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