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  * @since 3.4
31  * @version 0.1.0
32  * @{
33  */
34 
35 /**
36  * @brief Define USB Mass Storage Class logical unit
37  *
38  * Use this macro to create Logical Unit mapping in USB MSC for selected disk.
39  * Up to `CONFIG_USBD_MSC_LUNS_PER_INSTANCE` disks can be registered on single
40  * USB MSC instance. Currently only one USB MSC instance is supported.
41  *
42  * @param id Identifier by which the linker sorts registered LUNs
43  * @param disk_name Disk name as used in @ref disk_access_interface
44  * @param t10_vendor T10 Vendor Indetification
45  * @param t10_product T10 Product Identification
46  * @param t10_revision T10 Product Revision Level
47  */
48 #define USBD_DEFINE_MSC_LUN(id, disk_name, t10_vendor, t10_product, t10_revision)	\
49 	static const STRUCT_SECTION_ITERABLE(usbd_msc_lun, usbd_msc_lun_##id) = {	\
50 		.disk = disk_name,							\
51 		.vendor = t10_vendor,							\
52 		.product = t10_product,							\
53 		.revision = t10_revision,						\
54 	}
55 
56 /**
57  * @}
58  */
59 
60 #endif /* ZEPHYR_INCLUDE_USB_CLASS_USBD_MSC_H_ */
61