I am trying to transmit and receive from Realtek 8168E using loopback(For windows 7 platform) ( writing into tx buffer and reading from rx buffer) Reading rx buffer gives 0. On checking interrupt status register, TDU and RDU bit is set to 1 (Tx/Rx descriptor unavailable)
Network adaptor : Realtek 8168E
Data sheet referred : Realtek 8168B
Transmitter side configuration - Allocated a memory for TX descriptor as per the specification given in the data sheet (page no:55). Aligned descriptor to 256 byte alignment.
Also allocated a separate buffer (TXBuffer) to store the data to be transmitted.
Placed the address of TXBuffer into the specified field in the TX descriptor.
Enabled the MAC loopback bit in the TX config register (40h).
Then we have enabled the NPQ bit in the TxPoll register (38h).
After that, we have done the NIC reset by offset 37h.
Then we have enabled the loopback bit in BMCR register.
Enabled the Tx OK, and Tx Descriptor Unavailable interrupts in interrupt mask register (3Ch).
Placed the Tx Descriptor address into the MAC register TNPDS (20h).
Then at last enabled the TE bit in command register (37h).
Similarly I did required configuration in Rx side.
Below are the buffer I have Given
//TX Buffer desriptor
typedef struct _TMP_TBD_STRUC {
ULONG ulFrameLength;
ULONG VLAN_TAG;
ULONG TX_Buffer_Add_Low;
ULONG TX_Buffer_Add_High;
} TBD_TMP_STRUC, *PTBD_TMP_STRUC;
//RX Buffer desriptor
typedef struct _RMP_RBD_STRUC {
ULONG ulBufferSize;
ULONG VLAN_TAG;
ULONG RX_Buffer_Add_Low;
ULONG RX_Buffer_Add_High;
} RBD_RMP_STRUC, *PRBD_RMP_STRUC;
*PL. suggest with how to debug such situation. Also the correct seqeunce of Tx & Rx descriptor configuration, pl share. *