Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Jeff Johnson | 2bbc029 | 2017-09-19 08:38:56 -0700 | [diff] [blame] | 2 | * Copyright (c) 2012-2015, 2017 The Linux Foundation. All rights reserved. |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 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 Nakkala | 92f07d8 | 2013-01-08 21:16:34 -0800 | [diff] [blame] | 20 | */ |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 21 | |
| 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 Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 28 | /*=========================================================================== |
| 29 | |
| 30 | b a p A p i D a t a . C |
| 31 | |
| 32 | OVERVIEW: |
| 33 | |
| 34 | This software unit holds the implementation of the WLAN BAP modules |
| 35 | "platform independent" Data path functions. |
| 36 | |
| 37 | The functions externalized by this module are to be called ONLY by other |
| 38 | WLAN modules (HDD) that properly register with the BAP Layer initially. |
| 39 | |
| 40 | DEPENDENCIES: |
| 41 | |
| 42 | Are listed for each API below. |
| 43 | |
| 44 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 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: /cygdrive/e/Builds/M7201JSDCAAPAD52240B/WM/platform/msm7200/Src/Drivers/SD/ClientDrivers/WLAN/QCT/CORE/BAP/src/bapApiData.c,v 1.4 2008/11/10 22:34:22 jzmuda Exp jzmuda $$DateTime$$Author: jzmuda $ |
| 57 | |
| 58 | |
| 59 | when who what, where, why |
| 60 | ---------- --- -------------------------------------------------------- |
| 61 | 2008-09-15 jez Created module |
| 62 | |
| 63 | ===========================================================================*/ |
| 64 | |
| 65 | /*---------------------------------------------------------------------------- |
| 66 | * Include Files |
| 67 | * -------------------------------------------------------------------------*/ |
| 68 | //#include "wlan_qct_tl.h" |
| 69 | #include "vos_trace.h" |
| 70 | //I need the TL types and API |
| 71 | #include "wlan_qct_tl.h" |
| 72 | |
| 73 | #include "wlan_qct_hal.h" |
| 74 | |
| 75 | /* BT-AMP PAL API header file */ |
| 76 | #include "bapApi.h" |
| 77 | #include "bapInternal.h" |
| 78 | #include "bapApiTimer.h" |
| 79 | |
| 80 | //#define BAP_DEBUG |
| 81 | /*---------------------------------------------------------------------------- |
| 82 | * Preprocessor Definitions and Constants |
| 83 | * -------------------------------------------------------------------------*/ |
| 84 | /*Endian-ness definitions*/ |
| 85 | |
| 86 | #undef BAP_LITTLE_BIT_ENDIAN |
| 87 | #define BAP_LITTLE_BIT_ENDIAN |
| 88 | |
| 89 | /*LLC header definitions*/ |
| 90 | |
| 91 | /* Length of the LLC header*/ |
| 92 | #define WLANBAP_LLC_HEADER_LEN 8 |
| 93 | #if 0 |
| 94 | /*Offset of the OUI field inside the LLC/SNAP header*/ |
| 95 | #define WLANBAP_LLC_OUI_OFFSET 3 |
| 96 | |
| 97 | /*Size of the OUI type field inside the LLC/SNAP header*/ |
| 98 | #define WLANBAP_LLC_OUI_SIZE 3 |
| 99 | |
| 100 | /*Offset of the protocol type field inside the LLC/SNAP header*/ |
Madan Mohan Koyyalamudi | a53c4dc | 2012-11-13 10:35:42 -0800 | [diff] [blame] | 101 | #define WLANBAP_LLC_PROTO_TYPE_OFFSET (WLANBAP_LLC_OUI_OFFSET + WLANBAP_LLC_OUI_SIZE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 102 | |
| 103 | /*Size of the protocol type field inside the LLC/SNAP header*/ |
| 104 | #define WLANBAP_LLC_PROTO_TYPE_SIZE 2 |
| 105 | #endif |
| 106 | |
| 107 | /*BT-AMP protocol type values*/ |
| 108 | /*BT-AMP packet of type data*/ |
| 109 | #define WLANBAP_BT_AMP_TYPE_DATA 0x0001 |
| 110 | |
| 111 | /*BT-AMP packet of type activity report*/ |
| 112 | #define WLANBAP_BT_AMP_TYPE_AR 0x0002 |
| 113 | |
| 114 | /*BT-AMP packet of type security frame*/ |
| 115 | #define WLANBAP_BT_AMP_TYPE_SEC 0x0003 |
| 116 | |
| 117 | /*802.3 header definitions*/ |
| 118 | #define WLANBAP_802_3_HEADER_LEN 14 |
| 119 | |
| 120 | /* Offset of DA field in a 802.3 header*/ |
| 121 | #define WLANBAP_802_3_HEADER_DA_OFFSET 0 |
| 122 | |
| 123 | //*BT-AMP packet LLC OUI value*/ |
| 124 | const v_U8_t WLANBAP_BT_AMP_OUI[] = {0x00, 0x19, 0x58 }; |
| 125 | |
| 126 | /*LLC header value*/ |
| 127 | static v_U8_t WLANBAP_LLC_HEADER[] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00 }; |
| 128 | |
| 129 | /* HCI header definitions*/ |
| 130 | |
| 131 | // Define the length of the ACL data packet HCI header |
| 132 | #define WLANBAP_HCI_ACL_HEADER_LEN 4 |
| 133 | |
| 134 | // Debug related defines |
| 135 | //#define DBGLOG printf |
| 136 | #define DUMPLOG_ON |
| 137 | #ifdef DUMPLOG_ON |
Madan Mohan Koyyalamudi | a53c4dc | 2012-11-13 10:35:42 -0800 | [diff] [blame] | 138 | #define DUMPLOG(n, name1, name2, aStr, size) do { \ |
| 139 | int i; \ |
| 140 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,"%d. %s: %s = \n", n, name1, name2); \ |
| 141 | for (i = 0; i < size; i++) \ |
| 142 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,"%2.2x%s", ((unsigned char *)aStr)[i], i % 16 == 15 ? "\n" : " "); \ |
| 143 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,"\n"); \ |
| 144 | } while (0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 145 | #else |
| 146 | #define DUMPLOG(n, name1, name2, aStr, size) |
| 147 | #endif |
| 148 | |
| 149 | #if 0 |
| 150 | // Debug related defines |
| 151 | #define DBGLOG printf |
| 152 | #define DUMPLOG |
| 153 | #if defined DUMPLOG |
Madan Mohan Koyyalamudi | a53c4dc | 2012-11-13 10:35:42 -0800 | [diff] [blame] | 154 | #define DUMPLOG(n, name1, name2, aStr, size) do { \ |
| 155 | int i; \ |
| 156 | DBGLOG("%d. %s: %s = \n", n, name1, name2); \ |
| 157 | for (i = 0; i < size; i++) \ |
| 158 | DBGLOG("%2.2x%s", ((unsigned char *)aStr)[i], i % 16 == 15 ? "\n" : " "); \ |
| 159 | DBGLOG("\n"); \ |
| 160 | } while (0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 161 | #else |
| 162 | #define DUMPLOG(n, name1, name2, aStr, size) |
| 163 | #endif |
| 164 | #endif |
| 165 | |
| 166 | /*---------------------------------------------------------------------------- |
| 167 | * Type Declarations |
| 168 | * -------------------------------------------------------------------------*/ |
| 169 | // Don't we have this type defined somewhere? |
| 170 | #if 0 |
| 171 | /* 802.3 header */ |
| 172 | typedef struct |
| 173 | { |
| 174 | /* Destination address field */ |
| 175 | v_U8_t vDA[VOS_MAC_ADDR_SIZE]; |
| 176 | |
| 177 | /* Source address field */ |
| 178 | v_U8_t vSA[VOS_MAC_ADDR_SIZE]; |
| 179 | |
| 180 | /* Length field */ |
| 181 | v_U16_t usLenType; /* Num bytes in info field (i.e., exclude 802.3 hdr) */ |
| 182 | /* Max length 1500 (0x5dc) (What about 0x5ee? That |
| 183 | * includes 802.3 Header and FCS.) */ |
| 184 | }WLANBAP_8023HeaderType; |
| 185 | #endif |
| 186 | |
| 187 | /** |
| 188 | * \brief HCI ACL Data packet format |
| 189 | * |
| 190 | * 0 7 8 15 16 23 24 31 |
| 191 | * +--------+----+----+--------+--------+ |
| 192 | * | phy_ |log_| PB/| Data Total | |
| 193 | * | link_ |lnk_| BC | Length | |
| 194 | * | handle |hndl|Flag| | |
| 195 | * +--------+----+----+--------+--------+ |
| 196 | * | | |
| 197 | * | Data | |
| 198 | * ~ ~ |
| 199 | * +--------+---------+--------+--------+ |
| 200 | * |
| 201 | * NB: |
| 202 | * This is in little-endian |
| 203 | * 1) phy_link_handle is the first 8 bits |
| 204 | * 2) log_link_handle is the next 4 bits |
| 205 | * 3) PB flag is the next 2 bits |
| 206 | * 4) BC flags is the next 2 bits |
| 207 | * 5) Total length of the data field is the next 16 bits |
| 208 | * |
| 209 | */ |
| 210 | |
| 211 | typedef struct |
| 212 | { |
| 213 | |
| 214 | #ifndef BAP_LITTLE_BIT_ENDIAN |
| 215 | |
| 216 | v_U8_t phyLinkHandle; /* do I have to reverse the byte? I think so... */ |
| 217 | |
| 218 | v_U8_t BCFlag :2; |
| 219 | v_U8_t PBFlag :2; |
| 220 | v_U8_t logLinkHandle :4; |
| 221 | |
| 222 | v_U16_t dataLength; /* do I have to reverse each byte? and then reverse the two bytes? I think so... */ |
| 223 | |
| 224 | #else |
| 225 | |
| 226 | v_U8_t phyLinkHandle; |
| 227 | |
| 228 | v_U8_t logLinkHandle :4; |
| 229 | v_U8_t PBFlag :2; |
| 230 | v_U8_t BCFlag :2; |
| 231 | |
| 232 | v_U16_t dataLength; /* Max length WLANBAP_MAX_80211_PAL_PDU_SIZE (1492) */ |
| 233 | |
| 234 | #endif |
| 235 | |
| 236 | } WLANBAP_HCIACLHeaderType; |
| 237 | |
| 238 | |
| 239 | |
| 240 | /*---------------------------------------------------------------------------- |
| 241 | * Global Data Definitions |
| 242 | * -------------------------------------------------------------------------*/ |
| 243 | |
| 244 | /*---------------------------------------------------------------------------- |
| 245 | * Static Variable Definitions |
| 246 | * -------------------------------------------------------------------------*/ |
| 247 | |
| 248 | /*---------------------------------------------------------------------------- |
| 249 | * Static Function Declarations and Definitions |
| 250 | * -------------------------------------------------------------------------*/ |
| 251 | |
| 252 | /*---------------------------------------------------------------------------- |
| 253 | * Externalized Function Definitions |
| 254 | * -------------------------------------------------------------------------*/ |
| 255 | |
| 256 | /*---------------------------------------------------------------------------- |
| 257 | * Function Declarations and Documentation |
| 258 | * -------------------------------------------------------------------------*/ |
| 259 | |
| 260 | #define WLANBAP_DEBUG_FRAME_BYTE_PER_LINE 16 |
| 261 | #define WLANBAP_DEBUG_FRAME_BYTE_PER_BYTE 4 |
| 262 | |
| 263 | /*=========================================================================== |
| 264 | |
| 265 | FUNCTION WLANBAP_XlateTxDataPkt |
| 266 | |
| 267 | DESCRIPTION |
| 268 | |
| 269 | HDD will call this API when it has a HCI Data Packet and it wants |
| 270 | to translate it into a 802.3 LLC frame - ready to send using TL. |
| 271 | |
| 272 | |
| 273 | PARAMETERS |
| 274 | |
| 275 | btampHandle: The BT-AMP PAL handle returned in WLANBAP_GetNewHndl. |
| 276 | phy_link_handle: Used by BAP to indentify the WLAN assoc. (StaId) |
| 277 | |
| 278 | pucAC: Pointer to return the access category |
| 279 | vosDataBuff: The data buffer containing the BT-AMP packet to be |
| 280 | translated to an 802.3 LLC frame |
| 281 | tlMetaInfo: return meta info gleaned from the outgoing frame, here. |
| 282 | |
| 283 | RETURN VALUE |
| 284 | |
| 285 | The result code associated with performing the operation |
| 286 | |
| 287 | VOS_STATUS_E_INVAL: Input parameters are invalid |
| 288 | VOS_STATUS_E_FAULT: BAP handle is NULL |
| 289 | VOS_STATUS_SUCCESS: Everything is good :) |
| 290 | |
| 291 | SIDE EFFECTS |
| 292 | |
| 293 | ============================================================================*/ |
| 294 | VOS_STATUS |
| 295 | WLANBAP_XlateTxDataPkt |
| 296 | ( |
| 297 | ptBtampHandle btampHandle, /* Used by BAP to identify the actual session |
| 298 | and therefore addresses */ |
| 299 | v_U8_t phy_link_handle, /* Used by BAP to indentify the WLAN assoc. (StaId) */ |
| 300 | WLANTL_ACEnumType *pucAC, /* Return the AC here */ |
| 301 | WLANTL_MetaInfoType *tlMetaInfo, /* Return the MetaInfo here. An assist to WLANBAP_STAFetchPktCBType */ |
| 302 | vos_pkt_t *vosDataBuff |
| 303 | ) |
| 304 | { |
| 305 | ptBtampContext pBtampCtx = (ptBtampContext) btampHandle; |
| 306 | tpBtampLogLinkCtx pLogLinkContext; |
| 307 | WLANBAP_8023HeaderType w8023Header; |
| 308 | WLANBAP_HCIACLHeaderType hciACLHeader; |
| 309 | v_U8_t aucLLCHeader[WLANBAP_LLC_HEADER_LEN]; |
| 310 | VOS_STATUS vosStatus; |
| 311 | v_U8_t ucSTAId; /* The StaId (used by TL, PE, and HAL) */ |
| 312 | v_PVOID_t pHddHdl; /* Handle to return BSL context in */ |
| 313 | v_U16_t headerLength; /* The 802.3 frame length*/ |
| 314 | v_U16_t protoType = WLANBAP_BT_AMP_TYPE_DATA; /* The protocol type bytes*/ |
Arun Kumar Khandavalli | 2dadb37 | 2014-02-17 17:09:20 +0530 | [diff] [blame] | 315 | uintptr_t value = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 316 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 317 | |
| 318 | |
| 319 | /*------------------------------------------------------------------------ |
| 320 | Sanity check params |
| 321 | ------------------------------------------------------------------------*/ |
| 322 | if ( NULL == pBtampCtx) |
| 323 | { |
| 324 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 325 | "Invalid BAP handle value in %s", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 326 | return VOS_STATUS_E_FAULT; |
| 327 | } |
| 328 | |
| 329 | // Here, I have to make the assumption that this is an |
| 330 | // HCI ACL Data packet that I am being handed. |
| 331 | vosStatus = vos_pkt_pop_head( vosDataBuff, &hciACLHeader, WLANBAP_HCI_ACL_HEADER_LEN); |
| 332 | |
| 333 | if ( VOS_STATUS_SUCCESS != vosStatus ) |
| 334 | { |
| 335 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, |
| 336 | "WLAN BAP: Failed to pop HCI ACL header from packet %d", |
| 337 | vosStatus); |
| 338 | |
| 339 | return vosStatus; |
| 340 | } |
| 341 | |
| 342 | // JEZ081003: Remove this after debugging |
| 343 | // Sanity check the phy_link_handle value |
| 344 | |
| 345 | if ( phy_link_handle != hciACLHeader.phyLinkHandle ) |
| 346 | { |
| 347 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, |
| 348 | "WLAN BAP: phy_link_handle mismatch in %s phy_link_handle=%d hciACLHeader.phyLinkHandle=%d", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 349 | __func__, phy_link_handle, hciACLHeader.phyLinkHandle); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 350 | return VOS_STATUS_E_INVAL; |
| 351 | } |
| 352 | |
| 353 | |
| 354 | /* Lookup the StaId using the phy_link_handle and the BAP context */ |
| 355 | |
| 356 | vosStatus = WLANBAP_GetStaIdFromLinkCtx ( |
| 357 | btampHandle, /* btampHandle value in */ |
| 358 | phy_link_handle, /* phy_link_handle value in */ |
| 359 | &ucSTAId, /* The StaId (used by TL, PE, and HAL) */ |
| 360 | &pHddHdl); /* Handle to return BSL context */ |
| 361 | if ( VOS_STATUS_SUCCESS != vosStatus ) |
| 362 | { |
| 363 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 364 | "Unable to retrieve STA Id from BAP context and phy_link_handle in %s", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 365 | return VOS_STATUS_E_FAULT; |
| 366 | } |
| 367 | |
| 368 | // JEZ081003: Remove this after debugging |
| 369 | // Sanity check the log_link_handle value |
| 370 | if (!BTAMP_VALID_LOG_LINK( hciACLHeader.logLinkHandle)) |
| 371 | { |
| 372 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, |
| 373 | "WLAN BAP: Invalid logical link handle (%d) in %s. Corrected.", |
| 374 | hciACLHeader.logLinkHandle, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 375 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 376 | |
| 377 | // JEZ090123: Insure that the logical link value is good |
| 378 | hciACLHeader.logLinkHandle = 1; |
| 379 | //return VOS_STATUS_E_INVAL; |
| 380 | } |
| 381 | |
| 382 | /* Use the log_link_handle to retrieve the logical link context */ |
| 383 | /* JEZ081006: abstract this with a proc. So you can change the impl later */ |
| 384 | pLogLinkContext = &(pBtampCtx->btampLogLinkCtx[ hciACLHeader.logLinkHandle ]); |
| 385 | |
| 386 | // JEZ081003: Remove this after debugging |
| 387 | // Sanity check the log_link_handle value |
| 388 | // JEZ081113: I changed this to fail on an UNOCCUPIED entry |
| 389 | if ( pLogLinkContext->present != VOS_TRUE) |
| 390 | { |
| 391 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, |
| 392 | "WLAN BAP: Invalid logical link entry in %s", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 393 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 394 | |
| 395 | return VOS_STATUS_E_INVAL; |
| 396 | } |
| 397 | |
| 398 | // Return the AC and MetaInfo |
| 399 | |
| 400 | // Now copy the AC values from the Logical Link context |
| 401 | *pucAC = pLogLinkContext->btampAC; |
| 402 | // Now copy the values from the Logical Link context to the MetaInfo |
Kanchanapally, Vidyullatha | ed969c6 | 2015-02-18 11:39:11 +0530 | [diff] [blame] | 403 | tlMetaInfo->ac = *pucAC; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 404 | tlMetaInfo->ucTID = pLogLinkContext->ucTID; |
| 405 | tlMetaInfo->ucUP = pLogLinkContext->ucUP; |
| 406 | tlMetaInfo->ucIsEapol = VOS_FALSE; |
| 407 | tlMetaInfo->ucDisableFrmXtl = VOS_FALSE; |
| 408 | tlMetaInfo->ucBcast = VOS_FALSE; /* hciACLHeader.BCFlag; */ /* Don't I want to use the BCFlag? */ |
| 409 | tlMetaInfo->ucMcast = VOS_FALSE; |
| 410 | tlMetaInfo->ucType = 0x00; /* What is this really ?? */ |
| 411 | // tlMetaInfo->usTimeStamp = 0x00; /* Ravi, shouldn't you be setting this? It's in the VOS packet. */ |
| 412 | |
| 413 | // Form the 802.3 header |
| 414 | |
| 415 | vos_mem_copy( w8023Header.vDA, pBtampCtx->peer_mac_addr, VOS_MAC_ADDR_SIZE); |
| 416 | vos_mem_copy( w8023Header.vSA, pBtampCtx->self_mac_addr, VOS_MAC_ADDR_SIZE); |
| 417 | |
| 418 | /* Now this length passed down in HCI...is in little-endian */ |
| 419 | headerLength = vos_le16_to_cpu(hciACLHeader.dataLength); |
| 420 | headerLength += WLANBAP_LLC_HEADER_LEN; |
| 421 | /* Now the 802.3 length field is big-endian?! */ |
| 422 | w8023Header.usLenType = vos_cpu_to_be16(headerLength); |
| 423 | |
| 424 | /* Now adjust the protocol type bytes*/ |
| 425 | protoType = vos_cpu_to_be16( protoType); |
| 426 | |
| 427 | /* Now form the LLC header */ |
| 428 | vos_mem_copy(aucLLCHeader, |
| 429 | WLANBAP_LLC_HEADER, |
| 430 | sizeof(WLANBAP_LLC_HEADER)); |
| 431 | vos_mem_copy(&aucLLCHeader[WLANBAP_LLC_OUI_OFFSET], |
| 432 | WLANBAP_BT_AMP_OUI, |
| 433 | WLANBAP_LLC_OUI_SIZE); |
| 434 | vos_mem_copy(&aucLLCHeader[WLANBAP_LLC_PROTO_TYPE_OFFSET], |
| 435 | &protoType, //WLANBAP_BT_AMP_TYPE_DATA |
| 436 | WLANBAP_LLC_PROTO_TYPE_SIZE); |
| 437 | |
| 438 | /* Push on the LLC header */ |
| 439 | vos_pkt_push_head(vosDataBuff, |
| 440 | aucLLCHeader, |
| 441 | WLANBAP_LLC_HEADER_LEN); |
| 442 | |
| 443 | /* Push on the 802.3 header */ |
| 444 | vos_pkt_push_head(vosDataBuff, &w8023Header, sizeof(w8023Header)); |
| 445 | |
| 446 | |
| 447 | /*Set the logical link handle as user data so that we can retrieve it on |
| 448 | Tx Complete */ |
Arun Kumar Khandavalli | 2dadb37 | 2014-02-17 17:09:20 +0530 | [diff] [blame] | 449 | value = (uintptr_t)hciACLHeader.logLinkHandle; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 450 | vos_pkt_set_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_BAP, |
| 451 | (v_VOID_t *)value); |
| 452 | |
| 453 | return VOS_STATUS_SUCCESS; |
| 454 | }/*WLANBAP_XlateTxDataPkt*/ |
| 455 | |
| 456 | /*=========================================================================== |
| 457 | |
| 458 | FUNCTION WLANBAP_GetAcFromTxDataPkt |
| 459 | |
| 460 | DESCRIPTION |
| 461 | |
| 462 | HDD will call this API when it has a HCI Data Packet (SKB) and it wants |
| 463 | to find AC type of the data frame from the HCI header on the data pkt |
| 464 | - to be send using TL. |
| 465 | |
| 466 | |
| 467 | PARAMETERS |
| 468 | |
| 469 | btampHandle: The BT-AMP PAL handle returned in WLANBAP_GetNewHndl. |
| 470 | |
| 471 | pHciData: Pointer to the HCI data frame |
| 472 | |
| 473 | pucAC: Pointer to return the access category |
| 474 | |
| 475 | RETURN VALUE |
| 476 | |
| 477 | The result code associated with performing the operation |
| 478 | |
| 479 | VOS_STATUS_E_INVAL: Input parameters are invalid |
| 480 | VOS_STATUS_E_FAULT: BAP handle is NULL |
| 481 | VOS_STATUS_SUCCESS: Everything is good :) |
| 482 | |
| 483 | SIDE EFFECTS |
| 484 | |
| 485 | ============================================================================*/ |
| 486 | VOS_STATUS |
| 487 | WLANBAP_GetAcFromTxDataPkt |
| 488 | ( |
| 489 | ptBtampHandle btampHandle, /* Used by BAP to identify the actual session |
| 490 | and therefore addresses */ |
| 491 | void *pHciData, /* Pointer to the HCI data frame */ |
| 492 | WLANTL_ACEnumType *pucAC /* Return the AC here */ |
| 493 | ) |
| 494 | { |
| 495 | ptBtampContext pBtampCtx; |
| 496 | tpBtampLogLinkCtx pLogLinkContext; |
| 497 | WLANBAP_HCIACLHeaderType hciACLHeader; |
| 498 | /*------------------------------------------------------------------------ |
| 499 | Sanity check params |
| 500 | ------------------------------------------------------------------------*/ |
| 501 | if (( NULL == btampHandle) || (NULL == pHciData) || (NULL == pucAC)) |
| 502 | { |
| 503 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 504 | "Invalid params in %s", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 505 | return VOS_STATUS_E_FAULT; |
| 506 | } |
| 507 | pBtampCtx = (ptBtampContext) btampHandle; |
| 508 | |
| 509 | vos_mem_copy( &hciACLHeader, pHciData, WLANBAP_HCI_ACL_HEADER_LEN); |
| 510 | // Sanity check the log_link_handle value |
| 511 | if (!BTAMP_VALID_LOG_LINK( hciACLHeader.logLinkHandle)) |
| 512 | { |
| 513 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, |
| 514 | "WLAN BAP: Invalid logical link handle (%d) in %s", |
| 515 | hciACLHeader.logLinkHandle, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 516 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 517 | |
| 518 | return VOS_STATUS_E_INVAL; |
| 519 | } |
| 520 | |
| 521 | /* Use the log_link_handle to retrieve the logical link context */ |
| 522 | /* JEZ081006: abstract this with a proc. So you can change the impl later */ |
| 523 | pLogLinkContext = &(pBtampCtx->btampLogLinkCtx[ hciACLHeader.logLinkHandle ]); |
| 524 | |
| 525 | // Sanity check the log_link_handle value |
| 526 | // JEZ081113: I changed this to fail on an UNOCCUPIED entry |
| 527 | if ( pLogLinkContext->present != VOS_TRUE) |
| 528 | { |
| 529 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, |
| 530 | "WLAN BAP: Invalid logical link entry in %s", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 531 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 532 | |
| 533 | return VOS_STATUS_E_INVAL; |
| 534 | } |
| 535 | |
| 536 | // Return the AC |
| 537 | |
| 538 | // Now copy the AC values from the Logical Link context |
| 539 | *pucAC = pLogLinkContext->btampAC; |
| 540 | |
| 541 | return VOS_STATUS_SUCCESS; |
| 542 | } |
| 543 | |
| 544 | /*=========================================================================== |
| 545 | |
| 546 | FUNCTION WLANBAP_XlateRxDataPkt |
| 547 | |
| 548 | DESCRIPTION |
| 549 | |
| 550 | HDD will call this API when it has received a 802.3 (TL/UMA has |
| 551 | Xlated from 802.11) frame from TL and it wants to form a |
| 552 | BT HCI Data Packet - ready to signal up to the BT stack application. |
| 553 | |
| 554 | |
| 555 | PARAMETERS |
| 556 | |
| 557 | btampHandle: The BT-AMP PAL handle returned in WLANBAP_GetNewHndl. |
| 558 | pucAC: Pointer to return the access category |
| 559 | vosDataBuff: The data buffer containing the 802.3 frame to be |
| 560 | translated to BT HCI Data Packet |
| 561 | |
| 562 | RETURN VALUE |
| 563 | |
| 564 | The result code associated with performing the operation |
| 565 | |
| 566 | VOS_STATUS_E_INVAL: Input parameters are invalid |
| 567 | VOS_STATUS_E_FAULT: BAP handle is NULL |
| 568 | VOS_STATUS_SUCCESS: Everything is good :) |
| 569 | |
| 570 | SIDE EFFECTS |
| 571 | |
| 572 | ============================================================================*/ |
| 573 | VOS_STATUS |
| 574 | WLANBAP_XlateRxDataPkt |
| 575 | ( |
| 576 | ptBtampHandle btampHandle, |
| 577 | v_U8_t phy_link_handle, /* Used by BAP to indentify the WLAN assoc. (StaId) */ |
| 578 | WLANTL_ACEnumType *pucAC, /* Return the AC here. I don't think this is needed */ |
| 579 | vos_pkt_t *vosDataBuff |
| 580 | ) |
| 581 | { |
| 582 | WLANBAP_8023HeaderType w8023Header; |
| 583 | WLANBAP_HCIACLHeaderType hciACLHeader; |
| 584 | v_U8_t aucLLCHeader[WLANBAP_LLC_HEADER_LEN]; |
| 585 | ptBtampContext pBtampCtx = (ptBtampContext) btampHandle; |
| 586 | VOS_STATUS vosStatus; |
| 587 | //v_PVOID_t pHddHdl; /* Handle to return BSL context in */ |
| 588 | v_U16_t hciDataLength; /* The HCI packet data length*/ |
| 589 | v_U16_t protoType = WLANBAP_BT_AMP_TYPE_DATA; /* The protocol type bytes*/ |
| 590 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 591 | |
| 592 | /*------------------------------------------------------------------------ |
| 593 | Sanity check params |
| 594 | ------------------------------------------------------------------------*/ |
| 595 | if ( NULL == pBtampCtx) |
| 596 | { |
| 597 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 598 | "Invalid BAP handle value in %s", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 599 | return VOS_STATUS_E_FAULT; |
| 600 | } |
| 601 | |
| 602 | // Here, I have to make the assumption that this is an |
| 603 | // 802.3 header followed by an LLC/SNAP packet. |
| 604 | vos_mem_set( &w8023Header, sizeof(w8023Header), 0 ); |
| 605 | vosStatus = vos_pkt_pop_head( vosDataBuff, &w8023Header, sizeof(w8023Header)); |
| 606 | |
| 607 | if ( VOS_STATUS_SUCCESS != vosStatus ) |
| 608 | { |
| 609 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, |
| 610 | "WLAN BAP: Failed to pop 802.3 header from packet %d", |
| 611 | vosStatus); |
| 612 | |
| 613 | return vosStatus; |
| 614 | } |
| 615 | |
| 616 | // Here, is that LLC/SNAP header. |
| 617 | // With the BT SIG OUI that I am being handed. |
| 618 | vos_mem_set( aucLLCHeader, WLANBAP_LLC_HEADER_LEN, 0 ); |
| 619 | vosStatus = vos_pkt_pop_head( vosDataBuff, aucLLCHeader, WLANBAP_LLC_HEADER_LEN); |
| 620 | |
| 621 | if ( VOS_STATUS_SUCCESS != vosStatus ) |
| 622 | { |
| 623 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, |
| 624 | "WLAN BAP: Failed to pop LLC/SNAP header from packet %d", |
| 625 | vosStatus); |
| 626 | |
| 627 | return vosStatus; |
| 628 | } |
| 629 | |
| 630 | #ifdef BAP_DEBUG |
| 631 | // JEZ081003: Remove this after debugging |
| 632 | // Should I double check that I am getting the BT SIG OUI ? |
| 633 | if ( !(vos_mem_compare( aucLLCHeader, |
| 634 | WLANBAP_LLC_HEADER, |
| 635 | sizeof(WLANBAP_LLC_HEADER) |
| 636 | - WLANBAP_LLC_OUI_SIZE) /* Don't check the last three bytes here */ |
| 637 | && vos_mem_compare( &aucLLCHeader[WLANBAP_LLC_OUI_OFFSET], |
| 638 | (v_VOID_t*)WLANBAP_BT_AMP_OUI, |
| 639 | WLANBAP_LLC_OUI_SIZE))) /* check them here */ |
| 640 | { |
| 641 | |
| 642 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 643 | "Invalid LLC header for BT-AMP packet in %s", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 644 | return VOS_STATUS_E_FAULT; |
| 645 | } |
| 646 | #endif //BAP_DEBUG |
| 647 | |
| 648 | /* Now adjust the protocol type bytes*/ |
| 649 | protoType = vos_cpu_to_be16( protoType); |
| 650 | // check if this is a data frame or other, internal to BAP, type... |
| 651 | // we are only handling data frames in here... |
| 652 | // The others (Security and AR) are handled by TLs BAP client API. |
| 653 | // (Verify with TL) |
| 654 | if ( !(vos_mem_compare( &aucLLCHeader[WLANBAP_LLC_PROTO_TYPE_OFFSET], |
| 655 | &protoType, //WLANBAP_BT_AMP_TYPE_DATA |
| 656 | WLANBAP_LLC_PROTO_TYPE_SIZE))) |
| 657 | { |
| 658 | |
| 659 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 660 | "Invalid (non-data) frame type in %s", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 661 | return VOS_STATUS_E_FAULT; |
| 662 | } |
| 663 | |
| 664 | #ifdef BAP_DEBUG |
| 665 | // JEZ081003: Remove this after debugging |
| 666 | /*------------------------------------------------------------------------ |
| 667 | Sanity check the MAC address in the physical link context |
| 668 | against the value in the incoming Rx Frame. |
| 669 | ------------------------------------------------------------------------*/ |
| 670 | if ( !(vos_mem_compare( w8023Header.vDA, pBtampCtx->self_mac_addr, VOS_MAC_ADDR_SIZE) |
| 671 | && vos_mem_compare( w8023Header.vSA, pBtampCtx->peer_mac_addr, VOS_MAC_ADDR_SIZE))) |
| 672 | { |
| 673 | |
| 674 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 675 | "MAC address mismatch in %s", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 676 | return VOS_STATUS_E_FAULT; |
| 677 | } |
| 678 | #endif //BAP_DEBUG |
| 679 | |
| 680 | /* No lookup is needed. Because TL has already told WLANBAP_STARxCB |
| 681 | * the StaId. And I told WLANBAP_STARxCBType the corresponding BSL context |
| 682 | * Which he used to lookup the phy_link_handle value. |
| 683 | */ |
| 684 | |
| 685 | |
| 686 | // Start filling in the HCI header |
| 687 | hciACLHeader.phyLinkHandle = phy_link_handle; |
| 688 | |
| 689 | // Continue filling in the HCI header |
| 690 | //JEZ100913: On Rx the Logical Link is ALWAYS 0. See Vol 2, Sec E, 5.4.2 of spec. |
| 691 | hciACLHeader.logLinkHandle = 0; |
| 692 | hciACLHeader.PBFlag = WLANBAP_HCI_PKT_AMP; |
| 693 | hciACLHeader.BCFlag = 0; |
| 694 | |
| 695 | /* Now the length field is big-endian?! */ |
| 696 | hciDataLength = vos_be16_to_cpu(w8023Header.usLenType); |
| 697 | /* Max length WLANBAP_MAX_80211_PAL_PDU_SIZE (1492) */ |
| 698 | hciDataLength -= WLANBAP_LLC_HEADER_LEN; |
| 699 | /* The HCI packet data length is Little-endian */ |
| 700 | hciACLHeader.dataLength = vos_cpu_to_le16(hciDataLength); |
| 701 | |
| 702 | /* Return the AC here. |
| 703 | * (I can't because there is no way to figure out what it is.) |
| 704 | */ |
| 705 | *pucAC = 0; |
| 706 | |
| 707 | /* Push on the HCI header */ |
| 708 | vos_pkt_push_head(vosDataBuff, &hciACLHeader, WLANBAP_HCI_ACL_HEADER_LEN); |
| 709 | |
| 710 | return VOS_STATUS_SUCCESS; |
| 711 | } /* WLANBAP_XlateRxDataPkt */ |
| 712 | |
| 713 | /*---------------------------------------------------------------------------- |
| 714 | |
| 715 | FUNCTION WLANBAP_STAFetchPktCB |
| 716 | |
| 717 | DESCRIPTION |
| 718 | The fetch packet callback registered with TL. |
| 719 | |
| 720 | It is called by the TL when the scheduling algorithms allows for |
| 721 | transmission of another packet to the module. |
| 722 | It will be called in the context of the BAL fetch transmit packet |
| 723 | function, initiated by the bus lower layer. |
| 724 | |
| 725 | |
| 726 | PARAMETERS |
| 727 | |
| 728 | IN |
| 729 | pvosGCtx: pointer to the global vos context; a handle |
| 730 | to TL's or HDD's control block can be extracted |
| 731 | from its context |
| 732 | |
| 733 | IN/OUT |
| 734 | pucSTAId: the Id of the station for which TL is requesting a |
| 735 | packet, in case HDD does not maintain per station |
| 736 | queues it can give the next packet in its queue |
| 737 | and put in the right value for the |
| 738 | pucAC: access category requested by TL, if HDD does not have |
| 739 | packets on this AC it can choose to service another AC |
| 740 | queue in the order of priority |
| 741 | |
| 742 | OUT |
| 743 | vosDataBuff: pointer to the VOSS data buffer that was transmitted |
| 744 | tlMetaInfo: meta info related to the data frame |
| 745 | |
| 746 | |
| 747 | |
| 748 | RETURN VALUE |
| 749 | The result code associated with performing the operation |
| 750 | |
| 751 | ----------------------------------------------------------------------------*/ |
| 752 | VOS_STATUS |
| 753 | WLANBAP_STAFetchPktCB |
| 754 | ( |
| 755 | v_PVOID_t pvosGCtx, |
| 756 | v_U8_t* pucSTAId, |
| 757 | v_U8_t ucAC, |
| 758 | vos_pkt_t** vosDataBuff, |
| 759 | WLANTL_MetaInfoType* tlMetaInfo |
| 760 | ) |
| 761 | { |
| 762 | VOS_STATUS vosStatus; |
| 763 | ptBtampHandle bapHdl; /* holds ptBtampHandle value returned */ |
| 764 | ptBtampContext bapContext; /* Holds the btampContext value returned */ |
| 765 | v_PVOID_t pHddHdl; /* Handle to return BSL context in */ |
| 766 | |
| 767 | /* Lookup the BSL and BAP contexts using the StaId */ |
| 768 | |
| 769 | vosStatus = WLANBAP_GetCtxFromStaId ( |
| 770 | *pucSTAId, /* The StaId (used by TL, PE, and HAL) */ |
| 771 | &bapHdl, /* "handle" to return ptBtampHandle value in */ |
| 772 | &bapContext, /* "handle" to return ptBtampContext value in */ |
| 773 | &pHddHdl); /* "handle" to return BSL context in */ |
| 774 | if ( VOS_STATUS_SUCCESS != vosStatus ) |
| 775 | { |
| 776 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO, |
| 777 | "Unable to retrieve BSL or BAP context from STA Id in WLANBAP_STAFetchPktCB"); |
| 778 | return VOS_STATUS_E_FAULT; |
| 779 | } |
| 780 | |
| 781 | /* Invoke the callback that BSL registered with me */ |
| 782 | vosStatus = (*bapContext->pfnBtampFetchPktCB)( |
| 783 | pHddHdl, |
| 784 | (WLANTL_ACEnumType) ucAC, /* typecast it for now */ |
| 785 | vosDataBuff, |
| 786 | tlMetaInfo); |
| 787 | if ( VOS_STATUS_SUCCESS != vosStatus ) |
| 788 | { |
| 789 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO, |
| 790 | "Callback registered by BSL failed to fetch pkt in WLANNBAP_STAFetchPktCB"); |
| 791 | return VOS_STATUS_E_FAULT; |
| 792 | } |
| 793 | |
| 794 | return vosStatus; |
| 795 | } /* WLANBAP_STAFetchPktCB */ |
| 796 | |
| 797 | /*---------------------------------------------------------------------------- |
| 798 | |
| 799 | FUNCTION WLANBAP_STARxCB |
| 800 | |
| 801 | DESCRIPTION |
| 802 | The receive callback registered with TL. |
| 803 | |
| 804 | TL will call this to notify the client when a packet was received |
| 805 | for a registered STA. |
| 806 | |
| 807 | PARAMETERS |
| 808 | |
| 809 | IN |
| 810 | pvosGCtx: pointer to the global vos context; a handle to |
| 811 | TL's or HDD's control block can be extracted from |
| 812 | its context |
| 813 | vosDataBuff: pointer to the VOSS data buffer that was received |
| 814 | (it may be a linked list) |
| 815 | ucSTAId: station id |
| 816 | pRxMetaInfo: meta info for the received packet(s) |
| 817 | |
| 818 | RETURN VALUE |
| 819 | The result code associated with performing the operation |
| 820 | |
| 821 | ----------------------------------------------------------------------------*/ |
| 822 | VOS_STATUS |
| 823 | WLANBAP_STARxCB |
| 824 | ( |
| 825 | v_PVOID_t pvosGCtx, |
| 826 | vos_pkt_t* vosDataBuff, |
| 827 | v_U8_t ucSTAId, |
| 828 | WLANTL_RxMetaInfoType* pRxMetaInfo |
| 829 | ) |
| 830 | { |
| 831 | VOS_STATUS vosStatus; |
| 832 | ptBtampHandle bapHdl; /* holds ptBtampHandle value returned */ |
| 833 | ptBtampContext bapContext; /* Holds the btampContext value returned */ |
| 834 | v_PVOID_t pHddHdl; /* Handle to return BSL context in */ |
| 835 | ptBtampHandle btampHandle; |
| 836 | WLANBAP_8023HeaderType w8023Header; |
| 837 | v_U8_t aucLLCHeader[WLANBAP_LLC_HEADER_LEN]; |
| 838 | v_U16_t protoType ; |
| 839 | v_SIZE_t llcHeaderLen = WLANBAP_LLC_HEADER_LEN ; |
| 840 | |
| 841 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO, |
| 842 | "In WLANBAP_STARxCB"); |
| 843 | |
| 844 | /* Lookup the BSL and BAP contexts using the StaId */ |
| 845 | |
| 846 | vosStatus = WLANBAP_GetCtxFromStaId ( |
| 847 | ucSTAId, /* The StaId (used by TL, PE, and HAL) */ |
| 848 | &bapHdl, /* "handle" to return ptBtampHandle value in */ |
| 849 | &bapContext, /* "handle" to return ptBtampContext value in */ |
| 850 | &pHddHdl); /* "handle" to return BSL context in */ |
| 851 | if ( VOS_STATUS_SUCCESS != vosStatus ) |
| 852 | { |
| 853 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO, |
| 854 | "Unable to retrieve BSL or BAP context from STA Id in WLANBAP_STARxCB"); |
| 855 | /* Drop packet */ |
| 856 | vos_pkt_return_packet(vosDataBuff); |
| 857 | return VOS_STATUS_E_FAULT; |
| 858 | } |
| 859 | |
| 860 | |
| 861 | vosStatus = vos_pkt_extract_data( vosDataBuff, sizeof(w8023Header), (v_VOID_t *)aucLLCHeader, |
| 862 | &llcHeaderLen); |
| 863 | |
| 864 | if ( NULL == aucLLCHeader/*LLC Header*/ ) |
| 865 | { |
| 866 | VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 867 | "WLANBAP_STARxCB:Cannot extract LLC header"); |
| 868 | /* Drop packet */ |
| 869 | vos_pkt_return_packet(vosDataBuff); |
| 870 | return VOS_STATUS_E_FAULT; |
| 871 | } |
| 872 | |
| 873 | vos_mem_copy(&protoType,&aucLLCHeader[WLANBAP_LLC_PROTO_TYPE_OFFSET],WLANBAP_LLC_PROTO_TYPE_SIZE); |
| 874 | protoType = vos_be16_to_cpu(protoType); |
| 875 | |
| 876 | VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 877 | "%s: received : %d, => BAP",__func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 878 | protoType); |
| 879 | |
| 880 | if(WLANBAP_BT_AMP_TYPE_DATA == protoType) |
| 881 | { |
| 882 | if (bapContext->bapLinkSupervisionTimerInterval) |
| 883 | { |
| 884 | /* Reset Link Supervision timer */ |
| 885 | //vosStatus = WLANBAP_StopLinkSupervisionTimer(bapContext); |
| 886 | //vosStatus = WLANBAP_StartLinkSupervisionTimer(bapContext,7000); |
| 887 | bapContext->dataPktPending = VOS_TRUE;//Indication for LinkSupervision module that data is pending |
| 888 | /* Invoke the callback that BSL registered with me */ |
| 889 | vosStatus = (*bapContext->pfnBtamp_STARxCB)( |
| 890 | pHddHdl, |
| 891 | vosDataBuff, |
| 892 | pRxMetaInfo); |
| 893 | } |
| 894 | else |
| 895 | { |
| 896 | VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL, |
| 897 | "WLANBAP_STARxCB:bapLinkSupervisionTimerInterval is 0"); |
| 898 | /* Drop packet */ |
| 899 | vos_pkt_return_packet(vosDataBuff); |
| 900 | } |
| 901 | } |
| 902 | else |
| 903 | { |
| 904 | VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 905 | "%s: link Supervision packet received over TL: %d, => BAP", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 906 | __func__,protoType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 907 | btampHandle = (ptBtampHandle)bapContext; |
| 908 | vosStatus = WLANBAP_RxProcLsPkt( |
| 909 | btampHandle, |
| 910 | bapContext->phy_link_handle, |
| 911 | protoType, |
| 912 | vosDataBuff |
| 913 | ); |
| 914 | } |
| 915 | |
| 916 | return vosStatus; |
| 917 | } /* WLANBAP_STARxCB */ |
| 918 | |
| 919 | |
| 920 | /*---------------------------------------------------------------------------- |
| 921 | |
| 922 | FUNCTION WLANBAP_TxCompCB |
| 923 | |
| 924 | DESCRIPTION |
| 925 | The tx complete callback registered with TL. |
| 926 | |
| 927 | TL will call this to notify the client when a transmission for a |
| 928 | packet has ended. |
| 929 | |
| 930 | PARAMETERS |
| 931 | |
| 932 | IN |
| 933 | pvosGCtx: pointer to the global vos context; a handle to |
| 934 | TL/HAL/PE/BAP/HDD control block can be extracted from |
| 935 | its context |
| 936 | vosDataBuff: pointer to the VOSS data buffer that was transmitted |
| 937 | wTxSTAtus: status of the transmission |
| 938 | |
| 939 | |
| 940 | RETURN VALUE |
| 941 | The result code associated with performing the operation |
| 942 | |
| 943 | ----------------------------------------------------------------------------*/ |
| 944 | VOS_STATUS |
| 945 | WLANBAP_TxCompCB |
| 946 | ( |
| 947 | v_PVOID_t pvosGCtx, |
| 948 | vos_pkt_t* vosDataBuff, |
| 949 | VOS_STATUS wTxSTAtus |
| 950 | ) |
| 951 | { |
Arun Kumar Khandavalli | 2dadb37 | 2014-02-17 17:09:20 +0530 | [diff] [blame] | 952 | VOS_STATUS vosStatus; |
| 953 | ptBtampHandle bapHdl; /* holds ptBtampHandle value returned */ |
| 954 | ptBtampContext bapContext; /* Holds the btampContext value returned */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 955 | v_PVOID_t pHddHdl; /* Handle to return BSL context in */ |
| 956 | v_PVOID_t pvlogLinkHandle = NULL; |
Arun Kumar Khandavalli | 2dadb37 | 2014-02-17 17:09:20 +0530 | [diff] [blame] | 957 | uintptr_t value; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 958 | |
| 959 | WLANBAP_HCIACLHeaderType hciACLHeader; |
| 960 | |
| 961 | /* retrieve the BSL and BAP contexts */ |
| 962 | |
| 963 | /* I don't really know how to do this - in the general case. */ |
| 964 | /* So, for now, I will just use something that works. */ |
| 965 | /* (In general, I will have to keep a list of the outstanding transmit */ |
| 966 | /* buffers, in order to determine which assoc they are with.) */ |
| 967 | //vosStatus = WLANBAP_GetCtxFromStaId ( |
| 968 | // ucSTAId, /* The StaId (used by TL, PE, and HAL) */ |
| 969 | // &bapHdl, /* "handle" to return ptBtampHandle value in */ |
| 970 | // &bapContext, /* "handle" to return ptBtampContext value in */ |
| 971 | // &pHddHdl); /* "handle" to return BSL context in */ |
| 972 | /* Temporarily we do the following*/ |
| 973 | //bapHdl = &btampCtx; |
| 974 | bapHdl = (v_PVOID_t)gpBtampCtx; |
| 975 | /* Typecast the handle into a context. Works as we have only one link*/ |
| 976 | bapContext = ((ptBtampContext) bapHdl); |
| 977 | |
| 978 | /*------------------------------------------------------------------------ |
| 979 | Sanity check params |
| 980 | ------------------------------------------------------------------------*/ |
| 981 | if ( NULL == vosDataBuff) |
| 982 | { |
| 983 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 984 | "Invalid vosDataBuff value in %s", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 985 | return VOS_STATUS_E_FAULT; |
| 986 | } |
| 987 | |
| 988 | if ( NULL == bapContext) |
| 989 | { |
| 990 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 991 | "Invalid bapContext value in %s", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 992 | vos_pkt_return_packet( vosDataBuff ); |
| 993 | return VOS_STATUS_E_FAULT; |
| 994 | } |
| 995 | |
| 996 | pHddHdl = bapContext->pHddHdl; |
| 997 | vosStatus = VOS_STATUS_SUCCESS; |
| 998 | if ( VOS_STATUS_SUCCESS != vosStatus ) |
| 999 | { |
| 1000 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO, |
| 1001 | "Unable to retrieve BSL or BAP context from STA Id in WLANBAP_TxCompCB"); |
| 1002 | vos_pkt_return_packet( vosDataBuff ); |
| 1003 | return VOS_STATUS_E_FAULT; |
| 1004 | } |
| 1005 | |
| 1006 | /*Get the logical link handle from the vos user data*/ |
| 1007 | vos_pkt_get_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_BAP, |
| 1008 | &pvlogLinkHandle); |
| 1009 | |
Arun Kumar Khandavalli | 2dadb37 | 2014-02-17 17:09:20 +0530 | [diff] [blame] | 1010 | value = (uintptr_t)pvlogLinkHandle; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1011 | hciACLHeader.logLinkHandle = value; |
| 1012 | |
| 1013 | #ifdef BAP_DEBUG |
| 1014 | /* Trace the bapContext referenced. */ |
| 1015 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, |
Jeff Johnson | 2bbc029 | 2017-09-19 08:38:56 -0700 | [diff] [blame] | 1016 | "WLAN BAP Context Monitor: bapContext value = %pK in %s:%d. vosDataBuff=%pK", bapContext, __func__, __LINE__, vosDataBuff ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1017 | #endif //BAP_DEBUG |
| 1018 | |
| 1019 | // Sanity check the log_link_handle value |
| 1020 | // JEZ100722: Temporary changes. |
| 1021 | if (BTAMP_VALID_LOG_LINK( hciACLHeader.logLinkHandle)) |
| 1022 | { |
| 1023 | vos_atomic_increment_U32( |
| 1024 | &bapContext->btampLogLinkCtx[hciACLHeader.logLinkHandle].uTxPktCompleted); |
| 1025 | // &bapContext->btampLogLinkCtx[0].uTxPktCompleted); |
| 1026 | // vos_atomic_increment_U32( |
| 1027 | // &bapContext->btampLogLinkCtx[1].uTxPktCompleted); |
| 1028 | } else |
| 1029 | { |
| 1030 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1031 | "In %s:%d: Invalid logical link handle: %d", __func__, __LINE__, hciACLHeader.logLinkHandle); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1032 | } |
| 1033 | |
| 1034 | /* Invoke the callback that BSL registered with me */ |
| 1035 | vosStatus = (*bapContext->pfnBtampTxCompCB)( |
| 1036 | pHddHdl, |
| 1037 | vosDataBuff, |
| 1038 | wTxSTAtus); |
| 1039 | |
| 1040 | return vosStatus; |
| 1041 | } /* WLANBAP_TxCompCB */ |
| 1042 | |
| 1043 | /*========================================================================== |
| 1044 | |
| 1045 | FUNCTION WLANBAP_RegisterDataPlane |
| 1046 | |
| 1047 | DESCRIPTION |
| 1048 | The HDD calls this routine to register the "data plane" routines |
| 1049 | for Tx, Rx, and Tx complete with BT-AMP. For now, with only one |
| 1050 | physical association supported at a time, this COULD be called |
| 1051 | by HDD at the same time as WLANBAP_GetNewHndl. But, in general |
| 1052 | it needs to be called upon each new physical link establishment. |
| 1053 | |
| 1054 | This registration is really two part. The routines themselves are |
| 1055 | registered here. But, the mapping between the BSL context and the |
| 1056 | actual physical link takes place during WLANBAP_PhysicalLinkCreate. |
| 1057 | |
| 1058 | DEPENDENCIES |
| 1059 | |
| 1060 | PARAMETERS |
| 1061 | |
| 1062 | IN |
| 1063 | btampHandle: The BT-AMP PAL handle returned in WLANBAP_GetNewHndl. |
| 1064 | |
| 1065 | RETURN VALUE |
| 1066 | The result code associated with performing the operation |
| 1067 | |
| 1068 | VOS_STATUS_E_FAULT: pointer to BAP cb is NULL ; access would cause a page |
| 1069 | fault |
| 1070 | VOS_STATUS_SUCCESS: Everything is good :) |
| 1071 | |
| 1072 | SIDE EFFECTS |
| 1073 | |
| 1074 | ============================================================================*/ |
| 1075 | VOS_STATUS |
| 1076 | WLANBAP_RegisterDataPlane |
| 1077 | ( |
| 1078 | ptBtampHandle btampHandle, /* BTAMP context */ |
| 1079 | WLANBAP_STAFetchPktCBType pfnBtampFetchPktCB, |
| 1080 | WLANBAP_STARxCBType pfnBtamp_STARxCB, |
| 1081 | WLANBAP_TxCompCBType pfnBtampTxCompCB, |
| 1082 | // phy_link_handle, of course, doesn't come until much later. At Physical Link create. |
| 1083 | v_PVOID_t pHddHdl /* BSL specific context */ |
| 1084 | ) |
| 1085 | { |
| 1086 | ptBtampContext pBtampCtx = (ptBtampContext) btampHandle; |
| 1087 | |
| 1088 | |
| 1089 | /*------------------------------------------------------------------------ |
| 1090 | Sanity check params |
| 1091 | ------------------------------------------------------------------------*/ |
| 1092 | if ( NULL == pBtampCtx) |
| 1093 | { |
| 1094 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, |
| 1095 | "Invalid BAP handle value in WLANBAP_RegisterDataPlane"); |
| 1096 | return VOS_STATUS_E_FAULT; |
| 1097 | } |
| 1098 | |
| 1099 | // Include the HDD BAP Shim Layer callbacks for Fetch, TxComp, and RxPkt |
| 1100 | pBtampCtx->pfnBtampFetchPktCB = pfnBtampFetchPktCB; |
| 1101 | pBtampCtx->pfnBtamp_STARxCB = pfnBtamp_STARxCB; |
| 1102 | pBtampCtx->pfnBtampTxCompCB = pfnBtampTxCompCB; |
| 1103 | |
| 1104 | // (Right now, there is only one) |
| 1105 | pBtampCtx->pHddHdl = pHddHdl; |
| 1106 | /* Set the default data transfer mode */ |
| 1107 | pBtampCtx->ucDataTrafficMode = WLANBAP_FLOW_CONTROL_MODE_BLOCK_BASED; |
| 1108 | |
| 1109 | return VOS_STATUS_SUCCESS; |
| 1110 | } /* WLANBAP_RegisterDataPlane */ |
| 1111 | |
| 1112 | |
| 1113 | /*=========================================================================== |
| 1114 | |
| 1115 | FUNCTION WLANBAP_STAPktPending |
| 1116 | |
| 1117 | DESCRIPTION |
| 1118 | |
| 1119 | HDD will call this API when a packet is pending transmission in its |
| 1120 | queues. HDD uses this instead of WLANTL_STAPktPending because he is |
| 1121 | not aware of the mapping from session to STA ID. |
| 1122 | |
| 1123 | DEPENDENCIES |
| 1124 | |
| 1125 | HDD must have called WLANBAP_GetNewHndl before calling this API. |
| 1126 | |
| 1127 | PARAMETERS |
| 1128 | |
| 1129 | btampHandle: The BT-AMP PAL handle returned in WLANBAP_GetNewHndl. |
| 1130 | BSL can obtain this from the physical handle value in the |
| 1131 | downgoing HCI Data Packet. He, after all, was there |
| 1132 | when the PhysicalLink was created. He knew the btampHandle |
| 1133 | value returned by WLANBAP_GetNewHndl. He knows as well, his |
| 1134 | own pHddHdl (see next). |
| 1135 | phy_link_handle: Used by BAP to indentify the WLAN assoc. (StaId) |
| 1136 | ucAc: The access category for the pending frame |
| 1137 | |
| 1138 | RETURN VALUE |
| 1139 | |
| 1140 | The result code associated with performing the operation |
| 1141 | |
| 1142 | VOS_STATUS_E_INVAL: Input parameters are invalid |
| 1143 | VOS_STATUS_E_FAULT: BAP handle is NULL |
| 1144 | VOS_STATUS_SUCCESS: Everything is good :) |
| 1145 | |
| 1146 | SIDE EFFECTS |
| 1147 | |
| 1148 | ============================================================================*/ |
| 1149 | VOS_STATUS |
| 1150 | WLANBAP_STAPktPending |
| 1151 | ( |
| 1152 | ptBtampHandle btampHandle, /* Used by BAP to identify the app context and VOSS ctx (!?) */ |
| 1153 | v_U8_t phy_link_handle, /* Used by BAP to indentify the WLAN assoc. (StaId) */ |
| 1154 | WLANTL_ACEnumType ucAc /* This is the first instance of a TL type in bapApi.h */ |
| 1155 | ) |
| 1156 | { |
| 1157 | VOS_STATUS vosStatus; |
| 1158 | ptBtampContext pBtampCtx = (ptBtampContext) btampHandle; |
| 1159 | v_PVOID_t pvosGCtx; |
| 1160 | v_U8_t ucSTAId; /* The StaId (used by TL, PE, and HAL) */ |
| 1161 | v_PVOID_t pHddHdl; /* Handle to return BSL context in */ |
| 1162 | |
| 1163 | |
| 1164 | #ifdef BAP_DEBUG |
| 1165 | /* Trace the tBtampCtx being passed in. */ |
| 1166 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, |
Jeff Johnson | 2bbc029 | 2017-09-19 08:38:56 -0700 | [diff] [blame] | 1167 | "WLAN BAP Context Monitor: pBtampCtx value = %pK in %s:%d", pBtampCtx, __func__, __LINE__ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1168 | #endif //BAP_DEBUG |
| 1169 | |
| 1170 | /*------------------------------------------------------------------------ |
| 1171 | Sanity check params |
| 1172 | ------------------------------------------------------------------------*/ |
| 1173 | if ( NULL == pBtampCtx) |
| 1174 | { |
| 1175 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, |
| 1176 | "Invalid BAP handle value in WLANBAP_STAPktPending"); |
| 1177 | return VOS_STATUS_E_FAULT; |
| 1178 | } |
| 1179 | |
| 1180 | // Retrieve the VOSS context |
| 1181 | pvosGCtx = pBtampCtx->pvosGCtx; |
| 1182 | |
| 1183 | /* Lookup the StaId using the phy_link_handle and the BAP context */ |
| 1184 | |
| 1185 | vosStatus = WLANBAP_GetStaIdFromLinkCtx ( |
| 1186 | btampHandle, /* btampHandle value in */ |
| 1187 | phy_link_handle, /* phy_link_handle value in */ |
| 1188 | &ucSTAId, /* The StaId (used by TL, PE, and HAL) */ |
| 1189 | &pHddHdl); /* Handle to return BSL context */ |
| 1190 | if ( VOS_STATUS_SUCCESS != vosStatus ) |
| 1191 | { |
| 1192 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO, |
| 1193 | "Unable to retrieve STA Id from BAP context and phy_link_handle in WLANBAP_STAPktPending"); |
| 1194 | return VOS_STATUS_E_FAULT; |
| 1195 | } |
| 1196 | |
| 1197 | |
| 1198 | // Let TL know we have a packet to send... |
| 1199 | vosStatus = WLANTL_STAPktPending( |
| 1200 | pvosGCtx, |
| 1201 | ucSTAId, |
| 1202 | ucAc); |
| 1203 | if ( VOS_STATUS_SUCCESS != vosStatus ) |
| 1204 | { |
| 1205 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, |
| 1206 | "Tx: Packet rejected by TL in WLANBAP_STAPktPending"); |
| 1207 | return vosStatus; |
| 1208 | } |
| 1209 | pBtampCtx->dataPktPending = VOS_TRUE;//Indication for LinkSupervision module that data is pending |
| 1210 | return VOS_STATUS_SUCCESS; |
| 1211 | } /* WLANBAP_STAPktPending */ |
| 1212 | |
| 1213 | /*---------------------------------------------------------------------------- |
| 1214 | |
| 1215 | FUNCTION WLAN_BAPRegisterBAPCallbacks() |
| 1216 | |
| 1217 | DESCRIPTION |
| 1218 | Register the BAP "Event" callbacks. |
| 1219 | Return the per instance handle. |
| 1220 | |
| 1221 | DEPENDENCIES |
| 1222 | NA. |
| 1223 | |
| 1224 | PARAMETERS |
| 1225 | |
| 1226 | IN |
| 1227 | btampHandle: The BT-AMP PAL handle returned in WLANBAP_GetNewHndl. |
| 1228 | pBapHCIEventCB: pointer to the Event callback |
| 1229 | pAppHdl: The context passed in by caller. (I.E., BSL app specific context.) |
| 1230 | |
| 1231 | |
| 1232 | RETURN VALUE |
| 1233 | The result code associated with performing the operation |
| 1234 | |
| 1235 | VOS_STATUS_E_FAULT: pointer to pBapHCIEventCB is NULL |
| 1236 | VOS_STATUS_SUCCESS: Success |
| 1237 | |
| 1238 | SIDE EFFECTS |
| 1239 | |
| 1240 | ----------------------------------------------------------------------------*/ |
| 1241 | VOS_STATUS |
| 1242 | WLAN_BAPRegisterBAPCallbacks |
| 1243 | ( |
| 1244 | ptBtampHandle btampHandle, /* BSL uses my handle to talk to me */ |
| 1245 | /* Returned from WLANBAP_GetNewHndl() */ |
| 1246 | /* It's like each of us is using the other */ |
| 1247 | /* guys reference when invoking him. */ |
| 1248 | tpWLAN_BAPEventCB pBapHCIEventCB, /*Implements the callback for ALL asynchronous events. */ |
| 1249 | v_PVOID_t pAppHdl // Per-app BSL context |
| 1250 | ) |
| 1251 | { |
| 1252 | ptBtampContext pBtampCtx = (ptBtampContext) btampHandle; |
| 1253 | |
| 1254 | |
| 1255 | /*------------------------------------------------------------------------ |
| 1256 | Sanity check params |
| 1257 | ------------------------------------------------------------------------*/ |
| 1258 | if ( NULL == pBtampCtx) |
| 1259 | { |
| 1260 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, |
| 1261 | "Invalid BAP handle value in WLAN_BAPRegisterBAPCallbacks"); |
| 1262 | return VOS_STATUS_E_FAULT; |
| 1263 | } |
| 1264 | |
| 1265 | // Save the Event callback |
| 1266 | pBtampCtx->pBapHCIEventCB = pBapHCIEventCB; |
| 1267 | |
| 1268 | // (Right now, there is only one) |
| 1269 | pBtampCtx->pAppHdl = pAppHdl; |
| 1270 | |
| 1271 | return VOS_STATUS_SUCCESS; |
| 1272 | } /* WLAN_BAPRegisterBAPCallbacks */ |
| 1273 | |
| 1274 | |