晶振是12M的,MCU用的是ADuC831,p0接了RTL8019的SD7~0,p2的4~0接了RTL的SA4~0,p2的7接了SA8,p3的5接了RTL8019的reset。跑如下代码的时候:
#define reg00 XBYTE[0x8000] #define reg01 XBYTE[0x8100] #define reg02 XBYTE[0x8200] #define reg03 XBYTE[0x8300] #define reg04 XBYTE[0x8400] #define reg05 XBYTE[0x8500] #define reg06 XBYTE[0x8600] #define reg07 XBYTE[0x8700] #define reg08 XBYTE[0x8800] #define reg09 XBYTE[0x8900] #define reg0a XBYTE[0x8a00] #define reg0b XBYTE[0x8b00] #define reg0c XBYTE[0x8c00] #define reg0d XBYTE[0x8d00] #define reg0e XBYTE[0x8e00] #define reg0f XBYTE[0x8f00] #define reg10 XBYTE[0x9000] #define reg1f XBYTE[0x9f00]
...
... void etherdev_send() { write_dma(0x4000, uip_len); if(uip_len < 0x3c) { uip_len = 0x3c; } reg04 = 0x40;// reg05 = (unsigned char)(uip_len & 0xFF);// reg06 = (unsigned char)(uip_len >> 8);// reg00 = 0x26; return; }
void write_dma(unsigned int address,unsigned int count)//写网卡的ram {//address为要写入到网卡里的ram的起始地址,count为要连续写入的字节数 uint data i; uchar temp; page(0); reg09=address >> 8;//address high reg08=address&0xff;//address low reg0b=count>>8; //write count high reg0a=count&0xff;//write count low reg00=0x12 ;//dma write
for(i=0;i<count;i++) { reg10=uip_buf; } // while(1) // { // temp = reg07; // if((temp&0x40) == 0x40) // break; // } reg00=0x22;//abort/complete dma page 0 }
为什么DMA写入的时候会卡死呀?怎么回事呀? 帮忙看看
|