blob: a660b23adb1dcd739de9aa791bcca0051a1c661d [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Jeff Johnson32d95a32012-09-10 13:15:23 -07002 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -07003 *
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.
20 */
21
22/*
23 *
24 * Airgo Networks, Inc proprietary. All rights reserved.
25 * This file limSerDesUtils.h contains the utility definitions
26 * LIM uses while processing messages from upper layer software
27 * modules
28 * Author: Chandra Modumudi
29 * Date: 10/20/02
30 * History:-
31 * Date Modified by Modification Information
32 * --------------------------------------------------------------------
33 */
34#ifndef __LIM_SERDES_UTILS_H
35#define __LIM_SERDES_UTILS_H
36
37#include "sirApi.h"
38#include "aniSystemDefs.h"
39#include "sirMacProtDef.h"
40#include "utilsApi.h"
41#include "limTypes.h"
42#include "limPropExtsUtils.h"
43
44tSirRetStatus limStartBssReqSerDes(tpAniSirGlobal, tpSirSmeStartBssReq, tANI_U8 *);
45tSirRetStatus limStopBssReqSerDes(tpAniSirGlobal, tpSirSmeStopBssReq, tANI_U8 *);
46tSirRetStatus limJoinReqSerDes(tpAniSirGlobal, tpSirSmeJoinReq, tANI_U8 *);
47void limAssocIndSerDes(tpAniSirGlobal, tpLimMlmAssocInd, tANI_U8 *, tpPESession);
48void limReassocIndSerDes(tpAniSirGlobal, tpLimMlmReassocInd, tANI_U8 *, tpPESession psessionEntry);
49tSirRetStatus limAssocCnfSerDes(tpAniSirGlobal, tpSirSmeAssocCnf, tANI_U8 *);
50tSirRetStatus limDisassocCnfSerDes(tpAniSirGlobal, tpSirSmeDisassocCnf, tANI_U8 *);
51tSirRetStatus limSetContextReqSerDes(tpAniSirGlobal, tpSirSmeSetContextReq, tANI_U8 *);
52tSirRetStatus limDisassocReqSerDes(tpAniSirGlobal, tSirSmeDisassocReq *, tANI_U8 *);
53tSirRetStatus limDeauthReqSerDes(tpAniSirGlobal, tSirSmeDeauthReq *, tANI_U8 *);
54void limAuthIndSerDes(tpAniSirGlobal, tpLimMlmAuthInd, tANI_U8 *);
55void limStatSerDes(tpAniSirGlobal, tpAniStaStatStruct, tANI_U8 *);
56void limGetSessionInfo(tpAniSirGlobal pMac, tANI_U8 *, tANI_U8 *, tANI_U16 *);
57
58#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && (WNI_POLARIS_FW_PRODUCT == AP)
59tSirRetStatus limMeasurementReqSerDes(tpAniSirGlobal, tpSirSmeMeasurementReq, tANI_U8 *);
60void limMeasurementIndSerDes(tpAniSirGlobal, tANI_U8 *);
61void limCopyNeighborInfoToCfg(tpAniSirGlobal, tSirNeighborBssInfo);
62tSirRetStatus limWdsReqSerDes(tpAniSirGlobal, tpSirSmeSetWdsInfoReq, tANI_U8 *);
63tSirRetStatus limRadioInfoSerDes(tpAniSirGlobal, tpSirRadarInfo, tANI_U8 *, tANI_U16 *, tANI_U32);
64tSirRetStatus limSmeWmStatusChangeHeaderSerDes(tpAniSirGlobal, tSirSmeStatusChangeCode, tANI_U8 *, tANI_U16 *, tANI_U32, tANI_U8);
65tSirRetStatus nonTitanBssFoundSerDes( tpAniSirGlobal, tpSirNeighborBssWdsInfo, tANI_U8 *, tANI_U16 *, tANI_U8 );
66#endif
67
68void limPackBkgndScanFailNotify(tpAniSirGlobal, tSirSmeStatusChangeCode,
69 tpSirBackgroundScanInfo, tSirSmeWmStatusChangeNtf *, tANI_U8);
70
71#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
72tANI_U32 limCopyNeighborBssInfo(tpAniSirGlobal, tANI_U8 *, tpSirNeighborBssInfo);
73tANI_U32 limGetNeighborBssInfo(tpAniSirGlobal, tpSirNeighborBssInfo, tANI_U8 *);
74#endif
75
76tSirRetStatus limRemoveKeyReqSerDes(tpAniSirGlobal pMac, tpSirSmeRemoveKeyReq pRemoveKeyReq, tANI_U8 * pBuf);
77
78#ifdef WLAN_SOFTAP_FEATURE
79tANI_BOOLEAN limIsSmeGetAssocSTAsReqValid(tpAniSirGlobal pMac, tpSirSmeGetAssocSTAsReq pGetAssocSTAsReq, tANI_U8 *pBuf);
80tSirRetStatus limTkipCntrMeasReqSerDes(tpAniSirGlobal pMac, tpSirSmeTkipCntrMeasReq ptkipCntrMeasReq, tANI_U8 *pBuf);
81
82tSirRetStatus limUpdateAPWPSIEsReqSerDes(tpAniSirGlobal pMac, tpSirUpdateAPWPSIEsReq pUpdateAPWPSIEsReq, tANI_U8 *pBuf);
83tSirRetStatus limUpdateAPWPARSNIEsReqSerDes(tpAniSirGlobal pMac, tpSirUpdateAPWPARSNIEsReq pUpdateAPWPARSNIEsReq, tANI_U8 *pBuf);
84#endif
85
86#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && (WNI_POLARIS_FW_PRODUCT == AP)
87tANI_BOOLEAN limIsSmeSwitchChannelReqValid(tpAniSirGlobal, tANI_U8 *, tpSirSmeSwitchChannelReq);
88#endif
89
90// Byte String <--> tANI_U16/tANI_U32 copy functions
91static inline void limCopyU16(tANI_U8 *ptr, tANI_U16 u16Val)
92{
93#if defined(ANI_PRODUCT_TYPE_AP)
94 *ptr++ = (tANI_U8) ((u16Val >> 8) & 0xff);
95 *ptr = (tANI_U8) (u16Val & 0xff);
96#elif ((defined(ANI_OS_TYPE_OSX) && defined(ANI_LITTLE_BYTE_ENDIAN)) || \
97 (defined(ANI_OS_TYPE_WINDOWS) && defined(ANI_LITTLE_BYTE_ENDIAN)) || \
98 (defined(ANI_OS_TYPE_AMSS) && defined(ANI_LITTLE_BYTE_ENDIAN)) || \
99 (defined(ANI_OS_TYPE_ANDROID) && defined(ANI_LITTLE_BYTE_ENDIAN)))
100 *ptr++ = (tANI_U8) (u16Val & 0xff);
101 *ptr = (tANI_U8) ((u16Val >> 8) & 0xff);
102#else
103#error "Unknown combination of OS Type and endianess"
104#endif
105}
106
107static inline tANI_U16 limGetU16(tANI_U8 *ptr)
108{
109#if defined(ANI_PRODUCT_TYPE_AP)
110 return (((tANI_U16) (*ptr << 8)) |
111 ((tANI_U16) (*(ptr+1))));
112#elif ((defined(ANI_OS_TYPE_OSX) && defined(ANI_LITTLE_BYTE_ENDIAN)) || \
113 (defined(ANI_OS_TYPE_WINDOWS) && defined(ANI_LITTLE_BYTE_ENDIAN)) || \
114 (defined(ANI_OS_TYPE_AMSS) && defined(ANI_LITTLE_BYTE_ENDIAN)) || \
115 (defined(ANI_OS_TYPE_ANDROID) && defined(ANI_LITTLE_BYTE_ENDIAN)))
116 return (((tANI_U16) (*(ptr+1) << 8)) |
117 ((tANI_U16) (*ptr)));
118#else
119#error "Unknown combination of OS Type and endianess"
120#endif
121}
122
123static inline void limCopyU32(tANI_U8 *ptr, tANI_U32 u32Val)
124{
125#if defined(ANI_PRODUCT_TYPE_AP)
126 *ptr++ = (tANI_U8) ((u32Val >> 24) & 0xff);
127 *ptr++ = (tANI_U8) ((u32Val >> 16) & 0xff);
128 *ptr++ = (tANI_U8) ((u32Val >> 8) & 0xff);
129 *ptr = (tANI_U8) (u32Val & 0xff);
130#elif ((defined(ANI_OS_TYPE_OSX) && defined(ANI_LITTLE_BYTE_ENDIAN)) || \
131 (defined(ANI_OS_TYPE_WINDOWS) && defined(ANI_LITTLE_BYTE_ENDIAN)) || \
132 (defined(ANI_OS_TYPE_AMSS) && defined(ANI_LITTLE_BYTE_ENDIAN)) || \
133 (defined(ANI_OS_TYPE_ANDROID) && defined(ANI_LITTLE_BYTE_ENDIAN)))
134 *ptr++ = (tANI_U8) (u32Val & 0xff);
135 *ptr++ = (tANI_U8) ((u32Val >> 8) & 0xff);
136 *ptr++ = (tANI_U8) ((u32Val >> 16) & 0xff);
137 *ptr = (tANI_U8) ((u32Val >> 24) & 0xff);
138#else
139#error "Unknown combination of OS Type and endianess"
140#endif
141}
142
143static inline tANI_U32 limGetU32(tANI_U8 *ptr)
144{
145#if defined(ANI_PRODUCT_TYPE_AP)
146 return ((*(ptr) << 24) |
147 (*(ptr+1) << 16) |
148 (*(ptr+2) << 8) |
149 (*(ptr+3)));
150#elif ((defined(ANI_OS_TYPE_OSX) && defined(ANI_LITTLE_BYTE_ENDIAN)) || \
151 (defined(ANI_OS_TYPE_WINDOWS) && defined(ANI_LITTLE_BYTE_ENDIAN)) || \
152 (defined(ANI_OS_TYPE_AMSS) && defined(ANI_LITTLE_BYTE_ENDIAN)) || \
153 (defined(ANI_OS_TYPE_ANDROID) && defined(ANI_LITTLE_BYTE_ENDIAN)))
154 return ((*(ptr+3) << 24) |
155 (*(ptr+2) << 16) |
156 (*(ptr+1) << 8) |
157 (*(ptr)));
158#else
159#error "Unknown combination of OS Type and endianess"
160#endif
161}
162
163#endif /* __LIM_SERDES_UTILS_H */
164