硬件:请教斑竹8019
这是我的一段8019初始化CODE,请指教为什末他的CR不受程序控制,始终保持在PAGE0
上。而且其他命令也执行不
了。//******************************************************************
//* Initialize the RTL8019AS
//******************************************************************
void init_RTL8019AS()
{
read_creg(RSTPORT);
write_creg(RSTPORT,byte_read); // put NIC in reset
delay_ms(10); // delay_ms at least 1.6ms
read_creg(RSTPORT); // read contents of reset port
write_creg(RSTPORT,byte_read); // do soft reset
delay_ms(10); // give it time
read_creg(ISR); // check for good soft reset
if(!bit_test(byte_read,RST)){
while(1){
printf("INIT FAILED\n\r");
}
}
write_creg(CR,0x21); //stop the NIC, abort DMA, page 0
delay_ms(2); //make sure nothing is coming in or going out
write_creg(DCR,dcrval); //0x58
write_creg(RBCR0,0x00); //clear the DMA byte counters
write_creg(RBCR1,0x00);
write_creg(RCR,0x04); //accept broadcast packets
write_creg(TPSR,txstart); //set transmit buffer start page
write_creg(TCR,0x02);
write_creg(PSTART,rxstart);//set receive buffer start page
write_creg(BNRY,rxstart); //initialize the boundary
write_creg(PSTOP,rxstop); //set receive buffer stop page
write_creg(CR,0x61); //stop NIC and change control register page
delay_ms(2);
write_creg(CURR,rxstart); //write NIC MAC (hardware) address
for(i=0;i<6;++i)
write_creg(PAR0+i, MYMAC[i]);
write_creg(CR,0xC1); //prepare to emulate 9346 EEPROM
write_creg(CR9346,0xC0);
write_creg(CR9346,0x40);
fakeout_9346(); //emulate the 9348
delay_ms(10);
write_creg(CR,0x21); //stop the NIC and go to home page
write_creg(DCR,dcrval); //set FIFO threshold, enable Send Packet Command,
write_creg(CR,0x22); //start NIC
write_creg(ISR,0xFF); //clear interrupts
write_creg(IMR,imrval); //unmask interrupts
write_creg(TCR,tcrval); //normal operation and enable CRC
}
发表时间:2002年10月22日15:44:00