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 "dwc_otg_os_dep.h"
00038 #include "usb.h"
00039 #include "dwc_otg_cil.h"
00040 #include "dwc_otg_pcd_if.h"
00041 struct cfiobject;
00042
00059 #define DWC_DMA_ADDR_INVALID (~(dwc_dma_t)0)
00060
00062 #define DDMA_MAX_TRANSFER_SIZE 65535
00063
00067 #define GET_CORE_IF( _pcd ) (_pcd->core_if)
00068
00072 typedef enum ep0_state {
00073 EP0_DISCONNECT,
00074 EP0_IDLE,
00075 EP0_IN_DATA_PHASE,
00076 EP0_OUT_DATA_PHASE,
00077 EP0_IN_STATUS_PHASE,
00078 EP0_OUT_STATUS_PHASE,
00079 EP0_STALL,
00080 } ep0state_e;
00081
00083 struct dwc_otg_pcd;
00084
00088 typedef struct usb_iso_request dwc_otg_pcd_iso_request_t;
00089
00090 #ifdef DWC_UTE_PER_IO
00091
00096 struct dwc_iso_pkt_desc_port {
00097 uint32_t offset;
00098 uint32_t length;
00099 uint32_t actual_length;
00100 uint32_t status;
00101 };
00102
00103 struct dwc_iso_xreq_port {
00105 uint32_t tr_sub_flags;
00107 #define DWC_EREQ_TF_ASAP 0x00000002
00108
00109 #define DWC_EREQ_TF_ENQUEUE 0x00000004
00110
00115 uint32_t pio_pkt_count;
00117 uint32_t pio_alloc_pkt_count;
00119 uint32_t error_count;
00121 uint32_t res;
00123 struct dwc_iso_pkt_desc_port *per_io_frame_descs;
00124 };
00125 #endif
00126
00129 typedef struct dwc_otg_pcd_request {
00130 void *priv;
00131 void *buf;
00132 dwc_dma_t dma;
00133 uint32_t length;
00134 uint32_t actual;
00135 unsigned sent_zlp:1;
00140 uint8_t *dw_align_buf;
00141 dwc_dma_t dw_align_buf_dma;
00142
00143 DWC_CIRCLEQ_ENTRY(dwc_otg_pcd_request) queue_entry;
00144 #ifdef DWC_UTE_PER_IO
00145 struct dwc_iso_xreq_port ext_req;
00146
00147 #endif
00148 } dwc_otg_pcd_request_t;
00149
00150 DWC_CIRCLEQ_HEAD(req_list, dwc_otg_pcd_request);
00151
00156 typedef struct dwc_otg_pcd_ep {
00158 const usb_endpoint_descriptor_t *desc;
00159
00161 struct req_list queue;
00162 unsigned stopped:1;
00163 unsigned disabling:1;
00164 unsigned dma:1;
00165 unsigned queue_sof:1;
00166
00167 #ifdef DWC_EN_ISOC
00168
00169 void *iso_req_handle;
00170 #endif //_EN_ISOC_
00171
00173 dwc_ep_t dwc_ep;
00174
00176 struct dwc_otg_pcd *pcd;
00177
00178 void *priv;
00179 } dwc_otg_pcd_ep_t;
00180
00184 struct dwc_otg_pcd {
00185 const struct dwc_otg_pcd_function_ops *fops;
00187 struct dwc_otg_device *otg_dev;
00189 dwc_otg_core_if_t *core_if;
00191 ep0state_e ep0state;
00193 unsigned ep0_pending:1;
00195 unsigned request_config:1;
00197 unsigned remote_wakeup_enable:1;
00199 unsigned b_hnp_enable:1;
00201 unsigned a_hnp_support:1;
00203 unsigned a_alt_hnp_support:1;
00205 unsigned request_pending;
00206
00211 union {
00212 usb_device_request_t req;
00213 uint32_t d32[2];
00214 } *setup_pkt;
00215
00216 dwc_dma_t setup_pkt_dma_handle;
00217
00219 uint16_t *status_buf;
00220 dwc_dma_t status_buf_dma_handle;
00221
00223 dwc_otg_pcd_ep_t ep0;
00224
00226 dwc_otg_pcd_ep_t in_ep[MAX_EPS_CHANNELS - 1];
00228 dwc_otg_pcd_ep_t out_ep[MAX_EPS_CHANNELS - 1];
00230
00231 dwc_spinlock_t *lock;
00232
00236 dwc_tasklet_t *test_mode_tasklet;
00237
00239 dwc_tasklet_t *start_xfer_tasklet;
00240
00242 unsigned test_mode;
00246 #ifdef DWC_UTE_CFI
00247 struct cfiobject *cfi;
00248 #endif
00249
00250 };
00251
00252
00253 extern void dwc_otg_request_nuke(dwc_otg_pcd_ep_t * ep);
00254 extern void dwc_otg_request_done(dwc_otg_pcd_ep_t * ep,
00255 dwc_otg_pcd_request_t * req, int32_t status);
00256
00257 void dwc_otg_iso_buffer_done(dwc_otg_pcd_t * pcd, dwc_otg_pcd_ep_t * ep,
00258 void *req_handle);
00259
00260 extern void do_test_mode(void *data);
00261 #endif
00262 #endif