Merge branch develop-3.10 into develop-3.10-next
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / rockchip_wlan / rkwifi / bcmdhd / uamp_api.h
1 /*
2  *  Name:       uamp_api.h
3  *
4  *  Description: Universal AMP API
5  *
6  * $Copyright Open Broadcom Corporation$
7  *
8  * $Id: uamp_api.h 294267 2011-11-04 23:41:52Z $
9  *
10  */
11 #ifndef UAMP_API_H
12 #define UAMP_API_H
13
14
15 #include "typedefs.h"
16
17
18 /*****************************************************************************
19 **  Constant and Type Definitions
20 ******************************************************************************
21 */
22
23 #define BT_API
24
25 /* Types. */
26 typedef bool    BOOLEAN;
27 typedef uint8   UINT8;
28 typedef uint16  UINT16;
29
30
31 /* UAMP identifiers */
32 #define UAMP_ID_1   1
33 #define UAMP_ID_2   2
34 typedef UINT8 tUAMP_ID;
35
36 /* UAMP event ids (used by UAMP_CBACK) */
37 #define UAMP_EVT_RX_READY           0   /* Data from AMP controller is ready to be read */
38 #define UAMP_EVT_CTLR_REMOVED       1   /* Controller removed */
39 #define UAMP_EVT_CTLR_READY         2   /* Controller added/ready */
40 typedef UINT8 tUAMP_EVT;
41
42
43 /* UAMP Channels */
44 #define UAMP_CH_HCI_CMD            0   /* HCI Command channel */
45 #define UAMP_CH_HCI_EVT            1   /* HCI Event channel */
46 #define UAMP_CH_HCI_DATA           2   /* HCI ACL Data channel */
47 typedef UINT8 tUAMP_CH;
48
49 /* tUAMP_EVT_DATA: union for event-specific data, used by UAMP_CBACK */
50 typedef union {
51     tUAMP_CH channel;       /* UAMP_EVT_RX_READY: channel for which rx occured */
52 } tUAMP_EVT_DATA;
53
54
55 /*****************************************************************************
56 **
57 ** Function:    UAMP_CBACK
58 **
59 ** Description: Callback for events. Register callback using UAMP_Init.
60 **
61 ** Parameters   amp_id:         AMP device identifier that generated the event
62 **              amp_evt:        event id
63 **              p_amp_evt_data: pointer to event-specific data
64 **
65 ******************************************************************************
66 */
67 typedef void (*tUAMP_CBACK)(tUAMP_ID amp_id, tUAMP_EVT amp_evt, tUAMP_EVT_DATA *p_amp_evt_data);
68
69 /*****************************************************************************
70 **  external function declarations
71 ******************************************************************************
72 */
73 #ifdef __cplusplus
74 extern "C"
75 {
76 #endif
77
78 /*****************************************************************************
79 **
80 ** Function:    UAMP_Init
81 **
82 ** Description: Initialize UAMP driver
83 **
84 ** Parameters   p_cback:    Callback function for UAMP event notification
85 **
86 ******************************************************************************
87 */
88 BT_API BOOLEAN UAMP_Init(tUAMP_CBACK p_cback);
89
90
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 **
107 ** Function:    UAMP_Close
108 **
109 ** Description: Close connection to local AMP device.
110 **
111 ** Parameters   app_id: Application specific AMP identifer.
112 **
113 ******************************************************************************
114 */
115 BT_API void UAMP_Close(tUAMP_ID amp_id);
116
117
118 /*****************************************************************************
119 **
120 ** Function:    UAMP_Write
121 **
122 ** Description: Send buffer to AMP device. Frees GKI buffer when done.
123 **
124 **
125 ** Parameters:  app_id:     AMP identifer.
126 **              p_buf:      pointer to buffer to write
127 **              num_bytes:  number of bytes to write
128 **              channel:    UAMP_CH_HCI_ACL, or UAMP_CH_HCI_CMD
129 **
130 ** Returns:     number of bytes written
131 **
132 ******************************************************************************
133 */
134 BT_API UINT16 UAMP_Write(tUAMP_ID amp_id, UINT8 *p_buf, UINT16 num_bytes, tUAMP_CH channel);
135
136 /*****************************************************************************
137 **
138 ** Function:    UAMP_Read
139 **
140 ** Description: Read incoming data from AMP. Call after receiving a
141 **              UAMP_EVT_RX_READY callback event.
142 **
143 ** Parameters:  app_id:     AMP identifer.
144 **              p_buf:      pointer to buffer for holding incoming AMP data
145 **              buf_size:   size of p_buf
146 **              channel:    UAMP_CH_HCI_ACL, or UAMP_CH_HCI_EVT
147 **
148 ** Returns:     number of bytes read
149 **
150 ******************************************************************************
151 */
152 BT_API UINT16 UAMP_Read(tUAMP_ID amp_id, UINT8 *p_buf, UINT16 buf_size, tUAMP_CH channel);
153
154 #ifdef __cplusplus
155 }
156 #endif
157
158 #endif /* UAMP_API_H */