blob: 474ce76347a7bb7d70e41ad430ca98f18997c5bf [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Kiet Lam1ed83fc2014-02-19 01:15:45 -08002 * Copyright (c) 2012-2014 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 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/**=========================================================================
Jeff Johnson2f5cfec2013-02-22 21:25:10 -080029
Jeff Johnson295189b2012-06-20 16:38:30 -070030 \file vos_api.c
31
32 \brief Stub file for all virtual Operating System Services (vOSS) APIs
Jeff Johnson295189b2012-06-20 16:38:30 -070033
34 ========================================================================*/
35 /*===========================================================================
36
37 EDIT HISTORY FOR FILE
38
39
40 This section contains comments describing changes made to the module.
41 Notice that changes are listed in reverse chronological order.
42
43
44 $Header:$ $DateTime: $ $Author: $
45
46
47 when who what, where, why
48 -------- --- --------------------------------------------------------
49 03/29/09 kanand Created module.
50===========================================================================*/
51
52/*--------------------------------------------------------------------------
53 Include Files
54 ------------------------------------------------------------------------*/
Jeff Johnson295189b2012-06-20 16:38:30 -070055#include <vos_mq.h>
56#include "vos_sched.h"
57#include <vos_api.h>
58#include "sirTypes.h"
59#include "sirApi.h"
60#include "sirMacProtDef.h"
61#include "sme_Api.h"
62#include "macInitApi.h"
63#include "wlan_qct_sys.h"
64#include "wlan_qct_tl.h"
65#include "wlan_hdd_misc.h"
66#include "i_vos_packet.h"
67#include "vos_nvitem.h"
68#include "wlan_qct_wda.h"
69#include "wlan_hdd_main.h"
70#include <linux/vmalloc.h>
Madan Mohan Koyyalamudic3a240c2012-09-28 15:34:08 -070071#include "wlan_hdd_cfg80211.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070072
Jeff Johnson295189b2012-06-20 16:38:30 -070073#include "sapApi.h"
Leela Venkata Kiran Kumar Reddy Chirala57af2692013-04-10 22:39:51 -070074#include "vos_trace.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070075
76
77
78#ifdef WLAN_BTAMP_FEATURE
79#include "bapApi.h"
80#include "bapInternal.h"
81#include "bap_hdd_main.h"
82#endif //WLAN_BTAMP_FEATURE
83
84
85/*---------------------------------------------------------------------------
86 * Preprocessor Definitions and Constants
87 * ------------------------------------------------------------------------*/
88/* Amount of time to wait for WDA to perform an asynchronous activity.
89 This value should be larger than the timeout used by WDI to wait for
90 a response from WCNSS since in the event that WCNSS is not responding,
91 WDI should handle that timeout */
92#define VOS_WDA_TIMEOUT 15000
93
94/* Approximate amount of time to wait for WDA to stop WDI */
95#define VOS_WDA_STOP_TIMEOUT WDA_STOP_TIMEOUT
96
Madan Mohan Koyyalamudi62080282013-08-05 12:51:17 +053097/* Approximate amount of time to wait for WDA to issue a DUMP req */
98#define VOS_WDA_RESP_TIMEOUT WDA_STOP_TIMEOUT
99
Jeff Johnson295189b2012-06-20 16:38:30 -0700100/*---------------------------------------------------------------------------
101 * Data definitions
102 * ------------------------------------------------------------------------*/
103static VosContextType gVosContext;
104static pVosContextType gpVosContext;
105
106/*---------------------------------------------------------------------------
107 * Forward declaration
108 * ------------------------------------------------------------------------*/
109v_VOID_t vos_sys_probe_thread_cback ( v_VOID_t *pUserData );
110
Jeff Johnson295189b2012-06-20 16:38:30 -0700111v_VOID_t vos_core_return_msg(v_PVOID_t pVContext, pVosMsgWrapper pMsgWrapper);
112
113v_VOID_t vos_fetch_tl_cfg_parms ( WLANTL_ConfigInfoType *pTLConfig,
114 hdd_config_t * pConfig );
Jeff Johnson295189b2012-06-20 16:38:30 -0700115
116
117/*---------------------------------------------------------------------------
118
119 \brief vos_preOpen() - PreOpen the vOSS Module
120
121 The \a vos_preOpen() function allocates the Vos Context, but do not
122 initialize all the members. This overal initialization will happen
123 at vos_Open().
124 The reason why we need vos_preOpen() is to get a minimum context
125 where to store BAL and SAL relative data, which happens before
126 vos_Open() is called.
127
128 \param pVosContext: A pointer to where to store the VOS Context
129
130
131 \return VOS_STATUS_SUCCESS - Scheduler was successfully initialized and
132 is ready to be used.
133
134 VOS_STATUS_E_FAILURE - Failure to initialize the scheduler/
135
136 \sa vos_Open()
137
138---------------------------------------------------------------------------*/
139VOS_STATUS vos_preOpen ( v_CONTEXT_t *pVosContext )
140{
141 if ( pVosContext == NULL)
142 return VOS_STATUS_E_FAILURE;
143
144 /* Allocate the VOS Context */
145 *pVosContext = NULL;
146 gpVosContext = &gVosContext;
147
148 if (NULL == gpVosContext)
149 {
150 /* Critical Error ...Cannot proceed further */
151 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
152 "%s: Failed to allocate VOS Context", __func__);
153 VOS_ASSERT(0);
154 return VOS_STATUS_E_RESOURCES;
155 }
156
157 vos_mem_zero(gpVosContext, sizeof(VosContextType));
158
159 *pVosContext = gpVosContext;
160
Leela Venkata Kiran Kumar Reddy Chirala57af2692013-04-10 22:39:51 -0700161 /* Initialize the spinlock */
162 vos_trace_spin_lock_init();
163 /* it is the right time to initialize MTRACE structures */
164 #if defined(TRACE_RECORD)
165 vosTraceInit();
166 #endif
167
Jeff Johnson295189b2012-06-20 16:38:30 -0700168 return VOS_STATUS_SUCCESS;
169
170} /* vos_preOpen()*/
171
172
173/*---------------------------------------------------------------------------
174
175 \brief vos_preClose() - PreClose the vOSS Module
176
177 The \a vos_preClose() function frees the Vos Context.
178
179 \param pVosContext: A pointer to where the VOS Context was stored
180
181
182 \return VOS_STATUS_SUCCESS - Always successful
183
184
185 \sa vos_preClose()
186 \sa vos_close()
187---------------------------------------------------------------------------*/
188VOS_STATUS vos_preClose( v_CONTEXT_t *pVosContext )
189{
190
191 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
192 "%s: De-allocating the VOS Context", __func__);
193
194 if (( pVosContext == NULL) || (*pVosContext == NULL))
195 {
196 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
197 "%s: vOS Context is Null", __func__);
198 return VOS_STATUS_E_FAILURE;
199 }
200
201 if (gpVosContext != *pVosContext)
202 {
203 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
204 "%s: Context mismatch", __func__);
205 return VOS_STATUS_E_FAILURE;
206 }
207
208 *pVosContext = gpVosContext = NULL;
209
210 return VOS_STATUS_SUCCESS;
211
212} /* vos_preClose()*/
213
214/*---------------------------------------------------------------------------
215
216 \brief vos_open() - Open the vOSS Module
217
218 The \a vos_open() function opens the vOSS Scheduler
219 Upon successful initialization:
220
221 - All VOS submodules should have been initialized
222
223 - The VOS scheduler should have opened
224
225 - All the WLAN SW components should have been opened. This includes
226 SYS, MAC, SME, WDA and TL.
227
228
Arun Kumar Khandavalliebb19482014-03-25 13:56:53 +0530229 \param devHandle: pointer to the OS specific device handle
Jeff Johnson295189b2012-06-20 16:38:30 -0700230
231
232 \return VOS_STATUS_SUCCESS - Scheduler was successfully initialized and
233 is ready to be used.
234
235 VOS_STATUS_E_RESOURCES - System resources (other than memory)
236 are unavailable to initilize the scheduler
237
238
239 VOS_STATUS_E_FAILURE - Failure to initialize the scheduler/
240
241 \sa vos_preOpen()
242
243---------------------------------------------------------------------------*/
Arun Kumar Khandavalliebb19482014-03-25 13:56:53 +0530244VOS_STATUS vos_open( v_CONTEXT_t *pVosContext, void *devHandle )
Jeff Johnson295189b2012-06-20 16:38:30 -0700245
246{
247 VOS_STATUS vStatus = VOS_STATUS_SUCCESS;
248 int iter = 0;
249 tSirRetStatus sirStatus = eSIR_SUCCESS;
250 tMacOpenParameters macOpenParms;
251 WLANTL_ConfigInfoType TLConfig;
252
253 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH,
254 "%s: Opening VOSS", __func__);
255
256 if (NULL == gpVosContext)
257 {
258 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
259 "%s: Trying to open VOSS without a PreOpen", __func__);
260 VOS_ASSERT(0);
261 return VOS_STATUS_E_FAILURE;
262 }
263
264 /* Initialize the timer module */
265 vos_timer_module_init();
266
Leela Venkata Kiran Kumar Reddy Chirala57af2692013-04-10 22:39:51 -0700267
Jeff Johnson295189b2012-06-20 16:38:30 -0700268 /* Initialize the probe event */
269 if (vos_event_init(&gpVosContext->ProbeEvent) != VOS_STATUS_SUCCESS)
270 {
271 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
272 "%s: Unable to init probeEvent", __func__);
273 VOS_ASSERT(0);
274 return VOS_STATUS_E_FAILURE;
275 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700276 if (vos_event_init( &(gpVosContext->wdaCompleteEvent) ) != VOS_STATUS_SUCCESS )
277 {
278 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
279 "%s: Unable to init wdaCompleteEvent", __func__);
280 VOS_ASSERT(0);
281
282 goto err_probe_event;
283 }
284
Jeff Johnson295189b2012-06-20 16:38:30 -0700285 /* Initialize the free message queue */
286 vStatus = vos_mq_init(&gpVosContext->freeVosMq);
287 if (! VOS_IS_STATUS_SUCCESS(vStatus))
288 {
289
290 /* Critical Error ... Cannot proceed further */
291 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
292 "%s: Failed to initialize VOS free message queue", __func__);
293 VOS_ASSERT(0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700294 goto err_wda_complete_event;
Jeff Johnson295189b2012-06-20 16:38:30 -0700295 }
296
297 for (iter = 0; iter < VOS_CORE_MAX_MESSAGES; iter++)
298 {
299 (gpVosContext->aMsgWrappers[iter]).pVosMsg =
300 &(gpVosContext->aMsgBuffers[iter]);
301 INIT_LIST_HEAD(&gpVosContext->aMsgWrappers[iter].msgNode);
302 vos_mq_put(&gpVosContext->freeVosMq, &(gpVosContext->aMsgWrappers[iter]));
303 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700304
305 /* Now Open the VOS Scheduler */
306 vStatus= vos_sched_open(gpVosContext, &gpVosContext->vosSched,
307 sizeof(VosSchedContext));
308
309 if (!VOS_IS_STATUS_SUCCESS(vStatus))
310 {
311 /* Critical Error ... Cannot proceed further */
312 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
313 "%s: Failed to open VOS Scheduler", __func__);
314 VOS_ASSERT(0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700315 goto err_msg_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700316 }
317
Jeff Johnson295189b2012-06-20 16:38:30 -0700318 /*
319 ** Need to open WDA first because it calls WDI_Init, which calls wpalOpen
320 ** The reason that is needed becasue vos_packet_open need to use PAL APIs
321 */
322
323 /*Open the WDA module */
324 vos_mem_set(&macOpenParms, sizeof(macOpenParms), 0);
325 /* UMA is supported in hardware for performing the
326 ** frame translation 802.11 <-> 802.3
327 */
328 macOpenParms.frameTransRequired = 1;
329 macOpenParms.driverType = eDRIVER_TYPE_PRODUCTION;
Arun Kumar Khandavalliebb19482014-03-25 13:56:53 +0530330 vStatus = WDA_open( gpVosContext, devHandle, &macOpenParms );
Jeff Johnson295189b2012-06-20 16:38:30 -0700331
332 if (!VOS_IS_STATUS_SUCCESS(vStatus))
333 {
334 /* Critical Error ... Cannot proceed further */
335 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
336 "%s: Failed to open WDA module", __func__);
337 VOS_ASSERT(0);
338 goto err_sched_close;
339 }
340
341 /* Initialize here the VOS Packet sub module */
342 vStatus = vos_packet_open( gpVosContext, &gpVosContext->vosPacket,
343 sizeof( vos_pkt_context_t ) );
344
345 if ( !VOS_IS_STATUS_SUCCESS( vStatus ) )
346 {
347 /* Critical Error ... Cannot proceed further */
348 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
349 "%s: Failed to open VOS Packet Module", __func__);
350 VOS_ASSERT(0);
351 goto err_wda_close;
352 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700353
354 /* Open the SYS module */
355 vStatus = sysOpen(gpVosContext);
356
357 if (!VOS_IS_STATUS_SUCCESS(vStatus))
358 {
359 /* Critical Error ... Cannot proceed further */
360 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
361 "%s: Failed to open SYS module", __func__);
362 VOS_ASSERT(0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700363 goto err_packet_close;
Jeff Johnson295189b2012-06-20 16:38:30 -0700364 }
365
Amar Singhal0a402232013-10-11 20:57:16 -0700366#ifndef CONFIG_ENABLE_LINUX_REG
Jeff Johnson295189b2012-06-20 16:38:30 -0700367 /* initialize the NV module */
368 vStatus = vos_nv_open();
369 if (!VOS_IS_STATUS_SUCCESS(vStatus))
370 {
371 // NV module cannot be initialized
372 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
373 "%s: Failed to initialize the NV module", __func__);
374 goto err_sys_close;
375 }
Amar Singhal0a402232013-10-11 20:57:16 -0700376#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700377
378 /* If we arrive here, both threads dispacthing messages correctly */
379
380 /* Now proceed to open the MAC */
381
382 /* UMA is supported in hardware for performing the
383 frame translation 802.11 <-> 802.3 */
384 macOpenParms.frameTransRequired = 1;
385 sirStatus = macOpen(&(gpVosContext->pMACContext), gpVosContext->pHDDContext,
386 &macOpenParms);
387
388 if (eSIR_SUCCESS != sirStatus)
389 {
390 /* Critical Error ... Cannot proceed further */
391 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
392 "%s: Failed to open MAC", __func__);
393 VOS_ASSERT(0);
394 goto err_nv_close;
395 }
396
397 /* Now proceed to open the SME */
398 vStatus = sme_Open(gpVosContext->pMACContext);
399 if (!VOS_IS_STATUS_SUCCESS(vStatus))
400 {
401 /* Critical Error ... Cannot proceed further */
402 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
403 "%s: Failed to open SME", __func__);
404 VOS_ASSERT(0);
405 goto err_mac_close;
406 }
407
408 /* Now proceed to open TL. Read TL config first */
409 vos_fetch_tl_cfg_parms ( &TLConfig,
410 ((hdd_context_t*)(gpVosContext->pHDDContext))->cfg_ini);
411
412 vStatus = WLANTL_Open(gpVosContext, &TLConfig);
413 if (!VOS_IS_STATUS_SUCCESS(vStatus))
414 {
415 /* Critical Error ... Cannot proceed further */
416 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
417 "%s: Failed to open TL", __func__);
418 VOS_ASSERT(0);
419 goto err_sme_close;
420 }
421
422 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH,
423 "%s: VOSS successfully Opened", __func__);
424
425 *pVosContext = gpVosContext;
426
427 return VOS_STATUS_SUCCESS;
428
429
430err_sme_close:
431 sme_Close(gpVosContext->pMACContext);
432
433err_mac_close:
434 macClose(gpVosContext->pMACContext);
435
436err_nv_close:
Amar Singhal0a402232013-10-11 20:57:16 -0700437
438#ifndef CONFIG_ENABLE_LINUX_REG
Jeff Johnson295189b2012-06-20 16:38:30 -0700439 vos_nv_close();
Amar Singhal0a402232013-10-11 20:57:16 -0700440
441err_sys_close:
442#endif
443
Jeff Johnson295189b2012-06-20 16:38:30 -0700444 sysClose(gpVosContext);
445
Jeff Johnson295189b2012-06-20 16:38:30 -0700446err_packet_close:
447 vos_packet_close( gpVosContext );
448
449err_wda_close:
450 WDA_close(gpVosContext);
Jeff Johnson295189b2012-06-20 16:38:30 -0700451
Amar Singhal0a402232013-10-11 20:57:16 -0700452err_sched_close:
Jeff Johnson295189b2012-06-20 16:38:30 -0700453 vos_sched_close(gpVosContext);
454
Jeff Johnson295189b2012-06-20 16:38:30 -0700455
456err_msg_queue:
457 vos_mq_deinit(&gpVosContext->freeVosMq);
458
Jeff Johnson295189b2012-06-20 16:38:30 -0700459err_wda_complete_event:
460 vos_event_destroy( &gpVosContext->wdaCompleteEvent );
Jeff Johnson295189b2012-06-20 16:38:30 -0700461
462err_probe_event:
463 vos_event_destroy(&gpVosContext->ProbeEvent);
464
465 return VOS_STATUS_E_FAILURE;
466
467} /* vos_open() */
468
Jeff Johnson295189b2012-06-20 16:38:30 -0700469/*---------------------------------------------------------------------------
470
471 \brief vos_preStart() -
472
473 The \a vos_preStart() function to download CFG.
474 including:
475 - ccmStart
476
477 - WDA: triggers the CFG download
478
479
480 \param pVosContext: The VOS context
481
482
483 \return VOS_STATUS_SUCCESS - Scheduler was successfully initialized and
484 is ready to be used.
485
486 VOS_STATUS_E_RESOURCES - System resources (other than memory)
487 are unavailable to initilize the scheduler
488
489
490 VOS_STATUS_E_FAILURE - Failure to initialize the scheduler/
491
492 \sa vos_start
493
494---------------------------------------------------------------------------*/
495VOS_STATUS vos_preStart( v_CONTEXT_t vosContext )
496{
497 VOS_STATUS vStatus = VOS_STATUS_SUCCESS;
498 pVosContextType pVosContext = (pVosContextType)vosContext;
499
500 VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_INFO,
501 "vos prestart");
502
Manjunathappa Prakashfb585462013-12-23 19:07:07 -0800503 if (gpVosContext != pVosContext)
504 {
505 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
506 "%s: Context mismatch", __func__);
507 VOS_ASSERT(0);
508 return VOS_STATUS_E_INVAL;
509 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700510
Manjunathappa Prakashfb585462013-12-23 19:07:07 -0800511 if (pVosContext->pMACContext == NULL)
512 {
513 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
514 "%s: MAC NULL context", __func__);
515 VOS_ASSERT(0);
516 return VOS_STATUS_E_INVAL;
517 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700518
Manjunathappa Prakashfb585462013-12-23 19:07:07 -0800519 if (pVosContext->pWDAContext == NULL)
520 {
521 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
522 "%s: WDA NULL context", __func__);
523 VOS_ASSERT(0);
524 return VOS_STATUS_E_INVAL;
525 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700526
527 /* call macPreStart */
528 vStatus = macPreStart(gpVosContext->pMACContext);
529 if ( !VOS_IS_STATUS_SUCCESS(vStatus) )
530 {
531 VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_FATAL,
532 "Failed at macPreStart ");
533 return VOS_STATUS_E_FAILURE;
534 }
535
536 /* call ccmStart */
537 ccmStart(gpVosContext->pMACContext);
538
539 /* Reset wda wait event */
540 vos_event_reset(&gpVosContext->wdaCompleteEvent);
541
542
543 /*call WDA pre start*/
544 vStatus = WDA_preStart(gpVosContext);
545 if (!VOS_IS_STATUS_SUCCESS(vStatus))
546 {
547 VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_FATAL,
548 "Failed to WDA prestart");
549 macStop(gpVosContext->pMACContext, HAL_STOP_TYPE_SYS_DEEP_SLEEP);
550 ccmStop(gpVosContext->pMACContext);
551 VOS_ASSERT(0);
552 return VOS_STATUS_E_FAILURE;
553 }
554
555 /* Need to update time out of complete */
556 vStatus = vos_wait_single_event( &gpVosContext->wdaCompleteEvent,
557 VOS_WDA_TIMEOUT );
558 if ( vStatus != VOS_STATUS_SUCCESS )
559 {
560 if ( vStatus == VOS_STATUS_E_TIMEOUT )
561 {
562 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Arif Hussain02882402013-11-17 21:55:29 -0800563 "%s: Timeout occurred before WDA complete", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700564 }
565 else
566 {
567 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
568 "%s: WDA_preStart reporting other error", __func__);
569 }
Sameer Thalappil6d69cbd2013-06-27 13:07:15 -0700570 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
571 "%s: Test MC thread by posting a probe message to SYS", __func__);
572 wlan_sys_probe();
573
Jeff Johnsone7245742012-09-05 17:12:55 -0700574 macStop(gpVosContext->pMACContext, HAL_STOP_TYPE_SYS_DEEP_SLEEP);
575 ccmStop(gpVosContext->pMACContext);
Jeff Johnson295189b2012-06-20 16:38:30 -0700576 VOS_ASSERT( 0 );
577 return VOS_STATUS_E_FAILURE;
578 }
579
580 return VOS_STATUS_SUCCESS;
581}
Jeff Johnson295189b2012-06-20 16:38:30 -0700582
583/*---------------------------------------------------------------------------
584
585 \brief vos_start() - Start the Libra SW Modules
586
587 The \a vos_start() function starts all the components of the Libra SW
588 including:
589 - SAL/BAL, which in turn starts SSC
590
591 - the MAC (HAL and PE)
592
593 - SME
594
595 - TL
596
597 - SYS: triggers the CFG download
598
599
600 \param pVosContext: The VOS context
601
602
603 \return VOS_STATUS_SUCCESS - Scheduler was successfully initialized and
604 is ready to be used.
605
606 VOS_STATUS_E_RESOURCES - System resources (other than memory)
607 are unavailable to initilize the scheduler
608
609
610 VOS_STATUS_E_FAILURE - Failure to initialize the scheduler/
611
612 \sa vos_preStart()
613 \sa vos_open()
614
615---------------------------------------------------------------------------*/
616VOS_STATUS vos_start( v_CONTEXT_t vosContext )
617{
618 VOS_STATUS vStatus = VOS_STATUS_SUCCESS;
619 tSirRetStatus sirStatus = eSIR_SUCCESS;
620 pVosContextType pVosContext = (pVosContextType)vosContext;
621 tHalMacStartParameters halStartParams;
Jeff Johnson295189b2012-06-20 16:38:30 -0700622
623 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
624 "%s: Starting Libra SW", __func__);
625
626 /* We support only one instance for now ...*/
627 if (gpVosContext != pVosContext)
628 {
629 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700630 "%s: mismatch in context", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700631 return VOS_STATUS_E_FAILURE;
632 }
633
Jeff Johnson295189b2012-06-20 16:38:30 -0700634 if (( pVosContext->pWDAContext == NULL) || ( pVosContext->pMACContext == NULL)
635 || ( pVosContext->pTLContext == NULL))
636 {
637 if (pVosContext->pWDAContext == NULL)
638 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700639 "%s: WDA NULL context", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700640 else if (pVosContext->pMACContext == NULL)
641 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700642 "%s: MAC NULL context", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700643 else
644 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700645 "%s: TL NULL context", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700646
647 return VOS_STATUS_E_FAILURE;
648 }
649
650 /* WDA_Start will be called after NV image download because the
651 NV image data has to be updated at HAL before HAL_Start gets executed*/
652
653 /* Start the NV Image Download */
654
655 vos_event_reset( &(gpVosContext->wdaCompleteEvent) );
656
657 vStatus = WDA_NVDownload_Start(pVosContext);
658
659 if ( vStatus != VOS_STATUS_SUCCESS )
660 {
661 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
662 "%s: Failed to start NV Download", __func__);
663 return VOS_STATUS_E_FAILURE;
664 }
665
666 vStatus = vos_wait_single_event( &(gpVosContext->wdaCompleteEvent),
667 VOS_WDA_TIMEOUT );
668
669 if ( vStatus != VOS_STATUS_SUCCESS )
670 {
671 if ( vStatus == VOS_STATUS_E_TIMEOUT )
672 {
673 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
674 "%s: Timeout occurred before WDA_NVDownload_start complete", __func__);
675 }
676 else
677 {
678 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
679 "%s: WDA_NVDownload_start reporting other error", __func__);
680 }
681 VOS_ASSERT(0);
Madan Mohan Koyyalamudiec231f82012-11-28 16:01:28 -0800682 vos_event_reset( &(gpVosContext->wdaCompleteEvent) );
Sameer Thalappilb511beb2013-09-09 17:11:51 -0700683 if (vos_is_logp_in_progress(VOS_MODULE_ID_VOSS, NULL))
684 {
685 VOS_BUG(0);
686 }
Madan Mohan Koyyalamudiec231f82012-11-28 16:01:28 -0800687 WDA_setNeedShutdown(vosContext);
688 return VOS_STATUS_E_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700689 }
690
691 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
692 "%s: WDA_NVDownload_start correctly started", __func__);
693
694 /* Start the WDA */
695 vStatus = WDA_start(pVosContext);
696 if ( vStatus != VOS_STATUS_SUCCESS )
697 {
698 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
699 "%s: Failed to start WDA", __func__);
700 return VOS_STATUS_E_FAILURE;
701 }
702 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
703 "%s: WDA correctly started", __func__);
704
Jeff Johnson295189b2012-06-20 16:38:30 -0700705 /* Start the MAC */
706 vos_mem_zero((v_PVOID_t)&halStartParams, sizeof(tHalMacStartParameters));
707
Jeff Johnson295189b2012-06-20 16:38:30 -0700708 /* Start the MAC */
709 sirStatus = macStart(pVosContext->pMACContext,(v_PVOID_t)&halStartParams);
710
Jeff Johnson295189b2012-06-20 16:38:30 -0700711 if (eSIR_SUCCESS != sirStatus)
712 {
713 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
714 "%s: Failed to start MAC", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700715 goto err_wda_stop;
Jeff Johnson295189b2012-06-20 16:38:30 -0700716 }
717
718 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
719 "%s: MAC correctly started", __func__);
720
721 /* START SME */
722 vStatus = sme_Start(pVosContext->pMACContext);
723
724 if (!VOS_IS_STATUS_SUCCESS(vStatus))
725 {
726 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
727 "%s: Failed to start SME", __func__);
728 goto err_mac_stop;
729 }
730
731 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
732 "%s: SME correctly started", __func__);
733
734 /** START TL */
735 vStatus = WLANTL_Start(pVosContext);
736 if (!VOS_IS_STATUS_SUCCESS(vStatus))
737 {
738 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
739 "%s: Failed to start TL", __func__);
740 goto err_sme_stop;
741 }
742
743 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
744 "TL correctly started");
Jeff Johnson295189b2012-06-20 16:38:30 -0700745 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
746 "%s: VOSS Start is successful!!", __func__);
747
748 return VOS_STATUS_SUCCESS;
749
Jeff Johnson295189b2012-06-20 16:38:30 -0700750
751err_sme_stop:
Kiet Lama72a2322013-11-15 11:18:11 +0530752 sme_Stop(pVosContext->pMACContext, HAL_STOP_TYPE_SYS_RESET);
Jeff Johnson295189b2012-06-20 16:38:30 -0700753
754err_mac_stop:
755 macStop( pVosContext->pMACContext, HAL_STOP_TYPE_SYS_RESET );
756
Jeff Johnson295189b2012-06-20 16:38:30 -0700757err_wda_stop:
758 vos_event_reset( &(gpVosContext->wdaCompleteEvent) );
Madan Mohan Koyyalamudid57ae632012-11-06 18:42:48 -0800759 vStatus = WDA_stop( pVosContext, HAL_STOP_TYPE_RF_KILL);
760 if (!VOS_IS_STATUS_SUCCESS(vStatus))
Jeff Johnson295189b2012-06-20 16:38:30 -0700761 {
Madan Mohan Koyyalamudid57ae632012-11-06 18:42:48 -0800762 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
763 "%s: Failed to stop WDA", __func__);
764 VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vStatus ) );
Madan Mohan Koyyalamudi9d7a27f2012-11-28 15:55:25 -0800765 WDA_setNeedShutdown(vosContext);
Madan Mohan Koyyalamudid57ae632012-11-06 18:42:48 -0800766 }
767 else
768 {
769 vStatus = vos_wait_single_event( &(gpVosContext->wdaCompleteEvent),
770 VOS_WDA_TIMEOUT );
771 if( vStatus != VOS_STATUS_SUCCESS )
772 {
773 if( vStatus == VOS_STATUS_E_TIMEOUT )
774 {
775 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
776 "%s: Timeout occurred before WDA_stop complete", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700777
Madan Mohan Koyyalamudid57ae632012-11-06 18:42:48 -0800778 }
779 else
780 {
781 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
782 "%s: WDA_stop reporting other error", __func__);
783 }
784 VOS_ASSERT( 0 );
Madan Mohan Koyyalamudi9d7a27f2012-11-28 15:55:25 -0800785 WDA_setNeedShutdown(vosContext);
Madan Mohan Koyyalamudid57ae632012-11-06 18:42:48 -0800786 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700787 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700788
789 return VOS_STATUS_E_FAILURE;
790
791} /* vos_start() */
792
793
794/* vos_stop function */
795VOS_STATUS vos_stop( v_CONTEXT_t vosContext )
796{
797 VOS_STATUS vosStatus;
798
Jeff Johnson295189b2012-06-20 16:38:30 -0700799 /* WDA_Stop is called before the SYS so that the processing of Riva
800 pending responces will not be handled during uninitialization of WLAN driver */
801 vos_event_reset( &(gpVosContext->wdaCompleteEvent) );
802
803 vosStatus = WDA_stop( vosContext, HAL_STOP_TYPE_RF_KILL );
804
805 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
806 {
807 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
808 "%s: Failed to stop WDA", __func__);
809 VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
Madan Mohan Koyyalamudi9d7a27f2012-11-28 15:55:25 -0800810 WDA_setNeedShutdown(vosContext);
Jeff Johnson295189b2012-06-20 16:38:30 -0700811 }
Madan Mohan Koyyalamudia2fc6412012-10-21 12:06:12 -0700812 else
813 {
Madan Mohan Koyyalamudid57ae632012-11-06 18:42:48 -0800814 vosStatus = vos_wait_single_event( &(gpVosContext->wdaCompleteEvent),
815 VOS_WDA_STOP_TIMEOUT );
Jeff Johnson295189b2012-06-20 16:38:30 -0700816
Madan Mohan Koyyalamudid57ae632012-11-06 18:42:48 -0800817 if ( vosStatus != VOS_STATUS_SUCCESS )
818 {
819 if ( vosStatus == VOS_STATUS_E_TIMEOUT )
820 {
821 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
822 "%s: Timeout occurred before WDA complete", __func__);
823 }
824 else
825 {
826 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
827 "%s: WDA_stop reporting other error", __func__ );
828 }
Sameer Thalappil6d69cbd2013-06-27 13:07:15 -0700829 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
830 "%s: Test MC thread by posting a probe message to SYS", __func__);
831 wlan_sys_probe();
Madan Mohan Koyyalamudi9d7a27f2012-11-28 15:55:25 -0800832 WDA_setNeedShutdown(vosContext);
Madan Mohan Koyyalamudid57ae632012-11-06 18:42:48 -0800833 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700834 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700835
836 /* SYS STOP will stop SME and MAC */
837 vosStatus = sysStop( vosContext);
838 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
839 {
840 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
841 "%s: Failed to stop SYS", __func__);
842 VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
843 }
844
845 vosStatus = WLANTL_Stop( vosContext );
846 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
847 {
848 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
849 "%s: Failed to stop TL", __func__);
850 VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
851 }
852
Jeff Johnson295189b2012-06-20 16:38:30 -0700853
854 return VOS_STATUS_SUCCESS;
855}
856
857
858/* vos_close function */
859VOS_STATUS vos_close( v_CONTEXT_t vosContext )
860{
861 VOS_STATUS vosStatus;
862
863#ifdef WLAN_BTAMP_FEATURE
864 vosStatus = WLANBAP_Close(vosContext);
865 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
866 {
867 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
868 "%s: Failed to close BAP", __func__);
869 VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
870 }
871#endif // WLAN_BTAMP_FEATURE
872
873
874 vosStatus = WLANTL_Close(vosContext);
875 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
876 {
877 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
878 "%s: Failed to close TL", __func__);
879 VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
880 }
881
882 vosStatus = sme_Close( ((pVosContextType)vosContext)->pMACContext);
883 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
884 {
885 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
886 "%s: Failed to close SME", __func__);
887 VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
888 }
889
890 vosStatus = macClose( ((pVosContextType)vosContext)->pMACContext);
891 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
892 {
893 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
894 "%s: Failed to close MAC", __func__);
895 VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
896 }
897
898 ((pVosContextType)vosContext)->pMACContext = NULL;
899
Amar Singhal0a402232013-10-11 20:57:16 -0700900#ifndef CONFIG_ENABLE_LINUX_REG
Jeff Johnson295189b2012-06-20 16:38:30 -0700901 vosStatus = vos_nv_close();
902 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
903 {
904 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
905 "%s: Failed to close NV", __func__);
906 VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
907 }
Amar Singhal0a402232013-10-11 20:57:16 -0700908#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700909
910 vosStatus = sysClose( vosContext );
911 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
912 {
913 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
914 "%s: Failed to close SYS", __func__);
915 VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
916 }
917
Jeff Johnsone7245742012-09-05 17:12:55 -0700918 if ( TRUE == WDA_needShutdown(vosContext ))
Jeff Johnson295189b2012-06-20 16:38:30 -0700919 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700920 /* if WDA stop failed, call WDA shutdown to cleanup WDA/WDI */
921 vosStatus = WDA_shutdown( vosContext, VOS_TRUE );
922 if (VOS_IS_STATUS_SUCCESS( vosStatus ) )
923 {
Madan Mohan Koyyalamudib5da5332012-10-15 17:23:21 -0700924 hdd_set_ssr_required( HDD_SSR_REQUIRED );
Jeff Johnsone7245742012-09-05 17:12:55 -0700925 }
926 else
927 {
928 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
929 "%s: Failed to shutdown WDA", __func__ );
930 VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
931 }
932 }
933 else
934 {
935 vosStatus = WDA_close( vosContext );
936 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
937 {
938 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
939 "%s: Failed to close WDA", __func__);
940 VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
941 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700942 }
943
944 /* Let DXE return packets in WDA_close and then free them here */
945 vosStatus = vos_packet_close( vosContext );
946 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
947 {
948 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
949 "%s: Failed to close VOSS Packet", __func__);
950 VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
951 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700952
Jeff Johnson295189b2012-06-20 16:38:30 -0700953
954 vos_mq_deinit(&((pVosContextType)vosContext)->freeVosMq);
955
Jeff Johnson295189b2012-06-20 16:38:30 -0700956 vosStatus = vos_event_destroy(&gpVosContext->wdaCompleteEvent);
957 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
958 {
959 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
960 "%s: failed to destroy wdaCompleteEvent", __func__);
961 VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
962 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700963
964 vosStatus = vos_event_destroy(&gpVosContext->ProbeEvent);
965 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
966 {
967 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
968 "%s: failed to destroy ProbeEvent", __func__);
969 VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
970 }
971
972 return VOS_STATUS_SUCCESS;
973}
974
975
976/**---------------------------------------------------------------------------
977
978 \brief vos_get_context() - get context data area
979
980 Each module in the system has a context / data area that is allocated
981 and maanged by voss. This API allows any user to get a pointer to its
982 allocated context data area from the VOSS global context.
983
984 \param vosContext - the VOSS Global Context.
985
986 \param moduleId - the module ID, who's context data are is being retrived.
987
988 \return - pointer to the context data area.
989
990 - NULL if the context data is not allocated for the module ID
991 specified
992
993 --------------------------------------------------------------------------*/
994v_VOID_t* vos_get_context( VOS_MODULE_ID moduleId,
995 v_CONTEXT_t pVosContext )
996{
997 v_PVOID_t pModContext = NULL;
998
999 if (pVosContext == NULL)
1000 {
1001 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001002 "%s: vos context pointer is null", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001003 return NULL;
1004 }
1005
1006 if (gpVosContext != pVosContext)
1007 {
1008 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001009 "%s: pVosContext != gpVosContext", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001010 return NULL;
1011 }
1012
1013 switch(moduleId)
1014 {
1015 case VOS_MODULE_ID_TL:
1016 {
1017 pModContext = gpVosContext->pTLContext;
1018 break;
1019 }
1020
Jeff Johnson295189b2012-06-20 16:38:30 -07001021#ifdef WLAN_BTAMP_FEATURE
1022 case VOS_MODULE_ID_BAP:
1023 {
1024 pModContext = gpVosContext->pBAPContext;
1025 break;
1026 }
1027#endif //WLAN_BTAMP_FEATURE
1028
Jeff Johnson295189b2012-06-20 16:38:30 -07001029 case VOS_MODULE_ID_SAP:
1030 {
1031 pModContext = gpVosContext->pSAPContext;
1032 break;
1033 }
1034
1035 case VOS_MODULE_ID_HDD_SOFTAP:
1036 {
1037 pModContext = gpVosContext->pHDDSoftAPContext;
1038 break;
1039 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001040
1041 case VOS_MODULE_ID_HDD:
1042 {
1043 pModContext = gpVosContext->pHDDContext;
1044 break;
1045 }
1046
1047 case VOS_MODULE_ID_SME:
Jeff Johnson295189b2012-06-20 16:38:30 -07001048 case VOS_MODULE_ID_PE:
Katya Nigam70d68332013-09-16 16:49:45 +05301049 case VOS_MODULE_ID_PMC:
Jeff Johnson295189b2012-06-20 16:38:30 -07001050 {
1051 /*
1052 ** In all these cases, we just return the MAC Context
1053 */
1054 pModContext = gpVosContext->pMACContext;
1055 break;
1056 }
1057
Jeff Johnson295189b2012-06-20 16:38:30 -07001058 case VOS_MODULE_ID_WDA:
1059 {
1060 /* For WDA module */
1061 pModContext = gpVosContext->pWDAContext;
1062 break;
1063 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001064
1065 case VOS_MODULE_ID_VOSS:
1066 {
1067 /* For SYS this is VOS itself*/
1068 pModContext = gpVosContext;
1069 break;
1070 }
1071
1072 default:
1073 {
1074 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,"%s: Module ID %i "
1075 "does not have its context maintained by VOSS", __func__, moduleId);
1076 VOS_ASSERT(0);
1077 return NULL;
1078 }
1079 }
1080
1081 if (pModContext == NULL )
1082 {
1083 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,"%s: Module ID %i "
1084 "context is Null", __func__, moduleId);
1085 }
1086
1087 return pModContext;
1088
1089} /* vos_get_context()*/
1090
1091
1092/**---------------------------------------------------------------------------
1093
1094 \brief vos_get_global_context() - get VOSS global Context
1095
1096 This API allows any user to get the VOS Global Context pointer from a
1097 module context data area.
1098
1099 \param moduleContext - the input module context pointer
1100
1101 \param moduleId - the module ID who's context pointer is input in
1102 moduleContext.
1103
1104 \return - pointer to the VOSS global context
1105
1106 - NULL if the function is unable to retreive the VOSS context.
1107
1108 --------------------------------------------------------------------------*/
1109v_CONTEXT_t vos_get_global_context( VOS_MODULE_ID moduleId,
1110 v_VOID_t *moduleContext )
1111{
1112 if (gpVosContext == NULL)
1113 {
1114 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001115 "%s: global voss context is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001116 }
1117
1118 return gpVosContext;
1119
1120} /* vos_get_global_context() */
1121
1122
1123v_U8_t vos_is_logp_in_progress(VOS_MODULE_ID moduleId, v_VOID_t *moduleContext)
1124{
1125 if (gpVosContext == NULL)
1126 {
1127 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001128 "%s: global voss context is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001129 return 1;
1130 }
1131
1132 return gpVosContext->isLogpInProgress;
1133}
1134
1135void vos_set_logp_in_progress(VOS_MODULE_ID moduleId, v_U8_t value)
1136{
1137 if (gpVosContext == NULL)
1138 {
1139 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001140 "%s: global voss context is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001141 return;
1142 }
1143
1144 gpVosContext->isLogpInProgress = value;
1145}
1146
1147v_U8_t vos_is_load_unload_in_progress(VOS_MODULE_ID moduleId, v_VOID_t *moduleContext)
1148{
1149 if (gpVosContext == NULL)
1150 {
1151 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001152 "%s: global voss context is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001153 return 0;
1154 }
1155
1156 return gpVosContext->isLoadUnloadInProgress;
1157}
1158
1159void vos_set_load_unload_in_progress(VOS_MODULE_ID moduleId, v_U8_t value)
1160{
1161 if (gpVosContext == NULL)
1162 {
1163 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001164 "%s: global voss context is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001165 return;
1166 }
1167
1168 gpVosContext->isLoadUnloadInProgress = value;
1169}
1170
Sameer Thalappil9ab2fe52013-10-22 12:50:24 -07001171v_U8_t vos_is_reinit_in_progress(VOS_MODULE_ID moduleId, v_VOID_t *moduleContext)
1172{
1173 if (gpVosContext == NULL)
1174 {
1175 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
1176 "%s: global voss context is NULL", __func__);
1177 return 1;
1178 }
1179
1180 return gpVosContext->isReInitInProgress;
1181}
1182
1183void vos_set_reinit_in_progress(VOS_MODULE_ID moduleId, v_U8_t value)
1184{
1185 if (gpVosContext == NULL)
1186 {
1187 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
1188 "%s: global voss context is NULL", __func__);
1189 return;
1190 }
1191
1192 gpVosContext->isReInitInProgress = value;
1193}
1194
1195
Jeff Johnson295189b2012-06-20 16:38:30 -07001196/**---------------------------------------------------------------------------
1197
1198 \brief vos_alloc_context() - allocate a context within the VOSS global Context
1199
1200 This API allows any user to allocate a user context area within the
1201 VOS Global Context.
1202
1203 \param pVosContext - pointer to the global Vos context
1204
1205 \param moduleId - the module ID who's context area is being allocated.
1206
1207 \param ppModuleContext - pointer to location where the pointer to the
1208 allocated context is returned. Note this
1209 output pointer is valid only if the API
1210 returns VOS_STATUS_SUCCESS
1211
1212 \param size - the size of the context area to be allocated.
1213
1214 \return - VOS_STATUS_SUCCESS - the context for the module ID has been
1215 allocated successfully. The pointer to the context area
1216 can be found in *ppModuleContext.
1217 \note This function returns VOS_STATUS_SUCCESS if the
1218 module context was already allocated and the size
1219 allocated matches the size on this call.
1220
1221 VOS_STATUS_E_INVAL - the moduleId is not a valid or does
1222 not identify a module that can have a context allocated.
1223
1224 VOS_STATUS_E_EXISTS - vos could allocate the requested context
1225 because a context for this module ID already exists and it is
1226 a *different* size that specified on this call.
1227
1228 VOS_STATUS_E_NOMEM - vos could not allocate memory for the
1229 requested context area.
1230
1231 \sa vos_get_context(), vos_free_context()
1232
1233 --------------------------------------------------------------------------*/
1234VOS_STATUS vos_alloc_context( v_VOID_t *pVosContext, VOS_MODULE_ID moduleID,
1235 v_VOID_t **ppModuleContext, v_SIZE_t size )
1236{
1237 v_VOID_t ** pGpModContext = NULL;
1238
1239 if ( pVosContext == NULL) {
1240 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001241 "%s: vos context is null", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001242 return VOS_STATUS_E_FAILURE;
1243 }
1244
1245 if (( gpVosContext != pVosContext) || ( ppModuleContext == NULL)) {
1246 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001247 "%s: context mismatch or null param passed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001248 return VOS_STATUS_E_FAILURE;
1249 }
1250
1251 switch(moduleID)
1252 {
1253 case VOS_MODULE_ID_TL:
1254 {
1255 pGpModContext = &(gpVosContext->pTLContext);
1256 break;
1257 }
1258
Jeff Johnson295189b2012-06-20 16:38:30 -07001259#ifdef WLAN_BTAMP_FEATURE
1260 case VOS_MODULE_ID_BAP:
1261 {
1262 pGpModContext = &(gpVosContext->pBAPContext);
1263 break;
1264 }
1265#endif //WLAN_BTAMP_FEATURE
1266
Jeff Johnson295189b2012-06-20 16:38:30 -07001267 case VOS_MODULE_ID_SAP:
1268 {
1269 pGpModContext = &(gpVosContext->pSAPContext);
1270 break;
1271 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001272
Jeff Johnson295189b2012-06-20 16:38:30 -07001273 case VOS_MODULE_ID_WDA:
1274 {
1275 pGpModContext = &(gpVosContext->pWDAContext);
1276 break;
1277 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001278 case VOS_MODULE_ID_SME:
Jeff Johnson295189b2012-06-20 16:38:30 -07001279 case VOS_MODULE_ID_PE:
Katya Nigam70d68332013-09-16 16:49:45 +05301280 case VOS_MODULE_ID_PMC:
Jeff Johnson295189b2012-06-20 16:38:30 -07001281 case VOS_MODULE_ID_HDD:
Jeff Johnson295189b2012-06-20 16:38:30 -07001282 case VOS_MODULE_ID_HDD_SOFTAP:
Jeff Johnson295189b2012-06-20 16:38:30 -07001283 default:
1284 {
1285 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: Module ID %i "
1286 "does not have its context allocated by VOSS", __func__, moduleID);
1287 VOS_ASSERT(0);
1288 return VOS_STATUS_E_INVAL;
1289 }
1290 }
1291
1292 if ( NULL != *pGpModContext)
1293 {
1294 /*
1295 ** Context has already been allocated!
1296 ** Prevent double allocation
1297 */
1298 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
1299 "%s: Module ID %i context has already been allocated",
1300 __func__, moduleID);
1301 return VOS_STATUS_E_EXISTS;
1302 }
1303
1304 /*
1305 ** Dynamically allocate the context for module
1306 */
1307
1308 *ppModuleContext = kmalloc(size, GFP_KERNEL);
1309
1310
1311 if ( *ppModuleContext == NULL)
1312 {
1313 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,"%s: Failed to "
1314 "allocate Context for module ID %i", __func__, moduleID);
1315 VOS_ASSERT(0);
1316 return VOS_STATUS_E_NOMEM;
1317 }
1318
1319 if (moduleID==VOS_MODULE_ID_TL)
1320 {
1321 vos_mem_zero(*ppModuleContext, size);
1322 }
1323
1324 *pGpModContext = *ppModuleContext;
1325
1326 return VOS_STATUS_SUCCESS;
1327
1328} /* vos_alloc_context() */
1329
1330
1331/**---------------------------------------------------------------------------
1332
1333 \brief vos_free_context() - free an allocated a context within the
1334 VOSS global Context
1335
1336 This API allows a user to free the user context area within the
1337 VOS Global Context.
1338
1339 \param pVosContext - pointer to the global Vos context
1340
1341 \param moduleId - the module ID who's context area is being free
1342
1343 \param pModuleContext - pointer to module context area to be free'd.
1344
1345 \return - VOS_STATUS_SUCCESS - the context for the module ID has been
1346 free'd. The pointer to the context area is not longer
1347 available.
1348
1349 VOS_STATUS_E_FAULT - pVosContext or pModuleContext are not
1350 valid pointers.
1351
1352 VOS_STATUS_E_INVAL - the moduleId is not a valid or does
1353 not identify a module that can have a context free'd.
1354
1355 VOS_STATUS_E_EXISTS - vos could not free the requested
1356 context area because a context for this module ID does not
1357 exist in the global vos context.
1358
1359 \sa vos_get_context()
1360
1361 --------------------------------------------------------------------------*/
1362VOS_STATUS vos_free_context( v_VOID_t *pVosContext, VOS_MODULE_ID moduleID,
1363 v_VOID_t *pModuleContext )
1364{
1365 v_VOID_t ** pGpModContext = NULL;
1366
1367 if (( pVosContext == NULL) || ( gpVosContext != pVosContext) ||
1368 ( pModuleContext == NULL))
1369 {
1370 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
1371 "%s: Null params or context mismatch", __func__);
1372 return VOS_STATUS_E_FAILURE;
1373 }
1374
1375
1376 switch(moduleID)
1377 {
1378 case VOS_MODULE_ID_TL:
1379 {
1380 pGpModContext = &(gpVosContext->pTLContext);
1381 break;
1382 }
1383
Jeff Johnson295189b2012-06-20 16:38:30 -07001384#ifdef WLAN_BTAMP_FEATURE
1385 case VOS_MODULE_ID_BAP:
1386 {
1387 pGpModContext = &(gpVosContext->pBAPContext);
1388 break;
1389 }
1390#endif //WLAN_BTAMP_FEATURE
1391
Jeff Johnson295189b2012-06-20 16:38:30 -07001392 case VOS_MODULE_ID_SAP:
1393 {
1394 pGpModContext = &(gpVosContext->pSAPContext);
1395 break;
1396 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001397
Jeff Johnson295189b2012-06-20 16:38:30 -07001398 case VOS_MODULE_ID_WDA:
1399 {
1400 pGpModContext = &(gpVosContext->pWDAContext);
1401 break;
1402 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001403 case VOS_MODULE_ID_HDD:
1404 case VOS_MODULE_ID_SME:
Jeff Johnson295189b2012-06-20 16:38:30 -07001405 case VOS_MODULE_ID_PE:
Katya Nigam70d68332013-09-16 16:49:45 +05301406 case VOS_MODULE_ID_PMC:
Jeff Johnson295189b2012-06-20 16:38:30 -07001407 case VOS_MODULE_ID_HDD_SOFTAP:
Jeff Johnson295189b2012-06-20 16:38:30 -07001408 default:
1409 {
1410 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: Module ID %i "
1411 "does not have its context allocated by VOSS", __func__, moduleID);
1412 VOS_ASSERT(0);
1413 return VOS_STATUS_E_INVAL;
1414 }
1415 }
1416
1417 if ( NULL == *pGpModContext)
1418 {
1419 /*
1420 ** Context has not been allocated or freed already!
1421 */
1422 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,"%s: Module ID %i "
1423 "context has not been allocated or freed already", __func__,moduleID);
1424 return VOS_STATUS_E_FAILURE;
1425 }
1426
1427 if (*pGpModContext != pModuleContext)
1428 {
1429 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001430 "%s: pGpModContext != pModuleContext", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001431 return VOS_STATUS_E_FAILURE;
1432 }
1433
1434 if(pModuleContext != NULL)
1435 kfree(pModuleContext);
1436
1437 *pGpModContext = NULL;
1438
1439 return VOS_STATUS_SUCCESS;
1440
1441} /* vos_free_context() */
1442
1443
1444/**---------------------------------------------------------------------------
1445
1446 \brief vos_mq_post_message() - post a message to a message queue
1447
1448 This API allows messages to be posted to a specific message queue. Messages
1449 can be posted to the following message queues:
1450
1451 <ul>
1452 <li> SME
1453 <li> PE
1454 <li> HAL
1455 <li> TL
1456 </ul>
1457
1458 \param msgQueueId - identifies the message queue upon which the message
1459 will be posted.
1460
1461 \param message - a pointer to a message buffer. Memory for this message
1462 buffer is allocated by the caller and free'd by the vOSS after the
1463 message is posted to the message queue. If the consumer of the
1464 message needs anything in this message, it needs to copy the contents
1465 before returning from the message queue handler.
1466
1467 \return VOS_STATUS_SUCCESS - the message has been successfully posted
1468 to the message queue.
1469
1470 VOS_STATUS_E_INVAL - The value specified by msgQueueId does not
1471 refer to a valid Message Queue Id.
1472
1473 VOS_STATUS_E_FAULT - message is an invalid pointer.
1474
1475 VOS_STATUS_E_FAILURE - the message queue handler has reported
1476 an unknown failure.
1477
1478 \sa
1479
1480 --------------------------------------------------------------------------*/
1481VOS_STATUS vos_mq_post_message( VOS_MQ_ID msgQueueId, vos_msg_t *pMsg )
1482{
1483 pVosMqType pTargetMq = NULL;
1484 pVosMsgWrapper pMsgWrapper = NULL;
1485
1486 if ((gpVosContext == NULL) || (pMsg == NULL))
1487 {
1488 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
1489 "%s: Null params or global vos context is null", __func__);
1490 VOS_ASSERT(0);
1491 return VOS_STATUS_E_FAILURE;
1492 }
1493
1494 switch (msgQueueId)
1495 {
1496 /// Message Queue ID for messages bound for SME
1497 case VOS_MQ_ID_SME:
1498 {
1499 pTargetMq = &(gpVosContext->vosSched.smeMcMq);
1500 break;
1501 }
1502
1503 /// Message Queue ID for messages bound for PE
1504 case VOS_MQ_ID_PE:
1505 {
1506 pTargetMq = &(gpVosContext->vosSched.peMcMq);
1507 break;
1508 }
1509
Jeff Johnson295189b2012-06-20 16:38:30 -07001510 /// Message Queue ID for messages bound for WDA
1511 case VOS_MQ_ID_WDA:
1512 {
1513 pTargetMq = &(gpVosContext->vosSched.wdaMcMq);
1514 break;
1515 }
1516
1517 /// Message Queue ID for messages bound for WDI
1518 case VOS_MQ_ID_WDI:
1519 {
1520 pTargetMq = &(gpVosContext->vosSched.wdiMcMq);
1521 break;
1522 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001523
1524 /// Message Queue ID for messages bound for TL
1525 case VOS_MQ_ID_TL:
1526 {
1527 pTargetMq = &(gpVosContext->vosSched.tlMcMq);
1528 break;
1529 }
1530
1531 /// Message Queue ID for messages bound for the SYS module
1532 case VOS_MQ_ID_SYS:
1533 {
1534 pTargetMq = &(gpVosContext->vosSched.sysMcMq);
1535 break;
1536 }
1537
1538 default:
1539
1540 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
1541 ("%s: Trying to queue msg into unknown MC Msg queue ID %d"),
1542 __func__, msgQueueId);
1543
1544 return VOS_STATUS_E_FAILURE;
1545 }
1546
1547 VOS_ASSERT(NULL !=pTargetMq);
1548 if (pTargetMq == NULL)
1549 {
1550 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001551 "%s: pTargetMq == NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001552 return VOS_STATUS_E_FAILURE;
1553 }
1554
1555 /*
1556 ** Try and get a free Msg wrapper
1557 */
1558 pMsgWrapper = vos_mq_get(&gpVosContext->freeVosMq);
1559
1560 if (NULL == pMsgWrapper)
1561 {
1562 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
1563 "%s: VOS Core run out of message wrapper", __func__);
1564
1565 return VOS_STATUS_E_RESOURCES;
1566 }
1567
1568 /*
1569 ** Copy the message now
1570 */
1571 vos_mem_copy( (v_VOID_t*)pMsgWrapper->pVosMsg,
1572 (v_VOID_t*)pMsg, sizeof(vos_msg_t));
1573
1574 vos_mq_put(pTargetMq, pMsgWrapper);
1575
1576 set_bit(MC_POST_EVENT_MASK, &gpVosContext->vosSched.mcEventFlag);
1577 wake_up_interruptible(&gpVosContext->vosSched.mcWaitQueue);
1578
1579 return VOS_STATUS_SUCCESS;
1580
1581} /* vos_mq_post_message()*/
1582
1583
1584/**---------------------------------------------------------------------------
1585
1586 \brief vos_tx_mq_serialize() - serialize a message to the Tx execution flow
1587
1588 This API allows messages to be posted to a specific message queue in the
1589 Tx excution flow. Messages for the Tx execution flow can be posted only
1590 to the following queue.
1591
1592 <ul>
1593 <li> TL
1594 <li> SSC/WDI
1595 </ul>
1596
1597 \param msgQueueId - identifies the message queue upon which the message
1598 will be posted.
1599
1600 \param message - a pointer to a message buffer. Body memory for this message
1601 buffer is allocated by the caller and free'd by the vOSS after the
1602 message is dispacthed to the appropriate component. If the consumer
1603 of the message needs to keep anything in the body, it needs to copy
1604 the contents before returning from the message handler.
1605
1606 \return VOS_STATUS_SUCCESS - the message has been successfully posted
1607 to the message queue.
1608
1609 VOS_STATUS_E_INVAL - The value specified by msgQueueId does not
1610 refer to a valid Message Queue Id.
1611
1612 VOS_STATUS_E_FAULT - message is an invalid pointer.
1613
1614 VOS_STATUS_E_FAILURE - the message queue handler has reported
1615 an unknown failure.
1616
1617 \sa
1618
1619 --------------------------------------------------------------------------*/
1620VOS_STATUS vos_tx_mq_serialize( VOS_MQ_ID msgQueueId, vos_msg_t *pMsg )
1621{
1622 pVosMqType pTargetMq = NULL;
1623 pVosMsgWrapper pMsgWrapper = NULL;
1624
1625 if ((gpVosContext == NULL) || (pMsg == NULL))
1626 {
1627 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
1628 "%s: Null params or global vos context is null", __func__);
1629 VOS_ASSERT(0);
1630 return VOS_STATUS_E_FAILURE;
1631 }
1632
1633 switch (msgQueueId)
1634 {
1635 /// Message Queue ID for messages bound for SME
1636 case VOS_MQ_ID_TL:
1637 {
1638 pTargetMq = &(gpVosContext->vosSched.tlTxMq);
1639 break;
1640 }
1641
Jeff Johnson295189b2012-06-20 16:38:30 -07001642 /// Message Queue ID for messages bound for SSC
1643 case VOS_MQ_ID_WDI:
1644 {
1645 pTargetMq = &(gpVosContext->vosSched.wdiTxMq);
1646 break;
1647 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001648
1649 /// Message Queue ID for messages bound for the SYS module
1650 case VOS_MQ_ID_SYS:
1651 {
1652 pTargetMq = &(gpVosContext->vosSched.sysTxMq);
1653 break;
1654 }
1655
1656 default:
1657
1658 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Gopichand Nakkala66c0bd02013-04-10 11:36:29 +05301659 "%s: Trying to queue msg into unknown Tx Msg queue ID %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001660 __func__, msgQueueId);
1661
1662 return VOS_STATUS_E_FAILURE;
1663 }
1664
1665 if (pTargetMq == NULL)
1666 {
1667 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001668 "%s: pTargetMq == NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001669 return VOS_STATUS_E_FAILURE;
1670 }
1671
1672
1673 /*
1674 ** Try and get a free Msg wrapper
1675 */
1676 pMsgWrapper = vos_mq_get(&gpVosContext->freeVosMq);
1677
1678 if (NULL == pMsgWrapper)
1679 {
1680 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
1681 "%s: VOS Core run out of message wrapper", __func__);
1682
1683 return VOS_STATUS_E_RESOURCES;
1684 }
1685
1686 /*
1687 ** Copy the message now
1688 */
1689 vos_mem_copy( (v_VOID_t*)pMsgWrapper->pVosMsg,
1690 (v_VOID_t*)pMsg, sizeof(vos_msg_t));
1691
1692 vos_mq_put(pTargetMq, pMsgWrapper);
1693
1694 set_bit(TX_POST_EVENT_MASK, &gpVosContext->vosSched.txEventFlag);
1695 wake_up_interruptible(&gpVosContext->vosSched.txWaitQueue);
1696
1697 return VOS_STATUS_SUCCESS;
1698
1699} /* vos_tx_mq_serialize()*/
1700
Jeff Johnson295189b2012-06-20 16:38:30 -07001701/**---------------------------------------------------------------------------
1702
1703 \brief vos_rx_mq_serialize() - serialize a message to the Rx execution flow
1704
1705 This API allows messages to be posted to a specific message queue in the
1706 Tx excution flow. Messages for the Rx execution flow can be posted only
1707 to the following queue.
1708
1709 <ul>
1710 <li> TL
1711 <li> WDI
1712 </ul>
1713
1714 \param msgQueueId - identifies the message queue upon which the message
1715 will be posted.
1716
1717 \param message - a pointer to a message buffer. Body memory for this message
1718 buffer is allocated by the caller and free'd by the vOSS after the
1719 message is dispacthed to the appropriate component. If the consumer
1720 of the message needs to keep anything in the body, it needs to copy
1721 the contents before returning from the message handler.
1722
1723 \return VOS_STATUS_SUCCESS - the message has been successfully posted
1724 to the message queue.
1725
1726 VOS_STATUS_E_INVAL - The value specified by msgQueueId does not
1727 refer to a valid Message Queue Id.
1728
1729 VOS_STATUS_E_FAULT - message is an invalid pointer.
1730
1731 VOS_STATUS_E_FAILURE - the message queue handler has reported
1732 an unknown failure.
1733
1734 \sa
1735
1736 --------------------------------------------------------------------------*/
1737
1738VOS_STATUS vos_rx_mq_serialize( VOS_MQ_ID msgQueueId, vos_msg_t *pMsg )
1739{
1740 pVosMqType pTargetMq = NULL;
1741 pVosMsgWrapper pMsgWrapper = NULL;
1742 if ((gpVosContext == NULL) || (pMsg == NULL))
1743 {
1744 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
1745 "%s: Null params or global vos context is null", __func__);
1746 VOS_ASSERT(0);
1747 return VOS_STATUS_E_FAILURE;
1748 }
1749
1750 switch (msgQueueId)
1751 {
1752
1753 case VOS_MQ_ID_SYS:
1754 {
1755 pTargetMq = &(gpVosContext->vosSched.sysRxMq);
1756 break;
1757 }
1758
1759 /// Message Queue ID for messages bound for WDI
1760 case VOS_MQ_ID_WDI:
1761 {
1762 pTargetMq = &(gpVosContext->vosSched.wdiRxMq);
1763 break;
1764 }
Katya Nigam664f5032014-05-05 12:24:32 +05301765 case VOS_MQ_ID_TL:
1766 {
1767 pTargetMq = &(gpVosContext->vosSched.tlRxMq);
1768 break;
1769 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001770
1771 default:
1772
1773 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Gopichand Nakkala66c0bd02013-04-10 11:36:29 +05301774 "%s: Trying to queue msg into unknown Rx Msg queue ID %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001775 __func__, msgQueueId);
1776
1777 return VOS_STATUS_E_FAILURE;
1778 }
1779
1780 if (pTargetMq == NULL)
1781 {
1782 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001783 "%s: pTargetMq == NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001784 return VOS_STATUS_E_FAILURE;
1785 }
1786
1787
1788 /*
1789 ** Try and get a free Msg wrapper
1790 */
1791 pMsgWrapper = vos_mq_get(&gpVosContext->freeVosMq);
1792
1793 if (NULL == pMsgWrapper)
1794 {
1795 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
1796 "%s: VOS Core run out of message wrapper", __func__);
1797
1798 return VOS_STATUS_E_RESOURCES;
1799 }
1800
1801 /*
1802 ** Copy the message now
1803 */
1804 vos_mem_copy( (v_VOID_t*)pMsgWrapper->pVosMsg,
1805 (v_VOID_t*)pMsg, sizeof(vos_msg_t));
1806
1807 vos_mq_put(pTargetMq, pMsgWrapper);
1808
1809 set_bit(RX_POST_EVENT_MASK, &gpVosContext->vosSched.rxEventFlag);
1810 wake_up_interruptible(&gpVosContext->vosSched.rxWaitQueue);
1811
1812 return VOS_STATUS_SUCCESS;
1813
1814} /* vos_rx_mq_serialize()*/
1815
Jeff Johnson295189b2012-06-20 16:38:30 -07001816v_VOID_t
1817vos_sys_probe_thread_cback
1818(
1819 v_VOID_t *pUserData
1820)
1821{
1822 if (gpVosContext != pUserData)
1823 {
1824 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001825 "%s: gpVosContext != pUserData", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001826 return;
1827 }
1828
1829 if (vos_event_set(&gpVosContext->ProbeEvent)!= VOS_STATUS_SUCCESS)
1830 {
1831 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001832 "%s: vos_event_set failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001833 return;
1834 }
1835
1836} /* vos_sys_probe_thread_cback() */
1837
Jeff Johnson295189b2012-06-20 16:38:30 -07001838v_VOID_t vos_WDAComplete_cback
1839(
1840 v_VOID_t *pUserData
1841)
1842{
1843
1844 if (gpVosContext != pUserData)
1845 {
1846 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001847 "%s: gpVosContext != pUserData", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001848 return;
1849 }
1850
1851 if (vos_event_set(&gpVosContext->wdaCompleteEvent)!= VOS_STATUS_SUCCESS)
1852 {
1853 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001854 "%s: vos_event_set failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001855 return;
1856 }
1857
1858} /* vos_WDAComplete_cback() */
Jeff Johnson295189b2012-06-20 16:38:30 -07001859
1860v_VOID_t vos_core_return_msg
1861(
1862 v_PVOID_t pVContext,
1863 pVosMsgWrapper pMsgWrapper
1864)
1865{
1866 pVosContextType pVosContext = (pVosContextType) pVContext;
1867
1868 VOS_ASSERT( gpVosContext == pVosContext);
1869
1870 if (gpVosContext != pVosContext)
1871 {
1872 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001873 "%s: gpVosContext != pVosContext", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001874 return;
1875 }
1876
1877 VOS_ASSERT( NULL !=pMsgWrapper );
1878
1879 if (pMsgWrapper == NULL)
1880 {
1881 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001882 "%s: pMsgWrapper == NULL in function", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001883 return;
1884 }
1885
1886 /*
1887 ** Return the message on the free message queue
1888 */
1889 INIT_LIST_HEAD(&pMsgWrapper->msgNode);
1890 vos_mq_put(&pVosContext->freeVosMq, pMsgWrapper);
1891
1892} /* vos_core_return_msg() */
1893
1894
1895/**
1896 @brief vos_fetch_tl_cfg_parms() - this function will attempt to read the
1897 TL config params from the registry
1898
1899 @param pAdapter : [inout] pointer to TL config block
1900
1901 @return
1902 None
1903
1904*/
1905v_VOID_t
1906vos_fetch_tl_cfg_parms
1907(
1908 WLANTL_ConfigInfoType *pTLConfig,
1909 hdd_config_t * pConfig
1910)
1911{
1912 if (pTLConfig == NULL)
1913 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001914 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s NULL ptr passed in!", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001915 return;
1916 }
1917
1918 pTLConfig->ucAcWeights[0] = pConfig->WfqBkWeight;
1919 pTLConfig->ucAcWeights[1] = pConfig->WfqBeWeight;
1920 pTLConfig->ucAcWeights[2] = pConfig->WfqViWeight;
1921 pTLConfig->ucAcWeights[3] = pConfig->WfqVoWeight;
Dhanashri Atred8c20a32014-01-03 17:20:55 -08001922 pTLConfig->ucReorderAgingTime[0] = pConfig->BkReorderAgingTime;/*WLANTL_AC_BK*/
1923 pTLConfig->ucReorderAgingTime[1] = pConfig->BeReorderAgingTime;/*WLANTL_AC_BE*/
1924 pTLConfig->ucReorderAgingTime[2] = pConfig->ViReorderAgingTime;/*WLANTL_AC_VI*/
1925 pTLConfig->ucReorderAgingTime[3] = pConfig->VoReorderAgingTime;/*WLANTL_AC_VO*/
Jeff Johnson295189b2012-06-20 16:38:30 -07001926 pTLConfig->uDelayedTriggerFrmInt = pConfig->DelayedTriggerFrmInt;
Jeff Johnson295189b2012-06-20 16:38:30 -07001927 pTLConfig->uMinFramesProcThres = pConfig->MinFramesProcThres;
Jeff Johnson295189b2012-06-20 16:38:30 -07001928
1929}
1930
1931v_BOOL_t vos_is_apps_power_collapse_allowed(void* pHddCtx)
1932{
1933 return hdd_is_apps_power_collapse_allowed((hdd_context_t*) pHddCtx);
1934}
1935
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05301936void vos_abort_mac_scan(v_U8_t sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07001937{
1938 hdd_context_t *pHddCtx = NULL;
1939 v_CONTEXT_t pVosContext = NULL;
1940
1941 /* Get the Global VOSS Context */
1942 pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
1943 if(!pVosContext) {
1944 hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Global VOS context is Null", __func__);
1945 return;
1946 }
1947
1948 /* Get the HDD context */
1949 pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, pVosContext );
1950 if(!pHddCtx) {
1951 hddLog(VOS_TRACE_LEVEL_FATAL, "%s: HDD context is Null", __func__);
1952 return;
1953 }
1954
Srinivas, Dasari138af4f2014-02-07 11:13:45 +05301955 hdd_abort_mac_scan(pHddCtx, sessionId, eCSR_SCAN_ABORT_DEFAULT);
Jeff Johnson295189b2012-06-20 16:38:30 -07001956 return;
1957}
Jeff Johnson295189b2012-06-20 16:38:30 -07001958/*---------------------------------------------------------------------------
1959
1960 \brief vos_shutdown() - shutdown VOS
1961
1962 - All VOS submodules are closed.
1963
1964 - All the WLAN SW components should have been opened. This includes
1965 SYS, MAC, SME and TL.
1966
1967
1968 \param vosContext: Global vos context
1969
1970
1971 \return VOS_STATUS_SUCCESS - Operation successfull & vos is shutdown
1972
1973 VOS_STATUS_E_FAILURE - Failure to close
1974
1975---------------------------------------------------------------------------*/
1976VOS_STATUS vos_shutdown(v_CONTEXT_t vosContext)
1977{
1978 VOS_STATUS vosStatus;
1979
1980#ifdef WLAN_BTAMP_FEATURE
1981 vosStatus = WLANBAP_Close(vosContext);
1982 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
1983 {
1984 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
1985 "%s: Failed to close BAP", __func__);
1986 VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
1987 }
1988#endif // WLAN_BTAMP_FEATURE
1989
1990 vosStatus = WLANTL_Close(vosContext);
1991 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
1992 {
1993 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
1994 "%s: Failed to close TL", __func__);
1995 VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
1996 }
1997
1998 vosStatus = sme_Close( ((pVosContextType)vosContext)->pMACContext);
1999 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
2000 {
2001 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
2002 "%s: Failed to close SME", __func__);
2003 VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
2004 }
2005
2006 vosStatus = macClose( ((pVosContextType)vosContext)->pMACContext);
2007 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
2008 {
2009 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
2010 "%s: Failed to close MAC", __func__);
2011 VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
2012 }
2013
2014 ((pVosContextType)vosContext)->pMACContext = NULL;
2015
Jeff Johnson295189b2012-06-20 16:38:30 -07002016 vosStatus = sysClose( vosContext );
2017 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
2018 {
2019 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
2020 "%s: Failed to close SYS", __func__);
2021 VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
2022 }
2023
2024 /* Let DXE return packets in WDA_close and then free them here */
2025 vosStatus = vos_packet_close( vosContext );
2026 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
2027 {
2028 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
2029 "%s: Failed to close VOSS Packet", __func__);
2030 VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
2031 }
2032
2033 vos_mq_deinit(&((pVosContextType)vosContext)->freeVosMq);
2034
2035 vosStatus = vos_event_destroy(&gpVosContext->wdaCompleteEvent);
2036 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
2037 {
2038 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
2039 "%s: failed to destroy wdaCompleteEvent", __func__);
2040 VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
2041 }
2042
2043 vosStatus = vos_event_destroy(&gpVosContext->ProbeEvent);
2044 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
2045 {
2046 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
2047 "%s: failed to destroy ProbeEvent", __func__);
2048 VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
2049 }
2050
2051 return VOS_STATUS_SUCCESS;
2052}
2053
2054/*---------------------------------------------------------------------------
2055
2056 \brief vos_wda_shutdown() - VOS interface to wda shutdown
2057
2058 - WDA/WDI shutdown
2059
2060 \param vosContext: Global vos context
2061
2062
2063 \return VOS_STATUS_SUCCESS - Operation successfull
2064
2065 VOS_STATUS_E_FAILURE - Failure to close
2066
2067---------------------------------------------------------------------------*/
2068VOS_STATUS vos_wda_shutdown(v_CONTEXT_t vosContext)
2069{
2070 VOS_STATUS vosStatus;
2071 vosStatus = WDA_shutdown(vosContext, VOS_FALSE);
2072
2073 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
2074 {
2075 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
2076 "%s: failed to shutdown WDA", __func__);
2077 VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
2078 }
2079 return vosStatus;
2080}
2081/**
2082 @brief vos_wlanShutdown() - This API will shutdown WLAN driver
2083
2084 This function is called when Riva subsystem crashes. There are two
2085 methods (or operations) in WLAN driver to handle Riva crash,
2086 1. shutdown: Called when Riva goes down, this will shutdown WLAN
2087 driver without handshaking with Riva.
2088 2. re-init: Next API
2089 @param
2090 NONE
2091 @return
2092 VOS_STATUS_SUCCESS - Operation completed successfully.
2093 VOS_STATUS_E_FAILURE - Operation failed.
2094
2095*/
2096VOS_STATUS vos_wlanShutdown(void)
2097{
2098 VOS_STATUS vstatus;
2099 vstatus = vos_watchdog_wlan_shutdown();
2100 return vstatus;
2101}
2102/**
2103 @brief vos_wlanReInit() - This API will re-init WLAN driver
2104
2105 This function is called when Riva subsystem reboots. There are two
2106 methods (or operations) in WLAN driver to handle Riva crash,
2107 1. shutdown: Previous API
2108 2. re-init: Called when Riva comes back after the crash. This will
2109 re-initialize WLAN driver. In some cases re-open may be
2110 referred instead of re-init.
2111 @param
2112 NONE
2113 @return
2114 VOS_STATUS_SUCCESS - Operation completed successfully.
2115 VOS_STATUS_E_FAILURE - Operation failed.
2116
2117*/
2118VOS_STATUS vos_wlanReInit(void)
2119{
2120 VOS_STATUS vstatus;
2121 vstatus = vos_watchdog_wlan_re_init();
2122 return vstatus;
2123}
Jeff Johnsone7245742012-09-05 17:12:55 -07002124/**
2125 @brief vos_wlanRestart() - This API will reload WLAN driver.
2126
2127 This function is called if driver detects any fatal state which
2128 can be recovered by a WLAN module reload ( Android framwork initiated ).
2129 Note that this API will not initiate any RIVA subsystem restart.
2130
2131 The function wlan_hdd_restart_driver protects against re-entrant calls.
2132
2133 @param
2134 NONE
2135 @return
2136 VOS_STATUS_SUCCESS - Operation completed successfully.
2137 VOS_STATUS_E_FAILURE - Operation failed.
2138 VOS_STATUS_E_EMPTY - No configured interface
2139 VOS_STATUS_E_ALREADY - Request already in progress
2140
2141
2142*/
2143VOS_STATUS vos_wlanRestart(void)
2144{
2145 VOS_STATUS vstatus;
2146 hdd_context_t *pHddCtx = NULL;
2147 v_CONTEXT_t pVosContext = NULL;
2148
2149 /* Check whether driver load unload is in progress */
2150 if(vos_is_load_unload_in_progress( VOS_MODULE_ID_VOSS, NULL))
2151 {
2152 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
2153 "%s: Driver load/unload is in progress, retry later.", __func__);
2154 return VOS_STATUS_E_AGAIN;
2155 }
2156
2157 /* Get the Global VOSS Context */
2158 pVosContext = vos_get_global_context(VOS_MODULE_ID_VOSS, NULL);
2159 if(!pVosContext) {
2160 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
2161 "%s: Global VOS context is Null", __func__);
2162 return VOS_STATUS_E_FAILURE;
2163 }
2164
2165 /* Get the HDD context */
2166 pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, pVosContext );
2167 if(!pHddCtx) {
2168 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
2169 "%s: HDD context is Null", __func__);
2170 return VOS_STATUS_E_FAILURE;
2171 }
2172
2173 /* Reload the driver */
2174 vstatus = wlan_hdd_restart_driver(pHddCtx);
2175 return vstatus;
2176}
Madan Mohan Koyyalamudi62080282013-08-05 12:51:17 +05302177
2178
2179/**
2180 @brief vos_fwDumpReq()
2181
2182 This function is called to issue dump commands to Firmware
2183
2184 @param
2185 cmd - Command No. to execute
2186 arg1 - argument 1 to cmd
2187 arg2 - argument 2 to cmd
2188 arg3 - argument 3 to cmd
2189 arg4 - argument 4 to cmd
2190 @return
2191 NONE
2192*/
2193v_VOID_t vos_fwDumpReq(tANI_U32 cmd, tANI_U32 arg1, tANI_U32 arg2,
2194 tANI_U32 arg3, tANI_U32 arg4)
2195{
Madan Mohan Koyyalamudi62080282013-08-05 12:51:17 +05302196 WDA_HALDumpCmdReq(NULL, cmd, arg1, arg2, arg3, arg4, NULL);
Madan Mohan Koyyalamudi62080282013-08-05 12:51:17 +05302197}