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

Functions
LW_USBH Exported Functions
NUC472/NUC442 Device Driver » LW_USBH Driver | NUC472/NUC442 Device Driver » LW_USBH Driver » LW_USBH Exported Constants
Collaboration diagram for LW_USBH Exported Functions:

## Functions
int | usbh_probe_umass (void)
| Try to probe and initialize an USB mass storage device. More...
int | usbh_drv_ctrl_req (uint8_t requesttype, uint8_t request, uint16_t value, uint16_t index, uint16_t length, int data_len, uint8_t *buffer, int dir)
| Execute a control transfer request. More...
int | usbh_drv_bulk_xfer (uint16_t ep_addr, uint8_t *toggle, uint8_t *data_buff, int data_len, int timeout)
| Execute a control transfer request. More...
int | usbh_get_device_descriptor (uint8_t *desc_buff)
| Get device descriptor from the USB device. More...
int | get_config_descriptor (uint8_t *desc_buff)
| Get configuration descriptor from the USB device. More...
int | usbh_set_configuration (int conf_val)
| Issue a standard request SET_CONFIGURATION to USB device. More...
int | usbh_clear_halt (uint16_t ep_addr)
| Issue a standard request SET_FEATURE to clear USB device endpoint halt state. More...
int | usbh_probe_port (uint32_t port)
| Probe USB root-hub port connect/disconnect status. A newly connected device will be initialized in this function. More...
int | usbh_init (void)
| Initialized USB host controller driver. More...

## Detailed Description

## Function Documentation

## ◆ get_config_descriptor()

int get_config_descriptor | ( | uint8_t * | desc_buff | ) |

Get configuration descriptor from the USB device.

Parameters

  [out] | desc_buff | Data buffer to receive configuration descriptor data.

Returns
  Success or not.

Return values

  0 | Success
  Otherwise | Failed

Definition at line 493 of file lw_usbh.c.

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

## ◆ usbh_clear_halt()

int usbh_clear_halt | ( | uint16_t | ep_addr | ) |

Issue a standard request SET_FEATURE to clear USB device endpoint halt state.

Parameters

  [in] | ep_addr | Endpoint to be clear halt.

Returns
  Success or not.

Return values

  0 | Success
  Otherwise | Failed

Definition at line 542 of file lw_usbh.c.

Here is the call graph for this function:

## ◆ usbh_drv_bulk_xfer()

int usbh_drv_bulk_xfer | ( | uint16_t | ep_addr,
|  | uint8_t * | toggle,
|  | uint8_t * | data_buff,
|  | int | data_len,
|  | int | timeout
| ) |  |

Execute a control transfer request.

Parameters

  [in] | ep_addr | Endpoint address.
  [in,out] | toggle | Set the last data packet toggle setting and get new data packet toggle setting
  [in,out] | data_buff | Buffer hold the data to send and the data receive.
  [in] | data_len | Length in bytes of the data to send/receive
  [in] | timeout | Transfer time-out setting in millisecond.

Returns
  Success or not.

Return values

  0 | Success
  Otherwise | Failed

Definition at line 389 of file lw_usbh.c.

## ◆ usbh_drv_ctrl_req()

int usbh_drv_ctrl_req | ( | uint8_t | requesttype,
|  | uint8_t | request,
|  | uint16_t | value,
|  | uint16_t | index,
|  | uint16_t | length,
|  | int | data_len,
|  | uint8_t * | buffer,
|  | int | dir
| ) |  |

Execute a control transfer request.

Parameters

  [in] | requesttype | USB message request type value
  [in] | request | USB message request value
  [in] | value | USB message value
  [in] | index | USB message index value
  [in] | length | USB message length value
  [in] | data_len | length in bytes of the data to send/receive
  [in,out] | buffer | Pointer to buffer hold the data to send and to receive.
  [in] | dir | Data transfer direction. 0 - in; 1 - out.

Returns
  Success or not.

Return values

  0 | Success
  Otherwise | Failed

This function sends a simple control message to a specified endpoint and waits for the message to complete, or timeout.

If successful, it returns 0, otherwise a negative error number.

Definition at line 305 of file lw_usbh.c.

Here is the caller graph for this function:

## ◆ usbh_get_device_descriptor()

int usbh_get_device_descriptor | ( | uint8_t * | desc_buff | ) |

Get device descriptor from the USB device.

Parameters

  [out] | desc_buff | Data buffer to receive device descriptor data.

Returns
  Success or not.

Return values

  0 | Success
  Otherwise | Failed

Definition at line 456 of file lw_usbh.c.

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

## ◆ usbh_init()

int usbh_init | ( | void |  | ) |

Initialized USB host controller driver.

Returns
  Success or not.

Return values

  0 | Success
  Otherwise | Failed

Definition at line 767 of file lw_usbh.c.

## ◆ usbh_probe_port()

int usbh_probe_port | ( | uint32_t | port | ) |

Probe USB root-hub port connect/disconnect status. A newly connected device will be initialized in this function.

Parameters

  [in] | port | The root-hub port number, 0 for port 0 and 1 for port 1.

Returns
  The current port connect/disconnect status.

Return values

  0 | A new device connected and initialized successfully.
  USBH_RET_DEV_CONN_KEEP | USB device is still connected.
  USBH_RET_NO_DEVICE | There's no device connected.
  USBH_RET_DEV_REMOVED | A connected device had been removed.

Definition at line 590 of file lw_usbh.c.

Here is the call graph for this function:

## ◆ usbh_probe_umass()

int usbh_probe_umass | ( | void |  | ) |

Try to probe and initialize an USB mass storage device.

Returns
  Success or not.

Return values

  0 | Success
  Otherwise | Failed

Definition at line 434 of file lw_umass.c.

Here is the call graph for this function:

## ◆ usbh_set_configuration()

int usbh_set_configuration | ( | int | conf_val | ) |

Issue a standard request SET_CONFIGURATION to USB device.

Parameters

  [in] | conf_val | The configuration number to be set.

Returns
  Success or not.

Return values

  0 | Success
  Otherwise | Failed

Definition at line 528 of file lw_usbh.c.

Here is the call graph for this function: