UHCI root hub driver
[UHCI driver]

Driver for UHCI complaint root hub. More...


Files

file  main.c
 UHCI root hub initialization routines.
file  port.c
 UHCI root hub port routines.
file  port.h
 UHCI root hub port routines.
file  root_hub.c
 UHCI root hub driver.
file  root_hub.h
 UHCI driver.

Data Structures

struct  root_hub
 UHCI root hub drvier structure. More...
struct  uhci_port
 UHCI port structure. More...

Defines

#define NAME   "uhci-rhd"
#define ROOT_HUB_WAIT_USEC   250000
#define STATUS_ALWAYS_ONE   (1 << 7)
#define STATUS_CONNECTED   (1 << 0)
#define STATUS_CONNECTED_CHANGED   (1 << 1)
#define STATUS_ENABLED   (1 << 2)
#define STATUS_ENABLED_CHANGED   (1 << 3)
#define STATUS_IN_RESET   (1 << 9)
#define STATUS_LINE_D_MINUS   (1 << 5)
#define STATUS_LINE_D_PLUS   (1 << 4)
#define STATUS_LOW_SPEED   (1 << 8)
#define STATUS_RESUME   (1 << 6)
#define STATUS_SUSPEND   (1 << 12)
#define UHCI_ROOT_HUB_PORT_COUNT   2

Typedefs

typedef uint16_t port_status_t
typedef uhci_port uhci_port_t
 UHCI port structure.
typedef root_hub uhci_root_hub_t
 UHCI root hub drvier structure.

Functions

static int hc_get_my_registers (const ddf_dev_t *dev, uintptr_t *io_reg_address, size_t *io_reg_size)
 Get address of I/O registers.
int main (int argc, char *argv[])
 Main entry point.
static int uhci_port_check (void *port)
 Periodically checks port status and reports new devices.
void uhci_port_fini (uhci_port_t *port)
 Cleanup UHCI root hub port instance.
int uhci_port_init (uhci_port_t *port, port_status_t *address, unsigned number, unsigned usec, ddf_dev_t *rh)
 Initialize UHCI root hub port instance.
static int uhci_port_new_device (uhci_port_t *port, usb_speed_t speed)
 Initialize and report connected device.
static void uhci_port_print_status (uhci_port_t *port, const port_status_t value)
 Print the port status value in a human friendly way.
static port_status_t uhci_port_read_status (uhci_port_t *port)
 Register reading helper function.
static int uhci_port_remove_device (uhci_port_t *port)
 Remove device.
static int uhci_port_reset_enable (int portno, void *arg)
 Callback for enabling port during adding a new device.
static int uhci_port_set_enabled (uhci_port_t *port, bool enabled)
 Enable or disable root hub port.
static void uhci_port_write_status (uhci_port_t *port, port_status_t val)
 Register writing helper function.
static int uhci_rh_add_device (ddf_dev_t *device)
 Initialize a new ddf driver instance of UHCI root hub.
void uhci_root_hub_fini (uhci_root_hub_t *instance)
 Cleanup UHCI root hub instance.
int uhci_root_hub_init (uhci_root_hub_t *instance, void *addr, size_t size, ddf_dev_t *rh)
 Initialize UHCI root hub instance.

Variables

static driver_t uhci_rh_driver
static driver_ops_t uhci_rh_driver_ops

Detailed Description

Driver for UHCI complaint root hub.


Function Documentation

int hc_get_my_registers ( const ddf_dev_t dev,
uintptr_t io_reg_address,
size_t io_reg_size 
) [static]

Get address of I/O registers.

Parameters:
[in] dev Device asking for the addresses.
[out] io_reg_address Base address of the memory range.
[out] io_reg_size Size of the memory range.
Returns:
Error code.

Definition at line 132 of file main.c.

int main ( int  argc,
char *  argv[] 
)

Main entry point.

Parameters:
[in] argc Nmber of arguments in argv vector (ignored).
[in] argv Cmdline argument vector (ignored).
Returns:
Error code.
Driver debug level is set here.

Definition at line 70 of file main.c.

int uhci_port_check ( void *  port  )  [static]

Periodically checks port status and reports new devices.

Parameters:
[in] port Port structure to use.
Returns:
Error code.

Definition at line 147 of file port.c.

void uhci_port_fini ( uhci_port_t port  ) 

Cleanup UHCI root hub port instance.

Parameters:
[in] port Memory structure to use.
Stops the polling fibril.

Definition at line 134 of file port.c.

int uhci_port_init ( uhci_port_t port,
port_status_t address,
unsigned  number,
unsigned  usec,
ddf_dev_t rh 
)

Initialize UHCI root hub port instance.

Parameters:
[in] port Memory structure to use.
[in] address Address of I/O register.
[in] number Port number.
[in] usec Polling interval.
[in] rh Pointer to ddf instance of the root hub driver.
Returns:
Error code.
Creates and starts the polling fibril.

Definition at line 88 of file port.c.

int uhci_port_new_device ( uhci_port_t port,
usb_speed_t  speed 
) [static]

Initialize and report connected device.

Parameters:
[in] port Port structure to use.
[in] speed Detected speed.
Returns:
Error code.
Uses libUSB function to do the actual work.

Definition at line 251 of file port.c.

void uhci_port_print_status ( uhci_port_t port,
const port_status_t  value 
) [static]

Print the port status value in a human friendly way.

Parameters:
[in] port Port structure to use.
[in] value Port register value to print.
Returns:
Error code. (Always EOK)

Definition at line 335 of file port.c.

static port_status_t uhci_port_read_status ( uhci_port_t port  )  [inline, static]

Register reading helper function.

Parameters:
[in] port Structure to use.
Returns:
Error code. (Always EOK)

Definition at line 59 of file port.c.

int uhci_port_remove_device ( uhci_port_t port  )  [static]

Remove device.

Parameters:
[in] port Memory structure to use.
Returns:
Error code.
Does not work, DDF does not support device removal. Does not even free used USB address (it would be dangerous if tis driver is still running).

Definition at line 287 of file port.c.

int uhci_port_reset_enable ( int  portno,
void *  arg 
) [static]

Callback for enabling port during adding a new device.

Parameters:
portno Port number (unused).
arg Pointer to uhci_port_t of port with the new device.
Returns:
Error code.
Resets and enables the ub port.

Definition at line 214 of file port.c.

int uhci_port_set_enabled ( uhci_port_t port,
bool  enabled 
) [static]

Enable or disable root hub port.

Parameters:
[in] port Port structure to use.
[in] enabled Port status to set.
Returns:
Error code. (Always EOK)

Definition at line 301 of file port.c.

static void uhci_port_write_status ( uhci_port_t port,
port_status_t  val 
) [inline, static]

Register writing helper function.

Parameters:
[in] port Structure to use.
[in] val New register value.
Returns:
Error code. (Always EOK)

Definition at line 71 of file port.c.

static int uhci_rh_add_device ( ddf_dev_t device  )  [static]

Initialize a new ddf driver instance of UHCI root hub.

Parameters:
[in] device DDF instance of the device to initialize.
Returns:
Error code.

Definition at line 82 of file main.c.

void uhci_root_hub_fini ( uhci_root_hub_t instance  ) 

Cleanup UHCI root hub instance.

Parameters:
[in] instance Root hub structure to use.

Definition at line 86 of file root_hub.c.

int uhci_root_hub_init ( uhci_root_hub_t instance,
void *  addr,
size_t  size,
ddf_dev_t rh 
)

Initialize UHCI root hub instance.

Parameters:
[in] instance Driver memory structure to use.
[in] addr Address of I/O registers.
[in] size Size of available I/O space.
[in] rh Pointer to DDF instance of the root hub driver.
Returns:
Error code.

Definition at line 49 of file root_hub.c.


Generated on Thu Jun 2 07:45:56 2011 for HelenOS/USB by  doxygen 1.4.7