cmm_info.c

来自「ralink最新rt3070 usb wifi 无线网卡驱动程序」· C语言 代码 · 共 2,146 行 · 第 1/5 页

C
2,146
字号
	// check if this channel is valid	if (ChannelSanity(pAd, Channel) == TRUE)	{#ifdef CONFIG_STA_SUPPORT		IF_DEV_CONFIG_OPMODE_ON_STA(pAd)		{			pAd->CommonCfg.Channel = Channel;        			if (MONITOR_ON(pAd))			{#ifdef DOT11_N_SUPPORT				N_ChannelCheck(pAd);				if (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED &&					pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40)				{					N_SetCenCh(pAd);					AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, FALSE);					AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel);					DBGPRINT(RT_DEBUG_TRACE, ("BW_40, control_channel(%d), CentralChannel(%d) \n", 								pAd->CommonCfg.Channel, pAd->CommonCfg.CentralChannel));				}				else#endif // DOT11_N_SUPPORT //				{					AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE);					AsicLockChannel(pAd, pAd->CommonCfg.Channel);					DBGPRINT(RT_DEBUG_TRACE, ("BW_20, Channel(%d)\n", pAd->CommonCfg.Channel));				}			}		}#endif // CONFIG_STA_SUPPORT //		success = TRUE;	}	else	{#ifdef CONFIG_STA_SUPPORT		IF_DEV_CONFIG_OPMODE_ON_STA(pAd)			success = FALSE;#endif // CONFIG_STA_SUPPORT //	}	if (success == TRUE)		DBGPRINT(RT_DEBUG_TRACE, ("Set_Channel_Proc::(Channel=%d)\n", pAd->CommonCfg.Channel));	return success;}/*     ==========================================================================    Description:        Set Short Slot Time Enable or Disable    Return:        TRUE if all parameters are OK, FALSE otherwise    ==========================================================================*/INT	Set_ShortSlot_Proc(	IN	PRTMP_ADAPTER	pAd, 	IN	PUCHAR			arg){	ULONG ShortSlot;	ShortSlot = simple_strtol(arg, 0, 10);	if (ShortSlot == 1)		pAd->CommonCfg.bUseShortSlotTime = TRUE;	else if (ShortSlot == 0)		pAd->CommonCfg.bUseShortSlotTime = FALSE;	else		return FALSE;  //Invalid argument 		DBGPRINT(RT_DEBUG_TRACE, ("Set_ShortSlot_Proc::(ShortSlot=%d)\n", pAd->CommonCfg.bUseShortSlotTime));	return TRUE;}/*     ==========================================================================    Description:        Set Tx power    Return:        TRUE if all parameters are OK, FALSE otherwise    ==========================================================================*/INT	Set_TxPower_Proc(	IN	PRTMP_ADAPTER	pAd, 	IN	PUCHAR			arg){	ULONG TxPower;	INT   success = FALSE;	TxPower = (ULONG) simple_strtol(arg, 0, 10);	if (TxPower <= 100)	{#ifdef CONFIG_STA_SUPPORT		IF_DEV_CONFIG_OPMODE_ON_STA(pAd)		{			pAd->CommonCfg.TxPowerDefault = TxPower;			pAd->CommonCfg.TxPowerPercentage = pAd->CommonCfg.TxPowerDefault;		}#endif // CONFIG_STA_SUPPORT //		success = TRUE;	}	else		success = FALSE;	DBGPRINT(RT_DEBUG_TRACE, ("Set_TxPower_Proc::(TxPowerPercentage=%ld)\n", pAd->CommonCfg.TxPowerPercentage));	return success;}/*     ==========================================================================    Description:        Set 11B/11G Protection    Return:        TRUE if all parameters are OK, FALSE otherwise    ==========================================================================*/INT	Set_BGProtection_Proc(	IN	PRTMP_ADAPTER	pAd, 	IN	PUCHAR			arg){	switch (simple_strtol(arg, 0, 10))	{		case 0: //AUTO			pAd->CommonCfg.UseBGProtection = 0;			break;		case 1: //Always On			pAd->CommonCfg.UseBGProtection = 1;			break;		case 2: //Always OFF			pAd->CommonCfg.UseBGProtection = 2;			break;				default:  //Invalid argument 			return FALSE;	}	DBGPRINT(RT_DEBUG_TRACE, ("Set_BGProtection_Proc::(BGProtection=%ld)\n", pAd->CommonCfg.UseBGProtection));		return TRUE;}/*     ==========================================================================    Description:        Set TxPreamble    Return:        TRUE if all parameters are OK, FALSE otherwise    ==========================================================================*/INT	Set_TxPreamble_Proc(	IN	PRTMP_ADAPTER	pAd, 	IN	PUCHAR			arg){	RT_802_11_PREAMBLE	Preamble;	Preamble = simple_strtol(arg, 0, 10);	switch (Preamble)	{		case Rt802_11PreambleShort:			pAd->CommonCfg.TxPreamble = Preamble;#ifdef CONFIG_STA_SUPPORT			IF_DEV_CONFIG_OPMODE_ON_STA(pAd)				MlmeSetTxPreamble(pAd, Rt802_11PreambleShort);#endif // CONFIG_STA_SUPPORT //			break;		case Rt802_11PreambleLong:#ifdef CONFIG_STA_SUPPORT		case Rt802_11PreambleAuto:			// if user wants AUTO, initialize to LONG here, then change according to AP's			// capability upon association.#endif // CONFIG_STA_SUPPORT //			pAd->CommonCfg.TxPreamble = Preamble;#ifdef CONFIG_STA_SUPPORT			IF_DEV_CONFIG_OPMODE_ON_STA(pAd)				MlmeSetTxPreamble(pAd, Rt802_11PreambleLong);#endif // CONFIG_STA_SUPPORT //			break;		default: //Invalid argument 			return FALSE;	}	DBGPRINT(RT_DEBUG_TRACE, ("Set_TxPreamble_Proc::(TxPreamble=%ld)\n", pAd->CommonCfg.TxPreamble));	return TRUE;}/*     ==========================================================================    Description:        Set RTS Threshold    Return:        TRUE if all parameters are OK, FALSE otherwise    ==========================================================================*/INT	Set_RTSThreshold_Proc(	IN	PRTMP_ADAPTER	pAd, 	IN	PUCHAR			arg){	 NDIS_802_11_RTS_THRESHOLD           RtsThresh;	RtsThresh = simple_strtol(arg, 0, 10);	if((RtsThresh > 0) && (RtsThresh <= MAX_RTS_THRESHOLD))		pAd->CommonCfg.RtsThreshold  = (USHORT)RtsThresh;#ifdef CONFIG_STA_SUPPORT	else if (RtsThresh == 0)		pAd->CommonCfg.RtsThreshold = MAX_RTS_THRESHOLD;#endif // CONFIG_STA_SUPPORT //	else		return FALSE; //Invalid argument 	DBGPRINT(RT_DEBUG_TRACE, ("Set_RTSThreshold_Proc::(RTSThreshold=%d)\n", pAd->CommonCfg.RtsThreshold));	return TRUE;}/*     ==========================================================================    Description:        Set Fragment Threshold    Return:        TRUE if all parameters are OK, FALSE otherwise    ==========================================================================*/INT	Set_FragThreshold_Proc(	IN	PRTMP_ADAPTER	pAd, 	IN	PUCHAR			arg){	 NDIS_802_11_FRAGMENTATION_THRESHOLD     FragThresh;	FragThresh = simple_strtol(arg, 0, 10);	if (FragThresh > MAX_FRAG_THRESHOLD || FragThresh < MIN_FRAG_THRESHOLD)	{ 		//Illegal FragThresh so we set it to default		pAd->CommonCfg.FragmentThreshold = MAX_FRAG_THRESHOLD;	}	else if (FragThresh % 2 == 1)	{		// The length of each fragment shall always be an even number of octets, except for the last fragment		// of an MSDU or MMPDU, which may be either an even or an odd number of octets.		pAd->CommonCfg.FragmentThreshold = (USHORT)(FragThresh - 1);	}	else	{		pAd->CommonCfg.FragmentThreshold = (USHORT)FragThresh;	}#ifdef CONFIG_STA_SUPPORT	IF_DEV_CONFIG_OPMODE_ON_STA(pAd)	{		if (pAd->CommonCfg.FragmentThreshold == MAX_FRAG_THRESHOLD)			pAd->CommonCfg.bUseZeroToDisableFragment = TRUE;		else			pAd->CommonCfg.bUseZeroToDisableFragment = FALSE;	}#endif // CONFIG_STA_SUPPORT //	DBGPRINT(RT_DEBUG_TRACE, ("Set_FragThreshold_Proc::(FragThreshold=%d)\n", pAd->CommonCfg.FragmentThreshold));	return TRUE;}/*     ==========================================================================    Description:        Set TxBurst    Return:        TRUE if all parameters are OK, FALSE otherwise    ==========================================================================*/INT	Set_TxBurst_Proc(	IN	PRTMP_ADAPTER	pAd, 	IN	PUCHAR			arg){	ULONG TxBurst;	TxBurst = simple_strtol(arg, 0, 10);	if (TxBurst == 1)		pAd->CommonCfg.bEnableTxBurst = TRUE;	else if (TxBurst == 0)		pAd->CommonCfg.bEnableTxBurst = FALSE;	else		return FALSE;  //Invalid argument 		DBGPRINT(RT_DEBUG_TRACE, ("Set_TxBurst_Proc::(TxBurst=%d)\n", pAd->CommonCfg.bEnableTxBurst));	return TRUE;}#ifdef AGGREGATION_SUPPORT/*     ==========================================================================    Description:        Set TxBurst    Return:        TRUE if all parameters are OK, FALSE otherwise    ==========================================================================*/INT	Set_PktAggregate_Proc(	IN	PRTMP_ADAPTER	pAd, 	IN	PUCHAR			arg){	ULONG aggre;	aggre = simple_strtol(arg, 0, 10);	if (aggre == 1)		pAd->CommonCfg.bAggregationCapable = TRUE;	else if (aggre == 0)		pAd->CommonCfg.bAggregationCapable = FALSE;	else		return FALSE;  //Invalid argument 	DBGPRINT(RT_DEBUG_TRACE, ("Set_PktAggregate_Proc::(AGGRE=%d)\n", pAd->CommonCfg.bAggregationCapable));	return TRUE;}#endif/*     ==========================================================================    Description:        Set IEEE80211H.        This parameter is 1 when needs radar detection, otherwise 0    Return:        TRUE if all parameters are OK, FALSE otherwise    ==========================================================================*/INT	Set_IEEE80211H_Proc(	IN	PRTMP_ADAPTER	pAd, 	IN	PUCHAR			arg){    ULONG ieee80211h;	ieee80211h = simple_strtol(arg, 0, 10);	if (ieee80211h == 1)		pAd->CommonCfg.bIEEE80211H = TRUE;	else if (ieee80211h == 0)		pAd->CommonCfg.bIEEE80211H = FALSE;	else		return FALSE;  //Invalid argument 		DBGPRINT(RT_DEBUG_TRACE, ("Set_IEEE80211H_Proc::(IEEE80211H=%d)\n", pAd->CommonCfg.bIEEE80211H));	return TRUE;}#ifdef DBG/*     ==========================================================================    Description:        For Debug information    Return:        TRUE if all parameters are OK, FALSE otherwise    ==========================================================================*/INT	Set_Debug_Proc(	IN	PRTMP_ADAPTER	pAd, 	IN	PUCHAR			arg){	DBGPRINT(RT_DEBUG_TRACE, ("==> Set_Debug_Proc *******************\n"));    if(simple_strtol(arg, 0, 10) <= RT_DEBUG_LOUD)        RTDebugLevel = simple_strtol(arg, 0, 10);	DBGPRINT(RT_DEBUG_TRACE, ("<== Set_Debug_Proc(RTDebugLevel = %ld)\n", RTDebugLevel));	return TRUE;}#endifINT	Show_DescInfo_Proc(	IN	PRTMP_ADAPTER	pAd, 	IN	PUCHAR			arg){	return TRUE;}/*     ==========================================================================    Description:        Reset statistics counter    Arguments:        pAdapter            Pointer to our adapter        arg                     Return:        TRUE if all parameters are OK, FALSE otherwise    ==========================================================================*/INT	Set_ResetStatCounter_Proc(	IN	PRTMP_ADAPTER	pAd, 	IN	PUCHAR			arg){	//UCHAR           i;	//MAC_TABLE_ENTRY *pEntry;    	DBGPRINT(RT_DEBUG_TRACE, ("==>Set_ResetStatCounter_Proc\n"));	// add the most up-to-date h/w raw counters into software counters	NICUpdateRawCounters(pAd);    	NdisZeroMemory(&pAd->WlanCounters, sizeof(COUNTER_802_11));	NdisZeroMemory(&pAd->Counters8023, sizeof(COUNTER_802_3));	NdisZeroMemory(&pAd->RalinkCounters, sizeof(COUNTER_RALINK));	return TRUE;}BOOLEAN RTMPCheckStrPrintAble(    IN  CHAR *pInPutStr,     IN  UCHAR strLen){    UCHAR i=0;        for (i=0; i<strLen; i++)    {

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?