blob: 9990242c946b957c6c66f7eb01deb3fee2ad3f1c [file] [log] [blame]
/*
* cu_cmd.c
*
* Copyright 2001-2009 Texas Instruments, Inc. - http://www.ti.com/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/****************************************************************************
*
* MODULE: cu_cmd.c
*
* PURPOSE:
*
* DESCRIPTION:
* ============
*
*
****************************************************************************/
/* includes */
/************/
#include <stdio.h>
#include "cu_osapi.h"
#include "TWDriver.h"
#include "convert.h"
#include "console.h"
#include "cu_common.h"
#include "cu_os.h"
#include "ipc_event.h"
#include "wpa_core.h"
#include "cu_cmd.h"
#include "oserr.h"
/* defines */
/***********/
#define print_available_values(arr) \
{ \
S32 i; \
for(i=0; i<SIZE_ARR(arr); i++) \
os_error_printf(CU_MSG_INFO2, (PS8)"%d - %s%s", arr[i].value, arr[i].name, (i>=SIZE_ARR(arr)-1) ? (PS8)"\n" : (PS8)", " ); \
}
#define CU_CMD_FIND_NAME_ARRAY(index, arr, val) \
for ( index = 0; index < SIZE_ARR(arr); index++ ) \
if ( arr[ index ].value == (val) ) \
break; \
#define CHAN_FREQ_TABLE_SIZE (sizeof(ChanFreq) / sizeof(struct CHAN_FREQ))
#define IS_BASIC_RATE(a) ((a) & NET_BASIC_MASK)
#define RATE_2_MBPS(a) ((F32)((a) & (NET_BASIC_MASK-1))/2)
#define NET_BASIC_MASK 0x80 /* defined in common/src/utils/utils.c */
#define BIT_TO_BYTE_FACTOR 8
#define NVS_FILE_TX_PARAMETERS_UPDATE 0
#define NVS_FILE_RX_PARAMETERS_UPDATE 1
/* local types */
/***************/
/* Module control block */
typedef struct CuCmd_t
{
THandle hCuWext;
THandle hCuCommon;
THandle hConsole;
THandle hIpcEvent;
THandle hWpaCore;
U32 isDeviceRunning;
scan_Params_t appScanParams;
TPeriodicScanParams tPeriodicAppScanParams;
scan_Policy_t scanPolicy;
} CuCmd_t;
/* local variables */
/*******************/
struct CHAN_FREQ {
U8 chan;
U32 freq;
} ChanFreq[] = {
{1,2412000}, {2,2417000}, {3,2422000}, {4,2427000},
{5,2432000}, {6,2437000}, {7,2442000}, {8,2447000},
{9,2452000},
{10,2457000}, {11,2462000}, {12,2467000}, {13,2472000},
{14,2484000}, {36,5180000}, {40,5200000}, {44,5220000},
{48,5240000}, {52,5260000}, {56,5280000}, {60,5300000},
{64,5320000},
{100,5500000}, {104,5520000}, {108,5540000}, {112,5560000},
{116,5580000}, {120,5600000}, {124,5620000}, {128,5640000},
{132,5660000}, {136,5680000}, {140,5700000}, {149,5745000},
{153,5765000}, {157,5785000}, {161,5805000} };
static named_value_t BSS_type[] =
{
{ os802_11IBSS, (PS8)"AD-Hoc" },
{ os802_11Infrastructure, (PS8)"Infr." },
{ os802_11AutoUnknown, (PS8)"Auto" },
};
static named_value_t Current_mode[] =
{
{ 0, (PS8)"SME Auto" },
{ 1, (PS8)"SME Manual" },
};
static named_value_t BeaconFilter_use[] =
{
{ 0, (PS8)"INACTIVE" },
{ 1, (PS8)"ACTIVE" },
};
static named_value_t event_type[] = {
{ IPC_EVENT_ASSOCIATED, (PS8)"Associated" },
{ IPC_EVENT_DISASSOCIATED, (PS8)"Disassociated" },
{ IPC_EVENT_LINK_SPEED, (PS8)"LinkSpeed" },
{ IPC_EVENT_AUTH_SUCC, (PS8)"Authentication Success" },
{ IPC_EVENT_SCAN_COMPLETE, (PS8)"ScanComplete" },
{ IPC_EVENT_SCAN_STOPPED, (PS8)"ScanStopped" },
#ifdef XCC_MODULE_INCLUDED
{ IPC_EVENT_CCKM_START, (PS8)"CCKM_Start" },
#endif
{ IPC_EVENT_MEDIA_SPECIFIC, (PS8)"Media_Specific" },
{ IPC_EVENT_EAPOL, (PS8)"EAPOL" },
{ IPC_EVENT_RE_AUTH_STARTED, (PS8)"IPC_EVENT_RE_AUTH_STARTED" },
{ IPC_EVENT_RE_AUTH_COMPLETED, (PS8)"IPC_EVENT_RE_AUTH_COMPLETED" },
{ IPC_EVENT_RE_AUTH_TERMINATED, (PS8)"IPC_EVENT_RE_AUTH_TERMINATED" },
{ IPC_EVENT_BOUND, (PS8)"Bound" },
{ IPC_EVENT_UNBOUND, (PS8)"Unbound" },
#ifdef WPA_ENTERPRISE
{ IPC_EVENT_PREAUTH_EAPOL, (PS8)"PreAuth EAPOL"},
#endif
{ IPC_EVENT_LOW_RSSI, (PS8)"Low RSSI" },
{ IPC_EVENT_TSPEC_STATUS, (PS8)"IPC_EVENT_TSPEC_STATUS" },
{ IPC_EVENT_TSPEC_RATE_STATUS, (PS8)"IPC_EVENT_TSPEC_RATE_STATUS" },
{ IPC_EVENT_MEDIUM_TIME_CROSS, (PS8)"IPC_EVENT_MEDIUM_TIME_CROSS" },
{ IPC_EVENT_ROAMING_COMPLETE, (PS8)"ROAMING_COMPLETE"},
{ IPC_EVENT_EAP_AUTH_FAILURE, (PS8)"EAP-FAST/LEAP Auth Failed"},
{ IPC_EVENT_WPA2_PREAUTHENTICATION, (PS8)"IPC_EVENT_WPA2_PREAUTHENTICATION" },
{ IPC_EVENT_TRAFFIC_INTENSITY_THRESHOLD_CROSSED, (PS8)"IPC_EVENT_TRAFFIC_INTENSITY_THRESHOLD_CROSSED" },
{ IPC_EVENT_SCAN_FAILED, (PS8)"ScanFailed" },
{ IPC_EVENT_WPS_SESSION_OVERLAP, (PS8)"IPC_EVENT_WPS_SESSION_OVERLAP" },
{ IPC_EVENT_RSSI_SNR_TRIGGER_0, (PS8)"IPC_EVENT_RSSI_SNR_TRIGGER_0" },
{ IPC_EVENT_RSSI_SNR_TRIGGER_1, (PS8)"IPC_EVENT_RSSI_SNR_TRIGGER_1" },
{ IPC_EVENT_TIMEOUT, (PS8)"Timeout" }
};
static named_value_t report_module[] =
{
{ FILE_ID_0 , (PS8)"timer " },
{ FILE_ID_1 , (PS8)"measurementMgr " },
{ FILE_ID_2 , (PS8)"measurementMgrSM " },
{ FILE_ID_3 , (PS8)"regulatoryDomain " },
{ FILE_ID_4 , (PS8)"requestHandler " },
{ FILE_ID_5 , (PS8)"SoftGemini " },
{ FILE_ID_6 , (PS8)"spectrumMngmntMgr " },
{ FILE_ID_7 , (PS8)"SwitchChannel " },
{ FILE_ID_8 , (PS8)"roamingMngr " },
{ FILE_ID_9 , (PS8)"scanMngr " },
{ FILE_ID_10 , (PS8)"admCtrlXCC " },
{ FILE_ID_11 , (PS8)"XCCMngr " },
{ FILE_ID_12 , (PS8)"XCCRMMngr " },
{ FILE_ID_13 , (PS8)"XCCTSMngr " },
{ FILE_ID_14 , (PS8)"rogueAp " },
{ FILE_ID_15 , (PS8)"TransmitPowerXCC " },
{ FILE_ID_16 , (PS8)"admCtrl " },
{ FILE_ID_17 , (PS8)"admCtrlNone " },
{ FILE_ID_18 , (PS8)"admCtrlWep " },
{ FILE_ID_19 , (PS8)"admCtrlWpa " },
{ FILE_ID_20 , (PS8)"admCtrlWpa2 " },
{ FILE_ID_21 , (PS8)"apConn " },
{ FILE_ID_22 , (PS8)"broadcastKey802_1x " },
{ FILE_ID_23 , (PS8)"broadcastKeyNone " },
{ FILE_ID_24 , (PS8)"broadcastKeySM " },
{ FILE_ID_25 , (PS8)"conn " },
{ FILE_ID_26 , (PS8)"connIbss " },
{ FILE_ID_27 , (PS8)"connInfra " },
{ FILE_ID_28 , (PS8)"keyDerive " },
{ FILE_ID_29 , (PS8)"keyDeriveAes " },
{ FILE_ID_30 , (PS8)"keyDeriveCkip " },
{ FILE_ID_31 , (PS8)"keyDeriveTkip " },
{ FILE_ID_32 , (PS8)"keyDeriveWep " },
{ FILE_ID_33 , (PS8)"keyParser " },
{ FILE_ID_34 , (PS8)"keyParserExternal " },
{ FILE_ID_35 , (PS8)"keyParserWep " },
{ FILE_ID_36 , (PS8)"mainKeysSm " },
{ FILE_ID_37 , (PS8)"mainSecKeysOnly " },
{ FILE_ID_38 , (PS8)"mainSecNull " },
{ FILE_ID_39 , (PS8)"mainSecSm " },
{ FILE_ID_40 , (PS8)"rsn " },
{ FILE_ID_41 , (PS8)"sme " },
{ FILE_ID_42 , (PS8)"smeSelect " },
{ FILE_ID_43 , (PS8)"smeSm " },
{ FILE_ID_44 , (PS8)"unicastKey802_1x " },
{ FILE_ID_45 , (PS8)"unicastKeyNone " },
{ FILE_ID_46 , (PS8)"unicastKeySM " },
{ FILE_ID_47 , (PS8)"CmdDispatcher " },
{ FILE_ID_48 , (PS8)"CmdHndlr " },
{ FILE_ID_49 , (PS8)"DrvMain " },
{ FILE_ID_50 , (PS8)"EvHandler " },
{ FILE_ID_51 , (PS8)"Ctrl " },
{ FILE_ID_52 , (PS8)"GeneralUtil " },
{ FILE_ID_53 , (PS8)"RateAdaptation " },
{ FILE_ID_54 , (PS8)"rx " },
{ FILE_ID_55 , (PS8)"TrafficMonitor " },
{ FILE_ID_56 , (PS8)"txCtrl " },
{ FILE_ID_57 , (PS8)"txCtrlParams " },
{ FILE_ID_58 , (PS8)"txCtrlServ " },
{ FILE_ID_59 , (PS8)"TxDataClsfr " },
{ FILE_ID_60 , (PS8)"txDataQueue " },
{ FILE_ID_61 , (PS8)"txMgmtQueue " },
{ FILE_ID_62 , (PS8)"txPort " },
{ FILE_ID_63 , (PS8)"assocSM " },
{ FILE_ID_64 , (PS8)"authSm " },
{ FILE_ID_65 , (PS8)"currBss " },
{ FILE_ID_66 , (PS8)"healthMonitor " },
{ FILE_ID_67 , (PS8)"mlmeBuilder " },
{ FILE_ID_68 , (PS8)"mlmeParser " },
{ FILE_ID_69 , (PS8)"mlmeSm " },
{ FILE_ID_70 , (PS8)"openAuthSm " },
{ FILE_ID_71 , (PS8)"PowerMgr " },
{ FILE_ID_72 , (PS8)"PowerMgrDbgPrint " },
{ FILE_ID_73 , (PS8)"PowerMgrKeepAlive " },
{ FILE_ID_74 , (PS8)"qosMngr " },
{ FILE_ID_75 , (PS8)"roamingInt " },
{ FILE_ID_76 , (PS8)"ScanCncn " },
{ FILE_ID_77 , (PS8)"ScanCncnApp " },
{ FILE_ID_78 , (PS8)"ScanCncnOsSm " },
{ FILE_ID_79 , (PS8)"ScanCncnSm " },
{ FILE_ID_80 , (PS8)"ScanCncnSmSpecific " },
{ FILE_ID_81 , (PS8)"scanResultTable " },
{ FILE_ID_82 , (PS8)"scr " },
{ FILE_ID_83 , (PS8)"sharedKeyAuthSm " },
{ FILE_ID_84 , (PS8)"siteHash " },
{ FILE_ID_85 , (PS8)"siteMgr " },
{ FILE_ID_86 , (PS8)"StaCap " },
{ FILE_ID_87 , (PS8)"systemConfig " },
{ FILE_ID_88 , (PS8)"templates " },
{ FILE_ID_89 , (PS8)"trafficAdmControl " },
{ FILE_ID_90 , (PS8)"CmdBld " },
{ FILE_ID_91 , (PS8)"CmdBldCfg " },
{ FILE_ID_92 , (PS8)"CmdBldCfgIE " },
{ FILE_ID_93 , (PS8)"CmdBldCmd " },
{ FILE_ID_94 , (PS8)"CmdBldCmdIE " },
{ FILE_ID_95 , (PS8)"CmdBldItr " },
{ FILE_ID_96 , (PS8)"CmdBldItrIE " },
{ FILE_ID_97 , (PS8)"CmdQueue " },
{ FILE_ID_98 , (PS8)"RxQueue " },
{ FILE_ID_99 , (PS8)"txCtrlBlk " },
{ FILE_ID_100 , (PS8)"txHwQueue " },
{ FILE_ID_101 , (PS8)"CmdMBox " },
{ FILE_ID_102 , (PS8)"eventMbox " },
{ FILE_ID_103 , (PS8)"fwDebug " },
{ FILE_ID_104 , (PS8)"FwEvent " },
{ FILE_ID_105 , (PS8)"HwInit " },
{ FILE_ID_106 , (PS8)"RxXfer " },
{ FILE_ID_107 , (PS8)"txResult " },
{ FILE_ID_108 , (PS8)"txXfer " },
{ FILE_ID_109 , (PS8)"MacServices " },
{ FILE_ID_110 , (PS8)"MeasurementSrv " },
{ FILE_ID_111 , (PS8)"measurementSrvDbgPrint " },
{ FILE_ID_112 , (PS8)"MeasurementSrvSM " },
{ FILE_ID_113 , (PS8)"PowerSrv " },
{ FILE_ID_114 , (PS8)"PowerSrvSM " },
{ FILE_ID_115 , (PS8)"ScanSrv " },
{ FILE_ID_116 , (PS8)"ScanSrvSM " },
{ FILE_ID_117 , (PS8)"TWDriver " },
{ FILE_ID_118 , (PS8)"TWDriverCtrl " },
{ FILE_ID_119 , (PS8)"TWDriverRadio " },
{ FILE_ID_120 , (PS8)"TWDriverTx " },
{ FILE_ID_121 , (PS8)"TwIf " },
{ FILE_ID_122 , (PS8)"SdioBusDrv " },
{ FILE_ID_123 , (PS8)"TxnQueue " },
{ FILE_ID_124 , (PS8)"WspiBusDrv " },
{ FILE_ID_125 , (PS8)"context " },
{ FILE_ID_126 , (PS8)"freq " },
{ FILE_ID_127 , (PS8)"fsm " },
{ FILE_ID_128 , (PS8)"GenSM " },
{ FILE_ID_129 , (PS8)"mem " },
{ FILE_ID_130 , (PS8)"queue " },
{ FILE_ID_131 , (PS8)"rate " },
{ FILE_ID_132 , (PS8)"report " },
{ FILE_ID_133 , (PS8)"stack " }
};
static named_value_t report_severity[] = {
{ 0, (PS8)"----" },
{ REPORT_SEVERITY_INIT, (PS8)"INIT", },
{ REPORT_SEVERITY_INFORMATION, (PS8)"INFORMATION", },
{ REPORT_SEVERITY_WARNING, (PS8)"WARNING", },
{ REPORT_SEVERITY_ERROR, (PS8)"ERROR", },
{ REPORT_SEVERITY_FATAL_ERROR, (PS8)"FATAL_ERROR", },
{ REPORT_SEVERITY_SM, (PS8)"SM", },
{ REPORT_SEVERITY_CONSOLE, (PS8)"CONSOLE" }
};
static named_value_t power_level[] = {
{ OS_POWER_LEVEL_ELP, (PS8)"Extreme Low Power" },
{ OS_POWER_LEVEL_PD, (PS8)"Power Down" },
{ OS_POWER_LEVEL_AWAKE, (PS8)"Awake" },
};
static named_value_t band2Str[] = {
{ RADIO_BAND_2_4_GHZ, (PS8)"2.4 GHz" },
{ RADIO_BAND_5_0_GHZ, (PS8)"5.0 GHz" },
{ RADIO_BAND_DUAL, (PS8)"Both " }
};
static named_value_t EtEvent2Str[] = {
{ SCAN_ET_COND_DISABLE, (PS8)"ET disabled " },
{ SCAN_ET_COND_BEACON, (PS8)"ET on Beacon " },
{ SCAN_ET_COND_PROBE_RESP, (PS8)"ET on Prb Rsp" },
{ SCAN_ET_COND_ANY_FRAME, (PS8)"ET on both " }
};
static named_value_t rate2Str[] = {
{ DRV_RATE_MASK_AUTO, (PS8)"Auto " },
{ DRV_RATE_MASK_1_BARKER, (PS8)"1 Mbps " },
{ DRV_RATE_MASK_2_BARKER, (PS8)"2 Mbps " },
{ DRV_RATE_MASK_5_5_CCK, (PS8)"5.5 Mbps" },
{ DRV_RATE_MASK_11_CCK, (PS8)"11 Mbps " },
{ DRV_RATE_MASK_22_PBCC, (PS8)"22 Mbps " },
{ DRV_RATE_MASK_6_OFDM, (PS8)"6 Mbps " },
{ DRV_RATE_MASK_9_OFDM, (PS8)"9 Mbps " },
{ DRV_RATE_MASK_12_OFDM, (PS8)"12 Mbps " },
{ DRV_RATE_MASK_18_OFDM, (PS8)"18 Mbps " },
{ DRV_RATE_MASK_24_OFDM, (PS8)"24 Mbps " },
{ DRV_RATE_MASK_36_OFDM, (PS8)"36 Mbps " },
{ DRV_RATE_MASK_48_OFDM, (PS8)"48 Mbps " },
{ DRV_RATE_MASK_54_OFDM, (PS8)"54 Mbps " }
};
static named_value_t scanType2Str[] = {
{ SCAN_TYPE_NORMAL_PASSIVE, (PS8)"Passive Normal Scan" },
{ SCAN_TYPE_NORMAL_ACTIVE, (PS8)"Active Normal Scan" },
{ SCAN_TYPE_SPS, (PS8)"Scheduled Passive Scan (SPS)" },
{ SCAN_TYPE_TRIGGERED_PASSIVE, (PS8)"Passive Triggered Scan" },
{ SCAN_TYPE_TRIGGERED_ACTIVE, (PS8)"Active Triggered Scan" }
};
static named_value_t booleanStr[] = {
{ FALSE, (PS8)"False" },
{ TRUE, (PS8)"True" }
};
static named_value_t ssidVisabilityStr[] = {
{ SCAN_SSID_VISABILITY_PUBLIC, (PS8)"Public" },
{ SCAN_SSID_VISABILITY_HIDDEN, (PS8)"Hidden" }
};
static named_value_t bssTypeStr[] = {
{ BSS_INDEPENDENT, (PS8)"Independent" },
{ BSS_INFRASTRUCTURE, (PS8)"Infrastructure" },
{ BSS_ANY, (PS8)"Any" }
};
static named_value_t power_mode_val[] = {
{ OS_POWER_MODE_AUTO, (PS8)"AUTO" },
{ OS_POWER_MODE_ACTIVE, (PS8)"ACTIVE" },
{ OS_POWER_MODE_SHORT_DOZE, (PS8)"SHORT_DOZE" },
{ OS_POWER_MODE_LONG_DOZE, (PS8)"LONG_DOZE" }
};
static named_value_t encrypt_type[] = {
{ OS_ENCRYPTION_TYPE_NONE, (PS8)"None" },
{ OS_ENCRYPTION_TYPE_WEP, (PS8)"WEP" },
{ OS_ENCRYPTION_TYPE_TKIP, (PS8)"TKIP" },
{ OS_ENCRYPTION_TYPE_AES, (PS8)"AES" }
};
static named_value_t tKeepAliveTriggerTypes[] = {
{ KEEP_ALIVE_TRIG_TYPE_NO_TX, (PS8)"When Idle" },
{ KEEP_ALIVE_TRIG_TYPE_PERIOD_ONLY, (PS8)"Always" }
};
#if 0 /* need to create debug logic for CLI */
static named_value_t cli_level_type[] = {
{ CU_MSG_DEBUG, (PS8)"CU_MSG_DEBUG" },
{ CU_MSG_INFO1, (PS8)"CU_MSG_INFO1" },
{ CU_MSG_WARNING, (PS8)"CU_MSG_WARNING" },
{ CU_MSG_ERROR, (PS8)"CU_MSG_ERROR" },
{ CU_MSG_INFO2, (PS8)"CU_MSG_INFO2" }
};
#endif
/* local fucntions */
/*******************/
static S32 CuCmd_Str2MACAddr(PS8 str, PU8 mac)
{
S32 i;
for( i=0; i<MAC_ADDR_LEN; i++ )
{
mac[i] = (U8) os_strtoul(str, &str, 16);
str++;
}
return TRUE;
}
/* used in get_bssid_list() */
static U8 CuCmd_Freq2Chan(U32 freq)
{
U32 i;
for(i=0; i<CHAN_FREQ_TABLE_SIZE; i++)
if(ChanFreq[i].freq == freq)
return ChanFreq[i].chan;
return 0;
}
/* Converts a single ASCII character to a hex value (i.e. '0'-'9' = 0-9, 'a'-'f' = a-f, 'A'-'F' = a-f) */
static U8 CuCmd_atox(U8 c)
{
if (('0' <= c) && ('9' >= c))
{
return c - '0';
}
else if (('a' <= c) && ('f' >= c))
{
return c - 'a' + 10;
}
else /* assuming input is valid */
{
return c - 'A' + 10;
}
}
/* converts an ASCII string to a buffer */
static void CuCmd_atox_string (U8* srcString, U8* dstBuffer)
{
U32 uIndex, uLength;
uLength = os_strlen ((PS8)srcString);
/* clear the destination buffer */
os_memset (dstBuffer, 0, (uLength / 2) + 1);
for (uIndex = 0; uIndex < uLength; uIndex++)
{
if (0 == (uIndex % 2))
{
dstBuffer[ uIndex / 2 ] |= (CuCmd_atox (srcString[ uIndex ]) << 4);
}
else
{
dstBuffer[ uIndex / 2 ] |= CuCmd_atox (srcString[ uIndex ]);
}
}
}
static void CuCmd_xtoa_string (U8* srcBuffer, U32 srcBufferLength, U8* dstString)
{
U32 uIndex;
for (uIndex = 0; uIndex < srcBufferLength; uIndex++)
{
os_sprintf ((PS8)&(dstString[ uIndex * 2 ]), (PS8)"%02x", srcBuffer[ uIndex ]);
}
}
static VOID CuCmd_Init_Scan_Params(CuCmd_t* pCuCmd)
{
U8 i,j;
/* init application scan default params */
pCuCmd->appScanParams.desiredSsid.len = 0;
pCuCmd->appScanParams.scanType = SCAN_TYPE_NORMAL_ACTIVE;
pCuCmd->appScanParams.band = RADIO_BAND_2_4_GHZ;
pCuCmd->appScanParams.probeReqNumber = 3;
pCuCmd->appScanParams.probeRequestRate = RATE_MASK_UNSPECIFIED; /* Let the FW select */;
pCuCmd->appScanParams.numOfChannels = 14;
for ( i = 0; i < 14; i++ )
{
for ( j = 0; j < 6; j++ )
{
pCuCmd->appScanParams.channelEntry[ i ].normalChannelEntry.bssId[ j ] = 0xff;
}
pCuCmd->appScanParams.channelEntry[ i ].normalChannelEntry.earlyTerminationEvent = SCAN_ET_COND_DISABLE;
pCuCmd->appScanParams.channelEntry[ i ].normalChannelEntry.ETMaxNumOfAPframes = 0;
pCuCmd->appScanParams.channelEntry[ i ].normalChannelEntry.maxChannelDwellTime = 60000;
pCuCmd->appScanParams.channelEntry[ i ].normalChannelEntry.minChannelDwellTime = 30000;
pCuCmd->appScanParams.channelEntry[ i ].normalChannelEntry.txPowerDbm = DEF_TX_POWER;
pCuCmd->appScanParams.channelEntry[ i ].normalChannelEntry.channel = i + 1;
}
/* init periodic application scan params */
pCuCmd->tPeriodicAppScanParams.uSsidNum = 0;
pCuCmd->tPeriodicAppScanParams.uSsidListFilterEnabled = 1;
pCuCmd->tPeriodicAppScanParams.uCycleNum = 0; /* forever */
pCuCmd->tPeriodicAppScanParams.uCycleIntervalMsec[ 0 ] = 3;
for (i = 1; i < PERIODIC_SCAN_MAX_INTERVAL_NUM; i++)
{
pCuCmd->tPeriodicAppScanParams.uCycleIntervalMsec[ i ] = 30000;
}
pCuCmd->tPeriodicAppScanParams.iRssiThreshold = -80;
pCuCmd->tPeriodicAppScanParams.iSnrThreshold = 0;
pCuCmd->tPeriodicAppScanParams.uFrameCountReportThreshold = 1;
pCuCmd->tPeriodicAppScanParams.bTerminateOnReport = TRUE;
pCuCmd->tPeriodicAppScanParams.eBssType = BSS_ANY;
pCuCmd->tPeriodicAppScanParams.uProbeRequestNum = 3;
pCuCmd->tPeriodicAppScanParams.uChannelNum = 14;
for ( i = 0; i < 14; i++ )
{
pCuCmd->tPeriodicAppScanParams.tChannels[ i ].eBand = RADIO_BAND_2_4_GHZ;
pCuCmd->tPeriodicAppScanParams.tChannels[ i ].uChannel = i + 1;
pCuCmd->tPeriodicAppScanParams.tChannels[ i ].eScanType = SCAN_TYPE_NORMAL_ACTIVE;
pCuCmd->tPeriodicAppScanParams.tChannels[ i ].uMinDwellTimeMs = 5;
pCuCmd->tPeriodicAppScanParams.tChannels[ i ].uMaxDwellTimeMs = 20;
pCuCmd->tPeriodicAppScanParams.tChannels[ i ].uTxPowerLevelDbm = DEF_TX_POWER;
}
/* init default scan policy */
pCuCmd->scanPolicy.normalScanInterval = 10000;
pCuCmd->scanPolicy.deterioratingScanInterval = 5000;
pCuCmd->scanPolicy.maxTrackFailures = 3;
pCuCmd->scanPolicy.BSSListSize = 4;
pCuCmd->scanPolicy.BSSNumberToStartDiscovery = 1;
pCuCmd->scanPolicy.numOfBands = 1;
pCuCmd->scanPolicy.bandScanPolicy[ 0 ].band = RADIO_BAND_2_4_GHZ;
pCuCmd->scanPolicy.bandScanPolicy[ 0 ].rxRSSIThreshold = -80;
pCuCmd->scanPolicy.bandScanPolicy[ 0 ].numOfChannles = 14;
pCuCmd->scanPolicy.bandScanPolicy[ 0 ].numOfChannlesForDiscovery = 3;
for ( i = 0; i < 14; i++ )
{
pCuCmd->scanPolicy.bandScanPolicy[ 0 ].channelList[ i ] = i + 1;
}
pCuCmd->scanPolicy.bandScanPolicy[ 0 ].trackingMethod.scanType = SCAN_TYPE_NORMAL_ACTIVE;
pCuCmd->scanPolicy.bandScanPolicy[ 0 ].trackingMethod.method.basicMethodParams.earlyTerminationEvent = SCAN_ET_COND_DISABLE;
pCuCmd->scanPolicy.bandScanPolicy[ 0 ].trackingMethod.method.basicMethodParams.ETMaxNumberOfApFrames = 0;
pCuCmd->scanPolicy.bandScanPolicy[ 0 ].trackingMethod.method.basicMethodParams.maxChannelDwellTime = 30000;
pCuCmd->scanPolicy.bandScanPolicy[ 0 ].trackingMethod.method.basicMethodParams.minChannelDwellTime = 15000;
pCuCmd->scanPolicy.bandScanPolicy[ 0 ].trackingMethod.method.basicMethodParams.probReqParams.bitrate = RATE_MASK_UNSPECIFIED; /* Let the FW select */
pCuCmd->scanPolicy.bandScanPolicy[ 0 ].trackingMethod.method.basicMethodParams.probReqParams.numOfProbeReqs = 3;
pCuCmd->scanPolicy.bandScanPolicy[ 0 ].trackingMethod.method.basicMethodParams.probReqParams.txPowerDbm = DEF_TX_POWER;
pCuCmd->scanPolicy.bandScanPolicy[ 0 ].discoveryMethod.scanType = SCAN_TYPE_NORMAL_ACTIVE;
pCuCmd->scanPolicy.bandScanPolicy[ 0 ].discoveryMethod.method.basicMethodParams.earlyTerminationEvent = SCAN_ET_COND_DISABLE;
pCuCmd->scanPolicy.bandScanPolicy[ 0 ].discoveryMethod.method.basicMethodParams.ETMaxNumberOfApFrames = 0;
pCuCmd->scanPolicy.bandScanPolicy[ 0 ].discoveryMethod.method.basicMethodParams.maxChannelDwellTime = 30000;
pCuCmd->scanPolicy.bandScanPolicy[ 0 ].discoveryMethod.method.basicMethodParams.minChannelDwellTime = 15000;
pCuCmd->scanPolicy.bandScanPolicy[ 0 ].discoveryMethod.method.basicMethodParams.probReqParams.bitrate = RATE_MASK_UNSPECIFIED; /* Let the FW select */;
pCuCmd->scanPolicy.bandScanPolicy[ 0 ].discoveryMethod.method.basicMethodParams.probReqParams.numOfProbeReqs = 3;
pCuCmd->scanPolicy.bandScanPolicy[ 0 ].discoveryMethod.method.basicMethodParams.probReqParams.txPowerDbm = DEF_TX_POWER;
pCuCmd->scanPolicy.bandScanPolicy[ 0 ].immediateScanMethod.scanType = SCAN_TYPE_NORMAL_ACTIVE;
pCuCmd->scanPolicy.bandScanPolicy[ 0 ].immediateScanMethod.method.basicMethodParams.earlyTerminationEvent = SCAN_ET_COND_DISABLE;
pCuCmd->scanPolicy.bandScanPolicy[ 0 ].immediateScanMethod.method.basicMethodParams.ETMaxNumberOfApFrames = 0;
pCuCmd->scanPolicy.bandScanPolicy[ 0 ].immediateScanMethod.method.basicMethodParams.maxChannelDwellTime = 30000;
pCuCmd->scanPolicy.bandScanPolicy[ 0 ].immediateScanMethod.method.basicMethodParams.minChannelDwellTime = 15000;
pCuCmd->scanPolicy.bandScanPolicy[ 0 ].immediateScanMethod.method.basicMethodParams.probReqParams.bitrate = RATE_MASK_UNSPECIFIED; /* Let the FW select */;
pCuCmd->scanPolicy.bandScanPolicy[ 0 ].immediateScanMethod.method.basicMethodParams.probReqParams.numOfProbeReqs = 3;
pCuCmd->scanPolicy.bandScanPolicy[ 0 ].immediateScanMethod.method.basicMethodParams.probReqParams.txPowerDbm = DEF_TX_POWER;
}
char* PrintSSID(OS_802_11_SSID* ssid)
{
if(ssid->SsidLength < 32)
ssid->Ssid[ssid->SsidLength] = 0;
else
ssid->Ssid[31] = 0;
return (char*)&ssid->Ssid[0];
}
static VOID CuCmd_PrintBssidList(OS_802_11_BSSID_LIST_EX* bssidList, S32 IsFullPrint, TMacAddr CurrentBssid)
{
U32 i;
S8 connectionTypeStr[50];
POS_802_11_BSSID_EX pBssid = &bssidList->Bssid[0];
os_error_printf(CU_MSG_INFO2, (PS8)"BssId List: Num=%u\n", bssidList->NumberOfItems);
os_error_printf(CU_MSG_INFO2, (PS8)" MAC Privacy Rssi Mode Channel SSID\n");
for(i=0; i<bssidList->NumberOfItems; i++)
{
switch (pBssid->InfrastructureMode)
{
case os802_11IBSS:
os_strcpy (connectionTypeStr, (PS8)"Adhoc");
break;
case os802_11Infrastructure:
os_strcpy (connectionTypeStr, (PS8)"Infra");
break;
case os802_11AutoUnknown:
os_strcpy (connectionTypeStr, (PS8)"Auto");
break;
default:
os_strcpy (connectionTypeStr, (PS8)" --- ");
break;
}
os_error_printf(CU_MSG_INFO2, (PS8)"%s%02x.%02x.%02x.%02x.%02x.%02x %3u %4d %s %6d %s\n",
(!os_memcmp(CurrentBssid, pBssid->MacAddress, MAC_ADDR_LEN))?"*":" ",
pBssid->MacAddress[0],
pBssid->MacAddress[1],
pBssid->MacAddress[2],
pBssid->MacAddress[3],
pBssid->MacAddress[4],
pBssid->MacAddress[5],
pBssid->Privacy,
(char)pBssid->Rssi | 0xffffff00, /* need the 0xffffff00 to get negative value display */
connectionTypeStr,
CuCmd_Freq2Chan(pBssid->Configuration.Union.channel),
(pBssid->Ssid.Ssid[0] == '\0')?(PS8)"****":((PS8)pBssid->Ssid.Ssid) );
if (IsFullPrint)
{
os_error_printf(CU_MSG_INFO2, (PS8)" BeaconInterval %d\n", pBssid->Configuration.BeaconPeriod);
os_error_printf(CU_MSG_INFO2, (PS8)" Capabilities 0x%x\n", pBssid->Capabilities);
}
#ifdef _WINDOWS
pBssid = (POS_802_11_BSSID_EX)((S8*)pBssid + (pBssid->Length ? pBssid->Length : sizeof(OS_802_11_BSSID_EX)));
#else /*for Linux*/
pBssid = &bssidList->Bssid[i+1];
#endif
}
}
static U8 CuCmd_Char2Hex( S8 c )
{
if( c >= '0' && c <= '9' )
return c - '0';
else if( os_tolower(c) >= 'a' && os_tolower(c) <= 'f' )
return (U8) (os_tolower(c) - 'a' + 0x0a);
os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - CuCmd_Char2Hex - invalid symbol '%c'\n", c );
return ((U8)-1);
}
static PS8 CuCmd_CreateRateStr(PS8 str, U8 rate)
{
if( rate == 0 )
return os_strcpy(str,(PS8)"Auto (0)");
os_sprintf(str, (PS8)"%.3g Mbps",
RATE_2_MBPS(rate));
return str;
}
static VOID CuCmd_PrintScanMethod(scan_Method_t* scanMethod)
{
S32 i;
os_error_printf(CU_MSG_INFO2, (PS8)"Scan type: %s\n", scanType2Str[ scanMethod->scanType ].name);
switch (scanMethod->scanType)
{
case SCAN_TYPE_NORMAL_ACTIVE:
case SCAN_TYPE_NORMAL_PASSIVE:
os_error_printf(CU_MSG_INFO2, (PS8)"Max channel dwell time: %d, Min channel dwell time: %d\n",
scanMethod->method.basicMethodParams.maxChannelDwellTime,
scanMethod->method.basicMethodParams.minChannelDwellTime);
CU_CMD_FIND_NAME_ARRAY(i, EtEvent2Str, scanMethod->method.basicMethodParams.earlyTerminationEvent);
os_error_printf(CU_MSG_INFO2 ,(PS8)"ET condition: %s, ET number of frames: %d\n",
EtEvent2Str[i].name,
scanMethod->method.basicMethodParams.ETMaxNumberOfApFrames);
CU_CMD_FIND_NAME_ARRAY(i, rate2Str, scanMethod->method.basicMethodParams.probReqParams.bitrate);
os_error_printf(CU_MSG_INFO2 ,(PS8)"Probe request number: %d, probe request rate: %s, TX level: %d\n",
scanMethod->method.basicMethodParams.probReqParams.numOfProbeReqs,
rate2Str[i].name,
scanMethod->method.basicMethodParams.probReqParams.txPowerDbm);
break;
case SCAN_TYPE_TRIGGERED_ACTIVE:
case SCAN_TYPE_TRIGGERED_PASSIVE:
os_error_printf(CU_MSG_INFO2, (PS8)"Triggering Tid: %d\n", scanMethod->method.TidTriggerdMethodParams.triggeringTid);
os_error_printf(CU_MSG_INFO2, (PS8)"Max channel dwell time: %d, Min channel dwell time: %d\n",
scanMethod->method.basicMethodParams.maxChannelDwellTime,
scanMethod->method.basicMethodParams.minChannelDwellTime);
CU_CMD_FIND_NAME_ARRAY(i, EtEvent2Str, scanMethod->method.basicMethodParams.earlyTerminationEvent);
os_error_printf(CU_MSG_INFO2, (PS8)"ET condition: %s, ET number of frames: %d\n",
EtEvent2Str[i].name,
scanMethod->method.basicMethodParams.ETMaxNumberOfApFrames);
CU_CMD_FIND_NAME_ARRAY(i, rate2Str, scanMethod->method.basicMethodParams.probReqParams.bitrate);
os_error_printf(CU_MSG_INFO2, (PS8)"Probe request number: %d, probe request rate: %s, TX level: %d\n",
scanMethod->method.basicMethodParams.probReqParams.numOfProbeReqs,
rate2Str[i].name,
scanMethod->method.basicMethodParams.probReqParams.txPowerDbm);
break;
case SCAN_TYPE_SPS:
CU_CMD_FIND_NAME_ARRAY(i, EtEvent2Str, scanMethod->method.spsMethodParams.earlyTerminationEvent);
os_error_printf(CU_MSG_INFO2, (PS8)"ET condition: %s, ET number of frames: %d\n",
EtEvent2Str[i].name,
scanMethod->method.spsMethodParams.ETMaxNumberOfApFrames);
os_error_printf(CU_MSG_INFO2, (PS8)"Scan duration: %d\n", scanMethod->method.spsMethodParams.scanDuration);
break;
case SCAN_TYPE_NO_SCAN:
case SCAN_TYPE_PACTSIVE:
break;
}
}
static VOID CuCmd_PrintScanBand(scan_bandPolicy_t* pBandPolicy)
{
S32 j;
os_error_printf(CU_MSG_INFO2, (PS8)"\nBand: %s\n", band2Str[ pBandPolicy->band ].name);
os_error_printf(CU_MSG_INFO2, (PS8)"RSSI Threshold: %d dBm\n", pBandPolicy->rxRSSIThreshold);
os_error_printf(CU_MSG_INFO2, (PS8)"Number of channels for each discovery interval: %d\n", pBandPolicy->numOfChannlesForDiscovery);
os_error_printf(CU_MSG_INFO2, (PS8)"\nTracking Method:\n");
CuCmd_PrintScanMethod( &(pBandPolicy->trackingMethod) );
os_error_printf(CU_MSG_INFO2, (PS8)"\nDiscovery Method:\n");
CuCmd_PrintScanMethod( &(pBandPolicy->discoveryMethod) );
os_error_printf(CU_MSG_INFO2, (PS8)"\nImmediate Scan Method:\n");
CuCmd_PrintScanMethod( &(pBandPolicy->immediateScanMethod) );
if ( pBandPolicy->numOfChannles > 0 )
{
os_error_printf(CU_MSG_INFO2, (PS8)"\nChannel list: ");
for ( j = 0; j < pBandPolicy->numOfChannles; j++ )
{
os_error_printf(CU_MSG_INFO2, (PS8)"%3d ", pBandPolicy->channelList[ j ]);
}
os_error_printf(CU_MSG_INFO2, (PS8)"\n");
}
else
{
os_error_printf(CU_MSG_INFO2, (PS8)"\nNo channels defined.\n");
}
}
static U32 CuCmd_IsValueRate(U32 rate)
{
switch (rate)
{
case 1:
case 2:
case 5:
case 6:
case 9:
case 11:
case 12:
case 18:
case 24:
case 36:
case 48:
case 54:
return (TRUE);
default:
return (FALSE);
}
}
static VOID CuCmd_ParseMaskString(PS8 pString, PU8 pBuffer, PU8 pLength)
{
S8 ch;
S32 iter = 0;
U8 val;
while ((ch = pString[iter]))
{
val = (ch == '1' ? 1 : 0);
if (iter % BIT_TO_BYTE_FACTOR)
pBuffer[iter / BIT_TO_BYTE_FACTOR] |= (val << (iter % BIT_TO_BYTE_FACTOR));
else
pBuffer[iter / BIT_TO_BYTE_FACTOR] = val;
++iter;
}
/* iter = 0 len = 0, iter = 1 len = 1, iter = 8 len = 1, and so on... */
*pLength = (U8) (iter + BIT_TO_BYTE_FACTOR - 1) / BIT_TO_BYTE_FACTOR;
}
static VOID CuCmd_ParsePatternString(PS8 pString, PU8 pBuffer, PU8 pLength)
{
S8 ch;
S32 iter = 0;
U8 val;
while ((ch = pString[iter]))
{
val = ((ch >= '0' && ch <= '9') ? (ch - '0') :
(ch >= 'A' && ch <= 'F') ? (0xA + ch - 'A') :
(ch >= 'a' && ch <= 'f') ? (0xA + ch - 'a') : 0);
/* even indexes go to the lower nibble, odd indexes push them to the */
/* higher nibble and then go themselves to the lower nibble. */
if (iter % 2)
pBuffer[iter / 2] = ((pBuffer[iter / 2] << (BIT_TO_BYTE_FACTOR / 2)) | val);
else
pBuffer[iter / 2] = val;
++iter;
}
/* iter = 0 len = 0, iter = 1 len = 1, iter = 2 len = 1, and so on... */
*pLength = (U8) (iter + 1) / 2;
}
/* functions */
/*************/
THandle CuCmd_Create(const PS8 device_name, THandle hConsole, S32 BypassSupplicant, PS8 pSupplIfFile)
{
THandle hIpcSta;
CuCmd_t* pCuCmd = (CuCmd_t*)os_MemoryCAlloc(sizeof(CuCmd_t), sizeof(U8));
if(pCuCmd == NULL)
{
os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - CuCmd_Create - cant allocate control block\n");
return NULL;
}
pCuCmd->isDeviceRunning = FALSE;
pCuCmd->hConsole = hConsole;
pCuCmd->hCuCommon= CuCommon_Create(&hIpcSta, device_name);
if(pCuCmd->hCuCommon == NULL)
{
CuCmd_Destroy(pCuCmd);
return NULL;
}
pCuCmd->hCuWext= CuOs_Create(hIpcSta);
if(pCuCmd->hCuWext == NULL)
{
CuCmd_Destroy(pCuCmd);
return NULL;
}
pCuCmd->hIpcEvent = (THandle) IpcEvent_Create();
if(pCuCmd->hIpcEvent == NULL)
{
CuCmd_Destroy(pCuCmd);
return NULL;
}
if(BypassSupplicant)
{
/* specify that there is no supplicant */
pCuCmd->hWpaCore = NULL;
}
else
{
#ifndef NO_WPA_SUPPL
S32 res;
pCuCmd->hWpaCore = WpaCore_Create(&res, pSupplIfFile);
if((pCuCmd->hWpaCore == NULL) && (res != EOALERR_IPC_WPA_ERROR_CANT_CONNECT_TO_SUPPL))
{
CuCmd_Destroy(pCuCmd);
return NULL;
}
if(res == EOALERR_IPC_WPA_ERROR_CANT_CONNECT_TO_SUPPL)
{
os_error_printf(CU_MSG_ERROR, (PS8)"******************************************************\n");
os_error_printf(CU_MSG_ERROR, (PS8)"Connection to supplicant failed\n");
os_error_printf(CU_MSG_ERROR, (PS8)"******************************************************\n");
}
else
{
os_error_printf(CU_MSG_INFO2, (PS8)"Connection established with supplicant\n");
}
#endif
}
CuCmd_Init_Scan_Params(pCuCmd);
return pCuCmd;
}
VOID CuCmd_Destroy(THandle hCuCmd)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
if(pCuCmd->hCuCommon)
{
CuCommon_Destroy(pCuCmd->hCuCommon);
}
if(pCuCmd->hCuWext)
{
CuOs_Destroy(pCuCmd->hCuWext);
}
if(pCuCmd->hIpcEvent)
{
IpcEvent_Destroy(pCuCmd->hIpcEvent);
}
#ifndef NO_WPA_SUPPL
if(pCuCmd->hWpaCore)
{
WpaCore_Destroy(pCuCmd->hWpaCore);
}
#endif
os_MemoryFree(pCuCmd);
}
S32 CuCmd_GetDeviceStatus(THandle hCuCmd)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
S32 status;
status = CuCommon_GetU32(pCuCmd->hCuCommon, DRIVER_STATUS_PARAM, &pCuCmd->isDeviceRunning);
if ((status == OK) && pCuCmd->isDeviceRunning)
return OK;
return ECUERR_CU_CMD_ERROR_DEVICE_NOT_LOADED;
}
VOID CuCmd_StartDriver(THandle hCuCmd)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
U32 uDummyBuf;
if(OK != CuCommon_SetBuffer(pCuCmd->hCuCommon, DRIVER_START_PARAM, &uDummyBuf, sizeof(uDummyBuf)))
{
os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - Failed to start driver!\n");
}
}
VOID CuCmd_StopDriver(THandle hCuCmd)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
U32 uDummyBuf;
if(OK != CuCommon_SetBuffer(pCuCmd->hCuCommon, DRIVER_STOP_PARAM, &uDummyBuf, sizeof(uDummyBuf)))
{
os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - Failed to stop driver!\n");
}
}
#ifdef XCC_MODULE_INCLUDED
THandle CuCmd_GetCuCommonHandle(THandle hCuCmd)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
return pCuCmd->hCuCommon;
}
THandle CuCmd_GetCuWpaHandle (THandle hCuCmd)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
return pCuCmd->hWpaCore;
}
#endif
VOID CuCmd_Show_Status(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
TMacAddr Mac;
OS_802_11_SSID ssid;
TMacAddr bssid;
U32 channel, threadid=0;
if(OK != CuCmd_GetDeviceStatus(hCuCmd))
{
os_error_printf(CU_MSG_INFO2, (PS8)"Driver is stopped!\n");
return;
}
CuOs_GetDriverThreadId(pCuCmd->hCuWext, &threadid);
if(OK != CuCommon_GetBuffer(pCuCmd->hCuCommon, CTRL_DATA_MAC_ADDRESS, Mac, sizeof(TMacAddr))) return;
if(OK != CuOs_Get_SSID(pCuCmd->hCuWext, &ssid)) return;
if(OK != CuOs_Get_BSSID(pCuCmd->hCuWext, bssid)) return;
if(OK != CuOs_GetCurrentChannel(pCuCmd->hCuWext, &channel)) return;
if (threadid != 0)
{
os_error_printf(CU_MSG_INFO2, (PS8)"Thread id: %u (0x%x)\n\n", threadid, threadid);
}
os_error_printf(CU_MSG_INFO2, (PS8)"==========================\n");
os_error_printf(CU_MSG_INFO2, (PS8)"Status : running\n");
os_error_printf(CU_MSG_INFO2, (PS8)"MAC : %02x.%02x.%02x.%02x.%02x.%02x\n",Mac[0],Mac[1],Mac[2],Mac[3],Mac[4],Mac[5]);
os_error_printf(CU_MSG_INFO2, (PS8)"SSID : %s\n",(ssid.SsidLength)?PrintSSID(&ssid):"<empty>");
os_error_printf(CU_MSG_INFO2, (PS8)"BSSID : %02x.%02x.%02x.%02x.%02x.%02x\n",bssid[0],bssid[1],bssid[2],bssid[3],bssid[4],bssid[5]);
if(channel)
os_error_printf(CU_MSG_INFO2, (PS8)"Channel : %d\n",channel);
else
os_error_printf(CU_MSG_INFO2, (PS8)"Channel : <empty>\n");
os_error_printf(CU_MSG_INFO2, (PS8)"==========================\n");
}
VOID CuCmd_BssidList(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
U32 SizeOfBssiList=0;
OS_802_11_BSSID_LIST_EX* bssidList;
TMacAddr bssid;
if(OK != CuCommon_Get_BssidList_Size(pCuCmd->hCuCommon, &SizeOfBssiList))
{
os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - CuCmd_Bssid_List - cant get Bssid list size\n");
return;
}
/* allocate the bssidList */
bssidList = os_MemoryCAlloc(SizeOfBssiList, sizeof(U8));
if(bssidList == NULL)
{
os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - CuCmd_Bssid_List - cant allocate Bssid list\n");
return;
}
if(SizeOfBssiList == sizeof(U32))
{
/* means that bssidList is empty*/
bssidList->NumberOfItems = 0;
/* os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - CuCmd_Bssid_List - size of list is %d, indicating empty list\n",
sizeof(U32)); */
}
else
{
if (OK != CuOs_GetBssidList(pCuCmd->hCuWext, bssidList))
{
os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - CuCmd_Bssid_List - cant get Bssid list\n");
os_MemoryFree(bssidList);
return;
}
}
/* get currently connected bssid */
if(OK != CuOs_Get_BSSID(pCuCmd->hCuWext, bssid))
{
os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - CuCmd_Bssid_List - cant get current BSSID\n");
os_MemoryFree(bssidList);
return;
}
/* print the list to the terminal */
CuCmd_PrintBssidList(bssidList, FALSE, bssid);
/* free the bssidList */
os_MemoryFree(bssidList);
}
VOID CuCmd_FullBssidList(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
U32 SizeOfBssiList=0;
OS_802_11_BSSID_LIST_EX* bssidList;
TMacAddr bssid;
if(OK != CuCommon_Get_BssidList_Size(pCuCmd->hCuCommon, &SizeOfBssiList)) return;
/* allocate the bssidList */
bssidList = os_MemoryCAlloc(SizeOfBssiList, sizeof(U8));
if(bssidList == NULL)
{
os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - CuCmd_Bssid_List - cant allocate Bssid list\n");
return;
}
if(SizeOfBssiList == sizeof(U32))
{
/* means that bssidList is empty*/
bssidList->NumberOfItems = 0;
}
else
{
if(OK != CuOs_GetBssidList(pCuCmd->hCuWext, bssidList) ) return;
}
/* get currently connected bssid */
if(OK != CuOs_Get_BSSID(pCuCmd->hCuWext, bssid)) return;
/* print the list to the terminal */
CuCmd_PrintBssidList(bssidList, TRUE, bssid);
/* free the bssidList */
os_MemoryFree(bssidList);
}
#if defined(CONFIG_EAP_WSC) && !defined(NO_WPA_SUPPL)
VOID CuCmd_StartEnrolleePIN(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
if (pCuCmd->hWpaCore == NULL)
{
os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - Cannot start Enrollee without connection to supplicant\n");
return;
}
WpaCore_StartWpsPIN(pCuCmd->hWpaCore);
os_error_printf(CU_MSG_INFO2, (PS8)"WPS in PIN mode started\n");
}
VOID CuCmd_StartEnrolleePBC(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
if (pCuCmd->hWpaCore == NULL)
{
os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - Cannot start Enrollee push button without connection to supplicant\n");
return;
}
WpaCore_StartWpsPBC(pCuCmd->hWpaCore);
os_error_printf(CU_MSG_INFO2, (PS8)"WPS in PBC mode started\n");
}
VOID CuCmd_StopEnrollee(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
if (pCuCmd->hWpaCore == NULL)
{
os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - Cannot Stop Enrollee without connection to supplicant\n");
return;
}
WpaCore_StopWps(pCuCmd->hWpaCore);
os_error_printf(CU_MSG_INFO2, (PS8)"WPS mode stopped\n");
}
VOID CuCmd_SetPin(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
if (pCuCmd->hWpaCore == NULL)
{
os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - Cannot set PIN without connection to supplicant\n");
return;
}
WpaCore_SetPin(pCuCmd->hWpaCore, (PS8)parm[0].value);
os_error_printf(CU_MSG_INFO2, (PS8)"WPS PIN set %s\n", parm[0].value);
}
#endif /* CONFIG_EAP_WSC */
VOID CuCmd_Connect(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
TMacAddr bssid = { 0xff,0xff,0xff,0xff,0xff,0xff };
OS_802_11_SSID ssid;
U32 BssType;
switch (nParms)
{
case 0 :
/*
* No SSID & No BSSID are set -
* Use Any SSID & Any BSSID.
*/
ssid.SsidLength = 0;
ssid.Ssid[0] = 0;
break;
case 1:
/*
* SSID set & BSSID insn't set -
* Use CLI's SSID & Any BSSID.
*/
ssid.SsidLength = os_strlen( (PS8)parm[0].value);
os_memcpy((PVOID)ssid.Ssid, (PVOID) parm[0].value, ssid.SsidLength);
ssid.Ssid[ssid.SsidLength] = '\0';
break;
case 2:
/*
* Both SSID & BSSID are set -
* Use CLI's SSID & BSSID.
*/
if(!CuCmd_Str2MACAddr( (PS8)parm[1].value, bssid) )
return;
ssid.SsidLength = os_strlen((PS8) parm[0].value);
os_memcpy((PVOID)ssid.Ssid, (PVOID) parm[0].value, ssid.SsidLength);
ssid.Ssid[ssid.SsidLength] = '\0';
break;
}
if(pCuCmd->hWpaCore == NULL)
{
if(OK != CuCommon_GetU32(pCuCmd->hCuCommon, CTRL_DATA_CURRENT_BSS_TYPE_PARAM, &BssType)) return;
if((BssType == os802_11IBSS/* Ad-Hoc */) && (ssid.SsidLength == 0))
{
os_error_printf(CU_MSG_INFO2, (PS8)"SSID string is needed due to fact that BSS Type set to Ad-Hoc.\n");
return;
}
if(OK != CuOs_Set_BSSID(pCuCmd->hCuWext, bssid ) ) return;
if(OK != CuOs_Set_ESSID(pCuCmd->hCuWext, &ssid) ) return;
}
else
{
#ifndef NO_WPA_SUPPL
if(OK != WpaCore_GetBssType(pCuCmd->hWpaCore, &BssType)) return;
if((BssType == os802_11IBSS/* Ad-Hoc */) && (ssid.SsidLength == 0))
{
os_error_printf(CU_MSG_INFO2, (PS8)"SSID string is needed due to fact BSS Type set to Ad-Hoc\n");
return;
}
WpaCore_SetSsid(pCuCmd->hWpaCore, &ssid, bssid);
#endif
}
}
VOID CuCmd_Disassociate(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
if(pCuCmd->hWpaCore == NULL)
{
OS_802_11_SSID ssid;
ssid.SsidLength = MAX_SSID_LEN;
os_memset(ssid.Ssid, 0, MAX_SSID_LEN);
CuOs_Set_ESSID(pCuCmd->hCuWext, &ssid);
}
else
{
#ifndef NO_WPA_SUPPL
WpaCore_Disassociate(pCuCmd->hWpaCore);
#endif
}
}
VOID CuCmd_ModifySsid(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
OS_802_11_SSID ssid;
TMacAddr bssid = { 0xff,0xff,0xff,0xff,0xff,0xff };
if( nParms == 0 )
{
OS_802_11_SSID ssid;
if(OK != CuOs_Get_SSID(pCuCmd->hCuWext, &ssid)) return;
os_error_printf(CU_MSG_INFO2, (PS8)"SSID: %s\n",(ssid.SsidLength)?(PS8)PrintSSID(&ssid):(PS8)"<empty>");
}
else
{
/* Setting the new SSID, BRCS BSSID is set to clean pre-set BSSID */
ssid.SsidLength = os_strlen((PS8) parm[0].value);
os_memcpy((PVOID)ssid.Ssid, (PVOID) parm[0].value, ssid.SsidLength);
if(ssid.SsidLength < MAX_SSID_LEN)
{
ssid.Ssid[ssid.SsidLength] = 0;
}
if(OK != CuOs_Set_BSSID(pCuCmd->hCuWext, bssid ) ) return;
if(OK != CuOs_Set_ESSID(pCuCmd->hCuWext, &ssid) ) return;
}
}
VOID CuCmd_ModifyConnectMode(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
U32 i;
if( nParms == 0 )
{
U32 uConnectMode;
if(OK != CuCommon_GetU32 (pCuCmd->hCuCommon, SME_CONNECTION_MODE_PARAM, &uConnectMode)) return;
CU_CMD_FIND_NAME_ARRAY (i, Current_mode, uConnectMode);
os_error_printf (CU_MSG_INFO2, (PS8)"Current mode = %s\n", Current_mode[i].name);
print_available_values (Current_mode);
}
else
{
U32 uConnectMode = parm[0].value;
/* check if the param is valid */
CU_CMD_FIND_NAME_ARRAY (i, Current_mode, uConnectMode);
if(i == SIZE_ARR(Current_mode))
{
os_error_printf(CU_MSG_INFO2, (PS8)"CuCmd_ModifyConnectMode, Connect Mode %d is not defined!\n", uConnectMode);
print_available_values (Current_mode);
return;
}
else
{
CuCommon_SetU32(pCuCmd->hCuCommon, SME_CONNECTION_MODE_PARAM, uConnectMode);
}
}
}
VOID CuCmd_ModifyChannel(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
if( nParms == 0 )
{
U8 desiredChannel = 0;
U32 currentChannel = 0;
if(OK != CuCommon_GetU8(pCuCmd->hCuCommon, SITE_MGR_DESIRED_CHANNEL_PARAM, &desiredChannel)) return;
if(OK != CuOs_GetCurrentChannel(pCuCmd->hCuWext, &currentChannel)) return;
os_error_printf(CU_MSG_INFO2, (PS8)"Channel=%d (desired: %d)\n",currentChannel,desiredChannel);
}
else
{
CuCommon_SetU32(pCuCmd->hCuCommon, SITE_MGR_DESIRED_CHANNEL_PARAM, parm[0].value);
}
}
VOID CuCmd_GetTxRate(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
if( nParms == 0)
{
U8 CurrentTxRate;
S8 CurrentTxRateStr[50];
if(OK != CuCommon_GetU8(pCuCmd->hCuCommon, TIWLN_802_11_CURRENT_RATES_GET, &CurrentTxRate)) return;
CuCmd_CreateRateStr(CurrentTxRateStr, CurrentTxRate);
os_error_printf(CU_MSG_INFO2, (PS8)"Rate: %s\n", CurrentTxRateStr);
}
}
VOID CuCmd_ModifyBssType(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
U8 BssType;
S32 i;
if( nParms == 0 )
{
if(pCuCmd->hWpaCore == NULL)
{
if(OK != CuCommon_GetU8(pCuCmd->hCuCommon, CTRL_DATA_CURRENT_BSS_TYPE_PARAM, &BssType)) return;
}
else
{
#ifndef NO_WPA_SUPPL
if(OK != WpaCore_GetBssType(pCuCmd->hWpaCore, (U32*)&BssType)) return;
#endif
}
CU_CMD_FIND_NAME_ARRAY(i, BSS_type, BssType);
if(i == SIZE_ARR(BSS_type))
{
os_error_printf(CU_MSG_INFO2, (PS8)"Error getting the current BssType! BssType=0x%x\n",BssType);
return;
}
else
{
os_error_printf(CU_MSG_INFO2, (PS8)"Current mode = %s\n", BSS_type[i].name);
}
print_available_values(BSS_type);
}
else
{
BssType = parm[0].value;
/* check if the param is valid */
CU_CMD_FIND_NAME_ARRAY(i, BSS_type, BssType);
if(i == SIZE_ARR(BSS_type))
{
os_error_printf(CU_MSG_INFO2, (PS8)"CuCmd_ModifyBssType, BssType %d is not defined!\n", BssType);
return;
}
if(pCuCmd->hWpaCore == NULL)
{
CuCommon_SetU8(pCuCmd->hCuCommon, CTRL_DATA_CURRENT_BSS_TYPE_PARAM, BssType);
}
else
{
#ifndef NO_WPA_SUPPL
WpaCore_SetBssType(pCuCmd->hWpaCore, BssType);
#endif
}
}
}
VOID CuCmd_ModifyFragTh(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
S32 FragTh;
if( nParms == 0 )
{
if(OK != CuOs_GetFragTh(pCuCmd->hCuWext, &FragTh)) return;
os_error_printf(CU_MSG_INFO2, (PS8)"Frag. threshold = %d\n", FragTh);
}
else
{
FragTh = parm[0].value;
CuOs_SetFragTh(pCuCmd->hCuWext, FragTh);
}
}
VOID CuCmd_ModifyRtsTh(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
S32 RtsTh;
if( nParms == 0 )
{
if(OK != CuOs_GetRtsTh(pCuCmd->hCuWext, &RtsTh)) return;
os_error_printf(CU_MSG_INFO2, (PS8)"RTS threshold = %d\n", RtsTh);
}
else
{
RtsTh = parm[0].value;
CuOs_SetRtsTh(pCuCmd->hCuWext, RtsTh);
}
}
VOID CuCmd_ModifyPreamble(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
EPreamble Preamble;
S32 i;
named_value_t preamble_type[] = {
{ PREAMBLE_LONG, (PS8)"PREAMBLE_LONG" },
{ PREAMBLE_SHORT, (PS8)"PREAMBLE_SHORT" }
};
if(nParms)
{
Preamble = parm[0].value;
/* check if the param is valid */
CU_CMD_FIND_NAME_ARRAY(i, preamble_type, Preamble);
if(i == SIZE_ARR(preamble_type))
{
os_error_printf(CU_MSG_INFO2, (PS8)"CuCmd_ModifyPreamble, Preamble %d is not defined!\n", Preamble);
return;
}
CuCommon_SetU32(pCuCmd->hCuCommon, TIWLN_802_11_SHORT_PREAMBLE_SET, Preamble);
}
else
{
S32 PreambleData;
if(OK != CuCommon_GetU32(pCuCmd->hCuCommon, TIWLN_802_11_SHORT_PREAMBLE_GET, (PU32)&PreambleData)) return;
Preamble = PreambleData;
os_error_printf(CU_MSG_INFO2, (PS8)"Preamble = %d\n", Preamble);
print_available_values(preamble_type);
}
}
VOID CuCmd_ModifyShortSlot(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
slotTime_e SlotTime;
S32 i;
named_value_t SlotTime_type[] = {
{ PHY_SLOT_TIME_LONG, (PS8)"PHY_SLOT_TIME_LONG" },
{ PHY_SLOT_TIME_SHORT, (PS8)"PHY_SLOT_TIME_SHORT" }
};
if(nParms)
{
SlotTime = parm[0].value;
/* check if the param is valid */
CU_CMD_FIND_NAME_ARRAY(i, SlotTime_type, SlotTime);
if(i == SIZE_ARR(SlotTime_type))
{
os_error_printf(CU_MSG_INFO2, (PS8)"CuCmd_ModifyShortSlot, SlotTime %d is not defined!\n", SlotTime);
return;
}
CuCommon_SetU32(pCuCmd->hCuCommon, TIWLN_SHORT_SLOT_SET, SlotTime);
}
else
{
S32 SlotTimeData;
if(OK != CuCommon_GetU32(pCuCmd->hCuCommon, TIWLN_SHORT_SLOT_GET, (PU32)&SlotTimeData)) return;
SlotTime = SlotTimeData;
os_error_printf(CU_MSG_INFO2, (PS8)"SlotTime = %d\n", SlotTime);
print_available_values(SlotTime_type);
}
}
VOID CuCmd_RadioOnOff(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
U32 on_off;
if(nParms)
{
on_off = parm[0].value;
CuCommon_SetU32(pCuCmd->hCuCommon, SME_RADIO_ON_PARAM, on_off);
}
else
{
if(OK != CuCommon_GetU32(pCuCmd->hCuCommon, SME_RADIO_ON_PARAM, &on_off)) {
os_error_printf(CU_MSG_ERROR, (PS8)"CuCmd_RadioOnOff error, Cannot get radio state!\n");
return;
}
os_error_printf(CU_MSG_ERROR, (PS8)"Radio state = %s\n", on_off ? "ON" : "OFF");
os_error_printf(CU_MSG_ERROR, (PS8)"Turn radio on/off. 0=OFF, 1=ON\n");
}
}
VOID CuCmd_GetSelectedBssidInfo(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
OS_802_11_SSID ssid;
TMacAddr bssid;
if(OK != CuOs_Get_SSID(pCuCmd->hCuWext, &ssid)) return;
if(OK != CuOs_Get_BSSID(pCuCmd->hCuWext, bssid)) return;
os_error_printf(CU_MSG_INFO2, (PS8)"Selected BSSID Info:\n");
os_error_printf(CU_MSG_INFO2, (PS8)"--------------------\n");
os_error_printf(CU_MSG_INFO2, (PS8)"SSID : %s\n",(ssid.SsidLength)?(PS8)PrintSSID(&ssid):(PS8)"<empty>");
os_error_printf(CU_MSG_INFO2, (PS8)"BSSID : %02x.%02x.%02x.%02x.%02x.%02x\n",bssid[0],bssid[1],bssid[2],bssid[3],bssid[4],bssid[5]);
}
VOID CuCmd_GetRsiiLevel(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
S8 dRssi, bRssi;
if(OK != CuCommon_GetRssi(pCuCmd->hCuCommon, &dRssi, &bRssi)) return;
/* need the 0xffffff00 to get negative value display */
os_error_printf(CU_MSG_INFO2, (PS8)"Current dataRSSI=%d beaconRssi=%d\n", dRssi?dRssi|0xffffff00:dRssi, bRssi?bRssi|0xffffff00:bRssi);
}
VOID CuCmd_GetSnrRatio(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
U32 dSnr, bSnr;
if(OK != CuCommon_GetSnr(pCuCmd->hCuCommon, &dSnr, &bSnr)) return;
os_error_printf(CU_MSG_INFO2, (PS8)"Current dataSNR=%d beaconSnr=%d\n", dSnr, bSnr);
}
VOID CuCmd_ShowTxPowerLevel(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
S32 txPowerLevel;
if(OK != CuOs_GetTxPowerLevel(pCuCmd->hCuWext, &txPowerLevel)) return;
os_error_printf(CU_MSG_INFO2, (PS8)"Tx Power level = %d\n", txPowerLevel);
}
VOID CuCmd_ShowTxPowerTable(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
TpowerLevelTable_t txPowerLevel;
S32 i, res;
res = CuCommon_GetBuffer(pCuCmd->hCuCommon, REGULATORY_DOMAIN_TX_POWER_LEVEL_TABLE_PARAM, &txPowerLevel, sizeof(txPowerLevel));
if( !res )
{
os_error_printf(CU_MSG_INFO2, (PS8)"Power level table (Dbm/10)\n");
for (i = 0; i < NUMBER_OF_SUB_BANDS_E; i++)
{
os_error_printf(CU_MSG_INFO2, (PS8)"sub-band %i: %d %d %d %d\n", i,
txPowerLevel.uDbm[i][0],
txPowerLevel.uDbm[i][1],
txPowerLevel.uDbm[i][2],
txPowerLevel.uDbm[i][3]);
}
}
else
{
os_error_printf(CU_MSG_INFO2, (PS8)"Tx Power level table ERROR !!!\n");
}
}
VOID CuCmd_TxPowerDbm(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
U8 txPowerLevelDbm = (U8)parm[0].value;
if(nParms == 0)
{
if(OK != CuCommon_GetU8(pCuCmd->hCuCommon, TIWLN_802_11_TX_POWER_DBM_GET, (PU8)&txPowerLevelDbm)) return;
}
else
{
if (parm[0].value > MAX_TX_POWER)
{
os_error_printf(CU_MSG_INFO2, (PS8)"Please use values between %d and %d\n", MIN_TX_POWER, MAX_TX_POWER); return;
}
else
{
if(OK != CuCommon_SetU8(pCuCmd->hCuCommon, TIWLN_802_11_TX_POWER_DBM_GET, (U8)txPowerLevelDbm)) return;
}
}
os_error_printf(CU_MSG_INFO2, (PS8)"Tx Power in DBM = %d\n", txPowerLevelDbm);
}
VOID CuCmd_ModifyState_802_11d(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
U32 Enabled_802_11d;
if(nParms == 0)
{
if(OK != CuCommon_GetU32(pCuCmd->hCuCommon, TIWLN_REG_DOMAIN_GET_802_11D, &Enabled_802_11d)) return;
os_error_printf(CU_MSG_INFO2, (PS8)"802_11d enabled = %s\n", (Enabled_802_11d)?"TRUE":"FALSE");
}
else
{
Enabled_802_11d = parm[0].value;
if(OK != CuCommon_SetU32(pCuCmd->hCuCommon, TIWLN_REG_DOMAIN_ENABLE_DISABLE_802_11D, Enabled_802_11d))
{
U32 Enabled_802_11h;
if(OK != CuCommon_GetU32(pCuCmd->hCuCommon, TIWLN_REG_DOMAIN_GET_802_11H, &Enabled_802_11h)) return;
if(Enabled_802_11h && (!Enabled_802_11d))
os_error_printf(CU_MSG_INFO2, (PS8)"802_11d cannot be disabled while 802_11h is enabled!!\n" );
}
else
{
os_error_printf(CU_MSG_INFO2, (PS8)"802_11d status is updated to = %s\n", (Enabled_802_11d)?"TRUE":"FALSE" );
}
}
}
VOID CuCmd_ModifyState_802_11h(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
U32 Enabled_802_11h;
if(nParms == 0)
{
if(OK != CuCommon_GetU32(pCuCmd->hCuCommon, TIWLN_REG_DOMAIN_GET_802_11H, &Enabled_802_11h)) return;
os_error_printf(CU_MSG_INFO2, (PS8)"802_11h enabled = %s\n", (Enabled_802_11h)?"TRUE":"FALSE");
}
else
{
Enabled_802_11h = parm[0].value;
if(OK != CuCommon_SetU32(pCuCmd->hCuCommon, TIWLN_REG_DOMAIN_ENABLE_DISABLE_802_11H, Enabled_802_11h)) return;
if(Enabled_802_11h)
os_error_printf(CU_MSG_INFO2, (PS8)"802_11h enables automatically 802_11d!!\n" );
os_error_printf(CU_MSG_INFO2, (PS8)"802_11h status is updated to =%d\n", Enabled_802_11h );
}
}
VOID CuCmd_D_Country_2_4Ie(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
if( nParms == 0 )
{
U8 CountryString[DOT11_COUNTRY_STRING_LEN+1];
if(OK != CuCommon_GetSetBuffer(pCuCmd->hCuCommon, TIWLN_REG_DOMAIN_GET_COUNTRY_2_4,
CountryString, DOT11_COUNTRY_STRING_LEN+1)) return;
CountryString[DOT11_COUNTRY_STRING_LEN] = '\0';
if (CountryString[0] == '\0')
{
os_error_printf(CU_MSG_INFO2, (PS8)"802_11d Country for 2.4 GHz is not found\n");
}
else
{
os_error_printf(CU_MSG_INFO2, (PS8)"802_11d Country for 2.4 GHz is %s \n", CountryString );
}
}
else
{
country_t CountryWorld;
CountryWorld.elementId = COUNTRY_IE_ID;
CountryWorld.len = 6;
os_memcpy( (PVOID)CountryWorld.countryIE.CountryString,(PVOID)"GB ", 3);
CountryWorld.countryIE.tripletChannels[0].firstChannelNumber = 1;
CountryWorld.countryIE.tripletChannels[0].maxTxPowerLevel = 23;
CountryWorld.countryIE.tripletChannels[0].numberOfChannels = 11;
if(OK != CuCommon_SetBuffer(pCuCmd->hCuCommon, TIWLN_REG_DOMAIN_SET_COUNTRY_2_4,
&CountryWorld, sizeof(country_t))) return;
os_error_printf(CU_MSG_INFO2, (PS8)"802_11d Start Setting GB Country for 2.4 GHz\n");
}
}
VOID CuCmd_D_Country_5Ie(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
if( nParms == 0 )
{
U8 CountryString[DOT11_COUNTRY_STRING_LEN+1];
if(OK != CuCommon_GetSetBuffer(pCuCmd->hCuCommon, TIWLN_REG_DOMAIN_GET_COUNTRY_5,
CountryString, DOT11_COUNTRY_STRING_LEN+1)) return;
CountryString[DOT11_COUNTRY_STRING_LEN] = '\0';
if (CountryString[0] == '\0')
{
os_error_printf(CU_MSG_INFO2, (PS8)"802_11d Country for 5 GHz is not found\n");
}
else
{
os_error_printf(CU_MSG_INFO2, (PS8)"802_11d Country for 5 GHz is %s\n", CountryString );
}
}
else
{
country_t CountryWorld;
CountryWorld.elementId = COUNTRY_IE_ID;
CountryWorld.len = 6;
os_memcpy((PVOID) CountryWorld.countryIE.CountryString,(PVOID)"US ", 3);
CountryWorld.countryIE.tripletChannels[0].firstChannelNumber = 36;
CountryWorld.countryIE.tripletChannels[0].maxTxPowerLevel = 13;
CountryWorld.countryIE.tripletChannels[0].numberOfChannels = 8;
if(OK != CuCommon_SetBuffer(pCuCmd->hCuCommon, TIWLN_REG_DOMAIN_SET_COUNTRY_5,
&CountryWorld, sizeof(country_t))) return;
os_error_printf(CU_MSG_INFO2, (PS8)"802_11d Start Setting US Country for 5 GHz\n");
}
}
VOID CuCmd_ModifyDfsRange(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
U16 minDFS_channelNum;
U16 maxDFS_channelNum;
if( nParms == 0 )
{
if(OK != CuCommon_GetDfsChannels(pCuCmd->hCuCommon, &minDFS_channelNum, &maxDFS_channelNum)) return;
os_error_printf(CU_MSG_INFO2, (PS8)"DFS min channel is %d, DFS max channel is %d\n",
minDFS_channelNum, maxDFS_channelNum);
}
else
{
minDFS_channelNum = (U16) parm[0].value;
maxDFS_channelNum = (U16) parm[1].value;
if(OK != CuCommon_SetDfsChannels(pCuCmd->hCuCommon, minDFS_channelNum, maxDFS_channelNum)) return;
os_error_printf(CU_MSG_INFO2, (PS8)"Setting DFS min channel %d, DFS max channel %d\n",
minDFS_channelNum, maxDFS_channelNum);
}
}
VOID CuCmd_SetBeaconFilterDesiredState(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
if( nParms == 0 )
{
print_available_values(BeaconFilter_use);
}
else
{
CuCommon_SetU8(pCuCmd->hCuCommon, TIWLN_802_11_BEACON_FILTER_DESIRED_STATE_SET, (U8)parm[0].value);
}
}
VOID CuCmd_GetBeaconFilterDesiredState(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
U8 beaconFilterDesiredState = 0;
if(OK != CuCommon_GetU8(pCuCmd->hCuCommon, TIWLN_802_11_BEACON_FILTER_DESIRED_STATE_GET, &beaconFilterDesiredState)) return;
os_error_printf(CU_MSG_INFO2, (PS8)"Desired State is %s\n", (beaconFilterDesiredState == 0)?"FILTER INACTIVE":"FILTER ACTIVE" );
}
VOID CuCmd_ModifySupportedRates(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
rates_t SupportedRates;
S32 i;
if( nParms == 0 )
{
if(OK != CuCommon_GetBuffer(pCuCmd->hCuCommon, TIWLN_802_11_SUPPORTED_RATES,
&SupportedRates, sizeof(rates_t))) return;
os_error_printf(CU_MSG_INFO2, (PS8)" Rates: ");
for( i=0; i < SupportedRates.len; i++ )
{
os_error_printf(CU_MSG_INFO2,
(PS8)"%g Mbps(%u%s)%s",
/* patch in order to support NET_RATE_MCS7 values that equal to NET_RATE_1M_BASIC */
(RATE_2_MBPS(SupportedRates.ratesString[i]) == 63.5) ? 65 : RATE_2_MBPS(SupportedRates.ratesString[i]),
/* patch in order to support NET_RATE_MCS7 values that equal to NET_RATE_1M_BASIC */
(SupportedRates.ratesString[i] == 0x7f) ? 0x83 : SupportedRates.ratesString[i],
IS_BASIC_RATE(SupportedRates.ratesString[i]) ? " - basic" : "",
(i < SupportedRates.len-1) ? "," : "" );
}
os_error_printf(CU_MSG_INFO2, (PS8)"\n");
}
else
{
PS8 buf = (PS8) parm[0].value;
PS8 end_p;
U32 val;
U32 MaxVal = ((1 << (sizeof(SupportedRates.ratesString[i]) * 8))-1);
os_error_printf(CU_MSG_INFO2, (PS8)"param: %s\n", buf );
for( i=0; *buf && i < DOT11_MAX_SUPPORTED_RATES; i++ )
{
val = os_strtoul(buf, &end_p, 0);
if(val == 0)
{
os_error_printf(CU_MSG_INFO2, (PS8)"CuCmd_ModifySupportedRates: invalid value - %s\n", buf );
return;
}
if(val > MaxVal)
{
os_error_printf(CU_MSG_INFO2, (PS8)"CuCmd_ModifySupportedRates: out of range %d\n", val );
return;
}
/* patch in order to support NET_RATE_MCS7 values that equal to NET_RATE_1M_BASIC */
if (val == 0x83)
{
val = 0x7f;
}
SupportedRates.ratesString[i] = (U8)(val);
buf = end_p;
while( *buf==' ' || *buf == ',' ) buf++;
}
if(*buf)
{
os_error_printf(CU_MSG_INFO2, (PS8)"too many parameters. Max=%d\n", DOT11_MAX_SUPPORTED_RATES );
return;
}
SupportedRates.len = (U8) i;
CuCommon_SetBuffer(pCuCmd->hCuCommon, TIWLN_802_11_SUPPORTED_RATES,
&SupportedRates, sizeof(rates_t));
}
}
VOID CuCmd_SendHealthCheck(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
if (OK != CuCommon_SetU32(pCuCmd->hCuCommon, HEALTH_MONITOR_CHECK_DEVICE, TRUE)) return;
os_error_printf(CU_MSG_INFO2, (PS8)"Send health check...\n");
}
VOID CuCmd_EnableRxDataFilters(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
if (OK != CuCommon_SetU32(pCuCmd->hCuCommon, TIWLN_ENABLE_DISABLE_RX_DATA_FILTERS, TRUE)) return;
os_error_printf(CU_MSG_INFO2, (PS8)"Enabling Rx data filtering...\n");
}
VOID CuCmd_DisableRxDataFilters(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
if (OK != CuCommon_SetU32(pCuCmd->hCuCommon, TIWLN_ENABLE_DISABLE_RX_DATA_FILTERS, FALSE)) return;
os_error_printf(CU_MSG_INFO2, (PS8)"Disabling Rx data filtering...\n");
}
VOID CuCmd_AddRxDataFilter(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
S32 res;
TRxDataFilterRequest request;
PS8 mask = (PS8) parm[1].value;
PS8 pattern = (PS8) parm[2].value;
request.offset = (U8)parm[0].value;
CuCmd_ParseMaskString(mask, request.mask, &request.maskLength);
CuCmd_ParsePatternString(pattern, request.pattern, &request.patternLength);
res = CuCommon_SetBuffer(pCuCmd->hCuCommon, TIWLN_ADD_RX_DATA_FILTER,
&request, sizeof(TRxDataFilterRequest));
if(res == OK)
os_error_printf(CU_MSG_INFO2, (PS8)"Filter added.\n");
else
os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - CuCmd_AddRxDataFilter - Couldn't add Rx data filter...\n");
}
VOID CuCmd_RemoveRxDataFilter(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
S32 res;
TRxDataFilterRequest request;
PS8 mask = (PS8) parm[1].value;
PS8 pattern = (PS8) parm[2].value;
request.offset = (U8)parm[0].value;
CuCmd_ParseMaskString(mask, request.mask, &request.maskLength);
CuCmd_ParsePatternString(pattern, request.pattern, &request.patternLength);
res = CuCommon_SetBuffer(pCuCmd->hCuCommon, TIWLN_REMOVE_RX_DATA_FILTER,
&request, sizeof(TRxDataFilterRequest));
if(res == OK)
os_error_printf(CU_MSG_INFO2, (PS8)"Filter Removed.\n");
else
os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - CuCmd_AddRxDataFilter - Couldn't remove Rx data filter...\n");
}
VOID CuCmd_GetRxDataFiltersStatistics(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
U32 UnmatchedPacketsCount;
U32 MatchedPacketsCount[4];
if (OK != CuCommon_GetRxDataFiltersStatistics(pCuCmd->hCuCommon, &UnmatchedPacketsCount, MatchedPacketsCount)) return;
os_error_printf(CU_MSG_INFO2, (PS8)"Rx data filtering statistics:\n");
os_error_printf(CU_MSG_INFO2, (PS8)"Unmatched packets: %u\n", UnmatchedPacketsCount);
os_error_printf(CU_MSG_INFO2, (PS8)"Packets matching filter #1: %u\n", MatchedPacketsCount[0]);
os_error_printf(CU_MSG_INFO2, (PS8)"Packets matching filter #2: %u\n", MatchedPacketsCount[1]);
os_error_printf(CU_MSG_INFO2, (PS8)"Packets matching filter #3: %u\n", MatchedPacketsCount[2]);
os_error_printf(CU_MSG_INFO2, (PS8)"Packets matching filter #4: %u\n", MatchedPacketsCount[3]);
}
VOID CuCmd_ShowStatistics(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
U32 powerMode;
TMacAddr Mac;
OS_802_11_SSID ssid;
U8 desiredChannel;
S32 rtsTh;
S32 fragTh;
S32 txPowerLevel;
U8 bssType;
U32 desiredPreambleType;
TIWLN_COUNTERS driverCounters;
U32 AuthMode;
U8 CurrentTxRate;
S8 CurrentTxRateStr[20];
U8 CurrentRxRate;
S8 CurrentRxRateStr[20];
U32 DefaultKeyId;
U32 WepStatus;
S8 dRssi, bRssi;
#ifdef XCC_MODULE_INCLUDED
U32 XCCNetEap;
#endif
if(OK != CuCommon_GetBuffer(pCuCmd->hCuCommon, CTRL_DATA_MAC_ADDRESS,
Mac, sizeof(TMacAddr))) return;
if(OK != CuCommon_GetBuffer(pCuCmd->hCuCommon, TIWLN_802_11_POWER_MODE_GET, &powerMode, sizeof(U32))) return;
if(OK != CuOs_Get_SSID(pCuCmd->hCuWext, &ssid)) return;
if(OK != CuCommon_GetU8(pCuCmd->hCuCommon, SITE_MGR_DESIRED_CHANNEL_PARAM, &desiredChannel)) return;
if(OK != CuOs_GetRtsTh(pCuCmd->hCuWext, &rtsTh)) return;
if(OK != CuOs_GetFragTh(pCuCmd->hCuWext, &fragTh)) return;
if(OK != CuOs_GetTxPowerLevel(pCuCmd->hCuWext, &txPowerLevel)) return;
if(OK != CuCommon_GetU8(pCuCmd->hCuCommon, CTRL_DATA_CURRENT_BSS_TYPE_PARAM, &bssType)) return;
if(OK != CuCommon_GetU32(pCuCmd->hCuCommon, TIWLN_802_11_SHORT_PREAMBLE_GET, &desiredPreambleType)) return;
if(OK != CuCommon_GetBuffer(pCuCmd->hCuCommon, SITE_MGR_TI_WLAN_COUNTERS_PARAM, &driverCounters, sizeof(TIWLN_COUNTERS))) return;
if(OK != CuCommon_GetU32(pCuCmd->hCuCommon, RSN_ENCRYPTION_STATUS_PARAM, &WepStatus)) return;
if(OK != CuCommon_GetRssi(pCuCmd->hCuCommon, &dRssi, &bRssi)) return;
if (pCuCmd->hWpaCore == NULL)
{
if(OK != CuCommon_GetU32(pCuCmd->hCuCommon, RSN_EXT_AUTHENTICATION_MODE, &AuthMode)) return;
if(OK != CuCommon_GetU32(pCuCmd->hCuCommon, RSN_DEFAULT_KEY_ID, &DefaultKeyId)) return;
}
else
{
#ifndef NO_WPA_SUPPL
if(OK != WpaCore_GetAuthMode(pCuCmd->hWpaCore, &AuthMode)) return;
if(OK != WpaCore_GetDefaultKey(pCuCmd->hWpaCore, &DefaultKeyId)) return;
#endif
}
if(OK != CuCommon_GetU8(pCuCmd->hCuCommon, TIWLN_802_11_CURRENT_RATES_GET, &CurrentTxRate)) return;
CuCmd_CreateRateStr(CurrentTxRateStr, CurrentTxRate);
if(OK != CuCommon_GetU8(pCuCmd->hCuCommon, TIWLN_GET_RX_DATA_RATE, &CurrentRxRate)) return;
CuCmd_CreateRateStr(CurrentRxRateStr, CurrentRxRate);
#ifdef XCC_MODULE_INCLUDED
if(OK != CuCommon_GetU32(pCuCmd->hCuCommon, RSN_XCC_NETWORK_EAP, &XCCNetEap)) return;
#endif
os_error_printf(CU_MSG_INFO2, (PS8)"******************\n");
os_error_printf(CU_MSG_INFO2, (PS8)"Driver Statistics:\n");
os_error_printf(CU_MSG_INFO2, (PS8)"******************\n");
os_error_printf(CU_MSG_INFO2, (PS8)" dot11CurrentTxRate : %s\n", CurrentTxRateStr);
os_error_printf(CU_MSG_INFO2, (PS8)" CurrentRxRate : %s\n", CurrentRxRateStr);
os_error_printf(CU_MSG_INFO2, (PS8)" dot11DesiredChannel : %d\n", desiredChannel);
os_error_printf(CU_MSG_INFO2, (PS8)" currentMACAddress : %02x.%02x.%02x.%02x.%02x.%02x\n",Mac[0],Mac[1],Mac[2],Mac[3],Mac[4],Mac[5]);
os_error_printf(CU_MSG_INFO2, (PS8)" dot11DesiredSSID : %s\n", ssid.Ssid);
os_error_printf(CU_MSG_INFO2, (PS8)" dot11BSSType : %d\n", bssType);
os_error_printf(CU_MSG_INFO2, (PS8)" AuthenticationMode : %d\n", AuthMode );
os_error_printf(CU_MSG_INFO2, (PS8)" bShortPreambleUsed : %d\n", desiredPreambleType );
os_error_printf(CU_MSG_INFO2, (PS8)" RTSThreshold : %d\n", rtsTh );
os_error_printf(CU_MSG_INFO2, (PS8)"FragmentationThreshold : %d\n", fragTh );
os_error_printf(CU_MSG_INFO2, (PS8)" bDefaultWEPKeyDefined : %d\n", DefaultKeyId);
os_error_printf(CU_MSG_INFO2, (PS8)" WEPStatus : %d\n", WepStatus);
os_error_printf(CU_MSG_INFO2, (PS8)" TxPowerLevel : %d\n", txPowerLevel );
os_error_printf(CU_MSG_INFO2, (PS8)" PowerMode : %d\n", powerMode );
os_error_printf(CU_MSG_INFO2, (PS8)" dataRssi : %d\n", dRssi);
os_error_printf(CU_MSG_INFO2, (PS8)" beaconRssi : %d\n", bRssi);
/**/
/* network layer statistics*/
/**/
os_error_printf(CU_MSG_INFO2, (PS8)" RecvOk : %d\n", driverCounters.RecvOk );
os_error_printf(CU_MSG_INFO2, (PS8)" RecvError : %d\n", driverCounters.RecvError );
os_error_printf(CU_MSG_INFO2, (PS8)" DirectedBytesRecv : %d\n", driverCounters.DirectedBytesRecv );
os_error_printf(CU_MSG_INFO2, (PS8)" DirectedFramesRecv : %d\n", driverCounters.DirectedFramesRecv );
os_error_printf(CU_MSG_INFO2, (PS8)" MulticastBytesRecv : %d\n", driverCounters.MulticastBytesRecv );
os_error_printf(CU_MSG_INFO2, (PS8)" MulticastFramesRecv : %d\n", driverCounters.MulticastFramesRecv );
os_error_printf(CU_MSG_INFO2, (PS8)" BroadcastBytesRecv : %d\n", driverCounters.BroadcastBytesRecv );
os_error_printf(CU_MSG_INFO2, (PS8)" BroadcastFramesRecv : %d\n", driverCounters.BroadcastFramesRecv );
os_error_printf(CU_MSG_INFO2, (PS8)" FcsErrors : %d\n", driverCounters.FcsErrors );
os_error_printf(CU_MSG_INFO2, (PS8)" BeaconsRecv : %d\n", driverCounters.BeaconsRecv );
os_error_printf(CU_MSG_INFO2, (PS8)" AssocRejects : %d\n", driverCounters.AssocRejects );
os_error_printf(CU_MSG_INFO2, (PS8)" AssocTimeouts : %d\n", driverCounters.AssocTimeouts );
os_error_printf(CU_MSG_INFO2, (PS8)" AuthRejects : %d\n", driverCounters.AuthRejects );
os_error_printf(CU_MSG_INFO2, (PS8)" AuthTimeouts : %d\n", driverCounters.AuthTimeouts );
/**/
/* other statistics*/
/**/
#ifdef XCC_MODULE_INCLUDED
os_error_printf(CU_MSG_INFO2, (PS8)" dwSecuritySuit : %d\n", XCCNetEap);
#endif
}
VOID CuCmd_ShowTxStatistics(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
TIWLN_TX_STATISTICS txCounters;
U32 TxQid;
U32 AverageDelay;
U32 AverageFWDelay;
U32 AverageMacDelay;
if( nParms == 0 )
{
if(OK != CuCommon_GetTxStatistics(pCuCmd->hCuCommon, &txCounters, 0)) return;
}
else
{
if(OK != CuCommon_GetTxStatistics(pCuCmd->hCuCommon, &txCounters, parm[0].value)) return;
}
os_error_printf(CU_MSG_INFO2, (PS8)"*********************\n");
os_error_printf(CU_MSG_INFO2, (PS8)"Tx Queues Statistics:\n");
os_error_printf(CU_MSG_INFO2, (PS8)"*********************\n");
for (TxQid = 0; TxQid < MAX_NUM_OF_AC; TxQid++)
{
os_error_printf(CU_MSG_INFO2, (PS8)"\nTx Queue %d:\n", TxQid);
os_error_printf(CU_MSG_INFO2, (PS8)"===========\n");
os_error_printf(CU_MSG_INFO2, (PS8)" Total Good Frames : %d\n", txCounters.txCounters[TxQid].XmitOk );
os_error_printf(CU_MSG_INFO2, (PS8)" Unicast Bytes : %d\n", txCounters.txCounters[TxQid].DirectedBytesXmit );
os_error_printf(CU_MSG_INFO2, (PS8)" Unicast Frames : %d\n", txCounters.txCounters[TxQid].DirectedFramesXmit );
os_error_printf(CU_MSG_INFO2, (PS8)" Multicast Bytes : %d\n", txCounters.txCounters[TxQid].MulticastBytesXmit );
os_error_printf(CU_MSG_INFO2, (PS8)" Multicast Frames : %d\n", txCounters.txCounters[TxQid].MulticastFramesXmit );
os_error_printf(CU_MSG_INFO2, (PS8)" Broadcast Bytes : %d\n", txCounters.txCounters[TxQid].BroadcastBytesXmit );
os_error_printf(CU_MSG_INFO2, (PS8)" Broadcast Frames : %d\n", txCounters.txCounters[TxQid].BroadcastFramesXmit );
os_error_printf(CU_MSG_INFO2, (PS8)" Retry Failures : %d\n", txCounters.txCounters[TxQid].RetryFailCounter );
os_error_printf(CU_MSG_INFO2, (PS8)" Tx Timeout Failures : %d\n", txCounters.txCounters[TxQid].TxTimeoutCounter );
os_error_printf(CU_MSG_INFO2, (PS8)" No Link Failures : %d\n", txCounters.txCounters[TxQid].NoLinkCounter );
os_error_printf(CU_MSG_INFO2, (PS8)" Other Failures : %d\n", txCounters.txCounters[TxQid].OtherFailCounter );
os_error_printf(CU_MSG_INFO2, (PS8)" Max Consecutive Retry Failures : %d\n\n", txCounters.txCounters[TxQid].MaxConsecutiveRetryFail );
os_error_printf(CU_MSG_INFO2, (PS8)" Retry histogram:\n");
os_error_printf(CU_MSG_INFO2, (PS8)" ----------------\n\n");
os_error_printf(CU_MSG_INFO2, (PS8)" Retries: %8d %8d %8d %8d %8d %8d %8d %8d\n", 0, 1, 2, 3, 4, 5, 6, 7);
os_error_printf(CU_MSG_INFO2, (PS8)" packets: %8d %8d %8d %8d %8d %8d %8d %8d\n\n",
txCounters.txCounters[TxQid].RetryHistogram[ 0 ],
txCounters.txCounters[TxQid].RetryHistogram[ 1 ],
txCounters.txCounters[TxQid].RetryHistogram[ 2 ],
txCounters.txCounters[TxQid].RetryHistogram[ 3 ],
txCounters.txCounters[TxQid].RetryHistogram[ 4 ],
txCounters.txCounters[TxQid].RetryHistogram[ 5 ],
txCounters.txCounters[TxQid].RetryHistogram[ 6 ],
txCounters.txCounters[TxQid].RetryHistogram[ 7 ]);
os_error_printf(CU_MSG_INFO2, (PS8)" Retries: %8d %8d %8d %8d %8d %8d %8d %8d\n", 8, 9, 10, 11, 12, 13, 14, 15);
os_error_printf(CU_MSG_INFO2, (PS8)" packets: %8d %8d %8d %8d %8d %8d %8d %8d\n\n",
txCounters.txCounters[TxQid].RetryHistogram[ 8 ],
txCounters.txCounters[TxQid].RetryHistogram[ 9 ],
txCounters.txCounters[TxQid].RetryHistogram[ 10 ],
txCounters.txCounters[TxQid].RetryHistogram[ 11 ],
txCounters.txCounters[TxQid].RetryHistogram[ 12 ],
txCounters.txCounters[TxQid].RetryHistogram[ 13 ],
txCounters.txCounters[TxQid].RetryHistogram[ 14 ],
txCounters.txCounters[TxQid].RetryHistogram[ 15 ]);
if (txCounters.txCounters[TxQid].NumPackets)
{
AverageDelay = txCounters.txCounters[TxQid].SumTotalDelayMs / txCounters.txCounters[TxQid].NumPackets;
AverageFWDelay = txCounters.txCounters[TxQid].SumFWDelayUs / txCounters.txCounters[TxQid].NumPackets;
AverageMacDelay = txCounters.txCounters[TxQid].SumMacDelayUs / txCounters.txCounters[TxQid].NumPackets;
}
else
{
AverageDelay = 0;
AverageFWDelay = 0;
AverageMacDelay = 0;
}
os_error_printf(CU_MSG_INFO2, (PS8)" Total Delay ms (average/sum) : %d / %d\n", AverageDelay, txCounters.txCounters[TxQid].SumTotalDelayMs);
os_error_printf(CU_MSG_INFO2, (PS8)" FW Delay us (average/sum) : %d / %d\n", AverageFWDelay, txCounters.txCounters[TxQid].SumFWDelayUs);
os_error_printf(CU_MSG_INFO2, (PS8)" MAC Delay us (average/sum) : %d / %d\n\n", AverageMacDelay, txCounters.txCounters[TxQid].SumMacDelayUs);
os_error_printf(CU_MSG_INFO2, (PS8)" Delay Ranges [msec] : Num of packets\n");
os_error_printf(CU_MSG_INFO2, (PS8)" ------------------- : --------------\n");
os_error_printf(CU_MSG_INFO2, (PS8)" 0 - 1 : %d\n", txCounters.txCounters[TxQid].txDelayHistogram[TX_DELAY_RANGE_0_TO_1] );
os_error_printf(CU_MSG_INFO2, (PS8)" 1 - 10 : %d\n", txCounters.txCounters[TxQid].txDelayHistogram[TX_DELAY_RANGE_1_TO_10] );
os_error_printf(CU_MSG_INFO2, (PS8)" 10 - 20 : %d\n", txCounters.txCounters[TxQid].txDelayHistogram[TX_DELAY_RANGE_10_TO_20] );
os_error_printf(CU_MSG_INFO2, (PS8)" 20 - 40 : %d\n", txCounters.txCounters[TxQid].txDelayHistogram[TX_DELAY_RANGE_20_TO_40] );
os_error_printf(CU_MSG_INFO2, (PS8)" 40 - 60 : %d\n", txCounters.txCounters[TxQid].txDelayHistogram[TX_DELAY_RANGE_40_TO_60] );
os_error_printf(CU_MSG_INFO2, (PS8)" 60 - 80 : %d\n", txCounters.txCounters[TxQid].txDelayHistogram[TX_DELAY_RANGE_60_TO_80] );
os_error_printf(CU_MSG_INFO2, (PS8)" 80 - 100 : %d\n", txCounters.txCounters[TxQid].txDelayHistogram[TX_DELAY_RANGE_80_TO_100] );
os_error_printf(CU_MSG_INFO2, (PS8)" 100 - 200 : %d\n", txCounters.txCounters[TxQid].txDelayHistogram[TX_DELAY_RANGE_100_TO_200] );
os_error_printf(CU_MSG_INFO2, (PS8)" Above 200 : %d\n", txCounters.txCounters[TxQid].txDelayHistogram[TX_DELAY_RANGE_ABOVE_200] );
}
}
VOID CuCmd_ShowAdvancedParams(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
U32 AuthMode;
TPowerMgr_PowerMode Mode;
S32 txPowerLevel;
#ifndef NO_WPA_SUPPL
OS_802_11_ENCRYPTION_TYPES EncryptionTypePairwise;
OS_802_11_ENCRYPTION_TYPES EncryptionTypeGroup;
#endif
S32 Preamble;
S32 FragTh;
S32 RtsTh;
if (pCuCmd->hWpaCore == NULL)
{
if(OK != CuCommon_GetU32(pCuCmd->hCuCommon, RSN_EXT_AUTHENTICATION_MODE, &AuthMode)) return;
}
else
{
#ifndef NO_WPA_SUPPL
if(OK != WpaCore_GetAuthMode(pCuCmd->hWpaCore, &AuthMode)) return;
#endif
}
if(OK != CuCommon_GetBuffer(pCuCmd->hCuCommon, TIWLN_802_11_POWER_MODE_GET, &Mode, sizeof(TPowerMgr_PowerMode))) return;
if(OK != CuOs_GetTxPowerLevel(pCuCmd->hCuWext, &txPowerLevel)) return;
#ifndef NO_WPA_SUPPL
if(OK != WpaCore_GetEncryptionPairWise(pCuCmd->hWpaCore, &EncryptionTypePairwise)) return;
if(OK != WpaCore_GetEncryptionGroup(pCuCmd->hWpaCore, &EncryptionTypeGroup)) return;
#endif
if(OK != CuCommon_GetU32(pCuCmd->hCuCommon, TIWLN_802_11_SHORT_PREAMBLE_GET, (PU32)&Preamble)) return;
if(OK != CuOs_GetFragTh(pCuCmd->hCuWext, &FragTh)) return;
if(OK != CuOs_GetRtsTh(pCuCmd->hCuWext, &RtsTh)) return;
os_error_printf(CU_MSG_INFO2, (PS8)"********************\n");
os_error_printf(CU_MSG_INFO2, (PS8)"Advanced Statistics:\n");
os_error_printf(CU_MSG_INFO2, (PS8)"********************\n");
os_error_printf(CU_MSG_INFO2, (PS8)" Authentication : %u\n", AuthMode );
os_error_printf(CU_MSG_INFO2, (PS8)" Power mode : %d\n", Mode.PowerMode );
os_error_printf(CU_MSG_INFO2, (PS8)" Tx Power level : %d\n", txPowerLevel );
#ifndef NO_WPA_SUPPL
os_error_printf(CU_MSG_INFO2, (PS8)" Encryption Pairwise: %u\n", EncryptionTypePairwise );
os_error_printf(CU_MSG_INFO2, (PS8)" Encryption Group: %u\n", EncryptionTypeGroup );
#endif
os_error_printf(CU_MSG_INFO2, (PS8)" Preamble : <%s>\n", (Preamble) ? "short" : "long");
os_error_printf(CU_MSG_INFO2, (PS8)" Frag. threshold : %u\n", FragTh);
os_error_printf(CU_MSG_INFO2, (PS8)" RTS threshold : %u\n", RtsTh );
os_error_printf(CU_MSG_INFO2, (PS8)" Power mode: ");
print_available_values(power_mode_val);
os_error_printf(CU_MSG_INFO2, (PS8)" Encryption type: ");
print_available_values(encrypt_type);
}
VOID Cucmd_ShowPowerConsumptionStats(THandle hCuCmd,ConParm_t parm[],U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
ACXPowerConsumptionTimeStat_t tStatistics;
os_memset( &tStatistics, 0, sizeof(ACXPowerConsumptionTimeStat_t) );
if (OK != CuCommon_GetPowerConsumptionStat(pCuCmd->hCuCommon,&tStatistics))
{
os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - Failed to read power consumption statistic!\n");
return;
}
os_error_printf(CU_MSG_INFO2, (PS8)"\nPower Consumption Statistics:\n");
os_error_printf(CU_MSG_INFO2, (PS8)"-----------------------------\n");
os_error_printf(CU_MSG_INFO2, (PS8)"activeTimeCnt:0x%x%x\n", tStatistics.awakeTimeCnt_Hi,tStatistics.awakeTimeCnt_Low );
os_error_printf(CU_MSG_INFO2, (PS8)"elpTimeCnt: 0x%x%x\n", tStatistics.elpTimeCnt_Hi,tStatistics.elpTimeCnt_Low);
os_error_printf(CU_MSG_INFO2, (PS8)"powerDownTimeCnt: 0x%x%x\n", tStatistics.powerDownTimeCnt_Hi,tStatistics.powerDownTimeCnt_Low);
os_error_printf(CU_MSG_INFO2, (PS8)"ListenMode11BTimeCnt: 0x%x%x\n", tStatistics.ListenMode11BTimeCnt_Hi,tStatistics.ListenMode11BTimeCnt_Low);
os_error_printf(CU_MSG_INFO2, (PS8)"ListenModeOFDMTimeCnt: 0x%x%x\n", tStatistics.ListenModeOFDMTimeCnt_Hi,tStatistics.ListenModeOFDMTimeCnt_Low);
}
VOID CuCmd_ScanAppGlobalConfig(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
if ( 0 == os_strcmp( (PS8)"<empty>", (PS8)parm[0].value) )
{
pCuCmd->appScanParams.desiredSsid.len = 0;
pCuCmd->appScanParams.desiredSsid.str[ 0 ] = '\0';
}
else
{
pCuCmd->appScanParams.desiredSsid.len = (U8) os_strlen((PS8)parm[0].value);
os_memcpy( (PVOID)&(pCuCmd->appScanParams.desiredSsid.str), (PVOID)parm[0].value, pCuCmd->appScanParams.desiredSsid.len );
if(pCuCmd->appScanParams.desiredSsid.len < MAX_SSID_LEN)
{
pCuCmd->appScanParams.desiredSsid.str[pCuCmd->appScanParams.desiredSsid.len] = 0;
}
}
pCuCmd->appScanParams.scanType = parm[1].value;
pCuCmd->appScanParams.band = parm[2].value;
pCuCmd->appScanParams.probeReqNumber = (U8)parm[3].value;
pCuCmd->appScanParams.probeRequestRate = parm[4].value;
#ifdef TI_DBG
pCuCmd->appScanParams.Tid = (U8)parm[5].value;
pCuCmd->appScanParams.numOfChannels = (U8)parm[6].value;
#else
pCuCmd->appScanParams.Tid = 0;
pCuCmd->appScanParams.numOfChannels = (U8)parm[5].value;
#endif
}
VOID CuCmd_ScanAppChannelConfig(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
scan_normalChannelEntry_t* pChannelEntry =
&(pCuCmd->appScanParams.channelEntry[ parm[0].value ].normalChannelEntry);
if (parm[2].value < parm[3].value)
{
os_error_printf(CU_MSG_INFO2, (PS8)"Max Dwell Time must be larger than or equal to Min Dwell Time...\n");
return;
}
CuCmd_Str2MACAddr ((PS8)parm[1].value, pChannelEntry->bssId);
pChannelEntry->maxChannelDwellTime = parm[2].value;
pChannelEntry->minChannelDwellTime = parm[3].value;
pChannelEntry->earlyTerminationEvent = parm[4].value;
pChannelEntry->ETMaxNumOfAPframes = (U8)parm[5].value;
pChannelEntry->txPowerDbm = (U8)parm[6].value;
pChannelEntry->channel = (U8)parm[7].value;
}
VOID CuCmd_ScanAppClear(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
os_memset( &pCuCmd->appScanParams, 0, sizeof(scan_Params_t) );
os_error_printf(CU_MSG_INFO2, (PS8)"Application scan parameters cleared.\n");
}
VOID CuCmd_ScanAppDisplay(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
S32 i,j;
scan_normalChannelEntry_t* pNormalChannel;
CU_CMD_FIND_NAME_ARRAY(j, rate2Str, pCuCmd->appScanParams.probeRequestRate);
os_error_printf(CU_MSG_INFO2, (PS8)"Application Scan params:\n");
os_error_printf(CU_MSG_INFO2, (PS8)"SSID: %s, Type: %s\n",
pCuCmd->appScanParams.desiredSsid.str,
scanType2Str[ pCuCmd->appScanParams.scanType ].name);
os_error_printf(CU_MSG_INFO2, (PS8)"Band: %s, Number of probe req:%d, probe req. rate:%s\n",
band2Str[ pCuCmd->appScanParams.band ].name,
pCuCmd->appScanParams.probeReqNumber,
rate2Str[j].name);
#ifdef TI_DBG
os_error_printf(CU_MSG_INFO2, (PS8)"Tid :%d\n\n", pCuCmd->appScanParams.Tid);
#else
os_error_printf(CU_MSG_INFO2, (PS8)"\n");
#endif
os_error_printf(CU_MSG_INFO2, (PS8)"Channel BSS ID Max time Min time ET event ET frame num Power\n");
os_error_printf(CU_MSG_INFO2, (PS8)"-------------------------------------------------------------------------------\n");
for ( i = 0; i < pCuCmd->appScanParams.numOfChannels; i++ )
{
pNormalChannel = &(pCuCmd->appScanParams.channelEntry[ i ].normalChannelEntry);
CU_CMD_FIND_NAME_ARRAY(j, EtEvent2Str, pNormalChannel->earlyTerminationEvent);
os_error_printf(CU_MSG_INFO2, (PS8)"%2d %02x.%02x.%02x.%02x.%02x.%02x %7d %7d %s%3d %1d\n",
pNormalChannel->channel,
pNormalChannel->bssId[0],pNormalChannel->bssId[1],pNormalChannel->bssId[2],pNormalChannel->bssId[3],pNormalChannel->bssId[4],pNormalChannel->bssId[5],
pNormalChannel->maxChannelDwellTime,
pNormalChannel->minChannelDwellTime,
EtEvent2Str[j].name,
pNormalChannel->ETMaxNumOfAPframes,
pNormalChannel->txPowerDbm);
}
os_error_printf(CU_MSG_INFO2, (PS8)"\n");
}
VOID CuCmd_StartScan(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
if(OK != CuCommon_SetBuffer(pCuCmd->hCuCommon, TIWLN_802_11_START_APP_SCAN_SET,
&pCuCmd->appScanParams, sizeof(scan_Params_t)))
{
return;
}
os_error_printf(CU_MSG_INFO2, (PS8)"Application scan started\n");
/*
* In order to have ability to set the application scan we are using application scan priver command
* exsample for using supplicant scan command below:
* #ifndef NO_WPA_SUPPL
* CuOs_Start_Scan(pCuCmd->hCuWext, &ssid);
* #endif
*/
}
VOID CuCmd_WextStartScan(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
OS_802_11_SSID ssid;
switch (nParms)
{
case 0 :
/*
* No SSID & No BSSID are set -
* Use Any SSID & Any BSSID.
*/
ssid.SsidLength = 0;
ssid.Ssid[0] = 0;
break;
case 1:
/*
* SSID set
* Use CLI's SSID & Any BSSID.
*/
ssid.SsidLength = os_strlen( (PS8)parm[0].value);
os_memcpy((PVOID)ssid.Ssid, (PVOID) parm[0].value, ssid.SsidLength);
ssid.Ssid[ssid.SsidLength] = '\0';
break;
default:
os_error_printf(CU_MSG_INFO2, (PS8)"w <ssid Name As optional>\n");
return;
}
#ifndef NO_WPA_SUPPL
CuOs_Start_Scan(pCuCmd->hCuWext, &ssid);
#else
os_error_printf(CU_MSG_INFO2, (PS8)"WEXT not build, Scan Not Started\n");
#endif
}
VOID CuCmd_StopScan (THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
if(OK != CuCommon_SetBuffer(pCuCmd->hCuCommon, TIWLN_802_11_STOP_APP_SCAN_SET, NULL, 0))
{
return;
}
os_error_printf(CU_MSG_INFO2, (PS8)"Application scan stopped\n");
}
VOID CuCmd_ConfigPeriodicScanGlobal (THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
pCuCmd->tPeriodicAppScanParams.iRssiThreshold = (S8)parm[ 0 ].value;
pCuCmd->tPeriodicAppScanParams.iSnrThreshold = (S8)parm[ 1 ].value;
pCuCmd->tPeriodicAppScanParams.uFrameCountReportThreshold = parm[ 2 ].value;
pCuCmd->tPeriodicAppScanParams.bTerminateOnReport = parm[ 3 ].value;
pCuCmd->tPeriodicAppScanParams.eBssType = (ScanBssType_e )parm[ 4 ].value;
pCuCmd->tPeriodicAppScanParams.uProbeRequestNum = parm[ 5 ].value;
pCuCmd->tPeriodicAppScanParams.uCycleNum = parm[ 6 ].value;
pCuCmd->tPeriodicAppScanParams.uSsidNum = parm[ 7 ].value;
pCuCmd->tPeriodicAppScanParams.uSsidListFilterEnabled = (U8)(parm[ 8 ].value);
pCuCmd->tPeriodicAppScanParams.uChannelNum = parm[ 9 ].value;
}
VOID CuCmd_ConfigPeriodicScanInterval (THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
pCuCmd->tPeriodicAppScanParams.uCycleIntervalMsec[ parm[ 0 ].value ] = parm[ 1 ].value;
}
VOID CuCmd_ConfigurePeriodicScanSsid (THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
TSsid *pSsid = &pCuCmd->tPeriodicAppScanParams.tDesiredSsid[ parm[ 0 ].value ].tSsid;
pCuCmd->tPeriodicAppScanParams.tDesiredSsid[ parm[ 0 ].value ].eVisability = parm[ 1 ].value;
pSsid->len = (U8)os_strlen ((PS8)parm[ 2 ].value);
os_memcpy ((PVOID)&(pSsid->str),
(PVOID)parm[ 2 ].value,
pSsid->len);
if(pSsid->len < MAX_SSID_LEN)
{
pSsid->str[pSsid->len] = 0;
}
}
VOID CuCmd_ConfigurePeriodicScanChannel (THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t *pCuCmd = (CuCmd_t*)hCuCmd;
TPeriodicChannelEntry *pChannelEnrty = &(pCuCmd->tPeriodicAppScanParams.tChannels[ parm[ 0 ].value ]);
pChannelEnrty->eBand = parm[ 1 ].value;
pChannelEnrty->uChannel = parm[ 2 ].value;
pChannelEnrty->eScanType = parm[ 3 ].value;
pChannelEnrty->uMinDwellTimeMs = parm[ 4 ].value;;
pChannelEnrty->uMaxDwellTimeMs = parm[ 5 ].value;
pChannelEnrty->uTxPowerLevelDbm = parm[ 6 ].value;
}
VOID CuCmd_ClearPeriodicScanConfiguration (THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
os_memset (&(pCuCmd->tPeriodicAppScanParams), 0, sizeof (TPeriodicScanParams));
os_error_printf(CU_MSG_INFO2, (PS8)"Periodic application scan parameters cleared.\n");
}
VOID CuCmd_DisplayPeriodicScanConfiguration (THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
S32 i, j, k;
os_error_printf(CU_MSG_INFO2, (PS8)"Application Periodic Scan parameters:\n");
os_error_printf(CU_MSG_INFO2, (PS8)"RSSI Threshold: %d, SNR Threshold: %d, Report Threshold: %d Number of cycles: %d\n",
pCuCmd->tPeriodicAppScanParams.iRssiThreshold, pCuCmd->tPeriodicAppScanParams.iSnrThreshold,
pCuCmd->tPeriodicAppScanParams.uFrameCountReportThreshold, pCuCmd->tPeriodicAppScanParams.uCycleNum);
CU_CMD_FIND_NAME_ARRAY (i, booleanStr, pCuCmd->tPeriodicAppScanParams.bTerminateOnReport);
CU_CMD_FIND_NAME_ARRAY (j, bssTypeStr, pCuCmd->tPeriodicAppScanParams.eBssType);
os_error_printf(CU_MSG_INFO2, (PS8)"Terminate on Report: %s, BSS type: %s, Probe Request Number: %d\n",
booleanStr[ i ].name, bssTypeStr[ j ].name, pCuCmd->tPeriodicAppScanParams.uProbeRequestNum);
os_error_printf(CU_MSG_INFO2, (PS8)"\nIntervals (msec):\n");
for (i = 0; i < PERIODIC_SCAN_MAX_INTERVAL_NUM; i++)
{
os_error_printf(CU_MSG_INFO2, (PS8)"%d ", pCuCmd->tPeriodicAppScanParams.uCycleIntervalMsec[ i ]);
}
os_error_printf(CU_MSG_INFO2, (PS8)"\n\nSSIDs:\n");
for (i = 0; i < (S32)pCuCmd->tPeriodicAppScanParams.uSsidNum; i++)
{
CU_CMD_FIND_NAME_ARRAY (j, ssidVisabilityStr, pCuCmd->tPeriodicAppScanParams.tDesiredSsid[ i ].eVisability);
os_error_printf(CU_MSG_INFO2, (PS8)"%s (%s), ", pCuCmd->tPeriodicAppScanParams.tDesiredSsid[ i ].tSsid.str,
ssidVisabilityStr[ j ].name);
}
os_error_printf(CU_MSG_INFO2, (PS8)"\n\nSSID List Filter Enabled: %d\n", pCuCmd->tPeriodicAppScanParams.uSsidListFilterEnabled );
os_error_printf(CU_MSG_INFO2, (PS8)"\n\nChannels:\n");
os_error_printf(CU_MSG_INFO2, (PS8)"%-15s %-10s %-20s %-15s %-15s %-20s\n",
(PS8)"Band", (PS8)"Channel", (PS8)"Scan type", (PS8)"Min dwell time", (PS8)"Max dwell time", (PS8)"Power level (dBm*10)");
os_error_printf(CU_MSG_INFO2, (PS8)"----------------------------------------------------------------------------------------------------\n");
for (i = 0; i < (S32)pCuCmd->tPeriodicAppScanParams.uChannelNum; i++)
{
CU_CMD_FIND_NAME_ARRAY (j, band2Str, pCuCmd->tPeriodicAppScanParams.tChannels[ i ].eBand);
CU_CMD_FIND_NAME_ARRAY (k, scanType2Str, pCuCmd->tPeriodicAppScanParams.tChannels[ i ].eScanType);
os_error_printf(CU_MSG_INFO2, (PS8)"%-15s %-10d %-20s %-15d %-15d %-20d\n",
band2Str[ j ].name,
pCuCmd->tPeriodicAppScanParams.tChannels[ i ].uChannel,
scanType2Str[ k ].name,
pCuCmd->tPeriodicAppScanParams.tChannels[ i ].uMinDwellTimeMs,
pCuCmd->tPeriodicAppScanParams.tChannels[ i ].uMaxDwellTimeMs,
pCuCmd->tPeriodicAppScanParams.tChannels[ i ].uTxPowerLevelDbm);
}
os_error_printf(CU_MSG_INFO2, (PS8)"\n");
}
VOID CuCmd_StartPeriodicScan (THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
if(OK != CuCommon_SetBuffer(pCuCmd->hCuCommon, SCAN_CNCN_START_PERIODIC_SCAN,
&(pCuCmd->tPeriodicAppScanParams), sizeof(TPeriodicScanParams)))
{
return;
}
os_error_printf(CU_MSG_INFO2, (PS8)"Periodic application scan started.\n");
}
VOID CuCmd_StopPeriodicScan (THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
if(OK != CuCommon_SetBuffer(pCuCmd->hCuCommon, SCAN_CNCN_STOP_PERIODIC_SCAN,
NULL, 0))
{
return;
}
os_error_printf(CU_MSG_INFO2, (PS8)"Periodic application scan stopped.\n");
}
VOID CuCmd_ConfigScanPolicy(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
pCuCmd->scanPolicy.normalScanInterval = parm[ 0 ].value;
pCuCmd->scanPolicy.deterioratingScanInterval = parm[ 1 ].value;
pCuCmd->scanPolicy.maxTrackFailures = (U8)(parm[ 2 ].value);
pCuCmd->scanPolicy.BSSListSize = (U8)(parm[ 3 ].value);
pCuCmd->scanPolicy.BSSNumberToStartDiscovery = (U8)(parm[ 4 ].value);
pCuCmd->scanPolicy.numOfBands = (U8)(parm[ 5 ].value);
}
VOID CuCmd_ConfigScanBand(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
scan_bandPolicy_t* pBandPolicy = &(pCuCmd->scanPolicy.bandScanPolicy[ parm [ 0 ].value ]);
pBandPolicy->band = parm[ 1 ].value;
pBandPolicy->rxRSSIThreshold = (S8)(parm[ 2 ].value);
pBandPolicy->numOfChannlesForDiscovery = (U8)(parm[ 3 ].value);
pBandPolicy->numOfChannles = (U8)(parm[ 4 ].value);