#include "conf_access.h"
#include "virtual_mem.h"
#include "usb_drv.h"
#include "scsi_decoder.h"
#include <string.h>
Functions | |
static void | virtual_check_init (void) |
This function initializes the memory. More... | |
Ctrl_status | virtual_mem_2_ram (uint32_t addr, void *ram) |
This function transfers 1 data sector from memory to RAM sector = 512 bytes. More... | |
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. More... | |
Ctrl_status | virtual_read_capacity (uint32_t *u32_nb_sector) |
This function returns the address of the last valid sector. More... | |
bool | virtual_removal (void) |
This function informs about the memory type. More... | |
Ctrl_status | virtual_test_unit_ready (void) |
This function tests memory state, and starts memory initialization. More... | |
Ctrl_status | virtual_usb_read_10 (uint32_t addr, uint16_t nb_sector) |
This function transfers the memory data (programmed in sbc_read_10) directly to the USB interface sector = 512 bytes. More... | |
Ctrl_status | virtual_usb_write_10 (uint32_t addr, uint16_t nb_sector) |
This function transfers the USB data (programmed in sbc_write_10) directly to the memory interface sector = 512 bytes. More... | |
bool | virtual_wr_protect (void) |
This function returns the write-protected mode Only used by memory removal with a HARDWARE-SPECIFIC write-protected detection. More... | |
Variables | |
static bool | cram_init = false |
static uint8_t | vmem_data [VMEM_NB_SECTOR *VMEM_SECTOR_SIZE] |
|
static |
This function initializes the memory.
References cram_init, FAT_SECTOR, PBR_SECTOR, VMEM_CLUSTER_SIZE, vmem_data, VMEM_MEDIA_TYPE, VMEM_NB_FATS, VMEM_NB_HEAD, VMEM_NB_HIDDEN_SECT, VMEM_NB_ROOT_ENTRY, VMEM_NB_SECTOR, VMEM_RESERVED_SIZE, VMEM_SECT_PER_TRACK, VMEM_SECTOR_SIZE, VMEM_SIZE_FAT, and VMEN_DRIVE_NUMBER.
Referenced by virtual_mem_2_ram(), virtual_ram_2_mem(), virtual_read_capacity(), virtual_test_unit_ready(), virtual_usb_read_10(), and virtual_usb_write_10().
Ctrl_status virtual_mem_2_ram | ( | uint32_t | addr, |
void * | ram | ||
) |
This function transfers 1 data sector from memory to RAM sector = 512 bytes.
addr | Sector address to start read |
ram | Address of RAM buffer |
References CTRL_FAIL, CTRL_GOOD, Max, min, virtual_check_init(), vmem_data, VMEM_NB_SECTOR, and VMEM_SECTOR_SIZE.
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.
addr | Sector address to start write |
ram | Address of RAM buffer |
References CTRL_FAIL, CTRL_GOOD, virtual_check_init(), vmem_data, VMEM_NB_SECTOR, and VMEM_SECTOR_SIZE.
Ctrl_status virtual_read_capacity | ( | uint32_t * | u32_nb_sector | ) |
This function returns the address of the last valid sector.
u32_nb_sector | Pointer to number of sectors (sector = 512 bytes) |
References CTRL_GOOD, Max, virtual_check_init(), and VMEM_NB_SECTOR.
bool virtual_removal | ( | void | ) |
This function informs about the memory type.
Ctrl_status virtual_test_unit_ready | ( | void | ) |
This function tests memory state, and starts memory initialization.
References CTRL_GOOD, and virtual_check_init().
Ctrl_status virtual_usb_read_10 | ( | uint32_t | addr, |
uint16_t | nb_sector | ||
) |
This function transfers the memory data (programmed in sbc_read_10) directly to the USB interface sector = 512 bytes.
addr | Sector address to start read |
nb_sector | Number of sectors to transfer |
References CTRL_FAIL, CTRL_GOOD, data_to_transfer, g_scsi_ep_ms_in, Is_usb_endpoint_enabled, Is_usb_in_ready, Max, min, Usb_ack_in_ready_send, Usb_reset_endpoint_fifo_access, usb_write_ep_txpacket(), virtual_check_init(), vmem_data, VMEM_NB_SECTOR, and VMEM_SECTOR_SIZE.
Ctrl_status virtual_usb_write_10 | ( | uint32_t | addr, |
uint16_t | nb_sector | ||
) |
This function transfers the USB data (programmed in sbc_write_10) directly to the memory interface sector = 512 bytes.
addr | Sector address to start write |
nb_sector | Number of sectors to transfer |
References CTRL_FAIL, CTRL_GOOD, data_to_transfer, g_scsi_ep_ms_out, Is_usb_endpoint_enabled, Is_usb_out_received, Usb_ack_out_received_free, usb_read_ep_rxpacket(), Usb_reset_endpoint_fifo_access, virtual_check_init(), vmem_data, VMEM_NB_SECTOR, and VMEM_SECTOR_SIZE.
bool virtual_wr_protect | ( | void | ) |
This function returns the write-protected mode Only used by memory removal with a HARDWARE-SPECIFIC write-protected detection.
Referenced by virtual_check_init().
|
static |
Referenced by virtual_check_init(), virtual_mem_2_ram(), virtual_ram_2_mem(), virtual_usb_read_10(), and virtual_usb_write_10().