You are viewing documentation for version:
1.0
|
Version History
USB Device MSC SCSI API.
|
sl_status_t
|
sl_usbd_msc_scsi_init
(void)
|
|
Initialize internal tables, variables and the storage layer.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
◆
sl_usbd_msc_scsi_init()
sl_status_t sl_usbd_msc_scsi_init
|
(
|
void
|
|
)
|
|
Initialize internal tables, variables and the storage layer.
-
Returns
-
Returns SL_STATUS_OK on success or another SL_STATUS code on failure.
◆
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.
-
Parameters
-
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.
|
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.
|
p_scsi_callbacks
|
Pointer to MSC SCSI callback structure. [Content MUST be persistent]
|
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.
◆
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.
-
Parameters
-
class_nbr
|
MSC instance number.
|
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.
◆
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.
-
Parameters
-
class_nbr
|
MSC SCSI instance number.
|
p_lu_info
|
Pointer to logical unit information structure.
|
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.
◆
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.
-
Parameters
-
-
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
◆
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.
-
Parameters
-
-
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
◆
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.
-
Parameters
-
p_scsi_lun
|
Pointer to Logical Unit structure returned by
sl_usbd_msc_scsi_lun_add()
.
|
p_lb_qty
|
Pointer to a variable that will receive LB quantity.
|
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.
◆
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.
-
Parameters
-
class_nbr
|
MSC SCSI instance number.
|
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.
◆
sl_usbd_msc_scsi_lb_qty_t