![]() |
NANO100_BSP V3.04.002
The Board Support Package for Nano100BN Series
|
Macros | |
#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->CTL |= 0xF)) |
Enable USBD engine. More... | |
#define | USBD_DISABLE_USB() ((uint32_t)(USBD->CTL &= ~USBD_USB_EN)) |
Disable USBD engine. More... | |
#define | USBD_ENABLE_PHY() ((uint32_t)(USBD->CTL |= USBD_PHY_EN)) |
Enable USBD PHY. More... | |
#define | USBD_DISABLE_PHY() ((uint32_t)(USBD->CTL &= ~USBD_PHY_EN)) |
Disable USBD PHY. More... | |
#define | USBD_SET_SE0() ((uint32_t)(USBD->CTL |= USBD_DRVSE0)) |
Force USB PHY Transceiver to Drive SE0. More... | |
#define | USBD_CLR_SE0() ((uint32_t)(USBD->CTL &= ~USBD_DRVSE0)) |
Release SE0. More... | |
#define | USBD_SET_ADDR(addr) (USBD->FADDR = (addr)) |
Set USBD address. More... | |
#define | USBD_GET_ADDR() ((uint32_t)(USBD->FADDR)) |
Get USBD address. More... | |
#define | USBD_ENABLE_INT(intr) (USBD->INTEN |= (intr)) |
Enable USBD interrupt. More... | |
#define | USBD_GET_INT_FLAG() ((uint32_t)(USBD->INTSTS)) |
Get USBD interrupt flag. More... | |
#define | USBD_CLR_INT_FLAG(flag) (USBD->INTSTS = flag) |
Clear USBD interrupt. More... | |
#define | USBD_GET_EP_FLAG() ((uint32_t)(USBD->EPSTS)) |
Get USBD Endpoint status. More... | |
#define | USBD_GET_BUS_STATE() ((uint32_t)(USBD->BUSSTS & 0xf)) |
Get USBD bus state. More... | |
#define | USBD_IS_ATTACHED() ((uint32_t)(USBD->BUSSTS & USBD_BUSSTS_FLDET_Msk)) |
check cable connect state More... | |
#define | USBD_STOP_TRANSACTION(ep) (*((__IO uint32_t *) ((uint32_t)&USBD->EP[0].CFG + (uint32_t)((ep) << 4))) |= USBD_CFG_CLRRDY_Msk) |
Stop USB endpoint transaction. More... | |
#define | USBD_SET_DATA1(ep) (*((__IO uint32_t *) ((uint32_t)&USBD->EP[0].CFG + (uint32_t)((ep) << 4))) |= USBD_CFG_DSQ_SYNC_Msk) |
Set USB data1 token. More... | |
#define | USBD_SET_DATA0(ep) (*((__IO uint32_t *) ((uint32_t)&USBD->EP[0].CFG + (uint32_t)((ep) << 4))) &= (~USBD_CFG_DSQ_SYNC_Msk)) |
Set USB data0 token. 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)) |
config 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 buffer for USB endpoint. More... | |
#define | USBD_GET_EP_BUF_ADDR(ep) ((uint32_t)*((__IO uint32_t *) ((uint32_t)&USBD->EP[0].BUFSEG + (uint32_t)((ep) << 4)))) |
Get buffer for USB endpoint. More... | |
#define | USBD_SET_EP_STALL(ep) (*((__IO uint32_t *) ((uint32_t)&USBD->EP[0].CFG + (uint32_t)((ep) << 4))) |= USBD_CFG_SSTALL_Msk) |
Set USB endpoint stall state. More... | |
#define | USBD_CLR_EP_STALL(ep) (*((__IO uint32_t *) ((uint32_t)&USBD->EP[0].CFG + (uint32_t)((ep) << 4))) &= ~USBD_CFG_SSTALL_Msk) |
Clear USB endpoint stall state. More... | |
#define | USBD_GET_EP_STALL(ep) (*((__IO uint32_t *) ((uint32_t)&USBD->EP[0].CFG + (uint32_t)((ep) << 4))) & USBD_CFG_SSTALL_Msk) |
Get USB endpoint stall state. More... | |
Typedefs | |
typedef void(* | VENDOR_REQ) (void) |
typedef void(* | CLASS_REQ) (void) |
typedef void(* | SET_INTERFACE_REQ) (uint32_t u32AltInterface) |
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 (S_USBD_INFO_T *param, CLASS_REQ pfnClassReq, SET_INTERFACE_REQ pfnSetInterface) |
USBD Initial, Enable clock and reset USB. More... | |
void | USBD_Start (void) |
USBD Start. More... | |
void | USBD_GetSetupPacket (uint8_t *buf) |
Get Setup Packet. More... | |
void | USBD_ProcessSetupPacket (void) |
Process Setup Packet. More... | |
void | USBD_StandardRequest (void) |
Process USB standard request. More... | |
void | USBD_PrepareCtrlIn (uint8_t *pu8Buf, uint32_t u32Size) |
Prepare Control IN transaction. More... | |
void | USBD_CtrlIn (void) |
Start Control IN transfer. More... | |
void | USBD_PrepareCtrlOut (uint8_t *pu8Buf, uint32_t u32Size) |
Prepare Control OUT transaction. More... | |
void | USBD_CtrlOut (void) |
Start Control OUT transfer. More... | |
void | USBD_SwReset (void) |
Clear all 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) |
Variables | |
uint8_t * | s_usbd_info::gu8DevDesc |
uint8_t * | s_usbd_info::gu8ConfigDesc |
uint8_t ** | s_usbd_info::gu8StringDesc |
uint8_t ** | s_usbd_info::gu8HidReportDesc |
uint32_t * | s_usbd_info::gu32HidReportSize |
uint32_t * | s_usbd_info::gu32ConfigHidDescIdx |
volatile uint8_t | g_usbd_RemoteWakeupEn |
#define Maximum | ( | a, | |
b | |||
) | ((a)>(b) ? (a) : (b)) |
#define Minimum | ( | a, | |
b | |||
) | ((a)<(b) ? (a) : (b)) |
#define USBD_CLR_EP_STALL | ( | ep | ) | (*((__IO uint32_t *) ((uint32_t)&USBD->EP[0].CFG + (uint32_t)((ep) << 4))) &= ~USBD_CFG_SSTALL_Msk) |
#define USBD_CLR_INT_FLAG | ( | flag | ) | (USBD->INTSTS = flag) |
#define USBD_CLR_SE0 | ( | ) | ((uint32_t)(USBD->CTL &= ~USBD_DRVSE0)) |
#define USBD_CONFIG_EP | ( | ep, | |
config | |||
) | (*((__IO uint32_t *) ((uint32_t)&USBD->EP[0].CFG + (uint32_t)((ep) << 4))) = (config)) |
#define USBD_DISABLE_PHY | ( | ) | ((uint32_t)(USBD->CTL &= ~USBD_PHY_EN)) |
#define USBD_DISABLE_USB | ( | ) | ((uint32_t)(USBD->CTL &= ~USBD_USB_EN)) |
#define USBD_ENABLE_INT | ( | intr | ) | (USBD->INTEN |= (intr)) |
#define USBD_ENABLE_PHY | ( | ) | ((uint32_t)(USBD->CTL |= USBD_PHY_EN)) |
#define USBD_ENABLE_USB | ( | ) | ((uint32_t)(USBD->CTL |= 0xF)) |
#define USBD_GET_ADDR | ( | ) | ((uint32_t)(USBD->FADDR)) |
#define USBD_GET_BUS_STATE | ( | ) | ((uint32_t)(USBD->BUSSTS & 0xf)) |
#define USBD_GET_EP_BUF_ADDR | ( | ep | ) | ((uint32_t)*((__IO uint32_t *) ((uint32_t)&USBD->EP[0].BUFSEG + (uint32_t)((ep) << 4)))) |
#define USBD_GET_EP_FLAG | ( | ) | ((uint32_t)(USBD->EPSTS)) |
#define USBD_GET_EP_STALL | ( | ep | ) | (*((__IO uint32_t *) ((uint32_t)&USBD->EP[0].CFG + (uint32_t)((ep) << 4))) & USBD_CFG_SSTALL_Msk) |
#define USBD_GET_INT_FLAG | ( | ) | ((uint32_t)(USBD->INTSTS)) |
#define USBD_GET_PAYLOAD_LEN | ( | ep | ) | ((uint32_t)*((__IO uint32_t *) ((uint32_t)&USBD->EP[0].MXPLD + (uint32_t)((ep) << 4)))) |
#define USBD_IS_ATTACHED | ( | ) | ((uint32_t)(USBD->BUSSTS & USBD_BUSSTS_FLDET_Msk)) |
#define USBD_SET_ADDR | ( | addr | ) | (USBD->FADDR = (addr)) |
#define USBD_SET_DATA0 | ( | ep | ) | (*((__IO uint32_t *) ((uint32_t)&USBD->EP[0].CFG + (uint32_t)((ep) << 4))) &= (~USBD_CFG_DSQ_SYNC_Msk)) |
#define USBD_SET_DATA1 | ( | ep | ) | (*((__IO uint32_t *) ((uint32_t)&USBD->EP[0].CFG + (uint32_t)((ep) << 4))) |= USBD_CFG_DSQ_SYNC_Msk) |
#define USBD_SET_EP_BUF_ADDR | ( | ep, | |
offset | |||
) | (*((__IO uint32_t *) ((uint32_t)&USBD->EP[0].BUFSEG + (uint32_t)((ep) << 4))) = (offset)) |
#define USBD_SET_EP_STALL | ( | ep | ) | (*((__IO uint32_t *) ((uint32_t)&USBD->EP[0].CFG + (uint32_t)((ep) << 4))) |= USBD_CFG_SSTALL_Msk) |
#define USBD_SET_PAYLOAD_LEN | ( | ep, | |
size | |||
) | (*((__IO uint32_t *) ((uint32_t)&USBD->EP[0].MXPLD + (uint32_t)((ep) << 4))) = (size)) |
#define USBD_SET_SE0 | ( | ) | ((uint32_t)(USBD->CTL |= USBD_DRVSE0)) |
#define USBD_STOP_TRANSACTION | ( | ep | ) | (*((__IO uint32_t *) ((uint32_t)&USBD->EP[0].CFG + (uint32_t)((ep) << 4))) |= USBD_CFG_CLRRDY_Msk) |
typedef void(* CLASS_REQ) (void) |
typedef void(* SET_CONFIG_CB) (void) |
typedef void(* SET_INTERFACE_REQ) (uint32_t u32AltInterface) |
typedef void(* VENDOR_REQ) (void) |
|
static |
void USBD_CtrlIn | ( | void | ) |
void USBD_CtrlOut | ( | void | ) |
void USBD_GetSetupPacket | ( | uint8_t * | buf | ) |
|
static |
|
static |
To support byte access between USB SRAM and system SRAM.
[in] | dest | Destination pointer. |
[in] | src | Source pointer. |
[in] | size | Byte count. |
This function will copy the number of data specified by size and src parameters to the address specified by dest parameter.
Definition at line 394 of file usbd.h.
void USBD_Open | ( | S_USBD_INFO_T * | param, |
CLASS_REQ | pfnClassReq, | ||
SET_INTERFACE_REQ | pfnSetInterface | ||
) |
void USBD_PrepareCtrlIn | ( | uint8_t * | pu8Buf, |
uint32_t | u32Size | ||
) |
void USBD_PrepareCtrlOut | ( | uint8_t * | pu8Buf, |
uint32_t | u32Size | ||
) |
void USBD_ProcessSetupPacket | ( | void | ) |
void USBD_SetConfigCallback | ( | SET_CONFIG_CB | pfnSetConfigCallback | ) |
The callback function which called when get SET CONFIGURATION request.
[in] | pfnSetConfigCallback | Callback function pointer for SET CONFIGURATION request |
This function is used to set the callback function which will be called at SET CONFIGURATION request.
|
static |
void USBD_SetVendorRequest | ( | VENDOR_REQ | pfnVendorReq | ) |
void USBD_StandardRequest | ( | void | ) |
void USBD_Start | ( | void | ) |
void USBD_SwReset | ( | void | ) |
|
extern |
uint32_t* s_usbd_info::gu32ConfigHidDescIdx |
uint32_t* s_usbd_info::gu32HidReportSize |
uint8_t** s_usbd_info::gu8HidReportDesc |