/******************************************************************************
*                                                                             *
*        **********                                                           *
*       ************                                                          *
*      ***        ***                                                         *
*     ***    ++    ***                                                        *
*     ***   +  +   ***                      CHIPCON                           *
*     ***   +                                                                 *
*     ***   +  +   ***                                                        *
*     ***    ++    ***                                                        *
*      ***        ***                                                         *
*       ************                                                          *
*        **********                                                           *
*                                                                             *
*******************************************************************************

Filename:     eeprom.h
Target:       cc2430
Author:       EFU
Revised:      16/12-2005
Revision:     1.0

Description:
Function declarations for common EEPROM functions for use with the CC2430DB.

All functions defined here are implemented in eeprom.c.

******************************************************************************/
#ifndef EEPROM_H
#define EEPROM_H

#include "hal.h"


/******************************************************************************
* @fn  initEEProm
*
* @brief
*      Initializes the EEPROM. Configures pins EE_SDA and EE_SCL as input.
*
* Parameters:
*
* @param  void
*
* @return void
*
******************************************************************************/
void initEEProm( void );


/******************************************************************************
* @fn  eraseEEProm
*
* @brief
*      Erases the entire EEPROM, by writing 0x00 to all memory locations.
*
* Parameters:
*
* @param  void
*
* @return void
*
******************************************************************************/
void eraseEEProm( void );


/******************************************************************************
* @fn  writeEEProm
*
* @brief
*      This function writes _length_ bytes of data starting at the _buffer_
*      location to the EEPROM address _address_.
*
* Parameters:
*
* @param  BYTE*    buffer
* 	  Pointer to the first byte to be written to EEPROM. _length_ bytes
*	  starting from this address will be written to EEPROM address _address_.
*
* @param  WORD	   address
*	  Target EEPROM address for write operation.
*
* @param  UINT8    length
*	  Number of bytes to be written to EEPROM.
*
* @return BYTE
*         TRUE: Write operation successful.
*         FALSE: Write operation NOT successful.
*
******************************************************************************/
BYTE writeEEProm(BYTE* buffer, WORD address, UINT8 length);


/******************************************************************************
* @fn  readEEProm
*
* @brief
*      Initiates sequential read of EEPROM content from the given address. The
*      read operation transfer _length_ bytes to _buffer_, starting at EEPROM
*      address _address_, ending at _adress_ + _length_.
*
* Parameters:
*
* @param  BYTE*    buffer
*	  Pointer to buffer for storing read values.
*	
* @param  WORD     address
*	  Start address for read operation. Valid range: 0 - 0xFFF.
*
* @param  UINT8    length
*	  Number of bytes to be read.
*
* @return BOOL
*         TRUE: Read operation successful.
*         FALSE: Read operation NOT successful.
*
******************************************************************************/
BOOL readEEProm(BYTE* buffer, WORD address, UINT8 length);

#endif
