PageRenderTime 66ms CodeModel.GetById 10ms RepoModel.GetById 0ms app.codeStats 1ms

/drivers/net/wireless/tiwlan1251/CUDK/CLI/cu_cmd.c

https://bitbucket.org/cyanogenmod/cm-kernel
C | 4896 lines | 4071 code | 671 blank | 154 comment | 594 complexity | fcb5e6f14279a95b0b28ca74c32c7a5c MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.0, AGPL-1.0
  1. /*******************************************************************************
  2. **+--------------------------------------------------------------------------+**
  3. **| |**
  4. **| Copyright 1998-2008 Texas Instruments, Inc. - http://www.ti.com/ |**
  5. **| |**
  6. **| Licensed under the Apache License, Version 2.0 (the "License"); |**
  7. **| you may not use this file except in compliance with the License. |**
  8. **| You may obtain a copy of the License at |**
  9. **| |**
  10. **| http://www.apache.org/licenses/LICENSE-2.0 |**
  11. **| |**
  12. **| Unless required by applicable law or agreed to in writing, software |**
  13. **| distributed under the License is distributed on an "AS IS" BASIS, |**
  14. **| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |**
  15. **| See the License for the specific language governing permissions and |**
  16. **| limitations under the License. |**
  17. **| |**
  18. **+--------------------------------------------------------------------------+**
  19. *******************************************************************************/
  20. #ifdef _WINDOWS
  21. #endif
  22. #include <stdio.h>
  23. #include <string.h>
  24. #include <stdlib.h>
  25. #include <ctype.h>
  26. #ifndef _WINDOWS
  27. #include <errno.h>
  28. #include <stdio.h>
  29. #include <unistd.h>
  30. #include <termios.h>
  31. #include <sys/socket.h>
  32. #include <linux/if.h>
  33. #include <linux/wireless.h>
  34. #include "tnetwCommon.h"
  35. #endif /* __LINUX__ */
  36. #include "g_tester.h"
  37. #include "wspVer.h"
  38. #include "paramOut.h"
  39. #include "console.h"
  40. #include "ticon.h"
  41. #include "cu_cmd.h"
  42. #include "linux_ioctl_common.h"
  43. #include "802_11Defs.h"
  44. #ifndef _T
  45. #define _T(a) a
  46. #endif
  47. #ifndef _WINDOWS
  48. TI_HANDLE g_id_adapter = 0;
  49. #endif
  50. #define MAX_SSID_LEN 32
  51. #define CLI_NUM_OF_TX_CLASFR_CON 4
  52. scan_Params_t appScanParams;
  53. scan_Policy_t scanPolicy;
  54. /*** Roaming Manager configuration parameters ***/
  55. roamingMngrConfigParams_t roamingMngrConfigParams;
  56. static tiUINT32 events_mask = 0; // TRS:PGK
  57. #define NET_BASIC_MASK 0x80 /* defined in common/src/utils/utils.c */
  58. #define IS_BASIC_RATE(a) ((a) & NET_BASIC_MASK)
  59. #define RATE_2_MBPS(a) ((float)((a) & (NET_BASIC_MASK-1))/2)
  60. #define GET_NAME_BY_VALUE(arr, value) get_name_by_value(arr, SIZE_ARR(arr), value)
  61. #define CHAN_FREQ_TABLE_SIZE (sizeof(ChanFreq) / sizeof(struct CHAN_FREQ))
  62. #define RATE_TABLE_SIZE (sizeof(rate2Str) / sizeof(named_value_t))
  63. #define ET_TABLE_SIZE (sizeof(EtEvent2Str) / sizeof(named_value_t))
  64. /* EarlyTermination DISABLE mode - Should be same as in scan.h */
  65. #define SCAN_ET_COND_DISABLE 0
  66. #define MAX_PSK_STRING_LENGTH 63
  67. #define MIN_PSK_STRING_LENGTH 8
  68. #define PSK_HEXA_LENGTH 64
  69. #define PSK_BUFF_LEN 65
  70. static void get_bssid_list(ConParm_t parm[], U16 nParms, BOOL fullBssidList , OS_802_11_BSSID_EX *pBssid);
  71. static BOOL is_value_rate (tiUINT32 rate)
  72. {
  73. switch (rate)
  74. {
  75. case 1:
  76. case 2:
  77. case 5:
  78. case 6:
  79. case 9:
  80. case 11:
  81. case 12:
  82. case 18:
  83. case 22:
  84. case 24:
  85. case 36:
  86. case 48:
  87. case 54:
  88. return (TRUE);
  89. default:
  90. return (FALSE);
  91. }
  92. }
  93. static BOOL is_value_rate (tiUINT32 rate);
  94. struct CHAN_FREQ {
  95. UINT8 chan;
  96. UINT32 freq;
  97. } ChanFreq[] = {
  98. {1,2412000}, {2,2417000}, {3,2422000}, {4,2427000},
  99. {5,2432000}, {6,2437000}, {7,2442000}, {8,2447000},
  100. {9,2452000},
  101. {10,2457000}, {11,2462000}, {12,2467000}, {13,2472000},
  102. {14,2484000}, {36,5180000}, {40,5200000}, {44,5220000},
  103. {48,5240000}, {52,5260000}, {56,5280000}, {60,5300000},
  104. {64,5320000},
  105. {100,5500000}, {104,5520000}, {108,5540000}, {112,5560000},
  106. {116,5580000}, {120,5600000}, {124,5620000}, {128,5640000},
  107. {132,5660000}, {136,5680000}, {140,5700000}, {149,5745000},
  108. {153,5765000}, {157,5785000}, {161,5805000} };
  109. static named_value_t power_mode_val[] = {
  110. { OS_POWER_MODE_AUTO, "AUTO" },
  111. { OS_POWER_MODE_ACTIVE, "ACTIVE" },
  112. { OS_POWER_MODE_SHORT_DOZE, "SHORT_DOZE" },
  113. { OS_POWER_MODE_LONG_DOZE, "LONG_DOZE" }
  114. };
  115. static named_value_t power_level_val[] = {
  116. { OS_POWER_LEVEL_ELP, "ELP" },
  117. { OS_POWER_LEVEL_PD, "PD" },
  118. { OS_POWER_LEVEL_AWAKE, "AWAKE" }
  119. };
  120. static named_value_t encrypt_type[] = {
  121. { OS_ENCRYPTION_TYPE_NONE, "None" },
  122. { OS_ENCRYPTION_TYPE_WEP, "WEP" },
  123. { OS_ENCRYPTION_TYPE_TKIP, "TKIP" },
  124. { OS_ENCRYPTION_TYPE_AES, "AES" }
  125. };
  126. static named_value_t scanType2Str[] = {
  127. { SCAN_TYPE_NORMAL_PASSIVE, "Passive Normal Scan" },
  128. { SCAN_TYPE_NORMAL_ACTIVE, "Active Normal Scan" },
  129. { SCAN_TYPE_SPS, "Scheduled Passive Scan (SPS)" },
  130. { SCAN_TYPE_TRIGGERED_PASSIVE, "Passive Triggered Scan" },
  131. { SCAN_TYPE_TRIGGERED_ACTIVE, "Active Triggered Scan" }
  132. };
  133. static named_value_t band2Str[] = {
  134. { RADIO_BAND_2_4_GHZ, "2.4 GHz" },
  135. { RADIO_BAND_5_0_GHZ, "5.0 GHz" },
  136. { RADIO_BAND_DUAL, "Both " }
  137. };
  138. static named_value_t rate2Str[] = {
  139. { DRV_RATE_MASK_AUTO, "Auto " },
  140. { DRV_RATE_MASK_1_BARKER, "1 Mbps " },
  141. { DRV_RATE_MASK_2_BARKER, "2 Mbps " },
  142. { DRV_RATE_MASK_5_5_CCK, "5.5 Mbps" },
  143. { DRV_RATE_MASK_11_CCK, "11 Mbps " },
  144. { DRV_RATE_MASK_22_PBCC, "22 Mbps " },
  145. { DRV_RATE_MASK_6_OFDM, "6 Mbps " },
  146. { DRV_RATE_MASK_9_OFDM, "9 Mbps " },
  147. { DRV_RATE_MASK_12_OFDM, "12 Mbps " },
  148. { DRV_RATE_MASK_18_OFDM, "18 Mbps " },
  149. { DRV_RATE_MASK_24_OFDM, "24 Mbps " },
  150. { DRV_RATE_MASK_36_OFDM, "36 Mbps " },
  151. { DRV_RATE_MASK_48_OFDM, "48 Mbps " },
  152. { DRV_RATE_MASK_54_OFDM, "54 Mbps " }
  153. };
  154. static named_value_t EtEvent2Str[] = {
  155. { SCAN_ET_COND_DISABLE, "ET disabled " },
  156. { SCAN_ET_COND_BEACON, "ET on Beacon " },
  157. { SCAN_ET_COND_PROBE_RESP, "ET on Prb Rsp" },
  158. { SCAN_ET_COND_ANY_FRAME, "ET on both " }
  159. };
  160. /* used in scan_display */
  161. static char* rate2StrFunc(UINT32 rate)
  162. {
  163. UINT32 i;
  164. for ( i = 0; i < RATE_TABLE_SIZE; i++ )
  165. {
  166. if ( rate2Str[ i ].value == rate )
  167. return rate2Str[ i ].name;
  168. }
  169. return rate2Str[ 0 ].name;
  170. }
  171. /* used in scan_display */
  172. static char* EtEvent2StrFunc( UINT32 ETCond )
  173. {
  174. int i;
  175. for ( i = 0; i < ET_TABLE_SIZE; i++ )
  176. {
  177. if ( EtEvent2Str[ i ].value == ETCond )
  178. {
  179. return EtEvent2Str[ i ].name;
  180. }
  181. }
  182. return EtEvent2Str[ 0 ].name;
  183. }
  184. /* used in get_bssid_list() */
  185. UINT8 Freq2Chan(UINT32 freq)
  186. {
  187. UINT32 i;
  188. for(i=0; i<CHAN_FREQ_TABLE_SIZE; i++)
  189. if(ChanFreq[i].freq == freq) return ChanFreq[i].chan;
  190. return 0;
  191. }
  192. /* IPC events Callback */
  193. int cli_receive_ev(IPC_EV_DATA* pData)
  194. {
  195. tiUINT8 *buf;
  196. OS_802_11_QOS_TSPEC_PARAMS *AddTsResult;
  197. OS_802_11_AUTHENTICATION_REQUEST *request;
  198. OS_802_11_DISASSOCIATE_REASON_T *pDisAssoc;
  199. OS_802_11_THRESHOLD_CROSS_INDICATION_PARAMS *CrossParams;
  200. OS_802_11_TRAFFIC_INTENSITY_THRESHOLD_CROSS_INDICATION_PARAMS *TrafficIntensityThresholdParams;
  201. btCoexStatus_t *btCoexStatus;
  202. #if defined (_WINDOWS)
  203. #endif
  204. g_tester_receive_event((tiUINT8)((IPC_EVENT_PARAMS *)pData)->uEventType);
  205. #if defined (_WINDOWS)
  206. #endif
  207. switch(((IPC_EVENT_PARAMS *)pData)->uEventType)
  208. {
  209. case IPC_EVENT_ASSOCIATED:
  210. console_printf_terminal("CLI Event - Associated\n");
  211. // TRS:HLC
  212. /*
  213. #if defined (_WINDOWS)
  214. #endif
  215. */
  216. //TRS end
  217. break;
  218. case IPC_EVENT_DISASSOCIATED:
  219. pDisAssoc = (OS_802_11_DISASSOCIATE_REASON_T*)pData->uBuffer;
  220. switch(pDisAssoc->eDisAssocType)
  221. {
  222. case OS_DISASSOC_STATUS_UNSPECIFIED:
  223. console_printf_terminal("CLI Event - Disassociated with unspecified reason (User/SG/Recovery)\n");
  224. break;
  225. case OS_DISASSOC_STATUS_AUTH_REJECT:
  226. if (pDisAssoc->uStatusCode == STATUS_PACKET_REJ_TIMEOUT)
  227. {
  228. console_printf_terminal("CLI Event - Disassociated due to no Auth response \n");
  229. }
  230. else
  231. {
  232. console_printf_terminal("CLI Event - Disassociated due to Auth response packet with reason = %d\n", pDisAssoc->uStatusCode);
  233. }
  234. break;
  235. case OS_DISASSOC_STATUS_ASSOC_REJECT:
  236. if (pDisAssoc->uStatusCode == STATUS_PACKET_REJ_TIMEOUT)
  237. {
  238. console_printf_terminal("CLI Event - Disassociated due to no Assoc response \n");
  239. }
  240. else
  241. {
  242. console_printf_terminal("CLI Event - Disassociated due to Assoc response packet with reason = %d\n", pDisAssoc->uStatusCode);
  243. }
  244. break;
  245. case OS_DISASSOC_STATUS_SECURITY_FAILURE:
  246. console_printf_terminal("CLI Event - Disassociated due to RSN failure\n");
  247. break;
  248. case OS_DISASSOC_STATUS_AP_DEAUTHENTICATE:
  249. console_printf_terminal("CLI Event - Disassociated due to AP deAuthenticate packet with reason = %d\n", pDisAssoc->uStatusCode);
  250. break;
  251. case OS_DISASSOC_STATUS_AP_DISASSOCIATE:
  252. console_printf_terminal("CLI Event - Disassociated due to AP disAssoc packet with reason = %d\n", pDisAssoc->uStatusCode);
  253. break;
  254. case OS_DISASSOC_STATUS_ROAMING_TRIGGER:
  255. console_printf_terminal("CLI Event - Disassociated due to roaming trigger = %d\n", pDisAssoc->uStatusCode);
  256. break;
  257. default:
  258. console_printf_terminal("CLI Event - Disassociated with unknown reason = %d\n", pDisAssoc->eDisAssocType);
  259. break;
  260. }
  261. break;
  262. case IPC_EVENT_LINK_SPEED:
  263. console_printf_terminal("CLI Event - LinkSpeed\n");
  264. break;
  265. case IPC_EVENT_AUTH_SUCC:
  266. console_printf_terminal("CLI Event - Authentication Success\n");
  267. break;
  268. case IPC_EVENT_SCAN_COMPLETE:
  269. console_printf_terminal("CLI Event - Scan Complete\n");
  270. break;
  271. case IPC_EVENT_TIMEOUT:
  272. console_printf_terminal("CLI Event - Timeout\n");
  273. break;
  274. case IPC_EVENT_UNBOUND:
  275. console_printf_terminal("CLI Event - Unbound\n");
  276. break;
  277. case IPC_EVENT_BOUND:
  278. console_printf_terminal("CLI Event - Bound\n");
  279. break;
  280. case IPC_EVENT_EAPOL:
  281. console_printf_terminal("CLI Event - EAPOL\n");
  282. break;
  283. case IPC_EVENT_MEDIA_SPECIFIC:
  284. buf = pData->uBuffer;
  285. request = (OS_802_11_AUTHENTICATION_REQUEST *) (buf + sizeof(tiUINT32));
  286. if( request->Flags == OS_802_11_REQUEST_PAIRWISE_ERROR ||
  287. request->Flags == OS_802_11_REQUEST_GROUP_ERROR)
  288. console_printf_terminal("CLI Event - Media_Specific\n");
  289. break;
  290. case IPC_EVENT_CCKM_START:
  291. console_printf_terminal("CLI Event - CCKM_Start\n");
  292. break;
  293. case IPC_EVENT_PREAUTH_EAPOL:
  294. console_printf_terminal("CLI Event - PreAuth EAPOL\n");
  295. break;
  296. case IPC_EVENT_LOW_SNR:
  297. console_printf_terminal("CLI Event - Low SNR\n");
  298. break;
  299. case IPC_EVENT_LOW_RSSI:
  300. console_printf_terminal("CLI Event - Low RSSI\n");
  301. break;
  302. case IPC_EVENT_EAP_AUTH_FAILURE:
  303. {
  304. OS_802_11_EAP_TYPES eapType;
  305. tiINT32 status;
  306. authStatus_e eAuthStatusReason;
  307. /* Cast the value to be UINT16 16 bits since it is sent this way in the EXCMngr.c */
  308. eAuthStatusReason = (authStatus_e)((*(pData->uBuffer)) & 0xFFFF);
  309. status = TI_GetEAPType( g_id_adapter, &eapType );
  310. if (eapType == OS_EAP_TYPE_LEAP)
  311. {
  312. console_printf_terminal("CLI Event - LEAP Authentication Failed \n");
  313. }
  314. else if (eapType == OS_EAP_TYPE_FAST)
  315. {
  316. console_printf_terminal("CLI Event - EAP-FAST Authentication Failed \n");
  317. }
  318. else if (eapType == OS_EAP_TYPE_TLS)
  319. {
  320. console_printf_terminal("CLI Event - EAP-TLS Authentication Failed \n");
  321. }
  322. switch ( eAuthStatusReason )
  323. {
  324. case RSN_AUTH_STATUS_INVALID_TYPE:
  325. console_printf_terminal("The reason: Invalid Authentication Type \n");
  326. break;
  327. case RSN_AUTH_STATUS_TIMEOUT:
  328. console_printf_terminal("The reason: Authentication Timeout \n");
  329. break;
  330. case RSN_AUTH_STATUS_CHALLENGE_FROM_AP_FAILED:
  331. case RSN_AUTH_STATUS_CHALLENGE_TO_AP_FAILED:
  332. console_printf_terminal("The reason: username or password incorrect \n");
  333. break;
  334. default:
  335. console_printf_terminal("The reason: unknown = %d \n", eAuthStatusReason);
  336. break;
  337. }
  338. }
  339. break;
  340. case IPC_EVENT_TSPEC_STATUS:
  341. AddTsResult = (OS_802_11_QOS_TSPEC_PARAMS *)pData->uBuffer;
  342. console_printf_terminal("CLI Event - IPC_EVENT_TSPEC_STATUS -- (userPriority = %d, ReasonCode = %d) \n",AddTsResult->uUserPriority,AddTsResult->uReasonCode);
  343. console_printf_terminal ("Tspec Parameters (as received through event handler):\n");
  344. console_printf_terminal ("-----------------------------------------------------\n");
  345. console_printf_terminal ("userPriority = %d\n",AddTsResult->uUserPriority);
  346. console_printf_terminal ("uNominalMSDUsize = %d\n",AddTsResult->uNominalMSDUsize);
  347. console_printf_terminal ("uMeanDataRate = %d\n",AddTsResult->uMeanDataRate);
  348. console_printf_terminal ("uMinimumPHYRate = %d\n",AddTsResult->uMinimumPHYRate);
  349. console_printf_terminal ("uSurplusBandwidthAllowance = %d\n",AddTsResult->uSurplusBandwidthAllowance);
  350. console_printf_terminal ("uAPSDFlag = %d\n",AddTsResult->uAPSDFlag);
  351. console_printf_terminal ("uMediumTime = %d\n\n",AddTsResult->uMediumTime);
  352. break;
  353. case IPC_EVENT_TSPEC_RATE_STATUS:
  354. CrossParams = (OS_802_11_THRESHOLD_CROSS_INDICATION_PARAMS *)pData->uBuffer;
  355. console_printf_terminal("CLI Event - IPC_EVENT_TSPEC_RATE_STATUS (AC = %d, HighLowFlag = %d, AboveOrBelow = %d)\n",CrossParams->uAC,CrossParams->uHighOrLowThresholdFlag,CrossParams->uAboveOrBelowFlag);
  356. break;
  357. case IPC_EVENT_MEDIUM_TIME_CROSS:
  358. CrossParams = (OS_802_11_THRESHOLD_CROSS_INDICATION_PARAMS *)pData->uBuffer;
  359. console_printf_terminal("CLI Event - IPC_EVENT_MEDIUM_TIME_CROSS (AC = %d, HighLowFlag = %d, AboveOrBelow = %d)\n",CrossParams->uAC,CrossParams->uHighOrLowThresholdFlag,CrossParams->uAboveOrBelowFlag);
  360. break;
  361. case IPC_EVENT_TRAFFIC_INTENSITY_THRESHOLD_CROSSED:
  362. TrafficIntensityThresholdParams = (OS_802_11_TRAFFIC_INTENSITY_THRESHOLD_CROSS_INDICATION_PARAMS*)pData->uBuffer;
  363. printf("CLI Event - IPC_EVENT_TRAFFIC_INTENSITY_THRESHOLD_CROSSED\n");
  364. printf("---------------------------------------------------------\n");
  365. printf("Threshold crossed: %s Threshold\n", ((TrafficIntensityThresholdParams->uHighOrLowThresholdFlag == HIGH_THRESHOLD_CROSS) ? "High" : "Low"));
  366. printf("Direction crossed: %s\n\n", ((TrafficIntensityThresholdParams->uAboveOrBelowFlag == CROSS_ABOVE) ? "Above" : "Below"));
  367. break;
  368. case IPC_EVENT_WPA2_PREAUTHENTICATION:
  369. {
  370. ULONG *WPA2_PreAuth_Status;
  371. WPA2_PreAuth_Status = (ULONG *)pData->uBuffer;
  372. printf("CLI Event - IPC_EVENT_WPA2_PREAUTHENTICATION\n");
  373. printf("Status code = %lu\n",*WPA2_PreAuth_Status);
  374. }
  375. break;
  376. case IPC_EVENT_ROAMING_COMPLETE:
  377. printf("CLI Event - IPC_EVENT_ROAMING_COMPLETE \n");
  378. break;
  379. case IPC_EVENT_BT_COEX_MODE:
  380. btCoexStatus = (btCoexStatus_t*)pData->uBuffer;
  381. if (btCoexStatus->state)
  382. {
  383. console_printf_terminal("CLI Event - IPC_EVENT_BT_COEX_MODE (SG is ON, minTxRate = %d)\n",btCoexStatus->minTxRate);
  384. }
  385. else
  386. {
  387. console_printf_terminal("CLI Event - IPC_EVENT_BT_COEX_MODE (SG is OFF)\n");
  388. }
  389. break;
  390. default:
  391. console_printf_terminal("CLI Event - Unknown event\n");
  392. break;
  393. }
  394. return 0;
  395. }
  396. static char *print_rate(rate_e rate)
  397. {
  398. static char buf[20];
  399. if( rate == 0 )
  400. return "Auto (0)";
  401. sprintf(buf, "%.3g Mbps (%u%s)", RATE_2_MBPS(rate), rate,
  402. IS_BASIC_RATE(rate) ? " - basic" : "" );
  403. return buf;
  404. }
  405. static BOOL isJunkSSID(OS_802_11_SSID *ssid )
  406. {
  407. if ((ssid == NULL) || (ssid->SsidLength == 0))
  408. {
  409. return TRUE;
  410. }
  411. if (ssid->SsidLength > 2)
  412. {
  413. if ((ssid->Ssid[0] < MAX_SSID_LEN) &&
  414. (ssid->Ssid[1] < MAX_SSID_LEN) &&
  415. (ssid->Ssid[2] < MAX_SSID_LEN))
  416. {
  417. return TRUE;
  418. }
  419. }
  420. return FALSE;
  421. }
  422. static char *get_ssid_string(OS_802_11_SSID *ssid )
  423. {
  424. static char tmp_buf[MAX_SSID_LEN+1];
  425. if ((ssid == NULL) || (ssid->SsidLength == 0) || isJunkSSID(ssid))
  426. return "<empty>";
  427. if (ssid->SsidLength < SIZE_ARR(ssid->Ssid))
  428. ssid->Ssid[ssid->SsidLength] = 0;
  429. else if( ssid->SsidLength == MAX_SSID_LEN )
  430. {
  431. memcpy(tmp_buf, ssid->Ssid, MAX_SSID_LEN );
  432. tmp_buf[MAX_SSID_LEN] = 0;
  433. return tmp_buf;
  434. }
  435. else
  436. {
  437. console_printf_terminal("error: invalid ssid length (len = %u)\n", ssid->SsidLength );
  438. return "<error>";
  439. }
  440. return (char *) ssid->Ssid;
  441. }
  442. /* return 0 on error
  443. or 'mac' if success
  444. 'str' format: num.num.num.num.num.num (where 'num' is number from 0 to 255)
  445. */
  446. U8* str2MACAddr(char *str, U8 *mac)
  447. {
  448. const int mac_len = 6;
  449. int i;
  450. char *p = str;
  451. #ifndef _WINDOWS
  452. errno = 0;
  453. #endif
  454. console_printf_terminal("str2MAC():");
  455. for( i=0; i<mac_len; i++ )
  456. {
  457. mac[i] = (U8) strtoul(p, &p, 16);
  458. #ifndef _WINDOWS
  459. if( errno == ERANGE )
  460. return NULL;
  461. #endif
  462. console_printf_terminal("%2x.", mac[i] );
  463. p++;
  464. }
  465. console_printf_terminal("\n");
  466. return mac;
  467. }
  468. static char * print_mac_2_str(OS_802_11_MAC_ADDRESS mac)
  469. {
  470. static char buf[30];
  471. sprintf(buf, "%02x.%02x.%02x.%02x.%02x.%02x",
  472. mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
  473. return buf;
  474. }
  475. /* convert hex MAC addr in the form xx:xx:xx:xx:xx:xx to mac address */
  476. static void hexStr2MACAddr( char *hexStr, macAddress_t* mac )
  477. {
  478. size_t i;
  479. char *currHexStrPos = hexStr;
  480. UINT8 tempValue;
  481. /* convert hex string to lower */
  482. for ( i = 0; i < strlen(hexStr); i++ )
  483. {
  484. hexStr[ i ] = tolower( hexStr[ i ] );
  485. }
  486. /* convert to numbers */
  487. for ( i = 0; i < 6; i++ )
  488. {
  489. tempValue = 0;
  490. if ( *currHexStrPos >= 'a' )
  491. tempValue = *currHexStrPos - 'a' + 10;
  492. else
  493. tempValue = *currHexStrPos - '0';
  494. currHexStrPos++;
  495. tempValue <<= 4;
  496. if ( *currHexStrPos >= 'a' )
  497. tempValue += *currHexStrPos - 'a' + 10;
  498. else
  499. tempValue += *currHexStrPos - '0';
  500. currHexStrPos += 2;
  501. mac->addr[ i ] = tempValue;
  502. }
  503. }
  504. static void mac2HexStr( macAddress_t* mac, char* hexStr )
  505. {
  506. sprintf( hexStr, "%02x:%02x:%02x:%02x:%02x:%02x",
  507. mac->addr[0],mac->addr[1],mac->addr[2],mac->addr[3],mac->addr[4],mac->addr[5]);
  508. }
  509. char *get_name_by_value(named_value_t *arr, int arr_size, UINT32 value)
  510. {
  511. int i;
  512. for(i=0; i<arr_size; i++) {
  513. if( arr[i].value == value )
  514. return arr[i].name;
  515. }
  516. return "<unknow>";
  517. }
  518. void cmd_modify_supported_rates(ConParm_t parm[], U16 nParms)
  519. {
  520. rates_t data = { 0 };
  521. char debug_buf[256] = { 0 };
  522. int i;
  523. if( nParms == 0 )
  524. {
  525. if( !TI_GetSupportedRates(g_id_adapter, (tiUINT8*)&data, sizeof(data)) )
  526. {
  527. console_printf_terminal(" Rates: ");
  528. for( i=0; i<MAX_SUPPORTED_RATES && i < data.len; i++ )
  529. {
  530. console_printf_terminal("%g Mbps(%u%s)%s", RATE_2_MBPS(data.ratesString[i]),
  531. data.ratesString[i],
  532. IS_BASIC_RATE(data.ratesString[i]) ? " - basic" : "",
  533. (i < data.len-1) ? "," : "" );
  534. }
  535. console_printf_terminal("\n");
  536. }
  537. }
  538. else
  539. {
  540. char *end_p, *buf = (char *) parm[0].value;
  541. float val;
  542. console_printf_terminal("param: %s\n", buf );
  543. #ifndef _WINDOWS
  544. errno = 0;
  545. #endif
  546. for( i=0; *buf && i < MAX_SUPPORTED_RATES; i++ )
  547. {
  548. val = (float) strtod(buf, &end_p);
  549. if(
  550. #ifndef _WINDOWS
  551. errno ||
  552. #endif
  553. buf == end_p )
  554. {
  555. console_printf_terminal("cmd_modify_supported_rates(): invalid value - %s\n", buf );
  556. return;
  557. }
  558. if( val > ((1 << (sizeof(data.ratesString[i]) * 8))-1) )
  559. {
  560. console_printf_terminal("cmd_modify_supported_rates(): out of range '%.*s'\n", end_p - buf, buf );
  561. return;
  562. }
  563. data.ratesString[i] = (tiUINT8) (val);
  564. sprintf(&debug_buf[strlen(debug_buf)], "%g (%d) ", val, data.ratesString[i] );
  565. buf = end_p;
  566. while( *buf==' ' || *buf == ',' ) buf++;
  567. }
  568. if( *buf )
  569. {
  570. console_printf_terminal("too many parameters. Max=%d\n", MAX_SUPPORTED_RATES );
  571. return;
  572. }
  573. data.len = i;
  574. console_printf_terminal("**set rates (%d) :%s\n", data.len, debug_buf );
  575. TI_SetSupportedRates(g_id_adapter, (tiUINT8*) &data, sizeof(data));
  576. }
  577. }
  578. void cmd_show_status(ConParm_t parm[], U16 nParms)
  579. {
  580. tiINT32 res;
  581. OS_802_11_BSSID_EX BssIdInfo;
  582. tiUINT32 data;
  583. char buf[4096] = { 0 };
  584. OS_802_11_SSID ssid = { 0 };
  585. OS_802_11_MAC_ADDRESS bssid = { 0 };
  586. UNUSED(parm);
  587. UNUSED(nParms);
  588. buf[0] = 0;
  589. res = TI_WLAN_IsDriverRun(g_id_adapter, (tiBOOL *)&data);
  590. if( res )
  591. return ;
  592. sprintf(buf, "Status : %s\n", res ? "<error>" : (data ? "running" : "stopped") );
  593. sprintf(&buf[strlen(buf)], "MAC : ");
  594. if( !TI_GetCurrentAddress(g_id_adapter, &bssid ) )
  595. strcat(buf, print_mac_2_str(bssid) );
  596. else
  597. strcat(buf, "<error>");
  598. strcat(buf, "\nSSID : ");
  599. if( !TI_GetCurrentSSID(g_id_adapter, &ssid) )
  600. {
  601. if (!isJunkSSID(&ssid))
  602. {
  603. strncat(buf, get_ssid_string(&ssid),ssid.SsidLength);
  604. }
  605. else
  606. {
  607. strcat(buf,"<empty>");
  608. }
  609. }
  610. else
  611. strcat(buf, "<error>" );
  612. sprintf(&buf[strlen(buf)], "\nBSSID : ");
  613. TI_GetSelectedBSSIDInfo(g_id_adapter, &BssIdInfo);
  614. strcat(buf, print_mac_2_str(BssIdInfo.MacAddress));
  615. strcat(buf, "\nChannel : ");
  616. data = 0;
  617. if( !TI_GetCurrentChannel(g_id_adapter, &data ) )
  618. {
  619. sprintf(&buf[strlen(buf)], "%d", data );
  620. }
  621. else
  622. strcat(buf, "<error>");
  623. console_printf_terminal("==========================\n%s\n==========================\n\n", buf);
  624. }
  625. void cmd_connect(ConParm_t parm[], U16 nParms)
  626. {
  627. char buf[1] = { 0 };
  628. OS_802_11_MAC_ADDRESS bssid = { 0xff,0xff,0xff,0xff,0xff,0xff };
  629. buf[0] = 0;
  630. switch (nParms) {
  631. case 0 :
  632. /*
  633. * No SSID & No BSSID are set -
  634. * Use Any SSID & Any BSSID.
  635. */
  636. TI_SetBSSID(g_id_adapter, &bssid );
  637. TI_SetSSID(g_id_adapter, (tiUINT8 *) buf);
  638. break;
  639. case 1:
  640. /*
  641. * SSID set & BSSID insn't set -
  642. * Use CLI's SSID & Any BSSID.
  643. */
  644. TI_SetBSSID(g_id_adapter, &bssid );
  645. TI_SetSSID(g_id_adapter, (tiUINT8 *) parm[0].value);
  646. break;
  647. case 2:
  648. /*
  649. * Both SSID & BSSID are set -
  650. * Use CLI's SSID & BSSID.
  651. */
  652. if( !str2MACAddr((char *) parm[1].value, bssid) )
  653. return;
  654. TI_SetBSSID(g_id_adapter, &bssid);
  655. TI_SetSSID(g_id_adapter, (tiUINT8 *) parm[0].value);
  656. break;
  657. }
  658. }
  659. void cmd_disassociate(ConParm_t parm[], U16 nParms)
  660. {
  661. UNUSED(parm);
  662. UNUSED(nParms);
  663. TI_Disassociate(g_id_adapter);
  664. }
  665. void cmd_show_advanced_params(ConParm_t parm[], U16 nParms)
  666. {
  667. tiUINT32 mode_4x = 0, preamble = 0xfefefefe;
  668. OS_802_11_AUTHENTICATION_MODE auth;
  669. OS_802_11_ENCRYPTION_TYPES encrypt;
  670. tiUINT32 rts_tresh;
  671. tiUINT32 frag_tresh = 0xfefefefe;
  672. tiUINT8 tx_power = 0xfe;
  673. OS_802_11_POWER_PROFILE power_mode = 0;
  674. UNUSED(parm);
  675. UNUSED(nParms);
  676. TI_GetAuthenticationMode(g_id_adapter, &auth );
  677. TI_GetTxPowerDbm(g_id_adapter, (tiCHAR*) &tx_power);
  678. TI_GetFragmentThreshold( g_id_adapter, &frag_tresh);
  679. TI_GetRTSThreshold( g_id_adapter, &rts_tresh);
  680. TI_Get4XState( g_id_adapter, &mode_4x);
  681. TI_GetEncryptionType( g_id_adapter, &encrypt );
  682. TI_GetPowerMode(g_id_adapter, (OS_802_11_POWER_PROFILE*) &power_mode );
  683. console_printf_terminal(" Authentication : %u\n", auth );
  684. console_printf_terminal(" Power mode : %d\n", (tiUINT32) power_mode );
  685. console_printf_terminal(" Tx Power (Dbm/10 units) : %d\n", tx_power );
  686. console_printf_terminal(" Encryption : %u\n", encrypt );
  687. console_printf_terminal(" Preamble : <%s>\n", (preamble) ? "short" : "long");
  688. /* console_printf_terminal(" Tx antenna : %u\n", tx_ant );*/
  689. /* console_printf_terminal( " Rx antenna : %u\n", rx_ant );*/
  690. /* console_printf_terminal( "Ap Tx power level: n/a\n" );*/
  691. /* console_printf_terminal( " Tx power value : %lu\n", tx_power_val );*/
  692. /* console_printf_terminal( " MAC address : n/a\n" );*/
  693. console_printf_terminal( " 4X state : %d\n", mode_4x );
  694. /* console_printf_terminal( " B/G mode : n/a\n" );*/
  695. /* console_printf_terminal( " Country code : n/a\n" );*/
  696. /* console_printf_terminal( " IP address : n/a\n" );*/
  697. /* console_printf_terminal( " Net mask : n/a\n" );*/
  698. /* console_printf_terminal( " Gateway : n/a\n" );*/
  699. console_printf_terminal( " Frag. threshold : %u\n", frag_tresh);
  700. console_printf_terminal( " RTS threshold : %u\n", rts_tresh );
  701. console_printf_terminal( "Power mode: ");
  702. print_available_values(power_mode_val);
  703. console_printf_terminal( "Encryption type: ");
  704. print_available_values(encrypt_type);
  705. }
  706. void cmd_show_statistics(ConParm_t parm[], U16 nParms)
  707. {
  708. TIWLN_STATISTICS statistics = { 0 } ;
  709. UNUSED(parm);
  710. UNUSED(nParms);
  711. console_printf_terminal( "TI_GetStatistics(%s, data=%p, size=%d\n", (char*) g_id_adapter, &statistics, sizeof(statistics) );
  712. if( TI_GetStatistics( g_id_adapter, &statistics ) )
  713. {
  714. console_printf_terminal ("Error in getting TI_GetStatistics!!\n");
  715. return;
  716. }
  717. console_printf_terminal("******************\n");
  718. console_printf_terminal("Driver Statistics:\n");
  719. console_printf_terminal("******************\n");
  720. console_printf_terminal(" dot11CurrentTxRate : %s\n", print_rate(statistics.dot11CurrentTxRate) );
  721. console_printf_terminal(" dot11CurrentChannel : %d\n", statistics.dot11CurrentChannel );
  722. console_printf_terminal(" currentMACAddress : %s\n", print_mac_2_str(statistics.currentMACAddress) );
  723. console_printf_terminal(" dot11DesiredSSID : %s\n", get_ssid_string(&statistics.dot11DesiredSSID) );
  724. console_printf_terminal(" dot11BSSType : %d\n", statistics.dot11BSSType );
  725. console_printf_terminal(" AuthenticationMode : %d\n", statistics.AuthenticationMode );
  726. console_printf_terminal(" bShortPreambleUsed : %d\n", statistics.bShortPreambleUsed );
  727. console_printf_terminal(" RTSThreshold : %d\n", statistics.RTSThreshold );
  728. console_printf_terminal("FragmentationThreshold : %d\n", statistics.FragmentationThreshold );
  729. console_printf_terminal(" bDefaultWEPKeyDefined : %d\n", statistics.bDefaultWEPKeyDefined );
  730. console_printf_terminal(" WEPStatus : %d\n", statistics.WEPStatus );
  731. console_printf_terminal(" TxAntenna : %d\n", statistics.TxAntenna );
  732. console_printf_terminal(" RxAntenna : %d\n", statistics.RxAntenna );
  733. console_printf_terminal(" TxPowerDbm : %d\n", statistics.TxPowerDbm );
  734. console_printf_terminal(" PowerMode : %d\n", statistics.PowerMode );
  735. console_printf_terminal(" RxLevel : %d\n", statistics.RxLevel );
  736. /**/
  737. /* status & AP info*/
  738. /**/
  739. console_printf_terminal(" dot11State : %d\n", statistics.dot11State );
  740. /**/
  741. /* network layer statistics*/
  742. /**/
  743. console_printf_terminal(" RecvOk : %d\n", statistics.tiCounters.RecvOk );
  744. console_printf_terminal(" RecvError : %d\n", statistics.tiCounters.RecvError );
  745. console_printf_terminal(" DirectedBytesRecv : %d\n", statistics.tiCounters.DirectedBytesRecv );
  746. console_printf_terminal(" DirectedFramesRecv : %d\n", statistics.tiCounters.DirectedFramesRecv );
  747. console_printf_terminal(" MulticastBytesRecv : %d\n", statistics.tiCounters.MulticastBytesRecv );
  748. console_printf_terminal(" MulticastFramesRecv : %d\n", statistics.tiCounters.MulticastFramesRecv );
  749. console_printf_terminal(" BroadcastBytesRecv : %d\n", statistics.tiCounters.BroadcastBytesRecv );
  750. console_printf_terminal(" BroadcastFramesRecv : %d\n", statistics.tiCounters.BroadcastFramesRecv );
  751. console_printf_terminal(" FcsErrors : %d\n", statistics.tiCounters.FcsErrors );
  752. console_printf_terminal(" BeaconsRecv : %d\n", statistics.tiCounters.BeaconsRecv );
  753. console_printf_terminal(" AssocRejects : %d\n", statistics.tiCounters.AssocRejects );
  754. console_printf_terminal(" AssocTimeouts : %d\n", statistics.tiCounters.AssocTimeouts );
  755. console_printf_terminal(" AuthRejects : %d\n", statistics.tiCounters.AuthRejects );
  756. console_printf_terminal(" AuthTimeouts : %d\n", statistics.tiCounters.AuthTimeouts );
  757. /**/
  758. /* other statistics*/
  759. /**/
  760. console_printf_terminal(" dwSecuritySuit : %d\n", statistics.dwSecuritySuit );
  761. console_printf_terminal(" dwSecurityState : %d\n", statistics.dwSecurityState );
  762. console_printf_terminal(" dwSecurityAuthStatus : %d\n", statistics.dwSecurityAuthStatus );
  763. console_printf_terminal(" dwFeatureSuit : %d\n", statistics.dwFeatureSuit );
  764. }
  765. void cmd_show_tx_statistics(ConParm_t parm[], U16 nParms)
  766. {
  767. TIWLN_TX_STATISTICS statistics;
  768. UINT32 TxQid;
  769. UINT32 AverageDelay;
  770. UINT32 AverageFWDelay;
  771. UINT32 AverageMacDelay;
  772. tiINT32 status;
  773. UNUSED(parm);
  774. UNUSED(nParms);
  775. console_printf_terminal("TI_GetTxStatistics(%s, data=%p, size=%d\n", (char*) g_id_adapter, &statistics, sizeof(statistics) );
  776. /* The first parameter indicates whether to clear the statistics on read: 0 - don't clear, 1 - clear */
  777. if ( 0 == nParms )
  778. {
  779. status = TI_GetTxStatistics( g_id_adapter, &statistics, 0 );
  780. }
  781. else
  782. {
  783. status = TI_GetTxStatistics( g_id_adapter, &statistics, parm[0].value );
  784. }
  785. if( status )
  786. {
  787. console_printf_terminal ("Error in getting TI_GetTxStatistics!!\n");
  788. return;
  789. }
  790. console_printf_terminal("*********************\n");
  791. console_printf_terminal("Tx Queues Statistics:\n");
  792. console_printf_terminal("*********************\n");
  793. for (TxQid = 0; TxQid < MAX_NUM_OF_TX_QUEUES; TxQid++)
  794. {
  795. console_printf_terminal("\nTx Queue %d:\n", TxQid);
  796. console_printf_terminal("===========\n");
  797. console_printf_terminal(" Total Good Frames : %d\n", statistics.txCounters[TxQid].XmitOk );
  798. console_printf_terminal(" Unicast Bytes : %d\n", statistics.txCounters[TxQid].DirectedBytesXmit );
  799. console_printf_terminal(" Unicast Frames : %d\n", statistics.txCounters[TxQid].DirectedFramesXmit );
  800. console_printf_terminal(" Multicast Bytes : %d\n", statistics.txCounters[TxQid].MulticastBytesXmit );
  801. console_printf_terminal(" Multicast Frames : %d\n", statistics.txCounters[TxQid].MulticastFramesXmit );
  802. console_printf_terminal(" Broadcast Bytes : %d\n", statistics.txCounters[TxQid].BroadcastBytesXmit );
  803. console_printf_terminal(" Broadcast Frames : %d\n", statistics.txCounters[TxQid].BroadcastFramesXmit );
  804. console_printf_terminal(" Retry Failures : %d\n", statistics.txCounters[TxQid].RetryFailCounter );
  805. console_printf_terminal(" Tx Timeout Failures : %d\n", statistics.txCounters[TxQid].TxTimeoutCounter );
  806. console_printf_terminal(" No Link Failures : %d\n", statistics.txCounters[TxQid].NoLinkCounter );
  807. console_printf_terminal(" Other Failures : %d\n", statistics.txCounters[TxQid].OtherFailCounter );
  808. console_printf_terminal(" Max Consecutive Retry Failures : %d\n\n", statistics.txCounters[TxQid].MaxConsecutiveRetryFail );
  809. console_printf_terminal(" Retry histogram:\n");
  810. console_printf_terminal(" ----------------\n\n");
  811. console_printf_terminal(" Retries: %8d %8d %8d %8d %8d %8d %8d %8d\n", 0, 1, 2, 3, 4, 5, 6, 7);
  812. console_printf_terminal(" packets: %8d %8d %8d %8d %8d %8d %8d %8d\n\n",
  813. statistics.txCounters[TxQid].RetryHistogram[ 0 ],
  814. statistics.txCounters[TxQid].RetryHistogram[ 1 ],
  815. statistics.txCounters[TxQid].RetryHistogram[ 2 ],
  816. statistics.txCounters[TxQid].RetryHistogram[ 3 ],
  817. statistics.txCounters[TxQid].RetryHistogram[ 4 ],
  818. statistics.txCounters[TxQid].RetryHistogram[ 5 ],
  819. statistics.txCounters[TxQid].RetryHistogram[ 6 ],
  820. statistics.txCounters[TxQid].RetryHistogram[ 7 ]);
  821. console_printf_terminal(" Retries: %8d %8d %8d %8d %8d %8d %8d %8d\n", 8, 9, 10, 11, 12, 13, 14, 15);
  822. console_printf_terminal(" packets: %8d %8d %8d %8d %8d %8d %8d %8d\n\n",
  823. statistics.txCounters[TxQid].RetryHistogram[ 8 ],
  824. statistics.txCounters[TxQid].RetryHistogram[ 9 ],
  825. statistics.txCounters[TxQid].RetryHistogram[ 10 ],
  826. statistics.txCounters[TxQid].RetryHistogram[ 11 ],
  827. statistics.txCounters[TxQid].RetryHistogram[ 12 ],
  828. statistics.txCounters[TxQid].RetryHistogram[ 13 ],
  829. statistics.txCounters[TxQid].RetryHistogram[ 14 ],
  830. statistics.txCounters[TxQid].RetryHistogram[ 15 ]);
  831. if (statistics.txCounters[TxQid].NumPackets)
  832. {
  833. AverageDelay = statistics.txCounters[TxQid].SumTotalDelayMs / statistics.txCounters[TxQid].NumPackets;
  834. AverageFWDelay = statistics.txCounters[TxQid].SumFWDelayUs / statistics.txCounters[TxQid].NumPackets;
  835. AverageMacDelay = statistics.txCounters[TxQid].SumMacDelayUs / statistics.txCounters[TxQid].NumPackets;
  836. }
  837. else
  838. {
  839. AverageDelay = 0;
  840. AverageFWDelay = 0;
  841. AverageMacDelay = 0;
  842. }
  843. console_printf_terminal(" Total Delay ms (average/sum) : %d / %d\n", AverageDelay, statistics.txCounters[TxQid].SumTotalDelayMs);
  844. console_printf_terminal(" FW Delay us (average/sum) : %d / %d\n", AverageFWDelay, statistics.txCounters[TxQid].SumFWDelayUs);
  845. console_printf_terminal(" MAC Delay us (average/sum) : %d / %d\n\n", AverageMacDelay, statistics.txCounters[TxQid].SumMacDelayUs);
  846. console_printf_terminal(" Delay Ranges [msec] : Num of packets\n");
  847. console_printf_terminal(" ------------------- : --------------\n");
  848. console_printf_terminal(" 0 - 1 : %d\n", statistics.txCounters[TxQid].txDelayHistogram[TX_DELAY_RANGE_0_TO_1] );
  849. console_printf_terminal(" 1 - 10 : %d\n", statistics.txCounters[TxQid].txDelayHistogram[TX_DELAY_RANGE_1_TO_10] );
  850. console_printf_terminal(" 10 - 20 : %d\n", statistics.txCounters[TxQid].txDelayHistogram[TX_DELAY_RANGE_10_TO_20] );
  851. console_printf_terminal(" 20 - 40 : %d\n", statistics.txCounters[TxQid].txDelayHistogram[TX_DELAY_RANGE_20_TO_40] );
  852. console_printf_terminal(" 40 - 60 : %d\n", statistics.txCounters[TxQid].txDelayHistogram[TX_DELAY_RANGE_40_TO_60] );
  853. console_printf_terminal(" 60 - 80 : %d\n", statistics.txCounters[TxQid].txDelayHistogram[TX_DELAY_RANGE_60_TO_80] );
  854. console_printf_terminal(" 80 - 100 : %d\n", statistics.txCounters[TxQid].txDelayHistogram[TX_DELAY_RANGE_80_TO_100] );
  855. console_printf_terminal(" 100 - 200 : %d\n", statistics.txCounters[TxQid].txDelayHistogram[TX_DELAY_RANGE_100_TO_200] );
  856. console_printf_terminal(" Above 200 : %d\n", statistics.txCounters[TxQid].txDelayHistogram[TX_DELAY_RANGE_ABOVE_200] );
  857. }
  858. }
  859. void cmd_show_about(ConParm_t parm[], U16 nParms)
  860. {
  861. TIWLN_VERSION_EX data;
  862. UNUSED(parm);
  863. UNUSED(nParms);
  864. console_printf_terminal("Utility version: %s (%u.%u.%u)\n", SW_VERSION_STR, SW_RELEASE_DAY,
  865. SW_RELEASE_MONTH, SW_RELEASE_YEAR );
  866. if( TI_GetDriverVersion(g_id_adapter, &data ) )
  867. return ;
  868. console_printf_terminal("Driver version: %u.%u.%u.%u.%u\n", data.DrvVersion.major, data.DrvVersion.minor,
  869. data.DrvVersion.bugfix, data.DrvVersion.subld, data.DrvVersion.build );
  870. console_printf_terminal("Firmware version: %u.%u.%u.%u.%u\n", data.FWVersion.major, data.FWVersion.minor,
  871. data.FWVersion.bugfix, data.FWVersion.subld, data.FWVersion.build );
  872. console_printf_terminal("Eeprom Version: %u.%u.%u.%u.%u\n", data.HWVersion.major, data.HWVersion.minor,
  873. data.HWVersion.bugfix, data.HWVersion.subld, data.HWVersion.build );
  874. console_printf_terminal("Eeprom Version2: %u.%u.%u.%u.%u\n", data.NVVersion.major, data.NVVersion.minor,
  875. data.NVVersion.bugfix, data.NVVersion.subld, data.HWVersion.build );
  876. }
  877. void cmd_modify_ssid(ConParm_t parm[], U16 nParms)
  878. {
  879. OS_802_11_SSID ssid = { 0 };
  880. OS_802_11_MAC_ADDRESS bssid = { 0xff,0xff,0xff,0xff,0xff,0xff };
  881. char *ssid_str;
  882. if( nParms == 0 )
  883. {
  884. if(!TI_GetCurrentSSID(g_id_adapter, &ssid))
  885. ssid_str = get_ssid_string(&ssid);
  886. else
  887. ssid_str = "<error>";
  888. console_printf_terminal("SSID: %s\n", ssid_str );
  889. }
  890. else{
  891. /* Setting the new SSID, BRCS BSSID is set to clean pre-set BSSID */
  892. TI_SetBSSID(g_id_adapter, &bssid );
  893. TI_SetSSID(g_id_adapter, (tiUINT8 *) parm[0].value);
  894. }
  895. }
  896. void cmd_modify_channel(ConParm_t parm[], U16 nParms)
  897. {
  898. if( nParms == 0 )
  899. {
  900. tiUINT32 data1 = 0, data = 0;
  901. if( !TI_GetDesiredChannel( g_id_adapter, &data1) )
  902. console_printf_terminal("Channel=%d (desired: %d)\n", !TI_GetCurrentChannel(g_id_adapter, &data) ? data : -1, data1 );
  903. }
  904. else
  905. TI_SetDesiredChannel( g_id_adapter, parm[0].value );
  906. }
  907. void cmd_set_power_mode(ConParm_t parm[], U16 nParms)
  908. {
  909. OS_802_11_POWER_PROFILE mode = 0x12345678;
  910. if( nParms )
  911. TI_ConfigPowerManagement (g_id_adapter, parm[0].value );
  912. else
  913. {
  914. if( !TI_GetPowerMode(g_id_adapter, &mode ) )
  915. {
  916. console_printf_terminal("Power mode: %d\n", mode );
  917. print_available_values(power_mode_val);
  918. }
  919. }
  920. }
  921. void cmd_set_PowerSave_PowerLevel(ConParm_t parm[], U16 nParms)
  922. {
  923. OS_802_11_POWER_LEVELS mode;
  924. if( nParms )
  925. TI_SetPowerLevelPS (g_id_adapter, parm[0].value );
  926. else
  927. {
  928. if( !TI_GetPowerLevelPS(g_id_adapter, &mode ) )
  929. {
  930. console_printf_terminal("Power Level PowerSave: %d\n", mode );
  931. print_available_values(power_level_val);
  932. }
  933. }
  934. }
  935. void cmd_set_Default_PowerLevel(ConParm_t parm[], U16 nParms)
  936. {
  937. OS_802_11_POWER_LEVELS mode;
  938. if( nParms )
  939. TI_SetPowerLevelDefault (g_id_adapter, parm[0].value );
  940. else
  941. {
  942. if( !TI_GetPowerLevelDefault(g_id_adapter, &mode ) )
  943. {
  944. console_printf_terminal("Default Power Level: %d\n", mode );
  945. print_available_values(power_level_val);
  946. }
  947. }
  948. }
  949. void cmd_set_DozeModeInAutoPowerLevel(ConParm_t parm[], U16 nParms)
  950. {
  951. OS_802_11_POWER_PROFILE mode;
  952. if( nParms )
  953. TI_SetPowerLevelDozeMode (g_id_adapter, parm[0].value );
  954. else
  955. {
  956. /* set Short or Long Doze. no use of other parameters */
  957. if( !TI_GetPowerLevelDozeMode(g_id_adapter,&mode ) )
  958. {
  959. console_printf_terminal("Doze Mode in Auto Power Level: SHORT_DOZE - %d LONG_DOZE - %d\n",
  960. OS_POWER_MODE_SHORT_DOZE,OS_POWER_MODE_LONG_DOZE);
  961. }
  962. }
  963. }
  964. void cmd_Beacon_Filter_Set_Desired_State(ConParm_t parm[], U16 nParms)
  965. {
  966. /*there are two modes : feature ACTIVE & PASSIV ( or NOT ACTIVE )*/
  967. if( nParms )
  968. {
  969. TI_SetBeaconFilterDesiredState(g_id_adapter, parm[0].value );
  970. }
  971. else
  972. {
  973. console_printf_terminal("Use : 0 = INACTIVE , 1 = ACTIVE\n" ) ;
  974. }
  975. }
  976. void cmd_Beacon_Filter_Get_Desired_State(ConParm_t parm[], U16 nParms)
  977. {
  978. UINT8 desState = FALSE ;
  979. TI_GetBeaconFilterDesiredState(g_id_adapter, &desState ) ;
  980. console_printf_terminal("Desired State is %s\n", (desState == FALSE)?"FILTER INACTIVE":"FILTER ACTIVE" );
  981. }
  982. /* scan commands (new from eSTAdk 5.0) */
  983. void init_scan_params(void)
  984. {
  985. int i,j;
  986. /* init application scan default params */
  987. appScanParams.desiredSsid.len = 0;
  988. appScanParams.scanType = SCAN_TYPE_NORMAL_ACTIVE;
  989. appScanParams.band = RADIO_BAND_2_4_GHZ;
  990. appScanParams.probeReqNumber = 3;
  991. appScanParams.probeRequestRate = DRV_RATE_MASK_2_BARKER;
  992. appScanParams.numOfChannels = 11;
  993. for ( i = 0; i < 11; i++ )
  994. {
  995. for ( j = 0; j < 6; j++ )
  996. {
  997. appScanParams.channelEntry[ i ].normalChannelEntry.bssId.addr[ j ] = 0xff;
  998. }
  999. appScanParams.channelEntry[ i ].normalChannelEntry.earlyTerminationEvent = SCAN_ET_COND_DISABLE;
  1000. appScanParams.channelEntry[ i ].normalChannelEntry.ETMaxNumOfAPframes = 0;
  1001. appScanParams.channelEntry[ i ].normalChannelEntry.maxChannelDwellTime = 60000;
  1002. appScanParams.channelEntry[ i ].normalChannelEntry.minChannelDwellTime = 30000;
  1003. appScanParams.channelEntry[ i ].normalChannelEntry.txPowerDbm = MAX_TX_POWER;
  1004. appScanParams.channelEntry[ i ].normalChannelEntry.channel = i + 1;
  1005. }
  1006. /* init default scan policy */
  1007. scanPolicy.normalScanInterval = 10000;
  1008. scanPolicy.deterioratingScanInterval = 5000;
  1009. scanPolicy.maxTrackFailures = 3;
  1010. scanPolicy.BSSListSize = 4;
  1011. scanPolicy.BSSNumberToStartDiscovery = 1;
  1012. scanPolicy.numOfBands = 1;
  1013. scanPolicy.bandScanPolicy[ 0 ].band = RADIO_BAND_2_4_GHZ;
  1014. scanPolicy.bandScanPolicy[ 0 ].rxRSSIThreshold = -80;
  1015. scanPolicy.bandScanPolicy[ 0 ].numOfChannles = 11;
  1016. scanPolicy.bandScanPolicy[ 0 ].numOfChannlesForDiscovery = 3;
  1017. for ( i = 0; i < 11; i++ )
  1018. {
  1019. scanPolicy.bandScanPolicy[ 0 ].channelList[ i ] = i + 1;
  1020. }
  1021. scanPolicy.bandScanPolicy[ 0 ].trackingMethod.scanType = SCAN_TYPE_NORMAL_ACTIVE;
  1022. scanPolicy.bandScanPolicy[ 0 ].trackingMethod.method.basicMethodParams.earlyTerminationEvent = SCAN_ET_COND_DISABLE;
  1023. scanPolicy.bandScanPolicy[ 0 ].trackingMethod.method.basicMethodParams.ETMaxNumberOfApFrames = 0;
  1024. scanPolicy.bandScanPolicy[ 0 ].trackingMethod.method.basicMethodParams.maxChannelDwellTime = 30000;
  1025. scanPolicy.bandScanPolicy[ 0 ].trackingMethod.method.basicMethodParams.minChannelDwellTime = 15000;
  1026. scanPolicy.bandScanPolicy[ 0 ].trackingMethod.method.basicMethodParams.probReqParams.bitrate = DRV_RATE_MASK_1_BARKER;
  1027. scanPolicy.bandScanPolicy[ 0 ].trackingMethod.method.basicMethodParams.probReqParams.numOfProbeReqs = 3;
  1028. scanPolicy.bandScanPolicy[ 0 ].trackingMethod.method.basicMethodParams.probReqParams.txPowerDbm = MAX_TX_POWER;
  1029. scanPolicy.bandScanPolicy[ 0 ].discoveryMethod.scanType = SCAN_TYPE_NORMAL_ACTIVE;
  1030. scanPolicy.bandScanPolicy[ 0 ].discoveryMethod.method.basicMethodParams.earlyTerminationEvent = SCAN_ET_COND_DISABLE;
  1031. scanPolicy.bandScanPolicy[ 0 ].discoveryMethod.method.basicMethodParams.ETMaxNumberOfApFrames = 0;
  1032. scanPolicy.bandScanPolicy[ 0 ].discoveryMethod.method.basicMethodParams.maxChannelDwellTime = 30000;
  1033. scanPolicy.bandScanPolicy[ 0 ].discoveryMethod.method.basicMethodParams.minChannelDwellTime = 15000;
  1034. scanPolicy.bandScanPolicy[ 0 ].discoveryMethod.method.basicMethodParams.probReqParams.bitrate = DRV_RATE_MASK_2_BARKER;
  1035. scanPolicy.bandScanPolicy[ 0 ].discoveryMethod.method.basicMethodParams.probReqParams.numOfProbeReqs = 3;
  1036. scanPolicy.bandScanPolicy[ 0 ].discoveryMethod.method.basicMethodParams.probReqParams.txPowerDbm = MAX_TX_POWER;
  1037. scanPolicy.bandScanPolicy[ 0 ].immediateScanMethod.scanType = SCAN_TYPE_NORMAL_ACTIVE;
  1038. scanPolicy.bandScanPolicy[ 0 ].immediateScanMethod.method.basicMethodParams.earlyTerminationEvent = SCAN_ET_COND_DISABLE;
  1039. scanPolicy.bandScanPolicy[ 0 ].immediateScanMethod.method.basicMethodParams.ETMaxNumberOfApFrames = 0;
  1040. scanPolicy.bandScanPolicy[ 0 ].immediateScanMethod.method.basicMethodParams.maxChannelDwellTime = 30000;
  1041. scanPolicy.bandScanPolicy[ 0 ].immediateScanMethod.method.basicMethodParams.minChannelDwellTime = 15000;
  1042. scanPolicy.bandScanPolicy[ 0 ].immediateScanMethod.method.basicMethodParams.probReqParams.bitrate = DRV_RATE_MASK_5_5_CCK;
  1043. scanPolicy.bandScanPolicy[ 0 ].immediateScanMethod.method.basicMethodParams.probReqParams.numOfProbeReqs = 3;
  1044. scanPolicy.bandScanPolicy[ 0 ].immediateScanMethod.method.basicMethodParams.probReqParams.txPowerDbm = MAX_TX_POWER;
  1045. }
  1046. void cmd_Scan_Start(ConParm_t parm[], U16 nParms)
  1047. {
  1048. TI_StartScan( g_id_adapter, &appScanParams );
  1049. console_printf_terminal("Application scan started.\n");
  1050. }
  1051. void cmd_Scan_Stop(ConParm_t parm[], U16 nParms)
  1052. {
  1053. TI_StopScan( g_id_adapter );
  1054. console_printf_terminal("Application scan stopped.\n");
  1055. }
  1056. void cmd_Scan_app_global_config(ConParm_t parm[], U16 nParms)
  1057. {
  1058. if ( 0 == strcmp( "<empty>", (char*)parm[0].value) )
  1059. {
  1060. appScanParams.desiredSsid.len = 0;
  1061. appScanParams.desiredSsid.ssidString[ 0 ] = '\0';
  1062. }
  1063. else
  1064. {
  1065. appScanParams.desiredSsid.len = strlen((char*)parm[0].value);
  1066. memcpy( &(appScanParams.desiredSsid.ssidString), (char*)parm[0].value, appScanParams.desiredSsid.len );
  1067. }
  1068. appScanParams.scanType = parm[1].value;
  1069. appScanParams.band = parm[2].value;
  1070. appScanParams.probeReqNumber = (UINT8)parm[3].value;
  1071. appScanParams.probeRequestRate = parm[4].value;
  1072. #ifdef TI_DBG
  1073. appScanParams.Tid = (UINT8)parm[5].value;
  1074. appScanParams.numOfChannels = (UINT8)parm[6].value;
  1075. #else
  1076. appScanParams.Tid = 0;
  1077. appScanParams.numOfChannels = (UINT8)parm[5].value;
  1078. #endif
  1079. }
  1080. void cmd_Scan_app_channel_config(ConParm_t parm[], U16 nParms)
  1081. {
  1082. scan_normalChannelEntry_t* pChannelEntry =
  1083. &(appScanParams.channelEntry[ parm[0].value ].normalChannelEntry);
  1084. if (parm[2].value < parm[3].value)
  1085. {
  1086. console_printf_terminal ("Max Dwell Time must be larger than or equal to Min Dwell Time...\n");
  1087. return;
  1088. }
  1089. hexStr2MACAddr( (char*)parm[1].value, &(pChannelEntry->bssId) );
  1090. pChannelEntry->maxChannelDwellTime = parm[2].value;
  1091. pChannelEntry->minChannelDwellTime = parm[3].value;
  1092. pChannelEntry->earlyTerminationEvent = parm[4].value;
  1093. pChannelEntry->ETMaxNumOfAPframes = (UINT8)parm[5].value;
  1094. pChannelEntry->txPowerDbm = (UINT8)parm[6].value;
  1095. pChannelEntry->channel = (UINT8)parm[7].value;
  1096. }
  1097. void cmd_Scan_app_clear(ConParm_t parm[], U16 nParms)
  1098. {
  1099. memset( &appScanParams, 0, sizeof(scan_Params_t) );
  1100. console_printf_terminal("Application scan parameters cleared.\n");
  1101. }
  1102. void cmd_Scan_app_display(ConParm_t parm[], U16 nParms)
  1103. {
  1104. int i;
  1105. scan_normalChannelEntry_t* pNormalChannel;
  1106. char bssId[18];
  1107. bssId[17] = '\0';
  1108. console_printf_terminal("Application Scan params:\n");
  1109. console_printf_terminal("SSID: %s, Type: %s\n", appScanParams.desiredSsid.ssidString, scanType2Str[ appScanParams.scanType ].name);
  1110. console_printf_terminal("Band: %s, Number of probe req:%d, probe req. rate:%s\n",
  1111. band2Str[ appScanParams.band ].name, appScanParams.probeReqNumber, rate2StrFunc( appScanParams.probeRequestRate ) );
  1112. #ifdef TI_DBG
  1113. console_printf_terminal("Tid :%d\n\n", appScanParams.Tid);
  1114. #else
  1115. console_printf_terminal("\n");
  1116. #endif
  1117. console_printf_terminal("Channel BSS ID Max time Min time ET event ET frame num Power\n");
  1118. console_printf_terminal("-------------------------------------------------------------------------------\n");
  1119. for ( i = 0; i < appScanParams.numOfChannels; i++ )
  1120. {
  1121. pNormalChannel = &(appScanParams.channelEntry[ i ].normalChannelEntry);
  1122. mac2HexStr( &(pNormalChannel->bssId), bssId );
  1123. console_printf_terminal ("%2d %s %7d %7d %s%3d %1d\n",
  1124. pNormalChannel->channel, bssId, pNormalChannel->maxChannelDwellTime,
  1125. pNormalChannel->minChannelDwellTime, EtEvent2StrFunc( pNormalChannel->earlyTerminationEvent ),
  1126. pNormalChannel->ETMaxNumOfAPframes, pNormalChannel->txPowerDbm);
  1127. }
  1128. console_printf_terminal("\n");
  1129. }
  1130. void cmd_Scan_policy_global_config(ConParm_t parm[], U16 nParms)
  1131. {
  1132. scanPolicy.normalScanInterval = parm[ 0 ].value;
  1133. scanPolicy.deterioratingScanInterval = parm[ 1 ].value;
  1134. scanPolicy.maxTrackFailures = (UINT8)(parm[ 2 ].value);
  1135. scanPolicy.BSSListSize = (UINT8)(parm[ 3 ].value);
  1136. scanPolicy.BSSNumberToStartDiscovery = (UINT8)(parm[ 4 ].value);
  1137. scanPolicy.numOfBands = (UINT8)(parm[ 5 ].value);
  1138. }
  1139. void cmd_Scan_band_global_config(ConParm_t parm[], U16 nParms)
  1140. {
  1141. scan_bandPolicy_t* bandPolicy = &(scanPolicy.bandScanPolicy[ parm [ 0 ].value ]);
  1142. bandPolicy->band = parm[ 1 ].value;
  1143. bandPolicy->rxRSSIThreshold = (S8)(parm[ 2 ].value);
  1144. bandPolicy->numOfChannlesForDiscovery = (UINT8)(parm[ 3 ].value);
  1145. bandPolicy->numOfChannles = (UINT8)(parm[ 4 ].value);
  1146. }
  1147. void cmd_Scan_band_channel_config(ConParm_t parm[], U16 nParms)
  1148. {
  1149. scan_bandPolicy_t* bandPolicy = &(scanPolicy.bandScanPolicy[ parm [ 0 ].value ]);
  1150. bandPolicy->channelList[ parm[ 1 ].value ] = (UINT8)(parm[ 2 ].value);
  1151. }
  1152. void cmd_Scan_band_track_config(ConParm_t parm[], U16 nParms)
  1153. {
  1154. scan_bandPolicy_t* bandPolicy = &(scanPolicy.bandScanPolicy[ parm [ 0 ].value ]);
  1155. if (parm[6].value < parm[7].value)
  1156. {
  1157. console_printf_terminal ("Max Dwell Time must be larger than or equal to Min Dwell Time...\n");
  1158. return;
  1159. }
  1160. bandPolicy->trackingMethod.scanType = parm[ 1 ].value;
  1161. switch (bandPolicy->trackingMethod.scanType)
  1162. {
  1163. case SCAN_TYPE_NORMAL_ACTIVE:
  1164. case SCAN_TYPE_NORMAL_PASSIVE:
  1165. bandPolicy->trackingMethod.method.basicMethodParams.maxChannelDwellTime = (parm[ 6 ].value);
  1166. bandPolicy->trackingMethod.method.basicMethodParams.minChannelDwellTime = (parm[ 7 ].value);
  1167. bandPolicy->trackingMethod.method.basicMethodParams.earlyTerminationEvent = parm[ 2 ].value;
  1168. bandPolicy->trackingMethod.method.basicMethodParams.ETMaxNumberOfApFrames = (UINT8)(parm[ 3 ].value);
  1169. bandPolicy->trackingMethod.method.basicMethodParams.probReqParams.bitrate = parm[ 9 ].value;
  1170. bandPolicy->trackingMethod.method.basicMethodParams.probReqParams.numOfProbeReqs = (UINT8)(parm[ 8 ].value);
  1171. bandPolicy->trackingMethod.method.basicMethodParams.probReqParams.txPowerDbm = (UINT8)(parm[ 10 ].value);
  1172. break;
  1173. case SCAN_TYPE_TRIGGERED_ACTIVE:
  1174. case SCAN_TYPE_TRIGGERED_PASSIVE:
  1175. /* Check if valid TID */
  1176. if (((parm[ 4 ].value) > 7) && ((parm[ 4 ].value) != 255))
  1177. {
  1178. console_printf_terminal ("ERROR Tid (AC) should be 0..7 or 255 instead = %d (using default = 255)\n",(parm[ 4 ].value));
  1179. parm[ 4 ].value = 255;
  1180. }
  1181. bandPolicy->trackingMethod.method.TidTriggerdMethodParams.triggeringTid = (UINT8)(parm[ 4 ].value);
  1182. bandPolicy->trackingMethod.method.TidTriggerdMethodParams.basicMethodParams.maxChannelDwellTime = (parm[ 6 ].value);
  1183. bandPolicy->trackingMethod.method.TidTriggerdMethodParams.basicMethodParams.minChannelDwellTime = (parm[ 7 ].value);
  1184. bandPolicy->trackingMethod.method.TidTriggerdMethodParams.basicMethodParams.earlyTerminationEvent = parm[ 2 ].value;
  1185. bandPolicy->trackingMethod.method.TidTriggerdMethodParams.basicMethodParams.ETMaxNumberOfApFrames = (UINT8)(parm[ 3 ].value);
  1186. bandPolicy->trackingMethod.method.TidTriggerdMethodParams.basicMethodParams.probReqParams.bitrate = parm[ 9 ].value;
  1187. bandPolicy->trackingMethod.method.TidTriggerdMethodParams.basicMethodParams.probReqParams.numOfProbeReqs = (UINT8)(parm[ 8 ].value);
  1188. bandPolicy->trackingMethod.method.TidTriggerdMethodParams.basicMethodParams.probReqParams.txPowerDbm = (UINT8)(parm[ 10 ].value);
  1189. break;
  1190. case SCAN_TYPE_SPS:
  1191. bandPolicy->trackingMethod.method.spsMethodParams.earlyTerminationEvent = parm[ 2 ].value;
  1192. bandPolicy->trackingMethod.method.spsMethodParams.ETMaxNumberOfApFrames = (UINT8)(parm[ 3 ].value);
  1193. bandPolicy->trackingMethod.method.spsMethodParams.scanDuration = parm[ 5 ].value;
  1194. break;
  1195. default:
  1196. bandPolicy->trackingMethod.scanType = SCAN_TYPE_NO_SCAN;
  1197. break;
  1198. }
  1199. }
  1200. void cmd_Scan_band_discover_config(ConParm_t parm[], U16 nParms)
  1201. {
  1202. scan_bandPolicy_t* bandPolicy = &(scanPolicy.bandScanPolicy[ parm [ 0 ].value ]);
  1203. if (parm[6].value < parm[7].value)
  1204. {
  1205. console_printf_terminal ("Max Dwell Time must be larger than or equal to Min Dwell Time...\n");
  1206. return;
  1207. }
  1208. bandPolicy->discoveryMethod.scanType = parm[ 1 ].value;
  1209. switch (bandPolicy->discoveryMethod.scanType)
  1210. {
  1211. case SCAN_TYPE_NORMAL_ACTIVE:
  1212. case SCAN_TYPE_NORMAL_PASSIVE:
  1213. bandPolicy->discoveryMethod.method.basicMethodParams.maxChannelDwellTime = (parm[ 6 ].value);
  1214. bandPolicy->discoveryMethod.method.basicMethodParams.minChannelDwellTime = (parm[ 7 ].value);
  1215. bandPolicy->discoveryMethod.method.basicMethodParams.earlyTerminationEvent = parm[ 2 ].value;
  1216. bandPolicy->discoveryMethod.method.basicMethodParams.ETMaxNumberOfApFrames = (UINT8)(parm[ 3 ].value);
  1217. bandPolicy->discoveryMethod.method.basicMethodParams.probReqParams.bitrate = parm[ 9 ].value;
  1218. bandPolicy->discoveryMethod.method.basicMethodParams.probReqParams.numOfProbeReqs = (UINT8)(parm[ 8 ].value);
  1219. bandPolicy->discoveryMethod.method.basicMethodParams.probReqParams.txPowerDbm = (UINT8)(parm[ 10 ].value);
  1220. break;
  1221. case SCAN_TYPE_TRIGGERED_ACTIVE:
  1222. case SCAN_TYPE_TRIGGERED_PASSIVE:
  1223. /* Check if valid TID */
  1224. if (((parm[ 4 ].value) > 7) && ((parm[ 4 ].value) != 255))
  1225. {
  1226. console_printf_terminal ("ERROR Tid (AC) should be 0..7 or 255 instead = %d (using default = 255)\n",(parm[ 4 ].value));
  1227. parm[ 4 ].value = 255;
  1228. }
  1229. bandPolicy->discoveryMethod.method.TidTriggerdMethodParams.triggeringTid = (UINT8)(parm[ 4 ].value);
  1230. bandPolicy->discoveryMethod.method.TidTriggerdMethodParams.basicMethodParams.maxChannelDwellTime = (parm[ 6 ].value);
  1231. bandPolicy->discoveryMethod.method.TidTriggerdMethodParams.basicMethodParams.minChannelDwellTime = (parm[ 7 ].value);
  1232. bandPolicy->discoveryMethod.method.TidTriggerdMethodParams.basicMethodParams.earlyTerminationEvent = parm[ 2 ].value;
  1233. bandPolicy->discoveryMethod.method.TidTriggerdMethodParams.basicMethodParams.ETMaxNumberOfApFrames = (UINT8)(parm[ 3 ].value);
  1234. bandPolicy->discoveryMethod.method.TidTriggerdMethodParams.basicMethodParams.probReqParams.bitrate = parm[ 9 ].value;
  1235. bandPolicy->discoveryMethod.method.TidTriggerdMethodParams.basicMethodParams.probReqParams.numOfProbeReqs = (UINT8)(parm[ 8 ].value);
  1236. bandPolicy->discoveryMethod.method.TidTriggerdMethodParams.basicMethodParams.probReqParams.txPowerDbm = (UINT8)(parm[ 10 ].value);
  1237. break;
  1238. case SCAN_TYPE_SPS:
  1239. bandPolicy->discoveryMethod.method.spsMethodParams.earlyTerminationEvent = parm[ 2 ].value;
  1240. bandPolicy->discoveryMethod.method.spsMethodParams.ETMaxNumberOfApFrames = (UINT8)(parm[ 3 ].value);
  1241. bandPolicy->discoveryMethod.method.spsMethodParams.scanDuration = parm[ 5 ].value;
  1242. break;
  1243. default:
  1244. bandPolicy->discoveryMethod.scanType = SCAN_TYPE_NO_SCAN;
  1245. break;
  1246. }
  1247. }
  1248. void cmd_Scan_band_immed_config(ConParm_t parm[], U16 nParms)
  1249. {
  1250. scan_bandPolicy_t* bandPolicy = &(scanPolicy.bandScanPolicy[ parm [ 0 ].value ]);
  1251. if (parm[6].value < parm[7].value)
  1252. {
  1253. console_printf_terminal ("Max Dwell Time must be larger than or equal to Min Dwell Time...\n");
  1254. return;
  1255. }
  1256. bandPolicy->immediateScanMethod.scanType = parm[ 1 ].value;
  1257. switch (bandPolicy->immediateScanMethod.scanType)
  1258. {
  1259. case SCAN_TYPE_NORMAL_ACTIVE:
  1260. case SCAN_TYPE_NORMAL_PASSIVE:
  1261. bandPolicy->immediateScanMethod.method.basicMethodParams.maxChannelDwellTime = (parm[ 6 ].value);
  1262. bandPolicy->immediateScanMethod.method.basicMethodParams.minChannelDwellTime = (parm[ 7 ].value);
  1263. bandPolicy->immediateScanMethod.method.basicMethodParams.earlyTerminationEvent = parm[ 2 ].value;
  1264. bandPolicy->immediateScanMethod.method.basicMethodParams.ETMaxNumberOfApFrames = (UINT8)(parm[ 3 ].value);
  1265. bandPolicy->immediateScanMethod.method.basicMethodParams.probReqParams.bitrate = parm[ 9 ].value;
  1266. bandPolicy->immediateScanMethod.method.basicMethodParams.probReqParams.numOfProbeReqs = (UINT8)(parm[ 8 ].value);
  1267. bandPolicy->immediateScanMethod.method.basicMethodParams.probReqParams.txPowerDbm = (UINT8)(parm[ 10 ].value);
  1268. break;
  1269. case SCAN_TYPE_TRIGGERED_ACTIVE:
  1270. case SCAN_TYPE_TRIGGERED_PASSIVE:
  1271. /* Check if valid TID */
  1272. if (((parm[ 4 ].value) > 7) && ((parm[ 4 ].value) != 255))
  1273. {
  1274. console_printf_terminal ("ERROR Tid (AC) should be 0..7 or 255 instead = %d (using default = 255)\n",(parm[ 4 ].value));
  1275. parm[ 4 ].value = 255;
  1276. }
  1277. bandPolicy->immediateScanMethod.method.TidTriggerdMethodParams.triggeringTid = (UINT8)(parm[ 4 ].value);
  1278. bandPolicy->immediateScanMethod.method.TidTriggerdMethodParams.basicMethodParams.maxChannelDwellTime = (parm[ 6 ].value);
  1279. bandPolicy->immediateScanMethod.method.TidTriggerdMethodParams.basicMethodParams.minChannelDwellTime = (parm[ 7 ].value);
  1280. bandPolicy->immediateScanMethod.method.TidTriggerdMethodParams.basicMethodParams.earlyTerminationEvent = parm[ 2 ].value;
  1281. bandPolicy->immediateScanMethod.method.TidTriggerdMethodParams.basicMethodParams.ETMaxNumberOfApFrames = (UINT8)(parm[ 3 ].value);
  1282. bandPolicy->immediateScanMethod.method.TidTriggerdMethodParams.basicMethodParams.probReqParams.bitrate = parm[ 9 ].value;
  1283. bandPolicy->immediateScanMethod.method.TidTriggerdMethodParams.basicMethodParams.probReqParams.numOfProbeReqs = (UINT8)(parm[ 8 ].value);
  1284. bandPolicy->immediateScanMethod.method.TidTriggerdMethodParams.basicMethodParams.probReqParams.txPowerDbm = (UINT8)(parm[ 10 ].value);
  1285. break;
  1286. case SCAN_TYPE_SPS:
  1287. bandPolicy->immediateScanMethod.method.spsMethodParams.earlyTerminationEvent = parm[ 2 ].value;
  1288. bandPolicy->immediateScanMethod.method.spsMethodParams.ETMaxNumberOfApFrames = (UINT8)(parm[ 3 ].value);
  1289. bandPolicy->immediateScanMethod.method.spsMethodParams.scanDuration = parm[ 5 ].value;
  1290. break;
  1291. default:
  1292. bandPolicy->immediateScanMethod.scanType = SCAN_TYPE_NO_SCAN;
  1293. break;
  1294. }
  1295. }
  1296. void cmd_Scan_policy_display(ConParm_t parm[], U16 nParms)
  1297. {
  1298. int i;
  1299. console_printf_terminal("Scan Policy:\n");
  1300. console_printf_terminal("Normal scan interval: %d, deteriorating scan interval: %d\n",
  1301. scanPolicy.normalScanInterval, scanPolicy.deterioratingScanInterval);
  1302. console_printf_terminal("Max track attempt failures: %d\n", scanPolicy.maxTrackFailures);
  1303. console_printf_terminal("BSS list size: %d, number of BSSes to start discovery: %d\n",
  1304. scanPolicy.BSSListSize, scanPolicy.BSSNumberToStartDiscovery);
  1305. console_printf_terminal("Number of configured bands: %d\n", scanPolicy.numOfBands);
  1306. for ( i = 0; i < scanPolicy.numOfBands; i++ )
  1307. {
  1308. cmd_Scan_print_band( i );
  1309. }
  1310. }
  1311. void cmd_Scan_print_band( int i )
  1312. {
  1313. scan_bandPolicy_t* bandPolicy = &(scanPolicy.bandScanPolicy[ i ]);
  1314. int j;
  1315. console_printf_terminal("\nBand: %s\n", band2Str[ bandPolicy->band ].name);
  1316. console_printf_terminal("RSSI Threshold: %d dBm\n", bandPolicy->rxRSSIThreshold);
  1317. console_printf_terminal("Number of channels for each discovery interval: %d\n", bandPolicy->numOfChannlesForDiscovery);
  1318. console_printf_terminal("\nTracking Method:\n");
  1319. cmd_Scan_print_method( &(bandPolicy->trackingMethod) );
  1320. console_printf_terminal("\nDiscovery Method:\n");
  1321. cmd_Scan_print_method( &(bandPolicy->discoveryMethod) );
  1322. console_printf_terminal("\nImmediate Scan Method:\n");
  1323. cmd_Scan_print_method( &(bandPolicy->immediateScanMethod) );
  1324. if ( bandPolicy->numOfChannles > 0 )
  1325. {
  1326. console_printf_terminal("\nChannel list: ");
  1327. for ( j = 0; j < bandPolicy->numOfChannles; j++ )
  1328. {
  1329. console_printf_terminal("%3d ", bandPolicy->channelList[ j ]);
  1330. }
  1331. console_printf_terminal("\n");
  1332. }
  1333. else
  1334. console_printf_terminal("\nNo channels defined.\n");
  1335. }
  1336. void cmd_Scan_print_method( scan_Method_t* scanMethod )
  1337. {
  1338. console_printf_terminal("Scan type: %s\n", scanType2Str[ scanMethod->scanType ].name);
  1339. switch (scanMethod->scanType)
  1340. {
  1341. case SCAN_TYPE_NORMAL_ACTIVE:
  1342. case SCAN_TYPE_NORMAL_PASSIVE:
  1343. cmd_Scan_print_basic_method( &(scanMethod->method.basicMethodParams) );
  1344. break;
  1345. case SCAN_TYPE_TRIGGERED_ACTIVE:
  1346. case SCAN_TYPE_TRIGGERED_PASSIVE:
  1347. cmd_Scan_print_triggered_method( &(scanMethod->method.TidTriggerdMethodParams) );
  1348. break;
  1349. case SCAN_TYPE_SPS:
  1350. cmd_Scan_print_sps_method( &(scanMethod->method.spsMethodParams) );
  1351. break;
  1352. case SCAN_TYPE_NO_SCAN:
  1353. break;
  1354. }
  1355. }
  1356. void cmd_Scan_print_basic_method( scan_basicMethodParams_t* basicMethodParams )
  1357. {
  1358. console_printf_terminal("Max channel dwell time: %d, Min channel dwell time: %d\n",
  1359. basicMethodParams->maxChannelDwellTime, basicMethodParams->minChannelDwellTime);
  1360. console_printf_terminal("ET condition: %s, ET number of frames: %d\n",
  1361. EtEvent2StrFunc( basicMethodParams->earlyTerminationEvent ), basicMethodParams->ETMaxNumberOfApFrames);
  1362. console_printf_terminal("Probe request number: %d, probe request rate: %s, TX power (Dbm/10): %d\n",
  1363. basicMethodParams->probReqParams.numOfProbeReqs, rate2StrFunc( basicMethodParams->probReqParams.bitrate ),
  1364. basicMethodParams->probReqParams.txPowerDbm);
  1365. }
  1366. void cmd_Scan_print_triggered_method( scan_TidTriggeredMethodParams_t* triggeredMethodParams )
  1367. {
  1368. console_printf_terminal("Triggering Tid: %d\n", triggeredMethodParams->triggeringTid);
  1369. cmd_Scan_print_basic_method( &(triggeredMethodParams->basicMethodParams) );
  1370. }
  1371. void cmd_Scan_print_sps_method( scan_SPSMethodParams_t* spsMethodParams )
  1372. {
  1373. console_printf_terminal("ET condition: %s, ET number of frames: %d\n",
  1374. EtEvent2StrFunc( spsMethodParams->earlyTerminationEvent ), spsMethodParams->ETMaxNumberOfApFrames);
  1375. console_printf_terminal("Scan duration: %d\n", spsMethodParams->scanDuration);
  1376. }
  1377. void cmd_Scan_policy_clear(ConParm_t parm[], U16 nParms)
  1378. {
  1379. memset( &scanPolicy, 0, sizeof(scan_Policy_t) );
  1380. console_printf_terminal("Scan policy cleared.\n");
  1381. }
  1382. void cmd_Scan_policy_store(ConParm_t parm[], U16 nParms)
  1383. {
  1384. TI_SetScanPolicy( g_id_adapter, (UINT8*)&scanPolicy, sizeof(scan_Policy_t) );
  1385. console_printf_terminal("Scan policy stored.\n");
  1386. }
  1387. void cmd_Scan_get_bss_list(ConParm_t parm[], U16 nParms)
  1388. {
  1389. bssList_t list;
  1390. int i;
  1391. /* get list */
  1392. if ( (TI_RESULT_OK != TI_GetScanBssList( g_id_adapter, &list )) || (0 == list.numOfEntries) )
  1393. {
  1394. return;
  1395. }
  1396. /* console_printf_terminal list */
  1397. console_printf_terminal("BSS List:\n");
  1398. console_printf_terminal("%-17s %-7s %-6s %-4s %-10s\n", "BSSID", "Band", "Channel", "RSSI", "Neighbor?");
  1399. console_printf_terminal("-----------------------------------------------------\n");
  1400. for ( i = 0; i < list.numOfEntries; i++ )
  1401. {
  1402. console_printf_terminal( "%s %s %-7d %-4d %s\n",
  1403. print_mac_2_str(list.BSSList[ i ].BSSID.addr), band2Str[ list.BSSList[ i ].band ].name,
  1404. list.BSSList[ i ].channel, list.BSSList[ i ].RSSI,
  1405. (TRUE == list.BSSList[ i ].bNeighborAP ? "Yes" : "No") );
  1406. }
  1407. }
  1408. void cmd_set_dtag_to_ac_mapping_table(ConParm_t parm[], U16 nParms)
  1409. {
  1410. int i;
  1411. acTrfcType_e dtagToAcTable[MAX_NUM_OF_802_1d_TAGS];
  1412. for (i=0; i<MAX_NUM_OF_802_1d_TAGS; i++)
  1413. {
  1414. dtagToAcTable[i] = (UINT32) parm[i].value;
  1415. }
  1416. console_printf_terminal("Input parameters =%d, %d, %d, %d, %d, %d, %d, %d\n",
  1417. (UINT32) parm[0].value,
  1418. (UINT32) parm[1].value,
  1419. (UINT32) parm[2].value,
  1420. (UINT32) parm[3].value,
  1421. (UINT32) parm[4].value,
  1422. (UINT32) parm[5].value,
  1423. (UINT32) parm[6].value,
  1424. (UINT32) parm[7].value);
  1425. if (TI_SetDTagToAcMappingTable(g_id_adapter, dtagToAcTable) == TI_RESULT_OK)
  1426. {
  1427. }
  1428. else
  1429. {
  1430. console_printf_terminal ("Error: could not set tag_ToAcClsfrTable ...\n");
  1431. }
  1432. }
  1433. void cmd_set_vad(ConParm_t parm[], U16 nParms)
  1434. {
  1435. txDataVadTimerParams_t pVadTimer;
  1436. if (0 == nParms) // GET operation
  1437. {
  1438. console_printf_terminal("Set VAD: \n");
  1439. console_printf_terminal(" Parm 0 -- 1: ENABLE; 0: DISABLE\n");
  1440. console_printf_terminal(" Parm 1 -- VAD timer duration in ms for enabling action\n");
  1441. if (TI_GetVAD(g_id_adapter, &pVadTimer) == TI_RESULT_OK)
  1442. {
  1443. console_printf_terminal("Current param values: %d, %d\n",
  1444. pVadTimer.vadTimerEnabled, pVadTimer.vadTimerDuration);
  1445. }
  1446. }
  1447. else
  1448. {
  1449. pVadTimer.vadTimerEnabled = (UINT16) parm[0].value;
  1450. pVadTimer.vadTimerDuration = (UINT16) parm[1].value;
  1451. if (pVadTimer.vadTimerEnabled)
  1452. {
  1453. console_printf_terminal("Enabling VAD timer (cycle = %d ms)\n", pVadTimer.vadTimerDuration);
  1454. }
  1455. else
  1456. {
  1457. console_printf_terminal("Disabling VAD timer\n");
  1458. }
  1459. if (TI_SetVAD(g_id_adapter, &pVadTimer) == TI_RESULT_OK)
  1460. {
  1461. console_printf_terminal("Setting VAD is done\n");
  1462. }
  1463. }
  1464. }
  1465. void cmd_set_qos_params(ConParm_t parm[], U16 nParms)
  1466. {
  1467. OS_802_11_QOS_PARAMS pQosParams;
  1468. pQosParams.acID=parm[0].value;
  1469. pQosParams.MaxLifeTime=parm[1].value;
  1470. pQosParams.VoiceDeliveryProtocol=0;
  1471. pQosParams.PSDeliveryProtocol=0;
  1472. if (nParms == 7) /* If the user has input 7 parameters, it means he gave Voice+PS delivery protocol values */
  1473. {
  1474. pQosParams.VoiceDeliveryProtocol=parm[5].value;
  1475. pQosParams.PSDeliveryProtocol=parm[6].value;
  1476. /* If this QOS config was done for a queue OTHER THAN VO, we will zero the DeliveryProtocolPsPoll parameter and notify the user */
  1477. if ((parm[0].value != 3) && (parm[5].value != 0))
  1478. {
  1479. pQosParams.VoiceDeliveryProtocol = 0;
  1480. console_printf_terminal("Since the acID is not VO, resetting VoiceDeliveryProtocol parameter to PS_NONE\n");
  1481. }
  1482. if ((pQosParams.VoiceDeliveryProtocol == 1) && (pQosParams.PSDeliveryProtocol == 1))
  1483. {
  1484. pQosParams.VoiceDeliveryProtocol = 1;
  1485. pQosParams.PSDeliveryProtocol = 0;
  1486. console_printf_terminal("Since the VoiceDeliveryProtocol is PS_POLL, resetting PSDeliveryProtocol to Legacy\n");
  1487. }
  1488. }
  1489. if (TI_SetQosParameters(g_id_adapter, &pQosParams) == TI_RESULT_OK)
  1490. {
  1491. console_printf_terminal("Sent QOS params to driver...\n AC Number=%d \n MaxLifeTime=%d \n DeliveryProtocolPsPoll = %d\n PSDeliveryProtocol = %d\n",
  1492. pQosParams.acID,
  1493. pQosParams.MaxLifeTime,
  1494. pQosParams.VoiceDeliveryProtocol,
  1495. pQosParams.PSDeliveryProtocol);
  1496. }
  1497. else
  1498. {
  1499. console_printf_terminal ("Error: could not set QOS params...\n");
  1500. }
  1501. }
  1502. void cmd_set_rxTimeOut_params(ConParm_t parm[], U16 nParms)
  1503. {
  1504. OS_802_11_QOS_RX_TIMEOUT_PARAMS rxTimeOut;
  1505. rxTimeOut.psPoll = parm[0].value;
  1506. rxTimeOut.UPSD = parm[1].value;
  1507. if (nParms != 2)
  1508. {
  1509. console_printf_terminal("Please enter Rx Time Out:\n");
  1510. console_printf_terminal("Param 0 - psPoll (0 - 65000)\n");
  1511. console_printf_terminal("Param 1 - UPSD (1 - 65000)\n");
  1512. }
  1513. else
  1514. {
  1515. if (TI_SetQosRxTimeOut(g_id_adapter, &rxTimeOut) == TI_RESULT_OK)
  1516. {
  1517. console_printf_terminal("Sent QOS Rx TimeOut params to driver...\n PsPoll = %d\n UPSD = %d\n",
  1518. rxTimeOut.psPoll,
  1519. rxTimeOut.UPSD);
  1520. }
  1521. else
  1522. {
  1523. console_printf_terminal ("Error: could not set Rx TimeOut..\n");
  1524. }
  1525. }
  1526. }
  1527. void cmd_enable_rx_data_filters(ConParm_t parm[], U16 nParms)
  1528. {
  1529. console_printf_terminal("Enabling Rx data filtering...\n");
  1530. TI_EnableDisableRxDataFilters( g_id_adapter, TRUE );
  1531. }
  1532. void cmd_disable_rx_data_filters(ConParm_t parm[], U16 nParms)
  1533. {
  1534. console_printf_terminal("Disabling Rx data filtering...\n");
  1535. TI_EnableDisableRxDataFilters( g_id_adapter, FALSE );
  1536. }
  1537. void cmd_get_rx_data_filters_statistics(ConParm_t parm[], U16 nParms)
  1538. {
  1539. TIWLAN_DATA_FILTER_STATISTICS statistics;
  1540. console_printf_terminal("Rx data filtering statistics:\n");
  1541. TI_GetRxDataFiltersStatistics( g_id_adapter, &statistics );
  1542. console_printf_terminal("Unmatched packets: %u\n", statistics.UnmatchedPacketsCount);
  1543. console_printf_terminal("Packets matching filter #1: %u\n", statistics.MatchedPacketsCount[0]);
  1544. console_printf_terminal("Packets matching filter #2: %u\n", statistics.MatchedPacketsCount[1]);
  1545. console_printf_terminal("Packets matching filter #3: %u\n", statistics.MatchedPacketsCount[2]);
  1546. console_printf_terminal("Packets matching filter #4: %u\n", statistics.MatchedPacketsCount[3]);
  1547. }
  1548. void cmd_show_power_consumption_stats(ConParm_t parm[])
  1549. {
  1550. PowerConsumptionTimeStat_t statistics;
  1551. TI_GetPowerConsumptionStatistics( g_id_adapter, &statistics );
  1552. console_printf_terminal("\nPower Consumption Statistics:\n");
  1553. console_printf_terminal("-----------------------------\n");
  1554. console_printf_terminal("activeTimeCnt_H: %u\n", statistics.activeTimeCnt_Hi);
  1555. console_printf_terminal("activeTimeCnt_Low: %u\n", statistics.activeTimeCnt_Low);
  1556. console_printf_terminal("elpTimeCnt_Hi: %u\n", statistics.elpTimeCnt_Hi);
  1557. console_printf_terminal("elpTimeCnt_Low: %u\n", statistics.elpTimeCnt_Low);
  1558. console_printf_terminal("powerDownTimeCnt_Hi: %u\n", statistics.powerDownTimeCnt_Hi);
  1559. console_printf_terminal("powerDownTimeCnt_Low: %u\n", statistics.powerDownTimeCnt_Low);
  1560. }
  1561. static void parse_hex_string(char * pString, tiUINT8 * pBuffer, tiUINT8 * Length)
  1562. {
  1563. char ch;
  1564. int iter = 0;
  1565. while ((ch = pString[iter]))
  1566. {
  1567. UINT8 val = ((ch >= '0' && ch <= '9') ? (ch - '0') :
  1568. (ch >= 'A' && ch <= 'F') ? (0xA + ch - 'A') :
  1569. (ch >= 'a' && ch <= 'f') ? (0xA + ch - 'a') : 0);
  1570. /* even indexes go to the lower nibble, odd indexes push them to the */
  1571. /* higher nibble and then go themselves to the lower nibble. */
  1572. if (iter % 2)
  1573. pBuffer[iter / 2] = ((pBuffer[iter / 2] << (BIT_TO_BYTE_FACTOR / 2)) | val);
  1574. else
  1575. pBuffer[iter / 2] = val;
  1576. ++iter;
  1577. }
  1578. /* iter = 0 len = 0, iter = 1 len = 1, iter = 2 len = 1, and so on... */
  1579. *Length = (iter + 1) / 2;
  1580. }
  1581. static void parse_binary_string(char * pString, tiUINT8 * pBuffer, tiUINT8 * Length)
  1582. {
  1583. char ch;
  1584. int iter = 0;
  1585. while ((ch = pString[iter]))
  1586. {
  1587. UINT8 val = (ch == '1' ? 1 : 0);
  1588. if (iter % BIT_TO_BYTE_FACTOR)
  1589. pBuffer[iter / BIT_TO_BYTE_FACTOR] |= (val << (iter % BIT_TO_BYTE_FACTOR));
  1590. else
  1591. pBuffer[iter / BIT_TO_BYTE_FACTOR] = val;
  1592. ++iter;
  1593. }
  1594. /* iter = 0 len = 0, iter = 1 len = 1, iter = 8 len = 1, and so on... */
  1595. *Length = (iter + BIT_TO_BYTE_FACTOR - 1) / BIT_TO_BYTE_FACTOR;
  1596. }
  1597. void cmd_add_rx_data_filter(ConParm_t parm[], U16 nParms)
  1598. {
  1599. tiUINT32 resultCode;
  1600. TIWLAN_DATA_FILTER_REQUEST request;
  1601. char * mask = (char *) parm[1].value;
  1602. char * pattern = (char *) parm[2].value;
  1603. request.Offset = (UINT8) parm[0].value;
  1604. parse_binary_string(mask, request.Mask, &request.MaskLength);
  1605. parse_hex_string(pattern, request.Pattern, &request.PatternLength);
  1606. resultCode = TI_AddRxDataFilter(g_id_adapter, &request);
  1607. console_printf_terminal(resultCode == RX_NO_AVAILABLE_FILTERS ? "Error: There are no available filter slots.\n" :
  1608. resultCode == RX_FILTER_ALREADY_EXISTS ? "Error: Filter already exists.\n" :
  1609. resultCode == NOK ? "Error: Could not add the filter.\n" :
  1610. "Filter added.\n");
  1611. }
  1612. void cmd_remove_rx_data_filter(ConParm_t parm[], U16 nParms)
  1613. {
  1614. tiUINT32 resultCode;
  1615. TIWLAN_DATA_FILTER_REQUEST request;
  1616. char * mask = (char *) parm[1].value;
  1617. char * pattern = (char *) parm[2].value;
  1618. request.Offset = (UINT8) parm[0].value;
  1619. parse_binary_string(mask, request.Mask, &request.MaskLength);
  1620. parse_hex_string(pattern, request.Pattern, &request.PatternLength);
  1621. resultCode = TI_RemoveRxDataFilter(g_id_adapter, &request);
  1622. console_printf_terminal(resultCode == RX_FILTER_DOES_NOT_EXIST ? "Error: Filter was not found.\n" :
  1623. resultCode == NOK ? "Error: Could not remove the filter, removal request must be identical to add request.\n" :
  1624. "Filter removed.\n");
  1625. }
  1626. void cmd_MaxRxLifetime_params(ConParm_t parm[], U16 nParms)
  1627. {
  1628. PLT_MIB_t Mib;
  1629. UINT32 Status;
  1630. memset(&Mib, 0, sizeof(Mib));
  1631. Mib.aMib = PLT_MIB_dot11MaxReceiveLifetime;
  1632. if (nParms != 1)
  1633. {
  1634. console_printf_terminal("Max Rx lifetime: [0 - 4294967295(0xFFFFFFFF)]\n");
  1635. }
  1636. if (nParms == 0) /*Get MaxRxlifetime */
  1637. {
  1638. Status = TI_PLT_ReadMIB(g_id_adapter, &Mib);
  1639. if (OK == Status)
  1640. console_printf_terminal("MaxRxLifetime = %d\n", Mib.aData.MaxReceiveLifeTime);
  1641. }
  1642. else if (nParms == 1)
  1643. {
  1644. Mib.Length = sizeof(Mib.aData.MaxReceiveLifeTime);
  1645. Mib.aData.MaxReceiveLifeTime = parm[0].value;
  1646. if (OK != TI_PLT_WriteMIB(g_id_adapter, &Mib))
  1647. console_printf_terminal("TI_PLT_WriteMIB failed\n");
  1648. }
  1649. }
  1650. void cmd_add_tspec(ConParm_t parm[], U16 nParms)
  1651. {
  1652. OS_802_11_QOS_TSPEC_PARAMS pTspecParams;
  1653. tiUINT32 resultCode;
  1654. pTspecParams.uUserPriority = parm[0].value;
  1655. pTspecParams.uNominalMSDUsize = parm[1].value;
  1656. pTspecParams.uMeanDataRate = parm[2].value;
  1657. pTspecParams.uMinimumPHYRate = parm[3].value * 1000 * 1000;
  1658. pTspecParams.uSurplusBandwidthAllowance = parm[4].value << 13;
  1659. pTspecParams.uAPSDFlag = parm[5].value;
  1660. resultCode = TI_AddTspec (g_id_adapter,&pTspecParams);
  1661. switch (resultCode)
  1662. {
  1663. case OK:
  1664. console_printf_terminal ("TSpec request sent to driver...\n uUserPriority = %d\n uNominalMSDUsize = %d\n uMeanDataRate = %d\n uMinimumPHYRate = %d\n uSurplusBandwidthAllowance = %d\n uAPSDFlag = %d\n",
  1665. parm[0].value,
  1666. parm[1].value,
  1667. parm[2].value,
  1668. parm[3].value,
  1669. parm[4].value,
  1670. parm[5].value);
  1671. break;
  1672. case TRAFIC_ADM_PENDING:
  1673. console_printf_terminal ("Driver is still waiting for a response of previous request...\n");
  1674. break;
  1675. case AC_ALREADY_IN_USE:
  1676. console_printf_terminal ("Other user priority from the same AC has already used a TSPEC...\n");
  1677. break;
  1678. case NOT_CONNECTED:
  1679. console_printf_terminal ("Not connected to an AP...\n");
  1680. break;
  1681. case NO_QOS_AP:
  1682. console_printf_terminal ("AP does not support QOS...\n");
  1683. break;
  1684. case NOK:
  1685. console_printf_terminal ("Invalid parameter...\n");
  1686. break;
  1687. default:
  1688. console_printf_terminal ("Unknown return value...\n");
  1689. break;
  1690. }
  1691. return;
  1692. }
  1693. void cmd_get_tspec_params(ConParm_t parm[], U16 nParms)
  1694. {
  1695. OS_802_11_QOS_TSPEC_PARAMS pTspecParams;
  1696. tiUINT32 resultCode;
  1697. pTspecParams.uUserPriority = parm[0].value;
  1698. resultCode = TI_GetTspecParameters(g_id_adapter, &pTspecParams);
  1699. switch (resultCode)
  1700. {
  1701. case OK:
  1702. console_printf_terminal ("TSpec parameters retrieved:\nuUserPriority = %d\nuNominalMSDUsize = %d\nuMeanDataRate = %d\nuMinimumPHYRate = %d\nuSurplusBandwidthAllowance = %d\nuUAPSD_Flag = %d\nuMediumTime = %d\n",
  1703. pTspecParams.uUserPriority,
  1704. pTspecParams.uNominalMSDUsize,
  1705. pTspecParams.uMeanDataRate,
  1706. pTspecParams.uMinimumPHYRate,
  1707. pTspecParams.uSurplusBandwidthAllowance,
  1708. pTspecParams.uAPSDFlag,
  1709. pTspecParams.uMediumTime);
  1710. break;
  1711. case USER_PRIORITY_NOT_ADMITTED:
  1712. console_printf_terminal ("User Priority is not admitted...\n");
  1713. break;
  1714. case NOT_CONNECTED:
  1715. console_printf_terminal ("Not connected to an AP...\n");
  1716. break;
  1717. case NO_QOS_AP:
  1718. console_printf_terminal ("AP does not support QOS...\n");
  1719. break;
  1720. case NOK:
  1721. console_printf_terminal ("Invalid parameter...\n");
  1722. break;
  1723. default:
  1724. console_printf_terminal ("Unknown return value...\n");
  1725. break;
  1726. }
  1727. return;
  1728. }
  1729. void cmd_delete_tspec(ConParm_t parm[], U16 nParms)
  1730. {
  1731. OS_802_11_QOS_DELETE_TSPEC_PARAMS pDelTspecParams;
  1732. tiUINT32 resultCode;
  1733. pDelTspecParams.uUserPriority = parm[0].value;
  1734. pDelTspecParams.uReasonCode = parm[1].value;
  1735. resultCode = TI_DeleteTspec(g_id_adapter, &pDelTspecParams);
  1736. switch (resultCode)
  1737. {
  1738. case OK:
  1739. console_printf_terminal ("TSPEC Delete request sent to driver...\n uUserPriority = %d\n uReasonCode = %d\n",
  1740. pDelTspecParams.uUserPriority,
  1741. pDelTspecParams.uReasonCode);
  1742. break;
  1743. case NOT_CONNECTED:
  1744. console_printf_terminal ("Not connected to an AP...\n");
  1745. break;
  1746. case NO_QOS_AP:
  1747. console_printf_terminal ("AP does not support QOS...\n");
  1748. break;
  1749. case NOK:
  1750. console_printf_terminal ("Invalid parameter...\n");
  1751. break;
  1752. default:
  1753. console_printf_terminal ("Unknown return value...\n");
  1754. break;
  1755. }
  1756. }
  1757. void cmd_get_ap_qos_params(ConParm_t parm[], U16 nParms)
  1758. {
  1759. OS_802_11_AC_QOS_PARAMS pACQosParams;
  1760. int i = 0;
  1761. tiUINT32 resultCode;
  1762. pACQosParams.uAC = i;
  1763. /* Read AC 0 parameters - just to check if connected to QOS AP etc */
  1764. resultCode = TI_GetAPQosParameters(g_id_adapter, &pACQosParams);
  1765. switch (resultCode)
  1766. {
  1767. case OK:
  1768. console_printf_terminal ("AP QOS Parameters:\n");
  1769. console_printf_terminal ("+----+-------------+----------+-----------+-----------+-----------+\n");
  1770. console_printf_terminal ("| AC | AdmCtrlFlag | AIFS | CwMin | CwMax | TXOPLimit |\n");
  1771. console_printf_terminal ("+----+-------------+----------+-----------+-----------+-----------+\n");
  1772. for (i=0; i<4; i++)
  1773. {
  1774. pACQosParams.uAC = i;
  1775. resultCode = TI_GetAPQosParameters(g_id_adapter, &pACQosParams);
  1776. console_printf_terminal ("| %2d | %11d | %8d | %9d | %9d | %9d |\n",i,
  1777. pACQosParams.uAssocAdmissionCtrlFlag,
  1778. pACQosParams.uAIFS,
  1779. pACQosParams.uCwMin,
  1780. pACQosParams.uCwMax,
  1781. pACQosParams.uTXOPLimit);
  1782. }
  1783. console_printf_terminal ("+----+-------------+----------+-----------+-----------+-----------+\n");
  1784. break;
  1785. case NOT_CONNECTED:
  1786. console_printf_terminal ("Not connected to an AP...\n");
  1787. break;
  1788. case NO_QOS_AP:
  1789. console_printf_terminal ("AP does not support QOS...\n");
  1790. break;
  1791. case NOK:
  1792. console_printf_terminal ("Invalid parameter...\n");
  1793. break;
  1794. default:
  1795. console_printf_terminal ("Unknown return value...\n");
  1796. break;
  1797. }
  1798. }
  1799. void cmd_get_ap_qos_capabilities(ConParm_t parm[], U16 nParms)
  1800. {
  1801. OS_802_11_AP_QOS_CAPABILITIES_PARAMS pAPQosCapabiltiesParams;
  1802. tiUINT32 resultCode;
  1803. resultCode = TI_GetAPQosCapabilitesParameters(g_id_adapter, &pAPQosCapabiltiesParams);
  1804. switch (resultCode)
  1805. {
  1806. case TI_RESULT_OK:
  1807. console_printf_terminal ("AP Qos Capabilities:\n QOSFlag = %d\n APSDFlag = %d\n",pAPQosCapabiltiesParams.uQOSFlag,pAPQosCapabiltiesParams.uAPSDFlag);
  1808. break;
  1809. case NOT_CONNECTED:
  1810. console_printf_terminal ("Not connected to an AP...\n");
  1811. break;
  1812. case NO_QOS_AP:
  1813. console_printf_terminal ("AP does not support QOS...\n");
  1814. break;
  1815. default:
  1816. console_printf_terminal ("Unknown return value...\n");
  1817. break;
  1818. }
  1819. return;
  1820. }
  1821. void cmd_get_ac_status(ConParm_t parm[], U16 nParms)
  1822. {
  1823. OS_802_11_AC_UPSD_STATUS_PARAMS pAcStatusParams;
  1824. tiUINT32 resultCode;
  1825. pAcStatusParams.uAC = parm[0].value;
  1826. resultCode = TI_GetCurrentACStatus(g_id_adapter, &pAcStatusParams);
  1827. switch (resultCode)
  1828. {
  1829. case TI_RESULT_OK:
  1830. console_printf_terminal ("AC %d Status:\nCurrentUAPSDStatus = %d (0=PS_POLL,1=UPSD,2=PS_NONE)\nCurrentAdmissionStatus = %d(0=NOT_ADMITED,1=WAIT,2=ADMITED)\n",
  1831. pAcStatusParams.uAC,
  1832. pAcStatusParams.uCurrentUAPSDStatus,
  1833. pAcStatusParams.pCurrentAdmissionStatus);
  1834. break;
  1835. case NOT_CONNECTED:
  1836. console_printf_terminal ("Not connected to an AP...\n");
  1837. break;
  1838. case NO_QOS_AP:
  1839. console_printf_terminal ("AP does not support QOS...\n");
  1840. break;
  1841. case NOK:
  1842. console_printf_terminal ("Invalid parameters...\n");
  1843. break;
  1844. default:
  1845. console_printf_terminal ("Unknown return value...\n");
  1846. break;
  1847. }
  1848. }
  1849. void cmd_get_desired_ps_mode(ConParm_t parm[], U16 nParms)
  1850. {
  1851. OS_802_11_QOS_DESIRED_PS_MODE pDesiredPsMode;
  1852. tiUINT32 resultCode;
  1853. resultCode = TI_GetDesiredPsMode(g_id_adapter, &pDesiredPsMode);
  1854. switch (resultCode)
  1855. {
  1856. case TI_RESULT_OK:
  1857. console_printf_terminal ("\n\
  1858. Desired PS Mode (0=PS_POLL, 1=UPSD, 2=PS_NONE):\n\
  1859. ===============================================\n\
  1860. General Desired Ps Mode = %d\n\
  1861. BE_AC Desired Ps Mode = %d\n\
  1862. BK_AC Desired Ps Mode = %d\n\
  1863. VI_AC Desired Ps Mode = %d\n\
  1864. VO_AC Desired Ps Mode = %d\n",
  1865. pDesiredPsMode.uDesiredPsMode,
  1866. pDesiredPsMode.uDesiredWmeAcPsMode[QOS_AC_BE],
  1867. pDesiredPsMode.uDesiredWmeAcPsMode[QOS_AC_BK],
  1868. pDesiredPsMode.uDesiredWmeAcPsMode[QOS_AC_VI],
  1869. pDesiredPsMode.uDesiredWmeAcPsMode[QOS_AC_VO]);
  1870. break;
  1871. case NOK:
  1872. console_printf_terminal ("Invalid parameters...\n");
  1873. break;
  1874. default:
  1875. console_printf_terminal ("Unknown return value...\n");
  1876. break;
  1877. }
  1878. }
  1879. void cmd_medium_usage_threshold(ConParm_t parm[], U16 nParms)
  1880. {
  1881. OS_802_11_THRESHOLD_CROSS_PARAMS pThresholdCrossParams;
  1882. tiUINT32 resultCode;
  1883. if (nParms == 3) /* If user supplied 3 parameters - this is a SET operation */
  1884. {
  1885. pThresholdCrossParams.uAC = parm[0].value;
  1886. pThresholdCrossParams.uHighThreshold = parm[1].value;
  1887. pThresholdCrossParams.uLowThreshold = parm[2].value;
  1888. if (pThresholdCrossParams.uLowThreshold > pThresholdCrossParams.uHighThreshold)
  1889. {
  1890. console_printf_terminal ("Low threshold cannot be higher than the High threshold...Aborting...\n");
  1891. }
  1892. else
  1893. {
  1894. resultCode = TI_SetMediumUsageThreshold(g_id_adapter, &pThresholdCrossParams);
  1895. if (resultCode == TI_RESULT_OK)
  1896. {
  1897. console_printf_terminal ("Medium usage threshold for AC %d has been set to:\n LowThreshold = %d\n HighThreshold = %d\n",
  1898. pThresholdCrossParams.uAC,
  1899. pThresholdCrossParams.uLowThreshold,
  1900. pThresholdCrossParams.uHighThreshold);
  1901. }
  1902. else
  1903. {
  1904. console_printf_terminal ("Error...\n");
  1905. }
  1906. }
  1907. }
  1908. else if (nParms == 1) /* Only 1 parameter means a GET operation */
  1909. {
  1910. pThresholdCrossParams.uAC = parm[0].value;
  1911. pThresholdCrossParams.uLowThreshold = 0;
  1912. pThresholdCrossParams.uHighThreshold = 0;
  1913. resultCode = TI_GetMediumUsageThreshold(g_id_adapter, &pThresholdCrossParams);
  1914. console_printf_terminal ("Medium usage threshold for AC %d:\n LowThreshold = %d\n HighThreshold = %d\n",
  1915. pThresholdCrossParams.uAC,
  1916. pThresholdCrossParams.uLowThreshold,
  1917. pThresholdCrossParams.uHighThreshold);
  1918. }
  1919. }
  1920. void cmd_phy_rate_threshold(ConParm_t parm[], U16 nParms)
  1921. {
  1922. OS_802_11_THRESHOLD_CROSS_PARAMS pThresholdCrossParams;
  1923. tiUINT32 resultCode;
  1924. if (nParms == 3) /* If user supplied 3 parameters - this is a SET operation */
  1925. {
  1926. if ((is_value_rate(parm[1].value) == FALSE) || (is_value_rate(parm[2].value) == FALSE))
  1927. {
  1928. console_printf_terminal ("Invalid rate - PHY rate valid values are: 1,2,5,6,9,11,12,18,24,36,48,54\n");
  1929. return;
  1930. }
  1931. pThresholdCrossParams.uAC = parm[0].value;
  1932. pThresholdCrossParams.uHighThreshold = parm[1].value;
  1933. pThresholdCrossParams.uLowThreshold = parm[2].value;
  1934. if (pThresholdCrossParams.uLowThreshold > pThresholdCrossParams.uHighThreshold)
  1935. {
  1936. console_printf_terminal ("Low threshold cannot be higher than the High threshold...Aborting...\n");
  1937. }
  1938. else
  1939. {
  1940. resultCode = TI_SetPhyRateThreshold(g_id_adapter, &pThresholdCrossParams);
  1941. if (resultCode == TI_RESULT_OK)
  1942. {
  1943. console_printf_terminal ("PHY rate threshold for AC %d has been set to:\n LowThreshold = %d\n HighThreshold = %d\n",
  1944. pThresholdCrossParams.uAC,
  1945. pThresholdCrossParams.uLowThreshold,
  1946. pThresholdCrossParams.uHighThreshold);
  1947. }
  1948. else
  1949. {
  1950. console_printf_terminal ("Error...\n");
  1951. }
  1952. }
  1953. }
  1954. else if (nParms == 1)
  1955. {
  1956. pThresholdCrossParams.uAC = parm[0].value;
  1957. pThresholdCrossParams.uLowThreshold = 0;
  1958. pThresholdCrossParams.uHighThreshold = 0;
  1959. resultCode = TI_GetPhyRateThreshold(g_id_adapter, &pThresholdCrossParams);
  1960. console_printf_terminal ("PHY rate threshold for AC %d:\n",pThresholdCrossParams.uAC);
  1961. console_printf_terminal ("LowThreshold = %s\n",print_rate((rate_e) pThresholdCrossParams.uLowThreshold));
  1962. console_printf_terminal ("HighThreshold = %s\n",print_rate((rate_e) pThresholdCrossParams.uHighThreshold));
  1963. }
  1964. }
  1965. void cmd_traffic_intensity_threshold(ConParm_t parm[], U16 nParms)
  1966. {
  1967. OS_802_11_TRAFFIC_INTENSITY_THRESHOLD_PARAMS pTrafficIntensityThresholds;
  1968. tiUINT32 resultCode;
  1969. if (nParms == 3)
  1970. {
  1971. pTrafficIntensityThresholds.uHighThreshold = parm[0].value;
  1972. pTrafficIntensityThresholds.uLowThreshold = parm[1].value;
  1973. pTrafficIntensityThresholds.TestInterval = parm[2].value;
  1974. if (pTrafficIntensityThresholds.uLowThreshold >= pTrafficIntensityThresholds.uHighThreshold)
  1975. {
  1976. console_printf_terminal ("Error: low threshold equal or greater than the high threshold...aborting...\n");
  1977. }
  1978. resultCode = TI_SetTrafficIntensityThresholds (g_id_adapter, &pTrafficIntensityThresholds);
  1979. if (resultCode == TI_RESULT_OK)
  1980. {
  1981. console_printf_terminal ("Successfully set traffic intensity thresholds...\n");
  1982. }
  1983. else
  1984. {
  1985. console_printf_terminal ("Error: result code = %d\n",resultCode);
  1986. }
  1987. }
  1988. else if (nParms == 0)
  1989. {
  1990. resultCode = TI_GetTrafficIntensityThresholds (g_id_adapter, &pTrafficIntensityThresholds);
  1991. if (resultCode == TI_RESULT_OK)
  1992. {
  1993. console_printf_terminal ("Traffic intensity thresholds :\n HighThreshold = %d\n LowThreshold = %d\n TestInterval = %d\n",
  1994. pTrafficIntensityThresholds.uHighThreshold,
  1995. pTrafficIntensityThresholds.uLowThreshold,
  1996. pTrafficIntensityThresholds.TestInterval);
  1997. }
  1998. else
  1999. {
  2000. console_printf_terminal ("Error: result code = %d\n",resultCode);
  2001. }
  2002. }
  2003. }
  2004. void cmd_enable_traffic_events(ConParm_t parm[], U16 nParms)
  2005. {
  2006. TI_ToggleTrafficIntensityEvents (g_id_adapter, (tiUINT32)TRUE);
  2007. console_printf_terminal ("Traffic intensity thresholds enabled...\n");
  2008. }
  2009. void cmd_disable_traffic_events(ConParm_t parm[], U16 nParms)
  2010. {
  2011. TI_ToggleTrafficIntensityEvents (g_id_adapter, (tiUINT32)FALSE);
  2012. console_printf_terminal ("Traffic intensity thresholds disabled...\n");
  2013. }
  2014. void cmd_config_tx_classifier(ConParm_t parm[], U16 nParms)
  2015. {
  2016. NWIF_CLSFR_ENTRY inParamsBuff[CLI_NUM_OF_TX_CLASFR_CON];
  2017. UINT32 inParamsBuffLen = 0;
  2018. UINT8 i,ic,iv=0;
  2019. for( ic=0,iv=0; ic<CLI_NUM_OF_TX_CLASFR_CON; ic++)
  2020. {
  2021. inParamsBuff[ic].port = (UINT16 )parm[iv].value;
  2022. iv++;
  2023. inParamsBuff[ic].pri = (UINT16 )parm[iv].value;
  2024. iv++;
  2025. inParamsBuff[ic].ip = 0;
  2026. inParamsBuffLen += sizeof(NWIF_CLSFR_ENTRY);
  2027. }
  2028. for( i=0; i<4; i++,iv++)
  2029. {
  2030. for(ic=0;ic<CLI_NUM_OF_TX_CLASFR_CON;ic++)
  2031. {
  2032. inParamsBuff[ic].ip |= parm[iv].value << i * 8;
  2033. }
  2034. }
  2035. }
  2036. void cmd_remove_clsfr_entry (ConParm_t parm[], U16 uParms)
  2037. {
  2038. clsfr_tableEntry_t newUserTableEntry;
  2039. int i;
  2040. clsfrTypeAndSupport ClsfrType;
  2041. tiINT32 res;
  2042. TI_GetClsfrType(g_id_adapter, &ClsfrType );
  2043. /* Possibly needs to be removed if we want to keep this routine working for old classifier as well */
  2044. if (ClsfrType.oldVersionSupport == TRUE)
  2045. {
  2046. console_printf_terminal ("Old classifier support detected...Remove action disabled (use old classifier config)\n");
  2047. return;
  2048. }
  2049. if (uParms >=2)
  2050. newUserTableEntry.DTag = (tiUINT8) parm[1].value;
  2051. switch(parm[0].value)
  2052. {
  2053. case D_TAG_CLSFR:
  2054. console_printf_terminal("Cannot remove D_TAG classifier entry!\n");
  2055. return;
  2056. break;
  2057. case DSCP_CLSFR:
  2058. if (uParms != 3)
  2059. {
  2060. console_printf_terminal("DSCP_CLSFR Entry type, wrong number of parameters(too many?)\n");
  2061. return;
  2062. }
  2063. newUserTableEntry.Dscp.CodePoint = (tiUINT8) parm[2].value;
  2064. console_printf_terminal ("Removing DSCP_CLSFR classifier entry\nD-Tag = %d\nCodePoint = %d\n",newUserTableEntry.DTag,newUserTableEntry.Dscp.CodePoint);
  2065. break;
  2066. case PORT_CLSFR:
  2067. if (uParms != 3)
  2068. {
  2069. console_printf_terminal("PORT_CLSFR Entry type, wrong number of parameters(too many?)\n");
  2070. return;
  2071. }
  2072. newUserTableEntry.Dscp.DstPortNum = (tiUINT16) parm[2].value;
  2073. console_printf_terminal ("Removing PORT_CLSFR classifier entry\nD-Tag = %d\nPort = %d\n",newUserTableEntry.DTag,newUserTableEntry.Dscp.DstPortNum);
  2074. break;
  2075. case IPPORT_CLSFR:
  2076. if (uParms != 7)
  2077. {
  2078. console_printf_terminal("PORT_CLSFR Entry type, wrong number of parameters\n");
  2079. return;
  2080. }
  2081. newUserTableEntry.Dscp.DstIPPort.DstPortNum = (tiUINT16) parm[2].value;
  2082. newUserTableEntry.Dscp.DstIPPort.DstIPAddress = 0;
  2083. for(i=0; i<4; i++)
  2084. {
  2085. newUserTableEntry.Dscp.DstIPPort.DstIPAddress |= parm[i+3].value << i * 8;
  2086. }
  2087. console_printf_terminal ("Removing IPPORT_CLSFR classifier entry\nD-Tag = %d\nPort = %d\nIP = %3d.%d.%d.%d\n",
  2088. newUserTableEntry.DTag,
  2089. newUserTableEntry.Dscp.DstIPPort.DstPortNum,
  2090. (int)parm[3].value,(int)parm[4].value,(int)parm[5].value,(int)parm[6].value);
  2091. break;
  2092. default:
  2093. console_printf_terminal("Unknown Classifier Type - Command aborted!\n");
  2094. return;
  2095. break;
  2096. }
  2097. res = TI_RemoveClassifierEntry(g_id_adapter, &newUserTableEntry);
  2098. if (res)
  2099. {
  2100. console_printf_terminal ("Failed to remove classifier entry...return code = %d\n",res);
  2101. }
  2102. }
  2103. void cmd_insert_clsfr_entry (ConParm_t parm[], U16 uParms)
  2104. {
  2105. clsfr_tableEntry_t newUserTableEntry;
  2106. int i;
  2107. clsfrTypeAndSupport ClsfrType;
  2108. tiINT32 res;
  2109. TI_GetClsfrType(g_id_adapter, &ClsfrType );
  2110. if (ClsfrType.oldVersionSupport == TRUE)
  2111. {
  2112. console_printf_terminal ("Old classifier support detected...Insert action disabled (use old classifier config)\n");
  2113. return;
  2114. }
  2115. if (uParms >=2)
  2116. newUserTableEntry.DTag = (UINT8) parm[1].value;
  2117. switch(parm[0].value)
  2118. {
  2119. case D_TAG_CLSFR:
  2120. console_printf_terminal("Cannot insert D_TAG classifier entry!\n");
  2121. return;
  2122. break;
  2123. case DSCP_CLSFR:
  2124. if (uParms != 3)
  2125. {
  2126. console_printf_terminal("DSCP_CLSFR Entry type, wrong number of parameters(too many?)\n");
  2127. return;
  2128. }
  2129. newUserTableEntry.Dscp.CodePoint = (UINT8) parm[2].value;
  2130. console_printf_terminal ("Inserting new DSCP_CLSFR classifier entry\nD-Tag = %d\nCodePoint = %d\n",newUserTableEntry.DTag,newUserTableEntry.Dscp.CodePoint);
  2131. break;
  2132. case PORT_CLSFR:
  2133. if (uParms != 3)
  2134. {
  2135. console_printf_terminal("PORT_CLSFR Entry type, wrong number of parameters(too many?)\n");
  2136. return;
  2137. }
  2138. newUserTableEntry.Dscp.DstPortNum = (UINT16) parm[2].value;
  2139. console_printf_terminal ("Inserting new PORT_CLSFR classifier entry\nD-Tag = %d\nPort = %d\n",newUserTableEntry.DTag,newUserTableEntry.Dscp.DstPortNum);
  2140. break;
  2141. case IPPORT_CLSFR:
  2142. if (uParms != 7)
  2143. {
  2144. console_printf_terminal("PORT_CLSFR Entry type, wrong number of parameters\n");
  2145. return;
  2146. }
  2147. newUserTableEntry.Dscp.DstIPPort.DstPortNum = (UINT16) parm[2].value;
  2148. newUserTableEntry.Dscp.DstIPPort.DstIPAddress = 0;
  2149. for(i=0; i<4; i++)
  2150. {
  2151. newUserTableEntry.Dscp.DstIPPort.DstIPAddress |= parm[i+3].value << i * 8;
  2152. }
  2153. console_printf_terminal ("Inserting new IPPORT_CLSFR classifier entry\nD-Tag = %d\nPort = %d\nIP = %3d.%d.%d.%d\n",
  2154. newUserTableEntry.DTag,
  2155. newUserTableEntry.Dscp.DstIPPort.DstPortNum,
  2156. (int)parm[3].value,(int)parm[4].value,(int)parm[5].value,(int)parm[6].value);
  2157. break;
  2158. default:
  2159. console_printf_terminal("Unknown Classifier Type - Command aborted!\n");
  2160. return;
  2161. break;
  2162. }
  2163. res = TI_ConfigTxClassifier(g_id_adapter, sizeof(clsfr_tableEntry_t), (UINT8 *)&newUserTableEntry);
  2164. if (res)
  2165. {
  2166. console_printf_terminal ("Failed to insert new classifier entry...return code = %d\n",res);
  2167. }
  2168. }
  2169. void cmd_poll_ap_packets(ConParm_t parm[], U16 nParms)
  2170. {
  2171. if (nParms == 0)
  2172. {
  2173. TI_PollApPackets (g_id_adapter);
  2174. console_printf_terminal ("Poll AP packets cmd sent to driver...\n");
  2175. }
  2176. else if (nParms == 1)
  2177. {
  2178. TI_PollApPacketsFromAC (g_id_adapter,parm[0].value);
  2179. console_printf_terminal ("Poll AP packets (From AC %d) cmd sent to driver...\n",(int)parm[0].value);
  2180. }
  2181. }
  2182. void cmd_modify_rate(ConParm_t parm[], U16 nParms)
  2183. {
  2184. tiUINT32 data = 0, data1 = 0;
  2185. if( !TI_GetDesiredRate(g_id_adapter, &data1 ) )
  2186. {
  2187. TI_GetCurrentRate(g_id_adapter, &data );
  2188. console_printf_terminal("Rate: %s", print_rate(data));
  2189. console_printf_terminal(", desired rate: %s\n", print_rate(data1));
  2190. }
  2191. }
  2192. #if 0 /* not in use*/
  2193. void cmd_net_current_regdomain(ConParm_t parm[], U16 nParms)
  2194. {
  2195. UNUSED(nParms);
  2196. UNUSED(parm);
  2197. console_printf_terminal("not implemented...\n");
  2198. }
  2199. static named_value_t network_type_name[] = {
  2200. { os802_11FH, "FH" } ,
  2201. { os802_11DS, "DS" } ,
  2202. { os802_11OFDM5, "OFDM5" } ,
  2203. { os802_11OFDM24, "OFDM24" } ,
  2204. { os802_11OFDM24_AND_5, "OFDM24_AND_5" } ,
  2205. { os802_11NetworkTypeMax, "NetworkTypeMax" }
  2206. };
  2207. void cmd_net_network_in_use(ConParm_t parm[], U16 nParms)
  2208. {
  2209. OS_802_11_NETWORK_TYPE data;
  2210. if( !nParms )
  2211. {
  2212. if( !TI_GetNetworkTypeInUse(g_id_adapter, &data ) )
  2213. {
  2214. print_available_values(network_type_name);
  2215. console_printf_terminal("Cur.network: %d\n", data );
  2216. }
  2217. }
  2218. else
  2219. TI_SetNetworkTypeInUse(g_id_adapter, parm[0].value );
  2220. }
  2221. #endif /* if 0*/
  2222. void cmd_show_tx_power_level_table(ConParm_t parm[], U16 nParms)
  2223. {
  2224. TIWLAN_POWER_LEVEL_TABLE powerTable;
  2225. int i;
  2226. if( !TI_GetTxPowerLevel(g_id_adapter, (tiCHAR*)&powerTable) )
  2227. {
  2228. console_printf_terminal("Power level table (Dbm/10)\n");
  2229. for ( i = 0 ; i < TI_NUM_OF_SUB_BANDS ; i++)
  2230. {
  2231. console_printf_terminal("sub-band %i: %d %d %d %d\n", i,
  2232. powerTable.uTxPower[i][0],
  2233. powerTable.uTxPower[i][1],
  2234. powerTable.uTxPower[i][2],
  2235. powerTable.uTxPower[i][3]);
  2236. }
  2237. }
  2238. else
  2239. {
  2240. console_printf_terminal("Tx Power level table ERROR !!!\n");
  2241. }
  2242. }
  2243. void cmd_tx_power_dbm(ConParm_t parm[], U16 nParms)
  2244. {
  2245. tiCHAR dummyData = 0;
  2246. if (nParms == 0)
  2247. {
  2248. if( !TI_GetTxPowerDbm(g_id_adapter, &dummyData))
  2249. {
  2250. console_printf_terminal("Tx Power (Dbm/10) = %d\n", dummyData);
  2251. }
  2252. }
  2253. else
  2254. {
  2255. if (parm[0].value > MAX_TX_POWER)
  2256. {
  2257. console_printf_terminal("Hey !!! You should use values between %d and %d\n", MIN_TX_POWER, MAX_TX_POWER);
  2258. return;
  2259. }
  2260. /* use U8 cast to fix compile warning */
  2261. if(! TI_SetTxPowerDbm(g_id_adapter, (U8)parm[0].value) )
  2262. {
  2263. console_printf_terminal("Set Tx Power in DBM/10 = %d\n", parm[0].value);
  2264. }
  2265. }
  2266. }
  2267. void cmd_enableDisable_802_11d(ConParm_t parm[], U16 nParms)
  2268. {
  2269. UINT8 data = 0;
  2270. tiINT32 result;
  2271. result = TI_Get_802_11d(g_id_adapter, &data );
  2272. if ( nParms == 0 )
  2273. {
  2274. if( result == TI_RESULT_OK)
  2275. {
  2276. console_printf_terminal("802_11d status=%d\n", data );
  2277. }
  2278. }
  2279. else
  2280. {
  2281. result = TI_EnableDisable_802_11d(g_id_adapter, (UINT8) parm[0].value);
  2282. if ((result != TI_RESULT_OK) && (!parm[0].value))
  2283. {
  2284. result = TI_Get_802_11h(g_id_adapter, &data );
  2285. if (data)
  2286. {
  2287. console_printf_terminal("802_11d cannot be disabled while 802_11h is enabled!!\n" );
  2288. }
  2289. }
  2290. else
  2291. {
  2292. console_printf_terminal("802_11d status is updated to =%d\n", parm[0].value );
  2293. }
  2294. }
  2295. }
  2296. void cmd_enableDisable_802_11h(ConParm_t parm[], U16 nParms)
  2297. {
  2298. UINT8 data = 0;
  2299. tiINT32 result;
  2300. result = TI_Get_802_11h(g_id_adapter, &data );
  2301. if( nParms == 0 )
  2302. {
  2303. if( result == TI_RESULT_OK)
  2304. {
  2305. console_printf_terminal("802_11h status=%d\n", data );
  2306. }
  2307. }
  2308. else
  2309. {
  2310. TI_EnableDisable_802_11h(g_id_adapter, (UINT8) parm[0].value);
  2311. if (parm[0].value)
  2312. {
  2313. console_printf_terminal("802_11h enables automatically 802_11d!!\n" );
  2314. }
  2315. console_printf_terminal("802_11h status is updated to =%d\n", parm[0].value );
  2316. }
  2317. }
  2318. void cmd_d_Country_2_4Ie(ConParm_t parm[], U16 nParms)
  2319. {
  2320. tiINT32 result;
  2321. if( nParms == 0 )
  2322. {
  2323. UINT8 countryString[COUNTRY_STRING_LEN+1];
  2324. result = TI_Get_countryIeFor2_4_Ghz(g_id_adapter, (UINT8**)&countryString );
  2325. if( result == TI_RESULT_OK)
  2326. {
  2327. countryString[COUNTRY_STRING_LEN] = '\0';
  2328. if (countryString[0] == '\0')
  2329. {
  2330. console_printf_terminal("802_11d Country for 2.4 GHz is not found\n");
  2331. }
  2332. else
  2333. {
  2334. console_printf_terminal("802_11d Country for 2.4 GHz is %s \n", countryString );
  2335. }
  2336. }
  2337. }
  2338. else
  2339. {
  2340. country_t countryWorld;
  2341. countryWorld.elementId = COUNTRY_IE_ID;
  2342. countryWorld.len = 6;
  2343. memcpy( countryWorld.countryIE.CountryString,"GB ", 3);
  2344. countryWorld.countryIE.tripletChannels[0].firstChannelNumber = 1;
  2345. countryWorld.countryIE.tripletChannels[0].maxTxPowerLevel = 23;
  2346. countryWorld.countryIE.tripletChannels[0].numberOfChannels = 11;
  2347. console_printf_terminal("802_11d Start Setting GB Country for 2.4 GHz \n");
  2348. result = TI_Set_countryIeFor2_4_Ghz(g_id_adapter, countryWorld);
  2349. console_printf_terminal("802_11d Setting GB Country for 2.4 GHz, result=%d\n", result);
  2350. }
  2351. }
  2352. void cmd_d_Country_5Ie(ConParm_t parm[], U16 nParms)
  2353. {
  2354. tiINT32 result;
  2355. if( nParms == 0 )
  2356. {
  2357. UINT8 countryString[COUNTRY_STRING_LEN+1];
  2358. result = TI_Get_countryIeFor5_Ghz(g_id_adapter, (UINT8**)&countryString );
  2359. if( result == TI_RESULT_OK)
  2360. {
  2361. countryString[COUNTRY_STRING_LEN] = '\0';
  2362. if (countryString[0] == '\0')
  2363. {
  2364. console_printf_terminal("802_11d Country for 5 GHz is not found\n");
  2365. }
  2366. else
  2367. {
  2368. console_printf_terminal("802_11d Country for 5 GHz is %s\n", countryString );
  2369. }
  2370. }
  2371. }
  2372. else
  2373. {
  2374. country_t countryWorld;
  2375. countryWorld.elementId = COUNTRY_IE_ID;
  2376. countryWorld.len = 6;
  2377. memcpy( countryWorld.countryIE.CountryString,"US ", 3);
  2378. countryWorld.countryIE.tripletChannels[0].firstChannelNumber = 36;
  2379. countryWorld.countryIE.tripletChannels[0].maxTxPowerLevel = 16;
  2380. countryWorld.countryIE.tripletChannels[0].numberOfChannels = 8;
  2381. result = TI_Set_countryIeFor5_Ghz(g_id_adapter, countryWorld);
  2382. console_printf_terminal("802_11d Setting US Country for 5 GHz, result=%d\n", result);
  2383. }
  2384. }
  2385. void cmd_DFS_range(ConParm_t parm[], U16 nParms)
  2386. {
  2387. tiINT32 result;
  2388. DFS_ChannelRange_t DFS_ChannelRange;
  2389. if( nParms == 0 )
  2390. {
  2391. result = TI_Get_minMaxDfsChannels(g_id_adapter, &DFS_ChannelRange );
  2392. if( result == TI_RESULT_OK)
  2393. {
  2394. console_printf_terminal("DFS min channel is %d, DFS max channel is %d\n",
  2395. DFS_ChannelRange.minDFS_channelNum, DFS_ChannelRange.maxDFS_channelNum);
  2396. }
  2397. }
  2398. else
  2399. {
  2400. DFS_ChannelRange.minDFS_channelNum = (UINT16) parm[0].value;
  2401. DFS_ChannelRange.maxDFS_channelNum = (UINT16) parm[1].value;
  2402. console_printf_terminal("Given params: min channel %d, DFS max channel %d\n",
  2403. parm[0].value, parm[1].value);
  2404. result = TI_Set_minMaxDfsChannels(g_id_adapter, DFS_ChannelRange);
  2405. if (result == TI_RESULT_OK)
  2406. {
  2407. console_printf_terminal("Setting DFS min channel %d, DFS max channel %d\n",
  2408. DFS_ChannelRange.minDFS_channelNum, DFS_ChannelRange.maxDFS_channelNum);
  2409. }
  2410. else
  2411. {
  2412. console_printf_terminal("Setting DFS min channel %d, DFS max channel %d - FAILED !!\n",
  2413. DFS_ChannelRange.minDFS_channelNum, DFS_ChannelRange.maxDFS_channelNum);
  2414. }
  2415. }
  2416. }
  2417. #if 0
  2418. void cmd_modify_tx_power_value(ConParm_t parm[], U16 nParms)
  2419. {
  2420. if( nParms == 0 )
  2421. {
  2422. tiUINT32 data = 1234;
  2423. if( !TI_GetTxPowerValue(g_id_adapter, &data) )
  2424. console_printf_terminal( "Tx Power val = %ld\n", data);
  2425. }
  2426. else
  2427. TI_SetTxPowerValue(g_id_adapter, parm[0].value);
  2428. }
  2429. #endif
  2430. void cmd_show_regdomain_table(ConParm_t parm[], U16 nParms)
  2431. {
  2432. UNUSED(nParms);
  2433. UNUSED(parm);
  2434. console_printf_terminal( "not implemented ....\n");
  2435. }
  2436. void cmd_modify_4x_state(ConParm_t parm[], U16 nParms)
  2437. {
  2438. if( nParms == 0 )
  2439. {
  2440. tiBOOL data = FALSE;
  2441. if( !TI_Get4XState(g_id_adapter, &data ) )
  2442. console_printf_terminal("4x state=%s\n", data ? "True" : "False" );
  2443. }
  2444. else /* param <read-only!!> */
  2445. TI_Set4XState(g_id_adapter, (BOOL) parm[0].value);
  2446. }
  2447. static named_value_t BSS_type[] =
  2448. {
  2449. { os802_11IBSS, "AD-Hoc" },
  2450. { os802_11Infrastructure, "Infr." },
  2451. { os802_11AutoUnknown, "Auto" },
  2452. /* { os802_11HighSpeedIBSS, "HighSpeedIBSS" },*/
  2453. /* { os802_11InfrastructureMax, "Max" }*/
  2454. };
  2455. void cmd_modify_bss_type(ConParm_t parm[], U16 nParms)
  2456. {
  2457. OS_802_11_NETWORK_MODE data = 0; //TRS:MEB use correct datatype to avoid compiler warning
  2458. if( nParms == 0 )
  2459. {
  2460. if( !TI_GetBSSType(g_id_adapter, &data ) )
  2461. {
  2462. print_available_values(BSS_type);
  2463. console_printf_terminal("Current mode=%d\n", data );
  2464. }
  2465. }
  2466. else /* param <read-only!!> */
  2467. TI_SetBSSType(g_id_adapter, (BOOL) parm[0].value);
  2468. }
  2469. void cmd_get_driver_state(ConParm_t parm[], U16 nParms)
  2470. {
  2471. static char stateDesc[6][100] =
  2472. {
  2473. "DRIVER_STATE_IDLE",
  2474. "DRIVER_STATE_SCANNING",
  2475. "DRIVER_STATE_SELECTING",
  2476. "DRIVER_STATE_CONNECTING",
  2477. "DRIVER_STATE_CONNECTED",
  2478. "DRIVER_STATE_DISCONNECTED",
  2479. };
  2480. driverState_e myState;
  2481. TI_GetDriverState (g_id_adapter, &myState);
  2482. console_printf_terminal("Driver state is %s\n", stateDesc[(UINT8)myState]);
  2483. }
  2484. void cmd_modify_ext_rates_ie(ConParm_t parm[], U16 nParms)
  2485. {
  2486. static named_value_t ExtRatesIE[] =
  2487. {
  2488. { DRAFT_5_AND_EARLIER, "5_AND_EARLIER" },
  2489. { DRAFT_6_AND_LATER, "6_AND_LATER" }
  2490. };
  2491. if( nParms == 0 )
  2492. {
  2493. tiUINT32 data = 1122;
  2494. if( !TI_GetExtRatesIE(g_id_adapter, &data ) )
  2495. {
  2496. print_available_values(ExtRatesIE);
  2497. console_printf_terminal("ExtRatesIE=%u\n", data );
  2498. }
  2499. }
  2500. else
  2501. TI_SetExtRatesIE(g_id_adapter, (tiUINT32) parm[0].value);
  2502. }
  2503. /*will return RSSI*/
  2504. void cmd_get_rsii_level(ConParm_t parm[], U16 nParms)
  2505. {
  2506. tiINT32 rssi ;
  2507. TI_GetRSSI(g_id_adapter, &rssi);
  2508. console_printf_terminal("\n Current RSSI : %d\n" ,rssi) ; // TRS:WDK - add return
  2509. }
  2510. /*will return SNR ratio*/
  2511. void cmd_get_snr_ratio(ConParm_t parm[], U16 nParms)
  2512. {
  2513. tiUINT32 snr ;
  2514. TI_GetSNR(g_id_adapter, &snr);
  2515. console_printf_terminal("\n Current SNR ratio : %d\n" ,snr) ; // TRS:WDK - add return
  2516. }
  2517. void cmd_modify_frag_threshold(ConParm_t parm[], U16 nParms)
  2518. {
  2519. if( nParms == 0 )
  2520. {
  2521. tiUINT32 data = 0xfefefefe;
  2522. if( !TI_GetFragmentThreshold(g_id_adapter, &data ) )
  2523. console_printf_terminal("Frag. threshold=%d\n", data );
  2524. }
  2525. else
  2526. TI_SetFragmentThreshold(g_id_adapter, parm[0].value);
  2527. }
  2528. void cmd_modify_short_slot(ConParm_t parm[], U16 nParms)
  2529. {
  2530. if( nParms == 0 )
  2531. {
  2532. tiUINT32 data = 0xfefefefe;
  2533. if( !TI_GetShortSlot(g_id_adapter, &data ) )
  2534. console_printf_terminal("Short slot=%d\n", data );
  2535. }
  2536. else
  2537. TI_SetShortSlot(g_id_adapter, parm[0].value);
  2538. }
  2539. void cmd_modify_rts_threshold(ConParm_t parm[], U16 nParms)
  2540. {
  2541. if( nParms == 0 )
  2542. {
  2543. tiUINT32 data = 0xfefefefe;
  2544. if( !TI_GetRTSThreshold( g_id_adapter, &data) )
  2545. console_printf_terminal("RTSThreshold=%d\n", data );
  2546. }
  2547. else
  2548. TI_SetRTSThreshold(g_id_adapter, parm[0].value);
  2549. }
  2550. void cmd_modify_preamble(ConParm_t parm[], U16 nParms)
  2551. {
  2552. if( nParms == 0 )
  2553. {
  2554. tiUINT32 data = 0xfefefefe;
  2555. if( !TI_GetShortPreamble( g_id_adapter, &data) )
  2556. console_printf_terminal("ShortPreamble=%d\n", data );
  2557. }
  2558. else
  2559. TI_SetShortPreamble(g_id_adapter, parm[0].value);
  2560. }
  2561. void cmd_modify_antenna_diversity(ConParm_t parm[], U16 nParms)
  2562. {
  2563. TIWLAN_ANT_DIVERSITY antennaDiversityOptions;
  2564. antennaDiversityOptions.enableRxDiversity = (UINT8)parm[0].value;
  2565. antennaDiversityOptions.rxSelectedAntenna = (UINT8)parm[1].value;
  2566. antennaDiversityOptions.enableTxDiversity = (UINT8)parm[2].value;
  2567. antennaDiversityOptions.txSelectedAntenna = (UINT8)parm[3].value;
  2568. antennaDiversityOptions.rxTxSharedAnts = (UINT8)parm[4].value;
  2569. TI_SetAntennaDiversityParams(g_id_adapter, &antennaDiversityOptions);
  2570. console_printf_terminal("Antenna diversity parameters sent.\n");
  2571. }
  2572. void cmd_modify_short_retry(ConParm_t parm[], U16 nParms)
  2573. {
  2574. if( nParms == 0 )
  2575. {
  2576. tiUINT32 data = 0xfefefefe;
  2577. if( !TI_GetShortRetry( g_id_adapter, &data) )
  2578. console_printf_terminal("ShortRetry=%d\n", data );
  2579. }
  2580. else
  2581. TI_SetShortRetry(g_id_adapter, parm[0].value);
  2582. }
  2583. void cmd_modify_long_retry(ConParm_t parm[], U16 nParms)
  2584. {
  2585. if( nParms == 0 )
  2586. {
  2587. tiUINT32 data = 0xfefefefe;
  2588. if( !TI_GetLongRetry( g_id_adapter, &data) )
  2589. console_printf_terminal("LongRetry=%d\n", data );
  2590. }
  2591. else
  2592. TI_SetLongRetry(g_id_adapter, parm[0].value);
  2593. }
  2594. void cmd_start_driver(ConParm_t parm[], U16 nParms)
  2595. {
  2596. TI_Start( g_id_adapter );
  2597. }
  2598. void cmd_stop_driver(ConParm_t parm[], U16 nParms)
  2599. {
  2600. UNUSED(nParms);
  2601. UNUSED(parm);
  2602. TI_Stop(g_id_adapter);
  2603. }
  2604. static TI_HANDLE eventRegistered[IPC_EVENT_MAX];
  2605. static named_value_t event_type[] = {
  2606. { IPC_EVENT_ASSOCIATED, "Associated" },
  2607. { IPC_EVENT_DISASSOCIATED, "Disassociated" },
  2608. { IPC_EVENT_LINK_SPEED, "LinkSpeed" },
  2609. { IPC_EVENT_AUTH_SUCC, "Authentication Success" },
  2610. { IPC_EVENT_SCAN_COMPLETE, "ScanComplete" },
  2611. { IPC_EVENT_TIMEOUT, "Timeout" },
  2612. { IPC_EVENT_CCKM_START, "CCKM_Start" },
  2613. { IPC_EVENT_MEDIA_SPECIFIC, "Media_Specific" },
  2614. { IPC_EVENT_EAPOL, "EAPOL" },
  2615. { IPC_EVENT_BOUND, "Bound" },
  2616. { IPC_EVENT_UNBOUND, "Unbound" },
  2617. { IPC_EVENT_PREAUTH_EAPOL, "PreAuth EAPOL"},
  2618. /* { IPC_EVENT_PER, "PER" },*/
  2619. { IPC_EVENT_LOW_SNR, "Low SNR" },
  2620. { IPC_EVENT_LOW_RSSI, "Low RSSI" },
  2621. { IPC_EVENT_TSPEC_STATUS, "IPC_EVENT_TSPEC_STATUS" },
  2622. { IPC_EVENT_TSPEC_RATE_STATUS, "IPC_EVENT_TSPEC_RATE_STATUS" },
  2623. { IPC_EVENT_MEDIUM_TIME_CROSS, "IPC_EVENT_MEDIUM_TIME_CROSS" },
  2624. { IPC_EVENT_ROAMING_COMPLETE, "ROAMING_COMPLETE"},
  2625. { IPC_EVENT_EAP_AUTH_FAILURE, "EAP-FAST/LEAP Auth Failed"},
  2626. { IPC_EVENT_WPA2_PREAUTHENTICATION, "IPC_EVENT_WPA2_PREAUTHENTICATION" },
  2627. { IPC_EVENT_TRAFFIC_INTENSITY_THRESHOLD_CROSSED, "IPC_EVENT_TRAFFIC_INTENSITY_THRESHOLD_CROSSED" },
  2628. { IPC_EVENT_BT_COEX_MODE, "IPC_EVENT_BT_COEX_MODE" },
  2629. };
  2630. void cmd_events_register(ConParm_t parm[], U16 nParms)
  2631. {
  2632. tiUINT32 event;
  2633. IPC_EVENT_PARAMS pEvent;
  2634. if( nParms )
  2635. {
  2636. event = (tiUINT32)parm[0].value;
  2637. if (events_mask & (1 << event))
  2638. {
  2639. #ifndef _WINDOWS
  2640. console_printf_terminal("cmd_events_register, event is already enabled! (%d)\n", events_mask);
  2641. #endif
  2642. }
  2643. else
  2644. {
  2645. pEvent.uEventType = (tiUINT32)parm[0].value;
  2646. pEvent.uDeliveryType = DELIVERY_PUSH;
  2647. pEvent.pfEventCallback = cli_receive_ev;
  2648. #ifdef _WINDOWS
  2649. #endif
  2650. if( !TI_RegisterEvent(g_id_adapter, &pEvent) )
  2651. {
  2652. eventRegistered[pEvent.uEventType] = pEvent.uEventID;
  2653. events_mask |= (1 << event);
  2654. #ifdef _WINDOWS
  2655. #endif
  2656. }
  2657. }
  2658. }
  2659. else
  2660. {
  2661. #ifdef _WINDOWS
  2662. #else
  2663. print_available_values(event_type);
  2664. #endif
  2665. }
  2666. }
  2667. void cmd_events_unregister(ConParm_t parm[], U16 nParms)
  2668. {
  2669. tiUINT32 event;
  2670. IPC_EVENT_PARAMS pEvent;
  2671. if( nParms )
  2672. {
  2673. event = (tiUINT32)parm[0].value;
  2674. #ifdef _WINDOWS
  2675. #else
  2676. pEvent.uEventType = event;
  2677. pEvent.uEventID = eventRegistered[pEvent.uEventType];
  2678. TI_UnRegisterEvent(g_id_adapter, &pEvent);
  2679. events_mask &= ~(1 << event);
  2680. #endif
  2681. }
  2682. else
  2683. {
  2684. #ifdef _WINDOWS
  2685. #else
  2686. print_available_values(event_type);
  2687. #endif
  2688. }
  2689. }
  2690. void cmd_get_selected_bssid_info(ConParm_t parm[], U16 nParms)
  2691. {
  2692. OS_802_11_BSSID_EX myInfo;
  2693. TI_GetSelectedBSSIDInfo(g_id_adapter, &myInfo);
  2694. console_printf_terminal("Selected BSSID Info:\n");
  2695. console_printf_terminal("--------------------\n");
  2696. console_printf_terminal("SSID: %s\n", get_ssid_string(&myInfo.Ssid));
  2697. console_printf_terminal("BSSID: %02x.%02x.%02x.%02x.%02x.%02x\n",
  2698. myInfo.MacAddress[0], myInfo.MacAddress[1], myInfo.MacAddress[2], myInfo.MacAddress[3], myInfo.MacAddress[4], myInfo.MacAddress[5] );
  2699. }
  2700. int parseBssidIe(OS_802_11_BSSID_EX * bssid)
  2701. {
  2702. OS_802_11_VARIABLE_IEs *pData;
  2703. dot11_WME_PARAM_t * qosParams;
  2704. int length;
  2705. int retval = 0;
  2706. /* console_printf_terminal("parseBssidIe,IElength=%d \n",bssid->IELength);*/
  2707. for (
  2708. length =sizeof(OS_802_11_FIXED_IEs) , pData = (OS_802_11_VARIABLE_IEs*) ((char*)bssid->IEs + sizeof(OS_802_11_FIXED_IEs));
  2709. length < (int)(bssid->IELength-3);
  2710. length += (pData->Length +2),pData = (OS_802_11_VARIABLE_IEs*)((char*)bssid->IEs + length)
  2711. )
  2712. {
  2713. /* console_printf_terminal("ElementID=%d pData=%x length=%d length1=%d\n",pData->ElementID,pData,pData->Length,length);*/
  2714. if (pData->ElementID == DOT11_WME_ELE_ID)
  2715. {
  2716. qosParams = (dot11_WME_PARAM_t *)pData;
  2717. /* console_printf_terminal("OUIType=%x OUI =%x %x %x \n",qosParams->OUIType,qosParams->OUI[0],qosParams->OUI[1],qosParams->OUI[2]);*/
  2718. if (qosParams->OUIType == dot11_WME_OUI_TYPE)
  2719. {
  2720. retval |= dot11_WME_OUI_TYPE;
  2721. }
  2722. }
  2723. }
  2724. return retval;
  2725. }
  2726. void cmd_bssid_list(ConParm_t parm[], U16 nParms)
  2727. {
  2728. OS_802_11_BSSID_EX BssIdInfo;
  2729. TI_GetSelectedBSSIDInfo(g_id_adapter, &BssIdInfo);
  2730. get_bssid_list(parm, nParms, FALSE , &BssIdInfo );
  2731. }
  2732. void cmd_Full_bssid_list(ConParm_t parm[], U16 nParms)
  2733. {
  2734. OS_802_11_BSSID_EX BssIdInfo;
  2735. TI_GetSelectedBSSIDInfo(g_id_adapter, &BssIdInfo);
  2736. get_bssid_list(parm, nParms, TRUE , &BssIdInfo);
  2737. }
  2738. /*When beacon filter is activated, the current RSSI of the connection with the AP will be displayed despite no beacons are
  2739. *passed up to the driver*/
  2740. static void get_bssid_list(ConParm_t parm[], U16 nParms, BOOL fullBssidList , OS_802_11_BSSID_EX *pBssid)
  2741. {
  2742. OS_802_11_BSSID_LIST_EX *list;/* = (OS_802_11_BSSID_LIST_EX *) data; */
  2743. OS_802_11_BSSID_EX *bssid;
  2744. tiUINT32 number_items, index;
  2745. char buffer[8] ;
  2746. int Qos = 0;
  2747. BOOL isConnectedAp = FALSE ; //TRS:MEB move this line earlier to avoid compile error
  2748. buffer[0] ='\0';
  2749. UNUSED(nParms);
  2750. UNUSED(parm);
  2751. if (fullBssidList)
  2752. {
  2753. if( TI_GetFullBSSIDList(g_id_adapter, &list) || !list )
  2754. return ;
  2755. }
  2756. else
  2757. {
  2758. if( TI_GetBSSIDList(g_id_adapter, &list) || !list )
  2759. return ;
  2760. }
  2761. bssid = &list->Bssid[0];
  2762. number_items = list->NumberOfItems;
  2763. console_printf_terminal("BssId List: Num=%u\n", number_items );
  2764. if( number_items )
  2765. {
  2766. console_printf_terminal("%17s %7s %4s %5s %7s %10s %s\n", "MAC", "Privacy", "Rssi", "Infra", "Channel","Qos ", "SSID");
  2767. while (number_items)
  2768. {
  2769. Qos = parseBssidIe(bssid);
  2770. /* console_printf_terminal("Qos=%d\n",Qos);*/
  2771. if (Qos & dot11_WME_OUI_TYPE)
  2772. {
  2773. strcpy(buffer, "WME ");
  2774. }
  2775. if (Qos == 0)
  2776. {
  2777. strcpy(buffer, "NONE ");
  2778. }
  2779. if (( 0 == memcmp(pBssid->MacAddress ,bssid->MacAddress,sizeof(OS_802_11_MAC_ADDRESS)) ) &&
  2780. (pBssid->NetworkTypeInUse == bssid->NetworkTypeInUse))
  2781. {
  2782. /*bssid->Rssi = staRssi ;*/
  2783. isConnectedAp = TRUE ;
  2784. }
  2785. else
  2786. {
  2787. isConnectedAp = FALSE ;
  2788. }
  2789. console_printf_terminal("%s %s %7u %4d %5d %7d %10s %s\n",
  2790. ( TRUE == isConnectedAp)?"*":" " ,
  2791. print_mac_2_str(bssid->MacAddress),
  2792. bssid->Privacy, bssid->Rssi,
  2793. bssid->InfrastructureMode, Freq2Chan(bssid->Configuration.Union.channel),
  2794. buffer,
  2795. get_ssid_string(&bssid->Ssid) );
  2796. if (fullBssidList)
  2797. {
  2798. console_printf_terminal(" TSF 0x%02x-0x%02x-0x%02x-0x%02x-0x%02x-0x%02x-0x%02x-0x%02x\n",
  2799. bssid->IEs[0], bssid->IEs[1], bssid->IEs[2], bssid->IEs[3],
  2800. bssid->IEs[4], bssid->IEs[5], bssid->IEs[6], bssid->IEs[7]);
  2801. console_printf_terminal(" BeaconInterval 0x%02x%02x\n", bssid->IEs[9], bssid->IEs[8]);
  2802. console_printf_terminal(" Capabilities 0x%02x%02x\n", bssid->IEs[10], bssid->IEs[11]);
  2803. console_printf_terminal(" Variable IEs:\n");
  2804. for (index=12; index<bssid->IELength; index++)
  2805. {
  2806. if ((index-12)%8 == 0)
  2807. {
  2808. console_printf_terminal("\n ");
  2809. }
  2810. console_printf_terminal("0x%02x ",bssid->IEs[index]);
  2811. }
  2812. console_printf_terminal("\n");
  2813. }
  2814. bssid = (OS_802_11_BSSID_EX *) (((char *) bssid) + bssid->Length);
  2815. number_items--;
  2816. }
  2817. console_printf_terminal("Infra.mode:");
  2818. print_available_values(BSS_type);
  2819. }
  2820. free(list);
  2821. }
  2822. #ifdef _WINDOWS
  2823. #else
  2824. PACKED_STRUCT( OS_802_11_BSSID_EX_TEMP,
  2825. tiUINT32 Length;
  2826. OS_802_11_MAC_ADDRESS MacAddress;
  2827. PACKED_UNION(Union,
  2828. tiUINT8 Reserved[2];
  2829. tiUINT16 Capabilities;
  2830. );
  2831. OS_802_11_SSID Ssid;
  2832. tiUINT32 Privacy;
  2833. OS_802_11_RSSI Rssi;
  2834. OS_802_11_NETWORK_TYPE NetworkTypeInUse;
  2835. OS_802_11_CONFIGURATION Configuration;
  2836. OS_802_11_NETWORK_MODE InfrastructureMode;
  2837. OS_802_11_RATES_EX SupportedRates;
  2838. tiUINT32 IELength;
  2839. tiUINT8 IEs[MAX_BEACON_BODY_LENGTH+sizeof(OS_802_11_FIXED_IEs)];
  2840. );
  2841. #endif
  2842. void cmd_FullPrimaryBbssid(ConParm_t parm[], U16 nParms)
  2843. {
  2844. OS_802_11_BSSID_EX_TEMP bssid;
  2845. OS_802_11_BSSID_EX_TEMP *pBssid = &bssid;
  2846. UINT32 index;
  2847. char buffer[8] ;
  2848. int Qos = 0;
  2849. buffer[0] ='\0';
  2850. UNUSED(nParms);
  2851. UNUSED(parm);
  2852. memset(pBssid, 0, sizeof(OS_802_11_BSSID_EX));
  2853. pBssid->Length = sizeof(OS_802_11_BSSID_EX) + sizeof(OS_802_11_FIXED_IEs) + MAX_BEACON_BODY_LENGTH;
  2854. if( TI_GetPrimaryBSSIDInfo(g_id_adapter, (OS_802_11_BSSID_EX*)pBssid))
  2855. return ;
  2856. console_printf_terminal("Primary BssId: Length = %d, IELength=%d \n" , pBssid->Length, pBssid->IELength);
  2857. if (pBssid->Length > sizeof(OS_802_11_BSSID_EX) + sizeof(OS_802_11_FIXED_IEs) + MAX_BEACON_BODY_LENGTH)
  2858. {
  2859. console_printf_terminal("Error - Length = %d is too long!!\n", pBssid->Length);
  2860. return;
  2861. }
  2862. if (pBssid->Length < pBssid->IELength)
  2863. {
  2864. console_printf_terminal("Error - IELength = %d is too long!!\n", pBssid->IELength);
  2865. pBssid->IELength = 50;
  2866. print_mac_2_str(pBssid->MacAddress),
  2867. console_printf_terminal("SSID len=%d\n", pBssid->Ssid.SsidLength);
  2868. return;
  2869. }
  2870. console_printf_terminal("%17s %7s %4s %5s %7s %10s %s\n", "MAC", "Privacy", "Rssi", "Infra", "Channel","Qos ", "SSID");
  2871. Qos = parseBssidIe((OS_802_11_BSSID_EX*)pBssid);
  2872. if (Qos & dot11_WME_OUI_TYPE)
  2873. {
  2874. strcpy(buffer, "WME ");
  2875. }
  2876. if (Qos == 0)
  2877. {
  2878. strcpy(buffer, "NONE ");
  2879. }
  2880. console_printf_terminal("%s %7u %4d %5d %7d %10s %s\n",
  2881. print_mac_2_str(pBssid->MacAddress),
  2882. pBssid->Privacy, pBssid->Rssi,
  2883. pBssid->InfrastructureMode, Freq2Chan(pBssid->Configuration.Union.channel),
  2884. buffer,
  2885. get_ssid_string(&pBssid->Ssid) );
  2886. {
  2887. console_printf_terminal(" TSF 0x%02x-0x%02x-0x%02x-0x%02x-0x%02x-0x%02x-0x%02x-0x%02x\n",
  2888. pBssid->IEs[0], pBssid->IEs[1], pBssid->IEs[2], pBssid->IEs[3],
  2889. pBssid->IEs[4], pBssid->IEs[5], pBssid->IEs[6], pBssid->IEs[7]);
  2890. console_printf_terminal(" BeaconInterval 0x%02x%02x\n", pBssid->IEs[9], pBssid->IEs[8]);
  2891. console_printf_terminal(" Capabilities 0x%02x%02x\n", pBssid->IEs[10], pBssid->IEs[11]);
  2892. console_printf_terminal(" Variable IEs:\n");
  2893. for (index=12; index<pBssid->IELength; index++)
  2894. {
  2895. if ((index-12)%8 == 0)
  2896. {
  2897. console_printf_terminal("\n ");
  2898. }
  2899. console_printf_terminal("0x%02x ",pBssid->IEs[index]);
  2900. }
  2901. console_printf_terminal("\n");
  2902. }
  2903. console_printf_terminal("\nInfra.mode:");
  2904. print_available_values(BSS_type);
  2905. }
  2906. void cmd_file_load(ConParm_t parm[], U16 nParms)
  2907. {
  2908. consoleRunScript((char *) parm[0].value);
  2909. }
  2910. #ifdef TI_DBG
  2911. struct report_bit_desc_t
  2912. {
  2913. int index;
  2914. char *desc;
  2915. };
  2916. struct report_bit_desc_t report[] =
  2917. {
  2918. /* Set 0 */
  2919. { CONFIG_MGR_MODULE_LOG, "CONFIG_MGR" },
  2920. { SME_SM_MODULE_LOG, "SME_SM" },
  2921. { SITE_MGR_MODULE_LOG, "SITE_MGR" },
  2922. { CONN_MODULE_LOG, "CONN" },
  2923. { MLME_SM_MODULE_LOG, "MLMEE" },
  2924. { AUTH_MODULE_LOG, "AUTH" },
  2925. { ASSOC_MODULE_LOG, "ASSOC" },
  2926. { RX_DATA_MODULE_LOG, "RX_DATA" },
  2927. { TX_DATA_MODULE_LOG, "TX_DATA" },
  2928. { CTRL_DATA_MODULE_LOG, "CTRL_DATA" },
  2929. { RSN_MODULE_LOG, "RSN" },
  2930. { HAL_RX_MODULE_LOG, "HAL_RX" },
  2931. { HAL_TX_MODULE_LOG, "HAL_TX" },
  2932. { HAL_CTRL_MODULE_LOG, "HAL_CTRL" },
  2933. { HAL_SECURITY_MODULE_LOG, "HAL_SECUR" },
  2934. { MEM_MGR_MODULE_LOG, "MEM_MGR" },
  2935. { REPORT_MODULE_LOG, "REPORT" },
  2936. { SITE_UPDATE_MODULE_LOG, "SITE_UPDATE" },
  2937. { REGULATORY_DOMAIN_MODULE_LOG, "REG_DOMAIN" },
  2938. { MEASUREMENT_MNGR_MODULE_LOG, "MEASUREMENT_MNGR" },
  2939. { MEASUREMENT_SRV_MODULE_LOG, "MEASUREMENT_SRV" },
  2940. { SOFT_GEMINI_MODULE_LOG, "SOFT_GEMINI" },
  2941. { SC_MODULE_LOG, "SC (Switch Channel)" },
  2942. { EXC_MANAGER_MODULE_LOG, "EXC_MANAGER" },
  2943. { ROAMING_MANAGER_MODULE_LOG, "ROAMING_MANAGER" },
  2944. { QOS_MANAGER_MODULE_LOG, "QOS_MANAGER" },
  2945. { TRAFFIC_ADM_CTRL_MODULE_LOG, "TRAFFIC_ADM_CTRL" },
  2946. { POWER_MANAGER_MODULE_LOG, "POWER_MANAGER" },
  2947. { POWER_CONTROL_MODULE_LOG, "POWER_CONTROL" },
  2948. { POWER_SERVER_MODULE_LOG, "POWER_SERVER" },
  2949. { ELP_MODULE_LOG, "ELP" },
  2950. { SCR_MODULE_LOG, "SCR" },
  2951. { SCAN_SRV_MODULE_LOG, "SCAN_SRV" },
  2952. { SCAN_CNCN_MODULE_LOG, "SCAN_CNCN" },
  2953. { SCAN_MNGR_MODULE_LOG, "SCAN_MNGR" },
  2954. { GWSI_ADAPT_MODULE_LOG, "GWSI_ADAPT" },
  2955. { GWSI_ADAPT_CB_MODULE_LOG, "GWSI_ADAPT_CB" },
  2956. { CORE_ADAPT_MODULE_LOG, "CORE_ADAPT" },
  2957. { TX_HW_QUEUE_MODULE_LOG, "TX HW QUEUE" },
  2958. { TX_CTRL_BLK_MODULE_LOG, "TX CTRL BLK" },
  2959. { TX_RESULT_MODULE_LOG, "TX RESULT" },
  2960. { TNETW_IF_MODULE_LOG, "TNETW IF" },
  2961. { TNETW_ARBITER_MODULE_LOG, "TNETW ARBITER" },
  2962. { CURR_BSS_MODULE_LOG, "CURR_BSS" },
  2963. { FW_EVENT_MODULE_LOG, "FW_EVENT" },
  2964. { CMD_MBOX_MODULE_LOG, "CMD_MBOX" },
  2965. { CMDQUEUE_MODULE_LOG, "CMD_QUEUE" },
  2966. { EVENT_MBOX_MODULE_LOG, "EVENT_MBOX"},
  2967. { TNETW_DRV_MODULE_LOG, "TNETW DRV" },
  2968. { TNETW_XFER_MODULE_LOG, "TX XFER" },
  2969. { RECOVERY_MGR_MODULE_LOG, "RECOVERY MGR" },
  2970. { RECOVERY_CTRL_MODULE_LOG, "RECOVERY CTRL" },
  2971. { HW_INIT_MODULE_LOG, "HW INIT" }
  2972. };
  2973. struct rep_severity_level_t {
  2974. U8 level;
  2975. char *desc;
  2976. };
  2977. static struct rep_severity_level_t report_severity_level[] = {
  2978. { 0, "----" },
  2979. { WLAN_SEVERITY_INIT, "INIT", },
  2980. { WLAN_SEVERITY_INFORMATION, "INFORMATION", },
  2981. { WLAN_SEVERITY_WARNING, "WARNING", },
  2982. { WLAN_SEVERITY_ERROR, "ERROR", },
  2983. { WLAN_SEVERITY_FATAL_ERROR, "FATAL_ERROR", },
  2984. { WLAN_SEVERITY_SM, "SM", },
  2985. { WLAN_SEVERITY_CONSOLE, "CONSOLE", },
  2986. { WLAN_SEVERITY_DEBUG_RX, "DEBUG RX", },
  2987. { WLAN_SEVERITY_DEBUG_TX, "DEBUG TX", },
  2988. { WLAN_SEVERITY_DEBUG_CONTROL,"DEBUG CONTROL", },
  2989. { WLAN_SEVERITY_GWSI_RECORDING,"GWSI RECORDING"}
  2990. };
  2991. static void print_report_module_desc(void)
  2992. {
  2993. int i;
  2994. tiUINT8 module_table[WLAN_MAX_LOG_MODULES];
  2995. if (!TI_GetReportModule(g_id_adapter, module_table))
  2996. {
  2997. console_printf_terminal("-------------------------------\n");
  2998. console_printf_terminal("%.5s\tState\t %s\n", "Index", "Desc");
  2999. for( i = 0; i < SIZE_ARR(report); i++)
  3000. {
  3001. /* Check if there is string content (the first character is not ZERO) */
  3002. if( report[i].desc[0] )
  3003. {
  3004. console_printf_terminal("%3d\t%c\t%s\n", report[i].index, (module_table[i] == '1') ? '+' : ' ', report[i].desc );
  3005. }
  3006. }
  3007. }
  3008. else
  3009. {
  3010. console_printf_terminal("Error reading the report table form the driver\n");
  3011. }
  3012. }
  3013. void cmd_report_add(ConParm_t parm[], U16 nParms)
  3014. {
  3015. tiUINT8 module_table[WLAN_MAX_LOG_MODULES];
  3016. if( nParms != 1)
  3017. {
  3018. print_report_module_desc();
  3019. console_printf_terminal( "* Use '%d' (max index) to set all table.\n", WLAN_MAX_LOG_MODULES);
  3020. }
  3021. else if(!TI_GetReportModule(g_id_adapter, module_table))
  3022. {
  3023. if (parm[0].value == WLAN_MAX_LOG_MODULES)
  3024. {
  3025. memset(module_table, '1', sizeof(module_table));
  3026. }
  3027. else if(parm[0].value < WLAN_MAX_LOG_MODULES)
  3028. {
  3029. module_table[parm[0].value] = '1';
  3030. }
  3031. TI_SetReportModule(g_id_adapter, module_table);
  3032. }
  3033. }
  3034. void cmd_report_clear(ConParm_t parm[], U16 nParms)
  3035. {
  3036. tiUINT8 module_table[WLAN_MAX_LOG_MODULES + 1];
  3037. if( nParms != 1)
  3038. {
  3039. print_report_module_desc();
  3040. console_printf_terminal( "* Use '%d' (max index) to clear all table.\n", WLAN_MAX_LOG_MODULES);
  3041. }
  3042. else if(!TI_GetReportModule(g_id_adapter, module_table))
  3043. {
  3044. if (parm[0].value == WLAN_MAX_LOG_MODULES)
  3045. {
  3046. memset(module_table, '0', WLAN_MAX_LOG_MODULES);
  3047. }
  3048. else if (parm[0].value < WLAN_MAX_LOG_MODULES)
  3049. {
  3050. module_table[parm[0].value] = '0';
  3051. }
  3052. TI_SetReportModule(g_id_adapter, module_table);
  3053. }
  3054. }
  3055. void cmd_report_set(ConParm_t parm[], U16 nParms)
  3056. {
  3057. U8 *ModuleTable = (U8 *)parm[0].value;
  3058. if( nParms != 1)
  3059. {
  3060. print_report_module_desc();
  3061. }
  3062. else
  3063. {
  3064. #ifdef _WINDOWS
  3065. #endif /* _WINDOWS */
  3066. TI_SetReportModule(g_id_adapter, ModuleTable);
  3067. }
  3068. }
  3069. void cmd_hw_register(ConParm_t parm[], U16 nParms)
  3070. {
  3071. tiUINT32 data;
  3072. #ifndef _WINDOWS
  3073. usleep(10 * 1000);
  3074. #elif defined (_WINDOWS)
  3075. #endif
  3076. if( nParms == 1 )
  3077. {
  3078. if( !TI_hwReadRegister(g_id_adapter, parm[0].value, &data ) )
  3079. {
  3080. #ifdef _WINDOWS
  3081. #endif
  3082. }
  3083. }
  3084. else
  3085. {
  3086. TI_hwWriteRegister(g_id_adapter, parm[0].value, parm[1].value );
  3087. }
  3088. }
  3089. void cmd_debug_driver_print(ConParm_t parm[], U16 nParms)
  3090. {
  3091. tiUINT32 func_id = ( nParms > 0 ) ? parm[0].value : 0;
  3092. tiUINT32 opt_param = ( nParms > 1 ) ? parm[1].value : 0;
  3093. tiUINT32 buf[2] = { func_id, opt_param };
  3094. console_printf_terminal("DRV_PRINT: FUNC:%u, PARAM:%u\n", func_id, opt_param);
  3095. TI_DisplayStats(g_id_adapter, (tiUINT8 *) buf, sizeof(buf) );
  3096. /* tiwlan_driver_debug_print( g_drv_name, func_id, opt_param ); */
  3097. }
  3098. void cmd_debug_buffer_put(ConParm_t parm[], U16 nParms)
  3099. {
  3100. tiUINT32 func_id = ( nParms > 0 ) ? parm[0].value : 0;
  3101. tiUINT32 opt_param = ( nParms > 1 ) ? parm[1].value : 0;
  3102. tiUINT8 buf[260]; /* no more then 256 + func id */
  3103. if (opt_param == 0)
  3104. return;
  3105. *(tiUINT32*) buf = func_id;
  3106. memcpy (buf + sizeof(func_id),(char *)opt_param,strlen((char *)opt_param));
  3107. console_printf_terminal("cmd_debug_buffer_put: FUNC:%u, PARAM:%u\n", func_id, opt_param);
  3108. TI_DisplayStats(g_id_adapter, (tiUINT8 *) buf, strlen((char *)opt_param) + sizeof(func_id));
  3109. /* tiwlan_driver_debug_print( g_drv_name, func_id, opt_param ); */
  3110. }
  3111. static void print_severity_table(tiUINT8 *pTable)
  3112. {
  3113. int i;
  3114. console_printf_terminal("Severity:\n");
  3115. console_printf_terminal("-------------------------------\n");
  3116. console_printf_terminal("%14s\tState\t%s\n", "Severity level", "Desc");
  3117. for( i=1; i<SIZE_ARR(report_severity_level); i++ )
  3118. {
  3119. console_printf_terminal("%d\t%c\t%s\n", report_severity_level[i].level, (pTable[i] == '1') ? '+' : ' ',report_severity_level[i].desc );
  3120. }
  3121. console_printf_terminal( "* Use '0' to clear all table.\n");
  3122. console_printf_terminal( "* Use '%d' (max index) to set all table.\n", SIZE_ARR(report_severity_level));
  3123. }
  3124. void cmd_report_severity_table(ConParm_t parm[], U16 nParms)
  3125. {
  3126. U8 *pSeverityTable = (U8 *)parm[0].value;
  3127. tiUINT8 SeverityTable[WLAN_MAX_SEVERITIES];
  3128. #ifdef _WINDOWS
  3129. #endif /* _WINDOWS */
  3130. if( nParms != 1)
  3131. {
  3132. if (!TI_GetReportSeverity( g_id_adapter, &SeverityTable[0]))
  3133. {
  3134. print_severity_table(SeverityTable);
  3135. }
  3136. }
  3137. else
  3138. {
  3139. TI_SetReportSeverity(g_id_adapter, pSeverityTable);
  3140. }
  3141. }
  3142. void cmd_report_severity_level(ConParm_t parm[], U16 nParms)
  3143. {
  3144. tiUINT8 SeverityTable[WLAN_MAX_SEVERITIES];
  3145. /* Get the current report severity */
  3146. if (!TI_GetReportSeverity( g_id_adapter, &SeverityTable[0]))
  3147. {
  3148. if(nParms == 0)
  3149. {
  3150. /* Parameters error - print the current table values */
  3151. print_severity_table(SeverityTable);
  3152. }
  3153. else
  3154. {
  3155. if (parm[0].value == 0)
  3156. {
  3157. /* Disable all severity levels */
  3158. memset(SeverityTable, (int)('0'), sizeof(SeverityTable));
  3159. TI_SetReportSeverity(g_id_adapter, SeverityTable);
  3160. }
  3161. else if (parm[0].value == SIZE_ARR(report_severity_level))
  3162. {
  3163. /* Enable all severity levels */
  3164. memset(SeverityTable, (int)('1'), sizeof(SeverityTable));
  3165. TI_SetReportSeverity(g_id_adapter, SeverityTable);
  3166. }
  3167. else if (parm[0].value < SIZE_ARR(report_severity_level))
  3168. {
  3169. console_printf_terminal("Toggle severity level %#lx\n", parm[0].value);
  3170. if (SeverityTable[parm[0].value] == '1')
  3171. {
  3172. /* The level is enabled - Disable it */
  3173. SeverityTable[parm[0].value] = '0';
  3174. }
  3175. else
  3176. {
  3177. /* The bit is disabled - Enable it */
  3178. SeverityTable[parm[0].value] = '1';
  3179. }
  3180. TI_SetReportSeverity(g_id_adapter, SeverityTable);
  3181. }
  3182. else
  3183. {
  3184. console_printf_terminal("invalid level value: %#lx\n", parm[0].value );
  3185. }
  3186. }
  3187. }
  3188. else
  3189. {
  3190. console_printf_terminal("Error retriving the severity table from the driver\n");
  3191. }
  3192. }
  3193. #ifdef DRIVER_PROFILING
  3194. void cmd_profile_report(ConParm_t parm[], U16 nParms)
  3195. {
  3196. TI_ProfileReport( g_id_adapter );
  3197. }
  3198. void cmd_profile_cpu_estimator_command(ConParm_t parm[], U16 nParms)
  3199. {
  3200. /* reset or stop command */
  3201. if (nParms == 1) {
  3202. //printf("cpu_profile_cpu_estimator: param[0] = %d\n", (tiUINT8)parm[0].value);
  3203. TI_CpuEstimatorCommand(g_id_adapter, (tiUINT8)parm[0].value, 0);
  3204. }
  3205. else /* start command */
  3206. {
  3207. //printf("cpu_profile_cpu_estimator: param[0] = %d, param[1] = %d\n",(tiUINT8)parm[0].value,(tiUINT32)parm[1].value);
  3208. TI_CpuEstimatorCommand(g_id_adapter, (tiUINT8)parm[0].value,(tiUINT32)parm[1].value);
  3209. }
  3210. }
  3211. #endif
  3212. void cmd_report_os_dbg_state(ConParm_t parm[], U16 nParms)
  3213. {
  3214. UINT32 dwOsDbgState;
  3215. if(nParms == 0) {
  3216. if (TI_GetOsDbgState( g_id_adapter, &dwOsDbgState) == TI_RESULT_OK) {
  3217. console_printf_terminal("OsDbgState %d (0x%08X)\n", dwOsDbgState, dwOsDbgState);
  3218. }
  3219. else {
  3220. console_printf_terminal("Error retriving the OsDbgState from the driver\n");
  3221. }
  3222. }
  3223. else {
  3224. TI_SetOsDbgState(g_id_adapter, parm[0].value);
  3225. }
  3226. }
  3227. #endif /* define TI_DBG */
  3228. void cmd_privacy_auth(ConParm_t parm[], U16 nParms)
  3229. {
  3230. if( nParms )
  3231. {
  3232. TI_SetAuthenticationMode( g_id_adapter, (tiUINT32)parm[0].value );
  3233. /*console_printf_terminal("CLI-AuthenticationMode: - %x",(tiUINT32)parm[0].value);*/
  3234. }
  3235. else
  3236. {
  3237. static named_value_t auth_mode_type[] = {
  3238. { os802_11AuthModeOpen, "Open" },
  3239. { os802_11AuthModeShared, "Shared" },
  3240. { os802_11AuthModeAutoSwitch, "AutoSwitch"},
  3241. { os802_11AuthModeWPA, "WPA" },
  3242. { os802_11AuthModeWPAPSK, "WPAPSK" },
  3243. { os802_11AuthModeWPANone, "WPANone" },
  3244. { os802_11AuthModeWPA2, "WPA2" },
  3245. { os802_11AuthModeWPA2PSK, "WPA2PSK" },
  3246. /*{ os802_11AuthModeMax, "Max" }*/
  3247. };
  3248. OS_802_11_AUTHENTICATION_MODE data;
  3249. if( !TI_GetAuthenticationMode( g_id_adapter, &data ) )
  3250. {
  3251. print_available_values(auth_mode_type);
  3252. console_printf_terminal("AuthenticationMode=%d\n", data );
  3253. }
  3254. }
  3255. }
  3256. void cmd_privacy_eap(ConParm_t parm[], U16 nParms)
  3257. {
  3258. if( nParms )
  3259. {
  3260. TI_SetEAPType( g_id_adapter, (OS_802_11_EAP_TYPES) parm[0].value );
  3261. TI_SetEAPTypeDriver( g_id_adapter, (OS_802_11_EAP_TYPES) parm[0].value );
  3262. }
  3263. else
  3264. {
  3265. static named_value_t eap_type[] = {
  3266. { OS_EAP_TYPE_GENERIC_TOKEN_CARD, "TOKEN" },
  3267. { OS_EAP_TYPE_TLS, "TLS" },
  3268. INCLUDE_EXC_TYPE_NAMES
  3269. { OS_EAP_TYPE_TTLS, "TTLS" },
  3270. { OS_EAP_TYPE_PEAP, "PEAP" },
  3271. {OS_EAP_TYPE_MS_CHAP_V2, "CHAP" }
  3272. };
  3273. /*temp_closed
  3274. OS_802_11_EAP_TYPES data;
  3275. if( !TI_GetEAPType( g_id_adapter, &data ) )
  3276. {
  3277. print_available_values(eap_type);
  3278. console_printf_terminal("EAP Type = %d\n", data );
  3279. }
  3280. */
  3281. print_available_values(eap_type);
  3282. }
  3283. }
  3284. void cmd_privacy_encrypt(ConParm_t parm[], U16 nParms)
  3285. {
  3286. OS_802_11_ENCRYPTION_TYPES data;
  3287. if( nParms )
  3288. {
  3289. TI_SetEncryptionType( g_id_adapter, (OS_802_11_ENCRYPTION_TYPES) parm[0].value );
  3290. }
  3291. else
  3292. {
  3293. print_available_values(encrypt_type);
  3294. console_printf_terminal("Encryption=%d\n", !TI_GetEncryptionType( g_id_adapter, &data ) ? data : -1 );
  3295. }
  3296. }
  3297. void cmd_privacy_credent(ConParm_t parm[], U16 nParms)
  3298. {
  3299. if( nParms == 2 )
  3300. {
  3301. TI_SetCredentials(g_id_adapter,(tiCHAR *) parm[0].value, (tiCHAR *) parm[1].value);
  3302. }
  3303. else if( nParms == 1 )
  3304. TI_SetCredentials(g_id_adapter,(tiCHAR *) parm[0].value, NULL);
  3305. else
  3306. return;
  3307. }
  3308. void cmd_privacy_PSKPassphrase(ConParm_t parm[], U16 nParms)
  3309. {
  3310. char buf[PSK_BUFF_LEN], *pPassphrase;
  3311. unsigned int len, is_hex_key = 0;
  3312. if( nParms == 0 )
  3313. return;
  3314. len = strlen((char*)(parm[0].value));
  3315. pPassphrase = (char*)(parm[0].value);
  3316. memset(buf,0,PSK_BUFF_LEN);
  3317. if( nParms >= 2 )
  3318. {
  3319. #ifdef _WINDOWS
  3320. #else
  3321. if( !stricmp((char *) parm[1].value, "hex") )
  3322. is_hex_key = 1;
  3323. else if(!stricmp((char *) parm[1].value, "text"))
  3324. is_hex_key = 0;
  3325. #endif
  3326. }
  3327. if( is_hex_key )
  3328. {
  3329. if( len != PSK_HEXA_LENGTH )
  3330. {
  3331. console_printf_terminal("The hexa PSKPassphrase must be at length of %d hexa digits \n",PSK_HEXA_LENGTH);
  3332. return ;
  3333. }
  3334. }
  3335. else
  3336. {
  3337. if (len > MAX_PSK_STRING_LENGTH || len < MIN_PSK_STRING_LENGTH)
  3338. {
  3339. console_printf_terminal("The PSKPassphrase must be between %d to %d chars \n", MIN_PSK_STRING_LENGTH, MAX_PSK_STRING_LENGTH);
  3340. return ;
  3341. }
  3342. }
  3343. memcpy(buf, (char*)(parm[0].value), len);
  3344. /*TI_SetPSKPassPhrase*/
  3345. TI_SetPSK(g_id_adapter, (tiCHAR *)buf);
  3346. }
  3347. void cmd_privacy_certificate(ConParm_t parm[], U16 nParms)
  3348. {
  3349. #ifdef _WINDOWS // TRS:HLC
  3350. #else
  3351. console_printf_terminal("Set sertificate file : %s\n", (char*)parm[0].value);
  3352. if(nParms == 1 )
  3353. TI_SetCertificateParameters(g_id_adapter, (void*)parm[0].value, 0);
  3354. else if(nParms == 2 )
  3355. TI_SetCertificateParameters(g_id_adapter, (void*)parm[0].value,
  3356. (unsigned int)parm[1].value);
  3357. else return;
  3358. #endif
  3359. //TRS end
  3360. }
  3361. void cmd_privacy_wpa_options(ConParm_t parm[], U16 nParms)
  3362. {
  3363. if( nParms )
  3364. {
  3365. TI_SetWpaOptions(g_id_adapter, parm[0].value );
  3366. }
  3367. else
  3368. {
  3369. tiUINT32 data;
  3370. static named_value_t wpa_options[] = {
  3371. { OS_802_11_OPTION_ENABLE_PROMOTE_MODE, "PROMOTE_MODE" },
  3372. { OS_802_11_OPTION_ENABLE_PROMOTE_CIPHER, "PROMOTE_CIPHER" },
  3373. { OS_802_11_OPTION_ENABLE_ALL, "All" }
  3374. };
  3375. print_available_values(wpa_options);
  3376. if( !TI_GetWpaOptions(g_id_adapter, &data ) )
  3377. console_printf_terminal("WPA option=%d\n", data );
  3378. }
  3379. }
  3380. void cmd_privacy_getdefaultkey(ConParm_t parm[], U16 nParms)
  3381. {
  3382. tiUINT32 DefaultKeyId;
  3383. if (OK == TI_GetDefaultWepKey(g_id_adapter, &DefaultKeyId))
  3384. console_printf_terminal("WEP default key ID = %d\n", DefaultKeyId );
  3385. }
  3386. unsigned int char_2_hexa( char c )
  3387. {
  3388. if( c >= '0' && c <= '9' )
  3389. return c - '0';
  3390. else if( tolower(c) >= 'a' && tolower(c) <= 'f' )
  3391. return tolower(c) - 'a' + 0x0a;
  3392. console_printf_terminal("invalid symbol '%c'\n", c );
  3393. return (unsigned int) -1;
  3394. }
  3395. void cmd_privacy_addkey(ConParm_t parm[], U16 nParms)
  3396. {
  3397. OS_802_11_WEP data;
  3398. char *buf;
  3399. unsigned int i, len, is_hex_key = 1;
  3400. U32 val, val_l;
  3401. unsigned int key_id = 0;
  3402. unsigned int def_flag = 0;
  3403. buf = (char *) parm[0].value;
  3404. key_id = (unsigned int)parm[1].value;
  3405. if( parm[2].value )
  3406. def_flag = 0x80000000;
  3407. if( nParms >= 4 )
  3408. {
  3409. #ifdef _WINDOWS
  3410. #else
  3411. if( !stricmp((char *) parm[3].value, "hex") )
  3412. is_hex_key = 1;
  3413. else if(!stricmp((char *) parm[3].value, "text"))
  3414. is_hex_key = 0;
  3415. #endif
  3416. }
  3417. memset(data.KeyMaterial,0,sizeof(data.KeyMaterial));
  3418. len = strlen(buf);
  3419. if( is_hex_key )
  3420. {
  3421. if( len % 2 )
  3422. {
  3423. console_printf_terminal("The hexa key should be even length\n");
  3424. return ;
  3425. }
  3426. if(len <= 10) /*10 is number of character for key length 40 bit*/
  3427. data.KeyLength = 5;
  3428. else if(len <= 26) /*26 is number of character for key length 128 bit*/
  3429. data.KeyLength = 13;
  3430. else if(len <= 58) /*58 is number of character for key length 256 bit*/
  3431. data.KeyLength = 29;
  3432. else {
  3433. console_printf_terminal("**Error key length\n" );
  3434. return;
  3435. }
  3436. for( i=0; *buf && i < data.KeyLength; i++ )
  3437. {
  3438. val = char_2_hexa(*buf);
  3439. if( val == (U32) -1 )
  3440. return;
  3441. val_l = char_2_hexa(*(++buf));
  3442. if( val_l == (U32) -1 )
  3443. return;
  3444. data.KeyMaterial[i] = (tiUINT8)((val << 4) | val_l);
  3445. buf++;
  3446. }
  3447. }
  3448. else /* for ascii key */
  3449. {
  3450. if(len <= 5) /*10 is number of character for key length 40 bit*/
  3451. data.KeyLength = 5;
  3452. else if(len <= 13) /*26 is number of character for key length 128 bit*/
  3453. data.KeyLength = 13;
  3454. else if(len <= 29) /*58 is number of character for key length 256 bit*/
  3455. data.KeyLength = 29;
  3456. else {
  3457. console_printf_terminal("**Error key length\n" );
  3458. return;
  3459. }
  3460. memcpy(data.KeyMaterial, buf, len );
  3461. }
  3462. data.KeyIndex = def_flag | key_id;
  3463. data.Length = sizeof(OS_802_11_WEP);
  3464. #ifdef DEBUG_MESSAGES
  3465. console_printf_terminal("cmd_privacy_addkey len = %d, type: %s\nkey:", data.KeyLength, is_hex_key ? "hex" : "text");
  3466. for(i=0; i<SIZE_ARR(data.KeyMaterial); i++ )
  3467. console_printf_terminal("%02x", (U32) data.KeyMaterial[i]);
  3468. console_printf_terminal("\n");
  3469. #endif /*DEBUG_MESSAGES */
  3470. TI_AddWEPKey(g_id_adapter, &data);
  3471. }
  3472. void cmd_privacy_removekey(ConParm_t parm[], U16 nParms)
  3473. {
  3474. TI_RemoveWEPKey(g_id_adapter, (U32) parm[0].value );
  3475. }
  3476. void cmd_privacy_key_type(ConParm_t parm[], U16 nParms)
  3477. {
  3478. if( nParms )
  3479. {
  3480. TI_SetKeyType( g_id_adapter, (OS_802_11_KEY_TYPES)parm[0].value );
  3481. console_printf_terminal("CLI-: KeyType - %x\n",(tiUINT32)parm[0].value);
  3482. }
  3483. else
  3484. {
  3485. static named_value_t key_type[] = {
  3486. { OS_KEY_TYPE_STATIC, "STATIC" },
  3487. { OS_KEY_TYPE_DYNAMIC, "DYNAMIC"}
  3488. };
  3489. print_available_values(key_type);
  3490. }
  3491. }
  3492. void cmd_privacy_mixed_mode(ConParm_t parm[], U16 nParms)
  3493. {
  3494. tiBOOL data;
  3495. if( nParms == 0 )
  3496. {
  3497. console_printf_terminal("Mixed Mode: 0 - FALSE, 1 - TRUE\n");
  3498. data = FALSE;
  3499. if( !TI_GetMixedMode(g_id_adapter, &data ) );
  3500. console_printf_terminal("Mixed Mode =%s\n", data ? "True" : "False" );
  3501. }
  3502. else /* param <read-only!!> */
  3503. TI_SetMixedMode(g_id_adapter, (BOOL) parm[0].value);
  3504. }
  3505. /************** Roaming Manager functions ******************/
  3506. void cmd_Roaming_enable(ConParm_t parm[], U16 nParms)
  3507. {
  3508. TI_GetRoamingConfiguration (g_id_adapter, (UINT8*)&roamingMngrConfigParams, sizeof(roamingMngrConfigParams_t));
  3509. roamingMngrConfigParams.roamingMngrConfig.enableDisable = ROAMING_ENABLED;
  3510. TI_SetRoamingConfiguration (g_id_adapter, (UINT8*)&roamingMngrConfigParams, sizeof(roamingMngrConfigParams_t));
  3511. console_printf_terminal("Roaming is enabled \n");
  3512. }
  3513. void cmd_Roaming_disable(ConParm_t parm[], U16 nParms)
  3514. {
  3515. TI_GetRoamingConfiguration (g_id_adapter, (UINT8*)&roamingMngrConfigParams, sizeof(roamingMngrConfigParams_t));
  3516. roamingMngrConfigParams.roamingMngrConfig.enableDisable = ROAMING_DISABLED;
  3517. TI_SetRoamingConfiguration (g_id_adapter, (UINT8*)&roamingMngrConfigParams, sizeof(roamingMngrConfigParams_t));
  3518. console_printf_terminal("Roaming is disabled \n");
  3519. }
  3520. void cmd_Roaming_lowPassFilter(ConParm_t parm[], U16 nParms)
  3521. {
  3522. TI_GetRoamingConfiguration (g_id_adapter, (UINT8*)&roamingMngrConfigParams, sizeof(roamingMngrConfigParams_t));
  3523. if( nParms != 0 )
  3524. {
  3525. roamingMngrConfigParams.roamingMngrConfig.lowPassFilterRoamingAttempt = (UINT16) parm[0].value;
  3526. }
  3527. TI_SetRoamingConfiguration (g_id_adapter, (UINT8*)&roamingMngrConfigParams, sizeof(roamingMngrConfigParams_t));
  3528. console_printf_terminal("Time in sec to wait before low quality Roaming Triggers, \n lowPassFilterRoamingAttempt = %d sec\n",
  3529. roamingMngrConfigParams.roamingMngrConfig.lowPassFilterRoamingAttempt);
  3530. }
  3531. void cmd_Roaming_qualityIndicator(ConParm_t parm[], U16 nParms)
  3532. {
  3533. TI_GetRoamingConfiguration (g_id_adapter, (UINT8*)&roamingMngrConfigParams, sizeof(roamingMngrConfigParams_t));
  3534. if( nParms != 0 )
  3535. {
  3536. roamingMngrConfigParams.roamingMngrConfig.apQualityThreshold = (S8) parm[0].value;
  3537. }
  3538. TI_SetRoamingConfiguration (g_id_adapter, (UINT8*)&roamingMngrConfigParams, sizeof(roamingMngrConfigParams_t));
  3539. console_printf_terminal("Quality indicator (RSSI) to be used when comparing AP List matching quality, \n apQualityThreshold = %d \n",
  3540. (roamingMngrConfigParams.roamingMngrConfig.apQualityThreshold));
  3541. }
  3542. void cmd_Roaming_dataRetryThreshold(ConParm_t parm[], U16 nParms)
  3543. {
  3544. TI_GetRoamingConfiguration (g_id_adapter, (UINT8*)&roamingMngrConfigParams, sizeof(roamingMngrConfigParams_t));
  3545. if( nParms != 0 )
  3546. {
  3547. roamingMngrConfigParams.roamingMngrThresholdsConfig.dataRetryThreshold = (UINT8) parm[0].value;
  3548. }
  3549. TI_SetRoamingConfiguration (g_id_adapter, (UINT8*)&roamingMngrConfigParams, sizeof(roamingMngrConfigParams_t));
  3550. console_printf_terminal("dataRetryThreshold = %d \n",
  3551. roamingMngrConfigParams.roamingMngrThresholdsConfig.dataRetryThreshold);
  3552. }
  3553. void cmd_Roaming_numExpectedTbttForBSSLoss(ConParm_t parm[], U16 nParms)
  3554. {
  3555. TI_GetRoamingConfiguration (g_id_adapter, (UINT8*)&roamingMngrConfigParams, sizeof(roamingMngrConfigParams_t));
  3556. if( nParms != 0 )
  3557. {
  3558. roamingMngrConfigParams.roamingMngrThresholdsConfig.numExpectedTbttForBSSLoss = (UINT8) parm[0].value;
  3559. }
  3560. TI_SetRoamingConfiguration (g_id_adapter, (UINT8*)&roamingMngrConfigParams, sizeof(roamingMngrConfigParams_t));
  3561. console_printf_terminal("Number of expected TBTTs for BSS Loss event, \n numExpectedTbttForBSSLoss = %d \n",
  3562. roamingMngrConfigParams.roamingMngrThresholdsConfig.numExpectedTbttForBSSLoss);
  3563. }
  3564. void cmd_Roaming_txRateThreshold(ConParm_t parm[], U16 nParms)
  3565. {
  3566. TI_GetRoamingConfiguration (g_id_adapter, (UINT8*)&roamingMngrConfigParams, sizeof(roamingMngrConfigParams_t));
  3567. if( nParms != 0 )
  3568. {
  3569. roamingMngrConfigParams.roamingMngrThresholdsConfig.txRateThreshold = (UINT8) parm[0].value;
  3570. }
  3571. TI_SetRoamingConfiguration (g_id_adapter, (UINT8*)&roamingMngrConfigParams, sizeof(roamingMngrConfigParams_t));
  3572. console_printf_terminal("txRateThreshold = %d \n",
  3573. roamingMngrConfigParams.roamingMngrThresholdsConfig.txRateThreshold);
  3574. }
  3575. void cmd_Roaming_lowRssiThreshold(ConParm_t parm[], U16 nParms)
  3576. {
  3577. TI_GetRoamingConfiguration (g_id_adapter, (UINT8*)&roamingMngrConfigParams, sizeof(roamingMngrConfigParams_t));
  3578. if( nParms != 0 )
  3579. {
  3580. roamingMngrConfigParams.roamingMngrThresholdsConfig.lowRssiThreshold = (S8) parm[0].value;
  3581. }
  3582. TI_SetRoamingConfiguration (g_id_adapter, (UINT8*)&roamingMngrConfigParams, sizeof(roamingMngrConfigParams_t));
  3583. console_printf_terminal("lowRssiThreshold = %d \n",
  3584. (roamingMngrConfigParams.roamingMngrThresholdsConfig.lowRssiThreshold));
  3585. }
  3586. void cmd_Roaming_lowSnrThreshold(ConParm_t parm[], U16 nParms)
  3587. {
  3588. TI_GetRoamingConfiguration (g_id_adapter, (UINT8*)&roamingMngrConfigParams, sizeof(roamingMngrConfigParams_t));
  3589. if( nParms != 0 )
  3590. {
  3591. roamingMngrConfigParams.roamingMngrThresholdsConfig.lowSnrThreshold = (S8)parm[0].value;
  3592. }
  3593. TI_SetRoamingConfiguration (g_id_adapter, (UINT8*)&roamingMngrConfigParams, sizeof(roamingMngrConfigParams_t));
  3594. console_printf_terminal("lowSnrThreshold = %d \n", roamingMngrConfigParams.roamingMngrThresholdsConfig.lowSnrThreshold);
  3595. }
  3596. void cmd_Roaming_lowQualityForBackgroungScanCondition(ConParm_t parm[], U16 nParms)
  3597. {
  3598. TI_GetRoamingConfiguration (g_id_adapter, (UINT8*)&roamingMngrConfigParams, sizeof(roamingMngrConfigParams_t));
  3599. if( nParms != 0 )
  3600. {
  3601. roamingMngrConfigParams.roamingMngrThresholdsConfig.lowQualityForBackgroungScanCondition = (S8) parm[0].value;
  3602. }
  3603. TI_SetRoamingConfiguration (g_id_adapter, (UINT8*)&roamingMngrConfigParams, sizeof(roamingMngrConfigParams_t));
  3604. console_printf_terminal("Indicator used to increase the background scan period when quality is low, \n lowQualityForBackgroungScanCondition = %d \n",
  3605. (roamingMngrConfigParams.roamingMngrThresholdsConfig.lowQualityForBackgroungScanCondition));
  3606. }
  3607. void cmd_Roaming_normalQualityForBackgroungScanCondition(ConParm_t parm[], U16 nParms)
  3608. {
  3609. TI_GetRoamingConfiguration (g_id_adapter, (UINT8*)&roamingMngrConfigParams, sizeof(roamingMngrConfigParams_t));
  3610. if( nParms != 0 )
  3611. {
  3612. roamingMngrConfigParams.roamingMngrThresholdsConfig.normalQualityForBackgroungScanCondition = (S8) parm[0].value;
  3613. }
  3614. TI_SetRoamingConfiguration (g_id_adapter, (UINT8*)&roamingMngrConfigParams, sizeof(roamingMngrConfigParams_t));
  3615. console_printf_terminal("Indicator used to reduce the background scan period when quality is normal, \n normalQualityForBackgroungScanCondition = %d \n",
  3616. (roamingMngrConfigParams.roamingMngrThresholdsConfig.normalQualityForBackgroungScanCondition));
  3617. }
  3618. void cmd_Roaming_rssiFilterWeight(ConParm_t parm[], U16 nParms)
  3619. {
  3620. TI_GetRoamingConfiguration (g_id_adapter, (UINT8*)&roamingMngrConfigParams, sizeof(roamingMngrConfigParams_t));
  3621. if( nParms != 0 )
  3622. {
  3623. roamingMngrConfigParams.roamingMngrThresholdsConfig.rssiFilterWeight = (UINT8) parm[0].value;
  3624. }
  3625. TI_SetRoamingConfiguration (g_id_adapter, (UINT8*)&roamingMngrConfigParams, sizeof(roamingMngrConfigParams_t));
  3626. console_printf_terminal("Rssi Filter Weight = %d \n",
  3627. (roamingMngrConfigParams.roamingMngrThresholdsConfig.rssiFilterWeight));
  3628. }
  3629. void cmd_Roaming_snrFilterWeight(ConParm_t parm[], U16 nParms)
  3630. {
  3631. TI_GetRoamingConfiguration (g_id_adapter, (UINT8*)&roamingMngrConfigParams, sizeof(roamingMngrConfigParams_t));
  3632. if( nParms != 0 )
  3633. {
  3634. roamingMngrConfigParams.roamingMngrThresholdsConfig.snrFilterWeight = (UINT8) parm[0].value;
  3635. }
  3636. TI_SetRoamingConfiguration (g_id_adapter, (UINT8*)&roamingMngrConfigParams, sizeof(roamingMngrConfigParams_t));
  3637. console_printf_terminal("Snr FIlter Weight = %d \n",
  3638. (roamingMngrConfigParams.roamingMngrThresholdsConfig.snrFilterWeight));
  3639. }
  3640. void cmd_Roaming_getConfParams(ConParm_t parm[], U16 nParms)
  3641. {
  3642. TI_GetRoamingConfiguration (g_id_adapter, (UINT8*)&roamingMngrConfigParams, sizeof(roamingMngrConfigParams_t));
  3643. console_printf_terminal("Roaming is: %s \n", roamingMngrConfigParams.roamingMngrConfig.enableDisable ? "Enabled" : "Disabled");
  3644. console_printf_terminal("lowPassFilterRoamingAttempt = %d sec, apQualityThreshold = %d\n",
  3645. roamingMngrConfigParams.roamingMngrConfig.lowPassFilterRoamingAttempt,
  3646. roamingMngrConfigParams.roamingMngrConfig.apQualityThreshold);
  3647. console_printf_terminal("Roaming Triggers' thresholds are: \n");
  3648. console_printf_terminal("dataRetryThreshold = %d, lowQualityForBackgroungScanCondition = %d, \
  3649. lowRssiThreshold = %d, lowSnrThreshold = %d, normalQualityForBackgroungScanCondition = %d, \
  3650. numExpectedTbttForBSSLoss = %d, txRateThreshold = %d \n",
  3651. roamingMngrConfigParams.roamingMngrThresholdsConfig.dataRetryThreshold,
  3652. roamingMngrConfigParams.roamingMngrThresholdsConfig.lowQualityForBackgroungScanCondition,
  3653. roamingMngrConfigParams.roamingMngrThresholdsConfig.lowRssiThreshold,
  3654. roamingMngrConfigParams.roamingMngrThresholdsConfig.lowSnrThreshold,
  3655. roamingMngrConfigParams.roamingMngrThresholdsConfig.normalQualityForBackgroungScanCondition,
  3656. roamingMngrConfigParams.roamingMngrThresholdsConfig.numExpectedTbttForBSSLoss,
  3657. roamingMngrConfigParams.roamingMngrThresholdsConfig.txRateThreshold);
  3658. console_printf_terminal("RSSI / SNR filter weights are: \n");
  3659. console_printf_terminal("RSSI filter weight = %d, SNR filter weight = %d\n ",
  3660. roamingMngrConfigParams.roamingMngrThresholdsConfig.rssiFilterWeight,
  3661. roamingMngrConfigParams.roamingMngrThresholdsConfig.snrFilterWeight);
  3662. }
  3663. void cmd_bt_coe_enable(ConParm_t parm[], U16 nParms)
  3664. {
  3665. if( nParms == 0 )
  3666. {
  3667. console_printf_terminal("Please enter enable value:\n");
  3668. console_printf_terminal("0 - Enable\n");
  3669. console_printf_terminal("1 - Disable\n");
  3670. console_printf_terminal("2 - Auto\n");
  3671. }
  3672. else
  3673. {
  3674. TI_SetBtCoeEnable(g_id_adapter, parm[0].value);
  3675. }
  3676. }
  3677. void cmd_bt_coe_rate(ConParm_t parm[], U16 nParms)
  3678. {
  3679. U8 Values[NUM_OF_RATES_IN_SG];
  3680. U8 Index;
  3681. if( nParms != NUM_OF_RATES_IN_SG )
  3682. {
  3683. console_printf_terminal("0 - 1Mbps (not recommended)\n");
  3684. console_printf_terminal("1 - 2Mbps (not recommended)\n");
  3685. console_printf_terminal("2 - 5.5Mbps\n");
  3686. console_printf_terminal("3 - 6Mbps\n");
  3687. console_printf_terminal("4 - 9Mbps\n");
  3688. console_printf_terminal("5 - 11Mbps\n");
  3689. console_printf_terminal("6 - 12Mbps\n");
  3690. console_printf_terminal("7 - 18Mbps\n");
  3691. console_printf_terminal("8 - 22Mbps (not in use)\n");
  3692. console_printf_terminal("9 - 24Mbps\n");
  3693. console_printf_terminal("10 - 36Mbps\n");
  3694. console_printf_terminal("11 - 48Mbps\n");
  3695. console_printf_terminal("12 - 54Mbps\n");
  3696. }
  3697. else
  3698. {
  3699. for (Index = 0; Index < NUM_OF_RATES_IN_SG; Index++ )
  3700. {
  3701. Values[Index] = (U8)parm[Index].value; //TRS:MEB use cast to fix compile warning
  3702. }
  3703. TI_SetBtCoeRate(g_id_adapter, Values);
  3704. }
  3705. }
  3706. void cmd_bt_coe_config(ConParm_t parm[], U16 nParms)
  3707. {
  3708. U32 Values[NUM_OF_CONFIG_PARAMS_IN_SG];
  3709. U8 Index = 0;
  3710. if( nParms != NUM_OF_CONFIG_PARAMS_IN_SG )
  3711. {
  3712. console_printf_terminal("Please enter valid config values:\n");
  3713. console_printf_terminal("Param %d - wlanRxMinRateToRespectBtHp (0 - all,2,5,6,9,11,12,18,22,24,36,48,54) \n",Index++);
  3714. console_printf_terminal("Param %d - btHpMaxTime (100 - 15000)\n",Index++);
  3715. console_printf_terminal("Param %d - wlanHpMaxTime (100 - 15000)\n",Index++);
  3716. console_printf_terminal("Param %d - senseDisableTimer (100 - 15000)\n",Index++);
  3717. console_printf_terminal("Param %d - protectiveRxTimeBeforeBtHp (10 - 2300)\n",Index++);
  3718. console_printf_terminal("Param %d - protectiveTxTimeBeforeBtHp (10 - 2300)\n",Index++);
  3719. console_printf_terminal("Param %d - protectiveRxTimeBeforeBtHpFastAp (10 - 20000)\n",Index++);
  3720. console_printf_terminal("Param %d - protectiveTxTimeBeforeBtHpFastAp (10 - 20000)\n",Index++);
  3721. console_printf_terminal("Param %d - protectiveWlanCycleTimeForFastAp (2000 - 65535)\n",Index++);
  3722. console_printf_terminal("Param %d - btAntiStarvationPeriod (0 - 15000) \n",Index++);
  3723. console_printf_terminal("Param %d - timeoutNextBtLpPacket (400 - 10000)\n",Index++);
  3724. console_printf_terminal("Param %d - wakeUpTimeBeforeBeacon (0 - 20000) \n",Index++);
  3725. console_printf_terminal("Param %d - hpdmMaxGuardTime (0 - 50000) \n",Index++);
  3726. console_printf_terminal("Param %d - timeoutNextWlanPacket (100 - 50000) \n",Index++);
  3727. console_printf_terminal("Param %d - sgAntennaType (0 - Single | 1 - Dual | 2 - Single+ )\n",Index++);
  3728. console_printf_terminal("Param %d - signalingType (0 - Legacy | 1 - Palau | 2 - Other)\n",Index++);
  3729. console_printf_terminal("Param %d - afhLeverageOn (0 - OFF | 1 - GPIO | 2 - ON)\n",Index++);
  3730. console_printf_terminal("Param %d - numberQuietCycle (0 - 10)\n",Index++);
  3731. console_printf_terminal("Param %d - maxNumCts (0 - 10)\n",Index++);
  3732. console_printf_terminal("Param %d - numberOfWlanPackets (1 - 10)\n",Index++);
  3733. console_printf_terminal("Param %d - numberOfBtPackets (2 - 10)\n",Index++);
  3734. console_printf_terminal("Param %d - numberOfMissedRxForAvalancheTrigger (1 - 255)\n",Index++);
  3735. console_printf_terminal("Param %d - wlanElpHpSupport (0 - 1)\n",Index++);
  3736. console_printf_terminal("Param %d - btAntiStarvationNumberOfCyclesWithinThePeriod (0 - 15) \n",Index++);
  3737. console_printf_terminal("Param %d - ackModeDuringBtLpInDualAnt (0 - 1) \n",Index++);
  3738. console_printf_terminal("Param %d - allowPaSdToggleDuringBtActivityEnable (0 - 1) \n",Index++);
  3739. console_printf_terminal("Param %d - sgAutoModeNoCts (0 - 1) \n",Index++);
  3740. console_printf_terminal("Param %d - numOfBtHpRespectedReq (0 - 20) \n",Index++);
  3741. }
  3742. else
  3743. {
  3744. for (Index = 0; Index < NUM_OF_CONFIG_PARAMS_IN_SG; Index++ )
  3745. {
  3746. Values[Index] = parm[Index].value;
  3747. }
  3748. if ( ( (is_value_rate(Values[0])) && (Values[0] != 1) ) || (Values[0] == 0) )
  3749. {
  3750. TI_SetBtCoeConfig(g_id_adapter, (tiUINT32 *)Values);
  3751. }
  3752. else
  3753. {
  3754. console_printf_terminal("Error: Param 26 - wlanRxMinRateToRespectBtHp (0 - all,2,5,6,9,11,12,18,22,24,36,48,54) \n");
  3755. }
  3756. }
  3757. }
  3758. void cmd_bt_coe_get_status(ConParm_t parm[], U16 nParms)
  3759. {
  3760. U32 Values[NUM_OF_STATUS_PARAMS_IN_SG];
  3761. /* The print is done inside the module */
  3762. console_printf_terminal("Done by driver - ");
  3763. if( TI_SetBtCoeGetStatus(g_id_adapter,(tiUINT32 *) Values) == OK ) {
  3764. console_printf_terminal("Ok\n");
  3765. /* console_printf_terminal("BT Coxistence status: \n\n");
  3766. console_printf_terminal("Enable: %d\n", Values[0]);
  3767. console_printf_terminal("Rate: %d\n", Values[1]);
  3768. console_printf_terminal("BtSignaling: %d\n", Values[2]);
  3769. console_printf_terminal("BtHPMaxTime: %d\n", Values[3]);
  3770. console_printf_terminal("WlanHPMaxTime: %d\n", Values[4]);
  3771. console_printf_terminal("WlanEOSMaxPacket: %d\n", Values[5]);
  3772. console_printf_terminal("WlanEOSMaxPacketTimeOut: %d\n", Values[6]);
  3773. console_printf_terminal("BtPTAMaxPacket: %d\n", Values[7]);
  3774. console_printf_terminal("BtPTAMaxPacketTimeOut: %d\n", Values[8]);
  3775. console_printf_terminal("WlanSlowAPSocial: %d\n", Values[9]);
  3776. console_printf_terminal("WlanSlowAPMaxCTS: %d\n", Values[10]);
  3777. console_printf_terminal("WlanSlowAPMaxTimeToCTS: %d\n", Values[11]);
  3778. console_printf_terminal("T8_temporary: %d\n", Values[12]);
  3779. console_printf_terminal("BTtoWLANSwitchTime: %d\n", Values[13]); */
  3780. }
  3781. else
  3782. {
  3783. console_printf_terminal("Fail\n");
  3784. /* console_printf_terminal("Error reading status!\n"); */
  3785. }
  3786. }
  3787. void cmd_PLT_RxPerStart(ConParm_t parm[], U16 nParms)
  3788. {
  3789. UINT32 Status = TI_PLT_RxPerStart(g_id_adapter);
  3790. if (Status == OK)
  3791. console_printf_terminal("Plt RX counters started\n");
  3792. else
  3793. console_printf_terminal("Plt RX counters start failed\n");
  3794. }
  3795. void cmd_PLT_RxPerStop(ConParm_t parm[], U16 nParms)
  3796. {
  3797. UINT32 Status = TI_PLT_RxPerStop(g_id_adapter);
  3798. if (Status == OK)
  3799. console_printf_terminal("Plt RX counters stoped\n");
  3800. else
  3801. console_printf_terminal("Plt RX counters stop failed\n");
  3802. }
  3803. void cmd_PLT_RxPerClear(ConParm_t parm[], U16 nParms)
  3804. {
  3805. UINT32 Status = TI_PLT_RxPerClear(g_id_adapter);
  3806. if (Status == OK)
  3807. console_printf_terminal("Plt RX counters cleard\n");
  3808. else
  3809. console_printf_terminal("Plt RX counters clear failed\n");
  3810. }
  3811. void cmd_PLT_RxPerGet(ConParm_t parm[], U16 nParms)
  3812. {
  3813. PltRxPer_t PltRxPer;
  3814. UINT32 Status = TI_PLT_RxPerGetResults(g_id_adapter, &PltRxPer);
  3815. if (Status == OK)
  3816. {
  3817. console_printf_terminal("FCSErrorCount = %d\n", PltRxPer.FCSErrorCount);
  3818. console_printf_terminal("PLCPErrorCount = %d\n", PltRxPer.PLCPErrorCount);
  3819. console_printf_terminal("SeqNumMissCount = %d\n", PltRxPer.SeqNumMissCount);
  3820. console_printf_terminal("TotalFrameCount = %d\n", PltRxPer.TotalFrameCount);
  3821. }
  3822. else
  3823. console_printf_terminal("Plt RX counters Get results failed\n");
  3824. }
  3825. void cmd_PLT_RegisterRead(ConParm_t parm[], U16 nParms)
  3826. {
  3827. tiUINT32 RegAddress;
  3828. tiUINT32 RegValue;
  3829. tiUINT32 Status;
  3830. char* pTmp;
  3831. /* Converting hex string to tiUINT32*/
  3832. pTmp = (char*)parm[0].value;
  3833. sscanf(pTmp , "%x", &RegAddress);
  3834. /*Call the API function */
  3835. Status = TI_PLT_ReadRegister(g_id_adapter, RegAddress, &RegValue);
  3836. if( Status == OK )
  3837. console_printf_terminal("Reg. %#lx = %#x (%d)\n", RegAddress, RegValue, RegValue );
  3838. }
  3839. void cmd_PLT_RegisterWrite(ConParm_t parm[], U16 nParms)
  3840. {
  3841. tiUINT32 RegAddress;
  3842. tiUINT32 RegValue = 0;
  3843. tiUINT32 Status;
  3844. char* pTmp;
  3845. /* Converting hex string to tiUINT32*/
  3846. printf("cmd_PLT_RegisterWrite\n");
  3847. pTmp = (char*)parm[0].value;
  3848. sscanf(pTmp, "%x", &RegAddress);
  3849. pTmp = (char*)parm[1].value;
  3850. sscanf(pTmp , "%x", &RegValue);
  3851. printf("cmd_PLT_RegisterWrite %x %x\n", RegAddress, RegValue);
  3852. /*Call the API function */
  3853. Status = TI_PLT_WriteRegister(g_id_adapter, RegAddress, RegValue );
  3854. if (Status == OK)
  3855. console_printf_terminal("Plt register 0x%x is set to 0x%x OK.\n", RegAddress, RegValue);
  3856. else
  3857. console_printf_terminal("Plt register 0x%x is set to 0x%x NOK.\n", RegAddress, RegValue);
  3858. }
  3859. void cmd_PLT_TxContinues(ConParm_t parm[], U16 nParms)
  3860. {
  3861. UINT32 Status;
  3862. PltTxContinues_t PltTxContinues;
  3863. if ((nParms == 0) || (nParms > 10))
  3864. {
  3865. console_printf_terminal("\n");
  3866. console_printf_terminal("Param 0 - Band (0 - 2.4Ghz(B/G), 1 - 5Ghz(A), 2 - Japan(4.9Ghz))\n");
  3867. console_printf_terminal("Param 1 - Channel: (1..14(2.4Ghz), 1..180(5Ghz)) \n");
  3868. console_printf_terminal("Param 2 - Rate: \n");
  3869. console_printf_terminal(" 1 - 1Mbps\n");
  3870. console_printf_terminal(" 2 - 2Mbps\n");
  3871. console_printf_terminal(" 3 - 5.5Mbps\n");
  3872. console_printf_terminal(" 4 - 11Mbps\n");
  3873. console_printf_terminal(" 6 - 6Mbps\n");
  3874. console_printf_terminal(" 7 - 9Mbps\n");
  3875. console_printf_terminal(" 8 - 12Mbps\n");
  3876. console_printf_terminal(" 9 - 18Mbps\n");
  3877. console_printf_terminal(" 10 - 24Mbps\n");
  3878. console_printf_terminal(" 11 - 36Mbps\n");
  3879. console_printf_terminal(" 12 - 48Mbps\n");
  3880. console_printf_terminal(" 13 - 54Mbps \n");
  3881. console_printf_terminal("Param 3 - preamble (0-long, 1-short)\n");
  3882. console_printf_terminal("Param 4 - Delay between packets (uSec)\n");
  3883. console_printf_terminal("Param 5 - Number of TX frames (0 - endless)\n");
  3884. console_printf_terminal("Param 6 - Test mode (5-Random data, 9-ZOZO(0,1,0,1,...))\n");
  3885. console_printf_terminal("Param 7 - Sequance number mode(0 - fixed, 1 - incremented)\n");
  3886. console_printf_terminal("Param 8 - packet Data legth [bytes] (0 - 2284)\n");
  3887. console_printf_terminal("Param 9 - peer mac address: [xx:xx:xx:xx:xx:xx]\n");
  3888. }
  3889. else
  3890. {
  3891. PltTxContinues.band = (UINT8) parm[0].value;
  3892. PltTxContinues.chID = parm[1].value;
  3893. PltTxContinues.rate = parm[2].value;
  3894. PltTxContinues.preamble = (UINT8) parm[3].value;
  3895. PltTxContinues.InterPacketDelay = parm[4].value;
  3896. PltTxContinues.NumOfFrames = parm[5].value;
  3897. PltTxContinues.mode = (UINT8) parm[6].value;
  3898. PltTxContinues.aSeqNumMode = parm[7].value;
  3899. PltTxContinues.aPacketLength = parm[8].value;
  3900. hexStr2MACAddr( (char*)parm[9].value, &(PltTxContinues.aPeerMacAddr) );
  3901. Status = TI_PLT_TxContiues(g_id_adapter, &PltTxContinues);
  3902. if (Status == OK)
  3903. console_printf_terminal("OK\n");
  3904. else
  3905. console_printf_terminal("NOK\n");
  3906. }
  3907. }
  3908. void cmd_PLT_TxCW(ConParm_t parm[], U16 nParms)
  3909. {
  3910. UINT32 Status;
  3911. TestCmdChannelBand_t PltTxCW;
  3912. if ((nParms == 0) || (nParms > 2))
  3913. {
  3914. console_printf_terminal("Param 0 - Band (0 - 2.4Ghz(B/G), 1 - 5Ghz(A), 2 - Japan(4.9Ghz))\n");
  3915. console_printf_terminal("Param 1 - Channel(1..14(2.4Ghz), 1..180(5Ghz))\n");
  3916. }
  3917. else
  3918. {
  3919. PltTxCW.band = (RadioBand_e) parm[0].value;
  3920. PltTxCW.channel = (Channel_e) parm[1].value;
  3921. Status = TI_PLT_TxCW(g_id_adapter, &PltTxCW);
  3922. if (Status == OK)
  3923. console_printf_terminal("OK\n");
  3924. else
  3925. console_printf_terminal("NOK\n");
  3926. }
  3927. }
  3928. void cmd_PLT_TxStop(ConParm_t parm[], U16 nParms)
  3929. {
  3930. UINT32 Status = TI_PLT_TxStop(g_id_adapter);
  3931. if (Status == OK)
  3932. console_printf_terminal("OK\n");
  3933. else
  3934. console_printf_terminal("NOK\n");
  3935. }
  3936. void cmd_PLT_MIB_CounterTable(ConParm_t parm[], U16 nParms)
  3937. {
  3938. PLT_MIB_t Mib;
  3939. UINT32 Status;
  3940. memset(&Mib, 0, sizeof(Mib));
  3941. Mib.aMib = PLT_MIB_countersTable;
  3942. Status = TI_PLT_ReadMIB(g_id_adapter, &Mib);
  3943. if (Status == OK)
  3944. {
  3945. console_printf_terminal("FCS error count= %d \nPLCP error count = %d\n",
  3946. Mib.aData.CounterTable.FCSErrorCount,
  3947. Mib.aData.CounterTable.PLCPErrorCount);
  3948. }
  3949. else
  3950. {
  3951. console_printf_terminal("NOK\n");
  3952. }
  3953. }
  3954. void cmd_PLT_MIB_StationID(ConParm_t parm[], U16 nParms)
  3955. {
  3956. PLT_MIB_t Mib;
  3957. UINT32 Status;
  3958. memset(&Mib, 0, sizeof(Mib));
  3959. Mib.aMib = PLT_MIB_dot11StationId;
  3960. Status = TI_PLT_ReadMIB(g_id_adapter, &Mib);
  3961. if (Status == OK)
  3962. {
  3963. console_printf_terminal("MIB_StationID = %02x:%02x:%02x:%02x:%02x:%02x\n",
  3964. Mib.aData.StationId.addr[5],
  3965. Mib.aData.StationId.addr[4],
  3966. Mib.aData.StationId.addr[3],
  3967. Mib.aData.StationId.addr[2],
  3968. Mib.aData.StationId.addr[1],
  3969. Mib.aData.StationId.addr[0]);
  3970. }
  3971. else
  3972. {
  3973. console_printf_terminal("NOK\n");
  3974. }
  3975. }
  3976. void cmd_modify_ctsToSelf(ConParm_t parm[], U16 nParms)
  3977. {
  3978. PLT_MIB_t Mib;
  3979. UINT32 Status;
  3980. memset(&Mib, 0, sizeof(Mib));
  3981. Mib.aMib = PLT_MIB_ctsToSelf;
  3982. if (nParms != 1)
  3983. {
  3984. console_printf_terminal("CTS to self: [0 - Disable, 1 - Enable]\n");
  3985. }
  3986. if (nParms == 0) /*Get ctsToSelf */
  3987. {
  3988. Status = TI_PLT_ReadMIB(g_id_adapter, &Mib);
  3989. if (OK == Status)
  3990. console_printf_terminal("ctsToSelf = %s (%d)\n",
  3991. Mib.aData.CTSToSelfEnable?"Enable":"Disable",
  3992. Mib.aData.CTSToSelfEnable);
  3993. }
  3994. else if (nParms == 1)
  3995. {
  3996. Mib.Length = sizeof(Mib.aData.CTSToSelfEnable);
  3997. Mib.aData.CTSToSelfEnable = parm[0].value;
  3998. if (OK != TI_PLT_WriteMIB(g_id_adapter, &Mib))
  3999. console_printf_terminal("TI_PLT_WriteMIB failed\n");
  4000. }
  4001. }
  4002. void cmd_get_arpIpTable(ConParm_t parm[], U16 nParms)
  4003. {
  4004. PLT_MIB_t Mib;
  4005. UINT32 Status;
  4006. memset(&Mib, 0, sizeof(Mib));
  4007. Mib.aMib = PLT_MIB_arpIpAddressesTable;
  4008. Status = TI_PLT_ReadMIB(g_id_adapter, &Mib);
  4009. if (OK == Status)
  4010. {
  4011. int FilteringEnable = Mib.aData.ArpIpAddressesTable.FilteringEnable;
  4012. console_printf_terminal("ARP IP Table:\n");
  4013. console_printf_terminal("FilteringEnable: %s (%d)\n",
  4014. FilteringEnable?"Enable":"Disable",
  4015. FilteringEnable);
  4016. console_printf_terminal("ArpIpAddress: %d.%d.%d.%d\n",
  4017. Mib.aData.ArpIpAddressesTable.addr[0],
  4018. Mib.aData.ArpIpAddressesTable.addr[1],
  4019. Mib.aData.ArpIpAddressesTable.addr[2],
  4020. Mib.aData.ArpIpAddressesTable.addr[3]
  4021. );
  4022. }
  4023. }
  4024. void cmd_get_GroupAddressTable(ConParm_t parm[], U16 nParms)
  4025. {
  4026. PLT_MIB_t Mib;
  4027. UINT32 Status;
  4028. memset(&Mib, 0, sizeof(Mib));
  4029. Mib.aMib = PLT_MIB_dot11GroupAddressesTable;
  4030. Status = TI_PLT_ReadMIB(g_id_adapter, &Mib);
  4031. if (OK == Status)
  4032. {
  4033. int FilteringEnable = Mib.aData.GroupAddressTable.bFilteringEnable;
  4034. int i;
  4035. console_printf_terminal("Group addresses Table:\n");
  4036. console_printf_terminal("FilteringEnable: %s (%d)\n",
  4037. FilteringEnable?"Enable":"Disable",
  4038. FilteringEnable);
  4039. console_printf_terminal("nNumberOfAddresses: %d\n", Mib.aData.GroupAddressTable.nNumberOfAddresses);
  4040. console_printf_terminal("Group addresses: \n");
  4041. for (i=0; i<Mib.aData.GroupAddressTable.nNumberOfAddresses; i++)
  4042. console_printf_terminal("%x:%x:%x:%x:%x:%x\n",
  4043. Mib.aData.GroupAddressTable.GroupTable[i].addr[0],
  4044. Mib.aData.GroupAddressTable.GroupTable[i].addr[1],
  4045. Mib.aData.GroupAddressTable.GroupTable[i].addr[2],
  4046. Mib.aData.GroupAddressTable.GroupTable[i].addr[3],
  4047. Mib.aData.GroupAddressTable.GroupTable[i].addr[4],
  4048. Mib.aData.GroupAddressTable.GroupTable[i].addr[5]
  4049. );
  4050. }
  4051. }
  4052. void cmd_PLT_TxCalGainGet(ConParm_t parm[], U16 nParms)
  4053. {
  4054. UINT32 Status;
  4055. PltGainGet_t PLTGainGet;
  4056. Status = TI_PLT_TxCalGainGet(g_id_adapter, &PLTGainGet);
  4057. if (Status == OK)
  4058. {
  4059. console_printf_terminal("\n");
  4060. console_printf_terminal("TxGain: %d(0x%x)\n", PLTGainGet.TxGain, PLTGainGet.TxGain);
  4061. console_printf_terminal("TxUpperBound: %d(0x%x)\n", PLTGainGet.TxUpperBound, PLTGainGet.TxUpperBound);
  4062. console_printf_terminal("TxLowerBound: %d(0x%x)\n", PLTGainGet.TxLowerBound, PLTGainGet.TxLowerBound);
  4063. }
  4064. else
  4065. console_printf_terminal("NOK\n");
  4066. }
  4067. void cmd_PLT_TxCalGainAdjust(ConParm_t parm[], U16 nParms)
  4068. {
  4069. UINT32 Status;
  4070. UINT32 GainChange;
  4071. OS_802_11_POWER_LEVELS mode;
  4072. if ((nParms == 0) || (nParms > 1))
  4073. {
  4074. console_printf_terminal("\n");
  4075. console_printf_terminal("Param 0 - Gain change (db)\n");
  4076. }
  4077. else
  4078. {
  4079. GainChange = parm[0].value;
  4080. /* Check Power mode (works only in "awake" mode !!!) */
  4081. TI_GetPowerLevelDefault(g_id_adapter, &mode );
  4082. if(mode == OS_POWER_LEVEL_AWAKE)
  4083. {
  4084. Status = TI_PLT_TxCalGainAdjust(g_id_adapter, GainChange);
  4085. if (Status == OK)
  4086. console_printf_terminal("OK\n");
  4087. else
  4088. console_printf_terminal("NOK\n");
  4089. }
  4090. else
  4091. {
  4092. console_printf_terminal("Gain Adjust was not performed becouse Default power-mode is not AWAKE\n");
  4093. console_printf_terminal("Please change defaultPowerLevel parametr in tiwlan.ini file first\n");
  4094. }
  4095. }
  4096. }
  4097. void cmd_PLT_TxCalStart(ConParm_t parm[], U16 nParms)
  4098. {
  4099. UINT32 Status;
  4100. PltTxCalibrationRequest_t tTxStart;
  4101. if (nParms != 1)
  4102. {
  4103. console_printf_terminal("\nParam 0 - Tx Power [0-255]\n");
  4104. }
  4105. else
  4106. {
  4107. /* use U8 cast to fix compile warning */
  4108. tTxStart.refTxPower = (U8)parm[0].value;
  4109. Status = TI_PLT_TxCalStart(g_id_adapter,&tTxStart);
  4110. if (Status == OK)
  4111. console_printf_terminal("OK\n");
  4112. else
  4113. console_printf_terminal("NOK\n");
  4114. }
  4115. }
  4116. void cmd_PLT_TxCalStop(ConParm_t parm[], U16 nParms)
  4117. {
  4118. UINT32 Status;
  4119. Status = TI_PLT_TxCalStop(g_id_adapter);
  4120. if (Status == OK)
  4121. console_printf_terminal("OK\n");
  4122. else
  4123. console_printf_terminal("NOK\n");
  4124. }
  4125. void cmd_PLT_RxTxCalNVSUpdateBuffer(ConParm_t parm[], U16 nParms)
  4126. {
  4127. UINT32 Status;
  4128. PltNvsResultsBuffer_t PltNvsResultsBuffer;
  4129. int i;
  4130. memset(&PltNvsResultsBuffer, 0, sizeof(PltNvsResultsBuffer));
  4131. Status = TI_PLT_RxTxCalNVSUpdateBuffer(g_id_adapter, &PltNvsResultsBuffer);
  4132. if (Status == OK)
  4133. {
  4134. console_printf_terminal("NVSUpdateBuffer - number of tables:%d\n", PltNvsResultsBuffer.numOfTables);
  4135. console_printf_terminal("# \t Offset\t Size\t Data\n");
  4136. console_printf_terminal("###################################################################\n");
  4137. for (i=0; (i<PltNvsResultsBuffer.numOfTables) && (i<NVS_RESULTS_MAX_NUM_OF_TABLES); i++)
  4138. {
  4139. int j;
  4140. console_printf_terminal("#%d\t %p\t %.4d\t ",
  4141. i,
  4142. PltNvsResultsBuffer.tables[i].offset,
  4143. PltNvsResultsBuffer.tables[i].size);
  4144. for (j=0; (j<PltNvsResultsBuffer.tables[i].size) && (j<NVS_RESULTS_MAX_UPDATE_TABLE_SIZE); j++)
  4145. {
  4146. console_printf_terminal("%.2x ", PltNvsResultsBuffer.tables[i].data[j]);
  4147. }
  4148. console_printf_terminal("\n");
  4149. }
  4150. }
  4151. else
  4152. console_printf_terminal("NOK\n");
  4153. }
  4154. void cmd_PLT_RxCal(ConParm_t parm[], U16 nParms)
  4155. {
  4156. UINT32 Status;
  4157. PltRxCalibrationRequest_t PltRxCalibrationRequest;
  4158. OS_802_11_POWER_LEVELS mode;
  4159. if ((nParms == 0) || (nParms > 5))
  4160. {
  4161. console_printf_terminal("\n");
  4162. console_printf_terminal("Param 0 - Expected Rssi (db)\n");
  4163. console_printf_terminal("Param 1 - Channel\n");
  4164. console_printf_terminal("Param 2 - Band (0 - 2.4Ghz(B/G), 1 - 5Ghz(A), 2 - Japan(4.9Ghz)\n");
  4165. console_printf_terminal("Param 3 - Interval between samples(uSec) [100]\n");
  4166. console_printf_terminal("Param 4 - Number of samples [1000]\n");
  4167. }
  4168. else
  4169. {
  4170. PltRxCalibrationRequest.expectedRssi = parm[0].value;
  4171. PltRxCalibrationRequest.channel = (UINT8)parm[1].value;
  4172. PltRxCalibrationRequest.band = (UINT8)parm[2].value;
  4173. PltRxCalibrationRequest.intervalBetweenSamplesUsec = parm[3].value;
  4174. PltRxCalibrationRequest.numOfSamples = (UINT16)parm[4].value;
  4175. /* Check Power mode (works only in "awake" mode !!!) */
  4176. TI_GetPowerLevelDefault(g_id_adapter, &mode );
  4177. if(mode == OS_POWER_LEVEL_AWAKE)
  4178. {
  4179. Status = TI_PLT_RxCal(g_id_adapter, &PltRxCalibrationRequest);
  4180. if (Status == OK)
  4181. console_printf_terminal("OK\n");
  4182. else
  4183. console_printf_terminal("NOK\n");
  4184. }
  4185. else
  4186. {
  4187. console_printf_terminal("Rx calibration was not performed becouse Default power-mode is not AWAKE\n");
  4188. console_printf_terminal("Please change defaultPowerLevel parametr in tiwlan.ini file first\n");
  4189. }
  4190. }
  4191. }
  4192. void cmd_PLT_RadioTune(ConParm_t parm[], U16 nParms)
  4193. {
  4194. UINT32 Status;
  4195. TestCmdChannelBand_t ChannelBand;
  4196. OS_802_11_POWER_LEVELS mode;
  4197. if ((nParms == 0) || (nParms > 2))
  4198. {
  4199. console_printf_terminal("Param 0 - Band (0-2.4Ghz, 1-5Ghz, 2-4.9Ghz)\n");
  4200. console_printf_terminal("Param 1 - Channel\n");
  4201. }
  4202. else
  4203. {
  4204. ChannelBand.band = (RadioBand_e) parm[0].value;
  4205. ChannelBand.channel = (Channel_e) parm[1].value;
  4206. /* Check Power mode (works only in "awake" mode !!!) */
  4207. TI_GetPowerLevelDefault(g_id_adapter, &mode );
  4208. if(mode == OS_POWER_LEVEL_AWAKE)
  4209. {
  4210. Status = TI_PLT_RadioTune(g_id_adapter, &ChannelBand);
  4211. if (Status == OK)
  4212. console_printf_terminal("OK\n");
  4213. else
  4214. console_printf_terminal("NOK\n");
  4215. }
  4216. else
  4217. {
  4218. console_printf_terminal("Radio tune was not performed becouse Default power-mode is not AWAKE\n");
  4219. console_printf_terminal("Please change defaultPowerLevel parametr in tiwlan.ini file first\n");
  4220. }
  4221. }
  4222. }
  4223. #ifdef _WINDOWS
  4224. #endif /* ifdef _WINDOWS */