Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/29/05 15:08
Read: times


 
#104362 - Source code for RTL8019AS initialzation
Responding to: ???'s previous message



Before calling init_NIC i have initialized the UART and also male RST_NIC=0


void init_nic()
{
char i=0;
RST_NIC=1;

delay();
delay();
//IOCS16=0;
RST_NIC=0;



//outport(CR,0xC1);
//outport(CR9346,0xC0);
//outport(CR9346,0x40);



send_str(msg2);
chgline();
outport(CR, 0x21); // selecting page zero and REMOTE DMA write
//for(i=0;i<=255;i++);
//for(i=0;i<=255;i++);
delay();
delay();
outport(NIC_RESET, 0xFF); // Reset the NIC
delay();
delay();
i=inport(ISR);
if(!(0x80&i))
{
send_str(msg8);
chgline();
while(1);

}
outport(DCR, 0x58);
outport(RBCR0, 0x00);
outport(RBCR1, 0x00);

outport(RCR, 0x04); // packet with mutlticast and broadcast address will be accepted
// physical address of the destination address must match with it
// packet with error are rejected
// packet less than 64 byte are not accepted

outport(TPSR,0x40);

outport(TCR, 0x02); // CRC checker and generator is enabled and internal loopback is on

outport(BNDRY, 0x46);
outport(PSTART, 0x46); // initializing recieving buffer ring
outport(PSTOP, 0x60); // Recieve buffer ends here and transmit buffer start here


outport(ISR, 0xFF); // Clearing all the interrupt status
outport(IMR, 0x00); // all the interrupts are masked

outport(CR, 0x61); // selecting page 1
delay();
outport(CURR,0x46); // points to 1st recieved packet
//for(i=0;i<=255;i++);
//for(i=0;i<=255;i++);
delay();
send_str(msg3);
chgline();
for (i=0;i<6;i++)
outport(PAR0+i,physical_address[i]); // writing physical address in the par0-5 registers for comparision of the incoming packets destincation address
// if the physical address doesnt match with the value then the packet will be discard
outport(CR,0xC1);
outport(CR9346,0xC0);
outport(CR9346,0x40);
delay();
delay();

outport(CR, 0x21);
outport(DCR, 0x58);


outport(CR, 0x22); // end the DMA or aborting the DMA// and start the LAN card
outport(ISR, 0xff);
outport(IMR, 0x11);
outport(TCR, 0x00);

}



//******************************************************************
//* Write NIC Control Register
//******************************************************************

void outport(unsigned int regaddr, char regdata)
{
XBYTE[0x8000+regaddr] = regdata;

}
//******************************************************************
//* Read From NIC Control Register
//******************************************************************
char inport(unsigned int regaddr)
{
char a;
a=XBYTE[0x8000+regaddr];
return a;

}



I have also removed the latch from the P0 and pull-up P0 with 4.7K resister array
changed my inport and outport function




void outport(unsigned int regaddr, char regdata)
{
char j=0;
P2=regaddr;
P0=regdata;
RD=1;
WR=0;
for(j=0;j<=200;j++);
RD=1;
WR=1;
}

char inport(unsigned int regaddr)
{

char j=0;
P2=regaddr;
P0=255;
WR=1;
RD=0;
for(j=0;j<=200;j++);
j=P0;
RD=1;
WR=1;
return j;





}

List of 5 messages in thread
TopicAuthorDate
Problem Interfacing RTL8019AS            01/01/70 00:00      
   RST line            01/01/70 00:00      
      RST line            01/01/70 00:00      
         Source            01/01/70 00:00      
            Source code for RTL8019AS initialzation            01/01/70 00:00      

Back to Subject List