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_HOST_ONLY
00034
00035 #if !defined(__DWC_PCD_IF_H__)
00036 #define __DWC_PCD_IF_H__
00037
00038
00039 #include "dwc_otg_core_if.h"
00040
00045 struct dwc_otg_pcd;
00046 typedef struct dwc_otg_pcd dwc_otg_pcd_t;
00047
00049 #define MAX_EP0_SIZE 64
00050
00051 #define MAX_PACKET_SIZE 1024
00052
00061 typedef int (*dwc_completion_cb_t) (dwc_otg_pcd_t * pcd, void *ep_handle,
00062 void *req_handle, int32_t status,
00063 uint32_t actual);
00071 typedef int (*dwc_isoc_completion_cb_t) (dwc_otg_pcd_t * pcd, void *ep_handle,
00072 void *req_handle, int proc_buf_num);
00081 typedef int (*dwc_setup_cb_t) (dwc_otg_pcd_t * pcd, uint8_t * bytes);
00086 typedef int (*dwc_disconnect_cb_t) (dwc_otg_pcd_t * pcd);
00088 typedef int (*dwc_connect_cb_t) (dwc_otg_pcd_t * pcd, int speed);
00090 typedef int (*dwc_suspend_cb_t) (dwc_otg_pcd_t * pcd);
00093 typedef int (*dwc_sleep_cb_t) (dwc_otg_pcd_t * pcd);
00096 typedef int (*dwc_resume_cb_t) (dwc_otg_pcd_t * pcd);
00100 typedef int (*dwc_hnp_params_changed_cb_t) (dwc_otg_pcd_t * pcd);
00102 typedef int (*dwc_reset_cb_t) (dwc_otg_pcd_t * pcd);
00103
00104 typedef int (*cfi_setup_cb_t) (dwc_otg_pcd_t * pcd, void *ctrl_req_bytes);
00105
00112 typedef int (*xiso_completion_cb_t) (dwc_otg_pcd_t * pcd, void *ep_handle,
00113 void *req_handle, int32_t status,
00114 void *ereq_port);
00116 struct dwc_otg_pcd_function_ops {
00117 dwc_connect_cb_t connect;
00118 dwc_disconnect_cb_t disconnect;
00119 dwc_setup_cb_t setup;
00120 dwc_completion_cb_t complete;
00121 dwc_isoc_completion_cb_t isoc_complete;
00122 dwc_suspend_cb_t suspend;
00123 dwc_sleep_cb_t sleep;
00124 dwc_resume_cb_t resume;
00125 dwc_reset_cb_t reset;
00126 dwc_hnp_params_changed_cb_t hnp_changed;
00127 cfi_setup_cb_t cfi_setup;
00128 #ifdef DWC_UTE_PER_IO
00129 xiso_completion_cb_t xisoc_complete;
00130 #endif
00131 };
00142 extern dwc_otg_pcd_t *dwc_otg_pcd_init(dwc_otg_core_if_t * core_if);
00143
00148 extern void dwc_otg_pcd_remove(dwc_otg_pcd_t * pcd);
00149
00155 extern void dwc_otg_pcd_start(dwc_otg_pcd_t * pcd,
00156 const struct dwc_otg_pcd_function_ops *fops);
00157
00173 extern int dwc_otg_pcd_ep_enable(dwc_otg_pcd_t * pcd,
00174 const uint8_t * ep_desc, void *usb_ep);
00175
00181 extern int dwc_otg_pcd_ep_disable(dwc_otg_pcd_t * pcd, void *ep_handle);
00182
00201 extern int dwc_otg_pcd_ep_queue(dwc_otg_pcd_t * pcd, void *ep_handle,
00202 uint8_t * buf, dwc_dma_t dma_buf,
00203 uint32_t buflen, int zero, void *req_handle,
00204 int atomic_alloc);
00205 #ifdef DWC_UTE_PER_IO
00206
00211 extern int dwc_otg_pcd_xiso_ep_queue(dwc_otg_pcd_t * pcd, void *ep_handle,
00212 uint8_t * buf, dwc_dma_t dma_buf,
00213 uint32_t buflen, int zero,
00214 void *req_handle, int atomic_alloc,
00215 void *ereq_nonport);
00216
00217 #endif
00218
00224 extern int dwc_otg_pcd_ep_dequeue(dwc_otg_pcd_t * pcd, void *ep_handle,
00225 void *req_handle);
00226
00233 extern int dwc_otg_pcd_ep_halt(dwc_otg_pcd_t * pcd, void *ep_handle, int value);
00234
00236 extern int32_t dwc_otg_pcd_handle_intr(dwc_otg_pcd_t * pcd);
00237
00239 extern int dwc_otg_pcd_get_frame_number(dwc_otg_pcd_t * pcd);
00240
00267 extern int dwc_otg_pcd_iso_ep_start(dwc_otg_pcd_t * pcd, void *ep_handle,
00268 uint8_t * buf0, uint8_t * buf1,
00269 dwc_dma_t dma0, dwc_dma_t dma1,
00270 int sync_frame, int dp_frame,
00271 int data_per_frame, int start_frame,
00272 int buf_proc_intrvl, void *req_handle,
00273 int atomic_alloc);
00274
00284 int dwc_otg_pcd_iso_ep_stop(dwc_otg_pcd_t * pcd, void *ep_handle,
00285 void *req_handle);
00286
00298 extern void dwc_otg_pcd_get_iso_packet_params(dwc_otg_pcd_t * pcd,
00299 void *ep_handle,
00300 void *iso_req_handle, int packet,
00301 int *status, int *actual,
00302 int *offset);
00303
00310 extern int dwc_otg_pcd_get_iso_packet_count(dwc_otg_pcd_t * pcd,
00311 void *ep_handle,
00312 void *iso_req_handle);
00313
00318 extern int dwc_otg_pcd_wakeup(dwc_otg_pcd_t * pcd);
00319
00321 extern int dwc_otg_pcd_is_lpm_enabled(dwc_otg_pcd_t * pcd);
00322
00324 extern int dwc_otg_pcd_get_rmwkup_enable(dwc_otg_pcd_t * pcd);
00325
00327 extern void dwc_otg_pcd_initiate_srp(dwc_otg_pcd_t * pcd);
00328
00330 extern void dwc_otg_pcd_remote_wakeup(dwc_otg_pcd_t * pcd, int set);
00331
00333 extern void dwc_otg_pcd_disconnect_us(dwc_otg_pcd_t * pcd, int no_of_usecs);
00335 extern uint32_t dwc_otg_pcd_is_dualspeed(dwc_otg_pcd_t * pcd);
00336
00338 extern uint32_t dwc_otg_pcd_is_otg(dwc_otg_pcd_t * pcd);
00339
00341 extern uint32_t get_b_hnp_enable(dwc_otg_pcd_t * pcd);
00342 extern uint32_t get_a_hnp_support(dwc_otg_pcd_t * pcd);
00343 extern uint32_t get_a_alt_hnp_support(dwc_otg_pcd_t * pcd);
00344
00347 extern uint8_t *cfiw_ep_alloc_buffer(dwc_otg_pcd_t * pcd, void *pep,
00348 dwc_dma_t * addr, size_t buflen,
00349 int flags);
00350
00351
00352
00355 #endif
00356
00357 #endif