XenevaOS
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Enumerations | Functions
usb_desc.h File Reference
#include <stdint.h>
Include dependency graph for usb_desc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _dev_desc_
 
struct  _string_desc_
 
struct  _interface_desc_
 
struct  _qualifier_desc_
 
struct  _config_desc_
 
struct  _usb_desc_
 
struct  _usb_hub_
 
struct  _usb_ep_desc_
 
struct  usb_port_status_t
 

Macros

#define DESCRIPTOR_TYPE_CONFIG   2
 
#define DESCRIPTOR_TYPE_INTERFACE   4
 
#define DESCRIPTOR_TYPE_ENDPOINT   5
 
#define USB_EP_TYPE_CONTROL   0x00
 
#define USB_EP_TYPE_ISOC   0x01
 
#define USB_EP_TYPE_BULK   0x02
 
#define USB_EP_TYPE_INTERRUPT   0x03
 
#define REQUEST_OUT   0
 
#define REQUEST_IN   0x80
 
#define REQUEST_CLASS   0x20
 
#define REQUEST_VENDOR   0x40
 
#define REQUEST_TO_INTERFACE   1
 
#define REQUEST_TO_OTHER   3
 
#define GET_STATUS   0
 
#define CLEAR_FEATURE   1
 
#define SET_FEATURE   3
 
#define SET_ADDRESS   5
 
#define GET_DESCRIPTOR   6
 
#define SET_CONFIGURATION   9
 
#define SET_INTERFACE   11
 
#define PORT_STATUS_CONNECTION   (1<<0)
 
#define PORT_STATUS_ENABLED   (1<<1)
 
#define PORT_STATUS_SUSPEND   (1<<2)
 
#define PORT_STATUS_OVERCURRENT   (1<<3)
 
#define PORT_STATUS_RESET   (1<<4)
 
#define PORT_STATUS_POWER   (1<<8)
 
#define PORT_STATUS_LOW_SPEED   (1<<9)
 
#define PORT_STATUS_HIGH_SPEED   (1<<10)
 
#define PORT_STATUS_TEST   (1<<11)
 
#define PORT_STATUS_INDICATOR   (1<<12)
 
#define PORT_RESET   4
 
#define PORT_POWER   8
 

Typedefs

typedef struct _dev_desc_ usb_dev_desc_t
 
typedef struct _string_desc_ usb_string_desc_t
 
typedef struct _interface_desc_ usb_if_desc_t
 
typedef struct _qualifier_desc_ usb_qualifier_desc_t
 
typedef struct _config_desc_ usb_config_desc_t
 
typedef struct _usb_desc_ usb_descriptor_t
 
typedef struct _usb_hub_ usb_hub_desc_t
 
typedef struct _usb_ep_desc_ usb_ep_desc_t
 

Enumerations

enum  { USBSpeedLow , USBSpeedFull , USBSpeedHigh , USBSpeedUnknown }
 

Functions

usb_descriptor_tdwc2_get_descriptor (void *desc, uint8_t type)
 dwc2_get_descriptor – find a descriptor within descriptor config area
 

Detailed Description

BSD 2-Clause License

Copyright (c) 2022-2026, Manas Kamal Choudhury 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 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 HOLDER 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.

Macro Definition Documentation

◆ CLEAR_FEATURE

#define CLEAR_FEATURE   1

◆ DESCRIPTOR_TYPE_CONFIG

#define DESCRIPTOR_TYPE_CONFIG   2

◆ DESCRIPTOR_TYPE_ENDPOINT

#define DESCRIPTOR_TYPE_ENDPOINT   5

◆ DESCRIPTOR_TYPE_INTERFACE

#define DESCRIPTOR_TYPE_INTERFACE   4

◆ GET_DESCRIPTOR

#define GET_DESCRIPTOR   6

◆ GET_STATUS

#define GET_STATUS   0

◆ PORT_POWER

#define PORT_POWER   8

◆ PORT_RESET

#define PORT_RESET   4

◆ PORT_STATUS_CONNECTION

#define PORT_STATUS_CONNECTION   (1<<0)

◆ PORT_STATUS_ENABLED

#define PORT_STATUS_ENABLED   (1<<1)

◆ PORT_STATUS_HIGH_SPEED

#define PORT_STATUS_HIGH_SPEED   (1<<10)

◆ PORT_STATUS_INDICATOR

#define PORT_STATUS_INDICATOR   (1<<12)

◆ PORT_STATUS_LOW_SPEED

#define PORT_STATUS_LOW_SPEED   (1<<9)

◆ PORT_STATUS_OVERCURRENT

#define PORT_STATUS_OVERCURRENT   (1<<3)

◆ PORT_STATUS_POWER

#define PORT_STATUS_POWER   (1<<8)

◆ PORT_STATUS_RESET

#define PORT_STATUS_RESET   (1<<4)

◆ PORT_STATUS_SUSPEND

#define PORT_STATUS_SUSPEND   (1<<2)

◆ PORT_STATUS_TEST

#define PORT_STATUS_TEST   (1<<11)

◆ REQUEST_CLASS

#define REQUEST_CLASS   0x20

◆ REQUEST_IN

#define REQUEST_IN   0x80

◆ REQUEST_OUT

#define REQUEST_OUT   0

◆ REQUEST_TO_INTERFACE

#define REQUEST_TO_INTERFACE   1

◆ REQUEST_TO_OTHER

#define REQUEST_TO_OTHER   3

◆ REQUEST_VENDOR

#define REQUEST_VENDOR   0x40

◆ SET_ADDRESS

#define SET_ADDRESS   5

◆ SET_CONFIGURATION

#define SET_CONFIGURATION   9

◆ SET_FEATURE

#define SET_FEATURE   3

◆ SET_INTERFACE

#define SET_INTERFACE   11

◆ USB_EP_TYPE_BULK

#define USB_EP_TYPE_BULK   0x02

◆ USB_EP_TYPE_CONTROL

#define USB_EP_TYPE_CONTROL   0x00

◆ USB_EP_TYPE_INTERRUPT

#define USB_EP_TYPE_INTERRUPT   0x03

◆ USB_EP_TYPE_ISOC

#define USB_EP_TYPE_ISOC   0x01

Typedef Documentation

◆ usb_config_desc_t

◆ usb_descriptor_t

typedef struct _usb_desc_ usb_descriptor_t

◆ usb_dev_desc_t

typedef struct _dev_desc_ usb_dev_desc_t

◆ usb_ep_desc_t

typedef struct _usb_ep_desc_ usb_ep_desc_t

◆ usb_hub_desc_t

typedef struct _usb_hub_ usb_hub_desc_t

◆ usb_if_desc_t

◆ usb_qualifier_desc_t

◆ usb_string_desc_t

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
USBSpeedLow 
USBSpeedFull 
USBSpeedHigh 
USBSpeedUnknown 

Function Documentation

◆ dwc2_get_descriptor()

usb_descriptor_t * dwc2_get_descriptor ( void *  desc,
uint8_t  type 
)
extern

dwc2_get_descriptor – find a descriptor within descriptor config area

Parameters
desc– pointer to config descriptor
type– type of the descriptor