+/rtos

git clone https://git.julia.blue/+/rtos

Vivek Malneediusb headers326af29

master
6.1 KiB199 linesraw
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// This is part of revision 2.1.4.178 of the Tiva USB Library.
22//
23//*****************************************************************************
24
25#ifndef __USBHOSTPRIV_H__
26#define __USBHOSTPRIV_H__
27#include "usblib/host/usbhost.h"
28#include "usblib/usblib.h"
29
30//*****************************************************************************
31//
32// If building with a C++ compiler, make all of the definitions in this header
33// have a C binding.
34//
35//*****************************************************************************
36#ifdef __cplusplus
37extern "C" {
38#endif
39
40//*****************************************************************************
41//
42// The states a hub port can be in during device connection.
43//
44//*****************************************************************************
45typedef enum {
46    //
47    // The port has no device connected.
48    //
49    ePortIdle,
50
51    //
52    // The port has a device present and is waiting for the enumeration
53    // sequence to begin.
54    //
55    ePortConnected,
56
57    //
58    // A device connection notification has been received and we have initiated
59    // a reset to the port.  We are waiting for the reset to complete.
60    //
61    ePortResetActive,
62
63    //
64    // The Port reset has completed but now the hub is waiting the required
65    // 10ms before accessing the device.
66    //
67    ePortResetWait,
68
69    //
70    // A device is connected and the port has been reset.  Control has been
71    // passed to the main host handling portion of USBLib to enumerate the
72    // device.
73    //
74    ePortActive,
75
76    //
77    // A device has completed enumeration.
78    //
79    ePortEnumerated,
80
81    //
82    // A device is attached to the port but enumeration failed.
83    //
84    ePortError
85} tHubPortState;
86
87//*****************************************************************************
88//
89// The list of valid event flags in the g_sUSBHCD.ui32EventEnables member
90// variable.
91//
92//*****************************************************************************
93#define USBHCD_EVFLAG_SOF 0x00000001
94#define USBHCD_EVFLAG_CONNECT 0x00000002
95#define USBHCD_EVFLAG_UNKCNCT 0x00000004
96#define USBHCD_EVFLAG_DISCNCT 0x00000008
97#define USBHCD_EVFLAG_PWRFAULT 0x00000010
98#define USBHCD_EVFLAG_PWRDIS 0x00000020
99#define USBHCD_EVFLAG_PWREN 0x00000040
100
101//*****************************************************************************
102//
103// This is the structure that holds all of the information for devices
104// that are enumerated in the system.  It is passed in to Open function of
105// USB host class drivers so that they can allocate any endpoints and parse
106// out other information that the device class needs to complete enumeration.
107//
108//*****************************************************************************
109struct tUSBHostDevice {
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    //
135    bool bConfigRead;
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    //
160    uint32_t ui32ConfigDescriptorSize;
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//*****************************************************************************
173extern uint32_t USBHCDHubDeviceConnected(uint32_t ui32Index, uint8_t ui8Hub,
174                                         uint8_t ui8Port, uint32_t ui32Speed);
175extern 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//*****************************************************************************
183extern void USBHHubMain(void);
184extern void USBHHubInit(void);
185extern void USBHHubEnumerationComplete(uint8_t ui8Hub, uint8_t ui8Port);
186extern void USBHHubEnumerationError(uint8_t ui8Hub, uint8_t ui8Port);
187extern uint32_t USBHCDLPMSleep(tUSBHostDevice* psDevice);
188extern 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__