Prusa MINI Firmware overview
usbd_core.h
Go to the documentation of this file.
1 /**
2  ******************************************************************************
3  * @file usbd_core.h
4  * @author MCD Application Team
5  * @version V2.4.2
6  * @date 11-December-2015
7  * @brief Header file for usbd_core.c file
8  ******************************************************************************
9  * @attention
10  *
11  * <h2><center>&copy; COPYRIGHT 2015 STMicroelectronics</center></h2>
12  *
13  * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
14  * You may not use this file except in compliance with the License.
15  * You may obtain a copy of the License at:
16  *
17  * http://www.st.com/software_license_agreement_liberty_v2
18  *
19  * Unless required by applicable law or agreed to in writing, software
20  * distributed under the License is distributed on an "AS IS" BASIS,
21  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22  * See the License for the specific language governing permissions and
23  * limitations under the License.
24  *
25  ******************************************************************************
26  */
27 
28 /* Define to prevent recursive inclusion -------------------------------------*/
29 #ifndef __USBD_CORE_H
30 #define __USBD_CORE_H
31 
32 #ifdef __cplusplus
33  extern "C" {
34 #endif
35 
36 /* Includes ------------------------------------------------------------------*/
37 #include "usbd_conf.h"
38 #include "usbd_def.h"
39 #include "usbd_ioreq.h"
40 #include "usbd_ctlreq.h"
41 
42 /** @addtogroup STM32_USB_DEVICE_LIBRARY
43  * @{
44  */
45 
46 /** @defgroup USBD_CORE
47  * @brief This file is the Header file for usbd_core.c file
48  * @{
49  */
50 
51 
52 /** @defgroup USBD_CORE_Exported_Defines
53  * @{
54  */
55 
56 /**
57  * @}
58  */
59 
60 
61 /** @defgroup USBD_CORE_Exported_TypesDefinitions
62  * @{
63  */
64 
65 
66 /**
67  * @}
68  */
69 
70 
71 
72 /** @defgroup USBD_CORE_Exported_Macros
73  * @{
74  */
75 
76 /**
77  * @}
78  */
79 
80 /** @defgroup USBD_CORE_Exported_Variables
81  * @{
82  */
83 #define USBD_SOF USBD_LL_SOF
84 /**
85  * @}
86  */
87 
88 /** @defgroup USBD_CORE_Exported_FunctionsPrototype
89  * @{
90  */
96 
100 
104 
109 
113 
116 
117 /* USBD Low Level Driver */
123  uint8_t ep_addr,
124  uint8_t ep_type,
125  uint16_t ep_mps);
126 
134  uint8_t ep_addr,
135  uint8_t *pbuf,
136  uint16_t size);
137 
139  uint8_t ep_addr,
140  uint8_t *pbuf,
141  uint16_t size);
142 
143 uint32_t USBD_LL_GetRxDataSize (USBD_HandleTypeDef *pdev, uint8_t ep_addr);
144 void USBD_LL_Delay (uint32_t Delay);
145 
146 /**
147  * @}
148  */
149 
150 #ifdef __cplusplus
151 }
152 #endif
153 
154 #endif /* __USBD_CORE_H */
155 
156 /**
157  * @}
158  */
159 
160 /**
161 * @}
162 */
163 
164 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
usbd_ctlreq.h
usbd_desc.h
USBD_LL_FlushEP
USBD_StatusTypeDef USBD_LL_FlushEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
Flushes an endpoint of the Low Level Driver.
Definition: usbd_conf.c:484
CDC_DATA_HS_IN_PACKET_SIZE
#define CDC_DATA_HS_IN_PACKET_SIZE
Definition: usbd_cdc.h:62
USBD_DescriptorsTypeDef
Definition: usbd_def.h:201
USB_DESC_TYPE_ENDPOINT
#define USB_DESC_TYPE_ENDPOINT
Definition: usbd_def.h:99
USBD_Start
USBD_StatusTypeDef USBD_Start(USBD_HandleTypeDef *pdev)
USBD_Start Start the USB Device Core.
Definition: usbd_core.c:181
usb_setup_req::wLength
uint16_t wLength
Definition: usbd_def.h:155
USBD_LL_Start
USBD_StatusTypeDef USBD_LL_Start(USBD_HandleTypeDef *pdev)
Starts the low level portion of the device driver.
Definition: usbd_conf.c:355
USBD_Stop
USBD_StatusTypeDef USBD_Stop(USBD_HandleTypeDef *pdev)
USBD_Stop Stop the USB Device Core.
Definition: usbd_core.c:196
USBD_CDC_HandleTypeDef::RxState
__IO uint32_t RxState
Definition: usbd_cdc.h:122
USBD_LL_Delay
void USBD_LL_Delay(uint32_t Delay)
Delays routine for the USB Device Library.
Definition: usbd_conf.c:739
USBD_LL_GetRxDataSize
uint32_t USBD_LL_GetRxDataSize(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
Returns the last transfered packet size.
Definition: usbd_conf.c:696
LOBYTE
#define LOBYTE(x)
Definition: usbd_def.h:263
USBD_EP_TYPE_INTR
#define USBD_EP_TYPE_INTR
Definition: usbd_def.h:136
USBD_ClrClassConfig
USBD_StatusTypeDef USBD_ClrClassConfig(USBD_HandleTypeDef *pdev, uint8_t cfgidx)
USBD_ClrClassConfig Clear current configuration.
Definition: usbd_core.c:249
HIBYTE
#define HIBYTE(x)
Definition: usbd_def.h:264
usbd_cdc.h
header file for the usbd_cdc.c file.
USBD_CDC
USBD_ClassTypeDef USBD_CDC
Definition: usbd_cdc.c:159
USBD_CDC_DataOut
static uint8_t USBD_CDC_DataOut(USBD_HandleTypeDef *pdev, uint8_t epnum)
USBD_CDC_DataOut Data received on non-control Out endpoint.
Definition: usbd_cdc.c:688
USBD_CDC_HandleTypeDef::RxBuffer
uint8_t * RxBuffer
Definition: usbd_cdc.h:116
USB_REQ_GET_INTERFACE
#define USB_REQ_GET_INTERFACE
Definition: usbd_def.h:91
USBD_CDC_TransmitPacket
uint8_t USBD_CDC_TransmitPacket(USBD_HandleTypeDef *pdev)
USBD_CDC_DataOut Data received on non-control Out endpoint.
Definition: usbd_cdc.c:846
USBD_RegisterClass
USBD_StatusTypeDef USBD_RegisterClass(USBD_HandleTypeDef *pdev, USBD_ClassTypeDef *pclass)
USBD_RegisterClass Link class driver to Device Core.
Definition: usbd_core.c:157
USBD_CDC_HandleTypeDef::data
uint32_t data[CDC_DATA_HS_MAX_PACKET_SIZE/4]
Definition: usbd_cdc.h:113
USBD_FAIL
Definition: usbd_def.h:197
USBD_CDC_DataIn
static uint8_t USBD_CDC_DataIn(USBD_HandleTypeDef *pdev, uint8_t epnum)
USBD_CDC_DataIn Data sent on non-control IN endpoint.
Definition: usbd_cdc.c:664
USBD_LL_DataInStage
USBD_StatusTypeDef USBD_LL_DataInStage(USBD_HandleTypeDef *pdev, uint8_t epnum, uint8_t *pdata)
USBD_DataInStage Handle data in stage.
Definition: usbd_core.c:343
usbd_def.h
General defines for the usb device library.
USBD_LL_ClearStallEP
USBD_StatusTypeDef USBD_LL_ClearStallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
Clears a Stall condition on an endpoint of the Low Level Driver.
Definition: usbd_conf.c:548
USBD_LL_SetUSBAddress
USBD_StatusTypeDef USBD_LL_SetUSBAddress(USBD_HandleTypeDef *pdev, uint8_t dev_addr)
Assigns a USB address to the device.
Definition: usbd_conf.c:596
USBD_CDC_GetOtherSpeedCfgDesc
static uint8_t * USBD_CDC_GetOtherSpeedCfgDesc(uint16_t *length)
USBD_CDC_GetCfgDesc Return configuration descriptor.
Definition: usbd_cdc.c:766
USB_DESC_TYPE_CONFIGURATION
#define USB_DESC_TYPE_CONFIGURATION
Definition: usbd_def.h:96
usb_setup_req::bmRequest
uint8_t bmRequest
Definition: usbd_def.h:151
USB_DESC_TYPE_DEVICE_QUALIFIER
#define USB_DESC_TYPE_DEVICE_QUALIFIER
Definition: usbd_def.h:100
USBD_LL_CloseEP
USBD_StatusTypeDef USBD_LL_CloseEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
Closes an endpoint of the low level driver.
Definition: usbd_conf.c:452
_USBD_HandleTypeDef::pClassData
void * pClassData
Definition: usbd_def.h:246
USB_REQ_SET_INTERFACE
#define USB_REQ_SET_INTERFACE
Definition: usbd_def.h:92
NULL
#define NULL
Definition: usbd_def.h:53
USBD_CDC_HandleTypeDef::CmdLength
uint8_t CmdLength
Definition: usbd_cdc.h:115
USBD_CDC_RegisterInterface
uint8_t USBD_CDC_RegisterInterface(USBD_HandleTypeDef *pdev, USBD_CDC_ItfTypeDef *fops)
USBD_CDC_RegisterInterface.
Definition: usbd_cdc.c:790
USBD_LL_OpenEP
USBD_StatusTypeDef USBD_LL_OpenEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr, uint8_t ep_type, uint16_t ep_mps)
Opens an endpoint of the low level driver.
Definition: usbd_conf.c:420
USB_REQ_TYPE_MASK
#define USB_REQ_TYPE_MASK
Definition: usbd_def.h:76
USBD_CtlSendData
USBD_StatusTypeDef USBD_CtlSendData(USBD_HandleTypeDef *pdev, uint8_t *buf, uint16_t len)
USBD_CtlSendData send data on the ctl pipe.
Definition: usbd_ioreq.c:95
USBD_LL_Init
USBD_StatusTypeDef USBD_LL_Init(USBD_HandleTypeDef *pdev)
Initializes the low level portion of the device driver.
Definition: usbd_conf.c:290
USBD_CDC_ReceivePacket
uint8_t USBD_CDC_ReceivePacket(USBD_HandleTypeDef *pdev)
USBD_CDC_ReceivePacket prepare OUT Endpoint for reception.
Definition: usbd_cdc.c:883
USBD_LL_Resume
USBD_StatusTypeDef USBD_LL_Resume(USBD_HandleTypeDef *pdev)
USBD_Resume Handle Resume event.
Definition: usbd_core.c:478
CDC_IN_EP
#define CDC_IN_EP
Definition: usbd_cdc.h:52
USBD_CDC_HandleTypeDef::TxState
__IO uint32_t TxState
Definition: usbd_cdc.h:121
__ALIGN_END
static __ALIGN_BEGIN uint8_t USBD_CDC_DeviceQualifierDesc[USB_LEN_DEV_QUALIFIER_DESC] __ALIGN_END
Definition: usbd_cdc.c:135
USBD_SetClassConfig
USBD_StatusTypeDef USBD_SetClassConfig(USBD_HandleTypeDef *pdev, uint8_t cfgidx)
USBD_SetClassConfig Configure device and start the interface.
Definition: usbd_core.c:227
USBD_LL_DataOutStage
USBD_StatusTypeDef USBD_LL_DataOutStage(USBD_HandleTypeDef *pdev, uint8_t epnum, uint8_t *pdata)
USBD_DataOutStage Handle data OUT stage.
Definition: usbd_core.c:299
USBD_LL_Stop
USBD_StatusTypeDef USBD_LL_Stop(USBD_HandleTypeDef *pdev)
Stops the low level portion of the device driver.
Definition: usbd_conf.c:386
_USBD_HandleTypeDef
Definition: usbd_def.h:225
USBD_LL_StallEP
USBD_StatusTypeDef USBD_LL_StallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
Sets a Stall condition on an endpoint of the Low Level Driver.
Definition: usbd_conf.c:516
USBD_CtlPrepareRx
USBD_StatusTypeDef USBD_CtlPrepareRx(USBD_HandleTypeDef *pdev, uint8_t *pbuf, uint16_t len)
USBD_CtlPrepareRx receive data on the ctl pipe.
Definition: usbd_ioreq.c:135
USBD_CDC_DeInit
static uint8_t USBD_CDC_DeInit(USBD_HandleTypeDef *pdev, uint8_t cfgidx)
USBD_CDC_Init DeInitialize the CDC layer.
Definition: usbd_cdc.c:563
USBD_CDC_GetHSCfgDesc
static uint8_t * USBD_CDC_GetHSCfgDesc(uint16_t *length)
USBD_CDC_GetHSCfgDesc Return configuration descriptor.
Definition: usbd_cdc.c:753
USB_REQ_TYPE_CLASS
#define USB_REQ_TYPE_CLASS
Definition: usbd_def.h:74
_Device_cb
Definition: usbd_def.h:160
USBD_CDC_GetDeviceQualifierDescriptor
uint8_t * USBD_CDC_GetDeviceQualifierDescriptor(uint16_t *length)
DeviceQualifierDescriptor return Device Qualifier descriptor.
Definition: usbd_cdc.c:778
USBD_EP_TYPE_BULK
#define USBD_EP_TYPE_BULK
Definition: usbd_def.h:135
USBD_LL_SOF
USBD_StatusTypeDef USBD_LL_SOF(USBD_HandleTypeDef *pdev)
USBD_SOF Handle SOF event.
Definition: usbd_core.c:491
_USBD_CDC_Itf
Definition: usbd_cdc.h:101
USBD_Init
USBD_StatusTypeDef USBD_Init(USBD_HandleTypeDef *pdev, USBD_DescriptorsTypeDef *pdesc, uint8_t id)
USBD_Init Initializes the device stack and load the class driver.
Definition: usbd_core.c:96
USBD_LL_Transmit
USBD_StatusTypeDef USBD_LL_Transmit(USBD_HandleTypeDef *pdev, uint8_t ep_addr, uint8_t *pbuf, uint16_t size)
Transmits data over an endpoint.
Definition: usbd_conf.c:630
USBD_CDC_SetRxBuffer
uint8_t USBD_CDC_SetRxBuffer(USBD_HandleTypeDef *pdev, uint8_t *pbuff)
USBD_CDC_SetRxBuffer.
Definition: usbd_cdc.c:829
USBD_LL_Reset
USBD_StatusTypeDef USBD_LL_Reset(USBD_HandleTypeDef *pdev)
USBD_LL_Reset Handle Reset event.
Definition: usbd_core.c:415
usbd_ioreq.h
Header file for the usbd_ioreq.c file.
USBD_BUSY
Definition: usbd_def.h:196
USBD_SPEED_HIGH
Definition: usbd_def.h:188
CDC_DATA_FS_MAX_PACKET_SIZE
#define CDC_DATA_FS_MAX_PACKET_SIZE
Definition: usbd_cdc.h:58
USBD_CDC_HandleTypeDef
Definition: usbd_cdc.h:111
USBD_malloc
#define USBD_malloc
Definition: usbd_conf.h:126
uint8_t
const uint8_t[]
Definition: 404_html.c:3
USBD_CDC_SetTxBuffer
uint8_t USBD_CDC_SetTxBuffer(USBD_HandleTypeDef *pdev, uint8_t *pbuff, uint16_t length)
USBD_CDC_SetTxBuffer.
Definition: usbd_cdc.c:810
usb_setup_req
Definition: usbd_def.h:148
USBD_CDC_EP0_RxReady
static uint8_t USBD_CDC_EP0_RxReady(USBD_HandleTypeDef *pdev)
USBD_CDC_DataOut Data received on non-control Out endpoint.
Definition: usbd_cdc.c:718
CDC_DATA_FS_OUT_PACKET_SIZE
#define CDC_DATA_FS_OUT_PACKET_SIZE
Definition: usbd_cdc.h:66
USB_CDC_CONFIG_DESC_SIZ
#define USB_CDC_CONFIG_DESC_SIZ
Definition: usbd_cdc.h:61
USBD_CDC_Init
static uint8_t USBD_CDC_Init(USBD_HandleTypeDef *pdev, uint8_t cfgidx)
USBD_CDC_Init Initialize the CDC interface.
Definition: usbd_cdc.c:475
_USBD_HandleTypeDef::dev_speed
USBD_SpeedTypeDef dev_speed
Definition: usbd_def.h:231
USBD_LL_PrepareReceive
USBD_StatusTypeDef USBD_LL_PrepareReceive(USBD_HandleTypeDef *pdev, uint8_t ep_addr, uint8_t *pbuf, uint16_t size)
Prepares an endpoint for reception.
Definition: usbd_conf.c:664
CDC_DATA_HS_MAX_PACKET_SIZE
#define CDC_DATA_HS_MAX_PACKET_SIZE
Definition: usbd_cdc.h:57
USBD_LL_DevDisconnected
USBD_StatusTypeDef USBD_LL_DevDisconnected(USBD_HandleTypeDef *pdev)
USBD_DevDisconnected Handle device disconnection event.
Definition: usbd_core.c:542
USB_LEN_DEV_QUALIFIER_DESC
#define USB_LEN_DEV_QUALIFIER_DESC
Definition: usbd_def.h:57
USBD_StatusTypeDef
USBD_StatusTypeDef
Definition: usbd_def.h:194
USBD_CDC_HandleTypeDef::TxBuffer
uint8_t * TxBuffer
Definition: usbd_cdc.h:117
USBD_CDC_HandleTypeDef::RxLength
uint32_t RxLength
Definition: usbd_cdc.h:118
USBD_LL_SetSpeed
USBD_StatusTypeDef USBD_LL_SetSpeed(USBD_HandleTypeDef *pdev, USBD_SpeedTypeDef speed)
USBD_LL_Reset Handle Reset event.
Definition: usbd_core.c:451
USBD_LL_IsStallEP
uint8_t USBD_LL_IsStallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
Returns Stall condition.
Definition: usbd_conf.c:580
USBD_DeInit
USBD_StatusTypeDef USBD_DeInit(USBD_HandleTypeDef *pdev)
USBD_DeInit Re-Initialize th device library.
Definition: usbd_core.c:132
usb_setup_req::bRequest
uint8_t bRequest
Definition: usbd_def.h:152
USB_DESC_TYPE_INTERFACE
#define USB_DESC_TYPE_INTERFACE
Definition: usbd_def.h:98
_USBD_HandleTypeDef::pUserData
void * pUserData
Definition: usbd_def.h:247
USBD_SpeedTypeDef
USBD_SpeedTypeDef
Definition: usbd_def.h:186
CDC_DATA_FS_IN_PACKET_SIZE
#define CDC_DATA_FS_IN_PACKET_SIZE
Definition: usbd_cdc.h:65
USBD_LL_IsoOUTIncomplete
USBD_StatusTypeDef USBD_LL_IsoOUTIncomplete(USBD_HandleTypeDef *pdev, uint8_t epnum)
USBD_IsoOUTIncomplete Handle iso out incomplete event.
Definition: usbd_core.c:520
USBD_CDC_HandleTypeDef::CmdOpCode
uint8_t CmdOpCode
Definition: usbd_cdc.h:114
USBD_RunTestMode
USBD_StatusTypeDef USBD_RunTestMode(USBD_HandleTypeDef *pdev)
USBD_RunTestMode Launch test mode process.
Definition: usbd_core.c:213
CDC_OUT_EP
#define CDC_OUT_EP
Definition: usbd_cdc.h:53
USB_REQ_TYPE_STANDARD
#define USB_REQ_TYPE_STANDARD
Definition: usbd_def.h:73
USBD_CDC_GetFSCfgDesc
static uint8_t * USBD_CDC_GetFSCfgDesc(uint16_t *length)
USBD_CDC_GetFSCfgDesc Return configuration descriptor.
Definition: usbd_cdc.c:740
length
png_uint_32 length
Definition: png.c:2247
CDC_CMD_PACKET_SIZE
#define CDC_CMD_PACKET_SIZE
Definition: usbd_cdc.h:59
USBD_CDC_HandleTypeDef::TxLength
uint32_t TxLength
Definition: usbd_cdc.h:119
usbd_conf.h
: Header for usbd_conf.c file.
pbuf
Definition: pbuf.h:142
USBD_LL_IsoINIncomplete
USBD_StatusTypeDef USBD_LL_IsoINIncomplete(USBD_HandleTypeDef *pdev, uint8_t epnum)
USBD_IsoINIncomplete Handle iso in incomplete event.
Definition: usbd_core.c:509
USBD_CDC_Setup
static uint8_t USBD_CDC_Setup(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
USBD_CDC_Setup Handle the CDC specific requests.
Definition: usbd_cdc.c:599
USBD_OK
Definition: usbd_def.h:195
CDC_CMD_EP
#define CDC_CMD_EP
Definition: usbd_cdc.h:54
CDC_DATA_HS_OUT_PACKET_SIZE
#define CDC_DATA_HS_OUT_PACKET_SIZE
Definition: usbd_cdc.h:63
USBD_LL_SetupStage
USBD_StatusTypeDef USBD_LL_SetupStage(USBD_HandleTypeDef *pdev, uint8_t *psetup)
USBD_SetupStage Handle the setup stage.
Definition: usbd_core.c:263
USB_DESC_TYPE_OTHER_SPEED_CONFIGURATION
#define USB_DESC_TYPE_OTHER_SPEED_CONFIGURATION
Definition: usbd_def.h:101
USBD_LL_Suspend
USBD_StatusTypeDef USBD_LL_Suspend(USBD_HandleTypeDef *pdev)
USBD_Suspend Handle Suspend event.
Definition: usbd_core.c:464
USBD_LL_DevConnected
USBD_StatusTypeDef USBD_LL_DevConnected(USBD_HandleTypeDef *pdev)
USBD_DevConnected Handle device connection event.
Definition: usbd_core.c:531
size
static png_bytep size_t size
Definition: pngwrite.c:2170
USBD_LL_DeInit
USBD_StatusTypeDef USBD_LL_DeInit(USBD_HandleTypeDef *pdev)
De-Initializes the low level portion of the device driver.
Definition: usbd_conf.c:324
USBD_free
#define USBD_free
Definition: usbd_conf.h:129