00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef DWC_DEVICE_ONLY
00034 #ifndef __DWC_HCD_IF_H__
00035 #define __DWC_HCD_IF_H__
00036
00037 #include "dwc_otg_core_if.h"
00038
00043 struct dwc_otg_hcd;
00044 typedef struct dwc_otg_hcd dwc_otg_hcd_t;
00045
00046 struct dwc_otg_hcd_urb;
00047 typedef struct dwc_otg_hcd_urb dwc_otg_hcd_urb_t;
00048
00053 typedef int (*dwc_otg_hcd_start_cb_t) (dwc_otg_hcd_t * hcd);
00054
00056 typedef int (*dwc_otg_hcd_disconnect_cb_t) (dwc_otg_hcd_t * hcd);
00057
00059 typedef int (*dwc_otg_hcd_hub_info_from_urb_cb_t) (dwc_otg_hcd_t * hcd,
00060 void *urb_handle,
00061 uint32_t * hub_addr,
00062 uint32_t * port_addr);
00064 typedef int (*dwc_otg_hcd_speed_from_urb_cb_t) (dwc_otg_hcd_t * hcd,
00065 void *urb_handle);
00066
00068 typedef int (*dwc_otg_hcd_complete_urb_cb_t) (dwc_otg_hcd_t * hcd,
00069 void *urb_handle,
00070 dwc_otg_hcd_urb_t * dwc_otg_urb,
00071 int32_t status);
00072
00074 typedef int (*dwc_otg_hcd_get_b_hnp_enable) (dwc_otg_hcd_t * hcd);
00075
00076 struct dwc_otg_hcd_function_ops {
00077 dwc_otg_hcd_start_cb_t start;
00078 dwc_otg_hcd_disconnect_cb_t disconnect;
00079 dwc_otg_hcd_hub_info_from_urb_cb_t hub_info;
00080 dwc_otg_hcd_speed_from_urb_cb_t speed;
00081 dwc_otg_hcd_complete_urb_cb_t complete;
00082 dwc_otg_hcd_get_b_hnp_enable get_b_hnp_enable;
00083 };
00089 extern dwc_otg_hcd_t *dwc_otg_hcd_alloc_hcd(void);
00090
00099 extern int dwc_otg_hcd_init(dwc_otg_hcd_t * hcd, dwc_otg_core_if_t * core_if);
00100
00105 extern void dwc_otg_hcd_remove(dwc_otg_hcd_t * hcd);
00106
00114 extern int32_t dwc_otg_hcd_handle_intr(dwc_otg_hcd_t * dwc_otg_hcd);
00115
00122 extern void *dwc_otg_hcd_get_priv_data(dwc_otg_hcd_t * hcd);
00123
00130 extern void dwc_otg_hcd_set_priv_data(dwc_otg_hcd_t * hcd, void *priv_data);
00131
00141 extern int dwc_otg_hcd_start(dwc_otg_hcd_t * hcd,
00142 struct dwc_otg_hcd_function_ops *fops);
00143
00150 extern void dwc_otg_hcd_stop(dwc_otg_hcd_t * hcd);
00151
00165 extern int dwc_otg_hcd_hub_control(dwc_otg_hcd_t * dwc_otg_hcd,
00166 uint16_t typeReq, uint16_t wValue,
00167 uint16_t wIndex, uint8_t * buf,
00168 uint16_t wLength);
00169
00175 extern uint32_t dwc_otg_hcd_otg_port(dwc_otg_hcd_t * hcd);
00176
00182 extern uint32_t dwc_otg_hcd_is_b_host(dwc_otg_hcd_t * hcd);
00183
00189 extern int dwc_otg_hcd_get_frame_number(dwc_otg_hcd_t * hcd);
00190
00196 extern void dwc_otg_hcd_dump_state(dwc_otg_hcd_t * hcd);
00197
00206 extern void dwc_otg_hcd_dump_frrem(dwc_otg_hcd_t * hcd);
00207
00219 extern int dwc_otg_hcd_send_lpm(dwc_otg_hcd_t * hcd, uint8_t devaddr,
00220 uint8_t hird, uint8_t bRemoteWake);
00221
00222
00223
00232 extern dwc_otg_hcd_urb_t *dwc_otg_hcd_urb_alloc(dwc_otg_hcd_t * hcd,
00233 int iso_desc_count,
00234 int atomic_alloc);
00235
00246 extern void dwc_otg_hcd_urb_set_pipeinfo(dwc_otg_hcd_urb_t * hcd_urb,
00247 uint8_t devaddr, uint8_t ep_num,
00248 uint8_t ep_type, uint8_t ep_dir,
00249 uint16_t mps);
00250
00251
00252 #define URB_GIVEBACK_ASAP 0x1
00253 #define URB_SEND_ZERO_PACKET 0x2
00254
00269 extern void dwc_otg_hcd_urb_set_params(dwc_otg_hcd_urb_t * urb,
00270 void *urb_handle, void *buf,
00271 dwc_dma_t dma, uint32_t buflen, void *sp,
00272 dwc_dma_t sp_dma, uint32_t flags,
00273 uint16_t interval);
00274
00279 extern uint32_t dwc_otg_hcd_urb_get_status(dwc_otg_hcd_urb_t * dwc_otg_urb);
00280
00285 extern uint32_t dwc_otg_hcd_urb_get_actual_length(dwc_otg_hcd_urb_t *
00286 dwc_otg_urb);
00287
00292 extern uint32_t dwc_otg_hcd_urb_get_error_count(dwc_otg_hcd_urb_t *
00293 dwc_otg_urb);
00294
00302 extern void dwc_otg_hcd_urb_set_iso_desc_params(dwc_otg_hcd_urb_t * dwc_otg_urb,
00303 int desc_num, uint32_t offset,
00304 uint32_t length);
00305
00311 extern uint32_t dwc_otg_hcd_urb_get_iso_desc_status(dwc_otg_hcd_urb_t *
00312 dwc_otg_urb, int desc_num);
00313
00319 extern uint32_t dwc_otg_hcd_urb_get_iso_desc_actual_length(dwc_otg_hcd_urb_t *
00320 dwc_otg_urb,
00321 int desc_num);
00322
00333 extern int dwc_otg_hcd_urb_enqueue(dwc_otg_hcd_t * dwc_otg_hcd,
00334 dwc_otg_hcd_urb_t * dwc_otg_urb,
00335 void **ep_handle);
00336
00342 extern int dwc_otg_hcd_urb_dequeue(dwc_otg_hcd_t * dwc_otg_hcd,
00343 dwc_otg_hcd_urb_t * dwc_otg_urb);
00344
00355 extern int dwc_otg_hcd_endpoint_disable(dwc_otg_hcd_t * hcd, void *ep_handle,
00356 int retry);
00357
00363 extern int dwc_otg_hcd_is_status_changed(dwc_otg_hcd_t * hcd, int port);
00364
00371 extern int dwc_otg_hcd_is_bandwidth_allocated(dwc_otg_hcd_t * hcd,
00372 void *ep_handle);
00373
00379 extern int dwc_otg_hcd_is_bandwidth_freed(dwc_otg_hcd_t * hcd, void *ep_handle);
00380
00387 extern uint8_t dwc_otg_hcd_get_ep_bandwidth(dwc_otg_hcd_t * hcd,
00388 void *ep_handle);
00389
00392 #endif
00393 #endif