USB Device MSC API#
USB Device MSC API.
Modules#
Functions#
FUNCTION PROTOTYPES.
Add a new instance of the Mass Storage Class.
Add an existing MSC instance to the specified configuration.
Add an MSC logical unit to the MSC interface.
Get the MSC enable state of the device.
Macros#
MODULE.
SUBCLASS CODES.
PROTOCOL CODES.
Function Documentation#
sl_usbd_msc_init#
sl_status_t sl_usbd_msc_init (void )
FUNCTION PROTOTYPES.
N/A |
CONFIGURATION OVERRIDE FUNCTIONS MSC FUNCTIONS
Initialize internal structures and variables used by the Mass Storage Class Bulk Only Transport.
Returns
Returns SL_STATUS_OK on success or another SL_STATUS code on failure.
150
of file protocol/usb/inc/sl_usbd_class_msc.h
sl_usbd_msc_create_instance#
sl_status_t sl_usbd_msc_create_instance (uint8_t subclass, uint32_t msc_task_stack_size, osPriority_t msc_task_priority, sl_usbd_msc_subclass_driver_t * p_subclass_drv, void * p_subclass_arg, uint8_t * p_class_nbr)
Add a new instance of the Mass Storage Class.
N/A | subclass | MSC subclass code. |
N/A | msc_task_stack_size | Pointer to data structure of functions that implement the subclass driver. |
N/A | msc_task_priority | The USB stack creates a task to handle the events of each MSC instance. This parameter specifies the stack size to be used for the newly created task for this instance. |
N/A | p_subclass_drv | The USB stack creates a task to handle the events of each MSC instance. This parameter specifies the CMSIS priority of that task. |
N/A | p_subclass_arg | An argument that will be passed to the driver when driver functions are called. |
N/A | p_class_nbr | Pointer to a variable that will receive the instance number for the created class instance, if no errors are returned. Otherwise, the variable is set to SL_USBD_CLASS_NBR_NONE. |
Returns
Returns SL_STATUS_OK on success or another SL_STATUS code on failure.
174
of file protocol/usb/inc/sl_usbd_class_msc.h
sl_usbd_msc_add_to_configuration#
sl_status_t sl_usbd_msc_add_to_configuration (uint8_t class_nbr, uint8_t config_nbr)
Add an existing MSC instance to the specified configuration.
N/A | class_nbr | MSC instance number. |
N/A | config_nbr | Configuration index to which to add the existing MSC interface. |
Returns
Returns SL_STATUS_OK on success or another SL_STATUS code on failure.
Note
(1) sl_usbd_msc_add_to_configuration() adds an Interface descriptor and its associated Endpoint descriptor(s) to the Configuration descriptor. One call to sl_usbd_msc_add_to_configuration() builds the Configuration descriptor corresponding to an MSC device with the following format:
* Configuration Descriptor * |-- Interface Descriptor (MSC) * |-- Endpoint Descriptor (Bulk OUT) * |-- Endpoint Descriptor (Bulk IN) *
If sl_usbd_msc_add_to_configuration() is called several times from the application, it creates multiple instances and configurations. For example, the following architecture could be created for a high-speed device:
* High-speed * |-- Configuration 0 * |-- Interface 0 (MSC 0) * |-- Configuration 1 * |-- Interface 0 (MSC 0) * |-- Interface 1 (MSC 1) *
In this example, there are two instances of MSC: 'MSC 0' and 'MSC 1', and two possible configurations for the device: 'Configuration 0' and 'Configuration 1'. 'Configuration 1' is composed of two interfaces.
Each class instance has an association with one of the interfaces. If 'Configuration 1' is activated by the host, it allows the host to access two different functionalities offered by the device.
218
of file protocol/usb/inc/sl_usbd_class_msc.h
sl_usbd_msc_lun_add#
sl_status_t sl_usbd_msc_lun_add (uint8_t class_nbr, void * p_lu_data, uint8_t * p_lu_nbr)
Add an MSC logical unit to the MSC interface.
N/A | class_nbr | MSC instance number. |
N/A | p_lu_data | Pointer to the logical unit data to store in LU data structure. |
N/A | p_lu_nbr | Pointer to a variable that will receive Logical Unit Number. |
Returns
Returns SL_STATUS_OK on success or another SL_STATUS code on failure.
232
of file protocol/usb/inc/sl_usbd_class_msc.h
sl_usbd_msc_is_enabled#
sl_status_t sl_usbd_msc_is_enabled (uint8_t class_nbr, bool * p_enabled)
Get the MSC enable state of the device.
N/A | class_nbr | MSC instance number. |
N/A | p_enabled | Pointer to a boolean variable that will receive enable state. The variable is set to true if MSC class is enabled. The variable is set to false if the MSC class is not enabled. |
Returns
Returns SL_STATUS_OK on success or another SL_STATUS code on failure.
247
of file protocol/usb/inc/sl_usbd_class_msc.h
Macro Definition Documentation#
SL_USBD_MSC_LU_NBR_INVALID#
#define SL_USBD_MSC_LU_NBR_INVALIDValue:
255u
MODULE.
INCLUDE FILES MACROS
63
of file protocol/usb/inc/sl_usbd_class_msc.h
SL_USBD_MSC_SUBCLASS_CODE_RBC#
#define SL_USBD_MSC_SUBCLASS_CODE_RBCValue:
0x01
SUBCLASS CODES.
Note(s) : (1) See 'USB Mass Storage Class Specification Overview', Revision 1.2, Section 2
71
of file protocol/usb/inc/sl_usbd_class_msc.h
SL_USBD_MSC_SUBCLASS_CODE_SFF_8020i#
#define SL_USBD_MSC_SUBCLASS_CODE_SFF_8020iValue:
0x02
72
of file protocol/usb/inc/sl_usbd_class_msc.h
SL_USBD_MSC_SUBCLASS_CODE_MMC_2#
#define SL_USBD_MSC_SUBCLASS_CODE_MMC_2Value:
0x02
73
of file protocol/usb/inc/sl_usbd_class_msc.h
SL_USBD_MSC_SUBCLASS_CODE_QIC_157#
#define SL_USBD_MSC_SUBCLASS_CODE_QIC_157Value:
0x03
74
of file protocol/usb/inc/sl_usbd_class_msc.h
SL_USBD_MSC_SUBCLASS_CODE_UFI#
#define SL_USBD_MSC_SUBCLASS_CODE_UFIValue:
0x04
75
of file protocol/usb/inc/sl_usbd_class_msc.h
SL_USBD_MSC_SUBCLASS_CODE_SFF_8070i#
#define SL_USBD_MSC_SUBCLASS_CODE_SFF_8070iValue:
0x05
76
of file protocol/usb/inc/sl_usbd_class_msc.h
SL_USBD_MSC_SUBCLASS_CODE_SCSI#
#define SL_USBD_MSC_SUBCLASS_CODE_SCSIValue:
0x06
77
of file protocol/usb/inc/sl_usbd_class_msc.h
SL_USBD_MSC_PROTOCOL_CODE_CTRL_BULK_INTR_CMD_INTR#
#define SL_USBD_MSC_PROTOCOL_CODE_CTRL_BULK_INTR_CMD_INTRValue:
0x00
PROTOCOL CODES.
Note(s) : (1) See 'USB Mass Storage Class Specification Overview', Revision 1.2, Section 3
85
of file protocol/usb/inc/sl_usbd_class_msc.h
SL_USBD_MSC_PROTOCOL_CODE_CTRL_BULK_INTR#
#define SL_USBD_MSC_PROTOCOL_CODE_CTRL_BULK_INTRValue:
0x01
86
of file protocol/usb/inc/sl_usbd_class_msc.h
SL_USBD_MSC_PROTOCOL_CODE_BULK_ONLY#
#define SL_USBD_MSC_PROTOCOL_CODE_BULK_ONLYValue:
0x50
87
of file protocol/usb/inc/sl_usbd_class_msc.h