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 | |
Gopichand Nakkala | 92f07d8 | 2013-01-08 21:16:34 -0800 | [diff] [blame] | 28 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 29 | * |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 30 | * This file pmmAP.cc contains AP PM functions |
| 31 | * |
| 32 | * Author: Sandesh Goel |
| 33 | * Date: 02/25/02 |
| 34 | * History:- |
| 35 | * Date Modified by Modification Information |
| 36 | * -------------------------------------------------------------------- |
| 37 | * |
| 38 | */ |
| 39 | |
| 40 | #include "sirCommon.h" |
| 41 | |
| 42 | #include "aniGlobal.h" |
| 43 | |
| 44 | #include "schApi.h" |
| 45 | #include "limApi.h" |
| 46 | #include "cfgApi.h" |
Jeff Johnson | 62c2798 | 2013-02-27 17:53:55 -0800 | [diff] [blame] | 47 | #include "wniCfgSta.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 48 | |
| 49 | #include "pmmApi.h" |
| 50 | #include "pmmDebug.h" |
| 51 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 52 | /** |
| 53 | * pmmGenerateTIM |
| 54 | * |
| 55 | * FUNCTION: |
| 56 | * Generate TIM |
| 57 | * |
| 58 | * LOGIC: |
| 59 | * |
| 60 | * ASSUMPTIONS: |
| 61 | * |
| 62 | * NOTE: |
| 63 | * |
| 64 | * @param pMac pointer to global mac structure |
| 65 | * @param **pPtr pointer to the buffer, where the TIM bit is to be written. |
| 66 | * @param *timLength pointer to limLength, which needs to be returned. |
| 67 | * @return None |
| 68 | */ |
| 69 | void pmmGenerateTIM(tpAniSirGlobal pMac, tANI_U8 **pPtr, tANI_U16 *timLength, tANI_U8 dtimPeriod) |
| 70 | { |
| 71 | tANI_U8 *ptr = *pPtr; |
| 72 | tANI_U32 val = 0; |
| 73 | tANI_U32 minAid = 1; // Always start with AID 1 as minimum |
| 74 | tANI_U32 maxAid = HAL_NUM_STA; |
| 75 | |
| 76 | |
| 77 | // Generate partial virtual bitmap |
| 78 | tANI_U8 N1 = minAid / 8; |
| 79 | tANI_U8 N2 = maxAid / 8; |
| 80 | if (N1 & 1) N1--; |
| 81 | |
| 82 | *timLength = N2 - N1 + 4; |
| 83 | val = dtimPeriod; |
| 84 | |
| 85 | /* |
| 86 | * 09/23/2011 - ASW team decision; |
| 87 | * Write 0xFF to firmware's field to detect firmware's mal-function early. |
| 88 | * DTIM count and bitmap control usually cannot be 0xFF, so it is easy to know that |
| 89 | * firmware never updated DTIM count/bitmap control field after host driver downloaded |
| 90 | * beacon template if end-user complaints that DTIM count and bitmapControl is 0xFF. |
| 91 | */ |
| 92 | *ptr++ = SIR_MAC_TIM_EID; |
| 93 | *ptr++ = (tANI_U8)(*timLength); |
| 94 | *ptr++ = 0xFF; // location for dtimCount. will be filled in by FW. |
| 95 | *ptr++ = (tANI_U8)val; |
| 96 | |
Jeff Johnson | 62c2798 | 2013-02-27 17:53:55 -0800 | [diff] [blame] | 97 | *ptr++ = 0xFF; // location for bitmap control. will be filled in by FW. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 98 | ptr += (N2 - N1 + 1); |
| 99 | |
| 100 | PELOG2(sirDumpBuf(pMac, SIR_PMM_MODULE_ID, LOG2, *pPtr, (*timLength)+2);) |
| 101 | *pPtr = ptr; |
| 102 | } |