USBLib API Guide  1.00.00.01
usbdbulk.h
Go to the documentation of this file.
1 //*****************************************************************************
2 //
3 // usbdcdc.h - USBLib support for a generic bulk device.
4 //
5 // Copyright (c) 2008-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 __USBDBULK_H__
25 #define __USBDBULK_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 //
42 //
43 //*****************************************************************************
44 
45 //*****************************************************************************
46 //
47 // PRIVATE
48 //
49 // The first few sections of this header are private defines that are used by
50 // the USB Bulk example code and are here only to help with the application
51 // allocating the correct amount of memory for the Bulk example device code.
52 //
53 //*****************************************************************************
54 
55 //*****************************************************************************
56 //
57 // PRIVATE
58 //
59 // This enumeration holds the various states that the device can be in during
60 // normal operation.
61 //
62 //*****************************************************************************
63 typedef enum
64 {
65  //
66  // Not configured.
67  //
69 
70  //
71  // No outstanding transaction remains to be completed.
72  //
74 
75  //
76  // Waiting on completion of a send or receive transaction.
77  //
79 
80  //
81  // Waiting for client to process data.
82  //
84 }
86 
87 //*****************************************************************************
88 //
89 // PRIVATE
90 //
91 // This structure defines the private instance data and state variables for the
92 // Bulk only example device. The memory for this structure is inlcluded in
93 // the sPrivateData field in the tUSBDBulkDevice structure passed on
94 // USBDBulkInit().
95 //
96 //*****************************************************************************
97 typedef struct
98 {
99  //
100  // Base address for the USB controller.
101  //
102  uint32_t ui32USBBase;
103 
104  //
105  // The device info to interact with the lower level DCD code.
106  //
108 
109  //
110  // The state of the bulk receive channel.
111  //
112  volatile tBulkState iBulkRxState;
113 
114  //
115  // The state of the bulk transmit channel.
116  //
117  volatile tBulkState iBulkTxState;
118 
119  //
120  // State of any pending operations that could not be handled immediately
121  // upon receipt.
122  //
123  volatile uint16_t ui16DeferredOpFlags;
124 
125  //
126  // Size of the last transmit.
127  //
128  uint16_t ui16LastTxSize;
129 
130  //
131  // The connection status of the device.
132  //
133  volatile bool bConnected;
134 
135  //
136  // The IN endpoint number, this is modified in composite devices.
137  //
138  uint8_t ui8INEndpoint;
139 
140  //
141  // The OUT endpoint number, this is modified in composite devices.
142  //
143  uint8_t ui8OUTEndpoint;
144 
145  //
146  // The bulk class interface number, this is modified in composite devices.
147  //
148  uint8_t ui8Interface;
149 }
151 
152 //*****************************************************************************
153 //
154 // This is the size of the g_pui8BulkInterface array in bytes.
155 //
156 //*****************************************************************************
157 #define BULKINTERFACE_SIZE (23)
158 
159 //*****************************************************************************
160 //
165 //
166 //*****************************************************************************
167 #define COMPOSITE_DBULK_SIZE (BULKINTERFACE_SIZE)
168 
169 //*****************************************************************************
170 //
173 //
174 //*****************************************************************************
175 typedef struct
176 {
177  //
179  //
180  const uint16_t ui16VID;
181 
182  //
184  //
185  const uint16_t ui16PID;
186 
187  //
189  //
190  const uint16_t ui16MaxPowermA;
191 
192  //
196  //
197  const uint8_t ui8PwrAttributes;
198 
199  //
202  //
204 
205  //
209  //
210  void *pvRxCBData;
211 
212  //
216  //
218 
219  //
223  //
224  void *pvTxCBData;
225 
226  //
237  //
238  const uint8_t * const *ppui8StringDescriptors;
239 
240  //
243  //
244  const uint32_t ui32NumStringDescriptors;
245 
246  //
249  //
251 }
253 
254 //*****************************************************************************
255 //
256 // API Function Prototypes
257 //
258 //*****************************************************************************
259 extern void *USBDBulkInit(uint32_t ui32Index, tUSBDBulkDevice *psBulkDevice);
260 extern void *USBDBulkCompositeInit(uint32_t ui32Index,
261  tUSBDBulkDevice *psBulkDevice,
262  tCompositeEntry *psCompEntry);
263 extern void USBDBulkTerm(void *pvBulkInstance);
264 extern void *USBDBulkSetRxCBData(void *pvBulkInstance, void *pvCBData);
265 extern void *USBDBulkSetTxCBData(void *pvBulkInstance, void *pvCBData);
266 extern uint32_t USBDBulkPacketWrite(void *pvBulkInstance, uint8_t *pi8Data,
267  uint32_t ui32Length, bool bLast);
268 extern uint32_t USBDBulkPacketRead(void *pvBulkInstance, uint8_t *pi8Data,
269  uint32_t ui32Length, bool bLast);
270 extern uint32_t USBDBulkTxPacketAvailable(void *pvBulkInstance);
271 extern uint32_t USBDBulkRxPacketAvailable(void *pvBulkInstance);
272 extern bool USBDBulkRemoteWakeupRequest(void *pvBulkInstance);
273 
274 //*****************************************************************************
275 //
276 // Close the Doxygen group.
278 //
279 //*****************************************************************************
280 
281 //*****************************************************************************
282 //
283 // The following APIs are deprecated.
284 //
285 //*****************************************************************************
286 #ifndef DEPRECATED
287 extern void USBDBulkPowerStatusSet(void *pvBulkInstance, uint8_t ui8Power);
288 #endif
289 
290 //*****************************************************************************
291 //
292 // Mark the end of the C bindings section for C++ compilers.
293 //
294 //*****************************************************************************
295 #ifdef __cplusplus
296 }
297 #endif
298 
299 #endif // __USBDBULK_H__
void USBDBulkPowerStatusSet(void *pvBulkInstance, uint8_t ui8Power)
Definition: usbdbulk.c:1593
const tUSBCallback pfnRxCallback
Definition: usbdbulk.h:203
const uint16_t ui16MaxPowermA
The maximum power consumption of the device, expressed in milliamps.
Definition: usbdbulk.h:190
uint8_t ui8Interface
Definition: usbdbulk.h:148
tBulkInstance sPrivateData
Definition: usbdbulk.h:250
volatile tBulkState iBulkRxState
Definition: usbdbulk.h:112
volatile bool bConnected
Definition: usbdbulk.h:133
void USBDBulkTerm(void *pvBulkDevice)
Definition: usbdbulk.c:1147
tBulkState
Definition: usbdbulk.h:63
Definition: usbdbulk.h:97
Definition: usbdbulk.h:78
Definition: usbdbulk.h:83
void * USBDBulkInit(uint32_t ui32Index, tUSBDBulkDevice *psBulkDevice)
Definition: usbdbulk.c:962
Definition: usbdbulk.h:175
uint8_t ui8OUTEndpoint
Definition: usbdbulk.h:143
Definition: usbdevice.h:135
tDeviceInfo sDevInfo
Definition: usbdbulk.h:107
uint32_t USBDBulkTxPacketAvailable(void *pvBulkDevice)
Definition: usbdbulk.c:1489
uint32_t USBDBulkPacketRead(void *pvBulkDevice, uint8_t *pi8Data, uint32_t ui32Length, bool bLast)
Definition: usbdbulk.c:1393
void * pvTxCBData
Definition: usbdbulk.h:224
const uint8_t ui8PwrAttributes
Definition: usbdbulk.h:197
uint8_t ui8INEndpoint
Definition: usbdbulk.h:138
uint32_t USBDBulkPacketWrite(void *pvBulkDevice, uint8_t *pi8Data, uint32_t ui32Length, bool bLast)
Definition: usbdbulk.c:1290
volatile uint16_t ui16DeferredOpFlags
Definition: usbdbulk.h:123
const uint16_t ui16PID
The product ID that this device is to present in the device descriptor.
Definition: usbdbulk.h:185
uint16_t ui16LastTxSize
Definition: usbdbulk.h:128
bool USBDBulkRemoteWakeupRequest(void *pvBulkDevice)
Definition: usbdbulk.c:1624
const uint8_t *const * ppui8StringDescriptors
Definition: usbdbulk.h:238
void * pvRxCBData
Definition: usbdbulk.h:210
Definition: usbdevice.h:66
void * USBDBulkCompositeInit(uint32_t ui32Index, tUSBDBulkDevice *psBulkDevice, tCompositeEntry *psCompEntry)
Definition: usbdbulk.c:1029
uint32_t USBDBulkRxPacketAvailable(void *pvBulkDevice)
Definition: usbdbulk.c:1537
uint32_t(* tUSBCallback)(void *pvCBData, uint32_t ui32Event, uint32_t ui32MsgParam, void *pvMsgData)
Definition: usblib.h:1220
const uint16_t ui16VID
The vendor ID that this device is to present in the device descriptor.
Definition: usbdbulk.h:180
void * USBDBulkSetRxCBData(void *pvBulkDevice, void *pvCBData)
Definition: usbdbulk.c:1192
const tUSBCallback pfnTxCallback
Definition: usbdbulk.h:217
Definition: usbdbulk.h:73
volatile tBulkState iBulkTxState
Definition: usbdbulk.h:117
Definition: usbdbulk.h:68
const uint32_t ui32NumStringDescriptors
Definition: usbdbulk.h:244
uint32_t ui32USBBase
Definition: usbdbulk.h:102
void * USBDBulkSetTxCBData(void *pvBulkDevice, void *pvCBData)
Definition: usbdbulk.c:1234
© Copyright 1995-2019, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale