blob: 689df0c30b1a2126b2da2e41677cc1af90379994 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Kiet Lam842dad02014-02-18 18:44:02 -08002 * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080020 */
Kiet Lam842dad02014-02-18 18:44:02 -080021
22/*
23 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
Jeff Johnson295189b2012-06-20 16:38:30 -070028#ifndef WLAN_QCT_WLANBAP_INTERNAL_H
29#define WLAN_QCT_WLANBAP_INTERNAL_H
30
31/*===========================================================================
32
33 W L A N B T - A M P P A L L A Y E R
34 I N T E R N A L A P I
35
36
37DESCRIPTION
38 This file contains the internal API exposed by the wlan BT-AMP PAL layer
39 module.
40
41
42 Copyright (c) 2008 QUALCOMM Incorporated. All Rights Reserved.
43 Qualcomm Confidential and Proprietary
44===========================================================================*/
45
46
47/*===========================================================================
48
49 EDIT HISTORY FOR FILE
50
51
52 This section contains comments describing changes made to the module.
53 Notice that changes are listed in reverse chronological order.
54
55
56 $Header: /home/labuser/ampBlueZ_2/CORE/BAP/src/bapInternal.h,v 1.3 2010/07/12 20:40:18 labuser Exp labuser $ $DateTime: $ $Author: labuser $
57
58
59when who what, where, why
60-------- --- ----------------------------------------------------------
6109/15/08 jez Created module.
62
63===========================================================================*/
64
65
66
67/*===========================================================================
68
69 INCLUDE FILES FOR MODULE
70
71===========================================================================*/
72
73/*----------------------------------------------------------------------------
74 * Include Files
75 * -------------------------------------------------------------------------*/
76#include "vos_api.h"
77#include "vos_packet.h"
78
79// Pick up the CSR API definitions
80#include "csrApi.h"
81
82/* BT-AMP PAL API structure types - FramesC generated */
83#include "btampHCI.h"
84#include "bapApi.h"
85
86// Pick up the BTAMP FSM definitions
87#include "fsmDefs.h"
88//#include "btampFsm.h"
89#include "btampFsm_ext.h"
90#include "bapRsn8021xFsm.h"
91#include "bapRsnErrors.h"
92
93#include "csrApi.h"
94#include "sirApi.h"
95#include "wniApi.h"
96#include "palApi.h"
97/*----------------------------------------------------------------------------
98 * Preprocessor Definitions and Constants
99 * -------------------------------------------------------------------------*/
100 #ifdef __cplusplus
101 extern "C" {
102 #endif
103
104
105/*----------------------------------------------------------------------------
106 * Defines
107 * -------------------------------------------------------------------------*/
108// Temporary so that I can compile
109//#define VOS_MODULE_ID_BAP 9
110// Temporary
111//#define BAP_DEBUG
112
113// Used to enable or disable security on the BT-AMP link
114#define WLANBAP_SECURITY_ENABLED_STATE VOS_TRUE
115
116// How do I get BAP context from voss context?
117#define VOS_GET_BAP_CB(ctx) vos_get_context( VOS_MODULE_ID_BAP, ctx)
118// How do I get halHandle from voss context?
119#define VOS_GET_HAL_CB(ctx) vos_get_context( VOS_MODULE_ID_SME, ctx)
120
121// Default timeout values (in BR/EDR baseband slots)
122// Physical Link Connection Accept Timer interval (0x1FA0 * 0.625 = 5.06 sec)
123/* chose to double it to 3FFF as we saw conn timeout in lab*/
124//#define WLANBAP_CONNECTION_ACCEPT_TIMEOUT 0xFFFF
125// Set default to 0x1F40. Which is ~5 secs.
126#define WLANBAP_CONNECTION_ACCEPT_TIMEOUT 0x1F40
127
128/* Link Supervision Timer interval (0x7D00 * 0.625 = 20 sec) */
129#ifdef FEATURE_WLAN_BTAMP_UT
130#define WLANBAP_LINK_SUPERVISION_TIMEOUT 0x7D00
131#else
132#define WLANBAP_LINK_SUPERVISION_TIMEOUT 0x3E80 // 10 seconds
133#endif
134#define WLANBAP_LINK_SUPERVISION_RETRIES 2
135
136/* Logical Link Accept Timer interval (0x1FA0 * 0.625 = 5.06 sec)*/
137#define WLANBAP_LOGICAL_LINK_ACCEPT_TIMEOUT 0x1F40
138
139/* BR/EDR baseband 1 slot time period */
140#define WLANBAP_BREDR_BASEBAND_SLOT_TIME 1 // 0.625
141
142/* Maximum allowed range for connection accept timeout interval */
143#define WLANBAP_CON_ACCEPT_TIMEOUT_MAX_RANGE 0xB540
144
145/* Minimum allowed range for connection accept timeout interval */
146#define WLANBAP_CON_ACCEPT_TIMEOUT_MIN_RANGE 0x01
147
148/* Best Effort Flush timer interval*/
149#define WLANBAP_BE_FLUSH_TIMEOUT 10
150
151/* Length of the LLC header*/
152#define WLANBAP_LLC_HEADER_LEN 8
153
154/*Size of the protocol type field inside the LLC/SNAP header*/
155#define WLANBAP_LLC_PROTO_TYPE_SIZE 2
156
157/*Size of the OUI type field inside the LLC/SNAP header*/
158#define WLANBAP_LLC_OUI_SIZE 3
159
160/*Offset of the OUI field inside the LLC/SNAP header*/
161#define WLANBAP_LLC_OUI_OFFSET 3
162
163/*Offset of the protocol type field inside the LLC/SNAP header*/
Madan Mohan Koyyalamudia53c4dc2012-11-13 10:35:42 -0800164#define WLANBAP_LLC_PROTO_TYPE_OFFSET (WLANBAP_LLC_OUI_OFFSET + WLANBAP_LLC_OUI_SIZE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700165
166#define WLANBAP_MAX_NUM_TRIPLETS 5
167
168#define WLANBAP_MAX_SIZE_TRIPLETS 3
169/*----------------------------------------------------------------------------
170 * Typedefs
171 * -------------------------------------------------------------------------*/
172/*----------------------------------------------------------------------------
173 * Type Declarations - For internal BAP context information
174 * -------------------------------------------------------------------------*/
175typedef struct sBtampHCI_Buffer_Size {
176// v_U8_t present;
177 /* D9r14 says Max80211PALPDUSize 1492 */
178 v_U16_t HC_ACL_Data_Packet_Length;
179 v_U8_t HC_SCO_Packet_Length;
180 v_U16_t HC_Total_Num_ACL_Packets;
181 v_U16_t HC_Total_Num_SCO_Packets;
182} tBtampHCI_Buffer_Size;
183
184typedef struct sBtampHCI_Data_Block_Size {
185// v_U8_t present;
186 v_U8_t status;
187 /* D9r14 says Max80211PALPDUSize 1492 */
188 v_U16_t HC_Max_ACL_Data_Packet_Length;
189 v_U16_t HC_Data_Block_Length;
190 v_U16_t HC_Total_Num_Data_Blocks;
191} tBtampHCI_Data_Block_Size;
192
193typedef struct sBtampHCI_Version_Info {
194// v_U8_t present;
195 v_U8_t HC_HCI_Version;
196 v_U16_t HC_HCI_Revision;
197 v_U8_t HC_PAL_Version; /* for 802.11 AMP: 0x01 */
198 v_U16_t HC_PAL_Sub_Version; /* for 802.11 AMP: Vendor specific */
199 v_U16_t HC_Manufac_Name; /* See BT assigned numbers */
200} tBtampHCI_Version_Info;
201
202typedef struct sBtampHCI_Supported_Cmds {
203// v_U8_t present;
204 v_U8_t HC_Support_Cmds[64]; /* a bitmask of cmds */
205} tBtampHCI_Supported_Cmds;
206
207typedef struct sBtampHCI_AMP_Info {
208// v_U8_t present;
Kiet Lam842dad02014-02-18 18:44:02 -0800209 v_U8_t HC_AMP_Status;
Jeff Johnson295189b2012-06-20 16:38:30 -0700210 v_U32_t HC_Total_BW; /* combined uplink and downlink */
211 v_U32_t HC_Max_Guaranteed_BW; /* upper bound */
212 v_U32_t HC_Min_Latency; /* AMP HCI latency + DIFS + CWMin */
213 v_U32_t HC_Max_PDU_Size; /* Equal to Max80211PALPDUSize */
214 v_U8_t HC_Controller_Type; /* 0x01 for 802.11 BT-AMP PAL */
215 v_U16_t HC_PAL_Capabilities; /* Bit 0: 0 = No Guarantee; 1 = Guarantee */
216 v_U16_t HC_AMP_Assoc_Length; /* Length of AMP Assoc Info */
217 /* Equal to Max80211AMPASSOCLen (672) */
218 v_U16_t HC_Max_Flush_Timeout; /* Maximum time Tx attempted. 0 is inf retry */
219 v_U16_t HC_BE_Flush_Timeout; /* Maximum time BE Tx attempted. 0 is inf retry */
220} tBtampHCI_AMP_Info;
221
222typedef struct sBtampHCI_AMP_Assoc {
223// v_U8_t present;
224 v_U8_t HC_cnct_country[3]; /* Connected channel */
225 v_U8_t HC_cnct_num_triplets;
226 v_U8_t HC_cnct_triplets[WLANBAP_MAX_NUM_TRIPLETS][WLANBAP_MAX_SIZE_TRIPLETS];
227 v_U8_t HC_mac_addr[6];
228 v_U32_t HC_pal_capabilities;
229 v_U8_t HC_pref_country[3]; /* Preferred channels */
230 v_U8_t HC_pref_num_triplets;
231 v_U8_t HC_pref_triplets[WLANBAP_MAX_NUM_TRIPLETS][WLANBAP_MAX_SIZE_TRIPLETS];
232 v_U8_t HC_pal_version;
233 v_U16_t HC_pal_CompanyID;
234 v_U16_t HC_pal_subversion;
235} tBtampHCI_AMP_Assoc, *tpBtampHCI_AMP_Assoc ;
236
237typedef struct sBtampTLVHCI_Location_Data_Info {
238 v_U8_t loc_domain_aware;
239 v_U8_t loc_domain[3];
240 v_U8_t loc_options;
241} tBtampTLVHCI_Location_Data_Info;
242
243/*----------------------------------------------------------------------------
244 * Type Declarations - For BAP logical link context information
245 * -------------------------------------------------------------------------*/
246typedef struct sBtampLogLinkCtx {
247 v_U8_t present; /* In use? */
248
249 v_U8_t log_link_index; /* small integer (<16) value assigned by us */
250 v_U16_t log_link_handle; /* 8 bits of phy_link_handle and our index */
251
252 /* The flow spec (From section 5.6 of Generic AMP spec) */
253 tBtampTLVFlow_Spec btampFlowSpec;
254
255 /* The Access category */
256 WLANTL_ACEnumType btampAC;
257
258 /* The TID */
259 v_U8_t ucTID;
260
261 /* UP of the packet being sent */
262 v_U8_t ucUP;
263
264 /*Number of packets completed since the last time num pkt complete event
265 was issued*/
266 v_U32_t uTxPktCompleted;
267
268} tBtampLogLinkCtx, *tpBtampLogLinkCtx ;
269
270/*----------------------------------------------------------------------------
271 * Type Declarations - QOS related
272 * -------------------------------------------------------------------------*/
273/* BT-AMP QOS config */
274typedef struct sBtampQosCfg {
275 v_U8_t bWmmIsEnabled;
276} tBtampQosCfg;
277
278/*----------------------------------------------------------------------------
279 * Opaque BAP context Type Declaration
280 * -------------------------------------------------------------------------*/
281// We were only using this syntax, when this was truly opaque.
282// (I.E., it was defined in a different file.)
283//typedef struct sBtampContext tBtampContext, *ptBtampContext;
284
285
286// Validity check the logical link value
287#define BTAMP_VALID_LOG_LINK(a) ( a > 0 && a < WLANBAP_MAX_LOG_LINKS ? 1 : 0)
288
289/* Instance data definition of state machine */
290// Moved here from the BTAMP FSM definitions in btampFsm.h
291typedef struct{
292 BTAMPFSM_ENTRY_FLAG_T disconnectedEntry;
293 BTAMPFSM_STATEVAR_T stateVar;
294 BTAMPFSM_INST_ID_T inst_id;
295} BTAMPFSM_INSTANCEDATA_T;
296
297/* BT-AMP device role */
298typedef enum{
299 BT_RESPONDER,
300 BT_INITIATOR
301} tWLAN_BAPRole;
302
303/* BT-AMP device role */
304typedef enum{
305 WLAN_BAPLogLinkClosed,
306 WLAN_BAPLogLinkOpen,
307 WLAN_BAPLogLinkInProgress,
308} tWLAN_BAPLogLinkState;
309
310typedef struct{
311 v_U8_t phyLinkHandle;
312 v_U8_t txFlowSpec[18];
313 v_U8_t rxFlowSpec[18];
314} tBtampLogLinkReqInfo;
315
316/*----------------------------------------------------------------------------
317 * BAP context Data Type Declaration
318 * -------------------------------------------------------------------------*/
319#undef BTAMP_MULTIPLE_PHY_LINKS
320typedef struct sBtampContext {
321#ifndef BTAMP_MULTIPLE_PHY_LINKS
322
323 // Include the enclosing VOSS context here
324 v_PVOID_t pvosGCtx;
325
326 // include the phy link state machine structure here
327 tWLAN_BAPbapPhysLinkMachine bapPhysLinkMachine;
328
329 // BAP device role
330 tWLAN_BAPRole BAPDeviceRole;
331 // Include the SME(CSR) sessionId here
332 v_U8_t sessionId;
333
334 // Actual storage for AP and self (STA) SSID
335 //tSirMacSSid SSID[2];
336 tCsrSSIDInfo SSIDList[2];
337 // Actual storage for AP bssid
338 tCsrBssid bssid;
339 // Include the SME(CSR) context here
340 tCsrRoamProfile csrRoamProfile;
341 tANI_U32 csrRoamId;
342
343 // QOS config
344 tBtampQosCfg bapQosCfg;
345
346 /*Flag for signaling if security is enabled*/
347 v_U8_t ucSecEnabled;
348
349 // associated boolean flag
350 v_U8_t mAssociated;
351 // associated status
352 v_U8_t mAssociatedStatus;
353 tCsrBssid assocBssid;
354 tBssSystemRole systemRole;
355
356 // own SSID
357 v_U8_t ownSsid[32];
358 v_U32_t ownSsidLen;
359
360 // incoming Assoc SSID
361 v_U8_t assocSsid[32];
362 v_U32_t assocSsidLen;
363
364 // gNeedPhysLinkCompEvent
365 v_U8_t gNeedPhysLinkCompEvent;
366 // gPhysLinkStatus
367 v_U8_t gPhysLinkStatus;
368 // gDiscRequested
369 v_U8_t gDiscRequested;
370 // gDiscReason
371 v_U8_t gDiscReason;
372
373 // Include the BSL per-application context here
374 v_PVOID_t pAppHdl; // Per-app BSL context
375 // Include the BSL per-association contexts here.
376 // (Right now, there is only one)
377 v_PVOID_t pHddHdl;
378 /* 8 bits of phy_link_handle identifies this association */
379 v_U8_t phy_link_handle;
380 // Short Range Mode setting for this physical link
381 v_U8_t phy_link_srm;
382
383 // Include the key material for this physical link
384 v_U8_t key_type;
385 v_U8_t key_length;
386 v_U8_t key_material[32];
387
388 /* Physical link quality status
389 After the physical link is up, SME indicates the link quality through
390 callback. This value is returned to upper layer on request.
391 */
392 v_U8_t link_quality;
393
394 /* Connection Accept timer*/
395 vos_timer_t bapConnectionAcceptTimer;
396 /* Link Supervision timer*/
397 vos_timer_t bapLinkSupervisionTimer;
398 /* Logical Link Accept timer*/
399 vos_timer_t bapLogicalLinkAcceptTimer;
400 /* Best Effort Flush timer*/
401 vos_timer_t bapBEFlushTimer;
402
403 /* TX Packet Monitoring timer*/
404 vos_timer_t bapTxPktMonitorTimer;
405
406 /* Connection Accept Timer interval (in BR/EDR baseband slots)
407 * Interval length = N * 0.625 msec (1 BR/EDR baseband slot)
408 */
409 v_U16_t bapConnectionAcceptTimerInterval;
410
411 /* Link Supervision Timer interval (in BR/EDR baseband slots) */
412 v_U16_t bapLinkSupervisionTimerInterval;
413
414 /* Logical Link Accept Timer interval (in BR/EDR baseband slots) */
415 v_U16_t bapLogicalLinkAcceptTimerInterval;
416
417 /* Best Effort Flush timer interval*/
418 v_U32_t bapBEFlushTimerInterval;
419
420 // Include the current channel here
421 v_U32_t channel;
422
423 // Include the associations STA Id
424 v_U8_t ucSTAId;
425
426 // Include the associations MAC addresses
427 v_U8_t self_mac_addr[6];
428 v_U8_t peer_mac_addr[6];
429
430 // The array of logical links
431 /* the last small integer (<16) value assigned by us */
432 v_U8_t current_log_link_index; /* assigned mod 16 */
433 v_U8_t total_log_link_index; /* should never be >16 */
434 /* The actual array */
435 tBtampLogLinkCtx btampLogLinkCtx[WLANBAP_MAX_LOG_LINKS];
436
437 // Include the HDD BAP Shim Layer callbacks for Fetch, TxComp, and RxPkt
438 WLANBAP_STAFetchPktCBType pfnBtampFetchPktCB;
439 WLANBAP_STARxCBType pfnBtamp_STARxCB;
440 WLANBAP_TxCompCBType pfnBtampTxCompCB;
441
442 /* Implements the callback for ALL asynchronous events. */
443 tpWLAN_BAPEventCB pBapHCIEventCB;
444
445 // Save Page2 of the event mask.
446 v_U8_t event_mask_page_2[8];
447
448 // Include the Local Assoc structure.
449 // (This gets filled during initialization. It is used, for example, to
450 // obtain the local MAC address for forming the 802.3 frame.)
451 // <<Why don't I just pull out the individ fields I need? Like MAC addr.>>
452 tBtampHCI_AMP_Assoc btamp_AMP_Assoc;
453
454 // Remote AMP Assoc
455 tBtampHCI_AMP_Assoc btamp_Remote_AMP_Assoc;
456
457 tBtampTLVHCI_Location_Data_Info btamp_Location_Data_Info;
458
459 union
460 {
461 tAuthRsnFsm authFsm;
462 tSuppRsnFsm suppFsm;
463 }uFsm;
464 //LinkSupervision packet
465 tANI_BOOLEAN lsReqPktPending;
466 tANI_BOOLEAN dataPktPending;
467 tANI_U8 retries;
468 vos_pkt_t *pPacket;
469 vos_pkt_t *lsReqPacket;
470 vos_pkt_t *lsRepPacket;
471 v_U16_t lsPktln;
472 v_U16_t lsPending;
473 WLANTL_MetaInfoType metaInfo;
474 tANI_BOOLEAN isBapSessionOpen;
475
476 tWLAN_BAPLogLinkState btamp_logical_link_state;
477
478 tBtampLogLinkReqInfo btamp_logical_link_req_info;
479
480 tANI_BOOLEAN btamp_async_logical_link_create;
481
482 tANI_BOOLEAN btamp_logical_link_cancel_pending;
483
484 tANI_BOOLEAN btamp_session_on;
485
486#else // defined(BTAMP_MULTIPLE_PHY_LINKS)
487
488 // Include the enclosing VOSS context here
489 v_PVOID_t pvosGCtx;
490
491 // include the state machine structure here
492
493 // Include the BSL per-application context here
494 v_PVOID_t pAppHdl; // Per-app BSL context
495 // Include the BSL per-association contexts here.
496 // (Right now, there is only one)
497 v_PVOID_t pHddHdl;
498 /* 8 bits of phy_link_handle identifies this association */
499 v_U8_t phy_link_handle;
500 // Short Range Mode setting for this physical link
501 v_U8_t phy_link_srm;
502
503 // Include the associations STA Id
504 v_U8_t ucSTAId;
505
506 // Include the associations MAC addresses
507 v_U8_t self_mac_addr[6];
508 v_U8_t peer_mac_addr[6];
509
510 // The array of logical links
511 /* the last small integer (<16) value assigned by us */
512 v_U8_t current_log_link_index; /* assigned mod 16 */
513 v_U8_t total_log_link_index; /* should never be >16 */
514 /* The actual array */
515 tBtampLogLinkCtx btampLogLinkCtx[WLANBAP_MAX_LOG_LINKS];
516
517 // Include the HDD BAP Shim Layer callbacks for Fetch, TxComp, and RxPkt
518 WLANBAP_STAFetchPktCBType pfnBtampFetchPktCB;
519 WLANBAP_STARxCBType pfnBtamp_STARxCB;
520 WLANBAP_TxCompCBType pfnBtampTxCompCB;
521
522 /* Implements the callback for ALL asynchronous events. */
523 tpWLAN_BAPEventCB pBapHCIEventCB;
524
525 // Include the Local Assoc structure.
526 // (This gets filled during initialization. It is used, for example, to
527 // obtain the local MAC address for forming the 802.3 frame.)
528 // <<Why don't I just pull out the individ fields I need? Like MAC addr.>>
529 tBtampHCI_AMP_Assoc btamp_AMP_Assoc;
530 //LinkSupervision packet
531 tANI_BOOLEAN lsReqPktPending;
532 tANI_U8 retries;
533 vos_pkt_t *pPacket;
534 vos_pkt_t *lsReqPacket;
535 vos_pkt_t *lsRepPacket;
536 v_U16_t lsPktln;
537 WLANTL_MetaInfoType* metaInfo;
538 tANI_BOOLEAN isBapSessionOpen;
539 //End of LinkSupervision packet
540#endif //BTAMP_MULTIPLE_PHY_LINKS
541 WLANBAP_ConfigType config;
542 /*multiple data structures getting accessed/written from both north & south
543 bound entities. To avoid multiple access, need a lock*/
544 vos_lock_t bapLock;
545 // Either Block mode or Pkt mode
546 v_U8_t ucDataTrafficMode;
547}*ptBtampContext;
548//tBtampContext, *ptBtampContext;
549
550/*----------------------------------------------------------------------------
551 * Type Declarations
552 * -------------------------------------------------------------------------*/
553
554typedef struct sBtampLsPktData {
555 v_U32_t BufLen;
556 v_U8_t pBuf[1]; // ptr to Data Buffer
557}tBtampLsPktData, *ptBtampLsPktData;
558
559typedef struct sBtampLsPkt {
560 v_U8_t SrcMac[6];
561 v_U8_t DstMac[6];
562 tBtampLsPktData Data;
563} tBtampLsPkt, *ptBtampLsPkt;
564
565/*----------------------------------------------------------------------------
566 * BAP per-session Context Data Type Declaration
567 * -------------------------------------------------------------------------*/
568// For now, it is just the same thing as the per application context.
569typedef struct sBtampContext tBtampSessCtx;
570
571/*----------------------------------------------------------------------------
572 * BAP state machine event definition
573 * -------------------------------------------------------------------------*/
574/* The event structure */
575typedef struct sWLAN_BAPEvent {
576 v_U32_t event; /* State machine input event message */
577 v_PVOID_t params; /* A VOID pointer type for all possible inputs */
578 v_U32_t u1; /* introduced to handle csrRoamCompleteCallback roamStatus */
579 v_U32_t u2; /* introduced to handle csrRoamCompleteCallback roamResult */
580} tWLAN_BAPEvent, *ptWLAN_BAPEvent;
581
582// Pick up the BTAMP FSM definitions
583#include "btampFsm.h"
584
585
586/*----------------------------------------------------------------------------
587 * External declarations for global context
588 * -------------------------------------------------------------------------*/
589// The main per-Physical Link (per WLAN association) context.
590//extern tBtampContext btampCtx;
591extern ptBtampContext gpBtampCtx;
592
593// Include the Local AMP Info structure.
594extern tBtampHCI_AMP_Info btampHCI_AMP_Info;
595// Include the Local Data Block Size info structure.
596extern tBtampHCI_Data_Block_Size btampHCI_Data_Block_Size;
597// Include the Local Version info structure.
598extern tBtampHCI_Version_Info btampHCI_Version_Info;
599// Include the Local Supported Cmds info structure.
600extern tBtampHCI_Supported_Cmds btampHCI_Supported_Cmds;
601
602
603/*----------------------------------------------------------------------------
604 * Function prototypes
605 * -------------------------------------------------------------------------*/
606
607/* I don't think any of this is needed */
608
609/* TL data path callbacks passed into WLANTL_RegisterSTAClient */
610
611/*----------------------------------------------------------------------------
612
613 FUNCTION WLANBAP_STAFetchPktCB
614
615 DESCRIPTION
616 The fetch packet callback registered with TL.
617
618 It is called by the TL when the scheduling algorithms allows for
619 transmission of another packet to the module.
620 It will be called in the context of the BAL fetch transmit packet
621 function, initiated by the bus lower layer.
622
623
624 PARAMETERS
625
626 IN
627 pvosGCtx: pointer to the global vos context; a handle
628 to TL's or HDD's control block can be extracted
629 from its context
630
631 IN/OUT
632 pucSTAId: the Id of the station for which TL is requesting a
633 packet, in case HDD does not maintain per station
634 queues it can give the next packet in its queue
635 and put in the right value for the
636 pucAC: access category requested by TL, if HDD does not have
637 packets on this AC it can choose to service another AC
638 queue in the order of priority
639
640 OUT
641 vosDataBuff: pointer to the VOSS data buffer that was transmitted
642 tlMetaInfo: meta info related to the data frame
643
644
645
646 RETURN VALUE
647 The result code associated with performing the operation
648
649----------------------------------------------------------------------------*/
650VOS_STATUS
651WLANBAP_STAFetchPktCB
652(
653 v_PVOID_t pvosGCtx,
654 v_U8_t* pucSTAId,
655 v_U8_t ucAC,
656 vos_pkt_t** vosDataBuff,
657 WLANTL_MetaInfoType* tlMetaInfo
658);
659
660/*----------------------------------------------------------------------------
661
662 FUNCTION WLANBAP_STARxCB
663
664 DESCRIPTION
665 The receive callback registered with TL.
666
667 TL will call this to notify the client when a packet was received
668 for a registered STA.
669
670 PARAMETERS
671
672 IN
673 pvosGCtx: pointer to the global vos context; a handle to
674 TL's or HDD's control block can be extracted from
675 its context
676 vosDataBuff: pointer to the VOSS data buffer that was received
677 (it may be a linked list)
678 ucSTAId: station id
679
680 RETURN VALUE
681 The result code associated with performing the operation
682
683----------------------------------------------------------------------------*/
684VOS_STATUS
685WLANBAP_STARxCB
686(
687 v_PVOID_t pvosGCtx,
688 vos_pkt_t* vosDataBuff,
689 v_U8_t ucSTAId,
690 WLANTL_RxMetaInfoType* pRxMetaInfo
691);
692
693/*----------------------------------------------------------------------------
694
695 FUNCTION WLANBAP_TxCompCB
696
697 DESCRIPTION
698 The tx complete callback registered with TL.
699
700 TL will call this to notify the client when a transmission for a
701 packet has ended.
702
703 PARAMETERS
704
705 IN
706 pvosGCtx: pointer to the global vos context; a handle to
707 TL/HAL/PE/BAP/HDD control block can be extracted from
708 its context
709 vosDataBuff: pointer to the VOSS data buffer that was transmitted
710 wTxSTAtus: status of the transmission
711
712
713 RETURN VALUE
714 The result code associated with performing the operation
715
716----------------------------------------------------------------------------*/
717VOS_STATUS
718WLANBAP_TxCompCB
719(
720 v_PVOID_t pvosGCtx,
721 vos_pkt_t* vosDataBuff,
722 VOS_STATUS wTxSTAtus
723);
724
725/* Callbacks Registered with TL by WLANTL_RegisterBAPClient */
726
727/* RSN Callback */
728
729/*----------------------------------------------------------------------------
730
731 DESCRIPTION
732 The receive callback registered with TL for BAP.
733
734 The registered reception callback is being triggered by TL whenever a
735 frame was received and it was filtered as a non-data BT AMP packet.
736
737 PARAMETERS
738
739 IN
740 pvosGCtx: pointer to the global vos context; a handle to TL's
741 or SME's control block can be extracted from its context
742 vosDataBuff: pointer to the vOSS buffer containing the received packet;
743 no chaining will be done on this path
744
745 RETURN VALUE
746 The result code associated with performing the operation
747
748----------------------------------------------------------------------------*/
749WLANTL_BAPRxCBType WLANBAP_TLRsnRxCallback
750(
751 v_PVOID_t pvosGCtx,
752 vos_pkt_t* vosDataBuff
753);
754
755/* Flush complete Callback */
756
757/*----------------------------------------------------------------------------
758
759 DESCRIPTION
760 Callback registered with TL for BAP, this is required inorder for
761 TL to inform BAP, that the flush operation requested has been completed.
762
763 The registered reception callback is being triggered by TL whenever a
764 frame SIR_TL_HAL_FLUSH_AC_RSP is received by TL from HAL.
765
766 PARAMETERS
767
768 IN
769 pvosGCtx: pointer to the global vos context; a handle to TL's
770 or SME's control block can be extracted from its context
771 ucStaId: station identifier for the requested value
772 ucTid: identifier of the tspec
773 status: status of the Flush operation
774
775 RETURN VALUE
776 The result code associated with performing the operation
777
778----------------------------------------------------------------------------*/
779VOS_STATUS WLANBAP_TLFlushCompCallback
780(
781 v_PVOID_t pvosGCtx,
782 v_U8_t ucStaId,
783 v_U8_t ucTID,
784 v_U8_t status
785);
786
787/*----------------------------------------------------------------------------
788 * CSR Roam (Connection Status) callback
789 * -------------------------------------------------------------------------*/
790/*----------------------------------------------------------------------------
791
792 FUNCTION WLANBAP_RoamCallback()
793
794 DESCRIPTION
795 Callback for Roam (connection status) Events
796
797 DEPENDENCIES
798 NA.
799
800 PARAMETERS
801
802 IN
803 pContext: is the pContext passed in with the roam request
804 pParam: is a pointer to a tCsrRoamInfo, see definition of eRoamCmdStatus and
805 eRoamCmdResult: for detail valid members. It may be NULL
806 roamId: is to identify the callback related roam request. 0 means unsolicited
807 roamStatus: is a flag indicating the status of the callback
808 roamResult: is the result
809
810 RETURN VALUE
811 The result code associated with performing the operation
812
813 eHAL_STATUS_SUCCESS: Success
814
815 SIDE EFFECTS
816
817----------------------------------------------------------------------------*/
818eHalStatus
819WLANBAP_RoamCallback
820(
821 void *pContext,
822 tCsrRoamInfo *pCsrRoamInfo,
823 tANI_U32 roamId,
824 eRoamCmdStatus roamStatus,
825 eCsrRoamResult roamResult
826);
827
828/*----------------------------------------------------------------------------
829 * Utility Function prototypes
830 * -------------------------------------------------------------------------*/
831
832/*==========================================================================
833
834 FUNCTION WLANBAP_CleanCB
835
836 DESCRIPTION
837 Clear out all fields in the BAP context.
838
839 DEPENDENCIES
840
841 PARAMETERS
842
843 IN
844 pBtampCtx: pointer to the BAP control block
845 freeFlag: flag indicating whether to free any allocations.
846
847 RETURN VALUE
848 The result code associated with performing the operation
849
850 VOS_STATUS_E_FAULT: pointer to BAP cb is NULL ; access would cause a page
851 fault
852 VOS_STATUS_SUCCESS: Everything is good :)
853
854 SIDE EFFECTS
855
856============================================================================*/
857VOS_STATUS
858WLANBAP_CleanCB
859(
860 ptBtampContext pBtampCtx,
861 v_U32_t freeFlag // 0 /*do not empty*/);
862);
863
864/*==========================================================================
865
866 FUNCTION WLANBAP_GetCtxFromStaId
867
868 DESCRIPTION
869 Called inside the BT-AMP PAL (BAP) layer whenever we need either the
870 BSL context or the BTAMP context from the StaId.
871
872
873 DEPENDENCIES
874
875 PARAMETERS
876
877 IN
878 ucSTAId: The StaId (used by TL, PE, and HAL)
879
880 OUT
881 hBtampHandle: Handle (pointer to a pointer) to return the
882 btampHandle value in.
883 hHddHdl: Handle to return the BSL context pointer in.
884
885 RETURN VALUE
886 The result code associated with performing the operation
887
888 VOS_STATUS_E_FAULT: NULL pointer; access would cause a page fault
889 VOS_STATUS_SUCCESS: Everything is good :)
890
891 SIDE EFFECTS
892
893============================================================================*/
894VOS_STATUS
895WLANBAP_GetCtxFromStaId
896(
897 v_U8_t ucSTAId, /* The StaId (used by TL, PE, and HAL) */
898 ptBtampHandle *hBtampHandle, /* Handle to return per app btampHandle value in */
899 ptBtampContext *hBtampContext, /* Handle to return per assoc btampContext value in */
900 v_PVOID_t *hHddHdl /* Handle to return BSL context in */
901);
902
903/*==========================================================================
904
905 FUNCTION WLANBAP_GetStaIdFromLinkCtx
906
907 DESCRIPTION
908 Called inside the BT-AMP PAL (BAP) layer whenever we need the
909 StaId (or hHddHdl) from the BTAMP context and phy_link_handle.
910
911
912 DEPENDENCIES
913
914 PARAMETERS
915
916 IN
917 hBtampHandle: Handle (pointer to a pointer) to return the
918 btampHandle value in.
919 phy_link_handle: physical link handle value. Unique per assoc.
920
921 OUT
922 pucSTAId: The StaId (used by TL, PE, and HAL)
923 hHddHdl: Handle to return the BSL context pointer in.
924
925 RETURN VALUE
926 The result code associated with performing the operation
927
928 VOS_STATUS_E_FAULT: NULL pointer; access would cause a page fault
929 VOS_STATUS_SUCCESS: Everything is good :)
930
931 SIDE EFFECTS
932
933============================================================================*/
934VOS_STATUS
935WLANBAP_GetStaIdFromLinkCtx
936(
937 ptBtampHandle btampHandle, /* btampHandle value in */
938 v_U8_t phy_link_handle, /* phy_link_handle value in */
939 v_U8_t *pucSTAId, /* The StaId (used by TL, PE, and HAL) */
940 v_PVOID_t *hHddHdl /* Handle to return BSL context */
941);
942
943/*==========================================================================
944
945 FUNCTION WLANBAP_CreateNewPhyLinkCtx
946
947 DESCRIPTION
948 Called in order to create (or update) a BAP Physical Link "context"
949
950
951 DEPENDENCIES
952
953 PARAMETERS
954
955 IN
956 btampHandle: BAP app context handle
957 phy_link_handle: phy_link_handle from the Command
958 pHddHdl: BSL passes in its specific context
959
960 OUT
961 hBtampContext: Handle (pointer to a pointer) to return the
962 per "Phy Link" ptBtampContext value in.
963
964 RETURN VALUE
965 The result code associated with performing the operation
966
967 VOS_STATUS_E_FAULT: NULL pointer; access would cause a page fault
968 VOS_STATUS_SUCCESS: Everything is good :)
969
970 SIDE EFFECTS
971
972============================================================================*/
973VOS_STATUS
974WLANBAP_CreateNewPhyLinkCtx
975(
976 ptBtampHandle btampHandle,
977 v_U8_t phy_link_handle, /* I get phy_link_handle from the Command */
978 v_PVOID_t pHddHdl, /* BSL passes in its specific context */
979 ptBtampContext *hBtampContext, /* Handle to return per assoc btampContext value in */
980 tWLAN_BAPRole BAPDeviceRole /* Needed to determine which MAC address to use for self MAC */
981);
982
983/*==========================================================================
984
985 FUNCTION WLANBAP_UpdatePhyLinkCtxStaId
986
987 DESCRIPTION
988 Called to update the STAId value associated with Physical Link "context"
989
990
991 DEPENDENCIES
992
993 PARAMETERS
994
995 IN
996 pBtampContext: ptBtampContext to update.
997 ucSTAId: The StaId (used by TL, PE, and HAL)
998
999
1000 RETURN VALUE
1001 The result code associated with performing the operation
1002
1003 VOS_STATUS_E_FAULT: NULL pointer; access would cause a page fault
1004 VOS_STATUS_SUCCESS: Everything is good :)
1005
1006 SIDE EFFECTS
1007
1008============================================================================*/
1009VOS_STATUS
1010WLANBAP_UpdatePhyLinkCtxStaId
1011(
1012 ptBtampContext pBtampContext, /* btampContext value in */
1013 v_U8_t ucSTAId
1014);
1015
1016/*==========================================================================
1017
1018 FUNCTION WLANBAP_CreateNewLogLinkCtx
1019
1020 DESCRIPTION
1021 Called in order to allocate a BAP Logical Link "context" and "index"
1022
1023
1024 DEPENDENCIES
1025
1026 PARAMETERS
1027
1028 IN
1029 pBtampContext: Pointer to the ptBtampContext value in.
1030 phy_link_handle: phy_link_handle involved
1031
1032 OUT
1033 pLog_link_handle: return the log_link_handle here
1034
1035 RETURN VALUE
1036 The result code associated with performing the operation
1037
1038 VOS_STATUS_E_FAULT: NULL pointer; access would cause a page fault
1039 VOS_STATUS_SUCCESS: Everything is good :)
1040
1041 SIDE EFFECTS
1042
1043============================================================================*/
1044VOS_STATUS
1045WLANBAP_CreateNewLogLinkCtx
1046(
1047 ptBtampContext pBtampContext, /* pointer to the per assoc btampContext value */
1048 v_U8_t phy_link_handle, /* I get phy_link_handle from the Command */
1049 v_U8_t tx_flow_spec[18],
1050 v_U8_t rx_flow_spec[18],
1051 v_U16_t *pLog_link_handle /* Return the logical link index here */
1052);
1053
1054 /*==========================================================================
1055
1056 FUNCTION WLANBAP_pmcFullPwrReqCB
1057
1058 DESCRIPTION
1059 Callback provide to PMC in the pmcRequestFullPower API.
1060
1061
1062 DEPENDENCIES
1063
1064 PARAMETERS
1065
1066 IN
1067 callbackContext: The user passed in a context to identify
1068 status: The halStatus
1069
1070
1071 RETURN VALUE
1072 None
1073
1074 SIDE EFFECTS
1075
1076============================================================================*/
1077void
1078WLANBAP_pmcFullPwrReqCB
1079(
1080 void *callbackContext,
1081 eHalStatus status
1082);
1083
1084/*===========================================================================
1085
1086 FUNCTION WLANBAP_RxProcLsPkt
1087
1088 DESCRIPTION
1089
1090 This API will be called when Link Supervision frames are received at BAP
1091
1092 PARAMETERS
1093
1094 btampHandle: The BT-AMP PAL handle returned in WLANBAP_GetNewHndl.
1095 pucAC: Pointer to return the access category
1096 RxProtoType: Protocol type of Received Packet
1097 vosDataBuff: The data buffer containing the 802.3 frame to be
1098 translated to BT HCI Data Packet
1099
1100 RETURN VALUE
1101
1102 The result code associated with performing the operation
1103
1104 VOS_STATUS_E_INVAL: Input parameters are invalid
1105 VOS_STATUS_E_FAULT: BAP handle is NULL
1106 VOS_STATUS_SUCCESS: Everything is good :)
1107
1108 SIDE EFFECTS
1109
1110============================================================================*/
1111VOS_STATUS
1112WLANBAP_RxProcLsPkt
1113(
1114 ptBtampHandle btampHandle,
1115 v_U8_t phy_link_handle, /* Used by BAP to indentify the WLAN assoc. (StaId) */
1116 v_U16_t RxProtoType, /* Protocol Type from the frame received */
1117 vos_pkt_t *vosRxLsBuff
1118);
1119
1120
1121/*----------------------------------------------------------------------------
1122
1123 FUNCTION WLANBAP_TxLinkSupervisionReq()
1124
1125 DESCRIPTION
1126 Implements the LinkSupervision Tx Request procedure.This will be called by APIs that want
1127 to transmit LinkSupervision Packets
1128 Calls PktPending CB to indicate a packet is pending for transmission
1129
1130
1131 DEPENDENCIES
1132 NA.
1133
1134 PARAMETERS
1135
1136 IN
1137 btampHandle: pointer to the BAP handle. Returned from WLANBAP_GetNewHndl.
1138 phy_link_handle: Used by BAP to indentify the WLAN assoc. (StaId)
1139 vosDataBuff:The actual packet being sent in Tx request
1140 protoType : specifies if it is a LS REQ or LS REP packet
1141
1142 RETURN VALUE
1143 The result code associated with performing the operation
1144
1145 VOS_STATUS_E_FAULT: Failure of Transmit procedure
1146 VOS_STATUS_SUCCESS: Success
1147
1148 SIDE EFFECTS
1149
1150----------------------------------------------------------------------------*/
1151VOS_STATUS
1152WLANBAP_TxLinkSupervision
1153(
1154 ptBtampHandle btampHandle,
1155 v_U8_t phy_link_handle, /* Used by BAP to indentify the WLAN assoc. (StaId) */
1156 vos_pkt_t *vosDataBuff,
1157 v_U16_t protoType
1158);
1159
1160/*==========================================================================
1161
1162 FUNCTION WLANBAP_ReadMacConfig
1163
1164 DESCRIPTION
1165 This function sets the MAC config (Address and SSID to BT-AMP context
1166
1167 DEPENDENCIES
1168
1169 PARAMETERS
1170
1171 pvosGCtx: pointer to the global vos context; a handle to BAP's
1172 control block can be extracted from its context
1173
1174 RETURN VALUE
1175 None
1176
1177 SIDE EFFECTS
1178
1179============================================================================*/
1180void
1181WLANBAP_ReadMacConfig
1182(
1183 ptBtampContext pBtampCtx
1184);
1185
1186/*==========================================================================
1187
1188 FUNCTION WLANBAP_NeedBTCoexPriority
1189
1190 DESCRIPTION
1191 This function will cause a message to be sent to BTC firmware
1192 if a change in priority has occurred. (From AMP's point-of-view.)
1193
1194 DEPENDENCIES
1195
1196 PARAMETERS
1197
1198 pvosGCtx: pointer to the global vos context; a handle to HAL's
1199 control block can be extracted from its context
1200
1201 RETURN VALUE
1202 None
1203
1204 SIDE EFFECTS
1205
1206============================================================================*/
1207void
1208WLANBAP_NeedBTCoexPriority
1209(
1210 ptBtampContext pBtampCtx,
1211 v_U32_t needCoexPriority
1212);
1213
1214
1215/*==========================================================================
1216
1217 FUNCTION WLANBAP_RxCallback
1218
1219 DESCRIPTION
1220 This function is called by TL call this function for all frames except for Data frames
1221
1222 DEPENDENCIES
1223
1224 PARAMETERS
1225
1226 pvosGCtx: pointer to the global vos context; a handle to BAP's
1227 control block can be extracted from its context
1228 pPacket Vos packet
1229 frameType Frame type
1230
1231 RETURN VALUE
1232 None
1233
1234 SIDE EFFECTS
1235
1236============================================================================*/
1237VOS_STATUS WLANBAP_RxCallback
1238(
1239 v_PVOID_t pvosGCtx,
1240 vos_pkt_t *pPacket,
1241 WLANTL_BAPFrameEnumType frameType
1242);
1243
1244
1245/*===========================================================================
1246
1247 FUNCTION WLANBAP_InitLinkSupervision
1248
1249 DESCRIPTION
1250
1251 This API will be called when Link Supervision module is to be initialized when connected at BAP
1252
1253 PARAMETERS
1254
1255 btampHandle: The BT-AMP PAL handle returned in WLANBAP_GetNewHndl.
1256
1257 RETURN VALUE
1258
1259 The result code associated with performing the operation
1260
1261 VOS_STATUS_E_INVAL: Input parameters are invalid
1262 VOS_STATUS_E_FAULT: BAP handle is NULL
1263 VOS_STATUS_SUCCESS: Everything is good :)
1264
1265 SIDE EFFECTS
1266
1267============================================================================*/
1268#define TX_LS_DATALEN 32
1269
1270VOS_STATUS
1271WLANBAP_InitLinkSupervision
1272(
1273 ptBtampHandle btampHandle
1274);
1275
1276
1277/*===========================================================================
1278
1279 FUNCTION WLANBAP_DeInitLinkSupervision
1280
1281 DESCRIPTION
1282
1283 This API will be called when Link Supervision module is to be stopped after disconnected at BAP
1284
1285 PARAMETERS
1286
1287 btampHandle: The BT-AMP PAL handle returned in WLANBAP_GetNewHndl.
1288
1289 RETURN VALUE
1290
1291 The result code associated with performing the operation
1292
1293 VOS_STATUS_E_INVAL: Input parameters are invalid
1294 VOS_STATUS_E_FAULT: BAP handle is NULL
1295 VOS_STATUS_SUCCESS: Everything is good :)
1296
1297 SIDE EFFECTS
1298
1299============================================================================*/
1300VOS_STATUS
1301WLANBAP_DeInitLinkSupervision
1302(
1303 ptBtampHandle btampHandle
1304);
1305
1306void WLAN_BAPEstablishLogicalLink(ptBtampContext btampContext);
1307
1308 #ifdef __cplusplus
1309 }
1310
1311
1312#endif
1313
1314
1315#endif /* #ifndef WLAN_QCT_WLANBAP_INTERNAL_H */
1316