📄 lan91c111end.c
字号:
PacketRange++;
}
else
PacketRange++; /* for 91C111 Rev A bug for not identifying the ODD packets. */
/* <= Pramod, Odd Byte, RevB */
len = PacketRange;
DRV_LOG (DRV_DEBUG_RX, "\queue is not full,\n",1,2,3,4,5,6);
/* 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;
}
else
{
DRV_LOG (DRV_DEBUG_RX, "\netClusterGet ok,\n",1,2,3,4,5,6);
}
usr_buf = ReadBuffer = pData + pDrvCtrl->offset;/*需要偏移么*/
for(i = 0; i < ((PacketRange + 1) >> 1); i++)
{
SYS_IN_SHORT(DataPort, (USHORT *)( usr_buf + i*2));
}
/*
DRV_LOG (DRV_DEBUG_RX, "usr_buf=0x%x\n",usr_buf,2,3,4,5,6);
for(i = 0; i < ((PacketRange + 3) >> 2); i++)
{
SYS_IN_LONG(DataPort, (ULONG *)( usr_buf + i*4));
}
logMsg ( "&&&&&&&&&&&&&RX length=0x%x&&&&&&&&&&&&&\n",len,2,3,4,5,6);
for(i=0;i<len;)
{
if((len-i)>1)
{
DRV_LOG (DRV_DEBUG_RX, "%02x%02x ",*((UCHAR*)usr_buf+i),*((UCHAR*)usr_buf+i+1),3,4,5,6);
i+=2;
}
else if((len-i)==1)
{
DRV_LOG (DRV_DEBUG_RX, "%02x ",*((UCHAR*)usr_buf+i),2,3,4,5,6);
i+=1;
}
else if((len-i)==0)
{
;
}
}
*/
#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);
}
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);
SYS_IN_SHORT(IOBase + BANK2_FIFOS, &FifoPort);
} /* End While */
DRV_LOG(DRV_DEBUG_RX,"*************end rx int *************\n",1,2,3,4,5,6);
} /* done : RX_INT */
else if(IntrSts & INT_TX_CMP) /* start : TX_INT */
{
DRV_LOG(DRV_DEBUG_TX,"!!!!!!!!!!!!!!!START tx int!!!!!!!!!!!!!!!!\n\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);lan91c111Delay();lan91c111Delay();lan91c111Delay();lan91c111Delay();
if(pDrvCtrl->pTxReadIndex->pMblk != NULL)
netJobAdd ((FUNCPTR)lan91c111Send,(int)pDrvCtrl,0,0,0,0);
/*
* Update statistics.
*
*/
if(PacketStatus & TFS_ERROR)
{
DRV_LOG(DRV_DEBUG_TX,"#########end tx int###########\n\n",1,2,3,4,5,6);
/*
* 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)
{
DRV_LOG(DRV_DEBUG_RX,"send int TFS_BCAST\n",1,2,3,4,5,6);
}
else if(PacketStatus & TFS_MCAST)
{
DRV_LOG(DRV_DEBUG_RX,"send int TFS_MCAST\n",1,2,3,4,5,6);
}
else
{
;;
}
if(PacketStatus & TFS_DEFER)
DRV_LOG(DRV_DEBUG_RX,"send int TFS_DEFER\n",1,2,3,4,5,6);
if(PacketStatus & TFS_MULTICOL)
DRV_LOG(DRV_DEBUG_RX,"send int TFS_MULTICOL\n",1,2,3,4,5,6);
if(PacketStatus & TFS_1COL)
DRV_LOG(DRV_DEBUG_RX,"send int TFS_1COL\n",1,2,3,4,5,6);
}
DRV_LOG(DRV_DEBUG_TX,"!!!!!!!!!!!!!!!end tx int!!!!!!!!!!!!!!!!\n\n",1,2,3,4,5,6);
} /* done : TX_INT */
else if(IntrSts & INT_ALLOC) /* start : ALLOC_INT */
{
DRV_LOG(DRV_DEBUG_TX,"@@@@@@@@@@@@@ START ALLOC_INT tx int@@@@@@@@@@@@@@@@@@@\n",1,2,3,4,5,6);
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);
DRV_LOG(DRV_DEBUG_TX,"@@@@@@@@@@@@@ END ALLOC_INT tx int@@@@@@@@@@@@@@@@@@@\n",1,2,3,4,5,6);
} /* 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);lan91c111Delay();
DefaultVal = ReadPhyRegister( (UINT)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
{
Adapter->LinkChange = MEDIA_DISCONNECT;
DRV_LOG (DRV_DEBUG_INT, "\nMD Int : Link Detect : MEDIA_DISCONNECT \n",
1, 2, 3, 4, 5, 6);
}
}
else
{
if(Adapter->LinkChange == MEDIA_DISCONNECT)
Adapter->LinkChange = MEDIA_DISCONNECT;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -