+/rtos

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

Vivek Malneediusb headers326af29

master
6.0 KiB152 linesraw
1//*****************************************************************************
2//
3// usbhhub.h - This hold the host driver for hid class.
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 __USBHHUB_H__
26#define __USBHHUB_H__
27#include "usbhost.h"
28
29//*****************************************************************************
30//
31// If building with a C++ compiler, make all of the definitions in this header
32// have a C binding.
33//
34//*****************************************************************************
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39typedef struct tHubInstance tHubInstance;
40
41extern const tUSBHostClassDriver g_sUSBHubClassDriver;
42
43//*****************************************************************************
44//
45// The USB standard allows for up to 127 downstream ports on a single hub.
46// This would require rather more memory than we would like to set aside so the
47// default configuration of the hub driver supports hubs with up to 7
48// downstream-facing ports.  In practice, this should be more than enough
49// since this covers the vast majority of consumer hubs.  Note that, by
50// default, we will only support 4 devices so you can't fully populate a 7 port
51// hub and have everything work.
52//
53// Feel free to change this but bad things will happen if you increase it above
54// 31 since we assume the reports will always fit inside a 4 byte buffer.
55//
56//*****************************************************************************
57#define ROOT_HUB_MAX_PORTS 7
58
59//*****************************************************************************
60//
61// Values used as the ui16Feature parameter to USBHHubClearHubFeature().
62//
63//*****************************************************************************
64#define HUB_FEATURE_C_HUB_LOCAL_POWER 0
65#define HUB_FEATURE_C_HUB_OVER_CURRENT 1
66
67//*****************************************************************************
68//
69// Values used as the ui16Feature parameter to USBHHubSetPortFeature() and
70// USBHHubClearPortFeature().
71//
72//*****************************************************************************
73#define HUB_FEATURE_PORT_CONNECTION 0
74#define HUB_FEATURE_PORT_ENABLE 1
75#define HUB_FEATURE_PORT_SUSPEND 2
76#define HUB_FEATURE_PORT_OVER_CURRENT 3
77#define HUB_FEATURE_PORT_RESET 4
78#define HUB_FEATURE_PORT_POWER 8
79#define HUB_FEATURE_PORT_LOW_SPEED 9
80#define HUB_FEATURE_C_PORT_CONNECTION 16
81#define HUB_FEATURE_C_PORT_ENABLE 17
82#define HUB_FEATURE_C_PORT_SUSPEND 18
83#define HUB_FEATURE_C_PORT_OVER_CURRENT 19
84#define HUB_FEATURE_C_PORT_RESET 20
85#define HUB_FEATURE_PORT_TEST 21
86#define HUB_FEATURE_PORT_INDICATOR 22
87
88//*****************************************************************************
89//
90// Values returned via the *pui16HubStatus and *pui16HubChange parameters
91// passed to USBHHubGetHubStatus().  These may be ORed together into the
92// returned status value.
93//
94//*****************************************************************************
95#define HUB_STATUS_PWR_LOST 1
96#define HUB_STATUS_OVER_CURRENT 2
97
98//*****************************************************************************
99//
100// Values returned via the *pui16PortStatus parameter passed to
101// USBHHubGetPortStatus().  These may be ORed together into the returned status
102// value.
103//
104//*****************************************************************************
105#define HUB_PORT_STATUS_DEVICE_PRESENT 0x0001
106#define HUB_PORT_STATUS_ENABLED 0x0002
107#define HUB_PORT_STATUS_SUSPENDED 0x0004
108#define HUB_PORT_STATUS_OVER_CURRENT 0x0008
109#define HUB_PORT_STATUS_RESET 0x0010
110#define HUB_PORT_STATUS_POWERED 0x0100
111#define HUB_PORT_STATUS_LOW_SPEED 0x0200
112#define HUB_PORT_STATUS_HIGH_SPEED 0x0400
113#define HUB_PORT_STATUS_TEST_MODE 0x0800
114#define HUB_PORT_STATUS_INDICATOR_CONTROL 0x1000
115
116//*****************************************************************************
117//
118// Values returned via the *pui16PortChange parameter passed to
119// USBHHubGetPortStatus().  These may be ORed together into the returned status
120// value.
121//
122//*****************************************************************************
123#define HUB_PORT_CHANGE_DEVICE_PRESENT 0x0001
124#define HUB_PORT_CHANGE_ENABLED 0x0002
125#define HUB_PORT_CHANGE_SUSPENDED 0x0004
126#define HUB_PORT_CHANGE_OVER_CURRENT 0x0008
127#define HUB_PORT_CHANGE_RESET 0x0010
128
129//*****************************************************************************
130//
131// The prototype for the USB Hub host driver callback function.
132//
133//*****************************************************************************
134typedef void (*tUSBHHubCallback)(tHubInstance* psHubInstance,
135                                 uint32_t ui32Event, uint32_t ui32MsgParam,
136                                 void* pvMsgData);
137
138//*****************************************************************************
139//
140// Public function prototypes for the HUB class driver.
141//
142//*****************************************************************************
143extern tHubInstance* USBHHubOpen(tUSBHHubCallback pfnCallback);
144extern void USBHHubClose(tHubInstance* psHubInstance);
145extern uint32_t USBHHubLPMSleep(tHubInstance* psHubInstance);
146extern uint32_t USBHHubLPMStatus(tHubInstance* psHubInstance);
147
148#ifdef __cplusplus
149}
150#endif
151
152#endif // __USBHHUB_H__