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 uint16_t dwc_otg_get_otg_version(dwc_otg_core_if_t * core_if);
00183
00189 extern uint32_t dwc_otg_hcd_is_b_host(dwc_otg_hcd_t * hcd);
00190
00196 extern int dwc_otg_hcd_get_frame_number(dwc_otg_hcd_t * hcd);
00197
00203 extern void dwc_otg_hcd_dump_state(dwc_otg_hcd_t * hcd);
00204
00213 extern void dwc_otg_hcd_dump_frrem(dwc_otg_hcd_t * hcd);
00214
00226 extern int dwc_otg_hcd_send_lpm(dwc_otg_hcd_t * hcd, uint8_t devaddr,
00227 uint8_t hird, uint8_t bRemoteWake);
00228
00229
00230
00239 extern dwc_otg_hcd_urb_t *dwc_otg_hcd_urb_alloc(dwc_otg_hcd_t * hcd,
00240 int iso_desc_count,
00241 int atomic_alloc);
00242
00253 extern void dwc_otg_hcd_urb_set_pipeinfo(dwc_otg_hcd_urb_t * hcd_urb,
00254 uint8_t devaddr, uint8_t ep_num,
00255 uint8_t ep_type, uint8_t ep_dir,
00256 uint16_t mps);
00257
00258
00259 #define URB_GIVEBACK_ASAP 0x1
00260 #define URB_SEND_ZERO_PACKET 0x2
00261
00276 extern void dwc_otg_hcd_urb_set_params(dwc_otg_hcd_urb_t * urb,
00277 void *urb_handle, void *buf,
00278 dwc_dma_t dma, uint32_t buflen, void *sp,
00279 dwc_dma_t sp_dma, uint32_t flags,
00280 uint16_t interval);
00281
00286 extern uint32_t dwc_otg_hcd_urb_get_status(dwc_otg_hcd_urb_t * dwc_otg_urb);
00287
00292 extern uint32_t dwc_otg_hcd_urb_get_actual_length(dwc_otg_hcd_urb_t *
00293 dwc_otg_urb);
00294
00299 extern uint32_t dwc_otg_hcd_urb_get_error_count(dwc_otg_hcd_urb_t *
00300 dwc_otg_urb);
00301
00309 extern void dwc_otg_hcd_urb_set_iso_desc_params(dwc_otg_hcd_urb_t * dwc_otg_urb,
00310 int desc_num, uint32_t offset,
00311 uint32_t length);
00312
00318 extern uint32_t dwc_otg_hcd_urb_get_iso_desc_status(dwc_otg_hcd_urb_t *
00319 dwc_otg_urb, int desc_num);
00320
00326 extern uint32_t dwc_otg_hcd_urb_get_iso_desc_actual_length(dwc_otg_hcd_urb_t *
00327 dwc_otg_urb,
00328 int desc_num);
00329
00341 extern int dwc_otg_hcd_urb_enqueue(dwc_otg_hcd_t * dwc_otg_hcd,
00342 dwc_otg_hcd_urb_t * dwc_otg_urb,
00343 void **ep_handle, int atomic_alloc);
00344
00350 extern int dwc_otg_hcd_urb_dequeue(dwc_otg_hcd_t * dwc_otg_hcd,
00351 dwc_otg_hcd_urb_t * dwc_otg_urb);
00352
00363 extern int dwc_otg_hcd_endpoint_disable(dwc_otg_hcd_t * hcd, void *ep_handle,
00364 int retry);
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375 extern int dwc_otg_hcd_endpoint_reset(dwc_otg_hcd_t * hcd, void *ep_handle);
00376
00382 extern int dwc_otg_hcd_is_status_changed(dwc_otg_hcd_t * hcd, int port);
00383
00390 extern int dwc_otg_hcd_is_bandwidth_allocated(dwc_otg_hcd_t * hcd,
00391 void *ep_handle);
00392
00398 extern int dwc_otg_hcd_is_bandwidth_freed(dwc_otg_hcd_t * hcd, void *ep_handle);
00399
00406 extern uint8_t dwc_otg_hcd_get_ep_bandwidth(dwc_otg_hcd_t * hcd,
00407 void *ep_handle);
00408
00411 #endif
00412 #endif