00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #include <USBD_Config.h>
00038
00039 #include "DUALCDCDDriver.h"
00040
00041
00042
00043
00044
00045
00046
00047
00048 #define DUALCDCDDriverDescriptors_PRODUCTID USBD_PID_CDCCDC
00049
00050
00051 #define DUALCDCDDriverDescriptors_VENDORID USBD_VID_ATMEL
00052
00053
00054 #define DUALCDCDDriverDescriptors_RELEASE 0x0003
00055
00056
00057
00058
00059
00060
00061 #define MIN(a, b) ((a < b) ? a : b)
00062
00063
00064
00065
00066
00067
00068 static const USBDeviceDescriptor deviceDescriptor = {
00069
00070 sizeof(USBDeviceDescriptor),
00071 USBGenericDescriptor_DEVICE,
00072 USBDeviceDescriptor_USB2_00,
00073 0xEF,
00074 0x02,
00075 0x01,
00076 CHIP_USB_ENDPOINTS_MAXPACKETSIZE(0),
00077 DUALCDCDDriverDescriptors_VENDORID,
00078 DUALCDCDDriverDescriptors_PRODUCTID,
00079 DUALCDCDDriverDescriptors_RELEASE,
00080 0,
00081 1,
00082 0,
00083 1
00084 };
00085
00086
00087 static const USBDeviceQualifierDescriptor qualifierDescriptor = {
00088
00089 sizeof(USBDeviceQualifierDescriptor),
00090 USBGenericDescriptor_DEVICEQUALIFIER,
00091 USBDeviceDescriptor_USB2_00,
00092 0xEF,
00093 0x02,
00094 0x01,
00095 CHIP_USB_ENDPOINTS_MAXPACKETSIZE(0),
00096 0,
00097 0x00
00098 };
00099
00100
00101 static const DualCdcDriverConfigurationDescriptors configurationDescriptorsFS
00102 = {
00103
00104
00105 {
00106 sizeof(USBConfigurationDescriptor),
00107 USBGenericDescriptor_CONFIGURATION,
00108 sizeof(DualCdcDriverConfigurationDescriptors),
00109 DUALCDCDDriverDescriptors_NUMINTERFACE,
00110 1,
00111 0,
00112 USBD_BMATTRIBUTES,
00113 USBConfigurationDescriptor_POWER(100)
00114 },
00115
00116
00117
00118 {
00119 sizeof(USBInterfaceAssociationDescriptor),
00120 USBGenericDescriptor_INTERFACEASSOCIATION,
00121 DUALCDCDDriverDescriptors_INTERFACENUM0,
00122 2,
00123 CDCCommunicationInterfaceDescriptor_CLASS,
00124 CDCCommunicationInterfaceDescriptor_ABSTRACTCONTROLMODEL,
00125 CDCCommunicationInterfaceDescriptor_NOPROTOCOL,
00126 0
00127 },
00128
00129 {
00130 sizeof(USBInterfaceDescriptor),
00131 USBGenericDescriptor_INTERFACE,
00132 DUALCDCDDriverDescriptors_INTERFACENUM0,
00133 0,
00134 1,
00135 CDCCommunicationInterfaceDescriptor_CLASS,
00136 CDCCommunicationInterfaceDescriptor_ABSTRACTCONTROLMODEL,
00137 CDCCommunicationInterfaceDescriptor_NOPROTOCOL,
00138 0
00139 },
00140
00141 {
00142 sizeof(CDCHeaderDescriptor),
00143 CDCGenericDescriptor_INTERFACE,
00144 CDCGenericDescriptor_HEADER,
00145 CDCGenericDescriptor_CDC1_10
00146 },
00147
00148 {
00149 sizeof(CDCCallManagementDescriptor),
00150 CDCGenericDescriptor_INTERFACE,
00151 CDCGenericDescriptor_CALLMANAGEMENT,
00152 CDCCallManagementDescriptor_SELFCALLMANAGEMENT,
00153 DUALCDCDDriverDescriptors_INTERFACENUM0 + 1
00154 },
00155
00156 {
00157 sizeof(CDCAbstractControlManagementDescriptor),
00158 CDCGenericDescriptor_INTERFACE,
00159 CDCGenericDescriptor_ABSTRACTCONTROLMANAGEMENT,
00160 CDCAbstractControlManagementDescriptor_LINE
00161 },
00162
00163 {
00164 sizeof(CDCUnionDescriptor),
00165 CDCGenericDescriptor_INTERFACE,
00166 CDCGenericDescriptor_UNION,
00167 DUALCDCDDriverDescriptors_INTERFACENUM0,
00168 DUALCDCDDriverDescriptors_INTERFACENUM0 + 1
00169 },
00170
00171 {
00172 sizeof(USBEndpointDescriptor),
00173 USBGenericDescriptor_ENDPOINT,
00174 USBEndpointDescriptor_ADDRESS(USBEndpointDescriptor_IN,
00175 CDCD_Descriptors_NOTIFICATION0),
00176 USBEndpointDescriptor_INTERRUPT,
00177 MIN(CHIP_USB_ENDPOINTS_MAXPACKETSIZE(CDCD_Descriptors_NOTIFICATION0),
00178 USBEndpointDescriptor_MAXINTERRUPTSIZE_FS),
00179 CDCDSerialPort_INTERRUPT_INTERVAL_FS
00180 },
00181
00182 {
00183 sizeof(USBInterfaceDescriptor),
00184 USBGenericDescriptor_INTERFACE,
00185 DUALCDCDDriverDescriptors_INTERFACENUM0 + 1,
00186 0,
00187 2,
00188 CDCDataInterfaceDescriptor_CLASS,
00189 CDCDataInterfaceDescriptor_SUBCLASS,
00190 CDCDataInterfaceDescriptor_NOPROTOCOL,
00191 0
00192 },
00193
00194 {
00195 sizeof(USBEndpointDescriptor),
00196 USBGenericDescriptor_ENDPOINT,
00197 USBEndpointDescriptor_ADDRESS(USBEndpointDescriptor_OUT,
00198 CDCD_Descriptors_DATAOUT0),
00199 USBEndpointDescriptor_BULK,
00200 MIN(CHIP_USB_ENDPOINTS_MAXPACKETSIZE(CDCD_Descriptors_DATAOUT0),
00201 USBEndpointDescriptor_MAXBULKSIZE_FS),
00202 0
00203 },
00204
00205 {
00206 sizeof(USBEndpointDescriptor),
00207 USBGenericDescriptor_ENDPOINT,
00208 USBEndpointDescriptor_ADDRESS(USBEndpointDescriptor_IN,
00209 CDCD_Descriptors_DATAIN0),
00210 USBEndpointDescriptor_BULK,
00211 MIN(CHIP_USB_ENDPOINTS_MAXPACKETSIZE(CDCD_Descriptors_DATAIN0),
00212 USBEndpointDescriptor_MAXBULKSIZE_FS),
00213 0
00214 },
00215
00216
00217
00218 {
00219 sizeof(USBInterfaceAssociationDescriptor),
00220 USBGenericDescriptor_INTERFACEASSOCIATION,
00221 DUALCDCDDriverDescriptors_INTERFACENUM1,
00222 2,
00223 CDCCommunicationInterfaceDescriptor_CLASS,
00224 CDCCommunicationInterfaceDescriptor_ABSTRACTCONTROLMODEL,
00225 CDCCommunicationInterfaceDescriptor_NOPROTOCOL,
00226 0
00227 },
00228
00229 {
00230 sizeof(USBInterfaceDescriptor),
00231 USBGenericDescriptor_INTERFACE,
00232 DUALCDCDDriverDescriptors_INTERFACENUM1,
00233 0,
00234 1,
00235 CDCCommunicationInterfaceDescriptor_CLASS,
00236 CDCCommunicationInterfaceDescriptor_ABSTRACTCONTROLMODEL,
00237 CDCCommunicationInterfaceDescriptor_NOPROTOCOL,
00238 0
00239 },
00240
00241 {
00242 sizeof(CDCHeaderDescriptor),
00243 CDCGenericDescriptor_INTERFACE,
00244 CDCGenericDescriptor_HEADER,
00245 CDCGenericDescriptor_CDC1_10
00246 },
00247
00248 {
00249 sizeof(CDCCallManagementDescriptor),
00250 CDCGenericDescriptor_INTERFACE,
00251 CDCGenericDescriptor_CALLMANAGEMENT,
00252 CDCCallManagementDescriptor_SELFCALLMANAGEMENT,
00253 DUALCDCDDriverDescriptors_INTERFACENUM1 + 1
00254 },
00255
00256 {
00257 sizeof(CDCAbstractControlManagementDescriptor),
00258 CDCGenericDescriptor_INTERFACE,
00259 CDCGenericDescriptor_ABSTRACTCONTROLMANAGEMENT,
00260 CDCAbstractControlManagementDescriptor_LINE
00261 },
00262
00263 {
00264 sizeof(CDCUnionDescriptor),
00265 CDCGenericDescriptor_INTERFACE,
00266 CDCGenericDescriptor_UNION,
00267 DUALCDCDDriverDescriptors_INTERFACENUM1,
00268 DUALCDCDDriverDescriptors_INTERFACENUM1 + 1
00269 },
00270
00271 {
00272 sizeof(USBEndpointDescriptor),
00273 USBGenericDescriptor_ENDPOINT,
00274 USBEndpointDescriptor_ADDRESS(USBEndpointDescriptor_IN,
00275 CDCD_Descriptors_NOTIFICATION1),
00276 USBEndpointDescriptor_INTERRUPT,
00277 MIN(CHIP_USB_ENDPOINTS_MAXPACKETSIZE(CDCD_Descriptors_NOTIFICATION1),
00278 USBEndpointDescriptor_MAXINTERRUPTSIZE_FS),
00279 CDCDSerialPort_INTERRUPT_INTERVAL_FS
00280 },
00281
00282 {
00283 sizeof(USBInterfaceDescriptor),
00284 USBGenericDescriptor_INTERFACE,
00285 DUALCDCDDriverDescriptors_INTERFACENUM1 + 1,
00286 0,
00287 2,
00288 CDCDataInterfaceDescriptor_CLASS,
00289 CDCDataInterfaceDescriptor_SUBCLASS,
00290 CDCDataInterfaceDescriptor_NOPROTOCOL,
00291 0
00292 },
00293
00294 {
00295 sizeof(USBEndpointDescriptor),
00296 USBGenericDescriptor_ENDPOINT,
00297 USBEndpointDescriptor_ADDRESS(USBEndpointDescriptor_OUT,
00298 CDCD_Descriptors_DATAOUT1),
00299 USBEndpointDescriptor_BULK,
00300 MIN(CHIP_USB_ENDPOINTS_MAXPACKETSIZE(CDCD_Descriptors_DATAOUT1),
00301 USBEndpointDescriptor_MAXBULKSIZE_FS),
00302 0
00303 },
00304
00305 {
00306 sizeof(USBEndpointDescriptor),
00307 USBGenericDescriptor_ENDPOINT,
00308 USBEndpointDescriptor_ADDRESS(USBEndpointDescriptor_IN,
00309 CDCD_Descriptors_DATAIN1),
00310 USBEndpointDescriptor_BULK,
00311 MIN(CHIP_USB_ENDPOINTS_MAXPACKETSIZE(CDCD_Descriptors_DATAIN1),
00312 USBEndpointDescriptor_MAXBULKSIZE_FS),
00313 0
00314 }
00315 };
00316
00317
00318 static const unsigned char languageIdDescriptor[] = {
00319
00320 USBStringDescriptor_LENGTH(1),
00321 USBGenericDescriptor_STRING,
00322 USBStringDescriptor_ENGLISH_US
00323 };
00324
00325
00326 static const unsigned char manufacturerDescriptor[] = {
00327
00328 USBStringDescriptor_LENGTH(5),
00329 USBGenericDescriptor_STRING,
00330 USBStringDescriptor_UNICODE('A'),
00331 USBStringDescriptor_UNICODE('t'),
00332 USBStringDescriptor_UNICODE('m'),
00333 USBStringDescriptor_UNICODE('e'),
00334 USBStringDescriptor_UNICODE('l')
00335 };
00336
00337
00338 static const unsigned char productDescriptor[] = {
00339
00340 USBStringDescriptor_LENGTH(14),
00341 USBGenericDescriptor_STRING,
00342 USBStringDescriptor_UNICODE('C'),
00343 USBStringDescriptor_UNICODE('o'),
00344 USBStringDescriptor_UNICODE('m'),
00345 USBStringDescriptor_UNICODE('p'),
00346 USBStringDescriptor_UNICODE('o'),
00347 USBStringDescriptor_UNICODE('s'),
00348 USBStringDescriptor_UNICODE('i'),
00349 USBStringDescriptor_UNICODE('t'),
00350 USBStringDescriptor_UNICODE('e'),
00351 USBStringDescriptor_UNICODE(' '),
00352 USBStringDescriptor_UNICODE('D'),
00353 USBStringDescriptor_UNICODE('e'),
00354 USBStringDescriptor_UNICODE('m'),
00355 USBStringDescriptor_UNICODE('o')
00356 };
00357
00358
00359 static const unsigned char serialNumberDescriptor[] = {
00360
00361 USBStringDescriptor_LENGTH(4),
00362 USBGenericDescriptor_STRING,
00363 USBStringDescriptor_UNICODE('0'),
00364 USBStringDescriptor_UNICODE('1'),
00365 USBStringDescriptor_UNICODE('2'),
00366 USBStringDescriptor_UNICODE('3')
00367 };
00368
00369
00370 static const unsigned char *stringDescriptors[] = {
00371
00372 languageIdDescriptor,
00373 manufacturerDescriptor,
00374 productDescriptor,
00375 serialNumberDescriptor,
00376 };
00377
00378
00379
00380
00381
00382
00383 const USBDDriverDescriptors dualcdcdDriverDescriptors = {
00384
00385 &deviceDescriptor,
00386 (const USBConfigurationDescriptor *) &configurationDescriptorsFS,
00387 &qualifierDescriptor,
00388 0, 0, 0,
00389 &qualifierDescriptor, 0,
00390 stringDescriptors,
00391 4
00392 };
00393
00394