/*
*******************************************************************************************************************
*								SERIAL EEPROM DRIVER (ATMEL AT24C256 or compatible)
* Description:  IIC-based serial eeprom driver (ATMEL AT24C256 or compatible)
* File:			at24c256.h
* Software:		Keil C (C51) compiler, Eval version 7.09 under uVision2 IDE v2.40
* Programmer: 	John Leung, TechToys Co. (www.TechToys.com.hk)
* Hardware:		gLCD-STK1
* Date:			14th May 2006
* Version:		1.0
*******************************************************************************************************************
*/

#ifndef _AT24C02_H_
#define _AT24C02_H_

#define EEPROM_ADDR			0xA0	//for A0 - A2 all grounded
#define EEPROM_SIZE			32768	//size of AT24C256 in 32,768 x8bit, i.e.of 32k bytes
									//AT24C256, 256K SERIAL EEPROM is internally organized as
									//512 pages of 64-bytes each.
#define EEPROM_PAGE_SIZE	64		//AT24C256 has 64-byte page size
#define EEPROM_BUS_ERR		0xFF
#define EEPROM_BUS_OK		0

#ifndef _uchar_
#define _uchar_
typedef unsigned char uchar;
#endif

#ifndef _uint_
#define _uint_
typedef unsigned int  uint;
#endif

/*
**************************************************************************************************************
*											FUNCTION PROTOTYPES
**************************************************************************************************************
*/
uchar eeprom_WrByte(uchar eeprom_addr, uint dataptr, uchar c);
uchar eeprom_WrPage(uchar eeprom_addr, uint dataptr, uchar *s, uchar length);
uchar eeprom_RdRandomByte(uchar eeprom_addr, uint dataptr, uchar *s);
uchar eeprom_RdPage(uchar eeprom_addr, uint dataptr, uchar *s, uchar length);
#endif

