Texas Instruments TNETE211 Network Card User Manual


 
External Devices
2-28
Set and clear are macros for a read/modify/write routine for individual bits in
the NetSio register. The NetSio byte is read indirectly from the internal register
block with the host register address and data pointers, the bit passed as a
constant (really a bit mask) is ANDed to 0 (clear), or ORed to a 1 (set). The
pattern of bits to be set and cleared is given in the data sheet for the EEPROM.
// put EEPROM device identifier, address, and write
// command on bus
sel(base_addr, WRITE);
The EEPROM, with its serial interface, must receive a wakeup pattern and a
device number, since more than one device can be tied to this bus. This code
assumes that there is only one device, 0.
// EEPROM should have acked
if (!ack(base_addr))
return (0);
// send address on EEPROM to read from
sendaddr(base_addr, addr);
sendaddr is a routine for serially sending out the address to be read from the
EEPROM. Each bit of the address must be accompanied by a clock.
// EEPROM should have ack’d address received
if (!ack(base_addr))
return (0);
// send EEPROM start access sequence
set(ETXEN); set(ECLOK); set(EDATA); set(ETXEN);
clr(EDATA); clr(ECLOK);