Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame^] | 2 | * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved. |
Kiet Lam | 1ed83fc | 2014-02-19 01:15:45 -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 | 92f07d8 | 2013-01-08 21:16:34 -0800 | [diff] [blame] | 20 | */ |
Kiet Lam | 1ed83fc | 2014-02-19 01:15:45 -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 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 28 | #if !defined( __VOS_SCHED_H ) |
| 29 | #define __VOS_SCHED_H |
| 30 | |
| 31 | /**========================================================================= |
| 32 | |
| 33 | \file vos_sched.h |
| 34 | |
| 35 | \brief virtual Operating System Servies (vOSS) |
| 36 | |
| 37 | Definitions for some of the internal data type that is internally used |
| 38 | by the vOSS scheduler on Windows Mobile. |
| 39 | |
| 40 | This file defines a vOSS message queue on Win Mobile and give some |
| 41 | insights about how the scheduler implements the execution model supported |
| 42 | by vOSS. |
| 43 | |
| 44 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 45 | |
| 46 | ========================================================================*/ |
| 47 | |
| 48 | /*=========================================================================== |
| 49 | |
| 50 | EDIT HISTORY FOR FILE |
| 51 | |
| 52 | |
| 53 | This section contains comments describing changes made to the module. |
| 54 | Notice that changes are listed in reverse chronological order. |
| 55 | |
| 56 | |
| 57 | $Header:$ $DateTime: $ $Author: $ |
| 58 | |
| 59 | |
| 60 | when who what, where, why |
| 61 | -------- --- -------------------------------------------------------- |
| 62 | 09/15/08 lac Removed hardcoded #define for VOS_TRACE. |
| 63 | 06/12/08 hba Created module. |
| 64 | |
| 65 | ===========================================================================*/ |
| 66 | |
| 67 | /*-------------------------------------------------------------------------- |
| 68 | Include Files |
| 69 | ------------------------------------------------------------------------*/ |
| 70 | #include <vos_event.h> |
Vinay Krishna Eranna | 2025d89 | 2014-09-18 16:51:42 +0530 | [diff] [blame] | 71 | #include <vos_nvitem.h> |
| 72 | #include <vos_mq.h> |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 73 | #include "i_vos_types.h" |
| 74 | #include "i_vos_packet.h" |
| 75 | #include <linux/wait.h> |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame^] | 76 | |
| 77 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)) && \ |
| 78 | defined(WLAN_OPEN_SOURCE) |
| 79 | #include <linux/device.h> |
| 80 | #include <linux/pm_wakeup.h> |
| 81 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 82 | #include <linux/wakelock.h> |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame^] | 83 | #endif |
| 84 | |
Abhishek Singh | e7ea25c | 2015-11-23 16:23:24 +0530 | [diff] [blame] | 85 | #include <vos_timer.h> |
| 86 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 87 | |
Mahesh A Saptasagar | 8b42b27 | 2016-02-24 16:22:45 +0530 | [diff] [blame] | 88 | #define TX_POST_EVENT 0x000 |
| 89 | #define TX_SUSPEND_EVENT 0x001 |
| 90 | #define MC_POST_EVENT 0x000 |
| 91 | #define MC_SUSPEND_EVENT 0x001 |
| 92 | #define RX_POST_EVENT 0x000 |
| 93 | #define RX_SUSPEND_EVENT 0x001 |
| 94 | #define TX_SHUTDOWN_EVENT 0x002 |
| 95 | #define MC_SHUTDOWN_EVENT 0x002 |
| 96 | #define RX_SHUTDOWN_EVENT 0x002 |
| 97 | |
| 98 | #define WD_POST_EVENT 0x000 |
| 99 | #define WD_SHUTDOWN_EVENT 0x001 |
| 100 | #define WD_CHIP_RESET_EVENT 0x002 |
| 101 | #define WD_WLAN_SHUTDOWN_EVENT 0x003 |
| 102 | #define WD_WLAN_REINIT_EVENT 0x004 |
| 103 | #define WD_WLAN_DETECT_THREAD_STUCK 0x005 |
Abhishek Singh | e7ea25c | 2015-11-23 16:23:24 +0530 | [diff] [blame] | 104 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 105 | |
| 106 | |
| 107 | |
| 108 | /* |
| 109 | ** Maximum number of messages in the system |
| 110 | ** These are buffers to account for all current messages |
| 111 | ** with some accounting of what we think is a |
| 112 | ** worst-case scenario. Must be able to handle all |
| 113 | ** incoming frames, as well as overhead for internal |
| 114 | ** messaging |
| 115 | */ |
| 116 | #define VOS_CORE_MAX_MESSAGES (VPKT_NUM_RX_RAW_PACKETS + 32) |
| 117 | |
| 118 | |
| 119 | /* |
| 120 | ** vOSS Message queue definition. |
| 121 | */ |
| 122 | typedef struct _VosMqType |
| 123 | { |
| 124 | /* Lock use to synchronize access to this message queue */ |
| 125 | spinlock_t mqLock; |
| 126 | |
| 127 | /* List of vOS Messages waiting on this queue */ |
| 128 | struct list_head mqList; |
| 129 | |
| 130 | } VosMqType, *pVosMqType; |
| 131 | |
| 132 | |
| 133 | /* |
| 134 | ** vOSS Scheduler context |
| 135 | ** The scheduler context contains the following: |
| 136 | ** ** the messages queues |
| 137 | ** ** the handle to the tread |
| 138 | ** ** pointer to the events that gracefully shutdown the MC and Tx threads |
| 139 | ** |
| 140 | */ |
| 141 | typedef struct _VosSchedContext |
| 142 | { |
| 143 | /* Place holder to the VOSS Context */ |
| 144 | v_PVOID_t pVContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 145 | /* WDA Message queue on the Main thread*/ |
| 146 | VosMqType wdaMcMq; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 147 | |
| 148 | |
| 149 | |
| 150 | /* PE Message queue on the Main thread*/ |
| 151 | VosMqType peMcMq; |
| 152 | |
| 153 | /* SME Message queue on the Main thread*/ |
| 154 | VosMqType smeMcMq; |
| 155 | |
| 156 | /* TL Message queue on the Main thread */ |
| 157 | VosMqType tlMcMq; |
| 158 | |
| 159 | /* SYS Message queue on the Main thread */ |
| 160 | VosMqType sysMcMq; |
| 161 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 162 | /* WDI Message queue on the Main thread*/ |
| 163 | VosMqType wdiMcMq; |
| 164 | |
| 165 | /* WDI Message queue on the Tx Thread*/ |
| 166 | VosMqType wdiTxMq; |
| 167 | |
| 168 | /* WDI Message queue on the Rx Thread*/ |
| 169 | VosMqType wdiRxMq; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 170 | |
| 171 | /* TL Message queue on the Tx thread */ |
| 172 | VosMqType tlTxMq; |
| 173 | |
Katya Nigam | 664f503 | 2014-05-05 12:24:32 +0530 | [diff] [blame] | 174 | /* TL Message queue on the Rx thread */ |
| 175 | VosMqType tlRxMq; |
| 176 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 177 | /* SYS Message queue on the Tx thread */ |
| 178 | VosMqType sysTxMq; |
| 179 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 180 | VosMqType sysRxMq; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 181 | |
| 182 | /* Handle of Event for MC thread to signal startup */ |
| 183 | struct completion McStartEvent; |
| 184 | |
| 185 | /* Handle of Event for Tx thread to signal startup */ |
| 186 | struct completion TxStartEvent; |
| 187 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 188 | /* Handle of Event for Rx thread to signal startup */ |
| 189 | struct completion RxStartEvent; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 190 | |
| 191 | struct task_struct* McThread; |
| 192 | |
| 193 | /* TX Thread handle */ |
| 194 | |
| 195 | struct task_struct* TxThread; |
| 196 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 197 | /* RX Thread handle */ |
| 198 | struct task_struct* RxThread; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 199 | |
| 200 | |
| 201 | /* completion object for MC thread shutdown */ |
| 202 | struct completion McShutdown; |
| 203 | |
| 204 | /* completion object for Tx thread shutdown */ |
| 205 | struct completion TxShutdown; |
| 206 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 207 | /* completion object for Rx thread shutdown */ |
| 208 | struct completion RxShutdown; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 209 | |
| 210 | /* Wait queue for MC thread */ |
| 211 | wait_queue_head_t mcWaitQueue; |
| 212 | |
| 213 | unsigned long mcEventFlag; |
| 214 | |
| 215 | /* Wait queue for Tx thread */ |
| 216 | wait_queue_head_t txWaitQueue; |
| 217 | |
| 218 | unsigned long txEventFlag; |
| 219 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 220 | /* Wait queue for Rx thread */ |
| 221 | wait_queue_head_t rxWaitQueue; |
| 222 | |
| 223 | unsigned long rxEventFlag; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 224 | |
| 225 | /* Completion object to resume Mc thread */ |
| 226 | struct completion ResumeMcEvent; |
| 227 | |
| 228 | /* Completion object to resume Tx thread */ |
| 229 | struct completion ResumeTxEvent; |
| 230 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 231 | /* Completion object to resume Rx thread */ |
| 232 | struct completion ResumeRxEvent; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 233 | |
| 234 | /* lock to make sure that McThread and TxThread Suspend/resume mechanism is in sync*/ |
| 235 | spinlock_t McThreadLock; |
| 236 | spinlock_t TxThreadLock; |
| 237 | spinlock_t RxThreadLock; |
| 238 | |
| 239 | } VosSchedContext, *pVosSchedContext; |
| 240 | |
| 241 | /* |
| 242 | ** VOSS watchdog context |
| 243 | ** The watchdog context contains the following: |
| 244 | ** The messages queues and events |
| 245 | ** The handle to the thread |
| 246 | ** |
| 247 | */ |
| 248 | typedef struct _VosWatchdogContext |
| 249 | { |
| 250 | |
| 251 | /* Place holder to the VOSS Context */ |
| 252 | v_PVOID_t pVContext; |
| 253 | |
| 254 | /* Handle of Event for Watchdog thread to signal startup */ |
| 255 | struct completion WdStartEvent; |
| 256 | |
| 257 | /* Watchdog Thread handle */ |
| 258 | |
| 259 | struct task_struct* WdThread; |
| 260 | |
| 261 | /* completion object for Watchdog thread shutdown */ |
| 262 | struct completion WdShutdown; |
| 263 | |
| 264 | /* Wait queue for Watchdog thread */ |
| 265 | wait_queue_head_t wdWaitQueue; |
| 266 | |
| 267 | /* Event flag for events handled by Watchdog */ |
| 268 | unsigned long wdEventFlag; |
| 269 | |
| 270 | v_BOOL_t resetInProgress; |
| 271 | |
Pradeep Kumar Goudagunta | 22d8e4d | 2014-07-17 15:03:51 +0530 | [diff] [blame] | 272 | v_BOOL_t isFatalError; |
| 273 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 274 | /* Lock for preventing multiple reset being triggered simultaneously */ |
| 275 | spinlock_t wdLock; |
Abhishek Singh | e7ea25c | 2015-11-23 16:23:24 +0530 | [diff] [blame] | 276 | /* Timer to detect thread stuck issue */ |
| 277 | vos_timer_t threadStuckTimer; |
| 278 | /* Count for each thread to determine thread stuck */ |
| 279 | unsigned int mcThreadStuckCount; |
| 280 | unsigned int txThreadStuckCount; |
| 281 | unsigned int rxThreadStuckCount; |
| 282 | /* lock to synchronize access to the thread stuck counts */ |
| 283 | spinlock_t thread_stuck_lock; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 284 | |
| 285 | } VosWatchdogContext, *pVosWatchdogContext; |
| 286 | |
| 287 | /* |
| 288 | ** vOSS Sched Msg Wrapper |
| 289 | ** Wrapper messages so that they can be chained to their respective queue |
| 290 | ** in the scheduler. |
| 291 | */ |
| 292 | typedef struct _VosMsgWrapper |
| 293 | { |
| 294 | /* Message node */ |
| 295 | struct list_head msgNode; |
| 296 | |
| 297 | /* the Vos message it is associated to */ |
| 298 | vos_msg_t *pVosMsg; |
| 299 | |
| 300 | } VosMsgWrapper, *pVosMsgWrapper; |
| 301 | |
| 302 | |
Mahesh A Saptasagar | a67b86d | 2016-04-26 21:20:41 +0530 | [diff] [blame] | 303 | typedef struct vos_wdthread_timer_work { |
| 304 | vos_timer_callback_t callback; |
| 305 | v_PVOID_t userData; |
| 306 | struct list_head node; |
| 307 | }vos_wdthread_timer_work_t; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 308 | |
| 309 | typedef struct _VosContextType |
| 310 | { |
| 311 | /* Messages buffers */ |
| 312 | vos_msg_t aMsgBuffers[VOS_CORE_MAX_MESSAGES]; |
| 313 | |
| 314 | VosMsgWrapper aMsgWrappers[VOS_CORE_MAX_MESSAGES]; |
| 315 | |
| 316 | /* Free Message queue*/ |
| 317 | VosMqType freeVosMq; |
| 318 | |
| 319 | /* Scheduler Context */ |
| 320 | VosSchedContext vosSched; |
| 321 | |
| 322 | /* Watchdog Context */ |
| 323 | VosWatchdogContext vosWatchdog; |
| 324 | |
| 325 | /* HDD Module Context */ |
| 326 | v_VOID_t *pHDDContext; |
| 327 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 328 | /* HDD SoftAP Module Context */ |
| 329 | v_VOID_t *pHDDSoftAPContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 330 | |
| 331 | /* TL Module Context */ |
| 332 | v_VOID_t *pTLContext; |
| 333 | |
| 334 | /* MAC Module Context */ |
| 335 | v_VOID_t *pMACContext; |
| 336 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 337 | /* BAP Context */ |
| 338 | v_VOID_t *pBAPContext; |
| 339 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 340 | /* SAP Context */ |
| 341 | v_VOID_t *pSAPContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 342 | |
| 343 | /* VOS Packet Context */ |
| 344 | vos_pkt_context_t vosPacket; |
| 345 | |
| 346 | vos_event_t ProbeEvent; |
| 347 | |
| 348 | volatile v_U8_t isLogpInProgress; |
| 349 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 350 | vos_event_t wdaCompleteEvent; |
| 351 | |
| 352 | /* WDA Context */ |
| 353 | v_VOID_t *pWDAContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 354 | |
| 355 | volatile v_U8_t isLoadUnloadInProgress; |
| 356 | |
Sameer Thalappil | 9ab2fe5 | 2013-10-22 12:50:24 -0700 | [diff] [blame] | 357 | /* SSR re-init in progress */ |
| 358 | volatile v_U8_t isReInitInProgress; |
| 359 | |
Leo Chang | 80de3c2 | 2013-11-26 10:52:12 -0800 | [diff] [blame] | 360 | /* NV BIN Version */ |
| 361 | eNvVersionType nvVersion; |
| 362 | |
Girish Gowli | a33f037 | 2015-01-19 15:39:04 +0530 | [diff] [blame] | 363 | /* Roam delay statistic enabled in ini*/ |
| 364 | v_U8_t roamDelayStatsEnabled; |
Sachin Ahuja | 715aafc | 2015-07-21 23:35:10 +0530 | [diff] [blame] | 365 | |
| 366 | /*Fw log complete Event*/ |
| 367 | vos_event_t fwLogsComplete; |
Sushant Kaushik | 8e64498 | 2015-09-23 12:18:54 +0530 | [diff] [blame] | 368 | v_U32_t wakelock_log_level; |
| 369 | v_U32_t connectivity_log_level; |
| 370 | v_U32_t packet_stats_log_level; |
Abhishek Singh | 837adf2 | 2015-10-01 17:37:37 +0530 | [diff] [blame] | 371 | v_U8_t vosWrapperFullReported; |
Mahesh A Saptasagar | a67b86d | 2016-04-26 21:20:41 +0530 | [diff] [blame] | 372 | vos_wdthread_timer_work_t wdthread_timer_work; |
| 373 | struct list_head wdthread_timer_work_list; |
| 374 | struct work_struct wdthread_work; |
| 375 | spinlock_t wdthread_work_lock; |
Abhishek Singh | 8a3e4dc | 2017-01-02 10:39:18 +0530 | [diff] [blame] | 376 | bool snoc_high_freq_voting; |
| 377 | spinlock_t freq_voting_lock; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 378 | } VosContextType, *pVosContextType; |
| 379 | |
| 380 | |
| 381 | |
| 382 | /*--------------------------------------------------------------------------- |
| 383 | Function declarations and documenation |
| 384 | ---------------------------------------------------------------------------*/ |
| 385 | |
| 386 | int vos_sched_is_tx_thread(int threadID); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 387 | int vos_sched_is_rx_thread(int threadID); |
Abhishek Singh | 880d712 | 2015-08-26 16:23:04 +0530 | [diff] [blame] | 388 | int vos_sched_is_mc_thread(int threadID); |
Hanumanth Reddy Pothula | 146bca4 | 2016-11-08 12:01:07 +0530 | [diff] [blame] | 389 | void vos_thread_stuck_timer_init(pVosWatchdogContext pWdContext); |
| 390 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 391 | /*--------------------------------------------------------------------------- |
| 392 | |
| 393 | \brief vos_sched_open() - initialize the vOSS Scheduler |
| 394 | |
| 395 | The \a vos_sched_open() function initializes the vOSS Scheduler |
| 396 | Upon successful initialization: |
| 397 | |
| 398 | - All the message queues are initialized |
| 399 | |
| 400 | - The Main Controller thread is created and ready to receive and |
| 401 | dispatch messages. |
| 402 | |
| 403 | - The Tx thread is created and ready to receive and dispatch messages |
| 404 | |
| 405 | |
| 406 | \param pVosContext - pointer to the global vOSS Context |
| 407 | |
| 408 | \param pVosSchedContext - pointer to a previously allocated buffer big |
| 409 | enough to hold a scheduler context. |
| 410 | \ |
| 411 | |
| 412 | \return VOS_STATUS_SUCCESS - Scheduler was successfully initialized and |
| 413 | is ready to be used. |
| 414 | |
| 415 | VOS_STATUS_E_RESOURCES - System resources (other than memory) |
| 416 | are unavailable to initilize the scheduler |
| 417 | |
| 418 | VOS_STATUS_E_NOMEM - insufficient memory exists to initialize |
| 419 | the scheduler |
| 420 | |
| 421 | VOS_STATUS_E_INVAL - Invalid parameter passed to the scheduler Open |
| 422 | function |
| 423 | |
| 424 | VOS_STATUS_E_FAILURE - Failure to initialize the scheduler/ |
| 425 | |
| 426 | \sa vos_sched_open() |
| 427 | |
| 428 | -------------------------------------------------------------------------*/ |
| 429 | VOS_STATUS vos_sched_open( v_PVOID_t pVosContext, |
| 430 | pVosSchedContext pSchedCxt, |
| 431 | v_SIZE_t SchedCtxSize); |
| 432 | |
| 433 | /*--------------------------------------------------------------------------- |
| 434 | |
| 435 | \brief vos_watchdog_open() - initialize the vOSS watchdog |
| 436 | |
| 437 | The \a vos_watchdog_open() function initializes the vOSS watchdog. Upon successful |
| 438 | initialization, the watchdog thread is created and ready to receive and process messages. |
| 439 | |
| 440 | |
| 441 | \param pVosContext - pointer to the global vOSS Context |
| 442 | |
| 443 | \param pWdContext - pointer to a previously allocated buffer big |
| 444 | enough to hold a watchdog context. |
| 445 | |
| 446 | \return VOS_STATUS_SUCCESS - Watchdog was successfully initialized and |
| 447 | is ready to be used. |
| 448 | |
| 449 | VOS_STATUS_E_RESOURCES - System resources (other than memory) |
| 450 | are unavailable to initilize the Watchdog |
| 451 | |
| 452 | VOS_STATUS_E_NOMEM - insufficient memory exists to initialize |
| 453 | the Watchdog |
| 454 | |
| 455 | VOS_STATUS_E_INVAL - Invalid parameter passed to the Watchdog Open |
| 456 | function |
| 457 | |
| 458 | VOS_STATUS_E_FAILURE - Failure to initialize the Watchdog/ |
| 459 | |
| 460 | \sa vos_watchdog_open() |
| 461 | |
| 462 | -------------------------------------------------------------------------*/ |
| 463 | |
| 464 | VOS_STATUS vos_watchdog_open |
| 465 | |
| 466 | ( |
| 467 | v_PVOID_t pVosContext, |
| 468 | pVosWatchdogContext pWdContext, |
| 469 | v_SIZE_t wdCtxSize |
| 470 | ); |
| 471 | |
| 472 | /*--------------------------------------------------------------------------- |
| 473 | |
| 474 | \brief vos_sched_close() - Close the vOSS Scheduler |
| 475 | |
| 476 | The \a vos_sched_closes() function closes the vOSS Scheduler |
| 477 | Upon successful closing: |
| 478 | |
| 479 | - All the message queues are flushed |
| 480 | |
| 481 | - The Main Controller thread is closed |
| 482 | |
| 483 | - The Tx thread is closed |
| 484 | |
| 485 | |
| 486 | \param pVosContext - pointer to the global vOSS Context |
| 487 | |
| 488 | \return VOS_STATUS_SUCCESS - Scheduler was successfully initialized and |
| 489 | is ready to be used. |
| 490 | |
| 491 | VOS_STATUS_E_INVAL - Invalid parameter passed to the scheduler Open |
| 492 | function |
| 493 | |
| 494 | VOS_STATUS_E_FAILURE - Failure to initialize the scheduler/ |
| 495 | |
| 496 | \sa vos_sched_close() |
| 497 | |
| 498 | ---------------------------------------------------------------------------*/ |
| 499 | VOS_STATUS vos_sched_close( v_PVOID_t pVosContext); |
| 500 | |
| 501 | /*--------------------------------------------------------------------------- |
| 502 | |
| 503 | \brief vos_watchdog_close() - Close the vOSS Watchdog |
| 504 | |
| 505 | The \a vos_watchdog_close() function closes the vOSS Watchdog |
| 506 | Upon successful closing: |
| 507 | |
| 508 | - The Watchdog thread is closed |
| 509 | |
| 510 | |
| 511 | \param pVosContext - pointer to the global vOSS Context |
| 512 | |
| 513 | \return VOS_STATUS_SUCCESS - Watchdog was successfully initialized and |
| 514 | is ready to be used. |
| 515 | |
| 516 | VOS_STATUS_E_INVAL - Invalid parameter passed |
| 517 | |
| 518 | VOS_STATUS_E_FAILURE - Failure to initialize the Watchdog/ |
| 519 | |
| 520 | \sa vos_watchdog_close() |
| 521 | |
| 522 | ---------------------------------------------------------------------------*/ |
| 523 | VOS_STATUS vos_watchdog_close ( v_PVOID_t pVosContext ); |
| 524 | |
| 525 | /* Helper routines provided to other VOS API's */ |
| 526 | VOS_STATUS vos_mq_init(pVosMqType pMq); |
| 527 | void vos_mq_deinit(pVosMqType pMq); |
| 528 | void vos_mq_put(pVosMqType pMq, pVosMsgWrapper pMsgWrapper); |
Padma, Santhosh Kumar | b036fc7 | 2015-11-13 16:22:23 +0530 | [diff] [blame] | 529 | void vos_mq_put_front(pVosMqType pMq, pVosMsgWrapper pMsgWrapper); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 530 | pVosMsgWrapper vos_mq_get(pVosMqType pMq); |
| 531 | v_BOOL_t vos_is_mq_empty(pVosMqType pMq); |
| 532 | pVosSchedContext get_vos_sched_ctxt(void); |
| 533 | pVosWatchdogContext get_vos_watchdog_ctxt(void); |
| 534 | VOS_STATUS vos_sched_init_mqs (pVosSchedContext pSchedContext); |
| 535 | void vos_sched_deinit_mqs (pVosSchedContext pSchedContext); |
| 536 | void vos_sched_flush_mc_mqs (pVosSchedContext pSchedContext); |
| 537 | void vos_sched_flush_tx_mqs (pVosSchedContext pSchedContext); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 538 | void vos_sched_flush_rx_mqs (pVosSchedContext pSchedContext); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 539 | void clearWlanResetReason(void); |
| 540 | |
| 541 | void vos_timer_module_init( void ); |
| 542 | VOS_STATUS vos_watchdog_wlan_shutdown(void); |
| 543 | VOS_STATUS vos_watchdog_wlan_re_init(void); |
Pradeep Kumar Goudagunta | 22d8e4d | 2014-07-17 15:03:51 +0530 | [diff] [blame] | 544 | v_BOOL_t isSsrPanicOnFailure(void); |
Mahesh A Saptasagar | 96395ab | 2014-04-08 12:48:39 +0530 | [diff] [blame] | 545 | void vos_ssr_protect(const char *caller_func); |
| 546 | void vos_ssr_unprotect(const char *caller_func); |
Abhishek Singh | e7ea25c | 2015-11-23 16:23:24 +0530 | [diff] [blame] | 547 | void vos_wd_reset_thread_stuck_count(int threadId); |
| 548 | bool vos_is_wd_thread(int threadId); |
Padma, Santhosh Kumar | 166597b | 2015-11-24 17:46:28 +0530 | [diff] [blame] | 549 | void vos_dump_stack(uint8_t value); |
Arunk Khandavalli | af6c3af | 2017-01-16 11:44:46 +0530 | [diff] [blame] | 550 | void vos_dump_thread_stacks(int threadId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 551 | |
| 552 | #endif // #if !defined __VOSS_SCHED_H |