PageRenderTime 42ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

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

http://github.com/CyanogenMod/cm-kernel
C | 164 lines | 82 code | 19 blank | 63 comment | 9 complexity | 7269f1680ef2c0ba08965dc329575266 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. #include "ioctl_init.h"
  36. #include "esta_drv.h"
  37. #include "ioctl_utils.h"
  38. #include "report.h"
  39. #include "osClsfr.h"
  40. #define CONFIG_MGR(dev) ((configMgr_t *) \
  41. ((dev && dev->priv) ? ((tiwlan_net_dev_t *) dev->priv)->adapter.CoreHalCtx : NULL ) )
  42. typedef struct
  43. {
  44. int err_code;
  45. char *desc;
  46. }
  47. configMgr_error_desc_t;
  48. static configMgr_error_desc_t configMgr_error_desc[] =
  49. {
  50. { OK, "OK" },
  51. { NOK, "NOK" },
  52. { PARAM_NOT_SUPPORTED, "PARAM_NOT_SUPPORTED" },
  53. { PARAM_VALUE_NOT_VALID, "PARAM_VALUE_NOT_VALID" },
  54. { CONFIGURATION_NOT_VALID, "CONFIGURATION_NOT_VALID" },
  55. { NO_SITE_SELECTED_YET, "NO_SITE_SELECTED_YET" },
  56. { RE_SCAN_NEEDED, "RE_SCAN_NEEDED" },
  57. { EXTERNAL_SET_PARAM_DENIED, "EXTERNAL_SET_PARAM_DENIED" },
  58. { EXTERNAL_GET_PARAM_DENIED, "EXTERNAL_GET_PARAM_DENIED" },
  59. { PARAM_MODULE_NUMBER_INVALID, "PARAM_MODULE_NUMBER_INVALID" },
  60. { STATION_IS_NOT_RUNNING, "STATION_IS_NOT_RUNNING" },
  61. { CARD_IS_NOT_INSTALLED, "CARD_IS_NOT_INSTALLED" },
  62. /* Data path section */
  63. /* { RX_BSS_TYPE_ERROR ,*/
  64. /* { RX_BSS_ID_ERROR ,*/
  65. /* { TX_QUEUE_SELECTED_OK ,*/
  66. /* { NO_TX_QUEUE_SELECTED ,*/
  67. /* { TX_STATUS_PENDING ,*/
  68. /* { TX_STATUS_NO_RESOURCES ,*/
  69. /* { TX_STATUS_FAILURE ,*/
  70. /* { TX_STATUS_OK ,*/
  71. /* 4x section */
  72. /* { MAKE_CONCATENATION ,*/
  73. /* { SEND_ONE_MSDU ,*/
  74. /* { DO_NOT_SEND_MSDU ,*/
  75. /* { FOUR_X_DISABLE ,*/
  76. /**/
  77. /* (Scanning section) */
  78. /* { NO_COUNTRY ,*/
  79. /**/
  80. /* (Setting power after select) */
  81. /* { TX_POWER_SHOULD_NOT_BE_SET ,*/
  82. /* (changing service channel) */
  83. /* { CHANNEL_CHANGED ,*/
  84. /* { SUPPORT_IMMEDIATE_MEASUREMENT_ONLY,*/
  85. /* { MEASUREMENT_TYPE_NOT_SUPPORT,*/
  86. /* { MEASUREMENT_CAN_NOT_EXECUTED_IN_PARALLEL,*/
  87. /* { MEASUREMENT_REQUEST_IGNORED,*/
  88. /* { CANNOT_SET_MEASUREMENT_PARAM_WHEN_ACTIVATED,*/
  89. /* { REGULATORY_DOMAIN_SET_TX_POWER_PARAM,*/
  90. /* { CANNOT_SET_CHANNEL_THAT_IS_NOT_SUPPORTED,*/
  91. };
  92. int print_err_desc(int err)
  93. {
  94. int i;
  95. for( i=0; i<SIZE_ARR(configMgr_error_desc);i++ )
  96. {
  97. if(configMgr_error_desc[i].err_code == err )
  98. {
  99. print_err("---err(%d) configMgr() = %s\n", err, configMgr_error_desc[i].desc );
  100. return -err;
  101. }
  102. }
  103. print_err("---err(%d) configMgr failed\n", err);
  104. return -err;
  105. }
  106. void print_memory_dump(char *addr, int size )
  107. {
  108. #ifdef DEBUG_MESSAGES
  109. int i;
  110. char buf[4096];
  111. if( size * 4 > sizeof(buf) ) {
  112. print_err("print_memory_dump(): buffer too small\n");
  113. return;
  114. }
  115. buf[0] = 0;
  116. for(i=0; i<size; i++ ) {
  117. if( !(i % 16) )
  118. sprintf(&buf[strlen(buf)], "%s%p: ", (i) ? "\n" : "", addr+i );
  119. sprintf(&buf[strlen(buf)], "%02x ", (unsigned char)addr[i] );
  120. }
  121. print_info("%s\n", buf);
  122. #endif /* DEBUG_MESSAGES */
  123. }
  124. #ifdef TI_DBG
  125. #ifndef TIWLAN_MSM7000
  126. TI_STATUS debugFunction(TI_HANDLE hConfigMgr,
  127. UINT32 functionNumber,
  128. void *pParam);
  129. #endif
  130. #endif
  131. int util_hal_debug_print(struct net_device *dev, ULONG *data)
  132. {
  133. hal_print_param_t *p = (hal_print_param_t *) data;
  134. UINT32 opt_data = 0;
  135. if( p->optional_param )
  136. {
  137. if( copy_from_user(&opt_data, p->optional_param, sizeof(opt_data) ) )
  138. return -EFAULT;
  139. }
  140. print_deb("HAL_DEBUG_PRINT: func_id=%d, param=%x\n", p->func_id, opt_data );
  141. #ifdef TI_DBG
  142. debugFunction(CONFIG_MGR(dev), p->func_id, &opt_data );
  143. #endif
  144. return 0;
  145. }