Nut/OS  4.10.3
API Reference
at49bv.h File Reference
#include <sys/types.h>
Include dependency graph for at49bv.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

unsigned long At49bvInit (void)
unsigned long long AT49bvReadProtectionRegister (int factory)
 Read user or factory id from protection register.
int At49bvChipErase (void)
 Erase entire flash memory chip.
int At49bvSectorErase (unsigned int off)
 Erase sector at the specified offset.
int At49bvSectorRead (unsigned int off, void *data, unsigned int len)
 Read data from flash memory.
int At49bvSectorWrite (unsigned int off, CONST void *data, unsigned int len)
 Write data into flash memory.
int At49bvParamRead (unsigned int pos, void *data, unsigned int len)
 Load configuration parameters from flash memory.
int At49bvParamWrite (unsigned int pos, CONST void *data, unsigned int len)
 Store configuration parameters in flash memory.

Function Documentation

unsigned long At49bvInit ( void  )

Definition at line 164 of file at49bv.c.

References FLASH_CMD_ENTER_ID, FLASH_CMD_EXIT_ID, FLASH_COMMAND, and FLASH_UNLOCK.

unsigned long long AT49bvReadProtectionRegister ( int  factory)

Read user or factory id from protection register.

Parameters:
factoryIf true, read factory id, otherwise read user id
Returns:
The ID read, 64 bit long!

Definition at line 185 of file at49bv.c.

References FLASH_CMD_ENTER_ID, FLASH_CMD_EXIT_ID, FLASH_COMMAND, and FLASH_UNLOCK.

int At49bvChipErase ( void  )

Erase entire flash memory chip.

Definition at line 232 of file at49bv.c.

References FLASH_CHIP_ERASE_WAIT, FLASH_CMD_ERASE, FLASH_CMD_ERASE_CHIP, FLASH_COMMAND, and FLASH_UNLOCK.

int At49bvSectorErase ( unsigned int  off)

Erase sector at the specified offset.

Definition at line 217 of file at49bv.c.

References FLASH_CHIP_BASE, FLASH_CMD_ERASE, FLASH_CMD_ERASE_SECTOR, FLASH_COMMAND, FLASH_ERASE_WAIT, and FLASH_UNLOCK.

Referenced by At49bvParamWrite().

int At49bvSectorRead ( unsigned int  off,
void *  data,
unsigned int  len 
)

Read data from flash memory.

Parameters:
offStart location within the chip, starting at 0.
dataPoints to a buffer that receives the data.
lenNumber of bytes to read.
Returns:
0 on success or -1 in case of an error.

Definition at line 251 of file at49bv.c.

References FLASH_CHIP_BASE, and memcpy().

Referenced by At49bvParamRead(), and At49bvParamWrite().

Here is the call graph for this function:

int At49bvSectorWrite ( unsigned int  off,
CONST void *  data,
unsigned int  len 
)

Write data into flash memory.

The related sector must have been erased before calling this function.

Parameters:
offStart location within the chip, starting at 0.
dataPoints to a buffer that contains the bytes to be written.
lenNumber of bytes to write.
Returns:
0 on success or -1 in case of an error.

Definition at line 269 of file at49bv.c.

References FLASH_CHIP_BASE, FLASH_CMD_PROGRAM, FLASH_COMMAND, FLASH_UNLOCK, and FLASH_WRITE_POLLS.

Referenced by At49bvParamWrite().

int At49bvParamRead ( unsigned int  pos,
void *  data,
unsigned int  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:
Always 0.

Definition at line 302 of file at49bv.c.

References At49bvSectorRead(), and FLASH_CONF_SECTOR.

Referenced by NutNvMemLoad().

Here is the call graph for this function:

int At49bvParamWrite ( unsigned int  pos,
CONST void *  data,
unsigned int  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 316 of file at49bv.c.

References At49bvSectorErase(), At49bvSectorRead(), At49bvSectorWrite(), FLASH_CONF_SECTOR, FLASH_CONF_SIZE, free(), malloc(), memcmp(), and memcpy().

Referenced by NutNvMemSave().

Here is the call graph for this function: