MG32F10x Standard Peripherals Firmware Library

usbd_core.h
浏览该文件的文档.
1
17 /* Define to prevent recursive inclusion -------------------------------------*/
18 #ifndef __USBD_CORE_H
19 #define __USBD_CORE_H
20
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24
25 /* Includes ------------------------------------------------------------------*/
26 #include <stdint.h>
27 #include <stdbool.h>
28 #include "usb_def.h"
29 #include "usbd_hw.h"
30
31 /* Exported types ------------------------------------------------------------*/
32 typedef struct {
33 USB_SETUP_PACKET SetupPacket;
34 uint8_t *DataPtr;
35 uint16_t DataSize;
36 uint16_t DataSent;
37 uint8_t Configuration;
38 uint8_t RemoteWakeup;
39 uint8_t DeviceState;
40 uint8_t OldDeviceState;
41 } UsbdCoreInfo_t;
42 extern volatile UsbdCoreInfo_t UsbdCoreInfo;
43 extern const uint8_t UsbdMaxPacketSize0;
44
45 typedef enum
46 {
47 USBD_CONTROL_STAGE_STALL,
48 USBD_CONTROL_STAGE_IN_DATA,
49 USBD_CONTROL_STAGE_OUT_DATA,
50 USBD_CONTROL_STAGE_STATUS
51 } UsbdControlStage;
52
53 /* Exported constants --------------------------------------------------------*/
54
55 #define USB_DEVICE_STATE_UNCONNECTED 0
56 #define USB_DEVICE_STATE_ATTACHED 1
57 #define USB_DEVICE_STATE_POWERED 2
58 #define USB_DEVICE_STATE_SUSPENDED 3
59 #define USB_DEVICE_STATE_ADDRESSED 4
60 #define USB_DEVICE_STATE_CONFIGURED 5
61
62 /* Exported macro ------------------------------------------------------------*/
63 /* Exported functions --------------------------------------------------------*/
64
65 void USBD_Init(void);
66 void USBD_DeInit(void);
67 void USBD_Connect(void);
68 void USBD_Disconnect(void);
69
70 void USBD_Core_Reset(void);
71 void USBD_Core_Suspend(void);
72 void USBD_Core_Resume(void);
73
74 UsbdControlStage USBD_EndPoint0_Setup_StdReq(void);
75
76 void Handle_USBD_INT(uint8_t IntrUSB, uint8_t IntrIn, uint8_t IntrOut);
77
78 #ifdef __cplusplus
79 }
80 #endif
81
82 #endif /* __USBD_CORE_H */
usb_def.h
USBD_Init
void USBD_Init(void)
Initializes the USB device library.
Definition: usbd_core.c:38
USBD_Connect
void USBD_Connect(void)
Connects the device to the USB host.
Definition: usbd_core.c:58
USBD_DeInit
void USBD_DeInit(void)
Deinitializes the USB device library.
Definition: usbd_core.c:49
usbd_hw.h
USBD_Disconnect
void USBD_Disconnect(void)
Disconnects the device from the USB host.
Definition: usbd_core.c:67
USBD_EndPoint0_Setup_StdReq
UsbdControlStage USBD_EndPoint0_Setup_StdReq(void)
Handle Standard Device Requests.
Definition: usbd_core.c:319
USBD_Core_Resume
void USBD_Core_Resume(void)
Handle resume event.
Definition: usbd_core.c:104
USBD_Core_Suspend
void USBD_Core_Suspend(void)
Handle suspend event.
Definition: usbd_core.c:90
UsbdCoreInfo_t
Definition: usbd_core.h:32
Handle_USBD_INT
void Handle_USBD_INT(uint8_t IntrUSB, uint8_t IntrIn, uint8_t IntrOut)
Handle USBD Interrupts.
Definition: usbd_intr.c:45
USBD_Core_Reset
void USBD_Core_Reset(void)
Handle reset event.
Definition: usbd_core.c:77