Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(679)

Side by Side Diff: chromeos/drivers/ath6kl/include/hci_transport_api.h

Issue 646055: Atheros AR600x driver + build glue (Closed)
Patch Set: Created 10 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chromeos/drivers/ath6kl/include/gpio_api.h ('k') | chromeos/drivers/ath6kl/include/hif.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 //------------------------------------------------------------------------------
2 // <copyright file="HCI_TRANSPORT_api.h" company="Atheros">
3 // Copyright (c) 2009 Atheros Corporation. All rights reserved.
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License version 2 as
7 // published by the Free Software Foundation;
8 //
9 // Software distributed under the License is distributed on an "AS
10 // IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
11 // implied. See the License for the specific language governing
12 // rights and limitations under the License.
13 //
14 //
15 //------------------------------------------------------------------------------
16 //==============================================================================
17 // Author(s): ="Atheros"
18 //==============================================================================
19 #ifndef _HCI_TRANSPORT_API_H_
20 #define _HCI_TRANSPORT_API_H_
21
22 /* Bluetooth HCI packets are stored in HTC packet containers */
23 #include "htc_packet.h"
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif /* __cplusplus */
28
29 typedef void *HCI_TRANSPORT_HANDLE;
30
31 typedef HTC_ENDPOINT_ID HCI_TRANSPORT_PACKET_TYPE;
32
33 /* we map each HCI packet class to a static Endpoint ID */
34 #define HCI_COMMAND_TYPE ENDPOINT_1
35 #define HCI_EVENT_TYPE ENDPOINT_2
36 #define HCI_ACL_TYPE ENDPOINT_3
37 #define HCI_PACKET_INVALID ENDPOINT_MAX
38
39 #define HCI_GET_PACKET_TYPE(pP) (pP)->Endpoint
40 #define HCI_SET_PACKET_TYPE(pP,s) (pP)->Endpoint = (s)
41
42 /* callback when an HCI packet was completely sent */
43 typedef void (*HCI_TRANSPORT_SEND_PKT_COMPLETE)(void *, HTC_PACKET *);
44 /* callback when an HCI packet is received */
45 typedef void (*HCI_TRANSPORT_RECV_PKT)(void *, HTC_PACKET *);
46 /* Optional receive buffer re-fill callback,
47 * On some OSes (like Linux) packets are allocated from a global pool and indica ted up
48 * to the network stack. The driver never gets the packets back from the OS. F or these OSes
49 * a refill callback can be used to allocate and re-queue buffers into HTC.
50 * A refill callback is used for the reception of ACL and EVENT packets. The ca ller must
51 * set the watermark trigger point to cause a refill.
52 */
53 typedef void (*HCI_TRANSPORT_RECV_REFILL)(void *, HCI_TRANSPORT_PACKET_TYPE Ty pe, int BuffersAvailable);
54 /* Optional receive packet refill
55 * On some systems packet buffers are an extremely limited resource. Rather tha n
56 * queue largest-possible-sized buffers to the HCI bridge, some systems would ra ther
57 * allocate a specific size as the packet is received. The trade off is
58 * slightly more processing (callback invoked for each RX packet)
59 * for the benefit of committing fewer buffer resources into the bridge.
60 *
61 * The callback is provided the length of the pending packet to fetch. This incl udes the
62 * full transport header, HCI header, plus the length of payload. The callback can return a pointer to
63 * the allocated HTC packet for immediate use.
64 *
65 * NOTE*** This callback is mutually exclusive with the the refill callback abov e.
66 *
67 * */
68 typedef HTC_PACKET *(*HCI_TRANSPORT_RECV_ALLOC)(void *, HCI_TRANSPORT_PACKET_TYP E Type, int Length);
69
70 typedef enum _HCI_SEND_FULL_ACTION {
71 HCI_SEND_FULL_KEEP = 0, /* packet that overflowed should be kept in the que ue */
72 HCI_SEND_FULL_DROP = 1, /* packet that overflowed should be dropped */
73 } HCI_SEND_FULL_ACTION;
74
75 /* callback when an HCI send queue exceeds the caller's MaxSendQueueDepth thresh old,
76 * the callback must return the send full action to take (either DROP or KEEP) * /
77 typedef HCI_SEND_FULL_ACTION (*HCI_TRANSPORT_SEND_FULL)(void *, HTC_PACKET *);
78
79 typedef struct {
80 int HeadRoom; /* number of bytes in front of HCI packet for header s pace */
81 int TailRoom; /* number of bytes at the end of the HCI packet for ta il space */
82 int IOBlockPad; /* I/O block padding required (always a power of 2) */
83 } HCI_TRANSPORT_PROPERTIES;
84
85 typedef struct _HCI_TRANSPORT_CONFIG_INFO {
86 int ACLRecvBufferWaterMark; /* low watermark to trigger recv refill */
87 int EventRecvBufferWaterMark; /* low watermark to trigger recv refill */
88 int MaxSendQueueDepth; /* max number of packets in the single send queue */
89 void *pContext; /* context for all callbacks */
90 void (*TransportFailure)(void *pContext, A_STATUS Status); /* transport failure callback */
91 A_STATUS (*TransportReady)(HCI_TRANSPORT_HANDLE, HCI_TRANSPORT_PROPERTIES *, void *pContext); /* transport is ready */
92 void (*TransportRemoved)(void *pContext); /* transport was removed */
93 /* packet processing callbacks */
94 HCI_TRANSPORT_SEND_PKT_COMPLETE pHCISendComplete;
95 HCI_TRANSPORT_RECV_PKT pHCIPktRecv;
96 HCI_TRANSPORT_RECV_REFILL pHCIPktRecvRefill;
97 HCI_TRANSPORT_RECV_ALLOC pHCIPktRecvAlloc;
98 HCI_TRANSPORT_SEND_FULL pHCISendFull;
99 } HCI_TRANSPORT_CONFIG_INFO;
100
101 /* ------ Function Prototypes ------ */
102 /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
103 @desc: Attach to the HCI transport module
104 @function name: HCI_TransportAttach
105 @input: HTCHandle - HTC handle (see HTC apis)
106 pInfo - initialization information
107 @output:
108 @return: HCI_TRANSPORT_HANDLE on success, NULL on failure
109 @notes: The HTC module provides HCI transport services.
110 @example:
111 @see also: HCI_TransportDetach
112 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++* /
113 HCI_TRANSPORT_HANDLE HCI_TransportAttach(void *HTCHandle, HCI_TRANSPORT_CONFIG_I NFO *pInfo);
114
115 /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
116 @desc: Detach from the HCI transport module
117 @function name: HCI_TransportDetach
118 @input: HciTrans - HCI transport handle
119 pInfo - initialization information
120 @output:
121 @return:
122 @notes:
123 @example:
124 @see also:
125 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++* /
126 void HCI_TransportDetach(HCI_TRANSPORT_HANDLE HciTrans);
127
128 /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
129 @desc: Add receive packets to the HCI transport
130 @function name: HCI_TransportAddReceivePkts
131 @input: HciTrans - HCI transport handle
132 pQueue - a queue holding one or more packets
133 @output:
134 @return: A_OK on success
135 @notes: user must supply HTC packets for capturing incomming HCI packets. Th e caller
136 must initialize each HTC packet using the SET_HTC_PACKET_INFO_RX_REFI LL()
137 macro. Each packet in the queue must be of the same type and length
138 @example:
139 @see also:
140 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++* /
141 A_STATUS HCI_TransportAddReceivePkts(HCI_TRANSPORT_HANDLE HciTrans, HTC_PACKE T_QUEUE *pQueue);
142
143 /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
144 @desc: Send an HCI packet packet
145 @function name: HCI_TransportSendPkt
146 @input: HciTrans - HCI transport handle
147 pPacket - packet to send
148 Synchronous - send the packet synchronously (blocking)
149 @output:
150 @return: A_OK
151 @notes: Caller must initialize packet using SET_HTC_PACKET_INFO_TX() and
152 HCI_SET_PACKET_TYPE() macros to prepare the packet.
153 If Synchronous is set to FALSE the call is fully asynchronous. On er ror or completion,
154 the registered send complete callback will be called.
155 If Synchronous is set to TRUE, the call will block until the packet i s sent, if the
156 interface cannot send the packet within a 2 second timeout, the funct ion will return
157 the failure code : A_EBUSY.
158
159 Synchronous Mode should only be used at start-up to initialize the HC I device using
160 custom HCI commands. It should NOT be mixed with Asynchronous operat ions. Mixed synchronous
161 and asynchronous operation behavior is undefined.
162
163 @example:
164 @see also:
165 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++* /
166 A_STATUS HCI_TransportSendPkt(HCI_TRANSPORT_HANDLE HciTrans, HTC_PACKET *pPac ket, A_BOOL Synchronous);
167
168
169 /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
170 @desc: Stop HCI transport
171 @function name: HCI_TransportStop
172 @input: HciTrans - hci transport handle
173 @output:
174 @return:
175 @notes: HCI transport communication will be halted. All receive and pending T X packets will
176 be flushed.
177 @example:
178 @see also:
179 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++* /
180 void HCI_TransportStop(HCI_TRANSPORT_HANDLE HciTrans);
181
182 /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
183 @desc: Start the HCI transport
184 @function name: HCI_TransportStart
185 @input: HciTrans - hci transport handle
186 @output:
187 @return: A_OK on success
188 @notes: HCI transport communication will begin, the caller can expect the arri val
189 of HCI recv packets as soon as this call returns.
190 @example:
191 @see also:
192 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++* /
193 A_STATUS HCI_TransportStart(HCI_TRANSPORT_HANDLE HciTrans);
194
195 /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
196 @desc: Enable or Disable Asynchronous Recv
197 @function name: HCI_TransportEnableDisableAsyncRecv
198 @input: HciTrans - hci transport handle
199 Enable - enable or disable asynchronous recv
200 @output:
201 @return: A_OK on success
202 @notes: This API must be called when HCI recv is handled synchronously
203 @example:
204 @see also:
205 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++* /
206 A_STATUS HCI_TransportEnableDisableAsyncRecv(HCI_TRANSPORT_HANDLE HciTrans, A _BOOL Enable);
207
208 /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
209 @desc: Receive an event packet from the HCI transport synchronously using poll ing
210 @function name: HCI_TransportRecvHCIEventSync
211 @input: HciTrans - hci transport handle
212 pPacket - HTC packet to hold the recv data
213 MaxPollMS - maximum polling duration in Milliseconds;
214 @output:
215 @return: A_OK on success
216 @notes: This API should be used only during HCI device initialization, the cal ler must call
217 HCI_TransportEnableDisableAsyncRecv with Enable=FALSE prior to using t his API.
218 This API will only capture HCI Event packets.
219 @example:
220 @see also: HCI_TransportEnableDisableAsyncRecv
221 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++* /
222 A_STATUS HCI_TransportRecvHCIEventSync(HCI_TRANSPORT_HANDLE HciTrans,
223 HTC_PACKET *pPacket,
224 int MaxPollMS);
225
226 #ifdef __cplusplus
227 }
228 #endif
229
230 #endif /* _HCI_TRANSPORT_API_H_ */
OLDNEW
« no previous file with comments | « chromeos/drivers/ath6kl/include/gpio_api.h ('k') | chromeos/drivers/ath6kl/include/hif.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698