USB multi interface device driver
[USB]

USB multi interface device driver. More...


Files

file  dump.c
 Dumping and debugging functions.
file  explore.c
 Exploration of available interfaces in the USB device.
file  main.c
 Main routines of USB multi interface device driver.
file  usbmid.c
 Helper functions.
file  usbmid.h
 Common definitions.

Data Structures

struct  usbmid_interface_t
 Container for single interface in a MID device. More...

Defines

#define NAME   "usbmid"

Functions

static void create_interfaces (uint8_t *config_descriptor, size_t config_descriptor_size, link_t *list)
 Create list of interfaces from configuration descriptor.
static void dump_tree (usb_dp_parser_t *parser, usb_dp_parser_data_t *data)
 Dump descriptor tree.
static void dump_tree_descriptor (uint8_t *data, size_t depth)
 Dump found descriptor.
static void dump_tree_internal (usb_dp_parser_t *parser, usb_dp_parser_data_t *data, uint8_t *root, size_t depth)
 Dump tree of descriptors.
static bool interface_in_list (link_t *list, int interface_no)
 Tell whether given interface is already in the list.
int main (int argc, char *argv[])
 Main entry point.
static int usb_iface_get_address_impl (ddf_fun_t *fun, devman_handle_t handle, usb_address_t *address)
 Callback for DDF USB interface.
static int usb_iface_get_interface_impl (ddf_fun_t *fun, devman_handle_t handle, int *iface_no)
 Callback for DDF USB interface.
static int usbmid_add_device (usb_device_t *dev)
 Callback when new MID device is attached to the host.
void usbmid_dump_descriptors (uint8_t *descriptors, size_t length)
 Dump given descriptors.
bool usbmid_explore_device (usb_device_t *dev)
 Explore MID device.
int usbmid_spawn_interface_child (usb_device_t *parent, usbmid_interface_t *iface, const usb_standard_device_descriptor_t *device_descriptor, const usb_standard_interface_descriptor_t *interface_descriptor)
 Spawn new child device from one interface.

Variables

static ddf_dev_ops_t child_device_ops
 Operations for children - interface functions.
static usb_iface_t child_usb_iface
 DDF interface of the child - interface function.
static ddf_dev_ops_t mid_device_ops
 Operations of the device itself.
static usb_driver_t mid_driver
 USB MID driver.
static usb_driver_ops_t mid_driver_ops
 USB MID driver ops.

Detailed Description

USB multi interface device driver.

This driver serves as a mini hub (or bus) driver for devices that have the class defined at interface level (those devices usually have several interfaces).

The term multi interface device driver (MID) was borrowed Solaris operating system.


Function Documentation

static void create_interfaces ( uint8_t *  config_descriptor,
size_t  config_descriptor_size,
link_t list 
) [static]

Create list of interfaces from configuration descriptor.

Parameters:
config_descriptor Configuration descriptor.
config_descriptor_size Size of configuration descriptor in bytes.
list List where to add the interfaces.

Definition at line 76 of file explore.c.

static void dump_tree ( usb_dp_parser_t parser,
usb_dp_parser_data_t data 
) [static]

Dump descriptor tree.

Parameters:
parser Descriptor parser.
data Descriptor parser data.

Definition at line 92 of file dump.c.

static void dump_tree_descriptor ( uint8_t *  data,
size_t  depth 
) [static]

Dump found descriptor.

Parameters:
data Descriptor data.
depth Nesting depth.

Definition at line 49 of file dump.c.

static void dump_tree_internal ( usb_dp_parser_t parser,
usb_dp_parser_data_t data,
uint8_t *  root,
size_t  depth 
) [static]

Dump tree of descriptors.

Parameters:
parser Descriptor parser.
data Descriptor parser data.
root Pointer to current root.
depth Nesting depth.

Definition at line 73 of file dump.c.

static bool interface_in_list ( link_t list,
int  interface_no 
) [static]

Tell whether given interface is already in the list.

Parameters:
list List of usbmid_interface_t members to be searched.
interface_no Interface number caller is looking for.
Returns:
Interface interface_no is already present in the list.

Definition at line 56 of file explore.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 80 of file main.c.

static int usbmid_add_device ( usb_device_t dev  )  [static]

Callback when new MID device is attached to the host.

Parameters:
gen_dev Generic DDF device representing the new device.
Returns:
Error code.

Definition at line 51 of file main.c.

void usbmid_dump_descriptors ( uint8_t *  descriptors,
size_t  length 
)

Dump given descriptors.

Parameters:
descriptors Descriptors buffer (typically full config descriptor).
length Size of descriptors buffer in bytes.

Definition at line 103 of file dump.c.

bool usbmid_explore_device ( usb_device_t dev  ) 

Explore MID device.

We expect that dev is initialized and session on control pipe is started.

Parameters:
dev Device to be explored.
Returns:
Whether to accept this device from devman.

Definition at line 138 of file explore.c.

int usbmid_spawn_interface_child ( usb_device_t parent,
usbmid_interface_t iface,
const usb_standard_device_descriptor_t device_descriptor,
const usb_standard_interface_descriptor_t interface_descriptor 
)

Spawn new child device from one interface.

Parameters:
parent Parent MID device.
iface Interface information.
device_descriptor Device descriptor.
interface_descriptor Interface descriptor.
Returns:
Error code.

Definition at line 90 of file usbmid.c.


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