blob: edb174bdbbf008ff8b2e98b5fa18a3726ac49ba4 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Agrawal Ashish01c66342017-01-27 12:52:25 +05302 * Copyright (c) 2012-2013, 2017 The Linux Foundation. All rights reserved.
Kiet Lam1ed83fc2014-02-19 01:15:45 -08003 *
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 Nakkala92f07d82013-01-08 21:16:34 -080020 */
Kiet Lam1ed83fc2014-02-19 01:15:45 -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
Jeff Johnson295189b2012-06-20 16:38:30 -070028/** ------------------------------------------------------------------------- *
29 ------------------------------------------------------------------------- *
30
31
32 \file halTypes.h
33
34 \brief This header captures types that must be shared in common with individual
35 module headers before inclusion into halCommonApi.h.
36
37 $Id$
38
Jeff Johnson295189b2012-06-20 16:38:30 -070039
40 ========================================================================== */
41
42#ifndef HALTYPES_H
43#define HALTYPES_H
44#ifndef WINXP_APPS_BUILD //TODO: this header dependency does not belong in this file
Jeff Johnson295189b2012-06-20 16:38:30 -070045
46#endif /* WINXP_APPS_BUILD */
47
48#include "palTypes.h"
49#include "wlan_nv.h"
50
51#define OFFSET_OF(structType,fldName) (&((structType*)0)->fldName)
52
53/** ------------------------------------------------------------------------- *
54
55 \typedef tHalHandle
56
57 \brief Handle to the HAL. The HAL handle is returned by the HAL after it
58 is opened (by calling halOpen).
59
60 -------------------------------------------------------------------------- */
61typedef void *tHalHandle;
62
63// define a value for an invalid HAL handle.....
64#define HAL_INVALID_HAL_HANDLE ( NULL )
65
66
67/** ------------------------------------------------------------------------- *
68
69 \enum eHalStatus
70
71 \brief Enumeration of all status codes returned by the higher level
72 HAL interface functions.
73
74 -------------------------------------------------------------------------- */
75typedef enum
76{
77 eHAL_STATUS_SUCCESS,
78
79 // general failure. This status applies to all failure that are not covered
80 // by more specific return codes.
81 eHAL_STATUS_FAILURE,
82 eHAL_STATUS_FAILED_ALLOC,
83 eHAL_STATUS_RESOURCES,
84
85 // the HAL has not been opened and a HAL function is being attempted.
86 eHAL_STATUS_NOT_OPEN,
87
88 // function failed due to the card being removed...
89 eHAL_STATUS_CARD_NOT_PRESENT,
90
91 //halInterrupt status
92 eHAL_STATUS_INTERRUPT_ENABLED,
93 eHAL_STATUS_INTERRUPT_DISABLED,
94 eHAL_STATUS_NO_INTERRUPTS,
95 eHAL_STATUS_INTERRUPT_PRESENT,
96 eHAL_STATUS_ALL_INTERRUPTS_PROCESSED,
97 eHAL_STATUS_INTERRUPT_NOT_PROCESSED, //interrupt cleared but no Isr to process
98
99 // a parameter on the PAL function call is not valid.
100 eHAL_STATUS_INVALID_PARAMETER,
101
102 // the PAL has not been initialized...
103 eHAL_STATUS_NOT_INITIALIZED,
104
105 // Error codes for PE-HAL message API
106 eHAL_STATUS_INVALID_STAIDX,
107 eHAL_STATUS_INVALID_BSSIDX,
108 eHAL_STATUS_STA_TABLE_FULL, // No space to add more STA, sta table full.
109 eHAL_STATUS_BSSID_TABLE_FULL,
110 eHAL_STATUS_DUPLICATE_BSSID,
111 eHAL_STATUS_DUPLICATE_STA,
112 eHAL_STATUS_BSSID_INVALID,
113 eHAL_STATUS_STA_INVALID,
114 eHAL_STATUS_INVALID_KEYID,
115 eHAL_STATUS_INVALID_SIGNATURE,
116
117 //DXE
118 eHAL_STATUS_DXE_FAILED_NO_DESCS,
119 eHAL_STATUS_DXE_CHANNEL_NOT_CONFIG, // Channel not configured
120 eHAL_STATUS_DXE_CHANNEL_MISUSE, // Specified operation inconsistent w/ configuration
121 eHAL_STATUS_DXE_VIRTUAL_MEM_ALLOC_ERROR, //
122 eHAL_STATUS_DXE_SHARED_MEM_ALLOC_ERROR, //
123 eHAL_STATUS_DXE_INVALID_CHANNEL,
124 eHAL_STATUS_DXE_INVALID_CALLBACK,
125 eHAL_STATUS_DXE_INCONSISTENT_DESC_COUNT,
126 eHAL_STATUS_DXE_XFR_QUEUE_ERROR,
127 eHAL_STATUS_DXE_INVALID_BUFFER,
128 eHAL_STATUS_DXE_INCOMPLETE_PACKET,
129 eHAL_STATUS_DXE_INVALID_PARAMETER,
130 eHAL_STATUS_DXE_CH_ALREADY_CONFIGURED,
131 eHAL_STATUS_DXE_USB_INVALID_EP,
132 eHAL_STATUS_DXE_GEN_ERROR,
133
134
135 // status codes added for the ImageValidate library
136 eHAL_STATUS_E_NULL_VALUE,
137 eHAL_STATUS_E_FILE_NOT_FOUND,
138 eHAL_STATUS_E_FILE_INVALID_CONTENT,
139 eHAL_STATUS_E_MALLOC_FAILED,
140 eHAL_STATUS_E_FILE_READ_FAILED,
141 eHAL_STATUS_E_IMAGE_INVALID,
142 eHAL_STATUS_E_IMAGE_UNSUPPORTED,
143
144 // status code returned by device memory calls when memory is
145 // not aligned correctly.
146 eHAL_STATUS_DEVICE_MEMORY_MISALIGNED, // memory access is not aligned on a 4 byte boundary
147 eHAL_STATUS_DEVICE_MEMORY_LENGTH_ERROR, // memory access is not a multiple of 4 bytes
148
149 // Generic status code to indicate network congestion.
150 eHAL_STATUS_NET_CONGESTION,
151
152 // various status codes for Rx packet dropped conditions... Note the Min and Max
153 // enums that bracked the Rx Packet Dropped status codes. There is code that
154 // looks at the various packet dropped conditions so make sure these min / max
155 // enums remain accurate.
156 eHAL_STATUS_RX_PACKET_DROPPED,
157 eHAL_STATUS_RX_PACKET_DROPPED_MIN = eHAL_STATUS_RX_PACKET_DROPPED,
158 eHAL_STATUS_RX_PACKET_DROPPED_NULL_DATA,
159 eHAL_STATUS_RX_PACKET_DROPPED_WDS_FRAME,
160 eHAL_STATUS_RX_PACKET_DROPPED_FILTERED,
161 eHAL_STATUS_RX_PACKET_DROPPED_GROUP_FROM_SELF,
162 eHAL_STATUS_RX_PACKET_DROPPED_MAX = eHAL_STATUS_RX_PACKET_DROPPED_GROUP_FROM_SELF,
163
164 // Status indicating that PMU did not power up and hence indicative of the fact that the clocks are not on
165 eHAL_STATUS_PMU_NOT_POWERED_UP,
166
167 // Queuing code for BA message API
168 eHAL_STATUS_BA_ENQUEUED, // packets have been buffered in Host
169 eHAL_STATUS_BA_INVALID,
170
171 // A-MPDU/BA related Error codes
172 eHAL_STATUS_BA_RX_BUFFERS_FULL,
173 eHAL_STATUS_BA_RX_MAX_SESSIONS_REACHED,
174 eHAL_STATUS_BA_RX_INVALID_SESSION_ID,
175
176 // !!LAC - can we rework the code so these are not needed?
177 eHAL_STATUS_BA_RX_DROP_FRAME,
178 eHAL_STATUS_BA_RX_INDICATE_FRAME,
179 eHAL_STATUS_BA_RX_ENQUEUE_FRAME,
180
181 // PMC return codes.
182 eHAL_STATUS_PMC_PENDING,
183 eHAL_STATUS_PMC_DISABLED,
184 eHAL_STATUS_PMC_NOT_NOW,
185 eHAL_STATUS_PMC_AC_POWER,
186 eHAL_STATUS_PMC_SYS_ERROR,
187 eHAL_STATUS_PMC_CANNOT_ENTER_IMPS,
188 eHAL_STATUS_PMC_ALREADY_IN_IMPS,
189
190 eHAL_STATUS_HEARTBEAT_TMOUT,
191 eHAL_STATUS_NTH_BEACON_DELIVERY,
192
193 //CSR
194 eHAL_STATUS_CSR_WRONG_STATE,
195
196 // DPU
197 eHAL_STATUS_DPU_DESCRIPTOR_TABLE_FULL,
198 eHAL_STATUS_DPU_MICKEY_TABLE_FULL,
199
200 // HAL-FW messages
201 eHAL_STATUS_FW_MSG_FAILURE, // Error in Hal-FW message interface
202 eHAL_STATUS_FW_MSG_TIMEDOUT,
203 eHAL_STATUS_FW_MSG_INVALID,
204 eHAL_STATUS_FW_SEND_MSG_FAILED,
205 eHAL_STATUS_FW_PS_BUSY,
206
207 eHAL_STATUS_TIMER_START_FAILED,
208 eHAL_STATUS_TIMER_STOP_FAILED,
209
210 eHAL_STATUS_TL_SUSPEND_TIMEOUT,
211
212 eHAL_STATUS_UMA_DESCRIPTOR_TABLE_FULL,
213
214 eHAL_STATUS_SET_CHAN_ALREADY_ON_REQUESTED_CHAN,
215
Gopichand Nakkalad7d13652013-02-15 01:48:00 +0530216#ifdef WLAN_FEATURE_VOWIFI_11R
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530217 eHAL_STATUS_FT_PREAUTH_KEY_SUCCESS,
218 eHAL_STATUS_FT_PREAUTH_KEY_FAILED,
Gopichand Nakkalad7d13652013-02-15 01:48:00 +0530219#endif
Abhishek Singhdc2bfd42014-06-19 17:59:05 +0530220 //CMD not Queued in SME
221 eHAL_STATUS_CMD_NOT_QUEUED,
Padma, Santhosh Kumar9f729552017-01-09 14:06:30 +0530222
223#ifdef WLAN_FEATURE_LFR_MBB
224 eHAL_STATUS_MBB_DEL_BSS_FAIL,
225#endif
226
Jeff Johnson295189b2012-06-20 16:38:30 -0700227 // not a real status. Just a way to mark the maximum in the enum.
228 eHAL_STATUS_MAX
229
230} eHalStatus;
231
Kiet Lama72a2322013-11-15 11:18:11 +0530232typedef enum
233{
234 HAL_STOP_TYPE_SYS_RESET,
235 HAL_STOP_TYPE_SYS_DEEP_SLEEP,
236 HAL_STOP_TYPE_RF_KILL,
237}tHalStopType;
Jeff Johnson295189b2012-06-20 16:38:30 -0700238
239// macro to check for SUCCESS value of the halStatus
240#define HAL_STATUS_SUCCESS( variable ) ( eHAL_STATUS_SUCCESS == ( variable ) )
241
242/// Bit value data structure
243typedef enum sHalBitVal // For Bit operations
244{
245 eHAL_CLEAR,
246 eHAL_SET
247}tHalBitVal;
248
249// -------------------------------------------------------------
250/// MMH APIs
251enum {
252 eHI_PRI,
253 ePROT,
254 eDBG
255};
256
257/// System role definition on a per BSS
258typedef enum eBssSystemRole
259{
260 eSYSTEM_UNKNOWN_ROLE,
261 eSYSTEM_AP_ROLE,
262 eSYSTEM_STA_IN_IBSS_ROLE,
263 eSYSTEM_STA_ROLE,
264 eSYSTEM_BTAMP_STA_ROLE,
265 eSYSTEM_BTAMP_AP_ROLE,
266
267 eSYSTEM_LAST_ROLE,
268 eSYSTEM_MULTI_BSS_ROLE = eSYSTEM_LAST_ROLE
269} tBssSystemRole;
270
271
272// ---------------------------------------
273// Channel Bonding Sideband configuration
274// ---------------------------------------
275typedef enum sHalCBsidebandType
276{
277 eHAL_SIDEBAND_CENTER=0,
278 eHAL_SIDEBAND_LOWER,
279 eHAL_SIDEBAND_UPPER,
280 eHAL_SIDEBAND_COPY
281}tHalCBsidebandType;
282
283
284/// HAL states
285typedef enum {
286 eHAL_IDLE,
287 eHAL_INIT,
288 eHAL_CFG, //CFG download completed.
289 eHAL_STARTED, //halProcessStartEvent compelted.
290 eHAL_SYS_READY, //Sys_ready msg received from HDD.
291 eHAL_NORMAL, //Sys_ready msg received from HDD and halProcessStartEvent completed.
292} tHAL_STATE;
293
294
295
296
297// Type to define softmac mode (also system mode)
298typedef enum
299{
300 //3- Promisc, 2 - Scan, 1 - Learn 0 - Normal
301 eHAL_SYS_MODE_NORMAL = 0,
302 eHAL_SYS_MODE_LEARN,
303 eHAL_SYS_MODE_SCAN,
304 eHAL_SYS_MODE_PROMISC,
Madan Mohan Koyyalamudi9b876782012-10-11 16:22:51 -0700305 eHAL_SYS_MODE_SUSPEND_LINK,
306 eHAL_SYS_MODE_ROAM_SCAN,
307 eHAL_SYS_MODE_ROAM_SUSPEND_LINK,
Jeff Johnson295189b2012-06-20 16:38:30 -0700308} eHalSysMode;
309
310
311
312
313// HAL frame types. Used on the TxRx APIs and the
314// corresponding PAL routines.
315typedef enum {
316
317 HAL_TXRX_FRM_RAW,
318 HAL_TXRX_FRM_ETH2,
319 HAL_TXRX_FRM_802_3,
320 HAL_TXRX_FRM_802_11_MGMT,
321 HAL_TXRX_FRM_802_11_CTRL,
322 HAL_TXRX_FRM_802_11_DATA,
323 HAL_TXRX_FRM_IGNORED, //This frame will be dropped
324 HAL_TXRX_FRM_MAX
325
326} eFrameType;
327
328
329typedef enum
330{
331 ANI_TXDIR_IBSS = 0,
332 ANI_TXDIR_TODS,
333 ANI_TXDIR_FROMDS,
334 ANI_TXDIR_WDS
335
336} eFrameTxDir;
337
338typedef enum
339{
340 eRF_BAND_UNKNOWN = 0,
341 eRF_BAND_2_4_GHZ = 1,
342 eRF_BAND_5_GHZ = 2
343} eRfBandMode;
344
345
346#ifndef __offsetof
347#define __offsetof(type, field) ((tANI_U32)(&((type *)0)->field))
348#endif
349
350#ifndef offsetof
351#define offsetof(type, field) __offsetof(type, field)
352#endif
353
Jeff Johnson295189b2012-06-20 16:38:30 -0700354#define HAL_MAX_TXPOWER_INVALID 127
355
Agrawal Ashish01c66342017-01-27 12:52:25 +0530356/* These are the min/max tx power (non virtual rates) range
357 * supported by rome/prima hardware
358 */
359#define MIN_TX_PWR_CAP 8
360#define MAX_TX_PWR_CAP 30
Jeff Johnson295189b2012-06-20 16:38:30 -0700361
362/* Moving the miscellaneous defination required by UMAC are moved here from
363 * volansdefs.h */
364/* --------------------------------------------------------------------
365 * Support definitions for taurus
366 * --------------------------------------------------------------------
367 */
368
369/*
370 * Volans supports 8 stations in hardware
371 *
372 * Volans without Virtual STA feature can only support 8 stations:
373 * 1 Broadcast STA (hard)
374 * 1 "Self" STA (hard)
375 * 6 Soft AP Stations (hard)
376 *
377 * Volans with Virtual STA feature supports 14 stations:
378 * 1 Broadcast STA (hard)
379 * 1 "Self" STA (hard)
380 * 2 General Purpose Stations to support Virtual STAs (hard)
381 * 10 Soft AP Stations (4 hard/6 virtual)
382 */
383
Madan Mohan Koyyalamudia53c4dc2012-11-13 10:35:42 -0800384#define HAL_INVALID_BSSIDX (HAL_NUM_BSSID + 1)
Jeff Johnson295189b2012-06-20 16:38:30 -0700385#define HAL_NUM_UMA_DESC_ENTRIES 8
386#define MAX_NUM_OF_BACKOFFS 8
387
388#define IS_VALID_BSSIDX(__x) \
389 ((__x) < HAL_NUM_BSSID)
390
391#ifdef WLAN_SOFTAP_VSTA_FEATURE
Gopichand Nakkala976e3252013-01-03 15:45:56 -0800392#define HAL_NUM_ASSOC_STA 32
Yathish Hanumapuradoddi Shivanna64dfc472013-03-08 10:48:34 -0800393#define HAL_NUM_STA 41
Gopichand Nakkala976e3252013-01-03 15:45:56 -0800394#define HAL_NUM_HW_STA 16
395#define HAL_NUM_GPSTA 4
Madan Mohan Koyyalamudia53c4dc2012-11-13 10:35:42 -0800396#define HAL_NUM_VSTA (HAL_NUM_STA - HAL_NUM_HW_STA)
Jeff Johnson295189b2012-06-20 16:38:30 -0700397
398#define QWLANFW_MAX_NUM_VSTA HAL_NUM_VSTA
Madan Mohan Koyyalamudia53c4dc2012-11-13 10:35:42 -0800399#define QWLANFW_VSTA_INVALID_IDX (HAL_NUM_STA + 1)
Jeff Johnson295189b2012-06-20 16:38:30 -0700400#define QWLAN_VSTA_MIN_IDX HAL_NUM_HW_STA
401#define QWLANFW_NUM_GPSTA HAL_NUM_GPSTA
402
403
404#define IS_VSTA_VALID_IDX(__x) \
405 ((__x) != QWLANFW_VSTA_INVALID_IDX)
406
407#define IS_VSTA_IDX(__x) \
408 (((__x) >= QWLAN_VSTA_MIN_IDX) && ((__x) < HAL_NUM_STA))
409
410
411// is the STA a General Purpose STA?
412#define IS_GPSTA_IDX(__x) \
413 (((__x) >= (HAL_NUM_HW_STA-HAL_NUM_GPSTA)) && \
414 ((__x) < HAL_NUM_HW_STA))
415
416// is the STA a HW STA (excluding GP STAs)
417#define IS_HWSTA_IDX(__x) \
418 ((__x) < (HAL_NUM_HW_STA-HAL_NUM_GPSTA))
419
420#else
421/*In prima 12 HW stations are supported including BCAST STA(staId 0)
422 and SELF STA(staId 1) so total ASSOC stations which can connect to Prima
423 SoftAP = 12 - 1(Self STa) - 1(Bcast Sta) = 10 Stations. */
424#define HAL_NUM_STA 12
425#define HAL_NUM_ASSOC_STA 10
426#define HAL_NUM_HW_STA 12
427#endif
428
429/*
430 * From NOVA Mac Arch document
431 * Encryp. mode The encryption mode
432 * 000: Encryption functionality is not enabled
433 * 001: Encryption is set to WEP
434 * 010: Encryption is set to WEP 104
435 * 011: Encryption is set to TKIP
436 * 100: Encryption is set to AES
437 * 101 - 111: Reserved for future
438 */
439
440#define HAL_ENC_POLICY_NULL 0
441#define HAL_ENC_POLICY_WEP40 1
442#define HAL_ENC_POLICY_WEP104 2
443#define HAL_ENC_POLICY_TKIP 3
444#define HAL_ENC_POLICY_AES_CCM 4
445
446#define STACFG_MAX_TC 8
447
Jeff Johnson295189b2012-06-20 16:38:30 -0700448
449#endif
450