xref: /haiku/src/add-ons/kernel/busses/usb/ohci_rh.cpp (revision 1d9d47fc72028bb71b5f232a877231e59cfe2438)
1 //------------------------------------------------------------------------------
2 //	Copyright (c) 2005, Jan-Rixt Van Hoye
3 //
4 //	Permission is hereby granted, free of charge, to any person obtaining a
5 //	copy of this software and associated documentation files (the "Software"),
6 //	to deal in the Software without restriction, including without limitation
7 //	the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 //	and/or sell copies of the Software, and to permit persons to whom the
9 //	Software is furnished to do so, subject to the following conditions:
10 //
11 //	The above copyright notice and this permission notice shall be included in
12 //	all copies or substantial portions of the Software.
13 //
14 //	THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 //	IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 //	FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 //	AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 //	LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 //	FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 //	DEALINGS IN THE SOFTWARE.
21 //------------------------------------------------------------------------------
22 
23 
24 #include "ohci.h"
25 #include <PCI.h>
26 
27 usb_device_descriptor ohci_devd =
28 {
29 	0x12,					//Descriptor size
30 	USB_DESCRIPTOR_DEVICE ,	//Type of descriptor
31 	0x110,					//USB 1.1
32 	0x09 ,					//Hub type
33 	0 ,						//Subclass
34 	0 ,						//Protocol
35 	64 ,					//Max packet size
36 	0 ,						//Vendor
37 	0 ,						//Product
38 	0x110 ,					//Version
39 	1 , 2 , 0 ,				//Other data
40 	1						//Number of configurations
41 };
42 
43 usb_configuration_descriptor ohci_confd =
44 {
45 	0x09,					//Size
46 	USB_DESCRIPTOR_CONFIGURATION ,
47 	25 ,					//Total size (taken from BSD source)
48 	1 ,						//Number interfaces
49 	1 ,						//Value of configuration
50 	0 ,						//Number of configuration
51 	0x40 ,					//Self powered
52 	0						//Max power (0, because of self power)
53 };
54 
55 usb_interface_descriptor ohci_intd =
56 {
57 	0x09 ,					//Size
58 	USB_DESCRIPTOR_INTERFACE ,
59 	0 ,						//Interface number
60 	0 ,						//Alternate setting
61 	1 ,						//Num endpoints
62 	0x09 ,					//Interface class
63 	0 ,						//Interface subclass
64 	0 ,						//Interface protocol
65 	0 ,						//Interface
66 };
67 
68 usb_endpoint_descriptor ohci_endd =
69 {
70 	0x07 ,					//Size
71 	USB_DESCRIPTOR_ENDPOINT,
72 	USB_REQTYPE_DEVICE_IN | 1, //1 from freebsd driver
73 	0x3 ,					// Interrupt
74 	8 ,						// Max packet size
75 	0xFF					// Interval 256
76 };
77 
78 usb_hub_descriptor ohci_hubd =
79 {
80 	0x09 ,					//Including deprecated powerctrlmask
81 	USB_DESCRIPTOR_HUB,
82 	1,						//Number of ports
83 	0x02 | 0x01 ,			//Hub characteristics FIXME
84 	50 ,					//Power on to power good
85 	0,						// Current
86 	0x00					//Both ports are removable
87 };
88 
89 //Implementation
90 OHCIRootHub::OHCIRootHub( OHCI *ohci , int8 devicenum )
91 		   : Hub( ohci , NULL , ohci_devd , devicenum , false )
92 {
93 	m_ohci = ohci;
94 }
95 
96 status_t OHCIRootHub::SubmitTransfer( Transfer *t )
97 {
98 	return B_OK;
99 }
100 
101 void OHCIRootHub::UpdatePortStatus(void)
102 {
103 	// nothing yet
104 }
105