blob: 100ac75837a63e46f05fbeae7c616fbaba5a8c67 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Mihir Shetee2ae82a2015-03-16 14:08:49 +05302 * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
Kiet Lam1ed83fc2014-02-19 01:15:45 -08003 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080020 */
Kiet Lam1ed83fc2014-02-19 01:15:45 -080021
22/*
23 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
Jeff Johnson295189b2012-06-20 16:38:30 -070028#if !defined( __VOS_API_H )
29#define __VOS_API_H
30
31/**=========================================================================
32
33 \file vos_Api.h
34
35 \brief virtual Operating System Services (vOSS) API
36
37 Header file that inludes all the vOSS API definitions.
38
Jeff Johnson295189b2012-06-20 16:38:30 -070039
40 ========================================================================*/
41 /*===========================================================================
42
43 EDIT HISTORY FOR FILE
44
45
46 This section contains comments describing changes made to the module.
47 Notice that changes are listed in reverse chronological order.
48
49
50 $Header:$ $DateTime: $ $Author: $
51
52
53 when who what, where, why
54 -------- --- --------------------------------------------------------
55 06/23/08 hba Added vos_preOpen()
56 05/18/08 lac Created module.
57===========================================================================*/
58
59/*--------------------------------------------------------------------------
60 Include Files
61 ------------------------------------------------------------------------*/
62// one stop shopping. This brings in the entire vOSS API.
63#include <vos_types.h>
64#include <vos_status.h>
65#include <vos_memory.h>
66#include <vos_list.h>
67#include <vos_getBin.h>
68#include <vos_trace.h>
69#include <vos_event.h>
70#include <vos_lock.h>
Jeff Johnson295189b2012-06-20 16:38:30 -070071#include <vos_nvitem.h>
Amar Singhal0a402232013-10-11 20:57:16 -070072#include <vos_mq.h>
Jeff Johnson295189b2012-06-20 16:38:30 -070073#include <vos_packet.h>
74#include <vos_threads.h>
75#include <vos_timer.h>
76#include <vos_pack_align.h>
77
Sachin Ahuja715aafc2015-07-21 23:35:10 +053078
79/**
80 * enum log_event_type - Type of event initiating bug report
81 * @WLAN_LOG_TYPE_NON_FATAL: Non fatal event
82 * @WLAN_LOG_TYPE_FATAL: Fatal event
83 *
84 * Enum indicating the type of event that is initiating the bug report
85 */
86enum log_event_type {
87 WLAN_LOG_TYPE_NON_FATAL,
88 WLAN_LOG_TYPE_FATAL,
89};
90
91/**
92 * enum log_event_indicator - Module triggering bug report
93 * @WLAN_LOG_INDICATOR_UNUSED: Unused
94 * @WLAN_LOG_INDICATOR_FRAMEWORK: Framework triggers bug report
95 * @WLAN_LOG_INDICATOR_HOST_DRIVER: Host driver triggers bug report
96 * @WLAN_LOG_INDICATOR_FIRMWARE: FW initiates bug report
97 *
98 * Enum indicating the module that triggered the bug report
99 */
100enum log_event_indicator {
101 WLAN_LOG_INDICATOR_UNUSED,
102 WLAN_LOG_INDICATOR_FRAMEWORK,
103 WLAN_LOG_INDICATOR_HOST_DRIVER,
104 WLAN_LOG_INDICATOR_FIRMWARE,
105 WLAN_LOG_INDICATOR_IOCTL
106};
107
108/**
109 * enum log_event_host_reason_code - Reason code for bug report
110 * @WLAN_LOG_REASON_CODE_UNUSED: Unused
111 * @WLAN_LOG_REASON_COMMAND_UNSUCCESSFUL: Command response status from FW
112 * is error
113 * @WLAN_LOG_REASON_ROAM_FAIL: Driver initiated roam has failed
114 * @WLAN_LOG_REASON_THREAD_STUCK: Monitor Health of host threads and report
115 * fatal event if some thread is stuck
116 * @WLAN_LOG_REASON_DATA_STALL: Unable to send/receive data due to low resource
117 * scenario for a prolonged period
118 * @WLAN_LOG_REASON_SME_COMMAND_STUCK: SME command is stuck in SME active queue
119 * @WLAN_LOG_REASON_ZERO_SCAN_RESULTS: Full scan resulted in zero scan results
120 * @WLAN_LOG_REASON_QUEUE_FULL: Defer queue becomes full for a prolonged period
121 * @WLAN_LOG_REASON_POWER_COLLAPSE_FAIL: Unable to allow apps power collapse
122 * for a prolonged period
123 * @WLAN_LOG_REASON_SSR_FAIL: Unable to gracefully complete SSR
124 * @WLAN_LOG_REASON_DISCONNECT_FAIL: Disconnect from Supplicant is not
125 * successful
126 * @WLAN_LOG_REASON_CLEAN_UP_FAIL: Clean up of TDLS or Pre-Auth Sessions
127 * not successful
128 * @WLAN_LOG_REASON_MALLOC_FAIL: Memory allocation Fails
129 * @WLAN_LOG_REASON_VOS_MSG_UNDER_RUN: VOS Core runs out of message wrapper
130 * @WLAN_LOG_REASON_MSG_POST_FAIL: Unable to post msg
131 *
132 * This enum contains the different reason codes for bug report
133 */
134enum log_event_host_reason_code {
135 WLAN_LOG_REASON_CODE_UNUSED,
136 WLAN_LOG_REASON_COMMAND_UNSUCCESSFUL,
137 WLAN_LOG_REASON_ROAM_FAIL,
138 WLAN_LOG_REASON_THREAD_STUCK,
139 WLAN_LOG_REASON_DATA_STALL,
140 WLAN_LOG_REASON_SME_COMMAND_STUCK,
141 WLAN_LOG_REASON_ZERO_SCAN_RESULTS,
142 WLAN_LOG_REASON_QUEUE_FULL,
143 WLAN_LOG_REASON_POWER_COLLAPSE_FAIL,
144 WLAN_LOG_REASON_SSR_FAIL,
145 WLAN_LOG_REASON_DISCONNECT_FAIL,
146 WLAN_LOG_REASON_CLEAN_UP_FAIL,
147 WLAN_LOG_REASON_MALLOC_FAIL,
148 WLAN_LOG_REASON_VOS_MSG_UNDER_RUN,
149 WLAN_LOG_REASON_MSG_POST_FAIL,
150};
151
Jeff Johnson295189b2012-06-20 16:38:30 -0700152/*-------------------------------------------------------------------------
153 Function declarations and documenation
154 ------------------------------------------------------------------------*/
155
156/**--------------------------------------------------------------------------
157
158 \brief vos_preOpen() - PreOpen the vOSS Module
159
160 The \a vos_preOpen() function allocates the Vos Context, but do not
161 initialize all the members. This overal initialization will happen
162 at vos_Open().
163 The reason why we need vos_preOpen() is to get a minimum context
164 where to store BAL and SAL relative data, which happens before
165 vos_Open() is called.
166
167 \param pVosContext: A pointer to where to store the VOS Context
168
169
170 \return VOS_STATUS_SUCCESS - Scheduler was successfully initialized and
171 is ready to be used.
172
173 VOS_STATUS_E_FAILURE - Failure to initialize the scheduler/
174
175 \sa vos_open()
176
177---------------------------------------------------------------------------*/
178VOS_STATUS vos_preOpen ( v_CONTEXT_t *pVosContext );
179
180VOS_STATUS vos_preClose( v_CONTEXT_t *pVosContext );
181
Jeff Johnson295189b2012-06-20 16:38:30 -0700182
183VOS_STATUS vos_preStart( v_CONTEXT_t vosContext );
184
Jeff Johnson295189b2012-06-20 16:38:30 -0700185
Arun Kumar Khandavalliebb19482014-03-25 13:56:53 +0530186VOS_STATUS vos_open( v_CONTEXT_t *pVosContext, void *devHandle );
Jeff Johnson295189b2012-06-20 16:38:30 -0700187
Katya Nigame7b69a82015-04-28 15:24:06 +0530188VOS_STATUS vos_mon_start( v_CONTEXT_t vosContext );
Jeff Johnson295189b2012-06-20 16:38:30 -0700189
Katya Nigame7b69a82015-04-28 15:24:06 +0530190VOS_STATUS vos_mon_stop( v_CONTEXT_t vosContext );
Jeff Johnson295189b2012-06-20 16:38:30 -0700191
192VOS_STATUS vos_start( v_CONTEXT_t vosContext );
193
194VOS_STATUS vos_stop( v_CONTEXT_t vosContext );
195
196VOS_STATUS vos_close( v_CONTEXT_t vosContext );
197
198/* vos shutdown will not close control transport and will not handshake with Riva */
199VOS_STATUS vos_shutdown( v_CONTEXT_t vosContext );
200
201/* the wda interface to shutdown */
202VOS_STATUS vos_wda_shutdown( v_CONTEXT_t vosContext );
203
204/**---------------------------------------------------------------------------
205
206 \brief vos_get_context() - get context data area
207
208 Each module in the system has a context / data area that is allocated
209 and maanged by voss. This API allows any user to get a pointer to its
210 allocated context data area from the VOSS global context.
211
212 \param vosContext - the VOSS Global Context.
213
214 \param moduleId - the module ID, who's context data are is being retrived.
215
216 \return - pointer to the context data area.
217
218 - NULL if the context data is not allocated for the module ID
219 specified
220
221 --------------------------------------------------------------------------*/
222v_VOID_t *vos_get_context( VOS_MODULE_ID moduleId,
223 v_CONTEXT_t vosContext );
224
225
226/**---------------------------------------------------------------------------
227
228 \brief vos_get_global_context() - get VOSS global Context
229
230 This API allows any user to get the VOS Global Context pointer from a
231 module context data area.
232
233 \param moduleContext - the input module context pointer
234
235 \param moduleId - the module ID who's context pointer is input in
236 moduleContext.
237
238 \return - pointer to the VOSS global context
239
240 - NULL if the function is unable to retreive the VOSS context.
241
242 --------------------------------------------------------------------------*/
243v_CONTEXT_t vos_get_global_context( VOS_MODULE_ID moduleId,
244 v_VOID_t *moduleContext );
245
246v_U8_t vos_is_logp_in_progress(VOS_MODULE_ID moduleId, v_VOID_t *moduleContext);
247void vos_set_logp_in_progress(VOS_MODULE_ID moduleId, v_U8_t value);
Sameer Thalappil9ab2fe52013-10-22 12:50:24 -0700248
Jeff Johnson295189b2012-06-20 16:38:30 -0700249v_U8_t vos_is_load_unload_in_progress(VOS_MODULE_ID moduleId, v_VOID_t *moduleContext);
250void vos_set_load_unload_in_progress(VOS_MODULE_ID moduleId, v_U8_t value);
251
Sameer Thalappil9ab2fe52013-10-22 12:50:24 -0700252v_U8_t vos_is_reinit_in_progress(VOS_MODULE_ID moduleId, v_VOID_t *moduleContext);
253void vos_set_reinit_in_progress(VOS_MODULE_ID moduleId, v_U8_t value);
Mihir Sheteccafc0c2015-04-17 16:13:15 +0530254VOS_STATUS vos_logger_pkt_serialize(vos_pkt_t *pPacket, uint32 pkt_type);
Sachin Ahuja715aafc2015-07-21 23:35:10 +0530255bool vos_is_log_report_in_progress(void);
256void vos_reset_log_report_in_progress(void);
257int vos_set_log_completion(uint32 is_fatal, uint32 indicator, uint32 reason_code);
258void vos_get_log_completion(uint32 *is_fatal, uint32 *indicator, uint32 *reason_code);
259VOS_STATUS vos_fatal_event_logs_req( uint32_t is_fatal, uint32_t indicator,
260 uint32_t reason_code, bool waitRequired);
261VOS_STATUS vos_process_done_indication(v_U8_t type, v_U32_t reason_code);
262void vos_send_fatal_event_done(void);
263
Sameer Thalappil9ab2fe52013-10-22 12:50:24 -0700264
Jeff Johnson295189b2012-06-20 16:38:30 -0700265/**---------------------------------------------------------------------------
266
267 \brief vos_alloc_context() - allocate a context within the VOSS global Context
268
269 This API allows any user to allocate a user context area within the
270 VOS Global Context.
271
272 \param pVosContext - pointer to the global Vos context
273
274 \param moduleId - the module ID who's context area is being allocated.
275
276 \param ppModuleContext - pointer to location where the pointer to the
277 allocated context is returned. Note this
278 output pointer is valid only if the API
279 returns VOS_STATUS_SUCCESS
280
281 \param size - the size of the context area to be allocated.
282
283 \return - VOS_STATUS_SUCCESS - the context for the module ID has been
284 allocated successfully. The pointer to the context area
285 can be found in *ppModuleContext.
286 \note This function returns VOS_STATUS_SUCCESS if the
287 module context was already allocated and the size
288 allocated matches the size on this call.
289
290 VOS_STATUS_E_INVAL - the moduleId is not a valid or does
291 not identify a module that can have a context allocated.
292
293 VOS_STATUS_E_EXISTS - vos could allocate the requested context
294 because a context for this module ID already exists and it is
295 a *different* size that specified on this call.
296
297 VOS_STATUS_E_NOMEM - vos could not allocate memory for the
298 requested context area.
299
300 \sa vos_get_context(), vos_free_context()
301
302 --------------------------------------------------------------------------*/
303VOS_STATUS vos_alloc_context( v_VOID_t *pVosContext, VOS_MODULE_ID moduleID,
304 v_VOID_t **ppModuleContext, v_SIZE_t size );
305
306
307/**---------------------------------------------------------------------------
308
309 \brief vos_free_context() - free an allocated a context within the
310 VOSS global Context
311
312 This API allows a user to free the user context area within the
313 VOS Global Context.
314
315 \param pVosContext - pointer to the global Vos context
316
317 \param moduleId - the module ID who's context area is being free
318
319 \param pModuleContext - pointer to module context area to be free'd.
320
321 \return - VOS_STATUS_SUCCESS - the context for the module ID has been
322 free'd. The pointer to the context area is not longer
323 available.
324
325 VOS_STATUS_E_FAULT - pVosContext or pModuleContext are not
326 valid pointers.
327
328 VOS_STATUS_E_INVAL - the moduleId is not a valid or does
329 not identify a module that can have a context free'd.
330
331 VOS_STATUS_E_EXISTS - vos could not free the requested
332 context area because a context for this module ID does not
333 exist in the global vos context.
334
335 \sa vos_get_context()
336
337 --------------------------------------------------------------------------*/
338VOS_STATUS vos_free_context( v_VOID_t *pVosContext, VOS_MODULE_ID moduleID,
339 v_VOID_t *pModuleContext );
Jeff Johnson295189b2012-06-20 16:38:30 -0700340v_BOOL_t vos_is_apps_power_collapse_allowed(void* pHddCtx);
Jeff Johnson295189b2012-06-20 16:38:30 -0700341
342/**
343 @brief vos_wlanShutdown() - This API will shutdown WLAN driver
344
345 This function is called when Riva subsystem crashes. There are two
346 methods (or operations) in WLAN driver to handle Riva crash,
347 1. shutdown: Called when Riva goes down, this will shutdown WLAN
348 driver without handshaking with Riva.
349 2. re-init: Next API
350
351 @param
352 NONE
353 @return
354 VOS_STATUS_SUCCESS - Operation completed successfully.
355 VOS_STATUS_E_FAILURE - Operation failed.
356
357*/
358VOS_STATUS vos_wlanShutdown(void);
359
360/**
361 @brief vos_wlanReInit() - This API will re-init WLAN driver
362
363 This function is called when Riva subsystem reboots. There are two
364 methods (or operations) in WLAN driver to handle Riva crash,
365 1. shutdown: Previous API
366 2. re-init: Called when Riva comes back after the crash. This will
367 re-initialize WLAN driver. In some cases re-open may be
368 referred instead of re-init.
369 @param
370 NONE
371 @return
372 VOS_STATUS_SUCCESS - Operation completed successfully.
373 VOS_STATUS_E_FAILURE - Operation failed.
374
375*/
376VOS_STATUS vos_wlanReInit(void);
377
Jeff Johnsone7245742012-09-05 17:12:55 -0700378/**
379 @brief vos_wlanRestart() - This API will reload WLAN driver.
380
381 This function is called if driver detects any fatal state which
382 can be recovered by a WLAN module reload ( Android framwork initiated ).
383 Note that this API will not initiate any RIVA subsystem restart.
384
385 @param
386 NONE
387 @return
388 VOS_STATUS_SUCCESS - Operation completed successfully.
389 VOS_STATUS_E_FAILURE - Operation failed.
390
391*/
392VOS_STATUS vos_wlanRestart(void);
393
Madan Mohan Koyyalamudi62080282013-08-05 12:51:17 +0530394/**
395 @brief vos_fwDumpReq()
396
397 This function is called to issue dump commands to Firmware
398
399 @param
Siddharth Bhal68115602015-01-18 20:44:55 +0530400 cmd - Command No. to execute
401 arg1 - argument 1 to cmd
402 arg2 - argument 2 to cmd
403 arg3 - argument 3 to cmd
404 arg4 - argument 4 to cmd
405 async - asynchronous event. Don't wait for completion.
Madan Mohan Koyyalamudi62080282013-08-05 12:51:17 +0530406 @return
407 NONE
408*/
409v_VOID_t vos_fwDumpReq(tANI_U32 cmd, tANI_U32 arg1, tANI_U32 arg2,
Siddharth Bhal68115602015-01-18 20:44:55 +0530410 tANI_U32 arg3, tANI_U32 arg4, tANI_U8 async);
Dino Mycle3f783bc2014-08-08 17:40:22 +0530411
Anand N Sunkad860e5ea2015-03-30 14:41:51 +0530412v_VOID_t vos_flush_work(struct work_struct *work);
413v_VOID_t vos_flush_delayed_work(struct delayed_work *dwork);
414
Anand N Sunkaddc63c792015-06-03 14:33:24 +0530415v_VOID_t vos_init_work(struct work_struct *work , void *callbackptr);
416v_VOID_t vos_init_delayed_work(struct delayed_work *dwork , void *callbackptr);
417
Dino Mycle3f783bc2014-08-08 17:40:22 +0530418v_U64_t vos_get_monotonic_boottime(void);
419
Siddharth Bhala3a5cb42014-09-29 21:13:13 +0530420VOS_STATUS vos_randomize_n_bytes(void *mac_addr, tANI_U32 n);
421
c_hpothu8adb97b2014-12-08 19:38:20 +0530422v_BOOL_t vos_is_wlan_in_badState(VOS_MODULE_ID moduleId,
423 v_VOID_t *moduleContext);
Girish Gowlia33f0372015-01-19 15:39:04 +0530424v_VOID_t vos_set_roam_delay_stats_enabled(v_U8_t value);
425v_U8_t vos_get_roam_delay_stats_enabled(v_VOID_t);
Katya Nigama6fbf662015-03-17 18:35:47 +0530426v_U32_t vos_get_dxeReplenishRXTimerVal(void);
427v_BOOL_t vos_get_dxeSSREnable(void);
Mihir Shetee2ae82a2015-03-16 14:08:49 +0530428
429v_U8_t vos_is_fw_logging_enabled(void);
Mihir Shetebe94ebb2015-05-26 12:07:14 +0530430v_U8_t vos_is_fw_ev_logging_enabled(void);
Mihir Shetee2ae82a2015-03-16 14:08:49 +0530431
Mihir Sheted6274602015-04-28 16:13:21 +0530432v_U8_t vos_is_fw_logging_supported(void);
Sushant Kaushik215778f2015-05-21 14:05:36 +0530433void vos_set_multicast_logging(uint8_t value);
434v_U8_t vos_is_multicast_logging(void);
Sushant Kaushik83392fa2015-05-05 17:44:40 +0530435bool vos_is_wakelock_enabled(void);
Hanumantha Reddy Pothula05b0b552015-06-18 14:26:10 +0530436v_BOOL_t vos_isUnloadInProgress(void);
Abhishek Singh30fd58c2015-07-15 14:19:21 +0530437v_BOOL_t vos_isLoadUnloadInProgress(void);
438
Jeff Johnson295189b2012-06-20 16:38:30 -0700439#endif // if !defined __VOS_NVITEM_H