Atmel Software Framework

at45dbx_mem.h File Reference

CTRL_ACCESS interface for the AT45DBX data flash driver.

Copyright (c) 2010-2015 Atmel Corporation. All rights reserved.

#include "conf_access.h"
#include "ctrl_access.h"

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.

Parameters
addrAddress of first memory sector to read.
ramPointer to RAM buffer to write.
Returns
Status.

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.

Parameters
addrAddress of first memory sector to write.
ramPointer to RAM buffer to read.
Returns
Status.

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.

Parameters
u32_nb_sectorPointer to the address of the last valid sector.
Returns
Status.

References CTRL_GOOD.

bool at45dbx_removal ( void  )

Tells whether the memory is removable.

Returns
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.

Returns
Status.

References at45dbx_mem_check(), b_at45dbx_unloaded, CTRL_GOOD, and CTRL_NO_PRESENT.

bool at45dbx_unload ( bool  unload)

Unload/load the memory.

Parameters
unloadtrue to unload, false to load.
Returns
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.

Parameters
addrAddress of first memory sector to read.
nb_sectorNumber of sectors to transfer.
Returns
Status.

References at45dbx_read_close(), at45dbx_read_sector_open(), at45dbx_read_sector_to_ram(), AT45DBX_SECTOR_BITS, AT45DBX_SECTOR_SIZE, CTRL_FAIL, CTRL_GOOD, 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.

Parameters
addrAddress of first memory sector to write.
nb_sectorNumber of sectors to transfer.
Returns
Status.

References AT45DBX_SECTOR_BITS, AT45DBX_SECTOR_SIZE, at45dbx_write_close(), at45dbx_write_sector_from_ram(), at45dbx_write_sector_open(), CTRL_FAIL, CTRL_GOOD, sector_buf, and udi_msc_trans_block().

bool at45dbx_wr_protect ( void  )

Returns the write-protection state of the memory.

Returns
true if the memory is write-protected, else false.
Note
Only used by removable memories with hardware-specific write protection.