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: #39 $
00004  * $Date: 2008/12/16 $
00005  * $Change: 1153731 $
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 "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,         /* no host */
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 //        unsigned      num_eps : 4;
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 //FIXME this functions should be static, and this prototypes should be removed
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                          /* DWC_HOST_ONLY */

Generated on Tue May 5 02:22:48 2009 for DesignWare USB 2.0 OTG Controller (DWC_otg) Device Driver by  doxygen 1.4.7