Group USB_STD
This module contains generic USB device framework definitions. More...
Modules
Type | Name |
---|---|
module | USB standard LANGID codes |
Classes
Type | Name |
---|---|
struct | usb_config_descriptor USB device configuration descriptor. |
struct | usb_debug_descriptor USB debug descriptor. |
struct | usb_device_descriptor Represents a USB device descriptor. |
struct | usb_endpoint_descriptor USB endpoint descriptor. |
struct | usb_header_descriptor common USB descriptor header |
struct | usb_iad_descriptor USB interface association descriptor. |
struct | usb_interface_descriptor USB interface descriptor. |
struct | usb_qualifier_descriptor USB device qualifier descriptor. |
struct | usb_string_descriptor USB string descriptor. |
Public Functions
Type | Name |
---|---|
struct usb_header_descriptor | __attribute__ ((packed)) |
struct usb_string_descriptor | __attribute__ ((packed, aligned(2))) |
Macros
Type | Name |
---|---|
define | INTSERIALNO_DESCRIPTOR 0xFE String descriptor is an internal serial number provided by hardware driver. |
define | NO_DESCRIPTOR 0x00 String descriptor doesn't exists in the device. |
define | USB_ARRAY_DESC (...) |
define | USB_CFG_ATTR_RESERVED 0x80 |
define | USB_CFG_ATTR_SELFPOWERED 0x40 |
define | USB_CFG_POWER_MA (mA) ((mA) >> 1) Macro to set мaximum power consumption field for the usb_config_descriptor . |
define | USB_CLASS_APP_SPEC 0xFE Application Specific class. |
define | USB_CLASS_AUDIO 0x01 Audio device class. |
define | USB_CLASS_AV 0x10 Audio/Video device class. |
define | USB_CLASS_BILLBOARD 0x11 Billboard device class. |
define | USB_CLASS_CBRIDGE 0x12 USB Type-C Bridge device class. |
define | USB_CLASS_CONTENT_SEC 0x0D Content Security device class. |
define | USB_CLASS_CSCID 0x0B Smart Card device class. |
define | USB_CLASS_DIAGNOSTIC 0xDC Diagnostic device class. |
define | USB_CLASS_HEALTHCARE 0x0F Personal Healthcare device class. |
define | USB_CLASS_HUB 0x09 HUB device class. |
define | USB_CLASS_IAD 0xEF Class defined on interface association level. |
define | USB_CLASS_MASS_STORAGE 0x08 Mass Storage device class. |
define | USB_CLASS_MISC 0xEF Miscellanious device class. |
define | USB_CLASS_PER_INTERFACE 0x00 Class defined on interface level. |
define | USB_CLASS_PHYSICAL 0x05 Physical device class. |
define | USB_CLASS_PRINTER 0x07 Printer device class. |
define | USB_CLASS_STILL_IMAGE 0x06 Still Imaging device class. |
define | USB_CLASS_VENDOR 0xFF Vendor specific class. |
define | USB_CLASS_VIDEO 0x0E Video device class. |
define | USB_CLASS_WIRELESS 0xE0 Wireless controller class. |
define | USB_DTYPE_CONFIGURATION 0x02 Configuration descriptor. |
define | USB_DTYPE_CS_ENDPOINT 0x25 Class specific endpoint descriptor. |
define | USB_DTYPE_CS_INTERFACE 0x24 Class specific interface descriptor. |
define | USB_DTYPE_DEBUG 0x0A Debug descriptor. |
define | USB_DTYPE_DEVICE 0x01 Device descriptor. |
define | USB_DTYPE_ENDPOINT 0x05 Endpoint descriptor. |
define | USB_DTYPE_INTERFACE 0x04 Interface descriptor. |
define | USB_DTYPE_INTERFACEPOWER 0x08 Interface power descriptor. |
define | USB_DTYPE_INTERFASEASSOC 0x0B Interface association descriptor. |
define | USB_DTYPE_OTG 0x09 OTG descriptor. |
define | USB_DTYPE_OTHER 0x07 Descriptor is of other type. |
define | USB_DTYPE_QUALIFIER 0x06 Qualifier descriptor. |
define | USB_DTYPE_STRING 0x03 String descriptor. |
define | USB_EPATTR_ADAPTIVE 0x08 Adaptive endpoint. |
define | USB_EPATTR_ASYNC 0x04 Asynchronous endpoint. |
define | USB_EPATTR_NO_SYNC 0x00 No synchronization. |
define | USB_EPATTR_SYNC 0x0C Synchronous endpoint. |
define | USB_EPDIR_IN 0x00 Host-to-device endpoint direction. |
define | USB_EPDIR_OUT 0x80 Device-to-host endpoint direction. |
define | USB_EPTYPE_BULK 0x02 Bbulk endpoint. |
define | USB_EPTYPE_CONTROL 0x00 Control endpoint. |
define | USB_EPTYPE_INTERRUPT 0x03 Interrupt endpoint. |
define | USB_EPTYPE_ISOCHRONUS 0x01 Isochronous endpoint. |
define | USB_EPUSAGE_DATA 0x00 Data endpoint. |
define | USB_EPUSAGE_FEEDBACK 0x10 Feedback endpoint. |
define | USB_EPUSAGE_IMP_FEEDBACK 0x20 Implicit feedback Data endpoint. |
define | USB_FEAT_DEBUG_MODE 0x06 |
define | USB_FEAT_ENDPOINT_HALT 0x00 Halt endpoint. |
define | USB_FEAT_REMOTE_WKUP 0x01 |
define | USB_FEAT_TEST_MODE 0x02 |
define | USB_PROTO_IAD 0x01 Protocol defined on interface association level. |
define | USB_PROTO_NONE 0x00 No protocol defined. |
define | USB_PROTO_VENDOR 0xFF Vendor specific protocol. |
define | USB_STD_CLEAR_FEATURE 0x01 Used to clear or disable a specific feature. |
define | USB_STD_GET_CONFIG 0x08 Returns the current device configuration value. |
define | USB_STD_GET_DESCRIPTOR 0x06 Returns the specified descriptor if the descriptor exists. |
define | USB_STD_GET_INTERFACE 0x0A Returns the selected alternate setting for the specified interface. |
define | USB_STD_GET_STATUS 0x00 Returns status for the specified recipient. |
define | USB_STD_SET_ADDRESS 0x05 Sets the device address for all future device accesses. |
define | USB_STD_SET_CONFIG 0x09 Sets the device configuration. |
define | USB_STD_SET_DESCRIPTOR 0x07 This request is optional and may be used to update existing descriptors or new descriptors may be added. |
define | USB_STD_SET_FEATURE 0x03 Used to set or enable a specific feature. |
define | USB_STD_SET_INTERFACE 0x0B Allows the host to select an alternate setting for the specified interface. |
define | USB_STD_SYNCH_FRAME 0x0C Used to set and then report an endpoint's synchronization frame. |
define | USB_STRING_DESC (s) |
define | USB_SUBCLASS_IAD 0x02 Subclass defined on interface association level. |
define | USB_SUBCLASS_NONE 0x00 No subclass defined. |
define | USB_SUBCLASS_VENDOR 0xFF Vendor specific subclass. |
define | USB_TEST_FORCE_ENABLE 0x05 Test Force Enable. |
define | USB_TEST_J 0x01 Test J. |
define | USB_TEST_K 0x02 Test K. |
define | USB_TEST_PACKET 0x04 Test Pcaket. |
define | USB_TEST_SE0_NAK 0x03 Test SE0 NAK. |
define | VERSION_BCD (maj, min, rev) (((maj & 0xFF) << 8) | ((min & 0x0F) << 4) | (rev & 0x0F)) |
Detailed Description
This module based on * Chapter 9 of the Universal Serial Bus Specification Revision 2.0 * LUFA - the Lightweight USB Framework for AVRs.
Public Functions Documentation
function __attribute__
struct usb_header_descriptor __attribute__ (
(packed)
)
function __attribute__
struct usb_string_descriptor __attribute__ (
(packed, aligned(2))
)
Macro Definition Documentation
define INTSERIALNO_DESCRIPTOR
#define INTSERIALNO_DESCRIPTOR 0xFE
define NO_DESCRIPTOR
#define NO_DESCRIPTOR 0x00
define USB_ARRAY_DESC
#define USB_ARRAY_DESC (
...
) {.bLength = 2 + sizeof((uint16_t[]){__VA_ARGS__}),\
.bDescriptorType = USB_DTYPE_STRING ,\
.wString = {__VA_ARGS__}}
Macro to create usb_string_descriptor from array
define USB_CFG_ATTR_RESERVED
#define USB_CFG_ATTR_RESERVED 0x80
define USB_CFG_ATTR_SELFPOWERED
#define USB_CFG_ATTR_SELFPOWERED 0x40
define USB_CFG_POWER_MA
#define USB_CFG_POWER_MA (
mA
) ((mA) >> 1)
define USB_CLASS_APP_SPEC
#define USB_CLASS_APP_SPEC 0xFE
define USB_CLASS_AUDIO
#define USB_CLASS_AUDIO 0x01
define USB_CLASS_AV
#define USB_CLASS_AV 0x10
define USB_CLASS_BILLBOARD
#define USB_CLASS_BILLBOARD 0x11
define USB_CLASS_CBRIDGE
#define USB_CLASS_CBRIDGE 0x12
define USB_CLASS_CONTENT_SEC
#define USB_CLASS_CONTENT_SEC 0x0D
define USB_CLASS_CSCID
#define USB_CLASS_CSCID 0x0B
define USB_CLASS_DIAGNOSTIC
#define USB_CLASS_DIAGNOSTIC 0xDC
define USB_CLASS_HEALTHCARE
#define USB_CLASS_HEALTHCARE 0x0F
define USB_CLASS_HUB
#define USB_CLASS_HUB 0x09
define USB_CLASS_IAD
#define USB_CLASS_IAD 0xEF
define USB_CLASS_MASS_STORAGE
#define USB_CLASS_MASS_STORAGE 0x08
define USB_CLASS_MISC
#define USB_CLASS_MISC 0xEF
define USB_CLASS_PER_INTERFACE
#define USB_CLASS_PER_INTERFACE 0x00
define USB_CLASS_PHYSICAL
#define USB_CLASS_PHYSICAL 0x05
define USB_CLASS_PRINTER
#define USB_CLASS_PRINTER 0x07
define USB_CLASS_STILL_IMAGE
#define USB_CLASS_STILL_IMAGE 0x06
define USB_CLASS_VENDOR
#define USB_CLASS_VENDOR 0xFF
define USB_CLASS_VIDEO
#define USB_CLASS_VIDEO 0x0E
define USB_CLASS_WIRELESS
#define USB_CLASS_WIRELESS 0xE0
define USB_DTYPE_CONFIGURATION
#define USB_DTYPE_CONFIGURATION 0x02
define USB_DTYPE_CS_ENDPOINT
#define USB_DTYPE_CS_ENDPOINT 0x25
define USB_DTYPE_CS_INTERFACE
#define USB_DTYPE_CS_INTERFACE 0x24
define USB_DTYPE_DEBUG
#define USB_DTYPE_DEBUG 0x0A
define USB_DTYPE_DEVICE
#define USB_DTYPE_DEVICE 0x01
define USB_DTYPE_ENDPOINT
#define USB_DTYPE_ENDPOINT 0x05
define USB_DTYPE_INTERFACE
#define USB_DTYPE_INTERFACE 0x04
define USB_DTYPE_INTERFACEPOWER
#define USB_DTYPE_INTERFACEPOWER 0x08
define USB_DTYPE_INTERFASEASSOC
#define USB_DTYPE_INTERFASEASSOC 0x0B
define USB_DTYPE_OTG
#define USB_DTYPE_OTG 0x09
define USB_DTYPE_OTHER
#define USB_DTYPE_OTHER 0x07
define USB_DTYPE_QUALIFIER
#define USB_DTYPE_QUALIFIER 0x06
define USB_DTYPE_STRING
#define USB_DTYPE_STRING 0x03
define USB_EPATTR_ADAPTIVE
#define USB_EPATTR_ADAPTIVE 0x08
define USB_EPATTR_ASYNC
#define USB_EPATTR_ASYNC 0x04
define USB_EPATTR_NO_SYNC
#define USB_EPATTR_NO_SYNC 0x00
define USB_EPATTR_SYNC
#define USB_EPATTR_SYNC 0x0C
define USB_EPDIR_IN
#define USB_EPDIR_IN 0x00
define USB_EPDIR_OUT
#define USB_EPDIR_OUT 0x80
define USB_EPTYPE_BULK
#define USB_EPTYPE_BULK 0x02
define USB_EPTYPE_CONTROL
#define USB_EPTYPE_CONTROL 0x00
define USB_EPTYPE_INTERRUPT
#define USB_EPTYPE_INTERRUPT 0x03
define USB_EPTYPE_ISOCHRONUS
#define USB_EPTYPE_ISOCHRONUS 0x01
define USB_EPUSAGE_DATA
#define USB_EPUSAGE_DATA 0x00
define USB_EPUSAGE_FEEDBACK
#define USB_EPUSAGE_FEEDBACK 0x10
define USB_EPUSAGE_IMP_FEEDBACK
#define USB_EPUSAGE_IMP_FEEDBACK 0x20
define USB_FEAT_DEBUG_MODE
#define USB_FEAT_DEBUG_MODE 0x06
define USB_FEAT_ENDPOINT_HALT
#define USB_FEAT_ENDPOINT_HALT 0x00
define USB_FEAT_REMOTE_WKUP
#define USB_FEAT_REMOTE_WKUP 0x01
define USB_FEAT_TEST_MODE
#define USB_FEAT_TEST_MODE 0x02
define USB_PROTO_IAD
#define USB_PROTO_IAD 0x01
define USB_PROTO_NONE
#define USB_PROTO_NONE 0x00
define USB_PROTO_VENDOR
#define USB_PROTO_VENDOR 0xFF
define USB_STD_CLEAR_FEATURE
#define USB_STD_CLEAR_FEATURE 0x01
define USB_STD_GET_CONFIG
#define USB_STD_GET_CONFIG 0x08
define USB_STD_GET_DESCRIPTOR
#define USB_STD_GET_DESCRIPTOR 0x06
define USB_STD_GET_INTERFACE
#define USB_STD_GET_INTERFACE 0x0A
define USB_STD_GET_STATUS
#define USB_STD_GET_STATUS 0x00
define USB_STD_SET_ADDRESS
#define USB_STD_SET_ADDRESS 0x05
define USB_STD_SET_CONFIG
#define USB_STD_SET_CONFIG 0x09
define USB_STD_SET_DESCRIPTOR
#define USB_STD_SET_DESCRIPTOR 0x07
define USB_STD_SET_FEATURE
#define USB_STD_SET_FEATURE 0x03
define USB_STD_SET_INTERFACE
#define USB_STD_SET_INTERFACE 0x0B
define USB_STD_SYNCH_FRAME
#define USB_STD_SYNCH_FRAME 0x0C
define USB_STRING_DESC
#define USB_STRING_DESC (
s
) {.bLength = sizeof(CAT(u,s)),\
.bDescriptorType = USB_DTYPE_STRING ,\
.wString = {CAT(u,s)}}
Macro to create usb_string_descriptor from string
define USB_SUBCLASS_IAD
#define USB_SUBCLASS_IAD 0x02
define USB_SUBCLASS_NONE
#define USB_SUBCLASS_NONE 0x00
define USB_SUBCLASS_VENDOR
#define USB_SUBCLASS_VENDOR 0xFF
define USB_TEST_FORCE_ENABLE
#define USB_TEST_FORCE_ENABLE 0x05
define USB_TEST_J
#define USB_TEST_J 0x01
define USB_TEST_K
#define USB_TEST_K 0x02
define USB_TEST_PACKET
#define USB_TEST_PACKET 0x04
define USB_TEST_SE0_NAK
#define USB_TEST_SE0_NAK 0x03
define VERSION_BCD
#define VERSION_BCD (
maj,
min,
rev
) (((maj & 0xFF) << 8) | ((min & 0x0F) << 4) | (rev & 0x0F))
Macro to encode major/minor/version number into BCD code
Parameters:
maj
Major versionmin
Minor versionrev
Revision