#include <string.h>
#include "compiler.h"
#include "preprocessor.h"
#include "board.h"
#include "power_clocks_lib.h"
#include "gpio.h"
#include "spi.h"
#include "conf_at45dbx.h"
#include "at45dbx.h"
#include <ports/avr32/board_init.h>
#include <util/nvram.h>
Data Structures | |
struct | nvram |
Functions | |
void | at45dbx_read_multiple_sector_callback (const void *psector) |
Invoked by at45dbx driver. More... | |
void | at45dbx_write_multiple_sector_callback (void *psector) |
Invoked by at45dbx driver. More... | |
int | nvram_init (void) |
int | nvram_read (uint32_t addr, void *data, uint32_t len) |
Read any number bytes into any offset of nor flash. More... | |
static int | nvram_rw (uint32_t addr, void *data, uint16_t len, int write) |
Write/read any number bytes into any offset of nor flash by taking care of cases where the length is not aligned to the sector size or where the addr is not aligned to the sector offsets. More... | |
int | nvram_write (uint32_t addr, const void *data, uint32_t len) |
Write any number bytes into any offset of nor flash. More... | |
Variables | |
static struct nvram | PRIV |
int nvram_init | ( | void | ) |
References at45dbx_init(), AT45DBX_SPI_BITS, AT45DBX_SPI_FIRST_NPCS, AT45DBX_SPI_MASTER_SPEED, FPBA_HZ, and spi_options_t::reg.
Referenced by main().
int nvram_read | ( | uint32_t | addr, |
void * | data, | ||
uint32_t | len | ||
) |
Read any number bytes into any offset of nor flash.
References nvram_rw().
Referenced by ak8975_calibrate(), ak8975_init(), hmc5883l_calibrate(), hmc5883l_init(), main(), sfh7770_calibrate(), and sfh7770_init().
|
static |
Write/read any number bytes into any offset of nor flash by taking care of cases where the length is not aligned to the sector size or where the addr is not aligned to the sector offsets.
References at45dbx_read_close(), at45dbx_read_multiple_sector(), at45dbx_read_open(), AT45DBX_SECTOR_SIZE, at45dbx_write_close(), at45dbx_write_multiple_sector(), at45dbx_write_open(), nvram::data, data, nvram::len, nvram::off, PRIV, and nvram::read.
Referenced by nvram_read(), and nvram_write().
int nvram_write | ( | uint32_t | addr, |
const void * | data, | ||
uint32_t | len | ||
) |
Write any number bytes into any offset of nor flash.
References nvram_rw().
Referenced by ak8975_calibrate(), hmc5883l_calibrate(), main(), sfh7770_calibrate(), and sfh7770_set_threshold().
|
static |
Referenced by at45dbx_read_multiple_sector_callback(), at45dbx_write_multiple_sector_callback(), and nvram_rw().