Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Mihir Shete | e2ae82a | 2015-03-16 14:08:49 +0530 | [diff] [blame^] | 2 | * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved. |
Kiet Lam | 1ed83fc | 2014-02-19 01:15:45 -0800 | [diff] [blame] | 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
Gopichand Nakkala | 92f07d8 | 2013-01-08 21:16:34 -0800 | [diff] [blame] | 20 | */ |
Kiet Lam | 1ed83fc | 2014-02-19 01:15:45 -0800 | [diff] [blame] | 21 | |
| 22 | /* |
| 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
| 26 | */ |
| 27 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 28 | #if !defined( __VOS_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 Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 39 | |
| 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 Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 71 | #include <vos_nvitem.h> |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 72 | #include <vos_mq.h> |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 73 | #include <vos_packet.h> |
| 74 | #include <vos_threads.h> |
| 75 | #include <vos_timer.h> |
| 76 | #include <vos_pack_align.h> |
| 77 | |
| 78 | /*------------------------------------------------------------------------- |
| 79 | Function declarations and documenation |
| 80 | ------------------------------------------------------------------------*/ |
| 81 | |
| 82 | /**-------------------------------------------------------------------------- |
| 83 | |
| 84 | \brief vos_preOpen() - PreOpen the vOSS Module |
| 85 | |
| 86 | The \a vos_preOpen() function allocates the Vos Context, but do not |
| 87 | initialize all the members. This overal initialization will happen |
| 88 | at vos_Open(). |
| 89 | The reason why we need vos_preOpen() is to get a minimum context |
| 90 | where to store BAL and SAL relative data, which happens before |
| 91 | vos_Open() is called. |
| 92 | |
| 93 | \param pVosContext: A pointer to where to store the VOS Context |
| 94 | |
| 95 | |
| 96 | \return VOS_STATUS_SUCCESS - Scheduler was successfully initialized and |
| 97 | is ready to be used. |
| 98 | |
| 99 | VOS_STATUS_E_FAILURE - Failure to initialize the scheduler/ |
| 100 | |
| 101 | \sa vos_open() |
| 102 | |
| 103 | ---------------------------------------------------------------------------*/ |
| 104 | VOS_STATUS vos_preOpen ( v_CONTEXT_t *pVosContext ); |
| 105 | |
| 106 | VOS_STATUS vos_preClose( v_CONTEXT_t *pVosContext ); |
| 107 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 108 | |
| 109 | VOS_STATUS vos_preStart( v_CONTEXT_t vosContext ); |
| 110 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 111 | |
Arun Kumar Khandavalli | ebb1948 | 2014-03-25 13:56:53 +0530 | [diff] [blame] | 112 | VOS_STATUS vos_open( v_CONTEXT_t *pVosContext, void *devHandle ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 113 | |
| 114 | |
| 115 | |
| 116 | VOS_STATUS vos_start( v_CONTEXT_t vosContext ); |
| 117 | |
| 118 | VOS_STATUS vos_stop( v_CONTEXT_t vosContext ); |
| 119 | |
| 120 | VOS_STATUS vos_close( v_CONTEXT_t vosContext ); |
| 121 | |
| 122 | /* vos shutdown will not close control transport and will not handshake with Riva */ |
| 123 | VOS_STATUS vos_shutdown( v_CONTEXT_t vosContext ); |
| 124 | |
| 125 | /* the wda interface to shutdown */ |
| 126 | VOS_STATUS vos_wda_shutdown( v_CONTEXT_t vosContext ); |
| 127 | |
| 128 | /**--------------------------------------------------------------------------- |
| 129 | |
| 130 | \brief vos_get_context() - get context data area |
| 131 | |
| 132 | Each module in the system has a context / data area that is allocated |
| 133 | and maanged by voss. This API allows any user to get a pointer to its |
| 134 | allocated context data area from the VOSS global context. |
| 135 | |
| 136 | \param vosContext - the VOSS Global Context. |
| 137 | |
| 138 | \param moduleId - the module ID, who's context data are is being retrived. |
| 139 | |
| 140 | \return - pointer to the context data area. |
| 141 | |
| 142 | - NULL if the context data is not allocated for the module ID |
| 143 | specified |
| 144 | |
| 145 | --------------------------------------------------------------------------*/ |
| 146 | v_VOID_t *vos_get_context( VOS_MODULE_ID moduleId, |
| 147 | v_CONTEXT_t vosContext ); |
| 148 | |
| 149 | |
| 150 | /**--------------------------------------------------------------------------- |
| 151 | |
| 152 | \brief vos_get_global_context() - get VOSS global Context |
| 153 | |
| 154 | This API allows any user to get the VOS Global Context pointer from a |
| 155 | module context data area. |
| 156 | |
| 157 | \param moduleContext - the input module context pointer |
| 158 | |
| 159 | \param moduleId - the module ID who's context pointer is input in |
| 160 | moduleContext. |
| 161 | |
| 162 | \return - pointer to the VOSS global context |
| 163 | |
| 164 | - NULL if the function is unable to retreive the VOSS context. |
| 165 | |
| 166 | --------------------------------------------------------------------------*/ |
| 167 | v_CONTEXT_t vos_get_global_context( VOS_MODULE_ID moduleId, |
| 168 | v_VOID_t *moduleContext ); |
| 169 | |
| 170 | v_U8_t vos_is_logp_in_progress(VOS_MODULE_ID moduleId, v_VOID_t *moduleContext); |
| 171 | void vos_set_logp_in_progress(VOS_MODULE_ID moduleId, v_U8_t value); |
Sameer Thalappil | 9ab2fe5 | 2013-10-22 12:50:24 -0700 | [diff] [blame] | 172 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 173 | v_U8_t vos_is_load_unload_in_progress(VOS_MODULE_ID moduleId, v_VOID_t *moduleContext); |
| 174 | void vos_set_load_unload_in_progress(VOS_MODULE_ID moduleId, v_U8_t value); |
| 175 | |
Sameer Thalappil | 9ab2fe5 | 2013-10-22 12:50:24 -0700 | [diff] [blame] | 176 | v_U8_t vos_is_reinit_in_progress(VOS_MODULE_ID moduleId, v_VOID_t *moduleContext); |
| 177 | void vos_set_reinit_in_progress(VOS_MODULE_ID moduleId, v_U8_t value); |
Siddharth Bhal | 7bd1993 | 2015-03-03 16:54:36 +0530 | [diff] [blame] | 178 | VOS_STATUS vos_logger_pkt_serialize(vos_pkt_t *pPacket, uint8 pkt_type); |
Sameer Thalappil | 9ab2fe5 | 2013-10-22 12:50:24 -0700 | [diff] [blame] | 179 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 180 | /**--------------------------------------------------------------------------- |
| 181 | |
| 182 | \brief vos_alloc_context() - allocate a context within the VOSS global Context |
| 183 | |
| 184 | This API allows any user to allocate a user context area within the |
| 185 | VOS Global Context. |
| 186 | |
| 187 | \param pVosContext - pointer to the global Vos context |
| 188 | |
| 189 | \param moduleId - the module ID who's context area is being allocated. |
| 190 | |
| 191 | \param ppModuleContext - pointer to location where the pointer to the |
| 192 | allocated context is returned. Note this |
| 193 | output pointer is valid only if the API |
| 194 | returns VOS_STATUS_SUCCESS |
| 195 | |
| 196 | \param size - the size of the context area to be allocated. |
| 197 | |
| 198 | \return - VOS_STATUS_SUCCESS - the context for the module ID has been |
| 199 | allocated successfully. The pointer to the context area |
| 200 | can be found in *ppModuleContext. |
| 201 | \note This function returns VOS_STATUS_SUCCESS if the |
| 202 | module context was already allocated and the size |
| 203 | allocated matches the size on this call. |
| 204 | |
| 205 | VOS_STATUS_E_INVAL - the moduleId is not a valid or does |
| 206 | not identify a module that can have a context allocated. |
| 207 | |
| 208 | VOS_STATUS_E_EXISTS - vos could allocate the requested context |
| 209 | because a context for this module ID already exists and it is |
| 210 | a *different* size that specified on this call. |
| 211 | |
| 212 | VOS_STATUS_E_NOMEM - vos could not allocate memory for the |
| 213 | requested context area. |
| 214 | |
| 215 | \sa vos_get_context(), vos_free_context() |
| 216 | |
| 217 | --------------------------------------------------------------------------*/ |
| 218 | VOS_STATUS vos_alloc_context( v_VOID_t *pVosContext, VOS_MODULE_ID moduleID, |
| 219 | v_VOID_t **ppModuleContext, v_SIZE_t size ); |
| 220 | |
| 221 | |
| 222 | /**--------------------------------------------------------------------------- |
| 223 | |
| 224 | \brief vos_free_context() - free an allocated a context within the |
| 225 | VOSS global Context |
| 226 | |
| 227 | This API allows a user to free the user context area within the |
| 228 | VOS Global Context. |
| 229 | |
| 230 | \param pVosContext - pointer to the global Vos context |
| 231 | |
| 232 | \param moduleId - the module ID who's context area is being free |
| 233 | |
| 234 | \param pModuleContext - pointer to module context area to be free'd. |
| 235 | |
| 236 | \return - VOS_STATUS_SUCCESS - the context for the module ID has been |
| 237 | free'd. The pointer to the context area is not longer |
| 238 | available. |
| 239 | |
| 240 | VOS_STATUS_E_FAULT - pVosContext or pModuleContext are not |
| 241 | valid pointers. |
| 242 | |
| 243 | VOS_STATUS_E_INVAL - the moduleId is not a valid or does |
| 244 | not identify a module that can have a context free'd. |
| 245 | |
| 246 | VOS_STATUS_E_EXISTS - vos could not free the requested |
| 247 | context area because a context for this module ID does not |
| 248 | exist in the global vos context. |
| 249 | |
| 250 | \sa vos_get_context() |
| 251 | |
| 252 | --------------------------------------------------------------------------*/ |
| 253 | VOS_STATUS vos_free_context( v_VOID_t *pVosContext, VOS_MODULE_ID moduleID, |
| 254 | v_VOID_t *pModuleContext ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 255 | v_BOOL_t vos_is_apps_power_collapse_allowed(void* pHddCtx); |
Madan Mohan Koyyalamudi | ff3a715 | 2013-06-13 14:47:55 +0530 | [diff] [blame] | 256 | void vos_abort_mac_scan(tANI_U8 sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 257 | |
| 258 | /** |
| 259 | @brief vos_wlanShutdown() - This API will shutdown WLAN driver |
| 260 | |
| 261 | This function is called when Riva subsystem crashes. There are two |
| 262 | methods (or operations) in WLAN driver to handle Riva crash, |
| 263 | 1. shutdown: Called when Riva goes down, this will shutdown WLAN |
| 264 | driver without handshaking with Riva. |
| 265 | 2. re-init: Next API |
| 266 | |
| 267 | @param |
| 268 | NONE |
| 269 | @return |
| 270 | VOS_STATUS_SUCCESS - Operation completed successfully. |
| 271 | VOS_STATUS_E_FAILURE - Operation failed. |
| 272 | |
| 273 | */ |
| 274 | VOS_STATUS vos_wlanShutdown(void); |
| 275 | |
| 276 | /** |
| 277 | @brief vos_wlanReInit() - This API will re-init WLAN driver |
| 278 | |
| 279 | This function is called when Riva subsystem reboots. There are two |
| 280 | methods (or operations) in WLAN driver to handle Riva crash, |
| 281 | 1. shutdown: Previous API |
| 282 | 2. re-init: Called when Riva comes back after the crash. This will |
| 283 | re-initialize WLAN driver. In some cases re-open may be |
| 284 | referred instead of re-init. |
| 285 | @param |
| 286 | NONE |
| 287 | @return |
| 288 | VOS_STATUS_SUCCESS - Operation completed successfully. |
| 289 | VOS_STATUS_E_FAILURE - Operation failed. |
| 290 | |
| 291 | */ |
| 292 | VOS_STATUS vos_wlanReInit(void); |
| 293 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 294 | /** |
| 295 | @brief vos_wlanRestart() - This API will reload WLAN driver. |
| 296 | |
| 297 | This function is called if driver detects any fatal state which |
| 298 | can be recovered by a WLAN module reload ( Android framwork initiated ). |
| 299 | Note that this API will not initiate any RIVA subsystem restart. |
| 300 | |
| 301 | @param |
| 302 | NONE |
| 303 | @return |
| 304 | VOS_STATUS_SUCCESS - Operation completed successfully. |
| 305 | VOS_STATUS_E_FAILURE - Operation failed. |
| 306 | |
| 307 | */ |
| 308 | VOS_STATUS vos_wlanRestart(void); |
| 309 | |
Madan Mohan Koyyalamudi | 6208028 | 2013-08-05 12:51:17 +0530 | [diff] [blame] | 310 | /** |
| 311 | @brief vos_fwDumpReq() |
| 312 | |
| 313 | This function is called to issue dump commands to Firmware |
| 314 | |
| 315 | @param |
Siddharth Bhal | 6811560 | 2015-01-18 20:44:55 +0530 | [diff] [blame] | 316 | cmd - Command No. to execute |
| 317 | arg1 - argument 1 to cmd |
| 318 | arg2 - argument 2 to cmd |
| 319 | arg3 - argument 3 to cmd |
| 320 | arg4 - argument 4 to cmd |
| 321 | async - asynchronous event. Don't wait for completion. |
Madan Mohan Koyyalamudi | 6208028 | 2013-08-05 12:51:17 +0530 | [diff] [blame] | 322 | @return |
| 323 | NONE |
| 324 | */ |
| 325 | v_VOID_t vos_fwDumpReq(tANI_U32 cmd, tANI_U32 arg1, tANI_U32 arg2, |
Siddharth Bhal | 6811560 | 2015-01-18 20:44:55 +0530 | [diff] [blame] | 326 | tANI_U32 arg3, tANI_U32 arg4, tANI_U8 async); |
Dino Mycle | 3f783bc | 2014-08-08 17:40:22 +0530 | [diff] [blame] | 327 | |
| 328 | v_U64_t vos_get_monotonic_boottime(void); |
| 329 | |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 330 | VOS_STATUS vos_randomize_n_bytes(void *mac_addr, tANI_U32 n); |
| 331 | |
c_hpothu | 8adb97b | 2014-12-08 19:38:20 +0530 | [diff] [blame] | 332 | v_BOOL_t vos_is_wlan_in_badState(VOS_MODULE_ID moduleId, |
| 333 | v_VOID_t *moduleContext); |
Girish Gowli | a33f037 | 2015-01-19 15:39:04 +0530 | [diff] [blame] | 334 | v_VOID_t vos_set_roam_delay_stats_enabled(v_U8_t value); |
| 335 | v_U8_t vos_get_roam_delay_stats_enabled(v_VOID_t); |
Katya Nigam | a6fbf66 | 2015-03-17 18:35:47 +0530 | [diff] [blame] | 336 | v_U32_t vos_get_dxeReplenishRXTimerVal(void); |
| 337 | v_BOOL_t vos_get_dxeSSREnable(void); |
Mihir Shete | e2ae82a | 2015-03-16 14:08:49 +0530 | [diff] [blame^] | 338 | |
| 339 | v_U8_t vos_is_fw_logging_enabled(void); |
| 340 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 341 | #endif // if !defined __VOS_NVITEM_H |