CTRL_ACCESS interface for the AT45DBX data flash driver.
Copyright (c) 2010-2018 Microchip Technology Inc. and its subsidiaries.
Functions | |
Control Interface | |
Ctrl_status | at45dbx_test_unit_ready (void) |
Tests the memory state and initializes the memory if required. More... | |
Ctrl_status | at45dbx_read_capacity (U32 *u32_nb_sector) |
Returns the address of the last valid sector in the memory. More... | |
bool | at45dbx_wr_protect (void) |
Returns the write-protection state of the memory. More... | |
bool | at45dbx_removal (void) |
Tells whether the memory is removable. More... | |
bool | at45dbx_unload (bool unload) |
Unload/load the memory. More... | |
MEM <-> USB Interface | |
Ctrl_status | at45dbx_usb_read_10 (U32 addr, U16 nb_sector) |
Transfers data from the memory to USB. More... | |
Ctrl_status | at45dbx_usb_write_10 (U32 addr, U16 nb_sector) |
Transfers data from USB to the memory. More... | |
MEM <-> RAM Interface | |
Ctrl_status | at45dbx_df_2_ram (U32 addr, void *ram) |
Copies 1 data sector from the memory to RAM. More... | |
Ctrl_status | at45dbx_ram_2_df (U32 addr, const void *ram) |
Copies 1 data sector from RAM to the memory. More... | |
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. |
References AT45DBX_PAGE_SIZE, at45dbx_read_close(), at45dbx_read_sector_open(), at45dbx_read_sector_to_ram(), CTRL_FAIL, and CTRL_GOOD.
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. |
References AT45DBX_PAGE_SIZE, at45dbx_write_close(), at45dbx_write_sector_from_ram(), at45dbx_write_sector_open(), CTRL_FAIL, and CTRL_GOOD.
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. |
References CTRL_GOOD.
bool at45dbx_removal | ( | void | ) |
Tells whether the memory is removable.
true
if the memory is removable, else false
. 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.
References at45dbx_mem_check(), b_at45dbx_unloaded, CTRL_GOOD, and CTRL_NO_PRESENT.
Unload/load the memory.
unload | true to unload, false to load. |
true
if the operation is success, else false
. References b_at45dbx_unloaded.
Ctrl_status at45dbx_usb_read_10 | ( | U32 | addr, |
U16 | nb_sector | ||
) |
Transfers data from the memory to USB.
addr | Address of first memory sector to read. |
nb_sector | Number of sectors to transfer. |
References at45dbx_read_close(), at45dbx_read_sector_open(), at45dbx_read_sector_to_ram(), AT45DBX_SECTOR_BITS, AT45DBX_SECTOR_SIZE, CTRL_FAIL, CTRL_GOOD, NULL, sector_buf, and udi_msc_trans_block().
Ctrl_status at45dbx_usb_write_10 | ( | U32 | addr, |
U16 | nb_sector | ||
) |
Transfers data from USB to the memory.
addr | Address of first memory sector to write. |
nb_sector | Number of sectors to transfer. |
References AT45DBX_SECTOR_BITS, AT45DBX_SECTOR_SIZE, at45dbx_write_close(), at45dbx_write_sector_from_ram(), at45dbx_write_sector_open(), CTRL_FAIL, CTRL_GOOD, NULL, sector_buf, and udi_msc_trans_block().
bool at45dbx_wr_protect | ( | void | ) |
Returns the write-protection state of the memory.
true
if the memory is write-protected, else false
.