USB Device MSC API#

USB Device MSC API.

Modules#

sl_usbd_msc_subclass_driver_t

Functions#

sl_status_t

FUNCTION PROTOTYPES.

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.

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.

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.

sl_status_t
sl_usbd_msc_is_enabled(uint8_t class_nbr, bool *p_enabled)

Get the MSC enable state of the device.

Function Documentation#

sl_usbd_msc_init#

sl_status_t sl_usbd_msc_init (void )

FUNCTION PROTOTYPES.

Parameters
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.


Definition at line 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.

Parameters
N/Asubclass

MSC subclass code.

N/Amsc_task_stack_size

Pointer to data structure of functions that implement the subclass driver.

N/Amsc_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/Ap_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/Ap_subclass_arg

An argument that will be passed to the driver when driver functions are called.

N/Ap_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.


Definition at line 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.

Parameters
N/Aclass_nbr

MSC instance number.

N/Aconfig_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.


Definition at line 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.

Parameters
N/Aclass_nbr

MSC instance number.

N/Ap_lu_data

Pointer to the logical unit data to store in LU data structure.

N/Ap_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.


Definition at line 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.

Parameters
N/Aclass_nbr

MSC instance number.

N/Ap_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.


Definition at line 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_INVALID
Value:
255u

MODULE.

INCLUDE FILES MACROS


Definition at line 63 of file protocol/usb/inc/sl_usbd_class_msc.h

SL_USBD_MSC_SUBCLASS_CODE_RBC#

#define SL_USBD_MSC_SUBCLASS_CODE_RBC
Value:
0x01

SUBCLASS CODES.

Note(s) : (1) See 'USB Mass Storage Class Specification Overview', Revision 1.2, Section 2


Definition at line 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_8020i
Value:
0x02

Definition at line 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_2
Value:
0x02

Definition at line 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_157
Value:
0x03

Definition at line 74 of file protocol/usb/inc/sl_usbd_class_msc.h

SL_USBD_MSC_SUBCLASS_CODE_UFI#

#define SL_USBD_MSC_SUBCLASS_CODE_UFI
Value:
0x04

Definition at line 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_8070i
Value:
0x05

Definition at line 76 of file protocol/usb/inc/sl_usbd_class_msc.h

SL_USBD_MSC_SUBCLASS_CODE_SCSI#

#define SL_USBD_MSC_SUBCLASS_CODE_SCSI
Value:
0x06

Definition at line 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_INTR
Value:
0x00

PROTOCOL CODES.

Note(s) : (1) See 'USB Mass Storage Class Specification Overview', Revision 1.2, Section 3


Definition at line 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_INTR
Value:
0x01

Definition at line 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_ONLY
Value:
0x50

Definition at line 87 of file protocol/usb/inc/sl_usbd_class_msc.h