Skip to content

File usb_descriptors.c

FileList > neuralSPOT > neuralspot > ns-usb > src > overrides > usb_descriptors.c

Go to the source code of this file

  • #include "tusb.h"
  • #include "usb_descriptors.h"

Public Types

Type Name
enum @2

Public Attributes

Type Name
uint8_t const desc_bos = = {
TUD\_BOS\_DESCRIPTOR(BOS\_TOTAL\_LEN, 2),


TUD\_BOS\_WEBUSB\_DESCRIPTOR(VENDOR\_REQUEST\_WEBUSB, 1),


TUD\_BOS\_MS\_OS\_20\_DESCRIPTOR(MS\_OS\_20\_DESC\_LEN, VENDOR\_REQUEST\_MICROSOFT)}<br> |

| tusb_desc_device_t const | desc_device = = { .bLength = sizeof(tusb_desc_device_t), .bDescriptorType = TUSB_DESC_DEVICE, .bcdUSB = 0x0210,

.bDeviceClass = TUSB\_CLASS\_MISC,
.bDeviceSubClass = MISC\_SUBCLASS\_COMMON,
.bDeviceProtocol = MISC\_PROTOCOL\_IAD,
.bMaxPacketSize0 = CFG\_TUD\_ENDPOINT0\_SIZE,

.idVendor = 0xCafe,
.idProduct = USB\_PID,
.bcdDevice = 0x0100,

.iManufacturer = USB\_DESCRIPTOR\_MANUFACTURER,
.iProduct = USB\_DESCRIPTOR\_PRODUCT,
.iSerialNumber = USB\_DESCRIPTOR\_SERIAL,

.bNumConfigurations = 0x01}<br> |

| uint8_t const | desc_ms_os_20
| | char const * | usb_string_desc_arr = = { (const char[]){0x09, 0x04}, "TinyUSB",
"TinyUSB Device",
"123456",
"TinyUSB CDC",

"TinyUSB WebUSB"

}
|

Public Static Attributes

Type Name
uint16_t _desc_str
uint8_t const desc_fs_configuration = = {
TUD\_CONFIG\_DESCRIPTOR(
    1, ITF\_NUM\_TOTAL, 0, CONFIG\_TOTAL\_LEN, TUSB\_DESC\_CONFIG\_ATT\_REMOTE\_WAKEUP, POWER),





TUD\_CDC\_DESCRIPTOR(
    ITF\_NUM\_CDC, 4, EPNUM\_CDC\_NOTIF, 8, EPNUM\_CDC\_OUT, EPNUM\_CDC\_IN, CDC\_FS\_EP\_LEN),


TUD\_VENDOR\_DESCRIPTOR(ITF\_NUM\_VENDOR, 5, EPNUM\_VENDOR\_OUT, EPNUM\_VENDOR\_IN, 64),

}
|

Public Functions

Type Name
TU_VERIFY_STATIC (sizeof(desc_ms_os_20)==MS_OS_20_DESC_LEN, "Incorrect size")
uint8_t const * tud_descriptor_bos_cb (void)
uint8_t const * tud_descriptor_configuration_cb (uint8_t index)
Invoked when received GET CONFIGURATION DESCRIPTOR.
uint8_t const * tud_descriptor_device_cb (void)
Invoked when received GET DEVICE DESCRIPTOR.
uint16_t const * tud_descriptor_string_cb (uint8_t index, uint16_t langid)
Invoked when received GET STRING DESCRIPTOR request.

Macros

Type Name
define BOS_TOTAL_LEN (TUD_BOS_DESC_LEN + TUD_BOS_WEBUSB_DESC_LEN + TUD_BOS_MICROSOFT_OS_DESC_LEN)
define CDC_FS_EP_LEN 0x40
define CDC_HS_EP_LEN 0x200
define CONFIG_TOTAL_LEN (TUD_CONFIG_DESC_LEN + TUD_CDC_DESC_LEN + TUD_VENDOR_DESC_LEN)
define EPNUM_CDC_IN 0x82
define EPNUM_CDC_NOTIF 0x81
define EPNUM_CDC_OUT 0x02
define EPNUM_VENDOR_IN 0x83
define EPNUM_VENDOR_OUT 0x03
define MS_OS_20_DESC_LEN 0xB2
define POWER 100
define USB_PID
define _PID_MAP (itf, n) ((CFG_TUD_##itf) << (n))

Public Types Documentation

enum @2

enum @2 {
    ITF_NUM_CDC = 0,
    ITF_NUM_CDC_DATA,
    ITF_NUM_VENDOR,
    ITF_NUM_TOTAL
};

Public Attributes Documentation

variable desc_bos

uint8_t const desc_bos[];

variable desc_device

tusb_desc_device_t const desc_device;

variable desc_ms_os_20

uint8_t const desc_ms_os_20[];

variable usb_string_desc_arr

char const* usb_string_desc_arr[6];

Public Static Attributes Documentation

variable _desc_str

uint16_t _desc_str[32];

variable desc_fs_configuration

uint8_t const desc_fs_configuration[];

Public Functions Documentation

function TU_VERIFY_STATIC

TU_VERIFY_STATIC (
    sizeof(desc_ms_os_20)==MS_OS_20_DESC_LEN,
    "Incorrect size"
) 

function tud_descriptor_bos_cb

uint8_t const * tud_descriptor_bos_cb (
    void
) 

function tud_descriptor_configuration_cb

Invoked when received GET CONFIGURATION DESCRIPTOR.

uint8_t const * tud_descriptor_configuration_cb (
    uint8_t index
) 

Note:

Descriptor contents must exist long enough for transfer to complete

Parameters:

  • index

Returns:

Application return pointer to descriptor.

function tud_descriptor_device_cb

Invoked when received GET DEVICE DESCRIPTOR.

uint8_t const * tud_descriptor_device_cb (
    void
) 

Returns:

Application return pointer to descriptor

function tud_descriptor_string_cb

Invoked when received GET STRING DESCRIPTOR request.

uint16_t const * tud_descriptor_string_cb (
    uint8_t index,
    uint16_t langid
) 

Returns:

Application return pointer to descriptor.

Macro Definition Documentation

define BOS_TOTAL_LEN

#define BOS_TOTAL_LEN (TUD_BOS_DESC_LEN + TUD_BOS_WEBUSB_DESC_LEN + TUD_BOS_MICROSOFT_OS_DESC_LEN)

define CDC_FS_EP_LEN

#define CDC_FS_EP_LEN 0x40

define CDC_HS_EP_LEN

#define CDC_HS_EP_LEN 0x200

define CONFIG_TOTAL_LEN

#define CONFIG_TOTAL_LEN (TUD_CONFIG_DESC_LEN + TUD_CDC_DESC_LEN + TUD_VENDOR_DESC_LEN)

define EPNUM_CDC_IN

#define EPNUM_CDC_IN 0x82

define EPNUM_CDC_NOTIF

#define EPNUM_CDC_NOTIF 0x81

define EPNUM_CDC_OUT

#define EPNUM_CDC_OUT 0x02

define EPNUM_VENDOR_IN

#define EPNUM_VENDOR_IN 0x83

define EPNUM_VENDOR_OUT

#define EPNUM_VENDOR_OUT 0x03

define MS_OS_20_DESC_LEN

#define MS_OS_20_DESC_LEN 0xB2

define POWER

#define POWER 100

define USB_PID

#define USB_PID (0x4000 | _PID_MAP(CDC, 0) | _PID_MAP(MSC, 1) | _PID_MAP(HID, 2) | _PID_MAP(MIDI, 3) |         \
     _PID_MAP(VENDOR, 4))

define _PID_MAP

#define _PID_MAP (
    itf,
    n
) ((CFG_TUD_##itf) << (n))

The documentation for this class was generated from the following file neuralSPOT/neuralspot/ns-usb/src/overrides/usb_descriptors.c