VSF Documented
vsf_usbd_ms.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Copyright(C)2009-2022 by VSF Team *
3 * *
4 * Licensed under the Apache License, Version 2.0 (the "License"); *
5 * you may not use this file except in compliance with the License. *
6 * You may obtain a copy of the License at *
7 * *
8 * http://www.apache.org/licenses/LICENSE-2.0 *
9 * *
10 * Unless required by applicable law or agreed to in writing, software *
11 * distributed under the License is distributed on an "AS IS" BASIS, *
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13 * See the License for the specific language governing permissions and *
14 * limitations under the License. *
15 * *
16 ****************************************************************************/
17
18#ifndef __VSF_USBD_MSEXT_H__
19#define __VSF_USBD_MSEXT_H__
20
21/*============================ INCLUDES ======================================*/
22
24
25#if VSF_USE_USB_DEVICE == ENABLED
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31/*============================ MACROS ========================================*/
32
33#define USB_MSOS10_GENRE 1
34#define USB_MSOS10_EXT_COMPATID_INDEX 4
35#define USB_MSOS10_EXT_PROPERTIES_INDEX 5
36
37#define USB_MSOS10_EXT_COMPATID_HEADER_LEN 16
38#define USB_MSOS10_EXT_COMPATID_FUNC_LEN 24
39
40#define __usbd_msos10_compatid_func_desc(__first_ifs, ...) \
41 { \
42 (__first_ifs), /* bFirstInterfaceNumber */ \
43 1, /* Reserved */ \
44 __VA_ARGS__ \
45 },
46
47#define __usbd_msos10_compatid_desc(__name, __section_cnt, ...) \
48 typedef struct __##__name##_msos10_compatid_desc_t { \
49 uint8_t header[USB_MSOS10_EXT_COMPATID_HEADER_LEN]; \
50 uint8_t func[__section_cnt][USB_MSOS10_EXT_COMPATID_FUNC_LEN]; \
51 } __##__name##_msos10_compatid_desc_t; \
52 const __##__name##_msos10_compatid_desc_t __##__name##_msos10_compatid_desc = {\
53 USB_DESC_DWORD(40), /* dwLength */ \
54 USB_DESC_WORD(0x0100), /* bcdVersion: 1.0 */ \
55 USB_DESC_WORD(4), /* wIndex: Extended compat ID descriptor index */\
56 (__section_cnt), /* bCount: Number of function sections */\
57 0, 0, 0, 0, 0, 0, 0, /* Reserved */ \
58 __VA_ARGS__ \
59 };
60
61#define usbd_msos10_compatid_desc(__name, __section_cnt, ...) \
62 __usbd_msos10_compatid_desc(__name, (__section_cnt), __VA_ARGS__)
63
64#define __usbd_msos10_compatid_desc_buffer(__name) \
65 &__##__name##_msos10_compatid_desc
66#define __usbd_msos10_compatid_desc_len(__name) \
67 sizeof(__##__name##_msos10_compatid_desc)
68#define usbd_msos10_compatid_desc_buffer(__name) \
69 __usbd_msos10_compatid_desc_buffer(__name)
70#define usbd_msos10_compatid_desc_len(__name) \
71 __usbd_msos10_compatid_desc_len(__name)
72
73/*============================ MACROFIED FUNCTIONS ===========================*/
74/*============================ TYPES =========================================*/
75/*============================ GLOBAL VARIABLES ==============================*/
76/*============================ PROTOTYPES ====================================*/
77
78#ifdef __cplusplus
79}
80#endif
81
82#endif // VSF_USE_USB_DEVICE
83#endif // __VSF_USBD_MSEXT_H__