I changed one line of code in the file with path name: USBDeviceHT/targets/TARGET_Maxim
Fork of USBDeviceHT by
USBSerial/USBCDC.cpp@6:c1f162fd7777, 2018-06-01 (annotated)
- Committer:
- dev_alexander
- Date:
- Fri Jun 01 21:43:55 2018 +0000
- Revision:
- 6:c1f162fd7777
- Parent:
- 2:195554780c9b
Fixed Error with code not compiling due to an issue with there not being a (uint32_t) cast of a (void) pointer. Maxim was the only mbed vendor to not have this one (uint32_t) cast in the spot it was added to. Look into public repos for similar cases.
Who changed what in which revision?
User | Revision | Line number | New 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) { |
Helmut64 | 0:a3ea811f80f2 | 47 | terminal_connected = false; |
Helmut64 | 0:a3ea811f80f2 | 48 | }; |
Helmut64 | 0:a3ea811f80f2 | 49 | |
Helmut64 | 0:a3ea811f80f2 | 50 | bool USBCDC::USBCallback_request(void) { |
Helmut64 | 0:a3ea811f80f2 | 51 | /* Called in ISR context */ |
Helmut64 | 0:a3ea811f80f2 | 52 | |
Helmut64 | 0:a3ea811f80f2 | 53 | bool success = false; |
Helmut64 | 0:a3ea811f80f2 | 54 | CONTROL_TRANSFER * transfer = getTransferPtr(); |
Helmut64 | 0:a3ea811f80f2 | 55 | |
Helmut64 | 0:a3ea811f80f2 | 56 | /* Process class-specific requests */ |
Helmut64 | 0:a3ea811f80f2 | 57 | |
Helmut64 | 0:a3ea811f80f2 | 58 | if (transfer->setup.bmRequestType.Type == CLASS_TYPE) { |
Helmut64 | 0:a3ea811f80f2 | 59 | switch (transfer->setup.bRequest) { |
Helmut64 | 0:a3ea811f80f2 | 60 | case CDC_GET_LINE_CODING: |
Helmut64 | 0:a3ea811f80f2 | 61 | transfer->remaining = 7; |
Helmut64 | 0:a3ea811f80f2 | 62 | transfer->ptr = cdc_line_coding; |
Helmut64 | 0:a3ea811f80f2 | 63 | transfer->direction = DEVICE_TO_HOST; |
Helmut64 | 0:a3ea811f80f2 | 64 | success = true; |
Helmut64 | 0:a3ea811f80f2 | 65 | break; |
Helmut64 | 0:a3ea811f80f2 | 66 | case CDC_SET_LINE_CODING: |
Helmut64 | 0:a3ea811f80f2 | 67 | transfer->remaining = 7; |
Helmut64 | 0:a3ea811f80f2 | 68 | transfer->notify = true; |
Helmut64 | 0:a3ea811f80f2 | 69 | success = true; |
Helmut64 | 0:a3ea811f80f2 | 70 | break; |
Helmut64 | 0:a3ea811f80f2 | 71 | case CDC_SET_CONTROL_LINE_STATE: |
Helmut64 | 0:a3ea811f80f2 | 72 | if (transfer->setup.wValue & CLS_DTR) { |
Helmut64 | 0:a3ea811f80f2 | 73 | terminal_connected = true; |
Helmut64 | 0:a3ea811f80f2 | 74 | } else { |
Helmut64 | 0:a3ea811f80f2 | 75 | terminal_connected = false; |
Helmut64 | 0:a3ea811f80f2 | 76 | } |
Helmut64 | 0:a3ea811f80f2 | 77 | success = true; |
Helmut64 | 0:a3ea811f80f2 | 78 | break; |
Helmut64 | 0:a3ea811f80f2 | 79 | default: |
Helmut64 | 0:a3ea811f80f2 | 80 | break; |
Helmut64 | 0:a3ea811f80f2 | 81 | } |
Helmut64 | 0:a3ea811f80f2 | 82 | } |
Helmut64 | 0:a3ea811f80f2 | 83 | |
Helmut64 | 0:a3ea811f80f2 | 84 | return success; |
Helmut64 | 0:a3ea811f80f2 | 85 | } |
Helmut64 | 0:a3ea811f80f2 | 86 | |
Helmut64 | 0:a3ea811f80f2 | 87 | void USBCDC::USBCallback_requestCompleted(uint8_t *buf, uint32_t length) { |
Helmut64 | 0:a3ea811f80f2 | 88 | // Request of setting line coding has 7 bytes |
Helmut64 | 0:a3ea811f80f2 | 89 | if (length != 7) { |
Helmut64 | 0:a3ea811f80f2 | 90 | return; |
Helmut64 | 0:a3ea811f80f2 | 91 | } |
Helmut64 | 0:a3ea811f80f2 | 92 | |
Helmut64 | 0:a3ea811f80f2 | 93 | CONTROL_TRANSFER * transfer = getTransferPtr(); |
Helmut64 | 0:a3ea811f80f2 | 94 | |
Helmut64 | 0:a3ea811f80f2 | 95 | /* Process class-specific requests */ |
Helmut64 | 0:a3ea811f80f2 | 96 | if (transfer->setup.bmRequestType.Type == CLASS_TYPE) { |
Helmut64 | 0:a3ea811f80f2 | 97 | if (transfer->setup.bRequest == CDC_SET_LINE_CODING) { |
Helmut64 | 0:a3ea811f80f2 | 98 | if (memcmp(cdc_line_coding, buf, 7)) { |
Helmut64 | 0:a3ea811f80f2 | 99 | memcpy(cdc_line_coding, buf, 7); |
Helmut64 | 0:a3ea811f80f2 | 100 | |
Helmut64 | 0:a3ea811f80f2 | 101 | int baud = buf[0] + (buf[1] << 8) |
Helmut64 | 0:a3ea811f80f2 | 102 | + (buf[2] << 16) + (buf[3] << 24); |
Helmut64 | 0:a3ea811f80f2 | 103 | int stop = buf[4]; |
Helmut64 | 0:a3ea811f80f2 | 104 | int bits = buf[6]; |
Helmut64 | 0:a3ea811f80f2 | 105 | int parity = buf[5]; |
Helmut64 | 0:a3ea811f80f2 | 106 | |
Helmut64 | 0:a3ea811f80f2 | 107 | lineCodingChanged(baud, bits, parity, stop); |
Helmut64 | 0:a3ea811f80f2 | 108 | } |
Helmut64 | 0:a3ea811f80f2 | 109 | } |
Helmut64 | 0:a3ea811f80f2 | 110 | } |
Helmut64 | 0:a3ea811f80f2 | 111 | } |
Helmut64 | 0:a3ea811f80f2 | 112 | |
Helmut64 | 0:a3ea811f80f2 | 113 | // Called in ISR context |
Helmut64 | 0:a3ea811f80f2 | 114 | // Set configuration. Return false if the |
Helmut64 | 0:a3ea811f80f2 | 115 | // configuration is not supported. |
Helmut64 | 0:a3ea811f80f2 | 116 | bool USBCDC::USBCallback_setConfiguration(uint8_t configuration) { |
Helmut64 | 0:a3ea811f80f2 | 117 | if (configuration != DEFAULT_CONFIGURATION) { |
Helmut64 | 0:a3ea811f80f2 | 118 | return false; |
Helmut64 | 0:a3ea811f80f2 | 119 | } |
Helmut64 | 0:a3ea811f80f2 | 120 | |
Helmut64 | 0:a3ea811f80f2 | 121 | // Configure endpoints > 0 |
Helmut64 | 0:a3ea811f80f2 | 122 | addEndpoint(EPINT_IN, MAX_PACKET_SIZE_EPINT); |
Helmut64 | 0:a3ea811f80f2 | 123 | addEndpoint(EPBULK_IN, MAX_PACKET_SIZE_EPBULK); |
Helmut64 | 0:a3ea811f80f2 | 124 | addEndpoint(EPBULK_OUT, MAX_PACKET_SIZE_EPBULK); |
Helmut64 | 0:a3ea811f80f2 | 125 | |
Helmut64 | 0:a3ea811f80f2 | 126 | // We activate the endpoint to be able to recceive data |
Helmut64 | 0:a3ea811f80f2 | 127 | readStart(EPBULK_OUT, MAX_PACKET_SIZE_EPBULK); |
Helmut64 | 0:a3ea811f80f2 | 128 | return true; |
Helmut64 | 0:a3ea811f80f2 | 129 | } |
Helmut64 | 0:a3ea811f80f2 | 130 | |
Helmut64 | 0:a3ea811f80f2 | 131 | bool USBCDC::send(uint8_t * buffer, uint32_t size) { |
Helmut64 | 0:a3ea811f80f2 | 132 | return USBDevice::write(EPBULK_IN, buffer, size, MAX_CDC_REPORT_SIZE); |
Helmut64 | 0:a3ea811f80f2 | 133 | } |
Helmut64 | 0:a3ea811f80f2 | 134 | |
Helmut64 | 0:a3ea811f80f2 | 135 | bool USBCDC::readEP(uint8_t * buffer, uint32_t * size) { |
Helmut64 | 0:a3ea811f80f2 | 136 | if (!USBDevice::readEP(EPBULK_OUT, buffer, size, MAX_CDC_REPORT_SIZE)) |
Helmut64 | 0:a3ea811f80f2 | 137 | return false; |
Helmut64 | 0:a3ea811f80f2 | 138 | if (!readStart(EPBULK_OUT, MAX_CDC_REPORT_SIZE)) |
Helmut64 | 0:a3ea811f80f2 | 139 | return false; |
Helmut64 | 0:a3ea811f80f2 | 140 | return true; |
Helmut64 | 0:a3ea811f80f2 | 141 | } |
Helmut64 | 0:a3ea811f80f2 | 142 | |
Helmut64 | 0:a3ea811f80f2 | 143 | bool USBCDC::readEP_NB(uint8_t * buffer, uint32_t * size) { |
Helmut64 | 0:a3ea811f80f2 | 144 | if (!USBDevice::readEP_NB(EPBULK_OUT, buffer, size, MAX_CDC_REPORT_SIZE)) |
Helmut64 | 0:a3ea811f80f2 | 145 | return false; |
Helmut64 | 0:a3ea811f80f2 | 146 | if (!readStart(EPBULK_OUT, MAX_CDC_REPORT_SIZE)) |
Helmut64 | 0:a3ea811f80f2 | 147 | return false; |
Helmut64 | 0:a3ea811f80f2 | 148 | return true; |
Helmut64 | 0:a3ea811f80f2 | 149 | } |
Helmut64 | 0:a3ea811f80f2 | 150 | |
Helmut64 | 0:a3ea811f80f2 | 151 | |
Helmut64 | 0:a3ea811f80f2 | 152 | const uint8_t * USBCDC::deviceDesc() { |
Helmut64 | 0:a3ea811f80f2 | 153 | uint8_t deviceDescriptorTemp[] = { |
Helmut64 | 0:a3ea811f80f2 | 154 | 18, // bLength |
Helmut64 | 0:a3ea811f80f2 | 155 | 1, // bDescriptorType |
Helmut64 | 0:a3ea811f80f2 | 156 | 0x10, 0x01, // bcdUSB |
Helmut64 | 0:a3ea811f80f2 | 157 | 2, // bDeviceClass |
Helmut64 | 0:a3ea811f80f2 | 158 | 0, // bDeviceSubClass |
Helmut64 | 0:a3ea811f80f2 | 159 | 0, // bDeviceProtocol |
Helmut64 | 0:a3ea811f80f2 | 160 | MAX_PACKET_SIZE_EP0, // bMaxPacketSize0 |
Helmut64 | 0:a3ea811f80f2 | 161 | (uint8_t)(LSB(VENDOR_ID)), (uint8_t)(MSB(VENDOR_ID)), // idVendor |
Helmut64 | 0:a3ea811f80f2 | 162 | (uint8_t)(LSB(PRODUCT_ID)), (uint8_t)(MSB(PRODUCT_ID)),// idProduct |
Helmut64 | 0:a3ea811f80f2 | 163 | 0x00, 0x01, // bcdDevice |
Helmut64 | 0:a3ea811f80f2 | 164 | 1, // iManufacturer |
Helmut64 | 0:a3ea811f80f2 | 165 | 2, // iProduct |
Helmut64 | 0:a3ea811f80f2 | 166 | 3, // iSerialNumber |
Helmut64 | 0:a3ea811f80f2 | 167 | 1 // bNumConfigurations |
Helmut64 | 0:a3ea811f80f2 | 168 | }; |
Helmut64 | 0:a3ea811f80f2 | 169 | MBED_ASSERT(sizeof(deviceDescriptorTemp) == sizeof(deviceDescriptor)); |
Helmut64 | 0:a3ea811f80f2 | 170 | memcpy(deviceDescriptor, deviceDescriptorTemp, sizeof(deviceDescriptor)); |
Helmut64 | 0:a3ea811f80f2 | 171 | return deviceDescriptor; |
Helmut64 | 0:a3ea811f80f2 | 172 | } |
Helmut64 | 0:a3ea811f80f2 | 173 | |
Helmut64 | 0:a3ea811f80f2 | 174 | const uint8_t * USBCDC::stringIinterfaceDesc() { |
Helmut64 | 0:a3ea811f80f2 | 175 | static const uint8_t stringIinterfaceDescriptor[] = { |
Helmut64 | 0:a3ea811f80f2 | 176 | 0x08, |
Helmut64 | 0:a3ea811f80f2 | 177 | STRING_DESCRIPTOR, |
Helmut64 | 0:a3ea811f80f2 | 178 | 'C',0,'D',0,'C',0, |
Helmut64 | 0:a3ea811f80f2 | 179 | }; |
Helmut64 | 0:a3ea811f80f2 | 180 | return stringIinterfaceDescriptor; |
Helmut64 | 0:a3ea811f80f2 | 181 | } |
Helmut64 | 0:a3ea811f80f2 | 182 | |
Helmut64 | 0:a3ea811f80f2 | 183 | const uint8_t * USBCDC::stringIproductDesc() { |
Helmut64 | 0:a3ea811f80f2 | 184 | static const uint8_t stringIproductDescriptor[] = { |
Helmut64 | 0:a3ea811f80f2 | 185 | 0x16, |
Helmut64 | 0:a3ea811f80f2 | 186 | STRING_DESCRIPTOR, |
Helmut64 | 0:a3ea811f80f2 | 187 | 'C',0,'D',0,'C',0,' ',0,'D',0,'E',0,'V',0,'I',0,'C',0,'E',0 |
Helmut64 | 0:a3ea811f80f2 | 188 | }; |
Helmut64 | 0:a3ea811f80f2 | 189 | return stringIproductDescriptor; |
Helmut64 | 0:a3ea811f80f2 | 190 | } |
Helmut64 | 0:a3ea811f80f2 | 191 | |
Helmut64 | 0:a3ea811f80f2 | 192 | |
Helmut64 | 0:a3ea811f80f2 | 193 | #define CONFIG1_DESC_SIZE (9+8+9+5+5+4+5+7+9+7+7) |
Helmut64 | 0:a3ea811f80f2 | 194 | |
Helmut64 | 0:a3ea811f80f2 | 195 | const uint8_t * USBCDC::configurationDesc() { |
Helmut64 | 0:a3ea811f80f2 | 196 | static const uint8_t configDescriptor[] = { |
Helmut64 | 0:a3ea811f80f2 | 197 | // configuration descriptor |
Helmut64 | 0:a3ea811f80f2 | 198 | 9, // bLength |
Helmut64 | 0:a3ea811f80f2 | 199 | 2, // bDescriptorType |
Helmut64 | 0:a3ea811f80f2 | 200 | LSB(CONFIG1_DESC_SIZE), // wTotalLength |
Helmut64 | 0:a3ea811f80f2 | 201 | MSB(CONFIG1_DESC_SIZE), |
Helmut64 | 0:a3ea811f80f2 | 202 | 2, // bNumInterfaces |
Helmut64 | 0:a3ea811f80f2 | 203 | 1, // bConfigurationValue |
Helmut64 | 0:a3ea811f80f2 | 204 | 0, // iConfiguration |
Helmut64 | 0:a3ea811f80f2 | 205 | 0x80, // bmAttributes |
Helmut64 | 0:a3ea811f80f2 | 206 | 50, // bMaxPower |
Helmut64 | 0:a3ea811f80f2 | 207 | |
Helmut64 | 0:a3ea811f80f2 | 208 | // IAD to associate the two CDC interfaces |
Helmut64 | 0:a3ea811f80f2 | 209 | 0x08, // bLength |
Helmut64 | 0:a3ea811f80f2 | 210 | 0x0b, // bDescriptorType |
Helmut64 | 0:a3ea811f80f2 | 211 | 0x00, // bFirstInterface |
Helmut64 | 0:a3ea811f80f2 | 212 | 0x02, // bInterfaceCount |
Helmut64 | 0:a3ea811f80f2 | 213 | 0x02, // bFunctionClass |
Helmut64 | 0:a3ea811f80f2 | 214 | 0x02, // bFunctionSubClass |
Helmut64 | 0:a3ea811f80f2 | 215 | 0, // bFunctionProtocol |
Helmut64 | 0:a3ea811f80f2 | 216 | 0, // iFunction |
Helmut64 | 0:a3ea811f80f2 | 217 | |
Helmut64 | 0:a3ea811f80f2 | 218 | // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12 |
Helmut64 | 0:a3ea811f80f2 | 219 | 9, // bLength |
Helmut64 | 0:a3ea811f80f2 | 220 | 4, // bDescriptorType |
Helmut64 | 0:a3ea811f80f2 | 221 | 0, // bInterfaceNumber |
Helmut64 | 0:a3ea811f80f2 | 222 | 0, // bAlternateSetting |
Helmut64 | 0:a3ea811f80f2 | 223 | 1, // bNumEndpoints |
Helmut64 | 0:a3ea811f80f2 | 224 | 0x02, // bInterfaceClass |
Helmut64 | 0:a3ea811f80f2 | 225 | 0x02, // bInterfaceSubClass |
Helmut64 | 0:a3ea811f80f2 | 226 | 0x01, // bInterfaceProtocol |
Helmut64 | 0:a3ea811f80f2 | 227 | 0, // iInterface |
Helmut64 | 0:a3ea811f80f2 | 228 | |
Helmut64 | 0:a3ea811f80f2 | 229 | // CDC Header Functional Descriptor, CDC Spec 5.2.3.1, Table 26 |
Helmut64 | 0:a3ea811f80f2 | 230 | 5, // bFunctionLength |
Helmut64 | 0:a3ea811f80f2 | 231 | 0x24, // bDescriptorType |
Helmut64 | 0:a3ea811f80f2 | 232 | 0x00, // bDescriptorSubtype |
Helmut64 | 0:a3ea811f80f2 | 233 | 0x10, 0x01, // bcdCDC |
Helmut64 | 0:a3ea811f80f2 | 234 | |
Helmut64 | 0:a3ea811f80f2 | 235 | // Call Management Functional Descriptor, CDC Spec 5.2.3.2, Table 27 |
Helmut64 | 0:a3ea811f80f2 | 236 | 5, // bFunctionLength |
Helmut64 | 0:a3ea811f80f2 | 237 | 0x24, // bDescriptorType |
Helmut64 | 0:a3ea811f80f2 | 238 | 0x01, // bDescriptorSubtype |
Helmut64 | 0:a3ea811f80f2 | 239 | 0x03, // bmCapabilities |
Helmut64 | 0:a3ea811f80f2 | 240 | 1, // bDataInterface |
Helmut64 | 0:a3ea811f80f2 | 241 | |
Helmut64 | 0:a3ea811f80f2 | 242 | // Abstract Control Management Functional Descriptor, CDC Spec 5.2.3.3, Table 28 |
Helmut64 | 0:a3ea811f80f2 | 243 | 4, // bFunctionLength |
Helmut64 | 0:a3ea811f80f2 | 244 | 0x24, // bDescriptorType |
Helmut64 | 0:a3ea811f80f2 | 245 | 0x02, // bDescriptorSubtype |
Helmut64 | 0:a3ea811f80f2 | 246 | 0x06, // bmCapabilities |
Helmut64 | 0:a3ea811f80f2 | 247 | |
Helmut64 | 0:a3ea811f80f2 | 248 | // Union Functional Descriptor, CDC Spec 5.2.3.8, Table 33 |
Helmut64 | 0:a3ea811f80f2 | 249 | 5, // bFunctionLength |
Helmut64 | 0:a3ea811f80f2 | 250 | 0x24, // bDescriptorType |
Helmut64 | 0:a3ea811f80f2 | 251 | 0x06, // bDescriptorSubtype |
Helmut64 | 0:a3ea811f80f2 | 252 | 0, // bMasterInterface |
Helmut64 | 0:a3ea811f80f2 | 253 | 1, // bSlaveInterface0 |
Helmut64 | 0:a3ea811f80f2 | 254 | |
Helmut64 | 0:a3ea811f80f2 | 255 | // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13 |
Helmut64 | 0:a3ea811f80f2 | 256 | ENDPOINT_DESCRIPTOR_LENGTH, // bLength |
Helmut64 | 0:a3ea811f80f2 | 257 | ENDPOINT_DESCRIPTOR, // bDescriptorType |
Helmut64 | 0:a3ea811f80f2 | 258 | PHY_TO_DESC(EPINT_IN), // bEndpointAddress |
Helmut64 | 0:a3ea811f80f2 | 259 | E_INTERRUPT, // bmAttributes (0x03=intr) |
Helmut64 | 0:a3ea811f80f2 | 260 | LSB(MAX_PACKET_SIZE_EPINT), // wMaxPacketSize (LSB) |
Helmut64 | 0:a3ea811f80f2 | 261 | MSB(MAX_PACKET_SIZE_EPINT), // wMaxPacketSize (MSB) |
Helmut64 | 0:a3ea811f80f2 | 262 | 16, // bInterval |
Helmut64 | 0:a3ea811f80f2 | 263 | |
Helmut64 | 0:a3ea811f80f2 | 264 | |
Helmut64 | 0:a3ea811f80f2 | 265 | |
Helmut64 | 0:a3ea811f80f2 | 266 | |
Helmut64 | 0:a3ea811f80f2 | 267 | // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12 |
Helmut64 | 0:a3ea811f80f2 | 268 | 9, // bLength |
Helmut64 | 0:a3ea811f80f2 | 269 | 4, // bDescriptorType |
Helmut64 | 0:a3ea811f80f2 | 270 | 1, // bInterfaceNumber |
Helmut64 | 0:a3ea811f80f2 | 271 | 0, // bAlternateSetting |
Helmut64 | 0:a3ea811f80f2 | 272 | 2, // bNumEndpoints |
Helmut64 | 0:a3ea811f80f2 | 273 | 0x0A, // bInterfaceClass |
Helmut64 | 0:a3ea811f80f2 | 274 | 0x00, // bInterfaceSubClass |
Helmut64 | 0:a3ea811f80f2 | 275 | 0x00, // bInterfaceProtocol |
Helmut64 | 0:a3ea811f80f2 | 276 | 0, // iInterface |
Helmut64 | 0:a3ea811f80f2 | 277 | |
Helmut64 | 0:a3ea811f80f2 | 278 | // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13 |
Helmut64 | 0:a3ea811f80f2 | 279 | ENDPOINT_DESCRIPTOR_LENGTH, // bLength |
Helmut64 | 0:a3ea811f80f2 | 280 | ENDPOINT_DESCRIPTOR, // bDescriptorType |
Helmut64 | 0:a3ea811f80f2 | 281 | PHY_TO_DESC(EPBULK_IN), // bEndpointAddress |
Helmut64 | 0:a3ea811f80f2 | 282 | E_BULK, // bmAttributes (0x02=bulk) |
Helmut64 | 0:a3ea811f80f2 | 283 | LSB(MAX_PACKET_SIZE_EPBULK),// wMaxPacketSize (LSB) |
Helmut64 | 0:a3ea811f80f2 | 284 | MSB(MAX_PACKET_SIZE_EPBULK),// wMaxPacketSize (MSB) |
Helmut64 | 0:a3ea811f80f2 | 285 | 0, // bInterval |
Helmut64 | 0:a3ea811f80f2 | 286 | |
Helmut64 | 0:a3ea811f80f2 | 287 | // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13 |
Helmut64 | 0:a3ea811f80f2 | 288 | ENDPOINT_DESCRIPTOR_LENGTH, // bLength |
Helmut64 | 0:a3ea811f80f2 | 289 | ENDPOINT_DESCRIPTOR, // bDescriptorType |
Helmut64 | 0:a3ea811f80f2 | 290 | PHY_TO_DESC(EPBULK_OUT), // bEndpointAddress |
Helmut64 | 0:a3ea811f80f2 | 291 | E_BULK, // bmAttributes (0x02=bulk) |
Helmut64 | 0:a3ea811f80f2 | 292 | LSB(MAX_PACKET_SIZE_EPBULK),// wMaxPacketSize (LSB) |
Helmut64 | 0:a3ea811f80f2 | 293 | MSB(MAX_PACKET_SIZE_EPBULK),// wMaxPacketSize (MSB) |
Helmut64 | 0:a3ea811f80f2 | 294 | 0 // bInterval |
Helmut64 | 0:a3ea811f80f2 | 295 | }; |
Helmut64 | 0:a3ea811f80f2 | 296 | return configDescriptor; |
Helmut64 | 0:a3ea811f80f2 | 297 | } |
Helmut Tschemernjak | 2:195554780c9b | 298 | |
Helmut Tschemernjak | 2:195554780c9b | 299 | #endif // FEATURE_USBSERIAL |