003 File Manager
Current Path:
/usr/include
usr
/
include
/
📁
..
📄
Block.h
(1.96 KB)
📄
Block_private.h
(5.94 KB)
📄
FlexLexer.h
(6.73 KB)
📄
_ctype.h
(5.98 KB)
📄
_semaphore.h
(2.05 KB)
📄
a.out.h
(1.88 KB)
📄
aio.h
(7.69 KB)
📄
alias.h
(8.51 KB)
📄
ar.h
(2.69 KB)
📄
archive.h
(51.93 KB)
📄
archive_entry.h
(32.79 KB)
📁
arpa
📄
asn1-common.h
(2.06 KB)
📄
asn1_err.h
(1.07 KB)
📄
assert.h
(2.93 KB)
📁
atf-c
📁
atf-c++
📄
atf-c++.hpp
(1.49 KB)
📄
atf-c.h
(1.5 KB)
📄
base64.h
(1.99 KB)
📄
be.h
(5.32 KB)
📄
bitstring.h
(1.53 KB)
📄
blacklist.h
(2.2 KB)
📄
bluetooth.h
(6.65 KB)
📄
bsdxml.h
(40.5 KB)
📄
bsdxml_external.h
(5.4 KB)
📁
bsm
📁
bsnmp
📄
bzlib.h
(6.09 KB)
📁
c++
📄
calendar.h
(1.83 KB)
📁
cam
📄
camlib.h
(7.39 KB)
📄
capsicum_helpers.h
(4.33 KB)
📁
casper
📄
cms_asn1.h
(27.2 KB)
📄
com_err.h
(2.62 KB)
📄
com_right.h
(2.8 KB)
📄
complex.h
(4.68 KB)
📄
cpio.h
(2.4 KB)
📄
crmf_asn1.h
(13.31 KB)
📁
crypto
📄
ctype.h
(4.59 KB)
📄
curses.h
(97.92 KB)
📄
cuse.h
(3.26 KB)
📄
db.h
(7.49 KB)
📄
der-private.h
(1.29 KB)
📄
der-protos.h
(10.5 KB)
📄
der.h
(3.08 KB)
📁
dev
📄
devctl.h
(2.02 KB)
📁
devdctl
📄
devinfo.h
(4.52 KB)
📄
devstat.h
(5.2 KB)
📄
dialog.h
(37.7 KB)
📄
digest_asn1.h
(17.01 KB)
📄
dirent.h
(4.13 KB)
📄
dlfcn.h
(5.04 KB)
📄
dlg_colors.h
(6.87 KB)
📄
dlg_config.h
(2.64 KB)
📄
dlg_keys.h
(5.23 KB)
📄
dpv.h
(5.76 KB)
📄
dtrace.h
(23.64 KB)
📄
dwarf.h
(20.09 KB)
📁
edit
📄
efivar-dp.h
(2.58 KB)
📄
efivar.h
(3.75 KB)
📄
elf-hints.h
(1.96 KB)
📄
elf.h
(1.59 KB)
📄
err.h
(2.98 KB)
📄
errno.h
(8.29 KB)
📄
eti.h
(2.9 KB)
📄
execinfo.h
(1.92 KB)
📄
fcntl.h
(12.02 KB)
📄
fenv.h
(8.19 KB)
📄
fetch.h
(4.87 KB)
📄
figpar.h
(3.84 KB)
📄
float.h
(86 B)
📄
floatingpoint.h
(2.01 KB)
📄
fmtmsg.h
(2.76 KB)
📄
fmtutils.h
(2.19 KB)
📄
fnmatch.h
(2.32 KB)
📄
form.h
(18.37 KB)
📁
fs
📄
fstab.h
(3.03 KB)
📄
fts.h
(5.47 KB)
📄
ftw.h
(2.26 KB)
📁
gcc
📄
gelf.h
(5 KB)
📁
geom
📄
getarg.h
(3.15 KB)
📄
getopt.h
(2.73 KB)
📄
glob.h
(4.21 KB)
📄
grp.h
(3.21 KB)
📁
gssapi
📄
gssapi.h
(158 B)
📄
hdb-protos.h
(7.24 KB)
📄
hdb.h
(9.85 KB)
📄
hdb_asn1.h
(16.72 KB)
📄
hdb_err.h
(944 B)
📄
heim_asn1.h
(2.33 KB)
📄
heim_err.h
(1.46 KB)
📄
heim_threads.h
(6.91 KB)
📄
heimbase.h
(5.1 KB)
📄
heimntlm-protos.h
(3.78 KB)
📄
heimntlm.h
(4.85 KB)
📄
hex.h
(2.08 KB)
📄
histedit.h
(9.16 KB)
📄
hx509-private.h
(9.39 KB)
📄
hx509-protos.h
(22.53 KB)
📄
hx509.h
(5.88 KB)
📄
hx509_err.h
(3.04 KB)
📄
iconv.h
(4.23 KB)
📄
ieeefp.h
(261 B)
📄
ifaddrs.h
(2.09 KB)
📁
infiniband
📄
inttypes.h
(2.2 KB)
📄
iso646.h
(1.67 KB)
📁
isofs
📄
jail.h
(2.46 KB)
📄
k524_err.h
(724 B)
📁
kadm5
📄
kafs.h
(7.09 KB)
📄
kdc-protos.h
(2.25 KB)
📄
kdc.h
(3.5 KB)
📄
kenv.h
(1.58 KB)
📁
krb5
📄
krb5-private.h
(12.91 KB)
📄
krb5-protos.h
(113.43 KB)
📄
krb5-types.h
(1.48 KB)
📄
krb5.h
(29.75 KB)
📄
krb5_asn1.h
(70.51 KB)
📄
krb5_ccapi.h
(7.52 KB)
📄
krb5_err.h
(7.37 KB)
📄
kvm.h
(4.11 KB)
📄
kx509_asn1.h
(4.61 KB)
📄
langinfo.h
(3.95 KB)
📁
lib80211
📁
lib9p
📄
libcasper.h
(6.53 KB)
📄
libcasper_service.h
(2.5 KB)
📄
libdwarf.h
(32.98 KB)
📄
libelf.h
(7.72 KB)
📄
libgen.h
(2.65 KB)
📄
libgeom.h
(4.47 KB)
📄
libgpio.h
(3.48 KB)
📁
libipt
📁
libmilter
📄
libnetmap.h
(24.54 KB)
📄
libproc.h
(5.51 KB)
📄
libprocstat.h
(7.57 KB)
📄
librss.h
(2.96 KB)
📄
libufs.h
(5.08 KB)
📄
libusb.h
(22.05 KB)
📄
libusb20.h
(12.45 KB)
📄
libusb20_desc.h
(17.6 KB)
📄
libutil.h
(8.04 KB)
📁
libxo
📄
libzfs.h
(32.8 KB)
📄
libzfs_core.h
(5.1 KB)
📄
libzfsbootenv.h
(1.22 KB)
📄
limits.h
(4.7 KB)
📄
link.h
(1.71 KB)
📄
linker_set.h
(3.85 KB)
📄
locale.h
(2.64 KB)
📄
login_cap.h
(6.25 KB)
📁
lzma
📄
lzma.h
(9.63 KB)
📁
machine
📄
magic.h
(5.64 KB)
📄
malloc.h
(102 B)
📄
malloc_np.h
(5.04 KB)
📄
math.h
(13.92 KB)
📄
md4.h
(2.31 KB)
📄
md5.h
(810 B)
📄
memory.h
(1.68 KB)
📄
memstat.h
(7.26 KB)
📄
menu.h
(11.99 KB)
📄
monetary.h
(1.88 KB)
📄
mp.h
(857 B)
📄
mpool.h
(4.16 KB)
📄
mqueue.h
(2.22 KB)
📄
mtlib.h
(4.22 KB)
📄
ncurses.h
(97.92 KB)
📄
ncurses_dll.h
(4.42 KB)
📄
ndbm.h
(2.67 KB)
📁
net
📁
net80211
📄
netconfig.h
(3.71 KB)
📄
netdb.h
(10.78 KB)
📁
netgraph
📄
netgraph.h
(3.02 KB)
📁
netinet
📁
netinet6
📁
netipsec
📁
netnatm
📁
netpfil
📁
netsmb
📁
nfs
📁
nfsclient
📁
nfsserver
📄
nl_types.h
(2.94 KB)
📄
nlist.h
(2.13 KB)
📄
nss.h
(2.32 KB)
📄
nsswitch.h
(7.16 KB)
📄
ntlm_err.h
(970 B)
📄
ocsp_asn1.h
(14.58 KB)
📄
omp.h
(15.76 KB)
📁
opencsd
📁
openssl
📄
opie.h
(5.57 KB)
📄
osreldate.h
(1.51 KB)
📄
panel.h
(4.1 KB)
📄
parse_bytes.h
(2.13 KB)
📄
parse_time.h
(2.19 KB)
📄
parse_units.h
(2.73 KB)
📄
pathconv.h
(1.64 KB)
📄
paths.h
(5.16 KB)
📁
pcap
📄
pcap-bpf.h
(2.24 KB)
📄
pcap-namedb.h
(1.98 KB)
📄
pcap-netmap.h
(126 B)
📄
pcap.h
(2.17 KB)
📄
pkcs10_asn1.h
(4.13 KB)
📄
pkcs12_asn1.h
(13.04 KB)
📄
pkcs8_asn1.h
(6.51 KB)
📄
pkcs9_asn1.h
(5.95 KB)
📄
pkinit_asn1.h
(26.54 KB)
📄
pmc.h
(4.51 KB)
📄
pmcformat.h
(1.47 KB)
📄
pmclog.h
(5.74 KB)
📄
poll.h
(4.03 KB)
📄
printf.h
(5.15 KB)
📁
private
📄
proc_service.h
(2.96 KB)
📁
protocols
📄
pthread.h
(12.7 KB)
📄
pthread_np.h
(3.28 KB)
📄
pwd.h
(6.05 KB)
📄
radlib.h
(8.86 KB)
📄
radlib_vs.h
(3.6 KB)
📄
ranlib.h
(1.99 KB)
📁
rdma
📄
readpassphrase.h
(1.82 KB)
📄
regex.h
(3.87 KB)
📄
res_update.h
(2.45 KB)
📄
resolv.h
(18.69 KB)
📄
resolve.h
(7.26 KB)
📄
rfc2459_asn1.h
(73.99 KB)
📄
ripemd.h
(5.09 KB)
📄
roken-common.h
(11.68 KB)
📄
roken.h
(6.86 KB)
📁
rpc
📁
rpcsvc
📄
rpoll.h
(2.13 KB)
📄
rtbl.h
(3.61 KB)
📄
rtld_db.h
(3.82 KB)
📄
runetype.h
(3.76 KB)
📄
sched.h
(9.06 KB)
📄
sdp.h
(21.58 KB)
📄
search.h
(1.71 KB)
📁
security
📄
semaphore.h
(2.35 KB)
📄
setjmp.h
(2.5 KB)
📄
sha.h
(5.91 KB)
📄
sha224.h
(2.93 KB)
📄
sha256.h
(3.01 KB)
📄
sha384.h
(2.94 KB)
📄
sha512.h
(3.02 KB)
📄
sha512t.h
(4.6 KB)
📄
signal.h
(4.42 KB)
📄
skein.h
(15.95 KB)
📄
skein_freebsd.h
(3.85 KB)
📄
skein_iv.h
(5.54 KB)
📄
skein_port.h
(5.17 KB)
📄
spawn.h
(4.26 KB)
📄
stab.h
(3.07 KB)
📄
stdalign.h
(1.81 KB)
📄
stdarg.h
(87 B)
📄
stdatomic.h
(13.94 KB)
📄
stdbool.h
(1.64 KB)
📄
stddef.h
(2.59 KB)
📄
stdint.h
(2.63 KB)
📄
stdio.h
(16.92 KB)
📄
stdlib.h
(11.23 KB)
📄
stdnoreturn.h
(1.59 KB)
📄
string.h
(5.32 KB)
📄
string_m.h
(1.72 KB)
📄
stringlist.h
(1.83 KB)
📄
strings.h
(2.47 KB)
📁
sys
📄
sysdecode.h
(6.59 KB)
📄
sysexits.h
(5.17 KB)
📄
syslog.h
(7.25 KB)
📄
taclib.h
(5.28 KB)
📄
tar.h
(2.9 KB)
📄
tcpd.h
(8.18 KB)
📁
teken
📄
term.h
(40.4 KB)
📄
termcap.h
(3.39 KB)
📄
termios.h
(3.28 KB)
📄
tgmath.h
(8.85 KB)
📄
thread_db.h
(6.36 KB)
📄
thread_pool_impl.h
(2.76 KB)
📄
threads.h
(3.56 KB)
📄
time.h
(7.07 KB)
📄
timeconv.h
(2.42 KB)
📄
timers.h
(1.97 KB)
📄
ttyent.h
(2.95 KB)
📄
uchar.h
(2.3 KB)
📄
ucontext.h
(2.91 KB)
📁
ufs
📄
ugidfw.h
(2.68 KB)
📄
ulimit.h
(1.58 KB)
📄
ulog.h
(1.67 KB)
📄
unctrl.h
(3.1 KB)
📄
unistd.h
(18.71 KB)
📄
usb.h
(9.48 KB)
📄
usbhid.h
(3.75 KB)
📄
utempter.h
(1.76 KB)
📄
utime.h
(2.01 KB)
📄
utmpx.h
(3.03 KB)
📄
uuid.h
(2.43 KB)
📄
varargs.h
(1.54 KB)
📄
vgl.h
(5.59 KB)
📄
vis.h
(4.48 KB)
📁
vm
📄
vmmapi.h
(10.49 KB)
📄
wchar.h
(8.81 KB)
📄
wctype.h
(3.89 KB)
📄
wind.h
(3.09 KB)
📄
wind_err.h
(860 B)
📄
wordexp.h
(2.75 KB)
📁
x86
📄
xdbm.h
(1.91 KB)
📁
xlocale
📄
xlocale.h
(2.23 KB)
📄
ypclnt.h
(2.33 KB)
📄
zconf.h
(16.24 KB)
📄
zdb.h
(1.02 KB)
📄
zinject.h
(2.14 KB)
📄
zlib.h
(94.08 KB)
📄
zstream.h
(820 B)
📄
zutil_import.h
(2.51 KB)
Editing: libusb20_desc.h
/* $FreeBSD$ */ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * Copyright (c) 2007-2008 Daniel Drake. All rights reserved. * Copyright (c) 2001 Johannes Erdfelt. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ /* * NOTE: This file contains the definition of some standard USB * structures. All structures which name ends by *DECODED use host byte * order. */ /* * NOTE: This file uses a lot of macros. If you want to see what the * macros become when they are expanded then run the following * commands from your shell: * * cpp libusb20_desc.h > temp.h * indent temp.h * less temp.h */ #ifndef _LIBUSB20_DESC_H_ #define _LIBUSB20_DESC_H_ #ifndef LIBUSB_GLOBAL_INCLUDE_FILE #include <stdint.h> #endif #ifdef __cplusplus extern "C" { #endif #if 0 }; /* style */ #endif /* basic macros */ #define LIBUSB20__NOT(...) __VA_ARGS__ #define LIBUSB20_NOT(arg) LIBUSB20__NOT(LIBUSB20_YES arg(() LIBUSB20_NO)) #define LIBUSB20_YES(...) __VA_ARGS__ #define LIBUSB20_NO(...) #define LIBUSB20_END(...) __VA_ARGS__ #define LIBUSB20_MAX(a,b) (((a) > (b)) ? (a) : (b)) #define LIBUSB20_MIN(a,b) (((a) < (b)) ? (a) : (b)) #define LIBUSB20_ADD_BYTES(ptr,off) \ ((void *)(((const uint8_t *)(ptr)) + (off) - ((const uint8_t *)0))) /* basic message elements */ enum { LIBUSB20_ME_INT8, LIBUSB20_ME_INT16, LIBUSB20_ME_INT32, LIBUSB20_ME_INT64, LIBUSB20_ME_STRUCT, LIBUSB20_ME_MAX, /* used to indicate end */ }; /* basic message element modifiers */ enum { LIBUSB20_ME_IS_UNSIGNED = 0x00, LIBUSB20_ME_IS_SIGNED = 0x80, LIBUSB20_ME_MASK = 0x7F, }; enum { LIBUSB20_ME_IS_RAW, /* structure excludes length field * (hardcoded value) */ LIBUSB20_ME_IS_ENCODED, /* structure includes length field */ LIBUSB20_ME_IS_EMPTY, /* no structure */ LIBUSB20_ME_IS_DECODED, /* structure is recursive */ }; /* basic helper structures and macros */ #define LIBUSB20_ME_STRUCT_ALIGN sizeof(void *) struct libusb20_me_struct { void *ptr; /* data pointer */ uint16_t len; /* defaults to zero */ uint16_t type; /* defaults to LIBUSB20_ME_IS_EMPTY */ } __aligned(LIBUSB20_ME_STRUCT_ALIGN); struct libusb20_me_format { const uint8_t *format; /* always set */ const char *desc; /* optionally set */ const char *fields; /* optionally set */ }; #define LIBUSB20_ME_STRUCT(n, field, arg, ismeta) \ ismeta ( LIBUSB20_ME_STRUCT, 1, 0, ) \ LIBUSB20_NOT(ismeta) ( struct libusb20_me_struct field; ) #define LIBUSB20_ME_STRUCT_ARRAY(n, field, arg, ismeta) \ ismeta ( LIBUSB20_ME_STRUCT , (arg) & 0xFF, \ ((arg) / 0x100) & 0xFF, ) \ LIBUSB20_NOT(ismeta) ( struct libusb20_me_struct field [arg]; ) #define LIBUSB20_ME_INTEGER(n, field, ismeta, un, u, bits, a, size) \ ismeta ( LIBUSB20_ME_INT##bits | \ LIBUSB20_ME_IS_##un##SIGNED , \ (size) & 0xFF, ((size) / 0x100) & 0xFF, ) \ LIBUSB20_NOT(ismeta) ( u##int##bits##_t \ __aligned((bits) / 8) field a; ) #define LIBUSB20_ME_UINT8_T(n, field, arg, ismeta) \ LIBUSB20_ME_INTEGER(n, field, ismeta, UN, u, 8, , 1) #define LIBUSB20_ME_UINT8_ARRAY_T(n, field, arg, ismeta) \ LIBUSB20_ME_INTEGER(n, field, ismeta, UN, u, 8, [arg], arg) #define LIBUSB20_ME_SINT8_T(n, field, arg, ismeta) \ LIBUSB20_ME_INTEGER(n, field, ismeta,,, 8, , 1) #define LIBUSB20_ME_SINT8_ARRAY_T(n, field, arg, ismeta) \ LIBUSB20_ME_INTEGER(n, field, ismeta,,, 8, [arg], arg) #define LIBUSB20_ME_UINT16_T(n, field, arg, ismeta) \ LIBUSB20_ME_INTEGER(n, field, ismeta, UN, u, 16, , 1) #define LIBUSB20_ME_UINT16_ARRAY_T(n, field, arg, ismeta) \ LIBUSB20_ME_INTEGER(n, field, ismeta, UN, u, 16, [arg], arg) #define LIBUSB20_ME_SINT16_T(n, field, arg, ismeta) \ LIBUSB20_ME_INTEGER(n, field, ismeta,,, 16, , 1) #define LIBUSB20_ME_SINT16_ARRAY_T(n, field, arg, ismeta) \ LIBUSB20_ME_INTEGER(n, field, ismeta,,, 16, [arg], arg) #define LIBUSB20_ME_UINT32_T(n, field, arg, ismeta) \ LIBUSB20_ME_INTEGER(n, field, ismeta, UN, u, 32, , 1) #define LIBUSB20_ME_UINT32_ARRAY_T(n, field, arg, ismeta) \ LIBUSB20_ME_INTEGER(n, field, ismeta, UN, u, 32, [arg], arg) #define LIBUSB20_ME_SINT32_T(n, field, arg, ismeta) \ LIBUSB20_ME_INTEGER(n, field, ismeta,,, 32, , 1) #define LIBUSB20_ME_SINT32_ARRAY_T(n, field, arg, ismeta) \ LIBUSB20_ME_INTEGER(n, field, ismeta,,, 32, [arg], arg) #define LIBUSB20_ME_UINT64_T(n, field, arg, ismeta) \ LIBUSB20_ME_INTEGER(n, field, ismeta, UN, u, 64, , 1) #define LIBUSB20_ME_UINT64_ARRAY_T(n, field, arg, ismeta) \ LIBUSB20_ME_INTEGER(n, field, ismeta, UN, u, 64, [arg], arg) #define LIBUSB20_ME_SINT64_T(n, field, arg, ismeta) \ LIBUSB20_ME_INTEGER(n, field, ismeta,,, 64, , 1) #define LIBUSB20_ME_SINT64_ARRAY_T(n, field, arg, ismeta) \ LIBUSB20_ME_INTEGER(n, field, ismeta,,, 64, [arg], arg) #define LIBUSB20_MAKE_DECODED_FIELD(n, type, field, arg) \ LIBUSB20_ME_##type (n, field, arg, LIBUSB20_NO) #define LIBUSB20_MAKE_STRUCT(name) \ extern const struct libusb20_me_format \ name##_FORMAT[1]; \ struct name##_DECODED { \ const struct libusb20_me_format *name##_FORMAT; \ name (LIBUSB20_MAKE_DECODED_FIELD,) \ } #define LIBUSB20_MAKE_STRUCT_FORMAT(name) \ const struct libusb20_me_format \ name##_FORMAT[1] = {{ \ .format = LIBUSB20_MAKE_FORMAT(name), \ .desc = #name, \ .fields = NULL, \ }} #define LIBUSB20_MAKE_FORMAT_SUB(n, type, field, arg) \ LIBUSB20_ME_##type (n, field, arg, LIBUSB20_YES) #define LIBUSB20_MAKE_FORMAT(what) (const uint8_t []) \ { what (LIBUSB20_MAKE_FORMAT_SUB, ) LIBUSB20_ME_MAX, 0, 0 } #define LIBUSB20_INIT(what, ptr) do { \ memset(ptr, 0, sizeof(*(ptr))); \ (ptr)->what##_FORMAT = what##_FORMAT; \ } while (0) #define LIBUSB20_DEVICE_DESC(m,n) \ m(n, UINT8_T, bLength, ) \ m(n, UINT8_T, bDescriptorType, ) \ m(n, UINT16_T, bcdUSB, ) \ m(n, UINT8_T, bDeviceClass, ) \ m(n, UINT8_T, bDeviceSubClass, ) \ m(n, UINT8_T, bDeviceProtocol, ) \ m(n, UINT8_T, bMaxPacketSize0, ) \ m(n, UINT16_T, idVendor, ) \ m(n, UINT16_T, idProduct, ) \ m(n, UINT16_T, bcdDevice, ) \ m(n, UINT8_T, iManufacturer, ) \ m(n, UINT8_T, iProduct, ) \ m(n, UINT8_T, iSerialNumber, ) \ m(n, UINT8_T, bNumConfigurations, ) \ LIBUSB20_MAKE_STRUCT(LIBUSB20_DEVICE_DESC); #define LIBUSB20_ENDPOINT_DESC(m,n) \ m(n, UINT8_T, bLength, ) \ m(n, UINT8_T, bDescriptorType, ) \ m(n, UINT8_T, bEndpointAddress, ) \ m(n, UINT8_T, bmAttributes, ) \ m(n, UINT16_T, wMaxPacketSize, ) \ m(n, UINT8_T, bInterval, ) \ m(n, UINT8_T, bRefresh, ) \ m(n, UINT8_T, bSynchAddress, ) \ LIBUSB20_MAKE_STRUCT(LIBUSB20_ENDPOINT_DESC); #define LIBUSB20_INTERFACE_DESC(m,n) \ m(n, UINT8_T, bLength, ) \ m(n, UINT8_T, bDescriptorType, ) \ m(n, UINT8_T, bInterfaceNumber, ) \ m(n, UINT8_T, bAlternateSetting, ) \ m(n, UINT8_T, bNumEndpoints, ) \ m(n, UINT8_T, bInterfaceClass, ) \ m(n, UINT8_T, bInterfaceSubClass, ) \ m(n, UINT8_T, bInterfaceProtocol, ) \ m(n, UINT8_T, iInterface, ) \ LIBUSB20_MAKE_STRUCT(LIBUSB20_INTERFACE_DESC); #define LIBUSB20_CONFIG_DESC(m,n) \ m(n, UINT8_T, bLength, ) \ m(n, UINT8_T, bDescriptorType, ) \ m(n, UINT16_T, wTotalLength, ) \ m(n, UINT8_T, bNumInterfaces, ) \ m(n, UINT8_T, bConfigurationValue, ) \ m(n, UINT8_T, iConfiguration, ) \ m(n, UINT8_T, bmAttributes, ) \ m(n, UINT8_T, bMaxPower, ) \ LIBUSB20_MAKE_STRUCT(LIBUSB20_CONFIG_DESC); #define LIBUSB20_CONTROL_SETUP(m,n) \ m(n, UINT8_T, bmRequestType, ) \ m(n, UINT8_T, bRequest, ) \ m(n, UINT16_T, wValue, ) \ m(n, UINT16_T, wIndex, ) \ m(n, UINT16_T, wLength, ) \ LIBUSB20_MAKE_STRUCT(LIBUSB20_CONTROL_SETUP); #define LIBUSB20_SS_ENDPT_COMP_DESC(m,n) \ m(n, UINT8_T, bLength, ) \ m(n, UINT8_T, bDescriptorType, ) \ m(n, UINT8_T, bMaxBurst, ) \ m(n, UINT8_T, bmAttributes, ) \ m(n, UINT16_T, wBytesPerInterval, ) \ LIBUSB20_MAKE_STRUCT(LIBUSB20_SS_ENDPT_COMP_DESC); #define LIBUSB20_USB_20_DEVCAP_DESC(m,n) \ m(n, UINT8_T, bLength, ) \ m(n, UINT8_T, bDescriptorType, ) \ m(n, UINT8_T, bDevCapabilityType, ) \ m(n, UINT32_T, bmAttributes, ) \ LIBUSB20_MAKE_STRUCT(LIBUSB20_USB_20_DEVCAP_DESC); #define LIBUSB20_SS_USB_DEVCAP_DESC(m,n) \ m(n, UINT8_T, bLength, ) \ m(n, UINT8_T, bDescriptorType, ) \ m(n, UINT8_T, bDevCapabilityType, ) \ m(n, UINT8_T, bmAttributes, ) \ m(n, UINT16_T, wSpeedSupported, ) \ m(n, UINT8_T, bFunctionalitySupport, ) \ m(n, UINT8_T, bU1DevExitLat, ) \ m(n, UINT16_T, wU2DevExitLat, ) \ LIBUSB20_MAKE_STRUCT(LIBUSB20_SS_USB_DEVCAP_DESC); #define LIBUSB20_BOS_DESCRIPTOR(m,n) \ m(n, UINT8_T, bLength, ) \ m(n, UINT8_T, bDescriptorType, ) \ m(n, UINT16_T, wTotalLength, ) \ m(n, UINT8_T, bNumDeviceCapabilities, ) \ LIBUSB20_MAKE_STRUCT(LIBUSB20_BOS_DESCRIPTOR); /* standard USB stuff */ /** \ingroup desc * Device and/or Interface Class codes */ enum libusb20_class_code { /** In the context of a \ref LIBUSB20_DEVICE_DESC "device * descriptor", this bDeviceClass value indicates that each * interface specifies its own class information and all * interfaces operate independently. */ LIBUSB20_CLASS_PER_INTERFACE = 0, /** Audio class */ LIBUSB20_CLASS_AUDIO = 1, /** Communications class */ LIBUSB20_CLASS_COMM = 2, /** Human Interface Device class */ LIBUSB20_CLASS_HID = 3, /** Printer dclass */ LIBUSB20_CLASS_PRINTER = 7, /** Picture transfer protocol class */ LIBUSB20_CLASS_PTP = 6, /** Mass storage class */ LIBUSB20_CLASS_MASS_STORAGE = 8, /** Hub class */ LIBUSB20_CLASS_HUB = 9, /** Data class */ LIBUSB20_CLASS_DATA = 10, /** Class is vendor-specific */ LIBUSB20_CLASS_VENDOR_SPEC = 0xff, }; /** \ingroup desc * Descriptor types as defined by the USB specification. */ enum libusb20_descriptor_type { /** Device descriptor. See LIBUSB20_DEVICE_DESC. */ LIBUSB20_DT_DEVICE = 0x01, /** Configuration descriptor. See LIBUSB20_CONFIG_DESC. */ LIBUSB20_DT_CONFIG = 0x02, /** String descriptor */ LIBUSB20_DT_STRING = 0x03, /** Interface descriptor. See LIBUSB20_INTERFACE_DESC. */ LIBUSB20_DT_INTERFACE = 0x04, /** Endpoint descriptor. See LIBUSB20_ENDPOINT_DESC. */ LIBUSB20_DT_ENDPOINT = 0x05, /** HID descriptor */ LIBUSB20_DT_HID = 0x21, /** HID report descriptor */ LIBUSB20_DT_REPORT = 0x22, /** Physical descriptor */ LIBUSB20_DT_PHYSICAL = 0x23, /** Hub descriptor */ LIBUSB20_DT_HUB = 0x29, /** Binary Object Store, BOS */ LIBUSB20_DT_BOS = 0x0f, /** Device Capability */ LIBUSB20_DT_DEVICE_CAPABILITY = 0x10, /** SuperSpeed endpoint companion */ LIBUSB20_DT_SS_ENDPOINT_COMPANION = 0x30, }; /** \ingroup desc * Device capability types as defined by the USB specification. */ enum libusb20_device_capability_type { LIBUSB20_WIRELESS_USB_DEVICE_CAPABILITY = 0x1, LIBUSB20_USB_2_0_EXTENSION_DEVICE_CAPABILITY = 0x2, LIBUSB20_SS_USB_DEVICE_CAPABILITY = 0x3, LIBUSB20_CONTAINER_ID_DEVICE_CAPABILITY = 0x4, }; /* Descriptor sizes per descriptor type */ #define LIBUSB20_DT_DEVICE_SIZE 18 #define LIBUSB20_DT_CONFIG_SIZE 9 #define LIBUSB20_DT_INTERFACE_SIZE 9 #define LIBUSB20_DT_ENDPOINT_SIZE 7 #define LIBUSB20_DT_ENDPOINT_AUDIO_SIZE 9 /* Audio extension */ #define LIBUSB20_DT_HUB_NONVAR_SIZE 7 #define LIBUSB20_DT_SS_ENDPOINT_COMPANION_SIZE 6 #define LIBUSB20_DT_BOS_SIZE 5 #define LIBUSB20_USB_2_0_EXTENSION_DEVICE_CAPABILITY_SIZE 7 #define LIBUSB20_SS_USB_DEVICE_CAPABILITY_SIZE 10 #define LIBUSB20_ENDPOINT_ADDRESS_MASK 0x0f /* in bEndpointAddress */ #define LIBUSB20_ENDPOINT_DIR_MASK 0x80 /** \ingroup desc * Endpoint direction. Values for bit 7 of the * \ref LIBUSB20_ENDPOINT_DESC::bEndpointAddress "endpoint address" scheme. */ enum libusb20_endpoint_direction { /** In: device-to-host */ LIBUSB20_ENDPOINT_IN = 0x80, /** Out: host-to-device */ LIBUSB20_ENDPOINT_OUT = 0x00, }; #define LIBUSB20_TRANSFER_TYPE_MASK 0x03 /* in bmAttributes */ /** \ingroup desc * Endpoint transfer type. Values for bits 0:1 of the * \ref LIBUSB20_ENDPOINT_DESC::bmAttributes "endpoint attributes" field. */ enum libusb20_transfer_type { /** Control endpoint */ LIBUSB20_TRANSFER_TYPE_CONTROL = 0, /** Isochronous endpoint */ LIBUSB20_TRANSFER_TYPE_ISOCHRONOUS = 1, /** Bulk endpoint */ LIBUSB20_TRANSFER_TYPE_BULK = 2, /** Interrupt endpoint */ LIBUSB20_TRANSFER_TYPE_INTERRUPT = 3, }; /** \ingroup misc * Standard requests, as defined in table 9-3 of the USB2 specifications */ enum libusb20_standard_request { /** Request status of the specific recipient */ LIBUSB20_REQUEST_GET_STATUS = 0x00, /** Clear or disable a specific feature */ LIBUSB20_REQUEST_CLEAR_FEATURE = 0x01, /* 0x02 is reserved */ /** Set or enable a specific feature */ LIBUSB20_REQUEST_SET_FEATURE = 0x03, /* 0x04 is reserved */ /** Set device address for all future accesses */ LIBUSB20_REQUEST_SET_ADDRESS = 0x05, /** Get the specified descriptor */ LIBUSB20_REQUEST_GET_DESCRIPTOR = 0x06, /** Used to update existing descriptors or add new descriptors */ LIBUSB20_REQUEST_SET_DESCRIPTOR = 0x07, /** Get the current device configuration value */ LIBUSB20_REQUEST_GET_CONFIGURATION = 0x08, /** Set device configuration */ LIBUSB20_REQUEST_SET_CONFIGURATION = 0x09, /** Return the selected alternate setting for the specified * interface */ LIBUSB20_REQUEST_GET_INTERFACE = 0x0A, /** Select an alternate interface for the specified interface */ LIBUSB20_REQUEST_SET_INTERFACE = 0x0B, /** Set then report an endpoint's synchronization frame */ LIBUSB20_REQUEST_SYNCH_FRAME = 0x0C, /** Set U1 and U2 system exit latency */ LIBUSB20_REQUEST_SET_SEL = 0x30, /** Set isochronous delay */ LIBUSB20_REQUEST_SET_ISOCH_DELAY = 0x31, }; /** \ingroup misc * Request type bits of the * \ref libusb20_control_setup::bmRequestType "bmRequestType" field in * control transfers. */ enum libusb20_request_type { /** Standard */ LIBUSB20_REQUEST_TYPE_STANDARD = (0x00 << 5), /** Class */ LIBUSB20_REQUEST_TYPE_CLASS = (0x01 << 5), /** Vendor */ LIBUSB20_REQUEST_TYPE_VENDOR = (0x02 << 5), /** Reserved */ LIBUSB20_REQUEST_TYPE_RESERVED = (0x03 << 5), }; /** \ingroup misc * Recipient bits of the * \ref libusb20_control_setup::bmRequestType "bmRequestType" field in * control transfers. Values 4 through 31 are reserved. */ enum libusb20_request_recipient { /** Device */ LIBUSB20_RECIPIENT_DEVICE = 0x00, /** Interface */ LIBUSB20_RECIPIENT_INTERFACE = 0x01, /** Endpoint */ LIBUSB20_RECIPIENT_ENDPOINT = 0x02, /** Other */ LIBUSB20_RECIPIENT_OTHER = 0x03, }; #define LIBUSB20_ISO_SYNC_TYPE_MASK 0x0C /** \ingroup desc * Synchronization type for isochronous endpoints. Values for bits 2:3 * of the \ref LIBUSB20_ENDPOINT_DESC::bmAttributes "bmAttributes" * field in LIBUSB20_ENDPOINT_DESC. */ enum libusb20_iso_sync_type { /** No synchronization */ LIBUSB20_ISO_SYNC_TYPE_NONE = 0, /** Asynchronous */ LIBUSB20_ISO_SYNC_TYPE_ASYNC = 1, /** Adaptive */ LIBUSB20_ISO_SYNC_TYPE_ADAPTIVE = 2, /** Synchronous */ LIBUSB20_ISO_SYNC_TYPE_SYNC = 3, }; #define LIBUSB20_ISO_USAGE_TYPE_MASK 0x30 /** \ingroup desc * Usage type for isochronous endpoints. Values for bits 4:5 of the * \ref LIBUSB20_ENDPOINT_DESC::bmAttributes "bmAttributes" field in * LIBUSB20_ENDPOINT_DESC. */ enum libusb20_iso_usage_type { /** Data endpoint */ LIBUSB20_ISO_USAGE_TYPE_DATA = 0, /** Feedback endpoint */ LIBUSB20_ISO_USAGE_TYPE_FEEDBACK = 1, /** Implicit feedback Data endpoint */ LIBUSB20_ISO_USAGE_TYPE_IMPLICIT = 2, }; struct libusb20_endpoint { struct LIBUSB20_ENDPOINT_DESC_DECODED desc; struct libusb20_me_struct extra; } __aligned(sizeof(void *)); struct libusb20_interface { struct LIBUSB20_INTERFACE_DESC_DECODED desc; struct libusb20_me_struct extra; struct libusb20_interface *altsetting; struct libusb20_endpoint *endpoints; uint8_t num_altsetting; uint8_t num_endpoints; } __aligned(sizeof(void *)); struct libusb20_config { struct LIBUSB20_CONFIG_DESC_DECODED desc; struct libusb20_me_struct extra; struct libusb20_interface *interface; uint8_t num_interface; } __aligned(sizeof(void *)); uint8_t libusb20_me_get_1(const struct libusb20_me_struct *ie, uint16_t offset); uint16_t libusb20_me_get_2(const struct libusb20_me_struct *ie, uint16_t offset); uint16_t libusb20_me_encode(void *ptr, uint16_t len, const void *pd); uint16_t libusb20_me_decode(const void *ptr, uint16_t len, void *pd); const uint8_t *libusb20_desc_foreach(const struct libusb20_me_struct *pdesc, const uint8_t *psubdesc); struct libusb20_config *libusb20_parse_config_desc(const void *config_desc); #if 0 { /* style */ #endif #ifdef __cplusplus } #endif #endif /* _LIBUSB20_DESC_H_ */
Upload File
Create Folder