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 #if !defined(__DWC_PCD_H__)
00035 #define __DWC_PCD_H__
00036
00037 #include "usb.h"
00038 #include "dwc_otg_cil.h"
00039 #include "dwc_otg_pcd_if.h"
00040 struct cfiobject;
00041
00058 #define DDMA_MAX_TRANSFER_SIZE 65535
00059
00061 #define MAX_DMA_DESC_CNT 64
00062
00066 #define GET_CORE_IF( _pcd ) (_pcd->core_if)
00067
00071 typedef enum ep0_state {
00072 EP0_DISCONNECT,
00073 EP0_IDLE,
00074 EP0_IN_DATA_PHASE,
00075 EP0_OUT_DATA_PHASE,
00076 EP0_IN_STATUS_PHASE,
00077 EP0_OUT_STATUS_PHASE,
00078 EP0_STALL,
00079 } ep0state_e;
00080
00082 struct dwc_otg_pcd;
00083
00087 typedef struct usb_iso_request dwc_otg_pcd_iso_request_t;
00088
00092 typedef struct dwc_otg_pcd_request {
00093 void *priv;
00094 void *buf;
00095 dwc_dma_t dma;
00096 uint32_t length;
00097 uint32_t actual;
00098 unsigned sent_zlp:1;
00099
00100 DWC_CIRCLEQ_ENTRY(dwc_otg_pcd_request) queue_entry;
00101 } dwc_otg_pcd_request_t;
00102
00103 DWC_CIRCLEQ_HEAD(req_list, dwc_otg_pcd_request);
00104
00109 typedef struct dwc_otg_pcd_ep {
00111 const usb_endpoint_descriptor_t *desc;
00112
00114 struct req_list queue;
00115 unsigned stopped:1;
00116 unsigned disabling:1;
00117 unsigned dma:1;
00118 unsigned queue_sof:1;
00119
00120 #ifdef DWC_EN_ISOC
00121
00122 void *iso_req_handle;
00123 #endif //_EN_ISOC_
00124
00126 dwc_ep_t dwc_ep;
00127
00129 struct dwc_otg_pcd *pcd;
00130
00131 void *priv;
00132 } dwc_otg_pcd_ep_t;
00133
00137 struct dwc_otg_pcd {
00138 const struct dwc_otg_pcd_function_ops *fops;
00140 dwc_otg_core_if_t *core_if;
00142 ep0state_e ep0state;
00144 unsigned ep0_pending:1;
00146 unsigned request_config:1;
00148 unsigned remote_wakeup_enable:1;
00150 unsigned b_hnp_enable:1;
00152 unsigned a_hnp_support:1;
00154 unsigned a_alt_hnp_support:1;
00156 unsigned request_pending;
00157
00162 union {
00163 usb_device_request_t req;
00164 uint32_t d32[2];
00165 } *setup_pkt;
00166
00167 dwc_dma_t setup_pkt_dma_handle;
00168
00170 uint16_t *status_buf;
00171 dwc_dma_t status_buf_dma_handle;
00172
00174 dwc_otg_pcd_ep_t ep0;
00175
00177 dwc_otg_pcd_ep_t in_ep[MAX_EPS_CHANNELS - 1];
00179 dwc_otg_pcd_ep_t out_ep[MAX_EPS_CHANNELS - 1];
00181
00182 dwc_spinlock_t *lock;
00185 dwc_timer_t *srp_timer;
00186
00190 dwc_tasklet_t *test_mode_tasklet;
00191
00193 dwc_tasklet_t *start_xfer_tasklet;
00194
00196 unsigned test_mode;
00200 #ifdef DWC_UTE_CFI
00201 struct cfiobject *cfi;
00202 #endif
00203
00204 };
00205
00206
00207 extern void dwc_otg_request_nuke(dwc_otg_pcd_ep_t * ep);
00208 extern void dwc_otg_request_done(dwc_otg_pcd_ep_t * ep,
00209 dwc_otg_pcd_request_t * req, int32_t status);
00210
00211 void dwc_otg_iso_buffer_done(dwc_otg_pcd_t * pcd, dwc_otg_pcd_ep_t * ep,
00212 void *req_handle);
00213
00214 extern void do_test_mode(void *data);
00215 #endif
00216 #endif