50 #ifndef _CTRL_ACCESS_H_    51 #define _CTRL_ACCESS_H_    70 #define SECTOR_SIZE  512    87   #error LUN_0 must be defined as ENABLE or DISABLE in conf_access.h    90   #error LUN_1 must be defined as ENABLE or DISABLE in conf_access.h    93   #error LUN_2 must be defined as ENABLE or DISABLE in conf_access.h    96   #error LUN_3 must be defined as ENABLE or DISABLE in conf_access.h    99   #error LUN_4 must be defined as ENABLE or DISABLE in conf_access.h   102   #error LUN_5 must be defined as ENABLE or DISABLE in conf_access.h   105   #error LUN_6 must be defined as ENABLE or DISABLE in conf_access.h   108   #error LUN_7 must be defined as ENABLE or DISABLE in conf_access.h   111   #error LUN_USB must be defined as ENABLE or DISABLE in conf_access.h   118 #define LUN_ID_1        (LUN_ID_0 + LUN_0)   119 #define LUN_ID_2        (LUN_ID_1 + LUN_1)   120 #define LUN_ID_3        (LUN_ID_2 + LUN_2)   121 #define LUN_ID_4        (LUN_ID_3 + LUN_3)   122 #define LUN_ID_5        (LUN_ID_4 + LUN_4)   123 #define LUN_ID_6        (LUN_ID_5 + LUN_5)   124 #define LUN_ID_7        (LUN_ID_6 + LUN_6)   125 #define MAX_LUN         (LUN_ID_7 + LUN_7)     126 #define LUN_ID_USB      (MAX_LUN)              132   #include LUN_0_INCLUDE   135   #include LUN_1_INCLUDE   138   #include LUN_2_INCLUDE   141   #include LUN_3_INCLUDE   144   #include LUN_4_INCLUDE   147   #include LUN_5_INCLUDE   150   #include LUN_6_INCLUDE   153   #include LUN_7_INCLUDE   155 #if LUN_USB == ENABLE   156   #include LUN_USB_INCLUDE   161 #ifndef GLOBAL_WR_PROTECT   162   #error GLOBAL_WR_PROTECT must be defined as true or false in conf_access.h   166 #if GLOBAL_WR_PROTECT == true   184 extern bool ctrl_access_init(
void);
   186 #endif  // FREERTOS_USED   273 #if ACCESS_USB == true   301 #endif  // ACCESS_USB == true   304 #if ACCESS_MEM_TO_RAM == true   332 #endif  // ACCESS_MEM_TO_RAM == true   335 #if ACCESS_STREAM == true   342 #define ID_STREAM_ERR         0xFF   344   #if ACCESS_MEM_TO_MEM == true   358   #endif  // ACCESS_MEM_TO_MEM == true   382 #endif  // ACCESS_STREAM == true   392 #endif  // _CTRL_ACCESS_H_ U8 get_cur_lun(void)
Returns the current LUN. 
 
Memory not initialized or changed. 
 
Ctrl_status ram_2_memory(U8 lun, U32 addr, const void *ram)
Copies 1 data sector from RAM to the memory. 
 
Ctrl_status mem_test_unit_ready(U8 lun)
Tests the memory state and initializes the memory if required. 
 
Ctrl_status usb_2_memory(U8 lun, U32 addr, U16 nb_sector)
Transfers data from USB to the memory. 
 
U8 mem_sector_size(U8 lun)
Returns the size of the physical sector. 
 
U8 get_nb_lun(void)
Returns the number of LUNs. 
 
Commonly used includes, types and macros. 
 
Ctrl_status memory_2_ram(U8 lun, U32 addr, void *ram)
Copies 1 data sector from the memory to RAM. 
 
Ctrl_status memory_2_usb(U8 lun, U32 addr, U16 nb_sector)
Transfers data from the memory to USB. 
 
Ctrl_status
Status returned by CTRL_ACCESS interfaces. 
 
bool mem_wr_protect(U8 lun)
Returns the write-protection state of the memory. 
 
bool mem_unload(U8 lun, bool unload)
Unload/load the medium. 
 
uint8_t U8
8-bit unsigned integer. 
 
bool g_wr_protect
Write protect. 
 
Ctrl_status stream_state(U8 id)
Returns the state of a streaming data transfer. 
 
bool mem_removal(U8 lun)
Tells whether the memory is removable. 
 
Ctrl_status stream_mem_to_mem(U8 src_lun, U32 src_addr, U8 dest_lun, U32 dest_addr, U16 nb_sector)
Copies data from one memory to another. 
 
const char * mem_name(U8 lun)
Returns a pointer to the LUN name. 
 
U16 stream_stop(U8 id)
Stops a streaming data transfer. 
 
Ctrl_status mem_read_capacity(U8 lun, U32 *u32_nb_sector)
Returns the address of the last valid sector (512 bytes) in the memory.