uamp_api.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. /*
  2. * Name: uamp_api.h
  3. *
  4. * Description: Universal AMP API
  5. *
  6. * Copyright (C) 1999-2014, Broadcom Corporation
  7. *
  8. * Unless you and Broadcom execute a separate written software license
  9. * agreement governing use of this software, this software is licensed to you
  10. * under the terms of the GNU General Public License version 2 (the "GPL"),
  11. * available at http://www.broadcom.com/licenses/GPLv2.php, with the
  12. * following added to such license:
  13. *
  14. * As a special exception, the copyright holders of this software give you
  15. * permission to link this software with independent modules, and to copy and
  16. * distribute the resulting executable under terms of your choice, provided that
  17. * you also meet, for each linked independent module, the terms and conditions of
  18. * the license of that module. An independent module is a module which is not
  19. * derived from this software. The special exception does not apply to any
  20. * modifications of the software.
  21. *
  22. * Notwithstanding the above, under no circumstances may you combine this
  23. * software in any way with any other Broadcom software provided under a license
  24. * other than the GPL, without Broadcom's express prior written consent.
  25. *
  26. * $Id: uamp_api.h 294267 2011-11-04 23:41:52Z $
  27. *
  28. */
  29. #ifndef UAMP_API_H
  30. #define UAMP_API_H
  31. #include "typedefs.h"
  32. /*****************************************************************************
  33. ** Constant and Type Definitions
  34. ******************************************************************************
  35. */
  36. #define BT_API
  37. /* Types. */
  38. typedef bool BOOLEAN;
  39. typedef uint8 UINT8;
  40. typedef uint16 UINT16;
  41. /* UAMP identifiers */
  42. #define UAMP_ID_1 1
  43. #define UAMP_ID_2 2
  44. typedef UINT8 tUAMP_ID;
  45. /* UAMP event ids (used by UAMP_CBACK) */
  46. #define UAMP_EVT_RX_READY 0 /* Data from AMP controller is ready to be read */
  47. #define UAMP_EVT_CTLR_REMOVED 1 /* Controller removed */
  48. #define UAMP_EVT_CTLR_READY 2 /* Controller added/ready */
  49. typedef UINT8 tUAMP_EVT;
  50. /* UAMP Channels */
  51. #define UAMP_CH_HCI_CMD 0 /* HCI Command channel */
  52. #define UAMP_CH_HCI_EVT 1 /* HCI Event channel */
  53. #define UAMP_CH_HCI_DATA 2 /* HCI ACL Data channel */
  54. typedef UINT8 tUAMP_CH;
  55. /* tUAMP_EVT_DATA: union for event-specific data, used by UAMP_CBACK */
  56. typedef union {
  57. tUAMP_CH channel; /* UAMP_EVT_RX_READY: channel for which rx occured */
  58. } tUAMP_EVT_DATA;
  59. /*****************************************************************************
  60. **
  61. ** Function: UAMP_CBACK
  62. **
  63. ** Description: Callback for events. Register callback using UAMP_Init.
  64. **
  65. ** Parameters amp_id: AMP device identifier that generated the event
  66. ** amp_evt: event id
  67. ** p_amp_evt_data: pointer to event-specific data
  68. **
  69. ******************************************************************************
  70. */
  71. typedef void (*tUAMP_CBACK)(tUAMP_ID amp_id, tUAMP_EVT amp_evt, tUAMP_EVT_DATA *p_amp_evt_data);
  72. /*****************************************************************************
  73. ** external function declarations
  74. ******************************************************************************
  75. */
  76. #ifdef __cplusplus
  77. extern "C"
  78. {
  79. #endif
  80. /*****************************************************************************
  81. **
  82. ** Function: UAMP_Init
  83. **
  84. ** Description: Initialize UAMP driver
  85. **
  86. ** Parameters p_cback: Callback function for UAMP event notification
  87. **
  88. ******************************************************************************
  89. */
  90. BT_API BOOLEAN UAMP_Init(tUAMP_CBACK p_cback);
  91. /*****************************************************************************
  92. **
  93. ** Function: UAMP_Open
  94. **
  95. ** Description: Open connection to local AMP device.
  96. **
  97. ** Parameters app_id: Application specific AMP identifer. This value
  98. ** will be included in AMP messages sent to the
  99. ** BTU task, to identify source of the message
  100. **
  101. ******************************************************************************
  102. */
  103. BT_API BOOLEAN UAMP_Open(tUAMP_ID amp_id);
  104. /*****************************************************************************
  105. **
  106. ** Function: UAMP_Close
  107. **
  108. ** Description: Close connection to local AMP device.
  109. **
  110. ** Parameters app_id: Application specific AMP identifer.
  111. **
  112. ******************************************************************************
  113. */
  114. BT_API void UAMP_Close(tUAMP_ID amp_id);
  115. /*****************************************************************************
  116. **
  117. ** Function: UAMP_Write
  118. **
  119. ** Description: Send buffer to AMP device. Frees GKI buffer when done.
  120. **
  121. **
  122. ** Parameters: app_id: AMP identifer.
  123. ** p_buf: pointer to buffer to write
  124. ** num_bytes: number of bytes to write
  125. ** channel: UAMP_CH_HCI_ACL, or UAMP_CH_HCI_CMD
  126. **
  127. ** Returns: number of bytes written
  128. **
  129. ******************************************************************************
  130. */
  131. BT_API UINT16 UAMP_Write(tUAMP_ID amp_id, UINT8 *p_buf, UINT16 num_bytes, tUAMP_CH channel);
  132. /*****************************************************************************
  133. **
  134. ** Function: UAMP_Read
  135. **
  136. ** Description: Read incoming data from AMP. Call after receiving a
  137. ** UAMP_EVT_RX_READY callback event.
  138. **
  139. ** Parameters: app_id: AMP identifer.
  140. ** p_buf: pointer to buffer for holding incoming AMP data
  141. ** buf_size: size of p_buf
  142. ** channel: UAMP_CH_HCI_ACL, or UAMP_CH_HCI_EVT
  143. **
  144. ** Returns: number of bytes read
  145. **
  146. ******************************************************************************
  147. */
  148. BT_API UINT16 UAMP_Read(tUAMP_ID amp_id, UINT8 *p_buf, UINT16 buf_size, tUAMP_CH channel);
  149. #ifdef __cplusplus
  150. }
  151. #endif
  152. #endif /* UAMP_API_H */