| NUC472_NUC442_BSP V3.03.003 The Board Support Package for NUC472/NUC442

Typedefs | Functions | Variables
USBD Exported Functions
NUC472/NUC442 Device Driver » USBD Driver » USBD Exported Constants » USBD Exported Struct » USBD Exported Macros
Collaboration diagram for USBD Exported Functions:

## Typedefs
typedef void(* | VENDOR_REQ) (void)
typedef void(* | CLASS_REQ) (void)
typedef void(* | SET_INTERFACE_REQ) (uint32_t u32AltInterface)

## Functions
static __INLINE void | USBD_MemCopy (uint8_t *u8Dst, uint8_t *u8Src, int32_t i32Size)
| USBD_memcpy, Copy bytes hardware limitation. More...
static __INLINE void | USBD_ResetDMA (void)
| USBD_ResetDMA. More...
static __INLINE void | USBD_SetEpBufAddr (uint32_t u32Ep, uint32_t u32Base, uint32_t u32Len)
| USBD_SetEpBufAddr, Set Endpoint buffer address. More...
static __INLINE void | USBD_ConfigEp (uint32_t u32Ep, uint32_t u32EpNum, uint32_t u32EpType, uint32_t u32EpDir)
| USBD_ConfigEp, Config Endpoint. More...
static __INLINE void | USBD_SetEpStall (uint32_t u32Ep)
| Set USB endpoint stall state. More...
static __INLINE void | USBD_SetStall (uint32_t u32EpNum)
| Set USB endpoint stall state. More...
static __INLINE void | USBD_ClearEpStall (uint32_t u32Ep)
| Clear USB endpoint stall state. More...
static __INLINE void | USBD_ClearStall (uint32_t u32EpNum)
| Clear USB endpoint stall state. More...
static __INLINE uint32_t | USBD_GetEpStall (uint32_t u32Ep)
| Get USB endpoint stall state. More...
static __INLINE uint32_t | USBD_GetStall (uint32_t u32EpNum)
| Get USB endpoint stall state. More...
void | USBD_Open (S_USBD_INFO_T *param, CLASS_REQ pfnClassReq, SET_INTERFACE_REQ pfnSetInterface)
| USBD Initial. More...
void | USBD_Start (void)
| USBD Start. More...
void | USBD_ProcessSetupPacket (void)
| Process Setup Packet. More...
void | USBD_StandardRequest (void)
| Process USB standard request. More...
void | USBD_UpdateDeviceState (void)
| Update Device State. 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_CtrlOut (uint8_t *pu8Buf, uint32_t u32Size)
| Start Control OUT transaction. More...
void | USBD_SwReset (void)
| Clear all software flags. More...
void | USBD_SetVendorRequest (VENDOR_REQ pfnVendorReq)
| USBD Set Vendor Request. More...
int | USBD_GetDescriptor (void)
| Get Descriptor request. More...

## Variables
uint8_t | USBD_CMD_STRUCT::bmRequestType
uint8_t | USBD_CMD_STRUCT::bRequest
uint16_t | USBD_CMD_STRUCT::wValue
uint16_t | USBD_CMD_STRUCT::wIndex
uint16_t | USBD_CMD_STRUCT::wLength
uint8_t * | s_usbd_info::gu8DevDesc
uint8_t * | s_usbd_info::gu8ConfigDesc
uint8_t ** | s_usbd_info::gu8StringDesc
uint8_t * | s_usbd_info::gu8QualDesc
uint8_t * | s_usbd_info::gu8OtherConfigDesc
uint8_t ** | s_usbd_info::gu8HidReportDesc
uint32_t * | s_usbd_info::gu32HidReportSize

## Detailed Description

## Typedef Documentation

## ◆ CLASS_REQ

typedef void(* CLASS_REQ) (void)

USB Class request callback function

Definition at line 395 of file usbd.h.

## ◆ SET_INTERFACE_REQ

typedef void(* SET_INTERFACE_REQ) (uint32_t u32AltInterface)

USB Standard request "Set Interface" callback function

Definition at line 396 of file usbd.h.

## ◆ VENDOR_REQ

typedef void(* VENDOR_REQ) (void)

USB Vendor request callback function

Definition at line 394 of file usbd.h.

## Function Documentation

## ◆ USBD_ClearEpStall()

static __INLINE void USBD_ClearEpStall | ( | uint32_t | u32Ep | ) |
| static

Clear USB endpoint stall state.

Parameters

  [in] | u32Ep | The USB endpoint ID.

Returns
  None

Clear USB endpoint stall state for the specified endpoint ID. Endpoint will respond ACK/NAK token.

Definition at line 331 of file usbd.h.

## ◆ USBD_ClearStall()

static __INLINE void USBD_ClearStall | ( | uint32_t | u32EpNum | ) |
| static

Clear USB endpoint stall state.

Parameters

  [in] | u32EpNum | USB endpoint

Returns
  None

Clear USB endpoint stall state, endpoint will return ACK/NAK token.

Definition at line 344 of file usbd.h.

Here is the caller graph for this function:

## ◆ USBD_ConfigEp()

static __INLINE void USBD_ConfigEp | ( | uint32_t | u32Ep,
|  | uint32_t | u32EpNum,
|  | uint32_t | u32EpType,
|  | uint32_t | u32EpDir
| ) |  |
| static

USBD_ConfigEp, Config Endpoint.

Parameters

  [in] | u32Ep | USB endpoint
  [in] | u32EpNum | Endpoint number
  [in] | u32EpType | Endpoint type
  [in] | u32EpDir | Endpoint direction

Return values

  None. |

Definition at line 271 of file usbd.h.

## ◆ USBD_CtrlIn()

void USBD_CtrlIn | ( | void |  | ) |

Start Control IN transfer.

Parameters

  [in] | None |

Returns
  None

This function is used to start Control IN

Definition at line 530 of file usbd.c.

## ◆ USBD_CtrlOut()

void USBD_CtrlOut | ( | uint8_t * | pu8Buf,
|  | uint32_t | u32Size
| ) |  |

Start Control OUT transaction.

Parameters

  [in] | pu8Buf | Control OUT data pointer
  [in] | u32Size | OUT transfer size

Returns
  None

This function is used to start Control OUT transfer

Definition at line 570 of file usbd.c.

## ◆ USBD_GetDescriptor()

int USBD_GetDescriptor | ( | void |  | ) |

Get Descriptor request.

Parameters

  [in] | None |

Returns
  None

This function is used to process GetDescriptor request.

Definition at line 167 of file usbd.c.

Here is the call graph for this function:
Here is the caller graph for this function:

## ◆ USBD_GetEpStall()

static __INLINE uint32_t USBD_GetEpStall | ( | uint32_t | u32Ep | ) |
| static

Get USB endpoint stall state.

Parameters

  [in] | u32Ep | The USB endpoint ID.

Return values

  0 | USB endpoint is not stalled.
  Others | USB endpoint is stalled.

Get USB endpoint stall state of the specified endpoint ID.

Definition at line 364 of file usbd.h.

## ◆ USBD_GetStall()

static __INLINE uint32_t USBD_GetStall | ( | uint32_t | u32EpNum | ) |
| static

Get USB endpoint stall state.

Parameters

  [in] | u32EpNum | USB endpoint

Return values

  0 | USB endpoint is not stalled.
  non-0 | USB endpoint is stalled.

Get USB endpoint stall state.

Definition at line 378 of file usbd.h.

Here is the caller graph for this function:

## ◆ USBD_MemCopy()

static __INLINE void USBD_MemCopy | ( | uint8_t * | u8Dst,
|  | uint8_t * | u8Src,
|  | int32_t | i32Size
| ) |  |
| static

USBD_memcpy, Copy bytes hardware limitation.

Parameters

  [in] | u8Dst | Destination pointer.
  [in] | u8Src | Source pointer.
  [in] | i32Size | Copy size.

Return values

  None. |

Definition at line 226 of file usbd.h.

Here is the caller graph for this function:

## ◆ USBD_Open()

void USBD_Open | ( | S_USBD_INFO_T * | param,
|  | CLASS_REQ | pfnClassReq,
|  | SET_INTERFACE_REQ | pfnSetInterface
| ) |  |

USBD Initial.

Parameters

  [in] | param | Descriptor
  [in] | pfnClassReq | Class Request Callback Function
  [in] | pfnSetInterface | SetInterface Request Callback Function

Returns
  None

This function is used to initial USBD.

Definition at line 70 of file usbd.c.

## ◆ USBD_PrepareCtrlIn()

void USBD_PrepareCtrlIn | ( | uint8_t * | pu8Buf,
|  | uint32_t | u32Size
| ) |  |

Prepare Control IN transaction.

Parameters

  [in] | pu8Buf | Control IN data pointer
  [in] | u32Size | IN transfer size

Returns
  None

This function is used to prepare Control IN transfer

Definition at line 513 of file usbd.c.

Here is the caller graph for this function:

## ◆ USBD_ProcessSetupPacket()

void USBD_ProcessSetupPacket | ( | void |  | ) |

Process Setup Packet.

Parameters

  [in] | None |

Returns
  None

This function is used to process Setup packet.

Definition at line 116 of file usbd.c.

Here is the call graph for this function:

## ◆ USBD_ResetDMA()

static __INLINE void USBD_ResetDMA | ( | void |  | ) |
| static

USBD_ResetDMA.

Parameters

  None |

Return values

  None. |

Definition at line 236 of file usbd.h.

## ◆ USBD_SetEpBufAddr()

static __INLINE void USBD_SetEpBufAddr | ( | uint32_t | u32Ep,
|  | uint32_t | u32Base,
|  | uint32_t | u32Len
| ) |  |
| static

USBD_SetEpBufAddr, Set Endpoint buffer address.

Parameters

  [in] | u32Ep | Endpoint Number
  [in] | u32Base | Buffer Start Address
  [in] | u32Len | Buffer length

Return values

  None. |

Definition at line 249 of file usbd.h.

## ◆ USBD_SetEpStall()

static __INLINE void USBD_SetEpStall | ( | uint32_t | u32Ep | ) |
| static

Set USB endpoint stall state.

Parameters

  [in] | u32Ep | The USB endpoint ID.

Returns
  None

Set USB endpoint stall state for the specified endpoint ID. Endpoint will respond STALL token automatically.

Definition at line 289 of file usbd.h.

## ◆ USBD_SetStall()

static __INLINE void USBD_SetStall | ( | uint32_t | u32EpNum | ) |
| static

Set USB endpoint stall state.

Parameters

  [in] | u32EpNum | USB endpoint

Returns
  None

Set USB endpoint stall state, endpoint will return STALL token.

Definition at line 307 of file usbd.h.

Here is the caller graph for this function:

## ◆ USBD_SetVendorRequest()

void USBD_SetVendorRequest | ( | VENDOR_REQ | pfnVendorReq | ) |

USBD Set Vendor Request.

Parameters

  [in] | pfnVendorReq | Vendor Request Callback Function

Returns
  None

This function is used to set USBD vendor request callback function

Definition at line 616 of file usbd.c.

## ◆ USBD_StandardRequest()

void USBD_StandardRequest | ( | void |  | ) |

Process USB standard request.

Parameters

  [in] | None |

Returns
  None

This function is used to process USB Standard Request.

Definition at line 274 of file usbd.c.

Here is the call graph for this function:
Here is the caller graph for this function:

## ◆ USBD_Start()

void USBD_Start | ( | void |  | ) |

USBD Start.

Parameters

  [in] | None |

Returns
  None

This function is used to start transfer

Definition at line 102 of file usbd.c.

## ◆ USBD_SwReset()

void USBD_SwReset | ( | void |  | ) |

Clear all software flags.

Parameters

  [in] | None |

Returns
  None

This function is used to clear all software control flag

Definition at line 595 of file usbd.c.

## ◆ USBD_UpdateDeviceState()

void USBD_UpdateDeviceState | ( | void |  | ) |

Update Device State.

Parameters

  [in] | None |

Returns
  None

This function is used to update Device state when Setup packet complete

Definition at line 446 of file usbd.c.

Here is the call graph for this function:

## Variable Documentation

## ◆ bmRequestType

uint8_t USBD_CMD_STRUCT::bmRequestType

Definition at line 144 of file usbd.h.

## ◆ bRequest

uint8_t USBD_CMD_STRUCT::bRequest

Definition at line 145 of file usbd.h.

## ◆ gu32HidReportSize

uint32_t* s_usbd_info::gu32HidReportSize

Pointer for HID Report descriptor Size

Definition at line 163 of file usbd.h.

## ◆ gu8ConfigDesc

uint8_t* s_usbd_info::gu8ConfigDesc

Config descriptor

Definition at line 158 of file usbd.h.

## ◆ gu8DevDesc

uint8_t* s_usbd_info::gu8DevDesc

Device descriptor

Definition at line 157 of file usbd.h.

## ◆ gu8HidReportDesc

uint8_t** s_usbd_info::gu8HidReportDesc

Pointer for HID Report descriptor

Definition at line 162 of file usbd.h.

## ◆ gu8OtherConfigDesc

uint8_t* s_usbd_info::gu8OtherConfigDesc

Other Speed Config descriptor

Definition at line 161 of file usbd.h.

## ◆ gu8QualDesc

uint8_t* s_usbd_info::gu8QualDesc

Qualifier descriptor

Definition at line 160 of file usbd.h.

## ◆ gu8StringDesc

uint8_t** s_usbd_info::gu8StringDesc

Pointer for USB String Descriptor pointers

Definition at line 159 of file usbd.h.

## ◆ wIndex

uint16_t USBD_CMD_STRUCT::wIndex

Definition at line 147 of file usbd.h.

## ◆ wLength

uint16_t USBD_CMD_STRUCT::wLength

Definition at line 148 of file usbd.h.

## ◆ wValue

uint16_t USBD_CMD_STRUCT::wValue

Definition at line 146 of file usbd.h.