release/src/linux/linux/drivers/net/tlan.c
/***************************************************************
	 *	TLan_EeReceiveByte
	 *
	 *	Returns:
	 *		Nothing
	 *	Parms:
	 *		io_base		The IO port base address for the
	 *				TLAN device with the EEPROM to
	 *				use.
	 *		data		An address to a char to hold the
	 *				data sent from the EEPROM.
	 *		stop		If TLAN_EEPROM_STOP is passed, a
	 *				stop cycle is sent after the
	 *				byte is received, and no ack is
	 *				sent.
	 *
	 *	This function receives 8 bits of data from the EEPROM
	 *	over the serial link.  It then sends and ack bit, or no
	 *	ack and a stop bit.  This function is used to retrieve
	 *	data after the address of a byte in the EEPROM has been
	 *	sent.
	 *
	 **************************************************************/
TLan_EeReceiveByte
Returns:
Nothing
Parms:
io_base         The IO port base address for the
TLAN device with the EEPROM to
use.
data            An address to a char to hold the
data sent from the EEPROM.
stop            If TLAN_EEPROM_STOP is passed, a
stop cycle is sent after the
byte is received, and no ack is
sent.

This function receives 8 bits of data from the EEPROM
over the serial link.  It then sends and ack bit, or no
ack and a stop bit.  This function is used to retrieve
data after the address of a byte in the EEPROM has been
sent.
TLan_EeReceiveByte Returns : Nothing Parms : io_base The IO port base address for the TLAN device with the EEPROM to use . data An address to a char to hold the data sent from the EEPROM . stop If TLAN_EEPROM_STOP is passed a stop cycle is sent after the byte is received and no ack is sent . This function receives 8 bits of data from the EEPROM over the serial link . It then sends and ack bit or no ack and a stop bit . This function is used to retrieve data after the address of a byte in the EEPROM has been sent .
void TLan_EeReceiveByte( u16 io_base, u8 *data, int stop )
{
	u8  place;
	u16 sio;
	outw( TLAN_NET_SIO, io_base + TLAN_DIO_ADR );
	sio = io_base + TLAN_DIO_DATA + TLAN_NET_SIO;
	*data = 0;
	TLan_ClearBit( TLAN_NET_SIO_ETXEN, sio );
	for ( place = 0x80; place; place >>= 1 ) {
		TLan_SetBit( TLAN_NET_SIO_ECLOK, sio );
		if ( TLan_GetBit( TLAN_NET_SIO_EDATA, sio ) )
			*data |= place;
		TLan_ClearBit( TLAN_NET_SIO_ECLOK, sio );
	}
	TLan_SetBit( TLAN_NET_SIO_ETXEN, sio );
	if ( ! stop ) {
		TLan_ClearBit( TLAN_NET_SIO_EDATA, sio );	
		TLan_SetBit( TLAN_NET_SIO_ECLOK, sio );
		TLan_ClearBit( TLAN_NET_SIO_ECLOK, sio );
	} else {
		TLan_SetBit( TLAN_NET_SIO_EDATA, sio );		
		TLan_SetBit( TLAN_NET_SIO_ECLOK, sio );
		TLan_ClearBit( TLAN_NET_SIO_ECLOK, sio );
		TLan_ClearBit( TLAN_NET_SIO_EDATA, sio );	
		TLan_SetBit( TLAN_NET_SIO_ECLOK, sio );
		TLan_SetBit( TLAN_NET_SIO_EDATA, sio );
	}
}
void TLan_EeReceiveByte ( u16 io_base , u8 * data , int stop ) { u8 place ; u16 sio ; outw ( TLAN_NET_SIO , io_base + TLAN_DIO_ADR ) ; sio = io_base + TLAN_DIO_DATA + TLAN_NET_SIO ; * data = 0 ; TLan_ClearBit ( TLAN_NET_SIO_ETXEN , sio ) ; for ( place = 0x80 ; place ; place >>= 1 ) { TLan_SetBit ( TLAN_NET_SIO_ECLOK , sio ) ; if ( TLan_GetBit ( TLAN_NET_SIO_EDATA , sio ) ) * data |= place ; TLan_ClearBit ( TLAN_NET_SIO_ECLOK , sio ) ; } TLan_SetBit ( TLAN_NET_SIO_ETXEN , sio ) ; if ( ! stop ) { TLan_ClearBit ( TLAN_NET_SIO_EDATA , sio ) ; TLan_SetBit ( TLAN_NET_SIO_ECLOK , sio ) ; TLan_ClearBit ( TLAN_NET_SIO_ECLOK , sio ) ; } else { TLan_SetBit ( TLAN_NET_SIO_EDATA , sio ) ; TLan_SetBit ( TLAN_NET_SIO_ECLOK , sio ) ; TLan_ClearBit ( TLAN_NET_SIO_ECLOK , sio ) ; TLan_ClearBit ( TLAN_NET_SIO_EDATA , sio ) ; TLan_SetBit ( TLAN_NET_SIO_ECLOK , sio ) ; TLan_SetBit ( TLAN_NET_SIO_EDATA , sio ) ; } }
TLan_EeReceiveByte
      Returns:
              Nothing
      Parms:
              io_base         The IO port base address for the
                              TLAN device with the EEPROM to
                              use.
TLan_EeReceiveByte Returns : Nothing Parms : io_base The IO port base address for the TLAN device with the EEPROM to use .
/* Assume clock is low, tx is enabled; */ /* Ack = 0 */ /* No ack = 1 (?) */ /* STOP, raise data while clock is high */