NUC472_NUC442_BSP V3.03.005
The Board Support Package for NUC472/NUC442
Functions | Variables
Collaboration diagram for USB Host HID Driver Exported Functions:

Functions

void USBH_HidInit (void)
 Init USB Host HID driver. More...
 
HID_DEV_TUSBH_HidGetDeviceList (void)
 Get a list of currently connected USB Hid devices. More...
 
int32_t HID_HidGetReportDescriptor (HID_DEV_T *hdev, uint8_t *desc_buf, int buf_max_len)
 Get report descriptor request. More...
 
int32_t HID_HidGetReport (HID_DEV_T *hdev, int rtp_typ, int rtp_id, uint8_t *data, int len)
 HID class standard request Get_Report request. The Get_Report request allows the host to receive a report via the Control pipe. More...
 
int32_t HID_HidSetReport (HID_DEV_T *hdev, int rtp_typ, int rtp_id, uint8_t *data, int len)
 HID class standard request Set_Report request. The Set_Report request allows the host to send a report to the device, possibly setting the state of input, output, or feature controls. More...
 
int32_t HID_HidGetIdle (HID_DEV_T *hdev, int rtp_id, uint8_t *idle_rate)
 HID class standard request Get_Idle request. The Get_Idle request reads the current idle rate for a particular Input report. More...
 
int32_t HID_HidSetIdle (HID_DEV_T *hdev, int rtp_id, uint8_t idle_rate)
 HID class standard request Set_Idle request. The Set_Idle request silences a particular report on the Interrupt In pipe until a new event occurs or the specified amount of time passes. More...
 
int32_t HID_HidGetProtocol (HID_DEV_T *hdev, uint8_t *protocol)
 HID class standard request Get_Protocol request. The Get_Protocol request reads which protocol is currently active (either the boot protocol or the report protocol.) More...
 
int32_t HID_HidSetProtocol (HID_DEV_T *hdev, uint8_t protocol)
 HID class standard request Set_Protocol request. The Set_Protocol switches between the boot protocol and the report protocol (or vice versa). More...
 
int32_t USBH_HidStartIntReadPipe (HID_DEV_T *hdev, HID_IR_FUNC *func)
 Start purge the USB interrupt in transfer. More...
 
int32_t USBH_HidStartIntWritePipe (HID_DEV_T *hdev, HID_IW_FUNC *func)
 Start purge the USB interrupt out transfer. More...
 

Variables

USB_DEV_Tusbhid_dev::udev
 
int usbhid_dev::ifnum
 
uint8_t usbhid_dev::bSubClassCode
 
uint8_t usbhid_dev::bProtocolCode
 
URB_Tusbhid_dev::urbin
 
URB_Tusbhid_dev::urbout
 
uint8_t usbhid_dev::inbuf [HID_MAX_BUFFER_SIZE]
 
HID_IR_FUNCusbhid_dev::read_func
 
HID_IW_FUNCusbhid_dev::write_func
 
struct usbhid_devusbhid_dev::next
 
uint8_t usbhid_dev::client [HID_CLIENT_SIZE]
 

Detailed Description

HID device structure

Function Documentation

◆ HID_HidGetIdle()

int32_t HID_HidGetIdle ( HID_DEV_T hdev,
int  rtp_id,
uint8_t *  idle_rate 
)

HID class standard request Get_Idle request. The Get_Idle request reads the current idle rate for a particular Input report.

Parameters
[in]hdevHID device
[in]rtp_idReport ID
[out]idle_rateAn one byte buffer holds the reported idle rate.
Returns
Success or not.
Return values
0Success
OtherwiseFailed

Definition at line 204 of file hid_core.c.

◆ HID_HidGetProtocol()

int32_t HID_HidGetProtocol ( HID_DEV_T hdev,
uint8_t *  protocol 
)

HID class standard request Get_Protocol request. The Get_Protocol request reads which protocol is currently active (either the boot protocol or the report protocol.)

Parameters
[in]hdevHID device
[out]protocolAn one byte buffer holds the protocol code.
Returns
Success or not.
Return values
0Success
OtherwiseFailed

Definition at line 268 of file hid_core.c.

◆ HID_HidGetReport()

int32_t HID_HidGetReport ( HID_DEV_T hdev,
int  rtp_typ,
int  rtp_id,
uint8_t *  data,
int  len 
)

HID class standard request Get_Report request. The Get_Report request allows the host to receive a report via the Control pipe.

Parameters
[in]hdevHID device
[in]rtp_typReport type. Valid values are:
[in]rtp_idReport ID
[out]dataBuffer to store data retrieved from this report ID.
[in]lenReport length.
Returns
Report length or error code.
Return values
>=0The actual length of data obtained from this report ID.
OtherwiseFailed

Definition at line 138 of file hid_core.c.

◆ HID_HidGetReportDescriptor()

int32_t HID_HidGetReportDescriptor ( HID_DEV_T hdev,
uint8_t *  desc_buf,
int  buf_max_len 
)

Get report descriptor request.

Parameters
[in]hdevHID device
[out]desc_bufThe data buffer to store report descriptor.
[in]buf_max_lenThe maximum length of desc_buf. This function will read more data than buf_max_len.
Returns
Report descriptor length or error code.
Return values
<0Failed
OtherwiseLength of report descriptor read.

Definition at line 76 of file hid_core.c.

◆ HID_HidSetIdle()

int32_t HID_HidSetIdle ( HID_DEV_T hdev,
int  rtp_id,
uint8_t  idle_rate 
)

HID class standard request Set_Idle request. The Set_Idle request silences a particular report on the Interrupt In pipe until a new event occurs or the specified amount of time passes.

Parameters
[in]hdevHID device
[in]rtp_idReport ID
[out]idle_rateThe idle rate to be set.
Returns
Success or not.
Return values
0Success
OtherwiseFailed

Definition at line 236 of file hid_core.c.

◆ HID_HidSetProtocol()

int32_t HID_HidSetProtocol ( HID_DEV_T hdev,
uint8_t  protocol 
)

HID class standard request Set_Protocol request. The Set_Protocol switches between the boot protocol and the report protocol (or vice versa).

Parameters
[in]hdevHID device
[in]protocolThe protocol to be set.
Returns
Success or not.
Return values
0Success
OtherwiseFailed

Definition at line 299 of file hid_core.c.

◆ HID_HidSetReport()

int32_t HID_HidSetReport ( HID_DEV_T hdev,
int  rtp_typ,
int  rtp_id,
uint8_t *  data,
int  len 
)

HID class standard request Set_Report request. The Set_Report request allows the host to send a report to the device, possibly setting the state of input, output, or feature controls.

Parameters
[in]hdevHID device
[in]rtp_typReport type. Valid values are:
[in]rtp_idReport ID
[out]dataBuffer store data to be send.
[in]lenReport length.
Returns
Written length or error code.
Return values
>=0The actual length of data written to this report ID.
OtherwiseFailed

Definition at line 174 of file hid_core.c.

◆ USBH_HidGetDeviceList()

HID_DEV_T * USBH_HidGetDeviceList ( void  )

Get a list of currently connected USB Hid devices.

Returns
List of HID devices.
Return values
NULLThere's no HID device found.
OtherwiseA list of connected HID devices.

The HID devices are chained by the "next" member of HID_DEV_T.

Definition at line 262 of file hid_driver.c.

◆ USBH_HidInit()

void USBH_HidInit ( void  )

Init USB Host HID driver.

Returns
None

Definition at line 246 of file hid_driver.c.

Here is the call graph for this function:

◆ USBH_HidStartIntReadPipe()

HIDDEN_SYMBOLS int32_t USBH_HidStartIntReadPipe ( HID_DEV_T hdev,
HID_IR_FUNC func 
)

Start purge the USB interrupt in transfer.

Parameters
[in]hdevHID device
[in]funcThe interrupt in data receiver callback function.
Returns
Success or not.
Return values
0Success
OtherwiseFailed

Definition at line 378 of file hid_core.c.

Here is the call graph for this function:

◆ USBH_HidStartIntWritePipe()

int32_t USBH_HidStartIntWritePipe ( HID_DEV_T hdev,
HID_IW_FUNC func 
)

Start purge the USB interrupt out transfer.

Parameters
[in]hdevHID device
[in]funcThe interrupt in data transfer callback function.
Returns
Success or not.
Return values
0Success
OtherwiseFailed

Definition at line 439 of file hid_core.c.

Here is the call graph for this function:

Variable Documentation

◆ bProtocolCode

uint8_t usbhid_dev::bProtocolCode

Interface protocol code

Definition at line 96 of file usbh_hid.h.

◆ bSubClassCode

uint8_t usbhid_dev::bSubClassCode

Interface subclass code

Definition at line 95 of file usbh_hid.h.

◆ client

uint8_t usbhid_dev::client[HID_CLIENT_SIZE]

HID device client data area

Definition at line 103 of file usbh_hid.h.

◆ ifnum

int usbhid_dev::ifnum

Interface numder

Definition at line 94 of file usbh_hid.h.

◆ inbuf

uint8_t usbhid_dev::inbuf[HID_MAX_BUFFER_SIZE]

Input buffer

Definition at line 99 of file usbh_hid.h.

◆ next

struct usbhid_dev* usbhid_dev::next

Point to the next HID device

Definition at line 102 of file usbh_hid.h.

◆ read_func

HID_IR_FUNC* usbhid_dev::read_func

Interrupt-in callback function

Definition at line 100 of file usbh_hid.h.

◆ udev

USB_DEV_T* usbhid_dev::udev

USB device pointer of HID_DEV_T

Definition at line 93 of file usbh_hid.h.

◆ urbin

URB_T* usbhid_dev::urbin

Input URB

Definition at line 97 of file usbh_hid.h.

◆ urbout

URB_T* usbhid_dev::urbout

Output URB

Definition at line 98 of file usbh_hid.h.

◆ write_func

HID_IW_FUNC* usbhid_dev::write_func

Interrupt-out callback function

Definition at line 101 of file usbh_hid.h.