📄 lan91c111end.c
字号:
}
/* Check to see if there is something to recieve */
DRV_LOG (DRV_DEBUG_INT, "lan91c111Int: IntrSts = %x\n",IntrSts, 2, 3, 4, 5, 6);
if(IntrSts & INT_EARLY_RX)
{
/*sysOutByte(IOBase + BANK2_INT_STS, INT_EARLY_RX);*/
SYS_IN_SHORT(IOBase + BANK2_INT_STS,&tempb);
tempb &= 0xff00;
tempb |= INT_EARLY_RX;
SYS_OUT_SHORT(IOBase + BANK2_INT_STS,tempb);
lan91c111Delay();
DRV_LOG (DRV_DEBUG_INT, "lan91c111Int: Early Receive",1, 2, 3, 4, 5, 6);
}
else if(IntrSts & INT_RX_CMP)/* start : RX_INT */
{
DRV_LOG (DRV_DEBUG_INT, " RX \n",1, 2, 3, 4, 5, 6);
/*
for(j= 0; j< 500; j++){}
Rve_Status=*(short *)(LAN91C111_BASE_ADDRESS+8);
Rve_count =*(short *)(LAN91C111_BASE_ADDRESS+8);
Des_add1 =*(short *)(LAN91C111_BASE_ADDRESS+8);
Des_add2 =*(short *)(LAN91C111_BASE_ADDRESS+8);
Des_add3 =*(short *)(LAN91C111_BASE_ADDRESS+8);
Sor_add1 =*(short *)(LAN91C111_BASE_ADDRESS+8);
Sor_add2 =*(short *)(LAN91C111_BASE_ADDRESS+8);
Sor_add3 =*(short *)(LAN91C111_BASE_ADDRESS+8);
Pak_protocal =*(short *)(LAN91C111_BASE_ADDRESS+8);
for(i=0;i<(Rve_count-20)/2;i++)
{
Rvebuff[i]=*(short *)(LAN91C111_BASE_ADDRESS+8);
}
Ctrl_Word =*(short *)(LAN91C111_BASE_ADDRESS+8);
*(short *)(LAN91C111_BASE_ADDRESS+0xe) =0x0002;
for(j= 0; j< 500; j++){}
*(short *)(LAN91C111_BASE_ADDRESS+0) =0x0080;
for(i=0;i<(Rve_count-6)/2;i++)
{
logMsg("num %d is %x\n",i,Rvebuff[i],0,0,0,0);
taskDelay(2);
}*/
SYS_IN_SHORT(IOBase + BANK2_FIFOS, &FifoPort);
while(!(FifoPort & FIFO_RX_EMPTY))
{
SYS_OUT_SHORT(PtrPort, (USHORT) (PTR_RCV | PTR_AUTO | PTR_READ));
Count = PTR_WAIT;
while(Count--)
SYS_IN_SHORT(PtrPort, (PUSHORT) &Pointer);
/*for(j= 0; j< 500; j++){} */
SYS_IN_SHORT(DataPort, (USHORT *) &PacketStatus);
SYS_IN_SHORT(DataPort, (USHORT *) &PacketRange);
DRV_LOG(DRV_DEBUG_RX," RX_DIR packetRange = %d\n",PacketRange,2,3,4,5,6);
PacketRange &= 0x7ff;
if(PacketStatus & RFS_LONG)
{
if((PacketRange - FRAME_OVERHEAD) <= MAX_FRAME_SIZE)
{
PacketStatus &= ~RFS_LONG;
}
else
{
DRV_LOG (DRV_DEBUG_ERR, "\nlan91c111Int: invalid length received\n",
1, 2, 3, 4, 5, 6);
END_ERR_ADD (&pDrvCtrl->endObj, MIB2_IN_ERRS, +1);
SYS_IN_SHORT(IOBase + BANK2_FIFOS, &FifoPort);
continue;
}
}
/* compute pRxWriteIndex_ahead to make sure there is room
* to queue packet
*/
if(pDrvCtrl->pRxWriteIndex < pDrvCtrl->pRxBase + RX_PACKETS - 1)
pRxWriteIndex_ahead = pDrvCtrl->pRxWriteIndex + 1;
else
pRxWriteIndex_ahead = pDrvCtrl->pRxBase;
if ((PacketStatus & RFS_ERROR) /* packet error */ ||
pRxWriteIndex_ahead == pDrvCtrl->pRxReadIndex /* queue full */)
{
if(PacketStatus & RFS_ALIGN)
;
if(PacketStatus & RFS_CRC)
;
SYS_OUT_SHORT(MmuPort, (USHORT) CMD_REM_REL_TOP);
do
{
SYS_IN_SHORT(MmuPort, (PUSHORT) &tempWord);
}while (tempWord & MMUCMD_BUSY);
DRV_LOG (DRV_DEBUG_ERR, "\nlan91c111Int: Alignment Err or CRC Err received\n",
1, 2, 3, 4, 5, 6);
END_ERR_ADD (&pDrvCtrl->endObj, MIB2_IN_ERRS, +1);
SYS_IN_SHORT(IOBase + BANK2_FIFOS, &FifoPort);
continue;
}
PacketRange -= FRAME_OVERHEAD;
/* => Pramod, Odd Byte, RevB */
if ((9 == Adapter->ChipID) && (1 == Adapter->ChipRev))
{
if (PacketStatus & RFS_ODD)
PacketRange++;
}
else
PacketRange++; /* for 91C111 Rev A bug for not identifying the ODD packets. */
/* <= Pramod, Odd Byte, RevB */
len = PacketRange;
/* queue is not full, so allocate buffer to store into queue */
if((pData = (UCHAR *) netClusterGet (pDrvCtrl->endObj.pNetPool,
pDrvCtrl->pClPoolId)) == NULL)
{
DRV_LOG (DRV_DEBUG_ERR, "\nlan91c111Int: Could not obtain cluster\n",
1, 2, 3, 4, 5, 6);
END_ERR_ADD (&pDrvCtrl->endObj, MIB2_IN_ERRS, +1);
SYS_OUT_SHORT(MmuPort, (USHORT) CMD_REM_REL_TOP);
do
{
SYS_IN_SHORT(MmuPort, (PUSHORT) &tempWord);
}while (tempWord & MMUCMD_BUSY);
/* goto lan91c111RxDone;*/
break;
}
usr_buf = ReadBuffer = pData + pDrvCtrl->offset;
for(i = 0; i < ((PacketRange + 3) >> 2); i++)
{
/* SYS_IN_LONG(DataPort, (ULONG *)( usr_buf + i*4));*/
SYS_IN_SHORT(DataPort, (USHORT *)( usr_buf + i*4));
SYS_IN_SHORT(DataPort, (USHORT *)( usr_buf + i*4 + 2));
}
#if 1
pDrvCtrl->pRxWriteIndex->len = len;
pDrvCtrl->pRxWriteIndex->pData = pData;
/* update indices */
if(pDrvCtrl->pRxWriteIndex < pDrvCtrl->pRxBase + RX_PACKETS - 1)
pDrvCtrl->pRxWriteIndex++;
else
pDrvCtrl->pRxWriteIndex = pDrvCtrl->pRxBase;
if (pDrvCtrl->rxHandling == FALSE)
{
pDrvCtrl->rxHandling = TRUE;
netJobAdd ((FUNCPTR)lan91c111HandleRcvInt, (int)pDrvCtrl,0,0,0,0);
DRV_LOG (DRV_DEBUG_ERR, "airoNetInt: add to tNetTask\n",
1, 2, 3, 4, 5, 6);
}
else
{
DRV_LOG (DRV_DEBUG_ERR, "airoNetInt: Could not add to tNetTask\n",
1, 2, 3, 4, 5, 6);
}
#endif
/*netJobAdd ((FUNCPTR)lan91c111Recv, (int)pDrvCtrl,pData,len,0,0);*/
SYS_OUT_SHORT(MmuPort, (USHORT) CMD_REM_REL_TOP);
do
{
SYS_IN_SHORT(MmuPort, (PUSHORT) &tempWord);
} while (tempWord & MMUCMD_BUSY);
{
DRV_LOG(DRV_DEBUG_RX," RX_DIR len = %d\n",len,2,3,4,5,6);
}
SYS_IN_SHORT(IOBase + BANK2_FIFOS, &FifoPort);
} /* End While */
} /* done : RX_INT */
else if(IntrSts & INT_TX_CMP) /* start : TX_INT */
{
DRV_LOG (DRV_DEBUG_INT, " TX \n",
1, 2, 3, 4, 5, 6);
SYS_IN_SHORT( IOBase + BANK2_FIFOS, &tempWord );
PacketNumber = (CHAR)LOBYTE(tempWord);
SYS_OUT_SHORT(IOBase + BANK2_PNR, (USHORT) PacketNumber);
/*
* Retrieve packet status and range.
*
*/
SYS_OUT_SHORT(IOBase + BANK2_PTR, (USHORT) (PTR_AUTO | PTR_READ));
Count = PTR_WAIT;
while(Count--)
SYS_IN_SHORT((IOBase + BANK2_PTR), (PUSHORT) &Pointer);
SYS_IN_SHORT(IOBase + BANK2_DATA1, (PUSHORT) &PacketStatus);
SYS_OUT_SHORT(IOBase + BANK2_MMU_CMD, (USHORT) CMD_REL_SPEC);
/*sysOutByte(IOBase + BANK2_INT_STS, INT_TX_CMP);*/
SYS_IN_SHORT(IOBase + BANK2_INT_STS,&tempb);
tempb &= 0xff00;
tempb |= INT_TX_CMP;
SYS_OUT_SHORT(IOBase + BANK2_INT_STS,tempb);
lan91c111Delay();
if(pDrvCtrl->pTxReadIndex->pMblk != NULL)
netJobAdd ((FUNCPTR)lan91c111Send,(int)pDrvCtrl,0,0,0,0);
/*
* Update statistics.
*
*/
if(PacketStatus & TFS_ERROR)
{
/*
* Lost carrier status be set when doing HCT test, that cause few
* items testing failed.
*/
;
if (!pDrvCtrl->errorHandling)
if (netJobAdd ((FUNCPTR) lan91c111HandleError, (int) pDrvCtrl,PacketStatus, 3, 4, 5) == OK)
pDrvCtrl->errorHandling = TRUE;
}
else
{
if(PacketStatus & TFS_BCAST)
{
}
else if(PacketStatus & TFS_MCAST)
{
}
else
{
}
if(PacketStatus & TFS_DEFER)
;
if(PacketStatus & TFS_MULTICOL)
;
if(PacketStatus & TFS_1COL)
;
}
} /* done : TX_INT */
else if(IntrSts & INT_ALLOC) /* start : ALLOC_INT */
{
if(Adapter->AllocPending == TRUE)
{
DRV_LOG (DRV_DEBUG_INT, " ALLOC_INT ",
1, 2, 3, 4, 5, 6);
Adapter->AllocPending = FALSE;
netJobAdd ((FUNCPTR) lan91c111Send, (int) pDrvCtrl,1,0,0,0);
}
/*-----------------3/15/01 3:51PM-------------------
* Acknowledge of ALLOC Interrupt is not possible
* --------------------------------------------------*/
/* SYS_OUT_SHORT(Adapter->IOBase + BANK2_INT_STS, INT_ALLOC);*/
SYS_OUT_SHORT(Adapter->IOBase + BANK_SELECT, 2);
SYS_IN_SHORT(Adapter->IOBase + BANK2_INT_STS, &tempWord);
/* 0xff00 would keep the higher byte as it is and the lower
byte will be made zero. This is what we need as we will
be touching the Int Ack Register which will not be modified
if written with a zero */
/* We are disabling Alloc Int now */
tempWord = tempWord & ((~((USHORT)(INT_ALLOC)))<<8);
SYS_OUT_SHORT(Adapter->IOBase + BANK2_INT_STS, tempWord);
} /* done : ALLOC_INT */
else if (IntrSts & INT_EPH_INT) /* start : EPHINT */
{
/* LE Enable and TXENA code that follows is taken from
AdapterEnableTransmitter() */
SYS_OUT_SHORT(Adapter->IOBase + BANK_SELECT, 1 );
SYS_IN_SHORT(Adapter->IOBase + BANK1_CTL, &tempWord );
tempWord &= ~CTL_LE_EN;
SYS_OUT_SHORT(Adapter->IOBase + BANK1_CTL, tempWord);
tempWord |= CTL_LE_EN;
SYS_OUT_SHORT(Adapter->IOBase + BANK1_CTL, tempWord);
SYS_OUT_SHORT(Adapter->IOBase + BANK_SELECT, 0 );
/* Enable Transmitter as it would have been shut off because of Tx Errors */
SYS_IN_SHORT(Adapter->IOBase + BANK0_TCR, (PUSHORT) &tempWord);
tempWord |= TCR_TX_ENA;
SYS_OUT_SHORT(Adapter->IOBase + BANK0_TCR, tempWord);
SYS_IN_SHORT(Adapter->IOBase + BANK0_STS, (PUSHORT) &EphStatus);
Adapter->EphStatus = EphStatus;
/*
* Count for statistics.
*
*/
DRV_LOG (DRV_DEBUG_INT, "EPH INT :EPH Status = %x\n",EphStatus, 2, 3, 4, 5, 6);
if( Adapter->EphStatus & TFS_UNDERRUN )
{
SYS_OUT_SHORT(Adapter->IOBase + BANK_SELECT, (USHORT) 2 );
if( Adapter->TxUnderRunFixed )
Adapter->TxUnderRunFixed = FALSE;
else
{
SYS_OUT_SHORT(Adapter->IOBase + BANK2_MMU_CMD, (USHORT) CMD_ENQ_TX);
Adapter->TxUnderRunFixed = TRUE;
}
Adapter->ETxThrshInc += ThresholdIncreament;
Adapter->EarlyTxThreshold = Adapter->ETxThrshInc + Adapter->ETxThrshBase;
}
/*
if(Adapter->EphStatus & TFS_16COL)
Adapter->MaximumCollisions++;
if(Adapter->EphStatus & TFS_SQET)
Adapter->SqetErrors++;
*/ /* <- This will be done at TX_INT */
if(Adapter->LinkStatusChange != (Adapter->EphStatus & TFS_LINKERROR))
{
if(Adapter->EphStatus & TFS_LINKERROR)
{
Adapter->LinkChange = MEDIA_CONNECT;
DRV_LOG (DRV_DEBUG_INT, "\nEPH Int : Link OK Transition : MEDIA_CONNECT %x\n",
1, 2, 3, 4, 5, 6);
}
else
{
Adapter->LinkChange = MEDIA_DISCONNECT;
DRV_LOG (DRV_DEBUG_INT, "\nEPH Int : Link OK Transition : MEDIA_DISCONNECT %x\n",
1, 2, 3, 4, 5, 6);
}
Adapter->LinkStatusChange = Adapter->EphStatus & TFS_LINKERROR;
}
} /* done : EPHINT */
else if(IntrSts & INT_MDINT) /* start : MDINT */
{
USHORT ledValue = 0;
SYS_OUT_SHORT(Adapter->IOBase + BANK_SELECT, 2);
/*SYS_OUT_SHORT(Adapter->IOBase + BANK2_INT_STS, INT_MDINT);*/
/*sysOutByte(Adapter->IOBase + BANK2_INT_STS, INT_MDINT);*/
SYS_IN_SHORT(Adapter->IOBase + BANK2_INT_STS,&tempb);
tempb &= 0xff00;
tempb |= INT_MDINT;
SYS_OUT_SHORT(Adapter->IOBase + BANK2_INT_STS,tempb);
lan91c111Delay();
DefaultVal = ReadPhyRegister( (USHORT)Adapter->IOBase,
(UCHAR)Adapter->TempPhyAddr, PHY_STATUS_OUTPUT );
DRV_LOG (DRV_DEBUG_INT, "MD Int : Link Detect : Phy Status Register %x\n",DefaultVal , 2, 3, 4, 5, 6);
/* DefaultVal = DefaultVal & 0x8000;*/
if(DefaultVal & 0x8000)
{
if(Adapter->LinkChange == MEDIA_DISCONNECT)
{
Adapter->LinkChange = MEDIA_CONNECT;
if(DefaultVal & 0x80)
{
Adapter->Speed100 = SPEED100;
ledValue =0x0000;
}
else
{
Adapter->Speed100 = SPEED10;
ledValue=0x0020;
}
if(DefaultVal & 0x40)
{
Adapter->Duplex = FULL_DUPLEX;
ledValue |= 0x0000;
}
else
{
Adapter->Duplex = HALF_DUPLEX;
ledValue |= 0x0004;
}
SYS_OUT_SHORT(Adapter->IOBase + BANK_SELECT, 0);
SYS_IN_SHORT(Adapter->IOBase + BANK0_RPCR,&DefaultVal);
SYS_OUT_SHORT(Adapter->IOBase + BANK0_RPCR,((DefaultVal & 0xff00) | ledValue) );
netJobAdd ((FUNCPTR) AdapterReset, (int) pDrvCtrl,0,0,0,0);
DRV_LOG (DRV_DEBUG_INT, "\nMD Int : Link Detect : MEDIA_CONNECT\n",
1, 2, 3, 4, 5, 6);
}
else
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -