stp_exp.h 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. /*! \file
  2. \brief Declaration of library functions
  3. Any definitions in this file will be shared among GLUE Layer and internal Driver Stack.
  4. */
  5. #ifndef _STP_EXP_H_
  6. #define _STP_EXP_H_
  7. #include "wmt_stp_exp.h"
  8. #include "osal.h"
  9. /*******************************************************************************
  10. * C O M P I L E R F L A G S
  11. ********************************************************************************
  12. */
  13. /*******************************************************************************
  14. * M A C R O S
  15. ********************************************************************************
  16. */
  17. #ifndef MTK_WCN_WMT_STP_EXP_SYMBOL_ABSTRACT
  18. #define BT_TASK_INDX (0)
  19. #define FM_TASK_INDX (1)
  20. #define GPS_TASK_INDX (2)
  21. #define WIFI_TASK_INDX (3)
  22. #define WMT_TASK_INDX (4)
  23. #define STP_TASK_INDX (5)
  24. #define INFO_TASK_INDX (6)
  25. #define ANT_TASK_INDX (7)
  26. #if CFG_WMT_LTE_COEX_HANDLING
  27. #define COEX_TASK_INDX (8)
  28. #define MTKSTP_MAX_TASK_NUM (9)
  29. #else
  30. #define MTKSTP_MAX_TASK_NUM (8)
  31. #endif
  32. #define MTKSTP_BUFFER_SIZE (16384) /* Size of RX Queue */
  33. #define STP_EXP_HID_API_EXPORT 0
  34. #else
  35. #define STP_EXP_HID_API_EXPORT 1
  36. #endif
  37. /*******************************************************************************
  38. * E X T E R N A L R E F E R E N C E S
  39. ********************************************************************************
  40. */
  41. /*******************************************************************************
  42. * C O N S T A N T S
  43. ********************************************************************************
  44. */
  45. /*******************************************************************************
  46. * D A T A T Y P E S
  47. ********************************************************************************
  48. */
  49. #ifndef MTK_WCN_WMT_STP_EXP_SYMBOL_ABSTRACT
  50. typedef VOID (*MTK_WCN_STP_EVENT_CB) (VOID);
  51. typedef INT32 (*MTK_WCN_STP_IF_TX) (const PUINT8 data, const UINT32 size, PUINT32 written_size);
  52. /* export for HIF driver */
  53. typedef VOID (*MTK_WCN_STP_IF_RX) (const PUINT8 data, INT32 size);
  54. typedef enum {
  55. STP_UART_IF_TX = 0,
  56. STP_SDIO_IF_TX,
  57. STP_MAX_IF_TX
  58. } ENUM_STP_TX_IF_TYPE;
  59. /*******************************************************************************
  60. * P U B L I C D A T A
  61. ********************************************************************************
  62. */
  63. /*******************************************************************************
  64. * P R I V A T E D A T A
  65. ********************************************************************************
  66. */
  67. /*******************************************************************************
  68. * F U N C T I O N D E C L A R A T I O N S
  69. ********************************************************************************
  70. */
  71. /*****************************************************************************
  72. * FUNCTION
  73. * mtk_wcn_stp_receive_data
  74. * DESCRIPTION
  75. * receive data from serial protocol engine
  76. * PARAMETERS
  77. * buffer [IN] data buffer
  78. * length [IN] data buffer length
  79. * RETURNS
  80. * INT32 >= 0: size of data received; < 0: error
  81. *****************************************************************************/
  82. extern INT32 mtk_wcn_stp_receive_data(PUINT8 buffer, UINT32 length, UINT8 type);
  83. /*****************************************************************************
  84. * FUNCTION
  85. * mtk_wcn_stp_send_data
  86. * DESCRIPTION
  87. * subfunction send data through STP
  88. * PARAMETERS
  89. * buffer [IN] data buffer
  90. * length [IN] data buffer length
  91. * type [IN] subfunction type
  92. * RETURNS
  93. * INT32 >= 0: length transmitted; < 0: error
  94. *****************************************************************************/
  95. extern INT32 mtk_wcn_stp_send_data(const PUINT8 buffer, const UINT32 length, const UINT8 type);
  96. /*****************************************************************************
  97. * FUNCTION
  98. * mtk_wcn_stp_is_rxqueue_empty
  99. * DESCRIPTION
  100. * Is certain rx queue empty?
  101. * PARAMETERS
  102. * type [IN] subfunction type
  103. * RETURNS
  104. * INT32 0: queue is NOT empyt; !0: queue is empty
  105. *****************************************************************************/
  106. extern MTK_WCN_BOOL mtk_wcn_stp_is_rxqueue_empty(UINT8 type);
  107. /*****************************************************************************
  108. * FUNCTION
  109. * mtk_wcn_stp_is_enable
  110. * DESCRIPTION
  111. * Is STP ready?
  112. * PARAMETERS
  113. * none.
  114. * RETURNS
  115. * MTK_WCN_BOOL TRUE:ready, FALSE:not ready
  116. *****************************************************************************/
  117. extern MTK_WCN_BOOL mtk_wcn_stp_is_ready(VOID);
  118. /*****************************************************************************
  119. * FUNCTION
  120. * mtk_wcn_stp_parser_data
  121. * DESCRIPTION
  122. * push data to serial transport protocol parser engine
  123. * PARAMETERS
  124. * buffer [IN] data buffer
  125. * length [IN] data buffer length
  126. * RETURNS
  127. * void
  128. *****************************************************************************/
  129. extern INT32 mtk_wcn_stp_parser_data(PUINT8 buffer, UINT32 length);
  130. /*****************************************************************************
  131. * FUNCTION
  132. * set_bluetooth_rx_interface
  133. * DESCRIPTION
  134. * Set bluetooth rx interface
  135. * PARAMETERS
  136. * rx interface type
  137. * RETURNS
  138. * void
  139. *****************************************************************************/
  140. extern void mtk_wcn_stp_set_bluez(MTK_WCN_BOOL sdio_flag);
  141. /*****************************************************************************
  142. * FUNCTION
  143. * mtk_wcn_stp_register_tx_event_cb
  144. * DESCRIPTION
  145. * regiter Tx event callback function
  146. * PARAMETERS
  147. * func
  148. * RETURNS
  149. * INT32: 0:successful , -1: fail
  150. *****************************************************************************/
  151. extern INT32 mtk_wcn_stp_register_tx_event_cb(INT32 type, MTK_WCN_STP_EVENT_CB func);
  152. /*****************************************************************************
  153. * FUNCTION
  154. * mtk_wcn_stp_register_event_cb
  155. * DESCRIPTION
  156. * regiter Rx event callback function
  157. * PARAMETERS
  158. * func
  159. * RETURNS
  160. * INT32: 0:successful , -1: fail
  161. *****************************************************************************/
  162. extern INT32 mtk_wcn_stp_register_event_cb(INT32 type, MTK_WCN_STP_EVENT_CB func);
  163. /*****************************************************************************
  164. * FUNCTION
  165. * mtk_wcn_stp_register_if_tx
  166. * DESCRIPTION
  167. * regiter Tx event callback function
  168. * PARAMETERS
  169. * stp_if: SDIO or UART, fnnc: Call back function
  170. * RETURNS
  171. * INT32: 0:successful , -1: fail
  172. *****************************************************************************/
  173. extern INT32 mtk_wcn_stp_register_if_tx(ENUM_STP_TX_IF_TYPE stp_if, MTK_WCN_STP_IF_TX func);
  174. /*****************************************************************************
  175. * FUNCTION
  176. * mtk_wcn_stp_register_if_rx
  177. * DESCRIPTION
  178. * regiter Rx event callback function
  179. * PARAMETERS
  180. * stp_if: SDIO or UART, fnnc: Call back function
  181. * RETURNS
  182. * INT32: 0:successful , -1: fail
  183. *****************************************************************************/
  184. extern INT32 mtk_wcn_stp_register_if_rx(MTK_WCN_STP_IF_RX func);
  185. /*****************************************************************************
  186. * FUNCTION
  187. * mtk_wcn_stp_coredump_start_get
  188. * DESCRIPTION
  189. * get f/w assert flag in STP context
  190. * PARAMETERS
  191. * VOID
  192. * RETURNS
  193. * INT32 0= f/w assert flag is not set, others=f/w assert flag is set
  194. *****************************************************************************/
  195. extern INT32 mtk_wcn_stp_coredump_start_get(VOID);
  196. /*******************************************************************************
  197. * F U N C T I O N S
  198. ********************************************************************************
  199. */
  200. #else
  201. extern INT32 _mtk_wcn_stp_receive_data(PUINT8 buffer, UINT32 length, UINT8 type);
  202. extern INT32 _mtk_wcn_stp_send_data_raw(const PUINT8 buffer, const UINT32 length, const UINT8 type);
  203. extern INT32 _mtk_wcn_stp_send_data(const PUINT8 buffer, const UINT32 length, const UINT8 type);
  204. extern MTK_WCN_BOOL _mtk_wcn_stp_is_rxqueue_empty(UINT8 type);
  205. extern MTK_WCN_BOOL _mtk_wcn_stp_is_ready(VOID);
  206. extern INT32 _mtk_wcn_stp_parser_data(PUINT8 buffer, UINT32 length);
  207. extern void _mtk_wcn_stp_set_bluez(MTK_WCN_BOOL sdio_flag);
  208. extern INT32 _mtk_wcn_stp_register_tx_event_cb(INT32 type, MTK_WCN_STP_EVENT_CB func);
  209. extern INT32 _mtk_wcn_stp_register_event_cb(INT32 type, MTK_WCN_STP_EVENT_CB func);
  210. extern INT32 _mtk_wcn_stp_register_if_tx(ENUM_STP_TX_IF_TYPE stp_if, MTK_WCN_STP_IF_TX func);
  211. extern INT32 _mtk_wcn_stp_register_if_rx(MTK_WCN_STP_IF_RX func);
  212. extern INT32 _mtk_wcn_stp_coredump_start_get(VOID);
  213. #endif
  214. /*****************************************************************************
  215. * FUNCTION
  216. * mtk_wcn_stp_read_fw_cpupcr
  217. * DESCRIPTION
  218. * read firmware cpupcr for debug.
  219. * PARAMETERS
  220. * VOID
  221. * RETURNS
  222. * VOID.
  223. * *****************************************************************************/
  224. extern VOID mtk_wcn_stp_read_fw_cpupcr(VOID);
  225. #endif /* _WMT_EXP_H_ */