Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Nishank Aggarwal | 760a2e4 | 2017-02-14 12:49:20 +0530 | [diff] [blame] | 2 | * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved. |
AnjaneeDevi Kapparapu | 24b52ff | 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 | 9c070ad | 2013-01-08 21:16:34 -0800 | [diff] [blame] | 20 | */ |
AnjaneeDevi Kapparapu | 24b52ff | 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 | 9c070ad | 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 limSerDesUtils.h contains the utility definitions |
| 31 | * LIM uses while processing messages from upper layer software |
| 32 | * modules |
| 33 | * Author: Chandra Modumudi |
| 34 | * Date: 10/20/02 |
| 35 | * History:- |
| 36 | * Date Modified by Modification Information |
| 37 | * -------------------------------------------------------------------- |
| 38 | */ |
| 39 | #ifndef __LIM_SERDES_UTILS_H |
| 40 | #define __LIM_SERDES_UTILS_H |
| 41 | |
| 42 | #include "sirApi.h" |
| 43 | #include "aniSystemDefs.h" |
| 44 | #include "sirMacProtDef.h" |
| 45 | #include "utilsApi.h" |
| 46 | #include "limTypes.h" |
| 47 | #include "limPropExtsUtils.h" |
| 48 | |
| 49 | tSirRetStatus limStartBssReqSerDes(tpAniSirGlobal, tpSirSmeStartBssReq, tANI_U8 *); |
| 50 | tSirRetStatus limStopBssReqSerDes(tpAniSirGlobal, tpSirSmeStopBssReq, tANI_U8 *); |
| 51 | tSirRetStatus limJoinReqSerDes(tpAniSirGlobal, tpSirSmeJoinReq, tANI_U8 *); |
| 52 | void limAssocIndSerDes(tpAniSirGlobal, tpLimMlmAssocInd, tANI_U8 *, tpPESession); |
Nishank Aggarwal | 760a2e4 | 2017-02-14 12:49:20 +0530 | [diff] [blame] | 53 | tSirRetStatus limReassocIndSerDes(tpAniSirGlobal, tpLimMlmReassocInd, tANI_U8 *, |
| 54 | tpPESession psessionEntry, tANI_U16 len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 55 | tSirRetStatus limAssocCnfSerDes(tpAniSirGlobal, tpSirSmeAssocCnf, tANI_U8 *); |
| 56 | tSirRetStatus limDisassocCnfSerDes(tpAniSirGlobal, tpSirSmeDisassocCnf, tANI_U8 *); |
| 57 | tSirRetStatus limSetContextReqSerDes(tpAniSirGlobal, tpSirSmeSetContextReq, tANI_U8 *); |
| 58 | tSirRetStatus limDisassocReqSerDes(tpAniSirGlobal, tSirSmeDisassocReq *, tANI_U8 *); |
| 59 | tSirRetStatus limDeauthReqSerDes(tpAniSirGlobal, tSirSmeDeauthReq *, tANI_U8 *); |
Nishank Aggarwal | 760a2e4 | 2017-02-14 12:49:20 +0530 | [diff] [blame] | 60 | tSirRetStatus limAuthIndSerDes(tpAniSirGlobal, tpLimMlmAuthInd, tANI_U8 *, |
| 61 | tANI_U16 len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 62 | void limStatSerDes(tpAniSirGlobal, tpAniStaStatStruct, tANI_U8 *); |
| 63 | void limGetSessionInfo(tpAniSirGlobal pMac, tANI_U8 *, tANI_U8 *, tANI_U16 *); |
| 64 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 65 | |
| 66 | void limPackBkgndScanFailNotify(tpAniSirGlobal, tSirSmeStatusChangeCode, |
| 67 | tpSirBackgroundScanInfo, tSirSmeWmStatusChangeNtf *, tANI_U8); |
| 68 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 69 | |
| 70 | tSirRetStatus limRemoveKeyReqSerDes(tpAniSirGlobal pMac, tpSirSmeRemoveKeyReq pRemoveKeyReq, tANI_U8 * pBuf); |
| 71 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 72 | tANI_BOOLEAN limIsSmeGetAssocSTAsReqValid(tpAniSirGlobal pMac, tpSirSmeGetAssocSTAsReq pGetAssocSTAsReq, tANI_U8 *pBuf); |
| 73 | tSirRetStatus limTkipCntrMeasReqSerDes(tpAniSirGlobal pMac, tpSirSmeTkipCntrMeasReq ptkipCntrMeasReq, tANI_U8 *pBuf); |
| 74 | |
| 75 | tSirRetStatus limUpdateAPWPSIEsReqSerDes(tpAniSirGlobal pMac, tpSirUpdateAPWPSIEsReq pUpdateAPWPSIEsReq, tANI_U8 *pBuf); |
| 76 | tSirRetStatus limUpdateAPWPARSNIEsReqSerDes(tpAniSirGlobal pMac, tpSirUpdateAPWPARSNIEsReq pUpdateAPWPARSNIEsReq, tANI_U8 *pBuf); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 77 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 78 | |
| 79 | // Byte String <--> tANI_U16/tANI_U32 copy functions |
| 80 | static inline void limCopyU16(tANI_U8 *ptr, tANI_U16 u16Val) |
| 81 | { |
Jeff Johnson | 8347b44 | 2013-03-07 08:15:44 -0800 | [diff] [blame] | 82 | #if ((defined(ANI_OS_TYPE_QNX) && defined(ANI_LITTLE_BYTE_ENDIAN)) || \ |
| 83 | (defined(ANI_OS_TYPE_ANDROID) && defined(ANI_LITTLE_BYTE_ENDIAN))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 84 | *ptr++ = (tANI_U8) (u16Val & 0xff); |
| 85 | *ptr = (tANI_U8) ((u16Val >> 8) & 0xff); |
| 86 | #else |
| 87 | #error "Unknown combination of OS Type and endianess" |
| 88 | #endif |
| 89 | } |
| 90 | |
| 91 | static inline tANI_U16 limGetU16(tANI_U8 *ptr) |
| 92 | { |
Jeff Johnson | 8347b44 | 2013-03-07 08:15:44 -0800 | [diff] [blame] | 93 | #if ((defined(ANI_OS_TYPE_QNX) && defined(ANI_LITTLE_BYTE_ENDIAN)) || \ |
| 94 | (defined(ANI_OS_TYPE_ANDROID) && defined(ANI_LITTLE_BYTE_ENDIAN))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 95 | return (((tANI_U16) (*(ptr+1) << 8)) | |
| 96 | ((tANI_U16) (*ptr))); |
| 97 | #else |
| 98 | #error "Unknown combination of OS Type and endianess" |
| 99 | #endif |
| 100 | } |
| 101 | |
| 102 | static inline void limCopyU32(tANI_U8 *ptr, tANI_U32 u32Val) |
| 103 | { |
Jeff Johnson | 8347b44 | 2013-03-07 08:15:44 -0800 | [diff] [blame] | 104 | #if ((defined(ANI_OS_TYPE_QNX) && defined(ANI_LITTLE_BYTE_ENDIAN)) || \ |
| 105 | (defined(ANI_OS_TYPE_ANDROID) && defined(ANI_LITTLE_BYTE_ENDIAN))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 106 | *ptr++ = (tANI_U8) (u32Val & 0xff); |
| 107 | *ptr++ = (tANI_U8) ((u32Val >> 8) & 0xff); |
| 108 | *ptr++ = (tANI_U8) ((u32Val >> 16) & 0xff); |
| 109 | *ptr = (tANI_U8) ((u32Val >> 24) & 0xff); |
| 110 | #else |
| 111 | #error "Unknown combination of OS Type and endianess" |
| 112 | #endif |
| 113 | } |
| 114 | |
| 115 | static inline tANI_U32 limGetU32(tANI_U8 *ptr) |
| 116 | { |
Jeff Johnson | 8347b44 | 2013-03-07 08:15:44 -0800 | [diff] [blame] | 117 | #if ((defined(ANI_OS_TYPE_QNX) && defined(ANI_LITTLE_BYTE_ENDIAN)) || \ |
| 118 | (defined(ANI_OS_TYPE_ANDROID) && defined(ANI_LITTLE_BYTE_ENDIAN))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 119 | return ((*(ptr+3) << 24) | |
| 120 | (*(ptr+2) << 16) | |
| 121 | (*(ptr+1) << 8) | |
| 122 | (*(ptr))); |
| 123 | #else |
| 124 | #error "Unknown combination of OS Type and endianess" |
| 125 | #endif |
| 126 | } |
| 127 | |
| 128 | #endif /* __LIM_SERDES_UTILS_H */ |
| 129 | |