DM9000A
APPLICATION NOTES
Preliminary 32
Version: DM9000A-AN-V121
November 27, 2007
Here is an example to get the RX status and length:
(u8) io_mode = ior ( 0xFE ) >> 7; /* ISR Bit [7] IOMODE indicating DATA I/O mode */
outb ( 0xF2, IOaddr );
/* trigger MRCMD (REG. F2H) with r+ */
/* int RX_status: the RX packet status, int RX_length: the length of the RX packet*/
if ( io_mode == DM9000A_BYTE_MODE ) { /* I/O 8-bit Byte mode if ( io_mode == 1 ) */
RX_status = inb ( 4 ) + ( inb ( 4 ) << 8 );
RX_length = inb ( 4 ) + ( inb ( 4 ) << 8 );
}
else if ( io_mode== DM9000A_WORD_MODE ) { /* I/O 16-bit Word mode if(io_mode== 0) */
RX_status = inw ( 4 ); /* the high byte is the status as RSR REG. 06 */
RX_length = inw ( 4 );
}
5.6.4 Receive the Packet's Data
The read pointer will be increased after reading the memory read command MRCMD REG.F2.
According to the length of the received packet, dump out the RX payload and the 4-byte CRC.
Here is an example to get the RX packet's data:
/* u8 RX_data[] : the data of the received packet with the 4-byte CRC checksum */
if ( io_mode == DM9000A_BYTE_MODE ) { /* I/O 8-bit Byte mode if ( io_mode == 1 ) */
for ( i = 0 ; i < RX_length ; i++ ) /* loop to READ a Byte data from RX FIFO SRAM */
RX_data[ i ] = (u8) inb ( 4 );
}
else
if ( io_mode== DM9000A_WORD_MODE ) { /* I/O 16-bit Word mode if(io_mode== 0) */
(int) tmp_length = ( RX_ 1 ) / 2;
/* Word mode */
for ( i = 0 ; i < tmp_length ; i++ ) /* loop to READ a Word data from RX FIFO SRAM*/
( (u16 *)RX_data)[ i ] = inw ( 4 );
}