Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2012, Code Aurora Forum. 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 | |
| 22 | #if !defined( __VOS_NVITEM_H ) |
| 23 | #define __VOS_NVITEM_H |
| 24 | |
| 25 | /**========================================================================= |
| 26 | |
| 27 | \file vos_nvitem.h |
| 28 | |
| 29 | \brief virtual Operating System Services (vOSS): Non-Volatile storage API |
| 30 | |
| 31 | Copyright 2008 (c) Qualcomm, Incorporated. All Rights Reserved. |
| 32 | |
| 33 | Qualcomm Confidential and Proprietary. |
| 34 | |
| 35 | ========================================================================*/ |
| 36 | |
| 37 | /* $Header$ */ |
| 38 | |
| 39 | /*-------------------------------------------------------------------------- |
| 40 | Include Files |
| 41 | ------------------------------------------------------------------------*/ |
| 42 | #include "vos_types.h" |
| 43 | #include "vos_status.h" |
| 44 | #include "wlan_nv.h" |
| 45 | |
| 46 | /*-------------------------------------------------------------------------- |
| 47 | Preprocessor definitions and constants |
| 48 | ------------------------------------------------------------------------*/ |
| 49 | // NV Items with their parameters are specified below |
| 50 | // Parameters include: enum label in VNV_TYPE (_name), |
| 51 | // element count (_cnt), element size (_size), |
| 52 | // enum of first element in NV module (_label) |
| 53 | |
| 54 | /* |
| 55 | * The VOS NV Item Table is compliant to AMSS NV service files of: |
| 56 | * //source/qcom/qct/wconnect/wlan/private/csw/nv/ @ CL 431102 |
| 57 | * |
| 58 | * VNV_REGULATORY_DOMAIN_TABLE - contains regulatory domain information; |
| 59 | * the table is stored as $(REGDOMAIN_COUNT) NV items where each NV item |
| 60 | * contains information for one domain; see definition of v_REGDOMAIN_t |
| 61 | * for the regulatory domains |
| 62 | * |
| 63 | * VNV_FIELD_IMAGE - contains various elements such as MAC addresses |
| 64 | * |
| 65 | * VNV_RATE_TO_POWER_TABLE - table of power for each of 25 PHY rates |
| 66 | * |
| 67 | * VNV_DEFAULT_LOCATION - default country code and regulatory domain |
| 68 | * |
| 69 | * VNV_MAXIMUM_TX_POWER |
| 70 | * |
| 71 | * VNV_RX_SENSITIVITY - table of sensitivity for each of %(MAC_RATE_COUNT) MAC |
| 72 | * rates; see definition of v_MAC_RATE_t for the MAC rates |
| 73 | * |
| 74 | * VNV_NETWORK_TYPE - either A, B or G type |
| 75 | * |
| 76 | * VOV_QFUSE - 16 byte QFUSE data |
| 77 | */ |
| 78 | #define VNV_ITEM_TABLE \ |
| 79 | ADD_VNV_ITEM( VNV_REGULARTORY_DOMAIN_TABLE, REGDOMAIN_COUNT, 144, \ |
| 80 | NV_WLAN_REGULATORY_DOMAIN_FCC_I ) \ |
| 81 | ADD_VNV_ITEM( VNV_FIELD_IMAGE, 1, 52, NV_WLAN_FIELD_IMAGE_I ) \ |
| 82 | ADD_VNV_ITEM( VNV_RATE_TO_POWER_TABLE, 2, 66, NV_WLAN_RATE_TO_POWER_LIST_I )\ |
| 83 | ADD_VNV_ITEM( VNV_DEFAULT_LOCATION, 1, 4, NV_WLAN_DEFAULT_LOCATION_INFO_I ) \ |
| 84 | ADD_VNV_ITEM( VNV_TPC_POWER_TABLE, 14, 128, NV_WLAN_TPC_POWER_TABLE_I ) \ |
| 85 | ADD_VNV_ITEM( VNV_TPC_PDADC_OFFSETS, 14, 2, NV_WLAN_TPC_PDADC_OFFSETS_I ) \ |
| 86 | ADD_VNV_ITEM( VNV_MAXIMUM_TX_POWER, 1, 1, NV_WLAN_MAX_TX_POWER_I ) \ |
| 87 | ADD_VNV_ITEM( VNV_RX_SENSITIVITY, 1, MAC_RATE_COUNT, NV_WLAN_RX_SENSITIVITY_I)\ |
| 88 | ADD_VNV_ITEM( VNV_NETWORK_TYPE, 1, 1, NV_WLAN_NETWORK_TYPE_I ) \ |
| 89 | ADD_VNV_ITEM( VNV_CAL_MEMORY, 1, 3460, NV_WLAN_CAL_MEMORY_I ) \ |
| 90 | ADD_VNV_ITEM( VNV_CAL_STATUS, 1, 32, NV_WLAN_CAL_STATUS_I ) \ |
| 91 | ADD_VNV_ITEM( VNV_RSSI_CHANNEL_OFFSETS, 2, 56, NV_WLAN_RSSI_CHANNEL_OFFSETS_I ) \ |
| 92 | ADD_VNV_ITEM( VNV_RF_CAL_VALUES, 1, 48, NV_WLAN_RF_CAL_VALUES_I ) \ |
| 93 | ADD_VNV_ITEM( VNV_ANTENNA_PATH_LOSS, 14, 2, NV_WLAN_ANTENNA_PATH_LOSS_I ) \ |
| 94 | ADD_VNV_ITEM( VNV_PACKET_TYPE_POWER_LIMITS, 42, 2, NV_WLAN_PACKET_TYPE_POWER_LIMITS_I ) \ |
| 95 | ADD_VNV_ITEM( VNV_OFDM_CMD_PWR_OFFSET, 1, 2, NV_WLAN_OFDM_CMD_PWR_OFFSET_I ) \ |
| 96 | ADD_VNV_ITEM( VNV_TX_BB_FILTER_MODE, 1, 4, NV_TX_BB_FILTER_MODE_I ) \ |
| 97 | ADD_VNV_ITEM( VNV_FREQUENCY_FOR_1_3V_SUPPLY, 1, 4, NV_FREQUENCY_FOR_1_3V_SUPPLY_I ) \ |
| 98 | ADD_VNV_ITEM( VNV_TABLE_VIRTUAL_RATE, 1, 4, VNV_TABLE_VIRTUAL_RATE_I ) \ |
| 99 | |
| 100 | |
| 101 | #define VOS_COUNTRY_CODE_LEN 2 |
| 102 | #define VOS_MAC_ADDRESS_LEN 6 |
| 103 | #define VOS_NV_FREQUENCY_FOR_1_3V_SUPPLY_3P2MH 0 //3.2 Mhz |
| 104 | #define VOS_NV_FREQUENCY_FOR_1_3V_SUPPLY_1P6MH 1 //1.6 Mhz |
| 105 | |
| 106 | |
| 107 | /*! |
| 108 | * The path (from the root of the DPP_FOLDER_PATH\QCOM) to the file containing |
| 109 | * the CLPC provisioning data. This is being temporarily put here. This should go |
| 110 | * to esp_dpp.h where the WLAN_PROVISION_DATA is present. |
| 111 | */ |
| 112 | #define CLPC_PROVISION_DATA L"WLAN_CLPC.PROVISION" |
| 113 | |
| 114 | /*-------------------------------------------------------------------------- |
| 115 | Type declarations |
| 116 | ------------------------------------------------------------------------*/ |
| 117 | // enum of RX sensitivity table index |
| 118 | typedef enum |
| 119 | { |
| 120 | // 11b |
| 121 | MAC_RATE_11B_1_MBPS, |
| 122 | MAC_RATE_11B_2_MBPS, |
| 123 | MAC_RATE_11B_5_5_MBPS, |
| 124 | MAC_RATE_11B_11_MBPS, |
| 125 | |
| 126 | // 11g |
| 127 | MAC_RATE_11G_6_MBPS, |
| 128 | MAC_RATE_11G_9_MBPS, |
| 129 | MAC_RATE_11G_12_MBPS, |
| 130 | MAC_RATE_11G_18_MBPS, |
| 131 | MAC_RATE_11G_24_MBPS, |
| 132 | MAC_RATE_11G_36_MBPS, |
| 133 | MAC_RATE_11G_48_MBPS, |
| 134 | MAC_RATE_11G_54_MBPS, |
| 135 | |
| 136 | // 11n |
| 137 | MAC_RATE_11N_MCS_0, |
| 138 | MAC_RATE_11N_MCS_1, |
| 139 | MAC_RATE_11N_MCS_2, |
| 140 | MAC_RATE_11N_MCS_3, |
| 141 | MAC_RATE_11N_MCS_4, |
| 142 | MAC_RATE_11N_MCS_5, |
| 143 | MAC_RATE_11N_MCS_6, |
| 144 | MAC_RATE_11N_MCS_7, |
| 145 | |
| 146 | MAC_RATE_COUNT |
| 147 | |
| 148 | } v_MAC_RATE_t; |
| 149 | |
| 150 | // enum of regulatory doamains in WLAN |
| 151 | typedef enum |
| 152 | { |
| 153 | REGDOMAIN_FCC, |
| 154 | REGDOMAIN_ETSI, |
| 155 | REGDOMAIN_JAPAN, |
| 156 | REGDOMAIN_WORLD, |
| 157 | REGDOMAIN_N_AMER_EXC_FCC, |
| 158 | REGDOMAIN_APAC, |
| 159 | REGDOMAIN_KOREA, |
| 160 | REGDOMAIN_HI_5GHZ, |
| 161 | REGDOMAIN_NO_5GHZ, |
| 162 | // add new regulatory domain here |
| 163 | REGDOMAIN_COUNT |
| 164 | } |
| 165 | v_REGDOMAIN_t; |
| 166 | |
| 167 | // enum of supported NV items in VOSS |
| 168 | typedef enum |
| 169 | { |
| 170 | #define ADD_VNV_ITEM(_name, _cnt, _size, _label) _name, |
| 171 | VNV_ITEM_TABLE |
| 172 | #undef ADD_VNV_ITEM |
| 173 | VNV_TYPE_COUNT |
| 174 | } |
| 175 | VNV_TYPE; |
| 176 | |
| 177 | // country code type |
| 178 | typedef v_U8_t v_COUNTRYCODE_t[VOS_COUNTRY_CODE_LEN]; |
| 179 | |
| 180 | // MAC address type |
| 181 | typedef v_U8_t v_MAC_ADDRESS_t[VOS_MAC_ADDRESS_LEN]; |
| 182 | |
| 183 | /*------------------------------------------------------------------------- |
| 184 | Function declarations and documenation |
| 185 | ------------------------------------------------------------------------*/ |
| 186 | /**------------------------------------------------------------------------ |
| 187 | |
| 188 | \brief vos_nv_init() - initialize the NV module |
| 189 | |
| 190 | The \a vos_nv_init() initializes the NV module. This read the binary |
| 191 | file for country code and regulatory domain information. |
| 192 | |
| 193 | \return VOS_STATUS_SUCCESS - module is initialized successfully |
| 194 | otherwise - module is not initialized |
| 195 | \sa |
| 196 | |
| 197 | -------------------------------------------------------------------------*/ |
| 198 | VOS_STATUS vos_nv_init(void); |
| 199 | |
| 200 | /**------------------------------------------------------------------------ |
| 201 | |
| 202 | \brief vos_nv_getRegDomainFromCountryCode() - get the regulatory domain of |
| 203 | a country given its country code |
| 204 | |
| 205 | The \a vos_nv_getRegDomainFromCountryCode() returns the regulatory domain of |
| 206 | a country given its country code. This is done from reading a cached |
| 207 | copy of the binary file. |
| 208 | |
| 209 | \param pRegDomain - pointer to regulatory domain |
| 210 | |
| 211 | \param countryCode - country code |
| 212 | |
| 213 | \return VOS_STATUS_SUCCESS - regulatory domain is found for the given country |
| 214 | VOS_STATUS_E_FAULT - invalid pointer error |
| 215 | VOS_STATUS_E_EMPTY - country code table is empty |
| 216 | VOS_STATUS_E_EXISTS - given country code does not exist in table |
| 217 | |
| 218 | \sa |
| 219 | |
| 220 | -------------------------------------------------------------------------*/ |
| 221 | VOS_STATUS vos_nv_getRegDomainFromCountryCode( v_REGDOMAIN_t *pRegDomain, |
| 222 | const v_COUNTRYCODE_t countryCode ); |
| 223 | |
| 224 | /**------------------------------------------------------------------------ |
| 225 | |
| 226 | \brief vos_nv_getSupportedCountryCode() - get the list of supported |
| 227 | country codes |
| 228 | |
| 229 | The \a vos_nv_getSupportedCountryCode() encodes the list of supported |
| 230 | country codes with paddings in the provided buffer |
| 231 | |
| 232 | \param pBuffer - pointer to buffer where supported country codes |
| 233 | and paddings are encoded; this may be set to NULL |
| 234 | if user wishes to query the required buffer size to |
| 235 | get the country code list |
| 236 | |
| 237 | \param pBufferSize - this is the provided buffer size on input; |
| 238 | this is the required or consumed buffer size on output |
| 239 | |
| 240 | \return VOS_STATUS_SUCCESS - country codes are successfully encoded |
| 241 | VOS_STATUS_E_NOMEM - country codes are not encoded because either |
| 242 | the buffer is NULL or buffer size is |
| 243 | sufficient |
| 244 | \sa |
| 245 | |
| 246 | -------------------------------------------------------------------------*/ |
| 247 | VOS_STATUS vos_nv_getSupportedCountryCode( v_BYTE_t *pBuffer, v_SIZE_t *pBufferSize, |
| 248 | v_SIZE_t paddingSize ); |
| 249 | |
| 250 | /**------------------------------------------------------------------------ |
| 251 | |
| 252 | \brief vos_nv_setValidity() - set the validity of an NV item. |
| 253 | |
| 254 | The \a vos_nv_setValidity() validates and invalidates an NV item. The |
| 255 | validity information is stored in NV memory. |
| 256 | One would get the VOS_STATUS_E_EXISTS error when reading an invalid item. |
| 257 | An item becomes valid when one has written to it successfully. |
| 258 | |
| 259 | \param type - NV item type |
| 260 | |
| 261 | \param itemIsValid - boolean value indicating the item's validity |
| 262 | |
| 263 | \return VOS_STATUS_SUCCESS - validity is set successfully |
| 264 | VOS_STATUS_E_INVAL - one of the parameters is invalid |
| 265 | VOS_STATUS_E_FAILURE - unknown error |
| 266 | \sa |
| 267 | |
| 268 | -------------------------------------------------------------------------*/ |
| 269 | VOS_STATUS vos_nv_setValidity( VNV_TYPE type, v_BOOL_t itemIsValid ); |
| 270 | |
| 271 | /**------------------------------------------------------------------------ |
| 272 | |
| 273 | \brief vos_nv_getValidity() - get the validity of an NV item. |
| 274 | |
| 275 | The \a vos_nv_getValidity() indicates if an NV item is valid. The |
| 276 | validity information is stored in NV memory. |
| 277 | One would get the VOS_STATUS_E_EXISTS error when reading an invalid item. |
| 278 | An item becomes valid when one has written to it successfully. |
| 279 | |
| 280 | \param type - NV item type |
| 281 | |
| 282 | \param pItemIsValid- pointer to the boolean value indicating the item's |
| 283 | validity |
| 284 | |
| 285 | \return VOS_STATUS_SUCCESS - validity is determined successfully |
| 286 | VOS_STATUS_E_INVAL - one of the parameters is invalid |
| 287 | VOS_STATUS_E_FAILURE - unknown error |
| 288 | \sa |
| 289 | |
| 290 | -------------------------------------------------------------------------*/ |
| 291 | VOS_STATUS vos_nv_getValidity( VNV_TYPE type, v_BOOL_t *pItemIsValid ); |
| 292 | |
| 293 | /**------------------------------------------------------------------------ |
| 294 | |
| 295 | \brief vos_nv_read() - read a NV item to an output buffer |
| 296 | |
| 297 | The \a vos_nv_read() reads a NV item to an output buffer. If the item is |
| 298 | an array, this function would read the entire array. One would get a |
| 299 | VOS_STATUS_E_EXISTS error when reading an invalid item. |
| 300 | |
| 301 | For error conditions of VOS_STATUS_E_EXISTS and VOS_STATUS_E_FAILURE, |
| 302 | if a default buffer is provided (with a non-NULL value), |
| 303 | the default buffer content is copied to the output buffer. |
| 304 | |
| 305 | \param type - NV item type |
| 306 | |
| 307 | \param outputBuffer - output buffer |
| 308 | |
| 309 | \param defaultBuffer - default buffer |
| 310 | |
| 311 | \param bufferSize - output buffer size |
| 312 | |
| 313 | \return VOS_STATUS_SUCCESS - NV item is read successfully |
| 314 | VOS_STATUS_E_INVAL - one of the parameters is invalid |
| 315 | VOS_STATUS_E_FAULT - defaultBuffer point is NULL |
| 316 | VOS_STATUS_E_EXISTS - NV type is unsupported |
| 317 | VOS_STATUS_E_FAILURE - unknown error |
| 318 | \sa |
| 319 | |
| 320 | -------------------------------------------------------------------------*/ |
| 321 | VOS_STATUS vos_nv_read( VNV_TYPE type, v_VOID_t *outputBuffer, |
| 322 | v_VOID_t *defaultBuffer, v_SIZE_t bufferSize ); |
| 323 | |
| 324 | /**------------------------------------------------------------------------ |
| 325 | |
| 326 | \brief vos_nv_readAtIndex() - read an element of a NV array to an output |
| 327 | buffer |
| 328 | |
| 329 | The \a vos_nv_readAtIndex() reads an element of a NV item to an output |
| 330 | buffer. If the item is not array, this function only works for index of 0. |
| 331 | One would get a VOS_STATUS_E_EXISTS error when reading an invalid item. |
| 332 | |
| 333 | For error conditions of VOS_STATUS_E_EXISTS and VOS_STATUS_E_FAILURE, |
| 334 | if a default buffer is provided (with a non-NULl value), |
| 335 | the default buffer content is copied to the output buffer. |
| 336 | |
| 337 | \param type - NV item type |
| 338 | |
| 339 | \param index - NV array index |
| 340 | |
| 341 | \param outputBuffer - output buffer |
| 342 | |
| 343 | \param defaultBuffer - default buffer |
| 344 | |
| 345 | \param bufferSize - output buffer size |
| 346 | |
| 347 | \return VOS_STATUS_SUCCESS - NV item is read successfully |
| 348 | VOS_STATUS_E_INVAL - one of the parameters is invalid |
| 349 | VOS_STATUS_E_FAULT - defaultBuffer point is NULL |
| 350 | VOS_STATUS_E_EXISTS - NV type is unsupported |
| 351 | VOS_STATUS_E_FAILURE - unknown error |
| 352 | \sa |
| 353 | |
| 354 | -------------------------------------------------------------------------*/ |
| 355 | VOS_STATUS vos_nv_readAtIndex( VNV_TYPE type, v_UINT_t index, |
| 356 | v_VOID_t *outputBuffer, v_VOID_t *defaultBuffer, v_SIZE_t bufferSize ); |
| 357 | |
| 358 | /**------------------------------------------------------------------------ |
| 359 | |
| 360 | \brief vos_nv_write() - write to a NV item from an input buffer |
| 361 | |
| 362 | The \a vos_nv_write() writes to a NV item from an input buffer. This would |
| 363 | validate the NV item if the write operation is successful. |
| 364 | |
| 365 | \param type - NV item type |
| 366 | |
| 367 | \param inputBuffer - input buffer |
| 368 | |
| 369 | \param inputBufferSize - input buffer size |
| 370 | |
| 371 | \return VOS_STATUS_SUCCESS - NV item is read successfully |
| 372 | VOS_STATUS_E_INVAL - one of the parameters is invalid |
| 373 | VOS_STATUS_E_FAULT - outputBuffer pointer is NULL |
| 374 | VOS_STATUS_E_EXISTS - NV type is unsupported |
| 375 | VOS_STATUS_E_FAILURE - unknown error |
| 376 | \sa |
| 377 | |
| 378 | -------------------------------------------------------------------------*/ |
| 379 | VOS_STATUS vos_nv_write( VNV_TYPE type, v_VOID_t *inputBuffer, |
| 380 | v_SIZE_t inputBufferSize ); |
| 381 | |
| 382 | /**------------------------------------------------------------------------ |
| 383 | |
| 384 | \brief vos_nv_writeAtIndex() - write to an element of a NV array from an |
| 385 | input buffer |
| 386 | |
| 387 | The \a vos_nv_writeAtIndex() writes to an element of a NV array from an |
| 388 | input buffer. If the item is not an array, this function only works for |
| 389 | an array index of 0. This would automatically validate the NV item if the |
| 390 | write operation is successful. |
| 391 | |
| 392 | \param type - NV item type |
| 393 | |
| 394 | \param index - NV array index |
| 395 | |
| 396 | \param inputBuffer - input buffer |
| 397 | |
| 398 | \param inputBufferSize - input buffer size |
| 399 | |
| 400 | \return VOS_STATUS_SUCCESS - NV item is read successfully |
| 401 | VOS_STATUS_E_INVAL - one of the parameters is invalid |
| 402 | VOS_STATUS_E_FAULT - outputBuffer pointer is NULL |
| 403 | VOS_STATUS_E_EXISTS - NV type is unsupported |
| 404 | VOS_STATUS_E_FAILURE - unknown error |
| 405 | \sa |
| 406 | |
| 407 | -------------------------------------------------------------------------*/ |
| 408 | VOS_STATUS vos_nv_writeAtIndex( VNV_TYPE type, v_UINT_t index, |
| 409 | v_VOID_t *inputBuffer, v_SIZE_t inputBufferSize ); |
| 410 | |
| 411 | /**------------------------------------------------------------------------ |
| 412 | |
| 413 | \brief vos_nv_getElementCount() - return element count of a NV array |
| 414 | |
| 415 | The \a vos_nv_getElementCount() returns element count of a NV array |
| 416 | |
| 417 | \param type - NV item type |
| 418 | |
| 419 | \return count if type is valid; 0 otherwise |
| 420 | |
| 421 | \sa |
| 422 | |
| 423 | -------------------------------------------------------------------------*/ |
| 424 | VOS_INLINE_FN v_SIZE_t vos_nv_getElementCount( VNV_TYPE type ) |
| 425 | { |
| 426 | switch (type) |
| 427 | { |
| 428 | #define ADD_VNV_ITEM(_name, _cnt, _size, _label) case (_name): return (_cnt); |
| 429 | VNV_ITEM_TABLE |
| 430 | #undef ADD_VNV_ITEM |
| 431 | default: |
| 432 | return 0; |
| 433 | } |
| 434 | } |
| 435 | |
| 436 | /**------------------------------------------------------------------------ |
| 437 | |
| 438 | \brief vos_nv_getElementSize() - return size of a NV element |
| 439 | |
| 440 | The \a vos_nv_getElementSize() returns size of a NV element. |
| 441 | |
| 442 | \param type - NV item type |
| 443 | |
| 444 | \return size if type is valid; 0 otherwise |
| 445 | |
| 446 | \sa |
| 447 | |
| 448 | -------------------------------------------------------------------------*/ |
| 449 | VOS_INLINE_FN v_SIZE_t vos_nv_getElementSize( VNV_TYPE type ) |
| 450 | { |
| 451 | switch (type) |
| 452 | { |
| 453 | #define ADD_VNV_ITEM(_name, _cnt, _size, _label) case (_name): return (_size); |
| 454 | VNV_ITEM_TABLE |
| 455 | #undef ADD_VNV_ITEM |
| 456 | default: |
| 457 | return 0; |
| 458 | } |
| 459 | } |
| 460 | |
| 461 | /**------------------------------------------------------------------------ |
| 462 | |
| 463 | \brief vos_nv_getItemSize() - return size of a NV item |
| 464 | |
| 465 | The \a vos_nv_getItemSize() returns size of a NV item. |
| 466 | |
| 467 | \param type - NV item type |
| 468 | |
| 469 | \return size of a NV item array if type is valid; 0 otherwise |
| 470 | |
| 471 | \sa |
| 472 | |
| 473 | -------------------------------------------------------------------------*/ |
| 474 | VOS_INLINE_FN v_SIZE_t vos_nv_getItemSize( VNV_TYPE type ) |
| 475 | { |
| 476 | return vos_nv_getElementCount(type) * vos_nv_getElementSize(type); |
| 477 | } |
| 478 | |
| 479 | // TODO: HAL NV interface should be used to access individual NV items |
| 480 | // instead of below functions once that is ready |
| 481 | |
| 482 | /**------------------------------------------------------------------------ |
| 483 | |
| 484 | \brief vos_nv_readTxAntennaCount() - return number of TX antenna |
| 485 | |
| 486 | \param pTxAntennaCount - antenna count |
| 487 | |
| 488 | \return status of the NV read operation |
| 489 | |
| 490 | \sa |
| 491 | |
| 492 | -------------------------------------------------------------------------*/ |
| 493 | VOS_STATUS vos_nv_readTxAntennaCount( v_U8_t *pTxAntennaCount ); |
| 494 | |
| 495 | /**------------------------------------------------------------------------ |
| 496 | |
| 497 | \brief vos_nv_readRxAntennaCount() - return number of RX antenna |
| 498 | |
| 499 | \param pRxAntennaCount - antenna count |
| 500 | |
| 501 | \return status of the NV read operation |
| 502 | |
| 503 | \sa |
| 504 | |
| 505 | -------------------------------------------------------------------------*/ |
| 506 | VOS_STATUS vos_nv_readRxAntennaCount( v_U8_t *pRxAntennaCount ); |
| 507 | |
| 508 | /**------------------------------------------------------------------------ |
| 509 | |
| 510 | \brief vos_nv_readMacAddress() - return the MAC address |
| 511 | |
| 512 | \param pMacAddress - MAC address |
| 513 | |
| 514 | \return status of the NV read operation |
| 515 | |
| 516 | \sa |
| 517 | |
| 518 | -------------------------------------------------------------------------*/ |
| 519 | VOS_STATUS vos_nv_readMacAddress( v_MAC_ADDRESS_t pMacAddress ); |
| 520 | |
| 521 | /**------------------------------------------------------------------------ |
| 522 | |
| 523 | \brief vos_nv_readMultiMacAddress() - return the Multiple MAC addresses |
| 524 | |
| 525 | \param pMacAddress - MAC address |
| 526 | \param macCount - Count of valid MAC addresses to get from NV field |
| 527 | |
| 528 | \return status of the NV read operation |
| 529 | |
| 530 | \sa |
| 531 | |
| 532 | -------------------------------------------------------------------------*/ |
| 533 | VOS_STATUS vos_nv_readMultiMacAddress( v_U8_t* pMacAddr, v_U8_t macCount); |
| 534 | |
| 535 | /**------------------------------------------------------------------------ |
| 536 | \brief vos_nv_getDefaultRegDomain() - return the default regulatory domain |
| 537 | \return default regulatory domain |
| 538 | \sa |
| 539 | -------------------------------------------------------------------------*/ |
| 540 | v_REGDOMAIN_t vos_nv_getDefaultRegDomain( void ); |
| 541 | |
| 542 | /**------------------------------------------------------------------------ |
| 543 | \brief vos_nv_getSupportedChannels() - function to return the list of |
| 544 | supported channels |
| 545 | \param p20MhzChannels - list of 20 Mhz channels |
| 546 | \param pNum20MhzChannels - number of 20 Mhz channels |
| 547 | \param p40MhzChannels - list of 20 Mhz channels |
| 548 | \param pNum40MhzChannels - number of 20 Mhz channels |
| 549 | \return status of the NV read operation |
| 550 | \Note: 40Mhz not currently supported |
| 551 | \sa |
| 552 | -------------------------------------------------------------------------*/ |
| 553 | VOS_STATUS vos_nv_getSupportedChannels( v_U8_t *p20MhzChannels, int *pNum20MhzChannels, |
| 554 | v_U8_t *p40MhzChannels, int *pNum40MhzChannels); |
| 555 | |
| 556 | /**------------------------------------------------------------------------ |
| 557 | \brief vos_nv_readDefaultCountryTable() - return the default Country table |
| 558 | \param table data - a union to return the default country table data in. |
| 559 | \return status of the NV read operation |
| 560 | \sa |
| 561 | -------------------------------------------------------------------------*/ |
| 562 | VOS_STATUS vos_nv_readDefaultCountryTable( uNvTables *tableData ); |
| 563 | |
| 564 | /**------------------------------------------------------------------------ |
| 565 | \brief vos_nv_getChannelListWithPower() - function to return the list of |
| 566 | supported channels with the power limit info too. |
| 567 | \param pChannels20MHz - list of 20 Mhz channels |
| 568 | \param pNum20MHzChannelsFound - number of 20 Mhz channels |
| 569 | \param pChannels40MHz - list of 20 Mhz channels |
| 570 | \param pNum40MHzChannelsFound - number of 20 Mhz channels |
| 571 | \return status of the NV read operation |
| 572 | \Note: 40Mhz not currently supported |
| 573 | \sa |
| 574 | -------------------------------------------------------------------------*/ |
| 575 | VOS_STATUS vos_nv_getChannelListWithPower(tChannelListWithPower *pChannels20MHz /*[NUM_LEGIT_RF_CHANNELS] */, |
| 576 | tANI_U8 *pNum20MHzChannelsFound, |
| 577 | tChannelListWithPower *pChannels40MHz /*[NUM_CHAN_BOND_CHANNELS] */, |
| 578 | tANI_U8 *pNum40MHzChannelsFound |
| 579 | ); |
| 580 | |
| 581 | /**------------------------------------------------------------------------ |
| 582 | |
| 583 | \brief vos_nv_open() - initialize the NV module |
| 584 | |
| 585 | The \a vos_nv_open() initializes the NV module. This function read the binary |
| 586 | file qcom_nv.bin for macaddress,country code,regulatory domain information and etc. |
| 587 | |
| 588 | \return VOS_STATUS_SUCCESS - module is initialized successfully |
| 589 | otherwise - module is not initialized |
| 590 | \sa |
| 591 | |
| 592 | -------------------------------------------------------------------------*/ |
| 593 | VOS_STATUS vos_nv_open(void); |
| 594 | |
| 595 | /**------------------------------------------------------------------------ |
| 596 | |
| 597 | \brief vos_nv_close() - uninitialize the NV module |
| 598 | |
| 599 | The \a vos_nv_init() uninitializes the NV module. This function release the binary |
| 600 | file qcom_nv.bin data buffer. |
| 601 | |
| 602 | \return VOS_STATUS_SUCCESS - module is initialized successfully |
| 603 | otherwise - module is not initialized |
| 604 | \sa |
| 605 | |
| 606 | -------------------------------------------------------------------------*/ |
| 607 | |
| 608 | VOS_STATUS vos_nv_close(void); |
| 609 | |
| 610 | /**------------------------------------------------------------------------ |
| 611 | \brief vos_nv_getBuffer - |
| 612 | \param pBuffer - to return the buffer address |
| 613 | pNvBitmap - Nv Bit map |
| 614 | pSize - buffer size. |
| 615 | \return status of the NV read operation |
| 616 | \sa |
| 617 | -------------------------------------------------------------------------*/ |
| 618 | VOS_STATUS vos_nv_getNVBuffer(v_VOID_t **pNvBuffer ,v_SIZE_t *pSize); |
| 619 | |
| 620 | #ifdef FEATURE_WLAN_INTEGRATED_SOC |
| 621 | /**------------------------------------------------------------------------ |
| 622 | \brief vos_nv_setRegDomain - |
| 623 | \param clientCtxt - Client Context, Not used for PRIMA |
| 624 | regId - Regulatory Domain ID |
| 625 | \return status set REG domain operation |
| 626 | \sa |
| 627 | -------------------------------------------------------------------------*/ |
| 628 | VOS_STATUS vos_nv_setRegDomain(void * clientCtxt, v_REGDOMAIN_t regId); |
| 629 | |
| 630 | /**------------------------------------------------------------------------ |
| 631 | \brief vos_nv_getChannelEnabledState - |
| 632 | \param rfChannel - input channel number to know enabled state |
| 633 | \return eNVChannelEnabledType enabled state for channel |
| 634 | * enabled |
| 635 | * disabled |
| 636 | * DFS |
| 637 | \sa |
| 638 | -------------------------------------------------------------------------*/ |
| 639 | |
| 640 | eNVChannelEnabledType vos_nv_getChannelEnabledState |
| 641 | ( |
| 642 | v_U32_t rfChannel |
| 643 | ); |
| 644 | #endif /* FEATURE_WLAN_INTEGRATED_SOC */ |
| 645 | |
| 646 | #endif // __VOS_NVITEM_H |