PageRenderTime 55ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

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

http://github.com/CyanogenMod/cm-kernel
C | 106 lines | 46 code | 8 blank | 52 comment | 2 complexity | e54737a422b13a64298bd1f92d5c5a9e 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 <linux/errno.h>
  36. #include <linux/string.h>
  37. #include "arch_ti.h"
  38. #include "osTIType.h"
  39. #include "osApi.h"
  40. #include "ioctl_init.h"
  41. #include "802_11Defs.h"
  42. #include "mlmeApi.h"
  43. /****************************************************************************/
  44. /* */
  45. /* Definition of Constants */
  46. /* */
  47. /****************************************************************************/
  48. #define SIZEOF_DOT11_MGMT_HEADER 0x18
  49. #define SIZEOF_MLME_FRAME_INFO 0x60
  50. #ifdef EXC_MODULE_INCLUDED
  51. #define SIZEOF_BEACON_FRM 0x57
  52. #else
  53. #define SIZEOF_BEACON_FRM 0x53
  54. #endif
  55. #define SIZEOF_ELEMENT_HDR 0x02
  56. #define SIZEOF_MGMT_FRAME 0x920
  57. #define SIZEOF_ASSOC_RSP_TYPE 0x26
  58. #define SIZEOF_AUTH_MSG_TYPE 0x0a
  59. #define SIZEOF_DEATUH_MSG_TYPE 0x02
  60. #define SIZEOF_DISASSOC_MSG_TYPE 0x02
  61. #define CHECK_STRUCT_SIZE(_type,_size) \
  62. { \
  63. if (sizeof(_type) != _size) \
  64. { \
  65. print_info(KERN_INFO"\n.... ERROR in size of %s struct 0x%08x should be 0x%08x.....\n", \
  66. #_type, (int)sizeof(_type),(int)_size); \
  67. rc = -EINVAL; \
  68. } \
  69. }
  70. /************************************************************************
  71. * packed_strct_tst *
  72. ************************************************************************
  73. DESCRIPTION: Used to test structures for the correct packed size
  74. INPUT: Void
  75. OUTPUT: Print Debug statements if the structures are not the expected size
  76. RETURN: 0=success
  77. -EINVAL - failure
  78. ************************************************************************/
  79. int packed_struct_tst (void)
  80. {
  81. int rc = 0;
  82. print_info("\nTIWLAN: Testing sizes of packed structures...\n");
  83. CHECK_STRUCT_SIZE(dot11_mgmtHeader_t, SIZEOF_DOT11_MGMT_HEADER);
  84. CHECK_STRUCT_SIZE(dot11_eleHdr_t, SIZEOF_ELEMENT_HDR);
  85. CHECK_STRUCT_SIZE(beacon_probeRsp_t, SIZEOF_BEACON_FRM);
  86. CHECK_STRUCT_SIZE(assocRsp_t, SIZEOF_ASSOC_RSP_TYPE );
  87. CHECK_STRUCT_SIZE(authMsg_t, SIZEOF_AUTH_MSG_TYPE);
  88. CHECK_STRUCT_SIZE(deAuth_t, SIZEOF_DEATUH_MSG_TYPE);
  89. CHECK_STRUCT_SIZE(disAssoc_t, SIZEOF_DISASSOC_MSG_TYPE);
  90. CHECK_STRUCT_SIZE(dot11_mgmtFrame_t, SIZEOF_MGMT_FRAME);
  91. CHECK_STRUCT_SIZE(mlmeFrameInfo_t,SIZEOF_MLME_FRAME_INFO);
  92. print_info("TIWLAN: packet structure size test %s\n", rc?"failed":"passed");
  93. return rc;
  94. }