00001
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048 #ifndef _VIRTUAL_MEM_H_
00049 #define _VIRTUAL_MEM_H_
00050
00051
00052 #include "conf_access.h"
00053
00054 #if VIRTUAL_MEM == DISABLE
00055 #error virtual_mem.h is #included although VIRTUAL_MEM is disabled
00056 #endif
00057
00058
00059 #include "ctrl_access.h"
00060
00061
00062
00063
00065 #define ENTRY_SIZE 32 // Size of entry in bytes
00066
00068 #define VMEM_SECTOR_SIZE 512 // Sector = 512 bytes
00069 #define VMEM_CLUSTER_SIZE 1 // Number of sectors per cluster
00070 #define VMEM_RESERVED_SIZE 1 // Number of reserved sectors in the Reserved region of the volume starting at the first sector (FAT sector) of the volume
00071
00072 #define VMEM_NB_FATS 2 // Number of FATs, it must be 2 to support all systems
00073 #define VMEM_NB_ROOT_ENTRY 16 // Count of 32-byte directory entries in the root directory (32 * this value = must be a multiple of sector size)
00074
00075 #define VMEM_MEDIA_TYPE 0xF8 // Media type (not removable=0xF8 or removable=0xF0), the standard value is 0xF8
00076 #define VMEM_SIZE_FAT 1 // Number of sectors per FAT
00077
00078 #define VMEM_SECT_PER_TRACK 1 // Number of sectors per track
00079 #define VMEM_NB_HEAD 1 // Number of heads
00080
00081 #define VMEM_NB_HIDDEN_SECT 0 // This field should always be zero on non-partitioned media
00082 #define VMEN_DRIVE_NUMBER 0x80 // 0x00 for floppy disk; 0x80 for hard disk
00083
00084
00085 #define PBR_SECTOR 0
00086 #define FAT_SECTOR (PBR_SECTOR + VMEM_RESERVED_SIZE)
00087 #define ROOT_SECTOR (FAT_SECTOR + VMEM_NB_FATS * VMEM_SIZE_FAT)
00088 #define FILE_SECTOR (ROOT_SECTOR + VMEM_NB_ROOT_ENTRY * ENTRY_SIZE / VMEM_SECTOR_SIZE) // 1 sector = size root dir
00089
00090 #define FILE_SIZE 16 // Number of available clusters
00091
00092
00093 #define VMEM_NB_SECTOR (FILE_SIZE * VMEM_CLUSTER_SIZE + FILE_SECTOR)
00094
00095
00096 #if VMEM_NB_SECTOR > 0xFF
00097 #error Virtual memory volume size > 512 bytes * 0xFF
00098 #endif
00099
00100
00101
00102
00103 extern Ctrl_status virtual_test_unit_ready(void);
00104 extern Ctrl_status virtual_read_capacity(U32 *u32_nb_sector);
00105 extern Bool virtual_wr_protect(void);
00106 extern Bool virtual_removal(void);
00107
00108
00109
00110
00111
00112 #if ACCESS_USB == ENABLED
00113 extern Ctrl_status virtual_usb_read_10 (U32 addr, U16 nb_sector);
00114 extern Ctrl_status virtual_usb_write_10(U32 addr, U16 nb_sector);
00115 #endif
00116
00117
00118 #if ACCESS_MEM_TO_RAM == ENABLED
00119 extern Ctrl_status virtual_mem_2_ram(U32 addr, void *ram);
00120 extern Ctrl_status virtual_ram_2_mem(U32 addr, const void *ram);
00121 #endif
00122
00123
00124 #endif // _VIRTUAL_MEM_H_