Data transfers functions. More...
Functions | |
hal_status_t | hal_usb_reset (usb_handle_t *p_usb) |
usb modlue reset the basic configuration during host reset More... | |
uint8_t | hal_usb_get_connect_state (void) |
usb module gets whether the device is connected to the host. More... | |
hal_status_t | hal_usb_ep_write_start (usb_handle_t *p_usb, hal_usb_ep_t ep) |
usb ep start transmit data. More... | |
hal_status_t | hal_usb_ep_write_end (usb_handle_t *p_usb, hal_usb_ep_t ep) |
usbd inform host transmit data end. More... | |
hal_status_t | hal_usb_ep_read_start (usb_handle_t *p_usb, hal_usb_ep_t ep) |
usb ep start receive data. More... | |
hal_status_t | hal_usb_ep_read_end (usb_handle_t *p_usb, hal_usb_ep_t ep) |
usbd inform host receive data end. More... | |
hal_status_t | hal_usb_ep_transmit_dma (usb_handle_t *p_usb, hal_usb_ep_t ep, uint8_t *p_data, uint32_t length) |
Transmit an amount of data to USB endpoint in dma mode. More... | |
hal_status_t | hal_usb_ep_receive_dma (usb_handle_t *p_usb, hal_usb_ep_t ep, uint8_t *p_data, uint32_t length) |
Receive an amount of data to USB endpoint in dma mode. More... | |
hal_status_t | hal_usb_set_addr (usb_handle_t *p_usb, uint32_t addr) |
set USB devcice address. More... | |
uint32_t | hal_usb_get_addr (usb_handle_t *p_usb) |
get USB devcice address More... | |
hal_status_t | hal_usb_write_ep_fifo (usb_handle_t *p_usb, hal_usb_ep_t ep, uint32_t value, uint32_t ep4_wr_byte) |
write 32bit value to USB endpoit FIFO. More... | |
uint32_t | hal_usb_read_ep_fifo (usb_handle_t *p_usb, hal_usb_ep_t ep) |
read 32bit value from USB endpoit FIFO. More... | |
hal_status_t | hal_usb_set_ep_attr (usb_handle_t *p_usb, hal_usb_ep_t ep, uint32_t attr) |
set USB EP attribute. More... | |
uint32_t | hal_usb_get_ep_attr (usb_handle_t *p_usb, hal_usb_ep_t ep) |
get USB EP attribute setting. More... | |
hal_status_t | hal_usb_halt_ep (usb_handle_t *p_usb, hal_usb_ep_t ep) |
USB halt the endpoint. More... | |
hal_status_t | hal_usb_un_halt_ep (usb_handle_t *p_usb, hal_usb_ep_t ep) |
USB un halt the endpoint. More... | |
hal_status_t | hal_usb_set_and_unhalt_ep (usb_handle_t *p_usb, hal_usb_ep_t ep, uint32_t attr) |
USB un halt the endpoint and set the endpoint attribute. More... | |
uint32_t | hal_usb_get_ep0_rx_data_sum (usb_handle_t *p_usb) |
get USB EP0 received data sum. More... | |
uint32_t | hal_usb_get_it_flag (usb_handle_t *p_usb) |
get USB all interrupt status. More... | |
uint32_t | hal_usb_get_ep1_rx_data_sum (usb_handle_t *p_usb) |
get USB EP1 received data sum. More... | |
uint32_t | hal_usb_get_ep5_rx_data_sum (usb_handle_t *p_usb) |
get USB EP5 received data sum. More... | |
hal_status_t | hal_usb_set_cmd_ok (usb_handle_t *p_usb) |
send ok command to USB host(EP0). More... | |
hal_status_t | hal_usb_set_cmd_err (usb_handle_t *p_usb) |
send error command to USB host(EP0). More... | |
Data transfers functions.
============================================================================== ##### USB operation functions ##### =============================================================================== [..] This subsection provides a set of functions allowing to manage the USB data transfers. [..] The USB supports master and slave mode: (#) There are two modes of transfer: (++) Blocking mode: The communication is performed in polling mode. The HAL status of all data processing is returned by the same function after finishing transfer. (++) No-Blocking mode: The communication is performed using Interrupts or DMA, These APIs return the HAL status. The end of the data processing will be indicated through the dedicated USB IRQ when using Interrupt mode or the DMA IRQ when using DMA mode. The hal_usb_tx_cplt_callback(), hal_usb_rx_cplt_callback() and hal_usb_tx_rx_cplt_callback() user callbacks will be executed respectively at the end of the transmit or Receive process The hal_usb_error_callback() user callback will be executed when a communication error is detected. (#) APIs provided for these 2 transfer modes (Blocking mode or Non blocking mode using either Interrupt or DMA) exist for 1-Line (simplex) and 2-Line (full duplex) modes.
hal_status_t hal_usb_ep_read_end | ( | usb_handle_t * | p_usb, |
hal_usb_ep_t | ep | ||
) |
usbd inform host receive data end.
[in] | p_usb | Pointer to an USB handle which contains the configuration information for the specified USB module. |
[in] | ep | USB endpoit number(only EP0 EP1 EP5 supported) |
HAL_OK | Operation is OK. |
HAL_ERROR | Parameter error or operation not supported. |
HAL_BUSY | Driver is busy. |
HAL_TIMEOUT | Timeout occurred. |
hal_status_t hal_usb_ep_read_start | ( | usb_handle_t * | p_usb, |
hal_usb_ep_t | ep | ||
) |
usb ep start receive data.
[in] | p_usb | Pointer to an USB handle which contains the configuration information for the specified USB module. |
[in] | ep | USB endpoit number(only EP0 EP1 EP5 supported) |
HAL_OK | Operation is OK. |
HAL_ERROR | Parameter error or operation not supported. |
HAL_BUSY | Driver is busy. |
HAL_TIMEOUT | Timeout occurred. |
hal_status_t hal_usb_ep_receive_dma | ( | usb_handle_t * | p_usb, |
hal_usb_ep_t | ep, | ||
uint8_t * | p_data, | ||
uint32_t | length | ||
) |
Receive an amount of data to USB endpoint in dma mode.
[in] | p_usb | Pointer to an USB handle which contains the configuration information for the specified USB module. |
[in] | ep | USB endpoit number(EP5 support dma receive mode) |
[in] | p_data | Pointer to AHB master buffer adderss |
[in] | length | Amount of data receive during dma mode. |
HAL_OK | Operation is OK. |
HAL_ERROR | Parameter error or operation not supported. |
HAL_BUSY | Driver is busy. |
HAL_TIMEOUT | Timeout occurred. |
hal_status_t hal_usb_ep_transmit_dma | ( | usb_handle_t * | p_usb, |
hal_usb_ep_t | ep, | ||
uint8_t * | p_data, | ||
uint32_t | length | ||
) |
Transmit an amount of data to USB endpoint in dma mode.
[in] | p_usb | Pointer to an USB handle which contains the configuration information for the specified USB module. |
[in] | ep | USB endpoit number( EP3 or EP4 support dma transmit mode) |
[in] | p_data | Pointer to ahbm buffer adderss |
[in] | length | Amount of data transmit during dma mode. |
HAL_OK | Operation is OK. |
HAL_ERROR | Parameter error or operation not supported. |
HAL_BUSY | Driver is busy. |
HAL_TIMEOUT | Timeout occurred. |
hal_status_t hal_usb_ep_write_end | ( | usb_handle_t * | p_usb, |
hal_usb_ep_t | ep | ||
) |
usbd inform host transmit data end.
[in] | p_usb | Pointer to an USB handle which contains the configuration information for the specified USB module. |
[in] | ep | USB endpoit number(only EP0 EP2 EP3 EP4 supported) |
HAL_OK | Operation is OK. |
HAL_ERROR | Parameter error or operation not supported. |
HAL_BUSY | Driver is busy. |
HAL_TIMEOUT | Timeout occurred. |
hal_status_t hal_usb_ep_write_start | ( | usb_handle_t * | p_usb, |
hal_usb_ep_t | ep | ||
) |
usb ep start transmit data.
[in] | p_usb | Pointer to an USB handle which contains the configuration information for the specified USB module. |
[in] | ep | USB endpoit number(only EP0 EP2 EP3 EP4 supported) |
HAL_OK | Operation is OK. |
HAL_ERROR | Parameter error or operation not supported. |
HAL_BUSY | Driver is busy. |
HAL_TIMEOUT | Timeout occurred. |
uint32_t hal_usb_get_addr | ( | usb_handle_t * | p_usb | ) |
get USB devcice address
[in] | p_usb | Pointer to an USB handle which contains the configuration information for the specified USB module. |
uint8_t hal_usb_get_connect_state | ( | void | ) |
usb module gets whether the device is connected to the host.
::0 | usb device is disconnected to the host. |
::1 | usb device is connected to the host. |
uint32_t hal_usb_get_ep0_rx_data_sum | ( | usb_handle_t * | p_usb | ) |
get USB EP0 received data sum.
[in] | p_usb | Pointer to an USB handle which contains the configuration information for the specified USB module. |
uint32_t hal_usb_get_ep1_rx_data_sum | ( | usb_handle_t * | p_usb | ) |
get USB EP1 received data sum.
[in] | p_usb | Pointer to an USB handle which contains the configuration information for the specified USB module. |
uint32_t hal_usb_get_ep5_rx_data_sum | ( | usb_handle_t * | p_usb | ) |
get USB EP5 received data sum.
[in] | p_usb | Pointer to an USB handle which contains the configuration information for the specified USB module. |
uint32_t hal_usb_get_ep_attr | ( | usb_handle_t * | p_usb, |
hal_usb_ep_t | ep | ||
) |
get USB EP attribute setting.
[in] | p_usb | Pointer to an USB handle which contains the configuration information for the specified USB module. |
[in] | ep | ep EP1 EP2 EP3 |
uint32_t hal_usb_get_it_flag | ( | usb_handle_t * | p_usb | ) |
get USB all interrupt status.
[in] | p_usb | Pointer to an USB handle which contains the configuration information for the specified USB module. |
hal_status_t hal_usb_halt_ep | ( | usb_handle_t * | p_usb, |
hal_usb_ep_t | ep | ||
) |
USB halt the endpoint.
[in] | p_usb | Pointer to an USB handle which contains the configuration information for the specified USB module. |
[in] | ep | ep EP1 EP2 EP3 |
HAL_OK | Operation is OK. |
HAL_ERROR | Parameter error or operation not supported. |
HAL_BUSY | Driver is busy. |
HAL_TIMEOUT | Timeout occurred. |
uint32_t hal_usb_read_ep_fifo | ( | usb_handle_t * | p_usb, |
hal_usb_ep_t | ep | ||
) |
read 32bit value from USB endpoit FIFO.
[in] | p_usb | Pointer to an USB handle which contains the configuration information for the specified USB module. |
[in] | ep | ep EP0 EP1 EP5 |
: | value USB endpoit FIFO 32bit data |
hal_status_t hal_usb_reset | ( | usb_handle_t * | p_usb | ) |
usb modlue reset the basic configuration during host reset
[in] | p_usb | Pointer to an USB handle which contains the configuration information for the specified USB module. |
HAL_OK | Operation is OK. |
HAL_ERROR | Parameter error or operation not supported. |
HAL_BUSY | Driver is busy. |
HAL_TIMEOUT | Timeout occurred. |
hal_status_t hal_usb_set_addr | ( | usb_handle_t * | p_usb, |
uint32_t | addr | ||
) |
set USB devcice address.
[in] | p_usb | Pointer to an USB handle which contains the configuration information for the specified USB module. |
[in] | addr | USB device address. |
HAL_OK | Operation is OK. |
HAL_ERROR | Parameter error or operation not supported. |
HAL_BUSY | Driver is busy. |
HAL_TIMEOUT | Timeout occurred. |
hal_status_t hal_usb_set_and_unhalt_ep | ( | usb_handle_t * | p_usb, |
hal_usb_ep_t | ep, | ||
uint32_t | attr | ||
) |
USB un halt the endpoint and set the endpoint attribute.
[in] | p_usb | Pointer to an USB handle which contains the configuration information for the specified USB module. |
[in] | ep | ep EP1 EP2 EP3 |
[in] | attr | USB attribute setting. |
HAL_OK | Operation is OK. |
HAL_ERROR | Parameter error or operation not supported. |
HAL_BUSY | Driver is busy. |
HAL_TIMEOUT | Timeout occurred. |
hal_status_t hal_usb_set_cmd_err | ( | usb_handle_t * | p_usb | ) |
send error command to USB host(EP0).
[in] | p_usb | Pointer to an USB handle which contains the configuration information for the specified USB module. |
HAL_OK | Operation is OK. |
HAL_ERROR | Parameter error or operation not supported. |
HAL_BUSY | Driver is busy. |
HAL_TIMEOUT | Timeout occurred. |
hal_status_t hal_usb_set_cmd_ok | ( | usb_handle_t * | p_usb | ) |
send ok command to USB host(EP0).
[in] | p_usb | Pointer to an USB handle which contains the configuration information for the specified USB module. |
HAL_OK | Operation is OK. |
HAL_ERROR | Parameter error or operation not supported. |
HAL_BUSY | Driver is busy. |
HAL_TIMEOUT | Timeout occurred. |
hal_status_t hal_usb_set_ep_attr | ( | usb_handle_t * | p_usb, |
hal_usb_ep_t | ep, | ||
uint32_t | attr | ||
) |
set USB EP attribute.
[in] | p_usb | Pointer to an USB handle which contains the configuration information for the specified USB module. |
[in] | ep | ep EP1 EP2 EP3 |
[in] | attr | USB attribute setting. This parameter can be one of the following values:
|
HAL_OK | Operation is OK. |
HAL_ERROR | Parameter error or operation not supported. |
HAL_BUSY | Driver is busy. |
HAL_TIMEOUT | Timeout occurred. |
hal_status_t hal_usb_un_halt_ep | ( | usb_handle_t * | p_usb, |
hal_usb_ep_t | ep | ||
) |
USB un halt the endpoint.
[in] | p_usb | Pointer to an USB handle which contains the configuration information for the specified USB module. |
[in] | ep | ep EP1 EP2 EP3 |
HAL_OK | Operation is OK. |
HAL_ERROR | Parameter error or operation not supported. |
HAL_BUSY | Driver is busy. |
HAL_TIMEOUT | Timeout occurred. |
hal_status_t hal_usb_write_ep_fifo | ( | usb_handle_t * | p_usb, |
hal_usb_ep_t | ep, | ||
uint32_t | value, | ||
uint32_t | ep4_wr_byte | ||
) |
write 32bit value to USB endpoit FIFO.
[in] | p_usb | Pointer to an USB handle which contains the configuration information for the specified USB module. |
[in] | ep | USB endpoit number(only EP0 EP2 EP3 EP4 supported) |
[in] | value | USB endpoit FIFO 32bit data |
[in] | ep4_wr_byte | USB ep4 write fifo effective byte USB_EP4_FIFO_WEN_DEFAULT USB_EP4_FIFO_WEN_1BYTE USB_EP4_FIFO_WEN_2BYTE USB_EP4_FIFO_WEN_3BYTE USB_EP4_FIFO_WEN_4BYTE |
HAL_OK | Operation is OK. |
HAL_ERROR | Parameter error or operation not supported. |
HAL_BUSY | Driver is busy. |
HAL_TIMEOUT | Timeout occurred. |