Zephyr Project API  3.3.0
A Scalable Open Source RTOS
bos.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018 Intel Corporation
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef ZEPHYR_INCLUDE_USB_BOS_H_
8#define ZEPHYR_INCLUDE_USB_BOS_H_
9
10#if defined(CONFIG_USB_DEVICE_BOS)
11#define USB_DEVICE_BOS_DESC_DEFINE_HDR \
12 static __in_section(usb, bos_desc_area, 0) __aligned(1) __used
13#define USB_DEVICE_BOS_DESC_DEFINE_CAP \
14 static __in_section(usb, bos_desc_area, 1) __aligned(1) __used
15
16#define USB_BOS_CAPABILITY_EXTENSION 0x02
17#define USB_BOS_CAPABILITY_PLATFORM 0x05
18
19/* BOS Capability Descriptor */
20struct usb_bos_platform_descriptor {
21 uint8_t bLength;
22 uint8_t bDescriptorType;
23 uint8_t bDevCapabilityType;
24 uint8_t bReserved;
25 uint8_t PlatformCapabilityUUID[16];
26} __packed;
27
28/* BOS Descriptor */
29struct usb_bos_descriptor {
30 uint8_t bLength;
31 uint8_t bDescriptorType;
32 uint16_t wTotalLength;
33 uint8_t bNumDeviceCaps;
34} __packed;
35
36/* BOS Capability webusb */
37struct usb_bos_capability_webusb {
38 uint16_t bcdVersion;
39 uint8_t bVendorCode;
40 uint8_t iLandingPage;
41} __packed;
42
43/* BOS Capability MS OS Descriptors version 2 */
44struct usb_bos_capability_msos {
45 uint32_t dwWindowsVersion;
46 uint16_t wMSOSDescriptorSetTotalLength;
47 uint8_t bMS_VendorCode;
48 uint8_t bAltEnumCode;
49} __packed;
50
51struct usb_bos_capability_lpm {
52 uint8_t bLength;
53 uint8_t bDescriptorType;
54 uint8_t bDevCapabilityType;
55 uint32_t bmAttributes;
56} __packed;
57
58size_t usb_bos_get_length(void);
59void usb_bos_fix_total_length(void);
60void usb_bos_register_cap(struct usb_bos_platform_descriptor *hdr);
61const void *usb_bos_get_header(void);
62int usb_handle_bos(struct usb_setup_packet *setup, int32_t *len, uint8_t **data);
63#else
64#define usb_handle_bos(x, y, z) -ENOTSUP
65#endif
66
67#endif /* ZEPHYR_INCLUDE_USB_BOS_H_ */
#define usb_handle_bos(x, y, z)
Definition: bos.h:64
__UINT32_TYPE__ uint32_t
Definition: stdint.h:90
__INT32_TYPE__ int32_t
Definition: stdint.h:74
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
__UINT16_TYPE__ uint16_t
Definition: stdint.h:89
Definition: usb_ch9.h:39
static fdata_t data[2]
Definition: test_fifo_contexts.c:15