1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
/*! \file examples.h
* \brief Common include file used only in examples.
*/
//! Enables/disables custom vendor control request (supported by the Benchmark Device Firmware).
/*!
* \note If your example device is not running Benchmark Firmware, set this define to "0".
*/
//! Default example vendor id
//! Default example product id
//! Custom vendor requests that must be implemented in the benchmark firmware.
typedef enum _BM_COMMAND
BM_COMMAND;
//! Tests supported by the official benchmark firmware.
typedef enum _BM_TEST_TYPE
BM_TEST_TYPE, *PBM_TEST_TYPE;
//! Helper function for examples; searches a command line argument list for devices matching a specific vid/pid.
/*!
* Arguments are interpreted as follows:
* - vid=<4 digit hex>
* - hex number is a vendor id.
* - pid=<4 digit hex>
* - hex number is a product id.
*
* \param DeviceList
* On success, contains a pointer to the device list.
*
* \param DeviceInfo
* On success, contains a pointer to the first device info structure which matched.
*
* \param argc
* The \c argc parameter of the \b main() application function.
*
* \param argv
* The \c argv parameter of the \b main() application function.
*
* \returns
* TRUE if a devices was found, otherwise FALSE.
*/
BOOL ;
BOOL ;
BOOL ;
BOOL ;
BOOL ;
typedef struct _DATA_COUNTER_STATS
DATA_COUNTER_STATS, *PDATA_COUNTER_STATS;
; \
; \
->dFreq = 1.0/->Freq.QuadPart; \
; \
}while
; \
->TotalBytes+=; \
->Duration = \
* \
; \
if \
->Bps = / ->Duration; \
}while
/*!
* \brief Doubly linked list macro for C structures. <A href="http://uthash.sourceforge.net/utlist.html">utlist.h</A>
* \brief Provided by <A href="http://uthash.sourceforge.net">Troy D. Hanson</A>
*
* \attention
* All lists used by the libusbK library are \b non-circular \b doubly-linked lists. (\b DL_ prefixed macros)
*
* This file contains macros to manipulate singly and doubly-linked lists:
* -# LL_ macros: singly-linked lists.
* -# DL_ macros: doubly-linked lists.
* -# CDL_ macros: circular doubly-linked lists.
*
* \note
* Only a small subset of the \c utlist.h macros are documented.
* Undocumented macros will not appear in this documentation but can be downloaded here:
* - <A href="http://uthash.sourceforge.net/utlist.html">utlist.h</A>.
*
* \note
* To use singly-linked lists, your structure must have a "next" pointer.
* <BR>
* To use doubly-linked lists, your structure must "prev" and "next" pointers.
* <BR>
* Either way, the pointer to the head of the list must be initialized to NULL.
*
* \code
struct item
{
int id;
struct item *prev, *next;
}
struct item *list = NULL:
int main()
{
struct item *item;
... allocate and populate item ...
DL_APPEND(list, item);
}
* \endcode
*
* <B>Performance Considerations</B>:
* - For doubly-linked lists, the append and delete macros are O(1)
* - For singly-linked lists, append and delete are O(n) but prepend is O(1)
* - The sort macro is O(n log(n)) for all types of single/double/circular lists.
*/
/*
Copyright (c) 2007-2010, Troy D. Hanson http://uthash.sourceforge.net
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/******************************************************************************
* doubly linked list macros (non-circular) *
*****************************************************************************/
//! Adds an element to the beginning of a linked list.
/*!
* \param head
* First element of the list.
*
* \param add
* Element to add.
*/
do while
//! Adds an element to the end of a linked list.
/*!
* \param head
* First element of the list.
*
* \param add
* Element to add.
*/
do while ;
//! Removes an element from a linked list.
/*!
*
* \param head
* First element of the list.
*
* \param del
* Element to remove.
*
* \attention
* \c DL_DELETE does not free or de-allocate memory.
* It "de-links" the element specified by \c del from the list.
*/
do while ;
//! Start a \c foreach like enumeration though a linked list using a \b for loop.
/*!
* \param head
* First element of the list.
*
* \param el
* assigned to an element of the linked list on each iteration.
*/
for
//! \copybrief DL_FOREACH
/*!
*
* \copydetails DL_FOREACH
*
* \param tmp
* A temporary list element used to ensure safe deletion during iteration.
*
* \attention
* This version is safe for deleting the elements during iteration.
*/
for
/* these are identical to their singly-linked list counterparts */
//! Searches for a scalar field using a \ref DL_FOREACH.
/*!
* \param head
* First element of the list.
*
* \param out
* First element whose \c field value equals \c val.
*
* \param field
* Name of the field member to search.
*
* \param val
* Value to compare with the field member.
*/
do while
//! Searches for an element using a user-defined compare function such as memcmp or strcmp.
/*!
* \param head
* First element of the list.
*
* \param out
* First matching element that matched (user-defined compare function returned 0).
*
* \param elt
* Matching criteria (passed as a second paramater to the user-defined compare function)
*
* \param cmp
* User-defined compare function or macro.
*/
do while
/* UTLIST_H */