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) |
USB Mass Storage Device Driver
Mainly based on STM32 example code and adapted to MIOS32.
Application examples:
#define GET_MAX_LUN 0xFE |
#define LUN_DATA_LENGTH 1 |
#define MASS_STORAGE_RESET 0xFF |
#define MSD_IMR_MSK (CNTR_CTRM | CNTR_RESETM) |
s32 MSD_CheckAvailable | ( | void | ) |
This function returns the connection status of the USB MIDI interface
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)
[in] | mode | currently only mode 0 supported |
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)
[in] | lun | Logical Unit number (0) |
[in] | available | 0 or 1 |
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 status of "Read LED"
[in] | lag_ms | The "lag" of the LED (e.g. 250 for 250 mS) |