DM9000A
APPLICATION NOTES
Preliminary 21
Version: DM9000A-AN-V121
November 27, 2007
5 How to Program DM9000A
5.1 How to Read/ Write DM9000A Register
There are only two addressing ports through the access of the host interface. One port is
INDEX port and the other is DATA port. INDEX port is decoded by the pin CMD=0 and DATA
port is decoded by the pin CMD = 1. The content of INDEX port is the address of the register
to access DATA port later. Before accessing the 8-bit data in any register or the 8/ 16-bit data
in the RX/ TX FIFO SRAM (total 16K bytes), the address of the register must be written into
INDEX port. Please refer to the DM9000A datasheet chapter 9.1 about host interface.
Here are the examples to read and write the DM9000A register:
(Where CMD pin is connected to Processor SA2)
UINT16 IOaddr; /* UINT32 IOaddr=0x19000000; for example defined in ARM-base HPI BANK3*/
void iow ( UINT16 reg, UINT8 dataB )
{
outb(reg, IOaddr);
/* I/O output a byte to INDEX port, select the register*/
outb(dataB, 4); /* I/O output a byte to DATA port, WRITE the register data*/
}
UINT8 ior ( UINT16 reg )
{
outb (reg, IOaddr);
/* I/O output a byte to INDEX port, select the register*/
return inb( 4); /*I/O input a byte from DATA port, READ the register data*/
}