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

* 12700: 硬件:请教斑竹8019

   dws457 
dws457发表的帖子 

 硬件:请教斑竹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

  
回复该帖

本主题共有 4 帖,分页:>>>>>该主题的所有内容[4]条

 *树形目录 只列出部分跟帖的标题以及简单的摘要信息 该主题的部分跟帖如下:

  12722.[详细]斑竹应该是这方面的高手
摘要:......(无内容)
- [wucang_deng][1305次] 2002年10月23日

  12750.[详细]古先生为什末不回应
摘要:......(无内容)
- [dws457][1030次] 2002年10月23日

  12843.[详细]急、加急..大家帮帮忙萨!!
摘要: ......(1字)
- [dws457][1195次] 2002年10月24日

[上一篇帖子]:硬件:哪有TMS29F040 FLASH的编程示例程序和使用方法`,参考一下哪有TMS29
[下一篇帖子]:硬件:about RTL8019我在初始化RTL8019时,发现CR控制,不能丛PAGE0