Main Page | Data Structures | File List | Data Fields | Globals | Related Pages

dwc_otg_pcd.h

Go to the documentation of this file.
00001 /* ==========================================================================
00002  * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_pcd.h $
00003  * $Revision: #46 $
00004  * $Date: 2011/10/20 $
00005  * $Change: 1870124 $
00006  *
00007  * Synopsys HS OTG Linux Software Driver and documentation (hereinafter,
00008  * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless
00009  * otherwise expressly agreed to in writing between Synopsys and you.
00010  *
00011  * The Software IS NOT an item of Licensed Software or Licensed Product under
00012  * any End User Software License Agreement or Agreement for Licensed Product
00013  * with Synopsys or any supplement thereto. You are permitted to use and
00014  * redistribute this Software in source and binary forms, with or without
00015  * modification, provided that redistributions of source code must retain this
00016  * notice. You may not view, use, disclose, copy or distribute this file or
00017  * any information contained herein except pursuant to this license grant from
00018  * Synopsys. If you do not agree with this notice, including the disclaimer
00019  * below, then you are not authorized to use the Software.
00020  *
00021  * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS
00022  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00023  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00024  * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT,
00025  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00026  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00027  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00028  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00029  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00030  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
00031  * DAMAGE.
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,         /* no host */
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;        /* expected 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         //void *priv_ereq_nport; /*  */
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 //        unsigned      num_eps : 4;
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 //FIXME this functions should be static, and this prototypes should be removed
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 /* DWC_HOST_ONLY */

Generated on Thu Oct 27 03:56:37 2011 for DesignWare USB 2.0 OTG Controller (DWC_otg) Device Driver by  doxygen 1.3.9.1