USB Device Manager

group USB_DM

USB device manager.

Defines

USB_SPEED_FULL

The definition of USB speed.

usb_dm.h

USB_SPEED_HIGH

The definition of USB speed.

usb_dm.h

Typedefs

typedef struct _usb_dm_evt_param_status_ind T_USB_DM_EVT_PARAM_STATUS_IND

USB device manager event parameter status indication.

Param state:

The current state.

Param info:

Specific information depends on state. If state is USB_DEFAULT, it indicates the actual enumeration speed.

typedef struct _usb_dm_evt_param_bc12_det T_USB_DM_EVT_PARAM_BC12_DET

The event parameter of bc12 detect.

Param type:

The bc12 detect result.

typedef union _usb_dm_evt_param T_USB_DM_EVT_PARAM

The event parameters.

typedef bool (*USB_DM_CB)(T_USB_DM_EVT, T_USB_DM_EVT_PARAM*)

The USB device manager callback.

usb_dm.h

Param T_USB_DM_EVT:

USB device manager event defined in T_USB_DM_EVT.

Param uint32_t:

Optional parameters depending on different event.

typedef struct _t_usb_core_config T_USB_CORE_CONFIG

USB settings such as speed, etc.

usb_dm.h

Enums

enum T_USB_DM_EVT

USB device manager event used in USB_DM_CB.

usb_dm.h

Values:

enumerator USB_DM_EVT_STATUS_IND
enumerator USB_DM_EVT_BC12_DETECT
enum T_USB_POWER_STATE

The USB power state obtained from event T_USB_DM_EVT.

usb_dm.h

Values:

enumerator USB_PDN
enumerator USB_ATTACHED
enumerator USB_POWERED
enumerator USB_DEFAULT
enumerator USB_ADDRESSED
enumerator USB_CONFIGURED
enumerator USB_SUSPENDED

Functions

void usb_dm_core_init(T_USB_CORE_CONFIG config)

Initialize the USB core.

usb_dm.h

参数:

config – USB core settings in T_USB_CORE_CONFIG.

void usb_dm_core_deinit(void)

Deinit the USB core.

usb_dm.h

参数:

config – USB core settings in T_USB_CORE_CONFIG.

void usb_dm_start(bool bc12_detect)

Start the USB core, this api will start the USB task.

usb_dm.h

参数:

bc12_detect – Do the bc12 detect if it is true.

void usb_dm_stop(void)

Stop the USB core, this api will stop the USB task.

usb_dm.h

void usb_dm_cb_register(USB_DM_CB cb)

Register the USB device manager callback.

usb_dm.h

参数:

cb – USB dm callback USB_DM_CB.

void usb_dm_cb_unregister(void)

Unregister the USB device manager callback.

usb_dm.h

struct _usb_dm_evt_param_status_ind
#include <usb_dm.h>

USB device manager event parameter status indication.

Param state:

The current state.

Param info:

Specific information depends on state. If state is USB_DEFAULT, it indicates the actual enumeration speed.

Public Members

T_USB_POWER_STATE state
uint8_t speed
uint8_t remote_wakeup_en
union _usb_dm_evt_param_status_ind info
struct _usb_dm_evt_param_bc12_det
#include <usb_dm.h>

The event parameter of bc12 detect.

Param type:

The bc12 detect result.

Public Members

uint8_t type
union _usb_dm_evt_param
#include <usb_dm.h>

The event parameters.

struct _t_usb_core_config
#include <usb_dm.h>

USB settings such as speed, etc.

usb_dm.h

Public Members

uint8_t speed
uint8_t uac_enable
uint8_t hid_enable
uint8_t rsv
struct _t_usb_core_config class_set