Turnstone Operating System
Loading...
Searching...
No Matches
usb.h File Reference

USB driver header file. More...

#include <types.h>
#include <pci.h>
#include <future.h>

Classes

union  usb_legacy_support_capabilities_t
 
union  usb_legacy_support_status_t
 
struct  usb_device_desc_t
 
struct  usb_config_desc_t
 
struct  usb_interface_desc_t
 
struct  usb_endpoint_desc_t
 
struct  usb_hub_desc_t
 
struct  usb_hid_desc_t
 
struct  usb_string_desc_t
 
struct  usb_device_request_t
 
struct  usb_endpoint_t
 
struct  usb_transfer_t
 
struct  usb_controller_t
 
struct  usb_config_t
 
struct  usb_device_t
 

Macros

#define USB_EHCI   0x20
 
#define USB_XHCI   0x30
 

Typedefs

typedef enum usb_endpoint_speed_t usb_endpoint_speed_t
 
typedef union usb_legacy_support_capabilities_t usb_legacy_support_capabilities_t
 
typedef union usb_legacy_support_status_t usb_legacy_support_status_t
 
typedef enum usb_controler_type_t usb_controler_type_t
 
typedef struct usb_controller_metadata_t usb_controller_metadata_t
 
typedef enum usb_base_desc_type_t usb_base_desc_type_t
 
typedef enum usb_hid_desc_type_t usb_hid_desc_type_t
 
typedef enum usb_hub_desc_type_t usb_hub_desc_type_t
 
typedef enum usb_hub_characteristic_t usb_hub_characteristic_t
 
typedef struct usb_device_desc_t usb_device_desc_t
 
typedef struct usb_config_desc_t usb_config_desc_t
 
typedef struct usb_interface_desc_t usb_interface_desc_t
 
typedef struct usb_endpoint_desc_t usb_endpoint_desc_t
 
typedef struct usb_hub_desc_t usb_hub_desc_t
 
typedef struct usb_hid_desc_t usb_hid_desc_t
 
typedef struct usb_string_desc_t usb_string_desc_t
 
typedef enum usb_request_type_t usb_request_type_t
 
typedef enum usb_request_recipient_t usb_request_recipient_t
 
typedef enum usb_request_device_t usb_request_device_t
 
typedef enum usb_request_direction_t usb_request_direction_t
 
typedef enum usb_request_hub_t usb_request_hub_t
 
typedef enum usb_request_interface_t usb_request_interface_t
 
typedef enum usb_standart_feature_selector_t usb_standart_feature_selector_t
 
typedef enum usb_hub_feature_selector_t usb_hub_feature_selector_t
 
typedef struct usb_device_request_t usb_device_request_t
 
typedef struct usb_endpoint_t usb_endpoint_t
 
typedef struct usb_device_t usb_device_t
 
typedef struct usb_controller_t usb_controller_t
 
typedef struct usb_transfer_t usb_transfer_t
 
typedef struct usb_driver_t usb_driver_t
 
typedef struct usb_config_t usb_config_t
 
typedef enum usb_class_t usb_interface_class_t
 
typedef enum usb_subclass_hid_t usb_interface_subclass_hid_t
 
typedef enum usb_subclass_mass_storage_t usb_interface_subclass_mass_storage_t
 
typedef enum usb_protocol_hid_t usb_interface_protocol_hid_t
 
typedef enum usb_protocol_mass_storage_t usb_interface_protocol_mass_storage_t
 

Enumerations

enum  usb_endpoint_speed_t { USB_ENDPOINT_SPEED_FULL = 0 , USB_ENDPOINT_SPEED_LOW = 1 , USB_ENDPOINT_SPEED_HIGH = 2 }
 
enum  usb_controler_type_t { USB_CONTROLLER_TYPE_EHCI = 0x20 , USB_CONTROLLER_TYPE_XHCI = 0x30 }
 
enum  usb_base_desc_type_t {
  USB_BASE_DESC_TYPE_DEVICE = 0x01 , USB_BASE_DESC_TYPE_CONFIG = 0x02 , USB_BASE_DESC_TYPE_STRING = 0x03 , USB_BASE_DESC_TYPE_INTERFACE = 0x04 ,
  USB_BASE_DESC_TYPE_ENDPOINT = 0x05
}
 
enum  usb_hid_desc_type_t { USB_HID_DESC_TYPE_HID = 0x21 , USB_HID_DESC_TYPE_REPORT = 0x22 , USB_HID_DESC_TYPE_PHYSICAL = 0x23 }
 
enum  usb_hub_desc_type_t { USB_HUB_DESC_TYPE_HUB = 0x29 }
 
enum  usb_hub_characteristic_t {
  USB_HUB_CHARACTERISTIC_POWER_MASK = 0x03 , USB_HUB_CHARACTERISTIC_GLOBAL = 0x00 , USB_HUB_CHARACTERISTIC_INDIVIDUAL = 0x01 , USB_HUB_CHARACTERISTIC_COMPOUND = 0x04 ,
  USB_HUB_CHARACTERISTIC_OVERCURRENT_MASK = 0x18 , USB_HUB_CHARACTERISTIC_TT_TTI_MASK = 0x60 , USB_HUB_CHARACTERISTIC_PORT_INDICATOR = 0x80
}
 
enum  usb_request_type_t { USB_REQUEST_TYPE_STANDARD = 0x00 , USB_REQUEST_TYPE_CLASS = 0x20 , USB_REQUEST_TYPE_VENDOR = 0x40 , USB_REQUEST_TYPE_MASK = 0x60 }
 
enum  usb_request_recipient_t {
  USB_REQUEST_RECIPIENT_DEVICE = 0x00 , USB_REQUEST_RECIPIENT_INTERFACE = 0x01 , USB_REQUEST_RECIPIENT_ENDPOINT = 0x02 , USB_REQUEST_RECIPIENT_OTHER = 0x03 ,
  USB_REQUEST_RECIPIENT_MASK = 0x1F
}
 
enum  usb_request_device_t {
  USB_REQUEST_GET_STATUS = 0x00 , USB_REQUEST_CLEAR_FEATURE = 0x01 , USB_REQUEST_SET_FEATURE = 0x03 , USB_REQUEST_SET_ADDRESS = 0x05 ,
  USB_REQUEST_GET_DESCRIPTOR = 0x06 , USB_REQUEST_SET_DESCRIPTOR = 0x07 , USB_REQUEST_GET_CONFIGURATION = 0x08 , USB_REQUEST_SET_CONFIGURATION = 0x09 ,
  USB_REQUEST_GET_INTERFACE = 0x0A , USB_REQUEST_SET_INTERFACE = 0x0B , USB_REQUEST_SYNCH_FRAME = 0x0C
}
 
enum  usb_request_direction_t { USB_REQUEST_DIRECTION_HOST_TO_DEVICE = 0x00 , USB_REQUEST_DIRECTION_DEVICE_TO_HOST = 0x80 }
 
enum  usb_request_hub_t { USB_REQUEST_CLEAR_TT_BUFFER = 0x08 , USB_REQUEST_RESET_TT = 0x09 , USB_REQUEST_GET_TT_STATE = 0x0A , USB_REQUEST_STOP_TT = 0x0B }
 
enum  usb_request_interface_t {
  USB_REQUEST_GET_REPORT = 0x01 , USB_REQUEST_GET_IDLE = 0x02 , USB_REQUEST_GET_PROTOCOL = 0x03 , USB_REQUEST_SET_REPORT = 0x09 ,
  USB_REQUEST_SET_IDLE = 0x0A , USB_REQUEST_SET_PROTOCOL = 0x0B
}
 
enum  usb_standart_feature_selector_t { USB_FEATURE_DEVICE_REMOTE_WAKEUP = 0x01 , USB_FEATURE_ENDPOINT_HALT = 0x00 , USB_FEATURE_TEST_MODE = 0x02 }
 
enum  usb_hub_feature_selector_t {
  USB_FEATURE_C_HUB_LOCAL_POWER = 0x00 , USB_FEATURE_C_HUB_OVER_CURRENT = 0x01 , USB_FEATURE_PORT_CONNECTION = 0x00 , USB_FEATURE_PORT_ENABLE = 0x01 ,
  USB_FEATURE_PORT_SUSPEND = 0x02 , USB_FEATURE_PORT_OVER_CURRENT = 0x03 , USB_FEATURE_PORT_RESET = 0x04 , USB_FEATURE_PORT_POWER = 0x08 ,
  USB_FEATURE_PORT_LOW_SPEED = 0x09 , USB_FEATURE_C_PORT_CONNECTION = 0x10 , USB_FEATURE_C_PORT_ENABLE = 0x11 , USB_FEATURE_C_PORT_SUSPEND = 0x12 ,
  USB_FEATURE_C_PORT_OVER_CURRENT = 0x13 , USB_FEATURE_C_PORT_RESET = 0x14 , USB_FEATURE_PORT_TEST = 0x15 , USB_FEATURE_PORT_INDICATOR = 0x16
}
 
enum  usb_class_t {
  USB_CLASS_AUDIO = 0x01 , USB_CLASS_COMMUNICATIONS_AND_CDC_CONTROL = 0x02 , USB_CLASS_HID = 0x03 , USB_CLASS_PHYSICAL = 0x05 ,
  USB_CLASS_IMAGE = 0x06 , USB_CLASS_PRINTER = 0x07 , USB_CLASS_MASS_STORAGE = 0x08 , USB_CLASS_HUB = 0x09 ,
  USB_CLASS_CDC_DATA = 0x0A , USB_CLASS_SMART_CARD = 0x0B , USB_CLASS_CONTENT_SECURITY = 0x0D , USB_CLASS_VIDEO = 0x0E ,
  USB_CLASS_PERSONAL_HEALTHCARE = 0x0F , USB_CLASS_AUDIO_VIDEO = 0x10 , USB_CLASS_BILLBOARD = 0x11 , USB_CLASS_DIAGNOSTIC_DEVICE = 0xDC ,
  USB_CLASS_WIRELESS_CONTROLLER = 0xE0 , USB_CLASS_MISCELLANEOUS = 0xEF , USB_CLASS_APPLICATION_SPECIFIC = 0xFE , USB_CLASS_VENDOR_SPECIFIC = 0xFF
}
 
enum  usb_subclass_hid_t { USB_SUBCLASS_HID_NO_SUBCLASS = 0x00 , USB_SUBCLASS_HID_BOOT_INTERFACE_SUBCLASS = 0x01 }
 
enum  usb_subclass_mass_storage_t {
  USB_SUBCLASS_MASS_STORAGE_SCSI = 0x06 , USB_SUBCLASS_MASS_STORAGE_UFI = 0x04 , USB_SUBCLASS_MASS_STORAGE_SFF_8070I = 0x05 , USB_SUBCLASS_MASS_STORAGE_SCSI_TRANSPARENT_COMMAND_SET = 0x06 ,
  USB_SUBCLASS_MASS_STORAGE_LSDFS = 0x07 , USB_SUBCLASS_MASS_STORAGE_IEEE1667 = 0x08 , USB_SUBCLASS_MASS_STORAGE_VENDOR_SPECIFIC = 0xFF
}
 
enum  usb_protocol_hid_t { USB_PROTOCOL_HID_NO_PROTOCOL = 0x00 , USB_PROTOCOL_HID_KEYBOARD = 0x01 , USB_PROTOCOL_HID_MOUSE = 0x02 }
 
enum  usb_protocol_mass_storage_t { USB_PROTOCOL_MASS_STORAGE_CBI = 0x00 , USB_PROTOCOL_MASS_STORAGE_CBI_NO_INTERRUPT = 0x01 , USB_PROTOCOL_MASS_STORAGE_BULK_ONLY = 0x50 , USB_PROTOCOL_MASS_STORAGE_UAS = 0x62 }
 

Functions

int8_t usb_init (void)
 
int8_t usb_device_init (usb_device_t *parent, usb_controller_t *controller, uint32_t port, uint32_t speed)
 
int8_t usb_probe_all_devices_all_ports (void)
 
int8_t usb_keyboard_init (usb_device_t *device)
 
int8_t usb_mass_storage_init (usb_device_t *device)
 
boolean_t usb_device_request (usb_device_t *usb_device, usb_request_type_t request_type, usb_request_recipient_t request_recipient, usb_request_direction_t request_direction, uint32_t request, uint16_t value, uint16_t index, uint16_t length, void *data)
 

Detailed Description

USB driver header file.

This work is licensed under TURNSTONE OS Public License. Please read and understand latest version of Licence.