Texas Instruments TNETE110A Network Card User Manual


 
External Devices
2-27
ThunderLAN Registers
Writing to the NetSio register involves writing a >000 to the host register
DIO_ADR, then writing to the DIO_DATA host register. Control of the
EEPROM interface shifts to the bits in NetSio when a write takes place to the
DIO_DATA host register. Following is an example of how one might read a byte
of data from the EEPROM, using the control bits in NetSio from the internal
register block.
//––––––––––––––––––––––––––––––––––––––––––––––––––––––––
// EeRdByte() – read byte of data from EEPROM (see
Exel XL24C02 device specification)
//
// Parameters:
// base_addr WORD base address of TLAN internal
registers
// addr WORD address to read
//
// Return val:
// BYTE value read
//––––––––––––––––––––––––––––––––––––––––––––––––––––––––
BYTE EeRdByte(WORD base_addr, WORD addr)
{
int i,ips,tmp;
CritOn();
CritOn turns off the interrupts. Remember that there are two possible control
points for reading and writing to the EEPROM. This is an attempt to avoid a
control shift and avoid loss of focus on just which byte, word, or double word
one accesses, since accessing the EEPROM is a relatively long process.
// send EEPROM start sequence
set(ECLOK); set(EDATA); set(ETXEN); clr(EDATA);
clr(ECLOK);