blob: b451716c835ca497bbc8c754c8592f8be814a6fd [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Jeff Johnson32d95a32012-09-10 13:15:23 -07002 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -07003 *
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
22#if !defined( __VOS_API_H )
23#define __VOS_API_H
24
25/**=========================================================================
26
27 \file vos_Api.h
28
29 \brief virtual Operating System Services (vOSS) API
30
31 Header file that inludes all the vOSS API definitions.
32
33 Copyright 2008 (c) Qualcomm, Incorporated. All Rights Reserved.
34
35 Qualcomm Confidential and Proprietary.
36
37 ========================================================================*/
38 /*===========================================================================
39
40 EDIT HISTORY FOR FILE
41
42
43 This section contains comments describing changes made to the module.
44 Notice that changes are listed in reverse chronological order.
45
46
47 $Header:$ $DateTime: $ $Author: $
48
49
50 when who what, where, why
51 -------- --- --------------------------------------------------------
52 06/23/08 hba Added vos_preOpen()
53 05/18/08 lac Created module.
54===========================================================================*/
55
56/*--------------------------------------------------------------------------
57 Include Files
58 ------------------------------------------------------------------------*/
59// one stop shopping. This brings in the entire vOSS API.
60#include <vos_types.h>
61#include <vos_status.h>
62#include <vos_memory.h>
63#include <vos_list.h>
64#include <vos_getBin.h>
65#include <vos_trace.h>
66#include <vos_event.h>
67#include <vos_lock.h>
68#include <vos_mq.h>
69#include <vos_nvitem.h>
70#include <vos_packet.h>
71#include <vos_threads.h>
72#include <vos_timer.h>
73#include <vos_pack_align.h>
74
75/*-------------------------------------------------------------------------
76 Function declarations and documenation
77 ------------------------------------------------------------------------*/
78
79/**--------------------------------------------------------------------------
80
81 \brief vos_preOpen() - PreOpen the vOSS Module
82
83 The \a vos_preOpen() function allocates the Vos Context, but do not
84 initialize all the members. This overal initialization will happen
85 at vos_Open().
86 The reason why we need vos_preOpen() is to get a minimum context
87 where to store BAL and SAL relative data, which happens before
88 vos_Open() is called.
89
90 \param pVosContext: A pointer to where to store the VOS Context
91
92
93 \return VOS_STATUS_SUCCESS - Scheduler was successfully initialized and
94 is ready to be used.
95
96 VOS_STATUS_E_FAILURE - Failure to initialize the scheduler/
97
98 \sa vos_open()
99
100---------------------------------------------------------------------------*/
101VOS_STATUS vos_preOpen ( v_CONTEXT_t *pVosContext );
102
103VOS_STATUS vos_preClose( v_CONTEXT_t *pVosContext );
104
105#ifdef FEATURE_WLAN_INTEGRATED_SOC
106
107VOS_STATUS vos_preStart( v_CONTEXT_t vosContext );
108
109#endif
110
111VOS_STATUS vos_open( v_CONTEXT_t *pVosContext, v_SIZE_t hddContextSize );
112
113
114
115VOS_STATUS vos_start( v_CONTEXT_t vosContext );
116
117VOS_STATUS vos_stop( v_CONTEXT_t vosContext );
118
119VOS_STATUS vos_close( v_CONTEXT_t vosContext );
120
121/* vos shutdown will not close control transport and will not handshake with Riva */
122VOS_STATUS vos_shutdown( v_CONTEXT_t vosContext );
123
124/* the wda interface to shutdown */
125VOS_STATUS vos_wda_shutdown( v_CONTEXT_t vosContext );
126
127/**---------------------------------------------------------------------------
128
129 \brief vos_get_context() - get context data area
130
131 Each module in the system has a context / data area that is allocated
132 and maanged by voss. This API allows any user to get a pointer to its
133 allocated context data area from the VOSS global context.
134
135 \param vosContext - the VOSS Global Context.
136
137 \param moduleId - the module ID, who's context data are is being retrived.
138
139 \return - pointer to the context data area.
140
141 - NULL if the context data is not allocated for the module ID
142 specified
143
144 --------------------------------------------------------------------------*/
145v_VOID_t *vos_get_context( VOS_MODULE_ID moduleId,
146 v_CONTEXT_t vosContext );
147
148
149/**---------------------------------------------------------------------------
150
151 \brief vos_get_global_context() - get VOSS global Context
152
153 This API allows any user to get the VOS Global Context pointer from a
154 module context data area.
155
156 \param moduleContext - the input module context pointer
157
158 \param moduleId - the module ID who's context pointer is input in
159 moduleContext.
160
161 \return - pointer to the VOSS global context
162
163 - NULL if the function is unable to retreive the VOSS context.
164
165 --------------------------------------------------------------------------*/
166v_CONTEXT_t vos_get_global_context( VOS_MODULE_ID moduleId,
167 v_VOID_t *moduleContext );
168
169v_U8_t vos_is_logp_in_progress(VOS_MODULE_ID moduleId, v_VOID_t *moduleContext);
170void vos_set_logp_in_progress(VOS_MODULE_ID moduleId, v_U8_t value);
171v_U8_t vos_is_load_unload_in_progress(VOS_MODULE_ID moduleId, v_VOID_t *moduleContext);
172void vos_set_load_unload_in_progress(VOS_MODULE_ID moduleId, v_U8_t value);
173
174/**---------------------------------------------------------------------------
175
176 \brief vos_alloc_context() - allocate a context within the VOSS global Context
177
178 This API allows any user to allocate a user context area within the
179 VOS Global Context.
180
181 \param pVosContext - pointer to the global Vos context
182
183 \param moduleId - the module ID who's context area is being allocated.
184
185 \param ppModuleContext - pointer to location where the pointer to the
186 allocated context is returned. Note this
187 output pointer is valid only if the API
188 returns VOS_STATUS_SUCCESS
189
190 \param size - the size of the context area to be allocated.
191
192 \return - VOS_STATUS_SUCCESS - the context for the module ID has been
193 allocated successfully. The pointer to the context area
194 can be found in *ppModuleContext.
195 \note This function returns VOS_STATUS_SUCCESS if the
196 module context was already allocated and the size
197 allocated matches the size on this call.
198
199 VOS_STATUS_E_INVAL - the moduleId is not a valid or does
200 not identify a module that can have a context allocated.
201
202 VOS_STATUS_E_EXISTS - vos could allocate the requested context
203 because a context for this module ID already exists and it is
204 a *different* size that specified on this call.
205
206 VOS_STATUS_E_NOMEM - vos could not allocate memory for the
207 requested context area.
208
209 \sa vos_get_context(), vos_free_context()
210
211 --------------------------------------------------------------------------*/
212VOS_STATUS vos_alloc_context( v_VOID_t *pVosContext, VOS_MODULE_ID moduleID,
213 v_VOID_t **ppModuleContext, v_SIZE_t size );
214
215
216/**---------------------------------------------------------------------------
217
218 \brief vos_free_context() - free an allocated a context within the
219 VOSS global Context
220
221 This API allows a user to free the user context area within the
222 VOS Global Context.
223
224 \param pVosContext - pointer to the global Vos context
225
226 \param moduleId - the module ID who's context area is being free
227
228 \param pModuleContext - pointer to module context area to be free'd.
229
230 \return - VOS_STATUS_SUCCESS - the context for the module ID has been
231 free'd. The pointer to the context area is not longer
232 available.
233
234 VOS_STATUS_E_FAULT - pVosContext or pModuleContext are not
235 valid pointers.
236
237 VOS_STATUS_E_INVAL - the moduleId is not a valid or does
238 not identify a module that can have a context free'd.
239
240 VOS_STATUS_E_EXISTS - vos could not free the requested
241 context area because a context for this module ID does not
242 exist in the global vos context.
243
244 \sa vos_get_context()
245
246 --------------------------------------------------------------------------*/
247VOS_STATUS vos_free_context( v_VOID_t *pVosContext, VOS_MODULE_ID moduleID,
248 v_VOID_t *pModuleContext );
249
250v_BOOL_t vos_is_apps_power_collapse_allowed(void* pHddCtx);
251void vos_abort_mac_scan(void);
252
253/**
254 @brief vos_wlanShutdown() - This API will shutdown WLAN driver
255
256 This function is called when Riva subsystem crashes. There are two
257 methods (or operations) in WLAN driver to handle Riva crash,
258 1. shutdown: Called when Riva goes down, this will shutdown WLAN
259 driver without handshaking with Riva.
260 2. re-init: Next API
261
262 @param
263 NONE
264 @return
265 VOS_STATUS_SUCCESS - Operation completed successfully.
266 VOS_STATUS_E_FAILURE - Operation failed.
267
268*/
269VOS_STATUS vos_wlanShutdown(void);
270
271/**
272 @brief vos_wlanReInit() - This API will re-init WLAN driver
273
274 This function is called when Riva subsystem reboots. There are two
275 methods (or operations) in WLAN driver to handle Riva crash,
276 1. shutdown: Previous API
277 2. re-init: Called when Riva comes back after the crash. This will
278 re-initialize WLAN driver. In some cases re-open may be
279 referred instead of re-init.
280 @param
281 NONE
282 @return
283 VOS_STATUS_SUCCESS - Operation completed successfully.
284 VOS_STATUS_E_FAILURE - Operation failed.
285
286*/
287VOS_STATUS vos_wlanReInit(void);
288
Jeff Johnsone7245742012-09-05 17:12:55 -0700289/**
290 @brief vos_wlanRestart() - This API will reload WLAN driver.
291
292 This function is called if driver detects any fatal state which
293 can be recovered by a WLAN module reload ( Android framwork initiated ).
294 Note that this API will not initiate any RIVA subsystem restart.
295
296 @param
297 NONE
298 @return
299 VOS_STATUS_SUCCESS - Operation completed successfully.
300 VOS_STATUS_E_FAILURE - Operation failed.
301
302*/
303VOS_STATUS vos_wlanRestart(void);
304
Jeff Johnson295189b2012-06-20 16:38:30 -0700305#endif // if !defined __VOS_NVITEM_H