net: rkwifi: fix using wext protocol anomaly
[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 (C) 1999-2016, 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  *
27  * <<Broadcom-WL-IPTag/Open:>>
28  *
29  * $Id: uamp_api.h 514727 2014-11-12 03:02:48Z $
30  *
31  */
32
33
34 #ifndef UAMP_API_H
35 #define UAMP_API_H
36
37
38 #include "typedefs.h"
39
40
41 /*****************************************************************************
42 **  Constant and Type Definitions
43 ******************************************************************************
44 */
45
46 #define BT_API
47
48 /* Types. */
49 typedef bool    BOOLEAN;
50 typedef uint8   UINT8;
51 typedef uint16  UINT16;
52
53
54 /* UAMP identifiers */
55 #define UAMP_ID_1   1
56 #define UAMP_ID_2   2
57 typedef UINT8 tUAMP_ID;
58
59 /* UAMP event ids (used by UAMP_CBACK) */
60 #define UAMP_EVT_RX_READY           0   /* Data from AMP controller is ready to be read */
61 #define UAMP_EVT_CTLR_REMOVED       1   /* Controller removed */
62 #define UAMP_EVT_CTLR_READY         2   /* Controller added/ready */
63 typedef UINT8 tUAMP_EVT;
64
65
66 /* UAMP Channels */
67 #define UAMP_CH_HCI_CMD            0   /* HCI Command channel */
68 #define UAMP_CH_HCI_EVT            1   /* HCI Event channel */
69 #define UAMP_CH_HCI_DATA           2   /* HCI ACL Data channel */
70 typedef UINT8 tUAMP_CH;
71
72 /* tUAMP_EVT_DATA: union for event-specific data, used by UAMP_CBACK */
73 typedef union {
74     tUAMP_CH channel;       /* UAMP_EVT_RX_READY: channel for which rx occured */
75 } tUAMP_EVT_DATA;
76
77
78 /*****************************************************************************
79 **
80 ** Function:    UAMP_CBACK
81 **
82 ** Description: Callback for events. Register callback using UAMP_Init.
83 **
84 ** Parameters   amp_id:         AMP device identifier that generated the event
85 **              amp_evt:        event id
86 **              p_amp_evt_data: pointer to event-specific data
87 **
88 ******************************************************************************
89 */
90 typedef void (*tUAMP_CBACK)(tUAMP_ID amp_id, tUAMP_EVT amp_evt, tUAMP_EVT_DATA *p_amp_evt_data);
91
92 /*****************************************************************************
93 **  external function declarations
94 ******************************************************************************
95 */
96 #ifdef __cplusplus
97 extern "C"
98 {
99 #endif
100
101 /*****************************************************************************
102 **
103 ** Function:    UAMP_Init
104 **
105 ** Description: Initialize UAMP driver
106 **
107 ** Parameters   p_cback:    Callback function for UAMP event notification
108 **
109 ******************************************************************************
110 */
111 BT_API BOOLEAN UAMP_Init(tUAMP_CBACK p_cback);
112
113
114 /*****************************************************************************
115 **
116 ** Function:    UAMP_Open
117 **
118 ** Description: Open connection to local AMP device.
119 **
120 ** Parameters   app_id: Application specific AMP identifer. This value
121 **                      will be included in AMP messages sent to the
122 **                      BTU task, to identify source of the message
123 **
124 ******************************************************************************
125 */
126 BT_API BOOLEAN UAMP_Open(tUAMP_ID amp_id);
127
128 /*****************************************************************************
129 **
130 ** Function:    UAMP_Close
131 **
132 ** Description: Close connection to local AMP device.
133 **
134 ** Parameters   app_id: Application specific AMP identifer.
135 **
136 ******************************************************************************
137 */
138 BT_API void UAMP_Close(tUAMP_ID amp_id);
139
140
141 /*****************************************************************************
142 **
143 ** Function:    UAMP_Write
144 **
145 ** Description: Send buffer to AMP device. Frees GKI buffer when done.
146 **
147 **
148 ** Parameters:  app_id:     AMP identifer.
149 **              p_buf:      pointer to buffer to write
150 **              num_bytes:  number of bytes to write
151 **              channel:    UAMP_CH_HCI_ACL, or UAMP_CH_HCI_CMD
152 **
153 ** Returns:     number of bytes written
154 **
155 ******************************************************************************
156 */
157 BT_API UINT16 UAMP_Write(tUAMP_ID amp_id, UINT8 *p_buf, UINT16 num_bytes, tUAMP_CH channel);
158
159 /*****************************************************************************
160 **
161 ** Function:    UAMP_Read
162 **
163 ** Description: Read incoming data from AMP. Call after receiving a
164 **              UAMP_EVT_RX_READY callback event.
165 **
166 ** Parameters:  app_id:     AMP identifer.
167 **              p_buf:      pointer to buffer for holding incoming AMP data
168 **              buf_size:   size of p_buf
169 **              channel:    UAMP_CH_HCI_ACL, or UAMP_CH_HCI_EVT
170 **
171 ** Returns:     number of bytes read
172 **
173 ******************************************************************************
174 */
175 BT_API UINT16 UAMP_Read(tUAMP_ID amp_id, UINT8 *p_buf, UINT16 buf_size, tUAMP_CH channel);
176
177 #ifdef __cplusplus
178 }
179 #endif
180
181 #endif /* UAMP_API_H */