├── App └── Device │ ├── app_usbd.c │ ├── app_usbd.h │ ├── app_usbd_audio.c │ ├── app_usbd_cdc.c │ ├── app_usbd_cdc_eem.c │ ├── app_usbd_hid.c │ ├── app_usbd_msc.c │ ├── app_usbd_phdc.c │ ├── app_usbd_vendor.c │ ├── usbd_audio_drv_simulation.c │ ├── usbd_audio_drv_simulation.h │ └── usbd_audio_drv_simulation_data.c ├── Cfg └── Template │ ├── usbd_audio_dev_cfg.c │ ├── usbd_audio_dev_cfg.h │ ├── usbd_cfg.h │ ├── usbd_dev_cfg.c │ └── usbd_dev_cfg.h ├── Class ├── Audio │ ├── Drivers │ │ ├── NXP-UDA1380-Codec │ │ │ ├── usbd_audio_drv_uda1380_codec.c │ │ │ └── usbd_audio_drv_uda1380_codec.h │ │ └── Template │ │ │ ├── usbd_audio_drv_template.c │ │ │ └── usbd_audio_drv_template.h │ ├── OS │ │ ├── Template │ │ │ └── usbd_audio_os.c │ │ ├── uCOS-II │ │ │ └── usbd_audio_os.c │ │ └── uCOS-III │ │ │ └── usbd_audio_os.c │ ├── usbd_audio.c │ ├── usbd_audio.h │ ├── usbd_audio_internal.h │ ├── usbd_audio_os.h │ ├── usbd_audio_processing.c │ └── usbd_audio_processing.h ├── CDC-EEM │ ├── usbd_cdc_eem.c │ └── usbd_cdc_eem.h ├── CDC │ ├── ACM │ │ ├── usbd_acm_serial.c │ │ └── usbd_acm_serial.h │ ├── usbd_cdc.c │ └── usbd_cdc.h ├── HID │ ├── OS │ │ ├── Template │ │ │ └── usbd_hid_os.c │ │ ├── uCOS-II │ │ │ └── usbd_hid_os.c │ │ └── uCOS-III │ │ │ └── usbd_hid_os.c │ ├── usbd_hid.c │ ├── usbd_hid.h │ ├── usbd_hid_os.h │ ├── usbd_hid_report.c │ └── usbd_hid_report.h ├── MSC │ ├── OS │ │ ├── Template │ │ │ └── usbd_msc_os.c │ │ ├── uCOS-II │ │ │ └── usbd_msc_os.c │ │ └── uCOS-III │ │ │ └── usbd_msc_os.c │ ├── Storage │ │ ├── RAMDisk │ │ │ ├── usbd_storage.c │ │ │ └── usbd_storage.h │ │ ├── Template │ │ │ ├── usbd_storage.c │ │ │ └── usbd_storage.h │ │ └── uC-FS │ │ │ └── V4 │ │ │ ├── usbd_storage.c │ │ │ └── usbd_storage.h │ ├── usbd_msc.c │ ├── usbd_msc.h │ ├── usbd_msc_os.h │ ├── usbd_scsi.c │ └── usbd_scsi.h ├── PHDC │ ├── OS │ │ ├── Template │ │ │ └── usbd_phdc_os.c │ │ └── uCOS-II │ │ │ └── usbd_phdc_os.c │ ├── usbd_phdc.c │ ├── usbd_phdc.h │ └── usbd_phdc_os.h └── Vendor │ ├── usbd_vendor.c │ └── usbd_vendor.h ├── Drivers ├── AT32UC3C │ ├── usbd_drv_at32uc3c.c │ └── usbd_drv_at32uc3c.h ├── AT32UC3x │ ├── usbd_drv_at32uc3x.c │ └── usbd_drv_at32uc3x.h ├── AT91SAM_UDPHS │ ├── usbd_at91sam_udphs.c │ └── usbd_at91sam_udphs.h ├── Kinetis_Kxx │ ├── usbd_drv_kinetis_kxx.c │ └── usbd_drv_kinetis_kxx.h ├── LPCxxxx │ ├── usbd_drv_lpcxxxx.c │ └── usbd_drv_lpcxxxx.h ├── RM48x │ ├── usbd_drv_rm48x.c │ └── usbd_drv_rm48x.h ├── RX600 │ ├── usbd_drv_rx600.c │ └── usbd_drv_rx600.h ├── Renesas_USBHS │ ├── usbd_drv_renesas_usbhs.c │ └── usbd_drv_renesas_usbhs.h ├── STM32F_FS │ ├── usbd_drv_stm32f_fs.c │ └── usbd_drv_stm32f_fs.h ├── STM32xxx │ ├── usbd_drv_stm32xxx.c │ └── usbd_drv_stm32xxx.h ├── STR91xxx │ ├── usbd_drv_str91xxx.c │ └── usbd_drv_str91xxx.h ├── Synopsys_OTG_HS │ ├── usbd_drv_synopsys_otg_hs.c │ └── usbd_drv_synopsys_otg_hs.h ├── TM4C123x │ ├── usbd_drv_tm4c123x.c │ └── usbd_drv_tm4c123x.h ├── Template │ ├── bsp_usbd_template.c │ ├── bsp_usbd_template.h │ ├── usbd_drv_template.c │ └── usbd_drv_template.h └── drv_lib │ ├── usbd_drv_lib.c │ └── usbd_drv_lib.h ├── LICENSE ├── NOTICE ├── OS ├── Template │ └── usbd_os.c ├── uCOS-II │ └── usbd_os.c └── uCOS-III │ └── usbd_os.c ├── README.rst └── Source ├── usbd_core.c ├── usbd_core.h ├── usbd_ep.c └── usbd_internal.h /App/Device/app_usbd_cdc_eem.c: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * EXAMPLE CODE 4 | * 5 | * This file is provided as an example on how to use Micrium products. 6 | * 7 | * Please feel free to use any application code labeled as 'EXAMPLE CODE' in 8 | * your application products. Example code may be used as is, in whole or in 9 | * part, or may be used as a reference only. This file can be modified as 10 | * required to meet the end-product requirements. 11 | * 12 | ********************************************************************************************************* 13 | */ 14 | 15 | /* 16 | ********************************************************************************************************* 17 | * 18 | * USB DEVICE CDC EEM CLASS APPLICATION INITIALIZATION 19 | * 20 | * TEMPLATE 21 | * 22 | * Filename : app_usbd_cdc_eem.c 23 | * Version : V4.06.01 24 | ********************************************************************************************************* 25 | */ 26 | 27 | /* 28 | ********************************************************************************************************* 29 | * INCLUDE FILES 30 | ********************************************************************************************************* 31 | */ 32 | 33 | #include 34 | 35 | #if (APP_CFG_USBD_EN == DEF_ENABLED) && \ 36 | (APP_CFG_USBD_CDC_EEM_EN == DEF_ENABLED) 37 | #include 38 | 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | 47 | 48 | /* 49 | ********************************************************************************************************* 50 | * LOCAL DEFINES 51 | ********************************************************************************************************* 52 | */ 53 | 54 | 55 | /* 56 | ********************************************************************************************************* 57 | * LOCAL GLOBAL VARIABLES 58 | ********************************************************************************************************* 59 | */ 60 | 61 | 62 | /* 63 | ********************************************************************************************************* 64 | * LOCAL FUNCTION PROTOTYPES 65 | ********************************************************************************************************* 66 | */ 67 | 68 | 69 | /* 70 | ********************************************************************************************************* 71 | * LOCAL CONFIGURATION ERRORS 72 | ********************************************************************************************************* 73 | */ 74 | 75 | 76 | /* 77 | ********************************************************************************************************* 78 | * App_USBD_CDC_EEM_Init() 79 | * 80 | * Description : Initialize USB device CDC EEM subclass. 81 | * 82 | * Argument(s) : dev_nbr Device number. 83 | * 84 | * cfg_hs Index of high-speed configuration to which this interface will be added to. 85 | * 86 | * cfg_fs Index of high-speed configuration to which this interface will be added to. 87 | * 88 | * Return(s) : DEF_OK, if successful. 89 | * DEF_FAIL, otherwise. 90 | * 91 | * Note(s) : (1) This function assumes that uC/TCP-IP with USBD_CDCEEM driver is part of the project 92 | * and that it has been initialized. 93 | * 94 | * (2) This example will set a static IPv4 address to the interface. For more examples that 95 | * uses IPv6 and/or assignation of address via DHCP, see uC/TCP-IPs application 96 | * examples. 97 | ********************************************************************************************************* 98 | */ 99 | 100 | CPU_BOOLEAN App_USBD_CDC_EEM_Init (CPU_INT08U dev_nbr, 101 | CPU_INT08U cfg_hs, 102 | CPU_INT08U cfg_fs) 103 | { 104 | CPU_BOOLEAN valid; 105 | CPU_INT08U cdc_eem_nbr; 106 | USBD_ERR err; 107 | NET_IF_NBR net_if_nbr; 108 | NET_IPv4_ADDR addr; 109 | NET_IPv4_ADDR subnet_mask; 110 | NET_IPv4_ADDR dflt_gateway; 111 | NET_ERR err_net; 112 | 113 | 114 | APP_TRACE_DBG((" Initializing CDC EEM class ... \r\n")); 115 | 116 | USBD_CDC_EEM_Init(&err); 117 | if (err != USBD_ERR_NONE) { 118 | APP_TRACE_DBG((" ... could not initialize CDC EEM class w/err = %d\r\n\r\n", err)); 119 | return (DEF_FAIL); 120 | } 121 | 122 | cdc_eem_nbr = USBD_CDC_EEM_Add(&err); 123 | if (err != USBD_ERR_NONE) { 124 | APP_TRACE_DBG((" ... could not create CDC EEM class instance w/err = %d\r\n\r\n", err)); 125 | return (DEF_FAIL); 126 | } 127 | 128 | /* Add CDC EEM class instance to USB configuration(s). */ 129 | if (cfg_hs != USBD_CFG_NBR_NONE) { 130 | USBD_CDC_EEM_CfgAdd(cdc_eem_nbr, 131 | dev_nbr, 132 | cfg_hs, 133 | "CDC EEM interface", 134 | &err); 135 | if (err != USBD_ERR_NONE) { 136 | APP_TRACE_DBG((" ... could not add CDC EEM instance #%d to HS configuration w/err = %d\r\n\r\n", cdc_eem_nbr, err)); 137 | return (DEF_FAIL); 138 | } 139 | } 140 | 141 | if (cfg_fs != USBD_CFG_NBR_NONE) { 142 | USBD_CDC_EEM_CfgAdd(cdc_eem_nbr, 143 | dev_nbr, 144 | cfg_fs, 145 | "CDC EEM interface", 146 | &err); 147 | if (err != USBD_ERR_NONE) { 148 | APP_TRACE_DBG((" ... could not add CDC EEM instance #%d to FS configuration w/err = %d\r\n\r\n", cdc_eem_nbr, err)); 149 | return (DEF_FAIL); 150 | } 151 | } 152 | 153 | /* Add uC/TCP-IP interface using CDC EEM. */ 154 | NetDev_Cfg_Ether_USBD_CDCEEM.ClassNbr = cdc_eem_nbr; /* Set CDC EEM class instance number to drv cfg. */ 155 | net_if_nbr = NetIF_Add((void *)&NetIF_API_Ether, 156 | (void *)&NetDev_API_USBD_CDCEEM, 157 | DEF_NULL, 158 | (void *)&NetDev_Cfg_Ether_USBD_CDCEEM, 159 | DEF_NULL, 160 | DEF_NULL, 161 | &err_net); 162 | if (err_net != NET_IF_ERR_NONE) { 163 | APP_TRACE_DBG((" ... could not add TCP IP IF w/err = %d\r\n\r\n", err_net)); 164 | return (DEF_FAIL); 165 | } 166 | 167 | 168 | /* Set static address to device. */ 169 | addr = NetASCII_Str_to_IPv4("192.168.0.10", 170 | &err_net); 171 | subnet_mask = NetASCII_Str_to_IPv4("255.255.255.0", 172 | &err_net); 173 | dflt_gateway = NetASCII_Str_to_IPv4("192.168.0.1", 174 | &err_net); 175 | 176 | NetIPv4_CfgAddrAdd(net_if_nbr, 177 | addr, 178 | subnet_mask, 179 | dflt_gateway, 180 | &err_net); 181 | if (err_net != NET_IPv4_ERR_NONE) { 182 | APP_TRACE_DBG((" ... could not add static IPv4 address to TCP IP IF w/err = %d\r\n\r\n", err_net)); 183 | return (DEF_FAIL); 184 | } 185 | 186 | NetIF_Start(net_if_nbr, &err_net); /* Start uC/TCP-IP interface. */ 187 | if (err_net != NET_IF_ERR_NONE) { 188 | APP_TRACE_DBG((" ... could not start TCP IP IF w/err = %d\r\n\r\n", err_net)); 189 | return (DEF_FAIL); 190 | } 191 | 192 | return (DEF_OK); 193 | } 194 | #endif 195 | -------------------------------------------------------------------------------- /App/Device/app_usbd_msc.c: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * EXAMPLE CODE 4 | * 5 | * This file is provided as an example on how to use Micrium products. 6 | * 7 | * Please feel free to use any application code labeled as 'EXAMPLE CODE' in 8 | * your application products. Example code may be used as is, in whole or in 9 | * part, or may be used as a reference only. This file can be modified as 10 | * required to meet the end-product requirements. 11 | * 12 | ********************************************************************************************************* 13 | */ 14 | 15 | /* 16 | ********************************************************************************************************* 17 | * 18 | * USB DEVICE MSC CLASS APPLICATION INITIALIZATION 19 | * 20 | * TEMPLATE 21 | * 22 | * Filename : app_usbd_msc.c 23 | * Version : V4.06.01 24 | ********************************************************************************************************* 25 | */ 26 | 27 | /* 28 | ********************************************************************************************************* 29 | * INCLUDE FILES 30 | ********************************************************************************************************* 31 | */ 32 | 33 | #include 34 | 35 | #if (APP_CFG_USBD_EN == DEF_ENABLED) && \ 36 | (APP_CFG_USBD_MSC_EN == DEF_ENABLED) 37 | #include 38 | 39 | 40 | /* 41 | ********************************************************************************************************* 42 | * LOCAL DEFINES 43 | ********************************************************************************************************* 44 | */ 45 | 46 | 47 | /* 48 | ********************************************************************************************************* 49 | * LOCAL GLOBAL VARIABLES 50 | ********************************************************************************************************* 51 | */ 52 | 53 | 54 | /* 55 | ********************************************************************************************************* 56 | * LOCAL FUNCTION PROTOTYPES 57 | ********************************************************************************************************* 58 | */ 59 | 60 | 61 | /* 62 | ********************************************************************************************************* 63 | * LOCAL CONFIGURATION ERRORS 64 | ********************************************************************************************************* 65 | */ 66 | 67 | 68 | /* 69 | ********************************************************************************************************* 70 | * App_USBD_MSC_Init() 71 | * 72 | * Description : Initialize USB device mass storage class. 73 | * 74 | * Argument(s) : p_dev Pointer to USB device. 75 | * 76 | * cfg_hs Index of high-speed configuration to which this interface will be added to. 77 | * 78 | * cfg_fs Index of high-speed configuration to which this interface will be added to. 79 | * 80 | * Return(s) : DEF_OK, if the Mass storage interface was added. 81 | * DEF_FAIL, if the Mass storage interface could not be added. 82 | * 83 | * Note(s) : none. 84 | ********************************************************************************************************* 85 | */ 86 | 87 | CPU_BOOLEAN App_USBD_MSC_Init (CPU_INT08U dev_nbr, 88 | CPU_INT08U cfg_hs, 89 | CPU_INT08U cfg_fs) 90 | { 91 | USBD_ERR err; 92 | CPU_INT08U msc_nbr; 93 | CPU_BOOLEAN valid; 94 | 95 | 96 | APP_TRACE_DBG((" Initializing MSC class ... \r\n")); 97 | 98 | USBD_MSC_Init(&err); 99 | if (err != USBD_ERR_NONE) { 100 | APP_TRACE_DBG((" ... could not initialize MSC class w/err = %d\r\n\r\n", err)); 101 | return (DEF_FAIL); 102 | } 103 | 104 | msc_nbr = USBD_MSC_Add(&err); 105 | 106 | if (cfg_hs != USBD_CFG_NBR_NONE) { 107 | valid = USBD_MSC_CfgAdd (msc_nbr, 108 | dev_nbr, 109 | cfg_hs, 110 | &err); 111 | 112 | if (valid != DEF_YES) { 113 | APP_TRACE_DBG((" ... could not add msc instance #%d to HS configuration w/err = %d\r\n\r\n", msc_nbr, err)); 114 | return (DEF_FAIL); 115 | } 116 | } 117 | 118 | if (cfg_fs != USBD_CFG_NBR_NONE) { 119 | valid = USBD_MSC_CfgAdd (msc_nbr, 120 | dev_nbr, 121 | cfg_fs, 122 | &err); 123 | 124 | if (valid != DEF_YES) { 125 | APP_TRACE_DBG((" ... could not add msc instance #%d to FS configuration w/err = %d\r\n\r\n", msc_nbr, err)); 126 | return (DEF_FAIL); 127 | } 128 | } 129 | /* Add Logical Unit to MSC interface. */ 130 | USBD_MSC_LunAdd((void *)"ram:0:", 131 | msc_nbr, 132 | (void *)"Micrium", 133 | (void *)"MSC FS Storage", 134 | 0x00, 135 | DEF_FALSE, 136 | &err); 137 | if (err != USBD_ERR_NONE) { 138 | APP_TRACE_DBG((" ... could not add LU to MSC class w/err = %d\r\n\r\n", err)); 139 | return (DEF_FAIL); 140 | } 141 | 142 | return (DEF_OK); 143 | } 144 | 145 | #endif 146 | -------------------------------------------------------------------------------- /App/Device/usbd_audio_drv_simulation.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * EXAMPLE CODE 4 | * 5 | * This file is provided as an example on how to use Micrium products. 6 | * 7 | * Please feel free to use any application code labeled as 'EXAMPLE CODE' in 8 | * your application products. Example code may be used as is, in whole or in 9 | * part, or may be used as a reference only. This file can be modified as 10 | * required to meet the end-product requirements. 11 | * 12 | ********************************************************************************************************* 13 | */ 14 | 15 | /* 16 | ********************************************************************************************************* 17 | * 18 | * USB AUDIO SIMULATION DRIVER 19 | * 20 | * Filename : usbd_audio_drv_simulation.h 21 | * Version : V4.06.01 22 | ********************************************************************************************************* 23 | */ 24 | 25 | /* 26 | ********************************************************************************************************* 27 | * MODULE 28 | ********************************************************************************************************* 29 | */ 30 | 31 | #ifndef USBD_AUDIO_DRV_SIMULATION_MODULE_PRESENT /* See Note #1. */ 32 | #define USBD_AUDIO_DRV_SIMULATION_MODULE_PRESENT 33 | 34 | 35 | /* 36 | ********************************************************************************************************* 37 | * INCLUDE FILES 38 | ********************************************************************************************************* 39 | */ 40 | 41 | #include "app_usbd.h" 42 | 43 | #if (APP_CFG_USBD_AUDIO_EN == DEF_ENABLED) 44 | #include 45 | 46 | 47 | /* 48 | ********************************************************************************************************* 49 | * EXTERNS 50 | ********************************************************************************************************* 51 | */ 52 | 53 | 54 | /* 55 | ********************************************************************************************************* 56 | * DEFINES 57 | ********************************************************************************************************* 58 | */ 59 | 60 | 61 | /* 62 | ********************************************************************************************************* 63 | * DATA TYPES 64 | ********************************************************************************************************* 65 | */ 66 | 67 | 68 | /* 69 | ********************************************************************************************************* 70 | * GLOBAL VARIABLES 71 | ********************************************************************************************************* 72 | */ 73 | 74 | 75 | /* 76 | ********************************************************************************************************* 77 | * MACROS 78 | ********************************************************************************************************* 79 | */ 80 | 81 | 82 | /* 83 | ********************************************************************************************************* 84 | * FUNCTION PROTOTYPES 85 | ********************************************************************************************************* 86 | */ 87 | 88 | 89 | /* 90 | ********************************************************************************************************* 91 | * CONFIGURATION ERRORS 92 | ********************************************************************************************************* 93 | */ 94 | 95 | 96 | /* 97 | ********************************************************************************************************* 98 | * USB AUDIO FUNCTION TOPOLOGY 1 CONFIGURATION 99 | ********************************************************************************************************* 100 | */ 101 | 102 | extern const USBD_AUDIO_DRV_COMMON_API USBD_Audio_DrvCommonAPI_Simulation; 103 | extern const USBD_AUDIO_DRV_AC_FU_API USBD_Audio_DrvFU_API_Simulation; 104 | extern const USBD_AUDIO_DRV_AS_API USBD_Audio_DrvAS_API_Simulation; 105 | 106 | 107 | /* 108 | ********************************************************************************************************* 109 | * MODULE END 110 | ********************************************************************************************************* 111 | */ 112 | 113 | #endif 114 | #endif 115 | -------------------------------------------------------------------------------- /Cfg/Template/usbd_audio_dev_cfg.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * uC/USB-Device 4 | * The Embedded USB Device Stack 5 | * 6 | * Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com 7 | * 8 | * SPDX-License-Identifier: APACHE-2.0 9 | * 10 | * This software is subject to an open source license and is distributed by 11 | * Silicon Laboratories Inc. pursuant to the terms of the Apache License, 12 | * Version 2.0 available at www.apache.org/licenses/LICENSE-2.0. 13 | * 14 | ********************************************************************************************************* 15 | */ 16 | 17 | /* 18 | ********************************************************************************************************* 19 | * 20 | * USB AUDIO DEVICE CONFIGURATION FILE 21 | * 22 | * Filename : usbd_audio_dev_cfg.h 23 | * Version : V4.06.01 24 | ********************************************************************************************************* 25 | */ 26 | 27 | /* 28 | ********************************************************************************************************* 29 | ********************************************************************************************************* 30 | * MODULE 31 | ********************************************************************************************************* 32 | ********************************************************************************************************* 33 | */ 34 | 35 | #ifndef USBD_AUDIO_DEV_CFG_MODULE_PRESENT /* See Note #1. */ 36 | #define USBD_AUDIO_DEV_CFG_MODULE_PRESENT 37 | 38 | 39 | /* 40 | ********************************************************************************************************* 41 | ********************************************************************************************************* 42 | * INCLUDE FILES 43 | ********************************************************************************************************* 44 | ********************************************************************************************************* 45 | */ 46 | 47 | #include 48 | #include "app_usbd.h" 49 | 50 | 51 | /* 52 | ********************************************************************************************************* 53 | ********************************************************************************************************* 54 | * DEFINES 55 | ********************************************************************************************************* 56 | ********************************************************************************************************* 57 | */ 58 | 59 | #define USBD_AUDIO_DEV_CFG_RECORD_CORR_PERIOD 16u /* Record correction period in ms. */ 60 | #define USBD_AUDIO_DEV_CFG_RECORD_EXTRA_PCK 0u 61 | 62 | #define USBD_AUDIO_DEV_CFG_RECORD_NBR_BUF USBD_AUDIO_STREAM_NBR_BUF_18 63 | 64 | #if (APP_CFG_USBD_AUDIO_SIMULATION_LOOP_EN == DEF_ENABLED) 65 | #define USBD_AUDIO_DEV_CFG_PLAYBACK_CORR_PERIOD 16u /* Playback correction period in ms. */ 66 | #define USBD_AUDIO_DEV_CFG_PLAYBACK_EXTRA_PCK 0u 67 | #define USBD_AUDIO_DEV_CFG_NBR_ENTITY 6u /* Nbr of entities (units/terminals) used by audio fnct.*/ 68 | #define USBD_AUDIO_DEV_CFG_PLAYBACK_NBR_BUF USBD_AUDIO_STREAM_NBR_BUF_18 69 | #else 70 | #define USBD_AUDIO_DEV_CFG_NBR_ENTITY 3u /* Nbr of entities (units/terminals) used by audio fnct.*/ 71 | #endif 72 | 73 | 74 | /* 75 | ********************************************************************************************************* 76 | * USB AUDIO FUNCTION TOPOLOGY 1 CONFIGURATION 77 | ********************************************************************************************************* 78 | */ 79 | 80 | /* -------------- TERMINAL AND UNIT IDS --------------- */ 81 | extern CPU_INT08U Mic_IT_ID; 82 | extern CPU_INT08U Mic_OT_USB_IN_ID; 83 | extern CPU_INT08U Mic_FU_ID; 84 | #if (APP_CFG_USBD_AUDIO_SIMULATION_LOOP_EN == DEF_ENABLED) 85 | extern CPU_INT08U Speaker_IT_USB_OUT_ID; 86 | extern CPU_INT08U Speaker_OT_ID; 87 | extern CPU_INT08U Speaker_FU_ID; 88 | #endif 89 | 90 | 91 | /* ----------- TERMINAL, UNIT AND AS IF CFG ----------- */ 92 | extern const USBD_AUDIO_IT_CFG USBD_IT_MIC_Cfg; 93 | extern const USBD_AUDIO_OT_CFG USBD_OT_USB_IN_Cfg; 94 | extern const USBD_AUDIO_FU_CFG USBD_FU_MIC_Cfg; 95 | extern const USBD_AUDIO_STREAM_CFG USBD_MicStreamCfg; 96 | extern const USBD_AUDIO_AS_IF_CFG USBD_AS_IF2_MicCfg; 97 | #if (APP_CFG_USBD_AUDIO_SIMULATION_LOOP_EN == DEF_ENABLED) 98 | extern const USBD_AUDIO_IT_CFG USBD_IT_USB_OUT_Cfg; 99 | extern const USBD_AUDIO_OT_CFG USBD_OT_SPEAKER_Cfg; 100 | extern const USBD_AUDIO_FU_CFG USBD_FU_SPEAKER_Cfg; 101 | extern const USBD_AUDIO_STREAM_CFG USBD_SpeakerStreamCfg; 102 | extern const USBD_AUDIO_AS_IF_CFG USBD_AS_IF1_SpeakerCfg; 103 | #endif 104 | 105 | 106 | /* 107 | ********************************************************************************************************* 108 | ********************************************************************************************************* 109 | * MODULE END 110 | ********************************************************************************************************* 111 | ********************************************************************************************************* 112 | */ 113 | 114 | #endif 115 | -------------------------------------------------------------------------------- /Cfg/Template/usbd_dev_cfg.c: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * uC/USB-Device 4 | * The Embedded USB Device Stack 5 | * 6 | * Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com 7 | * 8 | * SPDX-License-Identifier: APACHE-2.0 9 | * 10 | * This software is subject to an open source license and is distributed by 11 | * Silicon Laboratories Inc. pursuant to the terms of the Apache License, 12 | * Version 2.0 available at www.apache.org/licenses/LICENSE-2.0. 13 | * 14 | ********************************************************************************************************* 15 | */ 16 | 17 | /* 18 | ********************************************************************************************************* 19 | * 20 | * USB DEVICE CONFIGURATION FILE 21 | * 22 | * TEMPLATE 23 | * 24 | * Filename : usbd_dev_cfg.c 25 | * Version : V4.06.01 26 | ********************************************************************************************************* 27 | */ 28 | 29 | #include 30 | #include 31 | #include 32 | 33 | 34 | /* 35 | ********************************************************************************************************* 36 | * USB DEVICE CONFIGURATION 37 | ********************************************************************************************************* 38 | */ 39 | 40 | const USBD_DEV_CFG USBD_DevCfg_Template = { 41 | 0xFFFE, /* Vendor ID. */ 42 | 0x1234, /* Product ID. */ 43 | 0x0100, /* Device release number. */ 44 | "MICRIUM MANUFACTURER", /* Manufacturer string. */ 45 | "MICRIUM PRODUCT", /* Product string. */ 46 | "1234567890ABCDEF", /* Serial number string. */ 47 | USBD_LANG_ID_ENGLISH_US /* String language ID. */ 48 | }; 49 | 50 | 51 | /* 52 | ********************************************************************************************************* 53 | * USB DEVICE DRIVER CONFIGURATION 54 | ********************************************************************************************************* 55 | */ 56 | 57 | const USBD_DRV_CFG USBD_DrvCfg_Template = { 58 | 0x00000000, /* Base addr of device controller hw registers. */ 59 | 0x00000000, /* Base addr of device controller dedicated mem. */ 60 | 0u, /* Size of device controller dedicated mem. */ 61 | 62 | USBD_DEV_SPD_FULL, /* Speed of device controller. */ 63 | 64 | USBD_DrvEP_InfoTbl_Template /* EP Info tbl of device controller. */ 65 | }; 66 | -------------------------------------------------------------------------------- /Cfg/Template/usbd_dev_cfg.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * uC/USB-Device 4 | * The Embedded USB Device Stack 5 | * 6 | * Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com 7 | * 8 | * SPDX-License-Identifier: APACHE-2.0 9 | * 10 | * This software is subject to an open source license and is distributed by 11 | * Silicon Laboratories Inc. pursuant to the terms of the Apache License, 12 | * Version 2.0 available at www.apache.org/licenses/LICENSE-2.0. 13 | * 14 | ********************************************************************************************************* 15 | */ 16 | 17 | /* 18 | ********************************************************************************************************* 19 | * 20 | * USB DEVICE CONFIGURATION FILE 21 | * 22 | * TEMPLATE 23 | * 24 | * Filename : usbd_dev_cfg.h 25 | * Version : V4.06.01 26 | ********************************************************************************************************* 27 | */ 28 | 29 | /* 30 | ********************************************************************************************************* 31 | * MODULE 32 | * 33 | * Note(s) : (1) This USB device configuration header file is protected from multiple pre-processor 34 | * inclusion through use of the USB device configuration module present pre-processor 35 | * macro definition. 36 | ********************************************************************************************************* 37 | */ 38 | 39 | #ifndef USBD_DEV_CFG_MODULE_PRESENT /* See Note #1. */ 40 | #define USBD_DEV_CFG_MODULE_PRESENT 41 | 42 | 43 | /* 44 | ********************************************************************************************************* 45 | * USB DEVICE CONFIGURATION 46 | ********************************************************************************************************* 47 | */ 48 | 49 | extern const USBD_DEV_CFG USBD_DevCfg_Template; 50 | 51 | 52 | /* 53 | ********************************************************************************************************* 54 | * USB DEVICE DRIVER CONFIGURATION 55 | ********************************************************************************************************* 56 | */ 57 | 58 | extern const USBD_DRV_CFG USBD_DrvCfg_Template; 59 | 60 | 61 | /* 62 | ********************************************************************************************************* 63 | * MODULE END 64 | ********************************************************************************************************* 65 | */ 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /Class/Audio/Drivers/NXP-UDA1380-Codec/usbd_audio_drv_uda1380_codec.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * EXAMPLE CODE 4 | * 5 | * This file is provided as an example on how to use Micrium products. 6 | * 7 | * Please feel free to use any application code labeled as 'EXAMPLE CODE' in 8 | * your application products. Example code may be used as is, in whole or in 9 | * part, or may be used as a reference only. This file can be modified as 10 | * required to meet the end-product requirements. 11 | * 12 | ********************************************************************************************************* 13 | */ 14 | 15 | /* 16 | ********************************************************************************************************* 17 | * 18 | * USB AUDIO DEVICE CONFIGURATION FILE 19 | * 20 | * Filename : usbd_audio_drv_uda1380_codec.h 21 | * Version : V4.06.01 22 | ********************************************************************************************************* 23 | */ 24 | 25 | /* 26 | ********************************************************************************************************* 27 | * MODULE 28 | * 29 | * Note(s) : (1) This USB device configuration header file is protected from multiple pre-processor 30 | * inclusion through use of the USB device configuration module present pre-processor 31 | * macro definition. 32 | ********************************************************************************************************* 33 | */ 34 | 35 | #ifndef USBD_AUDIO_DRV_TEMPLATE_MODULE_PRESENT /* See Note #1. */ 36 | #define USBD_AUDIO_DRV_TEMPLATE_MODULE_PRESENT 37 | 38 | 39 | /* 40 | ********************************************************************************************************* 41 | * INCLUDE FILES 42 | ********************************************************************************************************* 43 | */ 44 | 45 | #include "../../usbd_audio_processing.h" 46 | 47 | 48 | /* 49 | ********************************************************************************************************* 50 | * USB AUDIO FUNCTION TOPOLOGY 1 CONFIGURATION 51 | ********************************************************************************************************* 52 | */ 53 | 54 | extern const USBD_AUDIO_DRV_COMMON_API USBD_Audio_DrvCommonAPI_UDA1380_Codec; 55 | extern const USBD_AUDIO_DRV_AC_FU_API USBD_Audio_DrvFU_API_UDA1380_Codec; 56 | extern const USBD_AUDIO_DRV_AS_API USBD_Audio_DrvAS_API_UDA1380_Codec; 57 | 58 | /* 59 | ********************************************************************************************************* 60 | * MODULE END 61 | ********************************************************************************************************* 62 | */ 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /Class/Audio/Drivers/Template/usbd_audio_drv_template.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * EXAMPLE CODE 4 | * 5 | * This file is provided as an example on how to use Micrium products. 6 | * 7 | * Please feel free to use any application code labeled as 'EXAMPLE CODE' in 8 | * your application products. Example code may be used as is, in whole or in 9 | * part, or may be used as a reference only. This file can be modified as 10 | * required to meet the end-product requirements. 11 | * 12 | ********************************************************************************************************* 13 | */ 14 | 15 | /* 16 | ********************************************************************************************************* 17 | * 18 | * USB AUDIO CODEC DRIVER TEMPLATE 19 | * 20 | * Filename : usbd_audio_drv_template.h 21 | * Version : V4.06.01 22 | ********************************************************************************************************* 23 | */ 24 | 25 | /* 26 | ********************************************************************************************************* 27 | * MODULE 28 | * 29 | * Note(s) : (1) This USB device configuration header file is protected from multiple pre-processor 30 | * inclusion through use of the USB device configuration module present pre-processor 31 | * macro definition. 32 | ********************************************************************************************************* 33 | */ 34 | 35 | #ifndef USBD_AUDIO_DRV_TEMPLATE_MODULE_PRESENT /* See Note #1. */ 36 | #define USBD_AUDIO_DRV_TEMPLATE_MODULE_PRESENT 37 | 38 | 39 | /* 40 | ********************************************************************************************************* 41 | * INCLUDE FILES 42 | ********************************************************************************************************* 43 | */ 44 | 45 | #include "../../usbd_audio_processing.h" 46 | 47 | 48 | /* 49 | ********************************************************************************************************* 50 | * USB AUDIO FUNCTION TOPOLOGY 1 CONFIGURATION 51 | ********************************************************************************************************* 52 | */ 53 | 54 | extern const USBD_AUDIO_DRV_COMMON_API USBD_Audio_DrvCommonAPI_Template; 55 | extern const USBD_AUDIO_DRV_AC_OT_API USBD_Audio_DrvOT_API_Template; 56 | extern const USBD_AUDIO_DRV_AC_FU_API USBD_Audio_DrvFU_API_Template; 57 | extern const USBD_AUDIO_DRV_AC_MU_API USBD_Audio_DrvMU_API_Template; 58 | extern const USBD_AUDIO_DRV_AC_SU_API USBD_Audio_DrvSU_API_Template; 59 | extern const USBD_AUDIO_DRV_AS_API USBD_Audio_DrvAS_API_Template; 60 | 61 | 62 | /* 63 | ********************************************************************************************************* 64 | * MODULE END 65 | ********************************************************************************************************* 66 | */ 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /Class/Audio/usbd_audio_os.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * uC/USB-Device 4 | * The Embedded USB Device Stack 5 | * 6 | * Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com 7 | * 8 | * SPDX-License-Identifier: APACHE-2.0 9 | * 10 | * This software is subject to an open source license and is distributed by 11 | * Silicon Laboratories Inc. pursuant to the terms of the Apache License, 12 | * Version 2.0 available at www.apache.org/licenses/LICENSE-2.0. 13 | * 14 | ********************************************************************************************************* 15 | */ 16 | 17 | /* 18 | ********************************************************************************************************* 19 | * 20 | * USB DEVICE AUDIO CLASS 21 | * 22 | * Filename : usbd_audio_os.h 23 | * Version : V4.06.01 24 | ********************************************************************************************************* 25 | */ 26 | 27 | /* 28 | ********************************************************************************************************* 29 | ********************************************************************************************************* 30 | * MODULE 31 | ********************************************************************************************************* 32 | ********************************************************************************************************* 33 | */ 34 | 35 | #ifndef USBD_AUDIO_OS_MODULE_PRESENT 36 | #define USBD_AUDIO_OS_MODULE_PRESENT 37 | 38 | 39 | /* 40 | ********************************************************************************************************* 41 | ********************************************************************************************************* 42 | * INCLUDE FILES 43 | ********************************************************************************************************* 44 | ********************************************************************************************************* 45 | */ 46 | 47 | 48 | /* 49 | ********************************************************************************************************* 50 | ********************************************************************************************************* 51 | * EXTERNS 52 | ********************************************************************************************************* 53 | ********************************************************************************************************* 54 | */ 55 | 56 | 57 | /* 58 | ********************************************************************************************************* 59 | ********************************************************************************************************* 60 | * DEFINES 61 | ********************************************************************************************************* 62 | ********************************************************************************************************* 63 | */ 64 | 65 | 66 | /* 67 | ********************************************************************************************************* 68 | ********************************************************************************************************* 69 | * DATA TYPES 70 | ********************************************************************************************************* 71 | ********************************************************************************************************* 72 | */ 73 | 74 | 75 | /* 76 | ********************************************************************************************************* 77 | ********************************************************************************************************* 78 | * GLOBAL VARIABLES 79 | ********************************************************************************************************* 80 | ********************************************************************************************************* 81 | */ 82 | 83 | 84 | /* 85 | ********************************************************************************************************* 86 | ********************************************************************************************************* 87 | * MACRO'S 88 | ********************************************************************************************************* 89 | ********************************************************************************************************* 90 | */ 91 | 92 | 93 | /* 94 | ********************************************************************************************************* 95 | ********************************************************************************************************* 96 | * FUNCTION PROTOTYPES 97 | ********************************************************************************************************* 98 | ********************************************************************************************************* 99 | */ 100 | 101 | void USBD_Audio_OS_Init (CPU_INT16U msg_qty, 102 | USBD_ERR *p_err); 103 | 104 | void USBD_Audio_OS_AS_IF_LockCreate (CPU_INT08U as_if_nbr, 105 | USBD_ERR *p_err); 106 | 107 | void USBD_Audio_OS_AS_IF_LockAcquire (CPU_INT08U as_if_nbr, 108 | CPU_INT16U timeout_ms, 109 | USBD_ERR *p_err); 110 | 111 | void USBD_Audio_OS_AS_IF_LockRelease (CPU_INT08U as_if_nbr); 112 | 113 | void USBD_Audio_OS_RingBufQLockCreate (CPU_INT08U as_if_settings_ix, 114 | USBD_ERR *p_err); 115 | 116 | void USBD_Audio_OS_RingBufQLockAcquire(CPU_INT08U as_if_settings_ix, 117 | CPU_INT16U timeout_ms, 118 | USBD_ERR *p_err); 119 | 120 | void USBD_Audio_OS_RingBufQLockRelease(CPU_INT08U as_if_settings_ix); 121 | 122 | #if (USBD_AUDIO_CFG_RECORD_EN == DEF_ENABLED) 123 | void USBD_Audio_OS_RecordReqPost (void *p_msg, 124 | USBD_ERR *p_err); 125 | 126 | void *USBD_Audio_OS_RecordReqPend (USBD_ERR *p_err); 127 | #endif 128 | 129 | #if (USBD_AUDIO_CFG_PLAYBACK_EN == DEF_ENABLED) 130 | void USBD_Audio_OS_PlaybackReqPost (void *p_msg, 131 | USBD_ERR *p_err); 132 | 133 | void *USBD_Audio_OS_PlaybackReqPend (USBD_ERR *p_err); 134 | #endif 135 | 136 | void USBD_Audio_OS_DlyMs (CPU_INT32U ms); 137 | 138 | 139 | /* 140 | ********************************************************************************************************* 141 | ********************************************************************************************************* 142 | * CONFIGURATION ERRORS 143 | ********************************************************************************************************* 144 | ********************************************************************************************************* 145 | */ 146 | 147 | 148 | /* 149 | ********************************************************************************************************* 150 | ********************************************************************************************************* 151 | * MODULE END 152 | ********************************************************************************************************* 153 | ********************************************************************************************************* 154 | */ 155 | 156 | #endif 157 | 158 | -------------------------------------------------------------------------------- /Class/CDC-EEM/usbd_cdc_eem.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * uC/USB-Device 4 | * The Embedded USB Device Stack 5 | * 6 | * Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com 7 | * 8 | * SPDX-License-Identifier: APACHE-2.0 9 | * 10 | * This software is subject to an open source license and is distributed by 11 | * Silicon Laboratories Inc. pursuant to the terms of the Apache License, 12 | * Version 2.0 available at www.apache.org/licenses/LICENSE-2.0. 13 | * 14 | ********************************************************************************************************* 15 | */ 16 | 17 | /* 18 | ********************************************************************************************************* 19 | * 20 | * USB COMMUNICATIONS DEVICE CLASS (CDC) 21 | * ETHERNET EMULATION MODEL (EEM) 22 | * 23 | * Filename : usbd_cdc_eem.h 24 | * Version : V4.06.01 25 | ********************************************************************************************************* 26 | */ 27 | 28 | /* 29 | ********************************************************************************************************* 30 | * MODULE 31 | ********************************************************************************************************* 32 | */ 33 | 34 | #ifndef USBD_CDC_EEM_MODULE_PRESENT 35 | #define USBD_CDC_EEM_MODULE_PRESENT 36 | 37 | 38 | /* 39 | ********************************************************************************************************* 40 | * INCLUDE FILES 41 | ********************************************************************************************************* 42 | */ 43 | 44 | #include "../../Source/usbd_core.h" 45 | 46 | 47 | /* 48 | ********************************************************************************************************* 49 | * EXTERNS 50 | ********************************************************************************************************* 51 | */ 52 | 53 | #ifdef USBD_CDC_EEM_MODULE 54 | #define USBD_CDC_EEM_EXT 55 | #else 56 | #define USBD_CDC_EEM_EXT extern 57 | #endif 58 | 59 | 60 | /* 61 | ********************************************************************************************************* 62 | * DEFINES 63 | ********************************************************************************************************* 64 | */ 65 | 66 | #define USBD_CDC_EEM_HDR_LEN 2u /* CDC EEM data header length. */ 67 | 68 | 69 | /* 70 | ********************************************************************************************************* 71 | * DATA TYPES 72 | ********************************************************************************************************* 73 | */ 74 | 75 | /* 76 | ********************************************************************************************************* 77 | * CDC EEM CLASS INSTANCE CONFIGURATION STRUCTURE 78 | ********************************************************************************************************* 79 | */ 80 | 81 | typedef struct usbd_cdc_eem_cfg { 82 | CPU_INT08U RxBufQSize; /* Size of rx buffer Q. */ 83 | CPU_INT08U TxBufQSize; /* Size of tx buffer Q. */ 84 | } USBD_CDC_EEM_CFG; 85 | 86 | 87 | /* 88 | ********************************************************************************************************* 89 | * CDC EEM DRIVER 90 | ********************************************************************************************************* 91 | */ 92 | 93 | typedef const struct usbd_cdc_eem_drv { 94 | /* Retrieve a Rx buffer. */ 95 | CPU_INT08U *(*RxBufGet) (CPU_INT08U class_nbr, 96 | void *p_arg, 97 | CPU_INT16U *p_buf_len); 98 | 99 | /* Signal that a rx buffer is ready. */ 100 | void (*RxBufRdy) (CPU_INT08U class_nbr, 101 | void *p_arg); 102 | 103 | /* Free a tx buffer. */ 104 | void (*TxBufFree) (CPU_INT08U class_nbr, 105 | void *p_arg, 106 | CPU_INT08U *p_buf, 107 | CPU_INT16U buf_len); 108 | } USBD_CDC_EEM_DRV; 109 | 110 | 111 | /* 112 | ********************************************************************************************************* 113 | * GLOBAL VARIABLES 114 | ********************************************************************************************************* 115 | */ 116 | 117 | /* 118 | ********************************************************************************************************* 119 | * MACRO'S 120 | ********************************************************************************************************* 121 | */ 122 | 123 | /* 124 | ********************************************************************************************************* 125 | * FUNCTION PROTOTYPES 126 | ********************************************************************************************************* 127 | */ 128 | 129 | void USBD_CDC_EEM_Init ( USBD_ERR *p_err); 130 | 131 | CPU_INT08U USBD_CDC_EEM_Add ( USBD_ERR *p_err); 132 | 133 | void USBD_CDC_EEM_CfgAdd ( CPU_INT08U class_nbr, 134 | CPU_INT08U dev_nbr, 135 | CPU_INT08U cfg_nbr, 136 | const CPU_CHAR *p_if_name, 137 | USBD_ERR *p_err); 138 | 139 | CPU_BOOLEAN USBD_CDC_EEM_IsConn ( CPU_INT08U class_nbr); 140 | 141 | void USBD_CDC_EEM_InstanceInit ( CPU_INT08U class_nbr, 142 | USBD_CDC_EEM_CFG *p_cfg, 143 | USBD_CDC_EEM_DRV *p_cdc_eem_drv, 144 | void *p_arg, 145 | USBD_ERR *p_err); 146 | 147 | void USBD_CDC_EEM_Start ( CPU_INT08U class_nbr, 148 | USBD_ERR *p_err); 149 | 150 | void USBD_CDC_EEM_Stop ( CPU_INT08U class_nbr, 151 | USBD_ERR *p_err); 152 | 153 | CPU_INT08U USBD_CDC_EEM_DevNbrGet ( CPU_INT08U class_nbr, 154 | USBD_ERR *p_err); 155 | 156 | CPU_INT08U *USBD_CDC_EEM_RxDataPktGet ( CPU_INT08U class_nbr, 157 | CPU_INT16U *p_rx_len, 158 | CPU_BOOLEAN *p_crc_computed, 159 | USBD_ERR *p_err); 160 | 161 | void USBD_CDC_EEM_TxDataPktSubmit( CPU_INT08U class_nbr, 162 | CPU_INT08U *p_buf, 163 | CPU_INT32U buf_len, 164 | CPU_BOOLEAN crc_computed, 165 | USBD_ERR *p_err); 166 | 167 | 168 | /* 169 | ********************************************************************************************************* 170 | * CONFIGURATION ERRORS 171 | ********************************************************************************************************* 172 | */ 173 | 174 | #ifndef USBD_CDC_EEM_CFG_MAX_NBR_DEV 175 | #error "USBD_CDC_EEM_CFG_MAX_NBR_DEV not #define'd in 'usbd_cfg.h'" 176 | #error " [MUST be >= 1] " 177 | #endif 178 | 179 | #if (USBD_CDC_EEM_CFG_MAX_NBR_DEV < 1u) 180 | #error "USBD_CDC_EEM_CFG_MAX_NBR_DEV illegally #define'd in 'usbd_cfg.h'" 181 | #error " [MUST be >= 1] " 182 | #endif 183 | 184 | #ifndef USBD_CDC_EEM_CFG_MAX_NBR_CFG 185 | #error "USBD_CDC_EEM_CFG_MAX_NBR_CFG not #define'd in 'usbd_cfg.h'" 186 | #error " [MUST be >= 1] " 187 | #endif 188 | 189 | #if (USBD_CDC_EEM_CFG_MAX_NBR_CFG < 1u) 190 | #error "USBD_CDC_EEM_CFG_MAX_NBR_CFG illegally #define'd in 'usbd_cfg.h'" 191 | #error " [MUST be >= 1] " 192 | #endif 193 | 194 | #ifdef USBD_CDC_EEM_CFG_RX_BUF_QTY_PER_DEV 195 | #if ((USBD_CDC_EEM_CFG_RX_BUF_QTY_PER_DEV - 1u) > USBD_CFG_MAX_NBR_URB_EXTRA) 196 | #error "USBD_CDC_EEM_CFG_RX_BUF_QTY_PER_DEV illegally #define'd in 'usbd_cfg.h'" 197 | #error " [MUST be <= USBD_CFG_MAX_NBR_URB_EXTRA + 1] " 198 | #endif 199 | #endif 200 | 201 | #ifndef USBD_CDC_EEM_CFG_ECHO_BUF_LEN 202 | #error "USBD_CDC_EEM_CFG_ECHO_BUF_LEN not #define'd in 'usbd_cfg.h'" 203 | #error " [MUST be >= 2u] " 204 | #endif 205 | 206 | #if (USBD_CDC_EEM_CFG_ECHO_BUF_LEN < 2u) 207 | #error "USBD_CDC_EEM_CFG_ECHO_BUF_LEN illegally #define'd in 'usbd_cfg.h'" 208 | #error " [MUST be >= 2] " 209 | #endif 210 | 211 | #ifndef USBD_CDC_EEM_CFG_RX_BUF_LEN 212 | #error "USBD_CDC_EEM_CFG_RX_BUF_LEN not #define'd in 'usbd_cfg.h'" 213 | #error " [MUST be >= 2u] " 214 | #endif 215 | 216 | #if (USBD_CDC_EEM_CFG_RX_BUF_LEN < 2u) 217 | #error "USBD_CDC_EEM_CFG_RX_BUF_LEN illegally #define'd in 'usbd_cfg.h'" 218 | #error " [MUST be >= 2] " 219 | #endif 220 | 221 | 222 | /* 223 | ********************************************************************************************************* 224 | * MODULE END 225 | ********************************************************************************************************* 226 | */ 227 | 228 | #endif 229 | -------------------------------------------------------------------------------- /Class/HID/usbd_hid_os.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * uC/USB-Device 4 | * The Embedded USB Device Stack 5 | * 6 | * Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com 7 | * 8 | * SPDX-License-Identifier: APACHE-2.0 9 | * 10 | * This software is subject to an open source license and is distributed by 11 | * Silicon Laboratories Inc. pursuant to the terms of the Apache License, 12 | * Version 2.0 available at www.apache.org/licenses/LICENSE-2.0. 13 | * 14 | ********************************************************************************************************* 15 | */ 16 | 17 | /* 18 | ********************************************************************************************************* 19 | * 20 | * USB HID CLASS OPERATING SYSTEM LAYER 21 | * 22 | * Filename : usbd_hid_os.h 23 | * Version : V4.06.01 24 | ********************************************************************************************************* 25 | */ 26 | 27 | /* 28 | ********************************************************************************************************* 29 | * MODULE 30 | ********************************************************************************************************* 31 | */ 32 | 33 | #ifndef USBD_HID_OS_MODULE_PRESENT 34 | #define USBD_HID_OS_MODULE_PRESENT 35 | 36 | 37 | /* 38 | ********************************************************************************************************* 39 | * INCLUDE FILES 40 | ********************************************************************************************************* 41 | */ 42 | 43 | #include "../../Source/usbd_core.h" 44 | 45 | 46 | /* 47 | ********************************************************************************************************* 48 | * EXTERNS 49 | ********************************************************************************************************* 50 | */ 51 | 52 | 53 | /* 54 | ********************************************************************************************************* 55 | * DEFINES 56 | ********************************************************************************************************* 57 | */ 58 | 59 | 60 | /* 61 | ********************************************************************************************************* 62 | * DATA TYPES 63 | ********************************************************************************************************* 64 | */ 65 | 66 | 67 | /* 68 | ********************************************************************************************************* 69 | * GLOBAL VARIABLES 70 | ********************************************************************************************************* 71 | */ 72 | 73 | 74 | /* 75 | ********************************************************************************************************* 76 | * MACRO'S 77 | ********************************************************************************************************* 78 | */ 79 | 80 | 81 | /* 82 | ********************************************************************************************************* 83 | * FUNCTION PROTOTYPES 84 | ********************************************************************************************************* 85 | */ 86 | 87 | void USBD_HID_OS_Init (USBD_ERR *p_err); 88 | 89 | 90 | void USBD_HID_OS_InputLock (CPU_INT08U class_nbr, 91 | USBD_ERR *p_err); 92 | 93 | void USBD_HID_OS_InputUnlock (CPU_INT08U class_nbr); 94 | 95 | void USBD_HID_OS_InputDataPend (CPU_INT08U class_nbr, 96 | CPU_INT16U timeout_ms, 97 | USBD_ERR *p_err); 98 | 99 | void USBD_HID_OS_InputDataPendAbort (CPU_INT08U class_nbr); 100 | 101 | void USBD_HID_OS_InputDataPost (CPU_INT08U class_nbr); 102 | 103 | 104 | void USBD_HID_OS_OutputLock (CPU_INT08U class_nbr, 105 | USBD_ERR *p_err); 106 | 107 | void USBD_HID_OS_OutputUnlock (CPU_INT08U class_nbr); 108 | 109 | void USBD_HID_OS_OutputDataPendAbort(CPU_INT08U class_nbr); 110 | 111 | void USBD_HID_OS_OutputDataPend (CPU_INT08U class_nbr, 112 | CPU_INT16U timeout_ms, 113 | USBD_ERR *p_err); 114 | 115 | void USBD_HID_OS_OutputDataPost (CPU_INT08U class_nbr); 116 | 117 | 118 | void USBD_HID_OS_TxLock (CPU_INT08U class_nbr, 119 | USBD_ERR *p_err); 120 | 121 | void USBD_HID_OS_TxUnlock (CPU_INT08U class_nbr); 122 | 123 | 124 | /* 125 | ********************************************************************************************************* 126 | * CONFIGURATION ERRORS 127 | ********************************************************************************************************* 128 | */ 129 | 130 | 131 | /* 132 | ********************************************************************************************************* 133 | * MODULE END 134 | ********************************************************************************************************* 135 | */ 136 | 137 | #endif 138 | -------------------------------------------------------------------------------- /Class/MSC/Storage/RAMDisk/usbd_storage.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * uC/USB-Device 4 | * The Embedded USB Device Stack 5 | * 6 | * Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com 7 | * 8 | * SPDX-License-Identifier: APACHE-2.0 9 | * 10 | * This software is subject to an open source license and is distributed by 11 | * Silicon Laboratories Inc. pursuant to the terms of the Apache License, 12 | * Version 2.0 available at www.apache.org/licenses/LICENSE-2.0. 13 | * 14 | ********************************************************************************************************* 15 | */ 16 | 17 | /* 18 | ********************************************************************************************************* 19 | * 20 | * USB DEVICE MSC CLASS STORAGE DRIVER 21 | * 22 | * RAMDISK 23 | * 24 | * Filename : usbd_storage.h 25 | * Version : V4.06.01 26 | ********************************************************************************************************* 27 | */ 28 | 29 | /* 30 | ********************************************************************************************************* 31 | * MODULE 32 | ********************************************************************************************************* 33 | */ 34 | 35 | #ifndef USBF_STORAGE_H 36 | #define USBF_STORAGE_H 37 | 38 | 39 | /* 40 | ********************************************************************************************************* 41 | * INCLUDE FILES 42 | ********************************************************************************************************* 43 | */ 44 | 45 | #include "../../../../Source/usbd_core.h" 46 | #include "../../usbd_scsi.h" 47 | 48 | 49 | /* 50 | ********************************************************************************************************* 51 | * EXTERNS 52 | ********************************************************************************************************* 53 | */ 54 | 55 | 56 | /* 57 | ********************************************************************************************************* 58 | * DEFINES 59 | ********************************************************************************************************* 60 | */ 61 | 62 | 63 | /* 64 | ********************************************************************************************************* 65 | * DATA TYPES 66 | ********************************************************************************************************* 67 | */ 68 | 69 | 70 | /* 71 | ********************************************************************************************************* 72 | * GLOBAL VARIABLES 73 | ********************************************************************************************************* 74 | */ 75 | 76 | 77 | /* 78 | ********************************************************************************************************* 79 | * MACRO'S 80 | ********************************************************************************************************* 81 | */ 82 | 83 | 84 | /* 85 | ********************************************************************************************************* 86 | * FUNCTION PROTOTYPES 87 | ********************************************************************************************************* 88 | */ 89 | 90 | void USBD_StorageInit (USBD_ERR *p_err); 91 | 92 | void USBD_StorageAdd (USBD_STORAGE_LUN *p_storage_lun, 93 | USBD_ERR *p_err); 94 | 95 | void USBD_StorageCapacityGet(USBD_STORAGE_LUN *p_storage_lun, 96 | CPU_INT64U *p_nbr_blks, 97 | CPU_INT32U *p_blk_size, 98 | USBD_ERR *p_err); 99 | 100 | void USBD_StorageRd (USBD_STORAGE_LUN *p_storage_lun, 101 | CPU_INT64U blk_addr, 102 | CPU_INT32U nbr_blks, 103 | CPU_INT08U *p_data_buf, 104 | USBD_ERR *p_err); 105 | 106 | void USBD_StorageWr (USBD_STORAGE_LUN *p_storage_lun, 107 | CPU_INT64U blk_addr, 108 | CPU_INT32U nbr_blks, 109 | CPU_INT08U *p_data_buf, 110 | USBD_ERR *p_err); 111 | 112 | void USBD_StorageStatusGet (USBD_STORAGE_LUN *p_storage_lun, 113 | USBD_ERR *p_err); 114 | 115 | void USBD_StorageLock (USBD_STORAGE_LUN *p_storage_lun, 116 | CPU_INT32U timeout_ms, 117 | USBD_ERR *p_err); 118 | 119 | void USBD_StorageUnlock (USBD_STORAGE_LUN *p_storage_lun, 120 | USBD_ERR *p_err); 121 | 122 | 123 | /* 124 | ********************************************************************************************************* 125 | * CONFIGURATION ERRORS 126 | ********************************************************************************************************* 127 | */ 128 | 129 | #ifndef USBD_RAMDISK_CFG_BLK_SIZE 130 | #error "USBD_RAMDISK_CFG_BLK_SIZE not #defined'd in 'usbd_cfg.h' [MUST be > 0]" 131 | #elif (USBD_RAMDISK_CFG_BLK_SIZE < 1u) 132 | #error "USBD_RAMDISK_CFG_BLK_SIZE illegally #define'd in 'usbd_cfg.h' [MUST be > 0]" 133 | #endif 134 | 135 | #ifndef USBD_RAMDISK_CFG_NBR_BLKS 136 | #error "USBD_RAMDISK_CFG_NBR_BLKS not #defined'd in 'usbd_cfg.h' [MUST be > 0]" 137 | #elif (USBD_RAMDISK_CFG_NBR_BLKS < 1u) 138 | #error "USBD_RAMDISK_CFG_NBR_BLKS illegally #define'd in 'usbd_cfg.h' [MUST be > 0]" 139 | #endif 140 | 141 | #ifndef USBD_RAMDISK_CFG_NBR_UNITS 142 | #error "USBD_RAMDISK_CFG_NBR_UNITS not #defined'd in 'usbd_cfg.h' [MUST be > 0]" 143 | #elif (USBD_RAMDISK_CFG_NBR_UNITS < 1u) 144 | #error "USBD_RAMDISK_CFG_NBR_UNITS illegally #define'd in 'usbd_cfg.h' [MUST be > 0]" 145 | #endif 146 | 147 | #ifndef USBD_RAMDISK_CFG_BASE_ADDR 148 | #error "USBD_RAMDISK_CFG_BASE_ADDR not #defined'd in 'usbd_cfg.h' [MUST be >= 0]" 149 | #elif (USBD_RAMDISK_CFG_BASE_ADDR < 0u) 150 | #error "USBD_RAMDISK_CFG_BASE_ADDR illegally #define'd in 'usbd_cfg.h' [MUST be >= 0]" 151 | #endif 152 | 153 | 154 | /* 155 | ********************************************************************************************************* 156 | * MODULE END 157 | ********************************************************************************************************* 158 | */ 159 | 160 | #endif 161 | -------------------------------------------------------------------------------- /Class/MSC/Storage/Template/usbd_storage.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * uC/USB-Device 4 | * The Embedded USB Device Stack 5 | * 6 | * Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com 7 | * 8 | * SPDX-License-Identifier: APACHE-2.0 9 | * 10 | * This software is subject to an open source license and is distributed by 11 | * Silicon Laboratories Inc. pursuant to the terms of the Apache License, 12 | * Version 2.0 available at www.apache.org/licenses/LICENSE-2.0. 13 | * 14 | ********************************************************************************************************* 15 | */ 16 | 17 | /* 18 | ********************************************************************************************************* 19 | * 20 | * USB DEVICE MSC CLASS STORAGE DRIVER 21 | * 22 | * TEMPLATE 23 | * 24 | * Filename : usbf_storage.h 25 | * Version : V4.06.01 26 | ********************************************************************************************************* 27 | */ 28 | 29 | /* 30 | ********************************************************************************************************* 31 | * MODULE 32 | ********************************************************************************************************* 33 | */ 34 | 35 | #ifndef USBF_STORAGE_H 36 | #define USBF_STORAGE_H 37 | 38 | 39 | /* 40 | ********************************************************************************************************* 41 | * INCLUDE FILES 42 | ********************************************************************************************************* 43 | */ 44 | 45 | #include "../../../../Source/usbd_core.h" 46 | #include "../../usbd_scsi.h" 47 | 48 | 49 | /* 50 | ********************************************************************************************************* 51 | * EXTERNS 52 | ********************************************************************************************************* 53 | */ 54 | 55 | 56 | /* 57 | ********************************************************************************************************* 58 | * DEVICE TYPES 59 | ********************************************************************************************************* 60 | */ 61 | 62 | #define USBD_DISK_DIRECT_ACCESS_DEVICE 0x00 63 | #define USBD_DISK_SEQUENTIAL_ACCESS_DEVICE 0x01 64 | #define USBD_DISK_PRINTER_DEVICE 0x02 65 | 66 | 67 | /* 68 | ********************************************************************************************************* 69 | * DIRECT ACCESS MEDIUM TYPE 70 | ********************************************************************************************************* 71 | */ 72 | 73 | #define USBD_DISK_MEMORY_MEDIA 0x00 74 | 75 | 76 | /* 77 | ********************************************************************************************************* 78 | * DATA TYPES 79 | ********************************************************************************************************* 80 | */ 81 | 82 | 83 | /* 84 | ********************************************************************************************************* 85 | * GLOBAL VARIABLES 86 | ********************************************************************************************************* 87 | */ 88 | 89 | 90 | /* 91 | ********************************************************************************************************* 92 | * MACRO'S 93 | ********************************************************************************************************* 94 | */ 95 | 96 | 97 | /* 98 | ********************************************************************************************************* 99 | * FUNCTION PROTOTYPES 100 | ********************************************************************************************************* 101 | */ 102 | 103 | void USBD_StorageInit (USBD_ERR *p_err); 104 | 105 | void USBD_StorageCapacityGet(USBD_STORAGE_LUN *p_storage_lun, 106 | CPU_INT64U *p_nbr_blks, 107 | CPU_INT32U *p_blk_size, 108 | USBD_ERR *p_err); 109 | 110 | void USBD_StorageRd (USBD_STORAGE_LUN *p_storage_lun, 111 | CPU_INT64U blk_addr, 112 | CPU_INT32U nbr_blks, 113 | CPU_INT08U *p_data_buf, 114 | USBD_ERR *p_err); 115 | 116 | void USBD_StorageWr (USBD_STORAGE_LUN *p_storage_lun, 117 | CPU_INT64U blk_addr, 118 | CPU_INT32U nbr_blks, 119 | CPU_INT08U *p_data_buf, 120 | USBD_ERR *p_err); 121 | 122 | void USBD_StorageStatusGet (USBD_STORAGE_LUN *p_storage_lun, 123 | USBD_ERR *p_err); 124 | 125 | void USBD_StorageLock (USBD_STORAGE_LUN *p_storage_lun, 126 | CPU_INT32U timeout_ms, 127 | USBD_ERR *p_err); 128 | 129 | void USBD_StorageUnlock (USBD_STORAGE_LUN *p_storage_lun, 130 | USBD_ERR *p_err); 131 | 132 | 133 | /* 134 | ********************************************************************************************************* 135 | * CONFIGURATION ERRORS 136 | ********************************************************************************************************* 137 | */ 138 | 139 | 140 | 141 | #endif 142 | -------------------------------------------------------------------------------- /Class/MSC/Storage/uC-FS/V4/usbd_storage.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * uC/USB-Device 4 | * The Embedded USB Device Stack 5 | * 6 | * Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com 7 | * 8 | * SPDX-License-Identifier: APACHE-2.0 9 | * 10 | * This software is subject to an open source license and is distributed by 11 | * Silicon Laboratories Inc. pursuant to the terms of the Apache License, 12 | * Version 2.0 available at www.apache.org/licenses/LICENSE-2.0. 13 | * 14 | ********************************************************************************************************* 15 | */ 16 | 17 | /* 18 | ********************************************************************************************************* 19 | * 20 | * USB DEVICE MSC CLASS STORAGE DRIVER 21 | * 22 | * uC/FS V4 23 | * 24 | * Filename : usbd_storage.h 25 | * Version : V4.06.01 26 | ********************************************************************************************************* 27 | */ 28 | 29 | /* 30 | ********************************************************************************************************** 31 | * MODULE 32 | ********************************************************************************************************** 33 | */ 34 | 35 | 36 | /* 37 | ********************************************************************************************************* 38 | * INCLUDE FILES 39 | ********************************************************************************************************* 40 | */ 41 | 42 | #include "../../../../../Source/usbd_core.h" 43 | #include "../../../usbd_scsi.h" 44 | #include 45 | 46 | 47 | /* 48 | ********************************************************************************************************* 49 | * EXTERNS 50 | ********************************************************************************************************* 51 | */ 52 | 53 | #ifdef STORAGE_MODULE 54 | #define STORAGE_EXT 55 | #else 56 | #define STORAGE_EXT extern 57 | #endif 58 | 59 | 60 | /* 61 | ********************************************************************************************************* 62 | * DEFINES 63 | ********************************************************************************************************* 64 | */ 65 | 66 | 67 | /* 68 | ********************************************************************************************************* 69 | * DATA TYPES 70 | ********************************************************************************************************* 71 | */ 72 | 73 | 74 | /* 75 | ********************************************************************************************************* 76 | * GLOBAL VARIABLES 77 | ********************************************************************************************************* 78 | */ 79 | 80 | 81 | /* 82 | ********************************************************************************************************* 83 | * MACRO'S 84 | ********************************************************************************************************* 85 | */ 86 | 87 | 88 | /* 89 | ********************************************************************************************************* 90 | * FUNCTION PROTOTYPES 91 | ********************************************************************************************************* 92 | */ 93 | 94 | void USBD_StorageInit (USBD_ERR *p_err); 95 | 96 | void USBD_StorageAdd (USBD_STORAGE_LUN *p_storage_lun, 97 | USBD_ERR *p_err); 98 | 99 | void USBD_StorageCapacityGet (USBD_STORAGE_LUN *p_storage_lun, 100 | CPU_INT64U *p_nbr_blks, 101 | CPU_INT32U *p_blk_size, 102 | USBD_ERR *p_err); 103 | 104 | void USBD_StorageRd (USBD_STORAGE_LUN *p_storage_lun, 105 | CPU_INT64U blk_addr, 106 | CPU_INT32U nbr_blks, 107 | CPU_INT08U *p_data_buf, 108 | USBD_ERR *p_err); 109 | 110 | void USBD_StorageWr (USBD_STORAGE_LUN *p_storage_lun, 111 | CPU_INT64U blk_addr, 112 | CPU_INT32U nbr_blks, 113 | CPU_INT08U *p_data_buf, 114 | USBD_ERR *p_err); 115 | 116 | void USBD_StorageStatusGet (USBD_STORAGE_LUN *p_storage_lun, 117 | USBD_ERR *p_err); 118 | 119 | void USBD_StorageLock (USBD_STORAGE_LUN *p_storage_lun, 120 | CPU_INT32U timeout_ms, 121 | USBD_ERR *p_err); 122 | 123 | void USBD_StorageUnlock (USBD_STORAGE_LUN *p_storage_lun, 124 | USBD_ERR *p_err); 125 | 126 | #if (USBD_MSC_CFG_FS_REFRESH_TASK_EN == DEF_ENABLED) 127 | void USBD_StorageRefreshTaskHandler(void *p_arg); 128 | #endif 129 | 130 | 131 | /* 132 | ********************************************************************************************************* 133 | * CONFIGURATION ERRORS 134 | ********************************************************************************************************* 135 | */ 136 | 137 | #ifndef USBD_MSC_CFG_FS_REFRESH_TASK_EN 138 | #error "USBD_MSC_CFG_FS_REFRESH_TASK_EN not #defined'd in 'usbd_cfg.h' [MUST be DEF_ENABLED or DEF_DISABLED]" 139 | #endif 140 | 141 | 142 | /* 143 | ********************************************************************************************************** 144 | * MODULE END 145 | ********************************************************************************************************** 146 | */ 147 | 148 | 149 | 150 | 151 | -------------------------------------------------------------------------------- /Class/MSC/usbd_msc.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * uC/USB-Device 4 | * The Embedded USB Device Stack 5 | * 6 | * Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com 7 | * 8 | * SPDX-License-Identifier: APACHE-2.0 9 | * 10 | * This software is subject to an open source license and is distributed by 11 | * Silicon Laboratories Inc. pursuant to the terms of the Apache License, 12 | * Version 2.0 available at www.apache.org/licenses/LICENSE-2.0. 13 | * 14 | ********************************************************************************************************* 15 | */ 16 | 17 | /* 18 | ********************************************************************************************************* 19 | * 20 | * USB DEVICE MSC CLASS 21 | * 22 | * Filename : usbd_msc.h 23 | * Version : V4.06.01 24 | ********************************************************************************************************* 25 | */ 26 | 27 | /* 28 | ********************************************************************************************************* 29 | * MODULE 30 | ********************************************************************************************************* 31 | */ 32 | 33 | #ifndef USBD_MSC_MODULE_PRESENT 34 | #define USBD_MSC_MODULE_PRESENT 35 | 36 | 37 | /* 38 | ********************************************************************************************************* 39 | * INCLUDE FILES 40 | ********************************************************************************************************* 41 | */ 42 | 43 | #include "../../Source/usbd_core.h" 44 | 45 | 46 | /* 47 | ********************************************************************************************************* 48 | * EXTERNS 49 | ********************************************************************************************************* 50 | */ 51 | 52 | #ifdef USBD_MSC_MODULE 53 | #define USBD_MSC_EXT 54 | #else 55 | #define USBD_MSC_EXT extern 56 | #endif 57 | 58 | 59 | /* 60 | ********************************************************************************************************* 61 | * DEFINES 62 | * 63 | * Note(s) : (1) The T10 VENDOR IDENTIFICATION field contains 8 bytes of left-aligned ASCII data 64 | * identifying the vendor of the product. The T10 vendor identification shall be one 65 | * assigned by INCITS. 66 | * The PRODUCT IDENTIFICATION field contains 16 bytes of left-aligned ASCII data 67 | * defined by the vendor. 68 | * See 'SCSI Primary Commands - 3 (SPC-3)', section 6.4.2 for more details about 69 | * Standard INQUIRY data format. 70 | ********************************************************************************************************* 71 | */ 72 | 73 | /* ---- STANDARD INQUIRY DATA FORMAT (see Note #1) ---- */ 74 | #define USBD_MSC_DEV_MAX_VEND_ID_LEN 8u 75 | #define USBD_MSC_DEV_MAX_PROD_ID_LEN 16u 76 | 77 | 78 | /* 79 | ********************************************************************************************************** 80 | * DATA TYPES 81 | ********************************************************************************************************** 82 | */ 83 | 84 | 85 | /* 86 | ********************************************************************************************************* 87 | * GLOBAL VARIABLES 88 | ********************************************************************************************************* 89 | */ 90 | 91 | 92 | /* 93 | ********************************************************************************************************* 94 | * MACROS 95 | ********************************************************************************************************* 96 | */ 97 | 98 | 99 | /* 100 | ********************************************************************************************************* 101 | * FUNCTION PROTOTYPES 102 | ********************************************************************************************************* 103 | */ 104 | 105 | 106 | void USBD_MSC_Init ( USBD_ERR *p_err); 107 | 108 | CPU_INT08U USBD_MSC_Add ( USBD_ERR *p_err); 109 | 110 | CPU_BOOLEAN USBD_MSC_CfgAdd ( CPU_INT08U class_nbr, 111 | CPU_INT08U dev_nbr, 112 | CPU_INT08U cfg_nbr, 113 | USBD_ERR *p_err); 114 | 115 | void USBD_MSC_LunAdd (const CPU_CHAR *p_store_name, 116 | CPU_INT08U class_nbr, 117 | CPU_CHAR *p_vend_id, 118 | CPU_CHAR *p_prod_id, 119 | CPU_INT32U prod_rev_level, 120 | CPU_BOOLEAN rd_only, 121 | USBD_ERR *p_err); 122 | 123 | CPU_BOOLEAN USBD_MSC_IsConn ( CPU_INT08U class_nbr); 124 | 125 | void USBD_MSC_TaskHandler( CPU_INT08U class_nbr); 126 | 127 | 128 | /* 129 | ********************************************************************************************************* 130 | * CONFIGURATION ERRORS 131 | ********************************************************************************************************* 132 | */ 133 | 134 | #ifndef USBD_MSC_CFG_MAX_NBR_DEV 135 | #error "USBD_MSC_CFG_MAX_NBR_DEV not #define'd in 'usbd_cfg.h' [MUST be >= 1]" 136 | #endif 137 | 138 | #if (USBD_MSC_CFG_MAX_NBR_DEV < 1u) 139 | #error "USBD_MSC_CFG_MAX_NBR_DEV illegally #define'd in 'usbd_cfg.h' [MUST be >= 1]" 140 | #endif 141 | 142 | #ifndef USBD_MSC_CFG_MAX_NBR_CFG 143 | #error "USBD_MSC_CFG_MAX_NBR_CFG not #define'd in 'usbd_cfg.h' [MUST be >= 1]" 144 | #endif 145 | 146 | #if (USBD_MSC_CFG_MAX_NBR_CFG < 1u) 147 | #error "USBD_MSC_CFG_MAX_NBR_CFG illegally #define'd in 'usbd_cfg.h' [MUST be >= 1]" 148 | #endif 149 | 150 | #ifndef USBD_MSC_CFG_MAX_LUN 151 | #error "USBD_MSC_CFG_MAX_LUN not #define'd in 'usbd_cfg.h' [MUST be >= 1]" 152 | #endif 153 | 154 | #if (USBD_MSC_CFG_MAX_LUN < 1u) 155 | #error "USBD_MSC_CFG_MAX_LUN illegally #define'd in 'usbd_cfg.h' [MUST be >= 1]" 156 | #endif 157 | 158 | #ifndef USBD_MSC_CFG_DATA_LEN 159 | #error "USBD_MSC_CFG_DATA_LEN not #define'd in 'usbd_cfg.h' [MUST be >= 1]" 160 | #endif 161 | 162 | #if (USBD_MSC_CFG_DATA_LEN < 1u) 163 | #error "USBD_MSC_CFG_DATA_LEN illegally #define'd in 'usbd_cfg.h' [MUST be >= 1]" 164 | #endif 165 | 166 | #ifndef USBD_MSC_CFG_MICRIUM_FS 167 | #error "USBD_MSC_CFG_MICRIUM_FS not #define'd in 'usbd_cfg.h' [MUST be DEF_ENABLED or DEF_DISABLED]" 168 | #endif 169 | 170 | 171 | /* 172 | ********************************************************************************************************* 173 | * MODULE END 174 | ********************************************************************************************************* 175 | */ 176 | 177 | #endif 178 | -------------------------------------------------------------------------------- /Class/MSC/usbd_msc_os.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * uC/USB-Device 4 | * The Embedded USB Device Stack 5 | * 6 | * Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com 7 | * 8 | * SPDX-License-Identifier: APACHE-2.0 9 | * 10 | * This software is subject to an open source license and is distributed by 11 | * Silicon Laboratories Inc. pursuant to the terms of the Apache License, 12 | * Version 2.0 available at www.apache.org/licenses/LICENSE-2.0. 13 | * 14 | ********************************************************************************************************* 15 | */ 16 | 17 | /* 18 | ********************************************************************************************************* 19 | * 20 | * USB MSC CLASS OPERATING SYSTEM LAYER 21 | * 22 | * Filename : usbd_msc_os.h 23 | * Version : V4.06.01 24 | ********************************************************************************************************* 25 | */ 26 | 27 | /* 28 | ********************************************************************************************************* 29 | * MODULE 30 | ********************************************************************************************************* 31 | */ 32 | 33 | #ifndef USBD_MSC_OS_MODULE_PRESENT 34 | #define USBD_MSC_OS_MODULE_PRESENT 35 | 36 | 37 | /* 38 | ********************************************************************************************************* 39 | * INCLUDE FILES 40 | ********************************************************************************************************* 41 | */ 42 | 43 | #include "../../Source/usbd_core.h" 44 | 45 | /* 46 | ********************************************************************************************************* 47 | * EXTERNS 48 | ********************************************************************************************************* 49 | */ 50 | 51 | 52 | /* 53 | ********************************************************************************************************* 54 | * DEFINES 55 | ********************************************************************************************************* 56 | */ 57 | 58 | 59 | /* 60 | ********************************************************************************************************* 61 | * DATA TYPES 62 | ********************************************************************************************************* 63 | */ 64 | 65 | 66 | /* 67 | ********************************************************************************************************* 68 | * GLOBAL VARIABLES 69 | ********************************************************************************************************* 70 | */ 71 | 72 | 73 | /* 74 | ********************************************************************************************************* 75 | * MACRO'S 76 | ********************************************************************************************************* 77 | */ 78 | 79 | 80 | /* 81 | ********************************************************************************************************* 82 | * FUNCTION PROTOTYPES 83 | ********************************************************************************************************* 84 | */ 85 | 86 | void USBD_MSC_OS_Init (USBD_ERR *p_err); 87 | 88 | void USBD_MSC_OS_CommSignalPost(CPU_INT08U class_nbr, 89 | USBD_ERR *p_err); 90 | 91 | void USBD_MSC_OS_CommSignalPend(CPU_INT08U class_nbr, 92 | CPU_INT32U timeout, 93 | USBD_ERR *p_err); 94 | 95 | void USBD_MSC_OS_CommSignalDel (CPU_INT08U class_nbr, 96 | USBD_ERR *p_err); 97 | 98 | void USBD_MSC_OS_EnumSignalPost(USBD_ERR *p_err); 99 | 100 | void USBD_MSC_OS_EnumSignalPend(CPU_INT32U timeout, 101 | USBD_ERR *p_err); 102 | 103 | 104 | /* 105 | ********************************************************************************************************* 106 | * CONFIGURATION ERRORS 107 | ********************************************************************************************************* 108 | */ 109 | 110 | 111 | /* 112 | ********************************************************************************************************* 113 | * MODULE END 114 | ********************************************************************************************************* 115 | */ 116 | 117 | #endif 118 | -------------------------------------------------------------------------------- /Class/MSC/usbd_scsi.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * uC/USB-Device 4 | * The Embedded USB Device Stack 5 | * 6 | * Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com 7 | * 8 | * SPDX-License-Identifier: APACHE-2.0 9 | * 10 | * This software is subject to an open source license and is distributed by 11 | * Silicon Laboratories Inc. pursuant to the terms of the Apache License, 12 | * Version 2.0 available at www.apache.org/licenses/LICENSE-2.0. 13 | * 14 | ********************************************************************************************************* 15 | */ 16 | 17 | /* 18 | ********************************************************************************************************* 19 | * 20 | * USB DEVICE MSC SCSI 21 | * 22 | * Filename : usbd_scsi.h 23 | * Version : V4.06.01 24 | ********************************************************************************************************* 25 | */ 26 | 27 | /* 28 | ********************************************************************************************************** 29 | * MODULE 30 | ********************************************************************************************************** 31 | */ 32 | 33 | #ifndef USBD_SCSI_H 34 | #define USBD_SCSI_H 35 | 36 | 37 | /* 38 | ********************************************************************************************************** 39 | * INCLUDE FILES 40 | ********************************************************************************************************** 41 | */ 42 | 43 | #include "../../Source/usbd_core.h" 44 | #include "usbd_msc.h" 45 | 46 | 47 | /* 48 | ********************************************************************************************************** 49 | * EXTERNS 50 | ********************************************************************************************************** 51 | */ 52 | 53 | #ifdef USBD_SCSI_MODULE 54 | #define USBD_SCSI_EXT 55 | #else 56 | #define USBD_SCSI_EXT extern 57 | #endif 58 | 59 | 60 | /* 61 | ********************************************************************************************************** 62 | * DEFINES 63 | ********************************************************************************************************** 64 | */ 65 | 66 | 67 | /* 68 | ********************************************************************************************************** 69 | * DATA TYPES 70 | ********************************************************************************************************** 71 | */ 72 | 73 | /* 74 | ********************************************************************************************************** 75 | * STORAGE UNIT CONTROL 76 | ********************************************************************************************************** 77 | */ 78 | 79 | typedef struct usbd_storage_lun { 80 | CPU_INT08U LunNbr; /* Logical Unit Number. */ 81 | CPU_CHAR *VolStrPtr; /* String uniquely identifying a logical unit. */ 82 | CPU_BOOLEAN MediumPresent; /* Flag indicating presence of logical unit. */ 83 | CPU_BOOLEAN LockFlag; /* Flag indicating logical unit locked or not. */ 84 | CPU_BOOLEAN EjectFlag; /* Flag indicating logical unit ejected by host or not. */ 85 | } USBD_STORAGE_LUN; 86 | 87 | 88 | /* 89 | ********************************************************************************************************** 90 | * LOGICAL UNIT CHARACTERISTICS 91 | ********************************************************************************************************** 92 | */ 93 | 94 | typedef struct usbd_lun_info { 95 | CPU_INT08U VendorId[USBD_MSC_DEV_MAX_VEND_ID_LEN]; /* Dev vendor info. */ 96 | CPU_INT08U ProdId[USBD_MSC_DEV_MAX_PROD_ID_LEN]; /* Dev prod ID. */ 97 | CPU_INT32U ProdRevisionLevel; /* Revision level of product. */ 98 | CPU_BOOLEAN ReadOnly; /* Wr protected or not. */ 99 | } USBD_LUN_INFO; 100 | 101 | 102 | /* 103 | ********************************************************************************************************** 104 | * LOGICAL UNIT CONTROL 105 | ********************************************************************************************************** 106 | */ 107 | 108 | typedef struct usbd_msc_lun_ctrl { 109 | CPU_INT08U LunNbr; /* LUN given by MSC IF. */ 110 | USBD_LUN_INFO LunInfo; /* Logical unit info. */ 111 | CPU_INT64U NbrBlocks; /* Nbr of blks supported by logical unit. */ 112 | CPU_INT32U BlockSize; /* Blk size supported by logical unit. */ 113 | void *LunArgPtr; /* Ptr to the LUN specific argument. */ 114 | } USBD_MSC_LUN_CTRL; 115 | 116 | 117 | /* 118 | ********************************************************************************************************** 119 | * GLOBAL VARIABLES 120 | ********************************************************************************************************** 121 | */ 122 | 123 | 124 | /* 125 | ********************************************************************************************************** 126 | * MACRO'S 127 | ********************************************************************************************************** 128 | */ 129 | 130 | 131 | /* 132 | ********************************************************************************************************** 133 | * FUNCTION PROTOTYPES 134 | ********************************************************************************************************** 135 | */ 136 | 137 | void USBD_SCSI_Init ( USBD_ERR *p_err); 138 | 139 | void USBD_SCSI_LunAdd ( CPU_INT08U lun_nbr, 140 | CPU_CHAR *p_vol_str, 141 | USBD_ERR *p_err); 142 | 143 | void USBD_SCSI_CmdProcess( USBD_MSC_LUN_CTRL *p_lun, 144 | const CPU_INT08U *p_cbwcb, 145 | CPU_INT32U *p_resp_len, 146 | CPU_INT08U *p_data_dir, 147 | USBD_ERR *p_err); 148 | 149 | void USBD_SCSI_DataRd (const USBD_MSC_LUN_CTRL *p_lun, 150 | CPU_INT08U scsi_cmd, 151 | CPU_INT08U *p_data_buf, 152 | CPU_INT32U data_len, 153 | CPU_INT32U *p_ret_len, 154 | USBD_ERR *p_err); 155 | 156 | void USBD_SCSI_DataWr (const USBD_MSC_LUN_CTRL *p_lun, 157 | CPU_INT08U scsi_cmd, 158 | void *p_data_buf, 159 | CPU_INT32U data_len, 160 | USBD_ERR *p_err); 161 | 162 | void USBD_SCSI_Reset ( void); 163 | 164 | void USBD_SCSI_Conn (const USBD_MSC_LUN_CTRL *p_lun); 165 | 166 | void USBD_SCSI_Unlock (const USBD_MSC_LUN_CTRL *p_lun, 167 | USBD_ERR *p_err); 168 | 169 | 170 | /* 171 | ********************************************************************************************************** 172 | * CONFIGURATION ERRORS 173 | ********************************************************************************************************** 174 | */ 175 | 176 | 177 | /* 178 | ********************************************************************************************************** 179 | * MODULE END 180 | ********************************************************************************************************** 181 | */ 182 | #endif 183 | -------------------------------------------------------------------------------- /Class/PHDC/OS/Template/usbd_phdc_os.c: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * uC/USB-Device 4 | * The Embedded USB Device Stack 5 | * 6 | * Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com 7 | * 8 | * SPDX-License-Identifier: APACHE-2.0 9 | * 10 | * This software is subject to an open source license and is distributed by 11 | * Silicon Laboratories Inc. pursuant to the terms of the Apache License, 12 | * Version 2.0 available at www.apache.org/licenses/LICENSE-2.0. 13 | * 14 | ********************************************************************************************************* 15 | */ 16 | 17 | /* 18 | ********************************************************************************************************* 19 | * 20 | * USB PHDC CLASS OPERATING SYSTEM LAYER 21 | * Micrium Template 22 | * 23 | * Filename : usbd_phdc_os.c 24 | * Version : V4.06.01 25 | ********************************************************************************************************* 26 | */ 27 | 28 | /* 29 | ********************************************************************************************************* 30 | * INCLUDE FILES 31 | ********************************************************************************************************* 32 | */ 33 | 34 | #include "../../usbd_phdc.h" 35 | #include "../../usbd_phdc_os.h" 36 | 37 | 38 | /* 39 | ********************************************************************************************************* 40 | * CONFIGURATION ERRORS 41 | ********************************************************************************************************* 42 | */ 43 | 44 | 45 | /* 46 | ********************************************************************************************************* 47 | * LOCAL DEFINES 48 | ********************************************************************************************************* 49 | */ 50 | 51 | 52 | /* 53 | ********************************************************************************************************* 54 | * LOCAL CONSTANTS 55 | ********************************************************************************************************* 56 | */ 57 | 58 | 59 | /* 60 | ********************************************************************************************************* 61 | * LOCAL DATA TYPES 62 | ********************************************************************************************************* 63 | */ 64 | 65 | 66 | /* 67 | ********************************************************************************************************* 68 | * LOCAL TABLES 69 | ********************************************************************************************************* 70 | */ 71 | 72 | 73 | /* 74 | ********************************************************************************************************* 75 | * LOCAL GLOBAL VARIABLES 76 | ********************************************************************************************************* 77 | */ 78 | 79 | 80 | /* 81 | ********************************************************************************************************* 82 | * LOCAL MACRO'S 83 | ********************************************************************************************************* 84 | */ 85 | 86 | 87 | /* 88 | ********************************************************************************************************* 89 | * LOCAL FUNCTION PROTOTYPES 90 | ********************************************************************************************************* 91 | */ 92 | 93 | static void USBD_PHDC_OS_WrBulkSchedTask(void *p_arg); 94 | 95 | 96 | /* 97 | ********************************************************************************************************* 98 | ********************************************************************************************************* 99 | * GLOBAL FUNCTIONS 100 | ********************************************************************************************************* 101 | ********************************************************************************************************* 102 | */ 103 | 104 | /* 105 | ********************************************************************************************************* 106 | * USBD_PHDC_OS_Init() 107 | * 108 | * Description : Initialize PHDC OS interface. 109 | * 110 | * Argument(s) : p_err Pointer to variable that will receive the return error code from this function : 111 | * 112 | * USBD_ERR_NONE OS initialization successful. 113 | * 114 | * Return(s) : none. 115 | * 116 | * Note(s) : none. 117 | ********************************************************************************************************* 118 | */ 119 | 120 | void USBD_PHDC_OS_Init (USBD_ERR *p_err) 121 | { 122 | /* $$$$ Initialize all internal variables and tasks used by OS layer. */ 123 | *p_err = USBD_ERR_NONE; 124 | } 125 | 126 | 127 | /* 128 | ********************************************************************************************************* 129 | * USBD_PHDC_OS_RdLock() 130 | * 131 | * Description : Lock PHDC read pipe. 132 | * 133 | * Argument(s) : class_nbr PHDC instance number; 134 | * 135 | * timeout_ms Timeout, in ms. 136 | * 137 | * p_err Pointer to variable that will receive the return error code from this function : 138 | * 139 | * USBD_ERR_NONE OS signal successfully acquired. 140 | * 141 | * Return(s) : none. 142 | * 143 | * Note(s) : none. 144 | ********************************************************************************************************* 145 | */ 146 | 147 | void USBD_PHDC_OS_RdLock (CPU_INT08U class_nbr, 148 | CPU_INT16U timeout_ms, 149 | USBD_ERR *p_err) 150 | { 151 | /* $$$$ Lock read pipe. */ 152 | *p_err = USBD_ERR_NONE; 153 | 154 | } 155 | 156 | 157 | /* 158 | ********************************************************************************************************* 159 | * USBD_PHDC_OS_RdUnlock() 160 | * 161 | * Description : Unlock PHDC read pipe. 162 | * 163 | * Argument(s) : class_nbr PHDC instance number; 164 | * 165 | * Return(s) : none. 166 | * 167 | * Note(s) : none. 168 | ********************************************************************************************************* 169 | */ 170 | 171 | void USBD_PHDC_OS_RdUnlock (CPU_INT08U class_nbr) 172 | { 173 | /* $$$$ Unlock read pipe. */ 174 | } 175 | 176 | 177 | /* 178 | ********************************************************************************************************* 179 | * USBD_PHDC_OS_WrIntrLock() 180 | * 181 | * Description : Lock PHDC write interrupt pipe. 182 | * 183 | * Argument(s) : class_nbr PHDC instance number; 184 | * 185 | * timeout_ms Timeout, in ms. 186 | * 187 | * p_err Pointer to variable that will receive the return error code from this function : 188 | * 189 | * USBD_ERR_NONE OS signal successfully acquired. 190 | * 191 | * Return(s) : none. 192 | * 193 | * Note(s) : none. 194 | ********************************************************************************************************* 195 | */ 196 | 197 | void USBD_PHDC_OS_WrIntrLock (CPU_INT08U class_nbr, 198 | CPU_INT16U timeout_ms, 199 | USBD_ERR *p_err) 200 | { 201 | /* $$$$ Lock interrupt write pipe. */ 202 | *p_err = USBD_ERR_NONE; 203 | } 204 | 205 | 206 | /* 207 | ********************************************************************************************************* 208 | * USBD_PHDC_OS_WrIntrUnlock() 209 | * 210 | * Description : Unlock PHDC write interrupt pipe. 211 | * 212 | * Argument(s) : class_nbr PHDC instance number; 213 | * 214 | * Return(s) : none. 215 | * 216 | * Note(s) : none. 217 | ********************************************************************************************************* 218 | */ 219 | 220 | void USBD_PHDC_OS_WrIntrUnlock (CPU_INT08U class_nbr) 221 | { 222 | /* $$$$ Unlock interrupt write pipe. */ 223 | } 224 | 225 | 226 | /* 227 | ********************************************************************************************************* 228 | * USBD_PHDC_OS_WrBulkLock() 229 | * 230 | * Description : Lock PHDC write bulk pipe. 231 | * 232 | * Argument(s) : class_nbr PHDC instance number; 233 | * 234 | * prio Priority of the transfer, based on its QoS. 235 | * 236 | * timeout_ms Timeout, in ms. 237 | * 238 | * p_err Pointer to variable that will receive the return error code from this function : 239 | * 240 | * USBD_ERR_NONE OS signal successfully acquired. 241 | * 242 | * Return(s) : none. 243 | * 244 | * Note(s) : none. 245 | ********************************************************************************************************* 246 | */ 247 | 248 | void USBD_PHDC_OS_WrBulkLock (CPU_INT08U class_nbr, 249 | CPU_INT08U prio, 250 | CPU_INT16U timeout_ms, 251 | USBD_ERR *p_err) 252 | { 253 | /* $$$$ Lock bulk write pipe. */ 254 | *p_err = USBD_ERR_NONE; 255 | } 256 | 257 | 258 | /* 259 | ********************************************************************************************************* 260 | * USBD_PHDC_OS_WrBulkUnlock() 261 | * 262 | * Description : Unlock PHDC write bulk pipe. 263 | * 264 | * Argument(s) : class_nbr PHDC instance number; 265 | * 266 | * Return(s) : none. 267 | * 268 | * Note(s) : none. 269 | ********************************************************************************************************* 270 | */ 271 | 272 | void USBD_PHDC_OS_WrBulkUnlock (CPU_INT08U class_nbr) 273 | { 274 | /* $$$$ Unlock bulk wirte pipe. */ 275 | } 276 | 277 | 278 | /* 279 | ********************************************************************************************************* 280 | * USBD_PHDC_OS_Reset() 281 | * 282 | * Description : Reset PHDC OS layer for given instance. 283 | * 284 | * Argument(s) : class_nbr PHDC instance number; 285 | * 286 | * Return(s) : none. 287 | * 288 | * Note(s) : none. 289 | ********************************************************************************************************* 290 | */ 291 | 292 | void USBD_PHDC_OS_Reset (CPU_INT08U class_nbr) 293 | { 294 | /* $$$$ Reset OS layer. */ 295 | } 296 | 297 | 298 | /* 299 | ********************************************************************************************************* 300 | * USBD_PHDC_OS_WrBulkSchedTask() 301 | * 302 | * Description : OS-dependent shell task to schedule bulk transfers in function of their priority. 303 | * 304 | * Argument(s) : p_arg Pointer to task initialization argument (required by uC/OS-III). 305 | * 306 | * Return(s) : none. 307 | * 308 | * Note(s) : (1) Only one task handle all class instances bulk write scheduling. 309 | ********************************************************************************************************* 310 | */ 311 | 312 | static void USBD_PHDC_OS_WrBulkSchedTask (void *p_arg) 313 | { 314 | /* $$$$ If QoS prioritization is used, implement this task to act as a scheduler. */ 315 | } 316 | -------------------------------------------------------------------------------- /Class/PHDC/usbd_phdc.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * uC/USB-Device 4 | * The Embedded USB Device Stack 5 | * 6 | * Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com 7 | * 8 | * SPDX-License-Identifier: APACHE-2.0 9 | * 10 | * This software is subject to an open source license and is distributed by 11 | * Silicon Laboratories Inc. pursuant to the terms of the Apache License, 12 | * Version 2.0 available at www.apache.org/licenses/LICENSE-2.0. 13 | * 14 | ********************************************************************************************************* 15 | */ 16 | 17 | /* 18 | ********************************************************************************************************* 19 | * 20 | * USB DEVICE PHDC CLASS 21 | * 22 | * Filename : usbd_phdc.h 23 | * Version : V4.06.01 24 | ********************************************************************************************************* 25 | */ 26 | 27 | /* 28 | ********************************************************************************************************* 29 | * MODULE 30 | ********************************************************************************************************* 31 | */ 32 | 33 | #ifndef USBD_PHDC_CLASS_MODULE_PRESENT 34 | #define USBD_PHDC_CLASS_MODULE_PRESENT 35 | 36 | 37 | /* 38 | ********************************************************************************************************* 39 | * INCLUDE FILES 40 | ********************************************************************************************************* 41 | */ 42 | 43 | #include "../../Source/usbd_core.h" 44 | 45 | 46 | /* 47 | ********************************************************************************************************* 48 | * EXTERNS 49 | ********************************************************************************************************* 50 | */ 51 | 52 | #ifdef USBD_PHDC_MODULE 53 | #define USBD_PHDC_EXT 54 | #else 55 | #define USBD_PHDC_EXT extern 56 | #endif 57 | 58 | 59 | /* 60 | ********************************************************************************************************* 61 | * DEFINES 62 | ********************************************************************************************************* 63 | */ 64 | 65 | #define USBD_PHDC_NBR_NONE DEF_INT_08U_MAX_VAL 66 | 67 | 68 | 69 | /* 70 | ********************************************************************************************************* 71 | * LATENCY / RELIABILITY BITMAPS 72 | ********************************************************************************************************* 73 | */ 74 | 75 | #define USBD_PHDC_LATENCY_VERYHIGH_RELY_BEST DEF_BIT_05 76 | #define USBD_PHDC_LATENCY_HIGH_RELY_BEST DEF_BIT_04 77 | #define USBD_PHDC_LATENCY_MEDIUM_RELY_BEST DEF_BIT_03 78 | #define USBD_PHDC_LATENCY_MEDIUM_RELY_BETTER DEF_BIT_02 79 | #define USBD_PHDC_LATENCY_MEDIUM_RELY_GOOD DEF_BIT_01 80 | #define USBD_PHDC_LATENCY_LOW_RELY_GOOD DEF_BIT_00 81 | 82 | 83 | /* 84 | ********************************************************************************************************* 85 | * DATA TYPES 86 | ********************************************************************************************************* 87 | */ 88 | 89 | typedef CPU_INT08U LATENCY_RELY_FLAGS; 90 | 91 | 92 | /* 93 | ********************************************************************************************************* 94 | * ASYNCHRONOUS CALLBACK FUNCTION DATA TYPE 95 | ********************************************************************************************************* 96 | */ 97 | 98 | typedef void (*USBD_PHDC_PREAMBLE_EN_NOTIFY)(CPU_INT08U class_nbr, 99 | CPU_BOOLEAN preamble_en); 100 | 101 | 102 | /* 103 | ********************************************************************************************************* 104 | * GLOBAL VARIABLES 105 | ********************************************************************************************************* 106 | */ 107 | 108 | 109 | /* 110 | ********************************************************************************************************* 111 | * MACRO'S 112 | ********************************************************************************************************* 113 | */ 114 | 115 | 116 | /* 117 | ********************************************************************************************************* 118 | * FUNCTION PROTOTYPES 119 | ********************************************************************************************************* 120 | */ 121 | 122 | /* 123 | ********************************************************************************************************* 124 | * APPLICATION FUNCTION PROTOTYPES 125 | ********************************************************************************************************* 126 | */ 127 | 128 | void USBD_PHDC_Init ( USBD_ERR *p_err); 129 | 130 | CPU_INT08U USBD_PHDC_Add ( CPU_BOOLEAN data_fmt_11073, 131 | CPU_BOOLEAN preamble_capable, 132 | USBD_PHDC_PREAMBLE_EN_NOTIFY preamble_en_notify, 133 | CPU_INT16U low_latency_interval, 134 | USBD_ERR *p_err); 135 | 136 | CPU_BOOLEAN USBD_PHDC_CfgAdd ( CPU_INT08U class_nbr, 137 | CPU_INT08U dev_nbr, 138 | CPU_INT08U cfg_nbr, 139 | USBD_ERR *p_err); 140 | 141 | CPU_BOOLEAN USBD_PHDC_IsConn ( CPU_INT08U class_nbr); 142 | 143 | void USBD_PHDC_RdCfg ( CPU_INT08U class_nbr, 144 | LATENCY_RELY_FLAGS latency_rely, 145 | const CPU_INT08U *p_data_opaque, 146 | CPU_INT08U data_opaque_len, 147 | USBD_ERR *p_err); 148 | 149 | void USBD_PHDC_WrCfg ( CPU_INT08U class_nbr, 150 | LATENCY_RELY_FLAGS latency_rely, 151 | const CPU_INT08U *p_data_opaque, 152 | CPU_INT08U data_opaque_len, 153 | USBD_ERR *p_err); 154 | 155 | void USBD_PHDC_11073_ExtCfg( CPU_INT08U class_nbr, 156 | CPU_INT16U *p_dev_specialization, 157 | CPU_INT08U nbr_dev_specialization, 158 | USBD_ERR *p_err); 159 | 160 | CPU_INT08U USBD_PHDC_PreambleRd ( CPU_INT08U class_nbr, 161 | void *p_buf, 162 | CPU_INT08U buf_len, 163 | CPU_INT08U *p_nbr_xfer, 164 | CPU_INT16U timeout, 165 | USBD_ERR *p_err); 166 | 167 | CPU_INT16U USBD_PHDC_Rd ( CPU_INT08U class_nbr, 168 | void *p_buf, 169 | CPU_INT16U buf_len, 170 | CPU_INT16U timeout, 171 | USBD_ERR *p_err); 172 | 173 | void USBD_PHDC_PreambleWr ( CPU_INT08U class_nbr, 174 | void *p_data_opaque, 175 | CPU_INT08U data_opaque_len, 176 | LATENCY_RELY_FLAGS latency_rely, 177 | CPU_INT08U nbr_xfers, 178 | CPU_INT16U timeout, 179 | USBD_ERR *p_err); 180 | 181 | void USBD_PHDC_Wr ( CPU_INT08U class_nbr, 182 | void *p_buf, 183 | CPU_INT16U buf_len, 184 | LATENCY_RELY_FLAGS latency_rely, 185 | CPU_INT16U timeout, 186 | USBD_ERR *p_err); 187 | 188 | void USBD_PHDC_Reset ( CPU_INT08U class_nbr); 189 | 190 | 191 | /* 192 | ********************************************************************************************************* 193 | * CONFIGURATION ERRORS 194 | ********************************************************************************************************* 195 | */ 196 | 197 | 198 | #ifndef USBD_PHDC_CFG_MAX_NBR_DEV 199 | #error "USBD_PHDC_CFG_MAX_NBR_DEV not #define'd in 'usbd_cfg.h' [MUST be >= 1]" 200 | #endif 201 | 202 | #if (USBD_PHDC_CFG_MAX_NBR_DEV < 1u) 203 | #error "USBD_PHDC_CFG_MAX_NBR_DEV illegally #define'd in 'usbd_cfg.h' [MUST be >= 1]" 204 | #endif 205 | 206 | #ifndef USBD_PHDC_CFG_MAX_NBR_CFG 207 | #error "USBD_PHDC_CFG_MAX_NBR_CFG not #define'd in 'usbd_cfg.h' [MUST be >= 1]" 208 | #endif 209 | 210 | #if (USBD_PHDC_CFG_MAX_NBR_CFG < 1u) 211 | #error "USBD_PHDC_CFG_MAX_NBR_CFG illegally #define'd in 'usbd_cfg.h' [MUST be >= 1]" 212 | #endif 213 | 214 | #ifndef USBD_PHDC_CFG_DATA_OPAQUE_MAX_LEN 215 | #error "USBD_PHDC_CFG_DATA_OPAQUE_MAX_LEN not #define'd in 'usbd_cfg.h' [MUST be >= 0]" 216 | #endif 217 | 218 | #if (USBD_PHDC_CFG_DATA_OPAQUE_MAX_LEN < 0u) 219 | #error "USBD_PHDC_CFG_DATA_OPAQUE_MAX_LEN illegally #define'd in 'usbd_cfg.h' [MUST be >= 0]" 220 | #endif 221 | 222 | 223 | /* 224 | ********************************************************************************************************* 225 | * MODULE END 226 | ********************************************************************************************************* 227 | */ 228 | 229 | #endif 230 | 231 | -------------------------------------------------------------------------------- /Class/PHDC/usbd_phdc_os.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * uC/USB-Device 4 | * The Embedded USB Device Stack 5 | * 6 | * Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com 7 | * 8 | * SPDX-License-Identifier: APACHE-2.0 9 | * 10 | * This software is subject to an open source license and is distributed by 11 | * Silicon Laboratories Inc. pursuant to the terms of the Apache License, 12 | * Version 2.0 available at www.apache.org/licenses/LICENSE-2.0. 13 | * 14 | ********************************************************************************************************* 15 | */ 16 | 17 | /* 18 | ********************************************************************************************************* 19 | * 20 | * USB PHDC CLASS OPERATING SYSTEM LAYER 21 | * 22 | * Filename : usbd_phdc_os.h 23 | * Version : V4.06.01 24 | ********************************************************************************************************* 25 | */ 26 | 27 | /* 28 | ********************************************************************************************************* 29 | * MODULE 30 | ********************************************************************************************************* 31 | */ 32 | 33 | #ifndef USBD_PHDC_OS_MODULE_PRESENT 34 | #define USBD_PHDC_OS_MODULE_PRESENT 35 | 36 | 37 | /* 38 | ********************************************************************************************************* 39 | * INCLUDE FILES 40 | ********************************************************************************************************* 41 | */ 42 | 43 | #include "../../Source/usbd_core.h" 44 | #include 45 | 46 | 47 | /* 48 | ********************************************************************************************************* 49 | * EXTERNS 50 | ********************************************************************************************************* 51 | */ 52 | 53 | 54 | /* 55 | ********************************************************************************************************* 56 | * DEFINES 57 | ********************************************************************************************************* 58 | */ 59 | 60 | 61 | /* 62 | ********************************************************************************************************* 63 | * DATA TYPES 64 | ********************************************************************************************************* 65 | */ 66 | 67 | 68 | /* 69 | ********************************************************************************************************* 70 | * GLOBAL VARIABLES 71 | ********************************************************************************************************* 72 | */ 73 | 74 | 75 | /* 76 | ********************************************************************************************************* 77 | * MACRO'S 78 | ********************************************************************************************************* 79 | */ 80 | 81 | 82 | /* 83 | ********************************************************************************************************* 84 | * FUNCTION PROTOTYPES 85 | ********************************************************************************************************* 86 | */ 87 | 88 | void USBD_PHDC_OS_Init ( USBD_ERR *p_err); 89 | 90 | void USBD_PHDC_OS_RdLock (CPU_INT08U class_nbr, 91 | CPU_INT16U timeout, 92 | USBD_ERR *p_err); 93 | 94 | void USBD_PHDC_OS_RdUnlock (CPU_INT08U class_nbr); 95 | 96 | 97 | void USBD_PHDC_OS_WrBulkLock (CPU_INT08U class_nbr, 98 | CPU_INT08U prio, 99 | CPU_INT16U timeout, 100 | USBD_ERR *p_err); 101 | 102 | void USBD_PHDC_OS_WrBulkUnlock(CPU_INT08U class_nbr); 103 | 104 | void USBD_PHDC_OS_WrIntrLock (CPU_INT08U class_nbr, 105 | CPU_INT16U timeout, 106 | USBD_ERR *p_err); 107 | 108 | void USBD_PHDC_OS_WrIntrUnlock(CPU_INT08U class_nbr); 109 | 110 | void USBD_PHDC_OS_Reset (CPU_INT08U class_nbr); 111 | 112 | 113 | /* 114 | ********************************************************************************************************* 115 | * CONFIGURATION ERRORS 116 | ********************************************************************************************************* 117 | */ 118 | 119 | #if (OS_VERSION >= 30000) 120 | #error "USB-Device PHDC class is not supported by uC/OS-III" 121 | #endif 122 | 123 | 124 | /* 125 | ********************************************************************************************************* 126 | * MODULE END 127 | ********************************************************************************************************* 128 | */ 129 | 130 | #endif 131 | -------------------------------------------------------------------------------- /Drivers/AT32UC3C/usbd_drv_at32uc3c.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * uC/USB-Device 4 | * The Embedded USB Device Stack 5 | * 6 | * Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com 7 | * 8 | * SPDX-License-Identifier: APACHE-2.0 9 | * 10 | * This software is subject to an open source license and is distributed by 11 | * Silicon Laboratories Inc. pursuant to the terms of the Apache License, 12 | * Version 2.0 available at www.apache.org/licenses/LICENSE-2.0. 13 | * 14 | ********************************************************************************************************* 15 | */ 16 | 17 | /* 18 | ********************************************************************************************************* 19 | * 20 | * USB DEVICE DRIVER 21 | * 22 | * AT32UC3C 23 | * 24 | * Filename : usbd_drv_at32uc3c.c 25 | * Version : V4.06.01 26 | ********************************************************************************************************* 27 | * Note(s) : (1) You can find specific information about this driver at: 28 | * https://doc.micrium.com/display/USBDDRV/AT32UC3C 29 | ********************************************************************************************************* 30 | */ 31 | 32 | /* 33 | ********************************************************************************************************* 34 | * MODULE 35 | * 36 | * Note(s) : (1) This USB device driver function header file is protected from multiple pre-processor 37 | * inclusion through use of the USB device driver module present pre-processor macro 38 | * definition. 39 | ********************************************************************************************************* 40 | */ 41 | 42 | #ifndef USBD_DRV_AT32UC3C_MODULE_PRESENT /* See Note #1. */ 43 | #define USBD_DRV_AT32UC3C_MODULE_PRESENT 44 | 45 | 46 | /* 47 | ********************************************************************************************************* 48 | * USB DEVICE DRIVER 49 | ********************************************************************************************************* 50 | */ 51 | 52 | extern USBD_DRV_API USBD_DrvAPI_AT32UC3C; 53 | 54 | 55 | /* 56 | ********************************************************************************************************* 57 | * MODULE END 58 | ********************************************************************************************************* 59 | */ 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /Drivers/AT32UC3x/usbd_drv_at32uc3x.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * uC/USB-Device 4 | * The Embedded USB Device Stack 5 | * 6 | * Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com 7 | * 8 | * SPDX-License-Identifier: APACHE-2.0 9 | * 10 | * This software is subject to an open source license and is distributed by 11 | * Silicon Laboratories Inc. pursuant to the terms of the Apache License, 12 | * Version 2.0 available at www.apache.org/licenses/LICENSE-2.0. 13 | * 14 | ********************************************************************************************************* 15 | */ 16 | 17 | /* 18 | ********************************************************************************************************* 19 | * 20 | * USB DEVICE DRIVER 21 | * 22 | * AT32UC3x 23 | * 24 | * Filename : usbd_drv_at32uc3x.c 25 | * Version : V4.06.01 26 | ********************************************************************************************************* 27 | * Note(s) : (1) You can find specific information about this driver at: 28 | * https://doc.micrium.com/display/USBDDRV/AT32UC3x 29 | * 30 | * (2) With an appropriate BSP, this device driver will support the USB device module on 31 | * the Atmel 32-bit AVR UC3 A and B series. 32 | * 33 | * (3) The device controller does not support synthetizing a corrupted SOF packet. It 34 | * reports an error flag meaning that the software should handle it properly. 35 | ********************************************************************************************************* 36 | */ 37 | 38 | #ifndef USBD_DRV_AT32UC3x_MODULE_PRESENT /* See Note #1. */ 39 | #define USBD_DRV_AT32UC3x_MODULE_PRESENT 40 | 41 | 42 | /* 43 | ********************************************************************************************************* 44 | * USB DEVICE DRIVER 45 | ********************************************************************************************************* 46 | */ 47 | 48 | extern USBD_DRV_API USBD_DrvAPI_AT32UC3x; 49 | 50 | 51 | /* 52 | ********************************************************************************************************* 53 | * MODULE END 54 | ********************************************************************************************************* 55 | */ 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /Drivers/AT91SAM_UDPHS/usbd_at91sam_udphs.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * uC/USB-Device 4 | * The Embedded USB Device Stack 5 | * 6 | * Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com 7 | * 8 | * SPDX-License-Identifier: APACHE-2.0 9 | * 10 | * This software is subject to an open source license and is distributed by 11 | * Silicon Laboratories Inc. pursuant to the terms of the Apache License, 12 | * Version 2.0 available at www.apache.org/licenses/LICENSE-2.0. 13 | * 14 | ********************************************************************************************************* 15 | */ 16 | 17 | /* 18 | ********************************************************************************************************* 19 | * 20 | * USB DEVICE DRIVER 21 | * 22 | * AT91SAM-UDPHS 23 | * 24 | * Filename : usbd_at91sam_udphs.h 25 | * Version : V4.06.01 26 | ********************************************************************************************************* 27 | * Note(s) : (1) You can find specific information about this driver at: 28 | * https://doc.micrium.com/display/USBDDRV/AT91SAM_UDPHS 29 | ********************************************************************************************************* 30 | */ 31 | 32 | /* 33 | ********************************************************************************************************* 34 | * MODULE 35 | * 36 | * Note(s) : (1) This USB device driver function header file is protected from multiple pre-processor 37 | * inclusion through use of the USB device driver module present pre-processor macro 38 | * definition. 39 | ********************************************************************************************************* 40 | */ 41 | 42 | #ifndef USBD_DRV_AT91SAM_UDPHS_MODULE_PRESENT /* See Note #1. */ 43 | #define USBD_DRV_AT91SAM_UDPHS_MODULE_PRESENT 44 | 45 | 46 | /* 47 | ********************************************************************************************************* 48 | * USB DEVICE DRIVER 49 | ********************************************************************************************************* 50 | */ 51 | 52 | extern USBD_DRV_API USBD_DrvAPI_AT91SAM_UDPHS; 53 | 54 | 55 | /* 56 | ********************************************************************************************************* 57 | * MODULE END 58 | ********************************************************************************************************* 59 | */ 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /Drivers/Kinetis_Kxx/usbd_drv_kinetis_kxx.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * uC/USB-Device 4 | * The Embedded USB Device Stack 5 | * 6 | * Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com 7 | * 8 | * SPDX-License-Identifier: APACHE-2.0 9 | * 10 | * This software is subject to an open source license and is distributed by 11 | * Silicon Laboratories Inc. pursuant to the terms of the Apache License, 12 | * Version 2.0 available at www.apache.org/licenses/LICENSE-2.0. 13 | * 14 | ********************************************************************************************************* 15 | */ 16 | 17 | /* 18 | ********************************************************************************************************* 19 | * 20 | * USB DEVICE DRIVER 21 | * 22 | * KINETIS 23 | * 24 | * Filename : usbd_drv_kinetis.h 25 | * Version : V4.06.01 26 | ********************************************************************************************************* 27 | * Note(s) : (1) You can find specific information about this driver at: 28 | * https://doc.micrium.com/display/USBDDRV/Kinetis_Kxx 29 | ********************************************************************************************************* 30 | */ 31 | 32 | /* 33 | ********************************************************************************************************* 34 | * MODULE 35 | * 36 | * Note(s) : (1) This USB device driver function header file is protected from multiple pre-processor 37 | * inclusion through use of the USB device driver module present pre-processor macro 38 | * definition. 39 | ********************************************************************************************************* 40 | */ 41 | 42 | #ifndef USBD_DRV_KINETIS_MODULE_PRESENT /* See Note #1. */ 43 | #define USBD_DRV_KINETIS_MODULE_PRESENT 44 | 45 | 46 | /* 47 | ********************************************************************************************************* 48 | * USB DEVICE DRIVER 49 | ********************************************************************************************************* 50 | */ 51 | 52 | extern USBD_DRV_API USBD_DrvAPI_KINETIS; 53 | 54 | 55 | /* 56 | ********************************************************************************************************* 57 | * MODULE END 58 | ********************************************************************************************************* 59 | */ 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /Drivers/LPCxxxx/usbd_drv_lpcxxxx.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * uC/USB-Device 4 | * The Embedded USB Device Stack 5 | * 6 | * Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com 7 | * 8 | * SPDX-License-Identifier: APACHE-2.0 9 | * 10 | * This software is subject to an open source license and is distributed by 11 | * Silicon Laboratories Inc. pursuant to the terms of the Apache License, 12 | * Version 2.0 available at www.apache.org/licenses/LICENSE-2.0. 13 | * 14 | ********************************************************************************************************* 15 | */ 16 | 17 | /* 18 | ********************************************************************************************************* 19 | * 20 | * USB DEVICE DRIVER 21 | * 22 | * LPCXXXX 23 | * 24 | * Filename : usbd_drv_lpcxxxx.h 25 | * Version : V4.06.01 26 | ********************************************************************************************************* 27 | * Note(s) : (1) You can find specific information about this driver at: 28 | * https://doc.micrium.com/display/USBDDRV/LPCxxxx 29 | ********************************************************************************************************* 30 | */ 31 | 32 | /* 33 | ********************************************************************************************************* 34 | * MODULE 35 | * 36 | * Note(s) : (1) This USB device driver function header file is protected from multiple pre-processor 37 | * inclusion through use of the USB device driver module present pre-processor macro 38 | * definition. 39 | ********************************************************************************************************* 40 | */ 41 | 42 | #ifndef USBD_DRV_LPCXXXX_MODULE_PRESENT /* See Note #1. */ 43 | #define USBD_DRV_LPCXXXX_MODULE_PRESENT 44 | 45 | /* 46 | ********************************************************************************************************* 47 | * USB DEVICE DRIVER 48 | ********************************************************************************************************* 49 | */ 50 | 51 | extern USBD_DRV_API USBD_DrvAPI_LPCXXXX_DMA; 52 | extern USBD_DRV_API USBD_DrvAPI_LPCXXXX_FIFO; 53 | 54 | 55 | /* 56 | ********************************************************************************************************* 57 | * MODULE END 58 | ********************************************************************************************************* 59 | */ 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /Drivers/RM48x/usbd_drv_rm48x.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * uC/USB-Device 4 | * The Embedded USB Device Stack 5 | * 6 | * Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com 7 | * 8 | * SPDX-License-Identifier: APACHE-2.0 9 | * 10 | * This software is subject to an open source license and is distributed by 11 | * Silicon Laboratories Inc. pursuant to the terms of the Apache License, 12 | * Version 2.0 available at www.apache.org/licenses/LICENSE-2.0. 13 | * 14 | ********************************************************************************************************* 15 | */ 16 | 17 | /* 18 | ********************************************************************************************************* 19 | * 20 | * USB DEVICE DRIVER 21 | * RM48X 22 | * 23 | * Filename : usbd_drv_rm48x.h 24 | * Version : V4.06.01 25 | ********************************************************************************************************* 26 | * Note(s) : (1) You can find specific information about this driver at: 27 | * https://doc.micrium.com/display/USBDDRV/RM48x 28 | ********************************************************************************************************* 29 | */ 30 | 31 | /* 32 | ********************************************************************************************************* 33 | * MODULE 34 | * 35 | * Note(s) : (1) This USB device driver function header file is protected from multiple pre-processor 36 | * inclusion through use of the USB device driver module present pre-processor macro 37 | * definition. 38 | ********************************************************************************************************* 39 | */ 40 | 41 | #ifndef USBD_DRV_RM48X_MODULE_PRESENT /* See Note #1. */ 42 | #define USBD_DRV_RM48X_MODULE_PRESENT 43 | 44 | /* 45 | ********************************************************************************************************* 46 | * USB DEVICE DRIVER 47 | ********************************************************************************************************* 48 | */ 49 | 50 | extern USBD_DRV_API USBD_DrvAPI_RM48X; 51 | 52 | 53 | /* 54 | ********************************************************************************************************* 55 | * MODULE END 56 | ********************************************************************************************************* 57 | */ 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /Drivers/RX600/usbd_drv_rx600.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * uC/USB-Device 4 | * The Embedded USB Device Stack 5 | * 6 | * Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com 7 | * 8 | * SPDX-License-Identifier: APACHE-2.0 9 | * 10 | * This software is subject to an open source license and is distributed by 11 | * Silicon Laboratories Inc. pursuant to the terms of the Apache License, 12 | * Version 2.0 available at www.apache.org/licenses/LICENSE-2.0. 13 | * 14 | ********************************************************************************************************* 15 | */ 16 | 17 | /* 18 | ********************************************************************************************************* 19 | * 20 | * USB DEVICE DRIVER 21 | * 22 | * Renesas RX600 23 | * Renesas RX100 24 | * Renesas V850E2/Jx4-L 25 | * 26 | * Filename : usbd_drv_rx600.h 27 | * Version : V4.06.01 28 | ********************************************************************************************************* 29 | * Note(s) : (1) You can find specific information about this driver at: 30 | * https://doc.micrium.com/display/USBDDRV/RX600 31 | ********************************************************************************************************* 32 | */ 33 | 34 | /* 35 | ********************************************************************************************************* 36 | * MODULE 37 | * 38 | * Note(s) : (1) This USB device driver function header file is protected from multiple pre-processor 39 | * inclusion through use of the USB device driver module present pre-processor macro 40 | * definition. 41 | ********************************************************************************************************* 42 | */ 43 | 44 | #ifndef USBD_DRV_RX600_MODULE_PRESENT /* See Note #1. */ 45 | #define USBD_DRV_RX600_MODULE_PRESENT 46 | 47 | 48 | /* 49 | ********************************************************************************************************* 50 | * USB DEVICE DRIVER 51 | ********************************************************************************************************* 52 | */ 53 | 54 | extern USBD_DRV_API USBD_DrvAPI_RX600; 55 | extern USBD_DRV_API USBD_DrvAPI_V850E2JX4L; 56 | 57 | 58 | /* 59 | ********************************************************************************************************* 60 | * CIRCULAR BUFFER CONFIGURATION 61 | ********************************************************************************************************* 62 | */ 63 | 64 | #define USBD_DRV_SETUP_PKT_CIRCULAR_BUF_SIZE 3u 65 | 66 | 67 | /* 68 | ********************************************************************************************************* 69 | * MODULE END 70 | ********************************************************************************************************* 71 | */ 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /Drivers/Renesas_USBHS/usbd_drv_renesas_usbhs.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * uC/USB-Device 4 | * The Embedded USB Device Stack 5 | * 6 | * Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com 7 | * 8 | * SPDX-License-Identifier: APACHE-2.0 9 | * 10 | * This software is subject to an open source license and is distributed by 11 | * Silicon Laboratories Inc. pursuant to the terms of the Apache License, 12 | * Version 2.0 available at www.apache.org/licenses/LICENSE-2.0. 13 | * 14 | ********************************************************************************************************* 15 | */ 16 | 17 | /* 18 | ********************************************************************************************************* 19 | * 20 | * USB DEVICE DRIVER 21 | * 22 | * RENESAS USB HIGH-SPEED 23 | * 24 | * Filename : usbd_drv_renesas_usbhs.h 25 | * Version : V4.06.01 26 | ********************************************************************************************************* 27 | * Note(s) : (1) You can find specific information about this driver at: 28 | * https://doc.micrium.com/display/USBDDRV/RENESAS_USBHS 29 | ********************************************************************************************************* 30 | */ 31 | 32 | /* 33 | ********************************************************************************************************* 34 | * MODULE 35 | * 36 | * Note(s) : (1) This USB device driver function header file is protected from multiple pre-processor 37 | * inclusion through use of the USB device driver module present pre-processor macro 38 | * definition. 39 | ********************************************************************************************************* 40 | */ 41 | 42 | #ifndef USBD_DRV_RENESAS_USBHS_MODULE_PRESENT /* See Note #1. */ 43 | #define USBD_DRV_RENESAS_USBHS_MODULE_PRESENT 44 | 45 | 46 | /* 47 | ********************************************************************************************************* 48 | * INCLUDE FILES 49 | ********************************************************************************************************* 50 | */ 51 | 52 | #include "../../Source/usbd_core.h" 53 | 54 | 55 | /* 56 | ********************************************************************************************************* 57 | * FUNCTION PROTOTYPES 58 | ********************************************************************************************************* 59 | */ 60 | 61 | 62 | /* 63 | ********************************************************************************************************* 64 | * USB DEVICE DRIVER 65 | ********************************************************************************************************* 66 | */ 67 | 68 | extern USBD_DRV_API USBD_DrvAPI_RenesasRZ_DMA; 69 | extern USBD_DRV_API USBD_DrvAPI_RenesasRZ_FIFO; 70 | 71 | extern USBD_DRV_API USBD_DrvAPI_RenesasRX64M_DMA; 72 | extern USBD_DRV_API USBD_DrvAPI_RenesasRX64M_FIFO; 73 | 74 | 75 | /* 76 | ********************************************************************************************************* 77 | * MODULE END 78 | ********************************************************************************************************* 79 | */ 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /Drivers/STM32F_FS/usbd_drv_stm32f_fs.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * uC/USB-Device 4 | * The Embedded USB Device Stack 5 | * 6 | * Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com 7 | * 8 | * SPDX-License-Identifier: APACHE-2.0 9 | * 10 | * This software is subject to an open source license and is distributed by 11 | * Silicon Laboratories Inc. pursuant to the terms of the Apache License, 12 | * Version 2.0 available at www.apache.org/licenses/LICENSE-2.0. 13 | * 14 | ********************************************************************************************************* 15 | */ 16 | 17 | /* 18 | ********************************************************************************************************* 19 | * 20 | * USB DEVICE DRIVER 21 | * 22 | * USB ON-THE-GO FULL-SPEED (OTG_FS) 23 | * 24 | * Filename : usbd_drv_stm32f_fs.h 25 | * Version : V4.06.01 26 | ********************************************************************************************************* 27 | * Note(s) : (1) You can find specific information about this driver at: 28 | * https://doc.micrium.com/display/USBDDRV/STM32F_FS 29 | ********************************************************************************************************* 30 | */ 31 | 32 | /* 33 | ********************************************************************************************************* 34 | * MODULE 35 | * 36 | * Note(s) : (1) This USB device driver function header file is protected from multiple pre-processor 37 | * inclusion through use of the USB device driver module present pre-processor macro 38 | * definition. 39 | ********************************************************************************************************* 40 | */ 41 | 42 | #ifndef USBD_DRV_STM32F_FS_MODULE_PRESENT /* See Note #1. */ 43 | #define USBD_DRV_STM32F_FS_MODULE_PRESENT 44 | 45 | /* 46 | ********************************************************************************************************* 47 | * USB DEVICE DRIVER 48 | * Note(s) : (1) The following MCUs are support by USBD_DrvAPI_STM32F_FS API: 49 | * 50 | * STMicroelectronics STM32F105xx series. 51 | * STMicroelectronics STM32F107xx series. 52 | * STMicroelectronics STM32F205xx series. 53 | * STMicroelectronics STM32F207xx series. 54 | * STMicroelectronics STM32F215xx series. 55 | * STMicroelectronics STM32F217xx series. 56 | * STMicroelectronics STM32F405xx series. 57 | * STMicroelectronics STM32F407xx series. 58 | * STMicroelectronics STM32F415xx series. 59 | * STMicroelectronics STM32F417xx series. 60 | * 61 | * (2) The following MCUs are support by USBD_DrvAPI_STM32F_OTG_FS API: 62 | * 63 | * STMicroelectronics STM32F74xx series. 64 | * STMicroelectronics STM32F75xx series. 65 | * 66 | * (3) The following MCUs are support by USBD_DrvAPI_EFM32_OTG_FS API: 67 | * 68 | * Silicon Labs EFM32 Giant Gecko series. 69 | * Silicon Labs EFM32 Wonder Gecko series. 70 | * Silicon Labs EFM32 Leopard Gecko series. 71 | * 72 | * (4) The following MCUs are support by USBD_DrvAPI_XMC_OTG_FS API: 73 | * 74 | * Infineon XMC4100 series. 75 | * Infineon XMC4200 series. 76 | * Infineon XMC4300 series. 77 | * Infineon XMC4400 series. 78 | * Infineon XMC4500 series. 79 | * Infineon XMC4700 series. 80 | * Infineon XMC4800 series. 81 | * 82 | ********************************************************************************************************* 83 | */ 84 | 85 | extern USBD_DRV_API USBD_DrvAPI_STM32F_FS; 86 | extern USBD_DRV_API USBD_DrvAPI_STM32F_OTG_FS; 87 | extern USBD_DRV_API USBD_DrvAPI_EFM32_OTG_FS; 88 | extern USBD_DRV_API USBD_DrvAPI_XMC_OTG_FS; 89 | 90 | 91 | /* 92 | ********************************************************************************************************* 93 | * MODULE END 94 | ********************************************************************************************************* 95 | */ 96 | 97 | #endif 98 | -------------------------------------------------------------------------------- /Drivers/STM32xxx/usbd_drv_stm32xxx.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * uC/USB-Device 4 | * The Embedded USB Device Stack 5 | * 6 | * Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com 7 | * 8 | * SPDX-License-Identifier: APACHE-2.0 9 | * 10 | * This software is subject to an open source license and is distributed by 11 | * Silicon Laboratories Inc. pursuant to the terms of the Apache License, 12 | * Version 2.0 available at www.apache.org/licenses/LICENSE-2.0. 13 | * 14 | ********************************************************************************************************* 15 | */ 16 | 17 | /* 18 | ********************************************************************************************************* 19 | * 20 | * USB DEVICE DRIVER 21 | * 22 | * STM32xxx 23 | * USB Full-speed Device 24 | * 25 | * Filename : usbd_drv_stm32xxx.h 26 | * Version : V4.06.01 27 | ********************************************************************************************************* 28 | * Note(s) : (1) You can find specific information about this driver at: 29 | * https://doc.micrium.com/display/USBDDRV/STM32xxx 30 | ********************************************************************************************************* 31 | */ 32 | 33 | /* 34 | ********************************************************************************************************* 35 | * MODULE 36 | * 37 | * Note(s) : (1) This USB device driver function header file is protected from multiple pre-processor 38 | * inclusion through use of the USB device driver module present pre-processor macro 39 | * definition. 40 | ********************************************************************************************************* 41 | */ 42 | 43 | #ifndef USBD_DRV_STM32XXX_MODULE_PRESENT /* See Note #1. */ 44 | #define USBD_DRV_STM32XXX_MODULE_PRESENT 45 | 46 | 47 | /* 48 | ********************************************************************************************************* 49 | * USB DEVICE DRIVER 50 | ********************************************************************************************************* 51 | */ 52 | 53 | extern USBD_DRV_API USBD_DrvAPI_STM32XXX; 54 | 55 | 56 | /* 57 | ********************************************************************************************************* 58 | * MODULE END 59 | ********************************************************************************************************* 60 | */ 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /Drivers/STR91xxx/usbd_drv_str91xxx.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * uC/USB-Device 4 | * The Embedded USB Device Stack 5 | * 6 | * Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com 7 | * 8 | * SPDX-License-Identifier: APACHE-2.0 9 | * 10 | * This software is subject to an open source license and is distributed by 11 | * Silicon Laboratories Inc. pursuant to the terms of the Apache License, 12 | * Version 2.0 available at www.apache.org/licenses/LICENSE-2.0. 13 | * 14 | ********************************************************************************************************* 15 | */ 16 | 17 | /* 18 | ********************************************************************************************************* 19 | * 20 | * USB DEVICE DRIVER 21 | * 22 | * STR91xxx 23 | * 24 | * Filename : usbd_drv_str91xxx.h 25 | * Version : V4.06.01 26 | ********************************************************************************************************* 27 | * Note(s) : (1) You can find specific information about this driver at: 28 | * https://doc.micrium.com/display/USBDDRV/STR91xxx 29 | ********************************************************************************************************* 30 | */ 31 | 32 | /* 33 | ********************************************************************************************************* 34 | * MODULE 35 | * 36 | * Note(s) : (1) This USB device driver function header file is protected from multiple pre-processor 37 | * inclusion through use of the USB device driver module present pre-processor macro 38 | * definition. 39 | ********************************************************************************************************* 40 | */ 41 | 42 | #ifndef USBD_DRV_STR91XXX_MODULE_PRESENT /* See Note #1. */ 43 | #define USBD_DRV_STR91XXX_MODULE_PRESENT 44 | 45 | /* 46 | ********************************************************************************************************* 47 | * USB DEVICE DRIVER 48 | ********************************************************************************************************* 49 | */ 50 | 51 | extern USBD_DRV_API USBD_DrvAPI_STR91XXX; 52 | 53 | 54 | /* 55 | ********************************************************************************************************* 56 | * MODULE END 57 | ********************************************************************************************************* 58 | */ 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /Drivers/Synopsys_OTG_HS/usbd_drv_synopsys_otg_hs.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * uC/USB-Device 4 | * The Embedded USB Device Stack 5 | * 6 | * Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com 7 | * 8 | * SPDX-License-Identifier: APACHE-2.0 9 | * 10 | * This software is subject to an open source license and is distributed by 11 | * Silicon Laboratories Inc. pursuant to the terms of the Apache License, 12 | * Version 2.0 available at www.apache.org/licenses/LICENSE-2.0. 13 | * 14 | ********************************************************************************************************* 15 | */ 16 | 17 | /* 18 | ********************************************************************************************************* 19 | * 20 | * USB DEVICE DRIVER 21 | * SYNOPSYS (CHIPIDEA) CORE USB 2.0 OTG (HS) 22 | * 23 | * Filename : usbd_drv_synopsys_otg_hs.h 24 | * Version : V4.06.01 25 | ********************************************************************************************************* 26 | * Note(s) : (1) You can find specific information about this driver at: 27 | * https://doc.micrium.com/display/USBDDRV/Synopsys_OTG_HS 28 | ********************************************************************************************************* 29 | */ 30 | 31 | /* 32 | ********************************************************************************************************* 33 | * MODULE 34 | * 35 | * Note(s) : (1) This USB device driver function header file is protected from multiple pre-processor 36 | * inclusion through use of the USB device driver module present pre-processor macro 37 | * definition. 38 | ********************************************************************************************************* 39 | */ 40 | 41 | #ifndef USBD_DRV_OTGHS_MODULE_PRESENT /* See Note #1. */ 42 | #define USBD_DRV_OTGHS_MODULE_PRESENT 43 | 44 | 45 | /* 46 | ********************************************************************************************************* 47 | * USB DEVICE DRIVER 48 | ********************************************************************************************************* 49 | */ 50 | 51 | extern USBD_DRV_API USBD_DrvAPI_Synopsys_OTG_HS; 52 | 53 | 54 | /* 55 | ********************************************************************************************************* 56 | * MODULE END 57 | ********************************************************************************************************* 58 | */ 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /Drivers/TM4C123x/usbd_drv_tm4c123x.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * uC/USB-Device 4 | * The Embedded USB Device Stack 5 | * 6 | * Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com 7 | * 8 | * SPDX-License-Identifier: APACHE-2.0 9 | * 10 | * This software is subject to an open source license and is distributed by 11 | * Silicon Laboratories Inc. pursuant to the terms of the Apache License, 12 | * Version 2.0 available at www.apache.org/licenses/LICENSE-2.0. 13 | * 14 | ********************************************************************************************************* 15 | */ 16 | 17 | /* 18 | ********************************************************************************************************* 19 | * 20 | * USB DEVICE DRIVER 21 | * 22 | * Texas Instruments Tiva C Series USB-OTG 23 | * 24 | * Filename : usbd_drv_tm4c123x.h 25 | * Version : V4.06.01 26 | ********************************************************************************************************* 27 | * Note(s) : (1) You can find specific information about this driver at: 28 | * https://doc.micrium.com/display/USBDDRV/TM4C123x 29 | * 30 | * (2) With an appropriate BSP, this device driver will support the USB-OTG device module 31 | * on the entire Texas Instruments Tiva C Series. 32 | ********************************************************************************************************* 33 | */ 34 | 35 | /* 36 | ********************************************************************************************************* 37 | * MODULE 38 | * 39 | * Note(s) : (1) This USB device driver function header file is protected from multiple pre-processor 40 | * inclusion through use of the USB device driver module present pre-processor macro 41 | * definition. 42 | ********************************************************************************************************* 43 | */ 44 | 45 | #ifndef USBD_DRV_TM4C123X_MODULE_PRESENT /* See Note #1. */ 46 | #define USBD_DRV_TM4C123X_MODULE_PRESENT 47 | 48 | /* 49 | ********************************************************************************************************* 50 | * USB DEVICE DRIVER 51 | ********************************************************************************************************* 52 | */ 53 | 54 | extern USBD_DRV_API USBD_DrvAPI_TM4C123X; 55 | extern USBD_DRV_API USBD_DrvAPI_MSP432E; 56 | 57 | 58 | /* 59 | ********************************************************************************************************* 60 | * MODULE END 61 | ********************************************************************************************************* 62 | */ 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /Drivers/Template/bsp_usbd_template.c: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * EXAMPLE CODE 4 | * 5 | * This file is provided as an example on how to use Micrium products. 6 | * 7 | * Please feel free to use any application code labeled as 'EXAMPLE CODE' in 8 | * your application products. Example code may be used as is, in whole or in 9 | * part, or may be used as a reference only. This file can be modified as 10 | * required to meet the end-product requirements. 11 | * 12 | ********************************************************************************************************* 13 | */ 14 | 15 | /* 16 | ********************************************************************************************************* 17 | * 18 | * USB DEVICE DRIVER BOARD SUPPORT PACKAGE (BSP) FUNCTIONS 19 | * 20 | * TEMPLATE 21 | * 22 | * Filename : bsp_usbd_template.c 23 | * Version : V4.06.01 24 | ********************************************************************************************************* 25 | */ 26 | 27 | /* 28 | ********************************************************************************************************* 29 | * INCLUDE FILES 30 | ********************************************************************************************************* 31 | */ 32 | 33 | #include "../../Source/usbd_core.h" 34 | #include "bsp_usbd_template.h" 35 | 36 | 37 | /* 38 | ********************************************************************************************************* 39 | * LOCAL DEFINES 40 | ********************************************************************************************************* 41 | */ 42 | 43 | 44 | /* 45 | ********************************************************************************************************* 46 | * LOCAL CONSTANTS 47 | ********************************************************************************************************* 48 | */ 49 | 50 | 51 | /* 52 | ********************************************************************************************************* 53 | * LOCAL TABLES 54 | ********************************************************************************************************* 55 | */ 56 | 57 | 58 | /* 59 | ********************************************************************************************************* 60 | * USB DEVICE ENDPOINT INFORMATION TABLE 61 | ********************************************************************************************************* 62 | */ 63 | 64 | USBD_DRV_EP_INFO USBD_DrvEP_InfoTbl_Template[] = { 65 | {USBD_EP_INFO_TYPE_CTRL | USBD_EP_INFO_DIR_OUT, 0u, 64u}, 66 | {USBD_EP_INFO_TYPE_CTRL | USBD_EP_INFO_DIR_IN, 0u, 64u}, 67 | {USBD_EP_INFO_TYPE_ISOC | USBD_EP_INFO_TYPE_BULK | USBD_EP_INFO_TYPE_INTR | USBD_EP_INFO_DIR_OUT, 1u, 1024u}, 68 | {USBD_EP_INFO_TYPE_ISOC | USBD_EP_INFO_TYPE_BULK | USBD_EP_INFO_TYPE_INTR | USBD_EP_INFO_DIR_IN, 1u, 1024u}, 69 | {USBD_EP_INFO_TYPE_ISOC | USBD_EP_INFO_TYPE_BULK | USBD_EP_INFO_TYPE_INTR | USBD_EP_INFO_DIR_OUT, 2u, 1024u}, 70 | {USBD_EP_INFO_TYPE_ISOC | USBD_EP_INFO_TYPE_BULK | USBD_EP_INFO_TYPE_INTR | USBD_EP_INFO_DIR_IN, 2u, 1024u}, 71 | {USBD_EP_INFO_TYPE_ISOC | USBD_EP_INFO_TYPE_BULK | USBD_EP_INFO_TYPE_INTR | USBD_EP_INFO_DIR_OUT, 3u, 1024u}, 72 | {USBD_EP_INFO_TYPE_ISOC | USBD_EP_INFO_TYPE_BULK | USBD_EP_INFO_TYPE_INTR | USBD_EP_INFO_DIR_IN, 3u, 1024u}, 73 | {DEF_BIT_NONE , 0u, 0u} 74 | }; 75 | 76 | 77 | /* 78 | ********************************************************************************************************* 79 | * LOCAL GLOBAL VARIABLES 80 | ********************************************************************************************************* 81 | */ 82 | 83 | static USBD_DRV *BSP_USBD_Controller_DrvPtr; 84 | 85 | 86 | /* 87 | ********************************************************************************************************* 88 | * LOCAL MACROS 89 | ********************************************************************************************************* 90 | */ 91 | 92 | 93 | /* 94 | ********************************************************************************************************* 95 | * LOCAL FUNCTION PROTOTYPES 96 | ********************************************************************************************************* 97 | */ 98 | 99 | static void BSP_USBD_Template_Init (USBD_DRV *p_drv); 100 | static void BSP_USBD_Template_Connect (void ); 101 | static void BSP_USBD_Template_Disconnect (void ); 102 | static void BSP_USBD_Controller_IntHandler(void *p_arg); 103 | 104 | 105 | /* 106 | ********************************************************************************************************* 107 | * USB DEVICE DRIVER BSP INTERFACE 108 | ********************************************************************************************************* 109 | */ 110 | 111 | USBD_DRV_BSP_API USBD_DrvBSP_Template = { 112 | BSP_USBD_Template_Init, 113 | BSP_USBD_Template_Connect, 114 | BSP_USBD_Template_Disconnect 115 | }; 116 | 117 | 118 | /* 119 | ********************************************************************************************************* 120 | * LOCAL CONFIGURATION ERRORS 121 | ********************************************************************************************************* 122 | */ 123 | 124 | 125 | /* 126 | ********************************************************************************************************* 127 | ********************************************************************************************************* 128 | * LOCAL FUNCTIONS 129 | ********************************************************************************************************* 130 | ********************************************************************************************************* 131 | */ 132 | 133 | /* 134 | ********************************************************************************************************* 135 | * BSP_USBD_Template_Init() 136 | * 137 | * Description : USB device controller board-specific initialization. 138 | * 139 | * Argument(s) : p_drv Pointer to device driver structure. 140 | * 141 | * Return(s) : none. 142 | * 143 | * Note(s) : none. 144 | ********************************************************************************************************* 145 | */ 146 | 147 | static void BSP_USBD_Template_Init (USBD_DRV *p_drv) 148 | { 149 | (void)p_drv; 150 | 151 | /* $$$$ If ISR does not support argument passing, save reference to USBD_DRV in a local global variable. */ 152 | BSP_USBD_Controller_DrvPtr = p_drv; 153 | 154 | /* $$$$ This function performs all operations that the device controller cannot do. Typical operations are: */ 155 | 156 | /* $$$$ Enable device control registers and bus clock [mandatory]. */ 157 | /* $$$$ Configure main USB device interrupt in interrupt controller (e.g. registering BSP ISR) [mandatory]. */ 158 | /* $$$$ Disable device transceiver clock [optional]. */ 159 | /* $$$$ Configure I/O pins [if necessary]. */ 160 | } 161 | 162 | 163 | /* 164 | ********************************************************************************************************* 165 | * BSP_USBD_Template_Connect() 166 | * 167 | * Description : Connect pull-up on DP. 168 | * 169 | * Argument(s) : none. 170 | * 171 | * Return(s) : none. 172 | * 173 | * Note(s) : none. 174 | ********************************************************************************************************* 175 | */ 176 | 177 | static void BSP_USBD_Template_Connect (void) 178 | { 179 | /* $$$$ Enable device transceiver clock [optional]. */ 180 | /* $$$$ Enable pull-up resistor (this operation may be done in the driver) [mandatory]. */ 181 | /* $$$$ Enable main USB device interrupt [mandatory]. */ 182 | } 183 | 184 | 185 | /* 186 | ********************************************************************************************************* 187 | * BSP_USBD_Template_Disconnect() 188 | * 189 | * Description : Disconnect pull-up on DP. 190 | * 191 | * Argument(s) : none. 192 | * 193 | * Return(s) : none. 194 | * 195 | * Note(s) : none. 196 | ********************************************************************************************************* 197 | */ 198 | 199 | static void BSP_USBD_Template_Disconnect (void) 200 | { 201 | /* $$$$ Disable device transceiver clock [optional]. */ 202 | /* $$$$ Disable pull-up resistor (this operation may be done in the driver) [mandatory]. */ 203 | /* $$$$ Disable main USB device interrupt [mandatory]. */ 204 | } 205 | 206 | 207 | /* 208 | ********************************************************************************************************* 209 | * BSP_USBD_Controller_IntHandler() 210 | * 211 | * Description : USB device interrupt handler. 212 | * 213 | * Argument(s) : p_arg Interrupt handler argument. 214 | * 215 | * Return(s) : none. 216 | * 217 | * Note(s) : none. 218 | ********************************************************************************************************* 219 | */ 220 | 221 | static void BSP_USBD_Controller_IntHandler (void *p_arg) 222 | { 223 | USBD_DRV *p_drv; 224 | USBD_DRV_API *p_drv_api; 225 | 226 | 227 | /* Get a reference to USBD_DRV. */ 228 | /* $$$$ If ISR does not support argument passing, get USBD_DRV from a global variable initialized in BSP_USBD_Template_Init(). */ 229 | p_drv = BSP_USBD_Controller_DrvPtr; 230 | /* $$$$ Otherwise if ISR supports argument passing, get USBD_DRV from the argument. Do not forget to pass USBD_DRV structure when registering the BSP ISR in BSP_USBD_Template_Init(). */ 231 | p_drv = (USBD_DRV *)p_arg; 232 | 233 | p_drv_api = p_drv->API_Ptr; /* Get a reference to USBD_DRV_API. */ 234 | p_drv_api->ISR_Handler(p_drv); /* Call the USB Device driver ISR. */ 235 | } 236 | -------------------------------------------------------------------------------- /Drivers/Template/bsp_usbd_template.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * EXAMPLE CODE 4 | * 5 | * This file is provided as an example on how to use Micrium products. 6 | * 7 | * Please feel free to use any application code labeled as 'EXAMPLE CODE' in 8 | * your application products. Example code may be used as is, in whole or in 9 | * part, or may be used as a reference only. This file can be modified as 10 | * required to meet the end-product requirements. 11 | * 12 | ********************************************************************************************************* 13 | */ 14 | 15 | /* 16 | ********************************************************************************************************* 17 | * 18 | * USB DEVICE DRIVER BOARD SUPPORT PACKAGE (BSP) FUNCTIONS 19 | * 20 | * TEMPLATE 21 | * 22 | * Filename : bsp_usbd_template.h 23 | * Version : V4.06.01 24 | ********************************************************************************************************* 25 | */ 26 | 27 | /* 28 | ********************************************************************************************************* 29 | * MODULE 30 | * 31 | * Note(s) : (1) This USB device driver board-specific function header file is protected from multiple 32 | * pre-processor inclusion through use of the USB device configuration module present pre- 33 | * processor macro definition. 34 | ********************************************************************************************************* 35 | */ 36 | 37 | #ifndef BSP_USBD_PRESENT /* See Note #1. */ 38 | #define BSP_USBD_PRESENT 39 | 40 | 41 | /* 42 | ********************************************************************************************************* 43 | * INCLUDE FILES 44 | ********************************************************************************************************* 45 | */ 46 | 47 | #include "usbd_drv_template.h" 48 | 49 | 50 | /* 51 | ********************************************************************************************************* 52 | * GLOBAL VARIABLES 53 | ********************************************************************************************************* 54 | */ 55 | 56 | extern USBD_DRV_EP_INFO USBD_DrvEP_InfoTbl_Template[]; 57 | extern USBD_DRV_BSP_API USBD_DrvBSP_Template; 58 | 59 | 60 | /* 61 | ********************************************************************************************************* 62 | * MODULE END 63 | ********************************************************************************************************* 64 | */ 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /Drivers/Template/usbd_drv_template.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * EXAMPLE CODE 4 | * 5 | * This file is provided as an example on how to use Micrium products. 6 | * 7 | * Please feel free to use any application code labeled as 'EXAMPLE CODE' in 8 | * your application products. Example code may be used as is, in whole or in 9 | * part, or may be used as a reference only. This file can be modified as 10 | * required to meet the end-product requirements. 11 | * 12 | ********************************************************************************************************* 13 | */ 14 | 15 | /* 16 | ********************************************************************************************************* 17 | * 18 | * USB DEVICE DRIVER 19 | * 20 | * TEMPLATE 21 | * 22 | * Filename : usbd_drv_template.h 23 | * Version : V4.06.01 24 | ********************************************************************************************************* 25 | */ 26 | 27 | /* 28 | ********************************************************************************************************* 29 | * MODULE 30 | * 31 | * Note(s) : (1) This USB device driver function header file is protected from multiple pre-processor 32 | * inclusion through use of the USB device driver module present pre-processor macro 33 | * definition. 34 | ********************************************************************************************************* 35 | */ 36 | 37 | #ifndef USBD_DRV_TEMPLATE_MODULE_PRESENT /* See Note #1. */ 38 | #define USBD_DRV_TEMPLATE_MODULE_PRESENT 39 | 40 | /* 41 | ********************************************************************************************************* 42 | * USB DEVICE DRIVER 43 | ********************************************************************************************************* 44 | */ 45 | 46 | extern USBD_DRV_API USBD_DrvAPI_Template; 47 | 48 | 49 | /* 50 | ********************************************************************************************************* 51 | * MODULE END 52 | ********************************************************************************************************* 53 | */ 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /Drivers/drv_lib/usbd_drv_lib.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * uC/USB-Device 4 | * The Embedded USB Device Stack 5 | * 6 | * Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com 7 | * 8 | * SPDX-License-Identifier: APACHE-2.0 9 | * 10 | * This software is subject to an open source license and is distributed by 11 | * Silicon Laboratories Inc. pursuant to the terms of the Apache License, 12 | * Version 2.0 available at www.apache.org/licenses/LICENSE-2.0. 13 | * 14 | ********************************************************************************************************* 15 | */ 16 | 17 | /* 18 | ********************************************************************************************************* 19 | * 20 | * USB DEVICE DRIVER 21 | * 22 | * Common library 23 | * 24 | * Filename : usbd_drv_lib.h 25 | * Version : V4.06.01 26 | ********************************************************************************************************* 27 | */ 28 | 29 | /* 30 | ********************************************************************************************************* 31 | * MODULE 32 | ********************************************************************************************************* 33 | */ 34 | 35 | #ifndef USBD_DRV_LIB_MODULE_PRESENT 36 | #define USBD_DRV_LIB_MODULE_PRESENT 37 | 38 | 39 | /* 40 | ********************************************************************************************************* 41 | * INCLUDE FILES 42 | ********************************************************************************************************* 43 | */ 44 | 45 | 46 | /* 47 | ********************************************************************************************************* 48 | * EXTERNS 49 | ********************************************************************************************************* 50 | */ 51 | 52 | #ifdef USBD_DRV_LIB_MODULE 53 | #define USBD_DRV_LIB_EXT 54 | #else 55 | #define USBD_DRV_LIB_EXT extern 56 | #endif 57 | 58 | 59 | /* 60 | ********************************************************************************************************* 61 | * DEFINES 62 | ********************************************************************************************************* 63 | */ 64 | 65 | 66 | /* 67 | ********************************************************************************************************* 68 | * DATA TYPES 69 | ********************************************************************************************************* 70 | */ 71 | 72 | /* ------------------- SETUP PACKET ------------------- */ 73 | typedef struct usbd_drv_lib_setup_pkt { 74 | CPU_INT32U SetupPkt[2u]; /* Setup req buf: |Request|Value|Index|Length| */ 75 | } USBD_DRV_LIB_SETUP_PKT; 76 | 77 | 78 | /* ---------------- SETUP PACKET QUEUE ---------------- */ 79 | typedef struct usbd_drv_lib_setup_pkt_q { 80 | USBD_DRV_LIB_SETUP_PKT *SetupPktTblPtr; /* Ptr to table that contains the Q'd setup pkt. */ 81 | 82 | CPU_INT08U IxIn; /* Ix where to put the next rxd setup pkt. */ 83 | CPU_INT08U IxOut; /* Ix where to get the next setup pkt to give to core. */ 84 | CPU_INT08U Nbr; /* Actual nbr of pkts in the buf. */ 85 | CPU_INT08U TblLen; /* Len of setup pkt tbl. */ 86 | } USBD_DRV_LIB_SETUP_PKT_Q; 87 | 88 | 89 | /* 90 | ********************************************************************************************************* 91 | * GLOBAL VARIABLES 92 | ********************************************************************************************************* 93 | */ 94 | 95 | 96 | /* 97 | ********************************************************************************************************* 98 | * MACROS 99 | ********************************************************************************************************* 100 | */ 101 | 102 | 103 | /* 104 | ********************************************************************************************************* 105 | * CONFIGURATION ERRORS 106 | ********************************************************************************************************* 107 | */ 108 | 109 | void USBD_DrvLib_SetupPktQInit (USBD_DRV_LIB_SETUP_PKT_Q *p_setup_pkt_q, 110 | CPU_INT08U q_size, 111 | USBD_ERR *p_err); 112 | 113 | void USBD_DrvLib_SetupPktQClr (USBD_DRV_LIB_SETUP_PKT_Q *p_setup_pkt_q); 114 | 115 | void USBD_DrvLib_SetupPktQAdd (USBD_DRV_LIB_SETUP_PKT_Q *p_setup_pkt_q, 116 | USBD_DRV *p_drv, 117 | CPU_INT32U *p_setup_pkt_buf); 118 | 119 | void USBD_DrvLib_SetupPktQSubmitNext(USBD_DRV_LIB_SETUP_PKT_Q *p_setup_pkt_q, 120 | USBD_DRV *p_drv); 121 | 122 | 123 | /* 124 | ********************************************************************************************************* 125 | * MODULE END 126 | ********************************************************************************************************* 127 | */ 128 | 129 | #endif 130 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | ATTENTION ALL USERS OF THIS REPOSITORY: 2 | 3 | The original work found in this repository is provided by Silicon Labs under the 4 | Apache License, Version 2.0. 5 | 6 | Any third party may contribute derivative works to the original work in which 7 | modifications are clearly identified as being licensed under: 8 | 9 | (1) the Apache License, Version 2.0 or a compatible open source license; or 10 | (2) under a proprietary license with a copy of such license deposited. 11 | 12 | All posted derivative works must clearly identify which license choice has been 13 | elected. 14 | 15 | No such posted derivative works will be considered to be a “Contribution” under 16 | the Apache License, Version 2.0. 17 | 18 | SILICON LABS MAKES NO WARRANTY WITH RESPECT TO ALL POSTED THIRD PARTY CONTENT 19 | AND DISCLAIMS ALL OTHER WARRANTIES OR LIABILITIES, INCLUDING ALL WARRANTIES OF 20 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, OWNERSHIP, 21 | NON-INFRINGEMENT, AND NON-MISAPPROPRIATION. 22 | 23 | In the event a derivative work is desired to be submitted to Silicon Labs as a 24 | “Contribution” under the Apache License, Version 2.0, a “Contributor” must give 25 | written email notice to micrium@weston-embedded.com. Unless an email response in 26 | the affirmative to accept the derivative work as a “Contribution”, such email 27 | submission should be considered to have not been incorporated into the original 28 | work. 29 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | .. raw:: html 2 | 3 | 4 |

5 | 6 |

7 |
8 | 9 | µC/OS is a full-featured embedded operating system originally developed by Micriµm™. In addition to the two highly popular kernels, µC/OS features support for TCP/IP, USB-Device, USB-Host, and Modbus, as well as a robust File System. 10 | 11 | Since its founding in 1999 as a private company, Micriµm and its team of engineers have offered world-class embedded software components for the most critical and demanding real-time applications. Recognized as having some of the cleanest code in the industry, with easy-to-understand documentation, the Micrium real-time kernels, and software components have successfully been deployed in thousands of products worldwide across a broad range of industries. Micrium’s µC/OS-II™ kernel has been certified for use in safety-critical applications and remains a respected favorite in the medical, aerospace, and industrial markets. µC/OS continues to be the RTOS of choice for engineers requiring the most reliable and trusted solution for their mission-critical applications. 12 | 13 | ---------- 14 | 15 | .. raw:: HTML 16 | 17 | 18 |

19 | 20 |

21 |
22 | 23 | Founded by a team of former Micrium employees, Weston Embedded Solutions is the official custodian for the µC/OS RTOS and Stacks software repository to ensure it remains the trusted choice for embedded engineers around the world. 24 | 25 | ---------- 26 | 27 | Product Documentation and Release Notes 28 | *************** 29 | https://micrium.atlassian.net/ 30 | 31 | Technical Support 32 | ***************** 33 | https://weston-embedded.com/micrium-support 34 | 35 | Example Projects 36 | ********* 37 | https://weston-embedded.com/micrium-examples 38 | 39 | Commercial Licensing Option 40 | ********* 41 | https://weston-embedded.com/products/cesium 42 | 43 | Who to Contact 44 | ********* 45 | https://weston-embedded.com/company/contact -------------------------------------------------------------------------------- /Source/usbd_internal.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * uC/USB-Device 4 | * The Embedded USB Device Stack 5 | * 6 | * Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com 7 | * 8 | * SPDX-License-Identifier: APACHE-2.0 9 | * 10 | * This software is subject to an open source license and is distributed by 11 | * Silicon Laboratories Inc. pursuant to the terms of the Apache License, 12 | * Version 2.0 available at www.apache.org/licenses/LICENSE-2.0. 13 | * 14 | ********************************************************************************************************* 15 | */ 16 | 17 | /* 18 | ********************************************************************************************************* 19 | * 20 | * USB DEVICE CORE INTERNAL FUNCTIONS 21 | * 22 | * Filename : usbd_internal.h 23 | * Version : V4.06.01 24 | ********************************************************************************************************* 25 | */ 26 | 27 | /* 28 | ********************************************************************************************************* 29 | * MODULE 30 | ********************************************************************************************************* 31 | */ 32 | 33 | #ifndef USBD_INTERNAL_MODULE_PRESENT 34 | #define USBD_INTERNAL_MODULE_PRESENT 35 | 36 | /* 37 | ********************************************************************************************************* 38 | * INCLUDE FILES 39 | ********************************************************************************************************* 40 | */ 41 | 42 | #include "usbd_core.h" 43 | 44 | 45 | /* 46 | ********************************************************************************************************* 47 | * EXTERNS 48 | ********************************************************************************************************* 49 | */ 50 | 51 | 52 | /* 53 | ********************************************************************************************************* 54 | * DEFINES 55 | ********************************************************************************************************* 56 | */ 57 | 58 | 59 | /* 60 | ********************************************************************************************************* 61 | * DATA TYPES 62 | ********************************************************************************************************* 63 | */ 64 | 65 | 66 | /* 67 | ********************************************************************************************************* 68 | * GLOBAL VARIABLES 69 | ********************************************************************************************************* 70 | */ 71 | 72 | 73 | /* 74 | ********************************************************************************************************* 75 | * MACRO'S 76 | ********************************************************************************************************* 77 | */ 78 | 79 | 80 | /* 81 | ********************************************************************************************************* 82 | * INTERNAL FUNCTION PROTOTYPES 83 | ********************************************************************************************************* 84 | */ 85 | /* ------------ DEVICE INTERNAL FUNCTIONS ------------ */ 86 | USBD_DRV *USBD_DrvRefGet (CPU_INT08U dev_nbr); 87 | 88 | void USBD_CoreTaskHandler (void); 89 | 90 | void USBD_DbgTaskHandler (void); 91 | 92 | /* ------------ ENDPOINT INTERNAL FUNCTIONS ----------- */ 93 | void USBD_EP_Init (void); 94 | 95 | void USBD_EventEP (USBD_DRV *p_drv, 96 | CPU_INT08U ep_addr, 97 | USBD_ERR err); 98 | 99 | void USBD_CtrlOpen (CPU_INT08U dev_nbr, 100 | CPU_INT16U max_pkt_size, 101 | USBD_ERR *p_err); 102 | 103 | void USBD_CtrlClose (CPU_INT08U dev_nbr, 104 | USBD_ERR *p_err); 105 | 106 | void USBD_CtrlStall (CPU_INT08U dev_nbr, 107 | USBD_ERR *p_err); 108 | 109 | void USBD_CtrlRxStatus (CPU_INT08U dev_nbr, 110 | CPU_INT16U timeout_ms, 111 | USBD_ERR *p_err); 112 | 113 | void USBD_CtrlTxStatus (CPU_INT08U dev_nbr, 114 | CPU_INT16U timeout_ms, 115 | USBD_ERR *p_err); 116 | 117 | void USBD_EP_Open (USBD_DRV *p_drv, 118 | CPU_INT08U ep_addr, 119 | CPU_INT16U max_pkt_size, 120 | CPU_INT08U attrib, 121 | CPU_INT08U interval, 122 | USBD_ERR *p_err); 123 | 124 | void USBD_EP_Close (USBD_DRV *p_drv, 125 | CPU_INT08U ep_addr, 126 | USBD_ERR *p_err); 127 | 128 | void USBD_EP_XferAsyncProcess(USBD_DRV *p_drv, 129 | CPU_INT08U ep_addr, 130 | USBD_ERR xfer_err); 131 | 132 | 133 | /* 134 | ********************************************************************************************************* 135 | * FUNCTION PROTOTYPES 136 | * DEFINED IN OS'S usbd_os.c 137 | ********************************************************************************************************* 138 | */ 139 | 140 | void USBD_OS_Init (USBD_ERR *p_err); 141 | 142 | void USBD_OS_EP_SignalCreate(CPU_INT08U dev_nbr, 143 | CPU_INT08U ep_ix, 144 | USBD_ERR *p_err); 145 | 146 | void USBD_OS_EP_SignalDel (CPU_INT08U dev_nbr, 147 | CPU_INT08U ep_ix); 148 | 149 | void USBD_OS_EP_SignalPend (CPU_INT08U dev_nbr, 150 | CPU_INT08U ep_ix, 151 | CPU_INT16U timeout_ms, 152 | USBD_ERR *p_err); 153 | 154 | void USBD_OS_EP_SignalAbort (CPU_INT08U dev_nbr, 155 | CPU_INT08U ep_ix, 156 | USBD_ERR *p_err); 157 | 158 | void USBD_OS_EP_SignalPost (CPU_INT08U dev_nbr, 159 | CPU_INT08U ep_ix, 160 | USBD_ERR *p_err); 161 | 162 | void USBD_OS_EP_LockCreate (CPU_INT08U dev_nbr, 163 | CPU_INT08U ep_ix, 164 | USBD_ERR *p_err); 165 | 166 | void USBD_OS_EP_LockDel (CPU_INT08U dev_nbr, 167 | CPU_INT08U ep_ix); 168 | 169 | void USBD_OS_EP_LockAcquire (CPU_INT08U dev_nbr, 170 | CPU_INT08U ep_ix, 171 | CPU_INT16U timeout_ms, 172 | USBD_ERR *p_err); 173 | 174 | void USBD_OS_EP_LockRelease (CPU_INT08U dev_nbr, 175 | CPU_INT08U ep_ix); 176 | 177 | void USBD_OS_DbgEventRdy (void); 178 | void USBD_OS_DbgEventWait (void); 179 | 180 | void *USBD_OS_CoreEventGet (CPU_INT32U timeout_ms, 181 | USBD_ERR *p_err); 182 | 183 | void USBD_OS_CoreEventPut (void *p_event); 184 | 185 | 186 | /* 187 | ********************************************************************************************************* 188 | * CONFIGURATION ERRORS 189 | ********************************************************************************************************* 190 | */ 191 | 192 | 193 | /* 194 | ********************************************************************************************************* 195 | * MODULE END 196 | ********************************************************************************************************* 197 | */ 198 | 199 | #endif 200 | 201 | --------------------------------------------------------------------------------