Repostiory containing DAPLink source code with Reset Pin workaround for HANI_IOT board.

Upstream: https://github.com/ARMmbed/DAPLink

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?

UserRevisionLine numberNew contents of line
Pawel Zarembski 0:01f31e923fe2 1 /**
Pawel Zarembski 0:01f31e923fe2 2 * @file usb_lib.c
Pawel Zarembski 0:01f31e923fe2 3 * @brief USB library
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 <string.h>
Pawel Zarembski 0:01f31e923fe2 23 #include "rl_usb.h"
Pawel Zarembski 0:01f31e923fe2 24 #include "usb.h"
Pawel Zarembski 0:01f31e923fe2 25 #include "settings.h"
Pawel Zarembski 0:01f31e923fe2 26
Pawel Zarembski 0:01f31e923fe2 27 #pragma thumb
Pawel Zarembski 0:01f31e923fe2 28 #pragma O3
Pawel Zarembski 0:01f31e923fe2 29
Pawel Zarembski 0:01f31e923fe2 30
Pawel Zarembski 0:01f31e923fe2 31 /*------------------------------------------------------------------------------
Pawel Zarembski 0:01f31e923fe2 32 * Library for usb_config.c
Pawel Zarembski 0:01f31e923fe2 33 *----------------------------------------------------------------------------*/
Pawel Zarembski 0:01f31e923fe2 34
Pawel Zarembski 0:01f31e923fe2 35 #ifdef __USB_CONFIG__
Pawel Zarembski 0:01f31e923fe2 36
Pawel Zarembski 0:01f31e923fe2 37 /*------------------------------------------------------------------------------
Pawel Zarembski 0:01f31e923fe2 38 * USB Device Configuration
Pawel Zarembski 0:01f31e923fe2 39 *----------------------------------------------------------------------------*/
Pawel Zarembski 0:01f31e923fe2 40
Pawel Zarembski 0:01f31e923fe2 41 #if (USBD_ENABLE)
Pawel Zarembski 0:01f31e923fe2 42
Pawel Zarembski 0:01f31e923fe2 43 U8 USBD_AltSetting[USBD_IF_NUM_MAX];
Pawel Zarembski 0:01f31e923fe2 44 U8 USBD_EP0Buf[USBD_MAX_PACKET0];
Pawel Zarembski 0:01f31e923fe2 45 const U8 usbd_power = USBD_POWER;
Pawel Zarembski 0:01f31e923fe2 46 const U8 usbd_hs_enable = USBD_HS_ENABLE;
Pawel Zarembski 0:01f31e923fe2 47 const U8 usbd_bos_enable = USBD_BOS_ENABLE;
Pawel Zarembski 0:01f31e923fe2 48 U16 usbd_if_num = USBD_IF_NUM_MAX;
Pawel Zarembski 0:01f31e923fe2 49 const U8 usbd_ep_num = USBD_EP_NUM;
Pawel Zarembski 0:01f31e923fe2 50 const U8 usbd_max_packet0 = USBD_MAX_PACKET0;
Pawel Zarembski 0:01f31e923fe2 51
Pawel Zarembski 0:01f31e923fe2 52
Pawel Zarembski 0:01f31e923fe2 53 /*------------------------------------------------------------------------------
Pawel Zarembski 0:01f31e923fe2 54 * USB Device Class Configuration
Pawel Zarembski 0:01f31e923fe2 55 *----------------------------------------------------------------------------*/
Pawel Zarembski 0:01f31e923fe2 56
Pawel Zarembski 0:01f31e923fe2 57 #if (!USBD_HID_BINTERVAL)
Pawel Zarembski 0:01f31e923fe2 58 #define USBD_HID_INTERVAL 1
Pawel Zarembski 0:01f31e923fe2 59 #else
Pawel Zarembski 0:01f31e923fe2 60 #define USBD_HID_INTERVAL USBD_HID_BINTERVAL
Pawel Zarembski 0:01f31e923fe2 61 #endif
Pawel Zarembski 0:01f31e923fe2 62 #if (!USBD_HID_HS_BINTERVAL)
Pawel Zarembski 0:01f31e923fe2 63 #define USBD_HID_HS_INTERVAL 1
Pawel Zarembski 0:01f31e923fe2 64 #else
Pawel Zarembski 0:01f31e923fe2 65 #define USBD_HID_HS_INTERVAL (2 << ((USBD_HID_HS_BINTERVAL & 0x0F)-1))
Pawel Zarembski 0:01f31e923fe2 66 #endif
Pawel Zarembski 0:01f31e923fe2 67
Pawel Zarembski 0:01f31e923fe2 68 #if (USBD_HID_ENABLE)
Pawel Zarembski 0:01f31e923fe2 69 U8 usbd_hid_if_num; //assigned during runtime init
Pawel Zarembski 0:01f31e923fe2 70 const U8 usbd_hid_ep_intin = USBD_HID_EP_INTIN;
Pawel Zarembski 0:01f31e923fe2 71 const U8 usbd_hid_ep_intout = USBD_HID_EP_INTOUT;
Pawel Zarembski 0:01f31e923fe2 72 const U16 usbd_hid_interval[2] = {USBD_HID_INTERVAL, USBD_HID_HS_INTERVAL};
Pawel Zarembski 0:01f31e923fe2 73 const U16 usbd_hid_maxpacketsize[2] = {USBD_HID_WMAXPACKETSIZE, USBD_HID_HS_WMAXPACKETSIZE};
Pawel Zarembski 0:01f31e923fe2 74 const U8 usbd_hid_inreport_num = USBD_HID_INREPORT_NUM;
Pawel Zarembski 0:01f31e923fe2 75 const U8 usbd_hid_outreport_num = USBD_HID_OUTREPORT_NUM;
Pawel Zarembski 0:01f31e923fe2 76 const U16 usbd_hid_inreport_max_sz = USBD_HID_INREPORT_MAX_SZ;
Pawel Zarembski 0:01f31e923fe2 77 const U16 usbd_hid_outreport_max_sz = USBD_HID_OUTREPORT_MAX_SZ;
Pawel Zarembski 0:01f31e923fe2 78 const U16 usbd_hid_featreport_max_sz = USBD_HID_FEATREPORT_MAX_SZ;
Pawel Zarembski 0:01f31e923fe2 79 U16 USBD_HID_PollingCnt;
Pawel Zarembski 0:01f31e923fe2 80 U8 USBD_HID_IdleCnt[USBD_HID_INREPORT_NUM];
Pawel Zarembski 0:01f31e923fe2 81 U8 USBD_HID_IdleReload[USBD_HID_INREPORT_NUM];
Pawel Zarembski 0:01f31e923fe2 82 U8 USBD_HID_IdleSet[USBD_HID_INREPORT_NUM];
Pawel Zarembski 0:01f31e923fe2 83 U8 USBD_HID_InReport[USBD_HID_INREPORT_MAX_SZ + 1];
Pawel Zarembski 0:01f31e923fe2 84 U8 USBD_HID_OutReport[USBD_HID_OUTREPORT_MAX_SZ + 1];
Pawel Zarembski 0:01f31e923fe2 85 U8 USBD_HID_FeatReport[USBD_HID_FEATREPORT_MAX_SZ + 1];
Pawel Zarembski 0:01f31e923fe2 86 #endif
Pawel Zarembski 0:01f31e923fe2 87
Pawel Zarembski 0:01f31e923fe2 88 #if (USBD_MSC_ENABLE)
Pawel Zarembski 0:01f31e923fe2 89 U8 usbd_msc_if_num; //assigned during runtime init
Pawel Zarembski 0:01f31e923fe2 90 const U8 usbd_msc_ep_bulkin = USBD_MSC_EP_BULKIN;
Pawel Zarembski 0:01f31e923fe2 91 const U8 usbd_msc_ep_bulkout = USBD_MSC_EP_BULKOUT;
Pawel Zarembski 0:01f31e923fe2 92 const U16 usbd_msc_maxpacketsize[2] = {USBD_MSC_WMAXPACKETSIZE, USBD_MSC_HS_WMAXPACKETSIZE};
Pawel Zarembski 0:01f31e923fe2 93 const U8 *usbd_msc_inquiry_data = USBD_MSC_INQUIRY_DATA;
Pawel Zarembski 0:01f31e923fe2 94 const U16 USBD_MSC_BulkBufSize = USBD_MSC_MAX_PACKET;
Pawel Zarembski 0:01f31e923fe2 95 U8 USBD_MSC_BulkBuf[USBD_MSC_MAX_PACKET];
Pawel Zarembski 0:01f31e923fe2 96 #endif
Pawel Zarembski 0:01f31e923fe2 97
Pawel Zarembski 0:01f31e923fe2 98 #if (USBD_ADC_ENABLE)
Pawel Zarembski 0:01f31e923fe2 99 const U8 usbd_adc_cif_num = USBD_ADC_CIF_NUM;
Pawel Zarembski 0:01f31e923fe2 100 const U8 usbd_adc_sif1_num = USBD_ADC_SIF1_NUM;
Pawel Zarembski 0:01f31e923fe2 101 const U8 usbd_adc_sif2_num = USBD_ADC_SIF2_NUM;
Pawel Zarembski 0:01f31e923fe2 102 const U8 usbd_adc_ep_isoout = USBD_ADC_EP_ISOOUT;
Pawel Zarembski 0:01f31e923fe2 103 const U32 usbd_adc_cfg_datafreq = USBD_ADC_TSAMFREQ;
Pawel Zarembski 0:01f31e923fe2 104 const U32 usbd_adc_cfg_p_s = USBD_ADC_CFG_P_S;
Pawel Zarembski 0:01f31e923fe2 105 const U32 usbd_adc_cfg_p_c = USBD_ADC_CFG_P_C;
Pawel Zarembski 0:01f31e923fe2 106 const U32 usbd_adc_cfg_b_s = (8 * USBD_ADC_CFG_P_C *USBD_ADC_CFG_P_S);
Pawel Zarembski 0:01f31e923fe2 107 S16 USBD_ADC_DataBuf[8 * USBD_ADC_CFG_P_C * USBD_ADC_CFG_P_S];
Pawel Zarembski 0:01f31e923fe2 108 #endif
Pawel Zarembski 0:01f31e923fe2 109
Pawel Zarembski 0:01f31e923fe2 110 #ifndef USBD_CDC_ACM_ENABLE
Pawel Zarembski 0:01f31e923fe2 111 #if (USBD_CDC_ENABLE == 1)
Pawel Zarembski 0:01f31e923fe2 112 #error "Please update usb_config.c file with new definitions for CDC, as new CDC is incompatible with the old one!"
Pawel Zarembski 0:01f31e923fe2 113 #else
Pawel Zarembski 0:01f31e923fe2 114 #define USBD_CDC_ACM_ENABLE 0
Pawel Zarembski 0:01f31e923fe2 115 #endif
Pawel Zarembski 0:01f31e923fe2 116 #endif
Pawel Zarembski 0:01f31e923fe2 117
Pawel Zarembski 0:01f31e923fe2 118 #if (USBD_CDC_ACM_ENABLE)
Pawel Zarembski 0:01f31e923fe2 119 U8 usbd_cdc_acm_cif_num = 0; //assigned during runtime init
Pawel Zarembski 0:01f31e923fe2 120 U8 usbd_cdc_acm_dif_num = 0; //assigned during runtime init
Pawel Zarembski 0:01f31e923fe2 121 const U8 usbd_cdc_acm_ep_intin = USBD_CDC_ACM_EP_INTIN;
Pawel Zarembski 0:01f31e923fe2 122 const U8 usbd_cdc_acm_ep_bulkin = USBD_CDC_ACM_EP_BULKIN;
Pawel Zarembski 0:01f31e923fe2 123 const U8 usbd_cdc_acm_ep_bulkout = USBD_CDC_ACM_EP_BULKOUT;
Pawel Zarembski 0:01f31e923fe2 124 const U16 usbd_cdc_acm_sendbuf_sz = USBD_CDC_ACM_SENDBUF_SIZE;
Pawel Zarembski 0:01f31e923fe2 125 const U16 usbd_cdc_acm_receivebuf_sz = USBD_CDC_ACM_RECEIVEBUF_SIZE;
Pawel Zarembski 0:01f31e923fe2 126 const U16 usbd_cdc_acm_maxpacketsize[2] = {USBD_CDC_ACM_WMAXPACKETSIZE, USBD_CDC_ACM_HS_WMAXPACKETSIZE};
Pawel Zarembski 0:01f31e923fe2 127 const U16 usbd_cdc_acm_maxpacketsize1[2] = {USBD_CDC_ACM_WMAXPACKETSIZE1, USBD_CDC_ACM_HS_WMAXPACKETSIZE1};
Pawel Zarembski 0:01f31e923fe2 128 U8 USBD_CDC_ACM_SendBuf[USBD_CDC_ACM_SENDBUF_SIZE];
Pawel Zarembski 0:01f31e923fe2 129 U8 USBD_CDC_ACM_ReceiveBuf[USBD_CDC_ACM_RECEIVEBUF_SIZE];
Pawel Zarembski 0:01f31e923fe2 130 U8 USBD_CDC_ACM_NotifyBuf[10];
Pawel Zarembski 0:01f31e923fe2 131 #endif
Pawel Zarembski 0:01f31e923fe2 132
Pawel Zarembski 0:01f31e923fe2 133 #if (USBD_WEBUSB_ENABLE)
Pawel Zarembski 0:01f31e923fe2 134 U8 usbd_webusb_if_num; //assigned during runtime init
Pawel Zarembski 0:01f31e923fe2 135 const U8 usbd_webusb_vendor_code = USBD_WEBUSB_VENDOR_CODE;
Pawel Zarembski 0:01f31e923fe2 136 #else
Pawel Zarembski 0:01f31e923fe2 137 const U8 usbd_webusb_vendor_code;
Pawel Zarembski 0:01f31e923fe2 138 #endif
Pawel Zarembski 0:01f31e923fe2 139
Pawel Zarembski 0:01f31e923fe2 140 #if (USBD_WINUSB_ENABLE)
Pawel Zarembski 0:01f31e923fe2 141 const U8 usbd_winusb_vendor_code = USBD_WINUSB_VENDOR_CODE;
Pawel Zarembski 0:01f31e923fe2 142 #else
Pawel Zarembski 0:01f31e923fe2 143 const U8 usbd_winusb_vendor_code;
Pawel Zarembski 0:01f31e923fe2 144 #endif
Pawel Zarembski 0:01f31e923fe2 145
Pawel Zarembski 0:01f31e923fe2 146 #if (USBD_BULK_ENABLE)
Pawel Zarembski 0:01f31e923fe2 147 U8 usbd_bulk_if_num = 0; //assigned during runtime init
Pawel Zarembski 0:01f31e923fe2 148 const U8 usbd_bulk_ep_bulkin = USBD_BULK_EP_BULKIN;
Pawel Zarembski 0:01f31e923fe2 149 const U8 usbd_bulk_ep_bulkout = USBD_BULK_EP_BULKOUT;
Pawel Zarembski 0:01f31e923fe2 150 const U16 usbd_bulk_maxpacketsize[2] = {USBD_BULK_WMAXPACKETSIZE, USBD_BULK_HS_WMAXPACKETSIZE};
Pawel Zarembski 0:01f31e923fe2 151 const U16 USBD_Bulk_BulkBufSize = USBD_BULK_MAX_PACKET;
Pawel Zarembski 0:01f31e923fe2 152 U8 USBD_Bulk_BulkInBuf[USBD_BULK_MAX_PACKET];
Pawel Zarembski 0:01f31e923fe2 153 U8 USBD_Bulk_BulkOutBuf[USBD_BULK_MAX_PACKET];
Pawel Zarembski 0:01f31e923fe2 154 #endif
Pawel Zarembski 0:01f31e923fe2 155
Pawel Zarembski 0:01f31e923fe2 156 /*------------------------------------------------------------------------------
Pawel Zarembski 0:01f31e923fe2 157 * USB Device Override Event Handler Fuctions
Pawel Zarembski 0:01f31e923fe2 158 *----------------------------------------------------------------------------*/
Pawel Zarembski 0:01f31e923fe2 159
Pawel Zarembski 0:01f31e923fe2 160 #if (USBD_HID_ENABLE)
Pawel Zarembski 0:01f31e923fe2 161 #ifndef __RTX
Pawel Zarembski 0:01f31e923fe2 162 void USBD_Configure_Event(void)
Pawel Zarembski 0:01f31e923fe2 163 {
Pawel Zarembski 0:01f31e923fe2 164 USBD_HID_Configure_Event();
Pawel Zarembski 0:01f31e923fe2 165 }
Pawel Zarembski 0:01f31e923fe2 166 #endif
Pawel Zarembski 0:01f31e923fe2 167 #ifdef __RTX
Pawel Zarembski 0:01f31e923fe2 168 #if ((USBD_HID_EP_INTOUT != 0) && (USBD_HID_EP_INTIN != USBD_HID_EP_INTOUT))
Pawel Zarembski 0:01f31e923fe2 169 #if (USBD_HID_EP_INTIN == 1)
Pawel Zarembski 0:01f31e923fe2 170 #define USBD_RTX_EndPoint1 USBD_RTX_HID_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 171 #elif (USBD_HID_EP_INTIN == 2)
Pawel Zarembski 0:01f31e923fe2 172 #define USBD_RTX_EndPoint2 USBD_RTX_HID_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 173 #elif (USBD_HID_EP_INTIN == 3)
Pawel Zarembski 0:01f31e923fe2 174 #define USBD_RTX_EndPoint3 USBD_RTX_HID_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 175 #elif (USBD_HID_EP_INTIN == 4)
Pawel Zarembski 0:01f31e923fe2 176 #define USBD_RTX_EndPoint4 USBD_RTX_HID_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 177 #elif (USBD_HID_EP_INTIN == 5)
Pawel Zarembski 0:01f31e923fe2 178 #define USBD_RTX_EndPoint5 USBD_RTX_HID_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 179 #elif (USBD_HID_EP_INTIN == 6)
Pawel Zarembski 0:01f31e923fe2 180 #define USBD_RTX_EndPoint6 USBD_RTX_HID_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 181 #elif (USBD_HID_EP_INTIN == 7)
Pawel Zarembski 0:01f31e923fe2 182 #define USBD_RTX_EndPoint7 USBD_RTX_HID_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 183 #elif (USBD_HID_EP_INTIN == 8)
Pawel Zarembski 0:01f31e923fe2 184 #define USBD_RTX_EndPoint8 USBD_RTX_HID_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 185 #elif (USBD_HID_EP_INTIN == 9)
Pawel Zarembski 0:01f31e923fe2 186 #define USBD_RTX_EndPoint9 USBD_RTX_HID_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 187 #elif (USBD_HID_EP_INTIN == 10)
Pawel Zarembski 0:01f31e923fe2 188 #define USBD_RTX_EndPoint10 USBD_RTX_HID_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 189 #elif (USBD_HID_EP_INTIN == 11)
Pawel Zarembski 0:01f31e923fe2 190 #define USBD_RTX_EndPoint11 USBD_RTX_HID_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 191 #elif (USBD_HID_EP_INTIN == 12)
Pawel Zarembski 0:01f31e923fe2 192 #define USBD_RTX_EndPoint12 USBD_RTX_HID_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 193 #elif (USBD_HID_EP_INTIN == 13)
Pawel Zarembski 0:01f31e923fe2 194 #define USBD_RTX_EndPoint13 USBD_RTX_HID_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 195 #elif (USBD_HID_EP_INTIN == 14)
Pawel Zarembski 0:01f31e923fe2 196 #define USBD_RTX_EndPoint14 USBD_RTX_HID_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 197 #elif (USBD_HID_EP_INTIN == 15)
Pawel Zarembski 0:01f31e923fe2 198 #define USBD_RTX_EndPoint15 USBD_RTX_HID_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 199 #endif
Pawel Zarembski 0:01f31e923fe2 200
Pawel Zarembski 0:01f31e923fe2 201 #if (USBD_HID_EP_INTOUT == 1)
Pawel Zarembski 0:01f31e923fe2 202 #define USBD_RTX_EndPoint1 USBD_RTX_HID_EP_INTOUT_Event
Pawel Zarembski 0:01f31e923fe2 203 #elif (USBD_HID_EP_INTOUT == 2)
Pawel Zarembski 0:01f31e923fe2 204 #define USBD_RTX_EndPoint2 USBD_RTX_HID_EP_INTOUT_Event
Pawel Zarembski 0:01f31e923fe2 205 #elif (USBD_HID_EP_INTOUT == 3)
Pawel Zarembski 0:01f31e923fe2 206 #define USBD_RTX_EndPoint3 USBD_RTX_HID_EP_INTOUT_Event
Pawel Zarembski 0:01f31e923fe2 207 #elif (USBD_HID_EP_INTOUT == 4)
Pawel Zarembski 0:01f31e923fe2 208 #define USBD_RTX_EndPoint4 USBD_RTX_HID_EP_INTOUT_Event
Pawel Zarembski 0:01f31e923fe2 209 #elif (USBD_HID_EP_INTOUT == 5)
Pawel Zarembski 0:01f31e923fe2 210 #define USBD_RTX_EndPoint5 USBD_RTX_HID_EP_INTOUT_Event
Pawel Zarembski 0:01f31e923fe2 211 #elif (USBD_HID_EP_INTOUT == 6)
Pawel Zarembski 0:01f31e923fe2 212 #define USBD_RTX_EndPoint6 USBD_RTX_HID_EP_INTOUT_Event
Pawel Zarembski 0:01f31e923fe2 213 #elif (USBD_HID_EP_INTOUT == 7)
Pawel Zarembski 0:01f31e923fe2 214 #define USBD_RTX_EndPoint7 USBD_RTX_HID_EP_INTOUT_Event
Pawel Zarembski 0:01f31e923fe2 215 #elif (USBD_HID_EP_INTOUT == 8)
Pawel Zarembski 0:01f31e923fe2 216 #define USBD_RTX_EndPoint8 USBD_RTX_HID_EP_INTOUT_Event
Pawel Zarembski 0:01f31e923fe2 217 #elif (USBD_HID_EP_INTOUT == 9)
Pawel Zarembski 0:01f31e923fe2 218 #define USBD_RTX_EndPoint9 USBD_RTX_HID_EP_INTOUT_Event
Pawel Zarembski 0:01f31e923fe2 219 #elif (USBD_HID_EP_INTOUT == 10)
Pawel Zarembski 0:01f31e923fe2 220 #define USBD_RTX_EndPoint10 USBD_RTX_HID_EP_INTOUT_Event
Pawel Zarembski 0:01f31e923fe2 221 #elif (USBD_HID_EP_INTOUT == 11)
Pawel Zarembski 0:01f31e923fe2 222 #define USBD_RTX_EndPoint11 USBD_RTX_HID_EP_INTOUT_Event
Pawel Zarembski 0:01f31e923fe2 223 #elif (USBD_HID_EP_INTOUT == 12)
Pawel Zarembski 0:01f31e923fe2 224 #define USBD_RTX_EndPoint12 USBD_RTX_HID_EP_INTOUT_Event
Pawel Zarembski 0:01f31e923fe2 225 #elif (USBD_HID_EP_INTOUT == 13)
Pawel Zarembski 0:01f31e923fe2 226 #define USBD_RTX_EndPoint13 USBD_RTX_HID_EP_INTOUT_Event
Pawel Zarembski 0:01f31e923fe2 227 #elif (USBD_HID_EP_INTOUT == 14)
Pawel Zarembski 0:01f31e923fe2 228 #define USBD_RTX_EndPoint14 USBD_RTX_HID_EP_INTOUT_Event
Pawel Zarembski 0:01f31e923fe2 229 #elif (USBD_HID_EP_INTOUT == 15)
Pawel Zarembski 0:01f31e923fe2 230 #define USBD_RTX_EndPoint15 USBD_RTX_HID_EP_INTOUT_Event
Pawel Zarembski 0:01f31e923fe2 231 #endif
Pawel Zarembski 0:01f31e923fe2 232 #elif (USBD_HID_EP_INTOUT != 0)
Pawel Zarembski 0:01f31e923fe2 233 #if (USBD_HID_EP_INTIN == 1)
Pawel Zarembski 0:01f31e923fe2 234 #define USBD_RTX_EndPoint1 USBD_RTX_HID_EP_INT_Event
Pawel Zarembski 0:01f31e923fe2 235 #elif (USBD_HID_EP_INTIN == 2)
Pawel Zarembski 0:01f31e923fe2 236 #define USBD_RTX_EndPoint2 USBD_RTX_HID_EP_INT_Event
Pawel Zarembski 0:01f31e923fe2 237 #elif (USBD_HID_EP_INTIN == 3)
Pawel Zarembski 0:01f31e923fe2 238 #define USBD_RTX_EndPoint3 USBD_RTX_HID_EP_INT_Event
Pawel Zarembski 0:01f31e923fe2 239 #elif (USBD_HID_EP_INTIN == 4)
Pawel Zarembski 0:01f31e923fe2 240 #define USBD_RTX_EndPoint4 USBD_RTX_HID_EP_INT_Event
Pawel Zarembski 0:01f31e923fe2 241 #elif (USBD_HID_EP_INTIN == 5)
Pawel Zarembski 0:01f31e923fe2 242 #define USBD_RTX_EndPoint5 USBD_RTX_HID_EP_INT_Event
Pawel Zarembski 0:01f31e923fe2 243 #elif (USBD_HID_EP_INTIN == 6)
Pawel Zarembski 0:01f31e923fe2 244 #define USBD_RTX_EndPoint6 USBD_RTX_HID_EP_INT_Event
Pawel Zarembski 0:01f31e923fe2 245 #elif (USBD_HID_EP_INTIN == 7)
Pawel Zarembski 0:01f31e923fe2 246 #define USBD_RTX_EndPoint7 USBD_RTX_HID_EP_INT_Event
Pawel Zarembski 0:01f31e923fe2 247 #elif (USBD_HID_EP_INTIN == 8)
Pawel Zarembski 0:01f31e923fe2 248 #define USBD_RTX_EndPoint8 USBD_RTX_HID_EP_INT_Event
Pawel Zarembski 0:01f31e923fe2 249 #elif (USBD_HID_EP_INTIN == 9)
Pawel Zarembski 0:01f31e923fe2 250 #define USBD_RTX_EndPoint9 USBD_RTX_HID_EP_INT_Event
Pawel Zarembski 0:01f31e923fe2 251 #elif (USBD_HID_EP_INTIN == 10)
Pawel Zarembski 0:01f31e923fe2 252 #define USBD_RTX_EndPoint10 USBD_RTX_HID_EP_INT_Event
Pawel Zarembski 0:01f31e923fe2 253 #elif (USBD_HID_EP_INTIN == 11)
Pawel Zarembski 0:01f31e923fe2 254 #define USBD_RTX_EndPoint11 USBD_RTX_HID_EP_INT_Event
Pawel Zarembski 0:01f31e923fe2 255 #elif (USBD_HID_EP_INTIN == 12)
Pawel Zarembski 0:01f31e923fe2 256 #define USBD_RTX_EndPoint12 USBD_RTX_HID_EP_INT_Event
Pawel Zarembski 0:01f31e923fe2 257 #elif (USBD_HID_EP_INTIN == 13)
Pawel Zarembski 0:01f31e923fe2 258 #define USBD_RTX_EndPoint13 USBD_RTX_HID_EP_INT_Event
Pawel Zarembski 0:01f31e923fe2 259 #elif (USBD_HID_EP_INTIN == 14)
Pawel Zarembski 0:01f31e923fe2 260 #define USBD_RTX_EndPoint14 USBD_RTX_HID_EP_INT_Event
Pawel Zarembski 0:01f31e923fe2 261 #elif (USBD_HID_EP_INTIN == 15)
Pawel Zarembski 0:01f31e923fe2 262 #define USBD_RTX_EndPoint15 USBD_RTX_HID_EP_INT_Event
Pawel Zarembski 0:01f31e923fe2 263 #endif
Pawel Zarembski 0:01f31e923fe2 264 #else
Pawel Zarembski 0:01f31e923fe2 265 #if (USBD_HID_EP_INTIN == 1)
Pawel Zarembski 0:01f31e923fe2 266 #define USBD_RTX_EndPoint1 USBD_RTX_HID_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 267 #elif (USBD_HID_EP_INTIN == 2)
Pawel Zarembski 0:01f31e923fe2 268 #define USBD_RTX_EndPoint2 USBD_RTX_HID_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 269 #elif (USBD_HID_EP_INTIN == 3)
Pawel Zarembski 0:01f31e923fe2 270 #define USBD_RTX_EndPoint3 USBD_RTX_HID_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 271 #elif (USBD_HID_EP_INTIN == 4)
Pawel Zarembski 0:01f31e923fe2 272 #define USBD_RTX_EndPoint4 USBD_RTX_HID_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 273 #elif (USBD_HID_EP_INTIN == 5)
Pawel Zarembski 0:01f31e923fe2 274 #define USBD_RTX_EndPoint5 USBD_RTX_HID_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 275 #elif (USBD_HID_EP_INTIN == 6)
Pawel Zarembski 0:01f31e923fe2 276 #define USBD_RTX_EndPoint6 USBD_RTX_HID_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 277 #elif (USBD_HID_EP_INTIN == 7)
Pawel Zarembski 0:01f31e923fe2 278 #define USBD_RTX_EndPoint7 USBD_RTX_HID_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 279 #elif (USBD_HID_EP_INTIN == 8)
Pawel Zarembski 0:01f31e923fe2 280 #define USBD_RTX_EndPoint8 USBD_RTX_HID_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 281 #elif (USBD_HID_EP_INTIN == 9)
Pawel Zarembski 0:01f31e923fe2 282 #define USBD_RTX_EndPoint9 USBD_RTX_HID_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 283 #elif (USBD_HID_EP_INTIN == 10)
Pawel Zarembski 0:01f31e923fe2 284 #define USBD_RTX_EndPoint10 USBD_RTX_HID_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 285 #elif (USBD_HID_EP_INTIN == 11)
Pawel Zarembski 0:01f31e923fe2 286 #define USBD_RTX_EndPoint11 USBD_RTX_HID_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 287 #elif (USBD_HID_EP_INTIN == 12)
Pawel Zarembski 0:01f31e923fe2 288 #define USBD_RTX_EndPoint12 USBD_RTX_HID_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 289 #elif (USBD_HID_EP_INTIN == 13)
Pawel Zarembski 0:01f31e923fe2 290 #define USBD_RTX_EndPoint13 USBD_RTX_HID_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 291 #elif (USBD_HID_EP_INTIN == 14)
Pawel Zarembski 0:01f31e923fe2 292 #define USBD_RTX_EndPoint14 USBD_RTX_HID_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 293 #elif (USBD_HID_EP_INTIN == 15)
Pawel Zarembski 0:01f31e923fe2 294 #define USBD_RTX_EndPoint15 USBD_RTX_HID_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 295 #endif
Pawel Zarembski 0:01f31e923fe2 296 #endif
Pawel Zarembski 0:01f31e923fe2 297 #else
Pawel Zarembski 0:01f31e923fe2 298 #if (USBD_HID_EP_INTIN != USBD_HID_EP_INTOUT)
Pawel Zarembski 0:01f31e923fe2 299 #if (USBD_HID_EP_INTIN == 1)
Pawel Zarembski 0:01f31e923fe2 300 #define USBD_EndPoint1 USBD_HID_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 301 #elif (USBD_HID_EP_INTIN == 2)
Pawel Zarembski 0:01f31e923fe2 302 #define USBD_EndPoint2 USBD_HID_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 303 #elif (USBD_HID_EP_INTIN == 3)
Pawel Zarembski 0:01f31e923fe2 304 #define USBD_EndPoint3 USBD_HID_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 305 #elif (USBD_HID_EP_INTIN == 4)
Pawel Zarembski 0:01f31e923fe2 306 #define USBD_EndPoint4 USBD_HID_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 307 #elif (USBD_HID_EP_INTIN == 5)
Pawel Zarembski 0:01f31e923fe2 308 #define USBD_EndPoint5 USBD_HID_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 309 #elif (USBD_HID_EP_INTIN == 6)
Pawel Zarembski 0:01f31e923fe2 310 #define USBD_EndPoint6 USBD_HID_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 311 #elif (USBD_HID_EP_INTIN == 7)
Pawel Zarembski 0:01f31e923fe2 312 #define USBD_EndPoint7 USBD_HID_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 313 #elif (USBD_HID_EP_INTIN == 8)
Pawel Zarembski 0:01f31e923fe2 314 #define USBD_EndPoint8 USBD_HID_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 315 #elif (USBD_HID_EP_INTIN == 9)
Pawel Zarembski 0:01f31e923fe2 316 #define USBD_EndPoint9 USBD_HID_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 317 #elif (USBD_HID_EP_INTIN == 10)
Pawel Zarembski 0:01f31e923fe2 318 #define USBD_EndPoint10 USBD_HID_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 319 #elif (USBD_HID_EP_INTIN == 11)
Pawel Zarembski 0:01f31e923fe2 320 #define USBD_EndPoint11 USBD_HID_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 321 #elif (USBD_HID_EP_INTIN == 12)
Pawel Zarembski 0:01f31e923fe2 322 #define USBD_EndPoint12 USBD_HID_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 323 #elif (USBD_HID_EP_INTIN == 13)
Pawel Zarembski 0:01f31e923fe2 324 #define USBD_EndPoint13 USBD_HID_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 325 #elif (USBD_HID_EP_INTIN == 14)
Pawel Zarembski 0:01f31e923fe2 326 #define USBD_EndPoint14 USBD_HID_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 327 #elif (USBD_HID_EP_INTIN == 15)
Pawel Zarembski 0:01f31e923fe2 328 #define USBD_EndPoint15 USBD_HID_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 329 #endif
Pawel Zarembski 0:01f31e923fe2 330
Pawel Zarembski 0:01f31e923fe2 331 #if (USBD_HID_EP_INTOUT == 1)
Pawel Zarembski 0:01f31e923fe2 332 #define USBD_EndPoint1 USBD_HID_EP_INTOUT_Event
Pawel Zarembski 0:01f31e923fe2 333 #elif (USBD_HID_EP_INTOUT == 2)
Pawel Zarembski 0:01f31e923fe2 334 #define USBD_EndPoint2 USBD_HID_EP_INTOUT_Event
Pawel Zarembski 0:01f31e923fe2 335 #elif (USBD_HID_EP_INTOUT == 3)
Pawel Zarembski 0:01f31e923fe2 336 #define USBD_EndPoint3 USBD_HID_EP_INTOUT_Event
Pawel Zarembski 0:01f31e923fe2 337 #elif (USBD_HID_EP_INTOUT == 4)
Pawel Zarembski 0:01f31e923fe2 338 #define USBD_EndPoint4 USBD_HID_EP_INTOUT_Event
Pawel Zarembski 0:01f31e923fe2 339 #elif (USBD_HID_EP_INTOUT == 5)
Pawel Zarembski 0:01f31e923fe2 340 #define USBD_EndPoint5 USBD_HID_EP_INTOUT_Event
Pawel Zarembski 0:01f31e923fe2 341 #elif (USBD_HID_EP_INTOUT == 6)
Pawel Zarembski 0:01f31e923fe2 342 #define USBD_EndPoint6 USBD_HID_EP_INTOUT_Event
Pawel Zarembski 0:01f31e923fe2 343 #elif (USBD_HID_EP_INTOUT == 7)
Pawel Zarembski 0:01f31e923fe2 344 #define USBD_EndPoint7 USBD_HID_EP_INTOUT_Event
Pawel Zarembski 0:01f31e923fe2 345 #elif (USBD_HID_EP_INTOUT == 8)
Pawel Zarembski 0:01f31e923fe2 346 #define USBD_EndPoint8 USBD_HID_EP_INTOUT_Event
Pawel Zarembski 0:01f31e923fe2 347 #elif (USBD_HID_EP_INTOUT == 9)
Pawel Zarembski 0:01f31e923fe2 348 #define USBD_EndPoint9 USBD_HID_EP_INTOUT_Event
Pawel Zarembski 0:01f31e923fe2 349 #elif (USBD_HID_EP_INTOUT == 10)
Pawel Zarembski 0:01f31e923fe2 350 #define USBD_EndPoint10 USBD_HID_EP_INTOUT_Event
Pawel Zarembski 0:01f31e923fe2 351 #elif (USBD_HID_EP_INTOUT == 11)
Pawel Zarembski 0:01f31e923fe2 352 #define USBD_EndPoint11 USBD_HID_EP_INTOUT_Event
Pawel Zarembski 0:01f31e923fe2 353 #elif (USBD_HID_EP_INTOUT == 12)
Pawel Zarembski 0:01f31e923fe2 354 #define USBD_EndPoint12 USBD_HID_EP_INTOUT_Event
Pawel Zarembski 0:01f31e923fe2 355 #elif (USBD_HID_EP_INTOUT == 13)
Pawel Zarembski 0:01f31e923fe2 356 #define USBD_EndPoint13 USBD_HID_EP_INTOUT_Event
Pawel Zarembski 0:01f31e923fe2 357 #elif (USBD_HID_EP_INTOUT == 14)
Pawel Zarembski 0:01f31e923fe2 358 #define USBD_EndPoint14 USBD_HID_EP_INTOUT_Event
Pawel Zarembski 0:01f31e923fe2 359 #elif (USBD_HID_EP_INTOUT == 15)
Pawel Zarembski 0:01f31e923fe2 360 #define USBD_EndPoint15 USBD_HID_EP_INTOUT_Event
Pawel Zarembski 0:01f31e923fe2 361 #endif
Pawel Zarembski 0:01f31e923fe2 362
Pawel Zarembski 0:01f31e923fe2 363 #else
Pawel Zarembski 0:01f31e923fe2 364
Pawel Zarembski 0:01f31e923fe2 365 #if (USBD_HID_EP_INTIN == 1)
Pawel Zarembski 0:01f31e923fe2 366 #define USBD_EndPoint1 USBD_HID_EP_INT_Event
Pawel Zarembski 0:01f31e923fe2 367 #elif (USBD_HID_EP_INTIN == 2)
Pawel Zarembski 0:01f31e923fe2 368 #define USBD_EndPoint2 USBD_HID_EP_INT_Event
Pawel Zarembski 0:01f31e923fe2 369 #elif (USBD_HID_EP_INTIN == 3)
Pawel Zarembski 0:01f31e923fe2 370 #define USBD_EndPoint3 USBD_HID_EP_INT_Event
Pawel Zarembski 0:01f31e923fe2 371 #elif (USBD_HID_EP_INTIN == 4)
Pawel Zarembski 0:01f31e923fe2 372 #define USBD_EndPoint4 USBD_HID_EP_INT_Event
Pawel Zarembski 0:01f31e923fe2 373 #elif (USBD_HID_EP_INTIN == 5)
Pawel Zarembski 0:01f31e923fe2 374 #define USBD_EndPoint5 USBD_HID_EP_INT_Event
Pawel Zarembski 0:01f31e923fe2 375 #elif (USBD_HID_EP_INTIN == 6)
Pawel Zarembski 0:01f31e923fe2 376 #define USBD_EndPoint6 USBD_HID_EP_INT_Event
Pawel Zarembski 0:01f31e923fe2 377 #elif (USBD_HID_EP_INTIN == 7)
Pawel Zarembski 0:01f31e923fe2 378 #define USBD_EndPoint7 USBD_HID_EP_INT_Event
Pawel Zarembski 0:01f31e923fe2 379 #elif (USBD_HID_EP_INTIN == 8)
Pawel Zarembski 0:01f31e923fe2 380 #define USBD_EndPoint8 USBD_HID_EP_INT_Event
Pawel Zarembski 0:01f31e923fe2 381 #elif (USBD_HID_EP_INTIN == 9)
Pawel Zarembski 0:01f31e923fe2 382 #define USBD_EndPoint9 USBD_HID_EP_INT_Event
Pawel Zarembski 0:01f31e923fe2 383 #elif (USBD_HID_EP_INTIN == 10)
Pawel Zarembski 0:01f31e923fe2 384 #define USBD_EndPoint10 USBD_HID_EP_INT_Event
Pawel Zarembski 0:01f31e923fe2 385 #elif (USBD_HID_EP_INTIN == 11)
Pawel Zarembski 0:01f31e923fe2 386 #define USBD_EndPoint11 USBD_HID_EP_INT_Event
Pawel Zarembski 0:01f31e923fe2 387 #elif (USBD_HID_EP_INTIN == 12)
Pawel Zarembski 0:01f31e923fe2 388 #define USBD_EndPoint12 USBD_HID_EP_INT_Event
Pawel Zarembski 0:01f31e923fe2 389 #elif (USBD_HID_EP_INTIN == 13)
Pawel Zarembski 0:01f31e923fe2 390 #define USBD_EndPoint13 USBD_HID_EP_INT_Event
Pawel Zarembski 0:01f31e923fe2 391 #elif (USBD_HID_EP_INTIN == 14)
Pawel Zarembski 0:01f31e923fe2 392 #define USBD_EndPoint14 USBD_HID_EP_INT_Event
Pawel Zarembski 0:01f31e923fe2 393 #elif (USBD_HID_EP_INTIN == 15)
Pawel Zarembski 0:01f31e923fe2 394 #define USBD_EndPoint15 USBD_HID_EP_INT_Event
Pawel Zarembski 0:01f31e923fe2 395 #endif
Pawel Zarembski 0:01f31e923fe2 396
Pawel Zarembski 0:01f31e923fe2 397 #endif /* (USBD_HID_EP_INTIN != USBD_HID_EP_INTOUT) */
Pawel Zarembski 0:01f31e923fe2 398
Pawel Zarembski 0:01f31e923fe2 399 #endif /*#ifdef __RTX*/
Pawel Zarembski 0:01f31e923fe2 400 #else
Pawel Zarembski 0:01f31e923fe2 401 BOOL USBD_ReqGetDescriptor_HID(U8 **pD, U32 *len)
Pawel Zarembski 0:01f31e923fe2 402 {
Pawel Zarembski 0:01f31e923fe2 403 return (__FALSE);
Pawel Zarembski 0:01f31e923fe2 404 }
Pawel Zarembski 0:01f31e923fe2 405 BOOL USBD_EndPoint0_Setup_HID_ReqToIF(void)
Pawel Zarembski 0:01f31e923fe2 406 {
Pawel Zarembski 0:01f31e923fe2 407 return (__FALSE);
Pawel Zarembski 0:01f31e923fe2 408 }
Pawel Zarembski 0:01f31e923fe2 409 BOOL USBD_EndPoint0_Out_HID_ReqToIF(void)
Pawel Zarembski 0:01f31e923fe2 410 {
Pawel Zarembski 0:01f31e923fe2 411 return (__FALSE);
Pawel Zarembski 0:01f31e923fe2 412 }
Pawel Zarembski 0:01f31e923fe2 413 #endif /* (USBD_HID_ENABLE) */
Pawel Zarembski 0:01f31e923fe2 414
Pawel Zarembski 0:01f31e923fe2 415 #if (USBD_MSC_ENABLE)
Pawel Zarembski 0:01f31e923fe2 416 #ifdef __RTX
Pawel Zarembski 0:01f31e923fe2 417 #if (USBD_MSC_EP_BULKIN != USBD_MSC_EP_BULKOUT)
Pawel Zarembski 0:01f31e923fe2 418 #if (USBD_MSC_EP_BULKIN == 1)
Pawel Zarembski 0:01f31e923fe2 419 #define USBD_RTX_EndPoint1 USBD_RTX_MSC_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 420 #elif (USBD_MSC_EP_BULKIN == 2)
Pawel Zarembski 0:01f31e923fe2 421 #define USBD_RTX_EndPoint2 USBD_RTX_MSC_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 422 #elif (USBD_MSC_EP_BULKIN == 3)
Pawel Zarembski 0:01f31e923fe2 423 #define USBD_RTX_EndPoint3 USBD_RTX_MSC_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 424 #elif (USBD_MSC_EP_BULKIN == 4)
Pawel Zarembski 0:01f31e923fe2 425 #define USBD_RTX_EndPoint4 USBD_RTX_MSC_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 426 #elif (USBD_MSC_EP_BULKIN == 5)
Pawel Zarembski 0:01f31e923fe2 427 #define USBD_RTX_EndPoint5 USBD_RTX_MSC_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 428 #elif (USBD_MSC_EP_BULKIN == 6)
Pawel Zarembski 0:01f31e923fe2 429 #define USBD_RTX_EndPoint6 USBD_RTX_MSC_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 430 #elif (USBD_MSC_EP_BULKIN == 7)
Pawel Zarembski 0:01f31e923fe2 431 #define USBD_RTX_EndPoint7 USBD_RTX_MSC_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 432 #elif (USBD_MSC_EP_BULKIN == 8)
Pawel Zarembski 0:01f31e923fe2 433 #define USBD_RTX_EndPoint8 USBD_RTX_MSC_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 434 #elif (USBD_MSC_EP_BULKIN == 9)
Pawel Zarembski 0:01f31e923fe2 435 #define USBD_RTX_EndPoint9 USBD_RTX_MSC_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 436 #elif (USBD_MSC_EP_BULKIN == 10)
Pawel Zarembski 0:01f31e923fe2 437 #define USBD_RTX_EndPoint10 USBD_RTX_MSC_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 438 #elif (USBD_MSC_EP_BULKIN == 11)
Pawel Zarembski 0:01f31e923fe2 439 #define USBD_RTX_EndPoint11 USBD_RTX_MSC_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 440 #elif (USBD_MSC_EP_BULKIN == 12)
Pawel Zarembski 0:01f31e923fe2 441 #define USBD_RTX_EndPoint12 USBD_RTX_MSC_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 442 #elif (USBD_MSC_EP_BULKIN == 13)
Pawel Zarembski 0:01f31e923fe2 443 #define USBD_RTX_EndPoint13 USBD_RTX_MSC_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 444 #elif (USBD_MSC_EP_BULKIN == 14)
Pawel Zarembski 0:01f31e923fe2 445 #define USBD_RTX_EndPoint14 USBD_RTX_MSC_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 446 #elif (USBD_MSC_EP_BULKIN == 15)
Pawel Zarembski 0:01f31e923fe2 447 #define USBD_RTX_EndPoint15 USBD_RTX_MSC_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 448 #endif
Pawel Zarembski 0:01f31e923fe2 449
Pawel Zarembski 0:01f31e923fe2 450 #if (USBD_MSC_EP_BULKOUT == 1)
Pawel Zarembski 0:01f31e923fe2 451 #define USBD_RTX_EndPoint1 USBD_RTX_MSC_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 452 #elif (USBD_MSC_EP_BULKOUT == 2)
Pawel Zarembski 0:01f31e923fe2 453 #define USBD_RTX_EndPoint2 USBD_RTX_MSC_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 454 #elif (USBD_MSC_EP_BULKOUT == 3)
Pawel Zarembski 0:01f31e923fe2 455 #define USBD_RTX_EndPoint3 USBD_RTX_MSC_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 456 #elif (USBD_MSC_EP_BULKOUT == 4)
Pawel Zarembski 0:01f31e923fe2 457 #define USBD_RTX_EndPoint4 USBD_RTX_MSC_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 458 #elif (USBD_MSC_EP_BULKOUT == 5)
Pawel Zarembski 0:01f31e923fe2 459 #define USBD_RTX_EndPoint5 USBD_RTX_MSC_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 460 #elif (USBD_MSC_EP_BULKOUT == 6)
Pawel Zarembski 0:01f31e923fe2 461 #define USBD_RTX_EndPoint6 USBD_RTX_MSC_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 462 #elif (USBD_MSC_EP_BULKOUT == 7)
Pawel Zarembski 0:01f31e923fe2 463 #define USBD_RTX_EndPoint7 USBD_RTX_MSC_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 464 #elif (USBD_MSC_EP_BULKOUT == 8)
Pawel Zarembski 0:01f31e923fe2 465 #define USBD_RTX_EndPoint8 USBD_RTX_MSC_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 466 #elif (USBD_MSC_EP_BULKOUT == 9)
Pawel Zarembski 0:01f31e923fe2 467 #define USBD_RTX_EndPoint9 USBD_RTX_MSC_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 468 #elif (USBD_MSC_EP_BULKOUT == 10)
Pawel Zarembski 0:01f31e923fe2 469 #define USBD_RTX_EndPoint10 USBD_RTX_MSC_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 470 #elif (USBD_MSC_EP_BULKOUT == 11)
Pawel Zarembski 0:01f31e923fe2 471 #define USBD_RTX_EndPoint11 USBD_RTX_MSC_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 472 #elif (USBD_MSC_EP_BULKOUT == 12)
Pawel Zarembski 0:01f31e923fe2 473 #define USBD_RTX_EndPoint12 USBD_RTX_MSC_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 474 #elif (USBD_MSC_EP_BULKOUT == 13)
Pawel Zarembski 0:01f31e923fe2 475 #define USBD_RTX_EndPoint13 USBD_RTX_MSC_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 476 #elif (USBD_MSC_EP_BULKOUT == 14)
Pawel Zarembski 0:01f31e923fe2 477 #define USBD_RTX_EndPoint14 USBD_RTX_MSC_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 478 #elif (USBD_MSC_EP_BULKOUT == 15)
Pawel Zarembski 0:01f31e923fe2 479 #define USBD_RTX_EndPoint15 USBD_RTX_MSC_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 480 #endif
Pawel Zarembski 0:01f31e923fe2 481 #else
Pawel Zarembski 0:01f31e923fe2 482 #if (USBD_MSC_EP_BULKIN == 1)
Pawel Zarembski 0:01f31e923fe2 483 #define USBD_RTX_EndPoint1 USBD_RTX_MSC_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 484 #elif (USBD_MSC_EP_BULKIN == 2)
Pawel Zarembski 0:01f31e923fe2 485 #define USBD_RTX_EndPoint2 USBD_RTX_MSC_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 486 #elif (USBD_MSC_EP_BULKIN == 3)
Pawel Zarembski 0:01f31e923fe2 487 #define USBD_RTX_EndPoint3 USBD_RTX_MSC_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 488 #elif (USBD_MSC_EP_BULKIN == 4)
Pawel Zarembski 0:01f31e923fe2 489 #define USBD_RTX_EndPoint4 USBD_RTX_MSC_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 490 #elif (USBD_MSC_EP_BULKIN == 5)
Pawel Zarembski 0:01f31e923fe2 491 #define USBD_RTX_EndPoint5 USBD_RTX_MSC_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 492 #elif (USBD_MSC_EP_BULKIN == 6)
Pawel Zarembski 0:01f31e923fe2 493 #define USBD_RTX_EndPoint6 USBD_RTX_MSC_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 494 #elif (USBD_MSC_EP_BULKIN == 7)
Pawel Zarembski 0:01f31e923fe2 495 #define USBD_RTX_EndPoint7 USBD_RTX_MSC_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 496 #elif (USBD_MSC_EP_BULKIN == 8)
Pawel Zarembski 0:01f31e923fe2 497 #define USBD_RTX_EndPoint8 USBD_RTX_MSC_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 498 #elif (USBD_MSC_EP_BULKIN == 9)
Pawel Zarembski 0:01f31e923fe2 499 #define USBD_RTX_EndPoint9 USBD_RTX_MSC_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 500 #elif (USBD_MSC_EP_BULKIN == 10)
Pawel Zarembski 0:01f31e923fe2 501 #define USBD_RTX_EndPoint10 USBD_RTX_MSC_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 502 #elif (USBD_MSC_EP_BULKIN == 11)
Pawel Zarembski 0:01f31e923fe2 503 #define USBD_RTX_EndPoint11 USBD_RTX_MSC_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 504 #elif (USBD_MSC_EP_BULKIN == 12)
Pawel Zarembski 0:01f31e923fe2 505 #define USBD_RTX_EndPoint12 USBD_RTX_MSC_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 506 #elif (USBD_MSC_EP_BULKIN == 13)
Pawel Zarembski 0:01f31e923fe2 507 #define USBD_RTX_EndPoint13 USBD_RTX_MSC_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 508 #elif (USBD_MSC_EP_BULKIN == 14)
Pawel Zarembski 0:01f31e923fe2 509 #define USBD_RTX_EndPoint14 USBD_RTX_MSC_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 510 #elif (USBD_MSC_EP_BULKIN == 15)
Pawel Zarembski 0:01f31e923fe2 511 #define USBD_RTX_EndPoint15 USBD_RTX_MSC_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 512 #endif
Pawel Zarembski 0:01f31e923fe2 513 #endif
Pawel Zarembski 0:01f31e923fe2 514 #else
Pawel Zarembski 0:01f31e923fe2 515 #if (USBD_MSC_EP_BULKIN != USBD_MSC_EP_BULKOUT)
Pawel Zarembski 0:01f31e923fe2 516 #if (USBD_MSC_EP_BULKIN == 1)
Pawel Zarembski 0:01f31e923fe2 517 #define USBD_EndPoint1 USBD_MSC_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 518 #elif (USBD_MSC_EP_BULKIN == 2)
Pawel Zarembski 0:01f31e923fe2 519 #define USBD_EndPoint2 USBD_MSC_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 520 #elif (USBD_MSC_EP_BULKIN == 3)
Pawel Zarembski 0:01f31e923fe2 521 #define USBD_EndPoint3 USBD_MSC_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 522 #elif (USBD_MSC_EP_BULKIN == 4)
Pawel Zarembski 0:01f31e923fe2 523 #define USBD_EndPoint4 USBD_MSC_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 524 #elif (USBD_MSC_EP_BULKIN == 5)
Pawel Zarembski 0:01f31e923fe2 525 #define USBD_EndPoint5 USBD_MSC_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 526 #elif (USBD_MSC_EP_BULKIN == 6)
Pawel Zarembski 0:01f31e923fe2 527 #define USBD_EndPoint6 USBD_MSC_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 528 #elif (USBD_MSC_EP_BULKIN == 7)
Pawel Zarembski 0:01f31e923fe2 529 #define USBD_EndPoint7 USBD_MSC_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 530 #elif (USBD_MSC_EP_BULKIN == 8)
Pawel Zarembski 0:01f31e923fe2 531 #define USBD_EndPoint8 USBD_MSC_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 532 #elif (USBD_MSC_EP_BULKIN == 9)
Pawel Zarembski 0:01f31e923fe2 533 #define USBD_EndPoint9 USBD_MSC_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 534 #elif (USBD_MSC_EP_BULKIN == 10)
Pawel Zarembski 0:01f31e923fe2 535 #define USBD_EndPoint10 USBD_MSC_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 536 #elif (USBD_MSC_EP_BULKIN == 11)
Pawel Zarembski 0:01f31e923fe2 537 #define USBD_EndPoint11 USBD_MSC_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 538 #elif (USBD_MSC_EP_BULKIN == 12)
Pawel Zarembski 0:01f31e923fe2 539 #define USBD_EndPoint12 USBD_MSC_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 540 #elif (USBD_MSC_EP_BULKIN == 13)
Pawel Zarembski 0:01f31e923fe2 541 #define USBD_EndPoint13 USBD_MSC_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 542 #elif (USBD_MSC_EP_BULKIN == 14)
Pawel Zarembski 0:01f31e923fe2 543 #define USBD_EndPoint14 USBD_MSC_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 544 #elif (USBD_MSC_EP_BULKIN == 15)
Pawel Zarembski 0:01f31e923fe2 545 #define USBD_EndPoint15 USBD_MSC_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 546 #endif
Pawel Zarembski 0:01f31e923fe2 547
Pawel Zarembski 0:01f31e923fe2 548 #if (USBD_MSC_EP_BULKOUT == 1)
Pawel Zarembski 0:01f31e923fe2 549 #define USBD_EndPoint1 USBD_MSC_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 550 #elif (USBD_MSC_EP_BULKOUT == 2)
Pawel Zarembski 0:01f31e923fe2 551 #define USBD_EndPoint2 USBD_MSC_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 552 #elif (USBD_MSC_EP_BULKOUT == 3)
Pawel Zarembski 0:01f31e923fe2 553 #define USBD_EndPoint3 USBD_MSC_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 554 #elif (USBD_MSC_EP_BULKOUT == 4)
Pawel Zarembski 0:01f31e923fe2 555 #define USBD_EndPoint4 USBD_MSC_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 556 #elif (USBD_MSC_EP_BULKOUT == 5)
Pawel Zarembski 0:01f31e923fe2 557 #define USBD_EndPoint5 USBD_MSC_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 558 #elif (USBD_MSC_EP_BULKOUT == 6)
Pawel Zarembski 0:01f31e923fe2 559 #define USBD_EndPoint6 USBD_MSC_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 560 #elif (USBD_MSC_EP_BULKOUT == 7)
Pawel Zarembski 0:01f31e923fe2 561 #define USBD_EndPoint7 USBD_MSC_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 562 #elif (USBD_MSC_EP_BULKOUT == 8)
Pawel Zarembski 0:01f31e923fe2 563 #define USBD_EndPoint8 USBD_MSC_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 564 #elif (USBD_MSC_EP_BULKOUT == 9)
Pawel Zarembski 0:01f31e923fe2 565 #define USBD_EndPoint9 USBD_MSC_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 566 #elif (USBD_MSC_EP_BULKOUT == 10)
Pawel Zarembski 0:01f31e923fe2 567 #define USBD_EndPoint10 USBD_MSC_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 568 #elif (USBD_MSC_EP_BULKOUT == 11)
Pawel Zarembski 0:01f31e923fe2 569 #define USBD_EndPoint11 USBD_MSC_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 570 #elif (USBD_MSC_EP_BULKOUT == 12)
Pawel Zarembski 0:01f31e923fe2 571 #define USBD_EndPoint12 USBD_MSC_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 572 #elif (USBD_MSC_EP_BULKOUT == 13)
Pawel Zarembski 0:01f31e923fe2 573 #define USBD_EndPoint13 USBD_MSC_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 574 #elif (USBD_MSC_EP_BULKOUT == 14)
Pawel Zarembski 0:01f31e923fe2 575 #define USBD_EndPoint14 USBD_MSC_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 576 #elif (USBD_MSC_EP_BULKOUT == 15)
Pawel Zarembski 0:01f31e923fe2 577 #define USBD_EndPoint15 USBD_MSC_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 578 #endif
Pawel Zarembski 0:01f31e923fe2 579 #else
Pawel Zarembski 0:01f31e923fe2 580 #if (USBD_MSC_EP_BULKIN == 1)
Pawel Zarembski 0:01f31e923fe2 581 #define USBD_EndPoint1 USBD_MSC_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 582 #elif (USBD_MSC_EP_BULKIN == 2)
Pawel Zarembski 0:01f31e923fe2 583 #define USBD_EndPoint2 USBD_MSC_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 584 #elif (USBD_MSC_EP_BULKIN == 3)
Pawel Zarembski 0:01f31e923fe2 585 #define USBD_EndPoint3 USBD_MSC_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 586 #elif (USBD_MSC_EP_BULKIN == 4)
Pawel Zarembski 0:01f31e923fe2 587 #define USBD_EndPoint4 USBD_MSC_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 588 #elif (USBD_MSC_EP_BULKIN == 5)
Pawel Zarembski 0:01f31e923fe2 589 #define USBD_EndPoint5 USBD_MSC_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 590 #elif (USBD_MSC_EP_BULKIN == 6)
Pawel Zarembski 0:01f31e923fe2 591 #define USBD_EndPoint6 USBD_MSC_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 592 #elif (USBD_MSC_EP_BULKIN == 7)
Pawel Zarembski 0:01f31e923fe2 593 #define USBD_EndPoint7 USBD_MSC_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 594 #elif (USBD_MSC_EP_BULKIN == 8)
Pawel Zarembski 0:01f31e923fe2 595 #define USBD_EndPoint8 USBD_MSC_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 596 #elif (USBD_MSC_EP_BULKIN == 9)
Pawel Zarembski 0:01f31e923fe2 597 #define USBD_EndPoint9 USBD_MSC_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 598 #elif (USBD_MSC_EP_BULKIN == 10)
Pawel Zarembski 0:01f31e923fe2 599 #define USBD_EndPoint10 USBD_MSC_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 600 #elif (USBD_MSC_EP_BULKIN == 11)
Pawel Zarembski 0:01f31e923fe2 601 #define USBD_EndPoint11 USBD_MSC_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 602 #elif (USBD_MSC_EP_BULKIN == 12)
Pawel Zarembski 0:01f31e923fe2 603 #define USBD_EndPoint12 USBD_MSC_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 604 #elif (USBD_MSC_EP_BULKIN == 13)
Pawel Zarembski 0:01f31e923fe2 605 #define USBD_EndPoint13 USBD_MSC_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 606 #elif (USBD_MSC_EP_BULKIN == 14)
Pawel Zarembski 0:01f31e923fe2 607 #define USBD_EndPoint14 USBD_MSC_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 608 #elif (USBD_MSC_EP_BULKIN == 15)
Pawel Zarembski 0:01f31e923fe2 609 #define USBD_EndPoint15 USBD_MSC_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 610 #endif
Pawel Zarembski 0:01f31e923fe2 611 #endif
Pawel Zarembski 0:01f31e923fe2 612 #endif
Pawel Zarembski 0:01f31e923fe2 613 #else
Pawel Zarembski 0:01f31e923fe2 614 void USBD_ReqClrFeature_MSC(U32 EPNum)
Pawel Zarembski 0:01f31e923fe2 615 {
Pawel Zarembski 0:01f31e923fe2 616
Pawel Zarembski 0:01f31e923fe2 617 }
Pawel Zarembski 0:01f31e923fe2 618 BOOL USBD_EndPoint0_Setup_MSC_ReqToIF(void)
Pawel Zarembski 0:01f31e923fe2 619 {
Pawel Zarembski 0:01f31e923fe2 620 return (__FALSE);
Pawel Zarembski 0:01f31e923fe2 621 }
Pawel Zarembski 0:01f31e923fe2 622 BOOL USBD_EndPoint0_Out_MSC_ReqToIF(void)
Pawel Zarembski 0:01f31e923fe2 623 {
Pawel Zarembski 0:01f31e923fe2 624 return (__FALSE);
Pawel Zarembski 0:01f31e923fe2 625 }
Pawel Zarembski 0:01f31e923fe2 626 #endif /* (USBD_MSC_ENABLE) */
Pawel Zarembski 0:01f31e923fe2 627
Pawel Zarembski 0:01f31e923fe2 628 #if (USBD_ADC_ENABLE == 0)
Pawel Zarembski 0:01f31e923fe2 629 BOOL USBD_EndPoint0_Setup_ADC_ReqToIF(void)
Pawel Zarembski 0:01f31e923fe2 630 {
Pawel Zarembski 0:01f31e923fe2 631 return (__FALSE);
Pawel Zarembski 0:01f31e923fe2 632 }
Pawel Zarembski 0:01f31e923fe2 633 BOOL USBD_EndPoint0_Setup_ADC_ReqToEP(void)
Pawel Zarembski 0:01f31e923fe2 634 {
Pawel Zarembski 0:01f31e923fe2 635 return (__FALSE);
Pawel Zarembski 0:01f31e923fe2 636 }
Pawel Zarembski 0:01f31e923fe2 637 BOOL USBD_EndPoint0_Out_ADC_ReqToIF(void)
Pawel Zarembski 0:01f31e923fe2 638 {
Pawel Zarembski 0:01f31e923fe2 639 return (__FALSE);
Pawel Zarembski 0:01f31e923fe2 640 }
Pawel Zarembski 0:01f31e923fe2 641 BOOL USBD_EndPoint0_Out_ADC_ReqToEP(void)
Pawel Zarembski 0:01f31e923fe2 642 {
Pawel Zarembski 0:01f31e923fe2 643 return (__FALSE);
Pawel Zarembski 0:01f31e923fe2 644 }
Pawel Zarembski 0:01f31e923fe2 645 #endif /* (USBD_ADC_ENABLE) */
Pawel Zarembski 0:01f31e923fe2 646
Pawel Zarembski 0:01f31e923fe2 647 #if (USBD_CDC_ACM_ENABLE)
Pawel Zarembski 0:01f31e923fe2 648 #ifdef __RTX
Pawel Zarembski 0:01f31e923fe2 649 #if (USBD_CDC_ACM_EP_INTIN == 1)
Pawel Zarembski 0:01f31e923fe2 650 #define USBD_RTX_EndPoint1 USBD_RTX_CDC_ACM_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 651 #elif (USBD_CDC_ACM_EP_INTIN == 2)
Pawel Zarembski 0:01f31e923fe2 652 #define USBD_RTX_EndPoint2 USBD_RTX_CDC_ACM_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 653 #elif (USBD_CDC_ACM_EP_INTIN == 3)
Pawel Zarembski 0:01f31e923fe2 654 #define USBD_RTX_EndPoint3 USBD_RTX_CDC_ACM_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 655 #elif (USBD_CDC_ACM_EP_INTIN == 4)
Pawel Zarembski 0:01f31e923fe2 656 #define USBD_RTX_EndPoint4 USBD_RTX_CDC_ACM_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 657 #elif (USBD_CDC_ACM_EP_INTIN == 5)
Pawel Zarembski 0:01f31e923fe2 658 #define USBD_RTX_EndPoint5 USBD_RTX_CDC_ACM_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 659 #elif (USBD_CDC_ACM_EP_INTIN == 6)
Pawel Zarembski 0:01f31e923fe2 660 #define USBD_RTX_EndPoint6 USBD_RTX_CDC_ACM_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 661 #elif (USBD_CDC_ACM_EP_INTIN == 7)
Pawel Zarembski 0:01f31e923fe2 662 #define USBD_RTX_EndPoint7 USBD_RTX_CDC_ACM_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 663 #elif (USBD_CDC_ACM_EP_INTIN == 8)
Pawel Zarembski 0:01f31e923fe2 664 #define USBD_RTX_EndPoint8 USBD_RTX_CDC_ACM_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 665 #elif (USBD_CDC_ACM_EP_INTIN == 9)
Pawel Zarembski 0:01f31e923fe2 666 #define USBD_RTX_EndPoint9 USBD_RTX_CDC_ACM_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 667 #elif (USBD_CDC_ACM_EP_INTIN == 10)
Pawel Zarembski 0:01f31e923fe2 668 #define USBD_RTX_EndPoint10 USBD_RTX_CDC_ACM_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 669 #elif (USBD_CDC_ACM_EP_INTIN == 11)
Pawel Zarembski 0:01f31e923fe2 670 #define USBD_RTX_EndPoint11 USBD_RTX_CDC_ACM_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 671 #elif (USBD_CDC_ACM_EP_INTIN == 12)
Pawel Zarembski 0:01f31e923fe2 672 #define USBD_RTX_EndPoint12 USBD_RTX_CDC_ACM_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 673 #elif (USBD_CDC_ACM_EP_INTIN == 13)
Pawel Zarembski 0:01f31e923fe2 674 #define USBD_RTX_EndPoint13 USBD_RTX_CDC_ACM_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 675 #elif (USBD_CDC_ACM_EP_INTIN == 14)
Pawel Zarembski 0:01f31e923fe2 676 #define USBD_RTX_EndPoint14 USBD_RTX_CDC_ACM_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 677 #elif (USBD_CDC_ACM_EP_INTIN == 15)
Pawel Zarembski 0:01f31e923fe2 678 #define USBD_RTX_EndPoint15 USBD_RTX_CDC_ACM_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 679 #endif
Pawel Zarembski 0:01f31e923fe2 680 #else
Pawel Zarembski 0:01f31e923fe2 681 #if (USBD_CDC_ACM_EP_INTIN == 1)
Pawel Zarembski 0:01f31e923fe2 682 #define USBD_EndPoint1 USBD_CDC_ACM_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 683 #elif (USBD_CDC_ACM_EP_INTIN == 2)
Pawel Zarembski 0:01f31e923fe2 684 #define USBD_EndPoint2 USBD_CDC_ACM_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 685 #elif (USBD_CDC_ACM_EP_INTIN == 3)
Pawel Zarembski 0:01f31e923fe2 686 #define USBD_EndPoint3 USBD_CDC_ACM_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 687 #elif (USBD_CDC_ACM_EP_INTIN == 4)
Pawel Zarembski 0:01f31e923fe2 688 #define USBD_EndPoint4 USBD_CDC_ACM_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 689 #elif (USBD_CDC_ACM_EP_INTIN == 5)
Pawel Zarembski 0:01f31e923fe2 690 #define USBD_EndPoint5 USBD_CDC_ACM_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 691 #elif (USBD_CDC_ACM_EP_INTIN == 6)
Pawel Zarembski 0:01f31e923fe2 692 #define USBD_EndPoint6 USBD_CDC_ACM_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 693 #elif (USBD_CDC_ACM_EP_INTIN == 7)
Pawel Zarembski 0:01f31e923fe2 694 #define USBD_EndPoint7 USBD_CDC_ACM_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 695 #elif (USBD_CDC_ACM_EP_INTIN == 8)
Pawel Zarembski 0:01f31e923fe2 696 #define USBD_EndPoint8 USBD_CDC_ACM_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 697 #elif (USBD_CDC_ACM_EP_INTIN == 9)
Pawel Zarembski 0:01f31e923fe2 698 #define USBD_EndPoint9 USBD_CDC_ACM_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 699 #elif (USBD_CDC_ACM_EP_INTIN == 10)
Pawel Zarembski 0:01f31e923fe2 700 #define USBD_EndPoint10 USBD_CDC_ACM_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 701 #elif (USBD_CDC_ACM_EP_INTIN == 11)
Pawel Zarembski 0:01f31e923fe2 702 #define USBD_EndPoint11 USBD_CDC_ACM_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 703 #elif (USBD_CDC_ACM_EP_INTIN == 12)
Pawel Zarembski 0:01f31e923fe2 704 #define USBD_EndPoint12 USBD_CDC_ACM_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 705 #elif (USBD_CDC_ACM_EP_INTIN == 13)
Pawel Zarembski 0:01f31e923fe2 706 #define USBD_EndPoint13 USBD_CDC_ACM_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 707 #elif (USBD_CDC_ACM_EP_INTIN == 14)
Pawel Zarembski 0:01f31e923fe2 708 #define USBD_EndPoint14 USBD_CDC_ACM_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 709 #elif (USBD_CDC_ACM_EP_INTIN == 15)
Pawel Zarembski 0:01f31e923fe2 710 #define USBD_EndPoint15 USBD_CDC_ACM_EP_INTIN_Event
Pawel Zarembski 0:01f31e923fe2 711 #endif
Pawel Zarembski 0:01f31e923fe2 712 #endif
Pawel Zarembski 0:01f31e923fe2 713
Pawel Zarembski 0:01f31e923fe2 714 #ifdef __RTX
Pawel Zarembski 0:01f31e923fe2 715 #if (USBD_CDC_ACM_EP_BULKIN != USBD_CDC_ACM_EP_BULKOUT)
Pawel Zarembski 0:01f31e923fe2 716 #if (USBD_CDC_ACM_EP_BULKIN == 1)
Pawel Zarembski 0:01f31e923fe2 717 #define USBD_RTX_EndPoint1 USBD_RTX_CDC_ACM_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 718 #elif (USBD_CDC_ACM_EP_BULKIN == 2)
Pawel Zarembski 0:01f31e923fe2 719 #define USBD_RTX_EndPoint2 USBD_RTX_CDC_ACM_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 720 #elif (USBD_CDC_ACM_EP_BULKIN == 3)
Pawel Zarembski 0:01f31e923fe2 721 #define USBD_RTX_EndPoint3 USBD_RTX_CDC_ACM_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 722 #elif (USBD_CDC_ACM_EP_BULKIN == 4)
Pawel Zarembski 0:01f31e923fe2 723 #define USBD_RTX_EndPoint4 USBD_RTX_CDC_ACM_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 724 #elif (USBD_CDC_ACM_EP_BULKIN == 5)
Pawel Zarembski 0:01f31e923fe2 725 #define USBD_RTX_EndPoint5 USBD_RTX_CDC_ACM_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 726 #elif (USBD_CDC_ACM_EP_BULKIN == 6)
Pawel Zarembski 0:01f31e923fe2 727 #define USBD_RTX_EndPoint6 USBD_RTX_CDC_ACM_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 728 #elif (USBD_CDC_ACM_EP_BULKIN == 7)
Pawel Zarembski 0:01f31e923fe2 729 #define USBD_RTX_EndPoint7 USBD_RTX_CDC_ACM_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 730 #elif (USBD_CDC_ACM_EP_BULKIN == 8)
Pawel Zarembski 0:01f31e923fe2 731 #define USBD_RTX_EndPoint8 USBD_RTX_CDC_ACM_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 732 #elif (USBD_CDC_ACM_EP_BULKIN == 9)
Pawel Zarembski 0:01f31e923fe2 733 #define USBD_RTX_EndPoint9 USBD_RTX_CDC_ACM_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 734 #elif (USBD_CDC_ACM_EP_BULKIN == 10)
Pawel Zarembski 0:01f31e923fe2 735 #define USBD_RTX_EndPoint10 USBD_RTX_CDC_ACM_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 736 #elif (USBD_CDC_ACM_EP_BULKIN == 11)
Pawel Zarembski 0:01f31e923fe2 737 #define USBD_RTX_EndPoint11 USBD_RTX_CDC_ACM_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 738 #elif (USBD_CDC_ACM_EP_BULKIN == 12)
Pawel Zarembski 0:01f31e923fe2 739 #define USBD_RTX_EndPoint12 USBD_RTX_CDC_ACM_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 740 #elif (USBD_CDC_ACM_EP_BULKIN == 13)
Pawel Zarembski 0:01f31e923fe2 741 #define USBD_RTX_EndPoint13 USBD_RTX_CDC_ACM_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 742 #elif (USBD_CDC_ACM_EP_BULKIN == 14)
Pawel Zarembski 0:01f31e923fe2 743 #define USBD_RTX_EndPoint14 USBD_RTX_CDC_ACM_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 744 #elif (USBD_CDC_ACM_EP_BULKIN == 15)
Pawel Zarembski 0:01f31e923fe2 745 #define USBD_RTX_EndPoint15 USBD_RTX_CDC_ACM_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 746 #endif
Pawel Zarembski 0:01f31e923fe2 747
Pawel Zarembski 0:01f31e923fe2 748 #if (USBD_CDC_ACM_EP_BULKOUT == 1)
Pawel Zarembski 0:01f31e923fe2 749 #define USBD_RTX_EndPoint1 USBD_RTX_CDC_ACM_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 750 #elif (USBD_CDC_ACM_EP_BULKOUT == 2)
Pawel Zarembski 0:01f31e923fe2 751 #define USBD_RTX_EndPoint2 USBD_RTX_CDC_ACM_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 752 #elif (USBD_CDC_ACM_EP_BULKOUT == 3)
Pawel Zarembski 0:01f31e923fe2 753 #define USBD_RTX_EndPoint3 USBD_RTX_CDC_ACM_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 754 #elif (USBD_CDC_ACM_EP_BULKOUT == 4)
Pawel Zarembski 0:01f31e923fe2 755 #define USBD_RTX_EndPoint4 USBD_RTX_CDC_ACM_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 756 #elif (USBD_CDC_ACM_EP_BULKOUT == 5)
Pawel Zarembski 0:01f31e923fe2 757 #define USBD_RTX_EndPoint5 USBD_RTX_CDC_ACM_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 758 #elif (USBD_CDC_ACM_EP_BULKOUT == 6)
Pawel Zarembski 0:01f31e923fe2 759 #define USBD_RTX_EndPoint6 USBD_RTX_CDC_ACM_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 760 #elif (USBD_CDC_ACM_EP_BULKOUT == 7)
Pawel Zarembski 0:01f31e923fe2 761 #define USBD_RTX_EndPoint7 USBD_RTX_CDC_ACM_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 762 #elif (USBD_CDC_ACM_EP_BULKOUT == 8)
Pawel Zarembski 0:01f31e923fe2 763 #define USBD_RTX_EndPoint8 USBD_RTX_CDC_ACM_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 764 #elif (USBD_CDC_ACM_EP_BULKOUT == 9)
Pawel Zarembski 0:01f31e923fe2 765 #define USBD_RTX_EndPoint9 USBD_RTX_CDC_ACM_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 766 #elif (USBD_CDC_ACM_EP_BULKOUT == 10)
Pawel Zarembski 0:01f31e923fe2 767 #define USBD_RTX_EndPoint10 USBD_RTX_CDC_ACM_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 768 #elif (USBD_CDC_ACM_EP_BULKOUT == 11)
Pawel Zarembski 0:01f31e923fe2 769 #define USBD_RTX_EndPoint11 USBD_RTX_CDC_ACM_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 770 #elif (USBD_CDC_ACM_EP_BULKOUT == 12)
Pawel Zarembski 0:01f31e923fe2 771 #define USBD_RTX_EndPoint12 USBD_RTX_CDC_ACM_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 772 #elif (USBD_CDC_ACM_EP_BULKOUT == 13)
Pawel Zarembski 0:01f31e923fe2 773 #define USBD_RTX_EndPoint13 USBD_RTX_CDC_ACM_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 774 #elif (USBD_CDC_ACM_EP_BULKOUT == 14)
Pawel Zarembski 0:01f31e923fe2 775 #define USBD_RTX_EndPoint14 USBD_RTX_CDC_ACM_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 776 #elif (USBD_CDC_ACM_EP_BULKOUT == 15)
Pawel Zarembski 0:01f31e923fe2 777 #define USBD_RTX_EndPoint15 USBD_RTX_CDC_ACM_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 778 #endif
Pawel Zarembski 0:01f31e923fe2 779 #else
Pawel Zarembski 0:01f31e923fe2 780 #if (USBD_CDC_ACM_EP_BULKIN == 1)
Pawel Zarembski 0:01f31e923fe2 781 #define USBD_RTX_EndPoint1 USBD_RTX_CDC_ACM_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 782 #elif (USBD_CDC_ACM_EP_BULKIN == 2)
Pawel Zarembski 0:01f31e923fe2 783 #define USBD_RTX_EndPoint2 USBD_RTX_CDC_ACM_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 784 #elif (USBD_CDC_ACM_EP_BULKIN == 3)
Pawel Zarembski 0:01f31e923fe2 785 #define USBD_RTX_EndPoint3 USBD_RTX_CDC_ACM_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 786 #elif (USBD_CDC_ACM_EP_BULKIN == 4)
Pawel Zarembski 0:01f31e923fe2 787 #define USBD_RTX_EndPoint4 USBD_RTX_CDC_ACM_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 788 #elif (USBD_CDC_ACM_EP_BULKIN == 5)
Pawel Zarembski 0:01f31e923fe2 789 #define USBD_RTX_EndPoint5 USBD_RTX_CDC_ACM_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 790 #elif (USBD_CDC_ACM_EP_BULKIN == 6)
Pawel Zarembski 0:01f31e923fe2 791 #define USBD_RTX_EndPoint6 USBD_RTX_CDC_ACM_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 792 #elif (USBD_CDC_ACM_EP_BULKIN == 7)
Pawel Zarembski 0:01f31e923fe2 793 #define USBD_RTX_EndPoint7 USBD_RTX_CDC_ACM_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 794 #elif (USBD_CDC_ACM_EP_BULKIN == 8)
Pawel Zarembski 0:01f31e923fe2 795 #define USBD_RTX_EndPoint8 USBD_RTX_CDC_ACM_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 796 #elif (USBD_CDC_ACM_EP_BULKIN == 9)
Pawel Zarembski 0:01f31e923fe2 797 #define USBD_RTX_EndPoint9 USBD_RTX_CDC_ACM_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 798 #elif (USBD_CDC_ACM_EP_BULKIN == 10)
Pawel Zarembski 0:01f31e923fe2 799 #define USBD_RTX_EndPoint10 USBD_RTX_CDC_ACM_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 800 #elif (USBD_CDC_ACM_EP_BULKIN == 11)
Pawel Zarembski 0:01f31e923fe2 801 #define USBD_RTX_EndPoint11 USBD_RTX_CDC_ACM_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 802 #elif (USBD_CDC_ACM_EP_BULKIN == 12)
Pawel Zarembski 0:01f31e923fe2 803 #define USBD_RTX_EndPoint12 USBD_RTX_CDC_ACM_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 804 #elif (USBD_CDC_ACM_EP_BULKIN == 13)
Pawel Zarembski 0:01f31e923fe2 805 #define USBD_RTX_EndPoint13 USBD_RTX_CDC_ACM_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 806 #elif (USBD_CDC_ACM_EP_BULKIN == 14)
Pawel Zarembski 0:01f31e923fe2 807 #define USBD_RTX_EndPoint14 USBD_RTX_CDC_ACM_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 808 #elif (USBD_CDC_ACM_EP_BULKIN == 15)
Pawel Zarembski 0:01f31e923fe2 809 #define USBD_RTX_EndPoint15 USBD_RTX_CDC_ACM_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 810 #endif
Pawel Zarembski 0:01f31e923fe2 811 #endif
Pawel Zarembski 0:01f31e923fe2 812 #else
Pawel Zarembski 0:01f31e923fe2 813 #if (USBD_CDC_ACM_EP_BULKIN != USBD_CDC_ACM_EP_BULKOUT)
Pawel Zarembski 0:01f31e923fe2 814 #if (USBD_CDC_ACM_EP_BULKIN == 1)
Pawel Zarembski 0:01f31e923fe2 815 #define USBD_EndPoint1 USBD_CDC_ACM_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 816 #elif (USBD_CDC_ACM_EP_BULKIN == 2)
Pawel Zarembski 0:01f31e923fe2 817 #define USBD_EndPoint2 USBD_CDC_ACM_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 818 #elif (USBD_CDC_ACM_EP_BULKIN == 3)
Pawel Zarembski 0:01f31e923fe2 819 #define USBD_EndPoint3 USBD_CDC_ACM_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 820 #elif (USBD_CDC_ACM_EP_BULKIN == 4)
Pawel Zarembski 0:01f31e923fe2 821 #define USBD_EndPoint4 USBD_CDC_ACM_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 822 #elif (USBD_CDC_ACM_EP_BULKIN == 5)
Pawel Zarembski 0:01f31e923fe2 823 #define USBD_EndPoint5 USBD_CDC_ACM_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 824 #elif (USBD_CDC_ACM_EP_BULKIN == 6)
Pawel Zarembski 0:01f31e923fe2 825 #define USBD_EndPoint6 USBD_CDC_ACM_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 826 #elif (USBD_CDC_ACM_EP_BULKIN == 7)
Pawel Zarembski 0:01f31e923fe2 827 #define USBD_EndPoint7 USBD_CDC_ACM_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 828 #elif (USBD_CDC_ACM_EP_BULKIN == 8)
Pawel Zarembski 0:01f31e923fe2 829 #define USBD_EndPoint8 USBD_CDC_ACM_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 830 #elif (USBD_CDC_ACM_EP_BULKIN == 9)
Pawel Zarembski 0:01f31e923fe2 831 #define USBD_EndPoint9 USBD_CDC_ACM_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 832 #elif (USBD_CDC_ACM_EP_BULKIN == 10)
Pawel Zarembski 0:01f31e923fe2 833 #define USBD_EndPoint10 USBD_CDC_ACM_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 834 #elif (USBD_CDC_ACM_EP_BULKIN == 11)
Pawel Zarembski 0:01f31e923fe2 835 #define USBD_EndPoint11 USBD_CDC_ACM_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 836 #elif (USBD_CDC_ACM_EP_BULKIN == 12)
Pawel Zarembski 0:01f31e923fe2 837 #define USBD_EndPoint12 USBD_CDC_ACM_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 838 #elif (USBD_CDC_ACM_EP_BULKIN == 13)
Pawel Zarembski 0:01f31e923fe2 839 #define USBD_EndPoint13 USBD_CDC_ACM_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 840 #elif (USBD_CDC_ACM_EP_BULKIN == 14)
Pawel Zarembski 0:01f31e923fe2 841 #define USBD_EndPoint14 USBD_CDC_ACM_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 842 #elif (USBD_CDC_ACM_EP_BULKIN == 15)
Pawel Zarembski 0:01f31e923fe2 843 #define USBD_EndPoint15 USBD_CDC_ACM_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 844 #endif
Pawel Zarembski 0:01f31e923fe2 845
Pawel Zarembski 0:01f31e923fe2 846 #if (USBD_CDC_ACM_EP_BULKOUT == 1)
Pawel Zarembski 0:01f31e923fe2 847 #define USBD_EndPoint1 USBD_CDC_ACM_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 848 #elif (USBD_CDC_ACM_EP_BULKOUT == 2)
Pawel Zarembski 0:01f31e923fe2 849 #define USBD_EndPoint2 USBD_CDC_ACM_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 850 #elif (USBD_CDC_ACM_EP_BULKOUT == 3)
Pawel Zarembski 0:01f31e923fe2 851 #define USBD_EndPoint3 USBD_CDC_ACM_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 852 #elif (USBD_CDC_ACM_EP_BULKOUT == 4)
Pawel Zarembski 0:01f31e923fe2 853 #define USBD_EndPoint4 USBD_CDC_ACM_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 854 #elif (USBD_CDC_ACM_EP_BULKOUT == 5)
Pawel Zarembski 0:01f31e923fe2 855 #define USBD_EndPoint5 USBD_CDC_ACM_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 856 #elif (USBD_CDC_ACM_EP_BULKOUT == 6)
Pawel Zarembski 0:01f31e923fe2 857 #define USBD_EndPoint6 USBD_CDC_ACM_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 858 #elif (USBD_CDC_ACM_EP_BULKOUT == 7)
Pawel Zarembski 0:01f31e923fe2 859 #define USBD_EndPoint7 USBD_CDC_ACM_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 860 #elif (USBD_CDC_ACM_EP_BULKOUT == 8)
Pawel Zarembski 0:01f31e923fe2 861 #define USBD_EndPoint8 USBD_CDC_ACM_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 862 #elif (USBD_CDC_ACM_EP_BULKOUT == 9)
Pawel Zarembski 0:01f31e923fe2 863 #define USBD_EndPoint9 USBD_CDC_ACM_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 864 #elif (USBD_CDC_ACM_EP_BULKOUT == 10)
Pawel Zarembski 0:01f31e923fe2 865 #define USBD_EndPoint10 USBD_CDC_ACM_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 866 #elif (USBD_CDC_ACM_EP_BULKOUT == 11)
Pawel Zarembski 0:01f31e923fe2 867 #define USBD_EndPoint11 USBD_CDC_ACM_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 868 #elif (USBD_CDC_ACM_EP_BULKOUT == 12)
Pawel Zarembski 0:01f31e923fe2 869 #define USBD_EndPoint12 USBD_CDC_ACM_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 870 #elif (USBD_CDC_ACM_EP_BULKOUT == 13)
Pawel Zarembski 0:01f31e923fe2 871 #define USBD_EndPoint13 USBD_CDC_ACM_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 872 #elif (USBD_CDC_ACM_EP_BULKOUT == 14)
Pawel Zarembski 0:01f31e923fe2 873 #define USBD_EndPoint14 USBD_CDC_ACM_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 874 #elif (USBD_CDC_ACM_EP_BULKOUT == 15)
Pawel Zarembski 0:01f31e923fe2 875 #define USBD_EndPoint15 USBD_CDC_ACM_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 876 #endif
Pawel Zarembski 0:01f31e923fe2 877 #else
Pawel Zarembski 0:01f31e923fe2 878 #if (USBD_CDC_ACM_EP_BULKIN == 1)
Pawel Zarembski 0:01f31e923fe2 879 #define USBD_EndPoint1 USBD_CDC_ACM_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 880 #elif (USBD_CDC_ACM_EP_BULKIN == 2)
Pawel Zarembski 0:01f31e923fe2 881 #define USBD_EndPoint2 USBD_CDC_ACM_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 882 #elif (USBD_CDC_ACM_EP_BULKIN == 3)
Pawel Zarembski 0:01f31e923fe2 883 #define USBD_EndPoint3 USBD_CDC_ACM_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 884 #elif (USBD_CDC_ACM_EP_BULKIN == 4)
Pawel Zarembski 0:01f31e923fe2 885 #define USBD_EndPoint4 USBD_CDC_ACM_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 886 #elif (USBD_CDC_ACM_EP_BULKIN == 5)
Pawel Zarembski 0:01f31e923fe2 887 #define USBD_EndPoint5 USBD_CDC_ACM_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 888 #elif (USBD_CDC_ACM_EP_BULKIN == 6)
Pawel Zarembski 0:01f31e923fe2 889 #define USBD_EndPoint6 USBD_CDC_ACM_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 890 #elif (USBD_CDC_ACM_EP_BULKIN == 7)
Pawel Zarembski 0:01f31e923fe2 891 #define USBD_EndPoint7 USBD_CDC_ACM_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 892 #elif (USBD_CDC_ACM_EP_BULKIN == 8)
Pawel Zarembski 0:01f31e923fe2 893 #define USBD_EndPoint8 USBD_CDC_ACM_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 894 #elif (USBD_CDC_ACM_EP_BULKIN == 9)
Pawel Zarembski 0:01f31e923fe2 895 #define USBD_EndPoint9 USBD_CDC_ACM_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 896 #elif (USBD_CDC_ACM_EP_BULKIN == 10)
Pawel Zarembski 0:01f31e923fe2 897 #define USBD_EndPoint10 USBD_CDC_ACM_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 898 #elif (USBD_CDC_ACM_EP_BULKIN == 11)
Pawel Zarembski 0:01f31e923fe2 899 #define USBD_EndPoint11 USBD_CDC_ACM_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 900 #elif (USBD_CDC_ACM_EP_BULKIN == 12)
Pawel Zarembski 0:01f31e923fe2 901 #define USBD_EndPoint12 USBD_CDC_ACM_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 902 #elif (USBD_CDC_ACM_EP_BULKIN == 13)
Pawel Zarembski 0:01f31e923fe2 903 #define USBD_EndPoint13 USBD_CDC_ACM_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 904 #elif (USBD_CDC_ACM_EP_BULKIN == 14)
Pawel Zarembski 0:01f31e923fe2 905 #define USBD_EndPoint14 USBD_CDC_ACM_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 906 #elif (USBD_CDC_ACM_EP_BULKIN == 15)
Pawel Zarembski 0:01f31e923fe2 907 #define USBD_EndPoint15 USBD_CDC_ACM_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 908 #endif
Pawel Zarembski 0:01f31e923fe2 909 #endif
Pawel Zarembski 0:01f31e923fe2 910 #endif
Pawel Zarembski 0:01f31e923fe2 911 #else
Pawel Zarembski 0:01f31e923fe2 912 BOOL USBD_EndPoint0_Setup_CDC_ReqToIF(void)
Pawel Zarembski 0:01f31e923fe2 913 {
Pawel Zarembski 0:01f31e923fe2 914 return (__FALSE);
Pawel Zarembski 0:01f31e923fe2 915 }
Pawel Zarembski 0:01f31e923fe2 916 BOOL USBD_EndPoint0_Out_CDC_ReqToIF(void)
Pawel Zarembski 0:01f31e923fe2 917 {
Pawel Zarembski 0:01f31e923fe2 918 return (__FALSE);
Pawel Zarembski 0:01f31e923fe2 919 }
Pawel Zarembski 0:01f31e923fe2 920 #endif /* (USBD_CDC_ACM_ENABLE) */
Pawel Zarembski 0:01f31e923fe2 921
Pawel Zarembski 0:01f31e923fe2 922 #if (USBD_BULK_ENABLE)
Pawel Zarembski 0:01f31e923fe2 923
Pawel Zarembski 0:01f31e923fe2 924 #if (USBD_BULK_EP_BULKIN != USBD_BULK_EP_BULKOUT)
Pawel Zarembski 0:01f31e923fe2 925
Pawel Zarembski 0:01f31e923fe2 926 #if (USBD_BULK_EP_BULKIN == 1)
Pawel Zarembski 0:01f31e923fe2 927 #define USBD_EndPoint1 USBD_BULK_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 928 #elif (USBD_BULK_EP_BULKIN == 2)
Pawel Zarembski 0:01f31e923fe2 929 #define USBD_EndPoint2 USBD_BULK_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 930 #elif (USBD_BULK_EP_BULKIN == 3)
Pawel Zarembski 0:01f31e923fe2 931 #define USBD_EndPoint3 USBD_BULK_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 932 #elif (USBD_BULK_EP_BULKIN == 4)
Pawel Zarembski 0:01f31e923fe2 933 #define USBD_EndPoint4 USBD_BULK_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 934 #elif (USBD_BULK_EP_BULKIN == 5)
Pawel Zarembski 0:01f31e923fe2 935 #define USBD_EndPoint5 USBD_BULK_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 936 #elif (USBD_BULK_EP_BULKIN == 6)
Pawel Zarembski 0:01f31e923fe2 937 #define USBD_EndPoint6 USBD_BULK_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 938 #elif (USBD_BULK_EP_BULKIN == 7)
Pawel Zarembski 0:01f31e923fe2 939 #define USBD_EndPoint7 USBD_BULK_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 940 #elif (USBD_BULK_EP_BULKIN == 8)
Pawel Zarembski 0:01f31e923fe2 941 #define USBD_EndPoint8 USBD_BULK_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 942 #elif (USBD_BULK_EP_BULKIN == 9)
Pawel Zarembski 0:01f31e923fe2 943 #define USBD_EndPoint9 USBD_BULK_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 944 #elif (USBD_BULK_EP_BULKIN == 10)
Pawel Zarembski 0:01f31e923fe2 945 #define USBD_EndPoint10 USBD_BULK_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 946 #elif (USBD_BULK_EP_BULKIN == 11)
Pawel Zarembski 0:01f31e923fe2 947 #define USBD_EndPoint11 USBD_BULK_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 948 #elif (USBD_BULK_EP_BULKIN == 12)
Pawel Zarembski 0:01f31e923fe2 949 #define USBD_EndPoint12 USBD_BULK_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 950 #elif (USBD_BULK_EP_BULKIN == 13)
Pawel Zarembski 0:01f31e923fe2 951 #define USBD_EndPoint13 USBD_BULK_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 952 #elif (USBD_BULK_EP_BULKIN == 14)
Pawel Zarembski 0:01f31e923fe2 953 #define USBD_EndPoint14 USBD_BULK_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 954 #elif (USBD_BULK_EP_BULKIN == 15)
Pawel Zarembski 0:01f31e923fe2 955 #define USBD_EndPoint15 USBD_BULK_EP_BULKIN_Event
Pawel Zarembski 0:01f31e923fe2 956 #endif
Pawel Zarembski 0:01f31e923fe2 957
Pawel Zarembski 0:01f31e923fe2 958 #if (USBD_BULK_EP_BULKOUT == 1)
Pawel Zarembski 0:01f31e923fe2 959 #define USBD_EndPoint1 USBD_BULK_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 960 #elif (USBD_BULK_EP_BULKOUT == 2)
Pawel Zarembski 0:01f31e923fe2 961 #define USBD_EndPoint2 USBD_BULK_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 962 #elif (USBD_BULK_EP_BULKOUT == 3)
Pawel Zarembski 0:01f31e923fe2 963 #define USBD_EndPoint3 USBD_BULK_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 964 #elif (USBD_BULK_EP_BULKOUT == 4)
Pawel Zarembski 0:01f31e923fe2 965 #define USBD_EndPoint4 USBD_BULK_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 966 #elif (USBD_BULK_EP_BULKOUT == 5)
Pawel Zarembski 0:01f31e923fe2 967 #define USBD_EndPoint5 USBD_BULK_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 968 #elif (USBD_BULK_EP_BULKOUT == 6)
Pawel Zarembski 0:01f31e923fe2 969 #define USBD_EndPoint6 USBD_BULK_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 970 #elif (USBD_BULK_EP_BULKOUT == 7)
Pawel Zarembski 0:01f31e923fe2 971 #define USBD_EndPoint7 USBD_BULK_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 972 #elif (USBD_BULK_EP_BULKOUT == 8)
Pawel Zarembski 0:01f31e923fe2 973 #define USBD_EndPoint8 USBD_BULK_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 974 #elif (USBD_BULK_EP_BULKOUT == 9)
Pawel Zarembski 0:01f31e923fe2 975 #define USBD_EndPoint9 USBD_BULK_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 976 #elif (USBD_BULK_EP_BULKOUT == 10)
Pawel Zarembski 0:01f31e923fe2 977 #define USBD_EndPoint10 USBD_BULK_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 978 #elif (USBD_BULK_EP_BULKOUT == 11)
Pawel Zarembski 0:01f31e923fe2 979 #define USBD_EndPoint11 USBD_BULK_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 980 #elif (USBD_BULK_EP_BULKOUT == 12)
Pawel Zarembski 0:01f31e923fe2 981 #define USBD_EndPoint12 USBD_BULK_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 982 #elif (USBD_BULK_EP_BULKOUT == 13)
Pawel Zarembski 0:01f31e923fe2 983 #define USBD_EndPoint13 USBD_BULK_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 984 #elif (USBD_BULK_EP_BULKOUT == 14)
Pawel Zarembski 0:01f31e923fe2 985 #define USBD_EndPoint14 USBD_BULK_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 986 #elif (USBD_BULK_EP_BULKOUT == 15)
Pawel Zarembski 0:01f31e923fe2 987 #define USBD_EndPoint15 USBD_BULK_EP_BULKOUT_Event
Pawel Zarembski 0:01f31e923fe2 988 #endif
Pawel Zarembski 0:01f31e923fe2 989
Pawel Zarembski 0:01f31e923fe2 990 #else
Pawel Zarembski 0:01f31e923fe2 991 #if (USBD_BULK_EP_BULKIN == 1)
Pawel Zarembski 0:01f31e923fe2 992 #define USBD_EndPoint1 USBD_BULK_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 993 #elif (USBD_BULK_EP_BULKIN == 2)
Pawel Zarembski 0:01f31e923fe2 994 #define USBD_EndPoint2 USBD_BULK_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 995 #elif (USBD_BULK_EP_BULKIN == 3)
Pawel Zarembski 0:01f31e923fe2 996 #define USBD_EndPoint3 USBD_BULK_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 997 #elif (USBD_BULK_EP_BULKIN == 4)
Pawel Zarembski 0:01f31e923fe2 998 #define USBD_EndPoint4 USBD_BULK_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 999 #elif (USBD_BULK_EP_BULKIN == 5)
Pawel Zarembski 0:01f31e923fe2 1000 #define USBD_EndPoint5 USBD_BULK_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 1001 #elif (USBD_BULK_EP_BULKIN == 6)
Pawel Zarembski 0:01f31e923fe2 1002 #define USBD_EndPoint6 USBD_BULK_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 1003 #elif (USBD_BULK_EP_BULKIN == 7)
Pawel Zarembski 0:01f31e923fe2 1004 #define USBD_EndPoint7 USBD_BULK_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 1005 #elif (USBD_BULK_EP_BULKIN == 8)
Pawel Zarembski 0:01f31e923fe2 1006 #define USBD_EndPoint8 USBD_BULK_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 1007 #elif (USBD_BULK_EP_BULKIN == 9)
Pawel Zarembski 0:01f31e923fe2 1008 #define USBD_EndPoint9 USBD_BULK_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 1009 #elif (USBD_BULK_EP_BULKIN == 10)
Pawel Zarembski 0:01f31e923fe2 1010 #define USBD_EndPoint10 USBD_BULK_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 1011 #elif (USBD_BULK_EP_BULKIN == 11)
Pawel Zarembski 0:01f31e923fe2 1012 #define USBD_EndPoint11 USBD_BULK_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 1013 #elif (USBD_BULK_EP_BULKIN == 12)
Pawel Zarembski 0:01f31e923fe2 1014 #define USBD_EndPoint12 USBD_BULK_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 1015 #elif (USBD_BULK_EP_BULKIN == 13)
Pawel Zarembski 0:01f31e923fe2 1016 #define USBD_EndPoint13 USBD_BULK_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 1017 #elif (USBD_BULK_EP_BULKIN == 14)
Pawel Zarembski 0:01f31e923fe2 1018 #define USBD_EndPoint14 USBD_BULK_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 1019 #elif (USBD_BULK_EP_BULKIN == 15)
Pawel Zarembski 0:01f31e923fe2 1020 #define USBD_EndPoint15 USBD_BULK_EP_BULK_Event
Pawel Zarembski 0:01f31e923fe2 1021 #endif
Pawel Zarembski 0:01f31e923fe2 1022 #endif
Pawel Zarembski 0:01f31e923fe2 1023
Pawel Zarembski 0:01f31e923fe2 1024 #endif /* (USBD_BULK_ENABLE) */
Pawel Zarembski 0:01f31e923fe2 1025
Pawel Zarembski 0:01f31e923fe2 1026 #if (USBD_CLS_ENABLE)
Pawel Zarembski 0:01f31e923fe2 1027 #else
Pawel Zarembski 0:01f31e923fe2 1028 BOOL USBD_EndPoint0_Setup_CLS_ReqToDEV(void)
Pawel Zarembski 0:01f31e923fe2 1029 {
Pawel Zarembski 0:01f31e923fe2 1030 return (__FALSE);
Pawel Zarembski 0:01f31e923fe2 1031 }
Pawel Zarembski 0:01f31e923fe2 1032 BOOL USBD_EndPoint0_Setup_CLS_ReqToIF(void)
Pawel Zarembski 0:01f31e923fe2 1033 {
Pawel Zarembski 0:01f31e923fe2 1034 return (__FALSE);
Pawel Zarembski 0:01f31e923fe2 1035 }
Pawel Zarembski 0:01f31e923fe2 1036 BOOL USBD_EndPoint0_Setup_CLS_ReqToEP(void)
Pawel Zarembski 0:01f31e923fe2 1037 {
Pawel Zarembski 0:01f31e923fe2 1038 return (__FALSE);
Pawel Zarembski 0:01f31e923fe2 1039 }
Pawel Zarembski 0:01f31e923fe2 1040 BOOL USBD_EndPoint0_Out_CLS_ReqToDEV(void)
Pawel Zarembski 0:01f31e923fe2 1041 {
Pawel Zarembski 0:01f31e923fe2 1042 return (__FALSE);
Pawel Zarembski 0:01f31e923fe2 1043 }
Pawel Zarembski 0:01f31e923fe2 1044 BOOL USBD_EndPoint0_Out_CLS_ReqToIF(void)
Pawel Zarembski 0:01f31e923fe2 1045 {
Pawel Zarembski 0:01f31e923fe2 1046 return (__FALSE);
Pawel Zarembski 0:01f31e923fe2 1047 }
Pawel Zarembski 0:01f31e923fe2 1048 BOOL USBD_EndPoint0_Out_CLS_ReqToEP(void)
Pawel Zarembski 0:01f31e923fe2 1049 {
Pawel Zarembski 0:01f31e923fe2 1050 return (__FALSE);
Pawel Zarembski 0:01f31e923fe2 1051 }
Pawel Zarembski 0:01f31e923fe2 1052 #endif /* (USBD_CLS_ENABLE) */
Pawel Zarembski 0:01f31e923fe2 1053
Pawel Zarembski 0:01f31e923fe2 1054 #if ((USBD_CDC_ACM_ENABLE))
Pawel Zarembski 0:01f31e923fe2 1055 #ifndef __RTX
Pawel Zarembski 0:01f31e923fe2 1056 void USBD_Reset_Event(void)
Pawel Zarembski 0:01f31e923fe2 1057 {
Pawel Zarembski 0:01f31e923fe2 1058 #if (USBD_CDC_ACM_ENABLE)
Pawel Zarembski 0:01f31e923fe2 1059 USBD_CDC_ACM_Reset_Event();
Pawel Zarembski 0:01f31e923fe2 1060 #endif
Pawel Zarembski 0:01f31e923fe2 1061 #if (USBD_MSC_ENABLE)
Pawel Zarembski 0:01f31e923fe2 1062 USBD_MSC_Reset_Event();
Pawel Zarembski 0:01f31e923fe2 1063 #endif
Pawel Zarembski 0:01f31e923fe2 1064 }
Pawel Zarembski 0:01f31e923fe2 1065 #endif
Pawel Zarembski 0:01f31e923fe2 1066 #endif /* ((USBD_CDC_ACM_ENABLE)) */
Pawel Zarembski 0:01f31e923fe2 1067
Pawel Zarembski 0:01f31e923fe2 1068 #if ((USBD_HID_ENABLE) || (USBD_ADC_ENABLE) || (USBD_CDC_ACM_ENABLE) || (USBD_CLS_ENABLE))
Pawel Zarembski 0:01f31e923fe2 1069 #ifndef __RTX
Pawel Zarembski 0:01f31e923fe2 1070 void USBD_SOF_Event(void)
Pawel Zarembski 0:01f31e923fe2 1071 {
Pawel Zarembski 0:01f31e923fe2 1072 #if (USBD_HID_ENABLE)
Pawel Zarembski 0:01f31e923fe2 1073 USBD_HID_SOF_Event();
Pawel Zarembski 0:01f31e923fe2 1074 #endif
Pawel Zarembski 0:01f31e923fe2 1075 #if (USBD_ADC_ENABLE)
Pawel Zarembski 0:01f31e923fe2 1076 USBD_ADC_SOF_Event();
Pawel Zarembski 0:01f31e923fe2 1077 #endif
Pawel Zarembski 0:01f31e923fe2 1078 #if (USBD_CDC_ACM_ENABLE)
Pawel Zarembski 0:01f31e923fe2 1079 USBD_CDC_ACM_SOF_Event();
Pawel Zarembski 0:01f31e923fe2 1080 #endif
Pawel Zarembski 0:01f31e923fe2 1081 #if (USBD_CLS_ENABLE)
Pawel Zarembski 0:01f31e923fe2 1082 USBD_CLS_SOF_Event();
Pawel Zarembski 0:01f31e923fe2 1083 #endif
Pawel Zarembski 0:01f31e923fe2 1084 }
Pawel Zarembski 0:01f31e923fe2 1085 #endif
Pawel Zarembski 0:01f31e923fe2 1086 #endif /* ((USBD_HID_ENABLE) || (USBD_ADC_ENABLE) || (USBD_CDC_ACM_ENABLE) || (USBD_CLS_ENABLE)) */
Pawel Zarembski 0:01f31e923fe2 1087
Pawel Zarembski 0:01f31e923fe2 1088 /* USB Device - Device Events Callback Functions */
Pawel Zarembski 0:01f31e923fe2 1089 __weak void USBD_Power_Event(BOOL power);
Pawel Zarembski 0:01f31e923fe2 1090 __weak void USBD_Reset_Event(void);
Pawel Zarembski 0:01f31e923fe2 1091 __weak void USBD_Suspend_Event(void);
Pawel Zarembski 0:01f31e923fe2 1092 __weak void USBD_Resume_Event(void);
Pawel Zarembski 0:01f31e923fe2 1093 __weak void USBD_WakeUp_Event(void);
Pawel Zarembski 0:01f31e923fe2 1094 __weak void USBD_SOF_Event(void);
Pawel Zarembski 0:01f31e923fe2 1095 __weak void USBD_Error_Event(U32 error);
Pawel Zarembski 0:01f31e923fe2 1096
Pawel Zarembski 0:01f31e923fe2 1097 /* USB Device - Device Events Callback Pointers */
Pawel Zarembski 0:01f31e923fe2 1098 void (* const USBD_P_Power_Event)(BOOL power) = USBD_Power_Event;
Pawel Zarembski 0:01f31e923fe2 1099 void (* const USBD_P_Reset_Event)(void) = USBD_Reset_Event;
Pawel Zarembski 0:01f31e923fe2 1100 void (* const USBD_P_Suspend_Event)(void) = USBD_Suspend_Event;
Pawel Zarembski 0:01f31e923fe2 1101 void (* const USBD_P_Resume_Event)(void) = USBD_Resume_Event;
Pawel Zarembski 0:01f31e923fe2 1102 void (* const USBD_P_WakeUp_Event)(void) = USBD_WakeUp_Event;
Pawel Zarembski 0:01f31e923fe2 1103 void (* const USBD_P_SOF_Event)(void) = USBD_SOF_Event;
Pawel Zarembski 0:01f31e923fe2 1104 void (* const USBD_P_Error_Event)(U32 error) = USBD_Error_Event;
Pawel Zarembski 0:01f31e923fe2 1105
Pawel Zarembski 0:01f31e923fe2 1106 /* USB Device - Endpoint Events Callback Functions */
Pawel Zarembski 0:01f31e923fe2 1107 extern void USBD_EndPoint0(U32 event);
Pawel Zarembski 0:01f31e923fe2 1108 #ifndef USBD_EndPoint1
Pawel Zarembski 0:01f31e923fe2 1109 __weak void USBD_EndPoint1(U32 event);
Pawel Zarembski 0:01f31e923fe2 1110 #endif
Pawel Zarembski 0:01f31e923fe2 1111 #ifndef USBD_EndPoint2
Pawel Zarembski 0:01f31e923fe2 1112 __weak void USBD_EndPoint2(U32 event);
Pawel Zarembski 0:01f31e923fe2 1113 #endif
Pawel Zarembski 0:01f31e923fe2 1114 #ifndef USBD_EndPoint3
Pawel Zarembski 0:01f31e923fe2 1115 __weak void USBD_EndPoint3(U32 event);
Pawel Zarembski 0:01f31e923fe2 1116 #endif
Pawel Zarembski 0:01f31e923fe2 1117 #ifndef USBD_EndPoint4
Pawel Zarembski 0:01f31e923fe2 1118 __weak void USBD_EndPoint4(U32 event);
Pawel Zarembski 0:01f31e923fe2 1119 #endif
Pawel Zarembski 0:01f31e923fe2 1120 #ifndef USBD_EndPoint5
Pawel Zarembski 0:01f31e923fe2 1121 __weak void USBD_EndPoint5(U32 event);
Pawel Zarembski 0:01f31e923fe2 1122 #endif
Pawel Zarembski 0:01f31e923fe2 1123 #ifndef USBD_EndPoint6
Pawel Zarembski 0:01f31e923fe2 1124 __weak void USBD_EndPoint6(U32 event);
Pawel Zarembski 0:01f31e923fe2 1125 #endif
Pawel Zarembski 0:01f31e923fe2 1126 #ifndef USBD_EndPoint7
Pawel Zarembski 0:01f31e923fe2 1127 __weak void USBD_EndPoint7(U32 event);
Pawel Zarembski 0:01f31e923fe2 1128 #endif
Pawel Zarembski 0:01f31e923fe2 1129 #ifndef USBD_EndPoint8
Pawel Zarembski 0:01f31e923fe2 1130 __weak void USBD_EndPoint8(U32 event);
Pawel Zarembski 0:01f31e923fe2 1131 #endif
Pawel Zarembski 0:01f31e923fe2 1132 #ifndef USBD_EndPoint9
Pawel Zarembski 0:01f31e923fe2 1133 __weak void USBD_EndPoint9(U32 event);
Pawel Zarembski 0:01f31e923fe2 1134 #endif
Pawel Zarembski 0:01f31e923fe2 1135 #ifndef USBD_EndPoint10
Pawel Zarembski 0:01f31e923fe2 1136 __weak void USBD_EndPoint10(U32 event);
Pawel Zarembski 0:01f31e923fe2 1137 #endif
Pawel Zarembski 0:01f31e923fe2 1138 #ifndef USBD_EndPoint11
Pawel Zarembski 0:01f31e923fe2 1139 __weak void USBD_EndPoint11(U32 event);
Pawel Zarembski 0:01f31e923fe2 1140 #endif
Pawel Zarembski 0:01f31e923fe2 1141 #ifndef USBD_EndPoint12
Pawel Zarembski 0:01f31e923fe2 1142 __weak void USBD_EndPoint12(U32 event);
Pawel Zarembski 0:01f31e923fe2 1143 #endif
Pawel Zarembski 0:01f31e923fe2 1144 #ifndef USBD_EndPoint13
Pawel Zarembski 0:01f31e923fe2 1145 __weak void USBD_EndPoint13(U32 event);
Pawel Zarembski 0:01f31e923fe2 1146 #endif
Pawel Zarembski 0:01f31e923fe2 1147 #ifndef USBD_EndPoint14
Pawel Zarembski 0:01f31e923fe2 1148 __weak void USBD_EndPoint14(U32 event);
Pawel Zarembski 0:01f31e923fe2 1149 #endif
Pawel Zarembski 0:01f31e923fe2 1150 #ifndef USBD_EndPoint15
Pawel Zarembski 0:01f31e923fe2 1151 __weak void USBD_EndPoint15(U32 event);
Pawel Zarembski 0:01f31e923fe2 1152 #endif
Pawel Zarembski 0:01f31e923fe2 1153
Pawel Zarembski 0:01f31e923fe2 1154 /* USB Device - Endpoint Events Callback Pointers */
Pawel Zarembski 0:01f31e923fe2 1155 void (* const USBD_P_EP[16])(U32 event) = {
Pawel Zarembski 0:01f31e923fe2 1156 USBD_EndPoint0,
Pawel Zarembski 0:01f31e923fe2 1157 USBD_EndPoint1,
Pawel Zarembski 0:01f31e923fe2 1158 USBD_EndPoint2,
Pawel Zarembski 0:01f31e923fe2 1159 USBD_EndPoint3,
Pawel Zarembski 0:01f31e923fe2 1160 USBD_EndPoint4,
Pawel Zarembski 0:01f31e923fe2 1161 USBD_EndPoint5,
Pawel Zarembski 0:01f31e923fe2 1162 USBD_EndPoint6,
Pawel Zarembski 0:01f31e923fe2 1163 USBD_EndPoint7,
Pawel Zarembski 0:01f31e923fe2 1164 USBD_EndPoint8,
Pawel Zarembski 0:01f31e923fe2 1165 USBD_EndPoint9,
Pawel Zarembski 0:01f31e923fe2 1166 USBD_EndPoint10,
Pawel Zarembski 0:01f31e923fe2 1167 USBD_EndPoint11,
Pawel Zarembski 0:01f31e923fe2 1168 USBD_EndPoint12,
Pawel Zarembski 0:01f31e923fe2 1169 USBD_EndPoint13,
Pawel Zarembski 0:01f31e923fe2 1170 USBD_EndPoint14,
Pawel Zarembski 0:01f31e923fe2 1171 USBD_EndPoint15
Pawel Zarembski 0:01f31e923fe2 1172 };
Pawel Zarembski 0:01f31e923fe2 1173
Pawel Zarembski 0:01f31e923fe2 1174 /* USB Device - Core Events Callback Functions */
Pawel Zarembski 0:01f31e923fe2 1175 __weak void USBD_Configure_Event(void);
Pawel Zarembski 0:01f31e923fe2 1176 __weak void USBD_Interface_Event(void);
Pawel Zarembski 0:01f31e923fe2 1177 __weak void USBD_Feature_Event(void);
Pawel Zarembski 0:01f31e923fe2 1178
Pawel Zarembski 0:01f31e923fe2 1179 /* USB Device - Core Events Callback Pointers */
Pawel Zarembski 0:01f31e923fe2 1180 void (* const USBD_P_Configure_Event)(void) = USBD_Configure_Event;
Pawel Zarembski 0:01f31e923fe2 1181 void (* const USBD_P_Interface_Event)(void) = USBD_Interface_Event;
Pawel Zarembski 0:01f31e923fe2 1182 void (* const USBD_P_Feature_Event)(void) = USBD_Feature_Event;
Pawel Zarembski 0:01f31e923fe2 1183
Pawel Zarembski 0:01f31e923fe2 1184 #ifdef __RTX
Pawel Zarembski 0:01f31e923fe2 1185 const BOOL __rtx = __TRUE;
Pawel Zarembski 0:01f31e923fe2 1186
Pawel Zarembski 0:01f31e923fe2 1187 #if ((USBD_HID_ENABLE) || (USBD_ADC_ENABLE) || (USBD_CDC_ACM_ENABLE) || (USBD_CLS_ENABLE))
Pawel Zarembski 0:01f31e923fe2 1188 __weak void USBD_RTX_Device(void)
Pawel Zarembski 0:01f31e923fe2 1189 {
Pawel Zarembski 0:01f31e923fe2 1190 U16 evt;
Pawel Zarembski 0:01f31e923fe2 1191
Pawel Zarembski 0:01f31e923fe2 1192 for (;;) {
Pawel Zarembski 0:01f31e923fe2 1193 os_evt_wait_or(0xFFFF, 0xFFFF); /* Wait for an Event */
Pawel Zarembski 0:01f31e923fe2 1194 evt = os_evt_get(); /* Get Event Flags */
Pawel Zarembski 0:01f31e923fe2 1195
Pawel Zarembski 0:01f31e923fe2 1196 if (evt & USBD_EVT_RESET) {
Pawel Zarembski 0:01f31e923fe2 1197 #if (USBD_CDC_ACM_ENABLE)
Pawel Zarembski 0:01f31e923fe2 1198 USBD_CDC_ACM_Reset_Event();
Pawel Zarembski 0:01f31e923fe2 1199 #endif
Pawel Zarembski 0:01f31e923fe2 1200 #if (USBD_MSC_ENABLE)
Pawel Zarembski 0:01f31e923fe2 1201 USBD_MSC_Reset_Event();
Pawel Zarembski 0:01f31e923fe2 1202 #endif
Pawel Zarembski 0:01f31e923fe2 1203 }
Pawel Zarembski 0:01f31e923fe2 1204
Pawel Zarembski 0:01f31e923fe2 1205 if (evt & USBD_EVT_SOF) {
Pawel Zarembski 0:01f31e923fe2 1206 #if (USBD_HID_ENABLE)
Pawel Zarembski 0:01f31e923fe2 1207 USBD_HID_SOF_Event();
Pawel Zarembski 0:01f31e923fe2 1208 #endif
Pawel Zarembski 0:01f31e923fe2 1209 #if (USBD_ADC_ENABLE)
Pawel Zarembski 0:01f31e923fe2 1210 USBD_ADC_SOF_Event();
Pawel Zarembski 0:01f31e923fe2 1211 #endif
Pawel Zarembski 0:01f31e923fe2 1212 #if (USBD_CDC_ACM_ENABLE)
Pawel Zarembski 0:01f31e923fe2 1213 USBD_CDC_ACM_SOF_Event();
Pawel Zarembski 0:01f31e923fe2 1214 #endif
Pawel Zarembski 0:01f31e923fe2 1215 #if (USBD_CLS_ENABLE)
Pawel Zarembski 0:01f31e923fe2 1216 USBD_CLS_SOF_Event();
Pawel Zarembski 0:01f31e923fe2 1217 #endif
Pawel Zarembski 0:01f31e923fe2 1218 }
Pawel Zarembski 0:01f31e923fe2 1219 }
Pawel Zarembski 0:01f31e923fe2 1220 }
Pawel Zarembski 0:01f31e923fe2 1221 #else
Pawel Zarembski 0:01f31e923fe2 1222 __weak void USBD_RTX_Device(void);
Pawel Zarembski 0:01f31e923fe2 1223 #endif
Pawel Zarembski 0:01f31e923fe2 1224
Pawel Zarembski 0:01f31e923fe2 1225 /* USB Device - Device Events Callback Pointer */
Pawel Zarembski 0:01f31e923fe2 1226 void (* const USBD_RTX_P_Device)(void) = USBD_RTX_Device;
Pawel Zarembski 0:01f31e923fe2 1227
Pawel Zarembski 0:01f31e923fe2 1228 /* USB Device Endpoint Events Callback Functions */
Pawel Zarembski 0:01f31e923fe2 1229 extern void USBD_RTX_EndPoint0(void);
Pawel Zarembski 0:01f31e923fe2 1230 #ifndef USBD_RTX_EndPoint1
Pawel Zarembski 0:01f31e923fe2 1231 __weak void USBD_RTX_EndPoint1(void);
Pawel Zarembski 0:01f31e923fe2 1232 #endif
Pawel Zarembski 0:01f31e923fe2 1233 #ifndef USBD_RTX_EndPoint2
Pawel Zarembski 0:01f31e923fe2 1234 __weak void USBD_RTX_EndPoint2(void);
Pawel Zarembski 0:01f31e923fe2 1235 #endif
Pawel Zarembski 0:01f31e923fe2 1236 #ifndef USBD_RTX_EndPoint3
Pawel Zarembski 0:01f31e923fe2 1237 __weak void USBD_RTX_EndPoint3(void);
Pawel Zarembski 0:01f31e923fe2 1238 #endif
Pawel Zarembski 0:01f31e923fe2 1239 #ifndef USBD_RTX_EndPoint4
Pawel Zarembski 0:01f31e923fe2 1240 __weak void USBD_RTX_EndPoint4(void);
Pawel Zarembski 0:01f31e923fe2 1241 #endif
Pawel Zarembski 0:01f31e923fe2 1242 #ifndef USBD_RTX_EndPoint5
Pawel Zarembski 0:01f31e923fe2 1243 __weak void USBD_RTX_EndPoint5(void);
Pawel Zarembski 0:01f31e923fe2 1244 #endif
Pawel Zarembski 0:01f31e923fe2 1245 #ifndef USBD_RTX_EndPoint6
Pawel Zarembski 0:01f31e923fe2 1246 __weak void USBD_RTX_EndPoint6(void);
Pawel Zarembski 0:01f31e923fe2 1247 #endif
Pawel Zarembski 0:01f31e923fe2 1248 #ifndef USBD_RTX_EndPoint7
Pawel Zarembski 0:01f31e923fe2 1249 __weak void USBD_RTX_EndPoint7(void);
Pawel Zarembski 0:01f31e923fe2 1250 #endif
Pawel Zarembski 0:01f31e923fe2 1251 #ifndef USBD_RTX_EndPoint8
Pawel Zarembski 0:01f31e923fe2 1252 __weak void USBD_RTX_EndPoint8(void);
Pawel Zarembski 0:01f31e923fe2 1253 #endif
Pawel Zarembski 0:01f31e923fe2 1254 #ifndef USBD_RTX_EndPoint9
Pawel Zarembski 0:01f31e923fe2 1255 __weak void USBD_RTX_EndPoint9(void);
Pawel Zarembski 0:01f31e923fe2 1256 #endif
Pawel Zarembski 0:01f31e923fe2 1257 #ifndef USBD_RTX_EndPoint10
Pawel Zarembski 0:01f31e923fe2 1258 __weak void USBD_RTX_EndPoint10(void);
Pawel Zarembski 0:01f31e923fe2 1259 #endif
Pawel Zarembski 0:01f31e923fe2 1260 #ifndef USBD_RTX_EndPoint11
Pawel Zarembski 0:01f31e923fe2 1261 __weak void USBD_RTX_EndPoint11(void);
Pawel Zarembski 0:01f31e923fe2 1262 #endif
Pawel Zarembski 0:01f31e923fe2 1263 #ifndef USBD_RTX_EndPoint12
Pawel Zarembski 0:01f31e923fe2 1264 __weak void USBD_RTX_EndPoint12(void);
Pawel Zarembski 0:01f31e923fe2 1265 #endif
Pawel Zarembski 0:01f31e923fe2 1266 #ifndef USBD_RTX_EndPoint13
Pawel Zarembski 0:01f31e923fe2 1267 __weak void USBD_RTX_EndPoint13(void);
Pawel Zarembski 0:01f31e923fe2 1268 #endif
Pawel Zarembski 0:01f31e923fe2 1269 #ifndef USBD_RTX_EndPoint14
Pawel Zarembski 0:01f31e923fe2 1270 __weak void USBD_RTX_EndPoint14(void);
Pawel Zarembski 0:01f31e923fe2 1271 #endif
Pawel Zarembski 0:01f31e923fe2 1272 #ifndef USBD_RTX_EndPoint15
Pawel Zarembski 0:01f31e923fe2 1273 __weak void USBD_RTX_EndPoint15(void);
Pawel Zarembski 0:01f31e923fe2 1274 #endif
Pawel Zarembski 0:01f31e923fe2 1275
Pawel Zarembski 0:01f31e923fe2 1276 #if (USBD_HID_ENABLE)
Pawel Zarembski 0:01f31e923fe2 1277 __weak void USBD_RTX_Core(void)
Pawel Zarembski 0:01f31e923fe2 1278 {
Pawel Zarembski 0:01f31e923fe2 1279 U16 evt;
Pawel Zarembski 0:01f31e923fe2 1280
Pawel Zarembski 0:01f31e923fe2 1281 for (;;) {
Pawel Zarembski 0:01f31e923fe2 1282 os_evt_wait_or(0xFFFF, 0xFFFF); /* Wait for an Event */
Pawel Zarembski 0:01f31e923fe2 1283 evt = os_evt_get(); /* Get Event Flags */
Pawel Zarembski 0:01f31e923fe2 1284
Pawel Zarembski 0:01f31e923fe2 1285 if (evt & USBD_EVT_SET_CFG) {
Pawel Zarembski 0:01f31e923fe2 1286 USBD_HID_Configure_Event();
Pawel Zarembski 0:01f31e923fe2 1287 }
Pawel Zarembski 0:01f31e923fe2 1288 }
Pawel Zarembski 0:01f31e923fe2 1289 }
Pawel Zarembski 0:01f31e923fe2 1290 #else
Pawel Zarembski 0:01f31e923fe2 1291 __weak void USBD_RTX_Core(void);
Pawel Zarembski 0:01f31e923fe2 1292 #endif
Pawel Zarembski 0:01f31e923fe2 1293
Pawel Zarembski 0:01f31e923fe2 1294 /* USB Device - Core Events Callback Pointer */
Pawel Zarembski 0:01f31e923fe2 1295 void (* const USBD_RTX_P_Core)(void) = USBD_RTX_Core;
Pawel Zarembski 0:01f31e923fe2 1296
Pawel Zarembski 0:01f31e923fe2 1297 /* USB Device Endpoint Events Callback Pointers */
Pawel Zarembski 0:01f31e923fe2 1298 void (* const USBD_RTX_P_EP[16])(void) = {
Pawel Zarembski 0:01f31e923fe2 1299 USBD_RTX_EndPoint0,
Pawel Zarembski 0:01f31e923fe2 1300 USBD_RTX_EndPoint1,
Pawel Zarembski 0:01f31e923fe2 1301 USBD_RTX_EndPoint2,
Pawel Zarembski 0:01f31e923fe2 1302 USBD_RTX_EndPoint3,
Pawel Zarembski 0:01f31e923fe2 1303 USBD_RTX_EndPoint4,
Pawel Zarembski 0:01f31e923fe2 1304 USBD_RTX_EndPoint5,
Pawel Zarembski 0:01f31e923fe2 1305 USBD_RTX_EndPoint6,
Pawel Zarembski 0:01f31e923fe2 1306 USBD_RTX_EndPoint7,
Pawel Zarembski 0:01f31e923fe2 1307 USBD_RTX_EndPoint8,
Pawel Zarembski 0:01f31e923fe2 1308 USBD_RTX_EndPoint9,
Pawel Zarembski 0:01f31e923fe2 1309 USBD_RTX_EndPoint10,
Pawel Zarembski 0:01f31e923fe2 1310 USBD_RTX_EndPoint11,
Pawel Zarembski 0:01f31e923fe2 1311 USBD_RTX_EndPoint12,
Pawel Zarembski 0:01f31e923fe2 1312 USBD_RTX_EndPoint13,
Pawel Zarembski 0:01f31e923fe2 1313 USBD_RTX_EndPoint14,
Pawel Zarembski 0:01f31e923fe2 1314 USBD_RTX_EndPoint15,
Pawel Zarembski 0:01f31e923fe2 1315 };
Pawel Zarembski 0:01f31e923fe2 1316
Pawel Zarembski 0:01f31e923fe2 1317 void usbd_os_evt_set(U16 event_flags, U32 task)
Pawel Zarembski 0:01f31e923fe2 1318 {
Pawel Zarembski 0:01f31e923fe2 1319 if (task) {
Pawel Zarembski 0:01f31e923fe2 1320 os_evt_set(event_flags, task);
Pawel Zarembski 0:01f31e923fe2 1321 }
Pawel Zarembski 0:01f31e923fe2 1322 }
Pawel Zarembski 0:01f31e923fe2 1323 U16 usbd_os_evt_get(void)
Pawel Zarembski 0:01f31e923fe2 1324 {
Pawel Zarembski 0:01f31e923fe2 1325 return (os_evt_get());
Pawel Zarembski 0:01f31e923fe2 1326 }
Pawel Zarembski 0:01f31e923fe2 1327 U32 usbd_os_evt_wait_or(U16 wait_flags, U16 timeout)
Pawel Zarembski 0:01f31e923fe2 1328 {
Pawel Zarembski 0:01f31e923fe2 1329 return (os_evt_wait_or(wait_flags, timeout));
Pawel Zarembski 0:01f31e923fe2 1330 }
Pawel Zarembski 0:01f31e923fe2 1331
Pawel Zarembski 0:01f31e923fe2 1332 #else
Pawel Zarembski 0:01f31e923fe2 1333 const BOOL __rtx = __FALSE;
Pawel Zarembski 0:01f31e923fe2 1334
Pawel Zarembski 0:01f31e923fe2 1335 void usbd_os_evt_set(U16 event_flags, U32 task)
Pawel Zarembski 0:01f31e923fe2 1336 {
Pawel Zarembski 0:01f31e923fe2 1337
Pawel Zarembski 0:01f31e923fe2 1338 }
Pawel Zarembski 0:01f31e923fe2 1339 U16 usbd_os_evt_get(void)
Pawel Zarembski 0:01f31e923fe2 1340 {
Pawel Zarembski 0:01f31e923fe2 1341 return (0);
Pawel Zarembski 0:01f31e923fe2 1342 }
Pawel Zarembski 0:01f31e923fe2 1343 U32 usbd_os_evt_wait_or(U16 wait_flags, U16 timeout)
Pawel Zarembski 0:01f31e923fe2 1344 {
Pawel Zarembski 0:01f31e923fe2 1345 return (0);
Pawel Zarembski 0:01f31e923fe2 1346 }
Pawel Zarembski 0:01f31e923fe2 1347 #endif
Pawel Zarembski 0:01f31e923fe2 1348
Pawel Zarembski 0:01f31e923fe2 1349 #ifdef __RTX
Pawel Zarembski 0:01f31e923fe2 1350
Pawel Zarembski 0:01f31e923fe2 1351 typedef struct {
Pawel Zarembski 0:01f31e923fe2 1352 void *stack;
Pawel Zarembski 0:01f31e923fe2 1353 U16 size;
Pawel Zarembski 0:01f31e923fe2 1354 } user_stack_t;
Pawel Zarembski 0:01f31e923fe2 1355
Pawel Zarembski 0:01f31e923fe2 1356 #if USBD_ENABLE && !defined(USBD_RTX_CORE_STACK)
Pawel Zarembski 0:01f31e923fe2 1357 #error "USB core stack must be defined"
Pawel Zarembski 0:01f31e923fe2 1358 #endif
Pawel Zarembski 0:01f31e923fe2 1359 #if USBD_ENABLE && !defined(USBD_RTX_DEVICE_STACK)
Pawel Zarembski 0:01f31e923fe2 1360 #error "USB device stack must be defined"
Pawel Zarembski 0:01f31e923fe2 1361 #endif
Pawel Zarembski 0:01f31e923fe2 1362 #if USBD_ENABLE && !defined(USBD_RTX_ENDPOINT0_STACK)
Pawel Zarembski 0:01f31e923fe2 1363 #error "USB endpoint 0 must be defined"
Pawel Zarembski 0:01f31e923fe2 1364 #endif
Pawel Zarembski 0:01f31e923fe2 1365
Pawel Zarembski 0:01f31e923fe2 1366 #if !defined(USBD_HID_EP_INTIN_STACK)
Pawel Zarembski 0:01f31e923fe2 1367 #define USBD_HID_EP_INTIN_STACK 0
Pawel Zarembski 0:01f31e923fe2 1368 #endif
Pawel Zarembski 0:01f31e923fe2 1369 #if !defined(USBD_HID_EP_INTOUT_STACK)
Pawel Zarembski 0:01f31e923fe2 1370 #define USBD_HID_EP_INTOUT_STACK 0
Pawel Zarembski 0:01f31e923fe2 1371 #endif
Pawel Zarembski 0:01f31e923fe2 1372 #if !defined(USBD_MSC_EP_BULKIN_STACK)
Pawel Zarembski 0:01f31e923fe2 1373 #define USBD_MSC_EP_BULKIN_STACK 0
Pawel Zarembski 0:01f31e923fe2 1374 #endif
Pawel Zarembski 0:01f31e923fe2 1375 #if !defined(USBD_MSC_EP_BULKOUT_STACK)
Pawel Zarembski 0:01f31e923fe2 1376 #define USBD_MSC_EP_BULKOUT_STACK 0
Pawel Zarembski 0:01f31e923fe2 1377 #endif
Pawel Zarembski 0:01f31e923fe2 1378 #if !defined(USBD_ADC_EP_ISOOUT_STACK)
Pawel Zarembski 0:01f31e923fe2 1379 #define USBD_ADC_EP_ISOOUT_STACK 0
Pawel Zarembski 0:01f31e923fe2 1380 #endif
Pawel Zarembski 0:01f31e923fe2 1381 #if !defined(USBD_CDC_ACM_EP_INTIN_STACK)
Pawel Zarembski 0:01f31e923fe2 1382 #define USBD_CDC_ACM_EP_INTIN_STACK 0
Pawel Zarembski 0:01f31e923fe2 1383 #endif
Pawel Zarembski 0:01f31e923fe2 1384 #if !defined(USBD_CDC_ACM_EP_BULKIN_STACK)
Pawel Zarembski 0:01f31e923fe2 1385 #define USBD_CDC_ACM_EP_BULKIN_STACK 0
Pawel Zarembski 0:01f31e923fe2 1386 #endif
Pawel Zarembski 0:01f31e923fe2 1387 #if !defined(USBD_CDC_ACM_EP_BULKOUT_STACK)
Pawel Zarembski 0:01f31e923fe2 1388 #define USBD_CDC_ACM_EP_BULKOUT_STACK 0
Pawel Zarembski 0:01f31e923fe2 1389 #endif
Pawel Zarembski 0:01f31e923fe2 1390
Pawel Zarembski 0:01f31e923fe2 1391 #if USBD_HID_EP_INTIN == 0 && USBD_HID_EP_INTIN_STACK > 0
Pawel Zarembski 0:01f31e923fe2 1392 #error "USBD_HID_EP_INTIN stack unused - must be 0"
Pawel Zarembski 0:01f31e923fe2 1393 #endif
Pawel Zarembski 0:01f31e923fe2 1394 #if USBD_HID_EP_INTOUT == 0 && USBD_HID_EP_INTOUT_STACK > 0
Pawel Zarembski 0:01f31e923fe2 1395 #error "USBD_HID_EP_INTOUT stack unused - must be 0"
Pawel Zarembski 0:01f31e923fe2 1396 #endif
Pawel Zarembski 0:01f31e923fe2 1397 #if USBD_MSC_EP_BULKIN == 0 && USBD_MSC_EP_BULKIN_STACK > 0
Pawel Zarembski 0:01f31e923fe2 1398 #error "USBD_MSC_EP_BULKIN stack unused - must be 0"
Pawel Zarembski 0:01f31e923fe2 1399 #endif
Pawel Zarembski 0:01f31e923fe2 1400 #if USBD_MSC_EP_BULKOUT == 0 && USBD_MSC_EP_BULKOUT_STACK > 0
Pawel Zarembski 0:01f31e923fe2 1401 #error "USBD_MSC_EP_BULKOUT stack unused - must be 0"
Pawel Zarembski 0:01f31e923fe2 1402 #endif
Pawel Zarembski 0:01f31e923fe2 1403 #if USBD_ADC_EP_ISOOUT == 0 && USBD_ADC_EP_ISOOUT_STACK > 0
Pawel Zarembski 0:01f31e923fe2 1404 #error "USBD_ADC_EP_ISOOUT stack unused - must be 0"
Pawel Zarembski 0:01f31e923fe2 1405 #endif
Pawel Zarembski 0:01f31e923fe2 1406 #if USBD_CDC_ACM_EP_INTIN == 0 && USBD_CDC_ACM_EP_INTIN_STACK > 0
Pawel Zarembski 0:01f31e923fe2 1407 #error "USBD_CDC_ACM_EP_INTIN stack unused - must be 0"
Pawel Zarembski 0:01f31e923fe2 1408 #endif
Pawel Zarembski 0:01f31e923fe2 1409 #if USBD_CDC_ACM_EP_BULKIN == 0 && USBD_CDC_ACM_EP_BULKIN_STACK > 0
Pawel Zarembski 0:01f31e923fe2 1410 #error "USBD_CDC_ACM_EP_BULKIN stack unused - must be 0"
Pawel Zarembski 0:01f31e923fe2 1411 #endif
Pawel Zarembski 0:01f31e923fe2 1412 #if USBD_CDC_ACM_EP_BULKOUT == 0 && USBD_CDC_ACM_EP_BULKOUT_STACK > 0
Pawel Zarembski 0:01f31e923fe2 1413 #error "USBD_CDC_ACM_EP_BULKOUT stack unused - must be 0"
Pawel Zarembski 0:01f31e923fe2 1414 #endif
Pawel Zarembski 0:01f31e923fe2 1415
Pawel Zarembski 0:01f31e923fe2 1416 #if USBD_ENABLE
Pawel Zarembski 0:01f31e923fe2 1417 static U64 usbd_core_stack[USBD_RTX_CORE_STACK / 8];
Pawel Zarembski 0:01f31e923fe2 1418 static U64 usbd_device_stack[USBD_RTX_DEVICE_STACK / 8];
Pawel Zarembski 0:01f31e923fe2 1419 static U64 usbd_endpoint0_stack[USBD_RTX_ENDPOINT0_STACK / 8];
Pawel Zarembski 0:01f31e923fe2 1420 #endif
Pawel Zarembski 0:01f31e923fe2 1421
Pawel Zarembski 0:01f31e923fe2 1422 #if (USBD_HID_EP_INTIN_STACK > 0)
Pawel Zarembski 0:01f31e923fe2 1423 static U64 usbd_hid_ep_intin_stack[USBD_HID_EP_INTIN_STACK / 8];
Pawel Zarembski 0:01f31e923fe2 1424 #endif
Pawel Zarembski 0:01f31e923fe2 1425 #if (USBD_HID_EP_INTOUT_STACK > 0)
Pawel Zarembski 0:01f31e923fe2 1426 static U64 usbd_hid_ep_intout_stack[USBD_HID_EP_INTOUT_STACK / 8];
Pawel Zarembski 0:01f31e923fe2 1427 #endif
Pawel Zarembski 0:01f31e923fe2 1428 #if (USBD_MSC_EP_BULKIN_STACK > 0)
Pawel Zarembski 0:01f31e923fe2 1429 static U64 usbd_msc_ep_bulkin_stack[USBD_MSC_EP_BULKIN_STACK / 8];
Pawel Zarembski 0:01f31e923fe2 1430 #endif
Pawel Zarembski 0:01f31e923fe2 1431 #if (USBD_MSC_EP_BULKOUT_STACK > 0)
Pawel Zarembski 0:01f31e923fe2 1432 static U64 usbd_msc_ep_bulkout_stack[USBD_MSC_EP_BULKOUT_STACK / 8];
Pawel Zarembski 0:01f31e923fe2 1433 #endif
Pawel Zarembski 0:01f31e923fe2 1434 #if (USBD_ADC_EP_ISOOUT_STACK > 0)
Pawel Zarembski 0:01f31e923fe2 1435 static U64 usbd_adc_ep_isoout_stack[USBD_ADC_EP_ISOOUT_STACK / 8];
Pawel Zarembski 0:01f31e923fe2 1436 #endif
Pawel Zarembski 0:01f31e923fe2 1437 #if (USBD_CDC_ACM_EP_INTIN_STACK > 0)
Pawel Zarembski 0:01f31e923fe2 1438 static U64 usbd_cdc_acm_ep_intin_stack[USBD_CDC_ACM_EP_INTIN_STACK / 8];
Pawel Zarembski 0:01f31e923fe2 1439 #endif
Pawel Zarembski 0:01f31e923fe2 1440 #if (USBD_CDC_ACM_EP_BULKIN_STACK > 0)
Pawel Zarembski 0:01f31e923fe2 1441 static U64 usbd_cdc_acm_ep_bulkin_stack[USBD_CDC_ACM_EP_BULKIN_STACK / 8];
Pawel Zarembski 0:01f31e923fe2 1442 #endif
Pawel Zarembski 0:01f31e923fe2 1443 #if (USBD_CDC_ACM_EP_BULKOUT_STACK > 0)
Pawel Zarembski 0:01f31e923fe2 1444 static U64 usbd_cdc_acm_ep_bulkout_stack[USBD_CDC_ACM_EP_BULKOUT_STACK / 8];
Pawel Zarembski 0:01f31e923fe2 1445 #endif
Pawel Zarembski 0:01f31e923fe2 1446
Pawel Zarembski 0:01f31e923fe2 1447 // Check HID
Pawel Zarembski 0:01f31e923fe2 1448 #if (USBD_HID_ENABLE && !USBD_HID_EP_INTIN_STACK && USBD_HID_EP_INTIN != USBD_HID_EP_INTOUT)
Pawel Zarembski 0:01f31e923fe2 1449 #error "USBD_HID_EP_INTIN_STACK must be defined"
Pawel Zarembski 0:01f31e923fe2 1450 #endif
Pawel Zarembski 0:01f31e923fe2 1451 #if (USBD_HID_ENABLE && !USBD_HID_EP_INTOUT_STACK && USBD_HID_EP_INTIN != USBD_HID_EP_INTOUT && USBD_HID_EP_INTOUT != 0)
Pawel Zarembski 0:01f31e923fe2 1452 #error "USBD_HID_EP_INTOUT_STACK must be defined"
Pawel Zarembski 0:01f31e923fe2 1453 #endif
Pawel Zarembski 0:01f31e923fe2 1454 #if (USBD_HID_ENABLE && USBD_HID_EP_INTIN_STACK == 0 && USBD_HID_EP_INTOUT_STACK == 0)
Pawel Zarembski 0:01f31e923fe2 1455 #error "HID stack must be defined"
Pawel Zarembski 0:01f31e923fe2 1456 #endif
Pawel Zarembski 0:01f31e923fe2 1457 #if (USBD_HID_EP_INTIN_STACK > 0 && USBD_HID_EP_INTOUT_STACK > 0 && USBD_HID_EP_INTIN == USBD_HID_EP_INTOUT)
Pawel Zarembski 0:01f31e923fe2 1458 #error "Multiple HID stacks defined for same EP"
Pawel Zarembski 0:01f31e923fe2 1459 #endif
Pawel Zarembski 0:01f31e923fe2 1460
Pawel Zarembski 0:01f31e923fe2 1461 // Check MSC
Pawel Zarembski 0:01f31e923fe2 1462 #if (USBD_MSC_ENABLE && !USBD_MSC_EP_BULKIN_STACK && USBD_MSC_EP_BULKIN != USBD_MSC_EP_BULKOUT)
Pawel Zarembski 0:01f31e923fe2 1463 #error "USBD_MSC_EP_BULKIN_STACK must be defined"
Pawel Zarembski 0:01f31e923fe2 1464 #endif
Pawel Zarembski 0:01f31e923fe2 1465 #if (USBD_MSC_ENABLE && !USBD_MSC_EP_BULKOUT_STACK && USBD_MSC_EP_BULKIN != USBD_MSC_EP_BULKOUT)
Pawel Zarembski 0:01f31e923fe2 1466 #error "USBD_MSC_EP_BULKIN_STACK must be defined"
Pawel Zarembski 0:01f31e923fe2 1467 #endif
Pawel Zarembski 0:01f31e923fe2 1468 #if (USBD_MSC_ENABLE && USBD_MSC_EP_BULKIN_STACK == 0 && USBD_MSC_EP_BULKOUT_STACK == 0)
Pawel Zarembski 0:01f31e923fe2 1469 #error "MSC stack must be defined"
Pawel Zarembski 0:01f31e923fe2 1470 #endif
Pawel Zarembski 0:01f31e923fe2 1471 #if (USBD_MSC_EP_BULKIN_STACK > 0 && USBD_MSC_EP_BULKOUT_STACK > 0 && USBD_MSC_EP_BULKIN == USBD_MSC_EP_BULKOUT)
Pawel Zarembski 0:01f31e923fe2 1472 #error "Multiple MSC stacks defined for same EP"
Pawel Zarembski 0:01f31e923fe2 1473 #endif
Pawel Zarembski 0:01f31e923fe2 1474
Pawel Zarembski 0:01f31e923fe2 1475 // Check ADC
Pawel Zarembski 0:01f31e923fe2 1476 #if (USBD_ADC_ENABLE && !USBD_ADC_EP_ISOOUT_STACK)
Pawel Zarembski 0:01f31e923fe2 1477 #error "ADC stack must be defined"
Pawel Zarembski 0:01f31e923fe2 1478 #endif
Pawel Zarembski 0:01f31e923fe2 1479
Pawel Zarembski 0:01f31e923fe2 1480 // Check CDC
Pawel Zarembski 0:01f31e923fe2 1481 #if (USBD_CDC_ACM_ENABLE && !USBD_CDC_ACM_EP_INTIN_STACK)
Pawel Zarembski 0:01f31e923fe2 1482 #error "CDC ACM INTIN stack must be defined"
Pawel Zarembski 0:01f31e923fe2 1483 #endif
Pawel Zarembski 0:01f31e923fe2 1484 #if (USBD_CDC_ACM_ENABLE && !USBD_CDC_ACM_EP_BULKIN_STACK && USBD_CDC_ACM_EP_BULKIN != USBD_CDC_ACM_EP_BULKOUT)
Pawel Zarembski 0:01f31e923fe2 1485 #error "USBD_CDC_ACM_EP_BULKIN must be defined"
Pawel Zarembski 0:01f31e923fe2 1486 #endif
Pawel Zarembski 0:01f31e923fe2 1487 #if (USBD_CDC_ACM_ENABLE && !USBD_CDC_ACM_EP_BULKOUT_STACK && USBD_CDC_ACM_EP_BULKIN != USBD_CDC_ACM_EP_BULKOUT)
Pawel Zarembski 0:01f31e923fe2 1488 #error "USBD_CDC_ACM_EP_BULKOUT must be defined"
Pawel Zarembski 0:01f31e923fe2 1489 #endif
Pawel Zarembski 0:01f31e923fe2 1490 #if (USBD_CDC_ACM_ENABLE && USBD_CDC_ACM_EP_BULKIN_STACK == 0 && USBD_CDC_ACM_EP_BULKOUT_STACK == 0)
Pawel Zarembski 0:01f31e923fe2 1491 #error "CDC BULK stack must be defined"
Pawel Zarembski 0:01f31e923fe2 1492 #endif
Pawel Zarembski 0:01f31e923fe2 1493 #if (USBD_CDC_ACM_EP_BULKIN_STACK > 0 && USBD_CDC_ACM_EP_BULKOUT_STACK > 0 && USBD_CDC_ACM_EP_BULKIN == USBD_CDC_ACM_EP_BULKOUT)
Pawel Zarembski 0:01f31e923fe2 1494 #error "Multiple CDC stacks defined for same EP"
Pawel Zarembski 0:01f31e923fe2 1495 #endif
Pawel Zarembski 0:01f31e923fe2 1496
Pawel Zarembski 0:01f31e923fe2 1497 static const user_stack_t user_stack_list[16] = {
Pawel Zarembski 0:01f31e923fe2 1498 #if USBD_ENABLE
Pawel Zarembski 0:01f31e923fe2 1499 [0] = {usbd_endpoint0_stack, sizeof(usbd_endpoint0_stack)},
Pawel Zarembski 0:01f31e923fe2 1500 #endif
Pawel Zarembski 0:01f31e923fe2 1501 #if (USBD_HID_EP_INTIN_STACK > 0)
Pawel Zarembski 0:01f31e923fe2 1502 [USBD_HID_EP_INTIN] = {usbd_hid_ep_intin_stack, sizeof(usbd_hid_ep_intin_stack)},
Pawel Zarembski 0:01f31e923fe2 1503 #endif
Pawel Zarembski 0:01f31e923fe2 1504 #if (USBD_HID_EP_INTOUT_STACK > 0)
Pawel Zarembski 0:01f31e923fe2 1505 [USBD_HID_EP_INTOUT] = {usbd_hid_ep_intout_stack, sizeof(usbd_hid_ep_intout_stack)},
Pawel Zarembski 0:01f31e923fe2 1506 #endif
Pawel Zarembski 0:01f31e923fe2 1507 #if (USBD_MSC_EP_BULKIN_STACK > 0)
Pawel Zarembski 0:01f31e923fe2 1508 [USBD_MSC_EP_BULKIN] = {usbd_msc_ep_bulkin_stack, sizeof(usbd_msc_ep_bulkin_stack)},
Pawel Zarembski 0:01f31e923fe2 1509 #endif
Pawel Zarembski 0:01f31e923fe2 1510 #if (USBD_MSC_EP_BULKOUT_STACK > 0)
Pawel Zarembski 0:01f31e923fe2 1511 [USBD_MSC_EP_BULKOUT] = {usbd_msc_ep_bulkout_stack, sizeof(usbd_msc_ep_bulkout_stack)},
Pawel Zarembski 0:01f31e923fe2 1512 #endif
Pawel Zarembski 0:01f31e923fe2 1513 #if (USBD_ADC_EP_ISOOUT_STACK > 0)
Pawel Zarembski 0:01f31e923fe2 1514 [USBD_ADC_EP_ISOOUT] = {usbd_adc_ep_isoout_stack, sizeof(usbd_adc_ep_isoout_stack)},
Pawel Zarembski 0:01f31e923fe2 1515 #endif
Pawel Zarembski 0:01f31e923fe2 1516 #if (USBD_CDC_ACM_EP_INTIN_STACK > 0)
Pawel Zarembski 0:01f31e923fe2 1517 [USBD_CDC_ACM_EP_INTIN] = {usbd_cdc_acm_ep_intin_stack, sizeof(usbd_cdc_acm_ep_intin_stack)},
Pawel Zarembski 0:01f31e923fe2 1518 #endif
Pawel Zarembski 0:01f31e923fe2 1519 #if (USBD_CDC_ACM_EP_BULKIN_STACK > 0)
Pawel Zarembski 0:01f31e923fe2 1520 [USBD_CDC_ACM_EP_BULKIN] = {usbd_cdc_acm_ep_bulkin_stack, sizeof(usbd_cdc_acm_ep_bulkin_stack)},
Pawel Zarembski 0:01f31e923fe2 1521 #endif
Pawel Zarembski 0:01f31e923fe2 1522 #if (USBD_CDC_ACM_EP_BULKOUT_STACK > 0)
Pawel Zarembski 0:01f31e923fe2 1523 [USBD_CDC_ACM_EP_BULKOUT] = {usbd_cdc_acm_ep_bulkout_stack, sizeof(usbd_cdc_acm_ep_bulkout_stack)},
Pawel Zarembski 0:01f31e923fe2 1524 #endif
Pawel Zarembski 0:01f31e923fe2 1525 };
Pawel Zarembski 0:01f31e923fe2 1526
Pawel Zarembski 0:01f31e923fe2 1527 #endif /* __RTX */
Pawel Zarembski 0:01f31e923fe2 1528
Pawel Zarembski 0:01f31e923fe2 1529 void USBD_RTX_TaskInit(void)
Pawel Zarembski 0:01f31e923fe2 1530 {
Pawel Zarembski 0:01f31e923fe2 1531 #ifdef __RTX
Pawel Zarembski 0:01f31e923fe2 1532 /* Initialize memory pools for endpoints */
Pawel Zarembski 0:01f31e923fe2 1533 U32 i;
Pawel Zarembski 0:01f31e923fe2 1534 USBD_RTX_DevTask = 0;
Pawel Zarembski 0:01f31e923fe2 1535
Pawel Zarembski 0:01f31e923fe2 1536 if (USBD_RTX_P_Device) {
Pawel Zarembski 0:01f31e923fe2 1537 USBD_RTX_DevTask = os_tsk_create_user(USBD_RTX_Device, 3, usbd_device_stack,
Pawel Zarembski 0:01f31e923fe2 1538 sizeof(usbd_device_stack));
Pawel Zarembski 0:01f31e923fe2 1539 }
Pawel Zarembski 0:01f31e923fe2 1540
Pawel Zarembski 0:01f31e923fe2 1541 for (i = 0; i <= 15; i++) {
Pawel Zarembski 0:01f31e923fe2 1542 USBD_RTX_EPTask[i] = 0;
Pawel Zarembski 0:01f31e923fe2 1543
Pawel Zarembski 0:01f31e923fe2 1544 if (USBD_RTX_P_EP[i]) {
Pawel Zarembski 0:01f31e923fe2 1545 // Set the control endpoint (endpoint 0) thread to a high priority.
Pawel Zarembski 0:01f31e923fe2 1546 // According to the USB 2.0 specification, the time to complete standard
Pawel Zarembski 0:01f31e923fe2 1547 // request with no data must be under 50ms. If a long caluclation
Pawel Zarembski 0:01f31e923fe2 1548 // such as a CRC is running on a higher priority thread, USB enumeration
Pawel Zarembski 0:01f31e923fe2 1549 // can fail because of this timeout.
Pawel Zarembski 0:01f31e923fe2 1550 uint8_t priority = 0 == i ? 200 : 20;
Pawel Zarembski 0:01f31e923fe2 1551 USBD_RTX_EPTask[i] = os_tsk_create_user(USBD_RTX_P_EP[i], priority, user_stack_list[i].stack,
Pawel Zarembski 0:01f31e923fe2 1552 user_stack_list[i].size);
Pawel Zarembski 0:01f31e923fe2 1553 }
Pawel Zarembski 0:01f31e923fe2 1554 }
Pawel Zarembski 0:01f31e923fe2 1555
Pawel Zarembski 0:01f31e923fe2 1556 USBD_RTX_CoreTask = 0;
Pawel Zarembski 0:01f31e923fe2 1557
Pawel Zarembski 0:01f31e923fe2 1558 if (USBD_RTX_P_Core) {
Pawel Zarembski 0:01f31e923fe2 1559 USBD_RTX_CoreTask = os_tsk_create_user(USBD_RTX_Core, 2, usbd_core_stack,
Pawel Zarembski 0:01f31e923fe2 1560 sizeof(usbd_core_stack));
Pawel Zarembski 0:01f31e923fe2 1561 }
Pawel Zarembski 0:01f31e923fe2 1562
Pawel Zarembski 0:01f31e923fe2 1563 #endif
Pawel Zarembski 0:01f31e923fe2 1564 }
Pawel Zarembski 0:01f31e923fe2 1565
Pawel Zarembski 0:01f31e923fe2 1566 /*------------------------------------------------------------------------------
Pawel Zarembski 0:01f31e923fe2 1567 * CDC Sizes
Pawel Zarembski 0:01f31e923fe2 1568 *----------------------------------------------------------------------------*/
Pawel Zarembski 0:01f31e923fe2 1569 #define CDC_HEADER_SIZE 5
Pawel Zarembski 0:01f31e923fe2 1570 #define CDC_CALL_MANAGEMENT_SIZE 5
Pawel Zarembski 0:01f31e923fe2 1571 #define CDC_ABSTRACT_CONTROL_MANAGEMENT_SIZE 4
Pawel Zarembski 0:01f31e923fe2 1572 #define CDC_UNION_SIZE 5
Pawel Zarembski 0:01f31e923fe2 1573
Pawel Zarembski 0:01f31e923fe2 1574 /*------------------------------------------------------------------------------
Pawel Zarembski 0:01f31e923fe2 1575 * USB Device Descriptors
Pawel Zarembski 0:01f31e923fe2 1576 *----------------------------------------------------------------------------*/
Pawel Zarembski 0:01f31e923fe2 1577 #define USBD_MSC_DESC_LEN (USB_INTERFACE_DESC_SIZE + 2*USB_ENDPOINT_DESC_SIZE)
Pawel Zarembski 0:01f31e923fe2 1578 #define USBD_CDC_ACM_DESC_LEN (USBD_MULTI_IF * USB_INTERFACE_ASSOC_DESC_SIZE + \
Pawel Zarembski 0:01f31e923fe2 1579 /* CDC Interface 1 */ \
Pawel Zarembski 0:01f31e923fe2 1580 USB_INTERFACE_DESC_SIZE + CDC_HEADER_SIZE + CDC_CALL_MANAGEMENT_SIZE + \
Pawel Zarembski 0:01f31e923fe2 1581 CDC_ABSTRACT_CONTROL_MANAGEMENT_SIZE + CDC_UNION_SIZE + USB_ENDPOINT_DESC_SIZE + \
Pawel Zarembski 0:01f31e923fe2 1582 /* CDC Interface 2 */ \
Pawel Zarembski 0:01f31e923fe2 1583 USB_INTERFACE_DESC_SIZE + USB_ENDPOINT_DESC_SIZE + USB_ENDPOINT_DESC_SIZE)
Pawel Zarembski 0:01f31e923fe2 1584 #define USBD_HID_DESC_LEN (USB_INTERFACE_DESC_SIZE + USB_HID_DESC_SIZE + \
Pawel Zarembski 0:01f31e923fe2 1585 (USB_ENDPOINT_DESC_SIZE*((USBD_HID_EP_INTIN != 0)+(USBD_HID_EP_INTOUT != 0))))
Pawel Zarembski 0:01f31e923fe2 1586 #define USBD_BULK_DESC_LEN (USB_INTERFACE_DESC_SIZE + 2*USB_ENDPOINT_DESC_SIZE)
Pawel Zarembski 0:01f31e923fe2 1587
Pawel Zarembski 0:01f31e923fe2 1588 #define USBD_HID_DESC_OFS (USB_CONFIGUARTION_DESC_SIZE + USB_INTERFACE_DESC_SIZE + \
Pawel Zarembski 0:01f31e923fe2 1589 USBD_MSC_ENABLE * USBD_MSC_DESC_LEN + USBD_CDC_ACM_ENABLE * USBD_CDC_ACM_DESC_LEN)
Pawel Zarembski 0:01f31e923fe2 1590
Pawel Zarembski 0:01f31e923fe2 1591 #define USBD_WTOTALLENGTH_MAX (USB_CONFIGUARTION_DESC_SIZE + \
Pawel Zarembski 0:01f31e923fe2 1592 USBD_CDC_ACM_DESC_LEN * USBD_CDC_ACM_ENABLE + \
Pawel Zarembski 0:01f31e923fe2 1593 USBD_HID_DESC_LEN * USBD_HID_ENABLE + \
Pawel Zarembski 0:01f31e923fe2 1594 (USB_INTERFACE_DESC_SIZE) * USBD_WEBUSB_ENABLE + \
Pawel Zarembski 0:01f31e923fe2 1595 USBD_BULK_DESC_LEN * USBD_BULK_ENABLE + \
Pawel Zarembski 0:01f31e923fe2 1596 USBD_MSC_DESC_LEN * USBD_MSC_ENABLE)
Pawel Zarembski 0:01f31e923fe2 1597
Pawel Zarembski 0:01f31e923fe2 1598 /*------------------------------------------------------------------------------
Pawel Zarembski 0:01f31e923fe2 1599 Default HID Report Descriptor
Pawel Zarembski 0:01f31e923fe2 1600 *----------------------------------------------------------------------------*/
Pawel Zarembski 0:01f31e923fe2 1601
Pawel Zarembski 0:01f31e923fe2 1602 /* Bit Input Output
Pawel Zarembski 0:01f31e923fe2 1603 0 IN0 OUT0
Pawel Zarembski 0:01f31e923fe2 1604 1 IN1 OUT1
Pawel Zarembski 0:01f31e923fe2 1605 2 IN2 OUT2
Pawel Zarembski 0:01f31e923fe2 1606 3 IN3 OUT3
Pawel Zarembski 0:01f31e923fe2 1607 4 IN4 OUT4
Pawel Zarembski 0:01f31e923fe2 1608 5 IN5 OUT5
Pawel Zarembski 0:01f31e923fe2 1609 6 IN6 OUT6
Pawel Zarembski 0:01f31e923fe2 1610 7 IN7 OUT7
Pawel Zarembski 0:01f31e923fe2 1611 */
Pawel Zarembski 0:01f31e923fe2 1612
Pawel Zarembski 0:01f31e923fe2 1613 __weak \
Pawel Zarembski 0:01f31e923fe2 1614 const U8 USBD_HID_ReportDescriptor[] = {
Pawel Zarembski 0:01f31e923fe2 1615 HID_UsagePageVendor(0x00),
Pawel Zarembski 0:01f31e923fe2 1616 HID_Usage(0x01),
Pawel Zarembski 0:01f31e923fe2 1617 HID_Collection(HID_Application),
Pawel Zarembski 0:01f31e923fe2 1618 HID_LogicalMin(0), /* value range: 0 - 0xFF */
Pawel Zarembski 0:01f31e923fe2 1619 HID_LogicalMaxS(0xFF),
Pawel Zarembski 0:01f31e923fe2 1620 HID_ReportSize(8), /* 8 bits */
Pawel Zarembski 0:01f31e923fe2 1621 #if (USBD_HID_INREPORT_MAX_SZ > 255)
Pawel Zarembski 0:01f31e923fe2 1622 HID_ReportCountS(USBD_HID_INREPORT_MAX_SZ),
Pawel Zarembski 0:01f31e923fe2 1623 #else
Pawel Zarembski 0:01f31e923fe2 1624 HID_ReportCount(USBD_HID_INREPORT_MAX_SZ),
Pawel Zarembski 0:01f31e923fe2 1625 #endif
Pawel Zarembski 0:01f31e923fe2 1626 HID_Usage(0x01),
Pawel Zarembski 0:01f31e923fe2 1627 HID_Input(HID_Data | HID_Variable | HID_Absolute),
Pawel Zarembski 0:01f31e923fe2 1628 #if (USBD_HID_OUTREPORT_MAX_SZ > 255)
Pawel Zarembski 0:01f31e923fe2 1629 HID_ReportCountS(USBD_HID_OUTREPORT_MAX_SZ),
Pawel Zarembski 0:01f31e923fe2 1630 #else
Pawel Zarembski 0:01f31e923fe2 1631 HID_ReportCount(USBD_HID_OUTREPORT_MAX_SZ),
Pawel Zarembski 0:01f31e923fe2 1632 #endif
Pawel Zarembski 0:01f31e923fe2 1633 HID_Usage(0x01),
Pawel Zarembski 0:01f31e923fe2 1634 HID_Output(HID_Data | HID_Variable | HID_Absolute),
Pawel Zarembski 0:01f31e923fe2 1635 #if (USBD_HID_FEATREPORT_MAX_SZ > 255)
Pawel Zarembski 0:01f31e923fe2 1636 HID_ReportCountS(USBD_HID_FEATREPORT_MAX_SZ),
Pawel Zarembski 0:01f31e923fe2 1637 #else
Pawel Zarembski 0:01f31e923fe2 1638 HID_ReportCount(USBD_HID_FEATREPORT_MAX_SZ),
Pawel Zarembski 0:01f31e923fe2 1639 #endif
Pawel Zarembski 0:01f31e923fe2 1640 HID_Usage(0x01),
Pawel Zarembski 0:01f31e923fe2 1641 HID_Feature(HID_Data | HID_Variable | HID_Absolute),
Pawel Zarembski 0:01f31e923fe2 1642 HID_EndCollection,
Pawel Zarembski 0:01f31e923fe2 1643 };
Pawel Zarembski 0:01f31e923fe2 1644
Pawel Zarembski 0:01f31e923fe2 1645 __weak \
Pawel Zarembski 0:01f31e923fe2 1646 const U16 USBD_HID_ReportDescriptorSize = sizeof(USBD_HID_ReportDescriptor);
Pawel Zarembski 0:01f31e923fe2 1647
Pawel Zarembski 0:01f31e923fe2 1648 __weak \
Pawel Zarembski 0:01f31e923fe2 1649 U16 USBD_HID_DescriptorOffset = USBD_HID_DESC_OFS;
Pawel Zarembski 0:01f31e923fe2 1650
Pawel Zarembski 0:01f31e923fe2 1651 /* USB Device Standard Descriptor */
Pawel Zarembski 0:01f31e923fe2 1652 __weak \
Pawel Zarembski 0:01f31e923fe2 1653 const U8 USBD_DeviceDescriptor[] = {
Pawel Zarembski 0:01f31e923fe2 1654 USB_DEVICE_DESC_SIZE, /* bLength */
Pawel Zarembski 0:01f31e923fe2 1655 USB_DEVICE_DESCRIPTOR_TYPE, /* bDescriptorType */
Pawel Zarembski 0:01f31e923fe2 1656 #if (USBD_BOS_ENABLE)
Pawel Zarembski 0:01f31e923fe2 1657 WBVAL(0x0210), /* 2.10 */ /* bcdUSB */
Pawel Zarembski 0:01f31e923fe2 1658 #elif ((USBD_HS_ENABLE) || (USBD_MULTI_IF))
Pawel Zarembski 0:01f31e923fe2 1659 WBVAL(0x0200), /* 2.00 */ /* bcdUSB */
Pawel Zarembski 0:01f31e923fe2 1660 #else
Pawel Zarembski 0:01f31e923fe2 1661 WBVAL(0x0110), /* 1.10 */ /* bcdUSB */
Pawel Zarembski 0:01f31e923fe2 1662 #endif
Pawel Zarembski 0:01f31e923fe2 1663 #if (USBD_MULTI_IF)
Pawel Zarembski 0:01f31e923fe2 1664 USB_DEVICE_CLASS_MISCELLANEOUS, /* bDeviceClass */
Pawel Zarembski 0:01f31e923fe2 1665 0x02, /* bDeviceSubClass */
Pawel Zarembski 0:01f31e923fe2 1666 0x01, /* bDeviceProtocol */
Pawel Zarembski 0:01f31e923fe2 1667 #elif (USBD_CDC_ACM_ENABLE)
Pawel Zarembski 0:01f31e923fe2 1668 USB_DEVICE_CLASS_COMMUNICATIONS, /* bDeviceClass CDC*/
Pawel Zarembski 0:01f31e923fe2 1669 0x00, /* bDeviceSubClass */
Pawel Zarembski 0:01f31e923fe2 1670 0x00, /* bDeviceProtocol */
Pawel Zarembski 0:01f31e923fe2 1671 #else
Pawel Zarembski 0:01f31e923fe2 1672 0x00, /* bDeviceClass */
Pawel Zarembski 0:01f31e923fe2 1673 0x00, /* bDeviceSubClass */
Pawel Zarembski 0:01f31e923fe2 1674 0x00, /* bDeviceProtocol */
Pawel Zarembski 0:01f31e923fe2 1675 #endif
Pawel Zarembski 0:01f31e923fe2 1676 USBD_MAX_PACKET0, /* bMaxPacketSize0 */
Pawel Zarembski 0:01f31e923fe2 1677 WBVAL(USBD_DEVDESC_IDVENDOR), /* idVendor */
Pawel Zarembski 0:01f31e923fe2 1678 WBVAL(USBD_DEVDESC_IDPRODUCT), /* idProduct */
Pawel Zarembski 0:01f31e923fe2 1679 WBVAL(USBD_DEVDESC_BCDDEVICE), /* bcdDevice */
Pawel Zarembski 0:01f31e923fe2 1680 0x01, /* iManufacturer */
Pawel Zarembski 0:01f31e923fe2 1681 0x02, /* iProduct */
Pawel Zarembski 0:01f31e923fe2 1682 0x03 * USBD_STRDESC_SER_ENABLE, /* iSerialNumber */
Pawel Zarembski 0:01f31e923fe2 1683 0x01 /* bNumConfigurations: one possible configuration*/
Pawel Zarembski 0:01f31e923fe2 1684 };
Pawel Zarembski 0:01f31e923fe2 1685
Pawel Zarembski 0:01f31e923fe2 1686 #if (USBD_HS_ENABLE)
Pawel Zarembski 0:01f31e923fe2 1687 /* USB Device Qualifier Descriptor (for Full Speed) */
Pawel Zarembski 0:01f31e923fe2 1688 __weak \
Pawel Zarembski 0:01f31e923fe2 1689 const U8 USBD_DeviceQualifier[] = {
Pawel Zarembski 0:01f31e923fe2 1690 USB_DEVICE_QUALI_SIZE, /* bLength */
Pawel Zarembski 0:01f31e923fe2 1691 USB_DEVICE_QUALIFIER_DESCRIPTOR_TYPE, /* bDescriptorType */
Pawel Zarembski 0:01f31e923fe2 1692 #if (USBD_BOS_ENABLE)
Pawel Zarembski 0:01f31e923fe2 1693 WBVAL(0x0210), /* 2.10 */ /* bcdUSB */
Pawel Zarembski 0:01f31e923fe2 1694 #else
Pawel Zarembski 0:01f31e923fe2 1695 WBVAL(0x0200), /* 2.00 */ /* bcdUSB */
Pawel Zarembski 0:01f31e923fe2 1696 #endif
Pawel Zarembski 0:01f31e923fe2 1697 0x00, /* bDeviceClass */
Pawel Zarembski 0:01f31e923fe2 1698 0x00, /* bDeviceSubClass */
Pawel Zarembski 0:01f31e923fe2 1699 0x00, /* bDeviceProtocol */
Pawel Zarembski 0:01f31e923fe2 1700 USBD_MAX_PACKET0, /* bMaxPacketSize0 */
Pawel Zarembski 0:01f31e923fe2 1701 0x01, /* bNumConfigurations */
Pawel Zarembski 0:01f31e923fe2 1702 0x00 /* bReserved */
Pawel Zarembski 0:01f31e923fe2 1703 };
Pawel Zarembski 0:01f31e923fe2 1704
Pawel Zarembski 0:01f31e923fe2 1705 /* USB Device Qualifier Descriptor for High Speed */
Pawel Zarembski 0:01f31e923fe2 1706 __weak \
Pawel Zarembski 0:01f31e923fe2 1707 const U8 USBD_DeviceQualifier_HS[] = {
Pawel Zarembski 0:01f31e923fe2 1708 USB_DEVICE_QUALI_SIZE, /* bLength */
Pawel Zarembski 0:01f31e923fe2 1709 USB_DEVICE_QUALIFIER_DESCRIPTOR_TYPE, /* bDescriptorType */
Pawel Zarembski 0:01f31e923fe2 1710 #if (USBD_BOS_ENABLE)
Pawel Zarembski 0:01f31e923fe2 1711 WBVAL(0x0210), /* 2.10 */ /* bcdUSB */
Pawel Zarembski 0:01f31e923fe2 1712 #else
Pawel Zarembski 0:01f31e923fe2 1713 WBVAL(0x0200), /* 2.00 */ /* bcdUSB */
Pawel Zarembski 0:01f31e923fe2 1714 #endif
Pawel Zarembski 0:01f31e923fe2 1715 0x00, /* bDeviceClass */
Pawel Zarembski 0:01f31e923fe2 1716 0x00, /* bDeviceSubClass */
Pawel Zarembski 0:01f31e923fe2 1717 0x00, /* bDeviceProtocol */
Pawel Zarembski 0:01f31e923fe2 1718 USBD_MAX_PACKET0, /* bMaxPacketSize0 */
Pawel Zarembski 0:01f31e923fe2 1719 0x01, /* bNumConfigurations */
Pawel Zarembski 0:01f31e923fe2 1720 0x00 /* bReserved */
Pawel Zarembski 0:01f31e923fe2 1721 };
Pawel Zarembski 0:01f31e923fe2 1722 #else
Pawel Zarembski 0:01f31e923fe2 1723 /* USB Device Qualifier Descriptor (for Full Speed) */
Pawel Zarembski 0:01f31e923fe2 1724 __weak \
Pawel Zarembski 0:01f31e923fe2 1725 const U8 USBD_DeviceQualifier[] = { 0 };
Pawel Zarembski 0:01f31e923fe2 1726
Pawel Zarembski 0:01f31e923fe2 1727 /* USB Device Qualifier Descriptor for High Speed */
Pawel Zarembski 0:01f31e923fe2 1728 __weak \
Pawel Zarembski 0:01f31e923fe2 1729 const U8 USBD_DeviceQualifier_HS[] = { 0 };
Pawel Zarembski 0:01f31e923fe2 1730 #endif
Pawel Zarembski 0:01f31e923fe2 1731
Pawel Zarembski 0:01f31e923fe2 1732 #if (USBD_WINUSB_ENABLE)
Pawel Zarembski 0:01f31e923fe2 1733
Pawel Zarembski 0:01f31e923fe2 1734 #define FUNCTION_SUBSET_LEN 160
Pawel Zarembski 0:01f31e923fe2 1735 #define DEVICE_INTERFACE_GUIDS_FEATURE_LEN 132
Pawel Zarembski 0:01f31e923fe2 1736
Pawel Zarembski 0:01f31e923fe2 1737 #define USBD_WINUSB_DESC_SET_LEN (WINUSB_DESCRIPTOR_SET_HEADER_SIZE + USBD_WEBUSB_ENABLE * FUNCTION_SUBSET_LEN + USBD_BULK_ENABLE * FUNCTION_SUBSET_LEN)
Pawel Zarembski 0:01f31e923fe2 1738
Pawel Zarembski 0:01f31e923fe2 1739 U8 USBD_WinUSBDescriptorSetDescriptor[] = {
Pawel Zarembski 0:01f31e923fe2 1740 WBVAL(WINUSB_DESCRIPTOR_SET_HEADER_SIZE), /* wLength */
Pawel Zarembski 0:01f31e923fe2 1741 WBVAL(WINUSB_SET_HEADER_DESCRIPTOR_TYPE), /* wDescriptorType */
Pawel Zarembski 0:01f31e923fe2 1742 0x00, 0x00, 0x03, 0x06, /* >= Win 8.1 */ /* dwWindowsVersion*/
Pawel Zarembski 0:01f31e923fe2 1743 WBVAL(USBD_WINUSB_DESC_SET_LEN), /* wDescriptorSetTotalLength */
Pawel Zarembski 0:01f31e923fe2 1744 #if (USBD_WEBUSB_ENABLE)
Pawel Zarembski 0:01f31e923fe2 1745 WBVAL(WINUSB_FUNCTION_SUBSET_HEADER_SIZE),// wLength
Pawel Zarembski 0:01f31e923fe2 1746 WBVAL(WINUSB_SUBSET_HEADER_FUNCTION_TYPE),// wDescriptorType
Pawel Zarembski 0:01f31e923fe2 1747 0, // bFirstInterface USBD_WINUSB_IF_NUM
Pawel Zarembski 0:01f31e923fe2 1748 0, // bReserved
Pawel Zarembski 0:01f31e923fe2 1749 WBVAL(FUNCTION_SUBSET_LEN), // wSubsetLength
Pawel Zarembski 0:01f31e923fe2 1750 WBVAL(WINUSB_FEATURE_COMPATIBLE_ID_SIZE), // wLength
Pawel Zarembski 0:01f31e923fe2 1751 WBVAL(WINUSB_FEATURE_COMPATIBLE_ID_TYPE), // wDescriptorType
Pawel Zarembski 0:01f31e923fe2 1752 'W', 'I', 'N', 'U', 'S', 'B', 0, 0, // CompatibleId
Pawel Zarembski 0:01f31e923fe2 1753 0, 0, 0, 0, 0, 0, 0, 0, // SubCompatibleId
Pawel Zarembski 0:01f31e923fe2 1754 WBVAL(DEVICE_INTERFACE_GUIDS_FEATURE_LEN),// wLength
Pawel Zarembski 0:01f31e923fe2 1755 WBVAL(WINUSB_FEATURE_REG_PROPERTY_TYPE), // wDescriptorType
Pawel Zarembski 0:01f31e923fe2 1756 WBVAL(WINUSB_PROP_DATA_TYPE_REG_MULTI_SZ), // wPropertyDataType
Pawel Zarembski 0:01f31e923fe2 1757 WBVAL(42), // wPropertyNameLength
Pawel Zarembski 0:01f31e923fe2 1758 'D',0,'e',0,'v',0,'i',0,'c',0,'e',0,
Pawel Zarembski 0:01f31e923fe2 1759 'I',0,'n',0,'t',0,'e',0,'r',0,'f',0,'a',0,'c',0,'e',0,
Pawel Zarembski 0:01f31e923fe2 1760 'G',0,'U',0,'I',0,'D',0,'s',0,0,0,
Pawel Zarembski 0:01f31e923fe2 1761 WBVAL(80), // wPropertyDataLength
Pawel Zarembski 0:01f31e923fe2 1762 '{',0,
Pawel Zarembski 0:01f31e923fe2 1763 '9',0,'2',0,'C',0,'E',0,'6',0,'4',0,'6',0,'2',0,'-',0,
Pawel Zarembski 0:01f31e923fe2 1764 '9',0,'C',0,'7',0,'7',0,'-',0,
Pawel Zarembski 0:01f31e923fe2 1765 '4',0,'6',0,'F',0,'E',0,'-',0,
Pawel Zarembski 0:01f31e923fe2 1766 '9',0,'3',0,'3',0,'B',0,'-',
Pawel Zarembski 0:01f31e923fe2 1767 0,'3',0,'1',0,'C',0,'B',0,'9',0,'C',0,'5',0,'A',0,'A',0,'3',0,'B',0,'9',0,
Pawel Zarembski 0:01f31e923fe2 1768 '}',0,0,0,0,0,
Pawel Zarembski 0:01f31e923fe2 1769 #endif
Pawel Zarembski 0:01f31e923fe2 1770 #if (USBD_BULK_ENABLE)
Pawel Zarembski 0:01f31e923fe2 1771 WBVAL(WINUSB_FUNCTION_SUBSET_HEADER_SIZE),/* wLength */
Pawel Zarembski 0:01f31e923fe2 1772 WBVAL(WINUSB_SUBSET_HEADER_FUNCTION_TYPE),/* wDescriptorType */
Pawel Zarembski 0:01f31e923fe2 1773 0, /* bFirstInterface USBD_BULK_IF_NUM*/
Pawel Zarembski 0:01f31e923fe2 1774 0, /* bReserved */
Pawel Zarembski 0:01f31e923fe2 1775 WBVAL(FUNCTION_SUBSET_LEN), /* wSubsetLength */
Pawel Zarembski 0:01f31e923fe2 1776 WBVAL(WINUSB_FEATURE_COMPATIBLE_ID_SIZE), /* wLength */
Pawel Zarembski 0:01f31e923fe2 1777 WBVAL(WINUSB_FEATURE_COMPATIBLE_ID_TYPE), /* wDescriptorType */
Pawel Zarembski 0:01f31e923fe2 1778 'W', 'I', 'N', 'U', 'S', 'B', 0, 0, /* CompatibleId*/
Pawel Zarembski 0:01f31e923fe2 1779 0, 0, 0, 0, 0, 0, 0, 0, /* SubCompatibleId*/
Pawel Zarembski 0:01f31e923fe2 1780 WBVAL(DEVICE_INTERFACE_GUIDS_FEATURE_LEN),/* wLength */
Pawel Zarembski 0:01f31e923fe2 1781 WBVAL(WINUSB_FEATURE_REG_PROPERTY_TYPE), /* wDescriptorType */
Pawel Zarembski 0:01f31e923fe2 1782 WBVAL(WINUSB_PROP_DATA_TYPE_REG_MULTI_SZ), /* wPropertyDataType */
Pawel Zarembski 0:01f31e923fe2 1783 WBVAL(42), /* wPropertyNameLength */
Pawel Zarembski 0:01f31e923fe2 1784 'D',0,'e',0,'v',0,'i',0,'c',0,'e',0,
Pawel Zarembski 0:01f31e923fe2 1785 'I',0,'n',0,'t',0,'e',0,'r',0,'f',0,'a',0,'c',0,'e',0,
Pawel Zarembski 0:01f31e923fe2 1786 'G',0,'U',0,'I',0,'D',0,'s',0,0,0,
Pawel Zarembski 0:01f31e923fe2 1787 WBVAL(80), /* wPropertyDataLength */
Pawel Zarembski 0:01f31e923fe2 1788 '{',0,
Pawel Zarembski 0:01f31e923fe2 1789 'C',0,'D',0,'B',0,'3',0,'B',0,'5',0,'A',0,'D',0,'-',0,
Pawel Zarembski 0:01f31e923fe2 1790 '2',0,'9',0,'3',0,'B',0,'-',0,
Pawel Zarembski 0:01f31e923fe2 1791 '4',0,'6',0,'6',0,'3',0,'-',0,
Pawel Zarembski 0:01f31e923fe2 1792 'A',0,'A',0,'3',0,'6',0,'-',
Pawel Zarembski 0:01f31e923fe2 1793 0,'1',0,'A',0,'A',0,'E',0,'4',0,'6',0,'4',0,'6',0,'3',0,'7',0,'7',0,'6',0,
Pawel Zarembski 0:01f31e923fe2 1794 '}',0,0,0,0,0,
Pawel Zarembski 0:01f31e923fe2 1795 #endif
Pawel Zarembski 0:01f31e923fe2 1796 };
Pawel Zarembski 0:01f31e923fe2 1797
Pawel Zarembski 0:01f31e923fe2 1798 #else
Pawel Zarembski 0:01f31e923fe2 1799
Pawel Zarembski 0:01f31e923fe2 1800 const U8 USBD_WinUSBDescriptorSetDescriptor[] = { 0 };
Pawel Zarembski 0:01f31e923fe2 1801
Pawel Zarembski 0:01f31e923fe2 1802 BOOL USBD_EndPoint0_Setup_WinUSB_ReqToDevice(void)
Pawel Zarembski 0:01f31e923fe2 1803 {
Pawel Zarembski 0:01f31e923fe2 1804 return (__FALSE);
Pawel Zarembski 0:01f31e923fe2 1805 }
Pawel Zarembski 0:01f31e923fe2 1806
Pawel Zarembski 0:01f31e923fe2 1807 #endif
Pawel Zarembski 0:01f31e923fe2 1808
Pawel Zarembski 0:01f31e923fe2 1809 #if (USBD_BOS_ENABLE)
Pawel Zarembski 0:01f31e923fe2 1810
Pawel Zarembski 0:01f31e923fe2 1811 #define USBD_NUM_DEV_CAPABILITIES (USBD_WEBUSB_ENABLE + USBD_WINUSB_ENABLE)
Pawel Zarembski 0:01f31e923fe2 1812
Pawel Zarembski 0:01f31e923fe2 1813 #define USBD_WEBUSB_DESC_LEN (sizeof(WEBUSB_PLATFORM_CAPABILITY_DESCRIPTOR))
Pawel Zarembski 0:01f31e923fe2 1814
Pawel Zarembski 0:01f31e923fe2 1815 #define USBD_WINUSB_DESC_LEN (sizeof(WINUSB_PLATFORM_CAPABILITY_DESCRIPTOR))
Pawel Zarembski 0:01f31e923fe2 1816
Pawel Zarembski 0:01f31e923fe2 1817 #define USBD_BOS_WTOTALLENGTH (USB_BOS_DESC_SIZE + \
Pawel Zarembski 0:01f31e923fe2 1818 USBD_WEBUSB_DESC_LEN * USBD_WEBUSB_ENABLE + \
Pawel Zarembski 0:01f31e923fe2 1819 USBD_WINUSB_DESC_LEN * USBD_WINUSB_ENABLE)
Pawel Zarembski 0:01f31e923fe2 1820
Pawel Zarembski 0:01f31e923fe2 1821 __weak \
Pawel Zarembski 0:01f31e923fe2 1822 const U8 USBD_BinaryObjectStoreDescriptor[] = {
Pawel Zarembski 0:01f31e923fe2 1823 USB_BOS_DESC_SIZE, /* bLength */
Pawel Zarembski 0:01f31e923fe2 1824 USB_BINARY_OBJECT_STORE_DESCRIPTOR_TYPE,/* bDescriptorType */
Pawel Zarembski 0:01f31e923fe2 1825 WBVAL(USBD_BOS_WTOTALLENGTH), /* wTotalLength */
Pawel Zarembski 0:01f31e923fe2 1826 USBD_NUM_DEV_CAPABILITIES, /* bNumDeviceCaps */
Pawel Zarembski 0:01f31e923fe2 1827 #if (USBD_WEBUSB_ENABLE)
Pawel Zarembski 0:01f31e923fe2 1828 USBD_WEBUSB_DESC_LEN, /* bLength */
Pawel Zarembski 0:01f31e923fe2 1829 USB_DEVICE_CAPABILITY_DESCRIPTOR_TYPE, /* bDescriptorType */
Pawel Zarembski 0:01f31e923fe2 1830 USB_DEVICE_CAPABILITY_PLATFORM, /* bDevCapabilityType */
Pawel Zarembski 0:01f31e923fe2 1831 0x00, /* bReserved */
Pawel Zarembski 0:01f31e923fe2 1832 0x38, 0xB6, 0x08, 0x34, /* PlatformCapabilityUUID */
Pawel Zarembski 0:01f31e923fe2 1833 0xA9, 0x09, 0xA0, 0x47,
Pawel Zarembski 0:01f31e923fe2 1834 0x8B, 0xFD, 0xA0, 0x76,
Pawel Zarembski 0:01f31e923fe2 1835 0x88, 0x15, 0xB6, 0x65,
Pawel Zarembski 0:01f31e923fe2 1836 WBVAL(0x0100), /* 1.00 */ /* bcdVersion */
Pawel Zarembski 0:01f31e923fe2 1837 USBD_WEBUSB_VENDOR_CODE, /* bVendorCode */
Pawel Zarembski 0:01f31e923fe2 1838 0, /* iLandingPage */
Pawel Zarembski 0:01f31e923fe2 1839 #endif
Pawel Zarembski 0:01f31e923fe2 1840 #if (USBD_WINUSB_ENABLE)
Pawel Zarembski 0:01f31e923fe2 1841 USBD_WINUSB_DESC_LEN, /* bLength */
Pawel Zarembski 0:01f31e923fe2 1842 USB_DEVICE_CAPABILITY_DESCRIPTOR_TYPE, /* bDescriptorType */
Pawel Zarembski 0:01f31e923fe2 1843 USB_DEVICE_CAPABILITY_PLATFORM, /* bDevCapabilityType */
Pawel Zarembski 0:01f31e923fe2 1844 0x00, /* bReserved */
Pawel Zarembski 0:01f31e923fe2 1845 0xDF, 0x60, 0xDD, 0xD8, /* PlatformCapabilityUUID */
Pawel Zarembski 0:01f31e923fe2 1846 0x89, 0x45, 0xC7, 0x4C,
Pawel Zarembski 0:01f31e923fe2 1847 0x9C, 0xD2, 0x65, 0x9D,
Pawel Zarembski 0:01f31e923fe2 1848 0x9E, 0x64, 0x8A, 0x9F,
Pawel Zarembski 0:01f31e923fe2 1849 0x00, 0x00, 0x03, 0x06, /* >= Win 8.1 *//* dwWindowsVersion*/
Pawel Zarembski 0:01f31e923fe2 1850 WBVAL(USBD_WINUSB_DESC_SET_LEN), /* wDescriptorSetTotalLength */
Pawel Zarembski 0:01f31e923fe2 1851 USBD_WINUSB_VENDOR_CODE, /* bVendorCode */
Pawel Zarembski 0:01f31e923fe2 1852 0, /* bAltEnumCode */
Pawel Zarembski 0:01f31e923fe2 1853 #endif
Pawel Zarembski 0:01f31e923fe2 1854 };
Pawel Zarembski 0:01f31e923fe2 1855
Pawel Zarembski 0:01f31e923fe2 1856 #else
Pawel Zarembski 0:01f31e923fe2 1857 __weak \
Pawel Zarembski 0:01f31e923fe2 1858 const U8 USBD_BinaryObjectStoreDescriptor[] = { 0 };
Pawel Zarembski 0:01f31e923fe2 1859
Pawel Zarembski 0:01f31e923fe2 1860 #endif
Pawel Zarembski 0:01f31e923fe2 1861
Pawel Zarembski 0:01f31e923fe2 1862 #define HID_DESC \
Pawel Zarembski 0:01f31e923fe2 1863 /* Interface, Alternate Setting 0, HID Class */ \
Pawel Zarembski 0:01f31e923fe2 1864 USB_INTERFACE_DESC_SIZE, /* bLength */ \
Pawel Zarembski 0:01f31e923fe2 1865 USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */ \
Pawel Zarembski 0:01f31e923fe2 1866 0x00, /* bInterfaceNumber USBD_HID_IF_NUM*/ \
Pawel Zarembski 0:01f31e923fe2 1867 0x00, /* bAlternateSetting */ \
Pawel Zarembski 0:01f31e923fe2 1868 0x00+(USBD_HID_EP_INTIN != 0)+(USBD_HID_EP_INTOUT != 0), /*0x01+(USBD_HID_EP_INTOUT != 0),*/ /* bNumEndpoints */ \
Pawel Zarembski 0:01f31e923fe2 1869 USB_DEVICE_CLASS_HUMAN_INTERFACE, /* bInterfaceClass */ \
Pawel Zarembski 0:01f31e923fe2 1870 HID_SUBCLASS_NONE, /* bInterfaceSubClass */ \
Pawel Zarembski 0:01f31e923fe2 1871 HID_PROTOCOL_NONE, /* bInterfaceProtocol */ \
Pawel Zarembski 0:01f31e923fe2 1872 USBD_HID_IF_STR_NUM, /* iInterface */ \
Pawel Zarembski 0:01f31e923fe2 1873 \
Pawel Zarembski 0:01f31e923fe2 1874 /* HID Class Descriptor */ \
Pawel Zarembski 0:01f31e923fe2 1875 USB_HID_DESC_SIZE, /* bLength */ \
Pawel Zarembski 0:01f31e923fe2 1876 HID_HID_DESCRIPTOR_TYPE, /* bDescriptorType */ \
Pawel Zarembski 0:01f31e923fe2 1877 WBVAL(0x0100), /* 1.00 */ /* bcdHID */ \
Pawel Zarembski 0:01f31e923fe2 1878 0x00, /* bCountryCode */ \
Pawel Zarembski 0:01f31e923fe2 1879 0x01, /* bNumDescriptors */ \
Pawel Zarembski 0:01f31e923fe2 1880 HID_REPORT_DESCRIPTOR_TYPE, /* bDescriptorType */ \
Pawel Zarembski 0:01f31e923fe2 1881 WBVAL(USB_HID_REPORT_DESC_SIZE), /* wDescriptorLength */
Pawel Zarembski 0:01f31e923fe2 1882
Pawel Zarembski 0:01f31e923fe2 1883 #define VENDOR_DESC_IAD(first,num_of_ifs) /* Vendor: Interface Association Descriptor */ \
Pawel Zarembski 0:01f31e923fe2 1884 USB_INTERFACE_ASSOC_DESC_SIZE, /* bLength */ \
Pawel Zarembski 0:01f31e923fe2 1885 USB_INTERFACE_ASSOCIATION_DESCRIPTOR_TYPE, /* bDescriptorType */ \
Pawel Zarembski 0:01f31e923fe2 1886 (first), /* bFirstInterface */ \
Pawel Zarembski 0:01f31e923fe2 1887 (num_of_ifs), /* bInterfaceCount */ \
Pawel Zarembski 0:01f31e923fe2 1888 USB_DEVICE_CLASS_VENDOR_SPECIFIC, /* bFunctionClass */ \
Pawel Zarembski 0:01f31e923fe2 1889 0x00, /* bFunctionSubclass */ \
Pawel Zarembski 0:01f31e923fe2 1890 0x00, /* bFunctionProtocol */ \
Pawel Zarembski 0:01f31e923fe2 1891 0x00, /* iFunction */
Pawel Zarembski 0:01f31e923fe2 1892
Pawel Zarembski 0:01f31e923fe2 1893 #define WEBUSB_DESC \
Pawel Zarembski 0:01f31e923fe2 1894 /* Interface, Alternate Setting 0, VENDOR_SPECIFIC Class */ \
Pawel Zarembski 0:01f31e923fe2 1895 USB_INTERFACE_DESC_SIZE, /* bLength */ \
Pawel Zarembski 0:01f31e923fe2 1896 USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */ \
Pawel Zarembski 0:01f31e923fe2 1897 0x00, /* bInterfaceNumber USBD_WEBUSB_IF_NUM */ \
Pawel Zarembski 0:01f31e923fe2 1898 0x00, /* bAlternateSetting */ \
Pawel Zarembski 0:01f31e923fe2 1899 0x00, /* bNumEndpoints */ \
Pawel Zarembski 0:01f31e923fe2 1900 USB_DEVICE_CLASS_VENDOR_SPECIFIC, /* bInterfaceClass */ \
Pawel Zarembski 0:01f31e923fe2 1901 USB_DEVICE_CLASS_HUMAN_INTERFACE, /* bInterfaceSubClass */ \
Pawel Zarembski 0:01f31e923fe2 1902 HID_PROTOCOL_NONE, /* bInterfaceProtocol */ \
Pawel Zarembski 0:01f31e923fe2 1903 USBD_WEBUSB_IF_STR_NUM, /* iInterface */ \
Pawel Zarembski 0:01f31e923fe2 1904
Pawel Zarembski 0:01f31e923fe2 1905 #define HID_EP_IN /* HID Endpoint for Low-speed/Full-speed */ \
Pawel Zarembski 0:01f31e923fe2 1906 /* Endpoint, HID Interrupt In */ \
Pawel Zarembski 0:01f31e923fe2 1907 USB_ENDPOINT_DESC_SIZE, /* bLength */ \
Pawel Zarembski 0:01f31e923fe2 1908 USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */ \
Pawel Zarembski 0:01f31e923fe2 1909 USB_ENDPOINT_IN(USBD_HID_EP_INTIN), /* bEndpointAddress */ \
Pawel Zarembski 0:01f31e923fe2 1910 USB_ENDPOINT_TYPE_INTERRUPT, /* bmAttributes */ \
Pawel Zarembski 0:01f31e923fe2 1911 WBVAL(USBD_HID_WMAXPACKETSIZE), /* wMaxPacketSize */ \
Pawel Zarembski 0:01f31e923fe2 1912 USBD_HID_BINTERVAL, /* bInterval */
Pawel Zarembski 0:01f31e923fe2 1913
Pawel Zarembski 0:01f31e923fe2 1914 #define HID_EP_OUT /* HID Endpoint for Low-speed/Full-speed */ \
Pawel Zarembski 0:01f31e923fe2 1915 /* Endpoint, HID Interrupt Out */ \
Pawel Zarembski 0:01f31e923fe2 1916 USB_ENDPOINT_DESC_SIZE, /* bLength */ \
Pawel Zarembski 0:01f31e923fe2 1917 USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */ \
Pawel Zarembski 0:01f31e923fe2 1918 USB_ENDPOINT_OUT(USBD_HID_EP_INTOUT), /* bEndpointAddress */ \
Pawel Zarembski 0:01f31e923fe2 1919 USB_ENDPOINT_TYPE_INTERRUPT, /* bmAttributes */ \
Pawel Zarembski 0:01f31e923fe2 1920 WBVAL(USBD_HID_WMAXPACKETSIZE), /* wMaxPacketSize */ \
Pawel Zarembski 0:01f31e923fe2 1921 USBD_HID_BINTERVAL, /* bInterval */
Pawel Zarembski 0:01f31e923fe2 1922
Pawel Zarembski 0:01f31e923fe2 1923 #define HID_EP_INOUT /* HID Endpoint for Low-speed/Full-speed */ \
Pawel Zarembski 0:01f31e923fe2 1924 /* Endpoint, HID Interrupt In */ \
Pawel Zarembski 0:01f31e923fe2 1925 USB_ENDPOINT_DESC_SIZE, /* bLength */ \
Pawel Zarembski 0:01f31e923fe2 1926 USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */ \
Pawel Zarembski 0:01f31e923fe2 1927 USB_ENDPOINT_IN(USBD_HID_EP_INTIN), /* bEndpointAddress */ \
Pawel Zarembski 0:01f31e923fe2 1928 USB_ENDPOINT_TYPE_INTERRUPT, /* bmAttributes */ \
Pawel Zarembski 0:01f31e923fe2 1929 WBVAL(USBD_HID_WMAXPACKETSIZE), /* wMaxPacketSize */ \
Pawel Zarembski 0:01f31e923fe2 1930 USBD_HID_BINTERVAL, /* bInterval */ \
Pawel Zarembski 0:01f31e923fe2 1931 \
Pawel Zarembski 0:01f31e923fe2 1932 /* Endpoint, HID Interrupt Out */ \
Pawel Zarembski 0:01f31e923fe2 1933 USB_ENDPOINT_DESC_SIZE, /* bLength */ \
Pawel Zarembski 0:01f31e923fe2 1934 USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */ \
Pawel Zarembski 0:01f31e923fe2 1935 USB_ENDPOINT_OUT(USBD_HID_EP_INTOUT), /* bEndpointAddress */ \
Pawel Zarembski 0:01f31e923fe2 1936 USB_ENDPOINT_TYPE_INTERRUPT, /* bmAttributes */ \
Pawel Zarembski 0:01f31e923fe2 1937 WBVAL(USBD_HID_WMAXPACKETSIZE), /* wMaxPacketSize */ \
Pawel Zarembski 0:01f31e923fe2 1938 USBD_HID_BINTERVAL, /* bInterval */
Pawel Zarembski 0:01f31e923fe2 1939
Pawel Zarembski 0:01f31e923fe2 1940 #define HID_EP_IN_HS /* HID Endpoint for High-speed */ \
Pawel Zarembski 0:01f31e923fe2 1941 /* Endpoint, HID Interrupt In */ \
Pawel Zarembski 0:01f31e923fe2 1942 USB_ENDPOINT_DESC_SIZE, /* bLength */ \
Pawel Zarembski 0:01f31e923fe2 1943 USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */ \
Pawel Zarembski 0:01f31e923fe2 1944 USB_ENDPOINT_IN(USBD_HID_EP_INTIN), /* bEndpointAddress */ \
Pawel Zarembski 0:01f31e923fe2 1945 USB_ENDPOINT_TYPE_INTERRUPT, /* bmAttributes */ \
Pawel Zarembski 0:01f31e923fe2 1946 WBVAL(USBD_HID_HS_WMAXPACKETSIZE), /* wMaxPacketSize */ \
Pawel Zarembski 0:01f31e923fe2 1947 USBD_HID_HS_BINTERVAL, /* bInterval */
Pawel Zarembski 0:01f31e923fe2 1948
Pawel Zarembski 0:01f31e923fe2 1949 #define HID_EP_OUT_HS /* HID Endpoint for High-speed */ \
Pawel Zarembski 0:01f31e923fe2 1950 /* Endpoint, HID Interrupt Out */ \
Pawel Zarembski 0:01f31e923fe2 1951 USB_ENDPOINT_DESC_SIZE, /* bLength */ \
Pawel Zarembski 0:01f31e923fe2 1952 USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */ \
Pawel Zarembski 0:01f31e923fe2 1953 USB_ENDPOINT_OUT(USBD_HID_EP_INTOUT), /* bEndpointAddress */ \
Pawel Zarembski 0:01f31e923fe2 1954 USB_ENDPOINT_TYPE_INTERRUPT, /* bmAttributes */ \
Pawel Zarembski 0:01f31e923fe2 1955 WBVAL(USBD_HID_HS_WMAXPACKETSIZE), /* wMaxPacketSize */ \
Pawel Zarembski 0:01f31e923fe2 1956 USBD_HID_HS_BINTERVAL, /* bInterval */
Pawel Zarembski 0:01f31e923fe2 1957
Pawel Zarembski 0:01f31e923fe2 1958 #define HID_EP_INOUT_HS /* HID Endpoint for High-speed */ \
Pawel Zarembski 0:01f31e923fe2 1959 /* Endpoint, HID Interrupt In */ \
Pawel Zarembski 0:01f31e923fe2 1960 USB_ENDPOINT_DESC_SIZE, /* bLength */ \
Pawel Zarembski 0:01f31e923fe2 1961 USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */ \
Pawel Zarembski 0:01f31e923fe2 1962 USB_ENDPOINT_IN(USBD_HID_EP_INTIN), /* bEndpointAddress */ \
Pawel Zarembski 0:01f31e923fe2 1963 USB_ENDPOINT_TYPE_INTERRUPT, /* bmAttributes */ \
Pawel Zarembski 0:01f31e923fe2 1964 WBVAL(USBD_HID_HS_WMAXPACKETSIZE), /* wMaxPacketSize */ \
Pawel Zarembski 0:01f31e923fe2 1965 USBD_HID_HS_BINTERVAL, /* bInterval */ \
Pawel Zarembski 0:01f31e923fe2 1966 \
Pawel Zarembski 0:01f31e923fe2 1967 /* Endpoint, HID Interrupt Out */ \
Pawel Zarembski 0:01f31e923fe2 1968 USB_ENDPOINT_DESC_SIZE, /* bLength */ \
Pawel Zarembski 0:01f31e923fe2 1969 USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */ \
Pawel Zarembski 0:01f31e923fe2 1970 USB_ENDPOINT_OUT(USBD_HID_EP_INTOUT), /* bEndpointAddress */ \
Pawel Zarembski 0:01f31e923fe2 1971 USB_ENDPOINT_TYPE_INTERRUPT, /* bmAttributes */ \
Pawel Zarembski 0:01f31e923fe2 1972 WBVAL(USBD_HID_HS_WMAXPACKETSIZE), /* wMaxPacketSize */ \
Pawel Zarembski 0:01f31e923fe2 1973 USBD_HID_HS_BINTERVAL, /* bInterval */
Pawel Zarembski 0:01f31e923fe2 1974
Pawel Zarembski 0:01f31e923fe2 1975 #define MSC_DESC \
Pawel Zarembski 0:01f31e923fe2 1976 /* Interface, Alternate Setting 0, MSC Class */ \
Pawel Zarembski 0:01f31e923fe2 1977 USB_INTERFACE_DESC_SIZE, /* bLength */ \
Pawel Zarembski 0:01f31e923fe2 1978 USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */ \
Pawel Zarembski 0:01f31e923fe2 1979 0x00, /* bInterfaceNumber USBD_MSC_IF_NUM*/ \
Pawel Zarembski 0:01f31e923fe2 1980 0x00, /* bAlternateSetting */ \
Pawel Zarembski 0:01f31e923fe2 1981 0x02, /* bNumEndpoints */ \
Pawel Zarembski 0:01f31e923fe2 1982 USB_DEVICE_CLASS_STORAGE, /* bInterfaceClass */ \
Pawel Zarembski 0:01f31e923fe2 1983 MSC_SUBCLASS_SCSI, /* bInterfaceSubClass */ \
Pawel Zarembski 0:01f31e923fe2 1984 MSC_PROTOCOL_BULK_ONLY, /* bInterfaceProtocol */ \
Pawel Zarembski 0:01f31e923fe2 1985 USBD_MSC_IF_STR_NUM, /* iInterface */
Pawel Zarembski 0:01f31e923fe2 1986
Pawel Zarembski 0:01f31e923fe2 1987 #define MSC_EP /* MSC Endpoints for Low-speed/Full-speed */ \
Pawel Zarembski 0:01f31e923fe2 1988 /* Endpoint, EP Bulk IN */ \
Pawel Zarembski 0:01f31e923fe2 1989 USB_ENDPOINT_DESC_SIZE, /* bLength */ \
Pawel Zarembski 0:01f31e923fe2 1990 USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */ \
Pawel Zarembski 0:01f31e923fe2 1991 USB_ENDPOINT_IN(USBD_MSC_EP_BULKIN), /* bEndpointAddress */ \
Pawel Zarembski 0:01f31e923fe2 1992 USB_ENDPOINT_TYPE_BULK, /* bmAttributes */ \
Pawel Zarembski 0:01f31e923fe2 1993 WBVAL(USBD_MSC_WMAXPACKETSIZE), /* wMaxPacketSize */ \
Pawel Zarembski 0:01f31e923fe2 1994 0x00, /* bInterval: ignore for Bulk transfer */ \
Pawel Zarembski 0:01f31e923fe2 1995 \
Pawel Zarembski 0:01f31e923fe2 1996 /* Endpoint, EP Bulk OUT */ \
Pawel Zarembski 0:01f31e923fe2 1997 USB_ENDPOINT_DESC_SIZE, /* bLength */ \
Pawel Zarembski 0:01f31e923fe2 1998 USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */ \
Pawel Zarembski 0:01f31e923fe2 1999 USB_ENDPOINT_OUT(USBD_MSC_EP_BULKOUT),/* bEndpointAddress */ \
Pawel Zarembski 0:01f31e923fe2 2000 USB_ENDPOINT_TYPE_BULK, /* bmAttributes */ \
Pawel Zarembski 0:01f31e923fe2 2001 WBVAL(USBD_MSC_WMAXPACKETSIZE), /* wMaxPacketSize */ \
Pawel Zarembski 0:01f31e923fe2 2002 0x00, /* bInterval: ignore for Bulk transfer */
Pawel Zarembski 0:01f31e923fe2 2003
Pawel Zarembski 0:01f31e923fe2 2004 #define MSC_EP_HS /* MSC Endpoints for High-speed */ \
Pawel Zarembski 0:01f31e923fe2 2005 /* Endpoint, EP Bulk IN */ \
Pawel Zarembski 0:01f31e923fe2 2006 USB_ENDPOINT_DESC_SIZE, /* bLength */ \
Pawel Zarembski 0:01f31e923fe2 2007 USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */ \
Pawel Zarembski 0:01f31e923fe2 2008 USB_ENDPOINT_IN(USBD_MSC_EP_BULKIN), /* bEndpointAddress */ \
Pawel Zarembski 0:01f31e923fe2 2009 USB_ENDPOINT_TYPE_BULK, /* bmAttributes */ \
Pawel Zarembski 0:01f31e923fe2 2010 WBVAL(USBD_MSC_HS_WMAXPACKETSIZE), /* wMaxPacketSize */ \
Pawel Zarembski 0:01f31e923fe2 2011 USBD_MSC_HS_BINTERVAL, /* bInterval */ \
Pawel Zarembski 0:01f31e923fe2 2012 \
Pawel Zarembski 0:01f31e923fe2 2013 /* Endpoint, EP Bulk OUT */ \
Pawel Zarembski 0:01f31e923fe2 2014 USB_ENDPOINT_DESC_SIZE, /* bLength */ \
Pawel Zarembski 0:01f31e923fe2 2015 USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */ \
Pawel Zarembski 0:01f31e923fe2 2016 USB_ENDPOINT_OUT(USBD_MSC_EP_BULKOUT),/* bEndpointAddress */ \
Pawel Zarembski 0:01f31e923fe2 2017 USB_ENDPOINT_TYPE_BULK, /* bmAttributes */ \
Pawel Zarembski 0:01f31e923fe2 2018 WBVAL(USBD_MSC_HS_WMAXPACKETSIZE), /* wMaxPacketSize */ \
Pawel Zarembski 0:01f31e923fe2 2019 USBD_MSC_HS_BINTERVAL, /* bInterval */
Pawel Zarembski 0:01f31e923fe2 2020
Pawel Zarembski 0:01f31e923fe2 2021 #define BULK_DESC \
Pawel Zarembski 0:01f31e923fe2 2022 /* Interface, Alternate Setting 0, MSC Class */ \
Pawel Zarembski 0:01f31e923fe2 2023 USB_INTERFACE_DESC_SIZE, /* bLength */ \
Pawel Zarembski 0:01f31e923fe2 2024 USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */ \
Pawel Zarembski 0:01f31e923fe2 2025 0x00, /* bInterfaceNumber USBD_BULK_IF_NUM*/ \
Pawel Zarembski 0:01f31e923fe2 2026 0x00, /* bAlternateSetting */ \
Pawel Zarembski 0:01f31e923fe2 2027 0x02, /* bNumEndpoints */ \
Pawel Zarembski 0:01f31e923fe2 2028 USB_DEVICE_CLASS_VENDOR_SPECIFIC, /* bInterfaceClass */ \
Pawel Zarembski 0:01f31e923fe2 2029 0x00, /* bInterfaceSubClass */ \
Pawel Zarembski 0:01f31e923fe2 2030 0x00, /* bInterfaceProtocol */ \
Pawel Zarembski 0:01f31e923fe2 2031 USBD_BULK_IF_STR_NUM, /* iInterface */
Pawel Zarembski 0:01f31e923fe2 2032
Pawel Zarembski 0:01f31e923fe2 2033 #define BULK_EP /* MSC Endpoints for Low-speed/Full-speed */ \
Pawel Zarembski 0:01f31e923fe2 2034 /* Endpoint, EP Bulk OUT */ \
Pawel Zarembski 0:01f31e923fe2 2035 USB_ENDPOINT_DESC_SIZE, /* bLength */ \
Pawel Zarembski 0:01f31e923fe2 2036 USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */ \
Pawel Zarembski 0:01f31e923fe2 2037 USB_ENDPOINT_OUT(USBD_BULK_EP_BULKOUT),/* bEndpointAddress */ \
Pawel Zarembski 0:01f31e923fe2 2038 USB_ENDPOINT_TYPE_BULK, /* bmAttributes */ \
Pawel Zarembski 0:01f31e923fe2 2039 WBVAL(USBD_BULK_WMAXPACKETSIZE), /* wMaxPacketSize */ \
Pawel Zarembski 0:01f31e923fe2 2040 0x00, /* bInterval: ignore for Bulk transfer */ \
Pawel Zarembski 0:01f31e923fe2 2041 \
Pawel Zarembski 0:01f31e923fe2 2042 /* Endpoint, EP Bulk IN */ \
Pawel Zarembski 0:01f31e923fe2 2043 USB_ENDPOINT_DESC_SIZE, /* bLength */ \
Pawel Zarembski 0:01f31e923fe2 2044 USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */ \
Pawel Zarembski 0:01f31e923fe2 2045 USB_ENDPOINT_IN(USBD_BULK_EP_BULKIN), /* bEndpointAddress */ \
Pawel Zarembski 0:01f31e923fe2 2046 USB_ENDPOINT_TYPE_BULK, /* bmAttributes */ \
Pawel Zarembski 0:01f31e923fe2 2047 WBVAL(USBD_BULK_WMAXPACKETSIZE), /* wMaxPacketSize */ \
Pawel Zarembski 0:01f31e923fe2 2048 0x00, /* bInterval: ignore for Bulk transfer */
Pawel Zarembski 0:01f31e923fe2 2049
Pawel Zarembski 0:01f31e923fe2 2050 #define BULK_EP_HS /* MSC Endpoints for Low-speed/Full-speed */ \
Pawel Zarembski 0:01f31e923fe2 2051 /* Endpoint, EP Bulk OUT */ \
Pawel Zarembski 0:01f31e923fe2 2052 USB_ENDPOINT_DESC_SIZE, /* bLength */ \
Pawel Zarembski 0:01f31e923fe2 2053 USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */ \
Pawel Zarembski 0:01f31e923fe2 2054 USB_ENDPOINT_OUT(USBD_BULK_EP_BULKOUT), /* bEndpointAddress */ \
Pawel Zarembski 0:01f31e923fe2 2055 USB_ENDPOINT_TYPE_BULK, /* bmAttributes */ \
Pawel Zarembski 0:01f31e923fe2 2056 WBVAL(USBD_BULK_HS_WMAXPACKETSIZE), /* wMaxPacketSize */ \
Pawel Zarembski 0:01f31e923fe2 2057 0x00, /* bInterval: ignore for Bulk transfer */ \
Pawel Zarembski 0:01f31e923fe2 2058 \
Pawel Zarembski 0:01f31e923fe2 2059 /* Endpoint, EP Bulk IN */ \
Pawel Zarembski 0:01f31e923fe2 2060 USB_ENDPOINT_DESC_SIZE, /* bLength */ \
Pawel Zarembski 0:01f31e923fe2 2061 USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */ \
Pawel Zarembski 0:01f31e923fe2 2062 USB_ENDPOINT_IN(USBD_BULK_EP_BULKIN),/* bEndpointAddress */ \
Pawel Zarembski 0:01f31e923fe2 2063 USB_ENDPOINT_TYPE_BULK, /* bmAttributes */ \
Pawel Zarembski 0:01f31e923fe2 2064 WBVAL(USBD_BULK_HS_WMAXPACKETSIZE), /* wMaxPacketSize */ \
Pawel Zarembski 0:01f31e923fe2 2065 0x00, /* bInterval: ignore for Bulk transfer */
Pawel Zarembski 0:01f31e923fe2 2066
Pawel Zarembski 0:01f31e923fe2 2067 #define ADC_DESC_IAD(first,num_of_ifs) /* ADC: Interface Association Descriptor */ \
Pawel Zarembski 0:01f31e923fe2 2068 USB_INTERFACE_ASSOC_DESC_SIZE, /* bLength */ \
Pawel Zarembski 0:01f31e923fe2 2069 USB_INTERFACE_ASSOCIATION_DESCRIPTOR_TYPE, /* bDescriptorType */ \
Pawel Zarembski 0:01f31e923fe2 2070 (first), /* bFirstInterface */ \
Pawel Zarembski 0:01f31e923fe2 2071 (num_of_ifs), /* bInterfaceCount */ \
Pawel Zarembski 0:01f31e923fe2 2072 USB_DEVICE_CLASS_AUDIO, /* bFunctionClass */ \
Pawel Zarembski 0:01f31e923fe2 2073 AUDIO_SUBCLASS_AUDIOCONTROL, /* bFunctionSubclass */ \
Pawel Zarembski 0:01f31e923fe2 2074 AUDIO_PROTOCOL_UNDEFINED, /* bFunctionProtocol */ \
Pawel Zarembski 0:01f31e923fe2 2075 USBD_ADC_CIF_STR_NUM, /* iFunction */ \
Pawel Zarembski 0:01f31e923fe2 2076
Pawel Zarembski 0:01f31e923fe2 2077 #define ADC_DESC \
Pawel Zarembski 0:01f31e923fe2 2078 /* Interface, Alternate Setting 0, Audio Control */ \
Pawel Zarembski 0:01f31e923fe2 2079 USB_INTERFACE_DESC_SIZE, /* bLength */ \
Pawel Zarembski 0:01f31e923fe2 2080 USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */ \
Pawel Zarembski 0:01f31e923fe2 2081 USBD_ADC_CIF_NUM, /* bInterfaceNumber */ \
Pawel Zarembski 0:01f31e923fe2 2082 0x00, /* bAlternateSetting */ \
Pawel Zarembski 0:01f31e923fe2 2083 0x00, /* bNumEndpoints */ \
Pawel Zarembski 0:01f31e923fe2 2084 USB_DEVICE_CLASS_AUDIO, /* bInterfaceClass */ \
Pawel Zarembski 0:01f31e923fe2 2085 AUDIO_SUBCLASS_AUDIOCONTROL, /* bInterfaceSubClass */ \
Pawel Zarembski 0:01f31e923fe2 2086 AUDIO_PROTOCOL_UNDEFINED, /* bInterfaceProtocol */ \
Pawel Zarembski 0:01f31e923fe2 2087 USBD_ADC_CIF_STR_NUM, /* iInterface */ \
Pawel Zarembski 0:01f31e923fe2 2088 /* Audio Control Interface */ \
Pawel Zarembski 0:01f31e923fe2 2089 AUDIO_CONTROL_INTERFACE_DESC_SZ(1), /* bLength */ \
Pawel Zarembski 0:01f31e923fe2 2090 AUDIO_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */ \
Pawel Zarembski 0:01f31e923fe2 2091 AUDIO_CONTROL_HEADER, /* bDescriptorSubtype */ \
Pawel Zarembski 0:01f31e923fe2 2092 WBVAL(0x0100), /* 1.00 */ /* bcdADC */ \
Pawel Zarembski 0:01f31e923fe2 2093 WBVAL( /* wTotalLength */ \
Pawel Zarembski 0:01f31e923fe2 2094 AUDIO_CONTROL_INTERFACE_DESC_SZ(1) + \
Pawel Zarembski 0:01f31e923fe2 2095 AUDIO_INPUT_TERMINAL_DESC_SIZE + \
Pawel Zarembski 0:01f31e923fe2 2096 AUDIO_FEATURE_UNIT_DESC_SZ(1,1) + \
Pawel Zarembski 0:01f31e923fe2 2097 AUDIO_OUTPUT_TERMINAL_DESC_SIZE \
Pawel Zarembski 0:01f31e923fe2 2098 ), \
Pawel Zarembski 0:01f31e923fe2 2099 0x01, /* bInCollection */ \
Pawel Zarembski 0:01f31e923fe2 2100 0x01, /* baInterfaceNr */ \
Pawel Zarembski 0:01f31e923fe2 2101 \
Pawel Zarembski 0:01f31e923fe2 2102 /* Audio Input Terminal */ \
Pawel Zarembski 0:01f31e923fe2 2103 AUDIO_INPUT_TERMINAL_DESC_SIZE, /* bLength */ \
Pawel Zarembski 0:01f31e923fe2 2104 AUDIO_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */ \
Pawel Zarembski 0:01f31e923fe2 2105 AUDIO_CONTROL_INPUT_TERMINAL, /* bDescriptorSubtype */ \
Pawel Zarembski 0:01f31e923fe2 2106 0x01, /* bTerminalID */ \
Pawel Zarembski 0:01f31e923fe2 2107 WBVAL(AUDIO_TERMINAL_USB_STREAMING), /* wTerminalType */ \
Pawel Zarembski 0:01f31e923fe2 2108 0x00, /* bAssocTerminal */ \
Pawel Zarembski 0:01f31e923fe2 2109 0x01, /* bNrChannels */ \
Pawel Zarembski 0:01f31e923fe2 2110 WBVAL(AUDIO_CHANNEL_M), /* wChannelConfig */ \
Pawel Zarembski 0:01f31e923fe2 2111 0x00, /* iChannelNames */ \
Pawel Zarembski 0:01f31e923fe2 2112 0x00, /* iTerminal */ \
Pawel Zarembski 0:01f31e923fe2 2113 \
Pawel Zarembski 0:01f31e923fe2 2114 /* Audio Feature Unit */ \
Pawel Zarembski 0:01f31e923fe2 2115 AUDIO_FEATURE_UNIT_DESC_SZ(1,1), /* bLength */ \
Pawel Zarembski 0:01f31e923fe2 2116 AUDIO_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */ \
Pawel Zarembski 0:01f31e923fe2 2117 AUDIO_CONTROL_FEATURE_UNIT, /* bDescriptorSubtype */ \
Pawel Zarembski 0:01f31e923fe2 2118 0x02, /* bUnitID */ \
Pawel Zarembski 0:01f31e923fe2 2119 0x01, /* bSourceID */ \
Pawel Zarembski 0:01f31e923fe2 2120 0x01, /* bControlSize */ \
Pawel Zarembski 0:01f31e923fe2 2121 AUDIO_CONTROL_MUTE | \
Pawel Zarembski 0:01f31e923fe2 2122 AUDIO_CONTROL_VOLUME, /* bmaControls(0) */ \
Pawel Zarembski 0:01f31e923fe2 2123 0x00, /* bmaControls(1) */ \
Pawel Zarembski 0:01f31e923fe2 2124 0x00, /* iTerminal */ \
Pawel Zarembski 0:01f31e923fe2 2125 \
Pawel Zarembski 0:01f31e923fe2 2126 /* Audio Output Terminal */ \
Pawel Zarembski 0:01f31e923fe2 2127 AUDIO_OUTPUT_TERMINAL_DESC_SIZE, /* bLength */ \
Pawel Zarembski 0:01f31e923fe2 2128 AUDIO_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */ \
Pawel Zarembski 0:01f31e923fe2 2129 AUDIO_CONTROL_OUTPUT_TERMINAL, /* bDescriptorSubtype */ \
Pawel Zarembski 0:01f31e923fe2 2130 0x03, /* bTerminalID */ \
Pawel Zarembski 0:01f31e923fe2 2131 WBVAL(AUDIO_TERMINAL_SPEAKER), /* wTerminalType */ \
Pawel Zarembski 0:01f31e923fe2 2132 0x00, /* bAssocTerminal */ \
Pawel Zarembski 0:01f31e923fe2 2133 0x02, /* bSourceID */ \
Pawel Zarembski 0:01f31e923fe2 2134 0x00, /* iTerminal */ \
Pawel Zarembski 0:01f31e923fe2 2135 \
Pawel Zarembski 0:01f31e923fe2 2136 /* Interface, Alternate Setting 0, Audio Streaming - Zero Bandwith */ \
Pawel Zarembski 0:01f31e923fe2 2137 USB_INTERFACE_DESC_SIZE, /* bLength */ \
Pawel Zarembski 0:01f31e923fe2 2138 USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */ \
Pawel Zarembski 0:01f31e923fe2 2139 USBD_ADC_SIF1_NUM, /* bInterfaceNumber */ \
Pawel Zarembski 0:01f31e923fe2 2140 0x00, /* bAlternateSetting */ \
Pawel Zarembski 0:01f31e923fe2 2141 0x00, /* bNumEndpoints */ \
Pawel Zarembski 0:01f31e923fe2 2142 USB_DEVICE_CLASS_AUDIO, /* bInterfaceClass */ \
Pawel Zarembski 0:01f31e923fe2 2143 AUDIO_SUBCLASS_AUDIOSTREAMING, /* bInterfaceSubClass */ \
Pawel Zarembski 0:01f31e923fe2 2144 AUDIO_PROTOCOL_UNDEFINED, /* bInterfaceProtocol */ \
Pawel Zarembski 0:01f31e923fe2 2145 USBD_ADC_SIF1_STR_NUM, /* iInterface */ \
Pawel Zarembski 0:01f31e923fe2 2146 \
Pawel Zarembski 0:01f31e923fe2 2147 /* Interface, Alternate Setting 1, Audio Streaming - Operational */ \
Pawel Zarembski 0:01f31e923fe2 2148 USB_INTERFACE_DESC_SIZE, /* bLength */ \
Pawel Zarembski 0:01f31e923fe2 2149 USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */ \
Pawel Zarembski 0:01f31e923fe2 2150 USBD_ADC_SIF1_NUM, /* bInterfaceNumber */ \
Pawel Zarembski 0:01f31e923fe2 2151 0x01, /* bAlternateSetting */ \
Pawel Zarembski 0:01f31e923fe2 2152 0x01, /* bNumEndpoints */ \
Pawel Zarembski 0:01f31e923fe2 2153 USB_DEVICE_CLASS_AUDIO, /* bInterfaceClass */ \
Pawel Zarembski 0:01f31e923fe2 2154 AUDIO_SUBCLASS_AUDIOSTREAMING, /* bInterfaceSubClass */ \
Pawel Zarembski 0:01f31e923fe2 2155 AUDIO_PROTOCOL_UNDEFINED, /* bInterfaceProtocol */ \
Pawel Zarembski 0:01f31e923fe2 2156 USBD_ADC_SIF2_STR_NUM, /* iInterface */ \
Pawel Zarembski 0:01f31e923fe2 2157 \
Pawel Zarembski 0:01f31e923fe2 2158 /* Audio Streaming Interface */ \
Pawel Zarembski 0:01f31e923fe2 2159 AUDIO_STREAMING_INTERFACE_DESC_SIZE, /* bLength */ \
Pawel Zarembski 0:01f31e923fe2 2160 AUDIO_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */ \
Pawel Zarembski 0:01f31e923fe2 2161 AUDIO_STREAMING_GENERAL, /* bDescriptorSubtype */ \
Pawel Zarembski 0:01f31e923fe2 2162 0x01, /* bTerminalLink */ \
Pawel Zarembski 0:01f31e923fe2 2163 0x01, /* bDelay */ \
Pawel Zarembski 0:01f31e923fe2 2164 WBVAL(AUDIO_FORMAT_PCM), /* wFormatTag */ \
Pawel Zarembski 0:01f31e923fe2 2165 \
Pawel Zarembski 0:01f31e923fe2 2166 /* Audio Type I Format */ \
Pawel Zarembski 0:01f31e923fe2 2167 AUDIO_FORMAT_TYPE_I_DESC_SZ(1), /* bLength */ \
Pawel Zarembski 0:01f31e923fe2 2168 AUDIO_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */ \
Pawel Zarembski 0:01f31e923fe2 2169 AUDIO_STREAMING_FORMAT_TYPE, /* bDescriptorSubtype */ \
Pawel Zarembski 0:01f31e923fe2 2170 AUDIO_FORMAT_TYPE_I, /* bFormatType */ \
Pawel Zarembski 0:01f31e923fe2 2171 0x01, /* bNrChannels */ \
Pawel Zarembski 0:01f31e923fe2 2172 USBD_ADC_BSUBFRAMESIZE, /* bSubFrameSize */ \
Pawel Zarembski 0:01f31e923fe2 2173 USBD_ADC_BBITRESOLUTION, /* bBitResolution */ \
Pawel Zarembski 0:01f31e923fe2 2174 0x01, /* bSamFreqType */ \
Pawel Zarembski 0:01f31e923fe2 2175 B3VAL(USBD_ADC_TSAMFREQ), /* tSamFreq */
Pawel Zarembski 0:01f31e923fe2 2176
Pawel Zarembski 0:01f31e923fe2 2177 #define ADC_EP /* ADC Endpoints for Low-speed/Full-speed */ \
Pawel Zarembski 0:01f31e923fe2 2178 /* Endpoint, EP ISO OUT - Standard Descriptor */ \
Pawel Zarembski 0:01f31e923fe2 2179 AUDIO_STANDARD_ENDPOINT_DESC_SIZE, /* bLength */ \
Pawel Zarembski 0:01f31e923fe2 2180 USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */ \
Pawel Zarembski 0:01f31e923fe2 2181 USB_ENDPOINT_OUT(USBD_ADC_EP_ISOOUT), /* bEndpointAddress */ \
Pawel Zarembski 0:01f31e923fe2 2182 USB_ENDPOINT_TYPE_ISOCHRONOUS, /* bmAttributes */ \
Pawel Zarembski 0:01f31e923fe2 2183 WBVAL(USBD_ADC_WMAXPACKETSIZE), /* wMaxPacketSize */ \
Pawel Zarembski 0:01f31e923fe2 2184 USBD_ADC_BINTERVAL, /* bInterval */ \
Pawel Zarembski 0:01f31e923fe2 2185 0x00, /* bRefresh */ \
Pawel Zarembski 0:01f31e923fe2 2186 0x00, /* bSynchAddress */ \
Pawel Zarembski 0:01f31e923fe2 2187 \
Pawel Zarembski 0:01f31e923fe2 2188 /* Endpoint - Audio Streaming */ \
Pawel Zarembski 0:01f31e923fe2 2189 AUDIO_STREAMING_ENDPOINT_DESC_SIZE, /* bLength */ \
Pawel Zarembski 0:01f31e923fe2 2190 AUDIO_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */ \
Pawel Zarembski 0:01f31e923fe2 2191 AUDIO_ENDPOINT_GENERAL, /* bDescriptor */ \
Pawel Zarembski 0:01f31e923fe2 2192 0x00, /* bmAttributes */ \
Pawel Zarembski 0:01f31e923fe2 2193 0x00, /* bLockDelayUnits */ \
Pawel Zarembski 0:01f31e923fe2 2194 WBVAL(0x0000), /* wLockDelay */
Pawel Zarembski 0:01f31e923fe2 2195
Pawel Zarembski 0:01f31e923fe2 2196 #define ADC_EP_HS /* ADC Endpoints for High-speed */ \
Pawel Zarembski 0:01f31e923fe2 2197 /* Endpoint, EP ISO OUT - Standard Descriptor */ \
Pawel Zarembski 0:01f31e923fe2 2198 AUDIO_STANDARD_ENDPOINT_DESC_SIZE, /* bLength */ \
Pawel Zarembski 0:01f31e923fe2 2199 USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */ \
Pawel Zarembski 0:01f31e923fe2 2200 USB_ENDPOINT_OUT(USBD_ADC_EP_ISOOUT), /* bEndpointAddress */ \
Pawel Zarembski 0:01f31e923fe2 2201 USB_ENDPOINT_TYPE_ISOCHRONOUS, /* bmAttributes */ \
Pawel Zarembski 0:01f31e923fe2 2202 WBVAL(USBD_ADC_HS_WMAXPACKETSIZE), /* wMaxPacketSize */ \
Pawel Zarembski 0:01f31e923fe2 2203 USBD_ADC_BINTERVAL, /* bInterval */ \
Pawel Zarembski 0:01f31e923fe2 2204 0x00, /* bRefresh */ \
Pawel Zarembski 0:01f31e923fe2 2205 0x00, /* bSynchAddress */ \
Pawel Zarembski 0:01f31e923fe2 2206 \
Pawel Zarembski 0:01f31e923fe2 2207 /* Endpoint - Audio Streaming */ \
Pawel Zarembski 0:01f31e923fe2 2208 AUDIO_STREAMING_ENDPOINT_DESC_SIZE, /* bLength */ \
Pawel Zarembski 0:01f31e923fe2 2209 AUDIO_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */ \
Pawel Zarembski 0:01f31e923fe2 2210 AUDIO_ENDPOINT_GENERAL, /* bDescriptor */ \
Pawel Zarembski 0:01f31e923fe2 2211 0x00, /* bmAttributes */ \
Pawel Zarembski 0:01f31e923fe2 2212 0x00, /* bLockDelayUnits */ \
Pawel Zarembski 0:01f31e923fe2 2213 WBVAL(0x0000), /* wLockDelay */
Pawel Zarembski 0:01f31e923fe2 2214
Pawel Zarembski 0:01f31e923fe2 2215 #define CDC_ACM_DESC_IAD(first,num_of_ifs) /* CDC: Interface Association Descriptor */ \
Pawel Zarembski 0:01f31e923fe2 2216 USB_INTERFACE_ASSOC_DESC_SIZE, /* bLength */ \
Pawel Zarembski 0:01f31e923fe2 2217 USB_INTERFACE_ASSOCIATION_DESCRIPTOR_TYPE, /* bDescriptorType */ \
Pawel Zarembski 0:01f31e923fe2 2218 (first), /* bFirstInterface */ \
Pawel Zarembski 0:01f31e923fe2 2219 (num_of_ifs), /* bInterfaceCount */ \
Pawel Zarembski 0:01f31e923fe2 2220 CDC_COMMUNICATION_INTERFACE_CLASS, /* bFunctionClass (Communication Class) */ \
Pawel Zarembski 0:01f31e923fe2 2221 CDC_ABSTRACT_CONTROL_MODEL, /* bFunctionSubclass (Abstract Control Model) */ \
Pawel Zarembski 0:01f31e923fe2 2222 0x01, /* bFunctionProtocol (V.25ter, Common AT commands) */ \
Pawel Zarembski 0:01f31e923fe2 2223 USBD_CDC_ACM_CIF_STR_NUM, /* iFunction */ \
Pawel Zarembski 0:01f31e923fe2 2224
Pawel Zarembski 0:01f31e923fe2 2225 #define CDC_ACM_DESC_IF0 \
Pawel Zarembski 0:01f31e923fe2 2226 /* Interface, Alternate Setting 0, CDC Class */ \
Pawel Zarembski 0:01f31e923fe2 2227 USB_INTERFACE_DESC_SIZE, /* bLength */ \
Pawel Zarembski 0:01f31e923fe2 2228 USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */ \
Pawel Zarembski 0:01f31e923fe2 2229 0x00, /* bInterfaceNumber: Number of Interface USBD_CDC_ACM_CIF_NUM*/ \
Pawel Zarembski 0:01f31e923fe2 2230 0x00, /* bAlternateSetting: Alternate setting */ \
Pawel Zarembski 0:01f31e923fe2 2231 0x01, /* bNumEndpoints: One endpoint used */ \
Pawel Zarembski 0:01f31e923fe2 2232 CDC_COMMUNICATION_INTERFACE_CLASS, /* bInterfaceClass: Communication Interface Class */ \
Pawel Zarembski 0:01f31e923fe2 2233 CDC_ABSTRACT_CONTROL_MODEL, /* bInterfaceSubClass: Abstract Control Model */ \
Pawel Zarembski 0:01f31e923fe2 2234 0x01, /* bInterfaceProtocol: no protocol used */ \
Pawel Zarembski 0:01f31e923fe2 2235 USBD_CDC_ACM_CIF_STR_NUM, /* iInterface: */ \
Pawel Zarembski 0:01f31e923fe2 2236 \
Pawel Zarembski 0:01f31e923fe2 2237 /* Header Functional Descriptor */ \
Pawel Zarembski 0:01f31e923fe2 2238 CDC_HEADER_SIZE, /* bLength: Endpoint Descriptor size */ \
Pawel Zarembski 0:01f31e923fe2 2239 CDC_CS_INTERFACE, /* bDescriptorType: CS_INTERFACE */ \
Pawel Zarembski 0:01f31e923fe2 2240 CDC_HEADER, /* bDescriptorSubtype: Header Func Desc */ \
Pawel Zarembski 0:01f31e923fe2 2241 WBVAL(CDC_V1_10), /* 1.10 */ /* bcdCDC */ \
Pawel Zarembski 0:01f31e923fe2 2242 /* Call Management Functional Descriptor */ \
Pawel Zarembski 0:01f31e923fe2 2243 CDC_CALL_MANAGEMENT_SIZE, /* bFunctionLength */ \
Pawel Zarembski 0:01f31e923fe2 2244 CDC_CS_INTERFACE, /* bDescriptorType: CS_INTERFACE */ \
Pawel Zarembski 0:01f31e923fe2 2245 CDC_CALL_MANAGEMENT, /* bDescriptorSubtype: Call Management Func Desc */ \
Pawel Zarembski 0:01f31e923fe2 2246 0x03, /* bmCapabilities: device handles call management */ \
Pawel Zarembski 0:01f31e923fe2 2247 0x02, /* bDataInterface: CDC data IF ID */ \
Pawel Zarembski 0:01f31e923fe2 2248 /* Abstract Control Management Functional Descriptor */ \
Pawel Zarembski 0:01f31e923fe2 2249 CDC_ABSTRACT_CONTROL_MANAGEMENT_SIZE, /* bFunctionLength */ \
Pawel Zarembski 0:01f31e923fe2 2250 CDC_CS_INTERFACE, /* bDescriptorType: CS_INTERFACE */ \
Pawel Zarembski 0:01f31e923fe2 2251 CDC_ABSTRACT_CONTROL_MANAGEMENT, /* bDescriptorSubtype: Abstract Control Management desc */ \
Pawel Zarembski 0:01f31e923fe2 2252 0x06, /* bmCapabilities: SET_LINE_CODING, GET_LINE_CODING, SET_CONTROL_LINE_STATE supported */ \
Pawel Zarembski 0:01f31e923fe2 2253 /* Union Functional Descriptor */ \
Pawel Zarembski 0:01f31e923fe2 2254 CDC_UNION_SIZE, /* bFunctionLength */ \
Pawel Zarembski 0:01f31e923fe2 2255 CDC_CS_INTERFACE, /* bDescriptorType: CS_INTERFACE */ \
Pawel Zarembski 0:01f31e923fe2 2256 CDC_UNION, /* bDescriptorSubtype: Union func desc */ \
Pawel Zarembski 0:01f31e923fe2 2257 0x00, /* bMasterInterface: Communication class interface is master USBD_CDC_ACM_CIF_NUM*/ \
Pawel Zarembski 0:01f31e923fe2 2258 0x00, /* bSlaveInterface0: Data class interface is slave 0 USBD_CDC_ACM_DIF_NUM*/
Pawel Zarembski 0:01f31e923fe2 2259
Pawel Zarembski 0:01f31e923fe2 2260 #define CDC_ACM_EP_IF0 /* CDC Endpoints for Interface 0 for Low-speed/Full-speed */ \
Pawel Zarembski 0:01f31e923fe2 2261 /* Endpoint, EP Interrupt IN */ /* event notification (optional) */ \
Pawel Zarembski 0:01f31e923fe2 2262 USB_ENDPOINT_DESC_SIZE, /* bLength */ \
Pawel Zarembski 0:01f31e923fe2 2263 USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */ \
Pawel Zarembski 0:01f31e923fe2 2264 USB_ENDPOINT_IN(USBD_CDC_ACM_EP_INTIN),/* bEndpointAddress */ \
Pawel Zarembski 0:01f31e923fe2 2265 USB_ENDPOINT_TYPE_INTERRUPT, /* bmAttributes */ \
Pawel Zarembski 0:01f31e923fe2 2266 WBVAL(USBD_CDC_ACM_WMAXPACKETSIZE), /* wMaxPacketSize */ \
Pawel Zarembski 0:01f31e923fe2 2267 USBD_CDC_ACM_BINTERVAL, /* bInterval */
Pawel Zarembski 0:01f31e923fe2 2268
Pawel Zarembski 0:01f31e923fe2 2269 #define CDC_ACM_EP_IF0_HS /* CDC Endpoints for Interface 0 for High-speed */ \
Pawel Zarembski 0:01f31e923fe2 2270 /* Endpoint, EP Interrupt IN */ /* event notification (optional) */ \
Pawel Zarembski 0:01f31e923fe2 2271 USB_ENDPOINT_DESC_SIZE, /* bLength */ \
Pawel Zarembski 0:01f31e923fe2 2272 USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */ \
Pawel Zarembski 0:01f31e923fe2 2273 USB_ENDPOINT_IN(USBD_CDC_ACM_EP_INTIN),/* bEndpointAddress */ \
Pawel Zarembski 0:01f31e923fe2 2274 USB_ENDPOINT_TYPE_INTERRUPT, /* bmAttributes */ \
Pawel Zarembski 0:01f31e923fe2 2275 WBVAL(USBD_CDC_ACM_HS_WMAXPACKETSIZE),/* wMaxPacketSize */ \
Pawel Zarembski 0:01f31e923fe2 2276 USBD_CDC_ACM_HS_BINTERVAL, /* bInterval */
Pawel Zarembski 0:01f31e923fe2 2277
Pawel Zarembski 0:01f31e923fe2 2278 #define CDC_ACM_DESC_IF1 \
Pawel Zarembski 0:01f31e923fe2 2279 /* Interface, Alternate Setting 0, Data class interface descriptor*/ \
Pawel Zarembski 0:01f31e923fe2 2280 USB_INTERFACE_DESC_SIZE, /* bLength */ \
Pawel Zarembski 0:01f31e923fe2 2281 USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */ \
Pawel Zarembski 0:01f31e923fe2 2282 0x00, /* bInterfaceNumber: Number of Interface USBD_CDC_ACM_DIF_NUM*/ \
Pawel Zarembski 0:01f31e923fe2 2283 0x00, /* bAlternateSetting: no alternate setting */ \
Pawel Zarembski 0:01f31e923fe2 2284 0x02, /* bNumEndpoints: two endpoints used */ \
Pawel Zarembski 0:01f31e923fe2 2285 CDC_DATA_INTERFACE_CLASS, /* bInterfaceClass: Data Interface Class */ \
Pawel Zarembski 0:01f31e923fe2 2286 0x00, /* bInterfaceSubClass: no subclass available */ \
Pawel Zarembski 0:01f31e923fe2 2287 0x00, /* bInterfaceProtocol: no protocol used */ \
Pawel Zarembski 0:01f31e923fe2 2288 USBD_CDC_ACM_DIF_STR_NUM, /* iInterface */
Pawel Zarembski 0:01f31e923fe2 2289
Pawel Zarembski 0:01f31e923fe2 2290 #define CDC_ACM_EP_IF1 /* CDC Endpoints for Interface 1 for Low-speed/Full-speed */ \
Pawel Zarembski 0:01f31e923fe2 2291 /* Endpoint, EP Bulk OUT */ \
Pawel Zarembski 0:01f31e923fe2 2292 USB_ENDPOINT_DESC_SIZE, /* bLength */ \
Pawel Zarembski 0:01f31e923fe2 2293 USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */ \
Pawel Zarembski 0:01f31e923fe2 2294 USB_ENDPOINT_OUT(USBD_CDC_ACM_EP_BULKOUT),/* bEndpointAddress */ \
Pawel Zarembski 0:01f31e923fe2 2295 USB_ENDPOINT_TYPE_BULK, /* bmAttributes */ \
Pawel Zarembski 0:01f31e923fe2 2296 WBVAL(USBD_CDC_ACM_WMAXPACKETSIZE1), /* wMaxPacketSize */ \
Pawel Zarembski 0:01f31e923fe2 2297 0x00, /* bInterval: ignore for Bulk transfer */ \
Pawel Zarembski 0:01f31e923fe2 2298 \
Pawel Zarembski 0:01f31e923fe2 2299 /* Endpoint, EP Bulk IN */ \
Pawel Zarembski 0:01f31e923fe2 2300 USB_ENDPOINT_DESC_SIZE, /* bLength */ \
Pawel Zarembski 0:01f31e923fe2 2301 USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */ \
Pawel Zarembski 0:01f31e923fe2 2302 USB_ENDPOINT_IN(USBD_CDC_ACM_EP_BULKIN),/* bEndpointAddress */ \
Pawel Zarembski 0:01f31e923fe2 2303 USB_ENDPOINT_TYPE_BULK, /* bmAttributes */ \
Pawel Zarembski 0:01f31e923fe2 2304 WBVAL(USBD_CDC_ACM_WMAXPACKETSIZE1), /* wMaxPacketSize */ \
Pawel Zarembski 0:01f31e923fe2 2305 0x00, /* bInterval: ignore for Bulk transfer */
Pawel Zarembski 0:01f31e923fe2 2306
Pawel Zarembski 0:01f31e923fe2 2307 #define CDC_ACM_EP_IF1_HS /* CDC Endpoints for Interface 1 for High-speed */ \
Pawel Zarembski 0:01f31e923fe2 2308 /* Endpoint, EP Bulk OUT */ \
Pawel Zarembski 0:01f31e923fe2 2309 USB_ENDPOINT_DESC_SIZE, /* bLength */ \
Pawel Zarembski 0:01f31e923fe2 2310 USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */ \
Pawel Zarembski 0:01f31e923fe2 2311 USB_ENDPOINT_OUT(USBD_CDC_ACM_EP_BULKOUT),/* bEndpointAddress */ \
Pawel Zarembski 0:01f31e923fe2 2312 USB_ENDPOINT_TYPE_BULK, /* bmAttributes */ \
Pawel Zarembski 0:01f31e923fe2 2313 WBVAL(USBD_CDC_ACM_HS_WMAXPACKETSIZE1),/* wMaxPacketSize */ \
Pawel Zarembski 0:01f31e923fe2 2314 USBD_CDC_ACM_HS_BINTERVAL1, /* bInterval */ \
Pawel Zarembski 0:01f31e923fe2 2315 \
Pawel Zarembski 0:01f31e923fe2 2316 /* Endpoint, EP Bulk IN */ \
Pawel Zarembski 0:01f31e923fe2 2317 USB_ENDPOINT_DESC_SIZE, /* bLength */ \
Pawel Zarembski 0:01f31e923fe2 2318 USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */ \
Pawel Zarembski 0:01f31e923fe2 2319 USB_ENDPOINT_IN(USBD_CDC_ACM_EP_BULKIN),/* bEndpointAddress */ \
Pawel Zarembski 0:01f31e923fe2 2320 USB_ENDPOINT_TYPE_BULK, /* bmAttributes */ \
Pawel Zarembski 0:01f31e923fe2 2321 WBVAL(USBD_CDC_ACM_HS_WMAXPACKETSIZE1),/* wMaxPacketSize */ \
Pawel Zarembski 0:01f31e923fe2 2322 USBD_CDC_ACM_HS_BINTERVAL1, /* bInterval */
Pawel Zarembski 0:01f31e923fe2 2323
Pawel Zarembski 0:01f31e923fe2 2324 /* USB Device Configuration Descriptor (for Full Speed) */
Pawel Zarembski 0:01f31e923fe2 2325 /* All Descriptors (Configuration, Interface, Endpoint, Class, Vendor) */
Pawel Zarembski 0:01f31e923fe2 2326 __weak \
Pawel Zarembski 0:01f31e923fe2 2327 U8 USBD_ConfigDescriptor[200] = { 0 };
Pawel Zarembski 0:01f31e923fe2 2328
Pawel Zarembski 0:01f31e923fe2 2329 #if (USBD_HS_ENABLE == 0) /* If High-speed not enabled, declare dummy descriptors for High-speed */
Pawel Zarembski 0:01f31e923fe2 2330 __weak \
Pawel Zarembski 0:01f31e923fe2 2331 U8 USBD_ConfigDescriptor_HS[] = { 0 };
Pawel Zarembski 0:01f31e923fe2 2332 #else
Pawel Zarembski 0:01f31e923fe2 2333 /* USB Device Configuration Descriptor (for High Speed) */
Pawel Zarembski 0:01f31e923fe2 2334 /* All Descriptors (Configuration, Interface, Endpoint, Class, Vendor) */
Pawel Zarembski 0:01f31e923fe2 2335 __weak \
Pawel Zarembski 0:01f31e923fe2 2336 U8 USBD_ConfigDescriptor_HS[200] = { 0 };
Pawel Zarembski 0:01f31e923fe2 2337
Pawel Zarembski 0:01f31e923fe2 2338 #endif
Pawel Zarembski 0:01f31e923fe2 2339
Pawel Zarembski 0:01f31e923fe2 2340 /* USB Device Create String Descriptor */
Pawel Zarembski 0:01f31e923fe2 2341 #define USBD_STR_DEF(n) \
Pawel Zarembski 0:01f31e923fe2 2342 struct { \
Pawel Zarembski 0:01f31e923fe2 2343 U8 len; \
Pawel Zarembski 0:01f31e923fe2 2344 U8 type; \
Pawel Zarembski 0:01f31e923fe2 2345 U16 str[sizeof(USBD_##n)/2-1]; \
Pawel Zarembski 0:01f31e923fe2 2346 } desc##n
Pawel Zarembski 0:01f31e923fe2 2347
Pawel Zarembski 0:01f31e923fe2 2348 #define USBD_STR_VAL(n) \
Pawel Zarembski 0:01f31e923fe2 2349 { sizeof(USBD_##n), USB_STRING_DESCRIPTOR_TYPE, USBD_##n }
Pawel Zarembski 0:01f31e923fe2 2350
Pawel Zarembski 0:01f31e923fe2 2351 __weak \
Pawel Zarembski 0:01f31e923fe2 2352 const struct {
Pawel Zarembski 0:01f31e923fe2 2353 struct {
Pawel Zarembski 0:01f31e923fe2 2354 U8 len;
Pawel Zarembski 0:01f31e923fe2 2355 U8 type;
Pawel Zarembski 0:01f31e923fe2 2356 U16 langid;
Pawel Zarembski 0:01f31e923fe2 2357 } desc_langid;
Pawel Zarembski 0:01f31e923fe2 2358 USBD_STR_DEF(STRDESC_MAN);
Pawel Zarembski 0:01f31e923fe2 2359 USBD_STR_DEF(STRDESC_PROD);
Pawel Zarembski 0:01f31e923fe2 2360 #if (USBD_STRDESC_SER_ENABLE)
Pawel Zarembski 0:01f31e923fe2 2361 USBD_STR_DEF(STRDESC_SER);
Pawel Zarembski 0:01f31e923fe2 2362 #endif
Pawel Zarembski 0:01f31e923fe2 2363 #if (USBD_ADC_ENABLE)
Pawel Zarembski 0:01f31e923fe2 2364 USBD_STR_DEF(ADC_CIF_STRDESC);
Pawel Zarembski 0:01f31e923fe2 2365 USBD_STR_DEF(ADC_SIF1_STRDESC);
Pawel Zarembski 0:01f31e923fe2 2366 USBD_STR_DEF(ADC_SIF2_STRDESC);
Pawel Zarembski 0:01f31e923fe2 2367 #endif
Pawel Zarembski 0:01f31e923fe2 2368 #if (USBD_CDC_ACM_ENABLE)
Pawel Zarembski 0:01f31e923fe2 2369 USBD_STR_DEF(CDC_ACM_CIF_STRDESC);
Pawel Zarembski 0:01f31e923fe2 2370 USBD_STR_DEF(CDC_ACM_DIF_STRDESC);
Pawel Zarembski 0:01f31e923fe2 2371 #endif
Pawel Zarembski 0:01f31e923fe2 2372 #if (USBD_HID_ENABLE)
Pawel Zarembski 0:01f31e923fe2 2373 USBD_STR_DEF(HID_STRDESC);
Pawel Zarembski 0:01f31e923fe2 2374 #endif
Pawel Zarembski 0:01f31e923fe2 2375 #if (USBD_WEBUSB_ENABLE)
Pawel Zarembski 0:01f31e923fe2 2376 USBD_STR_DEF(WEBUSB_STRDESC);
Pawel Zarembski 0:01f31e923fe2 2377 #endif
Pawel Zarembski 0:01f31e923fe2 2378 #if (USBD_MSC_ENABLE)
Pawel Zarembski 0:01f31e923fe2 2379 USBD_STR_DEF(MSC_STRDESC);
Pawel Zarembski 0:01f31e923fe2 2380 #endif
Pawel Zarembski 0:01f31e923fe2 2381 #if (USBD_BULK_ENABLE)
Pawel Zarembski 0:01f31e923fe2 2382 USBD_STR_DEF(BULK_STRDESC);
Pawel Zarembski 0:01f31e923fe2 2383 #endif
Pawel Zarembski 0:01f31e923fe2 2384 } USBD_StringDescriptor
Pawel Zarembski 0:01f31e923fe2 2385 = {
Pawel Zarembski 0:01f31e923fe2 2386 { 4, USB_STRING_DESCRIPTOR_TYPE, USBD_STRDESC_LANGID },
Pawel Zarembski 0:01f31e923fe2 2387 USBD_STR_VAL(STRDESC_MAN),
Pawel Zarembski 0:01f31e923fe2 2388 USBD_STR_VAL(STRDESC_PROD),
Pawel Zarembski 0:01f31e923fe2 2389 #if (USBD_STRDESC_SER_ENABLE)
Pawel Zarembski 0:01f31e923fe2 2390 USBD_STR_VAL(STRDESC_SER),
Pawel Zarembski 0:01f31e923fe2 2391 #endif
Pawel Zarembski 0:01f31e923fe2 2392 #if (USBD_ADC_ENABLE)
Pawel Zarembski 0:01f31e923fe2 2393 USBD_STR_VAL(ADC_CIF_STRDESC),
Pawel Zarembski 0:01f31e923fe2 2394 USBD_STR_VAL(ADC_SIF1_STRDESC),
Pawel Zarembski 0:01f31e923fe2 2395 USBD_STR_VAL(ADC_SIF2_STRDESC),
Pawel Zarembski 0:01f31e923fe2 2396 #endif
Pawel Zarembski 0:01f31e923fe2 2397 #if (USBD_CDC_ACM_ENABLE)
Pawel Zarembski 0:01f31e923fe2 2398 USBD_STR_VAL(CDC_ACM_CIF_STRDESC),
Pawel Zarembski 0:01f31e923fe2 2399 USBD_STR_VAL(CDC_ACM_DIF_STRDESC),
Pawel Zarembski 0:01f31e923fe2 2400 #endif
Pawel Zarembski 0:01f31e923fe2 2401 #if (USBD_HID_ENABLE)
Pawel Zarembski 0:01f31e923fe2 2402 USBD_STR_VAL(HID_STRDESC),
Pawel Zarembski 0:01f31e923fe2 2403 #endif
Pawel Zarembski 0:01f31e923fe2 2404 #if (USBD_WEBUSB_ENABLE)
Pawel Zarembski 0:01f31e923fe2 2405 USBD_STR_VAL(WEBUSB_STRDESC),
Pawel Zarembski 0:01f31e923fe2 2406 #endif
Pawel Zarembski 0:01f31e923fe2 2407 #if (USBD_MSC_ENABLE)
Pawel Zarembski 0:01f31e923fe2 2408 USBD_STR_VAL(MSC_STRDESC),
Pawel Zarembski 0:01f31e923fe2 2409 #endif
Pawel Zarembski 0:01f31e923fe2 2410 #if (USBD_BULK_ENABLE)
Pawel Zarembski 0:01f31e923fe2 2411 USBD_STR_VAL(BULK_STRDESC),
Pawel Zarembski 0:01f31e923fe2 2412 #endif
Pawel Zarembski 0:01f31e923fe2 2413 };
Pawel Zarembski 0:01f31e923fe2 2414
Pawel Zarembski 0:01f31e923fe2 2415 #if (USBD_WEBUSB_ENABLE)
Pawel Zarembski 0:01f31e923fe2 2416
Pawel Zarembski 0:01f31e923fe2 2417 #define WEBUSB_NUM_FUNCTIONS (1)
Pawel Zarembski 0:01f31e923fe2 2418
Pawel Zarembski 0:01f31e923fe2 2419 #define WEBUSB_WTOTALLENGTH (WEBUSB_DESCRIPTOR_SET_HEADER_SIZE + \
Pawel Zarembski 0:01f31e923fe2 2420 WEBUSB_CONFIGURATION_SUBSET_HEADER_SIZE +\
Pawel Zarembski 0:01f31e923fe2 2421 (WEBUSB_NUM_FUNCTIONS * (WEBUSB_FUNCTION_SUBSET_HEADER_SIZE + 1)))
Pawel Zarembski 0:01f31e923fe2 2422
Pawel Zarembski 0:01f31e923fe2 2423 /* WebUSB Create URL Descriptor */
Pawel Zarembski 0:01f31e923fe2 2424 #define WEBUSB_URL_DEF(n) \
Pawel Zarembski 0:01f31e923fe2 2425 struct { \
Pawel Zarembski 0:01f31e923fe2 2426 U8 bLength; \
Pawel Zarembski 0:01f31e923fe2 2427 U8 bDescriptorType; \
Pawel Zarembski 0:01f31e923fe2 2428 U8 bScheme; \
Pawel Zarembski 0:01f31e923fe2 2429 U8 URL[sizeof(USBD_##n)+3];\
Pawel Zarembski 0:01f31e923fe2 2430 } url##n
Pawel Zarembski 0:01f31e923fe2 2431
Pawel Zarembski 0:01f31e923fe2 2432 #define WEBUSB_HTTP_URL_VAL(n) \
Pawel Zarembski 0:01f31e923fe2 2433 { \
Pawel Zarembski 0:01f31e923fe2 2434 (sizeof(USBD_##n) + 3) + 3, \
Pawel Zarembski 0:01f31e923fe2 2435 WEBUSB_URL_TYPE, \
Pawel Zarembski 0:01f31e923fe2 2436 WEBUSB_URL_SCHEME_HTTP, \
Pawel Zarembski 0:01f31e923fe2 2437 USBD_##n \
Pawel Zarembski 0:01f31e923fe2 2438 }
Pawel Zarembski 0:01f31e923fe2 2439
Pawel Zarembski 0:01f31e923fe2 2440 #define WEBUSB_HTTPS_URL_VAL(n) \
Pawel Zarembski 0:01f31e923fe2 2441 { \
Pawel Zarembski 0:01f31e923fe2 2442 (sizeof(USBD_##n) + 3) + 3, \
Pawel Zarembski 0:01f31e923fe2 2443 WEBUSB_URL_TYPE, \
Pawel Zarembski 0:01f31e923fe2 2444 WEBUSB_URL_SCHEME_HTTPS, \
Pawel Zarembski 0:01f31e923fe2 2445 USBD_##n \
Pawel Zarembski 0:01f31e923fe2 2446 }
Pawel Zarembski 0:01f31e923fe2 2447
Pawel Zarembski 0:01f31e923fe2 2448 __weak \
Pawel Zarembski 0:01f31e923fe2 2449 struct {
Pawel Zarembski 0:01f31e923fe2 2450 WEBUSB_URL_DEF(WEBUSB_LANDING_URL);
Pawel Zarembski 0:01f31e923fe2 2451 WEBUSB_URL_DEF(WEBUSB_ORIGIN_URL);
Pawel Zarembski 0:01f31e923fe2 2452 } USBD_WebUSBURLDescriptor
Pawel Zarembski 0:01f31e923fe2 2453 = {
Pawel Zarembski 0:01f31e923fe2 2454 WEBUSB_HTTPS_URL_VAL(WEBUSB_LANDING_URL),
Pawel Zarembski 0:01f31e923fe2 2455 WEBUSB_HTTPS_URL_VAL(WEBUSB_ORIGIN_URL),
Pawel Zarembski 0:01f31e923fe2 2456 };
Pawel Zarembski 0:01f31e923fe2 2457
Pawel Zarembski 0:01f31e923fe2 2458 #else
Pawel Zarembski 0:01f31e923fe2 2459
Pawel Zarembski 0:01f31e923fe2 2460 U8 USBD_WebUSBURLDescriptor[] = { 0 };
Pawel Zarembski 0:01f31e923fe2 2461
Pawel Zarembski 0:01f31e923fe2 2462 BOOL USBD_EndPoint0_Setup_WebUSB_ReqToDevice(void)
Pawel Zarembski 0:01f31e923fe2 2463 {
Pawel Zarembski 0:01f31e923fe2 2464 return (__FALSE);
Pawel Zarembski 0:01f31e923fe2 2465 }
Pawel Zarembski 0:01f31e923fe2 2466
Pawel Zarembski 0:01f31e923fe2 2467 #endif //USBD_WEBUSB_ENABLE
Pawel Zarembski 0:01f31e923fe2 2468
Pawel Zarembski 0:01f31e923fe2 2469
Pawel Zarembski 0:01f31e923fe2 2470 extern uint8_t flash_algo_valid(void);
Pawel Zarembski 0:01f31e923fe2 2471
Pawel Zarembski 0:01f31e923fe2 2472 static U16 start_desc_fill(U8 * config_desc, U8 * config_desc_hs, U8 if_num) {
Pawel Zarembski 0:01f31e923fe2 2473 U8 * pD = 0;
Pawel Zarembski 0:01f31e923fe2 2474 const U8 start_desc[] = {
Pawel Zarembski 0:01f31e923fe2 2475 /* Configuration 1 */
Pawel Zarembski 0:01f31e923fe2 2476 USB_CONFIGUARTION_DESC_SIZE, // bLength
Pawel Zarembski 0:01f31e923fe2 2477 USB_CONFIGURATION_DESCRIPTOR_TYPE, // bDescriptorType
Pawel Zarembski 0:01f31e923fe2 2478 WBVAL(USBD_WTOTALLENGTH_MAX), // wTotalLength
Pawel Zarembski 0:01f31e923fe2 2479 USBD_IF_NUM_MAX, // bNumInterfaces
Pawel Zarembski 0:01f31e923fe2 2480 0x01, // bConfigurationValue: 0x01 is used to select this configuration
Pawel Zarembski 0:01f31e923fe2 2481 0x00, // iConfiguration: no string to describe this configuration
Pawel Zarembski 0:01f31e923fe2 2482 USBD_CFGDESC_BMATTRIBUTES | // bmAttributes
Pawel Zarembski 0:01f31e923fe2 2483 (USBD_POWER << 6),
Pawel Zarembski 0:01f31e923fe2 2484 USBD_CFGDESC_BMAXPOWER // bMaxPower, device power consumption
Pawel Zarembski 0:01f31e923fe2 2485 };
Pawel Zarembski 0:01f31e923fe2 2486 pD = config_desc;
Pawel Zarembski 0:01f31e923fe2 2487 memcpy(pD, start_desc, sizeof(start_desc));
Pawel Zarembski 0:01f31e923fe2 2488
Pawel Zarembski 0:01f31e923fe2 2489 #if (USBD_HS_ENABLE == 1)
Pawel Zarembski 0:01f31e923fe2 2490 pD = config_desc_hs;
Pawel Zarembski 0:01f31e923fe2 2491 memcpy(pD, start_desc, sizeof(start_desc));
Pawel Zarembski 0:01f31e923fe2 2492 #endif
Pawel Zarembski 0:01f31e923fe2 2493
Pawel Zarembski 0:01f31e923fe2 2494 return sizeof(start_desc);
Pawel Zarembski 0:01f31e923fe2 2495 }
Pawel Zarembski 0:01f31e923fe2 2496
Pawel Zarembski 0:01f31e923fe2 2497 static U16 hid_desc_fill(U8 * config_desc, U8 * config_desc_hs, U8 if_num) {
Pawel Zarembski 0:01f31e923fe2 2498 U8 * pD = 0;
Pawel Zarembski 0:01f31e923fe2 2499 const U8 hid_desc[] = {
Pawel Zarembski 0:01f31e923fe2 2500 HID_DESC
Pawel Zarembski 0:01f31e923fe2 2501 #if ((USBD_HID_EP_INTOUT != 0) && (USBD_HID_EP_INTIN != 0))
Pawel Zarembski 0:01f31e923fe2 2502 HID_EP_INOUT
Pawel Zarembski 0:01f31e923fe2 2503 #elif (USBD_HID_EP_INTIN != 0)
Pawel Zarembski 0:01f31e923fe2 2504 HID_EP_IN
Pawel Zarembski 0:01f31e923fe2 2505 #elif (USBD_HID_EP_INTOUT != 0)
Pawel Zarembski 0:01f31e923fe2 2506 HID_EP_OUT
Pawel Zarembski 0:01f31e923fe2 2507 #endif
Pawel Zarembski 0:01f31e923fe2 2508 };
Pawel Zarembski 0:01f31e923fe2 2509 pD = config_desc;
Pawel Zarembski 0:01f31e923fe2 2510 memcpy(pD, hid_desc, sizeof(hid_desc));
Pawel Zarembski 0:01f31e923fe2 2511 ((USB_INTERFACE_DESCRIPTOR *)pD)->bInterfaceNumber = if_num;
Pawel Zarembski 0:01f31e923fe2 2512 #if (USBD_HS_ENABLE == 1)
Pawel Zarembski 0:01f31e923fe2 2513 const U8 hid_desc_hs[] = {
Pawel Zarembski 0:01f31e923fe2 2514 HID_DESC
Pawel Zarembski 0:01f31e923fe2 2515 #if ((USBD_HID_EP_INTOUT != 0) && (USBD_HID_EP_INTIN != 0))
Pawel Zarembski 0:01f31e923fe2 2516 HID_EP_INOUT_HS
Pawel Zarembski 0:01f31e923fe2 2517 #elif (USBD_HID_EP_INTIN != 0) //#else
Pawel Zarembski 0:01f31e923fe2 2518 HID_EP_IN_HS
Pawel Zarembski 0:01f31e923fe2 2519 #elif (USBD_HID_EP_INTOUT != 0)
Pawel Zarembski 0:01f31e923fe2 2520 HID_EP_OUT_HS
Pawel Zarembski 0:01f31e923fe2 2521 #endif
Pawel Zarembski 0:01f31e923fe2 2522 };
Pawel Zarembski 0:01f31e923fe2 2523 pD = config_desc_hs;
Pawel Zarembski 0:01f31e923fe2 2524 memcpy(pD, hid_desc_hs, sizeof(hid_desc_hs));
Pawel Zarembski 0:01f31e923fe2 2525 ((USB_INTERFACE_DESCRIPTOR *)pD)->bInterfaceNumber = if_num;
Pawel Zarembski 0:01f31e923fe2 2526 #endif
Pawel Zarembski 0:01f31e923fe2 2527 return sizeof(hid_desc);
Pawel Zarembski 0:01f31e923fe2 2528 }
Pawel Zarembski 0:01f31e923fe2 2529
Pawel Zarembski 0:01f31e923fe2 2530 static U16 acm_cdc_desc_fill(U8 * config_desc, U8 * config_desc_hs, U8 if_num) {
Pawel Zarembski 0:01f31e923fe2 2531 U8 * pD = 0;
Pawel Zarembski 0:01f31e923fe2 2532 const U8 cdc_desc[] = {
Pawel Zarembski 0:01f31e923fe2 2533 #if (USBD_MULTI_IF)
Pawel Zarembski 0:01f31e923fe2 2534 CDC_ACM_DESC_IAD(0, 2)
Pawel Zarembski 0:01f31e923fe2 2535 #endif
Pawel Zarembski 0:01f31e923fe2 2536 CDC_ACM_DESC_IF0
Pawel Zarembski 0:01f31e923fe2 2537 CDC_ACM_EP_IF0
Pawel Zarembski 0:01f31e923fe2 2538 CDC_ACM_DESC_IF1
Pawel Zarembski 0:01f31e923fe2 2539 CDC_ACM_EP_IF1
Pawel Zarembski 0:01f31e923fe2 2540 };
Pawel Zarembski 0:01f31e923fe2 2541 pD = config_desc;
Pawel Zarembski 0:01f31e923fe2 2542 memcpy(pD, cdc_desc, sizeof(cdc_desc));
Pawel Zarembski 0:01f31e923fe2 2543
Pawel Zarembski 0:01f31e923fe2 2544 #if (USBD_MULTI_IF)
Pawel Zarembski 0:01f31e923fe2 2545 ((USB_INTERFACE_ASSOCIATION_DESCRIPTOR *)pD)->bFirstInterface = if_num;
Pawel Zarembski 0:01f31e923fe2 2546 pD += USB_INTERFACE_ASSOC_DESC_SIZE;
Pawel Zarembski 0:01f31e923fe2 2547 #endif
Pawel Zarembski 0:01f31e923fe2 2548
Pawel Zarembski 0:01f31e923fe2 2549 ((USB_INTERFACE_DESCRIPTOR *)pD)->bInterfaceNumber = if_num;
Pawel Zarembski 0:01f31e923fe2 2550 pD += USB_INTERFACE_DESC_SIZE + CDC_HEADER_SIZE + CDC_CALL_MANAGEMENT_SIZE + CDC_ABSTRACT_CONTROL_MANAGEMENT_SIZE;
Pawel Zarembski 0:01f31e923fe2 2551 ((UNION_FUNCTIONAL_DESCRIPTOR*)pD)->bMasterInterface = if_num;
Pawel Zarembski 0:01f31e923fe2 2552 ((UNION_FUNCTIONAL_DESCRIPTOR*)pD)->bSlaveInterface0 = if_num + 1;
Pawel Zarembski 0:01f31e923fe2 2553 pD += CDC_UNION_SIZE + USB_ENDPOINT_DESC_SIZE;
Pawel Zarembski 0:01f31e923fe2 2554 ((USB_INTERFACE_DESCRIPTOR *)pD)->bInterfaceNumber = if_num + 1;
Pawel Zarembski 0:01f31e923fe2 2555
Pawel Zarembski 0:01f31e923fe2 2556 #if (USBD_HS_ENABLE == 1)
Pawel Zarembski 0:01f31e923fe2 2557 const U8 cdc_desc_hs[] = {
Pawel Zarembski 0:01f31e923fe2 2558 #if (USBD_MULTI_IF)
Pawel Zarembski 0:01f31e923fe2 2559 CDC_ACM_DESC_IAD(0, 2)
Pawel Zarembski 0:01f31e923fe2 2560 #endif
Pawel Zarembski 0:01f31e923fe2 2561 CDC_ACM_DESC_IF0
Pawel Zarembski 0:01f31e923fe2 2562 CDC_ACM_EP_IF0_HS
Pawel Zarembski 0:01f31e923fe2 2563 CDC_ACM_DESC_IF1
Pawel Zarembski 0:01f31e923fe2 2564 CDC_ACM_EP_IF1_HS
Pawel Zarembski 0:01f31e923fe2 2565 };
Pawel Zarembski 0:01f31e923fe2 2566 pD = config_desc_hs;
Pawel Zarembski 0:01f31e923fe2 2567 memcpy(pD, cdc_desc_hs, sizeof(cdc_desc_hs));
Pawel Zarembski 0:01f31e923fe2 2568
Pawel Zarembski 0:01f31e923fe2 2569 #if (USBD_MULTI_IF)
Pawel Zarembski 0:01f31e923fe2 2570 ((USB_INTERFACE_ASSOCIATION_DESCRIPTOR *)pD)->bFirstInterface = if_num;
Pawel Zarembski 0:01f31e923fe2 2571 pD += USB_INTERFACE_ASSOC_DESC_SIZE;
Pawel Zarembski 0:01f31e923fe2 2572 #endif
Pawel Zarembski 0:01f31e923fe2 2573
Pawel Zarembski 0:01f31e923fe2 2574 ((USB_INTERFACE_DESCRIPTOR *)pD)->bInterfaceNumber = if_num;
Pawel Zarembski 0:01f31e923fe2 2575 pD += USB_INTERFACE_DESC_SIZE + CDC_HEADER_SIZE + CDC_CALL_MANAGEMENT_SIZE + CDC_ABSTRACT_CONTROL_MANAGEMENT_SIZE;
Pawel Zarembski 0:01f31e923fe2 2576 ((UNION_FUNCTIONAL_DESCRIPTOR*)pD)->bMasterInterface = if_num;
Pawel Zarembski 0:01f31e923fe2 2577 ((UNION_FUNCTIONAL_DESCRIPTOR*)pD)->bSlaveInterface0 = if_num + 1;
Pawel Zarembski 0:01f31e923fe2 2578 pD += CDC_UNION_SIZE + USB_ENDPOINT_DESC_SIZE;
Pawel Zarembski 0:01f31e923fe2 2579 ((USB_INTERFACE_DESCRIPTOR *)pD)->bInterfaceNumber = if_num +1 ;
Pawel Zarembski 0:01f31e923fe2 2580 #endif //(USBD_HS_ENABLE == 1)
Pawel Zarembski 0:01f31e923fe2 2581 return sizeof(cdc_desc);
Pawel Zarembski 0:01f31e923fe2 2582 }
Pawel Zarembski 0:01f31e923fe2 2583
Pawel Zarembski 0:01f31e923fe2 2584 static U16 msc_desc_fill(U8 * config_desc, U8 * config_desc_hs, U8 if_num) {
Pawel Zarembski 0:01f31e923fe2 2585 U8 * pD = 0;
Pawel Zarembski 0:01f31e923fe2 2586 const U8 msc_desc[] = {
Pawel Zarembski 0:01f31e923fe2 2587 MSC_DESC
Pawel Zarembski 0:01f31e923fe2 2588 MSC_EP
Pawel Zarembski 0:01f31e923fe2 2589 };
Pawel Zarembski 0:01f31e923fe2 2590 pD = config_desc;
Pawel Zarembski 0:01f31e923fe2 2591 memcpy(pD, msc_desc, sizeof(msc_desc));
Pawel Zarembski 0:01f31e923fe2 2592
Pawel Zarembski 0:01f31e923fe2 2593 ((USB_INTERFACE_DESCRIPTOR *)pD)->bInterfaceNumber = if_num;
Pawel Zarembski 0:01f31e923fe2 2594
Pawel Zarembski 0:01f31e923fe2 2595 #if (USBD_HS_ENABLE == 1)
Pawel Zarembski 0:01f31e923fe2 2596 const U8 msc_desc_hs[] = {
Pawel Zarembski 0:01f31e923fe2 2597 MSC_DESC
Pawel Zarembski 0:01f31e923fe2 2598 MSC_EP_HS
Pawel Zarembski 0:01f31e923fe2 2599 };
Pawel Zarembski 0:01f31e923fe2 2600 pD = config_desc_hs;
Pawel Zarembski 0:01f31e923fe2 2601 memcpy(pD, msc_desc_hs, sizeof(msc_desc_hs));
Pawel Zarembski 0:01f31e923fe2 2602 ((USB_INTERFACE_DESCRIPTOR *)pD)->bInterfaceNumber = if_num;
Pawel Zarembski 0:01f31e923fe2 2603 #endif
Pawel Zarembski 0:01f31e923fe2 2604
Pawel Zarembski 0:01f31e923fe2 2605 return sizeof(msc_desc);
Pawel Zarembski 0:01f31e923fe2 2606 }
Pawel Zarembski 0:01f31e923fe2 2607
Pawel Zarembski 0:01f31e923fe2 2608 #if (USBD_WEBUSB_ENABLE)
Pawel Zarembski 0:01f31e923fe2 2609 static U16 webusb_desc_fill(U8 * config_desc, U8 * config_desc_hs, U8 if_num) {
Pawel Zarembski 0:01f31e923fe2 2610 U8 * pD = 0;
Pawel Zarembski 0:01f31e923fe2 2611 const U8 webusb_desc[] = {
Pawel Zarembski 0:01f31e923fe2 2612 WEBUSB_DESC
Pawel Zarembski 0:01f31e923fe2 2613 };
Pawel Zarembski 0:01f31e923fe2 2614 pD = config_desc;
Pawel Zarembski 0:01f31e923fe2 2615 memcpy(pD, webusb_desc, sizeof(webusb_desc));
Pawel Zarembski 0:01f31e923fe2 2616 ((USB_INTERFACE_DESCRIPTOR *)pD)->bInterfaceNumber = if_num;
Pawel Zarembski 0:01f31e923fe2 2617
Pawel Zarembski 0:01f31e923fe2 2618 #if (USBD_HS_ENABLE == 1)
Pawel Zarembski 0:01f31e923fe2 2619 pD = config_desc_hs;
Pawel Zarembski 0:01f31e923fe2 2620 memcpy(pD, webusb_desc, sizeof(webusb_desc));
Pawel Zarembski 0:01f31e923fe2 2621 ((USB_INTERFACE_DESCRIPTOR *)pD)->bInterfaceNumber = if_num;
Pawel Zarembski 0:01f31e923fe2 2622 #endif
Pawel Zarembski 0:01f31e923fe2 2623
Pawel Zarembski 0:01f31e923fe2 2624 #if (USBD_WINUSB_ENABLE)
Pawel Zarembski 0:01f31e923fe2 2625 pD = USBD_WinUSBDescriptorSetDescriptor + WINUSB_DESCRIPTOR_SET_HEADER_SIZE;
Pawel Zarembski 0:01f31e923fe2 2626 ((WINUSB_FUNCTION_SUBSET_HEADER*)pD)->bFirstInterface = if_num;
Pawel Zarembski 0:01f31e923fe2 2627 #else
Pawel Zarembski 0:01f31e923fe2 2628 #error "WEBUSB requires WINUSB!"
Pawel Zarembski 0:01f31e923fe2 2629 #endif
Pawel Zarembski 0:01f31e923fe2 2630
Pawel Zarembski 0:01f31e923fe2 2631 return sizeof(webusb_desc);
Pawel Zarembski 0:01f31e923fe2 2632 }
Pawel Zarembski 0:01f31e923fe2 2633 #endif
Pawel Zarembski 0:01f31e923fe2 2634
Pawel Zarembski 0:01f31e923fe2 2635 #if (USBD_BULK_ENABLE)
Pawel Zarembski 0:01f31e923fe2 2636 static U16 bulk_desc_fill(U8 * config_desc, U8 * config_desc_hs, U8 if_num) {
Pawel Zarembski 0:01f31e923fe2 2637 U8 * pD = 0;
Pawel Zarembski 0:01f31e923fe2 2638 const U8 bulk_desc[] = {
Pawel Zarembski 0:01f31e923fe2 2639 BULK_DESC
Pawel Zarembski 0:01f31e923fe2 2640 BULK_EP
Pawel Zarembski 0:01f31e923fe2 2641 };
Pawel Zarembski 0:01f31e923fe2 2642 pD = config_desc;
Pawel Zarembski 0:01f31e923fe2 2643 memcpy(pD, bulk_desc, sizeof(bulk_desc));
Pawel Zarembski 0:01f31e923fe2 2644 ((USB_INTERFACE_DESCRIPTOR *)pD)->bInterfaceNumber = if_num;
Pawel Zarembski 0:01f31e923fe2 2645 #if (USBD_HS_ENABLE == 1)
Pawel Zarembski 0:01f31e923fe2 2646 const U8 bulk_desc_hs[] = {
Pawel Zarembski 0:01f31e923fe2 2647 BULK_DESC
Pawel Zarembski 0:01f31e923fe2 2648 BULK_EP_HS
Pawel Zarembski 0:01f31e923fe2 2649 };
Pawel Zarembski 0:01f31e923fe2 2650 pD = config_desc_hs;
Pawel Zarembski 0:01f31e923fe2 2651 memcpy(pD, bulk_desc_hs, sizeof(bulk_desc_hs));
Pawel Zarembski 0:01f31e923fe2 2652 ((USB_INTERFACE_DESCRIPTOR *)pD)->bInterfaceNumber = if_num;
Pawel Zarembski 0:01f31e923fe2 2653 #endif
Pawel Zarembski 0:01f31e923fe2 2654
Pawel Zarembski 0:01f31e923fe2 2655 #if (USBD_WINUSB_ENABLE)
Pawel Zarembski 0:01f31e923fe2 2656 pD = USBD_WinUSBDescriptorSetDescriptor + WINUSB_DESCRIPTOR_SET_HEADER_SIZE;
Pawel Zarembski 0:01f31e923fe2 2657 #if (USBD_WEBUSB_ENABLE)
Pawel Zarembski 0:01f31e923fe2 2658 pD += WINUSB_FUNCTION_SUBSET_HEADER_SIZE + WINUSB_FEATURE_COMPATIBLE_ID_SIZE + DEVICE_INTERFACE_GUIDS_FEATURE_LEN;
Pawel Zarembski 0:01f31e923fe2 2659 #endif
Pawel Zarembski 0:01f31e923fe2 2660 ((WINUSB_FUNCTION_SUBSET_HEADER*)pD)->bFirstInterface = if_num;
Pawel Zarembski 0:01f31e923fe2 2661 #else
Pawel Zarembski 0:01f31e923fe2 2662 #error "BULK interfaces requires WINUSB!"
Pawel Zarembski 0:01f31e923fe2 2663 #endif
Pawel Zarembski 0:01f31e923fe2 2664
Pawel Zarembski 0:01f31e923fe2 2665 return sizeof(bulk_desc);
Pawel Zarembski 0:01f31e923fe2 2666 }
Pawel Zarembski 0:01f31e923fe2 2667 #endif
Pawel Zarembski 0:01f31e923fe2 2668
Pawel Zarembski 0:01f31e923fe2 2669 void usbd_class_init(void)
Pawel Zarembski 0:01f31e923fe2 2670 {
Pawel Zarembski 0:01f31e923fe2 2671 U8 if_num = 0;
Pawel Zarembski 0:01f31e923fe2 2672 U16 desc_ptr = 0;
Pawel Zarembski 0:01f31e923fe2 2673
Pawel Zarembski 0:01f31e923fe2 2674 desc_ptr += start_desc_fill(&USBD_ConfigDescriptor[desc_ptr], &USBD_ConfigDescriptor_HS[desc_ptr], if_num);
Pawel Zarembski 0:01f31e923fe2 2675
Pawel Zarembski 0:01f31e923fe2 2676 #if (USBD_ADC_ENABLE)
Pawel Zarembski 0:01f31e923fe2 2677 usbd_adc_init();
Pawel Zarembski 0:01f31e923fe2 2678 #endif
Pawel Zarembski 0:01f31e923fe2 2679
Pawel Zarembski 0:01f31e923fe2 2680
Pawel Zarembski 0:01f31e923fe2 2681 #if (USBD_MSC_ENABLE)
Pawel Zarembski 0:01f31e923fe2 2682
Pawel Zarembski 0:01f31e923fe2 2683 #if !(defined(DAPLINK_BL)) && defined(DRAG_N_DROP_SUPPORT)
Pawel Zarembski 0:01f31e923fe2 2684 //change descriptors here
Pawel Zarembski 0:01f31e923fe2 2685 if (config_ram_get_disable_msd() == 1 || flash_algo_valid()==0 ){
Pawel Zarembski 0:01f31e923fe2 2686 usbd_if_num -= USBD_MSC_ENABLE;
Pawel Zarembski 0:01f31e923fe2 2687 USB_CONFIGURATION_DESCRIPTOR * usb_conf_desc = (USB_CONFIGURATION_DESCRIPTOR *)USBD_ConfigDescriptor;
Pawel Zarembski 0:01f31e923fe2 2688 usb_conf_desc->bNumInterfaces = usbd_if_num;
Pawel Zarembski 0:01f31e923fe2 2689 U16 usb_wtotal_len = USBD_WTOTALLENGTH_MAX - (USBD_MSC_DESC_LEN * USBD_MSC_ENABLE);
Pawel Zarembski 0:01f31e923fe2 2690 usb_conf_desc->wTotalLength = usb_wtotal_len;
Pawel Zarembski 0:01f31e923fe2 2691 USBD_ConfigDescriptor[usb_wtotal_len] = 0;
Pawel Zarembski 0:01f31e923fe2 2692 USBD_HID_DescriptorOffset -= USBD_MSC_ENABLE * USBD_MSC_DESC_LEN;
Pawel Zarembski 0:01f31e923fe2 2693 #if (USBD_HS_ENABLE == 1)
Pawel Zarembski 0:01f31e923fe2 2694 usb_conf_desc = (USB_CONFIGURATION_DESCRIPTOR *)USBD_ConfigDescriptor_HS;
Pawel Zarembski 0:01f31e923fe2 2695 usb_conf_desc->bNumInterfaces = usbd_if_num;
Pawel Zarembski 0:01f31e923fe2 2696 usb_conf_desc->wTotalLength = usb_wtotal_len;
Pawel Zarembski 0:01f31e923fe2 2697 USBD_ConfigDescriptor_HS[usb_wtotal_len] = 0;
Pawel Zarembski 0:01f31e923fe2 2698 #endif
Pawel Zarembski 0:01f31e923fe2 2699 } else
Pawel Zarembski 0:01f31e923fe2 2700 #endif
Pawel Zarembski 0:01f31e923fe2 2701 {
Pawel Zarembski 0:01f31e923fe2 2702 usbd_msc_if_num = if_num++;
Pawel Zarembski 0:01f31e923fe2 2703 desc_ptr += msc_desc_fill(&USBD_ConfigDescriptor[desc_ptr], &USBD_ConfigDescriptor_HS[desc_ptr], usbd_msc_if_num);
Pawel Zarembski 0:01f31e923fe2 2704 usbd_msc_init();
Pawel Zarembski 0:01f31e923fe2 2705
Pawel Zarembski 0:01f31e923fe2 2706 }
Pawel Zarembski 0:01f31e923fe2 2707 #endif //#if (USBD_MSC_ENABLE)
Pawel Zarembski 0:01f31e923fe2 2708
Pawel Zarembski 0:01f31e923fe2 2709 #if (USBD_CDC_ACM_ENABLE)
Pawel Zarembski 0:01f31e923fe2 2710 usbd_cdc_acm_cif_num = if_num++;
Pawel Zarembski 0:01f31e923fe2 2711 usbd_cdc_acm_dif_num = if_num++;
Pawel Zarembski 0:01f31e923fe2 2712 desc_ptr += acm_cdc_desc_fill(&USBD_ConfigDescriptor[desc_ptr], &USBD_ConfigDescriptor_HS[desc_ptr], usbd_cdc_acm_cif_num);
Pawel Zarembski 0:01f31e923fe2 2713 USBD_CDC_ACM_Initialize();
Pawel Zarembski 0:01f31e923fe2 2714 #endif
Pawel Zarembski 0:01f31e923fe2 2715
Pawel Zarembski 0:01f31e923fe2 2716 #if (USBD_HID_ENABLE)
Pawel Zarembski 0:01f31e923fe2 2717 usbd_hid_if_num = if_num++;
Pawel Zarembski 0:01f31e923fe2 2718 desc_ptr += hid_desc_fill(&USBD_ConfigDescriptor[desc_ptr], &USBD_ConfigDescriptor_HS[desc_ptr], usbd_hid_if_num);
Pawel Zarembski 0:01f31e923fe2 2719 usbd_hid_init();
Pawel Zarembski 0:01f31e923fe2 2720 #endif
Pawel Zarembski 0:01f31e923fe2 2721
Pawel Zarembski 0:01f31e923fe2 2722 #if (USBD_WEBUSB_ENABLE)
Pawel Zarembski 0:01f31e923fe2 2723 usbd_webusb_if_num = if_num++;
Pawel Zarembski 0:01f31e923fe2 2724 desc_ptr += webusb_desc_fill(&USBD_ConfigDescriptor[desc_ptr], &USBD_ConfigDescriptor_HS[desc_ptr], usbd_webusb_if_num);
Pawel Zarembski 0:01f31e923fe2 2725 #endif
Pawel Zarembski 0:01f31e923fe2 2726
Pawel Zarembski 0:01f31e923fe2 2727 #if (USBD_BULK_ENABLE)
Pawel Zarembski 0:01f31e923fe2 2728 usbd_bulk_if_num = if_num++;
Pawel Zarembski 0:01f31e923fe2 2729 desc_ptr += bulk_desc_fill(&USBD_ConfigDescriptor[desc_ptr], &USBD_ConfigDescriptor_HS[desc_ptr], usbd_bulk_if_num);
Pawel Zarembski 0:01f31e923fe2 2730 usbd_bulk_init();
Pawel Zarembski 0:01f31e923fe2 2731 #endif
Pawel Zarembski 0:01f31e923fe2 2732
Pawel Zarembski 0:01f31e923fe2 2733 #if (USBD_CLS_ENABLE)
Pawel Zarembski 0:01f31e923fe2 2734 usbd_cls_init();
Pawel Zarembski 0:01f31e923fe2 2735 #endif
Pawel Zarembski 0:01f31e923fe2 2736
Pawel Zarembski 0:01f31e923fe2 2737 }
Pawel Zarembski 0:01f31e923fe2 2738
Pawel Zarembski 0:01f31e923fe2 2739 #endif //USBD_ENABLE
Pawel Zarembski 0:01f31e923fe2 2740
Pawel Zarembski 0:01f31e923fe2 2741 #endif /* __USB_CONFIG__ */