#include <stdio.h>
#include <str_error.h>
#include <errno.h>
#include <assert.h>
#include <bool.h>
#include <usb/dev/dp.h>
#include <usb/descriptor.h>
Go to the source code of this file.
Defines | |
#define | LAST_NESTING { -1, -1 } |
#define | NESTING(parentname, childname) |
Functions | |
static int | get_descriptor_type (usb_dp_parser_data_t *data, uint8_t *start) |
Get descriptor type. | |
static uint8_t * | get_next_descriptor (usb_dp_parser_data_t *data, uint8_t *current) |
Get next descriptor regardless of the nesting. | |
static bool | is_nested_descriptor (usb_dp_parser_t *parser, usb_dp_parser_data_t *data, uint8_t *child, uint8_t *parent) |
Tells whether descriptors could be nested. | |
static bool | is_nested_descriptor_type (usb_dp_parser_t *parser, int child, int parent) |
Tells whether descriptors could be nested. | |
static bool | is_valid_descriptor_pointer (usb_dp_parser_data_t *data, uint8_t *ptr) |
Tells whether pointer points inside descriptor data. | |
static uint8_t * | skip_nested_descriptors (usb_dp_parser_t *parser, usb_dp_parser_data_t *data, uint8_t *parent) |
Skip all nested descriptors. | |
static void | usb_dp_browse_simple_internal (usb_dp_parser_t *parser, usb_dp_parser_data_t *data, uint8_t *root, size_t depth, void(*callback)(uint8_t *, size_t, void *), void *arg) |
Browser of the descriptor tree. | |
uint8_t * | usb_dp_get_nested_descriptor (usb_dp_parser_t *parser, usb_dp_parser_data_t *data, uint8_t *parent) |
Find first nested descriptor of given parent. | |
uint8_t * | usb_dp_get_sibling_descriptor (usb_dp_parser_t *parser, usb_dp_parser_data_t *data, uint8_t *parent, uint8_t *sibling) |
Get sibling descriptor. | |
void | usb_dp_walk_simple (uint8_t *descriptors, size_t descriptors_size, usb_dp_descriptor_nesting_t *descriptor_nesting, void(*callback)(uint8_t *, size_t, void *), void *arg) |
Browse flatten descriptor tree. | |
Variables | |
usb_dp_descriptor_nesting_t | usb_dp_standard_descriptor_nesting [] |
Nesting of standard USB descriptors. |
The descriptor parser is a generic parser for structure, where individual items are stored in single buffer and each item begins with length followed by type. These types are organized into tree hierarchy.
The parser is able of only two actions: find first child and find next sibling.
Definition in file dp.c.