include: usb: deprecate usb_common.h and usbstruct.h
Deprecate usb_common.h and usbstruct.h headers in 2.7 release. Deprecate DESCRIPTOR_TYPE_BOS macro. Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
This commit is contained in:
parent
c0ea13ba85
commit
07047aaad8
3 changed files with 111 additions and 175 deletions
|
@ -13,8 +13,11 @@
|
|||
#define USB_DEVICE_BOS_DESC_DEFINE_CAP \
|
||||
static __in_section(usb, bos_desc_area, 1) __aligned(1) __used
|
||||
|
||||
/* BOS descriptor type */
|
||||
#define DESCRIPTOR_TYPE_BOS 0x0F
|
||||
/*
|
||||
* DESCRIPTOR_TYPE_BOS macro is deprecated in 2.7 release.
|
||||
* Please replace with macros from Chapter 9 header, include/usb/usb_ch9.h
|
||||
*/
|
||||
#define DESCRIPTOR_TYPE_BOS __DEPRECATED_MACRO 0x0F
|
||||
|
||||
#define USB_BOS_CAPABILITY_EXTENSION 0x02
|
||||
#define USB_BOS_CAPABILITY_PLATFORM 0x05
|
||||
|
|
|
@ -43,53 +43,59 @@
|
|||
*/
|
||||
|
||||
#include <version.h>
|
||||
#include <usb/usb_ch9.h>
|
||||
|
||||
#ifndef ZEPHYR_INCLUDE_USB_USB_COMMON_H_
|
||||
#define ZEPHYR_INCLUDE_USB_USB_COMMON_H_
|
||||
|
||||
#define BCD(x) ((((x) / 10) << 4) | ((x) % 10))
|
||||
/*
|
||||
* This header and macros below are deprecated in 2.7 release.
|
||||
* Please replace with macros from Chapter 9 header, include/usb/usb_ch9.h
|
||||
*/
|
||||
#warning "<usb/usb_common.h> header is deprecated, use <usb/usb_ch9.h> instead"
|
||||
|
||||
#define BCD(x) __DEPRECATED_MACRO USB_DEC_TO_BCD(dec)
|
||||
|
||||
/* Descriptor size in bytes */
|
||||
#define USB_DEVICE_DESC_SIZE 18
|
||||
#define USB_CONFIGURATION_DESC_SIZE 9
|
||||
#define USB_INTERFACE_DESC_SIZE 9
|
||||
#define USB_ENDPOINT_DESC_SIZE 7
|
||||
#define USB_STRING_DESC_SIZE 4
|
||||
#define USB_HID_DESC_SIZE 9
|
||||
#define USB_DFU_DESC_SIZE 9
|
||||
#define USB_DEVICE_QUAL_DESC_SIZE 10
|
||||
#define USB_INTERFACE_ASSOC_DESC_SIZE 8
|
||||
#define USB_DEVICE_DESC_SIZE __DEPRECATED_MACRO 18
|
||||
#define USB_CONFIGURATION_DESC_SIZE __DEPRECATED_MACRO 9
|
||||
#define USB_INTERFACE_DESC_SIZE __DEPRECATED_MACRO 9
|
||||
#define USB_ENDPOINT_DESC_SIZE __DEPRECATED_MACRO 7
|
||||
#define USB_STRING_DESC_SIZE __DEPRECATED_MACRO 4
|
||||
#define USB_HID_DESC_SIZE __DEPRECATED_MACRO 9
|
||||
#define USB_DFU_DESC_SIZE __DEPRECATED_MACRO 9
|
||||
#define USB_DEVICE_QUAL_DESC_SIZE __DEPRECATED_MACRO 10
|
||||
#define USB_INTERFACE_ASSOC_DESC_SIZE __DEPRECATED_MACRO 8
|
||||
|
||||
/* Descriptor type */
|
||||
#define USB_DEVICE_DESC 0x01U
|
||||
#define USB_CONFIGURATION_DESC 0x02U
|
||||
#define USB_STRING_DESC 0x03U
|
||||
#define USB_INTERFACE_DESC 0x04U
|
||||
#define USB_ENDPOINT_DESC 0x05U
|
||||
#define USB_DEVICE_QUAL_DESC 0x06U
|
||||
#define USB_OTHER_SPEED 0x07U
|
||||
#define USB_INTERFACE_POWER 0x08U
|
||||
#define USB_INTERFACE_ASSOC_DESC 0x0BU
|
||||
#define USB_DEVICE_CAPABILITY_DESC 0x10U
|
||||
#define USB_HID_DESC 0x21U
|
||||
#define USB_HID_REPORT_DESC 0x22U
|
||||
#define USB_CS_INTERFACE_DESC 0x24U
|
||||
#define USB_CS_ENDPOINT_DESC 0x25U
|
||||
#define USB_DFU_FUNCTIONAL_DESC 0x21U
|
||||
#define USB_ASSOCIATION_DESC 0x0BU
|
||||
#define USB_BINARY_OBJECT_STORE_DESC 0x0FU
|
||||
#define USB_DEVICE_DESC __DEPRECATED_MACRO 0x01U
|
||||
#define USB_CONFIGURATION_DESC __DEPRECATED_MACRO 0x02U
|
||||
#define USB_STRING_DESC __DEPRECATED_MACRO 0x03U
|
||||
#define USB_INTERFACE_DESC __DEPRECATED_MACRO 0x04U
|
||||
#define USB_ENDPOINT_DESC __DEPRECATED_MACRO 0x05U
|
||||
#define USB_DEVICE_QUAL_DESC __DEPRECATED_MACRO 0x06U
|
||||
#define USB_OTHER_SPEED __DEPRECATED_MACRO 0x07U
|
||||
#define USB_INTERFACE_POWER __DEPRECATED_MACRO 0x08U
|
||||
#define USB_INTERFACE_ASSOC_DESC __DEPRECATED_MACRO 0x0BU
|
||||
#define USB_DEVICE_CAPABILITY_DESC __DEPRECATED_MACRO 0x10U
|
||||
#define USB_HID_DESC __DEPRECATED_MACRO 0x21U
|
||||
#define USB_HID_REPORT_DESC __DEPRECATED_MACRO 0x22U
|
||||
#define USB_CS_INTERFACE_DESC __DEPRECATED_MACRO 0x24U
|
||||
#define USB_CS_ENDPOINT_DESC __DEPRECATED_MACRO 0x25U
|
||||
#define USB_DFU_FUNCTIONAL_DESC __DEPRECATED_MACRO 0x21U
|
||||
#define USB_ASSOCIATION_DESC __DEPRECATED_MACRO 0x0BU
|
||||
#define USB_BINARY_OBJECT_STORE_DESC __DEPRECATED_MACRO 0x0FU
|
||||
|
||||
/* Useful define */
|
||||
#define USB_1_1 0x0110
|
||||
#define USB_2_0 0x0200
|
||||
#define USB_1_1 __DEPRECATED_MACRO 0x0110
|
||||
#define USB_2_0 __DEPRECATED_MACRO 0x0200
|
||||
/* Set USB version to 2.1 so that the host will request the BOS descriptor */
|
||||
#define USB_2_1 0x0210
|
||||
#define USB_2_1 __DEPRECATED_MACRO 0x0210
|
||||
|
||||
#define BCDDEVICE_RELNUM (BCD(KERNEL_VERSION_MAJOR) << 8 | \
|
||||
BCD(KERNEL_VERSION_MINOR))
|
||||
#define BCDDEVICE_RELNUM __DEPRECATED_MACRO USB_BCD_DRN
|
||||
|
||||
/* Highest value of Frame Number in SOF packets. */
|
||||
#define USB_SOF_MAX 2047
|
||||
#define USB_SOF_MAX __DEPRECATED_MACRO 2047
|
||||
|
||||
/* bmAttributes:
|
||||
* D7:Reserved, always 1,
|
||||
|
@ -97,117 +103,45 @@
|
|||
* D5:Remote Wakeup -> 0,
|
||||
* D4...0:Reserved -> 0
|
||||
*/
|
||||
#define USB_CONFIGURATION_ATTRIBUTES_REMOTE_WAKEUP BIT(5)
|
||||
#define USB_CONFIGURATION_ATTRIBUTES_SELF_POWERED BIT(6)
|
||||
#define USB_CONFIGURATION_ATTRIBUTES BIT(7) \
|
||||
#define USB_CONFIGURATION_ATTRIBUTES_REMOTE_WAKEUP __DEPRECATED_MACRO BIT(5)
|
||||
#define USB_CONFIGURATION_ATTRIBUTES_SELF_POWERED __DEPRECATED_MACRO BIT(6)
|
||||
#define USB_CONFIGURATION_ATTRIBUTES BIT(7) __DEPRECATED_MACRO \
|
||||
| ((COND_CODE_1(CONFIG_USB_SELF_POWERED, \
|
||||
(USB_CONFIGURATION_ATTRIBUTES_SELF_POWERED), (0))) \
|
||||
| (COND_CODE_1(CONFIG_USB_DEVICE_REMOTE_WAKEUP, \
|
||||
(USB_CONFIGURATION_ATTRIBUTES_REMOTE_WAKEUP), (0))))
|
||||
|
||||
/* Classes */
|
||||
#define AUDIO_CLASS 0x01
|
||||
#define COMMUNICATION_DEVICE_CLASS 0x02
|
||||
#define COMMUNICATION_DEVICE_CLASS_DATA 0x0A
|
||||
#define HID_CLASS 0x03
|
||||
#define MASS_STORAGE_CLASS 0x08
|
||||
#define WIRELESS_DEVICE_CLASS 0xE0
|
||||
#define MISC_CLASS 0xEF
|
||||
#define CUSTOM_CLASS 0xFF
|
||||
#define DFU_DEVICE_CLASS 0xFE
|
||||
#define AUDIO_CLASS __DEPRECATED_MACRO 0x01
|
||||
#define COMMUNICATION_DEVICE_CLASS __DEPRECATED_MACRO 0x02
|
||||
#define COMMUNICATION_DEVICE_CLASS_DATA __DEPRECATED_MACRO 0x0A
|
||||
#define HID_CLASS __DEPRECATED_MACRO 0x03
|
||||
#define MASS_STORAGE_CLASS __DEPRECATED_MACRO 0x08
|
||||
#define WIRELESS_DEVICE_CLASS __DEPRECATED_MACRO 0xE0
|
||||
#define MISC_CLASS __DEPRECATED_MACRO 0xEF
|
||||
#define CUSTOM_CLASS __DEPRECATED_MACRO 0xFF
|
||||
#define DFU_DEVICE_CLASS __DEPRECATED_MACRO 0xFE
|
||||
|
||||
/* Sub-classes */
|
||||
#define CDC_NCM_SUBCLASS 0x0d
|
||||
#define BOOT_INTERFACE_SUBCLASS 0x01
|
||||
#define SCSI_TRANSPARENT_SUBCLASS 0x06
|
||||
#define DFU_INTERFACE_SUBCLASS 0x01
|
||||
#define RF_SUBCLASS 0x01
|
||||
#define CUSTOM_SUBCLASS 0xFF
|
||||
#define CDC_NCM_SUBCLASS __DEPRECATED_MACRO 0x0d
|
||||
#define BOOT_INTERFACE_SUBCLASS __DEPRECATED_MACRO 0x01
|
||||
#define SCSI_TRANSPARENT_SUBCLASS __DEPRECATED_MACRO 0x06
|
||||
#define DFU_INTERFACE_SUBCLASS __DEPRECATED_MACRO 0x01
|
||||
#define RF_SUBCLASS __DEPRECATED_MACRO 0x01
|
||||
#define CUSTOM_SUBCLASS __DEPRECATED_MACRO 0xFF
|
||||
/* Misc subclasses */
|
||||
#define MISC_RNDIS_SUBCLASS 0x04
|
||||
#define MISC_RNDIS_SUBCLASS __DEPRECATED_MACRO 0x04
|
||||
|
||||
/* Protocols */
|
||||
#define V25TER_PROTOCOL 0x01
|
||||
#define MOUSE_PROTOCOL 0x02
|
||||
#define BULK_ONLY_PROTOCOL 0x50
|
||||
#define DFU_RUNTIME_PROTOCOL 0x01
|
||||
#define DFU_MODE_PROTOCOL 0x02
|
||||
#define BLUETOOTH_PROTOCOL 0x01
|
||||
#define V25TER_PROTOCOL __DEPRECATED_MACRO 0x01
|
||||
#define MOUSE_PROTOCOL __DEPRECATED_MACRO 0x02
|
||||
#define BULK_ONLY_PROTOCOL __DEPRECATED_MACRO 0x50
|
||||
#define DFU_RUNTIME_PROTOCOL __DEPRECATED_MACRO 0x01
|
||||
#define DFU_MODE_PROTOCOL __DEPRECATED_MACRO 0x02
|
||||
#define BLUETOOTH_PROTOCOL __DEPRECATED_MACRO 0x01
|
||||
/* CDC ACM protocols */
|
||||
#define ACM_VENDOR_PROTOCOL 0xFF
|
||||
#define ACM_VENDOR_PROTOCOL __DEPRECATED_MACRO 0xFF
|
||||
/* Misc protocols */
|
||||
#define MISC_ETHERNET_PROTOCOL 0x01
|
||||
|
||||
/** Standard Device Descriptor */
|
||||
struct usb_device_descriptor {
|
||||
uint8_t bLength;
|
||||
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;
|
||||
} __packed;
|
||||
|
||||
/** Unicode (UTF16LE) String Descriptor */
|
||||
struct usb_string_descriptor {
|
||||
uint8_t bLength;
|
||||
uint8_t bDescriptorType;
|
||||
uint16_t bString;
|
||||
} __packed;
|
||||
|
||||
/** Association Descriptor */
|
||||
struct usb_association_descriptor {
|
||||
uint8_t bLength;
|
||||
uint8_t bDescriptorType;
|
||||
uint8_t bFirstInterface;
|
||||
uint8_t bInterfaceCount;
|
||||
uint8_t bFunctionClass;
|
||||
uint8_t bFunctionSubClass;
|
||||
uint8_t bFunctionProtocol;
|
||||
uint8_t iFunction;
|
||||
} __packed;
|
||||
|
||||
/** Standard Configuration Descriptor */
|
||||
struct usb_cfg_descriptor {
|
||||
uint8_t bLength;
|
||||
uint8_t bDescriptorType;
|
||||
uint16_t wTotalLength;
|
||||
uint8_t bNumInterfaces;
|
||||
uint8_t bConfigurationValue;
|
||||
uint8_t iConfiguration;
|
||||
uint8_t bmAttributes;
|
||||
uint8_t bMaxPower;
|
||||
} __packed;
|
||||
|
||||
/** Standard Interface Descriptor */
|
||||
struct usb_if_descriptor {
|
||||
uint8_t bLength;
|
||||
uint8_t bDescriptorType;
|
||||
uint8_t bInterfaceNumber;
|
||||
uint8_t bAlternateSetting;
|
||||
uint8_t bNumEndpoints;
|
||||
uint8_t bInterfaceClass;
|
||||
uint8_t bInterfaceSubClass;
|
||||
uint8_t bInterfaceProtocol;
|
||||
uint8_t iInterface;
|
||||
} __packed;
|
||||
|
||||
/** Standard Endpoint Descriptor */
|
||||
struct usb_ep_descriptor {
|
||||
uint8_t bLength;
|
||||
uint8_t bDescriptorType;
|
||||
uint8_t bEndpointAddress;
|
||||
uint8_t bmAttributes;
|
||||
uint16_t wMaxPacketSize;
|
||||
uint8_t bInterval;
|
||||
} __packed;
|
||||
#define MISC_ETHERNET_PROTOCOL __DEPRECATED_MACRO 0x01
|
||||
|
||||
#endif /* ZEPHYR_INCLUDE_USB_USB_COMMON_H_ */
|
||||
|
|
|
@ -28,6 +28,11 @@
|
|||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This header and macros below are deprecated in 2.7 release.
|
||||
* Please replace with macros from Chapter 9 header, include/usb/usb_ch9.h
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief standard USB packet structures and defines
|
||||
|
@ -35,58 +40,52 @@
|
|||
* This file contains structures and defines of the standard USB packets
|
||||
*/
|
||||
|
||||
#include <usb/usb_ch9.h>
|
||||
|
||||
#ifndef ZEPHYR_INCLUDE_USB_USBSTRUCT_H_
|
||||
#define ZEPHYR_INCLUDE_USB_USBSTRUCT_H_
|
||||
|
||||
#define REQTYPE_GET_DIR(x) (((x)>>7)&0x01)
|
||||
#define REQTYPE_GET_TYPE(x) (((x)>>5)&0x03U)
|
||||
#define REQTYPE_GET_RECIP(x) ((x)&0x1F)
|
||||
#warning "<usb/usbstruct.h> header is deprecated, use <usb/usb_ch9.h> instead"
|
||||
|
||||
#define REQTYPE_DIR_TO_DEVICE 0
|
||||
#define REQTYPE_DIR_TO_HOST 1
|
||||
#define REQTYPE_GET_DIR(x) __DEPRECATED_MACRO USB_REQTYPE_GET_DIR(x)
|
||||
#define REQTYPE_GET_TYPE(x) __DEPRECATED_MACRO USB_REQTYPE_GET_TYPE(x)
|
||||
#define REQTYPE_GET_RECIP(x) __DEPRECATED_MACRO USB_REQTYPE_GET_RECIPIENT(x)
|
||||
|
||||
#define REQTYPE_TYPE_STANDARD 0
|
||||
#define REQTYPE_TYPE_CLASS 1
|
||||
#define REQTYPE_TYPE_VENDOR 2
|
||||
#define REQTYPE_TYPE_RESERVED 3
|
||||
#define REQTYPE_DIR_TO_DEVICE __DEPRECATED_MACRO 0
|
||||
#define REQTYPE_DIR_TO_HOST __DEPRECATED_MACRO 1
|
||||
|
||||
#define REQTYPE_RECIP_DEVICE 0
|
||||
#define REQTYPE_RECIP_INTERFACE 1
|
||||
#define REQTYPE_RECIP_ENDPOINT 2
|
||||
#define REQTYPE_RECIP_OTHER 3
|
||||
#define REQTYPE_TYPE_STANDARD __DEPRECATED_MACRO 0
|
||||
#define REQTYPE_TYPE_CLASS __DEPRECATED_MACRO 1
|
||||
#define REQTYPE_TYPE_VENDOR __DEPRECATED_MACRO 2
|
||||
#define REQTYPE_TYPE_RESERVED __DEPRECATED_MACRO 3
|
||||
|
||||
#define REQTYPE_RECIP_DEVICE __DEPRECATED_MACRO 0
|
||||
#define REQTYPE_RECIP_INTERFACE __DEPRECATED_MACRO 1
|
||||
#define REQTYPE_RECIP_ENDPOINT __DEPRECATED_MACRO 2
|
||||
#define REQTYPE_RECIP_OTHER __DEPRECATED_MACRO 3
|
||||
|
||||
/* standard requests */
|
||||
#define REQ_GET_STATUS 0x00
|
||||
#define REQ_CLEAR_FEATURE 0x01
|
||||
#define REQ_SET_FEATURE 0x03
|
||||
#define REQ_SET_ADDRESS 0x05
|
||||
#define REQ_GET_DESCRIPTOR 0x06
|
||||
#define REQ_SET_DESCRIPTOR 0x07
|
||||
#define REQ_GET_CONFIGURATION 0x08
|
||||
#define REQ_SET_CONFIGURATION 0x09
|
||||
#define REQ_GET_INTERFACE 0x0A
|
||||
#define REQ_SET_INTERFACE 0x0B
|
||||
#define REQ_SYNCH_FRAME 0x0C
|
||||
#define REQ_GET_STATUS __DEPRECATED_MACRO 0x00
|
||||
#define REQ_CLEAR_FEATURE __DEPRECATED_MACRO 0x01
|
||||
#define REQ_SET_FEATURE __DEPRECATED_MACRO 0x03
|
||||
#define REQ_SET_ADDRESS __DEPRECATED_MACRO 0x05
|
||||
#define REQ_GET_DESCRIPTOR __DEPRECATED_MACRO 0x06
|
||||
#define REQ_SET_DESCRIPTOR __DEPRECATED_MACRO 0x07
|
||||
#define REQ_GET_CONFIGURATION __DEPRECATED_MACRO 0x08
|
||||
#define REQ_SET_CONFIGURATION __DEPRECATED_MACRO 0x09
|
||||
#define REQ_GET_INTERFACE __DEPRECATED_MACRO 0x0A
|
||||
#define REQ_SET_INTERFACE __DEPRECATED_MACRO 0x0B
|
||||
#define REQ_SYNCH_FRAME __DEPRECATED_MACRO 0x0C
|
||||
|
||||
/* feature selectors */
|
||||
#define FEA_ENDPOINT_HALT 0x00
|
||||
#define FEA_REMOTE_WAKEUP 0x01
|
||||
#define FEA_TEST_MODE 0x02
|
||||
#define FEA_ENDPOINT_HALT __DEPRECATED_MACRO 0x00
|
||||
#define FEA_REMOTE_WAKEUP __DEPRECATED_MACRO 0x01
|
||||
#define FEA_TEST_MODE __DEPRECATED_MACRO 0x02
|
||||
|
||||
#define DEVICE_STATUS_SELF_POWERED 0x01
|
||||
#define DEVICE_STATUS_REMOTE_WAKEUP 0x02
|
||||
#define DEVICE_STATUS_SELF_POWERED __DEPRECATED_MACRO 0x01
|
||||
#define DEVICE_STATUS_REMOTE_WAKEUP __DEPRECATED_MACRO 0x02
|
||||
|
||||
/*
|
||||
* USB descriptors
|
||||
*/
|
||||
|
||||
/** USB descriptor header */
|
||||
struct usb_desc_header {
|
||||
uint8_t bLength; /**< descriptor length */
|
||||
uint8_t bDescriptorType; /**< descriptor type */
|
||||
};
|
||||
|
||||
#define GET_DESC_TYPE(x) (((x)>>8)&0xFFU)
|
||||
#define GET_DESC_INDEX(x) ((x)&0xFFU)
|
||||
#define GET_DESC_TYPE(x) __DEPRECATED_MACRO USB_GET_DESCRIPTOR_TYPE(x)
|
||||
#define GET_DESC_INDEX(x) __DEPRECATED_MACRO USB_GET_DESCRIPTOR_INDEX(x)
|
||||
|
||||
#endif /* ZEPHYR_INCLUDE_USB_USBSTRUCT_H_ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue