Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 2 | * 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 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 T i m e r . C |
| 31 | |
| 32 | OVERVIEW: |
| 33 | |
| 34 | This software unit holds the implementation of the timer routines |
| 35 | required by the WLAN BAP module. |
| 36 | |
| 37 | The functions provide by this module are called by the rest of |
| 38 | the BT-AMP PAL module. |
| 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: /home/labuser/btamp-label9/CORE/BAP/src/bapApiTimer.c,v 1.5 2010/09/04 00:14:37 labuser Exp labuser $$DateTime$$Author: labuser $ |
| 57 | |
| 58 | |
| 59 | when who what, where, why |
| 60 | ---------- --- -------------------------------------------------------- |
| 61 | 2008-10-23 jez Created module |
| 62 | |
| 63 | ===========================================================================*/ |
| 64 | |
| 65 | /*---------------------------------------------------------------------------- |
| 66 | * Include Files |
| 67 | * -------------------------------------------------------------------------*/ |
| 68 | // I think this pulls in everything |
| 69 | #include "vos_types.h" |
| 70 | #include "bapApiTimer.h" |
| 71 | |
| 72 | //#define BAP_DEBUG |
| 73 | |
| 74 | /*---------------------------------------------------------------------------- |
| 75 | * Preprocessor Definitions and Constants |
| 76 | * -------------------------------------------------------------------------*/ |
| 77 | #define WLAN_BAP_TX_PKT_MONITOR_TIME 100 |
| 78 | |
| 79 | /*---------------------------------------------------------------------------- |
| 80 | * Type Declarations |
| 81 | * -------------------------------------------------------------------------*/ |
| 82 | |
| 83 | /*---------------------------------------------------------------------------- |
| 84 | * Global Data Definitions |
| 85 | * -------------------------------------------------------------------------*/ |
| 86 | |
| 87 | /*---------------------------------------------------------------------------- |
| 88 | * External declarations for global context |
| 89 | * -------------------------------------------------------------------------*/ |
| 90 | #if 1 |
| 91 | //*BT-AMP packet LLC OUI value*/ |
| 92 | static const v_U8_t WLANBAP_BT_AMP_OUI[] = {0x00, 0x19, 0x58 }; |
| 93 | |
| 94 | #endif |
| 95 | |
| 96 | /*---------------------------------------------------------------------------- |
| 97 | * Static Variable Definitions |
| 98 | * -------------------------------------------------------------------------*/ |
| 99 | |
| 100 | /*---------------------------------------------------------------------------- |
| 101 | * Static Function Declarations and Definitions |
| 102 | * -------------------------------------------------------------------------*/ |
| 103 | |
| 104 | /*---------------------------------------------------------------------------- |
| 105 | * Externalized Function Definitions |
| 106 | * -------------------------------------------------------------------------*/ |
| 107 | |
| 108 | /*---------------------------------------------------------------------------- |
| 109 | * Function Declarations and Documentation |
| 110 | * -------------------------------------------------------------------------*/ |
| 111 | |
| 112 | /*---------------------------------------------------------------------------- |
| 113 | * Utility Function implementations |
| 114 | * -------------------------------------------------------------------------*/ |
| 115 | |
| 116 | /*========================================================================== |
| 117 | |
| 118 | FUNCTION WLANBAP_InitConnectionAcceptTimer |
| 119 | |
| 120 | DESCRIPTION |
| 121 | Initialize the Connection Accept Timer. |
| 122 | |
| 123 | DEPENDENCIES |
| 124 | |
| 125 | PARAMETERS |
| 126 | |
| 127 | IN |
| 128 | pBtampCtx: pointer to the BAP control block |
| 129 | |
| 130 | RETURN VALUE |
| 131 | The result code associated with performing the operation |
| 132 | |
| 133 | VOS_STATUS_E_FAULT: access would cause a page fault |
| 134 | VOS_STATUS_SUCCESS: Everything is good :) |
| 135 | |
| 136 | SIDE EFFECTS |
| 137 | |
| 138 | ============================================================================*/ |
| 139 | VOS_STATUS |
| 140 | WLANBAP_InitConnectionAcceptTimer |
| 141 | ( |
| 142 | ptBtampContext pBtampCtx |
| 143 | ) |
| 144 | { |
| 145 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
| 146 | |
| 147 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 148 | |
| 149 | |
| 150 | /*------------------------------------------------------------------------ |
| 151 | Sanity check BAP control block |
| 152 | ------------------------------------------------------------------------*/ |
| 153 | |
| 154 | if ( NULL == pBtampCtx ) |
| 155 | { |
| 156 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 157 | "Invalid BAP pointer in %s", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 158 | return VOS_STATUS_E_FAULT; |
| 159 | } |
| 160 | |
| 161 | /*Initialize the timer */ |
| 162 | vosStatus = vos_timer_init( |
| 163 | &pBtampCtx->bapConnectionAcceptTimer, |
| 164 | VOS_TIMER_TYPE_SW, /* use this type */ |
| 165 | WLANBAP_ConnectionAcceptTimerHandler, |
| 166 | pBtampCtx); |
| 167 | |
| 168 | return VOS_STATUS_SUCCESS; |
| 169 | }/* WLANBAP_InitConnectionAcceptTimer */ |
| 170 | |
| 171 | /*========================================================================== |
| 172 | |
| 173 | FUNCTION WLANBAP_DeinitConnectionAcceptTimer |
| 174 | |
| 175 | DESCRIPTION |
| 176 | Destroy the Connection Accept Timer. |
| 177 | |
| 178 | DEPENDENCIES |
| 179 | |
| 180 | PARAMETERS |
| 181 | |
| 182 | IN |
| 183 | pBtampCtx: pointer to the BAP control block |
| 184 | |
| 185 | RETURN VALUE |
| 186 | The result code associated with performing the operation |
| 187 | |
| 188 | VOS_STATUS_E_FAULT: access would cause a page fault |
| 189 | VOS_STATUS_SUCCESS: Everything is good :) |
| 190 | |
| 191 | SIDE EFFECTS |
| 192 | |
| 193 | ============================================================================*/ |
| 194 | VOS_STATUS |
| 195 | WLANBAP_DeinitConnectionAcceptTimer |
| 196 | ( |
| 197 | ptBtampContext pBtampCtx |
| 198 | ) |
| 199 | { |
| 200 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
| 201 | |
| 202 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 203 | |
| 204 | |
| 205 | /*------------------------------------------------------------------------ |
| 206 | Sanity check BAP control block |
| 207 | ------------------------------------------------------------------------*/ |
| 208 | |
| 209 | if ( NULL == pBtampCtx ) |
| 210 | { |
| 211 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 212 | "Invalid BAP pointer in %s", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 213 | return VOS_STATUS_E_FAULT; |
| 214 | } |
| 215 | |
| 216 | /*Initialize and then Start the timer */ |
| 217 | vosStatus = vos_timer_destroy ( |
| 218 | &pBtampCtx->bapConnectionAcceptTimer ); |
| 219 | |
| 220 | return VOS_STATUS_SUCCESS; |
| 221 | }/* WLANBAP_DeinitConnectionAcceptTimer */ |
| 222 | |
| 223 | /*========================================================================== |
| 224 | |
| 225 | FUNCTION WLANBAP_StartConnectionAcceptTimer |
| 226 | |
| 227 | DESCRIPTION |
| 228 | Start the Connection Accept Timer. |
| 229 | |
| 230 | DEPENDENCIES |
| 231 | |
| 232 | PARAMETERS |
| 233 | |
| 234 | IN |
| 235 | pBtampCtx: pointer to the BAP control block |
| 236 | interval: time interval. |
| 237 | |
| 238 | RETURN VALUE |
| 239 | The result code associated with performing the operation |
| 240 | |
| 241 | VOS_STATUS_E_FAULT: access would cause a page fault |
| 242 | VOS_STATUS_SUCCESS: Everything is good :) |
| 243 | |
| 244 | SIDE EFFECTS |
| 245 | |
| 246 | ============================================================================*/ |
| 247 | VOS_STATUS |
| 248 | WLANBAP_StartConnectionAcceptTimer |
| 249 | ( |
| 250 | ptBtampContext pBtampCtx, |
| 251 | v_U32_t interval |
| 252 | ) |
| 253 | { |
| 254 | /*------------------------------------------------------------------------ |
| 255 | Sanity check BAP control block |
| 256 | ------------------------------------------------------------------------*/ |
| 257 | |
| 258 | if ( NULL == pBtampCtx ) |
| 259 | { |
| 260 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 261 | "Invalid BAP pointer in %s", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 262 | return VOS_STATUS_E_FAULT; |
| 263 | } |
| 264 | |
| 265 | /*Start the connection accept timer*/ |
| 266 | vos_timer_start( |
| 267 | &pBtampCtx->bapConnectionAcceptTimer, |
| 268 | interval); |
| 269 | |
| 270 | return VOS_STATUS_SUCCESS; |
| 271 | }/* WLANBAP_StartConnectionAcceptTimer */ |
| 272 | |
| 273 | |
| 274 | /*========================================================================== |
| 275 | |
| 276 | FUNCTION WLANBAP_StopConnectionAcceptTimer |
| 277 | |
| 278 | DESCRIPTION |
| 279 | Stop the Connection Accept Timer. |
| 280 | |
| 281 | DEPENDENCIES |
| 282 | |
| 283 | PARAMETERS |
| 284 | |
| 285 | IN |
| 286 | pBtampCtx: pointer to the BAP control block |
| 287 | |
| 288 | RETURN VALUE |
| 289 | The result code associated with performing the operation |
| 290 | |
| 291 | VOS_STATUS_E_FAULT: access would cause a page fault |
| 292 | VOS_STATUS_SUCCESS: Everything is good :) |
| 293 | |
| 294 | SIDE EFFECTS |
| 295 | |
| 296 | ============================================================================*/ |
| 297 | VOS_STATUS |
| 298 | WLANBAP_StopConnectionAcceptTimer |
| 299 | ( |
| 300 | ptBtampContext pBtampCtx |
| 301 | ) |
| 302 | { |
| 303 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
| 304 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 305 | |
| 306 | |
| 307 | /*------------------------------------------------------------------------ |
| 308 | Sanity check BAP control block |
| 309 | ------------------------------------------------------------------------*/ |
| 310 | |
| 311 | if ( NULL == pBtampCtx ) |
| 312 | { |
| 313 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 314 | "Invalid BAP pointer in %s", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 315 | return VOS_STATUS_E_FAULT; |
| 316 | } |
| 317 | |
| 318 | /*Stop the timer */ |
| 319 | vosStatus = vos_timer_stop( |
| 320 | &pBtampCtx->bapConnectionAcceptTimer); |
| 321 | |
| 322 | |
| 323 | return VOS_STATUS_SUCCESS; |
| 324 | }/* WLANBAP_StopConnectionAcceptTimer */ |
| 325 | |
| 326 | |
| 327 | |
| 328 | /*========================================================================== |
| 329 | |
| 330 | FUNCTION WLANBAP_ConnectionAcceptTimerHandler |
| 331 | |
| 332 | DESCRIPTION |
| 333 | Callback function registered with vos timer for the Connection |
| 334 | Accept timer |
| 335 | |
| 336 | DEPENDENCIES |
| 337 | |
| 338 | PARAMETERS |
| 339 | |
| 340 | IN |
| 341 | userData: pointer can be used to retrive the BT-AMP context |
| 342 | |
| 343 | RETURN VALUE |
| 344 | None |
| 345 | |
| 346 | SIDE EFFECTS |
| 347 | |
| 348 | ============================================================================*/ |
| 349 | v_VOID_t |
| 350 | WLANBAP_ConnectionAcceptTimerHandler |
| 351 | ( |
| 352 | v_PVOID_t userData |
| 353 | ) |
| 354 | { |
| 355 | ptBtampContext pBtampCtx = (ptBtampContext)userData; |
| 356 | tWLAN_BAPEvent bapEvent; /* State machine event */ |
| 357 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
| 358 | v_U8_t status; /* return the BT-AMP status here */ |
| 359 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 360 | |
| 361 | /*----------------------------------------------------------------------- |
| 362 | Sanity check |
| 363 | -----------------------------------------------------------------------*/ |
| 364 | if ( NULL == pBtampCtx ) |
| 365 | { |
| 366 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 367 | "WLAN BAP: Fatal error in %s", __func__ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 368 | VOS_ASSERT(0); |
| 369 | return; |
| 370 | } |
| 371 | |
| 372 | /*--------------------------------------------------------------------- |
| 373 | Feed this timeout to the BTAMP FSM |
| 374 | ---------------------------------------------------------------------*/ |
| 375 | /* Fill in the event structure */ |
| 376 | bapEvent.event = eWLAN_BAP_TIMER_CONNECT_ACCEPT_TIMEOUT; |
| 377 | bapEvent.params = NULL; |
| 378 | |
| 379 | /* Handle event */ |
| 380 | vosStatus = btampFsm(pBtampCtx, &bapEvent, &status); |
| 381 | |
| 382 | /* Now transition to fully disconnected and notify phy link disconnect*/ |
| 383 | bapEvent.event = eWLAN_BAP_MAC_READY_FOR_CONNECTIONS; |
| 384 | bapEvent.params = NULL; |
| 385 | |
| 386 | /* Handle event */ |
| 387 | vosStatus = btampFsm(pBtampCtx, &bapEvent, &status); |
| 388 | |
| 389 | |
| 390 | }/*WLANBAP_ConnectionAcceptTimerHandler*/ |
| 391 | |
| 392 | /*========================================================================== |
| 393 | |
| 394 | FUNCTION WLANBAP_InitLinkSupervisionTimer |
| 395 | |
| 396 | DESCRIPTION |
| 397 | Initialize the Link Supervision Timer. |
| 398 | |
| 399 | DEPENDENCIES |
| 400 | |
| 401 | PARAMETERS |
| 402 | |
| 403 | IN |
| 404 | pBtampCtx: pointer to the BAP control block |
| 405 | |
| 406 | RETURN VALUE |
| 407 | The result code associated with performing the operation |
| 408 | |
| 409 | VOS_STATUS_E_FAULT: access would cause a page fault |
| 410 | VOS_STATUS_SUCCESS: Everything is good :) |
| 411 | |
| 412 | SIDE EFFECTS |
| 413 | |
| 414 | ============================================================================*/ |
| 415 | VOS_STATUS |
| 416 | WLANBAP_InitLinkSupervisionTimer |
| 417 | ( |
| 418 | ptBtampContext pBtampCtx |
| 419 | ) |
| 420 | { |
| 421 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
| 422 | |
| 423 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 424 | |
| 425 | |
| 426 | /*------------------------------------------------------------------------ |
| 427 | Sanity check BAP control block |
| 428 | ------------------------------------------------------------------------*/ |
| 429 | |
| 430 | if ( NULL == pBtampCtx ) |
| 431 | { |
| 432 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 433 | "Invalid BAP pointer in %s", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 434 | return VOS_STATUS_E_FAULT; |
| 435 | } |
| 436 | |
| 437 | /*Initialize the timer */ |
| 438 | vosStatus = vos_timer_init( |
| 439 | &pBtampCtx->bapLinkSupervisionTimer, |
| 440 | VOS_TIMER_TYPE_SW, /* use this type */ |
| 441 | WLANBAP_LinkSupervisionTimerHandler, |
| 442 | pBtampCtx); |
| 443 | |
| 444 | return VOS_STATUS_SUCCESS; |
| 445 | }/* WLANBAP_InitLinkSupervisionTimer */ |
| 446 | |
| 447 | /*========================================================================== |
| 448 | |
| 449 | FUNCTION WLANBAP_DeinitLinkSupervisionTimer |
| 450 | |
| 451 | DESCRIPTION |
| 452 | Destroy the Link Supervision Timer. |
| 453 | |
| 454 | DEPENDENCIES |
| 455 | |
| 456 | PARAMETERS |
| 457 | |
| 458 | IN |
| 459 | pBtampCtx: pointer to the BAP control block |
| 460 | |
| 461 | RETURN VALUE |
| 462 | The result code associated with performing the operation |
| 463 | |
| 464 | VOS_STATUS_E_FAULT: access would cause a page fault |
| 465 | VOS_STATUS_SUCCESS: Everything is good :) |
| 466 | |
| 467 | SIDE EFFECTS |
| 468 | |
| 469 | ============================================================================*/ |
| 470 | VOS_STATUS |
| 471 | WLANBAP_DeinitLinkSupervisionTimer |
| 472 | ( |
| 473 | ptBtampContext pBtampCtx |
| 474 | ) |
| 475 | { |
| 476 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
| 477 | |
| 478 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 479 | |
| 480 | |
| 481 | /*------------------------------------------------------------------------ |
| 482 | Sanity check BAP control block |
| 483 | ------------------------------------------------------------------------*/ |
| 484 | |
| 485 | if ( NULL == pBtampCtx ) |
| 486 | { |
| 487 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 488 | "Invalid BAP pointer in %s", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 489 | return VOS_STATUS_E_FAULT; |
| 490 | } |
| 491 | |
| 492 | /*Initialize and then Start the timer */ |
| 493 | vosStatus = vos_timer_destroy ( |
| 494 | &pBtampCtx->bapLinkSupervisionTimer ); |
| 495 | |
| 496 | return VOS_STATUS_SUCCESS; |
| 497 | }/* WLANBAP_DeinitLinkSupervisionTimer */ |
| 498 | |
| 499 | /*========================================================================== |
| 500 | |
| 501 | FUNCTION WLANBAP_StartLinkSupervisionTimer |
| 502 | |
| 503 | DESCRIPTION |
| 504 | Start the LinkSupervisionTimer Timer. |
| 505 | |
| 506 | DEPENDENCIES |
| 507 | |
| 508 | PARAMETERS |
| 509 | |
| 510 | IN |
| 511 | pBtampCtx: pointer to the BAP control block |
| 512 | interval: time interval. |
| 513 | |
| 514 | RETURN VALUE |
| 515 | The result code associated with performing the operation |
| 516 | |
| 517 | VOS_STATUS_E_FAULT: access would cause a page fault |
| 518 | VOS_STATUS_SUCCESS: Everything is good :) |
| 519 | |
| 520 | SIDE EFFECTS |
| 521 | |
| 522 | ============================================================================*/ |
| 523 | VOS_STATUS |
| 524 | WLANBAP_StartLinkSupervisionTimer |
| 525 | ( |
| 526 | ptBtampContext pBtampCtx, |
| 527 | v_U32_t interval |
| 528 | ) |
| 529 | { |
| 530 | /*------------------------------------------------------------------------ |
| 531 | Sanity check BAP control block |
| 532 | ------------------------------------------------------------------------*/ |
| 533 | |
| 534 | if ( NULL == pBtampCtx ) |
| 535 | { |
| 536 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 537 | "Invalid BAP pointer in %s", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 538 | return VOS_STATUS_E_FAULT; |
| 539 | } |
| 540 | |
| 541 | vos_timer_start( |
| 542 | &pBtampCtx->bapLinkSupervisionTimer, |
| 543 | interval); |
| 544 | |
| 545 | return VOS_STATUS_SUCCESS; |
| 546 | }/* WLANBAP_StartLinkSupervisionTimer */ |
| 547 | |
| 548 | /*========================================================================== |
| 549 | |
| 550 | FUNCTION WLANBAP_StopLinkSupervisionTimer |
| 551 | |
| 552 | DESCRIPTION |
| 553 | Stop the LinkSupervision Timer. |
| 554 | |
| 555 | DEPENDENCIES |
| 556 | |
| 557 | PARAMETERS |
| 558 | |
| 559 | IN |
| 560 | pBtampCtx: pointer to the BAP control block |
| 561 | |
| 562 | RETURN VALUE |
| 563 | The result code associated with performing the operation |
| 564 | |
| 565 | VOS_STATUS_E_FAULT: access would cause a page fault |
| 566 | VOS_STATUS_SUCCESS: Everything is good :) |
| 567 | |
| 568 | SIDE EFFECTS |
| 569 | |
| 570 | ============================================================================*/ |
| 571 | VOS_STATUS |
| 572 | WLANBAP_StopLinkSupervisionTimer |
| 573 | ( |
| 574 | ptBtampContext pBtampCtx |
| 575 | ) |
| 576 | { |
| 577 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
| 578 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 579 | |
| 580 | |
| 581 | /*------------------------------------------------------------------------ |
| 582 | Sanity check BAP control block |
| 583 | ------------------------------------------------------------------------*/ |
| 584 | |
| 585 | if ( NULL == pBtampCtx ) |
| 586 | { |
| 587 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 588 | "Invalid BAP pointer in %s", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 589 | return VOS_STATUS_E_FAULT; |
| 590 | } |
| 591 | |
| 592 | /*Stop the timer */ |
| 593 | vosStatus = vos_timer_stop( |
| 594 | &pBtampCtx->bapLinkSupervisionTimer); |
| 595 | |
| 596 | |
| 597 | return VOS_STATUS_SUCCESS; |
| 598 | }/* WLANBAP_StopLinkSupervisionTimer */ |
| 599 | |
| 600 | |
| 601 | /*========================================================================== |
| 602 | |
| 603 | FUNCTION WLANBAP_LinkSupervisionTimerHandler |
| 604 | |
| 605 | DESCRIPTION |
| 606 | Callback function registered with vos timer for the LinkSupervision timer |
| 607 | |
| 608 | DEPENDENCIES |
| 609 | |
| 610 | PARAMETERS |
| 611 | |
| 612 | IN |
| 613 | userData: pointer can be used to retrive the BT-AMP context |
| 614 | |
| 615 | RETURN VALUE |
| 616 | None |
| 617 | |
| 618 | SIDE EFFECTS |
| 619 | |
| 620 | ============================================================================*/ |
| 621 | v_VOID_t |
| 622 | WLANBAP_LinkSupervisionTimerHandler |
| 623 | ( |
| 624 | v_PVOID_t userData |
| 625 | ) |
| 626 | { |
| 627 | ptBtampContext pBtampCtx = (ptBtampContext)userData; |
| 628 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
| 629 | ptBtampHandle btampHandle = (ptBtampHandle)userData; |
| 630 | tWLAN_BAPEvent bapEvent; /* State machine event */ |
| 631 | v_U8_t phy_link_handle; |
| 632 | |
| 633 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 634 | |
| 635 | /*----------------------------------------------------------------------- |
| 636 | Sanity check |
| 637 | -----------------------------------------------------------------------*/ |
| 638 | if ( NULL == pBtampCtx ) |
| 639 | { |
| 640 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 641 | "WLAN BAP: Fatal error in %s", __func__ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 642 | VOS_ASSERT(0); |
| 643 | return; |
| 644 | } |
| 645 | |
| 646 | phy_link_handle = pBtampCtx->phy_link_handle; |
| 647 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 648 | "WLAN BAP:In LinkSupervision Timer handler %s", __func__ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 649 | |
| 650 | if(pBtampCtx->dataPktPending == VOS_TRUE) |
| 651 | { |
| 652 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 653 | "%s: Data seen. Do nothing", __func__ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 654 | |
| 655 | pBtampCtx->dataPktPending = VOS_FALSE; |
| 656 | pBtampCtx->lsReqPktPending = VOS_FALSE; |
| 657 | pBtampCtx->retries = 0; |
| 658 | vosStatus = WLANBAP_StopLinkSupervisionTimer(pBtampCtx); |
| 659 | vosStatus = WLANBAP_StartLinkSupervisionTimer (pBtampCtx, |
| 660 | pBtampCtx->bapLinkSupervisionTimerInterval * WLANBAP_BREDR_BASEBAND_SLOT_TIME); |
| 661 | |
| 662 | //Data is seen. or our previous packet is not yet fetched by TL.Don't do any thing.Just return; |
| 663 | return; |
| 664 | } |
| 665 | else if((pBtampCtx->lsReqPktPending == VOS_TRUE ) |
| 666 | && (pBtampCtx->retries == WLANBAP_LINK_SUPERVISION_RETRIES)) |
| 667 | { |
| 668 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 669 | "#########WLAN BAP: LinkSupervision Timed OUT######## %s", __func__ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 670 | |
| 671 | /*--------------------------------------------------------------------- |
| 672 | Feed this timeout to the BTAMP FSM |
| 673 | ---------------------------------------------------------------------*/ |
| 674 | /* Fill in the event structure */ |
| 675 | /* JEZ110307: Which should this be? */ |
| 676 | //bapEvent.event =eWLAN_BAP_HCI_PHYSICAL_LINK_DISCONNECT; |
| 677 | bapEvent.event =eWLAN_BAP_MAC_INDICATES_MEDIA_DISCONNECTION; |
| 678 | bapEvent.params = NULL; |
| 679 | |
| 680 | /* Handle event */ |
| 681 | vosStatus = btampFsm(pBtampCtx, &bapEvent, (v_U8_t *)&vosStatus); |
| 682 | } |
| 683 | else |
| 684 | { |
| 685 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 686 | "%s: Resend the LS packet", __func__ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 687 | |
| 688 | /* If we have transmit pkt pending and the time out occurred,resend the ls packet */ |
| 689 | WLANBAP_StopLinkSupervisionTimer(pBtampCtx); |
| 690 | pBtampCtx->pPacket = pBtampCtx->lsReqPacket; |
| 691 | vosStatus = WLANBAP_TxLinkSupervision( btampHandle, |
| 692 | phy_link_handle, |
| 693 | pBtampCtx->pPacket , |
| 694 | WLANTL_BT_AMP_TYPE_LS_REQ); |
| 695 | } |
| 696 | |
| 697 | }/*WLANBAP_LinkSupervisionTimerHandler*/ |
| 698 | |
| 699 | /*========================================================================== |
| 700 | |
| 701 | FUNCTION WLANBAP_StartTxPacketMonitorTimer |
| 702 | |
| 703 | DESCRIPTION |
| 704 | Start the Tx Packet Monitor Timer. |
| 705 | |
| 706 | DEPENDENCIES |
| 707 | |
| 708 | PARAMETERS |
| 709 | |
| 710 | IN |
| 711 | pBtampCtx: pointer to the BAP control block |
| 712 | interval: time interval. |
| 713 | |
| 714 | RETURN VALUE |
| 715 | The result code associated with performing the operation |
| 716 | |
| 717 | VOS_STATUS_E_FAULT: access would cause a page fault |
| 718 | VOS_STATUS_SUCCESS: Everything is good :) |
| 719 | |
| 720 | SIDE EFFECTS |
| 721 | |
| 722 | ============================================================================*/ |
| 723 | VOS_STATUS |
| 724 | WLANBAP_StartTxPacketMonitorTimer |
| 725 | ( |
| 726 | ptBtampContext pBtampCtx |
| 727 | ) |
| 728 | { |
| 729 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
| 730 | v_U32_t uInterval = WLAN_BAP_TX_PKT_MONITOR_TIME; |
| 731 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 732 | |
| 733 | |
| 734 | /*------------------------------------------------------------------------ |
| 735 | Sanity check BAP control block |
| 736 | ------------------------------------------------------------------------*/ |
| 737 | if ( NULL == pBtampCtx ) |
| 738 | { |
| 739 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 740 | "Invalid BAP pointer in %s", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 741 | return VOS_STATUS_E_FAULT; |
| 742 | } |
| 743 | |
| 744 | /*Start the timer */ |
| 745 | vosStatus = vos_timer_start( &pBtampCtx->bapTxPktMonitorTimer, |
| 746 | uInterval); |
| 747 | |
| 748 | return vosStatus; |
| 749 | }/* WLANBAP_StartTxPacketMonitorTimer */ |
| 750 | |
| 751 | |
| 752 | /*========================================================================== |
| 753 | |
| 754 | FUNCTION WLANBAP_StopTxPacketMonitorTimer |
| 755 | |
| 756 | DESCRIPTION |
| 757 | Stop the Tx Packet Monitor Timer. |
| 758 | |
| 759 | DEPENDENCIES |
| 760 | |
| 761 | PARAMETERS |
| 762 | |
| 763 | IN |
| 764 | pBtampCtx: pointer to the BAP control block |
| 765 | |
| 766 | RETURN VALUE |
| 767 | The result code associated with performing the operation |
| 768 | |
| 769 | VOS_STATUS_E_FAULT: access would cause a page fault |
| 770 | VOS_STATUS_SUCCESS: Everything is good :) |
| 771 | |
| 772 | SIDE EFFECTS |
| 773 | |
| 774 | ============================================================================*/ |
| 775 | VOS_STATUS |
| 776 | WLANBAP_StopTxPacketMonitorTimer |
| 777 | ( |
| 778 | ptBtampContext pBtampCtx |
| 779 | ) |
| 780 | { |
| 781 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
| 782 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 783 | |
| 784 | |
| 785 | /*------------------------------------------------------------------------ |
| 786 | Sanity check BAP control block |
| 787 | ------------------------------------------------------------------------*/ |
| 788 | if ( NULL == pBtampCtx ) |
| 789 | { |
| 790 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 791 | "Invalid BAP pointer in %s", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 792 | return VOS_STATUS_E_FAULT; |
| 793 | } |
| 794 | |
| 795 | /*Stop the timer */ |
| 796 | vosStatus = vos_timer_stop( &pBtampCtx->bapTxPktMonitorTimer); |
| 797 | |
| 798 | |
| 799 | return vosStatus; |
| 800 | }/* WLANBAP_StopTxPacketMonitorTimer */ |
| 801 | |
| 802 | |
| 803 | /*========================================================================== |
| 804 | |
| 805 | FUNCTION WLANBAP_SendCompletedPktsEvent |
| 806 | |
| 807 | DESCRIPTION |
| 808 | Utility function for sending the NUM_OF_COMPLETED_PKTS_EVENT to HCI |
| 809 | |
| 810 | DEPENDENCIES |
| 811 | |
| 812 | PARAMETERS |
| 813 | |
| 814 | IN |
| 815 | pBtampCtx: pointer to the BAP control block |
| 816 | |
| 817 | RETURN VALUE |
| 818 | None |
| 819 | |
| 820 | SIDE EFFECTS |
| 821 | |
| 822 | ============================================================================*/ |
| 823 | v_VOID_t |
| 824 | WLANBAP_SendCompletedPktsEvent |
| 825 | ( |
| 826 | ptBtampContext pBtampCtx |
| 827 | ) |
| 828 | { |
| 829 | v_U8_t i, j; |
| 830 | tBtampHCI_Event bapHCIEvent; /* This now encodes ALL event types */ |
| 831 | v_U32_t uTxCompleted = 0; |
| 832 | tpBtampLogLinkCtx pLogLinkContext = NULL; |
| 833 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 834 | /* Format the Number of completed packets event */ |
| 835 | bapHCIEvent.bapHCIEventCode = BTAMP_TLV_HCI_NUM_OF_COMPLETED_PKTS_EVENT; |
| 836 | bapHCIEvent.u.btampNumOfCompletedPktsEvent.num_handles = 0; |
| 837 | |
| 838 | /*--------------------------------------------------------------------- |
| 839 | Check if LL still exists, if TRUE generate num_pkt_event and |
| 840 | restart the timer |
| 841 | ---------------------------------------------------------------------*/ |
| 842 | for (i = 0, j = 0; i < WLANBAP_MAX_LOG_LINKS ; i++) |
| 843 | { |
| 844 | pLogLinkContext = &pBtampCtx->btampLogLinkCtx[i]; |
| 845 | if ( pLogLinkContext->present ) |
| 846 | { |
| 847 | uTxCompleted = pLogLinkContext->uTxPktCompleted; |
| 848 | bapHCIEvent.u.btampNumOfCompletedPktsEvent.conn_handles[j] = |
| 849 | pLogLinkContext->log_link_handle; |
| 850 | bapHCIEvent.u.btampNumOfCompletedPktsEvent.num_completed_pkts[j] = |
| 851 | uTxCompleted; |
| 852 | |
| 853 | j++; |
| 854 | |
| 855 | vos_atomic_decrement_U32_by_value((v_U32_t *) &pLogLinkContext->uTxPktCompleted, |
| 856 | (v_U32_t) uTxCompleted); |
| 857 | |
| 858 | if (uTxCompleted) { |
| 859 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 860 | "wlan bap: %s Log Link handle - %d No Of Pkts - %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 861 | pLogLinkContext->log_link_handle, uTxCompleted); |
| 862 | } |
| 863 | } |
| 864 | } |
| 865 | |
| 866 | /* Indicate only if at least one logical link is present and number of |
| 867 | completed packets is non zero */ |
| 868 | if (j && uTxCompleted) |
| 869 | { |
| 870 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, |
| 871 | "WLAN BAP: Indicating Num Completed packets Event"); |
| 872 | |
| 873 | /*issue num_pkt_event for uTxCompleted*/ |
| 874 | bapHCIEvent.u.btampNumOfCompletedPktsEvent.num_handles = j; |
| 875 | (*pBtampCtx->pBapHCIEventCB) |
| 876 | ( |
| 877 | pBtampCtx->pHddHdl, /* this refers the BSL per application context */ |
| 878 | &bapHCIEvent, /* This now encodes ALL event types */ |
| 879 | VOS_TRUE /* Flag to indicate assoc-specific event */ |
| 880 | ); |
| 881 | } |
| 882 | |
| 883 | } |
| 884 | |
| 885 | /*========================================================================== |
| 886 | |
| 887 | FUNCTION WLANBAP_SendCompletedDataBlksEvent |
| 888 | |
| 889 | DESCRIPTION |
| 890 | Utility function for sending the NUM_OF_COMPLETED_DATA_BLOCKS_EVENT to HCI |
| 891 | |
| 892 | DEPENDENCIES |
| 893 | |
| 894 | PARAMETERS |
| 895 | |
| 896 | IN |
| 897 | pBtampCtx: pointer to the BAP control block |
| 898 | |
| 899 | RETURN VALUE |
| 900 | None |
| 901 | |
| 902 | SIDE EFFECTS |
| 903 | |
| 904 | ============================================================================*/ |
| 905 | v_VOID_t |
| 906 | WLANBAP_SendCompletedDataBlksEvent |
| 907 | ( |
| 908 | ptBtampContext pBtampCtx |
| 909 | ) |
| 910 | { |
| 911 | v_U8_t i, j; |
| 912 | tBtampHCI_Event bapHCIEvent; /* This now encodes ALL event types */ |
| 913 | v_U32_t uTxCompleted = 0; |
| 914 | tpBtampLogLinkCtx pLogLinkContext = NULL; |
| 915 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 916 | /* Format the Number of completed data blocks event */ |
| 917 | bapHCIEvent.bapHCIEventCode = BTAMP_TLV_HCI_NUM_OF_COMPLETED_DATA_BLOCKS_EVENT; |
| 918 | bapHCIEvent.u.btampNumOfCompletedDataBlocksEvent.num_handles = 0; |
| 919 | |
| 920 | /*--------------------------------------------------------------------- |
| 921 | Check if LL still exists, if TRUE generate num_data_blocks_event and |
| 922 | restart the timer |
| 923 | ---------------------------------------------------------------------*/ |
| 924 | for (i = 0, j = 0; i < WLANBAP_MAX_LOG_LINKS ; i++) |
| 925 | { |
| 926 | pLogLinkContext = &pBtampCtx->btampLogLinkCtx[i]; |
| 927 | if ( pLogLinkContext->present ) |
| 928 | { |
| 929 | uTxCompleted = pLogLinkContext->uTxPktCompleted; |
| 930 | bapHCIEvent.u.btampNumOfCompletedDataBlocksEvent.conn_handles[j] = |
| 931 | pLogLinkContext->log_link_handle; |
| 932 | bapHCIEvent.u.btampNumOfCompletedDataBlocksEvent.num_completed_pkts[j] = |
| 933 | uTxCompleted; |
| 934 | bapHCIEvent.u.btampNumOfCompletedDataBlocksEvent.num_completed_blocks[j] = |
| 935 | uTxCompleted; |
| 936 | bapHCIEvent.u.btampNumOfCompletedDataBlocksEvent.total_num_data_blocks = 16; |
| 937 | |
| 938 | j++; |
| 939 | |
| 940 | vos_atomic_decrement_U32_by_value((v_U32_t *) &pLogLinkContext->uTxPktCompleted, |
| 941 | (v_U32_t) uTxCompleted); |
| 942 | |
| 943 | if (uTxCompleted) { |
| 944 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 945 | "wlan bap: %s Log Link handle - %d No Of Pkts - %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 946 | pLogLinkContext->log_link_handle, uTxCompleted); |
| 947 | } |
| 948 | } |
| 949 | } |
| 950 | |
| 951 | /* Indicate only if at least one logical link is present and number of |
| 952 | completed data blocks is non zero */ |
| 953 | if (j && uTxCompleted) |
| 954 | { |
| 955 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, |
| 956 | "WLAN BAP: Indicating Num Completed Data Blocks Event"); |
| 957 | |
| 958 | /*issue num_data_blocks_event for uTxCompleted*/ |
| 959 | bapHCIEvent.u.btampNumOfCompletedDataBlocksEvent.num_handles = j; |
| 960 | (*pBtampCtx->pBapHCIEventCB) |
| 961 | ( |
| 962 | pBtampCtx->pHddHdl, /* this refers the BSL per application context */ |
| 963 | &bapHCIEvent, /* This now encodes ALL event types */ |
| 964 | VOS_TRUE /* Flag to indicate assoc-specific event */ |
| 965 | ); |
| 966 | } |
| 967 | |
| 968 | } |
| 969 | |
| 970 | /*========================================================================== |
| 971 | |
| 972 | FUNCTION WLANBAP_TxPacketMonitorHandler |
| 973 | |
| 974 | DESCRIPTION |
| 975 | Callback function registered with vos timer for the Tx Packet Monitor |
| 976 | Timer. |
| 977 | |
| 978 | DEPENDENCIES |
| 979 | |
| 980 | PARAMETERS |
| 981 | |
| 982 | IN |
| 983 | userData: pointer can be used to retrive the BT-AMP context |
| 984 | |
| 985 | RETURN VALUE |
| 986 | None |
| 987 | |
| 988 | SIDE EFFECTS |
| 989 | |
| 990 | ============================================================================*/ |
| 991 | v_VOID_t |
| 992 | WLANBAP_TxPacketMonitorHandler |
| 993 | ( |
| 994 | v_PVOID_t userData |
| 995 | ) |
| 996 | { |
| 997 | ptBtampContext pBtampCtx = (ptBtampContext)userData; |
| 998 | BTAMPFSM_INSTANCEDATA_T *instanceVar = &pBtampCtx->bapPhysLinkMachine; |
| 999 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 1000 | |
| 1001 | /*----------------------------------------------------------------------- |
| 1002 | Sanity check |
| 1003 | -----------------------------------------------------------------------*/ |
| 1004 | if ( NULL == pBtampCtx ) |
| 1005 | { |
| 1006 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1007 | "WLAN BAP: Fatal error in %s", __func__ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1008 | VOS_ASSERT(0); |
| 1009 | return; |
| 1010 | } |
| 1011 | |
| 1012 | #if 0 //BAP_DEBUG |
| 1013 | /* Trace the tBtampCtx being passed in. */ |
| 1014 | VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1015 | "WLAN BAP Context Monitor: pBtampCtx value = %x in %s:%d", pBtampCtx, __func__, __LINE__ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1016 | #endif //BAP_DEBUG |
| 1017 | |
| 1018 | if(WLANBAP_FLOW_CONTROL_MODE_BLOCK_BASED == pBtampCtx->ucDataTrafficMode) |
| 1019 | { |
| 1020 | WLANBAP_SendCompletedDataBlksEvent(pBtampCtx); |
| 1021 | } |
| 1022 | else |
| 1023 | { |
| 1024 | WLANBAP_SendCompletedPktsEvent(pBtampCtx); |
| 1025 | } |
| 1026 | |
| 1027 | /* Restart the Packet monitoring timer if still Physical link |
| 1028 | * is present. |
| 1029 | * It is possible that when the physical link is tear down, |
| 1030 | * timer start request is in Q and could start again. |
| 1031 | */ |
| 1032 | if (CONNECTED == instanceVar->stateVar) |
| 1033 | { |
| 1034 | WLANBAP_StartTxPacketMonitorTimer(pBtampCtx); |
| 1035 | } |
| 1036 | }/*WLANBAP_TxPacketMonitorHandler*/ |
| 1037 | |