diff options
author | Dmitry Shmidt <dimitrysh@google.com> | 2013-01-17 14:02:41 -0800 |
---|---|---|
committer | Dmitry Shmidt <dimitrysh@google.com> | 2013-01-17 14:02:41 -0800 |
commit | d100419a8d5f1acc1c68fa227afb507a9bd07f42 (patch) | |
tree | 2d82c08616155a589cc57884c2469f8478292858 /wl1271/CUDK/configurationutility/src | |
parent | cece92a8acff0a81868e6cac326bcf61e54c5aec (diff) | |
download | wlan-d100419a8d5f1acc1c68fa227afb507a9bd07f42.tar.gz |
wl1271: Remove obsolete filesHEADandroid-4.3_r3.1android-4.3_r3android-4.3_r2.3android-4.3_r2.2android-4.3_r2.1android-4.3_r2android-4.3_r1.1android-4.3_r1android-4.3_r0.9.1android-4.3_r0.9android-4.3.1_r1tools_r22.2masterjb-mr2.0.0-releasejb-mr2.0-releasejb-mr2-releasejb-mr2-dev
Change-Id: I19c9ee8b975db9d6946c39529a4b01e3ba75b098
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Diffstat (limited to 'wl1271/CUDK/configurationutility/src')
-rw-r--r-- | wl1271/CUDK/configurationutility/src/console.c | 1073 | ||||
-rw-r--r-- | wl1271/CUDK/configurationutility/src/cu_cmd.c | 6386 | ||||
-rw-r--r-- | wl1271/CUDK/configurationutility/src/cu_common.c | 465 | ||||
-rw-r--r-- | wl1271/CUDK/configurationutility/src/ticon.c | 1215 | ||||
-rw-r--r-- | wl1271/CUDK/configurationutility/src/wpa_core.c | 940 |
5 files changed, 0 insertions, 10079 deletions
diff --git a/wl1271/CUDK/configurationutility/src/console.c b/wl1271/CUDK/configurationutility/src/console.c deleted file mode 100644 index ef645daa..00000000 --- a/wl1271/CUDK/configurationutility/src/console.c +++ /dev/null @@ -1,1073 +0,0 @@ -/* - * console.c - * - * Copyright 2001-2009 Texas Instruments, Inc. - http://www.ti.com/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/**************************************************************************** -* -* MODULE: console.c -* -* PURPOSE: -* -* DESCRIPTION: -* ============ -* -* -****************************************************************************/ - -/* includes */ -/************/ -#include <stdio.h> -#include "cu_osapi.h" -#include "console.h" -#include "cu_cmd.h" - -/* defines */ -/***********/ -#define INBUF_LENGTH 2100 -#define MAX_NAME_LEN 64 -#define MAX_HELP_LEN 40 -#define MAX_PARM_LEN 20 -#define ALIAS_LEN 1 - -#define TOKEN_UP ".." -#define TOKEN_ROOT "/" -#define TOKEN_BREAK "#" -#define TOKEN_HELP "?" -#define TOKEN_DIRHELP "help" -#define TOKEN_QUIT "q1" - -/* local types */ -/***************/ - -typedef enum -{ - Dir, - Token -} ConEntry_type_t; - -/* Token types */ -typedef enum -{ - EmptyToken, - UpToken, - RootToken, - BreakToken, - HelpToken, - DirHelpToken, - QuitToken, - NameToken -} TokenType_t; - - -/* Monitor token structure */ -typedef struct ConEntry_t -{ - struct ConEntry_t *next; - S8 name[MAX_NAME_LEN+1]; /* Entry name */ - S8 help[MAX_HELP_LEN+1]; /* Help string */ - PS8 alias; /* Alias - always in upper case*/ - ConEntry_type_t sel; /* Entry selector */ - - union - { - struct - { - struct ConEntry_t *upper; /* Upper directory */ - struct ConEntry_t *first; /* First entry */ - } dir; - struct t_Token - { - FuncToken_t f_tokenFunc; /* Token handler */ - S32 totalParams; - ConParm_t *parm; /* Parameters array with totalParams size */ - PS8 *name; /* Parameter name with totalParams size */ - } token; - } u; -} ConEntry_t; - -/* Module control block */ -typedef struct Console_t -{ - THandle hCuCmd; - - S32 isDeviceOpen; - - ConEntry_t *p_mon_root; - ConEntry_t *p_cur_dir; - PS8 p_inbuf; - volatile S32 stop_UI_Monitor; -} Console_t; - -/* local variables */ -/*******************/ - -/* local fucntions */ -/*******************/ -static VOID Console_allocRoot(Console_t* pConsole); -int consoleRunScript( char *script_file, THandle hConsole); - - -/* Remove leading blanks */ -static PS8 Console_ltrim(PS8 s) -{ - while( *s == ' ' || *s == '\t' ) s++; - return s; -} - -/* -Make a preliminary analizis of <name> token. -Returns a token type (Empty, Up, Root, Break, Name) -*/ -static TokenType_t Console_analizeToken( PS8 name ) -{ - if (!name[0]) - return EmptyToken; - - if (!os_strcmp(name, (PS8)TOKEN_UP ) ) - return UpToken; - - if (!os_strcmp(name, (PS8)TOKEN_ROOT ) ) - return RootToken; - - if (!os_strcmp(name, (PS8)TOKEN_BREAK ) ) - return BreakToken; - - if (!os_strcmp(name, (PS8)TOKEN_HELP ) ) - return HelpToken; - - if (!os_strcmp(name, (PS8)TOKEN_DIRHELP ) ) - return DirHelpToken; - - if (!os_strcmp(name, (PS8)TOKEN_QUIT ) ) - return QuitToken; - - return NameToken; - -} - -/* Compare strings case insensitive */ -static S32 Console_stricmp( PS8 s1, PS8 s2, U16 len ) -{ - S32 i; - - for( i=0; i<len && s1[i] && s2[i]; i++ ) - { - if (os_tolower(s1[i]) != os_tolower(s2[i] )) - break; - } - - return ( (len - i) * (s1[i] - s2[i]) ); -} - -/* Convert string s to lower case. Return pointer to s */ -static PS8 Console_strlwr( PS8 s ) -{ - PS8 s0=s; - - while( *s ) - { - *s = (S8)os_tolower(*s ); - ++s; - } - - return s0; -} - -/* free the entries tree */ -static VOID Console_FreeEntry(ConEntry_t *pEntry) -{ - ConEntry_t *pEntryTemp,*pEntryTemp1; - - if(pEntry->sel == Dir) - { - pEntryTemp = pEntry->u.dir.first; - - while (pEntryTemp) - { - pEntryTemp1 = pEntryTemp->next; - Console_FreeEntry(pEntryTemp); - pEntryTemp = pEntryTemp1; - } - } - - /* free the current entry */ - os_MemoryFree(pEntry); -} - - -/* Allocate root directory */ -static VOID Console_allocRoot(Console_t* pConsole) -{ - /* The very first call. Allocate root structure */ - if ((pConsole->p_mon_root=(ConEntry_t *)os_MemoryCAlloc(sizeof( ConEntry_t ), 1) ) == NULL) - { - os_error_printf(CU_MSG_ERROR, (PS8)( "ERROR - Console_allocRoot(): cant allocate root\n") ); - return; - } - os_strcpy((PS8)pConsole->p_mon_root->name, (PS8)("\\") ); - pConsole->p_mon_root->sel = Dir; - pConsole->p_cur_dir = pConsole->p_mon_root; -} - -/* Display current directory */ -static VOID Console_displayDir(Console_t* pConsole) -{ - S8 out_buf[512]; - ConEntry_t *p_token; - ConEntry_t *p_dir = pConsole->p_cur_dir; - - os_sprintf((PS8)out_buf, (PS8)("%s%s> "), (PS8)(p_dir==pConsole->p_mon_root)? (PS8)("") : (PS8)(".../"), (PS8)p_dir->name ); - p_token = p_dir->u.dir.first; - while( p_token ) - { - if( (os_strlen(out_buf) + os_strlen(p_token->name) + 2)>= sizeof(out_buf) ) - { - os_error_printf(CU_MSG_ERROR, ( (PS8)"ERROR - Console_displayDir(): buffer too small....\n") ); - break; - } - os_strcat(out_buf, p_token->name ); - if ( p_token->sel == Dir ) - os_strcat((PS8)out_buf, (PS8)("/" ) ); - p_token = p_token->next; - if (p_token) - os_strcat((PS8)out_buf, (PS8)(", ") ); - } - - os_error_printf(CU_MSG_INFO2, (PS8)("%s\n"), (PS8)out_buf ); -} - - -/* -Cut the first U16 from <p_inbuf>. -Return the U16 in <name> and updated <p_inbuf> -*/ -static TokenType_t Console_getWord(Console_t* pConsole, PS8 name, U16 len ) -{ - U16 i=0; - TokenType_t tType; - - pConsole->p_inbuf = Console_ltrim(pConsole->p_inbuf); - - while( *pConsole->p_inbuf && *pConsole->p_inbuf!=' ' && i<len ) - name[i++] = *(pConsole->p_inbuf++); - - if (i<len) - name[i] = 0; - - tType = Console_analizeToken( name ); - - return tType; -} - -static TokenType_t Console_getStrParam(Console_t* pConsole, PS8 buf, ConParm_t *param ) -{ - TokenType_t tType; - U32 i, len = param->hi_val; - PS8 end_buf; - - pConsole->p_inbuf = Console_ltrim(pConsole->p_inbuf); - - if( param->flags & CON_PARM_LINE ) - { - os_strcpy(buf, (PS8)pConsole->p_inbuf ); - pConsole->p_inbuf += os_strlen(pConsole->p_inbuf); - } - else - { - if( *pConsole->p_inbuf == '\"' ) - { - end_buf = os_strchr(pConsole->p_inbuf+1, '\"' ); - if( !end_buf ) - { - os_error_printf(CU_MSG_ERROR, (PS8)("ERROR - invalid string param: '%s'\n"), (PS8)pConsole->p_inbuf ); - pConsole->p_inbuf += os_strlen(pConsole->p_inbuf); - return EmptyToken; - } - if( (end_buf - pConsole->p_inbuf - 1) > (int)len ) - { - os_error_printf(CU_MSG_ERROR, (PS8)("ERROR - param is too long: '%s'\n"), (PS8)pConsole->p_inbuf ); - pConsole->p_inbuf += os_strlen(pConsole->p_inbuf); - return EmptyToken; - } - *end_buf = 0; - os_strcpy( buf, (PS8)(pConsole->p_inbuf+1 ) ); - pConsole->p_inbuf = end_buf + 1; - } - else - { - for( i=0; *pConsole->p_inbuf && *pConsole->p_inbuf!=' ' && i<len; i++ ) - buf[i] = *(pConsole->p_inbuf++); - - buf[i] = 0; - if( *pConsole->p_inbuf && *pConsole->p_inbuf != ' ' ) - { - os_error_printf(CU_MSG_ERROR, (PS8)("ERROR - param is too long: '%s'\n"), (PS8)( pConsole->p_inbuf-os_strlen( buf) ) ); - pConsole->p_inbuf += os_strlen(pConsole->p_inbuf); - return EmptyToken; - } - } - } - - tType = Console_analizeToken( buf ); - - return tType; -} - -/* Returns number of parameters of the given token -*/ -static U16 Console_getNParms( ConEntry_t *p_token ) -{ - U16 i; - if ( !p_token->u.token.parm ) - return 0; - for( i=0; - (i<p_token->u.token.totalParams) && - p_token->u.token.parm[i].name && - p_token->u.token.parm[i].name[0]; - i++ ) - ; - return i; -} - -/* Parse p_inbuf string based on parameter descriptions in <p_token>. -Fill parameter values in <p_token>. -Returns the number of parameters filled. -To Do: add a option of one-by-one user input of missing parameters. -*/ -static S32 Console_parseParms(Console_t* pConsole, ConEntry_t *p_token, U16 *pnParms ) -{ - U16 nTotalParms = Console_getNParms( p_token ); - U16 nParms=0; - PS8 end_buf = NULL; - S8 parm[INBUF_LENGTH]; - U16 i, print_params = 0; - U32 val = 0; - S32 sval = 0; - - /* Mark all parameters as don't having an explicit value */ - for( i=0; i<nTotalParms; i++ ) - p_token->u.token.parm[i].flags |= CON_PARM_NOVAL; - - /* ----------------- */ - pConsole->p_inbuf = Console_ltrim(pConsole->p_inbuf); - if( pConsole->p_inbuf[0] == '!' && pConsole->p_inbuf[1] == '!' ) - { - pConsole->p_inbuf += 2; print_params = 1; - } - /* ----------------- */ - - /* Build a format string */ - for( i=0; i<nTotalParms; i++ ) - { - if (p_token->u.token.parm[i].flags & (CON_PARM_STRING | CON_PARM_LINE) ) - { - /* For a string parameter value is the string address */ - /* and hi_val is the string length */ - if (Console_getStrParam(pConsole, parm, &p_token->u.token.parm[i] ) != NameToken) - break; - if( os_strlen( parm) > p_token->u.token.parm[i].hi_val || - (p_token->u.token.parm[i].low_val && p_token->u.token.parm[i].low_val > os_strlen( parm) ) ) - { - os_error_printf(CU_MSG_ERROR, (PS8)("ERROR - param '%s' must be %ld..%ld chars\n"), (PS8)p_token->u.token.parm[i].name, - (PS8)p_token->u.token.parm[i].low_val, (PS8)p_token->u.token.parm[i].hi_val); - return FALSE; - } - os_strcpy((PS8)(char *)p_token->u.token.parm[i].value, (PS8)parm); - } - else - { - if (Console_getWord(pConsole, parm, MAX_PARM_LEN ) != NameToken) - break; - - if (p_token->u.token.parm[i].flags & CON_PARM_SIGN) - { - sval = os_strtol( parm, &end_buf, 0 ); - } - else - { - val = os_strtoul( parm, &end_buf, 0 ); - } - if( end_buf <= parm ) - break; - - /* Check value */ - if (p_token->u.token.parm[i].flags & CON_PARM_RANGE) - { - if (p_token->u.token.parm[i].flags & CON_PARM_SIGN) - { - if ((sval < (S32)p_token->u.token.parm[i].low_val) || - (sval > (S32)p_token->u.token.parm[i].hi_val) ) - { - os_error_printf(CU_MSG_ERROR, (PS8)("%s: %d out of range (%d, %d)\n"), - (PS8)p_token->u.token.parm[i].name, (int)sval, - (int)p_token->u.token.parm[i].low_val, (int)p_token->u.token.parm[i].hi_val ); - return FALSE; - } - - } - else - { - if ((val < p_token->u.token.parm[i].low_val) || - (val > p_token->u.token.parm[i].hi_val) ) - { - os_error_printf(CU_MSG_ERROR , (PS8)("%s: %ld out of range (%ld, %ld)\n"), - (PS8)p_token->u.token.parm[i].name, (PS8)val, - (PS8)p_token->u.token.parm[i].low_val, (PS8)p_token->u.token.parm[i].hi_val ); - return FALSE; - } - } - } - - if (p_token->u.token.parm[i].flags & CON_PARM_SIGN) - p_token->u.token.parm[i].value = sval; - else - p_token->u.token.parm[i].value = val; - } - - p_token->u.token.parm[i].flags &= ~CON_PARM_NOVAL; - ++nParms; - } - - /* Process default values */ - for( ; i<nTotalParms; i++ ) - { - if ((p_token->u.token.parm[i].flags & CON_PARM_DEFVAL) != 0) - { - p_token->u.token.parm[i].flags &= ~CON_PARM_NOVAL; - ++nParms; - } - else if (!(p_token->u.token.parm[i].flags & CON_PARM_OPTIONAL) ) - { - /* Mandatory parameter missing */ - return FALSE; - } - } - - if( print_params ) - { - os_error_printf((S32)CU_MSG_INFO2, (PS8)("Params: %d\n"), nParms ); - for (i=0; i<nParms; i++ ) - { - os_error_printf(CU_MSG_INFO2, (PS8)("%d: %s - flags:%d"), - i+1, (PS8)p_token->u.token.parm[i].name, - p_token->u.token.parm[i].flags); - - if (p_token->u.token.parm[i].flags & CON_PARM_SIGN) - os_error_printf(CU_MSG_INFO2, (PS8)("min:%d, max:%d, value:%d "),(PS8)p_token->u.token.parm[i].low_val, (PS8)p_token->u.token.parm[i].hi_val, - (PS8)p_token->u.token.parm[i].value); - else - os_error_printf(CU_MSG_INFO2, (PS8)("min:%ld, max:%ld, value:%ld "),(PS8)p_token->u.token.parm[i].low_val, (PS8)p_token->u.token.parm[i].hi_val, - (PS8)p_token->u.token.parm[i].value); - - os_error_printf(CU_MSG_INFO2, (PS8)("(%#lx)"),(PS8)p_token->u.token.parm[i].value ); - - if( p_token->u.token.parm[i].flags & (CON_PARM_LINE | CON_PARM_STRING )) - { - os_error_printf(CU_MSG_INFO2, (PS8)(" - '%s'"), (PS8)(char *) p_token->u.token.parm[i].value ); - } - os_error_printf(CU_MSG_INFO2, (PS8)("\n") ); - } - - } - *pnParms = nParms; - - return TRUE; -} - -/* Serach a token by name in the current directory */ -static ConEntry_t *Console_searchToken( ConEntry_t *p_dir, PS8 name ) -{ - ConEntry_t *p_token; - U16 name_len = (U16)os_strlen( name ); - - /* Check alias */ - p_token = p_dir->u.dir.first; - while( p_token ) - { - if (p_token->alias && - (name_len == ALIAS_LEN) && - !Console_stricmp( p_token->alias, name, ALIAS_LEN ) ) - return p_token; - p_token = p_token->next; - } - - /* Check name */ - p_token = p_dir->u.dir.first; - while( p_token ) - { - if (!Console_stricmp( p_token->name, name, name_len ) ) - break; - p_token = p_token->next; - } - - return p_token; -} - - -/* Display help for each entry in the current directory */ -VOID Console_dirHelp(Console_t* pConsole) -{ - ConEntry_t *p_token; - S8 print_str[80]; - - p_token = pConsole->p_cur_dir->u.dir.first; - - while( p_token ) - { - if (p_token->sel == Dir) - os_sprintf( print_str, (PS8)"%s: directory\n", (PS8)p_token->name ); - else - os_sprintf( print_str, (PS8)("%s(%d parms): %s\n"), - (PS8)p_token->name, Console_getNParms(p_token), p_token->help ); - os_error_printf(CU_MSG_INFO2, (PS8)print_str ); - p_token = p_token->next; - } - - os_error_printf(CU_MSG_INFO2, (PS8)("Type ? <name> for command help, \"/\"-root, \"..\"-upper\n") ); -} - - -/* Display help a token */ -static VOID Console_displayHelp(Console_t* pConsole, ConEntry_t *p_token ) -{ - S8 bra, ket; - U16 nTotalParms = Console_getNParms( p_token ); - U16 i; - - - os_error_printf(CU_MSG_INFO2, (PS8)("%s: %s "), (PS8)p_token->help, (PS8)p_token->name ); - for( i=0; i<nTotalParms; i++ ) - { - if (p_token->u.token.parm[i].flags & CON_PARM_OPTIONAL) - { - bra = '['; ket=']'; - } - else - { - bra = '<'; ket='>'; - } - os_error_printf(CU_MSG_INFO2, (PS8)("%c%s"), bra, (PS8)p_token->u.token.parm[i].name ); - if (p_token->u.token.parm[i].flags & CON_PARM_DEFVAL) - { - os_error_printf(CU_MSG_INFO2, (PS8)("=%lu"), (PS8)p_token->u.token.parm[i].value); - } - if (p_token->u.token.parm[i].flags & CON_PARM_RANGE) - { - os_error_printf(CU_MSG_INFO2, (PS8)(p_token->u.token.parm[i].flags & CON_PARM_SIGN) ? (PS8)(" (%d..%d%s)") : (PS8)(" (%lu..%lu%s)"), - (PS8)p_token->u.token.parm[i].low_val, - (PS8)p_token->u.token.parm[i].hi_val, - (PS8)(p_token->u.token.parm[i].flags & (CON_PARM_STRING | CON_PARM_LINE)) ? (PS8)(" chars") : (PS8)("") ); - - } - os_error_printf(CU_MSG_INFO2, (PS8)("%c \n"),ket ); - } -} - -/* Choose unique alias for <name> in <p_dir> */ -/* Currently only single-character aliases are supported */ -static S32 Console_chooseAlias( ConEntry_t *p_dir, ConEntry_t *p_new_token ) -{ - ConEntry_t *p_token; - S32 i; - S8 c; - PS8 new_alias = NULL; - - /* find alias given from user */ - for(i=0; p_new_token->name[i]; i++ ) - { - if( os_isupper( p_new_token->name[i]) ) - { - new_alias = &p_new_token->name[i]; - break; - } - } - - Console_strlwr( p_new_token->name ); - - if( new_alias ) - { - p_token = p_dir->u.dir.first; - - while( p_token ) - { - if (p_token->alias && (os_tolower(*p_token->alias ) == *new_alias) ) - { - os_error_printf(CU_MSG_ERROR, (PS8)("Error - duplicated alias '%c' in <%s> and <%s>**\n"), *new_alias, - (PS8)p_token->name, (PS8)p_new_token->name ); - return 0; - } - p_token = p_token->next; - } - *new_alias = (S8)os_toupper(*new_alias); - p_new_token->alias = new_alias; - return 1; - } - - i = 0; - while( p_new_token->name[i] ) - { - c = p_new_token->name[i]; - p_token = p_dir->u.dir.first; - - while( p_token ) - { - if (p_token->alias && - (os_tolower(*p_token->alias ) == c) ) - break; - p_token = p_token->next; - } - if (p_token) - ++i; - else - { - p_new_token->name[i] = (S8)os_toupper( c ); - p_new_token->alias = &p_new_token->name[i]; - break; - } - } - return 1; -} - -/* Parse the given input string and exit. -All commands in the input string are executed one by one. -*/ -static U8 Console_ParseString(Console_t* pConsole, PS8 input_string ) -{ - ConEntry_t *p_token; - S8 name[MAX_NAME_LEN]; - TokenType_t tType; - U16 nParms; - - if (!pConsole->p_mon_root) - return 1; - - if(!pConsole->isDeviceOpen) - { - Console_GetDeviceStatus(pConsole); - if(!pConsole->isDeviceOpen) - { - os_error_printf(CU_MSG_ERROR, (PS8)("ERROR - Console_ParseString - Device isn't loaded !!!\n") ); - return 1; - } - } - - if( input_string[os_strlen( input_string)-1] == '\n' ) - { - PS8 s = &input_string[os_strlen( input_string)-1]; - *s = 0; - } - pConsole->p_inbuf = input_string; - pConsole->stop_UI_Monitor = FALSE; - - /* Interpret empty string as "display directory" */ - if ( pConsole->p_inbuf && !*pConsole->p_inbuf ) - Console_displayDir(pConsole); - - while(!pConsole->stop_UI_Monitor && pConsole->p_inbuf && *pConsole->p_inbuf) - { - tType = Console_getWord(pConsole, name, MAX_NAME_LEN ); - switch( tType ) - { - - case NameToken: - p_token = Console_searchToken( pConsole->p_cur_dir, name ); - if (p_token == NULL) - { - os_error_printf(CU_MSG_ERROR, (PS8)("**Error: '%s'**\n"),name); - pConsole->p_inbuf = NULL; - } - else if (p_token->sel == Dir) - { - pConsole->p_cur_dir = p_token; - Console_displayDir(pConsole); - } - else - { /* Function token */ - if (!Console_parseParms(pConsole, p_token, &nParms )) - { - Console_displayHelp(pConsole, p_token ); - } - else - { - p_token->u.token.f_tokenFunc(pConsole->hCuCmd, p_token->u.token.parm, nParms ); - } - } - break; - - case UpToken: /* Go to upper directory */ - if (pConsole->p_cur_dir->u.dir.upper) - pConsole->p_cur_dir = pConsole->p_cur_dir->u.dir.upper; - Console_displayDir(pConsole); - break; - - case RootToken: /* Go to the root directory */ - if (pConsole->p_cur_dir->u.dir.upper) - pConsole->p_cur_dir = pConsole->p_mon_root; - Console_displayDir(pConsole); - break; - - case HelpToken: /* Display help */ - if (( Console_getWord(pConsole, name, MAX_NAME_LEN ) == NameToken ) && - ((p_token = Console_searchToken( pConsole->p_cur_dir, name )) != NULL ) && - (p_token->sel == Token) ) - Console_displayHelp(pConsole, p_token); - else - Console_dirHelp(pConsole); - break; - - case DirHelpToken: - Console_displayDir(pConsole); - os_error_printf(CU_MSG_INFO2, (PS8)("Type ? <name> for command help, \"/\"-root, \"..\"-upper\n") ); - break; - - case BreakToken: /* Clear buffer */ - pConsole->p_inbuf = NULL; - break; - - case QuitToken: /* Go to upper directory */ - return 1; - - case EmptyToken: - break; - - } - } - return 0; -} - -/* functions */ -/*************/ - -THandle Console_Create(const PS8 device_name, S32 BypassSupplicant, PS8 pSupplIfFile) -{ - Console_t* pConsole = (Console_t*)os_MemoryCAlloc(sizeof(Console_t), sizeof(U8)); - if(pConsole == NULL) - { - os_error_printf(CU_MSG_ERROR, (PS8)("Error - Console_Create - cant allocate control block\n") ); - return NULL; - } - - pConsole->hCuCmd = CuCmd_Create(device_name, pConsole, BypassSupplicant, pSupplIfFile); - if(pConsole->hCuCmd == NULL) - { - Console_Destroy(pConsole); - return NULL; - } - - Console_allocRoot(pConsole); - - pConsole->isDeviceOpen = FALSE; - - return pConsole; -} - -VOID Console_Destroy(THandle hConsole) -{ - Console_t* pConsole = (Console_t*)hConsole; - - if(pConsole->hCuCmd) - { - CuCmd_Destroy(pConsole->hCuCmd); - } - if (pConsole->p_mon_root) - { - Console_FreeEntry(pConsole->p_mon_root); - } - os_MemoryFree(pConsole); -} - -VOID Console_Stop(THandle hConsole) -{ - ((Console_t*)hConsole)->stop_UI_Monitor = TRUE; -} - -/* Monitor driver */ -VOID Console_Start(THandle hConsole) -{ - Console_t* pConsole = (Console_t*)hConsole; - S8 inbuf[INBUF_LENGTH]; - S32 res; - - if (!pConsole->p_mon_root) - return; - - pConsole->stop_UI_Monitor = FALSE; - Console_displayDir(pConsole); - - while(!pConsole->stop_UI_Monitor) - { - /* get input string */ - res = os_getInputString(inbuf, sizeof(inbuf)); - if (res == FALSE) - { - if(pConsole->stop_UI_Monitor) - { - continue; - } - else - { - return; - } - } - - if(res == OS_GETINPUTSTRING_CONTINUE) - continue; - - /* change to NULL terminated strings */ - if( inbuf[os_strlen(inbuf)-1] == '\n' ) - inbuf[os_strlen(inbuf)-1] = 0; - - /* parse the string */ - Console_ParseString(pConsole, inbuf); - } - -} - -VOID Console_GetDeviceStatus(THandle hConsole) -{ - Console_t* pConsole = (Console_t*)hConsole; - - if(OK == CuCmd_GetDeviceStatus(pConsole->hCuCmd)) - { - pConsole->isDeviceOpen = TRUE; - } -} - - -/*************************************************************** - - Function : consoleAddDirExt - - Description: Add subdirectory - - Parameters: p_root - root directory handle (might be NULL) - name - directory name - - Output: the new created directory handle - =NULL - failure -***************************************************************/ -THandle Console_AddDirExt(THandle hConsole, - THandle hRoot, /* Upper directory handle. NULL=root */ - const PS8 name, /* New directory name */ - const PS8 desc ) /* Optional dir description */ -{ - Console_t* pConsole = (Console_t*)hConsole; - ConEntry_t *p_root = (ConEntry_t *)hRoot; - ConEntry_t *p_dir; - ConEntry_t **p_e; - - if (!p_root) - p_root = pConsole->p_mon_root; - - if(!( p_root && (p_root->sel == Dir))) - return NULL; - - if ( (p_dir=(ConEntry_t *)os_MemoryAlloc(sizeof( ConEntry_t )) ) == NULL) - return NULL; - - os_memset( p_dir, 0, sizeof( ConEntry_t ) ); - os_strncpy( p_dir->name, name, MAX_NAME_LEN ); - os_strncpy( p_dir->help, desc, MAX_HELP_LEN ); - p_dir->sel = Dir; - - Console_chooseAlias( p_root, p_dir ); - - /* Add new directory to the root's list */ - p_dir->u.dir.upper = p_root; - p_e = &(p_root->u.dir.first); - while (*p_e) - p_e = &((*p_e)->next); - *p_e = p_dir; - - return p_dir; -} - -/*************************************************************** - - Function : consoleAddToken - - Description: Add token - - Parameters: p_dir - directory handle (might be NULL=root) - name - token name - help - help string - p_func - token handler - p_parms- array of parameter descriptions. - Must be terminated with {0}. - Each parm descriptor is a struct - { "myname", - name - 10, - low value - 20, - high value - 0 } - default value =-1 no default - or address for string parameter - - Output: E_OK - OK - !=0 - error -***************************************************************/ -consoleErr Console_AddToken( THandle hConsole, - THandle hDir, - const PS8 name, - const PS8 help, - FuncToken_t p_func, - ConParm_t p_parms[] ) -{ - Console_t* pConsole = (Console_t*)hConsole; - ConEntry_t *p_dir = (ConEntry_t *)hDir; - ConEntry_t *p_token; - ConEntry_t **p_e; - U16 i; - - if (!pConsole->p_mon_root) - Console_allocRoot(pConsole); - - if (!p_dir) - p_dir = pConsole->p_mon_root; - - if(!( p_dir && (p_dir->sel == Dir))) - return E_ERROR; - - - /* Initialize token structure */ - if((p_token = (ConEntry_t *)os_MemoryCAlloc(1,sizeof(ConEntry_t))) == NULL) - { - os_error_printf(CU_MSG_ERROR, (PS8)("** no memory **\n") ); - return E_NOMEMORY; - } - - - /* Copy name */ - os_strncpy( p_token->name, name, MAX_NAME_LEN ); - os_strncpy( p_token->help, help, MAX_HELP_LEN ); - p_token->sel = Token; - p_token->u.token.f_tokenFunc = p_func; - p_token->u.token.totalParams = 0; - - /* Convert name to lower case and choose alias */ - Console_chooseAlias( p_dir, p_token ); - - /* Copy parameters */ - if ( p_parms ) - { - ConParm_t *p_tmpParms = p_parms; - - /* find the number of params */ - while( p_tmpParms->name && p_tmpParms->name[0] ) - { - p_token->u.token.totalParams++; - p_tmpParms++; - } - /* allocate the parameters info */ - p_token->u.token.parm = (ConParm_t *)os_MemoryAlloc(p_token->u.token.totalParams * sizeof(ConParm_t)); - p_token->u.token.name = (PS8*)os_MemoryAlloc(p_token->u.token.totalParams * sizeof(PS8)); - if ((p_token->u.token.parm == NULL) || (p_token->u.token.name == NULL)) - { - os_error_printf(CU_MSG_ERROR, (PS8)("** no memory for params\n") ); - os_MemoryFree(p_token); - return E_NOMEMORY; - } - for (i=0; i < p_token->u.token.totalParams; i++) - { - ConParm_t *p_token_parm = &p_token->u.token.parm[i]; - - /* String parameter must have an address */ - if(p_parms->flags & (CON_PARM_STRING | CON_PARM_LINE)) - { - if ( p_parms->hi_val >= INBUF_LENGTH ) - { - os_error_printf(CU_MSG_ERROR, (PS8)("** buffer too big: %s/%s\n"), p_dir->name, name); - os_MemoryFree(p_token->u.token.parm); - os_MemoryFree(p_token->u.token.name); - os_MemoryFree(p_token); - return E_NOMEMORY; - - } - if (p_parms->hi_val == 0 || (p_parms->flags & CON_PARM_RANGE) ) - { - os_error_printf(CU_MSG_ERROR, (PS8)("** Bad string param definition: %s/%s\n"), p_dir->name, name ); - os_MemoryFree(p_token->u.token.parm); - os_MemoryFree(p_token->u.token.name); - os_MemoryFree(p_token); - return E_BADPARM; - } - p_parms->value = (U32)os_MemoryCAlloc(1,p_parms->hi_val+1); - if( !p_parms->value ) - { - os_error_printf(CU_MSG_ERROR, (PS8)("** No memory: %s/%s (max.size=%ld)\n"), p_dir->name, name, p_parms->hi_val ); - os_MemoryFree(p_token->u.token.parm); - os_MemoryFree(p_token->u.token.name); - os_MemoryFree(p_token); - return E_NOMEMORY; - } - } - - /* Copy parameter */ - *p_token_parm = *p_parms; - if( p_token_parm->hi_val || p_token_parm->low_val ) - p_token_parm->flags |= CON_PARM_RANGE; - - p_token->u.token.name[i] = os_MemoryAlloc(os_strlen(p_parms->name)); - if (p_token->u.token.name[i] == NULL) - { - os_error_printf(CU_MSG_ERROR, (PS8)("** Error allocate param name\n")); - os_MemoryFree(p_token->u.token.parm); - os_MemoryFree(p_token->u.token.name); - os_MemoryFree(p_token); - return E_NOMEMORY; - } - p_token_parm->name = (PS8)p_token->u.token.name[i]; - os_strncpy( p_token->u.token.name[i], p_parms->name, os_strlen(p_parms->name) ); - ++p_parms; - } /*end of for loop*/ - } - - /* Add token to the directory */ - p_e = &(p_dir->u.dir.first); - while (*p_e) - p_e = &((*p_e)->next); - *p_e = p_token; - - return E_OK; -} - -int consoleRunScript( char *script_file, THandle hConsole) -{ - FILE *hfile = fopen(script_file, "r" ); - U8 status = 0; - Console_t* pConsole = (Console_t*)hConsole; - - if( hfile ) - { - char buf[INBUF_LENGTH]; - pConsole->stop_UI_Monitor = FALSE; - - while( fgets(buf, sizeof(buf), hfile ) ) - { - status = Console_ParseString(pConsole, buf); - if (status == 1) - return TRUE; - if( pConsole->stop_UI_Monitor ) - break; - } - - fclose(hfile); - } - else - { - os_error_printf(CU_MSG_ERROR, (PS8)("ERROR in script: %s \n"), (PS8)script_file); - } - return pConsole->stop_UI_Monitor; -} diff --git a/wl1271/CUDK/configurationutility/src/cu_cmd.c b/wl1271/CUDK/configurationutility/src/cu_cmd.c deleted file mode 100644 index 3b7eafe6..00000000 --- a/wl1271/CUDK/configurationutility/src/cu_cmd.c +++ /dev/null @@ -1,6386 +0,0 @@ -/* - * cu_cmd.c - * - * Copyright 2001-2010 Texas Instruments, Inc. - http://www.ti.com/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/**************************************************************************** -* -* MODULE: cu_cmd.c -* -* PURPOSE: -* -* DESCRIPTION: -* ============ -* -* -****************************************************************************/ - -/* includes */ -/************/ - -#include <stdio.h> - -#include "cu_osapi.h" -#include "TWDriver.h" -#include "convert.h" -#include "console.h" -#include "cu_common.h" -#include "cu_os.h" -#include "ipc_event.h" -#include "wpa_core.h" -#include "cu_cmd.h" -#include "oserr.h" - -/* defines */ -/***********/ -#define print_available_values(arr) \ - { \ - S32 i; \ - for(i=0; i<SIZE_ARR(arr); i++) \ - os_error_printf(CU_MSG_INFO2, (PS8)"%d - %s%s", arr[i].value, arr[i].name, (i>=SIZE_ARR(arr)-1) ? (PS8)"\n" : (PS8)", " ); \ - } - -#define CU_CMD_FIND_NAME_ARRAY(index, arr, val) \ - for ( index = 0; index < SIZE_ARR(arr); index++ ) \ - if ( arr[ index ].value == (val) ) \ - break; \ - -#define CHAN_FREQ_TABLE_SIZE (sizeof(ChanFreq) / sizeof(struct CHAN_FREQ)) - -#define IS_BASIC_RATE(a) ((a) & NET_BASIC_MASK) - -#define RATE_2_MBPS(a) ((F32)((a) & (NET_BASIC_MASK-1))/2) - -#define NET_BASIC_MASK 0x80 /* defined in common/src/utils/utils.c */ - -#define BIT_TO_BYTE_FACTOR 8 - -#define NVS_FILE_TX_PARAMETERS_UPDATE 0 -#define NVS_FILE_RX_PARAMETERS_UPDATE 1 - - -/* local types */ -/***************/ -/* Module control block */ -typedef struct CuCmd_t -{ - THandle hCuWext; - THandle hCuCommon; - THandle hConsole; - THandle hIpcEvent; - THandle hWpaCore; - - U32 isDeviceRunning; - - scan_Params_t appScanParams; - TPeriodicScanParams tPeriodicAppScanParams; - scan_Policy_t scanPolicy; - -} CuCmd_t; - -/* local variables */ -/*******************/ -struct CHAN_FREQ { - U8 chan; - U32 freq; -} ChanFreq[] = { - {1,2412000}, {2,2417000}, {3,2422000}, {4,2427000}, - {5,2432000}, {6,2437000}, {7,2442000}, {8,2447000}, - {9,2452000}, - {10,2457000}, {11,2462000}, {12,2467000}, {13,2472000}, - {14,2484000}, {36,5180000}, {40,5200000}, {44,5220000}, - {48,5240000}, {52,5260000}, {56,5280000}, {60,5300000}, - {64,5320000}, - {100,5500000}, {104,5520000}, {108,5540000}, {112,5560000}, - {116,5580000}, {120,5600000}, {124,5620000}, {128,5640000}, - {132,5660000}, {136,5680000}, {140,5700000}, {149,5745000}, - {153,5765000}, {157,5785000}, {161,5805000} }; - -static named_value_t BSS_type[] = -{ - { os802_11IBSS, (PS8)"AD-Hoc" }, - { os802_11Infrastructure, (PS8)"Infr." }, - { os802_11AutoUnknown, (PS8)"Auto" }, -}; - -static named_value_t Current_mode[] = -{ - { 0, (PS8)"SME Auto" }, - { 1, (PS8)"SME Manual" }, -}; - -static named_value_t BeaconFilter_use[] = -{ - { 0, (PS8)"INACTIVE" }, - { 1, (PS8)"ACTIVE" }, -}; - -static named_value_t event_type[] = { - { IPC_EVENT_ASSOCIATED, (PS8)"Associated" }, - { IPC_EVENT_DISASSOCIATED, (PS8)"Disassociated" }, - { IPC_EVENT_LINK_SPEED, (PS8)"LinkSpeed" }, - { IPC_EVENT_AUTH_SUCC, (PS8)"Authentication Success" }, - { IPC_EVENT_SCAN_COMPLETE, (PS8)"ScanComplete" }, - { IPC_EVENT_SCAN_STOPPED, (PS8)"ScanStopped" }, -#ifdef XCC_MODULE_INCLUDED - { IPC_EVENT_CCKM_START, (PS8)"CCKM_Start" }, -#endif - { IPC_EVENT_MEDIA_SPECIFIC, (PS8)"Media_Specific" }, - { IPC_EVENT_EAPOL, (PS8)"EAPOL" }, - { IPC_EVENT_RE_AUTH_STARTED, (PS8)"IPC_EVENT_RE_AUTH_STARTED" }, - { IPC_EVENT_RE_AUTH_COMPLETED, (PS8)"IPC_EVENT_RE_AUTH_COMPLETED" }, - { IPC_EVENT_RE_AUTH_TERMINATED, (PS8)"IPC_EVENT_RE_AUTH_TERMINATED" }, - { IPC_EVENT_BOUND, (PS8)"Bound" }, - { IPC_EVENT_UNBOUND, (PS8)"Unbound" }, -#ifdef WPA_ENTERPRISE - { IPC_EVENT_PREAUTH_EAPOL, (PS8)"PreAuth EAPOL"}, -#endif - { IPC_EVENT_LOW_RSSI, (PS8)"Low RSSI" }, - { IPC_EVENT_TSPEC_STATUS, (PS8)"IPC_EVENT_TSPEC_STATUS" }, - { IPC_EVENT_TSPEC_RATE_STATUS, (PS8)"IPC_EVENT_TSPEC_RATE_STATUS" }, - { IPC_EVENT_MEDIUM_TIME_CROSS, (PS8)"IPC_EVENT_MEDIUM_TIME_CROSS" }, - { IPC_EVENT_ROAMING_COMPLETE, (PS8)"ROAMING_COMPLETE"}, - { IPC_EVENT_EAP_AUTH_FAILURE, (PS8)"EAP-FAST/LEAP Auth Failed"}, - { IPC_EVENT_WPA2_PREAUTHENTICATION, (PS8)"IPC_EVENT_WPA2_PREAUTHENTICATION" }, - { IPC_EVENT_TRAFFIC_INTENSITY_THRESHOLD_CROSSED, (PS8)"IPC_EVENT_TRAFFIC_INTENSITY_THRESHOLD_CROSSED" }, - { IPC_EVENT_SCAN_FAILED, (PS8)"ScanFailed" }, - { IPC_EVENT_WPS_SESSION_OVERLAP, (PS8)"IPC_EVENT_WPS_SESSION_OVERLAP" }, - { IPC_EVENT_RSSI_SNR_TRIGGER, (PS8)"IPC_EVENT_RSSI_SNR_TRIGGER" }, - { IPC_EVENT_TIMEOUT, (PS8)"Timeout" } -}; - -static named_value_t report_module[] = -{ - { FILE_ID_0 , (PS8)"timer " }, - { FILE_ID_1 , (PS8)"measurementMgr " }, - { FILE_ID_2 , (PS8)"measurementMgrSM " }, - { FILE_ID_3 , (PS8)"regulatoryDomain " }, - { FILE_ID_4 , (PS8)"requestHandler " }, - { FILE_ID_5 , (PS8)"SoftGemini " }, - { FILE_ID_6 , (PS8)"spectrumMngmntMgr " }, - { FILE_ID_7 , (PS8)"SwitchChannel " }, - { FILE_ID_8 , (PS8)"roamingMngr " }, - { FILE_ID_9 , (PS8)"scanMngr " }, - { FILE_ID_10 , (PS8)"admCtrlXCC " }, - { FILE_ID_11 , (PS8)"XCCMngr " }, - { FILE_ID_12 , (PS8)"XCCRMMngr " }, - { FILE_ID_13 , (PS8)"XCCTSMngr " }, - { FILE_ID_14 , (PS8)"rogueAp " }, - { FILE_ID_15 , (PS8)"TransmitPowerXCC " }, - { FILE_ID_16 , (PS8)"admCtrl " }, - { FILE_ID_17 , (PS8)"admCtrlNone " }, - { FILE_ID_18 , (PS8)"admCtrlWep " }, - { FILE_ID_19 , (PS8)"admCtrlWpa " }, - { FILE_ID_20 , (PS8)"admCtrlWpa2 " }, - { FILE_ID_21 , (PS8)"apConn " }, - { FILE_ID_22 , (PS8)"broadcastKey802_1x " }, - { FILE_ID_23 , (PS8)"broadcastKeyNone " }, - { FILE_ID_24 , (PS8)"broadcastKeySM " }, - { FILE_ID_25 , (PS8)"conn " }, - { FILE_ID_26 , (PS8)"connIbss " }, - { FILE_ID_27 , (PS8)"connInfra " }, - { FILE_ID_28 , (PS8)"keyDerive " }, - { FILE_ID_29 , (PS8)"keyDeriveAes " }, - { FILE_ID_30 , (PS8)"keyDeriveCkip " }, - { FILE_ID_31 , (PS8)"keyDeriveTkip " }, - { FILE_ID_32 , (PS8)"keyDeriveWep " }, - { FILE_ID_33 , (PS8)"keyParser " }, - { FILE_ID_34 , (PS8)"keyParserExternal " }, - { FILE_ID_35 , (PS8)"keyParserWep " }, - { FILE_ID_36 , (PS8)"mainKeysSm " }, - { FILE_ID_37 , (PS8)"mainSecKeysOnly " }, - { FILE_ID_38 , (PS8)"mainSecNull " }, - { FILE_ID_39 , (PS8)"mainSecSm " }, - { FILE_ID_40 , (PS8)"rsn " }, - { FILE_ID_41 , (PS8)"sme " }, - { FILE_ID_42 , (PS8)"smeSelect " }, - { FILE_ID_43 , (PS8)"smeSm " }, - { FILE_ID_44 , (PS8)"unicastKey802_1x " }, - { FILE_ID_45 , (PS8)"unicastKeyNone " }, - { FILE_ID_46 , (PS8)"unicastKeySM " }, - { FILE_ID_47 , (PS8)"CmdDispatcher " }, - { FILE_ID_48 , (PS8)"CmdHndlr " }, - { FILE_ID_49 , (PS8)"DrvMain " }, - { FILE_ID_50 , (PS8)"EvHandler " }, - { FILE_ID_51 , (PS8)"Ctrl " }, - { FILE_ID_52 , (PS8)"GeneralUtil " }, - { FILE_ID_53 , (PS8)"RateAdaptation " }, - { FILE_ID_54 , (PS8)"rx " }, - { FILE_ID_55 , (PS8)"TrafficMonitor " }, - { FILE_ID_56 , (PS8)"txCtrl " }, - { FILE_ID_57 , (PS8)"txCtrlParams " }, - { FILE_ID_58 , (PS8)"txCtrlServ " }, - { FILE_ID_59 , (PS8)"TxDataClsfr " }, - { FILE_ID_60 , (PS8)"txDataQueue " }, - { FILE_ID_61 , (PS8)"txMgmtQueue " }, - { FILE_ID_62 , (PS8)"txPort " }, - { FILE_ID_63 , (PS8)"assocSM " }, - { FILE_ID_64 , (PS8)"authSm " }, - { FILE_ID_65 , (PS8)"currBss " }, - { FILE_ID_66 , (PS8)"healthMonitor " }, - { FILE_ID_67 , (PS8)"mlmeBuilder " }, - { FILE_ID_68 , (PS8)"mlmeParser " }, - { FILE_ID_69 , (PS8)"mlmeSm " }, - { FILE_ID_70 , (PS8)"openAuthSm " }, - { FILE_ID_71 , (PS8)"PowerMgr " }, - { FILE_ID_72 , (PS8)"PowerMgrDbgPrint " }, - { FILE_ID_73 , (PS8)"PowerMgrKeepAlive " }, - { FILE_ID_74 , (PS8)"qosMngr " }, - { FILE_ID_75 , (PS8)"roamingInt " }, - { FILE_ID_76 , (PS8)"ScanCncn " }, - { FILE_ID_77 , (PS8)"ScanCncnApp " }, - { FILE_ID_78 , (PS8)"ScanCncnOsSm " }, - { FILE_ID_79 , (PS8)"ScanCncnSm " }, - { FILE_ID_80 , (PS8)"ScanCncnSmSpecific " }, - { FILE_ID_81 , (PS8)"scanResultTable " }, - { FILE_ID_82 , (PS8)"scr " }, - { FILE_ID_83 , (PS8)"sharedKeyAuthSm " }, - { FILE_ID_84 , (PS8)"siteHash " }, - { FILE_ID_85 , (PS8)"siteMgr " }, - { FILE_ID_86 , (PS8)"StaCap " }, - { FILE_ID_87 , (PS8)"systemConfig " }, - { FILE_ID_88 , (PS8)"templates " }, - { FILE_ID_89 , (PS8)"trafficAdmControl " }, - { FILE_ID_90 , (PS8)"CmdBld " }, - { FILE_ID_91 , (PS8)"CmdBldCfg " }, - { FILE_ID_92 , (PS8)"CmdBldCfgIE " }, - { FILE_ID_93 , (PS8)"CmdBldCmd " }, - { FILE_ID_94 , (PS8)"CmdBldCmdIE " }, - { FILE_ID_95 , (PS8)"CmdBldItr " }, - { FILE_ID_96 , (PS8)"CmdBldItrIE " }, - { FILE_ID_97 , (PS8)"CmdQueue " }, - { FILE_ID_98 , (PS8)"RxQueue " }, - { FILE_ID_99 , (PS8)"txCtrlBlk " }, - { FILE_ID_100 , (PS8)"txHwQueue " }, - { FILE_ID_101 , (PS8)"CmdMBox " }, - { FILE_ID_102 , (PS8)"eventMbox " }, - { FILE_ID_103 , (PS8)"fwDebug " }, - { FILE_ID_104 , (PS8)"FwEvent " }, - { FILE_ID_105 , (PS8)"HwInit " }, - { FILE_ID_106 , (PS8)"RxXfer " }, - { FILE_ID_107 , (PS8)"txResult " }, - { FILE_ID_108 , (PS8)"txXfer " }, - { FILE_ID_109 , (PS8)"MacServices " }, - { FILE_ID_110 , (PS8)"MeasurementSrv " }, - { FILE_ID_111 , (PS8)"measurementSrvDbgPrint " }, - { FILE_ID_112 , (PS8)"MeasurementSrvSM " }, - { FILE_ID_113 , (PS8)"PowerSrv " }, - { FILE_ID_114 , (PS8)"PowerSrvSM " }, - { FILE_ID_115 , (PS8)"ScanSrv " }, - { FILE_ID_116 , (PS8)"ScanSrvSM " }, - { FILE_ID_117 , (PS8)"TWDriver " }, - { FILE_ID_118 , (PS8)"TWDriverCtrl " }, - { FILE_ID_119 , (PS8)"TWDriverRadio " }, - { FILE_ID_120 , (PS8)"TWDriverTx " }, - { FILE_ID_121 , (PS8)"TwIf " }, - { FILE_ID_122 , (PS8)"SdioBusDrv " }, - { FILE_ID_123 , (PS8)"TxnQueue " }, - { FILE_ID_124 , (PS8)"WspiBusDrv " }, - { FILE_ID_125 , (PS8)"context " }, - { FILE_ID_126 , (PS8)"freq " }, - { FILE_ID_127 , (PS8)"fsm " }, - { FILE_ID_128 , (PS8)"GenSM " }, - { FILE_ID_129 , (PS8)"mem " }, - { FILE_ID_130 , (PS8)"queue " }, - { FILE_ID_131 , (PS8)"rate " }, - { FILE_ID_132 , (PS8)"report " }, - { FILE_ID_133 , (PS8)"stack " }, - { FILE_ID_134 , (PS8)"externalSec " }, - { FILE_ID_135 , (PS8)"roamingMngr_autoSM " }, - { FILE_ID_136 , (PS8)"roamingMngr_manualSM " }, - { FILE_ID_137 , (PS8)"cmdinterpretoid " }, - { FILE_ID_138 , (PS8)"WlanDrvIf " } -}; - -static named_value_t report_severity[] = { - { 0, (PS8)"----" }, - { REPORT_SEVERITY_INIT, (PS8)"INIT", }, - { REPORT_SEVERITY_INFORMATION, (PS8)"INFORMATION", }, - { REPORT_SEVERITY_WARNING, (PS8)"WARNING", }, - { REPORT_SEVERITY_ERROR, (PS8)"ERROR", }, - { REPORT_SEVERITY_FATAL_ERROR, (PS8)"FATAL_ERROR", }, - { REPORT_SEVERITY_SM, (PS8)"SM", }, - { REPORT_SEVERITY_CONSOLE, (PS8)"CONSOLE" } -}; - -static named_value_t power_level[] = { - { OS_POWER_LEVEL_ELP, (PS8)"Extreme Low Power" }, - { OS_POWER_LEVEL_PD, (PS8)"Power Down" }, - { OS_POWER_LEVEL_AWAKE, (PS8)"Awake" }, -}; - -static named_value_t band2Str[] = { - { RADIO_BAND_2_4_GHZ, (PS8)"2.4 GHz" }, - { RADIO_BAND_5_0_GHZ, (PS8)"5.0 GHz" }, - { RADIO_BAND_DUAL, (PS8)"Both " } -}; - -static named_value_t EtEvent2Str[] = { - { SCAN_ET_COND_DISABLE, (PS8)"ET disabled " }, - { SCAN_ET_COND_BEACON, (PS8)"ET on Beacon " }, - { SCAN_ET_COND_PROBE_RESP, (PS8)"ET on Prb Rsp" }, - { SCAN_ET_COND_ANY_FRAME, (PS8)"ET on both " } -}; - -static named_value_t rate2Str[] = { - { DRV_RATE_MASK_AUTO, (PS8)"Auto " }, - { DRV_RATE_MASK_1_BARKER, (PS8)"1 Mbps " }, - { DRV_RATE_MASK_2_BARKER, (PS8)"2 Mbps " }, - { DRV_RATE_MASK_5_5_CCK, (PS8)"5.5 Mbps" }, - { DRV_RATE_MASK_11_CCK, (PS8)"11 Mbps " }, - { DRV_RATE_MASK_22_PBCC, (PS8)"22 Mbps " }, - { DRV_RATE_MASK_6_OFDM, (PS8)"6 Mbps " }, - { DRV_RATE_MASK_9_OFDM, (PS8)"9 Mbps " }, - { DRV_RATE_MASK_12_OFDM, (PS8)"12 Mbps " }, - { DRV_RATE_MASK_18_OFDM, (PS8)"18 Mbps " }, - { DRV_RATE_MASK_24_OFDM, (PS8)"24 Mbps " }, - { DRV_RATE_MASK_36_OFDM, (PS8)"36 Mbps " }, - { DRV_RATE_MASK_48_OFDM, (PS8)"48 Mbps " }, - { DRV_RATE_MASK_54_OFDM, (PS8)"54 Mbps " } -}; - -static named_value_t scanType2Str[] = { - { SCAN_TYPE_NORMAL_PASSIVE, (PS8)"Passive Normal Scan" }, - { SCAN_TYPE_NORMAL_ACTIVE, (PS8)"Active Normal Scan" }, - { SCAN_TYPE_SPS, (PS8)"Scheduled Passive Scan (SPS)" }, - { SCAN_TYPE_TRIGGERED_PASSIVE, (PS8)"Passive Triggered Scan" }, - { SCAN_TYPE_TRIGGERED_ACTIVE, (PS8)"Active Triggered Scan" } -}; - -static named_value_t booleanStr[] = { - { FALSE, (PS8)"False" }, - { TRUE, (PS8)"True" } -}; - -static named_value_t ssidVisabilityStr[] = { - { SCAN_SSID_VISABILITY_PUBLIC, (PS8)"Public" }, - { SCAN_SSID_VISABILITY_HIDDEN, (PS8)"Hidden" } -}; - -static named_value_t bssTypeStr[] = { - { BSS_INDEPENDENT, (PS8)"Independent" }, - { BSS_INFRASTRUCTURE, (PS8)"Infrastructure" }, - { BSS_ANY, (PS8)"Any" } -}; - -static named_value_t power_mode_val[] = { - { OS_POWER_MODE_AUTO, (PS8)"AUTO" }, - { OS_POWER_MODE_ACTIVE, (PS8)"ACTIVE" }, - { OS_POWER_MODE_SHORT_DOZE, (PS8)"SHORT_DOZE" }, - { OS_POWER_MODE_LONG_DOZE, (PS8)"LONG_DOZE" } -}; - -static named_value_t encrypt_type[] = { - { OS_ENCRYPTION_TYPE_NONE, (PS8)"None" }, - { OS_ENCRYPTION_TYPE_WEP, (PS8)"WEP" }, - { OS_ENCRYPTION_TYPE_TKIP, (PS8)"TKIP" }, - { OS_ENCRYPTION_TYPE_AES, (PS8)"AES" } -}; - -static named_value_t tKeepAliveTriggerTypes[] = { - { KEEP_ALIVE_TRIG_TYPE_NO_TX, (PS8)"When Idle" }, - { KEEP_ALIVE_TRIG_TYPE_PERIOD_ONLY, (PS8)"Always" } -}; - -#if 0 /* need to create debug logic for CLI */ -static named_value_t cli_level_type[] = { - { CU_MSG_DEBUG, (PS8)"CU_MSG_DEBUG" }, - { CU_MSG_INFO1, (PS8)"CU_MSG_INFO1" }, - { CU_MSG_WARNING, (PS8)"CU_MSG_WARNING" }, - { CU_MSG_ERROR, (PS8)"CU_MSG_ERROR" }, - { CU_MSG_INFO2, (PS8)"CU_MSG_INFO2" } -}; -#endif - - -static char *ConnState[] = { - "IDLE", - "SCANNING", - "CONNECTING", - "CONNECTED", - "DISCONNECT", - "IDLE" -}; - - - -static char ssidBuf[MAX_SSID_LEN +1]; - -/* local fucntions */ -/*******************/ -static S32 CuCmd_Str2MACAddr(PS8 str, PU8 mac) -{ - S32 i; - - for( i=0; i<MAC_ADDR_LEN; i++ ) - { - mac[i] = (U8) os_strtoul(str, &str, 16); - str++; - } - return TRUE; -} - -/* used in get_bssid_list() */ -static U8 CuCmd_Freq2Chan(U32 freq) -{ - U32 i; - - for(i=0; i<CHAN_FREQ_TABLE_SIZE; i++) - if(ChanFreq[i].freq == freq) - return ChanFreq[i].chan; - - return 0; -} - -/* Converts a single ASCII character to a hex value (i.e. '0'-'9' = 0-9, 'a'-'f' = a-f, 'A'-'F' = a-f) */ -static U8 CuCmd_atox(U8 c) -{ - if (('0' <= c) && ('9' >= c)) - { - return c - '0'; - } - else if (('a' <= c) && ('f' >= c)) - { - return c - 'a' + 10; - } - else /* assuming input is valid */ - { - return c - 'A' + 10; - } -} - -/* converts an ASCII string to a buffer */ -static void CuCmd_atox_string (U8* srcString, U8* dstBuffer) -{ - U32 uIndex, uLength; - - uLength = os_strlen ((PS8)srcString); - - /* clear the destination buffer */ - os_memset (dstBuffer, 0, (uLength / 2) + 1); - - for (uIndex = 0; uIndex < uLength; uIndex++) - { - if (0 == (uIndex % 2)) - { - dstBuffer[ uIndex / 2 ] |= (CuCmd_atox (srcString[ uIndex ]) << 4); - } - else - { - dstBuffer[ uIndex / 2 ] |= CuCmd_atox (srcString[ uIndex ]); - } - } -} - -static void CuCmd_xtoa_string (U8* srcBuffer, U32 srcBufferLength, U8* dstString) -{ - U32 uIndex; - - for (uIndex = 0; uIndex < srcBufferLength; uIndex++) - { - os_sprintf ((PS8)&(dstString[ uIndex * 2 ]), (PS8)"%02x", srcBuffer[ uIndex ]); - } -} - -static VOID CuCmd_Init_Scan_Params(CuCmd_t* pCuCmd) -{ - U8 i,j; - - /* init application scan default params */ - pCuCmd->appScanParams.desiredSsid.len = 0; - pCuCmd->appScanParams.scanType = SCAN_TYPE_NORMAL_ACTIVE; - pCuCmd->appScanParams.band = RADIO_BAND_2_4_GHZ; - pCuCmd->appScanParams.probeReqNumber = 3; - pCuCmd->appScanParams.probeRequestRate = RATE_MASK_UNSPECIFIED; /* Let the FW select */; - pCuCmd->appScanParams.numOfChannels = 14; - for ( i = 0; i < 14; i++ ) - { - for ( j = 0; j < 6; j++ ) - { - pCuCmd->appScanParams.channelEntry[ i ].normalChannelEntry.bssId[ j ] = 0xff; - } - pCuCmd->appScanParams.channelEntry[ i ].normalChannelEntry.earlyTerminationEvent = SCAN_ET_COND_DISABLE; - pCuCmd->appScanParams.channelEntry[ i ].normalChannelEntry.ETMaxNumOfAPframes = 0; - pCuCmd->appScanParams.channelEntry[ i ].normalChannelEntry.maxChannelDwellTime = 60000; - pCuCmd->appScanParams.channelEntry[ i ].normalChannelEntry.minChannelDwellTime = 30000; - pCuCmd->appScanParams.channelEntry[ i ].normalChannelEntry.txPowerDbm = DEF_TX_POWER; - pCuCmd->appScanParams.channelEntry[ i ].normalChannelEntry.channel = i + 1; - } - - /* init periodic application scan params */ - pCuCmd->tPeriodicAppScanParams.uSsidNum = 0; - pCuCmd->tPeriodicAppScanParams.uSsidListFilterEnabled = 1; - pCuCmd->tPeriodicAppScanParams.uCycleNum = 0; /* forever */ - pCuCmd->tPeriodicAppScanParams.uCycleIntervalMsec[ 0 ] = 3; - for (i = 1; i < PERIODIC_SCAN_MAX_INTERVAL_NUM; i++) - { - pCuCmd->tPeriodicAppScanParams.uCycleIntervalMsec[ i ] = 30000; - } - pCuCmd->tPeriodicAppScanParams.iRssiThreshold = -80; - pCuCmd->tPeriodicAppScanParams.iSnrThreshold = 0; - pCuCmd->tPeriodicAppScanParams.uFrameCountReportThreshold = 1; - pCuCmd->tPeriodicAppScanParams.bTerminateOnReport = TRUE; - pCuCmd->tPeriodicAppScanParams.eBssType = BSS_ANY; - pCuCmd->tPeriodicAppScanParams.uProbeRequestNum = 3; - pCuCmd->tPeriodicAppScanParams.uChannelNum = 14; - for ( i = 0; i < 14; i++ ) - { - pCuCmd->tPeriodicAppScanParams.tChannels[ i ].eBand = RADIO_BAND_2_4_GHZ; - pCuCmd->tPeriodicAppScanParams.tChannels[ i ].uChannel = i + 1; - pCuCmd->tPeriodicAppScanParams.tChannels[ i ].eScanType = SCAN_TYPE_NORMAL_ACTIVE; - pCuCmd->tPeriodicAppScanParams.tChannels[ i ].uMinDwellTimeMs = 5; - pCuCmd->tPeriodicAppScanParams.tChannels[ i ].uMaxDwellTimeMs = 20; - pCuCmd->tPeriodicAppScanParams.tChannels[ i ].uTxPowerLevelDbm = DEF_TX_POWER; - } - - /* init default scan policy */ - pCuCmd->scanPolicy.normalScanInterval = 10000; - pCuCmd->scanPolicy.deterioratingScanInterval = 5000; - pCuCmd->scanPolicy.maxTrackFailures = 3; - pCuCmd->scanPolicy.BSSListSize = 4; - pCuCmd->scanPolicy.BSSNumberToStartDiscovery = 1; - pCuCmd->scanPolicy.numOfBands = 1; - pCuCmd->scanPolicy.bandScanPolicy[ 0 ].band = RADIO_BAND_2_4_GHZ; - pCuCmd->scanPolicy.bandScanPolicy[ 0 ].rxRSSIThreshold = -80; - pCuCmd->scanPolicy.bandScanPolicy[ 0 ].numOfChannles = 14; - pCuCmd->scanPolicy.bandScanPolicy[ 0 ].numOfChannlesForDiscovery = 3; - for ( i = 0; i < 14; i++ ) - { - pCuCmd->scanPolicy.bandScanPolicy[ 0 ].channelList[ i ] = i + 1; - } - pCuCmd->scanPolicy.bandScanPolicy[ 0 ].trackingMethod.scanType = SCAN_TYPE_NORMAL_ACTIVE; - pCuCmd->scanPolicy.bandScanPolicy[ 0 ].trackingMethod.method.basicMethodParams.earlyTerminationEvent = SCAN_ET_COND_DISABLE; - pCuCmd->scanPolicy.bandScanPolicy[ 0 ].trackingMethod.method.basicMethodParams.ETMaxNumberOfApFrames = 0; - pCuCmd->scanPolicy.bandScanPolicy[ 0 ].trackingMethod.method.basicMethodParams.maxChannelDwellTime = 30000; - pCuCmd->scanPolicy.bandScanPolicy[ 0 ].trackingMethod.method.basicMethodParams.minChannelDwellTime = 15000; - pCuCmd->scanPolicy.bandScanPolicy[ 0 ].trackingMethod.method.basicMethodParams.probReqParams.bitrate = RATE_MASK_UNSPECIFIED; /* Let the FW select */ - pCuCmd->scanPolicy.bandScanPolicy[ 0 ].trackingMethod.method.basicMethodParams.probReqParams.numOfProbeReqs = 3; - pCuCmd->scanPolicy.bandScanPolicy[ 0 ].trackingMethod.method.basicMethodParams.probReqParams.txPowerDbm = DEF_TX_POWER; - pCuCmd->scanPolicy.bandScanPolicy[ 0 ].discoveryMethod.scanType = SCAN_TYPE_NORMAL_ACTIVE; - pCuCmd->scanPolicy.bandScanPolicy[ 0 ].discoveryMethod.method.basicMethodParams.earlyTerminationEvent = SCAN_ET_COND_DISABLE; - pCuCmd->scanPolicy.bandScanPolicy[ 0 ].discoveryMethod.method.basicMethodParams.ETMaxNumberOfApFrames = 0; - pCuCmd->scanPolicy.bandScanPolicy[ 0 ].discoveryMethod.method.basicMethodParams.maxChannelDwellTime = 30000; - pCuCmd->scanPolicy.bandScanPolicy[ 0 ].discoveryMethod.method.basicMethodParams.minChannelDwellTime = 15000; - pCuCmd->scanPolicy.bandScanPolicy[ 0 ].discoveryMethod.method.basicMethodParams.probReqParams.bitrate = RATE_MASK_UNSPECIFIED; /* Let the FW select */; - pCuCmd->scanPolicy.bandScanPolicy[ 0 ].discoveryMethod.method.basicMethodParams.probReqParams.numOfProbeReqs = 3; - pCuCmd->scanPolicy.bandScanPolicy[ 0 ].discoveryMethod.method.basicMethodParams.probReqParams.txPowerDbm = DEF_TX_POWER; - pCuCmd->scanPolicy.bandScanPolicy[ 0 ].immediateScanMethod.scanType = SCAN_TYPE_NORMAL_ACTIVE; - pCuCmd->scanPolicy.bandScanPolicy[ 0 ].immediateScanMethod.method.basicMethodParams.earlyTerminationEvent = SCAN_ET_COND_DISABLE; - pCuCmd->scanPolicy.bandScanPolicy[ 0 ].immediateScanMethod.method.basicMethodParams.ETMaxNumberOfApFrames = 0; - pCuCmd->scanPolicy.bandScanPolicy[ 0 ].immediateScanMethod.method.basicMethodParams.maxChannelDwellTime = 30000; - pCuCmd->scanPolicy.bandScanPolicy[ 0 ].immediateScanMethod.method.basicMethodParams.minChannelDwellTime = 15000; - pCuCmd->scanPolicy.bandScanPolicy[ 0 ].immediateScanMethod.method.basicMethodParams.probReqParams.bitrate = RATE_MASK_UNSPECIFIED; /* Let the FW select */; - pCuCmd->scanPolicy.bandScanPolicy[ 0 ].immediateScanMethod.method.basicMethodParams.probReqParams.numOfProbeReqs = 3; - pCuCmd->scanPolicy.bandScanPolicy[ 0 ].immediateScanMethod.method.basicMethodParams.probReqParams.txPowerDbm = DEF_TX_POWER; -} - -char* PrintSSID(OS_802_11_SSID* ssid) -{ - /* It looks like it never happens. Anyway decided to check */ - if(ssid->SsidLength > MAX_SSID_LEN) - { - - os_error_printf(CU_MSG_ERROR, (PS8)"PrintSSID. ssid->SsidLength=%d exceeds the limit %d\n", - ssid->SsidLength, MAX_SSID_LEN); - /*WLAN_OS_REPORT(("PrintSSID. ssid->SsidLength=%d exceeds the limit %d\n", - ssid->SsidLength, MAX_SSID_LEN));*/ - ssid->SsidLength = MAX_SSID_LEN; - } - os_memcpy((PVOID)ssidBuf, (PVOID) ssid->Ssid, ssid->SsidLength); - ssidBuf[ssid->SsidLength] = '\0'; - return ssidBuf; -} - -static VOID CuCmd_PrintBssidList(OS_802_11_BSSID_LIST_EX* bssidList, S32 IsFullPrint, TMacAddr CurrentBssid) -{ - U32 i; - S8 connectionTypeStr[50]; - POS_802_11_BSSID_EX pBssid = &bssidList->Bssid[0]; - - os_error_printf(CU_MSG_INFO2, (PS8)"BssId List: Num=%u\n", bssidList->NumberOfItems); - os_error_printf(CU_MSG_INFO2, (PS8)" MAC Privacy Rssi Mode Channel SSID\n"); - for(i=0; i<bssidList->NumberOfItems; i++) - { - switch (pBssid->InfrastructureMode) - { - case os802_11IBSS: - os_strcpy (connectionTypeStr, (PS8)"Adhoc"); - break; - case os802_11Infrastructure: - os_strcpy (connectionTypeStr, (PS8)"Infra"); - break; - case os802_11AutoUnknown: - os_strcpy (connectionTypeStr, (PS8)"Auto"); - break; - default: - os_strcpy (connectionTypeStr, (PS8)" --- "); - break; - } - os_error_printf(CU_MSG_INFO2, (PS8)"%s%02x.%02x.%02x.%02x.%02x.%02x %3u %4d %s %6d %s\n", - (!os_memcmp(CurrentBssid, pBssid->MacAddress, MAC_ADDR_LEN))?"*":" ", - pBssid->MacAddress[0], - pBssid->MacAddress[1], - pBssid->MacAddress[2], - pBssid->MacAddress[3], - pBssid->MacAddress[4], - pBssid->MacAddress[5], - pBssid->Privacy, - (char)pBssid->Rssi | 0xffffff00, /* need the 0xffffff00 to get negative value display */ - connectionTypeStr, - CuCmd_Freq2Chan(pBssid->Configuration.Union.channel), - (pBssid->Ssid.Ssid[0] == '\0')?(PS8)"****":((PS8)pBssid->Ssid.Ssid) ); - - if (IsFullPrint) - { - os_error_printf(CU_MSG_INFO2, (PS8)" BeaconInterval %d\n", pBssid->Configuration.BeaconPeriod); - os_error_printf(CU_MSG_INFO2, (PS8)" Capabilities 0x%x\n", pBssid->Capabilities); - } -#ifdef _WINDOWS - pBssid = (POS_802_11_BSSID_EX)((S8*)pBssid + (pBssid->Length ? pBssid->Length : sizeof(OS_802_11_BSSID_EX))); -#else /*for Linux*/ - pBssid = &bssidList->Bssid[i+1]; -#endif - } -} - -static U8 CuCmd_Char2Hex( S8 c ) -{ - if( c >= '0' && c <= '9' ) - return c - '0'; - else if( os_tolower(c) >= 'a' && os_tolower(c) <= 'f' ) - return (U8) (os_tolower(c) - 'a' + 0x0a); - os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - CuCmd_Char2Hex - invalid symbol '%c'\n", c ); - return ((U8)-1); -} - -static PS8 CuCmd_CreateRateStr(PS8 str, U8 rate) -{ - if( rate == 0 ) - return os_strcpy(str,(PS8)"Auto (0)"); - - os_sprintf(str, (PS8)"%.3g Mbps", - RATE_2_MBPS(rate)); - - return str; -} - -static VOID CuCmd_PrintScanMethod(scan_Method_t* scanMethod) -{ - S32 i; - os_error_printf(CU_MSG_INFO2, (PS8)"Scan type: %s\n", scanType2Str[ scanMethod->scanType ].name); - switch (scanMethod->scanType) - { - case SCAN_TYPE_NORMAL_ACTIVE: - case SCAN_TYPE_NORMAL_PASSIVE: - os_error_printf(CU_MSG_INFO2, (PS8)"Max channel dwell time: %d, Min channel dwell time: %d\n", - scanMethod->method.basicMethodParams.maxChannelDwellTime, - scanMethod->method.basicMethodParams.minChannelDwellTime); - - CU_CMD_FIND_NAME_ARRAY(i, EtEvent2Str, scanMethod->method.basicMethodParams.earlyTerminationEvent); - os_error_printf(CU_MSG_INFO2 ,(PS8)"ET condition: %s, ET number of frames: %d\n", - EtEvent2Str[i].name, - scanMethod->method.basicMethodParams.ETMaxNumberOfApFrames); - - CU_CMD_FIND_NAME_ARRAY(i, rate2Str, scanMethod->method.basicMethodParams.probReqParams.bitrate); - os_error_printf(CU_MSG_INFO2 ,(PS8)"Probe request number: %d, probe request rate: %s, TX level: %d\n", - scanMethod->method.basicMethodParams.probReqParams.numOfProbeReqs, - rate2Str[i].name, - scanMethod->method.basicMethodParams.probReqParams.txPowerDbm); - break; - - case SCAN_TYPE_TRIGGERED_ACTIVE: - case SCAN_TYPE_TRIGGERED_PASSIVE: - os_error_printf(CU_MSG_INFO2, (PS8)"Triggering Tid: %d\n", scanMethod->method.TidTriggerdMethodParams.triggeringTid); - os_error_printf(CU_MSG_INFO2, (PS8)"Max channel dwell time: %d, Min channel dwell time: %d\n", - scanMethod->method.basicMethodParams.maxChannelDwellTime, - scanMethod->method.basicMethodParams.minChannelDwellTime); - - CU_CMD_FIND_NAME_ARRAY(i, EtEvent2Str, scanMethod->method.basicMethodParams.earlyTerminationEvent); - os_error_printf(CU_MSG_INFO2, (PS8)"ET condition: %s, ET number of frames: %d\n", - EtEvent2Str[i].name, - scanMethod->method.basicMethodParams.ETMaxNumberOfApFrames); - - CU_CMD_FIND_NAME_ARRAY(i, rate2Str, scanMethod->method.basicMethodParams.probReqParams.bitrate); - os_error_printf(CU_MSG_INFO2, (PS8)"Probe request number: %d, probe request rate: %s, TX level: %d\n", - scanMethod->method.basicMethodParams.probReqParams.numOfProbeReqs, - rate2Str[i].name, - scanMethod->method.basicMethodParams.probReqParams.txPowerDbm); - break; - - case SCAN_TYPE_SPS: - CU_CMD_FIND_NAME_ARRAY(i, EtEvent2Str, scanMethod->method.spsMethodParams.earlyTerminationEvent); - os_error_printf(CU_MSG_INFO2, (PS8)"ET condition: %s, ET number of frames: %d\n", - EtEvent2Str[i].name, - scanMethod->method.spsMethodParams.ETMaxNumberOfApFrames); - os_error_printf(CU_MSG_INFO2, (PS8)"Scan duration: %d\n", scanMethod->method.spsMethodParams.scanDuration); - break; - - case SCAN_TYPE_NO_SCAN: - case SCAN_TYPE_PACTSIVE: - break; - } -} - -static VOID CuCmd_PrintScanBand(scan_bandPolicy_t* pBandPolicy) -{ - S32 j; - - os_error_printf(CU_MSG_INFO2, (PS8)"\nBand: %s\n", band2Str[ pBandPolicy->band ].name); - os_error_printf(CU_MSG_INFO2, (PS8)"RSSI Threshold: %d dBm\n", pBandPolicy->rxRSSIThreshold); - os_error_printf(CU_MSG_INFO2, (PS8)"Number of channels for each discovery interval: %d\n", pBandPolicy->numOfChannlesForDiscovery); - os_error_printf(CU_MSG_INFO2, (PS8)"\nTracking Method:\n"); - CuCmd_PrintScanMethod( &(pBandPolicy->trackingMethod) ); - os_error_printf(CU_MSG_INFO2, (PS8)"\nDiscovery Method:\n"); - CuCmd_PrintScanMethod( &(pBandPolicy->discoveryMethod) ); - os_error_printf(CU_MSG_INFO2, (PS8)"\nImmediate Scan Method:\n"); - CuCmd_PrintScanMethod( &(pBandPolicy->immediateScanMethod) ); - if ( pBandPolicy->numOfChannles > 0 ) - { - os_error_printf(CU_MSG_INFO2, (PS8)"\nChannel list: "); - for ( j = 0; j < pBandPolicy->numOfChannles; j++ ) - { - os_error_printf(CU_MSG_INFO2, (PS8)"%3d ", pBandPolicy->channelList[ j ]); - } - os_error_printf(CU_MSG_INFO2, (PS8)"\n"); - } - else - { - os_error_printf(CU_MSG_INFO2, (PS8)"\nNo channels defined.\n"); - } -} - -static U32 CuCmd_IsValueRate(U32 rate) -{ - - switch (rate) - { - case 1: - case 2: - case 5: - case 6: - case 9: - case 11: - case 12: - case 18: - case 24: - case 36: - case 48: - case 54: - return (TRUE); - - default: - return (FALSE); - } -} - -static VOID CuCmd_ParseMaskString(PS8 pString, PU8 pBuffer, PU8 pLength) -{ - S8 ch; - S32 iter = 0; - U8 val; - - while ((ch = pString[iter])) - { - val = (ch == '1' ? 1 : 0); - - if (iter % BIT_TO_BYTE_FACTOR) - pBuffer[iter / BIT_TO_BYTE_FACTOR] |= (val << (iter % BIT_TO_BYTE_FACTOR)); - else - pBuffer[iter / BIT_TO_BYTE_FACTOR] = val; - - ++iter; - } - - /* iter = 0 len = 0, iter = 1 len = 1, iter = 8 len = 1, and so on... */ - *pLength = (U8) (iter + BIT_TO_BYTE_FACTOR - 1) / BIT_TO_BYTE_FACTOR; -} - -static VOID CuCmd_ParsePatternString(PS8 pString, PU8 pBuffer, PU8 pLength) -{ - S8 ch; - S32 iter = 0; - U8 val; - - while ((ch = pString[iter])) - { - val = ((ch >= '0' && ch <= '9') ? (ch - '0') : - (ch >= 'A' && ch <= 'F') ? (0xA + ch - 'A') : - (ch >= 'a' && ch <= 'f') ? (0xA + ch - 'a') : 0); - - /* even indexes go to the lower nibble, odd indexes push them to the */ - /* higher nibble and then go themselves to the lower nibble. */ - if (iter % 2) - pBuffer[iter / 2] = ((pBuffer[iter / 2] << (BIT_TO_BYTE_FACTOR / 2)) | val); - else - pBuffer[iter / 2] = val; - - ++iter; - } - - /* iter = 0 len = 0, iter = 1 len = 1, iter = 2 len = 1, and so on... */ - *pLength = (U8) (iter + 1) / 2; -} - -/* functions */ -/*************/ -THandle CuCmd_Create(const PS8 device_name, THandle hConsole, S32 BypassSupplicant, PS8 pSupplIfFile) -{ - THandle hIpcSta; - - CuCmd_t* pCuCmd = (CuCmd_t*)os_MemoryCAlloc(sizeof(CuCmd_t), sizeof(U8)); - if(pCuCmd == NULL) - { - os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - CuCmd_Create - cant allocate control block\n"); - return NULL; - } - - pCuCmd->isDeviceRunning = FALSE; - pCuCmd->hConsole = hConsole; - - pCuCmd->hCuCommon= CuCommon_Create(&hIpcSta, device_name); - if(pCuCmd->hCuCommon == NULL) - { - CuCmd_Destroy(pCuCmd); - return NULL; - } - - pCuCmd->hCuWext= CuOs_Create(hIpcSta); - if(pCuCmd->hCuWext == NULL) - { - CuCmd_Destroy(pCuCmd); - return NULL; - } - - pCuCmd->hIpcEvent = (THandle) IpcEvent_Create(); - if(pCuCmd->hIpcEvent == NULL) - { - CuCmd_Destroy(pCuCmd); - return NULL; - } - - if(BypassSupplicant) - { - /* specify that there is no supplicant */ - pCuCmd->hWpaCore = NULL; - } - else - { -#ifndef NO_WPA_SUPPL - S32 res; - - pCuCmd->hWpaCore = WpaCore_Create(&res, pSupplIfFile); - if((pCuCmd->hWpaCore == NULL) && (res != EOALERR_IPC_WPA_ERROR_CANT_CONNECT_TO_SUPPL)) - { - CuCmd_Destroy(pCuCmd); - return NULL; - } - - if(res == EOALERR_IPC_WPA_ERROR_CANT_CONNECT_TO_SUPPL) - { - os_error_printf(CU_MSG_ERROR, (PS8)"******************************************************\n"); - os_error_printf(CU_MSG_ERROR, (PS8)"Connection to supplicant failed\n"); - os_error_printf(CU_MSG_ERROR, (PS8)"******************************************************\n"); - } - else - { - os_error_printf(CU_MSG_INFO2, (PS8)"Connection established with supplicant\n"); - } -#endif - } - - CuCmd_Init_Scan_Params(pCuCmd); - - return pCuCmd; -} - -VOID CuCmd_Destroy(THandle hCuCmd) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - - if(pCuCmd->hCuCommon) - { - CuCommon_Destroy(pCuCmd->hCuCommon); - } - - if(pCuCmd->hCuWext) - { - CuOs_Destroy(pCuCmd->hCuWext); - } - - if(pCuCmd->hIpcEvent) - { - IpcEvent_Destroy(pCuCmd->hIpcEvent); - } - -#ifndef NO_WPA_SUPPL - if(pCuCmd->hWpaCore) - { - WpaCore_Destroy(pCuCmd->hWpaCore); - } -#endif - - os_MemoryFree(pCuCmd); -} - -S32 CuCmd_GetDeviceStatus(THandle hCuCmd) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - S32 status; - - status = CuCommon_GetU32(pCuCmd->hCuCommon, DRIVER_STATUS_PARAM, &pCuCmd->isDeviceRunning); - - if ((status == OK) && pCuCmd->isDeviceRunning) - return OK; - - return ECUERR_CU_CMD_ERROR_DEVICE_NOT_LOADED; -} - -VOID CuCmd_StartDriver(THandle hCuCmd) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - U32 uDummyBuf; - - if(OK != CuCommon_SetBuffer(pCuCmd->hCuCommon, DRIVER_START_PARAM, &uDummyBuf, sizeof(uDummyBuf))) - { - os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - Failed to start driver!\n"); - } -} - -VOID CuCmd_StopDriver(THandle hCuCmd) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - U32 uDummyBuf; - - if(OK != CuCommon_SetBuffer(pCuCmd->hCuCommon, DRIVER_STOP_PARAM, &uDummyBuf, sizeof(uDummyBuf))) - { - os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - Failed to stop driver!\n"); - } -} - -#ifdef XCC_MODULE_INCLUDED -THandle CuCmd_GetCuCommonHandle(THandle hCuCmd) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - - return pCuCmd->hCuCommon; -} - -THandle CuCmd_GetCuWpaHandle (THandle hCuCmd) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - - return pCuCmd->hWpaCore; - -} -#endif - -VOID CuCmd_Show_Status(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - - TMacAddr Mac; - OS_802_11_SSID ssid; - TMacAddr bssid; - U32 channel, threadid=0; - U32 status ; - - if(OK != CuCmd_GetDeviceStatus(hCuCmd)) - { - os_error_printf(CU_MSG_INFO2, (PS8)"Driver is stopped!\n"); - return; - } - - CuOs_GetDriverThreadId(pCuCmd->hCuWext, &threadid); - if(OK != CuCommon_GetBuffer(pCuCmd->hCuCommon, CTRL_DATA_MAC_ADDRESS, Mac, sizeof(TMacAddr))) return; - if(OK != CuOs_Get_SSID(pCuCmd->hCuWext, &ssid)) return; - if(OK != CuOs_Get_BSSID(pCuCmd->hCuWext, bssid)) return; - if(OK != CuOs_GetCurrentChannel(pCuCmd->hCuWext, &channel)) return; - if(OK != CuCommon_GetU32(pCuCmd->hCuCommon, SME_CONNECTION_STATUS_PARAM, &status)) - os_error_printf(CU_MSG_INFO2, (PS8)"can't read connection status!\n"); - - if (threadid != 0) - { - os_error_printf(CU_MSG_INFO2, (PS8)"Thread id: %u (0x%x)\n\n", threadid, threadid); - } - os_error_printf(CU_MSG_INFO2, (PS8)"==========================\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Status : %s\n",ConnState[status]); - os_error_printf(CU_MSG_INFO2, (PS8)"MAC : %02x.%02x.%02x.%02x.%02x.%02x\n",Mac[0],Mac[1],Mac[2],Mac[3],Mac[4],Mac[5]); - os_error_printf(CU_MSG_INFO2, (PS8)"SSID : %s\n",(ssid.SsidLength)?PrintSSID(&ssid):"<empty>"); - os_error_printf(CU_MSG_INFO2, (PS8)"BSSID : %02x.%02x.%02x.%02x.%02x.%02x\n",bssid[0],bssid[1],bssid[2],bssid[3],bssid[4],bssid[5]); - if(channel) - os_error_printf(CU_MSG_INFO2, (PS8)"Channel : %d\n",channel); - else - os_error_printf(CU_MSG_INFO2, (PS8)"Channel : <empty>\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"==========================\n"); - -} - -VOID CuCmd_BssidList(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - U32 SizeOfBssiList=0; - OS_802_11_BSSID_LIST_EX* bssidList; - TMacAddr bssid; - - if(OK != CuCommon_Get_BssidList_Size(pCuCmd->hCuCommon, &SizeOfBssiList)) - { - os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - CuCmd_Bssid_List - cant get Bssid list size\n"); - return; - } - - /* allocate the bssidList */ - bssidList = os_MemoryCAlloc(SizeOfBssiList, sizeof(U8)); - if(bssidList == NULL) - { - os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - CuCmd_Bssid_List - cant allocate Bssid list\n"); - return; - } - - if(SizeOfBssiList == sizeof(U32)) - { - /* means that bssidList is empty*/ - bssidList->NumberOfItems = 0; - /* os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - CuCmd_Bssid_List - size of list is %d, indicating empty list\n", - sizeof(U32)); */ - } - else - { - if (OK != CuOs_GetBssidList(pCuCmd->hCuWext, bssidList)) - { - os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - CuCmd_Bssid_List - cant get Bssid list\n"); - os_MemoryFree(bssidList); - return; - } - } - - /* get currently connected bssid */ - if(OK != CuOs_Get_BSSID(pCuCmd->hCuWext, bssid)) - { - os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - CuCmd_Bssid_List - cant get current BSSID\n"); - os_MemoryFree(bssidList); - return; - } - - /* print the list to the terminal */ - CuCmd_PrintBssidList(bssidList, FALSE, bssid); - - /* free the bssidList */ - os_MemoryFree(bssidList); - -} - -VOID CuCmd_FullBssidList(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - U32 SizeOfBssiList=0; - OS_802_11_BSSID_LIST_EX* bssidList; - TMacAddr bssid; - - if(OK != CuCommon_Get_BssidList_Size(pCuCmd->hCuCommon, &SizeOfBssiList)) return; - - /* allocate the bssidList */ - bssidList = os_MemoryCAlloc(SizeOfBssiList, sizeof(U8)); - if(bssidList == NULL) - { - os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - CuCmd_Bssid_List - cant allocate Bssid list\n"); - return; - } - - if(SizeOfBssiList == sizeof(U32)) - { - /* means that bssidList is empty*/ - bssidList->NumberOfItems = 0; - - } - else - { - if(OK != CuOs_GetBssidList(pCuCmd->hCuWext, bssidList) ) return; - } - - /* get currently connected bssid */ - if(OK != CuOs_Get_BSSID(pCuCmd->hCuWext, bssid)) return; - - /* print the list to the terminal */ - CuCmd_PrintBssidList(bssidList, TRUE, bssid); - - /* free the bssidList */ - os_MemoryFree(bssidList); -} - -#if defined(CONFIG_WPS) && !defined(NO_WPA_SUPPL) -VOID CuCmd_StartEnrolleePIN(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - - if (pCuCmd->hWpaCore == NULL) - { - os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - Cannot start Enrollee without connection to supplicant\n"); - return; - } - - WpaCore_StartWpsPIN(pCuCmd->hWpaCore); - os_error_printf(CU_MSG_INFO2, (PS8)"WPS in PIN mode started\n"); -} - -VOID CuCmd_StartEnrolleePBC(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - - if (pCuCmd->hWpaCore == NULL) - { - os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - Cannot start Enrollee push button without connection to supplicant\n"); - return; - } - - WpaCore_StartWpsPBC(pCuCmd->hWpaCore); - os_error_printf(CU_MSG_INFO2, (PS8)"WPS in PBC mode started\n"); -} - -VOID CuCmd_StopEnrollee(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - if (pCuCmd->hWpaCore == NULL) - { - os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - Cannot Stop Enrollee without connection to supplicant\n"); - return; - } - - WpaCore_StopWps(pCuCmd->hWpaCore); - os_error_printf(CU_MSG_INFO2, (PS8)"WPS mode stopped\n"); -} - -VOID CuCmd_SetPin(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - - if (pCuCmd->hWpaCore == NULL) - { - os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - Cannot set PIN without connection to supplicant\n"); - return; - } - - WpaCore_SetPin(pCuCmd->hWpaCore, (PS8)parm[0].value); - os_error_printf(CU_MSG_INFO2, (PS8)"WPS PIN set %s\n", parm[0].value); -} - -#endif /* CONFIG_WPS */ - -VOID CuCmd_Connect(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - TMacAddr bssid = { 0xff,0xff,0xff,0xff,0xff,0xff }; - OS_802_11_SSID ssid; - U32 BssType; - - switch (nParms) - { - case 0 : - /* - * No SSID & No BSSID are set - - * Use Any SSID & Any BSSID. - */ - ssid.SsidLength = 0; - ssid.Ssid[0] = 0; - break; - case 1: - /* - * SSID set & BSSID insn't set - - * Use CLI's SSID & Any BSSID. - */ - ssid.SsidLength = os_strlen( (PS8)parm[0].value); - os_memcpy((PVOID)ssid.Ssid, (PVOID) parm[0].value, ssid.SsidLength); - ssid.Ssid[ssid.SsidLength] = '\0'; - break; - case 2: - /* - * Both SSID & BSSID are set - - * Use CLI's SSID & BSSID. - */ - if(!CuCmd_Str2MACAddr( (PS8)parm[1].value, bssid) ) - return; - ssid.SsidLength = os_strlen((PS8) parm[0].value); - os_memcpy((PVOID)ssid.Ssid, (PVOID) parm[0].value, ssid.SsidLength); - ssid.Ssid[ssid.SsidLength] = '\0'; - break; - } - - if(pCuCmd->hWpaCore == NULL) - { - if(OK != CuCommon_GetU32(pCuCmd->hCuCommon, CTRL_DATA_CURRENT_BSS_TYPE_PARAM, &BssType)) return; - - if((BssType == os802_11IBSS/* Ad-Hoc */) && (ssid.SsidLength == 0)) - { - os_error_printf(CU_MSG_INFO2, (PS8)"SSID string is needed due to fact that BSS Type set to Ad-Hoc.\n"); - return; - } - - if(OK != CuOs_Set_BSSID(pCuCmd->hCuWext, bssid ) ) return; - if(OK != CuOs_Set_ESSID(pCuCmd->hCuWext, &ssid) ) return; - } - else - { -#ifndef NO_WPA_SUPPL - if(OK != WpaCore_GetBssType(pCuCmd->hWpaCore, &BssType)) return; - - if((BssType == os802_11IBSS/* Ad-Hoc */) && (ssid.SsidLength == 0)) - { - os_error_printf(CU_MSG_INFO2, (PS8)"SSID string is needed due to fact BSS Type set to Ad-Hoc\n"); - return; - } - - WpaCore_SetSsid(pCuCmd->hWpaCore, &ssid, bssid); -#endif - } -} - -VOID CuCmd_Disassociate(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - - if(pCuCmd->hWpaCore == NULL) - { - OS_802_11_SSID ssid; - - ssid.SsidLength = MAX_SSID_LEN; - os_memset(ssid.Ssid, 0, MAX_SSID_LEN); - - CuOs_Set_ESSID(pCuCmd->hCuWext, &ssid); - } - else - { -#ifndef NO_WPA_SUPPL - WpaCore_Disassociate(pCuCmd->hWpaCore); -#endif - } -} - -VOID CuCmd_ModifySsid(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - OS_802_11_SSID ssid; - TMacAddr bssid = { 0xff,0xff,0xff,0xff,0xff,0xff }; - - if( nParms == 0 ) - { - OS_802_11_SSID ssid; - if(OK != CuOs_Get_SSID(pCuCmd->hCuWext, &ssid)) return; - os_error_printf(CU_MSG_INFO2, (PS8)"SSID: %s\n",(ssid.SsidLength)?(PS8)PrintSSID(&ssid):(PS8)"<empty>"); - } - else - { - /* Setting the new SSID, BRCS BSSID is set to clean pre-set BSSID */ - ssid.SsidLength = os_strlen((PS8) parm[0].value); - os_memcpy((PVOID)ssid.Ssid, (PVOID) parm[0].value, ssid.SsidLength); - if(ssid.SsidLength < MAX_SSID_LEN) - { - ssid.Ssid[ssid.SsidLength] = 0; - } - - if(OK != CuOs_Set_BSSID(pCuCmd->hCuWext, bssid ) ) return; - if(OK != CuOs_Set_ESSID(pCuCmd->hCuWext, &ssid) ) return; - } -} - -VOID CuCmd_ModifyConnectMode(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - U32 i; - - if( nParms == 0 ) - { - U32 uConnectMode; - - if(OK != CuCommon_GetU32 (pCuCmd->hCuCommon, SME_CONNECTION_MODE_PARAM, &uConnectMode)) return; - CU_CMD_FIND_NAME_ARRAY (i, Current_mode, uConnectMode); - os_error_printf (CU_MSG_INFO2, (PS8)"Current mode = %s\n", Current_mode[i].name); - print_available_values (Current_mode); - } - else - { - U32 uConnectMode = parm[0].value; - - /* check if the param is valid */ - CU_CMD_FIND_NAME_ARRAY (i, Current_mode, uConnectMode); - if(i == SIZE_ARR(Current_mode)) - { - os_error_printf(CU_MSG_INFO2, (PS8)"CuCmd_ModifyConnectMode, Connect Mode %d is not defined!\n", uConnectMode); - print_available_values (Current_mode); - return; - } - else - { - CuCommon_SetU32(pCuCmd->hCuCommon, SME_CONNECTION_MODE_PARAM, uConnectMode); - } - } -} - -VOID CuCmd_ModifyChannel(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - - if( nParms == 0 ) - { - U8 desiredChannel = 0; - U32 currentChannel = 0; - - - if(OK != CuCommon_GetU8(pCuCmd->hCuCommon, SITE_MGR_DESIRED_CHANNEL_PARAM, &desiredChannel)) return; - if(OK != CuOs_GetCurrentChannel(pCuCmd->hCuWext, ¤tChannel)) return; - - os_error_printf(CU_MSG_INFO2, (PS8)"Channel=%d (desired: %d)\n",currentChannel,desiredChannel); - } - else - { - CuCommon_SetU32(pCuCmd->hCuCommon, SITE_MGR_DESIRED_CHANNEL_PARAM, parm[0].value); - } -} - -VOID CuCmd_GetTxRate(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - - if( nParms == 0) - { - U8 CurrentTxRate; - S8 CurrentTxRateStr[50]; - - if(OK != CuCommon_GetU8(pCuCmd->hCuCommon, TIWLN_802_11_CURRENT_RATES_GET, &CurrentTxRate)) return; - - CuCmd_CreateRateStr(CurrentTxRateStr, CurrentTxRate); - os_error_printf(CU_MSG_INFO2, (PS8)"Rate: %s\n", CurrentTxRateStr); - } -} - -VOID CuCmd_ModifyBssType(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - U32 BssType = 0; - S32 i; - - if( nParms == 0 ) - { - if(pCuCmd->hWpaCore == NULL) - { - if(OK != CuCommon_GetU32(pCuCmd->hCuCommon, CTRL_DATA_CURRENT_BSS_TYPE_PARAM, &BssType)) return; - } - else - { -#ifndef NO_WPA_SUPPL - if(OK != WpaCore_GetBssType(pCuCmd->hWpaCore, &BssType)) return; -#endif - } - - CU_CMD_FIND_NAME_ARRAY(i, BSS_type, BssType); - if(i == SIZE_ARR(BSS_type)) - { - os_error_printf(CU_MSG_INFO2, (PS8)"Error getting the current BssType! BssType=0x%x\n",BssType); - return; - } - else - { - os_error_printf(CU_MSG_INFO2, (PS8)"Current mode = %s\n", BSS_type[i].name); - } - print_available_values(BSS_type); - } - else - { - BssType = parm[0].value; - /* check if the param is valid */ - CU_CMD_FIND_NAME_ARRAY(i, BSS_type, BssType); - if(i == SIZE_ARR(BSS_type)) - { - os_error_printf(CU_MSG_INFO2, (PS8)"CuCmd_ModifyBssType, BssType %d is not defined!\n", BssType); - return; - } - if(pCuCmd->hWpaCore == NULL) - { - CuCommon_SetU32(pCuCmd->hCuCommon, CTRL_DATA_CURRENT_BSS_TYPE_PARAM, BssType); - CuCommon_SetU32(pCuCmd->hCuCommon, SME_DESIRED_BSS_TYPE_PARAM, BssType); - } - else - { -#ifndef NO_WPA_SUPPL - WpaCore_SetBssType(pCuCmd->hWpaCore, BssType); -#endif - } - } -} - -VOID CuCmd_ModifyFragTh(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - S32 FragTh; - - if( nParms == 0 ) - { - if(OK != CuOs_GetFragTh(pCuCmd->hCuWext, &FragTh)) return; - os_error_printf(CU_MSG_INFO2, (PS8)"Frag. threshold = %d\n", FragTh); - } - else - { - FragTh = parm[0].value; - CuOs_SetFragTh(pCuCmd->hCuWext, FragTh); - } -} - -VOID CuCmd_ModifyRtsTh(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - S32 RtsTh; - - if( nParms == 0 ) - { - if(OK != CuOs_GetRtsTh(pCuCmd->hCuWext, &RtsTh)) return; - os_error_printf(CU_MSG_INFO2, (PS8)"RTS threshold = %d\n", RtsTh); - } - else - { - RtsTh = parm[0].value; - CuOs_SetRtsTh(pCuCmd->hCuWext, RtsTh); - } -} - -VOID CuCmd_ModifyPreamble(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - EPreamble Preamble; - S32 i; - named_value_t preamble_type[] = { - { PREAMBLE_LONG, (PS8)"PREAMBLE_LONG" }, - { PREAMBLE_SHORT, (PS8)"PREAMBLE_SHORT" } - }; - - if(nParms) - { - Preamble = parm[0].value; - /* check if the param is valid */ - CU_CMD_FIND_NAME_ARRAY(i, preamble_type, Preamble); - if(i == SIZE_ARR(preamble_type)) - { - os_error_printf(CU_MSG_INFO2, (PS8)"CuCmd_ModifyPreamble, Preamble %d is not defined!\n", Preamble); - return; - } - CuCommon_SetU32(pCuCmd->hCuCommon, TIWLN_802_11_SHORT_PREAMBLE_SET, Preamble); - } - else - { - S32 PreambleData; - if(OK != CuCommon_GetU32(pCuCmd->hCuCommon, TIWLN_802_11_SHORT_PREAMBLE_GET, (PU32)&PreambleData)) return; - Preamble = PreambleData; - os_error_printf(CU_MSG_INFO2, (PS8)"Preamble = %d\n", Preamble); - print_available_values(preamble_type); - } -} - -VOID CuCmd_ModifyShortSlot(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - slotTime_e SlotTime; - S32 i; - named_value_t SlotTime_type[] = { - { PHY_SLOT_TIME_LONG, (PS8)"PHY_SLOT_TIME_LONG" }, - { PHY_SLOT_TIME_SHORT, (PS8)"PHY_SLOT_TIME_SHORT" } - }; - - if(nParms) - { - SlotTime = parm[0].value; - /* check if the param is valid */ - CU_CMD_FIND_NAME_ARRAY(i, SlotTime_type, SlotTime); - if(i == SIZE_ARR(SlotTime_type)) - { - os_error_printf(CU_MSG_INFO2, (PS8)"CuCmd_ModifyShortSlot, SlotTime %d is not defined!\n", SlotTime); - return; - } - CuCommon_SetU32(pCuCmd->hCuCommon, TIWLN_SHORT_SLOT_SET, SlotTime); - } - else - { - S32 SlotTimeData; - if(OK != CuCommon_GetU32(pCuCmd->hCuCommon, TIWLN_SHORT_SLOT_GET, (PU32)&SlotTimeData)) return; - SlotTime = SlotTimeData; - os_error_printf(CU_MSG_INFO2, (PS8)"SlotTime = %d\n", SlotTime); - print_available_values(SlotTime_type); - } -} - - -VOID CuCmd_RadioOnOff(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - U32 on_off; - - if(nParms) - { - on_off = parm[0].value; - CuCommon_SetU32(pCuCmd->hCuCommon, SME_RADIO_ON_PARAM, on_off); - } - else - { - if(OK != CuCommon_GetU32(pCuCmd->hCuCommon, SME_RADIO_ON_PARAM, &on_off)) { - os_error_printf(CU_MSG_ERROR, (PS8)"CuCmd_RadioOnOff error, Cannot get radio state!\n"); - return; - } - os_error_printf(CU_MSG_ERROR, (PS8)"Radio state = %s\n", on_off ? "ON" : "OFF"); - os_error_printf(CU_MSG_ERROR, (PS8)"Turn radio on/off. 0=OFF, 1=ON\n"); - } -} - - -VOID CuCmd_GetSelectedBssidInfo(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - OS_802_11_SSID ssid; - TMacAddr bssid; - - if(OK != CuOs_Get_SSID(pCuCmd->hCuWext, &ssid)) return; - if(OK != CuOs_Get_BSSID(pCuCmd->hCuWext, bssid)) return; - - os_error_printf(CU_MSG_INFO2, (PS8)"Selected BSSID Info:\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"--------------------\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"SSID : %s\n",(ssid.SsidLength)?(PS8)PrintSSID(&ssid):(PS8)"<empty>"); - os_error_printf(CU_MSG_INFO2, (PS8)"BSSID : %02x.%02x.%02x.%02x.%02x.%02x\n",bssid[0],bssid[1],bssid[2],bssid[3],bssid[4],bssid[5]); -} - -VOID CuCmd_GetRsiiLevel(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - S8 dRssi, bRssi; - - if(OK != CuCommon_GetRssi(pCuCmd->hCuCommon, &dRssi, &bRssi)) return; - /* need the 0xffffff00 to get negative value display */ - os_error_printf(CU_MSG_INFO2, (PS8)"Current dataRSSI=%d beaconRssi=%d\n", dRssi?dRssi|0xffffff00:dRssi, bRssi?bRssi|0xffffff00:bRssi); -} - -VOID CuCmd_GetSnrRatio(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - U32 dSnr, bSnr; - - if(OK != CuCommon_GetSnr(pCuCmd->hCuCommon, &dSnr, &bSnr)) return; - os_error_printf(CU_MSG_INFO2, (PS8)"Current dataSNR=%d beaconSnr=%d\n", dSnr, bSnr); -} - -VOID CuCmd_ShowTxPowerLevel(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - - S32 txPowerLevel; - if(OK != CuOs_GetTxPowerLevel(pCuCmd->hCuWext, &txPowerLevel)) return; - - os_error_printf(CU_MSG_INFO2, (PS8)"Tx Power level = %d\n", txPowerLevel); -} - -VOID CuCmd_ShowTxPowerTable(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - TpowerLevelTable_t txPowerLevel; - S32 i, res; - - res = CuCommon_GetBuffer(pCuCmd->hCuCommon, REGULATORY_DOMAIN_TX_POWER_LEVEL_TABLE_PARAM, &txPowerLevel, sizeof(txPowerLevel)); - - if( !res ) - { - os_error_printf(CU_MSG_INFO2, (PS8)"Power level table (Dbm/10)\n"); - for (i = 0; i < NUMBER_OF_SUB_BANDS_E; i++) - { - os_error_printf(CU_MSG_INFO2, (PS8)"sub-band %i: %d %d %d %d\n", i, - txPowerLevel.uDbm[i][0], - txPowerLevel.uDbm[i][1], - txPowerLevel.uDbm[i][2], - txPowerLevel.uDbm[i][3]); - } - } - else - { - os_error_printf(CU_MSG_INFO2, (PS8)"Tx Power level table ERROR !!!\n"); - } -} - -VOID CuCmd_TxPowerDbm(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - U8 txPowerLevelDbm = (U8)parm[0].value; - - if(nParms == 0) - { - if(OK != CuCommon_GetU8(pCuCmd->hCuCommon, TIWLN_802_11_TX_POWER_DBM_GET, (PU8)&txPowerLevelDbm)) return; - } - else - { - if (parm[0].value > MAX_TX_POWER) - { - os_error_printf(CU_MSG_INFO2, (PS8)"Please use values between %d and %d\n", MIN_TX_POWER, MAX_TX_POWER); return; - } - else - { - if(OK != CuCommon_SetU8(pCuCmd->hCuCommon, TIWLN_802_11_TX_POWER_DBM_GET, (U8)txPowerLevelDbm)) return; - } - } - - os_error_printf(CU_MSG_INFO2, (PS8)"Tx Power in DBM = %d\n", txPowerLevelDbm); -} - -VOID CuCmd_ModifyState_802_11d(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - U32 Enabled_802_11d; - - if(nParms == 0) - { - if(OK != CuCommon_GetU32(pCuCmd->hCuCommon, TIWLN_REG_DOMAIN_GET_802_11D, &Enabled_802_11d)) return; - os_error_printf(CU_MSG_INFO2, (PS8)"802_11d enabled = %s\n", (Enabled_802_11d)?"TRUE":"FALSE"); - } - else - { - Enabled_802_11d = parm[0].value; - if(OK != CuCommon_SetU32(pCuCmd->hCuCommon, TIWLN_REG_DOMAIN_ENABLE_DISABLE_802_11D, Enabled_802_11d)) - { - U32 Enabled_802_11h; - if(OK != CuCommon_GetU32(pCuCmd->hCuCommon, TIWLN_REG_DOMAIN_GET_802_11H, &Enabled_802_11h)) return; - if(Enabled_802_11h && (!Enabled_802_11d)) - os_error_printf(CU_MSG_INFO2, (PS8)"802_11d cannot be disabled while 802_11h is enabled!!\n" ); - - } - else - { - os_error_printf(CU_MSG_INFO2, (PS8)"802_11d status is updated to = %s\n", (Enabled_802_11d)?"TRUE":"FALSE" ); - } - } -} - -VOID CuCmd_ModifyState_802_11h(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - U32 Enabled_802_11h; - - if(nParms == 0) - { - if(OK != CuCommon_GetU32(pCuCmd->hCuCommon, TIWLN_REG_DOMAIN_GET_802_11H, &Enabled_802_11h)) return; - os_error_printf(CU_MSG_INFO2, (PS8)"802_11h enabled = %s\n", (Enabled_802_11h)?"TRUE":"FALSE"); - } - else - { - Enabled_802_11h = parm[0].value; - if(OK != CuCommon_SetU32(pCuCmd->hCuCommon, TIWLN_REG_DOMAIN_ENABLE_DISABLE_802_11H, Enabled_802_11h)) return; - if(Enabled_802_11h) - os_error_printf(CU_MSG_INFO2, (PS8)"802_11h enables automatically 802_11d!!\n" ); - - os_error_printf(CU_MSG_INFO2, (PS8)"802_11h status is updated to =%d\n", Enabled_802_11h ); - } -} - -VOID CuCmd_D_Country_2_4Ie(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - - if( nParms == 0 ) - { - U8 CountryString[DOT11_COUNTRY_STRING_LEN+1]; - if(OK != CuCommon_GetSetBuffer(pCuCmd->hCuCommon, TIWLN_REG_DOMAIN_GET_COUNTRY_2_4, - CountryString, DOT11_COUNTRY_STRING_LEN+1)) return; - CountryString[DOT11_COUNTRY_STRING_LEN] = '\0'; - if (CountryString[0] == '\0') - { - os_error_printf(CU_MSG_INFO2, (PS8)"802_11d Country for 2.4 GHz is not found\n"); - } - else - { - os_error_printf(CU_MSG_INFO2, (PS8)"802_11d Country for 2.4 GHz is %s \n", CountryString ); - } - } - else - { - country_t CountryWorld; - - CountryWorld.elementId = COUNTRY_IE_ID; - CountryWorld.len = 6; - os_memcpy( (PVOID)CountryWorld.countryIE.CountryString,(PVOID)"GB ", 3); - CountryWorld.countryIE.tripletChannels[0].firstChannelNumber = 1; - CountryWorld.countryIE.tripletChannels[0].maxTxPowerLevel = 23; - CountryWorld.countryIE.tripletChannels[0].numberOfChannels = 11; - - if(OK != CuCommon_SetBuffer(pCuCmd->hCuCommon, TIWLN_REG_DOMAIN_SET_COUNTRY_2_4, - &CountryWorld, sizeof(country_t))) return; - - os_error_printf(CU_MSG_INFO2, (PS8)"802_11d Start Setting GB Country for 2.4 GHz\n"); - } -} - - -VOID CuCmd_D_Country_5Ie(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - - if( nParms == 0 ) - { - U8 CountryString[DOT11_COUNTRY_STRING_LEN+1]; - - if(OK != CuCommon_GetSetBuffer(pCuCmd->hCuCommon, TIWLN_REG_DOMAIN_GET_COUNTRY_5, - CountryString, DOT11_COUNTRY_STRING_LEN+1)) return; - - CountryString[DOT11_COUNTRY_STRING_LEN] = '\0'; - if (CountryString[0] == '\0') - { - os_error_printf(CU_MSG_INFO2, (PS8)"802_11d Country for 5 GHz is not found\n"); - } - else - { - os_error_printf(CU_MSG_INFO2, (PS8)"802_11d Country for 5 GHz is %s\n", CountryString ); - } - } - else - { - country_t CountryWorld; - - CountryWorld.elementId = COUNTRY_IE_ID; - CountryWorld.len = 6; - os_memcpy((PVOID) CountryWorld.countryIE.CountryString,(PVOID)"US ", 3); - CountryWorld.countryIE.tripletChannels[0].firstChannelNumber = 36; - CountryWorld.countryIE.tripletChannels[0].maxTxPowerLevel = 13; - CountryWorld.countryIE.tripletChannels[0].numberOfChannels = 8; - - if(OK != CuCommon_SetBuffer(pCuCmd->hCuCommon, TIWLN_REG_DOMAIN_SET_COUNTRY_5, - &CountryWorld, sizeof(country_t))) return; - - os_error_printf(CU_MSG_INFO2, (PS8)"802_11d Start Setting US Country for 5 GHz\n"); - } -} - -VOID CuCmd_ModifyDfsRange(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - U16 minDFS_channelNum; - U16 maxDFS_channelNum; - - if( nParms == 0 ) - { - if(OK != CuCommon_GetDfsChannels(pCuCmd->hCuCommon, &minDFS_channelNum, &maxDFS_channelNum)) return; - - os_error_printf(CU_MSG_INFO2, (PS8)"DFS min channel is %d, DFS max channel is %d\n", - minDFS_channelNum, maxDFS_channelNum); - } - else - { - minDFS_channelNum = (U16) parm[0].value; - maxDFS_channelNum = (U16) parm[1].value; - - if(OK != CuCommon_SetDfsChannels(pCuCmd->hCuCommon, minDFS_channelNum, maxDFS_channelNum)) return; - - os_error_printf(CU_MSG_INFO2, (PS8)"Setting DFS min channel %d, DFS max channel %d\n", - minDFS_channelNum, maxDFS_channelNum); - } -} - -VOID CuCmd_SetBeaconFilterDesiredState(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - - if( nParms == 0 ) - { - print_available_values(BeaconFilter_use); - } - else - { - CuCommon_SetU8(pCuCmd->hCuCommon, TIWLN_802_11_BEACON_FILTER_DESIRED_STATE_SET, (U8)parm[0].value); - } -} - -VOID CuCmd_GetBeaconFilterDesiredState(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - U8 beaconFilterDesiredState = 0; - - if(OK != CuCommon_GetU8(pCuCmd->hCuCommon, TIWLN_802_11_BEACON_FILTER_DESIRED_STATE_GET, &beaconFilterDesiredState)) return; - - os_error_printf(CU_MSG_INFO2, (PS8)"Desired State is %s\n", (beaconFilterDesiredState == 0)?"FILTER INACTIVE":"FILTER ACTIVE" ); -} - -VOID CuCmd_ModifySupportedRates(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - rates_t SupportedRates; - S32 i; - - if( nParms == 0 ) - { - if(OK != CuCommon_GetBuffer(pCuCmd->hCuCommon, TIWLN_802_11_SUPPORTED_RATES, - &SupportedRates, sizeof(rates_t))) return; - - os_error_printf(CU_MSG_INFO2, (PS8)" Rates: "); - for( i=0; i < SupportedRates.len; i++ ) - { - os_error_printf(CU_MSG_INFO2, - (PS8)"%g Mbps(%u%s)%s", - /* patch in order to support NET_RATE_MCS7 values that equal to NET_RATE_1M_BASIC */ - (RATE_2_MBPS(SupportedRates.ratesString[i]) == 63.5) ? 65 : RATE_2_MBPS(SupportedRates.ratesString[i]), - /* patch in order to support NET_RATE_MCS7 values that equal to NET_RATE_1M_BASIC */ - (SupportedRates.ratesString[i] == 0x7f) ? 0x83 : SupportedRates.ratesString[i], - IS_BASIC_RATE(SupportedRates.ratesString[i]) ? " - basic" : "", - (i < SupportedRates.len-1) ? "," : "" ); - } - os_error_printf(CU_MSG_INFO2, (PS8)"\n"); - } - else - { - PS8 buf = (PS8) parm[0].value; - PS8 end_p; - U32 val; - U32 MaxVal = ((1 << (sizeof(SupportedRates.ratesString[i]) * 8))-1); - - os_error_printf(CU_MSG_INFO2, (PS8)"param: %s\n", buf ); - - for( i=0; *buf && i < DOT11_MAX_SUPPORTED_RATES; i++ ) - { - val = os_strtoul(buf, &end_p, 0); - if(val == 0) - { - os_error_printf(CU_MSG_INFO2, (PS8)"CuCmd_ModifySupportedRates: invalid value - %s\n", buf ); - return; - } - if(val > MaxVal) - { - os_error_printf(CU_MSG_INFO2, (PS8)"CuCmd_ModifySupportedRates: out of range %d\n", val ); - return; - } - /* patch in order to support NET_RATE_MCS7 values that equal to NET_RATE_1M_BASIC */ - if (val == 0x83) - { - val = 0x7f; - } - SupportedRates.ratesString[i] = (U8)(val); - buf = end_p; - while( *buf==' ' || *buf == ',' ) buf++; - } - if(*buf) - { - os_error_printf(CU_MSG_INFO2, (PS8)"too many parameters. Max=%d\n", DOT11_MAX_SUPPORTED_RATES ); - return; - } - - SupportedRates.len = (U8) i; - CuCommon_SetBuffer(pCuCmd->hCuCommon, TIWLN_802_11_SUPPORTED_RATES, - &SupportedRates, sizeof(rates_t)); - } -} - -VOID CuCmd_SendHealthCheck(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - - if (OK != CuCommon_SetU32(pCuCmd->hCuCommon, HEALTH_MONITOR_CHECK_DEVICE, TRUE)) return; - - os_error_printf(CU_MSG_INFO2, (PS8)"Send health check...\n"); -} - -VOID CuCmd_EnableRxDataFilters(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - - if (OK != CuCommon_SetU32(pCuCmd->hCuCommon, TIWLN_ENABLE_DISABLE_RX_DATA_FILTERS, TRUE)) return; - - os_error_printf(CU_MSG_INFO2, (PS8)"Enabling Rx data filtering...\n"); -} - -VOID CuCmd_DisableRxDataFilters(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - - if (OK != CuCommon_SetU32(pCuCmd->hCuCommon, TIWLN_ENABLE_DISABLE_RX_DATA_FILTERS, FALSE)) return; - - os_error_printf(CU_MSG_INFO2, (PS8)"Disabling Rx data filtering...\n"); -} - -VOID CuCmd_AddRxDataFilter(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - S32 res; - TRxDataFilterRequest request; - PS8 mask = (PS8) parm[1].value; - PS8 pattern = (PS8) parm[2].value; - - request.offset = (U8)parm[0].value; - CuCmd_ParseMaskString(mask, request.mask, &request.maskLength); - CuCmd_ParsePatternString(pattern, request.pattern, &request.patternLength); - - res = CuCommon_SetBuffer(pCuCmd->hCuCommon, TIWLN_ADD_RX_DATA_FILTER, - &request, sizeof(TRxDataFilterRequest)); - - if(res == OK) - os_error_printf(CU_MSG_INFO2, (PS8)"Filter added.\n"); - else - os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - CuCmd_AddRxDataFilter - Couldn't add Rx data filter...\n"); - -} - -VOID CuCmd_RemoveRxDataFilter(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - S32 res; - TRxDataFilterRequest request; - PS8 mask = (PS8) parm[1].value; - PS8 pattern = (PS8) parm[2].value; - - request.offset = (U8)parm[0].value; - CuCmd_ParseMaskString(mask, request.mask, &request.maskLength); - CuCmd_ParsePatternString(pattern, request.pattern, &request.patternLength); - - res = CuCommon_SetBuffer(pCuCmd->hCuCommon, TIWLN_REMOVE_RX_DATA_FILTER, - &request, sizeof(TRxDataFilterRequest)); - - if(res == OK) - os_error_printf(CU_MSG_INFO2, (PS8)"Filter Removed.\n"); - else - os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - CuCmd_AddRxDataFilter - Couldn't remove Rx data filter...\n"); -} - -VOID CuCmd_GetRxDataFiltersStatistics(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - U32 UnmatchedPacketsCount; - U32 MatchedPacketsCount[4]; - - if (OK != CuCommon_GetRxDataFiltersStatistics(pCuCmd->hCuCommon, &UnmatchedPacketsCount, MatchedPacketsCount)) return; - - os_error_printf(CU_MSG_INFO2, (PS8)"Rx data filtering statistics:\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Unmatched packets: %u\n", UnmatchedPacketsCount); - os_error_printf(CU_MSG_INFO2, (PS8)"Packets matching filter #1: %u\n", MatchedPacketsCount[0]); - os_error_printf(CU_MSG_INFO2, (PS8)"Packets matching filter #2: %u\n", MatchedPacketsCount[1]); - os_error_printf(CU_MSG_INFO2, (PS8)"Packets matching filter #3: %u\n", MatchedPacketsCount[2]); - os_error_printf(CU_MSG_INFO2, (PS8)"Packets matching filter #4: %u\n", MatchedPacketsCount[3]); -} - -VOID CuCmd_ShowStatistics(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - - U32 powerMode; - TMacAddr Mac; - OS_802_11_SSID ssid; - U8 desiredChannel; - S32 rtsTh; - S32 fragTh; - S32 txPowerLevel; - U8 bssType; - U32 desiredPreambleType; - TIWLN_COUNTERS driverCounters; - U32 AuthMode; - U8 CurrentTxRate; - S8 CurrentTxRateStr[20]; - U8 CurrentRxRate; - S8 CurrentRxRateStr[20]; - U32 DefaultKeyId; - U32 WepStatus; - S8 dRssi, bRssi; -#ifdef XCC_MODULE_INCLUDED - U32 XCCNetEap; -#endif - - if(OK != CuCommon_GetBuffer(pCuCmd->hCuCommon, CTRL_DATA_MAC_ADDRESS, - Mac, sizeof(TMacAddr))) return; - if(OK != CuCommon_GetBuffer(pCuCmd->hCuCommon, TIWLN_802_11_POWER_MODE_GET, &powerMode, sizeof(U32))) return; - if(OK != CuOs_Get_SSID(pCuCmd->hCuWext, &ssid)) return; - if(OK != CuCommon_GetU8(pCuCmd->hCuCommon, SITE_MGR_DESIRED_CHANNEL_PARAM, &desiredChannel)) return; - if(OK != CuOs_GetRtsTh(pCuCmd->hCuWext, &rtsTh)) return; - if(OK != CuOs_GetFragTh(pCuCmd->hCuWext, &fragTh)) return; - if(OK != CuOs_GetTxPowerLevel(pCuCmd->hCuWext, &txPowerLevel)) return; - if(OK != CuCommon_GetU8(pCuCmd->hCuCommon, CTRL_DATA_CURRENT_BSS_TYPE_PARAM, &bssType)) return; - if(OK != CuCommon_GetU32(pCuCmd->hCuCommon, TIWLN_802_11_SHORT_PREAMBLE_GET, &desiredPreambleType)) return; - if(OK != CuCommon_GetBuffer(pCuCmd->hCuCommon, SITE_MGR_TI_WLAN_COUNTERS_PARAM, &driverCounters, sizeof(TIWLN_COUNTERS))) return; - if(OK != CuCommon_GetU32(pCuCmd->hCuCommon, RSN_ENCRYPTION_STATUS_PARAM, &WepStatus)) return; - if(OK != CuCommon_GetRssi(pCuCmd->hCuCommon, &dRssi, &bRssi)) return; - if (pCuCmd->hWpaCore == NULL) - { - if(OK != CuCommon_GetU32(pCuCmd->hCuCommon, RSN_EXT_AUTHENTICATION_MODE, &AuthMode)) return; - if(OK != CuCommon_GetU32(pCuCmd->hCuCommon, RSN_DEFAULT_KEY_ID, &DefaultKeyId)) return; - } - else - { -#ifndef NO_WPA_SUPPL - if(OK != WpaCore_GetAuthMode(pCuCmd->hWpaCore, &AuthMode)) return; - if(OK != WpaCore_GetDefaultKey(pCuCmd->hWpaCore, &DefaultKeyId)) return; -#endif - } - - if(OK != CuCommon_GetU8(pCuCmd->hCuCommon, TIWLN_802_11_CURRENT_RATES_GET, &CurrentTxRate)) return; - CuCmd_CreateRateStr(CurrentTxRateStr, CurrentTxRate); - - if(OK != CuCommon_GetU8(pCuCmd->hCuCommon, TIWLN_GET_RX_DATA_RATE, &CurrentRxRate)) return; - CuCmd_CreateRateStr(CurrentRxRateStr, CurrentRxRate); - -#ifdef XCC_MODULE_INCLUDED - if(OK != CuCommon_GetU32(pCuCmd->hCuCommon, RSN_XCC_NETWORK_EAP, &XCCNetEap)) return; -#endif - - os_error_printf(CU_MSG_INFO2, (PS8)"******************\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Driver Statistics:\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"******************\n"); - - os_error_printf(CU_MSG_INFO2, (PS8)" dot11CurrentTxRate : %s\n", CurrentTxRateStr); - os_error_printf(CU_MSG_INFO2, (PS8)" CurrentRxRate : %s\n", CurrentRxRateStr); - os_error_printf(CU_MSG_INFO2, (PS8)" dot11DesiredChannel : %d\n", desiredChannel); - os_error_printf(CU_MSG_INFO2, (PS8)" currentMACAddress : %02x.%02x.%02x.%02x.%02x.%02x\n",Mac[0],Mac[1],Mac[2],Mac[3],Mac[4],Mac[5]); - os_error_printf(CU_MSG_INFO2, (PS8)" dot11DesiredSSID : %s\n", ssid.Ssid); - os_error_printf(CU_MSG_INFO2, (PS8)" dot11BSSType : %d\n", bssType); - os_error_printf(CU_MSG_INFO2, (PS8)" AuthenticationMode : %d\n", AuthMode ); - os_error_printf(CU_MSG_INFO2, (PS8)" bShortPreambleUsed : %d\n", desiredPreambleType ); - os_error_printf(CU_MSG_INFO2, (PS8)" RTSThreshold : %d\n", rtsTh ); - os_error_printf(CU_MSG_INFO2, (PS8)"FragmentationThreshold : %d\n", fragTh ); - os_error_printf(CU_MSG_INFO2, (PS8)" bDefaultWEPKeyDefined : %d\n", DefaultKeyId); - os_error_printf(CU_MSG_INFO2, (PS8)" WEPStatus : %d\n", WepStatus); - os_error_printf(CU_MSG_INFO2, (PS8)" TxPowerLevel : %d\n", txPowerLevel ); - os_error_printf(CU_MSG_INFO2, (PS8)" PowerMode : %d\n", powerMode ); - os_error_printf(CU_MSG_INFO2, (PS8)" dataRssi : %d\n", dRssi); - os_error_printf(CU_MSG_INFO2, (PS8)" beaconRssi : %d\n", bRssi); - /**/ - /* network layer statistics*/ - /**/ - os_error_printf(CU_MSG_INFO2, (PS8)" RecvOk : %d\n", driverCounters.RecvOk ); - os_error_printf(CU_MSG_INFO2, (PS8)" RecvError : %d\n", driverCounters.RecvError ); - os_error_printf(CU_MSG_INFO2, (PS8)" DirectedBytesRecv : %d\n", driverCounters.DirectedBytesRecv ); - os_error_printf(CU_MSG_INFO2, (PS8)" DirectedFramesRecv : %d\n", driverCounters.DirectedFramesRecv ); - os_error_printf(CU_MSG_INFO2, (PS8)" MulticastBytesRecv : %d\n", driverCounters.MulticastBytesRecv ); - os_error_printf(CU_MSG_INFO2, (PS8)" MulticastFramesRecv : %d\n", driverCounters.MulticastFramesRecv ); - os_error_printf(CU_MSG_INFO2, (PS8)" BroadcastBytesRecv : %d\n", driverCounters.BroadcastBytesRecv ); - os_error_printf(CU_MSG_INFO2, (PS8)" BroadcastFramesRecv : %d\n", driverCounters.BroadcastFramesRecv ); - os_error_printf(CU_MSG_INFO2, (PS8)" FcsErrors : %d\n", driverCounters.FcsErrors ); - os_error_printf(CU_MSG_INFO2, (PS8)" BeaconsRecv : %d\n", driverCounters.BeaconsRecv ); - os_error_printf(CU_MSG_INFO2, (PS8)" AssocRejects : %d\n", driverCounters.AssocRejects ); - os_error_printf(CU_MSG_INFO2, (PS8)" AssocTimeouts : %d\n", driverCounters.AssocTimeouts ); - os_error_printf(CU_MSG_INFO2, (PS8)" AuthRejects : %d\n", driverCounters.AuthRejects ); - os_error_printf(CU_MSG_INFO2, (PS8)" AuthTimeouts : %d\n", driverCounters.AuthTimeouts ); - - /**/ - /* other statistics*/ - /**/ -#ifdef XCC_MODULE_INCLUDED - os_error_printf(CU_MSG_INFO2, (PS8)" dwSecuritySuit : %d\n", XCCNetEap); -#endif -} - -VOID CuCmd_ShowTxStatistics(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - TIWLN_TX_STATISTICS txCounters; - U32 TxQid; - U32 AverageDelay; - U32 AverageFWDelay; - U32 AverageMacDelay; - - if( nParms == 0 ) - { - if(OK != CuCommon_GetTxStatistics(pCuCmd->hCuCommon, &txCounters, 0)) return; - } - else - { - if(OK != CuCommon_GetTxStatistics(pCuCmd->hCuCommon, &txCounters, parm[0].value)) return; - } - - os_error_printf(CU_MSG_INFO2, (PS8)"*********************\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Tx Queues Statistics:\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"*********************\n"); - - for (TxQid = 0; TxQid < MAX_NUM_OF_AC; TxQid++) - { - os_error_printf(CU_MSG_INFO2, (PS8)"\nTx Queue %d:\n", TxQid); - os_error_printf(CU_MSG_INFO2, (PS8)"===========\n"); - - os_error_printf(CU_MSG_INFO2, (PS8)" Total Good Frames : %d\n", txCounters.txCounters[TxQid].XmitOk ); - os_error_printf(CU_MSG_INFO2, (PS8)" Unicast Bytes : %d\n", txCounters.txCounters[TxQid].DirectedBytesXmit ); - os_error_printf(CU_MSG_INFO2, (PS8)" Unicast Frames : %d\n", txCounters.txCounters[TxQid].DirectedFramesXmit ); - os_error_printf(CU_MSG_INFO2, (PS8)" Multicast Bytes : %d\n", txCounters.txCounters[TxQid].MulticastBytesXmit ); - os_error_printf(CU_MSG_INFO2, (PS8)" Multicast Frames : %d\n", txCounters.txCounters[TxQid].MulticastFramesXmit ); - os_error_printf(CU_MSG_INFO2, (PS8)" Broadcast Bytes : %d\n", txCounters.txCounters[TxQid].BroadcastBytesXmit ); - os_error_printf(CU_MSG_INFO2, (PS8)" Broadcast Frames : %d\n", txCounters.txCounters[TxQid].BroadcastFramesXmit ); - os_error_printf(CU_MSG_INFO2, (PS8)" Retry Failures : %d\n", txCounters.txCounters[TxQid].RetryFailCounter ); - os_error_printf(CU_MSG_INFO2, (PS8)" Tx Timeout Failures : %d\n", txCounters.txCounters[TxQid].TxTimeoutCounter ); - os_error_printf(CU_MSG_INFO2, (PS8)" No Link Failures : %d\n", txCounters.txCounters[TxQid].NoLinkCounter ); - os_error_printf(CU_MSG_INFO2, (PS8)" Other Failures : %d\n", txCounters.txCounters[TxQid].OtherFailCounter ); - os_error_printf(CU_MSG_INFO2, (PS8)" Max Consecutive Retry Failures : %d\n\n", txCounters.txCounters[TxQid].MaxConsecutiveRetryFail ); - - os_error_printf(CU_MSG_INFO2, (PS8)" Retry histogram:\n"); - os_error_printf(CU_MSG_INFO2, (PS8)" ----------------\n\n"); - os_error_printf(CU_MSG_INFO2, (PS8)" Retries: %8d %8d %8d %8d %8d %8d %8d %8d\n", 0, 1, 2, 3, 4, 5, 6, 7); - os_error_printf(CU_MSG_INFO2, (PS8)" packets: %8d %8d %8d %8d %8d %8d %8d %8d\n\n", - txCounters.txCounters[TxQid].RetryHistogram[ 0 ], - txCounters.txCounters[TxQid].RetryHistogram[ 1 ], - txCounters.txCounters[TxQid].RetryHistogram[ 2 ], - txCounters.txCounters[TxQid].RetryHistogram[ 3 ], - txCounters.txCounters[TxQid].RetryHistogram[ 4 ], - txCounters.txCounters[TxQid].RetryHistogram[ 5 ], - txCounters.txCounters[TxQid].RetryHistogram[ 6 ], - txCounters.txCounters[TxQid].RetryHistogram[ 7 ]); - os_error_printf(CU_MSG_INFO2, (PS8)" Retries: %8d %8d %8d %8d %8d %8d %8d %8d\n", 8, 9, 10, 11, 12, 13, 14, 15); - os_error_printf(CU_MSG_INFO2, (PS8)" packets: %8d %8d %8d %8d %8d %8d %8d %8d\n\n", - txCounters.txCounters[TxQid].RetryHistogram[ 8 ], - txCounters.txCounters[TxQid].RetryHistogram[ 9 ], - txCounters.txCounters[TxQid].RetryHistogram[ 10 ], - txCounters.txCounters[TxQid].RetryHistogram[ 11 ], - txCounters.txCounters[TxQid].RetryHistogram[ 12 ], - txCounters.txCounters[TxQid].RetryHistogram[ 13 ], - txCounters.txCounters[TxQid].RetryHistogram[ 14 ], - txCounters.txCounters[TxQid].RetryHistogram[ 15 ]); - - if (txCounters.txCounters[TxQid].NumPackets) - { - AverageDelay = txCounters.txCounters[TxQid].SumTotalDelayMs / txCounters.txCounters[TxQid].NumPackets; - AverageFWDelay = txCounters.txCounters[TxQid].SumFWDelayUs / txCounters.txCounters[TxQid].NumPackets; - AverageMacDelay = txCounters.txCounters[TxQid].SumMacDelayUs / txCounters.txCounters[TxQid].NumPackets; - } - else - { - AverageDelay = 0; - AverageFWDelay = 0; - AverageMacDelay = 0; - } - - os_error_printf(CU_MSG_INFO2, (PS8)" Total Delay ms (average/sum) : %d / %d\n", AverageDelay, txCounters.txCounters[TxQid].SumTotalDelayMs); - os_error_printf(CU_MSG_INFO2, (PS8)" FW Delay us (average/sum) : %d / %d\n", AverageFWDelay, txCounters.txCounters[TxQid].SumFWDelayUs); - os_error_printf(CU_MSG_INFO2, (PS8)" MAC Delay us (average/sum) : %d / %d\n\n", AverageMacDelay, txCounters.txCounters[TxQid].SumMacDelayUs); - - os_error_printf(CU_MSG_INFO2, (PS8)" Delay Ranges [msec] : Num of packets\n"); - os_error_printf(CU_MSG_INFO2, (PS8)" ------------------- : --------------\n"); - os_error_printf(CU_MSG_INFO2, (PS8)" 0 - 1 : %d\n", txCounters.txCounters[TxQid].txDelayHistogram[TX_DELAY_RANGE_0_TO_1] ); - os_error_printf(CU_MSG_INFO2, (PS8)" 1 - 10 : %d\n", txCounters.txCounters[TxQid].txDelayHistogram[TX_DELAY_RANGE_1_TO_10] ); - os_error_printf(CU_MSG_INFO2, (PS8)" 10 - 20 : %d\n", txCounters.txCounters[TxQid].txDelayHistogram[TX_DELAY_RANGE_10_TO_20] ); - os_error_printf(CU_MSG_INFO2, (PS8)" 20 - 40 : %d\n", txCounters.txCounters[TxQid].txDelayHistogram[TX_DELAY_RANGE_20_TO_40] ); - os_error_printf(CU_MSG_INFO2, (PS8)" 40 - 60 : %d\n", txCounters.txCounters[TxQid].txDelayHistogram[TX_DELAY_RANGE_40_TO_60] ); - os_error_printf(CU_MSG_INFO2, (PS8)" 60 - 80 : %d\n", txCounters.txCounters[TxQid].txDelayHistogram[TX_DELAY_RANGE_60_TO_80] ); - os_error_printf(CU_MSG_INFO2, (PS8)" 80 - 100 : %d\n", txCounters.txCounters[TxQid].txDelayHistogram[TX_DELAY_RANGE_80_TO_100] ); - os_error_printf(CU_MSG_INFO2, (PS8)" 100 - 200 : %d\n", txCounters.txCounters[TxQid].txDelayHistogram[TX_DELAY_RANGE_100_TO_200] ); - os_error_printf(CU_MSG_INFO2, (PS8)" Above 200 : %d\n", txCounters.txCounters[TxQid].txDelayHistogram[TX_DELAY_RANGE_ABOVE_200] ); - } -} - -VOID CuCmd_ShowAdvancedParams(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - - U32 AuthMode; - TPowerMgr_PowerMode Mode; - S32 txPowerLevel; -#ifndef NO_WPA_SUPPL - OS_802_11_ENCRYPTION_TYPES EncryptionTypePairwise; - OS_802_11_ENCRYPTION_TYPES EncryptionTypeGroup; -#endif - S32 Preamble; - S32 FragTh; - S32 RtsTh; - - if (pCuCmd->hWpaCore == NULL) - { - if(OK != CuCommon_GetU32(pCuCmd->hCuCommon, RSN_EXT_AUTHENTICATION_MODE, &AuthMode)) return; - } - else - { -#ifndef NO_WPA_SUPPL - if(OK != WpaCore_GetAuthMode(pCuCmd->hWpaCore, &AuthMode)) return; -#endif - } - if(OK != CuCommon_GetBuffer(pCuCmd->hCuCommon, TIWLN_802_11_POWER_MODE_GET, &Mode, sizeof(TPowerMgr_PowerMode))) return; - if(OK != CuOs_GetTxPowerLevel(pCuCmd->hCuWext, &txPowerLevel)) return; -#ifndef NO_WPA_SUPPL - if(OK != WpaCore_GetEncryptionPairWise(pCuCmd->hWpaCore, &EncryptionTypePairwise)) return; - if(OK != WpaCore_GetEncryptionGroup(pCuCmd->hWpaCore, &EncryptionTypeGroup)) return; -#endif - if(OK != CuCommon_GetU32(pCuCmd->hCuCommon, TIWLN_802_11_SHORT_PREAMBLE_GET, (PU32)&Preamble)) return; - if(OK != CuOs_GetFragTh(pCuCmd->hCuWext, &FragTh)) return; - if(OK != CuOs_GetRtsTh(pCuCmd->hCuWext, &RtsTh)) return; - - - os_error_printf(CU_MSG_INFO2, (PS8)"********************\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Advanced Statistics:\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"********************\n"); - - os_error_printf(CU_MSG_INFO2, (PS8)" Authentication : %u\n", AuthMode ); - os_error_printf(CU_MSG_INFO2, (PS8)" Power mode : %d\n", Mode.PowerMode ); - os_error_printf(CU_MSG_INFO2, (PS8)" Tx Power level : %d\n", txPowerLevel ); -#ifndef NO_WPA_SUPPL - os_error_printf(CU_MSG_INFO2, (PS8)" Encryption Pairwise: %u\n", EncryptionTypePairwise ); - os_error_printf(CU_MSG_INFO2, (PS8)" Encryption Group: %u\n", EncryptionTypeGroup ); -#endif - os_error_printf(CU_MSG_INFO2, (PS8)" Preamble : <%s>\n", (Preamble) ? "short" : "long"); - os_error_printf(CU_MSG_INFO2, (PS8)" Frag. threshold : %u\n", FragTh); - os_error_printf(CU_MSG_INFO2, (PS8)" RTS threshold : %u\n", RtsTh ); - os_error_printf(CU_MSG_INFO2, (PS8)" Power mode: "); - print_available_values(power_mode_val); - os_error_printf(CU_MSG_INFO2, (PS8)" Encryption type: "); - print_available_values(encrypt_type); - -} - - -VOID Cucmd_ShowPowerConsumptionStats(THandle hCuCmd,ConParm_t parm[],U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - ACXPowerConsumptionTimeStat_t tStatistics; - - os_memset( &tStatistics, 0, sizeof(ACXPowerConsumptionTimeStat_t) ); - - if (OK != CuCommon_GetPowerConsumptionStat(pCuCmd->hCuCommon,&tStatistics)) - { - os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - Failed to read power consumption statistic!\n"); - return; - } - - - - os_error_printf(CU_MSG_INFO2, (PS8)"\nPower Consumption Statistics:\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"-----------------------------\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"activeTimeCnt:0x%x%x\n", tStatistics.awakeTimeCnt_Hi,tStatistics.awakeTimeCnt_Low ); - os_error_printf(CU_MSG_INFO2, (PS8)"elpTimeCnt: 0x%x%x\n", tStatistics.elpTimeCnt_Hi,tStatistics.elpTimeCnt_Low); - os_error_printf(CU_MSG_INFO2, (PS8)"powerDownTimeCnt: 0x%x%x\n", tStatistics.powerDownTimeCnt_Hi,tStatistics.powerDownTimeCnt_Low); - os_error_printf(CU_MSG_INFO2, (PS8)"ListenMode11BTimeCnt: 0x%x%x\n", tStatistics.ListenMode11BTimeCnt_Hi,tStatistics.ListenMode11BTimeCnt_Low); - os_error_printf(CU_MSG_INFO2, (PS8)"ListenModeOFDMTimeCnt: 0x%x%x\n", tStatistics.ListenModeOFDMTimeCnt_Hi,tStatistics.ListenModeOFDMTimeCnt_Low); - -} - - - -VOID CuCmd_ScanAppGlobalConfig(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - - if ( 0 == os_strcmp( (PS8)"<empty>", (PS8)parm[0].value) ) - { - pCuCmd->appScanParams.desiredSsid.len = 0; - pCuCmd->appScanParams.desiredSsid.str[ 0 ] = '\0'; - } - else - { - pCuCmd->appScanParams.desiredSsid.len = (U8) os_strlen((PS8)parm[0].value); - os_memcpy( (PVOID)&(pCuCmd->appScanParams.desiredSsid.str), (PVOID)parm[0].value, pCuCmd->appScanParams.desiredSsid.len ); - if(pCuCmd->appScanParams.desiredSsid.len < MAX_SSID_LEN) - { - pCuCmd->appScanParams.desiredSsid.str[pCuCmd->appScanParams.desiredSsid.len] = 0; - } - } - pCuCmd->appScanParams.scanType = parm[1].value; - pCuCmd->appScanParams.band = parm[2].value; - pCuCmd->appScanParams.probeReqNumber = (U8)parm[3].value; - pCuCmd->appScanParams.probeRequestRate = parm[4].value; -#ifdef TI_DBG - pCuCmd->appScanParams.Tid = (U8)parm[5].value; - pCuCmd->appScanParams.numOfChannels = (U8)parm[6].value; -#else - pCuCmd->appScanParams.Tid = 0; - pCuCmd->appScanParams.numOfChannels = (U8)parm[5].value; -#endif -} - -VOID CuCmd_ScanAppChannelConfig(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - - scan_normalChannelEntry_t* pChannelEntry = - &(pCuCmd->appScanParams.channelEntry[ parm[0].value ].normalChannelEntry); - - if (parm[2].value < parm[3].value) - { - os_error_printf(CU_MSG_INFO2, (PS8)"Max Dwell Time must be larger than or equal to Min Dwell Time...\n"); - return; - } - - CuCmd_Str2MACAddr ((PS8)parm[1].value, pChannelEntry->bssId); - pChannelEntry->maxChannelDwellTime = parm[2].value; - pChannelEntry->minChannelDwellTime = parm[3].value; - pChannelEntry->earlyTerminationEvent = parm[4].value; - pChannelEntry->ETMaxNumOfAPframes = (U8)parm[5].value; - pChannelEntry->txPowerDbm = (U8)parm[6].value; - pChannelEntry->channel = (U8)parm[7].value; -} - -VOID CuCmd_ScanAppClear(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - os_memset( &pCuCmd->appScanParams, 0, sizeof(scan_Params_t) ); - os_error_printf(CU_MSG_INFO2, (PS8)"Application scan parameters cleared.\n"); -} - -VOID CuCmd_ScanAppDisplay(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - S32 i,j; - scan_normalChannelEntry_t* pNormalChannel; - - CU_CMD_FIND_NAME_ARRAY(j, rate2Str, pCuCmd->appScanParams.probeRequestRate); - os_error_printf(CU_MSG_INFO2, (PS8)"Application Scan params:\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"SSID: %s, Type: %s\n", - pCuCmd->appScanParams.desiredSsid.str, - scanType2Str[ pCuCmd->appScanParams.scanType ].name); - os_error_printf(CU_MSG_INFO2, (PS8)"Band: %s, Number of probe req:%d, probe req. rate:%s\n", - band2Str[ pCuCmd->appScanParams.band ].name, - pCuCmd->appScanParams.probeReqNumber, - rate2Str[j].name); -#ifdef TI_DBG - os_error_printf(CU_MSG_INFO2, (PS8)"Tid :%d\n\n", pCuCmd->appScanParams.Tid); -#else - os_error_printf(CU_MSG_INFO2, (PS8)"\n"); -#endif - os_error_printf(CU_MSG_INFO2, (PS8)"Channel BSS ID Max time Min time ET event ET frame num Power\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"-------------------------------------------------------------------------------\n"); - for ( i = 0; i < pCuCmd->appScanParams.numOfChannels; i++ ) - { - pNormalChannel = &(pCuCmd->appScanParams.channelEntry[ i ].normalChannelEntry); - CU_CMD_FIND_NAME_ARRAY(j, EtEvent2Str, pNormalChannel->earlyTerminationEvent); - os_error_printf(CU_MSG_INFO2, (PS8)"%2d %02x.%02x.%02x.%02x.%02x.%02x %7d %7d %s%3d %1d\n", - pNormalChannel->channel, - pNormalChannel->bssId[0],pNormalChannel->bssId[1],pNormalChannel->bssId[2],pNormalChannel->bssId[3],pNormalChannel->bssId[4],pNormalChannel->bssId[5], - pNormalChannel->maxChannelDwellTime, - pNormalChannel->minChannelDwellTime, - EtEvent2Str[j].name, - pNormalChannel->ETMaxNumOfAPframes, - pNormalChannel->txPowerDbm); - } - os_error_printf(CU_MSG_INFO2, (PS8)"\n"); -} - -VOID CuCmd_ScanSetSra(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - - if (OK != CuCommon_SetU32(pCuCmd->hCuCommon, SCAN_CNCN_SET_SRA, parm[0].value) ) - { - os_error_printf(CU_MSG_INFO2, (PS8) "Failed setting Scan Result Aging"); - } - os_error_printf(CU_MSG_INFO2, (PS8) "Scan Result Aging set succesfully to %d seconds", parm[0].value); -} - -VOID CuCmd_ScanSetRssi(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - - if (OK != CuCommon_SetU32(pCuCmd->hCuCommon, SCAN_CNCN_SET_RSSI, parm[0].value) ) - { - os_error_printf(CU_MSG_INFO2, (PS8) "Failed setting Rssi filter threshold"); - } - os_error_printf(CU_MSG_INFO2, (PS8) "Rssi filter set succesfully to %d", parm[0].value); -} - -VOID CuCmd_StartScan(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - - if(OK != CuCommon_SetBuffer(pCuCmd->hCuCommon, TIWLN_802_11_START_APP_SCAN_SET, - &pCuCmd->appScanParams, sizeof(scan_Params_t))) - { - return; - } - - os_error_printf(CU_MSG_INFO2, (PS8)"Application scan started\n"); - - /* - * In order to have ability to set the application scan we are using application scan priver command - * exsample for using supplicant scan command below: - * #ifndef NO_WPA_SUPPL - * CuOs_Start_Scan(pCuCmd->hCuWext, &ssid); - * #endif - */ -} - -VOID CuCmd_WextStartScan(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - OS_802_11_SSID ssid; - U8 scanType =0; - - switch (nParms) - { - case 0: - ssid.SsidLength = 0; - ssid.Ssid[0] = 0; - scanType = 0; - break; - case 1 : - /* - * No SSID & No BSSID are set - - * Use Any SSID & Any BSSID. - */ - ssid.SsidLength = 0; - ssid.Ssid[0] = 0; - scanType = (U8)parm[0].value; - break; - - case 2: - /* - * SSID set - * Use CLI's SSID & Any BSSID. - */ - ssid.SsidLength = os_strlen( (PS8)parm[1].value); - os_memcpy((PVOID)ssid.Ssid, (PVOID) parm[1].value, ssid.SsidLength); - ssid.Ssid[ssid.SsidLength] = '\0'; - scanType = (U8)parm[0].value; /* 0 - Active , 1 - Passive*/ - break; - - default: - os_error_printf(CU_MSG_ERROR, (PS8)"<Scan Type [0=Active, 1=Passive]> <ssid Name As optional>\n"); - return; - } - - - -#ifndef NO_WPA_SUPPL - CuOs_Start_Scan(pCuCmd->hCuWext, &ssid, scanType); -#else - os_error_printf(CU_MSG_INFO2, (PS8)"WEXT not build, Scan Not Started\n"); -#endif - -} - -VOID CuCmd_StopScan (THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - - if(OK != CuCommon_SetBuffer(pCuCmd->hCuCommon, TIWLN_802_11_STOP_APP_SCAN_SET, NULL, 0)) - { - return; - } - os_error_printf(CU_MSG_INFO2, (PS8)"Application scan stopped\n"); -} - -VOID CuCmd_ConfigPeriodicScanGlobal (THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - - pCuCmd->tPeriodicAppScanParams.iRssiThreshold = (S8)parm[ 0 ].value; - pCuCmd->tPeriodicAppScanParams.iSnrThreshold = (S8)parm[ 1 ].value; - pCuCmd->tPeriodicAppScanParams.uFrameCountReportThreshold = parm[ 2 ].value; - pCuCmd->tPeriodicAppScanParams.bTerminateOnReport = parm[ 3 ].value; - pCuCmd->tPeriodicAppScanParams.eBssType = (ScanBssType_e )parm[ 4 ].value; - pCuCmd->tPeriodicAppScanParams.uProbeRequestNum = parm[ 5 ].value; - pCuCmd->tPeriodicAppScanParams.uCycleNum = parm[ 6 ].value; - pCuCmd->tPeriodicAppScanParams.uSsidNum = parm[ 7 ].value; - pCuCmd->tPeriodicAppScanParams.uSsidListFilterEnabled = (U8)(parm[ 8 ].value); - pCuCmd->tPeriodicAppScanParams.uChannelNum = parm[ 9 ].value; -} - -VOID CuCmd_ConfigPeriodicScanInterval (THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - - pCuCmd->tPeriodicAppScanParams.uCycleIntervalMsec[ parm[ 0 ].value ] = parm[ 1 ].value; -} - -VOID CuCmd_ConfigurePeriodicScanSsid (THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - TSsid *pSsid = &pCuCmd->tPeriodicAppScanParams.tDesiredSsid[ parm[ 0 ].value ].tSsid; - - pCuCmd->tPeriodicAppScanParams.tDesiredSsid[ parm[ 0 ].value ].eVisability = parm[ 1 ].value; - pSsid->len = (U8)os_strlen ((PS8)parm[ 2 ].value); - os_memcpy ((PVOID)&(pSsid->str), - (PVOID)parm[ 2 ].value, - pSsid->len); - if(pSsid->len < MAX_SSID_LEN) - { - pSsid->str[pSsid->len] = 0; - } -} - -VOID CuCmd_ConfigurePeriodicScanChannel (THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t *pCuCmd = (CuCmd_t*)hCuCmd; - TPeriodicChannelEntry *pChannelEnrty = &(pCuCmd->tPeriodicAppScanParams.tChannels[ parm[ 0 ].value ]); - - pChannelEnrty->eBand = parm[ 1 ].value; - pChannelEnrty->uChannel = parm[ 2 ].value; - pChannelEnrty->eScanType = parm[ 3 ].value; - pChannelEnrty->uMinDwellTimeMs = parm[ 4 ].value;; - pChannelEnrty->uMaxDwellTimeMs = parm[ 5 ].value; - pChannelEnrty->uTxPowerLevelDbm = parm[ 6 ].value; -} - -VOID CuCmd_ClearPeriodicScanConfiguration (THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - - os_memset (&(pCuCmd->tPeriodicAppScanParams), 0, sizeof (TPeriodicScanParams)); - os_error_printf(CU_MSG_INFO2, (PS8)"Periodic application scan parameters cleared.\n"); -} - -VOID CuCmd_DisplayPeriodicScanConfiguration (THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - S32 i, j, k; - - os_error_printf(CU_MSG_INFO2, (PS8)"Application Periodic Scan parameters:\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"RSSI Threshold: %d, SNR Threshold: %d, Report Threshold: %d Number of cycles: %d\n", - pCuCmd->tPeriodicAppScanParams.iRssiThreshold, pCuCmd->tPeriodicAppScanParams.iSnrThreshold, - pCuCmd->tPeriodicAppScanParams.uFrameCountReportThreshold, pCuCmd->tPeriodicAppScanParams.uCycleNum); - CU_CMD_FIND_NAME_ARRAY (i, booleanStr, pCuCmd->tPeriodicAppScanParams.bTerminateOnReport); - CU_CMD_FIND_NAME_ARRAY (j, bssTypeStr, pCuCmd->tPeriodicAppScanParams.eBssType); - os_error_printf(CU_MSG_INFO2, (PS8)"Terminate on Report: %s, BSS type: %s, Probe Request Number: %d\n", - booleanStr[ i ].name, bssTypeStr[ j ].name, pCuCmd->tPeriodicAppScanParams.uProbeRequestNum); - - os_error_printf(CU_MSG_INFO2, (PS8)"\nIntervals (msec):\n"); - for (i = 0; i < PERIODIC_SCAN_MAX_INTERVAL_NUM; i++) - { - os_error_printf(CU_MSG_INFO2, (PS8)"%d ", pCuCmd->tPeriodicAppScanParams.uCycleIntervalMsec[ i ]); - } - os_error_printf(CU_MSG_INFO2, (PS8)"\n\nSSIDs:\n"); - for (i = 0; i < (S32)pCuCmd->tPeriodicAppScanParams.uSsidNum; i++) - { - CU_CMD_FIND_NAME_ARRAY (j, ssidVisabilityStr, pCuCmd->tPeriodicAppScanParams.tDesiredSsid[ i ].eVisability); - os_error_printf(CU_MSG_INFO2, (PS8)"%s (%s), ", pCuCmd->tPeriodicAppScanParams.tDesiredSsid[ i ].tSsid.str, - ssidVisabilityStr[ j ].name); - } - os_error_printf(CU_MSG_INFO2, (PS8)"\n\nSSID List Filter Enabled: %d\n", pCuCmd->tPeriodicAppScanParams.uSsidListFilterEnabled ); - - os_error_printf(CU_MSG_INFO2, (PS8)"\n\nChannels:\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"%-15s %-10s %-20s %-15s %-15s %-20s\n", - (PS8)"Band", (PS8)"Channel", (PS8)"Scan type", (PS8)"Min dwell time", (PS8)"Max dwell time", (PS8)"Power level (dBm*10)"); - os_error_printf(CU_MSG_INFO2, (PS8)"----------------------------------------------------------------------------------------------------\n"); - for (i = 0; i < (S32)pCuCmd->tPeriodicAppScanParams.uChannelNum; i++) - { - CU_CMD_FIND_NAME_ARRAY (j, band2Str, pCuCmd->tPeriodicAppScanParams.tChannels[ i ].eBand); - CU_CMD_FIND_NAME_ARRAY (k, scanType2Str, pCuCmd->tPeriodicAppScanParams.tChannels[ i ].eScanType); - os_error_printf(CU_MSG_INFO2, (PS8)"%-15s %-10d %-20s %-15d %-15d %-20d\n", - band2Str[ j ].name, - pCuCmd->tPeriodicAppScanParams.tChannels[ i ].uChannel, - scanType2Str[ k ].name, - pCuCmd->tPeriodicAppScanParams.tChannels[ i ].uMinDwellTimeMs, - pCuCmd->tPeriodicAppScanParams.tChannels[ i ].uMaxDwellTimeMs, - pCuCmd->tPeriodicAppScanParams.tChannels[ i ].uTxPowerLevelDbm); - } - os_error_printf(CU_MSG_INFO2, (PS8)"\n"); -} - -VOID CuCmd_StartPeriodicScan (THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - - if(OK != CuCommon_SetBuffer(pCuCmd->hCuCommon, SCAN_CNCN_START_PERIODIC_SCAN, - &(pCuCmd->tPeriodicAppScanParams), sizeof(TPeriodicScanParams))) - { - return; - } - os_error_printf(CU_MSG_INFO2, (PS8)"Periodic application scan started.\n"); -} - -VOID CuCmd_StopPeriodicScan (THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - - if(OK != CuCommon_SetBuffer(pCuCmd->hCuCommon, SCAN_CNCN_STOP_PERIODIC_SCAN, - NULL, 0)) - { - return; - } - os_error_printf(CU_MSG_INFO2, (PS8)"Periodic application scan stopped.\n"); -} - -VOID CuCmd_ConfigScanPolicy(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - - pCuCmd->scanPolicy.normalScanInterval = parm[ 0 ].value; - pCuCmd->scanPolicy.deterioratingScanInterval = parm[ 1 ].value; - pCuCmd->scanPolicy.maxTrackFailures = (U8)(parm[ 2 ].value); - pCuCmd->scanPolicy.BSSListSize = (U8)(parm[ 3 ].value); - pCuCmd->scanPolicy.BSSNumberToStartDiscovery = (U8)(parm[ 4 ].value); - pCuCmd->scanPolicy.numOfBands = (U8)(parm[ 5 ].value); -} - -VOID CuCmd_ConfigScanBand(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - scan_bandPolicy_t* pBandPolicy = &(pCuCmd->scanPolicy.bandScanPolicy[ parm [ 0 ].value ]); - - pBandPolicy->band = parm[ 1 ].value; - pBandPolicy->rxRSSIThreshold = (S8)(parm[ 2 ].value); - pBandPolicy->numOfChannlesForDiscovery = (U8)(parm[ 3 ].value); - pBandPolicy->numOfChannles = (U8)(parm[ 4 ].value); -} - -VOID CuCmd_ConfigScanBandChannel(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - scan_bandPolicy_t* pBandPolicy = &(pCuCmd->scanPolicy.bandScanPolicy[ parm [ 0 ].value ]); - - pBandPolicy->channelList[ parm[ 1 ].value ] = (U8)(parm[ 2 ].value); -} - -VOID CuCmd_ConfigScanBandTrack(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - scan_bandPolicy_t* pBandPolicy = &(pCuCmd->scanPolicy.bandScanPolicy[ parm [ 0 ].value ]); - - if (parm[6].value < parm[7].value) - { - os_error_printf(CU_MSG_INFO2, (PS8)"Max Dwell Time must be larger than or equal to Min Dwell Time...\n"); - return; - } - - pBandPolicy->trackingMethod.scanType = parm[ 1 ].value; - - switch (pBandPolicy->trackingMethod.scanType) - { - case SCAN_TYPE_NORMAL_ACTIVE: - case SCAN_TYPE_NORMAL_PASSIVE: - pBandPolicy->trackingMethod.method.basicMethodParams.maxChannelDwellTime = (parm[ 6 ].value); - pBandPolicy->trackingMethod.method.basicMethodParams.minChannelDwellTime = (parm[ 7 ].value); - pBandPolicy->trackingMethod.method.basicMethodParams.earlyTerminationEvent = parm[ 2 ].value; - pBandPolicy->trackingMethod.method.basicMethodParams.ETMaxNumberOfApFrames = (U8)(parm[ 3 ].value); - pBandPolicy->trackingMethod.method.basicMethodParams.probReqParams.bitrate = parm[ 9 ].value; - pBandPolicy->trackingMethod.method.basicMethodParams.probReqParams.numOfProbeReqs = (U8)(parm[ 8 ].value); - pBandPolicy->trackingMethod.method.basicMethodParams.probReqParams.txPowerDbm = (U8)(parm[ 10 ].value); - break; - - case SCAN_TYPE_TRIGGERED_ACTIVE: - case SCAN_TYPE_TRIGGERED_PASSIVE: - /* Check if valid TID */ - if (((parm[ 4 ].value) > 7) && ((parm[ 4 ].value) != 255)) - { - os_error_printf (CU_MSG_INFO2, (PS8)"ERROR Tid (AC) should be 0..7 or 255 instead = %d (using default = 255)\n",(parm[ 4 ].value)); - parm[ 4 ].value = 255; - } - - pBandPolicy->trackingMethod.method.TidTriggerdMethodParams.triggeringTid = (U8)(parm[ 4 ].value); - pBandPolicy->trackingMethod.method.TidTriggerdMethodParams.basicMethodParams.maxChannelDwellTime = (parm[ 6 ].value); - pBandPolicy->trackingMethod.method.TidTriggerdMethodParams.basicMethodParams.minChannelDwellTime = (parm[ 7 ].value); - pBandPolicy->trackingMethod.method.TidTriggerdMethodParams.basicMethodParams.earlyTerminationEvent = parm[ 2 ].value; - pBandPolicy->trackingMethod.method.TidTriggerdMethodParams.basicMethodParams.ETMaxNumberOfApFrames = (U8)(parm[ 3 ].value); - pBandPolicy->trackingMethod.method.TidTriggerdMethodParams.basicMethodParams.probReqParams.bitrate = parm[ 9 ].value; - pBandPolicy->trackingMethod.method.TidTriggerdMethodParams.basicMethodParams.probReqParams.numOfProbeReqs = (U8)(parm[ 8 ].value); - pBandPolicy->trackingMethod.method.TidTriggerdMethodParams.basicMethodParams.probReqParams.txPowerDbm = (U8)(parm[ 10 ].value); - break; - - case SCAN_TYPE_SPS: - pBandPolicy->trackingMethod.method.spsMethodParams.earlyTerminationEvent = parm[ 2 ].value; - pBandPolicy->trackingMethod.method.spsMethodParams.ETMaxNumberOfApFrames = (U8)(parm[ 3 ].value); - pBandPolicy->trackingMethod.method.spsMethodParams.scanDuration = parm[ 5 ].value; - break; - - default: - pBandPolicy->trackingMethod.scanType = SCAN_TYPE_NO_SCAN; - break; - } -} - -VOID CuCmd_ConfigScanBandDiscover(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - scan_bandPolicy_t* pBandPolicy = &(pCuCmd->scanPolicy.bandScanPolicy[ parm [ 0 ].value ]); - - if (parm[6].value < parm[7].value) - { - os_error_printf(CU_MSG_INFO2, (PS8)"Max Dwell Time must be larger than or equal to Min Dwell Time...\n"); - return; - } - - pBandPolicy->discoveryMethod.scanType = parm[ 1 ].value; - - switch (pBandPolicy->discoveryMethod.scanType) - { - case SCAN_TYPE_NORMAL_ACTIVE: - case SCAN_TYPE_NORMAL_PASSIVE: - pBandPolicy->discoveryMethod.method.basicMethodParams.maxChannelDwellTime = (parm[ 6 ].value); - pBandPolicy->discoveryMethod.method.basicMethodParams.minChannelDwellTime = (parm[ 7 ].value); - pBandPolicy->discoveryMethod.method.basicMethodParams.earlyTerminationEvent = parm[ 2 ].value; - pBandPolicy->discoveryMethod.method.basicMethodParams.ETMaxNumberOfApFrames = (U8)(parm[ 3 ].value); - pBandPolicy->discoveryMethod.method.basicMethodParams.probReqParams.bitrate = parm[ 9 ].value; - pBandPolicy->discoveryMethod.method.basicMethodParams.probReqParams.numOfProbeReqs = (U8)(parm[ 8 ].value); - pBandPolicy->discoveryMethod.method.basicMethodParams.probReqParams.txPowerDbm = (U8)(parm[ 10 ].value); - break; - - case SCAN_TYPE_TRIGGERED_ACTIVE: - case SCAN_TYPE_TRIGGERED_PASSIVE: - /* Check if valid TID */ - if (((parm[ 4 ].value) > 7) && ((parm[ 4 ].value) != 255)) - { - os_error_printf(CU_MSG_INFO2, (PS8)"ERROR Tid (AC) should be 0..7 or 255 instead = %d (using default = 255)\n",(parm[ 4 ].value)); - parm[ 4 ].value = 255; - } - - pBandPolicy->discoveryMethod.method.TidTriggerdMethodParams.triggeringTid = (U8)(parm[ 4 ].value); - pBandPolicy->discoveryMethod.method.TidTriggerdMethodParams.basicMethodParams.maxChannelDwellTime = (parm[ 6 ].value); - pBandPolicy->discoveryMethod.method.TidTriggerdMethodParams.basicMethodParams.minChannelDwellTime = (parm[ 7 ].value); - pBandPolicy->discoveryMethod.method.TidTriggerdMethodParams.basicMethodParams.earlyTerminationEvent = parm[ 2 ].value; - pBandPolicy->discoveryMethod.method.TidTriggerdMethodParams.basicMethodParams.ETMaxNumberOfApFrames = (U8)(parm[ 3 ].value); - pBandPolicy->discoveryMethod.method.TidTriggerdMethodParams.basicMethodParams.probReqParams.bitrate = parm[ 9 ].value; - pBandPolicy->discoveryMethod.method.TidTriggerdMethodParams.basicMethodParams.probReqParams.numOfProbeReqs = (U8)(parm[ 8 ].value); - pBandPolicy->discoveryMethod.method.TidTriggerdMethodParams.basicMethodParams.probReqParams.txPowerDbm = (U8)(parm[ 10 ].value); - break; - - case SCAN_TYPE_SPS: - pBandPolicy->discoveryMethod.method.spsMethodParams.earlyTerminationEvent = parm[ 2 ].value; - pBandPolicy->discoveryMethod.method.spsMethodParams.ETMaxNumberOfApFrames = (U8)(parm[ 3 ].value); - pBandPolicy->discoveryMethod.method.spsMethodParams.scanDuration = parm[ 5 ].value; - break; - - default: - pBandPolicy->discoveryMethod.scanType = SCAN_TYPE_NO_SCAN; - break; - } -} - -VOID CuCmd_ConfigScanBandImmed(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - scan_bandPolicy_t* pBandPolicy = &(pCuCmd->scanPolicy.bandScanPolicy[ parm [ 0 ].value ]); - - if (parm[6].value < parm[7].value) - { - os_error_printf(CU_MSG_INFO2, (PS8)"Max Dwell Time must be larger than or equal to Min Dwell Time...\n"); - return; - } - - pBandPolicy->immediateScanMethod.scanType = parm[ 1 ].value; - - switch (pBandPolicy->immediateScanMethod.scanType) - { - case SCAN_TYPE_NORMAL_ACTIVE: - case SCAN_TYPE_NORMAL_PASSIVE: - pBandPolicy->immediateScanMethod.method.basicMethodParams.maxChannelDwellTime = (parm[ 6 ].value); - pBandPolicy->immediateScanMethod.method.basicMethodParams.minChannelDwellTime = (parm[ 7 ].value); - pBandPolicy->immediateScanMethod.method.basicMethodParams.earlyTerminationEvent = parm[ 2 ].value; - pBandPolicy->immediateScanMethod.method.basicMethodParams.ETMaxNumberOfApFrames = (U8)(parm[ 3 ].value); - pBandPolicy->immediateScanMethod.method.basicMethodParams.probReqParams.bitrate = parm[ 9 ].value; - pBandPolicy->immediateScanMethod.method.basicMethodParams.probReqParams.numOfProbeReqs = (U8)(parm[ 8 ].value); - pBandPolicy->immediateScanMethod.method.basicMethodParams.probReqParams.txPowerDbm = (U8)(parm[ 10 ].value); - break; - - case SCAN_TYPE_TRIGGERED_ACTIVE: - case SCAN_TYPE_TRIGGERED_PASSIVE: - /* Check if valid TID */ - if (((parm[ 4 ].value) > 7) && ((parm[ 4 ].value) != 255)) - { - os_error_printf (CU_MSG_INFO2, (PS8)"ERROR Tid (AC) should be 0..7 or 255 instead = %d (using default = 255)\n",(parm[ 4 ].value)); - parm[ 4 ].value = 255; - } - - pBandPolicy->immediateScanMethod.method.TidTriggerdMethodParams.triggeringTid = (U8)(parm[ 4 ].value); - pBandPolicy->immediateScanMethod.method.TidTriggerdMethodParams.basicMethodParams.maxChannelDwellTime = (parm[ 6 ].value); - pBandPolicy->immediateScanMethod.method.TidTriggerdMethodParams.basicMethodParams.minChannelDwellTime = (parm[ 7 ].value); - pBandPolicy->immediateScanMethod.method.TidTriggerdMethodParams.basicMethodParams.earlyTerminationEvent = parm[ 2 ].value; - pBandPolicy->immediateScanMethod.method.TidTriggerdMethodParams.basicMethodParams.ETMaxNumberOfApFrames = (U8)(parm[ 3 ].value); - pBandPolicy->immediateScanMethod.method.TidTriggerdMethodParams.basicMethodParams.probReqParams.bitrate = parm[ 9 ].value; - pBandPolicy->immediateScanMethod.method.TidTriggerdMethodParams.basicMethodParams.probReqParams.numOfProbeReqs = (U8)(parm[ 8 ].value); - pBandPolicy->immediateScanMethod.method.TidTriggerdMethodParams.basicMethodParams.probReqParams.txPowerDbm = (U8)(parm[ 10 ].value); - break; - - case SCAN_TYPE_SPS: - pBandPolicy->immediateScanMethod.method.spsMethodParams.earlyTerminationEvent = parm[ 2 ].value; - pBandPolicy->immediateScanMethod.method.spsMethodParams.ETMaxNumberOfApFrames = (U8)(parm[ 3 ].value); - pBandPolicy->immediateScanMethod.method.spsMethodParams.scanDuration = parm[ 5 ].value; - break; - - default: - pBandPolicy->immediateScanMethod.scanType = SCAN_TYPE_NO_SCAN; - break; - } -} - -VOID CuCmd_DisplayScanPolicy(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - S32 i; - - os_error_printf(CU_MSG_INFO2, (PS8)"Scan Policy:\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Normal scan interval: %d, deteriorating scan interval: %d\n", - pCuCmd->scanPolicy.normalScanInterval, pCuCmd->scanPolicy.deterioratingScanInterval); - os_error_printf(CU_MSG_INFO2, (PS8)"Max track attempt failures: %d\n", pCuCmd->scanPolicy.maxTrackFailures); - os_error_printf(CU_MSG_INFO2, (PS8)"BSS list size: %d, number of BSSes to start discovery: %d\n", - pCuCmd->scanPolicy.BSSListSize, pCuCmd->scanPolicy.BSSNumberToStartDiscovery); - os_error_printf(CU_MSG_INFO2, (PS8)"Number of configured bands: %d\n", pCuCmd->scanPolicy.numOfBands); - for ( i = 0; i < pCuCmd->scanPolicy.numOfBands; i++ ) - { - CuCmd_PrintScanBand(&(pCuCmd->scanPolicy.bandScanPolicy[ i ])); - } -} - -VOID CuCmd_ClearScanPolicy(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - - os_memset( &pCuCmd->scanPolicy, 0, sizeof(scan_Policy_t) ); - os_error_printf(CU_MSG_INFO2, (PS8)"Scan policy cleared.\n"); -} - -VOID CuCmd_SetScanPolicy(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - - if(OK != CuCommon_SetBuffer(pCuCmd->hCuCommon, TIWLN_802_11_SCAN_POLICY_PARAM_SET, - &pCuCmd->scanPolicy, sizeof(scan_Policy_t))) return; - os_error_printf(CU_MSG_INFO2, (PS8)"Scan policy stored.\n"); -} - -VOID CuCmd_GetScanBssList(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - bssList_t list; - S32 i; - - if(OK != CuCommon_GetSetBuffer(pCuCmd->hCuCommon, TIWLN_802_11_SCAN_BSS_LIST_GET, - &list, sizeof(bssList_t))) return; - - /* os_error_printf list */ - os_error_printf(CU_MSG_INFO2, (PS8)"BSS List:\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"%-17s %-7s %-6s %-4s %-10s\n", (PS8)"BSSID", (PS8)"Band", (PS8)"Channel", (PS8)"RSSI", (PS8)"Neighbor?"); - os_error_printf(CU_MSG_INFO2, (PS8)"-----------------------------------------------------\n"); - for ( i = 0; i < list.numOfEntries; i++ ) - { - os_error_printf(CU_MSG_INFO2, (PS8)"%02x.%02x.%02x.%02x.%02x.%02x %s %-7d %-4d %s\n", - list.BSSList[i].BSSID[0], list.BSSList[i].BSSID[1], list.BSSList[i].BSSID[2], list.BSSList[i].BSSID[3], list.BSSList[i].BSSID[4], list.BSSList[i].BSSID[5], - band2Str[ list.BSSList[ i ].band ].name, - list.BSSList[ i ].channel, list.BSSList[ i ].RSSI, - (TRUE == list.BSSList[ i ].bNeighborAP ? (PS8)"Yes" : (PS8)"No") ); - } -} - -VOID CuCmd_RoamingEnable(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - roamingMngrConfigParams_t roamingMngrConfigParams; - - if(OK != CuCommon_GetBuffer(pCuCmd->hCuCommon, ROAMING_MNGR_APPLICATION_CONFIGURATION, - &roamingMngrConfigParams, sizeof(roamingMngrConfigParams_t))) return; - roamingMngrConfigParams.roamingMngrConfig.enableDisable = ROAMING_ENABLED; - if(OK != CuCommon_SetBuffer(pCuCmd->hCuCommon, ROAMING_MNGR_APPLICATION_CONFIGURATION, - &roamingMngrConfigParams, sizeof(roamingMngrConfigParams_t)) ) return; - os_error_printf(CU_MSG_INFO2, (PS8)"Roaming is enabled \n"); -} - -VOID CuCmd_RoamingDisable(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - roamingMngrConfigParams_t roamingMngrConfigParams; - - if(OK != CuCommon_GetBuffer(pCuCmd->hCuCommon, ROAMING_MNGR_APPLICATION_CONFIGURATION, - &roamingMngrConfigParams, sizeof(roamingMngrConfigParams_t)) ) return; - roamingMngrConfigParams.roamingMngrConfig.enableDisable = ROAMING_DISABLED; - if(OK != CuCommon_SetBuffer (pCuCmd->hCuCommon, ROAMING_MNGR_APPLICATION_CONFIGURATION, - &roamingMngrConfigParams, sizeof(roamingMngrConfigParams_t)) ) return; - os_error_printf(CU_MSG_INFO2, (PS8)"Roaming is disabled \n"); -} - -VOID CuCmd_RoamingLowPassFilter(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - roamingMngrConfigParams_t roamingMngrConfigParams; - - if(OK != CuCommon_GetBuffer (pCuCmd->hCuCommon, ROAMING_MNGR_APPLICATION_CONFIGURATION, - &roamingMngrConfigParams, sizeof(roamingMngrConfigParams_t)) ) return; - if( nParms != 0 ) - { - roamingMngrConfigParams.roamingMngrConfig.lowPassFilterRoamingAttempt = (U16) parm[0].value; - if(OK != CuCommon_SetBuffer (pCuCmd->hCuCommon, ROAMING_MNGR_APPLICATION_CONFIGURATION, - &roamingMngrConfigParams, sizeof(roamingMngrConfigParams_t)) ) return; - } - os_error_printf(CU_MSG_INFO2, (PS8)"Time in sec to wait before low quality Roaming Triggers, \n lowPassFilterRoamingAttempt = %d sec\n", - roamingMngrConfigParams.roamingMngrConfig.lowPassFilterRoamingAttempt); -} - -VOID CuCmd_RoamingQualityIndicator(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - roamingMngrConfigParams_t roamingMngrConfigParams; - - if(OK != CuCommon_GetBuffer (pCuCmd->hCuCommon, ROAMING_MNGR_APPLICATION_CONFIGURATION, - &roamingMngrConfigParams, sizeof(roamingMngrConfigParams_t)) ) return; - if( nParms != 0 ) - { - roamingMngrConfigParams.roamingMngrConfig.apQualityThreshold = (S8) parm[0].value; - if(OK != CuCommon_SetBuffer (pCuCmd->hCuCommon, ROAMING_MNGR_APPLICATION_CONFIGURATION, - &roamingMngrConfigParams, sizeof(roamingMngrConfigParams_t)) ) return; - } - os_error_printf(CU_MSG_INFO2, (PS8)"Quality indicator (RSSI) to be used when comparing AP List matching quality, \n apQualityThreshold = %d \n", - (roamingMngrConfigParams.roamingMngrConfig.apQualityThreshold)); -} - -VOID CuCmd_RoamingDataRetryThreshold(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - roamingMngrConfigParams_t roamingMngrConfigParams; - - if(OK != CuCommon_GetBuffer (pCuCmd->hCuCommon, ROAMING_MNGR_APPLICATION_CONFIGURATION, - &roamingMngrConfigParams, sizeof(roamingMngrConfigParams_t)) ) return; - if( nParms != 0 ) - { - roamingMngrConfigParams.roamingMngrThresholdsConfig.dataRetryThreshold = (S8) parm[0].value; - if(OK != CuCommon_SetBuffer (pCuCmd->hCuCommon, ROAMING_MNGR_APPLICATION_CONFIGURATION, - &roamingMngrConfigParams, sizeof(roamingMngrConfigParams_t)) ) return; - } - os_error_printf(CU_MSG_INFO2, (PS8)"dataRetryThreshold = %d \n", - roamingMngrConfigParams.roamingMngrThresholdsConfig.dataRetryThreshold); - -} -VOID CuCmd_RoamingNumExpectedTbttForBSSLoss(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - roamingMngrConfigParams_t roamingMngrConfigParams; - - if(OK != CuCommon_GetBuffer (pCuCmd->hCuCommon, ROAMING_MNGR_APPLICATION_CONFIGURATION, - &roamingMngrConfigParams, sizeof(roamingMngrConfigParams_t)) ) return; - if( nParms != 0 ) - { - roamingMngrConfigParams.roamingMngrThresholdsConfig.numExpectedTbttForBSSLoss = (S8) parm[0].value; - if(OK != CuCommon_SetBuffer (pCuCmd->hCuCommon, ROAMING_MNGR_APPLICATION_CONFIGURATION, - &roamingMngrConfigParams, sizeof(roamingMngrConfigParams_t)) ) return; - } - os_error_printf(CU_MSG_INFO2, (PS8)"Number of expected TBTTs for BSS Loss event, \n numExpectedTbttForBSSLoss = %d \n", - roamingMngrConfigParams.roamingMngrThresholdsConfig.numExpectedTbttForBSSLoss); - -} -VOID CuCmd_RoamingTxRateThreshold(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - roamingMngrConfigParams_t roamingMngrConfigParams; - - if(OK != CuCommon_GetBuffer (pCuCmd->hCuCommon, ROAMING_MNGR_APPLICATION_CONFIGURATION, - &roamingMngrConfigParams, sizeof(roamingMngrConfigParams_t)) ) return; - if( nParms != 0 ) - { - roamingMngrConfigParams.roamingMngrThresholdsConfig.txRateThreshold = (S8 )parm[0].value; - if(OK != CuCommon_SetBuffer (pCuCmd->hCuCommon, ROAMING_MNGR_APPLICATION_CONFIGURATION, - &roamingMngrConfigParams, sizeof(roamingMngrConfigParams_t)) ) return; - } - os_error_printf(CU_MSG_INFO2, (PS8)"txRateThreshold = %d \n", - roamingMngrConfigParams.roamingMngrThresholdsConfig.txRateThreshold); - -} - -VOID CuCmd_RoamingLowRssiThreshold(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - roamingMngrConfigParams_t roamingMngrConfigParams; - - if(OK != CuCommon_GetBuffer (pCuCmd->hCuCommon, ROAMING_MNGR_APPLICATION_CONFIGURATION, - &roamingMngrConfigParams, sizeof(roamingMngrConfigParams_t)) ) return; - if( nParms != 0 ) - { - roamingMngrConfigParams.roamingMngrThresholdsConfig.lowRssiThreshold = (S8) parm[0].value; - if(OK != CuCommon_SetBuffer (pCuCmd->hCuCommon, ROAMING_MNGR_APPLICATION_CONFIGURATION, - &roamingMngrConfigParams, sizeof(roamingMngrConfigParams_t)) ) return; - } - os_error_printf(CU_MSG_INFO2, (PS8)"lowRssiThreshold = %d \n", - (roamingMngrConfigParams.roamingMngrThresholdsConfig.lowRssiThreshold)); - -} - -VOID CuCmd_RoamingLowSnrThreshold(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - roamingMngrConfigParams_t roamingMngrConfigParams; - - if(OK != CuCommon_GetBuffer (pCuCmd->hCuCommon, ROAMING_MNGR_APPLICATION_CONFIGURATION, - &roamingMngrConfigParams, sizeof(roamingMngrConfigParams_t)) ) return; - if( nParms != 0 ) - { - roamingMngrConfigParams.roamingMngrThresholdsConfig.lowSnrThreshold = (S8)parm[0].value; - if(OK != CuCommon_SetBuffer (pCuCmd->hCuCommon, ROAMING_MNGR_APPLICATION_CONFIGURATION, - &roamingMngrConfigParams, sizeof(roamingMngrConfigParams_t)) ) return; - } - os_error_printf(CU_MSG_INFO2, (PS8)"lowSnrThreshold = %d \n", roamingMngrConfigParams.roamingMngrThresholdsConfig.lowSnrThreshold); -} - -VOID CuCmd_RoamingLowQualityForBackgroungScanCondition(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - roamingMngrConfigParams_t roamingMngrConfigParams; - - if(OK != CuCommon_GetBuffer (pCuCmd->hCuCommon, ROAMING_MNGR_APPLICATION_CONFIGURATION, - &roamingMngrConfigParams, sizeof(roamingMngrConfigParams_t)) ) return; - if( nParms != 0 ) - { - roamingMngrConfigParams.roamingMngrThresholdsConfig.lowQualityForBackgroungScanCondition = (S8) parm[0].value; - if(OK != CuCommon_SetBuffer (pCuCmd->hCuCommon, ROAMING_MNGR_APPLICATION_CONFIGURATION, - &roamingMngrConfigParams, sizeof(roamingMngrConfigParams_t)) ) return; - } - os_error_printf(CU_MSG_INFO2, (PS8)"Indicator used to increase the background scan period when quality is low, \n lowQualityForBackgroungScanCondition = %d \n", - (roamingMngrConfigParams.roamingMngrThresholdsConfig.lowQualityForBackgroungScanCondition)); - -} - -VOID CuCmd_RoamingNormalQualityForBackgroungScanCondition(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - roamingMngrConfigParams_t roamingMngrConfigParams; - - if(OK != CuCommon_GetBuffer (pCuCmd->hCuCommon, ROAMING_MNGR_APPLICATION_CONFIGURATION, - &roamingMngrConfigParams, sizeof(roamingMngrConfigParams_t)) ) return; - if( nParms != 0 ) - { - roamingMngrConfigParams.roamingMngrThresholdsConfig.normalQualityForBackgroungScanCondition = (S8) parm[0].value; - if(OK != CuCommon_SetBuffer (pCuCmd->hCuCommon, ROAMING_MNGR_APPLICATION_CONFIGURATION, - &roamingMngrConfigParams, sizeof(roamingMngrConfigParams_t)) ) return; - } - os_error_printf(CU_MSG_INFO2, (PS8)"Indicator used to reduce the background scan period when quality is normal, \n normalQualityForBackgroungScanCondition = %d \n", - (roamingMngrConfigParams.roamingMngrThresholdsConfig.normalQualityForBackgroungScanCondition)); - -} - -VOID CuCmd_RoamingGetConfParams(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - roamingMngrConfigParams_t roamingMngrConfigParams; - - if(OK != CuCommon_GetBuffer (pCuCmd->hCuCommon, ROAMING_MNGR_APPLICATION_CONFIGURATION, - &roamingMngrConfigParams, sizeof(roamingMngrConfigParams_t)) ) return; - - os_error_printf(CU_MSG_INFO2, (PS8)"Roaming is: %s \n", roamingMngrConfigParams.roamingMngrConfig.enableDisable ? "Enabled" : "Disabled\n"); - os_error_printf(CU_MSG_INFO2, (PS8)" lowPassFilterRoamingAttempt = %d sec,\n apQualityThreshold = %d\n", - roamingMngrConfigParams.roamingMngrConfig.lowPassFilterRoamingAttempt, - roamingMngrConfigParams.roamingMngrConfig.apQualityThreshold); - os_error_printf(CU_MSG_INFO2, (PS8)" Roaming Triggers' thresholds are: \n"); - os_error_printf(CU_MSG_INFO2, (PS8)" dataRetryThreshold = %d,\n lowQualityForBackgroungScanCondition = %d,\n lowRssiThreshold = %d,\n lowSnrThreshold = %d,\n normalQualityForBackgroungScanCondition = %d,\n numExpectedTbttForBSSLoss = %d,\n txRateThreshold = %d \n", - roamingMngrConfigParams.roamingMngrThresholdsConfig.dataRetryThreshold, - roamingMngrConfigParams.roamingMngrThresholdsConfig.lowQualityForBackgroungScanCondition, - roamingMngrConfigParams.roamingMngrThresholdsConfig.lowRssiThreshold, - roamingMngrConfigParams.roamingMngrThresholdsConfig.lowSnrThreshold, - roamingMngrConfigParams.roamingMngrThresholdsConfig.normalQualityForBackgroungScanCondition, - roamingMngrConfigParams.roamingMngrThresholdsConfig.numExpectedTbttForBSSLoss, - roamingMngrConfigParams.roamingMngrThresholdsConfig.txRateThreshold); -} - -VOID CuCmd_CurrBssUserDefinedTrigger(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t *pCuCmd = (CuCmd_t*)hCuCmd; - TUserDefinedQualityTrigger userTrigger; - - if (nParms == 0) - return; - - userTrigger.uIndex = (U8)parm[0].value; - userTrigger.iThreshold = (U16)parm[1].value; - userTrigger.uPacing = (U16)parm[2].value; - userTrigger.uMetric = (U8)parm[3].value; - userTrigger.uType = (U8)parm[4].value; - userTrigger.uDirection = (U8)parm[5].value; - userTrigger.uHystersis = (U8)parm[6].value; - userTrigger.uEnable = (U8)parm[7].value; - - userTrigger.uClientID = 0; /* '0' means that external application with no clientId has registered for the event */ - - if (OK != CuCommon_SetBuffer (pCuCmd->hCuCommon, CURR_BSS_REGISTER_LINK_QUALITY_EVENT_PARAM, - &userTrigger, sizeof(TUserDefinedQualityTrigger)) ) - return; - - os_error_printf(CU_MSG_INFO2, (PS8)"CuCmd_RoamingUserDefinedTrigger: \n \ - index = %d, \n \ - threshold = %d, \n \ - pacing = %d, \n \ - metric = %d, \n \ - type = %d, \n \ - direction = %d, \n \ - hystersis = %d, \n \ - enable = %d \n", - userTrigger.uIndex, - userTrigger.iThreshold, - userTrigger.uPacing, - userTrigger.uMetric, - userTrigger.uType, - userTrigger.uDirection, - userTrigger.uHystersis, - userTrigger.uEnable); -} - -VOID CuCmd_AddTspec(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - OS_802_11_QOS_TSPEC_PARAMS TspecParams; - - TspecParams.uUserPriority = parm[0].value; - TspecParams.uNominalMSDUsize = parm[1].value; - TspecParams.uMeanDataRate = parm[2].value; - TspecParams.uMinimumPHYRate = parm[3].value * 1000 * 1000; - TspecParams.uSurplusBandwidthAllowance = parm[4].value << 13; - TspecParams.uAPSDFlag = parm[5].value; - TspecParams.uMinimumServiceInterval = parm[6].value; - TspecParams.uMaximumServiceInterval = parm[7].value; - - if(OK != CuCommon_SetBuffer(pCuCmd->hCuCommon, TIWLN_802_11_ADD_TSPEC, - &TspecParams, sizeof(OS_802_11_QOS_TSPEC_PARAMS))) return; - - os_error_printf(CU_MSG_INFO2, (PS8)"TSpec request sent to driver...\n uUserPriority = %d\n uNominalMSDUsize = %d\n uMeanDataRate = %d\n uMinimumPHYRate = %d\n uSurplusBandwidthAllowance = %d\n uAPSDFlag = %d uMinimumServiceInterval = %d uMaximumServiceInterval = %d\n", - parm[0].value, - parm[1].value, - parm[2].value, - parm[3].value, - parm[4].value, - parm[5].value, - parm[6].value, - parm[7].value); - -} - -VOID CuCmd_GetTspec(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - OS_802_11_QOS_TSPEC_PARAMS TspecParams; - - TspecParams.uUserPriority = parm[0].value; - - if(OK != CuCommon_GetSetBuffer(pCuCmd->hCuCommon, TIWLN_802_11_GET_TSPEC_PARAMS, - &TspecParams, sizeof(OS_802_11_QOS_TSPEC_PARAMS))) return; - - os_error_printf(CU_MSG_INFO2, (PS8)"TSpec parameters retrieved:\nuUserPriority = %d\nuNominalMSDUsize = %d\nuMeanDataRate = %d\nuMinimumPHYRate = %d\nuSurplusBandwidthAllowance = %d\nuUAPSD_Flag = %d\nuMinimumServiceInterval = %d\nuMaximumServiceInterval = %d\nuMediumTime = %d\n", - TspecParams.uUserPriority, - TspecParams.uNominalMSDUsize, - TspecParams.uMeanDataRate, - TspecParams.uMinimumPHYRate, - TspecParams.uSurplusBandwidthAllowance, - TspecParams.uAPSDFlag, - TspecParams.uMinimumServiceInterval, - TspecParams.uMaximumServiceInterval, - TspecParams.uMediumTime); -} - -VOID CuCmd_DeleteTspec(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - OS_802_11_QOS_DELETE_TSPEC_PARAMS TspecParams; - - TspecParams.uUserPriority = parm[0].value; - TspecParams.uReasonCode = parm[1].value; - - if(OK != CuCommon_SetBuffer(pCuCmd->hCuCommon, TIWLN_802_11_DELETE_TSPEC, - &TspecParams, sizeof(OS_802_11_QOS_TSPEC_PARAMS))) return; - - os_error_printf(CU_MSG_INFO2, (PS8)"TSPEC Delete request sent to driver...\n uUserPriority = %d\n uReasonCode = %d\n", - TspecParams.uUserPriority, - TspecParams.uReasonCode); -} - -VOID CuCmd_GetApQosParams(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - OS_802_11_AC_QOS_PARAMS AcQosParams; - S32 i = 0; - - /* test if we can get the AC QOS Params */ - AcQosParams.uAC = i; - if(OK != CuCommon_GetSetBuffer(pCuCmd->hCuCommon, TIWLN_802_11_GET_AP_QOS_PARAMS, - &AcQosParams, sizeof(AcQosParams))) return; - - os_error_printf(CU_MSG_INFO2, (PS8)"AP QOS Parameters:\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"+----+-------------+----------+-----------+-----------+-----------+\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"| AC | AdmCtrlFlag | AIFS | CwMin | CwMax | TXOPLimit |\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"+----+-------------+----------+-----------+-----------+-----------+\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"| %2d | %11d | %8d | %9d | %9d | %9d |\n", - i, - AcQosParams.uAssocAdmissionCtrlFlag, - AcQosParams.uAIFS, - AcQosParams.uCwMin, - AcQosParams.uCwMax, - AcQosParams.uTXOPLimit); - - for (i=1; i<4; i++) - { - AcQosParams.uAC = i; - if(OK != CuCommon_GetSetBuffer(pCuCmd->hCuCommon, TIWLN_802_11_GET_AP_QOS_PARAMS, - &AcQosParams, sizeof(AcQosParams))) return; - - os_error_printf(CU_MSG_INFO2, (PS8)"| %2d | %11d | %8d | %9d | %9d | %9d |\n", - i, - AcQosParams.uAssocAdmissionCtrlFlag, - AcQosParams.uAIFS, - AcQosParams.uCwMin, - AcQosParams.uCwMax, - AcQosParams.uTXOPLimit); - } - os_error_printf(CU_MSG_INFO2, (PS8)"+----+-------------+----------+-----------+-----------+-----------+\n"); -} - -VOID CuCmd_GetPsRxStreamingParams(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - TPsRxStreaming tPsRxStreaming; - S32 i = 0; - - os_error_printf(CU_MSG_INFO2, (PS8)"PS Rx Streaming Parameters:\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"+-----+--------------+------------+---------+\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"| TID | StreamPeriod | uTxTimeout | Enabled |\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"+-----+--------------+------------+---------+\n"); - - for (i=0; i<8; i++) - { - tPsRxStreaming.uTid = i; - if(OK != CuCommon_GetSetBuffer(pCuCmd->hCuCommon, QOS_MNGR_PS_RX_STREAMING, - &tPsRxStreaming, sizeof(TPsRxStreaming))) return; - - os_error_printf(CU_MSG_INFO2, (PS8)"| %3d | %12d | %10d | %7d |\n", - tPsRxStreaming.uTid, - tPsRxStreaming.uStreamPeriod, - tPsRxStreaming.uTxTimeout, - tPsRxStreaming.bEnabled); - } - os_error_printf(CU_MSG_INFO2, (PS8)"+-----+--------------+------------+---------+\n"); -} - -VOID CuCmd_GetApQosCapabilities(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - - OS_802_11_AP_QOS_CAPABILITIES_PARAMS ApQosCapabiltiesParams; - - if(OK != CuCommon_GetBuffer(pCuCmd->hCuCommon, TIWLN_802_11_GET_AP_QOS_CAPABILITIES, - &ApQosCapabiltiesParams, sizeof(OS_802_11_AP_QOS_CAPABILITIES_PARAMS))) return; - - os_error_printf(CU_MSG_INFO2, (PS8)"AP Qos Capabilities:\n QOSFlag = %d\n APSDFlag = %d\n", - ApQosCapabiltiesParams.uQOSFlag, - ApQosCapabiltiesParams.uAPSDFlag); - -} - -VOID CuCmd_GetAcStatus(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - OS_802_11_AC_UPSD_STATUS_PARAMS AcStatusParams; - - AcStatusParams.uAC = parm[0].value; - - if(OK != CuCommon_GetSetBuffer(pCuCmd->hCuCommon, TIWLN_802_11_GET_CURRENT_AC_STATUS, - &AcStatusParams, sizeof(OS_802_11_AC_UPSD_STATUS_PARAMS))) return; - - os_error_printf(CU_MSG_INFO2, (PS8)"AC %d Status:\n", AcStatusParams.uAC); - os_error_printf(CU_MSG_INFO2, (PS8)"PS Scheme = %d (0=LEGACY, 1=UPSD)\n", AcStatusParams.uCurrentUAPSDStatus); - os_error_printf(CU_MSG_INFO2, (PS8)"Admission Status = %d (0=NOT_ADMITTED, 1=WAIT_ADMISSION, 2=ADMITTED)\n", AcStatusParams.pCurrentAdmissionStatus); -} - -VOID CuCmd_ModifyMediumUsageTh(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - OS_802_11_THRESHOLD_CROSS_PARAMS ThCrossParams; - - if (nParms == 3) /* If user supplied 3 parameters - this is a SET operation */ - { - ThCrossParams.uAC = parm[0].value; - ThCrossParams.uHighThreshold = parm[1].value; - ThCrossParams.uLowThreshold = parm[2].value; - - if (ThCrossParams.uLowThreshold > ThCrossParams.uHighThreshold) - { - os_error_printf(CU_MSG_INFO2, (PS8)"Low threshold cannot be higher than the High threshold...Aborting...\n"); - return; - } - - if(OK != CuCommon_SetBuffer(pCuCmd->hCuCommon, TIWLN_802_11_SET_MEDIUM_USAGE_THRESHOLD, - &ThCrossParams, sizeof(OS_802_11_THRESHOLD_CROSS_PARAMS))) return; - - os_error_printf(CU_MSG_INFO2, (PS8)"Medium usage threshold for AC %d has been set to:\n LowThreshold = %d\n HighThreshold = %d\n", - ThCrossParams.uAC, - ThCrossParams.uLowThreshold, - ThCrossParams.uHighThreshold); - } - else if (nParms == 1) /* Only 1 parameter means a GET operation */ - { - ThCrossParams.uAC = parm[0].value; - ThCrossParams.uLowThreshold = 0; - ThCrossParams.uHighThreshold = 0; - - if(OK != CuCommon_GetSetBuffer(pCuCmd->hCuCommon, TIWLN_802_11_GET_MEDIUM_USAGE_THRESHOLD, - &ThCrossParams, sizeof(OS_802_11_THRESHOLD_CROSS_PARAMS))) return; - - os_error_printf(CU_MSG_INFO2, (PS8)"Medium usage threshold for AC %d:\n LowThreshold = %d\n HighThreshold = %d\n", - ThCrossParams.uAC, - ThCrossParams.uLowThreshold, - ThCrossParams.uHighThreshold); - } -} - - -VOID CuCmd_GetDesiredPsMode(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - OS_802_11_QOS_DESIRED_PS_MODE DesiredPsMode; - - if(OK != CuCommon_GetBuffer(pCuCmd->hCuCommon, TIWLN_802_11_GET_DESIRED_PS_MODE, - &DesiredPsMode, sizeof(OS_802_11_QOS_DESIRED_PS_MODE))) return; - - os_error_printf(CU_MSG_INFO2, (PS8)"Desired PS Mode (0=PS_POLL, 1=UPSD, 2=PS_NONE):\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"===============================================\n"); - os_error_printf(CU_MSG_INFO2, (PS8)" +-----------+------+\n"); - os_error_printf(CU_MSG_INFO2, (PS8)" | AC | Mode |\n"); - os_error_printf(CU_MSG_INFO2, (PS8)" +-----------+------+\n"); - os_error_printf(CU_MSG_INFO2, (PS8)" | General | %d |\n", DesiredPsMode.uDesiredPsMode); - os_error_printf(CU_MSG_INFO2, (PS8)" | BE_AC | %d |\n", DesiredPsMode.uDesiredWmeAcPsMode[QOS_AC_BE]); - os_error_printf(CU_MSG_INFO2, (PS8)" | BK_AC | %d |\n", DesiredPsMode.uDesiredWmeAcPsMode[QOS_AC_BK]); - os_error_printf(CU_MSG_INFO2, (PS8)" | VI_AC | %d |\n", DesiredPsMode.uDesiredWmeAcPsMode[QOS_AC_VI]); - os_error_printf(CU_MSG_INFO2, (PS8)" | VO_AC | %d |\n", DesiredPsMode.uDesiredWmeAcPsMode[QOS_AC_VO]); - os_error_printf(CU_MSG_INFO2, (PS8)" +-----------+------+\n"); -} - - -VOID CuCmd_InsertClsfrEntry(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - clsfr_tableEntry_t newUserTableEntry; - S32 i; - - if (nParms >=2) - newUserTableEntry.DTag = (U8) parm[1].value; - - switch(parm[0].value) - { - case D_TAG_CLSFR: - os_error_printf(CU_MSG_INFO2, (PS8)"Cannot insert D_TAG classifier entry!\n"); - return; - case DSCP_CLSFR: - if (nParms != 3) - { - os_error_printf(CU_MSG_INFO2, (PS8)"DSCP_CLSFR Entry type, wrong number of parameters(too many?)\n"); - return; - } - newUserTableEntry.Dscp.CodePoint = (U8) parm[2].value; - os_error_printf(CU_MSG_INFO2, (PS8)"Inserting new DSCP_CLSFR classifier entry\nD-Tag = %d\nCodePoint = %d\n",newUserTableEntry.DTag,newUserTableEntry.Dscp.CodePoint); - break; - case PORT_CLSFR: - if (nParms != 3) - { - os_error_printf(CU_MSG_INFO2, (PS8)"PORT_CLSFR Entry type, wrong number of parameters(too many?)\n"); - return; - } - newUserTableEntry.Dscp.DstPortNum = (U16) parm[2].value; - os_error_printf(CU_MSG_INFO2, (PS8)"Inserting new PORT_CLSFR classifier entry\nD-Tag = %d\nPort = %d\n",newUserTableEntry.DTag,newUserTableEntry.Dscp.DstPortNum); - break; - case IPPORT_CLSFR: - if (nParms != 7) - { - os_error_printf(CU_MSG_INFO2, (PS8)"PORT_CLSFR Entry type, wrong number of parameters\n"); - return; - } - newUserTableEntry.Dscp.DstIPPort.DstPortNum = (U16) parm[2].value; - newUserTableEntry.Dscp.DstIPPort.DstIPAddress = 0; - for(i=0; i<4; i++) - { - newUserTableEntry.Dscp.DstIPPort.DstIPAddress |= parm[i+3].value << i * 8; - } - os_error_printf(CU_MSG_INFO2, (PS8)"Inserting new IPPORT_CLSFR classifier entry\nD-Tag = %d\nPort = %d\nIP = %3d.%d.%d.%d\n", - newUserTableEntry.DTag, - newUserTableEntry.Dscp.DstIPPort.DstPortNum, - (S32)parm[3].value,(S32)parm[4].value,(S32)parm[5].value,(S32)parm[6].value); - break; - default: - os_error_printf(CU_MSG_INFO2, (PS8)"Unknown Classifier Type - Command aborted!\n"); - return; - } - - if(CuCommon_SetBuffer(pCuCmd->hCuCommon, TIWLN_802_11_CONFIG_TX_CLASS, - &newUserTableEntry, sizeof(clsfr_tableEntry_t))) - { - os_error_printf(CU_MSG_INFO2, (PS8)"Failed to insert new classifier entry...\n"); - } -} - -VOID CuCmd_RemoveClsfrEntry(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - clsfr_tableEntry_t newUserTableEntry; - S32 i; - - if (nParms >=2) - newUserTableEntry.DTag = (U8) parm[1].value; - - switch(parm[0].value) - { - case D_TAG_CLSFR: - os_error_printf(CU_MSG_INFO2, (PS8)"Cannot remove D_TAG classifier entry!\n"); - return; - case DSCP_CLSFR: - if (nParms != 3) - { - os_error_printf(CU_MSG_INFO2, (PS8)"DSCP_CLSFR Entry type, wrong number of parameters(too many?)\n"); - return; - } - newUserTableEntry.Dscp.CodePoint = (U8) parm[2].value; - os_error_printf(CU_MSG_INFO2, (PS8)"Removing DSCP_CLSFR classifier entry\nD-Tag = %d\nCodePoint = %d\n",newUserTableEntry.DTag,newUserTableEntry.Dscp.CodePoint); - break; - case PORT_CLSFR: - if (nParms != 3) - { - os_error_printf(CU_MSG_INFO2, (PS8)"PORT_CLSFR Entry type, wrong number of parameters(too many?)\n"); - return; - } - newUserTableEntry.Dscp.DstPortNum = (U16) parm[2].value; - os_error_printf(CU_MSG_INFO2, (PS8)"Removing PORT_CLSFR classifier entry\nD-Tag = %d\nPort = %d\n",newUserTableEntry.DTag,newUserTableEntry.Dscp.DstPortNum); - break; - case IPPORT_CLSFR: - if (nParms != 7) - { - os_error_printf(CU_MSG_INFO2, (PS8)"PORT_CLSFR Entry type, wrong number of parameters\n"); - return; - } - newUserTableEntry.Dscp.DstIPPort.DstPortNum = (U16) parm[2].value; - newUserTableEntry.Dscp.DstIPPort.DstIPAddress = 0; - for(i=0; i<4; i++) - { - newUserTableEntry.Dscp.DstIPPort.DstIPAddress |= parm[i+3].value << i * 8; - } - os_error_printf(CU_MSG_INFO2, (PS8)"Removing IPPORT_CLSFR classifier entry\nD-Tag = %d\nPort = %d\nIP = %3d.%d.%d.%d\n", - newUserTableEntry.DTag, - newUserTableEntry.Dscp.DstIPPort.DstPortNum, - (S32)parm[3].value,(S32)parm[4].value,(S32)parm[5].value,(S32)parm[6].value); - break; - default: - os_error_printf(CU_MSG_INFO2, (PS8)"Unknown Classifier Type - Command aborted!\n"); - return; - break; - } - - if(CuCommon_SetBuffer(pCuCmd->hCuCommon, TIWLN_802_11_REMOVE_CLSFR_ENTRY, - &newUserTableEntry, sizeof(clsfr_tableEntry_t))) - { - os_error_printf(CU_MSG_INFO2, (PS8)"Failed to remove classifier entry...\n"); - } -} - - -VOID CuCmd_SetPsRxDelivery(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - TPsRxStreaming tPsRxStreaming; - - tPsRxStreaming.uTid = parm[0].value; - tPsRxStreaming.uStreamPeriod = parm[1].value; - tPsRxStreaming.uTxTimeout = parm[2].value; - tPsRxStreaming.bEnabled = parm[3].value; - - if (CuCommon_SetBuffer(pCuCmd->hCuCommon, QOS_MNGR_PS_RX_STREAMING, - &tPsRxStreaming, sizeof(TPsRxStreaming)) == OK) - { - os_error_printf(CU_MSG_INFO2, (PS8)"Sent PS Rx Delivery to driver..."); - } - else - { - os_error_printf(CU_MSG_INFO2, (PS8)"Error: could not set PS Rx Delivery in driver...\n"); - } - os_error_printf(CU_MSG_INFO2, - (PS8)"TID = %d \n RxPeriod = %d \n TxTimeout = %d\n Enabled = %d\n", - tPsRxStreaming.uTid, - tPsRxStreaming.uStreamPeriod, - tPsRxStreaming.uTxTimeout, - tPsRxStreaming.bEnabled); -} - - -VOID CuCmd_SetQosParams(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - OS_802_11_QOS_PARAMS QosParams; - - QosParams.acID=parm[0].value; - QosParams.MaxLifeTime=parm[1].value; - QosParams.PSDeliveryProtocol = parm[2].value; - - if (CuCommon_SetBuffer(pCuCmd->hCuCommon, TIWLN_802_11_SET_QOS_PARAMS, - &QosParams, sizeof(OS_802_11_QOS_PARAMS)) == OK) - { - os_error_printf(CU_MSG_INFO2, (PS8)"Sent QOS params to driver...\n AC Number=%d \n MaxLifeTime=%d \n PSDeliveryProtocol = %d\n", - QosParams.acID, - QosParams.MaxLifeTime, - QosParams.PSDeliveryProtocol); - } - else - { - os_error_printf(CU_MSG_INFO2, (PS8)"Error: could not set QOS params...\n"); - } -} - -VOID CuCmd_SetRxTimeOut(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - OS_802_11_QOS_RX_TIMEOUT_PARAMS rxTimeOut; - - rxTimeOut.psPoll = parm[0].value; - rxTimeOut.UPSD = parm[1].value; - - if (nParms != 2) - { - os_error_printf(CU_MSG_INFO2, (PS8)"Please enter Rx Time Out:\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 0 - psPoll (0 - 65000)\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 1 - UPSD (1 - 65000)\n"); - } - else - { - if(CuCommon_SetBuffer(pCuCmd->hCuCommon, TIWLN_802_11_SET_RX_TIMEOUT, - &rxTimeOut, sizeof(OS_802_11_QOS_RX_TIMEOUT_PARAMS)) == OK) - { - os_error_printf(CU_MSG_INFO2, (PS8)"Sent QOS Rx TimeOut params to driver...\n PsPoll = %d\n UPSD = %d\n", - rxTimeOut.psPoll, - rxTimeOut.UPSD); - } - else - { - os_error_printf(CU_MSG_INFO2, (PS8)"Error: could not set Rx TimeOut..\n"); - } - } -} - -VOID CuCmd_RegisterEvents(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - - if( nParms ) - { - U32 event; - S32 res, i; - - event = (U32)parm[0].value; - - CU_CMD_FIND_NAME_ARRAY(i, event_type, event); - if(i == SIZE_ARR(event_type)) - { - os_error_printf(CU_MSG_INFO2, (PS8)"CuCmd_RegisterEvents, event %d is not defined!\n", event); - return; - } - - res = IpcEvent_EnableEvent(pCuCmd->hIpcEvent, event); - if (res == EOALERR_IPC_EVENT_ERROR_EVENT_ALREADY_ENABLED) - { - CU_CMD_FIND_NAME_ARRAY(i, event_type, event); - os_error_printf(CU_MSG_INFO2, (PS8)"CuCmd_RegisterEvents, event %s is already enabled!\n", event_type[i].name); - return; - } - - } - else - { - print_available_values(event_type); - } -} - -VOID CuCmd_UnregisterEvents(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - - if( nParms ) - { - U32 event; - S32 res, i; - - event = (U32)parm[0].value; - - CU_CMD_FIND_NAME_ARRAY(i, event_type, event); - if(i == SIZE_ARR(event_type)) - { - os_error_printf(CU_MSG_INFO2, (PS8)"CuCmd_RegisterEvents, event %d is not defined!\n", event); - return; - } - - res = IpcEvent_DisableEvent(pCuCmd->hIpcEvent, event); - if (res == EOALERR_IPC_EVENT_ERROR_EVENT_ALREADY_DISABLED) - { - CU_CMD_FIND_NAME_ARRAY(i, event_type, event); - os_error_printf(CU_MSG_INFO2, (PS8)"CuCmd_RegisterEvents, event %s is already disabled!\n", event_type[i].name); - return; - } - - } - else - { - print_available_values(event_type); - } -} - -VOID CuCmd_EnableBtCoe(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - ESoftGeminiEnableModes BtMode; - S32 i; - - named_value_t BtCoe_Mode[] = - { - { SG_DISABLE, (PS8)"Disable" }, - { SG_PROTECTIVE, (PS8)"Protective" }, - { SG_OPPORTUNISTIC, (PS8)"Opportunistic" }, - }; - - - if(nParms) - { - CU_CMD_FIND_NAME_ARRAY(i, BtCoe_Mode, parm[0].value); - if(i == SIZE_ARR(BtCoe_Mode)) - { - os_error_printf(CU_MSG_INFO2, (PS8)"CuCmd_EnableBtCoe, mode %d is not defined!\n", parm[0].value); - return; - } - BtMode = parm[0].value; - CuCommon_SetU32(pCuCmd->hCuCommon, SOFT_GEMINI_SET_ENABLE, BtMode); - } - else - { - print_available_values(BtCoe_Mode); - } -} - -VOID CuCmd_ConfigBtCoe(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - U32 Values[NUM_OF_CONFIG_PARAMS_IN_SG]; - U8 Index; - - if( nParms != NUM_OF_CONFIG_PARAMS_IN_SG ) - { - os_error_printf(CU_MSG_INFO2, (PS8)"Please enter <index (0,1..)> <value> \n"); - - os_error_printf(CU_MSG_INFO2, (PS8)"Param 0 - coexBtPerThreshold (0 - 10000000) PER threshold in PPM of the BT voice \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 1 - coexAutoScanCompensationMaxTime (0 - 10000000 usec) \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 2 - coexBtNfsSampleInterval (1 - 65000 msec) \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 3 - coexBtLoadRatio (0 - 100 %) \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 4 - coexAutoPsMode (0 = Disabled, 1 = Enabled) Auto Power Save \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 5 - coexHv3AutoScanEnlargedNumOfProbeReqPercent (%) \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 6 - coexHv3AutoScanEnlargedScanWinodowPercent (%) \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 7 - coexAntennaConfiguration (0 = Single, 1 = Dual)\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 8 - coexMaxConsecutiveBeaconMissPrecent (1 - 100 %) \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 9 - coexAPRateAdapationThr - rates (1 - 54)\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 10 - coexAPRateAdapationSnr (-128 - 127)\n"); - - os_error_printf(CU_MSG_INFO2, (PS8)"Param 11 - coexWlanPsBtAclMasterMinBR (msec) \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 12 - coexWlanPsBtAclMasterMaxBR (msec) \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 13 - coexWlanPsMaxBtAclMasterBR (msec) \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 14 - coexWlanPsBtAclSlaveMinBR (msec) \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 15 - coexWlanPsBtAclSlaveMaxBR (msec) \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 16 - coexWlanPsMaxBtAclSlaveBR (msec) \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 17 - coexWlanPsBtAclMasterMinEDR (msec) \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 18 - coexWlanPsBtAclMasterMaxEDR (msec) \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 19 - coexWlanPsMaxBtAclMasterEDR (msec) \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 20 - coexWlanPsBtAclSlaveMinEDR (msec) \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 21 - coexWlanPsBtAclSlaveMaxEDR (msec) \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 22 - coexWlanPsMaxBtAclSlaveEDR (msec) \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 23 - coexRxt (usec) \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 24 - coexTxt (usec) \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 25 - coexAdaptiveRxtTxt (0 = Disable, 1 = Enable) \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 26 - coexPsPollTimeout (msec) \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 27 - coexUpsdTimeout (msec) \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 28 - coexWlanActiveBtAclMasterMinEDR (msec) \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 29 - coexWlanActiveBtAclMasterMaxEDR (msec) \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 30 - coexWlanActiveMaxBtAclMasterEDR (msec) \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 31 - coexWlanActiveBtAclSlaveMinEDR (msec) \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 32 - coexWlanActiveBtAclSlaveMaxEDR (msec) \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 33 - coexWlanActiveMaxBtAclSlaveEDR (msec) \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 34 - coexWlanActiveBtAclMinBR (msec) \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 35 - coexWlanActiveBtAclMaxBR (msec) \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 36 - coexWlanActiveMaxBtAclBR (msec) \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 37 - coexHv3AutoEnlargePassiveScanWindowPercent \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 38 - coexA2DPAutoEnlargePassiveScanWindowPercent \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 39 - coexPassiveScanBtTime (msec) \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 40 - coexPassiveScanWlanTime (msec)\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 41 - coexTempParam5 \n"); - - return; - } - if ((parm[0].value == SOFT_GEMINI_RATE_ADAPT_THRESH) && (CuCmd_IsValueRate(parm[1].value) == FALSE)) - { - os_error_printf(CU_MSG_INFO2, (PS8)"Invalid rate - PHY rate valid values are: 1,2,5,6,9,11,12,18,24,36,48,54\n"); - } - else - { - for (Index = 0; Index < NUM_OF_CONFIG_PARAMS_IN_SG; Index++ ) - { - Values[Index] = parm[Index].value; -/* value[0] - parmater index, value[1] - parameter value */ - } - CuCommon_SetBuffer(pCuCmd->hCuCommon, SOFT_GEMINI_SET_CONFIG, Values, sizeof(Values)); - } -} - -VOID CuCmd_GetBtCoeStatus(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - U32 uDummyBuf; - - if(OK != CuCommon_GetBuffer(pCuCmd->hCuCommon, SOFT_GEMINI_GET_CONFIG, - &uDummyBuf, sizeof(U32))) - { - return; - } -} - -VOID CuCmd_ConfigCoexActivity(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - TCoexActivity tCoexActivity; - - if( nParms != NUM_OF_COEX_ACTIVITY_PARAMS_IN_SG ) - { - os_error_printf(CU_MSG_INFO2, (PS8)"Param 1 - coexIp (0 - 1) BT-0, WLAN-1 \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 2 - activityId (0 - 24) \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 3 - defaultPriority (0 - 255) \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 4 - raisedPriority (0 - 255) \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 5 - minService (0 - 65535) \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 6 - maxService (0 - 65535) \n"); - } - else - { - tCoexActivity.coexIp = (U8)parm[0].value; - tCoexActivity.activityId = (U8)parm[1].value; - tCoexActivity.defaultPriority = (U8)parm[2].value; - tCoexActivity.raisedPriority = (U8)parm[3].value; - tCoexActivity.minService = (U16)parm[4].value; - tCoexActivity.maxService = (U16)parm[5].value; - - CuCommon_SetBuffer(pCuCmd->hCuCommon, TWD_COEX_ACTIVITY_PARAM, - &tCoexActivity, sizeof(tCoexActivity)); - } -} - -VOID CuCmd_ConfigFmCoex(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - TFmCoexParams tFmCoexParams; - - if (nParms != 10) - { - os_error_printf(CU_MSG_INFO2, (PS8)"1 - Enable (0 - 1) \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"2 - SwallowPeriod (0 - 255) \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"3 - NDividerFrefSet1 (0 - 255) \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"4 - NDividerFrefSet2 (0 - 255) \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"5 - MDividerFrefSet1 (0 - 65535) \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"6 - MDividerFrefSet2 (0 - 65535) \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"7 - CoexPllStabilizationTime (0 - 4294967295) \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"8 - LdoStabilizationTime (0 - 65535) \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"9 - FmDisturbedBandMargin (0 - 255) \n"); - os_error_printf(CU_MSG_INFO2, (PS8)"10- SwallowClkDif (0 - 255) \n"); - } - else - { - tFmCoexParams.uEnable = (TI_UINT8)parm[0].value; - tFmCoexParams.uSwallowPeriod = (TI_UINT8)parm[1].value; - tFmCoexParams.uNDividerFrefSet1 = (TI_UINT8)parm[2].value; - tFmCoexParams.uNDividerFrefSet2 = (TI_UINT8)parm[3].value; - tFmCoexParams.uMDividerFrefSet1 = (TI_UINT16)parm[4].value; - tFmCoexParams.uMDividerFrefSet2 = (TI_UINT16)parm[5].value; - tFmCoexParams.uCoexPllStabilizationTime = parm[6].value; - tFmCoexParams.uLdoStabilizationTime = (TI_UINT16)parm[7].value; - tFmCoexParams.uFmDisturbedBandMargin = (TI_UINT8)parm[8].value; - tFmCoexParams.uSwallowClkDif = (TI_UINT8)parm[9].value; - - CuCommon_SetBuffer(pCuCmd->hCuCommon, TWD_FM_COEX_PARAM, &tFmCoexParams, sizeof(TFmCoexParams)); - } -} - -VOID CuCmd_SetPowerMode(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - TPowerMgr_PowerMode Mode; - S32 i; - - if( nParms ) - { - CU_CMD_FIND_NAME_ARRAY(i, power_mode_val, parm[0].value); - if(i == SIZE_ARR(power_mode_val)) - { - os_error_printf(CU_MSG_INFO2, (PS8)"CuCmd_SetPowerMode, mode %d is not defined!\n", parm[0].value); - return; - } - Mode.PowerMode = parm[0].value; - Mode.PowerMngPriority = POWER_MANAGER_USER_PRIORITY; - CuCommon_SetBuffer(pCuCmd->hCuCommon, TIWLN_802_11_POWER_MODE_SET, - &Mode, sizeof(TPowerMgr_PowerMode)); - } - else - { - if(!CuCommon_GetBuffer(pCuCmd->hCuCommon, TIWLN_802_11_POWER_MODE_GET, &Mode, sizeof(TPowerMgr_PowerMode))) - { - os_error_printf(CU_MSG_INFO2, (PS8)"Power mode: %d\n", Mode.PowerMode); - print_available_values(power_mode_val); - } - } -} - -VOID CuCmd_SetPowerSavePowerLevel(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - U32 PowerSavePowerLevel; - S32 i; - - if( nParms ) - { - CU_CMD_FIND_NAME_ARRAY(i, power_level, parm[0].value); - if(i == SIZE_ARR(power_level)) - { - os_error_printf(CU_MSG_INFO2, (PS8)"CuCmd_SetPowerSavePowerLevel, level %d is not defined!\n", parm[0].value); - return; - } - PowerSavePowerLevel = parm[0].value; - CuCommon_SetU32(pCuCmd->hCuCommon, TIWLN_802_11_POWER_LEVEL_PS_SET, PowerSavePowerLevel); - } - else - { - if(!CuCommon_GetU32(pCuCmd->hCuCommon, TIWLN_802_11_POWER_LEVEL_PS_GET, &PowerSavePowerLevel)) - { - CU_CMD_FIND_NAME_ARRAY(i, power_level, PowerSavePowerLevel); - os_error_printf(CU_MSG_INFO2, (PS8)"Power Level PowerSave is: %s\n", power_level[i].name); - print_available_values(power_level); - } - } -} - -VOID CuCmd_SetDefaultPowerLevel(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - U32 DefaultPowerLevel; - S32 i; - - if( nParms ) - { - CU_CMD_FIND_NAME_ARRAY(i, power_level, parm[0].value); - if(i == SIZE_ARR(power_level)) - { - os_error_printf(CU_MSG_INFO2, (PS8)"CuCmd_SetDefaultPowerLevel, level %d is not defined!\n", parm[0].value); - return; - } - DefaultPowerLevel = parm[0].value; - CuCommon_SetU32(pCuCmd->hCuCommon, TIWLN_802_11_POWER_LEVEL_DEFAULT_SET, DefaultPowerLevel); - } - else - { - if(!CuCommon_GetU32(pCuCmd->hCuCommon, TIWLN_802_11_POWER_LEVEL_DEFAULT_GET, &DefaultPowerLevel)) - { - CU_CMD_FIND_NAME_ARRAY(i, power_level, DefaultPowerLevel); - os_error_printf(CU_MSG_INFO2, (PS8)"Power Level Default is: %s\n", power_level[i].name); - print_available_values(power_level); - } - } -} - -VOID CuCmd_SetDozeModeInAutoPowerLevel(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - U32 DozeModeInAutoPowerLevel; - S32 i; - - if( nParms ) - { - DozeModeInAutoPowerLevel = parm[0].value; - - if((DozeModeInAutoPowerLevel > AUTO_POWER_MODE_DOZE_MODE_MAX_VALUE) || (DozeModeInAutoPowerLevel < AUTO_POWER_MODE_DOZE_MODE_MIN_VALUE)) - { - os_error_printf(CU_MSG_INFO2, (PS8)"CuCmd_SetDozeModeInAutoPowerLevel, level %d is not defined!\n", DozeModeInAutoPowerLevel); - return; - } - CuCommon_SetU32(pCuCmd->hCuCommon, TIWLN_802_11_POWER_LEVEL_DOZE_MODE_SET, DozeModeInAutoPowerLevel); - } - else - { - /* set Short or Long Doze. no use of other parameters */ - if(!CuCommon_GetU32(pCuCmd->hCuCommon, TIWLN_802_11_POWER_LEVEL_DOZE_MODE_GET, &DozeModeInAutoPowerLevel)) - { - CU_CMD_FIND_NAME_ARRAY(i, power_mode_val, DozeModeInAutoPowerLevel); - os_error_printf(CU_MSG_INFO2, (PS8)"Doze power level in auto mode is: %s\n", power_mode_val[i].name); - } - } -} - -VOID CuCmd_SetTrafficIntensityTh(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - OS_802_11_TRAFFIC_INTENSITY_THRESHOLD_PARAMS TrafficIntensityTh; - - if (nParms == 3) - { - TrafficIntensityTh.uHighThreshold = parm[0].value; - TrafficIntensityTh.uLowThreshold = parm[1].value; - TrafficIntensityTh.TestInterval = parm[2].value; - - if (TrafficIntensityTh.uLowThreshold >= TrafficIntensityTh.uHighThreshold) - { - os_error_printf(CU_MSG_ERROR, (PS8)"Error - CuCmd_SetTrafficIntensityTh - low threshold equal or greater than the high threshold...aborting...\n"); - } - - if(OK == CuCommon_SetBuffer(pCuCmd->hCuCommon, TIWLN_802_11_SET_TRAFFIC_INTENSITY_THRESHOLDS, - &TrafficIntensityTh, sizeof(OS_802_11_TRAFFIC_INTENSITY_THRESHOLD_PARAMS))) - { - os_error_printf(CU_MSG_INFO2, (PS8)"Successfully set traffic intensity thresholds...\n"); - } - else - { - os_error_printf(CU_MSG_ERROR, (PS8)"Error - CuCmd_SetTrafficIntensityTh - cannot set thresholds\n"); - } - } - else if (nParms == 0) - { - if(OK == CuCommon_GetBuffer(pCuCmd->hCuCommon, TIWLN_802_11_GET_TRAFFIC_INTENSITY_THRESHOLDS, - &TrafficIntensityTh, sizeof(OS_802_11_TRAFFIC_INTENSITY_THRESHOLD_PARAMS))) - { - os_error_printf(CU_MSG_INFO2, (PS8)"Traffic intensity thresholds :\n HighThreshold = %d\n LowThreshold = %d\n TestInterval = %d\n", - TrafficIntensityTh.uHighThreshold, - TrafficIntensityTh.uLowThreshold, - TrafficIntensityTh.TestInterval); - } - else - { - os_error_printf (CU_MSG_ERROR, (PS8)"Error - CuCmd_SetTrafficIntensityTh - cannot get thresholds\n"); - } - } -} - -VOID CuCmd_EnableTrafficEvents(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - if(OK != CuCommon_SetU32(pCuCmd->hCuCommon, TIWLN_802_11_TOGGLE_TRAFFIC_INTENSITY_EVENTS, TRUE) ) return; - os_error_printf(CU_MSG_INFO2, (PS8)"Traffic intensity thresholds enabled...\n"); -} - -VOID CuCmd_DisableTrafficEvents(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - if(OK != CuCommon_SetU32(pCuCmd->hCuCommon, TIWLN_802_11_TOGGLE_TRAFFIC_INTENSITY_EVENTS, FALSE) ) return; - os_error_printf(CU_MSG_INFO2, (PS8)"Traffic intensity thresholds disabled...\n"); -} - -VOID CuCmd_SetDcoItrimParams(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - DcoItrimParams_t dcoItrimParams; - - if (nParms == 0) - { - if (OK == CuCommon_GetBuffer(pCuCmd->hCuCommon, TIWLN_DCO_ITRIM_PARAMS, &dcoItrimParams, sizeof(DcoItrimParams_t))) - { - os_error_printf(CU_MSG_INFO2, (PS8)"DCO Itrim Params :\n enable = %d\n moderationTimeoutUsec = %d\n", - dcoItrimParams.enable, dcoItrimParams.moderationTimeoutUsec); - } - else - { - os_error_printf (CU_MSG_ERROR, (PS8)"Error - CuCmd_SetDcoItrimParams - cannot get DCO Itrim Params\n"); - } - } - - else - { - dcoItrimParams.enable = (Bool_e)parm[0].value; - dcoItrimParams.moderationTimeoutUsec = parm[1].value; - - if (OK == CuCommon_SetBuffer(pCuCmd->hCuCommon, TIWLN_DCO_ITRIM_PARAMS, &dcoItrimParams, sizeof(DcoItrimParams_t))) - { - os_error_printf(CU_MSG_INFO2, (PS8)"Successfully set DCO Itrim Params...\n"); - } - else - { - os_error_printf(CU_MSG_ERROR, (PS8)"Error - CuCmd_SetDcoItrimParams - cannot set DCO Itrim Params\n"); - } - } -} - -VOID CuCmd_LogAddReport(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - U8 ModuleTable[REPORT_FILES_NUM], ModuleValue[REPORT_FILES_NUM] = {0}; - int index = 0; - - os_memcpy((THandle)ModuleValue, (THandle)(parm[0].value), nParms); - - for (index = 0; index < REPORT_FILES_NUM; index ++) - { - if (ModuleValue[index] == '1') - { - ModuleTable[index] = '1'; - } - else - { - ModuleTable[index] = '0'; - } - } - CuCommon_SetBuffer(pCuCmd->hCuCommon, REPORT_MODULE_TABLE_PARAM, ModuleTable, REPORT_FILES_NUM); -} - -VOID CuCmd_LogReportSeverityLevel(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - U8 SeverityTable[REPORT_SEVERITY_MAX]; - S32 index = 0; - PS8 SeverityValue = (PS8)(parm[0].value); - - /* Get the current report severity */ - if (!CuCommon_GetBuffer(pCuCmd->hCuCommon, REPORT_SEVERITY_TABLE_PARAM, SeverityTable, REPORT_SEVERITY_MAX)) - { - if(nParms == 0) - { - S32 i; - - os_error_printf(CU_MSG_INFO2, (PS8)"Severity:\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"-------------------------------\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"%14s\tState\t%s\n", (PS8)"Severity level", (PS8)"Desc"); - - for( i=1; i<SIZE_ARR(report_severity); i++ ) - { - os_error_printf(CU_MSG_INFO2, (PS8)"%d\t%c\t%s\n", report_severity[i].value, (SeverityTable[i] == '1') ? '+' : ' ', report_severity[i].name ); - } - - os_error_printf(CU_MSG_INFO2, (PS8)"* Use '0' to clear all table.\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"* Use '%d' (max index) to set all table.\n", REPORT_SEVERITY_MAX); - } - else - { - for (index = 0; index < REPORT_SEVERITY_MAX; index ++) - { - if (SeverityValue[index] == '0') - { - SeverityTable[index] = '0'; - } - else - { - SeverityTable[index] = '1'; - } - } - CuCommon_SetBuffer(pCuCmd->hCuCommon, REPORT_SEVERITY_TABLE_PARAM, SeverityTable, REPORT_SEVERITY_MAX); - } - } - else - { - os_error_printf(CU_MSG_ERROR, (PS8)"Error retriving the severity table from the driver\n"); - } -} - -VOID CuCmd_SetReport(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - U8 *pModuleTable = (U8 *)parm[0].value; - - if( nParms != 1) - { - U8 ModuleTable[REPORT_FILES_NUM]; - S32 i; - - if (!CuCommon_GetBuffer(pCuCmd->hCuCommon, TIWLN_REPORT_MODULE_GET, ModuleTable, REPORT_FILES_NUM)) - { - os_error_printf(CU_MSG_INFO2, (PS8)"-------------------------------\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"%.5s\tState\t %s\n", (PS8)"Index", (PS8)"Desc"); - - for( i = 0; i < SIZE_ARR(report_module); i++) - { - /* Check if there is string content (the first character is not ZERO) */ - if( report_module[i].name[0] ) - { - U8 module_num = (U8) report_module[i].value; - os_error_printf(CU_MSG_INFO2, (PS8)"%3d\t%c\t%s\n", - module_num, - (ModuleTable[module_num] == '1') ? '+' : ' ', - report_module[i].name ); - } - } - } - else - { - os_error_printf(CU_MSG_ERROR, (PS8)"Error reading the report table form the driver\n"); - } - } - else - { - CuCommon_SetBuffer(pCuCmd->hCuCommon, TIWLN_REPORT_MODULE_SET, pModuleTable, REPORT_FILES_NUM); - } -} - -VOID CuCmd_AddReport(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - U8 ModuleTable[REPORT_FILES_NUM]; - - if( nParms != 1) - { - S32 i; - if (!CuCommon_GetBuffer(pCuCmd->hCuCommon, TIWLN_REPORT_MODULE_GET, ModuleTable, REPORT_FILES_NUM)) - { - os_error_printf(CU_MSG_INFO2, (PS8)"-------------------------------\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"%.5s\tState\t %s\n", (PS8)"Index", (PS8)"Desc"); - - for( i = 0; i < SIZE_ARR(report_module); i++) - { - /* Check if there is string content (the first character is not ZERO) */ - if( report_module[i].name[0] ) - { - os_error_printf(CU_MSG_INFO2, (PS8)"%3d\t%c\t%s\n", report_module[i].value, (ModuleTable[i] == '1') ? '+' : ' ', report_module[i].name ); - } - } - } - else - { - os_error_printf(CU_MSG_ERROR, (PS8)"Error reading the report table form the driver\n"); - } - os_error_printf(CU_MSG_INFO2, (PS8)"* Use '%d' (max index) to set all table.\n", REPORT_FILES_NUM); - } - else if(!CuCommon_GetBuffer(pCuCmd->hCuCommon, TIWLN_REPORT_MODULE_GET, ModuleTable, REPORT_FILES_NUM)) - { - if (parm[0].value == REPORT_FILES_NUM) - { - os_memset(ModuleTable, '1', REPORT_FILES_NUM); - } - else if(parm[0].value < REPORT_FILES_NUM) - { - ModuleTable[parm[0].value] = '1'; - } - CuCommon_SetBuffer(pCuCmd->hCuCommon, TIWLN_REPORT_MODULE_SET, ModuleTable, REPORT_FILES_NUM); - } -} - -VOID CuCmd_ClearReport(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - U8 ModuleTable[REPORT_FILES_NUM]; - - if( nParms != 1) - { - S32 i; - if (!CuCommon_GetBuffer(pCuCmd->hCuCommon, TIWLN_REPORT_MODULE_GET, ModuleTable, REPORT_FILES_NUM)) - { - os_error_printf(CU_MSG_INFO2, (PS8)"-------------------------------\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"%.5s\tState\t %s\n", (PS8)"Index", (PS8)"Desc"); - - for( i = 0; i < SIZE_ARR(report_module); i++) - { - /* Check if there is string content (the first character is not ZERO) */ - if( report_module[i].name[0] ) - { - os_error_printf(CU_MSG_INFO2, (PS8)"%3d\t%c\t%s\n", report_module[i].value, (ModuleTable[i] == '1') ? '+' : ' ', report_module[i].name ); - } - } - } - else - { - os_error_printf(CU_MSG_ERROR, (PS8)"Error reading the report table form the driver\n"); - } - os_error_printf(CU_MSG_INFO2, (PS8)"* Use '%d' (max index) to clear all table.\n", REPORT_FILES_NUM); - } - else if(!CuCommon_GetBuffer(pCuCmd->hCuCommon, TIWLN_REPORT_MODULE_GET, ModuleTable, REPORT_FILES_NUM)) - { - if (parm[0].value == REPORT_FILES_NUM) - { - os_memset(ModuleTable, '0', REPORT_FILES_NUM); - } - else if(parm[0].value < REPORT_FILES_NUM) - { - ModuleTable[parm[0].value] = '0'; - } - CuCommon_SetBuffer(pCuCmd->hCuCommon, TIWLN_REPORT_MODULE_SET, ModuleTable, REPORT_FILES_NUM); - } -} - -VOID CuCmd_ReportSeverityLevel(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - U8 SeverityTable[REPORT_SEVERITY_MAX]; - - /* Get the current report severity */ - if (!CuCommon_GetBuffer(pCuCmd->hCuCommon, TIWLN_REPORT_SEVERITY_GET, SeverityTable, REPORT_SEVERITY_MAX)) - { - if(nParms == 0) - { - S32 i; - - os_error_printf(CU_MSG_INFO2, (PS8)"Severity:\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"-------------------------------\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"%14s\tState\t%s\n", (PS8)"Severity level", (PS8)"Desc"); - - for( i=1; i<SIZE_ARR(report_severity); i++ ) - { - os_error_printf(CU_MSG_INFO2, (PS8)"%d\t%c\t%s\n", report_severity[i].value, (SeverityTable[i] == '1') ? '+' : ' ', report_severity[i].name ); - } - - os_error_printf(CU_MSG_INFO2, (PS8)"* Use '0' to clear all table.\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"* Use '%d' (max index) to set all table.\n", REPORT_SEVERITY_MAX); - } - else - { - if (parm[0].value == 0) - { - /* Disable all severity levels */ - os_memset(SeverityTable, '0', sizeof(SeverityTable)); - CuCommon_SetBuffer(pCuCmd->hCuCommon, TIWLN_REPORT_SEVERITY_SET, SeverityTable, REPORT_SEVERITY_MAX); - } - else if (parm[0].value == REPORT_SEVERITY_MAX) - { - /* Enable all severity levels */ - os_memset(SeverityTable, '1', sizeof(SeverityTable)); - CuCommon_SetBuffer(pCuCmd->hCuCommon, TIWLN_REPORT_SEVERITY_SET, SeverityTable, REPORT_SEVERITY_MAX); - } - else if (parm[0].value < REPORT_SEVERITY_MAX) - { - os_error_printf(CU_MSG_INFO2, (PS8)"Toggle severity level %#lx\n", parm[0].value); - if (SeverityTable[parm[0].value] == '1') - { - /* The level is enabled - Disable it */ - SeverityTable[parm[0].value] = '0'; - } - else - { - /* The bit is disabled - Enable it */ - SeverityTable[parm[0].value] = '1'; - } - CuCommon_SetBuffer(pCuCmd->hCuCommon, TIWLN_REPORT_SEVERITY_SET, SeverityTable, REPORT_SEVERITY_MAX); - } - else - { - os_error_printf(CU_MSG_INFO2, (PS8)"invalid level value: %#lx\n", parm[0].value ); - } - } - } - else - { - os_error_printf(CU_MSG_ERROR, (PS8)"Error retriving the severity table from the driver\n"); - } -} - -VOID CuCmd_SetReportLevelCLI(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ -#if 0 /* need to create debug logic for CLI */ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - S32 i, cli_debug_level; - - if(nParms) - { - cli_debug_level = parm[0].value; - /* check if the param is valid */ - CU_CMD_FIND_NAME_ARRAY(i, cli_level_type, cli_debug_level); - if(i == SIZE_ARR(cli_level_type)) - { - os_error_printf(CU_MSG_INFO2, (PS8)"CuCmd_SetReportLevelCLI, cli_debug_level %d is not defined!\n", cli_debug_level); - return; - } - - g_debug_level = cli_debug_level; - IpcEvent_UpdateDebugLevel(pCuCmd->hIpcEvent, cli_debug_level); - os_error_printf(CU_MSG_INFO2, (PS8)"set CLI debug value = %s \n", cli_level_type[i].name); - } - else - { - cli_debug_level = g_debug_level; - CU_CMD_FIND_NAME_ARRAY(i, cli_level_type, cli_debug_level); - os_error_printf(CU_MSG_INFO2, (PS8)"CLI debug value = %s (%d)\n", cli_level_type[i].name, cli_debug_level); - print_available_values(cli_level_type); - } -#endif -} - - -char* SkipSpaces(char* str) -{ - char* tmp = str; - - while(*tmp == ' ') tmp++; - return tmp; -} - -#define ti_isdigit(c) ('0' <= (c) && (c) <= '9') -#define ti_islower(c) ('a' <= (c) && (c) <= 'z') -#define ti_toupper(c) (ti_islower(c) ? ((c) - 'a' + 'A') : (c)) - -#define ti_isxdigit(c) (('0' <= (c) && (c) <= '9') \ - || ('a' <= (c) && (c) <= 'f') \ - || ('A' <= (c) && (c) <= 'F')) - -#define ti_atol(x) strtoul(x, 0) - - -unsigned long ti_strtoul(char *cp, char** endp, unsigned int base) -{ - unsigned long result = 0, value; - - if (!base) { - base = 10; - if (*cp == '0') { - base = 8; - cp++; - if ((ti_toupper(*cp) == 'X') && ti_isxdigit(cp[1])) { - cp++; - base = 16; - } - } - } else if (base == 16) { - if (cp[0] == '0' && ti_toupper(cp[1]) == 'X') - cp += 2; - } - while (ti_isxdigit(*cp) && - (value = ti_isdigit(*cp) ? *cp-'0' : ti_toupper(*cp)-'A'+10) < base) { - result = result*base + value; - cp++; - } - - if(endp) - *endp = (char *)cp; - - return result; -} - - -VOID CuCmd_FwDebug(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - U32 *buf_ptr, *pbuf; - char *pstr = (char *)parm[0].value; - U32 parm_length; - - os_error_printf(CU_MSG_INFO2, (PS8)"FwDebug parm: %s\n", parm[0].value); - - buf_ptr = (U32*)os_MemoryCAlloc(252, sizeof(U32)); - if(!buf_ptr) - return; - - pbuf = buf_ptr + 2; - - pstr = SkipSpaces(pstr); - while(*pstr) { - *pbuf++ = ti_strtoul(pstr, &pstr, 0); - pstr = SkipSpaces(pstr); - } - - parm_length = (U32)((U8*)pbuf-(U8*)buf_ptr); - - os_error_printf(CU_MSG_INFO2, (PS8)"Parms buf size = %d\n", parm_length); - - *buf_ptr = 2210; - *(buf_ptr+1) = parm_length - 2*sizeof(U32); - - CuCommon_PrintDriverDebug(pCuCmd->hCuCommon, (PVOID)buf_ptr, parm_length); - - os_MemoryFree(buf_ptr); - -} - -VOID CuCmd_SetRateMngDebug(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - RateMangeParams_t RateParams; - - RateParams.paramIndex = (TI_UINT8)parm[0].value; - - - if( nParms == 2 ) - { - switch (RateParams.paramIndex) - { - case RATE_MGMT_RETRY_SCORE_PARAM: - RateParams.RateRetryScore = (TI_UINT16)parm[1].value; - break; - case RATE_MGMT_PER_ADD_PARAM: - RateParams.PerAdd = (TI_UINT16)parm[1].value; - break; - case RATE_MGMT_PER_TH1_PARAM: - RateParams.PerTh1 = (TI_UINT16)parm[1].value; - break; - case RATE_MGMT_PER_TH2_PARAM: - RateParams.PerTh2 = (TI_UINT16)parm[1].value; - break; - case RATE_MGMT_MAX_PER_PARAM: - RateParams.MaxPer = (TI_UINT16)parm[1].value; - break; - case RATE_MGMT_INVERSE_CURIOSITY_FACTOR_PARAM: - RateParams.InverseCuriosityFactor = (TI_UINT8)parm[1].value; - break; - case RATE_MGMT_TX_FAIL_LOW_TH_PARAM: - RateParams.TxFailLowTh = (TI_UINT8)parm[1].value; - break; - case RATE_MGMT_TX_FAIL_HIGH_TH_PARAM: - RateParams.TxFailHighTh = (TI_UINT8)parm[1].value; - break; - case RATE_MGMT_PER_ALPHA_SHIFT_PARAM: - RateParams.PerAlphaShift = (TI_UINT8)parm[1].value; - break; - case RATE_MGMT_PER_ADD_SHIFT_PARAM: - RateParams.PerAddShift = (TI_UINT8)parm[1].value; - break; - case RATE_MGMT_PER_BETA1_SHIFT_PARAM: - RateParams.PerBeta1Shift = (TI_UINT8)parm[1].value; - break; - case RATE_MGMT_PER_BETA2_SHIFT_PARAM: - RateParams.PerBeta2Shift = (TI_UINT8)parm[1].value; - break; - case RATE_MGMT_RATE_CHECK_UP_PARAM: - RateParams.RateCheckUp = (TI_UINT8)parm[1].value; - break; - case RATE_MGMT_RATE_CHECK_DOWN_PARAM: - RateParams.RateCheckDown = (TI_UINT8)parm[1].value; - break; - default: - os_error_printf(CU_MSG_INFO2,"Error: index is not valid! \n"); - return; - - } - } - else if ((nParms == NUM_OF_RATE_MNGT_PARAMS_MAX) && (parm[0].value == RATE_MGMT_RATE_RETRY_POLICY_PARAM )) - { - int i=0; - for (i=1; i < NUM_OF_RATE_MNGT_PARAMS_MAX; i++) - { - RateParams.RateRetryPolicy[i-1] = (TI_UINT8)parm[i].value; - } - } - else - { - os_error_printf(CU_MSG_INFO2,"(0) RateMngRateRetryScore \n"); - os_error_printf(CU_MSG_INFO2,"(1) RateMngPerAdd \n"); - os_error_printf(CU_MSG_INFO2,"(2) RateMngPerTh1 \n"); - os_error_printf(CU_MSG_INFO2,"(3) RateMngPerTh2 \n"); - os_error_printf(CU_MSG_INFO2,"(4) RateMngMaxPer \n"); - os_error_printf(CU_MSG_INFO2,"(5) RateMngInverseCuriosityFactor \n"); - os_error_printf(CU_MSG_INFO2,"(6) RateMngTxFailLowTh \n"); - os_error_printf(CU_MSG_INFO2,"(7) RateMngTxFailHighTh \n"); - os_error_printf(CU_MSG_INFO2,"(8) RateMngPerAlphaShift \n"); - os_error_printf(CU_MSG_INFO2,"(9) RateMngPerAddShift \n"); - os_error_printf(CU_MSG_INFO2,"(10) RateMngPerBeta1Shift \n"); - os_error_printf(CU_MSG_INFO2,"(11) RateMngPerBeta2Shift \n"); - os_error_printf(CU_MSG_INFO2,"(12) RateMngRateCheckUp \n"); - os_error_printf(CU_MSG_INFO2,"(13) RateMngRateCheckDown \n"); - os_error_printf(CU_MSG_INFO2,"(14) RateMngRateRetryPolicy[13] \n"); - return; - } - - CuCommon_SetBuffer(pCuCmd->hCuCommon, TIWLN_RATE_MNG_SET,&RateParams, sizeof(RateMangeParams_t)); -} - -VOID CuCmd_GetRateMngDebug(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - AcxRateMangeParams ReadRateParams; - int i; - - os_memset(&ReadRateParams,0,sizeof(AcxRateMangeParams)); - - CuCommon_GetBuffer(pCuCmd->hCuCommon, TIWLN_RATE_MNG_GET, &ReadRateParams, sizeof(AcxRateMangeParams)); - - if (0 == nParms) - { - parm[0].value = RATE_MGMT_ALL_PARAMS; - } - - switch (parm[0].value) - { - case RATE_MGMT_RETRY_SCORE_PARAM: - os_error_printf(CU_MSG_INFO2,"RateMngRateRetryScore = %d \n", ReadRateParams.RateRetryScore); - break; - case RATE_MGMT_PER_ADD_PARAM: - os_error_printf(CU_MSG_INFO2,"RateMngPerAdd = %d\n" , ReadRateParams.PerAdd); - break; - case RATE_MGMT_PER_TH1_PARAM: - os_error_printf(CU_MSG_INFO2,"RateMngPerTh1 = %d\n" , ReadRateParams.PerTh1); - break; - case RATE_MGMT_PER_TH2_PARAM: - os_error_printf(CU_MSG_INFO2,"RateMngPerTh2 = %d\n" , ReadRateParams.PerTh2); - break; - case RATE_MGMT_MAX_PER_PARAM: - os_error_printf(CU_MSG_INFO2,"RateMngMaxPer = %d\n" , ReadRateParams.MaxPer); - break; - case RATE_MGMT_INVERSE_CURIOSITY_FACTOR_PARAM: - os_error_printf(CU_MSG_INFO2,"RateMngInverseCuriosityFactor = %d \n" , ReadRateParams.InverseCuriosityFactor); - break; - case RATE_MGMT_TX_FAIL_LOW_TH_PARAM: - os_error_printf(CU_MSG_INFO2,"RateMngTxFailLowTh = %d\n" , ReadRateParams.TxFailLowTh); - break; - case RATE_MGMT_TX_FAIL_HIGH_TH_PARAM: - os_error_printf(CU_MSG_INFO2,"RateMngTxFailHighTh = %d\n" , ReadRateParams.TxFailHighTh); - break; - case RATE_MGMT_PER_ALPHA_SHIFT_PARAM: - os_error_printf(CU_MSG_INFO2,"RateMngPerAlphaShift = %d\n" , ReadRateParams.PerAlphaShift); - break; - case RATE_MGMT_PER_ADD_SHIFT_PARAM: - os_error_printf(CU_MSG_INFO2,"RateMngPerAddShift = %d\n" , ReadRateParams.PerAddShift); - break; - case RATE_MGMT_PER_BETA1_SHIFT_PARAM: - os_error_printf(CU_MSG_INFO2,"RateMngPerBeta1Shift = %d\n" , ReadRateParams.PerBeta1Shift); - break; - case RATE_MGMT_PER_BETA2_SHIFT_PARAM: - os_error_printf(CU_MSG_INFO2,"RateMngPerBeta2Shift = %d\n" , ReadRateParams.PerBeta2Shift); - break; - case RATE_MGMT_RATE_CHECK_UP_PARAM: - os_error_printf(CU_MSG_INFO2,"RateMngRateCheckUp = %d\n" , ReadRateParams.RateCheckUp); - break; - case RATE_MGMT_RATE_CHECK_DOWN_PARAM: - os_error_printf(CU_MSG_INFO2,"RateMngRateCheckDown = %d\n" , ReadRateParams.RateCheckDown); - break; - case RATE_MGMT_RATE_RETRY_POLICY_PARAM: - os_error_printf(CU_MSG_INFO2,"RateMngRateRetryPolicy = "); - - for (i=0 ; i< RATE_MNG_MAX_RETRY_POLICY_PARAMS_LEN ; i++) - { - os_error_printf(CU_MSG_INFO2,"%d ",ReadRateParams.RateRetryPolicy[i]); - } - - os_error_printf(CU_MSG_INFO2,"\n"); - - break; - - case RATE_MGMT_ALL_PARAMS: - os_error_printf(CU_MSG_INFO2,"RateMngRateRetryScore = %d \n", ReadRateParams.RateRetryScore); - os_error_printf(CU_MSG_INFO2,"RateMngPerAdd = %d\n" , ReadRateParams.PerAdd); - os_error_printf(CU_MSG_INFO2,"RateMngPerTh1 = %d\n" , ReadRateParams.PerTh1); - os_error_printf(CU_MSG_INFO2,"RateMngPerTh2 = %d\n" , ReadRateParams.PerTh2); - os_error_printf(CU_MSG_INFO2,"RateMngMaxPer = %d\n" , ReadRateParams.MaxPer); - os_error_printf(CU_MSG_INFO2,"RateMngInverseCuriosityFactor = %d \n" , ReadRateParams.InverseCuriosityFactor); - os_error_printf(CU_MSG_INFO2,"RateMngTxFailLowTh = %d\n" , ReadRateParams.TxFailLowTh); - os_error_printf(CU_MSG_INFO2,"RateMngTxFailHighTh = %d\n" , ReadRateParams.TxFailHighTh); - os_error_printf(CU_MSG_INFO2,"RateMngPerAlphaShift = %d\n" , ReadRateParams.PerAlphaShift); - os_error_printf(CU_MSG_INFO2,"RateMngPerAddShift = %d\n" , ReadRateParams.PerAddShift); - os_error_printf(CU_MSG_INFO2,"RateMngPerBeta1Shift = %d\n" , ReadRateParams.PerBeta1Shift); - os_error_printf(CU_MSG_INFO2,"RateMngPerBeta2Shift = %d\n" , ReadRateParams.PerBeta2Shift); - os_error_printf(CU_MSG_INFO2,"RateMngRateCheckUp = %d\n" , ReadRateParams.RateCheckUp); - os_error_printf(CU_MSG_INFO2,"RateMngRateCheckDown = %d\n" , ReadRateParams.RateCheckDown); - os_error_printf(CU_MSG_INFO2,"RateMngRateRetryPolicy = "); - - for (i=0 ; i< RATE_MNG_MAX_RETRY_POLICY_PARAMS_LEN ; i++) - { - os_error_printf(CU_MSG_INFO2,"%d ",ReadRateParams.RateRetryPolicy[i]); - } - os_error_printf(CU_MSG_INFO2,"\n"); - break; - - default: - os_error_printf(CU_MSG_INFO2,"Error: index is not valid! \n"); - return; - } - -} - - -VOID CuCmd_PrintDriverDebug(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - U32 size = 0; - TTwdDebug data; - - /* check if nParam is invalid */ - if (( nParms == 0 ) || ( nParms > 4 )) - { - os_error_printf(CU_MSG_INFO2, (PS8)"CuCmd_PrintDriverDebug: Invalid number of Parameters %d\n", nParms); - return; - } - - /* init */ - os_memset( &data.debug_data.mem_debug.UBuf.buf8, 0, sizeof(data.debug_data.mem_debug.UBuf.buf8) ); - data.func_id = parm[0].value; - size = sizeof(data.func_id); - - os_error_printf(CU_MSG_INFO2, (PS8)"CuCmd_PrintDriverDebug: FUN_ID: %u\n", data.func_id); - - /* if R reg request - read data */ - if ( nParms == 2 ) - { - data.debug_data.opt_param = 4; - data.debug_data.opt_param = parm[1].value; - size += sizeof(data.debug_data.opt_param); - } - else - /* if W reg request - read data */ - if ( nParms > 2 ) - { - data.debug_data.mem_debug.addr = 0; - - data.debug_data.mem_debug.length = 4; - size += sizeof(data.debug_data.mem_debug.length); - - data.debug_data.mem_debug.addr = parm[1].value; - size += sizeof(data.debug_data.mem_debug.addr); - - data.debug_data.mem_debug.UBuf.buf32[0] = parm[2].value; - size += sizeof(data.debug_data.mem_debug.UBuf.buf32[0]); - - os_error_printf(CU_MSG_INFO2, (PS8)"CuCmd_PrintDriverDebug: addr: 0x%x\n", data.debug_data.opt_param); - os_error_printf(CU_MSG_INFO2, (PS8)"CuCmd_PrintDriverDebug: data: 0x%x\n", data.debug_data.mem_debug.UBuf.buf32[0]); - } - CuCommon_PrintDriverDebug(pCuCmd->hCuCommon, (PVOID)&data, size); -} - -VOID CuCmd_PrintDriverDebugBuffer(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - - U32 func_id = ( nParms > 0 ) ? parm[0].value : 0; - U32 opt_param = ( nParms > 1 ) ? parm[1].value : 0; - - os_error_printf(CU_MSG_INFO2, (PS8)"CuCmd_PrintDriverDebugBuffer: FUNC:%u, PARAM:%u\n", func_id, opt_param); - - CuCommon_PrintDriverDebugBuffer(pCuCmd->hCuCommon, func_id, opt_param); -} - -/*-------------------*/ -/* Radio Debug Tests */ -/*-------------------*/ -/* Set the RX channel --> Radio Tune */ -VOID CuCmd_RadioDebug_ChannelTune(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - TPowerMgr_PowerMode Mode; - TTestCmd data; - - if ((nParms == 0) || (nParms > 2)) - { - os_error_printf(CU_MSG_INFO2, (PS8)"Param 0 - Band (0-2.4Ghz, 1-5Ghz, 2-4.9Ghz)\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 1 - Channel\n"); - } - else - { - if(OK != CuCommon_GetBuffer(pCuCmd->hCuCommon, TIWLN_802_11_POWER_MODE_GET, - &Mode, sizeof(TPowerMgr_PowerMode))) return; - if(Mode.PowerMode != OS_POWER_MODE_ACTIVE) - { - os_error_printf(CU_MSG_INFO2, (PS8)"Radio tune was not performed becouse Default power-mode is not ACTIVE\n"); - } - else - { - os_memset(&data, 0, sizeof(TTestCmd)); - data.testCmdId = TEST_CMD_CHANNEL_TUNE; - data.testCmd_u.Channel.iChannel = (U8)parm[1].value; - data.testCmd_u.Channel.iBand = (U8)parm[0].value; - - if(OK != CuCommon_Radio_Test(pCuCmd->hCuCommon, &data)) - { - os_error_printf(CU_MSG_INFO2, (PS8)"Channel %d tune failed\n",data.testCmd_u.Channel.iChannel); - return; - } - os_error_printf(CU_MSG_INFO2, (PS8)"Channel tune of channel %d was performed OK\n",(U8)data.testCmd_u.Channel.iChannel); - } - } -} - -/* Start CW test (TELEC) */ -VOID CuCmd_RadioDebug_StartTxCw(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - TTestCmd data; - - /* check # of params OK */ - if ((nParms == 0) || (nParms > 2)) - { - /* print help */ - os_error_printf(CU_MSG_INFO2, (PS8)"Param 0 - Power (0-25000 1/1000 db)\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 1 - Tone Type (1- Carrier Feed Through, 2- Single Tone)\n"); - -/* os_error_printf(CU_MSG_INFO2, (PS8)"Param 2 - Band\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 3 - Channel\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 4 - PPA Step\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 5 - Tone no. Single Tones\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 6 - Tone no. Two Tones\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 7 - Use digital DC\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 8 - Invert\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 9 - Eleven N Span\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 10 - Digital DC\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 11 - Analog DC Fine\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 12 - Analog DC Course\n");*/ - } - else - { - os_memset(&data, 0, sizeof(TTestCmd)); - data.testCmdId = TEST_CMD_TELEC; - data.testCmd_u.TxToneParams.iPower = (U16)parm[0].value; - data.testCmd_u.TxToneParams.iToneType = (U8)parm[1].value; -/* data.testCmd_u.TxToneParams.iPpaStep = (U8)parm[4].value; - data.testCmd_u.TxToneParams.iToneNumberSingleTones = (U8)parm[5].value; - data.testCmd_u.TxToneParams.iToneNumberTwoTones = (U8)parm[6].value; - data.testCmd_u.TxToneParams.iUseDigitalDC = (U8)parm[7].value; - data.testCmd_u.TxToneParams.iInvert = (U8)parm[8].value; - data.testCmd_u.TxToneParams.iElevenNSpan = (U8)parm[9].value; - data.testCmd_u.TxToneParams.iDigitalDC = (U8)parm[10].value; - data.testCmd_u.TxToneParams.iAnalogDCFine = (U8)parm[11].value; - data.testCmd_u.TxToneParams.iAnalogDCCoarse = (U8)parm[12].value;*/ - - if(OK != CuCommon_Radio_Test(pCuCmd->hCuCommon, &data)) - { - os_error_printf(CU_MSG_INFO2, (PS8)"CW test failed\n"); - return; - } - os_error_printf(CU_MSG_INFO2, (PS8)"CW test was performed OK\n"); - } -} - -/* Start TX continues test (FCC) */ -VOID CuCmd_RadioDebug_StartContinuousTx(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - TMacAddr mac_addr_mask = { 0xff,0xff,0xff,0xff,0xff,0xff }; - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - TTestCmd data; - - if ((nParms == 0) || (nParms > 15)) - { - /* print help */ - os_error_printf(CU_MSG_INFO2, (PS8)"\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 0 - Delay\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 1 - Rate\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 2 - Size\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 3 - Amount\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 4 - Power\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 5 - Seed\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 6 - Packet Mode\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 7 - DCF On/Off\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 8 - GI\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 9 - Preamble\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 10 - Type\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 11 - Scrambler\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 12 - Enable CLPC\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 13 - Sequance no. Mode\n"); - /* future use. for now the oregenal source address are use. - os_error_printf(CU_MSG_INFO2, (PS8)"Param 14 - Source MAC Address\n"); - */ - os_error_printf(CU_MSG_INFO2, (PS8)"Param 14 - Destination MAC Address\n"); - } - else - { - os_memset(&data, 0, sizeof(TTestCmd)); - data.testCmdId = TEST_CMD_FCC; - data.testCmd_u.TxPacketParams.iDelay = (U32)parm[0].value; - data.testCmd_u.TxPacketParams.iRate = (U32)parm[1].value; - data.testCmd_u.TxPacketParams.iSize = (U16)parm[2].value; - data.testCmd_u.TxPacketParams.iAmount = (U16)parm[3].value; - data.testCmd_u.TxPacketParams.iPower = (U16)parm[4].value; - data.testCmd_u.TxPacketParams.iSeed = (U16)parm[5].value; - data.testCmd_u.TxPacketParams.iPacketMode = (U8)parm[6].value; - data.testCmd_u.TxPacketParams.iDcfOnOff = (U8)parm[7].value; - data.testCmd_u.TxPacketParams.iGI = (U8)parm[8].value; - data.testCmd_u.TxPacketParams.iPreamble = (U8)parm[9].value; - data.testCmd_u.TxPacketParams.iType = (U8)parm[10].value; - data.testCmd_u.TxPacketParams.iScrambler = (U8)parm[11].value; - data.testCmd_u.TxPacketParams.iEnableCLPC = (U8)parm[12].value; - data.testCmd_u.TxPacketParams.iSeqNumMode = (U8)parm[13].value; - /* future use. for now the oregenal source address are use. - if(!CuCmd_Str2MACAddr((PS8)parm[16].value, (PU8)mac_addr_mask) ) - { - os_error_printf(CU_MSG_INFO2, (PS8)"Continuous Tx start has failed to read source MAC Address \n"); - return; - } - */ - os_memcpy((PVOID)data.testCmd_u.TxPacketParams.iSrcMacAddr, - (PVOID)mac_addr_mask, - sizeof(mac_addr_mask)); - if(!CuCmd_Str2MACAddr((PS8)parm[14].value, (PU8)mac_addr_mask) ) - { - os_error_printf(CU_MSG_INFO2, (PS8)"Continuous Tx start has failed to read destination MAC Address \n"); - return; - } - os_memcpy((PVOID)data.testCmd_u.TxPacketParams.iDstMacAddr, - (PVOID)mac_addr_mask, - sizeof(mac_addr_mask)); - - if(OK != CuCommon_Radio_Test(pCuCmd->hCuCommon, &data)) - { - os_error_printf(CU_MSG_INFO2, (PS8)"Continuous Tx start has failed\n"); - return; - } - os_error_printf(CU_MSG_INFO2, (PS8)"Continuous Tx started OK\n"); - } -} - -/* Stop FCC/TELEC (Radio Debug) */ -VOID CuCmd_RadioDebug_StopTx(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - TTestCmd data; - - os_memset(&data, 0, sizeof(TTestCmd)); - data.testCmdId = TEST_CMD_STOP_TX; - - if(OK != CuCommon_Radio_Test(pCuCmd->hCuCommon, &data)) - { - os_error_printf(CU_MSG_INFO2, (PS8)"Plt Tx Stop has failed\n"); - return; - } - os_error_printf(CU_MSG_INFO2, (PS8)"Plt Tx Stop was OK\n"); -} - -/* download packet template for transmissions - the template shall be set before calling TX Debug */ -VOID CuCmd_RadioDebug_Template(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - TTestCmd data; - - if ((nParms == 0) || (nParms > 3)) - { - /* print help */ - os_error_printf(CU_MSG_INFO2, (PS8)"\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 1 - Buffer Offset\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Param 2 - Buffer Data\n"); - } - else - { - os_memset(&data, 0, sizeof(TTestCmd)); - data.testCmdId = TEST_CMD_PLT_TEMPLATE; - data.testCmd_u.TxTemplateParams.bufferOffset = (U16)parm[0].value; - data.testCmd_u.TxTemplateParams.bufferLength = (U16)os_strlen((PS8)parm[1].value); - /* check that length is valid */ - if( data.testCmd_u.TxTemplateParams.bufferOffset + data.testCmd_u.TxTemplateParams.bufferLength > TX_TEMPLATE_MAX_BUF_LEN ) - { - os_error_printf(CU_MSG_INFO2, (PS8)"Plt Template has failed because of invalid buffer length\n"); - return; - } - /* convert the string to hexadeciaml values, and copy it */ - CuCmd_atox_string ((U8*)parm[1].value,(U8*)data.testCmd_u.TxTemplateParams.buffer); - - if(OK != CuCommon_Radio_Test(pCuCmd->hCuCommon, &data)) - { - os_error_printf(CU_MSG_INFO2, (PS8)"Plt Template has failed\n"); - return; - } - os_error_printf(CU_MSG_INFO2, (PS8)"Plt Template was OK\n"); - } -} - - -/* Start RX Statistics */ -VOID CuCmd_RadioDebug_StartRxStatistics(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - TTestCmd data; - - os_memset(&data, 0, sizeof(TTestCmd)); - data.testCmdId = TEST_CMD_RX_STAT_START; - - if(OK != CuCommon_Radio_Test(pCuCmd->hCuCommon, &data)) - { - os_error_printf(CU_MSG_INFO2, (PS8)"Start RX Statistics has failed\n"); - return; - } - os_error_printf(CU_MSG_INFO2, (PS8)"Start RX Statistics OK\n"); -} - -/* Stop RX Statistics */ -VOID CuCmd_RadioDebug_StopRxStatistics(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - TTestCmd data; - - os_memset(&data, 0, sizeof(TTestCmd)); - data.testCmdId = TEST_CMD_RX_STAT_STOP; - - if(OK != CuCommon_Radio_Test(pCuCmd->hCuCommon, &data)) - { - os_error_printf(CU_MSG_INFO2, (PS8)"Stop RX Statistics has failed\n"); - return; - } - os_error_printf(CU_MSG_INFO2, (PS8)"Stop RX Statistics OK\n"); -} - -/* Reset RX Statistics */ -VOID CuCmd_RadioDebug_ResetRxStatistics(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - TTestCmd data; - - os_memset(&data, 0, sizeof(TTestCmd)); - data.testCmdId = TEST_CMD_RX_STAT_RESET; - - if(OK != CuCommon_Radio_Test(pCuCmd->hCuCommon, &data)) - { - os_error_printf(CU_MSG_INFO2, (PS8)"Reset RX Statistics has failed\n"); - return; - } - os_error_printf(CU_MSG_INFO2, (PS8)"Reset RX Statistics OK\n"); -} - - -/* Get HDK Version*/ -VOID CuCmd_RadioDebug_GetHDKVersion(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - TTestCmd data; - - os_memset(&data, 0, sizeof(TTestCmd)); - - data.testCmdId = TEST_CMD_GET_FW_VERSIONS; - if(OK != CuCommon_Radio_Test(pCuCmd->hCuCommon, &data)) - { - os_error_printf(CU_MSG_INFO2, (PS8)"Get FW version function has failed\n"); - return; - } - os_error_printf(CU_MSG_INFO2, (PS8)"ProductName: %d\n", data.testCmd_u.fwVersions.hdkVersion.ProductName); - os_error_printf(CU_MSG_INFO2, (PS8)"PgNumber: %d\n", data.testCmd_u.fwVersions.hdkVersion.PgNumber); - os_error_printf(CU_MSG_INFO2, (PS8)"SoftwareVersionLevel: %d\n", data.testCmd_u.fwVersions.hdkVersion.SoftwareVersionLevel); - os_error_printf(CU_MSG_INFO2, (PS8)"radioModuleType: %d\n", data.testCmd_u.fwVersions.hdkVersion.radioModuleType); - os_error_printf(CU_MSG_INFO2, (PS8)"SoftwareVersionDelivery: %d\n", data.testCmd_u.fwVersions.hdkVersion.SoftwareVersionDelivery); - os_error_printf(CU_MSG_INFO2, (PS8)"numberOfReferenceDesignsSupported: %d\n", data.testCmd_u.fwVersions.hdkVersion.numberOfReferenceDesignsSupported); -#ifdef FIX_HDK_VERSION_API /* HDK version struct should be changed aligned and without pointer */ - os_error_printf(CU_MSG_INFO2, (PS8)"referenceDesignsSupported->referenceDesignId: %d\n", data.testCmd_u.fwVersions.hdkVersion.referenceDesignsSupported->referenceDesignId); - os_error_printf(CU_MSG_INFO2, (PS8)"referenceDesignsSupported->nvsMajorVersion: %d\n", data.testCmd_u.fwVersions.hdkVersion.referenceDesignsSupported->nvsMajorVersion); - os_error_printf(CU_MSG_INFO2, (PS8)"referenceDesignsSupported->nvsMinorVersion: %d\n", data.testCmd_u.fwVersions.hdkVersion.referenceDesignsSupported->nvsMinorVersion); - os_error_printf(CU_MSG_INFO2, (PS8)"referenceDesignsSupported->nvsMinorMinorVersion: %d\n", data.testCmd_u.fwVersions.hdkVersion.referenceDesignsSupported->nvsMinorMinorVersion); -#endif -} - -/* Get RX Statistics */ -VOID CuCmd_RadioDebug_GetRxStatistics(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ -#if 0 /*Temp: currently not supported*/ - U32 i = 0; -#endif - - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - TTestCmd data; - - os_memset(&data, 0, sizeof(TTestCmd)); - data.testCmdId = TEST_CMD_RX_STAT_GET; - - if(OK != CuCommon_Radio_Test(pCuCmd->hCuCommon, &data)) - { - os_error_printf(CU_MSG_INFO2, (PS8)"Get RX Statistics has failed\n"); - return; - } - /* print Statistics Got */ - os_error_printf(CU_MSG_INFO2, (PS8)"\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Received Valid Packet no.: %d(0x%x)\n", data.testCmd_u.Statistics.oRxPathStatistics.ReceivedValidPacketsNumber,data.testCmd_u.Statistics.oRxPathStatistics.ReceivedValidPacketsNumber); - os_error_printf(CU_MSG_INFO2, (PS8)"Received FCS Error Packet no.: %d(0x%x)\n", data.testCmd_u.Statistics.oRxPathStatistics.ReceivedFcsErrorPacketsNumber,data.testCmd_u.Statistics.oRxPathStatistics.ReceivedFcsErrorPacketsNumber); - os_error_printf(CU_MSG_INFO2, (PS8)"Received Address mismatched packet: %d(0x%x)\n", data.testCmd_u.Statistics.oRxPathStatistics.ReceivedPlcpErrorPacketsNumber,data.testCmd_u.Statistics.oRxPathStatistics.ReceivedPlcpErrorPacketsNumber); - os_error_printf(CU_MSG_INFO2, (PS8)"Sequance Nomber Missing Count: %d(0x%x)\n", data.testCmd_u.Statistics.oRxPathStatistics.SeqNumMissCount,data.testCmd_u.Statistics.oRxPathStatistics.SeqNumMissCount); - /* The RSSI and SNR are in octal units, the value divided by 8 for the print */ - os_error_printf(CU_MSG_INFO2, (PS8)"Average SNR: %d(0x%x)\n", data.testCmd_u.Statistics.oRxPathStatistics.AverageSnr/8,data.testCmd_u.Statistics.oRxPathStatistics.AverageSnr/8); - os_error_printf(CU_MSG_INFO2, (PS8)"Average RSSI: %d(0x%x)\n", (data.testCmd_u.Statistics.oRxPathStatistics.AverageRssi)/8,(data.testCmd_u.Statistics.oRxPathStatistics.AverageRssi)/8); - os_error_printf(CU_MSG_INFO2, (PS8)"Base Packet ID: %d(0x%x)\n", data.testCmd_u.Statistics.oBasePacketId,data.testCmd_u.Statistics.oBasePacketId); - os_error_printf(CU_MSG_INFO2, (PS8)"Number of Packets: %d(0x%x)\n", data.testCmd_u.Statistics.ioNumberOfPackets,data.testCmd_u.Statistics.ioNumberOfPackets); - os_error_printf(CU_MSG_INFO2, (PS8)"Number of Missed Packets: %d(0x%x)\n", data.testCmd_u.Statistics.oNumberOfMissedPackets,data.testCmd_u.Statistics.oNumberOfMissedPackets); -#if 0/*Temp: currently not supported*/ - for ( i = 0 ; i < RX_STAT_PACKETS_PER_MESSAGE ; i++ ) - { - os_error_printf(CU_MSG_INFO2, (PS8)"RX Packet %d Statistics\n",i); - os_error_printf(CU_MSG_INFO2, (PS8)"Length: %d(0x%x)\n", data.testCmd_u.Statistics.RxPacketStatistics[i].Length,data.testCmd_u.Statistics.RxPacketStatistics[i].Length); - os_error_printf(CU_MSG_INFO2, (PS8)"EVM: %d(0x%x)\n", data.testCmd_u.Statistics.RxPacketStatistics[i].EVM,data.testCmd_u.Statistics.RxPacketStatistics[i].EVM); - os_error_printf(CU_MSG_INFO2, (PS8)"RSSI: %d(0x%x)\n", data.testCmd_u.Statistics.RxPacketStatistics[i].RSSI,data.testCmd_u.Statistics.RxPacketStatistics[i].RSSI); - os_error_printf(CU_MSG_INFO2, (PS8)"Frequency Delta: %d(0x%x)\n", data.testCmd_u.Statistics.RxPacketStatistics[i].FrequencyDelta,data.testCmd_u.Statistics.RxPacketStatistics[i].FrequencyDelta); - os_error_printf(CU_MSG_INFO2, (PS8)"Flags: %d(0x%x)\n", data.testCmd_u.Statistics.RxPacketStatistics[i].Flags,data.testCmd_u.Statistics.RxPacketStatistics[i].Flags); - os_error_printf(CU_MSG_INFO2, (PS8)"Type: %d(0x%x)\n", data.testCmd_u.Statistics.RxPacketStatistics[i].Type,data.testCmd_u.Statistics.RxPacketStatistics[i].Type); - os_error_printf(CU_MSG_INFO2, (PS8)"Rate: %d(0x%x)\n", data.testCmd_u.Statistics.RxPacketStatistics[i].Rate,data.testCmd_u.Statistics.RxPacketStatistics[i].Rate); - os_error_printf(CU_MSG_INFO2, (PS8)"Noise: %d(0x%x)\n", data.testCmd_u.Statistics.RxPacketStatistics[i].Noise,data.testCmd_u.Statistics.RxPacketStatistics[i].Noise); - os_error_printf(CU_MSG_INFO2, (PS8)"AGC Gain: %d(0x%x)\n", data.testCmd_u.Statistics.RxPacketStatistics[i].AgcGain,data.testCmd_u.Statistics.RxPacketStatistics[i].AgcGain); - } -#endif -} - - -/*-----------*/ -/* BIP Tests */ -/*-----------*/ - - -void nvsFillMACAddress(THandle hCuCmd, FILE *nvsBinFile) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - TMacAddr Mac; - U8 lengthToSet; - U8 addressHigher; - U8 addressLower; - U8 valueToSet=0; - - lengthToSet = 0x1; - - - os_error_printf(CU_MSG_INFO2, (PS8)"Entering FillMACAddressToNVS\n"); - /* param 0 in nvs*/ - os_fwrite(&lengthToSet, sizeof(U8), 1, nvsBinFile); - - /* register for MAC Address*/ - addressHigher = 0x6D; - addressLower = 0x54; - - /* param 1 in nvs*/ - os_fwrite(&addressHigher, sizeof(U8), 1, nvsBinFile); - /* param 2 in nvs*/ - os_fwrite(&addressLower, sizeof(U8), 1, nvsBinFile); - - - /* read mac address */ - if(OK != CuCommon_GetBuffer(pCuCmd->hCuCommon, CTRL_DATA_MAC_ADDRESS, Mac, sizeof(TMacAddr))) - { - os_error_printf(CU_MSG_INFO2, (PS8)"Unable to get Mac address, aborting\n"); - return; - } - os_error_printf(CU_MSG_INFO2, (PS8)"Mac[0]=%02x\n", Mac[0]); - os_error_printf(CU_MSG_INFO2, (PS8)"Mac[1]=%02x\n", Mac[1]); - os_error_printf(CU_MSG_INFO2, (PS8)"Mac[2]=%02x\n", Mac[2]); - os_error_printf(CU_MSG_INFO2, (PS8)"Mac[3]=%02x\n", Mac[3]); - os_error_printf(CU_MSG_INFO2, (PS8)"Mac[4]=%02x\n", Mac[4]); - os_error_printf(CU_MSG_INFO2, (PS8)"Mac[5]=%02x\n", Mac[5]); - - /* write the lower MAC address starting from the LSB - params 3-6 in NVS*/ - os_fwrite(&Mac[5], sizeof(U8), 1, nvsBinFile); - os_fwrite(&Mac[4], sizeof(U8), 1, nvsBinFile); - os_fwrite(&Mac[3], sizeof(U8), 1, nvsBinFile); - os_fwrite(&Mac[2], sizeof(U8), 1, nvsBinFile); - - /* param 7 in NVS*/ - os_fwrite(&lengthToSet, sizeof(U8), 1, nvsBinFile); - - addressHigher = 0x71; - addressLower = 0x54; - - /* params 8-9 in NVS*/ - os_fwrite(&addressHigher, sizeof(U8), 1, nvsBinFile); - os_fwrite(&addressLower, sizeof(U8), 1, nvsBinFile); - - - /* Write the higher MAC address starting from the LSB - params 10-13 in NVS*/ - os_fwrite(&Mac[1], sizeof(U8), 1, nvsBinFile); - os_fwrite(&Mac[0], sizeof(U8), 1, nvsBinFile); - - os_fwrite(&valueToSet, sizeof(U8), 1, nvsBinFile); - os_fwrite(&valueToSet, sizeof(U8), 1, nvsBinFile); - - os_error_printf(CU_MSG_INFO2, (PS8)"exiting FillMACAddressToNVS\n"); -} - -TI_BOOL nvsReadFile(TI_UINT8 *pReadBuffer, TI_UINT16 *length, char* nvsFilePath) -{ - FILE *nvsBinFile = NULL; - TI_UINT8 nvsData; - TI_INT8 nvsFileValid = TRUE; - TI_UINT32 index =0; - - if (NULL == (nvsBinFile = os_fopen (nvsFilePath, OS_FOPEN_READ_BINARY))) - { - nvsFileValid = FALSE; - return TI_FALSE; - } - - do - { - os_fread(&nvsData, sizeof(TI_UINT8), 1, nvsBinFile); - pReadBuffer[index++] = nvsData; - } while((!feof(nvsBinFile)) && (index < NVS_TOTAL_LENGTH)) ; - - *length = index; - os_fclose(nvsBinFile); - - return TI_TRUE; -} - - -VOID nvsParsePreviosOne(const uint8 *nvsBuffer, TNvsStruct *nvsTypeTLV, uint32 *nvsVersion) -{ -#define BUFFER_INDEX bufferIndex + START_PARAM_INDEX + infoModeIndex - - uint16 bufferIndex; - uint8 tlvType; - uint16 tlvLength; - uint16 infoModeIndex; - NVSTypeInfo nvsTypeInfo; - uint8 nvsVersionOctetIndex; - uint8 shift; - - for (bufferIndex = 0; bufferIndex < NVS_TOTAL_LENGTH;) - { - tlvType = nvsBuffer[bufferIndex]; - - /* fill the correct mode to fill the NVS struct buffer */ - /* if the tlvType is the last type break from the loop */ - switch(tlvType) - { - case eNVS_RADIO_TX_PARAMETERS: - nvsTypeInfo = eNVS_RADIO_TX_TYPE_PARAMETERS_INFO; - break; - - case eNVS_RADIO_RX_PARAMETERS: - nvsTypeInfo = eNVS_RADIO_RX_TYPE_PARAMETERS_INFO; - break; - - case eNVS_VERSION: - for (*nvsVersion = 0, nvsVersionOctetIndex = 0; nvsVersionOctetIndex < NVS_VERSION_PARAMETER_LENGTH; nvsVersionOctetIndex++) - { - shift = 8 * (NVS_VERSION_PARAMETER_LENGTH - 1 - nvsVersionOctetIndex); - *nvsVersion += ((nvsBuffer[bufferIndex + START_PARAM_INDEX + nvsVersionOctetIndex]) << shift); - } - break; - - case eTLV_LAST: - default: - return; - } - - tlvLength = (nvsBuffer[bufferIndex + START_LENGTH_INDEX + 1] << 8) + nvsBuffer[bufferIndex + START_LENGTH_INDEX]; - - /* if TLV type is not NVS version fill the NVS structure according to the mode TX/RX */ - if ((eNVS_RADIO_TX_PARAMETERS == tlvType) || (eNVS_RADIO_RX_PARAMETERS == tlvType)) - { - nvsTypeTLV[nvsTypeInfo].Type = tlvType; - nvsTypeTLV[nvsTypeInfo].Length = tlvLength; - - for (infoModeIndex = 0; (infoModeIndex < tlvLength) && (BUFFER_INDEX < NVS_TOTAL_LENGTH); infoModeIndex++) - { - nvsTypeTLV[nvsTypeInfo].Buffer[infoModeIndex] = nvsBuffer[BUFFER_INDEX]; - } - - } - - /* increment to the next TLV */ - bufferIndex += START_PARAM_INDEX + tlvLength; - } -} - - -VOID nvsFillOldRxParams(FILE *nvsBinFile, const TI_UINT8 *buffer, const uint16 rxLength) -{ - TI_UINT16 index; - TI_UINT8 rxTypeValue; - TI_UINT8 valueToSet; - - /* RX BiP type */ - rxTypeValue = eNVS_RADIO_RX_PARAMETERS; - fwrite(&rxTypeValue, sizeof(TI_UINT8), 1, nvsBinFile); - - /* RX BIP Length */ - fwrite(&rxLength, sizeof(TI_UINT16), 1, nvsBinFile); - - for (index = 0; index < rxLength; index++) - { - valueToSet = buffer[index]; - fwrite(&valueToSet, sizeof(TI_UINT8), 1, nvsBinFile); - } -} - -VOID nvsFillTXParams(FILE *nvsBinFile, TI_UINT8 *nvsPtr, TI_UINT16 txParamLength) -{ - TI_UINT8 txParamValue; - TI_UINT8 valueToSet; - TI_UINT16 index; - - /* TX BiP type */ - txParamValue = eNVS_RADIO_TX_PARAMETERS; - os_fwrite(&txParamValue, sizeof(TI_UINT8), 1, nvsBinFile); - - /* TX Bip Length */ - os_fwrite(&txParamLength, sizeof(TI_UINT16), 1, nvsBinFile); - - for (index = 0; index < txParamLength; index++) - { - valueToSet = nvsPtr[index]; - os_fwrite(&valueToSet, sizeof(TI_UINT8), 1, nvsBinFile); - } -} - -VOID nvsFillDefaultRXParams(FILE *nvsBinFile) -{ - TI_UINT8 typeValue = eNVS_RADIO_RX_PARAMETERS; - TI_UINT16 lengthValue = NVS_RX_PARAM_LENGTH; - TI_UINT8 valueToSet = DEFAULT_EFUSE_VALUE; - TI_UINT8 rxParamIndex; - - /* RX type */ - os_fwrite(&typeValue, sizeof(TI_UINT8), 1, nvsBinFile); - - /* RX length */ - os_fwrite(&lengthValue, sizeof(TI_UINT16), 1, nvsBinFile); - - for (rxParamIndex = 0; rxParamIndex < lengthValue; rxParamIndex++) - { - os_fwrite(&valueToSet, sizeof(TI_UINT8), 1, nvsBinFile); - } -} - - -void nvsFillOldTXParams(FILE *nvsBinFile, const TI_UINT8 *buffer, const uint16 txParamLength) -{ - TI_UINT16 index; - TI_UINT8 rxTypeValue; - TI_UINT8 valueToSet; - TI_UINT16 tlvLength; - - /* TX BiP type */ - rxTypeValue = eNVS_RADIO_TX_PARAMETERS; - os_fwrite(&rxTypeValue, sizeof(TI_UINT8), 1, nvsBinFile); - - /* TX BIP Length */ - tlvLength = txParamLength; - os_fwrite(&tlvLength, sizeof(TI_UINT16), 1, nvsBinFile); - - for (index = 0; index < txParamLength; index++) - { - valueToSet = buffer[index]; - os_fwrite(&valueToSet, sizeof(TI_UINT8), 1, nvsBinFile); - } -} - - -VOID nvsFillDefaultTXParams(FILE *nvsBinFile, const uint16 txParamLength) -{ - TI_UINT32 index; - TI_UINT32 lengthOfP2Gtable = NVS_TX_P2G_TABLE_LENGTH; - TI_UINT8 p2GValue = 0; - TI_UINT32 lengthOfPPASTepTable = NVS_TX_PPA_STEPS_TABLE_LENGTH; - TI_UINT8 ppaStesValue = 0; - TI_UINT32 lengthOfPDBufferTable = NVS_TX_PD_TABLE_LENGTH_NVS_V2; - TI_UINT8 pdStesValue = 0; - TI_UINT8 typeValue = eNVS_RADIO_TX_PARAMETERS; - TI_UINT16 lengthValue = txParamLength; - TI_UINT8 perChannelGainOffsetValue = 0; - TI_UINT16 lengthOfGainOffsetTable = NUMBER_OF_RADIO_CHANNEL_INDEXS_E; - - /* TX type */ - os_fwrite(&typeValue, sizeof(TI_UINT8), 1, nvsBinFile); - - /* TX length */ - os_fwrite(&lengthValue, sizeof(TI_UINT16), 1, nvsBinFile); - - /* P2G table */ - for (index = 0; index < lengthOfP2Gtable; index++) - { - os_fwrite(&p2GValue, sizeof(TI_UINT8), 1, nvsBinFile); - } - - /* PPA steps table */ - for (index = 0; index < lengthOfPPASTepTable; index++) - { - os_fwrite(&ppaStesValue, sizeof(TI_UINT8), 1, nvsBinFile); - } - - /* Power Detector */ - for (index = 0; index < lengthOfPDBufferTable; index++) - { - os_fwrite(&pdStesValue, sizeof(TI_UINT8), 1, nvsBinFile); - } - - /* Per Channel Gain Offset */ - for (index = 0; index < lengthOfGainOffsetTable; index++) - { - os_fwrite(&perChannelGainOffsetValue, sizeof(TI_UINT8), 1, nvsBinFile); - } -} - -void nvsFillRXParams(FILE *nvsBinFile, uint8 *nvsPtr, uint16 rxLength) -{ - TI_UINT8 rxTypeValue; - TI_UINT8 valueToSet; - TI_UINT16 index; - - /* RX BiP type */ - rxTypeValue = eNVS_RADIO_RX_PARAMETERS; - os_fwrite(&rxTypeValue, sizeof(TI_UINT8), 1, nvsBinFile); - - /* RX Bip Length */ - os_fwrite(&rxLength, sizeof(TI_UINT16), 1, nvsBinFile); - - for (index = 0; index < rxLength; index++) - { - valueToSet = nvsPtr[index]; - os_fwrite(&valueToSet, sizeof(TI_UINT8), 1, nvsBinFile); - } -} - - -VOID nvsFillVersion(FILE *nvsBinFile, TI_UINT32 version) -{ - char versionBuffer[NVS_VERSION_PARAMETER_LENGTH]; - TI_UINT8 shift8; - TI_UINT8 valueToSet; - TI_UINT32 comparison; - TI_INT16 index; - TI_UINT16 lengthToSet; - - /* version type */ - valueToSet = eNVS_VERSION; - os_fwrite(&valueToSet, sizeof(TI_UINT8), 1, nvsBinFile); - - /* version length */ - lengthToSet = NVS_VERSION_PARAMETER_LENGTH; - os_fwrite(&lengthToSet, sizeof(TI_UINT16), 1, nvsBinFile); - - for (shift8 = 0, comparison = 0xff, index = NVS_VERSION_PARAMETER_LENGTH - 1;index >= 0; index--) - { - valueToSet = (version & comparison) >> shift8; - versionBuffer[index] = valueToSet; - - comparison <<= 8; - shift8 += 8; - } - - for (index = 0; index < NVS_VERSION_PARAMETER_LENGTH; index++) - { - os_fwrite(&versionBuffer[index], sizeof(TI_UINT8), 1, nvsBinFile); - } -} - - -VOID nvsWriteEndNVS(FILE *nvsBinFile) -{ - TI_UINT8 valueToSet; - TI_UINT16 lengthToSet; - - /* version type */ - valueToSet = eTLV_LAST; - os_fwrite(&valueToSet, sizeof(TI_UINT8), 1, nvsBinFile); - - valueToSet = eTLV_LAST; - os_fwrite(&valueToSet, sizeof(TI_UINT8), 1, nvsBinFile); - - /* version length */ - lengthToSet = 0; - os_fwrite(&lengthToSet, sizeof(TI_UINT16), 1, nvsBinFile); -} - -VOID nvsUpdateFile(THandle hCuCmd, TNvsStruct nvsStruct, TI_UINT8 version, S8 updatedProtocol) -{ -#ifdef _WINDOWS - PS8 nvsFilePath = (PS8)"/windows/nvs_map.bin"; -#else - PS8 nvsFilePath = (PS8)"./nvs_map.bin"; -#endif /*_WINDOWS*/ - TI_UINT8 currentNVSbuffer[1500]; - TI_UINT16 lengthOfCurrentNVSBufer; - TI_BOOL prevNVSIsValid; - TNvsStruct oldNVSParam[eNUMBER_RADIO_TYPE_PARAMETERS_INFO]; - FILE *nvsBinFile; - TI_UINT8 index; - TI_UINT8 valueToSet = 0; - TI_UINT16 nvsTXParamLength = NVS_TX_PARAM_LENGTH_NVS_V2; - TI_UINT16 oldNVSTXParamLength; - TI_UINT32 oldNVSVersion; - TI_UINT32 currentNVSVersion = NVS_VERSION_2; - - /* read previous NVS if exists */ - prevNVSIsValid = nvsReadFile(currentNVSbuffer, &lengthOfCurrentNVSBufer, nvsFilePath); - - if (prevNVSIsValid) - { - /* fill the TLV structure for the mode TX/RX */ - os_memset(oldNVSParam, 0, eNUMBER_RADIO_TYPE_PARAMETERS_INFO * sizeof(TNvsStruct)); - nvsParsePreviosOne(¤tNVSbuffer[NVS_PRE_PARAMETERS_LENGTH], oldNVSParam, &oldNVSVersion); - - if (currentNVSVersion == oldNVSVersion) - { - oldNVSTXParamLength = NVS_TX_PARAM_LENGTH_NVS_V2; - - /* if read all the parameter (needed) from the previous NVS */ - if ((oldNVSParam[eNVS_RADIO_TX_TYPE_PARAMETERS_INFO].Type != eNVS_RADIO_TX_PARAMETERS) || - (oldNVSParam[eNVS_RADIO_TX_TYPE_PARAMETERS_INFO].Length != nvsTXParamLength) || - (oldNVSParam[eNVS_RADIO_RX_TYPE_PARAMETERS_INFO].Type != eNVS_RADIO_RX_PARAMETERS) || - (oldNVSParam[eNVS_RADIO_RX_TYPE_PARAMETERS_INFO].Length != NVS_RX_PARAM_LENGTH)) - { - /* the parameters are wrong */ - prevNVSIsValid = TI_FALSE; - } - else - { - /* the parameters are right */ - prevNVSIsValid = TI_TRUE; - } - } - else - { - /* there isn't NVS */ - prevNVSIsValid = TI_FALSE; - } - } - - nvsBinFile = os_fopen(nvsFilePath, OS_FOPEN_WRITE_BINARY); - - if (NULL == nvsBinFile) - { - os_error_printf(CU_MSG_ERROR, (PS8)"\n Could not create FILE!!! !!!! \n"); - } - - /* fill MAC Address */ - nvsFillMACAddress(hCuCmd, nvsBinFile); - - /* fill end burst transaction zeros */ - for (index = 0; index < NVS_END_BURST_TRANSACTION_LENGTH; index++) - { - os_fwrite(&valueToSet, sizeof(TI_UINT8), 1, nvsBinFile); - } - - /* fill zeros to Align TLV start address */ - for (index = 0; index < NVS_ALING_TLV_START_ADDRESS_LENGTH; index++) - { - os_fwrite(&valueToSet, sizeof(TI_UINT8), 1, nvsBinFile); - } - - /* Getting from TX BiP Command */ - if(NVS_FILE_TX_PARAMETERS_UPDATE == updatedProtocol) - { - // Fill new TX BiP values - nvsFillTXParams(nvsBinFile, nvsStruct.Buffer, nvsStruct.Length); - - if (prevNVSIsValid) - { - /* set Parameters of RX from the previous file */ - nvsFillOldRxParams(nvsBinFile, oldNVSParam[eNVS_RADIO_RX_TYPE_PARAMETERS_INFO].Buffer, - oldNVSParam[eNVS_RADIO_RX_TYPE_PARAMETERS_INFO].Length); - } - else - { - nvsFillDefaultRXParams(nvsBinFile); - } - } - /* Getting from RX BiP Command */ - else if (NVS_FILE_RX_PARAMETERS_UPDATE == updatedProtocol) - { - if (prevNVSIsValid) - { - // set Parameters of TX from the previous file - nvsFillOldTXParams(nvsBinFile, oldNVSParam[eNVS_RADIO_TX_TYPE_PARAMETERS_INFO].Buffer, - oldNVSParam[eNVS_RADIO_TX_TYPE_PARAMETERS_INFO].Length); - } - else - { - nvsFillDefaultTXParams(nvsBinFile, nvsTXParamLength); - } - - /* Fill new RX BiP values */ - nvsFillRXParams(nvsBinFile, nvsStruct.Buffer, nvsStruct.Length); - - } - else /* NVS_FILE_WRONG_UPDATE == updatedProtocol */ - { - if (prevNVSIsValid) - { - /* set Parameters of TX from the previous file */ - nvsFillOldTXParams(nvsBinFile, - oldNVSParam[eNVS_RADIO_TX_TYPE_PARAMETERS_INFO].Buffer, - oldNVSParam[eNVS_RADIO_TX_TYPE_PARAMETERS_INFO].Length); - - /* set Parameters of RX from the previous file */ - nvsFillOldRxParams(nvsBinFile, - oldNVSParam[eNVS_RADIO_RX_TYPE_PARAMETERS_INFO].Buffer, - oldNVSParam[eNVS_RADIO_RX_TYPE_PARAMETERS_INFO].Length); - } - else - { - /* set default TX param */ - nvsFillDefaultTXParams(nvsBinFile,nvsTXParamLength); - - /* set default RX param */ - nvsFillDefaultRXParams(nvsBinFile); - } - } - - /* Fill the NVS version to the NVS */ - nvsFillVersion(nvsBinFile, version); - - /* End of NVS */ - nvsWriteEndNVS(nvsBinFile); - - /* close the file */ - os_fclose(nvsBinFile); -} - -VOID CuCmd_BIP_BufferCalReferencePoint(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ -#define NUM_OF_PARAMETERS_REF_POINT 3 - - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - TTestCmd data; - - if(nParms != NUM_OF_PARAMETERS_REF_POINT) - { - os_error_printf(CU_MSG_INFO2, (PS8)"Missing Param1: iReferencePointDetectorValue\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Missing Param2: iReferencePointPower\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Missing Param3: isubBand\n"); - return; - } - else - { - os_memset(&data, 0, sizeof(TTestCmd)); - data.testCmdId = TEST_CMD_UPDATE_PD_REFERENCE_POINT; -/* data.testCmd_u.PdBufferCalReferencePoint.iReferencePointDetectorValue = 189; - data.testCmd_u.PdBufferCalReferencePoint.iReferencePointPower = 12; - data.testCmd_u.PdBufferCalReferencePoint.isubBand = 0; 1- BG 2-*/ - - data.testCmd_u.PdBufferCalReferencePoint.iReferencePointDetectorValue = parm[0].value; - data.testCmd_u.PdBufferCalReferencePoint.iReferencePointPower = parm[1].value; - data.testCmd_u.PdBufferCalReferencePoint.isubBand = (U8)parm[2].value; - - if(OK != CuCommon_Radio_Test(pCuCmd->hCuCommon, &data)) - { - os_error_printf(CU_MSG_INFO2, (PS8)"BufferCalReferencePoint has failed\n"); - return; - } - - os_error_printf(CU_MSG_INFO2, (PS8)"BufferCalReferencePoint was configured succesfully\n"); - } - return; -} - - -/* P2G Calibration */ -VOID CuCmd_BIP_StartBIP(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - TTestCmd data; - U32 i; - - os_memset(&data, 0, sizeof(TTestCmd)); - - data.testCmdId = TEST_CMD_P2G_CAL; - - data.testCmd_u.P2GCal.iSubBandMask = 0; - for (i = 0; i < 8; i++) - { - data.testCmd_u.P2GCal.iSubBandMask |= (U8)parm[i].value << i; - } - - if (data.testCmd_u.P2GCal.iSubBandMask == 0) - { - os_error_printf(CU_MSG_INFO2, (PS8)"At least one sub-band should be enabled\n"); - return; - } - - if(OK != CuCommon_Radio_Test(pCuCmd->hCuCommon, &data)) - { - os_error_printf(CU_MSG_INFO2, (PS8)"Tx calibration start has failed\n"); - return; - } - - if (TI_OK != data.testCmd_u.P2GCal.oRadioStatus) { - os_error_printf(CU_MSG_INFO2, (PS8)"Tx calibration returned status: %d\n", data.testCmd_u.P2GCal.oRadioStatus); - return; - } - - nvsUpdateFile(hCuCmd,data.testCmd_u.P2GCal.oNvsStruct , (TI_UINT8)data.testCmd_u.P2GCal.oNVSVersion, NVS_FILE_TX_PARAMETERS_UPDATE); - -} - -VOID CuCmd_BIP_EnterRxBIP(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - TTestCmd data; - - os_memset(&data, 0, sizeof(TTestCmd)); - - data.testCmdId = TEST_CMD_RX_PLT_ENTER; - - if(OK != CuCommon_Radio_Test(pCuCmd->hCuCommon, &data)) - { - os_error_printf(CU_MSG_INFO2, (PS8)"Enter Rx calibration has failed\n"); - return; - } - - - if (TI_OK != data.testCmd_u.RxPlt.oRadioStatus) { - os_error_printf(CU_MSG_INFO2, (PS8)"Enter Rx calibration returned status: %d\n", data.testCmd_u.RxPlt.oRadioStatus); - return; - } - -} - - -VOID CuCmd_BIP_StartRxBIP(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - TTestCmd data; - - os_memset(&data, 0, sizeof(TTestCmd)); - - data.testCmdId = TEST_CMD_RX_PLT_CAL; - data.testCmd_u.RxPlt.iExternalSignalPowerLevel = (S32)parm[0].value; - - if(OK != CuCommon_Radio_Test(pCuCmd->hCuCommon, &data)) - { - os_error_printf(CU_MSG_INFO2, (PS8)"Rx calibration has failed\n"); - return; - } - - if (TI_OK != data.testCmd_u.RxPlt.oRadioStatus) { - os_error_printf(CU_MSG_INFO2, (PS8)"Rx calibration returned status: %d\n", data.testCmd_u.RxPlt.oRadioStatus); - return; - } - - nvsUpdateFile(hCuCmd, data.testCmd_u.RxPlt.oNvsStruct, (TI_UINT8)data.testCmd_u.RxPlt.oNVSVersion, NVS_FILE_RX_PARAMETERS_UPDATE); -} - -VOID CuCmd_BIP_ExitRxBIP(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - TTestCmd data; - - os_memset(&data, 0, sizeof(TTestCmd)); - - data.testCmdId = TEST_CMD_RX_PLT_EXIT; - - if(OK != CuCommon_Radio_Test(pCuCmd->hCuCommon, &data)) - { - os_error_printf(CU_MSG_INFO2, (PS8)"Exit Rx calibration has failed\n"); - return; - } - - - if (TI_OK != data.testCmd_u.RxPlt.oRadioStatus) { - os_error_printf(CU_MSG_INFO2, (PS8)"Exit Rx calibration returned status: %d\n", data.testCmd_u.RxPlt.oRadioStatus); - return; - } - -} - - - -VOID CuCmd_SetPrivacyAuth(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - U32 AuthMode; - - if( nParms ) - { - os_error_printf(CU_MSG_INFO2, (PS8)"Setting privacy authentication to %ld\n", parm[0].value); - AuthMode = parm[0].value; - if (pCuCmd->hWpaCore == NULL) - { - /* we can only accept WEP or OPEN configurations */ - if((AuthMode >= os802_11AuthModeOpen) && (AuthMode <= os802_11AuthModeAutoSwitch)) - { - if(OK != CuCommon_SetU32(pCuCmd->hCuCommon, RSN_EXT_AUTHENTICATION_MODE, AuthMode)) return; - } - else - { - os_error_printf(CU_MSG_ERROR, (PS8)"Error - CuCmd_SetPrivacyAuth - cannot set mode (%ld) when Suppl is not present\n", AuthMode); - return; - } - } - else - { -#ifndef NO_WPA_SUPPL - if(OK != WpaCore_SetAuthMode(pCuCmd->hWpaCore, AuthMode)) return; -#endif - } - } - else - { -#ifdef WPA_ENTERPRISE - static named_value_t auth_mode_type[] = { - { os802_11AuthModeOpen, (PS8)"Open" }, - { os802_11AuthModeShared, (PS8)"Shared" }, - { os802_11AuthModeAutoSwitch, (PS8)"AutoSwitch"}, - { os802_11AuthModeWPA, (PS8)"WPA" }, - { os802_11AuthModeWPAPSK, (PS8)"WPAPSK" }, - { os802_11AuthModeWPANone, (PS8)"WPANone" }, - { os802_11AuthModeWPA2, (PS8)"WPA2" }, - { os802_11AuthModeWPA2PSK, (PS8)"WPA2PSK" }, - }; -#else - static named_value_t auth_mode_type[] = { - { os802_11AuthModeOpen, (PS8)"Open" }, - { os802_11AuthModeShared, (PS8)"Shared" }, - { os802_11AuthModeWPAPSK, (PS8)"WPAPSK" }, - { os802_11AuthModeWPA2PSK, (PS8)"WPA2PSK" }, - }; -#endif - - if (pCuCmd->hWpaCore == NULL) - { - if(OK != CuCommon_GetU32(pCuCmd->hCuCommon, RSN_EXT_AUTHENTICATION_MODE, &AuthMode)) return; - } - else - { -#ifndef NO_WPA_SUPPL - if(OK != WpaCore_GetAuthMode(pCuCmd->hWpaCore, &AuthMode)) return; -#endif - } - - print_available_values(auth_mode_type); - os_error_printf(CU_MSG_INFO2, (PS8)"AuthenticationMode=%d\n", AuthMode ); - } -} - -VOID CuCmd_SetPrivacyEap(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - OS_802_11_EAP_TYPES EapType; - S32 i; - named_value_t EapType_type[] = { - { OS_EAP_TYPE_NONE, (PS8)"OS_EAP_TYPE_NONE" }, - { OS_EAP_TYPE_MD5_CHALLENGE, (PS8)"OS_EAP_TYPE_MD5_CHALLENGE" }, - { OS_EAP_TYPE_GENERIC_TOKEN_CARD, (PS8)"OS_EAP_TYPE_GENERIC_TOKEN_CARD" }, - { OS_EAP_TYPE_TLS, (PS8)"OS_EAP_TYPE_TLS" }, - { OS_EAP_TYPE_LEAP, (PS8)"OS_EAP_TYPE_LEAP" }, - { OS_EAP_TYPE_TTLS, (PS8)"OS_EAP_TYPE_TTLS" }, - { OS_EAP_TYPE_PEAP, (PS8)"OS_EAP_TYPE_PEAP" }, - { OS_EAP_TYPE_MS_CHAP_V2, (PS8)"OS_EAP_TYPE_MS_CHAP_V2" }, - { OS_EAP_TYPE_FAST, (PS8)"OS_EAP_TYPE_FAST" } - }; - - /* check if we have supplicant */ - if (pCuCmd->hWpaCore == NULL) - { - os_error_printf(CU_MSG_ERROR, (PS8)"Error - CuCmd_SetPrivacyEap - cannot set EapType when Suppl is not present\n"); - return; - } - - if( nParms ) - { - EapType = parm[0].value; - /* check if the param is valid */ - CU_CMD_FIND_NAME_ARRAY(i, EapType_type, EapType); - if(i == SIZE_ARR(EapType_type)) - { - os_error_printf(CU_MSG_INFO2, (PS8)"CuCmd_SetPrivacyEap, EapType %d is not defined!\n", EapType); - return; - } - -#ifndef NO_WPA_SUPPL - - if(OK != WpaCore_SetPrivacyEap(pCuCmd->hWpaCore, EapType)) - os_error_printf(CU_MSG_INFO2, (PS8)"Error Setting EapType to %ld\n", EapType); - else - os_error_printf(CU_MSG_INFO2, (PS8)"Setting EapType to %ld\n", EapType); - -#endif - /* - WEXT phase I - TI_SetEAPType( g_id_adapter, (OS_802_11_EAP_TYPES) parm[0].value ); - TI_SetEAPTypeDriver( g_id_adapter, (OS_802_11_EAP_TYPES) parm[0].value ); - */ - - } - else - { - print_available_values(EapType_type); - } -} - - -VOID CuCmd_SetPrivacyEncryption(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - U32 EncryptionType; -#ifndef NO_WPA_SUPPL - OS_802_11_ENCRYPTION_TYPES EncryptionTypePairWise; - OS_802_11_ENCRYPTION_TYPES EncryptionTypeGroup; -#endif - S32 i; - - if( nParms ) - { - EncryptionType = parm[0].value; - - /* check if the param is valid */ - CU_CMD_FIND_NAME_ARRAY(i, encrypt_type, EncryptionType); - if(i == SIZE_ARR(encrypt_type)) - { - os_error_printf(CU_MSG_INFO2, (PS8)"CuCmd_SetPrivacyEncryption, EncryptionType %d is not defined!\n", EncryptionType); - return; - } - - if (pCuCmd->hWpaCore == NULL) - { - if((EncryptionType == OS_ENCRYPTION_TYPE_NONE) || (EncryptionType == OS_ENCRYPTION_TYPE_WEP)) - { - if(OK != CuCommon_SetU32(pCuCmd->hCuCommon, RSN_ENCRYPTION_STATUS_PARAM, (U32)EncryptionType)) return; - } - else - { - os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - CuCmd_SetPrivacyEncryption - can't set EncryptionType %s when not connected to supplicant",encrypt_type[i].name); - return; - } - } - else - { -#ifndef NO_WPA_SUPPL - switch(EncryptionType) - { - case OS_ENCRYPTION_TYPE_NONE: - EncryptionTypePairWise = OS_ENCRYPTION_TYPE_NONE; - EncryptionTypeGroup = OS_ENCRYPTION_TYPE_NONE; - break; - case OS_ENCRYPTION_TYPE_WEP: - EncryptionTypePairWise = OS_ENCRYPTION_TYPE_WEP; - EncryptionTypeGroup = OS_ENCRYPTION_TYPE_WEP; - break; - case OS_ENCRYPTION_TYPE_TKIP: - EncryptionTypePairWise = OS_ENCRYPTION_TYPE_TKIP; - EncryptionTypeGroup = OS_ENCRYPTION_TYPE_TKIP; - break; - case OS_ENCRYPTION_TYPE_AES: - EncryptionTypePairWise = OS_ENCRYPTION_TYPE_AES; - EncryptionTypeGroup = OS_ENCRYPTION_TYPE_AES; - break; - } - - if(OK != WpaCore_SetEncryptionPairWise(pCuCmd->hWpaCore, EncryptionTypePairWise)) return; - if(OK != WpaCore_SetEncryptionGroup(pCuCmd->hWpaCore, EncryptionTypeGroup)) return; -#endif - - } - - os_error_printf(CU_MSG_INFO2, (PS8)"Setting privacy encryption to %ld\n", encrypt_type[i]); - } - else - { - if (pCuCmd->hWpaCore == NULL) - { - if(OK != CuCommon_GetU32(pCuCmd->hCuCommon, RSN_ENCRYPTION_STATUS_PARAM, &EncryptionType)) return; - - switch (EncryptionType) - { - case TWD_CIPHER_NONE: - EncryptionType = OS_ENCRYPTION_TYPE_NONE; - break; - case TWD_CIPHER_WEP: - case TWD_CIPHER_WEP104: - EncryptionType = OS_ENCRYPTION_TYPE_WEP; - break; - case TWD_CIPHER_TKIP: - EncryptionType = OS_ENCRYPTION_TYPE_TKIP; - break; - case TWD_CIPHER_AES_WRAP: - case TWD_CIPHER_AES_CCMP: - EncryptionType = OS_ENCRYPTION_TYPE_AES; - break; - default: - os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - CuCmd_SetPrivacyEncryption - unknown encryption type (%d)",EncryptionType); - break; - } - } - else - { -#ifndef NO_WPA_SUPPL - if(OK != WpaCore_GetEncryptionPairWise(pCuCmd->hWpaCore, &EncryptionTypePairWise)) return; - if(OK != WpaCore_GetEncryptionGroup(pCuCmd->hWpaCore, &EncryptionTypeGroup)) return; - - if((EncryptionTypePairWise == OS_ENCRYPTION_TYPE_NONE) && (EncryptionTypeGroup == OS_ENCRYPTION_TYPE_NONE)) - EncryptionType = OS_ENCRYPTION_TYPE_NONE; - else if((EncryptionTypePairWise == OS_ENCRYPTION_TYPE_WEP) && (EncryptionTypeGroup == OS_ENCRYPTION_TYPE_WEP)) - EncryptionType = OS_ENCRYPTION_TYPE_WEP; - else if((EncryptionTypePairWise == OS_ENCRYPTION_TYPE_TKIP) && (EncryptionTypeGroup == OS_ENCRYPTION_TYPE_TKIP)) - EncryptionType = OS_ENCRYPTION_TYPE_TKIP; - else if((EncryptionTypePairWise == OS_ENCRYPTION_TYPE_AES) && (EncryptionTypeGroup == OS_ENCRYPTION_TYPE_AES)) - EncryptionType = OS_ENCRYPTION_TYPE_AES; - else - { - os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - CuCmd_SetPrivacyEncryption - unknown encryption type (%d,%d)",EncryptionTypePairWise, EncryptionTypeGroup); - return; - } -#endif - } - - print_available_values(encrypt_type); - os_error_printf(CU_MSG_INFO2, (PS8)"Encryption = %d\n", EncryptionType); - } -} - -VOID CuCmd_SetPrivacyKeyType(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - OS_802_11_KEY_TYPES KeyType; - S32 i; - static named_value_t KeyType_type[] = { - { OS_KEY_TYPE_STATIC, (PS8)"STATIC" }, - { OS_KEY_TYPE_DYNAMIC, (PS8)"DYNAMIC"} - }; - - /* check if we have supplicant */ - if (pCuCmd->hWpaCore == NULL) - { - os_error_printf(CU_MSG_ERROR, (PS8)"Error - CuCmd_SetPrivacyEncryptGroup - cannot set encryption Group when Suppl is not present\n"); - return; - } - - if( nParms ) - { - KeyType = parm[0].value; - /* check if the param is valid */ - CU_CMD_FIND_NAME_ARRAY(i, KeyType_type, KeyType); - if(i == SIZE_ARR(KeyType_type)) - { - os_error_printf(CU_MSG_INFO2, (PS8)"CuCmd_SetPrivacyKeyType - KeyType %d is not defined!\n", KeyType); - return; - } - - os_error_printf(CU_MSG_INFO2, (PS8)"Setting KeyType to %ld\n", KeyType); - - /* - WEXT phase I - TI_SetKeyType( g_id_adapter, (OS_802_11_KEY_TYPES)parm[0].value ); - */ - } - else - { - print_available_values(KeyType_type); - } -} - -VOID CuCmd_SetPrivacyMixedMode(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - U32 MixedMode; - - if( nParms ) - { - MixedMode = parm[0].value; - os_error_printf(CU_MSG_INFO2, (PS8)"Setting MixedMode to %s\n", (MixedMode)?"True":"False"); - - CuCommon_SetU32(pCuCmd->hCuCommon, TIWLN_802_11_MIXED_MODE_SET, MixedMode); - } - else - { - if(OK != CuCommon_GetU32(pCuCmd->hCuCommon, TIWLN_802_11_MIXED_MODE_GET, &MixedMode)) return; - - os_error_printf(CU_MSG_INFO2, (PS8)"Mixed Mode: 0 - FALSE, 1 - TRUE\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Mixed Mode =%s\n", (MixedMode)?"True":"False"); - } -} - -VOID CuCmd_SetPrivacyAnyWpaMode(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; -#ifndef NO_WPA_SUPPL - U32 anyWpaMode; - - if( nParms ) - { - anyWpaMode = parm[0].value; - os_error_printf(CU_MSG_INFO2, (PS8)"Setting anyWpaMode to %s\n", (anyWpaMode)?"True":"False"); - - WpaCore_SetAnyWpaMode(pCuCmd->hWpaCore,(U8)anyWpaMode); - } - else - { - WpaCore_GetAnyWpaMode(pCuCmd->hWpaCore,(U8 *)&anyWpaMode); - os_error_printf(CU_MSG_INFO2, (PS8)"Any WPA Mode: 0 - FALSE, 1 - TRUE\n"); - os_error_printf(CU_MSG_INFO2, (PS8)"Any WPA =%s\n", (anyWpaMode)?"True":"False"); - } -#else - os_error_printf(CU_MSG_INFO2, (PS8)"Any Wpa Mode support only in Linux supplicants\n"); -#endif -} - -VOID CuCmd_SetPrivacyCredentials(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - - if( nParms == 0 ) - return; - - if (pCuCmd->hWpaCore == NULL) - { - os_error_printf(CU_MSG_ERROR, (PS8)"Error - CuCmd_SetPrivacyPskPassPhrase - cannot set Credential password phrase when Suppl is not present\n"); - return; - } - -#ifndef NO_WPA_SUPPL - - if( nParms == 2 ) - { - WpaCore_SetCredentials(pCuCmd->hWpaCore,(PU8)(parm[0].value),(PU8)(parm[1].value)); - } - else if( nParms == 1 ) - { - WpaCore_SetCredentials(pCuCmd->hWpaCore,(PU8)(parm[0].value),NULL); - } -#endif -} - -VOID CuCmd_SetPrivacyPskPassPhrase(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - U32 IsHexKey = FALSE; - U8 buf[WPACORE_MAX_PSK_STRING_LENGTH]; - PS8 pPassphrase; - S32 len; - - if( nParms == 0 ) - return; - - /* check if we have supplicant */ - if (pCuCmd->hWpaCore == NULL) - { - os_error_printf(CU_MSG_ERROR, (PS8)"Error - CuCmd_SetPrivacyPskPassPhrase - cannot set PSK password phrase when Suppl is not present\n"); - return; - } - - len = os_strlen((PS8)(parm[0].value)); - pPassphrase = ((PS8)parm[0].value); - os_memset(buf, 0, WPACORE_MAX_PSK_STRING_LENGTH); - - - if( nParms == 2 ) - { - if( !os_strcmp( (PS8) parm[1].value, (PS8)"hex") ) - IsHexKey = TRUE; - else if(!os_strcmp( (PS8) parm[1].value, (PS8)"text")) - IsHexKey = FALSE; - } - - if( IsHexKey ) - { - U8 val_l; - U8 val_u; - S32 i; - - if( len != WPACORE_PSK_HEX_LENGTH ) - { - os_error_printf(CU_MSG_INFO2, (PS8)"The hexa PSKPassphrase must be at length of %d hexa digits \n",WPACORE_PSK_HEX_LENGTH); - return; - } - - for( i=0; *pPassphrase; i++, pPassphrase++ ) - { - val_u = CuCmd_Char2Hex(*pPassphrase); - if( val_u == ((U8)-1) ) return; - val_l = CuCmd_Char2Hex(*(++pPassphrase)); - if( val_l == ((U8)-1) ) return; - buf[i] = ((val_u << 4) | val_l); - } - } - else - { - if (len > WPACORE_MAX_PSK_STRING_LENGTH || len < WPACORE_MIN_PSK_STRING_LENGTH) - { - os_error_printf(CU_MSG_INFO2, (PS8)"The PSKPassphrase must be between %d to %d chars \n", WPACORE_MIN_PSK_STRING_LENGTH, WPACORE_MAX_PSK_STRING_LENGTH); - return; - } - - os_memcpy((PVOID)buf, (PVOID)pPassphrase, len); - } - - os_error_printf(CU_MSG_INFO2, (PS8)"Setting PSKPassphrase to %s\n", (PS8) parm[0].value); -#ifndef NO_WPA_SUPPL - WpaCore_SetPskPassPhrase(pCuCmd->hWpaCore, buf); -#endif - -} - -VOID CuCmd_SetPrivacyCertificate(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - - if( nParms == 0 ) - return; - - if (pCuCmd->hWpaCore == NULL) - { - os_error_printf(CU_MSG_ERROR, (PS8)"Error - CuCmd_SetPrivacyPskPassPhrase - cannot set Certification when Suppl is not present\n"); - return; - } -#ifndef NO_WPA_SUPPL - WpaCore_SetCertificate(pCuCmd->hWpaCore,(PU8)(parm[0].value)); -#endif - - -} - -VOID CuCmd_StopSuppl(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - - /* check if we have supplicant */ - if (pCuCmd->hWpaCore == NULL) - { - os_error_printf(CU_MSG_ERROR, (PS8)"Error - CuCmd_StopSuppl - cannot stop supplicant when Suppl is not present :-)\n"); - return; - } -#ifndef NO_WPA_SUPPL - WpaCore_StopSuppl(pCuCmd->hWpaCore); -#endif -} - -VOID CuCmd_ChangeSupplDebugLevels(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - - /* check if we have supplicant */ - if (pCuCmd->hWpaCore == NULL) - { - os_error_printf(CU_MSG_ERROR, (PS8)"Error - CuCmd_DebugSuppl - cannot debug supplicant when Suppl is not present :-)\n"); - return; - } -#ifndef NO_WPA_SUPPL - WpaCore_ChangeSupplDebugLevels(pCuCmd->hWpaCore, parm[0].value, parm[1].value, parm[2].value); -#endif -} - -VOID CuCmd_AddPrivacyKey(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - PS8 buf; - U32 key_id = 0; - U32 def_flag = 0; - U32 IsHexKey = TRUE; - OS_802_11_WEP data; - U8 val_l, val_u; - S32 len; - - buf = (PS8)parm[0].value; - key_id = (U32)parm[1].value; - if( parm[2].value ) def_flag = 0x80000000; - os_memset(data.KeyMaterial,0,sizeof(data.KeyMaterial)); - len = os_strlen((PS8)buf); - - if(key_id > 3) - { - os_error_printf(CU_MSG_INFO2, (PS8)"the key index must be between 0 and 3\n"); - return; - } - - if( nParms >= 4 ) - { - if( !os_strcmp( (PS8) parm[3].value, (PS8)"hex") ) - IsHexKey = TRUE; - else if( !os_strcmp( (PS8) parm[3].value, (PS8)"HEX") ) - IsHexKey = TRUE; - else if(!os_strcmp( (PS8) parm[3].value, (PS8)"text")) - IsHexKey = FALSE; - else if(!os_strcmp( (PS8) parm[3].value, (PS8)"TEXT")) - IsHexKey = FALSE; - } - - if( IsHexKey ) - { - S32 i; - - if( len % 2 ) - { - os_error_printf(CU_MSG_INFO2, (PS8)"The hexa key should be even length\n"); - return; - } - if(len <= 10) /*10 is number of character for key length 40 bit*/ - data.KeyLength = 5; - else if(len <= 26) /*26 is number of character for key length 128 bit*/ - data.KeyLength = 13; - else if(len <= 58) /*58 is number of character for key length 256 bit*/ - data.KeyLength = 29; - else - { - os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - CuCmd_AddPrivacyKey - key length not valid\n" ); - return; - } - - for( i=0; *buf; i++, buf++ ) - { - val_u = CuCmd_Char2Hex(*buf); - if(val_u == ((U8)-1)) return; - val_l = CuCmd_Char2Hex(*(++buf)); - if(val_l == ((U8)-1)) return; - data.KeyMaterial[i] = ((val_u << 4) | val_l); - } - } - else /* for ascii key */ - { - if(len <= 5) /*10 is number of character for key length 40 bit*/ - data.KeyLength = 5; - else if(len <= 13) /*26 is number of character for key length 128 bit*/ - data.KeyLength = 13; - else if(len <= 29) /*58 is number of character for key length 256 bit*/ - data.KeyLength = 29; - else - { - os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - CuCmd_AddPrivacyKey - key length not valid\n" ); - return; - } - os_memcpy((PVOID)data.KeyMaterial, (PVOID)buf, len); - } - - data.KeyIndex = def_flag | key_id; - data.Length = sizeof(OS_802_11_WEP); - - /* check if we have supplicant */ - if (pCuCmd->hWpaCore == NULL) - { - CuCommon_AddKey(pCuCmd->hCuCommon, &data); - } - else - { -#ifndef NO_WPA_SUPPL - WpaCore_AddKey(pCuCmd->hWpaCore, &data); -#endif - } -} - -VOID CuCmd_RemovePrivacyKey(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - - /* check if we have supplicant */ - CuCommon_RemoveKey(pCuCmd->hCuCommon, parm[0].value); -} - -VOID CuCmd_GetPrivacyDefaultKey(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - U32 DefaultKeyId; - - /* check if we have supplicant */ - if (pCuCmd->hWpaCore == NULL) - { - if(OK != CuCommon_GetU32(pCuCmd->hCuCommon, RSN_DEFAULT_KEY_ID, &DefaultKeyId)) return; - } - else - { -#ifndef NO_WPA_SUPPL - if(OK != WpaCore_GetDefaultKey(pCuCmd->hWpaCore, &DefaultKeyId)) return; -#endif - } - - os_error_printf(CU_MSG_INFO2, (PS8)"WEP default key ID = %d\n", DefaultKeyId ); -} - -VOID CuCmd_EnableKeepAlive (THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - - if (OK != CuCommon_SetU32 (pCuCmd->hCuCommon, POWER_MGR_KEEP_ALIVE_ENA_DIS, 1)) - { - os_error_printf (CU_MSG_ERROR, (PS8)"Unable to enable keep-alive messages\n"); - } -} - -VOID CuCmd_DisableKeepAlive (THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - - if (OK != CuCommon_SetU32 (pCuCmd->hCuCommon, POWER_MGR_KEEP_ALIVE_ENA_DIS, 0)) - { - os_error_printf (CU_MSG_ERROR, (PS8)"Unable to disable keep-alive messages\n"); - } -} - -VOID CuCmd_AddKeepAliveMessage (THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t *pCuCmd = (CuCmd_t*)hCuCmd; - TKeepAliveTemplate keepAliveParams; - - if (4 != nParms) - { - os_error_printf (CU_MSG_ERROR, (PS8)"Number of params to add keep-alive message is %d\n", nParms); - return; - } - - /* copy keep-alive params */ - keepAliveParams.keepAliveParams.index = (U8)parm[ 0 ].value; - keepAliveParams.keepAliveParams.interval = parm[ 1 ].value; - keepAliveParams.keepAliveParams.trigType = parm[ 2 ].value; - keepAliveParams.keepAliveParams.enaDisFlag = 1; /* set to enable */ - keepAliveParams.msgBufferLength = os_strlen ((PS8)parm[ 3 ].value); - if (0 == (keepAliveParams.msgBufferLength %2)) - { - keepAliveParams.msgBufferLength = keepAliveParams.msgBufferLength / 2; - } - else - { - keepAliveParams.msgBufferLength = (keepAliveParams.msgBufferLength / 2) + 1; - } - /* convert the string to hexadeciaml values, and copy it */ - CuCmd_atox_string ((U8*)parm[ 3 ].value, &keepAliveParams.msgBuffer[ 0 ]); - - if (TI_OK != CuCommon_SetBuffer(pCuCmd->hCuCommon, POWER_MGR_KEEP_ALIVE_ADD_REM, - &(keepAliveParams), sizeof(TKeepAliveTemplate))) - { - os_error_printf (CU_MSG_ERROR, (PS8)"Unable to add keep-alive message\n"); - } -} - -VOID CuCmd_RemoveKeepAliveMessage (THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t *pCuCmd = (CuCmd_t*)hCuCmd; - TKeepAliveTemplate keepAliveParams; - - if (1 != nParms) - { - os_error_printf (CU_MSG_ERROR, (PS8)"Number of params to remove keep-alive message is %d\n", nParms); - return; - } - - /* copy keep-alive params */ - keepAliveParams.keepAliveParams.index = (U8)parm[ 0 ].value; - keepAliveParams.keepAliveParams.enaDisFlag = 0; /* set to disable */ - keepAliveParams.keepAliveParams.interval = 1000; /* FW validate all parameters, so some reasonable values must be used */ - keepAliveParams.keepAliveParams.trigType = KEEP_ALIVE_TRIG_TYPE_PERIOD_ONLY; - - if (OK != CuCommon_SetBuffer (pCuCmd->hCuCommon, POWER_MGR_KEEP_ALIVE_ADD_REM, - &(keepAliveParams), sizeof(TKeepAliveTemplate))) - { - os_error_printf (CU_MSG_ERROR, (PS8)"Unable to remove keep-alive message\n"); - } -} - -VOID CuCmd_ShowKeepAlive (THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t *pCuCmd = (CuCmd_t*)hCuCmd; - TKeepAliveConfig tConfig; - U32 uIndex, uNameIndex; - S8 msgBuffer[ KEEP_ALIVE_TEMPLATE_MAX_LENGTH * 2 ]; - - if (OK != CuCommon_GetSetBuffer (pCuCmd->hCuCommon, POWER_MGR_KEEP_ALIVE_GET_CONFIG, - &(tConfig), sizeof(TKeepAliveConfig))) - { - os_error_printf (CU_MSG_ERROR, (PS8)"Unable to read keep-alive configuration\n"); - } - - os_error_printf (CU_MSG_ERROR, (PS8)"Keep-Alive configuration:\n" - "-------------------------\n"); - if (TRUE == tConfig.enaDisFlag) - { - os_error_printf (CU_MSG_ERROR, (PS8)"Keep-Alive global flag set to enabled\n\n"); - } - else - { - os_error_printf (CU_MSG_ERROR, (PS8)"Keep-Alive global flag set to disabled\n\n"); - } - - os_error_printf (CU_MSG_ERROR, (PS8)"%-8s %-8s %-9s %-10s %s\n", (PS8)"Index", (PS8)"Enabled", (PS8)"Trig Type", (PS8)"Interval", (PS8)"Pattern"); - os_error_printf (CU_MSG_ERROR, (PS8)"-----------------------------------------------\n"); - for (uIndex = 0; uIndex < KEEP_ALIVE_MAX_USER_MESSAGES; uIndex++) - { - if (TRUE == tConfig.templates[ uIndex ].keepAliveParams.enaDisFlag) - { - CU_CMD_FIND_NAME_ARRAY (uNameIndex, tKeepAliveTriggerTypes, - tConfig.templates[ uIndex ].keepAliveParams.trigType); - CuCmd_xtoa_string (&(tConfig.templates[ uIndex ].msgBuffer[ 0 ]), - tConfig.templates[ uIndex ].msgBufferLength, (U8*)&(msgBuffer[ 0 ])); - os_error_printf (CU_MSG_ERROR, (PS8)"%-8d %-8d %-9s %-10d %s\n", uIndex, - tConfig.templates[ uIndex ].keepAliveParams.enaDisFlag, - tKeepAliveTriggerTypes[ uNameIndex ].name, - tConfig.templates[ uIndex ].keepAliveParams.interval, - &(msgBuffer[ 0 ])); - } - else - { - os_error_printf (CU_MSG_ERROR, (PS8)"%-8d %-8d %-9s %-10d %s\n", uIndex, 0, (PS8)"N/A", 0, (PS8)"N/A"); - } - } -} - - -VOID CuCmd_SetArpIPFilter (THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - - TIpAddr staIp; - CuCmd_t *pCuCmd = (CuCmd_t*)hCuCmd; - TI_UINT8 length = 4; - - if (length != nParms) - { - os_error_printf (CU_MSG_ERROR, (PS8)"Error! IP format requires 4 parameters as follows: <Part1> <Part2> <Part3> <Part4> \n"); - os_error_printf (CU_MSG_ERROR, (PS8)"Please note! IP of 0 0 0 0 will disable the arp filtering feature \n"); - return; - } - - staIp[0] = (TI_UINT8)parm[0].value; - staIp[1] = (TI_UINT8)parm[1].value; - staIp[2] = (TI_UINT8)parm[2].value; - staIp[3] = (TI_UINT8)parm[3].value; - - - if (OK != CuCommon_SetBuffer (pCuCmd->hCuCommon, SITE_MGR_SET_WLAN_IP_PARAM, staIp, length)) - { - os_error_printf (CU_MSG_ERROR, (PS8)"Unable to configure ARP IP filter \n"); - } - -} - -VOID CuCmd_ShowAbout(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - S8 FwVesrion[FW_VERSION_LEN]; - - if(OK != CuCommon_GetBuffer(pCuCmd->hCuCommon, SITE_MGR_FIRMWARE_VERSION_PARAM, - FwVesrion, FW_VERSION_LEN)) return; - -#ifdef XCC_MODULE_INCLUDED - os_error_printf(CU_MSG_INFO2, (PS8)"Driver version: %s_XCC\n", - SW_VERSION_STR); -#elif GEM_SUPPORTED - os_error_printf(CU_MSG_INFO2, (PS8)"Driver version: %s_GEM\n", - SW_VERSION_STR); -#else - os_error_printf(CU_MSG_INFO2, (PS8)"Driver version: %s_NOCCX\n", - SW_VERSION_STR); -#endif/* XCC_MODULE_INCLUDED*/ - os_error_printf(CU_MSG_INFO2, (PS8)"Firmware version: %s\n", - FwVesrion); - -} - -VOID CuCmd_Quit(THandle hCuCmd, ConParm_t parm[], U16 nParms) -{ - CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; - - Console_Stop(pCuCmd->hConsole); -} - - diff --git a/wl1271/CUDK/configurationutility/src/cu_common.c b/wl1271/CUDK/configurationutility/src/cu_common.c deleted file mode 100644 index 5357126a..00000000 --- a/wl1271/CUDK/configurationutility/src/cu_common.c +++ /dev/null @@ -1,465 +0,0 @@ -/* - * cu_common.c - * - * Copyright 2001-2009 Texas Instruments, Inc. - http://www.ti.com/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/**************************************************************************** -* -* MODULE: CU_Common.c -* -* PURPOSE: -* -* DESCRIPTION: -* ============ -* -* -****************************************************************************/ - -/* includes */ -/************/ -#include "cu_osapi.h" -#include "oserr.h" - -#include "TWDriver.h" -#include "convert.h" - -#include "ipc_sta.h" -#include "cu_common.h" - -/* defines */ -/***********/ - -/* local types */ -/***************/ -/* Module control block */ -typedef struct CuCommon_t -{ - THandle hIpcSta; -} CuCommon_t; - - -typedef enum -{ - DRIVER_STATUS_IDLE = 0, - DRIVER_STATUS_RUNNING = 1 -} PARAM_OUT_Driver_Status_e; - - -/* local variables */ -/*******************/ - -/* local fucntions */ -/*******************/ - - -/* functions */ -/*************/ -THandle CuCommon_Create(THandle *pIpcSta, const PS8 device_name) -{ - CuCommon_t* pCuCommon = (CuCommon_t*)os_MemoryCAlloc(sizeof(CuCommon_t), sizeof(U8)); - if(pCuCommon == NULL) - { - os_error_printf(CU_MSG_ERROR, (PS8)("ERROR - CuCommon_Create - cant allocate control block\n") ); - return NULL; - } - - pCuCommon->hIpcSta = IpcSta_Create(device_name); - if(pCuCommon->hIpcSta == NULL) - { - CuCommon_Destroy(pCuCommon); - return NULL; - } - *pIpcSta = pCuCommon->hIpcSta; - - return pCuCommon; -} - -VOID CuCommon_Destroy(THandle hCuCommon) -{ - CuCommon_t* pCuCommon = (CuCommon_t*)hCuCommon; - - if(pCuCommon->hIpcSta) - IpcSta_Destroy(pCuCommon->hIpcSta); - - os_MemoryFree(pCuCommon); -} - -S32 CuCommon_SetU32(THandle hCuCommon, U32 PrivateIoctlId, U32 Data) -{ - CuCommon_t* pCuCommon = (CuCommon_t*)hCuCommon; - S32 res; - - res = IPC_STA_Private_Send(pCuCommon->hIpcSta, PrivateIoctlId, &Data, sizeof(U32), - NULL, 0); - - if(res == EOALERR_IPC_STA_ERROR_SENDING_WEXT) - return ECUERR_CU_COMMON_ERROR; - - return OK; -} - -S32 CuCommon_GetU32(THandle hCuCommon, U32 PrivateIoctlId, PU32 pData) -{ - CuCommon_t* pCuCommon = (CuCommon_t*)hCuCommon; - S32 res; - - res = IPC_STA_Private_Send(pCuCommon->hIpcSta, PrivateIoctlId, NULL, 0, - pData, sizeof(U32)); - - if(res == EOALERR_IPC_STA_ERROR_SENDING_WEXT) - return ECUERR_CU_COMMON_ERROR; - - return OK; -} - -S32 CuCommon_SetU16(THandle hCuCommon, U32 PrivateIoctlId, U16 Data) -{ - CuCommon_t* pCuCommon = (CuCommon_t*)hCuCommon; - S32 res; - - res = IPC_STA_Private_Send(pCuCommon->hIpcSta, PrivateIoctlId, &Data, sizeof(U16), - NULL, 0); - - if(res == EOALERR_IPC_STA_ERROR_SENDING_WEXT) - return ECUERR_CU_COMMON_ERROR; - - return OK; -} - -S32 CuCommon_SetU8(THandle hCuCommon, U32 PrivateIoctlId, U8 Data) -{ - CuCommon_t* pCuCommon = (CuCommon_t*)hCuCommon; - S32 res; - - res = IPC_STA_Private_Send(pCuCommon->hIpcSta, PrivateIoctlId, &Data, sizeof(U8), - NULL, 0); - - if(res == EOALERR_IPC_STA_ERROR_SENDING_WEXT) - return ECUERR_CU_COMMON_ERROR; - - return OK; -} - - -S32 CuCommon_GetU8(THandle hCuCommon, U32 PrivateIoctlId, PU8 pData) -{ - CuCommon_t* pCuCommon = (CuCommon_t*)hCuCommon; - S32 res; - - res = IPC_STA_Private_Send(pCuCommon->hIpcSta, PrivateIoctlId, NULL, 0, - pData, sizeof(U8)); - - if(res == EOALERR_IPC_STA_ERROR_SENDING_WEXT) - return ECUERR_CU_COMMON_ERROR; - - return OK; -} - - -S32 CuCommon_SetBuffer(THandle hCuCommon, U32 PrivateIoctlId, PVOID pBuffer, U32 len) -{ - CuCommon_t* pCuCommon = (CuCommon_t*)hCuCommon; - S32 res; - - res = IPC_STA_Private_Send(pCuCommon->hIpcSta, PrivateIoctlId, pBuffer, len, - NULL, 0); - - if(res == EOALERR_IPC_STA_ERROR_SENDING_WEXT) - return ECUERR_CU_COMMON_ERROR; - - return OK; -} - -S32 CuCommon_GetBuffer(THandle hCuCommon, U32 PrivateIoctlId, PVOID pBuffer, U32 len) -{ - CuCommon_t* pCuCommon = (CuCommon_t*)hCuCommon; - S32 res; - - res = IPC_STA_Private_Send(pCuCommon->hIpcSta, PrivateIoctlId, NULL, 0, - pBuffer, len); - - if(res == EOALERR_IPC_STA_ERROR_SENDING_WEXT) - return ECUERR_CU_COMMON_ERROR; - - return OK; -} - -S32 CuCommon_GetSetBuffer(THandle hCuCommon, U32 PrivateIoctlId, PVOID pBuffer, U32 len) -{ - CuCommon_t* pCuCommon = (CuCommon_t*)hCuCommon; - S32 res; - - res = IPC_STA_Private_Send(pCuCommon->hIpcSta, PrivateIoctlId, pBuffer, len, - pBuffer, len); - - if(res == EOALERR_IPC_STA_ERROR_SENDING_WEXT) - return ECUERR_CU_COMMON_ERROR; - - return OK; -} - -S32 CuCommon_Get_BssidList_Size(THandle hCuCommon, PU32 pSizeOfBssiList) -{ - CuCommon_t* pCuCommon = (CuCommon_t*)hCuCommon; - S32 res; - - res = IPC_STA_Private_Send(pCuCommon->hIpcSta, SCAN_CNCN_BSSID_LIST_SIZE_PARAM, NULL, 0, - pSizeOfBssiList, sizeof(U32)); - - if(res == EOALERR_IPC_STA_ERROR_SENDING_WEXT) - return ECUERR_CU_COMMON_ERROR; - - return OK; -} - -S32 CuCommon_GetRssi(THandle hCuCommon, PS8 pdRssi, PS8 pbRssi) -{ - CuCommon_t* pCuCommon = (CuCommon_t*)hCuCommon; - S32 res; - TCuCommon_RoamingStatisticsTable buffer; - - res = IPC_STA_Private_Send(pCuCommon->hIpcSta, TIWLN_802_11_RSSI, NULL, 0, - &buffer, sizeof(TCuCommon_RoamingStatisticsTable)); - if(res == EOALERR_IPC_STA_ERROR_SENDING_WEXT) - return ECUERR_CU_COMMON_ERROR; - - *pdRssi = (S8)buffer.rssi; - *pbRssi = (S8)buffer.rssiBeacon; - - return OK; -} - -S32 CuCommon_GetSnr(THandle hCuCommon, PU32 pdSnr, PU32 pbSnr) -{ - CuCommon_t* pCuCommon = (CuCommon_t*)hCuCommon; - S32 res; - TCuCommon_RoamingStatisticsTable buffer; - - res = IPC_STA_Private_Send(pCuCommon->hIpcSta, TWD_SNR_RATIO_PARAM, NULL, 0, - &buffer, sizeof(TCuCommon_RoamingStatisticsTable)); - if(res == EOALERR_IPC_STA_ERROR_SENDING_WEXT) - return ECUERR_CU_COMMON_ERROR; - - *pdSnr = (U32)buffer.snr; - *pbSnr = (U32)buffer.snrBeacon; - - return OK; -} - -S32 CuCommon_GetTxStatistics(THandle hCuCommon, TIWLN_TX_STATISTICS* pTxCounters, U32 doReset) -{ - CuCommon_t* pCuCommon = (CuCommon_t*)hCuCommon; - S32 res; - - res = IPC_STA_Private_Send(pCuCommon->hIpcSta, TIWLN_802_11_TX_STATISTICS, pTxCounters, sizeof(TIWLN_TX_STATISTICS), - pTxCounters, sizeof(TIWLN_TX_STATISTICS)); - - if(res == EOALERR_IPC_STA_ERROR_SENDING_WEXT) - return ECUERR_CU_COMMON_ERROR; - - if(doReset) - { - res = IPC_STA_Private_Send(pCuCommon->hIpcSta, TX_CTRL_RESET_COUNTERS_PARAM, NULL, 0, - NULL, 0); - if(res == EOALERR_IPC_STA_ERROR_SENDING_WEXT) - return ECUERR_CU_COMMON_ERROR; - } - - return OK; -} - -S32 CuCommon_Radio_Test(THandle hCuCommon,TTestCmd* data) -{ - CuCommon_t* pCuCommon = (CuCommon_t*)hCuCommon; - S32 res; - - res = IPC_STA_Private_Send(pCuCommon->hIpcSta, - TWD_RADIO_TEST_PARAM, - (PVOID)data, - sizeof(TTestCmd), - (PVOID)data, - sizeof(TTestCmd)); - - if(res == EOALERR_IPC_STA_ERROR_SENDING_WEXT) - { - os_error_printf(CU_MSG_INFO2, (PS8)"In CuCommon_Radio_Test: IPC_STA_Private_Send failed\n"); - return ECUERR_CU_COMMON_ERROR; - } - - return OK; -} - -S32 CuCommon_AddKey(THandle hCuCommon, OS_802_11_WEP* pKey) -{ - CuCommon_t* pCuCommon = (CuCommon_t*)hCuCommon; - S32 res; - OS_802_11_KEY key; - - os_memset(&key, 0, sizeof(OS_802_11_KEY)); - - key.Length = pKey->Length; - key.KeyIndex = (pKey->KeyIndex & 0x80000000) | (pKey->KeyIndex & 0x3FFFFFFF); - key.KeyLength = pKey->KeyLength; - os_memcpy(key.KeyMaterial, pKey->KeyMaterial, pKey->KeyLength); - - res = IPC_STA_Private_Send(pCuCommon->hIpcSta, RSN_ADD_KEY_PARAM, &key, sizeof(OS_802_11_KEY), - NULL, 0); - - if(res == EOALERR_IPC_STA_ERROR_SENDING_WEXT) - return ECUERR_CU_COMMON_ERROR; - - return OK; -} - -S32 CuCommon_RemoveKey(THandle hCuCommon, U32 KeyIndex) -{ - CuCommon_t* pCuCommon = (CuCommon_t*)hCuCommon; - S32 res; - OS_802_11_KEY key; - - os_memset(&key, 0, sizeof(OS_802_11_KEY)); - key.KeyIndex = KeyIndex; - - res = IPC_STA_Private_Send(pCuCommon->hIpcSta, RSN_REMOVE_KEY_PARAM, &key, sizeof(OS_802_11_KEY), - NULL, 0); - - if(res == EOALERR_IPC_STA_ERROR_SENDING_WEXT) - return ECUERR_CU_COMMON_ERROR; - - return OK; -} - -S32 CuCommon_GetDfsChannels(THandle hCuCommon, PU16 pMinDfsChannel, PU16 pMaxDfsChannel) -{ - CuCommon_t* pCuCommon = (CuCommon_t*)hCuCommon; - S32 res; - DFS_ChannelRange_t DFS_ChannelRange; - - res = IPC_STA_Private_Send(pCuCommon->hIpcSta, TIWLN_REG_DOMAIN_GET_DFS_RANGE, NULL, 0, - &DFS_ChannelRange, sizeof(DFS_ChannelRange_t)); - - if(res == EOALERR_IPC_STA_ERROR_SENDING_WEXT) - return ECUERR_CU_COMMON_ERROR; - - *pMaxDfsChannel = DFS_ChannelRange.maxDFS_channelNum; - *pMinDfsChannel = DFS_ChannelRange.minDFS_channelNum; - - return OK; -} - -S32 CuCommon_SetDfsChannels(THandle hCuCommon, U16 MinDfsChannel, U16 MaxDfsChannel) -{ - CuCommon_t* pCuCommon = (CuCommon_t*)hCuCommon; - S32 res; - DFS_ChannelRange_t DFS_ChannelRange; - - DFS_ChannelRange.maxDFS_channelNum = MaxDfsChannel; - DFS_ChannelRange.minDFS_channelNum = MinDfsChannel; - - res = IPC_STA_Private_Send(pCuCommon->hIpcSta, TIWLN_REG_DOMAIN_SET_DFS_RANGE, &DFS_ChannelRange, sizeof(DFS_ChannelRange_t), - NULL, 0); - - if(res == EOALERR_IPC_STA_ERROR_SENDING_WEXT) - return ECUERR_CU_COMMON_ERROR; - - return OK; -} - -S32 CuCommon_PrintDriverDebug(THandle hCuCommon, PVOID pParams, U32 param_size) -{ - CuCommon_t* pCuCommon = (CuCommon_t*)hCuCommon; - S32 res; - - if ( pParams == NULL ) - { - return ECUERR_CU_COMMON_ERROR; - } - - res = IPC_STA_Private_Send(pCuCommon->hIpcSta, TIWLN_DISPLAY_STATS, pParams, param_size, - NULL, 0); - - if(res == EOALERR_IPC_STA_ERROR_SENDING_WEXT) - return ECUERR_CU_COMMON_ERROR; - - return OK; -} - -S32 CuCommon_PrintDriverDebugBuffer(THandle hCuCommon, U32 func_id, U32 opt_param) -{ - CuCommon_t* pCuCommon = (CuCommon_t*)hCuCommon; - S32 res, len; - U8 buf[260]; /* no more then 256 + func id */ - - if (opt_param == 0) - return ECUERR_CU_ERROR; - - len = os_strlen((PS8)opt_param); - *(PU32)buf = func_id; - os_memcpy((PS8)buf + sizeof(U32),(PS8)opt_param, len); - - res = IPC_STA_Private_Send(pCuCommon->hIpcSta, TIWLN_DISPLAY_STATS, buf, len + sizeof(U32), - NULL, 0); - - if(res == EOALERR_IPC_STA_ERROR_SENDING_WEXT) - return ECUERR_CU_COMMON_ERROR; - - return OK; -} - - -S32 CuCommon_GetRxDataFiltersStatistics(THandle hCuCommon, PU32 pUnmatchedPacketsCount, PU32 pMatchedPacketsCount) -{ - CuCommon_t* pCuCommon = (CuCommon_t*)hCuCommon; - S32 res; - TCuCommon_RxDataFilteringStatistics buffer; - - res = IPC_STA_Private_Send(pCuCommon->hIpcSta, TIWLN_GET_RX_DATA_FILTERS_STATISTICS, NULL, 0, - &buffer, sizeof(TCuCommon_RxDataFilteringStatistics)); - - if(res == EOALERR_IPC_STA_ERROR_SENDING_WEXT) - return ECUERR_CU_COMMON_ERROR; - - *pUnmatchedPacketsCount = buffer.unmatchedPacketsCount; - os_memcpy(pMatchedPacketsCount, &buffer.matchedPacketsCount, MAX_DATA_FILTERS*sizeof(U32)); - - return OK; -} - - -S32 CuCommon_GetPowerConsumptionStat(THandle hCuCommon, ACXPowerConsumptionTimeStat_t *pPowerstat) -{ - CuCommon_t* pCuCommon = (CuCommon_t*)hCuCommon; - ACXPowerConsumptionTimeStat_t tStatistics; - S32 res; - - - res = IPC_STA_Private_Send(pCuCommon->hIpcSta, TIWLN_GET_POWER_CONSUMPTION_STATISTICS, NULL, 0, - &tStatistics, sizeof(ACXPowerConsumptionTimeStat_t)); - - if(res == EOALERR_IPC_STA_ERROR_SENDING_WEXT) - return ECUERR_CU_COMMON_ERROR; - - os_memcpy(pPowerstat, &tStatistics, sizeof(ACXPowerConsumptionTimeStat_t)); - - return OK; -} - - - - - - - diff --git a/wl1271/CUDK/configurationutility/src/ticon.c b/wl1271/CUDK/configurationutility/src/ticon.c deleted file mode 100644 index 1d4baf5c..00000000 --- a/wl1271/CUDK/configurationutility/src/ticon.c +++ /dev/null @@ -1,1215 +0,0 @@ -/* - * ticon.c - * - * Copyright 2001-2010 Texas Instruments, Inc. - http://www.ti.com/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/**************************************************************************** -* -* MODULE: ticon.c -* -* PURPOSE: -* -* DESCRIPTION: -* ============ -* -* -****************************************************************************/ - -/* includes */ -/************/ -#include "cu_osapi.h" -#include "oserr.h" - -#include "TWDriver.h" -#include "STADExternalIf.h" - -#include "console.h" -#include "cu_cmd.h" -#include "wpa_core.h" -#ifdef XCC_MODULE_INCLUDED -#include "cu_XCC.h" -#endif - -/* defines */ -/***********/ -#ifdef DEBUG -#define CHK_NULL(p) ((p)) ? (VOID) 0 : os_error_printf(CU_MSG_ERROR, (PS8)"\nfailed: '%s', file %s, line %d\n", #p, __FILE__, __LINE__); -#define CHK(p) ((!p)) ? (VOID) 0 : os_error_printf(CU_MSG_ERROR, (PS8)"\nfailed: '%s', file %s, line %d\n", #p, __FILE__, __LINE__); -#else -#define CHK(p) (p) -#define CHK_NULL(p) (p) -#endif - -#define TIWLAN_DRV_NAME "tiwlan0" -#ifdef ANDROID -#define SUPPL_IF_FILE "/data/misc/wifi/sockets/" TIWLAN_DRV_NAME -#else -#define SUPPL_IF_FILE "/var/run/" TIWLAN_DRV_NAME -#endif -extern int consoleRunScript( char *script_file, THandle hConsole); - -/* local types */ -/***************/ -/* Module control block */ -typedef struct TiCon_t -{ - THandle hConsole; - S8 drv_name[IF_NAME_SIZE]; -} TiCon_t; - -/* local variables */ -/*******************/ -static TiCon_t g_TiCon; - -/* local fucntions */ -/*******************/ -static S32 TiCon_Init_Console_Menu(TiCon_t* pTiCon) -{ - THandle h, h1; - THandle h2; - - - - /* -------------------------------------------- Driver -------------------------------------------- */ - - CHK_NULL(h = (THandle) Console_AddDirExt(pTiCon->hConsole, (THandle) NULL, (PS8)"Driver", (PS8)"Driver start/stop" ) ); - Console_AddToken(pTiCon->hConsole,h, (PS8)"Start", (PS8)"Start driver", (FuncToken_t) CuCmd_StartDriver, NULL ); - Console_AddToken(pTiCon->hConsole,h, (PS8)"sTop", (PS8)"Stop driver", (FuncToken_t) CuCmd_StopDriver, NULL ); - Console_AddToken(pTiCon->hConsole,h, (PS8)"stAtus", (PS8)"Print status", (FuncToken_t) CuCmd_Show_Status, NULL ); - - /* -------------------------------------------- Connection -------------------------------------------- */ - - CHK_NULL(h = (THandle) Console_AddDirExt(pTiCon->hConsole, (THandle) NULL, (PS8)"Connection", (PS8)"Connection management" ) ); - Console_AddToken(pTiCon->hConsole,h, (PS8)"Bssid_list", (PS8)"Bssid_list", (FuncToken_t) CuCmd_BssidList, NULL ); - { - ConParm_t aaa[] = { {(PS8)"ssid", CON_PARM_STRING | CON_PARM_OPTIONAL, 0, 32, 0 }, - {(PS8)"bssid", CON_PARM_STRING | CON_PARM_OPTIONAL, 0, 32, 0 }, - CON_LAST_PARM }; - - Console_AddToken(pTiCon->hConsole,h, (PS8)"Connect", (PS8)"Connect", (FuncToken_t) CuCmd_Connect, aaa ); - } - Console_AddToken(pTiCon->hConsole,h, (PS8)"Disassociate", (PS8)"disconnect", (FuncToken_t) CuCmd_Disassociate, NULL ); - Console_AddToken(pTiCon->hConsole,h, (PS8)"Status", (PS8)"Print connection status", (FuncToken_t) CuCmd_Show_Status, NULL ); -#ifdef TI_DBG - Console_AddToken(pTiCon->hConsole,h, (PS8)"Full_bssid_list", (PS8)"Full_bssid_list", (FuncToken_t) CuCmd_FullBssidList, NULL ); -#endif - -#ifdef CONFIG_WPS - CHK_NULL(h1 = (THandle) Console_AddDirExt(pTiCon->hConsole, (THandle) h, (PS8)"wPs", (PS8)"WiFi Protected Setup" ) ); - Console_AddToken(pTiCon->hConsole,h1, (PS8)"Pin", (PS8)"Acquire profile using PIN", (FuncToken_t) CuCmd_StartEnrolleePIN, NULL ); - Console_AddToken(pTiCon->hConsole,h1, (PS8)"pBc", (PS8)"Acquire profile using Push Button", (FuncToken_t) CuCmd_StartEnrolleePBC, NULL ); - Console_AddToken(pTiCon->hConsole,h1, (PS8)"Stop", (PS8)"Stop WiFi Protected Setup", (FuncToken_t) CuCmd_StopEnrollee, NULL ); - { - ConParm_t aaa[] = - { - {(PS8)"PIN", CON_PARM_STRING, 0, 8, 0 }, - CON_LAST_PARM - }; - Console_AddToken(pTiCon->hConsole,h1, (PS8)"set pIn", (PS8)"Set PIN code", (FuncToken_t) CuCmd_SetPin, aaa ); - } -#endif /* CONFIG_WPS */ - - /* -------------------------------------------- Management -------------------------------------------- */ - - CHK_NULL(h = (THandle) Console_AddDirExt(pTiCon->hConsole, (THandle) NULL, (PS8)"Management", (PS8)"Station management" ) ); - { - ConParm_t aaa[] = { {(PS8)"connectMode", CON_PARM_OPTIONAL, 0, 0, 0 }, CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h, (PS8)"connect moDe", (PS8)"Set Connect Mode", (FuncToken_t) CuCmd_ModifyConnectMode, aaa ); - } - { - ConParm_t aaa[] = { {(PS8)"channel", CON_PARM_OPTIONAL, 0, 0, 0 }, CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h, (PS8)"Channel", (PS8)"Set the channel", (FuncToken_t) CuCmd_ModifyChannel, aaa ); - } - { - ConParm_t aaa[] = { {(PS8)"tx rate", CON_PARM_STRING | CON_PARM_OPTIONAL, 0, 32, 0 }, CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h, (PS8)"Rate", (PS8)"Get TX data rate in Mbps (1,2,5.5,11...)", (FuncToken_t) CuCmd_GetTxRate, aaa ); - } - { - ConParm_t aaa[] = { {(PS8)"BSS_type", CON_PARM_OPTIONAL, 0, 0, 0 }, CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h, (PS8)"Mode", (PS8)"BSS_type", (FuncToken_t) CuCmd_ModifyBssType, aaa ); - } - { - ConParm_t aaa[] = { {(PS8)"frag", CON_PARM_OPTIONAL, 0, 0, 0 }, CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h, (PS8)"Frag", (PS8)"Set the fragmentation threshold <256..2346>", (FuncToken_t) CuCmd_ModifyFragTh, aaa ); - } - { - ConParm_t aaa[] = { {(PS8)"rts", CON_PARM_OPTIONAL, 0, 0, 0 }, CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h, (PS8)"rts", (PS8)"Set RTS threshold <0..2347>", (FuncToken_t) CuCmd_ModifyRtsTh, aaa); - } - { - ConParm_t aaa[] = { {(PS8)"preamble", CON_PARM_RANGE | CON_PARM_OPTIONAL, 0, 1, 0 }, CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h, (PS8)"Preamble", (PS8)"Set preamble type 1=short 0=long", (FuncToken_t) CuCmd_ModifyPreamble, aaa ); - } - { - ConParm_t aaa[] = { {(PS8)"slot", CON_PARM_OPTIONAL, 0, 0, 0 }, CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h, (PS8)"sLot", (PS8)"Set short slot", (FuncToken_t) CuCmd_ModifyShortSlot, aaa ); - } - { - ConParm_t aaa[] = { {(PS8)"radio on//off", CON_PARM_OPTIONAL, 0, 1, 0 }, CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h, (PS8)"rAdio on/off", (PS8)"Turn radio on/off. 0=OFF, 1=ON", (FuncToken_t) CuCmd_RadioOnOff, aaa ); - } - Console_AddToken(pTiCon->hConsole,h, (PS8)"Info", (PS8)"Get Selected BSSID Info", (FuncToken_t) CuCmd_GetSelectedBssidInfo, NULL ); - Console_AddToken(pTiCon->hConsole,h, (PS8)"siGnal", (PS8)"Get Current RSSI level", (FuncToken_t) CuCmd_GetRsiiLevel, NULL ); - Console_AddToken(pTiCon->hConsole,h, (PS8)"snr ratiO", (PS8)"Get Current SNR radio", (FuncToken_t) CuCmd_GetSnrRatio, NULL ); - - - { - ConParm_t aaa[] = { {(PS8)"Tx power level", CON_PARM_OPTIONAL, 0, 0, 0 }, CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h, (PS8)"tX_power_table", (PS8)"show Tx power table", (FuncToken_t) CuCmd_ShowTxPowerTable, aaa ); - Console_AddToken(pTiCon->hConsole,h, (PS8)"tx_power_dBm_div10", (PS8)"Tx power level", (FuncToken_t) CuCmd_TxPowerDbm, aaa ); - } - CHK_NULL(h1 = (THandle) Console_AddDirExt(pTiCon->hConsole, (THandle) h, (PS8)"802_11d_h", (PS8)"802_11D_H" ) ); - { - ConParm_t aaa[] = { {(PS8)"802_11_D", CON_PARM_OPTIONAL, 0, 0, 0 }, CON_LAST_PARM }; - ConParm_t bbb[] = { - {(PS8)"min DFS channel", CON_PARM_RANGE, 36, 180, 40 }, - {(PS8)"max DFS channel", CON_PARM_RANGE, 36, 180, 140 }, - CON_LAST_PARM}; - - Console_AddToken(pTiCon->hConsole,h1, (PS8)"D_enableDisable", (PS8)"enableDisable_d", (FuncToken_t) CuCmd_ModifyState_802_11d, aaa ); - Console_AddToken(pTiCon->hConsole,h1, (PS8)"H_enableDisable", (PS8)"enableDisable_h", (FuncToken_t) CuCmd_ModifyState_802_11h, aaa ); - Console_AddToken(pTiCon->hConsole,h1, (PS8)"d_Country_2_4Ie", (PS8)"d_Country_2_4Ie", (FuncToken_t) CuCmd_D_Country_2_4Ie, aaa ); - Console_AddToken(pTiCon->hConsole,h1, (PS8)"d_cOuntry_5Ie", (PS8)"d_Country_5Ie", (FuncToken_t) CuCmd_D_Country_5Ie, aaa ); - - Console_AddToken(pTiCon->hConsole,h1, (PS8)"dfS_range", (PS8)"DFS_range", (FuncToken_t) CuCmd_ModifyDfsRange, bbb ); - - } - CHK_NULL(h1 = (THandle) Console_AddDirExt(pTiCon->hConsole, (THandle) h, (PS8)"beacoN", (PS8)"Set Beacon Filter Desired State" ) ); - { - ConParm_t beaconFilterDesiredState[] = { {(PS8)"Set Beacon Desired State", CON_PARM_OPTIONAL, 0, 0, 0 }, - CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h1, (PS8)"Set Beacon Filter Desired State", (PS8)"Set Beacon Filter Current State", (FuncToken_t) CuCmd_SetBeaconFilterDesiredState, beaconFilterDesiredState ); - Console_AddToken(pTiCon->hConsole,h1, (PS8)"Get Beacon Filter Current State", (PS8)"Get Beacon Filter Current State", (FuncToken_t) CuCmd_GetBeaconFilterDesiredState, NULL ); - } - - CHK_NULL(h1 = (THandle) Console_AddDirExt(pTiCon->hConsole, (THandle) h, (PS8)"adVanced", (PS8)"Advanced params" ) ); - { - ConParm_t aaa[] = { { (PS8)"rates", CON_PARM_OPTIONAL | CON_PARM_LINE, 0, 120, 0 }, CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole, h1, (PS8)"Supported rates", (PS8)"rates", (FuncToken_t) CuCmd_ModifySupportedRates, aaa ); - } - Console_AddToken(pTiCon->hConsole, h1, (PS8)"Health-check", (PS8)"Send health-check to device", (FuncToken_t) CuCmd_SendHealthCheck, NULL ); - CHK_NULL(h2 = (THandle) Console_AddDirExt(pTiCon->hConsole, (THandle) h1, (PS8)"rx data Filter", (PS8)"Rx Data Filter" ) ); - Console_AddToken(pTiCon->hConsole, h2, (PS8)"Enable", (PS8)"Enable Rx Data Filtering", (FuncToken_t) CuCmd_EnableRxDataFilters, NULL ); - Console_AddToken(pTiCon->hConsole, h2, (PS8)"Disable", (PS8)"Enable Rx Data Filtering", (FuncToken_t) CuCmd_DisableRxDataFilters, NULL ); - { - ConParm_t aaa[] = - { - {(PS8)"Offset", CON_PARM_RANGE, 0, 255, 0 }, - {(PS8)"Mask", CON_PARM_STRING, 0, 64, 0 }, - {(PS8)"Pattern", CON_PARM_STRING, 0, 128, 0 }, - CON_LAST_PARM - }; - Console_AddToken(pTiCon->hConsole, h2, (PS8)"Add", (PS8)"Add Rx Data Filter", (FuncToken_t) CuCmd_AddRxDataFilter, aaa ); - } - { - ConParm_t aaa[] = - { - {(PS8)"Offset", CON_PARM_RANGE, 0, 255, 0 }, - {(PS8)"Mask", CON_PARM_STRING, 0, 64, 0 }, - {(PS8)"Pattern", CON_PARM_STRING, 0, 128, 0 }, - CON_LAST_PARM - }; - Console_AddToken(pTiCon->hConsole, h2, (PS8)"Remove", (PS8)"Remove Rx Data Filter", (FuncToken_t) CuCmd_RemoveRxDataFilter, aaa ); - } - Console_AddToken(pTiCon->hConsole, h2, (PS8)"Statistics", (PS8)"Print Rx Data Filtering Statistics", (FuncToken_t) CuCmd_GetRxDataFiltersStatistics, NULL ); - CHK_NULL(h2 = (THandle) Console_AddDirExt(pTiCon->hConsole, (THandle) h1, (PS8)"Keep alive", (PS8)"Keep Alive templates" ) ); - Console_AddToken(pTiCon->hConsole, h2, (PS8)"Enable", (PS8)"Set global keep-alive flag to enable", (FuncToken_t)CuCmd_EnableKeepAlive, NULL ); - Console_AddToken(pTiCon->hConsole, h2, (PS8)"Disable", (PS8)"Set global keep-alive flag to disable", (FuncToken_t)CuCmd_DisableKeepAlive, NULL ); - { - ConParm_t aaa[] = - { - {(PS8)"Index", CON_PARM_RANGE, 0, 1, 0 }, - {(PS8)"Interval (msec)", CON_PARM_RANGE, 0, 1000000, 60000 }, - {(PS8)"Trigger type (0-idle 1-always)", CON_PARM_RANGE, 0, 1, 0 }, - {(PS8)"Pattern (hex data)", CON_PARM_STRING, 0, KEEP_ALIVE_TEMPLATE_MAX_LENGTH * 2, 0 }, - CON_LAST_PARM - }; - Console_AddToken(pTiCon->hConsole, h2, (PS8)"Add", (PS8)"Add a new keep-alive template", (FuncToken_t)CuCmd_AddKeepAliveMessage, aaa ); - } - { - ConParm_t aaa[] = - { - {(PS8)"Index", CON_PARM_RANGE, 0, 1, 0 }, - CON_LAST_PARM - }; - Console_AddToken(pTiCon->hConsole, h2, (PS8)"Remove", (PS8)"Remove a keep-alive template", (FuncToken_t)CuCmd_RemoveKeepAliveMessage, aaa ); - } - Console_AddToken(pTiCon->hConsole, h2, (PS8)"Show", (PS8)"Show all configured keep-alive templates", (FuncToken_t)CuCmd_ShowKeepAlive, NULL ); - - /* -------------------------------------------- Show -------------------------------------------- */ - CHK_NULL(h = (THandle) Console_AddDirExt(pTiCon->hConsole, (THandle) NULL, (PS8)"Show", (PS8)"Show params" ) ); - Console_AddToken(pTiCon->hConsole, h, (PS8)"Statistics", (PS8)"Show statistics", (FuncToken_t) CuCmd_ShowStatistics, NULL ); - { - ConParm_t aaa[] = { {(PS8)"Clear stats on read", CON_PARM_OPTIONAL | CON_PARM_RANGE, 0, 1, 0 }, CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h, (PS8)"Txstatistics", (PS8)"Show tx statistics", (FuncToken_t) CuCmd_ShowTxStatistics, aaa ); - } - Console_AddToken(pTiCon->hConsole,h, (PS8)"Advanced", (PS8)"Show advanced params", (FuncToken_t) CuCmd_ShowAdvancedParams, NULL ); - - Console_AddToken(pTiCon->hConsole,h, (PS8)"Power consumption", (PS8)"Show power consumption statistics", (FuncToken_t) Cucmd_ShowPowerConsumptionStats, NULL ); - - /* -------------------------------------------- Privacy -------------------------------------------- */ - - CHK_NULL(h = (THandle) Console_AddDirExt(pTiCon->hConsole, (THandle) NULL, (PS8)"Privacy", (PS8)"Privacy configuration" ) ); - { - ConParm_t aaa[] = { {(PS8)"mode", CON_PARM_OPTIONAL, 0, 0, 0 },CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h, (PS8)"Authentication", (PS8)"Set authentication mode", - (FuncToken_t)CuCmd_SetPrivacyAuth, aaa ); - } -#ifdef WPA_ENTERPRISE - { - ConParm_t aaa[] = { {(PS8)"type", CON_PARM_OPTIONAL, 0, 0, 0 }, CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h, (PS8)"Eap", (PS8)"Set EAP type", (FuncToken_t)CuCmd_SetPrivacyEap, aaa ); - } -#endif - { - ConParm_t aaa[] = { {(PS8)"type", CON_PARM_OPTIONAL, 0, 0, 0 }, CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h, (PS8)"encRyption", (PS8)"Set encryption type", (FuncToken_t)CuCmd_SetPrivacyEncryption, aaa); - } -#ifdef WPA_ENTERPRISE - { - ConParm_t aaa[] = { {(PS8)"type", 0, 0, 0, 0 }, CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h, (PS8)"Keytype", (PS8)"Set key type", (FuncToken_t) CuCmd_SetPrivacyKeyType, aaa ); - } - - { - ConParm_t aaa[] = { {(PS8)"mode", CON_PARM_OPTIONAL, 0, 0, 0 }, CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h, (PS8)"Mixedmode", (PS8)"Set mixed mode", (FuncToken_t) CuCmd_SetPrivacyMixedMode, aaa ); - } - - { - ConParm_t aaa[] = { {(PS8)"mode", CON_PARM_OPTIONAL, 0, 0, 0 }, CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h, (PS8)"aNywpamode", (PS8)"Set Any WPA mode", (FuncToken_t) CuCmd_SetPrivacyAnyWpaMode, aaa ); - } - - { - ConParm_t aaa[] = { - {(PS8)"User:", CON_PARM_STRING, 0, WPACORE_MAX_CERT_USER_NAME_LENGTH, 0 }, - {(PS8)"Password:", CON_PARM_STRING | CON_PARM_OPTIONAL, 0, WPACORE_MAX_CERT_PASSWORD_LENGTH , 0 }, - CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h, (PS8)"Credentials", (PS8)"Set Credentials ", (FuncToken_t)CuCmd_SetPrivacyCredentials, aaa); - } -#endif - { - ConParm_t aaa[] = - { - {(PS8)"Passphrase", CON_PARM_STRING, WPACORE_MIN_PSK_STRING_LENGTH, WPACORE_MAX_PSK_STRING_LENGTH, 0}, - {(PS8)"key type (hex | text) [text]", CON_PARM_OPTIONAL | CON_PARM_STRING, 0, 5, 0}, - CON_LAST_PARM - }; - Console_AddToken(pTiCon->hConsole,h, (PS8)"pskPassphrase", (PS8)"Set PSK Passphrase", (FuncToken_t)CuCmd_SetPrivacyPskPassPhrase, aaa ); - } - -#ifdef WPA_ENTERPRISE - { - ConParm_t aaa[] = { {(PS8)"Certificate Name:", CON_PARM_STRING, 0, WPACORE_MAX_CERT_FILE_NAME_LENGTH, 0 }, - {(PS8)"Validate (yes - 1 /no - 0):", CON_PARM_OPTIONAL, 0, 0, 0 }, CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h, (PS8)"cerTificate", (PS8)"Set Certificate",(FuncToken_t)CuCmd_SetPrivacyCertificate, aaa); - - } -#endif -#ifdef WPA_SUPPLICANT - CHK_NULL(h1 = (THandle) Console_AddDirExt(pTiCon->hConsole, (THandle) h, (PS8)"Supplicant", (PS8)"Supplicant" ) ); - { - Console_AddToken(pTiCon->hConsole,h1, (PS8)"Kill", (PS8)"Kill", (FuncToken_t) CuCmd_StopSuppl, NULL ); - - ConParm_t aaa[] = - { - {(PS8)"Level", CON_PARM_RANGE, 0, 4, 0 }, - {(PS8)"Show keys", CON_PARM_RANGE, 0, 1, 0 }, - {(PS8)"Show timestamps (yes - 1 /no - 0)", CON_PARM_RANGE, 0, 1, 0 }, - CON_LAST_PARM}; - Console_AddToken(pTiCon->hConsole,h1, (PS8)"Debug", (PS8)"Set debug", (FuncToken_t)CuCmd_ChangeSupplDebugLevels, aaa ); - } -#endif - - CHK_NULL(h1 = (THandle) Console_AddDirExt(pTiCon->hConsole, (THandle) h, (PS8)"Wep", (PS8)"Wep" ) ); - { - ConParm_t aaa[] = - { - {(PS8)"Key Value", CON_PARM_STRING, 0, 64, 0}, - {(PS8)"Tx Key Index", 0, 0, 0, 0 }, - {(PS8)"Default Key (yes - 1 /no - 0)", 0, 0, 0, 0 }, - {(PS8)"key type (hex | text) [hex]", CON_PARM_OPTIONAL | CON_PARM_STRING, 0, 5, 0}, - CON_LAST_PARM - }; - Console_AddToken(pTiCon->hConsole,h1, (PS8)"Add", (PS8)"Add WEP", (FuncToken_t)CuCmd_AddPrivacyKey, aaa ); - } - { - ConParm_t aaa[] = { {(PS8)"Key Index", 0, 0, 0, 0 }, CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h1, (PS8)"Remove", (PS8)"Remove WEP", (FuncToken_t)CuCmd_RemovePrivacyKey, aaa); - } - Console_AddToken(pTiCon->hConsole,h1, (PS8)"Get Default Key ID", (PS8)"Get Default Key ID", (FuncToken_t)CuCmd_GetPrivacyDefaultKey, NULL); - - -#ifdef XCC_MODULE_INCLUDED - CuXCC_AddXCCMenu(pTiCon, h); -#endif/*XCC_MODULE_INCLUDED*/ - - /* -------------------------------------------- Scan -------------------------------------------- */ - - CHK_NULL(h = (THandle) Console_AddDirExt(pTiCon->hConsole, (THandle) NULL, (PS8)"scAn", (PS8)"Scan Service Configuration" ) ); - Console_AddToken(pTiCon->hConsole, h, (PS8)"Start", (PS8)"Start One-Shot Application Scan", (FuncToken_t) CuCmd_StartScan, NULL ); - Console_AddToken(pTiCon->hConsole, h, (PS8)"sTop", (PS8)"Stop One-Shot Application Scan", (FuncToken_t) CuCmd_StopScan, NULL ); -#ifndef NO_WPA_SUPPL - { - ConParm_t aaa[] = { {(PS8)"Scan Type (0=Active, 1=Passive)", CON_PARM_RANGE | CON_PARM_OPTIONAL, 0, 1, 0 }, - {(PS8)"Ssid", CON_PARM_STRING | CON_PARM_OPTIONAL, 0, 32, 0 }, - CON_LAST_PARM }; - - Console_AddToken(pTiCon->hConsole,h, (PS8)"Wextstart", (PS8)"WEXT Start One-Shot Application Scan", (FuncToken_t) CuCmd_WextStartScan, aaa ); - } -#endif - - CHK_NULL(h1 = (THandle) Console_AddDirExt(pTiCon->hConsole, (THandle) h, (PS8)"configApp", (PS8)"Configure One-Shot Application Scan Params" ) ); - { - ConParm_t aaa[] = { - {(PS8)"SSID", CON_PARM_STRING, 0, 33, 0 }, -#ifdef TI_DBG /* limitn application scan to normal only in release version */ - {(PS8)"Scan Type", CON_PARM_RANGE, SCAN_TYPE_NORMAL_PASSIVE, SCAN_TYPE_TRIGGERED_ACTIVE, 0 }, -#else - {(PS8)"Scan Type", CON_PARM_RANGE, SCAN_TYPE_NORMAL_PASSIVE, SCAN_TYPE_NORMAL_ACTIVE, 0 }, -#endif - {(PS8)"Band", CON_PARM_RANGE, 0, 1, 0 }, - {(PS8)"Probe Request Number", CON_PARM_RANGE, 0, 255, 0 }, - {(PS8)"Probe Request Rate", CON_PARM_RANGE, 0, DRV_RATE_MASK_54_OFDM, 0 }, - -#ifdef TI_DBG - {(PS8)"Tid", CON_PARM_RANGE, 0, 255, 0 }, -#endif - {(PS8)"Number of Channels", CON_PARM_RANGE, 0, 16, 0 }, - CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h1, (PS8)"Global", (PS8)"Config Global Params", (FuncToken_t) CuCmd_ScanAppGlobalConfig, aaa ); - } - { - ConParm_t aaa[] = { - {(PS8)"Index", CON_PARM_RANGE, 0, 30, 0 }, - {(PS8)"BSSID (xx:xx:xx:xx:xx:xx)", CON_PARM_STRING, 0, 18, 0 }, - {(PS8)"Max Dwell Time", CON_PARM_RANGE, 0, 100000000, 0 }, - {(PS8)"Min Dwell Time", CON_PARM_RANGE, 0, 100000000, 0 }, - {(PS8)"ET Condition", CON_PARM_RANGE, SCAN_ET_COND_DISABLE, SCAN_ET_COND_ANY_FRAME, 0 }, - {(PS8)"ET Frame Number", CON_PARM_RANGE, 0, 255, 0 }, - {(PS8)"TX power level", CON_PARM_RANGE, 0, MAX_TX_POWER, 0 }, - {(PS8)"Channel Number", CON_PARM_RANGE, 0, 255, 0 }, - CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h1, (PS8)"Channel", (PS8)"Config Channel Params", (FuncToken_t) CuCmd_ScanAppChannelConfig, aaa ); - } - Console_AddToken(pTiCon->hConsole,h1, (PS8)"cLear", (PS8)"Clear All Params", (FuncToken_t) CuCmd_ScanAppClear, NULL ); - Console_AddToken(pTiCon->hConsole,h1, (PS8)"Display", (PS8)"Display Params", (FuncToken_t) CuCmd_ScanAppDisplay, NULL ); - - { - ConParm_t aaa[] = { - {(PS8)"Aging threshold", CON_PARM_RANGE, 0, 1000, 60 } }; - Console_AddToken(pTiCon->hConsole,h1, (PS8)"Aging", (PS8)"Set aging threshiold", (FuncToken_t) CuCmd_ScanSetSra, aaa ); - } - { - ConParm_t aaa[] = { - {(PS8)"Rssi threshold", CON_PARM_RANGE | CON_PARM_SIGN, -100, 0, -80 } }; - Console_AddToken(pTiCon->hConsole,h1, (PS8)"Rssi", (PS8)"Set rssi threshiold", (FuncToken_t) CuCmd_ScanSetRssi, aaa ); - } - - CHK_NULL(h1 = (THandle) Console_AddDirExt (pTiCon->hConsole, (THandle)h, (PS8)"configpEriodic", (PS8)"Configure Periodic Application Scan" ) ); - { - ConParm_t aaa[] = { - {(PS8)"RSSI Threshold", CON_PARM_RANGE | CON_PARM_SIGN, -100, 0, -97 }, - {(PS8)"SNR threshold", CON_PARM_RANGE | CON_PARM_SIGN, -10, 100, 0 }, - {(PS8)"Report threshold", CON_PARM_RANGE, 1, 8, 1 }, - {(PS8)"Terminate on report", CON_PARM_RANGE, 0, 1, 1 }, - {(PS8)"BSS Type (0-independent, 1-infrastructure, 2-any)", CON_PARM_RANGE, 0, 2, 2 }, - {(PS8)"Probe request number", CON_PARM_RANGE, 0, 5, 3 }, - {(PS8)"Number of scan cycles", CON_PARM_RANGE, 0, 100, 0 }, - {(PS8)"Number of SSIDs", CON_PARM_RANGE, 0, 8, 0 }, - {(PS8)"SSID List Filter Enabled", CON_PARM_RANGE, 0, 1, 1 }, - {(PS8)"Number of channels", CON_PARM_RANGE, 0, 32, 14 }, - CON_LAST_PARM }; - Console_AddToken (pTiCon->hConsole, h1, (PS8)"Global", (PS8)"Configure global periodic scan parameters", CuCmd_ConfigPeriodicScanGlobal, aaa); - } - { - ConParm_t aaa[] = { - {(PS8)"Index", CON_PARM_RANGE, 0, PERIODIC_SCAN_MAX_INTERVAL_NUM - 1, 0 }, - {(PS8)"Interval (in millisec)", CON_PARM_RANGE, 0, 3600000, 1000 }, - CON_LAST_PARM }; - Console_AddToken (pTiCon->hConsole, h1, (PS8)"Interval", (PS8)"Configure interval table", CuCmd_ConfigPeriodicScanInterval, aaa); - } - { - ConParm_t aaa[] = { - {(PS8)"Index", CON_PARM_RANGE, 0, 7, 0 }, - {(PS8)"Visability (0-public, 1-hidden)", CON_PARM_RANGE, 0, 1, 0 }, - {(PS8)"SSID", CON_PARM_STRING, 0, 33, 0}, - CON_LAST_PARM }; - Console_AddToken (pTiCon->hConsole, h1, (PS8)"SSID", (PS8)"Configure SSID list", CuCmd_ConfigurePeriodicScanSsid, aaa); - } - { - ConParm_t aaa[] = { - {(PS8)"Index", CON_PARM_RANGE, 0, 32, 0 }, - {(PS8)"Band (0-2.4GHz, 1-5GHz)", CON_PARM_RANGE, 0, 1, 0 }, - {(PS8)"Channel", CON_PARM_RANGE, 0, 180, 0 }, - {(PS8)"Scan Type (0-passive, 1-active)", CON_PARM_RANGE, 0, 1, 0 }, - {(PS8)"Min dwell time (in millisec)", CON_PARM_RANGE, 1, 1000, 15 }, - {(PS8)"Max dwell time (in millisec)", CON_PARM_RANGE, 1, 1000, 100 }, - {(PS8)"TX power level (dBm*10)", CON_PARM_RANGE, 0, MAX_TX_POWER, 0 }, - CON_LAST_PARM }; - Console_AddToken (pTiCon->hConsole, h1, (PS8)"Channel", (PS8)"Configure channel list", CuCmd_ConfigurePeriodicScanChannel, aaa); - } - Console_AddToken (pTiCon->hConsole, h1, (PS8)"cLear", (PS8)"Clear configuration", CuCmd_ClearPeriodicScanConfiguration, NULL); - Console_AddToken (pTiCon->hConsole, h1, (PS8)"Display", (PS8)"Display current configuration", CuCmd_DisplayPeriodicScanConfiguration, NULL); - Console_AddToken (pTiCon->hConsole, h1, (PS8)"sTart", (PS8)"Start Periodic Scan", CuCmd_StartPeriodicScan, NULL); - Console_AddToken (pTiCon->hConsole, h1, (PS8)"stoP", (PS8)"Stop periodic scan", CuCmd_StopPeriodicScan, NULL); - - CHK_NULL(h1 = (THandle) Console_AddDirExt(pTiCon->hConsole, (THandle) h, (PS8)"configPolicy", (PS8)"Configure Scan Manager Scan Policy" ) ); - { - ConParm_t aaa[] = { - {(PS8)"Normal scan interval (msec)", CON_PARM_RANGE, 0, 3600000, 5000 }, - {(PS8)"Deteriorating scan interval", CON_PARM_RANGE, 0, 3600000, 3000 }, - {(PS8)"Max Track Failures", CON_PARM_RANGE, 0, 20, 3 }, - {(PS8)"BSS list size", CON_PARM_RANGE, 0, 16, 8 }, - {(PS8)"BSS Number to start discovery", CON_PARM_RANGE, 0, 16, 4 }, - {(PS8)"Number of bands", CON_PARM_RANGE, 0, 2, 1 }, - CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h1, (PS8)"Gloabal", (PS8)"Set Global policy Params", (FuncToken_t) CuCmd_ConfigScanPolicy, aaa ); - } - - CHK_NULL(h2 = (THandle) Console_AddDirExt(pTiCon->hConsole, (THandle) h1, (PS8)"Band", (PS8)"Configure band scan policy" ) ); - { - ConParm_t aaa[] = { - {(PS8)"Index", CON_PARM_RANGE, 0, 1, 0 }, - {(PS8)"Band", CON_PARM_RANGE, 0, 1, 0 }, - {(PS8)"RSSI threshold", CON_PARM_RANGE| CON_PARM_SIGN, -100, 0, 0 }, - {(PS8)"Channel number for discovery cycle", CON_PARM_RANGE, 0, 30, 5 }, - {(PS8)"Number of Channels", CON_PARM_RANGE, 0, 30, 0 }, - CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h2, (PS8)"Misc", (PS8)"Set misc band params", (FuncToken_t) CuCmd_ConfigScanBand, aaa ); - } - { - ConParm_t aaa[] = { - {(PS8)"Band Index", CON_PARM_RANGE, 0, 1, 0 }, - {(PS8)"Channel Index", CON_PARM_RANGE, 0, 29, 0 }, - {(PS8)"Channel", CON_PARM_RANGE, 0, 160, 0 }, - CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h2, (PS8)"Channel", (PS8)"Set Channel params", (FuncToken_t) CuCmd_ConfigScanBandChannel, aaa ); - } - { - ConParm_t aaa[] = { - {(PS8)"Band Index", CON_PARM_RANGE, 0, 1, 0 }, - {(PS8)"Scan Type", CON_PARM_RANGE, 0, 5, 0 }, - {(PS8)"ET event", CON_PARM_RANGE, SCAN_ET_COND_DISABLE, SCAN_ET_COND_ANY_FRAME, SCAN_ET_COND_DISABLE }, - {(PS8)"ET num of frames", CON_PARM_RANGE, 0, 255,0 }, - {(PS8)"Triggering AC", CON_PARM_RANGE, 0, 255, 0 }, - {(PS8)"Scan Duration (SPS)", CON_PARM_RANGE, 0, 100000000, 2000 }, - {(PS8)"Max dwell time", CON_PARM_RANGE, 0, 100000000, 60000 }, - {(PS8)"Min dwell time", CON_PARM_RANGE, 0, 100000000, 30000 }, - {(PS8)"Probe req. number", CON_PARM_RANGE, 0, 255, 2 }, - - {(PS8)"Probe req. rate", CON_PARM_RANGE, 0, DRV_RATE_MASK_54_OFDM, 0 }, - - {(PS8)"TX power level", CON_PARM_RANGE, 0, MAX_TX_POWER, 0 }, - CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h2, (PS8)"Track", (PS8)"Set tracking method params", (FuncToken_t) CuCmd_ConfigScanBandTrack, aaa ); - } - { - ConParm_t aaa[] = { - {(PS8)"Band Index", CON_PARM_RANGE, 0, 1, 0 }, - {(PS8)"Scan Type", CON_PARM_RANGE, 0, 5, 0 }, - {(PS8)"ET event", CON_PARM_RANGE, SCAN_ET_COND_DISABLE, SCAN_ET_COND_ANY_FRAME, SCAN_ET_COND_DISABLE }, - {(PS8)"ET num of frames", CON_PARM_RANGE, 0, 255,0 }, - {(PS8)"Triggering AC", CON_PARM_RANGE, 0, 255, 0 }, - {(PS8)"Scan Duration (SPS)", CON_PARM_RANGE, 0, 100000000, 2000 }, - {(PS8)"Max dwell time", CON_PARM_RANGE, 0, 100000000, 60000 }, - {(PS8)"Min dwell time", CON_PARM_RANGE, 0, 100000000, 30000 }, - {(PS8)"Probe req. number", CON_PARM_RANGE, 0, 255, 2 }, - - {(PS8)"Probe req. rate", CON_PARM_RANGE, 0, DRV_RATE_MASK_54_OFDM, 0 }, - - {(PS8)"TX power level", CON_PARM_RANGE, 0, MAX_TX_POWER, 0 }, - CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h2, (PS8)"Discovery", (PS8)"Set Discovery method params", (FuncToken_t) CuCmd_ConfigScanBandDiscover, aaa ); - } - { - ConParm_t aaa[] = { - {(PS8)"Band Index", CON_PARM_RANGE, 0, 1, 0 }, - {(PS8)"Scan Type", CON_PARM_RANGE, 0, 5, 0 }, - {(PS8)"ET event", CON_PARM_RANGE, SCAN_ET_COND_DISABLE, SCAN_ET_COND_ANY_FRAME, SCAN_ET_COND_DISABLE }, - {(PS8)"ET num of frames", CON_PARM_RANGE, 0, 255,0 }, - {(PS8)"Triggering AC", CON_PARM_RANGE, 0, 255, 0 }, - {(PS8)"Scan Duration (SPS)", CON_PARM_RANGE, 0, 100000000, 2000 }, - {(PS8)"Max dwell time", CON_PARM_RANGE, 0, 100000000, 60000 }, - {(PS8)"Min dwell time", CON_PARM_RANGE, 0, 100000000, 30000 }, - {(PS8)"Probe req. number", CON_PARM_RANGE, 0, 255, 2 }, - - {(PS8)"Probe req. rate", CON_PARM_RANGE, 0, DRV_RATE_MASK_54_OFDM, 0 }, - - {(PS8)"TX power level", CON_PARM_RANGE, 0, MAX_TX_POWER, 0 }, - CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h2, (PS8)"Immediate", (PS8)"Set Immediate method params", (FuncToken_t) CuCmd_ConfigScanBandImmed, aaa ); - } - - - Console_AddToken(pTiCon->hConsole,h1, (PS8)"Display", (PS8)"Display Policy Params", (FuncToken_t) CuCmd_DisplayScanPolicy, NULL ); - Console_AddToken(pTiCon->hConsole,h1, (PS8)"cLear", (PS8)"Clear Polciy Params", (FuncToken_t) CuCmd_ClearScanPolicy, NULL ); - Console_AddToken(pTiCon->hConsole,h1, (PS8)"Store", (PS8)"Send policy to scan manager", (FuncToken_t) CuCmd_SetScanPolicy, NULL ); - Console_AddToken(pTiCon->hConsole,h1, (PS8)"bsslisT", (PS8)"Display BSS list", (FuncToken_t) CuCmd_GetScanBssList, NULL ); - - /* -------------------------------------------- roaminG -------------------------------------------- */ - - /************ ROAMING manager commands - start ********************/ - CHK_NULL(h = (THandle) Console_AddDirExt(pTiCon->hConsole, (THandle) NULL, (PS8)"roaminG", (PS8)"Roaming Manager configuration" ) ); - Console_AddToken(pTiCon->hConsole,h, (PS8)"Enable", (PS8)"Enable Internal Roaming", (FuncToken_t) CuCmd_RoamingEnable, NULL ); - Console_AddToken(pTiCon->hConsole,h, (PS8)"Disable", (PS8)"Disable Internal Roaming", (FuncToken_t) CuCmd_RoamingDisable, NULL ); - { - ConParm_t aaa[] = { - {(PS8)"Low pass filter time", CON_PARM_RANGE, 0, 1440, 30 }, CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h, (PS8)"Low pass filter", (PS8)"Time in sec ", (FuncToken_t) CuCmd_RoamingLowPassFilter, aaa ); - } - { - ConParm_t aaa[] = { - {(PS8)"Quality threshold", CON_PARM_RANGE | CON_PARM_SIGN, -150, 0, -70 }, CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h, (PS8)"Quality threshold", (PS8)"Quality indicator", (FuncToken_t) CuCmd_RoamingQualityIndicator, aaa ); - } - - Console_AddToken(pTiCon->hConsole,h, (PS8)"Get ", (PS8)"Get Roaming config params ", (FuncToken_t) CuCmd_RoamingGetConfParams, NULL ); - - CHK_NULL(h1 = (THandle) Console_AddDirExt(pTiCon->hConsole, (THandle) h, (PS8)"Thresholds", (PS8)"Set Roaming MNGR triggers thresholds" ) ); - { - ConParm_t aaa[] = { - {(PS8)"Tx retry", CON_PARM_RANGE, 0, 255, 20 }, CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h1, (PS8)"Tx retry ", (PS8)"Consecutive number of TX retries", (FuncToken_t) CuCmd_RoamingDataRetryThreshold, aaa ); - } - { - ConParm_t aaa[] = { - {(PS8)"Bss loss", CON_PARM_RANGE, 1, 255, 4 }, CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h1, (PS8)"Bss loss ", (PS8)"Number of TBTTs", (FuncToken_t) CuCmd_RoamingNumExpectedTbttForBSSLoss, aaa ); - } - { - ConParm_t aaa[] = { - {(PS8)"tx Rate threshold", CON_PARM_RANGE, 0, 54, 2 }, CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h1, (PS8)"tx Rate threshold ", (PS8)"TX rate (fallback) threshold", (FuncToken_t) CuCmd_RoamingTxRateThreshold, aaa ); - } - { - ConParm_t aaa[] = { - {(PS8)"Low rssi threshold", CON_PARM_RANGE | CON_PARM_SIGN, -150, 0, -80 }, CON_LAST_PARM }; - - Console_AddToken(pTiCon->hConsole,h1, (PS8)"low rssi thresHold ", (PS8)"Low RSSI threshold", (FuncToken_t) CuCmd_RoamingLowRssiThreshold, aaa ); - } - { - ConParm_t aaa[] = { - {(PS8)"low Snr threshold", CON_PARM_RANGE, 0, 255, 10 }, CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h1, (PS8)"low Snr threshold ", (PS8)"Low SNR threshold", (FuncToken_t) CuCmd_RoamingLowSnrThreshold, aaa ); - } - { - ConParm_t aaa[] = { - {(PS8)"low Quality for scan", CON_PARM_RANGE | CON_PARM_SIGN, -150, -40, -85 }, CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h1, (PS8)"low Quality for scan ", (PS8)"Increase the background scan", (FuncToken_t) CuCmd_RoamingLowQualityForBackgroungScanCondition, aaa ); - } - { - ConParm_t aaa[] = { - {(PS8)"Normal quality for scan", CON_PARM_RANGE | CON_PARM_SIGN, -150, -40, -70 }, CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h1, (PS8)"Normal quality for scan ", (PS8)"Reduce the background scan", (FuncToken_t) CuCmd_RoamingNormalQualityForBackgroungScanCondition, aaa ); - } - { - ConParm_t aaa[] = { - {(PS8)"Index ", CON_PARM_RANGE, 0, 1, 0 }, - {(PS8)"Threshold [dB / dBm] ", CON_PARM_RANGE | CON_PARM_SIGN, -100, 100, 0 }, - {(PS8)"Pacing [Millisecond] ", CON_PARM_RANGE, 0, 60000, 1000 }, - {(PS8)"Metric [0 - bcon_rssi, 1 - pkt_rssi, 2 - bcon_snr, 3 - pkt_snr] ", CON_PARM_RANGE, 0, 3, 0 }, - {(PS8)"Type [0 - Level, 1 - Edge] ", CON_PARM_RANGE, 0, 1, 0 }, - {(PS8)"Direction [0 - Down, 1 - Up, 2 - Both] ", CON_PARM_RANGE, 0, 2, 0 }, - {(PS8)"Hystersis [dB] ", CON_PARM_RANGE, 0, 255, 0 }, - {(PS8)"Enable [0 - Disable, 1 - Enable] ", CON_PARM_RANGE, 0, 1, 0 }, - CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h1, (PS8)"User defined trigger\n", (PS8)"User defined FW trigger", (FuncToken_t) CuCmd_CurrBssUserDefinedTrigger, aaa ); - } - - /************ ROAMING manager commands - end ********************/ - - /* -------------------------------------------- QOS -------------------------------------------- */ - - - CHK_NULL(h = (THandle) Console_AddDirExt(pTiCon->hConsole, (THandle) NULL, (PS8)"qOs", (PS8)"Quality of service" ) ); - - Console_AddToken(pTiCon->hConsole,h, (PS8)"aP params", (PS8)"Get AP QoS parameters", (FuncToken_t) CuCmd_GetApQosParams, NULL ); - Console_AddToken(pTiCon->hConsole,h, (PS8)"ap Capabilities", (PS8)"Get AP QoS capabilities parameters", (FuncToken_t) CuCmd_GetApQosCapabilities, NULL ); - { - ConParm_t ACid[] = { {(PS8)"AC", CON_PARM_RANGE, 0, 3, 3 }, CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h, (PS8)"ac Status", (PS8)"Get Current AC Status", (FuncToken_t) CuCmd_GetAcStatus, ACid ); - } - Console_AddToken(pTiCon->hConsole,h, (PS8)"dEsired ps mode", (PS8)"Get desired PS mode", (FuncToken_t) CuCmd_GetDesiredPsMode, NULL ); - { - ConParm_t aaa[] = { - {(PS8)"TID", CON_PARM_RANGE, 0, 7, 0 }, - {(PS8)"Stream Period (mSec)", CON_PARM_RANGE , 10, 100, 20 }, - {(PS8)"Tx Timeout (mSec)", CON_PARM_RANGE , 0, 200, 30 }, - {(PS8)"Enable", CON_PARM_RANGE , 0, 1, 1 }, - CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h, (PS8)"set ps rX streaming", (PS8)"Set PS Rx Streaming", (FuncToken_t) CuCmd_SetPsRxDelivery, aaa ); - } - Console_AddToken(pTiCon->hConsole,h, (PS8)"get ps rx streAming", (PS8)"Get PS Rx Streaming parameters", (FuncToken_t) CuCmd_GetPsRxStreamingParams, NULL ); - { - ConParm_t aaa[] = { - {(PS8)"acID", CON_PARM_RANGE, 0, 3, 0 }, - {(PS8)"MaxLifeTime", CON_PARM_RANGE , 0, 1024, 0 }, - {(PS8)"PS Delivery Protocol (0 - Legacy, 1 - U-APSD)", CON_PARM_RANGE | CON_PARM_OPTIONAL, 0, 1, 1 }, - CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h, (PS8)"Qosparams", (PS8)"Set QOS Parameters", (FuncToken_t) CuCmd_SetQosParams, aaa ); - } - { - ConParm_t aaa[] = { - {(PS8)"PsPoll", CON_PARM_RANGE, 0, 65000, 0 }, - {(PS8)"UPSD", CON_PARM_RANGE , 0, 65000, 0 }, - CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h, (PS8)"Rx TimeOut", (PS8)"Rx TimeOut", (FuncToken_t) CuCmd_SetRxTimeOut, aaa ); - } - { ConParm_t aaa[] = { - {(PS8)"Type", CON_PARM_RANGE, DSCP_CLSFR, CLSFR_TYPE_MAX, 0 }, - {(PS8)"D-Tag", CON_PARM_RANGE, CLASSIFIER_DTAG_MIN, CLASSIFIER_DTAG_MAX, CLASSIFIER_DTAG_DEF }, - {(PS8)"Param1", CON_PARM_RANGE, 0, 65535, 0 }, - {(PS8)"Ip1", CON_PARM_RANGE | CON_PARM_OPTIONAL, 0, 255, 0 }, - {(PS8)"Ip2", CON_PARM_RANGE | CON_PARM_OPTIONAL, 0, 255, 0 }, - {(PS8)"Ip3", CON_PARM_RANGE | CON_PARM_OPTIONAL, 0, 255, 0 }, - {(PS8)"Ip4", CON_PARM_RANGE | CON_PARM_OPTIONAL, 0, 255, 0 }, - CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h, (PS8)"Insert class", (PS8)"Insert new classification entry", (FuncToken_t) CuCmd_InsertClsfrEntry, aaa ); - } - { ConParm_t aaa[] = { - {(PS8)"Type", CON_PARM_RANGE, DSCP_CLSFR, CLSFR_TYPE_MAX, 0 }, - {(PS8)"D-Tag", CON_PARM_RANGE, CLASSIFIER_DTAG_MIN, CLASSIFIER_DTAG_MAX, CLASSIFIER_DTAG_DEF }, - {(PS8)"Param1", CON_PARM_RANGE, 0, 65535, 0 }, - {(PS8)"Ip1", CON_PARM_RANGE | CON_PARM_OPTIONAL, 0, 255, 0 }, - {(PS8)"Ip2", CON_PARM_RANGE | CON_PARM_OPTIONAL, 0, 255, 0 }, - {(PS8)"Ip3", CON_PARM_RANGE | CON_PARM_OPTIONAL, 0, 255, 0 }, - {(PS8)"Ip4", CON_PARM_RANGE | CON_PARM_OPTIONAL, 0, 255, 0 }, - CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h, (PS8)"remoVe class", (PS8)"Remove classification entry", (FuncToken_t) CuCmd_RemoveClsfrEntry, aaa ); - } - - CHK_NULL(h1 = (THandle) Console_AddDirExt(pTiCon->hConsole, (THandle) h, (PS8)"Tspec", (PS8)"TSPEC Sub-menu" ) ); - { ConParm_t TspecParams[] = { - {(PS8)"UserPriority", CON_PARM_RANGE, 0, 7, 1 }, - {(PS8)"NominalMSDUsize", CON_PARM_RANGE, 1, 2312, 1 }, - {(PS8)"MeanDataRate (Bps units)", CON_PARM_RANGE, 0, 54000000, 0 }, - {(PS8)"MinimumPHYRate (Mbps units)", CON_PARM_RANGE , 0, 54, 0 }, - {(PS8)"SurplusBandwidthAllowance", CON_PARM_RANGE , 0, 7, 0 }, - {(PS8)"UPSD Mode (0 - Legacy, 1 - U-APSD)", CON_PARM_RANGE , 0, 1, 0 }, - {(PS8)"MinimumServiceInterval (usec)", CON_PARM_RANGE , 0, 1000000000, 0 }, - {(PS8)"MaximumServiceInterval (usec)", CON_PARM_RANGE , 0, 1000000000, 0 }, - CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h1, (PS8)"Add", (PS8)"Add TSPEC", (FuncToken_t) CuCmd_AddTspec, TspecParams ); - } - { - ConParm_t UPid[] = { {(PS8)"User priority", CON_PARM_RANGE, 0, 7, 1 }, CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h1, (PS8)"Get", (PS8)"Get TSPEC Params", (FuncToken_t) CuCmd_GetTspec, UPid ); - } - { - ConParm_t UPid[] = { {(PS8)"UserPriority", CON_PARM_RANGE, 0, 7, 1 }, - {(PS8)"ReasonCode", CON_PARM_RANGE, 32, 45, 32 }, CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h1, (PS8)"Delete", (PS8)"Delete TSPEC", (FuncToken_t) CuCmd_DeleteTspec, UPid ); - } - - { - ConParm_t MediumUsageParams[] = { - {(PS8)"AC", CON_PARM_RANGE, 0, 3, 3 }, - {(PS8)"HighThreshold", CON_PARM_RANGE | CON_PARM_OPTIONAL, 0, 100, 1 }, - {(PS8)"LowThreshold", CON_PARM_RANGE | CON_PARM_OPTIONAL, 0, 100, 1 }, - CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h1, (PS8)"Medium usage", (PS8)"Medium usage threshold", (FuncToken_t) CuCmd_ModifyMediumUsageTh, MediumUsageParams ); - } - - - /* -------------------------------------------- Power Management -------------------------------------------- */ - - CHK_NULL(h = (THandle) Console_AddDirExt(pTiCon->hConsole, (THandle) NULL, (PS8)"poWer", (PS8)"Power Management" ) ); - { - /* Set Power Mode Command */ - ConParm_t powerModeCmd[] = { - {(PS8)"PowerMode", CON_PARM_RANGE | CON_PARM_OPTIONAL, 0, 3, 1 }, /* Min/Max/Def */ - CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h, (PS8)"set_Power_mode", (PS8)"Set user power mode", (FuncToken_t) CuCmd_SetPowerMode, powerModeCmd ); - - } - { - /* Set Power Save Power level Command */ - ConParm_t powerSavePowerLevelCmd[] = { - {(PS8)"PowerSavePowerLevel", CON_PARM_RANGE | CON_PARM_OPTIONAL, 0, 2, 2 }, /* Min/Max/Def */ - CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h, (PS8)"set_powersave_powerLevel", (PS8)"Set the Power level during PowerSave", (FuncToken_t) CuCmd_SetPowerSavePowerLevel, powerSavePowerLevelCmd ); - - } - { - /* Set default Power level Command */ - ConParm_t defaultPowerLevelCmd[] = { - {(PS8)"DefaultPowerLevel", CON_PARM_RANGE | CON_PARM_OPTIONAL, 0, 2, 2 }, /* Min/Max/Def */ - CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h, (PS8)"set_deFault_powerlevel", (PS8)"Set the default power level", (FuncToken_t) CuCmd_SetDefaultPowerLevel, defaultPowerLevelCmd ); - - } - { - /* Set doze mode in auto power mode */ - ConParm_t powerSaveDozeMode[] = { - {(PS8)"DozeModeInAuto", CON_PARM_RANGE | CON_PARM_OPTIONAL, AUTO_POWER_MODE_DOZE_MODE_MIN_VALUE, AUTO_POWER_MODE_DOZE_MODE_MAX_VALUE, AUTO_POWER_MODE_DOZE_MODE_DEF_VALUE }, - CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h, (PS8)"set_doZe_mode_in_auto", (PS8)"Set doze mode in auto power mode", (FuncToken_t) CuCmd_SetDozeModeInAutoPowerLevel, powerSaveDozeMode ); - - } - - { - ConParm_t TrafficIntensityParams[] = { - {(PS8)"HighThreshold (packets/sec)", CON_PARM_RANGE | CON_PARM_OPTIONAL, 0, 1000, 100 }, - {(PS8)"LowThreshold (packets/sec)", CON_PARM_RANGE | CON_PARM_OPTIONAL, 0, 1000, 25 }, - {(PS8)"CheckInterval (ms)", CON_PARM_RANGE | CON_PARM_OPTIONAL, 100, 10000, 1000 }, - CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h, (PS8)"traffic_Thresholds", (PS8)"Set/Get traffic intensity thresholds", (FuncToken_t) CuCmd_SetTrafficIntensityTh, TrafficIntensityParams ); - } - Console_AddToken(pTiCon->hConsole,h, (PS8)"eNable", (PS8)"enable traffic intensity events", (FuncToken_t) CuCmd_EnableTrafficEvents, NULL ); - Console_AddToken(pTiCon->hConsole,h, (PS8)"Disable", (PS8)"disable traffic intensity events", (FuncToken_t) CuCmd_DisableTrafficEvents, NULL ); - { - /* set DCO-Itrim parameters */ - ConParm_t dcoItrimParams[] = { {(PS8)"Enable/Disable <1/0>", CON_PARM_RANGE | CON_PARM_OPTIONAL, DCO_ITRIM_ENABLE_MIN, DCO_ITRIM_ENABLE_MAX, DCO_ITRIM_ENABLE_DEF }, - {(PS8)"Set Moderation Timeout (usec)", CON_PARM_RANGE | CON_PARM_OPTIONAL, DCO_ITRIM_MODERATION_TIMEOUT_MIN, DCO_ITRIM_MODERATION_TIMEOUT_MAX, DCO_ITRIM_MODERATION_TIMEOUT_DEF}, - CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h, (PS8)"set_dcO_itrim", (PS8)"Set/Get DCO Itrim Parameters", (FuncToken_t) CuCmd_SetDcoItrimParams, dcoItrimParams ); - } - - /* -------------------------------------------- Events -------------------------------------------- */ - - CHK_NULL(h = (THandle) Console_AddDirExt(pTiCon->hConsole, (THandle) NULL, (PS8)"eVents", (PS8)"Events" ) ); - { - ConParm_t aaa[] = { {(PS8)"type", CON_PARM_OPTIONAL, 0, 0, 0 }, CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h, (PS8)"Register", (PS8)"IPC events", (FuncToken_t)CuCmd_RegisterEvents, aaa); - } - { - ConParm_t aaa[] = { {(PS8)"type", CON_PARM_OPTIONAL, 0, 0, 0 }, CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h, (PS8)"Unregister", (PS8)"IPC events", (FuncToken_t)CuCmd_UnregisterEvents, aaa); - } - - /* -------------------------------------------- SG -------------------------------------------- */ - CHK_NULL(h = (THandle) Console_AddDirExt(pTiCon->hConsole, (THandle) NULL, (PS8)"Bt CoExsistance", (PS8)"BT - Wlan CoExsistance" ) ); - { - ConParm_t aaa[] = { {(PS8)"enable", CON_PARM_RANGE | CON_PARM_OPTIONAL, - SOFT_GEMINI_ENABLED_MIN, SOFT_GEMINI_ENABLED_MAX, 0 }, CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h, (PS8)"Enable", (PS8)"Enable BT Coexistense", (FuncToken_t) CuCmd_EnableBtCoe, aaa ); - } - { - ConParm_t aaa[] = { - {(PS8)"coexParamIdx", CON_PARM_RANGE | CON_PARM_OPTIONAL , - SOFT_GEMINI_PARAMS_INDEX_MIN, SOFT_GEMINI_PARAMS_INDEX_MAX, SOFT_GEMINI_PARAMS_INDEX_DEF }, - {(PS8)"coexParamValue", CON_PARM_RANGE | CON_PARM_OPTIONAL , - SOFT_GEMINI_PARAMS_VALUE_MIN, SOFT_GEMINI_PARAMS_VALUE_MAX, SOFT_GEMINI_PARAMS_VALUE_DEF}, - CON_LAST_PARM }; - - Console_AddToken(pTiCon->hConsole, h, (PS8)"Config", (PS8)"Parameters configuration", (FuncToken_t) CuCmd_ConfigBtCoe, aaa ); - } - { - ConParm_t aaa[] = { {(PS8)"status", CON_PARM_RANGE | CON_PARM_OPTIONAL, 0, 3, 0 }, CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole, h, (PS8)"Status", (PS8)"Get status", (FuncToken_t) CuCmd_GetBtCoeStatus, aaa ); - } - { - ConParm_t aaa[] = { - {(PS8)"coexIp", CON_PARM_RANGE | CON_PARM_OPTIONAL , - COEX_ACTIVITY_PARAMS_COEX_IP_MIN, COEX_ACTIVITY_PARAMS_COEX_IP_MAX, COEX_ACTIVITY_PARAMS_COEX_IP_DEF }, - {(PS8)"activityId", CON_PARM_RANGE | CON_PARM_OPTIONAL , - COEX_ACTIVITY_PARAMS_ACTIVITY_ID_MIN, COEX_ACTIVITY_PARAMS_ACTIVITY_ID_MAX, COEX_ACTIVITY_PARAMS_ACTIVITY_ID_DEF}, - {(PS8)"defaultPriority", CON_PARM_RANGE | CON_PARM_OPTIONAL , - COEX_ACTIVITY_PARAMS_DEFAULT_PRIO_MIN, COEX_ACTIVITY_PARAMS_DEFAULT_PRIO_MAX, COEX_ACTIVITY_PARAMS_DEFAULT_PRIO_DEF}, - {(PS8)"raisedPriority", CON_PARM_RANGE | CON_PARM_OPTIONAL, - COEX_ACTIVITY_PARAMS_RAISED_PRIO_MIN, COEX_ACTIVITY_PARAMS_RAISED_PRIO_MAX, COEX_ACTIVITY_PARAMS_RAISED_PRIO_DEF}, - {(PS8)"minService", CON_PARM_RANGE | CON_PARM_OPTIONAL , - COEX_ACTIVITY_PARAMS_MIN_SERVICE_MIN, COEX_ACTIVITY_PARAMS_MIN_SERVICE_MAX, COEX_ACTIVITY_PARAMS_MIN_SERVICE_DEF }, - {(PS8)"maxService", CON_PARM_RANGE | CON_PARM_OPTIONAL , - COEX_ACTIVITY_PARAMS_MAX_SERVICE_MIN, COEX_ACTIVITY_PARAMS_MAX_SERVICE_MAX, COEX_ACTIVITY_PARAMS_MAX_SERVICE_DEF}, - CON_LAST_PARM }; - - Console_AddToken(pTiCon->hConsole, h, (PS8)"coexActivity", (PS8)"Coex Activity Parameters configuration", (FuncToken_t) CuCmd_ConfigCoexActivity, aaa ); - } - { - ConParm_t aaa[] = { - {(PS8)"enable", CON_PARM_RANGE | CON_PARM_OPTIONAL , - FM_COEX_ENABLE_MIN, FM_COEX_ENABLE_MAX, FM_COEX_ENABLE_DEF }, - {(PS8)"swallowPeriod", CON_PARM_RANGE | CON_PARM_OPTIONAL , - FM_COEX_SWALLOW_PERIOD_MIN, FM_COEX_SWALLOW_PERIOD_MAX, FM_COEX_SWALLOW_PERIOD_DEF }, - {(PS8)"nDividerFrefSet1", CON_PARM_RANGE | CON_PARM_OPTIONAL , - FM_COEX_N_DIVIDER_FREF_SET1_MIN, FM_COEX_N_DIVIDER_FREF_SET1_MAX, FM_COEX_N_DIVIDER_FREF_SET1_DEF }, - {(PS8)"nDividerFrefSet2", CON_PARM_RANGE | CON_PARM_OPTIONAL , - FM_COEX_N_DIVIDER_FREF_SET2_MIN, FM_COEX_N_DIVIDER_FREF_SET2_MAX, FM_COEX_N_DIVIDER_FREF_SET2_DEF }, - {(PS8)"mDividerFrefSet1", CON_PARM_RANGE | CON_PARM_OPTIONAL , - FM_COEX_M_DIVIDER_FREF_SET1_MIN, FM_COEX_M_DIVIDER_FREF_SET1_MAX, FM_COEX_M_DIVIDER_FREF_SET1_DEF }, - {(PS8)"mDividerFrefSet2", CON_PARM_RANGE | CON_PARM_OPTIONAL , - FM_COEX_M_DIVIDER_FREF_SET2_MIN, FM_COEX_M_DIVIDER_FREF_SET2_MAX, FM_COEX_M_DIVIDER_FREF_SET2_DEF }, - {(PS8)"pllStabilizationTime", CON_PARM_RANGE | CON_PARM_OPTIONAL , - FM_COEX_PLL_STABILIZATION_TIME_MIN, FM_COEX_PLL_STABILIZATION_TIME_MAX, FM_COEX_PLL_STABILIZATION_TIME_DEF }, - {(PS8)"ldoStabilizationTime", CON_PARM_RANGE | CON_PARM_OPTIONAL , - FM_COEX_LDO_STABILIZATION_TIME_MIN, FM_COEX_LDO_STABILIZATION_TIME_MAX, FM_COEX_LDO_STABILIZATION_TIME_DEF }, - {(PS8)"disturbedBandMargin", CON_PARM_RANGE | CON_PARM_OPTIONAL , - FM_COEX_DISTURBED_BAND_MARGIN_MIN, FM_COEX_DISTURBED_BAND_MARGIN_MAX, FM_COEX_DISTURBED_BAND_MARGIN_DEF }, - {(PS8)"swallowClkDif", CON_PARM_RANGE | CON_PARM_OPTIONAL , - FM_COEX_SWALLOW_CLK_DIF_MIN, FM_COEX_SWALLOW_CLK_DIF_MAX, FM_COEX_SWALLOW_CLK_DIF_DEF }, - CON_LAST_PARM }; - - Console_AddToken(pTiCon->hConsole, h, (PS8)"Fm_coexistence", (PS8)"FM Coexistence parameters configuration", (FuncToken_t) CuCmd_ConfigFmCoex, aaa ); - } - -#ifdef XCC_MODULE_INCLUDED - CuXCC_AddMeasurementMenu(pTiCon->hConsole); -#endif /* XCC_MODULE_INCLUDED*/ - -#ifdef TI_DBG - - /* -------------------------------------------- Report -------------------------------------------- */ - - CHK_NULL(h1 = (THandle) Console_AddDirExt(pTiCon->hConsole, (THandle) NULL, (PS8)"Report", (PS8)"Debug features" ) ); - { - ConParm_t aaa[] = - { - {(PS8)"module table", CON_PARM_STRING | CON_PARM_OPTIONAL , REPORT_FILES_NUM, REPORT_FILES_NUM, 0 }, - CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h1, (PS8)"Set", (PS8)"set report module table", (FuncToken_t) CuCmd_SetReport, aaa ); - } - { - ConParm_t aaa[] = - { - {(PS8)"module", CON_PARM_OPTIONAL, 0, 0, 0 }, - CON_LAST_PARM - }; - Console_AddToken(pTiCon->hConsole,h1, (PS8)"Add", (PS8)"set report for specified module", (FuncToken_t) CuCmd_AddReport, aaa ); - } - { - ConParm_t aaa[] = - { - {(PS8)"module", CON_PARM_OPTIONAL, 0, 0, 0 }, - CON_LAST_PARM - }; - Console_AddToken(pTiCon->hConsole,h1, (PS8)"Clear", (PS8)"clear report for specified module", (FuncToken_t) CuCmd_ClearReport, aaa ); - } - { - ConParm_t aaa[] = { {(PS8)"level", CON_PARM_OPTIONAL , 0, 0, 0 }, CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h1, (PS8)"Level", (PS8)"set report severity level", (FuncToken_t) CuCmd_ReportSeverityLevel, aaa ); - } - /* -------------------------------------------- Debug -------------------------------------------- */ - - CHK_NULL(h = (THandle) Console_AddDirExt(pTiCon->hConsole, (THandle) NULL, (PS8)"dEbug", (PS8)"Debug features" ) ); - { - ConParm_t aaa[] = {{(PS8)"func_num", CON_PARM_OPTIONAL, 0, 0, 0 }, - {(PS8)"param1 (decimal)", CON_PARM_OPTIONAL , 0, 0, 0 }, - {(PS8)"param2 (decimal)", CON_PARM_OPTIONAL , 0, 0, 0 }, - {(PS8)"R/W Mem buf (up to 32 characters)", CON_PARM_STRING | CON_PARM_OPTIONAL, 0, FW_DEBUG_MAX_BUF * 2, 0 }, - CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h, (PS8)"Print", (PS8)"print driver debug info", (FuncToken_t) CuCmd_PrintDriverDebug, aaa ); - - CHK_NULL(h1 = (THandle) Console_AddDirExt(pTiCon->hConsole, (THandle)h , (PS8)"Fw Debug", (PS8)"Debug features" ) ); - { - { - ConParm_t aaa[] = { { (PS8)"debug", CON_PARM_OPTIONAL | CON_PARM_LINE, 0, 2050, 0 }, CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole, h1, (PS8)"debug", (PS8)" debug", (FuncToken_t) CuCmd_FwDebug, aaa ); - } - { - ConParm_t aaa[] = { {(PS8)"Index", CON_PARM_OPTIONAL|CON_PARM_RANGE | CON_PARM_SIGN,0,255,0}, - {(PS8)"Value_1", CON_PARM_OPTIONAL|CON_PARM_RANGE | CON_PARM_SIGN,-4096,4069,0}, - {(PS8)"Value_2", CON_PARM_OPTIONAL|CON_PARM_RANGE | CON_PARM_SIGN,-4096,4069,0}, - {(PS8)"Value_3", CON_PARM_OPTIONAL|CON_PARM_RANGE | CON_PARM_SIGN,-4096,4069,0}, - {(PS8)"Value_4", CON_PARM_OPTIONAL|CON_PARM_RANGE | CON_PARM_SIGN,-4096,4069,0}, - {(PS8)"Value_5", CON_PARM_OPTIONAL|CON_PARM_RANGE | CON_PARM_SIGN,-4096,4069,0}, - {(PS8)"Value_6", CON_PARM_OPTIONAL|CON_PARM_RANGE | CON_PARM_SIGN,-4096,4069,0}, - {(PS8)"Value_7", CON_PARM_OPTIONAL|CON_PARM_RANGE | CON_PARM_SIGN,-4096,4069,0}, - {(PS8)"Value_8", CON_PARM_OPTIONAL|CON_PARM_RANGE | CON_PARM_SIGN,-4096,4069,0}, - {(PS8)"Value_9", CON_PARM_OPTIONAL|CON_PARM_RANGE | CON_PARM_SIGN,-4096,4069,0}, - {(PS8)"Value_10", CON_PARM_OPTIONAL|CON_PARM_RANGE | CON_PARM_SIGN,-4096,4069,0}, - {(PS8)"Value_11", CON_PARM_OPTIONAL|CON_PARM_RANGE | CON_PARM_SIGN,-4096,4069,0}, - {(PS8)"Value_12", CON_PARM_OPTIONAL|CON_PARM_RANGE | CON_PARM_SIGN,-4096,4069,0}, - {(PS8)"Value_13", CON_PARM_OPTIONAL|CON_PARM_RANGE | CON_PARM_SIGN,-4096,4069,0}, - CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole, h1, (PS8)"Set rate managment", (PS8)"rate managment", (FuncToken_t) CuCmd_SetRateMngDebug, aaa ); - - } - { - ConParm_t aaa[] = { {(PS8)"Index", CON_PARM_OPTIONAL,0,4096,0}, - {(PS8)"Value", CON_PARM_OPTIONAL,0,4096,0}, CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole, h1, (PS8)"Get rate managment", (PS8)"rate managment", (FuncToken_t) CuCmd_GetRateMngDebug, aaa ); - } - - { - ConParm_t aaa[] = { {(PS8)"IpPart1", CON_PARM_OPTIONAL,0,255,0}, - {(PS8)"IpPart2", CON_PARM_OPTIONAL,0,255,0}, - {(PS8)"IpPart3", CON_PARM_OPTIONAL,0,255,0}, - {(PS8)"IpPart4", CON_PARM_OPTIONAL,0,255,0}, - CON_LAST_PARM }; - - Console_AddToken(pTiCon->hConsole, h1, (PS8)"set Arp ip filter", (PS8)"arp ip filter", (FuncToken_t) CuCmd_SetArpIPFilter, aaa ); - } - - } - } - -#endif /*TI_DBG*/ - - /* -------------------------------------------- BIT -------------------------------------------- */ - - CHK_NULL(h = (THandle) Console_AddDirExt(pTiCon->hConsole, (THandle) NULL, (PS8)"biT", (PS8)"Built In Test" ) ); - - CHK_NULL(h1 = (THandle) Console_AddDirExt(pTiCon->hConsole, (THandle) h, (PS8)"Bip", (PS8)"Built In Production Line Test" ) ); - { - { - ConParm_t aaa[] = {{(PS8)"iReferencePointDetectorValue", CON_PARM_OPTIONAL|CON_PARM_RANGE, 0, 1000, 0 }, - {(PS8)"iReferencePointPower", CON_PARM_OPTIONAL|CON_PARM_RANGE, 0, 200, 0 }, - {(PS8)"isubBand", CON_PARM_OPTIONAL|CON_PARM_RANGE, 0, 10, 0 }, - CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h1, (PS8)"update Buffer calref point", (PS8)"BufferCalReferencePoint", (FuncToken_t) CuCmd_BIP_BufferCalReferencePoint, aaa ); - } - - { - ConParm_t aaa[] = {{(PS8)"Sub Band B/G: 1 - 14", CON_PARM_RANGE, 0, 1, 0 }, - {(PS8)"Sub Band A: 1 - 4", CON_PARM_RANGE, 0, 1, 0 }, - {(PS8)"Sub Band A: 8 - 16", CON_PARM_RANGE, 0, 1, 0 }, - {(PS8)"Sub Band A: 34 - 48", CON_PARM_RANGE, 0, 1, 0 }, - {(PS8)"Sub Band A: 52 - 64", CON_PARM_RANGE, 0, 1, 0 }, - {(PS8)"Sub Band A: 100 -116", CON_PARM_RANGE, 0, 1, 0 }, - {(PS8)"Sub Band A: 120 -140", CON_PARM_RANGE, 0, 1, 0 }, - {(PS8)"Sub Band A: 149 -165", CON_PARM_RANGE, 0, 1, 0 }, - CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h1, (PS8)"Tx bip", (PS8)"P2G Calibration", (FuncToken_t) CuCmd_BIP_StartBIP, aaa ); - } - - - CHK_NULL(h2 = (THandle) Console_AddDirExt(pTiCon->hConsole, (THandle) h1, (PS8)"Rx bip", (PS8)"Rx Built In Production Line Test" ) ); - { - { - ConParm_t aaa[] = {{(PS8)"initiates RX BIP operations",CON_PARM_OPTIONAL }, - CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h2, (PS8)"rx Enter", (PS8)"enter Rx Calibration state", (FuncToken_t) CuCmd_BIP_EnterRxBIP, aaa ); - } - - { - ConParm_t aaa[] = {{(PS8)"Reference point value", CON_PARM_SIGN }, - CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h2, (PS8)"rx Start", (PS8)" Rx Calibration", (FuncToken_t) CuCmd_BIP_StartRxBIP, aaa ); - } - - { - ConParm_t aaa[] = {{(PS8)"finished the RX BIP procedure" ,CON_PARM_OPTIONAL}, - CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h2, (PS8)"rx eXit", (PS8)"Exit Rx Calibration", (FuncToken_t) CuCmd_BIP_ExitRxBIP, aaa ); - } - - } - - - } - - CHK_NULL(h1 = (THandle) Console_AddDirExt(pTiCon->hConsole, (THandle) h, (PS8)"Radio debug", (PS8)"Radio Debug Test" ) ); - { - /* Get HDK version*/ - Console_AddToken(pTiCon->hConsole,h1, (PS8)"Get hdk version", (PS8)"HDK version", (FuncToken_t) CuCmd_RadioDebug_GetHDKVersion, NULL ); - /* Rx Channel Tune */ - { - ConParm_t aaa[] = {{(PS8)"Band", CON_PARM_OPTIONAL|CON_PARM_RANGE, 0, 2, 0 }, - {(PS8)"Channel", CON_PARM_OPTIONAL|CON_PARM_RANGE , 1, 161, 0 }, - CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h1, (PS8)"cHannel tune", (PS8)"Set the RX channel", (FuncToken_t) CuCmd_RadioDebug_ChannelTune, aaa ); - } - /* TX Debug */ - CHK_NULL(h2 = (THandle) Console_AddDirExt(pTiCon->hConsole, (THandle) h1, (PS8)"Tx debug", (PS8)"TX Debug Test" ) ); - { - /* TELEC */ - { - ConParm_t aaa[] = {{(PS8)"Power", CON_PARM_OPTIONAL, 0, 25000, 0 }, - {(PS8)"Tone Type", CON_PARM_OPTIONAL, 1, 2, 2 }, - /* {(PS8)"Band", CON_PARM_OPTIONAL, 0, 2, 0 }, - {(PS8)"Channel", CON_PARM_OPTIONAL , 1, 161, 0 }, - {(PS8)"Power", CON_PARM_OPTIONAL, 0, 0, 0 }, - {(PS8)"Tone Type", CON_PARM_OPTIONAL, 0, 0, 0 }, - {(PS8)"Tone Number - Single Tones", CON_PARM_OPTIONAL, 0, 0, 0 }, - {(PS8)"Tone Number - Two Tones", CON_PARM_OPTIONAL, 0, 0, 0 }, - {(PS8)"Use Digital DC", CON_PARM_OPTIONAL, 0, 0, 0 }, - {(PS8)"Invert", CON_PARM_OPTIONAL, 0, 0, 0 }, - {(PS8)"Eleven N Span", CON_PARM_OPTIONAL, 0, 0, 0 }, - {(PS8)"Digital DC", CON_PARM_OPTIONAL, 0, 0, 0 }, - {(PS8)"Analog DC Fine", CON_PARM_OPTIONAL, 0, 0, 0 }, - {(PS8)"Analog DC Coarse", CON_PARM_OPTIONAL, 0, 0, 0 },*/ - CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h2, (PS8)"Cw", (PS8)"Start CW test", (FuncToken_t) CuCmd_RadioDebug_StartTxCw, aaa ); - - } - /* FCC */ - { - ConParm_t aaa[] = {{(PS8)"Delay", CON_PARM_OPTIONAL, 0, 0, 0 }, - {(PS8)"Rate", CON_PARM_OPTIONAL, 0, 0, 0 }, - {(PS8)"Size", CON_PARM_OPTIONAL, 0, 0, 0 }, - {(PS8)"Amount", CON_PARM_OPTIONAL, 0, 0, 0 }, - {(PS8)"Power", CON_PARM_OPTIONAL, 0, 0, 0 }, - {(PS8)"Seed", CON_PARM_OPTIONAL, 0, 0, 0 }, - {(PS8)"Packet Mode", CON_PARM_OPTIONAL, 0, 0, 0 }, - {(PS8)"DC On Off", CON_PARM_OPTIONAL, 0, 0, 0 }, - {(PS8)"GI", CON_PARM_OPTIONAL, 0, 0, 0 }, - {(PS8)"Preamble", CON_PARM_OPTIONAL, 0, 0, 0 }, - {(PS8)"Type", CON_PARM_OPTIONAL, 0, 0, 0 }, - {(PS8)"Scrambler", CON_PARM_OPTIONAL, 0, 0, 0 }, - {(PS8)"Enable CLPC", CON_PARM_OPTIONAL, 0, 0, 0 }, - {(PS8)"Sequance Number Mode", CON_PARM_OPTIONAL, 0, 0, 0 }, - {(PS8)"Destination MAC Address", CON_PARM_STRING | CON_PARM_OPTIONAL, 0, 32, 0 }, - /* future use. for now the oregenal source address are use. - {(PS8)"Source MAC Address", CON_PARM_STRING | CON_PARM_OPTIONAL, 0, 32, 0 }, - */ - {(PS8)"Destination MAC Address", CON_PARM_STRING | CON_PARM_OPTIONAL, 0, 32, 0 }, - CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h2, (PS8)"coNtinues", (PS8)"Start TX continues test", (FuncToken_t) CuCmd_RadioDebug_StartContinuousTx, aaa ); - } - /* Stop FCC/TELEC */ - { - Console_AddToken(pTiCon->hConsole,h2, (PS8)"Stop", (PS8)"Stop TX tests", (FuncToken_t) CuCmd_RadioDebug_StopTx, NULL ); - } -#if 0 /* not support for now */ - /* TEMPLATE */ - { - ConParm_t aaa[] = {{(PS8)"Length", CON_PARM_OPTIONAL|CON_PARM_RANGE, 0, 0, 0 }, - {(PS8)"Offset", CON_PARM_OPTIONAL|CON_PARM_RANGE , 0, 0, 0 }, - {(PS8)"Data", CON_PARM_OPTIONAL|CON_PARM_RANGE, 0, 0, 0 }, - CON_LAST_PARM }; - Console_AddToken(pTiCon->hConsole,h2, (PS8)"temPlate", (PS8)"Set Template", (FuncToken_t) CuCmd_RadioDebug_Template, aaa ); - } -#endif - } - /*yael - to Complete statistics */ - CHK_NULL(h2 = (THandle) Console_AddDirExt(pTiCon->hConsole, (THandle) h1, (PS8)"rx Statistics", (PS8)"Rx Statistics" ) ); - { - /* RX Statixtics Start */ - Console_AddToken(pTiCon->hConsole,h2, (PS8)"rx stat Start", (PS8)"Start Rx Statistics", (FuncToken_t)CuCmd_RadioDebug_StartRxStatistics , NULL ); - /* RX Statixtics Stop */ - Console_AddToken(pTiCon->hConsole,h2, (PS8)"rx stat stoP", (PS8)"Stop Rx Statistics", (FuncToken_t)CuCmd_RadioDebug_StopRxStatistics , NULL ); - /* RX Statixtics Reset */ - Console_AddToken(pTiCon->hConsole,h2, (PS8)"rx stat Reset", (PS8)"Reset Rx Statistics", (FuncToken_t)CuCmd_RadioDebug_ResetRxStatistics , NULL ); - /* RX Statixtics Get */ - Console_AddToken(pTiCon->hConsole,h2, (PS8)"rx stat Get", (PS8)"Get Rx Statistics", (FuncToken_t)CuCmd_RadioDebug_GetRxStatistics , NULL ); - } - } /* h1 */ - - /* -------------------------------------------- Root -------------------------------------------- */ - - Console_AddToken(pTiCon->hConsole,NULL, (PS8)"aboUt", (PS8)"About", (FuncToken_t) CuCmd_ShowAbout, NULL ); - Console_AddToken(pTiCon->hConsole,NULL, (PS8)"Quit", (PS8)"quit", (FuncToken_t) CuCmd_Quit, NULL ); - - return 0; -} - - -static S32 TiCon_Print_Usage(VOID) -{ - os_error_printf(CU_MSG_ERROR, (PS8)"Usage: ./wlan_cu [driver_name] [options]\n"); - os_error_printf(CU_MSG_ERROR, (PS8)" -b - bypass supplicant\n"); - os_error_printf(CU_MSG_ERROR, (PS8)" -i<ifname> - supplicant interface file\n"); - os_error_printf(CU_MSG_ERROR, (PS8)"example:\n"); - os_error_printf(CU_MSG_ERROR, (PS8)" ./wlan_cu tiwlan0 -i/voice/tiwlan0\n"); - return 0; -} - -static VOID TiCon_SignalCtrlC(S32 signo) -{ - os_error_printf(CU_MSG_ERROR, (PS8)"TiCon_Signal - got signal Ctrl+c ... exiting\n"); - Console_Stop(g_TiCon.hConsole); -} - - -/* functions */ -/*************/ -S32 user_main(S32 argc, PS8* argv) -{ - S32 i; - char *script_file = NULL; - S32 BypassSupplicant = FALSE; - S8 SupplIfFile[50]; - S32 fill_name = TRUE; - int stop_UI = 0; - - SupplIfFile[0] = '\0'; - if( argc > 1 ) - { - i=1; - if( argv[i][0] != '-' ) - { - os_strcpy( g_TiCon.drv_name, argv[i++] ); - fill_name = FALSE; - } - - for( ;i < argc; i++ ) - { - if( !os_strcmp(argv[i], (PS8)"-h" ) || !os_strcmp(argv[i], (PS8)"--help") ) - { - TiCon_Print_Usage(); - return 0; - } - else if(!os_strcmp(argv[i], (PS8)"-b")) - { - BypassSupplicant = TRUE; - } - else if(!os_strncmp(argv[i], (PS8)"-i", 2)) - { - os_strcpy( SupplIfFile, &(argv[i])[2] ); - } - else if(!os_strncmp(argv[i], "-s", 2 ) ) - { - script_file = argv[++i]; - } - } - } - - os_OsSpecificCmdParams(argc, argv); - - /* fill the driver name */ - if(fill_name == TRUE) - { - os_strcpy(g_TiCon.drv_name, (PS8)TIWLAN_DRV_NAME); - } - - /* fill supplicant interface file */ - if(SupplIfFile[0] == '\0') - { - os_strcpy(SupplIfFile, (PS8)SUPPL_IF_FILE); - } - - g_TiCon.hConsole = Console_Create(g_TiCon.drv_name, BypassSupplicant, SupplIfFile); - if(g_TiCon.hConsole == NULL) - return 0; - - Console_GetDeviceStatus(g_TiCon.hConsole); - - os_Catch_CtrlC_Signal(TiCon_SignalCtrlC); - - os_InitOsSpecificModules(); - - /* ----------------------------------------------------------- */ - TiCon_Init_Console_Menu(&g_TiCon); - - if( script_file ) - { - stop_UI = consoleRunScript (script_file, g_TiCon.hConsole); - } - - if( !stop_UI ) - { - os_error_printf(CU_MSG_INFO2, (PS8)("user_main, start\n") ); - Console_Start(g_TiCon.hConsole); - } - - Console_Destroy(g_TiCon.hConsole); - - os_DeInitOsSpecificModules(); - - return 0; -} - -/* Stubs for all OS */ -void g_tester_send_event(U8 event_index) -{ -} - -void ProcessLoggerMessage(PU8 data, U32 len) -{ -} diff --git a/wl1271/CUDK/configurationutility/src/wpa_core.c b/wl1271/CUDK/configurationutility/src/wpa_core.c deleted file mode 100644 index f771625c..00000000 --- a/wl1271/CUDK/configurationutility/src/wpa_core.c +++ /dev/null @@ -1,940 +0,0 @@ -/* - * wpa_core.c - * - * Copyright 2001-2010 Texas Instruments, Inc. - http://www.ti.com/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/**************************************************************************** -* -* MODULE: Wpa_Core.c -* -* PURPOSE: -* -* DESCRIPTION: -* ============ -* -* -****************************************************************************/ - -/* includes */ -/************/ - -#ifdef ANDROID -#include <unistd.h> -#endif - -#include <netinet/if_ether.h> - -#include "cu_osapi.h" -#include "TWDriver.h" -#include "config_ssid.h" -#include "driver.h" -#include "ipc_wpa.h" -#include "wpa_core.h" -#include "oserr.h" - -/* defines */ -/***********/ -#ifdef CONFIG_WPS -#define WSC_MODE_OFF 0 -#define WSC_MODE_PIN 1 -#define WSC_MODE_PBC 2 -#endif - -/* local types */ -/***************/ -/* Network configuration block - holds candidate connection parameters */ -typedef struct -{ - S32 mode; - S32 proto; - S32 key_mgmt; - S32 auth_alg; - S32 pair_wise; - S32 group; - U8 pass_phrase[WPACORE_MAX_PSK_STRING_LENGTH]; - U8 wep_key[4][32]; - U8 default_wep_key; - U8 wep_key_length; -#ifdef CONFIG_WPS - U8 WscMode; - PS8 pWscPin; -#endif - S32 eap; - U8 Identity[WPACORE_MAX_CERT_PASSWORD_LENGTH]; - U8 private_key_passwd[WPACORE_MAX_CERT_PASSWORD_LENGTH]; - U8 private_key[WPACORE_MAX_CERT_PASSWORD_LENGTH]; - U8 client_cert[WPACORE_MAX_CERT_FILE_NAME_LENGTH]; - U8 password[WPACORE_MAX_CERT_PASSWORD_LENGTH]; - U8 anyWpaMode; -#ifdef XCC_MODULE_INCLUDED - U16 XCC; -#endif -} TWpaCore_WpaSupplParams; - -typedef struct -{ - OS_802_11_AUTHENTICATION_MODE AuthMode; - OS_802_11_ENCRYPTION_TYPES EncryptionTypePairWise; - OS_802_11_ENCRYPTION_TYPES EncryptionTypeGroup; -} TWpaCore_WpaParams; - -/* Module control block */ -typedef struct TWpaCore -{ - THandle hIpcWpa; - - S32 CurrentNetwork; - - TWpaCore_WpaSupplParams WpaSupplParams; - TWpaCore_WpaParams WpaParams; -} TWpaCore; - -/* local variables */ -/*******************/ - -/* local fucntions */ -/*******************/ -static VOID WpaCore_InitWpaParams(TWpaCore* pWpaCore) -{ - os_memset( &pWpaCore->WpaSupplParams, 0, sizeof(TWpaCore_WpaSupplParams)); - pWpaCore->WpaSupplParams.mode = IEEE80211_MODE_INFRA; /* Default is Infrastructure mode */ - pWpaCore->WpaSupplParams.proto = 0; /* key negotiation protocol - WPA is ok even though no security is used */ - pWpaCore->WpaSupplParams.key_mgmt = WPA_KEY_MGMT_NONE; /* No key management suite */ - pWpaCore->WpaSupplParams.auth_alg = WPA_AUTH_ALG_OPEN; /* Open authentication */ - pWpaCore->WpaSupplParams.pair_wise = WPA_CIPHER_NONE; - pWpaCore->WpaSupplParams.group = WPA_CIPHER_NONE; - pWpaCore->WpaSupplParams.anyWpaMode = 0; -#ifdef CONFIG_WPS - pWpaCore->WpaSupplParams.pWscPin = NULL; - pWpaCore->WpaSupplParams.WscMode = WSC_MODE_OFF; -#endif - - pWpaCore->WpaParams.AuthMode = os802_11AuthModeOpen; - pWpaCore->WpaParams.EncryptionTypeGroup = OS_ENCRYPTION_TYPE_NONE; - pWpaCore->WpaParams.EncryptionTypePairWise = OS_ENCRYPTION_TYPE_NONE; -} - -/* functions */ -/*************/ -THandle WpaCore_Create(PS32 pRes, PS8 pSupplIfFile) -{ - TWpaCore* pWpaCore = (TWpaCore*)os_MemoryCAlloc(sizeof(TWpaCore), sizeof(U8)); - if(pWpaCore == NULL) - { - *pRes = OK; - os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - WpaCore_Create - cant allocate control block\n"); - return NULL; - } - - pWpaCore->hIpcWpa = IpcWpa_Create(pRes, pSupplIfFile); - if(pWpaCore->hIpcWpa == NULL) - { - WpaCore_Destroy(pWpaCore); - return NULL; - } - - WpaCore_InitWpaParams(pWpaCore); - - pWpaCore->CurrentNetwork = -1; - - /* send default configuration to the supplicant */ - IpcWpa_Command(pWpaCore->hIpcWpa, (PS8)"AP_SCAN 2", FALSE); - - return pWpaCore; -} - -VOID WpaCore_Destroy(THandle hWpaCore) -{ - TWpaCore* pWpaCore = (TWpaCore*)hWpaCore; - - if(pWpaCore->hIpcWpa) - IpcWpa_Destroy(pWpaCore->hIpcWpa); -#ifdef CONFIG_WPS - if(pWpaCore->WpaSupplParams.pWscPin) - os_MemoryFree(pWpaCore->WpaSupplParams.pWscPin); -#endif - - os_MemoryFree(pWpaCore); -} - -#ifdef XCC_MODULE_INCLUDED -S32 WpaCore_SetXCC(THandle hWpaCore, U16 XCCConfig) -{ - TWpaCore* pWpaCore = (TWpaCore*)hWpaCore; - - pWpaCore->WpaSupplParams.XCC = XCCConfig; - - return TI_OK; -} -#endif - -S32 WpaCore_SetAuthMode(THandle hWpaCore, OS_802_11_AUTHENTICATION_MODE AuthMode) -{ - TWpaCore* pWpaCore = (TWpaCore*)hWpaCore; - - pWpaCore->WpaParams.AuthMode = AuthMode; - - switch (AuthMode) - { - case os802_11AuthModeOpen: - pWpaCore->WpaSupplParams.proto = 0; - pWpaCore->WpaSupplParams.key_mgmt = WPA_KEY_MGMT_NONE; - pWpaCore->WpaSupplParams.auth_alg = WPA_AUTH_ALG_OPEN; - break; - case os802_11AuthModeShared: - pWpaCore->WpaSupplParams.proto = 0; - pWpaCore->WpaSupplParams.key_mgmt = WPA_KEY_MGMT_NONE; - pWpaCore->WpaSupplParams.auth_alg = WPA_AUTH_ALG_SHARED; - break; - case os802_11AuthModeWPANone: - pWpaCore->WpaSupplParams.proto = WPA_PROTO_WPA; - pWpaCore->WpaSupplParams.key_mgmt = WPA_KEY_MGMT_WPA_NONE; - pWpaCore->WpaSupplParams.auth_alg = WPA_AUTH_ALG_OPEN; - break; - case os802_11AuthModeWPAPSK: - pWpaCore->WpaSupplParams.proto = WPA_PROTO_WPA; - pWpaCore->WpaSupplParams.key_mgmt = WPA_KEY_MGMT_PSK; - pWpaCore->WpaSupplParams.auth_alg = WPA_AUTH_ALG_OPEN; - break; - case os802_11AuthModeWPA2PSK: - pWpaCore->WpaSupplParams.proto = WPA_PROTO_RSN; - pWpaCore->WpaSupplParams.key_mgmt = WPA_KEY_MGMT_PSK; - pWpaCore->WpaSupplParams.auth_alg = WPA_AUTH_ALG_OPEN; - break; - case os802_11AuthModeWPA: - pWpaCore->WpaSupplParams.proto = WPA_PROTO_WPA; - pWpaCore->WpaSupplParams.key_mgmt = WPA_KEY_MGMT_IEEE8021X; - pWpaCore->WpaSupplParams.auth_alg = WPA_AUTH_ALG_OPEN; - break; - case os802_11AuthModeWPA2: - pWpaCore->WpaSupplParams.proto = WPA_PROTO_RSN; - pWpaCore->WpaSupplParams.key_mgmt = WPA_KEY_MGMT_IEEE8021X; - pWpaCore->WpaSupplParams.auth_alg = WPA_AUTH_ALG_OPEN; - break; - - default: - os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - WpaCore_SetAuthMode - unknown authentication mode (%d)!!!\n", AuthMode); - return ECUERR_WPA_CORE_ERROR_UNKNOWN_AUTH_MODE; - } - - return OK; -} - - -S32 WpaCore_GetAuthMode(THandle hWpaCore, PU32 pAuthMode) -{ - TWpaCore* pWpaCore = (TWpaCore*)hWpaCore; - - *pAuthMode = pWpaCore->WpaParams.AuthMode; - - return OK; -} - -S32 WpaCore_SetEncryptionPairWise(THandle hWpaCore, OS_802_11_ENCRYPTION_TYPES EncryptionType) -{ - TWpaCore* pWpaCore = (TWpaCore*)hWpaCore; - - pWpaCore->WpaParams.EncryptionTypePairWise = EncryptionType; - - switch (EncryptionType) - { - case OS_ENCRYPTION_TYPE_NONE: - pWpaCore->WpaSupplParams.pair_wise = WPA_CIPHER_NONE; - break; - case OS_ENCRYPTION_TYPE_WEP: - pWpaCore->WpaSupplParams.pair_wise = WPA_CIPHER_WEP40; - break; - case OS_ENCRYPTION_TYPE_TKIP: - pWpaCore->WpaSupplParams.pair_wise = WPA_CIPHER_TKIP; - break; - case OS_ENCRYPTION_TYPE_AES: - pWpaCore->WpaSupplParams.pair_wise = WPA_CIPHER_CCMP; - break; - } - - return OK; -} - -S32 WpaCore_SetPrivacyEap(THandle hWpaCore, OS_802_11_EAP_TYPES EapType) -{ - TWpaCore* pWpaCore = (TWpaCore*)hWpaCore; - - pWpaCore->WpaSupplParams.eap = EapType; - - return OK; -} - -S32 WpaCore_GetEncryptionPairWise(THandle hWpaCore, OS_802_11_ENCRYPTION_TYPES* pEncryptionType) -{ - TWpaCore* pWpaCore = (TWpaCore*)hWpaCore; - - *pEncryptionType = pWpaCore->WpaParams.EncryptionTypePairWise; - - return OK; -} - -S32 WpaCore_SetEncryptionGroup(THandle hWpaCore, OS_802_11_ENCRYPTION_TYPES EncryptionType) -{ - TWpaCore* pWpaCore = (TWpaCore*)hWpaCore; - - pWpaCore->WpaParams.EncryptionTypeGroup = EncryptionType; - - switch (EncryptionType) - { - case OS_ENCRYPTION_TYPE_NONE: - os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - WpaCore_SetEncryptionGroup - group encryption cant be NONE\n"); - break; - case OS_ENCRYPTION_TYPE_WEP: - pWpaCore->WpaSupplParams.group = WPA_CIPHER_WEP40; - break; - - case OS_ENCRYPTION_TYPE_TKIP: - pWpaCore->WpaSupplParams.group = WPA_CIPHER_TKIP; - break; - case OS_ENCRYPTION_TYPE_AES: - pWpaCore->WpaSupplParams.group = WPA_CIPHER_CCMP; - break; - } - - return OK; -} - -S32 WpaCore_GetEncryptionGroup(THandle hWpaCore, OS_802_11_ENCRYPTION_TYPES* pEncryptionType) -{ - TWpaCore* pWpaCore = (TWpaCore*)hWpaCore; - - *pEncryptionType = pWpaCore->WpaParams.EncryptionTypeGroup; - - return OK; -} - -S32 WpaCore_SetCredentials(THandle hWpaCore, PU8 Identity, PU8 Passward) -{ - TWpaCore* pWpaCore = (TWpaCore*)hWpaCore; - - os_memcpy((PVOID)pWpaCore->WpaSupplParams.Identity, (PVOID)Identity, os_strlen((PS8)Identity)); - - if (Passward !=NULL) - { - os_memcpy((PVOID)pWpaCore->WpaSupplParams.password, (PVOID)Passward, os_strlen((PS8)Passward)); - os_memcpy((PVOID)pWpaCore->WpaSupplParams.private_key_passwd, (PVOID)Passward, os_strlen((PS8)Passward)); - } - - return OK; -} - -S32 WpaCore_SetCertificate(THandle hWpaCore, PU8 Filepath) -{ - TWpaCore* pWpaCore = (TWpaCore*)hWpaCore; - - os_memcpy((PVOID)pWpaCore->WpaSupplParams.client_cert, (PVOID)Filepath, os_strlen((PS8)Filepath)); - - return OK; - -} - -S32 WpaCore_SetPskPassPhrase(THandle hWpaCore, PU8 pPassPhrase) -{ - TWpaCore* pWpaCore = (TWpaCore*)hWpaCore; - - os_memcpy((PVOID)pWpaCore->WpaSupplParams.pass_phrase, (PVOID)pPassPhrase, os_strlen((PS8)pPassPhrase)); - - return OK; -} - -S32 WpaCore_StopSuppl(THandle hWpaCore) -{ - TWpaCore* pWpaCore = (TWpaCore*)hWpaCore; - - IpcWpa_Command(pWpaCore->hIpcWpa, (PS8)"TERMINATE", TRUE); - - return OK; -} - -S32 WpaCore_ChangeSupplDebugLevels(THandle hWpaCore, S32 Level1, S32 Level2, S32 Level3) -{ - TWpaCore* pWpaCore = (TWpaCore*)hWpaCore; - S8 cmd[100]; - - os_sprintf(cmd, (PS8)"CHANGE_SUPPLICANT_DEBUG %ld %ld %ld", Level1, Level2, Level3); - IpcWpa_Command(pWpaCore->hIpcWpa, cmd, TRUE); - - return OK; -} - -S32 WpaCore_AddKey(THandle hWpaCore, OS_802_11_WEP* pKey) -{ - TWpaCore* pWpaCore = (TWpaCore*)hWpaCore; - U32 WepKeyIndx; - - WepKeyIndx = pKey->KeyIndex & 0x7FFFFFFF; - - if ((pKey->KeyIndex & 0x80000000) == 0x80000000) - { - /* Add "1" to the default wep key index - since "0" is used to indicate no default wep key */ - pWpaCore->WpaSupplParams.default_wep_key = WepKeyIndx + 1; - } - - /* If key length wasn't set so far - set it according to current key */ - if (pWpaCore->WpaSupplParams.wep_key_length == 0) - { - pWpaCore->WpaSupplParams.wep_key_length = pKey->KeyLength; - } - else - { - if (pWpaCore->WpaSupplParams.wep_key_length != pKey->KeyLength) return ECUERR_WPA_CORE_ERROR_KEY_LEN_MUST_BE_SAME; - } - - os_memcpy(&pWpaCore->WpaSupplParams.wep_key[WepKeyIndx][0], pKey->KeyMaterial, pKey->KeyLength); - - return OK; -} - -S32 WpaCore_GetDefaultKey(THandle hWpaCore, U32* pDefaultKeyIndex) -{ - TWpaCore* pWpaCore = (TWpaCore*)hWpaCore; - - *pDefaultKeyIndex = pWpaCore->WpaSupplParams.default_wep_key; - - return OK; -} - -#ifdef CONFIG_WPS -S32 WpaCore_StartWpsPIN(THandle hWpaCore) -{ - TWpaCore* pWpaCore = (TWpaCore*)hWpaCore; -#ifdef SUPPL_WPS_SUPPORT - S8 cmd[100]; -#endif - - pWpaCore->WpaSupplParams.WscMode = WSC_MODE_PIN; - -#ifdef SUPPL_WPS_SUPPORT - os_sprintf(cmd, "WPS_PIN any"); - IpcWpa_Command(pWpaCore->hIpcWpa, cmd, TRUE); -#endif - - return OK; -} - -S32 WpaCore_StartWpsPBC(THandle hWpaCore) -{ - TWpaCore* pWpaCore = (TWpaCore*)hWpaCore; -#ifdef SUPPL_WPS_SUPPORT - S8 cmd[100]; -#endif - - pWpaCore->WpaSupplParams.WscMode = WSC_MODE_PBC; - -#ifdef SUPPL_WPS_SUPPORT - os_sprintf(cmd, "WPS_PBC"); - IpcWpa_Command(pWpaCore->hIpcWpa, cmd, TRUE); -#endif - - return OK; -} - -S32 WpaCore_StopWps(THandle hWpaCore) -{ - TWpaCore* pWpaCore = (TWpaCore*)hWpaCore; - - pWpaCore->WpaSupplParams.WscMode = WSC_MODE_OFF; - - return OK; -} - -S32 WpaCore_SetPin(THandle hWpaCore, PS8 pPinStr) -{ - TWpaCore* pWpaCore = (TWpaCore*)hWpaCore; - int len = os_strlen(pPinStr); - - if (len == 0) - return ECUERR_WPA_CORE_ERROR_IVALID_PIN; - - pWpaCore->WpaSupplParams.pWscPin = (PS8)os_MemoryCAlloc(len, sizeof(char)); - if(!pWpaCore->WpaSupplParams.pWscPin) - return ECUERR_WPA_CORE_ERROR_CANT_ALLOC_PIN; - - os_strcpy(pWpaCore->WpaSupplParams.pWscPin, pPinStr); - - return OK; -} -#endif /* CONFIG_WPS */ - -S32 WpaCore_SetAnyWpaMode(THandle hWpaCore, U8 anyWpaMode) -{ - TWpaCore* pWpaCore = (TWpaCore*)hWpaCore; - - pWpaCore->WpaSupplParams.anyWpaMode = anyWpaMode; - - return OK; -} - -S32 WpaCore_GetAnyWpaMode(THandle hWpaCore, PU8 pAnyWpaMode) -{ - TWpaCore* pWpaCore = (TWpaCore*)hWpaCore; - - *pAnyWpaMode = pWpaCore->WpaSupplParams.anyWpaMode; - - return OK; -} - - -S32 WpaCore_SetBssType(THandle hWpaCore, U32 BssType) -{ - TWpaCore* pWpaCore = (TWpaCore*)hWpaCore; - - switch(BssType) - { - case os802_11IBSS: - pWpaCore->WpaSupplParams.mode = IEEE80211_MODE_IBSS; - break; - case os802_11Infrastructure: - pWpaCore->WpaSupplParams.mode = IEEE80211_MODE_INFRA; - break; - default: - pWpaCore->WpaSupplParams.mode = IEEE80211_MODE_INFRA; - break; - } - - return OK; -} - -S32 WpaCore_GetBssType(THandle hWpaCore, PU32 pBssType) -{ - TWpaCore* pWpaCore = (TWpaCore*)hWpaCore; - - switch(pWpaCore->WpaSupplParams.mode) - { - case IEEE80211_MODE_IBSS: - *pBssType = os802_11IBSS; - break; - case IEEE80211_MODE_INFRA: - *pBssType = os802_11Infrastructure; - break; - } - - return OK; -} - -S32 WpaCore_SetSsid(THandle hWpaCore, OS_802_11_SSID* ssid, TMacAddr bssid) -{ - TWpaCore* pWpaCore = (TWpaCore*)hWpaCore; - S8 cmd[256]; - S8 Resp[IPC_WPA_RESP_MAX_LEN]; - PS8 pRespTemp; - U32 RespLen; - U32 NetworkID; - U32 SendCommand; - U8 Len; - -#define WPACORE_SETSSID_FAIL \ - os_error_printf(CU_MSG_ERROR, (PS8)"Failed to connect to %s\n", ssid->Ssid); \ - return ECUERR_WPA_CORE_ERROR_FAILED_CONNECT_SSID; - - /* First Add a new network block*/ - os_sprintf(cmd, (PS8)"ADD_NETWORK"); - if (IpcWpa_CommandWithResp(pWpaCore->hIpcWpa, cmd, TRUE, Resp, &RespLen)) - { - WPACORE_SETSSID_FAIL; - } - NetworkID = os_strtoul(Resp, &pRespTemp, 0); - - /* Set the parameters in the new new network block*/ - - /* Set the BSSID */ - if(!((bssid[0] == 0xFF) && - (bssid[1] == 0xFF) && - (bssid[2] == 0xFF) && - (bssid[3] == 0xFF) && - (bssid[4] == 0xFF) && - (bssid[5] == 0xFF))) - { - /* set th ebssid only if the bssid doesn't mean any bssid */ - S8 temp[20]; - os_sprintf(temp, (PS8)"%02x", bssid[0]); - os_sprintf(temp, (PS8)"%s:%02x", temp, bssid[1]); - os_sprintf(temp, (PS8)"%s:%02x", temp, bssid[2]); - os_sprintf(temp, (PS8)"%s:%02x", temp, bssid[3]); - os_sprintf(temp, (PS8)"%s:%02x", temp, bssid[4]); - os_sprintf(temp, (PS8)"%s:%02x", temp, bssid[5]); - os_sprintf(cmd, (PS8)"SET_NETWORK %d bssid %s", NetworkID, temp); - - if (IpcWpa_Command(pWpaCore->hIpcWpa, cmd, FALSE)) - { - WPACORE_SETSSID_FAIL; - } - } - - /* Set the SSID */ - os_sprintf(cmd, (PS8)"SET_NETWORK %d ssid \"%s\"", NetworkID, ssid->Ssid); - if (IpcWpa_Command(pWpaCore->hIpcWpa, cmd, 0)) - { - WPACORE_SETSSID_FAIL; - } - - /* set mode of the new network block */ - os_sprintf(cmd, (PS8)"SET_NETWORK %d mode %d", NetworkID, pWpaCore->WpaSupplParams.mode); - if (IpcWpa_Command(pWpaCore->hIpcWpa, cmd, 0)) - { - WPACORE_SETSSID_FAIL; - } - - /* set proto of the new network block */ - SendCommand = TRUE; - if (pWpaCore->WpaSupplParams.proto == WPA_PROTO_WPA) - { - os_sprintf(cmd, (PS8)"SET_NETWORK %d proto WPA", NetworkID); - } - else if (pWpaCore->WpaSupplParams.proto == WPA_PROTO_RSN) - { - os_sprintf(cmd, (PS8)"SET_NETWORK %d proto RSN", NetworkID); - } - else - { - SendCommand = FALSE; - } - - if (SendCommand && IpcWpa_Command(pWpaCore->hIpcWpa, cmd, 0)) - { - WPACORE_SETSSID_FAIL; - } - - /* set key management of the new network block */ - SendCommand = TRUE; - if (pWpaCore->WpaSupplParams.key_mgmt == WPA_KEY_MGMT_NONE) - { - if ((pWpaCore->WpaSupplParams.eap == OS_EAP_TYPE_LEAP) || - (pWpaCore->WpaSupplParams.eap == OS_EAP_TYPE_PEAP) || - (pWpaCore->WpaSupplParams.eap == OS_EAP_TYPE_FAST)) - { - os_sprintf(cmd, (PS8)"SET_NETWORK %d key_mgmt IEEE8021X", NetworkID); - } - else - os_sprintf(cmd, (PS8)"SET_NETWORK %d key_mgmt NONE", NetworkID); - } - else if (pWpaCore->WpaSupplParams.key_mgmt == WPA_KEY_MGMT_PSK) - os_sprintf(cmd, (PS8)"SET_NETWORK %d key_mgmt WPA-PSK", NetworkID); - else if (pWpaCore->WpaSupplParams.key_mgmt == WPA_KEY_MGMT_IEEE8021X) -#ifdef XCC_MODULE_INCLUDED - if((pWpaCore->WpaSupplParams.XCC == OS_XCC_CONFIGURATION_ENABLE_CCKM)||(pWpaCore->WpaSupplParams.XCC == OS_XCC_CONFIGURATION_ENABLE_ALL)) - { - os_sprintf(cmd, (PS8)"SET_NETWORK %d key_mgmt WPA-EAP CCKM", NetworkID); - } - else -#endif - os_sprintf(cmd, (PS8)"SET_NETWORK %d key_mgmt WPA-EAP", NetworkID); - else if (pWpaCore->WpaSupplParams.key_mgmt == WPA_KEY_MGMT_WPA_NONE) - os_sprintf(cmd, (PS8)"SET_NETWORK %d key_mgmt WPA-NONE", NetworkID); - else - { - SendCommand = FALSE; - } - - if (SendCommand && IpcWpa_Command(pWpaCore->hIpcWpa, cmd, 0)) - { - WPACORE_SETSSID_FAIL; - } - - - /* set authentication alog of the new network block */ - SendCommand = TRUE; - if (pWpaCore->WpaSupplParams.auth_alg == WPA_AUTH_ALG_OPEN) - os_sprintf(cmd, (PS8)"SET_NETWORK %d auth_alg OPEN", NetworkID); - else if (pWpaCore->WpaSupplParams.auth_alg == WPA_AUTH_ALG_SHARED) - os_sprintf(cmd, (PS8)"SET_NETWORK %d auth_alg SHARED", NetworkID); - else if (pWpaCore->WpaSupplParams.auth_alg == WPA_AUTH_ALG_LEAP) - os_sprintf(cmd, (PS8)"SET_NETWORK %d auth_alg LEAP", NetworkID); - else - { - SendCommand = FALSE; - } - - if (SendCommand && IpcWpa_Command(pWpaCore->hIpcWpa, cmd, 0)) - { - WPACORE_SETSSID_FAIL; - } - - - /* set pairwise encryption of the new network block */ - SendCommand = TRUE; - if (pWpaCore->WpaSupplParams.pair_wise == WPA_CIPHER_NONE) - os_sprintf(cmd, (PS8)"SET_NETWORK %d pairwise NONE", NetworkID); - else if (pWpaCore->WpaSupplParams.pair_wise == WPA_CIPHER_WEP40) - os_sprintf(cmd, (PS8)"SET_NETWORK %d pairwise NONE", NetworkID); - else if (pWpaCore->WpaSupplParams.pair_wise == WPA_CIPHER_TKIP) - os_sprintf(cmd, (PS8)"SET_NETWORK %d pairwise TKIP", NetworkID); - else if ((pWpaCore->WpaSupplParams.pair_wise == WPA_CIPHER_CCMP)&& (pWpaCore->WpaSupplParams.anyWpaMode == 0)) - os_sprintf(cmd, (PS8)"SET_NETWORK %d pairwise CCMP", NetworkID); - else if ((pWpaCore->WpaSupplParams.pair_wise == WPA_CIPHER_CCMP)&& (pWpaCore->WpaSupplParams.anyWpaMode == 1)) - os_sprintf(cmd, (PS8)"SET_NETWORK %d pairwise CCMP TKIP", NetworkID); - else - { - SendCommand = FALSE; - } - - if (SendCommand && IpcWpa_Command(pWpaCore->hIpcWpa, cmd, 0)) - { - WPACORE_SETSSID_FAIL; - } - - /* set group encryption of the new network block */ - SendCommand = TRUE; - if (pWpaCore->WpaSupplParams.group == WPA_CIPHER_WEP40) - os_sprintf(cmd, (PS8)"SET_NETWORK %d group WEP40", NetworkID); - else if (pWpaCore->WpaSupplParams.group == WPA_CIPHER_TKIP) - os_sprintf(cmd, (PS8)"SET_NETWORK %d group TKIP", NetworkID); - else if ((pWpaCore->WpaSupplParams.group == WPA_CIPHER_CCMP)&& (pWpaCore->WpaSupplParams.anyWpaMode == 0)) - os_sprintf(cmd, (PS8)"SET_NETWORK %d group CCMP", NetworkID); - else if ((pWpaCore->WpaSupplParams.group == WPA_CIPHER_CCMP)&& (pWpaCore->WpaSupplParams.anyWpaMode == 1)) - os_sprintf(cmd, (PS8)"SET_NETWORK %d group CCMP TKIP", NetworkID); - else - { - SendCommand = FALSE; - } - - if (SendCommand && IpcWpa_Command(pWpaCore->hIpcWpa, cmd, 0)) - { - WPACORE_SETSSID_FAIL; - } - - - /* set eap of the new network block */ - if (pWpaCore->WpaSupplParams.eap == OS_EAP_TYPE_NONE) - SendCommand = FALSE; - else - { - SendCommand = TRUE; - if (pWpaCore->WpaSupplParams.eap == OS_EAP_TYPE_MD5_CHALLENGE) - os_sprintf(cmd, (PS8)"SET_NETWORK %d eap MD5", NetworkID); - else if (pWpaCore->WpaSupplParams.eap == OS_EAP_TYPE_GENERIC_TOKEN_CARD) - os_sprintf(cmd, (PS8)"SET_NETWORK %d eap GTC", NetworkID); - else if (pWpaCore->WpaSupplParams.eap == OS_EAP_TYPE_TLS) - os_sprintf(cmd, (PS8)"SET_NETWORK %d eap TLS", NetworkID); - else if (pWpaCore->WpaSupplParams.eap == OS_EAP_TYPE_TTLS) - os_sprintf(cmd, (PS8)"SET_NETWORK %d eap TTLS", NetworkID); - else if (pWpaCore->WpaSupplParams.eap == OS_EAP_TYPE_PEAP) - os_sprintf(cmd, (PS8)"SET_NETWORK %d eap PEAP", NetworkID); - else if (pWpaCore->WpaSupplParams.eap == OS_EAP_TYPE_MS_CHAP_V2) - os_sprintf(cmd, (PS8)"SET_NETWORK %d eap MSCHAPV2", NetworkID); -#ifdef XCC_MODULE_INCLUDED - else if (pWpaCore->WpaSupplParams.eap == OS_EAP_TYPE_LEAP) - os_sprintf(cmd, (PS8)"SET_NETWORK %d eap LEAP", NetworkID); - else if (pWpaCore->WpaSupplParams.eap == OS_EAP_TYPE_FAST) - os_sprintf(cmd, (PS8)"SET_NETWORK %d eap FAST", NetworkID); -#endif - else - SendCommand = FALSE; - } - - - if (SendCommand && IpcWpa_Command(pWpaCore->hIpcWpa, cmd, 0)) - { - WPACORE_SETSSID_FAIL; - } - - if (pWpaCore->WpaSupplParams.Identity[0]) - { - os_sprintf(cmd, (PS8)"SET_NETWORK %d identity \"%s\"", NetworkID,pWpaCore->WpaSupplParams.Identity); - if (IpcWpa_Command(pWpaCore->hIpcWpa, cmd, 0)) - { - WPACORE_SETSSID_FAIL; - } - } - - if (pWpaCore->WpaSupplParams.client_cert[0]) - { - os_sprintf(cmd, (PS8)"SET_NETWORK %d client_cert \"%s\"", NetworkID,pWpaCore->WpaSupplParams.client_cert); - - if (IpcWpa_Command(pWpaCore->hIpcWpa, cmd, 0)) - { - WPACORE_SETSSID_FAIL; - } - - } - - - if (pWpaCore->WpaSupplParams.client_cert[0]) - { - - Len = os_strlen ((PS8)pWpaCore->WpaSupplParams.client_cert); - os_memcpy(pWpaCore->WpaSupplParams.private_key,pWpaCore->WpaSupplParams.client_cert,Len); - os_memcpy(&pWpaCore->WpaSupplParams.private_key[Len-3],"pem",3); - - os_sprintf(cmd, (PS8)"SET_NETWORK %d private_key \"%s\"", NetworkID,pWpaCore->WpaSupplParams.private_key); - if (IpcWpa_Command(pWpaCore->hIpcWpa, cmd, 0)) - { - WPACORE_SETSSID_FAIL; - } - } - - if (pWpaCore->WpaSupplParams.private_key_passwd[0] ) - { - os_sprintf(cmd, (PS8)"SET_NETWORK %d private_key_passwd \"%s\"", NetworkID,pWpaCore->WpaSupplParams.private_key_passwd); - if (IpcWpa_Command(pWpaCore->hIpcWpa, cmd, 0)) - { - WPACORE_SETSSID_FAIL; - } - } - - if (pWpaCore->WpaSupplParams.password[0] ) - { - os_sprintf(cmd, (PS8)"SET_NETWORK %d password \"%s\"", NetworkID,pWpaCore->WpaSupplParams.password); - if (IpcWpa_Command(pWpaCore->hIpcWpa, cmd, 0)) - { - WPACORE_SETSSID_FAIL; - } - - } - - - if (pWpaCore->WpaSupplParams.eap == OS_EAP_TYPE_FAST) - { - os_sprintf(cmd, (PS8)"SET_NETWORK %d phase1 \"fast_provisioning=3\"", NetworkID); - if (IpcWpa_Command(pWpaCore->hIpcWpa, cmd, 0)) - { - WPACORE_SETSSID_FAIL; - } - - os_sprintf(cmd, (PS8)"SET_NETWORK %d pac_file \"/etc/wpa_supplicant.eap-fast-pac\"", NetworkID); - if (IpcWpa_Command(pWpaCore->hIpcWpa, cmd, 0)) - { - WPACORE_SETSSID_FAIL; - } - - os_sprintf(cmd, (PS8)"SET_NETWORK %d anonymous_identity \"anonymous\"", NetworkID); - if (IpcWpa_Command(pWpaCore->hIpcWpa, cmd, 0)) - { - WPACORE_SETSSID_FAIL; - } - - } - - if (pWpaCore->WpaSupplParams.pair_wise == WPA_CIPHER_WEP40) - { - S32 idx, idx2; - - for (idx=0; idx<4; idx++) - { - S8 TempBuf[3]; - os_sprintf(cmd, (PS8)"SET_NETWORK %d wep_key%d ", NetworkID, idx); - for (idx2=0; idx2 < pWpaCore->WpaSupplParams.wep_key_length; idx2++) - { - os_sprintf(TempBuf, (PS8)"%02x", pWpaCore->WpaSupplParams.wep_key[idx][idx2]); - os_strcat (cmd, TempBuf); - } - if (IpcWpa_Command(pWpaCore->hIpcWpa, cmd, 0)) - { - WPACORE_SETSSID_FAIL; - } - } - os_sprintf(cmd, (PS8)"SET_NETWORK %d wep_tx_keyidx %d", NetworkID, pWpaCore->WpaSupplParams.default_wep_key-1); - if (IpcWpa_Command(pWpaCore->hIpcWpa, cmd, 0)) - { - WPACORE_SETSSID_FAIL; - } - } - - if (pWpaCore->WpaSupplParams.key_mgmt == WPA_KEY_MGMT_PSK) - { - os_sprintf(cmd, (PS8)"SET_NETWORK %d psk \"%s\"", NetworkID, pWpaCore->WpaSupplParams.pass_phrase); - if (IpcWpa_Command(pWpaCore->hIpcWpa, cmd, 0)) - { - WPACORE_SETSSID_FAIL; - } - } - - -#ifdef CONFIG_WPS - if (pWpaCore->WpaSupplParams.WscMode) - { - os_sprintf(cmd, (PS8)"SET_NETWORK %d wsc_mode %d", NetworkID, pWpaCore->WpaSupplParams.WscMode); - if (IpcWpa_Command(pWpaCore->hIpcWpa, cmd, 0)) - { - WPACORE_SETSSID_FAIL; - } - } - if (pWpaCore->WpaSupplParams.pWscPin) - { - os_sprintf(cmd, (PS8)"SET_NETWORK %d wsc_pin \"%s\"", NetworkID, pWpaCore->WpaSupplParams.pWscPin); - if (IpcWpa_Command(pWpaCore->hIpcWpa, cmd, 0)) - { - WPACORE_SETSSID_FAIL; - } - } -#endif - - /* Finaly Connect to the new network block */ - os_sprintf(cmd, (PS8)"SELECT_NETWORK %d", NetworkID); - if (IpcWpa_Command(pWpaCore->hIpcWpa, cmd, 0)) - { - WPACORE_SETSSID_FAIL; - } - - pWpaCore->CurrentNetwork = NetworkID; - IpcWpa_Command(pWpaCore->hIpcWpa, (PS8)"SAVE_CONFIG", 1); - - /* - init the connection params thus the next time we connect we will by default - connect to an open - */ - WpaCore_InitWpaParams(pWpaCore); - - return OK; -} - -S32 WpaCore_Disassociate(THandle hWpaCore) -{ - TWpaCore* pWpaCore = (TWpaCore*)hWpaCore; - S8 cmd[256]; - - os_sprintf(cmd, (PS8)"DISABLE_NETWORK %d", pWpaCore->CurrentNetwork); - if (IpcWpa_Command(pWpaCore->hIpcWpa, cmd, 1)) - { - os_error_printf(CU_MSG_ERROR, (PS8)"Failed to disconnect from current ssid\n"); - return ECUERR_WPA_CORE_ERROR_FAILED_DISCONNECT_SSID; - } - - pWpaCore->CurrentNetwork = -1; - IpcWpa_Command(pWpaCore->hIpcWpa, (PS8)"SAVE_CONFIG", 0); - -#if 0 /* for futur WPS work */ - if(pWpaCore->CurrentNetwork == -1) - { - os_sprintf(cmd, (PS8)"LIST_NETWORKS"); - if (IpcWpa_Command(pWpaCore->hIpcWpa, cmd, 1)) - { - os_error_printf(CU_MSG_ERROR, (PS8)"Failed to disconnect from current ssid\n"); - return ECUERR_WPA_CORE_ERROR_FAILED_DISCONNECT_SSID; - } - } - else - { - os_sprintf(cmd, (PS8)"DISABLE_NETWORK %d", pWpaCore->CurrentNetwork); - if (IpcWpa_Command(pWpaCore->hIpcWpa, cmd, 1)) - { - os_error_printf(CU_MSG_ERROR, (PS8)"Failed to disconnect from current ssid\n"); - return ECUERR_WPA_CORE_ERROR_FAILED_DISCONNECT_SSID; - } - - pWpaCore->CurrentNetwork = -1; - IpcWpa_Command(pWpaCore->hIpcWpa, (PS8)"SAVE_CONFIG", 0); - } -#endif /* #if 0 for futur WPS work */ - - return OK; -} - |