Nut/OS  5.0.5
API Reference
lpc177x_8x_eeprom.h File Reference
#include <inttypes.h>
Include dependency graph for lpc177x_8x_eeprom.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define EEPROM_SIZE   (4096 - 64)
#define EEPROM_CMD_8_BIT_READ   0
#define EEPROM_CMD_16_BIT_READ   1
#define EEPROM_CMD_32_BIT_READ   2
#define EEPROM_CMD_8_BIT_WRITE   3
#define EEPROM_CMD_16_BIT_WRITE   4
#define EEPROM_CMD_32_BIT_WRITE   5
#define EEPROM_CMD_ERASE_PRG_PAGE   6
#define EEPROM_CMD_RDPREFETCH   _BV(3)
#define EEPROM_PAGE_SIZE   64
#define EEPROM_PAGE_NUM   64
#define EEPROM_PAGE_OFFSET_MASK   0x3F
#define EEPROM_PAGE_NUM_MASK   (0x3F << 6)
#define EEPROM_PAGE_OFFSET(n)   ((n) & 0x3F)
#define EEPROM_PAGE_ADRESS(n)   (((n) & 0x3F) << 6)
#define EEPROM_WDATA_8_BIT(n)   ((n) & 0x000000FF)
#define EEPROM_WDATA_16_BIT(n)   ((n) & 0x0000FFFF)
#define EEPROM_WDATA_32_BIT(n)   ((n) & 0xFFFFFFFF)
#define EEPROM_RDATA_8_BIT(n)   ((n) & 0x000000FF)
#define EEPROM_RDATA_16_BIT(n)   ((n) & 0x0000FFFF)
#define EEPROM_RDATA_32_BIT(n)   ((n) & 0xFFFFFFFF)
#define EEPROM_PWRDWN   _BV(0)
#define EEPROM_ENDOF_RW   26
#define EEPROM_ENDOF_PROG   28

Functions

void Lpc177x_8x_EepromInit (void)
 Initialize EEPROM.
int Lpc177x_8x_EepromRead (uint16_t addr, void *buff, size_t size)
 Read data from EEPROM at specific address.
int Lpc177x_8x_EepromWrite (uint16_t addr, const void *buff, size_t size)
 Write data to EEPROM at specific address.

Define Documentation

#define EEPROM_SIZE   (4096 - 64)
#define EEPROM_CMD_8_BIT_READ   0

Referenced by Lpc177x_8x_EepromRead().

#define EEPROM_CMD_16_BIT_READ   1
#define EEPROM_CMD_32_BIT_READ   2
#define EEPROM_CMD_8_BIT_WRITE   3

Referenced by Lpc177x_8x_EepromWrite().

#define EEPROM_CMD_16_BIT_WRITE   4
#define EEPROM_CMD_32_BIT_WRITE   5
#define EEPROM_CMD_ERASE_PRG_PAGE   6

Referenced by Lpc177x_8x_EepromWrite().

#define EEPROM_CMD_RDPREFETCH   _BV(3)

Referenced by Lpc177x_8x_EepromRead().

#define EEPROM_PAGE_SIZE   64
#define EEPROM_PAGE_NUM   64
#define EEPROM_PAGE_OFFSET_MASK   0x3F
#define EEPROM_PAGE_NUM_MASK   (0x3F << 6)
#define EEPROM_PAGE_OFFSET (   n)    ((n) & 0x3F)
#define EEPROM_PAGE_ADRESS (   n)    (((n) & 0x3F) << 6)
#define EEPROM_WDATA_8_BIT (   n)    ((n) & 0x000000FF)
#define EEPROM_WDATA_16_BIT (   n)    ((n) & 0x0000FFFF)
#define EEPROM_WDATA_32_BIT (   n)    ((n) & 0xFFFFFFFF)
#define EEPROM_RDATA_8_BIT (   n)    ((n) & 0x000000FF)
#define EEPROM_RDATA_16_BIT (   n)    ((n) & 0x0000FFFF)
#define EEPROM_RDATA_32_BIT (   n)    ((n) & 0xFFFFFFFF)
#define EEPROM_PWRDWN   _BV(0)
#define EEPROM_ENDOF_RW   26
#define EEPROM_ENDOF_PROG   28

Function Documentation

void Lpc177x_8x_EepromInit ( void  )

Initialize EEPROM.

Initialize the eeprom memeory. Therefore enable power and setup clocks

Parameters:
none
Returns:
none

References LPC_EEPROM, NUT_HWCLK_CPU, and NutArchClockGet().

Referenced by Lpc177x_8x_EepromRead(), and Lpc177x_8x_EepromWrite().

Here is the call graph for this function:

int Lpc177x_8x_EepromRead ( uint16_t  addr,
void *  buff,
size_t  size 
)

Read data from EEPROM at specific address.

Parameters:
addressEEPROM address that start to write data, it must be in range 0..0x1000
buffbuffer to place the read data in
sizenumber of bytes to be read
Returns:
none

References _BV, EEPROM_CMD_8_BIT_READ, EEPROM_CMD_RDPREFETCH, EEPROM_ENDOF_PROG, EEPROM_ENDOF_RW, EEPROM_PAGE_ADRESS, EEPROM_PAGE_NUM, EEPROM_PAGE_NUM_MASK, EEPROM_PAGE_OFFSET, EEPROM_PAGE_OFFSET_MASK, EEPROM_PAGE_SIZE, EEPROM_SIZE, Lpc177x_8x_EepromInit(), and LPC_EEPROM.

Referenced by NutNvMemLoad().

Here is the call graph for this function:

int Lpc177x_8x_EepromWrite ( uint16_t  addr,
const void *  buff,
size_t  size 
)

Write data to EEPROM at specific address.

Parameters:
addressEEPROM address that start to write data, it must be in range 0..0x1000
buffbuffer that contain data that will be written to buffer
sizenumber of bytes to be written
Returns:
none

References _BV, EEPROM_CMD_8_BIT_WRITE, EEPROM_CMD_ERASE_PRG_PAGE, EEPROM_ENDOF_PROG, EEPROM_ENDOF_RW, EEPROM_PAGE_ADRESS, EEPROM_PAGE_NUM, EEPROM_PAGE_NUM_MASK, EEPROM_PAGE_OFFSET, EEPROM_PAGE_OFFSET_MASK, EEPROM_PAGE_SIZE, EEPROM_SIZE, Lpc177x_8x_EepromInit(), and LPC_EEPROM.

Referenced by NutNvMemSave().

Here is the call graph for this function: