usbd_desc.h File Reference

USB descriptors. More...

#include "os_port.h"

Go to the source code of this file.

Macros

#define USB_EP0   0
 
#define USB_EP1   1
 
#define USB_EP2   2
 
#define USB_EP3   3
 
#define USB_DIR_MASK   0x80
 
#define USB_DIR_OUT   0x00
 
#define USB_DIR_IN   0x80
 
#define USB_EP0_MAX_PACKET_SIZE   64
 
#define USB_EP1_MAX_PACKET_SIZE   64
 
#define USB_EP2_MAX_PACKET_SIZE   64
 
#define USB_EP3_MAX_PACKET_SIZE   64
 
#define USB_SELF_POWERED   0xC0
 
#define USB_BUS_POWERED   0x80
 
#define USB_REMOTE_WAKEUP   0xA0
 
#define USB_NO_REMOTE_WAKEUP   0x80
 
#define USB_ENDPOINT_TYPE_MASK   0x03
 
#define USB_ENDPOINT_TYPE_CONTROL   0x00
 
#define USB_ENDPOINT_TYPE_ISOCHRONOUS   0x01
 
#define USB_ENDPOINT_TYPE_BULK   0x02
 
#define USB_ENDPOINT_TYPE_INTERRUPT   0x03
 
#define USB_DEVICE_CLASS_CDC   0x02
 
#define USB_DEVICE_SUBCLASS_CDC   0x00
 
#define USB_DEVICE_PROTOCOL_CDC   0x00
 
#define CDC_INTERFACE_CLASS_COMMUNICATION   0x02
 
#define CDC_INTERFACE_CLASS_RNDIS   0xEF
 
#define CDC_INTERFACE_SUBCLASS_ACM   0x02
 
#define CDC_INTERFACE_SUBCLASS_RNDIS   0x04
 
#define CDC_INTERFACE_PROTOCOL_RNDIS   0x01
 
#define CDC_INTERFACE_PROTOCOL_VENDOR_SPECIFIC   0xFF
 
#define CDC_INTERFACE_CLASS_DATA   0x0A
 
#define CDC_INTERFACE_SUBCLASS_DATA   0x00
 
#define CDC_INTERFACE_PROTOCOL_DATA   0x00
 
#define CDC_CS_INTERFACE   0x24
 
#define CDC_CS_ENDPOINT   0x25
 
#define CDC_HEADER_DESC_SUBTYPE   0x00
 
#define CDC_CALL_MANAGEMENT_DESC_SUBTYPE   0x01
 
#define CDC_ACM_DESC_SUBTYPE   0x02
 
#define CDC_UNION_DESC_SUBTYPE   0x06
 

Functions

uint8_t * usbdGetDeviceDescriptor (USBD_SpeedTypeDef speed, uint16_t *length)
 Retrieve device descriptor. More...
 
uint8_t * usbdGetLangIdStrDescriptor (USBD_SpeedTypeDef speed, uint16_t *length)
 Retrieve the languages supported by the device. More...
 
uint8_t * usbdGetManufacturerStrDescriptor (USBD_SpeedTypeDef speed, uint16_t *length)
 Retrieve the manufacturer string descriptor. More...
 
uint8_t * usbdGetProductStrDescriptor (USBD_SpeedTypeDef speed, uint16_t *length)
 Retrieve the product string descriptor. More...
 
uint8_t * usbdGetSerialStrDescriptor (USBD_SpeedTypeDef speed, uint16_t *length)
 Retrieve the serial number string descriptor. More...
 
uint8_t * usbdGetConfigStrDescriptor (USBD_SpeedTypeDef speed, uint16_t *length)
 Retrieve the configuration string descriptor. More...
 
uint8_t * usbdGetInterfaceStrDescriptor (USBD_SpeedTypeDef speed, uint16_t *length)
 Retrieve the interface string descriptor. More...
 

Variables

typedef __packed_struct
 Device descriptor. More...
 
uint8_t bDescriptorType
 
uint16_t bcdUsb
 
uint8_t bDeviceClass
 
uint8_t bDeviceSubClass
 
uint8_t bDeviceProtocol
 
uint8_t bMaxPacketSize0
 
uint16_t idVendor
 
uint16_t idProduct
 
uint16_t bcdDevice
 
uint8_t iManufacturer
 
uint8_t iProduct
 
uint8_t iSerialNumber
 
uint8_t bNumConfigurations
 
 UsbDeviceDescriptor
 
uint16_t wTotalLength
 
uint8_t bNumInterfaces
 
uint8_t bConfigurationValue
 
uint8_t iConfiguration
 
uint8_t bmAttributes
 
uint8_t bMaxPower
 
 UsbConfigDescriptor
 
uint8_t bInterfaceNumber
 
uint8_t bAlternateSetting
 
uint8_t bNumEndpoints
 
uint8_t bInterfaceClass
 
uint8_t bInterfaceSubClass
 
uint8_t bInterfaceProtocol
 
uint8_t iInterface
 
 UsbInterfaceDescriptor
 
uint8_t bEndpointAddress
 
uint16_t wMaxPacketSize
 
uint8_t bInterval
 
 UsbEndpointDescriptor
 
uint16_t bString []
 
 UsbStringDescriptor
 
uint8_t bDescriptorSubtype
 
uint16_t bcdCdc
 
 CdcHeaderDescriptor
 
uint8_t bmCapabilities
 
uint8_t bDataInterface
 
 CdcCallManagementDescriptor
 
 CdcAcmDescriptor
 
uint8_t bMasterInterface
 
uint8_t bSlaveInterface0
 
 CdcUnionDescriptor
 
UsbInterfaceDescriptor communicationInterfaceDescriptor
 
CdcHeaderDescriptor cdcHeaderDescriptor
 
CdcCallManagementDescriptor cdcCallManagementDescriptor
 
CdcAcmDescriptor cdcAcmDescriptor
 
CdcUnionDescriptor cdcUnionDescriptor
 
UsbEndpointDescriptor notificationEndpointDescriptor
 
UsbInterfaceDescriptor dataInterfaceDescriptor
 
UsbEndpointDescriptor dataOutEndpointDescriptor
 
UsbEndpointDescriptor dataInEndpointDescriptor
 
 UsbConfigDescriptors
 
USBD_DescriptorsTypeDef usbdRndisDescriptors
 USB descriptors. More...
 
const UsbDeviceDescriptor usbdDeviceDescriptor
 USB device descriptor. More...
 
const UsbConfigDescriptors usbdConfigDescriptors
 USB configuration descriptors. More...
 

Detailed Description

USB descriptors.

License

SPDX-License-Identifier: GPL-2.0-or-later

Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.

This file is part of CycloneTCP Open.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
2.4.0

Definition in file usbd_desc.h.

Macro Definition Documentation

◆ CDC_ACM_DESC_SUBTYPE

#define CDC_ACM_DESC_SUBTYPE   0x02

Definition at line 98 of file usbd_desc.h.

◆ CDC_CALL_MANAGEMENT_DESC_SUBTYPE

#define CDC_CALL_MANAGEMENT_DESC_SUBTYPE   0x01

Definition at line 97 of file usbd_desc.h.

◆ CDC_CS_ENDPOINT

#define CDC_CS_ENDPOINT   0x25

Definition at line 93 of file usbd_desc.h.

◆ CDC_CS_INTERFACE

#define CDC_CS_INTERFACE   0x24

Definition at line 92 of file usbd_desc.h.

◆ CDC_HEADER_DESC_SUBTYPE

#define CDC_HEADER_DESC_SUBTYPE   0x00

Definition at line 96 of file usbd_desc.h.

◆ CDC_INTERFACE_CLASS_COMMUNICATION

#define CDC_INTERFACE_CLASS_COMMUNICATION   0x02

Definition at line 75 of file usbd_desc.h.

◆ CDC_INTERFACE_CLASS_DATA

#define CDC_INTERFACE_CLASS_DATA   0x0A

Definition at line 85 of file usbd_desc.h.

◆ CDC_INTERFACE_CLASS_RNDIS

#define CDC_INTERFACE_CLASS_RNDIS   0xEF

Definition at line 76 of file usbd_desc.h.

◆ CDC_INTERFACE_PROTOCOL_DATA

#define CDC_INTERFACE_PROTOCOL_DATA   0x00

Definition at line 89 of file usbd_desc.h.

◆ CDC_INTERFACE_PROTOCOL_RNDIS

#define CDC_INTERFACE_PROTOCOL_RNDIS   0x01

Definition at line 81 of file usbd_desc.h.

◆ CDC_INTERFACE_PROTOCOL_VENDOR_SPECIFIC

#define CDC_INTERFACE_PROTOCOL_VENDOR_SPECIFIC   0xFF

Definition at line 82 of file usbd_desc.h.

◆ CDC_INTERFACE_SUBCLASS_ACM

#define CDC_INTERFACE_SUBCLASS_ACM   0x02

Definition at line 78 of file usbd_desc.h.

◆ CDC_INTERFACE_SUBCLASS_DATA

#define CDC_INTERFACE_SUBCLASS_DATA   0x00

Definition at line 87 of file usbd_desc.h.

◆ CDC_INTERFACE_SUBCLASS_RNDIS

#define CDC_INTERFACE_SUBCLASS_RNDIS   0x04

Definition at line 79 of file usbd_desc.h.

◆ CDC_UNION_DESC_SUBTYPE

#define CDC_UNION_DESC_SUBTYPE   0x06

Definition at line 99 of file usbd_desc.h.

◆ USB_BUS_POWERED

#define USB_BUS_POWERED   0x80

Definition at line 56 of file usbd_desc.h.

◆ USB_DEVICE_CLASS_CDC

#define USB_DEVICE_CLASS_CDC   0x02

Definition at line 68 of file usbd_desc.h.

◆ USB_DEVICE_PROTOCOL_CDC

#define USB_DEVICE_PROTOCOL_CDC   0x00

Definition at line 72 of file usbd_desc.h.

◆ USB_DEVICE_SUBCLASS_CDC

#define USB_DEVICE_SUBCLASS_CDC   0x00

Definition at line 70 of file usbd_desc.h.

◆ USB_DIR_IN

#define USB_DIR_IN   0x80

Definition at line 46 of file usbd_desc.h.

◆ USB_DIR_MASK

#define USB_DIR_MASK   0x80

Definition at line 44 of file usbd_desc.h.

◆ USB_DIR_OUT

#define USB_DIR_OUT   0x00

Definition at line 45 of file usbd_desc.h.

◆ USB_ENDPOINT_TYPE_BULK

#define USB_ENDPOINT_TYPE_BULK   0x02

Definition at line 64 of file usbd_desc.h.

◆ USB_ENDPOINT_TYPE_CONTROL

#define USB_ENDPOINT_TYPE_CONTROL   0x00

Definition at line 62 of file usbd_desc.h.

◆ USB_ENDPOINT_TYPE_INTERRUPT

#define USB_ENDPOINT_TYPE_INTERRUPT   0x03

Definition at line 65 of file usbd_desc.h.

◆ USB_ENDPOINT_TYPE_ISOCHRONOUS

#define USB_ENDPOINT_TYPE_ISOCHRONOUS   0x01

Definition at line 63 of file usbd_desc.h.

◆ USB_ENDPOINT_TYPE_MASK

#define USB_ENDPOINT_TYPE_MASK   0x03

Definition at line 61 of file usbd_desc.h.

◆ USB_EP0

#define USB_EP0   0

Definition at line 38 of file usbd_desc.h.

◆ USB_EP0_MAX_PACKET_SIZE

#define USB_EP0_MAX_PACKET_SIZE   64

Definition at line 49 of file usbd_desc.h.

◆ USB_EP1

#define USB_EP1   1

Definition at line 39 of file usbd_desc.h.

◆ USB_EP1_MAX_PACKET_SIZE

#define USB_EP1_MAX_PACKET_SIZE   64

Definition at line 50 of file usbd_desc.h.

◆ USB_EP2

#define USB_EP2   2

Definition at line 40 of file usbd_desc.h.

◆ USB_EP2_MAX_PACKET_SIZE

#define USB_EP2_MAX_PACKET_SIZE   64

Definition at line 51 of file usbd_desc.h.

◆ USB_EP3

#define USB_EP3   3

Definition at line 41 of file usbd_desc.h.

◆ USB_EP3_MAX_PACKET_SIZE

#define USB_EP3_MAX_PACKET_SIZE   64

Definition at line 52 of file usbd_desc.h.

◆ USB_NO_REMOTE_WAKEUP

#define USB_NO_REMOTE_WAKEUP   0x80

Definition at line 58 of file usbd_desc.h.

◆ USB_REMOTE_WAKEUP

#define USB_REMOTE_WAKEUP   0xA0

Definition at line 57 of file usbd_desc.h.

◆ USB_SELF_POWERED

#define USB_SELF_POWERED   0xC0

Definition at line 55 of file usbd_desc.h.

Function Documentation

◆ usbdGetConfigStrDescriptor()

uint8_t* usbdGetConfigStrDescriptor ( USBD_SpeedTypeDef  speed,
uint16_t *  length 
)

Retrieve the configuration string descriptor.

Parameters
[in]speedCurrent speed
[out]lengthLength of the string descriptor, in bytes
Returns
Pointer to the string descriptor

Definition at line 301 of file usbd_desc.c.

◆ usbdGetDeviceDescriptor()

uint8_t* usbdGetDeviceDescriptor ( USBD_SpeedTypeDef  speed,
uint16_t *  length 
)

Retrieve device descriptor.

Parameters
[in]speedCurrent speed
[out]lengthLength of the device descriptor, in bytes
Returns
Pointer to the device descriptor

Definition at line 211 of file usbd_desc.c.

◆ usbdGetInterfaceStrDescriptor()

uint8_t* usbdGetInterfaceStrDescriptor ( USBD_SpeedTypeDef  speed,
uint16_t *  length 
)

Retrieve the interface string descriptor.

Parameters
[in]speedCurrent speed
[out]lengthLength of the string descriptor, in bytes
Returns
Pointer to the string descriptor

Definition at line 317 of file usbd_desc.c.

◆ usbdGetLangIdStrDescriptor()

uint8_t* usbdGetLangIdStrDescriptor ( USBD_SpeedTypeDef  speed,
uint16_t *  length 
)

Retrieve the languages supported by the device.

Parameters
[in]speedCurrent speed
[out]lengthLength of the string descriptor, in bytes
Returns
Pointer to the string descriptor

Definition at line 227 of file usbd_desc.c.

◆ usbdGetManufacturerStrDescriptor()

uint8_t* usbdGetManufacturerStrDescriptor ( USBD_SpeedTypeDef  speed,
uint16_t *  length 
)

Retrieve the manufacturer string descriptor.

Parameters
[in]speedCurrent speed
[out]lengthLength of the string descriptor, in bytes
Returns
Pointer to the string descriptor

Definition at line 253 of file usbd_desc.c.

◆ usbdGetProductStrDescriptor()

uint8_t* usbdGetProductStrDescriptor ( USBD_SpeedTypeDef  speed,
uint16_t *  length 
)

Retrieve the product string descriptor.

Parameters
[in]speedCurrent speed
[out]lengthLength of the string descriptor, in bytes
Returns
Pointer to the string descriptor

Definition at line 269 of file usbd_desc.c.

◆ usbdGetSerialStrDescriptor()

uint8_t* usbdGetSerialStrDescriptor ( USBD_SpeedTypeDef  speed,
uint16_t *  length 
)

Retrieve the serial number string descriptor.

Parameters
[in]speedCurrent speed
[out]lengthLength of the string descriptor, in bytes
Returns
Pointer to the string descriptor

Definition at line 285 of file usbd_desc.c.

Variable Documentation

◆ __packed_struct

typedef __packed_struct
Initial value:
{
uint8_t bLength

Device descriptor.

Configuration descriptors.

CDC union functional descriptor.

CDC abstract control management functional descriptor.

CDC call management functional descriptor.

CDC header functional descriptor.

String descriptor.

Endpoint descriptor.

Interface descriptor.

Configuration descriptor.

Definition at line 106 of file usbd_desc.h.

◆ bAlternateSetting

uint8_t bAlternateSetting

Definition at line 151 of file usbd_desc.h.

◆ bcdCdc

uint16_t bcdCdc

Definition at line 196 of file usbd_desc.h.

◆ bcdDevice

uint16_t bcdDevice

Definition at line 117 of file usbd_desc.h.

◆ bcdUsb

uint16_t bcdUsb

Definition at line 110 of file usbd_desc.h.

◆ bConfigurationValue

uint8_t bConfigurationValue

Definition at line 135 of file usbd_desc.h.

◆ bDataInterface

uint8_t bDataInterface

Definition at line 210 of file usbd_desc.h.

◆ bDescriptorSubtype

uint8_t bDescriptorSubtype

Definition at line 195 of file usbd_desc.h.

◆ bDescriptorType

uint8_t bDescriptorType

Definition at line 109 of file usbd_desc.h.

◆ bDeviceClass

uint8_t bDeviceClass

Definition at line 111 of file usbd_desc.h.

◆ bDeviceProtocol

uint8_t bDeviceProtocol

Definition at line 113 of file usbd_desc.h.

◆ bDeviceSubClass

uint8_t bDeviceSubClass

Definition at line 112 of file usbd_desc.h.

◆ bEndpointAddress

uint8_t bEndpointAddress

Definition at line 168 of file usbd_desc.h.

◆ bInterfaceClass

uint8_t bInterfaceClass

Definition at line 153 of file usbd_desc.h.

◆ bInterfaceNumber

uint8_t bInterfaceNumber

Definition at line 150 of file usbd_desc.h.

◆ bInterfaceProtocol

uint8_t bInterfaceProtocol

Definition at line 155 of file usbd_desc.h.

◆ bInterfaceSubClass

uint8_t bInterfaceSubClass

Definition at line 154 of file usbd_desc.h.

◆ bInterval

uint8_t bInterval

Definition at line 171 of file usbd_desc.h.

◆ bMasterInterface

uint8_t bMasterInterface

Definition at line 236 of file usbd_desc.h.

◆ bmAttributes

uint8_t bmAttributes

Definition at line 137 of file usbd_desc.h.

◆ bMaxPacketSize0

uint8_t bMaxPacketSize0

Definition at line 114 of file usbd_desc.h.

◆ bMaxPower

uint8_t bMaxPower

Definition at line 138 of file usbd_desc.h.

◆ bmCapabilities

uint8_t bmCapabilities

Definition at line 209 of file usbd_desc.h.

◆ bNumConfigurations

uint8_t bNumConfigurations

Definition at line 121 of file usbd_desc.h.

◆ bNumEndpoints

uint8_t bNumEndpoints

Definition at line 152 of file usbd_desc.h.

◆ bNumInterfaces

uint8_t bNumInterfaces

Definition at line 134 of file usbd_desc.h.

◆ bSlaveInterface0

uint8_t bSlaveInterface0

Definition at line 237 of file usbd_desc.h.

◆ bString

uint16_t bString[]

Definition at line 183 of file usbd_desc.h.

◆ CdcAcmDescriptor

CdcAcmDescriptor

Definition at line 224 of file usbd_desc.h.

◆ cdcAcmDescriptor

CdcAcmDescriptor cdcAcmDescriptor

Definition at line 256 of file usbd_desc.h.

◆ CdcCallManagementDescriptor

CdcCallManagementDescriptor

Definition at line 211 of file usbd_desc.h.

◆ cdcCallManagementDescriptor

CdcCallManagementDescriptor cdcCallManagementDescriptor

Definition at line 254 of file usbd_desc.h.

◆ CdcHeaderDescriptor

CdcHeaderDescriptor

Definition at line 197 of file usbd_desc.h.

◆ cdcHeaderDescriptor

CdcHeaderDescriptor cdcHeaderDescriptor

Definition at line 252 of file usbd_desc.h.

◆ CdcUnionDescriptor

CdcUnionDescriptor

Definition at line 238 of file usbd_desc.h.

◆ cdcUnionDescriptor

CdcUnionDescriptor cdcUnionDescriptor

Definition at line 258 of file usbd_desc.h.

◆ communicationInterfaceDescriptor

UsbInterfaceDescriptor communicationInterfaceDescriptor

Definition at line 250 of file usbd_desc.h.

◆ dataInEndpointDescriptor

UsbEndpointDescriptor dataInEndpointDescriptor

Definition at line 266 of file usbd_desc.h.

◆ dataInterfaceDescriptor

UsbInterfaceDescriptor dataInterfaceDescriptor

Definition at line 262 of file usbd_desc.h.

◆ dataOutEndpointDescriptor

UsbEndpointDescriptor dataOutEndpointDescriptor

Definition at line 264 of file usbd_desc.h.

◆ iConfiguration

uint8_t iConfiguration

Definition at line 136 of file usbd_desc.h.

◆ idProduct

uint16_t idProduct

Definition at line 116 of file usbd_desc.h.

◆ idVendor

uint16_t idVendor

Definition at line 115 of file usbd_desc.h.

◆ iInterface

uint8_t iInterface

Definition at line 156 of file usbd_desc.h.

◆ iManufacturer

uint8_t iManufacturer

Definition at line 118 of file usbd_desc.h.

◆ iProduct

uint8_t iProduct

Definition at line 119 of file usbd_desc.h.

◆ iSerialNumber

uint8_t iSerialNumber

Definition at line 120 of file usbd_desc.h.

◆ notificationEndpointDescriptor

UsbEndpointDescriptor notificationEndpointDescriptor

Definition at line 260 of file usbd_desc.h.

◆ UsbConfigDescriptor

UsbConfigDescriptor

Definition at line 139 of file usbd_desc.h.

◆ UsbConfigDescriptors

UsbConfigDescriptors

Definition at line 267 of file usbd_desc.h.

◆ usbdConfigDescriptors

const UsbConfigDescriptors usbdConfigDescriptors
extern

USB configuration descriptors.

Definition at line 99 of file usbd_desc.c.

◆ usbdDeviceDescriptor

const UsbDeviceDescriptor usbdDeviceDescriptor
extern

USB device descriptor.

Definition at line 76 of file usbd_desc.c.

◆ UsbDeviceDescriptor

UsbDeviceDescriptor

Definition at line 122 of file usbd_desc.h.

◆ usbdRndisDescriptors

USBD_DescriptorsTypeDef usbdRndisDescriptors
extern

USB descriptors.

Definition at line 61 of file usbd_desc.c.

◆ UsbEndpointDescriptor

UsbEndpointDescriptor

Definition at line 172 of file usbd_desc.h.

◆ UsbInterfaceDescriptor

UsbInterfaceDescriptor

Definition at line 157 of file usbd_desc.h.

◆ UsbStringDescriptor

UsbStringDescriptor

Definition at line 184 of file usbd_desc.h.

◆ wMaxPacketSize

uint16_t wMaxPacketSize

Definition at line 170 of file usbd_desc.h.

◆ wTotalLength

uint16_t wTotalLength

Definition at line 133 of file usbd_desc.h.