REG00=0x21; // Stop RTL8019 before initiation.
for(dly = 50000; dly > 0; dly--);;; // The delay time will be replaced by OSTimeDly().
EthPageSel(0);
REG01 = 0x4C; // Page Start Register. The Page Start register sets the start page address of
// the receive buffer ring.
REG02 = 0x60; // Page Stop Register. The Page Stop register sets the stop page address of the
// receive buffer ring. In 8 bit mode the PSTOP register should not exceed to 0x60,
// in 16 bit mode the PSTOP register should not exceed to 0x80.
REG03 = 0x4C;//5F; // Boundary Register (03H; Type=R/W in Page0)
// This register is used to prevent overwrite of the receive buffer ring. It is
// typically used as a pointer indicating the last receive buffer page the host has read.
REG04 = 0x40; // Transmit Page Start Register (04H; Type=W in Page0)
// This register sets the start page address of the packet to the transmitted.
REG07 = 0xFF; // ISR: Interrupt Status Register (07H; Type=R/W in Page0)
// This register reflects the NIC status. The host reads it to determine the cause of
// an interrupt.Individual bits are cleared by writing a "1" into the corresponding bit.
// It must be cleared after power up.
REG0A = 0x00;
REG0B = 0x00; // These two registers set the data byte counts of remote DMA.
// to debug the connection freely, the NIC is configed as receiving any data from MAC.
REG0C = 0xC4; // RCR: Receive Configuration Register (0CH; Type=W in Page0, Type=R in Page2)
REG0D = 0xE0; // TCR: Transmit Configuration Register (0DH; Type=W in Page0, Type=R in Page2)
REG0E = 0xC8; // DCR: Data Configuration Register (0EH; Type=W in Page0, Type=R in Page2)
REG0F = 0x00; // IMR: Interrupt Mask Register (0FH; Type=W in Page0, Type=R in Page2)
// All bits correspond to the bits in the ISR register. POWER UP=all 0s. Setting individual
// bits will enable the corresponding interrupts.
EthPageSel(1);
REG07 = 0x4D;//4C; // CURR: Current Page Register (07H; Type=R/W in Page1)
// This register points to the page address of the first receive buffer page to be used
// for a packet reception.
REG08 = 0x00; // MAR0-7: Multicast Address Register (08H - 0FH; Type=R/W in Page1)
// These REGisters provide filtering bits of multicast addresses hashed by the CRC logic.
REG09 = 0x00;
REG0A = 0x00;
REG0B = 0x00;
REG0C = 0x00;
REG0D = 0x00;
REG0E = 0x00;
REG0F = 0x00;
EthCardAddrLoad(); // 将网卡地址写入到mar寄存器
EthPageSel(0);
REG0C = 0xCC; //将网卡设置成正常的模式,跟外部网络连接
REG0D = 0xE0;
REG00 = 0x22; // start RTL8019.
REG07 = 0xFF; //清除所有中断标志位
REG0F = 0xFF;