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