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