diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2008-12-17 18:08:10 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2008-12-17 18:08:10 -0800 |
commit | b646ee4ff2d88f4481b1cced9b480f3b9abc0d71 (patch) | |
tree | e0b79f0306fd7e261488a67f7b0b42b43e5b39e6 | |
parent | 607e8a019b921eee008cd1e9ffc132318fabce7f (diff) | |
download | ti-b646ee4ff2d88f4481b1cced9b480f3b9abc0d71.tar.gz |
Code drop from //branches/cupcake/...@124589
-rw-r--r-- | Android.mk | 8 | ||||
-rw-r--r-- | sta_dk_4_0_4_32/Makefile | 2 | ||||
-rw-r--r-- | sta_dk_4_0_4_32/common/src/core/data_ctrl/Rx/rx.c | 38 | ||||
-rw-r--r-- | sta_dk_4_0_4_32/common/src/utils/memMngrEx.c | 2 | ||||
-rw-r--r-- | sta_dk_4_0_4_32/fw/Android.mk | 18 | ||||
-rw-r--r-- | sta_dk_4_0_4_32/fw/tiwlan.ini | 216 | ||||
-rw-r--r-- | sta_dk_4_0_4_32/pform/linux/inc/esta_drv.h | 19 | ||||
-rw-r--r-- | sta_dk_4_0_4_32/pform/linux/src/esta_drv.c | 143 | ||||
-rw-r--r-- | sta_dk_4_0_4_32/pform/linux/src/osapi.c | 25 | ||||
-rwxr-xr-x | sta_dk_4_0_4_32/pform/linux/src/tnetw_sdio.c | 48 | ||||
-rw-r--r-- | wpa_supplicant_lib/Android.mk | 40 | ||||
-rw-r--r-- | wpa_supplicant_lib/driver_ti.c | 318 | ||||
-rw-r--r-- | wpa_supplicant_lib/driver_ti.h | 3 |
13 files changed, 770 insertions, 110 deletions
@@ -15,5 +15,11 @@ # ifneq ($(TARGET_SIMULATOR),true) - include $(all-subdir-makefiles) + system_wlan_ti_path := $(my-dir) + # The board config file for the product must define BOARD_WLAN_TI_STA_DK_ROOT + # in order to build the TI wlan components. + ifdef BOARD_WLAN_TI_STA_DK_ROOT + include $(BOARD_WLAN_TI_STA_DK_ROOT)/Android.mk + include $(system_wlan_ti_path)/wpa_supplicant_lib/Android.mk + endif endif diff --git a/sta_dk_4_0_4_32/Makefile b/sta_dk_4_0_4_32/Makefile index 7404f8c..16120bd 100644 --- a/sta_dk_4_0_4_32/Makefile +++ b/sta_dk_4_0_4_32/Makefile @@ -107,7 +107,7 @@ ifneq ($(KERNELRELEASE),) # Intermediate object name - this should be converted to the appropriate library file # after the kernel makefile finishes its work. # - obj-$(CONFIG_TIWLAN1251) += wlan.o + obj-m += wlan.o # # List of object files the kernel makefile needs to compile. diff --git a/sta_dk_4_0_4_32/common/src/core/data_ctrl/Rx/rx.c b/sta_dk_4_0_4_32/common/src/core/data_ctrl/Rx/rx.c index 3f69157..c3875a8 100644 --- a/sta_dk_4_0_4_32/common/src/core/data_ctrl/Rx/rx.c +++ b/sta_dk_4_0_4_32/common/src/core/data_ctrl/Rx/rx.c @@ -46,6 +46,7 @@ #include "rx.h" #include "osApi.h" #include "DataCtrl_Api.h" +#include "Ctrl.h" #include "802_11Defs.h" #include "Ethernet.h" #include "report.h" @@ -376,7 +377,7 @@ TI_STATUS rxData_stop(TI_HANDLE hRxData) **************************************************************************** * DESCRIPTION: get a specific parameter * -* INPUTS: hTxData - the object +* INPUTS: hRxData - the object * * OUTPUT: pParamInfo - structure which include the value of * the requested parameter @@ -444,11 +445,11 @@ TI_STATUS rxData_getParam(TI_HANDLE hRxData, paramInfo_t *pParamInfo) } /*************************************************************************** -* txData_setParam * +* rxData_setParam * **************************************************************************** * DESCRIPTION: set a specific parameter * -* INPUTS: hTxData - the object +* INPUTS: hRxData - the object * pParamInfo - structure which include the value to set for * the requested parameter * @@ -972,7 +973,7 @@ TI_STATUS rxData_UnRegNotif(TI_HANDLE hRxData,TI_HANDLE RegEventHandle) * DESCRIPTION: this function is called by the GWSI for each received msdu. * It filter and distribute the received msdu. * -* INPUTS: hTxData - the object +* INPUTS: hRxData - the object * pMsdu - the received msdu. * pRxAttr - Rx attributes * @@ -1065,7 +1066,7 @@ void rxData_receiveMsduFromWlan(TI_HANDLE hRxData, mem_MSDU_T *pMsdu, Rx_attr_t* * it dispatches the packet to the approciate function according to * data packet type and rx port status. * -* INPUTS: hTxData - the object +* INPUTS: hRxData - the object * pMsdu - the received msdu. * pRxAttr - Rx attributes * @@ -1218,7 +1219,7 @@ static void rxData_discardMsduVlan(TI_HANDLE hRxData, mem_MSDU_T *pMsdu, Rx_attr * DESCRIPTION: this function is called upon receving data Eapol packet type * while rx port status is "open notify" * -* INPUTS: hTxData - the object +* INPUTS: hRxData - the object * pMsdu - the received msdu. * pRxAttr - Rx attributes * @@ -1248,7 +1249,7 @@ static void rxData_rcvMsduInOpenNotify(TI_HANDLE hRxData, mem_MSDU_T *pMsdu, Rx_ * DESCRIPTION: this function is called upon receving data Eapol packet type * while rx port status is "open eapol" * -* INPUTS: hTxData - the object +* INPUTS: hRxData - the object * pMsdu - the received msdu. * pRxAttr - Rx attributes * @@ -1281,7 +1282,7 @@ static void rxData_rcvMsduEapol(TI_HANDLE hRxData, mem_MSDU_T *pMsdu, Rx_attr_t* * DESCRIPTION: this function is called upon receving data "data" packet type * while rx port status is "open" * -* INPUTS: hTxData - the object +* INPUTS: hRxData - the object * pMsdu - the received msdu. * pRxAttr - Rx attributes * @@ -1297,7 +1298,7 @@ static void rxData_rcvMsduData(TI_HANDLE hRxData, mem_MSDU_T *pMsdu, Rx_attr_t* rxData_t *pRxData = (rxData_t *)hRxData; EthernetHeader_t *pEthernetHeader; UINT16 EventMask = 0; - + ctrlData_t *pCtrlData; WLAN_REPORT_INFORMATION(pRxData->hReport, RX_DATA_MODULE_LOG, (" rxData_rcvMsduData() : Received DATA frame tranferred to OS\n")); @@ -1333,6 +1334,21 @@ static void rxData_rcvMsduData(TI_HANDLE hRxData, mem_MSDU_T *pMsdu, Rx_attr_t* wlan_memMngrFreeMSDU(pRxData->hMemMngr, memMgr_MsduHandle(pMsdu)); 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." + */ + pCtrlData = (ctrlData_t *)pRxData->hCtrlData; + if (IsMacAddressEqual(&pCtrlData->ctrlDataDeviceMacAddress, &pEthernetHeader->SrcAddr)) + { + pRxData->rxDataDbgCounters.excludedFrameCounter++; + /* free msdu */ + wlan_memMngrFreeMSDU(pRxData->hMemMngr, memMgr_MsduHandle(pMsdu)); + return; + } } /* update traffic monitor parameters */ @@ -1399,7 +1415,7 @@ static void rxData_rcvMsduData(TI_HANDLE hRxData, mem_MSDU_T *pMsdu, Rx_attr_t* * DESCRIPTION: this function is called upon receving data IAPP packet type * while rx port status is "open" * -* INPUTS: hTxData - the object +* INPUTS: hRxData - the object * pMsdu - the received msdu. * pRxAttr - Rx attributes * @@ -1437,7 +1453,7 @@ static void rxData_rcvMsduIapp(TI_HANDLE hRxData, mem_MSDU_T *pMsdu, Rx_attr_t* * DESCRIPTION: this function convert the msdu header from 802.11 header * format to ethernet format * -* INPUTS: hTxData - the object +* INPUTS: hRxData - the object * pMsdu - msdu in 802.11 format * * OUTPUT: pMsdu - msdu in ethernet format diff --git a/sta_dk_4_0_4_32/common/src/utils/memMngrEx.c b/sta_dk_4_0_4_32/common/src/utils/memMngrEx.c index 6fc7265..e399080 100644 --- a/sta_dk_4_0_4_32/common/src/utils/memMngrEx.c +++ b/sta_dk_4_0_4_32/common/src/utils/memMngrEx.c @@ -74,7 +74,7 @@ TI_HANDLE wlan_memMngrInit(TI_HANDLE hOs) /* structures for initialization of Memory manager */ pMemMngrInit.numOfPools = DEF_NUMBER_OF_BUF_POOLS; pMemMngrInit.bufPoolInit[0].buffersSize = DEF_BUFFER_LENGTH_POOL_1; - pMemMngrInit.bufPoolInit[0].numOfbuffers = DEF_NUMBER_OF_BUFFERS_IN_POOL_1 ; + pMemMngrInit.bufPoolInit[0].numOfbuffers = DEF_NUMBER_OF_BUFFERS_IN_POOL_1; pMemMngrInit.bufPoolInit[1].buffersSize = DEF_BUFFER_LENGTH_POOL_2; pMemMngrInit.bufPoolInit[1].numOfbuffers = DEF_NUMBER_OF_BUFFERS_IN_POOL_2; pMemMngrInit.bufPoolInit[2].buffersSize = DEF_BUFFER_LENGTH_POOL_3; diff --git a/sta_dk_4_0_4_32/fw/Android.mk b/sta_dk_4_0_4_32/fw/Android.mk new file mode 100644 index 0000000..0ebbbae --- /dev/null +++ b/sta_dk_4_0_4_32/fw/Android.mk @@ -0,0 +1,18 @@ +# +# Install firmware file for WiFi +# + +# where to install the file on the device +# +local_target_dir := $(TARGET_OUT_ETC)/wifi +LOCAL_PATH := $(call my-dir) + +######################## +include $(CLEAR_VARS) +LOCAL_MODULE := tiwlan.ini +LOCAL_MODULE_TAGS := user development +LOCAL_MODULE_CLASS := ETC +LOCAL_MODULE_PATH := $(local_target_dir) +LOCAL_SRC_FILES := $(LOCAL_MODULE) +include $(BUILD_PREBUILT) +######################## diff --git a/sta_dk_4_0_4_32/fw/tiwlan.ini b/sta_dk_4_0_4_32/fw/tiwlan.ini new file mode 100644 index 0000000..d5fdd90 --- /dev/null +++ b/sta_dk_4_0_4_32/fw/tiwlan.ini @@ -0,0 +1,216 @@ +EEPROMlessModeSupported = 1 # 0 = disable epromless support / 1 = Enable +WME_Enable = 1 # 0 = diable WME support / 1 = Enable +dot11NetworkType = 3 # 2 - A only mode, 3 - B/G mode, 4 - A/G Dual mode +RecoveryEnable = 1 # 0 - Disabled, 1 - Enabled +TriggerFcs = 0 # 0 - Disabled, 1 - Enabled +dot11FragmentationThreshold = 4096 +dot11RTSThreshold = 4096 +WPAMixedMode = 1 +RSNPreAuthentication = 1 + +CalibrationChannel24 = 1 +CalibrationChannel5 = 36 + +# Regulatury Domain tables. +# Each byte correlates to one channel in sequential order. Table 2.4 starts from channel 1, Table 5.0 starts from channel 36. +# Bits 0..4 - Max power allowed in Dbm. +# Bit 6 - Channel is allowed for Active scan +# BIt 7 - Channel is allowed +AllowedChannelsTable24 = FFFFFFFFFFFFFFFFFFFFFFFFFFFF +AllowedChannelsTable5 = FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF0000000000000000000000000000000000000000000000000000000000000000000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF0000000000000000FF000000FF000000FF000000FF00000000000000000000000000000000000000 + + + +SpectrumManagement = 0 # 0 - Disable 802.11h, 1 - Enable + +RxBroadcastInPs = 1 + +FirstConnScanEnabled = 1 # 0 - Disable , 1 - Enable + +#arp ip filter +ArpIp_Addr = c0 a8 00 5e +ArpIp_Filter_ena = 0 + + +#mac filter +Mac_Filter_Enabled = 0 +numGroupAddrs = 4 +Group_addr0 = 10 01 02 03 04 05 +Group_addr1 = 11 11 12 13 14 15 +Group_addr2 = 12 21 22 23 24 25 +Group_addr3 = 13 31 32 33 34 35 +Group_addr4 = 14 41 42 43 44 45 +Group_addr5 = 15 51 52 53 54 55 +Group_addr6 = 16 61 62 63 64 65 +Group_addr7 = 17 71 72 73 74 75 + +#beacon filter +Beacon_Filter_Desired_State = 1 +Beacon_Filter_Stored = 1 + +#beacon IE table +#the size is the len of the string - spaces = number of bytes +Beacon_IE_Num_Of_Elem = 15 +Beacon_IE_Table_Size = 35 +Beacon_IE_Table = 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 85 01 dd 00 52 f2 02 00 01 + +#Rate adaptation +RateContThreshold = 10 +RateStepUpThreshold = 2 +FBShortInterval = 40 +FBLongInterval = 200 +RateAdaptationTimeout = 300 + +# rate policy - short / long retries +RatePolicyUserShortRetryLimit = 10 +RatePolicyUserLongRetryLimit = 10 + +#rate policies +RatePolicyUserRetriesPerRateCck = 1,1,1,1,1,1,1,1,1,1,1,1,1 +RatePolicyUserRetriesPerRatePbcc = 1,1,1,1,1,1,1,1,1,1,1,1,1 +RatePolicyUserRetriesPerRateOfdm = 0,0,0,1,0,0,0,1,0,0,1,1,1 +RatePolicyUserRetriesPerRateOfdmA = 0,0,0,1,0,0,1,0,0,1,0,0,0 + +RatePolicySGRetriesPerRateCck = 1,1,1,1,1,1,1,5,1,1,1,1,1 +RatePolicySGRetriesPerRatePbcc = 1,1,1,1,1,1,1,5,1,1,1,1,1 +RatePolicySGRetriesPerRateOfdm = 1,1,1,1,1,1,1,5,1,1,1,1,1 +RatePolicySGRetriesPerRateOfdmA = 1,1,1,1,1,1,1,5,1,1,1,1,1 + +# +# Power Manager +# +BeaconListenInterval = 1 # the number of N-Beacon or N-DTim +DtimListenInterval = 1 # Dm: Different value causes DHCP problem + +dot11PowerMode = 0 # 0 - Auto + # 1 - Active + # 2 - Short Doze + # 3 - Long Doze + +PowerMgmtHangOverPeriod = 5 # in mSec units + +AutoPowerModeDozeMode = 2 # 2 - Short Doze + # 3 - Long Doze + +AutoPowerModeActiveTh = 15 # packets per second + +AutoPowerModeDozeTh = 8 # packets per seconds - threshold for entering ELP in Auto mode + + + +defaultPowerLevel = 0 # 0 - ELP + # 1 - PD + # 2 - AWAKE + +PowerSavePowerLevel = 0 # 0 - ELP + # 1 - PD + # 2 - AWAKE + + +OsDbgState = 0x01e9003c # -1 or 0xffffffff -all (opens debug messages in o.s. only - sevirity+modules) + +############################################################# +# Configure the severity table (0 = Disable/ 1 = Enable) +# +# Byte #0: Init +# Byte #1: Information +# Byte #2: Warning +# Byte #3: Error +# Byte #4: Fatal Error +# Byte #5: SM +# Byte #6: Console +# Byte #7: Debug RX +# Byte #8: Debug TX +# Byte #9: Debug Control +# Byte #10: Debug GWSI Recording +############################################################# + +ReportSeverityTable = "00011010000" + + +BeaconReceiveTime = 50 + +# +# Default Driver Scan Parameters for BG band +# +FirstConnScanBandB_ChannelList = 1,2,3,4,5,6,7,8,9,10,11,12,13,14 # channel list to scan seperated with comma +FirstConnScanBandB_MinDwellTime = 30000 # Min dwell time in micro seconds +FirstConnScanBandB_MaxDwellTime = 60000 # Max dwell time in micro seconds +FirstConnScanBandB_NumOfProbReqs = 3 # Number of prob request +FirstConnScanBandB_ProbReqRate = 2 # Prob request rate +FirstConnScanBandB_TxPowerLevel = 255 # Tx power for every prob request - Dbm/10 units + +# Default Driver Scan Parameters for A band +FirstConnScanBandA_ChannelList = 36,40,44,48,52,56,60,64,100,104,108,112,149,153,157,161 # channel list to scan seperated with comma +FirstConnScanBandA_MinDwellTime = 30000 # Min dwell time in micro seconds +FirstConnScanBandA_MaxDwellTime = 60000 # Max dwell time in micro seconds +FirstConnScanBandA_NumOfProbReqs = 3 # Number of prob request +FirstConnScanBandA_ProbReqRate = 32 # Prob request rate +FirstConnScanBandA_TxPowerLevel = 255 # Tx power for every prob request - Dbm/10 units + +# +# QOS UPSD +# + +desiredPsMode = 0 # Global Power save delivery protocol (1 - UPSD, 0 - Legacy) +QOS_wmePsModeBE = 0 # Power save delivery protocol for BE AC (1 - UPSD, 0 - Legacy) +QOS_wmePsModeBK = 0 # Power save delivery protocol for BK AC (1 - UPSD, 0 - Legacy) +QOS_wmePsModeVI = 0 # Power save delivery protocol for VI AC (1 - UPSD, 0 - Legacy) +QOS_wmePsModeVO = 0 # Power save delivery protocol for VO AC (1 - UPSD, 0 - Legacy) + +# QOS_PacketBurstEnable = 1 # Packet Burst for non-QOS protocol + +# +# QOS Classifier +# +Clsfr_Type = 1 # 1 - DSCP, 2 - Port, 3 - IP+port + +NumOfDstIPPortClassifiers = 3 # number of classifier entries + +IPPortClassifier00_IPAddress = 0a 03 89 02 # IP address 10.3.137.2 +IPPortClassifier00_Port = 5001 # Port 5001 +IPPortClassifier00_DTag = 1 # User priority 1 + +IPPortClassifier01_IPAddress = 0a 03 89 02 # IP address 10.3.137.2 +IPPortClassifier01_Port = 5002 # Port 5002 +IPPortClassifier01_DTag = 4 # User priority 4 + +IPPortClassifier02_IPAddress = 0a 03 89 02 # IP address 10.3.137.2 +IPPortClassifier02_Port = 5003 # Port 5003 +IPPortClassifier02_DTag = 6 # User priority 6 + + +NumOfCodePoints = 4 +DSCPClassifier00_CodePoint = 0 #Best Effort +DSCPClassifier00_DTag = 0 + +DSCPClassifier01_CodePoint = 8 #Background +DSCPClassifier01_DTag = 1 + +DSCPClassifier02_CodePoint = 40 #Video +DSCPClassifier02_DTag = 5 + +DSCPClassifier03_CodePoint = 56 #Voice +DSCPClassifier03_DTag = 7 + +dot11MaxReceiveLifetime=512000 +FracOfLifeTimeToDrop = 50 + +WiFiAdhoc = 0 +WiFiWmmPS = 0 # Use 1 on WiFi test in order to configure PS to work in WMM mode + +EarlyWakeUp = 1 # 0 - Disable , 1 - Enable + +TxEnergyDetection = 0 # Use 1 for enabling + +TriggeredScanTimeOut = 50000 # Maximum time in Us between 2 channels on triggered scan +# PsPoll delivery failure solution +PsPollDeliveryFailureRecoveryPeriod = 20 # Time in Ms to stay ACTIVE ('0' to disable feature) +ConsecutivePsPollDeliveryFailureThreshold = 4 # Number of failed PsPoll's to start ACTIVE time out + +# BT Coexistence configuration +BThWlanCoexistEnable = 2 # 0 - SG_ENABLE + # 1 - SG_DISABLE (default) + # 2 - SG_SENSE (auto-detect activity) +# BThWlanCoexistParamsallowPaSdToggleDuringBtActivityEnable = 0 # 0 + # 1 - (default) diff --git a/sta_dk_4_0_4_32/pform/linux/inc/esta_drv.h b/sta_dk_4_0_4_32/pform/linux/inc/esta_drv.h index 8e9c07d..b181124 100644 --- a/sta_dk_4_0_4_32/pform/linux/inc/esta_drv.h +++ b/sta_dk_4_0_4_32/pform/linux/inc/esta_drv.h @@ -44,7 +44,15 @@ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) #include <asm/arch/gpio.h> #else -#include <mach/gpio.h> +#include <asm/gpio.h> +#endif + +#ifdef CONFIG_TROUT_PWRSINK +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) +#include <asm/arch/trout_pwrsink.h> +#else +#include <mach/trout_pwrsink.h> +#endif #endif #ifdef CONFIG_ANDROID_POWER @@ -64,9 +72,18 @@ #define TIWLAN_DRV_NAME_WIRELESS_PROTO "IEEE 802.11-DS" #ifdef TIWLAN_MSM7000 +#ifdef CONFIG_WIFI_CONTROL_FUNC +#include <linux/platform_device.h> +#include <mach/msm_wifi.h> +int msm_wifi_power(int on); +int msm_wifi_reset(int on); +#else extern int trout_wifi_power(int on); extern void trout_wifi_reset(int on); extern void trout_wifi_set_carddetect(int val); +#define msm_wifi_power(a) trout_wifi_power(a) +#define msm_wifi_reset(a) trout_wifi_reset(a) +#endif #endif #ifndef TIWLAN_OMAP1610_REGBASE diff --git a/sta_dk_4_0_4_32/pform/linux/src/esta_drv.c b/sta_dk_4_0_4_32/pform/linux/src/esta_drv.c index 801e514..6cb428a 100644 --- a/sta_dk_4_0_4_32/pform/linux/src/esta_drv.c +++ b/sta_dk_4_0_4_32/pform/linux/src/esta_drv.c @@ -107,7 +107,6 @@ #include "tiwlan_profile.h" #ifdef CONFIG_TROUT_PWRSINK -#include <asm/arch/trout_pwrsink.h> #define RX_RATE_INTERVAL_SEC 10 unsigned long num_rx_pkt_new = 0; static unsigned long num_rx_pkt_last = 0; @@ -118,6 +117,9 @@ extern unsigned char *get_wifi_nvs_ram(void); extern void SDIO_SetFunc( struct sdio_func * ); static struct proc_dir_entry *tiwlan_calibration; static struct completion sdio_wait; +#ifdef CONFIG_WIFI_CONTROL_FUNC +static struct wifi_platform_data *wifi_control_data = NULL; +#endif #endif /* Drivers list */ @@ -1198,15 +1200,15 @@ int tiwlan_init_drv (tiwlan_net_dev_t *drv, tiwlan_dev_init_t *init_info) #endif/*I_MEM_ALLOC_TRACE*/ if (!init_table) { - ti_dprintf(TIWLAN_LOG_ERROR, "Cannot allocate init_table\n"); - return -ENOMEM; + ti_dprintf(TIWLAN_LOG_ERROR, "Cannot allocate init_table\n"); + return -ENOMEM; } if (init_info) { - drv->eeprom_image.size = init_info->eeprom_image_length; + drv->eeprom_image.size = init_info->eeprom_image_length; if (drv->eeprom_image.size) - { + { drv->eeprom_image.va = os_memoryAlloc (drv, drv->eeprom_image.size); #ifdef TI_MEM_ALLOC_TRACE @@ -1219,29 +1221,29 @@ int tiwlan_init_drv (tiwlan_net_dev_t *drv, tiwlan_dev_init_t *init_info) return -ENOMEM; } memcpy (drv->eeprom_image.va, &init_info->data[0], drv->eeprom_image.size ); - } + } #ifdef FIRMWARE_DYNAMIC_LOAD drv->firmware_image.size = init_info->firmware_image_length; - if (!drv->firmware_image.size) - { + if (!drv->firmware_image.size) + { ti_dprintf (TIWLAN_LOG_ERROR, "No firmware image\n"); - return -EINVAL; - } + return -EINVAL; + } drv->firmware_image.va = os_memoryAlloc (drv,drv->firmware_image.size); #ifdef TI_MEM_ALLOC_TRACE osPrintf ("MTT:%s:%d ::kmalloc(%lu, %x) : %lu\n", __FUNCTION__, __LINE__, drv->firmware_image.size, GFP_KERNEL, drv->firmware_image.size); #endif if (!drv->firmware_image.va) - { - ti_dprintf(TIWLAN_LOG_ERROR, "Cannot allocate buffer for firmware image\n"); - drv->firmware_image.size = 0; + { + ti_dprintf(TIWLAN_LOG_ERROR, "Cannot allocate buffer for firmware image\n"); + drv->firmware_image.size = 0; if (drv->eeprom_image.va) os_memoryFree (drv, drv->eeprom_image.va, drv->eeprom_image.size); - return -ENOMEM; - } + return -ENOMEM; + } memcpy (drv->firmware_image.va, - &init_info->data[init_info->eeprom_image_length], + &init_info->data[init_info->eeprom_image_length], drv->firmware_image.size); #else extern unsigned char tiwlan_fwimage[]; @@ -1256,23 +1258,23 @@ int tiwlan_init_drv (tiwlan_net_dev_t *drv, tiwlan_dev_init_t *init_info) drv->eeprom_image.va, drv->eeprom_image.size, drv->firmware_image.va, - drv->firmware_image.size); + drv->firmware_image.size); /* Init defaults */ if ((rc = osInitTable_IniFile (drv, init_table, - (init_info && init_info->init_file_length) ? - &init_info->data[init_info->eeprom_image_length+init_info->firmware_image_length] : NULL, - init_info ? init_info->init_file_length : 0))) - { + (init_info && init_info->init_file_length) ? + &init_info->data[init_info->eeprom_image_length+init_info->firmware_image_length] : NULL, + init_info ? init_info->init_file_length : 0))) + { ti_dprintf (TIWLAN_LOG_ERROR, "osInitTable_IniFile failed :cannot initialize defaults\n"); os_memoryFree (drv, init_table, sizeof(initTable_t)); #ifdef TI_MEM_ALLOC_TRACE os_printf("MTT:%s:%d ::kfree(0x%p) : %d\n", __FUNCTION__, __LINE__, sizeof(initTable_t), -sizeof(initTable_t)); #endif - return rc; - } + return rc; + } pWLAN_Images[0] = (void *)drv->firmware_image.va; pWLAN_Images[1] = (void *)drv->firmware_image.size; @@ -1283,6 +1285,16 @@ int tiwlan_init_drv (tiwlan_net_dev_t *drv, tiwlan_dev_init_t *init_info) pWLAN_Images, init_table, (macAddress_t *) &drv->adapter.CurrentAddr); + if (!(drv->adapter.CoreHalCtx)) + { +#ifdef FIRMWARE_DYNAMIC_LOAD + os_memoryFree(drv,drv->firmware_image.va, drv->firmware_image.size); + os_memoryFree (drv, drv->eeprom_image.va, drv->eeprom_image.size); +#endif + os_memoryFree (drv, init_table, sizeof(initTable_t)); + ti_dprintf(TIWLAN_LOG_ERROR, "Cannot allocate CoreHalCtx\n"); + return -ENOMEM; + } drv->interrupt_pending = 0; drv->dma_done = 0; @@ -1815,6 +1827,79 @@ static struct sdio_driver tiwlan_sdio_drv = { .name = "sdio_tiwlan", .id_table = tiwlan_sdio_ids, }; + +#ifdef CONFIG_WIFI_CONTROL_FUNC +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__); + if( wifi_ctrl ) { + wifi_control_data = wifi_ctrl; + 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) */ + } + 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) */ + if( wifi_ctrl->set_reset ) + wifi_ctrl->set_reset(1); /* Reset active */ + if( wifi_ctrl->set_power ) + wifi_ctrl->set_power(0); /* Power Off */ + } + return 0; +} + +static struct platform_driver wifi_device = { + .probe = wifi_probe, + .remove = wifi_remove, + .suspend = NULL, + .resume = NULL, + .driver = { + .name = "msm_wifi", + }, +}; + +static int wifi_add_dev( void ) +{ + return platform_driver_register( &wifi_device ); +} + +static void wifi_del_dev( void ) +{ + platform_driver_unregister( &wifi_device ); +} + +int msm_wifi_power( int on ) +{ + printk("%s\n", __FUNCTION__); + if( wifi_control_data && wifi_control_data->set_power ) { + wifi_control_data->set_power(on); + } + return 0; +} + +int msm_wifi_reset( int on ) +{ + printk("%s\n", __FUNCTION__); + if( wifi_control_data && wifi_control_data->set_reset ) { + wifi_control_data->set_reset(on); + } + return 0; +} +#endif #endif /* TIWLAN_MSM7000 */ static int __init tiwlan_module_init(void) @@ -1848,9 +1933,13 @@ static int __init tiwlan_module_init(void) return rc; #elif defined(TIWLAN_MSM7000) +#ifdef CONFIG_WIFI_CONTROL_FUNC + wifi_add_dev(); +#else trout_wifi_power(1); /* Power On */ trout_wifi_reset(0); /* Reset clear */ trout_wifi_set_carddetect(1); /* CardDetect (0->1) */ +#endif /* Register ourselves as an SDIO driver */ rc = sdio_register_driver(&tiwlan_sdio_drv); @@ -1871,9 +1960,13 @@ static int __init tiwlan_module_init(void) printk(KERN_ERR "%s: Timed out waiting for device detect\n", __func__); remove_proc_entry("calibration", NULL); sdio_unregister_driver(&tiwlan_sdio_drv); +#ifdef CONFIG_WIFI_CONTROL_FUNC + wifi_del_dev(); +#else trout_wifi_set_carddetect(0); /* CardDetect (1->0) */ trout_wifi_reset(1); /* Reset active */ trout_wifi_power(0); /* Power Off */ +#endif return -ENODEV; } printk(KERN_INFO "TIWLAN: Driver loaded\n"); @@ -1905,9 +1998,13 @@ static void __exit tiwlan_module_cleanup(void) #ifdef TIWLAN_MSM7000 remove_proc_entry("calibration", NULL); sdio_unregister_driver(&tiwlan_sdio_drv); +#ifdef CONFIG_WIFI_CONTROL_FUNC + wifi_del_dev(); +#else trout_wifi_set_carddetect(0); /* CardDetect (1->0) */ trout_wifi_reset(1); /* Reset active */ trout_wifi_power(0); /* Power Off */ +#endif #endif printk(KERN_INFO "TIWLAN: Driver unloaded\n"); } diff --git a/sta_dk_4_0_4_32/pform/linux/src/osapi.c b/sta_dk_4_0_4_32/pform/linux/src/osapi.c index 6378b2e..ee7c270 100644 --- a/sta_dk_4_0_4_32/pform/linux/src/osapi.c +++ b/sta_dk_4_0_4_32/pform/linux/src/osapi.c @@ -50,9 +50,6 @@ #include <linux/time.h> #include <linux/list.h> #include <asm/io.h> -#ifdef CONFIG_TROUT_PWRSINK -#include <asm/arch/trout_pwrsink.h> -#endif #include "debug_module.h" #include "esta_drv.h" @@ -840,23 +837,23 @@ os_hardResetTnetw( void ) */ /* direction out */ #ifdef TIWLAN_OMAP1610 - omap_set_gpio_direction(GPIO_16, GPIO_16_DIRECTION_OUTPUT); + omap_set_gpio_direction(GPIO_16, GPIO_16_DIRECTION_OUTPUT); - /* clear reset WLAN chip */ - omap_set_gpio_dataout(GPIO_16, GPIO_16_CLEAR); + /* clear reset WLAN chip */ + omap_set_gpio_dataout(GPIO_16, GPIO_16_CLEAR); - /* wait for 50msec */ + /* wait for 50msec */ mdelay(50); - omap_set_gpio_dataout(GPIO_16, GPIO_16_SET); + omap_set_gpio_dataout(GPIO_16, GPIO_16_SET); - /* wait for 50msec */ - mdelay(50); + /* wait for 50msec */ + mdelay(50); #endif /* Dm: */ #ifdef TIWLAN_MSM7000 - trout_wifi_reset(1); /* Reset active */ - trout_wifi_power(0); /* Power disable */ - trout_wifi_power(1); /* Power enable */ - trout_wifi_reset(0); /* Reset clear */ + msm_wifi_reset(1); /* Reset active */ + msm_wifi_power(0); /* Power disable */ + msm_wifi_power(1); /* Power enable */ + msm_wifi_reset(0); /* Reset clear */ #endif } diff --git a/sta_dk_4_0_4_32/pform/linux/src/tnetw_sdio.c b/sta_dk_4_0_4_32/pform/linux/src/tnetw_sdio.c index ac72619..bc88b9c 100755 --- a/sta_dk_4_0_4_32/pform/linux/src/tnetw_sdio.c +++ b/sta_dk_4_0_4_32/pform/linux/src/tnetw_sdio.c @@ -25,12 +25,17 @@ #include "esta_drv.h" #include "mmc_omap_api.h" #include "osApi.h" +#define DM_DMA_WORKAROUND /*-------------------------------------------------------------------*/ extern int tiwlan_sdio_init(struct sdio_func *func); extern int sdio_reset_comm(struct mmc_card *card); /*-------------------------------------------------------------------*/ static struct sdio_func *tiwlan_func = NULL; static int sdio_reset_flag = 0; +#ifdef DM_DMA_WORKAROUND +#define DMA_THRESHOLD_SIZE 64 +static void *sdio_dma_ptr = NULL; +#endif /*-------------------------------------------------------------------*/ void SDIO_SetFunc( struct sdio_func *func ) { @@ -53,12 +58,25 @@ SDIO_Status SDIO_Init(SDIO_ConfigParams *ConfigParams, SDIO_Handle *Handle) printk(KERN_ERR "Error: SDIO_Init() called before SDIO probe completed!\n"); return SDIO_FAILURE; } +#ifdef DM_DMA_WORKAROUND + if( !sdio_dma_ptr ) { + sdio_dma_ptr = kmalloc( PAGE_SIZE, GFP_KERNEL ); + if( !sdio_dma_ptr ) + return SDIO_FAILURE; + } +#endif return SDIO_SUCCESS; } SDIO_Status SDIO_Shutdown(SDIO_Handle Handle) { /* printk("%s:\n", __FUNCTION__); */ +#ifdef DM_DMA_WORKAROUND + if( sdio_dma_ptr ) { + kfree( sdio_dma_ptr ); + sdio_dma_ptr = NULL; + } +#endif return SDIO_SUCCESS; } @@ -128,8 +146,7 @@ static int write_direct(struct sdio_func *func, unsigned long addr, SDIO_Status SDIO_SyncRead(SDIO_Handle Handle, SDIO_Request_t *Req) { struct sdio_func *func = (struct sdio_func *)Handle; - int rc; - int retries = 5; + int rc, retries = 5; #if 0 printk("%s: p_addr = 0x%.8lx, sz = %d\n", @@ -140,7 +157,17 @@ SDIO_Status SDIO_SyncRead(SDIO_Handle Handle, SDIO_Request_t *Req) while(retries) { if( retries > 2 ) +#ifdef DM_DMA_WORKAROUND + if( Req->buffer_len < DMA_THRESHOLD_SIZE ) { + rc = sdio_memcpy_fromio(func, Req->buffer, Req->peripheral_addr, Req->buffer_len); + } + else { + rc = sdio_memcpy_fromio(func, sdio_dma_ptr, Req->peripheral_addr, Req->buffer_len); + memcpy( Req->buffer, sdio_dma_ptr, Req->buffer_len ); + } +#else rc = sdio_memcpy_fromio(func, Req->buffer, Req->peripheral_addr, Req->buffer_len); +#endif else rc = read_direct(func, Req->buffer, Req->peripheral_addr, Req->buffer_len); @@ -161,8 +188,10 @@ SDIO_Status SDIO_SyncRead(SDIO_Handle Handle, SDIO_Request_t *Req) SDIO_Status SDIO_SyncWrite(SDIO_Handle Handle, SDIO_Request_t *Req) { struct sdio_func *func = (struct sdio_func *)Handle; - int rc; - int retries = 5; + int rc, retries = 5; +#ifdef DM_DMA_WORKAROUND + void *dma_ptr; +#endif #if 0 printk("%s: p_addr = 0x%.8lx, sz = %d\n", @@ -173,7 +202,18 @@ SDIO_Status SDIO_SyncWrite(SDIO_Handle Handle, SDIO_Request_t *Req) while(retries) { if( retries > 2 ) { +#ifdef DM_DMA_WORKAROUND + if( Req->buffer_len < DMA_THRESHOLD_SIZE ) { + dma_ptr = Req->buffer; + } + else { + dma_ptr = sdio_dma_ptr; + memcpy( dma_ptr, Req->buffer, Req->buffer_len ); + } + rc = sdio_memcpy_toio(func, Req->peripheral_addr, dma_ptr, Req->buffer_len); +#else rc = sdio_memcpy_toio(func, Req->peripheral_addr, Req->buffer, Req->buffer_len); +#endif } else rc = write_direct(func, Req->peripheral_addr, Req->buffer, Req->buffer_len); diff --git a/wpa_supplicant_lib/Android.mk b/wpa_supplicant_lib/Android.mk index 70d77a1..0aec192 100644 --- a/wpa_supplicant_lib/Android.mk +++ b/wpa_supplicant_lib/Android.mk @@ -1,12 +1,32 @@ +# +# Copyright (C) 2008 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# LOCAL_PATH := $(call my-dir) -WPA_BUILD_SUPPLICANT_LIB := false -ifeq ($(HAVE_CUSTOM_WIFI_DRIVER_2),true) -WPA_BUILD_SUPPLICANT_LIB := true STA_DK_ROOT = $(LOCAL_PATH)/../.. + +# This makefile is only included if BOARD_WLAN_TI_STA_DK_ROOT is set, +# and if we're not building for the simulator. +ifndef BOARD_WLAN_TI_STA_DK_ROOT + $(error BOARD_WLAN_TI_STA_DK_ROOT must be defined when including this makefile) +endif +ifeq ($(TARGET_SIMULATOR),true) + $(error This makefile must not be included when building the simulator) endif -DK_ROOT = $(STA_DK_ROOT) -OS_ROOT = $(STA_DK_ROOT)/pform +DK_ROOT = $(BOARD_WLAN_TI_STA_DK_ROOT) +OS_ROOT = $(BOARD_WLAN_TI_STA_DK_ROOT)/pform COMMON = $(DK_ROOT)/common COMSRC = $(COMMON)/src CUDK_ROOT = $(DK_ROOT)/CUDK @@ -108,7 +128,7 @@ INCLUDES = $(COMMON)/inc \ external/wpa_supplicant L_CFLAGS += -DCONFIG_DRIVER_CUSTOM -DHOST_COMPILE -ifeq ($(HAVE_CUSTOM_WIFI_DRIVER_0),true) +ifeq ($(notdir $(BOARD_WLAN_TI_STA_DK_ROOT)),sta_dk_5_0_0_94) L_CFLAGS += -DSTA_DK_VER_5_0_0_94 endif OBJS = driver_ti.c @@ -125,21 +145,15 @@ ifdef CONFIG_IEEE8021X_EAPOL L_CFLAGS += -DIEEE8021X_EAPOL endif -ifneq ($(TARGET_SIMULATOR),true) -ifeq ($(WPA_BUILD_SUPPLICANT_LIB),true) - ######################## include $(CLEAR_VARS) LOCAL_MODULE := libCustomWifi LOCAL_STATIC_LIBRARIES := libWifiApi -LOCAL_SHARED_LIBRARIES := libc +LOCAL_SHARED_LIBRARIES := libc libcutils LOCAL_CFLAGS := $(L_CFLAGS) LOCAL_SRC_FILES := $(OBJS) LOCAL_C_INCLUDES := $(INCLUDES) include $(BUILD_STATIC_LIBRARY) ######################## - -endif # ifeq ($(WPA_BUILD_SUPPLICANT_LIB),true) -endif # ifneq ($(TARGET_SIMULATOR),true) diff --git a/wpa_supplicant_lib/driver_ti.c b/wpa_supplicant_lib/driver_ti.c index 2bbd18d..10f2b5b 100644 --- a/wpa_supplicant_lib/driver_ti.c +++ b/wpa_supplicant_lib/driver_ti.c @@ -42,8 +42,13 @@ #include "wspVer.h" #include "driver_ti.h" #include "scanMngrTypes.h" +#ifdef ANDROID +#include <cutils/properties.h> +#endif /*-------------------------------------------------------------------*/ #define TI_DRIVER_MSG_PORT 9000 +#define RX_SELF_FILTER 0 +#define RX_BROADCAST_FILTER 1 #define TI2WPA_STATUS(s) (((s) != OK) ? -1 : 0) #define TI_CHECK_DRIVER(f,r) \ if( !(f) ) { \ @@ -56,6 +61,50 @@ static int lfp; #endif /*-------------------------------------------------------------------*/ +#ifdef ANDROID +typedef struct REG_DOMAIN_STRUCT { + char tmzn_name[PROPERTY_VALUE_MAX]; + int size; + int num_of_channels; +} reg_domain_struct_t; + +reg_domain_struct_t reg_domain_str[] = { + { "US", 2, NUMBER_SCAN_CHANNELS_FCC }, + { "AU", 2, NUMBER_SCAN_CHANNELS_FCC }, + { "SG", 2, NUMBER_SCAN_CHANNELS_FCC }, + { "CA", 2, NUMBER_SCAN_CHANNELS_FCC }, + { "GB", 2, NUMBER_SCAN_CHANNELS_ETSI }, + { "JP", 2, NUMBER_SCAN_CHANNELS_MKK1 }, + { "ZZ", 2, NUMBER_SCAN_CHANNELS_FCC } +}; +#endif +/*----------------------------------------------------------------------------- +Routine Name: check_and_get_carrier_channels +Routine Description: get number of allowed channels according to locale +as determined by the carrier being used. +Arguments: None +Return Value: Number of channels +-----------------------------------------------------------------------------*/ +static int check_and_get_carrier_channels( void ) +{ +#ifdef ANDROID + char prop_status[PROPERTY_VALUE_MAX]; + char *prop_name = "ro.product.locale.region"; + int default_channels = NUMBER_SCAN_CHANNELS_ETSI; + unsigned i; + + if( !property_get(prop_name, prop_status, NULL) ) + return default_channels; + for(i=0;( i < (sizeof(reg_domain_str)/sizeof(reg_domain_struct_t)) );i++) { + if( strncmp(prop_status, reg_domain_str[i].tmzn_name, + reg_domain_str[i].size) == 0 ) + return reg_domain_str[i].num_of_channels; + } + return( default_channels ); +#else + return( NUMBER_SCAN_CHANNELS_FCC ); +#endif +} /*----------------------------------------------------------------------------- Routine Name: wpa_driver_tista_event_receive @@ -1295,7 +1344,7 @@ static void *wpa_driver_tista_init( void *priv, const char *ifname ) myDrv->scan_type = SCAN_TYPE_NORMAL_ACTIVE; /* Set default amount of channels */ - myDrv->scan_channels = NUMBER_SCAN_CHANNELS_FCC; + myDrv->scan_channels = check_and_get_carrier_channels(); /* Link Speed will be set by the message from the driver */ myDrv->link_speed = 0; @@ -1303,6 +1352,9 @@ static void *wpa_driver_tista_init( void *priv, const char *ifname ) /* BtCoex mode is read from tiwlan.ini file */ myDrv->btcoex_mode = 1; /* SG_DISABLE */ + /* RTS Threshold is read from tiwlan.ini file */ + myDrv->rts_threshold = HAL_CTRL_RTS_THRESHOLD_MAX; + /* Return pointer to our driver structure */ return( myDrv ); @@ -1404,6 +1456,51 @@ static int ti_send_eapol( void *priv, const u8 *dest, u16 proto, return( TI2WPA_STATUS(ret) ); } +#ifndef STA_DK_VER_5_0_0_94 +/*----------------------------------------------------------------------------- +Routine Name: get_filter_mac_addr +Routine Description: returns mac address according to parameter type +Arguments: + priv - pointer to private data structure + type - type of mac address +Return Value: pointer to mac address array, or NULL +-----------------------------------------------------------------------------*/ +static const u8 *get_filter_mac_addr( void *priv, int type ) +{ + if( type == RX_SELF_FILTER ) + return( wpa_driver_tista_get_mac_addr(priv) ); + if( type == RX_BROADCAST_FILTER ) + return( (const u8 *)"\xFF\xFF\xFF\xFF\xFF\xFF" ); + return( NULL ); +} + +/*----------------------------------------------------------------------------- +Routine Name: prepare_filter_struct +Routine Description: fills rx data filter structure according to parameter type +Arguments: + priv - pointer to private data structure + type - type of mac address + dfreq_ptr - pointer to TIWLAN_DATA_FILTER_REQUEST structure +Return Value: 0 - success, -1 - error +-----------------------------------------------------------------------------*/ +static int prepare_filter_struct( void *priv, int type, + TIWLAN_DATA_FILTER_REQUEST *dfreq_ptr ) +{ + u8 *macaddr = (u8 *)get_filter_mac_addr( priv, type ); + int ret = -1; + + if( macaddr != NULL ) { + dfreq_ptr->Offset = 0; + dfreq_ptr->MaskLength = 1; + dfreq_ptr->Mask[0] = 0x3F; /* 6 bytes */ + dfreq_ptr->PatternLength = MAC_ADDR_LEN; + os_memcpy( dfreq_ptr->Pattern, macaddr, MAC_ADDR_LEN ); + ret = 0; + } + return( ret ); +} +#endif + /*----------------------------------------------------------------------------- Routine Name: wpa_driver_tista_driver_cmd Routine Description: executes driver-specific commands @@ -1429,6 +1526,7 @@ int wpa_driver_tista_driver_cmd( void *priv, char *cmd, char *buf, size_t buf_le if( ret == OK ) { /* Signal that driver is not loaded yet */ myDrv->driver_is_loaded = TRUE; + myDrv->scan_channels = check_and_get_carrier_channels(); wpa_msg(myDrv->hWpaSupplicant, MSG_INFO, WPA_EVENT_DRIVER_STATE "STARTED"); } else @@ -1456,8 +1554,10 @@ int wpa_driver_tista_driver_cmd( void *priv, char *cmd, char *buf, size_t buf_le u8 *macaddr = (u8 *)wpa_driver_tista_get_mac_addr(priv); wpa_printf(MSG_DEBUG,"Macaddr command"); wpa_printf(MSG_DEBUG, " Macaddr = " MACSTR, MAC2STR(macaddr)); - ret = sprintf(buf, "Macaddr = " MACSTR "\n", MAC2STR(macaddr)); - return( ret ); + ret = snprintf(buf, buf_len, "Macaddr = " MACSTR "\n", MAC2STR(macaddr)); + if (ret < (int)buf_len) { + return( ret ); + } } else if( os_strcasecmp(cmd, "scan-passive") == 0 ) { wpa_printf(MSG_DEBUG,"Scan Passive command"); @@ -1471,18 +1571,31 @@ int wpa_driver_tista_driver_cmd( void *priv, char *cmd, char *buf, size_t buf_le } else if( os_strcasecmp(cmd, "linkspeed") == 0 ) { wpa_printf(MSG_DEBUG,"Link Speed command"); - ret = sprintf(buf,"LinkSpeed %u\n", myDrv->link_speed); - return( ret ); + ret = snprintf(buf, buf_len, "LinkSpeed %u\n", myDrv->link_speed); + if (ret < (int)buf_len) { + return( ret ); + } } else if( os_strncasecmp(cmd, "scan-channels", 13) == 0 ) { int noOfChan; - - noOfChan = atoi(cmd + 13); - wpa_printf(MSG_DEBUG,"Scan Channels command = %d", noOfChan); - if( (noOfChan > 0) && (noOfChan <= MAX_NUMBER_OF_CHANNELS_PER_SCAN) ) - myDrv->scan_channels = noOfChan; - ret = sprintf(buf,"Scan-Channels = %d\n", myDrv->scan_channels); - return( ret ); + char *cp = cmd + 13; + char *endp; + + if (*cp != '\0') { + noOfChan = strtol(cp, &endp, 0); + if (endp != cp) { + wpa_printf(MSG_DEBUG,"Scan Channels command = %d", noOfChan); + if( (noOfChan > 0) && (noOfChan <= MAX_NUMBER_OF_CHANNELS_PER_SCAN) ) { + myDrv->scan_channels = noOfChan; + ret = 0; + } + } + } else { + ret = snprintf(buf, buf_len, "Scan-Channels = %d\n", myDrv->scan_channels); + if (ret < (int)buf_len) { + return( ret ); + } + } } else if( os_strcasecmp(cmd, "rssi") == 0 ) { #if 1 @@ -1494,16 +1607,15 @@ int wpa_driver_tista_driver_cmd( void *priv, char *cmd, char *buf, size_t buf_le ret = TI_GetRSSI( myDrv->hDriver, &rssi ); if( ret == OK ) { len = wpa_driver_tista_get_ssid( priv, (u8 *)ssid ); - if( (len > 0) && (len <= MAX_SSID_LEN) ) { + if( (len > 0) && (len <= MAX_SSID_LEN) && (len < (int)buf_len)) { os_memcpy( (void *)buf, (void *)ssid, len ); ret = len; - ret += sprintf(&buf[ret], " rssi %d\n", rssi); - return( ret ); - } - } - else { - ret = -1; - } + ret += snprintf(&buf[ret], buf_len-len, " rssi %d\n", rssi); + if (ret < (int)buf_len) { + return( ret ); + } + } + } #else OS_802_11_BSSID_EX bssidInfo; @@ -1511,55 +1623,179 @@ int wpa_driver_tista_driver_cmd( void *priv, char *cmd, char *buf, size_t buf_le ret = TI_GetSelectedBSSIDInfo( myDrv->hDriver, (OS_802_11_BSSID_EX *)&bssidInfo ); if( ret == OK ) { - if( bssidInfo.Ssid.SsidLength != 0 ) { + if( bssidInfo.Ssid.SsidLength != 0 && bssidInfo.Ssid.SsidLength < buf_len) { os_memcpy( (void *)buf, (void *)(bssidInfo.Ssid.Ssid), bssidInfo.Ssid.SsidLength ); ret = bssidInfo.Ssid.SsidLength; - ret += sprintf(&buf[ret]," rssi %d\n", bssidInfo.Rssi); - return( ret ); + ret += snprintf(&buf[ret], buf_len-ret, " rssi %d\n", bssidInfo.Rssi); + if (ret < (int)buf_len) { + return( ret ); + } } ret = -1; } #endif } else if( os_strncasecmp(cmd, "powermode", 9) == 0 ) { + u32 rtsThreshold = myDrv->rts_threshold; u32 mode; - - mode = (u32)atoi(cmd + 9); - wpa_printf(MSG_DEBUG,"Power Mode command = %u", mode); - if( mode <= OS_POWER_MODE_LONG_DOZE ) - ret = TI_ConfigPowerManagement( myDrv->hDriver, mode ); + char *cp = cmd + 9; + char *endp; + + if (*cp != '\0') { + mode = (u32)strtol(cp, &endp, 0); + if (endp != cp) { + wpa_printf(MSG_DEBUG,"Power Mode command = %u", mode); + if( mode <= OS_POWER_MODE_LONG_DOZE ) + ret = TI_ConfigPowerManagement( myDrv->hDriver, mode ); + if( mode == OS_POWER_MODE_ACTIVE ) + rtsThreshold = 0; + if( TI_SetRTSThreshold( myDrv->hDriver, rtsThreshold ) != OK ) + wpa_printf(MSG_DEBUG,"Set RTS threshold = %u failed", rtsThreshold); + } + } } - else if (os_strncasecmp(cmd, "getpower", 8) == 0 ) { + else if( os_strncasecmp(cmd, "getpower", 8) == 0 ) { u32 mode; ret = TI_GetPowerMode( myDrv->hDriver, (OS_802_11_POWER_PROFILE *)&mode); if( ret == OK ) { - ret = sprintf(buf, "powermode = %u\n", mode); - return( ret ); + ret = snprintf(buf, buf_len, "powermode = %u\n", mode); + if (ret < (int)buf_len) { + return( ret ); + } + } + } + else if( os_strncasecmp(cmd, "get-rts-threshold", 17) == 0 ) { + tiUINT32 rtsThreshold = 0; + + ret = TI_GetRTSThreshold( myDrv->hDriver, &rtsThreshold ); + wpa_printf(MSG_DEBUG,"Get RTS Threshold command = %d", rtsThreshold); + if( ret == OK ) { + ret = snprintf(buf, buf_len, "rts-threshold = %u\n", rtsThreshold); + if (ret < (int)buf_len) { + return( ret ); + } + } + } + else if( os_strncasecmp(cmd, "set-rts-threshold", 17) == 0 ) { + tiUINT32 rtsThreshold = 0; + char *cp = cmd + 17; + char *endp; + + if (*cp != '\0') { + rtsThreshold = (tiUINT32)strtol(cp, &endp, 0); + if (endp != cp) { + wpa_printf(MSG_DEBUG,"RTS Threshold command = %d", rtsThreshold); + if( rtsThreshold <= HAL_CTRL_RTS_THRESHOLD_MAX ) { + ret = TI_SetRTSThreshold( myDrv->hDriver, rtsThreshold ); + if( ret == OK ) { + myDrv->rts_threshold = rtsThreshold; + } + } + } } - ret = -1; } #ifndef STA_DK_VER_5_0_0_94 + else if( os_strcasecmp(cmd, "rxfilter-start") == 0 ) { + wpa_printf(MSG_DEBUG,"Rx Data Filter Start command"); + ret = TI_EnableDisableRxDataFilters( myDrv->hDriver, TRUE ); + } + else if( os_strcasecmp(cmd, "rxfilter-stop") == 0 ) { + wpa_printf(MSG_DEBUG,"Rx Data Filter Stop command"); + ret = TI_EnableDisableRxDataFilters( myDrv->hDriver, FALSE ); + } + else if( os_strcasecmp(cmd, "rxfilter-statistics") == 0 ) { + TIWLAN_DATA_FILTER_STATISTICS stats; + int len, i; + + wpa_printf(MSG_DEBUG,"Rx Data Filter Statistics command"); + ret = TI_GetRxDataFiltersStatistics( myDrv->hDriver, &stats ); + if( ret == OK ) { + ret = snprintf(buf, buf_len, "RxFilterStat: %u", + stats.UnmatchedPacketsCount); + for(i=0;( i < MAX_NUM_DATA_FILTERS );i++) { + ret += snprintf(&buf[ret], buf_len-ret, " %u", + stats.MatchedPacketsCount[i]); + } + ret += snprintf(&buf[ret], buf_len-ret, "\n"); + if (ret < (int)buf_len) { + return( ret ); + } + } + } + else if( os_strncasecmp(cmd, "rxfilter-add", 12) == 0 ) { + TIWLAN_DATA_FILTER_REQUEST dfreq; + char *cp = cmd + 12; + char *endp; + int type; + + if (*cp != '\0') { + type = (int)strtol(cp, &endp, 0); + if (endp != cp) { + wpa_printf(MSG_DEBUG,"Rx Data Filter Add [%d] command", type); + ret = prepare_filter_struct( priv, type, &dfreq ); + if( ret == 0 ) { + ret = TI_AddRxDataFilter( myDrv->hDriver, &dfreq ); + } + } + } + } + else if( os_strncasecmp(cmd, "rxfilter-remove",15) == 0 ) { + wpa_printf(MSG_DEBUG,"Rx Data Filter Remove command"); + TIWLAN_DATA_FILTER_REQUEST dfreq; + char *cp = cmd + 15; + char *endp; + int type; + + if (*cp != '\0') { + type = (int)strtol(cp, &endp, 0); + if (endp != cp) { + wpa_printf(MSG_DEBUG,"Rx Data Filter Remove [%d] command", type); + ret = prepare_filter_struct( priv, type, &dfreq ); + if( ret == 0 ) { + ret = TI_RemoveRxDataFilter( myDrv->hDriver, &dfreq ); + } + } + } + } + else if( os_strcasecmp(cmd, "snr") == 0 ) { + u32 snr; + + ret = TI_GetSNR( myDrv->hDriver, &snr ); + if( ret == OK ) { + ret = snprintf(buf, buf_len, "snr = %u\n", snr); + if (ret < (int)buf_len) { + return( ret ); + } + } + } else if( os_strncasecmp(cmd, "btcoexmode", 10) == 0 ) { u32 mode; + char *cp = cmd + 10; + char *endp; - mode = (u32)atoi(cmd + 10); - wpa_printf(MSG_DEBUG,"BtCoex Mode command = %u", mode); - ret = TI_SetBtCoeEnable( myDrv->hDriver, mode ); - if( ret == OK ) { - myDrv->btcoex_mode = mode; + if (*cp != '\0') { + mode = (u32)strtol(cp, &endp, 0); + if (endp != cp) { + wpa_printf(MSG_DEBUG,"BtCoex Mode command = %u", mode); + ret = TI_SetBtCoeEnable( myDrv->hDriver, mode ); + if( ret == OK ) { + myDrv->btcoex_mode = mode; + } + } } } else if( os_strcasecmp(cmd, "btcoexstat") == 0 ) { u32 status = myDrv->btcoex_mode; - wpa_printf(MSG_DEBUG,"BtCoex Status"); + wpa_printf(MSG_DEBUG,"BtCoex Status"); ret = TI_SetBtCoeGetStatus( myDrv->hDriver, (tiUINT32 *)&status ); if( ret == OK ) { - ret = sprintf(buf, "btcoexstatus = 0x%x\n", status); - return( ret ); + ret = snprintf(buf, buf_len, "btcoexstatus = 0x%x\n", status); + if (ret < (int)buf_len) { + return( ret ); + } } - ret = -1; } #endif else { diff --git a/wpa_supplicant_lib/driver_ti.h b/wpa_supplicant_lib/driver_ti.h index 240ebb8..b4dde86 100644 --- a/wpa_supplicant_lib/driver_ti.h +++ b/wpa_supplicant_lib/driver_ti.h @@ -59,6 +59,8 @@ typedef enum _TIWLAN_KEY_FLAGS #endif #define NUMBER_SCAN_CHANNELS_FCC 11 +#define NUMBER_SCAN_CHANNELS_ETSI 13 +#define NUMBER_SCAN_CHANNELS_MKK1 14 #ifndef ETHERNET_HDR_LEN #define ETHERNET_HDR_LEN 14 @@ -86,6 +88,7 @@ struct wpa_driver_ti_data { int scan_channels; /* Number of allowed scan channels */ unsigned link_speed; /* Link Speed */ unsigned btcoex_mode; /* BtCoex Mode */ + unsigned rts_threshold; /* RTS Threshold */ int driverEventsSocket; int block_disassoc_events; int block_disassoc_prev; |