zephyr/subsys/usb/device/os_desc.h
Johann Fischer 6be45c2a18 usb: move USB device stack code to own directory
Until now the whole USB device stack code is located
in the top subsys/usb directory. Move it to own directory
in preparation for upcoming extension and rework of USB support.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2022-03-31 18:30:14 +02:00

38 lines
1,023 B
C

/*
* Copyright (c) 2018 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#if defined(CONFIG_USB_DEVICE_OS_DESC)
#define USB_OSDESC_EXTENDED_COMPAT_ID 0x04
/*
* Devices supporting Microsoft OS Descriptors store special string
* descriptor at fixed index (0xEE). It is read when a new device is
* attached to a computer for the first time.
*/
#define USB_OSDESC_STRING_DESC_INDEX 0xEE
struct usb_os_descriptor {
uint8_t *string;
size_t string_len;
uint8_t vendor_code;
uint8_t *compat_id;
size_t compat_id_len;
};
int usb_handle_os_desc(struct usb_setup_packet *setup,
int32_t *len, uint8_t **data_buf);
int usb_handle_os_desc_feature(struct usb_setup_packet *setup,
int32_t *len, uint8_t **data_buf);
void usb_register_os_desc(struct usb_os_descriptor *desc);
bool usb_os_desc_enabled(void);
#else
#define usb_os_desc_enabled(x) false
#define usb_handle_os_desc(x, y, z) -ENOTSUP
#define usb_handle_os_desc_feature(x, y, z) -ENOTSUP
#define usb_register_os_desc(x)
#endif