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

dwc_otg_hcd_linux.c File Reference

This file contains the implementation of the HCD. More...

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/device.h>
#include <linux/errno.h>
#include <linux/list.h>
#include <linux/interrupt.h>
#include <linux/string.h>
#include <linux/dma-mapping.h>
#include <linux/version.h>
#include <asm/io.h>
#include <linux/usb.h>
#include <linux/usb/hcd.h>
#include "dwc_otg_hcd_if.h"
#include "dwc_otg_dbg.h"
#include "dwc_otg_driver.h"
#include "dwc_otg_hcd.h"

Go to the source code of this file.

Data Structures

struct  wrapper_priv_data

Linux HC Driver API Functions

int urb_enqueue (struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flags)
 Starts processing a USB transfer request specified by a USB Request Block (URB).
int urb_dequeue (struct usb_hcd *hcd, struct urb *urb, int status)
 Aborts/cancels a USB transfer request.
void endpoint_disable (struct usb_hcd *hcd, struct usb_host_endpoint *ep)
void endpoint_reset (struct usb_hcd *hcd, struct usb_host_endpoint *ep)
irqreturn_t dwc_otg_hcd_irq (struct usb_hcd *hcd)
 Handles host mode interrupts for the DWC_otg controller.
int hcd_start (struct usb_hcd *hcd)
 Initializes the DWC_otg controller and its root hub and prepares it for host mode operation.
void hcd_stop (struct usb_hcd *hcd)
 Halts the DWC_otg host mode operations in a clean manner.
int get_frame_number (struct usb_hcd *hcd)
 Returns the current frame number.
int hub_status_data (struct usb_hcd *hcd, char *buf)
 Creates Status Change bitmap for the root hub and root port.
int hub_control (struct usb_hcd *hcd, u16 typeReq, u16 wValue, u16 wIndex, char *buf, u16 wLength)
 Handles hub class-specific requests.

Defines

#define dwc_ep_addr_to_endpoint(_bEndpointAddress_)
 Gets the endpoint number from a _bEndpointAddress argument.

Functions

dwc_otg_hcd_thcd_to_dwc_otg_hcd (struct usb_hcd *hcd)
 Gets the dwc_otg_hcd from a struct usb_hcd.
usb_hcd * dwc_otg_hcd_to_hcd (dwc_otg_hcd_t *dwc_otg_hcd)
 Gets the struct usb_hcd that contains a dwc_otg_hcd_t.
usb_host_endpoint * dwc_urb_to_endpoint (struct urb *urb)
 Gets the usb_host_endpoint associated with an URB.
int _disconnect (dwc_otg_hcd_t *hcd)
int _start (dwc_otg_hcd_t *hcd)
int _hub_info (dwc_otg_hcd_t *hcd, void *urb_handle, uint32_t *hub_addr, uint32_t *port_addr)
int _speed (dwc_otg_hcd_t *hcd, void *urb_handle)
int _get_b_hnp_enable (dwc_otg_hcd_t *hcd)
void allocate_bus_bandwidth (struct usb_hcd *hcd, uint32_t bw, struct urb *urb)
void free_bus_bandwidth (struct usb_hcd *hcd, uint32_t bw, struct urb *urb)
int _complete (dwc_otg_hcd_t *hcd, void *urb_handle, dwc_otg_hcd_urb_t *dwc_otg_urb, int32_t status)
 Sets the final status of an URB and returns it to the device driver.
int hcd_init ()
 Initializes the HCD.
void hcd_remove ()
 Removes the HCD.

Variables

const char dwc_otg_hcd_name [] = "dwc_otg_hcd"
hc_driver dwc_otg_hc_driver
dwc_otg_hcd_function_ops hcd_fops


Detailed Description

This file contains the implementation of the HCD.

In Linux, the HCD implements the hc_driver API.

Definition in file dwc_otg_hcd_linux.c.


Define Documentation

#define dwc_ep_addr_to_endpoint _bEndpointAddress_   ) 
 

Value:

((_bEndpointAddress_ & USB_ENDPOINT_NUMBER_MASK) | \
                                                     ((_bEndpointAddress_ & USB_DIR_IN) != 0) << 4)
Gets the endpoint number from a _bEndpointAddress argument.

The endpoint is qualified with its direction (possible 32 endpoints per device).

Definition at line 68 of file dwc_otg_hcd_linux.c.


Function Documentation

int urb_enqueue struct usb_hcd *  hcd,
struct urb *  urb,
gfp_t  mem_flags
[static]
 

Starts processing a USB transfer request specified by a USB Request Block (URB).

mem_flags indicates the type of memory allocation to use while processing this URB.

Definition at line 586 of file dwc_otg_hcd_linux.c.

int urb_dequeue struct usb_hcd *  hcd,
struct urb *  urb,
int  status
[static]
 

Aborts/cancels a USB transfer request.

Always returns 0 to indicate success.

Definition at line 698 of file dwc_otg_hcd_linux.c.

irqreturn_t dwc_otg_hcd_irq struct usb_hcd *  hcd  )  [static]
 

Handles host mode interrupts for the DWC_otg controller.

Returns IRQ_NONE if there was no interrupt to handle. Returns IRQ_HANDLED if there was a valid interrupt.

This function is called by the USB core when an interrupt occurs

Definition at line 791 of file dwc_otg_hcd_linux.c.

int hcd_start struct usb_hcd *  hcd  ) 
 

Initializes the DWC_otg controller and its root hub and prepares it for host mode operation.

Activates the root port. Returns 0 on success and a negative error code on failure.

Definition at line 493 of file dwc_otg_hcd_linux.c.

void hcd_stop struct usb_hcd *  hcd  ) 
 

Halts the DWC_otg host mode operations in a clean manner.

USB transfers are stopped.

Definition at line 520 of file dwc_otg_hcd_linux.c.

int hub_status_data struct usb_hcd *  hcd,
char *  buf
 

Creates Status Change bitmap for the root hub and root port.

The bitmap is returned in buf. Bit 0 is the status change indicator for the root hub. Bit 1 is the status change indicator for the single root port. Returns 1 if either change indicator is 1, otherwise returns 0.

Definition at line 805 of file dwc_otg_hcd_linux.c.

int _complete dwc_otg_hcd_t hcd,
void *  urb_handle,
dwc_otg_hcd_urb_t *  dwc_otg_urb,
int32_t  status
[static]
 

Sets the final status of an URB and returns it to the device driver.

Any required cleanup of the URB is performed.

Definition at line 230 of file dwc_otg_hcd_linux.c.

int hcd_init  ) 
 

Initializes the HCD.

This function allocates memory for and initializes the static parts of the usb_hcd and dwc_otg_hcd structures. It also registers the USB bus with the core and calls the hc_driver->start() function. It returns a negative error on failure.

Definition at line 339 of file dwc_otg_hcd_linux.c.

void hcd_remove  ) 
 

Removes the HCD.

Frees memory and resources associated with the HCD and deregisters the bus.

Definition at line 441 of file dwc_otg_hcd_linux.c.


Variable Documentation

struct hc_driver dwc_otg_hc_driver [static]
 

Initial value:

 {

        .description = dwc_otg_hcd_name,
        .product_desc = "DWC OTG Controller",
        .hcd_priv_size = sizeof(struct wrapper_priv_data),

        .irq = dwc_otg_hcd_irq,

        .flags = HCD_MEMORY | HCD_USB2,

        
        .start = hcd_start,
        
        
        .stop = hcd_stop,

        .urb_enqueue = urb_enqueue,
        .urb_dequeue = urb_dequeue,
        .endpoint_disable = endpoint_disable,

        .endpoint_reset = endpoint_reset,

        .get_frame_number = get_frame_number,

        .hub_status_data = hub_status_data,
        .hub_control = hub_control,
        
        
}

Definition at line 105 of file dwc_otg_hcd_linux.c.

struct dwc_otg_hcd_function_ops hcd_fops [static]
 

Initial value:

 {
        .start = _start,
        .disconnect = _disconnect,
        .hub_info = _hub_info,
        .speed = _speed,
        .complete = _complete,
        .get_b_hnp_enable = _get_b_hnp_enable,
}

Definition at line 324 of file dwc_otg_hcd_linux.c.


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