Enhance the Usb bus driver to support Star with Remaining device path.
[mirror_edk2.git] / MdeModulePkg / Bus / Usb / UsbBusDxe / UsbEnumer.h
1 /** @file
2
3 Copyright (c) 2007, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 Module Name:
13
14 UsbEnumer.h
15
16 Abstract:
17
18 USB bus enumeration interface
19
20 Revision History
21
22
23 **/
24
25 #ifndef _USB_ENUMERATION_H_
26 #define _USB_ENUMERATION_H_
27
28 //
29 // Advance the byte and bit to the next bit, adjust byte accordingly.
30 //
31 #define USB_NEXT_BIT(Byte, Bit) \
32 do { \
33 (Bit)++; \
34 if ((Bit) > 7) { \
35 (Byte)++; \
36 (Bit) = 0; \
37 } \
38 } while (0)
39
40
41 //
42 // Common interface used by usb bus enumeration process.
43 // This interface is defined to mask the difference between
44 // the root hub and normal hub. So, bus enumeration code
45 // can be shared by both root hub and normal hub
46 //
47 typedef
48 EFI_STATUS
49 (*USB_HUB_INIT) (
50 IN USB_INTERFACE *UsbIf
51 );
52
53 //
54 // Get the port status. This function is required to
55 // ACK the port change bits although it will return
56 // the port changes in PortState. Bus enumeration code
57 // doesn't need to ACK the port change bits.
58 //
59 typedef
60 EFI_STATUS
61 (*USB_HUB_GET_PORT_STATUS) (
62 IN USB_INTERFACE *UsbIf,
63 IN UINT8 Port,
64 OUT EFI_USB_PORT_STATUS *PortState
65 );
66
67 typedef
68 VOID
69 (*USB_HUB_CLEAR_PORT_CHANGE) (
70 IN USB_INTERFACE *HubIf,
71 IN UINT8 Port
72 );
73
74 typedef
75 EFI_STATUS
76 (*USB_HUB_SET_PORT_FEATURE) (
77 IN USB_INTERFACE *UsbIf,
78 IN UINT8 Port,
79 IN EFI_USB_PORT_FEATURE Feature
80 );
81
82 typedef
83 EFI_STATUS
84 (*USB_HUB_CLEAR_PORT_FEATURE) (
85 IN USB_INTERFACE *UsbIf,
86 IN UINT8 Port,
87 IN EFI_USB_PORT_FEATURE Feature
88 );
89
90 typedef
91 EFI_STATUS
92 (*USB_HUB_RESET_PORT) (
93 IN USB_INTERFACE *UsbIf,
94 IN UINT8 Port
95 );
96
97 typedef
98 EFI_STATUS
99 (*USB_HUB_RELEASE) (
100 IN USB_INTERFACE *UsbIf
101 );
102
103 struct _USB_HUB_API{
104 USB_HUB_INIT Init;
105 USB_HUB_GET_PORT_STATUS GetPortStatus;
106 USB_HUB_CLEAR_PORT_CHANGE ClearPortChange;
107 USB_HUB_SET_PORT_FEATURE SetPortFeature;
108 USB_HUB_CLEAR_PORT_FEATURE ClearPortFeature;
109 USB_HUB_RESET_PORT ResetPort;
110 USB_HUB_RELEASE Release;
111 };
112
113 USB_ENDPOINT_DESC*
114 UsbGetEndpointDesc (
115 IN USB_INTERFACE *UsbIf,
116 IN UINT8 EpAddr
117 );
118
119
120 EFI_STATUS
121 UsbSelectSetting (
122 IN USB_INTERFACE_DESC *IfDesc,
123 IN UINT8 Alternate
124 );
125
126 EFI_STATUS
127 UsbSelectConfig (
128 IN USB_DEVICE *Device,
129 IN UINT8 ConfigIndex
130 );
131
132 VOID
133 UsbRemoveConfig (
134 IN USB_DEVICE *Device
135 );
136
137 EFI_STATUS
138 UsbRemoveDevice (
139 IN USB_DEVICE *Device
140 );
141
142 VOID
143 EFIAPI
144 UsbHubEnumeration (
145 IN EFI_EVENT Event,
146 IN VOID *Context
147 );
148
149 VOID
150 EFIAPI
151 UsbRootHubEnumeration (
152 IN EFI_EVENT Event,
153 IN VOID *Context
154 );
155 #endif