usbdbus(7)

SYNPOSIS

#include "usbd.h"
#include "usbd-bus.h"

DESCRIPTION

This man page documents the interface that the USB Bus Interface Driver uses to connect to the USB Device core layer.

In the USB Device Architecture the Bus Interface Driver implements the actual interface to a specific USB Bus Interface device.

Specifically the bottom layer of the Bus Interface Driver implements access the local hardware. It encapsulates the data given it and sends it to the USB host Class Driver via the USB bus.

Similarily data received from USB host is given to the user of the device.

The main interface to the USB Device core layer is through two routines:

    usbd_register_bus(struct *usb_bus_driver)

    usbd_deregister_bus(struct *usb_bus_driver)

    usbd_register_device(struct *usb_bus_driver)

    usbd_deregister_device(struct *usb_bus_driver)

These pass a pointer to a struct usb_function_driver.

This structure contains information required by the USB Device core layer to use the Bus Interface device.

    struct usb_bus_driver {
        char               *name;
        unsigned char       max_endpoints;          // maximimum number of rx enpoints
        unsigned char       maxpacketsize;
        struct usb_device_description *device_description;
        struct usb_bus_operations *ops;
        struct module       *this_module;                   // manage inc use counts to prevent unload races
    };

    ops
         this is a list of C functions this module implements to perform the operations required by the USB Device core layer.

    name

    max_endpoints

    maxpacketsize

The usb_function_operations structure is used to pass pointers to the functions implemented by the Function driver.

    struct usb_bus_operations {
        int (* send_urb) (struct urb *);
        int (* cancel_urb) (struct urb *);
        int (* endpoint_halted)(struct usb_device_instance *, int);
        int (* device_feature)(struct usb_device_instance *, int, int);
        int (* device_event)(struct usb_device_instance *, usb_device_event_t );
    };

    device event
        This function is called by the USB Device core layer to pass various events to the Bus Interface driver. These match the changes defined in the state diagram defined in chapter 9 USB Device Framework, section 9.1.1, in the USB specification. The events are passed through a task queue. This means that these functions are not executing in an interrupt context and may call other kernel functions that may sleep.

    send_urb
        The Function driver sends data in a structure called an urb using a function called usbd_send_urb(). When the urb has been sent the USB Device core layer will call the urb_sent function to notify the Function driver that it has finished sending the data or has stopped attempting to send the data.

    cancel_urb

    endpoint_halted

    device_feature

EXAMPLES

BUGS

AUTHOR

Stuart Lynne <sl@lineo.com>

Bruce Balden <balden@lineo.com>

Tom Rushworth <tbr@lineo.com>

SEE ALSO

usbd(7), usbdfunc(7)

Universal Serial Bus Specification, Revision 2.0

Universal Serial Bus Class Definitions for Communications Devices, Version 1.1