2017-07-06 19:56:28 +08:00
|
|
|
/* usb_descriptor.h - header for common device descriptor */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2017 PHYTEC Messtechnik GmbH
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __USB_DESCRIPTOR_H__
|
|
|
|
#define __USB_DESCRIPTOR_H__
|
|
|
|
|
|
|
|
#ifdef CONFIG_USB_CDC_ACM
|
|
|
|
#define NUMOF_IFACES_CDC_ACM 2
|
|
|
|
#define NUMOF_ENDPOINTS_CDC_ACM 3
|
|
|
|
#else
|
|
|
|
#define NUMOF_IFACES_CDC_ACM 0
|
|
|
|
#define NUMOF_ENDPOINTS_CDC_ACM 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_USB_MASS_STORAGE
|
|
|
|
#define NUMOF_IFACES_MASS 1
|
|
|
|
#define NUMOF_ENDPOINTS_MASS 2
|
|
|
|
#else
|
|
|
|
#define NUMOF_IFACES_MASS 0
|
|
|
|
#define NUMOF_ENDPOINTS_MASS 0
|
|
|
|
#endif
|
|
|
|
|
2017-11-10 20:32:55 +08:00
|
|
|
#ifdef CONFIG_USB_DEVICE_NETWORK_RNDIS
|
|
|
|
#define NUMOF_IFACES_RNDIS 2
|
|
|
|
#define NUMOF_ENDPOINTS_RNDIS 3
|
|
|
|
#else
|
|
|
|
#define NUMOF_IFACES_RNDIS 0
|
|
|
|
#define NUMOF_ENDPOINTS_RNDIS 0
|
|
|
|
#endif
|
|
|
|
|
2017-10-16 19:11:15 +08:00
|
|
|
#ifdef CONFIG_USB_DEVICE_NETWORK_ECM
|
|
|
|
#define NUMOF_IFACES_CDC_ECM 2
|
|
|
|
#define NUMOF_ENDPOINTS_CDC_ECM 3
|
|
|
|
#else
|
|
|
|
#define NUMOF_IFACES_CDC_ECM 0
|
|
|
|
#define NUMOF_ENDPOINTS_CDC_ECM 0
|
|
|
|
#endif
|
|
|
|
|
2018-01-24 20:02:44 +08:00
|
|
|
#ifdef CONFIG_USB_DEVICE_HID
|
|
|
|
#ifdef CONFIG_USB_DEVICE_HID_BOOTP
|
|
|
|
#define NUMOF_IFACES_HID 2
|
|
|
|
#define NUMOF_ENDPOINTS_HID 2
|
|
|
|
#else /* CONFIG_USB_DEVICE_HID_BOOTP */
|
|
|
|
#define NUMOF_IFACES_HID 1
|
|
|
|
#define NUMOF_ENDPOINTS_HID 1
|
|
|
|
#endif /* CONFIG_USB_DEVICE_HID_BOOTP */
|
|
|
|
#else /* CONFIG_USB_DEVICE_HID */
|
|
|
|
#define NUMOF_IFACES_HID 0
|
|
|
|
#define NUMOF_ENDPOINTS_HID 0
|
|
|
|
#endif /* CONFIG_USB_DEVICE_HID */
|
|
|
|
|
2017-10-16 19:11:15 +08:00
|
|
|
#define NUMOF_IFACES (NUMOF_IFACES_CDC_ACM + NUMOF_IFACES_MASS + \
|
2018-01-24 20:02:44 +08:00
|
|
|
NUMOF_IFACES_RNDIS + NUMOF_IFACES_CDC_ECM + \
|
|
|
|
NUMOF_IFACES_HID)
|
2017-10-16 19:11:15 +08:00
|
|
|
#define NUMOF_ENDPOINTS (NUMOF_ENDPOINTS_CDC_ACM + NUMOF_ENDPOINTS_MASS + \
|
2018-01-24 20:02:44 +08:00
|
|
|
NUMOF_ENDPOINTS_RNDIS + NUMOF_ENDPOINTS_CDC_ECM + \
|
|
|
|
NUMOF_ENDPOINTS_HID)
|
2017-07-06 19:56:28 +08:00
|
|
|
|
|
|
|
#define FIRST_IFACE_CDC_ACM 0
|
|
|
|
#define FIRST_IFACE_MASS_STORAGE NUMOF_IFACES_CDC_ACM
|
2017-11-10 20:32:55 +08:00
|
|
|
#define FIRST_IFACE_RNDIS (NUMOF_IFACES_CDC_ACM + \
|
2017-10-16 19:11:15 +08:00
|
|
|
NUMOF_IFACES_MASS)
|
2017-11-10 20:32:55 +08:00
|
|
|
#define FIRST_IFACE_CDC_ECM (NUMOF_IFACES_CDC_ACM + \
|
|
|
|
NUMOF_IFACES_MASS + \
|
|
|
|
NUMOF_IFACES_RNDIS)
|
2018-01-24 20:02:44 +08:00
|
|
|
#define FIRST_IFACE_HID (FIRST_IFACE_CDC_ECM + \
|
|
|
|
NUMOF_IFACES_CDC_ECM)
|
2017-07-06 19:56:28 +08:00
|
|
|
|
|
|
|
#define MFR_DESC_LENGTH (sizeof(CONFIG_USB_DEVICE_MANUFACTURER) * 2)
|
|
|
|
#define MFR_UC_IDX_MAX (MFR_DESC_LENGTH - 3)
|
|
|
|
#define MFR_STRING_IDX_MAX (sizeof(CONFIG_USB_DEVICE_MANUFACTURER) - 2)
|
|
|
|
|
|
|
|
#define PRODUCT_DESC_LENGTH (sizeof(CONFIG_USB_DEVICE_PRODUCT) * 2)
|
|
|
|
#define PRODUCT_UC_IDX_MAX (PRODUCT_DESC_LENGTH - 3)
|
|
|
|
#define PRODUCT_STRING_IDX_MAX (sizeof(CONFIG_USB_DEVICE_PRODUCT) - 2)
|
|
|
|
|
|
|
|
#define SN_DESC_LENGTH (sizeof(CONFIG_USB_DEVICE_SN) * 2)
|
|
|
|
#define SN_UC_IDX_MAX (SN_DESC_LENGTH - 3)
|
|
|
|
#define SN_STRING_IDX_MAX (sizeof(CONFIG_USB_DEVICE_SN) - 2)
|
|
|
|
|
2017-10-16 19:11:15 +08:00
|
|
|
#define ECM_MAC_DESC_LENGTH (sizeof(CONFIG_USB_DEVICE_NETWORK_ECM_MAC) * 2)
|
|
|
|
#define ECM_MAC_UC_IDX_MAX (ECM_MAC_DESC_LENGTH - 3)
|
|
|
|
#define ECM_STRING_IDX_MAX (sizeof(CONFIG_USB_DEVICE_NETWORK_ECM_MAC) - 2)
|
|
|
|
|
2018-03-17 03:01:44 +08:00
|
|
|
void ascii7_to_utf16le(int idx_max, int asci_idx_max, u8_t *buf);
|
2017-07-06 19:56:28 +08:00
|
|
|
u8_t *usb_get_device_descriptor(void);
|
|
|
|
|
2018-01-24 20:02:44 +08:00
|
|
|
#ifdef CONFIG_USB_DEVICE_HID
|
|
|
|
void usb_set_hid_report_size(u16_t report_desc_size);
|
|
|
|
#endif
|
|
|
|
|
2017-07-06 19:56:28 +08:00
|
|
|
#endif /* __USB_DESCRIPTOR_H__ */
|