Nut/OS  4.10.3
API Reference
nvmem_at45d.c File Reference

Non-volatile memory support using Atmel AT45 serial DataFlash memory chips. More...

#include <cfg/eeprom.h>
#include <cfg/memory.h>
#include <dev/board.h>
#include <dev/spi_at45d.h>
#include <sys/nutdebug.h>
#include <stdlib.h>
#include <string.h>
#include <memdebug.h>
#include <dev/nvmem_at45d.h>
Include dependency graph for nvmem_at45d.c:

Go to the source code of this file.

Functions

size_t SpiAt45dConfigSize (void)
 Get size of configuration area.
int SpiAt45dConfigRead (size_t pos, void *data, size_t len)
 Load configuration parameters from flash memory.
int SpiAt45dConfigWrite (size_t pos, CONST void *data, size_t len)
 Store configuration parameters in flash memory.

Detailed Description

Non-volatile memory support using Atmel AT45 serial DataFlash memory chips.

 * $Id: nvmem_at45d.c 3560 2011-08-16 10:53:31Z haraldkipp $
 * 

Definition in file nvmem_at45d.c.


Function Documentation

size_t SpiAt45dConfigSize ( void  )

Get size of configuration area.

A part of the DataFlash may be used to store configuration parameters, like the network interface MAC address, the local hostname etc. The size of this area may be configured by defining NUT_CONFIG_AT45D_SIZE. Otherwise one full page is used.

Returns:
The number of bytes available for configuration data. In case of an error, 0 is returned.

Definition at line 134 of file nvmem_at45d.c.

References SpiAt45dPageSize().

Referenced by ShowHardwareConfiguration(), SpiAt45dConfigRead(), and SpiAt45dConfigWrite().

Here is the call graph for this function:

int SpiAt45dConfigRead ( size_t  pos,
void *  data,
size_t  len 
)

Load configuration parameters from flash memory.

Parameters:
posStart location within configuration sector.
dataPoints to a buffer that receives the contents.
lenNumber of bytes to read.
Returns:
0 on success or -1 in case of an error.

Definition at line 157 of file nvmem_at45d.c.

References free(), malloc(), memcpy(), SpiAt45dConfigSize(), and SpiAt45dPageRead().

Referenced by NutNvMemLoad().

Here is the call graph for this function:

int SpiAt45dConfigWrite ( size_t  pos,
CONST void *  data,
size_t  len 
)

Store configuration parameters in flash memory.

Parameters:
posStart location within configuration sector.
dataPoints to a buffer that contains the bytes to store.
lenNumber of bytes to store.
Returns:
0 on success or -1 in case of an error.

Definition at line 187 of file nvmem_at45d.c.

References free(), malloc(), memcmp(), memcpy(), SpiAt45dConfigSize(), SpiAt45dPageRead(), SpiAt45dPageSize(), SpiAt45dPageWrite(), and wsize.

Referenced by NutNvMemSave().

Here is the call graph for this function: