diff options
author | Dmitry Shmidt <dimitrysh@google.com> | 2010-01-29 14:38:28 -0800 |
---|---|---|
committer | Dmitry Shmidt <dimitrysh@google.com> | 2010-01-29 14:38:28 -0800 |
commit | ddac9c138c5b4b16b99fb8bc5f0f10418efa1029 (patch) | |
tree | 9ad7e34f8dcd9d63ef2faa9e865d6056a061e6c3 | |
parent | a615fb1650af6e111053506f1b764b28a5b4631d (diff) | |
download | wlan-ddac9c138c5b4b16b99fb8bc5f0f10418efa1029.tar.gz |
wl1271: Android/Sholes update
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
158 files changed, 3745 insertions, 3173 deletions
diff --git a/wl1271/CUDK/configurationutility/Android.mk b/wl1271/CUDK/configurationutility/Android.mk index c33652fe..5d9c5417 100644 --- a/wl1271/CUDK/configurationutility/Android.mk +++ b/wl1271/CUDK/configurationutility/Android.mk @@ -3,7 +3,7 @@ include $(CLEAR_VARS) STATIC_LIB ?= y DEBUG ?= y -BUILD_SUPPL ?= y +BUILD_SUPPL ?= n WPA_ENTERPRISE ?= y CONFIG_WPS ?= y @@ -12,13 +12,18 @@ CUDK_ROOT ?= $(WILINK_ROOT)/CUDK CU_ROOT = $(CUDK_ROOT)/configurationutility ifeq ($(DEBUG),y) - DEBUGFLAGS = -O2 -g -DDEBUG -DTI_DBG -fno-builtin # "-O" is needed to expand inlines -# DEBUGFLAGS+= -DDEBUG_MESSAGES + DEBUGFLAGS = -O2 -g -DDEBUG -DTI_DBG -fno-builtin else - DEBUGFLAGS = -O2 + DEBUGFLAGS = -O2 endif -DEBUGFLAGS+= -DHOST_COMPILE +ifeq ($(DEBUG),y) + DEBUGFLAGS = -O2 -g -DDEBUG -DTI_DBG -fno-builtin # "-O" is needed to expand inlines +# DEBUGFLAGS+= -DDEBUG_MESSAGES +else + DEBUGFLAGS = -O2 +endif +DEBUGFLAGS += -DHOST_COMPILE DK_DEFINES = @@ -57,26 +62,27 @@ LOCAL_C_INCLUDES = \ $(LOCAL_PATH)/$(WILINK_ROOT)/TWD/FW_Transfer/Export_Inc \ external/wpa_supplicant -LOCAL_SRC_FILES:= \ +LOCAL_SRC_FILES = \ src/console.c \ src/cu_common.c \ src/cu_cmd.c \ src/ticon.c \ src/wpa_core.c -LOCAL_CFLAGS+= -Wall -Wstrict-prototypes $(DEBUGFLAGS) -D__LINUX__ $(DK_DEFINES) -D__BYTE_ORDER_LITTLE_ENDIAN -DDRV_NAME='"tiwlan"' +LOCAL_CFLAGS += -Wall -Wstrict-prototypes $(DEBUGFLAGS) -D__LINUX__ $(DK_DEFINES) -D__BYTE_ORDER_LITTLE_ENDIAN -DDRV_NAME='"tiwlan"' LOCAL_CFLAGS += $(ARMFLAGS) LOCAL_LDLIBS += -lpthread -LOCAL_STATIC_LIBRARIES := \ +LOCAL_STATIC_LIBRARIES = \ libtiOsLib -LOCAL_SHARED_LIBRARIES := \ - libwpa_client +ifeq ($(BUILD_SUPPL), y) +LOCAL_SHARED_LIBRARIES = \ + libwpa_client +endif -LOCAL_MODULE:= tiwlan_cu +LOCAL_MODULE:= wlan_cu include $(BUILD_EXECUTABLE) - diff --git a/wl1271/CUDK/configurationutility/inc/cu_cmd.h b/wl1271/CUDK/configurationutility/inc/cu_cmd.h index f076f88b..67cde770 100644 --- a/wl1271/CUDK/configurationutility/inc/cu_cmd.h +++ b/wl1271/CUDK/configurationutility/inc/cu_cmd.h @@ -137,7 +137,6 @@ VOID CuCmd_RoamingLowSnrThreshold(THandle hCuCmd, ConParm_t parm[], U16 nParms); VOID CuCmd_RoamingLowQualityForBackgroungScanCondition(THandle hCuCmd, ConParm_t parm[], U16 nParms); VOID CuCmd_RoamingNormalQualityForBackgroungScanCondition(THandle hCuCmd, ConParm_t parm[], U16 nParms); VOID CuCmd_RoamingGetConfParams(THandle hCuCmd, ConParm_t parm[], U16 nParms); - VOID CuCmd_CurrBssUserDefinedTrigger(THandle hCuCmd, ConParm_t parm[], U16 nParms); VOID CuCmd_AddTspec(THandle hCuCmd, ConParm_t parm[], U16 nParms); @@ -189,7 +188,6 @@ VOID CuCmd_FwDebug(THandle hCuCmd, ConParm_t parm[], U16 nParms); VOID CuCmd_SetRateMngDebug(THandle hCuCmd, ConParm_t parm[], U16 nParms); VOID CuCmd_GetRateMngDebug(THandle hCuCmd, ConParm_t parm[], U16 nParms); - VOID CuCmd_ShowAbout(THandle hCuCmd, ConParm_t parm[], U16 nParms); VOID CuCmd_Quit(THandle hCuCmd, ConParm_t parm[], U16 nParms); diff --git a/wl1271/CUDK/configurationutility/inc/cu_common.h b/wl1271/CUDK/configurationutility/inc/cu_common.h index 7a049916..94ac7f1c 100644 --- a/wl1271/CUDK/configurationutility/inc/cu_common.h +++ b/wl1271/CUDK/configurationutility/inc/cu_common.h @@ -45,8 +45,7 @@ typedef struct U8 snrBeacon; /* The current average SNR in db - For Beacon Packets*/ S8 rssi; /* The current average RSSI - For Data Packets*/ S8 rssiBeacon; -}TCuCommon_RoamingStatisticsTable; - +} TCuCommon_RoamingStatisticsTable; /* functions */ /*************/ diff --git a/wl1271/CUDK/configurationutility/inc/wpa_core.h b/wl1271/CUDK/configurationutility/inc/wpa_core.h index 7aad03dc..c936f8f6 100644 --- a/wl1271/CUDK/configurationutility/inc/wpa_core.h +++ b/wl1271/CUDK/configurationutility/inc/wpa_core.h @@ -66,7 +66,6 @@ S32 WpaCore_SetCertificate(THandle hWpaCore, PU8 Filepath); S32 WpaCore_SetXCC(THandle hWpaCore, U16 XCCConfig); - #ifdef CONFIG_WPS S32 WpaCore_StartWpsPIN(THandle hWpaCore); S32 WpaCore_StartWpsPBC(THandle hWpaCore); diff --git a/wl1271/CUDK/configurationutility/src/console.c b/wl1271/CUDK/configurationutility/src/console.c index b7ec5815..ef645daa 100644 --- a/wl1271/CUDK/configurationutility/src/console.c +++ b/wl1271/CUDK/configurationutility/src/console.c @@ -218,7 +218,6 @@ static VOID Console_allocRoot(Console_t* pConsole) 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; diff --git a/wl1271/CUDK/configurationutility/src/cu_cmd.c b/wl1271/CUDK/configurationutility/src/cu_cmd.c index 80ff5e19..85f32061 100644 --- a/wl1271/CUDK/configurationutility/src/cu_cmd.c +++ b/wl1271/CUDK/configurationutility/src/cu_cmd.c @@ -3661,8 +3661,6 @@ VOID CuCmd_ConfigBtCoe(THandle hCuCmd, ConParm_t parm[], U16 nParms) } } - - VOID CuCmd_GetBtCoeStatus(THandle hCuCmd, ConParm_t parm[], U16 nParms) { CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd; diff --git a/wl1271/CUDK/configurationutility/src/cu_common.c b/wl1271/CUDK/configurationutility/src/cu_common.c index febc0afd..5357126a 100644 --- a/wl1271/CUDK/configurationutility/src/cu_common.c +++ b/wl1271/CUDK/configurationutility/src/cu_common.c @@ -57,6 +57,7 @@ typedef enum DRIVER_STATUS_RUNNING = 1 } PARAM_OUT_Driver_Status_e; + /* local variables */ /*******************/ diff --git a/wl1271/CUDK/configurationutility/src/ticon.c b/wl1271/CUDK/configurationutility/src/ticon.c index fe03d4ba..9e0ce265 100644 --- a/wl1271/CUDK/configurationutility/src/ticon.c +++ b/wl1271/CUDK/configurationutility/src/ticon.c @@ -54,8 +54,11 @@ #endif #define TIWLAN_DRV_NAME "tiwlan0" -#define SUPPL_IF_FILE "/var/run/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 */ @@ -1190,5 +1193,3 @@ 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 index 9c3089be..9506c75f 100644 --- a/wl1271/CUDK/configurationutility/src/wpa_core.c +++ b/wl1271/CUDK/configurationutility/src/wpa_core.c @@ -35,18 +35,16 @@ #include <unistd.h> #endif -/* Linux only file */ -#include <netinet/if_ether.h> - +#include <string.h> #include "cu_osapi.h" #include "TWDriver.h" +#include "common.h" #include "config_ssid.h" #include "driver.h" #include "ipc_wpa.h" #include "wpa_core.h" #include "oserr.h" - /* defines */ /***********/ #ifdef CONFIG_WPS @@ -119,7 +117,7 @@ static VOID WpaCore_InitWpaParams(TWpaCore* pWpaCore) pWpaCore->WpaSupplParams.pair_wise = WPA_CIPHER_NONE; pWpaCore->WpaSupplParams.group = WPA_CIPHER_NONE; pWpaCore->WpaSupplParams.anyWpaMode = 0; - #ifdef CONFIG_WPS +#ifdef CONFIG_WPS pWpaCore->WpaSupplParams.pWscPin = NULL; pWpaCore->WpaSupplParams.WscMode = WSC_MODE_OFF; #endif @@ -141,7 +139,7 @@ THandle WpaCore_Create(PS32 pRes, PS8 pSupplIfFile) return NULL; } - pWpaCore->hIpcWpa = IpcWpa_Create(pRes, pSupplIfFile); + pWpaCore->hIpcWpa = IpcWpa_Create(pRes, pSupplIfFile); if(pWpaCore->hIpcWpa == NULL) { WpaCore_Destroy(pWpaCore); diff --git a/wl1271/CUDK/os/common/inc/cu_osapi.h b/wl1271/CUDK/os/common/inc/cu_osapi.h index 57b415b0..665af075 100644 --- a/wl1271/CUDK/os/common/inc/cu_osapi.h +++ b/wl1271/CUDK/os/common/inc/cu_osapi.h @@ -32,7 +32,7 @@ #define OK 0 #define FALSE 0 #define TRUE 1 -#define OSAL_ERROR -1 +#define OSAL_ERROR -1 #define OSAL_SUCCESS 0 #define OSAL_FAILURE 1 #define OS_GETINPUTSTRING_CONTINUE TRUE+1 @@ -43,13 +43,12 @@ /* replaces IFNAMSIZ in Linux */ #define IF_NAME_SIZE 16 - /* - * supp declares its OS abstarction with primitive types, so these must + * TODO : supp declares its OS abstarction with primitive types, so these must * be specifically declared here, and only if they weren't defined before by someone * including common.h */ -#ifndef COMMON_H +#ifndef ANDROID typedef unsigned char u8; typedef unsigned short u16; typedef unsigned long u32; diff --git a/wl1271/CUDK/os/common/inc/cu_ostypes.h b/wl1271/CUDK/os/common/inc/cu_ostypes.h index bf081e58..83a07693 100644 --- a/wl1271/CUDK/os/common/inc/cu_ostypes.h +++ b/wl1271/CUDK/os/common/inc/cu_ostypes.h @@ -17,4 +17,3 @@ typedef PVOID THandle; typedef int TI_SIZE_T; #endif - diff --git a/wl1271/CUDK/os/linux/src/Android.mk b/wl1271/CUDK/os/linux/src/Android.mk index 0fc7c7e1..3ae1e403 100644 --- a/wl1271/CUDK/os/linux/src/Android.mk +++ b/wl1271/CUDK/os/linux/src/Android.mk @@ -3,7 +3,7 @@ include $(CLEAR_VARS) STATIC_LIB ?= y DEBUG ?= y -BUILD_SUPPL ?= y +BUILD_SUPPL ?= n WPA_ENTERPRISE ?= y ifeq ($(DEBUG),y) @@ -29,7 +29,7 @@ ifeq ($(BUILD_SUPPL), y) endif endif -LOCAL_CFLAGS+= \ +LOCAL_CFLAGS += \ -Wall -Wstrict-prototypes $(DEBUGFLAGS) -D__LINUX__ $(DK_DEFINES) -D__BYTE_ORDER_LITTLE_ENDIAN -fno-common #-pipe LOCAL_SRC_FILES:= \ @@ -39,8 +39,12 @@ LOCAL_SRC_FILES:= \ ipc_wpa.c \ os_trans.c \ ParsEvent.c \ - osapi.c + osapi.c +ifeq ($(BUILD_SUPPL), y) +LOCAL_SRC_FILES += \ + $(TI_SUPP_LIB_DIR)/wpa_ctrl.c +endif LOCAL_C_INCLUDES := \ $(LOCAL_PATH)/../inc \ @@ -60,7 +64,7 @@ LOCAL_C_INCLUDES := \ external/wpa_supplicant \ $(LOCAL_PATH)/$(CUDK_ROOT)/configurationutility/inc -LOCAL_MODULE:=libtiOsLib +LOCAL_MODULE := libtiOsLib include $(BUILD_STATIC_LIBRARY) diff --git a/wl1271/CUDK/os/linux/src/ParsEvent.c b/wl1271/CUDK/os/linux/src/ParsEvent.c index b75070bf..43d65b01 100644 --- a/wl1271/CUDK/os/linux/src/ParsEvent.c +++ b/wl1271/CUDK/os/linux/src/ParsEvent.c @@ -38,7 +38,7 @@ #include <netinet/if_ether.h> #endif #include <linux/rtnetlink.h> -#include <linux/if.h> +#include <net/if.h> #include <linux/wireless.h> #include "ParsEvent.h" #include "cu_osapi.h" diff --git a/wl1271/CUDK/os/linux/src/cu_wext.c b/wl1271/CUDK/os/linux/src/cu_wext.c index 3294a430..39189ad0 100644 --- a/wl1271/CUDK/os/linux/src/cu_wext.c +++ b/wl1271/CUDK/os/linux/src/cu_wext.c @@ -32,10 +32,11 @@ /************/ #include "cu_osapi.h" #include "oserr.h" -#include <linux/if.h> +#include <net/if.h> #include <linux/rtnetlink.h> #include <linux/wireless.h> #include <string.h> +#include <stdlib.h> #include "TWDriver.h" #include "STADExternalIf.h" @@ -81,7 +82,7 @@ static S32 CuWext_FillBssidList(struct iw_event *iwe, OS_802_11_BSSID_EX* bssidL break; case SIOCGIWNAME: { - int i; + unsigned i; S8 buffer[IFNAMSIZ]; static const char *ieee80211_modes[] = { "?", diff --git a/wl1271/CUDK/os/linux/src/ipc_event.c b/wl1271/CUDK/os/linux/src/ipc_event.c index ede0a4b6..e8be9910 100644 --- a/wl1271/CUDK/os/linux/src/ipc_event.c +++ b/wl1271/CUDK/os/linux/src/ipc_event.c @@ -32,21 +32,21 @@ /************/ #include <sys/types.h> #include <sys/socket.h> -#include <linux/if.h> +#include <net/if.h> #include <linux/rtnetlink.h> #include <signal.h> #include <sys/mman.h> #include <unistd.h> #include <linux/wireless.h> - #include "cu_osapi.h" #include "oserr.h" + #include "TWDriver.h" #include "STADExternalIf.h" + #include "ParsEvent.h" #include "ipc_event.h" - /* defines */ /***********/ #define PIPE_READ 0 @@ -132,8 +132,6 @@ static VOID IpcEvent_PrintEvent(IpcEvent_Child_t* pIpcEventChild, U32 EventId, T { switch(EventId) { - - case IPC_EVENT_DISASSOCIATED: { OS_802_11_DISASSOCIATE_REASON_T *pDisAssoc; @@ -335,7 +333,7 @@ static VOID IpcEvent_wext_event_wireless(IpcEvent_Child_t* pIpcEventChild, PS8 d (iwe.u.ap_addr.sa_data[4] == 0) && (iwe.u.ap_addr.sa_data[5] == 0)) { - EventId=IPC_EVENT_DISASSOCIATED; + EventId=IPC_EVENT_DISASSOCIATED; IpcEvent_PrintEvent(pIpcEventChild, EventId, NULL,0); } else @@ -344,16 +342,16 @@ static VOID IpcEvent_wext_event_wireless(IpcEvent_Child_t* pIpcEventChild, PS8 d /* Send a signal to the udhcpc application to trigger the renew request */ system("killall -SIGUSR1 udhcpc"); #endif - EventId=IPC_EVENT_ASSOCIATED; + EventId=IPC_EVENT_ASSOCIATED; IpcEvent_PrintEvent(pIpcEventChild, EventId, NULL,0); } break; case IWEVMICHAELMICFAILURE: - EventId=IPC_EVENT_MEDIA_SPECIFIC; + EventId=IPC_EVENT_MEDIA_SPECIFIC; IpcEvent_PrintEvent(pIpcEventChild, EventId, NULL,0); break; case IWEVCUSTOM: - pEvent = (IPC_EV_DATA*)iwe.u.data.pointer; + pEvent = (IPC_EV_DATA*)iwe.u.data.pointer; if (pEvent) { EventId = (U32)pEvent->EvParams.uEventType; @@ -361,7 +359,7 @@ static VOID IpcEvent_wext_event_wireless(IpcEvent_Child_t* pIpcEventChild, PS8 d } break; case SIOCGIWSCAN: - EventId=IPC_EVENT_SCAN_COMPLETE; + EventId=IPC_EVENT_SCAN_COMPLETE; IpcEvent_PrintEvent(pIpcEventChild, EventId, NULL,0); break; case IWEVASSOCREQIE: diff --git a/wl1271/CUDK/os/linux/src/ipc_sta.c b/wl1271/CUDK/os/linux/src/ipc_sta.c index 51fa239c..53ecef06 100644 --- a/wl1271/CUDK/os/linux/src/ipc_sta.c +++ b/wl1271/CUDK/os/linux/src/ipc_sta.c @@ -32,7 +32,7 @@ /************/ #include <sys/types.h> #include <sys/socket.h> -#include <linux/if.h> +#include <net/if.h> #include <linux/rtnetlink.h> #include <errno.h> #include <sys/ioctl.h> diff --git a/wl1271/CUDK/os/linux/src/ipc_wpa.c b/wl1271/CUDK/os/linux/src/ipc_wpa.c index 5fd3d263..03f050da 100644 --- a/wl1271/CUDK/os/linux/src/ipc_wpa.c +++ b/wl1271/CUDK/os/linux/src/ipc_wpa.c @@ -47,9 +47,9 @@ /* Module control block */ typedef struct TIpcWpa { - struct wpa_ctrl *pWpaCtrl; + struct wpa_ctrl *pWpaCtrl; #if 0 - S32 socket; + S32 socket; struct sockaddr_in local; struct sockaddr_in dest; #endif @@ -62,7 +62,8 @@ typedef struct TIpcWpa /*******************/ static S32 IpcWpa_Sockets_Open(TIpcWpa* pIpcWpa, PS8 pSupplIfFile) { - S32 i; +#ifdef WPA_SUPPLICANT + S32 i; for(i=0; i< IPC_WPA_CTRL_OPEN_RETRIES; i++) { @@ -70,19 +71,23 @@ static S32 IpcWpa_Sockets_Open(TIpcWpa* pIpcWpa, PS8 pSupplIfFile) if(pIpcWpa->pWpaCtrl) break; } - +#else + pIpcWpa->pWpaCtrl = NULL; +#endif if(pIpcWpa->pWpaCtrl == NULL) - { + { os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - IpcWpa_Sockets_Open - can't connect the socket\n"); - return EOALERR_IPC_WPA_ERROR_CANT_CONNECT_TO_SUPPL; + return EOALERR_IPC_WPA_ERROR_CANT_CONNECT_TO_SUPPL; } - return OK; + return OK; } static VOID IpcWpa_Sockets_Close(TIpcWpa* pIpcWpa) { +#ifdef WPA_SUPPLICANT wpa_ctrl_close(pIpcWpa->pWpaCtrl); +#endif } @@ -100,7 +105,7 @@ THandle IpcWpa_Create(PS32 pRes, PS8 pSupplIfFile) *pRes = IpcWpa_Sockets_Open(pIpcWpa, pSupplIfFile); if(*pRes) - { + { IpcWpa_Destroy(pIpcWpa); return NULL; } @@ -120,54 +125,61 @@ VOID IpcWpa_Destroy(THandle hIpcWpa) S32 IpcWpa_Command(THandle hIpcWpa, PS8 cmd, S32 print) { +#ifdef WPA_SUPPLICANT TIpcWpa* pIpcWpa = (TIpcWpa*)hIpcWpa; - S8 Resp[IPC_WPA_RESP_MAX_LEN]; - TI_SIZE_T RespLen = IPC_WPA_RESP_MAX_LEN - 1; - S32 ret; + S8 Resp[IPC_WPA_RESP_MAX_LEN]; + TI_SIZE_T RespLen = IPC_WPA_RESP_MAX_LEN - 1; + S32 ret; ret = wpa_ctrl_request(pIpcWpa->pWpaCtrl, (char*)cmd, os_strlen(cmd), (char*)Resp, (size_t*)&RespLen, NULL); - if (ret == -2) + if (ret == -2) { os_error_printf(CU_MSG_ERROR, (PS8)"'%s' command timed out.\n", cmd); - return EOALERR_IPC_WPA_ERROR_CMD_TIMEOUT; - } - else if (ret < 0) + return EOALERR_IPC_WPA_ERROR_CMD_TIMEOUT; + } + else if (ret < 0) { os_error_printf(CU_MSG_ERROR, (PS8)"'%s' command failed (%d).\n", cmd, ret); - return EOALERR_IPC_WPA_ERROR_CMD_FAILED; + return EOALERR_IPC_WPA_ERROR_CMD_FAILED; } - if (print) + if (print) { Resp[RespLen] = '\0'; - os_error_printf(CU_MSG_INFO2, (PS8)"%s", Resp); + os_error_printf(CU_MSG_INFO2, (PS8)"%s", Resp); } return OK; +#else + return EOALERR_IPC_WPA_ERROR_CMD_FAILED; +#endif } S32 IpcWpa_CommandWithResp(THandle hIpcWpa, PS8 cmd, S32 print, PS8 pResp, PU32 pRespLen) { - TIpcWpa* pIpcWpa = (TIpcWpa*)hIpcWpa; - S32 ret; +#ifdef WPA_SUPPLICANT + TIpcWpa* pIpcWpa = (TIpcWpa*)hIpcWpa; + S32 ret; *pRespLen = IPC_WPA_RESP_MAX_LEN - 1; ret = wpa_ctrl_request(pIpcWpa->pWpaCtrl, (char*)cmd, os_strlen(cmd), (char*)pResp, (size_t*)pRespLen, NULL); - if (ret == -2) + if (ret == -2) { os_error_printf(CU_MSG_ERROR, (PS8)"'%s' command timed out.\n", cmd); - return EOALERR_IPC_WPA_ERROR_CMD_TIMEOUT; - } - else if (ret < 0) + return EOALERR_IPC_WPA_ERROR_CMD_TIMEOUT; + } + else if (ret < 0) { os_error_printf(CU_MSG_ERROR, (PS8)"'%s' command failed.\n", cmd); - return EOALERR_IPC_WPA_ERROR_CMD_FAILED; + return EOALERR_IPC_WPA_ERROR_CMD_FAILED; } - if (print) + if (print) { pResp[*pRespLen] = '\0'; - os_error_printf(CU_MSG_INFO2, (PS8)"%s", pResp); + os_error_printf(CU_MSG_INFO2, (PS8)"%s", pResp); } return OK; +#else + return EOALERR_IPC_WPA_ERROR_CMD_FAILED; +#endif } - diff --git a/wl1271/CUDK/os/linux/src/osapi.c b/wl1271/CUDK/os/linux/src/osapi.c index c088fbac..b1242112 100644 --- a/wl1271/CUDK/os/linux/src/osapi.c +++ b/wl1271/CUDK/os/linux/src/osapi.c @@ -78,20 +78,32 @@ RETURN: None *****************************************************************************************/ VOID os_error_printf(S32 debug_level, const PS8 arg_list ,...) { - static int g_debug_level = CU_MSG_ERROR; - va_list ap; + static int g_debug_level = CU_MSG_ERROR; /* TODO ronen: create debug logic for CLI */ S8 msg[MAX_HOST_MESSAGE_SIZE]; + va_list ap; +#ifdef OS_CLI_LOG_TO_FILE + char file_name[30]="/cli.log"; + FILE *ftmp; +#endif if (debug_level < g_debug_level) return; /* Format the message */ va_start(ap, arg_list); - vsprintf((char*)msg, (char*)arg_list, ap); + vsprintf((char *)msg, (char *)arg_list, ap); va_end(ap); /* print the message */ - fprintf(stderr, (char*)msg); + fprintf(stderr, (char *)msg); + +#ifdef OS_CLI_LOG_TO_FILE + ftmp = fopen(file_name, "a"); + if (ftmp != NULL) { + fprintf(ftmp,(char *)msg); + fclose(ftmp); + } +#endif } /**************************************************************************************** diff --git a/wl1271/CUDK/tiwlan_loader/Android.mk b/wl1271/CUDK/tiwlan_loader/Android.mk index 1a765119..00b0476d 100644 --- a/wl1271/CUDK/tiwlan_loader/Android.mk +++ b/wl1271/CUDK/tiwlan_loader/Android.mk @@ -49,9 +49,9 @@ LOCAL_STATIC_LIBRARIES := \ libtiOsLib LOCAL_SHARED_LIBRARIES := \ - libcutils libc libhardware_legacy + libc libcutils libhardware_legacy -LOCAL_MODULE:= tiwlan_loader +LOCAL_MODULE:= wlan_loader include $(BUILD_EXECUTABLE) diff --git a/wl1271/CUDK/tiwlan_loader/tiwlan_loader.c b/wl1271/CUDK/tiwlan_loader/tiwlan_loader.c index 7061eb45..2cf21eb7 100644 --- a/wl1271/CUDK/tiwlan_loader/tiwlan_loader.c +++ b/wl1271/CUDK/tiwlan_loader/tiwlan_loader.c @@ -2,22 +2,22 @@ * tiwlan_loader.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 + * See the License for the specific language governing permissions and * limitations under the License. */ - -/** - * \file tiwlan_loader.c + +/** + * \file tiwlan_loader.c * \brief Loader implementation - sends FW image, NVS image and ini file to the driver */ @@ -53,14 +53,14 @@ S32 print_usage(VOID) } /* Return '0' if success */ -S32 init_driver( PS8 adapter_name, PS8 eeprom_file_name, +S32 init_driver( PS8 adapter_name, PS8 eeprom_file_name, PS8 init_file_name, PS8 firmware_file_name ) { - PVOID f1=NULL, f2=NULL, f3 = NULL; - S32 eeprom_image_length=0; - S32 init_file_length=0; + PVOID f1 = NULL, f2 = NULL, f3 = NULL; + S32 eeprom_image_length = 0; + S32 init_file_length = 0; S32 firmware_image_length = 0; - U32 req_size=0; + U32 req_size = 0; TLoaderFilesData *init_info = NULL; S32 rc = -1; THandle hIpcSta; @@ -74,11 +74,10 @@ S32 init_driver( PS8 adapter_name, PS8 eeprom_file_name, hIpcSta = IpcSta_Create(adapter_name); if (hIpcSta == NULL) - { - os_error_printf (CU_MSG_ERROR, (PS8)"wlan_loader: cant allocate IpcSta context\n", eeprom_file_name); - goto init_driver_end; + { + os_error_printf (CU_MSG_ERROR, (PS8)"wlan_loader: cant allocate IpcSta context\n", eeprom_file_name); + goto init_driver_end; } - /* Send init request to the driver */ if ( (NULL != eeprom_file_name) && @@ -87,8 +86,7 @@ S32 init_driver( PS8 adapter_name, PS8 eeprom_file_name, eeprom_image_length = os_getFileSize(f1); if (-1 == eeprom_image_length) { - os_error_printf(CU_MSG_ERROR, (PS8)"Cannot get eeprom image file length <%s>\n", - eeprom_file_name); + os_error_printf(CU_MSG_ERROR, (PS8)"Cannot get eeprom image file length <%s>\n", eeprom_file_name); goto init_driver_end; } } @@ -99,8 +97,7 @@ S32 init_driver( PS8 adapter_name, PS8 eeprom_file_name, firmware_image_length = os_getFileSize(f2); if (-1 == firmware_image_length) { - os_error_printf(CU_MSG_ERROR, (PS8)"Cannot get firmware image file length <%s>\n", - firmware_file_name); + os_error_printf(CU_MSG_ERROR, (PS8)"Cannot get firmware image file length <%s>\n", firmware_file_name); goto init_driver_end; } } @@ -111,8 +108,7 @@ S32 init_driver( PS8 adapter_name, PS8 eeprom_file_name, init_file_length = os_getFileSize(f3); if (-1 == init_file_length) { - os_error_printf(CU_MSG_ERROR, (PS8)"Cannot get init file length <%s>\n", - init_file_name); + os_error_printf(CU_MSG_ERROR, (PS8)"Cannot get init file length <%s>\n", init_file_name); goto init_driver_end; } } @@ -128,24 +124,21 @@ S32 init_driver( PS8 adapter_name, PS8 eeprom_file_name, init_info->uNvsFileLength = eeprom_image_length; init_info->uFwFileLength = firmware_image_length; init_info->uIniFileLength = init_file_length; - - if (!f1 || - (eeprom_image_length && + + if (!f1 || (eeprom_image_length && os_fread(&init_info->data[0], 1, eeprom_image_length, f1)<eeprom_image_length)) { - }else + } else os_error_printf(CU_MSG_INFO1, (PS8)"**** nvs file found %s **** \n", eeprom_file_name); - if (!f2 || - (firmware_image_length && + if (!f2 || (firmware_image_length && os_fread(&init_info->data[eeprom_image_length], 1, firmware_image_length, f2)<firmware_image_length)) { os_error_printf(CU_MSG_ERROR, (PS8)"Error reading firmware image %s - Aborting...\n", firmware_file_name); goto init_driver_end; } - if (!f3 || - (init_file_length && + if (!f3 || (init_file_length && os_fread(&init_info->data[eeprom_image_length+firmware_image_length], 1, init_file_length, f3)<init_file_length)) { os_error_printf(CU_MSG_ERROR, (PS8)"Warning: Error in reading init_file %s - Using defaults\n", init_file_name); @@ -170,7 +163,7 @@ init_driver_end: os_fclose(f3); if (init_info) os_MemoryFree(init_info); - if (hIpcSta) + if (hIpcSta) IpcSta_Destroy(hIpcSta); return rc; @@ -189,7 +182,7 @@ int check_and_set_property(char *prop_name, char *prop_val) break; } if( count ) { - os_error_printf(CU_MSG_ERROR, (PS8)"Set property %s = %s - Ok\n", prop_name, prop_val); + os_error_printf(CU_MSG_ERROR, (PS8)"Set property %s = %s - Ok\n", prop_name, prop_val); } else { os_error_printf(CU_MSG_ERROR, (PS8)"Set property %s = %s - Fail\n", prop_name, prop_val); @@ -236,9 +229,9 @@ S32 user_main(S32 argc, PPS8 argv) else { os_error_printf (CU_MSG_ERROR, (PS8)"Loader: unknow parameter '%s'\n", argv[i]); -#ifdef ANDROID +#ifdef ANDROID check_and_set_property("wlan.driver.status", "failed"); -#endif +#endif return -1; } } @@ -256,14 +249,14 @@ S32 user_main(S32 argc, PPS8 argv) if (init_driver (g_drv_name, eeprom_file_name, init_file_name, firmware_file_name) != 0) { #ifdef ANDROID - check_and_set_property("wlan.driver.status", "failed"); - release_wake_lock(PROGRAM_NAME); -#endif + check_and_set_property("wlan.driver.status", "failed"); + release_wake_lock(PROGRAM_NAME); +#endif return -1; } #ifdef ANDROID - check_and_set_property("wlan.driver.status", "ok"); - release_wake_lock(PROGRAM_NAME); -#endif + check_and_set_property("wlan.driver.status", "ok"); + release_wake_lock(PROGRAM_NAME); +#endif return 0; } diff --git a/wl1271/TWD/Ctrl/CmdBld.c b/wl1271/TWD/Ctrl/CmdBld.c index 62edb0a9..2ef38ef0 100644 --- a/wl1271/TWD/Ctrl/CmdBld.c +++ b/wl1271/TWD/Ctrl/CmdBld.c @@ -1565,7 +1565,6 @@ static TI_STATUS __cfg_ht_information (TI_HANDLE hCmdBld) } - static TI_STATUS __cfg_ba_set_session (TI_HANDLE hCmdBld) { TI_STATUS tRes = TI_NOK; @@ -2200,7 +2199,7 @@ TI_STATUS cmdBld_ReadMib (TI_HANDLE hCmdBld, TI_HANDLE hCb, void* fCb, void* pCb { case MIB_dot11MaxReceiveLifetime: { - TTwdParamInfo ParamInfo; + TTwdParamInfo ParamInfo; ParamInfo.paramType = TWD_MAX_RX_MSDU_LIFE_TIME_PARAM_ID; ParamInfo.paramLength = sizeof(ParamInfo.content.halCtrlMaxRxMsduLifetime); Status = cmdBld_GetParam (hCmdBld, &ParamInfo); @@ -2224,7 +2223,7 @@ TI_STATUS cmdBld_ReadMib (TI_HANDLE hCmdBld, TI_HANDLE hCb, void* fCb, void* pCb case MIB_ctsToSelf: { - TTwdParamInfo ParamInfo; + TTwdParamInfo ParamInfo; ParamInfo.paramType = TWD_CTS_TO_SELF_PARAM_ID; ParamInfo.paramLength = sizeof(ParamInfo.content.halCtrlCtsToSelf); Status = cmdBld_GetParam (hCmdBld, &ParamInfo); @@ -2427,24 +2426,24 @@ TI_STATUS cmdBld_ConvertAppRatesBitmap (TI_UINT32 uAppRatesBitmap, TI_UINT32 uAp EHwRateBitFiled rateNumberToBitmap(TI_UINT8 uRate) { - switch(uRate) - { - case 1: return HW_BIT_RATE_1MBPS; - case 2: return HW_BIT_RATE_2MBPS; - case 5: return HW_BIT_RATE_5_5MBPS; - case 6: return HW_BIT_RATE_6MBPS; - case 9: return HW_BIT_RATE_9MBPS; - case 11: return HW_BIT_RATE_11MBPS; - case 12: return HW_BIT_RATE_12MBPS; - case 18: return HW_BIT_RATE_18MBPS; - case 22: return HW_BIT_RATE_22MBPS; - case 24: return HW_BIT_RATE_24MBPS; - case 36: return HW_BIT_RATE_36MBPS; - case 48: return HW_BIT_RATE_48MBPS; - case 54: return HW_BIT_RATE_54MBPS; - default: - return 0; - } + switch(uRate) + { + case 1: return HW_BIT_RATE_1MBPS; + case 2: return HW_BIT_RATE_2MBPS; + case 5: return HW_BIT_RATE_5_5MBPS; + case 6: return HW_BIT_RATE_6MBPS; + case 9: return HW_BIT_RATE_9MBPS; + case 11: return HW_BIT_RATE_11MBPS; + case 12: return HW_BIT_RATE_12MBPS; + case 18: return HW_BIT_RATE_18MBPS; + case 22: return HW_BIT_RATE_22MBPS; + case 24: return HW_BIT_RATE_24MBPS; + case 36: return HW_BIT_RATE_36MBPS; + case 48: return HW_BIT_RATE_48MBPS; + case 54: return HW_BIT_RATE_54MBPS; + default: + return 0; + } } TI_STATUS cmdBld_ConvertAppRate (ERate AppRate, TI_UINT8 *pHwRate) diff --git a/wl1271/TWD/Ctrl/CmdBld.h b/wl1271/TWD/Ctrl/CmdBld.h index 50789544..b30bce1f 100644 --- a/wl1271/TWD/Ctrl/CmdBld.h +++ b/wl1271/TWD/Ctrl/CmdBld.h @@ -261,7 +261,6 @@ typedef struct #define DB_RM(HCMDBLD) (((TCmdBld *)HCMDBLD)->tDb.tRateMngParams) - #define DB_DEFAULT_CHANNEL(HCMDBLD) \ (RADIO_BAND_5_0_GHZ == DB_WLAN(HCMDBLD).RadioBand) \ ? DB_WLAN(HCMDBLD).calibrationChannel5_0 \ diff --git a/wl1271/TWD/Ctrl/CmdBldCfgIE.c b/wl1271/TWD/Ctrl/CmdBldCfgIE.c index 18319011..8d642ce4 100644 --- a/wl1271/TWD/Ctrl/CmdBldCfgIE.c +++ b/wl1271/TWD/Ctrl/CmdBldCfgIE.c @@ -773,10 +773,7 @@ TI_STATUS cmdBld_CfgIeStatisitics (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb) pCfg = os_memoryAlloc(pCmdBld->hOs, sizeof(ACXStatistics_t)); if (!pCfg) - { return status; - } - /* Set information element header */ pCfg->EleHdr.id = ACX_STATISTICS; pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct); @@ -1868,10 +1865,9 @@ TI_STATUS cmdBld_CfgIeRadioParams (TI_HANDLE hCmdBld, IniFileRadioParam *pIniFil } pTestCmd->testCmdId = TEST_CMD_INI_FILE_RADIO_PARAM; - + os_memoryCopy(pCmdBld->hOs, &pTestCmd->testCmd_u.IniFileRadioParams, pIniFileRadioParams, sizeof(IniFileRadioParam)); - status = cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_TEST, (void *)pTestCmd, @@ -1912,8 +1908,6 @@ TI_STATUS cmdBld_CfgPlatformGenParams (TI_HANDLE hCmdBld, IniFileGeneralParam *p } - - /**************************************************************************** * cmdBld_CfgIeBurstMode() **************************************************************************** @@ -1922,7 +1916,7 @@ TI_STATUS cmdBld_CfgPlatformGenParams (TI_HANDLE hCmdBld, IniFileGeneralParam *p * INPUTS: hCmdBld - handle to command builder object * bEnabled - is enabled flag * fCB - callback function for command complete - * hCb - handle to be apssed to callback function + * hCb - handle to be apssed to callback function * * OUTPUT: None * @@ -1935,7 +1929,7 @@ TI_STATUS cmdBld_CfgIeBurstMode (TI_HANDLE hCmdBld, TI_BOOL bEnabled, void *fCb, AcxBurstMode *pCfg = &tAcxBurstMode; /* set IE header */ - pCfg->EleHdr.id = ACX_BURST_MODE; + pCfg->EleHdr.id = ACX_BURST_MODE; pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct); /* set burst mode value */ @@ -2042,6 +2036,3 @@ TI_STATUS cmdBld_CfgIeDcoItrimParams (TI_HANDLE hCmdBld, TI_BOOL enable, TI_UINT return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(ACXDCOItrimParams_t), fCb, hCb, NULL); } - - - diff --git a/wl1271/TWD/Ctrl/CmdBldCfgIE.h b/wl1271/TWD/Ctrl/CmdBldCfgIE.h index 9cee9cd1..af86f531 100644 --- a/wl1271/TWD/Ctrl/CmdBldCfgIE.h +++ b/wl1271/TWD/Ctrl/CmdBldCfgIE.h @@ -103,9 +103,5 @@ TI_STATUS cmdBld_CfgIeBurstMode (TI_HANDLE hCmdBld, TI_BOOL bEnabled, void * TI_STATUS cmdBld_CfgIeSRDebug (TI_HANDLE hCmdBld, ACXSmartReflexDebugParams_t *pSRDebug, void *fCb, TI_HANDLE hCb); TI_STATUS cmdBld_CfgIeSRState (TI_HANDLE hCmdBld, uint8 SRstate, void *fCb, TI_HANDLE hCb); TI_STATUS cmdBld_CfgIeRateMngDbg (TI_HANDLE hCmdBld, RateMangeParams_t *pRateMngParams, void *fCb, TI_HANDLE hCb); - - - - #endif diff --git a/wl1271/TWD/Ctrl/CmdBldCmd.c b/wl1271/TWD/Ctrl/CmdBldCmd.c index 905d95d2..27f205be 100644 --- a/wl1271/TWD/Ctrl/CmdBldCmd.c +++ b/wl1271/TWD/Ctrl/CmdBldCmd.c @@ -488,7 +488,6 @@ TI_UINT32 cmdBld_BuildPeriodicScanChannles (TPeriodicScanParams *pPeriodicScanPa /* advance mathcing channel counter */ uNumChannels++; } - } /* return channel count */ @@ -548,9 +547,7 @@ TI_STATUS cmdBld_StartPeriodicScan (TI_HANDLE hCmdBld, TPeriodicScanParams *pPer default: /* More than one SSID - copy SSIDs to SSID list command */ pFWSsidList = os_memoryAlloc(pCmdBld->hOs, sizeof(ConnScanSSIDList_t)); if (!pFWSsidList) - { return TI_NOK; - } if ((TI_UINT8)pPeriodicScanParams->uSsidListFilterEnabled == 1) tFWPeriodicScanParams.ssidFilterType = (ScanSsidFilterType_e)SCAN_SSID_FILTER_TYPE_LIST; @@ -1688,4 +1685,3 @@ TI_STATUS cmdBld_CmdTest (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb, TTestCmd* return cmdBld_CmdIeTest (hCmdBld, fCb, hCb, pTestCmd); } - diff --git a/wl1271/TWD/Ctrl/CmdQueue.c b/wl1271/TWD/Ctrl/CmdQueue.c index dc680273..97893ecd 100644 --- a/wl1271/TWD/Ctrl/CmdQueue.c +++ b/wl1271/TWD/Ctrl/CmdQueue.c @@ -63,8 +63,10 @@ static TI_STATUS cmdQueue_Push (TI_HANDLE hCmdQueue, void *pCb); #ifdef TI_DBG static void cmdQueue_PrintQueue(TCmdQueue *pCmdQueue); +#ifdef REPORT_LOG static char * cmdQueue_GetIEString (TI_INT32 MboxCmdType, TI_UINT16 id); static char * cmdQueue_GetCmdString (TI_INT32 MboxCmdType); +#endif #endif /* TI_DBG */ @@ -789,8 +791,8 @@ TI_STATUS cmdQueue_Error (TI_HANDLE hCmdQueue, TI_UINT32 command, TI_UINT32 stat if (status != CMD_STATUS_UNKNOWN_CMD && status != CMD_STATUS_UNKNOWN_IE) { - #ifdef TI_DBG - +#ifdef TI_DBG +#ifdef REPORT_LOG TCmdQueueNode* pHead = &pCmdQueue->aCmdQueue[pCmdQueue->head]; TI_UINT32 TimeStamp = os_timeStampMs(pCmdQueue->hOs); @@ -803,11 +805,11 @@ TI_STATUS cmdQueue_Error (TI_HANDLE hCmdQueue, TI_UINT32 command, TI_UINT32 stat pHead->uParamsLen, pCmdQueue->uNumberOfCommandInQueue, TimeStamp)); - +#endif /* Print The command that was sent before the timeout occur */ cmdQueue_PrintHistory(pCmdQueue, CMDQUEUE_HISTORY_DEPTH); - #endif /* TI_DBG */ +#endif /* TI_DBG */ /* preform Recovery */ if (pCmdQueue->fFailureCb) @@ -929,6 +931,7 @@ static void cmdQueue_PrintQueue (TCmdQueue *pCmdQueue) */ void cmdQueue_PrintHistory (TI_HANDLE hCmdQueue, TI_UINT32 uNumOfCmd) { +#ifdef REPORT_LOG TCmdQueue* pCmdQueue = (TCmdQueue*)hCmdQueue; TI_UINT32 uCurrentCmdIndex; TI_UINT32 first = pCmdQueue->head; @@ -951,16 +954,17 @@ void cmdQueue_PrintHistory (TI_HANDLE hCmdQueue, TI_UINT32 uNumOfCmd) { first = CMDQUEUE_QUEUE_DEPTH - 1; } - else + else { first--; } - } + } - WLAN_OS_REPORT(("-----------------------------------------------------------------------\n")); + WLAN_OS_REPORT(("-----------------------------------------------------------------------\n")); +#endif } - +#ifdef REPORT_LOG /* * \brief Interperts the command's type to the command's name * @@ -1090,7 +1094,7 @@ static char * cmdQueue_GetIEString (TI_INT32 MboxCmdType, TI_UINT16 Id) } return ""; } - +#endif #endif /* TI_DBG */ diff --git a/wl1271/TWD/Data_Service/RxQueue.c b/wl1271/TWD/Data_Service/RxQueue.c index de68ae1f..7f627beb 100644 --- a/wl1271/TWD/Data_Service/RxQueue.c +++ b/wl1271/TWD/Data_Service/RxQueue.c @@ -282,7 +282,6 @@ static TI_STATUS RxQueue_PassPacket (TI_HANDLE hRxQueue, TI_STATUS tStatus, cons pMacHdr->fc = ENDIAN_HANDLE_WORD(pMacHdr->fc); pMacHdr->duration = ENDIAN_HANDLE_WORD(pMacHdr->duration); pMacHdr->seqCtrl = ENDIAN_HANDLE_WORD(pMacHdr->seqCtrl); - } else { @@ -294,7 +293,6 @@ static TI_STATUS RxQueue_PassPacket (TI_HANDLE hRxQueue, TI_STATUS tStatus, cons TRACE0(pRxQueue->hReport, REPORT_SEVERITY_INFORMATION , "RxQueue_PassPacket: call TWD_OWNER_RX_QUEUE CB. In std rxData_ReceivePacket()\n"); - /* Set the packet to upper layer */ /* if the packet status not success it will be discarded */ pRxQueue->tReceivePacketCB (pRxQueue->hReceivePacketCB_handle, pBuffer); @@ -368,14 +366,14 @@ void RxQueue_ReceivePacket (TI_HANDLE hRxQueue, const void * pBuffer) { pRxParams->packet_class_tag = TAG_CLASS_QOS_DATA; } - } + } /* * packet doesn't need reorder ? */ if ((pRxParams->packet_class_tag != TAG_CLASS_QOS_DATA) && (pRxParams->packet_class_tag != TAG_CLASS_BA_EVENT) && (pRxParams->packet_class_tag != TAG_CLASS_AMSDU)) { - TRACE0(pRxQueue->hReport, REPORT_SEVERITY_INFORMATION , "RxQueue_ReceivePacket: pass packet without reorder.\n"); + TRACE0(pRxQueue->hReport, REPORT_SEVERITY_INFORMATION, "RxQueue_ReceivePacket: pass packet without reorder.\n"); RxQueue_PassPacket (pRxQueue, tStatus, pBuffer); @@ -393,7 +391,6 @@ void RxQueue_ReceivePacket (TI_HANDLE hRxQueue, const void * pBuffer) TI_UINT16 uSequenceControl; TRxQueueTidDataBase *pTidDataBase; - /* Get TID from frame */ uFrameTid = uQosControl & DOT11_QOS_CONTROL_FIELD_TID_BITS; @@ -502,7 +499,6 @@ void RxQueue_ReceivePacket (TI_HANDLE hRxQueue, const void * pBuffer) else { TRACE1(pRxQueue->hReport, REPORT_SEVERITY_ERROR, "RxQueue_ReceivePacket: frame Sequence has allready saved. uFrameSn = %d\n",uFrameSn); - RxQueue_PassPacket (pRxQueue, TI_NOK, pBuffer); return; } @@ -596,7 +592,7 @@ void RxQueue_ReceivePacket (TI_HANDLE hRxQueue, const void * pBuffer) /* uSaveInex % RX_QUEUE_ARRAY_SIZE */ uSaveInex &= RX_QUEUE_ARRAY_SIZE_BIT_MASK; - /* save the packet in the last entry of the queue */ + /* save the packet in the last entry of the queue */ pTidDataBase->aPaketsQueue[uSaveInex].tStatus = tStatus; pTidDataBase->aPaketsQueue[uSaveInex].pPacket = (void *)pBuffer; pTidDataBase->aPaketsQueue[uSaveInex].pPacket = (void *)pBuffer; @@ -630,7 +626,6 @@ void RxQueue_ReceivePacket (TI_HANDLE hRxQueue, const void * pBuffer) switch ((dot11_Fc_Sub_Type_e)(ufc & DOT11_FC_SUB_MASK)) { case DOT11_FC_SUB_BAR: - TRACE0(pRxQueue->hReport, REPORT_SEVERITY_INFORMATION , "RxQueue_ReceivePacket: BA event - BAR frame.\n"); /* get pointer to the frame body */ @@ -659,7 +654,7 @@ void RxQueue_ReceivePacket (TI_HANDLE hRxQueue, const void * pBuffer) { TRACE1(pRxQueue->hReport, REPORT_SEVERITY_ERROR , "RxQueue_ReceivePacket: BA event - BAR frame for TID not established, TID = %d.\n",uFrameTid); - RxQueue_PassPacket (pRxQueue, TI_NOK, pBuffer); + RxQueue_PassPacket (pRxQueue, TI_NOK, pBuffer); return; } @@ -695,6 +690,7 @@ void RxQueue_ReceivePacket (TI_HANDLE hRxQueue, const void * pBuffer) /* aWinStartArrayInex % RX_QUEUE_ARRAY_SIZE */ pTidDataBase->aWinStartArrayInex &= RX_QUEUE_ARRAY_SIZE_BIT_MASK; } + pTidDataBase->aTidExpectedSn = uStartingSequenceNumber; } break; @@ -730,7 +726,7 @@ void RxQueue_ReceivePacket (TI_HANDLE hRxQueue, const void * pBuffer) /*set the SA Tid pointer */ pTidDataBase = &(pRxQueue->tRxQueueArraysMng.tSa1ArrayMng[uFrameTid]); - /* TID legal value */ + /* TID legal value */ /* packet TID BA established ? */ if (pTidDataBase->aTidBaEstablished == TI_TRUE) { @@ -761,7 +757,6 @@ void RxQueue_ReceivePacket (TI_HANDLE hRxQueue, const void * pBuffer) pTidDataBase->aTidExpectedSn = (uStartingSequenceNumber & DOT11_SC_SEQ_NUM_MASK) >> 4; pTidDataBase->aWinStartArrayInex = 0; os_memoryZero (pRxQueue->hOs, pTidDataBase->aPaketsQueue, sizeof (TRxQueuePacketEntry) * RX_QUEUE_ARRAY_SIZE); - break; case DOT11_BA_ACTION_DELBA: @@ -792,7 +787,7 @@ void RxQueue_ReceivePacket (TI_HANDLE hRxQueue, const void * pBuffer) { TRACE1(pRxQueue->hReport, REPORT_SEVERITY_ERROR , "RxQueue_ReceivePacket: BA event - DELBA frame for TID not established, TID = %d.\n",uFrameTid); - RxQueue_PassPacket (pRxQueue, TI_NOK, pBuffer); + RxQueue_PassPacket (pRxQueue, TI_NOK, pBuffer); return; } diff --git a/wl1271/TWD/Data_Service/txCtrlBlk.c b/wl1271/TWD/Data_Service/txCtrlBlk.c index c78172e2..24feef64 100644 --- a/wl1271/TWD/Data_Service/txCtrlBlk.c +++ b/wl1271/TWD/Data_Service/txCtrlBlk.c @@ -260,6 +260,7 @@ TTxCtrlBlk *txCtrlBlk_GetPointer (TI_HANDLE hTxCtrlBlk, TI_UINT8 descId) #ifdef TI_DBG void txCtrlBlk_PrintTable (TI_HANDLE hTxCtrlBlk) { +#ifdef REPORT_LOG TTxCtrlBlkObj *pTxCtrlBlk = (TTxCtrlBlkObj *)hTxCtrlBlk; TI_UINT8 entry; @@ -279,6 +280,7 @@ void txCtrlBlk_PrintTable (TI_HANDLE hTxCtrlBlk) pTxCtrlBlk->aTxCtrlBlkTbl[entry].tTxDescriptor.totalMemBlks, pTxCtrlBlk->aTxCtrlBlkTbl[entry].tTxPktParams.uFlags)); } +#endif } #endif /* TI_DBG */ diff --git a/wl1271/TWD/Data_Service/txHwQueue.c b/wl1271/TWD/Data_Service/txHwQueue.c index b6a8e9ed..dda6da06 100644 --- a/wl1271/TWD/Data_Service/txHwQueue.c +++ b/wl1271/TWD/Data_Service/txHwQueue.c @@ -673,6 +673,7 @@ void txHwQueue_RegisterCb (TI_HANDLE hTxHwQueue, TI_UINT32 uCallBackId, void *fC #ifdef TI_DBG void txHwQueue_PrintInfo (TI_HANDLE hTxHwQueue) { +#ifdef REPORT_LOG TTxHwQueue *pTxHwQueue = (TTxHwQueue *)hTxHwQueue; TI_INT32 TxQid; @@ -706,8 +707,8 @@ void txHwQueue_PrintInfo (TI_HANDLE hTxHwQueue) pTxHwQueue->aTxHwQueueInfo[TxQid].uNumBlksCausedBusy, pTxHwQueue->aTxHwQueueInfo[TxQid].bQueueBusy)); } +#endif } - #endif /* TI_DBG */ diff --git a/wl1271/TWD/FW_Transfer/CmdMBox.c b/wl1271/TWD/FW_Transfer/CmdMBox.c index 7c4b0051..e8232e42 100644 --- a/wl1271/TWD/FW_Transfer/CmdMBox.c +++ b/wl1271/TWD/FW_Transfer/CmdMBox.c @@ -500,11 +500,13 @@ void cmdMbox_GetCmdParams (TI_HANDLE hCmdMbox, TI_UINT8* pParamBuf) void cmdMbox_PrintInfo(TI_HANDLE hCmdMbox) { +#ifdef REPORT_LOG TCmdMbox *pCmdMbox = (TCmdMbox *)hCmdMbox; WLAN_OS_REPORT(("Print cmdMbox module info\n")); WLAN_OS_REPORT(("=========================\n")); WLAN_OS_REPORT(("bCmdInProgress = %d\n", pCmdMbox->bCmdInProgress)); +#endif } #endif /* TI_DBG */ diff --git a/wl1271/TWD/FW_Transfer/Export_Inc/txXfer_api.h b/wl1271/TWD/FW_Transfer/Export_Inc/txXfer_api.h index 14f3def3..ba4ceda4 100644 --- a/wl1271/TWD/FW_Transfer/Export_Inc/txXfer_api.h +++ b/wl1271/TWD/FW_Transfer/Export_Inc/txXfer_api.h @@ -199,7 +199,3 @@ void txXfer_PrintStats (TI_HANDLE hTxXfer); #endif /* _TX_XFER_API_H */ - - - - diff --git a/wl1271/TWD/FW_Transfer/FwEvent.c b/wl1271/TWD/FW_Transfer/FwEvent.c index 4eec3a0b..6672aea5 100644 --- a/wl1271/TWD/FW_Transfer/FwEvent.c +++ b/wl1271/TWD/FW_Transfer/FwEvent.c @@ -772,6 +772,7 @@ void fwEvent_EnableInterrupts(TI_HANDLE hFwEvent) void fwEvent_PrintStat (TI_HANDLE hFwEvent) { +#ifdef REPORT_LOG TfwEvent *pFwEvent = (TfwEvent *)hFwEvent; WLAN_OS_REPORT(("Print FW event module info\n")); @@ -782,6 +783,7 @@ void fwEvent_PrintStat (TI_HANDLE hFwEvent) WLAN_OS_REPORT(("bIntrPending = %d\n", pFwEvent->bIntrPending)); WLAN_OS_REPORT(("uNumPendHndlrs = %d\n", pFwEvent->uNumPendHndlrs)); WLAN_OS_REPORT(("uFwTimeOffset = %d\n", pFwEvent->uFwTimeOffset)); +#endif } #endif /* TI_DBG */ diff --git a/wl1271/TWD/FW_Transfer/HwInit.c b/wl1271/TWD/FW_Transfer/HwInit.c index b8bebec1..cdb6c008 100644 --- a/wl1271/TWD/FW_Transfer/HwInit.c +++ b/wl1271/TWD/FW_Transfer/HwInit.c @@ -56,6 +56,10 @@ #include "eventMbox_api.h" #include "CmdBld.h" #include "CmdMBox_api.h" +#ifdef TI_RANDOM_DEFAULT_MAC +#include <linux/random.h> +#include <linux/jiffies.h> +#endif extern void TWD_FinalizeOnFailure (TI_HANDLE hTWD); @@ -92,9 +96,9 @@ extern void cmdBld_FinalizeDownload (TI_HANDLE hCmdBld, TBootAttr *pBootAttr, Fw /* Maximal block size in a single SDIO transfer --> Firmware image load chunk size */ #ifdef _VLCT_ -#define MAX_SDIO_BLOCK (4000) +#define MAX_SDIO_BLOCK (4000) #else -#define MAX_SDIO_BLOCK (500) +#define MAX_SDIO_BLOCK (500) #endif #define ACX_EEPROMLESS_IND_REG (SCR_PAD4) @@ -340,7 +344,6 @@ typedef struct TI_UINT32 uTopStage; TI_STATUS uTopStatus; - TI_UINT8 auFwTmpBuf [WSPI_PAD_LEN_WRITE + MAX_SDIO_BLOCK]; TFinalizeCb fFinalizeDownload; @@ -452,6 +455,9 @@ TI_STATUS hwInit_Init (TI_HANDLE hHwInit, { THwInit *pHwInit = (THwInit *)hHwInit; TTxnStruct* pTxn; +#ifdef TI_RANDOM_DEFAULT_MAC + u32 rand_mac; +#endif /* Configure modules handles */ pHwInit->hReport = hReport; @@ -463,6 +469,14 @@ TI_STATUS hwInit_Init (TI_HANDLE hHwInit, pHwInit->hFinalizeDownload = hFinalizeDownload; SET_DEF_NVS(pHwInit->aDefaultNVS) +#ifdef TI_RANDOM_DEFAULT_MAC + /* Create random MAC address: offset 3, 4 and 5 */ + srandom32((u32)jiffies); + rand_mac = random32(); + pHwInit->aDefaultNVS[3] = (u8)rand_mac; + pHwInit->aDefaultNVS[4] = (u8)(rand_mac >> 8); + pHwInit->aDefaultNVS[5] = (u8)(rand_mac >> 16); +#endif for (pHwInit->uTxnIndex=0;pHwInit->uTxnIndex<MAX_HW_INIT_CONSECUTIVE_TXN;pHwInit->uTxnIndex++) { @@ -1334,7 +1348,6 @@ static TI_STATUS hwInit_EepromlessStartBurstSm (TI_HANDLE hHwInit) pHwInit->uEEPROMStage = 3; - /* Set the bus addresses partition to its "running" mode */ SET_WORK_PARTITION(pHwInit->aPartition) hwInit_SetPartition (pHwInit,pHwInit->aPartition); @@ -1434,7 +1447,7 @@ static TI_STATUS hwInit_LoadFwImageSm (TI_HANDLE hHwInit) TRACE2(pHwInit->hReport, REPORT_SEVERITY_INIT , "Image addr=0x%x, Len=0x%x\n", pHwInit->pFwBuf, pHwInit->uFwLength); - /* Set bus memory partition to current download area */ + /* Set bus memory partition to current download area */ SET_FW_LOAD_PARTITION(pHwInit->aPartition,pHwInit->uFwAddress) hwInit_SetPartition (pHwInit,pHwInit->aPartition); status = TI_OK; @@ -2296,6 +2309,3 @@ TI_STATUS hwInit_InitTopRegisterRead(TI_HANDLE hHwInit, TI_UINT32 uAddress) } /* End while */ } - - - diff --git a/wl1271/TWD/FW_Transfer/RxXfer.c b/wl1271/TWD/FW_Transfer/RxXfer.c index 35c5f3cd..c5d2a269 100644 --- a/wl1271/TWD/FW_Transfer/RxXfer.c +++ b/wl1271/TWD/FW_Transfer/RxXfer.c @@ -563,7 +563,6 @@ static TI_STATUS rxXfer_Handle(TI_HANDLE hRxXfer) /* If required to send Rx packet(s) transaction */ if (bIssueTxn) { - if (bExit) { TXN_PARAM_SET_END_OF_BURST(pTxn, 1); @@ -665,6 +664,7 @@ static ETxnStatus rxXfer_IssueTxn (TI_HANDLE hRxXfer, TI_UINT32 uFirstMemBlkAddr eStatus = twIf_Transact(pRxXfer->hTwIf, pTxn); /* Write driver packets counter to FW. This write automatically generates interrupt to FW */ + /* Note: Workaround for WL6-PG1.0 is still needed for PG2.0 ==> if (pRxXfer->bChipIs1273Pg10) */ pTxn = &pRxXfer->aCounterTxn[uIndex].tTxnStruct; pTxn->uHwAddr = RX_DRIVER_COUNTER_ADDRESS; pRxXfer->aCounterTxn[uIndex].uCounter = ENDIAN_HANDLE_LONG(pRxXfer->uDrvRxCntr); @@ -886,6 +886,7 @@ void rxXfer_ClearStats (TI_HANDLE hRxXfer) ****************************************************************************/ void rxXfer_PrintStats (TI_HANDLE hRxXfer) { +#ifdef REPORT_LOG TRxXfer *pRxXfer = (TRxXfer *)hRxXfer; WLAN_OS_REPORT(("Print RX Xfer module info\n")); @@ -903,7 +904,6 @@ void rxXfer_PrintStats (TI_HANDLE hRxXfer) WLAN_OS_REPORT(("uCountPktAggreg-2 = %d\n", pRxXfer->tDbgStat.uCountPktAggreg[1])); WLAN_OS_REPORT(("uCountPktAggreg-3 = %d\n", pRxXfer->tDbgStat.uCountPktAggreg[2])); WLAN_OS_REPORT(("uCountPktAggreg-4 = %d\n", pRxXfer->tDbgStat.uCountPktAggreg[3])); +#endif } #endif - - diff --git a/wl1271/TWD/FW_Transfer/txResult.c b/wl1271/TWD/FW_Transfer/txResult.c index 1302c133..b1b80db9 100644 --- a/wl1271/TWD/FW_Transfer/txResult.c +++ b/wl1271/TWD/FW_Transfer/txResult.c @@ -434,6 +434,7 @@ void txResult_RegisterCb (TI_HANDLE hTxResult, TI_UINT32 uCallBackId, void *CBFu ****************************************************************************/ void txResult_PrintInfo (TI_HANDLE hTxResult) { +#ifdef REPORT_LOG TTxResultObj* pTxResult = (TTxResultObj*)hTxResult; WLAN_OS_REPORT(("Tx-Result Module Information:\n")); @@ -441,6 +442,7 @@ void txResult_PrintInfo (TI_HANDLE hTxResult) WLAN_OS_REPORT(("uInterruptsCounter: %d\n", pTxResult->uInterruptsCounter)); WLAN_OS_REPORT(("uHostResultsCounter: %d\n", pTxResult->uHostResultsCounter)); WLAN_OS_REPORT(("=============================\n")); +#endif } diff --git a/wl1271/TWD/FW_Transfer/txXfer.c b/wl1271/TWD/FW_Transfer/txXfer.c index c1567f3d..1497a092 100644 --- a/wl1271/TWD/FW_Transfer/txXfer.c +++ b/wl1271/TWD/FW_Transfer/txXfer.c @@ -422,6 +422,7 @@ void txXfer_ClearStats (TI_HANDLE hTxXfer) void txXfer_PrintStats (TI_HANDLE hTxXfer) { +#ifdef REPORT_LOG TTxXferObj *pTxXfer = (TTxXferObj*)hTxXfer; TI_UINT32 i; @@ -437,8 +438,7 @@ void txXfer_PrintStats (TI_HANDLE hTxXfer) { WLAN_OS_REPORT(("uCountPktAggreg-%2d = %d\n", i, pTxXfer->aDbgCountPktAggreg[i])); } +#endif } #endif /* TI_DBG */ - - diff --git a/wl1271/TWD/FirmwareApi/public_infoele.h b/wl1271/TWD/FirmwareApi/public_infoele.h index 4b4f6ec4..b818e497 100644 --- a/wl1271/TWD/FirmwareApi/public_infoele.h +++ b/wl1271/TWD/FirmwareApi/public_infoele.h @@ -2350,7 +2350,6 @@ typedef struct uint16 MaxPer; uint8 InverseCuriosityFactor; uint8 TxFailLowTh; - uint8 TxFailHighTh; uint8 PerAlphaShift; uint8 PerAddShift; diff --git a/wl1271/TWD/FirmwareApi/public_radio.h b/wl1271/TWD/FirmwareApi/public_radio.h index 77a227f9..1755e4b2 100644 --- a/wl1271/TWD/FirmwareApi/public_radio.h +++ b/wl1271/TWD/FirmwareApi/public_radio.h @@ -59,7 +59,6 @@ #include "public_types.h" #define MAC_ADDR_SIZE 6 /* typedef uint8 TMacAddr[MAC_ADDR_SIZE]; */ -/*defined in tiDefs.h*/ /************************************************************************/ /* */ /* Definitions section */ diff --git a/wl1271/TWD/MacServices/Export_Inc/MacServices_api.h b/wl1271/TWD/MacServices/Export_Inc/MacServices_api.h index 4c3c75e4..e547615f 100644 --- a/wl1271/TWD/MacServices/Export_Inc/MacServices_api.h +++ b/wl1271/TWD/MacServices/Export_Inc/MacServices_api.h @@ -33,7 +33,7 @@ /** \file MacServicesApi.h * \brief This file include public definitions for the MacServices module, comprising its API. - * \ + * \author Yuval Adler * \date 6-Oct-2005 */ @@ -80,7 +80,7 @@ *********************************************************************** */ /** - * \\n + * \author Yuval Adler\n * \date 6-Oct-2004\n * \brief Creates MacServices module * @@ -90,7 +90,7 @@ TI_HANDLE MacServices_create( TI_HANDLE hOS ); /** - * \\n + * \author Yuval Adler\n * \date 6-Oct-2004\n * \brief Destroys MacServices module * @@ -100,7 +100,7 @@ TI_HANDLE MacServices_create( TI_HANDLE hOS ); void MacServices_destroy( TI_HANDLE hMacServices ); /** - * \\n + * \author Yuval Adler\n * \date 6-Oct-2004\n * \brief Initializes the MacServices module * @@ -129,7 +129,7 @@ void MacServices_registerFailureEventCB (TI_HANDLE hMacServices, void * failureE /** - * \\n + * \author Ronen Kalish\n * \date 29-Dec-2004\n * \brief Registers a complete callback for scan complete notifications. * @@ -144,7 +144,7 @@ void MacServices_scanSRV_registerScanCompleteCB( TI_HANDLE hMacServices, /** - * \\n + * \author Ronen Kalish\n * \date 29-Dec-2004\n * \brief Performs a scan * @@ -167,7 +167,7 @@ TI_STATUS MacServices_scanSRV_scan( TI_HANDLE hMacServices, TScanParams *scanPar TCmdResponseCb commandResponseFunc, TI_HANDLE commandResponseObj ); /** - * \\n + * \author Ronen Kalish\n * \date 29-Dec-2004\n * \brief Stops a scan in progress * @@ -183,7 +183,7 @@ TI_STATUS MacServices_scanSRV_stopScan( TI_HANDLE hMacServices, EScanResultTag e TCmdResponseCb commandResponseFunc, TI_HANDLE commandResponseObj ); /** - * \\n + * \author Ronen Kalish\n * \date 17-Jan-2005\n * \brief Notifies the scan SRV of a FW reset (that had originally been reported by a different module).\n * @@ -194,7 +194,7 @@ TI_STATUS MacServices_scanSRV_stopScan( TI_HANDLE hMacServices, EScanResultTag e TI_STATUS MacServices_scanSRV_stopOnFWReset( TI_HANDLE hMacServices ); /** - * \\n + * \author Ronen Kalish\n * \date 29-Dec-2004\n * \brief callback function used by the power manager to notify driver mode result * @@ -205,7 +205,7 @@ TI_STATUS MacServices_scanSRV_stopOnFWReset( TI_HANDLE hMacServices ); void MacServices_scanSRV_powerSaveCB( TI_HANDLE hScanSRV, TI_UINT8 PSMode,TI_UINT8 psStatus ); /** - * \\n + * \author Ronen Kalish\n * \date 29-Dec-2004\n * \brief Callback function used by the HAL ctrl to notify scan complete * @@ -217,7 +217,7 @@ void MacServices_scanSRV_powerSaveCB( TI_HANDLE hScanSRV, TI_UINT8 PSMode,TI_UIN void MacServices_scanSRV_scanCompleteCB( TI_HANDLE hScanSRV, char* str, TI_UINT32 strLen ); /** - * \\n + * \author Ronen Kalish\n * \date 29-Dec-2004\n * \brief called when a scan timer expires. Completes the scan and starts a recovery process. * @@ -232,7 +232,7 @@ void MacServices_scanSrv_UpdateDtimTbtt (TI_HANDLE hMacServices, #ifdef TI_DBG /** - * \\n + * \author Shirit Brook\n * \date God knows when...\n * \brief Prints Scan Server SM status.\n * @@ -246,7 +246,7 @@ void MacServices_scanSrv_printDebugStatus(TI_HANDLE hMacServices); /** - * \ + * \author Assaf Azulay * \date 24-Oct-2005\n * \brief request PS by User * @@ -273,7 +273,7 @@ TI_STATUS MacServices_powerSrv_SetPsMode(TI_HANDLE hMacServices /** - * \ + * \author Assaf Azulay * \date 24-Oct-2005\n * \brief SW configure, use to override the current PowerMode (what ever it will be) to * active/PS combined with awake/power-down. use for temporary change the system policy. @@ -305,7 +305,7 @@ TI_STATUS MacServices_powerSrv_ReservePS( TI_HANDLE hMacService /** - * \ + * \author Assaf Azulay * \date 24-Oct-2005\n * \brief end the temporary change of system policy, and returns to the user system policy. * @@ -327,7 +327,7 @@ TI_STATUS MacServices_powerSrv_ReleasePS( TI_HANDLE hMacServices, /** - * \ + * \author Assaf Azulay * \date 24-Oct-2005\n * \brief reflects the actual state of the state machine * @@ -341,7 +341,7 @@ TI_BOOL MacServices_powerSrv_getPsStatus(TI_HANDLE hMacServices); /** - * \ + * \author Assaf Azulay * \date 24-Oct-2005\n * \sets the rate as got from user else sets default value.\n * @@ -372,7 +372,7 @@ TI_UINT32 MacServices_powerSrv_GetRateModulation(TI_HANDLE hMacServices); ***********************************************************************/ /** - * \\n + * \author Ronen Kalish\n * \date 09-November-2005\n * \brief Starts a measurement operation.\n * @@ -395,7 +395,7 @@ TI_STATUS MacServices_measurementSRV_startMeasurement( TI_HANDLE hMacServices, TI_HANDLE cmdCompleteCBObj ); /** - * \\n + * \author Ronen Kalish\n * \date 09-November-2005\n * \brief Stops a measurement operation in progress.\n * @@ -412,7 +412,7 @@ TI_STATUS MacServices_measurementSRV_stopMeasurement( TI_HANDLE hMacServices, TI_HANDLE cmdResponseCBObj ); /** - * \\n + * \author Ronen Kalish\n * \date 09-November-2005\n * \brief Notifies the measurement SRV of a FW reset (recovery).\n * @@ -422,7 +422,7 @@ TI_STATUS MacServices_measurementSRV_stopMeasurement( TI_HANDLE hMacServices, void MacServices_measurementSRV_FWReset( TI_HANDLE hMacServices ); /** - * \\n + * \author Ronen Kalish\n * \date 09-November-2005\n * \brief callback function used by the power manager to notify driver mode result * @@ -434,7 +434,7 @@ void MacServices_measurementSRV_FWReset( TI_HANDLE hMacServices ); void MacServices_measurementSRV_powerSaveCB( TI_HANDLE hMeasurementSRV, TI_UINT8 PSMode,TI_UINT8 psStatus ); /** - * \\n + * \author Ronen Kalish\n * \date 14-November-2005\n * \brief callback function used by the HAL for measure start event (sent when the FW * has started measurement operation, i.e. switched channel and changed RX filters).\n @@ -445,7 +445,7 @@ void MacServices_measurementSRV_powerSaveCB( TI_HANDLE hMeasurementSRV, TI_UINT8 void MacServices_measurementSRV_measureStartCB( TI_HANDLE hMeasurementSRV ); /** - * \\n + * \author Ronen Kalish\n * \date 14-November-2005\n * \brief callback function used by the HAL for measure stop event (sent when the FW * has finished measurement operation, i.e. switched channel to serving channel and changed back RX filters).\n @@ -456,7 +456,7 @@ void MacServices_measurementSRV_measureStartCB( TI_HANDLE hMeasurementSRV ); void MacServices_measurementSRV_measureCompleteCB( TI_HANDLE hMeasurementSRV ); /** - * \\n + * \author Ronen Kalish\n * \date 14-November-2005\n * \brief callback function used by the HAL for AP discovery stop event (sent when the FW * has finished AP discovery operation).\n @@ -467,7 +467,7 @@ void MacServices_measurementSRV_measureCompleteCB( TI_HANDLE hMeasurementSRV ); void MacServices_measurementSRV_apDiscoveryCompleteCB( TI_HANDLE hMeasurementSRV ); /** - * \\n + * \author Ronen Kalish\n * \date 16-November-2005\n * \brief Callback for channel load get param call.\n * @@ -490,7 +490,7 @@ void MacServices_measurementSRV_channelLoadParamCB( TI_HANDLE hMeasurementSRV, T void MacServices_measurementSRV_dummyChannelLoadParamCB( TI_HANDLE hMeasurementSRV, TI_STATUS status, TI_UINT8* CB_buf ); /** - * \\n + * \author Ronen Kalish\n * \date 16-November-2005\n * \brief Callback for noise histogram get param call.\n * @@ -502,7 +502,7 @@ void MacServices_measurementSRV_dummyChannelLoadParamCB( TI_HANDLE hMeasurementS void MacServices_measurementSRV_noiseHistCallBack(TI_HANDLE hMeasurementSRV, TI_STATUS status, TI_UINT8* CB_buf); /** - * \\n + * \author Ronen Kalish\n * \date 14-November-2005\n * \brief called when a measurement FW guard timer expires. * @@ -512,7 +512,7 @@ void MacServices_measurementSRV_noiseHistCallBack(TI_HANDLE hMeasurementSRV, TI_ void MacServices_measurementSRV_startStopTimerExpired (TI_HANDLE hMeasurementSRV, TI_BOOL bTwdInitOccured); /** - * \\n + * \author Ronen Kalish\n * \date 15-November-2005\n * \brief called when a measurement type timer expires.\n * diff --git a/wl1271/TWD/MacServices/Export_Inc/measurementSrvDbgPrint.h b/wl1271/TWD/MacServices/Export_Inc/measurementSrvDbgPrint.h index f37cc431..d76f4dac 100644 --- a/wl1271/TWD/MacServices/Export_Inc/measurementSrvDbgPrint.h +++ b/wl1271/TWD/MacServices/Export_Inc/measurementSrvDbgPrint.h @@ -33,7 +33,7 @@ /** \file MeasurementSrv.h * \brief This file include definitions for the measurmeent SRV module debug print functions. - * \ + * \author Ronen Kalish * \date 23-december-2005 */ @@ -76,7 +76,7 @@ *********************************************************************** */ /** - * \\n + * \author Ronen Kalish\n * \date 23-December-2005\n * \brief Prints a measurement request.\n * @@ -87,7 +87,7 @@ void measurementSRVPrintRequest( TI_HANDLE hMeasurementSRV, TMeasurementRequest *pMsrRequest ); /** - * \\n + * \author Ronen Kalish\n * \date 23-December-2005\n * \brief Prints a measurement type request.\n * diff --git a/wl1271/TWD/MacServices/MacServices.c b/wl1271/TWD/MacServices/MacServices.c index 0b7c2119..697be339 100644 --- a/wl1271/TWD/MacServices/MacServices.c +++ b/wl1271/TWD/MacServices/MacServices.c @@ -33,7 +33,7 @@ /** \file MacServices.c * \brief This file include public definitions for the scan SRV module, comprising its API. - * \ + * \author Yuval Adler * \date 6-Oct-2005 */ diff --git a/wl1271/TWD/MacServices/MacServices.h b/wl1271/TWD/MacServices/MacServices.h index 1edd2bad..a92551c6 100644 --- a/wl1271/TWD/MacServices/MacServices.h +++ b/wl1271/TWD/MacServices/MacServices.h @@ -33,7 +33,7 @@ /** \file MacServices.h * \brief This file include internal definitions for the MacServices module - * \ + * \author Yuval Adler * \date 6-Oct-2005 */ diff --git a/wl1271/TWD/MacServices/MeasurementSrv.c b/wl1271/TWD/MacServices/MeasurementSrv.c index 2dfaa936..d780a79c 100644 --- a/wl1271/TWD/MacServices/MeasurementSrv.c +++ b/wl1271/TWD/MacServices/MeasurementSrv.c @@ -33,7 +33,7 @@ /** \file measurementSrv.c * \brief This file include the measurement SRV interface functions implementation. - * \ + * \author Ronen Kalish * \date 09-November-2005 */ @@ -50,7 +50,7 @@ #include "CmdBld.h" /** - * \\n + * \author Ronen Kalish\n * \date 08-November-2005\n * \brief Creates the measurement SRV object * @@ -89,7 +89,7 @@ TI_HANDLE MacServices_measurementSRV_create( TI_HANDLE hOS ) } /** - * \\n + * \author Ronen Kalish\n * \date 08-November-2005\n * \brief Initializes the measurement SRV object * @@ -212,7 +212,7 @@ void measurementSRV_restart( TI_HANDLE hMeasurementSRV) } /** - * \\n + * \author Ronen Kalish\n * \date 08-November-2005\n * \brief Destroys the measurement SRV object * @@ -254,7 +254,7 @@ void MacServices_measurementSRV_destroy( TI_HANDLE hMeasurementSRV ) } /** - * \\n + * \author Ronen Kalish\n * \date 09-November-2005\n * \brief Starts a measurement operation.\n * @@ -334,7 +334,7 @@ TRACE2( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, "cmd complete CB: } /** - * \\n + * \author Ronen Kalish\n * \date 09-November-2005\n * \brief Stops a measurement operation in progress.\n * @@ -379,7 +379,7 @@ TRACE2( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, "Send null data:, } /** - * \\n + * \author Ronen Kalish\n * \date 09-November-2005\n * \brief Notifies the measurement SRV of a FW reset (recovery).\n * @@ -413,7 +413,7 @@ TRACE0( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, ": Received FW re } /** - * \\n + * \author Ronen Kalish\n * \date 09-November-2005\n * \brief callback function used by the power manager to notify driver mode result * @@ -452,7 +452,7 @@ TRACE2( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, ": Power save SRV } /** - * \\n + * \author Ronen Kalish\n * \date 14-November-2005\n * \brief callback function used by the HAL for measure start event (sent when the FW * has started measurement operation, i.e. switched channel and changed RX filters).\n @@ -479,7 +479,7 @@ void MacServices_measurementSRV_measureStartCB( TI_HANDLE hMeasurementSRV ) } /** - * \\n + * \author Ronen Kalish\n * \date 14-November-2005\n * \brief callback function used by the HAL for measure stop event (sent when the FW * has finished measurement operation, i.e. switched channel to serving channel and changed back RX filters).\n @@ -502,7 +502,7 @@ void MacServices_measurementSRV_measureCompleteCB( TI_HANDLE hMeasurementSRV ) } /** - * \\n + * \author Ronen Kalish\n * \date 14-November-2005\n * \brief callback function used by the HAL for AP discovery stop event (sent when the FW * has finished AP discovery operation).\n @@ -520,7 +520,7 @@ void MacServices_measurementSRV_apDiscoveryCompleteCB( TI_HANDLE hMeasurementSRV } /** - * \\n + * \author Ronen Kalish\n * \date 14-November-2005\n * \brief called when a measurement FW guard timer expires. * @@ -556,7 +556,7 @@ void MacServices_measurementSRV_startStopTimerExpired (TI_HANDLE hMeasurementSRV } /** - * \\n + * \author Ronen Kalish\n * \date 15-November-2005\n * \brief called when a measurement type timer expires.\n * @@ -617,7 +617,7 @@ TRACE2( pMeasurementSRV->hReport, REPORT_SEVERITY_ERROR, ": measure type %d not } /** - * \\n + * \author Ronen Kalish\n * \date 13-November-2005\n * \brief Checks whether a beacon measurement is part of current measurement request * @@ -641,7 +641,7 @@ TI_BOOL measurementSRVIsBeaconMeasureIncluded( TI_HANDLE hMeasurementSRV ) } /** - * \\n + * \author Ronen Kalish\n * \date 15-November-2005\n * \brief Finds the index for the measurement request with the shortest period * (the one that has now completed).\n @@ -685,7 +685,7 @@ TI_INT32 measurementSRVFindMinDuration( TI_HANDLE hMeasurementSRV ) } /** - * \\n + * \author Ronen Kalish\n * \date 15-November-2005\n * \brief Handles an AP discovery timer expiry, by setting necessary values in the * reply struct.\n @@ -711,7 +711,7 @@ TRACE1( pMeasurementSRV->hReport, REPORT_SEVERITY_ERROR, ": status %d received f } /** - * \\n + * \author Ronen Kalish\n * \date 15-November-2005\n * \brief Handles a channel load timer expiry, by requesting channel load * results from the FW.\n @@ -750,7 +750,7 @@ TRACE1( pMeasurementSRV->hReport, REPORT_SEVERITY_ERROR, ": whalCtrl_GetParam re } /** - * \\n + * \author Ronen Kalish\n * \date 15-November-2005\n * \brief Handles a noise histogram timer expiry, by requesting noise histogram * reaults from the FW.\n @@ -810,7 +810,7 @@ TRACE1( pMeasurementSRV->hReport, REPORT_SEVERITY_ERROR, ": whalCtrl_GetParam re } /** - * \\n + * \author Ronen Kalish\n * \date 16-November-2005\n * \brief Callback for channel load get param call.\n * @@ -908,7 +908,7 @@ TRACE1( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, ": Dummy Channel } /** - * \\n + * \author Ronen Kalish\n * \date 16-November-2005\n * \brief Callback for noise histogram get param call.\n * @@ -994,7 +994,7 @@ TRACE1( pMeasurementSRV->hReport, REPORT_SEVERITY_WARNING, ": noise histogram CB } /** - * \\n + * \author Ronen Kalish\n * \date 16-November-2005\n * \brief Checks whether all measuremtn types had completed and all param CBs had been called.\n * @@ -1028,7 +1028,7 @@ TI_BOOL measurementSRVIsMeasurementComplete( TI_HANDLE hMeasurementSRV ) } /** - * \\n + * \author Ronen Kalish\n * \date 17-November-2005\n * \brief Finds a measure type index in the measure request array.\n * diff --git a/wl1271/TWD/MacServices/MeasurementSrv.h b/wl1271/TWD/MacServices/MeasurementSrv.h index 38ae1907..7a852f4e 100644 --- a/wl1271/TWD/MacServices/MeasurementSrv.h +++ b/wl1271/TWD/MacServices/MeasurementSrv.h @@ -33,7 +33,7 @@ /** \file MeasurementSrv.h * \brief This file include private definitions for the Measurement SRV module. - * \ + * \author Ronen Kalish * \date 08-November-2005 */ @@ -181,7 +181,7 @@ typedef struct */ /** - * \\n + * \author Ronen Kalish\n * \date 08-November-2005\n * \brief Creates the measurement SRV object * @@ -192,7 +192,7 @@ typedef struct TI_HANDLE MacServices_measurementSRV_create( TI_HANDLE hOS ); /** - * \\n + * \author Ronen Kalish\n * \date 08-November-2005\n * \brief Initializes the measurement SRV object * @@ -212,7 +212,7 @@ TI_STATUS MacServices_measurementSRV_init (TI_HANDLE hMeasurementSRV, TI_HANDLE hTimer); /** - * \\n + * \author Ronen Kalish\n * \date 08-November-2005\n * \brief Destroys the measurement SRV object * @@ -222,7 +222,7 @@ TI_STATUS MacServices_measurementSRV_init (TI_HANDLE hMeasurementSRV, void MacServices_measurementSRV_destroy( TI_HANDLE hMeasurementSRV ); /** - * \\n + * \author Ronen Kalish\n * \date 13-November-2005\n * \brief Checks whether a beacon measurement is part of current measurement request * @@ -233,7 +233,7 @@ void MacServices_measurementSRV_destroy( TI_HANDLE hMeasurementSRV ); TI_BOOL measurementSRVIsBeaconMeasureIncluded( TI_HANDLE hMeasurementSRV ); /** - * \\n + * \author Ronen Kalish\n * \date 15-November-2005\n * \brief Finds the index for the measurement request with the shortest period * (the one that has now completed).\n @@ -245,7 +245,7 @@ TI_BOOL measurementSRVIsBeaconMeasureIncluded( TI_HANDLE hMeasurementSRV ); TI_INT32 measurementSRVFindMinDuration( TI_HANDLE hMeasurementSRV ); /** - * \\n + * \author Ronen Kalish\n * \date 15-November-2005\n * \brief Handles an AP discovery timer expiry, by setting necessary values in the * reply struct.\n @@ -257,7 +257,7 @@ TI_INT32 measurementSRVFindMinDuration( TI_HANDLE hMeasurementSRV ); void measurementSRVHandleBeaconMsrComplete( TI_HANDLE hMeasurementSRV, TI_INT32 requestIndex ); /** - * \\n + * \author Ronen Kalish\n * \date 15-November-2005\n * \brief Handles a channel load timer expiry, by requesting channel load * results from the FW.\n @@ -269,7 +269,7 @@ void measurementSRVHandleBeaconMsrComplete( TI_HANDLE hMeasurementSRV, TI_INT32 void measurementSRVHandleChannelLoadComplete( TI_HANDLE hMeasurementSRV, TI_INT32 requestIndex ); /** - * \\n + * \author Ronen Kalish\n * \date 15-November-2005\n * \brief Handles a nois histogram timer expiry, by requesting noise histogram * reaults from the FW.\n @@ -281,7 +281,7 @@ void measurementSRVHandleChannelLoadComplete( TI_HANDLE hMeasurementSRV, TI_INT3 void measurementSRVHandleNoiseHistogramComplete( TI_HANDLE hMeasurementSRV, TI_INT32 requestIndex ); /** - * \\n + * \author Ronen Kalish\n * \date 16-November-2005\n * \brief Checks whether all measuremtn types had completed and all param CBs had been called.\n * @@ -293,7 +293,7 @@ void measurementSRVHandleNoiseHistogramComplete( TI_HANDLE hMeasurementSRV, TI_I TI_BOOL measurementSRVIsMeasurementComplete( TI_HANDLE hMeasurementSRV ); /** - * \\n + * \author Ronen Kalish\n * \date 17-November-2005\n * \brief Finds a measure type index in the measure request array.\n * diff --git a/wl1271/TWD/MacServices/MeasurementSrvSM.c b/wl1271/TWD/MacServices/MeasurementSrvSM.c index 278d47f2..e81d41d7 100644 --- a/wl1271/TWD/MacServices/MeasurementSrvSM.c +++ b/wl1271/TWD/MacServices/MeasurementSrvSM.c @@ -33,7 +33,7 @@ /** \file measurementSrv.c * \brief This file include the measurement SRV state machine implementation. - * \ + * \author Ronen Kalish * \date 13-November-2005 */ @@ -55,7 +55,7 @@ static void measurementSRVSM_requestMeasureStartResponseCB(TI_HANDLE hMeasuremen /** - * \\n + * \author Ronen Kalish\n * \date 08-November-2005\n * \brief Initialize the measurement SRV SM.\n * @@ -143,7 +143,7 @@ TI_STATUS measurementSRVSM_init( TI_HANDLE hMeasurementSRV ) } /** - * \\n + * \author Ronen Kalish\n * \date 08-November-2005\n * \brief Processes an event.\n * @@ -176,7 +176,7 @@ TI_STATUS measurementSRVSM_SMEvent( TI_HANDLE hMeasurementSrv, measurements_SRVS } /** - * \\n + * \author Ronen Kalish\n * \date 08-November-2005\n * \brief Handle a MEASURE_START_REQUEST event by requesting driver mode.\n * @@ -237,7 +237,7 @@ TI_STATUS measurementSRVSM_requestDriverMode( TI_HANDLE hMeasurementSRV ) } /** - * \\n + * \author Ronen Kalish\n * \date 08-November-2005\n * \brief Handle a DRIVER_MODE_SUCCESS event by sending start measure command to the FW.\n * @@ -341,7 +341,7 @@ TI_STATUS measurementSRVSM_requestMeasureStart( TI_HANDLE hMeasurementSRV ) } /** - * \\n + * \author Ronen Kalish\n * \date 08-November-2005\n * \brief Handle a START_SUCCESS event by starting different measure types and setting timers.\n * @@ -468,7 +468,7 @@ TI_STATUS measurementSRVSM_startMeasureTypes( TI_HANDLE hMeasurementSRV ) case MSR_TYPE_BEACON_MEASUREMENT: /* set all parameters in the AP discovery command */ - pApDiscoveryParams.scanDuration = pMeasurementSRV->msrRequest.msrTypes[ requestIndex ].duration * 1000; + pApDiscoveryParams.scanDuration = pMeasurementSRV->msrRequest.msrTypes[ requestIndex ].duration * 1000; /* TODO change this to an infinite value (was 0) */ pApDiscoveryParams.numOfProbRqst = 1; pApDiscoveryParams.txdRateSet = HW_BIT_RATE_1MBPS; pApDiscoveryParams.ConfigOptions = RX_CONFIG_OPTION_FOR_MEASUREMENT; @@ -527,7 +527,7 @@ TI_STATUS measurementSRVSM_startMeasureTypes( TI_HANDLE hMeasurementSRV ) } /** - * \\n + * \author Ronen Kalish\n * \date 08-November-2005\n * \brief Handle an ALL_TYPE_COMPLETE event by sending a stop measure command to the FW.\n * @@ -579,7 +579,7 @@ TI_STATUS measurementSRVSM_requestMeasureStop( TI_HANDLE hMeasurementSRV ) } /** - * \\n + * \author Ronen Kalish\n * \date 08-November-2005\n * \brief Handle a STOP_COMPLETE event by exiting driver mode and calling the complete CB.\n * @@ -611,7 +611,7 @@ TI_STATUS measurementSRVSM_completeMeasure( TI_HANDLE hMeasurementSRV ) } /** - * \\n + * \author Ronen Kalish\n * \date 08-November-2005\n * \brief Handle a STOP_REQUEST event when in WAIT_FOR_DRIVER_MODE state by exiting driver mode. * @@ -698,7 +698,7 @@ TI_STATUS measurementSRVSM_stopFromWaitForDriverMode( TI_HANDLE hMeasurementSRV } /** - * \\n + * \author Ronen Kalish\n * \date 27-November-2005\n * \brief handle a STOP_REQUEST event when in WAIT_FOR_DRIVER_MODE by marking negative result status * \brief and calling the ordinary stop function @@ -725,7 +725,7 @@ TI_STATUS measurementSRVSM_stopFromWaitForMeasureStart( TI_HANDLE hMeasurementSR } /** - * \\n + * \author Ronen Kalish\n * \date 08-November-2005\n * \brief handle a STOP_REQUEST event when in MEASURE_IN_PROGRESS by stopping all measure types and * \brief requesting measure stop from the FW.\n @@ -824,7 +824,7 @@ TI_STATUS measurementSRVSM_stopFromMeasureInProgress( TI_HANDLE hMeasurementSRV } /** - * \\n + * \author Ronen Kalish\n * \date 08-November-2005\n * \brief handle a DRIVER_MODE_FAILURE event by calling the response and complete CBs.\n * @@ -877,7 +877,7 @@ TI_STATUS measurementSRVSM_DriverModeFailure( TI_HANDLE hMeasurementSRV ) } /** - * \\n + * \author Ronen Kalish\n * \date 08-November-2005\n * \brief handle a START_FAILURE event by exiting driver mode and calling the complete CB.\n * @@ -980,7 +980,7 @@ TRACE0( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, "***** STOP TIMER /** - * \\n + * \author Ronen Kalish\n * \date 23-December-2005\n * \brief Handles a stop request when no stop is needed (SM is either idle or already send stop command to FW.\n * @@ -1006,7 +1006,7 @@ TI_STATUS measurementSRVSRVSM_dummyStop( TI_HANDLE hMeasurementSrv ) } /** - * \\n + * \author Ronen Kalish\n * \date 17-November-2005\n * \brief Handles an unexpected event.\n * @@ -1048,7 +1048,7 @@ TI_STATUS actionUnexpected( TI_HANDLE hMeasurementSrv ) } /** - * \\n + * \author Ronen Kalish\n * \date 10-Jan-2005\n * \brief Handles an event that doesn't require any action.\n * diff --git a/wl1271/TWD/MacServices/MeasurementSrvSM.h b/wl1271/TWD/MacServices/MeasurementSrvSM.h index f17cbc3e..6c502e98 100644 --- a/wl1271/TWD/MacServices/MeasurementSrvSM.h +++ b/wl1271/TWD/MacServices/MeasurementSrvSM.h @@ -33,7 +33,7 @@ /** \file MeasurementSrv.h * \brief This file include private definitions for the Measurement SRV state machine. - * \ + * \author Ronen Kalish * \date 08-November-2005 */ @@ -110,7 +110,7 @@ typedef enum */ /** - * \\n + * \author Ronen Kalish\n * \date 08-November-2005\n * \brief Initialize the measurement SRV SM.\n * @@ -121,7 +121,7 @@ typedef enum TI_STATUS measurementSRVSM_init( TI_HANDLE hMeasurementSRV ); /** - * \\n + * \author Ronen Kalish\n * \date 08-November-2005\n * \brief Processes an event.\n * @@ -135,7 +135,7 @@ TI_STATUS measurementSRVSM_SMEvent( TI_HANDLE hMeasurementSrv, measurements_SRVS measurement_SRVSMEvents_e event ); /** - * \\n + * \author Ronen Kalish\n * \date 08-November-2005\n * \brief Handle a MEASURE_START_REQUEST event by requesting driver mode.\n * @@ -146,7 +146,7 @@ TI_STATUS measurementSRVSM_SMEvent( TI_HANDLE hMeasurementSrv, measurements_SRVS TI_STATUS measurementSRVSM_requestDriverMode( TI_HANDLE hMeasurementSRV ); /** - * \\n + * \author Ronen Kalish\n * \date 08-November-2005\n * \brief Handle a DRIVER_MODE_SUCCESS event by sending start measure command to the FW.\n * @@ -157,7 +157,7 @@ TI_STATUS measurementSRVSM_requestDriverMode( TI_HANDLE hMeasurementSRV ); TI_STATUS measurementSRVSM_requestMeasureStart( TI_HANDLE hMeasurementSRV ); /** - * \\n + * \author Ronen Kalish\n * \date 08-November-2005\n * \brief Handle a START_SUCCESS event by starting different measure types and setting timers.\n * @@ -168,7 +168,7 @@ TI_STATUS measurementSRVSM_requestMeasureStart( TI_HANDLE hMeasurementSRV ); TI_STATUS measurementSRVSM_startMeasureTypes( TI_HANDLE hMeasurementSRV ); /** - * \\n + * \author Ronen Kalish\n * \date 08-November-2005\n * \brief Handle an ALL_TYPE_COMPLETE event by sending a stop measure command to the FW.\n * @@ -179,7 +179,7 @@ TI_STATUS measurementSRVSM_startMeasureTypes( TI_HANDLE hMeasurementSRV ); TI_STATUS measurementSRVSM_requestMeasureStop( TI_HANDLE hMeasurementSRV ); /** - * \\n + * \author Ronen Kalish\n * \date 08-November-2005\n * \brief Handle a STOP_COMPLETE event by exiting driver mode and calling the complete CB.\n * @@ -190,7 +190,7 @@ TI_STATUS measurementSRVSM_requestMeasureStop( TI_HANDLE hMeasurementSRV ); TI_STATUS measurementSRVSM_completeMeasure( TI_HANDLE hMeasurementSRV ); /** - * \\n + * \author Ronen Kalish\n * \date 08-November-2005\n * \brief Handle a STOP_REQUEST event when in WAIT_FOR_DRIVER_MODE state by exiting driver mode. * @@ -201,7 +201,7 @@ TI_STATUS measurementSRVSM_completeMeasure( TI_HANDLE hMeasurementSRV ); TI_STATUS measurementSRVSM_stopFromWaitForDriverMode( TI_HANDLE hMeasurementSRV ); /** - * \\n + * \author Ronen Kalish\n * \date 27-November-2005\n * \brief handle a STOP_REQUEST event when in WAIT_FOR_DRIVER_MODE by marking negative result status * \brief and callin the ordinary stop function @@ -213,7 +213,7 @@ TI_STATUS measurementSRVSM_stopFromWaitForDriverMode( TI_HANDLE hMeasurementSRV TI_STATUS measurementSRVSM_stopFromWaitForMeasureStart( TI_HANDLE hMeasurementSRV ); /** - * \\n + * \author Ronen Kalish\n * \date 08-November-2005\n * \brief handle a STOP_REQUEST event when in MEASURE_IN_PROGRESS by stopping all measure types and * \brief requesting measure stop from the FW.\n @@ -225,7 +225,7 @@ TI_STATUS measurementSRVSM_stopFromWaitForMeasureStart( TI_HANDLE hMeasurementSR TI_STATUS measurementSRVSM_stopFromMeasureInProgress( TI_HANDLE hMeasurementSRV ); /** - * \\n + * \author Ronen Kalish\n * \date 08-November-2005\n * \brief handle a DRIVER_MODE_FAILURE event by calling the response CB.\n * @@ -236,7 +236,7 @@ TI_STATUS measurementSRVSM_stopFromMeasureInProgress( TI_HANDLE hMeasurementSRV TI_STATUS measurementSRVSM_DriverModeFailure( TI_HANDLE hMeasurementSRV ); /** - * \\n + * \author Ronen Kalish\n * \date 08-November-2005\n * \brief handle a START_FAILURE event by exiting driver mode and calling the complete CB.\n * @@ -247,7 +247,7 @@ TI_STATUS measurementSRVSM_DriverModeFailure( TI_HANDLE hMeasurementSRV ); TI_STATUS measurementSRVSM_measureStartFailure( TI_HANDLE hMeasurementSRV ); /** - * \\n + * \author Ronen Kalish\n * \date 23-December-2005\n * \brief Handles a stop request when no stop is needed (SM is either idle or already send stop command to FW.\n * diff --git a/wl1271/TWD/MacServices/PowerSrv.c b/wl1271/TWD/MacServices/PowerSrv.c index e7fb5822..71c33ac6 100644 --- a/wl1271/TWD/MacServices/PowerSrv.c +++ b/wl1271/TWD/MacServices/PowerSrv.c @@ -33,7 +33,7 @@ /** \file powerSrv.c * \brief This is the powerSrv module implementation. - * \ + * \author Assaf Azulay * \date 19-Oct-2005 */ diff --git a/wl1271/TWD/MacServices/PowerSrv.h b/wl1271/TWD/MacServices/PowerSrv.h index 243fae0b..b5f19da9 100644 --- a/wl1271/TWD/MacServices/PowerSrv.h +++ b/wl1271/TWD/MacServices/PowerSrv.h @@ -33,7 +33,7 @@ /** \file powerSrv.h * \brief This is the Power Manager module private (internal). - * \ + * \author Yaron Menashe * \date 27-Apr-2004 */ diff --git a/wl1271/TWD/MacServices/PowerSrvSM.c b/wl1271/TWD/MacServices/PowerSrvSM.c index 808ab223..173a080f 100644 --- a/wl1271/TWD/MacServices/PowerSrvSM.c +++ b/wl1271/TWD/MacServices/PowerSrvSM.c @@ -33,7 +33,7 @@ /** \file PowerSrvSM.c * \brief This is the PowerSrvSM module implementation. - * \ + * \author Assaf Azulay * \date 19-OCT-2005 */ diff --git a/wl1271/TWD/MacServices/PowerSrvSM.h b/wl1271/TWD/MacServices/PowerSrvSM.h index 933694e0..97464ac8 100644 --- a/wl1271/TWD/MacServices/PowerSrvSM.h +++ b/wl1271/TWD/MacServices/PowerSrvSM.h @@ -33,7 +33,7 @@ /** \file PowerSrvSM.h * \brief This is the PowerSrv module API. - * \ + * \author Assaf Azulay * \date 6-Oct-2005 */ @@ -143,7 +143,7 @@ typedef struct *****************************************************************************/ /** - * \ + * \author Assaf Azulay * \date 6-Oct-2005\n * \brief Creates the object of the PowerSrv. * @@ -155,7 +155,7 @@ typedef struct TI_HANDLE powerSrvSM_create(TI_HANDLE hOsHandle); /** - * \ + * \author Assaf Azulay * \date 6-Oct-2005\n * \brief Destroy the object of the PowerSrvSM. * @@ -167,7 +167,7 @@ TI_HANDLE powerSrvSM_create(TI_HANDLE hOsHandle); TI_STATUS powerSrvSM_destroy(TI_HANDLE thePowerSrvSMHandle); /** - * \ + * \author Assaf Azulay * \date 6-Oct-2005\n * \brief Initialize the PowerSrvSM module. * @@ -187,7 +187,7 @@ TI_STATUS powerSrvSM_init (TI_HANDLE hPowerSrvSM, TI_STATUS powerSrvSM_config(TI_HANDLE hPowerSrvSM, TPowerSrvInitParams *pPowerSrvInitParams); /** - * \ + * \author Assaf Azulay * \date 6-Oct-2005\n * \brief return the component version. * @@ -202,7 +202,7 @@ TI_STATUS powerSrvSM_SMApi(TI_HANDLE hPowerSrvSM, /** - * \ + * \author Assaf Azulay * \date 020-Oct-2005\n * \brief This function sets the current SM working request.\n * @@ -217,7 +217,7 @@ TI_STATUS powerSrvSm_setSmRequest(TI_HANDLE hPowerSrvSM,powerSrvRequest_t* pSmRe /** - * \ + * \author Assaf Azulay * \date 09-Jun-2004\n * \brief get the current state of the state machine. * @@ -230,7 +230,7 @@ PowerSrvSMStates_e powerSrvSM_getCurrentState(TI_HANDLE hPowerSrvSM); /** - * \ + * \author Assaf Azulay * \date 20-July-2004\n * \brief sets rate modulation * @@ -253,7 +253,7 @@ void powerSrvSM_setRateModulation(TI_HANDLE hPowerSrvSM, TI_UINT16 rateModulatio TI_UINT32 powerSrvSM_getRateModulation(TI_HANDLE hPowerSrvSM); /** - * \ + * \author Assaf Azulay * \date 20-July-2004\n * \brief print configuration of the PowerSrvSM object - use for debug! * @@ -265,7 +265,7 @@ TI_UINT32 powerSrvSM_getRateModulation(TI_HANDLE hPowerSrvSM); void powerSrvSM_printObject(TI_HANDLE hPowerSrvSM); /** - * \ + * \author Ronen Kalish * \date 21-August-2006\n * \brief Registers a failure event callback for power save error notifications (timer expiry).\n * diff --git a/wl1271/TWD/MacServices/PowerSrv_API.h b/wl1271/TWD/MacServices/PowerSrv_API.h index 10eace2d..9aca40e0 100644 --- a/wl1271/TWD/MacServices/PowerSrv_API.h +++ b/wl1271/TWD/MacServices/PowerSrv_API.h @@ -33,7 +33,7 @@ /** \file powerSrv_API.h * \brief This is the Power Manager module API. - * \ + * \author Yaron Menashe */ /**************************************************************************** @@ -89,7 +89,7 @@ typedef TPowerSaveCompleteCb powerSaveCmpltCB_t; /** - * \ + * \author Assaf Azulay * \date 20-Oct-2005\n * \brief Creates the object of the power Server. * @@ -102,7 +102,7 @@ TI_HANDLE powerSrv_create(TI_HANDLE hOs); /** - * \ + * \author Assaf Azulay * \date 27-Apr-2005\n * \brief Destroy the object of the power Server. * @@ -115,7 +115,7 @@ TI_STATUS powerSrv_destroy(TI_HANDLE hPowerSrv); /** - * \ + * \author Assaf Azulay * \date 24-Oct-2005\n * \brief Initialization of the powerSrv module. * @@ -139,7 +139,7 @@ TI_STATUS powerSrv_config(TI_HANDLE hPowerSrv, TPowerSrvInitParams *pPowerSrvInitParams); /** - * \ + * \author Assaf Azulay * \date 24-Oct-2005\n * \brief request PS by User * @@ -166,7 +166,7 @@ TI_STATUS powerSrv_SetPsMode (TI_HANDLE hPowerSrv, /** - * \ + * \author Assaf Azulay * \date 24-Oct-2005\n * \brief SW configure, use to override the current PowerMode (what ever it will be) to * active/PS combined with awake/power-down. use for temporary change the system policy. @@ -198,7 +198,7 @@ TI_STATUS powerSrv_ReservePS (TI_HANDLE hPowerSrv, /** - * \ + * \author Assaf Azulay * \date 24-Oct-2005\n * \brief end the temporary change of system policy, and returns to the user system policy. * @@ -220,7 +220,7 @@ TI_STATUS powerSrv_ReleasePS( TI_HANDLE hPowerSrv, /** - * \ + * \author Assaf Azulay * \date 24-Oct-2005\n * \brief reflects the actual state of the state machine * @@ -234,7 +234,7 @@ TI_BOOL powerSrv_getPsStatus(TI_HANDLE hPowerSrv); /** - * \ + * \author Assaf Azulay * \date 24-Oct-2005\n * \sets the rate as got from user else sets default value.\n * @@ -250,7 +250,7 @@ void powerSrv_SetRateModulation(TI_HANDLE hPowerSrv, TI_UINT16 rate); /** - * \ + * \author Assaf Azulay * \date 9-Mar-2006\n * \brief Registers a failure event callback for scan error notifications. * diff --git a/wl1271/TWD/MacServices/ScanSrvSM.c b/wl1271/TWD/MacServices/ScanSrvSM.c index e984bfba..8d96feaa 100644 --- a/wl1271/TWD/MacServices/ScanSrvSM.c +++ b/wl1271/TWD/MacServices/ScanSrvSM.c @@ -33,7 +33,7 @@ /** \file ScanSrvSM.c * \brief This file include the scan SRV Sm implementation - * \ + * \author Ronen Kalish * \date 10-Jan-2005 */ @@ -62,7 +62,7 @@ static TI_STATUS actionUnexpected( TI_HANDLE hScanSrv ); /** - * \\n + * \author Ronen Kalish\n * \date 10-Jan-2005\n * \brief Initialize the scan SRV SM. * @@ -150,7 +150,7 @@ TI_STATUS scanSRVSM_init( TI_HANDLE hScanSrv ) } /** - * \\n + * \author Ronen Kalish\n * \date 10-Jan-2005\n * \brief Processes an event. * @@ -182,7 +182,7 @@ TI_STATUS scanSRVSM_SMEvent( TI_HANDLE hScanSrv, scan_SRVSMStates_e* currentStat } /** - * \\n + * \author Ronen Kalish\n * \date 10-Jan-2005\n * \brief Request to enter driver mode from the power manager module.\n * @@ -247,7 +247,7 @@ TI_STATUS scanSRVSM_requestPS( TI_HANDLE hScanSrv ) } /** - * \\n + * \author Yuval Adler\n * \date 6-Oct-2005\n * \brief Request to release PS mode from the PowerSRV , and wait for answer.\n\n * @@ -315,7 +315,7 @@ TI_STATUS scanSRVSM_releasePS( TI_HANDLE hScanSrv ) } /** - * \\n + * \author Ronen Kalish\n * \date 10-Jan-2005\n * \brief Send the scan command to the firmware.\n * @@ -365,7 +365,7 @@ TI_STATUS scanSRVSM_startActualScan( TI_HANDLE hScanSrv ) /** - * \\n + * \author Ronen Kalish\n * \date 10-Jan-2005\n * \brief Notifies scan complete to upper layer.\n * @@ -419,7 +419,7 @@ TI_STATUS scanSRVSM_notifyScanComplete( TI_HANDLE hScanSrv ) /** - * \\n + * \author Ronen Kalish\n * \date 10-Jan-2005\n * \brief Handles a timer expiry event - starts a recovery process. * @@ -432,9 +432,12 @@ TI_STATUS scanSRVSM_handleTimerExpiry( TI_HANDLE hScanSrv ) scanSRV_t *pScanSRV = (scanSRV_t*)hScanSrv; /* - No scan complete event will trigger recovery only after a consecutive configurable number of - no scan complete events occurred. + * No scan complete bug workaround: + * Only after a consecutive configurable number of no scan complete events the recovery trigger + * will be issued. This is done as a workaround for a bug in the FW where if a channel is too + * loaded it wouldn't be able to send a probe request and will get stuck waiting for this channel */ + pScanSRV->currentNumberOfConsecutiveNoScanCompleteEvents++; if ( pScanSRV->currentNumberOfConsecutiveNoScanCompleteEvents >= @@ -477,7 +480,7 @@ TI_STATUS scanSRVSM_handleTimerExpiry( TI_HANDLE hScanSrv ) } /** - * \\n + * \author Shirit Brook\n * \date 10-Jan-2005\n * \brief Handles PS Fail event while in Scanning - Indicate not to Exit PS. * This event can be reached when Roaming is invoked while in Scanning state. @@ -500,7 +503,7 @@ static TI_STATUS scanSRVSM_PsFailWhileScanning( TI_HANDLE hScanSrv ) /** - * \\n + * \author Ronen Kalish\n * \date 17-Jan-2005\n * \brief Handles a FW reset event (one that was detected outside the scan SRV) by stopping the timer. * @@ -533,7 +536,7 @@ TI_STATUS scanSRVSM_handleRecovery( TI_HANDLE hScanSrv ) } /** - * \\n + * \author Ronen Kalish\n * \date 11-Jan-2005\n * \brief Handles an unexpected event.\n * @@ -565,7 +568,7 @@ static TI_STATUS actionUnexpected( TI_HANDLE hScanSrv ) } /** - * \\n + * \author Ronen Kalish\n * \date 10-Jan-2005\n * \brief Handles an event that doesn't require any action.\n * diff --git a/wl1271/TWD/MacServices/ScanSrvSM.h b/wl1271/TWD/MacServices/ScanSrvSM.h index 0b995f25..0b87e9fe 100644 --- a/wl1271/TWD/MacServices/ScanSrvSM.h +++ b/wl1271/TWD/MacServices/ScanSrvSM.h @@ -33,7 +33,7 @@ /** \file ScanSrvSM.h * \brief This file include definitions for the scan SRV SM module. - * \ + * \author Ronen Kalish * \date 10-Jan-2005 */ @@ -108,7 +108,7 @@ typedef enum */ /** - * \\n + * \author Ronen Kalish\n * \date 10-Jan-2005\n * \brief Initialize the scan SRV SM. * @@ -119,7 +119,7 @@ typedef enum TI_STATUS scanSRVSM_init( TI_HANDLE hScanSrv ); /** - * \\n + * \author Ronen Kalish\n * \date 10-Jan-2005\n * \brief Processes an event. * @@ -133,7 +133,7 @@ TI_STATUS scanSRVSM_SMEvent( TI_HANDLE hScanSrv, scan_SRVSMStates_e* currentStat scan_SRVSMEvents_e event ); /** - * \\n + * \author Ronen Kalish\n * \date 10-Jan-2005\n * \brief Request to enter driver mode from the power manager module.\n * @@ -144,7 +144,7 @@ TI_STATUS scanSRVSM_SMEvent( TI_HANDLE hScanSrv, scan_SRVSMStates_e* currentStat TI_STATUS scanSRVSM_requestPS( TI_HANDLE hScanSrv ); /** - * \\n + * \author Yuval Adler\n * \date 6-Oct-2005\n * \brief Request to release PS mode from the PowerSRV , and wait for answer.\n * @@ -155,7 +155,7 @@ TI_STATUS scanSRVSM_requestPS( TI_HANDLE hScanSrv ); TI_STATUS scanSRVSM_releasePS( TI_HANDLE hScanSrv ); /** - * \\n + * \author Ronen Kalish\n * \date 10-Jan-2005\n * \brief Send the scan command to the firmware.\n * @@ -166,7 +166,7 @@ TI_STATUS scanSRVSM_releasePS( TI_HANDLE hScanSrv ); TI_STATUS scanSRVSM_startActualScan( TI_HANDLE hScanSrv ); /** - * \\n + * \author Ronen Kalish\n * \date 10-Jan-2005\n * \brief Send a stop scan command to the firmware.\n * @@ -177,7 +177,7 @@ TI_STATUS scanSRVSM_startActualScan( TI_HANDLE hScanSrv ); TI_STATUS scanSRVSM_stopActualScan( TI_HANDLE hScanSrv ); /** - * \\n + * \author Ronen Kalish\n * \date 10-Jan-2005\n * \brief Notifies scan complete to upper layer.\n * @@ -188,7 +188,7 @@ TI_STATUS scanSRVSM_stopActualScan( TI_HANDLE hScanSrv ); TI_STATUS scanSRVSM_notifyScanComplete( TI_HANDLE hScanSrv ); /** - * \\n + * \author Ronen Kalish\n * \date 10-Jan-2005\n * \brief Handles a timer expiry event - starts a recovery process. * @@ -199,7 +199,7 @@ TI_STATUS scanSRVSM_notifyScanComplete( TI_HANDLE hScanSrv ); TI_STATUS scanSRVSM_handleTimerExpiry( TI_HANDLE hScanSrv ); /** - * \\n + * \author Ronen Kalish\n * \date 17-Jan-2005\n * \brief Handles a FW reset event (one that was detected outside the scan SRV) by stopping the timer. * diff --git a/wl1271/TWD/MacServices/measurementSrvDbgPrint.c b/wl1271/TWD/MacServices/measurementSrvDbgPrint.c index 7e73c1ba..aef32631 100644 --- a/wl1271/TWD/MacServices/measurementSrvDbgPrint.c +++ b/wl1271/TWD/MacServices/measurementSrvDbgPrint.c @@ -33,7 +33,7 @@ /** \file measurementSrvDbgPrint.c * \brief This file include variuos measurement SRV debug print facilities - * \ + * \author Ronen Kalish * \date 23-December-2005 */ @@ -46,7 +46,7 @@ /** - * \\n + * \author Ronen Kalish\n * \date 23-December-2005\n * \brief Prints a measurement request.\n * @@ -71,7 +71,7 @@ TRACE5( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, "band: %d, channe } /** - * \\n + * \author Ronen Kalish\n * \date 23-December-2005\n * \brief Prints a measurement type request.\n * diff --git a/wl1271/TWD/TWDriver/TWDriver.c b/wl1271/TWD/TWDriver/TWDriver.c index 7ef3b657..59787ad6 100644 --- a/wl1271/TWD/TWDriver/TWDriver.c +++ b/wl1271/TWD/TWDriver/TWDriver.c @@ -1834,4 +1834,3 @@ void TWD_FinalizePolarityRead(TI_HANDLE hTWD) /* allways read FEM type from Radio Registers */ hwInit_ReadRadioParams(pTWD->hHwInit); } - diff --git a/wl1271/TWD/TWDriver/TWDriver.h b/wl1271/TWD/TWDriver/TWDriver.h index a3a9042d..23182e9b 100644 --- a/wl1271/TWD/TWDriver/TWDriver.h +++ b/wl1271/TWD/TWDriver/TWDriver.h @@ -516,7 +516,6 @@ typedef enum * \sa TKeepAliveParams * */ - typedef enum { KEEP_ALIVE_TRIG_TYPE_NO_TX = 0, /**< */ @@ -2638,9 +2637,6 @@ typedef struct } TScanSrvInitParams; - - - /** \struct TArpIpFilterInitParams * \brief ARP IP Filter Init Parameters * @@ -4457,7 +4453,6 @@ TI_STATUS TWD_CfgSetFwHtInformation (TI_HANDLE hTWD, Tdot11HtInformationUnparse */ TI_STATUS TWD_CfgBurstMode (TI_HANDLE hTWD, TI_BOOL bEnabled); - /*-------------*/ /* Interrogate */ /*-------------*/ diff --git a/wl1271/TWD/TWDriver/TWDriverCtrl.c b/wl1271/TWD/TWDriver/TWDriverCtrl.c index 05a716b7..1707fda6 100644 --- a/wl1271/TWD/TWDriver/TWDriverCtrl.c +++ b/wl1271/TWD/TWDriver/TWDriverCtrl.c @@ -921,5 +921,3 @@ ETxnStatus TWD_WdExpireEvent(TI_HANDLE hTWD) return TXN_STATUS_COMPLETE; } - - diff --git a/wl1271/TWD/TWDriver/TWDriverInternal.h b/wl1271/TWD/TWDriver/TWDriverInternal.h index 368840b0..5e5a82b6 100644 --- a/wl1271/TWD/TWDriver/TWDriverInternal.h +++ b/wl1271/TWD/TWDriver/TWDriverInternal.h @@ -47,6 +47,7 @@ #include "TWDriver.h" #include "Device.h" + /* Shift factor to conver between TU (1024 uSec) and uSec. */ #define SHIFT_BETWEEN_TU_AND_USEC 10 @@ -147,6 +148,7 @@ typedef struct void *pRadioCb; TI_HANDLE hRadioCb; TTestCmd testCmd; + } TTwd; diff --git a/wl1271/TWD/TwIf/TwIf.c b/wl1271/TWD/TwIf/TwIf.c index 6abc89b5..08565de2 100644 --- a/wl1271/TWD/TwIf/TwIf.c +++ b/wl1271/TWD/TwIf/TwIf.c @@ -69,8 +69,11 @@ /* * Device interface-control registers addresses (at the end ot the 17-bit address space): */ -#define PARTITION_REGISTERS_ADDR (0x1FFC0) /* Start address of the chip memory regions partition (see also HwInit) */ - /* 4 couples of registers: region start address & region size */ +#define PARTITION_REGISTERS_ADDR (0x1FFC0) /* Four 32 bit register: */ + /* Memory region size (0x1FFC0) */ + /* Memory region base address (0x1FFC4) */ + /* Registers region size (0x1FFC8) */ + /* Registers region base address (0x1FFCC) */ #define ELP_CTRL_REG_ADDR (0x1FFFC) /* ELP control register address */ @@ -192,7 +195,6 @@ static void twIf_ClearTxnDoneQueue (TI_HANDLE hTwIf); static void twIf_PendRestratTimeout (TI_HANDLE hTwIf, TI_BOOL bTwdInitOccured); - /************************************************************************ * * Module functions implementation @@ -257,7 +259,6 @@ TI_STATUS twIf_Destroy (TI_HANDLE hTwIf) } os_memoryFree (pTwIf->hOs, pTwIf, sizeof(TTwIfObj)); } - return TI_OK; } @@ -429,7 +430,6 @@ void twIf_RegisterErrCb (TI_HANDLE hTwIf, void *fErrCb, TI_HANDLE hErrCb) static void twIf_WriteElpReg (TTwIfObj *pTwIf, TI_UINT32 uValue) { TRACE1(pTwIf->hReport, REPORT_SEVERITY_INFORMATION, "twIf_WriteElpReg: ELP Txn data = 0x%x\n", uValue); - /* Send ELP (awake or sleep) transaction to TxnQ */ if (uValue == ELP_CTRL_REG_AWAKE) { @@ -716,16 +716,15 @@ ETxnStatus twIf_TransactReadFWStatus (TI_HANDLE hTwIf, TTxnStruct *pTxn) static ETxnStatus twIf_SendTransaction (TTwIfObj *pTwIf, TTxnStruct *pTxn) { ETxnStatus eStatus; - TI_UINT32 data=0; - #ifdef TI_DBG + TI_UINT32 data = 0; + /* Verify that the Txn HW-Address is 4-bytes aligned */ - if (pTxn->uHwAddr & 0x3) - { -TRACE2(pTwIf->hReport, REPORT_SEVERITY_ERROR, "twIf_SendTransaction: Unaligned HwAddr! HwAddr=0x%x, Params=0x%x\n", pTxn->uHwAddr, pTxn->uTxnParams); + if (pTxn->uHwAddr & 0x3) + { + TRACE2(pTwIf->hReport, REPORT_SEVERITY_ERROR, "twIf_SendTransaction: Unaligned HwAddr! HwAddr=0x%x, Params=0x%x\n", pTxn->uHwAddr, pTxn->uTxnParams); return TXN_STATUS_ERROR; - } - + } #endif context_EnterCriticalSection (pTwIf->hContext); @@ -1113,7 +1112,8 @@ TI_BOOL twIf_isValidRegAddr(TI_HANDLE hTwIf, TI_UINT32 Address, TI_UINT32 Length */ void twIf_PrintModuleInfo (TI_HANDLE hTwIf) { - TTwIfObj *pTwIf = (TTwIfObj*)hTwIf; +#ifdef REPORT_LOG + TTwIfObj *pTwIf = (TTwIfObj*)hTwIf; WLAN_OS_REPORT(("-------------- TwIf Module Info-- ------------------------\n")); WLAN_OS_REPORT(("==========================================================\n")); @@ -1134,6 +1134,7 @@ void twIf_PrintModuleInfo (TI_HANDLE hTwIf) WLAN_OS_REPORT(("uDbgCountTxnComplete = %d\n", pTwIf->uDbgCountTxnComplete )); WLAN_OS_REPORT(("uDbgCountTxnDone = %d\n", pTwIf->uDbgCountTxnDoneCb )); WLAN_OS_REPORT(("==========================================================\n\n")); +#endif } @@ -1144,9 +1145,4 @@ void twIf_PrintQueues (TI_HANDLE hTwIf) txnQ_PrintQueues(pTwIf->hTxnQ); } - #endif /* TI_DBG */ - - - - diff --git a/wl1271/Test/TWD_Debug.c b/wl1271/Test/TWD_Debug.c index 9493d8dc..63a93584 100644 --- a/wl1271/Test/TWD_Debug.c +++ b/wl1271/Test/TWD_Debug.c @@ -212,7 +212,7 @@ static void TWD_PrintMemRegs (TI_HANDLE hTWD, TI_UINT32 address, TI_UINT32 len, static TI_STATUS TWD_PrintMemoryMapCb (TI_HANDLE hTWD, TI_STATUS status, void *pData) { -#ifdef TI_DBG +#ifdef REPORT_LOG TTwd *pTWD = (TTwd *)hTWD; MemoryMap_t *pMemMap = &pTWD->MemMap; @@ -232,7 +232,7 @@ static TI_STATUS TWD_PrintMemoryMapCb (TI_HANDLE hTWD, TI_STATUS status, void *p pMemMap->packetMemoryPoolEnd, pMemMap->debugBuffer1Start, pMemMap->debugBuffer2Start)); -#endif /* TI_DBG */ +#endif return TI_OK; } @@ -622,13 +622,14 @@ static TI_STATUS TWD_StatisticsReadCB (TI_HANDLE hTWD, TI_UINT16 MboxStatus, ACX TI_STATUS TWD_Debug (TI_HANDLE hTWD, TI_UINT32 funcType, void *pParam) { - TTwd *pTWD = (TTwd *)hTWD; + TTwd *pTWD = (TTwd *)hTWD; TI_UINT32 GenericVal; - TFwDebugParams* pMemDebug = (TFwDebugParams*)pParam; + TFwDebugParams* pMemDebug = (TFwDebugParams*)pParam; static TI_UINT32 GenericAddr; - static int iStart[100]; - +#ifdef REPORT_LOG + static int iStart[100]; /* Note: it is not used properly anyway */ +#endif /* check paramemters validity */ if (pMemDebug == NULL) { diff --git a/wl1271/Test/connDebug.c b/wl1271/Test/connDebug.c index 76309eb1..9136c4e4 100644 --- a/wl1271/Test/connDebug.c +++ b/wl1271/Test/connDebug.c @@ -51,10 +51,13 @@ #include "connApi.h" #include "report.h" +#ifdef REPORT_LOG void printConnDbgFunctions(void); +#endif void connDebugSetParam(TI_HANDLE hConn, TI_UINT32 paramType, TI_UINT32 *value) { +#ifdef REPORT_LOG conn_t *pConn = (conn_t *)hConn; switch (paramType) @@ -63,10 +66,12 @@ void connDebugSetParam(TI_HANDLE hConn, TI_UINT32 paramType, TI_UINT32 *value) WLAN_OS_REPORT(("Invalid param type in Set Debug Connection command: %d, curr state %d\n\n", value, pConn->state)); break; } +#endif } void connDebugGetParam(TI_HANDLE hConn, TI_UINT32 paramType, TI_UINT32 *value) { +#ifdef REPORT_LOG conn_t *pConn = (conn_t *)hConn; switch (paramType) @@ -75,12 +80,14 @@ void connDebugGetParam(TI_HANDLE hConn, TI_UINT32 paramType, TI_UINT32 *value) WLAN_OS_REPORT(("Invalid param type in Get Debug Connection command: %d, curr state %d\n\n", value, pConn->state)); break; } +#endif } void connDebugFunction(TI_HANDLE hConn, TI_UINT32 funcType, void *pParam) { +#ifdef REPORT_LOG conn_t *pConn = (conn_t *)hConn; switch (funcType) @@ -97,14 +104,15 @@ void connDebugFunction(TI_HANDLE hConn, WLAN_OS_REPORT(("Invalid function type in Debug Connection Function Command: %d\n\n", funcType)); break; } +#endif } void printConnDbgFunctions(void) { +#ifdef REPORT_LOG WLAN_OS_REPORT((" Conn Dbg Functions \n")); WLAN_OS_REPORT(("----------------------\n")); WLAN_OS_REPORT(("601 - Connection Print Test.\n")); +#endif } - - diff --git a/wl1271/Test/dataCtrlDbg.h b/wl1271/Test/dataCtrlDbg.h index f062f46b..17372304 100644 --- a/wl1271/Test/dataCtrlDbg.h +++ b/wl1271/Test/dataCtrlDbg.h @@ -57,7 +57,6 @@ typedef enum /* 23 */ RESET_TX_MGMT_QUEUE_COUNTERS, /* 24 */ RESET_TX_RESULT_COUNTERS, /* 25 */ RESET_TX_XFER_COUNTERS, - /* Rx debug functions */ /* 50 */ PRINT_RX_BLOCK = 50, diff --git a/wl1271/Test/fwdriverdebug.c b/wl1271/Test/fwdriverdebug.c index 759791c9..c7f1ba32 100644 --- a/wl1271/Test/fwdriverdebug.c +++ b/wl1271/Test/fwdriverdebug.c @@ -263,8 +263,8 @@ void sendDataPacket (TI_HANDLE hOs) void sendMgmtPacket(TI_HANDLE hOs) { + static TI_UINT8 aMsg[2000]; TI_UINT32 i; - TI_UINT8 aMsg[2000]; dot11MgmtSubType_e eMsgType = DE_AUTH; for (i = 0; i < packetLength; i++) diff --git a/wl1271/Test/measurementDbg.c b/wl1271/Test/measurementDbg.c index fb454f6a..9e0566b3 100644 --- a/wl1271/Test/measurementDbg.c +++ b/wl1271/Test/measurementDbg.c @@ -82,18 +82,20 @@ RETURN: ************************************************************************/ void measurementDebugFunction(TI_HANDLE hMeasurementMgr, TI_HANDLE hSwitchChannel, TI_HANDLE hRegulatoryDomain, TI_UINT32 funcType, void *pParam) { - paramInfo_t param; + paramInfo_t param; #ifdef XCC_MODULE_INCLUDED TTwdParamInfo tTwdParam; #endif - TI_STATUS status = TI_OK; + TI_STATUS status = TI_OK; TI_UINT8 rangeUpperBound; TI_UINT8 rangeIndex; TI_UINT16 trafficThreshold; TNoiseHistogram pNoiseHistParams; - measurementMgr_t * pMeasurementMgr = (measurementMgr_t *) hMeasurementMgr; - TI_UINT8 SwitchChannelParam = *(TI_UINT8*)pParam; - siteMgr_t *pSiteMgr = (siteMgr_t *) pMeasurementMgr->hSiteMgr; + measurementMgr_t * pMeasurementMgr = (measurementMgr_t *) hMeasurementMgr; + TI_UINT8 SwitchChannelParam = *(TI_UINT8*)pParam; +#ifdef REPORT_LOG + siteMgr_t *pSiteMgr = (siteMgr_t *) pMeasurementMgr->hSiteMgr; +#endif #ifdef XCC_MODULE_INCLUDED TI_UINT8 iappPacket[90] = {0xAA, 0xAA, 0x03, 0x00, 0x40, 0x96, 0x00, 0x00, 0x00, 0x20, 0x32, 0x01, @@ -409,10 +411,12 @@ void measurementDebugFunction(TI_HANDLE hMeasurementMgr, TI_HANDLE hSwitchChanne void measurement_channelLoadCallBackDbg(TI_HANDLE hMeasurementMgr, TI_STATUS status, TI_UINT8* CB_buf) { +#ifdef REPORT_LOG TMediumOccupancy *pMediumOccupancy = (TMediumOccupancy*)(CB_buf+4); WLAN_OS_REPORT(("MediumUsage = %d\nPeriod = %d\n", - pMediumOccupancy->MediumUsage/1000, pMediumOccupancy->Period/1000)); + pMediumOccupancy->MediumUsage/1000, pMediumOccupancy->Period/1000)); +#endif } void measurement_noiseHistCallBackDbg(TI_HANDLE hMeasurementSRV, TI_STATUS status, @@ -440,27 +444,6 @@ void measurement_noiseHistCallBackDbg(TI_HANDLE hMeasurementSRV, TI_STATUS statu WLAN_OS_REPORT(("Measurement Debug Functions - Interogate Noise Hist FAILED")); } } - - - - - - - - - - - - - - - - - - - - - void printMeasurementDbgFunctions(void) { diff --git a/wl1271/Test/scrDbg.c b/wl1271/Test/scrDbg.c index 9bc71fa5..6890975d 100644 --- a/wl1271/Test/scrDbg.c +++ b/wl1271/Test/scrDbg.c @@ -257,6 +257,7 @@ void changeMode( TI_HANDLE hScr, EScrModeId mode ) */ void printSCRObject( TI_HANDLE hScr ) { +#ifdef REPORT_LOG TScr* pScr = (TScr*)hScr; int i; @@ -277,4 +278,5 @@ void printSCRObject( TI_HANDLE hScr ) pendReasonDesc[ pScr->clientArray[ i ].currentPendingReason[ SCR_RESOURCE_SERVING_CHANNEL ] ], pendReasonDesc[ pScr->clientArray[ i ].currentPendingReason[ SCR_RESOURCE_PERIODIC_SCAN ] ]) ); } +#endif } diff --git a/wl1271/Test/siteMgrDebug.c b/wl1271/Test/siteMgrDebug.c index 0345e736..d5c28095 100644 --- a/wl1271/Test/siteMgrDebug.c +++ b/wl1271/Test/siteMgrDebug.c @@ -249,10 +249,12 @@ void siteMgrDebugFunction (TI_HANDLE hSiteMgr, case PRINT_FAILURE_EVENTS: { - WLAN_OS_REPORT(("\n PRINT HEALTH MONITOR LOG\n")); - healthMonitor_printFailureEvents (pStadHandles->hHealthMonitor); - apConn_printStatistics(pStadHandles->hAPConnection); + WLAN_OS_REPORT(("\n PRINT HEALTH MONITOR LOG\n")); + healthMonitor_printFailureEvents (pStadHandles->hHealthMonitor); + apConn_printStatistics(pStadHandles->hAPConnection); +#ifdef REPORT_LOG conn_ibssPrintStatistics(pStadHandles->hConn); +#endif if (((conn_t*)pStadHandles->hConn)->currentConnType==CONNECTION_INFRA) { switch (((conn_t*)pStadHandles->hConn)->state) @@ -312,7 +314,7 @@ void siteMgrDebugFunction (TI_HANDLE hSiteMgr, static void printPrimarySite(siteMgr_t *pSiteMgr) { - siteEntry_t *pSiteEntry; + siteEntry_t *pSiteEntry; TI_UINT8 len; char ssid[MAX_SSID_LEN + 1]; diff --git a/wl1271/Test/smeDebug.c b/wl1271/Test/smeDebug.c index 2c0e51b1..4133c17f 100644 --- a/wl1271/Test/smeDebug.c +++ b/wl1271/Test/smeDebug.c @@ -164,7 +164,7 @@ void printSmeDbgFunctions(void) WLAN_OS_REPORT(("1904 - Print BSSID list\n")); } - +#ifdef REPORT_LOG static TI_UINT8 Freq2Chan(TI_UINT32 freq) { TI_UINT32 i; @@ -175,6 +175,7 @@ static TI_UINT8 Freq2Chan(TI_UINT32 freq) return 0; } +#endif static void PrintBssidList(OS_802_11_BSSID_LIST_EX* bssidList, TI_UINT32 IsFullPrint, TMacAddr CurrentBssid) { diff --git a/wl1271/Txn/BusDrv.h b/wl1271/Txn/BusDrv.h index b816501e..d29965d6 100644 --- a/wl1271/Txn/BusDrv.h +++ b/wl1271/Txn/BusDrv.h @@ -196,6 +196,5 @@ TI_STATUS busDrv_DisconnectBus (TI_HANDLE hBusDrv); ETxnStatus busDrv_Transact (TI_HANDLE hBusDrv, TTxnStruct *pTxn); - #endif /*__BUS_DRV_API_H__*/ diff --git a/wl1271/Txn/SdioBusDrv.c b/wl1271/Txn/SdioBusDrv.c index 79aca4d2..20efe787 100644 --- a/wl1271/Txn/SdioBusDrv.c +++ b/wl1271/Txn/SdioBusDrv.c @@ -624,6 +624,3 @@ static void busDrv_TxnDoneCb (TI_HANDLE hBusDrv, int iStatus) CL_TRACE_END_L1("tiwlan_drv.ko", "TXN_DONE", "BusDrvCB", ""); } - - - diff --git a/wl1271/Txn/TxnQueue.c b/wl1271/Txn/TxnQueue.c index 95387608..edfd4378 100644 --- a/wl1271/Txn/TxnQueue.c +++ b/wl1271/Txn/TxnQueue.c @@ -804,6 +804,18 @@ static TTxnStruct *txnQ_SelectTxn (TTxnQObj *pTxnQ) } +/** + * \fn txnQ_ClearQueues + * \brief Clear the function queues + * + * Clear the specified function queues and call its CB for each Txn with status=RECOVERY. + * + * \note Called in critical section. + * \param hTxnQ - The module's object + * \param uFuncId - The calling functional driver + * \return void + * \sa + */ void txnQ_ClearQueues (TI_HANDLE hTxnQ, TI_UINT32 uFuncId) { TTxnQObj *pTxnQ = (TTxnQObj*)hTxnQ; @@ -817,22 +829,16 @@ void txnQ_ClearQueues (TI_HANDLE hTxnQ, TI_UINT32 uFuncId) /* For all function priorities */ for (uPrio = 0; uPrio < pTxnQ->aFuncInfo[uFuncId].uNumPrios; uPrio++) { - while (1) + do { /* Dequeue Txn from current priority queue */ pTxn = (TTxnStruct *) que_Dequeue (pTxnQ->aTxnQueues[uFuncId][uPrio]); - /* If NULL Txn (queue empty), exit while loop */ - if (pTxn == NULL) - { - break; - } - /* * Drop on Restart * do not call fTxnQueueDoneCb (hCbHandle, pTxn) callback */ - } + } while (pTxn != NULL); } /* Clear state - for restart (doesn't call txnQ_Open) */ @@ -852,5 +858,3 @@ void txnQ_PrintQueues (TI_HANDLE hTxnQ) que_Print(pTxnQ->aTxnQueues[TXN_FUNC_ID_WLAN][TXN_HIGH_PRIORITY]); } #endif /* TI_DBG */ - - diff --git a/wl1271/Txn/TxnQueue.h b/wl1271/Txn/TxnQueue.h index 4de63398..ee4987c2 100644 --- a/wl1271/Txn/TxnQueue.h +++ b/wl1271/Txn/TxnQueue.h @@ -76,7 +76,6 @@ * \sa txnQ_Destroy */ TI_HANDLE txnQ_Create (TI_HANDLE hOs); - /** \brief Destroy the module * * \param The module's object @@ -88,7 +87,6 @@ TI_HANDLE txnQ_Create (TI_HANDLE hOs); * \sa txnQ_Create */ TI_STATUS txnQ_Destroy (TI_HANDLE hTxnQ); - /** \brief Init module * * \param hTxnQ - The module's object @@ -139,7 +137,6 @@ TI_STATUS txnQ_ConnectBus (TI_HANDLE hTxnQ, * \sa */ TI_STATUS txnQ_DisconnectBus (TI_HANDLE hTxnQ); - /** \brief Register functional driver to TxnQ * * \param hTxnQ - The module's object @@ -161,7 +158,6 @@ TI_STATUS txnQ_Open (TI_HANDLE hTxnQ, TI_UINT32 uNumPrios, TTxnQueueDoneCb fTxnQueueDoneCb, TI_HANDLE hCbHandle); - /** \brief Unregister functional driver from TxnQ * * \param hTxnQ - The module's object @@ -177,7 +173,6 @@ TI_STATUS txnQ_Open (TI_HANDLE hTxnQ, * \sa txnQ_Open */ void txnQ_Close (TI_HANDLE hTxnQ, TI_UINT32 uFuncId); - /** \brief Restart caller's queues * * \param hTxnQ - The module's object @@ -196,7 +191,6 @@ void txnQ_Close (TI_HANDLE hTxnQ, TI_UINT32 uFuncId); * \sa txnQ_ClearQueues */ ETxnStatus txnQ_Restart (TI_HANDLE hTxnQ, TI_UINT32 uFuncId); - /** \brief Run caller's queues * * \param hTxnQ - The module's object @@ -211,7 +205,6 @@ ETxnStatus txnQ_Restart (TI_HANDLE hTxnQ, TI_UINT32 uFuncId); * \sa txnQ_ClearQueues */ void txnQ_Run (TI_HANDLE hTxnQ, TI_UINT32 uFuncId); - /** \brief Stop caller's queues * * \param hTxnQ - The module's object @@ -224,7 +217,6 @@ void txnQ_Run (TI_HANDLE hTxnQ, TI_UINT32 uFuncId); * \sa */ void txnQ_Stop (TI_HANDLE hTxnQ, TI_UINT32 uFuncId); - /** \brief Issue a new transaction * * \param hTxnQ - The module's object diff --git a/wl1271/external_drivers/zoom2/Linux/sdio/SdioDrv.c b/wl1271/external_drivers/sdio/linux/SdioDrv.c index a8cb514e..8797d4e4 100644 --- a/wl1271/external_drivers/zoom2/Linux/sdio/SdioDrv.c +++ b/wl1271/external_drivers/sdio/linux/SdioDrv.c @@ -33,32 +33,54 @@ #include <linux/kernel.h> #include <linux/module.h> +#include <linux/version.h> #include <linux/moduleparam.h> #include <linux/delay.h> #include <linux/interrupt.h> #include <linux/slab.h> -#include <mach/io.h> #include <linux/types.h> #include <linux/dma-mapping.h> -#include <mach/hardware.h> #include <linux/platform_device.h> -#include <mach/hardware.h> #include <linux/i2c/twl4030.h> -#include <mach/board.h> #include <linux/errno.h> #include <linux/clk.h> +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 31)) +#include <plat/hardware.h> +#include <plat/board.h> +#include <plat/clock.h> +#include <plat/dma.h> +#include <plat/io.h> +#include <plat/resource.h> +#define IO_ADDRESS(pa) OMAP2_L4_IO_ADDRESS(pa) +#else +#include <mach/hardware.h> +#include <mach/board.h> #include <mach/clock.h> #include <mach/dma.h> #include <mach/io.h> #include <mach/resource.h> -typedef void* TI_HANDLE; +#endif +typedef void *TI_HANDLE; #include "host_platform.h" #include "SdioDrvDbg.h" #include "SdioDrv.h" -#define TIWLAN_MMC_CONTROLLER 3 -#define TIWLAN_MMC_CONTROLLER_BASE_ADDR OMAP_HSMMC3_BASE -#define TIWLAN_MMC_CONTROLLER_BASE_SIZE 512 +/* #define TI_SDIO_DEBUG */ + +#ifndef CONFIG_MMC_EMBEDDED_SDIO + +#define SDIOWQ_NAME "sdio_wq" + +/* + * HSMMC Address and DMA Settings + */ +static unsigned long TIWLAN_MMC_CONTROLLER = 2; /* MMC3 */ +static unsigned long TIWLAN_MMC_CONTROLLER_BASE_ADDR = OMAP_HSMMC3_BASE; +#define TIWLAN_MMC_CONTROLLER_BASE_SIZE 512 +#define TIWLAN_MMC_MAX_DMA 8192 +static unsigned long TIWLAN_MMC_DMA_TX = OMAP34XX_DMA_MMC3_TX; +static unsigned long TIWLAN_MMC_DMA_RX = OMAP34XX_DMA_MMC3_RX; +static unsigned long OMAP_MMC_IRQ = INT_MMC3_IRQ; #define OMAP_MMC_MASTER_CLOCK 96000000 /* @@ -97,72 +119,70 @@ typedef void* TI_HANDLE; #define SDVSDET 0x00000400 #define SIDLE_MODE (0x2 << 3) #define AUTOIDLE 0x1 -#define SDBP (1 << 8) -#define DTO 0xE -#define ICE 0x1 -#define ICS 0x2 -#define CEN (1 << 2) -#define CLKD_MASK 0x0000FFC0 -#define IE_EN_MASK 0x317F0137 -#define INIT_STREAM (1 << 1) -#define DP_SELECT (1 << 21) -#define DDIR (1 << 4) -#define DMA_EN 0x1 +#define SDBP (1 << 8) +#define DTO 0xE +#define ICE 0x1 +#define ICS 0x2 +#define CEN (1 << 2) +#define CLKD_MASK 0x0000FFC0 +#define IE_EN_MASK 0x317F0137 +#define INIT_STREAM (1 << 1) +#define DP_SELECT (1 << 21) +#define DDIR (1 << 4) +#define DMA_EN 0x1 #define MSBS (1 << 5) -#define BCE (1 << 1) +#define BCE (1 << 1) #define ONE_BIT (~(0x2)) -#define EIGHT_BIT (~(0x20)) -#define CC 0x1 -#define TC 0x02 -#define OD 0x1 -#define BRW 0x400 -#define BRR 0x800 -#define BRE (1 << 11) -#define BWE (1 << 10) -#define SBGR (1 << 16) -#define CT (1 << 17) -#define SDIO_READ (1 << 31) -#define SDIO_BLKMODE (1 << 27) +#define EIGHT_BIT (~(0x20)) +#define CC 0x1 +#define TC 0x02 +#define OD 0x1 +#define BRW 0x400 +#define BRR 0x800 +#define BRE (1 << 11) +#define BWE (1 << 10) +#define SBGR (1 << 16) +#define CT (1 << 17) +#define SDIO_READ (1 << 31) +#define SDIO_BLKMODE (1 << 27) #define OMAP_HSMMC_ERR (1 << 15) /* Any error */ #define OMAP_HSMMC_CMD_TIMEOUT (1 << 16) /* Com mand response time-out */ #define OMAP_HSMMC_DATA_TIMEOUT (1 << 20) /* Data response time-out */ #define OMAP_HSMMC_CMD_CRC (1 << 17) /* Command CRC error */ #define OMAP_HSMMC_DATA_CRC (1 << 21) /* Date CRC error */ #define OMAP_HSMMC_CARD_ERR (1 << 28) /* Card ERR */ -#define OMAP_HSMMC_STAT_CLEAR 0xFFFFFFFF -#define INIT_STREAM_CMD 0x00000000 -#define INT_CLEAR 0x00000000 -#define BLK_CLEAR 0x00000000 +#define OMAP_HSMMC_STAT_CLEAR 0xFFFFFFFF +#define INIT_STREAM_CMD 0x00000000 +#define INT_CLEAR 0x00000000 +#define BLK_CLEAR 0x00000000 /* SCM CONTROL_DEVCONF1 MMC1 overwrite but */ -#define MMC1_ACTIVE_OVERWRITE (1 << 31) - -#define sdio_blkmode_regaddr 0x2000 -#define sdio_blkmode_mask 0xFF00 - -#define IO_RW_DIRECT_MASK 0xF000FF00 -#define IO_RW_DIRECT_ARG_MASK 0x80001A00 - -#define RMASK (MMC_RSP_MASK | MMC_RSP_CRC) +#define MMC1_ACTIVE_OVERWRITE (1 << 31) + +#define sdio_blkmode_regaddr 0x2000 +#define sdio_blkmode_mask 0xFF00 + +#define IO_RW_DIRECT_MASK 0xF000FF00 +#define IO_RW_DIRECT_ARG_MASK 0x80001A00 + +#define RMASK (MMC_RSP_MASK | MMC_RSP_CRC) #define MMC_TIMEOUT_MS 100 /*on the new 2430 it was 20, i changed back to 100*//* obc */ -#define MMCA_VSN_4 4 - -#define VMMC1_DEV_GRP 0x27 -#define P1_DEV_GRP 0x20 -#define VMMC1_DEDICATED 0x2A -#define VSEL_3V 0x02 -#define VSEL_18V 0x00 -#define PBIAS_3V 0x03 -#define PBIAS_18V 0x02 -#define PBIAS_LITE 0x04A0 -#define PBIAS_CLR 0x00 +#define MMCA_VSN_4 4 + +#define VMMC1_DEV_GRP 0x27 +#define P1_DEV_GRP 0x20 +#define VMMC1_DEDICATED 0x2A +#define VSEL_3V 0x02 +#define VSEL_18V 0x00 +#define PBIAS_3V 0x03 +#define PBIAS_18V 0x02 +#define PBIAS_LITE 0x04A0 +#define PBIAS_CLR 0x00 #define OMAP_MMC_REGS_BASE IO_ADDRESS(TIWLAN_MMC_CONTROLLER_BASE_ADDR) -#define INT_MMC3_IRQ 94 -#define OMAP_MMC_IRQ INT_MMC3_IRQ -/* +/* * MMC Host controller read/write API's. */ #define OMAP_HSMMC_READ_OFFSET(offset) (__raw_readl((OMAP_MMC_REGS_BASE) + (offset))) @@ -188,7 +208,7 @@ typedef void* TI_HANDLE; #define SDIO_CMD53_READ(v1,v2,v3,v4,v5,v6) (SDIO_RWFLAG(v1)|SDIO_FUNCN(v2)|SDIO_BLKM(v3)| SDIO_OPCODE(v4)|SDIO_ADDRREG(v5)|(v6&0x1ff)) #define SDIO_CMD53_WRITE(v1,v2,v3,v4,v5,v6) (SDIO_RWFLAG(v1)|SDIO_FUNCN(v2)|SDIO_BLKM(v3)| SDIO_OPCODE(v4)|SDIO_ADDRREG(v5)|(v6&0x1ff)) -#define SDIODRV_MAX_LOOPS 50000 +#define SDIODRV_MAX_LOOPS 50000 #define VMMC2_DEV_GRP 0x2B #define VMMC2_DEDICATED 0x2E @@ -201,15 +221,14 @@ typedef void* TI_HANDLE; #define VSIM_DEDICATED 0x3A #define TWL4030_MODULE_PM_RECIEVER 0x13 - typedef struct OMAP3430_sdiodrv { struct clk *fclk, *iclk, *dbclk; int ifclks_enabled; - spinlock_t clk_lock; + spinlock_t clk_lock; int dma_tx_channel; int dma_rx_channel; - int irq; + int irq; void (*BusTxnCB)(void* BusTxnHandle, int status); void* BusTxnHandle; unsigned int uBlkSize; @@ -222,7 +241,8 @@ typedef struct OMAP3430_sdiodrv size_t dma_read_size; dma_addr_t dma_write_addr; size_t dma_write_size; - struct workqueue_struct *pWorkQueue; + struct workqueue_struct *sdio_wq; /* Work Queue */ + struct work_struct sdiodrv_work; } OMAP3430_sdiodrv_t; struct omap_hsmmc_regs { @@ -236,18 +256,23 @@ struct omap_hsmmc_regs { }; static struct omap_hsmmc_regs hsmmc_ctx; +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 31)) +static struct platform_device dummy_pdev = { + .dev = { + .bus = &platform_bus_type, + }, +}; +#endif + #define SDIO_DRIVER_NAME "TIWLAN_SDIO" -#define SDIO_DRV_WK_NAME "ti_sdio_drv" module_param(g_sdio_debug_level, int, 0644); MODULE_PARM_DESC(g_sdio_debug_level, "debug level"); int g_sdio_debug_level = SDIO_DEBUGLEVEL_ERR; -EXPORT_SYMBOL( g_sdio_debug_level); +EXPORT_SYMBOL(g_sdio_debug_level); OMAP3430_sdiodrv_t g_drv; -struct work_struct sdiodrv_work; - static int sdiodrv_irq_requested = 0; static int sdiodrv_iclk_got = 0; static int sdiodrv_fclk_got = 0; @@ -256,18 +281,39 @@ static void sdioDrv_hsmmc_save_ctx(void); static void sdioDrv_hsmmc_restore_ctx(void); static void sdiodrv_dma_shutdown(void); +#ifndef TI_SDIO_STANDALONE +void sdio_init( int sdcnum ) +{ + if( sdcnum <= 0 ) + return; + TIWLAN_MMC_CONTROLLER = sdcnum - 1; + if( sdcnum == 2 ) { + TIWLAN_MMC_CONTROLLER_BASE_ADDR = OMAP_HSMMC2_BASE; + TIWLAN_MMC_DMA_TX = OMAP24XX_DMA_MMC2_TX; + TIWLAN_MMC_DMA_RX = OMAP24XX_DMA_MMC2_RX; + OMAP_MMC_IRQ = INT_MMC2_IRQ; + } + else if( sdcnum == 3 ) { + TIWLAN_MMC_CONTROLLER_BASE_ADDR = OMAP_HSMMC3_BASE; + TIWLAN_MMC_DMA_TX = OMAP34XX_DMA_MMC3_TX; + TIWLAN_MMC_DMA_RX = OMAP34XX_DMA_MMC3_RX; + OMAP_MMC_IRQ = INT_MMC3_IRQ; + } +} +#endif + static void sdioDrv_hsmmc_save_ctx(void) { - /* MMC : context save */ - hsmmc_ctx.hctl = OMAP_HSMMC_READ(HCTL); - hsmmc_ctx.capa = OMAP_HSMMC_READ(CAPA); - hsmmc_ctx.sysconfig = OMAP_HSMMC_READ(SYSCONFIG); - hsmmc_ctx.ise = OMAP_HSMMC_READ(ISE); - hsmmc_ctx.ie = OMAP_HSMMC_READ(IE); - hsmmc_ctx.con = OMAP_HSMMC_READ(CON); - hsmmc_ctx.sysctl = OMAP_HSMMC_READ(SYSCTL); - OMAP_HSMMC_WRITE(ISE, 0); - OMAP_HSMMC_WRITE(IE, 0); + /* MMC : context save */ + hsmmc_ctx.hctl = OMAP_HSMMC_READ(HCTL); + hsmmc_ctx.capa = OMAP_HSMMC_READ(CAPA); + hsmmc_ctx.sysconfig = OMAP_HSMMC_READ(SYSCONFIG); + hsmmc_ctx.ise = OMAP_HSMMC_READ(ISE); + hsmmc_ctx.ie = OMAP_HSMMC_READ(IE); + hsmmc_ctx.con = OMAP_HSMMC_READ(CON); + hsmmc_ctx.sysctl = OMAP_HSMMC_READ(SYSCTL); + OMAP_HSMMC_WRITE(ISE, 0); + OMAP_HSMMC_WRITE(IE, 0); } static void sdioDrv_hsmmc_restore_ctx(void) @@ -316,31 +362,17 @@ irqreturn_t sdiodrv_irq(int irq, void *drv) if (g_drv.async_status) { PERR("sdiodrv_irq: ERROR in STAT = 0x%x\n", status); } - - status = queue_work (g_drv.pWorkQueue, &sdiodrv_work); - if (!status) - { - printk("\n***Error sdiodrv_irq: failed to enqueue work,status = %d\n", status); - } - + queue_work(g_drv.sdio_wq, &g_drv.sdiodrv_work); return IRQ_HANDLED; } void sdiodrv_dma_read_cb(int lch, u16 ch_status, void *data) { - int status; - PDEBUG("sdiodrv_dma_read_cb() channel=%d status=0x%x\n", lch, (int)ch_status); g_drv.async_status = ch_status & (1 << 7); - status = queue_work (g_drv.pWorkQueue, &sdiodrv_work); - - if (! status ) - { - printk("\n***Error sdiodrv_dma_read_cb: failed to enqueue work ,status = %d\n", status); - } - + queue_work(g_drv.sdio_wq, &g_drv.sdiodrv_work); sdiodrv_dma_shutdown(); } @@ -353,27 +385,27 @@ int sdiodrv_dma_init(void) { int rc; - rc = omap_request_dma(OMAP34XX_DMA_MMC3_TX, "SDIO WRITE", sdiodrv_dma_write_cb, &g_drv, &g_drv.dma_tx_channel); + rc = omap_request_dma(TIWLAN_MMC_DMA_TX, "SDIO WRITE", sdiodrv_dma_write_cb, &g_drv, &g_drv.dma_tx_channel); if (rc != 0) { - PERR("sdiodrv_dma_init() omap_request_dma(OMAP34XX_DMA_MMC2_TX) FAILED\n"); + PERR("sdiodrv_dma_init() omap_request_dma(TIWLAN_MMC_DMA_TX) FAILED\n"); goto out; } - rc = omap_request_dma(OMAP34XX_DMA_MMC3_RX, "SDIO READ", sdiodrv_dma_read_cb, &g_drv, &g_drv.dma_rx_channel); + rc = omap_request_dma(TIWLAN_MMC_DMA_RX, "SDIO READ", sdiodrv_dma_read_cb, &g_drv, &g_drv.dma_rx_channel); if (rc != 0) { - PERR("sdiodrv_dma_init() omap_request_dma(OMAP24XX_DMA_MMC2_RX) FAILED\n"); + PERR("sdiodrv_dma_init() omap_request_dma(TIWLAN_MMC_DMA_RX) FAILED\n"); goto freetx; } omap_set_dma_src_params(g_drv.dma_rx_channel, 0, // src_port is only for OMAP1 OMAP_DMA_AMODE_CONSTANT, - (OMAP_HSMMC3_BASE) + OMAP_HSMMC_DATA, 0, 0); + (TIWLAN_MMC_CONTROLLER_BASE_ADDR) + OMAP_HSMMC_DATA, 0, 0); omap_set_dma_dest_params(g_drv.dma_tx_channel, 0, // dest_port is only for OMAP1 OMAP_DMA_AMODE_CONSTANT, - (OMAP_HSMMC3_BASE) + OMAP_HSMMC_DATA, 0, 0); + (TIWLAN_MMC_CONTROLLER_BASE_ADDR) + OMAP_HSMMC_DATA, 0, 0); return 0; @@ -385,20 +417,20 @@ out: static void sdiodrv_dma_shutdown(void) { - omap_free_dma(g_drv.dma_tx_channel); - omap_free_dma(g_drv.dma_rx_channel); + omap_free_dma(g_drv.dma_tx_channel); + omap_free_dma(g_drv.dma_rx_channel); } /* sdiodrv_dma_shutdown() */ static u32 sdiodrv_poll_status(u32 reg_offset, u32 stat, unsigned int msecs) { - u32 status=0, loops=0; + u32 status=0, loops=0; do { - status=OMAP_HSMMC_READ_OFFSET(reg_offset); - if(( status & stat)) + status = OMAP_HSMMC_READ_OFFSET(reg_offset); + if(( status & stat)) { - break; + break; } } while (loops++ < SDIODRV_MAX_LOOPS); @@ -439,7 +471,6 @@ static int sdiodrv_send_command(u32 cmdreg, u32 cmdarg) OMAP_HSMMC_SEND_COMMAND(cmdreg, cmdarg); return sdiodrv_poll_status(OMAP_HSMMC_STAT, CC, MMC_TIMEOUT_MS); - } /* sdiodrv_send_command() */ /* @@ -449,9 +480,9 @@ static void OMAP3430_mmc_stop_clock(void) { OMAP_HSMMC_WRITE(SYSCTL, OMAP_HSMMC_READ(SYSCTL) & ~CEN); if ((OMAP_HSMMC_READ(SYSCTL) & CEN) != 0x0) - { + { PERR("MMC clock not stoped, clock freq can not be altered\n"); - } + } } /* OMAP3430_mmc_stop_clock */ /* @@ -501,7 +532,7 @@ static void OMAP3430_mmc_set_clock(unsigned int clock, OMAP3430_sdiodrv_t *host) OMAP_HSMMC_WRITE(SYSCTL, regVal); OMAP_HSMMC_WRITE(SYSCTL, OMAP_HSMMC_READ(SYSCTL) | ICE);//internal clock enable. obc not mentioned in the spec /* - * wait till the the clock is stable (ICS) bit is set + * wait till the the clock is stable (ICS) bit is set */ status = sdiodrv_poll_status(OMAP_HSMMC_SYSCTL, ICS, MMC_TIMEOUT_MS); if(!(status & ICS)) { @@ -531,7 +562,7 @@ static void sdiodrv_free_resources(void) } if (sdiodrv_irq_requested) { - free_irq(g_drv.irq, &g_drv); + free_irq(OMAP_MMC_IRQ, &g_drv); sdiodrv_irq_requested = 0; } } @@ -539,7 +570,7 @@ static void sdiodrv_free_resources(void) int sdioDrv_InitHw(void) { return 0; -} /* sdiodrv_init */ +} /* sdioDrv_InitHw */ void sdiodrv_shutdown(void) { @@ -552,11 +583,11 @@ void sdiodrv_shutdown(void) static int sdiodrv_send_data_xfer_commad(u32 cmd, u32 cmdarg, int length, u32 buffer_enable_status, unsigned int bBlkMode) { - int status; + int status; PDEBUG("%s() writing CMD 0x%x ARG 0x%x\n",__FUNCTION__, cmd, cmdarg); - /* block mode */ + /* block mode */ if(bBlkMode) { /* * Bits 31:16 of BLK reg: NBLK Blocks count for current transfer. @@ -573,32 +604,32 @@ static int sdiodrv_send_data_xfer_commad(u32 cmd, u32 cmdarg, int length, u32 bu */ cmd |= MSBS | BCE ; } else { - OMAP_HSMMC_WRITE(BLK, length); - } + OMAP_HSMMC_WRITE(BLK, length); + } - status = sdiodrv_send_command(cmd, cmdarg); + status = sdiodrv_send_command(cmd, cmdarg); if(!(status & CC)) { - PERR("sdiodrv_send_data_xfer_commad() SDIO Command error! STAT = 0x%x\n", status); - return 0; + PERR("sdiodrv_send_data_xfer_commad() SDIO Command error! STAT = 0x%x\n", status); + return 0; } PDEBUG("%s() length = %d(%dw) BLK = 0x%x\n", __FUNCTION__, length,((length + 3) >> 2), OMAP_HSMMC_READ(BLK)); - return sdiodrv_poll_status(OMAP_HSMMC_PSTATE, buffer_enable_status, MMC_TIMEOUT_MS); + return sdiodrv_poll_status(OMAP_HSMMC_PSTATE, buffer_enable_status, MMC_TIMEOUT_MS); } /* sdiodrv_send_data_xfer_commad() */ int sdiodrv_data_xfer_sync(u32 cmd, u32 cmdarg, void *data, int length, u32 buffer_enable_status) { - u32 buf_start, buf_end, data32; + u32 buf_start, buf_end, data32; int status; - status = sdiodrv_send_data_xfer_commad(cmd, cmdarg, length, buffer_enable_status, 0); + status = sdiodrv_send_data_xfer_commad(cmd, cmdarg, length, buffer_enable_status, 0); if(!(status & buffer_enable_status)) - { - PERR("sdiodrv_data_xfer_sync() buffer disabled! length = %d BLK = 0x%x PSTATE = 0x%x\n", + { + PERR("sdiodrv_data_xfer_sync() buffer disabled! length = %d BLK = 0x%x PSTATE = 0x%x\n", length, OMAP_HSMMC_READ(BLK), status); - return -1; + return -1; } buf_end = (u32)data+(u32)length; @@ -615,7 +646,7 @@ int sdiodrv_data_xfer_sync(u32 cmd, u32 cmdarg, void *data, int length, u32 buff *((unsigned long*)(data)) = OMAP_HSMMC_READ(DATA); } } - else /* 2 bytes aligned */ + else /* 2 bytes aligned */ { for (buf_start = (u32)data; (u32)data < buf_end; data += sizeof(unsigned long)) { @@ -649,22 +680,14 @@ int sdiodrv_data_xfer_sync(u32 cmd, u32 cmdarg, void *data, int length, u32 buff status = sdiodrv_poll_status(OMAP_HSMMC_STAT, TC, MMC_TIMEOUT_MS); if(!(status & TC)) { - PERR("sdiodrv_data_xfer_sync() transfer error! STAT = 0x%x\n", status); - return -1; + PERR("sdiodrv_data_xfer_sync() transfer error! STAT = 0x%x\n", status); + return -1; } return 0; } /* sdiodrv_data_xfer_sync() */ -/*--------------------------------------------------------------------------------------*/ - -/********************************************************************/ -/* SDIO driver interface functions */ -/********************************************************************/ - -/*--------------------------------------------------------------------------------------*/ - int sdioDrv_ConnectBus (void * fCbFunc, void * hCbArg, unsigned int uBlkSizeShift, @@ -675,12 +698,11 @@ int sdioDrv_ConnectBus (void * fCbFunc, g_drv.uBlkSizeShift = uBlkSizeShift; g_drv.uBlkSize = 1 << uBlkSizeShift; - INIT_WORK(&sdiodrv_work, sdiodrv_task); + INIT_WORK(&g_drv.sdiodrv_work, sdiodrv_task); return sdioDrv_InitHw (); } - /*--------------------------------------------------------------------------------------*/ int sdioDrv_DisconnectBus (void) @@ -703,6 +725,8 @@ int sdioDrv_ExecuteCmd (unsigned int uCmd, PDEBUG("sdioDrv_ExecuteCmd() starting cmd %02x arg %08x\n", (int)uCmd, (int)uArg); + sdioDrv_clk_enable(); /* To make sure we have clocks enable */ + uCmdReg = (uCmd << 24) | (uRespType << 16) ; uStatus = sdiodrv_send_command(uCmdReg, uArg); @@ -714,11 +738,10 @@ int sdioDrv_ExecuteCmd (unsigned int uCmd, } if ((uLen > 0) && (uLen <= 4))/*obc - Len > 4 ? shouldn't read anything ? */ { - uResponse = OMAP_HSMMC_READ(RSP10); + uResponse = OMAP_HSMMC_READ(RSP10); memcpy (pResponse, (char *)&uResponse, uLen); PDEBUG("sdioDrv_ExecuteCmd() response = 0x%x\n", uResponse); } - return 0; } @@ -735,15 +758,22 @@ int sdioDrv_ReadSync (unsigned int uFunc, int iStatus; // printk(KERN_INFO "in sdioDrv_ReadSync\n"); - uCmdArg = SDIO_CMD53_READ(0, uFunc, 0, bIncAddr, uHwAddr, uLen); iStatus = sdiodrv_data_xfer_sync(OMAP_HSMMC_CMD53_READ, uCmdArg, pData, uLen, BRE); - if (iStatus != 0) - { + if (iStatus != 0) { PERR("sdioDrv_ReadSync() FAILED!!\n"); } - +#ifdef TI_SDIO_DEBUG + if (uLen == 1) + printk(KERN_INFO "R53: [0x%x](%u) = 0x%x\n", uHwAddr, uLen, (unsigned)(*(char *)pData)); + else if (uLen == 2) + printk(KERN_INFO "R53: [0x%x](%u) = 0x%x\n", uHwAddr, uLen, (unsigned)(*(short *)pData)); + else if (uLen == 4) + printk(KERN_INFO "R53: [0x%x](%u) = 0x%x\n", uHwAddr, uLen, (unsigned)(*(long *)pData)); + else + printk(KERN_INFO "R53: [0x%x](%u)\n", uHwAddr, uLen); +#endif return iStatus; } @@ -763,33 +793,37 @@ int sdioDrv_ReadAsync (unsigned int uFunc, unsigned int uNumOfElem; dma_addr_t dma_bus_address; - //printk(KERN_INFO "in sdioDrv_ReadAsync\n"); - - if (bBlkMode) - { - /* For block mode use number of blocks instead of length in bytes */ - uNumBlks = uLen >> g_drv.uBlkSizeShift; - uDmaBlockCount = uNumBlks; - /* due to the DMA config to 32Bit per element (OMAP_DMA_DATA_TYPE_S32) the division is by 4 */ - uNumOfElem = g_drv.uBlkSize >> 2; - } - else - { - uNumBlks = uLen; - uDmaBlockCount = 1; - uNumOfElem = (uLen + 3) >> 2; - } +#ifdef TI_SDIO_DEBUG + printk(KERN_INFO "R53: [0x%x](%u) F[%d]\n", uHwAddr, uLen, uFunc); +#endif - uCmdArg = SDIO_CMD53_READ(0, uFunc, bBlkMode, bIncAddr, uHwAddr, uNumBlks); + //printk(KERN_INFO "in sdioDrv_ReadAsync\n"); - iStatus = sdiodrv_send_data_xfer_commad(OMAP_HSMMC_CMD53_READ_DMA, uCmdArg, uNumBlks, BRE, bBlkMode); - - if (!(iStatus & BRE)) - { - PERR("sdioDrv_ReadAsync() buffer disabled! length = %d BLK = 0x%x PSTATE = 0x%x, BlkMode = %d\n", - uLen, OMAP_HSMMC_READ(BLK), iStatus, bBlkMode); - return -1; - } + if (bBlkMode) + { + /* For block mode use number of blocks instead of length in bytes */ + uNumBlks = uLen >> g_drv.uBlkSizeShift; + uDmaBlockCount = uNumBlks; + /* due to the DMA config to 32Bit per element (OMAP_DMA_DATA_TYPE_S32) the division is by 4 */ + uNumOfElem = g_drv.uBlkSize >> 2; + } + else + { + uNumBlks = uLen; + uDmaBlockCount = 1; + uNumOfElem = (uLen + 3) >> 2; + } + + uCmdArg = SDIO_CMD53_READ(0, uFunc, bBlkMode, bIncAddr, uHwAddr, uNumBlks); + + iStatus = sdiodrv_send_data_xfer_commad(OMAP_HSMMC_CMD53_READ_DMA, uCmdArg, uNumBlks, BRE, bBlkMode); + + if (!(iStatus & BRE)) + { + PERR("sdioDrv_ReadAsync() buffer disabled! length = %d BLK = 0x%x PSTATE = 0x%x, BlkMode = %d\n", + uLen, OMAP_HSMMC_READ(BLK), iStatus, bBlkMode); + goto err; + } sdiodrv_dma_init(); @@ -798,7 +832,7 @@ int sdioDrv_ReadAsync (unsigned int uFunc, dma_bus_address = dma_map_single(g_drv.dev, pData, uLen, DMA_FROM_DEVICE); if (!dma_bus_address) { PERR("sdioDrv_ReadAsync: dma_map_single failed\n"); - return -1; + goto err; } if (g_drv.dma_read_addr != 0) { @@ -809,18 +843,24 @@ int sdioDrv_ReadAsync (unsigned int uFunc, g_drv.dma_read_addr = dma_bus_address; g_drv.dma_read_size = uLen; - omap_set_dma_dest_params(g_drv.dma_rx_channel, - 0, // dest_port is only for OMAP1 - OMAP_DMA_AMODE_POST_INC, - dma_bus_address, - 0, 0); + omap_set_dma_dest_params (g_drv.dma_rx_channel, + 0, // dest_port is only for OMAP1 + OMAP_DMA_AMODE_POST_INC, + dma_bus_address, + 0, 0); - omap_set_dma_transfer_params(g_drv.dma_rx_channel, OMAP_DMA_DATA_TYPE_S32, uNumOfElem , uDmaBlockCount , OMAP_DMA_SYNC_FRAME, OMAP34XX_DMA_MMC3_RX, OMAP_DMA_SRC_SYNC); + omap_set_dma_transfer_params(g_drv.dma_rx_channel, OMAP_DMA_DATA_TYPE_S32, uNumOfElem , uDmaBlockCount , OMAP_DMA_SYNC_FRAME, TIWLAN_MMC_DMA_RX, OMAP_DMA_SRC_SYNC); omap_start_dma(g_drv.dma_rx_channel); /* Continued at sdiodrv_irq() after DMA transfer is finished */ +#ifdef TI_SDIO_DEBUG + printk(KERN_INFO "R53: [0x%x](%u) (A)\n", uHwAddr, uLen); +#endif return 0; +err: + return -1; + } @@ -835,6 +875,7 @@ int sdioDrv_WriteSync (unsigned int uFunc, { unsigned int uCmdArg; int iStatus; + // printk(KERN_INFO "in sdioDrv_WriteSync\n"); uCmdArg = SDIO_CMD53_WRITE(1, uFunc, 0, bIncAddr, uHwAddr, uLen); @@ -844,7 +885,16 @@ int sdioDrv_WriteSync (unsigned int uFunc, { PERR("sdioDrv_WriteSync() FAILED!!\n"); } - +#ifdef TI_SDIO_DEBUG + if (uLen == 1) + printk(KERN_INFO "W53: [0x%x](%u) < 0x%x\n", uHwAddr, uLen, (unsigned)(*(char *)pData)); + else if (uLen == 2) + printk(KERN_INFO "W53: [0x%x](%u) < 0x%x\n", uHwAddr, uLen, (unsigned)(*(short *)pData)); + else if (uLen == 4) + printk(KERN_INFO "W53: [0x%x](%u) < 0x%x\n", uHwAddr, uLen, (unsigned)(*(long *)pData)); + else + printk(KERN_INFO "W53: [0x%x](%u)\n", uHwAddr, uLen); +#endif return iStatus; } @@ -864,32 +914,35 @@ int sdioDrv_WriteAsync (unsigned int uFunc, unsigned int uNumOfElem; dma_addr_t dma_bus_address; -// printk(KERN_INFO "in sdioDrv_WriteAsync\n"); - - if (bBlkMode) - { - /* For block mode use number of blocks instead of length in bytes */ - uNumBlks = uLen >> g_drv.uBlkSizeShift; - uDmaBlockCount = uNumBlks; - /* due to the DMA config to 32Bit per element (OMAP_DMA_DATA_TYPE_S32) the division is by 4 */ - uNumOfElem = g_drv.uBlkSize >> 2; - } - else - { - uNumBlks = uLen; - uDmaBlockCount = 1; - uNumOfElem = (uLen + 3) >> 2; - } - - uCmdArg = SDIO_CMD53_WRITE(1, uFunc, bBlkMode, bIncAddr, uHwAddr, uNumBlks); +#ifdef TI_SDIO_DEBUG + printk(KERN_INFO "W53: [0x%x](%u) F[%d] B[%d] I[%d]\n", uHwAddr, uLen, uFunc, bBlkMode, bIncAddr); +#endif - iStatus = sdiodrv_send_data_xfer_commad(OMAP_HSMMC_CMD53_WRITE_DMA, uCmdArg, uNumBlks, BWE, bBlkMode); - if (!(iStatus & BWE)) - { - PERR("sdioDrv_WriteAsync() buffer disabled! length = %d, BLK = 0x%x, Status = 0x%x\n", - uLen, OMAP_HSMMC_READ(BLK), iStatus); - return -1; - } +// printk(KERN_INFO "in sdioDrv_WriteAsync\n"); + if (bBlkMode) + { + /* For block mode use number of blocks instead of length in bytes */ + uNumBlks = uLen >> g_drv.uBlkSizeShift; + uDmaBlockCount = uNumBlks; + /* due to the DMA config to 32Bit per element (OMAP_DMA_DATA_TYPE_S32) the division is by 4 */ + uNumOfElem = g_drv.uBlkSize >> 2; + } + else + { + uNumBlks = uLen; + uDmaBlockCount = 1; + uNumOfElem = (uLen + 3) >> 2; + } + + uCmdArg = SDIO_CMD53_WRITE(1, uFunc, bBlkMode, bIncAddr, uHwAddr, uNumBlks); + + iStatus = sdiodrv_send_data_xfer_commad(OMAP_HSMMC_CMD53_WRITE_DMA, uCmdArg, uNumBlks, BWE, bBlkMode); + if (!(iStatus & BWE)) + { + PERR("sdioDrv_WriteAsync() buffer disabled! length = %d, BLK = 0x%x, Status = 0x%x\n", + uLen, OMAP_HSMMC_READ(BLK), iStatus); + goto err; + } OMAP_HSMMC_WRITE(ISE, TC); @@ -898,7 +951,7 @@ int sdioDrv_WriteAsync (unsigned int uFunc, dma_bus_address = dma_map_single(g_drv.dev, pData, uLen, DMA_TO_DEVICE); if (!dma_bus_address) { PERR("sdioDrv_WriteAsync: dma_map_single failed\n"); - return -1; + goto err; } if (g_drv.dma_write_addr != 0) { @@ -909,18 +962,20 @@ int sdioDrv_WriteAsync (unsigned int uFunc, g_drv.dma_write_addr = dma_bus_address; g_drv.dma_write_size = uLen; - omap_set_dma_src_params(g_drv.dma_tx_channel, - 0, // src_port is only for OMAP1 - OMAP_DMA_AMODE_POST_INC, - dma_bus_address, - 0, 0); + omap_set_dma_src_params (g_drv.dma_tx_channel, + 0, // src_port is only for OMAP1 + OMAP_DMA_AMODE_POST_INC, + dma_bus_address, + 0, 0); - omap_set_dma_transfer_params(g_drv.dma_tx_channel, OMAP_DMA_DATA_TYPE_S32, uNumOfElem, uDmaBlockCount, OMAP_DMA_SYNC_FRAME, OMAP34XX_DMA_MMC3_TX, OMAP_DMA_DST_SYNC); + omap_set_dma_transfer_params(g_drv.dma_tx_channel, OMAP_DMA_DATA_TYPE_S32, uNumOfElem, uDmaBlockCount, OMAP_DMA_SYNC_FRAME, TIWLAN_MMC_DMA_TX, OMAP_DMA_DST_SYNC); omap_start_dma(g_drv.dma_tx_channel); /* Continued at sdiodrv_irq() after DMA transfer is finished */ return 0; +err: + return -1; } /*--------------------------------------------------------------------------------------*/ @@ -935,22 +990,21 @@ int sdioDrv_ReadSyncBytes (unsigned int uFunc, unsigned int i; int iStatus; - for (i = 0; i < uLen; i++) - { + for (i = 0; i < uLen; i++) { uCmdArg = SDIO_CMD52_READ(0, uFunc, 0, uHwAddr); iStatus = sdiodrv_send_command(OMAP_HSMMC_CMD52_READ, uCmdArg); - if (!(iStatus & CC)) - { + if (!(iStatus & CC)) { PERR("sdioDrv_ReadSyncBytes() SDIO Command error status = 0x%x\n", iStatus); return -1; } - else - { + else { *pData = (unsigned char)(OMAP_HSMMC_READ(RSP10)); } - +#ifdef TI_SDIO_DEBUG + printk(KERN_INFO "R52: [0x%x](%u) = 0x%x\n", uHwAddr, uLen, (unsigned)*pData); +#endif uHwAddr++; pData++; } @@ -970,18 +1024,17 @@ int sdioDrv_WriteSyncBytes (unsigned int uFunc, unsigned int i; int iStatus; - for (i = 0; i < uLen; i++) - { + for (i = 0; i < uLen; i++) { +#ifdef TI_SDIO_DEBUG + printk(KERN_INFO "W52: [0x%x](%u) < 0x%x\n", uHwAddr, uLen, (unsigned)*pData); +#endif uCmdArg = SDIO_CMD52_WRITE(1, uFunc, 0, uHwAddr, *pData); iStatus = sdiodrv_send_command(OMAP_HSMMC_CMD52_WRITE, uCmdArg); - - if (!(iStatus & CC)) - { + if (!(iStatus & CC)) { PERR("sdioDrv_WriteSyncBytes() SDIO Command error status = 0x%x\n", iStatus); return -1; } - uHwAddr++; pData++; } @@ -1007,7 +1060,7 @@ static int sdioDrv_probe(struct platform_device *pdev) if (g_drv.irq < 0) return -ENXIO; - rc= request_irq(g_drv.irq, sdiodrv_irq, 0, SDIO_DRIVER_NAME, &g_drv); + rc= request_irq(OMAP_MMC_IRQ, sdiodrv_irq, 0, SDIO_DRIVER_NAME, &g_drv); if (rc != 0) { PERR("sdioDrv_InitHw() - request_irq FAILED!!\n"); return rc; @@ -1015,8 +1068,14 @@ static int sdioDrv_probe(struct platform_device *pdev) sdiodrv_irq_requested = 1; spin_lock_init(&g_drv.clk_lock); - + +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 31)) + dummy_pdev.id = TIWLAN_MMC_CONTROLLER; + dev_set_name(&dummy_pdev.dev, "mmci-omap-hs.%lu", TIWLAN_MMC_CONTROLLER); + g_drv.fclk = clk_get(&dummy_pdev.dev, "fck"); +#else g_drv.fclk = clk_get(&pdev->dev, "mmchs_fck"); +#endif if (IS_ERR(g_drv.fclk)) { rc = PTR_ERR(g_drv.fclk); PERR("clk_get(fclk) FAILED !!!\n"); @@ -1024,45 +1083,42 @@ static int sdioDrv_probe(struct platform_device *pdev) } sdiodrv_fclk_got = 1; +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 31)) + g_drv.iclk = clk_get(&dummy_pdev.dev, "ick"); +#else g_drv.iclk = clk_get(&pdev->dev, "mmchs_ick"); +#endif if (IS_ERR(g_drv.iclk)) { rc = PTR_ERR(g_drv.iclk); PERR("clk_get(iclk) FAILED !!!\n"); goto err; } sdiodrv_iclk_got = 1; - - rc = clk_enable(g_drv.iclk); - if(rc) { - PERR("clk_enable(iclk) FAILED !!!\n"); - goto err; - } - - rc = clk_enable(g_drv.fclk); - if (rc) { - PERR("clk_enable(fclk) FAILED !!!\n"); - goto err; - } - g_drv.ifclks_enabled = 1; + + rc = sdioDrv_clk_enable(); + if (rc) { + PERR("sdioDrv_probe : clk_enable FAILED !!!\n"); + goto err; + } OMAP3430_mmc_reset(); //obc - init sequence p. 3600,3617 /* 1.8V */ - OMAP_HSMMC_WRITE(CAPA, OMAP_HSMMC_READ(CAPA) | VS18); - OMAP_HSMMC_WRITE(HCTL, OMAP_HSMMC_READ(HCTL) | SDVS18);//SDVS fits p. 3650 + OMAP_HSMMC_WRITE(CAPA, OMAP_HSMMC_READ(CAPA) | VS18); + OMAP_HSMMC_WRITE(HCTL, OMAP_HSMMC_READ(HCTL) | SDVS18);//SDVS fits p. 3650 /* clock gating */ OMAP_HSMMC_WRITE(SYSCONFIG, OMAP_HSMMC_READ(SYSCONFIG) | AUTOIDLE); /* bus power */ - OMAP_HSMMC_WRITE(HCTL, OMAP_HSMMC_READ(HCTL) | SDBP);//SDBP fits p. 3650 + OMAP_HSMMC_WRITE(HCTL, OMAP_HSMMC_READ(HCTL) | SDBP);//SDBP fits p. 3650 /* interrupts */ - OMAP_HSMMC_WRITE(ISE, 0); - OMAP_HSMMC_WRITE(IE, IE_EN_MASK); + OMAP_HSMMC_WRITE(ISE, 0); + OMAP_HSMMC_WRITE(IE, IE_EN_MASK); //p. 3601 suggests moving to the end OMAP3430_mmc_set_clock(clock_rate, &g_drv); - printk("SDIO clock Configuration is now set to %dMhz\n",(int)clock_rate/1000000); + printk(KERN_INFO "SDIO clock Configuration is now set to %dMhz\n",(int)clock_rate/1000000); /* Bus width */ #ifdef SDIO_1_BIT /* see also in SdioAdapter.c */ @@ -1097,16 +1153,15 @@ err: static int sdioDrv_remove(struct platform_device *pdev) { printk(KERN_INFO "sdioDrv_remove: calling sdiodrv_shutdown\n"); - + sdiodrv_shutdown(); - + return 0; } #ifdef CONFIG_PM static int sdioDrv_suspend(struct platform_device *pdev, pm_message_t state) { - printk(KERN_INFO "TISDIO: sdioDrv is suspending\n"); return 0; } @@ -1118,8 +1173,8 @@ static int sdioDrv_resume(struct platform_device *pdev) return 0; } #else -#define sdioDrv_suspend NULL -#define sdioDrv_resume NULL +#define sdioDrv_suspend NULL +#define sdioDrv_resume NULL #endif static struct platform_driver sdioDrv_struct = { @@ -1139,97 +1194,91 @@ void sdioDrv_register_pm(int (*wlanDrvIf_Start)(void), g_drv.wlanDrvIf_pm_suspend = wlanDrvIf_Stop; } -#ifdef CONFIG_PM int sdioDrv_clk_enable(void) { - unsigned long flags; - int ret = 0; - - spin_lock_irqsave(&g_drv.clk_lock, flags); - if (g_drv.ifclks_enabled) - goto done; - ret = clk_enable(g_drv.iclk); - if (ret) - goto clk_en_err1; - ret = clk_enable(g_drv.fclk); - if (ret) - goto clk_en_err2; - g_drv.ifclks_enabled = 1; - - sdioDrv_hsmmc_restore_ctx(); + unsigned long flags; + int ret = 0; + + spin_lock_irqsave(&g_drv.clk_lock, flags); + if (g_drv.ifclks_enabled) + goto done; + + ret = clk_enable(g_drv.iclk); + if (ret) + goto clk_en_err1; + + ret = clk_enable(g_drv.fclk); + if (ret) + goto clk_en_err2; + g_drv.ifclks_enabled = 1; + + sdioDrv_hsmmc_restore_ctx(); done: - spin_unlock_irqrestore(&g_drv.clk_lock, flags); - return ret; + spin_unlock_irqrestore(&g_drv.clk_lock, flags); + return ret; clk_en_err2: - clk_disable(g_drv.iclk); -clk_en_err1: - spin_unlock_irqrestore(&g_drv.clk_lock, flags); - return ret; + clk_disable(g_drv.iclk); +clk_en_err1 : + spin_unlock_irqrestore(&g_drv.clk_lock, flags); + return ret; } void sdioDrv_clk_disable(void) { - unsigned long flags; - - spin_lock_irqsave(&g_drv.clk_lock, flags); - if (!g_drv.ifclks_enabled) - goto done; + unsigned long flags; - sdioDrv_hsmmc_save_ctx(); + spin_lock_irqsave(&g_drv.clk_lock, flags); + if (!g_drv.ifclks_enabled) + goto done; - clk_disable(g_drv.fclk); - clk_disable(g_drv.iclk); - g_drv.ifclks_enabled = 0; + sdioDrv_hsmmc_save_ctx(); + clk_disable(g_drv.fclk); + clk_disable(g_drv.iclk); + g_drv.ifclks_enabled = 0; done: - spin_unlock_irqrestore(&g_drv.clk_lock, flags); -} -#else -int sdioDrv_clk_enable(void) -{ - return 0; + spin_unlock_irqrestore(&g_drv.clk_lock, flags); } -void sdioDrv_clk_disable(void) -{ - return 0; -} +#ifdef TI_SDIO_STANDALONE +static int __init sdioDrv_init(void) +#else +int __init sdioDrv_init(int sdcnum) #endif - -int sdioDrv_init(void) { memset(&g_drv, 0, sizeof(g_drv)); memset(&hsmmc_ctx, 0, sizeof(hsmmc_ctx)); - g_drv.pWorkQueue = create_singlethread_workqueue (SDIO_DRV_WK_NAME); - printk(KERN_INFO "TIWLAN SDIO init\n"); - +#ifndef TI_SDIO_STANDALONE + sdio_init( sdcnum ); +#endif + g_drv.sdio_wq = create_freezeable_workqueue(SDIOWQ_NAME); + if (!g_drv.sdio_wq) { + printk("TISDIO: Fail to create SDIO WQ\n"); + return -EINVAL; + } /* Register the sdio driver */ return platform_driver_register(&sdioDrv_struct); } -void sdioDrv_exit(void) +#ifdef TI_SDIO_STANDALONE +static +#endif +void __exit sdioDrv_exit(void) { /* Unregister sdio driver */ platform_driver_unregister(&sdioDrv_struct); - if(g_drv.pWorkQueue) - { - flush_workqueue(g_drv.pWorkQueue); - destroy_workqueue(g_drv.pWorkQueue); - } + if (g_drv.sdio_wq) + destroy_workqueue(g_drv.sdio_wq); } -//module_init(sdioDrv_init); -//module_exit(sdioDrv_exit); - -EXPORT_SYMBOL(sdioDrv_clk_enable); -EXPORT_SYMBOL(sdioDrv_clk_disable); - -EXPORT_SYMBOL(sdioDrv_init); -EXPORT_SYMBOL(sdioDrv_exit); +#ifdef TI_SDIO_STANDALONE +module_init(sdioDrv_init); +module_exit(sdioDrv_exit); +#endif EXPORT_SYMBOL(sdioDrv_ConnectBus); EXPORT_SYMBOL(sdioDrv_DisconnectBus); @@ -1245,4 +1294,4 @@ MODULE_DESCRIPTION("TI WLAN SDIO driver"); MODULE_LICENSE("GPL"); MODULE_ALIAS(SDIO_DRIVER_NAME); MODULE_AUTHOR("Texas Instruments Inc"); - +#endif diff --git a/wl1271/external_drivers/zoom2/Linux/sdio/SdioDrv.h b/wl1271/external_drivers/sdio/linux/SdioDrv.h index dc2ccaa9..33837608 100644 --- a/wl1271/external_drivers/zoom2/Linux/sdio/SdioDrv.h +++ b/wl1271/external_drivers/sdio/linux/SdioDrv.h @@ -169,8 +169,6 @@ int sdioDrv_WriteSyncBytes (unsigned int uFunc, void sdioDrv_register_pm(int (*wlanDrvIf_Start)(void), int (*wlanDrvIf_Stop)(void)); -int sdioDrv_init(void); -void sdioDrv_exit(void); int sdioDrv_clk_enable(void); void sdioDrv_clk_disable(void); diff --git a/wl1271/external_drivers/zoom2/Linux/sdio/SdioDrvDbg.h b/wl1271/external_drivers/sdio/linux/SdioDrvDbg.h index 8d2bec55..8d2bec55 100644 --- a/wl1271/external_drivers/zoom2/Linux/sdio/SdioDrvDbg.h +++ b/wl1271/external_drivers/sdio/linux/SdioDrvDbg.h diff --git a/wl1271/external_drivers/zoom2/Linux/sdio/Makefile b/wl1271/external_drivers/zoom2/Linux/sdio/Makefile deleted file mode 100644 index 1b08a961..00000000 --- a/wl1271/external_drivers/zoom2/Linux/sdio/Makefile +++ /dev/null @@ -1,55 +0,0 @@ - -PWD := $(shell pwd) -DK_ROOT = ../../../.. - -EXTRA_CFLAGS += -I$(KERNEL_DIR) -I$(PWD)/$(DK_ROOT)/Txn -I$(PWD)/$(DK_ROOT)/external_drivers/zoom2/Linux/sdio -I$(PWD)/$(DK_ROOT)/platforms/hw/host_platform_zoom2/linux - -SDIO_IN_BAND ?= n -TRACE ?= n -STRIP = n - -ifeq ($(SDIO_IN_BAND),y) -EXTRA_CFLAGS += -DSDIO_IN_BAND_INTERRUPT -endif - -ifeq ($(KERNEL_DEBUGGER),y) - EXTRA_CFLAGS += -g -Os -endif -ifeq ($(DEBUG),y) - EXTRA_CFLAGS += -DSDIO_DEBUG -Os -else - EXTRA_CFLAGS += -Os - STRIP = y -endif - -ifneq ($(KERNELRELEASE),) - -obj-m := sdio.o -ifeq ($(TEST),y) -obj-m += testsdio.o -endif - -sdio-objs := SdioDrv.o -ifeq ($(TEST),y) -testsdio-objs += testdrv.o -endif -else - -PWD := $(shell pwd) -all: - pwd - @echo EXTRA_CFLAGS = $(EXTRA_CFLAGS) - $(MAKE) CROSS_COMPILE=$(CROSS_COMPILE) EXTRA_CFLAGS="$(EXTRA_CFLAGS)" ARCH=$(ARCH) -C $(KERNEL_DIR) M=$(PWD) modules -ifeq ($(STRIP),y) - @echo $(CROSS_COMPILE)strip -g sdio.ko - $(CROSS_COMPILE)strip -g sdio.ko -ifeq ($(TEST),y) - $(CROSS_COMPILE)strip -g testsdio.ko -endif -endif -endif - -clean: - rm -f *.o *~ *.~* core .depend dep - rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions - diff --git a/wl1271/platforms/hw/host_platform_zoom2/linux/SdioAdapter.c b/wl1271/platforms/hw/linux/SdioAdapter.c index a822d110..96f12942 100644 --- a/wl1271/platforms/hw/host_platform_zoom2/linux/SdioAdapter.c +++ b/wl1271/platforms/hw/linux/SdioAdapter.c @@ -1,48 +1,255 @@ /* * SdioAdapter.c * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. + * Copyright(c) 2008 - 2009 Google, Inc. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name Texas Instruments nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - -/** \file SdioAdapter.c - * \brief The SDIO driver adapter. Platform dependent. - * - * An adaptation layer between the lower SDIO driver (in BSP) and the upper SdioBusDrv. +/** \file SdioAdapter.c + * \brief The SDIO driver adapter. Platform dependent. + * + * An adaptation layer between the lower SDIO driver (in BSP) and the upper Sdio * Used for issuing all SDIO transaction types towards the lower SDIO-driver. - * Makes the decision whether to use Sync or Async transaction, and reflects it to the caller + * Makes the decision whether to use Sync or Async transaction, and reflects it * by the return value and calling its callback in case of Async. - * + * * \see SdioAdapter.h, SdioDrv.c & h */ +#ifdef CONFIG_MMC_EMBEDDED_SDIO +#include <linux/kernel.h> +#include <linux/mutex.h> +#include <linux/mmc/core.h> +#include <linux/mmc/card.h> +#include <linux/mmc/sdio_func.h> +#include <linux/mmc/sdio_ids.h> +#include "TxnDefs.h" + +#define TI_SDIO_DEBUG + +#define TIWLAN_MMC_MAX_DMA 8192 + +int wifi_set_carddetect( int on ); + +static struct sdio_func *tiwlan_func = NULL; +static struct completion sdio_wait; + +ETxnStatus sdioAdapt_TransactBytes (unsigned int uFuncId, + unsigned int uHwAddr, + void * pHostAddr, + unsigned int uLength, + unsigned int bDirection, + unsigned int bMore); + +static int sdio_wifi_probe(struct sdio_func *func, + const struct sdio_device_id *id) +{ + int rc; + + printk("%s: %d\n", __FUNCTION__, func->class); + + if (func->class != SDIO_CLASS_WLAN) + return -EINVAL; + + sdio_claim_host(func); + + rc = sdio_enable_func(func); + if (rc) + goto err1; + rc = sdio_set_block_size(func, 512); + + if (rc) { + printk("%s: Unable to set blocksize\n", __FUNCTION__); + goto err2; + } + + tiwlan_func = func; + complete(&sdio_wait); + return 0; +err2: + sdio_disable_func(func); +err1: + sdio_release_host(func); + complete(&sdio_wait); + return rc; +} + +static void sdio_wifi_remove(struct sdio_func *func) +{ +} + +static const struct sdio_device_id sdio_wifi_ids[] = { + { SDIO_DEVICE_CLASS(SDIO_CLASS_WLAN) }, + { }, +}; + +MODULE_DEVICE_TABLE(sdio, sdio_wifi_ids); + +static struct sdio_driver sdio_wifi_driver = { + .probe = sdio_wifi_probe, + .remove = sdio_wifi_remove, + .name = "sdio_wifi", + .id_table = sdio_wifi_ids, +}; + +ETxnStatus sdioAdapt_TransactBytes (unsigned int uFuncId, + unsigned int uHwAddr, + void * pHostAddr, + unsigned int uLength, + unsigned int bDirection, + unsigned int bMore); + +int sdioAdapt_ConnectBus (void * fCbFunc, + void * hCbArg, + unsigned int uBlkSizeShift, + unsigned int uSdioThreadPriority, + unsigned char **pTxDmaSrcAddr) +{ + int rc; + + init_completion(&sdio_wait); + wifi_set_carddetect( 1 ); + rc = sdio_register_driver(&sdio_wifi_driver); + if (rc < 0) { + printk(KERN_ERR "%s: Fail to register sdio_wifi_driver\n", __func__); + return rc; + } + if (!wait_for_completion_timeout(&sdio_wait, msecs_to_jiffies(10000))) { + printk(KERN_ERR "%s: Timed out waiting for device detect\n", __func__); + sdio_unregister_driver(&sdio_wifi_driver); + return -ENODEV; + } + /* Provide the DMA buffer address to the upper layer so it will use it as the transactions host buffer. */ + if (pTxDmaSrcAddr) { /* Dm: check what to do with it */ + *pTxDmaSrcAddr = kmalloc(TIWLAN_MMC_MAX_DMA, GFP_ATOMIC | GFP_DMA); + } + return 0; +} + +int sdioAdapt_DisconnectBus (void) +{ + if (tiwlan_func) { + sdio_disable_func( tiwlan_func ); + sdio_release_host( tiwlan_func ); + } + wifi_set_carddetect( 0 ); + sdio_unregister_driver(&sdio_wifi_driver); + return 0; +} + +ETxnStatus sdioAdapt_TransactBytes (unsigned int uFuncId, + unsigned int uHwAddr, + void * pHostAddr, + unsigned int uLength, + unsigned int bDirection, + unsigned int bMore) +{ + unsigned char *pData = pHostAddr; + unsigned int i; + int rc = 0, final_rc = 0; + + for (i = 0; i < uLength; i++) { + if( bDirection ) { + if (uFuncId == 0) + *pData = (unsigned char)sdio_f0_readb(tiwlan_func, uHwAddr, &rc); + else + *pData = (unsigned char)sdio_readb(tiwlan_func, uHwAddr, &rc); + } + else { + if (uFuncId == 0) + sdio_f0_writeb(tiwlan_func, *pData, uHwAddr, &rc); + else + sdio_writeb(tiwlan_func, *pData, uHwAddr, &rc); + } + if( rc ) { + final_rc = rc; + } +#ifdef TI_SDIO_DEBUG + printk(KERN_INFO "%c52: [0x%x](%u) %c 0x%x\n", (bDirection ? 'R' : 'W'), uHwAddr, uLength, (bDirection ? '=' : '<'), (unsigned)*pData); +#endif + uHwAddr++; + pData++; + } + /* If failed return ERROR, if succeeded return COMPLETE */ + if (final_rc) { + return TXN_STATUS_ERROR; + } + return TXN_STATUS_COMPLETE; +} + +ETxnStatus sdioAdapt_Transact (unsigned int uFuncId, + unsigned int uHwAddr, + void * pHostAddr, + unsigned int uLength, + unsigned int bDirection, + unsigned int bBlkMode, + unsigned int bFixedAddr, + unsigned int bMore) +{ + int rc; + + if (uFuncId == 0) + return sdioAdapt_TransactBytes (uFuncId, uHwAddr, pHostAddr, + uLength, bDirection, bMore); + if (bDirection) { + if (bFixedAddr) + rc = sdio_memcpy_fromio(tiwlan_func, pHostAddr, uHwAddr, uLength); + else + rc = sdio_readsb(tiwlan_func, pHostAddr, uHwAddr, uLength); + + } + else { + if (bFixedAddr) + rc = sdio_memcpy_toio(tiwlan_func, uHwAddr, pHostAddr, uLength); + else + rc = sdio_writesb(tiwlan_func, uHwAddr, pHostAddr, uLength); + } +#ifdef TI_SDIO_DEBUG + if (uLength == 1) + printk(KERN_INFO "%c53: [0x%x](%u) %c 0x%x\n", (bDirection ? 'R' : 'W'), uHwAddr, uLength, (bDirection ? '=' : '<'), (unsigned)(*(char *)pHostAddr)); + else if (uLength == 2) + printk(KERN_INFO "%c53: [0x%x](%u) %c 0x%x\n", (bDirection ? 'R' : 'W'), uHwAddr, uLength, (bDirection ? '=' : '<'), (unsigned)(*(short *)pHostAddr)); + else if (uLength == 4) + printk(KERN_INFO "%c53: [0x%x](%u) %c 0x%x\n", (bDirection ? 'R' : 'W'), uHwAddr, uLength, (bDirection ? '=' : '<'), (unsigned)(*(long *)pHostAddr)); + else + printk(KERN_INFO "%c53: [0x%x](%u) F[%d] B[%d] I[%d] = %d\n", (bDirection ? 'R' : 'W'), uHwAddr, uLength, uFuncId, bBlkMode, bFixedAddr, rc); +#endif + /* If failed return ERROR, if succeeded return COMPLETE */ + if (rc) { + return TXN_STATUS_ERROR; + } + return TXN_STATUS_COMPLETE; +} + +#else + #include "SdioDrvDbg.h" #include "TxnDefs.h" #include "SdioAdapter.h" @@ -58,8 +265,6 @@ static unsigned char *pDmaBufAddr = 0; -int g_ssd_debug_level=4; - /************************************************************************ * Defines ************************************************************************/ @@ -76,7 +281,7 @@ int g_ssd_debug_level=4; /* For block mode configuration */ #define FN0_FBR2_REG_108 0x210 -#define FN0_FBR2_REG_108_BIT_MASK 0xFFF +#define FN0_FBR2_REG_108_BIT_MASK 0xFFF int sdioAdapt_ConnectBus (void * fCbFunc, void * hCbArg, @@ -87,16 +292,16 @@ int sdioAdapt_ConnectBus (void * fCbFunc, unsigned char **pTxDmaBufAddr, unsigned int *pTxDmaBufLen) { - unsigned char uByte; - unsigned long uLong; - unsigned long uCount = 0; - unsigned int uBlkSize = 1 << uBlkSizeShift; - int iStatus; + unsigned char uByte; + unsigned long uLong; + unsigned long uCount = 0; + unsigned int uBlkSize = 1 << uBlkSizeShift; + int iStatus; - if (uBlkSize < SYNC_ASYNC_LENGTH_THRESH) - { - PERR1("%s(): Block-Size should be bigger than SYNC_ASYNC_LENGTH_THRESH!!\n", __FUNCTION__ ); - } + if (uBlkSize < SYNC_ASYNC_LENGTH_THRESH) + { + PERR1("%s(): Block-Size should be bigger than SYNC_ASYNC_LENGTH_THRESH!!\n", __FUNCTION__ ); + } /* Enabling clocks if thet are not enabled */ sdioDrv_clk_enable(); @@ -113,29 +318,30 @@ int sdioAdapt_ConnectBus (void * fCbFunc, /* Init SDIO driver and HW */ iStatus = sdioDrv_ConnectBus (fCbFunc, hCbArg, uBlkSizeShift, uSdioThreadPriority); if (iStatus) { return iStatus; } - - /* Send commands sequence: 0, 5, 3, 7 */ - iStatus = sdioDrv_ExecuteCmd (SD_IO_GO_IDLE_STATE, 0, MMC_RSP_NONE, &uByte, sizeof(uByte)); - if (iStatus) { - printk("%s %d command number: %d failed\n", __FUNCTION__, __LINE__, SD_IO_GO_IDLE_STATE); - return iStatus; - } - iStatus = sdioDrv_ExecuteCmd (SDIO_CMD5, VDD_VOLTAGE_WINDOW, MMC_RSP_R4, &uByte, sizeof(uByte)); - if (iStatus) { - printk("%s %d command number: %d failed\n", __FUNCTION__, __LINE__, SDIO_CMD5); - return iStatus; - } - iStatus = sdioDrv_ExecuteCmd (SD_IO_SEND_RELATIVE_ADDR, 0, MMC_RSP_R6, &uLong, sizeof(uLong)); - if (iStatus) { - printk("%s %d command number: %d failed\n", __FUNCTION__, __LINE__, SD_IO_SEND_RELATIVE_ADDR); - return iStatus; - } - iStatus = sdioDrv_ExecuteCmd (SD_IO_SELECT_CARD, uLong, MMC_RSP_R6, &uByte, sizeof(uByte)); - if (iStatus) { - printk("%s %d command number: %d failed\n", __FUNCTION__, __LINE__, SD_IO_SELECT_CARD); - return iStatus; - } + /* Send commands sequence: 0, 5, 3, 7 */ + iStatus = sdioDrv_ExecuteCmd (SD_IO_GO_IDLE_STATE, 0, MMC_RSP_NONE, &uByte, sizeof(uByte)); + if (iStatus) + { + printk("%s %d command number: %d failed\n", __FUNCTION__, __LINE__, SD_IO_GO_IDLE_STATE); + return iStatus; + } + iStatus = sdioDrv_ExecuteCmd (SDIO_CMD5, VDD_VOLTAGE_WINDOW, MMC_RSP_R4, &uByte, sizeof(uByte)); + if (iStatus) { + printk("%s %d command number: %d failed\n", __FUNCTION__, __LINE__, SDIO_CMD5); + return iStatus; + } + + iStatus = sdioDrv_ExecuteCmd (SD_IO_SEND_RELATIVE_ADDR, 0, MMC_RSP_R6, &uLong, sizeof(uLong)); + if (iStatus) { + printk("%s %d command number: %d failed\n", __FUNCTION__, __LINE__, SD_IO_SEND_RELATIVE_ADDR); + return iStatus; + } + iStatus = sdioDrv_ExecuteCmd (SD_IO_SELECT_CARD, uLong, MMC_RSP_R6, &uByte, sizeof(uByte)); + if (iStatus) { + printk("%s %d command number: %d failed\n", __FUNCTION__, __LINE__, SD_IO_SELECT_CARD); + return iStatus; + } /* NOTE: * ===== @@ -237,7 +443,7 @@ int sdioAdapt_ConnectBus (void * fCbFunc, /* Disable the clocks for now */ sdioDrv_clk_disable(); - return iStatus; + return iStatus; } @@ -321,9 +527,10 @@ ETxnStatus sdioAdapt_TransactBytes (unsigned int uFuncId, unsigned int bDirection, unsigned int bMore) { + static unsigned int lastMore = 0; int iStatus; - if(bMore == 1) + if ((bMore == 1) || (lastMore == bMore)) { sdioDrv_clk_enable(); } @@ -338,10 +545,11 @@ ETxnStatus sdioAdapt_TransactBytes (unsigned int uFuncId, iStatus = sdioDrv_WriteSyncBytes (uFuncId, uHwAddr, pHostAddr, uLength, bMore); } - if(bMore == 0) + if (bMore == 0) { sdioDrv_clk_disable(); } + lastMore = bMore; /* If failed return ERROR, if succeeded return COMPLETE */ if (iStatus) @@ -350,7 +558,4 @@ ETxnStatus sdioAdapt_TransactBytes (unsigned int uFuncId, } return TXN_STATUS_COMPLETE; } - - - - +#endif diff --git a/wl1271/platforms/hw/host_platform_zoom2/linux/SdioAdapter.h b/wl1271/platforms/hw/linux/SdioAdapter.h index dacdcd50..dacdcd50 100644 --- a/wl1271/platforms/hw/host_platform_zoom2/linux/SdioAdapter.h +++ b/wl1271/platforms/hw/linux/SdioAdapter.h diff --git a/wl1271/platforms/hw/host_platform_zoom2/linux/host_platform.c b/wl1271/platforms/hw/linux/host_platform.c index 0d2bc6ab..2f95c6dd 100644 --- a/wl1271/platforms/hw/host_platform_zoom2/linux/host_platform.c +++ b/wl1271/platforms/hw/linux/host_platform.c @@ -33,7 +33,6 @@ #include "tidef.h" #include <linux/kernel.h> #include <asm/io.h> -#include <mach/tc.h> #include <linux/delay.h> #include <linux/platform_device.h> #include <linux/wifi_tiwlan.h> @@ -43,13 +42,8 @@ #include "WlanDrvIf.h" #include "Device1273.h" - -#define OS_API_MEM_ADDR 0x0000000 -#define OS_API_REG_ADDR 0x300000 -#if 0 /* needed for first time new host ramp*/ -static void dump_omap_registers(void); -#endif - +#define OS_API_MEM_ADDR 0x0000000 +#define OS_API_REG_ADDR 0x0300000 #define SDIO_ATTEMPT_LONGER_DELAY_LINUX 150 static struct wifi_platform_data *wifi_control_data = NULL; @@ -59,18 +53,33 @@ static int wifi_probe( struct platform_device *pdev ) { struct wifi_platform_data *wifi_ctrl = (struct wifi_platform_data *)(pdev->dev.platform_data); + /* printk("%s\n", __FUNCTION__); */ wifi_irqres = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "device_wifi_irq"); - +#if 0 + if (wifi_irqres) { + printk("wifi_irqres->start = %lu\n", (unsigned long)(wifi_irqres->start)); + printk("wifi_irqres->flags = %lx\n", wifi_irqres->flags); + } +#endif if( wifi_ctrl ) { wifi_control_data = wifi_ctrl; +#if 0 + if( wifi_ctrl->set_power ) + wifi_ctrl->set_power(1); /* Power On */ + if( wifi_ctrl->set_reset ) + wifi_ctrl->set_reset(0); /* Reset clear */ + if( wifi_ctrl->set_carddetect ) + wifi_ctrl->set_carddetect(1); /* CardDetect (0->1) */ +#endif } return 0; } - + static int wifi_remove( struct platform_device *pdev ) { struct wifi_platform_data *wifi_ctrl = (struct wifi_platform_data *)(pdev->dev.platform_data); + /* printk("%s\n", __FUNCTION__); */ if( wifi_ctrl ) { if( wifi_ctrl->set_carddetect ) wifi_ctrl->set_carddetect(0); /* CardDetect (1->0) */ @@ -94,91 +103,76 @@ static struct platform_driver wifi_device = { static int wifi_add_dev( void ) { + /* printk("%s\n", __FUNCTION__); */ return platform_driver_register( &wifi_device ); } static void wifi_del_dev( void ) { + /* printk("%s\n", __FUNCTION__); */ platform_driver_unregister( &wifi_device ); } int wifi_set_carddetect( int on ) { + /* printk("%s = %d\n", __FUNCTION__, on); */ if( wifi_control_data && wifi_control_data->set_carddetect ) { wifi_control_data->set_carddetect(on); } return 0; } -#if 0 /* Pad configurations are taken care in kernel */ -static void pad_config(unsigned long pad_addr, u32 andmask, u32 ormask) +int wifi_set_power( int on, unsigned long msec ) { - int val; - u32 *addr; - - addr = (u32 *) ioremap(pad_addr, 4); - if (!addr) { - printk(KERN_ERR "OMAP3430_pad_config: ioremap failed with addr %lx\n", pad_addr); - return; + /* printk("%s = %d\n", __FUNCTION__, on); */ + if( wifi_control_data && wifi_control_data->set_power ) { + wifi_control_data->set_power(on); } - - val = __raw_readl(addr); - val &= andmask; - val |= ormask; - __raw_writel(val, addr); - - iounmap(addr); + else { + gpio_set_value(PMENA_GPIO, on); + } + if( msec ) + mdelay(msec); + return 0; } -#endif -static int OMAP3430_TNETW_Power(int power_on) +int wifi_set_reset( int on, unsigned long msec ) { - if (power_on) { - gpio_set_value(PMENA_GPIO, 1); - } else { - gpio_set_value(PMENA_GPIO, 0); + /* printk("%s = %d\n", __FUNCTION__, on); */ + if( wifi_control_data && wifi_control_data->set_reset ) { + wifi_control_data->set_reset(on); } - - return 0; + if( msec ) + mdelay(msec); + return 0; } /*----------------------------------------------------------------------------- -Routine Name: - hPlatform_hardResetTnetw -Routine Description: - set the GPIO to low after awaking the TNET from ELP. -Arguments: - OsContext - our adapter context. -Return Value: - None +Routine Name: hPlatform_hardResetTnetw +Routine Description: set the GPIO to low after awaking the TNET from ELP. +Arguments: None +Return Value: 0 - Ok -----------------------------------------------------------------------------*/ -int hPlatform_hardResetTnetw(void) +int hPlatform_hardResetTnetw( void ) { - int err; - - /* Turn power OFF*/ - if ((err = OMAP3430_TNETW_Power(0)) == 0) - { - mdelay(500); - /* Turn power ON*/ - err = OMAP3430_TNETW_Power(1); - mdelay(50); - } - return err; + int err; + /* Turn power OFF */ + if ((err = wifi_set_power(0, 15)) == 0) { + /* Turn power ON*/ + err = wifi_set_power(1, 70); + } + return err; } /* hPlatform_hardResetTnetw() */ /* Turn device power off */ -int hPlatform_DevicePowerOff (void) +int hPlatform_DevicePowerOff( void ) { - int err; - - err = OMAP3430_TNETW_Power(0); - - mdelay(10); - - return err; + int err; + + err = wifi_set_power(0, 15); + return err; } @@ -187,39 +181,39 @@ int hPlatform_DevicePowerOffSetLongerDelay(void) { int err; - err = OMAP3430_TNETW_Power(0); - - mdelay(SDIO_ATTEMPT_LONGER_DELAY_LINUX); + err = wifi_set_power(0, SDIO_ATTEMPT_LONGER_DELAY_LINUX); return err; } - /* Turn device power on */ -int hPlatform_DevicePowerOn (void) +int hPlatform_DevicePowerOn( void ) { - int err; - - err = OMAP3430_TNETW_Power(1); - - /* New Power Up Sequence */ - mdelay(15); - err = OMAP3430_TNETW_Power(0); - mdelay(1); + int err; - err = OMAP3430_TNETW_Power(1); - - /* Should not be changed, 50 msec cause failures */ - mdelay(70); - - return err; + wifi_set_power(1, 15); /* Fixed power sequence */ + wifi_set_power(0, 1); + /* Should not be changed, 50 msec cause failures */ + err = wifi_set_power(1, 70); + return err; } -/*--------------------------------------------------------------------------------------*/ +/*---------------------------------------------------------------------------*/ -int hPlatform_Wlan_Hardware_Init(void) +int hPlatform_Wlan_Hardware_Init(void *tnet_drv) { + TWlanDrvIfObj *drv = tnet_drv; + + printk("%s\n", __FUNCTION__); wifi_add_dev(); + if (wifi_irqres) { + drv->irq = wifi_irqres->start; + drv->irq_flags = wifi_irqres->flags & IRQF_TRIGGER_MASK; + } + else { + drv->irq = TNETW_IRQ; + drv->irq_flags = (unsigned long)IRQF_TRIGGER_FALLING; + } return 0; } @@ -237,47 +231,41 @@ Arguments: tnet_drv - Golbal Tnet driver pointer. - Return Value: status -----------------------------------------------------------------------------*/ -int hPlatform_initInterrupt(void *tnet_drv, void* handle_add ) +int hPlatform_initInterrupt( void *tnet_drv, void* handle_add ) { TWlanDrvIfObj *drv = tnet_drv; int rc; - + if (drv->irq == 0 || handle_add == NULL) { print_err("hPlatform_initInterrupt() bad param drv->irq=%d handle_add=0x%x !!!\n",drv->irq,(int)handle_add); return -EINVAL; } - - if ((rc = request_irq(drv->irq, handle_add, IRQF_TRIGGER_FALLING, drv->netdev->name, drv))) + printk("drv->irq = %u, %lx\n", drv->irq, drv->irq_flags); + if ((rc = request_irq(drv->irq, handle_add, drv->irq_flags, drv->netdev->name, drv))) { print_err("TIWLAN: Failed to register interrupt handler\n"); - gpio_free(IRQ_GPIO); return rc; } - - set_irq_wake(drv->irq, 1); - - /* - * request_gpio and gpio_direction are now taken care in kernel - * File: arch/arm/mach-omap2/board-zoom2-wifi.c - */ - + set_irq_wake(drv->irq, 1); return rc; } /* hPlatform_initInterrupt() */ /*--------------------------------------------------------------------------------------*/ -void hPlatform_freeInterrupt(void) +void hPlatform_freeInterrupt( void *tnet_drv ) { - /* gpio_free(IRQ_GPIO); */ + TWlanDrvIfObj *drv = tnet_drv; + + set_irq_wake(drv->irq, 0); + free_irq(drv->irq, drv); } /**************************************************************************************** @@ -291,12 +279,9 @@ RETURN: NOTES: *****************************************************************************************/ -void* -hPlatform_hwGetRegistersAddr( - TI_HANDLE OsContext - ) +void *hPlatform_hwGetRegistersAddr(TI_HANDLE OsContext) { - return (void*)OS_API_REG_ADDR; + return (void *)OS_API_REG_ADDR; } /**************************************************************************************** @@ -310,31 +295,13 @@ RETURN: NOTES: *****************************************************************************************/ -void* -hPlatform_hwGetMemoryAddr( - TI_HANDLE OsContext - ) +void *hPlatform_hwGetMemoryAddr(TI_HANDLE OsContext) { - return (void*)OS_API_MEM_ADDR; + return (void *)OS_API_MEM_ADDR; } void hPlatform_Wlan_Hardware_DeInit(void) { - /* gpio_free(PMENA_GPIO); */ wifi_del_dev(); } - -#if 0/* needed for first time new host ramp*/ -static void dump_omap_registers(void) -{ - printk(KERN_ERR "MMC3 CMD addr 0x%x value is =%x\n", CONTROL_PADCONF_MMC3_CMD, omap_readl( CONTROL_PADCONF_MMC3_CMD )); - printk(KERN_ERR "MMC3 CLK addr 0x%x value is =%x\n", CONTROL_PADCONF_MMC3_CLK, omap_readl( CONTROL_PADCONF_MMC3_CLK )); - printk(KERN_ERR "MMC3 DAT0 addr 0x%x value is =%x\n", CONTROL_PADCONF_MMC3_DAT0, omap_readl( CONTROL_PADCONF_MMC3_DAT0 )); - printk(KERN_ERR "MMC3 DAT2 addr 0x%x value is =%x\n", CONTROL_PADCONF_MMC3_DAT2, omap_readl( CONTROL_PADCONF_MMC3_DAT2 )); - printk(KERN_ERR "MMC3 DAT3 addr 0x%x value is =%x\n", CONTROL_PADCONF_MMC3_DAT3, omap_readl( CONTROL_PADCONF_MMC3_DAT3 )); - printk(KERN_ERR "WLAN_EN addr 0x%x value is =%x\n", CONTROL_PADCONF_CAM_D1, omap_readl( CONTROL_PADCONF_CAM_D1 )); - printk(KERN_ERR "WLAN_IRQ addr 0x%x value is =%x\n", CONTROL_PADCONF_MCBSP1_CLKX, omap_readl( CONTROL_PADCONF_MCBSP1_CLKX )); - return; -} -#endif diff --git a/wl1271/platforms/hw/host_platform_zoom2/linux/host_platform.h b/wl1271/platforms/hw/linux/host_platform.h index 2dd29d29..362267e8 100644 --- a/wl1271/platforms/hw/host_platform_zoom2/linux/host_platform.h +++ b/wl1271/platforms/hw/linux/host_platform.h @@ -44,29 +44,41 @@ #include <mach/hardware.h> -#define OMAP_HSMMC3_BASE 0x480AD000 //0x480b4000 +//OMAP343X_CTRL_BASE = 0x48002000 -#define CONTROL_PADCONF_CAM_D1 0x48002118 /* WLAN_EN */ -#define CONTROL_PADCONF_MCBSP1_CLKX 0x48002198 /* WLAN_IRQ */ +#define OMAP_HSMMC1_BASE 0x4809C000 +#define OMAP_HSMMC2_BASE 0x480B4000 +#define OMAP_HSMMC3_BASE 0x480AD000 -#define CONTROL_PADCONF_MMC3_CLK 0x480025D8 /* mmc3_cmd */ -#define CONTROL_PADCONF_MMC3_CMD 0x480021D0 /* mmc3_cmd */ +#if 0 +#define CONTROL_PADCONF_CAM_D1 0x48002118 /* WLAN_EN */ +#define CONTROL_PADCONF_MCBSP1_CLKX 0x48002198 /* WLAN_IRQ */ +#define CONTROL_PADCONF_MMC3_CLK 0x480025D8 /* mmc3_cmd */ +#define CONTROL_PADCONF_MMC3_CMD 0x480021D0 /* mmc3_cmd */ -#define CONTROL_PADCONF_MMC3_DAT0 0x480025E4 /* mmc3_dat0, mmc3_dat1 */ -#define CONTROL_PADCONF_MMC3_DAT2 0x480025E8 /* mmc3_dat2 */ -#define CONTROL_PADCONF_MMC3_DAT3 0x480025E0 /* mmc3_dat3 */ - +#define CONTROL_PADCONF_MMC3_DAT0 0x480025E4 /* mmc3_dat0, mmc3_dat1 */ +#define CONTROL_PADCONF_MMC3_DAT2 0x480025E8 /* mmc3_dat2 */ +#define CONTROL_PADCONF_MMC3_DAT3 0x480025E0 /* mmc3_dat3 */ +#endif +#define INT_MMC2_IRQ 86 +#define INT_MMC3_IRQ 94 +/* Zoom2 */ #define PMENA_GPIO 101 #define IRQ_GPIO 162 -#define MUXMODE_3 3 +/* Sholes */ +/* +#define PMENA_GPIO 186 +#define IRQ_GPIO 65 +*/ + #define TNETW_IRQ (OMAP_GPIO_IRQ(IRQ_GPIO)) -#define TIWLAN_IRQ_POLL_INTERVAL HZ/100 -#define HZ_IN_MSEC HZ/1000 -#define TIWLAN_IRQ_POLL_INTERVAL_MS TIWLAN_IRQ_POLL_INTERVAL/HZ_IN_MSEC +#define TIWLAN_IRQ_POLL_INTERVAL HZ/100 +#define HZ_IN_MSEC HZ/1000 +#define TIWLAN_IRQ_POLL_INTERVAL_MS TIWLAN_IRQ_POLL_INTERVAL/HZ_IN_MSEC int hPlatform_initInterrupt( @@ -84,10 +96,10 @@ hPlatform_hwGetMemoryAddr( TI_HANDLE OsContext ); -void hPlatform_freeInterrupt(void); +void hPlatform_freeInterrupt(void *tnet_drv); int hPlatform_hardResetTnetw(void); -int hPlatform_Wlan_Hardware_Init(void); +int hPlatform_Wlan_Hardware_Init(void *tnet_drv); void hPlatform_Wlan_Hardware_DeInit(void); int hPlatform_DevicePowerOff(void); int hPlatform_DevicePowerOffSetLongerDelay(void); diff --git a/wl1271/platforms/os/common/inc/osApi.h b/wl1271/platforms/os/common/inc/osApi.h index 46d2e4c0..4787a75f 100644 --- a/wl1271/platforms/os/common/inc/osApi.h +++ b/wl1271/platforms/os/common/inc/osApi.h @@ -529,7 +529,6 @@ void os_protectLock (TI_HANDLE OsContext, TI_HANDLE ProtectContext); */ void os_protectUnlock (TI_HANDLE OsContext, TI_HANDLE ProtectContext); - /* Wakelock functionality */ int os_wake_lock (TI_HANDLE OsContext); int os_wake_unlock (TI_HANDLE OsContext); @@ -539,7 +538,6 @@ int os_wake_lock_timeout_enable (TI_HANDLE OsContext); #define os_profile(hos,fn,par) - /**************************************************************************************** START OF GWSI DRIVER API *****************************************************************************************/ diff --git a/wl1271/platforms/os/common/src/osRgstry.c b/wl1271/platforms/os/common/src/osRgstry.c index 27c88136..736d8726 100644 --- a/wl1271/platforms/os/common/src/osRgstry.c +++ b/wl1271/platforms/os/common/src/osRgstry.c @@ -78,21 +78,21 @@ NDIS_STRING STRGroup_addr7 = NDIS_STRING_CONST( "Group_addr7" ); /* If Early Wakeup is Enabled, 1251 wakes-up EARLY_WAKEUP_TIME before expected Beacon reception occasion */ /* If Early Wakeup is Disabled, 1251 wakes-up at the expected Beacon reception occasion. */ NDIS_STRING STREarlyWakeup = NDIS_STRING_CONST( "EarlyWakeup" ); - + NDIS_STRING STRArp_Ip_Addr = NDIS_STRING_CONST( "ArpIp_Addr" ); NDIS_STRING STRArp_Ip_Filter_Ena = NDIS_STRING_CONST( "ArpIp_Filter_ena"); -NDIS_STRING STRBeaconFilterDesiredState = NDIS_STRING_CONST( "Beacon_Filter_Desired_State") ; -NDIS_STRING STRBeaconFilterStored = NDIS_STRING_CONST( "Beacon_Filter_Stored") ; +NDIS_STRING STRBeaconFilterDesiredState = NDIS_STRING_CONST( "Beacon_Filter_Desired_State"); +NDIS_STRING STRBeaconFilterStored = NDIS_STRING_CONST( "Beacon_Filter_Stored"); /*this is for configuring table from ini file*/ -NDIS_STRING STRBeaconIETableSize = NDIS_STRING_CONST( "Beacon_IE_Table_Size") ; +NDIS_STRING STRBeaconIETableSize = NDIS_STRING_CONST( "Beacon_IE_Table_Size"); NDIS_STRING STRBeaconIETable = NDIS_STRING_CONST( "Beacon_IE_Table") ; -NDIS_STRING STRBeaconIETableNumOfElem = NDIS_STRING_CONST( "Beacon_IE_Num_Of_Elem") ; +NDIS_STRING STRBeaconIETableNumOfElem = NDIS_STRING_CONST( "Beacon_IE_Num_Of_Elem"); -NDIS_STRING STRCoexActivityTable = NDIS_STRING_CONST( "Coex_Activity_Table") ; -NDIS_STRING STRCoexActivityNumOfElem = NDIS_STRING_CONST( "Coex_Activity_Num_Of_Elem") ; +NDIS_STRING STRCoexActivityTable = NDIS_STRING_CONST( "Coex_Activity_Table"); +NDIS_STRING STRCoexActivityNumOfElem = NDIS_STRING_CONST( "Coex_Activity_Num_Of_Elem"); /* ------------------------------------------------------ */ NDIS_STRING STRFirmwareDebug = NDIS_STRING_CONST( "FirmwareDebug" ); @@ -141,7 +141,7 @@ NDIS_STRING STRdot11MaxTxMSDULifetime = NDIS_STRING_CONST( "dot11MaxTransm NDIS_STRING STRdot11MaxReceiveLifetime = NDIS_STRING_CONST( "dot11MaxReceiveLifetime" ); NDIS_STRING STRdot11RateFallBackRetryLimit = NDIS_STRING_CONST( "dot11RateFallBackRetryLimit"); -NDIS_STRING STRReAuthActivePriority = NDIS_STRING_CONST( "ReAuthActivePriority" ); +NDIS_STRING STRReAuthActivePriority = NDIS_STRING_CONST( "ReAuthActivePriority" ); NDIS_STRING STRListenInterval = NDIS_STRING_CONST( "dot11ListenInterval" ); NDIS_STRING STRExternalMode = NDIS_STRING_CONST( "DriverExternalMode" ); @@ -226,12 +226,11 @@ NDIS_STRING STRdot11WEPDefaultKeyID = NDIS_STRING_CONST( "dot11WEPDefaul NDIS_STRING STRMixedMode = NDIS_STRING_CONST( "MixedMode" ); -NDIS_STRING STRWPAMixedMode = NDIS_STRING_CONST( "WPAMixedMode"); -NDIS_STRING STRRSNPreAuth = NDIS_STRING_CONST( "RSNPreAuthentication"); -NDIS_STRING STRRSNPreAuthTimeout = NDIS_STRING_CONST( "RSNPreAuthTimeout" ); - +NDIS_STRING STRWPAMixedMode = NDIS_STRING_CONST( "WPAMixedMode"); +NDIS_STRING STRRSNPreAuth = NDIS_STRING_CONST( "RSNPreAuthentication"); +NDIS_STRING STRRSNPreAuthTimeout = NDIS_STRING_CONST( "RSNPreAuthTimeout" ); -NDIS_STRING STRPairwiseMicFailureFilter = NDIS_STRING_CONST( "PairwiseMicFailureFilter" ); +NDIS_STRING STRPairwiseMicFailureFilter = NDIS_STRING_CONST( "PairwiseMicFailureFilter" ); NDIS_STRING STRTimeToResetCountryMs = NDIS_STRING_CONST( "TimeToResetCountryMs" ); NDIS_STRING STRMultiRegulatoryDomainEnabled = NDIS_STRING_CONST( "MultiRegulatoryDomain" ); @@ -298,7 +297,7 @@ NDIS_STRING STRTriggeredScanTimeOut = NDIS_STRING_CONST( "Tr /*-----------------------------------*/ /* Coexistence params */ /*-----------------------------------*/ -NDIS_STRING STRBThWlanCoexistEnable = NDIS_STRING_CONST( "BThWlanCoexistEnable" ); +NDIS_STRING STRBThWlanCoexistEnable = NDIS_STRING_CONST( "BThWlanCoexistEnable" ); NDIS_STRING STRBThWlanCoexistPerThreshold = NDIS_STRING_CONST( "coexBtPerThreshold" ); NDIS_STRING STRBThWlanCoexistHv3MaxOverride = NDIS_STRING_CONST( "coexHv3MaxOverride" ); @@ -355,8 +354,6 @@ NDIS_STRING STRBThWlanCoexTemp3 = NDIS_STRING_CONST( "coexTempParam3" ); NDIS_STRING STRBThWlanCoexTemp4 = NDIS_STRING_CONST( "coexTempParam4" ); NDIS_STRING STRBThWlanCoexTemp5 = NDIS_STRING_CONST( "coexTempParam5" ); - - NDIS_STRING STRDisableSsidPending = NDIS_STRING_CONST( "DisableSsidPending" ); /*-----------------------------------*/ @@ -630,7 +627,7 @@ NDIS_STRING STRRxDataFiltersFilter4Mask = NDIS_STRING_CONST("RxDataFilte NDIS_STRING STRRxDataFiltersFilter4Pattern = NDIS_STRING_CONST("RxDataFilters_Filter4Pattern"); -NDIS_STRING STRReAuthActiveTimeout = NDIS_STRING_CONST( "ReAuthActiveTimeout" ); +NDIS_STRING STRReAuthActiveTimeout = NDIS_STRING_CONST( "ReAuthActiveTimeout" ); /*--------------------------- Measurement parameters @@ -661,7 +658,7 @@ NDIS_STRING STRstationMacAddress = NDIS_STRING_CONST("dot11Statio NDIS_STRING SendINIBufferToUser = NDIS_STRING_CONST("SendINIBufferToUserMode"); /*------------------------------------------- - RSSI/SNR Weights for Average calculations + RSSI/SNR Weights for Average calculations --------------------------------------------*/ NDIS_STRING STRRssiBeaconAverageWeight = NDIS_STRING_CONST("RssiBeaconAverageWeight"); @@ -769,21 +766,21 @@ NDIS_STRING STRFmCoexSwallowClkDif = NDIS_STRING_CONST("FmCoexSwallowClkD /*----------------------------------------*/ -NDIS_STRING STRRateMngRateRetryScore = NDIS_STRING_CONST("RateMngRateRetryScore"); -NDIS_STRING STRRateMngPerAdd = NDIS_STRING_CONST("RateMngPerAdd"); -NDIS_STRING STRRateMngPerTh1 = NDIS_STRING_CONST("RateMngPerTh1"); -NDIS_STRING STRRateMngPerTh2 = NDIS_STRING_CONST("RateMngPerTh2"); -NDIS_STRING STRRateMngMaxPer = NDIS_STRING_CONST("RateMngMaxPer"); -NDIS_STRING STRRateMngInverseCuriosityFactor = NDIS_STRING_CONST("RateMngInverseCuriosityFactor"); -NDIS_STRING STRRateMngTxFailLowTh = NDIS_STRING_CONST("RateMngTxFailLowTh"); -NDIS_STRING STRRateMngTxFailHighTh = NDIS_STRING_CONST("RateMngTxFailHighTh"); -NDIS_STRING STRRateMngPerAlphaShift = NDIS_STRING_CONST("RateMngPerAlphaShift"); -NDIS_STRING STRRateMngPerAddShift = NDIS_STRING_CONST("RateMngPerAddShift"); -NDIS_STRING STRRateMngPerBeta1Shift = NDIS_STRING_CONST("RateMngPerBeta1Shift"); -NDIS_STRING STRRateMngPerBeta2Shift = NDIS_STRING_CONST("RateMngPerBeta2Shift"); -NDIS_STRING STRRateMngRateCheckUp = NDIS_STRING_CONST("RateMngRateCheckUp"); -NDIS_STRING STRRateMngRateCheckDown = NDIS_STRING_CONST("RateMngRateCheckDown"); -NDIS_STRING STRRateMngRateRetryPolicy = NDIS_STRING_CONST("RateMngRateRetryPolicy"); +NDIS_STRING STRRateMngRateRetryScore = NDIS_STRING_CONST("RateMngRateRetryScore"); +NDIS_STRING STRRateMngPerAdd = NDIS_STRING_CONST("RateMngPerAdd"); +NDIS_STRING STRRateMngPerTh1 = NDIS_STRING_CONST("RateMngPerTh1"); +NDIS_STRING STRRateMngPerTh2 = NDIS_STRING_CONST("RateMngPerTh2"); +NDIS_STRING STRRateMngMaxPer = NDIS_STRING_CONST("RateMngMaxPer"); +NDIS_STRING STRRateMngInverseCuriosityFactor = NDIS_STRING_CONST("RateMngInverseCuriosityFactor"); +NDIS_STRING STRRateMngTxFailLowTh = NDIS_STRING_CONST("RateMngTxFailLowTh"); +NDIS_STRING STRRateMngTxFailHighTh = NDIS_STRING_CONST("RateMngTxFailHighTh"); +NDIS_STRING STRRateMngPerAlphaShift = NDIS_STRING_CONST("RateMngPerAlphaShift"); +NDIS_STRING STRRateMngPerAddShift = NDIS_STRING_CONST("RateMngPerAddShift"); +NDIS_STRING STRRateMngPerBeta1Shift = NDIS_STRING_CONST("RateMngPerBeta1Shift"); +NDIS_STRING STRRateMngPerBeta2Shift = NDIS_STRING_CONST("RateMngPerBeta2Shift"); +NDIS_STRING STRRateMngRateCheckUp = NDIS_STRING_CONST("RateMngRateCheckUp"); +NDIS_STRING STRRateMngRateCheckDown = NDIS_STRING_CONST("RateMngRateCheckDown"); +NDIS_STRING STRRateMngRateRetryPolicy = NDIS_STRING_CONST("RateMngRateRetryPolicy"); NDIS_STRING STRincludeWSCinProbeReq = NDIS_STRING_CONST("IncludeWSCinProbeReq"); @@ -820,7 +817,7 @@ static void assignRegValue(TI_UINT32* lValue, PNDIS_CONFIGURATION_PARAMETER ndis static void parse_filter_request(TRxDataFilterRequest* request, TI_UINT8 offset, char * mask, TI_UINT8 maskLength, char * pattern, TI_UINT8 patternLength); -void regReadIntegerParameter ( +static void regReadIntegerParameter ( TWlanDrvIfObjPtr pAdapter, PNDIS_STRING pParameterName, TI_UINT32 defaultValue, @@ -913,7 +910,7 @@ static TI_UINT32 tiwlnstrtoi_hex (TI_UINT8 *num, TI_UINT32 length) break; } } - + return value; } @@ -923,8 +920,8 @@ Routine Name: regConvertStringtoMACAddress -Routine Description: Converts the MAC Adrress in a form of string readen from the Registry -to the MAC Address Array to be stored in the init_table struct +Routine Description: Converts the MAC Adrress in a form of string readen from the Registry +to the MAC Address Array to be stored in the init_table struct Arguments: @@ -935,29 +932,35 @@ Return Value: None -----------------------------------------------------------------------------*/ -static void regConvertStringtoMACAddress(TI_UINT8 *staMACAddressString,TI_UINT8 *MacAddressArray) +static void regConvertStringtoMACAddress(TI_UINT8 *staMACAddressString, TI_UINT8 *MacAddressArray) { char *ptr; TI_UINT8 *tmpMacAddr; - TI_UINT8 value=0,value_l,value_h,add_value; + TI_UINT8 value = 0, value_l, value_h, add_value; int i, str_len; /* Take the pointer to the string MAC Address to convert it to the Array MAC Address */ - ptr=(char *)staMACAddressString; + ptr = (char *)staMACAddressString; tmpMacAddr = MacAddressArray; - str_len = 3 * MAC_ADDR_LEN - 1; /* Each value includes two digits and a space so multpily by 3 */ + str_len = 3 * MAC_ADDR_LEN - 1; - for (i = 0; i < MAC_ADDR_LEN; ptr++, str_len--) + for(i=0;(i < MAC_ADDR_LEN);ptr++,str_len--) { - /* The value can be "0-9" or from "a-f" */ - value_l = *ptr - '0'; - value_h = *ptr - 'a'; + if (str_len > 0) { + /* The value can be or "0-9" or from "a-f" */ + value_l = (*ptr - '0'); + value_h = (*ptr - 'a'); + } + else { /* last element */ + value_l = value_h = 16; + } + /*PRINTF(DBG_REGISTRY,("value_l [%d] value_h [%d] *ptr %c value %d\n",value_l,value_h,*ptr,value));*/ - if ((str_len > 0) && ((value_l <= 9) || (value_h <= 15 ))) + if( (value_l <= 9) || (value_h <= 15 ) ) { /* We are in an expected range */ /* Check if 0-9 */ - if (value_l <= 9) + if(value_l <= 9 ) { add_value = value_l; } @@ -967,7 +970,7 @@ static void regConvertStringtoMACAddress(TI_UINT8 *staMACAddressString,TI_UINT8 /* 'a' is in fact 10 decimal in hexa */ add_value = value_h + 10; } - value = value * 16 + add_value; + value = value * 16 + add_value; } else { @@ -979,7 +982,6 @@ static void regConvertStringtoMACAddress(TI_UINT8 *staMACAddressString,TI_UINT8 } - /*----------------------------------------------------------------------------- Routine Name: @@ -1003,87 +1005,66 @@ regFillInitTable( void* pInitTable ) { - TI_UINT8 bssidBroadcast[MAC_ADDR_LEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - char dummySsidString[MAX_SSID_LEN]; - - TI_UINT8 *ClsfrIp = "0a 03 01 c9"; - TI_UINT8 ClsfrIpString[16]; - TI_UINT8 ClsfrIpStringSize; - - /* EEPROM-less : MAC address */ - TI_UINT8 regMACstrLen = REG_MAC_ADDR_STR_LEN; - TI_UINT8 staMACAddress[REG_MAC_ADDR_STR_LEN]; - TI_UINT8 defStaMacAddress0[]= "00 22 11 33 44 55"; - TI_UINT8 defStaMacAddress1[]= "11 11 12 13 14 15"; - TI_UINT8 defStaMacAddress2[]= "12 21 22 23 24 25"; - TI_UINT8 defStaMacAddress3[]= "13 31 32 33 34 35"; - TI_UINT8 defStaMacAddress4[]= "14 41 42 43 44 45"; - TI_UINT8 defStaMacAddress5[]= "15 51 52 53 54 55"; - TI_UINT8 defStaMacAddress6[]= "16 61 62 63 64 65"; - TI_UINT8 defStaMacAddress7[]= "17 71 72 73 74 75"; - - - TI_UINT8 regArpIpStrLen = REG_ARP_IP_ADDR_STR_LEN ; - TI_UINT8 staArpIpAddress[REG_ARP_IP_ADDR_STR_LEN]; - TI_UINT8 defArpIpAddress[] = "0a 00 00 0a" ; /*value by default*/ + static TI_UINT8 *ClsfrIp = "0a 03 01 c9"; + static TI_UINT8 ClsfrIpString[16]; + static TI_UINT8 ClsfrIpStringSize; + + /* EEPROM-less : MAC address */ + static TI_UINT8 regMACstrLen = REG_MAC_ADDR_STR_LEN; + static TI_UINT8 staMACAddress[REG_MAC_ADDR_STR_LEN]; + static TI_UINT8 defStaMacAddress0[]= "00 22 11 33 44 55"; + static TI_UINT8 regArpIpStrLen = REG_ARP_IP_ADDR_STR_LEN; + static TI_UINT8 staArpIpAddress[REG_ARP_IP_ADDR_STR_LEN]; + static TI_UINT8 defArpIpAddress[] = "0a 00 00 0a" ; /*value by default*/ /*defaults values for beacon IE table*/ /*TI_UINT8 defBeaconIETableSize = 0 ;*/ - TI_UINT8 defBeaconIETable[] = "00 01 01 01 32 01 2a 01 03 01 06 01 07 01 20 01 25 01 23 01 30 01 28 01 2e 01 3d 01 85 01 dd 01 00 52 f2 02 00 01"; + static TI_UINT8 defBeaconIETable[] = "00 01 01 01 32 01 2a 01 03 01 06 01 07 01 20 01 25 01 23 01 30 01 28 01 2e 01 3d 01 85 01 dd 01 00 52 f2 02 00 01"; /*TI_UINT8 tmpIeTable[BEACON_FILTER_TABLE_MAX_SIZE] ;*/ - TI_UINT8 staBeaconFilterIETable[BEACON_FILTER_STRING_MAX_LEN] ; - TI_UINT8 tmpIeTableSize = 37; - TI_UINT8 strSize = 113; - - TI_UINT8 defRxRssiAndProcessCompensation_2_4G[] = "ec,f6,00,0c,18,f8,fc,00,08,10,f0,f8,00,0a,14"; - TI_UINT8 tmpRssiTableSize = RSSI_AND_PROCESS_COMPENSATION_TABLE_SIZE; - TI_UINT8 staRssiAndProcessCompensation[RSSI_AND_PROCESS_COMPENSATION_TABLE_SIZE] ; - TI_UINT8 RssiSize = 113; + static TI_UINT8 tmpIeTableSize = 37; + static TI_UINT8 strSize = 113; + static TI_UINT8 defRxRssiAndProcessCompensation_2_4G[] = "ec,f6,00,0c,18,f8,fc,00,08,10,f0,f8,00,0a,14"; + static TI_UINT8 tmpRssiTableSize = RSSI_AND_PROCESS_COMPENSATION_TABLE_SIZE; + static TI_UINT8 staRssiAndProcessCompensation[RSSI_AND_PROCESS_COMPENSATION_TABLE_SIZE] ; + static TI_UINT8 RssiSize = 44; /* defaults values for CoexActivity table*/ /* example: WLAN(0), BT_VOICE(0), defPrio(20), raisePrio(25), minServ(0), maxServ(1ms) */ - TI_UINT8 defCoexActivityTable[] = ""; /* Sample "01 00 14 19 0000 0001 " */ - TI_UINT8 strCoexActivityTable[COEX_ACTIVITY_TABLE_MAX_NUM*COEX_ACTIVITY_TABLE_SIZE] ; - TI_UINT8 strCoexActivitySize = 0; - - TI_UINT32 filterOffset = 0; - char filterMask[16]; - TI_UINT8 filterMaskLength; - char filterPattern[16]; - TI_UINT8 filterPatternLength; - - TInitTable* p = (TInitTable*) pInitTable; - USHORT tableLen = 0; - USHORT loopIndex = 0; - TI_UINT8 ScanControlTable24Tmp[2 * NUM_OF_CHANNELS_24]; - TI_UINT8 ScanControlTable5Tmp[2 * NUM_OF_CHANNELS_5]; - TI_UINT8 ScanControlTable24Def[2* NUM_OF_CHANNELS_24] = "FFFFFFFFFFFFFFFFFFFFFFFFFFFF"; - TI_UINT8 ScanControlTable5Def[2 * NUM_OF_CHANNELS_5] = "FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF0000000000000000000000000000000000000000000000000000000000000000000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF0000000000000000FF000000FF000000FF000000FF000000FF000000000000000000000000000000"; - TI_UINT8 reportSeverityTableDefaults[REPORT_SEVERITY_MAX] = "0001101"; - TI_UINT8 reportModuleTableDefaults[REPORT_FILES_NUM]; - TI_UINT16 reportSeverityTableLen; - TI_UINT16 reportModuleTableLen; - - TI_UINT8 uSmeTempList[ 255 ]; - TI_UINT32 uSmeScanIntervalsTempList[ 255 ]; - TI_UINT32 uTempEntriesCount, uSmeGChannelsCount, uIndex; - TI_UINT32 uWiFiMode = 0; - TI_INT8 SRConfigParams[MAX_SMART_REFLEX_PARAM]; - TI_UINT32 len,TempSRCnt; - TI_UINT8 uTempRatePolicyList[RATE_MNG_MAX_RETRY_POLICY_PARAMS_LEN]; - TI_UINT32 uTempRatePolicyCnt=0; - - int macIndex ; /*used for group address filtering*/ + static TI_UINT8 defCoexActivityTable[] = ""; /* Sample "01 00 14 19 0000 0001 " */ + + static TI_UINT32 filterOffset = 0; + static char filterMask[16]; + static TI_UINT8 filterMaskLength; + static char filterPattern[16]; + static TI_UINT8 filterPatternLength; + + static USHORT tableLen = 0; + static USHORT loopIndex = 0; + static TI_UINT8 ScanControlTable24Tmp[2 * NUM_OF_CHANNELS_24]; + static TI_UINT8 ScanControlTable5Tmp[2 * NUM_OF_CHANNELS_5]; + static TI_UINT8 ScanControlTable24Def[2* NUM_OF_CHANNELS_24] = "FFFFFFFFFFFFFFFFFFFFFFFFFFFF"; + static TI_UINT8 ScanControlTable5Def[2 * NUM_OF_CHANNELS_5] = "FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF0000000000000000000000000000000000000000000000000000000000000000000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF0000000000000000FF000000FF000000FF000000FF000000FF000000000000000000000000000000"; + static TI_UINT8 reportSeverityTableDefaults[REPORT_SEVERITY_MAX+1] = "00001101"; + static TI_UINT16 reportSeverityTableLen; + + static TI_UINT32 uWiFiMode = 0; + static TI_INT8 SRConfigParams[14]; + static TI_UINT8 len,TempSRCnt; + static TI_UINT8 uTempRatePolicyList[RATE_MNG_MAX_RETRY_POLICY_PARAMS_LEN]; + static TI_UINT32 uTempRatePolicyCnt=0; + + TInitTable *p = (TInitTable *)pInitTable; + TI_UINT32 uTempEntriesCount, uIndex; PRINT(DBG_REGISTRY_LOUD, "TIWL: Reading InitTable parameters\n"); - - /*set all report modules.as default*/ - memset(reportModuleTableDefaults, '1', REPORT_FILES_NUM ); - + + if (!p) + return; + /* Reset structure */ NdisZeroMemory(p, sizeof(TInitTable)); - + regReadIntegerParameter(pAdapter, &STRincludeWSCinProbeReq, WSC_INCLUDE_IN_BEACON_DEF,WSC_INCLUDE_IN_BEACON_MIN,WSC_INCLUDE_IN_BEACON_MAX, sizeof p->siteMgrInitParams.includeWSCinProbeReq, @@ -1093,12 +1074,12 @@ regFillInitTable( /*is the desired state ENABLED ?*/ regReadIntegerParameter(pAdapter, &STRBeaconFilterDesiredState, DEF_BEACON_FILTER_ENABLE_VALUE, MIN_BEACON_FILTER_ENABLE_VALUE, MAX_BEACON_FILTER_ENABLE_VALUE, - sizeof p->siteMgrInitParams.beaconFilterParams.desiredState, + sizeof p->siteMgrInitParams.beaconFilterParams.desiredState, (TI_UINT8*)&p->siteMgrInitParams.beaconFilterParams.desiredState ); - + regReadIntegerParameter(pAdapter, &STRBeaconFilterStored, DEF_NUM_STORED_FILTERS, MIN_NUM_STORED_FILTERS, MAX_NUM_STORED_FILTERS, - sizeof p->siteMgrInitParams.beaconFilterParams.numOfStored, + sizeof p->siteMgrInitParams.beaconFilterParams.numOfStored, (TI_UINT8*)&p->siteMgrInitParams.beaconFilterParams.numOfStored ); /*Read the beacon filter IE table*/ @@ -1106,145 +1087,156 @@ regFillInitTable( regReadIntegerParameter(pAdapter, &STRBeaconIETableSize, BEACON_FILTER_IE_TABLE_DEF_SIZE, BEACON_FILTER_IE_TABLE_MIN_SIZE, BEACON_FILTER_IE_TABLE_MAX_SIZE, - sizeof p->siteMgrInitParams.beaconFilterParams.IETableSize, + sizeof p->siteMgrInitParams.beaconFilterParams.IETableSize, (TI_UINT8*)(&p->siteMgrInitParams.beaconFilterParams.IETableSize) ); - + tmpIeTableSize = p->siteMgrInitParams.beaconFilterParams.IETableSize; - + /*Read the number of elements in the table ( this is because 221 has 5 values following it )*/ regReadIntegerParameter(pAdapter, &STRBeaconIETableNumOfElem, DEF_BEACON_FILTER_IE_TABLE_NUM, BEACON_FILTER_IE_TABLE_MIN_NUM, BEACON_FILTER_IE_TABLE_MAX_NUM, - sizeof p->siteMgrInitParams.beaconFilterParams.numOfElements, + sizeof p->siteMgrInitParams.beaconFilterParams.numOfElements, (TI_UINT8*)(&p->siteMgrInitParams.beaconFilterParams.numOfElements) ); /*printk("\n OsRgstr tmpIeTableSize = %d numOfElems = %d" , tmpIeTableSize , p->siteMgrInitParams.beaconFilterParams.numOfElements) ;*/ strSize = 3 * tmpIeTableSize - 1 ; /*includes spaces between bytes*/ if ( ( tmpIeTableSize > 0 ) && ( tmpIeTableSize <= BEACON_FILTER_IE_TABLE_MAX_SIZE) ) { - - regReadStringParameter(pAdapter, &STRBeaconIETable , + TI_UINT8 *staBeaconFilterIETable; + + staBeaconFilterIETable = os_memoryAlloc(pAdapter, BEACON_FILTER_STRING_MAX_LEN); + if (staBeaconFilterIETable) { + regReadStringParameter(pAdapter, &STRBeaconIETable , (TI_INT8*)(defBeaconIETable), strSize, (TI_UINT8*)staBeaconFilterIETable, &strSize); - regConvertStringtoBeaconIETable(staBeaconFilterIETable , (TI_UINT8*)&p->siteMgrInitParams.beaconFilterParams.IETable[0]/*(TI_UINT8*)&(tmpIeTable[0] )*/ , tmpIeTableSize); + regConvertStringtoBeaconIETable(staBeaconFilterIETable, (TI_UINT8*)&p->siteMgrInitParams.beaconFilterParams.IETable[0]/*(TI_UINT8*)&(tmpIeTable[0] )*/, tmpIeTableSize); + os_memoryFree(pAdapter, staBeaconFilterIETable, BEACON_FILTER_STRING_MAX_LEN); + } } /* MAC ADDRESSES FILTER*/ regReadIntegerParameter(pAdapter, &STRFilterEnabled, DEF_FILTER_ENABLE_VALUE, MIN_FILTER_ENABLE_VALUE, MAX_FILTER_ENABLE_VALUE, - sizeof p->twdInitParams.tMacAddrFilter.isFilterEnabled, + sizeof p->twdInitParams.tMacAddrFilter.isFilterEnabled, (TI_UINT8*) &p->twdInitParams.tMacAddrFilter.isFilterEnabled); regReadIntegerParameter(pAdapter, &STRnumGroupAddrs, NUM_GROUP_ADDRESS_VALUE_DEF, NUM_GROUP_ADDRESS_VALUE_MIN, NUM_GROUP_ADDRESS_VALUE_MAX, - sizeof p->twdInitParams.tMacAddrFilter.numOfMacAddresses, + sizeof p->twdInitParams.tMacAddrFilter.numOfMacAddresses, (TI_UINT8*) &p->twdInitParams.tMacAddrFilter.numOfMacAddresses); - - /*printk("\nOsRgstry Num Of Group Addr:%d \n" , p->twdInitParams.tMacAddrFilter.numOfMacAddresses) ;*/ - macIndex = p->twdInitParams.tMacAddrFilter.numOfMacAddresses -1 ; - switch( macIndex ) + /*printk("\nOsRgstry Num Of Group Addr:%d \n" , p->twdInitParams.tMacAddrFilter.numOfMacAddresses) ;*/ { - case 7: + TI_UINT8 defStaMacAddress1[]= "11 11 12 13 14 15"; + TI_UINT8 defStaMacAddress2[]= "12 21 22 23 24 25"; + TI_UINT8 defStaMacAddress3[]= "13 31 32 33 34 35"; + TI_UINT8 defStaMacAddress4[]= "14 41 42 43 44 45"; + TI_UINT8 defStaMacAddress5[]= "15 51 52 53 54 55"; + TI_UINT8 defStaMacAddress6[]= "16 61 62 63 64 65"; + TI_UINT8 defStaMacAddress7[]= "17 71 72 73 74 75"; + int macIndex ; /*used for group address filtering*/ + + macIndex = p->twdInitParams.tMacAddrFilter.numOfMacAddresses - 1; + switch( macIndex ) { + case 7: + { - regReadStringParameter(pAdapter, &STRGroup_addr7, - (TI_INT8*)(defStaMacAddress7), REG_MAC_ADDR_STR_LEN, - (TI_UINT8*)staMACAddress, ®MACstrLen); - - regConvertStringtoMACAddress(staMACAddress,(TI_UINT8*) &p->twdInitParams.tMacAddrFilter.macAddrTable[7]); - --macIndex; - } + regReadStringParameter(pAdapter, &STRGroup_addr7, + (TI_INT8*)(defStaMacAddress7), REG_MAC_ADDR_STR_LEN, + (TI_UINT8*)staMACAddress, ®MACstrLen); - case 6: - { + regConvertStringtoMACAddress(staMACAddress,(TI_UINT8*) &p->twdInitParams.tMacAddrFilter.macAddrTable[7]); + --macIndex; + } - regReadStringParameter(pAdapter, &STRGroup_addr6, - (TI_INT8*)(defStaMacAddress6), REG_MAC_ADDR_STR_LEN, - (TI_UINT8*)staMACAddress, ®MACstrLen); + case 6: + { - regConvertStringtoMACAddress(staMACAddress,(TI_UINT8*) &p->twdInitParams.tMacAddrFilter.macAddrTable[6]); - --macIndex; - } + regReadStringParameter(pAdapter, &STRGroup_addr6, + (TI_INT8*)(defStaMacAddress6), REG_MAC_ADDR_STR_LEN, + (TI_UINT8*)staMACAddress, ®MACstrLen); - case 5: - { + regConvertStringtoMACAddress(staMACAddress,(TI_UINT8*) &p->twdInitParams.tMacAddrFilter.macAddrTable[6]); + --macIndex; + } - regReadStringParameter(pAdapter, &STRGroup_addr5, - (TI_INT8*)(defStaMacAddress5), REG_MAC_ADDR_STR_LEN, - (TI_UINT8*)staMACAddress, ®MACstrLen); + case 5: + { - regConvertStringtoMACAddress(staMACAddress,(TI_UINT8*) &p->twdInitParams.tMacAddrFilter.macAddrTable[5]); - --macIndex; - } + regReadStringParameter(pAdapter, &STRGroup_addr5, + (TI_INT8*)(defStaMacAddress5), REG_MAC_ADDR_STR_LEN, + (TI_UINT8*)staMACAddress, ®MACstrLen); - case 4: - { + regConvertStringtoMACAddress(staMACAddress,(TI_UINT8*) &p->twdInitParams.tMacAddrFilter.macAddrTable[5]); + --macIndex; + } - regReadStringParameter(pAdapter, &STRGroup_addr4, - (TI_INT8*)(defStaMacAddress4), REG_MAC_ADDR_STR_LEN, - (TI_UINT8*)staMACAddress, ®MACstrLen); + case 4: + { - regConvertStringtoMACAddress(staMACAddress,(TI_UINT8*) &p->twdInitParams.tMacAddrFilter.macAddrTable[4]); - --macIndex; - } + regReadStringParameter(pAdapter, &STRGroup_addr4, + (TI_INT8*)(defStaMacAddress4), REG_MAC_ADDR_STR_LEN, + (TI_UINT8*)staMACAddress, ®MACstrLen); - case 3: - { + regConvertStringtoMACAddress(staMACAddress,(TI_UINT8*) &p->twdInitParams.tMacAddrFilter.macAddrTable[4]); + --macIndex; + } - regReadStringParameter(pAdapter, &STRGroup_addr3, - (TI_INT8*)(defStaMacAddress3), REG_MAC_ADDR_STR_LEN, - (TI_UINT8*)staMACAddress, ®MACstrLen); + case 3: + { - regConvertStringtoMACAddress(staMACAddress, (TI_UINT8*)&p->twdInitParams.tMacAddrFilter.macAddrTable[3]); - --macIndex; - } + regReadStringParameter(pAdapter, &STRGroup_addr3, + (TI_INT8*)(defStaMacAddress3), REG_MAC_ADDR_STR_LEN, + (TI_UINT8*)staMACAddress, ®MACstrLen); - case 2: - { + regConvertStringtoMACAddress(staMACAddress, (TI_UINT8*)&p->twdInitParams.tMacAddrFilter.macAddrTable[3]); + --macIndex; + } - regReadStringParameter(pAdapter, &STRGroup_addr2, - (TI_INT8*)(defStaMacAddress2), REG_MAC_ADDR_STR_LEN, - (TI_UINT8*)staMACAddress, ®MACstrLen); + case 2: + { - regConvertStringtoMACAddress(staMACAddress,(TI_UINT8*) &p->twdInitParams.tMacAddrFilter.macAddrTable[2]); - --macIndex; - } + regReadStringParameter(pAdapter, &STRGroup_addr2, + (TI_INT8*)(defStaMacAddress2), REG_MAC_ADDR_STR_LEN, + (TI_UINT8*)staMACAddress, ®MACstrLen); - case 1: - { + regConvertStringtoMACAddress(staMACAddress,(TI_UINT8*) &p->twdInitParams.tMacAddrFilter.macAddrTable[2]); + --macIndex; + } - regReadStringParameter(pAdapter, &STRGroup_addr1, - (TI_INT8*)(defStaMacAddress1), REG_MAC_ADDR_STR_LEN, - (TI_UINT8*)staMACAddress, ®MACstrLen); + case 1: + { - regConvertStringtoMACAddress(staMACAddress,(TI_UINT8*) &p->twdInitParams.tMacAddrFilter.macAddrTable[1]); - --macIndex; - } + regReadStringParameter(pAdapter, &STRGroup_addr1, + (TI_INT8*)(defStaMacAddress1), REG_MAC_ADDR_STR_LEN, + (TI_UINT8*)staMACAddress, ®MACstrLen); - - case 0: - { + regConvertStringtoMACAddress(staMACAddress,(TI_UINT8*) &p->twdInitParams.tMacAddrFilter.macAddrTable[1]); + --macIndex; + } - regReadStringParameter(pAdapter, &STRGroup_addr0, - (TI_INT8*)(defStaMacAddress0), REG_MAC_ADDR_STR_LEN, - (TI_UINT8*)staMACAddress, ®MACstrLen); + case 0: + { - regConvertStringtoMACAddress(staMACAddress,(TI_UINT8*) &p->twdInitParams.tMacAddrFilter.macAddrTable[0]); + regReadStringParameter(pAdapter, &STRGroup_addr0, + (TI_INT8*)(defStaMacAddress0), REG_MAC_ADDR_STR_LEN, + (TI_UINT8*)staMACAddress, ®MACstrLen); - - } + regConvertStringtoMACAddress(staMACAddress,(TI_UINT8*) &p->twdInitParams.tMacAddrFilter.macAddrTable[0]); + } - default: - { + default: + { + } } } - /************************/ /* Read severity table */ /**********************/ @@ -1259,37 +1251,40 @@ regFillInitTable( /***********************/ /* Read modules table */ /*********************/ - - regReadStringParameter(pAdapter, &STR_ReportModuleTable, - (TI_INT8*)reportModuleTableDefaults, - (TI_UINT8)REPORT_FILES_NUM, - (TI_UINT8*)p->tReport.aFileEnable, - (TI_UINT8*)&reportModuleTableLen); - - - /* - Default SSID should be non-Valid SSID, hence the STA will not try to connect - */ - for(loopIndex = 0; loopIndex < MAX_SSID_LEN; loopIndex++) - dummySsidString[loopIndex] = (loopIndex+1); - - + { + TI_UINT8 *reportModuleTableDefaults; + TI_UINT16 reportModuleTableLen; + + reportModuleTableDefaults = os_memoryAlloc(pAdapter, REPORT_FILES_NUM); + if (!reportModuleTableDefaults) + return; + + /*set all report modules.as default*/ + memset(reportModuleTableDefaults, '1', REPORT_FILES_NUM ); + + regReadStringParameter(pAdapter, &STR_ReportModuleTable, + (TI_INT8*)reportModuleTableDefaults, + (TI_UINT8)REPORT_FILES_NUM, + (TI_UINT8*)p->tReport.aFileEnable, + (TI_UINT8*)&reportModuleTableLen); + os_memoryFree(pAdapter, reportModuleTableDefaults, REPORT_FILES_NUM); + } /* rate Policy Params */ regReadIntegerParameter(pAdapter, &STRRatePolicyUserShortRetryLimit, - CTRL_DATA_RATE_POLICY_USER_SHORT_RETRY_LIMIT_DEF, + CTRL_DATA_RATE_POLICY_USER_SHORT_RETRY_LIMIT_DEF, CTRL_DATA_RATE_POLICY_USER_SHORT_RETRY_LIMIT_MIN, CTRL_DATA_RATE_POLICY_USER_SHORT_RETRY_LIMIT_MAX, - sizeof p->ctrlDataInitParams.ctrlDataTxRatePolicy.shortRetryLimit, + sizeof p->ctrlDataInitParams.ctrlDataTxRatePolicy.shortRetryLimit, (TI_UINT8*)&p->ctrlDataInitParams.ctrlDataTxRatePolicy.shortRetryLimit); regReadIntegerParameter(pAdapter, &STRRatePolicyUserLongRetryLimit, CTRL_DATA_RATE_POLICY_USER_LONG_RETRY_LIMIT_DEF, CTRL_DATA_RATE_POLICY_USER_LONG_RETRY_LIMIT_MIN, CTRL_DATA_RATE_POLICY_USER_LONG_RETRY_LIMIT_MAX, - sizeof p->ctrlDataInitParams.ctrlDataTxRatePolicy.longRetryLimit, + sizeof p->ctrlDataInitParams.ctrlDataTxRatePolicy.longRetryLimit, (TI_UINT8*)&p->ctrlDataInitParams.ctrlDataTxRatePolicy.longRetryLimit); - regReadIntegerParameterHex (pAdapter, &STRRatePolicyUserEnabledRatesMaskCck, + regReadIntegerParameterHex (pAdapter, &STRRatePolicyUserEnabledRatesMaskCck, CTRL_DATA_RATE_POLICY_USER_EN_DIS_MASK_CCK_DEF, CTRL_DATA_RATE_POLICY_USER_EN_DIS_MASK_MIN, CTRL_DATA_RATE_POLICY_USER_EN_DIS_MASK_MAX, @@ -1347,23 +1342,23 @@ regFillInitTable( 80, 0, 255, sizeof p->twdInitParams.tGeneral.halCtrlArmClock, (TI_UINT8*)&p->twdInitParams.tGeneral.halCtrlArmClock); - + regReadIntegerParameter(pAdapter, &STRg80211DraftNumber, DRAFT_6_AND_LATER, DRAFT_5_AND_EARLIER, DRAFT_6_AND_LATER, sizeof p->siteMgrInitParams.siteMgrUseDraftNum, (TI_UINT8*)&p->siteMgrInitParams.siteMgrUseDraftNum); - + regReadIntegerParameter(pAdapter, &STRTraceBufferSize, /*1024, 0, 1024, sizeof(TI_UINT32), */ 16, 16, 16, sizeof p->twdInitParams.tGeneral.TraceBufferSize, (TI_UINT8*)&p->twdInitParams.tGeneral.TraceBufferSize); - + regReadIntegerParameter(pAdapter, &STRPrintTrace, TI_FALSE, TI_FALSE, TI_TRUE, sizeof p->twdInitParams.tGeneral.bDoPrint, (TI_UINT8*)&p->twdInitParams.tGeneral.bDoPrint); - + regReadIntegerParameter(pAdapter, &STRFirmwareDebug, TI_FALSE, TI_FALSE, TI_TRUE, sizeof p->twdInitParams.tGeneral.halCtrlFirmwareDebug, @@ -1515,7 +1510,7 @@ regFillInitTable( TWD_MAX_RX_MSDU_LIFETIME_MAX, sizeof p->twdInitParams.tGeneral.halCtrlMaxRxMsduLifetime, (TI_UINT8*)&p->twdInitParams.tGeneral.halCtrlMaxRxMsduLifetime); - + regReadIntegerParameter(pAdapter, &STRdot11RateFallBackRetryLimit, TWD_RATE_FB_RETRY_LIMIT_DEF, TWD_RATE_FB_RETRY_LIMIT_MIN, TWD_RATE_FB_RETRY_LIMIT_MAX, @@ -1590,26 +1585,40 @@ regFillInitTable( (TI_UINT8*)&p->siteMgrInitParams.siteMgrDesiredChannel); /* NOTE: desired BSSID and SSID (and BSS type, later on) are currently set both to the SME and the site manager!!! */ - MAC_COPY (p->siteMgrInitParams.siteMgrDesiredBSSID, bssidBroadcast); - MAC_COPY (p->tSmeModifiedInitParams.tDesiredBssid, bssidBroadcast); + { + TI_UINT8 bssidBroadcast[MAC_ADDR_LEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - regReadStringParameter(pAdapter, &STRdot11DesiredSSID, - (TI_INT8*)dummySsidString, - (TI_UINT8)MAX_SSID_LEN, - (TI_UINT8*)p->siteMgrInitParams.siteMgrDesiredSSID.str, - (TI_UINT8*)&p->siteMgrInitParams.siteMgrDesiredSSID.len); + MAC_COPY (p->siteMgrInitParams.siteMgrDesiredBSSID, bssidBroadcast); + MAC_COPY (p->tSmeModifiedInitParams.tDesiredBssid, bssidBroadcast); + } - /* in case no SSID desired at the init file set dummy len */ - for(loopIndex = 0; loopIndex < MAX_SSID_LEN; loopIndex++) { - if(dummySsidString[loopIndex] != p->siteMgrInitParams.siteMgrDesiredSSID.str[loopIndex]) - break; - } + static char dummySsidString[MAX_SSID_LEN]; + + /* + Default SSID should be non-Valid SSID, hence the STA will not try to connect + */ + for(loopIndex = 0; loopIndex < MAX_SSID_LEN; loopIndex++) + dummySsidString[loopIndex] = (loopIndex+1); + + regReadStringParameter(pAdapter, &STRdot11DesiredSSID, + (TI_INT8*)dummySsidString, + (TI_UINT8)MAX_SSID_LEN, + (TI_UINT8*)p->siteMgrInitParams.siteMgrDesiredSSID.str, + (TI_UINT8*)&p->siteMgrInitParams.siteMgrDesiredSSID.len); + + /* in case no SSID desired at the init file set dummy len */ + for(loopIndex = 0; loopIndex < MAX_SSID_LEN; loopIndex++) + { + if(dummySsidString[loopIndex] != p->siteMgrInitParams.siteMgrDesiredSSID.str[loopIndex]) + break; + } - p->siteMgrInitParams.siteMgrDesiredSSID.len = (TI_UINT8)loopIndex; + p->siteMgrInitParams.siteMgrDesiredSSID.len = (TI_UINT8)loopIndex; + } NdisMoveMemory(&p->tSmeModifiedInitParams.tDesiredSsid, - &p->siteMgrInitParams.siteMgrDesiredSSID, + &p->siteMgrInitParams.siteMgrDesiredSSID, sizeof(TSsid)); regReadIntegerParameter(pAdapter, &STRdot11DesiredNetworkType, @@ -1639,9 +1648,8 @@ regFillInitTable( p->siteMgrInitParams.siteMgrDesiredChannel = SITE_MGR_CHANNEL_A_MIN; } - if(1) { - TI_UINT32 Freq2ChannelTable[] = {0,2412000,2417000,2422000,2427000,2432000,2437000, + static TI_UINT32 Freq2ChannelTable[] = {0,2412000,2417000,2422000,2427000,2432000,2437000, 2442000,2447000,2452000,2457000, 2462000,2467000,2472000,2484000}; @@ -1862,12 +1870,12 @@ regFillInitTable( (TI_UINT8*)&p->tSmeModifiedInitParams.eConnectMode); { - /* due to the fact that two following init keys has negative values, we read them as table */ + /* due to the fact that two following init keys has negative values, we read them as table */ TI_UINT32 uEntriesNumber = 1; regReadIntegerTable(pAdapter ,&STRSmeScanRssiThreshold, SME_SCAN_RSSI_THRESHOLD_DEF, sizeof(TI_INT8) * 3, - (TI_UINT8*)&p->tSmeInitParams.iRssiThreshold, NULL, &uEntriesNumber, + (TI_UINT8*)&p->tSmeInitParams.iRssiThreshold, NULL, &uEntriesNumber, sizeof(TI_INT8),TI_FALSE); if ( (p->tSmeInitParams.iRssiThreshold < SME_SCAN_RSSI_THRESHOLD_MIN) || @@ -1879,7 +1887,7 @@ regFillInitTable( regReadIntegerTable(pAdapter ,&STRSmeScanSnrThreshold, SME_SCAN_SNR_THRESHOLD_DEF, sizeof(TI_INT8), (TI_UINT8*)&p->tSmeInitParams.iSnrThreshold, NULL, &uEntriesNumber, sizeof(TI_INT8),TI_FALSE); - + if ( (p->tSmeInitParams.iSnrThreshold < SME_SCAN_SNR_THRESHOLD_MIN) || (p->tSmeInitParams.iSnrThreshold > SME_SCAN_SNR_THRESHOLD_MAX)) { @@ -1908,59 +1916,79 @@ regFillInitTable( SME_SCAN_PROBE_REQ_DEF, SME_SCAN_PROBE_REQ_MIN, SME_SCAN_PROBE_REQ_MAX, sizeof p->tSmeInitParams.uProbeReqNum, (TI_UINT8*)&p->tSmeInitParams.uProbeReqNum); - regReadIntegerTable(pAdapter, &STRSmeScanIntervals, SME_SCAN_INTERVALS_LIST_VAL_DEF, + + { + TI_UINT32 *uSmeScanIntervalsTempList; + + uSmeScanIntervalsTempList = os_memoryAlloc(pAdapter, SME_SCAN_INTERVALS_LIST_STRING_MAX_SIZE * sizeof(TI_UINT32)); + if (!uSmeScanIntervalsTempList) { + return; + } + regReadIntegerTable(pAdapter, &STRSmeScanIntervals, SME_SCAN_INTERVALS_LIST_VAL_DEF, SME_SCAN_INTERVALS_LIST_STRING_MAX_SIZE, - (TI_UINT8*)&uSmeScanIntervalsTempList, NULL, &uTempEntriesCount, + (TI_UINT8 *)uSmeScanIntervalsTempList, NULL, &uTempEntriesCount, sizeof (TI_UINT32),TI_FALSE); - /* sanity check */ - if (uTempEntriesCount > PERIODIC_SCAN_MAX_INTERVAL_NUM) - { - uTempEntriesCount = PERIODIC_SCAN_MAX_INTERVAL_NUM; + /* sanity check */ + if (uTempEntriesCount > PERIODIC_SCAN_MAX_INTERVAL_NUM) + { + uTempEntriesCount = PERIODIC_SCAN_MAX_INTERVAL_NUM; + } + /* convert from TI_UINT8 to TI_UINT32 */ + for (uIndex = 0; uIndex < uTempEntriesCount; uIndex++) + { + p->tSmeInitParams.uScanIntervals[ uIndex ] = uSmeScanIntervalsTempList[ uIndex ]; + } + os_memoryFree(pAdapter, uSmeScanIntervalsTempList, SME_SCAN_INTERVALS_LIST_STRING_MAX_SIZE * sizeof(TI_UINT32)); } - /* convert from TI_UINT8 to TI_UINT32 */ - for (uIndex = 0; uIndex < uTempEntriesCount; uIndex++) { - p->tSmeInitParams.uScanIntervals[ uIndex ] = uSmeScanIntervalsTempList[ uIndex ]; - } - regReadIntegerTable(pAdapter, &STRSmeScanGChannels, SME_SCAN_CHANNELS_LIST_G_VAL_DEF, - SME_SCAN_CHANNELS_LIST_G_STRING_MAX_SIZE, - (TI_UINT8*)&uSmeTempList, NULL, &uTempEntriesCount, - sizeof (TI_UINT8),TI_FALSE); + TI_UINT8 *uSmeTempList; + TI_UINT32 uSmeGChannelsCount; + uSmeTempList = os_memoryAlloc(pAdapter, SME_SCAN_CHANNELS_LIST_G_STRING_MAX_SIZE); + if (!uSmeTempList) { + return; + } + regReadIntegerTable(pAdapter, &STRSmeScanGChannels, SME_SCAN_CHANNELS_LIST_G_VAL_DEF, + SME_SCAN_CHANNELS_LIST_G_STRING_MAX_SIZE, + (TI_UINT8 *)uSmeTempList, NULL, &uTempEntriesCount, + sizeof (TI_UINT8),TI_FALSE); - /* convert to channel list */ - for (uIndex = 0; uIndex < uTempEntriesCount; uIndex++) - { - p->tSmeInitParams.tChannelList[ uIndex ].eBand = RADIO_BAND_2_4_GHZ; - p->tSmeInitParams.tChannelList[ uIndex ].uChannel = uSmeTempList[ uIndex ]; + + /* convert to channel list */ + for (uIndex = 0; uIndex < uTempEntriesCount; uIndex++) + { + p->tSmeInitParams.tChannelList[ uIndex ].eBand = RADIO_BAND_2_4_GHZ; + p->tSmeInitParams.tChannelList[ uIndex ].uChannel = uSmeTempList[ uIndex ]; + } + uSmeGChannelsCount = uTempEntriesCount; + + /* + * Add A_MODE channels to scan list only if it enabled + * NOTE: Don't use empty channel list string + */ + if ((p->siteMgrInitParams.siteMgrDesiredDot11Mode == DOT11_A_MODE) || + (p->siteMgrInitParams.siteMgrDesiredDot11Mode == DOT11_DUAL_MODE)) + { + regReadIntegerTable(pAdapter, &STRSmeScanAChannels, SME_SCAN_CHANNELS_LIST_A_VAL_DEF, + SME_SCAN_CHANNELS_LIST_A_STRING_MAX_SIZE, + (TI_UINT8*)&uSmeTempList, NULL, &uTempEntriesCount, + sizeof (TI_UINT8),TI_FALSE); + + /* convert to channel list */ + for (uIndex = 0; uIndex < uTempEntriesCount; uIndex++) + { + p->tSmeInitParams.tChannelList[ uSmeGChannelsCount + uIndex ].eBand = RADIO_BAND_5_0_GHZ; + p->tSmeInitParams.tChannelList[ uSmeGChannelsCount + uIndex ].uChannel = uSmeTempList[ uIndex ]; + } + + p->tSmeInitParams.uChannelNum = uSmeGChannelsCount + uIndex; + } + else + { + p->tSmeInitParams.uChannelNum = uSmeGChannelsCount; + } + os_memoryFree(pAdapter, uSmeTempList, SME_SCAN_CHANNELS_LIST_G_STRING_MAX_SIZE); } - uSmeGChannelsCount = uTempEntriesCount; - - /* - * Add A_MODE channels to scan list only if it enabled - * NOTE: Don't use empty channel list string - */ - if ((p->siteMgrInitParams.siteMgrDesiredDot11Mode == DOT11_A_MODE) || - (p->siteMgrInitParams.siteMgrDesiredDot11Mode == DOT11_DUAL_MODE)) - { - regReadIntegerTable(pAdapter, &STRSmeScanAChannels, SME_SCAN_CHANNELS_LIST_A_VAL_DEF, - SME_SCAN_CHANNELS_LIST_A_STRING_MAX_SIZE, - (TI_UINT8*)&uSmeTempList, NULL, &uTempEntriesCount, - sizeof (TI_UINT8),TI_FALSE); - - /* convert to channel list */ - for (uIndex = 0; uIndex < uTempEntriesCount; uIndex++) - { - p->tSmeInitParams.tChannelList[ uSmeGChannelsCount + uIndex ].eBand = RADIO_BAND_5_0_GHZ; - p->tSmeInitParams.tChannelList[ uSmeGChannelsCount + uIndex ].uChannel = uSmeTempList[ uIndex ]; - } - - p->tSmeInitParams.uChannelNum = uSmeGChannelsCount + uIndex; - } - else - { - p->tSmeInitParams.uChannelNum = uSmeGChannelsCount; - } regReadIntegerParameter(pAdapter, &STRdot11AuthenticationMode, RSN_AUTH_SUITE_DEF, RSN_AUTH_SUITE_MIN, RSN_AUTH_SUITE_MAX, @@ -1968,13 +1996,13 @@ regFillInitTable( (TI_UINT8*)&p->rsnInitParams.authSuite); /* Soft Gemini Section */ - + regReadIntegerParameter(pAdapter, &STRBThWlanCoexistEnable, SOFT_GEMINI_ENABLED_DEF, SOFT_GEMINI_ENABLED_MIN, SOFT_GEMINI_ENABLED_MAX, sizeof p->SoftGeminiInitParams.SoftGeminiEnable, (TI_UINT8*)&p->SoftGeminiInitParams.SoftGeminiEnable); - regReadIntegerParameter(pAdapter, &STRBThWlanCoexistParamsBtLoadRatio, + regReadIntegerParameter(pAdapter, &STRBThWlanCoexistParamsBtLoadRatio, SOFT_GEMINI_PARAMS_LOAD_RATIO_DEF, SOFT_GEMINI_PARAMS_LOAD_RATIO_MIN, SOFT_GEMINI_PARAMS_LOAD_RATIO_MAX, sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_BT_LOAD_RATIO], (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_BT_LOAD_RATIO]); @@ -2073,7 +2101,7 @@ regFillInitTable( - /* EDR section */ + /* EDR section */ regReadIntegerParameter(pAdapter, &STRBThWlanCoexistUpsdAclMasterMinEDR, SOFT_GEMINI_WLAN_PS_BT_ACL_MASTER_MIN_EDR_DEF, SOFT_GEMINI_WLAN_PS_BT_ACL_MASTER_MIN_EDR_MIN, SOFT_GEMINI_WLAN_PS_BT_ACL_MASTER_MIN_EDR_MAX, sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_WLAN_PS_BT_ACL_MASTER_MIN_EDR], @@ -2205,32 +2233,32 @@ regFillInitTable( regReadIntegerParameter(pAdapter, &STRBThWlanCoexHv3MaxServed, SOFT_GEMINI_HV3_MAX_SERVED_DEF, SOFT_GEMINI_HV3_MAX_SERVED_MIN, SOFT_GEMINI_HV3_MAX_SERVED_MAX, sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_HV3_MAX_SERVED], - (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_HV3_MAX_SERVED]);; - - regReadIntegerParameter(pAdapter, &STRBThWlanCoexTemp1, - SOFT_GEMINI_TEMP_PARAM_1_DEF, SOFT_GEMINI_TEMP_PARAM_1_MIN, SOFT_GEMINI_TEMP_PARAM_1_MAX, - sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_TEMP_PARAM_1], - (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_TEMP_PARAM_1]);; - - regReadIntegerParameter(pAdapter, &STRBThWlanCoexTemp2, - SOFT_GEMINI_TEMP_PARAM_2_DEF, SOFT_GEMINI_TEMP_PARAM_2_MIN, SOFT_GEMINI_TEMP_PARAM_2_MAX, - sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_TEMP_PARAM_2], - (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_TEMP_PARAM_2]);; - - regReadIntegerParameter(pAdapter, &STRBThWlanCoexTemp3, - SOFT_GEMINI_TEMP_PARAM_3_DEF, SOFT_GEMINI_TEMP_PARAM_3_MIN, SOFT_GEMINI_TEMP_PARAM_3_MAX, - sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_TEMP_PARAM_3], - (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_TEMP_PARAM_3]);; - - regReadIntegerParameter(pAdapter, &STRBThWlanCoexTemp4, + (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_HV3_MAX_SERVED]); + regReadIntegerParameter(pAdapter, &STRBThWlanCoexTemp1, + SOFT_GEMINI_TEMP_PARAM_1_DEF, SOFT_GEMINI_TEMP_PARAM_1_MIN, SOFT_GEMINI_TEMP_PARAM_1_MAX, + sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_TEMP_PARAM_1], + (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_TEMP_PARAM_1]); + + regReadIntegerParameter(pAdapter, &STRBThWlanCoexTemp2, + SOFT_GEMINI_TEMP_PARAM_2_DEF, SOFT_GEMINI_TEMP_PARAM_2_MIN, SOFT_GEMINI_TEMP_PARAM_2_MAX, + sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_TEMP_PARAM_2], + (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_TEMP_PARAM_2]); + + regReadIntegerParameter(pAdapter, &STRBThWlanCoexTemp3, + SOFT_GEMINI_TEMP_PARAM_3_DEF, SOFT_GEMINI_TEMP_PARAM_3_MIN, SOFT_GEMINI_TEMP_PARAM_3_MAX, + sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_TEMP_PARAM_3], + (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_TEMP_PARAM_3]); + + regReadIntegerParameter(pAdapter, &STRBThWlanCoexTemp4, SOFT_GEMINI_TEMP_PARAM_4_DEF, SOFT_GEMINI_TEMP_PARAM_4_MIN, SOFT_GEMINI_TEMP_PARAM_4_MAX, sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_TEMP_PARAM_4], - (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_TEMP_PARAM_4]);; + (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_TEMP_PARAM_4]); - regReadIntegerParameter(pAdapter, &STRBThWlanCoexTemp5, + regReadIntegerParameter(pAdapter, &STRBThWlanCoexTemp5, SOFT_GEMINI_TEMP_PARAM_5_DEF, SOFT_GEMINI_TEMP_PARAM_5_MIN, SOFT_GEMINI_TEMP_PARAM_5_MAX, sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_TEMP_PARAM_5], - (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_TEMP_PARAM_5]);; + (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_TEMP_PARAM_5]); + /* * CoexActivity table @@ -2243,14 +2271,23 @@ regFillInitTable( (TI_UINT8*)(&p->twdInitParams.tGeneral.halCoexActivityTable.numOfElements) ); /* Read the CoexActivity table string */ - regReadStringParameter(pAdapter, &STRCoexActivityTable , + { + TI_UINT8 *strCoexActivityTable; + TI_UINT8 strCoexActivitySize = 0; + + strCoexActivityTable = os_memoryAlloc(pAdapter, COEX_ACTIVITY_TABLE_MAX_NUM*COEX_ACTIVITY_TABLE_SIZE); + if (strCoexActivityTable) { + regReadStringParameter(pAdapter, &STRCoexActivityTable , (TI_INT8*)(defCoexActivityTable), strCoexActivitySize, (TI_UINT8*)strCoexActivityTable, &strCoexActivitySize); - /* Convert the CoexActivity table string */ - regConvertStringtoCoexActivityTable(strCoexActivityTable , p->twdInitParams.tGeneral.halCoexActivityTable.numOfElements, &p->twdInitParams.tGeneral.halCoexActivityTable.entry[0] , strCoexActivitySize); + /* Convert the CoexActivity table string */ + regConvertStringtoCoexActivityTable(strCoexActivityTable , p->twdInitParams.tGeneral.halCoexActivityTable.numOfElements, &p->twdInitParams.tGeneral.halCoexActivityTable.entry[0] , strCoexActivitySize); + os_memoryFree(pAdapter, strCoexActivityTable, COEX_ACTIVITY_TABLE_MAX_NUM*COEX_ACTIVITY_TABLE_SIZE); + } + } - /* + /* Power Manager */ regReadIntegerParameter(pAdapter, @@ -2549,7 +2586,7 @@ regReadIntegerParameter(pAdapter, &STRSettings, regReadIntegerTable (pAdapter, &STRSRDebugTable, SMART_REFLEX_CONFIG_PARAMS_DEF_TABLE, MAX_SR_PARAM_LEN, NULL, (TI_INT8*)&p->twdInitParams.tSmartReflexDebugParams.errorTable, - &TempSRCnt, sizeof (TI_UINT8),TI_FALSE); + (TI_UINT32 *)&TempSRCnt, sizeof (TI_UINT8),TI_FALSE); @@ -2572,7 +2609,7 @@ regReadIntegerParameter(pAdapter, &STRSettings, POWER_MGMNT_NEED_TO_SEND_NULL_PACKET_MAX_VALUE, sizeof p->PowerMgrInitParams.needToSendNullData, (TI_UINT8*)&p->PowerMgrInitParams.needToSendNullData); - + regReadIntegerParameter(pAdapter, &STRPowerMgmtNullPktRateModulation, POWER_MGMNT_NULL_PACKET_RATE_MOD_DEF_VALUE, @@ -2580,7 +2617,7 @@ regReadIntegerParameter(pAdapter, &STRSettings, POWER_MGMNT_NULL_PACKET_RATE_MOD_MAX_VALUE, sizeof p->PowerMgrInitParams.NullPktRateModulation, (TI_UINT8*)&p->PowerMgrInitParams.NullPktRateModulation); - + regReadIntegerParameter(pAdapter, &STRPowerMgmtNumNullPktRetries, POWER_MGMNT_NUM_NULL_PACKET_RETRY_DEF_VALUE, @@ -2620,7 +2657,7 @@ regReadIntegerParameter(pAdapter, &STRSettings, HOST_FAST_WAKE_SUPPORT_MAX, sizeof p->twdInitParams.tGeneral.uHostFastWakeupSupport, (TI_UINT8*)&p->twdInitParams.tGeneral.uHostFastWakeupSupport); - + /*--------------- Power Management Wake up conditions ------------------*/ regReadIntegerParameter(pAdapter, &STRListenInterval, @@ -2648,7 +2685,7 @@ regReadIntegerParameter(pAdapter, &STRSettings, sizeof p->twdInitParams.tPowerSrv.hangOverPeriod, (TI_UINT8*)&p->twdInitParams.tPowerSrv.hangOverPeriod); /*-----------------------------------------------------------------------*/ - + /* Scan SRV */ regReadIntegerParameter(pAdapter, &STRNumberOfNoScanCompleteToRecovery, @@ -4239,7 +4276,7 @@ regReadIntegerParameter(pAdapter, &STRFmCoexSwallowClkDif, /*----------------------------------------------*/ -/* Rate Management parameters */ +/* Rate Management parameters */ /*----------------------------------------------*/ regReadIntegerParameter(pAdapter, &STRRateMngRateRetryScore, @@ -4334,7 +4371,6 @@ regReadIntegerTable (pAdapter, &STRRateMngRateRetryPolicy, RATE_MNG_RATE_RETRY_P p->twdInitParams.tRateMngParams.RateRetryPolicy[uIndex] = uTempRatePolicyList[uIndex]; } - #ifdef _WINDOWS /* set etherMaxPayloadSize parameter for MTU size setting */ pAdapter->etherMaxPayloadSize = ETHER_MAX_PAYLOAD_SIZE; @@ -4361,7 +4397,7 @@ Return Value: None -----------------------------------------------------------------------------*/ -void regReadIntegerParameter ( +static void regReadIntegerParameter ( TWlanDrvIfObjPtr pAdapter, PNDIS_STRING pParameterName, TI_UINT32 defaultValue, @@ -5073,24 +5109,23 @@ regReadIntegerTable( TI_UINT8 uParameterSize, TI_BOOL bHex) { + static CHAR Buffer[MAX_KEY_BUFFER_LEN]; TI_UINT32 parameterIndex = 0; int myNumber; TI_UINT32 index; TI_UINT32 bufferSize = 0; - char tempBuffer[15]; + char tempBuffer[16]; char *pTempBuffer = tempBuffer; TI_UINT32 tempBufferIndex = 0; TI_BOOL isDigit; TI_BOOL numberReady; TI_BOOL isSign; - TI_BOOL endOfLine; + TI_BOOL endOfLine; TI_UINT32 debugInfo = 0; - - CHAR Buffer[MAX_KEY_BUFFER_LEN]; TI_INT8* pBuffer = (TI_INT8*)&Buffer; regReadStringParameter(pAdapter, @@ -5100,7 +5135,7 @@ regReadIntegerTable( (TI_UINT8*)pBuffer, &bufferSize); - index=0; + index = 0; do { /* Parsing one line */ isSign = TI_FALSE; @@ -5262,7 +5297,7 @@ regReadIntegerTable( } ++parameterIndex; - + }while ((index<bufferSize)&&(endOfLine==TI_FALSE)); *pEntriesNumber = parameterIndex; /* return number of entries read */ @@ -5310,7 +5345,7 @@ Return Value: None -----------------------------------------------------------------------------*/ -static void regConvertStringtoBeaconIETable(TI_UINT8 *staIpAddressString,TI_UINT8 *IpAddressArray, TI_UINT8 size) +static void regConvertStringtoBeaconIETable(TI_UINT8 *staIpAddressString, TI_UINT8 *IpAddressArray, TI_UINT8 size) { char *ptr; TI_UINT8 *tmpIpAddr; @@ -5320,19 +5355,25 @@ static void regConvertStringtoBeaconIETable(TI_UINT8 *staIpAddressString,TI_UINT /* Take the pointer to the string MAC Address to convert it to the Array MAC Address */ ptr = (char *)staIpAddressString; tmpIpAddr = IpAddressArray; - str_len = 3 * size - 1; /* Each value includes two digits and a space so multpily by 3 */ + str_len = 3 * size - 1; - for (i = 0; i < size; ptr++, str_len--) + for(i=0;(i < size);ptr++,str_len--) { - value_l = *ptr - '0'; - value_h = *ptr - 'a'; + if (str_len > 0) { + /* The value can be or "0-9" or from "a-f" */ + value_l = (*ptr - '0'); + value_h = (*ptr - 'a'); + } + else { /* last element */ + value_l = value_h = 16; + } + /*PRINTF(DBG_REGISTRY,("value_l [%d] value_h [%d] *ptr %c value %d\n",value_l,value_h,*ptr,value));*/ - if ((str_len > 0) && ((value_l <= 9) || (value_h <= 15))) + if( (value_l <= 9) || (value_h <= 15 ) ) { /* We are in an expected range */ - /* Check if 0-9 */ - if (value_l <= 9) + if(value_l <= 9 ) { add_value = value_l; } @@ -5343,10 +5384,12 @@ static void regConvertStringtoBeaconIETable(TI_UINT8 *staIpAddressString,TI_UINT add_value = value_h + 10; } value = value * 16 + add_value; + /*PRINTF(DBG_REGISTRY,("value %d add_value %d \n",value,add_value));*/ } else { tmpIpAddr[i] = value; + /*PRINTF(DBG_REGISTRY,("tmpMacAddr[%d] is %x\n",i,tmpMacAddr[i]));*/ value = 0; i++; } @@ -5359,7 +5402,7 @@ Routine Name: regConvertStringtoCoexActivityTable -Routine Description: Converts the CoexActivity string into CoexActivity config table +Routine Description: Converts the CoexActivity string into CoexActivity config table Arguments: @@ -5374,7 +5417,7 @@ static void regConvertStringtoCoexActivityTable(TI_UINT8 *strCoexActivityTable, { char *ptr; TI_UINT16 tmpArray[NUM_OF_COEX_ACTIVITY_PARAMS_IN_SG]; - TI_UINT16 value=0,value_l,value_h,add_value; + TI_UINT16 value = 0, value_l, value_h, add_value; TI_UINT32 i; int entry = 0; @@ -5382,11 +5425,10 @@ static void regConvertStringtoCoexActivityTable(TI_UINT8 *strCoexActivityTable, problem if buffer is not ended with blank (Dm) */ /* Take the pointer to the string MAC Address to convert it to the Array MAC Address */ - ptr=(char *)strCoexActivityTable; + ptr = (char *)strCoexActivityTable; - for (i=0 ;i < numOfElements*NUM_OF_COEX_ACTIVITY_PARAMS_IN_SG ;ptr++) + for(i=0;(i < numOfElements*NUM_OF_COEX_ACTIVITY_PARAMS_IN_SG);ptr++) { - /* The value can be or "0-9" or from "a-f" */ value_l = (*ptr - '0'); value_h = (*ptr - 'a'); @@ -5407,10 +5449,8 @@ static void regConvertStringtoCoexActivityTable(TI_UINT8 *strCoexActivityTable, /* 'a' is in fact 10 decimal in hexa */ add_value = value_h + 10; } - value = value*16 + add_value; - /* PRINTF(DBG_REGISTRY,("value %d add_value %d \n",value,add_value));*/ - - + value = value * 16 + add_value; + /* PRINTF(DBG_REGISTRY,("value %d add_value %d \n",value,add_value));*/ } else { @@ -5428,9 +5468,7 @@ static void regConvertStringtoCoexActivityTable(TI_UINT8 *strCoexActivityTable, entry++; } } - } - } static void parse_hex_string(char * pString, TI_UINT8 StrLength, TI_UINT8 * pBuffer, TI_UINT8 * Length) @@ -5440,7 +5478,7 @@ static void parse_hex_string(char * pString, TI_UINT8 StrLength, TI_UINT8 * pBuf while ((iter < StrLength) && (ch = pString[iter])) { - TI_UINT8 val = ((ch >= '0' && ch <= '9') ? (ch - '0') : + TI_UINT8 val = ((ch >= '0' && ch <= '9') ? (ch - '0') : (ch >= 'A' && ch <= 'F') ? (0xA + ch - 'A') : (ch >= 'a' && ch <= 'f') ? (0xA + ch - 'a') : 0); @@ -5490,4 +5528,3 @@ static void parse_filter_request(TRxDataFilterRequest* request, TI_UINT8 offset, parse_hex_string(pattern, patternLength, request->pattern, &request->patternLength); } } - diff --git a/wl1271/platforms/os/linux/Makefile b/wl1271/platforms/os/linux/Makefile index c9e7707f..0c56778c 100644 --- a/wl1271/platforms/os/linux/Makefile +++ b/wl1271/platforms/os/linux/Makefile @@ -13,7 +13,7 @@ STATIC_LIB ?= y # # Rebuild the supplicant # -BUILD_SUPPL ?= y +BUILD_SUPPL ?= n # # Supplicant @@ -53,9 +53,16 @@ USE_IRQ_ACTIVE_HIGH ?= n # TEST ?= n - +# +# Eth Support +# ETH_SUPPORT ?= n +# +# Debug +# +DEBUG ?= y + ## ## ## File lists and locations @@ -203,8 +210,8 @@ endif ifeq "$(HOST_PLATFORM)" "zoom1" TARGET = apps.tar endif -ifeq "$(HOST_PLATFORM)" "*UNDEFINED*" -TARGET = help +ifeq "$(HOST_PLATFORM)" "sholes" +TARGET = apps.tar endif # .PHONY: all @@ -244,7 +251,7 @@ TAR_FILE = $(HOST_PLATFORM)Binaries.tar apps.tar: apps ifeq ($(STRIP),y) @echo stripping... - cd $(OUTPUT_DIR) && $(CROSS_COMPILE)strip --strip-unneeded $(MODULES_LIST) + cd $(OUTPUT_DIR) && $(CROSS_COMPILE)strip -g --strip-unneeded $(MODULES_LIST) # cd $(DK_ROOT)/external_drivers/$(HOST_PLATFORM)/Linux/$(BUS_DRV) && $(CROSS_COMPILE)strip -g $(BUS_DRIVER_MODULE) endif @@ -278,19 +285,19 @@ clean: $(MAKE) -C $(OS_COMMON_DIR) CROSS_COMPILE=$(CROSS_COMPILE) DEBUG=$(DEBUG) BUILD_SUPPL=$(BUILD_SUPPL) SUPPL=$(SUPPL) WSPI=$(WSPI) INTR=$(INTR) XCC=$(XCC) INFO=$(INFO) STATIC_LIB=$(STATIC_LIB) clean $(MAKE) -C $(OS_LINUX_DIR) CROSS_COMPILE=$(CROSS_COMPILE) DEBUG=$(DEBUG) BUILD_SUPPL=$(BUILD_SUPPL) SUPPL=$(SUPPL) WSPI=$(WSPI) INTR=$(INTR) XCC=$(XCC) INFO=$(INFO) STATIC_LIB=$(STATIC_LIB) clean # $(MAKE) -C $(DK_ROOT)/external_drivers/$(HOST_PLATFORM)/Linux/$(BUS_DRV) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) KERNEL_DIR=$(KERNEL_DIR) OUTPUT_DIR=$(shell pwd)/$(OUTPUT_DIR) clean -# $(MAKE) -C $(WLAN_CUDK_DIR) CROSS_COMPILE=$(CROSS_COMPILE) BUILD_SUPPL=$(BUILD_SUPPL) SUPPL=$(SUPPL) XCC=$(XCC) ETH_SUPPORT=$(ETH_SUPPORT) clean +# $(MAKE) -C $(WLAN_CUDK_DIR) CROSS_COMPILE=$(CROSS_COMPILE) BUILD_SUPPL=$(BUILD_SUPPL) SUPPL=$(SUPPL) XCC=$(XCC) clean # $(MAKE) -C $(WLAN_CU_CLI_DIR) CROSS_COMPILE=$(CROSS_COMPILE) BUILD_SUPPL=$(BUILD_SUPPL) SUPPL=$(SUPPL) XCC=$(XCC) cleanall # $(MAKE) -C $(WLAN_LOADER_DIR) CROSS_COMPILE=$(CROSS_COMPILE) BUILD_SUPPL=$(BUILD_SUPPL) SUPPL=$(SUPPL) XCC=$(XCC) clean # $(MAKE) -C $(LINUX_WIRELESS_TOOLS_DIR) CROSS_COMPILE=$(CROSS_COMPILE) BUILD_SUPPL=$(BUILD_SUPPL) SUPPL=$(SUPPL) XCC=$(XCC) clean # $(MAKE) -C $(DBG_MDL) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) KERNEL_DIR=$(KERNEL_DIR) clean - @rm -f suppl.* apps.* voice.* - @rm -f *spi*.ko sdio.ko - @rm -f $(OUTPUT_DIR)/tiwlan_drv.ko +# @rm -f suppl.* apps.* voice.* +# @rm -f *spi*.ko sdio.ko +# @rm -f $(OUTPUT_DIR)/wlan_cu @rm -f $(OUTPUT_DIR)/tiwlan_drv.ko - @rm -f wpa_supplicant +# @rm -f wpa_supplicant # @rm -f $(FW_IMAGE_DEST_FILE) - @rm -rf *.o *.a \.*.o.cmd *~ *.~* core .depend dep +# @rm -rf *.o *.a \.*.o.cmd *~ *.~* core .depend dep # @rm -f tiwlan_drv.ko $(OUTPUT_DIR)/gwsi_drv.o $(OUTPUT_DIR)/debug_tools.o # @rm -rf $(OUTPUT_DIR)/iwconfig apps/iwlist $(OUTPUT_DIR)/iwevent diff --git a/wl1271/platforms/os/linux/build/Makefile b/wl1271/platforms/os/linux/build/Makefile index 92d05700..c93bb801 100644 --- a/wl1271/platforms/os/linux/build/Makefile +++ b/wl1271/platforms/os/linux/build/Makefile @@ -9,6 +9,7 @@ NO_ARCH_STRCMP ?= y NO_USERMODE_WORKAROUND ?= n MEM_ALLOC_TRACE ?= n +STACK_PROFILING_ON ?= n ## ## @@ -37,16 +38,18 @@ endif # List of linux OS files needed to be compiled # OS_SRCS = \ - $(DK_ROOT)/external_drivers/zoom2/Linux/sdio/SdioDrv.c \ $(DK_ROOT)/platforms/os/linux/src/WlanDrvIf.c \ - $(DK_ROOT)/platforms/hw/host_platform_$(HOST_PLATFORM)/linux/host_platform.c \ $(DK_ROOT)/platforms/os/linux/src/osapi.c \ $(DK_ROOT)/platforms/os/linux/src/osmemapi.c \ $(DK_ROOT)/platforms/os/linux/src/osRgstry_parser.c \ $(DK_ROOT)/platforms/os/linux/src/ipc_k.c \ $(DK_ROOT)/platforms/os/linux/src/WlanDrvWext.c \ $(DK_ROOT)/platforms/os/linux/src/CmdInterpretWext.c \ - $(DK_ROOT)/platforms/os/linux/src/RxBuf.c + $(DK_ROOT)/platforms/os/linux/src/RxBuf.c \ + $(DK_ROOT)/platforms/hw/linux/host_platform.c \ + $(DK_ROOT)/external_drivers/sdio/linux/SdioDrv.c +# $(DK_ROOT)/external_drivers/$(HOST_PLATFORM)/Linux/sdio/SdioDrv.c +# $(DK_ROOT)/platforms/hw/host_platform_$(HOST_PLATFORM)/linux/host_platform.c ifeq ($(STACK_PROFILING_ON),y) OS_SRCS += $(DK_ROOT)/platforms/os/linux/src/stack_profile.c @@ -58,16 +61,19 @@ ifeq ($(NO_ARCH_STRCMP),y) endif OS_INCS = $(DK_ROOT)/platforms/os/linux/inc $(DK_ROOT)/platforms/os/linux/src $(DK_ROOT)/platforms/os/common/inc -OS_INCS += $(DK_ROOT)/stad/src/core/EvHandler $(DK_ROOT)/Test $(DK_ROOT)/platforms/hw/host_platform_$(HOST_PLATFORM)/linux +#OS_INCS += $(DK_ROOT)/stad/src/core/EvHandler $(DK_ROOT)/Test $(DK_ROOT)/platforms/hw/host_platform_$(HOST_PLATFORM)/linux +OS_INCS += $(DK_ROOT)/stad/src/core/EvHandler $(DK_ROOT)/Test $(DK_ROOT)/platforms/hw/linux ifeq ($(WSPI),y) OS_SRCS += $(DK_ROOT)/platforms/hw/host_platform_$(HOST_PLATFORM)/linux/WspiAdapter.c - OS_INCS += $(EXT_DRV)/$(HOST_PLATFORM)/Linux/spi + OS_INCS += $(EXT_DRV)/$(HOST_PLATFORM)/Linux/spi endif ifeq ($(WSPI),n) - OS_SRCS += $(DK_ROOT)/platforms/hw/host_platform_$(HOST_PLATFORM)/linux/SdioAdapter.c - OS_INCS += $(EXT_DRV)/$(HOST_PLATFORM)/Linux/sdio +# OS_SRCS += $(DK_ROOT)/platforms/hw/host_platform_$(HOST_PLATFORM)/linux/SdioAdapter.c +# OS_INCS += $(EXT_DRV)/$(HOST_PLATFORM)/Linux/sdio + OS_SRCS += $(DK_ROOT)/platforms/hw/linux/SdioAdapter.c + OS_INCS += $(EXT_DRV)/sdio/linux endif OS_OBJS = $(patsubst %.c, %.o, $(OS_SRCS)) diff --git a/wl1271/platforms/os/linux/inc/WlanDrvIf.h b/wl1271/platforms/os/linux/inc/WlanDrvIf.h index 66d7cf47..0e9ddbe4 100644 --- a/wl1271/platforms/os/linux/inc/WlanDrvIf.h +++ b/wl1271/platforms/os/linux/inc/WlanDrvIf.h @@ -45,7 +45,6 @@ #include <linux/netdevice.h> #include <linux/workqueue.h> #include <mach/gpio.h> - #ifdef CONFIG_HAS_WAKELOCK #include <linux/wakelock.h> #endif @@ -57,9 +56,9 @@ #include "windows_types.h" #define TIWLAN_DRV_NAME "tiwlan" +#define DRIVERWQ_NAME "tiwlan_wq" #define TIWLAN_DRV_IF_NAME TIWLAN_DRV_NAME"%d" - #ifdef TI_DBG #define ti_dprintf(log, fmt, args...) do { \ if (log != TIWLAN_LOG_OTHER) { \ @@ -83,7 +82,7 @@ #endif -typedef enum +typedef enum { TIWLAN_LOG_ERROR, TIWLAN_LOG_INFO, @@ -102,12 +101,13 @@ typedef struct /* Driver object */ -typedef struct +typedef struct { TWlanDrvIfCommon tCommon; /* The driver object common part */ int irq; /* The OS IRQ handle */ - struct workqueue_struct *pWorkQueue;/* The OS work queue */ + unsigned long irq_flags; /* The IRQ flags */ + struct workqueue_struct *tiwlan_wq; /* Work Queue */ struct work_struct tWork; /* The OS work handle. */ spinlock_t lock; /* The OS spinlock handle. */ unsigned long flags; /* For saving the cpu flags during spinlock */ @@ -121,7 +121,7 @@ typedef struct struct wake_lock wl_wifi; /* Wifi wakelock */ struct wake_lock wl_rxwake; /* Wifi rx wakelock */ #endif - NDIS_HANDLE ConfigHandle;/* Temp - For Windows compatibility */ + NDIS_HANDLE ConfigHandle;/* Temp - For Windows compatibility */ } TWlanDrvIfObj, *TWlanDrvIfObjPtr; diff --git a/wl1271/platforms/os/linux/src/CmdInterpretWext.c b/wl1271/platforms/os/linux/src/CmdInterpretWext.c index d48770fb..656626fc 100644 --- a/wl1271/platforms/os/linux/src/CmdInterpretWext.c +++ b/wl1271/platforms/os/linux/src/CmdInterpretWext.c @@ -61,8 +61,7 @@ static int cmdInterpret_setSecurityParams (TI_HANDLE hCmdInterpret); static int cmdInterpret_initEvents(TI_HANDLE hCmdInterpret); static int cmdInterpret_unregisterEvents(TI_HANDLE hCmdInterpret, TI_HANDLE hEvHandler); -#define CHECK_PENDING_RESULT(x,y) if (x == COMMAND_PENDING) { os_printf ("Unexpected COMMAND PENDING result (cmd = 0x%x)\n",y.paramType); break; } -#define CHECK_PENDING_RESULT_RET(x,y) if (x == COMMAND_PENDING) { os_printf ("Unexpected COMMAND PENDING result (cmd = 0x%x)\n",y.paramType); return NULL; } +#define CHECK_PENDING_RESULT(x,y) if (x == COMMAND_PENDING) { os_printf ("Unexpected COMMAND PENDING result (cmd = 0x%x)\n",y->paramType); break; } static const char *ieee80211_modes[] = { "?", "IEEE 802.11 B", "IEEE 802.11 A", "IEEE 802.11 BG", "IEEE 802.11 ABG" @@ -71,7 +70,7 @@ static const char *ieee80211_modes[] = { typedef struct { - TI_UINT8 *assocRespBuffer; + TI_UINT8 *assocRespBuffer; TI_UINT32 assocRespLen; } cckm_assocInformation_t; @@ -110,10 +109,10 @@ TI_HANDLE cmdInterpret_Create (TI_HANDLE hOs) /* Deinitialize the cmdInterpreter module */ TI_STATUS cmdInterpret_Destroy (TI_HANDLE hCmdInterpret, TI_HANDLE hEvHandler) { - cmdInterpret_t * pCmdInterpret = (cmdInterpret_t *)hCmdInterpret; + cmdInterpret_t *pCmdInterpret = (cmdInterpret_t *)hCmdInterpret; /* Unregister events */ - cmdInterpret_unregisterEvents ((TI_HANDLE)pCmdInterpret, hEvHandler); + cmdInterpret_unregisterEvents ((TI_HANDLE)pCmdInterpret, hEvHandler); /* Release allocated memory */ os_memoryFree (pCmdInterpret->hOs, pCmdInterpret, sizeof(cmdInterpret_t)); @@ -139,13 +138,16 @@ void cmdInterpret_Init (TI_HANDLE hCmdInterpret, TStadHandlesList *pStadHandles) int cmdInterpret_convertAndExecute(TI_HANDLE hCmdInterpret, TConfigCommand *cmdObj) { cmdInterpret_t *pCmdInterpret = (cmdInterpret_t *)hCmdInterpret; + paramInfo_t *pParam; TI_STATUS res = TI_NOK; int i,j; - paramInfo_t Param; + union iwreq_data *wrqu = (union iwreq_data *)cmdObj->buffer1; cmdObj->return_code = WEXT_NOT_SUPPORTED; - + pParam = (paramInfo_t *)os_memoryAlloc(pCmdInterpret->hOs, sizeof(paramInfo_t)); + if (!pParam) + return res; /* Check user request */ switch (cmdObj->cmd) { @@ -162,12 +164,12 @@ int cmdInterpret_convertAndExecute(TI_HANDLE hCmdInterpret, TConfigCommand *cmdO /* If there is a given channel */ if (wrqu->freq.m != 0) { - Param.paramType = SITE_MGR_DESIRED_CHANNEL_PARAM; - Param.paramLength = sizeof(TI_UINT32); - Param.content.siteMgrDesiredChannel = wrqu->freq.m; + pParam->paramType = SITE_MGR_DESIRED_CHANNEL_PARAM; + pParam->paramLength = sizeof(TI_UINT32); + pParam->content.siteMgrDesiredChannel = wrqu->freq.m; - res = cmdDispatch_SetParam (pCmdInterpret->hCmdDispatch, &Param); - CHECK_PENDING_RESULT(res,Param) + res = cmdDispatch_SetParam (pCmdInterpret->hCmdDispatch, pParam); + CHECK_PENDING_RESULT(res,pParam) } break; } @@ -175,18 +177,18 @@ int cmdInterpret_convertAndExecute(TI_HANDLE hCmdInterpret, TConfigCommand *cmdO /* Get channel / frequency */ case SIOCGIWFREQ: { - Param.paramType = SITE_MGR_CURRENT_CHANNEL_PARAM; - Param.paramLength = sizeof(TI_UINT32); + pParam->paramType = SITE_MGR_CURRENT_CHANNEL_PARAM; + pParam->paramLength = sizeof(TI_UINT32); - res = cmdDispatch_GetParam (pCmdInterpret->hCmdDispatch, &Param); + res = cmdDispatch_GetParam (pCmdInterpret->hCmdDispatch, pParam); if(res == NO_SITE_SELECTED_YET) res = TI_OK; - - CHECK_PENDING_RESULT(res,Param) + + CHECK_PENDING_RESULT(res,pParam) if (res == TI_OK) { - wrqu->freq.m = Param.content.siteMgrCurrentChannel; + wrqu->freq.m = pParam->content.siteMgrCurrentChannel; wrqu->freq.e = 3; wrqu->freq.i = 0; } @@ -196,44 +198,45 @@ int cmdInterpret_convertAndExecute(TI_HANDLE hCmdInterpret, TConfigCommand *cmdO /* Set Mode (Adhoc / infrastructure) */ case SIOCSIWMODE: { - Param.paramType = SME_DESIRED_BSS_TYPE_PARAM; - Param.paramLength = sizeof(ScanBssType_e); + pParam->paramType = SME_DESIRED_BSS_TYPE_PARAM; + pParam->paramLength = sizeof(ScanBssType_e); switch (wrqu->mode) { case IW_MODE_AUTO: - Param.content.smeDesiredBSSType = BSS_ANY; + pParam->content.smeDesiredBSSType = BSS_ANY; break; case IW_MODE_ADHOC: - Param.content.smeDesiredBSSType = BSS_INDEPENDENT; + pParam->content.smeDesiredBSSType = BSS_INDEPENDENT; break; case IW_MODE_INFRA: - Param.content.smeDesiredBSSType = BSS_INFRASTRUCTURE; + pParam->content.smeDesiredBSSType = BSS_INFRASTRUCTURE; break; default: - return -EOPNOTSUPP; + res = -EOPNOTSUPP; + goto cmd_end; } - res = cmdDispatch_SetParam(pCmdInterpret->hCmdDispatch, &Param); - CHECK_PENDING_RESULT(res,Param) + res = cmdDispatch_SetParam(pCmdInterpret->hCmdDispatch, pParam); + CHECK_PENDING_RESULT(res,pParam) /* also set the site mgr desired mode */ - Param.paramType = SITE_MGR_DESIRED_BSS_TYPE_PARAM; - res = cmdDispatch_SetParam(pCmdInterpret->hCmdDispatch, &Param); - CHECK_PENDING_RESULT(res,Param) - + pParam->paramType = SITE_MGR_DESIRED_BSS_TYPE_PARAM; + res = cmdDispatch_SetParam(pCmdInterpret->hCmdDispatch, pParam); + CHECK_PENDING_RESULT(res,pParam) + break; } /* Get Mode (Adhoc / infrastructure) */ case SIOCGIWMODE: { - Param.paramType = SME_DESIRED_BSS_TYPE_PARAM; - Param.paramLength = sizeof(ScanBssType_e); - res = cmdDispatch_GetParam(pCmdInterpret->hCmdDispatch, &Param); - CHECK_PENDING_RESULT(res,Param) + pParam->paramType = SME_DESIRED_BSS_TYPE_PARAM; + pParam->paramLength = sizeof(ScanBssType_e); + res = cmdDispatch_GetParam(pCmdInterpret->hCmdDispatch, pParam); + CHECK_PENDING_RESULT(res,pParam) - switch (Param.content.smeDesiredBSSType) + switch (pParam->content.smeDesiredBSSType) { case BSS_ANY: wrqu->mode = IW_MODE_AUTO; @@ -255,19 +258,19 @@ int cmdInterpret_convertAndExecute(TI_HANDLE hCmdInterpret, TConfigCommand *cmdO case SIOCSIWSENS: { /* First get the current roaming configuration as a whole */ - Param.paramType = ROAMING_MNGR_APPLICATION_CONFIGURATION; - Param.paramLength = sizeof (roamingMngrConfigParams_t); - res = cmdDispatch_GetParam(pCmdInterpret->hCmdDispatch, &Param); + pParam->paramType = ROAMING_MNGR_APPLICATION_CONFIGURATION; + pParam->paramLength = sizeof (roamingMngrConfigParams_t); + res = cmdDispatch_GetParam(pCmdInterpret->hCmdDispatch, pParam); - CHECK_PENDING_RESULT(res,Param) + CHECK_PENDING_RESULT(res,pParam) /* Now change the low rssi threshold supplied by the user */ - Param.content.roamingConfigBuffer.roamingMngrThresholdsConfig.lowRssiThreshold = wrqu->param.value; + pParam->content.roamingConfigBuffer.roamingMngrThresholdsConfig.lowRssiThreshold = wrqu->param.value; /* And set the parameters back to the roaming module */ - res = cmdDispatch_SetParam(pCmdInterpret->hCmdDispatch, &Param); + res = cmdDispatch_SetParam(pCmdInterpret->hCmdDispatch, pParam); - CHECK_PENDING_RESULT(res,Param) + CHECK_PENDING_RESULT(res,pParam) break; } @@ -275,15 +278,15 @@ int cmdInterpret_convertAndExecute(TI_HANDLE hCmdInterpret, TConfigCommand *cmdO /* Get sensitivity (Rssi threshold OR CCA?)*/ case SIOCGIWSENS: { - Param.paramType = ROAMING_MNGR_APPLICATION_CONFIGURATION; - Param.paramLength = sizeof (roamingMngrConfigParams_t); - res = cmdDispatch_GetParam(pCmdInterpret->hCmdDispatch, &Param); + pParam->paramType = ROAMING_MNGR_APPLICATION_CONFIGURATION; + pParam->paramLength = sizeof (roamingMngrConfigParams_t); + res = cmdDispatch_GetParam(pCmdInterpret->hCmdDispatch, pParam); - CHECK_PENDING_RESULT(res,Param) + CHECK_PENDING_RESULT(res,pParam) if (res == TI_OK) { - wrqu->param.value = Param.content.roamingConfigBuffer.roamingMngrThresholdsConfig.lowRssiThreshold; + wrqu->param.value = pParam->content.roamingConfigBuffer.roamingMngrThresholdsConfig.lowRssiThreshold; wrqu->param.disabled = (wrqu->param.value == 0); wrqu->param.fixed = 1; } @@ -318,7 +321,7 @@ int cmdInterpret_convertAndExecute(TI_HANDLE hCmdInterpret, TConfigCommand *cmdO range->old_num_frequency = 0; /* Wireless event capability bitmasks */ - IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWAP); + IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWAP); IW_EVENT_CAPA_SET(range->event_capa, IWEVREGISTERED); IW_EVENT_CAPA_SET(range->event_capa, IWEVEXPIRED); @@ -326,16 +329,16 @@ int cmdInterpret_convertAndExecute(TI_HANDLE hCmdInterpret, TConfigCommand *cmdO range->sensitivity = 0; /* Rates */ - Param.paramType = SITE_MGR_DESIRED_SUPPORTED_RATE_SET_PARAM; - res = cmdDispatch_GetParam (pCmdInterpret->hCmdDispatch, &Param ); + pParam->paramType = SITE_MGR_DESIRED_SUPPORTED_RATE_SET_PARAM; + res = cmdDispatch_GetParam (pCmdInterpret->hCmdDispatch, pParam ); - CHECK_PENDING_RESULT(res,Param) + CHECK_PENDING_RESULT(res,pParam) /* Number of entries in the rates list */ - range->num_bitrates = Param.content.siteMgrDesiredSupportedRateSet.len; - for (i=0; i<Param.content.siteMgrDesiredSupportedRateSet.len; i++) + range->num_bitrates = pParam->content.siteMgrDesiredSupportedRateSet.len; + for (i=0; i<pParam->content.siteMgrDesiredSupportedRateSet.len; i++) { - range->bitrate[i] = ((Param.content.siteMgrDesiredSupportedRateSet.ratesString[i] & 0x7F) * 500000); + range->bitrate[i] = ((pParam->content.siteMgrDesiredSupportedRateSet.ratesString[i] & 0x7F) * 500000); } /* RTS threshold */ @@ -381,25 +384,25 @@ int cmdInterpret_convertAndExecute(TI_HANDLE hCmdInterpret, TConfigCommand *cmdO range->max_r_time = 0; /* Maximal retry lifetime */ /* Get Supported channels */ - Param.paramType = SITE_MGR_RADIO_BAND_PARAM; - res = cmdDispatch_GetParam( pCmdInterpret->hCmdDispatch, &Param ); + pParam->paramType = SITE_MGR_RADIO_BAND_PARAM; + res = cmdDispatch_GetParam( pCmdInterpret->hCmdDispatch, pParam ); - CHECK_PENDING_RESULT(res,Param) + CHECK_PENDING_RESULT(res,pParam) /* pParam->content.siteMgrRadioBand contains the current band, now get list of supported channels */ - Param.paramType = REGULATORY_DOMAIN_ALL_SUPPORTED_CHANNELS; - res = cmdDispatch_GetParam( pCmdInterpret->hCmdDispatch, &Param ); + pParam->paramType = REGULATORY_DOMAIN_ALL_SUPPORTED_CHANNELS; + res = cmdDispatch_GetParam( pCmdInterpret->hCmdDispatch, pParam ); - CHECK_PENDING_RESULT(res,Param) + CHECK_PENDING_RESULT(res,pParam) - range->num_channels = Param.content.supportedChannels.sizeOfList; /* Number of channels [0; num - 1] */ - range->num_frequency = Param.content.supportedChannels.sizeOfList; /* Number of entry in the list */ + range->num_channels = pParam->content.supportedChannels.sizeOfList; /* Number of channels [0; num - 1] */ + range->num_frequency = pParam->content.supportedChannels.sizeOfList; /* Number of entry in the list */ - for (i=0; i<Param.content.supportedChannels.sizeOfList; i++) + for (i=0; i<pParam->content.supportedChannels.sizeOfList; i++) { range->freq[i].e = 0; range->freq[i].m = i; - range->freq[i].i = Param.content.supportedChannels.listOfChannels[i]+1; + range->freq[i].i = pParam->content.supportedChannels.listOfChannels[i]+1; } /* Encoder (Encryption) capabilities */ @@ -418,9 +421,9 @@ int cmdInterpret_convertAndExecute(TI_HANDLE hCmdInterpret, TConfigCommand *cmdO range->encoding_login_index = 0; /* token index for login token */ /* Encryption capabilities */ - range->enc_capa = IW_ENC_CAPA_WPA | - IW_ENC_CAPA_WPA2 | - IW_ENC_CAPA_CIPHER_TKIP | + range->enc_capa = IW_ENC_CAPA_WPA | + IW_ENC_CAPA_WPA2 | + IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP; /* IW_ENC_CAPA_* bit field */ } @@ -434,21 +437,21 @@ int cmdInterpret_convertAndExecute(TI_HANDLE hCmdInterpret, TConfigCommand *cmdO if (MAC_NULL (wrqu->ap_addr.sa_data)) { /* Convert to "FF:FF:FF:FF:FF:FF" since this driver requires this value */ - MAC_COPY (Param.content.siteMgrDesiredBSSID, "\xff\xff\xff\xff\xff\xff"); - } + MAC_COPY (pParam->content.siteMgrDesiredBSSID, "\xff\xff\xff\xff\xff\xff"); + } else { - MAC_COPY (Param.content.siteMgrDesiredBSSID, wrqu->ap_addr.sa_data); + MAC_COPY (pParam->content.siteMgrDesiredBSSID, wrqu->ap_addr.sa_data); } - Param.paramType = SITE_MGR_DESIRED_BSSID_PARAM; - res = cmdDispatch_SetParam ( pCmdInterpret->hCmdDispatch, &Param ); - CHECK_PENDING_RESULT(res,Param) + pParam->paramType = SITE_MGR_DESIRED_BSSID_PARAM; + res = cmdDispatch_SetParam ( pCmdInterpret->hCmdDispatch, pParam ); + CHECK_PENDING_RESULT(res,pParam) /* also set it to the SME */ - Param.paramType = SME_DESIRED_BSSID_PARAM; - res = cmdDispatch_SetParam ( pCmdInterpret->hCmdDispatch, &Param ); - CHECK_PENDING_RESULT(res,Param) + pParam->paramType = SME_DESIRED_BSSID_PARAM; + res = cmdDispatch_SetParam ( pCmdInterpret->hCmdDispatch, pParam ); + CHECK_PENDING_RESULT(res,pParam) break; } @@ -458,20 +461,20 @@ int cmdInterpret_convertAndExecute(TI_HANDLE hCmdInterpret, TConfigCommand *cmdO case SIOCGIWAP: { /* Get current AP BSSID */ - Param.paramType = SITE_MGR_CURRENT_BSSID_PARAM; - res = cmdDispatch_GetParam ( pCmdInterpret->hCmdDispatch, &Param ); + pParam->paramType = SITE_MGR_CURRENT_BSSID_PARAM; + res = cmdDispatch_GetParam ( pCmdInterpret->hCmdDispatch, pParam ); - CHECK_PENDING_RESULT(res,Param) + CHECK_PENDING_RESULT(res,pParam) /* In case we are not associated - copy zeroes into bssid */ if (res == NO_SITE_SELECTED_YET) { MAC_COPY (wrqu->ap_addr.sa_data, "\x00\x00\x00\x00\x00\x00"); cmdObj->return_code = WEXT_OK; - } + } else if (res == TI_OK) { - MAC_COPY (wrqu->ap_addr.sa_data, Param.content.siteMgrDesiredBSSID); + MAC_COPY (wrqu->ap_addr.sa_data, pParam->content.siteMgrDesiredBSSID); } break; @@ -483,26 +486,27 @@ int cmdInterpret_convertAndExecute(TI_HANDLE hCmdInterpret, TConfigCommand *cmdO { struct iw_mlme *mlme = (struct iw_mlme *)cmdObj->param3; - Param.paramType = SITE_MGR_DESIRED_SSID_PARAM; + pParam->paramType = SITE_MGR_DESIRED_SSID_PARAM; /* In either case - we need to disconnect, so prepare "junk" SSID */ for (i = 0; i < MAX_SSID_LEN; i++) - Param.content.siteMgrDesiredSSID.str[i] = (i+1); - Param.content.siteMgrDesiredSSID.len = MAX_SSID_LEN; + pParam->content.siteMgrDesiredSSID.str[i] = (i+1); + pParam->content.siteMgrDesiredSSID.len = MAX_SSID_LEN; switch (mlme->cmd) { case IW_MLME_DEAUTH: case IW_MLME_DISASSOC: - res = cmdDispatch_SetParam (pCmdInterpret->hCmdDispatch, &Param ); - CHECK_PENDING_RESULT(res,Param) + res = cmdDispatch_SetParam (pCmdInterpret->hCmdDispatch, pParam ); + CHECK_PENDING_RESULT(res,pParam) /* now also set it to the SME */ - Param.paramType = SME_DESIRED_SSID_ACT_PARAM; - res = cmdDispatch_SetParam (pCmdInterpret->hCmdDispatch, &Param ); - CHECK_PENDING_RESULT(res,Param) + pParam->paramType = SME_DESIRED_SSID_ACT_PARAM; + res = cmdDispatch_SetParam (pCmdInterpret->hCmdDispatch, pParam ); + CHECK_PENDING_RESULT(res,pParam) break; default: - return -EOPNOTSUPP; + res = -EOPNOTSUPP; + goto cmd_end; } break; } @@ -510,12 +514,13 @@ int cmdInterpret_convertAndExecute(TI_HANDLE hCmdInterpret, TConfigCommand *cmdO /* trigger scanning (list cells) */ case SIOCSIWSCAN: { - struct iw_scan_req scanReq; - TScanParams scanParams; - Param.content.pScanParams = &scanParams; + struct iw_scan_req scanReq; + TScanParams scanParams; + + pParam->content.pScanParams = &scanParams; /* Init the parameters in case the Supplicant doesn't support them*/ - Param.content.pScanParams->desiredSsid.len = 0; + pParam->content.pScanParams->desiredSsid.len = 0; scanReq.scan_type = SCAN_TYPE_TRIGGERED_ACTIVE; if (cmdObj->param3) @@ -524,39 +529,39 @@ int cmdInterpret_convertAndExecute(TI_HANDLE hCmdInterpret, TConfigCommand *cmdO if (wrqu->data.flags & IW_SCAN_THIS_ESSID) { - Param.content.pScanParams->desiredSsid.len = scanReq.essid_len; - os_memoryCopy(pCmdInterpret->hOs,Param.content.pScanParams->desiredSsid.str, scanReq.essid, scanReq.essid_len); + pParam->content.pScanParams->desiredSsid.len = scanReq.essid_len; + os_memoryCopy(pCmdInterpret->hOs,pParam->content.pScanParams->desiredSsid.str, scanReq.essid, scanReq.essid_len); } else { - Param.content.pScanParams->desiredSsid.len = 0; /* scan all*/ + pParam->content.pScanParams->desiredSsid.len = 0; /* scan all*/ } } /* set the scan type according to driver trigger scan */ if (IW_SCAN_TYPE_PASSIVE == scanReq.scan_type) { - Param.content.pScanParams->scanType = SCAN_TYPE_TRIGGERED_PASSIVE; + pParam->content.pScanParams->scanType = SCAN_TYPE_TRIGGERED_PASSIVE; } else { - Param.content.pScanParams->scanType = SCAN_TYPE_TRIGGERED_ACTIVE; + pParam->content.pScanParams->scanType = SCAN_TYPE_TRIGGERED_ACTIVE; } - Param.paramType = SCAN_CNCN_BSSID_LIST_SCAN_PARAM; - Param.paramLength = sizeof(TScanParams); - res = cmdDispatch_SetParam (pCmdInterpret->hCmdDispatch, &Param ); - CHECK_PENDING_RESULT(res,Param) + pParam->paramType = SCAN_CNCN_BSSID_LIST_SCAN_PARAM; + pParam->paramLength = sizeof(TScanParams); + res = cmdDispatch_SetParam (pCmdInterpret->hCmdDispatch, pParam ); + CHECK_PENDING_RESULT(res,pParam) } break; /* get scanning results */ case SIOCGIWSCAN: { + unsigned char buf[30]; char *event = (char *)cmdObj->buffer2; - unsigned char buf[200]; struct iw_event iwe; - char *end_buf,*current_val; + char *end_buf, *current_val; int allocated_size; OS_802_11_BSSID_LIST_EX *my_list; OS_802_11_BSSID_EX *my_current; @@ -564,28 +569,32 @@ int cmdInterpret_convertAndExecute(TI_HANDLE hCmdInterpret, TConfigCommand *cmdO #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) struct iw_request_info info; - info.cmd= SIOCGIWSCAN; - info.flags=0; + info.cmd = SIOCGIWSCAN; + info.flags = 0; #endif end_buf = (char *)(cmdObj->buffer2 + wrqu->data.length); /* First get the amount of memory required to hold the entire BSSID list by setting the length to 0 */ - Param.paramType = SCAN_CNCN_BSSID_LIST_SIZE_PARAM; - Param.paramLength = 0; - res = cmdDispatch_GetParam (pCmdInterpret->hCmdDispatch, &Param ); - CHECK_PENDING_RESULT(res,Param) + pParam->paramType = SCAN_CNCN_BSSID_LIST_SIZE_PARAM; + pParam->paramLength = 0; + res = cmdDispatch_GetParam (pCmdInterpret->hCmdDispatch, pParam ); + CHECK_PENDING_RESULT(res,pParam) - allocated_size = Param.content.uBssidListSize; + allocated_size = pParam->content.uBssidListSize; /* Allocate required memory */ my_list = os_memoryAlloc (pCmdInterpret->hOs, allocated_size); + if (!my_list) { + res = -ENOMEM; + goto cmd_end; + } /* And retrieve the list */ - Param.paramType = SCAN_CNCN_BSSID_LIST_PARAM; - Param.content.pBssidList = my_list; - Param.paramLength = allocated_size; - res = cmdDispatch_GetParam (pCmdInterpret->hCmdDispatch, &Param ); - CHECK_PENDING_RESULT(res,Param) + pParam->paramType = SCAN_CNCN_BSSID_LIST_PARAM; + pParam->content.pBssidList = my_list; + pParam->paramLength = allocated_size; + res = cmdDispatch_GetParam (pCmdInterpret->hCmdDispatch, pParam ); + CHECK_PENDING_RESULT(res,pParam) my_current = &my_list->Bssid[0]; i=0; @@ -603,7 +612,7 @@ int cmdInterpret_convertAndExecute(TI_HANDLE hCmdInterpret, TConfigCommand *cmdO { break; } - + /* The first entry MUST be the AP BSSID */ os_memorySet (pCmdInterpret->hOs, &iwe, 0, sizeof(iwe)); iwe.cmd = SIOCGIWAP; @@ -659,7 +668,7 @@ int cmdInterpret_convertAndExecute(TI_HANDLE hCmdInterpret, TConfigCommand *cmdO os_memorySet (pCmdInterpret->hOs, &iwe, 0, sizeof(iwe)); iwe.cmd = SIOCGIWFREQ; iwe.u.freq.m = my_current->Configuration.Union.channel; - iwe.u.freq.e = 3; + iwe.u.freq.e = 3; /* Frequency divider */ iwe.u.freq.i = 0; iwe.len = IW_EV_FREQ_LEN; @@ -730,7 +739,7 @@ int cmdInterpret_convertAndExecute(TI_HANDLE hCmdInterpret, TConfigCommand *cmdO os_memorySet (pCmdInterpret->hOs, &iwe, 0, sizeof(iwe)); iwe.cmd = IWEVGENIE; offset = sizeof(OS_802_11_FIXED_IEs); - while(offset < my_current->IELength) + while(offset < my_current->IELength) { OS_802_11_VARIABLE_IEs *pIE; pIE = (OS_802_11_VARIABLE_IEs*)&(my_current->IEs[offset]); @@ -743,7 +752,7 @@ int cmdInterpret_convertAndExecute(TI_HANDLE hCmdInterpret, TConfigCommand *cmdO event = iwe_stream_add_point(&info, event, end_buf, &iwe, (char *)&(my_current->IEs[offset])); #endif offset += pIE->Length + 2; - } + } my_current = (OS_802_11_BSSID_EX *) (((char *) my_current) + my_current->Length); } @@ -775,15 +784,15 @@ int cmdInterpret_convertAndExecute(TI_HANDLE hCmdInterpret, TConfigCommand *cmdO else cmdInterpret_setSecurityParams (hCmdInterpret); - os_memoryZero (pCmdInterpret->hOs, &Param.content.siteMgrDesiredSSID.str, MAX_SSID_LEN); + os_memoryZero (pCmdInterpret->hOs, &pParam->content.siteMgrDesiredSSID.str, MAX_SSID_LEN); - Param.content.siteMgrCurrentSSID.len = 0; + pParam->content.siteMgrCurrentSSID.len = 0; if (wrqu->essid.flags == 0) { /* Connect to ANY ESSID - use empty */ - os_memoryCopy(pCmdInterpret->hOs, &Param.content.siteMgrCurrentSSID.str, "\00", 1); - Param.content.siteMgrCurrentSSID.len = 0;; + os_memoryCopy(pCmdInterpret->hOs, &pParam->content.siteMgrCurrentSSID.str, "\00", 1); + pParam->content.siteMgrCurrentSSID.len = 0;; } else { /* Handle ESSID length issue in WEXT (backward compatibility with old/new versions) */ @@ -793,18 +802,18 @@ int cmdInterpret_convertAndExecute(TI_HANDLE hCmdInterpret, TConfigCommand *cmdO while (length < wrqu->essid.length && extra[length]) length++; - os_memoryCopy(pCmdInterpret->hOs, &Param.content.siteMgrCurrentSSID.str, cmdObj->buffer2, length); - Param.content.siteMgrCurrentSSID.len = length; + os_memoryCopy(pCmdInterpret->hOs, &pParam->content.siteMgrCurrentSSID.str, cmdObj->buffer2, length); + pParam->content.siteMgrCurrentSSID.len = length; } - Param.paramType = SITE_MGR_DESIRED_SSID_PARAM; - Param.paramLength = sizeof (TSsid); - res = cmdDispatch_SetParam (pCmdInterpret->hCmdDispatch, &Param ); - CHECK_PENDING_RESULT(res,Param) + pParam->paramType = SITE_MGR_DESIRED_SSID_PARAM; + pParam->paramLength = sizeof (TSsid); + res = cmdDispatch_SetParam (pCmdInterpret->hCmdDispatch, pParam ); + CHECK_PENDING_RESULT(res,pParam) /* also set it to the SME */ - Param.paramType = SME_DESIRED_SSID_ACT_PARAM; - res = cmdDispatch_SetParam (pCmdInterpret->hCmdDispatch, &Param ); - CHECK_PENDING_RESULT(res,Param) + pParam->paramType = SME_DESIRED_SSID_ACT_PARAM; + res = cmdDispatch_SetParam (pCmdInterpret->hCmdDispatch, pParam ); + CHECK_PENDING_RESULT(res,pParam) } break; @@ -813,22 +822,22 @@ int cmdInterpret_convertAndExecute(TI_HANDLE hCmdInterpret, TConfigCommand *cmdO { char *extra = (char *)cmdObj->buffer2; - Param.paramType = SITE_MGR_CURRENT_SSID_PARAM; - res = cmdDispatch_GetParam ( pCmdInterpret->hCmdDispatch, &Param ); + pParam->paramType = SITE_MGR_CURRENT_SSID_PARAM; + res = cmdDispatch_GetParam ( pCmdInterpret->hCmdDispatch, pParam ); if(res == NO_SITE_SELECTED_YET) res = WEXT_OK; - CHECK_PENDING_RESULT(res,Param) + CHECK_PENDING_RESULT(res,pParam) wrqu->essid.flags = 1; - os_memoryCopy(pCmdInterpret->hOs, cmdObj->buffer2, &Param.content.siteMgrCurrentSSID.str, Param.content.siteMgrCurrentSSID.len ); + os_memoryCopy(pCmdInterpret->hOs, cmdObj->buffer2, &pParam->content.siteMgrCurrentSSID.str, pParam->content.siteMgrCurrentSSID.len ); - if(Param.content.siteMgrCurrentSSID.len < MAX_SSID_LEN) + if (pParam->content.siteMgrCurrentSSID.len < MAX_SSID_LEN) { - extra[Param.content.siteMgrCurrentSSID.len] = 0; + extra[pParam->content.siteMgrCurrentSSID.len] = 0; } - wrqu->essid.length = Param.content.siteMgrCurrentSSID.len; + wrqu->essid.length = pParam->content.siteMgrCurrentSSID.len; } break; @@ -836,8 +845,10 @@ int cmdInterpret_convertAndExecute(TI_HANDLE hCmdInterpret, TConfigCommand *cmdO /* set node name/nickname */ case SIOCSIWNICKN: { - if (wrqu->data.length > IW_ESSID_MAX_SIZE) - return -EINVAL; + if (wrqu->data.length > IW_ESSID_MAX_SIZE) { + res = -EINVAL; + goto cmd_end; + } os_memoryCopy(pCmdInterpret->hOs, pCmdInterpret->nickName, cmdObj->buffer2, wrqu->data.length); pCmdInterpret->nickName[IW_ESSID_MAX_SIZE] = 0; res = TI_OK; @@ -860,28 +871,28 @@ int cmdInterpret_convertAndExecute(TI_HANDLE hCmdInterpret, TConfigCommand *cmdO /* Set RTS Threshold */ case SIOCSIWRTS: { - Param.paramType = TWD_RTS_THRESHOLD_PARAM; + pParam->paramType = TWD_RTS_THRESHOLD_PARAM; if (wrqu->rts.disabled) - Param.content.halCtrlRtsThreshold = TWD_RTS_THRESHOLD_DEF; + pParam->content.halCtrlRtsThreshold = TWD_RTS_THRESHOLD_DEF; else - Param.content.halCtrlRtsThreshold = wrqu->rts.value; + pParam->content.halCtrlRtsThreshold = wrqu->rts.value; - res = cmdDispatch_SetParam (pCmdInterpret->hCmdDispatch,&Param); - CHECK_PENDING_RESULT(res,Param) + res = cmdDispatch_SetParam (pCmdInterpret->hCmdDispatch,pParam); + CHECK_PENDING_RESULT(res,pParam) break; } - + /* Get RTS Threshold */ case SIOCGIWRTS: { - Param.paramType = TWD_RTS_THRESHOLD_PARAM; - res = cmdDispatch_GetParam (pCmdInterpret->hCmdDispatch,&Param); + pParam->paramType = TWD_RTS_THRESHOLD_PARAM; + res = cmdDispatch_GetParam (pCmdInterpret->hCmdDispatch,pParam); - CHECK_PENDING_RESULT(res,Param) + CHECK_PENDING_RESULT(res,pParam) - wrqu->rts.value = Param.content.halCtrlRtsThreshold; - wrqu->rts.fixed = 1; + wrqu->rts.value = pParam->content.halCtrlRtsThreshold; + wrqu->rts.fixed = 1; cmdObj->return_code = WEXT_OK; break; } @@ -889,11 +900,11 @@ int cmdInterpret_convertAndExecute(TI_HANDLE hCmdInterpret, TConfigCommand *cmdO /* Set Fragmentation threshold */ case SIOCSIWFRAG: { - Param.paramType = TWD_FRAG_THRESHOLD_PARAM; - Param.content.halCtrlFragThreshold = ((wrqu->frag.value+1)>>1) << 1; /* make it always even */ + pParam->paramType = TWD_FRAG_THRESHOLD_PARAM; + pParam->content.halCtrlFragThreshold = ((wrqu->frag.value+1)>>1) << 1; /* make it always even */ - res = cmdDispatch_SetParam(pCmdInterpret->hCmdDispatch, &Param); - CHECK_PENDING_RESULT(res,Param) + res = cmdDispatch_SetParam(pCmdInterpret->hCmdDispatch, pParam); + CHECK_PENDING_RESULT(res,pParam) break; } @@ -901,13 +912,13 @@ int cmdInterpret_convertAndExecute(TI_HANDLE hCmdInterpret, TConfigCommand *cmdO /* Get Fragmentation threshold */ case SIOCGIWFRAG: { - Param.paramType = TWD_FRAG_THRESHOLD_PARAM; - res = cmdDispatch_GetParam (pCmdInterpret->hCmdDispatch,&Param); + pParam->paramType = TWD_FRAG_THRESHOLD_PARAM; + res = cmdDispatch_GetParam (pCmdInterpret->hCmdDispatch,pParam); - CHECK_PENDING_RESULT(res,Param) + CHECK_PENDING_RESULT(res,pParam) - wrqu->rts.value = Param.content.halCtrlFragThreshold; - wrqu->rts.fixed = 1; + wrqu->rts.value = pParam->content.halCtrlFragThreshold; + wrqu->rts.fixed = 1; cmdObj->return_code = WEXT_OK; break; } @@ -920,25 +931,25 @@ int cmdInterpret_convertAndExecute(TI_HANDLE hCmdInterpret, TConfigCommand *cmdO } else { - Param.paramType = REGULATORY_DOMAIN_CURRENT_TX_POWER_LEVEL_PARAM; - Param.content.desiredTxPower = wrqu->txpower.value; - res = cmdDispatch_SetParam (pCmdInterpret->hCmdDispatch,&Param); - CHECK_PENDING_RESULT(res,Param) + pParam->paramType = REGULATORY_DOMAIN_CURRENT_TX_POWER_LEVEL_PARAM; + pParam->content.desiredTxPower = wrqu->txpower.value; + res = cmdDispatch_SetParam (pCmdInterpret->hCmdDispatch,pParam); + CHECK_PENDING_RESULT(res,pParam) } break; /* Get TX power level */ case SIOCGIWTXPOW: { - Param.paramType = REGULATORY_DOMAIN_CURRENT_TX_POWER_IN_DBM_PARAM; - res = cmdDispatch_GetParam (pCmdInterpret->hCmdDispatch,&Param); + pParam->paramType = REGULATORY_DOMAIN_CURRENT_TX_POWER_IN_DBM_PARAM; + res = cmdDispatch_GetParam (pCmdInterpret->hCmdDispatch,pParam); - CHECK_PENDING_RESULT(res,Param) + CHECK_PENDING_RESULT(res,pParam) wrqu->txpower.flags = IW_TXPOW_RELATIVE | IW_TXPOW_RANGE; wrqu->txpower.disabled = 0; wrqu->txpower.fixed = 0; - wrqu->txpower.value = Param.content.desiredTxPower; + wrqu->txpower.value = pParam->content.desiredTxPower; break; } @@ -955,35 +966,34 @@ int cmdInterpret_convertAndExecute(TI_HANDLE hCmdInterpret, TConfigCommand *cmdO index--; else { - Param.paramType = RSN_DEFAULT_KEY_ID; - res = cmdDispatch_GetParam (pCmdInterpret->hCmdDispatch,&Param); - CHECK_PENDING_RESULT(res,Param) - index = Param.content.rsnDefaultKeyID; + pParam->paramType = RSN_DEFAULT_KEY_ID; + res = cmdDispatch_GetParam (pCmdInterpret->hCmdDispatch,pParam); + CHECK_PENDING_RESULT(res,pParam) + index = pParam->content.rsnDefaultKeyID; } - - Param.paramType = RSN_ADD_KEY_PARAM; + + pParam->paramType = RSN_ADD_KEY_PARAM; /* remove key if disabled */ if (wrqu->data.flags & IW_ENCODE_DISABLED) { - Param.paramType = RSN_REMOVE_KEY_PARAM; + pParam->paramType = RSN_REMOVE_KEY_PARAM; } - Param.content.rsnOsKey.KeyIndex = index; + pParam->content.rsnOsKey.KeyIndex = index; if (wrqu->data.length) { - os_memoryCopy(pCmdInterpret->hOs, &Param.content.rsnOsKey.KeyMaterial, cmdObj->buffer2, wrqu->data.length); - Param.content.rsnOsKey.KeyLength = wrqu->data.length; + os_memoryCopy(pCmdInterpret->hOs, &pParam->content.rsnOsKey.KeyMaterial, cmdObj->buffer2, wrqu->data.length); + pParam->content.rsnOsKey.KeyLength = wrqu->data.length; } else { /* No key material is provided, just set given index as default TX key */ - Param.paramType = RSN_DEFAULT_KEY_ID; - Param.content.rsnDefaultKeyID = index; + pParam->paramType = RSN_DEFAULT_KEY_ID; + pParam->content.rsnDefaultKeyID = index; } - - res = cmdDispatch_SetParam (pCmdInterpret->hCmdDispatch, &Param); - CHECK_PENDING_RESULT(res,Param) + res = cmdDispatch_SetParam (pCmdInterpret->hCmdDispatch, pParam); + CHECK_PENDING_RESULT(res,pParam) break; } @@ -1005,25 +1015,25 @@ int cmdInterpret_convertAndExecute(TI_HANDLE hCmdInterpret, TConfigCommand *cmdO index--; else { - Param.paramType = RSN_DEFAULT_KEY_ID; - res = cmdDispatch_GetParam (pCmdInterpret->hCmdDispatch,&Param); - CHECK_PENDING_RESULT(res,Param) - index = Param.content.rsnDefaultKeyID; + pParam->paramType = RSN_DEFAULT_KEY_ID; + res = cmdDispatch_GetParam (pCmdInterpret->hCmdDispatch,pParam); + CHECK_PENDING_RESULT(res,pParam) + index = pParam->content.rsnDefaultKeyID; wrqu->data.flags = (index+1); } - Param.content.pRsnKey = &myKeyInfo; + pParam->content.pRsnKey = &myKeyInfo; - Param.paramType = RSN_KEY_PARAM; - Param.content.pRsnKey->keyIndex = index; - res = cmdDispatch_GetParam (pCmdInterpret->hCmdDispatch,&Param); - CHECK_PENDING_RESULT(res,Param) + pParam->paramType = RSN_KEY_PARAM; + pParam->content.pRsnKey->keyIndex = index; + res = cmdDispatch_GetParam (pCmdInterpret->hCmdDispatch,pParam); + CHECK_PENDING_RESULT(res,pParam) - if ((Param.content.pRsnKey) && (Param.content.pRsnKey->encLen)) + if ((pParam->content.pRsnKey) && (pParam->content.pRsnKey->encLen)) { wrqu->data.flags |= IW_ENCODE_ENABLED; - wrqu->data.length = Param.content.pRsnKey->encLen; - os_memoryCopy(pCmdInterpret->hOs,extra, &Param.content.pRsnKey->encKey,wrqu->data.length); + wrqu->data.length = pParam->content.pRsnKey->encLen; + os_memoryCopy(pCmdInterpret->hOs,extra, &pParam->content.pRsnKey->encKey,wrqu->data.length); } /* Convert from driver (OID-like) authentication parameters to WEXT */ @@ -1050,22 +1060,21 @@ int cmdInterpret_convertAndExecute(TI_HANDLE hCmdInterpret, TConfigCommand *cmdO } break; - case SIOCSIWGENIE: + case SIOCSIWGENIE: { - Param.paramType = RSN_GENERIC_IE_PARAM; - Param.content.rsnGenericIE.length = wrqu->data.length; - if (wrqu->data.length) { - os_memoryCopy(pCmdInterpret->hOs, Param.content.rsnGenericIE.data, cmdObj->param3, wrqu->data.length); - } - res = cmdDispatch_SetParam (pCmdInterpret->hCmdDispatch, &Param); - CHECK_PENDING_RESULT(res,Param); - - break; + pParam->paramType = RSN_GENERIC_IE_PARAM; + pParam->content.rsnGenericIE.length = wrqu->data.length; + if (wrqu->data.length) { + os_memoryCopy(pCmdInterpret->hOs, pParam->content.rsnGenericIE.data, cmdObj->param3, wrqu->data.length); + } + res = cmdDispatch_SetParam (pCmdInterpret->hCmdDispatch, pParam); + CHECK_PENDING_RESULT(res,pParam); } + break; /* Set Authentication */ case SIOCSIWAUTH: - + res = TI_OK; switch (wrqu->param.flags & IW_AUTH_INDEX) { case IW_AUTH_WPA_VERSION: @@ -1094,15 +1103,13 @@ int cmdInterpret_convertAndExecute(TI_HANDLE hCmdInterpret, TConfigCommand *cmdO case IW_AUTH_PRIVACY_INVOKED: break; default: - return -EOPNOTSUPP; + res = -EOPNOTSUPP; } - - res = TI_OK; - break; /* Get Authentication */ case SIOCGIWAUTH: + res = TI_OK; { switch (wrqu->param.flags & IW_AUTH_INDEX) { @@ -1122,12 +1129,9 @@ int cmdInterpret_convertAndExecute(TI_HANDLE hCmdInterpret, TConfigCommand *cmdO wrqu->param.value = pCmdInterpret->wai.iw_auth_80211_auth_alg; break; default: - return -EOPNOTSUPP; + res = -EOPNOTSUPP; } } - - res = TI_OK; - break; /* set encoding token & mode */ @@ -1138,26 +1142,28 @@ int cmdInterpret_convertAndExecute(TI_HANDLE hCmdInterpret, TConfigCommand *cmdO TI_UINT8 temp[32]; #ifdef GEM_SUPPORTED - if ( ext->alg == KEY_GEM ) { - TSecurityKeys key; - os_memoryZero(pCmdInterpret->hOs, &key, sizeof(key)); - key.keyType = ext->alg; - if (ext->key_len > MAX_KEY_LEN) { - return -EINVAL; - } - key.encLen = ext->key_len; - os_memoryCopy(pCmdInterpret->hOs, key.encKey, ext->key, ext->key_len); - key.keyIndex = (wrqu->encoding.flags & IW_ENCODE_INDEX) - 1; - os_memoryCopy(pCmdInterpret->hOs, &key.macAddress, ext->addr.sa_data, sizeof(key.macAddress)); - - Param.paramType = RSN_SET_KEY_PARAM; - Param.paramLength = sizeof(Param.content.pRsnKey); - Param.content.pRsnKey = &key; - - res = cmdDispatch_SetParam (pCmdInterpret->hCmdDispatch, &Param); - CHECK_PENDING_RESULT(res,Param); - break; - } + if ( ext->alg == KEY_GEM ) { + TSecurityKeys key; + + os_memoryZero(pCmdInterpret->hOs, &key, sizeof(key)); + key.keyType = ext->alg; + if (ext->key_len > MAX_KEY_LEN) { + res = -EINVAL; + break; + } + key.encLen = ext->key_len; + os_memoryCopy(pCmdInterpret->hOs, key.encKey, ext->key, ext->key_len); + key.keyIndex = (wrqu->encoding.flags & IW_ENCODE_INDEX) - 1; + os_memoryCopy(pCmdInterpret->hOs, &key.macAddress, ext->addr.sa_data, sizeof(key.macAddress)); + + pParam->paramType = RSN_SET_KEY_PARAM; + pParam->paramLength = sizeof(pParam->content.pRsnKey); + pParam->content.pRsnKey = &key; + + res = cmdDispatch_SetParam (pCmdInterpret->hCmdDispatch, pParam); + CHECK_PENDING_RESULT(res,pParam); + break; + } #endif addr = ext->addr.sa_data; @@ -1167,36 +1173,36 @@ int cmdInterpret_convertAndExecute(TI_HANDLE hCmdInterpret, TConfigCommand *cmdO os_printf ("ext->ext_flags = 0x%x\n",ext->ext_flags); os_printf ("ext->key_len = 0x%x\n",ext->key_len); os_printf ("ext->key_idx = 0x%x\n",(wrqu->encoding.flags & IW_ENCODE_INDEX)); - + os_printf ("key = "); for (i=0; i<ext->key_len; i++) { os_printf ("0x%02x:",ext->key[i]); } - os_printf ("\n"); + os_printf ("\n"); */ - MAC_COPY (Param.content.rsnOsKey.BSSID, addr); + MAC_COPY (pParam->content.rsnOsKey.BSSID, addr); - Param.content.rsnOsKey.KeyLength = ext->key_len; + pParam->content.rsnOsKey.KeyLength = ext->key_len; - Param.content.rsnOsKey.KeyIndex = wrqu->encoding.flags & IW_ENCODE_INDEX; - Param.content.rsnOsKey.KeyIndex -= 1; + pParam->content.rsnOsKey.KeyIndex = wrqu->encoding.flags & IW_ENCODE_INDEX; + pParam->content.rsnOsKey.KeyIndex -= 1; if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { - Param.content.rsnOsKey.KeyIndex |= TIWLAN_KEY_FLAGS_TRANSMIT; + pParam->content.rsnOsKey.KeyIndex |= TIWLAN_KEY_FLAGS_TRANSMIT; } if (addr[0]!=0xFF) { - Param.content.rsnOsKey.KeyIndex |= TIWLAN_KEY_FLAGS_PAIRWISE; + pParam->content.rsnOsKey.KeyIndex |= TIWLAN_KEY_FLAGS_PAIRWISE; } if (ext->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID) { - os_memoryCopy(pCmdInterpret->hOs, &Param.content.rsnOsKey.KeyRSC, &ext->rx_seq, IW_ENCODE_SEQ_MAX_SIZE); - Param.content.rsnOsKey.KeyIndex |= TIWLAN_KEY_FLAGS_SET_KEY_RSC; + os_memoryCopy(pCmdInterpret->hOs, &pParam->content.rsnOsKey.KeyRSC, &ext->rx_seq, IW_ENCODE_SEQ_MAX_SIZE); + pParam->content.rsnOsKey.KeyIndex |= TIWLAN_KEY_FLAGS_SET_KEY_RSC; } /* If key is TKIP - need to switch RX and TX MIC (to match driver API) */ @@ -1205,19 +1211,19 @@ int cmdInterpret_convertAndExecute(TI_HANDLE hCmdInterpret, TConfigCommand *cmdO os_memoryCopy(pCmdInterpret->hOs,(TI_UINT8*)(((TI_UINT8*)&temp)+24),(TI_UINT8*)(((TI_UINT8*)&ext->key)+16),8); os_memoryCopy(pCmdInterpret->hOs,(TI_UINT8*)(((TI_UINT8*)&temp)+16),(TI_UINT8*)(((TI_UINT8*)&ext->key)+24),8); os_memoryCopy(pCmdInterpret->hOs,&temp,&ext->key,16); - os_memoryCopy(pCmdInterpret->hOs, &Param.content.rsnOsKey.KeyMaterial, &temp, ext->key_len); + os_memoryCopy(pCmdInterpret->hOs, &pParam->content.rsnOsKey.KeyMaterial, &temp, ext->key_len); } else { - os_memoryCopy(pCmdInterpret->hOs, &Param.content.rsnOsKey.KeyMaterial, &ext->key, ext->key_len); + os_memoryCopy(pCmdInterpret->hOs, &pParam->content.rsnOsKey.KeyMaterial, &ext->key, ext->key_len); } if (ext->key_len == 0) - Param.paramType = RSN_REMOVE_KEY_PARAM; + pParam->paramType = RSN_REMOVE_KEY_PARAM; else - Param.paramType = RSN_ADD_KEY_PARAM; + pParam->paramType = RSN_ADD_KEY_PARAM; - res = cmdDispatch_SetParam (pCmdInterpret->hCmdDispatch, &Param); - CHECK_PENDING_RESULT(res,Param) + res = cmdDispatch_SetParam (pCmdInterpret->hCmdDispatch, pParam); + CHECK_PENDING_RESULT(res,pParam) } break; @@ -1230,26 +1236,26 @@ int cmdInterpret_convertAndExecute(TI_HANDLE hCmdInterpret, TConfigCommand *cmdO switch (pmksa->cmd) { case IW_PMKSA_ADD: - Param.paramType = RSN_PMKID_LIST; - Param.content.rsnPMKIDList.BSSIDInfoCount = 1; - Param.content.rsnPMKIDList.Length = 2*sizeof(TI_UINT32) + MAC_ADDR_LEN + PMKID_VALUE_SIZE; - MAC_COPY (Param.content.rsnPMKIDList.osBSSIDInfo[0].BSSID, pmksa->bssid.sa_data); - os_memoryCopy(pCmdInterpret->hOs, &Param.content.rsnPMKIDList.osBSSIDInfo[0].PMKID, pmksa->pmkid, IW_PMKID_LEN); + pParam->paramType = RSN_PMKID_LIST; + pParam->content.rsnPMKIDList.BSSIDInfoCount = 1; + pParam->content.rsnPMKIDList.Length = 2*sizeof(TI_UINT32) + MAC_ADDR_LEN + PMKID_VALUE_SIZE; + MAC_COPY (pParam->content.rsnPMKIDList.osBSSIDInfo[0].BSSID, pmksa->bssid.sa_data); + os_memoryCopy(pCmdInterpret->hOs, &pParam->content.rsnPMKIDList.osBSSIDInfo[0].PMKID, pmksa->pmkid, IW_PMKID_LEN); - res = cmdDispatch_SetParam (pCmdInterpret->hCmdDispatch, &Param); - CHECK_PENDING_RESULT(res,Param) + res = cmdDispatch_SetParam (pCmdInterpret->hCmdDispatch, pParam); + CHECK_PENDING_RESULT(res,pParam) break; case IW_PMKSA_REMOVE: /* Not supported yet */ break; case IW_PMKSA_FLUSH: - Param.paramType = RSN_PMKID_LIST; + pParam->paramType = RSN_PMKID_LIST; /* By using info count=0, RSN knows to clear its tables */ /* It's also possible to call rsn_resetPMKIDList directly, but cmdDispatcher should be the interface */ - Param.content.rsnPMKIDList.BSSIDInfoCount = 0; - res = cmdDispatch_SetParam (pCmdInterpret->hCmdDispatch, &Param); - CHECK_PENDING_RESULT(res,Param) + pParam->content.rsnPMKIDList.BSSIDInfoCount = 0; + res = cmdDispatch_SetParam (pCmdInterpret->hCmdDispatch, pParam); + CHECK_PENDING_RESULT(res,pParam) break; default: @@ -1269,16 +1275,15 @@ int cmdInterpret_convertAndExecute(TI_HANDLE hCmdInterpret, TConfigCommand *cmdO os_printf ("in_buffer = 0x%x (len = %d)\n",my_command->in_buffer,(unsigned int)my_command->in_buffer_len); os_printf ("out_buffer = 0x%x (len = %d)\n",my_command->out_buffer,(unsigned int)my_command->out_buffer_len); */ - - Param.paramType = my_command->cmd; + + pParam->paramType = my_command->cmd; if (IS_PARAM_ASYNC(my_command->cmd)) { - /* os_printf ("Detected ASYNC command - setting CB \n"); */ - Param.content.interogateCmdCBParams.hCb = (TI_HANDLE)pCmdInterpret; - Param.content.interogateCmdCBParams.fCb = (void*)cmdInterpret_ServiceCompleteCB; - Param.content.interogateCmdCBParams.pCb = my_command->out_buffer; + pParam->content.interogateCmdCBParams.hCb = (TI_HANDLE)pCmdInterpret; + pParam->content.interogateCmdCBParams.fCb = (void*)cmdInterpret_ServiceCompleteCB; + pParam->content.interogateCmdCBParams.pCb = my_command->out_buffer; if (my_command->out_buffer) { /* the next copy is need for PLT commands */ @@ -1287,50 +1292,48 @@ int cmdInterpret_convertAndExecute(TI_HANDLE hCmdInterpret, TConfigCommand *cmdO } else if ((my_command->in_buffer) && (my_command->in_buffer_len)) { - /* this cmd doesnt have the structure allocated as part of the paramInfo_t structure. as a result we need to allocate the memory internally. */ if(IS_ALLOC_NEEDED_PARAM(my_command->cmd)) { - - *(void**)&Param.content = os_memoryAlloc(pCmdInterpret->hOs, my_command->in_buffer_len); - os_memoryCopy(pCmdInterpret->hOs, *(void**)&Param.content, my_command->in_buffer, my_command->in_buffer_len); + *(void **)&pParam->content = os_memoryAlloc(pCmdInterpret->hOs, my_command->in_buffer_len); + os_memoryCopy(pCmdInterpret->hOs, *(void **)&pParam->content, my_command->in_buffer, my_command->in_buffer_len); } else - os_memoryCopy(pCmdInterpret->hOs,&Param.content,my_command->in_buffer,my_command->in_buffer_len); + os_memoryCopy(pCmdInterpret->hOs,&pParam->content,my_command->in_buffer,my_command->in_buffer_len); } if (my_command->flags & PRIVATE_CMD_SET_FLAG) { - Param.paramLength = my_command->in_buffer_len; - res = cmdDispatch_SetParam (pCmdInterpret->hCmdDispatch,&Param); - } + /* os_printf ("Calling setParam\n"); */ + pParam->paramLength = my_command->in_buffer_len; + res = cmdDispatch_SetParam (pCmdInterpret->hCmdDispatch,pParam); + } else if (my_command->flags & PRIVATE_CMD_GET_FLAG) { - /* os_printf ("Calling getParam\n"); */ - Param.paramLength = my_command->out_buffer_len; - res = cmdDispatch_GetParam (pCmdInterpret->hCmdDispatch,&Param); + pParam->paramLength = my_command->out_buffer_len; + res = cmdDispatch_GetParam (pCmdInterpret->hCmdDispatch,pParam); if(res == EXTERNAL_GET_PARAM_DENIED) { cmdObj->return_code = WEXT_INVALID_PARAMETER; - return res; + goto cmd_end; } - /* - this is for cmd that want to check the size of memory that they need to + /* + this is for cmd that want to check the size of memory that they need to allocate for the actual data. */ - if(Param.paramLength && (my_command->out_buffer_len == 0)) + if(pParam->paramLength && (my_command->out_buffer_len == 0)) { - my_command->out_buffer_len = Param.paramLength; + my_command->out_buffer_len = pParam->paramLength; } } else { - res = TI_NOK; + res = TI_NOK; } if (res == TI_OK) @@ -1346,20 +1349,20 @@ int cmdInterpret_convertAndExecute(TI_HANDLE hCmdInterpret, TConfigCommand *cmdO { if(IS_ALLOC_NEEDED_PARAM(my_command->cmd)) { - os_memoryCopy(pCmdInterpret->hOs,my_command->out_buffer,*(void**)&Param.content,my_command->out_buffer_len); + os_memoryCopy(pCmdInterpret->hOs,my_command->out_buffer,*(void **)&pParam->content,my_command->out_buffer_len); } else { - os_memoryCopy(pCmdInterpret->hOs,my_command->out_buffer,&Param.content,my_command->out_buffer_len); - } - } + os_memoryCopy(pCmdInterpret->hOs,my_command->out_buffer,&pParam->content,my_command->out_buffer_len); + } + } } } /* need to free the allocated memory */ if(IS_ALLOC_NEEDED_PARAM(my_command->cmd)) { - os_memoryFree(pCmdInterpret->hOs, *(void**)&Param.content, my_command->in_buffer_len); + os_memoryFree(pCmdInterpret->hOs, *(void **)&pParam->content, my_command->in_buffer_len); } } @@ -1370,13 +1373,12 @@ int cmdInterpret_convertAndExecute(TI_HANDLE hCmdInterpret, TConfigCommand *cmdO } - - if (res == TI_OK) { cmdObj->return_code = WEXT_OK; } - +cmd_end: + os_memoryFree(pCmdInterpret->hOs, pParam, sizeof(paramInfo_t)); /* Return with return code */ return res; @@ -1417,14 +1419,14 @@ static int cmdInterpret_initEvents(TI_HANDLE hCmdInterpret) for (i=0; i<IPC_EVENT_MAX; i++) { - evParams.uDeliveryType = DELIVERY_PUSH; - evParams.uProcessID = 0; - evParams.uEventID = 0; - evParams.hUserParam = hCmdInterpret; - evParams.pfEventCallback = cmdInterpret_Event; - evParams.uEventType = i; + evParams.uDeliveryType = DELIVERY_PUSH; + evParams.uProcessID = 0; + evParams.uEventID = 0; + evParams.hUserParam = hCmdInterpret; + evParams.pfEventCallback = cmdInterpret_Event; + evParams.uEventType = i; EvHandlerRegisterEvent (pCmdInterpret->hEvHandler, (TI_UINT8*) &evParams, sizeof(IPC_EVENT_PARAMS)); - pCmdInterpret->hEvents[i] = evParams.uEventID; + pCmdInterpret->hEvents[i] = evParams.uEventID; } return TI_OK; @@ -1458,10 +1460,9 @@ static TI_INT32 cmdInterpret_Event(IPC_EV_DATA* pData) OS_802_11_ASSOCIATION_INFORMATION *assocInformation; TI_UINT8 *requestIEs; TI_UINT8 *responseIEs; - paramInfo_t Param; union iwreq_data wrqu; char *memptr; - int TotalLength,res; + int TotalLength, res = TI_OK; #ifdef XCC_MODULE_INCLUDED cckm_assocInformation_t cckm_assoc; unsigned char beaconIE[MAX_BEACON_BODY_LENGTH]; @@ -1472,41 +1473,50 @@ static TI_INT32 cmdInterpret_Event(IPC_EV_DATA* pData) /* indicate to the OS */ os_IndicateEvent (pCmdInterpret->hOs, pData); + switch (pData->EvParams.uEventType) { case IPC_EVENT_ASSOCIATED: { + paramInfo_t *pParam; + + pParam = (paramInfo_t *)os_memoryAlloc(pCmdInterpret->hOs, sizeof(paramInfo_t)); + if (!pParam) + return TI_NOK; + /* Get Association information */ /* first check if this is ADHOC or INFRA (to avoid retrieving ASSOC INFO for ADHOC)*/ - Param.paramType = CTRL_DATA_CURRENT_BSS_TYPE_PARAM; - cmdDispatch_GetParam(pCmdInterpret->hCmdDispatch, &Param); - if (Param.content.ctrlDataCurrentBssType == BSS_INFRASTRUCTURE) + pParam->paramType = CTRL_DATA_CURRENT_BSS_TYPE_PARAM; + cmdDispatch_GetParam(pCmdInterpret->hCmdDispatch, pParam); + if (pParam->content.ctrlDataCurrentBssType == BSS_INFRASTRUCTURE) { /* First get length of data */ - Param.paramType = ASSOC_ASSOCIATION_INFORMATION_PARAM; - Param.paramLength = 0; - res = cmdDispatch_GetParam(pCmdInterpret->hCmdDispatch, &Param); + pParam->paramType = ASSOC_ASSOCIATION_INFORMATION_PARAM; + pParam->paramLength = 0; + res = cmdDispatch_GetParam(pCmdInterpret->hCmdDispatch, pParam); if (res != TI_NOK) { - TotalLength = sizeof(OS_802_11_ASSOCIATION_INFORMATION) + Param.content.assocAssociationInformation.RequestIELength + - Param.content.assocAssociationInformation.ResponseIELength; + TotalLength = sizeof(OS_802_11_ASSOCIATION_INFORMATION) + pParam->content.assocAssociationInformation.RequestIELength + + pParam->content.assocAssociationInformation.ResponseIELength; - memptr = os_memoryAlloc (pCmdInterpret->hOs, TotalLength); + memptr = os_memoryAlloc(pCmdInterpret->hOs, TotalLength); - if(!memptr) - return TI_NOK; + if (!memptr) { + res = TI_NOK; + goto event_end; + } /* Get actual data */ - Param.paramType = ASSOC_ASSOCIATION_INFORMATION_PARAM; - Param.paramLength = TotalLength; - cmdDispatch_GetParam(pCmdInterpret->hCmdDispatch, &Param); + pParam->paramType = ASSOC_ASSOCIATION_INFORMATION_PARAM; + pParam->paramLength = TotalLength; + cmdDispatch_GetParam(pCmdInterpret->hCmdDispatch, pParam); - os_memoryCopy(pCmdInterpret->hOs, memptr, &Param.content, TotalLength); + os_memoryCopy(pCmdInterpret->hOs, memptr, &pParam->content, TotalLength); assocInformation = (OS_802_11_ASSOCIATION_INFORMATION*)memptr; requestIEs = (TI_UINT8*)memptr + sizeof(OS_802_11_ASSOCIATION_INFORMATION); @@ -1527,7 +1537,7 @@ static TI_INT32 cmdInterpret_Event(IPC_EV_DATA* pData) wireless_send_event(NETDEV(pCmdInterpret->hOs), IWEVASSOCRESPIE, &wrqu, (char *)responseIEs); } - os_memoryFree (pCmdInterpret->hOs, memptr, TotalLength); + os_memoryFree(pCmdInterpret->hOs, memptr, TotalLength); } } @@ -1540,17 +1550,21 @@ static TI_INT32 cmdInterpret_Event(IPC_EV_DATA* pData) my_current = os_memoryAlloc (pCmdInterpret->hOs,MAX_BEACON_BODY_LENGTH); - Param.paramType = SITE_MGR_GET_SELECTED_BSSID_INFO_EX; - Param.content.pSiteMgrSelectedSiteInfo = my_current; - Param.paramLength = MAX_BEACON_BODY_LENGTH; - cmdDispatch_GetParam(pCmdInterpret->hCmdDispatch, &Param); + if (!my_current) { + res = TI_NOK; + goto event_end; + } + pParam->paramType = SITE_MGR_GET_SELECTED_BSSID_INFO_EX; + pParam->content.pSiteMgrSelectedSiteInfo = my_current; + pParam->paramLength = MAX_BEACON_BODY_LENGTH; + cmdDispatch_GetParam(pCmdInterpret->hCmdDispatch, pParam); - len = Param.content.pSiteMgrSelectedSiteInfo->IELength - BEACON_HEADER_FIX_SIZE; + len = pParam->content.pSiteMgrSelectedSiteInfo->IELength - BEACON_HEADER_FIX_SIZE; n = sprintf(beaconIE, "BEACONIE="); for (i = 0; i < len; i++) { - n += sprintf(beaconIE + n, "%02x", Param.content.pSiteMgrSelectedSiteInfo->IEs[BEACON_HEADER_FIX_SIZE+i] & 0xff); + n += sprintf(beaconIE + n, "%02x", pParam->content.pSiteMgrSelectedSiteInfo->IEs[BEACON_HEADER_FIX_SIZE+i] & 0xff); } os_memorySet (pCmdInterpret->hOs,&wrqu, 0, sizeof(wrqu)); @@ -1565,14 +1579,17 @@ static TI_INT32 cmdInterpret_Event(IPC_EV_DATA* pData) */ - Param.paramType = ASSOC_ASSOCIATION_RESP_PARAM; - Param.paramLength = sizeof(TAssocReqBuffer); - cmdDispatch_GetParam(pCmdInterpret->hCmdDispatch, &Param); + pParam->paramType = ASSOC_ASSOCIATION_RESP_PARAM; + pParam->paramLength = sizeof(TAssocReqBuffer); + cmdDispatch_GetParam(pCmdInterpret->hCmdDispatch, pParam); cckm_assoc.assocRespLen = Param.content.assocReqBuffer.bufferSize - ASSOC_RESP_FIXED_DATA_LEN ; cckm_assoc.assocRespBuffer = os_memoryAlloc (pCmdInterpret->hOs, cckm_assoc.assocRespLen); - - memcpy(cckm_assoc.assocRespBuffer,(Param.content.assocReqBuffer.buffer)+ASSOC_RESP_FIXED_DATA_LEN,cckm_assoc.assocRespLen); + if (!cckm_assoc.assocRespBuffer) { + res = TI_NOK; + goto event_end; + } + memcpy(cckm_assoc.assocRespBuffer,(pParam->content.assocReqBuffer.buffer)+ASSOC_RESP_FIXED_DATA_LEN,cckm_assoc.assocRespLen); wrqu.data.length = cckm_assoc.assocRespLen; wireless_send_event(NETDEV(pCmdInterpret->hOs), IWEVASSOCRESPIE, &wrqu, (TI_UINT8*)cckm_assoc.assocRespBuffer); os_memoryFree(pCmdInterpret->hOs,cckm_assoc.assocRespBuffer,cckm_assoc.assocRespLen); @@ -1581,13 +1598,13 @@ static TI_INT32 cmdInterpret_Event(IPC_EV_DATA* pData) /* Send associated event (containing BSSID of AP) */ os_memorySet (pCmdInterpret->hOs,&wrqu, 0, sizeof(wrqu)); - Param.paramType = SITE_MGR_CURRENT_BSSID_PARAM; - cmdDispatch_GetParam ( pCmdInterpret->hCmdDispatch, &Param ); - MAC_COPY (wrqu.ap_addr.sa_data, Param.content.siteMgrDesiredBSSID); + pParam->paramType = SITE_MGR_CURRENT_BSSID_PARAM; + cmdDispatch_GetParam ( pCmdInterpret->hCmdDispatch, pParam ); + MAC_COPY (wrqu.ap_addr.sa_data, pParam->content.siteMgrDesiredBSSID); wrqu.ap_addr.sa_family = ARPHRD_ETHER; wireless_send_event(NETDEV(pCmdInterpret->hOs), SIOCGIWAP, &wrqu, NULL); - - +event_end: + os_memoryFree(pCmdInterpret->hOs, pParam, sizeof(paramInfo_t)); } break; case IPC_EVENT_DISASSOCIATED: @@ -1604,27 +1621,27 @@ static TI_INT32 cmdInterpret_Event(IPC_EV_DATA* pData) case IPC_EVENT_SCAN_COMPLETE: { - TI_UINT8 *buf; - wrqu.data.length = 0; - wrqu.data.flags = 0; - buf = pData->uBuffer; - - if (*(TI_UINT32*)buf == SCAN_STATUS_COMPLETE) - wireless_send_event(NETDEV(pCmdInterpret->hOs), SIOCGIWSCAN, &wrqu, NULL); - else - { + TI_UINT8 *buf; + wrqu.data.length = 0; + wrqu.data.flags = 0; + buf = pData->uBuffer; + + if (*(TI_UINT32*)buf == SCAN_STATUS_COMPLETE) + wireless_send_event(NETDEV(pCmdInterpret->hOs), SIOCGIWSCAN, &wrqu, NULL); + else + { if (*(TI_UINT32*)buf == SCAN_STATUS_STOPPED) // scan is stopped successfully - pData->EvParams.uEventType = IPC_EVENT_SCAN_STOPPED; + pData->EvParams.uEventType = IPC_EVENT_SCAN_STOPPED; else if (*(TI_UINT32*)buf == SCAN_STATUS_FAILED) // scan is stopped successfully - pData->EvParams.uEventType = IPC_EVENT_SCAN_FAILED; - else - break; - - os_memorySet (pCmdInterpret->hOs,&wrqu, 0, sizeof(wrqu)); - wrqu.data.length = sizeof(IPC_EV_DATA); - wireless_send_event(NETDEV(pCmdInterpret->hOs), IWEVCUSTOM, &wrqu, (u8 *)pData); - } - } + pData->EvParams.uEventType = IPC_EVENT_SCAN_FAILED; + else + break; + + os_memorySet (pCmdInterpret->hOs,&wrqu, 0, sizeof(wrqu)); + wrqu.data.length = sizeof(IPC_EV_DATA); + wireless_send_event(NETDEV(pCmdInterpret->hOs), IWEVCUSTOM, &wrqu, (u8 *)pData); + } + } break; case IPC_EVENT_MEDIA_SPECIFIC: @@ -1712,11 +1729,11 @@ static TI_INT32 cmdInterpret_Event(IPC_EV_DATA* pData) wrqu.data.length = sizeof(IPC_EV_DATA); wireless_send_event(NETDEV(pCmdInterpret->hOs), IWEVCUSTOM, &wrqu, (TI_UINT8 *)pData); } - + break; } - return TI_OK; + return res; } @@ -1724,9 +1741,9 @@ static TI_INT32 cmdInterpret_Event(IPC_EV_DATA* pData) static int cmdInterpret_setSecurityParams (TI_HANDLE hCmdInterpret) { cmdInterpret_t *pCmdInterpret = (cmdInterpret_t *)hCmdInterpret; - paramInfo_t Param; + paramInfo_t *pParam; int auth_mode, encr_mode; - + /* printk ("wpa_version=0x%x auth_alg=0x%x key_mgmt=0x%x " "cipher_pairwise=0x%x cipher_group=0x%x\n", @@ -1734,6 +1751,9 @@ static int cmdInterpret_setSecurityParams (TI_HANDLE hCmdInterpret) pCmdInterpret->wai.iw_auth_key_mgmt, pCmdInterpret->wai.iw_auth_cipher_pairwise, pCmdInterpret->wai.iw_auth_cipher_group); */ + pParam = (paramInfo_t *)os_memoryAlloc(pCmdInterpret->hOs, sizeof(paramInfo_t)); + if (!pParam) + return TI_NOK; if (pCmdInterpret->wai.iw_auth_wpa_version & IW_AUTH_WPA_VERSION_WPA2) { if (pCmdInterpret->wai.iw_auth_key_mgmt & IW_AUTH_KEY_MGMT_802_1X) @@ -1789,14 +1809,14 @@ static int cmdInterpret_setSecurityParams (TI_HANDLE hCmdInterpret) break; } - Param.paramType = RSN_EXT_AUTHENTICATION_MODE; - Param.content.rsnExtAuthneticationMode = auth_mode; - cmdDispatch_SetParam ( pCmdInterpret->hCmdDispatch, &Param ); - - Param.paramType = RSN_ENCRYPTION_STATUS_PARAM; - Param.content.rsnEncryptionStatus = encr_mode; - cmdDispatch_SetParam ( pCmdInterpret->hCmdDispatch, &Param ); + pParam->paramType = RSN_EXT_AUTHENTICATION_MODE; + pParam->content.rsnExtAuthneticationMode = auth_mode; + cmdDispatch_SetParam ( pCmdInterpret->hCmdDispatch, pParam ); + pParam->paramType = RSN_ENCRYPTION_STATUS_PARAM; + pParam->content.rsnEncryptionStatus = encr_mode; + cmdDispatch_SetParam ( pCmdInterpret->hCmdDispatch, pParam ); + os_memoryFree(pCmdInterpret->hOs, pParam, sizeof(paramInfo_t)); return TI_OK; } @@ -1804,42 +1824,42 @@ static int cmdInterpret_setSecurityParams (TI_HANDLE hCmdInterpret) void *cmdInterpret_GetStat (TI_HANDLE hCmdInterpret) { cmdInterpret_t *pCmdInterpret = (cmdInterpret_t *)hCmdInterpret; - paramInfo_t Param; - TI_STATUS res = TI_NOK; /* Check if driver is initialized - If not - return empty statistics */ if (hCmdInterpret) { - Param.paramType = SITE_MGR_GET_STATS; - res = cmdDispatch_GetParam ( pCmdInterpret->hCmdDispatch, &Param ); + paramInfo_t *pParam; + TI_STATUS res; - CHECK_PENDING_RESULT_RET(res, Param); + pParam = (paramInfo_t *)os_memoryAlloc(pCmdInterpret->hOs, sizeof(paramInfo_t)); + if (!pParam) + return NULL; - if (res == TI_OK) - { - pCmdInterpret->wstats.qual.level = (TI_UINT8)Param.content.siteMgrCurrentRssi; - pCmdInterpret->wstats.qual.updated = IW_QUAL_LEVEL_UPDATED | IW_QUAL_QUAL_UPDATED | IW_QUAL_NOISE_INVALID | IW_QUAL_DBM; + pParam->paramType = SITE_MGR_GET_STATS; + res = cmdDispatch_GetParam ( pCmdInterpret->hCmdDispatch, pParam ); - } - else - { - pCmdInterpret->wstats.qual.level = 0; - pCmdInterpret->wstats.qual.updated = IW_QUAL_ALL_INVALID; - } + if (res == TI_OK) + { + pCmdInterpret->wstats.qual.level = (TI_UINT8)pParam->content.siteMgrCurrentRssi; + pCmdInterpret->wstats.qual.updated = IW_QUAL_LEVEL_UPDATED | IW_QUAL_QUAL_UPDATED | IW_QUAL_NOISE_INVALID | IW_QUAL_DBM; + } + else + { + pCmdInterpret->wstats.qual.level = 0; + pCmdInterpret->wstats.qual.updated = IW_QUAL_ALL_INVALID; + } pCmdInterpret->wstats.qual.noise = 0; - pCmdInterpret->wstats.qual.qual = 0; - pCmdInterpret->wstats.status = 0; - pCmdInterpret->wstats.miss.beacon = 0; - pCmdInterpret->wstats.discard.retries = 0; /* Tx : Max MAC retries num reached */ - pCmdInterpret->wstats.discard.nwid = 0; /* Rx : Wrong nwid/essid */ - pCmdInterpret->wstats.discard.code = 0; /* Rx : Unable to code/decode (WEP) */ - pCmdInterpret->wstats.discard.fragment = 0; /* Rx : Can't perform MAC reassembly */ - pCmdInterpret->wstats.discard.misc = 0; /* Others cases */ - + pCmdInterpret->wstats.qual.qual = 0; + pCmdInterpret->wstats.status = 0; + pCmdInterpret->wstats.miss.beacon = 0; + pCmdInterpret->wstats.discard.retries = 0; /* Tx : Max MAC retries num reached */ + pCmdInterpret->wstats.discard.nwid = 0; /* Rx : Wrong nwid/essid */ + pCmdInterpret->wstats.discard.code = 0; /* Rx : Unable to code/decode (WEP) */ + pCmdInterpret->wstats.discard.fragment = 0; /* Rx : Can't perform MAC reassembly */ + pCmdInterpret->wstats.discard.misc = 0; /* Others cases */ + os_memoryFree(pCmdInterpret->hOs, pParam, sizeof(paramInfo_t)); return &pCmdInterpret->wstats; } return (void *)NULL; } - - diff --git a/wl1271/platforms/os/linux/src/RxBuf.c b/wl1271/platforms/os/linux/src/RxBuf.c index 58481ac1..61972928 100644 --- a/wl1271/platforms/os/linux/src/RxBuf.c +++ b/wl1271/platforms/os/linux/src/RxBuf.c @@ -46,20 +46,18 @@ * Allocate BUF Rx packets. * Add 16 bytes before the data buffer for WSPI overhead! */ -void* RxBufAlloc(TI_HANDLE hOs, TI_UINT32 len,PacketClassTag_e ePacketClassTag) +void *RxBufAlloc(TI_HANDLE hOs, TI_UINT32 len,PacketClassTag_e ePacketClassTag) { - rx_head_t *rx_head; - TI_UINT32 alloc_len = len + WSPI_PAD_BYTES + PAYLOAD_ALIGN_PAD_BYTES + RX_HEAD_LEN_ALIGNED; - struct sk_buff *skb = alloc_skb (alloc_len, GFP_ATOMIC); - - if(skb == NULL){ - printk("RxBufAlloc(): alloc_skb failed\n"); - return NULL; - } - rx_head = (rx_head_t *)skb->head; + TI_UINT32 alloc_len = len + WSPI_PAD_BYTES + PAYLOAD_ALIGN_PAD_BYTES + RX_HEAD_LEN_ALIGNED; + struct sk_buff *skb; + rx_head_t *rx_head; + skb = alloc_skb(alloc_len, GFP_ATOMIC); + if (!skb) + return NULL; + rx_head = (rx_head_t *)skb->head; rx_head->skb = skb; - skb_reserve(skb, RX_HEAD_LEN_ALIGNED+WSPI_PAD_BYTES); + skb_reserve(skb, RX_HEAD_LEN_ALIGNED + WSPI_PAD_BYTES); /* printk("-->> RxBufAlloc(len=%d) skb=0x%x skb->data=0x%x skb->head=0x%x skb->len=%d\n", (int)len, (int)skb, (int)skb->data, (int)skb->head, (int)skb->len); @@ -70,28 +68,27 @@ void* RxBufAlloc(TI_HANDLE hOs, TI_UINT32 len,PacketClassTag_e ePacketClassTag) /*--------------------------------------------------------------------------------------*/ -inline void RxBufFree(TI_HANDLE hOs, void* pBuf) +inline void RxBufFree(TI_HANDLE hOs, void *pBuf) { - unsigned char *pdata = (unsigned char *)((TI_UINT32)pBuf & ~(TI_UINT32)0x3); + unsigned char *pdata = (unsigned char *)((TI_UINT32)pBuf & ~(TI_UINT32)0x3); rx_head_t *rx_head = (rx_head_t *)(pdata - WSPI_PAD_BYTES - RX_HEAD_LEN_ALIGNED); struct sk_buff *skb = rx_head->skb; - #ifdef TI_DBG - if ((TI_UINT32)pBuf & 0x3) - { - if ((TI_UINT32)pBuf - (TI_UINT32)skb->data != 2) - { - printk("RxBufFree() address error skb=0x%x skb->data=0x%x pPacket=0x%x !!!\n",(int)skb, (int)skb->data, (int)pBuf); - } - } - else - { - if ((TI_UINT32)skb->data != (TI_UINT32)pBuf) - { - printk("RxBufFree() address error skb=0x%x skb->data=0x%x pPacket=0x%x !!!\n",(int)skb, (int)skb->data, (int)pBuf); - } - } + if ((TI_UINT32)pBuf & 0x3) + { + if ((TI_UINT32)pBuf - (TI_UINT32)skb->data != 2) + { + printk("RxBufFree() address error skb=0x%x skb->data=0x%x pPacket=0x%x !!!\n",(int)skb, (int)skb->data, (int)pBuf); + } + } + else + { + if ((TI_UINT32)skb->data != (TI_UINT32)pBuf) + { + printk("RxBufFree() address error skb=0x%x skb->data=0x%x pPacket=0x%x !!!\n",(int)skb, (int)skb->data, (int)pBuf); + } + } #endif /* printk("-->> RxBufFree() skb=0x%x skb->data=0x%x skb->head=0x%x skb->len=%d\n", @@ -99,7 +96,3 @@ inline void RxBufFree(TI_HANDLE hOs, void* pBuf) */ dev_kfree_skb(skb); } - - - - diff --git a/wl1271/platforms/os/linux/src/WlanDrvIf.c b/wl1271/platforms/os/linux/src/WlanDrvIf.c index c0803a4f..ab322c7b 100644 --- a/wl1271/platforms/os/linux/src/WlanDrvIf.c +++ b/wl1271/platforms/os/linux/src/WlanDrvIf.c @@ -55,8 +55,6 @@ #include <linux/etherdevice.h> #include <linux/delay.h> #include <linux/netlink.h> -#include <linux/version.h> - #include "WlanDrvIf.h" #include "osApi.h" @@ -73,12 +71,15 @@ #include "tracebuf_api.h" #endif /* PM hooks */ -#ifdef CONFIG_PM +#ifdef TI_CONFIG_PM_HOOKS #include "SdioDrv.h" static int wlanDrvIf_pm_resume(void); static int wlanDrvIf_pm_suspend(void); #endif #include "bmtrace_api.h" +#ifdef STACK_PROFILE +#include "stack_profile.h" +#endif /* save driver handle just for module cleanup */ static TWlanDrvIfObj *pDrvStaticHandle; @@ -89,9 +90,30 @@ static TWlanDrvIfObj *pDrvStaticHandle; MODULE_DESCRIPTION("TI WLAN Embedded Station Driver"); MODULE_LICENSE("GPL"); -/* linux/irq.h declarations */ -extern void disable_irq(unsigned int); +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 31)) +static int wlanDrvIf_Xmit(struct sk_buff *skb, struct net_device *dev); +static int wlanDrvIf_XmitDummy(struct sk_buff *skb, struct net_device *dev); +static struct net_device_stats *wlanDrvIf_NetGetStat(struct net_device *dev); +int wlanDrvIf_Open(struct net_device *dev); +int wlanDrvIf_Release(struct net_device *dev); + +static struct net_device_ops tiwlan_ops_pri = { + .ndo_open = wlanDrvIf_Open, + .ndo_stop = wlanDrvIf_Release, + .ndo_get_stats = wlanDrvIf_NetGetStat, + .ndo_do_ioctl = NULL, + .ndo_start_xmit = wlanDrvIf_Xmit, +}; + +static struct net_device_ops tiwlan_ops_dummy = { + .ndo_open = wlanDrvIf_Open, + .ndo_stop = wlanDrvIf_Release, + .ndo_get_stats = wlanDrvIf_NetGetStat, + .ndo_do_ioctl = NULL, + .ndo_start_xmit = wlanDrvIf_XmitDummy, +}; +#endif /** * \fn wlanDrvIf_Xmit @@ -110,43 +132,43 @@ extern void disable_irq(unsigned int); */ static int wlanDrvIf_Xmit (struct sk_buff *skb, struct net_device *dev) { - TWlanDrvIfObj *drv = (TWlanDrvIfObj *)NETDEV_GET_PRIVATE(dev); - TTxCtrlBlk * pPktCtrlBlk; - int status; + TWlanDrvIfObj *drv = (TWlanDrvIfObj *)NETDEV_GET_PRIVATE(dev); + TTxCtrlBlk * pPktCtrlBlk; + int status; - CL_TRACE_START_L1(); + CL_TRACE_START_L1(); - os_profile (drv, 0, 0); - drv->stats.tx_packets++; - drv->stats.tx_bytes += skb->len; + os_profile (drv, 0, 0); + drv->stats.tx_packets++; + drv->stats.tx_bytes += skb->len; - /* Allocate a TxCtrlBlk for the Tx packet and save timestamp, length and packet handle */ - pPktCtrlBlk = TWD_txCtrlBlk_Alloc (drv->tCommon.hTWD); + /* Allocate a TxCtrlBlk for the Tx packet and save timestamp, length and packet handle */ + pPktCtrlBlk = TWD_txCtrlBlk_Alloc (drv->tCommon.hTWD); - pPktCtrlBlk->tTxDescriptor.startTime = os_timeStampMs(drv); /* remove use of skb->tstamp.off_usec */ - pPktCtrlBlk->tTxDescriptor.length = skb->len; - pPktCtrlBlk->tTxPktParams.pInputPkt = skb; + pPktCtrlBlk->tTxDescriptor.startTime = os_timeStampMs(drv); /* remove use of skb->tstamp.off_usec */ + pPktCtrlBlk->tTxDescriptor.length = skb->len; + pPktCtrlBlk->tTxPktParams.pInputPkt = skb; - /* Point the first BDL buffer to the Ethernet header, and the second buffer to the rest of the packet */ - pPktCtrlBlk->tTxnStruct.aBuf[0] = skb->data; - pPktCtrlBlk->tTxnStruct.aLen[0] = ETHERNET_HDR_LEN; - pPktCtrlBlk->tTxnStruct.aBuf[1] = skb->data + ETHERNET_HDR_LEN; - pPktCtrlBlk->tTxnStruct.aLen[1] = (TI_UINT16)skb->len - ETHERNET_HDR_LEN; - pPktCtrlBlk->tTxnStruct.aLen[2] = 0; + /* Point the first BDL buffer to the Ethernet header, and the second buffer to the rest of the packet */ + pPktCtrlBlk->tTxnStruct.aBuf[0] = skb->data; + pPktCtrlBlk->tTxnStruct.aLen[0] = ETHERNET_HDR_LEN; + pPktCtrlBlk->tTxnStruct.aBuf[1] = skb->data + ETHERNET_HDR_LEN; + pPktCtrlBlk->tTxnStruct.aLen[1] = (TI_UINT16)skb->len - ETHERNET_HDR_LEN; + pPktCtrlBlk->tTxnStruct.aLen[2] = 0; - /* Send the packet to the driver for transmission. */ - status = txDataQ_InsertPacket (drv->tCommon.hTxDataQ, pPktCtrlBlk,(TI_UINT8)skb->priority); + /* Send the packet to the driver for transmission. */ + status = txDataQ_InsertPacket (drv->tCommon.hTxDataQ, pPktCtrlBlk,(TI_UINT8)skb->priority); - /* If failed (queue full or driver not running), drop the packet. */ + /* If failed (queue full or driver not running), drop the packet. */ if (status != TI_OK) { drv->stats.tx_errors++; } - os_profile (drv, 1, 0); + os_profile (drv, 1, 0); - CL_TRACE_END_L1("tiwlan_drv.ko", "OS", "TX", ""); + CL_TRACE_END_L1("tiwlan_drv.ko", "OS", "TX", ""); - return 0; + return 0; } /*--------------------------------------------------------------------------------------*/ /** @@ -186,8 +208,8 @@ void wlanDrvIf_FreeTxPacket (TI_HANDLE hOs, TTxCtrlBlk *pPktCtrlBlk, TI_STATUS e */ static int wlanDrvIf_XmitDummy (struct sk_buff *skb, struct net_device *dev) { - /* Just return error. The driver is not running (network stack frees the packet) */ - return -ENODEV; + /* Just return error. The driver is not running (network stack frees the packet) */ + return -ENODEV; } @@ -204,10 +226,10 @@ static int wlanDrvIf_XmitDummy (struct sk_buff *skb, struct net_device *dev) */ static struct net_device_stats *wlanDrvIf_NetGetStat (struct net_device *dev) { - TWlanDrvIfObj *drv = (TWlanDrvIfObj *)NETDEV_GET_PRIVATE(dev); - ti_dprintf (TIWLAN_LOG_OTHER, "wlanDrvIf_NetGetStat()\n"); - - return &drv->stats; + TWlanDrvIfObj *drv = (TWlanDrvIfObj *)NETDEV_GET_PRIVATE(dev); + ti_dprintf (TIWLAN_LOG_OTHER, "wlanDrvIf_NetGetStat()\n"); + + return &drv->stats; } @@ -226,18 +248,21 @@ static struct net_device_stats *wlanDrvIf_NetGetStat (struct net_device *dev) */ void wlanDrvIf_UpdateDriverState (TI_HANDLE hOs, EDriverSteadyState eDriverState) { - TWlanDrvIfObj *drv = (TWlanDrvIfObj *)hOs; + TWlanDrvIfObj *drv = (TWlanDrvIfObj *)hOs; - ti_dprintf(TIWLAN_LOG_OTHER, "wlanDrvIf_UpdateDriverState(): State = %d\n", eDriverState); + ti_dprintf(TIWLAN_LOG_OTHER, "wlanDrvIf_UpdateDriverState(): State = %d\n", eDriverState); - /* Save the new state */ - drv->tCommon.eDriverState = eDriverState; + /* Save the new state */ + drv->tCommon.eDriverState = eDriverState; - /* If the new state is not RUNNING, replace the Tx handler to a dummy one. */ - if (eDriverState != DRV_STATE_RUNNING) - { - drv->netdev->hard_start_xmit = wlanDrvIf_XmitDummy; - } + /* If the new state is not RUNNING, replace the Tx handler to a dummy one. */ + if (eDriverState != DRV_STATE_RUNNING) { +#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 31)) + drv->netdev->hard_start_xmit = wlanDrvIf_XmitDummy; +#else + drv->netdev->netdev_ops = &tiwlan_ops_dummy; +#endif + } } @@ -257,11 +282,11 @@ void wlanDrvIf_UpdateDriverState (TI_HANDLE hOs, EDriverSteadyState eDriverState */ irqreturn_t wlanDrvIf_HandleInterrupt (int irq, void *hDrv, struct pt_regs *cpu_regs) { - TWlanDrvIfObj *drv = (TWlanDrvIfObj *)hDrv; + TWlanDrvIfObj *drv = (TWlanDrvIfObj *)hDrv; - TWD_InterruptRequest (drv->tCommon.hTWD); + TWD_InterruptRequest (drv->tCommon.hTWD); - return IRQ_HANDLED; + return IRQ_HANDLED; } @@ -280,10 +305,10 @@ irqreturn_t wlanDrvIf_HandleInterrupt (int irq, void *hDrv, struct pt_regs *cpu_ #ifdef PRIODIC_INTERRUPT static void wlanDrvIf_PollIrqHandler (TI_HANDLE parm) { - TWlanDrvIfObj *drv = (TWlanDrvIfObj *)parm; + TWlanDrvIfObj *drv = (TWlanDrvIfObj *)parm; - wlanDrvIf_HandleInterrupt (0, drv, NULL); - os_periodicIntrTimerStart (drv); + wlanDrvIf_HandleInterrupt (0, drv, NULL); + os_periodicIntrTimerStart (drv); } #endif @@ -301,54 +326,51 @@ static void wlanDrvIf_PollIrqHandler (TI_HANDLE parm) * \param hDrv - The driver object handle * \return void * \sa - */ + */ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23) static void wlanDrvIf_DriverTask (void *hDrv) { - TWlanDrvIfObj *drv = (TWlanDrvIfObj *)hDrv; + TWlanDrvIfObj *drv = (TWlanDrvIfObj *)hDrv; #else static void wlanDrvIf_DriverTask(struct work_struct *work) { - TWlanDrvIfObj *drv = container_of(work, TWlanDrvIfObj, tWork); +#ifdef STACK_PROFILE + register unsigned long sp asm ("sp"); + unsigned long local_sp = sp; +#endif + TWlanDrvIfObj *drv = container_of(work, TWlanDrvIfObj, tWork); #endif #ifdef STACK_PROFILE - unsigned int curr1,base1; - unsigned int curr2,base2; - static unsigned int maximum_stack = 0; + unsigned long curr1, base1; + unsigned long curr2, base2; + static unsigned long maximum_stack = 0; #endif - - - os_profile (drv, 0, 0); + os_profile (drv, 0, 0); #ifdef STACK_PROFILE - curr1 = check_stack_start(&base1); + curr1 = check_stack_start(&base1, local_sp + 4, 0); #endif + /* Call the driver main task */ + context_DriverTask (drv->tCommon.hContext); - /* Call the driver main task */ - context_DriverTask (drv->tCommon.hContext); - - os_wake_lock_timeout(drv); - os_wake_unlock(drv); - + os_profile (drv, 1, 0); + os_wake_lock_timeout(drv); + os_wake_unlock(drv); #ifdef STACK_PROFILE - curr2 = check_stack_stop(&base2); - if (base2 == base1) - { - /* if the current measurement is bigger then the maximum store it and print*/ - if ((curr1 - curr2) > maximum_stack) - { - printk("STACK PROFILER GOT THE LOCAL MAXIMMUM!!!! \n"); - printk("current operation stack use =%d \n",(curr1 - curr2)); - printk("total stack use=%d \n",8192 - curr2 + base2); - printk("total stack usage= %d percent \n",100 * (8192 - curr2 + base2) / 8192); + curr2 = check_stack_stop(&base2, 0); + if (base2 == base1) { + /* if the current measurement is bigger then the maximum store it and print*/ + if ((curr1 - curr2) > maximum_stack) { + printk("STACK PROFILER GOT THE LOCAL MAXIMMUM!!!! \n"); + printk("current operation stack use=%lu \n",(curr1 - curr2)); + printk("total stack use=%lu \n",8192 - curr2 + base2); + printk("total stack usage=%lu percent \n",100 * (8192 - curr2 + base2) / 8192); maximum_stack = curr1 - curr2; - } - } + } + } #endif - - os_profile (drv, 1, 0); } @@ -404,7 +426,7 @@ int wlanDrvIf_LoadFiles (TWlanDrvIfObj *drv, TLoaderFilesData *pInitFiles) drv->tCommon.tNvsImage.uSize = pInitFiles->uNvsFileLength; drv->tCommon.tNvsImage.pImage = kmalloc (drv->tCommon.tNvsImage.uSize, GFP_KERNEL); #ifdef TI_MEM_ALLOC_TRACE - os_printf ("MTT:%s:%d ::kmalloc(%lu, %x) : %lu\n", + os_printf ("MTT:%s:%d ::kmalloc(%lu, %x) : %lu\n", __FUNCTION__, __LINE__, drv->tCommon.tNvsImage.uSize, GFP_KERNEL, drv->tCommon.tNvsImage.uSize); #endif if (!drv->tCommon.tNvsImage.pImage) @@ -423,7 +445,7 @@ int wlanDrvIf_LoadFiles (TWlanDrvIfObj *drv, TLoaderFilesData *pInitFiles) } drv->tCommon.tFwImage.pImage = os_memoryAlloc (drv, drv->tCommon.tFwImage.uSize); #ifdef TI_MEM_ALLOC_TRACE - os_printf ("MTT:%s:%d ::kmalloc(%lu, %x) : %lu\n", + os_printf ("MTT:%s:%d ::kmalloc(%lu, %x) : %lu\n", __FUNCTION__, __LINE__, drv->tCommon.tFwImage.uSize, GFP_KERNEL, drv->tCommon.tFwImage.uSize); #endif if (!drv->tCommon.tFwImage.pImage) @@ -581,10 +603,10 @@ int wlanDrvIf_GetFile (TI_HANDLE hOs, TFileInfo *pFileInfo) */ void wlanDrvIf_SetMacAddress (TI_HANDLE hOs, TI_UINT8 *pMacAddr) { - TWlanDrvIfObj *drv = (TWlanDrvIfObj *)hOs; + TWlanDrvIfObj *drv = (TWlanDrvIfObj *)hOs; - /* Copy STA MAC address to the network interface structure */ - MAC_COPY (drv->netdev->dev_addr, pMacAddr); + /* Copy STA MAC address to the network interface structure */ + MAC_COPY (drv->netdev->dev_addr, pMacAddr); } @@ -603,57 +625,58 @@ void wlanDrvIf_SetMacAddress (TI_HANDLE hOs, TI_UINT8 *pMacAddr) */ int wlanDrvIf_Start (struct net_device *dev) { - TWlanDrvIfObj *drv = (TWlanDrvIfObj *)NETDEV_GET_PRIVATE(dev); - - ti_dprintf (TIWLAN_LOG_OTHER, "wlanDrvIf_Start()\n"); - - if (!drv->tCommon.hDrvMain) - { - ti_dprintf (TIWLAN_LOG_ERROR, "wlanDrvIf_Start() Driver not created!\n"); - return -ENODEV; - } + TWlanDrvIfObj *drv = (TWlanDrvIfObj *)NETDEV_GET_PRIVATE(dev); + ti_dprintf (TIWLAN_LOG_OTHER, "wlanDrvIf_Start()\n"); + printk("%s\n", __func__); + if (!drv->tCommon.hDrvMain) { + ti_dprintf (TIWLAN_LOG_ERROR, "wlanDrvIf_Start() Driver not created!\n"); + return -ENODEV; + } - /* - * Insert Start command in DrvMain action queue, request driver scheduling - * and wait for action completion (all init process). - */ - os_wake_lock_timeout_enable(drv); - drvMain_InsertAction (drv->tCommon.hDrvMain, ACTION_TYPE_START); - - return 0; + /* + * Insert Start command in DrvMain action queue, request driver scheduling + * and wait for action completion (all init process). + */ + os_wake_lock_timeout_enable(drv); + drvMain_InsertAction (drv->tCommon.hDrvMain, ACTION_TYPE_START); + return 0; } int wlanDrvIf_Open (struct net_device *dev) { - TWlanDrvIfObj *drv = (TWlanDrvIfObj *)NETDEV_GET_PRIVATE(dev); - - ti_dprintf (TIWLAN_LOG_OTHER, "wlanDrvIf_Open()\n"); + TWlanDrvIfObj *drv = (TWlanDrvIfObj *)NETDEV_GET_PRIVATE(dev); - if (!drv->tCommon.hDrvMain) - { - ti_dprintf (TIWLAN_LOG_ERROR, "wlanDrvIf_Open() Driver not created!\n"); - return -ENODEV; - } + ti_dprintf (TIWLAN_LOG_OTHER, "wlanDrvIf_Open()\n"); + printk("%s\n", __func__); + if (!drv->tCommon.hDrvMain) { + ti_dprintf (TIWLAN_LOG_ERROR, "wlanDrvIf_Open() Driver not created!\n"); + return -ENODEV; + } if (drv->tCommon.eDriverState == DRV_STATE_STOPPED || drv->tCommon.eDriverState == DRV_STATE_IDLE) { wlanDrvIf_Start(dev); } - /* - * Finalize network interface setup - */ - drv->netdev->hard_start_xmit = wlanDrvIf_Xmit; - drv->netdev->addr_len = MAC_ADDR_LEN; - netif_start_queue (dev); - - /* register 3430 PM hooks in our SDIO driver */ -#ifdef CONFIG_PM - sdioDrv_register_pm(wlanDrvIf_pm_resume, wlanDrvIf_pm_suspend); + /* + * Finalize network interface setup + */ +#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 31)) + drv->netdev->hard_start_xmit = wlanDrvIf_Xmit; +#else + drv->netdev->netdev_ops = &tiwlan_ops_pri; #endif + drv->netdev->addr_len = MAC_ADDR_LEN; + netif_start_queue (dev); - return 0; + /* register 3430 PM hooks in our SDIO driver */ +#ifdef TI_CONFIG_PM_HOOKS +#ifndef CONFIG_MMC_EMBEDDED_SDIO + sdioDrv_register_pm(wlanDrvIf_pm_resume, wlanDrvIf_pm_suspend); +#endif +#endif + return 0; } /** @@ -671,31 +694,32 @@ int wlanDrvIf_Open (struct net_device *dev) */ int wlanDrvIf_Stop (struct net_device *dev) { - TWlanDrvIfObj *drv = (TWlanDrvIfObj *)NETDEV_GET_PRIVATE(dev); - - ti_dprintf (TIWLAN_LOG_OTHER, "wlanDrvIf_Stop()\n"); - - /* - * Insert Stop command in DrvMain action queue, request driver scheduling - * and wait for Stop process completion. - */ - os_wake_lock_timeout_enable(drv); - drvMain_InsertAction (drv->tCommon.hDrvMain, ACTION_TYPE_STOP); - - return 0; + TWlanDrvIfObj *drv = (TWlanDrvIfObj *)NETDEV_GET_PRIVATE(dev); + + ti_dprintf (TIWLAN_LOG_OTHER, "wlanDrvIf_Stop()\n"); + printk("%s\n", __func__); + /* + * Insert Stop command in DrvMain action queue, request driver scheduling + * and wait for Stop process completion. + */ + os_wake_lock_timeout_enable(drv); + drvMain_InsertAction (drv->tCommon.hDrvMain, ACTION_TYPE_STOP); + return 0; } int wlanDrvIf_Release (struct net_device *dev) { - ti_dprintf (TIWLAN_LOG_OTHER, "wlanDrvIf_Release()\n"); + /* TWlanDrvIfObj *drv = (TWlanDrvIfObj *)NETDEV_GET_PRIVATE(dev); */ - /* Disable network interface queue */ - netif_stop_queue (dev); - return 0; + ti_dprintf (TIWLAN_LOG_OTHER, "wlanDrvIf_Release()\n"); + printk("%s\n", __func__); + /* Disable network interface queue */ + netif_stop_queue (dev); + return 0; } /* 3430 PM hooks */ -#ifdef CONFIG_PM +#ifdef TI_CONFIG_PM_HOOKS static int wlanDrvIf_pm_resume(void) { return(wlanDrvIf_Open(pDrvStaticHandle->netdev)); @@ -722,57 +746,56 @@ static int wlanDrvIf_pm_suspend(void) */ static int wlanDrvIf_SetupNetif (TWlanDrvIfObj *drv) { - struct net_device *dev; - int res; - - /* Allocate network interface structure for the driver */ - dev = alloc_etherdev (0); - if (dev == NULL) - { - ti_dprintf (TIWLAN_LOG_ERROR, "alloc_etherdev() failed\n"); - return -ENOMEM; - } + struct net_device *dev; + int res; + + /* Allocate network interface structure for the driver */ + dev = alloc_etherdev (0); + if (dev == NULL) { + ti_dprintf (TIWLAN_LOG_ERROR, "alloc_etherdev() failed\n"); + return -ENOMEM; + } - /* Setup the network interface */ - ether_setup (dev); + /* Setup the network interface */ + ether_setup (dev); + NETDEV_SET_PRIVATE(dev,drv); + drv->netdev = dev; + strcpy (dev->name, TIWLAN_DRV_IF_NAME); + netif_carrier_off (dev); +#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 31)) /* the following is required on at least BSP 23.8 and higher. Without it, the Open function of the driver will not be called when trying to 'ifconfig up' the interface */ #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,23) - dev->validate_addr = NULL; + dev->validate_addr = NULL; +#endif + dev->open = wlanDrvIf_Open; + dev->stop = wlanDrvIf_Release; + dev->hard_start_xmit = wlanDrvIf_XmitDummy; + dev->get_stats = wlanDrvIf_NetGetStat; + dev->do_ioctl = NULL; +#else + dev->netdev_ops = &tiwlan_ops_dummy; #endif + dev->tx_queue_len = 100; - NETDEV_SET_PRIVATE(dev,drv); - drv->netdev = dev; - strcpy (dev->name, TIWLAN_DRV_IF_NAME); - netif_carrier_off (dev); - dev->open = wlanDrvIf_Open; - dev->stop = wlanDrvIf_Release; - dev->hard_start_xmit = wlanDrvIf_XmitDummy; - dev->get_stats = wlanDrvIf_NetGetStat; - dev->tx_queue_len = 100; - dev->do_ioctl = NULL; - - /* Initialize Wireless Extensions interface (WEXT) */ - wlanDrvWext_Init (dev); - - res = register_netdev (dev); - if (res != 0) - { - ti_dprintf (TIWLAN_LOG_ERROR, "register_netdev() failed : %d\n", res); - kfree (dev); - return res; - } + /* Initialize Wireless Extensions interface (WEXT) */ + wlanDrvWext_Init (dev); + res = register_netdev (dev); + if (res != 0) { + ti_dprintf (TIWLAN_LOG_ERROR, "register_netdev() failed : %d\n", res); + kfree (dev); + return res; + } /* On the latest Kernel there is no more support for the below macro. */ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) - SET_MODULE_OWNER (dev); + SET_MODULE_OWNER (dev); #endif - - return 0; + return 0; } /** @@ -790,8 +813,8 @@ On the latest Kernel there is no more support for the below macro. */ void wlanDrvIf_CommandDone (TI_HANDLE hOs, void *pSignalObject, TI_UINT8 *CmdResp_p) { - /* Free semaphore */ - os_SignalObjectSet (hOs, pSignalObject); + /* Free semaphore */ + os_SignalObjectSet (hOs, pSignalObject); } @@ -811,98 +834,124 @@ void wlanDrvIf_CommandDone (TI_HANDLE hOs, void *pSignalObject, TI_UINT8 *CmdRes */ static int wlanDrvIf_Create (void) { - TWlanDrvIfObj *drv; - int rc; + TWlanDrvIfObj *drv; /* Dm: Failure is not cleaned properly !!! */ + int rc; - /* Allocate driver's structure */ - drv = kmalloc (sizeof(TWlanDrvIfObj), GFP_KERNEL); - if (!drv) - { - return -ENOMEM; - } + /* Allocate driver's structure */ + drv = kmalloc (sizeof(TWlanDrvIfObj), GFP_KERNEL); + if (!drv) { + return -ENOMEM; + } #ifdef TI_DBG tb_init(TB_OPTION_NONE); #endif - pDrvStaticHandle = drv; /* save for module destroy */ - #ifdef TI_MEM_ALLOC_TRACE - os_printf ("MTT:%s:%d ::kmalloc(%lu, %x) : %lu\n", __FUNCTION__, __LINE__, sizeof(TWlanDrvIfObj), GFP_KERNEL, sizeof(TWlanDrvIfObj)); - #endif - memset (drv, 0, sizeof(TWlanDrvIfObj)); - - drv->irq = TNETW_IRQ; - drv->tCommon.eDriverState = DRV_STATE_IDLE; + pDrvStaticHandle = drv; /* save for module destroy */ +#ifdef TI_MEM_ALLOC_TRACE + os_printf ("MTT:%s:%d ::kmalloc(%lu, %x) : %lu\n", __FUNCTION__, __LINE__, sizeof(TWlanDrvIfObj), GFP_KERNEL, sizeof(TWlanDrvIfObj)); +#endif + memset (drv, 0, sizeof(TWlanDrvIfObj)); - drv->pWorkQueue = create_singlethread_workqueue (TIWLAN_DRV_NAME); - if (!drv->pWorkQueue) - { - return -ENOMEM; - } + /* Dm: drv->irq = TNETW_IRQ; */ + drv->tCommon.eDriverState = DRV_STATE_IDLE; - drv->wl_packet = 0; - drv->wl_count = 0; + drv->tiwlan_wq = create_freezeable_workqueue(DRIVERWQ_NAME); + if (!drv->tiwlan_wq) { + ti_dprintf (TIWLAN_LOG_ERROR, "wlanDrvIf_Create(): Failed to create workQ!\n"); + rc = -EINVAL; + goto drv_create_end_1; + } + drv->wl_packet = 0; + drv->wl_count = 0; #ifdef CONFIG_HAS_WAKELOCK - wake_lock_init(&drv->wl_wifi, WAKE_LOCK_SUSPEND, "wifi_wake"); - wake_lock_init(&drv->wl_rxwake, WAKE_LOCK_SUSPEND, "wifi_rx_wake"); + wake_lock_init(&drv->wl_wifi, WAKE_LOCK_SUSPEND, "wifi_wake"); + wake_lock_init(&drv->wl_rxwake, WAKE_LOCK_SUSPEND, "wifi_rx_wake"); #endif - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23) - INIT_WORK(&drv->tWork, wlanDrvIf_DriverTask, (void *)drv); + INIT_WORK(&drv->tWork, wlanDrvIf_DriverTask, (void *)drv); #else - INIT_WORK(&drv->tWork, wlanDrvIf_DriverTask); + INIT_WORK(&drv->tWork, wlanDrvIf_DriverTask); #endif - spin_lock_init (&drv->lock); + spin_lock_init (&drv->lock); - /* Setup driver network interface. */ - rc = wlanDrvIf_SetupNetif (drv); - if (rc) - { - kfree (drv); - return rc; - } - + /* Setup driver network interface. */ + rc = wlanDrvIf_SetupNetif (drv); + if (rc) { + goto drv_create_end_2; + } - /* Create the events socket interface */ + /* Create the events socket interface */ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23) drv->wl_sock = netlink_kernel_create( NETLINK_USERSOCK, 0, NULL, THIS_MODULE ); #else - drv->wl_sock = netlink_kernel_create(&init_net, NETLINK_USERSOCK, 0, NULL, NULL, THIS_MODULE ); + drv->wl_sock = netlink_kernel_create(&init_net, NETLINK_USERSOCK, 0, NULL, NULL, THIS_MODULE ); #endif - if (drv->wl_sock == NULL) - { - ti_dprintf (TIWLAN_LOG_ERROR, "netlink_kernel_create() failed !\n"); - return -EINVAL; - } + if (drv->wl_sock == NULL) { + ti_dprintf (TIWLAN_LOG_ERROR, "netlink_kernel_create() failed !\n"); + rc = -EINVAL; + goto drv_create_end_3; + } - /* Create all driver modules and link their handles */ - drvMain_Create (drv, - &drv->tCommon.hDrvMain, - &drv->tCommon.hCmdHndlr, - &drv->tCommon.hContext, - &drv->tCommon.hTxDataQ, - &drv->tCommon.hTxMgmtQ, - &drv->tCommon.hTxCtrl, - &drv->tCommon.hTWD, + /* Create all driver modules and link their handles */ + rc = drvMain_Create (drv, + &drv->tCommon.hDrvMain, + &drv->tCommon.hCmdHndlr, + &drv->tCommon.hContext, + &drv->tCommon.hTxDataQ, + &drv->tCommon.hTxMgmtQ, + &drv->tCommon.hTxCtrl, + &drv->tCommon.hTWD, &drv->tCommon.hEvHandler, &drv->tCommon.hCmdDispatch, - &drv->tCommon.hReport); - - /* - * Initialize interrupts (or polling mode for debug): - */ + &drv->tCommon.hReport); + if (rc != TI_OK) { + ti_dprintf (TIWLAN_LOG_ERROR, "%s: Failed to dvrMain_Create!\n", __func__); + rc = -EINVAL; + goto drv_create_end_4; + } + /* + * Initialize interrupts (or polling mode for debug): + */ #ifdef PRIODIC_INTERRUPT - /* Debug mode: Polling (the timer is started by HwInit process) */ - drv->hPollTimer = os_timerCreate ((TI_HANDLE)drv, wlanDrvIf_PollIrqHandler, (TI_HANDLE)drv); + /* Debug mode: Polling (the timer is started by HwInit process) */ + drv->hPollTimer = os_timerCreate ((TI_HANDLE)drv, wlanDrvIf_PollIrqHandler, (TI_HANDLE)drv); #else - /* Normal mode: Interrupts (the default mode) */ - rc = hPlatform_initInterrupt (drv, (void*)wlanDrvIf_HandleInterrupt); - if (rc) - { - ti_dprintf (TIWLAN_LOG_ERROR, "wlanDrvIf_Create(): Failed to register interrupt handler!\n"); - return rc; - } + /* Normal mode: Interrupts (the default mode) */ + rc = hPlatform_initInterrupt (drv, (void*)wlanDrvIf_HandleInterrupt); + if (rc) { + ti_dprintf (TIWLAN_LOG_ERROR, "wlanDrvIf_Create(): Failed to register interrupt handler!\n"); + goto drv_create_end_5; + } #endif /* PRIODIC_INTERRUPT */ + return 0; +drv_create_end_5: + /* Destroy all driver modules */ + if (drv->tCommon.hDrvMain) { + drvMain_Destroy (drv->tCommon.hDrvMain); + } +drv_create_end_4: + if (drv->wl_sock) { + sock_release (drv->wl_sock->sk_socket); + } + +drv_create_end_3: + /* Release the driver network interface */ + if (drv->netdev) { + unregister_netdev (drv->netdev); + free_netdev (drv->netdev); + } + +drv_create_end_2: +#ifdef CONFIG_HAS_WAKELOCK + wake_lock_destroy(&drv->wl_wifi); + wake_lock_destroy(&drv->wl_rxwake); +#endif + if (drv->tiwlan_wq) + destroy_workqueue(drv->tiwlan_wq); - return 0; +drv_create_end_1: + kfree(drv); + printk("%s: Fail\n", __func__); + return rc; } @@ -923,84 +972,79 @@ static int wlanDrvIf_Create (void) */ static void wlanDrvIf_Destroy (TWlanDrvIfObj *drv) { - if(!drv) - return; - - /* Release the driver network interface */ - if (drv->netdev) - { - netif_stop_queue (drv->netdev); - wlanDrvIf_Stop (drv->netdev); - unregister_netdev (drv->netdev); - } + if (!drv) + return; - cancel_work_sync (&drv->tWork); + if (drv->tiwlan_wq) { + cancel_work_sync(&drv->tWork); + flush_workqueue(drv->tiwlan_wq); + } - flush_workqueue (drv->pWorkQueue); - destroy_workqueue (drv->pWorkQueue); + /* Release the driver network interface */ + if (drv->netdev) { + netif_stop_queue (drv->netdev); + wlanDrvIf_Stop (drv->netdev); + unregister_netdev (drv->netdev); + free_netdev (drv->netdev); + } /* Destroy all driver modules */ - if (drv->tCommon.hDrvMain) - { - drvMain_Destroy (drv->tCommon.hDrvMain); - } - - /* close the ipc_kernel socket*/ - if (drv && drv->wl_sock) - { - sock_release (drv->wl_sock->sk_socket); - } + if (drv->tCommon.hDrvMain) { + drvMain_Destroy (drv->tCommon.hDrvMain); + } - /* Release the driver interrupt (or polling timer) */ + /* close the ipc_kernel socket*/ + if (drv && drv->wl_sock) { + sock_release (drv->wl_sock->sk_socket); + } + /* Release the driver interrupt (or polling timer) */ #ifdef PRIODIC_INTERRUPT - os_timerDestroy (drv, drv->hPollTimer); + os_timerDestroy (drv, drv->hPollTimer); #else - if (drv->irq) - { - set_irq_wake(drv->irq, 0); - free_irq (drv->irq, drv); - hPlatform_freeInterrupt (); - } + if (drv->irq) { + hPlatform_freeInterrupt(drv); + } #endif + if (drv->tiwlan_wq) + destroy_workqueue(drv->tiwlan_wq); #ifdef CONFIG_HAS_WAKELOCK - wake_lock_destroy(&drv->wl_wifi); - wake_lock_destroy(&drv->wl_rxwake); + wake_lock_destroy(&drv->wl_wifi); + wake_lock_destroy(&drv->wl_rxwake); #endif - - /* - * Free init files memory - */ - if (drv->tCommon.tFwImage.pImage) - { - os_memoryFree (drv, drv->tCommon.tFwImage.pImage, drv->tCommon.tFwImage.uSize); - #ifdef TI_MEM_ALLOC_TRACE - os_printf ("MTT:%s:%d ::kfree(0x%p) : %d\n", - __FUNCTION__, __LINE__, drv->tCommon.tFwImage.uSize, -drv->tCommon.tFwImage.uSize); - #endif - } - if (drv->tCommon.tNvsImage.pImage) - { - kfree (drv->tCommon.tNvsImage.pImage); - #ifdef TI_MEM_ALLOC_TRACE - os_printf ("MTT:%s:%d ::kfree(0x%p) : %d\n", - __FUNCTION__, __LINE__, drv->tCommon.tNvsImage.uSize, -drv->tCommon.tNvsImage.uSize); - #endif - } - if (drv->tCommon.tIniFile.pImage) - { - kfree (drv->tCommon.tIniFile.pImage); - #ifdef TI_MEM_ALLOC_TRACE - os_printf ("MTT:%s:%d ::kfree(0x%p) : %d\n", - __FUNCTION__, __LINE__, drv->tCommon.tIniFile.uSize, -drv->tCommon.tIniFile.uSize); - #endif - } + /* + * Free init files memory + */ + if (drv->tCommon.tFwImage.pImage) { + os_memoryFree (drv, drv->tCommon.tFwImage.pImage, drv->tCommon.tFwImage.uSize); +#ifdef TI_MEM_ALLOC_TRACE + os_printf ("MTT:%s:%d ::kfree(0x%p) : %d\n", + __FUNCTION__, __LINE__, drv->tCommon.tFwImage.uSize, + -drv->tCommon.tFwImage.uSize); +#endif + } + if (drv->tCommon.tNvsImage.pImage) { + kfree (drv->tCommon.tNvsImage.pImage); +#ifdef TI_MEM_ALLOC_TRACE + os_printf ("MTT:%s:%d ::kfree(0x%p) : %d\n", + __FUNCTION__, __LINE__, drv->tCommon.tNvsImage.uSize, + -drv->tCommon.tNvsImage.uSize); +#endif + } + if (drv->tCommon.tIniFile.pImage) { + kfree (drv->tCommon.tIniFile.pImage); +#ifdef TI_MEM_ALLOC_TRACE + os_printf ("MTT:%s:%d ::kfree(0x%p) : %d\n", + __FUNCTION__, __LINE__, drv->tCommon.tIniFile.uSize, + -drv->tCommon.tIniFile.uSize); +#endif + } /* Free the driver object */ #ifdef TI_DBG tb_destroy(); -#endif - kfree (drv); +#endif + kfree (drv); } @@ -1015,18 +1059,34 @@ static void wlanDrvIf_Destroy (TWlanDrvIfObj *drv) * \return Init: 0 - OK, else - failure. Exit: void * \sa wlanDrvIf_Create, wlanDrvIf_Destroy */ +#ifndef TI_SDIO_STANDALONE +static int sdc_ctrl = 2; +module_param(sdc_ctrl, int, S_IRUGO | S_IWUSR | S_IWGRP); + +extern int sdioDrv_init(int sdcnum); +extern void sdioDrv_exit(void); +#endif + static int __init wlanDrvIf_ModuleInit (void) { - printk(KERN_INFO "TIWLAN: driver init\n"); - sdioDrv_init(); - return wlanDrvIf_Create (); + printk(KERN_INFO "TIWLAN: driver init\n"); +#ifndef TI_SDIO_STANDALONE +#ifndef CONFIG_MMC_EMBEDDED_SDIO + sdioDrv_init(sdc_ctrl); +#endif +#endif + return wlanDrvIf_Create (); } static void __exit wlanDrvIf_ModuleExit (void) { - wlanDrvIf_Destroy (pDrvStaticHandle); - sdioDrv_exit(); - printk (KERN_INFO "TI WLAN: driver unloaded\n"); + wlanDrvIf_Destroy (pDrvStaticHandle); +#ifndef TI_SDIO_STANDALONE +#ifndef CONFIG_MMC_EMBEDDED_SDIO + sdioDrv_exit(); +#endif +#endif + printk (KERN_INFO "TI WLAN: driver unloaded\n"); } diff --git a/wl1271/platforms/os/linux/src/WlanDrvWext.c b/wl1271/platforms/os/linux/src/WlanDrvWext.c index 39743f64..8e0076ea 100644 --- a/wl1271/platforms/os/linux/src/WlanDrvWext.c +++ b/wl1271/platforms/os/linux/src/WlanDrvWext.c @@ -166,76 +166,75 @@ int wlanDrvWext_Handler (struct net_device *dev, void *iw_req, void *extra) { - int rc; - TWlanDrvIfObj *drv = (TWlanDrvIfObj *)NETDEV_GET_PRIVATE(dev); - ti_private_cmd_t my_command; - struct iw_mlme mlme; - struct iw_scan_req scanreq; + int rc; + TWlanDrvIfObj *drv = (TWlanDrvIfObj *)NETDEV_GET_PRIVATE(dev); + ti_private_cmd_t my_command; + struct iw_mlme mlme; + struct iw_scan_req scanreq; + void *copy_to_buf=NULL, *param3=NULL; - void *copy_to_buf=NULL, *param3=NULL; + os_memoryZero(drv, &my_command, sizeof(ti_private_cmd_t)); + os_memoryZero(drv, &mlme, sizeof(struct iw_mlme)); + os_memoryZero(drv, &scanreq, sizeof(struct iw_scan_req)); - os_memoryZero(drv, &my_command, sizeof(ti_private_cmd_t)); - os_memoryZero(drv, &mlme, sizeof(struct iw_mlme)); - os_memoryZero(drv, &scanreq, sizeof(struct iw_scan_req)); - - switch (info->cmd) - { - case SIOCIWFIRSTPRIV: - { - void *copy_from_buf; + switch (info->cmd) + { + case SIOCIWFIRSTPRIV: + { + void *copy_from_buf; - if (os_memoryCopyFromUser(drv, &my_command, ((union iwreq_data *)iw_req)->data.pointer, sizeof(ti_private_cmd_t))) - { - os_printf ("wlanDrvWext_Handler() os_memoryCopyFromUser FAILED !!!\n"); - return TI_NOK; - } - if (IS_PARAM_FOR_MODULE(my_command.cmd, DRIVER_MODULE_PARAM)) - { - /* If it's a driver level command, handle it here and exit */ - switch (my_command.cmd) - { - case DRIVER_INIT_PARAM: - return wlanDrvIf_LoadFiles (drv, my_command.in_buffer); - - case DRIVER_START_PARAM: - return wlanDrvIf_Start (dev); + if (os_memoryCopyFromUser(drv, &my_command, ((union iwreq_data *)iw_req)->data.pointer, sizeof(ti_private_cmd_t))) + { + os_printf ("wlanDrvWext_Handler() os_memoryCopyFromUser FAILED !!!\n"); + return TI_NOK; + } + if (IS_PARAM_FOR_MODULE(my_command.cmd, DRIVER_MODULE_PARAM)) + { + /* If it's a driver level command, handle it here and exit */ + switch (my_command.cmd) + { + case DRIVER_INIT_PARAM: + return wlanDrvIf_LoadFiles(drv, my_command.in_buffer); - case DRIVER_STOP_PARAM: - return wlanDrvIf_Stop (dev); + case DRIVER_START_PARAM: + return wlanDrvIf_Start(dev); - case DRIVER_STATUS_PARAM: - *(TI_UINT32 *)my_command.out_buffer = - (drv->tCommon.eDriverState == DRV_STATE_RUNNING) ? TI_TRUE : TI_FALSE; - return TI_OK; - } - } - /* if we are still here handle a normal private command*/ + case DRIVER_STOP_PARAM: + return wlanDrvIf_Stop(dev); - if ((my_command.in_buffer) && (my_command.in_buffer_len)) - { - copy_from_buf = my_command.in_buffer; - my_command.in_buffer = os_memoryAlloc(drv, my_command.in_buffer_len); - if (os_memoryCopyFromUser(drv, my_command.in_buffer, copy_from_buf, my_command.in_buffer_len)) - { - os_printf ("wlanDrvWext_Handler() os_memoryCopyFromUser 1 FAILED !!!\n"); - return TI_NOK; - } - } - if ((my_command.out_buffer) && (my_command.out_buffer_len)) - { - copy_to_buf = my_command.out_buffer; - my_command.out_buffer = os_memoryAlloc(drv, my_command.out_buffer_len); - } - param3 = &my_command; - } - break; + case DRIVER_STATUS_PARAM: + *(TI_UINT32 *)my_command.out_buffer = + (drv->tCommon.eDriverState == DRV_STATE_RUNNING) ? TI_TRUE : TI_FALSE; + return TI_OK; + } + } + /* if we are still here handle a normal private command*/ - case SIOCSIWMLME: - { - os_memoryCopyFromUser(drv, &mlme, ((union iwreq_data *)iw_req)->data.pointer, sizeof(struct iw_mlme)); - param3 = &mlme; - } - break; + if ((my_command.in_buffer) && (my_command.in_buffer_len)) + { + copy_from_buf = my_command.in_buffer; + my_command.in_buffer = os_memoryAlloc(drv, my_command.in_buffer_len); + if (os_memoryCopyFromUser(drv, my_command.in_buffer, copy_from_buf, my_command.in_buffer_len)) + { + os_printf("wlanDrvWext_Handler() os_memoryCopyFromUser 1 FAILED !!!\n"); + return TI_NOK; + } + } + if ((my_command.out_buffer) && (my_command.out_buffer_len)) + { + copy_to_buf = my_command.out_buffer; + my_command.out_buffer = os_memoryAlloc(drv, my_command.out_buffer_len); + } + param3 = &my_command; + } + break; + + case SIOCSIWMLME: + { + os_memoryCopyFromUser(drv, &mlme, ((union iwreq_data *)iw_req)->data.pointer, sizeof(struct iw_mlme)); + param3 = &mlme; + } + break; case SIOCSIWSCAN: { if (((union iwreq_data *)iw_req)->data.pointer) { @@ -263,14 +262,18 @@ int wlanDrvWext_Handler (struct net_device *dev, } break; } - /* If the friver is not running, return NOK */ - if (drv->tCommon.eDriverState != DRV_STATE_RUNNING) - { - return TI_NOK; - } + /* If the friver is not running, return NOK */ + if (drv->tCommon.eDriverState != DRV_STATE_RUNNING) + { + if (my_command.in_buffer) + os_memoryFree(drv, my_command.in_buffer, my_command.in_buffer_len); + if (my_command.out_buffer) + os_memoryFree(drv,my_command.out_buffer,my_command.out_buffer_len); + return TI_NOK; + } - /* Call the Cmd module with the given user paramters */ - rc = (cmdHndlr_InsertCommand (drv->tCommon.hCmdHndlr, + /* Call the Cmd module with the given user paramters */ + rc = cmdHndlr_InsertCommand(drv->tCommon.hCmdHndlr, info->cmd, info->flags, iw_req, @@ -278,21 +281,20 @@ int wlanDrvWext_Handler (struct net_device *dev, extra, 0, param3, - NULL)); - /* Here we are after the command was completed */ - if (my_command.in_buffer) - { - os_memoryFree (drv, my_command.in_buffer, my_command.in_buffer_len); - } - if (my_command.out_buffer) - { - if (os_memoryCopyToUser(drv, copy_to_buf, my_command.out_buffer, my_command.out_buffer_len)) - { - os_printf ("wlanDrvWext_Handler() os_memoryCopyToUser FAILED !!!\n"); - rc = TI_NOK; - } - os_memoryFree (drv, my_command.out_buffer, my_command.out_buffer_len); - } - - return rc; + NULL); + /* Here we are after the command was completed */ + if (my_command.in_buffer) + { + os_memoryFree(drv, my_command.in_buffer, my_command.in_buffer_len); + } + if (my_command.out_buffer) + { + if (os_memoryCopyToUser(drv, copy_to_buf, my_command.out_buffer, my_command.out_buffer_len)) + { + os_printf("wlanDrvWext_Handler() os_memoryCopyToUser FAILED !!!\n"); + rc = TI_NOK; + } + os_memoryFree(drv, my_command.out_buffer, my_command.out_buffer_len); + } + return rc; } diff --git a/wl1271/platforms/os/linux/src/osRgstry_parser.c b/wl1271/platforms/os/linux/src/osRgstry_parser.c index ec5bc3e4..8aa108b6 100644 --- a/wl1271/platforms/os/linux/src/osRgstry_parser.c +++ b/wl1271/platforms/os/linux/src/osRgstry_parser.c @@ -41,16 +41,15 @@ extern void regReadLastDbgState(TWlanDrvIfObjPtr pAdapter); -static char *init_file = NULL; -static int init_file_length= 0; +static char *init_file = NULL; +static int init_file_length = 0; static PNDIS_CONFIGURATION_PARAMETER pNdisParm; int osInitTable_IniFile (TI_HANDLE hOs, TInitTable *InitTable, char *file_buf, int file_length) { TWlanDrvIfObjPtr drv = (TWlanDrvIfObjPtr)hOs; - static NDIS_CONFIGURATION_PARAMETER vNdisParm; - + init_file = file_buf; init_file_length = file_length; pNdisParm = &vNdisParm; @@ -59,7 +58,6 @@ int osInitTable_IniFile (TI_HANDLE hOs, TInitTable *InitTable, char *file_buf, i #ifdef TI_DBG regReadLastDbgState(drv); #endif - return 0; } diff --git a/wl1271/platforms/os/linux/src/osapi.c b/wl1271/platforms/os/linux/src/osapi.c index 3809ec7f..833281af 100644 --- a/wl1271/platforms/os/linux/src/osapi.c +++ b/wl1271/platforms/os/linux/src/osapi.c @@ -80,11 +80,6 @@ typedef struct timer_list TOsTimer; TI_BOOL bRedirectOutputToLogger = TI_FALSE; TI_BOOL use_debug_module = TI_FALSE; -/* linux/irq.h declerations */ -extern void disable_irq(unsigned int); -extern void enable_irq(unsigned int); - - /**************************************************************************************** * * * OS Report API * @@ -134,38 +129,37 @@ NOTES: *****************************************************************************************/ void os_printf(const char *format ,...) { - static int from_new_line = 1; /* Used to save the last message EOL */ - va_list ap; - static char msg[MAX_MESSAGE_SIZE]; - char *p_msg = msg; /* Pointer to the message */ - TI_UINT16 message_len; - TI_UINT32 sec = 0; - TI_UINT32 uSec = 0; - os_memoryZero(NULL,msg, MAX_MESSAGE_SIZE); + static int from_new_line = 1; /* Used to save the last message EOL */ + va_list ap; + static char msg[MAX_MESSAGE_SIZE]; + char *p_msg = msg; /* Pointer to the message */ + TI_UINT16 message_len; + TI_UINT32 sec = 0; + TI_UINT32 uSec = 0; + os_memoryZero(NULL,msg, MAX_MESSAGE_SIZE); /* Format the message and keep the message length */ - va_start(ap,format); - message_len = vsnprintf(&msg[0], sizeof(msg) -1 , format, ap); - if( from_new_line ) - { - if (msg[1] == '$') - { - p_msg += 4; - } - - sec = os_timeStampUs(NULL); - uSec = sec % MICROSECOND_IN_SECONDS; - sec /= MICROSECOND_IN_SECONDS; - - printk(KERN_INFO DRIVER_NAME ": %d.%06d: %s",sec,uSec,p_msg); - } - else - { - printk(&msg[0]); - } - - from_new_line = ( msg[message_len] == '\n' ); - + va_start(ap,format); + message_len = vsnprintf(&msg[0], sizeof(msg) -1 , format, ap); + if( from_new_line ) + { + if (msg[1] == '$') + { + p_msg += 4; + } + + sec = os_timeStampUs(NULL); + uSec = sec % MICROSECOND_IN_SECONDS; + sec /= MICROSECOND_IN_SECONDS; + + printk(KERN_INFO DRIVER_NAME ": %d.%06d: %s",sec,uSec,p_msg); + } + else + { + printk(&msg[0]); + } + + from_new_line = ( msg[message_len] == '\n' ); va_end(ap); } @@ -194,7 +188,7 @@ NOTES: 1) The user's callback is called directly from OS timer context *****************************************************************************************/ TI_HANDLE os_timerCreate (TI_HANDLE OsContext, fTimerFunction pRoutine, TI_HANDLE hFuncHandle) { - TOsTimer *pOsTimer = os_memoryAlloc (OsContext, sizeof(TOsTimer)); + TOsTimer *pOsTimer = os_memoryAlloc (OsContext, sizeof(TOsTimer)); if(pOsTimer) { @@ -220,8 +214,8 @@ NOTES: *****************************************************************************************/ void os_timerDestroy (TI_HANDLE OsContext, TI_HANDLE TimerHandle) { - os_timerStop (OsContext, TimerHandle); - os_memoryFree (OsContext, TimerHandle, sizeof(TOsTimer)); + os_timerStop (OsContext, TimerHandle); + os_memoryFree (OsContext, TimerHandle, sizeof(TOsTimer)); } @@ -238,9 +232,9 @@ NOTES: *****************************************************************************************/ void os_timerStart (TI_HANDLE OsContext, TI_HANDLE TimerHandle, TI_UINT32 DelayMs) { - TI_UINT32 jiffie_cnt = msecs_to_jiffies (DelayMs); + TI_UINT32 jiffie_cnt = msecs_to_jiffies (DelayMs); - mod_timer ((TOsTimer *)TimerHandle, jiffies + jiffie_cnt); + mod_timer ((TOsTimer *)TimerHandle, jiffies + jiffie_cnt); } @@ -257,7 +251,7 @@ NOTES: *****************************************************************************************/ void os_timerStop (TI_HANDLE OsContext, TI_HANDLE TimerHandle) { - del_timer_sync((TOsTimer *)TimerHandle); + del_timer_sync((TOsTimer *)TimerHandle); } @@ -298,9 +292,9 @@ NOTES: *****************************************************************************************/ TI_UINT32 os_timeStampMs (TI_HANDLE OsContext) { - struct timeval tv; - do_gettimeofday(&tv); - return tv.tv_sec*1000 + tv.tv_usec/1000; + struct timeval tv; + do_gettimeofday(&tv); + return tv.tv_sec*1000 + tv.tv_usec/1000; } @@ -319,9 +313,9 @@ NOTES: *****************************************************************************************/ TI_UINT32 os_timeStampUs (TI_HANDLE OsContext) { - struct timeval tv; - do_gettimeofday(&tv); - return tv.tv_sec*1000000 + tv.tv_usec; + struct timeval tv; + do_gettimeofday(&tv); + return tv.tv_sec*1000000 + tv.tv_usec; } @@ -339,7 +333,7 @@ NOTES: *****************************************************************************************/ void os_StalluSec (TI_HANDLE OsContext, TI_UINT32 uSec) { - udelay (uSec); + udelay (uSec); } @@ -367,7 +361,7 @@ NOTES: *****************************************************************************************/ TI_HANDLE os_protectCreate (TI_HANDLE OsContext) { - return NULL; + return NULL; } @@ -400,9 +394,9 @@ NOTES: *****************************************************************************************/ void os_protectLock (TI_HANDLE OsContext, TI_HANDLE ProtectContext) { - TWlanDrvIfObj *drv = (TWlanDrvIfObj *)OsContext; + TWlanDrvIfObj *drv = (TWlanDrvIfObj *)OsContext; - spin_lock_irqsave (&drv->lock, drv->flags); + spin_lock_irqsave (&drv->lock, drv->flags); } @@ -434,7 +428,6 @@ RETURN: NOTES: *****************************************************************************************/ - TI_BOOL os_receivePacket(TI_HANDLE OsContext, void *pRxDesc ,void *pPacket, TI_UINT16 Length) { TWlanDrvIfObj *drv = (TWlanDrvIfObj *)OsContext; @@ -467,7 +460,9 @@ TI_BOOL os_receivePacket(TI_HANDLE OsContext, void *pRxDesc ,void *pPacket, TI_U printk("-->> os_receivePacket() pPacket=0x%x Length=%d skb=0x%x skb->data=0x%x skb->head=0x%x skb->len=%d\n", (int)pPacket, (int)Length, (int)skb, (int)skb->data, (int)skb->head, (int)skb->len); */ + /* Use skb_reserve, it updates both skb->data and skb->tail. */ skb->data = RX_ETH_PKT_DATA(pPacket); + skb->tail = skb->data; skb_put(skb, RX_ETH_PKT_LEN(pPacket)); /* printk("-->> os_receivePacket() skb=0x%x skb->data=0x%x skb->head=0x%x skb->len=%d\n", @@ -570,14 +565,14 @@ TI_INT32 os_IndicateEvent (TI_HANDLE OsContext, IPC_EV_DATA* pData) void os_disableIrq (TI_HANDLE OsContext) { - TWlanDrvIfObj *drv = (TWlanDrvIfObj *)OsContext; - disable_irq (drv->irq); + TWlanDrvIfObj *drv = (TWlanDrvIfObj *)OsContext; + disable_irq (drv->irq); } void os_enableIrq (TI_HANDLE OsContext) { - TWlanDrvIfObj *drv = (TWlanDrvIfObj *)OsContext; - enable_irq (drv->irq); + TWlanDrvIfObj *drv = (TWlanDrvIfObj *)OsContext; + enable_irq (drv->irq); } /*----------------------------------------------------------------------------- @@ -595,108 +590,119 @@ void os_InterruptServiced (TI_HANDLE OsContext) /* To be implemented with Level IRQ */ } -/*--------------------*/ -/* WAKE LOCK ROUTINES */ -/*--------------------*/ - /*----------------------------------------------------------------------------- - * Routine Name: os_wake_lock_timeout - * Routine Description: Called to prevent system from suspend for some time - * Arguments: OsContext - handle to OS context - * Return Value: packet counter - * -----------------------------------------------------------------------------*/ +Routine Name: os_wake_lock_timeout + +Routine Description: Called to prevent system from suspend for some time + +Arguments: OsContext - handle to OS context + +Return Value: packet counter +-----------------------------------------------------------------------------*/ int os_wake_lock_timeout (TI_HANDLE OsContext) { - TWlanDrvIfObj *drv = (TWlanDrvIfObj *)OsContext; - int ret = 0; - unsigned long flags; - - spin_lock_irqsave(&drv->lock, flags); - if (drv) { - ret = drv->wl_packet; - if (drv->wl_packet) { - drv->wl_packet = 0; + TWlanDrvIfObj *drv = (TWlanDrvIfObj *)OsContext; + int ret = 0; + unsigned long flags; + + if (drv) { + spin_lock_irqsave(&drv->lock, flags); + ret = drv->wl_packet; + if (drv->wl_packet) { + drv->wl_packet = 0; #ifdef CONFIG_HAS_WAKELOCK - wake_lock_timeout(&drv->wl_rxwake, (HZ >> 1)); + wake_lock_timeout(&drv->wl_rxwake, (HZ >> 1)); #endif - } - } - spin_unlock_irqrestore(&drv->lock, flags); - /* printk("%s: %d\n", __func__, ret); */ - return ret; + } + spin_unlock_irqrestore(&drv->lock, flags); + } + /* printk("%s: %d\n", __func__, ret); */ + return ret; } /*----------------------------------------------------------------------------- - * Routine Name: os_wake_lock_timeout_enable - * Routine Description: Called to set flag for suspend prevention for some time - * Arguments: OsContext - handle to OS context - * Return Value: packet counter - * -----------------------------------------------------------------------------*/ +Routine Name: os_wake_lock_timeout_enable + +Routine Description: Called to set flag for suspend prevention for some time + +Arguments: OsContext - handle to OS context + +Return Value: packet counter +-----------------------------------------------------------------------------*/ int os_wake_lock_timeout_enable (TI_HANDLE OsContext) { - TWlanDrvIfObj *drv = (TWlanDrvIfObj *)OsContext; - unsigned long flags; - int ret; + TWlanDrvIfObj *drv = (TWlanDrvIfObj *)OsContext; + unsigned long flags; + int ret = 0; - spin_lock_irqsave(&drv->lock, flags); - ret = drv->wl_packet = 1; - spin_unlock_irqrestore(&drv->lock, flags); - return ret; + if (drv) { + spin_lock_irqsave(&drv->lock, flags); + ret = drv->wl_packet = 1; + spin_unlock_irqrestore(&drv->lock, flags); + } + return ret; } /*----------------------------------------------------------------------------- - * Routine Name: os_wake_lock - * Routine Description: Called to prevent system from suspend - * Arguments: OsContext - handle to OS context - * Return Value: wake_lock counter - * -----------------------------------------------------------------------------*/ +Routine Name: os_wake_lock + +Routine Description: Called to prevent system from suspend + +Arguments: OsContext - handle to OS context + +Return Value: wake_lock counter +-----------------------------------------------------------------------------*/ int os_wake_lock (TI_HANDLE OsContext) { - TWlanDrvIfObj *drv = (TWlanDrvIfObj *)OsContext; - int ret = 0; - unsigned long flags; + TWlanDrvIfObj *drv = (TWlanDrvIfObj *)OsContext; + int ret = 0; + unsigned long flags; - spin_lock_irqsave(&drv->lock, flags); - if (drv) { + if (drv) { + spin_lock_irqsave(&drv->lock, flags); #ifdef CONFIG_HAS_WAKELOCK - if (!drv->wl_count) - wake_lock(&drv->wl_wifi); + if (!drv->wl_count) + wake_lock(&drv->wl_wifi); #endif - drv->wl_count++; - ret = drv->wl_count; - } - spin_unlock_irqrestore(&drv->lock, flags); - /* printk("%s: %d\n", __func__, ret); */ - return ret; + drv->wl_count++; + ret = drv->wl_count; + spin_unlock_irqrestore(&drv->lock, flags); + } + /* printk("%s: %d\n", __func__, ret); */ + return ret; } /*----------------------------------------------------------------------------- - * Routine Name: os_wake_unlock - * Routine Description: Called to allow system to suspend - * Arguments: OsContext - handle to OS context - * Return Value: wake_lock counter - * -----------------------------------------------------------------------------*/ +Routine Name: os_wake_unlock + +Routine Description: Called to allow system to suspend + +Arguments: OsContext - handle to OS context + +Return Value: wake_lock counter +-----------------------------------------------------------------------------*/ int os_wake_unlock (TI_HANDLE OsContext) { - TWlanDrvIfObj *drv = (TWlanDrvIfObj *)OsContext; - int ret = 0; - unsigned long flags; + TWlanDrvIfObj *drv = (TWlanDrvIfObj *)OsContext; + int ret = 0; + unsigned long flags; - spin_lock_irqsave(&drv->lock, flags); - if (drv && drv->wl_count) { - drv->wl_count--; + if (drv) { + spin_lock_irqsave(&drv->lock, flags); + if (drv->wl_count) { + drv->wl_count--; #ifdef CONFIG_HAS_WAKELOCK - if (!drv->wl_count) - wake_unlock(&drv->wl_wifi); + if (!drv->wl_count) + wake_unlock(&drv->wl_wifi); #endif - ret = drv->wl_count; - } - spin_unlock_irqrestore(&drv->lock, flags); - /* printk("%s: %d\n", __func__, ret); */ - return ret; + ret = drv->wl_count; + } + spin_unlock_irqrestore(&drv->lock, flags); + } + /* printk("%s: %d\n", __func__, ret); */ + return ret; } - /*----------------------------------------------------------------------------- Routine Name: os_RequestSchedule @@ -708,21 +714,20 @@ Return Value: TI_OK -----------------------------------------------------------------------------*/ int os_RequestSchedule (TI_HANDLE OsContext) { - TWlanDrvIfObj *drv = (TWlanDrvIfObj *)OsContext; - int iRes = TI_OK; + TWlanDrvIfObj *drv = (TWlanDrvIfObj *)OsContext; - /* Note: The performance trace below doesn't inclose the schedule itself because the rescheduling - * can occur immediately and call os_RequestSchedule again which will confuse the trace tools - */ - CL_TRACE_START_L3(); - CL_TRACE_END_L3("tiwlan_drv.ko", "OS", "TASK", ""); + /* Note: The performance trace below doesn't inclose the schedule + * itself because the rescheduling can occur immediately and call + * os_RequestSchedule again which will confuse the trace tools */ + CL_TRACE_START_L3(); + CL_TRACE_END_L3("tiwlan_drv.ko", "OS", "TASK", ""); - if (!queue_work (drv->pWorkQueue, &drv->tWork)) - { - iRes = TI_NOK; - } + if( !queue_work(drv->tiwlan_wq, &drv->tWork) ) { + /* printk("%s: Fail\n",__func__); */ + return TI_NOK; + } - return iRes; + return TI_OK; } @@ -737,11 +742,11 @@ Return Value: TI_OK -----------------------------------------------------------------------------*/ void *os_SignalObjectCreate (TI_HANDLE OsContext) { - struct completion *myPtr; - myPtr = os_memoryAlloc(OsContext, sizeof(struct completion)); - if(myPtr) - init_completion (myPtr); - return (myPtr); + struct completion *myPtr; + myPtr = os_memoryAlloc(OsContext, sizeof(struct completion)); + if (myPtr) + init_completion (myPtr); + return (myPtr); } @@ -756,8 +761,13 @@ Return Value: TI_OK -----------------------------------------------------------------------------*/ int os_SignalObjectWait (TI_HANDLE OsContext, void *signalObject) { - wait_for_completion ((struct completion *)signalObject); - return TI_OK; + if (!signalObject) + return TI_NOK; + if (!wait_for_completion_timeout((struct completion *)signalObject, + msecs_to_jiffies(10000))) { + printk("tiwlan: 10 sec %s timeout\n", __func__); + } + return TI_OK; } @@ -772,8 +782,10 @@ Return Value: TI_OK -----------------------------------------------------------------------------*/ int os_SignalObjectSet (TI_HANDLE OsContext, void *signalObject) { - complete ((struct completion *)signalObject); - return TI_OK; + if (!signalObject) + return TI_NOK; + complete ((struct completion *)signalObject); + return TI_OK; } @@ -788,8 +800,10 @@ Return Value: TI_OK -----------------------------------------------------------------------------*/ int os_SignalObjectFree (TI_HANDLE OsContext, void *signalObject) { - os_memoryFree(OsContext, signalObject, sizeof(struct completion)); - return TI_OK; + if (!signalObject) + return TI_NOK; + os_memoryFree(OsContext, signalObject, sizeof(struct completion)); + return TI_OK; } @@ -813,21 +827,21 @@ void os_Trace (TI_HANDLE OsContext, TI_UINT32 uLevel, TI_UINT32 uFileId, TI_UINT TI_UINT32 uMaxParamValue = 0; TI_UINT32 uMsgLen = TRACE_MSG_MIN_LENGTH; TI_UINT8 aMsg[TRACE_MSG_MAX_LENGTH] = {0}; - TTraceMsg *pMsgHdr = (TTraceMsg *)&aMsg[0]; + TTraceMsg *pMsgHdr = (TTraceMsg *)&aMsg[0]; TI_UINT8 *pMsgData = &aMsg[0] + sizeof(TTraceMsg); va_list list; - if (!bRedirectOutputToLogger) - { - return; - } + if (!bRedirectOutputToLogger) + { + return; + } if (uParamsNum > TRACE_MSG_MAX_PARAMS) { uParamsNum = TRACE_MSG_MAX_PARAMS; } - /* sync on the parameters */ + /* sync on the parameters */ va_start(list, uParamsNum); /* find the longest parameter */ @@ -849,7 +863,7 @@ void os_Trace (TI_HANDLE OsContext, TI_UINT32 uLevel, TI_UINT32 uFileId, TI_UINT } } - /* Set msg length and format according to the biggest parameter value (8/16/32 bits) */ + /* Set msg length and format according to the biggest parameter value (8/16/32 bits) */ if (uMaxParamValue > UINT16_MAX_VAL) { pMsgHdr->uFormat = TRACE_FORMAT_32_BITS_PARAMS; @@ -866,11 +880,11 @@ void os_Trace (TI_HANDLE OsContext, TI_UINT32 uLevel, TI_UINT32 uFileId, TI_UINT uMsgLen += uParamsNum; } - /* Fill all other header information */ - pMsgHdr->uLevel = (TI_UINT8)uLevel; - pMsgHdr->uParamsNum = (TI_UINT8)uParamsNum; - pMsgHdr->uFileId = (TI_UINT16)uFileId; - pMsgHdr->uLineNum = (TI_UINT16)uLineNum; + /* Fill all other header information */ + pMsgHdr->uLevel = (TI_UINT8)uLevel; + pMsgHdr->uParamsNum = (TI_UINT8)uParamsNum; + pMsgHdr->uFileId = (TI_UINT16)uFileId; + pMsgHdr->uLineNum = (TI_UINT16)uLineNum; /* re-sync on the parameters */ va_start(list, uParamsNum); @@ -904,7 +918,7 @@ void os_Trace (TI_HANDLE OsContext, TI_UINT32 uLevel, TI_UINT32 uFileId, TI_UINT va_end(list); - /* Send the trace message to the logger */ + /* Send the trace message to the logger */ SendLoggerData(OsContext, aMsg, (TI_UINT16)uMsgLen); } @@ -922,7 +936,3 @@ void os_Trace (TI_HANDLE OsContext, TI_UINT32 uLevel, TI_UINT32 uFileId, TI_UINT void os_SetDrvThreadPriority (TI_HANDLE OsContext, TI_UINT32 uWlanDrvThreadPriority) { } - - - - diff --git a/wl1271/platforms/os/linux/src/osmemapi.c b/wl1271/platforms/os/linux/src/osmemapi.c index 0243df76..e0e2fe2c 100644 --- a/wl1271/platforms/os/linux/src/osmemapi.c +++ b/wl1271/platforms/os/linux/src/osmemapi.c @@ -61,10 +61,10 @@ typedef void (*os_free)(void *); struct os_mem_block { - struct list_head blk_list; - os_free f_free; - __u32 size; - __u32 signature; + struct list_head blk_list; + os_free f_free; + __u32 size; + __u32 signature; }; #define MEM_BLOCK_START (('m'<<24) | ('e'<<16) | ('m'<<8) | 's') #define MEM_BLOCK_END (('m'<<24) | ('e'<<16) | ('m'<<8) | 'e') @@ -97,25 +97,25 @@ os_memoryAlloc( TI_UINT32 Size ) { - struct os_mem_block *blk; - __u32 total_size = Size + sizeof(struct os_mem_block) + sizeof(__u32); + struct os_mem_block *blk; + __u32 total_size = Size + sizeof(struct os_mem_block) + sizeof(__u32); #ifdef TI_MEM_ALLOC_TRACE - os_printf("MTT:%s:%d ::os_memoryAlloc(0x%p, %lu) : %lu\n",__FUNCTION__, __LINE__,OsContext,Size,total_size); + os_printf("MTT:%s:%d ::os_memoryAlloc(0x%p, %lu) : %lu\n",__FUNCTION__, __LINE__,OsContext,Size,total_size); #endif /* - Memory optimization issue. Allocate up to 2 pages (8k) from the SLAB allocator (2^n), - otherwise allocate from virtual pool. - If full Async mode is used, allow up to 6 pages (24k) for DMA-able memory, so the TxCtrlBlk table - can be transacted over DMA. + Memory optimization issue. Allocate up to 2 pages (8k) from the SLAB + allocator (2^n), otherwise allocate from virtual pool. + If full Async mode is used, allow up to 6 pages (24k) for DMA-able + memory, so the TxCtrlBlk table can be transacted over DMA. */ #ifdef FULL_ASYNC_MODE if (total_size < 6 * 4096) #else - if (total_size < 2 * 4096) + if (total_size < 2 * 4096) #endif - { - if (in_atomic()) + { + if (in_atomic()) { blk = kmalloc(total_size, GFP_ATOMIC); } @@ -125,31 +125,35 @@ os_memoryAlloc( } if (!blk) { - printk("%s: NULL\n",__func__); - return NULL; - } - blk->f_free = (os_free)kfree; - } + printk("%s: NULL\n",__func__); + return NULL; + } + blk->f_free = (os_free)kfree; + } else { - /* We expect that the big allocations should be made outside the interrupt, - otherwise fail + /* We expect that the big allocations should be made outside + the interrupt, otherwise fail */ - if (in_interrupt()) + if (in_interrupt()) { + printk("%s: NULL\n",__func__); return NULL; - blk = vmalloc(total_size); - if (!blk) - return NULL; - blk->f_free = (os_free)vfree; - } + } + blk = vmalloc(total_size); + if (!blk) { + printk("%s: NULL\n",__func__); + return NULL; + } + blk->f_free = (os_free)vfree; + } - os_profile (OsContext, 4, total_size); + os_profile (OsContext, 4, total_size); - /*list_add(&blk->blk_list, &drv->mem_blocks);*/ - blk->size = Size; - blk->signature = MEM_BLOCK_START; - *(__u32 *)((unsigned char *)blk + total_size - sizeof(__u32)) = MEM_BLOCK_END; - return (void*)((char *)blk + sizeof(struct os_mem_block)); + /*list_add(&blk->blk_list, &drv->mem_blocks);*/ + blk->size = Size; + blk->signature = MEM_BLOCK_START; + *(__u32 *)((unsigned char *)blk + total_size - sizeof(__u32)) = MEM_BLOCK_END; + return (void *)((char *)blk + sizeof(struct os_mem_block)); } @@ -173,22 +177,22 @@ os_memoryCAlloc( TI_UINT32 Size ) { - void* pAllocatedMem; - TI_UINT32 MemSize; + void* pAllocatedMem; + TI_UINT32 MemSize; #ifdef TI_MEM_ALLOC_TRACE - os_printf("MTT:%s:%d ::os_memoryCAlloc(0x%p, %lu, %lu) : %lu\n",__FUNCTION__,__LINE__,OsContext,Number,Size,Number*Size); + os_printf("MTT:%s:%d ::os_memoryCAlloc(0x%p, %lu, %lu) : %lu\n",__FUNCTION__,__LINE__,OsContext,Number,Size,Number*Size); #endif - MemSize = Number * Size; + MemSize = Number * Size; - pAllocatedMem = os_memoryAlloc(OsContext, MemSize); + pAllocatedMem = os_memoryAlloc(OsContext, MemSize); - if(!pAllocatedMem) - return NULL; + if (!pAllocatedMem) + return NULL; - memset(pAllocatedMem,0,MemSize); + memset(pAllocatedMem,0,MemSize); - return pAllocatedMem; + return pAllocatedMem; } @@ -218,29 +222,34 @@ os_memoryFree( TI_UINT32 Size ) { - struct os_mem_block *blk = - (struct os_mem_block *)((char *)pMemPtr - sizeof(struct os_mem_block)); - + struct os_mem_block *blk; + + if (!pMemPtr) { + printk("%s: NULL\n",__func__); + return; + } + blk = (struct os_mem_block *)((char *)pMemPtr - sizeof(struct os_mem_block)); + #ifdef TI_MEM_ALLOC_TRACE - os_printf("MTT:%s:%d ::os_memoryFree(0x%p, 0x%p, %lu) : %d\n",__FUNCTION__,__LINE__,OsContext,pMemPtr,Size,-Size); + os_printf("MTT:%s:%d ::os_memoryFree(0x%p, 0x%p, %lu) : %d\n",__FUNCTION__,__LINE__,OsContext,pMemPtr,Size,-Size); #endif if (blk->signature != MEM_BLOCK_START) - { + { printk("\n\n%s: memory block signature is incorrect - 0x%x\n\n\n", - __FUNCTION__, blk->signature); - return; - } - *(char *)(&blk->signature) = '~'; - if (*(__u32 *)((unsigned char *)blk + blk->size + sizeof(struct os_mem_block)) - != MEM_BLOCK_END) - { + __FUNCTION__, blk->signature); + return; + } + *(char *)(&blk->signature) = '~'; + if (*(__u32 *)((unsigned char *)blk + blk->size + sizeof(struct os_mem_block)) + != MEM_BLOCK_END) + { printk("\n\n%s: memory block corruption. Size=%u\n\n\n", - __FUNCTION__, blk->size); - } + __FUNCTION__, blk->size); + } - os_profile (OsContext, 5, blk->size + sizeof(struct os_mem_block) + sizeof(__u32)); + os_profile (OsContext, 5, blk->size + sizeof(struct os_mem_block) + sizeof(__u32)); - blk->f_free(blk); + blk->f_free(blk); } @@ -266,7 +275,11 @@ os_memorySet( TI_UINT32 Length ) { - memset(pMemPtr,Value,Length); + if (!pMemPtr) { + printk("%s: NULL\n",__func__); + return; + } + memset(pMemPtr,Value,Length); } /**************************************************************************************** @@ -289,29 +302,32 @@ os_memoryAlloc4HwDma( TI_UINT32 Size ) { - struct os_mem_block *blk; + struct os_mem_block *blk; __u32 total_size = Size + sizeof(struct os_mem_block) + sizeof(__u32); /* - if the size is greater than 2 pages then we cant allocate the memory through kmalloc so the function fails + if the size is greater than 2 pages then we cant allocate the memory + through kmalloc so the function fails */ if (Size < 2 * OS_PAGE_SIZE) - { - blk = kmalloc(total_size, GFP_ATOMIC|GFP_DMA); - if (!blk) + { + blk = kmalloc(total_size, GFP_ATOMIC|GFP_DMA); + if (!blk) { + printk("%s: NULL\n",__func__); return NULL; - blk->f_free = (os_free)kfree; + } + blk->f_free = (os_free)kfree; } - else - { + else + { printk("\n\n%s: memory cant be allocated-Size = %d\n\n\n", - __FUNCTION__, Size); + __FUNCTION__, Size); return NULL; } blk->size = Size; blk->signature = MEM_BLOCK_START; *(__u32 *)((unsigned char *)blk + total_size - sizeof(__u32)) = MEM_BLOCK_END; - return (void*)((char *)blk + sizeof(struct os_mem_block)); + return (void *)((char *)blk + sizeof(struct os_mem_block)); } /**************************************************************************************** @@ -339,24 +355,29 @@ os_memory4HwDmaFree( TI_UINT32 Size ) { - struct os_mem_block *blk = - (struct os_mem_block *)((char *)pMem_ptr - sizeof(struct os_mem_block)); + struct os_mem_block *blk; + + if (!pMem_ptr) { + printk("%s: NULL\n",__func__); + return; + } + blk = (struct os_mem_block *)((char *)pMem_ptr - sizeof(struct os_mem_block)); if (blk->signature != MEM_BLOCK_START) - { + { printk("\n\n%s: memory block signature is incorrect - 0x%x\n\n\n", - __FUNCTION__, blk->signature); - return; - } - *(char *)(&blk->signature) = '~'; - if (*(__u32 *)((unsigned char *)blk + blk->size + sizeof(struct os_mem_block)) - != MEM_BLOCK_END) - { + __FUNCTION__, blk->signature); + return; + } + *(char *)(&blk->signature) = '~'; + if (*(__u32 *)((unsigned char *)blk + blk->size + sizeof(struct os_mem_block)) + != MEM_BLOCK_END) + { printk("\n\n%s: memory block corruption. Size=%u\n\n\n", - __FUNCTION__, blk->size); - } + __FUNCTION__, blk->size); + } - blk->f_free(blk); + blk->f_free(blk); } /**************************************************************************************** @@ -379,7 +400,11 @@ os_memoryZero( TI_UINT32 Length ) { - memset(pMemPtr,0,Length); + if (!pMemPtr) { + printk("%s: NULL\n",__func__); + return; + } + memset(pMemPtr,0,Length); } @@ -406,7 +431,8 @@ os_memoryCopy( TI_UINT32 Size ) { - memcpy(pDstPtr,pSrcPtr,Size); + + memcpy(pDstPtr,pSrcPtr,Size); } /**************************************************************************************** @@ -434,7 +460,7 @@ os_memoryCompare( TI_INT32 Count ) { - return memcmp(Buf1, Buf2, Count); + return memcmp(Buf1, Buf2, Count); } @@ -463,7 +489,7 @@ os_memoryCopyFromUser( TI_UINT32 Size ) { - return copy_from_user(pDstPtr,pSrcPtr,Size); + return copy_from_user(pDstPtr,pSrcPtr,Size); } /**************************************************************************************** @@ -489,5 +515,5 @@ os_memoryCopyToUser( TI_UINT32 Size ) { - return copy_to_user(pDstPtr,pSrcPtr,Size); + return copy_to_user(pDstPtr,pSrcPtr,Size); } diff --git a/wl1271/platforms/os/linux/src/stack_profile.c b/wl1271/platforms/os/linux/src/stack_profile.c index 352c77e7..37e55cb4 100644 --- a/wl1271/platforms/os/linux/src/stack_profile.c +++ b/wl1271/platforms/os/linux/src/stack_profile.c @@ -31,60 +31,144 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - /* * src/stack_profile.c * */ #include <linux/stddef.h> +#include <linux/kernel.h> +#include <linux/sched.h> + +#define STACK_MASK (THREAD_SIZE-1) +#define MAX_STACK_FRAME 2 + +typedef struct STACK_FRAME { + unsigned long stack_buf[THREAD_SIZE/sizeof(unsigned long)]; + unsigned long *stack_start; + unsigned long stack_size; +} stack_frame_t; -unsigned long check_stack(unsigned long *base) +static stack_frame_t sf_array[MAX_STACK_FRAME]; + +static unsigned long check_stack(unsigned long *base) { - register unsigned long sp asm ("sp"); unsigned long retval = sp; - *base = ((sp & ~0x1fff) + 0x380); + + *base = ((sp & ~STACK_MASK) + sizeof(struct task_struct) + 4); return retval; } -unsigned long check_stack_start(unsigned long *base) +unsigned long check_stack_start(unsigned long *base, unsigned long real_sp, + int id) { - unsigned long i; - unsigned long from,to; + unsigned long i; + unsigned long from, to; to = check_stack(&from); *base = from; + /* save used stack context */ + if (id < MAX_STACK_FRAME) { + stack_frame_t *sfp = &sf_array[id]; + + if (!real_sp) + real_sp = to; + sfp->stack_size = THREAD_SIZE - (real_sp & STACK_MASK); + sfp->stack_start = (unsigned long *)real_sp; + memcpy(sfp->stack_buf, sfp->stack_start, sfp->stack_size); + } /* run from the stack pointer down to the base */ - for (i = from;i<to;i+=4) - { + for(i=from;(i < to);i+=4) { /* fill up the pattern */ - *(long *)i = 0xdeadbeef; + *(unsigned long *)i = 0xdeadbeef; } -/* printk("check_stack_start: from =%x to=%x data=%x\n",from,to,*(long *)(from+4));*/ + /*printk("check_stack_start: from=%x to=%x data=%x\n",from,to,*(long *)(from+4));*/ return to; } -unsigned long check_stack_stop(unsigned long *base) +unsigned long check_stack_stop(unsigned long *base, int id) { - unsigned long i; - unsigned long from,to; + unsigned long i; + unsigned long from, to; to = check_stack(&from); *base = from; + /* check used stack context */ + if (id < MAX_STACK_FRAME) { + stack_frame_t *sfp = &sf_array[id]; + + if (memcmp(sfp->stack_buf, sfp->stack_start, sfp->stack_size)) { + printk("%s: %p - Error\n", __func__, sfp->stack_start); + for(i=0;(i < sfp->stack_size/sizeof(unsigned long));i++) { + if (sfp->stack_start[i] != sfp->stack_buf[i]) + printk("%p: 0x%08lx != 0x%08lx\n", &sfp->stack_start[i], sfp->stack_start[i], sfp->stack_buf[i]); + } + } + } + /* run from the stack pointer down to the base */ - for (i = from;i<to;i+=4) - { + for(i=from;(i < to);i+=4) { /* check up the pattern */ - if ((*(long *)i) != 0xdeadbeef) + if ((*(unsigned long *)i) != 0xdeadbeef) break; } - /*printk("check_stack_stop: from =%x to=%x data=%x data=%x i=0x%x\n",from,to,*(long *)from,*(long *)(from+4),i);*/ + /*printk("check_stack_stop: from=%x to=%x data=%x data=%x i=0x%x\n",from,to,*(long *)from,*(long *)(from+4),i);*/ /* return the first time when the pattern doesn't match */ return i; } +void print_stack(int id) +{ + stack_frame_t *sfp = &sf_array[id]; + unsigned long i; + printk("%s: %d\n", __func__, id); + for(i=0;(i < sfp->stack_size/sizeof(unsigned long));i++) { + printk("%p: 0x%08lx\n", &sfp->stack_start[i], sfp->stack_start[i]); + } +} + +struct task_struct *get_task_struct_ptr_by_name(char *name) +{ + struct task_struct *g, *p; + + read_lock(&tasklist_lock); + do_each_thread(g, p) { + /* + * reset the NMI-timeout, listing all files on a slow + * console might take alot of time: + */ + /* touch_nmi_watchdog(); */ + if (!strcmp(name, p->comm)) { + read_unlock(&tasklist_lock); + return p; + } + } while_each_thread(g, p); + read_unlock(&tasklist_lock); + return NULL; +} + +unsigned long save_stack_context(char *name, int id) +{ +/* register unsigned long sp asm ("sp"); + unsigned long sp_local = sp; +*/ + struct task_struct *p; + stack_frame_t *sfp; + + if (id >= MAX_STACK_FRAME) + return 0L; + sfp = &sf_array[id]; + p = get_task_struct_ptr_by_name(name); + if (p) { + printk("%s: %s found\n", __func__, p->comm); /* sched_show_task(t);*/ + sfp->stack_start = (unsigned long *)((unsigned long)end_of_stack(p) & ~STACK_MASK); + sfp->stack_size = THREAD_SIZE; + memcpy(sfp->stack_buf, sfp->stack_start, sfp->stack_size); + } + return sfp->stack_size; +} diff --git a/wl1271/platforms/os/linux/wl_env.bash b/wl1271/platforms/os/linux/wl_env.bash index 64961c3f..234e0b34 100644 --- a/wl1271/platforms/os/linux/wl_env.bash +++ b/wl1271/platforms/os/linux/wl_env.bash @@ -1,5 +1,6 @@ -export PATH=<PATH TO CROSS COMPILER>:$PATH -export CROSS_COMPILE=arm-none-linux-gnueabi- +# export PATH=<PATH TO CROSS COMPILER>:$PATH +export CROSS_COMPILE=arm-eabi- export ARCH=arm -export HOST_PLATFORM=zoom2 -export KERNEL_DIR=<PATH TO KERNEL DIR> +export HOST_PLATFORM=sholes +export KERNEL_DIR=/usr/local/google/android/master/kernel + diff --git a/wl1271/stad/Export_Inc/paramOut.h b/wl1271/stad/Export_Inc/paramOut.h index 3df1d2c1..57a73405 100644 --- a/wl1271/stad/Export_Inc/paramOut.h +++ b/wl1271/stad/Export_Inc/paramOut.h @@ -255,7 +255,7 @@ typedef struct typedef struct rxDataFilterFieldPattern_t { - TI_UINT16 offset; /* Offset of the field to compare from the start of the packet*/ + TI_UINT16 offset; /* Offset of the field to compare from the start of the packet*/ TI_UINT8 length; /* Size of the field pattern */ TI_UINT8 flag; /* Bit Mask flag */ TI_UINT8 pattern[RX_DATA_FILTER_MAX_PATTERN_SIZE]; /* expected pattern */ diff --git a/wl1271/stad/build/linux/Makefile b/wl1271/stad/build/linux/Makefile index 9ce7e938..e98697ec 100644 --- a/wl1271/stad/build/linux/Makefile +++ b/wl1271/stad/build/linux/Makefile @@ -34,7 +34,8 @@ endif # OS include paths required for compilation. # OS_INCS = $(DK_ROOT)/platforms/os/linux/inc $(DK_ROOT)/platforms/os/common/inc -OS_INCS += $(DK_ROOT)/stad/src/core/EvHandler $(DK_ROOT)/Test $(DK_ROOT)/platforms/hw/host_platform_$(HOST_PLATFORM)/linux +#OS_INCS += $(DK_ROOT)/stad/src/core/EvHandler $(DK_ROOT)/Test $(DK_ROOT)/platforms/hw/host_platform_$(HOST_PLATFORM)/linux +OS_INCS += $(DK_ROOT)/stad/src/core/EvHandler $(DK_ROOT)/Test $(DK_ROOT)/platforms/hw/linux # # Location and filename of the driver .lib file created by this makefile. diff --git a/wl1271/stad/build/linux/common.inc b/wl1271/stad/build/linux/common.inc index 65b29d18..27f8f254 100644 --- a/wl1271/stad/build/linux/common.inc +++ b/wl1271/stad/build/linux/common.inc @@ -100,13 +100,15 @@ endif ifeq ($(DEBUG),y) DK_DEFINES += -D TI_DBG DK_DEFINES += -D REPORT_LOG - DK_DEFINES += -Os + DK_DEFINES += -O2 + DK_DEFINES += -D PRINTF_ROLLBACK else + DK_DEFINES += -D TI_DBG DK_DEFINES += -U REPORT_LOG - DK_DEFINES += -Os + DK_DEFINES += -O2 endif ifeq ($(KERNEL_DEBUGGER),y) - DK_DEFINES += -g -Os + DK_DEFINES += -g -O2 STRIP = n endif export KERNEL_DEBUGGER @@ -170,7 +172,7 @@ endif ## ## -EXTRA_CFLAGS += -fsigned-char -Werror -EXTRA_CFLAGS += -D __LINUX__ +EXTRA_CFLAGS += -fsigned-char +EXTRA_CFLAGS += -D __LINUX__ -DTI_RANDOM_DEFAULT_MAC EXTRA_CFLAGS += $(DK_DEFINES) EXTRA_CFLAGS += $(PFORM_DEFINES) diff --git a/wl1271/stad/build/linux/drv_sources.inc b/wl1271/stad/build/linux/drv_sources.inc index 7ddd82c2..a7120c45 100644 --- a/wl1271/stad/build/linux/drv_sources.inc +++ b/wl1271/stad/build/linux/drv_sources.inc @@ -6,8 +6,8 @@ TNETW_INCS = \ $(PLATFORMS)/os/common/inc \ $(PLATFORMS)/os/linux/src \ $(PLATFORMS)/os/linux/inc \ - $(PLATFORMS)/hw/host_platform_$(HOST_PLATFORM) \ - $(EXT_DRV)/$(HOST_PLATFORM)/Linux/$(BUS_DRV) \ + $(PLATFORMS)/hw/linux \ + $(EXT_DRV)/$(BUS_DRV)/linux \ $(EXT_APP)/Linux/bmtrace/Export_Inc \ $(TWD) \ $(TWD)/Ctrl \ @@ -50,10 +50,10 @@ CORE_INCS = \ $(COMSRC)/Sta_Management \ $(COMSRC)/Connection_Managment -ifeq ($(DEBUG),y) +#ifeq ($(DEBUG),y) CORE_INCS += \ $(TESTSRC)/ -endif +#endif #start of CORE_INCS_XCC# do not remove or change this comment ifeq ($(XCC),y) @@ -220,7 +220,7 @@ CORE_SRCS = \ $(COMSRC)/Application/roamingMngr_manualSM.c \ $(COMSRC)/Application/roamingMngr_autoSM.c -ifeq ($(DEBUG),y) +#ifeq ($(DEBUG),y) CORE_SRCS += \ $(TESTSRC)/connDebug.c \ $(TESTSRC)/siteMgrDebug.c \ @@ -242,9 +242,9 @@ ifeq ($(DEBUG),y) $(TESTSRC)/HealthMonitorDbg.c \ $(TESTSRC)/smeDebug.c \ $(TESTSRC)/fwdriverdebug.c \ - $(TESTSRC)/MibDbg.c \ - $(TESTSRC)/TwIfDebug.c -endif + $(TESTSRC)/MibDbg.c \ + $(TESTSRC)/TwIfDebug.c +#endif #start of CORE_SRCS_XCC# do not remove or change this comment ifeq ($(XCC),y) diff --git a/wl1271/stad/src/AirLink_Managment/measurementMgrSM.c b/wl1271/stad/src/AirLink_Managment/measurementMgrSM.c index 777aca30..6687d40a 100644 --- a/wl1271/stad/src/AirLink_Managment/measurementMgrSM.c +++ b/wl1271/stad/src/AirLink_Managment/measurementMgrSM.c @@ -824,7 +824,6 @@ static TI_STATUS measurementMgrSM_acStartMeasurement(void * pData) /* the second one is the measurementSRV request */ MeasurementRequest_t * pRequestArr[MAX_NUM_REQ]; TMeasurementRequest request; - paramInfo_t *pParam; TI_UINT8 numOfRequestsInParallel; TI_UINT8 requestIndex; @@ -844,7 +843,7 @@ static TI_STATUS measurementMgrSM_acStartMeasurement(void * pData) request.startTime = 0; /* ignored by MeasurementSRV for now - for .11k */ request.numberOfTypes = 0; -TRACE1(pMeasurementMgr->hReport, REPORT_SEVERITY_INFORMATION, ": Measured Channel = %d\n", pMeasurementMgr->measuredChannelID); + TRACE1(pMeasurementMgr->hReport, REPORT_SEVERITY_INFORMATION, ": Measured Channel = %d\n", pMeasurementMgr->measuredChannelID); pParam->paramType = REGULATORY_DOMAIN_GET_SCAN_CAPABILITIES; pParam->content.channelCapabilityReq.channelNum = pMeasurementMgr->measuredChannelID; @@ -877,7 +876,6 @@ TRACE1(pMeasurementMgr->hReport, REPORT_SEVERITY_INFORMATION, ": Measured Channe if (status != TI_OK) { TRACE0(pMeasurementMgr->hReport, REPORT_SEVERITY_ERROR, ": Failed getting next request from Request Handler\n"); - return measurementMgrSM_event((TI_UINT8 *) &(pMeasurementMgr->currentState), MEASUREMENTMGR_EVENT_COMPLETE, pMeasurementMgr); } @@ -954,7 +952,6 @@ TRACE1(pMeasurementMgr->hReport, REPORT_SEVERITY_INFORMATION, ": Measured Channe TRACE2(pMeasurementMgr->hReport, REPORT_SEVERITY_INFORMATION, ": Maximum delay to perform measurement operation has passed (%d / %d)\n", MSR_START_MAX_DELAY, (os_timeStampMs(pMeasurementMgr->hOs) - pMeasurementMgr->currentRequestStartTime)); pMeasurementMgr->buildRejectReport(pMeasurementMgr, pRequestArr, numOfRequestsInParallel, MSR_REJECT_MAX_DELAY_PASSED); - return measurementMgrSM_event((TI_UINT8 *) &(pMeasurementMgr->currentState), MEASUREMENTMGR_EVENT_COMPLETE, pMeasurementMgr); } @@ -968,7 +965,6 @@ TRACE1(pMeasurementMgr->hReport, REPORT_SEVERITY_INFORMATION, ": Measured Channe NULL, NULL, measurementMgr_MeasurementCompleteCB, pMeasurementMgr); - return TI_OK; } diff --git a/wl1271/stad/src/AirLink_Managment/regulatoryDomain.c b/wl1271/stad/src/AirLink_Managment/regulatoryDomain.c index fb99df5d..d25e6acb 100644 --- a/wl1271/stad/src/AirLink_Managment/regulatoryDomain.c +++ b/wl1271/stad/src/AirLink_Managment/regulatoryDomain.c @@ -649,7 +649,7 @@ TRACE1(pRegulatoryDomain->hReport, REPORT_SEVERITY_INFORMATION, "regulatoryDomai break; default: -TRACE1(pRegulatoryDomain->hReport, REPORT_SEVERITY_ERROR, "Get param, Params is not supported, %d\n\n", pParam->paramType); + TRACE1(pRegulatoryDomain->hReport, REPORT_SEVERITY_WARNING, "Get param, Params is not supported, %d\n\n", pParam->paramType); return PARAM_NOT_SUPPORTED; } @@ -1118,7 +1118,7 @@ static TI_STATUS regulatoryDomain_getChannelCapability(regulatoryDomain_t *pRegu { return TI_NOK; } - + channelCapabilityRet->channelValidity = TI_FALSE; channelCapabilityRet->maxTxPowerDbm = 0; if ((channelCapabilityReq.channelNum==0 ) || (channelCapabilityReq.channelNum > A_5G_BAND_MAX_CHANNEL)) @@ -1192,7 +1192,6 @@ static TI_STATUS regulatoryDomain_getChannelCapability(regulatoryDomain_t *pRegu channelCapabilityReq.band, bServingChannel); os_memoryFree(pRegulatoryDomain->hOs, pParam, sizeof(paramInfo_t)); - } } else /* Passive scanning */ @@ -1297,6 +1296,7 @@ static TI_STATUS regulatoryDomain_updateCurrTxPower(regulatoryDomain_t *pRegulat pTwdParam = (TTwdParamInfo *)os_memoryAlloc(pRegulatoryDomain->hOs, sizeof(TTwdParamInfo)); if (!pTwdParam) { + os_memoryFree(pRegulatoryDomain->hOs, pParam, sizeof(paramInfo_t)); return TI_NOK; } @@ -1366,7 +1366,7 @@ void regulatoryDomain_checkCountryCodeExpiry(regulatoryDomain_t *pRegulatoryDoma { paramInfo_t *pParam; TI_STATUS connStatus; - TI_UINT32 uCurrentTS = os_timeStampMs(pRegulatoryDomain->hOs); + TI_UINT32 uCurrentTS = os_timeStampMs(pRegulatoryDomain->hOs); if ((pRegulatoryDomain->country_2_4_WasFound) || (pRegulatoryDomain->country_5_WasFound)) { @@ -1392,7 +1392,7 @@ void regulatoryDomain_checkCountryCodeExpiry(regulatoryDomain_t *pRegulatoryDoma /* Restore default values of the scan control table */ setSupportedChannelsAccording2ScanControlTable(pRegulatoryDomain); - } + } os_memoryFree(pRegulatoryDomain->hOs, pParam, sizeof(paramInfo_t)); } } diff --git a/wl1271/stad/src/Application/roamingMngr.c b/wl1271/stad/src/Application/roamingMngr.c index 5403c68b..0655aad8 100644 --- a/wl1271/stad/src/Application/roamingMngr.c +++ b/wl1271/stad/src/Application/roamingMngr.c @@ -645,7 +645,6 @@ extern TI_STATUS apConn_reportRoamingEvent(TI_HANDLE hAPConnection, TI_HANDLE roamingMngr_create(TI_HANDLE hOs) { - // TI_STATUS status = TI_OK; roamingMngr_t *pRoamingMngr; TI_UINT32 initVec; diff --git a/wl1271/stad/src/Application/roamingMngrApi.h b/wl1271/stad/src/Application/roamingMngrApi.h index 7985b70e..bc297974 100644 --- a/wl1271/stad/src/Application/roamingMngrApi.h +++ b/wl1271/stad/src/Application/roamingMngrApi.h @@ -297,6 +297,8 @@ TI_STATUS roamingMngr_updateNewBssList(TI_HANDLE hRoamingMngr, bssList_t *newBss +/* All functions below added by Lior*/ + TI_STATUS roamingMngr_setDefaults (TI_HANDLE hRoamingMngr, TRoamScanMngrInitParams *pInitParam); TI_STATUS roamingMngr_setBssLossThreshold (TI_HANDLE hRoamingMngr, TI_UINT32 uNumOfBeacons, TI_UINT16 uClientID); TI_STATUS roamingMngr_connect(TI_HANDLE hRoamingMngr, TargetAp_t* pTargetAp); diff --git a/wl1271/stad/src/Application/roamingMngrTypes.h b/wl1271/stad/src/Application/roamingMngrTypes.h index bc88ddf9..e66c5c69 100644 --- a/wl1271/stad/src/Application/roamingMngrTypes.h +++ b/wl1271/stad/src/Application/roamingMngrTypes.h @@ -55,7 +55,6 @@ #define ROAMING_OPERATIONAL_MODE_MANUAL 0 #define ROAMING_OPERATIONAL_MODE_AUTO 1 - /*--------------*/ /* Enumerations */ /*--------------*/ diff --git a/wl1271/stad/src/Application/roamingMngr_autoSM.c b/wl1271/stad/src/Application/roamingMngr_autoSM.c index 6c262031..585b203b 100644 --- a/wl1271/stad/src/Application/roamingMngr_autoSM.c +++ b/wl1271/stad/src/Application/roamingMngr_autoSM.c @@ -612,7 +612,7 @@ static void roamingMngr_smSuccHandover(TI_HANDLE hRoamingMngr) /* Start pre-authentication in order to set PMKID for the current AP */ if (pRoamingMngr->staCapabilities.authMode==os802_11AuthModeWPA2) - { + { /* No Pre-Auth is required */ bssList_t *pBssList; @@ -792,4 +792,3 @@ static void roamingMngr_smStartIdle(void *pData) } } - diff --git a/wl1271/stad/src/Application/scanMngrApi.h b/wl1271/stad/src/Application/scanMngrApi.h index 9df33f0f..792c25de 100644 --- a/wl1271/stad/src/Application/scanMngrApi.h +++ b/wl1271/stad/src/Application/scanMngrApi.h @@ -389,9 +389,8 @@ void scanMngrDebugPrintNeighborAPList( TI_HANDLE hScanMngr ); */ void scanMngrDebugPrintObject( TI_HANDLE hScanMngr ); +#endif /* TI_DBG */ void scanMngr_SetDefaults (TI_HANDLE hScanMngr, TRoamScanMngrInitParams *pInitParams); -#endif /* TI_DBG */ - #endif /* __SCAN_MNGR_API_H__ */ diff --git a/wl1271/stad/src/Application/scanMngrTypes.h b/wl1271/stad/src/Application/scanMngrTypes.h index 68dd23cf..c224fcf2 100644 --- a/wl1271/stad/src/Application/scanMngrTypes.h +++ b/wl1271/stad/src/Application/scanMngrTypes.h @@ -43,7 +43,7 @@ * \n\n */ -/* \ +/* \author Ronen Kalish * \date 01-Mar-2005 */ @@ -70,7 +70,6 @@ *********************************************************************** */ - /* *********************************************************************** * Structure definitions. diff --git a/wl1271/stad/src/Connection_Managment/admCtrlWpa.c b/wl1271/stad/src/Connection_Managment/admCtrlWpa.c index 69079ada..91339236 100644 --- a/wl1271/stad/src/Connection_Managment/admCtrlWpa.c +++ b/wl1271/stad/src/Connection_Managment/admCtrlWpa.c @@ -843,12 +843,11 @@ TI_STATUS admCtrlWpa_setSite(admCtrl_t *pAdmCtrl, TRsnData *pRsnData, TI_UINT8 * pAdmCtrl->externalAuthMode = RSN_EXT_AUTH_MODE_OPEN; break; } - #ifdef XCC_MODULE_INCLUDED pParam->paramType = XCC_CCKM_EXISTS; - pParam->content.XCCCckmExists = (wpaData.KeyMngSuite[0]==WPA_IE_KEY_MNG_CCKM) ? TI_TRUE : TI_FALSE; + pParam->content.XCCCckmExists = (wpaData.KeyMngSuite[0]==WPA_IE_KEY_MNG_CCKM) ? TI_TRUE : TI_FALSE; XCCMngr_setParam(pAdmCtrl->hXCCMngr, pParam); #endif /* set replay counter */ @@ -896,7 +895,7 @@ TI_STATUS admCtrlWpa_setSite(admCtrl_t *pAdmCtrl, TRsnData *pRsnData, TI_UINT8 * status = TWD_SetParam(pAdmCtrl->pRsn->hTWD, &tTwdParam); if (status != TI_OK) { - goto adm_ctrl_wpa_end; + goto adm_ctrl_wpa_end; } #ifdef XCC_MODULE_INCLUDED @@ -915,7 +914,7 @@ TI_STATUS admCtrlWpa_setSite(admCtrl_t *pAdmCtrl, TRsnData *pRsnData, TI_UINT8 * if (status != TI_OK) { - goto adm_ctrl_wpa_end; + goto adm_ctrl_wpa_end; } #endif /*XCC_MODULE_INCLUDED*/ @@ -925,7 +924,6 @@ TI_STATUS admCtrlWpa_setSite(admCtrl_t *pAdmCtrl, TRsnData *pRsnData, TI_UINT8 * { goto adm_ctrl_wpa_end; } - adm_ctrl_wpa_end: os_memoryFree(pAdmCtrl->hOs, pParam, sizeof(paramInfo_t)); return status; @@ -1080,7 +1078,6 @@ TI_STATUS admCtrlWpa_evalSite(admCtrl_t *pAdmCtrl, TRsnData *pRsnData, TRsnSiteP return TI_NOK; /* if the encyption is TKIP and the site does support HT(11n) the site can not be a candidate */ } - /* Check privacy bit if not in mixed mode */ if (!pAdmCtrl->mixedMode) { /* There's no mixed mode, so make sure that the privacy Bit matches the privacy mode*/ @@ -1103,7 +1100,6 @@ TI_STATUS admCtrlWpa_evalSite(admCtrl_t *pAdmCtrl, TRsnData *pRsnData, TRsnSiteP pAdmCtrl->unicastSuite = TWD_CIPHER_NONE; } - /* always return TI_OK */ return TI_OK; } @@ -1257,7 +1253,8 @@ TI_STATUS admCtrlWpa_parseIe(admCtrl_t *pAdmCtrl, TI_UINT8 *pWpaIe, wpaIeData_t curWpaIe +=4; /* Include all AP key management supported suites in the wpaData structure */ - pWpaData->KeyMngSuite[index+1] = curKeyMngSuite; + if ((index+1) < MAX_WPA_KEY_MNG_SUITES) + pWpaData->KeyMngSuite[index+1] = curKeyMngSuite; } pWpaData->KeyMngSuite[0] = maxKeyMngSuite; diff --git a/wl1271/stad/src/Connection_Managment/admCtrlWpa2.c b/wl1271/stad/src/Connection_Managment/admCtrlWpa2.c index 037fe96f..d4688e6f 100644 --- a/wl1271/stad/src/Connection_Managment/admCtrlWpa2.c +++ b/wl1271/stad/src/Connection_Managment/admCtrlWpa2.c @@ -651,7 +651,6 @@ TI_STATUS admCtrlWpa2_setSite(admCtrl_t *pAdmCtrl, TRsnData *pRsnData, TI_UINT8 TI_UINT8 *pWpa2Ie; ECipherSuite uSuite, bSuite; - *pAssocIeLen = 0; if (pRsnData==NULL) @@ -693,7 +692,7 @@ TI_STATUS admCtrlWpa2_setSite(admCtrl_t *pAdmCtrl, TRsnData *pRsnData, TI_UINT8 status = admCtrl_parseIe(pAdmCtrl, pRsnData, &pWpa2Ie, RSN_IE_ID); if (status != TI_OK) - { + { goto adm_ctrl_wpa2_end; } TRACE0(pAdmCtrl->hReport, REPORT_SEVERITY_INFORMATION, "admCtrlWpa2_setSite: RSN_IE=\n"); @@ -742,14 +741,12 @@ TI_STATUS admCtrlWpa2_setSite(admCtrl_t *pAdmCtrl, TRsnData *pRsnData, TI_UINT8 paeConfig.authProtocol = RSN_EXT_AUTH_MODE_WPA2PSK; } - #ifdef XCC_MODULE_INCLUDED pParam->paramType = XCC_CCKM_EXISTS; pParam->content.XCCCckmExists = (wpa2Data.KeyMngSuite[0]==WPA2_IE_KEY_MNG_CCKM) ? TI_TRUE : TI_FALSE; XCCMngr_setParam(pAdmCtrl->hXCCMngr, pParam); #endif - paeConfig.keyExchangeProtocol = pAdmCtrl->keyMngSuite; paeConfig.unicastSuite = uSuite; /* Updated value */ paeConfig.broadcastSuite = bSuite; /* Updated value */ @@ -849,10 +846,8 @@ TI_STATUS admCtrlWpa2_evalSite(admCtrl_t *pAdmCtrl, TRsnData *pRsnData, TRsnSite TRACE0(pAdmCtrl->hReport, REPORT_SEVERITY_INFORMATION,"Dismiss AP - HT with TKIP is not valid"); return TI_NOK; /* if the encyption is TKIP and the site does support HT(11n) the site can not be a candidate */ } - - /* Get Simple-Config state */ + /* Get Simple-Config state */ siteMgr_getParamWSC(pAdmCtrl->pRsn->hSiteMgr, &wscMode); /* SITE_MGR_SIMPLE_CONFIG_MODE */ - status = admCtrl_parseIe(pAdmCtrl, pRsnData, &pWpa2Ie, RSN_IE_ID); if (status != TI_OK) { @@ -1680,7 +1675,7 @@ static void admCtrlWpa2_buildAndSendPMKIDCandList (TI_HANDLE hHandle, TBssidList TI_UINT8 candIndex =0, apIndex = 0, size =0; paramInfo_t *pParam; OS_802_11_PMKID_CANDIDATELIST *pCandList; - TI_UINT8 memBuff[PMKID_CAND_LIST_MEMBUFF_SIZE + sizeof(TI_UINT32)]; + TI_UINT8 memBuff[PMKID_CAND_LIST_MEMBUFF_SIZE + sizeof(TI_UINT32)]; dot11_RSN_t *rsnIE = 0; wpa2IeData_t wpa2Data; TI_STATUS status = TI_NOK; @@ -1704,7 +1699,7 @@ static void admCtrlWpa2_buildAndSendPMKIDCandList (TI_HANDLE hHandle, TBssidList /* the ssid in the PMKID cache */ if ((pAdmCtrl->pmkid_cache.ssid.len != pParam->content.smeDesiredSSID.len) || (os_memoryCompare(pAdmCtrl->hOs, (TI_UINT8 *)pAdmCtrl->pmkid_cache.ssid.str, - (TI_UINT8 *) pParam->content.smeDesiredSSID.str, + (TI_UINT8 *)pParam->content.smeDesiredSSID.str, pAdmCtrl->pmkid_cache.ssid.len) != 0)) { admCtrlWpa2_resetPMKIDCache(pAdmCtrl); @@ -1843,10 +1838,7 @@ static void admCtrlWpa2_buildAndSendPMKIDCandList (TI_HANDLE hHandle, TBssidList /* Send PRE-AUTH start event to External Application */ admCtrl_notifyPreAuthStatus (pAdmCtrl, RSN_PRE_AUTH_START); TRACE1(pAdmCtrl->hReport, REPORT_SEVERITY_INFORMATION, "RSN: PMKID Candidate List with %d entries has been built and sent for ssid \n", candIndex); - - return; - } /** diff --git a/wl1271/stad/src/Connection_Managment/apConn.c b/wl1271/stad/src/Connection_Managment/apConn.c index 06b23998..39fbacb9 100644 --- a/wl1271/stad/src/Connection_Managment/apConn.c +++ b/wl1271/stad/src/Connection_Managment/apConn.c @@ -1547,15 +1547,10 @@ TI_STATUS apConn_getVendorSpecificIE(TI_HANDLE hAPConnection, TI_UINT8 *pRequest { *len = 0; } - return TI_OK; } - - - - /* Internal functions implementation */ @@ -2279,7 +2274,6 @@ static void apConn_smHandleTspecReneg (void *pData) { /* TSPEC is already configured, move to CONNECTED */ apConn_smEvent(&(pAPConnection->currentState), AP_CONNECT_EVENT_FINISHED_OK, pAPConnection); - return;; } else { @@ -2291,17 +2285,15 @@ static void apConn_smHandleTspecReneg (void *pData) { /* Re-negotiation of TSPEC cannot be performed */ apConn_smEvent(&(pAPConnection->currentState), AP_CONNECT_EVENT_FINISHED_NOT_OK, pAPConnection); - return; } - return; } } else { /* No need to re-negotiate TSPEC, move to CONNECTED */ apConn_smEvent(&(pAPConnection->currentState), AP_CONNECT_EVENT_FINISHED_OK, pAPConnection); - return; } + return; } diff --git a/wl1271/stad/src/Connection_Managment/apConnApi.h b/wl1271/stad/src/Connection_Managment/apConnApi.h index deb9b4ae..12bed1cf 100644 --- a/wl1271/stad/src/Connection_Managment/apConnApi.h +++ b/wl1271/stad/src/Connection_Managment/apConnApi.h @@ -170,8 +170,6 @@ typedef TI_STATUS (*apConn_roamMngrCallb_t) (TI_HANDLE hRoamingMngr, void *pData typedef TI_STATUS (*apConn_roamMngrEventCallb_t) (TI_HANDLE hRoamingMngr, void *pData, TI_UINT16 reasonCode); - - /*------------*/ /* Structures */ /*------------*/ @@ -248,7 +246,6 @@ typedef struct _TargetAP_t bssEntry_t newAP; } TargetAp_t; - /*---------------------------*/ /* External data definitions */ /*---------------------------*/ diff --git a/wl1271/stad/src/Connection_Managment/conn.c b/wl1271/stad/src/Connection_Managment/conn.c index d6c2824d..aa49b1cb 100644 --- a/wl1271/stad/src/Connection_Managment/conn.c +++ b/wl1271/stad/src/Connection_Managment/conn.c @@ -92,19 +92,19 @@ RETURN: Handle to the connection module on success, NULL otherwise ************************************************************************/ TI_HANDLE conn_create(TI_HANDLE hOs) { - conn_t *pConn; + conn_t *pConn; fsm_stateMachine_t *pFsm; TI_STATUS status; pConn = os_memoryAlloc(hOs, sizeof(conn_t)); if (pConn == NULL) - { + { return NULL; - } - os_memoryZero (pConn->hOs, pConn, sizeof(conn_t)); - + } + + os_memoryZero(hOs, (void *)pConn, sizeof(conn_t)); /* Creating connection Ibss SM */ - status = fsm_Create(hOs, &pFsm, CONN_IBSS_NUM_STATES, CONN_IBSS_NUM_EVENTS); + status = fsm_Create(hOs, &pFsm, CONN_IBSS_NUM_STATES, CONN_IBSS_NUM_EVENTS); if (status != TI_OK) { release_module(pConn); @@ -112,7 +112,7 @@ TI_HANDLE conn_create(TI_HANDLE hOs) } pConn->ibss_pFsm = pFsm; - /* Creating connection Infra SM */ + /* Creating connection Infra SM */ status = fsm_Create(hOs, &pFsm, CONN_INFRA_NUM_STATES, CONN_INFRA_NUM_EVENTS); if (status != TI_OK) { @@ -484,11 +484,13 @@ TI_STATUS conn_reportMlmeStatus(TI_HANDLE hConn, TRACE0(pConn->hReport, REPORT_SEVERITY_CONSOLE," CONN LOST \n"); TRACE0(pConn->hReport, REPORT_SEVERITY_CONSOLE,"-------------------------------------\n"); - +#ifdef REPORT_LOG WLAN_OS_REPORT(("-------------------------------------\n")); WLAN_OS_REPORT((" CONN LOST \n")); WLAN_OS_REPORT(("-------------------------------------\n")); - +#else + os_printf("%s: *** CONN LOST ***\n", __func__); +#endif if( pConn->connType == CONN_TYPE_ROAM ) pConn->disConnType = DISCONNECT_IMMEDIATE; else /* connType == CONN_TYPE_ESS */ diff --git a/wl1271/stad/src/Connection_Managment/connIbss.c b/wl1271/stad/src/Connection_Managment/connIbss.c index aa0170a4..3583abb4 100644 --- a/wl1271/stad/src/Connection_Managment/connIbss.c +++ b/wl1271/stad/src/Connection_Managment/connIbss.c @@ -447,7 +447,7 @@ RETURN: TI_OK on success, TI_NOK otherwise ************************************************************************/ static TI_STATUS rsnWait_to_waitToDisconnCmplt(void *pData) { - paramInfo_t param; + paramInfo_t param; TI_STATUS tStatus; tStatus = rsn_stop(((conn_t *)pData)->hRsn, TI_FALSE); diff --git a/wl1271/stad/src/Connection_Managment/connIbss.h b/wl1271/stad/src/Connection_Managment/connIbss.h index 3476ca5a..24ba706c 100644 --- a/wl1271/stad/src/Connection_Managment/connIbss.h +++ b/wl1271/stad/src/Connection_Managment/connIbss.h @@ -67,6 +67,7 @@ typedef enum typedef enum { STATE_CONN_IBSS_IDLE =0, + STATE_CONN_IBSS_SELF_WAIT , STATE_CONN_IBSS_RSN_WAIT , STATE_CONN_IBSS_CONNECTED , diff --git a/wl1271/stad/src/Connection_Managment/connInfra.c b/wl1271/stad/src/Connection_Managment/connInfra.c index b9fa8bfe..d2f63a0e 100644 --- a/wl1271/stad/src/Connection_Managment/connInfra.c +++ b/wl1271/stad/src/Connection_Managment/connInfra.c @@ -256,7 +256,6 @@ TI_STATUS conn_infraConfig(conn_t *pConn) return fsm_Config(pConn->infra_pFsm, (fsm_Matrix_t)smMatrix, CONN_INFRA_NUM_STATES, CONN_INFRA_NUM_EVENTS, conn_infraSMEvent, pConn->hOs); } - /*********************************************************************** * conn_infraSMEvent *********************************************************************** @@ -283,7 +282,6 @@ TI_STATUS conn_infraSMEvent(TI_UINT8 *currentState, TI_UINT8 event, TI_HANDLE hC TI_UINT8 nextState; status = fsm_GetNextState(pConn->infra_pFsm, *currentState, event, &nextState); - if (status != TI_OK) { TRACE0(pConn->hReport, REPORT_SEVERITY_SM, "State machine error, failed getting next state\n"); @@ -394,7 +392,6 @@ static TI_STATUS mlmeWait_to_WaitDisconnect(void *pData) pParam->content.rxDataPortStatus = CLOSE; rxData_setParam(pConn->hRxData, pParam); - /* Update TxMgmtQueue SM to close Tx path. */ txMgmtQ_SetConnState (pConn->hTxMgmtQ, TX_CONN_STATE_CLOSE); @@ -443,19 +440,17 @@ static TI_STATUS mlmeWait_to_rsnWait(void *pData) pParam->paramType = RX_DATA_PORT_STATUS_PARAM; pParam->content.rxDataPortStatus = OPEN_EAPOL; - status = rxData_setParam(pConn->hRxData, pParam); + status = rxData_setParam(pConn->hRxData, pParam); os_memoryFree(pConn->hOs, pParam, sizeof(paramInfo_t)); if (status != TI_OK) return status; - /* Update TxMgmtQueue SM to enable EAPOL packets. */ txMgmtQ_SetConnState (((conn_t *)pData)->hTxMgmtQ, TX_CONN_STATE_EAPOL); - + /* * Notify that the driver is associated to the supplicant\IP stack. */ EvHandlerSendEvent(pConn->hEvHandler, IPC_EVENT_ASSOCIATED, NULL,0); - status = rsn_start(pConn->hRsn); return status; } @@ -531,16 +526,15 @@ static TI_STATUS configHW_to_disconnect(void *pData) { pParam->paramType = REGULATORY_DOMAIN_DISCONNECT_PARAM; regulatoryDomain_setParam(pConn->hRegulatoryDomain, pParam); - + /* Must be called AFTER mlme_stop. since De-Auth packet should be sent with the - supported rates, and stopModules clears all rates. */ + supported rates, and stopModules clears all rates. */ stopModules(pConn, TI_TRUE); - + /* send disconnect command to firmware */ prepare_send_disconnect(pData); } } - os_memoryFree(pConn->hOs, pParam, sizeof(paramInfo_t)); return status; } @@ -567,25 +561,25 @@ static TI_STATUS connInfra_ScrWaitDisconn_to_disconnect(void *pData) if (status == TI_OK) { /* Update TxMgmtQueue SM to close Tx path for all except Mgmt packets. */ - txMgmtQ_SetConnState (pConn->hTxMgmtQ, TX_CONN_STATE_MGMT); - + txMgmtQ_SetConnState(pConn->hTxMgmtQ, TX_CONN_STATE_MGMT); + pParam->paramType = REGULATORY_DOMAIN_DISCONNECT_PARAM; regulatoryDomain_setParam(pConn->hRegulatoryDomain, pParam); - - status = mlme_stop( pConn->hMlmeSm, DISCONNECT_IMMEDIATE, pConn->disConnReasonToAP ); + + status = mlme_stop(pConn->hMlmeSm, DISCONNECT_IMMEDIATE, pConn->disConnReasonToAP); if (status == TI_OK) { /* Must be called AFTER mlme_stop. since De-Auth packet should be sent with the supported rates, and stopModules clears all rates. */ stopModules(pConn, TI_TRUE); - + /* send disconnect command to firmware */ prepare_send_disconnect(pData); } } - os_memoryFree(pConn->hOs, pParam, sizeof(paramInfo_t)); return status; + } @@ -607,7 +601,7 @@ static TI_STATUS rsnWait_to_configHW(void *pData) status = rxData_setParam(pConn->hRxData, pParam); os_memoryFree(pConn->hOs, pParam, sizeof(paramInfo_t)); if (status != TI_OK) - return status; + return status; status = qosMngr_connect(pConn->hQosMngr); if (status != TI_OK) @@ -619,15 +613,15 @@ static TI_STATUS rsnWait_to_configHW(void *pData) status = measurementMgr_connected(pConn->hMeasurementMgr); if (status != TI_OK) { - TRACE2(pConn->hReport, REPORT_SEVERITY_ERROR, "Infra Conn status=%d, have to return (%d)\n",status,__LINE__); - return status; + TRACE2(pConn->hReport, REPORT_SEVERITY_ERROR, "Infra Conn status=%d, have to return (%d)\n",status,__LINE__); + return status; } status = TrafficMonitor_Start(pConn->hTrafficMonitor); if (status != TI_OK) { - TRACE2(pConn->hReport, REPORT_SEVERITY_ERROR, "Infra Conn status=%d, have to return (%d)\n",status,__LINE__); - return status; + TRACE2(pConn->hReport, REPORT_SEVERITY_ERROR, "Infra Conn status=%d, have to return (%d)\n",status,__LINE__); + return status; } healthMonitor_setState(pConn->hHealthMonitor, HEALTH_MONITOR_STATE_CONNECTED); @@ -687,8 +681,10 @@ static TI_STATUS configHW_to_connected(void *pData) TRACE0(pConn->hReport, REPORT_SEVERITY_CONSOLE, "************ NEW CONNECTION ************\n"); WLAN_OS_REPORT(("************ NEW CONNECTION ************\n")); siteMgr_printPrimarySiteDesc(pConn->hSiteMgr); - TRACE0(pConn->hReport, REPORT_SEVERITY_CONSOLE, "****************************************\n"); + TRACE0(pConn->hReport, REPORT_SEVERITY_CONSOLE, "****************************************\n"); WLAN_OS_REPORT(("****************************************\n")); +#else + os_printf("%s: *** NEW CONNECTION ***\n", __func__); #endif return TI_OK; diff --git a/wl1271/stad/src/Connection_Managment/externalSec.c b/wl1271/stad/src/Connection_Managment/externalSec.c index aa56c06e..64d7c9b7 100644 --- a/wl1271/stad/src/Connection_Managment/externalSec.c +++ b/wl1271/stad/src/Connection_Managment/externalSec.c @@ -115,8 +115,6 @@ TI_STATUS externalSec_config(mainSec_t *pMainSec) return status; } - - /** * * Function - externalSec_create. @@ -160,7 +158,6 @@ struct externalSec_t* externalSec_create(TI_HANDLE hOs) return pHandle; } - /** * * Function - externalSec_Destroy. @@ -185,20 +182,17 @@ TI_STATUS externalSec_Destroy (struct externalSec_t *pExternalSec) { return TI_NOK; } - - status = fsm_Unload (pExternalSec->hOs, pExternalSec->pExternalSecSm); + status = fsm_Unload(pExternalSec->hOs, pExternalSec->pExternalSecSm); if (status != TI_OK) { /* report failure but don't stop... */ TRACE0(pExternalSec->hReport, REPORT_SEVERITY_ERROR, "EXTERNAL SECURITY: Error releasing FSM memory \n"); } - os_memoryFree (pExternalSec->hOs, pExternalSec, sizeof(struct externalSec_t)); - + os_memoryFree(pExternalSec->hOs, pExternalSec, sizeof(struct externalSec_t)); return TI_OK; } - /** * * Function - externalSecSM_start. @@ -360,4 +354,3 @@ TI_STATUS externalSecSM_Unexpected(struct externalSec_t *pExternalSec) TRACE0(pExternalSec->hReport, REPORT_SEVERITY_ERROR, "EXTERNAL_SEC_SM: ERROR UnExpected Event\n"); return(TI_OK); } - diff --git a/wl1271/stad/src/Connection_Managment/rsn.c b/wl1271/stad/src/Connection_Managment/rsn.c index 02414026..70fcd29c 100644 --- a/wl1271/stad/src/Connection_Managment/rsn.c +++ b/wl1271/stad/src/Connection_Managment/rsn.c @@ -461,7 +461,6 @@ TI_STATUS rsn_start(TI_HANDLE hRsn) } TRACE0(pRsn->hReport, REPORT_SEVERITY_INFORMATION, "rsn_start ...\n"); - pRsn->rsnStartedTs = os_timeStampMs (pRsn->hOs); status = pRsn->pMainSecSm->start (pRsn->pMainSecSm); @@ -670,7 +669,7 @@ TI_STATUS rsn_getParamEncryptionStatus(TI_HANDLE hRsn, ECipherSuite *rsnStatus) TI_STATUS rsn_getParam(TI_HANDLE hRsn, void *param) { rsn_t *pRsn = (rsn_t *)hRsn; - paramInfo_t *pParam = (paramInfo_t*)param; + paramInfo_t *pParam = (paramInfo_t *)param; TI_STATUS status = TI_OK; if ( (NULL == pRsn) || (NULL == pParam) ) @@ -1223,7 +1222,6 @@ TI_STATUS rsn_reportStatus (rsn_t *pRsn, TI_STATUS rsnStatus) return TI_NOK; } - if (rsnStatus == TI_OK) { /* set EAPOL encryption status according to authentication protocol */ @@ -1584,9 +1582,13 @@ TI_STATUS rsn_setKey (rsn_t *pRsn, TSecurityKeys *pKey) TI_BOOL macIsBroadcast = TI_FALSE; TI_STATUS status = TI_OK; - keyIndex = (TI_UINT8)pKey->keyIndex; + if (pRsn == NULL || pKey == NULL) + { + return TI_NOK; + } - if ((pRsn == NULL) || (pKey == NULL) || ((keyIndex)>=MAX_KEYS_NUM)) + keyIndex = (TI_UINT8)pKey->keyIndex; + if (keyIndex >= MAX_KEYS_NUM) { return TI_NOK; } @@ -1649,6 +1651,7 @@ TI_STATUS rsn_setKey (rsn_t *pRsn, TSecurityKeys *pKey) txCtrlParams_setEncryptionFieldSizes (pRsn->hTxCtrl, 0); break; } + } pRsn->keys[keyIndex].keyType = pKey->keyType; @@ -1728,9 +1731,13 @@ TI_STATUS rsn_removeKey (rsn_t *pRsn, TSecurityKeys *pKey) TTwdParamInfo tTwdParam; TI_UINT8 keyIndex; - keyIndex = (TI_UINT8)pKey->keyIndex; + if (pRsn == NULL || pKey == NULL) + { + return TI_NOK; + } - if ( (NULL == pRsn) || (NULL == pKey) || (keyIndex >= MAX_KEYS_NUM) ) + keyIndex = (TI_UINT8)pKey->keyIndex; + if (keyIndex >= MAX_KEYS_NUM) { return TI_NOK; } @@ -1913,7 +1920,6 @@ TI_STATUS rsn_reportMicFailure(TI_HANDLE hRsn, TI_UINT8 *pType, TI_UINT32 Length (TI_UINT8*)AuthBuf, sizeof(TI_UINT32) + sizeof(OS_802_11_AUTHENTICATION_REQUEST)); - if ( pRsn->bRsnExternalMode ) { return TI_OK; } diff --git a/wl1271/stad/src/Connection_Managment/rsnApi.h b/wl1271/stad/src/Connection_Managment/rsnApi.h index 4314e0dd..656d95d3 100644 --- a/wl1271/stad/src/Connection_Managment/rsnApi.h +++ b/wl1271/stad/src/Connection_Managment/rsnApi.h @@ -238,7 +238,6 @@ TI_STATUS rsn_eventRecv(TI_HANDLE hRsn, ERsnEvent event, void* pData); TI_STATUS rsn_setParam(TI_HANDLE hCtrlData, void *pParam); TI_STATUS rsn_getParamEncryptionStatus(TI_HANDLE hRsn, ECipherSuite *rsnStatus); - TI_STATUS rsn_getParam(TI_HANDLE hCtrlData, void *pParam); TI_STATUS rsn_evalSite(TI_HANDLE hRsn, TRsnData *pRsnData, TRsnSiteParams *pRsnSiteParams, TI_UINT32 *pMetric); diff --git a/wl1271/stad/src/Connection_Managment/sme.c b/wl1271/stad/src/Connection_Managment/sme.c index 029f4f08..c02893ef 100644 --- a/wl1271/stad/src/Connection_Managment/sme.c +++ b/wl1271/stad/src/Connection_Managment/sme.c @@ -362,6 +362,12 @@ TI_STATUS sme_SetParam (TI_HANDLE hSme, paramInfo_t *pParam) break; case SME_DESIRED_SSID_ACT_PARAM: + if (pParam->content.smeDesiredSSID.len > MAX_SSID_LEN) + { + /* printk("SSID length(%d) is out of range. Discard it.\n", pParam->content.smeDesiredSSID.len);*/ + return PARAM_VALUE_NOT_VALID; /* ssid length is out of range */ + } + pSme->bRadioOn = TI_TRUE; /* if new value is different than current one */ @@ -397,6 +403,9 @@ TI_STATUS sme_SetParam (TI_HANDLE hSme, paramInfo_t *pParam) pSme->bConstantScan = TI_FALSE; } + /* printk("SME_DESIRED_SSID_ACT_PARAM: bRadioOn = %d, bRunning = %d\n", pSme->bRadioOn, pSme->bRunning); */ + pSme->bRunning = TI_TRUE; /* set it to TRUE in case it's accidentally altered. */ + /* now send a disconnect event */ genSM_Event (pSme->hSmeSm, SME_SM_EVENT_DISCONNECT, hSme); break; @@ -553,12 +562,10 @@ void sme_ScanResultCB (TI_HANDLE hSme, EScanCncnResultStatus eStatus, TSme *pSme = (TSme*)hSme; paramInfo_t param; - switch (eStatus) { /* a frame was received - update the scan result table */ case SCAN_CRS_RECEIVED_FRAME: - TRACE6(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_ScanResultCB: received frame from BSSID %02x:%02x:%02x:%02x:%02x:%02x\n", (*pFrameInfo->bssId)[ 0 ], (*pFrameInfo->bssId)[ 1 ], (*pFrameInfo->bssId)[ 2 ], (*pFrameInfo->bssId)[ 3 ], (*pFrameInfo->bssId)[ 4 ], (*pFrameInfo->bssId)[ 5 ]); /* @@ -578,19 +585,17 @@ void sme_ScanResultCB (TI_HANDLE hSme, EScanCncnResultStatus eStatus, pSme->tSsid.len))) #endif { - if (TI_OK != scanResultTable_UpdateEntry (pSme->hScanResultTable, pFrameInfo->bssId, pFrameInfo)) { - TRACE6(pSme->hReport, REPORT_SEVERITY_ERROR , "sme_ScanResultCB: unable to update specific enrty for BSSID %02x:%02x:%02x:%02x:%02x:%02x\n", (*pFrameInfo->bssId)[ 0 ], (*pFrameInfo->bssId)[ 1 ], (*pFrameInfo->bssId)[ 2 ], (*pFrameInfo->bssId)[ 3 ], (*pFrameInfo->bssId)[ 4 ], (*pFrameInfo->bssId)[ 5 ]); + TRACE6(pSme->hReport, REPORT_SEVERITY_ERROR , "sme_ScanResultCB: unable to update specific entry for BSSID %02x:%02x:%02x:%02x:%02x:%02x\n", (*pFrameInfo->bssId)[ 0 ], (*pFrameInfo->bssId)[ 1 ], (*pFrameInfo->bssId)[ 2 ], (*pFrameInfo->bssId)[ 3 ], (*pFrameInfo->bssId)[ 4 ], (*pFrameInfo->bssId)[ 5 ]); } } } else { - if (TI_OK != scanResultTable_UpdateEntry (pSme->hScanResultTable, pFrameInfo->bssId, pFrameInfo)) { - TRACE6(pSme->hReport, REPORT_SEVERITY_ERROR , "sme_ScanResultCB: unable to update enrty for BSSID %02x:%02x:%02x:%02x:%02x:%02x because table is full\n", (*pFrameInfo->bssId)[ 0 ], (*pFrameInfo->bssId)[ 1 ], (*pFrameInfo->bssId)[ 2 ], (*pFrameInfo->bssId)[ 3 ], (*pFrameInfo->bssId)[ 4 ], (*pFrameInfo->bssId)[ 5 ]); + TRACE6(pSme->hReport, REPORT_SEVERITY_ERROR , "sme_ScanResultCB: unable to update entry for BSSID %02x:%02x:%02x:%02x:%02x:%02x because table is full\n", (*pFrameInfo->bssId)[ 0 ], (*pFrameInfo->bssId)[ 1 ], (*pFrameInfo->bssId)[ 2 ], (*pFrameInfo->bssId)[ 3 ], (*pFrameInfo->bssId)[ 4 ], (*pFrameInfo->bssId)[ 5 ]); } } } @@ -599,7 +604,7 @@ void sme_ScanResultCB (TI_HANDLE hSme, EScanCncnResultStatus eStatus, { if (TI_OK != scanResultTable_UpdateEntry (pSme->hScanResultTable, pFrameInfo->bssId, pFrameInfo)) { - TRACE6(pSme->hReport, REPORT_SEVERITY_ERROR , "sme_ScanResultCB: unable to update application scan enrty for BSSID %02x:%02x:%02x:%02x:%02x:%02x\n", (*pFrameInfo->bssId)[ 0 ], (*pFrameInfo->bssId)[ 1 ], (*pFrameInfo->bssId)[ 2 ], (*pFrameInfo->bssId)[ 3 ], (*pFrameInfo->bssId)[ 4 ], (*pFrameInfo->bssId)[ 5 ]); + TRACE6(pSme->hReport, REPORT_SEVERITY_ERROR , "sme_ScanResultCB: unable to update application scan entry for BSSID %02x:%02x:%02x:%02x:%02x:%02x\n", (*pFrameInfo->bssId)[ 0 ], (*pFrameInfo->bssId)[ 1 ], (*pFrameInfo->bssId)[ 2 ], (*pFrameInfo->bssId)[ 3 ], (*pFrameInfo->bssId)[ 4 ], (*pFrameInfo->bssId)[ 5 ]); } } break; @@ -735,7 +740,7 @@ void sme_AppScanResult (TI_HANDLE hSme, EScanCncnResultStatus eStatus, if (TI_OK != scanResultTable_UpdateEntry (pSme->hScanResultTable, pFrameInfo->bssId, pFrameInfo)) { - TRACE6(pSme->hReport, REPORT_SEVERITY_ERROR , "sme_AppScanResult: unable to update enrty for BSSID %02x:%02x:%02x:%02x:%02x:%02x because table is full\n", (*pFrameInfo->bssId)[ 0 ], (*pFrameInfo->bssId)[ 1 ], (*pFrameInfo->bssId)[ 2 ], (*pFrameInfo->bssId)[ 3 ], (*pFrameInfo->bssId)[ 4 ], (*pFrameInfo->bssId)[ 5 ]); + TRACE6(pSme->hReport, REPORT_SEVERITY_ERROR , "sme_AppScanResult: unable to update entry for BSSID %02x:%02x:%02x:%02x:%02x:%02x because table is full\n", (*pFrameInfo->bssId)[ 0 ], (*pFrameInfo->bssId)[ 1 ], (*pFrameInfo->bssId)[ 2 ], (*pFrameInfo->bssId)[ 3 ], (*pFrameInfo->bssId)[ 4 ], (*pFrameInfo->bssId)[ 5 ]); } break; @@ -783,7 +788,7 @@ void sme_MeansurementScanResult (TI_HANDLE hSme, EScanCncnResultStatus eStatus, if (TI_OK != scanResultTable_UpdateEntry (pSme->hScanResultTable, pFrameInfo->bssId, pFrameInfo)) { - TRACE6(pSme->hReport, REPORT_SEVERITY_ERROR , "sme_MeansurementScanResult: unable to update enrty for BSSID %02x:%02x:%02x:%02x:%02x:%02x because table is full\n", (*pFrameInfo->bssId)[ 0 ], (*pFrameInfo->bssId)[ 1 ], (*pFrameInfo->bssId)[ 2 ], (*pFrameInfo->bssId)[ 3 ], (*pFrameInfo->bssId)[ 4 ], (*pFrameInfo->bssId)[ 5 ]); + TRACE6(pSme->hReport, REPORT_SEVERITY_ERROR , "sme_MeansurementScanResult: unable to update entry for BSSID %02x:%02x:%02x:%02x:%02x:%02x because table is full\n", (*pFrameInfo->bssId)[ 0 ], (*pFrameInfo->bssId)[ 1 ], (*pFrameInfo->bssId)[ 2 ], (*pFrameInfo->bssId)[ 3 ], (*pFrameInfo->bssId)[ 4 ], (*pFrameInfo->bssId)[ 5 ]); } break; @@ -990,4 +995,3 @@ void SME_Disconnect (TI_HANDLE hSme) /* now send a disconnect event */ genSM_Event (pSme->hSmeSm, SME_SM_EVENT_DISCONNECT, hSme); } - diff --git a/wl1271/stad/src/Connection_Managment/smeSelect.c b/wl1271/stad/src/Connection_Managment/smeSelect.c index 55f6d2ed..74758890 100644 --- a/wl1271/stad/src/Connection_Managment/smeSelect.c +++ b/wl1271/stad/src/Connection_Managment/smeSelect.c @@ -81,7 +81,7 @@ TSiteEntry *sme_Select (TI_HANDLE hSme) /* on SG avalanche, select is not needed, send connect event automatically */ if (TI_TRUE == pSme->bReselect) - { + { paramInfo_t *pParam; TRACE0(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_Select: reselect flag is on, reselecting the current site\n"); @@ -100,7 +100,6 @@ TSiteEntry *sme_Select (TI_HANDLE hSme) pCurrentSite = pParam->content.pPrimarySite; os_memoryFree(pSme->hOS, pParam, sizeof(paramInfo_t)); return pCurrentSite; - } /* get the first site from the scan result table */ diff --git a/wl1271/stad/src/Connection_Managment/smeSm.c b/wl1271/stad/src/Connection_Managment/smeSm.c index 2f32bd71..dc673fe9 100644 --- a/wl1271/stad/src/Connection_Managment/smeSm.c +++ b/wl1271/stad/src/Connection_Managment/smeSm.c @@ -244,7 +244,6 @@ void smeSm_PreConnect (TI_HANDLE hSme) TSme *pSme = (TSme *)hSme; paramInfo_t *pParam; - /* set the connection mode with which this connection attempt is starting */ pSme->eLastConnectMode = pSme->eConnectMode; @@ -285,16 +284,17 @@ void smeSm_PreConnect (TI_HANDLE hSme) { /* makr whether we need to stop the attempt connection in manual mode */ pSme->bConnectRequired = TI_FALSE; - - TRACE0(pSme->hReport, REPORT_SEVERITY_INFORMATION , "smeSm_PreConnect: No candidate available, sending connect failure\n"); + + TRACE0(pSme->hReport, REPORT_SEVERITY_INFORMATION , "smeSm_PreConnect: No candidate available, sending connect failure\n"); /* manual mode and no connection candidate is available - connection failed */ genSM_Event (pSme->hSmeSm, SME_SM_EVENT_CONNECT_FAILURE, hSme); } else /* IBSS */ { - TI_UINT8 uDesiredChannel; + TI_UINT8 uDesiredChannel; TI_BOOL channelValidity; + pSme->bConnectRequired = TI_FALSE; pParam = (paramInfo_t *)os_memoryAlloc(pSme->hOS, sizeof(paramInfo_t)); @@ -324,7 +324,7 @@ void smeSm_PreConnect (TI_HANDLE hSme) pParam->content.channelCapabilityReq.scanOption = ACTIVE_SCANNING; pParam->content.channelCapabilityReq.channelNum = uDesiredChannel; - regulatoryDomain_getParam (pSme->hRegDomain,pParam); + regulatoryDomain_getParam (pSme->hRegDomain, pParam); channelValidity = pParam->content.channelCapabilityRet.channelValidity; os_memoryFree(pSme->hOS, pParam, sizeof(paramInfo_t)); if (!channelValidity) @@ -370,7 +370,7 @@ void smeSm_PreConnect (TI_HANDLE hSme) */ void smeSm_Connect (TI_HANDLE hSme) { - TSme *pSme = (TSme*)hSme; + TSme *pSme = (TSme*)hSme; TI_STATUS tStatus; paramInfo_t *pParam; @@ -406,8 +406,8 @@ void smeSm_Connect (TI_HANDLE hSme) pParam->content.connType = CONNECTION_IBSS; } else - pParam->content.connType = CONNECTION_INFRA; - conn_setParam(pSme->hConn, pParam); + pParam->content.connType = CONNECTION_INFRA; + conn_setParam(pSme->hConn, pParam); os_memoryFree(pSme->hOS, pParam, sizeof(paramInfo_t)); /* start the connection process */ diff --git a/wl1271/stad/src/Ctrl_Interface/CmdHndlr.c b/wl1271/stad/src/Ctrl_Interface/CmdHndlr.c index 91e858e1..6966645f 100644 --- a/wl1271/stad/src/Ctrl_Interface/CmdHndlr.c +++ b/wl1271/stad/src/Ctrl_Interface/CmdHndlr.c @@ -155,19 +155,16 @@ void cmdHndlr_ClearQueue (TI_HANDLE hCmdHndlr) TCmdHndlrObj *pCmdHndlr = (TCmdHndlrObj *)hCmdHndlr; TConfigCommand *pCurrCmd; - /* Dequeue and free all queued commands in a critical section */ - while (1) - { + /* Dequeue and free all queued commands */ + do { context_EnterCriticalSection (pCmdHndlr->hContext); pCurrCmd = (TConfigCommand *)que_Dequeue(pCmdHndlr->hCmdQueue); context_LeaveCriticalSection (pCmdHndlr->hContext); - if (pCurrCmd == NULL) - { - break; + if (pCurrCmd != NULL) { + /* Just release the semaphore. The command is freed subsequently. */ + os_SignalObjectSet (pCmdHndlr->hOs, pCurrCmd->pSignalObject); } - /* Just release the semaphore. The command is freed subsequently. */ - os_SignalObjectSet (pCmdHndlr->hOs, pCurrCmd->pSignalObject); - } + } while (pCurrCmd != NULL); } @@ -278,14 +275,14 @@ TI_STATUS cmdHndlr_InsertCommand (TI_HANDLE hCmdHndlr, /* Enter critical section to protect queue access */ context_EnterCriticalSection (pCmdHndlr->hContext); - /* Enqueue the command (if failed, release memory and return NOK) */ + /* Enqueue the command (if failed, release memory and return NOK) */ eStatus = que_Enqueue (pCmdHndlr->hCmdQueue, (TI_HANDLE)pNewCmd); if (eStatus != TI_OK) - { - os_printf("cmdPerform: Failed to enqueue new command\n"); - os_SignalObjectFree (pCmdHndlr->hOs, pNewCmd->pSignalObject); - os_memoryFree (pCmdHndlr->hOs, pNewCmd, sizeof (TConfigCommand)); + { context_LeaveCriticalSection (pCmdHndlr->hContext); /* Leave critical section */ + os_printf("cmdPerform: Failed to enqueue new command\n"); + os_SignalObjectFree (pCmdHndlr->hOs, pNewCmd->pSignalObject); + os_memoryFree (pCmdHndlr->hOs, pNewCmd, sizeof (TConfigCommand)); return TI_NOK; } diff --git a/wl1271/stad/src/Ctrl_Interface/DrvMain.c b/wl1271/stad/src/Ctrl_Interface/DrvMain.c index c13b39a3..6dc69a69 100644 --- a/wl1271/stad/src/Ctrl_Interface/DrvMain.c +++ b/wl1271/stad/src/Ctrl_Interface/DrvMain.c @@ -546,7 +546,6 @@ TI_STATUS drvMain_Create (TI_HANDLE hOs, return TI_OK; } - /* * \fn drvMain_Destroy * \brief Destroy driver @@ -654,10 +653,6 @@ TI_STATUS drvMain_Destroy (TI_HANDLE hDrvMain) scr_release (pDrvMain->tStadHandles.hSCR); } - if (pDrvMain->tStadHandles.hEvHandler != NULL) - { - EvHandlerUnload (pDrvMain->tStadHandles.hEvHandler); - } if (pDrvMain->tStadHandles.hRsn != NULL) { @@ -726,37 +721,37 @@ TI_STATUS drvMain_Destroy (TI_HANDLE hDrvMain) cmdHndlr_Destroy (pDrvMain->tStadHandles.hCmdHndlr, pDrvMain->tStadHandles.hEvHandler); } - if (pDrvMain->tStadHandles.hCmdDispatch) + if (pDrvMain->tStadHandles.hEvHandler != NULL) { - cmdDispatch_Destroy (pDrvMain->tStadHandles.hCmdDispatch); + EvHandlerUnload (pDrvMain->tStadHandles.hEvHandler); } - if (pDrvMain->tStadHandles.hStaCap != NULL) + if (pDrvMain->tStadHandles.hCmdDispatch) { - StaCap_Destroy (pDrvMain->tStadHandles.hStaCap); + cmdDispatch_Destroy (pDrvMain->tStadHandles.hCmdDispatch); } if (pDrvMain->tStadHandles.hTxnQ != NULL) { txnQ_Destroy (pDrvMain->tStadHandles.hTxnQ); } - - /* - * Note: The Timer module must be destroyed here, after all created timers are already destroyed!! - * Also, the context module must be destroyed after that because its services are used in other - * modules destroy function (including the tmr_Destroy function), and then the report module. - */ - + /* Note: The Timer module must be destroyed last, so all created timers are already destroyed!! */ if (pDrvMain->tStadHandles.hTimer != NULL) { tmr_Destroy (pDrvMain->tStadHandles.hTimer); } + /* Note: Moved after timers for locks */ if (pDrvMain->tStadHandles.hContext != NULL) { context_Destroy (pDrvMain->tStadHandles.hContext); } + if (pDrvMain->tStadHandles.hStaCap != NULL) + { + StaCap_Destroy (pDrvMain->tStadHandles.hStaCap); + } + if (pDrvMain->tStadHandles.hReport != NULL) { report_Unload (pDrvMain->tStadHandles.hReport); @@ -1053,7 +1048,7 @@ static void drvMain_InitLocals (TDrvMain *pDrvMain) sizeof("ACTION")); /* Platform specific HW preparations */ - hPlatform_Wlan_Hardware_Init (); + hPlatform_Wlan_Hardware_Init(pDrvMain->tStadHandles.hOs); /* Insure that device power is off (expected to be) */ hPlatform_DevicePowerOff (); @@ -1127,14 +1122,14 @@ static TI_STATUS drvMain_ConfigFw (TI_HANDLE hDrvMain) TRACE0(pDrvMain->tStadHandles.hReport, REPORT_SEVERITY_INIT , "EXIT FROM INIT\n"); /* Print the driver and firmware version and the mac address */ - WLAN_OS_REPORT(("\n")); - WLAN_OS_REPORT(("--------------------------------------------------------------------\n")); - WLAN_OS_REPORT(("Driver Version : %s\n", SW_VERSION_STR)); - WLAN_OS_REPORT(("Firmware Version: %s\n", pFwInfo->fwVer)); - WLAN_OS_REPORT(("Station ID : %02X-%02X-%02X-%02X-%02X-%02X\n", - pMacAddr[0], pMacAddr[1], pMacAddr[2], pMacAddr[3], pMacAddr[4], pMacAddr[5])); - WLAN_OS_REPORT(("--------------------------------------------------------------------\n")); - WLAN_OS_REPORT(("\n")); + os_printf("\n"); + os_printf("-----------------------------------------------------\n"); + os_printf("Driver Version : %s\n", SW_VERSION_STR); + os_printf("Firmware Version: %s\n", pFwInfo->fwVer); + os_printf("Station ID : %02X-%02X-%02X-%02X-%02X-%02X\n", + pMacAddr[0], pMacAddr[1], pMacAddr[2], pMacAddr[3], pMacAddr[4], pMacAddr[5]); + os_printf("-----------------------------------------------------\n"); + os_printf("\n"); return TI_OK; } @@ -1227,15 +1222,18 @@ TI_STATUS drvMain_InsertAction (TI_HANDLE hDrvMain, EActionType eAction) { TDrvMain *pDrvMain = (TDrvMain *) hDrvMain; + context_EnterCriticalSection(pDrvMain->tStadHandles.hContext); if (pDrvMain->eAction == eAction) - { + { + context_LeaveCriticalSection(pDrvMain->tStadHandles.hContext); TRACE0(pDrvMain->tStadHandles.hReport, REPORT_SEVERITY_CONSOLE, "Action is identical to last action!\n"); - WLAN_OS_REPORT(("Action is identical to last action!\n")); + WLAN_OS_REPORT(("Action %d is identical to last action!\n", eAction)); return TI_NOK; } /* Save the requested action */ pDrvMain->eAction = eAction; + context_LeaveCriticalSection(pDrvMain->tStadHandles.hContext); /* Create signal object */ /* @@ -1260,6 +1258,7 @@ TI_STATUS drvMain_InsertAction (TI_HANDLE hDrvMain, EActionType eAction) /* Free signalling object */ os_SignalObjectFree (pDrvMain->tStadHandles.hOs, pDrvMain->hSignalObj); + pDrvMain->hSignalObj = NULL; if (pDrvMain->eSmState == SM_STATE_FAILED) return TI_NOK; @@ -1286,7 +1285,11 @@ TI_STATUS drvMain_Recovery (TI_HANDLE hDrvMain) if (!pDrvMain->bRecovery) { TRACE1(pDrvMain->tStadHandles.hReport, REPORT_SEVERITY_CONSOLE,".....drvMain_Recovery, ts=%d\n", os_timeStampMs(pDrvMain->tStadHandles.hOs)); +#ifdef REPORT_LOG WLAN_OS_REPORT((".....drvMain_Recovery, ts=%d\n", os_timeStampMs(pDrvMain->tStadHandles.hOs))); +#else + printk("%s\n",__func__); +#endif pDrvMain->bRecovery = TI_TRUE; drvMain_SmEvent (hDrvMain, SM_EVENT_RECOVERY); return TI_OK; @@ -1501,9 +1504,9 @@ static void drvMain_Sm (TI_HANDLE hDrvMain, ESmEvent eEvent) { WLAN_OS_REPORT(("SDBus Connect Failed, Set Object Event !!\r\n")); TRACE0(pDrvMain->tStadHandles.hReport, REPORT_SEVERITY_ERROR , "SDBus Connect Failed, Set Object Event !!\r\n"); - if (!pDrvMain->bRecovery) + if (!pDrvMain->bRecovery) { - os_SignalObjectSet (hOs, pDrvMain->hSignalObj); + os_SignalObjectSet(hOs, pDrvMain->hSignalObj); } } else /* SDBus Connect success */ @@ -1520,11 +1523,11 @@ static void drvMain_Sm (TI_HANDLE hDrvMain, ESmEvent eEvent) } break; case SM_STATE_HW_INIT: - /* + /* * HW-Init process is completed. * Request for the FW image file. */ - if (eEvent == SM_EVENT_HW_INIT_COMPLETE) + if (eEvent == SM_EVENT_HW_INIT_COMPLETE) { pDrvMain->tFileInfo.eFileType = FILE_TYPE_FW; pDrvMain->eSmState = SM_STATE_DOWNLOAD_FW_FILE; @@ -1532,7 +1535,7 @@ static void drvMain_Sm (TI_HANDLE hDrvMain, ESmEvent eEvent) } break; case SM_STATE_DOWNLOAD_FW_FILE: - if (eEvent == SM_EVENT_FW_FILE_READY) + if (eEvent == SM_EVENT_FW_FILE_READY) { pDrvMain->tFileInfo.eFileType = FILE_TYPE_FW_NEXT; if (pDrvMain->tFileInfo.bLast == TI_TRUE) @@ -1551,14 +1554,14 @@ static void drvMain_Sm (TI_HANDLE hDrvMain, ESmEvent eEvent) } break; case SM_STATE_WAIT_FW_FILE: - if (eEvent == SM_EVENT_FW_INIT_COMPLETE) + if (eEvent == SM_EVENT_FW_INIT_COMPLETE) { pDrvMain->eSmState = SM_STATE_DOWNLOAD_FW_FILE; eStatus = wlanDrvIf_GetFile (hOs, &pDrvMain->tFileInfo); } break; case SM_STATE_FW_INIT: - /* + /* * FW-Init process is completed. * Free the semaphore of the START action to enable the OS interface. * Enable interrupts (or polling for debug). @@ -1567,13 +1570,9 @@ static void drvMain_Sm (TI_HANDLE hDrvMain, ESmEvent eEvent) * Note that in some OSs, the semaphore must be released in order to enable the * interrupts, and the interrupts are needed for the configuration process! */ - if (eEvent == SM_EVENT_FW_INIT_COMPLETE) + if (eEvent == SM_EVENT_FW_INIT_COMPLETE) { pDrvMain->eSmState = SM_STATE_FW_CONFIG; - if (!pDrvMain->bRecovery) - { - os_SignalObjectSet (hOs, pDrvMain->hSignalObj); - } TWD_EnableInterrupts(pDrvMain->tStadHandles.hTWD); #ifdef PRIODIC_INTERRUPT /* Start periodic interrupts. It means that every period of time the FwEvent SM will be called */ @@ -1583,7 +1582,7 @@ static void drvMain_Sm (TI_HANDLE hDrvMain, ESmEvent eEvent) } break; case SM_STATE_FW_CONFIG: - /* + /* * FW-configuration process is completed. * Stop watchdog timer. * For recovery, notify the relevant STAD modules. @@ -1613,6 +1612,10 @@ static void drvMain_Sm (TI_HANDLE hDrvMain, ESmEvent eEvent) eStatus = TI_OK; } + if (!pDrvMain->bRecovery) + { + os_SignalObjectSet(hOs, pDrvMain->hSignalObj); + } break; case SM_STATE_OPERATIONAL: /* @@ -1713,9 +1716,9 @@ static void drvMain_Sm (TI_HANDLE hDrvMain, ESmEvent eEvent) hPlatform_DevicePowerOff (); WLAN_OS_REPORT(("[WLAN] Exit application\n")); if (!pDrvMain->bRecovery) - { + { os_SignalObjectSet (hOs, pDrvMain->hSignalObj); - } + } break; case SM_STATE_FAILED: /* Nothing to do except waiting for Destroy */ @@ -1744,6 +1747,3 @@ static void drvMain_Sm (TI_HANDLE hDrvMain, ESmEvent eEvent) eStatus = drvMain_StopActivities (pDrvMain); } } - - - diff --git a/wl1271/stad/src/Ctrl_Interface/EvHandler.c b/wl1271/stad/src/Ctrl_Interface/EvHandler.c index b76b6826..99205b4b 100644 --- a/wl1271/stad/src/Ctrl_Interface/EvHandler.c +++ b/wl1271/stad/src/Ctrl_Interface/EvHandler.c @@ -63,7 +63,7 @@ TI_HANDLE EvHandler_Create (TI_HANDLE hOs) #endif pEvHandler->hOs = hOs; - + pEvHandler->LastUMEventType = 0xFFFFFFFF; return (TI_HANDLE) pEvHandler; @@ -72,22 +72,22 @@ TI_HANDLE EvHandler_Create (TI_HANDLE hOs) TI_UINT32 EvHandlerUnload (TI_HANDLE hEvHandler) { - TEvHandlerObj *pEvHandler; + TEvHandlerObj *pEvHandler; PRINT(DBG_INIT_LOUD, (" ev_handler_unLoad\n")); pEvHandler = (TEvHandlerObj *)hEvHandler; os_memoryFree(pEvHandler->hOs,pEvHandler,sizeof(TEvHandlerObj)); - return TI_OK; + return TI_OK; } TI_UINT32 EvHandlerRegisterEvent(TI_HANDLE hEvHandler, TI_UINT8* pData, TI_UINT32 Length) { TEvHandlerObj *pEvHandler; - IPC_EVENT_PARAMS* pEvParams; - TI_UINT32 ModuleIndex; + IPC_EVENT_PARAMS *pEvParams; + TI_UINT32 ModuleIndex; if( (hEvHandler==NULL) || (pData == NULL)){ PRINT(DBG_INIT_ERROR, "EvHandler:EvHandlerRegisterEvent Bad Handle passed \n"); @@ -102,22 +102,20 @@ TI_UINT32 EvHandlerRegisterEvent(TI_HANDLE hEvHandler, TI_UINT8* pData, TI_UINT3 #endif pEvHandler = (TEvHandlerObj *)hEvHandler; + pEvParams = (IPC_EVENT_PARAMS *)pData; - pEvParams = (IPC_EVENT_PARAMS*)pData; - - PRINTF(DBG_INIT_LOUD, (" EvHandlerRegisterEvent EventType = %d \n",pEvParams->uEventType)); - /* used to be: if ( sizeof(IPC_EVENT_PARAMS) != Length) + /* used to be: if ( sizeof(IPC_EVENT_PARAMS) != Length) relaxed size checking (okay if output buffer is larger) */ - if ( sizeof(IPC_EVENT_PARAMS) > Length) + if (sizeof(IPC_EVENT_PARAMS) > Length) { PRINTF(DBG_INIT_ERROR, (" EvHandlerRegisterEvent Error sizeof(IPC_EVENT_PARAMS) != Length," "%d != %d \n",sizeof(IPC_EVENT_PARAMS), (int)Length)); return (TI_UINT32)STATUS_INVALID_PARAMETER; } - if( pEvParams->uEventType >= IPC_EVENT_MAX){ + if (pEvParams->uEventType >= IPC_EVENT_MAX){ PRINTF(DBG_INIT_ERROR, (" EvHandlerRegisterEvent Error - Invalid Event Type = %d \n", pEvParams->uEventType)); return (TI_UINT32)STATUS_INVALID_PARAMETER; @@ -125,19 +123,18 @@ TI_UINT32 EvHandlerRegisterEvent(TI_HANDLE hEvHandler, TI_UINT8* pData, TI_UINT3 ModuleIndex = 0; - while ( (pEvHandler->RegistrationArray[pEvParams->uEventType][ModuleIndex].uEventID != NULL ) - && ( ModuleIndex < MAX_REGISTERED_MODULES) ) + while ((ModuleIndex < MAX_REGISTERED_MODULES) && + (pEvHandler->RegistrationArray[pEvParams->uEventType][ModuleIndex].uEventID != NULL)) { - ModuleIndex++; + ModuleIndex++; } - if(ModuleIndex == MAX_REGISTERED_MODULES) + if (ModuleIndex == MAX_REGISTERED_MODULES) { - PRINTF(DBG_INIT_WARNING, (" EvHandlerRegisterEvent %d" - "Registration queue full or event already registered!\n", - pEvParams->uEventType)); - - return (TI_UINT32)STATUS_INVALID_PARAMETER; + PRINTF(DBG_INIT_WARNING, (" EvHandlerRegisterEvent %d " + "Registration queue full or event already registered!\n", + pEvParams->uEventType)); + return (TI_UINT32)STATUS_INVALID_PARAMETER; } os_memoryCopy(pEvHandler->hOs,(TI_UINT8*)&pEvHandler->RegistrationArray[pEvParams->uEventType][ModuleIndex], @@ -148,7 +145,6 @@ TI_UINT32 EvHandlerRegisterEvent(TI_HANDLE hEvHandler, TI_UINT8* pData, TI_UINT3 pEvHandler->RegistrationArray[pEvParams->uEventType][ModuleIndex].uEventID = pEvParams->uEventID; PRINT(DBG_INIT_LOUD, " EvHandlerRegisterEvent Out \n"); - return STATUS_SUCCESS; } @@ -157,24 +153,23 @@ TI_UINT32 EvHandlerRegisterEvent(TI_HANDLE hEvHandler, TI_UINT8* pData, TI_UINT3 TI_UINT32 EvHandlerUnRegisterEvent(TI_HANDLE hEvHandler, TI_HANDLE uEventID) { TEvHandlerObj *pEvHandler; - IPC_EVENT_PARAMS* pEvParams; - TI_UINT32 ModuleIndex; + IPC_EVENT_PARAMS *pEvParams; + TI_UINT32 ModuleIndex; - #ifdef EV_HANDLER_DEBUG - if (ghEvHandler != hEvHandler ) +#ifdef EV_HANDLER_DEBUG + if (ghEvHandler != hEvHandler ) { return TI_NOK; } - #endif +#endif - if (uEventID == NULL) + if (uEventID == NULL) { return TI_NOK; } pEvHandler = (TEvHandlerObj *)hEvHandler; - pEvParams = (IPC_EVENT_PARAMS*)uEventID; - + pEvParams = (IPC_EVENT_PARAMS *)uEventID; PRINTF(DBG_INIT_LOUD, (" EvHandlerUnRegisterEvent EventType = %d \n",pEvParams->uEventType)); @@ -186,21 +181,19 @@ TI_UINT32 EvHandlerUnRegisterEvent(TI_HANDLE hEvHandler, TI_HANDLE uEventID) ModuleIndex = 0; - while ( (pEvHandler->RegistrationArray[pEvParams->uEventType][ModuleIndex].uEventID != pEvParams->uEventID ) - && ( ModuleIndex < MAX_REGISTERED_MODULES) ) + while ((ModuleIndex < MAX_REGISTERED_MODULES) && + (pEvHandler->RegistrationArray[pEvParams->uEventType][ModuleIndex].uEventID != pEvParams->uEventID)) { - ModuleIndex++; + ModuleIndex++; } - if(ModuleIndex == MAX_REGISTERED_MODULES) + if (ModuleIndex == MAX_REGISTERED_MODULES) { - PRINTF(DBG_INIT_ERROR, (" EvHandlerUnRegisterEvent %d" + PRINTF(DBG_INIT_ERROR, (" EvHandlerUnRegisterEvent %d " "Registration queue doesn't hold this event!\n", pEvParams->uEventType )); - - return (TI_UINT32)STATUS_INVALID_PARAMETER; + return (TI_UINT32)STATUS_INVALID_PARAMETER; } - pEvHandler->RegistrationArray[pEvParams->uEventType][ModuleIndex].uEventID = NULL; return STATUS_SUCCESS; @@ -240,7 +233,7 @@ TI_UINT32 EvHandlerSendEvent(TI_HANDLE hEvHandler, TI_UINT32 EvType, TI_UINT8* p if (pEvHandler->RegistrationArray[EvType][ModuleIndex].uEventID != NULL ) { if(pEvHandler->SendEventArray.Counter == MAX_SEND_EVENTS) - { + { PRINT(DBG_INIT_ERROR, " EvHandlerSendEvent Array Full u Fool! \n"); return TI_NOK; } @@ -253,17 +246,17 @@ TI_UINT32 EvHandlerSendEvent(TI_HANDLE hEvHandler, TI_UINT32 EvType, TI_UINT8* p sizeof(IPC_EVENT_PARAMS)); os_memoryZero(pEvHandler->hOs,(TI_UINT8*)pNewEvent->uBuffer, sizeof(pNewEvent->uBuffer)); - - os_memoryCopy(pEvHandler->hOs, - (TI_UINT8*)pNewEvent->uBuffer, - (TI_UINT8*)pData, - Length); - + + os_memoryCopy(pEvHandler->hOs, + (TI_UINT8*)pNewEvent->uBuffer, + (TI_UINT8*)pData, + Length); + pNewEvent->uBufferSize = Length; - + if(pNewEvent->EvParams.uDeliveryType == DELIVERY_PUSH) { - PRINTF(DBG_INIT_LOUD, (" EvHandlerSendEvent %d to OS \n", EvType)); + PRINTF(DBG_INIT_LOUD, (" EvHandlerSendEvent %d to OS \n", EvType)); PRINTF(DBG_INIT_LOUD, ("EvHandlerSendEvent Matching OS Registered event found at EvType = %d," "ModuleIndex = %d \n", EvType, ModuleIndex)); IPC_EventSend (pEvHandler->hOs,(TI_UINT8*)pNewEvent,sizeof(IPC_EV_DATA)); @@ -281,10 +274,10 @@ TI_UINT32 EvHandlerSendEvent(TI_HANDLE hEvHandler, TI_UINT32 EvType, TI_UINT8* p { IPC_EventSend (pEvHandler->hOs,NULL,0); } - } + } } /* end if*/ - ModuleIndex++; + ModuleIndex++; } /* end of while*/ diff --git a/wl1271/stad/src/Data_link/Ctrl.c b/wl1271/stad/src/Data_link/Ctrl.c index 4ef843f0..876d6d22 100644 --- a/wl1271/stad/src/Data_link/Ctrl.c +++ b/wl1271/stad/src/Data_link/Ctrl.c @@ -994,17 +994,20 @@ static void ctrlData_TrafficThresholdCrossed(TI_HANDLE Context,TI_UINT32 Cookie) void ctrlData_printTxParameters(TI_HANDLE hCtrlData) { - ctrlData_t *pCtrlData = (ctrlData_t *)hCtrlData; +#ifdef REPORT_LOG + ctrlData_t *pCtrlData = (ctrlData_t *)hCtrlData; WLAN_OS_REPORT((" Tx Parameters \n")); WLAN_OS_REPORT(("-------------------------------------\n")); WLAN_OS_REPORT(("currentPreamble = %d\n\n",pCtrlData->ctrlDataCurrentPreambleType)); WLAN_OS_REPORT(("ctrlDataCurrentRateMask = 0x%X\n",pCtrlData->ctrlDataCurrentRateMask)); +#endif } void ctrlData_printCtrlBlock(TI_HANDLE hCtrlData) { +#ifdef REPORT_LOG ctrlData_t *pCtrlData = (ctrlData_t *)hCtrlData; TI_UINT32 i; @@ -1048,6 +1051,7 @@ void ctrlData_printCtrlBlock(TI_HANDLE hCtrlData) pCtrlData->ctrlDataTxRatePolicy.rateClass[i].longRetryLimit, pCtrlData->ctrlDataTxRatePolicy.rateClass[i].shortRetryLimit)); } +#endif } diff --git a/wl1271/stad/src/Data_link/rx.c b/wl1271/stad/src/Data_link/rx.c index 5257cbed..9b5a4ab0 100644 --- a/wl1271/stad/src/Data_link/rx.c +++ b/wl1271/stad/src/Data_link/rx.c @@ -39,27 +39,28 @@ /***************************************************************************/ #define __FILE_ID__ FILE_ID_54 #include "tidef.h" -#include "paramOut.h" +#include "paramOut.h" #include "rx.h" #include "osApi.h" #include "timer.h" #include "DataCtrl_Api.h" +#include "Ctrl.h" #include "802_11Defs.h" -#include "Ethernet.h" +#include "Ethernet.h" #include "report.h" #include "rate.h" #include "mlmeApi.h" #include "rsnApi.h" #include "smeApi.h" #include "siteMgrApi.h" -#include "GeneralUtil.h" +#include "GeneralUtil.h" #include "EvHandler.h" #ifdef XCC_MODULE_INCLUDED #include "XCCMngr.h" #endif #include "TWDriver.h" #include "RxBuf.h" -#include "DrvMainModules.h" +#include "DrvMainModules.h" #include "bmtrace_api.h" #include "PowerMgr_API.h" @@ -183,7 +184,7 @@ void rxData_init (TStadHandlesList *pStadHandles) pRxData->hEvHandler = pStadHandles->hEvHandler; pRxData->hTimer = pStadHandles->hTimer; pRxData->hPowerMgr = pStadHandles->hPowerMgr; - + pRxData->rxDataExcludeUnencrypted = DEF_EXCLUDE_UNENCYPTED; pRxData->rxDataExludeBroadcastUnencrypted = DEF_EXCLUDE_UNENCYPTED; pRxData->rxDataEapolDestination = DEF_EAPOL_DESTINATION; @@ -239,7 +240,7 @@ TI_STATUS rxData_SetDefaults (TI_HANDLE hRxData, rxDataInitParams_t * rxDataInit { rxData_t *pRxData = (rxData_t *)hRxData; int i; - + /* init rx data filters */ pRxData->filteringEnabled = rxDataInitParams->rxDataFiltersEnabled; pRxData->filteringDefaultAction = rxDataInitParams->rxDataFiltersDefaultAction; @@ -267,7 +268,7 @@ TI_STATUS rxData_SetDefaults (TI_HANDLE hRxData, rxDataInitParams_t * rxDataInit rxData_SetReAuthInProgress(pRxData, TI_FALSE); - #ifdef TI_DBG +#ifdef TI_DBG /* reset counters */ rxData_resetCounters(pRxData); rxData_resetDbgCounters(pRxData); @@ -280,7 +281,7 @@ TI_STATUS rxData_SetDefaults (TI_HANDLE hRxData, rxDataInitParams_t * rxDataInit return TI_NOK; } pRxData->rxThroughputTimerEnable = TI_FALSE; - #endif +#endif TRACE0(pRxData->hReport, REPORT_SEVERITY_INIT, ".....Rx Data configured successfully\n"); @@ -819,7 +820,6 @@ static TI_STATUS rxData_addRxDataFilter (TI_HANDLE hRxData, TRxDataFilterRequest lenFieldPatterns, fieldPatterns); - return TI_OK; } /*************************************************************************** @@ -966,7 +966,7 @@ void rxData_receivePacketFromWlan (TI_HANDLE hRxData, void *pBuffer, TRxAttr* pR /* distribute mgmt pBuffer to mlme */ if( mlmeParser_recv(pRxData->hMlme, pBuffer, pRxAttr) != TI_OK ) { - TRACE0(pRxData->hReport, REPORT_SEVERITY_ERROR, " rxData_receivePacketFromWlan() : MLME returned error \n"); + TRACE0(pRxData->hReport, REPORT_SEVERITY_WARNING, " rxData_receivePacketFromWlan() : MLME returned error \n"); } break; @@ -985,7 +985,7 @@ void rxData_receivePacketFromWlan (TI_HANDLE hRxData, void *pBuffer, TRxAttr* pR } default: - TRACE0(pRxData->hReport, REPORT_SEVERITY_ERROR, " rxData_receivePacketFromWlan(): Received unspecified packet type !!! \n"); + TRACE0(pRxData->hReport, REPORT_SEVERITY_WARNING, " rxData_receivePacketFromWlan(): Received unspecified packet type !!! \n"); RxBufFree(pRxData->hOs, pBuffer); break; } @@ -1176,10 +1176,8 @@ static void rxData_rcvPacketInOpenNotify (TI_HANDLE hRxData, void *pBuffer, TRxA { rxData_t *pRxData = (rxData_t *)hRxData; - TRACE0(pRxData->hReport, REPORT_SEVERITY_ERROR, " rxData_rcvPacketInOpenNotify: receiving data packet while in rx port status is open notify\n"); + TRACE0(pRxData->hReport, REPORT_SEVERITY_WARNING, " rxData_rcvPacketInOpenNotify: receiving data packet while in rx port status is open notify\n"); - TRACE0(pRxData->hReport, REPORT_SEVERITY_INFORMATION, "rxData_rcvPacketInOpenNotify: ERROR !!! receiving data packet while in rx port status is open notify\n"); - pRxData->rxDataDbgCounters.rcvUnicastFrameInOpenNotify++; /* free Buffer */ @@ -1232,10 +1230,8 @@ static void rxData_rcvPacketData(TI_HANDLE hRxData, void *pBuffer, TRxAttr* pRxA { rxData_t *pRxData = (rxData_t *)hRxData; TEthernetHeader *pEthernetHeader; - TI_UINT16 EventMask = 0; - - - TRACE0(pRxData->hReport, REPORT_SEVERITY_INFORMATION, " rxData_rcvPacketData() : Received DATA frame tranferred to OS\n"); + TI_UINT16 EventMask = 0; + TFwInfo *pFwInfo; TRACE0(pRxData->hReport, REPORT_SEVERITY_INFORMATION, " rxData_rcvPacketData() : Received DATA frame tranferred to OS\n"); @@ -1264,6 +1260,21 @@ static void rxData_rcvPacketData(TI_HANDLE hRxData, void *pBuffer, TRxAttr* pRxA RxBufFree(pRxData->hOs, pBuffer); return; } + + /* + * Discard multicast/broadcast frames that we sent ourselves. + * Per IEEE 802.11-2007 section 9.2.7: "STAs shall filter out + * broadcast/multicast messages that contain their address as + * the source address." + */ + pFwInfo = TWD_GetFWInfo (pRxData->hTWD); + if (MAC_EQUAL(pFwInfo->macAddress, pEthernetHeader->src)) + { + pRxData->rxDataDbgCounters.excludedFrameCounter++; + /* free Buffer */ + RxBufFree(pRxData->hOs, pBuffer); + return; + } } /* update traffic monitor parameters */ @@ -1357,7 +1368,6 @@ static void rxData_rcvPacketIapp(TI_HANDLE hRxData, void *pBuffer, TRxAttr* pRxA * * RETURNS: TI_OK/TI_NOK ***************************************************************************/ - static TI_STATUS rxData_convertWlanToEthHeader (TI_HANDLE hRxData, void *pBuffer, TI_UINT16 * etherType) { TEthernetHeader EthHeader; @@ -1369,6 +1379,7 @@ static TI_STATUS rxData_convertWlanToEthHeader (TI_HANDLE hRxData, void *pBuffer TI_UINT32 headerLength; TI_UINT8 createEtherIIHeader; rxData_t *pRxData = (rxData_t *)hRxData; + dataBuf = (TI_UINT8 *)RX_BUF_DATA(pBuffer); /* Setting the mac header len according to the received FrameControl field in the Mac Header */ @@ -1540,7 +1551,8 @@ static TI_STATUS rxData_ConvertAmsduToEthPackets (TI_HANDLE hRxData, void *pBuff lengthDelta = ETHERNET_HDR_LEN + uDataLen; /* copy the packet payload */ - os_memoryCopy (pRxData->hOs, + if (uDataLen > WLAN_SNAP_HDR_LEN) + os_memoryCopy (pRxData->hOs, (((TI_UINT8*)pEthHeader) + ETHERNET_HDR_LEN), ((TI_UINT8*)pMsduEthHeader) + ETHERNET_HDR_LEN + WLAN_SNAP_HDR_LEN, uDataLen - WLAN_SNAP_HDR_LEN); @@ -1726,9 +1738,8 @@ static void rxData_ReceivePacket (TI_HANDLE hRxData, RxAttr.band = ((pRxParams->flags & RX_DESC_BAND_MASK) == RX_DESC_BAND_A) ? RADIO_BAND_5_0_GHZ : RADIO_BAND_2_4_GHZ ; RxAttr.eScanTag = pRxParams->proccess_id_tag; - /* timestamp is 32 bit so do bytes copy to avoid exception in case the RxInfo is in 2 bytes offset */ - os_memoryCopy (pRxData->hOs, + os_memoryCopy (pRxData->hOs, (void *)&(RxAttr.TimeStamp), (void *)&(pRxParams->timestamp), sizeof(pRxParams->timestamp) ); @@ -1833,6 +1844,7 @@ void rxData_resetDbgCounters(TI_HANDLE hRxData) ***************************************************************************/ void rxData_printRxCounters (TI_HANDLE hRxData) { +#ifdef REPORT_LOG rxData_t *pRxData = (rxData_t *)hRxData; if (pRxData) @@ -1852,11 +1864,13 @@ void rxData_printRxCounters (TI_HANDLE hRxData) WLAN_OS_REPORT(("rxWrongBssIdCounter = %d\n", pRxData->rxDataDbgCounters.rxWrongBssIdCounter)); WLAN_OS_REPORT(("rcvUnicastFrameInOpenNotify = %d\n", pRxData->rxDataDbgCounters.rcvUnicastFrameInOpenNotify)); } +#endif } void rxData_printRxBlock(TI_HANDLE hRxData) { +#ifdef REPORT_LOG rxData_t *pRxData = (rxData_t *)hRxData; WLAN_OS_REPORT(("hCtrlData = 0x%X\n", pRxData->hCtrlData)); @@ -1876,6 +1890,7 @@ void rxData_printRxBlock(TI_HANDLE hRxData) WLAN_OS_REPORT(("rxDataPortStatus = %d\n", pRxData->rxDataPortStatus)); WLAN_OS_REPORT(("rxDataExcludeUnencrypted = %d\n", pRxData->rxDataExcludeUnencrypted)); WLAN_OS_REPORT(("rxDataEapolDestination = %d\n", pRxData->rxDataEapolDestination)); +#endif } diff --git a/wl1271/stad/src/Data_link/txCtrl.c b/wl1271/stad/src/Data_link/txCtrl.c index 25bef9ca..ae45342e 100644 --- a/wl1271/stad/src/Data_link/txCtrl.c +++ b/wl1271/stad/src/Data_link/txCtrl.c @@ -163,22 +163,22 @@ static inline void txCtrl_TranslateTimeToFw (txCtrl_t *pTxCtrl, TTxCtrlBlk *pPkt *************************************************************************/ TI_HANDLE txCtrl_Create (TI_HANDLE hOs) { - txCtrl_t *pTxCtrl; + txCtrl_t *pTxCtrl; - /* allocate Tx module control block */ - pTxCtrl = os_memoryAlloc(hOs, (sizeof(txCtrl_t))); + /* allocate Tx module control block */ + pTxCtrl = os_memoryAlloc(hOs, (sizeof(txCtrl_t))); - if (!pTxCtrl) - return NULL; + if (!pTxCtrl) + return NULL; - /* reset tx control object */ - os_memoryZero(hOs, pTxCtrl, (sizeof(txCtrl_t))); + /* reset tx control object */ + os_memoryZero(hOs, pTxCtrl, (sizeof(txCtrl_t))); - pTxCtrl->TxEventDistributor = DistributorMgr_Create(hOs, MAX_TX_NOTIF_REQ_ELMENTS); + pTxCtrl->TxEventDistributor = DistributorMgr_Create(hOs, MAX_TX_NOTIF_REQ_ELMENTS); - pTxCtrl->hOs = hOs; + pTxCtrl->hOs = hOs; - return pTxCtrl; + return pTxCtrl; } @@ -189,31 +189,31 @@ TI_HANDLE txCtrl_Create (TI_HANDLE hOs) ***************************************************************************/ void txCtrl_Init (TStadHandlesList *pStadHandles) { - txCtrl_t *pTxCtrl = (txCtrl_t *)(pStadHandles->hTxCtrl); + txCtrl_t *pTxCtrl = (txCtrl_t *)(pStadHandles->hTxCtrl); TI_UINT32 ac; - /* Save other modules handles */ + /* Save other modules handles */ pTxCtrl->hOs = pStadHandles->hOs; pTxCtrl->hReport = pStadHandles->hReport; pTxCtrl->hCtrlData = pStadHandles->hCtrlData; pTxCtrl->hTWD = pStadHandles->hTWD; - pTxCtrl->hTxDataQ = pStadHandles->hTxDataQ; - pTxCtrl->hTxMgmtQ = pStadHandles->hTxMgmtQ; - pTxCtrl->hEvHandler = pStadHandles->hEvHandler; + pTxCtrl->hTxDataQ = pStadHandles->hTxDataQ; + pTxCtrl->hTxMgmtQ = pStadHandles->hTxMgmtQ; + pTxCtrl->hEvHandler = pStadHandles->hEvHandler; pTxCtrl->hHealthMonitor = pStadHandles->hHealthMonitor; pTxCtrl->hTimer = pStadHandles->hTimer; - pTxCtrl->hStaCap = pStadHandles->hStaCap; - pTxCtrl->hXCCMngr = pStadHandles->hXCCMngr; - pTxCtrl->hQosMngr = pStadHandles->hQosMngr; + pTxCtrl->hStaCap = pStadHandles->hStaCap; + pTxCtrl->hXCCMngr = pStadHandles->hXCCMngr; + pTxCtrl->hQosMngr = pStadHandles->hQosMngr; pTxCtrl->hRxData = pStadHandles->hRxData; - /* Set Tx parameters to defaults */ - pTxCtrl->headerConverMode = HDR_CONVERT_NONE; - pTxCtrl->currentPrivacyInvokedMode = DEF_CURRENT_PRIVACY_MODE; - pTxCtrl->eapolEncryptionStatus = DEF_EAPOL_ENCRYPTION_STATUS; - pTxCtrl->encryptionFieldSize = 0; - pTxCtrl->currBssType = BSS_INFRASTRUCTURE; - pTxCtrl->busyAcBitmap = 0; + /* Set Tx parameters to defaults */ + pTxCtrl->headerConverMode = HDR_CONVERT_NONE; + pTxCtrl->currentPrivacyInvokedMode = DEF_CURRENT_PRIVACY_MODE; + pTxCtrl->eapolEncryptionStatus = DEF_EAPOL_ENCRYPTION_STATUS; + pTxCtrl->encryptionFieldSize = 0; + pTxCtrl->currBssType = BSS_INFRASTRUCTURE; + pTxCtrl->busyAcBitmap = 0; pTxCtrl->dbgPktSeqNum = 0; pTxCtrl->bCreditCalcTimerRunning = TI_FALSE; pTxCtrl->genericEthertype = ETHERTYPE_EAPOL; @@ -230,26 +230,26 @@ void txCtrl_Init (TStadHandlesList *pStadHandles) pTxCtrl->credit[ac] = 0; } - /* Reset counters */ - txCtrlParams_resetCounters (pStadHandles->hTxCtrl); + /* Reset counters */ + txCtrlParams_resetCounters (pStadHandles->hTxCtrl); #ifdef TI_DBG - txCtrlParams_resetDbgCounters (pStadHandles->hTxCtrl); + txCtrlParams_resetDbgCounters (pStadHandles->hTxCtrl); #endif - /* Register the Tx-Complete callback function. */ + /* Register the Tx-Complete callback function. */ TWD_RegisterCb (pTxCtrl->hTWD, - TWD_EVENT_TX_RESULT_SEND_PKT_COMPLETE, - (void*)txCtrl_TxCompleteCb, - pStadHandles->hTxCtrl); + TWD_EVENT_TX_RESULT_SEND_PKT_COMPLETE, + (void*)txCtrl_TxCompleteCb, + pStadHandles->hTxCtrl); /* Register the Update-Busy-Map callback function. */ TWD_RegisterCb (pTxCtrl->hTWD, - TWD_EVENT_TX_HW_QUEUE_UPDATE_BUSY_MAP, - (void *)txCtrl_UpdateBackpressure, - pStadHandles->hTxCtrl); + TWD_EVENT_TX_HW_QUEUE_UPDATE_BUSY_MAP, + (void *)txCtrl_UpdateBackpressure, + pStadHandles->hTxCtrl); - TRACE0(pTxCtrl->hReport, REPORT_SEVERITY_INIT, ".....Tx Data configured successfully\n"); + TRACE0(pTxCtrl->hReport, REPORT_SEVERITY_INIT, ".....Tx Data configured successfully\n"); } @@ -267,23 +267,23 @@ void txCtrl_Init (TStadHandlesList *pStadHandles) *************************************************************************/ TI_STATUS txCtrl_SetDefaults (TI_HANDLE hTxCtrl, txDataInitParams_t *txDataInitParams) { - txCtrl_t *pTxCtrl = (txCtrl_t *)hTxCtrl; + txCtrl_t *pTxCtrl = (txCtrl_t *)hTxCtrl; - pTxCtrl->creditCalculationTimeout = txDataInitParams->creditCalculationTimeout; + pTxCtrl->creditCalculationTimeout = txDataInitParams->creditCalculationTimeout; pTxCtrl->bCreditCalcTimerEnabled = txDataInitParams->bCreditCalcTimerEnabled; - /* Update queues mapping (AC/TID/Backpressure) after module init. */ + /* Update queues mapping (AC/TID/Backpressure) after module init. */ txCtrl_UpdateQueuesMapping (hTxCtrl); - /* allocate timer for credit calculation */ - pTxCtrl->hCreditTimer = tmr_CreateTimer (pTxCtrl->hTimer); + /* allocate timer for credit calculation */ + pTxCtrl->hCreditTimer = tmr_CreateTimer (pTxCtrl->hTimer); if (pTxCtrl->hCreditTimer == NULL) { - TRACE0(pTxCtrl->hReport, REPORT_SEVERITY_ERROR, "txCtrl_SetDefaults(): Failed to create hCreditTimer!\n"); + TRACE0(pTxCtrl->hReport, REPORT_SEVERITY_ERROR, "txCtrl_SetDefaults(): Failed to create hCreditTimer!\n"); return TI_NOK; } - return TI_OK; + return TI_OK; } diff --git a/wl1271/stad/src/Data_link/txCtrlParams.c b/wl1271/stad/src/Data_link/txCtrlParams.c index d71d8e68..cb9c1e4f 100644 --- a/wl1271/stad/src/Data_link/txCtrlParams.c +++ b/wl1271/stad/src/Data_link/txCtrlParams.c @@ -686,7 +686,8 @@ DESCRIPTION: Print module internal information. ************************************************************************/ void txCtrlParams_printInfo(TI_HANDLE hTxCtrl) { - txCtrl_t *pTxCtrl = (txCtrl_t *)hTxCtrl; +#ifdef REPORT_LOG + txCtrl_t *pTxCtrl = (txCtrl_t *)hTxCtrl; WLAN_OS_REPORT(("-------------- Tx-Ctrl Module Information --------------\n")); WLAN_OS_REPORT(("========================================================\n")); @@ -728,6 +729,7 @@ void txCtrlParams_printInfo(TI_HANDLE hTxCtrl) WLAN_OS_REPORT(("encryptionFieldSize = %d\n", pTxCtrl->encryptionFieldSize)); WLAN_OS_REPORT(("currBssType = %d\n", pTxCtrl->currBssType)); WLAN_OS_REPORT(("========================================================\n\n")); +#endif } @@ -738,7 +740,8 @@ DESCRIPTION: Print Tx statistics debug counters. ************************************************************************/ void txCtrlParams_printDebugCounters(TI_HANDLE hTxCtrl) { - txCtrl_t *pTxCtrl = (txCtrl_t *)hTxCtrl; +#ifdef REPORT_LOG + txCtrl_t *pTxCtrl = (txCtrl_t *)hTxCtrl; TI_UINT32 ac; WLAN_OS_REPORT(("-------------- Tx-Ctrl Statistics Per AC ---------------\n")); @@ -794,6 +797,7 @@ void txCtrlParams_printDebugCounters(TI_HANDLE hTxCtrl) pTxCtrl->dbgCounters.dbgNumPktsPending[0] + pTxCtrl->dbgCounters.dbgNumPktsPending[1] + pTxCtrl->dbgCounters.dbgNumPktsPending[2] + pTxCtrl->dbgCounters.dbgNumPktsPending[3])); WLAN_OS_REPORT(("========================================================\n\n")); +#endif } diff --git a/wl1271/stad/src/Data_link/txCtrlServ.c b/wl1271/stad/src/Data_link/txCtrlServ.c index 4020569c..0638eaaa 100644 --- a/wl1271/stad/src/Data_link/txCtrlServ.c +++ b/wl1271/stad/src/Data_link/txCtrlServ.c @@ -102,7 +102,6 @@ TI_STATUS txCtrlServ_buildNullFrame(TI_HANDLE hTxCtrl, TI_UINT8* pFrame, TI_UINT /* copy source mac address */ status = ctrlData_getParamBssid(pTxCtrl->hCtrlData, CTRL_DATA_MAC_ADDRESS, pHeader->address2); - if (status != TI_OK) { return TI_NOK; diff --git a/wl1271/stad/src/Data_link/txDataQueue.c b/wl1271/stad/src/Data_link/txDataQueue.c index cbedef61..127f8ca7 100644 --- a/wl1271/stad/src/Data_link/txDataQueue.c +++ b/wl1271/stad/src/Data_link/txDataQueue.c @@ -177,7 +177,6 @@ void txDataQ_Init (TStadHandlesList *pStadHandles) TI_TRUE, "TX_DATA", sizeof("TX_DATA")); - } @@ -284,17 +283,14 @@ void txDataQ_ClearQueues (TI_HANDLE hTxDataQ) /* Dequeue and free all queued packets */ for (uQueId = 0 ; uQueId < pTxDataQ->uNumQueues ; uQueId++) { - while (1) - { + do { context_EnterCriticalSection (pTxDataQ->hContext); - pPktCtrlBlk = (TTxCtrlBlk *) que_Dequeue (pTxDataQ->aQueues[uQueId]); + pPktCtrlBlk = (TTxCtrlBlk *) que_Dequeue(pTxDataQ->aQueues[uQueId]); context_LeaveCriticalSection (pTxDataQ->hContext); - if (pPktCtrlBlk == NULL) - { - break; + if (pPktCtrlBlk != NULL) { + txCtrl_FreePacket (pTxDataQ->hTxCtrl, pPktCtrlBlk, TI_NOK); } - txCtrl_FreePacket (pTxDataQ->hTxCtrl, pPktCtrlBlk, TI_NOK); - } + } while (pPktCtrlBlk != NULL); } } @@ -315,8 +311,6 @@ void txDataQ_ClearQueues (TI_HANDLE hTxDataQ) * \return TI_OK - if the packet was queued, TI_NOK - if the packet was dropped. * \sa txDataQ_Run */ - - TI_STATUS txDataQ_InsertPacket (TI_HANDLE hTxDataQ, TTxCtrlBlk *pPktCtrlBlk, TI_UINT8 uPacketDtag) { TTxDataQ *pTxDataQ = (TTxDataQ *)hTxDataQ; @@ -349,7 +343,7 @@ TI_STATUS txDataQ_InsertPacket (TI_HANDLE hTxDataQ, TTxCtrlBlk *pPktCtrlBlk, TI_ { #ifdef TI_DBG pTxDataQ->uClsfrMismatchCount++; - TRACE0(pTxDataQ->hReport, REPORT_SEVERITY_WARNING, "txDataQueue_xmit: No matching classifier found \n"); +TRACE0(pTxDataQ->hReport, REPORT_SEVERITY_WARNING, "txDataQueue_xmit: No matching classifier found \n"); #endif /* TI_DBG */ } @@ -592,35 +586,37 @@ void txDataQ_PrintModuleParams (TI_HANDLE hTxDataQ) */ void txDataQ_PrintQueueStatistics (TI_HANDLE hTxDataQ) { - TTxDataQ *pTxDataQ = (TTxDataQ *)hTxDataQ; - TI_UINT32 qIndex; +#ifdef REPORT_LOG + TTxDataQ *pTxDataQ = (TTxDataQ *)hTxDataQ; + TI_UINT32 qIndex; - WLAN_OS_REPORT(("-------------- txDataQueue_printStatistics -------\n\n")); + WLAN_OS_REPORT(("-------------- txDataQueue_printStatistics -------\n\n")); WLAN_OS_REPORT(("uClsfrMismatchCount = %d\n",pTxDataQ->uClsfrMismatchCount)); WLAN_OS_REPORT(("uTxSendPaceTimeoutsCount = %d\n",pTxDataQ->uTxSendPaceTimeoutsCount)); - WLAN_OS_REPORT(("-------------- Enqueue to queues -----------------\n")); + WLAN_OS_REPORT(("-------------- Enqueue to queues -----------------\n")); for(qIndex = 0; qIndex < MAX_NUM_OF_AC; qIndex++) WLAN_OS_REPORT(("Que[%d]: = %d\n",qIndex, pTxDataQ->aQueueCounters[qIndex].uEnqueuePacket)); - WLAN_OS_REPORT(("-------------- Dequeue from queues ---------------\n")); + WLAN_OS_REPORT(("-------------- Dequeue from queues ---------------\n")); for(qIndex = 0; qIndex < MAX_NUM_OF_AC; qIndex++) WLAN_OS_REPORT(("Que[%d]: = %d\n",qIndex, pTxDataQ->aQueueCounters[qIndex].uDequeuePacket)); - WLAN_OS_REPORT(("-------------- Requeue to queues -----------------\n")); + WLAN_OS_REPORT(("-------------- Requeue to queues -----------------\n")); for(qIndex = 0; qIndex < MAX_NUM_OF_AC; qIndex++) WLAN_OS_REPORT(("Que[%d]: = %d\n",qIndex, pTxDataQ->aQueueCounters[qIndex].uRequeuePacket)); - WLAN_OS_REPORT(("-------------- Sent to TxCtrl --------------------\n")); + WLAN_OS_REPORT(("-------------- Sent to TxCtrl --------------------\n")); for(qIndex = 0; qIndex < MAX_NUM_OF_AC; qIndex++) WLAN_OS_REPORT(("Que[%d]: = %d\n",qIndex, pTxDataQ->aQueueCounters[qIndex].uXmittedPacket)); - WLAN_OS_REPORT(("-------------- Dropped - Queue Full --------------\n")); + WLAN_OS_REPORT(("-------------- Dropped - Queue Full --------------\n")); for(qIndex = 0; qIndex < MAX_NUM_OF_AC; qIndex++) WLAN_OS_REPORT(("Que[%d]: = %d\n",qIndex, pTxDataQ->aQueueCounters[qIndex].uDroppedPacket)); - WLAN_OS_REPORT(("--------------------------------------------------\n\n")); + WLAN_OS_REPORT(("--------------------------------------------------\n\n")); +#endif } @@ -825,6 +821,3 @@ static void txDataQ_TxSendPaceTimeout (TI_HANDLE hTxDataQ, TI_BOOL bTwdInitOccur txDataQ_RunScheduler (hTxDataQ); } - - - diff --git a/wl1271/stad/src/Data_link/txDataQueue.h b/wl1271/stad/src/Data_link/txDataQueue.h index 8d42f1f4..4f93d021 100644 --- a/wl1271/stad/src/Data_link/txDataQueue.h +++ b/wl1271/stad/src/Data_link/txDataQueue.h @@ -101,8 +101,6 @@ typedef struct TI_UINT32 uClsfrMismatchCount; TI_UINT32 uTxSendPaceTimeoutsCount; - - } TTxDataQ; diff --git a/wl1271/stad/src/Data_link/txMgmtQueue.c b/wl1271/stad/src/Data_link/txMgmtQueue.c index fc8681a0..befc803f 100644 --- a/wl1271/stad/src/Data_link/txMgmtQueue.c +++ b/wl1271/stad/src/Data_link/txMgmtQueue.c @@ -278,8 +278,7 @@ TI_STATUS txMgmtQ_Destroy (TI_HANDLE hTxMgmtQ) { if (que_Destroy(pTxMgmtQ->aQueues[uQueId]) != TI_OK) { -TRACE1(pTxMgmtQ->hReport, REPORT_SEVERITY_ERROR, "txMgmtQueue_unLoad: fail to free Mgmt Queue number: %d\n",uQueId); - + TRACE1(pTxMgmtQ->hReport, REPORT_SEVERITY_ERROR, "txMgmtQueue_unLoad: fail to free Mgmt Queue number: %d\n",uQueId); eStatus = TI_NOK; } } @@ -311,17 +310,14 @@ void txMgmtQ_ClearQueues (TI_HANDLE hTxMgmtQ) /* Dequeue and free all queued packets */ for (uQueId = 0 ; uQueId < NUM_OF_MGMT_QUEUES ; uQueId++) { - while (1) - { + do { context_EnterCriticalSection (pTxMgmtQ->hContext); - pPktCtrlBlk = (TTxCtrlBlk *) que_Dequeue (pTxMgmtQ->aQueues[uQueId]); + pPktCtrlBlk = (TTxCtrlBlk *)que_Dequeue(pTxMgmtQ->aQueues[uQueId]); context_LeaveCriticalSection (pTxMgmtQ->hContext); - if (pPktCtrlBlk == NULL) - { - break; + if (pPktCtrlBlk != NULL) { + txCtrl_FreePacket (pTxMgmtQ->hTxCtrl, pPktCtrlBlk, TI_NOK); } - txCtrl_FreePacket (pTxMgmtQ->hTxCtrl, pPktCtrlBlk, TI_NOK); - } + } while (pPktCtrlBlk != NULL); } } @@ -953,33 +949,35 @@ void txMgmtQ_PrintModuleParams (TI_HANDLE hTxMgmtQ) */ void txMgmtQ_PrintQueueStatistics (TI_HANDLE hTxMgmtQ) { - TTxMgmtQ *pTxMgmtQ = (TTxMgmtQ *)hTxMgmtQ; - TI_UINT32 uQueId; +#ifdef REPORT_LOG + TTxMgmtQ *pTxMgmtQ = (TTxMgmtQ *)hTxMgmtQ; + TI_UINT32 uQueId; - WLAN_OS_REPORT(("-------------- Mgmt Queues Statistics -------------------\n")); - WLAN_OS_REPORT(("==========================================================\n")); + WLAN_OS_REPORT(("-------------- Mgmt Queues Statistics -------------------\n")); + WLAN_OS_REPORT(("==========================================================\n")); - WLAN_OS_REPORT(("-------------- Enqueue Packets ---------------------------\n")); + WLAN_OS_REPORT(("-------------- Enqueue Packets ---------------------------\n")); for(uQueId = 0; uQueId < NUM_OF_MGMT_QUEUES; uQueId++) WLAN_OS_REPORT(("Que[%d]: %d\n", uQueId, pTxMgmtQ->tDbgCounters.aEnqueuePackets[uQueId])); - WLAN_OS_REPORT(("-------------- Dequeue Packets ---------------------------\n")); + WLAN_OS_REPORT(("-------------- Dequeue Packets ---------------------------\n")); for(uQueId = 0; uQueId < NUM_OF_MGMT_QUEUES; uQueId++) WLAN_OS_REPORT(("Que[%d]: %d\n", uQueId, pTxMgmtQ->tDbgCounters.aDequeuePackets[uQueId])); - WLAN_OS_REPORT(("-------------- Requeue Packets ---------------------------\n")); + WLAN_OS_REPORT(("-------------- Requeue Packets ---------------------------\n")); for(uQueId = 0; uQueId < NUM_OF_MGMT_QUEUES; uQueId++) WLAN_OS_REPORT(("Que[%d]: %d\n", uQueId, pTxMgmtQ->tDbgCounters.aRequeuePackets[uQueId])); - WLAN_OS_REPORT(("-------------- Xmitted Packets ---------------------------\n")); + WLAN_OS_REPORT(("-------------- Xmitted Packets ---------------------------\n")); for(uQueId = 0; uQueId < NUM_OF_MGMT_QUEUES; uQueId++) WLAN_OS_REPORT(("Que[%d]: %d\n", uQueId, pTxMgmtQ->tDbgCounters.aXmittedPackets[uQueId])); - WLAN_OS_REPORT(("-------------- Dropped Packets (queue full) --------------\n")); + WLAN_OS_REPORT(("-------------- Dropped Packets (queue full) --------------\n")); for(uQueId = 0; uQueId < NUM_OF_MGMT_QUEUES; uQueId++) WLAN_OS_REPORT(("Que[%d]: %d\n", uQueId, pTxMgmtQ->tDbgCounters.aDroppedPackets[uQueId])); - WLAN_OS_REPORT(("==========================================================\n\n")); + WLAN_OS_REPORT(("==========================================================\n\n")); +#endif } @@ -1001,6 +999,5 @@ void txMgmtQ_ResetQueueStatistics (TI_HANDLE hTxMgmtQ) os_memoryZero(pTxMgmtQ->hOs, (void *)&(pTxMgmtQ->tDbgCounters), sizeof(TDbgCount)); } - #endif /* TI_DBG */ diff --git a/wl1271/stad/src/Sta_Management/PowerMgrDbgPrint.c b/wl1271/stad/src/Sta_Management/PowerMgrDbgPrint.c index c1c0ed66..6d4df016 100644 --- a/wl1271/stad/src/Sta_Management/PowerMgrDbgPrint.c +++ b/wl1271/stad/src/Sta_Management/PowerMgrDbgPrint.c @@ -50,9 +50,9 @@ #define MAX_DESC_LENGTH 32 +#ifdef REPORT_LOG void powerMgrPrintPriorities( TI_HANDLE hPowerMgr, powerMngModePriority_t* pPriorities ); - static char booleanDesc[ 2 ][ MAX_DESC_LENGTH ] = {"no", "yes"}; static char powerModeDesc[ POWER_MODE_MAX ][ MAX_DESC_LENGTH ] = { "Auto", "Active", "Short doze", "Long doze", "PS only" }; @@ -62,6 +62,7 @@ static char priorityDesc[ POWER_MANAGER_MAX_PRIORITY ][ MAX_DESC_LENGTH ] = { "User priority", "Soft-Gemini priority" }; static char psStatusDesc[ POWER_SAVE_STATUS_NUMBER ][ MAX_DESC_LENGTH ]= { "Enter fail", "Enter success", "Exit fail", "Exit succes" }; +#endif /**************************************************************************************** * PowerMgr_printObject * @@ -74,6 +75,7 @@ RETURN: void.\n ****************************************************************************************/ void PowerMgr_printObject( TI_HANDLE hPowerMgr ) { +#ifdef REPORT_LOG PowerMgr_t *pPowerMgr = (PowerMgr_t*)hPowerMgr; WLAN_OS_REPORT(("------------ Power Manager Object ------------\n\n")); @@ -98,8 +100,10 @@ void PowerMgr_printObject( TI_HANDLE hPowerMgr ) WLAN_OS_REPORT(("%-15s: 0x%x, %-15s:0x%x\n","hSiteMgr", pPowerMgr->hSiteMgr, "hTWD", pPowerMgr->hTWD)); WLAN_OS_REPORT(("%-15s: 0x%x, %-15s:0x%x\n","hRetryPsTimer", pPowerMgr->hRetryPsTimer, "hActiveTMEvent", pPowerMgr->passToActiveTMEvent)); WLAN_OS_REPORT(("%-15s: 0x%x\n", "hDozeTMEvent", pPowerMgr->passToDozeTMEvent)); +#endif } +#ifdef REPORT_LOG void powerMgrPrintPriorities( TI_HANDLE hPowerMgr, powerMngModePriority_t* pPriorities ) { int i; @@ -111,6 +115,7 @@ void powerMgrPrintPriorities( TI_HANDLE hPowerMgr, powerMngModePriority_t* pPrio powerModeDesc[ pPriorities[ i ].powerMode ])); } } +#endif #endif /* TI_DBG */ #endif /* __POWER_MGR_DBG_PRINT__ */ diff --git a/wl1271/stad/src/Sta_Management/ScanCncnApp.c b/wl1271/stad/src/Sta_Management/ScanCncnApp.c index 68654005..0e200664 100644 --- a/wl1271/stad/src/Sta_Management/ScanCncnApp.c +++ b/wl1271/stad/src/Sta_Management/ScanCncnApp.c @@ -49,7 +49,6 @@ #include "sme.h" #include "smeApi.h" - /** * \fn scanCncnApp_SetParam * \brief Parses and executes a set param command @@ -75,7 +74,7 @@ TI_STATUS scanCncnApp_SetParam (TI_HANDLE hScanCncn, paramInfo_t *pParam) /* verify that scan is not currently running */ if (pScanCncn->eCurrentRunningAppScanClient != SCAN_SCC_NO_CLIENT) { - TRACE1(pScanCncn->hReport, REPORT_SEVERITY_ERROR , "scanCncnApp_SetParam: trying to start app one-shot scan when client %d is currently running!\n", pScanCncn->eCurrentRunningAppScanClient); + TRACE1(pScanCncn->hReport, REPORT_SEVERITY_WARNING, "scanCncnApp_SetParam: trying to start app one-shot scan when client %d is currently running!\n", pScanCncn->eCurrentRunningAppScanClient); /* Scan was not started successfully, send a scan complete event to the user */ return TI_NOK; } @@ -105,7 +104,7 @@ TI_STATUS scanCncnApp_SetParam (TI_HANDLE hScanCncn, paramInfo_t *pParam) /* verify that scan is not currently running */ if (SCAN_SCC_NO_CLIENT != pScanCncn->eCurrentRunningAppScanClient) { - TRACE1(pScanCncn->hReport, REPORT_SEVERITY_ERROR , "scanCncnApp_SetParam: trying to start app periodic scan when client %d is currently running!\n", pScanCncn->eCurrentRunningAppScanClient); + TRACE1(pScanCncn->hReport, REPORT_SEVERITY_WARNING, "scanCncnApp_SetParam: trying to start app periodic scan when client %d is currently running!\n", pScanCncn->eCurrentRunningAppScanClient); /* Scan was not started successfully, send a scan complete event to the user */ return TI_NOK; } diff --git a/wl1271/stad/src/Sta_Management/assocSM.c b/wl1271/stad/src/Sta_Management/assocSM.c index 1fd3c9eb..457c1575 100644 --- a/wl1271/stad/src/Sta_Management/assocSM.c +++ b/wl1271/stad/src/Sta_Management/assocSM.c @@ -936,7 +936,6 @@ TI_STATUS assoc_smSendAssocReq(assoc_t *pAssoc) { assocType = RE_ASSOC_REQUEST; } - status = assoc_smRequestBuild(pAssoc, assocMsg, &msgLen); if (status == TI_OK) { /* Save the association request message */ @@ -1362,12 +1361,10 @@ TI_STATUS assoc_smRequestBuild(assoc_t *pCtx, TI_UINT8* reqBuf, TI_UINT32* reqLe paramInfo_t param; TTwdParamInfo tTwdParam; TI_UINT16 capabilities; - pRequest = reqBuf; *reqLen = 0; - /* insert capabilities */ status = assoc_smCapBuild(pCtx, &capabilities); if (status == TI_OK) @@ -1576,7 +1573,6 @@ TI_STATUS assoc_saveAssocRespMessage(assoc_t *pAssocSm, TI_UINT8 *pAssocBuffer, { return TI_NOK; } - os_memoryCopy(pAssocSm->hOs, pAssocSm->assocRespBuffer, pAssocBuffer, length); pAssocSm->assocRespLen = length; diff --git a/wl1271/stad/src/Sta_Management/currBss.c b/wl1271/stad/src/Sta_Management/currBss.c index d1d29b8a..8d5c8469 100644 --- a/wl1271/stad/src/Sta_Management/currBss.c +++ b/wl1271/stad/src/Sta_Management/currBss.c @@ -268,7 +268,7 @@ TI_STATUS currBSS_SetDefaults (TI_HANDLE hCurrBSS, TCurrBssInitParams *pInitPara currBSS_t *pCurrBSS = (currBSS_t *)hCurrBSS; TRroamingTriggerParams params; RssiSnrTriggerCfg_t tTriggerCfg; - + /* save the roaming operational mode */ pCurrBSS->RoamingOperationalMode = pInitParams->RoamingOperationalMode; @@ -559,7 +559,8 @@ void currBSS_updateBSSLoss(currBSS_t *pCurrBSS) roamingTriggersParams.BssLossTimeout = NO_BEACON_DEFAULT_TIMEOUT; -TRACE2(pCurrBSS->hReport, REPORT_SEVERITY_INFORMATION, ": SG=%d, Band=%d\n", pCurrBSS->bUseSGParams, pCurrBSS->currAPInfo.band); + TRACE2(pCurrBSS->hReport, REPORT_SEVERITY_INFORMATION, ": SG=%d, Band=%d\n", pCurrBSS->bUseSGParams, pCurrBSS->currAPInfo.band); + /* if Soft Gemini is enabled - increase the BSSLoss value (because BT activity might over-run beacons) */ if ((pCurrBSS->bUseSGParams) && (pCurrBSS->currAPInfo.band == RADIO_BAND_2_4_GHZ)) @@ -657,10 +658,8 @@ TI_STATUS currBSS_probRespReceivedCallb(TI_HANDLE hCurrBSS, pParam = (paramInfo_t *)os_memoryAlloc(pCurrBSS->hOs, sizeof(paramInfo_t)); if (!pParam) - { return TI_NOK; - } - + pParam->paramType = SITE_MGR_CURRENT_BSSID_PARAM; siteMgr_getParam(pCurrBSS->hSiteMgr, pParam); @@ -780,9 +779,7 @@ void currBSS_updateConnectedState(TI_HANDLE hCurrBSS, TI_BOOL isConnected, ScanB pParam = (paramInfo_t *)os_memoryAlloc(pCurrBSS->hOs, sizeof(paramInfo_t)); if (!pParam) - { return; - } /* BSSID */ pParam->paramType = SITE_MGR_CURRENT_BSSID_PARAM; @@ -1111,10 +1108,7 @@ static void currBSS_BackgroundScanQuality(TI_HANDLE hCurrBSS, /* Update Site Table in order to represent the RSSI of current AP correctly in the utility */ pParam = (paramInfo_t *)os_memoryAlloc(pCurrBSS->hOs, sizeof(paramInfo_t)); if (!pParam) - { return; - } - pParam->paramType = SITE_MGR_CURRENT_SIGNAL_PARAM; pParam->content.siteMgrCurrentSignal.rssi = averageRssi; siteMgr_setParam(pCurrBSS->hSiteMgr, pParam); @@ -1237,7 +1231,6 @@ static TI_STATUS currBss_HandleTriggerEvent(TI_HANDLE hCurrBSS, TI_UINT8 *data, TRACE1(pCurrBSS->hReport ,REPORT_SEVERITY_INFORMATION, "currBss_HandleTriggerEvent(). eventID =%d \n",eventID); - if (eventID < MAX_NUM_OF_RSSI_SNR_TRIGGERS) { pTrigger = &pCurrBSS->aTriggersDesc[eventID]; @@ -1420,7 +1413,6 @@ TI_STATUS currBSS_setParam(TI_HANDLE hCurrBSS, paramInfo_t *pParam) /* Register the event and enable it before configuration. */ triggerID = currBSS_RegisterTriggerEvent(hCurrBSS, (TI_UINT8)0, pUserTrigger->uClientID, (void*)0, hCurrBSS); - if (triggerID < 0) { TRACE0(pCurrBSS->hReport, REPORT_SEVERITY_ERROR , "currBSS_setParam: RSSI/SNR user trigger registration FAILED!! \n"); @@ -1430,7 +1422,6 @@ TI_STATUS currBSS_setParam(TI_HANDLE hCurrBSS, paramInfo_t *pParam) { tTriggerCfg.index = (uint8)triggerID; /* the index is used for the eventMBox triggerID mapping*/ } - /* Send user defined trigger to FW (the related FW events are handled by the currBSS) */ status = TWD_CfgRssiSnrTrigger (pCurrBSS->hTWD, &tTriggerCfg); @@ -1453,6 +1444,7 @@ TI_STATUS currBSS_getParam(TI_HANDLE hCurrBSS, paramInfo_t *pParam) void currBss_DbgPrintTriggersTable(TI_HANDLE hCurrBSS) { +#ifdef REPORT_LOG int i=0; currBSS_t *pCurrBSS = (currBSS_t *)hCurrBSS; @@ -1467,4 +1459,5 @@ void currBss_DbgPrintTriggersTable(TI_HANDLE hCurrBSS) pCurrBSS->aTriggersDesc[i].WasRegisteredByApp)); } WLAN_OS_REPORT(("\n --------------------------------------------------------------- \n")); +#endif } diff --git a/wl1271/stad/src/Sta_Management/healthMonitor.c b/wl1271/stad/src/Sta_Management/healthMonitor.c index b0f115e3..132d4060 100644 --- a/wl1271/stad/src/Sta_Management/healthMonitor.c +++ b/wl1271/stad/src/Sta_Management/healthMonitor.c @@ -408,7 +408,8 @@ RETURN: ************************************************************************/ void healthMonitor_printFailureEvents(TI_HANDLE hHealthMonitor) { - #ifdef TI_DBG +#ifdef TI_DBG +#ifdef REPORT_LOG THealthMonitor *pHealthMonitor = (THealthMonitor*)hHealthMonitor; int i; @@ -421,8 +422,8 @@ void healthMonitor_printFailureEvents(TI_HANDLE hHealthMonitor) WLAN_OS_REPORT(("Maximum number of commands in mailbox queue = %u\n", TWD_GetMaxNumberOfCommandsInQueue(pHealthMonitor->hTWD))); WLAN_OS_REPORT(("Health Test Performed = %d\n", pHealthMonitor->numOfHealthTests)); WLAN_OS_REPORT(("\n")); - - #endif /* TI_DBG */ +#endif +#endif /* TI_DBG */ } diff --git a/wl1271/stad/src/Sta_Management/mlmeParser.c b/wl1271/stad/src/Sta_Management/mlmeParser.c index 3d07826f..4a0f4736 100644 --- a/wl1271/stad/src/Sta_Management/mlmeParser.c +++ b/wl1271/stad/src/Sta_Management/mlmeParser.c @@ -93,7 +93,7 @@ extern int WMEQosTagToACTable[MAX_NUM_OF_802_1d_TAGS]; TI_STATUS mlmeParser_recv(TI_HANDLE hMlme, void *pBuffer, TRxAttr* pRxAttr) { - TI_STATUS status = TI_NOK; + TI_STATUS status; mlme_t *pHandle = (mlme_t *)hMlme; TI_UINT8 *pData; TI_INT32 bodyDataLen; @@ -132,8 +132,8 @@ TI_STATUS mlmeParser_recv(TI_HANDLE hMlme, void *pBuffer, TRxAttr* pRxAttr) } pParam = (paramInfo_t *)os_memoryAlloc(pHandle->hOs, sizeof(paramInfo_t)); - if (!pParam) - { + if (!pParam) { + RxBufFree(pHandle->hOs, pBuffer); return TI_NOK; } @@ -798,12 +798,11 @@ TI_STATUS mlmeParser_recv(TI_HANDLE hMlme, void *pBuffer, TRxAttr* pRxAttr) break; default: - TRACE1(pHandle->hReport, REPORT_SEVERITY_ERROR, "MLME_PARSER: Error, category is invalid for action management frame %d \n", pHandle->tempFrameInfo.frame.content.action.category ); + TRACE1(pHandle->hReport, REPORT_SEVERITY_ERROR, "MLME_PARSER: Error, category is invalid for action management frame %d \n", pHandle->tempFrameInfo.frame.content.action.category ); break; } break; - default: status = TI_NOK; @@ -816,7 +815,9 @@ mlme_recv_end: /* release BUF */ os_memoryFree(pHandle->hOs, pParam, sizeof(paramInfo_t)); RxBufFree(pHandle->hOs, pBuffer); - return status; + if (status != TI_OK) + return TI_NOK; + return TI_OK; } TI_STATUS mlmeParser_getFrameType(mlme_t *pMlme, TI_UINT16* pFrameCtrl, dot11MgmtSubType_e *pType) @@ -1100,33 +1101,33 @@ TI_STATUS mlmeParser_readWMEParams(mlme_t *pMlme,TI_UINT8 *pData, TI_UINT32 data /* Note: This function actually reads either the WME-Params IE or the WME-Info IE! */ - pWMEParamIE->hdr[0] = *pData; - pWMEParamIE->hdr[1] = *(pData+1); + pWMEParamIE->hdr[0] = *pData; + pWMEParamIE->hdr[1] = *(pData+1); - *pReadLen = pWMEParamIE->hdr[1] + 2; + *pReadLen = pWMEParamIE->hdr[1] + 2; - if (dataLen < *pReadLen) - { -TRACE2(pMlme->hReport, REPORT_SEVERITY_ERROR, "MLME_PARSER: WME Parameter: eleLen=%d is too long (%d)\n", *pReadLen, dataLen); + if (dataLen < *pReadLen) + { + TRACE2(pMlme->hReport, REPORT_SEVERITY_WARNING, "MLME_PARSER: WME Parameter: eleLen=%d is too long (%d)\n", *pReadLen, dataLen); *pReadLen = dataLen; return TI_NOK; - } + } - if ((pWMEParamIE->hdr[1]> WME_TSPEC_IE_LEN) || (pWMEParamIE->hdr[1]< DOT11_WME_ELE_LEN)) - { - TRACE1(pMlme->hReport, REPORT_SEVERITY_ERROR, "MLME_PARSER: WME Parameter IE error: eleLen=%d\n", pWMEParamIE->hdr[1]); - return TI_NOK; - } + if ((pWMEParamIE->hdr[1]> WME_TSPEC_IE_LEN) || (pWMEParamIE->hdr[1]< DOT11_WME_ELE_LEN)) + { + TRACE1(pMlme->hReport, REPORT_SEVERITY_WARNING, "MLME_PARSER: WME Parameter IE error: eleLen=%d\n", pWMEParamIE->hdr[1]); + return TI_NOK; + } ieSubtype = *((TI_UINT8*)(pData+6)); - switch (ieSubtype) + switch (ieSubtype) { case dot11_WME_OUI_SUB_TYPE_IE: case dot11_WME_OUI_SUB_TYPE_PARAMS_IE: /* Checking WME Version validity */ if (*((TI_UINT8*)(pData+7)) != dot11_WME_VERSION ) { -TRACE1(pMlme->hReport, REPORT_SEVERITY_INFORMATION, "MLME_PARSER: WME Parameter IE error: Version =%d is unsupported\n", *((TI_UINT8*)(pData+7)) ); + TRACE1(pMlme->hReport, REPORT_SEVERITY_INFORMATION, "MLME_PARSER: WME Parameter IE error: Version =%d is unsupported\n", *((TI_UINT8*)(pData+7)) ); return TI_NOK; } diff --git a/wl1271/stad/src/Sta_Management/qosMngr.c b/wl1271/stad/src/Sta_Management/qosMngr.c index c2a19d4e..121797fc 100644 --- a/wl1271/stad/src/Sta_Management/qosMngr.c +++ b/wl1271/stad/src/Sta_Management/qosMngr.c @@ -117,9 +117,7 @@ TI_HANDLE qosMngr_create(TI_HANDLE hOs) pQosMngr = os_memoryAlloc(hOs,sizeof(qosMngr_t)); if (pQosMngr == NULL) - { - return NULL; - } + return NULL; os_memoryZero (hOs, pQosMngr, sizeof(qosMngr_t)); @@ -768,7 +766,6 @@ TI_STATUS qosMngr_getParamsActiveProtocol(TI_HANDLE hQosMngr, EQosProtocol *actP return TI_OK; } - /************************************************************************ * qosMngr_getACparams * ************************************************************************ @@ -818,7 +815,6 @@ TI_STATUS qosMngr_getParams(TI_HANDLE hQosMngr,paramInfo_t *pParamInfo) pParamInfo->content.TspecConfigure.voiceTspecConfigure = (TI_UINT8)pQosMngr->voiceTspecConfigured; pParamInfo->content.TspecConfigure.videoTspecConfigure = (TI_UINT8)pQosMngr->videoTspecConfigured; - TRACE1(pQosMngr->hReport, REPORT_SEVERITY_INFORMATION, "qosMngr_getParams: QOS_MNGR_VOICE_RE_NEGOTIATE_TSPEC=%d\n", pQosMngr->voiceTspecConfigured); if (pQosMngr->voiceTspecConfigured == TI_TRUE) diff --git a/wl1271/stad/src/Sta_Management/qosMngr_API.h b/wl1271/stad/src/Sta_Management/qosMngr_API.h index 1deda895..867da739 100644 --- a/wl1271/stad/src/Sta_Management/qosMngr_API.h +++ b/wl1271/stad/src/Sta_Management/qosMngr_API.h @@ -102,7 +102,6 @@ void qosMngr_SetBaPolicies(TI_HANDLE hQosMngr); TI_STATUS qosMngr_setParams(TI_HANDLE hQosMngr,paramInfo_t *pParamInfo); TI_STATUS qosMngr_getParamsActiveProtocol(TI_HANDLE hQosMngr, EQosProtocol *actProt); - TI_STATUS qosMngr_getParams(TI_HANDLE hQosMngr,paramInfo_t *pParamInfo); TI_STATUS qosMngr_assocReqBuild(TI_HANDLE hQosMngr, TI_UINT8 *pQosIe, TI_UINT32 *pLen); diff --git a/wl1271/stad/src/Sta_Management/scanResultTable.c b/wl1271/stad/src/Sta_Management/scanResultTable.c index 8de92070..1ffb916d 100644 --- a/wl1271/stad/src/Sta_Management/scanResultTable.c +++ b/wl1271/stad/src/Sta_Management/scanResultTable.c @@ -520,7 +520,7 @@ void scanResultTable_UpdateSiteData (TI_HANDLE hScanResultTable, TSiteEntry *pSi if ((pFrame->parsedIEs->content.iePacket.pDSParamsSet != NULL) && (pFrame->parsedIEs->content.iePacket.pDSParamsSet->currChannel != pFrame->channel)) { - TRACE2(pScanResultTable->hReport, REPORT_SEVERITY_ERROR , "scanResultTable_UpdateSiteData: wrong channels, radio channel=%d, frame channel=%d\n", pFrame->channel, pFrame->parsedIEs->content.iePacket.pDSParamsSet->currChannel); + TRACE2(pScanResultTable->hReport, REPORT_SEVERITY_WARNING, "scanResultTable_UpdateSiteData: wrong channels, radio channel=%d, frame channel=%d\n", pFrame->channel, pFrame->parsedIEs->content.iePacket.pDSParamsSet->currChannel); } else UPDATE_CHANNEL (pSite, pFrame , pFrame->channel); diff --git a/wl1271/stad/src/Sta_Management/siteHash.c b/wl1271/stad/src/Sta_Management/siteHash.c index 26301ca8..4a910d1f 100644 --- a/wl1271/stad/src/Sta_Management/siteHash.c +++ b/wl1271/stad/src/Sta_Management/siteHash.c @@ -170,8 +170,7 @@ siteEntry_t *findSiteEntry(siteMgr_t *pSiteMgr, } } - if ((pSiteMgr->pDesiredParams->siteMgrDesiredDot11Mode == DOT11_DUAL_MODE) && - (tableIndex==1)) + if ((pSiteMgr->pDesiredParams->siteMgrDesiredDot11Mode == DOT11_DUAL_MODE) && (tableIndex==1)) { /* change site table */ if (pCurrentSiteTable == &pSiteMgr->pSitesMgmtParams->dot11BG_sitesTables) { diff --git a/wl1271/stad/src/Sta_Management/siteMgr.c b/wl1271/stad/src/Sta_Management/siteMgr.c index e80a4ed4..b4b026dc 100644 --- a/wl1271/stad/src/Sta_Management/siteMgr.c +++ b/wl1271/stad/src/Sta_Management/siteMgr.c @@ -228,6 +228,7 @@ static void siteMgr_TxPowerAdaptation(TI_HANDLE hSiteMgr, RssiEventDir_e highLow static void siteMgr_TxPowerLowThreshold(TI_HANDLE hSiteMgr, TI_UINT8 *data, TI_UINT8 dataLength); static void siteMgr_TxPowerHighThreshold(TI_HANDLE hSiteMgr, TI_UINT8 *data, TI_UINT8 dataLength); + /************************************************************************ * siteMgr_setTemporaryTxPower * ************************************************************************* @@ -291,9 +292,7 @@ TI_HANDLE siteMgr_create(TI_HANDLE hOs) pSiteMgr = os_memoryAlloc(hOs, sizeof(siteMgr_t)); if (pSiteMgr == NULL) - { return NULL; - } os_memoryZero(hOs, pSiteMgr, sizeof(siteMgr_t)); @@ -4074,7 +4073,6 @@ TI_STATUS siteMgr_overwritePrimarySite(TI_HANDLE hSiteMgr, bssEntry_t *newAP, TI /* Select the entry as primary site */ newApEntry->siteType = SITE_PRIMARY; pSiteMgr->pSitesMgmtParams->pPrimarySite = newApEntry; - return TI_OK; } else diff --git a/wl1271/stad/src/Sta_Management/siteMgrApi.h b/wl1271/stad/src/Sta_Management/siteMgrApi.h index 6a27dbde..03d24920 100644 --- a/wl1271/stad/src/Sta_Management/siteMgrApi.h +++ b/wl1271/stad/src/Sta_Management/siteMgrApi.h @@ -109,7 +109,6 @@ TI_STATUS siteMgr_setParam(TI_HANDLE hSiteMgr, paramInfo_t *pParam); TI_STATUS siteMgr_getParamWSC(TI_HANDLE hSiteMgr, TIWLN_SIMPLE_CONFIG_MODE *wscParam); - TI_STATUS siteMgr_getParam(TI_HANDLE hSiteMgr, paramInfo_t *pParam); @@ -180,7 +179,6 @@ TI_STATUS siteMgr_saveBeaconBuffer(TI_HANDLE hSiteMgr, TMacAddr *bssid, TI_UINT8 void siteMgr_UpdatHtParams (TI_HANDLE hSiteMgr, siteEntry_t *pSite, mlmeFrameInfo_t *pFrameInfo); - #ifdef REPORT_LOG void siteMgr_printPrimarySiteDesc(TI_HANDLE hSiteMgr ); #endif diff --git a/wl1271/stad/src/Sta_Management/systemConfig.c b/wl1271/stad/src/Sta_Management/systemConfig.c index 06a954e8..85d2fcdc 100644 --- a/wl1271/stad/src/Sta_Management/systemConfig.c +++ b/wl1271/stad/src/Sta_Management/systemConfig.c @@ -133,6 +133,8 @@ typedef enum #define MAX_GB_MODE_CHANEL 14 +#define MAX_RSN_DATA_SIZE 256 + /* RSSI values boundaries and metric values for best, good, etc signals */ #define SELECT_RSSI_BEST_LEVEL (-22) #define SELECT_RSSI_GOOD_LEVEL (-38) @@ -224,7 +226,6 @@ siteEntry_t *addSelfSite(TI_HANDLE hSiteMgr) pSite->bssType = BSS_INDEPENDENT; return pSite; - } /*********************************************************************** @@ -428,13 +429,12 @@ TI_STATUS systemConfig(siteMgr_t *pSiteMgr) dot11_ACParameters_t *p_ACParametersDummy = NULL; TtxCtrlHtControl tHtControl; - curRsnData = os_memoryAlloc(pSiteMgr->hOs, 256); + curRsnData = os_memoryAlloc(pSiteMgr->hOs, MAX_RSN_DATA_SIZE); if (!curRsnData) return TI_NOK; - pParam = (paramInfo_t *)os_memoryAlloc(pSiteMgr->hOs, sizeof(paramInfo_t)); if (!pParam) { - os_memoryFree(pSiteMgr->hOs, curRsnData, 256); + os_memoryFree(pSiteMgr->hOs, curRsnData, MAX_RSN_DATA_SIZE); return TI_NOK; } @@ -543,7 +543,6 @@ TI_STATUS systemConfig(siteMgr_t *pSiteMgr) pParam->content.ctrlDataCurrentPreambleType = PREAMBLE_LONG; ctrlData_setParam(pSiteMgr->hCtrlData, pParam); - /* Mutual Rates Matching */ StaTotalRates = pSiteMgr->pDesiredParams->siteMgrCurrentDesiredRateMask.basicRateMask | pSiteMgr->pDesiredParams->siteMgrCurrentDesiredRateMask.supportedRateMask; @@ -593,7 +592,7 @@ TI_STATUS systemConfig(siteMgr_t *pSiteMgr) qosMngr_setParams(pSiteMgr->hQosMngr, pParam); /* Set active protocol in qosMngr according to station desired mode and site capabilities - Must be called BEFORE setting the "CURRENT_PS_MODE" into the QosMngr */ + Must be called BEFORE setting the "CURRENT_PS_MODE" into the QosMngr */ qosMngr_selectActiveProtocol(pSiteMgr->hQosMngr); /* set PS capability parameter */ @@ -626,7 +625,8 @@ TI_STATUS systemConfig(siteMgr_t *pSiteMgr) TWD_CfgSetFwHtInformation (pSiteMgr->hTWD, &pPrimarySite->tHtInformation); /* the FW not supported in HT control field in TX */ - tHtControl.bHtEnable = TI_FALSE; + + tHtControl.bHtEnable = TI_FALSE; txCtrlParams_SetHtControl (pSiteMgr->hTxCtrl, &tHtControl); } else @@ -694,11 +694,8 @@ TI_STATUS systemConfig(siteMgr_t *pSiteMgr) /* Updating the Measurement Module Mode */ measurementMgr_setMeasurementMode(pSiteMgr->hMeasurementMgr, capabilities, pIeBuffer, PktLength); - - os_memoryFree(pSiteMgr->hOs, curRsnData, 256); + os_memoryFree(pSiteMgr->hOs, curRsnData, MAX_RSN_DATA_SIZE); os_memoryFree(pSiteMgr->hOs, pParam, sizeof(paramInfo_t)); - return TI_OK; } - diff --git a/wl1271/stad/src/Sta_Management/templates.c b/wl1271/stad/src/Sta_Management/templates.c index 631de323..43a3b951 100644 --- a/wl1271/stad/src/Sta_Management/templates.c +++ b/wl1271/stad/src/Sta_Management/templates.c @@ -154,7 +154,6 @@ TI_STATUS buildDisconnTemplate(siteMgr_t *pSiteMgr, TSetTemplate *pTemplate) MAC_COPY (pBuffer->hdr.SA, param.content.ctrlDataDeviceMacAddress); fc = DOT11_FC_DISASSOC; /* will be change by firmware to DOT11_FC_DEAUTH if needed */ - COPY_WLAN_WORD(&pBuffer->hdr.fc, &fc); /* copy with endianess handling. */ @@ -805,7 +804,6 @@ TI_STATUS buildArpRspTemplate(siteMgr_t *pSiteMgr, TSetTemplate *pTemplate, TIpA } return TI_OK; } - diff --git a/wl1271/utils/802_11Defs.h b/wl1271/utils/802_11Defs.h index 1cc32895..3b533690 100644 --- a/wl1271/utils/802_11Defs.h +++ b/wl1271/utils/802_11Defs.h @@ -504,6 +504,7 @@ typedef struct #define TKIP_AFTER_HEADER_FIELD_SIZE (IV_FIELD_SIZE + EIV_FIELD_SIZE) #define AES_AFTER_HEADER_FIELD_SIZE 8 + /* DS params Information Element */ #define DOT11_DS_PARAMS_ELE_ID 3 #define DOT11_DS_PARAMS_ELE_LEN 1 diff --git a/wl1271/utils/CmdInterfaceCodes.h b/wl1271/utils/CmdInterfaceCodes.h index 71669b2e..82cccf21 100644 --- a/wl1271/utils/CmdInterfaceCodes.h +++ b/wl1271/utils/CmdInterfaceCodes.h @@ -1448,7 +1448,7 @@ typedef enum * Allocate Bit: OFF \n * GET Bit: OFF \n * SET Bit: ON \n - */ + */ /* Health Monitoring section */ HEALTH_MONITOR_CHECK_DEVICE = SET_BIT | HEALTH_MONITOR_MODULE_PARAM | 0x01, /**< Health Monitoring Check Device Parameter (Health Monitoring Module Set Command): \n diff --git a/wl1271/utils/GenSM.c b/wl1271/utils/GenSM.c index e6c21da1..2527e3b2 100644 --- a/wl1271/utils/GenSM.c +++ b/wl1271/utils/GenSM.c @@ -152,13 +152,14 @@ void genSM_Event (TI_HANDLE hGenSM, TI_UINT32 uEvent, void *pData) TI_UINT32 uCurrentState; TGenSM_actionCell *pCell; -#ifdef TI_DBG - /* sanity check */ if (pGenSM == NULL) { TRACE0(pGenSM->hReport, REPORT_SEVERITY_ERROR , "genSM_Event: Handle is NULL!!\n"); return; } + +#ifdef TI_DBG + /* sanity check */ if (uEvent >= pGenSM->uEventNum) { TRACE3(pGenSM->hReport, REPORT_SEVERITY_ERROR , "genSM_Event: module: %d received event %d, which is out of events boundry %d\n", pGenSM->uModuleLogIndex, uEvent, pGenSM->uEventNum); diff --git a/wl1271/utils/GenSM.h b/wl1271/utils/GenSM.h index 4d3b0974..120d2394 100644 --- a/wl1271/utils/GenSM.h +++ b/wl1271/utils/GenSM.h @@ -43,7 +43,6 @@ #include "tidef.h" - /* action function type definition */ typedef void (*TGenSM_action) (void *pData); @@ -56,6 +55,7 @@ typedef struct } TGenSM_actionCell; + /* * matrix type * Although the state-machine matrix is actually a two-dimensional array, it is treated as a single @@ -83,8 +83,6 @@ typedef struct TI_INT8 **pEventDesc; /**< Event description strings */ } TGenSM; - - TI_HANDLE genSM_Create (TI_HANDLE hOS); void genSM_Unload (TI_HANDLE hGenSM); void genSM_Init (TI_HANDLE hGenSM, TI_HANDLE hReport); diff --git a/wl1271/utils/context.c b/wl1271/utils/context.c index bbbaa141..be71f9a1 100644 --- a/wl1271/utils/context.c +++ b/wl1271/utils/context.c @@ -56,21 +56,21 @@ #define MAX_NAME_SIZE 16 /* Maximum client's name string size */ #ifdef TI_DBG -typedef struct +typedef struct { TI_UINT32 uSize; /* Clients' name string size */ char sName [MAX_NAME_SIZE]; /* Clients' name string */ -} TClientName; +} TClientName; #endif /* TI_DBG */ /* context module structure */ -typedef struct +typedef struct { - TI_HANDLE hOs; - TI_HANDLE hReport; + TI_HANDLE hOs; + TI_HANDLE hReport; TI_BOOL bContextSwitchRequired; /* Indicate if the driver should switch to its */ - /* own context or not before handling events */ + /* own context or not before handling events */ TI_HANDLE hProtectionLock; /* Handle of protection lock used by context clients */ TI_UINT32 uNumClients; /* Number of registered clients */ TContextCbFunc aClientCbFunc [MAX_CLIENTS]; /* Clients' callback functions */ @@ -84,9 +84,7 @@ typedef struct TI_UINT32 aInvokeCount [MAX_CLIENTS]; /* Clients' invocations counter */ #endif -} TContext; - - +} TContext; /** @@ -102,20 +100,20 @@ typedef struct */ TI_HANDLE context_Create (TI_HANDLE hOs) { - TI_HANDLE hContext; - - /* allocate module object */ - hContext = os_memoryAlloc (hOs, sizeof(TContext)); - - if (!hContext) - { - WLAN_OS_REPORT (("context_Create(): Allocation failed!!\n")); - return NULL; - } - + TI_HANDLE hContext; + + /* allocate module object */ + hContext = os_memoryAlloc (hOs, sizeof(TContext)); + + if (!hContext) + { + WLAN_OS_REPORT (("context_Create(): Allocation failed!!\n")); + return NULL; + } + os_memoryZero (hOs, hContext, (sizeof(TContext))); - return (hContext); + return (hContext); } @@ -138,8 +136,8 @@ TI_STATUS context_Destroy (TI_HANDLE hContext) os_protectDestroy (pContext->hOs, pContext->hProtectionLock); /* free module object */ - os_memoryFree (pContext->hOs, pContext, sizeof(TContext)); - + os_memoryFree (pContext->hOs, pContext, sizeof(TContext)); + return TI_OK; } @@ -159,11 +157,11 @@ TI_STATUS context_Destroy (TI_HANDLE hContext) */ void context_Init (TI_HANDLE hContext, TI_HANDLE hOs, TI_HANDLE hReport) { - TContext *pContext = (TContext *)hContext; + TContext *pContext = (TContext *)hContext; pContext->hOs = hOs; pContext->hReport = hReport; - + /* Create the module's protection lock and save its handle */ pContext->hProtectionLock = os_protectCreate (pContext->hOs); } @@ -184,11 +182,11 @@ void context_Init (TI_HANDLE hContext, TI_HANDLE hOs, TI_HANDLE hReport) */ TI_STATUS context_SetDefaults (TI_HANDLE hContext, TContextInitParams *pContextInitParams) { - TContext *pContext = (TContext *)hContext; + TContext *pContext = (TContext *)hContext; /* Set parameters */ pContext->bContextSwitchRequired = pContextInitParams->bContextSwitchRequired; - + return TI_OK; } @@ -217,11 +215,11 @@ TI_UINT32 context_RegisterClient (TI_HANDLE hContext, char *sName, TI_UINT32 uNameSize) { - TContext *pContext = (TContext *)hContext; + TContext *pContext = (TContext *)hContext; TI_UINT32 uClientId = pContext->uNumClients; /* If max number of clients is exceeded, report error and exit. */ - if (uClientId == MAX_CLIENTS) + if (uClientId == MAX_CLIENTS) { TRACE0(pContext->hReport, REPORT_SEVERITY_ERROR , "context_RegisterClient() MAX_CLIENTS limit exceeded!!\n"); return 0; @@ -234,15 +232,15 @@ TI_UINT32 context_RegisterClient (TI_HANDLE hContext, pContext->aClientPending[uClientId] = TI_FALSE; #ifdef TI_DBG - if (uNameSize <= MAX_NAME_SIZE) + if (uNameSize <= MAX_NAME_SIZE) { - os_memoryCopy(pContext->hOs, + os_memoryCopy(pContext->hOs, (void *)(pContext->aClientName[uClientId].sName), - (void *)sName, + (void *)sName, uNameSize); pContext->aClientName[uClientId].uSize = uNameSize; } - else + else { TRACE0(pContext->hReport, REPORT_SEVERITY_ERROR , "context_RegisterClient() MAX_NAME_SIZE limit exceeded!\n"); } @@ -273,7 +271,7 @@ TI_UINT32 context_RegisterClient (TI_HANDLE hContext, */ void context_RequestSchedule (TI_HANDLE hContext, TI_UINT32 uClientId) { - TContext *pContext = (TContext *)hContext; + TContext *pContext = (TContext *)hContext; #ifdef TI_DBG pContext->aRequestCount[uClientId]++; @@ -292,12 +290,12 @@ void context_RequestSchedule (TI_HANDLE hContext, TI_UINT32 uClientId) */ if (pContext->bContextSwitchRequired) { - if(os_RequestSchedule(pContext->hOs) != TI_OK) + if (os_RequestSchedule(pContext->hOs) != TI_OK) os_wake_unlock(pContext->hOs); } - else + else { - context_DriverTask (hContext); + context_DriverTask(hContext); os_wake_unlock(pContext->hOs); } } @@ -318,7 +316,7 @@ void context_RequestSchedule (TI_HANDLE hContext, TI_UINT32 uClientId) */ void context_DriverTask (TI_HANDLE hContext) { - TContext *pContext = (TContext *)hContext; + TContext *pContext = (TContext *)hContext; TContextCbFunc fCbFunc; TI_HANDLE hCbHndl; TI_UINT32 i; @@ -327,15 +325,15 @@ void context_DriverTask (TI_HANDLE hContext) TRACE0(pContext->hReport, REPORT_SEVERITY_INFORMATION , "context_DriverTask():\n"); /* For all registered clients do: */ - for (i = 0; i < pContext->uNumClients; i++) + for (i = 0; i < pContext->uNumClients; i++) { /* If client is pending and enabled */ if (pContext->aClientPending[i] && pContext->aClientEnabled[i]) { - #ifdef TI_DBG - pContext->aInvokeCount[i]++; - TRACE1(pContext->hReport, REPORT_SEVERITY_INFORMATION , "Invoking - Client=, ID=%d\n", i); - #endif /* TI_DBG */ +#ifdef TI_DBG + pContext->aInvokeCount[i]++; + TRACE1(pContext->hReport, REPORT_SEVERITY_INFORMATION , "Invoking - Client=, ID=%d\n", i); +#endif /* TI_DBG */ /* Clear client's pending flag */ pContext->aClientPending[i] = TI_FALSE; @@ -366,7 +364,7 @@ void context_DriverTask (TI_HANDLE hContext) */ void context_EnableClient (TI_HANDLE hContext, TI_UINT32 uClientId) { - TContext *pContext = (TContext *)hContext; + TContext *pContext = (TContext *)hContext; #ifdef TI_DBG if (pContext->aClientEnabled[uClientId]) @@ -392,12 +390,12 @@ void context_EnableClient (TI_HANDLE hContext, TI_UINT32 uClientId) */ if (pContext->bContextSwitchRequired) { - if(os_RequestSchedule(pContext->hOs) != TI_OK) + if (os_RequestSchedule(pContext->hOs) != TI_OK) os_wake_unlock(pContext->hOs); } - else + else { - context_DriverTask (hContext); + context_DriverTask(hContext); os_wake_unlock(pContext->hOs); } } @@ -405,7 +403,7 @@ void context_EnableClient (TI_HANDLE hContext, TI_UINT32 uClientId) void context_DisableClient (TI_HANDLE hContext, TI_UINT32 uClientId) { - TContext *pContext = (TContext *)hContext; + TContext *pContext = (TContext *)hContext; #ifdef TI_DBG if (!pContext->aClientEnabled[uClientId]) @@ -435,7 +433,7 @@ void context_DisableClient (TI_HANDLE hContext, TI_UINT32 uClientId) */ void context_EnterCriticalSection (TI_HANDLE hContext) { - TContext *pContext = (TContext *)hContext; + TContext *pContext = (TContext *)hContext; TRACE0(pContext->hReport, REPORT_SEVERITY_INFORMATION , "context_EnterCriticalSection():\n"); @@ -445,7 +443,7 @@ void context_EnterCriticalSection (TI_HANDLE hContext) void context_LeaveCriticalSection (TI_HANDLE hContext) { - TContext *pContext = (TContext *)hContext; + TContext *pContext = (TContext *)hContext; TRACE0(pContext->hReport, REPORT_SEVERITY_INFORMATION , "context_LeaveCriticalSection():\n"); @@ -470,16 +468,17 @@ void context_LeaveCriticalSection (TI_HANDLE hContext) void context_Print(TI_HANDLE hContext) { - TContext *pContext = (TContext *)hContext; +#ifdef REPORT_LOG + TContext *pContext = (TContext *)hContext; TI_UINT32 i; WLAN_OS_REPORT(("context_Print(): %d Clients Registered:\n", pContext->uNumClients)); WLAN_OS_REPORT(("=======================================\n")); WLAN_OS_REPORT(("bContextSwitchRequired = %d\n", pContext->bContextSwitchRequired)); - for (i = 0; i < pContext->uNumClients; i++) - { - WLAN_OS_REPORT(("Client %d - %s: CbFunc=0x%x, CbHndl=0x%x, Enabled=%d, Pending=%d, Requests=%d, Invoked=%d\n", + for (i = 0; i < pContext->uNumClients; i++) + { + WLAN_OS_REPORT(("Client %d - %s: CbFunc=0x%x, CbHndl=0x%x, Enabled=%d, Pending=%d, Requests=%d, Invoked=%d\n", i, pContext->aClientName[i].sName, pContext->aClientCbFunc[i], @@ -488,9 +487,8 @@ void context_Print(TI_HANDLE hContext) pContext->aClientPending[i], pContext->aRequestCount[i], pContext->aInvokeCount[i] )); - } + } +#endif } #endif /* TI_DBG */ - - diff --git a/wl1271/utils/fsm.c b/wl1271/utils/fsm.c index cae429db..aca1b7a6 100644 --- a/wl1271/utils/fsm.c +++ b/wl1271/utils/fsm.c @@ -105,6 +105,7 @@ TI_STATUS fsm_Create(TI_HANDLE hOs, { return TI_NOK; } + os_memoryZero(hOs, (*pFsm), sizeof(fsm_stateMachine_t)); /* allocate memory for FSM matrix */ (*pFsm)->stateEventMatrix = (fsm_Matrix_t)os_memoryAlloc(hOs, MaxNoOfStates * MaxNoOfEvents * sizeof(fsm_actionCell_t)); @@ -113,7 +114,8 @@ TI_STATUS fsm_Create(TI_HANDLE hOs, os_memoryFree(hOs, *pFsm, sizeof(fsm_stateMachine_t)); return TI_NOK; } - + os_memoryZero(hOs, (*pFsm)->stateEventMatrix, + (MaxNoOfStates * MaxNoOfEvents * sizeof(fsm_actionCell_t))); /* update pFsm structure with parameters */ (*pFsm)->MaxNoOfStates = MaxNoOfStates; (*pFsm)->MaxNoOfEvents = MaxNoOfEvents; @@ -240,9 +242,9 @@ TI_STATUS fsm_Config(fsm_stateMachine_t *pFsm, * * \sa fsm_Init */ -TI_STATUS fsm_Event (fsm_stateMachine_t *pFsm, - TI_UINT8 *currentState, - TI_UINT8 event, +TI_STATUS fsm_Event(fsm_stateMachine_t *pFsm, + TI_UINT8 *currentState, + TI_UINT8 event, void *pData) { TI_UINT8 oldState; diff --git a/wl1271/utils/osDot11.h b/wl1271/utils/osDot11.h index 245560a4..4973e5c3 100644 --- a/wl1271/utils/osDot11.h +++ b/wl1271/utils/osDot11.h @@ -56,9 +56,9 @@ #define OS_802_11_SSID_JUNK(str,len) \ ((len) > 2 && \ - (str)[0] < OS_802_11_SSID_FIRST_VALID_CHAR && \ - (str)[1] < OS_802_11_SSID_FIRST_VALID_CHAR && \ - (str)[2] < OS_802_11_SSID_FIRST_VALID_CHAR) + (unsigned char)(str)[0] < OS_802_11_SSID_FIRST_VALID_CHAR && \ + (unsigned char)(str)[1] < OS_802_11_SSID_FIRST_VALID_CHAR && \ + (unsigned char)(str)[2] < OS_802_11_SSID_FIRST_VALID_CHAR) /**/ @@ -683,4 +683,3 @@ typedef enum _OS_802_11_REG_DOMAIN #define OS_802_11_OPTION_ENABLE_ALL 0x00000003 #endif - diff --git a/wl1271/utils/queue.c b/wl1271/utils/queue.c index 51258f5a..92439d4d 100644 --- a/wl1271/utils/queue.c +++ b/wl1271/utils/queue.c @@ -249,13 +249,13 @@ TI_STATUS que_Enqueue (TI_HANDLE hQue, TI_HANDLE hItem) AddToHead (pQueNodeHdr, &pQue->tHead); pQue->uCount++; -#ifdef TI_DBG - if (pQue->uCount > pQue->uMaxCount) - { - pQue->uMaxCount = pQue->uCount; - } - TRACE0(pQue->hReport, REPORT_SEVERITY_INFORMATION , "que_Enqueue(): Enqueued Successfully\n"); -#endif + #ifdef TI_DBG + if (pQue->uCount > pQue->uMaxCount) + { + pQue->uMaxCount = pQue->uCount; + } + TRACE0(pQue->hReport, REPORT_SEVERITY_INFORMATION , "que_Enqueue(): Enqueued Successfully\n"); + #endif return TI_OK; } @@ -265,7 +265,7 @@ TI_STATUS que_Enqueue (TI_HANDLE hQue, TI_HANDLE hItem) */ #ifdef TI_DBG pQue->uOverflow++; - TRACE0(pQue->hReport, REPORT_SEVERITY_WARNING , "que_Enqueue(): Queue Overflow\n"); +TRACE0(pQue->hReport, REPORT_SEVERITY_WARNING , "que_Enqueue(): Queue Overflow\n"); #endif return TI_NOK; @@ -298,10 +298,10 @@ TI_HANDLE que_Dequeue (TI_HANDLE hQue) DelFromTail (pQue->tHead.pPrev); /* remove node from the queue */ pQue->uCount--; -#ifdef TI_DBG - /* Clear the pNext so we can do a sanity check when enqueuing this structre in the future */ - ((TQueNodeHdr *)((TI_UINT8*)hItem + pQue->uNodeHeaderOffset))->pNext = NULL; -#endif + #ifdef TI_DBG + /* Clear the pNext so we can do a sanity check when enqueuing this structre in the future */ + ((TQueNodeHdr *)((TI_UINT8*)hItem + pQue->uNodeHeaderOffset))->pNext = NULL; + #endif return (hItem); } @@ -357,6 +357,7 @@ TRACE0(pQue->hReport, REPORT_SEVERITY_INFORMATION , "que_Requeue(): Requeued suc return TI_OK; } + /* * Queue is overflowed, return TI_NOK. * Note: This is not expected in the current design, since Tx packet may be requeued @@ -364,7 +365,7 @@ TRACE0(pQue->hReport, REPORT_SEVERITY_INFORMATION , "que_Requeue(): Requeued suc */ #ifdef TI_DBG pQue->uOverflow++; - TRACE0(pQue->hReport, REPORT_SEVERITY_ERROR , "que_Requeue(): Queue Overflow\n"); +TRACE0(pQue->hReport, REPORT_SEVERITY_ERROR , "que_Requeue(): Queue Overflow\n"); #endif return TI_NOK; @@ -406,11 +407,13 @@ TI_UINT32 que_Size (TI_HANDLE hQue) void que_Print(TI_HANDLE hQue) { - TQueue *pQue = (TQueue *)hQue; +#ifdef REPORT_LOG + TQueue *pQue = (TQueue *)hQue; WLAN_OS_REPORT(("que_Print: Count=%u MaxCount=%u Limit=%u Overflow=%u NodeHeaderOffset=%u Next=0x%x Prev=0x%x\n", pQue->uCount, pQue->uMaxCount, pQue->uLimit, pQue->uOverflow, pQue->uNodeHeaderOffset, pQue->tHead.pNext, pQue->tHead.pPrev)); +#endif } #endif /* TI_DBG */ diff --git a/wl1271/utils/rate.c b/wl1271/utils/rate.c index b6e525d5..cb83212c 100644 --- a/wl1271/utils/rate.c +++ b/wl1271/utils/rate.c @@ -708,7 +708,6 @@ TI_STATUS rate_DrvBitmapToNetStr (TI_UINT32 uSuppRatesBitMap, * it is only for basic and extended rates, otherwise it will exceed 16 bytes string * the code below is a sample and can be used in the future, if need to parse MCS rates bit map to string */ - #if 0 if (uSuppRatesBitMap & DRV_RATE_MASK_MCS_0_OFDM) { @@ -806,6 +805,7 @@ TI_STATUS rate_DrvBitmapToNetStr (TI_UINT32 uSuppRatesBitMap, } } #endif + *len = i; return TI_OK; diff --git a/wl1271/utils/timer.c b/wl1271/utils/timer.c index f73609c6..329e2134 100644 --- a/wl1271/utils/timer.c +++ b/wl1271/utils/timer.c @@ -38,7 +38,6 @@ * \see timer.h, osapi.c */ - #define __FILE_ID__ FILE_ID_0 #include "osApi.h" #include "report.h" @@ -52,9 +51,9 @@ /* The timer module structure (common to all timers) */ typedef struct { - TI_HANDLE hOs; - TI_HANDLE hReport; - TI_HANDLE hContext; + TI_HANDLE hOs; + TI_HANDLE hReport; + TI_HANDLE hContext; TI_UINT32 uContextId; /* The ID allocated to this module on registration to context module */ TI_HANDLE hInitQueue; /* Handle of the Init-Queue */ TI_HANDLE hOperQueue; /* Handle of the Operational-Queue */ @@ -93,20 +92,20 @@ typedef struct */ TI_HANDLE tmr_Create (TI_HANDLE hOs) { - TI_HANDLE hTimerModule; + TI_HANDLE hTimerModule; - /* allocate module object */ - hTimerModule = os_memoryAlloc (hOs, sizeof(TTimerModule)); + /* allocate module object */ + hTimerModule = os_memoryAlloc (hOs, sizeof(TTimerModule)); - if (!hTimerModule) - { - WLAN_OS_REPORT (("tmr_Create(): Allocation failed!!\n")); - return NULL; - } + if (!hTimerModule) + { + WLAN_OS_REPORT (("tmr_Create(): Allocation failed!!\n")); + return NULL; + } os_memoryZero (hOs, hTimerModule, (sizeof(TTimerModule))); - return (hTimerModule); + return (hTimerModule); } @@ -128,7 +127,7 @@ TI_STATUS tmr_Destroy (TI_HANDLE hTimerModule) /* Alert if there are still timers that were not destroyed */ if (pTimerModule->uTimersCount) { - WLAN_OS_REPORT (("tmr_Destroy(): ERROR - Destroying Timer module but not all timers were destroyed!!\n")); + WLAN_OS_REPORT (("tmr_Destroy(): ERROR - Destroying Timer module but not all timers were destroyed!!\n")); } /* Clear queues (critical section is used inside these functions) */ @@ -161,7 +160,7 @@ TI_STATUS tmr_Free(TI_HANDLE hTimerModule) TTimerModule *pTimerModule = (TTimerModule *)hTimerModule; /* free module object */ - os_memoryFree (pTimerModule->hOs, pTimerModule, sizeof(TTimerModule)); + os_memoryFree (pTimerModule->hOs, pTimerModule, sizeof(TTimerModule)); return TI_OK; } @@ -214,7 +213,7 @@ void tmr_ClearOperQueue (TI_HANDLE hTimerModule) */ void tmr_Init (TI_HANDLE hTimerModule, TI_HANDLE hOs, TI_HANDLE hReport, TI_HANDLE hContext) { - TTimerModule *pTimerModule = (TTimerModule *)hTimerModule; + TTimerModule *pTimerModule = (TTimerModule *)hTimerModule; TI_UINT32 uNodeHeaderOffset; pTimerModule->hOs = hOs; @@ -265,17 +264,18 @@ void tmr_Init (TI_HANDLE hTimerModule, TI_HANDLE hOs, TI_HANDLE hReport, TI_HAND */ void tmr_UpdateDriverState (TI_HANDLE hTimerModule, TI_BOOL bOperState) { - TTimerModule *pTimerModule = (TTimerModule *)hTimerModule; + TTimerModule *pTimerModule = (TTimerModule *)hTimerModule; + + /* Enter critical section */ + context_EnterCriticalSection (pTimerModule->hContext); if (bOperState == pTimerModule->bOperState) { + context_LeaveCriticalSection (pTimerModule->hContext); TRACE1(pTimerModule->hReport, REPORT_SEVERITY_ERROR, "tmr_UpdateDriverState(): New bOperState (%d) is as current!\n", bOperState); return; } - /* Enter critical section */ - context_EnterCriticalSection (pTimerModule->hContext); - /* Save new state (TRUE means operational). */ pTimerModule->bOperState = bOperState; @@ -288,7 +288,7 @@ void tmr_UpdateDriverState (TI_HANDLE hTimerModule, TI_BOOL bOperState) /* Empty the init queue (obsolete). */ while (que_Dequeue (pTimerModule->hInitQueue) != NULL) {} } - + /* Leave critical section */ context_LeaveCriticalSection (pTimerModule->hContext); @@ -301,7 +301,6 @@ void tmr_UpdateDriverState (TI_HANDLE hTimerModule, TI_BOOL bOperState) - /** * \fn tmr_CreateTimer * \brief Create a new timer @@ -315,27 +314,27 @@ void tmr_UpdateDriverState (TI_HANDLE hTimerModule, TI_BOOL bOperState) */ TI_HANDLE tmr_CreateTimer (TI_HANDLE hTimerModule) { - TTimerModule *pTimerModule = (TTimerModule *)hTimerModule; /* The timer module handle */ + TTimerModule *pTimerModule = (TTimerModule *)hTimerModule; /* The timer module handle */ TTimerInfo *pTimerInfo; /* The created timer handle */ - /* Allocate timer object */ - pTimerInfo = os_memoryAlloc (pTimerModule->hOs, sizeof(TTimerInfo)); - if (!pTimerInfo) - { - WLAN_OS_REPORT (("tmr_CreateTimer(): Timer allocation failed!!\n")); - return NULL; - } + /* Allocate timer object */ + pTimerInfo = os_memoryAlloc (pTimerModule->hOs, sizeof(TTimerInfo)); + if (!pTimerInfo) + { + WLAN_OS_REPORT (("tmr_CreateTimer(): Timer allocation failed!!\n")); + return NULL; + } os_memoryZero (pTimerModule->hOs, pTimerInfo, (sizeof(TTimerInfo))); /* Allocate OS-API timer, providing the common expiry callback with the current timer handle */ pTimerInfo->hOsTimerObj = os_timerCreate(pTimerModule->hOs, tmr_GetExpiry, (TI_HANDLE)pTimerInfo); - if (!pTimerInfo->hOsTimerObj) - { + if (!pTimerInfo->hOsTimerObj) + { TRACE0(pTimerModule->hReport, REPORT_SEVERITY_CONSOLE ,"tmr_CreateTimer(): OS-API Timer allocation failed!!\n"); os_memoryFree (pTimerModule->hOs, pTimerInfo, sizeof(TTimerInfo)); WLAN_OS_REPORT (("tmr_CreateTimer(): OS-API Timer allocation failed!!\n")); - return NULL; - } + return NULL; + } /* Save the timer module handle in the created timer object (needed for the expiry callback) */ pTimerInfo->hTimerModule = hTimerModule; @@ -359,22 +358,23 @@ TI_HANDLE tmr_CreateTimer (TI_HANDLE hTimerModule) */ TI_STATUS tmr_DestroyTimer (TI_HANDLE hTimerInfo) { - TTimerInfo *pTimerInfo = (TTimerInfo *)hTimerInfo; /* The timer handle */ - TTimerModule *pTimerModule = (TTimerModule *)pTimerInfo->hTimerModule; /* The timer module handle */ + TTimerInfo *pTimerInfo = (TTimerInfo *)hTimerInfo; /* The timer handle */ + TTimerModule *pTimerModule; /* The timer module handle */ + if (!pTimerInfo) + return TI_NOK; + pTimerModule = (TTimerModule *)pTimerInfo->hTimerModule; /* Free the OS-API timer */ - os_timerDestroy (pTimerModule->hOs, pTimerInfo->hOsTimerObj); - + if (pTimerInfo->hOsTimerObj) { + os_timerDestroy (pTimerModule->hOs, pTimerInfo->hOsTimerObj); + pTimerModule->uTimersCount--; /* update created timers number */ + } /* Free the timer object */ os_memoryFree (pTimerModule->hOs, hTimerInfo, sizeof(TTimerInfo)); - - pTimerModule->uTimersCount--; /* update created timers number */ - return TI_OK; } - /** * \fn tmr_StartTimer * \brief Start a timer @@ -402,7 +402,7 @@ void tmr_StartTimer (TI_HANDLE hTimerInfo, TI_BOOL bPeriodic) { TTimerInfo *pTimerInfo = (TTimerInfo *)hTimerInfo; /* The timer handle */ - TTimerModule *pTimerModule = (TTimerModule *)pTimerInfo->hTimerModule; /* The timer module handle */ + TTimerModule *pTimerModule = (TTimerModule *)pTimerInfo->hTimerModule; /* The timer module handle */ /* Save the timer parameters. */ pTimerInfo->fExpiryCbFunc = fExpiryCbFunc; @@ -433,7 +433,7 @@ void tmr_StartTimer (TI_HANDLE hTimerInfo, void tmr_StopTimer (TI_HANDLE hTimerInfo) { TTimerInfo *pTimerInfo = (TTimerInfo *)hTimerInfo; /* The timer handle */ - TTimerModule *pTimerModule = (TTimerModule *)pTimerInfo->hTimerModule; /* The timer module handle */ + TTimerModule *pTimerModule = (TTimerModule *)pTimerInfo->hTimerModule; /* The timer module handle */ /* Stop OS-API timer running */ os_timerStop(pTimerModule->hOs, pTimerInfo->hOsTimerObj); @@ -507,7 +507,7 @@ void tmr_GetExpiry (TI_HANDLE hTimerInfo) */ void tmr_HandleExpiry (TI_HANDLE hTimerModule) { - TTimerModule *pTimerModule = (TTimerModule *)hTimerModule; /* The timer module handle */ + TTimerModule *pTimerModule = (TTimerModule *)hTimerModule; /* The timer module handle */ TTimerInfo *pTimerInfo; /* The timer handle */ TI_BOOL bTwdInitOccured; /* Indicates if TWD init occured since timer start */ @@ -572,12 +572,12 @@ void tmr_HandleExpiry (TI_HANDLE hTimerModule) void tmr_PrintModule (TI_HANDLE hTimerModule) { - TTimerModule *pTimerModule = (TTimerModule *)hTimerModule; + TTimerModule *pTimerModule = (TTimerModule *)hTimerModule; /* Print module parameters */ WLAN_OS_REPORT(("tmr_PrintModule(): uContextId=%d, bOperState=%d, uTwdInitCount=%d, uTimersCount=%d\n", - pTimerModule->uContextId, pTimerModule->bOperState, - pTimerModule->uTwdInitCount, pTimerModule->uTimersCount)); + pTimerModule->uContextId, pTimerModule->bOperState, + pTimerModule->uTwdInitCount, pTimerModule->uTimersCount)); /* Print Init Queue Info */ WLAN_OS_REPORT(("tmr_PrintModule(): Init-Queue:\n")); @@ -590,13 +590,13 @@ void tmr_PrintModule (TI_HANDLE hTimerModule) void tmr_PrintTimer (TI_HANDLE hTimerInfo) { +#ifdef REPORT_LOG TTimerInfo *pTimerInfo = (TTimerInfo *)hTimerInfo; /* The timer handle */ WLAN_OS_REPORT(("tmr_PrintTimer(): uIntervalMs=%d, bPeriodic=%d, bOperStateWhenStarted=%d, uTwdInitCountWhenStarted=%d, hOsTimerObj=0x%x, fExpiryCbFunc=0x%x\n", - pTimerInfo->uIntervalMsec, pTimerInfo->bPeriodic, pTimerInfo->bOperStateWhenStarted, - pTimerInfo->uTwdInitCountWhenStarted, pTimerInfo->hOsTimerObj, pTimerInfo->fExpiryCbFunc)); + pTimerInfo->uIntervalMsec, pTimerInfo->bPeriodic, pTimerInfo->bOperStateWhenStarted, + pTimerInfo->uTwdInitCountWhenStarted, pTimerInfo->hOsTimerObj, pTimerInfo->fExpiryCbFunc)); +#endif } #endif /* TI_DBG */ - - diff --git a/wl1271/utils/version.h b/wl1271/utils/version.h index cb045338..bf8edcb6 100644 --- a/wl1271/utils/version.h +++ b/wl1271/utils/version.h @@ -49,8 +49,6 @@ #define SW_RELEASE_DAY 10 #define SW_RELEASE_YEAR 2009 - - #endif /* _VERSION_H_ */ diff --git a/wl1271/wpa_supplicant_lib/Android.mk b/wl1271/wpa_supplicant_lib/Android.mk index 5e2dd516..cd1d4c26 100644 --- a/wl1271/wpa_supplicant_lib/Android.mk +++ b/wl1271/wpa_supplicant_lib/Android.mk @@ -24,6 +24,25 @@ ifeq ($(TARGET_SIMULATOR),true) $(error This makefile must not be included when building the simulator) endif +ifndef WPA_SUPPLICANT_VERSION +WPA_SUPPLICANT_VERSION := VER_0_5_X +endif + +ifeq ($(WPA_SUPPLICANT_VERSION),VER_0_5_X) +WPA_SUPPL_DIR = external/wpa_supplicant +else +WPA_SUPPL_DIR = external/wpa_supplicant_6/wpa_supplicant +endif +WPA_SUPPL_DIR_INCLUDE = $(WPA_SUPPL_DIR) +ifeq ($(WPA_SUPPLICANT_VERSION),VER_0_6_X) +WPA_SUPPL_DIR_INCLUDE += $(WPA_SUPPL_DIR)/src \ + $(WPA_SUPPL_DIR)/src/common \ + $(WPA_SUPPL_DIR)/src/drivers \ + $(WPA_SUPPL_DIR)/src/l2_packet \ + $(WPA_SUPPL_DIR)/src/utils \ + $(WPA_SUPPL_DIR)/src/wps +endif + DK_ROOT = $(BOARD_WLAN_TI_STA_DK_ROOT) OS_ROOT = $(DK_ROOT)/platforms STAD = $(DK_ROOT)/stad @@ -34,12 +53,7 @@ TXN = $(DK_ROOT)/Txn CUDK = $(DK_ROOT)/CUDK LIB = ../../lib -include external/wpa_supplicant/.config - -# To force sizeof(enum) = 4 -ifneq ($(TARGET_SIMULATOR),true) -L_CFLAGS += -mabi=aapcs-linux -endif +include $(WPA_SUPPL_DIR)/.config INCLUDES = $(STAD)/Export_Inc \ $(STAD)/src/Application \ @@ -54,12 +68,18 @@ INCLUDES = $(STAD)/Export_Inc \ $(CUDK)/configurationutility/inc \ $(CUDK)/os/common/inc \ external/openssl/include \ - external/wpa_supplicant \ + $(WPA_SUPPL_DIR_INCLUDE) \ $(DK_ROOT)/../lib -L_CFLAGS += -DCONFIG_DRIVER_CUSTOM -DHOST_COMPILE -D__BYTE_ORDER_LITTLE_ENDIAN +L_CFLAGS = -DCONFIG_DRIVER_CUSTOM -DHOST_COMPILE -D__BYTE_ORDER_LITTLE_ENDIAN +L_CFLAGS += -DWPA_SUPPLICANT_$(WPA_SUPPLICANT_VERSION) OBJS = driver_ti.c $(LIB)/scanmerge.c $(LIB)/shlist.c +# To force sizeof(enum) = 4 +ifneq ($(TARGET_SIMULATOR),true) +L_CFLAGS += -mabi=aapcs-linux +endif + ifdef CONFIG_NO_STDOUT_DEBUG L_CFLAGS += -DCONFIG_NO_STDOUT_DEBUG endif @@ -68,11 +88,17 @@ ifdef CONFIG_DEBUG_FILE L_CFLAGS += -DCONFIG_DEBUG_FILE endif +ifdef CONFIG_ANDROID_LOG +L_CFLAGS += -DCONFIG_ANDROID_LOG +endif + ifdef CONFIG_IEEE8021X_EAPOL L_CFLAGS += -DIEEE8021X_EAPOL endif +ifdef CONFIG_WPS L_CFLAGS += -DCONFIG_WPS +endif ######################## diff --git a/wl1271/wpa_supplicant_lib/driver_ti.c b/wl1271/wpa_supplicant_lib/driver_ti.c index 00c0f64a..e7e2bc22 100644 --- a/wl1271/wpa_supplicant_lib/driver_ti.c +++ b/wl1271/wpa_supplicant_lib/driver_ti.c @@ -30,6 +30,9 @@ #endif #include "driver_ti.h" #include "scanmerge.h" +#ifdef CONFIG_WPS +#include "wps_defs.h" +#endif /*-------------------------------------------------------------------*/ #define TI2WPA_STATUS(s) (((s) != 0) ? -1 : 0) @@ -50,7 +53,7 @@ static int check_and_get_build_channels( void ) #ifdef ANDROID char prop_status[PROPERTY_VALUE_MAX]; char *prop_name = "ro.wifi.channels"; - int i, default_channels = NUMBER_SCAN_CHANNELS_ETSI; + int i, default_channels = NUMBER_SCAN_CHANNELS_FCC; if( property_get(prop_name, prop_status, NULL) ) { i = atoi(prop_status); @@ -86,6 +89,9 @@ static int wpa_driver_tista_keymgmt2wext(int keymgmt) switch (keymgmt) { case KEY_MGMT_802_1X: case KEY_MGMT_802_1X_NO_WPA: +#ifdef CONFIG_WPS + case KEY_MGMT_WPS: +#endif return IW_AUTH_KEY_MGMT_802_1X; case KEY_MGMT_PSK: return IW_AUTH_KEY_MGMT_PSK; @@ -134,12 +140,17 @@ static int wpa_driver_tista_private_send( void *priv, u32 ioctl_cmd, void *bufIn iwr.u.data.flags = 0; res = ioctl(drv->ioctl_sock, SIOCIWFIRSTPRIV, &iwr); - if(res != 0) + if (0 != res) { wpa_printf(MSG_ERROR, "ERROR - wpa_driver_tista_private_send - error sending Wext private IOCTL to STA driver (ioctl_cmd = %x, res = %d, errno = %d)", ioctl_cmd, res, errno); + drv->errors++; + if (drv->errors > MAX_NUMBER_SEQUENTIAL_ERRORS) { + drv->errors = 0; + wpa_msg(drv->ctx, MSG_INFO, WPA_EVENT_DRIVER_STATE "HANGED"); + } return -1; } - + drv->errors = 0; wpa_printf(MSG_DEBUG, "wpa_driver_tista_private_send ioctl_cmd = %x res = %d", ioctl_cmd, res); return 0; @@ -153,8 +164,10 @@ static int wpa_driver_tista_driver_start( void *priv ) res = wpa_driver_tista_private_send(priv, DRIVER_START_PARAM, &uDummyBuf, sizeof(uDummyBuf), NULL, 0); - if(0 != res) + if (0 != res) { wpa_printf(MSG_ERROR, "ERROR - Failed to start driver!"); + wpa_msg(drv->ctx, MSG_INFO, WPA_EVENT_DRIVER_STATE "HANGED"); + } else { os_sleep(0, WPA_DRIVER_WEXT_WAIT_US); /* delay 400 ms */ wpa_printf(MSG_DEBUG, "wpa_driver_tista_driver_start success"); @@ -170,8 +183,10 @@ static int wpa_driver_tista_driver_stop( void *priv ) res = wpa_driver_tista_private_send(priv, DRIVER_STOP_PARAM, &uDummyBuf, sizeof(uDummyBuf), NULL, 0); - if(0 != res) + if (0 != res) { wpa_printf(MSG_ERROR, "ERROR - Failed to stop driver!"); + wpa_msg(drv->ctx, MSG_INFO, WPA_EVENT_DRIVER_STATE "HANGED"); + } else wpa_printf(MSG_DEBUG, "wpa_driver_tista_driver_stop success"); @@ -195,12 +210,6 @@ int wpa_driver_tista_parse_custom(void *ctx, const void *custom) /* Dm: wpa_printf(MSG_INFO,"wpa_supplicant - Link Speed = %u", pStaDrv->link_speed ); */ break; -#ifdef CONFIG_WPS - case IPC_EVENT_WPS_SESSION_OVERLAP: - wpa_printf(MSG_INFO, "IPC_EVENT_WPS_SESSION_OVERLAP"); - wpa_supplicant_event(ctx, EVENT_WSC_PBC_OVERLAP, NULL); - break; -#endif /* CONFIG_WPS */ default: wpa_printf(MSG_DEBUG, "Unknown event"); break; @@ -257,7 +266,7 @@ static int wpa_driver_tista_scan( void *priv, const u8 *ssid, size_t ssid_len ) struct wpa_supplicant *wpa_s = (struct wpa_supplicant *)(drv->ctx); struct wpa_ssid *issid; scan_Params_t scanParams; - int scan_type, res, scan_probe_flag = 0; + int scan_type, res, timeout, scan_probe_flag = 0; wpa_printf(MSG_DEBUG, "%s", __func__); TI_CHECK_DRIVER( drv->driver_is_loaded, -1 ); @@ -295,6 +304,12 @@ static int wpa_driver_tista_scan( void *priv, const u8 *ssid, size_t ssid_len ) else wpa_printf(MSG_DEBUG, "wpa_driver_tista_scan success"); + timeout = 30; + wpa_printf(MSG_DEBUG, "Scan requested (ret=%d) - scan timeout %d sec", + res, timeout); + eloop_cancel_timeout(wpa_driver_wext_scan_timeout, drv->wext, drv->ctx); + eloop_register_timeout(timeout, 0, wpa_driver_wext_scan_timeout, + drv->wext, drv->ctx); return res; #else return wpa_driver_wext_scan(drv->wext, ssid, ssid_len); @@ -575,7 +590,7 @@ Return Value: actual buffer length - success, -1 - failure static int wpa_driver_tista_driver_cmd( void *priv, char *cmd, char *buf, size_t buf_len ) { struct wpa_driver_ti_data *drv = (struct wpa_driver_ti_data *)priv; - int ret = -1, prev_events; + int ret = -1, prev_events, flags; wpa_printf(MSG_DEBUG, "%s %s", __func__, cmd); @@ -593,12 +608,22 @@ static int wpa_driver_tista_driver_cmd( void *priv, char *cmd, char *buf, size_t if( os_strcasecmp(cmd, "stop") == 0 ) { wpa_printf(MSG_DEBUG,"Stop command"); + if ((wpa_driver_wext_get_ifflags(drv->wext, &flags) == 0) && + (flags & IFF_UP)) { + wpa_printf(MSG_ERROR, "TI: %s when iface is UP", cmd); + wpa_driver_wext_set_ifflags(drv->wext, flags & ~IFF_UP); + } ret = wpa_driver_tista_driver_stop(priv); if( ret == 0 ) { drv->driver_is_loaded = FALSE; wpa_msg(drv->ctx, MSG_INFO, WPA_EVENT_DRIVER_STATE "STOPPED"); } } + if( os_strcasecmp(cmd, "reload") == 0 ) { + wpa_printf(MSG_DEBUG,"Reload command"); + ret = 0; + wpa_msg(drv->ctx, MSG_INFO, WPA_EVENT_DRIVER_STATE "HANGED"); + } else if( os_strcasecmp(cmd, "macaddr") == 0 ) { wpa_driver_tista_get_mac_addr(priv); wpa_printf(MSG_DEBUG, "Macaddr command"); @@ -641,43 +666,50 @@ static int wpa_driver_tista_driver_cmd( void *priv, char *cmd, char *buf, size_t wpa_printf(MSG_DEBUG, "buf %s", buf); } else if( os_strcasecmp(cmd, "rssi-approx") == 0 ) { - struct wpa_scan_result *cur_res; + scan_result_t *cur_res; struct wpa_supplicant *wpa_s = (struct wpa_supplicant *)(drv->ctx); + scan_ssid_t *p_ssid; int rssi, len; wpa_printf(MSG_DEBUG,"rssi-approx command"); if( !wpa_s ) return( ret ); - cur_res = scan_get_by_bssid( drv, wpa_s->bssid ); + cur_res = scan_get_by_bssid(drv, wpa_s->bssid); if( cur_res ) { - len = (int)(cur_res->ssid_len); + p_ssid = scan_get_ssid(cur_res); + len = (int)(p_ssid->ssid_len); rssi = cur_res->level; if( (len > 0) && (len <= MAX_SSID_LEN) && (len < (int)buf_len)) { - os_memcpy( (void *)buf, (void *)(cur_res->ssid), len ); + os_memcpy((void *)buf, (void *)(p_ssid->ssid), len); ret = len; ret += snprintf(&buf[ret], buf_len-len, " rssi %d\n", rssi); - if (ret < (int)buf_len) { - return( ret ); - } } } } else if( os_strcasecmp(cmd, "rssi") == 0 ) { u8 ssid[MAX_SSID_LEN]; + scan_result_t *cur_res; + struct wpa_supplicant *wpa_s = (struct wpa_supplicant *)(drv->ctx); int rssi_data, rssi_beacon, len; wpa_printf(MSG_DEBUG,"rssi command"); ret = wpa_driver_tista_get_rssi(priv, &rssi_data, &rssi_beacon); if( ret == 0 ) { - len = wpa_driver_tista_get_ssid( priv, (u8 *)ssid ); + len = wpa_driver_tista_get_ssid(priv, (u8 *)ssid); wpa_printf(MSG_DEBUG,"rssi_data %d rssi_beacon %d", rssi_data, rssi_beacon); if( (len > 0) && (len <= MAX_SSID_LEN) ) { - os_memcpy( (void *)buf, (void *)ssid, len ); + os_memcpy((void *)buf, (void *)ssid, len); ret = len; ret += sprintf(&buf[ret], " rssi %d\n", rssi_beacon); wpa_printf(MSG_DEBUG, "buf %s", buf); + /* Update cached value */ + if( !wpa_s ) + return( ret ); + cur_res = scan_get_by_bssid(drv, wpa_s->bssid); + if( cur_res ) + cur_res->level = rssi_beacon; } else { @@ -794,6 +826,86 @@ static int wpa_driver_tista_driver_cmd( void *priv, char *cmd, char *buf, size_t return ret; } +#ifdef WPA_SUPPLICANT_VER_0_6_X +/*----------------------------------------------------------------------------- +Routine Name: wpa_driver_tista_set_probe_req_ie +Routine Description: set probe request ie for WSC mode change +Arguments: + priv - pointer to private data structure + ies - probe_req_ie data + ies_len - ie data length +Return Value: actual buffer length - success, -1 - failure +-----------------------------------------------------------------------------*/ +static int wpa_driver_tista_set_probe_req_ie(void *priv, const u8* ies, size_t ies_len) +{ + struct wpa_driver_ti_data *drv = (struct wpa_driver_ti_data *)priv; +#ifdef CONFIG_WPS + TWscMode WscModeStruct; + + TI_CHECK_DRIVER( drv->driver_is_loaded, -1 ); + + if ((!ies || (0 == ies_len)) && (NULL == drv->probe_req_ie)) { + return 0; + } + + if (ies && drv->probe_req_ie) { + size_t len = wpabuf_len(drv->probe_req_ie); + u8* data = (u8*)wpabuf_head(drv->probe_req_ie); + if ((ies_len == len) && (0 == os_memcmp(ies, data, ies_len))) { + return 0; + } + } + + os_memset(&WscModeStruct, 0, sizeof(TWscMode)); + + if (!ies || (0 == ies_len)) { + WscModeStruct.WSCMode = TIWLN_SIMPLE_CONFIG_OFF; + } else { + const size_t head_len = 6; /* probeReqIe head: dd xx 00 50 f2 04 */ + u8 *pos, *end; + u16 password_id = 0; + size_t min_len = 0; + + pos = (u8*)ies + head_len; /* Find the WSC mode in probe_req_ie by password_id */ + end = (u8*)ies + ies_len; + while (pos < end) { + if (ATTR_DEV_PASSWORD_ID == WPA_GET_BE16(pos)) { + password_id = WPA_GET_BE16(pos+4); + break; + } + pos += (4 + WPA_GET_BE16(pos+2)); + } + WscModeStruct.WSCMode = (DEV_PW_PUSHBUTTON == password_id)?TIWLN_SIMPLE_CONFIG_PBC_METHOD:TIWLN_SIMPLE_CONFIG_PIN_METHOD; + + pos = (u8*)ies + head_len; + min_len = ies_len - head_len; + if (min_len > sizeof(WscModeStruct.probeReqWSCIE)) { + min_len = sizeof(WscModeStruct.probeReqWSCIE); + } + os_memcpy(WscModeStruct.probeReqWSCIE, pos, min_len); + } + + wpa_hexdump(MSG_DEBUG, "SetProbeReqIe:WscModeStruct", (u8*)&WscModeStruct, sizeof(TWscMode)); + if(0 == wpa_driver_tista_private_send(priv, SITE_MGR_SIMPLE_CONFIG_MODE, (void*)&WscModeStruct, sizeof(TWscMode), NULL, 0)) { + /* Update the cached probe req ie */ + wpabuf_free(drv->probe_req_ie); + drv->probe_req_ie = NULL; + + if (ies && ies_len) { + drv->probe_req_ie = wpabuf_alloc(sizeof(WscModeStruct.probeReqWSCIE)); + if (drv->probe_req_ie) { + wpabuf_put_data(drv->probe_req_ie, ies, ies_len); + } + } + } else { + wpa_printf(MSG_ERROR, "ERROR - Failed to set wsc mode!"); + return -1; + } +#endif + return 0; +} +#endif + /** * wpa_driver_tista_init - Initialize WE driver interface * @ctx: context to be used when calling wpa_supplicant functions, @@ -840,6 +952,14 @@ void * wpa_driver_tista_init(void *ctx, const char *ifname) /* BtCoex mode is read from tiwlan.ini file */ drv->btcoex_mode = 0; /* SG_DISABLE */ + +#ifdef CONFIG_WPS + /* The latest probe_req_ie for WSC */ + drv->probe_req_ie = NULL; +#endif + + /* Number of sequential errors */ + drv->errors = 0; return drv; } @@ -857,6 +977,10 @@ void wpa_driver_tista_deinit(void *priv) wpa_driver_wext_deinit(drv->wext); close(drv->ioctl_sock); scan_exit(drv); +#ifdef CONFIG_WPS + wpabuf_free(drv->probe_req_ie); + drv->probe_req_ie = NULL; +#endif os_free(drv); } @@ -873,7 +997,7 @@ static int wpa_driver_tista_set_auth_param(struct wpa_driver_ti_data *drv, if (ioctl(drv->ioctl_sock, SIOCSIWAUTH, &iwr) < 0) { perror("ioctl[SIOCSIWAUTH]"); - fprintf(stderr, "WEXT auth param %d value 0x%x - ", + wpa_printf(MSG_ERROR, "WEXT auth param %d value 0x%x - ", idx, value); ret = errno == EOPNOTSUPP ? -2 : -1; } @@ -1065,21 +1189,77 @@ static int wpa_driver_tista_set_key(void *priv, wpa_alg alg, int ret; wpa_printf(MSG_DEBUG, "%s", __func__); - TI_CHECK_DRIVER( drv->driver_is_loaded, -1 ); + TI_CHECK_DRIVER( drv->driver_is_loaded, -1 ); ret = wpa_driver_wext_set_key(drv->wext, alg, addr, key_idx, set_tx, seq, seq_len, key, key_len); return ret; } +static int wpa_driver_tista_set_gen_ie(void *priv, const u8 *ie, size_t ie_len) +{ + struct wpa_driver_ti_data *drv = priv; + struct iwreq iwr; + int ret = 0; + + os_memset(&iwr, 0, sizeof(iwr)); + os_strncpy(iwr.ifr_name, drv->ifname, IFNAMSIZ); + iwr.u.data.pointer = (caddr_t)ie; + iwr.u.data.length = ie_len; + + if (ioctl(drv->ioctl_sock, SIOCSIWGENIE, &iwr) < 0) { + perror("ioctl[SIOCSIWGENIE]"); + ret = -1; + } + + return ret; +} + +#ifdef WPA_SUPPLICANT_VER_0_6_X +static struct wpa_scan_results *wpa_driver_tista_get_scan_results(void *priv) +{ + struct wpa_driver_ti_data *drv = priv; + struct wpa_scan_results *res; + struct wpa_scan_res **tmp; + unsigned ap_num; + + TI_CHECK_DRIVER( drv->driver_is_loaded, NULL ); + res = wpa_driver_wext_get_scan_results(drv->wext); + if (res == NULL) { + return NULL; + } + + wpa_printf(MSG_DEBUG, "Actual APs number %d", res->num); + ap_num = (unsigned)scan_count(drv) + res->num; + tmp = os_realloc(res->res, ap_num * sizeof(struct wpa_scan_res *)); + if (tmp == NULL) + return res; + res->num = scan_merge(drv, tmp, drv->force_merge_flag, res->num, ap_num); + wpa_printf(MSG_DEBUG, "After merge, APs number %d", res->num); + tmp = os_realloc(tmp, res->num * sizeof(struct wpa_scan_res *)); + res->res = tmp; + return res; +} + +int wpa_driver_tista_set_mode(void *priv, int mode) +{ + struct wpa_driver_ti_data *drv = priv; + int ret; + + wpa_printf(MSG_DEBUG, "%s", __func__); + TI_CHECK_DRIVER( drv->driver_is_loaded, -1 ); + ret = wpa_driver_wext_set_mode(drv->wext, mode); + return ret; +} +#else /*----------------------------------------------------------------------------- Compare function for sorting scan results. Return >0 if @b is considered better. -----------------------------------------------------------------------------*/ static int wpa_driver_tista_scan_result_compare(const void *a, const void *b) { - const struct wpa_scan_result *wa = a; - const struct wpa_scan_result *wb = b; + const struct wpa_scan_result *wa = a; + const struct wpa_scan_result *wb = b; - return( wb->level - wa->level ); + return( wb->level - wa->level ); } static int wpa_driver_tista_get_scan_results(void *priv, @@ -1089,7 +1269,7 @@ static int wpa_driver_tista_get_scan_results(void *priv, struct wpa_driver_ti_data *drv = priv; int ap_num = 0; - TI_CHECK_DRIVER( drv->driver_is_loaded, -1 ); + TI_CHECK_DRIVER( drv->driver_is_loaded, -1 ); ap_num = wpa_driver_wext_get_scan_results(drv->wext, results, max_size); wpa_printf(MSG_DEBUG, "Actual APs number %d", ap_num); @@ -1097,33 +1277,51 @@ static int wpa_driver_tista_get_scan_results(void *priv, return -1; /* Merge new results with previous */ - ap_num = scan_merge( drv, results, drv->force_merge_flag, ap_num, max_size ); + ap_num = scan_merge(drv, results, drv->force_merge_flag, ap_num, max_size); wpa_printf(MSG_DEBUG, "After merge, APs number %d", ap_num); - qsort( results, ap_num, sizeof(struct wpa_scan_result), - wpa_driver_tista_scan_result_compare ); + qsort(results, ap_num, sizeof(struct wpa_scan_result), + wpa_driver_tista_scan_result_compare); return ap_num; } +#endif static int wpa_driver_tista_associate(void *priv, struct wpa_driver_associate_params *params) { struct wpa_driver_ti_data *drv = priv; int allow_unencrypted_eapol; - int value, flags; + int value, flags, ret = 0; + + wpa_printf(MSG_DEBUG, "%s", __FUNCTION__); + TI_CHECK_DRIVER( drv->driver_is_loaded, -1 ); - TI_CHECK_DRIVER( drv->driver_is_loaded, -1 ); if (wpa_driver_wext_get_ifflags(drv->wext, &flags) == 0) { if (!(flags & IFF_UP)) { wpa_driver_wext_set_ifflags(drv->wext, flags | IFF_UP); } } + + if (!params->bssid) + wpa_driver_wext_set_bssid(drv->wext, NULL); + +#ifdef WPA_SUPPLICANT_VER_0_5_X /* Set driver network mode (Adhoc/Infrastructure) according to supplied parameters */ wpa_driver_wext_set_mode(drv->wext, params->mode); +#endif + wpa_driver_tista_set_gen_ie(drv, params->wpa_ie, params->wpa_ie_len); if (params->wpa_ie == NULL || params->wpa_ie_len == 0) value = IW_AUTH_WPA_VERSION_DISABLED; +#ifdef WPA_SUPPLICANT_VER_0_6_X + else if (params->wpa_ie[0] == WLAN_EID_RSN) +#else else if (params->wpa_ie[0] == RSN_INFO_ELEM) +#endif value = IW_AUTH_WPA_VERSION_WPA2; +#ifdef CONFIG_WPS + else if (params->key_mgmt_suite == KEY_MGMT_WPS) + value = IW_AUTH_WPA_VERSION_DISABLED; +#endif else value = IW_AUTH_WPA_VERSION_WPA; wpa_driver_tista_set_auth_param(drv, IW_AUTH_WPA_VERSION, value); @@ -1136,7 +1334,11 @@ static int wpa_driver_tista_associate(void *priv, value = params->key_mgmt_suite != KEY_MGMT_NONE || params->pairwise_suite != CIPHER_NONE || params->group_suite != CIPHER_NONE || +#ifdef WPA_SUPPLICANT_VER_0_6_X + (params->wpa_ie_len && (params->key_mgmt_suite != KEY_MGMT_WPS)); +#else params->wpa_ie_len; +#endif wpa_driver_tista_set_auth_param(drv, IW_AUTH_PRIVACY_INVOKED, value); /* Allow unencrypted EAPOL messages even if pairwise keys are set when @@ -1152,16 +1354,20 @@ static int wpa_driver_tista_associate(void *priv, IW_AUTH_RX_UNENCRYPTED_EAPOL, allow_unencrypted_eapol); - if( params->bssid ) { - wpa_printf(MSG_DEBUG, "wpa_driver_tista_associate: BSSID=" MACSTR, + if (params->freq) + wpa_driver_wext_set_freq(drv->wext, params->freq); + + ret = wpa_driver_wext_set_ssid(drv->wext, params->ssid, params->ssid_len); + if (params->bssid) { + wpa_printf(MSG_DEBUG, "wpa_driver_tista_associate: BSSID=" MACSTR, MAC2STR(params->bssid)); /* if there is bssid -> set it */ - if( os_memcmp( params->bssid, "\x00\x00\x00\x00\x00\x00", ETH_ALEN ) != 0 ) { - wpa_driver_wext_set_bssid( drv->wext, params->bssid ); + if (os_memcmp(params->bssid, "\x00\x00\x00\x00\x00\x00", ETH_ALEN) != 0) { + wpa_driver_wext_set_bssid(drv->wext, params->bssid); } } - return wpa_driver_wext_set_ssid(drv->wext, params->ssid, params->ssid_len); + return ret; } static int wpa_driver_tista_set_operstate(void *priv, int state) @@ -1175,42 +1381,6 @@ static int wpa_driver_tista_set_operstate(void *priv, int state) return wpa_driver_wext_set_operstate(drv->wext, state); } -#ifdef CONFIG_WPS -static int wpa_driver_tista_set_wsc_mode(void *priv, const u32 WscMode, const void* probeReqBuf, int probeReqBufLen) -{ - struct wpa_driver_ti_data *drv = priv; - struct iwreq iwr; - ti_private_cmd_t private_cmd; - TWscMode WcsModeStruct; - int ret = 0; - - WcsModeStruct.WSCMode = WscMode; - memset(WcsModeStruct.probeReqWSCIE, 0, DOT11_WSC_PROBE_REQ_MAX_LENGTH); - memcpy(WcsModeStruct.probeReqWSCIE, probeReqBuf, probeReqBufLen); - - private_cmd.cmd = SITE_MGR_SIMPLE_CONFIG_MODE; - private_cmd.flags = PRIVATE_CMD_SET_FLAG; - private_cmd.in_buffer = &WcsModeStruct; - private_cmd.in_buffer_len = sizeof(TWscMode); - private_cmd.out_buffer = NULL; - private_cmd.out_buffer_len = 0; - - os_memset(&iwr, 0, sizeof(iwr)); - os_strncpy(iwr.ifr_name, drv->ifname, IFNAMSIZ); - - iwr.u.data.pointer = &private_cmd; - iwr.u.data.length = sizeof(ti_private_cmd_t); - iwr.u.data.flags = 0; - - if (ioctl(drv->ioctl_sock, SIOCIWFIRSTPRIV, &iwr) < 0) { - perror("ioctl[SIOCIWFIRSTPRIV]"); - ret = -1; - } - - return ret; -} -#endif /* CONFIG_WPS */ - const struct wpa_driver_ops wpa_driver_custom_ops = { .name = TIWLAN_DRV_NAME, .desc = "TI Station Driver (1271)", @@ -1221,7 +1391,11 @@ const struct wpa_driver_ops wpa_driver_custom_ops = { .set_countermeasures = wpa_driver_tista_set_countermeasures, .set_drop_unencrypted = wpa_driver_tista_set_drop_unencrypted, .scan = wpa_driver_tista_scan, +#ifdef WPA_SUPPLICANT_VER_0_6_X + .get_scan_results2 = wpa_driver_tista_get_scan_results, +#else .get_scan_results = wpa_driver_tista_get_scan_results, +#endif .deauthenticate = wpa_driver_tista_deauthenticate, .disassociate = wpa_driver_tista_disassociate, .associate = wpa_driver_tista_associate, @@ -1233,8 +1407,9 @@ const struct wpa_driver_ops wpa_driver_custom_ops = { .remove_pmkid = wpa_driver_tista_remove_pmkid, .flush_pmkid = wpa_driver_tista_flush_pmkid, .set_operstate = wpa_driver_tista_set_operstate, -#ifdef CONFIG_WPS - .set_wsc_mode = wpa_driver_tista_set_wsc_mode, -#endif /* CONFIG_WPS */ +#ifdef WPA_SUPPLICANT_VER_0_6_X + .set_mode = wpa_driver_tista_set_mode, + .set_probe_req_ie = wpa_driver_tista_set_probe_req_ie, +#endif .driver_cmd = wpa_driver_tista_driver_cmd }; diff --git a/wl1271/wpa_supplicant_lib/driver_ti.h b/wl1271/wpa_supplicant_lib/driver_ti.h index ab36ab30..c60d43e3 100644 --- a/wl1271/wpa_supplicant_lib/driver_ti.h +++ b/wl1271/wpa_supplicant_lib/driver_ti.h @@ -29,14 +29,16 @@ #include "driver.h" #include "l2_packet.h" #include "eloop.h" -#include "wpa_supplicant.h" #include "priv_netlink.h" #include "driver_wext.h" -#include "wpa.h" #include "wpa_ctrl.h" #include "wpa_supplicant_i.h" #include "config.h" - +#ifdef WPA_SUPPLICANT_VER_0_6_X +#include "ieee802_11_defs.h" +#else +#include "wpa.h" +#endif #include "cu_ostypes.h" #include "STADExternalIf.h" #include "convert.h" @@ -53,6 +55,8 @@ #define RX_IPV4_MULTICAST_FILTER 2 #define RX_IPV6_MULTICAST_FILTER 3 +#define MAX_NUMBER_SEQUENTIAL_ERRORS 4 + typedef enum { BLUETOOTH_COEXISTENCE_MODE_ENABLED = 0, BLUETOOTH_COEXISTENCE_MODE_DISABLED, @@ -73,5 +77,9 @@ struct wpa_driver_ti_data { u32 btcoex_mode; /* BtCoex Mode */ int last_scan; /* Last scan type */ SHLIST scan_merge_list; /* Previous scan list */ +#ifdef CONFIG_WPS + struct wpabuf *probe_req_ie; /* Store the latest probe_req_ie for WSC */ +#endif + int errors; /* Number of sequential errors */ }; #endif |