Definition in file at45dbx_mem.h.
#include "conf_access.h"
#include "ctrl_access.h"
Go to the source code of this file.
Functions | |
MEM <-> RAM Interface | |
Ctrl_status | at45dbx_df_2_ram (U32 addr, void *ram) |
Copies 1 data sector from the memory to RAM. | |
Ctrl_status | at45dbx_ram_2_df (U32 addr, const void *ram) |
Copies 1 data sector from RAM to the memory. | |
Control Interface | |
Ctrl_status | at45dbx_read_capacity (U32 *u32_nb_sector) |
Returns the address of the last valid sector in the memory. | |
Bool | at45dbx_removal (void) |
Tells whether the memory is removable. | |
Ctrl_status | at45dbx_test_unit_ready (void) |
Tests the memory state and initializes the memory if required. | |
Bool | at45dbx_wr_protect (void) |
Returns the write-protection state of the memory. | |
MEM <-> USB Interface | |
Ctrl_status | at45dbx_usb_read_10 (U32 addr, U16 nb_sector) |
Tranfers data from the memory to USB. | |
Ctrl_status | at45dbx_usb_write_10 (U32 addr, U16 nb_sector) |
Tranfers data from USB to the memory. |
Ctrl_status at45dbx_df_2_ram | ( | U32 | addr, | |
void * | ram | |||
) |
Copies 1 data sector from the memory to RAM.
addr | Address of first memory sector to read. | |
ram | Pointer to RAM buffer to write. |
Definition at line 199 of file at45dbx_mem.c.
References AT45DBX_MEM_CNT, AT45DBX_MEM_SIZE, at45dbx_read_close(), at45dbx_read_open(), at45dbx_read_sector_2_ram(), AT45DBX_SECTOR_BITS, CTRL_FAIL, and CTRL_GOOD.
00200 { 00201 if (addr + 1 > AT45DBX_MEM_CNT << (AT45DBX_MEM_SIZE - AT45DBX_SECTOR_BITS)) return CTRL_FAIL; 00202 00203 at45dbx_read_open(addr); 00204 at45dbx_read_sector_2_ram(ram); 00205 at45dbx_read_close(); 00206 00207 return CTRL_GOOD; 00208 }
Ctrl_status at45dbx_ram_2_df | ( | U32 | addr, | |
const void * | ram | |||
) |
Copies 1 data sector from RAM to the memory.
addr | Address of first memory sector to write. | |
ram | Pointer to RAM buffer to read. |
Definition at line 211 of file at45dbx_mem.c.
References AT45DBX_MEM_CNT, AT45DBX_MEM_SIZE, AT45DBX_SECTOR_BITS, at45dbx_write_close(), at45dbx_write_open(), at45dbx_write_sector_from_ram(), CTRL_FAIL, CTRL_GOOD, and s_b_data_modify.
00212 { 00213 if (addr + 1 > AT45DBX_MEM_CNT << (AT45DBX_MEM_SIZE - AT45DBX_SECTOR_BITS)) return CTRL_FAIL; 00214 00215 #if AT45DBX_MEM_TEST_CHANGE_STATE == ENABLED 00216 s_b_data_modify = TRUE; 00217 #endif 00218 00219 at45dbx_write_open(addr); 00220 at45dbx_write_sector_from_ram(ram); 00221 at45dbx_write_close(); 00222 00223 return CTRL_GOOD; 00224 }
Ctrl_status at45dbx_read_capacity | ( | U32 * | u32_nb_sector | ) |
Returns the address of the last valid sector in the memory.
u32_nb_sector | Pointer to the address of the last valid sector. |
Definition at line 83 of file at45dbx_mem.c.
References AT45DBX_MEM_CNT, AT45DBX_MEM_SIZE, AT45DBX_SECTOR_BITS, and CTRL_GOOD.
00084 { 00085 *u32_nb_sector = (AT45DBX_MEM_CNT << (AT45DBX_MEM_SIZE - AT45DBX_SECTOR_BITS)) - 1; 00086 00087 return CTRL_GOOD; 00088 }
Bool at45dbx_removal | ( | void | ) |
Tells whether the memory is removable.
TRUE
if the memory is removable, else FALSE
. Definition at line 97 of file at45dbx_mem.c.
Ctrl_status at45dbx_test_unit_ready | ( | void | ) |
Tests the memory state and initializes the memory if required.
The TEST UNIT READY SCSI primary command allows an application client to poll a LUN until it is ready without having to allocate memory for returned data.
This command may be used to check the media status of LUNs with removable media.
Definition at line 77 of file at45dbx_mem.c.
References at45dbx_mem_check(), CTRL_GOOD, and CTRL_NO_PRESENT.
00078 { 00079 return (at45dbx_mem_check() == OK) ? CTRL_GOOD : CTRL_NO_PRESENT; 00080 }
Ctrl_status at45dbx_usb_read_10 | ( | U32 | addr, | |
U16 | nb_sector | |||
) |
Tranfers data from the memory to USB.
addr | Address of first memory sector to read. | |
nb_sector | Number of sectors to transfer. |
Definition at line 117 of file at45dbx_mem.c.
References AT45DBX_MEM_CNT, AT45DBX_MEM_SIZE, at45dbx_read_close(), at45dbx_read_multiple_sector(), at45dbx_read_open(), AT45DBX_SECTOR_BITS, CTRL_FAIL, and CTRL_GOOD.
00118 { 00119 if (addr + nb_sector > AT45DBX_MEM_CNT << (AT45DBX_MEM_SIZE - AT45DBX_SECTOR_BITS)) return CTRL_FAIL; 00120 00121 at45dbx_read_open(addr); 00122 at45dbx_read_multiple_sector(nb_sector); 00123 at45dbx_read_close(); 00124 00125 return CTRL_GOOD; 00126 }
Ctrl_status at45dbx_usb_write_10 | ( | U32 | addr, | |
U16 | nb_sector | |||
) |
Tranfers data from USB to the memory.
addr | Address of first memory sector to write. | |
nb_sector | Number of sectors to transfer. |
Definition at line 150 of file at45dbx_mem.c.
References AT45DBX_MEM_CNT, AT45DBX_MEM_SIZE, AT45DBX_SECTOR_BITS, at45dbx_write_close(), at45dbx_write_multiple_sector(), at45dbx_write_open(), CTRL_FAIL, CTRL_GOOD, and s_b_data_modify.
00151 { 00152 if (addr + nb_sector > AT45DBX_MEM_CNT << (AT45DBX_MEM_SIZE - AT45DBX_SECTOR_BITS)) return CTRL_FAIL; 00153 00154 #if AT45DBX_MEM_TEST_CHANGE_STATE == ENABLED 00155 if (nb_sector) s_b_data_modify = TRUE; 00156 #endif 00157 00158 at45dbx_write_open(addr); 00159 at45dbx_write_multiple_sector(nb_sector); 00160 at45dbx_write_close(); 00161 00162 return CTRL_GOOD; 00163 }
Bool at45dbx_wr_protect | ( | void | ) |
Returns the write-protection state of the memory.
TRUE
if the memory is write-protected, else FALSE
.Definition at line 91 of file at45dbx_mem.c.