wm_efuse.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  1. /**
  2. * @file wm_efuse.h
  3. *
  4. * @brief virtual efuse Driver Module
  5. *
  6. * @author dave
  7. *
  8. * Copyright (c) 2014 Winner Microelectronics Co., Ltd.
  9. */
  10. #ifndef WM_EFUSE_H
  11. #define WM_EFUSE_H
  12. #define TLS_EFUSE_STATUS_OK (0)
  13. #define TLS_EFUSE_STATUS_EINVALID (1)
  14. #define TLS_EFUSE_STATUS_EIO (2)
  15. enum {
  16. CMD_WIFI_MAC = 0x01,
  17. CMD_BT_MAC,
  18. CMD_TX_DC,
  19. CMD_RX_DC,
  20. CMD_TX_IQ_GAIN,
  21. CMD_RX_IQ_GAIN,
  22. CMD_TX_IQ_PHASE,
  23. CMD_RX_IQ_PHASE,
  24. CMD_TX_GAIN,
  25. CMD_TX_ADC_CAL,
  26. CMD_ALL,
  27. };
  28. #define FREQERR_ADDR (FT_MAGICNUM_ADDR + sizeof(FT_PARAM_ST))
  29. #define FREQERR_LEN (4)
  30. #define CAL_FLAG_ADDR (FT_MAGICNUM_ADDR + sizeof(FT_PARAM_ST)+4)
  31. #define CAL_FLAG_LEN (4)
  32. //#define TX_GAIN_NEW_ADDR (VCG_ADDR+VCG_LEN)
  33. #define TX_GAIN_LEN (28*3)
  34. typedef struct FT_ADC_CAL_UNIT
  35. {
  36. unsigned short ref_val;
  37. unsigned short real_val;
  38. }FT_ADC_CAL_UINT_ST;
  39. typedef struct FT_ADC_CAL
  40. {
  41. unsigned int valid_cnt;
  42. FT_ADC_CAL_UINT_ST units[8];
  43. }FT_ADC_CAL_ST;
  44. typedef struct FT_TEMP_CAL
  45. {
  46. int ref_val;
  47. int real_val;
  48. }FT_TEMP_CAL_ST;
  49. /**
  50. * @defgroup Driver_APIs Driver APIs
  51. * @brief Driver APIs
  52. */
  53. /**
  54. * @addtogroup Driver_APIs
  55. * @{
  56. */
  57. /**
  58. * @defgroup EFUSE_Driver_APIs EFUSE Driver APIs
  59. * @brief EFUSE driver APIs
  60. */
  61. /**
  62. * @addtogroup EFUSE_Driver_APIs
  63. * @{
  64. */
  65. /**
  66. * @brief This function is used to init ft param.
  67. *
  68. * @param[in] None
  69. *
  70. * @retval TRUE init success
  71. * @retval FALSE init failed
  72. */
  73. int tls_ft_param_init(void);
  74. /**
  75. * @brief This function is used to write ft_param.
  76. *
  77. * @param[in] opnum ft cmd
  78. * @param[in] data data pointer
  79. * @param[in] len len to write data
  80. *
  81. * @retval TLS_EFUSE_STATUS_OK set success
  82. * @retval TLS_EFUSE_STATUS_EIO set failed
  83. */
  84. int tls_ft_param_set(unsigned int opnum, void *data, unsigned int len);
  85. /**
  86. * @brief This function is used to read ft_param.
  87. *
  88. * @param[in] opnum ft cmd
  89. * @param[in] data data pointer
  90. * @param[in] len len to read data
  91. *
  92. * @retval TLS_EFUSE_STATUS_OK get success
  93. * @retval TLS_EFUSE_STATUS_EIO get failed
  94. */
  95. int tls_ft_param_get(unsigned int opnum, void *data, unsigned int rdlen);
  96. /**
  97. * @brief This function is used to get mac addr
  98. *
  99. * @param[in] mac mac addr,6 byte
  100. *
  101. * @retval TLS_EFUSE_STATUS_OK get success
  102. * @retval TLS_EFUSE_STATUS_EIO get failed
  103. */
  104. int tls_get_mac_addr(u8 *mac);
  105. /**
  106. * @brief This function is used to set mac addr
  107. *
  108. * @param[in] mac mac addr,6 byte
  109. *
  110. * @retval TLS_EFUSE_STATUS_OK set success
  111. * @retval TLS_EFUSE_STATUS_EIO set failed
  112. */
  113. int tls_set_mac_addr(u8 *mac);
  114. /**
  115. * @brief This function is used to get bluetooth mac addr
  116. *
  117. * @param[in] mac mac addr,6 byte
  118. *
  119. * @retval TLS_EFUSE_STATUS_OK get success
  120. * @retval TLS_EFUSE_STATUS_EIO get failed
  121. */
  122. int tls_get_bt_mac_addr(u8 *mac);
  123. /**
  124. * @brief This function is used to set bluetooth mac addr
  125. *
  126. * @param[in] mac mac addr,6 byte
  127. *
  128. * @retval TLS_EFUSE_STATUS_OK set success
  129. * @retval TLS_EFUSE_STATUS_EIO set failed
  130. */
  131. int tls_set_bt_mac_addr(u8 *mac);
  132. /**
  133. * @brief This function is used to get tx gain
  134. *
  135. * @param[in] txgain tx gain,12 byte
  136. *
  137. * @retval TLS_EFUSE_STATUS_OK get success
  138. * @retval TLS_EFUSE_STATUS_EIO get failed
  139. */
  140. int tls_get_tx_gain(u8 *txgain);
  141. /**
  142. * @brief This function is used to set tx gain
  143. *
  144. * @param[in] txgain tx gain,12 byte
  145. *
  146. * @retval TLS_EFUSE_STATUS_OK set success
  147. * @retval TLS_EFUSE_STATUS_EIO set failed
  148. */
  149. int tls_set_tx_gain(u8 *txgain);
  150. /**
  151. * @brief This function is used to get tx lod
  152. *
  153. * @param[in] txlo tx lod
  154. *
  155. * @retval TLS_EFUSE_STATUS_OK get success
  156. * @retval TLS_EFUSE_STATUS_EIO get failed
  157. */
  158. int tls_get_tx_lo(u8 *txlo);
  159. /**
  160. * @brief This function is used to set tx lod
  161. *
  162. * @param[in] txlo tx lod
  163. *
  164. * @retval TLS_EFUSE_STATUS_OK set success
  165. * @retval TLS_EFUSE_STATUS_EIO set failed
  166. */
  167. int tls_set_tx_lo(u8 *txlo);
  168. /**
  169. * @brief This function is used to get tx iq gain
  170. *
  171. * @param[in] txGain
  172. *
  173. * @retval TLS_EFUSE_STATUS_OK get success
  174. * @retval TLS_EFUSE_STATUS_EIO get failed
  175. */
  176. int tls_get_tx_iq_gain(u8 *txGain);
  177. /**
  178. * @brief This function is used to set tx iq gain
  179. *
  180. * @param[in] txGain
  181. *
  182. * @retval TLS_EFUSE_STATUS_OK set success
  183. * @retval TLS_EFUSE_STATUS_EIO set failed
  184. */
  185. int tls_set_tx_iq_gain(u8 *txGain);
  186. /**
  187. * @brief This function is used to get rx iq gain
  188. *
  189. * @param[in] rxGain
  190. *
  191. * @retval TLS_EFUSE_STATUS_OK get success
  192. * @retval TLS_EFUSE_STATUS_EIO get failed
  193. */
  194. int tls_get_rx_iq_gain(u8 *rxGain);
  195. /**
  196. * @brief This function is used to get rx iq gain
  197. *
  198. * @param[in] rxGain
  199. *
  200. * @retval TLS_EFUSE_STATUS_OK set success
  201. * @retval TLS_EFUSE_STATUS_EIO set failed
  202. */
  203. int tls_set_rx_iq_gain(u8 *rxGain);
  204. /**
  205. * @brief This function is used to get tx iq phase
  206. *
  207. * @param[in] txPhase
  208. *
  209. * @retval TLS_EFUSE_STATUS_OK get success
  210. * @retval TLS_EFUSE_STATUS_EIO get failed
  211. */
  212. int tls_get_tx_iq_phase(u8 *txPhase);
  213. /**
  214. * @brief This function is used to set tx iq phase
  215. *
  216. * @param[in] txPhase
  217. *
  218. * @retval TLS_EFUSE_STATUS_OK set success
  219. * @retval TLS_EFUSE_STATUS_EIO set failed
  220. */
  221. int tls_set_tx_iq_phase(u8 *txPhase);
  222. /**
  223. * @brief This function is used to get rx iq phase
  224. *
  225. * @param[in] rxPhase
  226. *
  227. * @retval TLS_EFUSE_STATUS_OK get success
  228. * @retval TLS_EFUSE_STATUS_EIO get failed
  229. */
  230. int tls_get_rx_iq_phase(u8 *rxPhase);
  231. /**
  232. * @brief This function is used to set rx iq phase
  233. *
  234. * @param[in] rxPhase
  235. *
  236. * @retval TLS_EFUSE_STATUS_OK set success
  237. * @retval TLS_EFUSE_STATUS_EIO set failed
  238. */
  239. int tls_set_rx_iq_phase(u8 *rxPhase);
  240. /**
  241. * @brief This function is used to set/get freq err
  242. *
  243. * @param[in] freqerr (Unit:Hz),relative to base frequency(chan 1,2,3,4,5......13,14)
  244. * @param[in] flag 1-set 0-get
  245. * @retval TLS_EFUSE_STATUS_OK set/get success
  246. * @retval TLS_EFUSE_STATUS_EIO set/get failed
  247. */
  248. int tls_freq_err_op(u8 *freqerr, u8 flag);
  249. /**
  250. * @brief This function is used to set/get cal finish flag
  251. *
  252. * @param[in] calflag 1- finish calibration, non-1-do not calibration
  253. * @param[in] flag 1-set 0-get
  254. *
  255. * @retval TLS_EFUSE_STATUS_OK set/get success
  256. * @retval TLS_EFUSE_STATUS_EIO set/get failed
  257. */
  258. int tls_rf_cal_finish_op(u8 *calflag, u8 flag);
  259. /**
  260. * @brief This function is used to get adc cal param
  261. *
  262. * @param[out] adc_cal adc cal param
  263. *
  264. * @retval TLS_EFUSE_STATUS_OK get success
  265. * @retval TLS_EFUSE_STATUS_EIO get failed
  266. */
  267. int tls_get_adc_cal_param(FT_ADC_CAL_ST *adc_cal);
  268. /**
  269. * @}
  270. */
  271. /**
  272. * @}
  273. */
  274. #endif /* WM_EFUSE_H */