blob: af4411c59ad67092b011ecfd53dcd304a24f0ac7 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Gopichand Nakkala92f07d82013-01-08 21:16:34 -08002 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21/*
Jeff Johnson32d95a32012-09-10 13:15:23 -070022 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -070023 *
24 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
25 *
26 *
27 * Permission to use, copy, modify, and/or distribute this software for
28 * any purpose with or without fee is hereby granted, provided that the
29 * above copyright notice and this permission notice appear in all
30 * copies.
31 *
32 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
33 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
34 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
35 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
36 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
37 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
38 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
39 * PERFORMANCE OF THIS SOFTWARE.
40 */
41
42/**=========================================================================
Jeff Johnson2f5cfec2013-02-22 21:25:10 -080043
Jeff Johnson295189b2012-06-20 16:38:30 -070044 \file vos_api.c
45
46 \brief Stub file for all virtual Operating System Services (vOSS) APIs
Jeff Johnson295189b2012-06-20 16:38:30 -070047
48 ========================================================================*/
49 /*===========================================================================
50
51 EDIT HISTORY FOR FILE
52
53
54 This section contains comments describing changes made to the module.
55 Notice that changes are listed in reverse chronological order.
56
57
58 $Header:$ $DateTime: $ $Author: $
59
60
61 when who what, where, why
62 -------- --- --------------------------------------------------------
63 03/29/09 kanand Created module.
64===========================================================================*/
65
66/*--------------------------------------------------------------------------
67 Include Files
68 ------------------------------------------------------------------------*/
Jeff Johnson295189b2012-06-20 16:38:30 -070069#include <vos_mq.h>
70#include "vos_sched.h"
71#include <vos_api.h>
72#include "sirTypes.h"
73#include "sirApi.h"
74#include "sirMacProtDef.h"
75#include "sme_Api.h"
76#include "macInitApi.h"
77#include "wlan_qct_sys.h"
78#include "wlan_qct_tl.h"
79#include "wlan_hdd_misc.h"
80#include "i_vos_packet.h"
81#include "vos_nvitem.h"
82#include "wlan_qct_wda.h"
83#include "wlan_hdd_main.h"
84#include <linux/vmalloc.h>
Madan Mohan Koyyalamudic3a240c2012-09-28 15:34:08 -070085#include "wlan_hdd_cfg80211.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070086
Jeff Johnson295189b2012-06-20 16:38:30 -070087#include "sapApi.h"
Leela Venkata Kiran Kumar Reddy Chirala57af2692013-04-10 22:39:51 -070088#include "vos_trace.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070089
90
91
92#ifdef WLAN_BTAMP_FEATURE
93#include "bapApi.h"
94#include "bapInternal.h"
95#include "bap_hdd_main.h"
96#endif //WLAN_BTAMP_FEATURE
97
98
99/*---------------------------------------------------------------------------
100 * Preprocessor Definitions and Constants
101 * ------------------------------------------------------------------------*/
102/* Amount of time to wait for WDA to perform an asynchronous activity.
103 This value should be larger than the timeout used by WDI to wait for
104 a response from WCNSS since in the event that WCNSS is not responding,
105 WDI should handle that timeout */
106#define VOS_WDA_TIMEOUT 15000
107
108/* Approximate amount of time to wait for WDA to stop WDI */
109#define VOS_WDA_STOP_TIMEOUT WDA_STOP_TIMEOUT
110
Madan Mohan Koyyalamudi62080282013-08-05 12:51:17 +0530111/* Approximate amount of time to wait for WDA to issue a DUMP req */
112#define VOS_WDA_RESP_TIMEOUT WDA_STOP_TIMEOUT
113
Jeff Johnson295189b2012-06-20 16:38:30 -0700114/*---------------------------------------------------------------------------
115 * Data definitions
116 * ------------------------------------------------------------------------*/
117static VosContextType gVosContext;
118static pVosContextType gpVosContext;
119
120/*---------------------------------------------------------------------------
121 * Forward declaration
122 * ------------------------------------------------------------------------*/
123v_VOID_t vos_sys_probe_thread_cback ( v_VOID_t *pUserData );
124
Jeff Johnson295189b2012-06-20 16:38:30 -0700125v_VOID_t vos_core_return_msg(v_PVOID_t pVContext, pVosMsgWrapper pMsgWrapper);
126
127v_VOID_t vos_fetch_tl_cfg_parms ( WLANTL_ConfigInfoType *pTLConfig,
128 hdd_config_t * pConfig );
Jeff Johnson295189b2012-06-20 16:38:30 -0700129
130
131/*---------------------------------------------------------------------------
132
133 \brief vos_preOpen() - PreOpen the vOSS Module
134
135 The \a vos_preOpen() function allocates the Vos Context, but do not
136 initialize all the members. This overal initialization will happen
137 at vos_Open().
138 The reason why we need vos_preOpen() is to get a minimum context
139 where to store BAL and SAL relative data, which happens before
140 vos_Open() is called.
141
142 \param pVosContext: A pointer to where to store the VOS Context
143
144
145 \return VOS_STATUS_SUCCESS - Scheduler was successfully initialized and
146 is ready to be used.
147
148 VOS_STATUS_E_FAILURE - Failure to initialize the scheduler/
149
150 \sa vos_Open()
151
152---------------------------------------------------------------------------*/
153VOS_STATUS vos_preOpen ( v_CONTEXT_t *pVosContext )
154{
155 if ( pVosContext == NULL)
156 return VOS_STATUS_E_FAILURE;
157
158 /* Allocate the VOS Context */
159 *pVosContext = NULL;
160 gpVosContext = &gVosContext;
161
162 if (NULL == gpVosContext)
163 {
164 /* Critical Error ...Cannot proceed further */
165 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
166 "%s: Failed to allocate VOS Context", __func__);
167 VOS_ASSERT(0);
168 return VOS_STATUS_E_RESOURCES;
169 }
170
171 vos_mem_zero(gpVosContext, sizeof(VosContextType));
172
173 *pVosContext = gpVosContext;
174
Leela Venkata Kiran Kumar Reddy Chirala57af2692013-04-10 22:39:51 -0700175 /* Initialize the spinlock */
176 vos_trace_spin_lock_init();
177 /* it is the right time to initialize MTRACE structures */
178 #if defined(TRACE_RECORD)
179 vosTraceInit();
180 #endif
181
Jeff Johnson295189b2012-06-20 16:38:30 -0700182 return VOS_STATUS_SUCCESS;
183
184} /* vos_preOpen()*/
185
186
187/*---------------------------------------------------------------------------
188
189 \brief vos_preClose() - PreClose the vOSS Module
190
191 The \a vos_preClose() function frees the Vos Context.
192
193 \param pVosContext: A pointer to where the VOS Context was stored
194
195
196 \return VOS_STATUS_SUCCESS - Always successful
197
198
199 \sa vos_preClose()
200 \sa vos_close()
201---------------------------------------------------------------------------*/
202VOS_STATUS vos_preClose( v_CONTEXT_t *pVosContext )
203{
204
205 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
206 "%s: De-allocating the VOS Context", __func__);
207
208 if (( pVosContext == NULL) || (*pVosContext == NULL))
209 {
210 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
211 "%s: vOS Context is Null", __func__);
212 return VOS_STATUS_E_FAILURE;
213 }
214
215 if (gpVosContext != *pVosContext)
216 {
217 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
218 "%s: Context mismatch", __func__);
219 return VOS_STATUS_E_FAILURE;
220 }
221
222 *pVosContext = gpVosContext = NULL;
223
224 return VOS_STATUS_SUCCESS;
225
226} /* vos_preClose()*/
227
228/*---------------------------------------------------------------------------
229
230 \brief vos_open() - Open the vOSS Module
231
232 The \a vos_open() function opens the vOSS Scheduler
233 Upon successful initialization:
234
235 - All VOS submodules should have been initialized
236
237 - The VOS scheduler should have opened
238
239 - All the WLAN SW components should have been opened. This includes
240 SYS, MAC, SME, WDA and TL.
241
242
243 \param hddContextSize: Size of the HDD context to allocate.
244
245
246 \return VOS_STATUS_SUCCESS - Scheduler was successfully initialized and
247 is ready to be used.
248
249 VOS_STATUS_E_RESOURCES - System resources (other than memory)
250 are unavailable to initilize the scheduler
251
252
253 VOS_STATUS_E_FAILURE - Failure to initialize the scheduler/
254
255 \sa vos_preOpen()
256
257---------------------------------------------------------------------------*/
258VOS_STATUS vos_open( v_CONTEXT_t *pVosContext, v_SIZE_t hddContextSize )
259
260{
261 VOS_STATUS vStatus = VOS_STATUS_SUCCESS;
262 int iter = 0;
263 tSirRetStatus sirStatus = eSIR_SUCCESS;
264 tMacOpenParameters macOpenParms;
265 WLANTL_ConfigInfoType TLConfig;
266
267 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH,
268 "%s: Opening VOSS", __func__);
269
270 if (NULL == gpVosContext)
271 {
272 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
273 "%s: Trying to open VOSS without a PreOpen", __func__);
274 VOS_ASSERT(0);
275 return VOS_STATUS_E_FAILURE;
276 }
277
278 /* Initialize the timer module */
279 vos_timer_module_init();
280
Leela Venkata Kiran Kumar Reddy Chirala57af2692013-04-10 22:39:51 -0700281
Jeff Johnson295189b2012-06-20 16:38:30 -0700282 /* Initialize the probe event */
283 if (vos_event_init(&gpVosContext->ProbeEvent) != VOS_STATUS_SUCCESS)
284 {
285 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
286 "%s: Unable to init probeEvent", __func__);
287 VOS_ASSERT(0);
288 return VOS_STATUS_E_FAILURE;
289 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700290 if (vos_event_init( &(gpVosContext->wdaCompleteEvent) ) != VOS_STATUS_SUCCESS )
291 {
292 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
293 "%s: Unable to init wdaCompleteEvent", __func__);
294 VOS_ASSERT(0);
295
296 goto err_probe_event;
297 }
298
Jeff Johnson295189b2012-06-20 16:38:30 -0700299 /* Initialize the free message queue */
300 vStatus = vos_mq_init(&gpVosContext->freeVosMq);
301 if (! VOS_IS_STATUS_SUCCESS(vStatus))
302 {
303
304 /* Critical Error ... Cannot proceed further */
305 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
306 "%s: Failed to initialize VOS free message queue", __func__);
307 VOS_ASSERT(0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700308 goto err_wda_complete_event;
Jeff Johnson295189b2012-06-20 16:38:30 -0700309 }
310
311 for (iter = 0; iter < VOS_CORE_MAX_MESSAGES; iter++)
312 {
313 (gpVosContext->aMsgWrappers[iter]).pVosMsg =
314 &(gpVosContext->aMsgBuffers[iter]);
315 INIT_LIST_HEAD(&gpVosContext->aMsgWrappers[iter].msgNode);
316 vos_mq_put(&gpVosContext->freeVosMq, &(gpVosContext->aMsgWrappers[iter]));
317 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700318
319 /* Now Open the VOS Scheduler */
320 vStatus= vos_sched_open(gpVosContext, &gpVosContext->vosSched,
321 sizeof(VosSchedContext));
322
323 if (!VOS_IS_STATUS_SUCCESS(vStatus))
324 {
325 /* Critical Error ... Cannot proceed further */
326 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
327 "%s: Failed to open VOS Scheduler", __func__);
328 VOS_ASSERT(0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700329 goto err_msg_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700330 }
331
Jeff Johnson295189b2012-06-20 16:38:30 -0700332 /*
333 ** Need to open WDA first because it calls WDI_Init, which calls wpalOpen
334 ** The reason that is needed becasue vos_packet_open need to use PAL APIs
335 */
336
337 /*Open the WDA module */
338 vos_mem_set(&macOpenParms, sizeof(macOpenParms), 0);
339 /* UMA is supported in hardware for performing the
340 ** frame translation 802.11 <-> 802.3
341 */
342 macOpenParms.frameTransRequired = 1;
343 macOpenParms.driverType = eDRIVER_TYPE_PRODUCTION;
344 vStatus = WDA_open( gpVosContext, gpVosContext->pHDDContext, &macOpenParms );
345
346 if (!VOS_IS_STATUS_SUCCESS(vStatus))
347 {
348 /* Critical Error ... Cannot proceed further */
349 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
350 "%s: Failed to open WDA module", __func__);
351 VOS_ASSERT(0);
352 goto err_sched_close;
353 }
354
355 /* Initialize here the VOS Packet sub module */
356 vStatus = vos_packet_open( gpVosContext, &gpVosContext->vosPacket,
357 sizeof( vos_pkt_context_t ) );
358
359 if ( !VOS_IS_STATUS_SUCCESS( vStatus ) )
360 {
361 /* Critical Error ... Cannot proceed further */
362 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
363 "%s: Failed to open VOS Packet Module", __func__);
364 VOS_ASSERT(0);
365 goto err_wda_close;
366 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700367
368 /* Open the SYS module */
369 vStatus = sysOpen(gpVosContext);
370
371 if (!VOS_IS_STATUS_SUCCESS(vStatus))
372 {
373 /* Critical Error ... Cannot proceed further */
374 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
375 "%s: Failed to open SYS module", __func__);
376 VOS_ASSERT(0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700377 goto err_packet_close;
Jeff Johnson295189b2012-06-20 16:38:30 -0700378 }
379
Amar Singhal0a402232013-10-11 20:57:16 -0700380#ifndef CONFIG_ENABLE_LINUX_REG
Jeff Johnson295189b2012-06-20 16:38:30 -0700381 /* initialize the NV module */
382 vStatus = vos_nv_open();
383 if (!VOS_IS_STATUS_SUCCESS(vStatus))
384 {
385 // NV module cannot be initialized
386 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
387 "%s: Failed to initialize the NV module", __func__);
388 goto err_sys_close;
389 }
Amar Singhal0a402232013-10-11 20:57:16 -0700390#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700391
392 /* If we arrive here, both threads dispacthing messages correctly */
393
394 /* Now proceed to open the MAC */
395
396 /* UMA is supported in hardware for performing the
397 frame translation 802.11 <-> 802.3 */
398 macOpenParms.frameTransRequired = 1;
399 sirStatus = macOpen(&(gpVosContext->pMACContext), gpVosContext->pHDDContext,
400 &macOpenParms);
401
402 if (eSIR_SUCCESS != sirStatus)
403 {
404 /* Critical Error ... Cannot proceed further */
405 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
406 "%s: Failed to open MAC", __func__);
407 VOS_ASSERT(0);
408 goto err_nv_close;
409 }
410
411 /* Now proceed to open the SME */
412 vStatus = sme_Open(gpVosContext->pMACContext);
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 SME", __func__);
418 VOS_ASSERT(0);
419 goto err_mac_close;
420 }
421
422 /* Now proceed to open TL. Read TL config first */
423 vos_fetch_tl_cfg_parms ( &TLConfig,
424 ((hdd_context_t*)(gpVosContext->pHDDContext))->cfg_ini);
425
426 vStatus = WLANTL_Open(gpVosContext, &TLConfig);
427 if (!VOS_IS_STATUS_SUCCESS(vStatus))
428 {
429 /* Critical Error ... Cannot proceed further */
430 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
431 "%s: Failed to open TL", __func__);
432 VOS_ASSERT(0);
433 goto err_sme_close;
434 }
435
436 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH,
437 "%s: VOSS successfully Opened", __func__);
438
439 *pVosContext = gpVosContext;
440
441 return VOS_STATUS_SUCCESS;
442
443
444err_sme_close:
445 sme_Close(gpVosContext->pMACContext);
446
447err_mac_close:
448 macClose(gpVosContext->pMACContext);
449
450err_nv_close:
Amar Singhal0a402232013-10-11 20:57:16 -0700451
452#ifndef CONFIG_ENABLE_LINUX_REG
Jeff Johnson295189b2012-06-20 16:38:30 -0700453 vos_nv_close();
Amar Singhal0a402232013-10-11 20:57:16 -0700454
455err_sys_close:
456#endif
457
Jeff Johnson295189b2012-06-20 16:38:30 -0700458 sysClose(gpVosContext);
459
Jeff Johnson295189b2012-06-20 16:38:30 -0700460err_packet_close:
461 vos_packet_close( gpVosContext );
462
463err_wda_close:
464 WDA_close(gpVosContext);
Jeff Johnson295189b2012-06-20 16:38:30 -0700465
Amar Singhal0a402232013-10-11 20:57:16 -0700466err_sched_close:
Jeff Johnson295189b2012-06-20 16:38:30 -0700467 vos_sched_close(gpVosContext);
468
Jeff Johnson295189b2012-06-20 16:38:30 -0700469
470err_msg_queue:
471 vos_mq_deinit(&gpVosContext->freeVosMq);
472
Jeff Johnson295189b2012-06-20 16:38:30 -0700473err_wda_complete_event:
474 vos_event_destroy( &gpVosContext->wdaCompleteEvent );
Jeff Johnson295189b2012-06-20 16:38:30 -0700475
476err_probe_event:
477 vos_event_destroy(&gpVosContext->ProbeEvent);
478
479 return VOS_STATUS_E_FAILURE;
480
481} /* vos_open() */
482
Jeff Johnson295189b2012-06-20 16:38:30 -0700483/*---------------------------------------------------------------------------
484
485 \brief vos_preStart() -
486
487 The \a vos_preStart() function to download CFG.
488 including:
489 - ccmStart
490
491 - WDA: triggers the CFG download
492
493
494 \param pVosContext: The VOS context
495
496
497 \return VOS_STATUS_SUCCESS - Scheduler was successfully initialized and
498 is ready to be used.
499
500 VOS_STATUS_E_RESOURCES - System resources (other than memory)
501 are unavailable to initilize the scheduler
502
503
504 VOS_STATUS_E_FAILURE - Failure to initialize the scheduler/
505
506 \sa vos_start
507
508---------------------------------------------------------------------------*/
509VOS_STATUS vos_preStart( v_CONTEXT_t vosContext )
510{
511 VOS_STATUS vStatus = VOS_STATUS_SUCCESS;
512 pVosContextType pVosContext = (pVosContextType)vosContext;
513
514 VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_INFO,
515 "vos prestart");
516
Manjunathappa Prakashfb585462013-12-23 19:07:07 -0800517 if (gpVosContext != pVosContext)
518 {
519 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
520 "%s: Context mismatch", __func__);
521 VOS_ASSERT(0);
522 return VOS_STATUS_E_INVAL;
523 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700524
Manjunathappa Prakashfb585462013-12-23 19:07:07 -0800525 if (pVosContext->pMACContext == NULL)
526 {
527 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
528 "%s: MAC NULL context", __func__);
529 VOS_ASSERT(0);
530 return VOS_STATUS_E_INVAL;
531 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700532
Manjunathappa Prakashfb585462013-12-23 19:07:07 -0800533 if (pVosContext->pWDAContext == NULL)
534 {
535 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
536 "%s: WDA NULL context", __func__);
537 VOS_ASSERT(0);
538 return VOS_STATUS_E_INVAL;
539 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700540
541 /* call macPreStart */
542 vStatus = macPreStart(gpVosContext->pMACContext);
543 if ( !VOS_IS_STATUS_SUCCESS(vStatus) )
544 {
545 VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_FATAL,
546 "Failed at macPreStart ");
547 return VOS_STATUS_E_FAILURE;
548 }
549
550 /* call ccmStart */
551 ccmStart(gpVosContext->pMACContext);
552
553 /* Reset wda wait event */
554 vos_event_reset(&gpVosContext->wdaCompleteEvent);
555
556
557 /*call WDA pre start*/
558 vStatus = WDA_preStart(gpVosContext);
559 if (!VOS_IS_STATUS_SUCCESS(vStatus))
560 {
561 VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_FATAL,
562 "Failed to WDA prestart");
563 macStop(gpVosContext->pMACContext, HAL_STOP_TYPE_SYS_DEEP_SLEEP);
564 ccmStop(gpVosContext->pMACContext);
565 VOS_ASSERT(0);
566 return VOS_STATUS_E_FAILURE;
567 }
568
569 /* Need to update time out of complete */
570 vStatus = vos_wait_single_event( &gpVosContext->wdaCompleteEvent,
571 VOS_WDA_TIMEOUT );
572 if ( vStatus != VOS_STATUS_SUCCESS )
573 {
574 if ( vStatus == VOS_STATUS_E_TIMEOUT )
575 {
576 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Arif Hussain02882402013-11-17 21:55:29 -0800577 "%s: Timeout occurred before WDA complete", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700578 }
579 else
580 {
581 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
582 "%s: WDA_preStart reporting other error", __func__);
583 }
Sameer Thalappil6d69cbd2013-06-27 13:07:15 -0700584 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
585 "%s: Test MC thread by posting a probe message to SYS", __func__);
586 wlan_sys_probe();
587
Jeff Johnsone7245742012-09-05 17:12:55 -0700588 macStop(gpVosContext->pMACContext, HAL_STOP_TYPE_SYS_DEEP_SLEEP);
589 ccmStop(gpVosContext->pMACContext);
Jeff Johnson295189b2012-06-20 16:38:30 -0700590 VOS_ASSERT( 0 );
591 return VOS_STATUS_E_FAILURE;
592 }
593
594 return VOS_STATUS_SUCCESS;
595}
Jeff Johnson295189b2012-06-20 16:38:30 -0700596
597/*---------------------------------------------------------------------------
598
599 \brief vos_start() - Start the Libra SW Modules
600
601 The \a vos_start() function starts all the components of the Libra SW
602 including:
603 - SAL/BAL, which in turn starts SSC
604
605 - the MAC (HAL and PE)
606
607 - SME
608
609 - TL
610
611 - SYS: triggers the CFG download
612
613
614 \param pVosContext: The VOS context
615
616
617 \return VOS_STATUS_SUCCESS - Scheduler was successfully initialized and
618 is ready to be used.
619
620 VOS_STATUS_E_RESOURCES - System resources (other than memory)
621 are unavailable to initilize the scheduler
622
623
624 VOS_STATUS_E_FAILURE - Failure to initialize the scheduler/
625
626 \sa vos_preStart()
627 \sa vos_open()
628
629---------------------------------------------------------------------------*/
630VOS_STATUS vos_start( v_CONTEXT_t vosContext )
631{
632 VOS_STATUS vStatus = VOS_STATUS_SUCCESS;
633 tSirRetStatus sirStatus = eSIR_SUCCESS;
634 pVosContextType pVosContext = (pVosContextType)vosContext;
635 tHalMacStartParameters halStartParams;
Jeff Johnson295189b2012-06-20 16:38:30 -0700636
637 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
638 "%s: Starting Libra SW", __func__);
639
640 /* We support only one instance for now ...*/
641 if (gpVosContext != pVosContext)
642 {
643 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700644 "%s: mismatch in context", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700645 return VOS_STATUS_E_FAILURE;
646 }
647
Jeff Johnson295189b2012-06-20 16:38:30 -0700648 if (( pVosContext->pWDAContext == NULL) || ( pVosContext->pMACContext == NULL)
649 || ( pVosContext->pTLContext == NULL))
650 {
651 if (pVosContext->pWDAContext == NULL)
652 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700653 "%s: WDA NULL context", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700654 else if (pVosContext->pMACContext == NULL)
655 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700656 "%s: MAC NULL context", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700657 else
658 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700659 "%s: TL NULL context", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700660
661 return VOS_STATUS_E_FAILURE;
662 }
663
664 /* WDA_Start will be called after NV image download because the
665 NV image data has to be updated at HAL before HAL_Start gets executed*/
666
667 /* Start the NV Image Download */
668
669 vos_event_reset( &(gpVosContext->wdaCompleteEvent) );
670
671 vStatus = WDA_NVDownload_Start(pVosContext);
672
673 if ( vStatus != VOS_STATUS_SUCCESS )
674 {
675 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
676 "%s: Failed to start NV Download", __func__);
677 return VOS_STATUS_E_FAILURE;
678 }
679
680 vStatus = vos_wait_single_event( &(gpVosContext->wdaCompleteEvent),
681 VOS_WDA_TIMEOUT );
682
683 if ( vStatus != VOS_STATUS_SUCCESS )
684 {
685 if ( vStatus == VOS_STATUS_E_TIMEOUT )
686 {
687 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
688 "%s: Timeout occurred before WDA_NVDownload_start complete", __func__);
689 }
690 else
691 {
692 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
693 "%s: WDA_NVDownload_start reporting other error", __func__);
694 }
695 VOS_ASSERT(0);
Madan Mohan Koyyalamudiec231f82012-11-28 16:01:28 -0800696 vos_event_reset( &(gpVosContext->wdaCompleteEvent) );
Sameer Thalappilb511beb2013-09-09 17:11:51 -0700697 if (vos_is_logp_in_progress(VOS_MODULE_ID_VOSS, NULL))
698 {
699 VOS_BUG(0);
700 }
Madan Mohan Koyyalamudiec231f82012-11-28 16:01:28 -0800701 WDA_setNeedShutdown(vosContext);
702 return VOS_STATUS_E_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700703 }
704
705 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
706 "%s: WDA_NVDownload_start correctly started", __func__);
707
708 /* Start the WDA */
709 vStatus = WDA_start(pVosContext);
710 if ( vStatus != VOS_STATUS_SUCCESS )
711 {
712 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
713 "%s: Failed to start WDA", __func__);
714 return VOS_STATUS_E_FAILURE;
715 }
716 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
717 "%s: WDA correctly started", __func__);
718
Jeff Johnson295189b2012-06-20 16:38:30 -0700719 /* Start the MAC */
720 vos_mem_zero((v_PVOID_t)&halStartParams, sizeof(tHalMacStartParameters));
721
Jeff Johnson295189b2012-06-20 16:38:30 -0700722 /* Start the MAC */
723 sirStatus = macStart(pVosContext->pMACContext,(v_PVOID_t)&halStartParams);
724
Jeff Johnson295189b2012-06-20 16:38:30 -0700725 if (eSIR_SUCCESS != sirStatus)
726 {
727 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
728 "%s: Failed to start MAC", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700729 goto err_wda_stop;
Jeff Johnson295189b2012-06-20 16:38:30 -0700730 }
731
732 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
733 "%s: MAC correctly started", __func__);
734
735 /* START SME */
736 vStatus = sme_Start(pVosContext->pMACContext);
737
738 if (!VOS_IS_STATUS_SUCCESS(vStatus))
739 {
740 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
741 "%s: Failed to start SME", __func__);
742 goto err_mac_stop;
743 }
744
745 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
746 "%s: SME correctly started", __func__);
747
748 /** START TL */
749 vStatus = WLANTL_Start(pVosContext);
750 if (!VOS_IS_STATUS_SUCCESS(vStatus))
751 {
752 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
753 "%s: Failed to start TL", __func__);
754 goto err_sme_stop;
755 }
756
757 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
758 "TL correctly started");
Jeff Johnson295189b2012-06-20 16:38:30 -0700759 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
760 "%s: VOSS Start is successful!!", __func__);
761
762 return VOS_STATUS_SUCCESS;
763
Jeff Johnson295189b2012-06-20 16:38:30 -0700764
765err_sme_stop:
Kiet Lama72a2322013-11-15 11:18:11 +0530766 sme_Stop(pVosContext->pMACContext, HAL_STOP_TYPE_SYS_RESET);
Jeff Johnson295189b2012-06-20 16:38:30 -0700767
768err_mac_stop:
769 macStop( pVosContext->pMACContext, HAL_STOP_TYPE_SYS_RESET );
770
Jeff Johnson295189b2012-06-20 16:38:30 -0700771err_wda_stop:
772 vos_event_reset( &(gpVosContext->wdaCompleteEvent) );
Madan Mohan Koyyalamudid57ae632012-11-06 18:42:48 -0800773 vStatus = WDA_stop( pVosContext, HAL_STOP_TYPE_RF_KILL);
774 if (!VOS_IS_STATUS_SUCCESS(vStatus))
Jeff Johnson295189b2012-06-20 16:38:30 -0700775 {
Madan Mohan Koyyalamudid57ae632012-11-06 18:42:48 -0800776 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
777 "%s: Failed to stop WDA", __func__);
778 VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vStatus ) );
Madan Mohan Koyyalamudi9d7a27f2012-11-28 15:55:25 -0800779 WDA_setNeedShutdown(vosContext);
Madan Mohan Koyyalamudid57ae632012-11-06 18:42:48 -0800780 }
781 else
782 {
783 vStatus = vos_wait_single_event( &(gpVosContext->wdaCompleteEvent),
784 VOS_WDA_TIMEOUT );
785 if( vStatus != VOS_STATUS_SUCCESS )
786 {
787 if( vStatus == VOS_STATUS_E_TIMEOUT )
788 {
789 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
790 "%s: Timeout occurred before WDA_stop complete", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700791
Madan Mohan Koyyalamudid57ae632012-11-06 18:42:48 -0800792 }
793 else
794 {
795 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
796 "%s: WDA_stop reporting other error", __func__);
797 }
798 VOS_ASSERT( 0 );
Madan Mohan Koyyalamudi9d7a27f2012-11-28 15:55:25 -0800799 WDA_setNeedShutdown(vosContext);
Madan Mohan Koyyalamudid57ae632012-11-06 18:42:48 -0800800 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700801 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700802
803 return VOS_STATUS_E_FAILURE;
804
805} /* vos_start() */
806
807
808/* vos_stop function */
809VOS_STATUS vos_stop( v_CONTEXT_t vosContext )
810{
811 VOS_STATUS vosStatus;
812
Jeff Johnson295189b2012-06-20 16:38:30 -0700813 /* WDA_Stop is called before the SYS so that the processing of Riva
814 pending responces will not be handled during uninitialization of WLAN driver */
815 vos_event_reset( &(gpVosContext->wdaCompleteEvent) );
816
817 vosStatus = WDA_stop( vosContext, HAL_STOP_TYPE_RF_KILL );
818
819 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
820 {
821 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
822 "%s: Failed to stop WDA", __func__);
823 VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
Madan Mohan Koyyalamudi9d7a27f2012-11-28 15:55:25 -0800824 WDA_setNeedShutdown(vosContext);
Jeff Johnson295189b2012-06-20 16:38:30 -0700825 }
Madan Mohan Koyyalamudia2fc6412012-10-21 12:06:12 -0700826 else
827 {
Madan Mohan Koyyalamudid57ae632012-11-06 18:42:48 -0800828 vosStatus = vos_wait_single_event( &(gpVosContext->wdaCompleteEvent),
829 VOS_WDA_STOP_TIMEOUT );
Jeff Johnson295189b2012-06-20 16:38:30 -0700830
Madan Mohan Koyyalamudid57ae632012-11-06 18:42:48 -0800831 if ( vosStatus != VOS_STATUS_SUCCESS )
832 {
833 if ( vosStatus == VOS_STATUS_E_TIMEOUT )
834 {
835 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
836 "%s: Timeout occurred before WDA complete", __func__);
837 }
838 else
839 {
840 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
841 "%s: WDA_stop reporting other error", __func__ );
842 }
Sameer Thalappil6d69cbd2013-06-27 13:07:15 -0700843 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
844 "%s: Test MC thread by posting a probe message to SYS", __func__);
845 wlan_sys_probe();
Madan Mohan Koyyalamudi9d7a27f2012-11-28 15:55:25 -0800846 WDA_setNeedShutdown(vosContext);
Madan Mohan Koyyalamudid57ae632012-11-06 18:42:48 -0800847 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700848 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700849
850 /* SYS STOP will stop SME and MAC */
851 vosStatus = sysStop( vosContext);
852 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
853 {
854 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
855 "%s: Failed to stop SYS", __func__);
856 VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
857 }
858
859 vosStatus = WLANTL_Stop( vosContext );
860 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
861 {
862 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
863 "%s: Failed to stop TL", __func__);
864 VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
865 }
866
Jeff Johnson295189b2012-06-20 16:38:30 -0700867
868 return VOS_STATUS_SUCCESS;
869}
870
871
872/* vos_close function */
873VOS_STATUS vos_close( v_CONTEXT_t vosContext )
874{
875 VOS_STATUS vosStatus;
876
877#ifdef WLAN_BTAMP_FEATURE
878 vosStatus = WLANBAP_Close(vosContext);
879 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
880 {
881 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
882 "%s: Failed to close BAP", __func__);
883 VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
884 }
885#endif // WLAN_BTAMP_FEATURE
886
887
888 vosStatus = WLANTL_Close(vosContext);
889 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
890 {
891 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
892 "%s: Failed to close TL", __func__);
893 VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
894 }
895
896 vosStatus = sme_Close( ((pVosContextType)vosContext)->pMACContext);
897 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
898 {
899 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
900 "%s: Failed to close SME", __func__);
901 VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
902 }
903
904 vosStatus = macClose( ((pVosContextType)vosContext)->pMACContext);
905 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
906 {
907 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
908 "%s: Failed to close MAC", __func__);
909 VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
910 }
911
912 ((pVosContextType)vosContext)->pMACContext = NULL;
913
Amar Singhal0a402232013-10-11 20:57:16 -0700914#ifndef CONFIG_ENABLE_LINUX_REG
Jeff Johnson295189b2012-06-20 16:38:30 -0700915 vosStatus = vos_nv_close();
916 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
917 {
918 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
919 "%s: Failed to close NV", __func__);
920 VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
921 }
Amar Singhal0a402232013-10-11 20:57:16 -0700922#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700923
924 vosStatus = sysClose( vosContext );
925 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
926 {
927 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
928 "%s: Failed to close SYS", __func__);
929 VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
930 }
931
Jeff Johnsone7245742012-09-05 17:12:55 -0700932 if ( TRUE == WDA_needShutdown(vosContext ))
Jeff Johnson295189b2012-06-20 16:38:30 -0700933 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700934 /* if WDA stop failed, call WDA shutdown to cleanup WDA/WDI */
935 vosStatus = WDA_shutdown( vosContext, VOS_TRUE );
936 if (VOS_IS_STATUS_SUCCESS( vosStatus ) )
937 {
Madan Mohan Koyyalamudib5da5332012-10-15 17:23:21 -0700938 hdd_set_ssr_required( HDD_SSR_REQUIRED );
Jeff Johnsone7245742012-09-05 17:12:55 -0700939 }
940 else
941 {
942 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
943 "%s: Failed to shutdown WDA", __func__ );
944 VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
945 }
946 }
947 else
948 {
949 vosStatus = WDA_close( vosContext );
950 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
951 {
952 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
953 "%s: Failed to close WDA", __func__);
954 VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
955 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700956 }
957
958 /* Let DXE return packets in WDA_close and then free them here */
959 vosStatus = vos_packet_close( vosContext );
960 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
961 {
962 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
963 "%s: Failed to close VOSS Packet", __func__);
964 VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
965 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700966
Jeff Johnson295189b2012-06-20 16:38:30 -0700967
968 vos_mq_deinit(&((pVosContextType)vosContext)->freeVosMq);
969
Jeff Johnson295189b2012-06-20 16:38:30 -0700970 vosStatus = vos_event_destroy(&gpVosContext->wdaCompleteEvent);
971 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
972 {
973 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
974 "%s: failed to destroy wdaCompleteEvent", __func__);
975 VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
976 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700977
978 vosStatus = vos_event_destroy(&gpVosContext->ProbeEvent);
979 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
980 {
981 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
982 "%s: failed to destroy ProbeEvent", __func__);
983 VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
984 }
985
986 return VOS_STATUS_SUCCESS;
987}
988
989
990/**---------------------------------------------------------------------------
991
992 \brief vos_get_context() - get context data area
993
994 Each module in the system has a context / data area that is allocated
995 and maanged by voss. This API allows any user to get a pointer to its
996 allocated context data area from the VOSS global context.
997
998 \param vosContext - the VOSS Global Context.
999
1000 \param moduleId - the module ID, who's context data are is being retrived.
1001
1002 \return - pointer to the context data area.
1003
1004 - NULL if the context data is not allocated for the module ID
1005 specified
1006
1007 --------------------------------------------------------------------------*/
1008v_VOID_t* vos_get_context( VOS_MODULE_ID moduleId,
1009 v_CONTEXT_t pVosContext )
1010{
1011 v_PVOID_t pModContext = NULL;
1012
1013 if (pVosContext == NULL)
1014 {
1015 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001016 "%s: vos context pointer is null", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001017 return NULL;
1018 }
1019
1020 if (gpVosContext != pVosContext)
1021 {
1022 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001023 "%s: pVosContext != gpVosContext", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001024 return NULL;
1025 }
1026
1027 switch(moduleId)
1028 {
1029 case VOS_MODULE_ID_TL:
1030 {
1031 pModContext = gpVosContext->pTLContext;
1032 break;
1033 }
1034
Jeff Johnson295189b2012-06-20 16:38:30 -07001035#ifdef WLAN_BTAMP_FEATURE
1036 case VOS_MODULE_ID_BAP:
1037 {
1038 pModContext = gpVosContext->pBAPContext;
1039 break;
1040 }
1041#endif //WLAN_BTAMP_FEATURE
1042
Jeff Johnson295189b2012-06-20 16:38:30 -07001043 case VOS_MODULE_ID_SAP:
1044 {
1045 pModContext = gpVosContext->pSAPContext;
1046 break;
1047 }
1048
1049 case VOS_MODULE_ID_HDD_SOFTAP:
1050 {
1051 pModContext = gpVosContext->pHDDSoftAPContext;
1052 break;
1053 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001054
1055 case VOS_MODULE_ID_HDD:
1056 {
1057 pModContext = gpVosContext->pHDDContext;
1058 break;
1059 }
1060
1061 case VOS_MODULE_ID_SME:
Jeff Johnson295189b2012-06-20 16:38:30 -07001062 case VOS_MODULE_ID_PE:
Katya Nigam70d68332013-09-16 16:49:45 +05301063 case VOS_MODULE_ID_PMC:
Jeff Johnson295189b2012-06-20 16:38:30 -07001064 {
1065 /*
1066 ** In all these cases, we just return the MAC Context
1067 */
1068 pModContext = gpVosContext->pMACContext;
1069 break;
1070 }
1071
Jeff Johnson295189b2012-06-20 16:38:30 -07001072 case VOS_MODULE_ID_WDA:
1073 {
1074 /* For WDA module */
1075 pModContext = gpVosContext->pWDAContext;
1076 break;
1077 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001078
1079 case VOS_MODULE_ID_VOSS:
1080 {
1081 /* For SYS this is VOS itself*/
1082 pModContext = gpVosContext;
1083 break;
1084 }
1085
1086 default:
1087 {
1088 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,"%s: Module ID %i "
1089 "does not have its context maintained by VOSS", __func__, moduleId);
1090 VOS_ASSERT(0);
1091 return NULL;
1092 }
1093 }
1094
1095 if (pModContext == NULL )
1096 {
1097 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,"%s: Module ID %i "
1098 "context is Null", __func__, moduleId);
1099 }
1100
1101 return pModContext;
1102
1103} /* vos_get_context()*/
1104
1105
1106/**---------------------------------------------------------------------------
1107
1108 \brief vos_get_global_context() - get VOSS global Context
1109
1110 This API allows any user to get the VOS Global Context pointer from a
1111 module context data area.
1112
1113 \param moduleContext - the input module context pointer
1114
1115 \param moduleId - the module ID who's context pointer is input in
1116 moduleContext.
1117
1118 \return - pointer to the VOSS global context
1119
1120 - NULL if the function is unable to retreive the VOSS context.
1121
1122 --------------------------------------------------------------------------*/
1123v_CONTEXT_t vos_get_global_context( VOS_MODULE_ID moduleId,
1124 v_VOID_t *moduleContext )
1125{
1126 if (gpVosContext == NULL)
1127 {
1128 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001129 "%s: global voss context is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001130 }
1131
1132 return gpVosContext;
1133
1134} /* vos_get_global_context() */
1135
1136
1137v_U8_t vos_is_logp_in_progress(VOS_MODULE_ID moduleId, v_VOID_t *moduleContext)
1138{
1139 if (gpVosContext == NULL)
1140 {
1141 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001142 "%s: global voss context is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001143 return 1;
1144 }
1145
1146 return gpVosContext->isLogpInProgress;
1147}
1148
1149void vos_set_logp_in_progress(VOS_MODULE_ID moduleId, v_U8_t value)
1150{
1151 if (gpVosContext == NULL)
1152 {
1153 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001154 "%s: global voss context is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001155 return;
1156 }
1157
1158 gpVosContext->isLogpInProgress = value;
1159}
1160
1161v_U8_t vos_is_load_unload_in_progress(VOS_MODULE_ID moduleId, v_VOID_t *moduleContext)
1162{
1163 if (gpVosContext == NULL)
1164 {
1165 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001166 "%s: global voss context is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001167 return 0;
1168 }
1169
1170 return gpVosContext->isLoadUnloadInProgress;
1171}
1172
1173void vos_set_load_unload_in_progress(VOS_MODULE_ID moduleId, v_U8_t value)
1174{
1175 if (gpVosContext == NULL)
1176 {
1177 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001178 "%s: global voss context is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001179 return;
1180 }
1181
1182 gpVosContext->isLoadUnloadInProgress = value;
1183}
1184
Sameer Thalappil9ab2fe52013-10-22 12:50:24 -07001185v_U8_t vos_is_reinit_in_progress(VOS_MODULE_ID moduleId, v_VOID_t *moduleContext)
1186{
1187 if (gpVosContext == NULL)
1188 {
1189 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
1190 "%s: global voss context is NULL", __func__);
1191 return 1;
1192 }
1193
1194 return gpVosContext->isReInitInProgress;
1195}
1196
1197void vos_set_reinit_in_progress(VOS_MODULE_ID moduleId, v_U8_t value)
1198{
1199 if (gpVosContext == NULL)
1200 {
1201 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
1202 "%s: global voss context is NULL", __func__);
1203 return;
1204 }
1205
1206 gpVosContext->isReInitInProgress = value;
1207}
1208
1209
Jeff Johnson295189b2012-06-20 16:38:30 -07001210/**---------------------------------------------------------------------------
1211
1212 \brief vos_alloc_context() - allocate a context within the VOSS global Context
1213
1214 This API allows any user to allocate a user context area within the
1215 VOS Global Context.
1216
1217 \param pVosContext - pointer to the global Vos context
1218
1219 \param moduleId - the module ID who's context area is being allocated.
1220
1221 \param ppModuleContext - pointer to location where the pointer to the
1222 allocated context is returned. Note this
1223 output pointer is valid only if the API
1224 returns VOS_STATUS_SUCCESS
1225
1226 \param size - the size of the context area to be allocated.
1227
1228 \return - VOS_STATUS_SUCCESS - the context for the module ID has been
1229 allocated successfully. The pointer to the context area
1230 can be found in *ppModuleContext.
1231 \note This function returns VOS_STATUS_SUCCESS if the
1232 module context was already allocated and the size
1233 allocated matches the size on this call.
1234
1235 VOS_STATUS_E_INVAL - the moduleId is not a valid or does
1236 not identify a module that can have a context allocated.
1237
1238 VOS_STATUS_E_EXISTS - vos could allocate the requested context
1239 because a context for this module ID already exists and it is
1240 a *different* size that specified on this call.
1241
1242 VOS_STATUS_E_NOMEM - vos could not allocate memory for the
1243 requested context area.
1244
1245 \sa vos_get_context(), vos_free_context()
1246
1247 --------------------------------------------------------------------------*/
1248VOS_STATUS vos_alloc_context( v_VOID_t *pVosContext, VOS_MODULE_ID moduleID,
1249 v_VOID_t **ppModuleContext, v_SIZE_t size )
1250{
1251 v_VOID_t ** pGpModContext = NULL;
1252
1253 if ( pVosContext == NULL) {
1254 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001255 "%s: vos context is null", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001256 return VOS_STATUS_E_FAILURE;
1257 }
1258
1259 if (( gpVosContext != pVosContext) || ( ppModuleContext == NULL)) {
1260 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001261 "%s: context mismatch or null param passed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001262 return VOS_STATUS_E_FAILURE;
1263 }
1264
1265 switch(moduleID)
1266 {
1267 case VOS_MODULE_ID_TL:
1268 {
1269 pGpModContext = &(gpVosContext->pTLContext);
1270 break;
1271 }
1272
Jeff Johnson295189b2012-06-20 16:38:30 -07001273#ifdef WLAN_BTAMP_FEATURE
1274 case VOS_MODULE_ID_BAP:
1275 {
1276 pGpModContext = &(gpVosContext->pBAPContext);
1277 break;
1278 }
1279#endif //WLAN_BTAMP_FEATURE
1280
Jeff Johnson295189b2012-06-20 16:38:30 -07001281 case VOS_MODULE_ID_SAP:
1282 {
1283 pGpModContext = &(gpVosContext->pSAPContext);
1284 break;
1285 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001286
Jeff Johnson295189b2012-06-20 16:38:30 -07001287 case VOS_MODULE_ID_WDA:
1288 {
1289 pGpModContext = &(gpVosContext->pWDAContext);
1290 break;
1291 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001292 case VOS_MODULE_ID_SME:
Jeff Johnson295189b2012-06-20 16:38:30 -07001293 case VOS_MODULE_ID_PE:
Katya Nigam70d68332013-09-16 16:49:45 +05301294 case VOS_MODULE_ID_PMC:
Jeff Johnson295189b2012-06-20 16:38:30 -07001295 case VOS_MODULE_ID_HDD:
Jeff Johnson295189b2012-06-20 16:38:30 -07001296 case VOS_MODULE_ID_HDD_SOFTAP:
Jeff Johnson295189b2012-06-20 16:38:30 -07001297 default:
1298 {
1299 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: Module ID %i "
1300 "does not have its context allocated by VOSS", __func__, moduleID);
1301 VOS_ASSERT(0);
1302 return VOS_STATUS_E_INVAL;
1303 }
1304 }
1305
1306 if ( NULL != *pGpModContext)
1307 {
1308 /*
1309 ** Context has already been allocated!
1310 ** Prevent double allocation
1311 */
1312 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
1313 "%s: Module ID %i context has already been allocated",
1314 __func__, moduleID);
1315 return VOS_STATUS_E_EXISTS;
1316 }
1317
1318 /*
1319 ** Dynamically allocate the context for module
1320 */
1321
1322 *ppModuleContext = kmalloc(size, GFP_KERNEL);
1323
1324
1325 if ( *ppModuleContext == NULL)
1326 {
1327 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,"%s: Failed to "
1328 "allocate Context for module ID %i", __func__, moduleID);
1329 VOS_ASSERT(0);
1330 return VOS_STATUS_E_NOMEM;
1331 }
1332
1333 if (moduleID==VOS_MODULE_ID_TL)
1334 {
1335 vos_mem_zero(*ppModuleContext, size);
1336 }
1337
1338 *pGpModContext = *ppModuleContext;
1339
1340 return VOS_STATUS_SUCCESS;
1341
1342} /* vos_alloc_context() */
1343
1344
1345/**---------------------------------------------------------------------------
1346
1347 \brief vos_free_context() - free an allocated a context within the
1348 VOSS global Context
1349
1350 This API allows a user to free the user context area within the
1351 VOS Global Context.
1352
1353 \param pVosContext - pointer to the global Vos context
1354
1355 \param moduleId - the module ID who's context area is being free
1356
1357 \param pModuleContext - pointer to module context area to be free'd.
1358
1359 \return - VOS_STATUS_SUCCESS - the context for the module ID has been
1360 free'd. The pointer to the context area is not longer
1361 available.
1362
1363 VOS_STATUS_E_FAULT - pVosContext or pModuleContext are not
1364 valid pointers.
1365
1366 VOS_STATUS_E_INVAL - the moduleId is not a valid or does
1367 not identify a module that can have a context free'd.
1368
1369 VOS_STATUS_E_EXISTS - vos could not free the requested
1370 context area because a context for this module ID does not
1371 exist in the global vos context.
1372
1373 \sa vos_get_context()
1374
1375 --------------------------------------------------------------------------*/
1376VOS_STATUS vos_free_context( v_VOID_t *pVosContext, VOS_MODULE_ID moduleID,
1377 v_VOID_t *pModuleContext )
1378{
1379 v_VOID_t ** pGpModContext = NULL;
1380
1381 if (( pVosContext == NULL) || ( gpVosContext != pVosContext) ||
1382 ( pModuleContext == NULL))
1383 {
1384 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
1385 "%s: Null params or context mismatch", __func__);
1386 return VOS_STATUS_E_FAILURE;
1387 }
1388
1389
1390 switch(moduleID)
1391 {
1392 case VOS_MODULE_ID_TL:
1393 {
1394 pGpModContext = &(gpVosContext->pTLContext);
1395 break;
1396 }
1397
Jeff Johnson295189b2012-06-20 16:38:30 -07001398#ifdef WLAN_BTAMP_FEATURE
1399 case VOS_MODULE_ID_BAP:
1400 {
1401 pGpModContext = &(gpVosContext->pBAPContext);
1402 break;
1403 }
1404#endif //WLAN_BTAMP_FEATURE
1405
Jeff Johnson295189b2012-06-20 16:38:30 -07001406 case VOS_MODULE_ID_SAP:
1407 {
1408 pGpModContext = &(gpVosContext->pSAPContext);
1409 break;
1410 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001411
Jeff Johnson295189b2012-06-20 16:38:30 -07001412 case VOS_MODULE_ID_WDA:
1413 {
1414 pGpModContext = &(gpVosContext->pWDAContext);
1415 break;
1416 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001417 case VOS_MODULE_ID_HDD:
1418 case VOS_MODULE_ID_SME:
Jeff Johnson295189b2012-06-20 16:38:30 -07001419 case VOS_MODULE_ID_PE:
Katya Nigam70d68332013-09-16 16:49:45 +05301420 case VOS_MODULE_ID_PMC:
Jeff Johnson295189b2012-06-20 16:38:30 -07001421 case VOS_MODULE_ID_HDD_SOFTAP:
Jeff Johnson295189b2012-06-20 16:38:30 -07001422 default:
1423 {
1424 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: Module ID %i "
1425 "does not have its context allocated by VOSS", __func__, moduleID);
1426 VOS_ASSERT(0);
1427 return VOS_STATUS_E_INVAL;
1428 }
1429 }
1430
1431 if ( NULL == *pGpModContext)
1432 {
1433 /*
1434 ** Context has not been allocated or freed already!
1435 */
1436 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,"%s: Module ID %i "
1437 "context has not been allocated or freed already", __func__,moduleID);
1438 return VOS_STATUS_E_FAILURE;
1439 }
1440
1441 if (*pGpModContext != pModuleContext)
1442 {
1443 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001444 "%s: pGpModContext != pModuleContext", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001445 return VOS_STATUS_E_FAILURE;
1446 }
1447
1448 if(pModuleContext != NULL)
1449 kfree(pModuleContext);
1450
1451 *pGpModContext = NULL;
1452
1453 return VOS_STATUS_SUCCESS;
1454
1455} /* vos_free_context() */
1456
1457
1458/**---------------------------------------------------------------------------
1459
1460 \brief vos_mq_post_message() - post a message to a message queue
1461
1462 This API allows messages to be posted to a specific message queue. Messages
1463 can be posted to the following message queues:
1464
1465 <ul>
1466 <li> SME
1467 <li> PE
1468 <li> HAL
1469 <li> TL
1470 </ul>
1471
1472 \param msgQueueId - identifies the message queue upon which the message
1473 will be posted.
1474
1475 \param message - a pointer to a message buffer. Memory for this message
1476 buffer is allocated by the caller and free'd by the vOSS after the
1477 message is posted to the message queue. If the consumer of the
1478 message needs anything in this message, it needs to copy the contents
1479 before returning from the message queue handler.
1480
1481 \return VOS_STATUS_SUCCESS - the message has been successfully posted
1482 to the message queue.
1483
1484 VOS_STATUS_E_INVAL - The value specified by msgQueueId does not
1485 refer to a valid Message Queue Id.
1486
1487 VOS_STATUS_E_FAULT - message is an invalid pointer.
1488
1489 VOS_STATUS_E_FAILURE - the message queue handler has reported
1490 an unknown failure.
1491
1492 \sa
1493
1494 --------------------------------------------------------------------------*/
1495VOS_STATUS vos_mq_post_message( VOS_MQ_ID msgQueueId, vos_msg_t *pMsg )
1496{
1497 pVosMqType pTargetMq = NULL;
1498 pVosMsgWrapper pMsgWrapper = NULL;
1499
1500 if ((gpVosContext == NULL) || (pMsg == NULL))
1501 {
1502 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
1503 "%s: Null params or global vos context is null", __func__);
1504 VOS_ASSERT(0);
1505 return VOS_STATUS_E_FAILURE;
1506 }
1507
1508 switch (msgQueueId)
1509 {
1510 /// Message Queue ID for messages bound for SME
1511 case VOS_MQ_ID_SME:
1512 {
1513 pTargetMq = &(gpVosContext->vosSched.smeMcMq);
1514 break;
1515 }
1516
1517 /// Message Queue ID for messages bound for PE
1518 case VOS_MQ_ID_PE:
1519 {
1520 pTargetMq = &(gpVosContext->vosSched.peMcMq);
1521 break;
1522 }
1523
Jeff Johnson295189b2012-06-20 16:38:30 -07001524 /// Message Queue ID for messages bound for WDA
1525 case VOS_MQ_ID_WDA:
1526 {
1527 pTargetMq = &(gpVosContext->vosSched.wdaMcMq);
1528 break;
1529 }
1530
1531 /// Message Queue ID for messages bound for WDI
1532 case VOS_MQ_ID_WDI:
1533 {
1534 pTargetMq = &(gpVosContext->vosSched.wdiMcMq);
1535 break;
1536 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001537
1538 /// Message Queue ID for messages bound for TL
1539 case VOS_MQ_ID_TL:
1540 {
1541 pTargetMq = &(gpVosContext->vosSched.tlMcMq);
1542 break;
1543 }
1544
1545 /// Message Queue ID for messages bound for the SYS module
1546 case VOS_MQ_ID_SYS:
1547 {
1548 pTargetMq = &(gpVosContext->vosSched.sysMcMq);
1549 break;
1550 }
1551
1552 default:
1553
1554 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
1555 ("%s: Trying to queue msg into unknown MC Msg queue ID %d"),
1556 __func__, msgQueueId);
1557
1558 return VOS_STATUS_E_FAILURE;
1559 }
1560
1561 VOS_ASSERT(NULL !=pTargetMq);
1562 if (pTargetMq == NULL)
1563 {
1564 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001565 "%s: pTargetMq == NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001566 return VOS_STATUS_E_FAILURE;
1567 }
1568
1569 /*
1570 ** Try and get a free Msg wrapper
1571 */
1572 pMsgWrapper = vos_mq_get(&gpVosContext->freeVosMq);
1573
1574 if (NULL == pMsgWrapper)
1575 {
1576 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
1577 "%s: VOS Core run out of message wrapper", __func__);
1578
1579 return VOS_STATUS_E_RESOURCES;
1580 }
1581
1582 /*
1583 ** Copy the message now
1584 */
1585 vos_mem_copy( (v_VOID_t*)pMsgWrapper->pVosMsg,
1586 (v_VOID_t*)pMsg, sizeof(vos_msg_t));
1587
1588 vos_mq_put(pTargetMq, pMsgWrapper);
1589
1590 set_bit(MC_POST_EVENT_MASK, &gpVosContext->vosSched.mcEventFlag);
1591 wake_up_interruptible(&gpVosContext->vosSched.mcWaitQueue);
1592
1593 return VOS_STATUS_SUCCESS;
1594
1595} /* vos_mq_post_message()*/
1596
1597
1598/**---------------------------------------------------------------------------
1599
1600 \brief vos_tx_mq_serialize() - serialize a message to the Tx execution flow
1601
1602 This API allows messages to be posted to a specific message queue in the
1603 Tx excution flow. Messages for the Tx execution flow can be posted only
1604 to the following queue.
1605
1606 <ul>
1607 <li> TL
1608 <li> SSC/WDI
1609 </ul>
1610
1611 \param msgQueueId - identifies the message queue upon which the message
1612 will be posted.
1613
1614 \param message - a pointer to a message buffer. Body memory for this message
1615 buffer is allocated by the caller and free'd by the vOSS after the
1616 message is dispacthed to the appropriate component. If the consumer
1617 of the message needs to keep anything in the body, it needs to copy
1618 the contents before returning from the message handler.
1619
1620 \return VOS_STATUS_SUCCESS - the message has been successfully posted
1621 to the message queue.
1622
1623 VOS_STATUS_E_INVAL - The value specified by msgQueueId does not
1624 refer to a valid Message Queue Id.
1625
1626 VOS_STATUS_E_FAULT - message is an invalid pointer.
1627
1628 VOS_STATUS_E_FAILURE - the message queue handler has reported
1629 an unknown failure.
1630
1631 \sa
1632
1633 --------------------------------------------------------------------------*/
1634VOS_STATUS vos_tx_mq_serialize( VOS_MQ_ID msgQueueId, vos_msg_t *pMsg )
1635{
1636 pVosMqType pTargetMq = NULL;
1637 pVosMsgWrapper pMsgWrapper = NULL;
1638
1639 if ((gpVosContext == NULL) || (pMsg == NULL))
1640 {
1641 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
1642 "%s: Null params or global vos context is null", __func__);
1643 VOS_ASSERT(0);
1644 return VOS_STATUS_E_FAILURE;
1645 }
1646
1647 switch (msgQueueId)
1648 {
1649 /// Message Queue ID for messages bound for SME
1650 case VOS_MQ_ID_TL:
1651 {
1652 pTargetMq = &(gpVosContext->vosSched.tlTxMq);
1653 break;
1654 }
1655
Jeff Johnson295189b2012-06-20 16:38:30 -07001656 /// Message Queue ID for messages bound for SSC
1657 case VOS_MQ_ID_WDI:
1658 {
1659 pTargetMq = &(gpVosContext->vosSched.wdiTxMq);
1660 break;
1661 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001662
1663 /// Message Queue ID for messages bound for the SYS module
1664 case VOS_MQ_ID_SYS:
1665 {
1666 pTargetMq = &(gpVosContext->vosSched.sysTxMq);
1667 break;
1668 }
1669
1670 default:
1671
1672 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Gopichand Nakkala66c0bd02013-04-10 11:36:29 +05301673 "%s: Trying to queue msg into unknown Tx Msg queue ID %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001674 __func__, msgQueueId);
1675
1676 return VOS_STATUS_E_FAILURE;
1677 }
1678
1679 if (pTargetMq == NULL)
1680 {
1681 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001682 "%s: pTargetMq == NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001683 return VOS_STATUS_E_FAILURE;
1684 }
1685
1686
1687 /*
1688 ** Try and get a free Msg wrapper
1689 */
1690 pMsgWrapper = vos_mq_get(&gpVosContext->freeVosMq);
1691
1692 if (NULL == pMsgWrapper)
1693 {
1694 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
1695 "%s: VOS Core run out of message wrapper", __func__);
1696
1697 return VOS_STATUS_E_RESOURCES;
1698 }
1699
1700 /*
1701 ** Copy the message now
1702 */
1703 vos_mem_copy( (v_VOID_t*)pMsgWrapper->pVosMsg,
1704 (v_VOID_t*)pMsg, sizeof(vos_msg_t));
1705
1706 vos_mq_put(pTargetMq, pMsgWrapper);
1707
1708 set_bit(TX_POST_EVENT_MASK, &gpVosContext->vosSched.txEventFlag);
1709 wake_up_interruptible(&gpVosContext->vosSched.txWaitQueue);
1710
1711 return VOS_STATUS_SUCCESS;
1712
1713} /* vos_tx_mq_serialize()*/
1714
Jeff Johnson295189b2012-06-20 16:38:30 -07001715/**---------------------------------------------------------------------------
1716
1717 \brief vos_rx_mq_serialize() - serialize a message to the Rx execution flow
1718
1719 This API allows messages to be posted to a specific message queue in the
1720 Tx excution flow. Messages for the Rx execution flow can be posted only
1721 to the following queue.
1722
1723 <ul>
1724 <li> TL
1725 <li> WDI
1726 </ul>
1727
1728 \param msgQueueId - identifies the message queue upon which the message
1729 will be posted.
1730
1731 \param message - a pointer to a message buffer. Body memory for this message
1732 buffer is allocated by the caller and free'd by the vOSS after the
1733 message is dispacthed to the appropriate component. If the consumer
1734 of the message needs to keep anything in the body, it needs to copy
1735 the contents before returning from the message handler.
1736
1737 \return VOS_STATUS_SUCCESS - the message has been successfully posted
1738 to the message queue.
1739
1740 VOS_STATUS_E_INVAL - The value specified by msgQueueId does not
1741 refer to a valid Message Queue Id.
1742
1743 VOS_STATUS_E_FAULT - message is an invalid pointer.
1744
1745 VOS_STATUS_E_FAILURE - the message queue handler has reported
1746 an unknown failure.
1747
1748 \sa
1749
1750 --------------------------------------------------------------------------*/
1751
1752VOS_STATUS vos_rx_mq_serialize( VOS_MQ_ID msgQueueId, vos_msg_t *pMsg )
1753{
1754 pVosMqType pTargetMq = NULL;
1755 pVosMsgWrapper pMsgWrapper = NULL;
1756 if ((gpVosContext == NULL) || (pMsg == NULL))
1757 {
1758 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
1759 "%s: Null params or global vos context is null", __func__);
1760 VOS_ASSERT(0);
1761 return VOS_STATUS_E_FAILURE;
1762 }
1763
1764 switch (msgQueueId)
1765 {
1766
1767 case VOS_MQ_ID_SYS:
1768 {
1769 pTargetMq = &(gpVosContext->vosSched.sysRxMq);
1770 break;
1771 }
1772
1773 /// Message Queue ID for messages bound for WDI
1774 case VOS_MQ_ID_WDI:
1775 {
1776 pTargetMq = &(gpVosContext->vosSched.wdiRxMq);
1777 break;
1778 }
1779
1780 default:
1781
1782 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Gopichand Nakkala66c0bd02013-04-10 11:36:29 +05301783 "%s: Trying to queue msg into unknown Rx Msg queue ID %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001784 __func__, msgQueueId);
1785
1786 return VOS_STATUS_E_FAILURE;
1787 }
1788
1789 if (pTargetMq == NULL)
1790 {
1791 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001792 "%s: pTargetMq == NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001793 return VOS_STATUS_E_FAILURE;
1794 }
1795
1796
1797 /*
1798 ** Try and get a free Msg wrapper
1799 */
1800 pMsgWrapper = vos_mq_get(&gpVosContext->freeVosMq);
1801
1802 if (NULL == pMsgWrapper)
1803 {
1804 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
1805 "%s: VOS Core run out of message wrapper", __func__);
1806
1807 return VOS_STATUS_E_RESOURCES;
1808 }
1809
1810 /*
1811 ** Copy the message now
1812 */
1813 vos_mem_copy( (v_VOID_t*)pMsgWrapper->pVosMsg,
1814 (v_VOID_t*)pMsg, sizeof(vos_msg_t));
1815
1816 vos_mq_put(pTargetMq, pMsgWrapper);
1817
1818 set_bit(RX_POST_EVENT_MASK, &gpVosContext->vosSched.rxEventFlag);
1819 wake_up_interruptible(&gpVosContext->vosSched.rxWaitQueue);
1820
1821 return VOS_STATUS_SUCCESS;
1822
1823} /* vos_rx_mq_serialize()*/
1824
Jeff Johnson295189b2012-06-20 16:38:30 -07001825v_VOID_t
1826vos_sys_probe_thread_cback
1827(
1828 v_VOID_t *pUserData
1829)
1830{
1831 if (gpVosContext != pUserData)
1832 {
1833 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001834 "%s: gpVosContext != pUserData", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001835 return;
1836 }
1837
1838 if (vos_event_set(&gpVosContext->ProbeEvent)!= VOS_STATUS_SUCCESS)
1839 {
1840 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001841 "%s: vos_event_set failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001842 return;
1843 }
1844
1845} /* vos_sys_probe_thread_cback() */
1846
Jeff Johnson295189b2012-06-20 16:38:30 -07001847v_VOID_t vos_WDAComplete_cback
1848(
1849 v_VOID_t *pUserData
1850)
1851{
1852
1853 if (gpVosContext != pUserData)
1854 {
1855 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001856 "%s: gpVosContext != pUserData", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001857 return;
1858 }
1859
1860 if (vos_event_set(&gpVosContext->wdaCompleteEvent)!= VOS_STATUS_SUCCESS)
1861 {
1862 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001863 "%s: vos_event_set failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001864 return;
1865 }
1866
1867} /* vos_WDAComplete_cback() */
Jeff Johnson295189b2012-06-20 16:38:30 -07001868
1869v_VOID_t vos_core_return_msg
1870(
1871 v_PVOID_t pVContext,
1872 pVosMsgWrapper pMsgWrapper
1873)
1874{
1875 pVosContextType pVosContext = (pVosContextType) pVContext;
1876
1877 VOS_ASSERT( gpVosContext == pVosContext);
1878
1879 if (gpVosContext != pVosContext)
1880 {
1881 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001882 "%s: gpVosContext != pVosContext", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001883 return;
1884 }
1885
1886 VOS_ASSERT( NULL !=pMsgWrapper );
1887
1888 if (pMsgWrapper == NULL)
1889 {
1890 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001891 "%s: pMsgWrapper == NULL in function", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001892 return;
1893 }
1894
1895 /*
1896 ** Return the message on the free message queue
1897 */
1898 INIT_LIST_HEAD(&pMsgWrapper->msgNode);
1899 vos_mq_put(&pVosContext->freeVosMq, pMsgWrapper);
1900
1901} /* vos_core_return_msg() */
1902
1903
1904/**
1905 @brief vos_fetch_tl_cfg_parms() - this function will attempt to read the
1906 TL config params from the registry
1907
1908 @param pAdapter : [inout] pointer to TL config block
1909
1910 @return
1911 None
1912
1913*/
1914v_VOID_t
1915vos_fetch_tl_cfg_parms
1916(
1917 WLANTL_ConfigInfoType *pTLConfig,
1918 hdd_config_t * pConfig
1919)
1920{
1921 if (pTLConfig == NULL)
1922 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001923 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s NULL ptr passed in!", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001924 return;
1925 }
1926
1927 pTLConfig->ucAcWeights[0] = pConfig->WfqBkWeight;
1928 pTLConfig->ucAcWeights[1] = pConfig->WfqBeWeight;
1929 pTLConfig->ucAcWeights[2] = pConfig->WfqViWeight;
1930 pTLConfig->ucAcWeights[3] = pConfig->WfqVoWeight;
1931 pTLConfig->uDelayedTriggerFrmInt = pConfig->DelayedTriggerFrmInt;
Jeff Johnson295189b2012-06-20 16:38:30 -07001932 pTLConfig->uMinFramesProcThres = pConfig->MinFramesProcThres;
Jeff Johnson295189b2012-06-20 16:38:30 -07001933
1934}
1935
1936v_BOOL_t vos_is_apps_power_collapse_allowed(void* pHddCtx)
1937{
1938 return hdd_is_apps_power_collapse_allowed((hdd_context_t*) pHddCtx);
1939}
1940
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05301941void vos_abort_mac_scan(v_U8_t sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07001942{
1943 hdd_context_t *pHddCtx = NULL;
1944 v_CONTEXT_t pVosContext = NULL;
1945
1946 /* Get the Global VOSS Context */
1947 pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
1948 if(!pVosContext) {
1949 hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Global VOS context is Null", __func__);
1950 return;
1951 }
1952
1953 /* Get the HDD context */
1954 pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, pVosContext );
1955 if(!pHddCtx) {
1956 hddLog(VOS_TRACE_LEVEL_FATAL, "%s: HDD context is Null", __func__);
1957 return;
1958 }
1959
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05301960 hdd_abort_mac_scan(pHddCtx, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001961 return;
1962}
Jeff Johnson295189b2012-06-20 16:38:30 -07001963/*---------------------------------------------------------------------------
1964
1965 \brief vos_shutdown() - shutdown VOS
1966
1967 - All VOS submodules are closed.
1968
1969 - All the WLAN SW components should have been opened. This includes
1970 SYS, MAC, SME and TL.
1971
1972
1973 \param vosContext: Global vos context
1974
1975
1976 \return VOS_STATUS_SUCCESS - Operation successfull & vos is shutdown
1977
1978 VOS_STATUS_E_FAILURE - Failure to close
1979
1980---------------------------------------------------------------------------*/
1981VOS_STATUS vos_shutdown(v_CONTEXT_t vosContext)
1982{
1983 VOS_STATUS vosStatus;
1984
1985#ifdef WLAN_BTAMP_FEATURE
1986 vosStatus = WLANBAP_Close(vosContext);
1987 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
1988 {
1989 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
1990 "%s: Failed to close BAP", __func__);
1991 VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
1992 }
1993#endif // WLAN_BTAMP_FEATURE
1994
1995 vosStatus = WLANTL_Close(vosContext);
1996 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
1997 {
1998 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
1999 "%s: Failed to close TL", __func__);
2000 VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
2001 }
2002
2003 vosStatus = sme_Close( ((pVosContextType)vosContext)->pMACContext);
2004 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
2005 {
2006 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
2007 "%s: Failed to close SME", __func__);
2008 VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
2009 }
2010
2011 vosStatus = macClose( ((pVosContextType)vosContext)->pMACContext);
2012 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
2013 {
2014 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
2015 "%s: Failed to close MAC", __func__);
2016 VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
2017 }
2018
2019 ((pVosContextType)vosContext)->pMACContext = NULL;
2020
Jeff Johnson295189b2012-06-20 16:38:30 -07002021 vosStatus = sysClose( vosContext );
2022 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
2023 {
2024 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
2025 "%s: Failed to close SYS", __func__);
2026 VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
2027 }
2028
2029 /* Let DXE return packets in WDA_close and then free them here */
2030 vosStatus = vos_packet_close( vosContext );
2031 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
2032 {
2033 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
2034 "%s: Failed to close VOSS Packet", __func__);
2035 VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
2036 }
2037
2038 vos_mq_deinit(&((pVosContextType)vosContext)->freeVosMq);
2039
2040 vosStatus = vos_event_destroy(&gpVosContext->wdaCompleteEvent);
2041 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
2042 {
2043 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
2044 "%s: failed to destroy wdaCompleteEvent", __func__);
2045 VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
2046 }
2047
2048 vosStatus = vos_event_destroy(&gpVosContext->ProbeEvent);
2049 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
2050 {
2051 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
2052 "%s: failed to destroy ProbeEvent", __func__);
2053 VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
2054 }
2055
2056 return VOS_STATUS_SUCCESS;
2057}
2058
2059/*---------------------------------------------------------------------------
2060
2061 \brief vos_wda_shutdown() - VOS interface to wda shutdown
2062
2063 - WDA/WDI shutdown
2064
2065 \param vosContext: Global vos context
2066
2067
2068 \return VOS_STATUS_SUCCESS - Operation successfull
2069
2070 VOS_STATUS_E_FAILURE - Failure to close
2071
2072---------------------------------------------------------------------------*/
2073VOS_STATUS vos_wda_shutdown(v_CONTEXT_t vosContext)
2074{
2075 VOS_STATUS vosStatus;
2076 vosStatus = WDA_shutdown(vosContext, VOS_FALSE);
2077
2078 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
2079 {
2080 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
2081 "%s: failed to shutdown WDA", __func__);
2082 VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
2083 }
2084 return vosStatus;
2085}
2086/**
2087 @brief vos_wlanShutdown() - This API will shutdown WLAN driver
2088
2089 This function is called when Riva subsystem crashes. There are two
2090 methods (or operations) in WLAN driver to handle Riva crash,
2091 1. shutdown: Called when Riva goes down, this will shutdown WLAN
2092 driver without handshaking with Riva.
2093 2. re-init: Next API
2094 @param
2095 NONE
2096 @return
2097 VOS_STATUS_SUCCESS - Operation completed successfully.
2098 VOS_STATUS_E_FAILURE - Operation failed.
2099
2100*/
2101VOS_STATUS vos_wlanShutdown(void)
2102{
2103 VOS_STATUS vstatus;
2104 vstatus = vos_watchdog_wlan_shutdown();
2105 return vstatus;
2106}
2107/**
2108 @brief vos_wlanReInit() - This API will re-init WLAN driver
2109
2110 This function is called when Riva subsystem reboots. There are two
2111 methods (or operations) in WLAN driver to handle Riva crash,
2112 1. shutdown: Previous API
2113 2. re-init: Called when Riva comes back after the crash. This will
2114 re-initialize WLAN driver. In some cases re-open may be
2115 referred instead of re-init.
2116 @param
2117 NONE
2118 @return
2119 VOS_STATUS_SUCCESS - Operation completed successfully.
2120 VOS_STATUS_E_FAILURE - Operation failed.
2121
2122*/
2123VOS_STATUS vos_wlanReInit(void)
2124{
2125 VOS_STATUS vstatus;
2126 vstatus = vos_watchdog_wlan_re_init();
2127 return vstatus;
2128}
Jeff Johnsone7245742012-09-05 17:12:55 -07002129/**
2130 @brief vos_wlanRestart() - This API will reload WLAN driver.
2131
2132 This function is called if driver detects any fatal state which
2133 can be recovered by a WLAN module reload ( Android framwork initiated ).
2134 Note that this API will not initiate any RIVA subsystem restart.
2135
2136 The function wlan_hdd_restart_driver protects against re-entrant calls.
2137
2138 @param
2139 NONE
2140 @return
2141 VOS_STATUS_SUCCESS - Operation completed successfully.
2142 VOS_STATUS_E_FAILURE - Operation failed.
2143 VOS_STATUS_E_EMPTY - No configured interface
2144 VOS_STATUS_E_ALREADY - Request already in progress
2145
2146
2147*/
2148VOS_STATUS vos_wlanRestart(void)
2149{
2150 VOS_STATUS vstatus;
2151 hdd_context_t *pHddCtx = NULL;
2152 v_CONTEXT_t pVosContext = NULL;
2153
2154 /* Check whether driver load unload is in progress */
2155 if(vos_is_load_unload_in_progress( VOS_MODULE_ID_VOSS, NULL))
2156 {
2157 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
2158 "%s: Driver load/unload is in progress, retry later.", __func__);
2159 return VOS_STATUS_E_AGAIN;
2160 }
2161
2162 /* Get the Global VOSS Context */
2163 pVosContext = vos_get_global_context(VOS_MODULE_ID_VOSS, NULL);
2164 if(!pVosContext) {
2165 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
2166 "%s: Global VOS context is Null", __func__);
2167 return VOS_STATUS_E_FAILURE;
2168 }
2169
2170 /* Get the HDD context */
2171 pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, pVosContext );
2172 if(!pHddCtx) {
2173 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
2174 "%s: HDD context is Null", __func__);
2175 return VOS_STATUS_E_FAILURE;
2176 }
2177
2178 /* Reload the driver */
2179 vstatus = wlan_hdd_restart_driver(pHddCtx);
2180 return vstatus;
2181}
Madan Mohan Koyyalamudi62080282013-08-05 12:51:17 +05302182
2183
2184/**
2185 @brief vos_fwDumpReq()
2186
2187 This function is called to issue dump commands to Firmware
2188
2189 @param
2190 cmd - Command No. to execute
2191 arg1 - argument 1 to cmd
2192 arg2 - argument 2 to cmd
2193 arg3 - argument 3 to cmd
2194 arg4 - argument 4 to cmd
2195 @return
2196 NONE
2197*/
2198v_VOID_t vos_fwDumpReq(tANI_U32 cmd, tANI_U32 arg1, tANI_U32 arg2,
2199 tANI_U32 arg3, tANI_U32 arg4)
2200{
2201 VOS_STATUS vStatus = VOS_STATUS_SUCCESS;
2202
2203 /* Reset wda wait event */
2204 vos_event_reset(&gpVosContext->wdaCompleteEvent);
2205
2206 WDA_HALDumpCmdReq(NULL, cmd, arg1, arg2, arg3, arg4, NULL);
2207
2208 /* Need to update time out of complete */
2209 vStatus = vos_wait_single_event(&gpVosContext->wdaCompleteEvent,
2210 VOS_WDA_RESP_TIMEOUT );
2211
2212 if (vStatus != VOS_STATUS_SUCCESS)
2213 {
2214 if (vStatus == VOS_STATUS_E_TIMEOUT)
2215 {
2216 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Arif Hussain02882402013-11-17 21:55:29 -08002217 "%s: Timeout occurred before WDA HAL DUMP complete", __func__);
Madan Mohan Koyyalamudi62080282013-08-05 12:51:17 +05302218 }
2219 else
2220 {
2221 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
2222 "%s: reporting other error", __func__);
2223 }
2224 }
2225
2226 return;
2227
2228}