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

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: #12 $
00004  * $Date: 2011/10/26 $
00005  * $Change: 1873028 $
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 uint16_t dwc_otg_get_otg_version(dwc_otg_core_if_t * core_if);
00183 
00189 extern uint32_t dwc_otg_hcd_is_b_host(dwc_otg_hcd_t * hcd);
00190 
00196 extern int dwc_otg_hcd_get_frame_number(dwc_otg_hcd_t * hcd);
00197 
00203 extern void dwc_otg_hcd_dump_state(dwc_otg_hcd_t * hcd);
00204 
00213 extern void dwc_otg_hcd_dump_frrem(dwc_otg_hcd_t * hcd);
00214 
00226 extern int dwc_otg_hcd_send_lpm(dwc_otg_hcd_t * hcd, uint8_t devaddr,
00227                                 uint8_t hird, uint8_t bRemoteWake);
00228 
00229 /* URB interface */
00230 
00239 extern dwc_otg_hcd_urb_t *dwc_otg_hcd_urb_alloc(dwc_otg_hcd_t * hcd,
00240                                                 int iso_desc_count,
00241                                                 int atomic_alloc);
00242 
00253 extern void dwc_otg_hcd_urb_set_pipeinfo(dwc_otg_hcd_urb_t * hcd_urb,
00254                                          uint8_t devaddr, uint8_t ep_num,
00255                                          uint8_t ep_type, uint8_t ep_dir,
00256                                          uint16_t mps);
00257 
00258 /* Transfer flags */
00259 #define URB_GIVEBACK_ASAP 0x1
00260 #define URB_SEND_ZERO_PACKET 0x2
00261 
00276 extern void dwc_otg_hcd_urb_set_params(dwc_otg_hcd_urb_t * urb,
00277                                        void *urb_handle, void *buf,
00278                                        dwc_dma_t dma, uint32_t buflen, void *sp,
00279                                        dwc_dma_t sp_dma, uint32_t flags,
00280                                        uint16_t interval);
00281 
00286 extern uint32_t dwc_otg_hcd_urb_get_status(dwc_otg_hcd_urb_t * dwc_otg_urb);
00287 
00292 extern uint32_t dwc_otg_hcd_urb_get_actual_length(dwc_otg_hcd_urb_t *
00293                                                   dwc_otg_urb);
00294 
00299 extern uint32_t dwc_otg_hcd_urb_get_error_count(dwc_otg_hcd_urb_t *
00300                                                 dwc_otg_urb);
00301 
00309 extern void dwc_otg_hcd_urb_set_iso_desc_params(dwc_otg_hcd_urb_t * dwc_otg_urb,
00310                                                 int desc_num, uint32_t offset,
00311                                                 uint32_t length);
00312 
00318 extern uint32_t dwc_otg_hcd_urb_get_iso_desc_status(dwc_otg_hcd_urb_t *
00319                                                     dwc_otg_urb, int desc_num);
00320 
00326 extern uint32_t dwc_otg_hcd_urb_get_iso_desc_actual_length(dwc_otg_hcd_urb_t *
00327                                                            dwc_otg_urb,
00328                                                            int desc_num);
00329 
00341 extern int dwc_otg_hcd_urb_enqueue(dwc_otg_hcd_t * dwc_otg_hcd,
00342                                    dwc_otg_hcd_urb_t * dwc_otg_urb,
00343                                    void **ep_handle, int atomic_alloc);
00344 
00350 extern int dwc_otg_hcd_urb_dequeue(dwc_otg_hcd_t * dwc_otg_hcd,
00351                                    dwc_otg_hcd_urb_t * dwc_otg_urb);
00352 
00363 extern int dwc_otg_hcd_endpoint_disable(dwc_otg_hcd_t * hcd, void *ep_handle,
00364                                         int retry);
00365 
00366 /* Resets the data toggle in qh structure. This function can be called from
00367  * usb_clear_halt routine.
00368  *
00369  * @param hcd The HCD
00370  * @param ep_handle Endpoint handle, returned by dwc_otg_hcd_urb_enqueue function
00371  *
00372  * Returns -DWC_E_INVALID if invalid arguments are passed.
00373  * Returns 0 on success
00374  */
00375 extern int dwc_otg_hcd_endpoint_reset(dwc_otg_hcd_t * hcd, void *ep_handle);
00376 
00382 extern int dwc_otg_hcd_is_status_changed(dwc_otg_hcd_t * hcd, int port);
00383 
00390 extern int dwc_otg_hcd_is_bandwidth_allocated(dwc_otg_hcd_t * hcd,
00391                                               void *ep_handle);
00392 
00398 extern int dwc_otg_hcd_is_bandwidth_freed(dwc_otg_hcd_t * hcd, void *ep_handle);
00399 
00406 extern uint8_t dwc_otg_hcd_get_ep_bandwidth(dwc_otg_hcd_t * hcd,
00407                                             void *ep_handle);
00408 
00411 #endif /* __DWC_HCD_IF_H__ */
00412 #endif /* DWC_DEVICE_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