Commit c3504bfd authored by Joe Perches's avatar Joe Perches Committed by Greg Kroah-Hartman

staging:vt6655:mac: Whitespace cleanups

Neatening only.
git diff -w shows no differences.
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d82adcab
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
unsigned short TxRate_iwconfig;//2008-5-8 <add> by chester unsigned short TxRate_iwconfig;//2008-5-8 <add> by chester
/*--------------------- Static Definitions -------------------------*/ /*--------------------- Static Definitions -------------------------*/
//static int msglevel =MSG_LEVEL_DEBUG; //static int msglevel =MSG_LEVEL_DEBUG;
static int msglevel =MSG_LEVEL_INFO; static int msglevel = MSG_LEVEL_INFO;
/*--------------------- Static Classes ----------------------------*/ /*--------------------- Static Classes ----------------------------*/
/*--------------------- Static Variables --------------------------*/ /*--------------------- Static Variables --------------------------*/
...@@ -103,25 +103,25 @@ static int msglevel =MSG_LEVEL_INFO; ...@@ -103,25 +103,25 @@ static int msglevel =MSG_LEVEL_INFO;
* Return Value: none * Return Value: none
* *
*/ */
void MACvReadAllRegs (unsigned long dwIoBase, unsigned char *pbyMacRegs) void MACvReadAllRegs(unsigned long dwIoBase, unsigned char *pbyMacRegs)
{ {
int ii; int ii;
// read page0 register // read page0 register
for (ii = 0; ii < MAC_MAX_CONTEXT_SIZE_PAGE0; ii++) { for (ii = 0; ii < MAC_MAX_CONTEXT_SIZE_PAGE0; ii++) {
VNSvInPortB(dwIoBase + ii, pbyMacRegs); VNSvInPortB(dwIoBase + ii, pbyMacRegs);
pbyMacRegs++; pbyMacRegs++;
} }
MACvSelectPage1(dwIoBase); MACvSelectPage1(dwIoBase);
// read page1 register // read page1 register
for (ii = 0; ii < MAC_MAX_CONTEXT_SIZE_PAGE1; ii++) { for (ii = 0; ii < MAC_MAX_CONTEXT_SIZE_PAGE1; ii++) {
VNSvInPortB(dwIoBase + ii, pbyMacRegs); VNSvInPortB(dwIoBase + ii, pbyMacRegs);
pbyMacRegs++; pbyMacRegs++;
} }
MACvSelectPage0(dwIoBase); MACvSelectPage0(dwIoBase);
} }
...@@ -140,12 +140,12 @@ void MACvReadAllRegs (unsigned long dwIoBase, unsigned char *pbyMacRegs) ...@@ -140,12 +140,12 @@ void MACvReadAllRegs (unsigned long dwIoBase, unsigned char *pbyMacRegs)
* Return Value: true if all test bits On; otherwise false * Return Value: true if all test bits On; otherwise false
* *
*/ */
bool MACbIsRegBitsOn (unsigned long dwIoBase, unsigned char byRegOfs, unsigned char byTestBits) bool MACbIsRegBitsOn(unsigned long dwIoBase, unsigned char byRegOfs, unsigned char byTestBits)
{ {
unsigned char byData; unsigned char byData;
VNSvInPortB(dwIoBase + byRegOfs, &byData); VNSvInPortB(dwIoBase + byRegOfs, &byData);
return (byData & byTestBits) == byTestBits; return (byData & byTestBits) == byTestBits;
} }
/* /*
...@@ -163,12 +163,12 @@ bool MACbIsRegBitsOn (unsigned long dwIoBase, unsigned char byRegOfs, unsigned c ...@@ -163,12 +163,12 @@ bool MACbIsRegBitsOn (unsigned long dwIoBase, unsigned char byRegOfs, unsigned c
* Return Value: true if all test bits Off; otherwise false * Return Value: true if all test bits Off; otherwise false
* *
*/ */
bool MACbIsRegBitsOff (unsigned long dwIoBase, unsigned char byRegOfs, unsigned char byTestBits) bool MACbIsRegBitsOff(unsigned long dwIoBase, unsigned char byRegOfs, unsigned char byTestBits)
{ {
unsigned char byData; unsigned char byData;
VNSvInPortB(dwIoBase + byRegOfs, &byData); VNSvInPortB(dwIoBase + byRegOfs, &byData);
return !(byData & byTestBits); return !(byData & byTestBits);
} }
/* /*
...@@ -184,15 +184,15 @@ bool MACbIsRegBitsOff (unsigned long dwIoBase, unsigned char byRegOfs, unsigned ...@@ -184,15 +184,15 @@ bool MACbIsRegBitsOff (unsigned long dwIoBase, unsigned char byRegOfs, unsigned
* Return Value: true if interrupt is disable; otherwise false * Return Value: true if interrupt is disable; otherwise false
* *
*/ */
bool MACbIsIntDisable (unsigned long dwIoBase) bool MACbIsIntDisable(unsigned long dwIoBase)
{ {
unsigned long dwData; unsigned long dwData;
VNSvInPortD(dwIoBase + MAC_REG_IMR, &dwData); VNSvInPortD(dwIoBase + MAC_REG_IMR, &dwData);
if (dwData != 0) if (dwData != 0)
return false; return false;
return true; return true;
} }
/* /*
...@@ -209,14 +209,14 @@ bool MACbIsIntDisable (unsigned long dwIoBase) ...@@ -209,14 +209,14 @@ bool MACbIsIntDisable (unsigned long dwIoBase)
* Return Value: Mask Value read * Return Value: Mask Value read
* *
*/ */
unsigned char MACbyReadMultiAddr (unsigned long dwIoBase, unsigned int uByteIdx) unsigned char MACbyReadMultiAddr(unsigned long dwIoBase, unsigned int uByteIdx)
{ {
unsigned char byData; unsigned char byData;
MACvSelectPage1(dwIoBase); MACvSelectPage1(dwIoBase);
VNSvInPortB(dwIoBase + MAC_REG_MAR0 + uByteIdx, &byData); VNSvInPortB(dwIoBase + MAC_REG_MAR0 + uByteIdx, &byData);
MACvSelectPage0(dwIoBase); MACvSelectPage0(dwIoBase);
return byData; return byData;
} }
/* /*
...@@ -234,11 +234,11 @@ unsigned char MACbyReadMultiAddr (unsigned long dwIoBase, unsigned int uByteIdx) ...@@ -234,11 +234,11 @@ unsigned char MACbyReadMultiAddr (unsigned long dwIoBase, unsigned int uByteIdx)
* Return Value: none * Return Value: none
* *
*/ */
void MACvWriteMultiAddr (unsigned long dwIoBase, unsigned int uByteIdx, unsigned char byData) void MACvWriteMultiAddr(unsigned long dwIoBase, unsigned int uByteIdx, unsigned char byData)
{ {
MACvSelectPage1(dwIoBase); MACvSelectPage1(dwIoBase);
VNSvOutPortB(dwIoBase + MAC_REG_MAR0 + uByteIdx, byData); VNSvOutPortB(dwIoBase + MAC_REG_MAR0 + uByteIdx, byData);
MACvSelectPage0(dwIoBase); MACvSelectPage0(dwIoBase);
} }
/* /*
...@@ -255,21 +255,21 @@ void MACvWriteMultiAddr (unsigned long dwIoBase, unsigned int uByteIdx, unsigned ...@@ -255,21 +255,21 @@ void MACvWriteMultiAddr (unsigned long dwIoBase, unsigned int uByteIdx, unsigned
* Return Value: none * Return Value: none
* *
*/ */
void MACvSetMultiAddrByHash (unsigned long dwIoBase, unsigned char byHashIdx) void MACvSetMultiAddrByHash(unsigned long dwIoBase, unsigned char byHashIdx)
{ {
unsigned int uByteIdx; unsigned int uByteIdx;
unsigned char byBitMask; unsigned char byBitMask;
unsigned char byOrgValue; unsigned char byOrgValue;
// calculate byte position // calculate byte position
uByteIdx = byHashIdx / 8; uByteIdx = byHashIdx / 8;
ASSERT(uByteIdx < 8); ASSERT(uByteIdx < 8);
// calculate bit position // calculate bit position
byBitMask = 1; byBitMask = 1;
byBitMask <<= (byHashIdx % 8); byBitMask <<= (byHashIdx % 8);
// turn on the bit // turn on the bit
byOrgValue = MACbyReadMultiAddr(dwIoBase, uByteIdx); byOrgValue = MACbyReadMultiAddr(dwIoBase, uByteIdx);
MACvWriteMultiAddr(dwIoBase, uByteIdx, (unsigned char)(byOrgValue | byBitMask)); MACvWriteMultiAddr(dwIoBase, uByteIdx, (unsigned char)(byOrgValue | byBitMask));
} }
/* /*
...@@ -286,21 +286,21 @@ void MACvSetMultiAddrByHash (unsigned long dwIoBase, unsigned char byHashIdx) ...@@ -286,21 +286,21 @@ void MACvSetMultiAddrByHash (unsigned long dwIoBase, unsigned char byHashIdx)
* Return Value: none * Return Value: none
* *
*/ */
void MACvResetMultiAddrByHash (unsigned long dwIoBase, unsigned char byHashIdx) void MACvResetMultiAddrByHash(unsigned long dwIoBase, unsigned char byHashIdx)
{ {
unsigned int uByteIdx; unsigned int uByteIdx;
unsigned char byBitMask; unsigned char byBitMask;
unsigned char byOrgValue; unsigned char byOrgValue;
// calculate byte position // calculate byte position
uByteIdx = byHashIdx / 8; uByteIdx = byHashIdx / 8;
ASSERT(uByteIdx < 8); ASSERT(uByteIdx < 8);
// calculate bit position // calculate bit position
byBitMask = 1; byBitMask = 1;
byBitMask <<= (byHashIdx % 8); byBitMask <<= (byHashIdx % 8);
// turn off the bit // turn off the bit
byOrgValue = MACbyReadMultiAddr(dwIoBase, uByteIdx); byOrgValue = MACbyReadMultiAddr(dwIoBase, uByteIdx);
MACvWriteMultiAddr(dwIoBase, uByteIdx, (unsigned char)(byOrgValue & (~byBitMask))); MACvWriteMultiAddr(dwIoBase, uByteIdx, (unsigned char)(byOrgValue & (~byBitMask)));
} }
/* /*
...@@ -317,16 +317,16 @@ void MACvResetMultiAddrByHash (unsigned long dwIoBase, unsigned char byHashIdx) ...@@ -317,16 +317,16 @@ void MACvResetMultiAddrByHash (unsigned long dwIoBase, unsigned char byHashIdx)
* Return Value: none * Return Value: none
* *
*/ */
void MACvSetRxThreshold (unsigned long dwIoBase, unsigned char byThreshold) void MACvSetRxThreshold(unsigned long dwIoBase, unsigned char byThreshold)
{ {
unsigned char byOrgValue; unsigned char byOrgValue;
ASSERT(byThreshold < 4); ASSERT(byThreshold < 4);
// set FCR0 // set FCR0
VNSvInPortB(dwIoBase + MAC_REG_FCR0, &byOrgValue); VNSvInPortB(dwIoBase + MAC_REG_FCR0, &byOrgValue);
byOrgValue = (byOrgValue & 0xCF) | (byThreshold << 4); byOrgValue = (byOrgValue & 0xCF) | (byThreshold << 4);
VNSvOutPortB(dwIoBase + MAC_REG_FCR0, byOrgValue); VNSvOutPortB(dwIoBase + MAC_REG_FCR0, byOrgValue);
} }
/* /*
...@@ -342,11 +342,11 @@ void MACvSetRxThreshold (unsigned long dwIoBase, unsigned char byThreshold) ...@@ -342,11 +342,11 @@ void MACvSetRxThreshold (unsigned long dwIoBase, unsigned char byThreshold)
* Return Value: none * Return Value: none
* *
*/ */
void MACvGetRxThreshold (unsigned long dwIoBase, unsigned char *pbyThreshold) void MACvGetRxThreshold(unsigned long dwIoBase, unsigned char *pbyThreshold)
{ {
// get FCR0 // get FCR0
VNSvInPortB(dwIoBase + MAC_REG_FCR0, pbyThreshold); VNSvInPortB(dwIoBase + MAC_REG_FCR0, pbyThreshold);
*pbyThreshold = (*pbyThreshold >> 4) & 0x03; *pbyThreshold = (*pbyThreshold >> 4) & 0x03;
} }
/* /*
...@@ -363,16 +363,16 @@ void MACvGetRxThreshold (unsigned long dwIoBase, unsigned char *pbyThreshold) ...@@ -363,16 +363,16 @@ void MACvGetRxThreshold (unsigned long dwIoBase, unsigned char *pbyThreshold)
* Return Value: none * Return Value: none
* *
*/ */
void MACvSetTxThreshold (unsigned long dwIoBase, unsigned char byThreshold) void MACvSetTxThreshold(unsigned long dwIoBase, unsigned char byThreshold)
{ {
unsigned char byOrgValue; unsigned char byOrgValue;
ASSERT(byThreshold < 4); ASSERT(byThreshold < 4);
// set FCR0 // set FCR0
VNSvInPortB(dwIoBase + MAC_REG_FCR0, &byOrgValue); VNSvInPortB(dwIoBase + MAC_REG_FCR0, &byOrgValue);
byOrgValue = (byOrgValue & 0xF3) | (byThreshold << 2); byOrgValue = (byOrgValue & 0xF3) | (byThreshold << 2);
VNSvOutPortB(dwIoBase + MAC_REG_FCR0, byOrgValue); VNSvOutPortB(dwIoBase + MAC_REG_FCR0, byOrgValue);
} }
/* /*
...@@ -388,11 +388,11 @@ void MACvSetTxThreshold (unsigned long dwIoBase, unsigned char byThreshold) ...@@ -388,11 +388,11 @@ void MACvSetTxThreshold (unsigned long dwIoBase, unsigned char byThreshold)
* Return Value: none * Return Value: none
* *
*/ */
void MACvGetTxThreshold (unsigned long dwIoBase, unsigned char *pbyThreshold) void MACvGetTxThreshold(unsigned long dwIoBase, unsigned char *pbyThreshold)
{ {
// get FCR0 // get FCR0
VNSvInPortB(dwIoBase + MAC_REG_FCR0, pbyThreshold); VNSvInPortB(dwIoBase + MAC_REG_FCR0, pbyThreshold);
*pbyThreshold = (*pbyThreshold >> 2) & 0x03; *pbyThreshold = (*pbyThreshold >> 2) & 0x03;
} }
/* /*
...@@ -409,16 +409,16 @@ void MACvGetTxThreshold (unsigned long dwIoBase, unsigned char *pbyThreshold) ...@@ -409,16 +409,16 @@ void MACvGetTxThreshold (unsigned long dwIoBase, unsigned char *pbyThreshold)
* Return Value: none * Return Value: none
* *
*/ */
void MACvSetDmaLength (unsigned long dwIoBase, unsigned char byDmaLength) void MACvSetDmaLength(unsigned long dwIoBase, unsigned char byDmaLength)
{ {
unsigned char byOrgValue; unsigned char byOrgValue;
ASSERT(byDmaLength < 4); ASSERT(byDmaLength < 4);
// set FCR0 // set FCR0
VNSvInPortB(dwIoBase + MAC_REG_FCR0, &byOrgValue); VNSvInPortB(dwIoBase + MAC_REG_FCR0, &byOrgValue);
byOrgValue = (byOrgValue & 0xFC) | byDmaLength; byOrgValue = (byOrgValue & 0xFC) | byDmaLength;
VNSvOutPortB(dwIoBase + MAC_REG_FCR0, byOrgValue); VNSvOutPortB(dwIoBase + MAC_REG_FCR0, byOrgValue);
} }
/* /*
...@@ -434,11 +434,11 @@ void MACvSetDmaLength (unsigned long dwIoBase, unsigned char byDmaLength) ...@@ -434,11 +434,11 @@ void MACvSetDmaLength (unsigned long dwIoBase, unsigned char byDmaLength)
* Return Value: none * Return Value: none
* *
*/ */
void MACvGetDmaLength (unsigned long dwIoBase, unsigned char *pbyDmaLength) void MACvGetDmaLength(unsigned long dwIoBase, unsigned char *pbyDmaLength)
{ {
// get FCR0 // get FCR0
VNSvInPortB(dwIoBase + MAC_REG_FCR0, pbyDmaLength); VNSvInPortB(dwIoBase + MAC_REG_FCR0, pbyDmaLength);
*pbyDmaLength &= 0x03; *pbyDmaLength &= 0x03;
} }
/* /*
...@@ -455,10 +455,10 @@ void MACvGetDmaLength (unsigned long dwIoBase, unsigned char *pbyDmaLength) ...@@ -455,10 +455,10 @@ void MACvGetDmaLength (unsigned long dwIoBase, unsigned char *pbyDmaLength)
* Return Value: none * Return Value: none
* *
*/ */
void MACvSetShortRetryLimit (unsigned long dwIoBase, unsigned char byRetryLimit) void MACvSetShortRetryLimit(unsigned long dwIoBase, unsigned char byRetryLimit)
{ {
// set SRT // set SRT
VNSvOutPortB(dwIoBase + MAC_REG_SRT, byRetryLimit); VNSvOutPortB(dwIoBase + MAC_REG_SRT, byRetryLimit);
} }
/* /*
...@@ -474,10 +474,10 @@ void MACvSetShortRetryLimit (unsigned long dwIoBase, unsigned char byRetryLimit) ...@@ -474,10 +474,10 @@ void MACvSetShortRetryLimit (unsigned long dwIoBase, unsigned char byRetryLimit)
* Return Value: none * Return Value: none
* *
*/ */
void MACvGetShortRetryLimit (unsigned long dwIoBase, unsigned char *pbyRetryLimit) void MACvGetShortRetryLimit(unsigned long dwIoBase, unsigned char *pbyRetryLimit)
{ {
// get SRT // get SRT
VNSvInPortB(dwIoBase + MAC_REG_SRT, pbyRetryLimit); VNSvInPortB(dwIoBase + MAC_REG_SRT, pbyRetryLimit);
} }
/* /*
...@@ -494,10 +494,10 @@ void MACvGetShortRetryLimit (unsigned long dwIoBase, unsigned char *pbyRetryLimi ...@@ -494,10 +494,10 @@ void MACvGetShortRetryLimit (unsigned long dwIoBase, unsigned char *pbyRetryLimi
* Return Value: none * Return Value: none
* *
*/ */
void MACvSetLongRetryLimit (unsigned long dwIoBase, unsigned char byRetryLimit) void MACvSetLongRetryLimit(unsigned long dwIoBase, unsigned char byRetryLimit)
{ {
// set LRT // set LRT
VNSvOutPortB(dwIoBase + MAC_REG_LRT, byRetryLimit); VNSvOutPortB(dwIoBase + MAC_REG_LRT, byRetryLimit);
} }
/* /*
...@@ -513,10 +513,10 @@ void MACvSetLongRetryLimit (unsigned long dwIoBase, unsigned char byRetryLimit) ...@@ -513,10 +513,10 @@ void MACvSetLongRetryLimit (unsigned long dwIoBase, unsigned char byRetryLimit)
* Return Value: none * Return Value: none
* *
*/ */
void MACvGetLongRetryLimit (unsigned long dwIoBase, unsigned char *pbyRetryLimit) void MACvGetLongRetryLimit(unsigned long dwIoBase, unsigned char *pbyRetryLimit)
{ {
// get LRT // get LRT
VNSvInPortB(dwIoBase + MAC_REG_LRT, pbyRetryLimit); VNSvInPortB(dwIoBase + MAC_REG_LRT, pbyRetryLimit);
} }
/* /*
...@@ -533,17 +533,17 @@ void MACvGetLongRetryLimit (unsigned long dwIoBase, unsigned char *pbyRetryLimit ...@@ -533,17 +533,17 @@ void MACvGetLongRetryLimit (unsigned long dwIoBase, unsigned char *pbyRetryLimit
* Return Value: none * Return Value: none
* *
*/ */
void MACvSetLoopbackMode (unsigned long dwIoBase, unsigned char byLoopbackMode) void MACvSetLoopbackMode(unsigned long dwIoBase, unsigned char byLoopbackMode)
{ {
unsigned char byOrgValue; unsigned char byOrgValue;
ASSERT(byLoopbackMode < 3); ASSERT(byLoopbackMode < 3);
byLoopbackMode <<= 6; byLoopbackMode <<= 6;
// set TCR // set TCR
VNSvInPortB(dwIoBase + MAC_REG_TEST, &byOrgValue); VNSvInPortB(dwIoBase + MAC_REG_TEST, &byOrgValue);
byOrgValue = byOrgValue & 0x3F; byOrgValue = byOrgValue & 0x3F;
byOrgValue = byOrgValue | byLoopbackMode; byOrgValue = byOrgValue | byLoopbackMode;
VNSvOutPortB(dwIoBase + MAC_REG_TEST, byOrgValue); VNSvOutPortB(dwIoBase + MAC_REG_TEST, byOrgValue);
} }
/* /*
...@@ -559,14 +559,14 @@ void MACvSetLoopbackMode (unsigned long dwIoBase, unsigned char byLoopbackMode) ...@@ -559,14 +559,14 @@ void MACvSetLoopbackMode (unsigned long dwIoBase, unsigned char byLoopbackMode)
* Return Value: true if in Loopback mode; otherwise false * Return Value: true if in Loopback mode; otherwise false
* *
*/ */
bool MACbIsInLoopbackMode (unsigned long dwIoBase) bool MACbIsInLoopbackMode(unsigned long dwIoBase)
{ {
unsigned char byOrgValue; unsigned char byOrgValue;
VNSvInPortB(dwIoBase + MAC_REG_TEST, &byOrgValue); VNSvInPortB(dwIoBase + MAC_REG_TEST, &byOrgValue);
if (byOrgValue & (TEST_LBINT | TEST_LBEXT)) if (byOrgValue & (TEST_LBINT | TEST_LBEXT))
return true; return true;
return false; return false;
} }
/* /*
...@@ -583,51 +583,51 @@ bool MACbIsInLoopbackMode (unsigned long dwIoBase) ...@@ -583,51 +583,51 @@ bool MACbIsInLoopbackMode (unsigned long dwIoBase)
* Return Value: none * Return Value: none
* *
*/ */
void MACvSetPacketFilter (unsigned long dwIoBase, unsigned short wFilterType) void MACvSetPacketFilter(unsigned long dwIoBase, unsigned short wFilterType)
{ {
unsigned char byOldRCR; unsigned char byOldRCR;
unsigned char byNewRCR = 0; unsigned char byNewRCR = 0;
// if only in DIRECTED mode, multicast-address will set to zero, // if only in DIRECTED mode, multicast-address will set to zero,
// but if other mode exist (e.g. PROMISCUOUS), multicast-address // but if other mode exist (e.g. PROMISCUOUS), multicast-address
// will be open // will be open
if (wFilterType & PKT_TYPE_DIRECTED) { if (wFilterType & PKT_TYPE_DIRECTED) {
// set multicast address to accept none // set multicast address to accept none
MACvSelectPage1(dwIoBase); MACvSelectPage1(dwIoBase);
VNSvOutPortD(dwIoBase + MAC_REG_MAR0, 0L); VNSvOutPortD(dwIoBase + MAC_REG_MAR0, 0L);
VNSvOutPortD(dwIoBase + MAC_REG_MAR0 + sizeof(unsigned long), 0L); VNSvOutPortD(dwIoBase + MAC_REG_MAR0 + sizeof(unsigned long), 0L);
MACvSelectPage0(dwIoBase); MACvSelectPage0(dwIoBase);
} }
if (wFilterType & (PKT_TYPE_PROMISCUOUS | PKT_TYPE_ALL_MULTICAST)) { if (wFilterType & (PKT_TYPE_PROMISCUOUS | PKT_TYPE_ALL_MULTICAST)) {
// set multicast address to accept all // set multicast address to accept all
MACvSelectPage1(dwIoBase); MACvSelectPage1(dwIoBase);
VNSvOutPortD(dwIoBase + MAC_REG_MAR0, 0xFFFFFFFFL); VNSvOutPortD(dwIoBase + MAC_REG_MAR0, 0xFFFFFFFFL);
VNSvOutPortD(dwIoBase + MAC_REG_MAR0 + sizeof(unsigned long), 0xFFFFFFFFL); VNSvOutPortD(dwIoBase + MAC_REG_MAR0 + sizeof(unsigned long), 0xFFFFFFFFL);
MACvSelectPage0(dwIoBase); MACvSelectPage0(dwIoBase);
} }
if (wFilterType & PKT_TYPE_PROMISCUOUS) { if (wFilterType & PKT_TYPE_PROMISCUOUS) {
byNewRCR |= (RCR_RXALLTYPE | RCR_UNICAST | RCR_MULTICAST | RCR_BROADCAST); byNewRCR |= (RCR_RXALLTYPE | RCR_UNICAST | RCR_MULTICAST | RCR_BROADCAST);
byNewRCR &= ~RCR_BSSID; byNewRCR &= ~RCR_BSSID;
} }
if (wFilterType & (PKT_TYPE_ALL_MULTICAST | PKT_TYPE_MULTICAST)) if (wFilterType & (PKT_TYPE_ALL_MULTICAST | PKT_TYPE_MULTICAST))
byNewRCR |= RCR_MULTICAST; byNewRCR |= RCR_MULTICAST;
if (wFilterType & PKT_TYPE_BROADCAST) if (wFilterType & PKT_TYPE_BROADCAST)
byNewRCR |= RCR_BROADCAST; byNewRCR |= RCR_BROADCAST;
if (wFilterType & PKT_TYPE_ERROR_CRC) if (wFilterType & PKT_TYPE_ERROR_CRC)
byNewRCR |= RCR_ERRCRC; byNewRCR |= RCR_ERRCRC;
VNSvInPortB(dwIoBase + MAC_REG_RCR, &byOldRCR); VNSvInPortB(dwIoBase + MAC_REG_RCR, &byOldRCR);
if (byNewRCR != byOldRCR) { if (byNewRCR != byOldRCR) {
// Modify the Receive Command Register // Modify the Receive Command Register
VNSvOutPortB(dwIoBase + MAC_REG_RCR, byNewRCR); VNSvOutPortB(dwIoBase + MAC_REG_RCR, byNewRCR);
} }
} }
/* /*
...@@ -643,23 +643,23 @@ void MACvSetPacketFilter (unsigned long dwIoBase, unsigned short wFilterType) ...@@ -643,23 +643,23 @@ void MACvSetPacketFilter (unsigned long dwIoBase, unsigned short wFilterType)
* Return Value: none * Return Value: none
* *
*/ */
void MACvSaveContext (unsigned long dwIoBase, unsigned char *pbyCxtBuf) void MACvSaveContext(unsigned long dwIoBase, unsigned char *pbyCxtBuf)
{ {
int ii; int ii;
// read page0 register // read page0 register
for (ii = 0; ii < MAC_MAX_CONTEXT_SIZE_PAGE0; ii++) { for (ii = 0; ii < MAC_MAX_CONTEXT_SIZE_PAGE0; ii++) {
VNSvInPortB((dwIoBase + ii), (pbyCxtBuf + ii)); VNSvInPortB((dwIoBase + ii), (pbyCxtBuf + ii));
} }
MACvSelectPage1(dwIoBase); MACvSelectPage1(dwIoBase);
// read page1 register // read page1 register
for (ii = 0; ii < MAC_MAX_CONTEXT_SIZE_PAGE1; ii++) { for (ii = 0; ii < MAC_MAX_CONTEXT_SIZE_PAGE1; ii++) {
VNSvInPortB((dwIoBase + ii), (pbyCxtBuf + MAC_MAX_CONTEXT_SIZE_PAGE0 + ii)); VNSvInPortB((dwIoBase + ii), (pbyCxtBuf + MAC_MAX_CONTEXT_SIZE_PAGE0 + ii));
} }
MACvSelectPage0(dwIoBase); MACvSelectPage0(dwIoBase);
} }
/* /*
...@@ -676,41 +676,41 @@ void MACvSaveContext (unsigned long dwIoBase, unsigned char *pbyCxtBuf) ...@@ -676,41 +676,41 @@ void MACvSaveContext (unsigned long dwIoBase, unsigned char *pbyCxtBuf)
* Return Value: none * Return Value: none
* *
*/ */
void MACvRestoreContext (unsigned long dwIoBase, unsigned char *pbyCxtBuf) void MACvRestoreContext(unsigned long dwIoBase, unsigned char *pbyCxtBuf)
{ {
int ii; int ii;
MACvSelectPage1(dwIoBase); MACvSelectPage1(dwIoBase);
// restore page1 // restore page1
for (ii = 0; ii < MAC_MAX_CONTEXT_SIZE_PAGE1; ii++) { for (ii = 0; ii < MAC_MAX_CONTEXT_SIZE_PAGE1; ii++) {
VNSvOutPortB((dwIoBase + ii), *(pbyCxtBuf + MAC_MAX_CONTEXT_SIZE_PAGE0 + ii)); VNSvOutPortB((dwIoBase + ii), *(pbyCxtBuf + MAC_MAX_CONTEXT_SIZE_PAGE0 + ii));
} }
MACvSelectPage0(dwIoBase); MACvSelectPage0(dwIoBase);
// restore RCR,TCR,IMR... // restore RCR,TCR,IMR...
for (ii = MAC_REG_RCR; ii < MAC_REG_ISR; ii++) { for (ii = MAC_REG_RCR; ii < MAC_REG_ISR; ii++) {
VNSvOutPortB(dwIoBase + ii, *(pbyCxtBuf + ii)); VNSvOutPortB(dwIoBase + ii, *(pbyCxtBuf + ii));
} }
// restore MAC Config. // restore MAC Config.
for (ii = MAC_REG_LRT; ii < MAC_REG_PAGE1SEL; ii++) { for (ii = MAC_REG_LRT; ii < MAC_REG_PAGE1SEL; ii++) {
VNSvOutPortB(dwIoBase + ii, *(pbyCxtBuf + ii)); VNSvOutPortB(dwIoBase + ii, *(pbyCxtBuf + ii));
} }
VNSvOutPortB(dwIoBase + MAC_REG_CFG, *(pbyCxtBuf + MAC_REG_CFG)); VNSvOutPortB(dwIoBase + MAC_REG_CFG, *(pbyCxtBuf + MAC_REG_CFG));
// restore PS Config. // restore PS Config.
for (ii = MAC_REG_PSCFG; ii < MAC_REG_BBREGCTL; ii++) { for (ii = MAC_REG_PSCFG; ii < MAC_REG_BBREGCTL; ii++) {
VNSvOutPortB(dwIoBase + ii, *(pbyCxtBuf + ii)); VNSvOutPortB(dwIoBase + ii, *(pbyCxtBuf + ii));
} }
// restore CURR_RX_DESC_ADDR, CURR_TX_DESC_ADDR // restore CURR_RX_DESC_ADDR, CURR_TX_DESC_ADDR
VNSvOutPortD(dwIoBase + MAC_REG_TXDMAPTR0, *(unsigned long *)(pbyCxtBuf + MAC_REG_TXDMAPTR0)); VNSvOutPortD(dwIoBase + MAC_REG_TXDMAPTR0, *(unsigned long *)(pbyCxtBuf + MAC_REG_TXDMAPTR0));
VNSvOutPortD(dwIoBase + MAC_REG_AC0DMAPTR, *(unsigned long *)(pbyCxtBuf + MAC_REG_AC0DMAPTR)); VNSvOutPortD(dwIoBase + MAC_REG_AC0DMAPTR, *(unsigned long *)(pbyCxtBuf + MAC_REG_AC0DMAPTR));
VNSvOutPortD(dwIoBase + MAC_REG_BCNDMAPTR, *(unsigned long *)(pbyCxtBuf + MAC_REG_BCNDMAPTR)); VNSvOutPortD(dwIoBase + MAC_REG_BCNDMAPTR, *(unsigned long *)(pbyCxtBuf + MAC_REG_BCNDMAPTR));
VNSvOutPortD(dwIoBase + MAC_REG_RXDMAPTR0, *(unsigned long *)(pbyCxtBuf + MAC_REG_RXDMAPTR0)); VNSvOutPortD(dwIoBase + MAC_REG_RXDMAPTR0, *(unsigned long *)(pbyCxtBuf + MAC_REG_RXDMAPTR0));
VNSvOutPortD(dwIoBase + MAC_REG_RXDMAPTR1, *(unsigned long *)(pbyCxtBuf + MAC_REG_RXDMAPTR1)); VNSvOutPortD(dwIoBase + MAC_REG_RXDMAPTR1, *(unsigned long *)(pbyCxtBuf + MAC_REG_RXDMAPTR1));
} }
...@@ -728,36 +728,36 @@ void MACvRestoreContext (unsigned long dwIoBase, unsigned char *pbyCxtBuf) ...@@ -728,36 +728,36 @@ void MACvRestoreContext (unsigned long dwIoBase, unsigned char *pbyCxtBuf)
* Return Value: true if all values are the same; otherwise false * Return Value: true if all values are the same; otherwise false
* *
*/ */
bool MACbCompareContext (unsigned long dwIoBase, unsigned char *pbyCxtBuf) bool MACbCompareContext(unsigned long dwIoBase, unsigned char *pbyCxtBuf)
{ {
unsigned long dwData; unsigned long dwData;
// compare MAC context to determine if this is a power lost init, // compare MAC context to determine if this is a power lost init,
// return true for power remaining init, return false for power lost init // return true for power remaining init, return false for power lost init
// compare CURR_RX_DESC_ADDR, CURR_TX_DESC_ADDR // compare CURR_RX_DESC_ADDR, CURR_TX_DESC_ADDR
VNSvInPortD(dwIoBase + MAC_REG_TXDMAPTR0, &dwData); VNSvInPortD(dwIoBase + MAC_REG_TXDMAPTR0, &dwData);
if (dwData != *(unsigned long *)(pbyCxtBuf + MAC_REG_TXDMAPTR0)) { if (dwData != *(unsigned long *)(pbyCxtBuf + MAC_REG_TXDMAPTR0)) {
return false; return false;
} }
VNSvInPortD(dwIoBase + MAC_REG_AC0DMAPTR, &dwData); VNSvInPortD(dwIoBase + MAC_REG_AC0DMAPTR, &dwData);
if (dwData != *(unsigned long *)(pbyCxtBuf + MAC_REG_AC0DMAPTR)) { if (dwData != *(unsigned long *)(pbyCxtBuf + MAC_REG_AC0DMAPTR)) {
return false; return false;
} }
VNSvInPortD(dwIoBase + MAC_REG_RXDMAPTR0, &dwData); VNSvInPortD(dwIoBase + MAC_REG_RXDMAPTR0, &dwData);
if (dwData != *(unsigned long *)(pbyCxtBuf + MAC_REG_RXDMAPTR0)) { if (dwData != *(unsigned long *)(pbyCxtBuf + MAC_REG_RXDMAPTR0)) {
return false; return false;
} }
VNSvInPortD(dwIoBase + MAC_REG_RXDMAPTR1, &dwData); VNSvInPortD(dwIoBase + MAC_REG_RXDMAPTR1, &dwData);
if (dwData != *(unsigned long *)(pbyCxtBuf + MAC_REG_RXDMAPTR1)) { if (dwData != *(unsigned long *)(pbyCxtBuf + MAC_REG_RXDMAPTR1)) {
return false; return false;
} }
return true; return true;
} }
/* /*
...@@ -773,23 +773,23 @@ bool MACbCompareContext (unsigned long dwIoBase, unsigned char *pbyCxtBuf) ...@@ -773,23 +773,23 @@ bool MACbCompareContext (unsigned long dwIoBase, unsigned char *pbyCxtBuf)
* Return Value: true if Reset Success; otherwise false * Return Value: true if Reset Success; otherwise false
* *
*/ */
bool MACbSoftwareReset (unsigned long dwIoBase) bool MACbSoftwareReset(unsigned long dwIoBase)
{ {
unsigned char byData; unsigned char byData;
unsigned short ww; unsigned short ww;
// turn on HOSTCR_SOFTRST, just write 0x01 to reset // turn on HOSTCR_SOFTRST, just write 0x01 to reset
//MACvRegBitsOn(dwIoBase, MAC_REG_HOSTCR, HOSTCR_SOFTRST); //MACvRegBitsOn(dwIoBase, MAC_REG_HOSTCR, HOSTCR_SOFTRST);
VNSvOutPortB(dwIoBase+ MAC_REG_HOSTCR, 0x01); VNSvOutPortB(dwIoBase + MAC_REG_HOSTCR, 0x01);
for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
VNSvInPortB(dwIoBase + MAC_REG_HOSTCR, &byData); VNSvInPortB(dwIoBase + MAC_REG_HOSTCR, &byData);
if ( !(byData & HOSTCR_SOFTRST)) if (!(byData & HOSTCR_SOFTRST))
break; break;
} }
if (ww == W_MAX_TIMEOUT) if (ww == W_MAX_TIMEOUT)
return false; return false;
return true; return true;
} }
...@@ -806,24 +806,24 @@ bool MACbSoftwareReset (unsigned long dwIoBase) ...@@ -806,24 +806,24 @@ bool MACbSoftwareReset (unsigned long dwIoBase)
* Return Value: true if success; otherwise false * Return Value: true if success; otherwise false
* *
*/ */
bool MACbSafeSoftwareReset (unsigned long dwIoBase) bool MACbSafeSoftwareReset(unsigned long dwIoBase)
{ {
unsigned char abyTmpRegData[MAC_MAX_CONTEXT_SIZE_PAGE0+MAC_MAX_CONTEXT_SIZE_PAGE1]; unsigned char abyTmpRegData[MAC_MAX_CONTEXT_SIZE_PAGE0+MAC_MAX_CONTEXT_SIZE_PAGE1];
bool bRetVal; bool bRetVal;
// PATCH.... // PATCH....
// save some important register's value, then do // save some important register's value, then do
// reset, then restore register's value // reset, then restore register's value
// save MAC context // save MAC context
MACvSaveContext(dwIoBase, abyTmpRegData); MACvSaveContext(dwIoBase, abyTmpRegData);
// do reset // do reset
bRetVal = MACbSoftwareReset(dwIoBase); bRetVal = MACbSoftwareReset(dwIoBase);
//BBvSoftwareReset(pDevice->PortOffset); //BBvSoftwareReset(pDevice->PortOffset);
// restore MAC context, except CR0 // restore MAC context, except CR0
MACvRestoreContext(dwIoBase, abyTmpRegData); MACvRestoreContext(dwIoBase, abyTmpRegData);
return bRetVal; return bRetVal;
} }
/* /*
...@@ -839,52 +839,52 @@ bool MACbSafeSoftwareReset (unsigned long dwIoBase) ...@@ -839,52 +839,52 @@ bool MACbSafeSoftwareReset (unsigned long dwIoBase)
* Return Value: true if success; otherwise false * Return Value: true if success; otherwise false
* *
*/ */
bool MACbSafeRxOff (unsigned long dwIoBase) bool MACbSafeRxOff(unsigned long dwIoBase)
{ {
unsigned short ww; unsigned short ww;
unsigned long dwData; unsigned long dwData;
unsigned char byData; unsigned char byData;
// turn off wow temp for turn off Rx safely // turn off wow temp for turn off Rx safely
// Clear RX DMA0,1 // Clear RX DMA0,1
VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL0, DMACTL_CLRRUN); VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL0, DMACTL_CLRRUN);
VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL1, DMACTL_CLRRUN); VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL1, DMACTL_CLRRUN);
for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
VNSvInPortD(dwIoBase + MAC_REG_RXDMACTL0, &dwData); VNSvInPortD(dwIoBase + MAC_REG_RXDMACTL0, &dwData);
if (!(dwData & DMACTL_RUN)) if (!(dwData & DMACTL_RUN))
break; break;
} }
if (ww == W_MAX_TIMEOUT) { if (ww == W_MAX_TIMEOUT) {
DBG_PORT80(0x10); DBG_PORT80(0x10);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x10)\n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x10)\n");
return(false); return(false);
} }
for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
VNSvInPortD(dwIoBase + MAC_REG_RXDMACTL1, &dwData); VNSvInPortD(dwIoBase + MAC_REG_RXDMACTL1, &dwData);
if ( !(dwData & DMACTL_RUN)) if (!(dwData & DMACTL_RUN))
break; break;
} }
if (ww == W_MAX_TIMEOUT) { if (ww == W_MAX_TIMEOUT) {
DBG_PORT80(0x11); DBG_PORT80(0x11);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x11)\n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x11)\n");
return(false); return(false);
} }
// try to safe shutdown RX // try to safe shutdown RX
MACvRegBitsOff(dwIoBase, MAC_REG_HOSTCR, HOSTCR_RXON); MACvRegBitsOff(dwIoBase, MAC_REG_HOSTCR, HOSTCR_RXON);
// W_MAX_TIMEOUT is the timeout period // W_MAX_TIMEOUT is the timeout period
for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
VNSvInPortB(dwIoBase + MAC_REG_HOSTCR, &byData); VNSvInPortB(dwIoBase + MAC_REG_HOSTCR, &byData);
if ( !(byData & HOSTCR_RXONST)) if (!(byData & HOSTCR_RXONST))
break; break;
} }
if (ww == W_MAX_TIMEOUT) { if (ww == W_MAX_TIMEOUT) {
DBG_PORT80(0x12); DBG_PORT80(0x12);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x12)\n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x12)\n");
return(false); return(false);
} }
return true; return true;
} }
/* /*
...@@ -900,55 +900,55 @@ bool MACbSafeRxOff (unsigned long dwIoBase) ...@@ -900,55 +900,55 @@ bool MACbSafeRxOff (unsigned long dwIoBase)
* Return Value: true if success; otherwise false * Return Value: true if success; otherwise false
* *
*/ */
bool MACbSafeTxOff (unsigned long dwIoBase) bool MACbSafeTxOff(unsigned long dwIoBase)
{ {
unsigned short ww; unsigned short ww;
unsigned long dwData; unsigned long dwData;
unsigned char byData; unsigned char byData;
// Clear TX DMA // Clear TX DMA
//Tx0 //Tx0
VNSvOutPortD(dwIoBase + MAC_REG_TXDMACTL0, DMACTL_CLRRUN); VNSvOutPortD(dwIoBase + MAC_REG_TXDMACTL0, DMACTL_CLRRUN);
//AC0 //AC0
VNSvOutPortD(dwIoBase + MAC_REG_AC0DMACTL, DMACTL_CLRRUN); VNSvOutPortD(dwIoBase + MAC_REG_AC0DMACTL, DMACTL_CLRRUN);
for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
VNSvInPortD(dwIoBase + MAC_REG_TXDMACTL0, &dwData); VNSvInPortD(dwIoBase + MAC_REG_TXDMACTL0, &dwData);
if ( !(dwData & DMACTL_RUN)) if (!(dwData & DMACTL_RUN))
break; break;
} }
if (ww == W_MAX_TIMEOUT) { if (ww == W_MAX_TIMEOUT) {
DBG_PORT80(0x20); DBG_PORT80(0x20);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x20)\n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x20)\n");
return(false); return(false);
} }
for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
VNSvInPortD(dwIoBase + MAC_REG_AC0DMACTL, &dwData); VNSvInPortD(dwIoBase + MAC_REG_AC0DMACTL, &dwData);
if ( !(dwData & DMACTL_RUN)) if (!(dwData & DMACTL_RUN))
break; break;
} }
if (ww == W_MAX_TIMEOUT) { if (ww == W_MAX_TIMEOUT) {
DBG_PORT80(0x21); DBG_PORT80(0x21);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x21)\n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x21)\n");
return(false); return(false);
} }
// try to safe shutdown TX // try to safe shutdown TX
MACvRegBitsOff(dwIoBase, MAC_REG_HOSTCR, HOSTCR_TXON); MACvRegBitsOff(dwIoBase, MAC_REG_HOSTCR, HOSTCR_TXON);
// W_MAX_TIMEOUT is the timeout period // W_MAX_TIMEOUT is the timeout period
for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
VNSvInPortB(dwIoBase + MAC_REG_HOSTCR, &byData); VNSvInPortB(dwIoBase + MAC_REG_HOSTCR, &byData);
if ( !(byData & HOSTCR_TXONST)) if (!(byData & HOSTCR_TXONST))
break; break;
} }
if (ww == W_MAX_TIMEOUT) { if (ww == W_MAX_TIMEOUT) {
DBG_PORT80(0x24); DBG_PORT80(0x24);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x24)\n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x24)\n");
return(false); return(false);
} }
return true; return true;
} }
/* /*
...@@ -964,26 +964,26 @@ bool MACbSafeTxOff (unsigned long dwIoBase) ...@@ -964,26 +964,26 @@ bool MACbSafeTxOff (unsigned long dwIoBase)
* Return Value: true if success; otherwise false * Return Value: true if success; otherwise false
* *
*/ */
bool MACbSafeStop (unsigned long dwIoBase) bool MACbSafeStop(unsigned long dwIoBase)
{ {
MACvRegBitsOff(dwIoBase, MAC_REG_TCR, TCR_AUTOBCNTX); MACvRegBitsOff(dwIoBase, MAC_REG_TCR, TCR_AUTOBCNTX);
if (MACbSafeRxOff(dwIoBase) == false) { if (MACbSafeRxOff(dwIoBase) == false) {
DBG_PORT80(0xA1); DBG_PORT80(0xA1);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" MACbSafeRxOff == false)\n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " MACbSafeRxOff == false)\n");
MACbSafeSoftwareReset(dwIoBase); MACbSafeSoftwareReset(dwIoBase);
return false; return false;
} }
if (MACbSafeTxOff(dwIoBase) == false) { if (MACbSafeTxOff(dwIoBase) == false) {
DBG_PORT80(0xA2); DBG_PORT80(0xA2);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" MACbSafeTxOff == false)\n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " MACbSafeTxOff == false)\n");
MACbSafeSoftwareReset(dwIoBase); MACbSafeSoftwareReset(dwIoBase);
return false; return false;
} }
MACvRegBitsOff(dwIoBase, MAC_REG_HOSTCR, HOSTCR_MACEN); MACvRegBitsOff(dwIoBase, MAC_REG_HOSTCR, HOSTCR_MACEN);
return true; return true;
} }
/* /*
...@@ -999,18 +999,18 @@ bool MACbSafeStop (unsigned long dwIoBase) ...@@ -999,18 +999,18 @@ bool MACbSafeStop (unsigned long dwIoBase)
* Return Value: true if success; otherwise false * Return Value: true if success; otherwise false
* *
*/ */
bool MACbShutdown (unsigned long dwIoBase) bool MACbShutdown(unsigned long dwIoBase)
{ {
// disable MAC IMR // disable MAC IMR
MACvIntDisable(dwIoBase); MACvIntDisable(dwIoBase);
MACvSetLoopbackMode(dwIoBase, MAC_LB_INTERNAL); MACvSetLoopbackMode(dwIoBase, MAC_LB_INTERNAL);
// stop the adapter // stop the adapter
if (!MACbSafeStop(dwIoBase)) { if (!MACbSafeStop(dwIoBase)) {
MACvSetLoopbackMode(dwIoBase, MAC_LB_NONE); MACvSetLoopbackMode(dwIoBase, MAC_LB_NONE);
return false; return false;
} }
MACvSetLoopbackMode(dwIoBase, MAC_LB_NONE); MACvSetLoopbackMode(dwIoBase, MAC_LB_NONE);
return true; return true;
} }
/* /*
...@@ -1026,42 +1026,42 @@ bool MACbShutdown (unsigned long dwIoBase) ...@@ -1026,42 +1026,42 @@ bool MACbShutdown (unsigned long dwIoBase)
* Return Value: none * Return Value: none
* *
*/ */
void MACvInitialize (unsigned long dwIoBase) void MACvInitialize(unsigned long dwIoBase)
{ {
// clear sticky bits // clear sticky bits
MACvClearStckDS(dwIoBase); MACvClearStckDS(dwIoBase);
// disable force PME-enable // disable force PME-enable
VNSvOutPortB(dwIoBase + MAC_REG_PMC1, PME_OVR); VNSvOutPortB(dwIoBase + MAC_REG_PMC1, PME_OVR);
// only 3253 A // only 3253 A
/* /*
MACvPwrEvntDisable(dwIoBase); MACvPwrEvntDisable(dwIoBase);
// clear power status // clear power status
VNSvOutPortW(dwIoBase + MAC_REG_WAKEUPSR0, 0x0F0F); VNSvOutPortW(dwIoBase + MAC_REG_WAKEUPSR0, 0x0F0F);
*/ */
// do reset // do reset
MACbSoftwareReset(dwIoBase); MACbSoftwareReset(dwIoBase);
// issue AUTOLD in EECSR to reload eeprom // issue AUTOLD in EECSR to reload eeprom
//MACvRegBitsOn(dwIoBase, MAC_REG_I2MCSR, I2MCSR_AUTOLD); //MACvRegBitsOn(dwIoBase, MAC_REG_I2MCSR, I2MCSR_AUTOLD);
// wait until EEPROM loading complete // wait until EEPROM loading complete
//while (true) { //while (true) {
// u8 u8Data; // u8 u8Data;
// VNSvInPortB(dwIoBase + MAC_REG_I2MCSR, &u8Data); // VNSvInPortB(dwIoBase + MAC_REG_I2MCSR, &u8Data);
// if ( !(u8Data & I2MCSR_AUTOLD)) // if (!(u8Data & I2MCSR_AUTOLD))
// break; // break;
//} //}
// reset TSF counter // reset TSF counter
VNSvOutPortB(dwIoBase + MAC_REG_TFTCTL, TFTCTL_TSFCNTRST); VNSvOutPortB(dwIoBase + MAC_REG_TFTCTL, TFTCTL_TSFCNTRST);
// enable TSF counter // enable TSF counter
VNSvOutPortB(dwIoBase + MAC_REG_TFTCTL, TFTCTL_TSFCNTREN); VNSvOutPortB(dwIoBase + MAC_REG_TFTCTL, TFTCTL_TSFCNTREN);
// set packet filter // set packet filter
// receive directed and broadcast address // receive directed and broadcast address
MACvSetPacketFilter(dwIoBase, PKT_TYPE_DIRECTED | PKT_TYPE_BROADCAST); MACvSetPacketFilter(dwIoBase, PKT_TYPE_DIRECTED | PKT_TYPE_BROADCAST);
} }
...@@ -1079,28 +1079,28 @@ void MACvInitialize (unsigned long dwIoBase) ...@@ -1079,28 +1079,28 @@ void MACvInitialize (unsigned long dwIoBase)
* Return Value: none * Return Value: none
* *
*/ */
void MACvSetCurrRx0DescAddr (unsigned long dwIoBase, unsigned long dwCurrDescAddr) void MACvSetCurrRx0DescAddr(unsigned long dwIoBase, unsigned long dwCurrDescAddr)
{ {
unsigned short ww; unsigned short ww;
unsigned char byData; unsigned char byData;
unsigned char byOrgDMACtl; unsigned char byOrgDMACtl;
VNSvInPortB(dwIoBase + MAC_REG_RXDMACTL0, &byOrgDMACtl); VNSvInPortB(dwIoBase + MAC_REG_RXDMACTL0, &byOrgDMACtl);
if (byOrgDMACtl & DMACTL_RUN) { if (byOrgDMACtl & DMACTL_RUN) {
VNSvOutPortB(dwIoBase + MAC_REG_RXDMACTL0+2, DMACTL_RUN); VNSvOutPortB(dwIoBase + MAC_REG_RXDMACTL0+2, DMACTL_RUN);
} }
for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
VNSvInPortB(dwIoBase + MAC_REG_RXDMACTL0, &byData); VNSvInPortB(dwIoBase + MAC_REG_RXDMACTL0, &byData);
if ( !(byData & DMACTL_RUN)) if (!(byData & DMACTL_RUN))
break; break;
} }
if (ww == W_MAX_TIMEOUT) { if (ww == W_MAX_TIMEOUT) {
DBG_PORT80(0x13); DBG_PORT80(0x13);
} }
VNSvOutPortD(dwIoBase + MAC_REG_RXDMAPTR0, dwCurrDescAddr); VNSvOutPortD(dwIoBase + MAC_REG_RXDMAPTR0, dwCurrDescAddr);
if (byOrgDMACtl & DMACTL_RUN) { if (byOrgDMACtl & DMACTL_RUN) {
VNSvOutPortB(dwIoBase + MAC_REG_RXDMACTL0, DMACTL_RUN); VNSvOutPortB(dwIoBase + MAC_REG_RXDMACTL0, DMACTL_RUN);
} }
} }
/* /*
...@@ -1117,28 +1117,28 @@ unsigned char byOrgDMACtl; ...@@ -1117,28 +1117,28 @@ unsigned char byOrgDMACtl;
* Return Value: none * Return Value: none
* *
*/ */
void MACvSetCurrRx1DescAddr (unsigned long dwIoBase, unsigned long dwCurrDescAddr) void MACvSetCurrRx1DescAddr(unsigned long dwIoBase, unsigned long dwCurrDescAddr)
{ {
unsigned short ww; unsigned short ww;
unsigned char byData; unsigned char byData;
unsigned char byOrgDMACtl; unsigned char byOrgDMACtl;
VNSvInPortB(dwIoBase + MAC_REG_RXDMACTL1, &byOrgDMACtl); VNSvInPortB(dwIoBase + MAC_REG_RXDMACTL1, &byOrgDMACtl);
if (byOrgDMACtl & DMACTL_RUN) { if (byOrgDMACtl & DMACTL_RUN) {
VNSvOutPortB(dwIoBase + MAC_REG_RXDMACTL1+2, DMACTL_RUN); VNSvOutPortB(dwIoBase + MAC_REG_RXDMACTL1+2, DMACTL_RUN);
} }
for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
VNSvInPortB(dwIoBase + MAC_REG_RXDMACTL1, &byData); VNSvInPortB(dwIoBase + MAC_REG_RXDMACTL1, &byData);
if ( !(byData & DMACTL_RUN)) if (!(byData & DMACTL_RUN))
break; break;
} }
if (ww == W_MAX_TIMEOUT) { if (ww == W_MAX_TIMEOUT) {
DBG_PORT80(0x14); DBG_PORT80(0x14);
} }
VNSvOutPortD(dwIoBase + MAC_REG_RXDMAPTR1, dwCurrDescAddr); VNSvOutPortD(dwIoBase + MAC_REG_RXDMAPTR1, dwCurrDescAddr);
if (byOrgDMACtl & DMACTL_RUN) { if (byOrgDMACtl & DMACTL_RUN) {
VNSvOutPortB(dwIoBase + MAC_REG_RXDMACTL1, DMACTL_RUN); VNSvOutPortB(dwIoBase + MAC_REG_RXDMACTL1, DMACTL_RUN);
} }
} }
/* /*
...@@ -1155,28 +1155,28 @@ unsigned char byOrgDMACtl; ...@@ -1155,28 +1155,28 @@ unsigned char byOrgDMACtl;
* Return Value: none * Return Value: none
* *
*/ */
void MACvSetCurrTx0DescAddrEx (unsigned long dwIoBase, unsigned long dwCurrDescAddr) void MACvSetCurrTx0DescAddrEx(unsigned long dwIoBase, unsigned long dwCurrDescAddr)
{ {
unsigned short ww; unsigned short ww;
unsigned char byData; unsigned char byData;
unsigned char byOrgDMACtl; unsigned char byOrgDMACtl;
VNSvInPortB(dwIoBase + MAC_REG_TXDMACTL0, &byOrgDMACtl); VNSvInPortB(dwIoBase + MAC_REG_TXDMACTL0, &byOrgDMACtl);
if (byOrgDMACtl & DMACTL_RUN) { if (byOrgDMACtl & DMACTL_RUN) {
VNSvOutPortB(dwIoBase + MAC_REG_TXDMACTL0+2, DMACTL_RUN); VNSvOutPortB(dwIoBase + MAC_REG_TXDMACTL0+2, DMACTL_RUN);
} }
for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
VNSvInPortB(dwIoBase + MAC_REG_TXDMACTL0, &byData); VNSvInPortB(dwIoBase + MAC_REG_TXDMACTL0, &byData);
if ( !(byData & DMACTL_RUN)) if (!(byData & DMACTL_RUN))
break; break;
} }
if (ww == W_MAX_TIMEOUT) { if (ww == W_MAX_TIMEOUT) {
DBG_PORT80(0x25); DBG_PORT80(0x25);
} }
VNSvOutPortD(dwIoBase + MAC_REG_TXDMAPTR0, dwCurrDescAddr); VNSvOutPortD(dwIoBase + MAC_REG_TXDMAPTR0, dwCurrDescAddr);
if (byOrgDMACtl & DMACTL_RUN) { if (byOrgDMACtl & DMACTL_RUN) {
VNSvOutPortB(dwIoBase + MAC_REG_TXDMACTL0, DMACTL_RUN); VNSvOutPortB(dwIoBase + MAC_REG_TXDMACTL0, DMACTL_RUN);
} }
} }
/* /*
...@@ -1193,41 +1193,41 @@ unsigned char byOrgDMACtl; ...@@ -1193,41 +1193,41 @@ unsigned char byOrgDMACtl;
* Return Value: none * Return Value: none
* *
*/ */
//TxDMA1 = AC0DMA //TxDMA1 = AC0DMA
void MACvSetCurrAC0DescAddrEx (unsigned long dwIoBase, unsigned long dwCurrDescAddr) void MACvSetCurrAC0DescAddrEx(unsigned long dwIoBase, unsigned long dwCurrDescAddr)
{ {
unsigned short ww; unsigned short ww;
unsigned char byData; unsigned char byData;
unsigned char byOrgDMACtl; unsigned char byOrgDMACtl;
VNSvInPortB(dwIoBase + MAC_REG_AC0DMACTL, &byOrgDMACtl); VNSvInPortB(dwIoBase + MAC_REG_AC0DMACTL, &byOrgDMACtl);
if (byOrgDMACtl & DMACTL_RUN) { if (byOrgDMACtl & DMACTL_RUN) {
VNSvOutPortB(dwIoBase + MAC_REG_AC0DMACTL+2, DMACTL_RUN); VNSvOutPortB(dwIoBase + MAC_REG_AC0DMACTL+2, DMACTL_RUN);
} }
for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
VNSvInPortB(dwIoBase + MAC_REG_AC0DMACTL, &byData); VNSvInPortB(dwIoBase + MAC_REG_AC0DMACTL, &byData);
if (!(byData & DMACTL_RUN)) if (!(byData & DMACTL_RUN))
break; break;
} }
if (ww == W_MAX_TIMEOUT) { if (ww == W_MAX_TIMEOUT) {
DBG_PORT80(0x26); DBG_PORT80(0x26);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x26)\n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x26)\n");
} }
VNSvOutPortD(dwIoBase + MAC_REG_AC0DMAPTR, dwCurrDescAddr); VNSvOutPortD(dwIoBase + MAC_REG_AC0DMAPTR, dwCurrDescAddr);
if (byOrgDMACtl & DMACTL_RUN) { if (byOrgDMACtl & DMACTL_RUN) {
VNSvOutPortB(dwIoBase + MAC_REG_AC0DMACTL, DMACTL_RUN); VNSvOutPortB(dwIoBase + MAC_REG_AC0DMACTL, DMACTL_RUN);
} }
} }
void MACvSetCurrTXDescAddr (int iTxType, unsigned long dwIoBase, unsigned long dwCurrDescAddr) void MACvSetCurrTXDescAddr(int iTxType, unsigned long dwIoBase, unsigned long dwCurrDescAddr)
{ {
if(iTxType == TYPE_AC0DMA){ if (iTxType == TYPE_AC0DMA) {
MACvSetCurrAC0DescAddrEx(dwIoBase, dwCurrDescAddr); MACvSetCurrAC0DescAddrEx(dwIoBase, dwCurrDescAddr);
}else if(iTxType == TYPE_TXDMA0){ } else if (iTxType == TYPE_TXDMA0) {
MACvSetCurrTx0DescAddrEx(dwIoBase, dwCurrDescAddr); MACvSetCurrTx0DescAddrEx(dwIoBase, dwCurrDescAddr);
} }
} }
/* /*
...@@ -1244,25 +1244,25 @@ void MACvSetCurrTXDescAddr (int iTxType, unsigned long dwIoBase, unsigned long d ...@@ -1244,25 +1244,25 @@ void MACvSetCurrTXDescAddr (int iTxType, unsigned long dwIoBase, unsigned long d
* Return Value: none * Return Value: none
* *
*/ */
void MACvTimer0MicroSDelay (unsigned long dwIoBase, unsigned int uDelay) void MACvTimer0MicroSDelay(unsigned long dwIoBase, unsigned int uDelay)
{ {
unsigned char byValue; unsigned char byValue;
unsigned int uu,ii; unsigned int uu, ii;
VNSvOutPortB(dwIoBase + MAC_REG_TMCTL0, 0); VNSvOutPortB(dwIoBase + MAC_REG_TMCTL0, 0);
VNSvOutPortD(dwIoBase + MAC_REG_TMDATA0, uDelay); VNSvOutPortD(dwIoBase + MAC_REG_TMDATA0, uDelay);
VNSvOutPortB(dwIoBase + MAC_REG_TMCTL0, (TMCTL_TMD | TMCTL_TE)); VNSvOutPortB(dwIoBase + MAC_REG_TMCTL0, (TMCTL_TMD | TMCTL_TE));
for(ii=0;ii<66;ii++) { // assume max PCI clock is 66Mhz for (ii = 0; ii < 66; ii++) { // assume max PCI clock is 66Mhz
for (uu = 0; uu < uDelay; uu++) { for (uu = 0; uu < uDelay; uu++) {
VNSvInPortB(dwIoBase + MAC_REG_TMCTL0, &byValue); VNSvInPortB(dwIoBase + MAC_REG_TMCTL0, &byValue);
if ((byValue == 0) || if ((byValue == 0) ||
(byValue & TMCTL_TSUSP)) { (byValue & TMCTL_TSUSP)) {
VNSvOutPortB(dwIoBase + MAC_REG_TMCTL0, 0); VNSvOutPortB(dwIoBase + MAC_REG_TMCTL0, 0);
return; return;
} }
} }
} }
VNSvOutPortB(dwIoBase + MAC_REG_TMCTL0, 0); VNSvOutPortB(dwIoBase + MAC_REG_TMCTL0, 0);
} }
...@@ -1280,11 +1280,11 @@ unsigned int uu,ii; ...@@ -1280,11 +1280,11 @@ unsigned int uu,ii;
* Return Value: none * Return Value: none
* *
*/ */
void MACvOneShotTimer0MicroSec (unsigned long dwIoBase, unsigned int uDelayTime) void MACvOneShotTimer0MicroSec(unsigned long dwIoBase, unsigned int uDelayTime)
{ {
VNSvOutPortB(dwIoBase + MAC_REG_TMCTL0, 0); VNSvOutPortB(dwIoBase + MAC_REG_TMCTL0, 0);
VNSvOutPortD(dwIoBase + MAC_REG_TMDATA0, uDelayTime); VNSvOutPortD(dwIoBase + MAC_REG_TMDATA0, uDelayTime);
VNSvOutPortB(dwIoBase + MAC_REG_TMCTL0, (TMCTL_TMD | TMCTL_TE)); VNSvOutPortB(dwIoBase + MAC_REG_TMCTL0, (TMCTL_TMD | TMCTL_TE));
} }
/* /*
...@@ -1301,143 +1301,143 @@ void MACvOneShotTimer0MicroSec (unsigned long dwIoBase, unsigned int uDelayTime) ...@@ -1301,143 +1301,143 @@ void MACvOneShotTimer0MicroSec (unsigned long dwIoBase, unsigned int uDelayTime)
* Return Value: none * Return Value: none
* *
*/ */
void MACvOneShotTimer1MicroSec (unsigned long dwIoBase, unsigned int uDelayTime) void MACvOneShotTimer1MicroSec(unsigned long dwIoBase, unsigned int uDelayTime)
{ {
VNSvOutPortB(dwIoBase + MAC_REG_TMCTL1, 0); VNSvOutPortB(dwIoBase + MAC_REG_TMCTL1, 0);
VNSvOutPortD(dwIoBase + MAC_REG_TMDATA1, uDelayTime); VNSvOutPortD(dwIoBase + MAC_REG_TMDATA1, uDelayTime);
VNSvOutPortB(dwIoBase + MAC_REG_TMCTL1, (TMCTL_TMD | TMCTL_TE)); VNSvOutPortB(dwIoBase + MAC_REG_TMCTL1, (TMCTL_TMD | TMCTL_TE));
} }
void MACvSetMISCFifo (unsigned long dwIoBase, unsigned short wOffset, unsigned long dwData) void MACvSetMISCFifo(unsigned long dwIoBase, unsigned short wOffset, unsigned long dwData)
{ {
if (wOffset > 273) if (wOffset > 273)
return; return;
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset);
VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData); VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData);
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
} }
bool MACbTxDMAOff (unsigned long dwIoBase, unsigned int idx) bool MACbTxDMAOff(unsigned long dwIoBase, unsigned int idx)
{ {
unsigned char byData; unsigned char byData;
unsigned int ww = 0; unsigned int ww = 0;
if (idx == TYPE_TXDMA0) { if (idx == TYPE_TXDMA0) {
VNSvOutPortB(dwIoBase + MAC_REG_TXDMACTL0+2, DMACTL_RUN); VNSvOutPortB(dwIoBase + MAC_REG_TXDMACTL0+2, DMACTL_RUN);
for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
VNSvInPortB(dwIoBase + MAC_REG_TXDMACTL0, &byData); VNSvInPortB(dwIoBase + MAC_REG_TXDMACTL0, &byData);
if ( !(byData & DMACTL_RUN)) if (!(byData & DMACTL_RUN))
break; break;
} }
} else if (idx == TYPE_AC0DMA) { } else if (idx == TYPE_AC0DMA) {
VNSvOutPortB(dwIoBase + MAC_REG_AC0DMACTL+2, DMACTL_RUN); VNSvOutPortB(dwIoBase + MAC_REG_AC0DMACTL+2, DMACTL_RUN);
for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
VNSvInPortB(dwIoBase + MAC_REG_AC0DMACTL, &byData); VNSvInPortB(dwIoBase + MAC_REG_AC0DMACTL, &byData);
if ( !(byData & DMACTL_RUN)) if (!(byData & DMACTL_RUN))
break; break;
} }
} }
if (ww == W_MAX_TIMEOUT) { if (ww == W_MAX_TIMEOUT) {
DBG_PORT80(0x29); DBG_PORT80(0x29);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x29)\n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x29)\n");
return false; return false;
} }
return true; return true;
} }
void MACvClearBusSusInd (unsigned long dwIoBase) void MACvClearBusSusInd(unsigned long dwIoBase)
{ {
unsigned long dwOrgValue; unsigned long dwOrgValue;
unsigned int ww; unsigned int ww;
// check if BcnSusInd enabled // check if BcnSusInd enabled
VNSvInPortD(dwIoBase + MAC_REG_ENCFG , &dwOrgValue); VNSvInPortD(dwIoBase + MAC_REG_ENCFG , &dwOrgValue);
if( !(dwOrgValue & EnCFG_BcnSusInd)) if (!(dwOrgValue & EnCFG_BcnSusInd))
return; return;
//Set BcnSusClr //Set BcnSusClr
dwOrgValue = dwOrgValue | EnCFG_BcnSusClr; dwOrgValue = dwOrgValue | EnCFG_BcnSusClr;
VNSvOutPortD(dwIoBase + MAC_REG_ENCFG, dwOrgValue); VNSvOutPortD(dwIoBase + MAC_REG_ENCFG, dwOrgValue);
for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
VNSvInPortD(dwIoBase + MAC_REG_ENCFG , &dwOrgValue); VNSvInPortD(dwIoBase + MAC_REG_ENCFG , &dwOrgValue);
if( !(dwOrgValue & EnCFG_BcnSusInd)) if (!(dwOrgValue & EnCFG_BcnSusInd))
break; break;
} }
if (ww == W_MAX_TIMEOUT) { if (ww == W_MAX_TIMEOUT) {
DBG_PORT80(0x33); DBG_PORT80(0x33);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x33)\n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x33)\n");
} }
} }
void MACvEnableBusSusEn (unsigned long dwIoBase) void MACvEnableBusSusEn(unsigned long dwIoBase)
{ {
unsigned char byOrgValue; unsigned char byOrgValue;
unsigned long dwOrgValue; unsigned long dwOrgValue;
unsigned int ww; unsigned int ww;
// check if BcnSusInd enabled // check if BcnSusInd enabled
VNSvInPortB(dwIoBase + MAC_REG_CFG , &byOrgValue); VNSvInPortB(dwIoBase + MAC_REG_CFG , &byOrgValue);
//Set BcnSusEn //Set BcnSusEn
byOrgValue = byOrgValue | CFG_BCNSUSEN; byOrgValue = byOrgValue | CFG_BCNSUSEN;
VNSvOutPortB(dwIoBase + MAC_REG_ENCFG, byOrgValue); VNSvOutPortB(dwIoBase + MAC_REG_ENCFG, byOrgValue);
for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
VNSvInPortD(dwIoBase + MAC_REG_ENCFG , &dwOrgValue); VNSvInPortD(dwIoBase + MAC_REG_ENCFG , &dwOrgValue);
if(dwOrgValue & EnCFG_BcnSusInd) if (dwOrgValue & EnCFG_BcnSusInd)
break; break;
} }
if (ww == W_MAX_TIMEOUT) { if (ww == W_MAX_TIMEOUT) {
DBG_PORT80(0x34); DBG_PORT80(0x34);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x34)\n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x34)\n");
} }
} }
bool MACbFlushSYNCFifo (unsigned long dwIoBase) bool MACbFlushSYNCFifo(unsigned long dwIoBase)
{ {
unsigned char byOrgValue; unsigned char byOrgValue;
unsigned int ww; unsigned int ww;
// Read MACCR // Read MACCR
VNSvInPortB(dwIoBase + MAC_REG_MACCR , &byOrgValue); VNSvInPortB(dwIoBase + MAC_REG_MACCR , &byOrgValue);
// Set SYNCFLUSH // Set SYNCFLUSH
byOrgValue = byOrgValue | MACCR_SYNCFLUSH; byOrgValue = byOrgValue | MACCR_SYNCFLUSH;
VNSvOutPortB(dwIoBase + MAC_REG_MACCR, byOrgValue); VNSvOutPortB(dwIoBase + MAC_REG_MACCR, byOrgValue);
// Check if SyncFlushOK // Check if SyncFlushOK
for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
VNSvInPortB(dwIoBase + MAC_REG_MACCR , &byOrgValue); VNSvInPortB(dwIoBase + MAC_REG_MACCR , &byOrgValue);
if(byOrgValue & MACCR_SYNCFLUSHOK) if (byOrgValue & MACCR_SYNCFLUSHOK)
break; break;
} }
if (ww == W_MAX_TIMEOUT) { if (ww == W_MAX_TIMEOUT) {
DBG_PORT80(0x35); DBG_PORT80(0x35);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x33)\n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x33)\n");
} }
return true; return true;
} }
bool MACbPSWakeup (unsigned long dwIoBase) bool MACbPSWakeup(unsigned long dwIoBase)
{ {
unsigned char byOrgValue; unsigned char byOrgValue;
unsigned int ww; unsigned int ww;
// Read PSCTL // Read PSCTL
if (MACbIsRegBitsOff(dwIoBase, MAC_REG_PSCTL, PSCTL_PS)) { if (MACbIsRegBitsOff(dwIoBase, MAC_REG_PSCTL, PSCTL_PS)) {
return true; return true;
} }
// Disable PS // Disable PS
MACvRegBitsOff(dwIoBase, MAC_REG_PSCTL, PSCTL_PSEN); MACvRegBitsOff(dwIoBase, MAC_REG_PSCTL, PSCTL_PSEN);
// Check if SyncFlushOK // Check if SyncFlushOK
for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
VNSvInPortB(dwIoBase + MAC_REG_PSCTL , &byOrgValue); VNSvInPortB(dwIoBase + MAC_REG_PSCTL , &byOrgValue);
if(byOrgValue & PSCTL_WAKEDONE) if (byOrgValue & PSCTL_WAKEDONE)
break; break;
} }
if (ww == W_MAX_TIMEOUT) { if (ww == W_MAX_TIMEOUT) {
DBG_PORT80(0x36); DBG_PORT80(0x36);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x33)\n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x33)\n");
return false; return false;
} }
return true; return true;
} }
/* /*
...@@ -1455,55 +1455,55 @@ bool MACbPSWakeup (unsigned long dwIoBase) ...@@ -1455,55 +1455,55 @@ bool MACbPSWakeup (unsigned long dwIoBase)
* *
*/ */
void MACvSetKeyEntry (unsigned long dwIoBase, unsigned short wKeyCtl, unsigned int uEntryIdx, void MACvSetKeyEntry(unsigned long dwIoBase, unsigned short wKeyCtl, unsigned int uEntryIdx,
unsigned int uKeyIdx, unsigned char *pbyAddr, unsigned long *pdwKey, unsigned char byLocalID) unsigned int uKeyIdx, unsigned char *pbyAddr, unsigned long *pdwKey, unsigned char byLocalID)
{ {
unsigned short wOffset; unsigned short wOffset;
unsigned long dwData; unsigned long dwData;
int ii; int ii;
if (byLocalID <= 1) if (byLocalID <= 1)
return; return;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MACvSetKeyEntry\n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MACvSetKeyEntry\n");
wOffset = MISCFIFO_KEYETRY0; wOffset = MISCFIFO_KEYETRY0;
wOffset += (uEntryIdx * MISCFIFO_KEYENTRYSIZE); wOffset += (uEntryIdx * MISCFIFO_KEYENTRYSIZE);
dwData = 0; dwData = 0;
dwData |= wKeyCtl; dwData |= wKeyCtl;
dwData <<= 16; dwData <<= 16;
dwData |= MAKEWORD(*(pbyAddr+4), *(pbyAddr+5)); dwData |= MAKEWORD(*(pbyAddr+4), *(pbyAddr+5));
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"1. wOffset: %d, Data: %lX, KeyCtl:%X\n", wOffset, dwData, wKeyCtl); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "1. wOffset: %d, Data: %lX, KeyCtl:%X\n", wOffset, dwData, wKeyCtl);
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset);
VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData); VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData);
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
wOffset++; wOffset++;
dwData = 0; dwData = 0;
dwData |= *(pbyAddr+3); dwData |= *(pbyAddr+3);
dwData <<= 8; dwData <<= 8;
dwData |= *(pbyAddr+2); dwData |= *(pbyAddr+2);
dwData <<= 8; dwData <<= 8;
dwData |= *(pbyAddr+1); dwData |= *(pbyAddr+1);
dwData <<= 8; dwData <<= 8;
dwData |= *(pbyAddr+0); dwData |= *(pbyAddr+0);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"2. wOffset: %d, Data: %lX\n", wOffset, dwData); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "2. wOffset: %d, Data: %lX\n", wOffset, dwData);
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset);
VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData); VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData);
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
wOffset++; wOffset++;
wOffset += (uKeyIdx * 4); wOffset += (uKeyIdx * 4);
for (ii=0;ii<4;ii++) { for (ii = 0; ii < 4; ii++) {
// always push 128 bits // always push 128 bits
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"3.(%d) wOffset: %d, Data: %lX\n", ii, wOffset+ii, *pdwKey); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "3.(%d) wOffset: %d, Data: %lX\n", ii, wOffset+ii, *pdwKey);
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset+ii); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset+ii);
VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, *pdwKey++); VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, *pdwKey++);
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
} }
} }
...@@ -1522,16 +1522,16 @@ int ii; ...@@ -1522,16 +1522,16 @@ int ii;
* Return Value: none * Return Value: none
* *
*/ */
void MACvDisableKeyEntry (unsigned long dwIoBase, unsigned int uEntryIdx) void MACvDisableKeyEntry(unsigned long dwIoBase, unsigned int uEntryIdx)
{ {
unsigned short wOffset; unsigned short wOffset;
wOffset = MISCFIFO_KEYETRY0; wOffset = MISCFIFO_KEYETRY0;
wOffset += (uEntryIdx * MISCFIFO_KEYENTRYSIZE); wOffset += (uEntryIdx * MISCFIFO_KEYENTRYSIZE);
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset);
VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, 0); VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, 0);
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
} }
...@@ -1550,38 +1550,38 @@ unsigned short wOffset; ...@@ -1550,38 +1550,38 @@ unsigned short wOffset;
* *
*/ */
void MACvSetDefaultKeyEntry (unsigned long dwIoBase, unsigned int uKeyLen, void MACvSetDefaultKeyEntry(unsigned long dwIoBase, unsigned int uKeyLen,
unsigned int uKeyIdx, unsigned long *pdwKey, unsigned char byLocalID) unsigned int uKeyIdx, unsigned long *pdwKey, unsigned char byLocalID)
{ {
unsigned short wOffset; unsigned short wOffset;
unsigned long dwData; unsigned long dwData;
int ii; int ii;
if (byLocalID <= 1) if (byLocalID <= 1)
return; return;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MACvSetDefaultKeyEntry\n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MACvSetDefaultKeyEntry\n");
wOffset = MISCFIFO_KEYETRY0; wOffset = MISCFIFO_KEYETRY0;
wOffset += (10 * MISCFIFO_KEYENTRYSIZE); wOffset += (10 * MISCFIFO_KEYENTRYSIZE);
wOffset++; wOffset++;
wOffset++; wOffset++;
wOffset += (uKeyIdx * 4); wOffset += (uKeyIdx * 4);
// always push 128 bits // always push 128 bits
for (ii=0; ii<3; ii++) { for (ii = 0; ii < 3; ii++) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"(%d) wOffset: %d, Data: %lX\n", ii, wOffset+ii, *pdwKey); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "(%d) wOffset: %d, Data: %lX\n", ii, wOffset+ii, *pdwKey);
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset+ii); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset+ii);
VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, *pdwKey++); VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, *pdwKey++);
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
} }
dwData = *pdwKey; dwData = *pdwKey;
if (uKeyLen == WLAN_WEP104_KEYLEN) { if (uKeyLen == WLAN_WEP104_KEYLEN) {
dwData |= 0x80000000; dwData |= 0x80000000;
} }
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset+3); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset+3);
VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData); VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData);
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"End. wOffset: %d, Data: %lX\n", wOffset+3, dwData); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "End. wOffset: %d, Data: %lX\n", wOffset+3, dwData);
} }
...@@ -1601,25 +1601,25 @@ int ii; ...@@ -1601,25 +1601,25 @@ int ii;
* *
*/ */
/* /*
void MACvEnableDefaultKey (unsigned long dwIoBase, unsigned char byLocalID) void MACvEnableDefaultKey(unsigned long dwIoBase, unsigned char byLocalID)
{ {
unsigned short wOffset; unsigned short wOffset;
unsigned long dwData; unsigned long dwData;
if (byLocalID <= 1) if (byLocalID <= 1)
return; return;
wOffset = MISCFIFO_KEYETRY0; wOffset = MISCFIFO_KEYETRY0;
wOffset += (10 * MISCFIFO_KEYENTRYSIZE); wOffset += (10 * MISCFIFO_KEYENTRYSIZE);
dwData = 0xC0440000; dwData = 0xC0440000;
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset);
VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData); VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData);
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MACvEnableDefaultKey: wOffset: %d, Data: %lX\n", wOffset, dwData); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MACvEnableDefaultKey: wOffset: %d, Data: %lX\n", wOffset, dwData);
} }
*/ */
/* /*
...@@ -1636,20 +1636,20 @@ unsigned long dwData; ...@@ -1636,20 +1636,20 @@ unsigned long dwData;
* Return Value: none * Return Value: none
* *
*/ */
void MACvDisableDefaultKey (unsigned long dwIoBase) void MACvDisableDefaultKey(unsigned long dwIoBase)
{ {
unsigned short wOffset; unsigned short wOffset;
unsigned long dwData; unsigned long dwData;
wOffset = MISCFIFO_KEYETRY0; wOffset = MISCFIFO_KEYETRY0;
wOffset += (10 * MISCFIFO_KEYENTRYSIZE); wOffset += (10 * MISCFIFO_KEYENTRYSIZE);
dwData = 0x0; dwData = 0x0;
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset);
VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData); VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData);
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MACvDisableDefaultKey: wOffset: %d, Data: %lX\n", wOffset, dwData); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MACvDisableDefaultKey: wOffset: %d, Data: %lX\n", wOffset, dwData);
} }
/* /*
...@@ -1666,43 +1666,43 @@ unsigned long dwData; ...@@ -1666,43 +1666,43 @@ unsigned long dwData;
* Return Value: none * Return Value: none
* *
*/ */
void MACvSetDefaultTKIPKeyEntry (unsigned long dwIoBase, unsigned int uKeyLen, void MACvSetDefaultTKIPKeyEntry(unsigned long dwIoBase, unsigned int uKeyLen,
unsigned int uKeyIdx, unsigned long *pdwKey, unsigned char byLocalID) unsigned int uKeyIdx, unsigned long *pdwKey, unsigned char byLocalID)
{ {
unsigned short wOffset; unsigned short wOffset;
unsigned long dwData; unsigned long dwData;
int ii; int ii;
if (byLocalID <= 1) if (byLocalID <= 1)
return; return;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MACvSetDefaultTKIPKeyEntry\n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MACvSetDefaultTKIPKeyEntry\n");
wOffset = MISCFIFO_KEYETRY0; wOffset = MISCFIFO_KEYETRY0;
// Kyle test : change offset from 10 -> 0 // Kyle test : change offset from 10 -> 0
wOffset += (10 * MISCFIFO_KEYENTRYSIZE); wOffset += (10 * MISCFIFO_KEYENTRYSIZE);
dwData = 0xC0660000; dwData = 0xC0660000;
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset);
VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData); VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData);
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
wOffset++; wOffset++;
dwData = 0; dwData = 0;
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset);
VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData); VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData);
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
wOffset++; wOffset++;
wOffset += (uKeyIdx * 4); wOffset += (uKeyIdx * 4);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"1. wOffset: %d, Data: %lX, idx:%d\n", wOffset, *pdwKey, uKeyIdx); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "1. wOffset: %d, Data: %lX, idx:%d\n", wOffset, *pdwKey, uKeyIdx);
// always push 128 bits // always push 128 bits
for (ii=0; ii<4; ii++) { for (ii = 0; ii < 4; ii++) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"2.(%d) wOffset: %d, Data: %lX\n", ii, wOffset+ii, *pdwKey); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "2.(%d) wOffset: %d, Data: %lX\n", ii, wOffset+ii, *pdwKey);
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset+ii); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset+ii);
VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, *pdwKey++); VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, *pdwKey++);
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
} }
} }
...@@ -1723,28 +1723,28 @@ int ii; ...@@ -1723,28 +1723,28 @@ int ii;
* *
*/ */
void MACvSetDefaultKeyCtl (unsigned long dwIoBase, unsigned short wKeyCtl, unsigned int uEntryIdx, unsigned char byLocalID) void MACvSetDefaultKeyCtl(unsigned long dwIoBase, unsigned short wKeyCtl, unsigned int uEntryIdx, unsigned char byLocalID)
{ {
unsigned short wOffset; unsigned short wOffset;
unsigned long dwData; unsigned long dwData;
if (byLocalID <= 1) if (byLocalID <= 1)
return; return;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MACvSetKeyEntry\n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MACvSetKeyEntry\n");
wOffset = MISCFIFO_KEYETRY0; wOffset = MISCFIFO_KEYETRY0;
wOffset += (uEntryIdx * MISCFIFO_KEYENTRYSIZE); wOffset += (uEntryIdx * MISCFIFO_KEYENTRYSIZE);
dwData = 0; dwData = 0;
dwData |= wKeyCtl; dwData |= wKeyCtl;
dwData <<= 16; dwData <<= 16;
dwData |= 0xffff; dwData |= 0xffff;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"1. wOffset: %d, Data: %lX, KeyCtl:%X\n", wOffset, dwData, wKeyCtl); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "1. wOffset: %d, Data: %lX, KeyCtl:%X\n", wOffset, dwData, wKeyCtl);
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset);
VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData); VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData);
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
} }
...@@ -604,20 +604,20 @@ ...@@ -604,20 +604,20 @@
#define MISCFIFO_SYNDATASIZE 21 #define MISCFIFO_SYNDATASIZE 21
// enabled mask value of irq // enabled mask value of irq
#define IMR_MASK_VALUE (IMR_SOFTTIMER1 | \ #define IMR_MASK_VALUE (IMR_SOFTTIMER1 | \
IMR_RXDMA1 | \ IMR_RXDMA1 | \
IMR_RXNOBUF | \ IMR_RXNOBUF | \
IMR_MIBNEARFULL | \ IMR_MIBNEARFULL | \
IMR_SOFTINT | \ IMR_SOFTINT | \
IMR_FETALERR | \ IMR_FETALERR | \
IMR_WATCHDOG | \ IMR_WATCHDOG | \
IMR_SOFTTIMER | \ IMR_SOFTTIMER | \
IMR_GPIO | \ IMR_GPIO | \
IMR_TBTT | \ IMR_TBTT | \
IMR_RXDMA0 | \ IMR_RXDMA0 | \
IMR_BNTX | \ IMR_BNTX | \
IMR_AC0DMA | \ IMR_AC0DMA | \
IMR_TXDMA0) IMR_TXDMA0)
// max time out delay time // max time out delay time
#define W_MAX_TIMEOUT 0xFFF0U // #define W_MAX_TIMEOUT 0xFFF0U //
...@@ -637,412 +637,412 @@ ...@@ -637,412 +637,412 @@
/*--------------------- Export Macros ------------------------------*/ /*--------------------- Export Macros ------------------------------*/
#define MACvRegBitsOn(dwIoBase, byRegOfs, byBits) \ #define MACvRegBitsOn(dwIoBase, byRegOfs, byBits) \
{ \ { \
unsigned char byData; \ unsigned char byData; \
VNSvInPortB(dwIoBase + byRegOfs, &byData); \ VNSvInPortB(dwIoBase + byRegOfs, &byData); \
VNSvOutPortB(dwIoBase + byRegOfs, byData | (byBits)); \ VNSvOutPortB(dwIoBase + byRegOfs, byData | (byBits)); \
} }
#define MACvWordRegBitsOn(dwIoBase, byRegOfs, wBits) \ #define MACvWordRegBitsOn(dwIoBase, byRegOfs, wBits) \
{ \ { \
unsigned short wData; \ unsigned short wData; \
VNSvInPortW(dwIoBase + byRegOfs, &wData); \ VNSvInPortW(dwIoBase + byRegOfs, &wData); \
VNSvOutPortW(dwIoBase + byRegOfs, wData | (wBits)); \ VNSvOutPortW(dwIoBase + byRegOfs, wData | (wBits)); \
} }
#define MACvDWordRegBitsOn(dwIoBase, byRegOfs, dwBits) \ #define MACvDWordRegBitsOn(dwIoBase, byRegOfs, dwBits) \
{ \ { \
unsigned long dwData; \ unsigned long dwData; \
VNSvInPortD(dwIoBase + byRegOfs, &dwData); \ VNSvInPortD(dwIoBase + byRegOfs, &dwData); \
VNSvOutPortD(dwIoBase + byRegOfs, dwData | (dwBits)); \ VNSvOutPortD(dwIoBase + byRegOfs, dwData | (dwBits)); \
} }
#define MACvRegBitsOnEx(dwIoBase, byRegOfs, byMask, byBits) \ #define MACvRegBitsOnEx(dwIoBase, byRegOfs, byMask, byBits) \
{ \ { \
unsigned char byData; \ unsigned char byData; \
VNSvInPortB(dwIoBase + byRegOfs, &byData); \ VNSvInPortB(dwIoBase + byRegOfs, &byData); \
byData &= byMask; \ byData &= byMask; \
VNSvOutPortB(dwIoBase + byRegOfs, byData | (byBits)); \ VNSvOutPortB(dwIoBase + byRegOfs, byData | (byBits)); \
} }
#define MACvRegBitsOff(dwIoBase, byRegOfs, byBits) \ #define MACvRegBitsOff(dwIoBase, byRegOfs, byBits) \
{ \ { \
unsigned char byData; \ unsigned char byData; \
VNSvInPortB(dwIoBase + byRegOfs, &byData); \ VNSvInPortB(dwIoBase + byRegOfs, &byData); \
VNSvOutPortB(dwIoBase + byRegOfs, byData & ~(byBits)); \ VNSvOutPortB(dwIoBase + byRegOfs, byData & ~(byBits)); \
} }
#define MACvWordRegBitsOff(dwIoBase, byRegOfs, wBits) \ #define MACvWordRegBitsOff(dwIoBase, byRegOfs, wBits) \
{ \ { \
unsigned short wData; \ unsigned short wData; \
VNSvInPortW(dwIoBase + byRegOfs, &wData); \ VNSvInPortW(dwIoBase + byRegOfs, &wData); \
VNSvOutPortW(dwIoBase + byRegOfs, wData & ~(wBits)); \ VNSvOutPortW(dwIoBase + byRegOfs, wData & ~(wBits)); \
} }
#define MACvDWordRegBitsOff(dwIoBase, byRegOfs, dwBits) \ #define MACvDWordRegBitsOff(dwIoBase, byRegOfs, dwBits) \
{ \ { \
unsigned long dwData; \ unsigned long dwData; \
VNSvInPortD(dwIoBase + byRegOfs, &dwData); \ VNSvInPortD(dwIoBase + byRegOfs, &dwData); \
VNSvOutPortD(dwIoBase + byRegOfs, dwData & ~(dwBits)); \ VNSvOutPortD(dwIoBase + byRegOfs, dwData & ~(dwBits)); \
} }
#define MACvGetCurrRx0DescAddr(dwIoBase, pdwCurrDescAddr) \ #define MACvGetCurrRx0DescAddr(dwIoBase, pdwCurrDescAddr) \
{ \ { \
VNSvInPortD(dwIoBase + MAC_REG_RXDMAPTR0, \ VNSvInPortD(dwIoBase + MAC_REG_RXDMAPTR0, \
(unsigned long *)pdwCurrDescAddr); \ (unsigned long *)pdwCurrDescAddr); \
} }
#define MACvGetCurrRx1DescAddr(dwIoBase, pdwCurrDescAddr) \ #define MACvGetCurrRx1DescAddr(dwIoBase, pdwCurrDescAddr) \
{ \ { \
VNSvInPortD(dwIoBase + MAC_REG_RXDMAPTR1, \ VNSvInPortD(dwIoBase + MAC_REG_RXDMAPTR1, \
(unsigned long *)pdwCurrDescAddr); \ (unsigned long *)pdwCurrDescAddr); \
} }
#define MACvGetCurrTx0DescAddr(dwIoBase, pdwCurrDescAddr) \ #define MACvGetCurrTx0DescAddr(dwIoBase, pdwCurrDescAddr) \
{ \ { \
VNSvInPortD(dwIoBase + MAC_REG_TXDMAPTR0, \ VNSvInPortD(dwIoBase + MAC_REG_TXDMAPTR0, \
(unsigned long *)pdwCurrDescAddr); \ (unsigned long *)pdwCurrDescAddr); \
} }
#define MACvGetCurrAC0DescAddr(dwIoBase, pdwCurrDescAddr) \ #define MACvGetCurrAC0DescAddr(dwIoBase, pdwCurrDescAddr) \
{ \ { \
VNSvInPortD(dwIoBase + MAC_REG_AC0DMAPTR, \ VNSvInPortD(dwIoBase + MAC_REG_AC0DMAPTR, \
(unsigned long *)pdwCurrDescAddr); \ (unsigned long *)pdwCurrDescAddr); \
} }
#define MACvGetCurrSyncDescAddr(dwIoBase, pdwCurrDescAddr) \ #define MACvGetCurrSyncDescAddr(dwIoBase, pdwCurrDescAddr) \
{ \ { \
VNSvInPortD(dwIoBase + MAC_REG_SYNCDMAPTR, \ VNSvInPortD(dwIoBase + MAC_REG_SYNCDMAPTR, \
(unsigned long *)pdwCurrDescAddr); \ (unsigned long *)pdwCurrDescAddr); \
} }
#define MACvGetCurrATIMDescAddr(dwIoBase, pdwCurrDescAddr) \ #define MACvGetCurrATIMDescAddr(dwIoBase, pdwCurrDescAddr) \
{ \ { \
VNSvInPortD(dwIoBase + MAC_REG_ATIMDMAPTR, \ VNSvInPortD(dwIoBase + MAC_REG_ATIMDMAPTR, \
(unsigned long *)pdwCurrDescAddr); \ (unsigned long *)pdwCurrDescAddr); \
} \ } \
// set the chip with current BCN tx descriptor address // set the chip with current BCN tx descriptor address
#define MACvSetCurrBCNTxDescAddr(dwIoBase, dwCurrDescAddr) \ #define MACvSetCurrBCNTxDescAddr(dwIoBase, dwCurrDescAddr) \
{ \ { \
VNSvOutPortD(dwIoBase + MAC_REG_BCNDMAPTR, \ VNSvOutPortD(dwIoBase + MAC_REG_BCNDMAPTR, \
dwCurrDescAddr); \ dwCurrDescAddr); \
} }
// set the chip with current BCN length // set the chip with current BCN length
#define MACvSetCurrBCNLength(dwIoBase, wCurrBCNLength) \ #define MACvSetCurrBCNLength(dwIoBase, wCurrBCNLength) \
{ \ { \
VNSvOutPortW(dwIoBase + MAC_REG_BCNDMACTL+2, \ VNSvOutPortW(dwIoBase + MAC_REG_BCNDMACTL+2, \
wCurrBCNLength); \ wCurrBCNLength); \
} }
#define MACvReadBSSIDAddress(dwIoBase, pbyEtherAddr) \ #define MACvReadBSSIDAddress(dwIoBase, pbyEtherAddr) \
{ \ { \
VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 1); \ VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 1); \
VNSvInPortB(dwIoBase + MAC_REG_BSSID0, \ VNSvInPortB(dwIoBase + MAC_REG_BSSID0, \
(unsigned char *)pbyEtherAddr); \ (unsigned char *)pbyEtherAddr); \
VNSvInPortB(dwIoBase + MAC_REG_BSSID0 + 1, \ VNSvInPortB(dwIoBase + MAC_REG_BSSID0 + 1, \
pbyEtherAddr + 1); \ pbyEtherAddr + 1); \
VNSvInPortB(dwIoBase + MAC_REG_BSSID0 + 2, \ VNSvInPortB(dwIoBase + MAC_REG_BSSID0 + 2, \
pbyEtherAddr + 2); \ pbyEtherAddr + 2); \
VNSvInPortB(dwIoBase + MAC_REG_BSSID0 + 3, \ VNSvInPortB(dwIoBase + MAC_REG_BSSID0 + 3, \
pbyEtherAddr + 3); \ pbyEtherAddr + 3); \
VNSvInPortB(dwIoBase + MAC_REG_BSSID0 + 4, \ VNSvInPortB(dwIoBase + MAC_REG_BSSID0 + 4, \
pbyEtherAddr + 4); \ pbyEtherAddr + 4); \
VNSvInPortB(dwIoBase + MAC_REG_BSSID0 + 5, \ VNSvInPortB(dwIoBase + MAC_REG_BSSID0 + 5, \
pbyEtherAddr + 5); \ pbyEtherAddr + 5); \
VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 0); \ VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 0); \
} }
#define MACvWriteBSSIDAddress(dwIoBase, pbyEtherAddr) \ #define MACvWriteBSSIDAddress(dwIoBase, pbyEtherAddr) \
{ \ { \
VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 1); \ VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 1); \
VNSvOutPortB(dwIoBase + MAC_REG_BSSID0, \ VNSvOutPortB(dwIoBase + MAC_REG_BSSID0, \
*(pbyEtherAddr)); \ *(pbyEtherAddr)); \
VNSvOutPortB(dwIoBase + MAC_REG_BSSID0 + 1, \ VNSvOutPortB(dwIoBase + MAC_REG_BSSID0 + 1, \
*(pbyEtherAddr + 1)); \ *(pbyEtherAddr + 1)); \
VNSvOutPortB(dwIoBase + MAC_REG_BSSID0 + 2, \ VNSvOutPortB(dwIoBase + MAC_REG_BSSID0 + 2, \
*(pbyEtherAddr + 2)); \ *(pbyEtherAddr + 2)); \
VNSvOutPortB(dwIoBase + MAC_REG_BSSID0 + 3, \ VNSvOutPortB(dwIoBase + MAC_REG_BSSID0 + 3, \
*(pbyEtherAddr + 3)); \ *(pbyEtherAddr + 3)); \
VNSvOutPortB(dwIoBase + MAC_REG_BSSID0 + 4, \ VNSvOutPortB(dwIoBase + MAC_REG_BSSID0 + 4, \
*(pbyEtherAddr + 4)); \ *(pbyEtherAddr + 4)); \
VNSvOutPortB(dwIoBase + MAC_REG_BSSID0 + 5, \ VNSvOutPortB(dwIoBase + MAC_REG_BSSID0 + 5, \
*(pbyEtherAddr + 5)); \ *(pbyEtherAddr + 5)); \
VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 0); \ VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 0); \
} }
#define MACvReadEtherAddress(dwIoBase, pbyEtherAddr) \ #define MACvReadEtherAddress(dwIoBase, pbyEtherAddr) \
{ \ { \
VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 1); \ VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 1); \
VNSvInPortB(dwIoBase + MAC_REG_PAR0, \ VNSvInPortB(dwIoBase + MAC_REG_PAR0, \
(unsigned char *)pbyEtherAddr); \ (unsigned char *)pbyEtherAddr); \
VNSvInPortB(dwIoBase + MAC_REG_PAR0 + 1, \ VNSvInPortB(dwIoBase + MAC_REG_PAR0 + 1, \
pbyEtherAddr + 1); \ pbyEtherAddr + 1); \
VNSvInPortB(dwIoBase + MAC_REG_PAR0 + 2, \ VNSvInPortB(dwIoBase + MAC_REG_PAR0 + 2, \
pbyEtherAddr + 2); \ pbyEtherAddr + 2); \
VNSvInPortB(dwIoBase + MAC_REG_PAR0 + 3, \ VNSvInPortB(dwIoBase + MAC_REG_PAR0 + 3, \
pbyEtherAddr + 3); \ pbyEtherAddr + 3); \
VNSvInPortB(dwIoBase + MAC_REG_PAR0 + 4, \ VNSvInPortB(dwIoBase + MAC_REG_PAR0 + 4, \
pbyEtherAddr + 4); \ pbyEtherAddr + 4); \
VNSvInPortB(dwIoBase + MAC_REG_PAR0 + 5, \ VNSvInPortB(dwIoBase + MAC_REG_PAR0 + 5, \
pbyEtherAddr + 5); \ pbyEtherAddr + 5); \
VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 0); \ VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 0); \
} }
#define MACvWriteEtherAddress(dwIoBase, pbyEtherAddr) \ #define MACvWriteEtherAddress(dwIoBase, pbyEtherAddr) \
{ \ { \
VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 1); \ VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 1); \
VNSvOutPortB(dwIoBase + MAC_REG_PAR0, \ VNSvOutPortB(dwIoBase + MAC_REG_PAR0, \
*pbyEtherAddr); \ *pbyEtherAddr); \
VNSvOutPortB(dwIoBase + MAC_REG_PAR0 + 1, \ VNSvOutPortB(dwIoBase + MAC_REG_PAR0 + 1, \
*(pbyEtherAddr + 1)); \ *(pbyEtherAddr + 1)); \
VNSvOutPortB(dwIoBase + MAC_REG_PAR0 + 2, \ VNSvOutPortB(dwIoBase + MAC_REG_PAR0 + 2, \
*(pbyEtherAddr + 2)); \ *(pbyEtherAddr + 2)); \
VNSvOutPortB(dwIoBase + MAC_REG_PAR0 + 3, \ VNSvOutPortB(dwIoBase + MAC_REG_PAR0 + 3, \
*(pbyEtherAddr + 3)); \ *(pbyEtherAddr + 3)); \
VNSvOutPortB(dwIoBase + MAC_REG_PAR0 + 4, \ VNSvOutPortB(dwIoBase + MAC_REG_PAR0 + 4, \
*(pbyEtherAddr + 4)); \ *(pbyEtherAddr + 4)); \
VNSvOutPortB(dwIoBase + MAC_REG_PAR0 + 5, \ VNSvOutPortB(dwIoBase + MAC_REG_PAR0 + 5, \
*(pbyEtherAddr + 5)); \ *(pbyEtherAddr + 5)); \
VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 0); \ VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 0); \
} }
#define MACvClearISR(dwIoBase) \ #define MACvClearISR(dwIoBase) \
{ \ { \
VNSvOutPortD(dwIoBase + MAC_REG_ISR, IMR_MASK_VALUE); \ VNSvOutPortD(dwIoBase + MAC_REG_ISR, IMR_MASK_VALUE); \
} }
#define MACvStart(dwIoBase) \ #define MACvStart(dwIoBase) \
{ \ { \
VNSvOutPortB(dwIoBase + MAC_REG_HOSTCR, \ VNSvOutPortB(dwIoBase + MAC_REG_HOSTCR, \
(HOSTCR_MACEN | HOSTCR_RXON | HOSTCR_TXON)); \ (HOSTCR_MACEN | HOSTCR_RXON | HOSTCR_TXON)); \
} }
#define MACvRx0PerPktMode(dwIoBase) \ #define MACvRx0PerPktMode(dwIoBase) \
{ \ { \
VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL0, RX_PERPKT); \ VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL0, RX_PERPKT); \
} }
#define MACvRx0BufferFillMode(dwIoBase) \ #define MACvRx0BufferFillMode(dwIoBase) \
{ \ { \
VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL0, RX_PERPKTCLR); \ VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL0, RX_PERPKTCLR); \
} }
#define MACvRx1PerPktMode(dwIoBase) \ #define MACvRx1PerPktMode(dwIoBase) \
{ \ { \
VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL1, RX_PERPKT); \ VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL1, RX_PERPKT); \
} }
#define MACvRx1BufferFillMode(dwIoBase) \ #define MACvRx1BufferFillMode(dwIoBase) \
{ \ { \
VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL1, RX_PERPKTCLR); \ VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL1, RX_PERPKTCLR); \
} }
#define MACvRxOn(dwIoBase) \ #define MACvRxOn(dwIoBase) \
{ \ { \
MACvRegBitsOn(dwIoBase, MAC_REG_HOSTCR, HOSTCR_RXON); \ MACvRegBitsOn(dwIoBase, MAC_REG_HOSTCR, HOSTCR_RXON); \
} }
#define MACvReceive0(dwIoBase) \ #define MACvReceive0(dwIoBase) \
{ \ { \
unsigned long dwData; \ unsigned long dwData; \
VNSvInPortD(dwIoBase + MAC_REG_RXDMACTL0, &dwData); \ VNSvInPortD(dwIoBase + MAC_REG_RXDMACTL0, &dwData); \
if (dwData & DMACTL_RUN) { \ if (dwData & DMACTL_RUN) { \
VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL0, DMACTL_WAKE);\ VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL0, DMACTL_WAKE); \
} \ } \
else { \ else { \
VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL0, DMACTL_RUN); \ VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL0, DMACTL_RUN); \
} \ } \
} }
#define MACvReceive1(dwIoBase) \ #define MACvReceive1(dwIoBase) \
{ \ { \
unsigned long dwData; \ unsigned long dwData; \
VNSvInPortD(dwIoBase + MAC_REG_RXDMACTL1, &dwData); \ VNSvInPortD(dwIoBase + MAC_REG_RXDMACTL1, &dwData); \
if (dwData & DMACTL_RUN) { \ if (dwData & DMACTL_RUN) { \
VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL1, DMACTL_WAKE);\ VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL1, DMACTL_WAKE); \
} \ } \
else { \ else { \
VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL1, DMACTL_RUN); \ VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL1, DMACTL_RUN); \
} \ } \
} }
#define MACvTxOn(dwIoBase) \ #define MACvTxOn(dwIoBase) \
{ \ { \
MACvRegBitsOn(dwIoBase, MAC_REG_HOSTCR, HOSTCR_TXON); \ MACvRegBitsOn(dwIoBase, MAC_REG_HOSTCR, HOSTCR_TXON); \
} }
#define MACvTransmit0(dwIoBase) \ #define MACvTransmit0(dwIoBase) \
{ \ { \
unsigned long dwData; \ unsigned long dwData; \
VNSvInPortD(dwIoBase + MAC_REG_TXDMACTL0, &dwData); \ VNSvInPortD(dwIoBase + MAC_REG_TXDMACTL0, &dwData); \
if (dwData & DMACTL_RUN) { \ if (dwData & DMACTL_RUN) { \
VNSvOutPortD(dwIoBase + MAC_REG_TXDMACTL0, DMACTL_WAKE);\ VNSvOutPortD(dwIoBase + MAC_REG_TXDMACTL0, DMACTL_WAKE); \
} \ } \
else { \ else { \
VNSvOutPortD(dwIoBase + MAC_REG_TXDMACTL0, DMACTL_RUN); \ VNSvOutPortD(dwIoBase + MAC_REG_TXDMACTL0, DMACTL_RUN); \
} \ } \
} }
#define MACvTransmitAC0(dwIoBase) \ #define MACvTransmitAC0(dwIoBase) \
{ \ { \
unsigned long dwData; \ unsigned long dwData; \
VNSvInPortD(dwIoBase + MAC_REG_AC0DMACTL, &dwData); \ VNSvInPortD(dwIoBase + MAC_REG_AC0DMACTL, &dwData); \
if (dwData & DMACTL_RUN) { \ if (dwData & DMACTL_RUN) { \
VNSvOutPortD(dwIoBase + MAC_REG_AC0DMACTL, DMACTL_WAKE);\ VNSvOutPortD(dwIoBase + MAC_REG_AC0DMACTL, DMACTL_WAKE); \
} \ } \
else { \ else { \
VNSvOutPortD(dwIoBase + MAC_REG_AC0DMACTL, DMACTL_RUN); \ VNSvOutPortD(dwIoBase + MAC_REG_AC0DMACTL, DMACTL_RUN); \
} \ } \
} }
#define MACvTransmitSYNC(dwIoBase) \ #define MACvTransmitSYNC(dwIoBase) \
{ \ { \
unsigned long dwData; \ unsigned long dwData; \
VNSvInPortD(dwIoBase + MAC_REG_SYNCDMACTL, &dwData); \ VNSvInPortD(dwIoBase + MAC_REG_SYNCDMACTL, &dwData); \
if (dwData & DMACTL_RUN) { \ if (dwData & DMACTL_RUN) { \
VNSvOutPortD(dwIoBase + MAC_REG_SYNCDMACTL, DMACTL_WAKE);\ VNSvOutPortD(dwIoBase + MAC_REG_SYNCDMACTL, DMACTL_WAKE); \
} \ } \
else { \ else { \
VNSvOutPortD(dwIoBase + MAC_REG_SYNCDMACTL, DMACTL_RUN); \ VNSvOutPortD(dwIoBase + MAC_REG_SYNCDMACTL, DMACTL_RUN); \
} \ } \
} }
#define MACvTransmitATIM(dwIoBase) \ #define MACvTransmitATIM(dwIoBase) \
{ \ { \
unsigned long dwData; \ unsigned long dwData; \
VNSvInPortD(dwIoBase + MAC_REG_ATIMDMACTL, &dwData); \ VNSvInPortD(dwIoBase + MAC_REG_ATIMDMACTL, &dwData); \
if (dwData & DMACTL_RUN) { \ if (dwData & DMACTL_RUN) { \
VNSvOutPortD(dwIoBase + MAC_REG_ATIMDMACTL, DMACTL_WAKE);\ VNSvOutPortD(dwIoBase + MAC_REG_ATIMDMACTL, DMACTL_WAKE); \
} \ } \
else { \ else { \
VNSvOutPortD(dwIoBase + MAC_REG_ATIMDMACTL, DMACTL_RUN); \ VNSvOutPortD(dwIoBase + MAC_REG_ATIMDMACTL, DMACTL_RUN); \
} \ } \
} }
#define MACvTransmitBCN(dwIoBase) \ #define MACvTransmitBCN(dwIoBase) \
{ \ { \
VNSvOutPortB(dwIoBase + MAC_REG_BCNDMACTL, BEACON_READY); \ VNSvOutPortB(dwIoBase + MAC_REG_BCNDMACTL, BEACON_READY); \
} }
#define MACvClearStckDS(dwIoBase) \ #define MACvClearStckDS(dwIoBase) \
{ \ { \
unsigned char byOrgValue; \ unsigned char byOrgValue; \
VNSvInPortB(dwIoBase + MAC_REG_STICKHW, &byOrgValue); \ VNSvInPortB(dwIoBase + MAC_REG_STICKHW, &byOrgValue); \
byOrgValue = byOrgValue & 0xFC; \ byOrgValue = byOrgValue & 0xFC; \
VNSvOutPortB(dwIoBase + MAC_REG_STICKHW, byOrgValue); \ VNSvOutPortB(dwIoBase + MAC_REG_STICKHW, byOrgValue); \
} }
#define MACvReadISR(dwIoBase, pdwValue) \ #define MACvReadISR(dwIoBase, pdwValue) \
{ \ { \
VNSvInPortD(dwIoBase + MAC_REG_ISR, pdwValue); \ VNSvInPortD(dwIoBase + MAC_REG_ISR, pdwValue); \
} }
#define MACvWriteISR(dwIoBase, dwValue) \ #define MACvWriteISR(dwIoBase, dwValue) \
{ \ { \
VNSvOutPortD(dwIoBase + MAC_REG_ISR, dwValue); \ VNSvOutPortD(dwIoBase + MAC_REG_ISR, dwValue); \
} }
#define MACvIntEnable(dwIoBase, dwMask) \ #define MACvIntEnable(dwIoBase, dwMask) \
{ \ { \
VNSvOutPortD(dwIoBase + MAC_REG_IMR, dwMask); \ VNSvOutPortD(dwIoBase + MAC_REG_IMR, dwMask); \
} }
#define MACvIntDisable(dwIoBase) \ #define MACvIntDisable(dwIoBase) \
{ \ { \
VNSvOutPortD(dwIoBase + MAC_REG_IMR, 0); \ VNSvOutPortD(dwIoBase + MAC_REG_IMR, 0); \
} }
#define MACvSelectPage0(dwIoBase) \ #define MACvSelectPage0(dwIoBase) \
{ \ { \
VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 0); \ VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 0); \
} }
#define MACvSelectPage1(dwIoBase) \ #define MACvSelectPage1(dwIoBase) \
{ \ { \
VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 1); \ VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 1); \
} }
#define MACvReadMIBCounter(dwIoBase, pdwCounter) \ #define MACvReadMIBCounter(dwIoBase, pdwCounter) \
{ \ { \
VNSvInPortD(dwIoBase + MAC_REG_MIBCNTR , pdwCounter); \ VNSvInPortD(dwIoBase + MAC_REG_MIBCNTR , pdwCounter); \
} }
#define MACvPwrEvntDisable(dwIoBase) \ #define MACvPwrEvntDisable(dwIoBase) \
{ \ { \
VNSvOutPortW(dwIoBase + MAC_REG_WAKEUPEN0, 0x0000); \ VNSvOutPortW(dwIoBase + MAC_REG_WAKEUPEN0, 0x0000); \
} }
#define MACvEnableProtectMD(dwIoBase) \ #define MACvEnableProtectMD(dwIoBase) \
{ \ { \
unsigned long dwOrgValue; \ unsigned long dwOrgValue; \
VNSvInPortD(dwIoBase + MAC_REG_ENCFG , &dwOrgValue); \ VNSvInPortD(dwIoBase + MAC_REG_ENCFG , &dwOrgValue); \
dwOrgValue = dwOrgValue | EnCFG_ProtectMd; \ dwOrgValue = dwOrgValue | EnCFG_ProtectMd; \
VNSvOutPortD(dwIoBase + MAC_REG_ENCFG, dwOrgValue); \ VNSvOutPortD(dwIoBase + MAC_REG_ENCFG, dwOrgValue); \
} }
#define MACvDisableProtectMD(dwIoBase) \ #define MACvDisableProtectMD(dwIoBase) \
{ \ { \
unsigned long dwOrgValue; \ unsigned long dwOrgValue; \
VNSvInPortD(dwIoBase + MAC_REG_ENCFG , &dwOrgValue); \ VNSvInPortD(dwIoBase + MAC_REG_ENCFG , &dwOrgValue); \
dwOrgValue = dwOrgValue & ~EnCFG_ProtectMd; \ dwOrgValue = dwOrgValue & ~EnCFG_ProtectMd; \
VNSvOutPortD(dwIoBase + MAC_REG_ENCFG, dwOrgValue); \ VNSvOutPortD(dwIoBase + MAC_REG_ENCFG, dwOrgValue); \
} }
#define MACvEnableBarkerPreambleMd(dwIoBase) \ #define MACvEnableBarkerPreambleMd(dwIoBase) \
{ \ { \
unsigned long dwOrgValue; \ unsigned long dwOrgValue; \
VNSvInPortD(dwIoBase + MAC_REG_ENCFG , &dwOrgValue); \ VNSvInPortD(dwIoBase + MAC_REG_ENCFG , &dwOrgValue); \
dwOrgValue = dwOrgValue | EnCFG_BarkerPream; \ dwOrgValue = dwOrgValue | EnCFG_BarkerPream; \
VNSvOutPortD(dwIoBase + MAC_REG_ENCFG, dwOrgValue); \ VNSvOutPortD(dwIoBase + MAC_REG_ENCFG, dwOrgValue); \
} }
#define MACvDisableBarkerPreambleMd(dwIoBase) \ #define MACvDisableBarkerPreambleMd(dwIoBase) \
{ \ { \
unsigned long dwOrgValue; \ unsigned long dwOrgValue; \
VNSvInPortD(dwIoBase + MAC_REG_ENCFG , &dwOrgValue); \ VNSvInPortD(dwIoBase + MAC_REG_ENCFG , &dwOrgValue); \
dwOrgValue = dwOrgValue & ~EnCFG_BarkerPream; \ dwOrgValue = dwOrgValue & ~EnCFG_BarkerPream; \
VNSvOutPortD(dwIoBase + MAC_REG_ENCFG, dwOrgValue); \ VNSvOutPortD(dwIoBase + MAC_REG_ENCFG, dwOrgValue); \
} }
#define MACvSetBBType(dwIoBase, byTyp) \ #define MACvSetBBType(dwIoBase, byTyp) \
{ \ { \
unsigned long dwOrgValue; \ unsigned long dwOrgValue; \
VNSvInPortD(dwIoBase + MAC_REG_ENCFG , &dwOrgValue); \ VNSvInPortD(dwIoBase + MAC_REG_ENCFG , &dwOrgValue); \
dwOrgValue = dwOrgValue & ~EnCFG_BBType_MASK; \ dwOrgValue = dwOrgValue & ~EnCFG_BBType_MASK; \
dwOrgValue = dwOrgValue | (unsigned long) byTyp; \ dwOrgValue = dwOrgValue | (unsigned long) byTyp; \
VNSvOutPortD(dwIoBase + MAC_REG_ENCFG, dwOrgValue); \ VNSvOutPortD(dwIoBase + MAC_REG_ENCFG, dwOrgValue); \
} }
#define MACvReadATIMW(dwIoBase, pwCounter) \ #define MACvReadATIMW(dwIoBase, pwCounter) \
{ \ { \
VNSvInPortW(dwIoBase + MAC_REG_AIDATIM , pwCounter); \ VNSvInPortW(dwIoBase + MAC_REG_AIDATIM , pwCounter); \
} }
#define MACvWriteATIMW(dwIoBase, wCounter) \ #define MACvWriteATIMW(dwIoBase, wCounter) \
{ \ { \
VNSvOutPortW(dwIoBase + MAC_REG_AIDATIM , wCounter); \ VNSvOutPortW(dwIoBase + MAC_REG_AIDATIM , wCounter); \
} }
#define MACvWriteCRC16_128(dwIoBase, byRegOfs, wCRC) \ #define MACvWriteCRC16_128(dwIoBase, byRegOfs, wCRC) \
{ \ { \
VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 1); \ VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 1); \
VNSvOutPortW(dwIoBase + byRegOfs, wCRC); \ VNSvOutPortW(dwIoBase + byRegOfs, wCRC); \
VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 0); \ VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 0); \
} }
#define MACvGPIOIn(dwIoBase, pbyValue) \ #define MACvGPIOIn(dwIoBase, pbyValue) \
{ \ { \
VNSvInPortB(dwIoBase + MAC_REG_GPIOCTL1, pbyValue); \ VNSvInPortB(dwIoBase + MAC_REG_GPIOCTL1, pbyValue); \
} }
#define MACvSetRFLE_LatchBase(dwIoBase) \ #define MACvSetRFLE_LatchBase(dwIoBase) \
{ \ { \
MACvWordRegBitsOn(dwIoBase, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_RFLEOPT); \ MACvWordRegBitsOn(dwIoBase, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_RFLEOPT); \
} }
/*--------------------- Export Classes ----------------------------*/ /*--------------------- Export Classes ----------------------------*/
...@@ -1107,7 +1107,7 @@ void MACvOneShotTimer1MicroSec(unsigned long dwIoBase, unsigned int uDelayTime); ...@@ -1107,7 +1107,7 @@ void MACvOneShotTimer1MicroSec(unsigned long dwIoBase, unsigned int uDelayTime);
void MACvSetMISCFifo(unsigned long dwIoBase, unsigned short wOffset, unsigned long dwData); void MACvSetMISCFifo(unsigned long dwIoBase, unsigned short wOffset, unsigned long dwData);
bool MACbTxDMAOff (unsigned long dwIoBase, unsigned int idx); bool MACbTxDMAOff(unsigned long dwIoBase, unsigned int idx);
void MACvClearBusSusInd(unsigned long dwIoBase); void MACvClearBusSusInd(unsigned long dwIoBase);
void MACvEnableBusSusEn(unsigned long dwIoBase); void MACvEnableBusSusEn(unsigned long dwIoBase);
...@@ -1116,14 +1116,14 @@ bool MACbFlushSYNCFifo(unsigned long dwIoBase); ...@@ -1116,14 +1116,14 @@ bool MACbFlushSYNCFifo(unsigned long dwIoBase);
bool MACbPSWakeup(unsigned long dwIoBase); bool MACbPSWakeup(unsigned long dwIoBase);
void MACvSetKeyEntry(unsigned long dwIoBase, unsigned short wKeyCtl, unsigned int uEntryIdx, void MACvSetKeyEntry(unsigned long dwIoBase, unsigned short wKeyCtl, unsigned int uEntryIdx,
unsigned int uKeyIdx, unsigned char *pbyAddr, unsigned long *pdwKey, unsigned char byLocalID); unsigned int uKeyIdx, unsigned char *pbyAddr, unsigned long *pdwKey, unsigned char byLocalID);
void MACvDisableKeyEntry(unsigned long dwIoBase, unsigned int uEntryIdx); void MACvDisableKeyEntry(unsigned long dwIoBase, unsigned int uEntryIdx);
void MACvSetDefaultKeyEntry(unsigned long dwIoBase, unsigned int uKeyLen, void MACvSetDefaultKeyEntry(unsigned long dwIoBase, unsigned int uKeyLen,
unsigned int uKeyIdx, unsigned long *pdwKey, unsigned char byLocalID); unsigned int uKeyIdx, unsigned long *pdwKey, unsigned char byLocalID);
//void MACvEnableDefaultKey(unsigned long dwIoBase, unsigned char byLocalID); //void MACvEnableDefaultKey(unsigned long dwIoBase, unsigned char byLocalID);
void MACvDisableDefaultKey(unsigned long dwIoBase); void MACvDisableDefaultKey(unsigned long dwIoBase);
void MACvSetDefaultTKIPKeyEntry(unsigned long dwIoBase, unsigned int uKeyLen, void MACvSetDefaultTKIPKeyEntry(unsigned long dwIoBase, unsigned int uKeyLen,
unsigned int uKeyIdx, unsigned long *pdwKey, unsigned char byLocalID); unsigned int uKeyIdx, unsigned long *pdwKey, unsigned char byLocalID);
void MACvSetDefaultKeyCtl(unsigned long dwIoBase, unsigned short wKeyCtl, unsigned int uEntryIdx, unsigned char byLocalID); void MACvSetDefaultKeyCtl(unsigned long dwIoBase, unsigned short wKeyCtl, unsigned int uEntryIdx, unsigned char byLocalID);
#endif // __MAC_H__ #endif // __MAC_H__
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment