1 /* 2 * Copyright (c) 2023 Nordic Semiconductor ASA 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 /** 8 * @file 9 * @brief MS OS 2.0 descriptor definitions 10 * 11 */ 12 13 #ifndef ZEPHYR_INCLUDE_USB_MSOS_DESC_H 14 #define ZEPHYR_INCLUDE_USB_MSOS_DESC_H 15 16 #include <stdint.h> 17 18 enum msosv2_descriptor_index { 19 MS_OS_20_DESCRIPTOR_INDEX = 0x07, 20 MS_OS_20_SET_ALT_ENUMERATION = 0x08, 21 }; 22 23 enum msosv2_descriptor_type { 24 MS_OS_20_SET_HEADER_DESCRIPTOR = 0x00, 25 MS_OS_20_SUBSET_HEADER_CONFIGURATION = 0x01, 26 MS_OS_20_SUBSET_HEADER_FUNCTION = 0x02, 27 MS_OS_20_FEATURE_COMPATIBLE_ID = 0x03, 28 MS_OS_20_FEATURE_REG_PROPERTY = 0x04, 29 MS_OS_20_FEATURE_MIN_RESUME_TIME = 0x05, 30 MS_OS_20_FEATURE_MODEL_ID = 0x06, 31 MS_OS_20_FEATURE_CCGP_DEVICE = 0x07, 32 MS_OS_20_FEATURE_VENDOR_REVISION = 0x08 33 }; 34 35 enum msosv2_property_data_type { 36 MS_OS_20_PROPERTY_DATA_RESERVED = 0, 37 MS_OS_20_PROPERTY_DATA_REG_SZ = 1, 38 MS_OS_20_PROPERTY_DATA_REG_EXPAND_SZ = 2, 39 MS_OS_20_PROPERTY_DATA_REG_BINARY = 3, 40 MS_OS_20_PROPERTY_DATA_REG_DWORD_LITTLE_ENDIAN = 4, 41 MS_OS_20_PROPERTY_DATA_REG_DWORD_BIG_ENDIAN = 5, 42 MS_OS_20_PROPERTY_DATA_REG_LINK = 6, 43 MS_OS_20_PROPERTY_DATA_REG_MULTI_SZ = 7 44 }; 45 46 /* Microsoft OS 2.0 descriptor set header */ 47 struct msosv2_descriptor_set_header { 48 uint16_t wLength; 49 uint16_t wDescriptorType; 50 uint32_t dwWindowsVersion; 51 uint16_t wTotalLength; 52 } __packed; 53 54 /* Microsoft OS 2.0 configuration subset header 55 * This header is for composite devices with multiple configurations. 56 */ 57 struct msosv2_configuration_subset_header { 58 uint16_t wLength; 59 uint16_t wDescriptorType; 60 uint8_t bConfigurationValue; 61 uint8_t bReserved; 62 uint16_t wTotalLength; 63 } __packed; 64 65 /* Microsoft OS 2.0 function subset header 66 * Note: This must be used if your device has multiple interfaces and cannot be used otherwise. 67 */ 68 struct msosv2_function_subset_header { 69 uint16_t wLength; 70 uint16_t wDescriptorType; 71 uint8_t bFirstInterface; 72 uint8_t bReserved; 73 uint16_t wSubsetLength; 74 } __packed; 75 76 /* Microsoft OS 2.0 compatible ID descriptor */ 77 struct msosv2_compatible_id { 78 uint16_t wLength; 79 uint16_t wDescriptorType; 80 uint8_t CompatibleID[8]; 81 uint8_t SubCompatibleID[8]; 82 } __packed; 83 84 /* Microsoft OS 2.0 Registry property descriptor: DeviceInterfaceGUIDs */ 85 struct msosv2_guids_property { 86 uint16_t wLength; 87 uint16_t wDescriptorType; 88 uint16_t wPropertyDataType; 89 uint16_t wPropertyNameLength; 90 uint8_t PropertyName[42]; 91 uint16_t wPropertyDataLength; 92 uint8_t bPropertyData[80]; 93 } __packed; 94 95 /* DeviceInterfaceGUIDs */ 96 #define DEVICE_INTERFACE_GUIDS_PROPERTY_NAME \ 97 'D', 0x00, 'e', 0x00, 'v', 0x00, 'i', 0x00, 'c', 0x00, 'e', 0x00, \ 98 'I', 0x00, 'n', 0x00, 't', 0x00, 'e', 0x00, 'r', 0x00, 'f', 0x00, \ 99 'a', 0x00, 'c', 0x00, 'e', 0x00, 'G', 0x00, 'U', 0x00, 'I', 0x00, \ 100 'D', 0x00, 's', 0x00, 0x00, 0x00 101 102 #endif /* ZEPHYR_INCLUDE_USB_MSOS_DESC_H */ 103