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