aboutsummaryrefslogtreecommitdiffstats
path: root/firmware/include_sam3s/USBD_Config.h
blob: 256262c312ce800adbd01a95a26aa7732990f8fb (plain)
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
/* ----------------------------------------------------------------------------
 *         ATMEL Microcontroller Software Support
 * ----------------------------------------------------------------------------
 * Copyright (c) 2008, Atmel Corporation
 *
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * - Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the disclaimer below.
 *
 * Atmel's name may not be used to endorse or promote products derived from
 * this software without specific prior written permission.
 *
 * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
 * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * ----------------------------------------------------------------------------
 */

/**
 * \file
 *
 * USB Device Framework configurations.
 *
 */

#ifndef USBD_CONFIG_H
#define USBD_CONFIG_H

/*----------------------------------------------------------------------------
 *      Headers
 *----------------------------------------------------------------------------*/

/** \addtogroup usbd_config
 *@{
 */
/*----------------------------------------------------------------------------
 *      Constants
 *----------------------------------------------------------------------------*/

/** \addtogroup usbd_ids USBD Device IDs
 *      @{
 */
#define USBD_VID_ATMEL              0x03EB  /**< Vendor ID: Atmel */

#define USBD_PID_ENUM               0x0001  /**< Product ID: Enum (Core) */
#define USBD_PID_CDCDSERIAL         0x6119  /**< Product ID: CDC Serial */
#define USBD_PID_HIDKEYBOARD        0x6127  /**< Product ID: HID Keyboard */
#define USBD_PID_AUDIO              0x6128  /**< Product ID: Audio devices */
#define USBD_PID_MSD                0x6129  /**< Product ID: Massstorage */
#define USBD_PID_CDCHID             0x6130  /**< Product ID: composite */
#define USBD_PID_CDCAUDIO           0x6131  /**< Product ID: composite */
#define USBD_PID_CDCMSD             0x6132  /**< Product ID: composite */
#define USBD_PID_CDCCDC             0x6133  /**< Product ID: composite */
#define USBD_PID_HIDAUDIO           0x6134  /**< Product ID: composite */
#define USBD_PID_HIDMSD             0x6135  /**< Product ID: composite */
#define USBD_PID_HIDMOUSE           0x6200  /**< Product ID: HID Mouse */
#define USBD_PID_HIDTRANSFER        0x6201  /**< Product ID: HID Transfer */
#define USBD_PID_CCID               0x6203  /**< Product ID: CCID */

#define USBD_RELEASE_1_00           0x0100  /**< Release: 1.00 */
/**     @}*/

/** \addtogroup usbd_general_config USBD General Configure
 *      @{
 * This page lists general configurations for all USB device drivers.
 * - \ref USBD_BMATTRIBUTES
 */
/** default USB Device attributes configuration descriptor
 *  (bus or self powered, remote wakeup) */
#define USBD_BMATTRIBUTES           BOARD_USB_BMATTRIBUTES
/**     @}*/

/*----------------------------------------------------------------------------
 *      USB Device - Mass storage
 *----------------------------------------------------------------------------*/

/** \addtogroup usbd_msdd_config USB MassStorage Configure
 *      @{
 * This page lists the defines used by the Mass Storage driver.
 *
 * \section msd_ep_addr Endpoint Addresses
 * - \ref MSDDriverDescriptors_BULKOUT
 * - \ref MSDDriverDescriptors_BULKIN
 */
/** Address of the Mass Storage bulk-out endpoint.*/
#define MSDDriverDescriptors_BULKOUT                1
/** Address of the Mass Storage bulk-in endpoint.*/
#define MSDDriverDescriptors_BULKIN                 2
/**      @}*/

/*----------------------------------------------------------------------------
 *      USB Device - CDC Serial
 *----------------------------------------------------------------------------*/

/** \addtogroup usbd_cdc_serial_config USB CDC Serial Configure
 *      @{
 * This page lists the defines used by the CDC Serial Device Driver.
 *
 * \section cdcd_ep_addr Endpoint Addresses
 * - \ref CDCDSerialDriverDescriptors_DATAOUT
 * - \ref CDCDSerialDriverDescriptors_DATAIN
 * - \ref CDCDSerialDriverDescriptors_NOTIFICATION
 */
/** Data OUT endpoint number */
#define CDCDSerialDriverDescriptors_DATAOUT             1
/** Data IN endpoint number */
#define CDCDSerialDriverDescriptors_DATAIN              2
/** Notification endpoint number */
#define CDCDSerialDriverDescriptors_NOTIFICATION        3
/**      @}*/

/*----------------------------------------------------------------------------
 *      USB Device - Audio
 *----------------------------------------------------------------------------*/

/** \addtogroup usbd_audio_config USB Audio General Configure
 *      @{
 * This page lists definitions for USB Audio Devices Drivers.
 * - \ref
 */
#if defined(at91sam7s) || defined(at91sam9xe)
 /** Sample rate in Hz. */
 #define AUDDevice_SAMPLERATE        32000UL
 /** Number of channels in audio stream. */
 #define AUDDevice_NUMCHANNELS       1
 /** Number of bytes in one sample. */
 #define AUDDevice_BYTESPERSAMPLE    2
#else
 /** Sample rate in Hz. */
 #define AUDDevice_SAMPLERATE        48000UL
 /** Number of channels in audio stream. */
 #define AUDDevice_NUMCHANNELS       2
 /** Number of bytes in one sample. */
 #define AUDDevice_BYTESPERSAMPLE    2
#endif
/** Number of bits in one sample. */
#define AUDDevice_BITSPERSAMPLE     (AUDDevice_BYTESPERSAMPLE * 8)
/** Number of bytes in one USB subframe. */
#define AUDDevice_BYTESPERSUBFRAME  (AUDDevice_NUMCHANNELS * \
                                     AUDDevice_BYTESPERSAMPLE)
/** Number of samples in one USB frame. */
#define AUDDevice_SAMPLESPERFRAME   (AUDDevice_SAMPLERATE / 1000 \
                                     * AUDDevice_NUMCHANNELS)
/** Number of bytes in one USB frame. */
#define AUDDevice_BYTESPERFRAME     (AUDDevice_SAMPLESPERFRAME * \
                                     AUDDevice_BYTESPERSAMPLE)
/**     @}*/

/*----------------------------------------------------------------------------
 *      USB Device - Audio - Desktop Speaker
 *----------------------------------------------------------------------------*/

/** \addtogroup usbd_audio_speaker_config USB Speaker Configure
 *      @{
 * This page lists the definitions for USB Audio Speaker Device Driver.
 * - \ref AUDDSpeakerDriverDescriptors_DATAOUT
 * - \ref AUDDSpeakerDriverDescriptors_FS_INTERVAL
 * - \ref AUDDSpeakerDriverDescriptors_HS_INTERVAL
 *
 * \note for UDP, uses IN EPs that support double buffer; for UDPHS, uses
 *       IN EPs that support DMA and High bandwidth.
 */
/** Data out endpoint number. */
#define AUDDSpeakerDriverDescriptors_DATAOUT            0x04
/** Endpoint polling interval 2^(x-1) * 125us */
#define AUDDSpeakerDriverDescriptors_HS_INTERVAL        0x04
/** Endpoint polling interval 2^(x-1) * ms */
#define AUDDSpeakerDriverDescriptors_FS_INTERVAL        0x01
/**     @}*/

/*----------------------------------------------------------------------------
 *      USB Device - Audio - Speaker Phone
 *----------------------------------------------------------------------------*/

/** \addtogroup usbd_audio_speakerphone_config USB Speaker Phone Configure
 *      @{
 * This page lists the definitions for USB Audio Speaker Phone Device Driver.
 * - \ref AUDDSpeakerPhoneDriverDescriptors_DATAOUT
 * - \ref AUDDSpeakerPhoneDriverDescriptors_DATAIN
 * - \ref AUDDSpeakerPhoneDriverDescriptors_HS_INTERVAL
 * - \ref AUDDSpeakerPhoneDriverDescriptors_FS_INTERVAL
 */

#if defined(at91sam7s) || defined(at91sam9xe)
    /** Data out endpoint number, size 64B */
    #define AUDDSpeakerPhoneDriverDescriptors_DATAOUT        0x01
    /** Data in endpoint number, size 64B */
    #define AUDDSpeakerPhoneDriverDescriptors_DATAIN         0x02
#elif defined(CHIP_USB_UDP)
    /** Data out endpoint number, size 192B */
    #define AUDDSpeakerPhoneDriverDescriptors_DATAOUT        0x04
    /** Data in endpoint number, size 192B */
    #define AUDDSpeakerPhoneDriverDescriptors_DATAIN         0x05
#elif defined(at91sam9m10ek)
    /** Data out endpoint number, size 192B */
    #define AUDDSpeakerPhoneDriverDescriptors_DATAOUT        0x01
    /** Data in endpoint number, size 192B */
    #define AUDDSpeakerPhoneDriverDescriptors_DATAIN         0x06
#else
    /** Data out endpoint number, size 192B */
    #define AUDDSpeakerPhoneDriverDescriptors_DATAOUT        0x05
    /** Data in endpoint number, size 192B */
    #define AUDDSpeakerPhoneDriverDescriptors_DATAIN         0x06
#endif
/** Endpoint polling interval 2^(x-1) * 125us */
#define AUDDSpeakerPhoneDriverDescriptors_HS_INTERVAL        0x04
/** Endpoint polling interval 2^(x-1) * ms */
#define AUDDSpeakerPhoneDriverDescriptors_FS_INTERVAL        0x01
/**      @}*/

/*----------------------------------------------------------------------------
 *      USB Device - HID - Keyboard
 *----------------------------------------------------------------------------*/

/** \addtogroup usbd_hid_keyboard_config USB HID Keyboard Device Configure
 *      @{
 * This page lists the defines used by the HID Keyboard Device Driver.
 *
 * \section hidd_k_ep_addr Endpoint Addresses
 * - \ref HIDDKeyboardDriverDescriptors_INTERRUPTIN
 * - \ref HIDDKeyboardDriverDescriptors_INTERRUPTOUT
 * \section hidd_k_ep_polling Endpoint Polling Rate
 * - \ref HIDDKeyboardDriverDescriptors_INTERRUPTIN_POLLING
 * - \ref HIDDKeyboardDriverDescriptors_INTERRUPTOUT_POLLING
 */
/** Interrupt IN endpoint number */
#define HIDDKeyboardDriverDescriptors_INTERRUPTIN           1
/** Interrupt IN endpoint polling rate (in milliseconds) */
#define HIDDKeyboardDriverDescriptors_INTERRUPTIN_POLLING   10
/** Interrupt OUT endpoint number */
#define HIDDKeyboardDriverDescriptors_INTERRUPTOUT          2
/** Interrupt OUT endpoint polling rate (in milliseconds) */
#define HIDDKeyboardDriverDescriptors_INTERRUPTOUT_POLLING  10
/**     @}*/

/*----------------------------------------------------------------------------
 *      USB Device - HID  - Mouse
 *----------------------------------------------------------------------------*/

/** \addtogroup usbd_hid_mouse_config USB HID Mouse Device Configure
 *      @{
 * This page lists the defines used by the HID Mouse Device Driver.
 *
 * \section hidd_m_ep_addr Endpoint Addresses
 * - \ref HIDDMouseDriverDescriptors_INTERRUPTIN
 * \section hidd_m_ep_polling Endpoint Polling Rate
 * - \ref HIDDMouseDriverDescriptors_INTERRUPTIN_POLLING
 */
/** Interrupt IN endpoint number */
#define HIDDMouseDriverDescriptors_INTERRUPTIN           1
/** Interrupt IN endpoint polling rate (in milliseconds) */
#define HIDDMouseDriverDescriptors_INTERRUPTIN_POLLING   10
/**     @}*/

/*----------------------------------------------------------------------------
 *      USB Device - HID  - Transfer (Customize device)
 *----------------------------------------------------------------------------*/

/** \addtogroup usbd_hid_xfr_config USB HID Transfer Device Configure
 *      @{
 * This page lists the defines used by the HID Transfer Device Driver.
 *
 * \section hidd_t_ep_addr Endpoint Addresses
 * - \ref HIDDTransferDriverDescriptors_INTERRUPTIN
 * - \ref HIDDTransferDriverDescriptors_INTERRUPTOUT
 * \section hidd_t_ep_polling Endpoint Polling Rate
 * - \ref HIDDTransferDriverDescriptors_INTERRUPTIN_POLLING
 * - \ref HIDDTransferDriverDescriptors_INTERRUPTOUT_POLLING
 */
/** Interrupt IN endpoint number. */
#define HIDDTransferDriverDescriptors_INTERRUPTIN           1
/** Polling rate in ms */
#define HIDDTransferDriverDescriptors_INTERRUPTIN_POLLING   50
/** Interrupt IN endpoint polling rate (in milliseconds). */
#define HIDDTransferDriverDescriptors_INTERRUPTOUT          2
/** Polling rate in ms */
#define HIDDTransferDriverDescriptors_INTERRUPTOUT_POLLING  50
/**     @}*/

/*----------------------------------------------------------------------------
 *      USB Device - Composite
 *----------------------------------------------------------------------------*/

/** \addtogroup usbd_composite_config USB Composite Device Configure
 *  @{
 */
/** @}*/

/**@}*/
#endif //#ifndef USBD_CONFIG_H