hci_event.h 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. /**************************************************************************************************
  2. Phyplus Microelectronics Limited confidential and proprietary.
  3. All rights reserved.
  4. IMPORTANT: All rights of this software belong to Phyplus Microelectronics
  5. Limited ("Phyplus"). Your use of this Software is limited to those
  6. specific rights granted under the terms of the business contract, the
  7. confidential agreement, the non-disclosure agreement and any other forms
  8. of agreements as a customer or a partner of Phyplus. You may not use this
  9. Software unless you agree to abide by the terms of these agreements.
  10. You acknowledge that the Software may not be modified, copied,
  11. distributed or disclosed unless embedded on a Phyplus Bluetooth Low Energy
  12. (BLE) integrated circuit, either as a product or is integrated into your
  13. products. Other than for the aforementioned purposes, you may not use,
  14. reproduce, copy, prepare derivative works of, modify, distribute, perform,
  15. display or sell this Software and/or its documentation for any purposes.
  16. YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
  17. PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
  18. INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
  19. NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
  20. PHYPLUS OR ITS SUBSIDIARIES BE LIABLE OR OBLIGATED UNDER CONTRACT,
  21. NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
  22. LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
  23. INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
  24. OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
  25. OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
  26. (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
  27. **************************************************************************************************/
  28. /*******************************************************************************
  29. Filename: hci_c_event.h
  30. Revised: $Date: 2012-05-01 12:13:50 -0700 (Tue, 01 May 2012) $
  31. Revision: $Revision: 30418 $
  32. Description: This file contains the HCI Event types, contants,
  33. external functions etc. for the BLE Controller.
  34. *******************************************************************************/
  35. #ifndef HCI_C_EVENT_H
  36. #define HCI_C_EVENT_H
  37. #ifdef __cplusplus
  38. extern "C"
  39. {
  40. #endif
  41. /*******************************************************************************
  42. * INCLUDES
  43. */
  44. #include "hci_tl.h"
  45. extern uint32 bleEvtMask;
  46. extern uint8 pHciEvtMask[];
  47. /*******************************************************************************
  48. * MACROS
  49. */
  50. /*******************************************************************************
  51. * CONSTANTS
  52. */
  53. // Event Mask Default Values
  54. #define BT_EVT_MASK_BYTE0 0xFF
  55. #define BT_EVT_MASK_BYTE1 0xFF
  56. #define BT_EVT_MASK_BYTE2 0xFF
  57. #define BT_EVT_MASK_BYTE3 0xFF
  58. #define BT_EVT_MASK_BYTE4 0xFF
  59. #define BT_EVT_MASK_BYTE5 0x9F
  60. #define BT_EVT_MASK_BYTE6 0x00
  61. #define BT_EVT_MASK_BYTE7 0x20
  62. //
  63. #define LE_EVT_MASK_DEFAULT 0x00005F
  64. /*******************************************************************************
  65. * TYPEDEFS
  66. */
  67. /*******************************************************************************
  68. * LOCAL VARIABLES
  69. */
  70. /*******************************************************************************
  71. * GLOBAL VARIABLES
  72. */
  73. /*
  74. ** Internal Functions
  75. */
  76. extern void hciInitEventMasks( void );
  77. /*
  78. ** HCI Controller Events
  79. */
  80. /*******************************************************************************
  81. * @fn HCI_DataBufferOverflowEvent
  82. *
  83. * @brief This function sends the Data Buffer Overflow Event to the Host.
  84. *
  85. * input parameters
  86. *
  87. * @param linkType - HCI_LINK_TYPE_SCO_BUFFER_OVERFLOW,
  88. * HCI_LINK_TYPE_ACL_BUFFER_OVERFLOW
  89. *
  90. * output parameters
  91. *
  92. * @param None.
  93. *
  94. * @return None.
  95. */
  96. extern void HCI_DataBufferOverflowEvent( uint8 linkType );
  97. /*******************************************************************************
  98. * @fn HCI_NumOfCompletedPacketsEvent
  99. *
  100. * @brief This function sends the Number of Completed Packets Event to
  101. * the Host.
  102. *
  103. * Note: Currently, the number of handles is always one.
  104. *
  105. * input parameters
  106. *
  107. * @param numHandles - Number of handles.
  108. * @param handlers - Array of connection handles.
  109. * @param numCompletedPkts - Array of number of completed packets for
  110. * each handle.
  111. *
  112. * output parameters
  113. *
  114. * @param None.
  115. *
  116. * @return None.
  117. */
  118. extern void HCI_NumOfCompletedPacketsEvent( uint8 numHandles,
  119. uint16 *handlers,
  120. uint16 *numCompletedPackets );
  121. /*******************************************************************************
  122. * @fn HCI_CommandCompleteEvent
  123. *
  124. * @brief This function sends a Command Complete Event to the Host.
  125. *
  126. * input parameters
  127. *
  128. * @param opcode - The opcode of the command that generated this event.
  129. * @param numParam - The number of parameters in the event.
  130. * @param param - The event parameters associated with the command.
  131. *
  132. * output parameters
  133. *
  134. * @param None.
  135. *
  136. * @return None.
  137. */
  138. extern void HCI_CommandCompleteEvent( uint16 opcode,
  139. uint8 numParam,
  140. uint8 *param );
  141. /*******************************************************************************
  142. * @fn HCI_VendorSpecifcCommandCompleteEvent
  143. *
  144. * @brief This function sends a Vendor Specific Command Complete Event to
  145. * the Host.
  146. *
  147. * input parameters
  148. *
  149. * @param opcode - The opcode of the command that generated this event.
  150. * @param numParam - The number of parameters in the event.
  151. * @param param - The event parameters associated with the command.
  152. *
  153. * output parameters
  154. *
  155. * @param None.
  156. *
  157. * @return None.
  158. */
  159. extern void HCI_VendorSpecifcCommandCompleteEvent( uint16 opcode,
  160. uint8 len,
  161. uint8 *param );
  162. /*******************************************************************************
  163. * @fn HCI_CommandStatusEvent
  164. *
  165. * @brief This function sends a Command Status Event to the Host.
  166. *
  167. * input parameters
  168. *
  169. * @param status - The resulting status of the comamnd.
  170. * @param opcode - The opcode of the command that generated this event.
  171. *
  172. * output parameters
  173. *
  174. * @param None.
  175. *
  176. * @return None.
  177. */
  178. extern void HCI_CommandStatusEvent( uint8 status,
  179. uint16 opcode );
  180. /*******************************************************************************
  181. * @fn HCI_HardwareErrorEvent
  182. *
  183. * @brief This function sends a Hardware Error Event to the Host.
  184. *
  185. * input parameters
  186. *
  187. * @param hwErrorCode - The hardware error code.
  188. *
  189. * output parameters
  190. *
  191. * @param None.
  192. *
  193. * @return None.
  194. */
  195. extern void HCI_HardwareErrorEvent( uint8 hwErrorCode );
  196. /*******************************************************************************
  197. * @fn HCI_SendCommandStatusEvent
  198. *
  199. * @brief This generic function sends a Command Status event to the Host.
  200. * It is provided as a direct call so the Host can use it directly.
  201. *
  202. * input parameters
  203. *
  204. * @param eventCode - The event code.
  205. * @param status - The resulting status of the comamnd.
  206. * @param opcode - The opcode of the command that generated this event.
  207. *
  208. * output parameters
  209. *
  210. * @param None.
  211. *
  212. * @return None.
  213. */
  214. extern void HCI_SendCommandStatusEvent ( uint8 eventCode,
  215. uint16 status,
  216. uint16 opcode );
  217. /*******************************************************************************
  218. * @fn HCI_SendCommandCompleteEvent
  219. *
  220. * @brief This generic function sends a Command Complete or a Vendor
  221. * Specific Command Complete Event to the Host.
  222. *
  223. * input parameters
  224. *
  225. * @param eventCode - The event code.
  226. * @param opcode - The opcode of the command that generated this event.
  227. * @param numParam - The number of parameters in the event.
  228. * @param param - The event parameters associated with the command.
  229. *
  230. * output parameters
  231. *
  232. * @param None.
  233. *
  234. * @return None.
  235. */
  236. extern void HCI_SendCommandCompleteEvent ( uint8 eventCode,
  237. uint16 opcode,
  238. uint8 numParam,
  239. uint8 *param );
  240. /*******************************************************************************
  241. * @fn HCI_SendControllerToHostEvent
  242. *
  243. * @brief This generic function sends a Controller to Host Event.
  244. *
  245. * input parameters
  246. *
  247. * @param eventCode - Bluetooth event code.
  248. * @param dataLen - Length of dataField.
  249. * @param pData - Pointer to data.
  250. *
  251. * output parameters
  252. *
  253. * @param None.
  254. *
  255. * @return None.
  256. */
  257. extern void HCI_SendControllerToHostEvent( uint8 eventCode,
  258. uint8 dataLen,
  259. uint8 *pData );
  260. #ifdef __cplusplus
  261. }
  262. #endif
  263. #endif /* HCI_C_EVENT_H */