PageRenderTime 50ms CodeModel.GetById 24ms RepoModel.GetById 1ms app.codeStats 0ms

/drivers/net/wireless/tiwlan1251/pform/linux/src/proc_stat.c

http://github.com/CyanogenMod/cm-kernel
C | 105 lines | 53 code | 17 blank | 35 comment | 0 complexity | 87acaf85d1b5e68b75b159824d98890f MD5 | raw file
Possible License(s): AGPL-1.0, GPL-2.0, LGPL-2.0
  1. /****************************************************************************
  2. **+-----------------------------------------------------------------------+**
  3. **| |**
  4. **| Copyright(c) 1998 - 2008 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. /* Dm: #include <linux/config.h> */
  36. #include <linux/module.h>
  37. #include <linux/errno.h>
  38. #include <linux/string.h>
  39. #include <linux/proc_fs.h>
  40. #include "healthMonitor.h"
  41. #include "whalCtrl.h"
  42. #include "osTIType.h"
  43. #include "configMgr.h"
  44. int proc_stat_res_read_proc(char *page, char **start, off_t off, int count, int *eof, void *data);
  45. static struct proc_dir_entry *res;
  46. int proc_stat_init(TI_HANDLE *pHandle)
  47. {
  48. configMgr_t *pConfigManager = (configMgr_t *)pHandle;
  49. res = proc_mkdir("tiwlan", NULL);
  50. create_proc_read_entry("tiwlan0_proc_stat", 0, res, proc_stat_res_read_proc, pConfigManager->hHealthMonitor);
  51. return 0;
  52. }
  53. int proc_stat_res_read_proc(char *page, char **start, off_t off, int count, int *eof, void *data)
  54. {
  55. int len=0;
  56. healthMonitor_t *pHealthMonitor = (healthMonitor_t*) data;
  57. WHAL_CTRL *pWhalCtrl = (WHAL_CTRL *)pHealthMonitor->hHalCtrl;
  58. whalCtrl_hwStatus_t *pHwStatus = &pWhalCtrl->pHwCtrl->HwStatus;
  59. count -= 80; /* some reserve */
  60. len += (len<count)?sprintf(page+len,"-------------- STA Health Configuration ---------------\n"):0;
  61. len += (len<count)?sprintf(page+len,"Full recovery enabled = %d\n",pHealthMonitor->bFullRecoveryEnable):0;
  62. len += (len<count)?sprintf(page+len,"Timer interval = %d msec\n",pHealthMonitor->timerInterval):0;
  63. len += (len<count)?sprintf(page+len,"\n"):0;
  64. len += (len<count)?sprintf(page+len,"-------------- STA Health Failure Statistics ---------------\n"):0;
  65. len += (len<count)?sprintf(page+len,"Health test perfomred = %d\n",pHealthMonitor->numOfHealthTests):0;
  66. len += (len<count)?sprintf(page+len,"Full recovery performed = %d\n",pHealthMonitor->numOfRecoveryPerformed):0;
  67. len += (len<count)?sprintf(page+len,"No scan complete failure = %d\n",pHealthMonitor->recoveryTriggersNumber[ NO_SCAN_COMPLETE_FAILURE ]):0;
  68. len += (len<count)?sprintf(page+len,"Mailbox failure = %d\n",pHealthMonitor->recoveryTriggersNumber[ MBOX_FAILURE ]):0;
  69. len += (len<count)?sprintf(page+len,"HW awake failure = %d\n",pHealthMonitor->recoveryTriggersNumber[ HW_AWAKE_FAILURE ]):0;
  70. len += (len<count)?sprintf(page+len,"Bus error = %d\n",pHealthMonitor->recoveryTriggersNumber[ BUS_ERROR ]):0;
  71. len += (len<count)?sprintf(page+len,"Device error = %d\n",pHealthMonitor->recoveryTriggersNumber[ DEVICE_ERROR ]):0;
  72. len += (len<count)?sprintf(page+len,"Tx Stuck Errors = %d\n",pHealthMonitor->recoveryTriggersNumber[ TX_STUCK ]):0;
  73. len += (len<count)?sprintf(page+len,"Disconnect timeouts = %d\n",pHealthMonitor->recoveryTriggersNumber[ DISCONNECT_TIMEOUT ]):0;
  74. len += (len<count)?sprintf(page+len,"Power save failures = %d\n",pHealthMonitor->recoveryTriggersNumber[ POWER_SAVE_FAILURE ]):0;
  75. len += (len<count)?sprintf(page+len,"measurement failures = %d\n",pHealthMonitor->recoveryTriggersNumber[ MEASUREMENT_FAILURE ]):0;
  76. len += (len<count)?sprintf(page+len,"--------------- whalCtrl_PrintHwStatus ---------------\n\n"):0;
  77. len += (len<count)?sprintf(page+len,"NumMboxErrDueToPeriodicBuiltInTestCheck = %d\n", pHwStatus->NumMboxErrDueToPeriodicBuiltInTestCheck):0;
  78. len += (len<count)?sprintf(page+len,"NumMboxFailures = %d\n", pHwStatus->NumMboxFailures):0;
  79. len += (len<count)?sprintf(page+len, "\n"):0;
  80. *eof = 1;
  81. return len;
  82. }
  83. int proc_stat_destroy(void)
  84. {
  85. remove_proc_entry("tiwlan0_proc_stat", res);
  86. remove_proc_entry("tiwlan", NULL);
  87. return 0;
  88. }