The component manages a disk on a volatile memory (internal RAM).
This can be connected to a File System management or a USB Device Mass Storage Interface via the service Memory Control Access.
Ctrl_status virtual_mem_2_ram |
( |
uint32_t |
addr, |
|
|
void * |
ram |
|
) |
| |
This function transfers 1 data sector from memory to RAM sector = 512 bytes.
- Parameters
-
addr | Sector address to start read |
ram | Address of RAM buffer |
- Returns
- Ctrl_status It is ready -> CTRL_GOOD Memory unplug -> CTRL_NO_PRESENT Not initialized or changed -> CTRL_BUSY An error occurred -> CTRL_FAIL
Ctrl_status virtual_ram_2_mem |
( |
uint32_t |
addr, |
|
|
const void * |
ram |
|
) |
| |
This function transfers 1 data sector from memory to RAM sector = 512 bytes.
- Parameters
-
addr | Sector address to start write |
ram | Address of RAM buffer |
- Returns
- Ctrl_status It is ready -> CTRL_GOOD Memory unplug -> CTRL_NO_PRESENT Not initialized or changed -> CTRL_BUSY An error occurred -> CTRL_FAIL
Ctrl_status virtual_read_capacity |
( |
uint32_t * |
uint32_t_nb_sector | ) |
|
This function returns the address of the last valid sector.
- Parameters
-
uint32_t_nb_sector | Pointer to number of sectors (sector=512 bytes) |
- Returns
- Ctrl_status It is ready -> CTRL_GOOD Memory unplug -> CTRL_NO_PRESENT Not initialized or changed -> CTRL_BUSY An error occurred -> CTRL_FAIL
bool virtual_removal |
( |
void |
| ) |
|
This function informs about the memory type.
- Returns
- true if the memory is removable
This function tests memory state, and starts memory initialization.
- Returns
- Ctrl_status It is ready -> CTRL_GOOD Memory unplug -> CTRL_NO_PRESENT Not initialized or changed -> CTRL_BUSY An error occurred -> CTRL_FAIL
This function unloads/loads the memory.
- Returns
- true if the memory is unloaded
References b_vmem_unloaded.
Ctrl_status virtual_usb_read_10 |
( |
uint32_t |
addr, |
|
|
uint16_t |
nb_sector |
|
) |
| |
This function transfers the memory data to the USB MSC interface.
- Parameters
-
addr | Sector address to start read |
nb_sector | Number of sectors to transfer (sector=512 bytes) |
- Returns
- Ctrl_status It is ready -> CTRL_GOOD Memory unplug -> CTRL_NO_PRESENT Not initialized or changed -> CTRL_BUSY An error occurred -> CTRL_FAIL
static Ctrl_status virtual_usb_trans |
( |
uint32_t |
addr, |
|
|
uint16_t |
nb_sector, |
|
|
bool |
b_read |
|
) |
| |
|
static |
This function transfers the data between memory and USB MSC interface.
- Parameters
-
addr | Sector address to start read |
nb_sector | Number of sectors to transfer (sector=512 bytes) |
b_read | Memory to USB, if true |
- Returns
- Ctrl_status It is ready -> CTRL_GOOD Memory unplug -> CTRL_NO_PRESENT Not initialized or changed -> CTRL_BUSY An error occurred -> CTRL_FAIL
References buffer, CTRL_FAIL, CTRL_GOOD, min, NULL, udi_msc_trans_block(), vmem_data, VMEM_NB_SECTOR, and VMEM_SECTOR_SIZE.
Referenced by virtual_usb_read_10(), and virtual_usb_write_10().
Ctrl_status virtual_usb_write_10 |
( |
uint32_t |
addr, |
|
|
uint16_t |
nb_sector |
|
) |
| |
This function transfers the USB MSC data to the memory.
- Parameters
-
addr | Sector address to start write |
nb_sector | Number of sectors to transfer (sector=512 bytes) |
- Returns
- Ctrl_status It is ready -> CTRL_GOOD Memory unplug -> CTRL_NO_PRESENT Not initialized or changed -> CTRL_BUSY An error occurred -> CTRL_FAIL
bool virtual_wr_protect |
( |
void |
| ) |
|
This function returns the write-protected mode.
- Returns
- true if the memory is protected