DM9000A
APPLICATION NOTES
Preliminary 29
Version: DM9000A-AN-V121
November 27, 2007
Step 2: write the packet's data into TX FIFO SRAM,
outb ( IOaddr, 0xF8 );
/* trigger MWCMD REG. F8H with wr+ */
/* u8 TX_data[]: the transmitting data, int TX_length: the length of TX_data[] */
if ( io_mode == DM9000A_BYTE_MODE ) { /* I/O 8-bit Byte mode if ( io_mode == 1 ) */
for ( i = 0; i < TX_length; i++ ) /* loop to write a Byte data into TX FIFO SRAM */
outb ( TX_data[i], 4 );
}
else if ( io_mode == DM9000A_WORD_MODE ) { /* IO 16-bit Word mode if(io_mode== 0) */
(int) length_tmp = ( TX_ 1 ) / 2;
/* depended on Word mode for loop */
for ( i = 0; i < length_tmp; i++ ) /* loop to write a Word data into TX FIFO SRAM */
outw ( ( (u16 *) TX_data)[i], 4 );
}
Step 3: write the transmitting length into TXPLH REG. FCH and TXPLL REG. FDH,
/* write high byte of the TX data length into TXPLL REG. FDH */
iow ( 0xFD, (TX_length >> 8) & 0xff );
/* write low byte of the TX data length into TXPLH REG. FCH */
Iow ( 0xFC, TX_length & 0xff );
Step 4: start to transmit a packet out,
iow ( 0x02, 1 );
/* set a TX request command, TXREQ, Bit[0] of TCR REG.02 */
5.5.2 To Check a Completion Flag
If the driver is used the polling/ interrupt method, the program segment can be inserted into
the TX routine for detecting a packet transmission completed or even double-check interrupt:
(u8) TX_status = ior ( 0x01 );
/* read NSR REG. 01 status for TX completed */
if ( TX_status & (4 | 8) ) { /* success */ } /* check if TX1END or TX2END=1, TX ok*/
The program segment shown as follows can be inserted into the interrupt handler, if the driver
is used the interrupt driven and setting the IMR PTM Bit [1] = 1 enable:
(u8) INT_status = ior ( 0xFE );
/* got DM9000A interrupt status in ISR */
if ( INT_status & 0x02 ) { /* TX success */ /* check if PTS Bit [1] = 1, TX ok */
iow ( 0xFE, 0x02 ); }
/* clear PTS Bit [1] latched in ISR */
// if ( INT_status & 0x01 )
{ /* RX success */ iow ( 0xFE, 0x01 ); }