Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Gopichand Nakkala | 92f07d8 | 2013-01-08 21:16:34 -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. |
| 20 | */ |
| 21 | /* |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 22 | * Copyright (c) 2012, The Linux Foundation. All rights reserved. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 23 | * |
| 24 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 25 | * |
| 26 | * |
| 27 | * Permission to use, copy, modify, and/or distribute this software for |
| 28 | * any purpose with or without fee is hereby granted, provided that the |
| 29 | * above copyright notice and this permission notice appear in all |
| 30 | * copies. |
| 31 | * |
| 32 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 33 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 34 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 35 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 36 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 37 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 38 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 39 | * PERFORMANCE OF THIS SOFTWARE. |
| 40 | */ |
| 41 | |
| 42 | #ifndef __VOSS_WRAPPER_H |
| 43 | #define __VOSS_WRAPPER_H |
| 44 | |
| 45 | #ifdef __cplusplus |
| 46 | extern "C" { |
| 47 | #endif |
| 48 | |
| 49 | /*=========================================================================== |
| 50 | @file VossWrapper.h |
| 51 | |
| 52 | @brief This header file contains the various structure definitions and |
| 53 | function prototypes for the RTOS abstraction layer, implemented for VOSS |
| 54 | |
| 55 | Copyright (c) 2008 QUALCOMM Incorporated. |
| 56 | All Rights Reserved. |
| 57 | Qualcomm Confidential and Proprietary |
| 58 | ===========================================================================*/ |
| 59 | |
| 60 | /*=========================================================================== |
| 61 | |
| 62 | EDIT HISTORY FOR FILE |
| 63 | |
| 64 | |
| 65 | This section contains comments describing changes made to the module. |
| 66 | Notice that changes are listed in reverse chronological order. |
| 67 | |
| 68 | |
| 69 | $Header:$ $DateTime: $ $Author: $ |
| 70 | |
| 71 | |
| 72 | when who what, where, why |
| 73 | -------- --- -------------------------------------------------------- |
| 74 | 12/15/08 sho Resolved warnings and errors from AMSS compiler when |
| 75 | this is ported to WM |
| 76 | 11/20/08 sho Renamed this to VossWrapper.h; remove all dependencies |
| 77 | on WM platform and allow this to work on all VOSS enabled |
| 78 | platforms |
| 79 | 06/24/08 tbh Modified the file to remove the dependecy on HDD files as |
| 80 | part of Gen6 bring up process. |
| 81 | 10/29/02 Neelay Das Created file. |
| 82 | |
| 83 | ===========================================================================*/ |
| 84 | |
| 85 | /*--------------------------------------------------------------------------- |
| 86 | * Include Files |
| 87 | * ------------------------------------------------------------------------*/ |
| 88 | |
| 89 | #include "sirTypes.h" |
| 90 | #include "sirParams.h" |
| 91 | #include "sysDef.h" |
| 92 | #ifdef FEATURE_WLAN_NON_INTEGRATED_SOC |
| 93 | #include "halDataStruct.h" |
| 94 | #endif |
| 95 | #include "aniDbgTest.h" |
| 96 | #include "vos_timer.h" |
| 97 | #include "palApi.h" |
| 98 | #include "vos_types.h" |
| 99 | #ifdef FEATURE_WLAN_INTEGRATED_SOC |
| 100 | #include "vos_trace.h" |
| 101 | #include "vos_memory.h" |
| 102 | #endif |
| 103 | |
| 104 | /* Interlocked Compare Exchange related definitions */ |
| 105 | |
| 106 | |
| 107 | |
| 108 | /* Define basic constants for the ThreadX kernel. */ |
| 109 | |
| 110 | #define TX_NO_WAIT 0 |
| 111 | #define TX_WAIT_FOREVER 0xFFFFFFFFUL |
| 112 | #define TX_AUTO_ACTIVATE 1 |
| 113 | #define TX_NO_ACTIVATE 0 |
| 114 | |
| 115 | |
| 116 | |
| 117 | /* API return values. */ |
| 118 | #define TX_SUCCESS 0x00 |
| 119 | #define TX_QUEUE_FULL 0x01 |
| 120 | // ... |
| 121 | #define TX_NO_INSTANCE 0x0D |
| 122 | // ... |
| 123 | #define TX_TIMER_ERROR 0x15 |
| 124 | #define TX_TICK_ERROR 0x16 |
| 125 | // ... |
| 126 | |
| 127 | |
| 128 | #ifndef true |
| 129 | #define true 1 |
| 130 | #endif |
| 131 | |
| 132 | #ifndef false |
| 133 | #define false 0 |
| 134 | #endif |
| 135 | |
| 136 | /* Following macro specifies the number of milliseconds which constitute 1 ThreadX timer tick. Used |
| 137 | for mimicking the ThreadX timer behaviour on VOSS. */ |
| 138 | // Use the same MACRO used by firmware modules to calculate TICKs from mSec |
| 139 | // Mismatch would cause worng timer value to be programmed |
| 140 | #define TX_MSECS_IN_1_TICK SYS_TICK_DUR_MS |
| 141 | |
| 142 | // Signature with which the TX_TIMER struct is initialized, when the timer is created |
| 143 | #define TX_AIRGO_TMR_SIGNATURE 0xDEADBEEF |
| 144 | |
| 145 | |
| 146 | /* Just #define out the thread and queue specific threadX calls, since the plan is to keep |
| 147 | the Windows port of the MAC non-threaded */ |
| 148 | |
| 149 | #define tx_thread_create(a, b, c, d, e, f, g, h, i) |
| 150 | #define tx_thread_delete(a) |
| 151 | #define tx_thread_resume(a) |
| 152 | |
| 153 | // Please note that for the Windows implementation for this routine the time is specified in terms of |
| 154 | // microseconds and not timer ticks. Also, the DDK recommends that this routine should not be called with |
| 155 | // sleep durations of more than 50 usecs. |
| 156 | #define tx_thread_sleep(uSecs) |
| 157 | |
| 158 | #define tx_thread_suspend(a) |
| 159 | #define tx_thread_terminate(a) |
| 160 | #define tx_thread_identify() NULL |
| 161 | |
| 162 | #define tx_queue_create(a, b, c, d, e) TX_SUCCESS |
| 163 | #define tx_queue_delete(a) TX_SUCCESS |
| 164 | #define tx_queue_get_ptr(a) TX_SUCCESS |
| 165 | #define tx_queue_flush(a) TX_SUCCESS |
| 166 | #define tx_queue_receive(a, b, c) TX_SUCCESS |
| 167 | #define tx_queue_send(a, b, c) TX_SUCCESS |
| 168 | |
| 169 | #define tx_disable_intr() |
| 170 | #define tx_enable_intr() |
| 171 | |
| 172 | |
| 173 | #define TX_DISABLE_INTR tx_disable_intr() |
| 174 | #define TX_ENABLE_INTR tx_enable_intr() |
| 175 | |
| 176 | #ifdef TIMER_MANAGER |
| 177 | #define tx_timer_create(a, b, c, d, e, f, g) tx_timer_create_intern_debug((v_PVOID_t)pMac, a, b, c, d, e, f, g, __FILE__, __LINE__) |
| 178 | #else |
| 179 | #define tx_timer_create(a, b, c, d, e, f, g) tx_timer_create_intern((v_PVOID_t)pMac, a, b, c, d, e, f, g) |
| 180 | #endif |
| 181 | |
| 182 | |
| 183 | /*-------------------------------------------------------------------------*/ |
| 184 | /* ThreadX structures are not mapped to Windows structures for the */ |
| 185 | /* following reasons: */ |
| 186 | /* - Windows structures are written in C and they are not C++ aware. */ |
| 187 | /* - There should not be any dependency between MAC FW include tree */ |
| 188 | /* and Windows include tree. */ |
| 189 | /* */ |
| 190 | /* Instead, ThreadX structures are defined here as void*. This will be */ |
| 191 | /* used by the wrapper functions to save the pointer of the actual Windows*/ |
| 192 | /* structure. Windows structure is allocated in ? */ |
| 193 | /*-------------------------------------------------------------------------*/ |
| 194 | |
| 195 | typedef v_PVOID_t TX_THREAD; |
| 196 | typedef v_PVOID_t TX_QUEUE; |
| 197 | typedef v_PVOID_t TX_MUTEX; |
| 198 | |
| 199 | /*--------------------------------------------------------------------*/ |
| 200 | /* Semaphore structure */ |
| 201 | /* This structure is used to mimic the binary semaphore functionality */ |
| 202 | /* available on ThreadX. */ |
| 203 | /*--------------------------------------------------------------------*/ |
| 204 | typedef v_SLONG_t TX_SEMAPHORE; |
| 205 | |
| 206 | /*--------------------------------------------------------------------*/ |
| 207 | /* Timer structure */ |
| 208 | /* This structure is used to implement ThreadX timer facility. Just */ |
| 209 | /* like ThreadX, timer expiration handler executes at the highest */ |
| 210 | /* possible priority level, i.e. DISPATCH_LEVEL. */ |
| 211 | /*--------------------------------------------------------------------*/ |
| 212 | typedef struct TX_TIMER_STRUCT |
| 213 | { |
| 214 | #ifdef WLAN_DEBUG |
| 215 | #define TIMER_MAX_NAME_LEN 50 |
| 216 | char timerName[TIMER_MAX_NAME_LEN]; |
| 217 | #endif |
| 218 | v_ULONG_t tmrSignature; |
| 219 | v_VOID_t (*pExpireFunc)(v_PVOID_t, tANI_U32); |
| 220 | tANI_U32 expireInput; |
| 221 | v_ULONG_t initScheduleTimeInMsecs; |
| 222 | v_ULONG_t rescheduleTimeInMsecs; |
| 223 | vos_timer_t vosTimer; |
| 224 | |
| 225 | // Pointer to the MAC global structure, which stores the context for the NIC, |
| 226 | // for which this timer is supposed to operate. |
| 227 | v_PVOID_t pMac; |
| 228 | tANI_U8 sessionId; |
| 229 | |
| 230 | } TX_TIMER; |
| 231 | |
| 232 | #define TX_TIMER_VALID(timer) (timer.pMac != 0) |
| 233 | |
| 234 | typedef struct sAniSirTxWrapper |
| 235 | { |
| 236 | // Back pointer to the pAdapter structure, needed for some of the internal routines |
| 237 | v_PVOID_t pAdapter; |
| 238 | |
| 239 | } tAniSirTxWrapper, *tpAniSirTxWrapper; |
| 240 | |
| 241 | |
| 242 | |
| 243 | extern v_ULONG_t tx_time_get(v_VOID_t); |
| 244 | extern v_UINT_t tx_timer_activate(TX_TIMER*); |
| 245 | extern v_UINT_t tx_timer_change(TX_TIMER*, v_ULONG_t, v_ULONG_t); |
| 246 | extern v_UINT_t tx_timer_change_context(TX_TIMER*, tANI_U32); |
| 247 | #ifdef TIMER_MANAGER |
| 248 | extern v_UINT_t tx_timer_create_intern_debug(v_PVOID_t, TX_TIMER*, char *, v_VOID_t(*)(v_PVOID_t, tANI_U32), |
| 249 | tANI_U32, v_ULONG_t, v_ULONG_t, v_ULONG_t, char* fileName, v_U32_t lineNum ); |
| 250 | #else |
| 251 | extern v_UINT_t tx_timer_create_intern(v_PVOID_t, TX_TIMER*, char *, v_VOID_t(*)(v_PVOID_t, tANI_U32), tANI_U32, v_ULONG_t, v_ULONG_t, v_ULONG_t); |
| 252 | #endif |
| 253 | extern v_UINT_t tx_timer_deactivate(TX_TIMER*); |
| 254 | extern v_UINT_t tx_timer_delete(TX_TIMER*); |
| 255 | extern v_BOOL_t tx_timer_running(TX_TIMER*); |
| 256 | |
| 257 | |
| 258 | |
| 259 | // Routines needed to initialize and cleanup the Windows wrapper |
| 260 | extern v_VOID_t tx_voss_wrapper_init(v_PVOID_t, v_PVOID_t); |
| 261 | |
| 262 | #define schAddDphActivityQueueWin( a, b, c ) |
| 263 | |
| 264 | // Debug display related globals |
| 265 | extern v_ULONG_t gDbgLevel; |
| 266 | extern v_ULONG_t gDbgMask; |
| 267 | extern int gHalBufCnt; |
| 268 | |
| 269 | /* forward declaration From HDDUtil.h used by some internal files */ |
| 270 | |
| 271 | extern v_U64_t utilGetCurrentTime(void); |
| 272 | |
| 273 | |
| 274 | #ifdef __cplusplus |
| 275 | } |
| 276 | #endif |
| 277 | |
| 278 | |
| 279 | #endif |
| 280 | |
| 281 | |
| 282 | |