source: mainline/uspace/lib/usbdev/include/usb/dev/dp.h@ 34b2f54d

Last change on this file since 34b2f54d was d7f7a4a, checked in by Jiří Zárevúcky <zarevucky.jiri@…>, 3 years ago

Replace some license headers with SPDX identifier

Headers are replaced using tools/transorm-copyright.sh only
when it can be matched verbatim with the license header used
throughout most of the codebase.

  • Property mode set to 100644
File size: 1.5 KB
Line 
1/*
2 * SPDX-FileCopyrightText: 2011 Vojtech Horky
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7/** @addtogroup libusbdev
8 * @{
9 */
10/** @file
11 * USB descriptor parser.
12 */
13#ifndef LIBUSBDEV_DP_H_
14#define LIBUSBDEV_DP_H_
15
16#include <stddef.h>
17#include <stdint.h>
18
19/** USB descriptors nesting.
20 * The nesting describes the logical tree USB descriptors form
21 * (e.g. that endpoint descriptor belongs to interface or that
22 * interface belongs to configuration).
23 *
24 * See usb_descriptor_type_t for descriptor constants.
25 */
26typedef struct {
27 /** Child descriptor id. */
28 int child;
29 /** Parent descriptor id. */
30 int parent;
31} usb_dp_descriptor_nesting_t;
32
33extern const usb_dp_descriptor_nesting_t usb_dp_standard_descriptor_nesting[];
34
35/** Descriptor parser structure. */
36typedef struct {
37 /** Used descriptor nesting. */
38 const usb_dp_descriptor_nesting_t *nesting;
39} usb_dp_parser_t;
40
41/** Descriptor parser data. */
42typedef struct {
43 /** Data to be parsed. */
44 const uint8_t *data;
45 /** Size of input data in bytes. */
46 size_t size;
47 /** Custom argument. */
48 void *arg;
49} usb_dp_parser_data_t;
50
51typedef void (*walk_callback_t)(const uint8_t *, size_t, void *);
52
53const uint8_t *usb_dp_get_nested_descriptor(const usb_dp_parser_t *,
54 const usb_dp_parser_data_t *, const uint8_t *);
55const uint8_t *usb_dp_get_sibling_descriptor(const usb_dp_parser_t *,
56 const usb_dp_parser_data_t *, const uint8_t *, const uint8_t *);
57
58void usb_dp_walk_simple(const uint8_t *, size_t,
59 const usb_dp_descriptor_nesting_t *, walk_callback_t, void *);
60
61#endif
62/**
63 * @}
64 */
Note: See TracBrowser for help on using the repository browser.