32#define USBH_ERR_MEMORY_OUT -10
33#define USBH_ERR_IF_ALT_LIMIT -11
34#define USBH_ERR_IF_EP_LIMIT -15
35#define USBH_ERR_NOT_SUPPORTED -101
36#define USBH_ERR_NOT_MATCHED -103
37#define USBH_ERR_NOT_EXPECTED -104
38#define USBH_ERR_INVALID_PARAM -105
39#define USBH_ERR_NOT_FOUND -106
40#define USBH_ERR_EP_NOT_FOUND -107
41#define USBH_ERR_DESCRIPTOR -137
42#define USBH_ERR_SET_DEV_ADDR -139
43#define USBH_ERR_SET_CONFIG -151
45#define USBH_ERR_TRANSFER -201
46#define USBH_ERR_TIMEOUT -203
47#define USBH_ERR_ABORT -205
48#define USBH_ERR_PORT_RESET -255
49#define USBH_ERR_SCH_OVERRUN -257
50#define USBH_ERR_DISCONNECTED -259
52#define USBH_ERR_TRANSACTION -271
53#define USBH_ERR_BABBLE_DETECTED -272
54#define USBH_ERR_DATA_BUFF -274
56#define USBH_ERR_CC_NO_ERR -280
57#define USBH_ERR_CRC -281
58#define USBH_ERR_BIT_STUFF -282
59#define USBH_ERR_DATA_TOGGLE -283
60#define USBH_ERR_STALL -284
61#define USBH_ERR_DEV_NO_RESP -285
62#define USBH_ERR_PID_CHECK -286
63#define USBH_ERR_UNEXPECT_PID -287
64#define USBH_ERR_DATA_OVERRUN -288
65#define USBH_ERR_DATA_UNDERRUN -289
66#define USBH_ERR_BUFF_OVERRUN -292
67#define USBH_ERR_BUFF_UNDERRUN -293
68#define USBH_ERR_NOT_ACCESS0 -294
69#define USBH_ERR_NOT_ACCESS1 -295
71#define USBH_ERR_OHCI_INIT -301
72#define USBH_ERR_OHCI_EP_BUSY -303
74#define USBH_ERR_EHCI_INIT -501
75#define USBH_ERR_EHCI_QH_BUSY -503
78#define UMAS_ERR_NO_DEVICE -1031
79#define UMAS_ERR_IO -1033
80#define UMAS_ERR_INIT_DEVICE -1035
81#define UMAS_ERR_CMD_STATUS -1037
82#define UMAS_ERR_IVALID_PARM -1038
83#define UMAS_ERR_DRIVE_NOT_FOUND -1039
86#define HID_RET_DEV_NOT_FOUND -1081
87#define HID_RET_IO_ERR -1082
88#define HID_RET_INVALID_PARAMETER -1083
89#define HID_RET_OUT_OF_MEMORY -1084
90#define HID_RET_NOT_SUPPORTED -1085
91#define HID_RET_EP_NOT_FOUND -1086
92#define HID_RET_PARSING -1087
93#define HID_RET_XFER_IS_RUNNING -1089
94#define HID_RET_REPORT_NOT_FOUND -1090
97#define UAC_RET_DEV_NOT_FOUND -2001
98#define UAC_RET_FUNC_NOT_FOUND -2002
99#define UAC_RET_IO_ERR -2003
100#define UAC_RET_DATA_LEN -2004
101#define UAC_RET_INVALID -2005
102#define UAC_RET_OUT_OF_MEMORY -2007
103#define UAC_RET_DRV_NOT_SUPPORTED -2009
104#define UAC_RET_DEV_NOT_SUPPORTED -2011
105#define UAC_RET_PARSER -2013
106#define UAC_RET_IS_STREAMING -2015
116typedef void (
CONN_FUNC)(
struct udev_t *udev,
int param);
123typedef void (
HID_IR_FUNC)(
struct usbhid_dev *hdev, uint16_t ep_addr,
int status, uint8_t *rdata, uint32_t data_len);
124typedef void (
HID_IW_FUNC)(
struct usbhid_dev *hdev, uint16_t ep_addr,
int status, uint8_t *wbuff, uint32_t *data_len);
199extern int usbh_umas_read(
int drv_no, uint32_t sec_no,
int sec_cnt, uint8_t *buff);
203extern int usbh_umas_reset_disk(
int drv_no);
228extern void dump_ohci_regs(
void);
229extern void dump_ehci_regs(
void);
230extern void dump_ohci_ports(
void);
231extern void dump_ehci_ports(
void);
232extern uint32_t usbh_memory_used(
void);
NuMicro peripheral access layer header file.
int32_t usbh_cdc_start_to_receive_data(struct cdc_dev_t *cdev, CDC_CB_FUNC *func)
Make CDC device start to receive data from bulk-in transfer pipe.
int32_t usbh_cdc_set_line_coding(CDC_DEV_T *cdev, LINE_CODING_T *line_code)
SET_LINE_CODING request.
int usbh_uac_stop_audio_out(struct uac_dev_t *audev)
Stop UAC device audio out data stream.
int32_t usbh_hid_stop_int_read(struct usbhid_dev *hdev, uint8_t ep_addr)
int usbh_uac_sampling_rate_control(struct uac_dev_t *audev, uint8_t target, uint8_t req, uint32_t *srate)
Set sampling rate frequency.
int usbh_uac_get_channel_number(struct uac_dev_t *audev, uint8_t target)
Obtain Audio Class device's channel number.
int32_t usbh_hid_start_int_write(struct usbhid_dev *hdev, uint8_t ep_addr, HID_IW_FUNC *func)
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)
void usbh_suspend(void)
Suspend USB Host Controller and devices.
int usbh_uac_stop_audio_in(struct uac_dev_t *audev)
Stop UAC device audio in data stream.
struct usbhid_dev * usbh_hid_get_device_list(void)
Get a list of currently connected USB Hid devices.
struct udev_t * usbh_find_device(char *hub_id, int port)
Find the device under the specified hub port.
int usbh_pooling_hubs(void)
Let USB stack polls all root hubs and downstream hubs. If there's any hub port change found,...
int32_t usbh_hid_get_report_descriptor(struct usbhid_dev *hdev, uint8_t *desc_buf, int buf_max_len)
int usbh_uac_open(struct uac_dev_t *audev)
Open an connected UAC device.
int32_t usbh_hid_start_int_read(struct usbhid_dev *hdev, uint8_t ep_addr, HID_IR_FUNC *func)
void usbh_cdc_init(void)
Init USB Host CDC driver.
int usbh_uac_vol_control(struct uac_dev_t *audev, uint8_t target, uint8_t req, uint16_t chn, uint16_t *volume)
Audio Class device volume control.
struct cdc_dev_t * usbh_cdc_get_device_list(void)
Get a list of currently connected USB Hid devices.
HIDDEN_SYMBOLS int32_t usbh_cdc_set_control_line_state(struct cdc_dev_t *cdev, int active_carrier, int DTE_present)
SET_CONTROL_LINE_STATE request.
int usbh_umas_read(int drv_no, uint32_t sec_no, int sec_cnt, uint8_t *buff)
int32_t usbh_cdc_send_data(struct cdc_dev_t *cdev, uint8_t *buff, int buff_len)
Send a block of data via CDC device's bulk-out transfer pipe.
int32_t usbh_cdc_start_polling_status(struct cdc_dev_t *cdev, CDC_CB_FUNC *func)
Start purge the CDC device's interrupt-in transfer pipe.
int32_t usbh_cdc_get_line_coding(CDC_DEV_T *cdev, LINE_CODING_T *line_code)
GET_LINE_CODING request.
int32_t usbh_hid_get_idle(struct usbhid_dev *hdev, int rtp_id, uint8_t *idle_rate)
int usbh_umas_write(int drv_no, uint32_t sec_no, int sec_cnt, uint8_t *buff)
int32_t usbh_hid_get_report(struct usbhid_dev *hdev, int rtp_typ, int rtp_id, uint8_t *data, int len)
int usbh_umas_init(void)
Register and initialize USB Host Mass Storage driver.
int usbh_uac_start_audio_out(struct uac_dev_t *uac, UAC_CB_FUNC *func)
Start to transmit audio data to UAC device. (Speaker)
void usbh_core_init(void)
Initialize M480 USB Host controller and USB stack.
int usbh_uac_get_bit_resolution(struct uac_dev_t *audev, uint8_t target, uint8_t *byte_cnt)
Obtain Audio Class device subframe bit resolution..
void usbh_install_conn_callback(CONN_FUNC *conn_func, CONN_FUNC *disconn_func)
Install device connect and disconnect callback function.
int usbh_umas_ioctl(int drv_no, int cmd, void *buff)
int usbh_uac_auto_gain_control(struct uac_dev_t *audev, uint8_t target, uint8_t req, uint16_t chn, uint8_t *bAGC)
Audio Class device automatic gain control.
int32_t usbh_hid_set_idle(struct usbhid_dev *hdev, int rtp_id, uint8_t idle_rate)
int usbh_umas_disk_status(int drv_no)
struct uac_dev_t * usbh_uac_get_device_list(void)
Get a list of currently connected USB Audio Class devices.
int usbh_uac_get_sampling_rate(struct uac_dev_t *audev, 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.
void usbh_hid_init(void)
Initialize USB Host HID driver.
int32_t usbh_hid_set_report(struct usbhid_dev *hdev, int rtp_typ, int rtp_id, uint8_t *data, int len)
uint32_t get_ticks(void)
A function return current tick count.
int usbh_uac_mute_control(struct uac_dev_t *audev, uint8_t target, uint8_t req, uint16_t chn, uint8_t *mute)
Control Audio Class device mute on/off.
int32_t usbh_hid_stop_int_write(struct usbhid_dev *hdev, uint8_t ep_addr)
int usbh_uac_start_audio_in(struct uac_dev_t *uac, UAC_CB_FUNC *func)
Start to receive audio data from UAC device. (Microphone)
void usbh_resume(void)
Resume USB Host controller and devices.
HIDDEN_SYMBOLS void usbh_uac_init(void)
Initialize USB Audio Class driver.
void() CDC_CB_FUNC(struct cdc_dev_t *cdev, uint8_t *rdata, int data_len)
void() HID_IR_FUNC(struct usbhid_dev *hdev, uint16_t ep_addr, int status, uint8_t *rdata, uint32_t data_len)
int() UAC_CB_FUNC(struct uac_dev_t *dev, uint8_t *data, int len)
void() CONN_FUNC(struct udev_t *udev, int param)
void() HID_IW_FUNC(struct usbhid_dev *hdev, uint16_t ep_addr, int status, uint8_t *wbuff, uint32_t *data_len)