Atmel Software Framework

at45dbx.h File Reference

Management of the AT45DBX DataFlash component.

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

#include "conf_at45dbx.h"

Macros

#define AT45DBX_SECTOR_BITS   9
 Number of bits for addresses within logical sectors of file system. More...
 
#define AT45DBX_SECTOR_SIZE   (1 << AT45DBX_SECTOR_BITS)
 Logical sector size of file system in bytes. More...
 
Available AT45DBX Sizes

Number of address bits of available AT45DBX data flash memories.

Note
All memories from page sizes of 256 bytes to 1024 bytes are supported.
#define AT45DBX_500KB   19
 
#define AT45DBX_1MB   20
 
#define AT45DBX_2MB   21
 
#define AT45DBX_4MB   22
 
#define AT45DBX_8MB   23
 

Functions

static bool at45dbx_check_address (uint32_t address)
 Check the address passed is valid. More...
 
Control Functions
bool at45dbx_init (void)
 Initializes the data flash controller and the SPI channel by which the DF is controlled. More...
 
bool at45dbx_mem_check (void)
 Performs a memory check on all DataFlash memories. More...
 
bool at45dbx_read_sector_open (uint32_t sector)
 Opens a DataFlash memory in read mode at a given sector. More...
 
bool at45dbx_read_byte_open (uint32_t ad)
 Opens a DataFlash memory in read mode at a given byte address. More...
 
void at45dbx_read_close (void)
 Unselects the current DataFlash memory. More...
 
bool at45dbx_write_sector_open (uint32_t sector)
 This function opens a DataFlash memory in write mode at a given sector. More...
 
bool at45dbx_write_byte_open (uint32_t ad)
 This function opens a DataFlash memory in write mode at a given address. More...
 
void at45dbx_write_close (void)
 Fills the end of the current logical sector and launches page programming. More...
 
Single-Byte Access Functions
uint8_t at45dbx_read_byte (void)
 Performs a single byte read from DataFlash memory. More...
 
bool at45dbx_write_byte (uint8_t b)
 Performs a single byte write to DataFlash memory. More...
 
Single-Sector Access Functions
bool at45dbx_read_sector_to_ram (void *ram)
 Reads one DataFlash sector to a RAM buffer. More...
 
bool at45dbx_write_sector_from_ram (const void *ram)
 Writes one DataFlash sector from a RAM buffer. More...
 
Functions to connect the DataFlash driver with the SPI Multiple-Sector Access Functions
void at45dbx_spi_init (void)
 Initialize SPI external resource for AT45dbx DataFlash driver. More...
 
void at45dbx_spi_select_device (uint8_t mem_id)
 Select one external DataFlash component. More...
 
void at45dbx_spi_deselect_device (uint8_t mem_id)
 Unselect one external DataFlash component. More...
 
void at45dbx_spi_write_byte (uint8_t data)
 Send one byte to the DataFlash. More...
 
void at45dbx_spi_read_byte (uint8_t *data)
 Get one byte (read) from the DataFlash. More...
 
void at45dbx_spi_read_packet (void const *data, size_t len)
 Receive a sequence of bytes from a DataFlash. More...
 
void at45dbx_spi_write_packet (void const *data, size_t len)
 Send a sequence of bytes to a DataFlash from. More...
 

static bool at45dbx_check_address ( uint32_t  address)
inlinestatic

Check the address passed is valid.

Driver-internal function for checking the DataFlash address is in memory range configuration.

Parameters
addressThe address to be checked
Returns
true when the address is valid, false when out of memory range.

Referenced by at45dbx_read_byte_open(), at45dbx_read_sector_open(), at45dbx_write_byte_open(), and at45dbx_write_sector_open().