1 /** \file report.c 2 * \brief report module implementation 3 * 4 * \see report.h 5 */ 6 /**************************************************************************** 7 **+-----------------------------------------------------------------------+** 8 **| |** 9 **| Copyright(c) 1998 - 2008 Texas Instruments. All rights reserved. |** 10 **| All rights reserved. |** 11 **| |** 12 **| Redistribution and use in source and binary forms, with or without |** 13 **| modification, are permitted provided that the following conditions |** 14 **| are met: |** 15 **| |** 16 **| * Redistributions of source code must retain the above copyright |** 17 **| notice, this list of conditions and the following disclaimer. |** 18 **| * Redistributions in binary form must reproduce the above copyright |** 19 **| notice, this list of conditions and the following disclaimer in |** 20 **| the documentation and/or other materials provided with the |** 21 **| distribution. |** 22 **| * Neither the name Texas Instruments nor the names of its |** 23 **| contributors may be used to endorse or promote products derived |** 24 **| from this software without specific prior written permission. |** 25 **| |** 26 **| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |** 27 **| "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |** 28 **| LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |** 29 **| A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |** 30 **| OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |** 31 **| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |** 32 **| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |** 33 **| DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |** 34 **| THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |** 35 **| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |** 36 **| OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |** 37 **| |** 38 **+-----------------------------------------------------------------------+** 39 ****************************************************************************/ 40 41 /****************************************************************************************************/ 42 /* */ 43 /* MODULE: report.c */ 44 /* PURPOSE: report module implementation */ 45 /* */ 46 /****************************************************************************************************/ 47 #include "osTIType.h" 48 #include "osApi.h" 49 #include "report.h" 50 #include "commonTypes.h" 51 #include "paramIn.h" 52 #include "utils.h" 53 54 55 /************************************************************************ 56 * report_create * 57 ************************************************************************ 58 DESCRIPTION: Report module creation function, called by the config mgr in creation phase 59 performs the following: 60 - Allocate the report handle 61 62 INPUT: hOs - Handle to OS 63 64 65 OUTPUT: 66 67 RETURN: Handle to the report module on success, NULL otherwise 68 69 ************************************************************************/ 70 TI_HANDLE report_create(TI_HANDLE hOs) 71 { 72 report_t *pReport; 73 74 pReport = os_memoryAlloc(hOs, sizeof(report_t)); 75 if(!pReport) 76 return NULL; 77 78 pReport->hOs = hOs; 79 80 return(pReport); 81 } 82 83 /************************************************************************ 84 * report_config * 85 ************************************************************************ 86 DESCRIPTION: Report module configuration function, called by the config mgr in configuration phase 87 performs the following: 88 - Reset & init local variables 89 - Resets all report modules bits 90 - Resets all severities bits 91 - Init the description strings 92 93 INPUT: hReport - Report handle 94 hOs - OS handle 95 96 97 OUTPUT: 98 99 RETURN: OK on success, NOK otherwise 100 101 ************************************************************************/ 102 TI_STATUS report_config(TI_HANDLE hReport, TI_HANDLE hOs, reportInitParams_t * init_params) 103 { 104 report_t *pReport = (report_t *)hReport; 105 106 pReport->hOs = hOs; 107 108 os_memoryZero(NULL, pReport->SeverityTable, sizeof(pReport->SeverityTable)); 109 os_memoryZero(NULL, pReport->ModuleTable, sizeof(pReport->ModuleTable)); 110 111 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[CONFIG_MGR_MODULE_LOG]), "CONFIG_MGR", sizeof("CONFIG_MGR")); 112 113 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[SME_SM_MODULE_LOG]), "SME_SM ", sizeof("SME_SM ")); 114 115 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[SITE_MGR_MODULE_LOG]), "SITE_MGR ", sizeof("SITE_MGR ")); 116 117 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[CONN_MODULE_LOG]), "CONN ", sizeof("CONN ")); 118 119 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[MLME_SM_MODULE_LOG]), "MLME_SM ", sizeof("MLME_SM ")); 120 121 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[AUTH_MODULE_LOG]), "AUTH ", sizeof("AUTH ")); 122 123 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[ASSOC_MODULE_LOG]), "ASSOC ", sizeof("ASSOC ")); 124 125 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[RX_DATA_MODULE_LOG]), "RX_DATA ", sizeof("RX_DATA ")); 126 127 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[TX_DATA_MODULE_LOG]), "TX_DATA ", sizeof("TX_DATA ")); 128 129 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[CTRL_DATA_MODULE_LOG]), "CTRL_DATA ", sizeof("CTRL_DATA ")); 130 131 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[RSN_MODULE_LOG]), "RSN ", sizeof("RSN ")); 132 133 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[HAL_RX_MODULE_LOG]), "HAL_RX ", sizeof("HAL_RX ")); 134 135 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[HAL_TX_MODULE_LOG]), "HAL_TX ", sizeof("HAL_TX ")); 136 137 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[HAL_CTRL_MODULE_LOG]), "HAL_CTRL ", sizeof("HAL_CTRL ")); 138 139 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[HAL_SECURITY_MODULE_LOG]), "HAL_SEC ", sizeof("HAL_SEC ")); 140 141 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[MEM_MGR_MODULE_LOG]), "MEM_MGR ", sizeof("MEM_MGR ")); 142 143 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[REPORT_MODULE_LOG]), "REPORT ", sizeof("REPORT ")); 144 145 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[SITE_UPDATE_MODULE_LOG]), "SITE_UPDATE", sizeof("SITE_UPDATE")); 146 147 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[REGULATORY_DOMAIN_MODULE_LOG]), "REGULATORY_DOMAIN ", sizeof("REGULATORY_DOMAIN ")); 148 149 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[MEASUREMENT_MNGR_MODULE_LOG]), "MEASUREMENT MNGR ", sizeof("MEASUREMENT MNGR ")); 150 151 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[MEASUREMENT_SRV_MODULE_LOG]), "MEASUREMENT SRV ", sizeof("MEASUREMENT SRV ")); 152 153 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[SOFT_GEMINI_MODULE_LOG]), "SOFT_GEMINI ", sizeof("SOFT_GEMINI ")); 154 155 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[SC_MODULE_LOG]), "SC_MODULE_LOG ", sizeof("SC_MODULE_LOG ")); 156 157 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[EXC_MANAGER_MODULE_LOG]), "EXC_MANAGER ", sizeof("EXC_MANAGER ")); 158 159 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[ROAMING_MANAGER_MODULE_LOG]), "ROAMING_MANAGER ", sizeof("ROAMING_MANAGER ")); 160 161 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[QOS_MANAGER_MODULE_LOG]), "QOS_MANAGER ", sizeof("QOS_MANAGER ")); 162 163 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[TRAFFIC_ADM_CTRL_MODULE_LOG]), "TRAFFIC_ADM_CTRL ", sizeof("TRAFFIC_ADM_CTRL ")); 164 165 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[POWER_MANAGER_MODULE_LOG]), "POWER_MANAGER ", sizeof("POWER_MANAGER ")); 166 167 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[POWER_CONTROL_MODULE_LOG]), "POWER_CONTROL ", sizeof("POWER_CONTROL ")); 168 169 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[POWER_SERVER_MODULE_LOG]), "POWER_SERVER ", sizeof("POWER_SERVER ")); 170 171 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[ELP_MODULE_LOG]), "ELP ", sizeof("ELP ")); 172 173 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[SCR_MODULE_LOG]), "SCR ", sizeof("SCR ")); 174 175 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[SCAN_SRV_MODULE_LOG]), "SCAN SERVICE ", sizeof("SCAN SERVICE ")); 176 177 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[SCAN_CNCN_MODULE_LOG]), "SCAN CONCENTRATOR", sizeof("SCAN CONCENTRATOR")); 178 179 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[SCAN_MNGR_MODULE_LOG]), "SCAN MANAGER ", sizeof("SCAN MANAGER ")); 180 181 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[GWSI_ADAPT_MODULE_LOG]), "GWSI_ADAPT ", sizeof("GWSI_ADAPT ")); 182 183 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[GWSI_ADAPT_CB_MODULE_LOG]), "GWSI_ADAPT_CB ", sizeof("GWSI_ADAPT_CB ")); 184 185 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[CORE_ADAPT_MODULE_LOG]), "CORE_ADAPT ", sizeof("CORE_ADAPT ")); 186 187 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[TX_HW_QUEUE_MODULE_LOG]), "TX HW QUEUE ", sizeof("TX HW QUEUE ")); 188 189 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[TX_CTRL_BLK_MODULE_LOG]), "TX CTRL BLK ", sizeof("TX CTRL BLK ")); 190 191 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[TX_RESULT_MODULE_LOG]), "TX RESULT ", sizeof("TX RESULT ")); 192 193 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[TNETW_IF_MODULE_LOG]), "TNETW IF ", sizeof("TNETW IF ")); 194 195 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[TNETW_ARBITER_MODULE_LOG]), "TNETW ARBITER", sizeof("TNETW ARBITER")); 196 197 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[CURR_BSS_MODULE_LOG]), "CURR BSS", sizeof("CURR BSS")); 198 199 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[FW_EVENT_MODULE_LOG]), "FW EVENT", sizeof("FW EVENT")); 200 201 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[CMD_MBOX_MODULE_LOG]), "CMD MBOX", sizeof("CMD MBOX")); 202 203 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[CMDQUEUE_MODULE_LOG]), "CMD QUEUE", sizeof("CMD QUEUE")); 204 205 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[EVENT_MBOX_MODULE_LOG]), "EVENT MBOX", sizeof("EVENT MBOX")); 206 207 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[TNETW_DRV_MODULE_LOG]), "TNETW DRV", sizeof("TNETW DRV")); 208 209 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[TNETW_XFER_MODULE_LOG]), "TX XFER ", sizeof("TX XFER ")); 210 211 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[RECOVERY_MGR_MODULE_LOG]), "RECOVERY MGR", sizeof("RECOVERY MGR")); 212 213 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[RECOVERY_CTRL_MODULE_LOG]), "RECOVERY CTRL", sizeof("RECOVERY CTRL")); 214 215 os_memoryCopy(hOs, (void *)(pReport->moduleDesc[HW_INIT_MODULE_LOG]), "HW INIT", sizeof("HW INIT")); 216 217 report_setReportModuleTable( hReport, (tiUINT8 *)init_params->ModuleTable); 218 report_setReportSeverityTable( hReport, (tiUINT8 *)init_params->SeverityTable); 219 220 return OK; 221 } 222 223 /************************************************************************ 224 * report_unLoad * 225 ************************************************************************ 226 DESCRIPTION: report module unload function, called by the config mgr in the unload phase 227 performs the following: 228 - Free all memory allocated by the module 229 230 INPUT: hReport - report handle. 231 232 233 OUTPUT: 234 235 RETURN: OK on success, NOK otherwise 236 237 ************************************************************************/ 238 TI_STATUS report_unLoad(TI_HANDLE hReport) 239 { 240 report_t *pReport = (report_t *)hReport; 241 242 #if defined(TIWLN_WINCE30) && defined(TI_DBG) 243 closeMyFile(); 244 #endif 245 246 utils_nullMemoryFree(pReport->hOs, pReport, sizeof(report_t)); 247 return OK; 248 } 249 250 251 252 253 /** 254 * 255 * report_setReportModulet 256 * 257 * \b Description: 258 * 259 * Sets the relevant bit in the reportModule variable. 260 * 261 * \b ARGS: 262 * 263 * I - hReport - Report handle \n 264 * I - module_index - Report module index in the table \n 265 * 266 * \b RETURNS: 267 * 268 * None. 269 */ 270 void report_setReportModule(TI_HANDLE hReport, tiUINT8 module_index) 271 { 272 ((report_t *)hReport)->ModuleTable[module_index] = 1; 273 } 274 275 276 /** 277 * 278 * report_clearReportModule 279 * 280 * \b Description: 281 * 282 * Clears the relevant bit in the reportModule variable. 283 * 284 * \b ARGS: 285 * 286 * I - hReport - Report handle \n 287 * I - module_index - Report module index in the table \n 288 289 * 290 * \b RETURNS: 291 * 292 * None. 293 */ 294 void report_clearReportModule(TI_HANDLE hReport, tiUINT8 module_index) 295 { 296 ((report_t *)hReport)->ModuleTable[module_index] = 0; 297 } 298 299 300 /** 301 * 302 * report_getReportModuleValue 303 * 304 * \b Description: 305 * 306 * Returns the value of reportModule. 307 * 308 * \b ARGS: 309 * 310 * I - hReport - Report handle \n 311 * I - module array - set index \n 312 * 313 * \b RETURNS: 314 * 315 * Report module value 316 */ 317 void report_getReportModuleTable(TI_HANDLE hReport, tiUINT8 *pModules) 318 { 319 tiUINT8 index; 320 321 os_memoryCopy(NULL, (void *)pModules, (void *)(((report_t *)hReport)->ModuleTable), sizeof(((report_t *)hReport)->ModuleTable)); 322 323 for (index = 0; index < sizeof(((report_t *)hReport)->ModuleTable); index++) 324 { 325 pModules[index] += '0'; 326 } 327 } 328 329 330 /** 331 * 332 * report_setReportModuleTable 333 * 334 * \b Description: 335 * 336 * Sets the value of reportModule. 337 * 338 * \b ARGS: 339 * 340 * I - hReport - Report handle \n 341 * I - module array - set index \n 342 343 * 344 * \b RETURNS: 345 * 346 * None. 347 */ 348 void report_setReportModuleTable(TI_HANDLE hReport, tiUINT8 *pModules) 349 { 350 tiUINT8 index; 351 352 for (index = 0; index < sizeof(((report_t *)hReport)->ModuleTable); index++) 353 { 354 pModules[index] -= '0'; 355 } 356 357 os_memoryCopy(NULL, (void *)(((report_t *)hReport)->ModuleTable), (void *)pModules, sizeof(((report_t *)hReport)->ModuleTable)); 358 } 359 360 361 /** 362 * 363 * report_setReportSeverity 364 * 365 * \b Description: 366 * 367 * Sets the relevant bit in the reportSeverity variable. 368 * 369 * \b ARGS: 370 * 371 * I - hReport - Report handle \n 372 * I - severity_index - Report severity index in the table \n 373 * 374 * \b RETURNS: 375 * 376 * None. 377 */ 378 void report_setReportSeverity(TI_HANDLE hReport, tiUINT8 severity_index) 379 { 380 ((report_t *)hReport)->SeverityTable[severity_index] = 0; 381 } 382 383 384 /** 385 * 386 * report_clearReportSeverityBit 387 * 388 * \b Description: 389 * 390 * Clears the relevant bit in the reportSeverity variable. 391 * 392 * \b ARGS: 393 * 394 * I - hReport - Report handle \n 395 * I - severity_index - Report severity index in the table \n 396 * 397 * \b RETURNS: 398 * 399 * None. 400 */ 401 void report_clearReportSeverity(TI_HANDLE hReport, tiUINT8 severity_index) 402 { 403 ((report_t *)hReport)->SeverityTable[severity_index] = 1; 404 } 405 406 407 /** 408 * 409 * report_getReportSeverityValue 410 * 411 * \b Description: 412 * 413 * Returns the value of reportSeverity. 414 * 415 * \b ARGS: 416 * 417 * I - hReport - Report handle \n 418 * I - severity_array 419 * 420 * \b RETURNS: 421 * 422 * None 423 */ 424 void report_getReportSeverityTable(TI_HANDLE hReport, tiUINT8 *pSeverities) 425 { 426 tiUINT8 index; 427 428 os_memoryCopy(NULL, (void *)pSeverities, (void *)(((report_t *)hReport)->SeverityTable), sizeof(((report_t *)hReport)->SeverityTable)); 429 430 for (index = 0; index < sizeof(((report_t *)hReport)->SeverityTable); index++) 431 { 432 pSeverities[index] += '0'; 433 } 434 } 435 436 /** 437 * 438 * report_setReportSeverityValue 439 * 440 * \b Description: 441 * 442 * Sets the value of reportSeverity. 443 * 444 * \b ARGS: 445 * 446 * I - hReport - Report handle \n 447 * I - severity_array 448 * 449 * \b RETURNS: 450 * 451 * None. 452 */ 453 void report_setReportSeverityTable(TI_HANDLE hReport, tiUINT8 *pSeverities) 454 { 455 tiUINT8 index; 456 457 for (index = 0; index < sizeof(((report_t *)hReport)->SeverityTable); index++) 458 { 459 pSeverities[index] -= '0'; 460 } 461 462 os_memoryCopy(NULL, (void *)(((report_t *)hReport)->SeverityTable), (void *)pSeverities, sizeof(((report_t *)hReport)->SeverityTable)); 463 } 464 465 466 /*********************************************************************** 467 * report_setParam 468 *********************************************************************** 469 DESCRIPTION: Report set param function, called by the following: 470 - config mgr in order to set a parameter from the OS abstraction layer. 471 - Form inside the driver 472 473 INPUT: hReport - Report handle. 474 pParam - Pointer to the parameter 475 476 OUTPUT: 477 478 RETURN: OK on success, NOK otherwise 479 480 ************************************************************************/ 481 TI_STATUS report_setParam(TI_HANDLE hReport, 482 whalParamInfo_t *pParam) 483 { 484 switch((externalParam_e)pParam->paramType) 485 { 486 case REPORT_MODULE_ON_PARAM: 487 report_setReportModule(hReport, pParam->content.ModuleTable[0]); 488 break; 489 490 case REPORT_MODULE_OFF_PARAM: 491 report_clearReportModule(hReport, pParam->content.ModuleTable[0]); 492 break; 493 494 case REPORT_MODULE_TABLE_PARAM: 495 report_setReportModuleTable(hReport, (tiUINT8 *)pParam->content.ModuleTable); 496 break; 497 498 case REPORT_SEVERITY_ON_PARAM: 499 report_setReportSeverity(hReport, pParam->content.SeverityTable[0]); 500 break; 501 502 case REPORT_SEVERITY_OFF_PARAM: 503 report_clearReportSeverity(hReport, pParam->content.SeverityTable[0]); 504 break; 505 506 case REPORT_SEVERITY_TABLE_PARAM: 507 report_setReportSeverityTable(hReport, (tiUINT8 *)pParam->content.SeverityTable); 508 break; 509 510 case REPORT_PPMODE_VALUE_PARAM: 511 os_setDebugMode((BOOL)pParam->content.reportPPMode); 512 break; 513 default: 514 WLAN_REPORT_ERROR(hReport, REPORT_MODULE_LOG, ("Set param, Params is not supported, %d\n", pParam->paramType)); 515 return PARAM_NOT_SUPPORTED; 516 } 517 518 return OK; 519 } 520 521 /*********************************************************************** 522 * report_getParam 523 *********************************************************************** 524 DESCRIPTION: Report get param function, called by the following: 525 - config mgr in order to get a parameter from the OS abstraction layer. 526 - from inside the driver 527 528 INPUT: hReport - Report handle. 529 pParam - Pointer to the parameter 530 531 OUTPUT: 532 533 RETURN: OK on success, NOK otherwise 534 535 ************************************************************************/ 536 TI_STATUS report_getParam(TI_HANDLE hReport, 537 whalParamInfo_t *pParam) 538 { 539 540 switch((externalParam_e)pParam->paramType) 541 { 542 case REPORT_MODULE_TABLE_PARAM: 543 report_getReportModuleTable(hReport, (tiUINT8 *)pParam->content.ModuleTable); 544 break; 545 546 case REPORT_SEVERITY_TABLE_PARAM: 547 report_getReportSeverityTable(hReport, (tiUINT8 *)pParam->content.SeverityTable); 548 break; 549 550 default: 551 WLAN_REPORT_ERROR(hReport, REPORT_MODULE_LOG, ("Get param, Params is not supported, %d\n", pParam->paramType)); 552 return PARAM_NOT_SUPPORTED; 553 } 554 555 return OK; 556 } 557 558 559 /*********************************************************************** 560 * report_dummy 561 *********************************************************************** 562 DESCRIPTION: Dummy function used to solve warning problems 563 when REPORT_LOG flag is disabled 564 565 INPUT: 566 567 OUTPUT: 568 569 RETURN: 570 571 ************************************************************************/ 572 void report_dummy (const char* fmt, ...) 573 { 574 } 575