Prasanna Kumar | f6c94ae | 2013-04-11 20:05:21 -0700 | [diff] [blame] | 1 | /* |
Kiet Lam | aa8e15a | 2014-02-11 23:30:06 -0800 | [diff] [blame^] | 2 | * Copyright (c) 2012-2013 Qualcomm Atheros, Inc. |
| 3 | * All Rights Reserved. |
| 4 | * Qualcomm Atheros Confidential and Proprietary. |
Madan Mohan Koyyalamudi | a997c1e | 2013-09-03 12:16:32 -0700 | [diff] [blame] | 5 | */ |
Prasanna Kumar | f6c94ae | 2013-04-11 20:05:21 -0700 | [diff] [blame] | 6 | #if !defined _WLAN_NV_TEMPLATE_BUILTIN_H |
| 7 | #define _WLAN_NV_TEMPLATE_BUILTIN_H |
| 8 | |
| 9 | |
| 10 | /*=========================================================================== |
| 11 | EDIT HISTORY FOR FILE |
| 12 | |
| 13 | This section contains comments describing changes made to the module. |
| 14 | Notice that changes are listed in reverse chronological order. |
| 15 | |
| 16 | $Header:$ $DateTime: $ $Author: $ |
| 17 | |
| 18 | when who what, where, why |
| 19 | -------- --- ----------------------------------------------- |
| 20 | 04/10/13 kumarpra nv built in creation |
| 21 | ===========================================================================*/ |
| 22 | |
| 23 | |
| 24 | /* |
| 25 | ----------------------------------------- |
| 26 | This file is generated by nvTmplRun Parser |
| 27 | ----------------------------------------- |
| 28 | To be auto-generated, or |
| 29 | This is the source file and the header file can be generated from this |
| 30 | template file. |
| 31 | |
| 32 | Template constructs |
| 33 | 1. TABLE_: struct |
| 34 | 2. INDEX_ENUM: enums, e.g. {RATE_OFDM_6M,RATE_OFDM_54M} |
| 35 | 3. INDEX_INT: int, e.g.{min, max, increment} |
| 36 | 3. Basic data types: tANI_U8, tANI_S8, tANI_U32, tANI_S32 |
| 37 | 4. Storage types: |
| 38 | 4.1 SINGULAR: one element of basic data type |
| 39 | 4.2 ARRAY_1: one dimensional array, x-axis |
| 40 | 4.3 ARRAY_2: two dimensional array, (x, y) |
| 41 | 4.4 ARRAY_3: three dimensional array, (x, y, z) |
| 42 | 4.5 ARRAY_4: four dimensional array, (x, y, z, t) |
| 43 | |
| 44 | Implementation notes |
| 45 | 1. Flow of changing NV data format: (TBD) Either change the template and |
| 46 | generate the header file, or modify header file and auto-generate |
| 47 | the template. |
| 48 | 2. Flow of writing NV data: encode the template in the data stream, so the |
| 49 | NV data is "self-sufficient". No separate template, no compability |
| 50 | issue, no need of version control. |
| 51 | 3. Flow of reading NV data: parse the binary NV data stream based on the |
| 52 | template info in the data stream. |
| 53 | 4. The above NV logic is decoupled from the actual data content, a generic, |
| 54 | content ergonostic parser (reading) and encoder (writing). |
| 55 | The NV logic is common code shared by tools, s/w |
| 56 | (both host and firmware), and off-line utilities. |
| 57 | 5. NV data parsing and "acceptanace" into an s/w moduel data structure can |
| 58 | be "configured" in several ways: |
| 59 | 5.1 only total matching of all fields, otherwise, reject the whole data |
| 60 | stream (a table). |
| 61 | 5.2 partial matching of fields allowed and the rest fields assume |
| 62 | reasonal default values, |
| 63 | The choice can be determined later, but the capability is provided. |
| 64 | 6. We could also design in this selection on an individua table base. |
| 65 | To design such capability, reserve some header bits in the data stream. |
| 66 | 7. The NV data streams can be modified, replaced, or intact with a new data |
| 67 | stream of the same table ID added to NV data. |
| 68 | The choice can be determined later, but the NV scheme provides such |
| 69 | capability. |
| 70 | 8. The template construct definitions can be common to all tables |
| 71 | (tbd: in a common section) or table specific, or updated in a |
| 72 | subsequent format section. |
| 73 | The use cases are: |
| 74 | - An index enum (e.g. RF channels) is common to all tables when the NV |
| 75 | data is created. Later new enums are added (e.g. |
| 76 | additional channels), one can choose to add the new index enum for new |
| 77 | tables appended to the NV data, or replace the |
| 78 | old table with new template info and data. |
| 79 | The template precedence is table specific then common, and later |
| 80 | "common" overwrites "earlier" commmon. |
| 81 | - A new field is added to the table, the user decides to replace the |
| 82 | old table data, he can simply encode the template info in the |
| 83 | data stream. |
| 84 | - In the same scenario (a new field is added), the user decides to |
| 85 | append a new table, he can encode the template |
| 86 | in the new data table and append it to NV data, or write a new common |
| 87 | template section and append the data. |
| 88 | |
| 89 | Key "ingredients", (re-iterate the most important features and capabilities) |
| 90 | 1. How to parse the data is embedded in the NV data itself. It removes the |
| 91 | dependency on header file matching, |
| 92 | version checking, compatibility among tools, host and firmware. |
| 93 | 2. Table field ID enables "partial" data acceptance in an s/w module data |
| 94 | structure. Whether full matching or reject the whole table, or "partial" |
| 95 | acceptance, the capabiilty is in place and further ensures the robust |
| 96 | NV data extensibility and compatibility. |
| 97 | 3. The table granularity, data stream based NV data has variable length |
| 98 | and flexibility of modifying an existing table data, replacing the |
| 99 | whole data, or leaving the existing data table intact and appending |
| 100 | a new table. |
| 101 | Misc notes: |
| 102 | 1. For endianness, support only 4 bytes integer or 4 1-byte |
| 103 | 2. String identifier needs to be shortened to save storage |
| 104 | 3. string_field_name, field type, field storage class, storage size |
| 105 | */ |
| 106 | |
| 107 | |
| 108 | #include "wlan_nv_types.h" |
| 109 | |
Leo Chang | 80de3c2 | 2013-11-26 10:52:12 -0800 | [diff] [blame] | 110 | int allocNvBinTable(int tblIdx, int numEntries); |
| 111 | int allocNvBinEnum(int enumIdx, int numEntries); |
| 112 | |
Prasanna Kumar | f6c94ae | 2013-04-11 20:05:21 -0700 | [diff] [blame] | 113 | typedef enum _nvFieldSizeEnums { |
| 114 | INDEX_ENUM_ALL = 0, |
| 115 | INDEX_ENUM_NUM_PHY_MAX_TX_CHAINS, |
| 116 | INDEX_ENUM_NUM_REG_DOMAINS, |
| 117 | INDEX_ENUM_NUM_RF_SUBBANDS, |
| 118 | INDEX_ENUM_NUM_RF_CHANNELS, |
| 119 | INDEX_ENUM_NUM_2_4GHZ_CHANNELS, |
| 120 | INDEX_ENUM_NUM_802_11_MODES, |
| 121 | INDEX_ENUM_NUM_HAL_PHY_RATES, |
| 122 | INDEX_ENUM_BUILTIN_LAST, |
| 123 | INDEX_ENUM_BUILTIN_MAX, |
| 124 | } _NV_FIELD_SIZE_ENUMS; |
| 125 | |
| 126 | #define INDEX_ENUM_MAX MAX(INDEX_ENUM_PREDEFINED_MAX, INDEX_ENUM_BUILTIN_MAX) |
| 127 | |
| 128 | int getEnumNoOfFields(int enumIdx); |
| 129 | extern _NV_TEMPLATE_ENUM NvEnumsBuiltIn[/*INDEX_ENUM_MAX*/][ENUM_ENTRIES_MAX]; |
| 130 | |
| 131 | typedef enum _nvTableIDs { |
| 132 | TABLE_sHalNv, |
| 133 | TABLE_sNvFields, |
| 134 | TABLE_sRegulatoryChannel, |
| 135 | TABLE_sRssiChannelOffsets, |
| 136 | TABLE_sCalData, |
| 137 | TABLE_sTxBbFilterMode, |
| 138 | TABLE_sOfdmCmdPwrOffset, |
| 139 | TABLE_sDefaultCountry, |
| 140 | TABLE_sFwConfig, |
| 141 | TABLE_tTpcPowerTable, |
| 142 | TABLE_tRateGroupPwr, |
| 143 | TABLE_tRateGroupPwrVR, |
| 144 | TABLE_sRegulatoryDomains, |
| 145 | TABLE_sHwCalValues, |
| 146 | TABLE_sNvTables, |
| 147 | TABLE_BUILTIN_LAST, |
| 148 | TABLE_BUILTIN_MAX, |
| 149 | } _NV_TABLE_ID; |
| 150 | |
| 151 | #define TABLES_MAX MAX(TABLE_PREDEFINED_MAX, TABLE_BUILTIN_MAX) |
| 152 | |
| 153 | int getTableNoOfFields(int tblIdx); |
| 154 | extern _NV_TEMPLATE_TABLE NvTablesBuiltIn[/*TABLES_MAX*/][TABLE_ENTRIES_MAX]; |
| 155 | |
| 156 | #endif //#if !defined(_WLAN_NV_TEMPLATEBUILTIN_H) |