cancel
Showing results for 
Search instead for 
Did you mean: 

USBX MSC *media_status value meaning

ABasi.2
Senior

Hello!

i'm developing a firmware that use an SD card connected to USBX MSC, and i have a couple of question

 

i want to understand better the  ULONG *media_status value returned in the function :

UINT USBD_STORAGE_Status(VOID *storage_instance, ULONG lun,
                         ULONG media_id,ULONG *media_status) 

UINT USBD_STORAGE_Flush(VOID *storage_instance, ULONG lun, ULONG number_blocks,
                        ULONG lba, ULONG *media_status)

UINT USBD_STORAGE_Write(VOID *storage_instance, ULONG lun, UCHAR *data_pointer,
                        ULONG number_blocks, ULONG lba, ULONG *media_status) 

UINT USBD_STORAGE_Read(VOID *storage_instance, ULONG lun, UCHAR *data_pointer,
                       ULONG number_blocks, ULONG lba, ULONG *media_status)                

 i'm hoping that value is related to the SCSI code value that windows need from a USB MSC

is it true? beyond UX_SUCCESS which value can i use? for example to indicate the media as changed  or is readonly?

how can the functions ULONG USBD_STORAGE_GetMediaLastLba(VOID) and ULONG USBD_STORAGE_GetMediaBlocklength(VOID) can be fired againafter initialization? (maybe i have changed the SD card)

 

whats the meaning of this function? 

UINT USBD_STORAGE_Notification(VOID *storage_instance, ULONG lun, ULONG media_id,
                               ULONG notification_class, UCHAR **media_notification,
                               ULONG *media_notification_length)

 

thank you!

 

best reguards

 

2 REPLIES 2
FBL
ST Employee

Hi @ABasi.2 

Checking USBX documentation I found  : media_status should be filled out exactly like the media status callback return value. Check here for further details.

The return value of your read/write/flush functions is only UX_SUCCESS or UX_ERROR. It could be UX_STATE_NEXT in standalone applications.

About USBD_STORAGE_Notification is not commonly used in simple applications. Its purpose to provide a buffer with notification data to the host.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.


HELLO @FBL 

media_status should be filled out exactly like the media status callback return value and what does it mean? if i want to tell windows the media as changed? or if is now read only?

how to do that?

where the SCSI code are used?

 

The return value of your read/write/flush functions is only UX_SUCCESS or UX_ERROR. It could be UX_STATE_NEXT in standalone applications. ok for that, is the only "OK or error" return

 

About USBD_STORAGE_Notification is not commonly used in simple applications. Its purpose to provide a buffer with notification data to the host.

my isn't a "simple application" there is documentation about that?

 

i need to make a professional use of USBX msc , with using changed media , media in read only, ability to disconnect and reconnect the SD card , use of SCSI code ecc

 

there is a complex example or at least documentation about that?

 

thank you