| M480 BSP V3.05.001 The Board Support Package for M480 Series

Macros | Typedefs | Functions
usbh_lib.h File Reference

USB Host library exported header file. More...

`#include "NuMicro.h"`

Go to the source code of this file.

## Macros
#define | USBH_OK 0
#define | USBH_ERR_MEMORY_OUT -10
#define | USBH_ERR_IF_ALT_LIMIT -11
#define | USBH_ERR_IF_EP_LIMIT -15
#define | USBH_ERR_NOT_SUPPORTED -101
#define | USBH_ERR_NOT_MATCHED -103
#define | USBH_ERR_NOT_EXPECTED -104
#define | USBH_ERR_INVALID_PARAM -105
#define | USBH_ERR_NOT_FOUND -106
#define | USBH_ERR_EP_NOT_FOUND -107
#define | USBH_ERR_DESCRIPTOR -137
#define | USBH_ERR_SET_DEV_ADDR -139
#define | USBH_ERR_SET_CONFIG -151
#define | USBH_ERR_TRANSFER -201
#define | USBH_ERR_TIMEOUT -203
#define | USBH_ERR_ABORT -205
#define | USBH_ERR_PORT_RESET -255
#define | USBH_ERR_SCH_OVERRUN -257
#define | USBH_ERR_DISCONNECTED -259
#define | USBH_ERR_TRANSACTION -271
#define | USBH_ERR_BABBLE_DETECTED -272
#define | USBH_ERR_DATA_BUFF -274
#define | USBH_ERR_CC_NO_ERR -280
#define | USBH_ERR_CRC -281
#define | USBH_ERR_BIT_STUFF -282
#define | USBH_ERR_DATA_TOGGLE -283
#define | USBH_ERR_STALL -284
#define | USBH_ERR_DEV_NO_RESP -285
#define | USBH_ERR_PID_CHECK -286
#define | USBH_ERR_UNEXPECT_PID -287
#define | USBH_ERR_DATA_OVERRUN -288
#define | USBH_ERR_DATA_UNDERRUN -289
#define | USBH_ERR_BUFF_OVERRUN -292
#define | USBH_ERR_BUFF_UNDERRUN -293
#define | USBH_ERR_NOT_ACCESS0 -294
#define | USBH_ERR_NOT_ACCESS1 -295
#define | USBH_ERR_OHCI_INIT -301
#define | USBH_ERR_OHCI_EP_BUSY -303
#define | USBH_ERR_EHCI_INIT -501
#define | USBH_ERR_EHCI_QH_BUSY -503
#define | UMAS_OK 0
#define | UMAS_ERR_NO_DEVICE -1031
#define | UMAS_ERR_IO -1033
#define | UMAS_ERR_INIT_DEVICE -1035
#define | UMAS_ERR_CMD_STATUS -1037
#define | UMAS_ERR_IVALID_PARM -1038
#define | UMAS_ERR_DRIVE_NOT_FOUND -1039
#define | HID_RET_OK 0
#define | HID_RET_DEV_NOT_FOUND -1081
#define | HID_RET_IO_ERR -1082
#define | HID_RET_INVALID_PARAMETER -1083
#define | HID_RET_OUT_OF_MEMORY -1084
#define | HID_RET_NOT_SUPPORTED -1085
#define | HID_RET_EP_NOT_FOUND -1086
#define | HID_RET_PARSING -1087
#define | HID_RET_XFER_IS_RUNNING -1089
#define | HID_RET_REPORT_NOT_FOUND -1090
#define | UAC_RET_OK 0
#define | UAC_RET_DEV_NOT_FOUND -2001
#define | UAC_RET_FUNC_NOT_FOUND -2002
#define | UAC_RET_IO_ERR -2003
#define | UAC_RET_DATA_LEN -2004
#define | UAC_RET_INVALID -2005
#define | UAC_RET_OUT_OF_MEMORY -2007
#define | UAC_RET_DRV_NOT_SUPPORTED -2009
#define | UAC_RET_DEV_NOT_SUPPORTED -2011
#define | UAC_RET_PARSER -2013
#define | UAC_RET_IS_STREAMING -2015

## Typedefs
typedef void() | CONN_FUNC(struct udev_t *udev, int param)
typedef void() | CDC_CB_FUNC(struct cdc_dev_t *cdev, uint8_t *rdata, int data_len)
typedef void() | HID_IR_FUNC(struct usbhid_dev *hdev, uint16_t ep_addr, int status, uint8_t *rdata, uint32_t data_len)
typedef void() | HID_IW_FUNC(struct usbhid_dev *hdev, uint16_t ep_addr, int status, uint8_t *wbuff, uint32_t *data_len)
typedef int() | UAC_CB_FUNC(struct uac_dev_t *dev, uint8_t *data, int len)

## Functions
void | usbh_core_init (void)
| Initialize M480 USB Host controller and USB stack. More...
int | usbh_pooling_hubs (void)
| Let USB stack polls all root hubs and downstream hubs. If there's any hub port change found, USB stack will manage the hub events in this function call. In this function, USB stack enumerates newly connected devices and remove staff of disconnected devices. User's application should periodically invoke this function. More...
void | usbh_install_conn_callback (CONN_FUNC *conn_func, CONN_FUNC *disconn_func)
| Install device connect and disconnect callback function. More...
void | usbh_suspend (void)
| Suspend USB Host Controller and devices. More...
void | usbh_resume (void)
| Resume USB Host controller and devices. More...
struct udev_t * | usbh_find_device (char *hub_id, int port)
| Find the device under the specified hub port. More...
uint32_t | get_ticks (void)
| A function return current tick count. More...
void | usbh_cdc_init (void)
| Init USB Host CDC driver. More...
struct cdc_dev_t * | usbh_cdc_get_device_list (void)
| Get a list of currently connected USB Hid devices. More...
HIDDEN_SYMBOLS int32_t | usbh_cdc_set_control_line_state (CDC_DEV_T *cdev, int active_carrier, int DTE_present)
| SET_CONTROL_LINE_STATE request. More...
int32_t | usbh_cdc_start_polling_status (CDC_DEV_T *cdev, CDC_CB_FUNC *func)
| Start purge the CDC device's interrupt-in transfer pipe. More...
int32_t | usbh_cdc_start_to_receive_data (CDC_DEV_T *cdev, CDC_CB_FUNC *func)
| Make CDC device start to receive data from bulk-in transfer pipe. More...
int32_t | usbh_cdc_send_data (CDC_DEV_T *cdev, uint8_t *buff, int buff_len)
| Send a block of data via CDC device's bulk-out transfer pipe. More...
void | usbh_hid_init (void)
| Initialize USB Host HID driver. More...
struct usbhid_dev * | usbh_hid_get_device_list (void)
| Get a list of currently connected USB Hid devices. More...
int32_t | usbh_hid_get_report_descriptor (struct usbhid_dev *hdev, uint8_t *desc_buf, int buf_max_len)
int32_t | usbh_hid_get_report (struct usbhid_dev *hdev, int rtp_typ, int rtp_id, uint8_t *data, int len)
int32_t | usbh_hid_set_report (struct usbhid_dev *hdev, int rtp_typ, int rtp_id, uint8_t *data, int len)
int32_t | usbh_hid_get_idle (struct usbhid_dev *hdev, int rtp_id, uint8_t *idle_rate)
int32_t | usbh_hid_set_idle (struct usbhid_dev *hdev, int rtp_id, uint8_t idle_rate)
int32_t | usbh_hid_get_protocol (struct usbhid_dev *hdev, uint8_t *protocol)
int32_t | usbh_hid_set_protocol (struct usbhid_dev *hdev, uint8_t protocol)
int32_t | usbh_hid_start_int_read (struct usbhid_dev *hdev, uint8_t ep_addr, HID_IR_FUNC *func)
int32_t | usbh_hid_stop_int_read (struct usbhid_dev *hdev, uint8_t ep_addr)
int32_t | usbh_hid_start_int_write (struct usbhid_dev *hdev, uint8_t ep_addr, HID_IW_FUNC *func)
int32_t | usbh_hid_stop_int_write (struct usbhid_dev *hdev, uint8_t ep_addr)
int | usbh_umas_init (void)
| Register and initialize USB Host Mass Storage driver. More...
int | usbh_umas_disk_status (int drv_no)
int | usbh_umas_read (int drv_no, uint32_t sec_no, int sec_cnt, uint8_t *buff)
int | usbh_umas_write (int drv_no, uint32_t sec_no, int sec_cnt, uint8_t *buff)
int | usbh_umas_ioctl (int drv_no, int cmd, void *buff)
HIDDEN_SYMBOLS void | usbh_uac_init (void)
| Initialize USB Audio Class driver. More...
int | usbh_uac_open (UAC_DEV_T *uac)
| Open an connected UAC device. More...
struct uac_dev_t * | usbh_uac_get_device_list (void)
| Get a list of currently connected USB Audio Class devices. More...
int | usbh_uac_get_channel_number (UAC_DEV_T *uac, uint8_t target)
| Obtain Audio Class device's channel number. More...
int | usbh_uac_get_bit_resolution (UAC_DEV_T *uac, uint8_t target, uint8_t *byte_cnt)
| Obtain Audio Class device subframe bit resolution.. More...
int | usbh_uac_get_sampling_rate (UAC_DEV_T *uac, uint8_t target, uint32_t *srate_list, int max_cnt, uint8_t *type)
| Get a list of sampling rate frequencies supported by the UAC device. More...
int | usbh_uac_sampling_rate_control (UAC_DEV_T *uac, uint8_t target, uint8_t req, uint32_t *srate)
| Set sampling rate frequency. More...
int | usbh_uac_mute_control (UAC_DEV_T *uac, uint8_t target, uint8_t req, uint16_t chn, uint8_t *mute)
| Control Audio Class device mute on/off. More...
int | usbh_uac_vol_control (UAC_DEV_T *uac, uint8_t target, uint8_t req, uint16_t chn, uint16_t *volume)
| Audio Class device volume control. More...
int | usbh_uac_auto_gain_control (UAC_DEV_T *uac, uint8_t target, uint8_t req, uint16_t chn, uint8_t *bAGC)
| Audio Class device automatic gain control. More...
int | usbh_uac_start_audio_in (UAC_DEV_T *uac, UAC_CB_FUNC *func)
| Start to receive audio data from UAC device. (Microphone) More...
int | usbh_uac_stop_audio_in (UAC_DEV_T *uac)
| Stop UAC device audio in data stream. More...
int | usbh_uac_start_audio_out (UAC_DEV_T *uac, UAC_CB_FUNC *func)
| Start to transmit audio data to UAC device. (Speaker) More...
int | usbh_uac_stop_audio_out (UAC_DEV_T *uac)
| Stop UAC device audio out data stream. More...

## Detailed Description

USB Host library exported header file.

Version
  V1.10 SPDX-License-Identifier: Apache-2.0

Copyright
  (C) 2017-2020 Nuvoton Technology Corp. All rights reserved.

Definition in file usbh_lib.h.