MSD

Defines

#define GET_MAX_LUN   0xFE
#define MASS_STORAGE_RESET   0xFF
#define LUN_DATA_LENGTH   1
#define MSD_IMR_MSK   (CNTR_CTRM | CNTR_RESETM)

Functions

s32 MSD_Init (u32 mode)
s32 MSD_Periodic_mS (void)
s32 MSD_CheckAvailable (void)
s32 MSD_LUN_AvailableSet (u8 lun, u8 available)
s32 MSD_LUN_AvailableGet (u8 lun)
s32 MSD_RdLEDGet (u16 lag_ms)
s32 MSD_WrLEDGet (u16 lag_ms)

Detailed Description

USB Mass Storage Device Driver

Mainly based on STM32 example code and adapted to MIOS32.

Application examples:


Define Documentation

#define GET_MAX_LUN   0xFE
#define LUN_DATA_LENGTH   1
#define MASS_STORAGE_RESET   0xFF
#define MSD_IMR_MSK   (CNTR_CTRM | CNTR_RESETM)

Function Documentation

s32 MSD_CheckAvailable ( void   ) 

This function returns the connection status of the USB MIDI interface

Returns:
1: interface available
0: interface not available
s32 MSD_Init ( u32  mode  ) 

Initializes the USB Device Driver for a Mass Storage Device

Should be called during runtime once a SD Card has been connected.
It is possible to switch back to the original device driver provided by MIOS32 (e.g. MIOS32_USB_MIDI) by calling MIOS32_USB_Init(1)

Parameters:
[in] mode currently only mode 0 supported
Returns:
< 0 if initialisation failed

Here is the call graph for this function:

s32 MSD_LUN_AvailableGet ( u8  lun  ) 
Returns:
1 if device is mounted by host
0 if device is not mounted by host
s32 MSD_LUN_AvailableSet ( u8  lun,
u8  available 
)

The logical unit is available whenever MSD_Init() is called, or the USB cable has been reconnected.

It will be disabled when the host unmounts the file system (like if the SD Card would be removed.

When this happens, the application can either call MIOS32_USB_Init(1) again, e.g. to switch to USB MIDI, or it can make the LUN available again by calling MSD_LUN_AvailableSet(0, 1)

Parameters:
[in] lun Logical Unit number (0)
[in] available 0 or 1
Returns:
< 0 on errors
s32 MSD_Periodic_mS ( void   ) 

Should be called periodically each millisecond so long this driver is active (and only then!) to handle USBtransfers.

Take care that no other task accesses SD Card while this function is processed!

Ensure that this function isn't called when a MIOS32 USB driver like MIOS32_USB_MIDI is running!

Returns:
< 0 on errors
s32 MSD_RdLEDGet ( u16  lag_ms  ) 

Returns status of "Read LED"

Parameters:
[in] lag_ms The "lag" of the LED (e.g. 250 for 250 mS)
Returns:
1: a read operation has happened in the last x mS (x == time defined by "lag")
0: no read operation has happened in the last x mS (x == time defined by "lag")
s32 MSD_WrLEDGet ( u16  lag_ms  ) 

Returns status of "Write LED"

Parameters:
[in] lag_ms The "lag" of the LED (e.g. 250 for 250 mS)
Returns:
1: a write operation has happened in the last x mS (x == time defined by "lag")
0: no write operation has happened in the last x mS (x == time defined by "lag")

Generated on 22 Jan 2016 for MIOS32 by  doxygen 1.6.1