#include <stdint.h>
#include <stdbool.h>
#include <kernel/list.h>
Go to the source code of this file.
Data Structures | |
struct | usb_iface |
struct | usb_host |
struct | usb_class |
struct | usb_endpoint |
struct | usb_dev |
struct | usb_setup_pkt |
Defines | |
#define | USB_HOST_ERR_NONE 0 |
#define | USB_HOST_ERR_BITSTUFF 1 |
#define | USB_HOST_ERR_TIMEOUT 2 |
#define | USB_HOST_ERR_NAK 3 |
#define | USB_HOST_ERR_BABBLE 4 |
#define | USB_HOST_ERR_BUFFER 5 |
#define | USB_HOST_ERR_STALL 6 |
#define | USB_HOST_ERR_NODEV 7 |
#define | make_usb_pid(x) ((x) | ((~(x)) << 4)) |
#define | USB_PID_OUT make_usb_pid(1) |
#define | USB_PID_IN make_usb_pid(9) |
#define | USB_PID_SOF make_usb_pid(5) |
#define | USB_PID_SETUP make_usb_pid(13) |
#define | USB_PID_DATA0 make_usb_pid(3) |
#define | USB_PID_DATA1 make_usb_pid(11) |
#define | USB_PID_DATA2 make_usb_pid(7) |
#define | USB_PID_MDATA make_usb_pid(15) |
#define | USB_PID_ACK make_usb_pid(2) |
#define | USB_PID_NAK make_usb_pid(10) |
#define | USB_PID_STALL make_usb_pid(14) |
#define | USB_PID_NYET make_usb_pid(6) |
#define | USB_PID_PRE make_usb_pid(12) |
#define | USB_PID_ERR make_usb_pid(12) |
#define | USB_PID_SPLIT make_usb_pid(8) |
#define | USB_PID_PING make_usb_pid(4) |
#define | REQ_STD_GET_STATUS 0 |
#define | REQ_STD_CLR_FEAT 1 |
#define | REQ_STD_SET_FEAT 3 |
#define | REQ_STD_SET_ADDRESS 5 |
#define | REQ_STD_GET_DESC 6 |
#define | REQ_STD_SET_DESC 7 |
#define | REQ_STD_GET_CONFIG 8 |
#define | REQ_STD_SET_CONFIG 9 |
#define | REQ_STD_GET_IFACE 10 |
#define | REQ_STD_SET_IFACE 11 |
#define | REQ_STD_SYNCH_FRAME 12 |
#define | USB_TOKEN_SETUP 0x00 |
#define | USB_TOKEN_IN 0x80 |
#define | USB_TOKEN_OUT 0x90 |
#define | USB_SPEED_1 0 |
#define | USB_SPEED_1_1 1 |
#define | USB_SPEED_2 2 |
#define | USB_VERSION_1_0 0x100 |
#define | USB_VERSION_1_1 0x110 |
#define | USB_VERSION_2 0x200 |
#define | USB_EOP_ATTR_CTL 0 |
#define | USB_EOP_ATTR_ISO 1 |
#define | USB_EOP_ATTR_BULK 2 |
#define | USB_EOP_ATTR_INT 3 |
#define | USB_SETUP_TYPE_STD 0 |
#define | USB_SETUP_TYPE_CLASS 1 |
#define | USB_SETUP_TYPE_VENDOR 2 |
#define | USB_SETUP_RECIP_DEV 0 |
#define | USB_SETUP_RECIP_IFACE 1 |
#define | USB_SETUP_RECIP_ENDPT 2 |
#define | USB_SETUP_RECIP_OTHER 3 |
Typedefs | |
typedef void * | host_info |
typedef void * | host_eop_info |
typedef void * | host_dev_info |
typedef void * | class_info |
Functions | |
void | usb_init (void) |
void | usb_storage_init (void) |
void | usb_register_host (struct usb_host *, host_info info) |
int | usb_unregister_host (struct usb_host *, host_info info) |
int | usb_register_class (struct usb_class *) |
int | usb_unregister_class (struct usb_class *) |
int | usb_dev_bulk (struct usb_endpoint *eop, void *buf, int sz, int *tx) |
int | usb_dev_setup (struct usb_endpoint *eop, bool in, struct usb_setup_pkt *s, void *buf, int sz) |
int | usb_dev_wait_int (struct usb_dev *) |
#define REQ_STD_CLR_FEAT 1 |
#define REQ_STD_GET_DESC 6 |
Definition at line 46 of file usb.h.
Referenced by usb_configure_default(), usb_get_string(), and usb_load_config().
#define REQ_STD_SET_ADDRESS 5 |
#define REQ_STD_SET_CONFIG 9 |
#define USB_EOP_ATTR_BULK 2 |
#define USB_HOST_ERR_BABBLE 4 |
#define USB_HOST_ERR_BITSTUFF 1 |
#define USB_HOST_ERR_BUFFER 5 |
#define USB_HOST_ERR_NAK 3 |
#define USB_HOST_ERR_NODEV 7 |
#define USB_HOST_ERR_NONE 0 |
Definition at line 9 of file usb.h.
Referenced by uhci_tx_pkt_bulk(), uhci_tx_pkt_now(), uhci_tx_pkt_wait(), usb_config_dev(), usb_configure_default(), usb_dev_setup(), usb_get_string(), usb_load_config(), usb_setup_dev_addr(), and usb_tx_all().
#define USB_HOST_ERR_STALL 6 |
#define USB_HOST_ERR_TIMEOUT 2 |
#define USB_PID_IN make_usb_pid(9) |
#define USB_PID_OUT make_usb_pid(1) |
#define USB_PID_SETUP make_usb_pid(13) |
#define USB_SETUP_RECIP_DEV 0 |
Definition at line 170 of file usb.h.
Referenced by msc_bulk_reset(), usb_config_dev(), usb_configure_default(), usb_get_string(), usb_load_config(), and usb_setup_dev_addr().
#define USB_SETUP_RECIP_ENDPT 2 |
#define USB_SETUP_TYPE_CLASS 1 |
#define USB_SETUP_TYPE_STD 0 |
Definition at line 166 of file usb.h.
Referenced by msc_reset_endpoint(), usb_config_dev(), usb_configure_default(), usb_get_string(), usb_load_config(), and usb_setup_dev_addr().
#define USB_TOKEN_IN 0x80 |
Definition at line 56 of file usb.h.
Referenced by token_to_pid(), uhci_tx_pkt_wait(), usb_config_dev(), usb_configure_default(), usb_dev_bulk(), usb_dev_setup(), usb_setup_dev_addr(), and usb_tx_all().
#define USB_TOKEN_OUT 0x90 |
Definition at line 57 of file usb.h.
Referenced by send_status(), token_to_pid(), uhci_tx_pkt_wait(), usb_dev_bulk(), usb_dev_setup(), and usb_tx_all().
#define USB_TOKEN_SETUP 0x00 |
Definition at line 55 of file usb.h.
Referenced by token_to_pid(), uhci_tx_pkt(), uhci_tx_pkt_wait(), usb_config_dev(), usb_configure_default(), usb_dev_setup(), usb_get_string(), usb_load_config(), and usb_setup_dev_addr().
#define USB_VERSION_1_0 0x100 |
Definition at line 119 of file usb.h.
Referenced by uhci_create_chan(), uhci_modify_chan(), and usb_configure_default().
#define USB_VERSION_1_1 0x110 |
typedef void* class_info |
typedef void* host_dev_info |
typedef void* host_eop_info |
int usb_dev_bulk | ( | struct usb_endpoint * | eop, | |
void * | buf, | |||
int | sz, | |||
int * | tx | |||
) |
Definition at line 724 of file usb.c.
References ASSERT, host::dev, usb_iface::dev, usb_endpoint::direction, usb_endpoint::h_eop, usb_dev::host, usb_endpoint::iface, NULL, usb_host::tx_pkt, USB_TOKEN_IN, and USB_TOKEN_OUT.
Referenced by msc_get_geometry(), and msc_io().
int usb_dev_setup | ( | struct usb_endpoint * | eop, | |
bool | in, | |||
struct usb_setup_pkt * | s, | |||
void * | buf, | |||
int | sz | |||
) |
Definition at line 744 of file usb.c.
References ASSERT, host::dev, usb_iface::dev, usb_endpoint::h_eop, usb_dev::host, usb_endpoint::iface, NULL, printf(), usb_host::tx_pkt, USB_HOST_ERR_NONE, USB_TOKEN_IN, USB_TOKEN_OUT, and USB_TOKEN_SETUP.
Referenced by msc_bulk_reset(), and msc_reset_endpoint().
int usb_dev_wait_int | ( | struct usb_dev * | ) |
void usb_init | ( | void | ) |
Definition at line 153 of file usb.c.
References class_list, ehci_init(), host_list, list_init(), lock_init(), printf(), uhci_init(), usb_dev_list, usb_hub_init(), and usb_sys_lock.
Referenced by main().
int usb_register_class | ( | struct usb_class * | ) |
Definition at line 189 of file usb.c.
References usb_class::class_id, class_list, class::dev, list_init(), list_push_back(), malloc(), NULL, class::peers, usb_apply_class_to_interfaces(), usb_get_class_by_id(), class::usb_ifaces, usb_lock, and usb_unlock.
Referenced by usb_hub_init(), and usb_storage_init().
Definition at line 171 of file usb.c.
References ADDRS_PER_HOST, bitmap_create(), host::dev, host_list, host::host_usb_devs, host::info, list_init(), list_push_back(), malloc(), host::peers, host::usb_dev_addrs, usb_lock, usb_scan_devices(), and usb_unlock.
Referenced by uhci_init().
void usb_storage_init | ( | void | ) |
Definition at line 177 of file usb_storage.c.
References device_list, list_init(), and usb_register_class().
Referenced by main().
int usb_unregister_class | ( | struct usb_class * | ) |