wmt_exp.h 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. /*
  2. * Copyright (C) 2011-2014 MediaTek Inc.
  3. *
  4. * This program is free software: you can redistribute it and/or modify it under the terms of the
  5. * GNU General Public License version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
  8. * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  9. * See the GNU General Public License for more details.
  10. *
  11. * You should have received a copy of the GNU General Public License along with this program.
  12. * If not, see <http://www.gnu.org/licenses/>.
  13. */
  14. /*! \file
  15. \brief Declaration of library functions
  16. Any definitions in this file will be shared among GLUE Layer and internal Driver Stack.
  17. */
  18. #ifndef _WMT_EXP_H_
  19. #define _WMT_EXP_H_
  20. #include <mtk_wcn_cmb_stub.h>
  21. #include "osal.h"
  22. #include "wmt_plat.h"
  23. #include "wmt_stp_exp.h"
  24. /* not to reference to internal wmt */
  25. /* #include "wmt_core.h" */
  26. /*******************************************************************************
  27. * C O M P I L E R F L A G S
  28. ********************************************************************************
  29. */
  30. /*******************************************************************************
  31. * M A C R O S
  32. ********************************************************************************
  33. */
  34. #if 1 /* moved from wmt_lib.h */
  35. #ifndef DFT_TAG
  36. #define DFT_TAG "[WMT-DFT]"
  37. #endif
  38. #define WMT_LOUD_FUNC(fmt, arg...) \
  39. do { \
  40. if (gWmtDbgLvl >= WMT_LOG_LOUD) \
  41. osal_dbg_print(DFT_TAG "[L]%s:" fmt, __func__ , ##arg); \
  42. } while (0)
  43. #define WMT_INFO_FUNC(fmt, arg...) \
  44. do { \
  45. if (gWmtDbgLvl >= WMT_LOG_INFO) \
  46. osal_dbg_print(DFT_TAG "[I]%s:" fmt, __func__ , ##arg); \
  47. } while (0)
  48. #define WMT_WARN_FUNC(fmt, arg...) \
  49. do { \
  50. if (gWmtDbgLvl >= WMT_LOG_WARN) \
  51. osal_warn_print(DFT_TAG "[W]%s:" fmt, __func__ , ##arg); \
  52. } while (0)
  53. #define WMT_ERR_FUNC(fmt, arg...) \
  54. do { \
  55. if (gWmtDbgLvl >= WMT_LOG_ERR) \
  56. osal_err_print(DFT_TAG "[E]%s(%d):" fmt, __func__ , __LINE__, ##arg); \
  57. } while (0)
  58. #define WMT_DBG_FUNC(fmt, arg...) \
  59. do { \
  60. if (gWmtDbgLvl >= WMT_LOG_DBG) \
  61. osal_dbg_print(DFT_TAG "[D]%s:" fmt, __func__ , ##arg); \
  62. } while (0)
  63. #define WMT_TRC_FUNC(f) \
  64. do { \
  65. if (gWmtDbgLvl >= WMT_LOG_DBG) \
  66. osal_dbg_print(DFT_TAG "<%s> <%d>\n", __func__, __LINE__); \
  67. } while (0)
  68. #endif
  69. /*******************************************************************************
  70. * E X T E R N A L R E F E R E N C E S
  71. ********************************************************************************
  72. */
  73. #if 1 /* moved from wmt_lib.h */
  74. extern UINT32 gWmtDbgLvl;
  75. #endif
  76. extern OSAL_BIT_OP_VAR gBtWifiGpsState;
  77. extern OSAL_BIT_OP_VAR gGpsFmState;
  78. extern UINT32 gWifiProbed;
  79. extern MTK_WCN_BOOL g_pwr_off_flag;
  80. extern UINT32 g_IsNeedDoChipReset;
  81. /*******************************************************************************
  82. * C O N S T A N T S
  83. ********************************************************************************
  84. */
  85. #if 1 /* moved from wmt_lib.h */
  86. #define WMT_LOG_LOUD 4
  87. #define WMT_LOG_DBG 3
  88. #define WMT_LOG_INFO 2
  89. #define WMT_LOG_WARN 1
  90. #define WMT_LOG_ERR 0
  91. #endif
  92. #define CFG_CORE_INTERNAL_TXRX 0 /*just do TX/RX in host side */
  93. /*******************************************************************************
  94. * D A T A T Y P E S
  95. ********************************************************************************
  96. */
  97. #ifndef MTK_WCN_WMT_STP_EXP_SYMBOL_ABSTRACT
  98. typedef enum _ENUM_WMTDRV_TYPE_T {
  99. WMTDRV_TYPE_BT = 0,
  100. WMTDRV_TYPE_FM = 1,
  101. WMTDRV_TYPE_GPS = 2,
  102. WMTDRV_TYPE_WIFI = 3,
  103. WMTDRV_TYPE_WMT = 4,
  104. WMTDRV_TYPE_STP = 5,
  105. WMTDRV_TYPE_LPBK = 6,
  106. WMTDRV_TYPE_COREDUMP = 7,
  107. WMTDRV_TYPE_MAX
  108. } ENUM_WMTDRV_TYPE_T, *P_ENUM_WMTDRV_TYPE_T;
  109. /* TODO: [ChangeFeature][GeorgeKuo] Reconsider usage of this type */
  110. /* TODO: how do we extend for new chip and newer revision? */
  111. /* TODO: This way is hard to extend */
  112. typedef enum _ENUM_WMTHWVER_TYPE_T {
  113. WMTHWVER_E1 = 0x0,
  114. WMTHWVER_E2 = 0x1,
  115. WMTHWVER_E3 = 0x2,
  116. WMTHWVER_E4 = 0x3,
  117. WMTHWVER_E5 = 0x4,
  118. WMTHWVER_E6 = 0x5,
  119. WMTHWVER_MAX,
  120. WMTHWVER_INVALID = 0xff
  121. } ENUM_WMTHWVER_TYPE_T, *P_ENUM_WMTHWVER_TYPE_T;
  122. typedef enum _ENUM_WMTDSNS_TYPE_T {
  123. WMTDSNS_FM_DISABLE = 0,
  124. WMTDSNS_FM_ENABLE = 1,
  125. WMTDSNS_FM_GPS_DISABLE = 2,
  126. WMTDSNS_FM_GPS_ENABLE = 3,
  127. WMTDSNS_MAX
  128. } ENUM_WMTDSNS_TYPE_T, *P_ENUM_WMTDSNS_TYPE_T;
  129. typedef enum _ENUM_WMTTHERM_TYPE_T {
  130. WMTTHERM_ZERO = 0,
  131. WMTTHERM_ENABLE = WMTTHERM_ZERO + 1,
  132. WMTTHERM_READ = WMTTHERM_ENABLE + 1,
  133. WMTTHERM_DISABLE = WMTTHERM_READ + 1,
  134. WMTTHERM_MAX
  135. } ENUM_WMTTHERM_TYPE_T, *P_ENUM_WMTTHERM_TYPE_T;
  136. typedef enum _ENUM_WMTMSG_TYPE_T {
  137. WMTMSG_TYPE_POWER_ON = 0,
  138. WMTMSG_TYPE_POWER_OFF = 1,
  139. WMTMSG_TYPE_RESET = 2,
  140. WMTMSG_TYPE_STP_RDY = 3,
  141. WMTMSG_TYPE_HW_FUNC_ON = 4,
  142. WMTMSG_TYPE_MAX
  143. } ENUM_WMTMSG_TYPE_T, *P_ENUM_WMTMSG_TYPE_T;
  144. typedef void (*PF_WMT_CB) (ENUM_WMTDRV_TYPE_T, /* Source driver type */
  145. ENUM_WMTDRV_TYPE_T, /* Destination driver type */
  146. ENUM_WMTMSG_TYPE_T, /* Message type */
  147. VOID *, /* READ-ONLY buffer. Buffer is allocated and freed by WMT_drv. Client
  148. can't touch this buffer after this function return. */
  149. UINT32 /* Buffer size in unit of byte */
  150. );
  151. typedef enum _SDIO_PS_OP {
  152. OWN_SET = 0,
  153. OWN_CLR = 1,
  154. OWN_STATE = 2,
  155. } SDIO_PS_OP;
  156. typedef INT32(*PF_WMT_SDIO_PSOP) (SDIO_PS_OP);
  157. typedef enum _ENUM_WMTCHIN_TYPE_T {
  158. WMTCHIN_CHIPID = 0x0,
  159. WMTCHIN_HWVER = WMTCHIN_CHIPID + 1,
  160. WMTCHIN_MAPPINGHWVER = WMTCHIN_HWVER + 1,
  161. WMTCHIN_FWVER = WMTCHIN_MAPPINGHWVER + 1,
  162. WMTCHIN_MAX,
  163. } ENUM_WMT_CHIPINFO_TYPE_T, *P_ENUM_WMT_CHIPINFO_TYPE_T;
  164. #endif
  165. typedef enum _ENUM_WMTRSTMSG_TYPE_T {
  166. WMTRSTMSG_RESET_START = 0x0,
  167. WMTRSTMSG_RESET_END = 0x1,
  168. WMTRSTMSG_RESET_END_FAIL = 0x2,
  169. WMTRSTMSG_RESET_MAX,
  170. WMTRSTMSG_RESET_INVALID = 0xff
  171. } ENUM_WMTRSTMSG_TYPE_T, *P_ENUM_WMTRSTMSG_TYPE_T;
  172. typedef enum _ENUM_BT_GPS_ONOFF_STATE_T {
  173. WMT_BT_ON = 0,
  174. WMT_GPS_ON = 1,
  175. WMT_WIFI_ON = 2,
  176. WMT_FM_ON = 3,
  177. WMT_BT_GPS_STATE_MAX,
  178. WMT_BT_GPS_STATE_INVALID = 0xff
  179. } ENUM_BT_GPS_ONOFF_STATE_T, *P_ENUM_BT_GPS_ONOFF_STATE_T;
  180. #if 1 /* moved from wmt_core.h */
  181. typedef enum {
  182. WMT_SDIO_SLOT_INVALID = 0,
  183. WMT_SDIO_SLOT_SDIO1 = 1, /* Wi-Fi dedicated SDIO1 */
  184. WMT_SDIO_SLOT_SDIO2 = 2,
  185. WMT_SDIO_SLOT_MAX
  186. } WMT_SDIO_SLOT_NUM;
  187. typedef enum {
  188. WMT_SDIO_FUNC_STP = 0,
  189. WMT_SDIO_FUNC_WIFI = 1,
  190. WMT_SDIO_FUNC_MAX
  191. } WMT_SDIO_FUNC_TYPE;
  192. #endif
  193. typedef INT32(*wmt_wlan_probe_cb) (VOID);
  194. typedef INT32(*wmt_wlan_remove_cb) (VOID);
  195. typedef INT32(*wmt_wlan_bus_cnt_get_cb) (VOID);
  196. typedef INT32(*wmt_wlan_bus_cnt_clr_cb) (VOID);
  197. typedef struct _MTK_WCN_WMT_WLAN_CB_INFO {
  198. wmt_wlan_probe_cb wlan_probe_cb;
  199. wmt_wlan_remove_cb wlan_remove_cb;
  200. wmt_wlan_bus_cnt_get_cb wlan_bus_cnt_get_cb;
  201. wmt_wlan_bus_cnt_clr_cb wlan_bus_cnt_clr_cb;
  202. } MTK_WCN_WMT_WLAN_CB_INFO, *P_MTK_WCN_WMT_WLAN_CB_INFO;
  203. extern INT32 mtk_wcn_wmt_wlan_reg(P_MTK_WCN_WMT_WLAN_CB_INFO pWmtWlanCbInfo);
  204. extern INT32 mtk_wcn_wmt_wlan_unreg(VOID);
  205. /*******************************************************************************
  206. * P U B L I C D A T A
  207. ********************************************************************************
  208. */
  209. extern wmt_wlan_probe_cb mtk_wcn_wlan_probe;
  210. extern wmt_wlan_remove_cb mtk_wcn_wlan_remove;
  211. extern wmt_wlan_bus_cnt_get_cb mtk_wcn_wlan_bus_tx_cnt;
  212. extern wmt_wlan_bus_cnt_clr_cb mtk_wcn_wlan_bus_tx_cnt_clr;
  213. /*******************************************************************************
  214. * P R I V A T E D A T A
  215. ********************************************************************************
  216. */
  217. /*******************************************************************************
  218. * F U N C T I O N D E C L A R A T I O N S
  219. ********************************************************************************
  220. */
  221. /*subsystem function ctrl APIs*/
  222. extern MTK_WCN_BOOL mtk_wcn_wmt_assert(ENUM_WMTDRV_TYPE_T type, UINT32 reason);
  223. #ifndef MTK_WCN_WMT_STP_EXP_SYMBOL_ABSTRACT
  224. #define WMT_EXP_HID_API_EXPORT 0
  225. extern MTK_WCN_BOOL mtk_wcn_wmt_func_off(ENUM_WMTDRV_TYPE_T type);
  226. extern MTK_WCN_BOOL mtk_wcn_wmt_func_on(ENUM_WMTDRV_TYPE_T type);
  227. extern MTK_WCN_BOOL mtk_wcn_wmt_dsns_ctrl(ENUM_WMTDSNS_TYPE_T eType);
  228. extern MTK_WCN_BOOL mtk_wcn_wmt_assert(ENUM_WMTDRV_TYPE_T type, UINT32 reason);
  229. extern INT32 mtk_wcn_wmt_msgcb_reg(ENUM_WMTDRV_TYPE_T eType, PF_WMT_CB pCb);
  230. extern INT32 mtk_wcn_wmt_msgcb_unreg(ENUM_WMTDRV_TYPE_T eType);
  231. extern INT32 mtk_wcn_stp_wmt_sdio_op_reg(PF_WMT_SDIO_PSOP own_cb);
  232. extern INT32 mtk_wcn_stp_wmt_sdio_host_awake(VOID);
  233. /*
  234. return value:
  235. enable/disable thermal sensor function: true(1)/false(0)
  236. read thermal sensor function: thermal value
  237. */
  238. extern INT8 mtk_wcn_wmt_therm_ctrl(ENUM_WMTTHERM_TYPE_T eType);
  239. extern ENUM_WMTHWVER_TYPE_T mtk_wcn_wmt_hwver_get(VOID);
  240. #else
  241. #define WMT_EXP_HID_API_EXPORT 1
  242. #endif
  243. extern INT32 wmt_lib_set_aif(CMB_STUB_AIF_X aif, MTK_WCN_BOOL share); /* set AUDIO interface options */
  244. extern VOID wmt_lib_ps_irq_cb(VOID);
  245. extern VOID mtk_wcn_wmt_func_ctrl_for_plat(UINT32 on, ENUM_WMTDRV_TYPE_T type);
  246. extern INT32 mtk_wcn_wmt_system_state_reset(VOID);
  247. extern MTK_WCN_BOOL mtk_wcn_set_connsys_power_off_flag(MTK_WCN_BOOL value);
  248. #ifdef MTK_WCN_WMT_STP_EXP_SYMBOL_ABSTRACT
  249. extern VOID mtk_wcn_wmt_exp_init(VOID);
  250. extern VOID mtk_wcn_wmt_exp_deinit(VOID);
  251. #endif
  252. extern INT8 mtk_wcn_wmt_co_clock_flag_get(VOID);
  253. /*******************************************************************************
  254. * F U N C T I O N S
  255. ********************************************************************************
  256. */
  257. #endif /* _WMT_EXP_H_ */