USBLibAPIGuide  1.00.00.01
usbhostpriv.h
Go to the documentation of this file.
1 //*****************************************************************************
2 //
3 // usbhostpriv.h - Internal header file for USB host functions.
4 //
5 // Copyright (c) 2011-2017 Texas Instruments Incorporated. All rights reserved.
6 // Software License Agreement
7 //
8 // Texas Instruments (TI) is supplying this software for use solely and
9 // exclusively on TI's microcontroller products. The software is owned by
10 // TI and/or its suppliers, and is protected under applicable copyright
11 // laws. You may not combine this software with "viral" open-source
12 // software in order to form a larger program.
13 //
14 // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
15 // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
16 // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
17 // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
18 // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
19 // DAMAGES, FOR ANY REASON WHATSOEVER.
20 //
21 //*****************************************************************************
22 
23 #ifndef __USBHOSTPRIV_H__
24 #define __USBHOSTPRIV_H__
25 
26 //*****************************************************************************
27 //
28 // If building with a C++ compiler, make all of the definitions in this header
29 // have a C binding.
30 //
31 //*****************************************************************************
32 #ifdef __cplusplus
33 extern "C"
34 {
35 #endif
36 
37 //*****************************************************************************
38 //
39 // The states a hub port can be in during device connection.
40 //
41 //*****************************************************************************
42 typedef enum
43 {
44  //
45  // The port has no device connected.
46  //
48 
49  //
50  // The port has a device present and is waiting for the enumeration
51  // sequence to begin.
52  //
54 
55  //
56  // A device connection notification has been received and we have initiated
57  // a reset to the port. We are waiting for the reset to complete.
58  //
60 
61  //
62  // The Port reset has completed but now the hub is waiting the required
63  // 10ms before accessing the device.
64  //
66 
67  //
68  // A device is connected and the port has been reset. Control has been
69  // passed to the main host handling portion of USBLib to enumerate the
70  // device.
71  //
73 
74  //
75  // A device has completed enumeration.
76  //
78 
79  //
80  // A device is attached to the port but enumeration failed.
81  //
83 }
85 
86 //*****************************************************************************
87 //
88 // The list of valid event flags in the g_sUSBHCD.ui32EventEnables member
89 // variable.
90 //
91 //*****************************************************************************
92 #define USBHCD_EVFLAG_SOF 0x00000001
93 #define USBHCD_EVFLAG_CONNECT 0x00000002
94 #define USBHCD_EVFLAG_UNKCNCT 0x00000004
95 #define USBHCD_EVFLAG_DISCNCT 0x00000008
96 #define USBHCD_EVFLAG_PWRFAULT 0x00000010
97 #define USBHCD_EVFLAG_PWRDIS 0x00000020
98 #define USBHCD_EVFLAG_PWREN 0x00000040
99 
100 //*****************************************************************************
101 //
102 // This is the structure that holds all of the information for devices
103 // that are enumerated in the system. It is passed in to Open function of
104 // USB host class drivers so that they can allocate any endpoints and parse
105 // out other information that the device class needs to complete enumeration.
106 //
107 //*****************************************************************************
109 {
110  //
111  // The current device address for this device.
112  //
113  uint32_t ui32Address;
114 
115  //
116  // The current interface for this device.
117  //
118  uint32_t ui32Interface;
119 
120  //
121  // A flag used to record whether this is a low-speed or a full-speed
122  // device.
123  //
124  bool bLowSpeed;
125 
126  //
127  // The USB connection speed for this device.
128  //
129  uint32_t ui32Speed;
130 
131  //
132  // A flag indicating whether or not we have read the device's
133  // configuration descriptor yet.
134  //
136 
137  //
138  // The hub number to which this device is attached.
139  //
140  uint8_t ui8Hub;
141 
142  //
143  // The hub port number to which the device is attached.
144  //
145  uint8_t ui8HubPort;
146 
147  //
148  // The device descriptor for this device.
149  //
150  tDeviceDescriptor sDeviceDescriptor;
151 
152  //
153  // A pointer to the configuration descriptor for this device.
154  //
155  tConfigDescriptor *psConfigDescriptor;
156 
157  //
158  // The size of the buffer allocated to psConfigDescriptor.
159  //
161 
162  //
163  // Internal flags used by the host controller driver.
164  //
165  uint32_t ui32Flags;
166 };
167 
168 //*****************************************************************************
169 //
170 // Functions within the host controller that are called by the hub class driver
171 //
172 //*****************************************************************************
173 extern uint32_t USBHCDHubDeviceConnected(uint32_t ui32Index, uint8_t ui8Hub,
174  uint8_t ui8Port, uint32_t ui32Speed);
175 extern void USBHCDHubDeviceDisconnected(uint32_t ui32Index,
176  uint32_t ui32DevIndex);
177 
178 //*****************************************************************************
179 //
180 // Functions in the hub class driver that are called by the host controller.
181 //
182 //*****************************************************************************
183 extern void USBHHubMain(void);
184 extern void USBHHubInit(void);
185 extern void USBHHubEnumerationComplete(uint8_t ui8Hub, uint8_t ui8Port);
186 extern void USBHHubEnumerationError(uint8_t ui8Hub, uint8_t ui8Port);
187 extern uint32_t USBHCDLPMSleep(tUSBHostDevice *psDevice);
188 extern uint32_t USBHCDLPMStatus(tUSBHostDevice *psDevice);
189 
190 //*****************************************************************************
191 //
192 // Mark the end of the C bindings section for C++ compilers.
193 //
194 //*****************************************************************************
195 #ifdef __cplusplus
196 }
197 #endif
198 
199 #endif // __USBHOSTPRIV_H__
void USBHHubEnumerationComplete(uint8_t ui8Hub, uint8_t ui8Port)
Definition: usbhhub.c:1285
Definition: usbhostpriv.h:53
uint32_t ui32Address
Definition: usbhostpriv.h:113
uint32_t ui32Flags
Definition: usbhostpriv.h:165
Definition: usbhostpriv.h:65
Definition: usbhostpriv.h:82
bool bLowSpeed
Definition: usbhostpriv.h:124
tDeviceDescriptor sDeviceDescriptor
Definition: usbhostpriv.h:150
Definition: usbhostpriv.h:108
uint8_t ui8HubPort
Definition: usbhostpriv.h:145
uint32_t USBHCDHubDeviceConnected(uint32_t ui32Index, uint8_t ui8Hub, uint8_t ui8Port, uint32_t ui32Speed)
Definition: usbhostenum.c:5372
void USBHCDHubDeviceDisconnected(uint32_t ui32Index, uint32_t ui32DevIndex)
Definition: usbhostenum.c:5435
Definition: usbhostpriv.h:59
uint32_t USBHCDLPMStatus(tUSBHostDevice *psDevice)
Definition: usbhostenum.c:6131
tHubPortState
Definition: usbhostpriv.h:42
void USBHHubMain(void)
Definition: usbhhub.c:1030
Definition: usbhostpriv.h:47
uint32_t ui32ConfigDescriptorSize
Definition: usbhostpriv.h:160
void USBHHubInit(void)
Definition: usbhhub.c:1427
Definition: usbhostpriv.h:77
uint32_t USBHCDLPMSleep(tUSBHostDevice *psDevice)
Definition: usbhostenum.c:6189
uint32_t ui32Speed
Definition: usbhostpriv.h:129
uint32_t ui32Interface
Definition: usbhostpriv.h:118
bool bConfigRead
Definition: usbhostpriv.h:135
tConfigDescriptor * psConfigDescriptor
Definition: usbhostpriv.h:155
Definition: usbhostpriv.h:72
uint8_t ui8Hub
Definition: usbhostpriv.h:140
void USBHHubEnumerationError(uint8_t ui8Hub, uint8_t ui8Port)
Definition: usbhhub.c:1320
© Copyright 1995-2020, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale