net/xeeprom.h File Reference


Detailed Description

External serial I2C EEPROM code for Modtronix TCP/IP Stack.

Author:
Modtronix Engineering
Compiler:
MPLAB C18 v2.10 or higher
HITECH PICC-18 V8.35PL3 or higher

Description

This module contains code for reading and writing to the external serial I2C EEPROM memory. This memory is used to store the web pages contained on the web server.


Defines

#define EE_BAUD(CLOCK, BAUD)   ( ((CLOCK / BAUD) / 4) - 1 )
#define XEEBeginWrite(control, address)   XEESetAddr(control, address)

Typedefs

typedef unsigned short int XEE_ADDR
typedef enum _XEE_RESULT XEE_RESULT

Enumerations

enum  _XEE_RESULT {
  XEE_SUCCESS = 0, XEE_READY = 0, XEE_BUS_COLLISION, XEE_NAK,
  XEE_VERIFY_ERR, XEE_BUSY
}

Functions

BYTE XEEBeginRead (unsigned char control, XEE_ADDR address)
BYTE XEEEndRead (void)
BYTE XEEEndWrite (void)
void XEEInit (unsigned char baud)
BYTE XEEIsBusy (unsigned char control)
unsigned char XEERead (void)
BYTE XEEReadArray (unsigned char control, XEE_ADDR address, unsigned char *buffer, unsigned char length)
BYTE XEESetAddr (unsigned char control, XEE_ADDR address)
BYTE XEEWrite (unsigned char val)


Define Documentation

#define EE_BAUD CLOCK,
BAUD   )     ( ((CLOCK / BAUD) / 4) - 1 )
 

#define XEEBeginWrite control,
address   )     XEESetAddr(control, address)
 

Sets up internal address counter of EEPROM.

This function does not release the I2C bus. User must close XEEEndWrite() after this function is called to relase the I2C bus.

Pre-Condition:
XEEInit() is already called.
Parameters:
control data EEPROM control code
address address to where to write
Returns:
XEE_SUCCESS if successful other value if failed.


Typedef Documentation

typedef unsigned short int XEE_ADDR
 

typedef enum _XEE_RESULT XEE_RESULT
 


Enumeration Type Documentation

enum _XEE_RESULT
 

Enumerator:
XEE_SUCCESS 
XEE_READY 
XEE_BUS_COLLISION 
XEE_NAK 
XEE_VERIFY_ERR 
XEE_BUSY 


Function Documentation

BYTE XEEBeginRead unsigned char  control,
XEE_ADDR  address
 

Sets internal address counter to given address. Puts EEPROM in sequential read mode.

This function does not release I2C bus. User must call XEEEndRead() when read is not longer needed; I2C bus will released after XEEEndRead() is called.

Pre-Condition:
XEEInit() is already called.
Parameters:
control EEPROM control and address code.
address Address at which read is to be performed.
Returns:
XEE_SUCCESS if successful other value if failed.

BYTE XEEEndRead void   ) 
 

Ends sequential read cycle.

This function ends seuential cycle that was in progress. It releases I2C bus.

Pre-Condition:
XEEInit() && XEEBeginRead() are already called.
Returns:
XEE_SUCCESS if successful other value if failed.

BYTE XEEEndWrite void   ) 
 

Instructs EEPROM to begin write cycle.

Call this function after either page full of bytes written or no more bytes are left to load. This function initiates the write cycle. User must call for XEEWait() to ensure that write cycle is finished before calling any other routine.

Pre-Condition:
XEEInit() && XEEBeginWrite() are already called.
Returns:
XEE_SUCCESS if successful other value if failed.

void XEEInit unsigned char  baud  ) 
 

Overview: Initialize I2C module to communicate to serial EEPROM.

Parameters:
baud - SSPADD value for bit rate.

BYTE XEEIsBusy unsigned char  control  ) 
 

Requests ack from EEPROM.

Pre-Condition:
XEEInit() is already called.
Parameters:
control EEPROM control and address code.
Returns:
XEE_READY if EEPROM is not busy
XEE_BUSY if EEPROM is busy
other value if failed.

unsigned char XEERead void   ) 
 

Reads next byte from EEPROM; internal address is incremented by one.

This function does not release I2C bus. User must call XEEEndRead() when read is not longer needed; I2C bus will released after XEEEndRead() is called.

Pre-Condition:
XEEInit() && XEEBeginRead() are already called.
Returns:
XEE_SUCCESS if successful other value if failed.

BYTE XEEReadArray unsigned char  control,
XEE_ADDR  address,
unsigned char *  buffer,
unsigned char  length
 

Reads desired number of bytes in sequential mode. This function performs all necessary steps and releases the bus when finished.

Pre-Condition:
XEEInit() is already called.
Parameters:
control EEPROM control and address code.
address Address from where array is to be read
buffer Caller supplied buffer to hold the data
length Number of bytes to read.
Returns:
XEE_SUCCESS if successful other value if failed.

BYTE XEESetAddr unsigned char  control,
XEE_ADDR  address
 

Modifies internal address counter of EEPROM.

This function does not release the I2C bus. User must close XEEClose() after this function is called.

Pre-Condition:
XEEInit() is already called.
Parameters:
control data EEPROM control code
address address to be set
Returns:
XEE_SUCCESS if successful other value if failed.

BYTE XEEWrite unsigned char  val  ) 
 

Writes given value 'val' at current address. Current address is set by XEEBeginWrite() and is incremented by every XEEWrite().

This function does not initiate the write cycle; it simply loads given value into internal page buffer. This function does not release the I2C bus. User must close XEEEndWrite() after this function is called to relase the I2C bus.

Pre-Condition:
XEEInit() && XEEBeginWrite() are already called.
Parameters:
val Value to be written
Returns:
XEE_SUCCESS if successful other value if failed.


Generated on Wed Feb 22 12:39:26 2006 for SBC68EC Web Server by  doxygen 1.4.5