1 /* 2 * CmdDispatcher.c 3 * 4 * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 11 * * Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * * Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in 15 * the documentation and/or other materials provided with the 16 * distribution. 17 * * Neither the name Texas Instruments nor the names of its 18 * contributors may be used to endorse or promote products derived 19 * from this software without specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 34 35 /** \file CmdDispatcher.c 36 * \brief The CmdDispatcher module. Handles user commbands dispatching to the driver modules. 37 * 38 * \see CmdDispatcher.h 39 */ 40 41 #define __FILE_ID__ FILE_ID_47 42 #include "tidef.h" 43 #include "osApi.h" 44 #include "report.h" 45 #include "DrvMain.h" 46 #include "connApi.h" 47 #include "siteMgrApi.h" 48 #include "smeApi.h" 49 #include "SoftGeminiApi.h" 50 #include "roamingMngrApi.h" 51 #include "qosMngr_API.h" 52 #include "PowerMgr_API.h" 53 #include "ScanCncn.h" 54 #include "scanMngrApi.h" 55 #include "regulatoryDomainApi.h" 56 #include "measurementMgrApi.h" 57 #include "TWDriver.h" 58 #include "debug.h" 59 #include "DrvMainModules.h" 60 #include "CmdDispatcher.h" 61 #include "healthMonitor.h" 62 #include "currBssApi.h" 63 #ifdef XCC_MODULE_INCLUDED 64 #include "XCCMngr.h" 65 #endif 66 67 68 /* Set/get params function prototype */ 69 typedef TI_STATUS (*TParamFunc) (TI_HANDLE handle, paramInfo_t *pParam); 70 71 typedef struct 72 { 73 TParamFunc set; 74 TParamFunc get; 75 TI_HANDLE handle; 76 77 } TParamAccess; 78 79 /* The module's object */ 80 typedef struct 81 { 82 /* Other modules handles */ 83 TI_HANDLE hOs; 84 TI_HANDLE hReport; 85 TI_HANDLE hAuth; 86 TI_HANDLE hAssoc; 87 TI_HANDLE hRxData; 88 TI_HANDLE hTxCtrl; 89 TI_HANDLE hCtrlData; 90 TI_HANDLE hSiteMgr; 91 TI_HANDLE hConn; 92 TI_HANDLE hRsn; 93 TI_HANDLE hSme; 94 TI_HANDLE hScanCncn; 95 TI_HANDLE hScanMngr; 96 TI_HANDLE hMlmeSm; 97 TI_HANDLE hRegulatoryDomain; 98 TI_HANDLE hMeasurementMgr; 99 TI_HANDLE hRoamingMngr; 100 TI_HANDLE hSoftGemini; 101 TI_HANDLE hQosMngr; 102 TI_HANDLE hPowerMgr; 103 TI_HANDLE hHealthMonitor; 104 TI_HANDLE hTWD; 105 TI_HANDLE hCurrBss; 106 #ifdef XCC_MODULE_INCLUDED 107 TI_HANDLE hXCCMngr; 108 #endif 109 110 /* Table of params set/get functions */ 111 TParamAccess paramAccessTable[MAX_PARAM_MODULE_NUMBER]; 112 113 #ifdef TI_DBG 114 TStadHandlesList *pStadHandles; /* Save modules list pointer just for the debug functions */ 115 #endif 116 117 } TCmdDispatchObj; 118 119 120 /* Internal functions prototypes */ 121 static void cmdDispatch_ConfigParamsAccessTable (TCmdDispatchObj *pCmdDispatch); 122 static TI_STATUS cmdDispatch_SetTwdParam (TI_HANDLE hCmdDispatch, paramInfo_t *pParam); 123 static TI_STATUS cmdDispatch_GetTwdParam (TI_HANDLE hCmdDispatch, paramInfo_t *pParam); 124 125 #ifdef TI_DBG 126 static TI_STATUS cmdDispatch_DebugFuncSet (TI_HANDLE hCmdDispatch, paramInfo_t *pParam); 127 static TI_STATUS cmdDispatch_DebugFuncGet (TI_HANDLE hCmdDispatch, paramInfo_t *pParam); /*yael - this function is not in use*/ 128 #endif 129 130 131 132 /** 133 * \fn cmdDispatch_Create 134 * \brief Create the module 135 * 136 * Create the Command-Dispatcher module 137 * 138 * \note 139 * \param hOs - Handle to the Os Abstraction Layer 140 * \return Handle to the allocated module (NULL if failed) 141 * \sa 142 */ 143 TI_HANDLE cmdDispatch_Create (TI_HANDLE hOs) 144 { 145 TCmdDispatchObj *pCmdDispatch; 146 147 /* allocate CmdDispatcher module */ 148 pCmdDispatch = os_memoryAlloc (hOs, (sizeof(TCmdDispatchObj))); 149 150 if (!pCmdDispatch) 151 { 152 WLAN_OS_REPORT(("Error allocating the CmdDispatcher Module\n")); 153 return NULL; 154 } 155 156 /* Reset CmdDispatcher module */ 157 os_memoryZero (hOs, pCmdDispatch, (sizeof(TCmdDispatchObj))); 158 159 pCmdDispatch->hOs = hOs; 160 161 return (TI_HANDLE)pCmdDispatch; 162 } 163 164 165 /** 166 * \fn cmdDispatch_Init 167 * \brief Save modules handles and fill the configuration table 168 * 169 * Save other modules handles, and fill the configuration table 170 * with the Get/Set functions. 171 * 172 * \note 173 * \param pStadHandles - The driver modules handles 174 * \return void 175 * \sa 176 */ 177 void cmdDispatch_Init (TStadHandlesList *pStadHandles) 178 { 179 TCmdDispatchObj *pCmdDispatch = (TCmdDispatchObj *)(pStadHandles->hCmdDispatch); 180 181 /* Save modules handles */ 182 pCmdDispatch->hReport = pStadHandles->hReport; 183 pCmdDispatch->hAuth = pStadHandles->hAuth; 184 pCmdDispatch->hAssoc = pStadHandles->hAssoc; 185 pCmdDispatch->hRxData = pStadHandles->hRxData; 186 pCmdDispatch->hTxCtrl = pStadHandles->hTxCtrl; 187 pCmdDispatch->hCtrlData = pStadHandles->hCtrlData; 188 pCmdDispatch->hSiteMgr = pStadHandles->hSiteMgr; 189 pCmdDispatch->hConn = pStadHandles->hConn; 190 pCmdDispatch->hRsn = pStadHandles->hRsn; 191 pCmdDispatch->hSme = pStadHandles->hSme; 192 pCmdDispatch->hScanCncn = pStadHandles->hScanCncn; 193 pCmdDispatch->hScanMngr = pStadHandles->hScanMngr; 194 pCmdDispatch->hMlmeSm = pStadHandles->hMlmeSm; 195 pCmdDispatch->hRegulatoryDomain = pStadHandles->hRegulatoryDomain; 196 pCmdDispatch->hMeasurementMgr = pStadHandles->hMeasurementMgr; 197 pCmdDispatch->hRoamingMngr = pStadHandles->hRoamingMngr; 198 pCmdDispatch->hSoftGemini = pStadHandles->hSoftGemini; 199 pCmdDispatch->hQosMngr = pStadHandles->hQosMngr; 200 pCmdDispatch->hPowerMgr = pStadHandles->hPowerMgr; 201 pCmdDispatch->hHealthMonitor = pStadHandles->hHealthMonitor; 202 pCmdDispatch->hTWD = pStadHandles->hTWD; 203 pCmdDispatch->hCurrBss = pStadHandles->hCurrBss; 204 #ifdef XCC_MODULE_INCLUDED 205 pCmdDispatch->hXCCMngr = pStadHandles->hXCCMngr; 206 #endif 207 208 #ifdef TI_DBG 209 pCmdDispatch->pStadHandles = pStadHandles; /* Save modules list pointer just for the debug functions */ 210 #endif 211 212 /* Fill the configuration table with the Get/Set functions */ 213 cmdDispatch_ConfigParamsAccessTable (pCmdDispatch); 214 } 215 216 217 /** 218 * \fn cmdDispatch_Destroy 219 * \brief Destroy the module object 220 * 221 * Destroy the module object. 222 * 223 * \note 224 * \param hCmdDispatch - The object 225 * \return TI_OK - Unload succesfull, TI_NOK - Unload unsuccesfull 226 * \sa 227 */ 228 TI_STATUS cmdDispatch_Destroy (TI_HANDLE hCmdDispatch) 229 { 230 TCmdDispatchObj *pCmdDispatch = (TCmdDispatchObj *)hCmdDispatch; 231 232 /* Free the module object */ 233 os_memoryFree (pCmdDispatch->hOs, pCmdDispatch, sizeof(TCmdDispatchObj)); 234 235 return TI_OK; 236 } 237 238 239 /** 240 * \fn cmdDispatch_ConfigParamsAccessTable 241 * \brief Fill the configuration table with the Get/Set functions 242 * 243 * Called in the configuration phase by the driver, performs the following: 244 * - for each module that supply a Get/Set services to his parameters, 245 * fill the corresponding entry in the params access table with the following: 246 * - Get function 247 * - Set function 248 * - Handle to the module 249 * This table is used when Getting/Setting a parameter from the OS abstraction layer. 250 * 251 * \note 252 * \param pCmdDispatch - The object 253 * \return void 254 * \sa 255 */ 256 static void cmdDispatch_ConfigParamsAccessTable (TCmdDispatchObj *pCmdDispatch) 257 { 258 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(AUTH_MODULE_PARAM) - 1].set = auth_setParam; 259 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(AUTH_MODULE_PARAM) - 1].get = auth_getParam; 260 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(AUTH_MODULE_PARAM) - 1].handle = pCmdDispatch->hAuth; 261 262 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(ASSOC_MODULE_PARAM) - 1].set = assoc_setParam; 263 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(ASSOC_MODULE_PARAM) - 1].get = assoc_getParam; 264 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(ASSOC_MODULE_PARAM) - 1].handle = pCmdDispatch->hAssoc; 265 266 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(RX_DATA_MODULE_PARAM) - 1].set = rxData_setParam; 267 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(RX_DATA_MODULE_PARAM) - 1].get = rxData_getParam; 268 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(RX_DATA_MODULE_PARAM) - 1].handle = pCmdDispatch->hRxData; 269 270 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(TX_CTRL_MODULE_PARAM) - 1].set = txCtrlParams_setParam; 271 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(TX_CTRL_MODULE_PARAM) - 1].get = txCtrlParams_getParam; 272 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(TX_CTRL_MODULE_PARAM) - 1].handle = pCmdDispatch->hTxCtrl; 273 274 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(CTRL_DATA_MODULE_PARAM) - 1].set = ctrlData_setParam; 275 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(CTRL_DATA_MODULE_PARAM) - 1].get = ctrlData_getParam; 276 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(CTRL_DATA_MODULE_PARAM) - 1].handle = pCmdDispatch->hCtrlData; 277 278 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(SITE_MGR_MODULE_PARAM) - 1].set = siteMgr_setParam; 279 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(SITE_MGR_MODULE_PARAM) - 1].get = siteMgr_getParam; 280 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(SITE_MGR_MODULE_PARAM) - 1].handle = pCmdDispatch->hSiteMgr; 281 282 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(CONN_MODULE_PARAM) - 1].set = conn_setParam; 283 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(CONN_MODULE_PARAM) - 1].get = conn_getParam; 284 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(CONN_MODULE_PARAM) - 1].handle = pCmdDispatch->hConn; 285 286 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(RSN_MODULE_PARAM) - 1].set = (TParamFunc)rsn_setParam; 287 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(RSN_MODULE_PARAM) - 1].get = (TParamFunc)rsn_getParam; 288 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(RSN_MODULE_PARAM) - 1].handle = pCmdDispatch->hRsn; 289 290 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(TWD_MODULE_PARAM) - 1].set = cmdDispatch_SetTwdParam; 291 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(TWD_MODULE_PARAM) - 1].get = cmdDispatch_GetTwdParam; 292 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(TWD_MODULE_PARAM) - 1].handle = (TI_HANDLE)pCmdDispatch; 293 294 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(REPORT_MODULE_PARAM) - 1].set = (TParamFunc)report_SetParam; 295 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(REPORT_MODULE_PARAM) - 1].get = (TParamFunc)report_GetParam; 296 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(REPORT_MODULE_PARAM) - 1].handle = pCmdDispatch->hReport; 297 298 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(SME_MODULE_PARAM) - 1].set = sme_SetParam; 299 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(SME_MODULE_PARAM) - 1].get = sme_GetParam; 300 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(SME_MODULE_PARAM) - 1].handle = pCmdDispatch->hSme; 301 302 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(SCAN_CNCN_PARAM) - 1].set = scanCncnApp_SetParam; 303 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(SCAN_CNCN_PARAM) - 1].get = scanCncnApp_GetParam; 304 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(SCAN_CNCN_PARAM) - 1].handle = pCmdDispatch->hScanCncn; 305 306 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(SCAN_MNGR_PARAM) - 1].set = scanMngr_setParam; 307 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(SCAN_MNGR_PARAM) - 1].get = scanMngr_getParam; 308 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(SCAN_MNGR_PARAM) - 1].handle = pCmdDispatch->hScanMngr; 309 310 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(MLME_SM_MODULE_PARAM) - 1].set = mlme_setParam; 311 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(MLME_SM_MODULE_PARAM) - 1].get = mlme_getParam; 312 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(MLME_SM_MODULE_PARAM) - 1].handle = pCmdDispatch->hMlmeSm; 313 314 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(REGULATORY_DOMAIN_MODULE_PARAM) - 1].set = regulatoryDomain_setParam; 315 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(REGULATORY_DOMAIN_MODULE_PARAM) - 1].get = regulatoryDomain_getParam; 316 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(REGULATORY_DOMAIN_MODULE_PARAM) - 1].handle = pCmdDispatch->hRegulatoryDomain; 317 318 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(MEASUREMENT_MODULE_PARAM) - 1].set = measurementMgr_setParam; 319 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(MEASUREMENT_MODULE_PARAM) - 1].get = measurementMgr_getParam; 320 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(MEASUREMENT_MODULE_PARAM) - 1].handle = pCmdDispatch->hMeasurementMgr; 321 322 #ifdef XCC_MODULE_INCLUDED 323 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(XCC_MANAGER_MODULE_PARAM) - 1].set = XCCMngr_setParam; 324 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(XCC_MANAGER_MODULE_PARAM) - 1].get = XCCMngr_getParam; 325 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(XCC_MANAGER_MODULE_PARAM) - 1].handle = pCmdDispatch->hXCCMngr; 326 #endif 327 328 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(ROAMING_MANAGER_MODULE_PARAM) - 1].set = roamingMngr_setParam; 329 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(ROAMING_MANAGER_MODULE_PARAM) - 1].get = roamingMngr_getParam; 330 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(ROAMING_MANAGER_MODULE_PARAM) - 1].handle = pCmdDispatch->hRoamingMngr; 331 332 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(SOFT_GEMINI_PARAM) - 1].set = SoftGemini_setParam; 333 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(SOFT_GEMINI_PARAM) - 1].get = SoftGemini_getParam; 334 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(SOFT_GEMINI_PARAM) - 1].handle = pCmdDispatch->hSoftGemini; 335 336 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(QOS_MANAGER_PARAM) - 1].set = qosMngr_setParams; 337 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(QOS_MANAGER_PARAM) - 1].get = qosMngr_getParams; 338 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(QOS_MANAGER_PARAM) - 1].handle = pCmdDispatch->hQosMngr; 339 340 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(POWER_MANAGER_PARAM) - 1].set = powerMgr_setParam; 341 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(POWER_MANAGER_PARAM) - 1].get = powerMgr_getParam; 342 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(POWER_MANAGER_PARAM) - 1].handle = pCmdDispatch->hPowerMgr; 343 344 #ifdef TI_DBG 345 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(MISC_MODULE_PARAM) - 1].set = cmdDispatch_DebugFuncSet; 346 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(MISC_MODULE_PARAM) - 1].get = cmdDispatch_DebugFuncGet; /*yael - this function is not in use*/ 347 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(MISC_MODULE_PARAM) - 1].handle = (TI_HANDLE)pCmdDispatch; 348 #endif 349 350 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(HEALTH_MONITOR_MODULE_PARAM) - 1].set = healthMonitor_SetParam; 351 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(HEALTH_MONITOR_MODULE_PARAM) - 1].get = healthMonitor_GetParam; 352 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(HEALTH_MONITOR_MODULE_PARAM) - 1].handle = pCmdDispatch->hHealthMonitor; 353 354 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(CURR_BSS_MODULE_PARAM) - 1].set = currBSS_setParam; 355 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(CURR_BSS_MODULE_PARAM) - 1].get = currBSS_getParam; 356 pCmdDispatch->paramAccessTable[GET_PARAM_MODULE_NUMBER(CURR_BSS_MODULE_PARAM) - 1].handle = pCmdDispatch->hCurrBss; 357 } 358 359 360 /** 361 * \fn cmdDispatch_SetParam 362 * \brief Set a driver parameter 363 * 364 * Called by the OS abstraction layer in order to set a parameter in the driver. 365 * If the parameter can not be set from outside the driver it returns a failure status. 366 * The parameters is set to the module that uses as its father in the system 367 * (refer to the file paramOut.h for more explanations). 368 * 369 * \note 370 * \param hCmdDispatch - The object 371 * \param param - The parameter information 372 * \return result of parameter setting 373 * \sa 374 */ 375 TI_STATUS cmdDispatch_SetParam (TI_HANDLE hCmdDispatch, void *param) 376 { 377 TCmdDispatchObj *pCmdDispatch = (TCmdDispatchObj *)hCmdDispatch; 378 paramInfo_t *pParam = (paramInfo_t *)param; 379 TI_UINT32 moduleNumber; 380 381 moduleNumber = GET_PARAM_MODULE_NUMBER(pParam->paramType); 382 383 if (moduleNumber > MAX_PARAM_MODULE_NUMBER) 384 { 385 return PARAM_MODULE_NUMBER_INVALID; 386 } 387 388 if ((pCmdDispatch->paramAccessTable[moduleNumber - 1].set == 0) || 389 (pCmdDispatch->paramAccessTable[moduleNumber - 1].get == 0) || 390 (pCmdDispatch->paramAccessTable[moduleNumber - 1].handle == 0)) 391 { 392 WLAN_OS_REPORT(("cmdDispatch_SetParam(): NULL pointers!!!, return, ParamType=0x%x\n", pParam->paramType)); 393 return TI_NOK; 394 } 395 396 TRACE2(pCmdDispatch->hReport, REPORT_SEVERITY_INFORMATION , "cmdDispatch_SetParam(): ParamType=0x%x, ModuleNumber=0x%x\n", pParam->paramType, moduleNumber); 397 398 return pCmdDispatch->paramAccessTable[moduleNumber - 1].set(pCmdDispatch->paramAccessTable[moduleNumber - 1].handle, pParam); 399 } 400 401 402 /** 403 * \fn cmdDispatch_GetParam 404 * \brief Get a driver parameter 405 * 406 * Called by the OS abstraction layer in order to get a parameter the driver. 407 * If the parameter can not be get from outside the driver it returns a failure status. 408 * The parameter is get from the module that uses as its father in the system 409 * (refer to the file paramOut.h for more explanations). 410 * 411 * \note 412 * \param hCmdDispatch - The object 413 * \param param - The parameter information 414 * \return result of parameter getting 415 * \sa 416 */ 417 TI_STATUS cmdDispatch_GetParam (TI_HANDLE hCmdDispatch, void *param) 418 { 419 TCmdDispatchObj *pCmdDispatch = (TCmdDispatchObj *) hCmdDispatch; 420 paramInfo_t *pParam = (paramInfo_t *) param; 421 TI_UINT32 moduleNumber; 422 TI_STATUS status; 423 424 moduleNumber = GET_PARAM_MODULE_NUMBER(pParam->paramType); 425 426 if (moduleNumber > MAX_PARAM_MODULE_NUMBER) 427 { 428 return PARAM_MODULE_NUMBER_INVALID; 429 } 430 431 if ((pCmdDispatch->paramAccessTable[moduleNumber - 1].set == 0) || 432 (pCmdDispatch->paramAccessTable[moduleNumber - 1].get == 0) || 433 (pCmdDispatch->paramAccessTable[moduleNumber - 1].handle == 0)) 434 { 435 WLAN_OS_REPORT(("cmdDispatch_GetParam(): NULL pointers!!!, return, ParamType=0x%x\n", pParam->paramType)); 436 return TI_NOK; 437 } 438 439 TRACE2(pCmdDispatch->hReport, REPORT_SEVERITY_INFORMATION , "cmdDispatch_GetParam(): ParamType=0x%x, ModuleNumber=0x%x\n", pParam->paramType, moduleNumber); 440 441 status = pCmdDispatch->paramAccessTable[moduleNumber - 1].get(pCmdDispatch->paramAccessTable[moduleNumber - 1].handle, pParam); 442 443 return status; 444 } 445 446 447 /** 448 * \fn cmdDispatch_SetTwdParam / cmdDispatch_GetParam 449 * \brief Set/Get a TWD parameter 450 * 451 * Set/Get a TWD parameter. 452 * 453 * \note 454 * \param hCmdDispatch - The object 455 * \param param - The parameter information 456 * \return parameter set/get result 457 * \sa 458 */ 459 static TI_STATUS cmdDispatch_SetTwdParam (TI_HANDLE hCmdDispatch, paramInfo_t *pParam) 460 { 461 TCmdDispatchObj *pCmdDispatch = (TCmdDispatchObj *)hCmdDispatch; 462 463 pParam->paramType &= ~(SET_BIT | GET_BIT | TWD_MODULE_PARAM | ASYNC_PARAM | ALLOC_NEEDED_PARAM); 464 465 return TWD_SetParam (pCmdDispatch->hTWD, (TTwdParamInfo *)pParam); 466 } 467 468 static TI_STATUS cmdDispatch_GetTwdParam (TI_HANDLE hCmdDispatch, paramInfo_t *pParam) 469 { 470 TCmdDispatchObj *pCmdDispatch = (TCmdDispatchObj *)hCmdDispatch; 471 472 pParam->paramType &= ~(SET_BIT | GET_BIT | TWD_MODULE_PARAM | ASYNC_PARAM | ALLOC_NEEDED_PARAM); 473 474 return TWD_GetParam (pCmdDispatch->hTWD, (TTwdParamInfo *)pParam); 475 } 476 477 478 479 480 /** 481 * \fn cmdDispatch_DebugFuncSet / cmdDispatch_DebugFuncGet 482 * \brief Set/Get a debug function parameter 483 * 484 * Set/Get a debug function parameter. 485 * 486 * \note 487 * \param hCmdDispatch - The object 488 * \param param - The parameter information 489 * \return parameter set/get result 490 * \sa 491 */ 492 493 #ifdef TI_DBG 494 495 static TI_STATUS cmdDispatch_DebugFuncSet (TI_HANDLE hCmdDispatch, paramInfo_t *pParam) 496 { 497 TCmdDispatchObj *pCmdDispatch = (TCmdDispatchObj *)hCmdDispatch; 498 499 if (hCmdDispatch == NULL || pParam == NULL) 500 { 501 return TI_NOK; 502 } 503 504 switch (pParam->paramType) 505 { 506 case DEBUG_ACTIVATE_FUNCTION: 507 debugFunction (pCmdDispatch->pStadHandles, 508 *(TI_UINT32*)&pParam->content, 509 (void*)((TI_UINT32*)&pParam->content + 1)); 510 break; 511 default: 512 TRACE1(pCmdDispatch->hReport, REPORT_SEVERITY_ERROR, "cmdDispatch_DebugFuncSet bad param=%X\n", pParam->paramType); 513 break; 514 } 515 return TI_OK; 516 } 517 518 519 520 /*yael - this function is not in use*/ 521 static TI_STATUS cmdDispatch_DebugFuncGet (TI_HANDLE hCmdDispatch, paramInfo_t *pParam) 522 { 523 if (hCmdDispatch == NULL || pParam == NULL) 524 { 525 return TI_NOK; 526 } 527 528 /*yael - no use for that function */ 529 530 return TI_OK; 531 } 532 533 #endif /* TI_DBG */ 534 535 536