usbdcomp.h
Go to the documentation of this file.
1 //*****************************************************************************
2 //
3 // usbdcomp.h - USB composite device class driver.
4 //
5 // Copyright (c) 2010-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 
24 #ifndef __USBDCOMP_H__
25 #define __USBDCOMP_H__
26 
27 //*****************************************************************************
28 //
29 // If building with a C++ compiler, make all of the definitions in this header
30 // have a C binding.
31 //
32 //*****************************************************************************
33 #ifdef __cplusplus
34 extern "C"
35 {
36 #endif
37 
38 //*****************************************************************************
39 //
40 // Return to default packing when using the IAR Embedded Workbench compiler.
41 //
42 //*****************************************************************************
43 #ifdef __ICCARM__
44 #pragma pack()
45 #endif
46 
47 //*****************************************************************************
48 //
51 //
52 //*****************************************************************************
53 
54 //
55 // Defines a single entry in a table of device types supported by the composite
56 // device.
57 //
58 typedef struct
59 {
60  //
61  // This is set internally by the composite class so it can be left
62  // uninitialized by the application.
63  //
65 
66  //
67  // This should be the header to the configuration header for a class.
68  //
70 
71  //
72  // The offset to this devices interface, filled in by the composite class.
73  //
74  uint8_t ui8IfaceOffset;
75 }
77 
78 //*****************************************************************************
79 //
80 // PRIVATE
81 //
82 // This structure defines the private instance data and state variables for the
83 // composite device class. The memory for this structure is included in
84 // the sPrivateData field in the tUSBDCompositeDevice structure passed on
85 // USBDCompositeInit() and should not be modified by any code outside of the
86 // composite device code.
87 //
88 //*****************************************************************************
89 typedef struct
90 {
91  //
92  // Saves which USB controller is in use.
93  //
94  uint32_t ui32USBBase;
95 
96  //
97  // The device information pointer.
98  //
100 
101  //
102  // This is the configuration descriptor for this instance.
103  //
104  tConfigDescriptor sConfigDescriptor;
105 
106  //
107  // This is the device descriptor for this instance.
108  //
109  tDeviceDescriptor sDeviceDescriptor;
110 
111  //
112  // The configuration header for this instance.
113  //
115 
116  //
117  // These are the configuration sections that will be built from the
118  // Configuration Descriptor header and the descriptors from the devices
119  // that are part of this composite device.
120  //
121  tConfigSection psCompSections[2];
122  tConfigSection *ppsCompSections[2];
123 
124  //
125  // The size and pointer to the data used by the instance.
126  //
127  uint32_t ui32DataSize;
128  uint8_t *pui8Data;
129 
130  //
131  // The current "owner" of endpoint 0. This is used to track the device
132  // class which is currently transferring data on EP0.
133  //
134  uint32_t ui32EP0Owner;
135 }
137 
138 //*****************************************************************************
139 //
142 //
143 //*****************************************************************************
144 typedef struct
145 {
146  //
148  //
149  const uint16_t ui16VID;
150 
151  //
153  //
154  const uint16_t ui16PID;
155 
156  //
158  //
159  const uint16_t ui16MaxPowermA;
160 
161  //
166  //
167  const uint8_t ui8PwrAttributes;
168 
169  //
173  //
175 
176  //
188  //
189  const uint8_t * const *ppui8StringDescriptors;
190 
191  //
195  //
196  const uint32_t ui32NumStringDescriptors;
197 
198  //
200  //
201  const uint32_t ui32NumDevices;
202 
203  //
206  //
208 
209  //
213  //
215 }
217 
218 //*****************************************************************************
219 //
220 // Return to default packing when using the IAR Embedded Workbench compiler.
221 //
222 //*****************************************************************************
223 #ifdef __ICCARM__
224 #pragma pack()
225 #endif
226 
227 //*****************************************************************************
228 //
229 // Composite specific device class driver events
230 //
231 //*****************************************************************************
232 
233 //*****************************************************************************
234 //
235 // API Function Prototypes
236 //
237 //*****************************************************************************
238 extern void *USBDCompositeInit(uint32_t ui32Index,
239  tUSBDCompositeDevice *psCompDevice,
240  uint32_t ui32Size, uint8_t *pui8Data);
241 extern void USBDCompositeTerm(void *pvInstance);
242 
243 //*****************************************************************************
244 //
245 // Close the Doxygen group.
247 //
248 //*****************************************************************************
249 
250 //*****************************************************************************
251 //
252 // Mark the end of the C bindings section for C++ compilers.
253 //
254 //*****************************************************************************
255 #ifdef __cplusplus
256 }
257 #endif
258 
259 #endif
260 
Definition: usblib.h:1077
Definition: usbdcomp.h:89
const uint16_t ui16MaxPowermA
The maximum power consumption of the device, expressed in mA.
Definition: usbdcomp.h:159
const uint16_t ui16VID
The vendor ID that this device is to present in the device descriptor.
Definition: usbdcomp.h:149
const uint32_t ui32NumStringDescriptors
Definition: usbdcomp.h:196
uint32_t ui32DataSize
Definition: usbdcomp.h:127
const uint32_t ui32NumDevices
The number of devices in the psDevices array.
Definition: usbdcomp.h:201
Definition: usbdevice.h:135
const tDeviceInfo * psDeviceInfo
Definition: usbdcomp.h:64
uint8_t ui8IfaceOffset
Definition: usbdcomp.h:74
void USBDCompositeTerm(void *pvCompositeInstance)
Definition: usbdcomp.c:1534
const uint16_t ui16PID
The product ID that this device is to present in the device descriptor.
Definition: usbdcomp.h:154
Definition: usbdcomp.h:58
tConfigDescriptor sConfigDescriptor
Definition: usbdcomp.h:104
Definition: usbdcomp.h:144
tConfigHeader sCompConfigHeader
Definition: usbdcomp.h:114
const tUSBCallback pfnCallback
Definition: usbdcomp.h:174
const uint8_t *const * ppui8StringDescriptors
Definition: usbdcomp.h:189
const tConfigHeader * psConfigHeader
Definition: usbdcomp.h:69
uint32_t ui32USBBase
Definition: usbdcomp.h:94
Definition: usbdevice.h:66
uint32_t(* tUSBCallback)(void *pvCBData, uint32_t ui32Event, uint32_t ui32MsgParam, void *pvMsgData)
Definition: usblib.h:1220
tCompositeInstance sPrivateData
Definition: usbdcomp.h:214
tDeviceInfo sDevInfo
Definition: usbdcomp.h:99
Definition: usblib.h:1049
uint8_t * pui8Data
Definition: usbdcomp.h:128
tCompositeEntry *const psDevices
Definition: usbdcomp.h:207
uint32_t ui32EP0Owner
Definition: usbdcomp.h:134
const uint8_t ui8PwrAttributes
Definition: usbdcomp.h:167
tDeviceDescriptor sDeviceDescriptor
Definition: usbdcomp.h:109
void * USBDCompositeInit(uint32_t ui32Index, tUSBDCompositeDevice *psDevice, uint32_t ui32Size, uint8_t *pui8Data)
Definition: usbdcomp.c:1390
Copyright 2018, Texas Instruments Incorporated