| LPCOpen Platform v1.03 LPCOpen Platform for NXP LPC Microcontrollers

- Main Page
- Modules
- Data Structures
- Files
- Related Pages

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
IP: EEPROM register block and driver
IP drivers: Common drivers used on multiple NXP devices

## Detailed Description

Supports 4032 byte EEPROM devices.

## Data Structures
struct | IP_EEPROM_001_T
| EEPROM register block structure. More...

## Macros
#define | EEPROM_PAGE_SIZE 64
#define | EEPROM_PAGE_NUM 63
#define | EEPROM_CMD_8BITS_READ (0)
#define | EEPROM_CMD_16BITS_READ (1)
#define | EEPROM_CMD_32BITS_READ (2)
#define | EEPROM_CMD_8BITS_WRITE (3)
#define | EEPROM_CMD_16BITS_WRITE (4)
#define | EEPROM_CMD_32BITS_WRITE (5)
#define | EEPROM_CMD_ERASE_PRG_PAGE (6)
#define | EEPROM_CMD_RDPREFETCH (1 << 3)
#define | EEPROM_PWRDWN (1 << 0)
#define | EEPROM_INT_ENDOFRW (1 << 26)
#define | EEPROM_INT_ENDOFPROG (1 << 28)

## Enumerations
enum | IP_EEPROM_RWSIZE_T { EEPROM_RWSIZE_8BITS = 1, EEPROM_RWSIZE_16BITS = 2, EEPROM_RWSIZE_32BITS = 4 }
| EEPROM Mode type definition. More...

## Functions
STATIC INLINE void | IP_EEPROM_SetCmd (IP_EEPROM_001_T *pEEPROM, uint32_t cmd)
| Select an EEPROM command.
STATIC INLINE void | IP_EEPROM_SetAddr (IP_EEPROM_001_T *pEEPROM, uint32_t pageAddr, uint32_t pageOffset)
| Set EEPROM address.
STATIC INLINE void | IP_EEPROM_WriteData (IP_EEPROM_001_T *pEEPROM, uint32_t data)
| Write EEPROM data.
STATIC INLINE uint32_t | IP_EEPROM_ReadData (IP_EEPROM_001_T *pEEPROM)
| Read EEPROM data.
STATIC INLINE void | IP_EEPROM_SetWaitState (IP_EEPROM_001_T *pEEPROM, uint32_t ws)
| Set EEPROM wait state.
STATIC INLINE void | IP_EEPROM_EnablePowerDown (IP_EEPROM_001_T *pEEPROM)
| Put EEPROM device in power down mode.
STATIC INLINE void | IP_EEPROM_DisablePowerDown (IP_EEPROM_001_T *pEEPROM)
| Bring EEPROM device out of power down mode.
STATIC INLINE void | IP_EEPROM_EnableInt (IP_EEPROM_001_T *pEEPROM, uint32_t mask)
| Enable EEPROM interrupt.
STATIC INLINE void | IP_EEPROM_DisableInt (IP_EEPROM_001_T *pEEPROM, uint32_t mask)
| Disable EEPROM interrupt.
STATIC INLINE uint32_t | IP_EEPROM_GetIntEnable (IP_EEPROM_001_T *pEEPROM)
| Get the value of the EEPROM interrupt enable register.
STATIC INLINE uint32_t | IP_EEPROM_GetIntStatus (IP_EEPROM_001_T *pEEPROM)
| Get EEPROM interrupt status.
STATIC INLINE void | IP_EEPROM_SetIntStatus (IP_EEPROM_001_T *pEEPROM, uint32_t mask)
| Set EEPROM interrupt status.
STATIC INLINE void | IP_EEPROM_ClearIntStatus (IP_EEPROM_001_T *pEEPROM, uint32_t mask)
| Clear EEPROM interrupt status.
void | IP_EEPROM_Init (IP_EEPROM_001_T *pEEPROM, uint32_t div)
| Initializes EEPROM.
STATIC INLINE void | IP_EEPROM_DeInit (IP_EEPROM_001_T *pEEPROM)
| De-initializes EEPROM.
void | IP_EEPROM_ErasePageRegister (IP_EEPROM_001_T *pEEPROM)
| Erase data in page register.
uint32_t | IP_EEPROM_WritePageRegister (IP_EEPROM_001_T *pEEPROM, uint16_t pageOffset, uint8_t *pData, uint8_t wsize, uint32_t byteNum)
| Write data to page register.
uint32_t | IP_EEPROM_ReadPage (IP_EEPROM_001_T *pEEPROM, uint16_t pageOffset, uint16_t pageAddr, uint8_t *pData, uint8_t rsize, uint32_t byteNum)
| Read data from non-volatile memory.
void | IP_EEPROM_EraseProgramPage (IP_EEPROM_001_T *pEEPROM, uint16_t pageAddr)
| Erase/Program an EEPROM page.
void | IP_EEPROM_WaitForIntStatus (IP_EEPROM_001_T *pEEPROM, uint32_t mask)
| Wait for interrupt occurs.
Status | IP_EEPROM_Write (IP_EEPROM_001_T *pEEPROM, uint16_t pageOffset, uint16_t pageAddr, void *pData, IP_EEPROM_RWSIZE_T wsize, uint32_t byteNum)
| Write data to EEPROM at specific address.
Status | IP_EEPROM_Read (IP_EEPROM_001_T *pEEPROM, uint16_t pageOffset, uint16_t pageAddr, void *pData, IP_EEPROM_RWSIZE_T rsize, uint32_t byteNum)
| Read data to EEPROM at specific address.
void | IP_EEPROM_Erase (IP_EEPROM_001_T *pEEPROM, uint16_t pageAddr)
| Erase a page at the specific address.

## Macro Definition Documentation

#define EEPROM_CMD_16BITS_READ (1)

EEPROM 16-bit read command

Definition at line 75 of file eeprom_001.h.

#define EEPROM_CMD_16BITS_WRITE (4)

EEPROM 16-bit write command

Definition at line 78 of file eeprom_001.h.

#define EEPROM_CMD_32BITS_READ (2)

EEPROM 32-bit read command

Definition at line 76 of file eeprom_001.h.

#define EEPROM_CMD_32BITS_WRITE (5)

EEPROM 32-bit write command

Definition at line 79 of file eeprom_001.h.

#define EEPROM_CMD_8BITS_READ (0)

EEPROM 8-bit read command

Definition at line 74 of file eeprom_001.h.

#define EEPROM_CMD_8BITS_WRITE (3)

EEPROM 8-bit write command

Definition at line 77 of file eeprom_001.h.

#define EEPROM_CMD_ERASE_PRG_PAGE (6)

EEPROM erase/program command

Definition at line 80 of file eeprom_001.h.

#define EEPROM_CMD_RDPREFETCH (1 << 3)

EEPROM read pre-fetch enable

Definition at line 81 of file eeprom_001.h.

#define EEPROM_INT_ENDOFPROG (1 << 28)

Definition at line 92 of file eeprom_001.h.

#define EEPROM_INT_ENDOFRW (1 << 26)

Definition at line 91 of file eeprom_001.h.

#define EEPROM_PAGE_NUM 63

EEPROM pages

Definition at line 69 of file eeprom_001.h.

#define EEPROM_PAGE_SIZE 64

EEPROM byes per page

Definition at line 68 of file eeprom_001.h.

#define EEPROM_PWRDWN (1 << 0)

Definition at line 86 of file eeprom_001.h.

## Enumeration Type Documentation

enum IP_EEPROM_RWSIZE_T

EEPROM Mode type definition.

Enumerator:

  EEPROM_RWSIZE_8BITS |
  EEPROM_RWSIZE_16BITS |
  EEPROM_RWSIZE_32BITS |

Definition at line 97 of file eeprom_001.h.

## Function Documentation

STATIC INLINE void IP_EEPROM_ClearIntStatus | ( | IP_EEPROM_001_T * | pEEPROM,
|  | uint32_t | mask
| ) |  |

Clear EEPROM interrupt status.

Parameters

  pEEPROM | : pointer to EEPROM peripheral block
  mask | : interrupt mask (or-ed bits value of EEPROM_INT_*)

Returns
  Nothing

Definition at line 242 of file eeprom_001.h.

STATIC INLINE void IP_EEPROM_DeInit | ( | IP_EEPROM_001_T * | pEEPROM | ) |

De-initializes EEPROM.

Parameters

  pEEPROM | : pointer to EEPROM peripheral block

Returns
  Nothing

Definition at line 260 of file eeprom_001.h.

STATIC INLINE void IP_EEPROM_DisableInt | ( | IP_EEPROM_001_T * | pEEPROM,
|  | uint32_t | mask
| ) |  |

Disable EEPROM interrupt.

Parameters

  pEEPROM | : pointer to EEPROM peripheral block
  mask | : interrupt mask (or-ed bits value of EEPROM_INT_*)

Returns
  Nothing

Definition at line 200 of file eeprom_001.h.

STATIC INLINE void IP_EEPROM_DisablePowerDown | ( | IP_EEPROM_001_T * | pEEPROM | ) |

Bring EEPROM device out of power down mode.

Parameters

  pEEPROM | : pointer to EEPROM peripheral block

Returns
  Nothing

Note
  Any EEPROM operation has to be suspended for 100us while the EEPROM wakes up.

Definition at line 178 of file eeprom_001.h.

STATIC INLINE void IP_EEPROM_EnableInt | ( | IP_EEPROM_001_T * | pEEPROM,
|  | uint32_t | mask
| ) |  |

Enable EEPROM interrupt.

Parameters

  pEEPROM | : pointer to EEPROM peripheral block
  mask | : interrupt mask (or-ed bits value of EEPROM_INT_*)

Returns
  Nothing

Definition at line 189 of file eeprom_001.h.

STATIC INLINE void IP_EEPROM_EnablePowerDown | ( | IP_EEPROM_001_T * | pEEPROM | ) |

Put EEPROM device in power down mode.

Parameters

  pEEPROM | : pointer to EEPROM peripheral block

Returns
  Nothing

Definition at line 167 of file eeprom_001.h.

void IP_EEPROM_Erase | ( | IP_EEPROM_001_T * | pEEPROM,
|  | uint16_t | pageAddr
| ) |  |

Erase a page at the specific address.

Parameters

  pEEPROM | : pointer to EEPROM peripheral block
  pageAddr | : EEPROM page address (0-62)

Returns
  Nothing

Definition at line 223 of file eeprom_001.c.

void IP_EEPROM_ErasePageRegister | ( | IP_EEPROM_001_T * | pEEPROM | ) |

Erase data in page register.

Parameters

  pEEPROM | : pointer to EEPROM peripheral block

Returns
  Nothing

Definition at line 74 of file eeprom_001.c.

void IP_EEPROM_EraseProgramPage | ( | IP_EEPROM_001_T * | pEEPROM,
|  | uint16_t | pageAddr
| ) |  |

Erase/Program an EEPROM page.

Parameters

  pEEPROM | : pointer to EEPROM peripheral block
  pageAddr | : EEPROM page address (0-62)

Returns
  Nothing

Definition at line 121 of file eeprom_001.c.

STATIC INLINE uint32_t IP_EEPROM_GetIntEnable | ( | IP_EEPROM_001_T * | pEEPROM | ) |

Get the value of the EEPROM interrupt enable register.

Parameters

  pEEPROM | : pointer to EEPROM peripheral block

Returns
  Or-ed bits value of EEPROM_INT_*

Definition at line 210 of file eeprom_001.h.

STATIC INLINE uint32_t IP_EEPROM_GetIntStatus | ( | IP_EEPROM_001_T * | pEEPROM | ) |

Get EEPROM interrupt status.

Parameters

  pEEPROM | : pointer to EEPROM peripheral block

Returns
  Or-ed bits value of EEPROM_INT_*

Definition at line 220 of file eeprom_001.h.

void IP_EEPROM_Init | ( | IP_EEPROM_001_T * | pEEPROM,
|  | uint32_t | div
| ) |  |

Initializes EEPROM.

Parameters

  pEEPROM | : pointer to EEPROM peripheral block
  div | : clock divide value (pre-minus 1)

Returns
  Nothing

Definition at line 51 of file eeprom_001.c.

Status IP_EEPROM_Read | ( | IP_EEPROM_001_T * | pEEPROM,
|  | uint16_t | pageOffset,
|  | uint16_t | pageAddr,
|  | void * | pData,
|  | IP_EEPROM_RWSIZE_T | rsize,
|  | uint32_t | byteNum
| ) |  |

Read data to EEPROM at specific address.

Parameters

  pEEPROM | : pointer to EEPROM peripheral block
  pageOffset | : offset of data in page register(0 -> EEPROM_PAGE_SIZE-1)
  pageAddr | : page address (0 ->EEPROM_PAGE_NUM -1 )
  pData | : buffer that contain data read from read data register
  rsize | : Read size: EEPROM_RWSIZE_8BITS : 8-bit read/write mode EEPROM_RWSIZE_16BITS : 16-bit read/write mode EEPROM_RWSIZE_32BITS : 32-bit read/write mode
  byteNum | : number read data (bytes)

Returns
  SUCCESS on successful write of data, or ERROR

Note
  The pageOffset must be aligned following selected mode.

Definition at line 193 of file eeprom_001.c.

STATIC INLINE uint32_t IP_EEPROM_ReadData | ( | IP_EEPROM_001_T * | pEEPROM | ) |

Read EEPROM data.

Parameters

  pEEPROM | : pointer to EEPROM peripheral block

Returns
  data

Definition at line 146 of file eeprom_001.h.

uint32_t IP_EEPROM_ReadPage | ( | IP_EEPROM_001_T * | pEEPROM,
|  | uint16_t | pageOffset,
|  | uint16_t | pageAddr,
|  | uint8_t * | pData,
|  | uint8_t | rsize,
|  | uint32_t | byteNum
| ) |  |

Read data from non-volatile memory.

Parameters

  pEEPROM | : pointer to EEPROM peripheral block
  pageOffset | : offset of data in page register(0 -> EEPROM_PAGE_SIZE-1)
  pageAddr | : page address (0 ->EEPROM_PAGE_NUM -1 )
  pData | : buffer that contain data read from read data register
  rsize | : The number of bytes in each reading (1/2/4 bytes)
  byteNum | : number of read data (bytes)

Returns
  The bumber of byte read

Note
  The pageOffset must be aligned following selected mode.

Definition at line 130 of file eeprom_001.c.

STATIC INLINE void IP_EEPROM_SetAddr | ( | IP_EEPROM_001_T * | pEEPROM,
|  | uint32_t | pageAddr,
|  | uint32_t | pageOffset
| ) |  |

Set EEPROM address.

Parameters

  pEEPROM | : pointer to EEPROM peripheral block
  pageAddr | : Page address.
  pageOffset | : Page address.

Returns
  Nothing

Definition at line 125 of file eeprom_001.h.

STATIC INLINE void IP_EEPROM_SetCmd | ( | IP_EEPROM_001_T * | pEEPROM,
|  | uint32_t | cmd
| ) |  |

Select an EEPROM command.

Parameters

  pEEPROM | : pointer to EEPROM peripheral block
  cmd | : EEPROM command.

Returns
  Nothing

Note
  cmd is or-ed bits value of EEPROM_CMD_[8|16|32]BITS_READ/EEPROM_CMD_[8|16|32]BITS_WRITE with EEPROM_CMD_RDPREFETCH flag. Read and erase/program operations are started on the EEPROM device as a side-effect of calling this function. Write operations are started as a side-effect of writing data to data register.

Definition at line 113 of file eeprom_001.h.

STATIC INLINE void IP_EEPROM_SetIntStatus | ( | IP_EEPROM_001_T * | pEEPROM,
|  | uint32_t | mask
| ) |  |

Set EEPROM interrupt status.

Parameters

  pEEPROM | : pointer to EEPROM peripheral block
  mask | : interrupt mask (or-ed bits value of EEPROM_INT_*)

Returns
  Nothing

Definition at line 231 of file eeprom_001.h.

STATIC INLINE void IP_EEPROM_SetWaitState | ( | IP_EEPROM_001_T * | pEEPROM,
|  | uint32_t | ws
| ) |  |

Set EEPROM wait state.

Parameters

  pEEPROM | : pointer to EEPROM peripheral block
  ws | : Wait State value.

Returns
  Nothing

Definition at line 157 of file eeprom_001.h.

void IP_EEPROM_WaitForIntStatus | ( | IP_EEPROM_001_T * | pEEPROM,
|  | uint32_t | mask
| ) |  |

Wait for interrupt occurs.

Parameters

  pEEPROM | : pointer to EEPROM peripheral block
  mask | : expected interrupt

Returns
  Nothing

Definition at line 61 of file eeprom_001.c.

Status IP_EEPROM_Write | ( | IP_EEPROM_001_T * | pEEPROM,
|  | uint16_t | pageOffset,
|  | uint16_t | pageAddr,
|  | void * | pData,
|  | IP_EEPROM_RWSIZE_T | wsize,
|  | uint32_t | byteNum
| ) |  |

Write data to EEPROM at specific address.

Parameters

  pEEPROM | : pointer to EEPROM peripheral block
  pageOffset | : offset of data in page register(0 -> EEPROM_PAGE_SIZE-1)
  pageAddr | : page address (0 ->EEPROM_PAGE_NUM -1 )
  pData | : buffer that contain data that will be written to buffer
  wsize | : Write size: EEPROM_RWSIZE_8BITS : 8-bit read/write mode EEPROM_RWSIZE_16BITS : 16-bit read/write mode EEPROM_RWSIZE_32BITS : 32-bit read/write mode
  byteNum | : number written data (bytes)

Returns
  SUCCESS on successful write of data, or ERROR

Note
  The pageOffset must be aligned following selected mode.
  This function actually write data into EEPROM memory and automatically write into next page if current page is overflowed

Definition at line 163 of file eeprom_001.c.

STATIC INLINE void IP_EEPROM_WriteData | ( | IP_EEPROM_001_T * | pEEPROM,
|  | uint32_t | data
| ) |  |

Write EEPROM data.

Parameters

  pEEPROM | : pointer to EEPROM peripheral block
  data | : EEPROM data.

Returns
  Nothing

Definition at line 136 of file eeprom_001.h.

uint32_t IP_EEPROM_WritePageRegister | ( | IP_EEPROM_001_T * | pEEPROM,
|  | uint16_t | pageOffset,
|  | uint8_t * | pData,
|  | uint8_t | wsize,
|  | uint32_t | byteNum
| ) |  |

Write data to page register.

Parameters

  pEEPROM | : pointer to EEPROM peripheral block
  pageOffset | : offset of data in page register(0 -> EEPROM_PAGE_SIZE-1)
  pData | : buffer that contain data that will be written to buffer
  wsize | : The number of bytes in each writting (1/2/4 bytes)
  byteNum | : number written data (bytes)

Returns
  The bumber of byte written

Note
  The pageOffset must be aligned following selected mode.

Definition at line 92 of file eeprom_001.c.