#include "conf/conf_access.h"
#include "ctrl_status.h"
#include "lib_mem\virtual_mem\virtual_mem.h"
#include "lib_mem\nf\nf_mngt.h"
#include "lib_mem\df\df_mem.h"
#include "lib_mem\mmc_sd\mmc_sd_mem.h"
#include <LUN_4_INCLUDE>
#include <LUN_5_INCLUDE>
#include <LUN_6_INCLUDE>
#include <LUN_7_INCLUDE>
#include "lib_mem\host_mem\host_mem.h"
Go to the source code of this file.
Defines | |
#define | ACCESS_MEM_TO_RAM DISABLE |
#define | LUN_0 DISABLE |
#define | LUN_1 DISABLE |
#define | LUN_2 DISABLE |
#define | LUN_3 DISABLE |
#define | LUN_4 DISABLE |
#define | LUN_5 DISABLE |
#define | LUN_6 DISABLE |
#define | LUN_7 DISABLE |
#define | LUN_USB DISABLE |
#define | LUN_ID_VIRTUAL LUN_ID_0 |
#define | LUN_0_INCLUDE "lib_mem\virtual_mem\virtual_mem.h" |
#define | Lun_0_test_unit_ready() virtual_test_unit_ready() |
#define | Lun_0_read_capacity(nb_sect) virtual_read_capacity(nb_sect) |
#define | Lun_0_wr_protect() virtual_wr_protect() |
#define | Lun_0_removal() virtual_removal() |
#define | Lun_0_read_10(ad, sec) virtual_read_10(ad, sec) |
#define | Lun_0_write_10(ad, sec) virtual_write_10(ad, sec) |
#define | Lun_0_ram_2_mem(addr, ram) virtual_ram_2_mem(addr, ram) |
#define | Lun_0_mem_2_ram(addr, ram) virtual_mem_2_ram(addr, ram) |
#define | LUN_0_NAME "VIRTUAL_MEM_ON_CHIP" |
#define | LUN_ID_NF LUN_ID_1 |
#define | LUN_1_INCLUDE "lib_mem\nf\nf_mngt.h" |
#define | Lun_1_test_unit_ready() nf_test_unit_ready() |
#define | Lun_1_read_capacity(nb_sect) nf_read_capacity(nb_sect) |
#define | Lun_1_wr_protect() nf_wr_protect() |
#define | Lun_1_removal() nf_removal() |
#define | Lun_1_read_10(ad, sec) nf_read_10(ad, sec) |
#define | Lun_1_write_10(ad, sec) nf_write_10(ad, sec) |
#define | Lun_1_ram_2_mem(addr, ram) nf_ram_2_nf(addr, ram) |
#define | Lun_1_mem_2_ram(addr, ram) nf_nf_2_ram(addr, ram) |
#define | LUN_1_NAME "\"NAND Flash\"" |
#define | LUN_ID_DF LUN_ID_2 |
#define | LUN_2_INCLUDE "lib_mem\df\df_mem.h" |
#define | Lun_2_test_unit_ready() df_test_unit_ready() |
#define | Lun_2_read_capacity(nb_sect) df_read_capacity(nb_sect) |
#define | Lun_2_wr_protect() df_wr_protect() |
#define | Lun_2_removal() df_removal() |
#define | Lun_2_read_10(ad, sec) df_read_10(ad, sec) |
#define | Lun_2_write_10(ad, sec) df_write_10(ad, sec) |
#define | Lun_2_ram_2_mem(addr, ram) df_ram_2_df(addr, ram) |
#define | Lun_2_mem_2_ram(addr, ram) df_df_2_ram(addr, ram) |
#define | LUN_2_NAME "\"On board data flash\"" |
#define | LUN_ID_MMC_SD LUN_ID_3 |
#define | LUN_3_INCLUDE "lib_mem\mmc_sd\mmc_sd_mem.h" |
#define | Lun_3_test_unit_ready() mmc_sd_test_unit_ready() |
#define | Lun_3_read_capacity(nb_sect) mmc_sd_read_capacity(nb_sect) |
#define | Lun_3_wr_protect() mmc_sd_wr_protect() |
#define | Lun_3_removal() mmc_sd_removal() |
#define | Lun_3_read_10(ad, sec) mmc_sd_read_10(ad, sec) |
#define | Lun_3_write_10(ad, sec) mmc_sd_write_10(ad, sec) |
#define | Lun_3_ram_2_mem(addr, ram) mmc_ram_2_mmc(addr, ram) |
#define | Lun_3_mem_2_ram(addr, ram) mmc_mmc_2_ram(addr, ram) |
#define | LUN_3_NAME "\"MMC\"" |
#define | LUN_USB_INCLUDE "lib_mem\host_mem\host_mem.h" |
#define | Lun_usb_get_lun() host_mem_get_lun() |
#define | Lun_usb_test_unit_ready(lun) host_mem_test_unit_ready(lun) |
#define | Lun_usb_read_capacity(lun, nb_sect) host_mem_read_capacity(lun,nb_sect) |
#define | Lun_usb_read_sector_size(lun) host_mem_read_sector_size(lun) |
#define | Lun_usb_wr_protect(lun) host_mem_wr_protect_cache(lun) |
#define | Lun_usb_removal() host_mem_removal() |
#define | Lun_usb_ram_2_mem(lun, addr, ram) host_mem_ram_2_mem(lun,addr,ram) |
#define | Lun_usb_mem_2_ram(lun, addr, ram) host_mem_mem_2_ram(lun,addr,ram) |
#define | LUN_USB_NAME "\"USB Remote memory\"" |
#define | LUN_0_EN 1 |
Computed the maximum of static lun (don't add the lun of Mass Storage in mode USB Host). | |
#define | LUN_1_EN 1 |
#define | LUN_2_EN 1 |
#define | LUN_3_EN 1 |
#define | LUN_4_EN 1 |
#define | LUN_5_EN 1 |
#define | LUN_6_EN 1 |
#define | LUN_7_EN 1 |
#define | LUN_USB_EN 1 |
#define | LUN_ID_0 (0) |
#define | LUN_ID_1 (LUN_0_EN) |
#define | LUN_ID_2 (LUN_0_EN+LUN_1_EN) |
#define | LUN_ID_3 (LUN_0_EN+LUN_1_EN+LUN_2_EN) |
#define | LUN_ID_4 (LUN_0_EN+LUN_1_EN+LUN_2_EN+LUN_3_EN) |
#define | LUN_ID_5 (LUN_0_EN+LUN_1_EN+LUN_2_EN+LUN_3_EN+LUN_4_EN) |
#define | LUN_ID_6 (LUN_0_EN+LUN_1_EN+LUN_2_EN+LUN_3_EN+LUN_4_EN+LUN_5_EN) |
#define | LUN_ID_7 (LUN_0_EN+LUN_1_EN+LUN_2_EN+LUN_3_EN+LUN_4_EN+LUN_5_EN+LUN_6_EN) |
#define | MAX_LUN (LUN_0_EN+LUN_1_EN+LUN_2_EN+LUN_3_EN+LUN_4_EN+LUN_5_EN+LUN_6_EN+LUN_7_EN) |
#define | LUN_ID_USB (MAX_LUN) |
#define | ID_STREAM_ERR 0xFF |
Functions | |
U8 | get_nb_lun () |
This function return the number of logical unit. | |
U8 | get_cur_lun () |
This function return the current logical unit. | |
Ctrl_status | mem_test_unit_ready (U8 lun) |
This function test the state of memory, and start the initialisation of the memory. | |
Ctrl_status | mem_read_capacity (U8 lun, U32 _MEM_TYPE_SLOW_ *u32_nb_sector) |
This function return the capacity of the memory. | |
U8 | mem_sector_size (U8 lun) |
This function return the sector size of the memory. | |
Bool | mem_wr_protect (U8 lun) |
This function return is the write protected mode. | |
Bool | mem_removal (U8 lun) |
This function inform about the memory type. | |
U8 code * | mem_name (U8 lun) |
This function returns a pointer to the LUN name. | |
Ctrl_status | memory_2_usb (U8 lun, U32 addr, U16 nb_sector) |
This function tranfer a data from memory to usb. | |
Ctrl_status | usb_2_memory (U8 lun, U32 addr, U16 nb_sector) |
This function transfer a data from usb to memory. | |
Ctrl_status | memory_2_ram (U8 lun, const U32 _MEM_TYPE_SLOW_ addr, U8 _MEM_TYPE_SLOW_ *ram) |
Interface for RAM. | |
Ctrl_status | ram_2_memory (U8 lun, const U32 _MEM_TYPE_SLOW_ addr, U8 _MEM_TYPE_SLOW_ *ram) |
This function transfer a data from ram to memory. | |
U8 | stream_mem_to_mem (U8 src_lun, U32 src_addr, U8 dest_lun, U32 dest_addr, U16 nb_sector) |
This function copy a data from memory to other memory. | |
Ctrl_status | stream_state (U8 Id) |
Returns the state on a data transfer. | |
U16 | stream_stop (U8 Id) |
Stop the data transfer. |
Definition in file ctrl_access.h.
#define ACCESS_MEM_TO_RAM DISABLE |
Definition at line 55 of file ctrl_access.h.
#define LUN_0 DISABLE |
Definition at line 60 of file ctrl_access.h.
#define LUN_1 DISABLE |
Definition at line 63 of file ctrl_access.h.
#define LUN_2 DISABLE |
Definition at line 66 of file ctrl_access.h.
#define LUN_3 DISABLE |
Definition at line 69 of file ctrl_access.h.
#define LUN_4 DISABLE |
Definition at line 72 of file ctrl_access.h.
#define LUN_5 DISABLE |
Definition at line 75 of file ctrl_access.h.
#define LUN_6 DISABLE |
Definition at line 78 of file ctrl_access.h.
#define LUN_7 DISABLE |
Definition at line 81 of file ctrl_access.h.
#define LUN_USB DISABLE |
Definition at line 84 of file ctrl_access.h.
#define LUN_ID_VIRTUAL LUN_ID_0 |
Definition at line 88 of file ctrl_access.h.
#define LUN_0_INCLUDE "lib_mem\virtual_mem\virtual_mem.h" |
Definition at line 89 of file ctrl_access.h.
#define Lun_0_test_unit_ready | ( | ) | virtual_test_unit_ready() |
#define Lun_0_read_capacity | ( | nb_sect | ) | virtual_read_capacity(nb_sect) |
#define Lun_0_wr_protect | ( | ) | virtual_wr_protect() |
#define Lun_0_removal | ( | ) | virtual_removal() |
#define Lun_0_read_10 | ( | ad, | |||
sec | ) | virtual_read_10(ad, sec) |
#define Lun_0_write_10 | ( | ad, | |||
sec | ) | virtual_write_10(ad, sec) |
#define Lun_0_ram_2_mem | ( | addr, | |||
ram | ) | virtual_ram_2_mem(addr, ram) |
#define Lun_0_mem_2_ram | ( | addr, | |||
ram | ) | virtual_mem_2_ram(addr, ram) |
#define LUN_0_NAME "VIRTUAL_MEM_ON_CHIP" |
Definition at line 98 of file ctrl_access.h.
#define LUN_ID_NF LUN_ID_1 |
Definition at line 101 of file ctrl_access.h.
#define LUN_1_INCLUDE "lib_mem\nf\nf_mngt.h" |
Definition at line 102 of file ctrl_access.h.
#define Lun_1_test_unit_ready | ( | ) | nf_test_unit_ready() |
#define Lun_1_read_capacity | ( | nb_sect | ) | nf_read_capacity(nb_sect) |
#define Lun_1_wr_protect | ( | ) | nf_wr_protect() |
#define Lun_1_removal | ( | ) | nf_removal() |
#define Lun_1_read_10 | ( | ad, | |||
sec | ) | nf_read_10(ad, sec) |
#define Lun_1_write_10 | ( | ad, | |||
sec | ) | nf_write_10(ad, sec) |
#define Lun_1_ram_2_mem | ( | addr, | |||
ram | ) | nf_ram_2_nf(addr, ram) |
#define Lun_1_mem_2_ram | ( | addr, | |||
ram | ) | nf_nf_2_ram(addr, ram) |
#define LUN_1_NAME "\"NAND Flash\"" |
Definition at line 111 of file ctrl_access.h.
#define LUN_ID_DF LUN_ID_2 |
Definition at line 114 of file ctrl_access.h.
#define LUN_2_INCLUDE "lib_mem\df\df_mem.h" |
Definition at line 115 of file ctrl_access.h.
#define Lun_2_test_unit_ready | ( | ) | df_test_unit_ready() |
#define Lun_2_read_capacity | ( | nb_sect | ) | df_read_capacity(nb_sect) |
#define Lun_2_wr_protect | ( | ) | df_wr_protect() |
#define Lun_2_removal | ( | ) | df_removal() |
#define Lun_2_read_10 | ( | ad, | |||
sec | ) | df_read_10(ad, sec) |
#define Lun_2_write_10 | ( | ad, | |||
sec | ) | df_write_10(ad, sec) |
#define Lun_2_ram_2_mem | ( | addr, | |||
ram | ) | df_ram_2_df(addr, ram) |
#define Lun_2_mem_2_ram | ( | addr, | |||
ram | ) | df_df_2_ram(addr, ram) |
#define LUN_2_NAME "\"On board data flash\"" |
Definition at line 124 of file ctrl_access.h.
#define LUN_ID_MMC_SD LUN_ID_3 |
Definition at line 127 of file ctrl_access.h.
#define LUN_3_INCLUDE "lib_mem\mmc_sd\mmc_sd_mem.h" |
Definition at line 128 of file ctrl_access.h.
#define Lun_3_test_unit_ready | ( | ) | mmc_sd_test_unit_ready() |
#define Lun_3_read_capacity | ( | nb_sect | ) | mmc_sd_read_capacity(nb_sect) |
#define Lun_3_wr_protect | ( | ) | mmc_sd_wr_protect() |
#define Lun_3_removal | ( | ) | mmc_sd_removal() |
#define Lun_3_read_10 | ( | ad, | |||
sec | ) | mmc_sd_read_10(ad, sec) |
#define Lun_3_write_10 | ( | ad, | |||
sec | ) | mmc_sd_write_10(ad, sec) |
#define Lun_3_ram_2_mem | ( | addr, | |||
ram | ) | mmc_ram_2_mmc(addr, ram) |
#define Lun_3_mem_2_ram | ( | addr, | |||
ram | ) | mmc_mmc_2_ram(addr, ram) |
#define LUN_3_NAME "\"MMC\"" |
Definition at line 137 of file ctrl_access.h.
#define LUN_USB_INCLUDE "lib_mem\host_mem\host_mem.h" |
Definition at line 140 of file ctrl_access.h.
#define Lun_usb_get_lun | ( | ) | host_mem_get_lun() |
#define Lun_usb_test_unit_ready | ( | lun | ) | host_mem_test_unit_ready(lun) |
#define Lun_usb_read_capacity | ( | lun, | |||
nb_sect | ) | host_mem_read_capacity(lun,nb_sect) |
#define Lun_usb_read_sector_size | ( | lun | ) | host_mem_read_sector_size(lun) |
#define Lun_usb_wr_protect | ( | lun | ) | host_mem_wr_protect_cache(lun) |
#define Lun_usb_removal | ( | ) | host_mem_removal() |
#define Lun_usb_ram_2_mem | ( | lun, | |||
addr, | |||||
ram | ) | host_mem_ram_2_mem(lun,addr,ram) |
#define Lun_usb_mem_2_ram | ( | lun, | |||
addr, | |||||
ram | ) | host_mem_mem_2_ram(lun,addr,ram) |
#define LUN_USB_NAME "\"USB Remote memory\"" |
Definition at line 149 of file ctrl_access.h.
#define LUN_0_EN 1 |
Computed the maximum of static lun (don't add the lun of Mass Storage in mode USB Host).
Definition at line 219 of file ctrl_access.h.
#define LUN_1_EN 1 |
Definition at line 224 of file ctrl_access.h.
#define LUN_2_EN 1 |
Definition at line 229 of file ctrl_access.h.
#define LUN_3_EN 1 |
Definition at line 234 of file ctrl_access.h.
#define LUN_4_EN 1 |
Definition at line 239 of file ctrl_access.h.
#define LUN_5_EN 1 |
Definition at line 244 of file ctrl_access.h.
#define LUN_6_EN 1 |
Definition at line 249 of file ctrl_access.h.
#define LUN_7_EN 1 |
Definition at line 254 of file ctrl_access.h.
#define LUN_USB_EN 1 |
Definition at line 259 of file ctrl_access.h.
#define LUN_ID_0 (0) |
Definition at line 265 of file ctrl_access.h.
Referenced by mem_name(), mem_read_capacity(), mem_removal(), mem_test_unit_ready(), mem_wr_protect(), memory_2_ram(), memory_2_usb(), ram_2_memory(), and usb_2_memory().
#define LUN_ID_1 (LUN_0_EN) |
Definition at line 266 of file ctrl_access.h.
Referenced by mem_name(), mem_read_capacity(), mem_removal(), mem_test_unit_ready(), mem_wr_protect(), memory_2_ram(), memory_2_usb(), ram_2_memory(), and usb_2_memory().
#define LUN_ID_2 (LUN_0_EN+LUN_1_EN) |
Definition at line 267 of file ctrl_access.h.
Referenced by mem_name(), mem_read_capacity(), mem_removal(), mem_test_unit_ready(), mem_wr_protect(), memory_2_ram(), memory_2_usb(), ram_2_memory(), and usb_2_memory().
#define LUN_ID_3 (LUN_0_EN+LUN_1_EN+LUN_2_EN) |
Definition at line 268 of file ctrl_access.h.
Referenced by mem_name(), mem_read_capacity(), mem_removal(), mem_test_unit_ready(), mem_wr_protect(), memory_2_ram(), memory_2_usb(), ram_2_memory(), and usb_2_memory().
#define LUN_ID_4 (LUN_0_EN+LUN_1_EN+LUN_2_EN+LUN_3_EN) |
Definition at line 269 of file ctrl_access.h.
Referenced by mem_name(), mem_read_capacity(), mem_removal(), mem_test_unit_ready(), mem_wr_protect(), memory_2_ram(), memory_2_usb(), ram_2_memory(), and usb_2_memory().
#define LUN_ID_5 (LUN_0_EN+LUN_1_EN+LUN_2_EN+LUN_3_EN+LUN_4_EN) |
Definition at line 270 of file ctrl_access.h.
Referenced by mem_name(), mem_read_capacity(), mem_removal(), mem_test_unit_ready(), mem_wr_protect(), memory_2_ram(), memory_2_usb(), ram_2_memory(), and usb_2_memory().
#define LUN_ID_6 (LUN_0_EN+LUN_1_EN+LUN_2_EN+LUN_3_EN+LUN_4_EN+LUN_5_EN) |
Definition at line 271 of file ctrl_access.h.
Referenced by mem_name(), mem_read_capacity(), mem_removal(), mem_test_unit_ready(), mem_wr_protect(), memory_2_ram(), memory_2_usb(), ram_2_memory(), and usb_2_memory().
#define LUN_ID_7 (LUN_0_EN+LUN_1_EN+LUN_2_EN+LUN_3_EN+LUN_4_EN+LUN_5_EN+LUN_6_EN) |
Definition at line 272 of file ctrl_access.h.
Referenced by mem_name(), mem_read_capacity(), mem_removal(), mem_test_unit_ready(), mem_wr_protect(), memory_2_ram(), memory_2_usb(), ram_2_memory(), and usb_2_memory().
#define MAX_LUN (LUN_0_EN+LUN_1_EN+LUN_2_EN+LUN_3_EN+LUN_4_EN+LUN_5_EN+LUN_6_EN+LUN_7_EN) |
#define LUN_ID_USB (MAX_LUN) |
Definition at line 274 of file ctrl_access.h.
Referenced by mem_read_capacity(), mem_sector_size(), mem_test_unit_ready(), mem_wr_protect(), memory_2_ram(), ram_2_memory(), ushell_cmd_perform(), and ushell_cmd_perform_extaccess().
#define ID_STREAM_ERR 0xFF |
Definition at line 306 of file ctrl_access.h.
Referenced by stream_mem_to_mem(), and ushell_cmd_perform_transfer().
U8 get_nb_lun | ( | ) |
This function return the number of logical unit.
Definition at line 95 of file ctrl_access.c.
References Lun_usb_get_lun, and MAX_LUN.
00096 { 00097 #if (LUN_USB == ENABLED) 00098 return (MAX_LUN + Lun_usb_get_lun()); 00099 #else 00100 return MAX_LUN; 00101 #endif 00102 }
U8 get_cur_lun | ( | ) |
This function return the current logical unit.
Definition at line 109 of file ctrl_access.c.
Ctrl_status mem_test_unit_ready | ( | U8 | lun | ) |
This function test the state of memory, and start the initialisation of the memory.
MORE (see SPC-3 §5.2.4) : The TEST UNIT READY command allows an application client to poll a logical unit until it is ready without the need to allocate space for returned data. The TEST UNIT READY command may be used to check the media status of logical units with removable media.
lun | Logical unit number |
Definition at line 128 of file ctrl_access.c.
References CTRL_FAIL, Lun_0_test_unit_ready, Lun_1_test_unit_ready, Lun_2_test_unit_ready, Lun_3_test_unit_ready, LUN_ID_0, LUN_ID_1, LUN_ID_2, LUN_ID_3, LUN_ID_4, LUN_ID_5, LUN_ID_6, LUN_ID_7, LUN_ID_USB, and Lun_usb_test_unit_ready.
00129 { 00130 switch( lun ) 00131 { 00132 # if (LUN_0 == ENABLE) 00133 case LUN_ID_0: 00134 return Lun_0_test_unit_ready(); 00135 break; 00136 # endif 00137 # if (LUN_1 == ENABLE) 00138 case LUN_ID_1: 00139 return Lun_1_test_unit_ready(); 00140 break; 00141 # endif 00142 # if (LUN_2 == ENABLE) 00143 case LUN_ID_2: 00144 return Lun_2_test_unit_ready(); 00145 break; 00146 # endif 00147 # if (LUN_3 == ENABLE) 00148 case LUN_ID_3: 00149 return Lun_3_test_unit_ready(); 00150 break; 00151 # endif 00152 # if (LUN_4 == ENABLE) 00153 case LUN_ID_4: 00154 return Lun_4_test_unit_ready(); 00155 break; 00156 # endif 00157 # if (LUN_5 == ENABLE) 00158 case LUN_ID_5: 00159 return Lun_5_test_unit_ready(); 00160 break; 00161 # endif 00162 # if (LUN_6 == ENABLE) 00163 case LUN_ID_6: 00164 return Lun_6_test_unit_ready(); 00165 break; 00166 # endif 00167 # if (LUN_7 == ENABLE) 00168 case LUN_ID_7: 00169 return Lun_7_test_unit_ready(); 00170 break; 00171 # endif 00172 # if (LUN_USB == ENABLE) 00173 default: 00174 return Lun_usb_test_unit_ready(lun - LUN_ID_USB); 00175 break; 00176 # endif 00177 } 00178 return CTRL_FAIL; 00179 }
Ctrl_status mem_read_capacity | ( | U8 | lun, | |
U32 _MEM_TYPE_SLOW_ * | u32_last_sector | |||
) |
This function return the capacity of the memory.
lun | Logical unit number |
Ctrl_status It is ready -> CTRL_GOOD Memory unplug -> CTRL_NO_PRESENT
Definition at line 191 of file ctrl_access.c.
References CTRL_FAIL, Lun_0_read_capacity, Lun_1_read_capacity, Lun_2_read_capacity, Lun_3_read_capacity, LUN_ID_0, LUN_ID_1, LUN_ID_2, LUN_ID_3, LUN_ID_4, LUN_ID_5, LUN_ID_6, LUN_ID_7, LUN_ID_USB, and Lun_usb_read_capacity.
00192 { 00193 switch( lun ) 00194 { 00195 # if (LUN_0 == ENABLE) 00196 case LUN_ID_0: 00197 return Lun_0_read_capacity( u32_last_sector ); 00198 break; 00199 # endif 00200 # if (LUN_1 == ENABLE) 00201 case LUN_ID_1: 00202 return Lun_1_read_capacity( u32_last_sector ); 00203 break; 00204 # endif 00205 # if (LUN_2 == ENABLE) 00206 case LUN_ID_2: 00207 return Lun_2_read_capacity( u32_last_sector ); 00208 break; 00209 # endif 00210 # if (LUN_3 == ENABLE) 00211 case LUN_ID_3: 00212 return Lun_3_read_capacity( u32_last_sector ); 00213 break; 00214 # endif 00215 # if (LUN_4 == ENABLE) 00216 case LUN_ID_4: 00217 return Lun_4_read_capacity( u32_last_sector ); 00218 break; 00219 # endif 00220 # if (LUN_5 == ENABLE) 00221 case LUN_ID_5: 00222 return Lun_5_read_capacity( u32_last_sector ); 00223 break; 00224 # endif 00225 # if (LUN_6 == ENABLE) 00226 case LUN_ID_6: 00227 return Lun_6_read_capacity( u32_last_sector ); 00228 break; 00229 # endif 00230 # if (LUN_7 == ENABLE) 00231 case LUN_ID_7: 00232 return Lun_7_read_capacity( u32_last_sector ); 00233 break; 00234 # endif 00235 # if (LUN_USB == ENABLE) 00236 default: 00237 return Lun_usb_read_capacity( lun - LUN_ID_USB, u32_last_sector ); 00238 break; 00239 # endif 00240 } 00241 return CTRL_FAIL; 00242 }
This function return the sector size of the memory.
lun | Logical unit number |
Definition at line 251 of file ctrl_access.c.
References LUN_ID_USB, and Lun_usb_read_sector_size.
00252 { 00253 # if (LUN_USB == ENABLE) 00254 return (lun < LUN_ID_USB) ? 1 : Lun_usb_read_sector_size(lun- LUN_ID_USB); 00255 #else 00256 return 1; 00257 #endif 00258 }
This function return is the write protected mode.
lun | Logical unit number |
Definition at line 270 of file ctrl_access.c.
References CTRL_FAIL, Lun_0_wr_protect, Lun_1_wr_protect, Lun_2_wr_protect, Lun_3_wr_protect, LUN_ID_0, LUN_ID_1, LUN_ID_2, LUN_ID_3, LUN_ID_4, LUN_ID_5, LUN_ID_6, LUN_ID_7, LUN_ID_USB, and Lun_usb_wr_protect.
00271 { 00272 switch( lun ) 00273 { 00274 # if (LUN_0 == ENABLE) 00275 case LUN_ID_0: 00276 return Lun_0_wr_protect(); 00277 break; 00278 # endif 00279 # if (LUN_1 == ENABLE) 00280 case LUN_ID_1: 00281 return Lun_1_wr_protect(); 00282 break; 00283 # endif 00284 # if (LUN_2 == ENABLE) 00285 case LUN_ID_2: 00286 return Lun_2_wr_protect(); 00287 break; 00288 # endif 00289 # if (LUN_3 == ENABLE) 00290 case LUN_ID_3: 00291 return Lun_3_wr_protect(); 00292 break; 00293 # endif 00294 # if (LUN_4 == ENABLE) 00295 case LUN_ID_4: 00296 return Lun_4_wr_protect(); 00297 break; 00298 # endif 00299 # if (LUN_5 == ENABLE) 00300 case LUN_ID_5: 00301 return Lun_5_wr_protect(); 00302 break; 00303 # endif 00304 # if (LUN_6 == ENABLE) 00305 case LUN_ID_6: 00306 return Lun_6_wr_protect(); 00307 break; 00308 # endif 00309 # if (LUN_7 == ENABLE) 00310 case LUN_ID_7: 00311 return Lun_7_wr_protect(); 00312 break; 00313 # endif 00314 # if (LUN_USB == ENABLE) 00315 default: 00316 return Lun_usb_wr_protect(lun - LUN_ID_USB); 00317 break; 00318 # endif 00319 } 00320 return CTRL_FAIL; 00321 }
This function inform about the memory type.
lun | Logical unit number |
Definition at line 330 of file ctrl_access.c.
References CTRL_FAIL, Lun_0_removal, Lun_1_removal, Lun_2_removal, Lun_3_removal, LUN_ID_0, LUN_ID_1, LUN_ID_2, LUN_ID_3, LUN_ID_4, LUN_ID_5, LUN_ID_6, LUN_ID_7, and Lun_usb_removal.
00331 { 00332 switch( lun ) 00333 { 00334 # if (LUN_0 == ENABLE) 00335 case LUN_ID_0: 00336 return Lun_0_removal(); 00337 break; 00338 # endif 00339 # if (LUN_1 == ENABLE) 00340 case LUN_ID_1: 00341 return Lun_1_removal(); 00342 break; 00343 # endif 00344 # if (LUN_2 == ENABLE) 00345 case LUN_ID_2: 00346 return Lun_2_removal(); 00347 break; 00348 # endif 00349 # if (LUN_3 == ENABLE) 00350 case LUN_ID_3: 00351 return Lun_3_removal(); 00352 break; 00353 # endif 00354 # if (LUN_4 == ENABLE) 00355 case LUN_ID_4: 00356 return Lun_4_removal(); 00357 break; 00358 # endif 00359 # if (LUN_5 == ENABLE) 00360 case LUN_ID_5: 00361 return Lun_5_removal(); 00362 break; 00363 # endif 00364 # if (LUN_6 == ENABLE) 00365 case LUN_ID_6: 00366 return Lun_6_removal(); 00367 break; 00368 # endif 00369 # if (LUN_7 == ENABLE) 00370 case LUN_ID_7: 00371 return Lun_7_removal(); 00372 break; 00373 # endif 00374 # if (LUN_USB == ENABLE) 00375 default: 00376 return Lun_usb_removal(); 00377 break; 00378 # endif 00379 } 00380 return CTRL_FAIL; 00381 }
This function returns a pointer to the LUN name.
lun | Logical unit number |
Definition at line 393 of file ctrl_access.c.
References lun0_name, lun1_name, lun2_name, lun3_name, lun4_name, lun5_name, lun6_name, lun7_name, LUN_ID_0, LUN_ID_1, LUN_ID_2, LUN_ID_3, LUN_ID_4, LUN_ID_5, LUN_ID_6, LUN_ID_7, and lunusb_name.
00395 { 00396 switch( lun ) 00397 { 00398 # if (LUN_0 == ENABLE) 00399 case LUN_ID_0: 00400 return (U8 code*)lun0_name; 00401 break; 00402 # endif 00403 # if (LUN_1 == ENABLE) 00404 case LUN_ID_1: 00405 return (U8 code*)lun1_name; 00406 break; 00407 # endif 00408 # if (LUN_2 == ENABLE) 00409 case LUN_ID_2: 00410 return (U8 code*)lun2_name; 00411 break; 00412 # endif 00413 # if (LUN_3 == ENABLE) 00414 case LUN_ID_3: 00415 return (U8 code*)lun3_name; 00416 break; 00417 # endif 00418 # if (LUN_4 == ENABLE) 00419 case LUN_ID_4: 00420 return (U8 code*)lun4_name; 00421 break; 00422 # endif 00423 # if (LUN_5 == ENABLE) 00424 case LUN_ID_5: 00425 return (U8 code*)lun5_name; 00426 break; 00427 # endif 00428 # if (LUN_6 == ENABLE) 00429 case LUN_ID_6: 00430 return (U8 code*)lun6_name; 00431 break; 00432 # endif 00433 # if (LUN_7 == ENABLE) 00434 case LUN_ID_7: 00435 return (U8 code*)lun7_name; 00436 break; 00437 # endif 00438 # if (LUN_USB == ENABLE) 00439 default: 00440 return (U8 code*)lunusb_name; 00441 break; 00442 # endif 00443 } 00444 return 0; // Remove compiler warning 00445 }
Ctrl_status memory_2_usb | ( | U8 | lun, | |
U32 | addr, | |||
U16 | nb_sector | |||
) |
This function tranfer a data from memory to usb.
lun | Logical unit number | |
addr | Sector address to start read (sector = 512B) | |
nb_sector | Number of sectors to transfer |
Definition at line 465 of file ctrl_access.c.
References CTRL_FAIL, Lun_0_read_10, Lun_1_read_10, Lun_2_read_10, Lun_3_read_10, LUN_ID_0, LUN_ID_1, LUN_ID_2, LUN_ID_3, LUN_ID_4, LUN_ID_5, LUN_ID_6, and LUN_ID_7.
00466 { 00467 Ctrl_status status=CTRL_FAIL; 00468 00469 switch( lun ) 00470 { 00471 # if (LUN_0 == ENABLE) 00472 case LUN_ID_0: 00473 status = Lun_0_read_10(addr , nb_sector); 00474 break; 00475 # endif 00476 # if (LUN_1 == ENABLE) 00477 case LUN_ID_1: 00478 status = Lun_1_read_10(addr , nb_sector); 00479 break; 00480 # endif 00481 # if (LUN_2 == ENABLE) 00482 case LUN_ID_2: 00483 status = Lun_2_read_10(addr , nb_sector); 00484 break; 00485 # endif 00486 # if (LUN_3 == ENABLE) 00487 case LUN_ID_3: 00488 status = Lun_3_read_10(addr , nb_sector); 00489 break; 00490 # endif 00491 # if (LUN_4 == ENABLE) 00492 case LUN_ID_4: 00493 status = Lun_4_read_10(addr , nb_sector); 00494 break; 00495 # endif 00496 # if (LUN_5 == ENABLE) 00497 case LUN_ID_5: 00498 status = Lun_5_read_10(addr , nb_sector); 00499 break; 00500 # endif 00501 # if (LUN_6 == ENABLE) 00502 case LUN_ID_6: 00503 status = Lun_6_read_10(addr , nb_sector); 00504 break; 00505 # endif 00506 # if (LUN_7 == ENABLE) 00507 case LUN_ID_7: 00508 status = Lun_7_read_10(addr , nb_sector); 00509 break; 00510 # endif 00511 } 00512 return status; 00513 }
Ctrl_status usb_2_memory | ( | U8 | lun, | |
U32 | addr, | |||
U16 | nb_sector | |||
) |
This function transfer a data from usb to memory.
lun | Logical unit number | |
addr | Sector address to start write (sector = 512B) | |
nb_sector | Number of sectors to transfer |
Definition at line 526 of file ctrl_access.c.
References CTRL_FAIL, Lun_0_write_10, Lun_1_write_10, Lun_2_write_10, Lun_3_write_10, LUN_ID_0, LUN_ID_1, LUN_ID_2, LUN_ID_3, LUN_ID_4, LUN_ID_5, LUN_ID_6, and LUN_ID_7.
00527 { 00528 Ctrl_status status=CTRL_FAIL; 00529 00530 switch( lun ) 00531 { 00532 # if (LUN_0 == ENABLE) 00533 case LUN_ID_0: 00534 status = Lun_0_write_10(addr , nb_sector); 00535 break; 00536 # endif 00537 # if (LUN_1 == ENABLE) 00538 case LUN_ID_1: 00539 status = Lun_1_write_10(addr , nb_sector); 00540 break; 00541 # endif 00542 # if (LUN_2 == ENABLE) 00543 case LUN_ID_2: 00544 status = Lun_2_write_10(addr , nb_sector); 00545 break; 00546 # endif 00547 # if (LUN_3 == ENABLE) 00548 case LUN_ID_3: 00549 status = Lun_3_write_10(addr , nb_sector); 00550 break; 00551 # endif 00552 # if (LUN_4 == ENABLE) 00553 case LUN_ID_4: 00554 status = Lun_4_write_10(addr , nb_sector); 00555 break; 00556 # endif 00557 # if (LUN_5 == ENABLE) 00558 case LUN_ID_5: 00559 status = Lun_5_write_10(addr , nb_sector); 00560 break; 00561 # endif 00562 # if (LUN_6 == ENABLE) 00563 case LUN_ID_6: 00564 status = Lun_6_write_10(addr , nb_sector); 00565 break; 00566 # endif 00567 # if (LUN_7 == ENABLE) 00568 case LUN_ID_7: 00569 status = Lun_7_write_10(addr , nb_sector); 00570 break; 00571 # endif 00572 } 00573 return status; 00574 }
Ctrl_status memory_2_ram | ( | U8 | lun, | |
const U32 _MEM_TYPE_SLOW_ | addr, | |||
U8 _MEM_TYPE_SLOW_ * | ram | |||
) |
Interface for RAM.
This function tranfer one sector data from memory to ram
lun | Logical unit number | |
addr | Sector address to start read (sector = 512B) | |
nb_sector | Number of sectors to transfer | |
ram | Adresse of ram buffer (only xdata) |
Definition at line 591 of file ctrl_access.c.
References CTRL_FAIL, Lun_0_mem_2_ram, Lun_1_mem_2_ram, Lun_2_mem_2_ram, Lun_3_mem_2_ram, LUN_ID_0, LUN_ID_1, LUN_ID_2, LUN_ID_3, LUN_ID_4, LUN_ID_5, LUN_ID_6, LUN_ID_7, LUN_ID_USB, and Lun_usb_mem_2_ram.
00592 { 00593 00594 Ctrl_status status=CTRL_FAIL; 00595 00596 switch( lun ) 00597 { 00598 # if (LUN_0 == ENABLE) 00599 case LUN_ID_0: 00600 status = Lun_0_mem_2_ram(addr , ram); 00601 break; 00602 # endif 00603 # if (LUN_1 == ENABLE) 00604 case LUN_ID_1: 00605 status = Lun_1_mem_2_ram(addr , ram); 00606 break; 00607 # endif 00608 # if (LUN_2 == ENABLE) 00609 case LUN_ID_2: 00610 status = Lun_2_mem_2_ram(addr , ram); 00611 break; 00612 # endif 00613 # if (LUN_3 == ENABLE) 00614 case LUN_ID_3: 00615 status = Lun_3_mem_2_ram(addr , ram); 00616 break; 00617 # endif 00618 # if (LUN_4 == ENABLE) 00619 case LUN_ID_4: 00620 status = Lun_4_mem_2_ram(addr , ram); 00621 break; 00622 # endif 00623 # if (LUN_5 == ENABLE) 00624 case LUN_ID_5: 00625 status = Lun_5_mem_2_ram(addr , ram); 00626 break; 00627 # endif 00628 # if (LUN_6 == ENABLE) 00629 case LUN_ID_6: 00630 status = Lun_6_mem_2_ram(addr , ram); 00631 break; 00632 # endif 00633 # if (LUN_7 == ENABLE) 00634 case LUN_ID_7: 00635 status = Lun_7_mem_2_ram(addr , ram); 00636 break; 00637 # endif 00638 # if (LUN_USB == ENABLE) 00639 default: 00640 return Lun_usb_mem_2_ram(lun - LUN_ID_USB,addr , ram); 00641 # endif 00642 } 00643 return status; 00644 }
Ctrl_status ram_2_memory | ( | U8 | lun, | |
const U32 _MEM_TYPE_SLOW_ | addr, | |||
U8 _MEM_TYPE_SLOW_ * | ram | |||
) |
This function transfer a data from ram to memory.
lun | Logical unit number | |
addr | Sector address to start write (sector = 512B) | |
nb_sector | Number of sectors to transfer | |
ram | Adresse of ram buffer (only xdata) |
Definition at line 663 of file ctrl_access.c.
References CTRL_FAIL, Lun_0_ram_2_mem, Lun_1_ram_2_mem, Lun_2_ram_2_mem, Lun_3_ram_2_mem, LUN_ID_0, LUN_ID_1, LUN_ID_2, LUN_ID_3, LUN_ID_4, LUN_ID_5, LUN_ID_6, LUN_ID_7, LUN_ID_USB, and Lun_usb_ram_2_mem.
00664 { 00665 Ctrl_status status=CTRL_FAIL; 00666 00667 switch( lun ) 00668 { 00669 # if (LUN_0 == ENABLE) 00670 case LUN_ID_0: 00671 status = Lun_0_ram_2_mem(addr , ram); 00672 break; 00673 # endif 00674 # if (LUN_1 == ENABLE) 00675 case LUN_ID_1: 00676 status = Lun_1_ram_2_mem(addr , ram); 00677 break; 00678 # endif 00679 # if (LUN_2 == ENABLE) 00680 case LUN_ID_2: 00681 status = Lun_2_ram_2_mem(addr , ram); 00682 break; 00683 # endif 00684 # if (LUN_3 == ENABLE) 00685 case LUN_ID_3: 00686 status = Lun_3_ram_2_mem(addr , ram); 00687 break; 00688 # endif 00689 # if (LUN_4 == ENABLE) 00690 case LUN_ID_4: 00691 status = Lun_4_ram_2_mem(addr , ram); 00692 break; 00693 # endif 00694 # if (LUN_5 == ENABLE) 00695 case LUN_ID_5: 00696 status = Lun_5_ram_2_mem(addr , ram); 00697 break; 00698 # endif 00699 # if (LUN_6 == ENABLE) 00700 case LUN_ID_6: 00701 status = Lun_6_ram_2_mem(addr , ram); 00702 break; 00703 # endif 00704 # if (LUN_7 == ENABLE) 00705 case LUN_ID_7: 00706 status = Lun_7_ram_2_mem(addr , ram); 00707 break; 00708 # endif 00709 # if (LUN_USB == ENABLE) 00710 default: 00711 return Lun_usb_ram_2_mem(lun - LUN_ID_USB,addr , ram); 00712 break; 00713 # endif 00714 } 00715 return status; 00716 }
This function copy a data from memory to other memory.
addr | Sector address to start write | |
nb_sector | Number of sectors to transfer |
Definition at line 724 of file ctrl_access.c.
References CTRL_FAIL, CTRL_GOOD, fat_cache_flush(), fat_cache_reset(), fs_g_sector, ID_STREAM_ERR, memory_2_ram(), and ram_2_memory().
00725 { 00726 Ctrl_status status=CTRL_FAIL; 00727 fat_cache_flush(); 00728 while(nb_sector) 00729 { 00730 status = memory_2_ram( src_lun , src_addr , fs_g_sector ); 00731 if( status != CTRL_GOOD ) 00732 break; 00733 status = ram_2_memory( dest_lun , dest_addr , fs_g_sector ); 00734 if( status != CTRL_GOOD ) 00735 break; 00736 src_addr++; 00737 dest_addr++; 00738 nb_sector--; 00739 } 00740 fat_cache_reset(); 00741 return (status != CTRL_GOOD)? ID_STREAM_ERR:0; 00742 }
Ctrl_status stream_state | ( | U8 | Id | ) |
Returns the state on a data transfer.
id | transfer id |
Definition at line 754 of file ctrl_access.c.
References CTRL_GOOD.
00755 { 00756 return CTRL_GOOD; 00757 }
Stop the data transfer.
id | Transfer id |
Definition at line 765 of file ctrl_access.c.