Project

General

Profile

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