Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
c_hpothu | 3249078 | 2014-03-14 19:14:34 +0530 | [diff] [blame] | 2 | * Copyright (c) 2014 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. |
Kiet Lam | aa8e15a | 2014-02-11 23:30:06 -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_TYPES_H ) |
| 29 | #define __VOS_TYPES_H |
| 30 | |
| 31 | /**========================================================================= |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 32 | \file vos_Types.h |
Mahesh Kumar Kalikot Veetil | 2aad8d8 | 2013-02-07 12:31:28 -0800 | [diff] [blame] | 33 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 34 | \brief virtual Operating System Servies (vOS) |
Mahesh Kumar Kalikot Veetil | 2aad8d8 | 2013-02-07 12:31:28 -0800 | [diff] [blame] | 35 | |
| 36 | Basic type definitions |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 37 | ========================================================================*/ |
| 38 | |
| 39 | /* $Header$ */ |
| 40 | |
| 41 | /*-------------------------------------------------------------------------- |
| 42 | Include Files |
| 43 | ------------------------------------------------------------------------*/ |
| 44 | #include "i_vos_types.h" |
| 45 | #include <string.h> |
| 46 | |
| 47 | /*-------------------------------------------------------------------------- |
| 48 | Preprocessor definitions and constants |
| 49 | ------------------------------------------------------------------------*/ |
| 50 | // macro to get maximum of two values. |
| 51 | #define VOS_MAX( _x, _y ) ( ( (_x) > (_y) ) ? (_x) : (_y) ) |
| 52 | |
| 53 | // macro to get minimum of two values |
| 54 | #define VOS_MIN( _x, _y ) ( ( (_x) < (_y) ) ? (_x) : (_y) ) |
| 55 | |
| 56 | // macro to get the ceiling of an integer division operation... |
Madan Mohan Koyyalamudi | a53c4dc | 2012-11-13 10:35:42 -0800 | [diff] [blame] | 57 | #define VOS_CEIL_DIV( _a, _b ) (( 0 != (_a) % (_b) ) ? ( (_a) / (_b) + 1 ) : ( (_a) / (_b) )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 58 | |
| 59 | // macro to return the floor of an integer division operation |
| 60 | #define VOS_FLOOR_DIV( _a, _b ) ( ( (_a) - ( (_a) % (_b) ) ) / (_b) ) |
| 61 | |
| 62 | #define VOS_SWAP_U16(_x) \ |
| 63 | ( ( ( (_x) << 8 ) & 0xFF00 ) | ( ( (_x) >> 8 ) & 0x00FF ) ) |
| 64 | |
| 65 | #define VOS_SWAP_U32(_x) \ |
Madan Mohan Koyyalamudi | a53c4dc | 2012-11-13 10:35:42 -0800 | [diff] [blame] | 66 | (( ( ( (_x) << 24 ) & 0xFF000000 ) | ( ( (_x) >> 24 ) & 0x000000FF ) ) | \ |
| 67 | ( ( ( (_x) << 8 ) & 0x00FF0000 ) | ( ( (_x) >> 8 ) & 0x0000FF00 ) )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 68 | |
Abhishek Singh | b3e1e7b | 2015-10-12 16:23:33 +0530 | [diff] [blame^] | 69 | /* Length enough to include full DHCP/EAPOL/Management frame */ |
| 70 | #define MAX_PKT_STAT_DATA_LEN 800 |
| 71 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 72 | // Endian operations for Big Endian and Small Endian modes |
| 73 | #ifdef ANI_LITTLE_BYTE_ENDIAN |
| 74 | |
| 75 | #define vos_cpu_to_be32(_x) VOS_SWAP_U32(_x) |
| 76 | #define vos_be32_to_cpu(_x) VOS_SWAP_U32(_x) |
| 77 | #define vos_cpu_to_be16(_x) VOS_SWAP_U16(_x) |
| 78 | #define vos_be16_to_cpu(_x) VOS_SWAP_U16(_x) |
| 79 | #define vos_cpu_to_le32(_x) (_x) |
| 80 | #define vos_le32_to_cpu(_x) (_x) |
| 81 | #define vos_cpu_to_le16(_x) (_x) |
| 82 | #define vos_le16_to_cpu(_x) (_x) |
| 83 | |
| 84 | #endif |
| 85 | |
| 86 | #ifdef ANI_BIG_BYTE_ENDIAN |
| 87 | |
| 88 | #define vos_cpu_to_be32(_x) (_x) |
| 89 | #define vos_be32_to_cpu(_x) (_x) |
| 90 | #define vos_cpu_to_be16(_x) (_x) |
| 91 | #define vos_be16_to_cpu(_x) (_x) |
| 92 | #define vos_cpu_to_le32(_x) VOS_SWAP_U32(_x) |
| 93 | #define vos_le32_to_cpu(_x) VOS_SWAP_U32(_x) |
| 94 | #define vos_cpu_to_le16(_x) VOS_SWAP_U16(_x) |
| 95 | #define vos_le16_to_cpu(_x) VOS_SWAP_U16(_x) |
| 96 | |
| 97 | #endif |
| 98 | |
Mahesh Kumar Kalikot Veetil | 2aad8d8 | 2013-02-07 12:31:28 -0800 | [diff] [blame] | 99 | |
| 100 | /*-------------------------------------------------------------------------- |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 101 | Type declarations |
| 102 | ------------------------------------------------------------------------*/ |
Mahesh Kumar Kalikot Veetil | 2aad8d8 | 2013-02-07 12:31:28 -0800 | [diff] [blame] | 103 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 104 | /// Module IDs. These are generic IDs that identify the various modules |
| 105 | /// in the software system. |
| 106 | typedef enum |
| 107 | { |
| 108 | VOS_MODULE_ID_BAP = 0, |
| 109 | VOS_MODULE_ID_TL = 1, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 110 | VOS_MODULE_ID_WDI = 2, |
Siddharth Bhal | 7bd1993 | 2015-03-03 16:54:36 +0530 | [diff] [blame] | 111 | VOS_MODULE_ID_SVC = 3, |
| 112 | // 4 is unused for historical purposes |
Vinay Krishna Eranna | d938c42 | 2014-03-10 17:14:21 +0530 | [diff] [blame] | 113 | VOS_MODULE_ID_RSV4 = 4, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 114 | VOS_MODULE_ID_HDD = 5, |
| 115 | VOS_MODULE_ID_SME = 6, |
| 116 | VOS_MODULE_ID_PE = 7, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 117 | VOS_MODULE_ID_WDA = 8, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 118 | VOS_MODULE_ID_SYS = 9, |
| 119 | VOS_MODULE_ID_VOSS = 10, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 120 | VOS_MODULE_ID_SAP = 11, |
| 121 | VOS_MODULE_ID_HDD_SOFTAP = 12, |
Katya Nigam | 70d6833 | 2013-09-16 16:49:45 +0530 | [diff] [blame] | 122 | VOS_MODULE_ID_PMC = 13, |
c_hpothu | 3249078 | 2014-03-14 19:14:34 +0530 | [diff] [blame] | 123 | VOS_MODULE_ID_HDD_DATA = 14, |
c_hpothu | 6d1d2a3 | 2014-03-18 20:17:03 +0530 | [diff] [blame] | 124 | VOS_MODULE_ID_HDD_SAP_DATA = 15, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 125 | |
| 126 | // not a real module ID. This is used to identify the maxiumum |
| 127 | // number of VOS_MODULE_IDs and should always be at the END of |
| 128 | // this enum. If IDs are added, they need to go in front of this |
| 129 | VOS_MODULE_ID_MAX |
| 130 | |
| 131 | } VOS_MODULE_ID; |
| 132 | |
| 133 | |
| 134 | /// Concurrency role. These are generic IDs that identify the various roles |
| 135 | /// in the software system. |
| 136 | typedef enum |
| 137 | { /*ON linux maintain 1-1 corespondence with device_mode_t in hdd*/ |
| 138 | VOS_STA_MODE=0, |
| 139 | VOS_STA_SAP_MODE=1, //to support softAp mode . This is misleading. It means AP MODE only. |
| 140 | //The constant name has historical reason |
| 141 | VOS_P2P_CLIENT_MODE, |
| 142 | VOS_P2P_GO_MODE, |
| 143 | VOS_MONITOR_MODE, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 144 | VOS_FTM_MODE = 5, |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 145 | VOS_IBSS_MODE, |
Kiran Kumar Lokere | 0ad5cd3 | 2013-06-25 11:26:22 -0700 | [diff] [blame] | 146 | VOS_P2P_DEVICE, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 147 | VOS_MAX_NO_OF_MODE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 148 | } tVOS_CON_MODE; |
| 149 | |
| 150 | //This is a bit pattern to be set for each mode |
| 151 | //bit 0 - sta mode |
| 152 | //bit 1 - ap mode |
| 153 | //bit 2 - p2p client mode |
| 154 | //bit 3 - p2p go mode |
| 155 | typedef enum |
| 156 | { |
| 157 | VOS_STA=1, |
| 158 | VOS_SAP=2, |
| 159 | VOS_STA_SAP=3, //to support sta, softAp mode . This means STA+AP mode |
| 160 | VOS_P2P_CLIENT=4, |
| 161 | VOS_P2P_GO=8, |
| 162 | VOS_MAX_CONCURRENCY_PERSONA=4 |
| 163 | } tVOS_CONCURRENCY_MODE; |
| 164 | |
| 165 | #if !defined( NULL ) |
| 166 | #ifdef __cplusplus |
| 167 | #define NULL 0 |
| 168 | #else |
| 169 | #define NULL ((void *)0) |
| 170 | #endif |
| 171 | #endif |
| 172 | |
| 173 | enum |
| 174 | { |
| 175 | VOS_FALSE = 0, |
| 176 | VOS_TRUE = ( !VOS_FALSE ) |
| 177 | }; |
| 178 | |
| 179 | /// pointer to void types |
| 180 | typedef v_VOID_t *v_PVOID_t; |
| 181 | |
| 182 | /// "Size" type... |
| 183 | typedef v_UINT_t v_SIZE_t; |
| 184 | |
| 185 | /// 'Time' type |
| 186 | typedef v_ULONG_t v_TIME_t; |
| 187 | |
| 188 | // typedef for VOSS Context... |
| 189 | typedef v_VOID_t *v_CONTEXT_t; |
| 190 | |
| 191 | |
| 192 | /// MAC address data type and corresponding macros/functions to |
| 193 | /// manipulate MAC addresses... |
| 194 | /// Macro defining the size of a MAC Address... |
| 195 | #define VOS_MAC_ADDR_SIZE ( 6 ) |
| 196 | |
| 197 | typedef struct |
| 198 | { |
| 199 | /// the bytes that make up the macAddress. |
| 200 | v_BYTE_t bytes[ VOS_MAC_ADDR_SIZE ]; |
| 201 | |
| 202 | } v_MACADDR_t; |
| 203 | |
| 204 | |
| 205 | /// This macro is used to initialize a vOSS MacAddress to the |
| 206 | /// broadcast MacAddress. It is used like this... |
| 207 | /// v_MACADDR_t macAddress = VOS_MAC_ADDR_BROADCAST_INITIALIZER; |
| 208 | #define VOS_MAC_ADDR_BROADCAST_INITIALIZER { { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } } |
| 209 | |
| 210 | /// This macro is used to initialize a vOSS MacAddress to zero |
| 211 | /// It is used like this... |
| 212 | /// v_MACADDR_t macAddress = VOS_MAC_ADDR_ZERO_INITIALIZER; |
| 213 | #define VOS_MAC_ADDR_ZERO_INITIALIZER { { 0, 0, 0, 0, 0, 0 } } |
| 214 | |
| 215 | |
| 216 | |
| 217 | /*---------------------------------------------------------------------------- |
| 218 | |
| 219 | \brief vos_is_macaddr_equal() - compare two vOSS MacAddress |
| 220 | |
| 221 | This function returns a boolean that tells if a two vOSS MacAddress' |
| 222 | are equivalent. |
| 223 | |
| 224 | \param pMacAddr1 - pointer to one voss MacAddress to compare |
| 225 | \param pMacAddr2 - pointer to the other voss MacAddress to compare |
| 226 | |
| 227 | \return true - the MacAddress's are equal |
| 228 | not true - the MacAddress's are not equal |
| 229 | |
| 230 | \sa |
| 231 | |
| 232 | --------------------------------------------------------------------------*/ |
| 233 | VOS_INLINE_FN v_BOOL_t vos_is_macaddr_equal( v_MACADDR_t *pMacAddr1, |
| 234 | v_MACADDR_t *pMacAddr2 ) |
| 235 | { |
| 236 | return ( 0 == memcmp( pMacAddr1, pMacAddr2, VOS_MAC_ADDR_SIZE ) ); |
| 237 | } |
| 238 | |
| 239 | |
| 240 | |
| 241 | /*---------------------------------------------------------------------------- |
| 242 | |
| 243 | \brief vos_is_macaddr_zero() - check for a MacAddress of all zeros. |
| 244 | |
| 245 | This function returns a boolean that tells if a MacAddress is made up of |
| 246 | all zeros. |
| 247 | |
| 248 | \param pMacAddr - pointer to the v_MACADDR_t to check. |
| 249 | |
| 250 | \return true - the MacAddress is all Zeros |
| 251 | not true - the MacAddress is not all Zeros. |
| 252 | |
| 253 | \sa |
| 254 | |
| 255 | --------------------------------------------------------------------------*/ |
| 256 | VOS_INLINE_FN v_BOOL_t vos_is_macaddr_zero( v_MACADDR_t *pMacAddr ) |
| 257 | { |
| 258 | v_MACADDR_t zeroMacAddr = VOS_MAC_ADDR_ZERO_INITIALIZER; |
| 259 | |
| 260 | return( vos_is_macaddr_equal( pMacAddr, &zeroMacAddr ) ); |
| 261 | } |
| 262 | |
| 263 | |
| 264 | /*---------------------------------------------------------------------------- |
| 265 | |
| 266 | \brief vos_zero_macaddr() - zero out a MacAddress |
| 267 | |
| 268 | This function zeros out a vOSS MacAddress type. |
| 269 | |
| 270 | \param pMacAddr - pointer to the v_MACADDR_t to zero. |
| 271 | |
| 272 | \return nothing |
| 273 | |
| 274 | \sa |
| 275 | |
| 276 | --------------------------------------------------------------------------*/ |
| 277 | VOS_INLINE_FN v_VOID_t vos_zero_macaddr( v_MACADDR_t *pMacAddr ) |
| 278 | { |
| 279 | memset( pMacAddr, 0, VOS_MAC_ADDR_SIZE ); |
| 280 | } |
| 281 | |
| 282 | |
| 283 | /*---------------------------------------------------------------------------- |
| 284 | |
| 285 | \brief vos_is_macaddr_group() - check for a MacAddress is a 'group' address |
| 286 | |
| 287 | This function returns a boolean that tells if a the input vOSS MacAddress |
| 288 | is a "group" address. Group addresses have the 'group address bit' turned |
| 289 | on in the MacAddress. Group addresses are made up of Broadcast and |
| 290 | Multicast addresses. |
| 291 | |
| 292 | \param pMacAddr1 - pointer to the voss MacAddress to check |
| 293 | |
| 294 | \return true - the input MacAddress is a Group address |
| 295 | not true - the input MacAddress is not a Group address |
| 296 | |
| 297 | \sa |
| 298 | |
| 299 | --------------------------------------------------------------------------*/ |
| 300 | VOS_INLINE_FN v_BOOL_t vos_is_macaddr_group( v_MACADDR_t *pMacAddr ) |
| 301 | { |
| 302 | return( pMacAddr->bytes[ 0 ] & 0x01 ); |
| 303 | } |
| 304 | |
| 305 | |
| 306 | /*---------------------------------------------------------------------------- |
| 307 | |
| 308 | \brief vos_is_macaddr_broadcast() - check for a MacAddress is a broadcast address |
| 309 | |
| 310 | This function returns a boolean that tells if a the input vOSS MacAddress |
| 311 | is a "broadcast" address. |
| 312 | |
| 313 | \param pMacAddr - pointer to the voss MacAddress to check |
| 314 | |
| 315 | \return true - the input MacAddress is a broadcast address |
| 316 | not true - the input MacAddress is not a broadcast address |
| 317 | |
| 318 | \sa |
| 319 | |
| 320 | --------------------------------------------------------------------------*/ |
| 321 | VOS_INLINE_FN v_BOOL_t vos_is_macaddr_broadcast( v_MACADDR_t *pMacAddr ) |
| 322 | { |
| 323 | v_MACADDR_t broadcastMacAddr = VOS_MAC_ADDR_BROADCAST_INITIALIZER; |
| 324 | |
| 325 | return( vos_is_macaddr_equal( pMacAddr, &broadcastMacAddr ) ); |
| 326 | } |
| 327 | |
| 328 | /*---------------------------------------------------------------------------- |
| 329 | |
| 330 | \brief vos_is_macaddr_multicast() - check for a MacAddress is a multicast address |
| 331 | |
| 332 | This function returns a boolean that tells if a the input vOSS MacAddress |
| 333 | is a "Multicast" address. |
| 334 | |
| 335 | \param pMacAddr - pointer to the voss MacAddress to check |
| 336 | |
| 337 | \return true - the input MacAddress is a Multicast address |
| 338 | not true - the input MacAddress is not a Multicast address |
| 339 | |
| 340 | \sa |
| 341 | |
| 342 | --------------------------------------------------------------------------*/ |
| 343 | VOS_INLINE_FN v_BOOL_t vos_is_macaddr_multicast( v_MACADDR_t *pMacAddr ) |
| 344 | { |
| 345 | return( vos_is_macaddr_group( pMacAddr ) && |
| 346 | !vos_is_macaddr_broadcast( pMacAddr ) ); |
| 347 | } |
| 348 | |
| 349 | |
| 350 | |
| 351 | /*---------------------------------------------------------------------------- |
| 352 | |
| 353 | \brief vos_is_macaddr_directed() - check for a MacAddress is a directed address |
| 354 | |
| 355 | This function returns a boolean that tells if a the input vOSS MacAddress |
| 356 | is a "directed" address. |
| 357 | |
| 358 | \param pMacAddr - pointer to the voss MacAddress to check |
| 359 | |
| 360 | \return true - the input MacAddress is a directed address |
| 361 | not true - the input MacAddress is not a directed address |
| 362 | |
| 363 | \sa |
| 364 | |
| 365 | --------------------------------------------------------------------------*/ |
| 366 | VOS_INLINE_FN v_BOOL_t vos_is_macaddr_directed( v_MACADDR_t *pMacAddr ) |
| 367 | { |
| 368 | return( !vos_is_macaddr_group( pMacAddr ) ); |
| 369 | } |
| 370 | |
| 371 | /*---------------------------------------------------------------------------- |
| 372 | |
| 373 | \brief vos_copy_macaddr() - copy a vOSS MacAddress |
| 374 | |
| 375 | This function copies a vOSS MacAddress into another vOSS MacAddress. |
| 376 | |
| 377 | \param pDst - pointer to the voss MacAddress to copy TO (the destination) |
| 378 | \param pSrc - pointer to the voss MacAddress to copy FROM (the source) |
| 379 | |
| 380 | \return nothing |
| 381 | |
| 382 | \sa |
| 383 | |
| 384 | --------------------------------------------------------------------------*/ |
| 385 | VOS_INLINE_FN v_VOID_t vos_copy_macaddr( v_MACADDR_t *pDst, v_MACADDR_t *pSrc ) |
| 386 | { |
| 387 | *pDst = *pSrc; |
| 388 | } |
| 389 | |
| 390 | |
| 391 | /*---------------------------------------------------------------------------- |
| 392 | |
| 393 | \brief vos_set_macaddr_broadcast() - set a vOSS MacAddress to the 'broadcast' |
| 394 | |
| 395 | This function sets a vOSS MacAddress to the 'broadcast' MacAddress. Broadcast |
| 396 | MacAddress contains all 0xFF bytes. |
| 397 | |
| 398 | \param pMacAddr - pointer to the voss MacAddress to set to broadcast |
| 399 | |
| 400 | \return nothing |
| 401 | |
| 402 | \sa |
| 403 | |
| 404 | --------------------------------------------------------------------------*/ |
| 405 | VOS_INLINE_FN v_VOID_t vos_set_macaddr_broadcast( v_MACADDR_t *pMacAddr ) |
| 406 | { |
| 407 | memset( pMacAddr, 0xff, VOS_MAC_ADDR_SIZE ); |
| 408 | } |
| 409 | |
| 410 | /*---------------------------------------------------------------------------- |
| 411 | |
Arun Kumar Khandavalli | 4f8f3f2 | 2014-02-07 17:50:12 +0530 | [diff] [blame] | 412 | \brief vos_atomic_set() - set a variable atomically |
| 413 | |
| 414 | \param pTarget - pointer to the variable to set. |
| 415 | |
| 416 | \param value - the value to set in the variable. |
| 417 | |
| 418 | \return This function returns the value previously in the uintptr_t before |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 419 | the new value is set. |
Arun Kumar Khandavalli | 4f8f3f2 | 2014-02-07 17:50:12 +0530 | [diff] [blame] | 420 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 421 | \sa vos_atomic_increment_U32(), vos_atomic_decrement_U32() |
| 422 | |
| 423 | --------------------------------------------------------------------------*/ |
Arun Kumar Khandavalli | 4f8f3f2 | 2014-02-07 17:50:12 +0530 | [diff] [blame] | 424 | uintptr_t vos_atomic_set( uintptr_t *pTarget, uintptr_t value ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 425 | |
| 426 | |
| 427 | // TODO: the below function is a stub to perform atomic set on a BYTE |
| 428 | // Clearly the function below is not an atomic function |
| 429 | VOS_INLINE_FN v_U8_t vos_atomic_set_U8( v_U8_t *pVariable, v_U8_t value ) |
| 430 | { |
| 431 | if (pVariable == NULL) |
| 432 | { |
| 433 | return 0; |
| 434 | } |
| 435 | *pVariable = value; |
| 436 | return value; |
| 437 | } |
| 438 | |
| 439 | /*---------------------------------------------------------------------------- |
| 440 | |
| 441 | \brief vos_atomic_increment_U32() - Increment a U32 variable atomically |
| 442 | |
| 443 | \param pTarget - pointer to the v_U32_t to increment. |
| 444 | |
| 445 | \return This function returns the value of the variable after the |
| 446 | increment occurs. |
| 447 | |
| 448 | \sa vos_atomic_decrement_U32(), vos_atomic_set_U32() |
| 449 | |
| 450 | --------------------------------------------------------------------------*/ |
| 451 | v_U32_t vos_atomic_increment_U32( v_U32_t *pTarget ); |
| 452 | |
| 453 | |
| 454 | /*---------------------------------------------------------------------------- |
| 455 | |
| 456 | \brief vos_atomic_decrement_U32() - Decrement a U32 variable atomically |
| 457 | |
| 458 | \param pTarget - pointer to the v_U32_t to decrement. |
| 459 | |
| 460 | \return This function returns the value of the variable after the |
| 461 | decrement occurs. |
| 462 | |
| 463 | \sa vos_atomic_increment_U32(), vos_atomic_set_U32() |
| 464 | |
| 465 | --------------------------------------------------------------------------*/ |
| 466 | v_U32_t vos_atomic_decrement_U32( v_U32_t *pTarget ); |
| 467 | |
| 468 | /*---------------------------------------------------------------------------- |
| 469 | |
| 470 | \brief vos_atomic_increment_U32_by_value() - Increment a U32 variable atomically |
| 471 | by a given value |
| 472 | |
| 473 | \param pTarget - pointer to the v_U32_t to decrement. |
| 474 | \param value - the value that needs to be added to target |
| 475 | |
| 476 | \return This function returns the value of the variable after the |
| 477 | decrement occurs. |
| 478 | |
| 479 | \sa vos_atomic_increment_U32(), vos_atomic_set_U32() |
| 480 | |
| 481 | --------------------------------------------------------------------------*/ |
| 482 | v_U32_t vos_atomic_increment_U32_by_value( v_U32_t *pTarget, v_U32_t value ); |
| 483 | |
| 484 | /*---------------------------------------------------------------------------- |
| 485 | |
| 486 | \brief vos_atomic_decrement_U32_by_value() - Decrement a U32 variable atomically |
| 487 | by a given value |
| 488 | |
| 489 | \param pTarget - pointer to the v_U32_t to decrement. |
| 490 | \param value - the value that needs to be substracted from target |
| 491 | |
| 492 | \return This function returns the value of the variable after the |
| 493 | decrement occurs. |
| 494 | |
| 495 | \sa vos_atomic_increment_U32(), vos_atomic_set_U32() |
| 496 | |
| 497 | --------------------------------------------------------------------------*/ |
| 498 | v_U32_t vos_atomic_decrement_U32_by_value( v_U32_t *pTarget, v_U32_t value ); |
| 499 | |
| 500 | |
| 501 | v_U32_t vos_get_skip_ssid_check(void); |
| 502 | |
| 503 | v_U32_t vos_get_skip_11e_check(void); |
| 504 | |
| 505 | |
| 506 | |
| 507 | #endif // if !defined __VOSS_TYPES_H |