1 /*
2  * Copyright (c) 2023 Nordic Semiconductor ASA
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 /**
8  * @file
9  * @brief USBD Mass Storage Class public header
10  *
11  * Header exposes API for registering LUNs.
12  */
13 
14 #include <zephyr/sys/iterable_sections.h>
15 
16 #ifndef ZEPHYR_INCLUDE_USB_CLASS_USBD_MSC_H_
17 #define ZEPHYR_INCLUDE_USB_CLASS_USBD_MSC_H_
18 
19 struct usbd_msc_lun {
20 	const char *disk;
21 	const char *vendor;
22 	const char *product;
23 	const char *revision;
24 };
25 
26 /**
27  * @brief USB Mass Storage Class device API
28  * @defgroup usbd_msc_device USB Mass Storage Class device API
29  * @ingroup usb
30  * @{
31  */
32 
33 /**
34  * @brief Define USB Mass Storage Class logical unit
35  *
36  * Use this macro to create Logical Unit mapping in USB MSC for selected disk.
37  * Up to `CONFIG_USBD_MSC_LUNS_PER_INSTANCE` disks can be registered on single
38  * USB MSC instance. Currently only one USB MSC instance is supported.
39  *
40  * @param disk_name Disk name as used in @ref disk_access_interface
41  * @param t10_vendor T10 Vendor Indetification
42  * @param t10_product T10 Product Identification
43  * @param t10_revision T10 Product Revision Level
44  */
45 #define USBD_DEFINE_MSC_LUN(disk_name, t10_vendor, t10_product, t10_revision)	\
46 	STRUCT_SECTION_ITERABLE(usbd_msc_lun, usbd_msc_lun_##disk_name) = {	\
47 		.disk = STRINGIFY(disk_name),					\
48 		.vendor = t10_vendor,						\
49 		.product = t10_product,						\
50 		.revision = t10_revision,					\
51 	}
52 
53 /**
54  * @}
55  */
56 
57 #endif /* ZEPHYR_INCLUDE_USB_CLASS_USBD_MSC_H_ */
58