wm_efuse.h 6.7 KB

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