我用的是s3c44b0,因为板子上与8019的地址线连接有错位,所以稍微修改了ne2000End.h,然后在syslib.c中添加了sysInbyte,sysOutbyte,sysInstring和sysOutstring这个几个函数的定义,就修改了这么多,都是参照Amine的,代码如下,请高手们帮我看看:
1) ne2000End.h中,因为44b0地址线与8019错开一位,44b0的ADRS1->8019的SA0,所以所有8019的寄存器地址左移一位,
#define NE2000_BASE ((volatile unsigned char *)(0x06000600))/*这是我的8019的开始地址*/
#define NEADDR(addr) (addr<<1)
2) ne2000End.c中就用了上面定义的NEADDR(addr),其他没有改动。
3) sysLib.c中添加了8019的初始化代码和上面提到的四个函数实现:
static void rtl8019_init(void)
{
UCHAR regVal;
/* Entering Page 0 */
*(NE2000_BASE + ENE_CMD) = CMD_STOP | CMD_PAGE0;
/* 1st: Reset the rtl8019as */
*(NE2000_BASE + ENE_RESET) = *(NE2000_BASE + ENE_RESET);
loopDelay(500);
/* 2nd: Polling INTSTAT\'s ISTAT_RST bit, if it is 1, then reset success, quit the loop */
regVal = *(NE2000_BASE + ENE_INTSTAT);
while ( (regVal & ISTAT_RST) == 0){}
/* i) Entering Page 3 */
*(NE2000_BASE + ENE_CMD) = CMD_STOP | CMD_PAGE3;
/* ii) Set CONFIGx */
*(NE2000_BASE + ENE_9346CR) = 0xCF;
/* iii) CONFIG1: IRQEN, IRQ = INT0, Select I/O = 300H */
*(NE2000_BASE + ENE_CONFIG1) = 0x80;
/* iv) CONFIG2 = 0 */
*(NE2000_BASE + ENE_CONFIG2) = 0x00;
/* v) CONFIG3: Disable PnP, Full-Duplex, and LEDs */
*(NE2000_BASE + ENE_CONFIG3) = 0x50;
/* vi) Disable write to CONFIGx */
*(NE2000_BASE + ENE_9346CR) = 0x0F;
}
unsigned char sysInByte (unsigned long port)
{
return (REG8(port));
}
void sysOutByte (unsigned long port, unsigned char data)
{
REG8(port) = data;
}
void sysInWordString (unsigned long port, unsigned short *pData, int count)
{
int i, byte_count; char *pbyte;
pbyte = (char *)pData;
byte_count = count*2;
for(i=0; i<byte_count; i++){
*(pbyte) = REG8(port);
pbyte++;
}
}
void sysOutWordString(unsigned long port, unsigned short *pData, int count)
{
int i, byte_count; char *pbyte;
pbyte = (char *)pData;
byte_count = count*2;
for(i=0; i<byte_count; i++){
REG8(port) = *(pbyte);
pbyte++;
}
}
其他的都没有修改,问题大概都出在上面的这些代码里喽?
还有我在configNet.h里是这样定义的:
IMPORT END_OBJ * ne2000EndLoad (char *, void *);
END_TBL_ENTRY endDevTbl [] =
{
#ifdef INCLUDE_NE2000_END
{ 0, ne2000EndLoad, "0x06000600:0x18:0x18:1:0:2", 1, NULL, FALSE },
#endif /* INCLUDE_NE2000_END */
#ifdef INCLUDE_SNGKS32C_END
{ 0, SBCARM7_LOAD_FUNC_0, SBCARM7_LOAD_STRING_0, SBCARM7_LOAN , NULL, FALSE},
#endif /* INCLUDE_SNGKS32C_END */
#ifdef INCLUDE_SNGKS32C_HDLC_END
{ 1, SBCARM7_LOAD_FUNC_1, SBCARM7_LOAD_STRING_1, SBCARM7_LOAN , NULL, FALSE},
{ 2, SBCARM7_LOAD_FUNC_2, SBCARM7_LOAD_STRING_2, SBCARM7_LOAN , NULL, FALSE},
#endif /* INCLUDE_SNGKS32C_HDLC_END */
{ 0, END_TBL_END, NULL, 0, NULL, FALSE},
};