USB Device MSC SCSI API#
USB Device MSC SCSI API.
Modules#
Functions#
FUNCTION PROTOTYPES.
Add a new instance of SCSI Mass Storage Class.
Add an existing MSC SCSI instance to the specified configuration.
Initialize the specified logical unit.
Attach a storage medium to the given SCSI logical unit.
Detach a storage medium from the given SCSI logical unit.
Retrieve capacity of logical unit.
Get the MSC enable state of the SCSI interface.
Typedef Documentation#
sl_usbd_msc_scsi_lb_qty_t#
typedef uint32_t sl_usbd_msc_scsi_lb_qty_t
MODULE.
INCLUDE FILES DATA TYPES SCSI LBA Types
67
of file protocol/usb/inc/sl_usbd_class_msc_scsi.h
sl_usbd_msc_scsi_lba_t#
typedef uint32_t sl_usbd_msc_scsi_lba_t
68
of file protocol/usb/inc/sl_usbd_class_msc_scsi.h
Function Documentation#
sl_usbd_msc_scsi_init#
sl_status_t sl_usbd_msc_scsi_init (void )
FUNCTION PROTOTYPES.
N/A |
MSC FUNCTIONS
Initialize internal tables, variables and the storage layer.
Returns
Returns SL_STATUS_OK on success or another SL_STATUS code on failure.
161
of file protocol/usb/inc/sl_usbd_class_msc_scsi.h
sl_usbd_msc_scsi_create_instance#
sl_status_t sl_usbd_msc_scsi_create_instance (uint32_t msc_task_stack_size, osPriority_t msc_task_priority, sl_usbd_msc_scsi_callbacks_t * p_scsi_callbacks, uint8_t * p_class_nbr)
Add a new instance of SCSI Mass Storage Class.
N/A | msc_task_stack_size | 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 | msc_task_priority | 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_scsi_callbacks | Pointer to MSC SCSI callback structure. [Content MUST be persistent] |
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.
182
of file protocol/usb/inc/sl_usbd_class_msc_scsi.h
sl_usbd_msc_scsi_add_to_configuration#
sl_status_t sl_usbd_msc_scsi_add_to_configuration (uint8_t class_nbr, uint8_t config_nbr)
Add an existing MSC SCSI 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.
196
of file protocol/usb/inc/sl_usbd_class_msc_scsi.h
sl_usbd_msc_scsi_lun_add#
sl_status_t sl_usbd_msc_scsi_lun_add (uint8_t class_nbr, sl_usbd_msc_scsi_lun_info_t * p_lu_info, sl_usbd_msc_scsi_lun_t ** p_scsi_lun_ptr)
Initialize the specified logical unit.
N/A | class_nbr | MSC SCSI instance number. |
N/A | p_lu_info | Pointer to logical unit information structure. |
N/A | p_scsi_lun_ptr | Pointer to a void pointer that will be set to point to SCSI-related logical unit data. |
Returns
Returns SL_STATUS_OK on success or another SL_STATUS code on failure.
210
of file protocol/usb/inc/sl_usbd_class_msc_scsi.h
sl_usbd_msc_scsi_lun_attach#
sl_status_t sl_usbd_msc_scsi_lun_attach (sl_usbd_msc_scsi_lun_t * p_scsi_lun)
Attach a storage medium to the given SCSI logical unit.
N/A | p_scsi_lun | Pointer to Logical Unit structure returned by sl_usbd_msc_scsi_lun_add(). |
Returns
Returns SL_STATUS_OK on success or another SL_STATUS code on failure.
Note
(1) If the logical unit has been ejected from the host, calling sl_usbd_msc_scsi_lun_detach() and sl_usbd_msc_scsi_lun_attach() will make it re-appear.
(2) Use this function with care as ejecting a logical unit in the middle of a transfer may corrupt the file system. The only scenarios where the usage of this function is safe are:
(a) Host: Read, Embedded app: Read
(b) Host: Read, Embedded app: Write The following scenarios are not considered safe. Use at your own risk.
(a) Host: Write, Embedded app: Read
(b) Host: Write, Embedded app: Write
233
of file protocol/usb/inc/sl_usbd_class_msc_scsi.h
sl_usbd_msc_scsi_lun_detach#
sl_status_t sl_usbd_msc_scsi_lun_detach (sl_usbd_msc_scsi_lun_t * p_scsi_lun)
Detach a storage medium from the given SCSI logical unit.
N/A | p_scsi_lun | Pointer to Logical Unit structure returned by sl_usbd_msc_scsi_lun_add(). |
Returns
Returns SL_STATUS_OK on success or another SL_STATUS code on failure.
Note
(1) After a call to this function, the media will be available to the embedded application. The standard file API can be used.
(2) Use this function with care as ejecting a logical unit in the middle of a transfer may corrupt the file system. The only scenarios where the usage of this function is considered safe are:
(a) Host: Read, Embedded app: Read
(b) Host: Read, Embedded app: Write The following scenarios are not considered safe. Use at your own risk.
(a) Host: Write, Embedded app: Read
(b) Host: Write, Embedded app: Write
254
of file protocol/usb/inc/sl_usbd_class_msc_scsi.h
sl_usbd_msc_scsi_lun_get_capacity#
sl_status_t sl_usbd_msc_scsi_lun_get_capacity (sl_usbd_msc_scsi_lun_t * p_scsi_lun, sl_usbd_msc_scsi_lb_qty_t * p_lb_qty, uint32_t * p_blk_size)
Retrieve capacity of logical unit.
N/A | p_scsi_lun | Pointer to Logical Unit structure returned by sl_usbd_msc_scsi_lun_add(). |
N/A | p_lb_qty | Pointer to a variable that will receive LB quantity. |
N/A | p_blk_size | Pointer to a variable that will receive block size. |
Returns
Returns SL_STATUS_OK on success or another SL_STATUS code on failure.
267
of file protocol/usb/inc/sl_usbd_class_msc_scsi.h
sl_usbd_msc_scsi_is_enabled#
sl_status_t sl_usbd_msc_scsi_is_enabled (uint8_t class_nbr, bool * p_enabled)
Get the MSC enable state of the SCSI interface.
N/A | class_nbr | MSC SCSI 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.
282
of file protocol/usb/inc/sl_usbd_class_msc_scsi.h