| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,172 @@ |
| 1 |
+/** |
|
| 2 |
+ ****************************************************************************** |
|
| 3 |
+ * @file usbd_core.h |
|
| 4 |
+ * @author MCD Application Team |
|
| 5 |
+ * @brief Header file for usbd_core.c file |
|
| 6 |
+ ****************************************************************************** |
|
| 7 |
+ * @attention |
|
| 8 |
+ * |
|
| 9 |
+ * Copyright (c) 2015 STMicroelectronics. |
|
| 10 |
+ * All rights reserved. |
|
| 11 |
+ * |
|
| 12 |
+ * This software is licensed under terms that can be found in the LICENSE file |
|
| 13 |
+ * in the root directory of this software component. |
|
| 14 |
+ * If no LICENSE file comes with this software, it is provided AS-IS. |
|
| 15 |
+ * |
|
| 16 |
+ ****************************************************************************** |
|
| 17 |
+ */ |
|
| 18 |
+ |
|
| 19 |
+/* Define to prevent recursive inclusion -------------------------------------*/ |
|
| 20 |
+#ifndef __USBD_CORE_H |
|
| 21 |
+#define __USBD_CORE_H |
|
| 22 |
+ |
|
| 23 |
+#ifdef __cplusplus |
|
| 24 |
+extern "C" {
|
|
| 25 |
+#endif |
|
| 26 |
+ |
|
| 27 |
+/* Includes ------------------------------------------------------------------*/ |
|
| 28 |
+#include "usbd_conf.h" |
|
| 29 |
+#include "usbd_def.h" |
|
| 30 |
+#include "usbd_ioreq.h" |
|
| 31 |
+#include "usbd_ctlreq.h" |
|
| 32 |
+ |
|
| 33 |
+/** @addtogroup STM32_USB_DEVICE_LIBRARY |
|
| 34 |
+ * @{
|
|
| 35 |
+ */ |
|
| 36 |
+ |
|
| 37 |
+/** @defgroup USBD_CORE |
|
| 38 |
+ * @brief This file is the Header file for usbd_core.c file |
|
| 39 |
+ * @{
|
|
| 40 |
+ */ |
|
| 41 |
+ |
|
| 42 |
+ |
|
| 43 |
+/** @defgroup USBD_CORE_Exported_Defines |
|
| 44 |
+ * @{
|
|
| 45 |
+ */ |
|
| 46 |
+#ifndef USBD_DEBUG_LEVEL |
|
| 47 |
+#define USBD_DEBUG_LEVEL 0U |
|
| 48 |
+#endif /* USBD_DEBUG_LEVEL */ |
|
| 49 |
+/** |
|
| 50 |
+ * @} |
|
| 51 |
+ */ |
|
| 52 |
+ |
|
| 53 |
+ |
|
| 54 |
+/** @defgroup USBD_CORE_Exported_TypesDefinitions |
|
| 55 |
+ * @{
|
|
| 56 |
+ */ |
|
| 57 |
+ |
|
| 58 |
+ |
|
| 59 |
+/** |
|
| 60 |
+ * @} |
|
| 61 |
+ */ |
|
| 62 |
+ |
|
| 63 |
+ |
|
| 64 |
+ |
|
| 65 |
+/** @defgroup USBD_CORE_Exported_Macros |
|
| 66 |
+ * @{
|
|
| 67 |
+ */ |
|
| 68 |
+ |
|
| 69 |
+/** |
|
| 70 |
+ * @} |
|
| 71 |
+ */ |
|
| 72 |
+ |
|
| 73 |
+/** @defgroup USBD_CORE_Exported_Variables |
|
| 74 |
+ * @{
|
|
| 75 |
+ */ |
|
| 76 |
+#define USBD_SOF USBD_LL_SOF |
|
| 77 |
+/** |
|
| 78 |
+ * @} |
|
| 79 |
+ */ |
|
| 80 |
+ |
|
| 81 |
+/** @defgroup USBD_CORE_Exported_FunctionsPrototype |
|
| 82 |
+ * @{
|
|
| 83 |
+ */ |
|
| 84 |
+USBD_StatusTypeDef USBD_Init(USBD_HandleTypeDef *pdev, USBD_DescriptorsTypeDef *pdesc, uint8_t id); |
|
| 85 |
+USBD_StatusTypeDef USBD_DeInit(USBD_HandleTypeDef *pdev); |
|
| 86 |
+USBD_StatusTypeDef USBD_Start(USBD_HandleTypeDef *pdev); |
|
| 87 |
+USBD_StatusTypeDef USBD_Stop(USBD_HandleTypeDef *pdev); |
|
| 88 |
+USBD_StatusTypeDef USBD_RegisterClass(USBD_HandleTypeDef *pdev, USBD_ClassTypeDef *pclass); |
|
| 89 |
+ |
|
| 90 |
+#ifdef USE_USBD_COMPOSITE |
|
| 91 |
+USBD_StatusTypeDef USBD_RegisterClassComposite(USBD_HandleTypeDef *pdev, USBD_ClassTypeDef *pclass, |
|
| 92 |
+ USBD_CompositeClassTypeDef classtype, uint8_t *EpAddr); |
|
| 93 |
+ |
|
| 94 |
+USBD_StatusTypeDef USBD_UnRegisterClassComposite(USBD_HandleTypeDef *pdev); |
|
| 95 |
+uint8_t USBD_CoreGetEPAdd(USBD_HandleTypeDef *pdev, uint8_t ep_dir, uint8_t ep_type, uint8_t ClassId); |
|
| 96 |
+#endif /* USE_USBD_COMPOSITE */ |
|
| 97 |
+ |
|
| 98 |
+uint8_t USBD_CoreFindIF(USBD_HandleTypeDef *pdev, uint8_t index); |
|
| 99 |
+uint8_t USBD_CoreFindEP(USBD_HandleTypeDef *pdev, uint8_t index); |
|
| 100 |
+ |
|
| 101 |
+USBD_StatusTypeDef USBD_RunTestMode(USBD_HandleTypeDef *pdev); |
|
| 102 |
+USBD_StatusTypeDef USBD_SetClassConfig(USBD_HandleTypeDef *pdev, uint8_t cfgidx); |
|
| 103 |
+USBD_StatusTypeDef USBD_ClrClassConfig(USBD_HandleTypeDef *pdev, uint8_t cfgidx); |
|
| 104 |
+ |
|
| 105 |
+USBD_StatusTypeDef USBD_LL_SetupStage(USBD_HandleTypeDef *pdev, uint8_t *psetup); |
|
| 106 |
+USBD_StatusTypeDef USBD_LL_DataOutStage(USBD_HandleTypeDef *pdev, uint8_t epnum, uint8_t *pdata); |
|
| 107 |
+USBD_StatusTypeDef USBD_LL_DataInStage(USBD_HandleTypeDef *pdev, uint8_t epnum, uint8_t *pdata); |
|
| 108 |
+ |
|
| 109 |
+USBD_StatusTypeDef USBD_LL_Reset(USBD_HandleTypeDef *pdev); |
|
| 110 |
+USBD_StatusTypeDef USBD_LL_SetSpeed(USBD_HandleTypeDef *pdev, USBD_SpeedTypeDef speed); |
|
| 111 |
+USBD_StatusTypeDef USBD_LL_Suspend(USBD_HandleTypeDef *pdev); |
|
| 112 |
+USBD_StatusTypeDef USBD_LL_Resume(USBD_HandleTypeDef *pdev); |
|
| 113 |
+ |
|
| 114 |
+USBD_StatusTypeDef USBD_LL_SOF(USBD_HandleTypeDef *pdev); |
|
| 115 |
+USBD_StatusTypeDef USBD_LL_IsoINIncomplete(USBD_HandleTypeDef *pdev, uint8_t epnum); |
|
| 116 |
+USBD_StatusTypeDef USBD_LL_IsoOUTIncomplete(USBD_HandleTypeDef *pdev, uint8_t epnum); |
|
| 117 |
+ |
|
| 118 |
+USBD_StatusTypeDef USBD_LL_DevConnected(USBD_HandleTypeDef *pdev); |
|
| 119 |
+USBD_StatusTypeDef USBD_LL_DevDisconnected(USBD_HandleTypeDef *pdev); |
|
| 120 |
+ |
|
| 121 |
+/* USBD Low Level Driver */ |
|
| 122 |
+USBD_StatusTypeDef USBD_LL_Init(USBD_HandleTypeDef *pdev); |
|
| 123 |
+USBD_StatusTypeDef USBD_LL_DeInit(USBD_HandleTypeDef *pdev); |
|
| 124 |
+USBD_StatusTypeDef USBD_LL_Start(USBD_HandleTypeDef *pdev); |
|
| 125 |
+USBD_StatusTypeDef USBD_LL_Stop(USBD_HandleTypeDef *pdev); |
|
| 126 |
+ |
|
| 127 |
+USBD_StatusTypeDef USBD_LL_OpenEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr, |
|
| 128 |
+ uint8_t ep_type, uint16_t ep_mps); |
|
| 129 |
+ |
|
| 130 |
+USBD_StatusTypeDef USBD_LL_CloseEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr); |
|
| 131 |
+USBD_StatusTypeDef USBD_LL_FlushEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr); |
|
| 132 |
+USBD_StatusTypeDef USBD_LL_StallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr); |
|
| 133 |
+USBD_StatusTypeDef USBD_LL_ClearStallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr); |
|
| 134 |
+USBD_StatusTypeDef USBD_LL_SetUSBAddress(USBD_HandleTypeDef *pdev, uint8_t dev_addr); |
|
| 135 |
+ |
|
| 136 |
+USBD_StatusTypeDef USBD_LL_Transmit(USBD_HandleTypeDef *pdev, uint8_t ep_addr, |
|
| 137 |
+ uint8_t *pbuf, uint32_t size); |
|
| 138 |
+ |
|
| 139 |
+USBD_StatusTypeDef USBD_LL_PrepareReceive(USBD_HandleTypeDef *pdev, uint8_t ep_addr, |
|
| 140 |
+ uint8_t *pbuf, uint32_t size); |
|
| 141 |
+ |
|
| 142 |
+#ifdef USBD_HS_TESTMODE_ENABLE |
|
| 143 |
+USBD_StatusTypeDef USBD_LL_SetTestMode(USBD_HandleTypeDef *pdev, uint8_t testmode); |
|
| 144 |
+#endif /* USBD_HS_TESTMODE_ENABLE */ |
|
| 145 |
+ |
|
| 146 |
+uint8_t USBD_LL_IsStallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr); |
|
| 147 |
+uint32_t USBD_LL_GetRxDataSize(USBD_HandleTypeDef *pdev, uint8_t ep_addr); |
|
| 148 |
+ |
|
| 149 |
+void USBD_LL_Delay(uint32_t Delay); |
|
| 150 |
+ |
|
| 151 |
+void *USBD_GetEpDesc(uint8_t *pConfDesc, uint8_t EpAddr); |
|
| 152 |
+USBD_DescHeaderTypeDef *USBD_GetNextDesc(uint8_t *pbuf, uint16_t *ptr); |
|
| 153 |
+ |
|
| 154 |
+/** |
|
| 155 |
+ * @} |
|
| 156 |
+ */ |
|
| 157 |
+ |
|
| 158 |
+#ifdef __cplusplus |
|
| 159 |
+} |
|
| 160 |
+#endif |
|
| 161 |
+ |
|
| 162 |
+#endif /* __USBD_CORE_H */ |
|
| 163 |
+ |
|
| 164 |
+/** |
|
| 165 |
+ * @} |
|
| 166 |
+ */ |
|
| 167 |
+ |
|
| 168 |
+/** |
|
| 169 |
+ * @} |
|
| 170 |
+ */ |
|
| 171 |
+ |
|
| 172 |
+ |