wm_efuse.h 6.7 KB

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