Repostiory containing DAPLink source code with Reset Pin workaround for HANI_IOT board.
Upstream: https://github.com/ARMmbed/DAPLink
source/hic_hal/nxp/lpc11u35/usb_config.c@0:01f31e923fe2, 2020-04-07 (annotated)
- Committer:
- Pawel Zarembski
- Date:
- Tue Apr 07 12:55:42 2020 +0200
- Revision:
- 0:01f31e923fe2
hani: DAPLink with reset workaround
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Pawel Zarembski |
0:01f31e923fe2 | 1 | /** |
Pawel Zarembski |
0:01f31e923fe2 | 2 | * @file usb_config.c |
Pawel Zarembski |
0:01f31e923fe2 | 3 | * @brief |
Pawel Zarembski |
0:01f31e923fe2 | 4 | * |
Pawel Zarembski |
0:01f31e923fe2 | 5 | * DAPLink Interface Firmware |
Pawel Zarembski |
0:01f31e923fe2 | 6 | * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved |
Pawel Zarembski |
0:01f31e923fe2 | 7 | * SPDX-License-Identifier: Apache-2.0 |
Pawel Zarembski |
0:01f31e923fe2 | 8 | * |
Pawel Zarembski |
0:01f31e923fe2 | 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may |
Pawel Zarembski |
0:01f31e923fe2 | 10 | * not use this file except in compliance with the License. |
Pawel Zarembski |
0:01f31e923fe2 | 11 | * You may obtain a copy of the License at |
Pawel Zarembski |
0:01f31e923fe2 | 12 | * |
Pawel Zarembski |
0:01f31e923fe2 | 13 | * http://www.apache.org/licenses/LICENSE-2.0 |
Pawel Zarembski |
0:01f31e923fe2 | 14 | * |
Pawel Zarembski |
0:01f31e923fe2 | 15 | * Unless required by applicable law or agreed to in writing, software |
Pawel Zarembski |
0:01f31e923fe2 | 16 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
Pawel Zarembski |
0:01f31e923fe2 | 17 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
Pawel Zarembski |
0:01f31e923fe2 | 18 | * See the License for the specific language governing permissions and |
Pawel Zarembski |
0:01f31e923fe2 | 19 | * limitations under the License. |
Pawel Zarembski |
0:01f31e923fe2 | 20 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 21 | |
Pawel Zarembski |
0:01f31e923fe2 | 22 | #include "util.h" |
Pawel Zarembski |
0:01f31e923fe2 | 23 | |
Pawel Zarembski |
0:01f31e923fe2 | 24 | // <e> USB Device |
Pawel Zarembski |
0:01f31e923fe2 | 25 | // <i> Enable the USB Device functionality |
Pawel Zarembski |
0:01f31e923fe2 | 26 | #define USBD_ENABLE 1 |
Pawel Zarembski |
0:01f31e923fe2 | 27 | #define USBD_RTX_CORE_STACK 0 |
Pawel Zarembski |
0:01f31e923fe2 | 28 | #define USBD_RTX_DEVICE_STACK 0 |
Pawel Zarembski |
0:01f31e923fe2 | 29 | #define USBD_RTX_ENDPOINT0_STACK 0 |
Pawel Zarembski |
0:01f31e923fe2 | 30 | #if (defined(WEBUSB_INTERFACE) || defined(WINUSB_INTERFACE) || defined(BULK_ENDPOINT)) |
Pawel Zarembski |
0:01f31e923fe2 | 31 | #define USBD_BOS_ENABLE 1 |
Pawel Zarembski |
0:01f31e923fe2 | 32 | #else |
Pawel Zarembski |
0:01f31e923fe2 | 33 | #define USBD_BOS_ENABLE 0 |
Pawel Zarembski |
0:01f31e923fe2 | 34 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 35 | // <o0.0> High-speed |
Pawel Zarembski |
0:01f31e923fe2 | 36 | // <i> Enable high-speed functionality (if device supports it) |
Pawel Zarembski |
0:01f31e923fe2 | 37 | #define USBD_HS_ENABLE 0 |
Pawel Zarembski |
0:01f31e923fe2 | 38 | |
Pawel Zarembski |
0:01f31e923fe2 | 39 | // <h> Device Settings |
Pawel Zarembski |
0:01f31e923fe2 | 40 | // <i> These settings affect Device Descriptor |
Pawel Zarembski |
0:01f31e923fe2 | 41 | // <o0> Power |
Pawel Zarembski |
0:01f31e923fe2 | 42 | // <i> Default Power Setting |
Pawel Zarembski |
0:01f31e923fe2 | 43 | // <0=> Bus-powered |
Pawel Zarembski |
0:01f31e923fe2 | 44 | // <1=> Self-powered |
Pawel Zarembski |
0:01f31e923fe2 | 45 | // <o1> Max Endpoint 0 Packet Size |
Pawel Zarembski |
0:01f31e923fe2 | 46 | // <i> Maximum packet size for endpoint zero (bMaxPacketSize0) |
Pawel Zarembski |
0:01f31e923fe2 | 47 | // <8=> 8 Bytes <16=> 16 Bytes <32=> 32 Bytes <64=> 64 Bytes |
Pawel Zarembski |
0:01f31e923fe2 | 48 | // <o2.0..15> Vendor ID <0x0000-0xFFFF> |
Pawel Zarembski |
0:01f31e923fe2 | 49 | // <i> Vendor ID assigned by the USB-IF (idVendor) |
Pawel Zarembski |
0:01f31e923fe2 | 50 | // <o3.0..15> Product ID <0x0000-0xFFFF> |
Pawel Zarembski |
0:01f31e923fe2 | 51 | // <i> Product ID assigned by the manufacturer (idProduct) |
Pawel Zarembski |
0:01f31e923fe2 | 52 | // <o4.0..15> Device Release Number <0x0000-0xFFFF> |
Pawel Zarembski |
0:01f31e923fe2 | 53 | // <i> Device release number in binary-coded decimal (bcdDevice) |
Pawel Zarembski |
0:01f31e923fe2 | 54 | // </h> |
Pawel Zarembski |
0:01f31e923fe2 | 55 | #define USBD_POWER 0 |
Pawel Zarembski |
0:01f31e923fe2 | 56 | #define USBD_MAX_PACKET0 8 |
Pawel Zarembski |
0:01f31e923fe2 | 57 | #define USBD_DEVDESC_IDVENDOR 0x0D28 |
Pawel Zarembski |
0:01f31e923fe2 | 58 | #define USBD_DEVDESC_IDPRODUCT 0x0204 |
Pawel Zarembski |
0:01f31e923fe2 | 59 | #define USBD_DEVDESC_BCDDEVICE 0x0100 |
Pawel Zarembski |
0:01f31e923fe2 | 60 | |
Pawel Zarembski |
0:01f31e923fe2 | 61 | // <h> Configuration Settings |
Pawel Zarembski |
0:01f31e923fe2 | 62 | // <i> These settings affect Configuration Descriptor |
Pawel Zarembski |
0:01f31e923fe2 | 63 | // <o0.5> Remote Wakeup |
Pawel Zarembski |
0:01f31e923fe2 | 64 | // <i> Configuration support for remote wakeup (D5: of bmAttributes) |
Pawel Zarembski |
0:01f31e923fe2 | 65 | // <o1.0..7> Maximum Power Consumption (in mA) <0-510><#/2> |
Pawel Zarembski |
0:01f31e923fe2 | 66 | // <i> Maximum power consumption of the USB device |
Pawel Zarembski |
0:01f31e923fe2 | 67 | // <i> from the bus in this specific configuration |
Pawel Zarembski |
0:01f31e923fe2 | 68 | // <i> when the device is fully operational (bMaxPower) |
Pawel Zarembski |
0:01f31e923fe2 | 69 | // </h> |
Pawel Zarembski |
0:01f31e923fe2 | 70 | #define USBD_CFGDESC_BMATTRIBUTES 0x80 |
Pawel Zarembski |
0:01f31e923fe2 | 71 | #define USBD_CFGDESC_BMAXPOWER 0xFA |
Pawel Zarembski |
0:01f31e923fe2 | 72 | |
Pawel Zarembski |
0:01f31e923fe2 | 73 | // <h> String Settings |
Pawel Zarembski |
0:01f31e923fe2 | 74 | // <i> These settings affect String Descriptor |
Pawel Zarembski |
0:01f31e923fe2 | 75 | // <o0.0..15> Language ID <0x0000-0xFCFF> |
Pawel Zarembski |
0:01f31e923fe2 | 76 | // <i> English (United States) = 0x0409 |
Pawel Zarembski |
0:01f31e923fe2 | 77 | // <s0.126> Manufacturer String |
Pawel Zarembski |
0:01f31e923fe2 | 78 | // <i> String descriptor describing manufacturer |
Pawel Zarembski |
0:01f31e923fe2 | 79 | // <s1.126> Product String |
Pawel Zarembski |
0:01f31e923fe2 | 80 | // <i> String descriptor describing product |
Pawel Zarembski |
0:01f31e923fe2 | 81 | // <e1.0> Serial Number |
Pawel Zarembski |
0:01f31e923fe2 | 82 | // <i> Enable serial number string |
Pawel Zarembski |
0:01f31e923fe2 | 83 | // <i> If disabled serial number string will not be assigned to the USB Device |
Pawel Zarembski |
0:01f31e923fe2 | 84 | // <s2.126> Serial Number String |
Pawel Zarembski |
0:01f31e923fe2 | 85 | // <i> String descriptor describing device's serial number |
Pawel Zarembski |
0:01f31e923fe2 | 86 | // </e> |
Pawel Zarembski |
0:01f31e923fe2 | 87 | // </h> |
Pawel Zarembski |
0:01f31e923fe2 | 88 | #define USBD_STRDESC_LANGID 0x0409 |
Pawel Zarembski |
0:01f31e923fe2 | 89 | #define USBD_STRDESC_MAN L"ARM" |
Pawel Zarembski |
0:01f31e923fe2 | 90 | #ifndef USB_PROD_STR |
Pawel Zarembski |
0:01f31e923fe2 | 91 | #define USBD_STRDESC_PROD L"DAPLink CMSIS-DAP" |
Pawel Zarembski |
0:01f31e923fe2 | 92 | #else |
Pawel Zarembski |
0:01f31e923fe2 | 93 | #define _TOWIDE(x) L ## #x |
Pawel Zarembski |
0:01f31e923fe2 | 94 | #define TOWIDE(x) _TOWIDE(x) |
Pawel Zarembski |
0:01f31e923fe2 | 95 | #define USBD_STRDESC_PROD TOWIDE(USB_PROD_STR) |
Pawel Zarembski |
0:01f31e923fe2 | 96 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 97 | #define USBD_STRDESC_SER_ENABLE 1 |
Pawel Zarembski |
0:01f31e923fe2 | 98 | #define USBD_STRDESC_SER L"0001A0000000" |
Pawel Zarembski |
0:01f31e923fe2 | 99 | |
Pawel Zarembski |
0:01f31e923fe2 | 100 | // <e0> Class Support |
Pawel Zarembski |
0:01f31e923fe2 | 101 | // <i> Enables USB Device Class specific Requests |
Pawel Zarembski |
0:01f31e923fe2 | 102 | #define USBD_CLASS_ENABLE 1 |
Pawel Zarembski |
0:01f31e923fe2 | 103 | |
Pawel Zarembski |
0:01f31e923fe2 | 104 | // <e0.0> Human Interface Device (HID) |
Pawel Zarembski |
0:01f31e923fe2 | 105 | // <i> Enable class support for Human Interface Device (HID) |
Pawel Zarembski |
0:01f31e923fe2 | 106 | // <h> Interrupt Endpoint Settings |
Pawel Zarembski |
0:01f31e923fe2 | 107 | // <o1.0..4> Interrupt In Endpoint Number <1=> 1 <2=> 2 <3=> 3 |
Pawel Zarembski |
0:01f31e923fe2 | 108 | // <4=> 4 <5=> 5 <6=> 6 <7=> 7 |
Pawel Zarembski |
0:01f31e923fe2 | 109 | // <8=> 8 <9=> 9 <10=> 10 <11=> 11 |
Pawel Zarembski |
0:01f31e923fe2 | 110 | // <12=> 12 <13=> 13 <14=> 14 <15=> 15 |
Pawel Zarembski |
0:01f31e923fe2 | 111 | // <o2.0..4> Interrupt Out Endpoint Number <0=> Not used <1=> 1 <2=> 2 <3=> 3 |
Pawel Zarembski |
0:01f31e923fe2 | 112 | // <4=> 4 <5=> 5 <6=> 6 <7=> 7 |
Pawel Zarembski |
0:01f31e923fe2 | 113 | // <8=> 8 <9=> 9 <10=> 10 <11=> 11 |
Pawel Zarembski |
0:01f31e923fe2 | 114 | // <12=> 12 <13=> 13 <14=> 14 <15=> 15 |
Pawel Zarembski |
0:01f31e923fe2 | 115 | // <i> If interrupt out endpoint is not used select "Not used" |
Pawel Zarembski |
0:01f31e923fe2 | 116 | // <h> Endpoint Settings |
Pawel Zarembski |
0:01f31e923fe2 | 117 | // <o3.0..7> Maximum Endpoint Packet Size (in bytes) <0-64> |
Pawel Zarembski |
0:01f31e923fe2 | 118 | // <o4.0..7> Endpoint polling Interval (in ms) <1-255> |
Pawel Zarembski |
0:01f31e923fe2 | 119 | // <e5> High-speed |
Pawel Zarembski |
0:01f31e923fe2 | 120 | // <i> If high-speed is enabled set endpoint settings for it |
Pawel Zarembski |
0:01f31e923fe2 | 121 | // <o6.0..10> Maximum Endpoint Packet Size (in bytes) <0-1024> |
Pawel Zarembski |
0:01f31e923fe2 | 122 | // <o6.11..12> Additional transactions per microframe <0=> None <1=> 1 additional <2=> 2 additional |
Pawel Zarembski |
0:01f31e923fe2 | 123 | // <o7.0..7> Endpoint polling Interval (in ms) <1=> 1 <2=> 2 <3=> 4 <4=> 8 |
Pawel Zarembski |
0:01f31e923fe2 | 124 | // <5=> 16 <6=> 32 <7=> 64 <8=> 128 |
Pawel Zarembski |
0:01f31e923fe2 | 125 | // <9=> 256 <10=> 512 <11=> 1024 <12=> 2048 |
Pawel Zarembski |
0:01f31e923fe2 | 126 | // <13=> 4096 <14=> 8192 <15=> 16384 <16=> 32768 |
Pawel Zarembski |
0:01f31e923fe2 | 127 | // </e> |
Pawel Zarembski |
0:01f31e923fe2 | 128 | // </h> |
Pawel Zarembski |
0:01f31e923fe2 | 129 | // </h> |
Pawel Zarembski |
0:01f31e923fe2 | 130 | // <h> Human Interface Device Settings |
Pawel Zarembski |
0:01f31e923fe2 | 131 | // <i> Device specific settings |
Pawel Zarembski |
0:01f31e923fe2 | 132 | // <s0.126> HID Interface String |
Pawel Zarembski |
0:01f31e923fe2 | 133 | // <o8.0..4> Number of Input Reports <1-32> |
Pawel Zarembski |
0:01f31e923fe2 | 134 | // <o9.0..4> Number of Output Reports <1-32> |
Pawel Zarembski |
0:01f31e923fe2 | 135 | // <o10.0..15> Maximum Input Report Size (in bytes) <1-65535> |
Pawel Zarembski |
0:01f31e923fe2 | 136 | // <o11.0..15> Maximum Output Report Size (in bytes) <1-65535> |
Pawel Zarembski |
0:01f31e923fe2 | 137 | // <o12.0..15> Maximum Feature Report Size (in bytes) <1-65535> |
Pawel Zarembski |
0:01f31e923fe2 | 138 | // </h> |
Pawel Zarembski |
0:01f31e923fe2 | 139 | // </e> |
Pawel Zarembski |
0:01f31e923fe2 | 140 | #ifndef HID_ENDPOINT |
Pawel Zarembski |
0:01f31e923fe2 | 141 | #define HID_ENDPOINT 0 |
Pawel Zarembski |
0:01f31e923fe2 | 142 | #else |
Pawel Zarembski |
0:01f31e923fe2 | 143 | #define HID_ENDPOINT 1 |
Pawel Zarembski |
0:01f31e923fe2 | 144 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 145 | |
Pawel Zarembski |
0:01f31e923fe2 | 146 | #ifndef WEBUSB_INTERFACE |
Pawel Zarembski |
0:01f31e923fe2 | 147 | #define WEBUSB_INTERFACE 0 |
Pawel Zarembski |
0:01f31e923fe2 | 148 | #else |
Pawel Zarembski |
0:01f31e923fe2 | 149 | #define WEBUSB_INTERFACE 1 |
Pawel Zarembski |
0:01f31e923fe2 | 150 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 151 | |
Pawel Zarembski |
0:01f31e923fe2 | 152 | #define USBD_HID_ENABLE HID_ENDPOINT |
Pawel Zarembski |
0:01f31e923fe2 | 153 | #ifndef BULK_ENDPOINT //check if bulk endpoint is not enabled |
Pawel Zarembski |
0:01f31e923fe2 | 154 | #define USBD_HID_EP_INTIN 1 |
Pawel Zarembski |
0:01f31e923fe2 | 155 | #define USBD_HID_EP_INTOUT 1 |
Pawel Zarembski |
0:01f31e923fe2 | 156 | #else //if bulk endpoint is enabled remove interrupt endpoints from the hid |
Pawel Zarembski |
0:01f31e923fe2 | 157 | #define USBD_HID_EP_INTIN 0 |
Pawel Zarembski |
0:01f31e923fe2 | 158 | #define USBD_HID_EP_INTOUT 0 |
Pawel Zarembski |
0:01f31e923fe2 | 159 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 160 | #define USBD_HID_ENABLE HID_ENDPOINT |
Pawel Zarembski |
0:01f31e923fe2 | 161 | #define USBD_HID_EP_INTIN_STACK 0 |
Pawel Zarembski |
0:01f31e923fe2 | 162 | #define USBD_HID_WMAXPACKETSIZE 64 |
Pawel Zarembski |
0:01f31e923fe2 | 163 | #define USBD_HID_BINTERVAL 1 |
Pawel Zarembski |
0:01f31e923fe2 | 164 | #define USBD_HID_HS_ENABLE 0 |
Pawel Zarembski |
0:01f31e923fe2 | 165 | #define USBD_HID_HS_WMAXPACKETSIZE 64 |
Pawel Zarembski |
0:01f31e923fe2 | 166 | #define USBD_HID_HS_BINTERVAL 6 |
Pawel Zarembski |
0:01f31e923fe2 | 167 | #define USBD_HID_STRDESC L"CMSIS-DAP v1" |
Pawel Zarembski |
0:01f31e923fe2 | 168 | #define USBD_WEBUSB_STRDESC L"WebUSB: CMSIS-DAP" |
Pawel Zarembski |
0:01f31e923fe2 | 169 | #define USBD_HID_INREPORT_NUM 1 |
Pawel Zarembski |
0:01f31e923fe2 | 170 | #define USBD_HID_OUTREPORT_NUM 1 |
Pawel Zarembski |
0:01f31e923fe2 | 171 | #define USBD_HID_INREPORT_MAX_SZ 64 |
Pawel Zarembski |
0:01f31e923fe2 | 172 | #define USBD_HID_OUTREPORT_MAX_SZ 64 |
Pawel Zarembski |
0:01f31e923fe2 | 173 | #define USBD_HID_FEATREPORT_MAX_SZ 1 |
Pawel Zarembski |
0:01f31e923fe2 | 174 | |
Pawel Zarembski |
0:01f31e923fe2 | 175 | // <e0.0> Mass Storage Device (MSC) |
Pawel Zarembski |
0:01f31e923fe2 | 176 | // <i> Enable class support for Mass Storage Device (MSC) |
Pawel Zarembski |
0:01f31e923fe2 | 177 | // <h> Bulk Endpoint Settings |
Pawel Zarembski |
0:01f31e923fe2 | 178 | // <o1.0..4> Bulk In Endpoint Number <1=> 1 <2=> 2 <3=> 3 |
Pawel Zarembski |
0:01f31e923fe2 | 179 | // <4=> 4 <5=> 5 <6=> 6 <7=> 7 |
Pawel Zarembski |
0:01f31e923fe2 | 180 | // <8=> 8 <9=> 9 <10=> 10 <11=> 11 |
Pawel Zarembski |
0:01f31e923fe2 | 181 | // <12=> 12 <13=> 13 <14=> 14 <15=> 15 |
Pawel Zarembski |
0:01f31e923fe2 | 182 | // <o2.0..4> Bulk Out Endpoint Number <1=> 1 <2=> 2 <3=> 3 |
Pawel Zarembski |
0:01f31e923fe2 | 183 | // <4=> 4 <5=> 5 <6=> 6 <7=> 7 |
Pawel Zarembski |
0:01f31e923fe2 | 184 | // <8=> 8 <9=> 9 <10=> 10 <11=> 11 |
Pawel Zarembski |
0:01f31e923fe2 | 185 | // <12=> 12 <13=> 13 <14=> 14 <15=> 15 |
Pawel Zarembski |
0:01f31e923fe2 | 186 | // <h> Endpoint Settings |
Pawel Zarembski |
0:01f31e923fe2 | 187 | // <o3> Maximum Packet Size <1-1024> |
Pawel Zarembski |
0:01f31e923fe2 | 188 | // <e4> High-speed |
Pawel Zarembski |
0:01f31e923fe2 | 189 | // <i> If high-speed is enabled set endpoint settings for it |
Pawel Zarembski |
0:01f31e923fe2 | 190 | // <o5> Maximum Packet Size <1-1024> |
Pawel Zarembski |
0:01f31e923fe2 | 191 | // <o6> Maximum NAK Rate <0-255> |
Pawel Zarembski |
0:01f31e923fe2 | 192 | // </e> |
Pawel Zarembski |
0:01f31e923fe2 | 193 | // </h> |
Pawel Zarembski |
0:01f31e923fe2 | 194 | // </h> |
Pawel Zarembski |
0:01f31e923fe2 | 195 | // <h> Mass Storage Device Settings |
Pawel Zarembski |
0:01f31e923fe2 | 196 | // <i> Device specific settings |
Pawel Zarembski |
0:01f31e923fe2 | 197 | // <s0.126> MSC Interface String |
Pawel Zarembski |
0:01f31e923fe2 | 198 | // <h> Inquiry Data |
Pawel Zarembski |
0:01f31e923fe2 | 199 | // <s1.8> Vendor Identification |
Pawel Zarembski |
0:01f31e923fe2 | 200 | // <s2.16> Product Identification |
Pawel Zarembski |
0:01f31e923fe2 | 201 | // <s3.4> Product Revision Level |
Pawel Zarembski |
0:01f31e923fe2 | 202 | // </h> |
Pawel Zarembski |
0:01f31e923fe2 | 203 | // </h> |
Pawel Zarembski |
0:01f31e923fe2 | 204 | // </e> |
Pawel Zarembski |
0:01f31e923fe2 | 205 | #ifndef MSC_ENDPOINT |
Pawel Zarembski |
0:01f31e923fe2 | 206 | #define MSC_ENDPOINT 0 |
Pawel Zarembski |
0:01f31e923fe2 | 207 | #else |
Pawel Zarembski |
0:01f31e923fe2 | 208 | #define MSC_ENDPOINT 1 |
Pawel Zarembski |
0:01f31e923fe2 | 209 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 210 | #define USBD_MSC_ENABLE MSC_ENDPOINT |
Pawel Zarembski |
0:01f31e923fe2 | 211 | #define USBD_MSC_EP_BULKIN 2 |
Pawel Zarembski |
0:01f31e923fe2 | 212 | #define USBD_MSC_EP_BULKOUT 2 |
Pawel Zarembski |
0:01f31e923fe2 | 213 | #define USBD_MSC_EP_BULKIN_STACK 0 |
Pawel Zarembski |
0:01f31e923fe2 | 214 | #define USBD_MSC_WMAXPACKETSIZE 64 |
Pawel Zarembski |
0:01f31e923fe2 | 215 | #define USBD_MSC_HS_ENABLE 0 |
Pawel Zarembski |
0:01f31e923fe2 | 216 | #define USBD_MSC_HS_WMAXPACKETSIZE 512 |
Pawel Zarembski |
0:01f31e923fe2 | 217 | #define USBD_MSC_HS_BINTERVAL 0 |
Pawel Zarembski |
0:01f31e923fe2 | 218 | #define USBD_MSC_STRDESC L"USB_MSC" |
Pawel Zarembski |
0:01f31e923fe2 | 219 | // Make sure changes to USBD_MSC_INQUIRY_DATA are coordinated with mbed-ls |
Pawel Zarembski |
0:01f31e923fe2 | 220 | // since this is used to detect DAPLink drives |
Pawel Zarembski |
0:01f31e923fe2 | 221 | #define USBD_MSC_INQUIRY_DATA "MBED " \ |
Pawel Zarembski |
0:01f31e923fe2 | 222 | "VFS " \ |
Pawel Zarembski |
0:01f31e923fe2 | 223 | "0.1" |
Pawel Zarembski |
0:01f31e923fe2 | 224 | |
Pawel Zarembski |
0:01f31e923fe2 | 225 | // <e0.0> Audio Device (ADC) |
Pawel Zarembski |
0:01f31e923fe2 | 226 | // <i> Enable class support for Audio Device (ADC) |
Pawel Zarembski |
0:01f31e923fe2 | 227 | // <h> Isochronous Endpoint Settings |
Pawel Zarembski |
0:01f31e923fe2 | 228 | // <o1.0..4> Isochronous Out Endpoint Number <1=> 1 <2=> 2 <3=> 3 |
Pawel Zarembski |
0:01f31e923fe2 | 229 | // <4=> 4 <5=> 5 <6=> 6 <7=> 7 |
Pawel Zarembski |
0:01f31e923fe2 | 230 | // <8=> 8 <9=> 9 <10=> 10 <11=> 11 |
Pawel Zarembski |
0:01f31e923fe2 | 231 | // <12=> 12 <13=> 13 <14=> 14 <15=> 15 |
Pawel Zarembski |
0:01f31e923fe2 | 232 | // <h> Endpoint Settings |
Pawel Zarembski |
0:01f31e923fe2 | 233 | // <o2.0..10> Maximum Endpoint Packet Size (in bytes) <0-1024> |
Pawel Zarembski |
0:01f31e923fe2 | 234 | // <o3.0..10> Endpoint polling Interval (in ms) <1=> 1 <2=> 2 <3=> 4 <4=> 8 |
Pawel Zarembski |
0:01f31e923fe2 | 235 | // <5=> 16 <6=> 32 <7=> 64 <8=> 128 |
Pawel Zarembski |
0:01f31e923fe2 | 236 | // <9=> 256 <10=> 512 <11=> 1024 <12=> 2048 |
Pawel Zarembski |
0:01f31e923fe2 | 237 | // <13=> 4096 <14=> 8192 <15=> 16384 <16=> 32768 |
Pawel Zarembski |
0:01f31e923fe2 | 238 | // <e4> High-speed |
Pawel Zarembski |
0:01f31e923fe2 | 239 | // <i> If high-speed is enabled set endpoint settings for it |
Pawel Zarembski |
0:01f31e923fe2 | 240 | // <o5.0..10> Maximum Endpoint Packet Size (in bytes) <0-1024> |
Pawel Zarembski |
0:01f31e923fe2 | 241 | // <o5.11..12> Additional transactions per microframe <0=> None <1=> 1 additional <2=> 2 additional |
Pawel Zarembski |
0:01f31e923fe2 | 242 | // </e> |
Pawel Zarembski |
0:01f31e923fe2 | 243 | // </h> |
Pawel Zarembski |
0:01f31e923fe2 | 244 | // </h> |
Pawel Zarembski |
0:01f31e923fe2 | 245 | // <h> Audio Device Settings |
Pawel Zarembski |
0:01f31e923fe2 | 246 | // <i> Device specific settings |
Pawel Zarembski |
0:01f31e923fe2 | 247 | // <s0.126> Audio Control Interface String |
Pawel Zarembski |
0:01f31e923fe2 | 248 | // <s1.126> Audio Streaming (Zero Bandwidth) Interface String |
Pawel Zarembski |
0:01f31e923fe2 | 249 | // <s2.126> Audio Streaming (Operational) Interface String |
Pawel Zarembski |
0:01f31e923fe2 | 250 | // <o6.0..7> Audio Subframe Size (in bytes) <0-255> |
Pawel Zarembski |
0:01f31e923fe2 | 251 | // <o7.0..7> Sample Resolution (in bits) <0-255> |
Pawel Zarembski |
0:01f31e923fe2 | 252 | // <o8.0..23> Sample Frequency (in Hz) <0-16777215> |
Pawel Zarembski |
0:01f31e923fe2 | 253 | // <o9> Packet Size (in bytes) <1-256> |
Pawel Zarembski |
0:01f31e923fe2 | 254 | // <o10> Packet Count <1-16> |
Pawel Zarembski |
0:01f31e923fe2 | 255 | // </h> |
Pawel Zarembski |
0:01f31e923fe2 | 256 | // </e> |
Pawel Zarembski |
0:01f31e923fe2 | 257 | #define USBD_ADC_ENABLE 0 |
Pawel Zarembski |
0:01f31e923fe2 | 258 | #define USBD_ADC_EP_ISOOUT 3 |
Pawel Zarembski |
0:01f31e923fe2 | 259 | #define USBD_ADC_WMAXPACKETSIZE 64 |
Pawel Zarembski |
0:01f31e923fe2 | 260 | #define USBD_ADC_BINTERVAL 1 |
Pawel Zarembski |
0:01f31e923fe2 | 261 | #define USBD_ADC_HS_ENABLE 0 |
Pawel Zarembski |
0:01f31e923fe2 | 262 | #define USBD_ADC_HS_WMAXPACKETSIZE 64 |
Pawel Zarembski |
0:01f31e923fe2 | 263 | #define USBD_ADC_CIF_STRDESC L"USB_ADC" |
Pawel Zarembski |
0:01f31e923fe2 | 264 | #define USBD_ADC_SIF1_STRDESC L"USB_ADC1" |
Pawel Zarembski |
0:01f31e923fe2 | 265 | #define USBD_ADC_SIF2_STRDESC L"USB_ADC2" |
Pawel Zarembski |
0:01f31e923fe2 | 266 | #define USBD_ADC_BSUBFRAMESIZE 2 |
Pawel Zarembski |
0:01f31e923fe2 | 267 | #define USBD_ADC_BBITRESOLUTION 16 |
Pawel Zarembski |
0:01f31e923fe2 | 268 | #define USBD_ADC_TSAMFREQ 32000 |
Pawel Zarembski |
0:01f31e923fe2 | 269 | #define USBD_ADC_CFG_P_S 32 |
Pawel Zarembski |
0:01f31e923fe2 | 270 | #define USBD_ADC_CFG_P_C 1 |
Pawel Zarembski |
0:01f31e923fe2 | 271 | |
Pawel Zarembski |
0:01f31e923fe2 | 272 | // <e0> Communication Device (CDC) - Abstract Control Model (ACM) |
Pawel Zarembski |
0:01f31e923fe2 | 273 | // <i> Enable class support for Communication Device (CDC) - Abstract Control Model (ACM) |
Pawel Zarembski |
0:01f31e923fe2 | 274 | // <h> Interrupt Endpoint Settings |
Pawel Zarembski |
0:01f31e923fe2 | 275 | // <o1.0..4> Interrupt In Endpoint Number <1=> 1 <2=> 2 <3=> 3 |
Pawel Zarembski |
0:01f31e923fe2 | 276 | // <4=> 4 <5=> 5 <6=> 6 <7=> 7 |
Pawel Zarembski |
0:01f31e923fe2 | 277 | // <8=> 8 <9=> 9 <10=> 10 <11=> 11 |
Pawel Zarembski |
0:01f31e923fe2 | 278 | // <12=> 12 <13=> 13 <14=> 14 <15=> 15 |
Pawel Zarembski |
0:01f31e923fe2 | 279 | // <h> Endpoint Settings |
Pawel Zarembski |
0:01f31e923fe2 | 280 | // <o2.0..10> Maximum Endpoint Packet Size (in bytes) <0-1024> |
Pawel Zarembski |
0:01f31e923fe2 | 281 | // <o3.0..10> Endpoint polling Interval (in ms) <0-255> |
Pawel Zarembski |
0:01f31e923fe2 | 282 | // <e4> High-speed |
Pawel Zarembski |
0:01f31e923fe2 | 283 | // <i> If high-speed is enabled set endpoint settings for it |
Pawel Zarembski |
0:01f31e923fe2 | 284 | // <o5.0..10> Maximum Endpoint Packet Size (in bytes) <0-1024> |
Pawel Zarembski |
0:01f31e923fe2 | 285 | // <o5.11..12> Additional transactions per microframe <0=> None <1=> 1 additional <2=> 2 additional |
Pawel Zarembski |
0:01f31e923fe2 | 286 | // <o6.0..10> Endpoint polling Interval (in ms) <1=> 1 <2=> 2 <3=> 4 <4=> 8 |
Pawel Zarembski |
0:01f31e923fe2 | 287 | // <5=> 16 <6=> 32 <7=> 64 <8=> 128 |
Pawel Zarembski |
0:01f31e923fe2 | 288 | // <9=> 256 <10=> 512 <11=> 1024 <12=> 2048 |
Pawel Zarembski |
0:01f31e923fe2 | 289 | // <13=> 4096 <14=> 8192 <15=> 16384 <16=> 32768 |
Pawel Zarembski |
0:01f31e923fe2 | 290 | // </e4> |
Pawel Zarembski |
0:01f31e923fe2 | 291 | // </h> |
Pawel Zarembski |
0:01f31e923fe2 | 292 | // </h> |
Pawel Zarembski |
0:01f31e923fe2 | 293 | // <h> Bulk Endpoint Settings |
Pawel Zarembski |
0:01f31e923fe2 | 294 | // <o7.0..4> Bulk In Endpoint Number <1=> 1 <2=> 2 <3=> 3 |
Pawel Zarembski |
0:01f31e923fe2 | 295 | // <4=> 4 <5=> 5 <6=> 6 <7=> 7 |
Pawel Zarembski |
0:01f31e923fe2 | 296 | // <8=> 8 <9=> 9 <10=> 10 <11=> 11 |
Pawel Zarembski |
0:01f31e923fe2 | 297 | // <12=> 12 <13=> 13 <14=> 14 <15=> 15 |
Pawel Zarembski |
0:01f31e923fe2 | 298 | // <o8.0..4> Bulk Out Endpoint Number <1=> 1 <2=> 2 <3=> 3 |
Pawel Zarembski |
0:01f31e923fe2 | 299 | // <4=> 4 <5=> 5 <6=> 6 <7=> 7 |
Pawel Zarembski |
0:01f31e923fe2 | 300 | // <8=> 8 <9=> 9 <10=> 10 <11=> 11 |
Pawel Zarembski |
0:01f31e923fe2 | 301 | // <12=> 12 <13=> 13 <14=> 14 <15=> 15 |
Pawel Zarembski |
0:01f31e923fe2 | 302 | // <h> Endpoint Settings |
Pawel Zarembski |
0:01f31e923fe2 | 303 | // <o9> Maximum Packet Size <1-1024> |
Pawel Zarembski |
0:01f31e923fe2 | 304 | // <e10> High-speed |
Pawel Zarembski |
0:01f31e923fe2 | 305 | // <i> If high-speed is enabled set endpoint settings for it |
Pawel Zarembski |
0:01f31e923fe2 | 306 | // <o11> Maximum Packet Size <1-1024> |
Pawel Zarembski |
0:01f31e923fe2 | 307 | // <o12> Maximum NAK Rate <0-255> |
Pawel Zarembski |
0:01f31e923fe2 | 308 | // </e10> |
Pawel Zarembski |
0:01f31e923fe2 | 309 | // </h> |
Pawel Zarembski |
0:01f31e923fe2 | 310 | // </h> |
Pawel Zarembski |
0:01f31e923fe2 | 311 | // <h> Communication Device Settings |
Pawel Zarembski |
0:01f31e923fe2 | 312 | // <i> Device specific settings |
Pawel Zarembski |
0:01f31e923fe2 | 313 | // <s0.126> Communication Class Interface String |
Pawel Zarembski |
0:01f31e923fe2 | 314 | // <s1.126> Data Class Interface String |
Pawel Zarembski |
0:01f31e923fe2 | 315 | // <o13> Maximum Communication Device Send Buffer Size |
Pawel Zarembski |
0:01f31e923fe2 | 316 | // <8=> 8 Bytes <16=> 16 Bytes <32=> 32 Bytes <64=> 64 Bytes <128=> 128 Bytes |
Pawel Zarembski |
0:01f31e923fe2 | 317 | // <256=> 256 Bytes <512=> 512 Bytes <1024=> 1024 Bytes |
Pawel Zarembski |
0:01f31e923fe2 | 318 | // <o14> Maximum Communication Device Receive Buffer Size |
Pawel Zarembski |
0:01f31e923fe2 | 319 | // <i> Minimum size must be as big as maximum packet size for Bulk Out Endpoint |
Pawel Zarembski |
0:01f31e923fe2 | 320 | // <8=> 8 Bytes <16=> 16 Bytes <32=> 32 Bytes <64=> 64 Bytes <128=> 128 Bytes |
Pawel Zarembski |
0:01f31e923fe2 | 321 | // <256=> 256 Bytes <512=> 512 Bytes <1024=> 1024 Bytes |
Pawel Zarembski |
0:01f31e923fe2 | 322 | // </h> |
Pawel Zarembski |
0:01f31e923fe2 | 323 | // </e> |
Pawel Zarembski |
0:01f31e923fe2 | 324 | |
Pawel Zarembski |
0:01f31e923fe2 | 325 | #ifndef CDC_ENDPOINT |
Pawel Zarembski |
0:01f31e923fe2 | 326 | #define CDC_ENDPOINT 0 |
Pawel Zarembski |
0:01f31e923fe2 | 327 | #else |
Pawel Zarembski |
0:01f31e923fe2 | 328 | #define CDC_ENDPOINT 1 |
Pawel Zarembski |
0:01f31e923fe2 | 329 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 330 | #define USBD_CDC_ACM_ENABLE CDC_ENDPOINT |
Pawel Zarembski |
0:01f31e923fe2 | 331 | #define USBD_CDC_ACM_EP_INTIN 3 |
Pawel Zarembski |
0:01f31e923fe2 | 332 | #define USBD_CDC_ACM_EP_INTIN_STACK 0 |
Pawel Zarembski |
0:01f31e923fe2 | 333 | #define USBD_CDC_ACM_WMAXPACKETSIZE 16 |
Pawel Zarembski |
0:01f31e923fe2 | 334 | #define USBD_CDC_ACM_BINTERVAL 32 |
Pawel Zarembski |
0:01f31e923fe2 | 335 | #define USBD_CDC_ACM_HS_ENABLE 0 |
Pawel Zarembski |
0:01f31e923fe2 | 336 | #define USBD_CDC_ACM_HS_WMAXPACKETSIZE 16 |
Pawel Zarembski |
0:01f31e923fe2 | 337 | #define USBD_CDC_ACM_HS_BINTERVAL 2 |
Pawel Zarembski |
0:01f31e923fe2 | 338 | #define USBD_CDC_ACM_EP_BULKIN 4 |
Pawel Zarembski |
0:01f31e923fe2 | 339 | #define USBD_CDC_ACM_EP_BULKOUT 4 |
Pawel Zarembski |
0:01f31e923fe2 | 340 | #define USBD_CDC_ACM_EP_BULKIN_STACK 0 |
Pawel Zarembski |
0:01f31e923fe2 | 341 | #define USBD_CDC_ACM_WMAXPACKETSIZE1 64 |
Pawel Zarembski |
0:01f31e923fe2 | 342 | #define USBD_CDC_ACM_HS_ENABLE1 0 |
Pawel Zarembski |
0:01f31e923fe2 | 343 | #define USBD_CDC_ACM_HS_WMAXPACKETSIZE1 64 |
Pawel Zarembski |
0:01f31e923fe2 | 344 | #define USBD_CDC_ACM_HS_BINTERVAL1 0 |
Pawel Zarembski |
0:01f31e923fe2 | 345 | #define USBD_CDC_ACM_CIF_STRDESC L"mbed Serial Port" |
Pawel Zarembski |
0:01f31e923fe2 | 346 | #define USBD_CDC_ACM_DIF_STRDESC L"mbed Serial Port" |
Pawel Zarembski |
0:01f31e923fe2 | 347 | #define USBD_CDC_ACM_SENDBUF_SIZE 64 |
Pawel Zarembski |
0:01f31e923fe2 | 348 | #define USBD_CDC_ACM_RECEIVEBUF_SIZE 64 |
Pawel Zarembski |
0:01f31e923fe2 | 349 | #if (((USBD_CDC_ACM_HS_ENABLE1) && (USBD_CDC_ACM_SENDBUF_SIZE < USBD_CDC_ACM_HS_WMAXPACKETSIZE1)) || (USBD_CDC_ACM_SENDBUF_SIZE < USBD_CDC_ACM_WMAXPACKETSIZE1)) |
Pawel Zarembski |
0:01f31e923fe2 | 350 | #error "Send Buffer size must be larger or equal to Bulk In maximum packet size!" |
Pawel Zarembski |
0:01f31e923fe2 | 351 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 352 | #if (((USBD_CDC_ACM_HS_ENABLE1) && (USBD_CDC_ACM_RECEIVEBUF_SIZE < USBD_CDC_ACM_HS_WMAXPACKETSIZE1)) || (USBD_CDC_ACM_RECEIVEBUF_SIZE < USBD_CDC_ACM_WMAXPACKETSIZE1)) |
Pawel Zarembski |
0:01f31e923fe2 | 353 | #error "Receive Buffer size must be larger or equal to Bulk Out maximum packet size!" |
Pawel Zarembski |
0:01f31e923fe2 | 354 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 355 | |
Pawel Zarembski |
0:01f31e923fe2 | 356 | // <e0> Custom Class Device |
Pawel Zarembski |
0:01f31e923fe2 | 357 | // <i> Enables USB Custom Class Requests |
Pawel Zarembski |
0:01f31e923fe2 | 358 | // <i> Class IDs: |
Pawel Zarembski |
0:01f31e923fe2 | 359 | // <i> 0x00 - Class Reserved ID |
Pawel Zarembski |
0:01f31e923fe2 | 360 | // <i> 0x01 - Class Audio ID |
Pawel Zarembski |
0:01f31e923fe2 | 361 | // <i> 0x02 - Class Communications ID |
Pawel Zarembski |
0:01f31e923fe2 | 362 | // <i> 0x03 - Class Human Interface ID |
Pawel Zarembski |
0:01f31e923fe2 | 363 | // <i> 0x04 - Class Monitor ID |
Pawel Zarembski |
0:01f31e923fe2 | 364 | // <i> 0x05 - Class Physical Interface ID |
Pawel Zarembski |
0:01f31e923fe2 | 365 | // <i> 0x06 - Class Power ID |
Pawel Zarembski |
0:01f31e923fe2 | 366 | // <i> 0x07 - Class Printer ID |
Pawel Zarembski |
0:01f31e923fe2 | 367 | // <i> 0x08 - Class Storage ID |
Pawel Zarembski |
0:01f31e923fe2 | 368 | // <i> 0x09 - Class HUB ID |
Pawel Zarembski |
0:01f31e923fe2 | 369 | // <i> 0xEF - Class Miscellaneous ID |
Pawel Zarembski |
0:01f31e923fe2 | 370 | // <i> 0xFF - Class Vendor Specific ID |
Pawel Zarembski |
0:01f31e923fe2 | 371 | // </e> |
Pawel Zarembski |
0:01f31e923fe2 | 372 | #define USBD_CLS_ENABLE 0 |
Pawel Zarembski |
0:01f31e923fe2 | 373 | |
Pawel Zarembski |
0:01f31e923fe2 | 374 | // WebUSB support |
Pawel Zarembski |
0:01f31e923fe2 | 375 | #define USBD_WEBUSB_ENABLE WEBUSB_INTERFACE |
Pawel Zarembski |
0:01f31e923fe2 | 376 | #define USBD_WEBUSB_VENDOR_CODE 0x21 |
Pawel Zarembski |
0:01f31e923fe2 | 377 | #define USBD_WEBUSB_LANDING_URL "os.mbed.com/webusb/landing-page/?bid=" |
Pawel Zarembski |
0:01f31e923fe2 | 378 | #define USBD_WEBUSB_ORIGIN_URL "os.mbed.com/" |
Pawel Zarembski |
0:01f31e923fe2 | 379 | |
Pawel Zarembski |
0:01f31e923fe2 | 380 | // Microsoft OS Descriptors 2.0 (WinUSB) support |
Pawel Zarembski |
0:01f31e923fe2 | 381 | #define USBD_WINUSB_ENABLE WINUSB_INTERFACE |
Pawel Zarembski |
0:01f31e923fe2 | 382 | #define USBD_WINUSB_VENDOR_CODE 0x20 |
Pawel Zarembski |
0:01f31e923fe2 | 383 | // </e> |
Pawel Zarembski |
0:01f31e923fe2 | 384 | // </e> |
Pawel Zarembski |
0:01f31e923fe2 | 385 | |
Pawel Zarembski |
0:01f31e923fe2 | 386 | #ifndef BULK_ENDPOINT |
Pawel Zarembski |
0:01f31e923fe2 | 387 | #define BULK_ENDPOINT 0 |
Pawel Zarembski |
0:01f31e923fe2 | 388 | #else |
Pawel Zarembski |
0:01f31e923fe2 | 389 | #define BULK_ENDPOINT 1 |
Pawel Zarembski |
0:01f31e923fe2 | 390 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 391 | //There are only 5 pyhical endpt so get the hid endpts |
Pawel Zarembski |
0:01f31e923fe2 | 392 | #define USBD_BULK_ENABLE BULK_ENDPOINT |
Pawel Zarembski |
0:01f31e923fe2 | 393 | #define USBD_BULK_EP_BULKIN 1 |
Pawel Zarembski |
0:01f31e923fe2 | 394 | #define USBD_BULK_EP_BULKOUT 1 |
Pawel Zarembski |
0:01f31e923fe2 | 395 | #define USBD_BULK_WMAXPACKETSIZE 64 |
Pawel Zarembski |
0:01f31e923fe2 | 396 | #define USBD_BULK_HS_ENABLE 0 |
Pawel Zarembski |
0:01f31e923fe2 | 397 | #define USBD_BULK_HS_WMAXPACKETSIZE 512 |
Pawel Zarembski |
0:01f31e923fe2 | 398 | #define USBD_BULK_STRDESC L"CMSIS-DAP v2" |
Pawel Zarembski |
0:01f31e923fe2 | 399 | |
Pawel Zarembski |
0:01f31e923fe2 | 400 | /* USB Device Calculations ---------------------------------------------------*/ |
Pawel Zarembski |
0:01f31e923fe2 | 401 | |
Pawel Zarembski |
0:01f31e923fe2 | 402 | #define USBD_IF_NUM_MAX (USBD_BULK_ENABLE+USBD_WEBUSB_ENABLE+USBD_HID_ENABLE+USBD_MSC_ENABLE+(USBD_ADC_ENABLE*2)+(USBD_CDC_ACM_ENABLE*2)+USBD_CLS_ENABLE) |
Pawel Zarembski |
0:01f31e923fe2 | 403 | #define USBD_MULTI_IF (USBD_CDC_ACM_ENABLE*(USBD_HID_ENABLE|USBD_MSC_ENABLE|USBD_ADC_ENABLE|USBD_CLS_ENABLE|USBD_WEBUSB_ENABLE|USBD_BULK_ENABLE)) |
Pawel Zarembski |
0:01f31e923fe2 | 404 | // #define MAX(x, y) (((x) < (y)) ? (y) : (x)) |
Pawel Zarembski |
0:01f31e923fe2 | 405 | #define USBD_EP_NUM_CALC0 MAX((USBD_HID_ENABLE *(USBD_HID_EP_INTIN )), (USBD_HID_ENABLE *(USBD_HID_EP_INTOUT!=0)*(USBD_HID_EP_INTOUT))) |
Pawel Zarembski |
0:01f31e923fe2 | 406 | #define USBD_EP_NUM_CALC1 MAX((USBD_MSC_ENABLE *(USBD_MSC_EP_BULKIN )), (USBD_MSC_ENABLE *(USBD_MSC_EP_BULKOUT))) |
Pawel Zarembski |
0:01f31e923fe2 | 407 | #define USBD_EP_NUM_CALC2 MAX((USBD_ADC_ENABLE *(USBD_ADC_EP_ISOOUT )), (USBD_CDC_ACM_ENABLE*(USBD_CDC_ACM_EP_INTIN))) |
Pawel Zarembski |
0:01f31e923fe2 | 408 | #define USBD_EP_NUM_CALC3 MAX((USBD_CDC_ACM_ENABLE*(USBD_CDC_ACM_EP_BULKIN)), (USBD_CDC_ACM_ENABLE*(USBD_CDC_ACM_EP_BULKOUT))) |
Pawel Zarembski |
0:01f31e923fe2 | 409 | #define USBD_EP_NUM_CALC4 MAX(USBD_EP_NUM_CALC0, USBD_EP_NUM_CALC1) |
Pawel Zarembski |
0:01f31e923fe2 | 410 | #define USBD_EP_NUM_CALC5 MAX(USBD_EP_NUM_CALC2, USBD_EP_NUM_CALC3) |
Pawel Zarembski |
0:01f31e923fe2 | 411 | #define USBD_EP_NUM_CALC6 MAX(USBD_EP_NUM_CALC4, USBD_EP_NUM_CALC5) |
Pawel Zarembski |
0:01f31e923fe2 | 412 | #define USBD_EP_NUM_CALC7 MAX((USBD_BULK_ENABLE*(USBD_BULK_EP_BULKIN)), (USBD_BULK_ENABLE*(USBD_BULK_EP_BULKOUT))) |
Pawel Zarembski |
0:01f31e923fe2 | 413 | #define USBD_EP_NUM MAX(USBD_EP_NUM_CALC6, USBD_EP_NUM_CALC7) |
Pawel Zarembski |
0:01f31e923fe2 | 414 | |
Pawel Zarembski |
0:01f31e923fe2 | 415 | #if (USBD_EP_NUM > 5) |
Pawel Zarembski |
0:01f31e923fe2 | 416 | #error "Lpc11u35 only have 5 pyhsical endpoints including EP0!" |
Pawel Zarembski |
0:01f31e923fe2 | 417 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 418 | |
Pawel Zarembski |
0:01f31e923fe2 | 419 | #if (USBD_HID_ENABLE) |
Pawel Zarembski |
0:01f31e923fe2 | 420 | #if (USBD_MSC_ENABLE) |
Pawel Zarembski |
0:01f31e923fe2 | 421 | #if ((((USBD_HID_EP_INTIN == USBD_MSC_EP_BULKIN) || \ |
Pawel Zarembski |
0:01f31e923fe2 | 422 | (USBD_HID_EP_INTIN == USBD_MSC_EP_BULKOUT))) || \ |
Pawel Zarembski |
0:01f31e923fe2 | 423 | ((USBD_HID_EP_INTOUT != 0) && \ |
Pawel Zarembski |
0:01f31e923fe2 | 424 | (USBD_HID_EP_INTOUT == USBD_MSC_EP_BULKIN) || \ |
Pawel Zarembski |
0:01f31e923fe2 | 425 | (USBD_HID_EP_INTOUT == USBD_MSC_EP_BULKOUT))) |
Pawel Zarembski |
0:01f31e923fe2 | 426 | #error "HID and Mass Storage Device Interface can not use same Endpoints!" |
Pawel Zarembski |
0:01f31e923fe2 | 427 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 428 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 429 | #if (USBD_ADC_ENABLE) |
Pawel Zarembski |
0:01f31e923fe2 | 430 | #if ((USBD_HID_EP_INTIN == USBD_ADC_EP_ISOOUT) || \ |
Pawel Zarembski |
0:01f31e923fe2 | 431 | ((USBD_HID_EP_INTOUT != 0) && \ |
Pawel Zarembski |
0:01f31e923fe2 | 432 | (USBD_HID_EP_INTOUT == USBD_ADC_EP_ISOOUT))) |
Pawel Zarembski |
0:01f31e923fe2 | 433 | #error "HID and Audio Device Interface can not use same Endpoints!" |
Pawel Zarembski |
0:01f31e923fe2 | 434 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 435 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 436 | #if (USBD_CDC_ACM_ENABLE) |
Pawel Zarembski |
0:01f31e923fe2 | 437 | #if (((USBD_HID_EP_INTIN == USBD_CDC_ACM_EP_INTIN) || \ |
Pawel Zarembski |
0:01f31e923fe2 | 438 | (USBD_HID_EP_INTIN == USBD_CDC_ACM_EP_BULKIN) || \ |
Pawel Zarembski |
0:01f31e923fe2 | 439 | (USBD_HID_EP_INTIN == USBD_CDC_ACM_EP_BULKOUT))|| \ |
Pawel Zarembski |
0:01f31e923fe2 | 440 | ((USBD_HID_EP_INTOUT != 0) && \ |
Pawel Zarembski |
0:01f31e923fe2 | 441 | ((USBD_HID_EP_INTOUT == USBD_CDC_ACM_EP_INTIN) || \ |
Pawel Zarembski |
0:01f31e923fe2 | 442 | (USBD_HID_EP_INTOUT == USBD_CDC_ACM_EP_BULKIN) || \ |
Pawel Zarembski |
0:01f31e923fe2 | 443 | (USBD_HID_EP_INTOUT == USBD_CDC_ACM_EP_BULKOUT)))) |
Pawel Zarembski |
0:01f31e923fe2 | 444 | #error "HID and Communication Device Interface can not use same Endpoints!" |
Pawel Zarembski |
0:01f31e923fe2 | 445 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 446 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 447 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 448 | |
Pawel Zarembski |
0:01f31e923fe2 | 449 | #if (USBD_MSC_ENABLE) |
Pawel Zarembski |
0:01f31e923fe2 | 450 | #if (USBD_ADC_ENABLE) |
Pawel Zarembski |
0:01f31e923fe2 | 451 | #if ((USBD_MSC_EP_BULKIN == USBD_ADC_EP_ISOOUT) || \ |
Pawel Zarembski |
0:01f31e923fe2 | 452 | (USBD_MSC_EP_BULKOUT == USBD_ADC_EP_ISOOUT)) |
Pawel Zarembski |
0:01f31e923fe2 | 453 | #error "Mass Storage Device and Audio Device Interface can not use same Endpoints!" |
Pawel Zarembski |
0:01f31e923fe2 | 454 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 455 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 456 | #if (USBD_CDC_ACM_ENABLE) |
Pawel Zarembski |
0:01f31e923fe2 | 457 | #if ((USBD_MSC_EP_BULKIN == USBD_CDC_ACM_EP_INTIN) || \ |
Pawel Zarembski |
0:01f31e923fe2 | 458 | (USBD_MSC_EP_BULKIN == USBD_CDC_ACM_EP_BULKIN) || \ |
Pawel Zarembski |
0:01f31e923fe2 | 459 | (USBD_MSC_EP_BULKIN == USBD_CDC_ACM_EP_BULKOUT) || \ |
Pawel Zarembski |
0:01f31e923fe2 | 460 | (USBD_MSC_EP_BULKOUT == USBD_CDC_ACM_EP_INTIN) || \ |
Pawel Zarembski |
0:01f31e923fe2 | 461 | (USBD_MSC_EP_BULKOUT == USBD_CDC_ACM_EP_BULKIN) || \ |
Pawel Zarembski |
0:01f31e923fe2 | 462 | (USBD_MSC_EP_BULKOUT == USBD_CDC_ACM_EP_BULKOUT)) |
Pawel Zarembski |
0:01f31e923fe2 | 463 | #error "Mass Storage Device and Communication Device Interface can not use same Endpoints!" |
Pawel Zarembski |
0:01f31e923fe2 | 464 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 465 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 466 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 467 | |
Pawel Zarembski |
0:01f31e923fe2 | 468 | #if (USBD_ADC_ENABLE) |
Pawel Zarembski |
0:01f31e923fe2 | 469 | #if (USBD_CDC_ACM_ENABLE) |
Pawel Zarembski |
0:01f31e923fe2 | 470 | #if ((USBD_ADC_EP_ISOOUT == USBD_CDC_ACM_EP_INTIN) || \ |
Pawel Zarembski |
0:01f31e923fe2 | 471 | (USBD_ADC_EP_ISOOUT == USBD_CDC_ACM_EP_BULKIN) || \ |
Pawel Zarembski |
0:01f31e923fe2 | 472 | (USBD_ADC_EP_ISOOUT == USBD_CDC_ACM_EP_BULKOUT)) |
Pawel Zarembski |
0:01f31e923fe2 | 473 | #error "Audio Device and Communication Device Interface can not use same Endpoints!" |
Pawel Zarembski |
0:01f31e923fe2 | 474 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 475 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 476 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 477 | |
Pawel Zarembski |
0:01f31e923fe2 | 478 | #define USBD_ADC_CIF_NUM (0) |
Pawel Zarembski |
0:01f31e923fe2 | 479 | #define USBD_ADC_SIF1_NUM (1) |
Pawel Zarembski |
0:01f31e923fe2 | 480 | #define USBD_ADC_SIF2_NUM (2) |
Pawel Zarembski |
0:01f31e923fe2 | 481 | |
Pawel Zarembski |
0:01f31e923fe2 | 482 | |
Pawel Zarembski |
0:01f31e923fe2 | 483 | #define USBD_ADC_CIF_STR_NUM (3+USBD_STRDESC_SER_ENABLE+0) |
Pawel Zarembski |
0:01f31e923fe2 | 484 | #define USBD_ADC_SIF1_STR_NUM (3+USBD_STRDESC_SER_ENABLE+1) |
Pawel Zarembski |
0:01f31e923fe2 | 485 | #define USBD_ADC_SIF2_STR_NUM (3+USBD_STRDESC_SER_ENABLE+2) |
Pawel Zarembski |
0:01f31e923fe2 | 486 | #define USBD_CDC_ACM_CIF_STR_NUM (3+USBD_STRDESC_SER_ENABLE+USBD_ADC_ENABLE*3+0) |
Pawel Zarembski |
0:01f31e923fe2 | 487 | #define USBD_CDC_ACM_DIF_STR_NUM (3+USBD_STRDESC_SER_ENABLE+USBD_ADC_ENABLE*3+1) |
Pawel Zarembski |
0:01f31e923fe2 | 488 | #define USBD_HID_IF_STR_NUM (3+USBD_STRDESC_SER_ENABLE+USBD_ADC_ENABLE*3+USBD_CDC_ACM_ENABLE*2) |
Pawel Zarembski |
0:01f31e923fe2 | 489 | #define USBD_WEBUSB_IF_STR_NUM (3+USBD_STRDESC_SER_ENABLE+USBD_ADC_ENABLE*3+USBD_CDC_ACM_ENABLE*2+USBD_HID_ENABLE) |
Pawel Zarembski |
0:01f31e923fe2 | 490 | #define USBD_MSC_IF_STR_NUM (3+USBD_STRDESC_SER_ENABLE+USBD_ADC_ENABLE*3+USBD_CDC_ACM_ENABLE*2+USBD_HID_ENABLE+USBD_WEBUSB_ENABLE) |
Pawel Zarembski |
0:01f31e923fe2 | 491 | #define USBD_BULK_IF_STR_NUM (3+USBD_STRDESC_SER_ENABLE+USBD_ADC_ENABLE*3+USBD_CDC_ACM_ENABLE*2+USBD_HID_ENABLE+USBD_WEBUSB_ENABLE+USBD_BULK_ENABLE) |
Pawel Zarembski |
0:01f31e923fe2 | 492 | |
Pawel Zarembski |
0:01f31e923fe2 | 493 | #if (USBD_HID_ENABLE) |
Pawel Zarembski |
0:01f31e923fe2 | 494 | #if (USBD_HID_HS_ENABLE) |
Pawel Zarembski |
0:01f31e923fe2 | 495 | #define USBD_HID_MAX_PACKET ((USBD_HID_HS_WMAXPACKETSIZE > USBD_HID_WMAXPACKETSIZE) ? USBD_HID_HS_WMAXPACKETSIZE : USBD_HID_WMAXPACKETSIZE) |
Pawel Zarembski |
0:01f31e923fe2 | 496 | #else |
Pawel Zarembski |
0:01f31e923fe2 | 497 | #define USBD_HID_MAX_PACKET (USBD_HID_WMAXPACKETSIZE) |
Pawel Zarembski |
0:01f31e923fe2 | 498 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 499 | #else |
Pawel Zarembski |
0:01f31e923fe2 | 500 | #define USBD_HID_MAX_PACKET (0) |
Pawel Zarembski |
0:01f31e923fe2 | 501 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 502 | #if (USBD_MSC_ENABLE) |
Pawel Zarembski |
0:01f31e923fe2 | 503 | #if (USBD_MSC_HS_ENABLE) |
Pawel Zarembski |
0:01f31e923fe2 | 504 | #define USBD_MSC_MAX_PACKET ((USBD_MSC_HS_WMAXPACKETSIZE > USBD_MSC_WMAXPACKETSIZE) ? USBD_MSC_HS_WMAXPACKETSIZE : USBD_MSC_WMAXPACKETSIZE) |
Pawel Zarembski |
0:01f31e923fe2 | 505 | #else |
Pawel Zarembski |
0:01f31e923fe2 | 506 | #define USBD_MSC_MAX_PACKET (USBD_MSC_WMAXPACKETSIZE) |
Pawel Zarembski |
0:01f31e923fe2 | 507 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 508 | #else |
Pawel Zarembski |
0:01f31e923fe2 | 509 | #define USBD_MSC_MAX_PACKET (0) |
Pawel Zarembski |
0:01f31e923fe2 | 510 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 511 | #if (USBD_ADC_ENABLE) |
Pawel Zarembski |
0:01f31e923fe2 | 512 | #if (USBD_ADC_HS_ENABLE) |
Pawel Zarembski |
0:01f31e923fe2 | 513 | #define USBD_ADC_MAX_PACKET ((USBD_ADC_HS_WMAXPACKETSIZE > USBD_ADC_WMAXPACKETSIZE) ? USBD_ADC_HS_WMAXPACKETSIZE : USBD_ADC_WMAXPACKETSIZE) |
Pawel Zarembski |
0:01f31e923fe2 | 514 | #else |
Pawel Zarembski |
0:01f31e923fe2 | 515 | #define USBD_ADC_MAX_PACKET (USBD_ADC_WMAXPACKETSIZE) |
Pawel Zarembski |
0:01f31e923fe2 | 516 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 517 | #else |
Pawel Zarembski |
0:01f31e923fe2 | 518 | #define USBD_ADC_MAX_PACKET (0) |
Pawel Zarembski |
0:01f31e923fe2 | 519 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 520 | #if (USBD_CDC_ACM_ENABLE) |
Pawel Zarembski |
0:01f31e923fe2 | 521 | #if (USBD_CDC_ACM_HS_ENABLE) |
Pawel Zarembski |
0:01f31e923fe2 | 522 | #define USBD_CDC_ACM_MAX_PACKET ((USBD_CDC_ACM_HS_WMAXPACKETSIZE > USBD_CDC_ACM_WMAXPACKETSIZE) ? USBD_CDC_ACM_HS_WMAXPACKETSIZE : USBD_CDC_ACM_WMAXPACKETSIZE) |
Pawel Zarembski |
0:01f31e923fe2 | 523 | #else |
Pawel Zarembski |
0:01f31e923fe2 | 524 | #define USBD_CDC_ACM_MAX_PACKET (USBD_CDC_ACM_WMAXPACKETSIZE) |
Pawel Zarembski |
0:01f31e923fe2 | 525 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 526 | #if (USBD_CDC_ACM_HS_ENABLE1) |
Pawel Zarembski |
0:01f31e923fe2 | 527 | #define USBD_CDC_ACM_MAX_PACKET1 ((USBD_CDC_ACM_HS_WMAXPACKETSIZE1 > USBD_CDC_ACM_WMAXPACKETSIZE1) ? USBD_CDC_ACM_HS_WMAXPACKETSIZE1 : USBD_CDC_ACM_WMAXPACKETSIZE1) |
Pawel Zarembski |
0:01f31e923fe2 | 528 | #else |
Pawel Zarembski |
0:01f31e923fe2 | 529 | #define USBD_CDC_ACM_MAX_PACKET1 (USBD_CDC_ACM_WMAXPACKETSIZE1) |
Pawel Zarembski |
0:01f31e923fe2 | 530 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 531 | #else |
Pawel Zarembski |
0:01f31e923fe2 | 532 | #define USBD_CDC_ACM_MAX_PACKET (0) |
Pawel Zarembski |
0:01f31e923fe2 | 533 | #define USBD_CDC_ACM_MAX_PACKET1 (0) |
Pawel Zarembski |
0:01f31e923fe2 | 534 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 535 | |
Pawel Zarembski |
0:01f31e923fe2 | 536 | #if (USBD_BULK_ENABLE) |
Pawel Zarembski |
0:01f31e923fe2 | 537 | #if (USBD_BULK_HS_ENABLE) |
Pawel Zarembski |
0:01f31e923fe2 | 538 | #define USBD_BULK_MAX_PACKET ((USBD_BULK_HS_WMAXPACKETSIZE > USBD_BULK_WMAXPACKETSIZE) ? USBD_BULK_HS_WMAXPACKETSIZE : USBD_BULK_WMAXPACKETSIZE) |
Pawel Zarembski |
0:01f31e923fe2 | 539 | #else |
Pawel Zarembski |
0:01f31e923fe2 | 540 | #define USBD_BULK_MAX_PACKET (USBD_BULK_WMAXPACKETSIZE) |
Pawel Zarembski |
0:01f31e923fe2 | 541 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 542 | #else |
Pawel Zarembski |
0:01f31e923fe2 | 543 | #define USBD_BULK_MAX_PACKET (0) |
Pawel Zarembski |
0:01f31e923fe2 | 544 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 545 | |
Pawel Zarembski |
0:01f31e923fe2 | 546 | #define USBD_MAX_PACKET_CALC0 ((USBD_HID_MAX_PACKET > USBD_HID_MAX_PACKET ) ? (USBD_HID_MAX_PACKET ) : (USBD_HID_MAX_PACKET )) |
Pawel Zarembski |
0:01f31e923fe2 | 547 | #define USBD_MAX_PACKET_CALC1 ((USBD_ADC_MAX_PACKET > USBD_CDC_ACM_MAX_PACKET ) ? (USBD_ADC_MAX_PACKET ) : (USBD_CDC_ACM_MAX_PACKET )) |
Pawel Zarembski |
0:01f31e923fe2 | 548 | #define USBD_MAX_PACKET_CALC2 ((USBD_MAX_PACKET_CALC0 > USBD_MAX_PACKET_CALC1 ) ? (USBD_MAX_PACKET_CALC0) : (USBD_MAX_PACKET_CALC1 )) |
Pawel Zarembski |
0:01f31e923fe2 | 549 | #define USBD_MAX_PACKET_CALC3 ((USBD_BULK_MAX_PACKET > USBD_CDC_ACM_MAX_PACKET1 ) ? (USBD_BULK_MAX_PACKET) : (USBD_CDC_ACM_MAX_PACKET1 )) |
Pawel Zarembski |
0:01f31e923fe2 | 550 | #define USBD_MAX_PACKET ((USBD_MAX_PACKET_CALC3 > USBD_MAX_PACKET_CALC2 ) ? (USBD_MAX_PACKET_CALC3) : (USBD_MAX_PACKET_CALC2 )) |
Pawel Zarembski |
0:01f31e923fe2 | 551 | |
Pawel Zarembski |
0:01f31e923fe2 | 552 | |
Pawel Zarembski |
0:01f31e923fe2 | 553 | /*------------------------------------------------------------------------------ |
Pawel Zarembski |
0:01f31e923fe2 | 554 | * USB Config Functions |
Pawel Zarembski |
0:01f31e923fe2 | 555 | *----------------------------------------------------------------------------*/ |
Pawel Zarembski |
0:01f31e923fe2 | 556 | |
Pawel Zarembski |
0:01f31e923fe2 | 557 | #ifndef __USB_CONFIG___ |
Pawel Zarembski |
0:01f31e923fe2 | 558 | #define __USB_CONFIG__ |
Pawel Zarembski |
0:01f31e923fe2 | 559 | |
Pawel Zarembski |
0:01f31e923fe2 | 560 | #ifndef __NO_USB_LIB_C |
Pawel Zarembski |
0:01f31e923fe2 | 561 | #include "usb_lib.c" |
Pawel Zarembski |
0:01f31e923fe2 | 562 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 563 | |
Pawel Zarembski |
0:01f31e923fe2 | 564 | #endif /* __USB_CONFIG__ */ |