Internal Registers
2-13
ThunderLAN Registers
is used to set the network transmit commit level. The
BSIZEreg register is used
to set the bus burst size on both Tx and Rx frames.
The internal registers are accessed via the DIO_DATA and DIO_ADR host
registers. DIO_ADR holds the DIO address of the register. The data is then
read from or written to DIO_DATA.
Before one can write to an internal register, one must find the proper address
for the host registers to use as pointers to the internal register block, and de-
cide whether to use the memory pointer or the I/O port pointer value. Following
is an example of x86 C code to access a byte from an internal register using
the I/O port pointer value:
//––––––––––––––––––––––––––––––––––––––––––––––––––––––––
// DioRdByte() – Read byte from adapter internal register
//
// Parameters:
// base_addr WORD base address of TLAN internal registers
// addr
WORD offset of register to read
//
// Return val:
// BYTE
value read
//––––––––––––––––––––––––––––––––––––––––––––––––––––––––
BYTE DioRdByte(WORD base_addr, WORD addr)
{
outpw(baOFF_DIO_ADDR, addr);
return(inp((baOFF_DIO_DATA) + (addr&3)));
}
The address of the register being read is determined by the calling program
and is passed to this routine as a parameter, along with the the I/O base ad-
dress. An output is executed to the DIO_ADR host register as part of setting
up the pointer address. In x86 architectures, there are separate instructions
for 16-bit port writes and 8-bit port writes; the 16-bit version is used to write all
the address field’s 16 bits in one operation. Internally, this causes the data from
the internal register at that address to be deposited in the DIO_DATA host reg-
ister. A byte read of the data register gets the LSbyte (addr&3). A more sophis-
ticated routine honors the address of the byte specifically requested and sees
that those eight bits are shifted down to a byte to be returned. If you want to
read a whole word from one of the internal registers (32 bits), you could per-
form two 16-bit reads and merge the values to be returned as a 32-bit value
like this:
Summary of Contents for ThunderLAN TNETE100A
Page 2: ...Printed in U S A October 1996 L411001 9761 revisionA SPWU013A ...
Page 3: ......
Page 17: ...xiv ...
Page 23: ...1 6 ...
Page 67: ...3 10 ...
Page 81: ...4 14 ...
Page 113: ...7 10 ...
Page 165: ...A 52 ...
Page 179: ...C 2 ...