blob: a43bc1313999d9ddd36e702c71f5e60ed3ba2824 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
AnjaneeDevi Kapparapu24b52ff2014-02-18 18:44:02 -08002 * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
Gopichand Nakkala9c070ad2013-01-08 21:16:34 -080020 */
AnjaneeDevi Kapparapu24b52ff2014-02-18 18:44:02 -080021
22/*
23 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
Gopichand Nakkala9c070ad2013-01-08 21:16:34 -080028/*
Jeff Johnson295189b2012-06-20 16:38:30 -070029 *
Jeff Johnson295189b2012-06-20 16:38:30 -070030 * 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
49tSirRetStatus limStartBssReqSerDes(tpAniSirGlobal, tpSirSmeStartBssReq, tANI_U8 *);
50tSirRetStatus limStopBssReqSerDes(tpAniSirGlobal, tpSirSmeStopBssReq, tANI_U8 *);
51tSirRetStatus limJoinReqSerDes(tpAniSirGlobal, tpSirSmeJoinReq, tANI_U8 *);
52void limAssocIndSerDes(tpAniSirGlobal, tpLimMlmAssocInd, tANI_U8 *, tpPESession);
53void limReassocIndSerDes(tpAniSirGlobal, tpLimMlmReassocInd, tANI_U8 *, tpPESession psessionEntry);
54tSirRetStatus limAssocCnfSerDes(tpAniSirGlobal, tpSirSmeAssocCnf, tANI_U8 *);
55tSirRetStatus limDisassocCnfSerDes(tpAniSirGlobal, tpSirSmeDisassocCnf, tANI_U8 *);
56tSirRetStatus limSetContextReqSerDes(tpAniSirGlobal, tpSirSmeSetContextReq, tANI_U8 *);
57tSirRetStatus limDisassocReqSerDes(tpAniSirGlobal, tSirSmeDisassocReq *, tANI_U8 *);
58tSirRetStatus limDeauthReqSerDes(tpAniSirGlobal, tSirSmeDeauthReq *, tANI_U8 *);
59void limAuthIndSerDes(tpAniSirGlobal, tpLimMlmAuthInd, tANI_U8 *);
60void limStatSerDes(tpAniSirGlobal, tpAniStaStatStruct, tANI_U8 *);
61void limGetSessionInfo(tpAniSirGlobal pMac, tANI_U8 *, tANI_U8 *, tANI_U16 *);
62
Jeff Johnson295189b2012-06-20 16:38:30 -070063
64void limPackBkgndScanFailNotify(tpAniSirGlobal, tSirSmeStatusChangeCode,
65 tpSirBackgroundScanInfo, tSirSmeWmStatusChangeNtf *, tANI_U8);
66
Jeff Johnson295189b2012-06-20 16:38:30 -070067
68tSirRetStatus limRemoveKeyReqSerDes(tpAniSirGlobal pMac, tpSirSmeRemoveKeyReq pRemoveKeyReq, tANI_U8 * pBuf);
69
Jeff Johnson295189b2012-06-20 16:38:30 -070070tANI_BOOLEAN limIsSmeGetAssocSTAsReqValid(tpAniSirGlobal pMac, tpSirSmeGetAssocSTAsReq pGetAssocSTAsReq, tANI_U8 *pBuf);
71tSirRetStatus limTkipCntrMeasReqSerDes(tpAniSirGlobal pMac, tpSirSmeTkipCntrMeasReq ptkipCntrMeasReq, tANI_U8 *pBuf);
72
73tSirRetStatus limUpdateAPWPSIEsReqSerDes(tpAniSirGlobal pMac, tpSirUpdateAPWPSIEsReq pUpdateAPWPSIEsReq, tANI_U8 *pBuf);
74tSirRetStatus limUpdateAPWPARSNIEsReqSerDes(tpAniSirGlobal pMac, tpSirUpdateAPWPARSNIEsReq pUpdateAPWPARSNIEsReq, tANI_U8 *pBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -070075
Jeff Johnson295189b2012-06-20 16:38:30 -070076
77// Byte String <--> tANI_U16/tANI_U32 copy functions
78static inline void limCopyU16(tANI_U8 *ptr, tANI_U16 u16Val)
79{
Jeff Johnson8347b442013-03-07 08:15:44 -080080#if ((defined(ANI_OS_TYPE_QNX) && defined(ANI_LITTLE_BYTE_ENDIAN)) || \
81 (defined(ANI_OS_TYPE_ANDROID) && defined(ANI_LITTLE_BYTE_ENDIAN)))
Jeff Johnson295189b2012-06-20 16:38:30 -070082 *ptr++ = (tANI_U8) (u16Val & 0xff);
83 *ptr = (tANI_U8) ((u16Val >> 8) & 0xff);
84#else
85#error "Unknown combination of OS Type and endianess"
86#endif
87}
88
89static inline tANI_U16 limGetU16(tANI_U8 *ptr)
90{
Jeff Johnson8347b442013-03-07 08:15:44 -080091#if ((defined(ANI_OS_TYPE_QNX) && defined(ANI_LITTLE_BYTE_ENDIAN)) || \
92 (defined(ANI_OS_TYPE_ANDROID) && defined(ANI_LITTLE_BYTE_ENDIAN)))
Jeff Johnson295189b2012-06-20 16:38:30 -070093 return (((tANI_U16) (*(ptr+1) << 8)) |
94 ((tANI_U16) (*ptr)));
95#else
96#error "Unknown combination of OS Type and endianess"
97#endif
98}
99
100static inline void limCopyU32(tANI_U8 *ptr, tANI_U32 u32Val)
101{
Jeff Johnson8347b442013-03-07 08:15:44 -0800102#if ((defined(ANI_OS_TYPE_QNX) && defined(ANI_LITTLE_BYTE_ENDIAN)) || \
103 (defined(ANI_OS_TYPE_ANDROID) && defined(ANI_LITTLE_BYTE_ENDIAN)))
Jeff Johnson295189b2012-06-20 16:38:30 -0700104 *ptr++ = (tANI_U8) (u32Val & 0xff);
105 *ptr++ = (tANI_U8) ((u32Val >> 8) & 0xff);
106 *ptr++ = (tANI_U8) ((u32Val >> 16) & 0xff);
107 *ptr = (tANI_U8) ((u32Val >> 24) & 0xff);
108#else
109#error "Unknown combination of OS Type and endianess"
110#endif
111}
112
113static inline tANI_U32 limGetU32(tANI_U8 *ptr)
114{
Jeff Johnson8347b442013-03-07 08:15:44 -0800115#if ((defined(ANI_OS_TYPE_QNX) && defined(ANI_LITTLE_BYTE_ENDIAN)) || \
116 (defined(ANI_OS_TYPE_ANDROID) && defined(ANI_LITTLE_BYTE_ENDIAN)))
Jeff Johnson295189b2012-06-20 16:38:30 -0700117 return ((*(ptr+3) << 24) |
118 (*(ptr+2) << 16) |
119 (*(ptr+1) << 8) |
120 (*(ptr)));
121#else
122#error "Unknown combination of OS Type and endianess"
123#endif
124}
125
126#endif /* __LIM_SERDES_UTILS_H */
127