VSF Documented
vsf_usbd_MSC_desc.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_MSC_DESC_H__
19#define __VSF_USBD_MSC_DESC_H__
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25/*============================ INCLUDES ======================================*/
26/*============================ MACROS ========================================*/
27
28// __INT_EP_INTERVAL: HS 0x10, otherwise 0xFF
29#define USB_DESC_MSC(__IFS, __SUB_CLASS, __PROTOCOL, __I_FUNC) \
30 USB_DESC_IFS((__IFS), 0, 2, USB_CLASS_MASS_STORAGE, (__SUB_CLASS), (__PROTOCOL), (__I_FUNC))
31
32#define USB_DESC_MSC_IAD(__IFS, __SUB_CLASS, __PROTOCOL, __I_FUNC) \
33 USB_DESC_IAD((__IFS), 1, USB_CLASS_MASS_STORAGE, __SUB_CLASS, __PROTOCOL, (__I_FUNC))\
34 USB_DESC_MSC((__IFS), (__SUB_CLASS), (__PROTOCOL), (__I_FUNC))
35
36#define USB_DESC_MSCBOT(__IFS, __I_FUNC, __BULK_IN_EP, __BULK_OUT_EP, __BULK_EP_SIZE)\
37 USB_DESC_MSC((__IFS), 0x06, 0x50, (__I_FUNC)) \
38 USB_DESC_EP(USB_DIR_IN | (__BULK_IN_EP), USB_ENDPOINT_XFER_BULK, __BULK_EP_SIZE, 0x00)\
39 USB_DESC_EP(USB_DIR_OUT | (__BULK_OUT_EP), USB_ENDPOINT_XFER_BULK, __BULK_EP_SIZE, 0x00)
40#define USB_DESC_MSCBOT_LEN (USB_DT_INTERFACE_SIZE + 2 * USB_DT_ENDPOINT_SIZE)
41
42#define USB_DESC_MSCBOT_IAD(__IFS, __I_FUNC, __BULK_IN_EP, __BULK_OUT_EP, __BULK_EP_SIZE)\
43 USB_DESC_MSC_IAD((__IFS), 0x06, 0x50, (__I_FUNC)) \
44 USB_DESC_EP(USB_DIR_IN | (__BULK_IN_EP), USB_ENDPOINT_XFER_BULK, __BULK_EP_SIZE, 0x00)\
45 USB_DESC_EP(USB_DIR_OUT | (__BULK_OUT_EP), USB_ENDPOINT_XFER_BULK, __BULK_EP_SIZE, 0x00)
46#define USB_DESC_MSCBOT_IAD_LEN (USB_DESC_IAD_LEN + USB_DESC_MSCBOT_LEN)
47
48/*============================ MACROFIED FUNCTIONS ===========================*/
49/*============================ TYPES =========================================*/
50/*============================ GLOBAL VARIABLES ==============================*/
51/*============================ PROTOTYPES ====================================*/
52
53#ifdef __cplusplus
54}
55#endif
56
57#endif // __VSF_USBD_MSC_DESC_H__