usb device

Committer:
ppo
Date:
Sat May 14 17:24:10 2022 +0000
Revision:
0:c1e89c49eae5
commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ppo 0:c1e89c49eae5 1 /* Copyright (c) 2010-2011 mbed.org, MIT License
ppo 0:c1e89c49eae5 2 *
ppo 0:c1e89c49eae5 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
ppo 0:c1e89c49eae5 4 * and associated documentation files (the "Software"), to deal in the Software without
ppo 0:c1e89c49eae5 5 * restriction, including without limitation the rights to use, copy, modify, merge, publish,
ppo 0:c1e89c49eae5 6 * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
ppo 0:c1e89c49eae5 7 * Software is furnished to do so, subject to the following conditions:
ppo 0:c1e89c49eae5 8 *
ppo 0:c1e89c49eae5 9 * The above copyright notice and this permission notice shall be included in all copies or
ppo 0:c1e89c49eae5 10 * substantial portions of the Software.
ppo 0:c1e89c49eae5 11 *
ppo 0:c1e89c49eae5 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
ppo 0:c1e89c49eae5 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
ppo 0:c1e89c49eae5 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
ppo 0:c1e89c49eae5 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
ppo 0:c1e89c49eae5 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
ppo 0:c1e89c49eae5 17 */
ppo 0:c1e89c49eae5 18
ppo 0:c1e89c49eae5 19 #include "stdint.h"
ppo 0:c1e89c49eae5 20 #include "USBCDC.h"
ppo 0:c1e89c49eae5 21
ppo 0:c1e89c49eae5 22 //static uint8_t cdc_line_coding[7]= {0x80, 0x25, 0x00, 0x00, 0x00, 0x00, 0x08};
ppo 0:c1e89c49eae5 23
ppo 0:c1e89c49eae5 24 #define DEFAULT_CONFIGURATION (1)
ppo 0:c1e89c49eae5 25
ppo 0:c1e89c49eae5 26 /*
ppo 0:c1e89c49eae5 27 #define CDC_SET_LINE_CODING 0x20
ppo 0:c1e89c49eae5 28 #define CDC_GET_LINE_CODING 0x21
ppo 0:c1e89c49eae5 29 #define CDC_SET_CONTROL_LINE_STATE 0x22
ppo 0:c1e89c49eae5 30 */
ppo 0:c1e89c49eae5 31
ppo 0:c1e89c49eae5 32 #define MAX_CDC_REPORT_SIZE MAX_PACKET_SIZE_EPBULK
ppo 0:c1e89c49eae5 33
ppo 0:c1e89c49eae5 34 USBCDC::USBCDC(uint16_t vendor_id, uint16_t product_id, uint16_t product_release): USBDevice(vendor_id, product_id, product_release) {
ppo 0:c1e89c49eae5 35 //USBDevice::connect();
ppo 0:c1e89c49eae5 36 }
ppo 0:c1e89c49eae5 37 /*
ppo 0:c1e89c49eae5 38 bool USBCDC::USBCallback_request(void) {
ppo 0:c1e89c49eae5 39 // Called in ISR context
ppo 0:c1e89c49eae5 40
ppo 0:c1e89c49eae5 41 bool success = false;
ppo 0:c1e89c49eae5 42 CONTROL_TRANSFER * transfer = getTransferPtr();
ppo 0:c1e89c49eae5 43
ppo 0:c1e89c49eae5 44 // Process class-specific requests
ppo 0:c1e89c49eae5 45
ppo 0:c1e89c49eae5 46 if (transfer->setup.bmRequestType.Type == CLASS_TYPE) {
ppo 0:c1e89c49eae5 47 switch (transfer->setup.bRequest) {
ppo 0:c1e89c49eae5 48 case CDC_GET_LINE_CODING:
ppo 0:c1e89c49eae5 49 transfer->remaining = 7;
ppo 0:c1e89c49eae5 50 transfer->ptr = cdc_line_coding;
ppo 0:c1e89c49eae5 51 transfer->direction = DEVICE_TO_HOST;
ppo 0:c1e89c49eae5 52 success = true;
ppo 0:c1e89c49eae5 53 break;
ppo 0:c1e89c49eae5 54 case CDC_SET_LINE_CODING:
ppo 0:c1e89c49eae5 55 // pc.printf("set line coding\n");
ppo 0:c1e89c49eae5 56 // for (int i = 0; i < 7 ; i++) {pc.printf (" %x ",*(transfer->ptr+i)); cdc_line_coding[i] = *(transfer->ptr+i);}
ppo 0:c1e89c49eae5 57 //pc.printf ("\n");
ppo 0:c1e89c49eae5 58 transfer->remaining = 7;
ppo 0:c1e89c49eae5 59 success = true;
ppo 0:c1e89c49eae5 60 break;
ppo 0:c1e89c49eae5 61 case CDC_SET_CONTROL_LINE_STATE:
ppo 0:c1e89c49eae5 62 success = true;
ppo 0:c1e89c49eae5 63 break;
ppo 0:c1e89c49eae5 64 default:
ppo 0:c1e89c49eae5 65 break;
ppo 0:c1e89c49eae5 66 }
ppo 0:c1e89c49eae5 67 }
ppo 0:c1e89c49eae5 68
ppo 0:c1e89c49eae5 69 return success;
ppo 0:c1e89c49eae5 70 }
ppo 0:c1e89c49eae5 71 */
ppo 0:c1e89c49eae5 72
ppo 0:c1e89c49eae5 73 // Called in ISR context
ppo 0:c1e89c49eae5 74 // Set configuration. Return false if the
ppo 0:c1e89c49eae5 75 // configuration is not supported.
ppo 0:c1e89c49eae5 76 bool USBCDC::USBCallback_setConfiguration(uint8_t configuration) {
ppo 0:c1e89c49eae5 77 if (configuration != DEFAULT_CONFIGURATION) {
ppo 0:c1e89c49eae5 78 return false;
ppo 0:c1e89c49eae5 79 }
ppo 0:c1e89c49eae5 80
ppo 0:c1e89c49eae5 81 // Configure endpoints > 0
ppo 0:c1e89c49eae5 82 addEndpoint(EPINT_IN, MAX_PACKET_SIZE_EPINT);
ppo 0:c1e89c49eae5 83 addEndpoint(EPBULK_IN, MAX_PACKET_SIZE_EPBULK);
ppo 0:c1e89c49eae5 84 addEndpoint(EPBULK_OUT, MAX_PACKET_SIZE_EPBULK);
ppo 0:c1e89c49eae5 85
ppo 0:c1e89c49eae5 86 // We activate the endpoint to be able to recceive data
ppo 0:c1e89c49eae5 87 readStart(EPBULK_OUT, MAX_PACKET_SIZE_EPBULK);
ppo 0:c1e89c49eae5 88 return true;
ppo 0:c1e89c49eae5 89 }
ppo 0:c1e89c49eae5 90
ppo 0:c1e89c49eae5 91 bool USBCDC::send(uint8_t * buffer, uint32_t size) {
ppo 0:c1e89c49eae5 92 return USBDevice::write(EPBULK_IN, buffer, size, MAX_CDC_REPORT_SIZE);
ppo 0:c1e89c49eae5 93 }
ppo 0:c1e89c49eae5 94
ppo 0:c1e89c49eae5 95 bool USBCDC::readEP(uint8_t * buffer, uint32_t * size) {
ppo 0:c1e89c49eae5 96 if (!USBDevice::readEP(EPBULK_OUT, buffer, size, MAX_CDC_REPORT_SIZE))
ppo 0:c1e89c49eae5 97 return false;
ppo 0:c1e89c49eae5 98 if (!readStart(EPBULK_OUT, MAX_CDC_REPORT_SIZE))
ppo 0:c1e89c49eae5 99 return false;
ppo 0:c1e89c49eae5 100 return true;
ppo 0:c1e89c49eae5 101 }
ppo 0:c1e89c49eae5 102
ppo 0:c1e89c49eae5 103 bool USBCDC::readEP_NB(uint8_t * buffer, uint32_t * size) {
ppo 0:c1e89c49eae5 104 if (!USBDevice::readEP_NB(EPBULK_OUT, buffer, size, MAX_CDC_REPORT_SIZE))
ppo 0:c1e89c49eae5 105 return false;
ppo 0:c1e89c49eae5 106 if (!readStart(EPBULK_OUT, MAX_CDC_REPORT_SIZE))
ppo 0:c1e89c49eae5 107 return false;
ppo 0:c1e89c49eae5 108 return true;
ppo 0:c1e89c49eae5 109 }
ppo 0:c1e89c49eae5 110
ppo 0:c1e89c49eae5 111
ppo 0:c1e89c49eae5 112 uint8_t * USBCDC::deviceDesc() {
ppo 0:c1e89c49eae5 113 static uint8_t deviceDescriptor[] = {
ppo 0:c1e89c49eae5 114 18, // bLength
ppo 0:c1e89c49eae5 115 1, // bDescriptorType
ppo 0:c1e89c49eae5 116 0x00, 0x02, // bcdUSB
ppo 0:c1e89c49eae5 117 2, // bDeviceClass
ppo 0:c1e89c49eae5 118 0, // bDeviceSubClass
ppo 0:c1e89c49eae5 119 0, // bDeviceProtocol
ppo 0:c1e89c49eae5 120 MAX_PACKET_SIZE_EP0, // bMaxPacketSize0
ppo 0:c1e89c49eae5 121 LSB(VENDOR_ID), MSB(VENDOR_ID), // idVendor
ppo 0:c1e89c49eae5 122 LSB(PRODUCT_ID), MSB(PRODUCT_ID),// idProduct
ppo 0:c1e89c49eae5 123 0x00, 0x01, // bcdDevice
ppo 0:c1e89c49eae5 124 1, // iManufacturer
ppo 0:c1e89c49eae5 125 2, // iProduct
ppo 0:c1e89c49eae5 126 3, // iSerialNumber
ppo 0:c1e89c49eae5 127 1 // bNumConfigurations
ppo 0:c1e89c49eae5 128 };
ppo 0:c1e89c49eae5 129 return deviceDescriptor;
ppo 0:c1e89c49eae5 130 }
ppo 0:c1e89c49eae5 131
ppo 0:c1e89c49eae5 132 uint8_t * USBCDC::stringIinterfaceDesc() {
ppo 0:c1e89c49eae5 133 static uint8_t stringIinterfaceDescriptor[] = {
ppo 0:c1e89c49eae5 134 0x08,
ppo 0:c1e89c49eae5 135 STRING_DESCRIPTOR,
ppo 0:c1e89c49eae5 136 'C',0,'D',0,'C',0,
ppo 0:c1e89c49eae5 137 };
ppo 0:c1e89c49eae5 138 return stringIinterfaceDescriptor;
ppo 0:c1e89c49eae5 139 }
ppo 0:c1e89c49eae5 140
ppo 0:c1e89c49eae5 141 uint8_t * USBCDC::stringIproductDesc() {
ppo 0:c1e89c49eae5 142 static uint8_t stringIproductDescriptor[] = {
ppo 0:c1e89c49eae5 143 0x16,
ppo 0:c1e89c49eae5 144 STRING_DESCRIPTOR,
ppo 0:c1e89c49eae5 145 'C',0,'D',0,'C',0,' ',0,'D',0,'E',0,'V',0,'I',0,'C',0,'E',0
ppo 0:c1e89c49eae5 146 };
ppo 0:c1e89c49eae5 147 return stringIproductDescriptor;
ppo 0:c1e89c49eae5 148 }
ppo 0:c1e89c49eae5 149
ppo 0:c1e89c49eae5 150
ppo 0:c1e89c49eae5 151 #define CONFIG1_DESC_SIZE (9+9+5+5+4+5+7+9+7+7)
ppo 0:c1e89c49eae5 152
ppo 0:c1e89c49eae5 153 uint8_t * USBCDC::configurationDesc() {
ppo 0:c1e89c49eae5 154 static uint8_t configDescriptor[] = {
ppo 0:c1e89c49eae5 155 9, // bLength;
ppo 0:c1e89c49eae5 156 2, // bDescriptorType;
ppo 0:c1e89c49eae5 157 LSB(CONFIG1_DESC_SIZE), // wTotalLength
ppo 0:c1e89c49eae5 158 MSB(CONFIG1_DESC_SIZE),
ppo 0:c1e89c49eae5 159 2, // bNumInterfaces
ppo 0:c1e89c49eae5 160 1, // bConfigurationValue
ppo 0:c1e89c49eae5 161 0, // iConfiguration
ppo 0:c1e89c49eae5 162 0x80, // bmAttributes
ppo 0:c1e89c49eae5 163 50, // bMaxPower
ppo 0:c1e89c49eae5 164
ppo 0:c1e89c49eae5 165 // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
ppo 0:c1e89c49eae5 166 9, // bLength
ppo 0:c1e89c49eae5 167 4, // bDescriptorType
ppo 0:c1e89c49eae5 168 0, // bInterfaceNumber
ppo 0:c1e89c49eae5 169 0, // bAlternateSetting
ppo 0:c1e89c49eae5 170 1, // bNumEndpoints
ppo 0:c1e89c49eae5 171 0x02, // bInterfaceClass
ppo 0:c1e89c49eae5 172 0x02, // bInterfaceSubClass
ppo 0:c1e89c49eae5 173 0x00, // bInterfaceProtocol
ppo 0:c1e89c49eae5 174 0, // iInterface
ppo 0:c1e89c49eae5 175
ppo 0:c1e89c49eae5 176 // CDC Header Functional Descriptor, CDC Spec 5.2.3.1, Table 26
ppo 0:c1e89c49eae5 177 5, // bFunctionLength
ppo 0:c1e89c49eae5 178 0x24, // bDescriptorType
ppo 0:c1e89c49eae5 179 0x00, // bDescriptorSubtype
ppo 0:c1e89c49eae5 180 0x10, 0x01, // bcdCDC
ppo 0:c1e89c49eae5 181
ppo 0:c1e89c49eae5 182 // Call Management Functional Descriptor, CDC Spec 5.2.3.2, Table 27
ppo 0:c1e89c49eae5 183 5, // bFunctionLength
ppo 0:c1e89c49eae5 184 0x24, // bDescriptorType
ppo 0:c1e89c49eae5 185 0x01, // bDescriptorSubtype
ppo 0:c1e89c49eae5 186 0x01, // bmCapabilities
ppo 0:c1e89c49eae5 187 1, // bDataInterface
ppo 0:c1e89c49eae5 188
ppo 0:c1e89c49eae5 189 // Abstract Control Management Functional Descriptor, CDC Spec 5.2.3.3, Table 28
ppo 0:c1e89c49eae5 190 4, // bFunctionLength
ppo 0:c1e89c49eae5 191 0x24, // bDescriptorType
ppo 0:c1e89c49eae5 192 0x02, // bDescriptorSubtype
ppo 0:c1e89c49eae5 193 0x02, // bmCapabilities
ppo 0:c1e89c49eae5 194
ppo 0:c1e89c49eae5 195 // Union Functional Descriptor, CDC Spec 5.2.3.8, Table 33
ppo 0:c1e89c49eae5 196 5, // bFunctionLength
ppo 0:c1e89c49eae5 197 0x24, // bDescriptorType
ppo 0:c1e89c49eae5 198 0x06, // bDescriptorSubtype
ppo 0:c1e89c49eae5 199 0, // bMasterInterface
ppo 0:c1e89c49eae5 200 1, // bSlaveInterface0
ppo 0:c1e89c49eae5 201
ppo 0:c1e89c49eae5 202 // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
ppo 0:c1e89c49eae5 203 ENDPOINT_DESCRIPTOR_LENGTH, // bLength
ppo 0:c1e89c49eae5 204 ENDPOINT_DESCRIPTOR, // bDescriptorType
ppo 0:c1e89c49eae5 205 PHY_TO_DESC(EPINT_IN), // bEndpointAddress
ppo 0:c1e89c49eae5 206 E_INTERRUPT, // bmAttributes (0x03=intr)
ppo 0:c1e89c49eae5 207 LSB(MAX_PACKET_SIZE_EPINT), // wMaxPacketSize (LSB)
ppo 0:c1e89c49eae5 208 MSB(MAX_PACKET_SIZE_EPINT), // wMaxPacketSize (MSB)
ppo 0:c1e89c49eae5 209 16, // bInterval
ppo 0:c1e89c49eae5 210
ppo 0:c1e89c49eae5 211
ppo 0:c1e89c49eae5 212
ppo 0:c1e89c49eae5 213
ppo 0:c1e89c49eae5 214 // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
ppo 0:c1e89c49eae5 215 9, // bLength
ppo 0:c1e89c49eae5 216 4, // bDescriptorType
ppo 0:c1e89c49eae5 217 1, // bInterfaceNumber
ppo 0:c1e89c49eae5 218 0, // bAlternateSetting
ppo 0:c1e89c49eae5 219 2, // bNumEndpoints
ppo 0:c1e89c49eae5 220 0x0A, // bInterfaceClass
ppo 0:c1e89c49eae5 221 0x00, // bInterfaceSubClass
ppo 0:c1e89c49eae5 222 0x00, // bInterfaceProtocol
ppo 0:c1e89c49eae5 223 0, // iInterface
ppo 0:c1e89c49eae5 224
ppo 0:c1e89c49eae5 225 // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
ppo 0:c1e89c49eae5 226 7, // bLength
ppo 0:c1e89c49eae5 227 5, // bDescriptorType
ppo 0:c1e89c49eae5 228 PHY_TO_DESC(EPBULK_IN), // bEndpointAddress
ppo 0:c1e89c49eae5 229 0x02, // bmAttributes (0x02=bulk)
ppo 0:c1e89c49eae5 230 LSB(MAX_PACKET_SIZE_EPBULK), // wMaxPacketSize (LSB)
ppo 0:c1e89c49eae5 231 MSB(MAX_PACKET_SIZE_EPBULK), // wMaxPacketSize (MSB)
ppo 0:c1e89c49eae5 232 0, // bInterval
ppo 0:c1e89c49eae5 233
ppo 0:c1e89c49eae5 234 // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
ppo 0:c1e89c49eae5 235 7, // bLength
ppo 0:c1e89c49eae5 236 5, // bDescriptorType
ppo 0:c1e89c49eae5 237 PHY_TO_DESC(EPBULK_OUT),// bEndpointAddress
ppo 0:c1e89c49eae5 238 0x02, // bmAttributes (0x02=bulk)
ppo 0:c1e89c49eae5 239 LSB(MAX_PACKET_SIZE_EPBULK), // wMaxPacketSize (LSB)
ppo 0:c1e89c49eae5 240 MSB(MAX_PACKET_SIZE_EPBULK), // wMaxPacketSize (MSB)
ppo 0:c1e89c49eae5 241 0 // bInterval
ppo 0:c1e89c49eae5 242 };
ppo 0:c1e89c49eae5 243 return configDescriptor;
ppo 0:c1e89c49eae5 244 }
ppo 0:c1e89c49eae5 245 /*
ppo 0:c1e89c49eae5 246 uint8_t * USBCDC::configurationDesc() {
ppo 0:c1e89c49eae5 247 static uint8_t configDescriptor[] = {
ppo 0:c1e89c49eae5 248 9, // bLength;
ppo 0:c1e89c49eae5 249 2, // bDescriptorType;
ppo 0:c1e89c49eae5 250 LSB(CONFIG1_DESC_SIZE), // wTotalLength
ppo 0:c1e89c49eae5 251 MSB(CONFIG1_DESC_SIZE),
ppo 0:c1e89c49eae5 252 2, // bNumInterfaces
ppo 0:c1e89c49eae5 253 1, // bConfigurationValue
ppo 0:c1e89c49eae5 254 0, // iConfiguration
ppo 0:c1e89c49eae5 255 0x80, // bmAttributes
ppo 0:c1e89c49eae5 256 50, // bMaxPower
ppo 0:c1e89c49eae5 257
ppo 0:c1e89c49eae5 258 // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
ppo 0:c1e89c49eae5 259 9, // bLength
ppo 0:c1e89c49eae5 260 4, // bDescriptorType
ppo 0:c1e89c49eae5 261 0, // bInterfaceNumber
ppo 0:c1e89c49eae5 262 0, // bAlternateSetting
ppo 0:c1e89c49eae5 263 1, // bNumEndpoints
ppo 0:c1e89c49eae5 264 0x02, // bInterfaceClass
ppo 0:c1e89c49eae5 265 0x02, // bInterfaceSubClass
ppo 0:c1e89c49eae5 266 0x01, // bInterfaceProtocol
ppo 0:c1e89c49eae5 267 0, // iInterface
ppo 0:c1e89c49eae5 268
ppo 0:c1e89c49eae5 269 // CDC Header Functional Descriptor, CDC Spec 5.2.3.1, Table 26
ppo 0:c1e89c49eae5 270 5, // bFunctionLength
ppo 0:c1e89c49eae5 271 0x24, // bDescriptorType
ppo 0:c1e89c49eae5 272 0x00, // bDescriptorSubtype
ppo 0:c1e89c49eae5 273 0x10, 0x01, // bcdCDC
ppo 0:c1e89c49eae5 274
ppo 0:c1e89c49eae5 275 // Call Management Functional Descriptor, CDC Spec 5.2.3.2, Table 27
ppo 0:c1e89c49eae5 276 5, // bFunctionLength
ppo 0:c1e89c49eae5 277 0x24, // bDescriptorType
ppo 0:c1e89c49eae5 278 0x01, // bDescriptorSubtype
ppo 0:c1e89c49eae5 279 0x03, // bmCapabilities
ppo 0:c1e89c49eae5 280 1, // bDataInterface
ppo 0:c1e89c49eae5 281
ppo 0:c1e89c49eae5 282 // Abstract Control Management Functional Descriptor, CDC Spec 5.2.3.3, Table 28
ppo 0:c1e89c49eae5 283 4, // bFunctionLength
ppo 0:c1e89c49eae5 284 0x24, // bDescriptorType
ppo 0:c1e89c49eae5 285 0x02, // bDescriptorSubtype
ppo 0:c1e89c49eae5 286 0x06, // bmCapabilities
ppo 0:c1e89c49eae5 287
ppo 0:c1e89c49eae5 288 // Union Functional Descriptor, CDC Spec 5.2.3.8, Table 33
ppo 0:c1e89c49eae5 289 5, // bFunctionLength
ppo 0:c1e89c49eae5 290 0x24, // bDescriptorType
ppo 0:c1e89c49eae5 291 0x06, // bDescriptorSubtype
ppo 0:c1e89c49eae5 292 0, // bMasterInterface
ppo 0:c1e89c49eae5 293 1, // bSlaveInterface0
ppo 0:c1e89c49eae5 294
ppo 0:c1e89c49eae5 295 // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
ppo 0:c1e89c49eae5 296 ENDPOINT_DESCRIPTOR_LENGTH, // bLength
ppo 0:c1e89c49eae5 297 ENDPOINT_DESCRIPTOR, // bDescriptorType
ppo 0:c1e89c49eae5 298 PHY_TO_DESC(EPINT_IN), // bEndpointAddress
ppo 0:c1e89c49eae5 299 E_INTERRUPT, // bmAttributes (0x03=intr)
ppo 0:c1e89c49eae5 300 LSB(MAX_PACKET_SIZE_EPINT), // wMaxPacketSize (LSB)
ppo 0:c1e89c49eae5 301 MSB(MAX_PACKET_SIZE_EPINT), // wMaxPacketSize (MSB)
ppo 0:c1e89c49eae5 302 16, // bInterval
ppo 0:c1e89c49eae5 303
ppo 0:c1e89c49eae5 304
ppo 0:c1e89c49eae5 305
ppo 0:c1e89c49eae5 306
ppo 0:c1e89c49eae5 307 // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
ppo 0:c1e89c49eae5 308 9, // bLength
ppo 0:c1e89c49eae5 309 4, // bDescriptorType
ppo 0:c1e89c49eae5 310 1, // bInterfaceNumber
ppo 0:c1e89c49eae5 311 0, // bAlternateSetting
ppo 0:c1e89c49eae5 312 2, // bNumEndpoints
ppo 0:c1e89c49eae5 313 0x0A, // bInterfaceClass
ppo 0:c1e89c49eae5 314 0x00, // bInterfaceSubClass
ppo 0:c1e89c49eae5 315 0x00, // bInterfaceProtocol
ppo 0:c1e89c49eae5 316 0, // iInterface
ppo 0:c1e89c49eae5 317
ppo 0:c1e89c49eae5 318 // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
ppo 0:c1e89c49eae5 319 7, // bLength
ppo 0:c1e89c49eae5 320 5, // bDescriptorType
ppo 0:c1e89c49eae5 321 PHY_TO_DESC(EPBULK_IN), // bEndpointAddress
ppo 0:c1e89c49eae5 322 0x02, // bmAttributes (0x02=bulk)
ppo 0:c1e89c49eae5 323 LSB(MAX_PACKET_SIZE_EPBULK), // wMaxPacketSize (LSB)
ppo 0:c1e89c49eae5 324 MSB(MAX_PACKET_SIZE_EPBULK), // wMaxPacketSize (MSB)
ppo 0:c1e89c49eae5 325 0, // bInterval
ppo 0:c1e89c49eae5 326
ppo 0:c1e89c49eae5 327 // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
ppo 0:c1e89c49eae5 328 7, // bLength
ppo 0:c1e89c49eae5 329 5, // bDescriptorType
ppo 0:c1e89c49eae5 330 PHY_TO_DESC(EPBULK_OUT),// bEndpointAddress
ppo 0:c1e89c49eae5 331 0x02, // bmAttributes (0x02=bulk)
ppo 0:c1e89c49eae5 332 LSB(MAX_PACKET_SIZE_EPBULK), // wMaxPacketSize (LSB)
ppo 0:c1e89c49eae5 333 MSB(MAX_PACKET_SIZE_EPBULK), // wMaxPacketSize (MSB)
ppo 0:c1e89c49eae5 334 0 // bInterval
ppo 0:c1e89c49eae5 335 };
ppo 0:c1e89c49eae5 336 return configDescriptor;
ppo 0:c1e89c49eae5 337 }
ppo 0:c1e89c49eae5 338 */