1 /* 2 * Copyright 2003-2006, Haiku Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Michael Lotz <mmlr@mlotz.ch> 7 * Niels S. Reedijk 8 */ 9 10 #ifndef _USBSPEC_PRIVATE_H 11 #define _USBSPEC_PRIVATE_H 12 13 #include <KernelExport.h> 14 #include <util/Vector.h> 15 #include <USB3.h> 16 #include <util/kernel_cpp.h> 17 18 #define USB_MAX_AREAS 8 19 #define USB_MAX_FRAGMENT_SIZE B_PAGE_SIZE * 96 20 #define USB_MAX_PORT_COUNT 16 21 22 #define USB_DELAY_BUS_RESET 100000 23 #define USB_DELAY_DEVICE_POWER_UP 300000 24 #define USB_DELAY_HUB_POWER_UP 200000 25 #define USB_DELAY_PORT_RESET 50000 26 #define USB_DELAY_PORT_RESET_RECOVERY 250000 27 #define USB_DELAY_SET_ADDRESS_RETRY 200000 28 #define USB_DELAY_SET_ADDRESS 10000 29 #define USB_DELAY_SET_CONFIGURATION 50000 30 #define USB_DELAY_HUB_EXPLORE 1000000 31 32 // For bandwidth calculation 33 #define USB_BW_HOST_DELAY 1000 34 #define USB_BW_SETUP_LOW_SPEED_PORT_DELAY 333 35 36 37 /* 38 Important data from the USB spec (not interesting for drivers) 39 */ 40 41 struct memory_chunk 42 { 43 addr_t next_item; 44 addr_t physical; 45 }; 46 47 48 struct usb_request_data 49 { 50 uint8 RequestType; 51 uint8 Request; 52 uint16 Value; 53 uint16 Index; 54 uint16 Length; 55 }; 56 57 58 struct usb_isochronous_data { 59 usb_iso_packet_descriptor *packet_descriptors; 60 uint32 packet_count; 61 uint32 *starting_frame_number; 62 uint32 flags; 63 }; 64 65 66 struct usb_hub_descriptor 67 { 68 uint8 length; 69 uint8 descriptor_type; 70 uint8 num_ports; 71 uint16 characteristics; 72 uint8 power_on_to_power_good; 73 uint8 max_power; 74 uint8 device_removeable; //Should be variable!!! 75 uint8 power_control_mask; //Deprecated 76 } _PACKED; 77 78 #define USB_DESCRIPTOR_HUB 0x29 79 80 81 // USB Spec 1.1 page 273 82 struct usb_port_status 83 { 84 uint16 status; 85 uint16 change; 86 }; 87 88 89 //The bits in the usb_port_status struct 90 // USB 1.1 spec page 274 91 #define PORT_STATUS_CONNECTION 0x0001 92 #define PORT_STATUS_ENABLE 0x0002 93 #define PORT_STATUS_SUSPEND 0x0004 94 #define PORT_STATUS_OVER_CURRENT 0x0008 95 #define PORT_STATUS_RESET 0x0010 96 #define PORT_STATUS_POWER 0x0100 97 #define PORT_STATUS_LOW_SPEED 0x0200 98 #define PORT_STATUS_HIGH_SPEED 0x0400 99 100 101 //The feature requests with ports 102 // USB 1.1 spec page 268 103 #define PORT_CONNECTION 0 104 #define PORT_ENABLE 1 105 #define PORT_SUSPEND 2 106 #define PORT_OVER_CURRENT 3 107 #define PORT_RESET 4 108 #define PORT_POWER 8 109 #define PORT_LOW_SPEED 9 110 #define C_PORT_CONNECTION 16 111 #define C_PORT_ENABLE 17 112 #define C_PORT_SUSPEND 18 113 #define C_PORT_OVER_CURRENT 19 114 #define C_PORT_RESET 20 115 116 #endif // _USBSPEC_PRIVATE_H 117