📄 rf.c
字号:
if (pDevice->byCurPwr > AL7230_PWR_IDX_LEN) return FALSE; // 0x080F1B00 for 3 wire control TxGain(D10) and 0x31 as TX Gain value dwMax7230Pwr = 0x080C0B00 | ( (pDevice->byCurPwr) << 12 ) | (BY_AL7230_REG_LEN << 3 ) | IFREGCTL_REGW; bResult &= IFRFbWriteEmbeded(pDevice, dwMax7230Pwr); break; } break; case RF_VT3226: //RobertYu:20051111, VT3226C0 and before
{
DWORD dwVT3226Pwr;
if (pDevice->byCurPwr >= VT3226_PWR_IDX_LEN)
return FALSE;
dwVT3226Pwr = ((0x3F-pDevice->byCurPwr) << 20 ) | ( 0x17 << 8 ) /* Reg7 */ |
(BY_VT3226_REG_LEN << 3 ) | IFREGCTL_REGW;
bResult &= IFRFbWriteEmbeded(pDevice, dwVT3226Pwr);
break;
}
case RF_VT3226D0: //RobertYu:20051228
{
DWORD dwVT3226Pwr;
if (pDevice->byCurPwr >= VT3226_PWR_IDX_LEN)
return FALSE;
if (uRATE <= RATE_11M) {
dwVT3226Pwr = ((0x3F-pDevice->byCurPwr) << 20 ) | ( 0xE07 << 8 ) /* Reg7 */ | //RobertYu:20060420, TWIF 1.10
(BY_VT3226_REG_LEN << 3 ) | IFREGCTL_REGW;
bResult &= IFRFbWriteEmbeded(pDevice, dwVT3226Pwr);
bResult &= IFRFbWriteEmbeded(pDevice, 0x03C6A200+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW);
if (pDevice->sMgmtObj.eScanState != WMAC_NO_SCANNING) {
// scanning, the channel number is pDevice->uScanChannel
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"@@@@ RFbRawSetPower> 11B mode uCurrChannel[%d]\n", pDevice->sMgmtObj.uScanChannel);
bResult &= IFRFbWriteEmbeded(pDevice, dwVT3226D0LoCurrentTable[pDevice->sMgmtObj.uScanChannel-1]); //RobertYu:20060420, sometimes didn't change channel just set power with different rate
} else {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"@@@@ RFbRawSetPower> 11B mode uCurrChannel[%d]\n", pDevice->sMgmtObj.uCurrChannel);
bResult &= IFRFbWriteEmbeded(pDevice, dwVT3226D0LoCurrentTable[pDevice->sMgmtObj.uCurrChannel-1]); //RobertYu:20060420, sometimes didn't change channel just set power with different rate
}
bResult &= IFRFbWriteEmbeded(pDevice, 0x015C0800+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW); //RobertYu:20060420, ok now, new switching power (mini-pci can have bigger power consumption)
} else { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"@@@@ RFbRawSetPower> 11G mode\n");
dwVT3226Pwr = ((0x3F-pDevice->byCurPwr) << 20 ) | ( 0x7 << 8 ) /* Reg7 */ | //RobertYu:20060420, TWIF 1.10
(BY_VT3226_REG_LEN << 3 ) | IFREGCTL_REGW;
bResult &= IFRFbWriteEmbeded(pDevice, dwVT3226Pwr);
bResult &= IFRFbWriteEmbeded(pDevice, 0x00C6A200+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW); //RobertYu:20060327
bResult &= IFRFbWriteEmbeded(pDevice, 0x016BC600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW); //RobertYu:20060111
bResult &= IFRFbWriteEmbeded(pDevice, 0x00900800+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW); //RobertYu:20060111
}
break;
}
//{{RobertYu:20060609
case RF_VT3342A0:
{
DWORD dwVT3342Pwr;
if (pDevice->byCurPwr >= VT3342_PWR_IDX_LEN)
return FALSE;
dwVT3342Pwr = ((0x3F-pDevice->byCurPwr) << 20 ) | ( 0x27 << 8 ) /* Reg7 */ |
(BY_VT3342_REG_LEN << 3 ) | IFREGCTL_REGW;
bResult &= IFRFbWriteEmbeded(pDevice, dwVT3342Pwr);
break;
}
default : break; } return bResult;}/*+ * * Routine Description: * Translate RSSI to dBm * * Parameters: * In: * pDevice - The adapter to be translated * byCurrRSSI - RSSI to be translated * Out: * pdwdbm - Translated dbm number * * Return Value: none *-*/VOIDRFvRSSITodBm ( IN PSDevice pDevice, IN BYTE byCurrRSSI, OUT PLONG pldBm ){ BYTE byIdx = (((byCurrRSSI & 0xC0) >> 6) & 0x03); LONG b = (byCurrRSSI & 0x3F); LONG a = 0; BYTE abyAIROHARF[4] = {0, 18, 0, 40}; switch (pDevice->byRFType) { case RF_AL2230: case RF_AL2230S: case RF_AIROHA7230: case RF_VT3226: //RobertYu:20051111
case RF_VT3226D0:
case RF_VT3342A0: //RobertYu:20060609 a = abyAIROHARF[byIdx]; break; default: break; } *pldBm = -1 * (a + b * 2);}VOIDRFbRFTableDownload ( IN PSDevice pDevice ){WORD wLength1 = 0,wLength2 = 0 ,wLength3 = 0;PBYTE pbyAddr1 = NULL,pbyAddr2 = NULL,pbyAddr3 = NULL;WORD wLength,wValue;BYTE abyArray[256]; switch ( pDevice->byRFType ) { case RF_AL2230: case RF_AL2230S: wLength1 = CB_AL2230_INIT_SEQ * 3; wLength2 = CB_MAX_CHANNEL_24G * 3; wLength3 = CB_MAX_CHANNEL_24G * 3; pbyAddr1 = &(abyAL2230InitTable[0][0]); pbyAddr2 = &(abyAL2230ChannelTable0[0][0]); pbyAddr3 = &(abyAL2230ChannelTable1[0][0]); break; case RF_AIROHA7230: wLength1 = CB_AL7230_INIT_SEQ * 3; wLength2 = CB_MAX_CHANNEL * 3; wLength3 = CB_MAX_CHANNEL * 3; pbyAddr1 = &(abyAL7230InitTable[0][0]); pbyAddr2 = &(abyAL7230ChannelTable0[0][0]); pbyAddr3 = &(abyAL7230ChannelTable1[0][0]); break; case RF_VT3226: //RobertYu:20051111
wLength1 = CB_VT3226_INIT_SEQ * 3;
wLength2 = CB_MAX_CHANNEL_24G * 3;
wLength3 = CB_MAX_CHANNEL_24G * 3;
pbyAddr1 = &(abyVT3226_InitTable[0][0]);
pbyAddr2 = &(abyVT3226_ChannelTable0[0][0]);
pbyAddr3 = &(abyVT3226_ChannelTable1[0][0]);
break;
case RF_VT3226D0: //RobertYu:20051114
wLength1 = CB_VT3226_INIT_SEQ * 3;
wLength2 = CB_MAX_CHANNEL_24G * 3;
wLength3 = CB_MAX_CHANNEL_24G * 3;
pbyAddr1 = &(abyVT3226D0_InitTable[0][0]);
pbyAddr2 = &(abyVT3226_ChannelTable0[0][0]);
pbyAddr3 = &(abyVT3226_ChannelTable1[0][0]);
break;
case RF_VT3342A0: //RobertYu:20060609
wLength1 = CB_VT3342_INIT_SEQ * 3;
wLength2 = CB_MAX_CHANNEL * 3;
wLength3 = CB_MAX_CHANNEL * 3;
pbyAddr1 = &(abyVT3342A0_InitTable[0][0]);
pbyAddr2 = &(abyVT3342_ChannelTable0[0][0]);
pbyAddr3 = &(abyVT3342_ChannelTable1[0][0]);
break;
} //Init Table memcpy(abyArray, pbyAddr1, wLength1); CONTROLnsRequestOut(pDevice, MESSAGE_TYPE_WRITE, 0, MESSAGE_REQUEST_RF_INIT, wLength1, abyArray ); //Channle Table 0 wValue = 0; while ( wLength2 > 0 ) { if ( wLength2 >= 64 ) { wLength = 64; } else { wLength = wLength2; } memcpy(abyArray, pbyAddr2, wLength); CONTROLnsRequestOut(pDevice, MESSAGE_TYPE_WRITE, wValue, MESSAGE_REQUEST_RF_CH0, wLength, abyArray); wLength2 -= wLength; wValue += wLength; pbyAddr2 += wLength; } //Channel table 1 wValue = 0; while ( wLength3 > 0 ) { if ( wLength3 >= 64 ) { wLength = 64; } else { wLength = wLength3; } memcpy(abyArray, pbyAddr3, wLength); CONTROLnsRequestOut(pDevice, MESSAGE_TYPE_WRITE, wValue, MESSAGE_REQUEST_RF_CH1, wLength, abyArray); wLength3 -= wLength; wValue += wLength; pbyAddr3 += wLength; } //7230 needs 2 InitTable and 3 Channel Table if ( pDevice->byRFType == RF_AIROHA7230 ) { wLength1 = CB_AL7230_INIT_SEQ * 3; wLength2 = CB_MAX_CHANNEL * 3; pbyAddr1 = &(abyAL7230InitTableAMode[0][0]); pbyAddr2 = &(abyAL7230ChannelTable2[0][0]); memcpy(abyArray, pbyAddr1, wLength1); //Init Table 2 CONTROLnsRequestOut(pDevice, MESSAGE_TYPE_WRITE, 0, MESSAGE_REQUEST_RF_INIT2, wLength1, abyArray); //Channle Table 0 wValue = 0; while ( wLength2 > 0 ) { if ( wLength2 >= 64 ) { wLength = 64; } else { wLength = wLength2; } memcpy(abyArray, pbyAddr2, wLength); CONTROLnsRequestOut(pDevice, MESSAGE_TYPE_WRITE, wValue, MESSAGE_REQUEST_RF_CH2, wLength, abyArray); wLength2 -= wLength; wValue += wLength; pbyAddr2 += wLength; } } }// RobertYu:20060412, TWIF1.11 adjust LO Current for 11b mode
BOOL s_bVT3226D0_11bLoCurrentAdjust(
IN PSDevice pDevice,
IN BYTE byChannel,
IN BOOL b11bMode )
{
BOOL bResult;
bResult = TRUE;
if( b11bMode )
bResult &= IFRFbWriteEmbeded(pDevice, dwVT3226D0LoCurrentTable[byChannel-1]);
else
bResult &= IFRFbWriteEmbeded(pDevice, 0x016BC600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW); //RobertYu:20060412
return bResult;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -