PageRenderTime 41ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/drivers/net/wireless/tiwlan1251/common/src/BusAccess/Shm_Common/whalHwEeprom.h

http://github.com/CyanogenMod/cm-kernel
C Header | 300 lines | 40 code | 36 blank | 224 comment | 0 complexity | c7ba6625ac0432da02b9f0c8819c584f 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: whalHwEeprom.h */
  38. /* PURPOSE: Wlan hardware EEPROM access routines implemenatation */
  39. /* */
  40. /**************************************************************************/
  41. #ifndef _WHAL_HW_EEPROM_H
  42. #define _WHAL_HW_EEPROM_H
  43. #include "whalCommon.h"
  44. #include "TNETWIF.h"
  45. typedef struct _HwEeprom_T
  46. {
  47. TI_HANDLE hTNETWIF;
  48. TI_HANDLE hOs;
  49. TI_HANDLE hReport;
  50. } HwEeprom_T;
  51. extern HwEeprom_T *whal_hwEeprom_Create(TI_HANDLE hOs);
  52. extern int whal_hwEeprom_Destroy(HwEeprom_T *pHwEeprom);
  53. extern int whal_hwEeprom_Config (HwEeprom_T *pHwEeprom, TI_HANDLE hTNETWIF, TI_HANDLE hReport);
  54. #ifdef USE_SYNC_API
  55. extern int whal_hwEeprom_GetRadioTypeAndEEPROMversion(HwEeprom_T *pHwEeprom, UINT32 *major, UINT32 *minor, UINT32 *bugfix);
  56. /****************************
  57. Offsets of Wlan Hardware data
  58. ****************************/
  59. #define HW_EEPROM_AGC_TABLE_ADDR 0x18C
  60. #define HW_EEPROM_DAC_ADDR 0x20D
  61. #define HW_EEPROM_BIAS_ADDR 0x20E
  62. #define HW_EEPROM_OSC_ADDR 0x215
  63. #define MAX_AGC_TABLE_ENTRIES 128
  64. /*******************
  65. EEPROM access APIs
  66. *******************/
  67. #define MAX_OSC_CAL 15
  68. #define EEPROM_ACCESS_TO 10000 /* timeout counter */
  69. #define INVALID_PARAMETER1 -101
  70. /************************************************************************
  71. * UINT32 whal_hwEepromReadByte(UINT16 wAddr,UINT8 *pbVal) *
  72. *************************************************************************
  73. * DESCRIPTION: Reads a single byte from EEPROM. *
  74. * *
  75. * INPUT: wAddr - 16-bits EEPROM addrress *
  76. * pbVal - pointer the to output parameter - EEPROM value *
  77. * *
  78. * OUTPUT: *pbVal contains EEPROM value *
  79. * *
  80. * RETURN: OK - successful *
  81. * NOK timeout *
  82. *************************************************************************/
  83. UINT32 whal_hwEepromReadByte(HwEeprom_T *pHwEeprom, UINT16 wAddr,UINT8 *pbVal);
  84. /************************************************************************
  85. * UINT32 whal_hwEepromWriteByte(UINT16 wAddr,UINT8 bVal) *
  86. *************************************************************************
  87. * DESCRIPTION: Writes a single byte to EEPROM *
  88. * *
  89. * INPUT: wAddr - 16-bits EEPROM addrress *
  90. * bVal - new value *
  91. * *
  92. * OUTPUT: N/A *
  93. * *
  94. * RETURN: OK - successful *
  95. * NOK timeout *
  96. *************************************************************************/
  97. UINT32 whal_hwEepromWriteByte(HwEeprom_T *pHwEeprom, UINT16 wAddr,UINT8 bVal);
  98. /************************************************************************
  99. * UINT32 whal_hwEepromWriteByteNoUnp(UINT16 wAddr,UINT8 bVal) *
  100. *************************************************************************
  101. * DESCRIPTION: Writes a single byte to EEPROM. The caller must *
  102. * unprotect the EEPROM first. This is done for fast *
  103. * programming of several data bytes. *
  104. * *
  105. * INPUT: wAddr - 16-bits EEPROM addrress *
  106. * bVal - new value *
  107. * *
  108. * OUTPUT: N/A *
  109. * *
  110. * RETURN: OK - successful *
  111. * NOK timeout *
  112. *************************************************************************/
  113. UINT32 whal_hwEepromWriteByteNoUnp(HwEeprom_T *pHwEeprom, UINT16 wAddr,UINT8 bVal);
  114. /************************************************************************
  115. * void whal_hwEepromProtect(void) *
  116. *************************************************************************
  117. * DESCRIPTION: Set EEPROM write protection. *
  118. * Inhibits writing to the EEPROM. *
  119. * *
  120. * INPUT: N/A *
  121. * *
  122. * OUTPUT: N/A *
  123. * *
  124. * RETURN: N/A *
  125. *************************************************************************/
  126. void whal_hwEepromProtect(HwEeprom_T *pHwEeprom);
  127. /************************************************************************
  128. * void whal_hwEepromUnprotect(void) *
  129. *************************************************************************
  130. * DESCRIPTION: Remove EEPROM write protection. *
  131. * Enables writing to the EEPROM. *
  132. * *
  133. * INPUT: N/A *
  134. * *
  135. * OUTPUT: N/A *
  136. * *
  137. * RETURN: N/A *
  138. *************************************************************************/
  139. void whal_hwEepromUnprotect(HwEeprom_T *pHwEeprom);
  140. /*************************
  141. EEPROM data manipulation
  142. *************************/
  143. /************************************************************************
  144. * UINT32 whal_hwEepromGetCalValue(UINT8 *pbVal) *
  145. *************************************************************************
  146. * DESCRIPTION: Reads oscillator cal. value from EEPROM *
  147. * *
  148. * INPUT: N/A *
  149. * *
  150. * OUTPUT: pbVal - pointer to the output parameter *
  151. * *
  152. * RETURN: OK successful *
  153. * NOK timeout *
  154. *************************************************************************/
  155. UINT32 whal_hwEepromGetCalValue(HwEeprom_T *pHwEeprom, UINT8 *pbVal);
  156. /************************************************************************
  157. * UINT32 whal_hwEepromSetCalValue(UINT8 bVal) *
  158. *************************************************************************
  159. * DESCRIPTION: Writes new oscillator cal. value to EEPROM *
  160. * *
  161. * INPUT: bVal - new oscillator cal. value *
  162. * *
  163. * OUTPUT: N/A *
  164. * *
  165. * RETURN: OK successful *
  166. * NOK timeout or invalid value *
  167. *************************************************************************/
  168. UINT32 whal_hwEepromSetCalValue(HwEeprom_T *pHwEeprom, UINT8 bVal);
  169. /************************************************************************
  170. * UINT32 whal_hwEepromGetBiasValue(UINT8 *pbVal) *
  171. *************************************************************************
  172. * DESCRIPTION: Reads bias value from EEPROM *
  173. * *
  174. * INPUT: N/A *
  175. * *
  176. * OUTPUT: pbVal - pointer to the output parameter *
  177. * *
  178. * RETURN: OK successful *
  179. * NOK timeout *
  180. *************************************************************************/
  181. UINT32 whal_hwEepromGetBiasValue(HwEeprom_T *pHwEeprom, UINT8 *pbVal);
  182. /************************************************************************
  183. * UINT32 whal_hwEepromSetBiasValue(UINT8 bVal) *
  184. *************************************************************************
  185. * DESCRIPTION: Writes new bias value to EEPROM *
  186. * *
  187. * INPUT: bVal - new bias value *
  188. * *
  189. * OUTPUT: N/A *
  190. * *
  191. * RETURN: OK successful *
  192. * NOK timeout *
  193. *************************************************************************/
  194. UINT32 whal_hwEepromSetBiasValue(HwEeprom_T *pHwEeprom, UINT8 bVal);
  195. /************************************************************************
  196. * UINT32 whal_hwEepromGetDACValue(UINT8 *pbVal) *
  197. *************************************************************************
  198. * DESCRIPTION: Reads DAC value from EEPROM *
  199. * *
  200. * INPUT: N/A *
  201. * *
  202. * OUTPUT: pbVal - pointer to the output parameter *
  203. * *
  204. * RETURN: OK successful *
  205. * NOK timeout *
  206. *************************************************************************/
  207. UINT32 whal_hwEepromGetDACValue(HwEeprom_T *pHwEeprom, UINT8 *pbVal);
  208. /************************************************************************
  209. * UINT32 whal_hwEepromSetDACValue(UINT8 bVal) *
  210. *************************************************************************
  211. * DESCRIPTION: Writes new DAC value to EEPROM *
  212. * *
  213. * INPUT: bVal - new DAC value *
  214. * *
  215. * OUTPUT: N/A *
  216. * *
  217. * RETURN: OK successful *
  218. * NOK timeout *
  219. *************************************************************************/
  220. UINT32 whal_hwEepromSetDACValue(HwEeprom_T *pHwEeprom, UINT8 bVal);
  221. /************************************************************************
  222. * int whal_hwEepromLoadBaseBandTable(void) *
  223. *************************************************************************
  224. * DESCRIPTION: Loads BB registers table from EEPROM *
  225. * *
  226. * INPUT: N/A *
  227. * *
  228. * OUTPUT: N/A *
  229. * *
  230. * RETURN: N/A *
  231. *************************************************************************/
  232. int whal_hwEepromLoadBaseBandTable(HwEeprom_T *pHwEeprom);
  233. /************************************************************************
  234. * UINT32 whal_hwEepromGetAGCCell(UINT8 bTableOffset, UINT8 *pbVal) *
  235. *************************************************************************
  236. * DESCRIPTION: Reads one cell from ACG table *
  237. * *
  238. * INPUT: bTableOffset - zero-based offset of the cell in AGC *
  239. * table *
  240. * OUTPUT: pbVal - pointer to the output parameter *
  241. * *
  242. * RETURN: OK *
  243. * NOK - EEPROM write error *
  244. * INVALID_PARAMETER1 - invalid parameter 1 *
  245. *************************************************************************/
  246. UINT32 whal_hwEepromGetAGCCell(HwEeprom_T *pHwEeprom, UINT8 bTableOffset, UINT8 *pbVal);
  247. /************************************************************************
  248. * UINT32 whal_hwEepromSetAGCCell(UINT8 bTableOffset, UINT8 bVal) *
  249. *************************************************************************
  250. * DESCRIPTION: Writes one AGC table cell to EEPROM *
  251. * *
  252. * INPUT: bTableOffset - zero-based offset of the cell in AGC *
  253. * table *
  254. * bVal - new cell value *
  255. * OUTPUT: N/A *
  256. * *
  257. * RETURN: OK *
  258. * NOK - EEPROM write error *
  259. * INVALID_PARAMETER1 - invalid parameter 1 *
  260. *************************************************************************/
  261. UINT32 whal_hwEepromSetAGCCell(HwEeprom_T *pHwEeprom, UINT8 bTableOffset, UINT8 bVal);
  262. void whal_hwEeprom_DumpEEPROM(HwEeprom_T *pHwEeprom);
  263. #endif /* USE_SYNC_API */
  264. #endif /* _WHAL_HW_EEPROM_H */