![]() |
M471M/R1/S BSP V3.01.000
The Board Support Package for M4521
|
M471M/R1/S Timer USBD driver header file. More...
Go to the source code of this file.
Data Structures | |
struct | s_usbd_info |
Macros | |
#define | USBD_BUF_BASE (USBD_BASE+0x100) |
#define | USBD_MAX_EP 8 |
#define | EP0 0 |
#define | EP1 1 |
#define | EP2 2 |
#define | EP3 3 |
#define | EP4 4 |
#define | EP5 5 |
#define | EP6 6 |
#define | EP7 7 |
#define | REQ_STANDARD 0x00 |
#define | REQ_CLASS 0x20 |
#define | REQ_VENDOR 0x40 |
#define | GET_STATUS 0x00 |
#define | CLEAR_FEATURE 0x01 |
#define | SET_FEATURE 0x03 |
#define | SET_ADDRESS 0x05 |
#define | GET_DESCRIPTOR 0x06 |
#define | SET_DESCRIPTOR 0x07 |
#define | GET_CONFIGURATION 0x08 |
#define | SET_CONFIGURATION 0x09 |
#define | GET_INTERFACE 0x0A |
#define | SET_INTERFACE 0x0B |
#define | SYNC_FRAME 0x0C |
#define | DESC_DEVICE 0x01 |
#define | DESC_CONFIG 0x02 |
#define | DESC_STRING 0x03 |
#define | DESC_INTERFACE 0x04 |
#define | DESC_ENDPOINT 0x05 |
#define | DESC_QUALIFIER 0x06 |
#define | DESC_OTHERSPEED 0x07 |
#define | DESC_HID 0x21 |
#define | DESC_HID_RPT 0x22 |
#define | LEN_DEVICE 18 |
#define | LEN_CONFIG 9 |
#define | LEN_INTERFACE 9 |
#define | LEN_ENDPOINT 7 |
#define | LEN_HID 9 |
#define | LEN_CCID 0x36 |
#define | EP_ISO 0x01 |
#define | EP_BULK 0x02 |
#define | EP_INT 0x03 |
#define | EP_INPUT 0x80 |
#define | EP_OUTPUT 0x00 |
#define | FEATURE_DEVICE_REMOTE_WAKEUP 0x01 |
#define | FEATURE_ENDPOINT_HALT 0x00 |
#define | USBD_WAKEUP_EN USBD_INTEN_WKEN_Msk |
#define | USBD_DRVSE0 USBD_SE0_SE0_Msk |
#define | USBD_DPPU_EN USBD_ATTR_DPPUEN_Msk |
#define | USBD_PWRDN USBD_ATTR_PWRDN_Msk |
#define | USBD_PHY_EN USBD_ATTR_PHYEN_Msk |
#define | USBD_USB_EN USBD_ATTR_USBEN_Msk |
#define | USBD_INT_BUS USBD_INTEN_BUSIEN_Msk |
#define | USBD_INT_USB USBD_INTEN_USBIEN_Msk |
#define | USBD_INT_FLDET USBD_INTEN_VBDETIEN_Msk |
#define | USBD_INT_WAKEUP (USBD_INTEN_NEVWKIEN_Msk | USBD_INTEN_WKEN_Msk) |
#define | USBD_INTSTS_WAKEUP USBD_INTSTS_NEVWKIF_Msk |
#define | USBD_INTSTS_FLDET USBD_INTSTS_VBDETIF_Msk |
#define | USBD_INTSTS_BUS USBD_INTSTS_BUSIF_Msk |
#define | USBD_INTSTS_USB USBD_INTSTS_USBIF_Msk |
#define | USBD_INTSTS_SETUP USBD_INTSTS_SETUP_Msk |
#define | USBD_INTSTS_EP0 USBD_INTSTS_EPEVT0_Msk |
#define | USBD_INTSTS_EP1 USBD_INTSTS_EPEVT1_Msk |
#define | USBD_INTSTS_EP2 USBD_INTSTS_EPEVT2_Msk |
#define | USBD_INTSTS_EP3 USBD_INTSTS_EPEVT3_Msk |
#define | USBD_INTSTS_EP4 USBD_INTSTS_EPEVT4_Msk |
#define | USBD_INTSTS_EP5 USBD_INTSTS_EPEVT5_Msk |
#define | USBD_INTSTS_EP6 USBD_INTSTS_EPEVT6_Msk |
#define | USBD_INTSTS_EP7 USBD_INTSTS_EPEVT7_Msk |
#define | USBD_STATE_USBRST USBD_ATTR_USBRST_Msk |
#define | USBD_STATE_SUSPEND USBD_ATTR_SUSPEND_Msk |
#define | USBD_STATE_RESUME USBD_ATTR_RESUME_Msk |
#define | USBD_STATE_TIMEOUT USBD_ATTR_TOUT_Msk |
#define | USBD_CFGP_SSTALL USBD_CFGP_SSTALL_Msk |
#define | USBD_CFG_CSTALL USBD_CFG_CSTALL_Msk |
#define | USBD_CFG_EPMODE_DISABLE (0ul << USBD_CFG_STATE_Pos) |
#define | USBD_CFG_EPMODE_OUT (1ul << USBD_CFG_STATE_Pos) |
#define | USBD_CFG_EPMODE_IN (2ul << USBD_CFG_STATE_Pos) |
#define | USBD_CFG_TYPE_ISO (1ul << USBD_CFG_ISOCH_Pos) |
#define | Maximum(a, b) ((a)>(b) ? (a) : (b)) |
Compare two input numbers and return maximum one. More... | |
#define | Minimum(a, b) ((a)<(b) ? (a) : (b)) |
Compare two input numbers and return minimum one. More... | |
#define | USBD_ENABLE_USB() ((uint32_t)(USBD->ATTR |= (USBD_USB_EN|USBD_PHY_EN))) |
Enable USB. More... | |
#define | USBD_DISABLE_USB() ((uint32_t)(USBD->ATTR &= ~USBD_USB_EN)) |
Disable USB. More... | |
#define | USBD_ENABLE_PHY() ((uint32_t)(USBD->ATTR |= USBD_PHY_EN)) |
Enable USB PHY. More... | |
#define | USBD_DISABLE_PHY() ((uint32_t)(USBD->ATTR &= ~USBD_PHY_EN)) |
Disable USB PHY. More... | |
#define | USBD_SET_SE0() ((uint32_t)(USBD->SE0 |= USBD_DRVSE0)) |
Enable SE0. Force USB PHY transceiver to drive SE0. More... | |
#define | USBD_CLR_SE0() ((uint32_t)(USBD->SE0 &= ~USBD_DRVSE0)) |
Disable SE0. More... | |
#define | USBD_SET_ADDR(addr) (USBD->FADDR = (addr)) |
Set USB device address. More... | |
#define | USBD_GET_ADDR() ((uint32_t)(USBD->FADDR)) |
Get USB device address. More... | |
#define | USBD_ENABLE_INT(intr) (USBD->INTEN |= (intr)) |
Enable USB interrupt function. More... | |
#define | USBD_GET_INT_FLAG() ((uint32_t)(USBD->INTSTS)) |
Get interrupt status. More... | |
#define | USBD_CLR_INT_FLAG(flag) (USBD->INTSTS = (flag)) |
Clear USB interrupt flag. More... | |
#define | USBD_GET_EP_FLAG() ((uint32_t)(USBD->EPSTS)) |
Get endpoint status. More... | |
#define | USBD_GET_BUS_STATE() ((uint32_t)(USBD->ATTR & 0xf)) |
Get USB bus state. More... | |
#define | USBD_IS_ATTACHED() ((uint32_t)(USBD->VBUSDET & USBD_VBUSDET_VBUSDET_Msk)) |
Check cable connection state. More... | |
#define | USBD_STOP_TRANSACTION(ep) (*((__IO uint32_t *) ((uint32_t)&USBD->EP[0].CFGP + (uint32_t)((ep) << 4))) |= USBD_CFGP_CLRRDY_Msk) |
Stop USB transaction of the specified endpoint ID. More... | |
#define | USBD_SET_DATA1(ep) (*((__IO uint32_t *) ((uint32_t)&USBD->EP[0].CFG + (uint32_t)((ep) << 4))) |= USBD_CFG_DSQSYNC_Msk) |
Set USB DATA1 PID for the specified endpoint ID. More... | |
#define | USBD_SET_DATA0(ep) (*((__IO uint32_t *) ((uint32_t)&USBD->EP[0].CFG + (uint32_t)((ep) << 4))) &= (~USBD_CFG_DSQSYNC_Msk)) |
Set USB DATA0 PID for the specified endpoint ID. More... | |
#define | USBD_SET_PAYLOAD_LEN(ep, size) (*((__IO uint32_t *) ((uint32_t)&USBD->EP[0].MXPLD + (uint32_t)((ep) << 4))) = (size)) |
Set USB payload size (IN data) More... | |
#define | USBD_GET_PAYLOAD_LEN(ep) ((uint32_t)*((__IO uint32_t *) ((uint32_t)&USBD->EP[0].MXPLD + (uint32_t)((ep) << 4)))) |
Get USB payload size (OUT data) More... | |
#define | USBD_CONFIG_EP(ep, config) (*((__IO uint32_t *) ((uint32_t)&USBD->EP[0].CFG + (uint32_t)((ep) << 4))) = (config)) |
Configure endpoint. More... | |
#define | USBD_SET_EP_BUF_ADDR(ep, offset) (*((__IO uint32_t *) ((uint32_t)&USBD->EP[0].BUFSEG + (uint32_t)((ep) << 4))) = (offset)) |
Set USB endpoint buffer. More... | |
#define | USBD_GET_EP_BUF_ADDR(ep) ((uint32_t)*((__IO uint32_t *) ((uint32_t)&USBD->EP[0].BUFSEG + (uint32_t)((ep) << 4)))) |
Get the offset of the specified USB endpoint buffer. More... | |
#define | USBD_SET_EP_STALL(ep) (*((__IO uint32_t *) ((uint32_t)&USBD->EP[0].CFGP + (uint32_t)((ep) << 4))) |= USBD_CFGP_SSTALL_Msk) |
Set USB endpoint stall state. More... | |
#define | USBD_CLR_EP_STALL(ep) (*((__IO uint32_t *) ((uint32_t)&USBD->EP[0].CFGP + (uint32_t)((ep) << 4))) &= ~USBD_CFGP_SSTALL_Msk) |
Clear USB endpoint stall state. More... | |
#define | USBD_GET_EP_STALL(ep) (*((__IO uint32_t *) ((uint32_t)&USBD->EP[0].CFGP + (uint32_t)((ep) << 4))) & USBD_CFGP_SSTALL_Msk) |
Get USB endpoint stall state. More... | |
Typedefs | |
typedef struct s_usbd_info | S_USBD_INFO_T |
typedef void(* | VENDOR_REQ) (void) |
typedef void(* | CLASS_REQ) (void) |
typedef void(* | SET_INTERFACE_REQ) (void) |
typedef void(* | SET_CONFIG_CB) (void) |
Functions | |
static __INLINE void | USBD_MemCopy (uint8_t *dest, uint8_t *src, int32_t size) |
To support byte access between USB SRAM and system SRAM. More... | |
static __INLINE void | USBD_SetStall (uint8_t epnum) |
Set USB endpoint stall state. More... | |
static __INLINE void | USBD_ClearStall (uint8_t epnum) |
Clear USB endpoint stall state. More... | |
static __INLINE uint32_t | USBD_GetStall (uint8_t epnum) |
Get USB endpoint stall state. More... | |
void | USBD_Open (const S_USBD_INFO_T *param, CLASS_REQ pfnClassReq, SET_INTERFACE_REQ pfnSetInterface) |
This function makes USBD module to be ready to use. More... | |
void | USBD_Start (void) |
This function makes USB host to recognize the device. More... | |
void | USBD_GetSetupPacket (uint8_t *buf) |
Get the received SETUP packet. More... | |
void | USBD_ProcessSetupPacket (void) |
Process SETUP packet. More... | |
void | USBD_StandardRequest (void) |
Process standard request. More... | |
void | USBD_PrepareCtrlIn (uint8_t *pu8Buf, uint32_t u32Size) |
Prepare the first Control IN pipe. More... | |
void | USBD_CtrlIn (void) |
Repeat Control IN pipe. More... | |
void | USBD_PrepareCtrlOut (uint8_t *pu8Buf, uint32_t u32Size) |
Prepare the first Control OUT pipe. More... | |
void | USBD_CtrlOut (void) |
Repeat Control OUT pipe. More... | |
void | USBD_SwReset (void) |
Reset software flags. More... | |
void | USBD_SetVendorRequest (VENDOR_REQ pfnVendorReq) |
USBD Set Vendor Request. More... | |
void | USBD_SetConfigCallback (SET_CONFIG_CB pfnSetConfigCallback) |
The callback function which called when get SET CONFIGURATION request. More... | |
void | USBD_LockEpStall (uint32_t u32EpBitmap) |
EP stall lock function to avoid stall clear by USB SET FEATURE request. More... | |
Variables | |
const S_USBD_INFO_T | gsInfo |
volatile uint8_t | g_usbd_RemoteWakeupEn |
M471M/R1/S Timer USBD driver header file.
SPDX-License-Identifier: Apache-2.0
Definition in file usbd.h.