#include "dwc_otg_core_if.h"
Go to the source code of this file.
Data Structures | |
struct | dwc_otg_hcd_function_ops |
HCD Core API | |
#define | URB_GIVEBACK_ASAP 0x1 |
#define | URB_SEND_ZERO_PACKET 0x2 |
dwc_otg_hcd_t * | dwc_otg_hcd_alloc_hcd (void) |
This function allocates dwc_otg_hcd structure and returns pointer on it. | |
int | dwc_otg_hcd_init (dwc_otg_hcd_t *hcd, dwc_otg_core_if_t *core_if) |
This function should be called to initiate HCD Core. | |
void | dwc_otg_hcd_remove (dwc_otg_hcd_t *hcd) |
Frees HCD. | |
int32_t | dwc_otg_hcd_handle_intr (dwc_otg_hcd_t *dwc_otg_hcd) |
This function should be called on every hardware interrupt. | |
void * | dwc_otg_hcd_get_priv_data (dwc_otg_hcd_t *hcd) |
Returns private data set by dwc_otg_hcd_set_priv_data function. | |
void | dwc_otg_hcd_set_priv_data (dwc_otg_hcd_t *hcd, void *priv_data) |
Set private data. | |
int | dwc_otg_hcd_start (dwc_otg_hcd_t *hcd, struct dwc_otg_hcd_function_ops *fops) |
This function initializes the HCD Core. | |
void | dwc_otg_hcd_stop (dwc_otg_hcd_t *hcd) |
Halts the DWC_otg host mode operations in a clean manner. | |
int | dwc_otg_hcd_hub_control (dwc_otg_hcd_t *dwc_otg_hcd, uint16_t typeReq, uint16_t wValue, uint16_t wIndex, uint8_t *buf, uint16_t wLength) |
Handles hub class-specific requests. | |
uint32_t | dwc_otg_hcd_otg_port (dwc_otg_hcd_t *hcd) |
Returns otg port number. | |
uint32_t | dwc_otg_hcd_is_b_host (dwc_otg_hcd_t *hcd) |
Returns 1 if currently core is acting as B host, and 0 otherwise. | |
int | dwc_otg_hcd_get_frame_number (dwc_otg_hcd_t *hcd) |
Returns current frame number. | |
void | dwc_otg_hcd_dump_state (dwc_otg_hcd_t *hcd) |
Dumps hcd state. | |
void | dwc_otg_hcd_dump_frrem (dwc_otg_hcd_t *hcd) |
Dump the average frame remaining at SOF. | |
int | dwc_otg_hcd_send_lpm (dwc_otg_hcd_t *hcd, uint8_t devaddr, uint8_t hird, uint8_t bRemoteWake) |
Sends LPM transaction to the local device. | |
dwc_otg_hcd_urb_t * | dwc_otg_hcd_urb_alloc (dwc_otg_hcd_t *hcd, int iso_desc_count, int atomic_alloc) |
Allocates memory for dwc_otg_hcd_urb structure. | |
void | dwc_otg_hcd_urb_set_pipeinfo (dwc_otg_hcd_urb_t *hcd_urb, uint8_t devaddr, uint8_t ep_num, uint8_t ep_type, uint8_t ep_dir, uint16_t mps) |
Set pipe information in URB. | |
void | dwc_otg_hcd_urb_set_params (dwc_otg_hcd_urb_t *urb, void *urb_handle, void *buf, dwc_dma_t dma, uint32_t buflen, void *sp, dwc_dma_t sp_dma, uint32_t flags, uint16_t interval) |
Sets dwc_otg_hcd_urb parameters. | |
uint32_t | dwc_otg_hcd_urb_get_status (dwc_otg_hcd_urb_t *dwc_otg_urb) |
Gets status from dwc_otg_hcd_urb. | |
uint32_t | dwc_otg_hcd_urb_get_actual_length (dwc_otg_hcd_urb_t *dwc_otg_urb) |
Gets actual length from dwc_otg_hcd_urb. | |
uint32_t | dwc_otg_hcd_urb_get_error_count (dwc_otg_hcd_urb_t *dwc_otg_urb) |
Gets error count from dwc_otg_hcd_urb. | |
void | dwc_otg_hcd_urb_set_iso_desc_params (dwc_otg_hcd_urb_t *dwc_otg_urb, int desc_num, uint32_t offset, uint32_t length) |
Set ISOC descriptor offset and length. | |
uint32_t | dwc_otg_hcd_urb_get_iso_desc_status (dwc_otg_hcd_urb_t *dwc_otg_urb, int desc_num) |
Get status of ISOC descriptor, specified by desc_num. | |
uint32_t | dwc_otg_hcd_urb_get_iso_desc_actual_length (dwc_otg_hcd_urb_t *dwc_otg_urb, int desc_num) |
Get actual length of ISOC descriptor, specified by desc_num. | |
int | dwc_otg_hcd_urb_enqueue (dwc_otg_hcd_t *dwc_otg_hcd, dwc_otg_hcd_urb_t *dwc_otg_urb, void **ep_handle) |
Queue URB. | |
int | dwc_otg_hcd_urb_dequeue (dwc_otg_hcd_t *dwc_otg_hcd, dwc_otg_hcd_urb_t *dwc_otg_urb) |
De-queue the specified URB. | |
int | dwc_otg_hcd_endpoint_disable (dwc_otg_hcd_t *hcd, void *ep_handle, int retry) |
Frees resources in the DWC_otg controller related to a given endpoint. | |
int | dwc_otg_hcd_is_status_changed (dwc_otg_hcd_t *hcd, int port) |
Returns 1 if status of specified port is changed and 0 otherwise. | |
int | dwc_otg_hcd_is_bandwidth_allocated (dwc_otg_hcd_t *hcd, void *ep_handle) |
Call this function to check if bandwidth was allocated for specified endpoint. | |
int | dwc_otg_hcd_is_bandwidth_freed (dwc_otg_hcd_t *hcd, void *ep_handle) |
Call this function to check if bandwidth was freed for specified endpoint. | |
uint8_t | dwc_otg_hcd_get_ep_bandwidth (dwc_otg_hcd_t *hcd, void *ep_handle) |
Returns bandwidth allocated for specified endpoint in microseconds. | |
HCD Function Driver Callbacks | |
typedef int(*) | dwc_otg_hcd_start_cb_t (dwc_otg_hcd_t *hcd) |
This function is called whenever core switches to host mode. | |
typedef int(*) | dwc_otg_hcd_disconnect_cb_t (dwc_otg_hcd_t *hcd) |
This function is called when device has been disconnected. | |
typedef int(*) | dwc_otg_hcd_hub_info_from_urb_cb_t (dwc_otg_hcd_t *hcd, void *urb_handle, uint32_t *hub_addr, uint32_t *port_addr) |
Wrapper provides this function to HCD to core, so it can get hub information to which device is connected. | |
typedef int(*) | dwc_otg_hcd_speed_from_urb_cb_t (dwc_otg_hcd_t *hcd, void *urb_handle) |
Via this function HCD core gets device speed. | |
typedef int(*) | dwc_otg_hcd_complete_urb_cb_t (dwc_otg_hcd_t *hcd, void *urb_handle, dwc_otg_hcd_urb_t *dwc_otg_urb, int32_t status) |
This function is called when urb is completed. | |
typedef int(*) | dwc_otg_hcd_get_b_hnp_enable (dwc_otg_hcd_t *hcd) |
Via this function HCD core gets b_hnp_enable parameter. | |
Typedefs | |
typedef dwc_otg_hcd | dwc_otg_hcd_t |
typedef dwc_otg_hcd_urb | dwc_otg_hcd_urb_t |
Definition in file dwc_otg_hcd_if.h.
int dwc_otg_hcd_init | ( | dwc_otg_hcd_t * | hcd, | |
dwc_otg_core_if_t * | core_if | |||
) |
This function should be called to initiate HCD Core.
hcd | The HCD | |
core_if | The DWC_OTG Core |
Definition at line 693 of file dwc_otg_hcd.c.
void dwc_otg_hcd_remove | ( | dwc_otg_hcd_t * | hcd | ) |
int32_t dwc_otg_hcd_handle_intr | ( | dwc_otg_hcd_t * | dwc_otg_hcd | ) |
This function should be called on every hardware interrupt.
dwc_otg_hcd | The HCD |
Definition at line 43 of file dwc_otg_hcd_intr.c.
void* dwc_otg_hcd_get_priv_data | ( | dwc_otg_hcd_t * | hcd | ) |
Returns private data set by dwc_otg_hcd_set_priv_data function.
hcd | The HCD |
Definition at line 2671 of file dwc_otg_hcd.c.
void dwc_otg_hcd_set_priv_data | ( | dwc_otg_hcd_t * | hcd, | |
void * | priv_data | |||
) |
Set private data.
hcd | The HCD | |
priv_data | pointer to be stored in private data |
Definition at line 2676 of file dwc_otg_hcd.c.
int dwc_otg_hcd_start | ( | dwc_otg_hcd_t * | hcd, | |
struct dwc_otg_hcd_function_ops * | fops | |||
) |
This function initializes the HCD Core.
hcd | The HCD | |
fops | The Function Driver Operations data structure containing pointers to all callbacks. |
Definition at line 2656 of file dwc_otg_hcd.c.
void dwc_otg_hcd_stop | ( | dwc_otg_hcd_t * | hcd | ) |
Halts the DWC_otg host mode operations in a clean manner.
USB transfers are stopped.
Definition at line 422 of file dwc_otg_hcd.c.
int dwc_otg_hcd_hub_control | ( | dwc_otg_hcd_t * | dwc_otg_hcd, | |
uint16_t | typeReq, | |||
uint16_t | wValue, | |||
uint16_t | wIndex, | |||
uint8_t * | buf, | |||
uint16_t | wLength | |||
) |
Handles hub class-specific requests.
dwc_otg_hcd | The HCD | |
typeReq | Request Type | |
wValue | wValue from control request | |
wIndex | wIndex from control request | |
buf | data buffer | |
wLength | data buffer length |
Definition at line 1905 of file dwc_otg_hcd.c.
uint32_t dwc_otg_hcd_otg_port | ( | dwc_otg_hcd_t * | hcd | ) |
uint32_t dwc_otg_hcd_is_b_host | ( | dwc_otg_hcd_t * | hcd | ) |
Returns 1 if currently core is acting as B host, and 0 otherwise.
hcd | The HCD |
Definition at line 2686 of file dwc_otg_hcd.c.
int dwc_otg_hcd_get_frame_number | ( | dwc_otg_hcd_t * | hcd | ) |
Returns current frame number.
hcd | The HCD |
Definition at line 2643 of file dwc_otg_hcd.c.
void dwc_otg_hcd_dump_state | ( | dwc_otg_hcd_t * | hcd | ) |
void dwc_otg_hcd_dump_frrem | ( | dwc_otg_hcd_t * | hcd | ) |
Dump the average frame remaining at SOF.
This can be used to determine average interrupt latency. Frame remaining is also shown for start transfer and two additional sample points. Currently this function is not implemented.
hcd | The HCD |
Definition at line 2991 of file dwc_otg_hcd.c.
int dwc_otg_hcd_send_lpm | ( | dwc_otg_hcd_t * | hcd, | |
uint8_t | devaddr, | |||
uint8_t | hird, | |||
uint8_t | bRemoteWake | |||
) |
Sends LPM transaction to the local device.
hcd | The HCD | |
devaddr | Device Address | |
hird | Host initiated resume duration | |
bRemoteWake | Value of bRemoteWake field in LPM transaction |
dwc_otg_hcd_urb_t* dwc_otg_hcd_urb_alloc | ( | dwc_otg_hcd_t * | hcd, | |
int | iso_desc_count, | |||
int | atomic_alloc | |||
) |
Allocates memory for dwc_otg_hcd_urb structure.
Allocated memory should be freed by call dwc_free function.
hcd | The HCD | |
iso_desc_count | Count of ISOC descriptors | |
atomic_alloc | Specefies whether to perform atomic allocation. |
Definition at line 2698 of file dwc_otg_hcd.c.
void dwc_otg_hcd_urb_set_pipeinfo | ( | dwc_otg_hcd_urb_t * | hcd_urb, | |
uint8_t | devaddr, | |||
uint8_t | ep_num, | |||
uint8_t | ep_type, | |||
uint8_t | ep_dir, | |||
uint16_t | mps | |||
) |
Set pipe information in URB.
hcd_urb | DWC_OTG URB | |
devaddr | Device Address | |
ep_num | Endpoint Number | |
ep_type | Endpoint Type | |
ep_dir | Endpoint Direction | |
mps | Max Packet Size |
Definition at line 2717 of file dwc_otg_hcd.c.
void dwc_otg_hcd_urb_set_params | ( | dwc_otg_hcd_urb_t * | urb, | |
void * | urb_handle, | |||
void * | buf, | |||
dwc_dma_t | dma, | |||
uint32_t | buflen, | |||
void * | sp, | |||
dwc_dma_t | sp_dma, | |||
uint32_t | flags, | |||
uint16_t | interval | |||
) |
Sets dwc_otg_hcd_urb parameters.
urb | DWC_OTG URB allocated by dwc_otg_hcd_urb_alloc function. | |
urb_handle | Unique handle for request, this will be passed back to function driver in completion callback. | |
buf | The buffer for the data | |
dma | The DMA buffer for the data | |
buflen | Transfer length | |
sp | Buffer for setup data | |
sp_dma | DMA address of setup data buffer | |
flags | Transfer flags | |
interval | Polling interval for interrupt or isochronous transfers. |
Definition at line 2730 of file dwc_otg_hcd.c.
uint32_t dwc_otg_hcd_urb_get_status | ( | dwc_otg_hcd_urb_t * | dwc_otg_urb | ) |
Gets status from dwc_otg_hcd_urb.
dwc_otg_urb | DWC_OTG URB |
Definition at line 2747 of file dwc_otg_hcd.c.
uint32_t dwc_otg_hcd_urb_get_actual_length | ( | dwc_otg_hcd_urb_t * | dwc_otg_urb | ) |
Gets actual length from dwc_otg_hcd_urb.
dwc_otg_urb | DWC_OTG URB |
Definition at line 2752 of file dwc_otg_hcd.c.
uint32_t dwc_otg_hcd_urb_get_error_count | ( | dwc_otg_hcd_urb_t * | dwc_otg_urb | ) |
Gets error count from dwc_otg_hcd_urb.
Only for ISOC URBs
dwc_otg_urb | DWC_OTG URB |
Definition at line 2757 of file dwc_otg_hcd.c.
void dwc_otg_hcd_urb_set_iso_desc_params | ( | dwc_otg_hcd_urb_t * | dwc_otg_urb, | |
int | desc_num, | |||
uint32_t | offset, | |||
uint32_t | length | |||
) |
Set ISOC descriptor offset and length.
dwc_otg_urb | DWC_OTG URB | |
desc_num | ISOC descriptor number | |
offset | Offset from beginig of buffer. | |
length | Transaction length |
Definition at line 2762 of file dwc_otg_hcd.c.
uint32_t dwc_otg_hcd_urb_get_iso_desc_status | ( | dwc_otg_hcd_urb_t * | dwc_otg_urb, | |
int | desc_num | |||
) |
Get status of ISOC descriptor, specified by desc_num.
dwc_otg_urb | DWC_OTG URB | |
desc_num | ISOC descriptor number |
Definition at line 2770 of file dwc_otg_hcd.c.
uint32_t dwc_otg_hcd_urb_get_iso_desc_actual_length | ( | dwc_otg_hcd_urb_t * | dwc_otg_urb, | |
int | desc_num | |||
) |
Get actual length of ISOC descriptor, specified by desc_num.
dwc_otg_urb | DWC_OTG URB | |
desc_num | ISOC descriptor number |
Definition at line 2776 of file dwc_otg_hcd.c.
int dwc_otg_hcd_urb_enqueue | ( | dwc_otg_hcd_t * | dwc_otg_hcd, | |
dwc_otg_hcd_urb_t * | dwc_otg_urb, | |||
void ** | ep_handle | |||
) |
Queue URB.
After transfer is completes, the complete callback will be called with the URB status
dwc_otg_hcd | The HCD | |
dwc_otg_urb | DWC_OTG URB | |
ep_handle | Out parameter for returning endpoint handle |
Definition at line 444 of file dwc_otg_hcd.c.
int dwc_otg_hcd_urb_dequeue | ( | dwc_otg_hcd_t * | dwc_otg_hcd, | |
dwc_otg_hcd_urb_t * | dwc_otg_urb | |||
) |
De-queue the specified URB.
dwc_otg_hcd | The HCD | |
dwc_otg_urb | DWC_OTG URB |
Definition at line 489 of file dwc_otg_hcd.c.
int dwc_otg_hcd_endpoint_disable | ( | dwc_otg_hcd_t * | hcd, | |
void * | ep_handle, | |||
int | retry | |||
) |
Frees resources in the DWC_otg controller related to a given endpoint.
Any URBs for the endpoint must already be dequeued.
hcd | The HCD | |
ep_handle | Endpoint handle, returned by dwc_otg_hcd_urb_enqueue function | |
retry | Number of retries if there are queued transfers. |
Definition at line 547 of file dwc_otg_hcd.c.
int dwc_otg_hcd_is_status_changed | ( | dwc_otg_hcd_t * | hcd, | |
int | port | |||
) |
Returns 1 if status of specified port is changed and 0 otherwise.
hcd | The HCD | |
port | Port number |
Definition at line 2611 of file dwc_otg_hcd.c.
int dwc_otg_hcd_is_bandwidth_allocated | ( | dwc_otg_hcd_t * | hcd, | |
void * | ep_handle | |||
) |
Call this function to check if bandwidth was allocated for specified endpoint.
Only for ISOC and INTERRUPT endpoints.
hcd | The HCD | |
ep_handle | Endpoint handle |
Definition at line 2782 of file dwc_otg_hcd.c.
int dwc_otg_hcd_is_bandwidth_freed | ( | dwc_otg_hcd_t * | hcd, | |
void * | ep_handle | |||
) |
Call this function to check if bandwidth was freed for specified endpoint.
hcd | The HCD | |
ep_handle | Endpoint handle |
Definition at line 2795 of file dwc_otg_hcd.c.
uint8_t dwc_otg_hcd_get_ep_bandwidth | ( | dwc_otg_hcd_t * | hcd, | |
void * | ep_handle | |||
) |
Returns bandwidth allocated for specified endpoint in microseconds.
Only for ISOC and INTERRUPT endpoints.
hcd | The HCD | |
ep_handle | Endpoint handle |
Definition at line 2808 of file dwc_otg_hcd.c.