but I cannot find the Initerrupt hanlder function work.
please help me? if anyone who have the source code of
dp8390 , please send me a copy. thanks!
1.my init dp8390 function is
Code: Select all
void Init_NIC()
{
unsigned char val;
unsigned int port,value;
int i;
port=CR;
val=0x21;
outportb(CR,val);
port=DCR;
val=0x49;
outportb(port,val);
val=0;
port=RBCR0;
outportb(port,val);
port=RBCR1;
outportb(port,val);
port=RCR;
val=0x1f;
outportb(port,val);
port=TCR;
val=0x02;
outportb(port,val);
port=PSTART;
val=0x4c;
outportb(port,val);
port=PSTOP;
val=0x80;
outportb(port,val);
port=BNRY;
val=0x4c;
outportb(port,val);
port=ISR;
val=0xff;
outportb(port,val);
port=IMR;
val=0xff;
outportb(port,val);
port=DCR;
val=0x49;
outportb(port,val);
port=RSAR0;
val=0;
outportb(port,val);
port=RSAR1;
outportb(port,val);
port=RBCR1;
outportb(port,val);
port=RBCR0;
val=20;
outportb(port,val);
port=CR;
val=0x61;
outportb(port,val);
port=PAR0;
for(i=0;i<6;i++)
{
outportb(port,local_logic_addr[i]);
port++;
}
port=MAR0;
for(i=0;i<8;i++)
{
outportb(port,0xff);
port++;
}
port=CURR;
val=0x4d;
next_pkt=val;
outportb(port,val);
port=CR;
val=0x22;
outportb(port,val);
port=TCR;
val=0;
outportb(port,val);
}
2. send_package funciotn is
Code: Select all
{
int port,i;
unsigned int data,len;
unsigned char val;
val=0x40;
port=RSAR1;
outportb(port,val);
val=0;
port=RSAR0;
outportb(port,val);
port=RBCR1;
outportb(port,val);
kprintf("%u\n",send_buf[12]);
if(length<46)
{
len=46;
}
else len=length;
len=len+14+1;
len=len&0xfffe;
val=len&0x00ff;
port=RBCR0;
outportb(port,val);
val=(len&0xff00)>>8;
port=RBCR1;
outportb(port,val);
val=0x12;
outportb(port,val);
len=length;
if(len<46)
len=46;
len=((len+1)>>1)+7;
port=data_port;
for(i=0;i<len;i++)
{
data=send_buf[2*i];
data=(data<<8)+send_buf[2*i+1];
outportb(port,data);
}
kprintf("send package 0\n");
while(Mark_INT!=0x88);
Mark_INT=0;
port=TPSR;
val=0x40;
outportb(port,val);
len=length;
port=TBCR0;
val=(len+14+1)&0x00fe;
outportb(port,val);
port=TBCR1;
val=((len+14+1)&0xff00)>>8;
outportb(port,val);
port=CR;
val=0x26; //0010 0110
outportb(port,val);
kprintf("send package 3\n");
while(Mark_INT!=0x88);
Mark_INT=0;
}
3.my interrupt handler function is
Code: Select all
void dp8390_handler()
{
kprintf("in Interrupt_Process\n");
__asm__ __volatile__(
"sti;
mov %1,%%dx;
mov %0,%%al;
out %%al,%%dx;
mov %2,%%dx;
in %%dx,%%al;
mov %%al,%3;
out %%al,%% dx;"::
"m"(Mark_INT),
"m"(IMR),"m"(ISR),"m"(is_reg)
);
if(is_reg&0x10)
{
Mark_PTX=0x88;
interrupt_send_count++;
}
if(is_reg&0x04) Mark_RXE=0x88;
if(is_reg&0x08) Mark_TXE=0x88;
if(is_reg&0x10) Mark_OVW=0x88;
if(is_reg&0x20) Mark_CNT=0x88;
if(is_reg&0x40) Mark_RDC=0x88;
__asm__ __volatile__(
"mov %0,%%dx;
mov $0xff,%%al;
out %%al,%%dx;
mov $0x20,%%al;
out %%al,$0x20;
cli;"::"m"(IMR)
);
kprintf("will return from Interrupt_Process\n");
}