00001
00016
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 #ifndef _MEM_CTRL_H_
00048 #define _MEM_CTRL_H_
00049
00050 #include "conf/conf_access.h"
00051 #include "ctrl_status.h"
00052
00053
00054 #ifndef ACCESS_MEM_TO_RAM
00055 # define ACCESS_MEM_TO_RAM DISABLE
00056 #endif
00057
00058
00059 #ifndef LUN_0
00060 # define LUN_0 DISABLE
00061 #endif
00062 #ifndef LUN_1
00063 # define LUN_1 DISABLE
00064 #endif
00065 #ifndef LUN_2
00066 # define LUN_2 DISABLE
00067 #endif
00068 #ifndef LUN_3
00069 # define LUN_3 DISABLE
00070 #endif
00071 #ifndef LUN_4
00072 # define LUN_4 DISABLE
00073 #endif
00074 #ifndef LUN_5
00075 # define LUN_5 DISABLE
00076 #endif
00077 #ifndef LUN_6
00078 # define LUN_6 DISABLE
00079 #endif
00080 #ifndef LUN_7
00081 # define LUN_7 DISABLE
00082 #endif
00083 #ifndef LUN_USB
00084 # define LUN_USB DISABLE
00085 #endif
00086
00087
00088 #define LUN_ID_VIRTUAL LUN_ID_0
00089 #define LUN_0_INCLUDE "lib_mem\virtual_mem\virtual_mem.h"
00090 #define Lun_0_test_unit_ready() virtual_test_unit_ready()
00091 #define Lun_0_read_capacity(nb_sect) virtual_read_capacity(nb_sect)
00092 #define Lun_0_wr_protect() virtual_wr_protect()
00093 #define Lun_0_removal() virtual_removal()
00094 #define Lun_0_read_10(ad, sec) virtual_read_10(ad, sec)
00095 #define Lun_0_write_10(ad, sec) virtual_write_10(ad, sec)
00096 #define Lun_0_ram_2_mem(addr , ram) virtual_ram_2_mem(addr, ram)
00097 #define Lun_0_mem_2_ram(addr , ram) virtual_mem_2_ram(addr, ram)
00098 #define LUN_0_NAME "VIRTUAL_MEM_ON_CHIP"
00099
00100
00101 #define LUN_ID_NF LUN_ID_1
00102 #define LUN_1_INCLUDE "lib_mem\nf\nf_mngt.h"
00103 #define Lun_1_test_unit_ready() nf_test_unit_ready()
00104 #define Lun_1_read_capacity(nb_sect) nf_read_capacity(nb_sect)
00105 #define Lun_1_wr_protect() nf_wr_protect()
00106 #define Lun_1_removal() nf_removal()
00107 #define Lun_1_read_10(ad, sec) nf_read_10(ad, sec)
00108 #define Lun_1_write_10(ad, sec) nf_write_10(ad, sec)
00109 #define Lun_1_ram_2_mem(addr , ram) nf_ram_2_nf(addr, ram)
00110 #define Lun_1_mem_2_ram(addr , ram) nf_nf_2_ram(addr, ram)
00111 #define LUN_1_NAME "\"NAND Flash\""
00112
00113
00114 #define LUN_ID_DF LUN_ID_2
00115 #define LUN_2_INCLUDE "lib_mem\df\df_mem.h"
00116 #define Lun_2_test_unit_ready() df_test_unit_ready()
00117 #define Lun_2_read_capacity(nb_sect) df_read_capacity(nb_sect)
00118 #define Lun_2_wr_protect() df_wr_protect()
00119 #define Lun_2_removal() df_removal()
00120 #define Lun_2_read_10(ad, sec) df_read_10(ad, sec)
00121 #define Lun_2_write_10(ad, sec) df_write_10(ad, sec)
00122 #define Lun_2_ram_2_mem(addr , ram) df_ram_2_df(addr, ram)
00123 #define Lun_2_mem_2_ram(addr , ram) df_df_2_ram(addr, ram)
00124 #define LUN_2_NAME "\"On board data flash\""
00125
00126
00127 #define LUN_ID_MMC_SD LUN_ID_3
00128 #define LUN_3_INCLUDE "lib_mem\mmc_sd\mmc_sd_mem.h"
00129 #define Lun_3_test_unit_ready() mmc_sd_test_unit_ready()
00130 #define Lun_3_read_capacity(nb_sect) mmc_sd_read_capacity(nb_sect)
00131 #define Lun_3_wr_protect() mmc_sd_wr_protect()
00132 #define Lun_3_removal() mmc_sd_removal()
00133 #define Lun_3_read_10(ad, sec) mmc_sd_read_10(ad, sec)
00134 #define Lun_3_write_10(ad, sec) mmc_sd_write_10(ad, sec)
00135 #define Lun_3_ram_2_mem(addr , ram) mmc_ram_2_mmc(addr, ram)
00136 #define Lun_3_mem_2_ram(addr , ram) mmc_mmc_2_ram(addr, ram)
00137 #define LUN_3_NAME "\"MMC\""
00138
00139
00140 #define LUN_USB_INCLUDE "lib_mem\host_mem\host_mem.h"
00141 #define Lun_usb_test_unit_ready(lun) host_test_unit_ready(lun)
00142 #define Lun_usb_read_capacity(lun,nb_sect) host_read_capacity(lun,nb_sect)
00143 #define Lun_usb_wr_protect(lun) host_wr_protect(lun)
00144 #define Lun_usb_removal() host_removal()
00145 #define Lun_usb_ram_2_mem(lun, addr , ram) host_write_10_ram(lun,addr, ram)
00146 #define Lun_usb_mem_2_ram(lun, addr , ram) host_read_10_ram(lun,addr, ram)
00147 #define LUN_USB_NAME "\"USB Remote memory\""
00148
00149
00150
00151 #if (LUN_0 == ENABLE)
00152 #include LUN_0_INCLUDE
00153 #endif
00154 #if (LUN_1 == ENABLE)
00155 #include LUN_1_INCLUDE
00156 #endif
00157 #if (LUN_2 == ENABLE)
00158 #include LUN_2_INCLUDE
00159 #endif
00160 #if (LUN_3 == ENABLE)
00161 #include LUN_3_INCLUDE
00162 #endif
00163 #if (LUN_4 == ENABLE)
00164 #include LUN_4_INCLUDE
00165 #endif
00166 #if (LUN_5 == ENABLE)
00167 #include LUN_5_INCLUDE
00168 #endif
00169 #if (LUN_6 == ENABLE)
00170 #include LUN_6_INCLUDE
00171 #endif
00172 #if (LUN_7 == ENABLE)
00173 #include LUN_7_INCLUDE
00174 #endif
00175 #if (LUN_USB == ENABLE)
00176 #include LUN_USB_INCLUDE
00177 #endif
00178
00179
00180
00181
00182
00183
00184
00185 U8 get_nb_lun();
00186 U8 get_cur_lun();
00187 Ctrl_status mem_test_unit_ready( U8 lun );
00188 Ctrl_status mem_read_capacity( U8 lun , U32 _MEM_TYPE_SLOW_ *u32_nb_sector );
00189 U8 mem_sector_size( U8 lun );
00190 Bool mem_wr_protect( U8 lun );
00191 Bool mem_removal( U8 lun );
00192 U8 code* mem_name( U8 lun );
00193
00194
00195
00196
00197
00198 Ctrl_status memory_2_usb( U8 lun , U32 addr , U16 nb_sector );
00199 Ctrl_status usb_2_memory( U8 lun , U32 addr , U16 nb_sector );
00200
00201
00202 Ctrl_status memory_2_ram( U8 lun , const U32 _MEM_TYPE_SLOW_ addr , U8 _MEM_TYPE_SLOW_ *ram );
00203 Ctrl_status ram_2_memory( U8 lun , const U32 _MEM_TYPE_SLOW_ addr , U8 _MEM_TYPE_SLOW_ * ram );
00204
00205 #define ID_STREAM_ERR 0xFF
00206 U8 stream_mem_to_mem( U8 src_lun , U32 src_addr , U8 dest_lun , U32 dest_addr , U16 nb_sector );
00207 Ctrl_status stream_state( U8 Id );
00208 U16 stream_stop( U8 Id );
00209
00210 #endif // _MEM_CTRL_H_
00211