Repostiory containing DAPLink source code with Reset Pin workaround for HANI_IOT board.
Upstream: https://github.com/ARMmbed/DAPLink
source/hic_hal/nuvoton/m48ssidae/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-2016, 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 | |
Pawel Zarembski |
0:01f31e923fe2 | 31 | // <o0.0> High-speed |
Pawel Zarembski |
0:01f31e923fe2 | 32 | // <i> Enable high-speed functionality (if device supports it) |
Pawel Zarembski |
0:01f31e923fe2 | 33 | #define USBD_HS_ENABLE 1 |
Pawel Zarembski |
0:01f31e923fe2 | 34 | #if (defined(WEBUSB_INTERFACE) || defined(WINUSB_INTERFACE) || defined(BULK_ENDPOINT)) |
Pawel Zarembski |
0:01f31e923fe2 | 35 | #define USBD_BOS_ENABLE 1 |
Pawel Zarembski |
0:01f31e923fe2 | 36 | #else |
Pawel Zarembski |
0:01f31e923fe2 | 37 | #define USBD_BOS_ENABLE 0 |
Pawel Zarembski |
0:01f31e923fe2 | 38 | #endif |
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 64 |
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 //was 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 | #define USBD_STRDESC_PROD L"DAPLink CMSIS-DAP" |
Pawel Zarembski |
0:01f31e923fe2 | 91 | #define USBD_STRDESC_SER_ENABLE 1 |
Pawel Zarembski |
0:01f31e923fe2 | 92 | #define USBD_STRDESC_SER L"0001A0000000" |
Pawel Zarembski |
0:01f31e923fe2 | 93 | |
Pawel Zarembski |
0:01f31e923fe2 | 94 | // <e0> Class Support |
Pawel Zarembski |
0:01f31e923fe2 | 95 | // <i> Enables USB Device Class specific Requests |
Pawel Zarembski |
0:01f31e923fe2 | 96 | #define USBD_CLASS_ENABLE 1 |
Pawel Zarembski |
0:01f31e923fe2 | 97 | |
Pawel Zarembski |
0:01f31e923fe2 | 98 | // <e0.0> Human Interface Device (HID) |
Pawel Zarembski |
0:01f31e923fe2 | 99 | // <i> Enable class support for Human Interface Device (HID) |
Pawel Zarembski |
0:01f31e923fe2 | 100 | // <h> Interrupt Endpoint Settings |
Pawel Zarembski |
0:01f31e923fe2 | 101 | // <o1.0..4> Interrupt In Endpoint Number <1=> 1 <2=> 2 <3=> 3 |
Pawel Zarembski |
0:01f31e923fe2 | 102 | // <4=> 4 <5=> 5 <6=> 6 <7=> 7 |
Pawel Zarembski |
0:01f31e923fe2 | 103 | // <8=> 8 <9=> 9 <10=> 10 <11=> 11 |
Pawel Zarembski |
0:01f31e923fe2 | 104 | // <12=> 12 <13=> 13 <14=> 14 <15=> 15 |
Pawel Zarembski |
0:01f31e923fe2 | 105 | // <o2.0..4> Interrupt Out Endpoint Number <0=> Not used <1=> 1 <2=> 2 <3=> 3 |
Pawel Zarembski |
0:01f31e923fe2 | 106 | // <4=> 4 <5=> 5 <6=> 6 <7=> 7 |
Pawel Zarembski |
0:01f31e923fe2 | 107 | // <8=> 8 <9=> 9 <10=> 10 <11=> 11 |
Pawel Zarembski |
0:01f31e923fe2 | 108 | // <12=> 12 <13=> 13 <14=> 14 <15=> 15 |
Pawel Zarembski |
0:01f31e923fe2 | 109 | // <i> If interrupt out endpoint is not used select "Not used" |
Pawel Zarembski |
0:01f31e923fe2 | 110 | // <h> Endpoint Settings |
Pawel Zarembski |
0:01f31e923fe2 | 111 | // <o3.0..7> Maximum Endpoint Packet Size (in bytes) <0-64> |
Pawel Zarembski |
0:01f31e923fe2 | 112 | // <o4.0..7> Endpoint polling Interval (in ms) <1-255> |
Pawel Zarembski |
0:01f31e923fe2 | 113 | // <e5> High-speed |
Pawel Zarembski |
0:01f31e923fe2 | 114 | // <i> If high-speed is enabled set endpoint settings for it |
Pawel Zarembski |
0:01f31e923fe2 | 115 | // <o6.0..10> Maximum Endpoint Packet Size (in bytes) <0-1024> |
Pawel Zarembski |
0:01f31e923fe2 | 116 | // <o6.11..12> Additional transactions per microframe <0=> None <1=> 1 additional <2=> 2 additional |
Pawel Zarembski |
0:01f31e923fe2 | 117 | // <o7.0..7> Endpoint polling Interval (in ms) <1=> 1 <2=> 2 <3=> 4 <4=> 8 |
Pawel Zarembski |
0:01f31e923fe2 | 118 | // <5=> 16 <6=> 32 <7=> 64 <8=> 128 |
Pawel Zarembski |
0:01f31e923fe2 | 119 | // <9=> 256 <10=> 512 <11=> 1024 <12=> 2048 |
Pawel Zarembski |
0:01f31e923fe2 | 120 | // <13=> 4096 <14=> 8192 <15=> 16384 <16=> 32768 |
Pawel Zarembski |
0:01f31e923fe2 | 121 | // </e> |
Pawel Zarembski |
0:01f31e923fe2 | 122 | // </h> |
Pawel Zarembski |
0:01f31e923fe2 | 123 | // </h> |
Pawel Zarembski |
0:01f31e923fe2 | 124 | // <h> Human Interface Device Settings |
Pawel Zarembski |
0:01f31e923fe2 | 125 | // <i> Device specific settings |
Pawel Zarembski |
0:01f31e923fe2 | 126 | // <s0.126> HID Interface String |
Pawel Zarembski |
0:01f31e923fe2 | 127 | // <o8.0..4> Number of Input Reports <1-32> |
Pawel Zarembski |
0:01f31e923fe2 | 128 | // <o9.0..4> Number of Output Reports <1-32> |
Pawel Zarembski |
0:01f31e923fe2 | 129 | // <o10.0..15> Maximum Input Report Size (in bytes) <1-65535> |
Pawel Zarembski |
0:01f31e923fe2 | 130 | // <o11.0..15> Maximum Output Report Size (in bytes) <1-65535> |
Pawel Zarembski |
0:01f31e923fe2 | 131 | // <o12.0..15> Maximum Feature Report Size (in bytes) <1-65535> |
Pawel Zarembski |
0:01f31e923fe2 | 132 | // </h> |
Pawel Zarembski |
0:01f31e923fe2 | 133 | // </e> |
Pawel Zarembski |
0:01f31e923fe2 | 134 | #ifndef HID_ENDPOINT |
Pawel Zarembski |
0:01f31e923fe2 | 135 | #define HID_ENDPOINT 0 |
Pawel Zarembski |
0:01f31e923fe2 | 136 | #else |
Pawel Zarembski |
0:01f31e923fe2 | 137 | #define HID_ENDPOINT 1 |
Pawel Zarembski |
0:01f31e923fe2 | 138 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 139 | |
Pawel Zarembski |
0:01f31e923fe2 | 140 | #ifndef WEBUSB_INTERFACE |
Pawel Zarembski |
0:01f31e923fe2 | 141 | #define WEBUSB_INTERFACE 0 |
Pawel Zarembski |
0:01f31e923fe2 | 142 | #else |
Pawel Zarembski |
0:01f31e923fe2 | 143 | #define WEBUSB_INTERFACE 1 |
Pawel Zarembski |
0:01f31e923fe2 | 144 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 145 | |
Pawel Zarembski |
0:01f31e923fe2 | 146 | #define USBD_HID_ENABLE HID_ENDPOINT |
Pawel Zarembski |
0:01f31e923fe2 | 147 | #ifndef BULK_ENDPOINT //check if bulk endpoint is not enabled |
Pawel Zarembski |
0:01f31e923fe2 | 148 | #define USBD_HID_EP_INTIN 1 |
Pawel Zarembski |
0:01f31e923fe2 | 149 | #define USBD_HID_EP_INTOUT 2 |
Pawel Zarembski |
0:01f31e923fe2 | 150 | #else //if bulk endpoint is enabled remove interrupt endpoints from the hid |
Pawel Zarembski |
0:01f31e923fe2 | 151 | #define USBD_HID_EP_INTIN 0 |
Pawel Zarembski |
0:01f31e923fe2 | 152 | #define USBD_HID_EP_INTOUT 0 |
Pawel Zarembski |
0:01f31e923fe2 | 153 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 154 | #define USBD_HID_EP_INTIN_STACK 0 |
Pawel Zarembski |
0:01f31e923fe2 | 155 | #define USBD_HID_WMAXPACKETSIZE 64 |
Pawel Zarembski |
0:01f31e923fe2 | 156 | #define USBD_HID_BINTERVAL 1 |
Pawel Zarembski |
0:01f31e923fe2 | 157 | #define USBD_HID_HS_ENABLE 1 |
Pawel Zarembski |
0:01f31e923fe2 | 158 | #define USBD_HID_HS_WMAXPACKETSIZE 64 |
Pawel Zarembski |
0:01f31e923fe2 | 159 | #define USBD_HID_HS_BINTERVAL 4 |
Pawel Zarembski |
0:01f31e923fe2 | 160 | #define USBD_HID_STRDESC L"CMSIS-DAP v1" |
Pawel Zarembski |
0:01f31e923fe2 | 161 | #define USBD_WEBUSB_STRDESC L"WebUSB: CMSIS-DAP" |
Pawel Zarembski |
0:01f31e923fe2 | 162 | #define USBD_HID_INREPORT_NUM 1 |
Pawel Zarembski |
0:01f31e923fe2 | 163 | #define USBD_HID_OUTREPORT_NUM 1 |
Pawel Zarembski |
0:01f31e923fe2 | 164 | #define USBD_HID_INREPORT_MAX_SZ 64 |
Pawel Zarembski |
0:01f31e923fe2 | 165 | #define USBD_HID_OUTREPORT_MAX_SZ 64 |
Pawel Zarembski |
0:01f31e923fe2 | 166 | #define USBD_HID_FEATREPORT_MAX_SZ 1 |
Pawel Zarembski |
0:01f31e923fe2 | 167 | |
Pawel Zarembski |
0:01f31e923fe2 | 168 | // <e0.0> Mass Storage Device (MSC) |
Pawel Zarembski |
0:01f31e923fe2 | 169 | // <i> Enable class support for Mass Storage Device (MSC) |
Pawel Zarembski |
0:01f31e923fe2 | 170 | // <h> Bulk Endpoint Settings |
Pawel Zarembski |
0:01f31e923fe2 | 171 | // <o1.0..4> Bulk In Endpoint Number <1=> 1 <2=> 2 <3=> 3 |
Pawel Zarembski |
0:01f31e923fe2 | 172 | // <4=> 4 <5=> 5 <6=> 6 <7=> 7 |
Pawel Zarembski |
0:01f31e923fe2 | 173 | // <8=> 8 <9=> 9 <10=> 10 <11=> 11 |
Pawel Zarembski |
0:01f31e923fe2 | 174 | // <12=> 12 <13=> 13 <14=> 14 <15=> 15 |
Pawel Zarembski |
0:01f31e923fe2 | 175 | // <o2.0..4> Bulk Out Endpoint Number <1=> 1 <2=> 2 <3=> 3 |
Pawel Zarembski |
0:01f31e923fe2 | 176 | // <4=> 4 <5=> 5 <6=> 6 <7=> 7 |
Pawel Zarembski |
0:01f31e923fe2 | 177 | // <8=> 8 <9=> 9 <10=> 10 <11=> 11 |
Pawel Zarembski |
0:01f31e923fe2 | 178 | // <12=> 12 <13=> 13 <14=> 14 <15=> 15 |
Pawel Zarembski |
0:01f31e923fe2 | 179 | // <h> Endpoint Settings |
Pawel Zarembski |
0:01f31e923fe2 | 180 | // <o3> Maximum Packet Size <1-1024> |
Pawel Zarembski |
0:01f31e923fe2 | 181 | // <e4> High-speed |
Pawel Zarembski |
0:01f31e923fe2 | 182 | // <i> If high-speed is enabled set endpoint settings for it |
Pawel Zarembski |
0:01f31e923fe2 | 183 | // <o5> Maximum Packet Size <1-1024> |
Pawel Zarembski |
0:01f31e923fe2 | 184 | // <o6> Maximum NAK Rate <0-255> |
Pawel Zarembski |
0:01f31e923fe2 | 185 | // </e> |
Pawel Zarembski |
0:01f31e923fe2 | 186 | // </h> |
Pawel Zarembski |
0:01f31e923fe2 | 187 | // </h> |
Pawel Zarembski |
0:01f31e923fe2 | 188 | // <h> Mass Storage Device Settings |
Pawel Zarembski |
0:01f31e923fe2 | 189 | // <i> Device specific settings |
Pawel Zarembski |
0:01f31e923fe2 | 190 | // <s0.126> MSC Interface String |
Pawel Zarembski |
0:01f31e923fe2 | 191 | // <h> Inquiry Data |
Pawel Zarembski |
0:01f31e923fe2 | 192 | // <s1.8> Vendor Identification |
Pawel Zarembski |
0:01f31e923fe2 | 193 | // <s2.16> Product Identification |
Pawel Zarembski |
0:01f31e923fe2 | 194 | // <s3.4> Product Revision Level |
Pawel Zarembski |
0:01f31e923fe2 | 195 | // </h> |
Pawel Zarembski |
0:01f31e923fe2 | 196 | // </h> |
Pawel Zarembski |
0:01f31e923fe2 | 197 | // </e> |
Pawel Zarembski |
0:01f31e923fe2 | 198 | #ifndef MSC_ENDPOINT |
Pawel Zarembski |
0:01f31e923fe2 | 199 | #define MSC_ENDPOINT 0 |
Pawel Zarembski |
0:01f31e923fe2 | 200 | #else |
Pawel Zarembski |
0:01f31e923fe2 | 201 | #define MSC_ENDPOINT 1 |
Pawel Zarembski |
0:01f31e923fe2 | 202 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 203 | #define USBD_MSC_ENABLE MSC_ENDPOINT |
Pawel Zarembski |
0:01f31e923fe2 | 204 | #define USBD_MSC_EP_BULKIN 6 |
Pawel Zarembski |
0:01f31e923fe2 | 205 | #define USBD_MSC_EP_BULKOUT 7 |
Pawel Zarembski |
0:01f31e923fe2 | 206 | #define USBD_MSC_EP_BULKIN_STACK 0 |
Pawel Zarembski |
0:01f31e923fe2 | 207 | #define USBD_MSC_WMAXPACKETSIZE 64 |
Pawel Zarembski |
0:01f31e923fe2 | 208 | #define USBD_MSC_HS_ENABLE 1 |
Pawel Zarembski |
0:01f31e923fe2 | 209 | #define USBD_MSC_HS_WMAXPACKETSIZE 512 |
Pawel Zarembski |
0:01f31e923fe2 | 210 | #define USBD_MSC_HS_BINTERVAL 0 |
Pawel Zarembski |
0:01f31e923fe2 | 211 | #define USBD_MSC_STRDESC L"USB_MSC" |
Pawel Zarembski |
0:01f31e923fe2 | 212 | // Make sure changes to USBD_MSC_INQUIRY_DATA are coordinated with mbed-ls |
Pawel Zarembski |
0:01f31e923fe2 | 213 | // since this is used to detect DAPLink drives |
Pawel Zarembski |
0:01f31e923fe2 | 214 | #define USBD_MSC_INQUIRY_DATA "MBED " \ |
Pawel Zarembski |
0:01f31e923fe2 | 215 | "VFS " \ |
Pawel Zarembski |
0:01f31e923fe2 | 216 | "0.1" |
Pawel Zarembski |
0:01f31e923fe2 | 217 | |
Pawel Zarembski |
0:01f31e923fe2 | 218 | // <e0.0> Audio Device (ADC) |
Pawel Zarembski |
0:01f31e923fe2 | 219 | // <i> Enable class support for Audio Device (ADC) |
Pawel Zarembski |
0:01f31e923fe2 | 220 | // <h> Isochronous Endpoint Settings |
Pawel Zarembski |
0:01f31e923fe2 | 221 | // <o1.0..4> Isochronous Out Endpoint Number <1=> 1 <2=> 2 <3=> 3 |
Pawel Zarembski |
0:01f31e923fe2 | 222 | // <4=> 4 <5=> 5 <6=> 6 <7=> 7 |
Pawel Zarembski |
0:01f31e923fe2 | 223 | // <8=> 8 <9=> 9 <10=> 10 <11=> 11 |
Pawel Zarembski |
0:01f31e923fe2 | 224 | // <12=> 12 <13=> 13 <14=> 14 <15=> 15 |
Pawel Zarembski |
0:01f31e923fe2 | 225 | // <h> Endpoint Settings |
Pawel Zarembski |
0:01f31e923fe2 | 226 | // <o2.0..10> Maximum Endpoint Packet Size (in bytes) <0-1024> |
Pawel Zarembski |
0:01f31e923fe2 | 227 | // <o3.0..10> Endpoint polling Interval (in ms) <1=> 1 <2=> 2 <3=> 4 <4=> 8 |
Pawel Zarembski |
0:01f31e923fe2 | 228 | // <5=> 16 <6=> 32 <7=> 64 <8=> 128 |
Pawel Zarembski |
0:01f31e923fe2 | 229 | // <9=> 256 <10=> 512 <11=> 1024 <12=> 2048 |
Pawel Zarembski |
0:01f31e923fe2 | 230 | // <13=> 4096 <14=> 8192 <15=> 16384 <16=> 32768 |
Pawel Zarembski |
0:01f31e923fe2 | 231 | // <e4> High-speed |
Pawel Zarembski |
0:01f31e923fe2 | 232 | // <i> If high-speed is enabled set endpoint settings for it |
Pawel Zarembski |
0:01f31e923fe2 | 233 | // <o5.0..10> Maximum Endpoint Packet Size (in bytes) <0-1024> |
Pawel Zarembski |
0:01f31e923fe2 | 234 | // <o5.11..12> Additional transactions per microframe <0=> None <1=> 1 additional <2=> 2 additional |
Pawel Zarembski |
0:01f31e923fe2 | 235 | // </e> |
Pawel Zarembski |
0:01f31e923fe2 | 236 | // </h> |
Pawel Zarembski |
0:01f31e923fe2 | 237 | // </h> |
Pawel Zarembski |
0:01f31e923fe2 | 238 | // <h> Audio Device Settings |
Pawel Zarembski |
0:01f31e923fe2 | 239 | // <i> Device specific settings |
Pawel Zarembski |
0:01f31e923fe2 | 240 | // <s0.126> Audio Control Interface String |
Pawel Zarembski |
0:01f31e923fe2 | 241 | // <s1.126> Audio Streaming (Zero Bandwidth) Interface String |
Pawel Zarembski |
0:01f31e923fe2 | 242 | // <s2.126> Audio Streaming (Operational) Interface String |
Pawel Zarembski |
0:01f31e923fe2 | 243 | // <o6.0..7> Audio Subframe Size (in bytes) <0-255> |
Pawel Zarembski |
0:01f31e923fe2 | 244 | // <o7.0..7> Sample Resolution (in bits) <0-255> |
Pawel Zarembski |
0:01f31e923fe2 | 245 | // <o8.0..23> Sample Frequency (in Hz) <0-16777215> |
Pawel Zarembski |
0:01f31e923fe2 | 246 | // <o9> Packet Size (in bytes) <1-256> |
Pawel Zarembski |
0:01f31e923fe2 | 247 | // <o10> Packet Count <1-16> |
Pawel Zarembski |
0:01f31e923fe2 | 248 | // </h> |
Pawel Zarembski |
0:01f31e923fe2 | 249 | // </e> |
Pawel Zarembski |
0:01f31e923fe2 | 250 | #define USBD_ADC_ENABLE 0 |
Pawel Zarembski |
0:01f31e923fe2 | 251 | #define USBD_ADC_EP_ISOOUT 3 |
Pawel Zarembski |
0:01f31e923fe2 | 252 | #define USBD_ADC_WMAXPACKETSIZE 64 |
Pawel Zarembski |
0:01f31e923fe2 | 253 | #define USBD_ADC_BINTERVAL 1 |
Pawel Zarembski |
0:01f31e923fe2 | 254 | #define USBD_ADC_HS_ENABLE 0 |
Pawel Zarembski |
0:01f31e923fe2 | 255 | #define USBD_ADC_HS_WMAXPACKETSIZE 64 |
Pawel Zarembski |
0:01f31e923fe2 | 256 | #define USBD_ADC_CIF_STRDESC L"USB_ADC" |
Pawel Zarembski |
0:01f31e923fe2 | 257 | #define USBD_ADC_SIF1_STRDESC L"USB_ADC1" |
Pawel Zarembski |
0:01f31e923fe2 | 258 | #define USBD_ADC_SIF2_STRDESC L"USB_ADC2" |
Pawel Zarembski |
0:01f31e923fe2 | 259 | #define USBD_ADC_BSUBFRAMESIZE 2 |
Pawel Zarembski |
0:01f31e923fe2 | 260 | #define USBD_ADC_BBITRESOLUTION 16 |
Pawel Zarembski |
0:01f31e923fe2 | 261 | #define USBD_ADC_TSAMFREQ 32000 |
Pawel Zarembski |
0:01f31e923fe2 | 262 | #define USBD_ADC_CFG_P_S 32 |
Pawel Zarembski |
0:01f31e923fe2 | 263 | #define USBD_ADC_CFG_P_C 1 |
Pawel Zarembski |
0:01f31e923fe2 | 264 | |
Pawel Zarembski |
0:01f31e923fe2 | 265 | // <e0> Communication Device (CDC) - Abstract Control Model (ACM) |
Pawel Zarembski |
0:01f31e923fe2 | 266 | // <i> Enable class support for Communication Device (CDC) - Abstract Control Model (ACM) |
Pawel Zarembski |
0:01f31e923fe2 | 267 | // <h> Interrupt Endpoint Settings |
Pawel Zarembski |
0:01f31e923fe2 | 268 | // <o1.0..4> Interrupt In Endpoint Number <1=> 1 <2=> 2 <3=> 3 |
Pawel Zarembski |
0:01f31e923fe2 | 269 | // <4=> 4 <5=> 5 <6=> 6 <7=> 7 |
Pawel Zarembski |
0:01f31e923fe2 | 270 | // <8=> 8 <9=> 9 <10=> 10 <11=> 11 |
Pawel Zarembski |
0:01f31e923fe2 | 271 | // <12=> 12 <13=> 13 <14=> 14 <15=> 15 |
Pawel Zarembski |
0:01f31e923fe2 | 272 | // <h> Endpoint Settings |
Pawel Zarembski |
0:01f31e923fe2 | 273 | // <o2.0..10> Maximum Endpoint Packet Size (in bytes) <0-1024> |
Pawel Zarembski |
0:01f31e923fe2 | 274 | // <o3.0..10> Endpoint polling Interval (in ms) <0-255> |
Pawel Zarembski |
0:01f31e923fe2 | 275 | // <e4> High-speed |
Pawel Zarembski |
0:01f31e923fe2 | 276 | // <i> If high-speed is enabled set endpoint settings for it |
Pawel Zarembski |
0:01f31e923fe2 | 277 | // <o5.0..10> Maximum Endpoint Packet Size (in bytes) <0-1024> |
Pawel Zarembski |
0:01f31e923fe2 | 278 | // <o5.11..12> Additional transactions per microframe <0=> None <1=> 1 additional <2=> 2 additional |
Pawel Zarembski |
0:01f31e923fe2 | 279 | // <o6.0..10> Endpoint polling Interval (in ms) <1=> 1 <2=> 2 <3=> 4 <4=> 8 |
Pawel Zarembski |
0:01f31e923fe2 | 280 | // <5=> 16 <6=> 32 <7=> 64 <8=> 128 |
Pawel Zarembski |
0:01f31e923fe2 | 281 | // <9=> 256 <10=> 512 <11=> 1024 <12=> 2048 |
Pawel Zarembski |
0:01f31e923fe2 | 282 | // <13=> 4096 <14=> 8192 <15=> 16384 <16=> 32768 |
Pawel Zarembski |
0:01f31e923fe2 | 283 | // </e4> |
Pawel Zarembski |
0:01f31e923fe2 | 284 | // </h> |
Pawel Zarembski |
0:01f31e923fe2 | 285 | // </h> |
Pawel Zarembski |
0:01f31e923fe2 | 286 | // <h> Bulk Endpoint Settings |
Pawel Zarembski |
0:01f31e923fe2 | 287 | // <o7.0..4> Bulk In Endpoint Number <1=> 1 <2=> 2 <3=> 3 |
Pawel Zarembski |
0:01f31e923fe2 | 288 | // <4=> 4 <5=> 5 <6=> 6 <7=> 7 |
Pawel Zarembski |
0:01f31e923fe2 | 289 | // <8=> 8 <9=> 9 <10=> 10 <11=> 11 |
Pawel Zarembski |
0:01f31e923fe2 | 290 | // <12=> 12 <13=> 13 <14=> 14 <15=> 15 |
Pawel Zarembski |
0:01f31e923fe2 | 291 | // <o8.0..4> Bulk Out Endpoint Number <1=> 1 <2=> 2 <3=> 3 |
Pawel Zarembski |
0:01f31e923fe2 | 292 | // <4=> 4 <5=> 5 <6=> 6 <7=> 7 |
Pawel Zarembski |
0:01f31e923fe2 | 293 | // <8=> 8 <9=> 9 <10=> 10 <11=> 11 |
Pawel Zarembski |
0:01f31e923fe2 | 294 | // <12=> 12 <13=> 13 <14=> 14 <15=> 15 |
Pawel Zarembski |
0:01f31e923fe2 | 295 | // <h> Endpoint Settings |
Pawel Zarembski |
0:01f31e923fe2 | 296 | // <o9> Maximum Packet Size <1-1024> |
Pawel Zarembski |
0:01f31e923fe2 | 297 | // <e10> High-speed |
Pawel Zarembski |
0:01f31e923fe2 | 298 | // <i> If high-speed is enabled set endpoint settings for it |
Pawel Zarembski |
0:01f31e923fe2 | 299 | // <o11> Maximum Packet Size <1-1024> |
Pawel Zarembski |
0:01f31e923fe2 | 300 | // <o12> Maximum NAK Rate <0-255> |
Pawel Zarembski |
0:01f31e923fe2 | 301 | // </e10> |
Pawel Zarembski |
0:01f31e923fe2 | 302 | // </h> |
Pawel Zarembski |
0:01f31e923fe2 | 303 | // </h> |
Pawel Zarembski |
0:01f31e923fe2 | 304 | // <h> Communication Device Settings |
Pawel Zarembski |
0:01f31e923fe2 | 305 | // <i> Device specific settings |
Pawel Zarembski |
0:01f31e923fe2 | 306 | // <s0.126> Communication Class Interface String |
Pawel Zarembski |
0:01f31e923fe2 | 307 | // <s1.126> Data Class Interface String |
Pawel Zarembski |
0:01f31e923fe2 | 308 | // <o13> Maximum Communication Device Send Buffer Size |
Pawel Zarembski |
0:01f31e923fe2 | 309 | // <8=> 8 Bytes <16=> 16 Bytes <32=> 32 Bytes <64=> 64 Bytes <128=> 128 Bytes |
Pawel Zarembski |
0:01f31e923fe2 | 310 | // <256=> 256 Bytes <512=> 512 Bytes <1024=> 1024 Bytes |
Pawel Zarembski |
0:01f31e923fe2 | 311 | // <o14> Maximum Communication Device Receive Buffer Size |
Pawel Zarembski |
0:01f31e923fe2 | 312 | // <i> Minimum size must be as big as maximum packet size for Bulk Out Endpoint |
Pawel Zarembski |
0:01f31e923fe2 | 313 | // <8=> 8 Bytes <16=> 16 Bytes <32=> 32 Bytes <64=> 64 Bytes <128=> 128 Bytes |
Pawel Zarembski |
0:01f31e923fe2 | 314 | // <256=> 256 Bytes <512=> 512 Bytes <1024=> 1024 Bytes |
Pawel Zarembski |
0:01f31e923fe2 | 315 | // </h> |
Pawel Zarembski |
0:01f31e923fe2 | 316 | // </e> |
Pawel Zarembski |
0:01f31e923fe2 | 317 | |
Pawel Zarembski |
0:01f31e923fe2 | 318 | #ifndef CDC_ENDPOINT |
Pawel Zarembski |
0:01f31e923fe2 | 319 | #define CDC_ENDPOINT 0 |
Pawel Zarembski |
0:01f31e923fe2 | 320 | #else |
Pawel Zarembski |
0:01f31e923fe2 | 321 | #define CDC_ENDPOINT 1 |
Pawel Zarembski |
0:01f31e923fe2 | 322 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 323 | #define USBD_CDC_ACM_ENABLE CDC_ENDPOINT |
Pawel Zarembski |
0:01f31e923fe2 | 324 | #define USBD_CDC_ACM_EP_INTIN 3 |
Pawel Zarembski |
0:01f31e923fe2 | 325 | #define USBD_CDC_ACM_EP_INTIN_STACK 0 |
Pawel Zarembski |
0:01f31e923fe2 | 326 | #define USBD_CDC_ACM_WMAXPACKETSIZE 64 |
Pawel Zarembski |
0:01f31e923fe2 | 327 | #define USBD_CDC_ACM_BINTERVAL 32 |
Pawel Zarembski |
0:01f31e923fe2 | 328 | #define USBD_CDC_ACM_HS_ENABLE 1 |
Pawel Zarembski |
0:01f31e923fe2 | 329 | #define USBD_CDC_ACM_HS_WMAXPACKETSIZE 64 |
Pawel Zarembski |
0:01f31e923fe2 | 330 | #define USBD_CDC_ACM_HS_BINTERVAL 2 |
Pawel Zarembski |
0:01f31e923fe2 | 331 | #define USBD_CDC_ACM_EP_BULKIN 4 |
Pawel Zarembski |
0:01f31e923fe2 | 332 | #define USBD_CDC_ACM_EP_BULKOUT 5 |
Pawel Zarembski |
0:01f31e923fe2 | 333 | #define USBD_CDC_ACM_EP_BULKIN_STACK 0 |
Pawel Zarembski |
0:01f31e923fe2 | 334 | #define USBD_CDC_ACM_WMAXPACKETSIZE1 64 |
Pawel Zarembski |
0:01f31e923fe2 | 335 | #define USBD_CDC_ACM_HS_ENABLE1 1 |
Pawel Zarembski |
0:01f31e923fe2 | 336 | #define USBD_CDC_ACM_HS_WMAXPACKETSIZE1 512 |
Pawel Zarembski |
0:01f31e923fe2 | 337 | #define USBD_CDC_ACM_HS_BINTERVAL1 0 |
Pawel Zarembski |
0:01f31e923fe2 | 338 | #define USBD_CDC_ACM_CIF_STRDESC L"mbed Serial Port" |
Pawel Zarembski |
0:01f31e923fe2 | 339 | #define USBD_CDC_ACM_DIF_STRDESC L"mbed Serial Port" |
Pawel Zarembski |
0:01f31e923fe2 | 340 | #define USBD_CDC_ACM_SENDBUF_SIZE 512 |
Pawel Zarembski |
0:01f31e923fe2 | 341 | #define USBD_CDC_ACM_RECEIVEBUF_SIZE 512 |
Pawel Zarembski |
0:01f31e923fe2 | 342 | #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 | 343 | #error "Send Buffer size must be larger or equal to Bulk In maximum packet size!" |
Pawel Zarembski |
0:01f31e923fe2 | 344 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 345 | #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 | 346 | #error "Receive Buffer size must be larger or equal to Bulk Out maximum packet size!" |
Pawel Zarembski |
0:01f31e923fe2 | 347 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 348 | |
Pawel Zarembski |
0:01f31e923fe2 | 349 | // <e0> Custom Class Device |
Pawel Zarembski |
0:01f31e923fe2 | 350 | // <i> Enables USB Custom Class Requests |
Pawel Zarembski |
0:01f31e923fe2 | 351 | // <i> Class IDs: |
Pawel Zarembski |
0:01f31e923fe2 | 352 | // <i> 0x00 - Class Reserved ID |
Pawel Zarembski |
0:01f31e923fe2 | 353 | // <i> 0x01 - Class Audio ID |
Pawel Zarembski |
0:01f31e923fe2 | 354 | // <i> 0x02 - Class Communications ID |
Pawel Zarembski |
0:01f31e923fe2 | 355 | // <i> 0x03 - Class Human Interface ID |
Pawel Zarembski |
0:01f31e923fe2 | 356 | // <i> 0x04 - Class Monitor ID |
Pawel Zarembski |
0:01f31e923fe2 | 357 | // <i> 0x05 - Class Physical Interface ID |
Pawel Zarembski |
0:01f31e923fe2 | 358 | // <i> 0x06 - Class Power ID |
Pawel Zarembski |
0:01f31e923fe2 | 359 | // <i> 0x07 - Class Printer ID |
Pawel Zarembski |
0:01f31e923fe2 | 360 | // <i> 0x08 - Class Storage ID |
Pawel Zarembski |
0:01f31e923fe2 | 361 | // <i> 0x09 - Class HUB ID |
Pawel Zarembski |
0:01f31e923fe2 | 362 | // <i> 0xEF - Class Miscellaneous ID |
Pawel Zarembski |
0:01f31e923fe2 | 363 | // <i> 0xFF - Class Vendor Specific ID |
Pawel Zarembski |
0:01f31e923fe2 | 364 | // </e> |
Pawel Zarembski |
0:01f31e923fe2 | 365 | #define USBD_CLS_ENABLE 0 |
Pawel Zarembski |
0:01f31e923fe2 | 366 | |
Pawel Zarembski |
0:01f31e923fe2 | 367 | // WebUSB support |
Pawel Zarembski |
0:01f31e923fe2 | 368 | #define USBD_WEBUSB_ENABLE WEBUSB_INTERFACE |
Pawel Zarembski |
0:01f31e923fe2 | 369 | #define USBD_WEBUSB_VENDOR_CODE 0x21 |
Pawel Zarembski |
0:01f31e923fe2 | 370 | #define USBD_WEBUSB_LANDING_URL "os.mbed.com/webusb/landing-page/?bid=" |
Pawel Zarembski |
0:01f31e923fe2 | 371 | #define USBD_WEBUSB_ORIGIN_URL "os.mbed.com/" |
Pawel Zarembski |
0:01f31e923fe2 | 372 | |
Pawel Zarembski |
0:01f31e923fe2 | 373 | // Microsoft OS Descriptors 2.0 (WinUSB) support |
Pawel Zarembski |
0:01f31e923fe2 | 374 | #define USBD_WINUSB_ENABLE WINUSB_INTERFACE |
Pawel Zarembski |
0:01f31e923fe2 | 375 | #define USBD_WINUSB_VENDOR_CODE 0x20 |
Pawel Zarembski |
0:01f31e923fe2 | 376 | // </e> |
Pawel Zarembski |
0:01f31e923fe2 | 377 | // </e> |
Pawel Zarembski |
0:01f31e923fe2 | 378 | |
Pawel Zarembski |
0:01f31e923fe2 | 379 | #ifndef BULK_ENDPOINT |
Pawel Zarembski |
0:01f31e923fe2 | 380 | #define BULK_ENDPOINT 0 |
Pawel Zarembski |
0:01f31e923fe2 | 381 | #else |
Pawel Zarembski |
0:01f31e923fe2 | 382 | #define BULK_ENDPOINT 1 |
Pawel Zarembski |
0:01f31e923fe2 | 383 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 384 | #define USBD_BULK_ENABLE BULK_ENDPOINT |
Pawel Zarembski |
0:01f31e923fe2 | 385 | #define USBD_BULK_EP_BULKIN 1 // fixme: both bulk and hid ep cannot be both enabled in a single build |
Pawel Zarembski |
0:01f31e923fe2 | 386 | #define USBD_BULK_EP_BULKOUT 1 |
Pawel Zarembski |
0:01f31e923fe2 | 387 | #define USBD_BULK_EP_BULKIN_SWO 6 |
Pawel Zarembski |
0:01f31e923fe2 | 388 | #define USBD_BULK_WMAXPACKETSIZE 64 |
Pawel Zarembski |
0:01f31e923fe2 | 389 | #define USBD_BULK_HS_ENABLE 0 |
Pawel Zarembski |
0:01f31e923fe2 | 390 | #define USBD_BULK_HS_WMAXPACKETSIZE 512 |
Pawel Zarembski |
0:01f31e923fe2 | 391 | #define USBD_BULK_STRDESC L"CMSIS-DAP v2" |
Pawel Zarembski |
0:01f31e923fe2 | 392 | |
Pawel Zarembski |
0:01f31e923fe2 | 393 | /* USB Device Calculations ---------------------------------------------------*/ |
Pawel Zarembski |
0:01f31e923fe2 | 394 | |
Pawel Zarembski |
0:01f31e923fe2 | 395 | #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 | 396 | #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 | 397 | // #define MAX(x, y) (((x) < (y)) ? (y) : (x)) |
Pawel Zarembski |
0:01f31e923fe2 | 398 | #define USBD_EP_NUM_CALC0 MAX((USBD_HID_ENABLE *(USBD_HID_EP_INTIN )), (USBD_HID_ENABLE *(USBD_HID_EP_INTOUT))) |
Pawel Zarembski |
0:01f31e923fe2 | 399 | #define USBD_EP_NUM_CALC1 MAX((USBD_MSC_ENABLE *(USBD_MSC_EP_BULKIN )), (USBD_MSC_ENABLE *(USBD_MSC_EP_BULKOUT))) |
Pawel Zarembski |
0:01f31e923fe2 | 400 | #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 | 401 | #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 | 402 | #define USBD_EP_NUM_CALC4 MAX(USBD_EP_NUM_CALC0, USBD_EP_NUM_CALC1) |
Pawel Zarembski |
0:01f31e923fe2 | 403 | #define USBD_EP_NUM_CALC5 MAX(USBD_EP_NUM_CALC2, USBD_EP_NUM_CALC3) |
Pawel Zarembski |
0:01f31e923fe2 | 404 | #define USBD_EP_NUM_CALC6 MAX(USBD_EP_NUM_CALC4, USBD_EP_NUM_CALC5) |
Pawel Zarembski |
0:01f31e923fe2 | 405 | #define USBD_EP_NUM_CALC7 MAX((USBD_BULK_ENABLE*(USBD_BULK_EP_BULKIN)), (USBD_BULK_ENABLE*(USBD_BULK_EP_BULKOUT))) |
Pawel Zarembski |
0:01f31e923fe2 | 406 | #define USBD_EP_NUM MAX(USBD_EP_NUM_CALC6, USBD_EP_NUM_CALC7) |
Pawel Zarembski |
0:01f31e923fe2 | 407 | |
Pawel Zarembski |
0:01f31e923fe2 | 408 | |
Pawel Zarembski |
0:01f31e923fe2 | 409 | #if (USBD_HID_ENABLE) |
Pawel Zarembski |
0:01f31e923fe2 | 410 | #if (USBD_MSC_ENABLE) |
Pawel Zarembski |
0:01f31e923fe2 | 411 | #if ((((USBD_HID_EP_INTIN == USBD_MSC_EP_BULKIN) || \ |
Pawel Zarembski |
0:01f31e923fe2 | 412 | (USBD_HID_EP_INTIN == USBD_MSC_EP_BULKIN)))|| \ |
Pawel Zarembski |
0:01f31e923fe2 | 413 | ((USBD_HID_EP_INTOUT != 0) && \ |
Pawel Zarembski |
0:01f31e923fe2 | 414 | (USBD_HID_EP_INTOUT == USBD_MSC_EP_BULKIN) || \ |
Pawel Zarembski |
0:01f31e923fe2 | 415 | (USBD_HID_EP_INTOUT == USBD_MSC_EP_BULKOUT))) |
Pawel Zarembski |
0:01f31e923fe2 | 416 | #error "HID and Mass Storage Device Interface can not use same Endpoints!" |
Pawel Zarembski |
0:01f31e923fe2 | 417 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 418 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 419 | #if (USBD_ADC_ENABLE) |
Pawel Zarembski |
0:01f31e923fe2 | 420 | #if ((USBD_HID_EP_INTIN == USBD_ADC_EP_ISOOUT) || \ |
Pawel Zarembski |
0:01f31e923fe2 | 421 | ((USBD_HID_EP_INTOUT != 0) && \ |
Pawel Zarembski |
0:01f31e923fe2 | 422 | (USBD_HID_EP_INTOUT == USBD_ADC_EP_ISOOUT))) |
Pawel Zarembski |
0:01f31e923fe2 | 423 | #error "HID and Audio Device Interface can not use same Endpoints!" |
Pawel Zarembski |
0:01f31e923fe2 | 424 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 425 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 426 | #if (USBD_CDC_ACM_ENABLE) |
Pawel Zarembski |
0:01f31e923fe2 | 427 | #if (((USBD_HID_EP_INTIN == USBD_CDC_ACM_EP_INTIN) || \ |
Pawel Zarembski |
0:01f31e923fe2 | 428 | (USBD_HID_EP_INTIN == USBD_CDC_ACM_EP_BULKIN) || \ |
Pawel Zarembski |
0:01f31e923fe2 | 429 | (USBD_HID_EP_INTIN == USBD_CDC_ACM_EP_BULKOUT))|| \ |
Pawel Zarembski |
0:01f31e923fe2 | 430 | ((USBD_HID_EP_INTOUT != 0) && \ |
Pawel Zarembski |
0:01f31e923fe2 | 431 | ((USBD_HID_EP_INTOUT == USBD_CDC_ACM_EP_INTIN) || \ |
Pawel Zarembski |
0:01f31e923fe2 | 432 | (USBD_HID_EP_INTOUT == USBD_CDC_ACM_EP_BULKIN) || \ |
Pawel Zarembski |
0:01f31e923fe2 | 433 | (USBD_HID_EP_INTOUT == USBD_CDC_ACM_EP_BULKOUT)))) |
Pawel Zarembski |
0:01f31e923fe2 | 434 | #error "HID and Communication Device Interface can not use same Endpoints!" |
Pawel Zarembski |
0:01f31e923fe2 | 435 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 436 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 437 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 438 | |
Pawel Zarembski |
0:01f31e923fe2 | 439 | #if (USBD_MSC_ENABLE) |
Pawel Zarembski |
0:01f31e923fe2 | 440 | #if (USBD_ADC_ENABLE) |
Pawel Zarembski |
0:01f31e923fe2 | 441 | #if ((USBD_MSC_EP_BULKIN == USBD_ADC_EP_ISOOUT) || \ |
Pawel Zarembski |
0:01f31e923fe2 | 442 | (USBD_MSC_EP_BULKOUT == USBD_ADC_EP_ISOOUT)) |
Pawel Zarembski |
0:01f31e923fe2 | 443 | #error "Mass Storage Device and Audio Device Interface can not use same Endpoints!" |
Pawel Zarembski |
0:01f31e923fe2 | 444 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 445 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 446 | #if (USBD_CDC_ACM_ENABLE) |
Pawel Zarembski |
0:01f31e923fe2 | 447 | #if ((USBD_MSC_EP_BULKIN == USBD_CDC_ACM_EP_INTIN) || \ |
Pawel Zarembski |
0:01f31e923fe2 | 448 | (USBD_MSC_EP_BULKIN == USBD_CDC_ACM_EP_BULKIN) || \ |
Pawel Zarembski |
0:01f31e923fe2 | 449 | (USBD_MSC_EP_BULKIN == USBD_CDC_ACM_EP_BULKOUT) || \ |
Pawel Zarembski |
0:01f31e923fe2 | 450 | (USBD_MSC_EP_BULKOUT == USBD_CDC_ACM_EP_INTIN) || \ |
Pawel Zarembski |
0:01f31e923fe2 | 451 | (USBD_MSC_EP_BULKOUT == USBD_CDC_ACM_EP_BULKIN) || \ |
Pawel Zarembski |
0:01f31e923fe2 | 452 | (USBD_MSC_EP_BULKOUT == USBD_CDC_ACM_EP_BULKOUT)) |
Pawel Zarembski |
0:01f31e923fe2 | 453 | #error "Mass Storage Device and Communication Device Interface can not use same Endpoints!" |
Pawel Zarembski |
0:01f31e923fe2 | 454 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 455 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 456 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 457 | |
Pawel Zarembski |
0:01f31e923fe2 | 458 | #if (USBD_ADC_ENABLE) |
Pawel Zarembski |
0:01f31e923fe2 | 459 | #if (USBD_CDC_ACM_ENABLE) |
Pawel Zarembski |
0:01f31e923fe2 | 460 | #if ((USBD_ADC_EP_ISOOUT == USBD_CDC_ACM_EP_INTIN) || \ |
Pawel Zarembski |
0:01f31e923fe2 | 461 | (USBD_ADC_EP_ISOOUT == USBD_CDC_ACM_EP_BULKIN) || \ |
Pawel Zarembski |
0:01f31e923fe2 | 462 | (USBD_ADC_EP_ISOOUT == USBD_CDC_ACM_EP_BULKOUT)) |
Pawel Zarembski |
0:01f31e923fe2 | 463 | #error "Audio 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 | #define USBD_ADC_CIF_NUM (0) |
Pawel Zarembski |
0:01f31e923fe2 | 469 | #define USBD_ADC_SIF1_NUM (1) |
Pawel Zarembski |
0:01f31e923fe2 | 470 | #define USBD_ADC_SIF2_NUM (2) |
Pawel Zarembski |
0:01f31e923fe2 | 471 | |
Pawel Zarembski |
0:01f31e923fe2 | 472 | |
Pawel Zarembski |
0:01f31e923fe2 | 473 | #define USBD_ADC_CIF_STR_NUM (3+USBD_STRDESC_SER_ENABLE+0) |
Pawel Zarembski |
0:01f31e923fe2 | 474 | #define USBD_ADC_SIF1_STR_NUM (3+USBD_STRDESC_SER_ENABLE+1) |
Pawel Zarembski |
0:01f31e923fe2 | 475 | #define USBD_ADC_SIF2_STR_NUM (3+USBD_STRDESC_SER_ENABLE+2) |
Pawel Zarembski |
0:01f31e923fe2 | 476 | #define USBD_CDC_ACM_CIF_STR_NUM (3+USBD_STRDESC_SER_ENABLE+USBD_ADC_ENABLE*3+0) |
Pawel Zarembski |
0:01f31e923fe2 | 477 | #define USBD_CDC_ACM_DIF_STR_NUM (3+USBD_STRDESC_SER_ENABLE+USBD_ADC_ENABLE*3+1) |
Pawel Zarembski |
0:01f31e923fe2 | 478 | #define USBD_HID_IF_STR_NUM (3+USBD_STRDESC_SER_ENABLE+USBD_ADC_ENABLE*3+USBD_CDC_ACM_ENABLE*2) |
Pawel Zarembski |
0:01f31e923fe2 | 479 | #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 | 480 | #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 | 481 | #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 | 482 | |
Pawel Zarembski |
0:01f31e923fe2 | 483 | |
Pawel Zarembski |
0:01f31e923fe2 | 484 | #if (USBD_HID_ENABLE) |
Pawel Zarembski |
0:01f31e923fe2 | 485 | #if (USBD_HID_HS_ENABLE) |
Pawel Zarembski |
0:01f31e923fe2 | 486 | #define USBD_HID_MAX_PACKET ((USBD_HID_HS_WMAXPACKETSIZE > USBD_HID_WMAXPACKETSIZE) ? USBD_HID_HS_WMAXPACKETSIZE : USBD_HID_WMAXPACKETSIZE) |
Pawel Zarembski |
0:01f31e923fe2 | 487 | #else |
Pawel Zarembski |
0:01f31e923fe2 | 488 | #define USBD_HID_MAX_PACKET (USBD_HID_WMAXPACKETSIZE) |
Pawel Zarembski |
0:01f31e923fe2 | 489 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 490 | #else |
Pawel Zarembski |
0:01f31e923fe2 | 491 | #define USBD_HID_MAX_PACKET (0) |
Pawel Zarembski |
0:01f31e923fe2 | 492 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 493 | #if (USBD_MSC_ENABLE) |
Pawel Zarembski |
0:01f31e923fe2 | 494 | #if (USBD_MSC_HS_ENABLE) |
Pawel Zarembski |
0:01f31e923fe2 | 495 | #define USBD_MSC_MAX_PACKET ((USBD_MSC_HS_WMAXPACKETSIZE > USBD_MSC_WMAXPACKETSIZE) ? USBD_MSC_HS_WMAXPACKETSIZE : USBD_MSC_WMAXPACKETSIZE) |
Pawel Zarembski |
0:01f31e923fe2 | 496 | #else |
Pawel Zarembski |
0:01f31e923fe2 | 497 | #define USBD_MSC_MAX_PACKET (USBD_MSC_WMAXPACKETSIZE) |
Pawel Zarembski |
0:01f31e923fe2 | 498 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 499 | #else |
Pawel Zarembski |
0:01f31e923fe2 | 500 | #define USBD_MSC_MAX_PACKET (0) |
Pawel Zarembski |
0:01f31e923fe2 | 501 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 502 | #if (USBD_ADC_ENABLE) |
Pawel Zarembski |
0:01f31e923fe2 | 503 | #if (USBD_ADC_HS_ENABLE) |
Pawel Zarembski |
0:01f31e923fe2 | 504 | #define USBD_ADC_MAX_PACKET ((USBD_ADC_HS_WMAXPACKETSIZE > USBD_ADC_WMAXPACKETSIZE) ? USBD_ADC_HS_WMAXPACKETSIZE : USBD_ADC_WMAXPACKETSIZE) |
Pawel Zarembski |
0:01f31e923fe2 | 505 | #else |
Pawel Zarembski |
0:01f31e923fe2 | 506 | #define USBD_ADC_MAX_PACKET (USBD_ADC_WMAXPACKETSIZE) |
Pawel Zarembski |
0:01f31e923fe2 | 507 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 508 | #else |
Pawel Zarembski |
0:01f31e923fe2 | 509 | #define USBD_ADC_MAX_PACKET (0) |
Pawel Zarembski |
0:01f31e923fe2 | 510 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 511 | #if (USBD_CDC_ACM_ENABLE) |
Pawel Zarembski |
0:01f31e923fe2 | 512 | #if (USBD_CDC_ACM_HS_ENABLE) |
Pawel Zarembski |
0:01f31e923fe2 | 513 | #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 | 514 | #else |
Pawel Zarembski |
0:01f31e923fe2 | 515 | #define USBD_CDC_ACM_MAX_PACKET (USBD_CDC_ACM_WMAXPACKETSIZE) |
Pawel Zarembski |
0:01f31e923fe2 | 516 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 517 | #if (USBD_CDC_ACM_HS_ENABLE1) |
Pawel Zarembski |
0:01f31e923fe2 | 518 | #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 | 519 | #else |
Pawel Zarembski |
0:01f31e923fe2 | 520 | #define USBD_CDC_ACM_MAX_PACKET1 (USBD_CDC_ACM_WMAXPACKETSIZE1) |
Pawel Zarembski |
0:01f31e923fe2 | 521 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 522 | #else |
Pawel Zarembski |
0:01f31e923fe2 | 523 | #define USBD_CDC_ACM_MAX_PACKET (0) |
Pawel Zarembski |
0:01f31e923fe2 | 524 | #define USBD_CDC_ACM_MAX_PACKET1 (0) |
Pawel Zarembski |
0:01f31e923fe2 | 525 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 526 | #if (USBD_BULK_ENABLE) |
Pawel Zarembski |
0:01f31e923fe2 | 527 | #if (USBD_BULK_HS_ENABLE) |
Pawel Zarembski |
0:01f31e923fe2 | 528 | #define USBD_BULK_MAX_PACKET ((USBD_BULK_HS_WMAXPACKETSIZE > USBD_BULK_WMAXPACKETSIZE) ? USBD_BULK_HS_WMAXPACKETSIZE : USBD_BULK_WMAXPACKETSIZE) |
Pawel Zarembski |
0:01f31e923fe2 | 529 | #else |
Pawel Zarembski |
0:01f31e923fe2 | 530 | #define USBD_BULK_MAX_PACKET (USBD_BULK_WMAXPACKETSIZE) |
Pawel Zarembski |
0:01f31e923fe2 | 531 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 532 | #else |
Pawel Zarembski |
0:01f31e923fe2 | 533 | #define USBD_BULK_MAX_PACKET (0) |
Pawel Zarembski |
0:01f31e923fe2 | 534 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 535 | |
Pawel Zarembski |
0:01f31e923fe2 | 536 | #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 | 537 | #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 | 538 | #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 | 539 | #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 | 540 | #define USBD_MAX_PACKET ((USBD_MAX_PACKET_CALC3 > USBD_MAX_PACKET_CALC2 ) ? (USBD_MAX_PACKET_CALC3) : (USBD_MAX_PACKET_CALC2 )) |
Pawel Zarembski |
0:01f31e923fe2 | 541 | |
Pawel Zarembski |
0:01f31e923fe2 | 542 | |
Pawel Zarembski |
0:01f31e923fe2 | 543 | /*------------------------------------------------------------------------------ |
Pawel Zarembski |
0:01f31e923fe2 | 544 | * USB Config Functions |
Pawel Zarembski |
0:01f31e923fe2 | 545 | *----------------------------------------------------------------------------*/ |
Pawel Zarembski |
0:01f31e923fe2 | 546 | |
Pawel Zarembski |
0:01f31e923fe2 | 547 | #ifndef __USB_CONFIG___ |
Pawel Zarembski |
0:01f31e923fe2 | 548 | #define __USB_CONFIG__ |
Pawel Zarembski |
0:01f31e923fe2 | 549 | |
Pawel Zarembski |
0:01f31e923fe2 | 550 | #ifndef __NO_USB_LIB_C |
Pawel Zarembski |
0:01f31e923fe2 | 551 | #include "usb_lib.c" |
Pawel Zarembski |
0:01f31e923fe2 | 552 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 553 | |
Pawel Zarembski |
0:01f31e923fe2 | 554 | #endif /* __USB_CONFIG__ */ |