stp_exp.h 8.9 KB

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