导航: 老古网老古论坛XMOS公共讨论区XMOS开源项目区单片机程序设计嵌入式系统广告区域
→硬件:请教斑竹8019[dws457]

 *第5643篇: 硬件:请教斑竹8019

  
楼 主:dws457 2002年10月22日15:44
 硬件:请教斑竹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 
}

  
2楼:wucang_deng 2002年10月23日09:16
 斑竹应该是这方面的高手
  
3楼:dws457 2002年10月23日13:36
 古先生为什末不回应
  
4楼:dws457 2002年10月24日17:39
 急、加急..大家帮帮忙萨!!
 

>>>>>>对该主题发表你的看法

本主题贴数4,分页: [第1页]


[上一篇主题]:硬件:哪有TMS29F040 FLASH的编程示例程序和使用方法`,参考一下

[下一篇主题]:硬件:about RTL8019