📄 wlan_11d.c
字号:
{
CHANNEL_FREQ_POWER *pNewCFP_BG;
CHANNEL_FREQ_POWER *pNewCFP_A;
int i, j, k, k1;
switch (CountryNum)
{
case 0x10: // "US ", "CA "
pNewCFP_BG = channel_freq_power_US_BG;
pNewCFP_A = channel_freq_power_A;
k = sizeof(channel_freq_power_US_BG)/sizeof(CHANNEL_FREQ_POWER);
k1 = sizeof(channel_freq_power_A)/sizeof(CHANNEL_FREQ_POWER);
break;
case 0x30: // "EU "
pNewCFP_BG = channel_freq_power_EU_BG;
pNewCFP_A = channel_freq_power_EU_A;
k = sizeof(channel_freq_power_EU_BG)/sizeof(CHANNEL_FREQ_POWER);
k1 = sizeof(channel_freq_power_EU_A)/sizeof(CHANNEL_FREQ_POWER);
break;
case 0x31: // "ES "
pNewCFP_BG = channel_freq_power_SPN_BG;
pNewCFP_A = channel_freq_power_A;
k = sizeof(channel_freq_power_SPN_BG)/sizeof(CHANNEL_FREQ_POWER);
k1 = sizeof(channel_freq_power_A)/sizeof(CHANNEL_FREQ_POWER);
break;
case 0x32: // "FR "
pNewCFP_BG = channel_freq_power_FR_BG;
pNewCFP_A = channel_freq_power_A;
k = sizeof(channel_freq_power_FR_BG)/sizeof(CHANNEL_FREQ_POWER);
k1 = sizeof(channel_freq_power_A)/sizeof(CHANNEL_FREQ_POWER);
break;
case 0x40: // "JP "
pNewCFP_BG = channel_freq_power_JPN_BG;
pNewCFP_A = channel_freq_power_JPN_A;
k = sizeof(channel_freq_power_JPN_BG)/sizeof(CHANNEL_FREQ_POWER);
k1 = sizeof(channel_freq_power_JPN_A)/sizeof(CHANNEL_FREQ_POWER);
break;
}
DBGPRINT(DBG_ALLEN, ("CountryNum = %d, k = %d, k1 = %d \n", CountryNum, k, k1));
if (Adapter->region_channel[0].Valid)
{
//RETAILMSG(1,(L"region channel 0 valid\n\r"));
Adapter->region_channel[0].Region = CountryNum;
// set passive scan type to all channel
NdisFillMemory(Adapter->region_channel[0].ScanType, MAX_PSCAN_CH_NUM, 0x01);
for (i=0; i< Adapter->region_channel[0].NrCFP; i++)
{
for (j=0; j< k; j++)
{
if (Adapter->region_channel[0].CFP[i].Channel == pNewCFP_BG[j].Channel)
{
Adapter->region_channel[0].ScanType[i] = 0;
break;
}
}
}
}
if (Adapter->region_channel[1].Valid)
{
//RETAILMSG(1,(L"region channel 1 valid\n\r"));
Adapter->region_channel[1].Region = CountryNum;
// set passive scan type to all channel
NdisFillMemory(Adapter->region_channel[1].ScanType, MAX_PSCAN_CH_NUM, 0x01);
for (i=0; i< Adapter->region_channel[1].NrCFP; i++)
{
for (j=0; j< k1; j++)
{
if (Adapter->region_channel[1].CFP[i].Channel == pNewCFP_BG[j].Channel)
{ // set active sacn type to the channel
Adapter->region_channel[1].ScanType[i] = 0;
break;
}
}
}
}
}
// Generate domaininfo CountryIE
VOID
GenerateDomainInfoFromCountryIE(
MrvlIEtypes_DomainParamSet_t *pDomainInfo,
IEEEtypes_CountryInfoFullSet_t *pCountryIE
)
{
DBGPRINT(DBG_ALLEN, ("GenerateDomainInfoFromCountryIE() \n"));
NdisMoveMemory (pDomainInfo->CountryCode, pCountryIE->CountryCode, COUNTRY_CODE_LEN);
pDomainInfo->Header.Len= (SHORT)pCountryIE->Len;
pDomainInfo->Header.Type = TLV_TYPE_DOMAIN;
NdisMoveMemory(pDomainInfo->Subband, pCountryIE->Subband, pCountryIE->Len);
return;
}
// Enable/Disable 11D via set SNMP OID to FW
VOID
Enable_11d(
PMRVDRV_ADAPTER Adapter,
BOOLEAN enable )
{
USHORT Cmdopt = 0;
if (enable)
{
Cmdopt = 1;
RETAILMSG(1,(L"enable 11d:%x\n\r",Cmdopt ));
}
PrepareAndSendCommand(
Adapter,
HostCmd_CMD_802_11_SNMP_MIB,
HostCmd_ACT_GEN_SET,
HostCmd_OPTION_USE_INT,
OID_802_11D_ENABLE,
HostCmd_PENDING_ON_NONE,
0,
FALSE,
NULL,
NULL,
NULL,
&Cmdopt);
return;
}
// Set DOMAIN INFO to FW
VOID
SetDomainInfo(
PMRVDRV_ADAPTER Adapter,
IEEEtypes_CountryInfoFullSet_t *pCountryIE)
{
UCHAR CountryNum;
CountryNum = region_2_code( pCountryIE->CountryCode);
PrepareAndSendCommand(
Adapter,
HostCmd_CMD_802_11D_DOMAIN_INFO,
HostCmd_ACT_SET,
HostCmd_OPTION_USE_INT,
0,
HostCmd_PENDING_ON_NONE,
0,
FALSE,
NULL,
NULL,
NULL,
(PVOID)&CountryNum
);
}
//dralee_20060502
VOID
Generate_domain_info_11d(
UCHAR CountryNum,
UCHAR band,
MrvlIEtypes_DomainParamSet_t *domaininfo)
{
UCHAR NoOfSubband =0;
UCHAR NoOfChan = 0;
UCHAR NoOfParsedChan =0;
UCHAR firstChan=0, nextChan=0, maxPwr=0;
UCHAR i, flag =0;
CHANNEL_FREQ_POWER *pNewCFP_BG;
CHANNEL_FREQ_POWER *pNewCFP_A;
CHANNEL_FREQ_POWER *pNewCFP;
int k, k1;
//USHORT *dbg;
//copy region code string
NdisMoveMemory( domaininfo->CountryCode, code_2_region((UCHAR)CountryNum),
COUNTRY_CODE_LEN);
domaininfo->CountryCode[2] = 0x20;
//RETAILMSG(1,(L"REGION:%c%c%c\n\r",domaininfo->CountryCode[0],domaininfo->CountryCode[1],domaininfo->CountryCode[2]));
if ((CountryNum != 0) &&
((CountryNum == 0x10) || (CountryNum == 0x30) || (CountryNum == 0x31) ||
(CountryNum == 0x32) || (CountryNum == 0x40)))
{
switch (CountryNum)
{
case 0x10: // "US ", "CA "
pNewCFP_BG = channel_freq_power_US_BG;
pNewCFP_A = channel_freq_power_A;
k = sizeof(channel_freq_power_US_BG)/sizeof(CHANNEL_FREQ_POWER);
k1 = sizeof(channel_freq_power_A)/sizeof(CHANNEL_FREQ_POWER);
break;
case 0x30: // "EU "
pNewCFP_BG = channel_freq_power_EU_BG;
pNewCFP_A = channel_freq_power_EU_A;
k = sizeof(channel_freq_power_EU_BG)/sizeof(CHANNEL_FREQ_POWER);
k1 = sizeof(channel_freq_power_EU_A)/sizeof(CHANNEL_FREQ_POWER);
break;
case 0x31: // "ES "
pNewCFP_BG = channel_freq_power_SPN_BG;
pNewCFP_A = channel_freq_power_A;
k = sizeof(channel_freq_power_SPN_BG)/sizeof(CHANNEL_FREQ_POWER);
k1 = sizeof(channel_freq_power_A)/sizeof(CHANNEL_FREQ_POWER);
break;
case 0x32: // "FR "
pNewCFP_BG = channel_freq_power_FR_BG;
pNewCFP_A = channel_freq_power_A;
k = sizeof(channel_freq_power_FR_BG)/sizeof(CHANNEL_FREQ_POWER);
k1 = sizeof(channel_freq_power_A)/sizeof(CHANNEL_FREQ_POWER);
break;
case 0x40: // "JP "
pNewCFP_BG = channel_freq_power_JPN_BG;
pNewCFP_A = channel_freq_power_JPN_A;
k = sizeof(channel_freq_power_JPN_BG)/sizeof(CHANNEL_FREQ_POWER);
k1 = sizeof(channel_freq_power_JPN_A)/sizeof(CHANNEL_FREQ_POWER);
break;
}
}
if( band == MRVDRV_802_11_BAND_A )
{
pNewCFP = pNewCFP_A;
NoOfChan = k1;
}
else
{
pNewCFP = pNewCFP_BG;
NoOfChan = k;
}
for ( i=0; i<NoOfChan; i++ )
{
if ( !flag )
{
flag = 1;
nextChan = firstChan =(UCHAR) pNewCFP[i].Channel;
maxPwr = (UCHAR)pNewCFP[i].MaxTxPower;
NoOfParsedChan = 1;
continue;
}
if ( pNewCFP[i].Channel == nextChan+1 &&
pNewCFP[i].MaxTxPower == maxPwr )
{
nextChan++;
NoOfParsedChan++;
}
else
{
domaininfo->Subband[NoOfSubband].FirstChan = firstChan;
domaininfo->Subband[NoOfSubband].NoOfChan = NoOfParsedChan;
domaininfo->Subband[NoOfSubband].MaxTxPwr = maxPwr;
NoOfSubband++;
nextChan = firstChan = (UCHAR)pNewCFP[i].Channel;
maxPwr = (UCHAR) pNewCFP[i].MaxTxPower;
}
}
if( flag )
{
domaininfo->Subband[NoOfSubband].FirstChan = firstChan;
domaininfo->Subband[NoOfSubband].NoOfChan = NoOfParsedChan;
domaininfo->Subband[NoOfSubband].MaxTxPwr = maxPwr;
NoOfSubband++;
}
//domaininfo->NoOfSubband = NoOfSubband;
domaininfo->Header.Len = NoOfSubband * sizeof(IEEEtypes_SubbandSet_t) + COUNTRY_CODE_LEN;
domaininfo->Header.Type = TLV_TYPE_DOMAIN;
//dbg = (USHORT *)domaininfo;
//RETAILMSG(1,(L"domain:%x,%x,%x,%x,%x,%x\n\r",dbg[0],dbg[1],dbg[2],dbg[3],dbg[4],dbg[5]));
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -