PageRenderTime 47ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/drivers/net/wireless/tiwlan1251/common/src/TNETW_Driver/TNETWIF/Inc/whalHwAccess.h

http://github.com/CyanogenMod/cm-kernel
C Header | 178 lines | 71 code | 31 blank | 76 comment | 1 complexity | f64aa4615c0e5049d915b27772630ef0 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. /****************************************************************************
  36. *
  37. * MODULE: hwAccess.c
  38. * PURPOSE: Support access to the wlan hardware registers and memory
  39. *
  40. ****************************************************************************/
  41. #ifndef __WHAL_HW_ACCESS_H__
  42. #define __WHAL_HW_ACCESS_H__
  43. /************************************************************************
  44. * partition addresses
  45. *
  46. * each access region will have its base address and the HAL will use only the logical offset
  47. * there isnt an access region for the registers.
  48. * for the mem the access regions are defined for their functionality : double-buffer,tx registers, rx registers etc...
  49. *
  50. * EXAMPLE :
  51. * if the HAL wants to read register at offset 0xA the the call will be :
  52. * whal_hwAccess_ReadReg(hHwAccess, 0xA, &RegVal);
  53. * if the HAL wants to read 4bytes from mem at offset 0x10 in the double-buffer region the the call will be:
  54. * whal_hwAccess_ReadMem(hHwAccess, HW_ACCESS_BASE_DOUBLE_BUFFER + 0x10, &RegVal , 4);
  55. ************************************************************************/
  56. #define HW_ACCESS_BASE_DOUBLE_BUFFER 0
  57. #define HW_ACCESS_BASE_CMD_MBX 0
  58. #define HEALTH_REPORT_BUS_ERROR BIT_2
  59. /************************************************************************
  60. * Return codes
  61. ************************************************************************/
  62. #define ERROR_HW_ACCEESS_ADDR 10
  63. #define ERROR_HW_ACCEESS_LEN 11
  64. /************************************************************************
  65. * Types
  66. ************************************************************************/
  67. typedef void (*HwAccess_callback_t)(void *data,int status);
  68. /************************************************************************
  69. * partition addresses
  70. ************************************************************************/
  71. /* Download phase */
  72. #define HW_ACCESS_DOWN_PART0_SIZE 0x16800
  73. #define HW_ACCESS_DOWN_PART0_ADDR 0x0
  74. #define HW_ACCESS_DOWN_PART1_SIZE 0x8800
  75. #define HW_ACCESS_DOWN_PART1_ADDR 0x300000
  76. /* Working phase */
  77. #ifdef TNETW1251
  78. #define HW_ACCESS_WORK_PART0_SIZE 0x14000
  79. #define HW_ACCESS_WORK_PART0_ADDR 0x28000
  80. #define HW_ACCESS_WORK_PART1_SIZE 0xB000
  81. #else
  82. #define HW_ACCESS_WORK_PART0_SIZE 0x16800
  83. #define HW_ACCESS_WORK_PART0_ADDR 0xF000
  84. #define HW_ACCESS_WORK_PART1_SIZE 0x8800
  85. #endif
  86. #define HW_ACCESS_WORK_PART1_ADDR 0x300000
  87. #define HW_ACCESS_MAX_PARTITIONS 2
  88. #ifndef HW_ACCESS_MEMORY_MAX_RANGE /* this macro is already defined in SDIO client driver */
  89. #define HW_ACCESS_MEMORY_MAX_RANGE 0x1FFC0
  90. #endif /* ifndef HW_ACCESS_MEMORY_MAX_RANGE */
  91. #define HW_ACCESS_PRAM_MAX_RANGE 0x3c000
  92. /************************************************************************
  93. * Functions
  94. ************************************************************************/
  95. extern int whal_hwAccess_ReConfig(TI_HANDLE hHwAccess);
  96. extern int whal_hwAccess_Stop(TI_HANDLE hHwAccess);
  97. #if (defined (HW_ACCESS_SDIO) || defined (HW_ACCESS_WSPI))
  98. TI_STATUS whal_hwAccess_RecreateInterface(TI_HANDLE hHwAccess);
  99. #endif
  100. /* new API */
  101. /***********/
  102. TI_HANDLE whal_hwAccess_Create(TI_HANDLE hOs);
  103. int whal_hwAccess_Destroy(TI_HANDLE hHwAccess);
  104. int whal_hwAccess_Config(TI_HANDLE hHwAccess, TI_HANDLE hReport,UINT32 RegBaseAddr, UINT32 MemBaseAddr, HwAccess_callback_t CBFunc,void* CBArg);
  105. int whal_hwAccess_SetPartitions(TI_HANDLE hHwAccess, TNETIF_HwAccess_SetPartition_mode_e partitionMode, UINT32 partition_start);
  106. int whal_hwAccess_SetPartitionsAsync(TI_HANDLE hHwAccess, TNETIF_HwAccess_SetPartition_mode_e partitionMode, UINT32 partition_start);
  107. UINT8 whal_hwAccess_Get_Async_Mode(TI_HANDLE hHwAccess);
  108. int whal_hwAccess_WriteELP(TI_HANDLE hHwAccess, UINT32 data);
  109. int whal_hwAccess_WriteELPAsync(TI_HANDLE hHwAccess, UINT32 data, BOOL bCb, BOOL bMore);
  110. int whal_hwAccess_ReadELPAsync (TI_HANDLE hHwAccess, UINT8 *data, BOOL bCb, BOOL bMore);
  111. int whal_hwAccess_ReadMem_Align(TI_HANDLE hHwAccess, UINT32 addr, UINT8* data, UINT16 len);
  112. int whal_hwAccess_WriteMem_Align(TI_HANDLE hHwAccess, UINT32 addr, UINT8* data, UINT16 len);
  113. int whal_hwAccess_ReadMemAsync_Align(TI_HANDLE hHwAccess, UINT32 addr, UINT8* data, UINT16 len);
  114. int whal_hwAccess_WriteMemAsync_Align(TI_HANDLE hHwAccess, UINT32 addr, UINT8* data, UINT16 len);
  115. int whal_hwAccess_ReadMem(TI_HANDLE hHwAccess, UINT32 addr, UINT8* data, UINT16 len);
  116. int whal_hwAccess_WriteMem(TI_HANDLE hHwAccess, UINT32 addr, UINT8* data, UINT16 len);
  117. int whal_hwAccess_ReadMemAsync(TI_HANDLE hHwAccess, UINT32 addr, UINT8* data, UINT16 len);
  118. TI_STATUS whal_hwAccess_WriteMemAsync(TI_HANDLE hHwAccess, UINT32 addr, UINT8* data, UINT16 len);
  119. int whal_hwAccess_ReadReg(TI_HANDLE hHwAccess, UINT32 addr, UINT32* data);
  120. int whal_hwAccess_WriteReg(TI_HANDLE hHwAccess, UINT32 addr, UINT32 data);
  121. int whal_hwAccess_ReadRegAsync(TI_HANDLE hHwAccess, UINT32 addr, UINT32* data);
  122. int whal_hwAccess_WriteRegAsync(TI_HANDLE hHwAccess, UINT32 addr, UINT32 data);
  123. void whal_hwAccess_Print(TI_HANDLE hHwAccess);
  124. /*old - new*/
  125. /*
  126. * Hardware memory Api
  127. */
  128. UINT8 whal_hwAccess_GetU08 (TI_HANDLE hHwAccess, UINT32 Addr);
  129. void whal_hwAccess_SetU08 (TI_HANDLE hHwAccess, UINT32 Addr, UINT8 Val);
  130. void whal_hwAccess_SetU08_Bits (TI_HANDLE hHwAccess, UINT32 Addr, UINT8 BitsVal);
  131. void whal_hwAccess_ResetU08_Bits(TI_HANDLE hHwAccess, UINT32 Addr, UINT8 BitsVal);
  132. UINT16 whal_hwAccess_GetU16 (TI_HANDLE hHwAccess, UINT32 Addr);
  133. void whal_hwAccess_SetU16 (TI_HANDLE hHwAccess, UINT32 Addr, UINT16 Val);
  134. void whal_hwAccess_SetU16_Bits (TI_HANDLE hHwAccess, UINT32 Addr, UINT16 BitsVal);
  135. void whal_hwAccess_ResetU16_Bits(TI_HANDLE hHwAccess, UINT32 Addr, UINT16 BitsVal);
  136. UINT32 whal_hwAccess_GetU32 (TI_HANDLE hHwAccess, UINT32 Addr);
  137. void whal_hwAccess_SetU32 (TI_HANDLE hHwAccess, UINT32 Addr, UINT32 Val);
  138. void whal_hwAccess_SetU32_Bits (TI_HANDLE hHwAccess, UINT32 Addr, UINT32 BitsVal);
  139. void whal_hwAccess_ResetU32_Bits(TI_HANDLE hHwAccess, UINT32 Addr, UINT32 BitsVal);
  140. /*
  141. * Hardware Registers Api
  142. */
  143. void whal_hwAccess_RegSetBitVal (TI_HANDLE hHwAccess, UINT32 RegAddr, UINT32 BitVal);
  144. void whal_hwAccess_RegResetBitVal(TI_HANDLE hHwAccess, UINT32 RegAddr, UINT32 BitVal);
  145. int whal_hwAccess_RegIsBitSet (TI_HANDLE hHwAccess, UINT32 RegAddr, UINT32 BitVal);
  146. TI_STATUS whal_hwAccess_RegisterForErrorCB(TI_HANDLE hHwAccess,void* CbFunc,TI_HANDLE CbObj);
  147. #endif /*__WHAL_HW_ACCESS_H__*/