A copy of the mbed USBDevice with USBSerial library

Dependents:   STM32L0_LoRa Smartage STM32L0_LoRa Turtle_RadioShuttle

Committer:
Helmut Tschemernjak
Date:
Sun Feb 24 14:52:33 2019 +0100
Revision:
8:961423d1da74
Parent:
2:195554780c9b
Added sleep manager support to avoids sleeps while a USB CDC
connection is active

Who changed what in which revision?

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