dwc_otg_hcd_if.h

Go to the documentation of this file.
00001 /* ==========================================================================
00002  * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd_if.h $
00003  * $Revision: #6 $
00004  * $Date: 2009/04/21 $
00005  * $Change: 1237474 $
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_DEVICE_ONLY
00034 #ifndef __DWC_HCD_IF_H__
00035 #define __DWC_HCD_IF_H__
00036 
00037 #include "dwc_otg_core_if.h"
00038 
00043 struct dwc_otg_hcd;
00044 typedef struct dwc_otg_hcd dwc_otg_hcd_t;
00045 
00046 struct dwc_otg_hcd_urb;
00047 typedef struct dwc_otg_hcd_urb dwc_otg_hcd_urb_t;
00048 
00053 typedef int (*dwc_otg_hcd_start_cb_t) (dwc_otg_hcd_t * hcd);
00054 
00056 typedef int (*dwc_otg_hcd_disconnect_cb_t) (dwc_otg_hcd_t * hcd);
00057 
00059 typedef int (*dwc_otg_hcd_hub_info_from_urb_cb_t) (dwc_otg_hcd_t * hcd,
00060                                                    void *urb_handle,
00061                                                    uint32_t * hub_addr,
00062                                                    uint32_t * port_addr);
00064 typedef int (*dwc_otg_hcd_speed_from_urb_cb_t) (dwc_otg_hcd_t * hcd,
00065                                                 void *urb_handle);
00066 
00068 typedef int (*dwc_otg_hcd_complete_urb_cb_t) (dwc_otg_hcd_t * hcd,
00069                                               void *urb_handle,
00070                                               dwc_otg_hcd_urb_t * dwc_otg_urb,
00071                                               int32_t status);
00072 
00074 typedef int (*dwc_otg_hcd_get_b_hnp_enable) (dwc_otg_hcd_t * hcd);
00075 
00076 struct dwc_otg_hcd_function_ops {
00077         dwc_otg_hcd_start_cb_t start;
00078         dwc_otg_hcd_disconnect_cb_t disconnect;
00079         dwc_otg_hcd_hub_info_from_urb_cb_t hub_info;
00080         dwc_otg_hcd_speed_from_urb_cb_t speed;
00081         dwc_otg_hcd_complete_urb_cb_t complete;
00082         dwc_otg_hcd_get_b_hnp_enable get_b_hnp_enable;
00083 };
00089 extern dwc_otg_hcd_t *dwc_otg_hcd_alloc_hcd(void);
00090 
00099 extern int dwc_otg_hcd_init(dwc_otg_hcd_t * hcd, dwc_otg_core_if_t * core_if);
00100 
00105 extern void dwc_otg_hcd_remove(dwc_otg_hcd_t * hcd);
00106 
00114 extern int32_t dwc_otg_hcd_handle_intr(dwc_otg_hcd_t * dwc_otg_hcd);
00115 
00122 extern void *dwc_otg_hcd_get_priv_data(dwc_otg_hcd_t * hcd);
00123 
00130 extern void dwc_otg_hcd_set_priv_data(dwc_otg_hcd_t * hcd, void *priv_data);
00131 
00141 extern int dwc_otg_hcd_start(dwc_otg_hcd_t * hcd,
00142                              struct dwc_otg_hcd_function_ops *fops);
00143 
00150 extern void dwc_otg_hcd_stop(dwc_otg_hcd_t * hcd);
00151 
00165 extern int dwc_otg_hcd_hub_control(dwc_otg_hcd_t * dwc_otg_hcd,
00166                                    uint16_t typeReq, uint16_t wValue,
00167                                    uint16_t wIndex, uint8_t * buf,
00168                                    uint16_t wLength);
00169 
00175 extern uint32_t dwc_otg_hcd_otg_port(dwc_otg_hcd_t * hcd);
00176 
00182 extern uint32_t dwc_otg_hcd_is_b_host(dwc_otg_hcd_t * hcd);
00183 
00189 extern int dwc_otg_hcd_get_frame_number(dwc_otg_hcd_t * hcd);
00190 
00196 extern void dwc_otg_hcd_dump_state(dwc_otg_hcd_t * hcd);
00197 
00206 extern void dwc_otg_hcd_dump_frrem(dwc_otg_hcd_t * hcd);
00207 
00219 extern int dwc_otg_hcd_send_lpm(dwc_otg_hcd_t * hcd, uint8_t devaddr,
00220                                 uint8_t hird, uint8_t bRemoteWake);
00221 
00222 /* URB interface */
00223 
00232 extern dwc_otg_hcd_urb_t *dwc_otg_hcd_urb_alloc(dwc_otg_hcd_t * hcd,
00233                                                 int iso_desc_count,
00234                                                 int atomic_alloc);
00235 
00246 extern void dwc_otg_hcd_urb_set_pipeinfo(dwc_otg_hcd_urb_t * hcd_urb,
00247                                          uint8_t devaddr, uint8_t ep_num,
00248                                          uint8_t ep_type, uint8_t ep_dir,
00249                                          uint16_t mps);
00250 
00251 /* Transfer flags */ 
00252 #define URB_GIVEBACK_ASAP 0x1
00253 #define URB_SEND_ZERO_PACKET 0x2
00254 
00269 extern void dwc_otg_hcd_urb_set_params(dwc_otg_hcd_urb_t * urb,
00270                                        void *urb_handle, void *buf,
00271                                        dwc_dma_t dma, uint32_t buflen, void *sp,
00272                                        dwc_dma_t sp_dma, uint32_t flags,
00273                                        uint16_t interval);
00274 
00279 extern uint32_t dwc_otg_hcd_urb_get_status(dwc_otg_hcd_urb_t * dwc_otg_urb);
00280 
00285 extern uint32_t dwc_otg_hcd_urb_get_actual_length(dwc_otg_hcd_urb_t *
00286                                                   dwc_otg_urb);
00287 
00292 extern uint32_t dwc_otg_hcd_urb_get_error_count(dwc_otg_hcd_urb_t *
00293                                                 dwc_otg_urb);
00294 
00302 extern void dwc_otg_hcd_urb_set_iso_desc_params(dwc_otg_hcd_urb_t * dwc_otg_urb,
00303                                                 int desc_num, uint32_t offset,
00304                                                 uint32_t length);
00305 
00311 extern uint32_t dwc_otg_hcd_urb_get_iso_desc_status(dwc_otg_hcd_urb_t *
00312                                                     dwc_otg_urb, int desc_num);
00313 
00319 extern uint32_t dwc_otg_hcd_urb_get_iso_desc_actual_length(dwc_otg_hcd_urb_t *
00320                                                            dwc_otg_urb,
00321                                                            int desc_num);
00322 
00333 extern int dwc_otg_hcd_urb_enqueue(dwc_otg_hcd_t * dwc_otg_hcd,
00334                                    dwc_otg_hcd_urb_t * dwc_otg_urb,
00335                                    void **ep_handle);
00336 
00342 extern int dwc_otg_hcd_urb_dequeue(dwc_otg_hcd_t * dwc_otg_hcd,
00343                                    dwc_otg_hcd_urb_t * dwc_otg_urb);
00344 
00355 extern int dwc_otg_hcd_endpoint_disable(dwc_otg_hcd_t * hcd, void *ep_handle,
00356                                         int retry);
00357 
00363 extern int dwc_otg_hcd_is_status_changed(dwc_otg_hcd_t * hcd, int port);
00364 
00371 extern int dwc_otg_hcd_is_bandwidth_allocated(dwc_otg_hcd_t * hcd,
00372                                               void *ep_handle);
00373 
00379 extern int dwc_otg_hcd_is_bandwidth_freed(dwc_otg_hcd_t * hcd, void *ep_handle);
00380 
00387 extern uint8_t dwc_otg_hcd_get_ep_bandwidth(dwc_otg_hcd_t * hcd,
00388                                             void *ep_handle);
00389 
00392 #endif                          /* __DWC_HCD_IF_H__ */
00393 #endif                          /* DWC_DEVICE_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