2 FreeRTOS.org V4.7.1 - Copyright (C) 2003-2008 Richard Barry.
\r
4 This file is part of the FreeRTOS.org distribution.
\r
6 FreeRTOS.org is free software; you can redistribute it and/or modify
\r
7 it under the terms of the GNU General Public License as published by
\r
8 the Free Software Foundation; either version 2 of the License, or
\r
9 (at your option) any later version.
\r
11 FreeRTOS.org is distributed in the hope that it will be useful,
\r
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
14 GNU General Public License for more details.
\r
16 You should have received a copy of the GNU General Public License
\r
17 along with FreeRTOS.org; if not, write to the Free Software
\r
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
\r
20 A special exception to the GPL can be applied should you wish to distribute
\r
21 a combined work that includes FreeRTOS.org, without being obliged to provide
\r
22 the source code for any proprietary components. See the licensing section
\r
23 of http://www.FreeRTOS.org for full details of how and when the exception
\r
26 ***************************************************************************
\r
28 Please ensure to read the configuration and relevant port sections of the
\r
29 online documentation.
\r
31 +++ http://www.FreeRTOS.org +++
\r
32 Documentation, latest information, license and contact details.
\r
34 +++ http://www.SafeRTOS.com +++
\r
35 A version that is certified for use in safety critical systems.
\r
37 +++ http://www.OpenRTOS.com +++
\r
38 Commercial support, development, porting, licensing and training services.
\r
40 ***************************************************************************
\r
43 /* Descriptor type definitions. */
\r
44 #define usbDESCRIPTOR_TYPE_DEVICE ( 0x01 )
\r
45 #define usbDESCRIPTOR_TYPE_CONFIGURATION ( 0x02 )
\r
46 #define usbDESCRIPTOR_TYPE_STRING ( 0x03 )
\r
48 /* USB request type definitions. */
\r
49 #define usbGET_REPORT_REQUEST ( 0x01 )
\r
50 #define usbGET_IDLE_REQUEST ( 0x02 )
\r
51 #define usbGET_PROTOCOL_REQUEST ( 0x03 )
\r
52 #define usbSET_REPORT_REQUEST ( 0x09 )
\r
53 #define usbSET_IDLE_REQUEST ( 0x0A )
\r
54 #define usbSET_PROTOCOL_REQUEST ( 0x0B )
\r
55 #define usbGET_CONFIGURATION_REQUEST ( 0x08 )
\r
56 #define usbGET_STATUS_REQUEST ( 0x00 )
\r
57 #define usbCLEAR_FEATURE_REQUEST ( 0x01 )
\r
58 #define usbSET_FEATURE_REQUEST ( 0x03 )
\r
59 #define usbSET_ADDRESS_REQUEST ( 0x05 )
\r
60 #define usbGET_DESCRIPTOR_REQUEST ( 0x06 )
\r
61 #define usbSET_CONFIGURATION_REQUEST ( 0x09 )
\r
62 #define usbGET_INTERFACE_REQUEST ( 0x0A )
\r
63 #define usbSET_INTERFACE_REQUEST ( 0x0B )
\r
66 #define usbSEND_ENCAPSULATED_COMMAND ( 0x00 )
\r
67 #define usbGET_ENCAPSULATED_RESPONSE ( 0x01 )
\r
68 #define usbSET_LINE_CODING ( 0x20 )
\r
69 #define usbGET_LINE_CODING ( 0x21 )
\r
70 #define usbSET_CONTROL_LINE_STATE ( 0x22 )
\r
72 /* Misc USB definitions. */
\r
73 #define usbDEVICE_CLASS_VENDOR_SPECIFIC ( 0xFF )
\r
74 #define usbBUS_POWERED ( 0x80 )
\r
75 #define usbHID_REPORT_DESCRIPTOR ( 0x22 )
\r
76 #define AT91C_UDP_TRANSCEIVER_ENABLE ( *( ( unsigned long * ) 0xfffb0074 ) )
\r
78 /* Index to the various string. */
\r
79 #define usbLANGUAGE_STRING ( 0 )
\r
80 #define usbMANUFACTURER_STRING ( 1 )
\r
81 #define usbPRODUCT_STRING ( 2 )
\r
82 #define usbCONFIGURATION_STRING ( 3 )
\r
83 #define usbINTERFACE_STRING ( 4 )
\r
85 /* Defines fields of standard SETUP request. Now in normal order. */
\r
86 #define usbREQUEST_TYPE_INDEX ( 0 )
\r
87 #define usbREQUEST_INDEX ( 1 )
\r
88 #define usbVALUE_HIGH_BYTE ( 3 )
\r
89 #define usbVALUE_LOW_BYTE ( 2 )
\r
90 #define usbINDEX_HIGH_BYTE ( 5 )
\r
91 #define usbINDEX_LOW_BYTE ( 4 )
\r
92 #define usbLENGTH_HIGH_BYTE ( 7 )
\r
93 #define usbLENGTH_LOW_BYTE ( 6 )
\r
95 /* Misc application definitions. */
\r
96 #define usbINTERRUPT_PRIORITY ( 3 )
\r
97 #define usbQUEUE_LENGTH ( 0x3 ) /* Must have all bits set! */
\r
98 #define usbFIFO_LENGTH ( ( unsigned portLONG ) 8 )
\r
99 #define usbEND_POINT_0 ( 0 )
\r
100 #define usbEND_POINT_1 ( 1 )
\r
101 #define usbEND_POINT_2 ( 2 )
\r
102 #define usbEND_POINT_3 ( 3 )
\r
103 #define usbMAX_CONTROL_MESSAGE_SIZE ( 128 )
\r
104 #define usbRX_COUNT_MASK ( ( unsigned portLONG ) 0x7ff )
\r
105 #define AT91C_UDP_STALLSENT AT91C_UDP_ISOERROR
\r
106 #define usbSHORTEST_DELAY ( ( portTickType ) 1 )
\r
107 #define usbINIT_DELAY ( ( portTickType ) 1000 / portTICK_RATE_MS )
\r
108 #define usbSHORT_DELAY ( ( portTickType ) 50 / portTICK_RATE_MS )
\r
109 #define usbEND_POINT_RESET_MASK ( ( unsigned portLONG ) 0x0f )
\r
110 #define usbDATA_INC ( ( portCHAR ) 5 )
\r
111 #define usbEXPECTED_NUMBER_OF_BYTES ( ( unsigned portLONG ) 8 )
\r
113 /* Control request types. */
\r
114 #define usbSTANDARD_DEVICE_REQUEST ( 0 )
\r
115 #define usbSTANDARD_INTERFACE_REQUEST ( 1 )
\r
116 #define usbSTANDARD_END_POINT_REQUEST ( 2 )
\r
117 #define usbCLASS_INTERFACE_REQUEST ( 5 )
\r
120 /* Macros to manipulate the control and status registers. These registers
\r
121 cannot be accessed using a direct read modify write operation outside of the
\r
122 ISR as some bits are left unchanged by writing with a 0, and some are left
\r
123 unchanged by writing with a 1. */
\r
126 #define usbCSR_SET_BIT( pulValueNow, ulBit ) \
\r
128 /* Set TXCOMP, RX_DATA_BK0, RXSETUP, */ \
\r
129 /* STALLSENT and RX_DATA_BK1 to 1 so the */ \
\r
130 /* write has no effect. */ \
\r
131 ( * ( ( unsigned portLONG * ) pulValueNow ) ) |= ( unsigned portLONG ) 0x4f; \
\r
133 /* Clear the FORCE_STALL and TXPKTRDY bits */ \
\r
134 /* so the write has no effect. */ \
\r
135 ( * ( ( unsigned portLONG * ) pulValueNow ) ) &= ( unsigned portLONG ) 0xffffffcf; \
\r
137 /* Set whichever bit we want set. */ \
\r
138 ( * ( ( unsigned portLONG * ) pulValueNow ) ) |= ( ulBit ); \
\r
141 #define usbCSR_CLEAR_BIT( pulValueNow, ulBit ) \
\r
143 /* Set TXCOMP, RX_DATA_BK0, RXSETUP, */ \
\r
144 /* STALLSENT and RX_DATA_BK1 to 1 so the */ \
\r
145 /* write has no effect. */ \
\r
146 ( * ( ( unsigned portLONG * ) pulValueNow ) ) |= ( unsigned portLONG ) 0x4f; \
\r
148 /* Clear the FORCE_STALL and TXPKTRDY bits */ \
\r
149 /* so the write has no effect. */ \
\r
150 ( * ( ( unsigned portLONG * ) pulValueNow ) ) &= ( unsigned portLONG ) 0xffffffcf; \
\r
152 /* Clear whichever bit we want clear. */ \
\r
153 ( * ( ( unsigned portLONG * ) pulValueNow ) ) &= ( ~ulBit ); \
\r