kernels/linux-2.4.0/drivers/net/tlan.c
/***************************************************************
	 *	TLan_EeSendByte
	 *
	 *	Returns:
	 *		If the correct ack was received, 0, otherwise 1
	 *	Parms:	io_base		The IO port base address for the
	 *				TLAN device with the EEPROM to
	 *				use.
	 *		data		The 8 bits of information to
	 *				send to the EEPROM.
	 *		stop		If TLAN_EEPROM_STOP is passed, a
	 *				stop cycle is sent after the
	 *				byte is sent after the ack is
	 *				read.
	 *
	 *	This function sends a byte on the serial EEPROM line,
	 *	driving the clock to send each bit. The function then
	 *	reverses transmission direction and reads an acknowledge
	 *	bit.
	 *
	 **************************************************************/
TLan_EeSendByte
Returns:
If the correct ack was received, 0, otherwise 1
Parms:  io_base         The IO port base address for the
TLAN device with the EEPROM to
use.
data            The 8 bits of information to
send to the EEPROM.
stop            If TLAN_EEPROM_STOP is passed, a
stop cycle is sent after the
byte is sent after the ack is
read.

This function sends a byte on the serial EEPROM line,
driving the clock to send each bit. The function then
reverses transmission direction and reads an acknowledge
bit.
TLan_EeSendByte Returns : If the correct ack was received 0 otherwise 1 Parms : io_base The IO port base address for the TLAN device with the EEPROM to use . data The 8 bits of information to send to the EEPROM . stop If TLAN_EEPROM_STOP is passed a stop cycle is sent after the byte is sent after the ack is read . This function sends a byte on the serial EEPROM line driving the clock to send each bit . The function then reverses transmission direction and reads an acknowledge bit .
int TLan_EeSendByte( u16 io_base, u8 data, int stop )
{
	int	err;
	u8	place;
	u16	sio;
	outw( TLAN_NET_SIO, io_base + TLAN_DIO_ADR );
	sio = io_base + TLAN_DIO_DATA + TLAN_NET_SIO;
	for ( place = 0x80; place != 0; place >>= 1 ) {
		if ( place & data )
			TLan_SetBit( TLAN_NET_SIO_EDATA, sio );
		else
			TLan_ClearBit( TLAN_NET_SIO_EDATA, sio );
		TLan_SetBit( TLAN_NET_SIO_ECLOK, sio );
		TLan_ClearBit( TLAN_NET_SIO_ECLOK, sio );
	}
	TLan_ClearBit( TLAN_NET_SIO_ETXEN, sio );
	TLan_SetBit( TLAN_NET_SIO_ECLOK, sio );
	err = TLan_GetBit( TLAN_NET_SIO_EDATA, sio );
	TLan_ClearBit( TLAN_NET_SIO_ECLOK, sio );
	TLan_SetBit( TLAN_NET_SIO_ETXEN, sio );
	if ( ( ! err ) && stop ) {
		TLan_ClearBit( TLAN_NET_SIO_EDATA, sio );	
		TLan_SetBit( TLAN_NET_SIO_ECLOK, sio );
		TLan_SetBit( TLAN_NET_SIO_EDATA, sio );
	}
	return ( err );
}
int TLan_EeSendByte ( u16 io_base , u8 data , int stop ) { int err ; u8 place ; u16 sio ; outw ( TLAN_NET_SIO , io_base + TLAN_DIO_ADR ) ; sio = io_base + TLAN_DIO_DATA + TLAN_NET_SIO ; for ( place = 0x80 ; place != 0 ; place >>= 1 ) { if ( place & data ) TLan_SetBit ( TLAN_NET_SIO_EDATA , sio ) ; else TLan_ClearBit ( TLAN_NET_SIO_EDATA , sio ) ; TLan_SetBit ( TLAN_NET_SIO_ECLOK , sio ) ; TLan_ClearBit ( TLAN_NET_SIO_ECLOK , sio ) ; } TLan_ClearBit ( TLAN_NET_SIO_ETXEN , sio ) ; TLan_SetBit ( TLAN_NET_SIO_ECLOK , sio ) ; err = TLan_GetBit ( TLAN_NET_SIO_EDATA , sio ) ; TLan_ClearBit ( TLAN_NET_SIO_ECLOK , sio ) ; TLan_SetBit ( TLAN_NET_SIO_ETXEN , sio ) ; if ( ( ! err ) && stop ) { TLan_ClearBit ( TLAN_NET_SIO_EDATA , sio ) ; TLan_SetBit ( TLAN_NET_SIO_ECLOK , sio ) ; TLan_SetBit ( TLAN_NET_SIO_EDATA , sio ) ; } return ( err ) ; }
TLan_EeSendByte
      Returns:
              If the correct ack was received, 0, otherwise 1
      Parms:  io_base         The IO port base address for the
                              TLAN device with the EEPROM to
                              use.
TLan_EeSendByte Returns : If the correct ack was received 0 otherwise 1 Parms : io_base The IO port base address for the TLAN device with the EEPROM to use .
/* Assume clock is low, tx is enabled; */ /* STOP, raise data while clock is high */