arc.h
5.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
#ifndef __arc_h__
#define __arc_h__
/*HEADER******************************************************************
**************************************************************************
***
*** Copyright (c) 2001-2002 ARC International.
*** All rights reserved
***
*** This software embodies materials and concepts which are
*** confidential to ARC International and is made
*** available solely pursuant to the terms of a written license
*** agreement with ARC International
***
*** $Workfile:arc.h$
*** $Revision: 1.1 $
*** $Date: 2003/02/17 20:49:01 $
***
*** Description:
*** This file contains ARC-specific defines.
***
**************************************************************************
*END*********************************************************************/
/*--------------------------------------------------------------------------*/
/*
** STANDARD TYPES
*/
/*
** The following typedefs allow us to minimize portability problems
** due to the various C compilers (even for the same processor) not
** agreeing on the sizes of "int"s and "short int"s and "longs".
*/
#define _PTR_ *
#define _CODE_PTR_ *
typedef char _PTR_ char_ptr; /* signed character */
typedef unsigned char uchar, _PTR_ uchar_ptr; /* unsigned character */
typedef signed char int_8, _PTR_ int_8_ptr; /* 8-bit signed integer */
typedef unsigned char uint_8, _PTR_ uint_8_ptr; /* 8-bit signed integer */
typedef short int_16, _PTR_ int_16_ptr; /* 16-bit signed integer */
typedef unsigned short uint_16, _PTR_ uint_16_ptr; /* 16-bit unsigned integer*/
typedef long int_32, _PTR_ int_32_ptr; /* 32-bit signed integer */
typedef unsigned long uint_32, _PTR_ uint_32_ptr; /* 32-bit unsigned integer*/
typedef unsigned long boolean; /* Machine representation of a boolean */
typedef void _PTR_ pointer; /* Machine representation of a pointer */
/* IEEE single precision floating point number (32 bits, 8 exponent bits) */
typedef float ieee_single;
/* IEEE double precision floating point number (64 bits, 11 exponent bits) */
typedef double ieee_double;
typedef pointer _usb_host_handle;
/*--------------------------------------------------------------------------*/
/*
** STANDARD CONSTANTS
**
** Note that if standard 'C' library files are included after types.h,
** the defines of TRUE, FALSE and NULL may sometimes conflict, as most
** standard library files do not check for previous definitions.
*/
#ifdef FALSE
#undef FALSE
#endif
#define FALSE ((boolean)0)
#ifdef TRUE
#undef TRUE
#endif
#define TRUE ((boolean)1)
#ifdef NULL
#undef NULL
#endif
#ifdef __cplusplus
#define NULL (0)
#else
#define NULL ((pointer)0)
#endif
typedef uint_32 VUSB_REGISTER;
#define BSP_VUSB11_HOST_BASE_ADDRESS0 (0xFC4080)
#define BSP_VUSB11_HOST_VECTOR0 (3)
#define ARC_JMP_TO_ADDR_INSTRN ((uint_32)(0x381F0000))
#define BSP_VUSB11_DEVICE_BASE_ADDRESS0 (0xFC4080)
#define BSP_VUSB11_DEVICE_VECTOR0 (3)
#define ARC_JMP_TO_ADDR_INSTRN ((uint_32)(0x381F0000))
#define BSP_VUSB11_OTG_BASE_ADDRESS0 (0xFC4080)
#define BSP_VUSB11_OTG_VECTOR0 (3)
#define BSP_VUSB11_OTG_USB_OFFSET (0x70)
/* The ARC is little-endian, just like USB */
#define USB_uint_16_low(x) ((x) & 0xFF)
#define USB_uint_16_high(x) (((x) >> 8) & 0xFF)
#ifndef __USB_OTG__
#if BSP_VUSB11_HOST_VECTOR0 < 6
#define HOST_INTERRUPT_ROUTINE_KEYWORD _Interrupt1
#else
#define HOST_INTERRUPT_ROUTINE_KEYWORD _Interrupt2
#endif
#if BSP_VUSB11_DEVICE_VECTOR0 < 6
#define DEVICE_INTERRUPT_ROUTINE_KEYWORD _Interrupt1
#else
#define DEVICE_INTERRUPT_ROUTINE_KEYWORD _Interrupt2
#endif
#endif
#if BSP_VUSB11_OTG_VECTOR0 < 6
#define OTG_INTERRUPT_ROUTINE_KEYWORD _Interrupt1
#else
#define OTG_INTERRUPT_ROUTINE_KEYWORD _Interrupt2
#endif
#ifdef __USB_OTG__
#define DEVICE_INTERRUPT_ROUTINE_KEYWORD
#define HOST_INTERRUPT_ROUTINE_KEYWORD
#define INTERRUPT_ROUTINE_KEYWORD OTG_INTERRUPT_ROUTINE_KEYWORD
#else
#define INTERRUPT_ROUTINE_KEYWORD HOST_INTERRUPT_ROUTINE_KEYWORD
#endif
#define VUSB_ARC_BDT_OUT_BIT (0x10)
#define VUSB_ARC_BDT_IN_BIT (0x00)
#define VUSB_ARC_BDT_ODD_EVEN_BIT (0x08)
#define VUSB_BDT_OUT_BIT (VUSB_ARC_BDT_OUT_BIT)
#define VUSB_BDT_IN_BIT (VUSB_ARC_BDT_IN_BIT)
#define VUSB_BDT_ODD_EVEN_BIT (VUSB_ARC_BDT_ODD_EVEN_BIT)
#define VUSB_GET_STATUS(BDT_ptr) (BDT_ptr->PID & VUSB_BD_PID_MASKS)
#define VUSB_GET_BYTE_COUNT(BDT_ptr) (BDT_ptr->BC)
#define VUSB_ENDPT_REG_OFFSET (0x40)
#define DISABLE_INTERRUPTS() _ASM(".equ DI,0");\
_ASM("flag DI")
#define ENABLE_INTERRUPTS() _ASM(".equ EI,6");\
_ASM("flag EI");
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __USB_OS_MQX__
extern void USB_int_install_isr(uint_8,
INTERRUPT_ROUTINE_KEYWORD void (_CODE_PTR_ )(void), pointer);
extern void _disable_interrupts(void);
extern void _enable_interrupts(void);
#endif
#ifdef __cplusplus
}
#endif
#endif