/**
 * @file nvm.h
 *
 * @brief This file functions for the NVM framework
 *
 * @copyright Copyright 2023 Antaris, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

#ifndef NVM_CONFIG_H
#define NVM_CONFIG_H

#ifdef COREBOARD
#define FMC_NOR_NVM                                         ///< select FMC flash as NVM
#undef QSPI_NVM                                         ///< unselect FMC flash as NVM
#endif

#ifdef STM32F769xx
#undef FMC_NOR_NVM                                         ///< select FMC flash as NVM
#define QSPI_NVM                                         ///< unselect FMC flash as NVM
#endif


#define NVM_MAX_BUFF_SIZE             24*1024               ///< 24 kb
#define NVM_HEADER_MAGIC_BYTE         0xEF
#define NVM_HEADER_LEN                8                   ///< NVM header length in bytes
#define NVM_MAGIC_NUMBER              0xA3D5                 ///< NVM Magic number
//#define NVM_MAGIC_NUM_OFFSET          NVM_LOCAL_BUFF_SIZE-6  ///< NVM revision number offset
#define NVM_DATA_VERSION              0                    ///< NVM Data version
#define INIT_FAIL                     1                    ///< NVM init fail status
#define INIT_TRUE                     0                    ///< NVM init success status
#define FMC_SDRAM_NVM_DATA_START_ADDR 1                    ///< FMC Flash NVM partition 1 data length in bytes
#define NVM_COMMIT_PERIODICITY        2*60*60*1000              ///< NVM flash commit periodicity in milliseconds


/**
 * @brief  HAL State structures definition
 */
typedef enum
{
	NVM_RAM_PARTITION,
	NVM_FLASH_PARTITION_1,
	NVM_FLASH_PARTITION_2

}nvm_partition_type;

/**
 * @brief NVM storage type enumeration
 */
typedef enum
{
	NVM_DATA,
	RD_ONLY_DATA,

}nvm_store_type;

/**
 * @brief NVM state enumeration
 */
typedef enum
{
	NVM_DRV_SUCCESS,
	NVM_DRV_INVALID

}e_nvm_drv_state;

/**
 * @brief NVM error code enumeration
 */
typedef enum
{
	NVM_INVALID_ID=1,
	NVM_INVALID_LEN=2,
	NVM_INVALID_PTR=3,
	NVM_SUCCESS=0,
	NVM_READ_ERROR=4,
	NVM_WRITE_ERROR=5,
	NVM_CRC_ERROR=6,
	NVM_INVALID_PARTITION_ID=7,
	NVM_VERSION_ERROR=8,
	NVM_INVALID=9,
	NVM_INVALID_PARTITION=10,
	NVM_MAGIC_BYTE_ERROR =11,
	NVM_UNKNOWN_ERROR=12,
}nvm_return_types;

/**
 * @brief NVM parameter ID enumeration
 */
typedef enum
{
    NVM_REV_NUM,
    NVM_VERSION,
    NVM_ZONE_FLAG,
    CONOPS_SCH_EVNT_PENDING_STS,
    CONOPS_SCH_CRNT_EVNT,
    CONOPS_SCH_LUT_INFO_0,
    CONOPS_SCH_LUT_INFO_1,
    CONOPS_SCH_EVNT_BUFF_0,
    CONOPS_SCH_EVNT_BUFF_1,
    EPS_ELIGIBLE_CHNL,
    EPS_CHNL_OVR_CUR_ERR,
    EPS_BTRY_THRSHLD,
    EPS_PWR_TMR1,
    EPS_PWR_TMR2,
    EPS_PWR_TMR3,
    EPS_PWR_TMR4,
    EPS_PWR_TMR5,
    EPS_PWR_TMR6,
    EPS_PWR_TMR7,
    EPS_PWR_TMR8,
    EPS_PWR_TMR9,
    EPS_PWR_TMR10,
    EPS_PWR_TMR11,
    EPS_PWR_TMR12,
    EPS_PWR_TMR13,
    EPS_PWR_TMR14,
    EPS_BTRY_CH_MAP,
	EPS_COM_FAIL_TIMEOUT,
    NVM_IPCC_SEC_CFG,
    NVM_TC_TM_SEC_CFG,
    NVM_OTSU_GSCONT_FAIL_TIMEOUT,
    NVM_OTSU_REBOOT_CONFIG,
    NVM_OTSU_CONFIG,
    NVM_OTSU_NW_FRMW_STS,
    NVM_OTSU_FTM_FILE_CONTXT_DATA,
    NVM_OTSU_FTM_CONTXT_DATA,
    NVM_TEMP_SENSOR_MCP9843_GPS_CFG,
    NVM_TEMP_SENSOR_MCP9843_PS_CFG,
    NVM_TEMP_SENSOR_MCP9843_EDGE_CFG,
    NVM_TEMP_SENSOR_MCP9843_OBC_CFG,
	/***** GEN2 TEMP*****/
	NVM_TEMP_SENSOR_MCP9843_EDGE1_GEN2_CFG,
	NVM_TEMP_SENSOR_MCP9843_EDGE2_GEN2_CFG,
	NVM_TEMP_SENSOR_MCP9843_PS_GEN2_CFG,
	NVM_TEMP_SENSOR_MCP9843_NIC1_CFG,
	NVM_TEMP_SENSOR_MCP9843_SSD1_GEN2_CFG,
	NVM_TEMP_SENSOR_MCP9843_SSD2_GEN2_CFG,
	NVM_TEMP_SENSOR_MCP9843_SSD3_GEN2_CFG,
	NVM_TEMP_SENSOR_MCP9843_SSD4_GEN2_CFG,

    NVM_DT_DS620_SPE01_CFG,
    NVM_DT_DS620_SPE02_CFG,
    NVM_DT_DS620_SPB01_CFG,
    NVM_DT_DS620_SPW01_CFG,
    NVM_DT_DS620_SPW02_CFG,
    NVM_DT_DS620_PS_CFG,
    NVM_DT_DS620_EDGE_CFG,
    NVM_POWER_SENSE_MONITOR_OBC_CFG,
    NVM_POWER_SENSE_MONITOR_PS_CFG,
	/***** GEN2 PSM *****/
	NVM_POWER_SENSE_MONITOR_PS_GEN2_CFG,
	NVM_POWER_SENSE_MONITOR_CORE_BRD_A_CFG,
	NVM_POWER_SENSE_MONITOR_CORE_BRD_B_CFG,
	NVM_POWER_SENSE_MONITOR_PS_1_CFG,
	NVM_POWER_SENSE_MONITOR_PS_2_CFG,
	NVM_POWER_SENSE_MONITOR_EDGE_1_CFG,
	NVM_POWER_SENSE_MONITOR_EDGE_2_SUP_CFG,
	NVM_POWER_SENSE_MONITOR_IO_BRD_SUP_CFG,
    /***** GEN2 HSC *****/
	NVM_HSC_ADM1176_PS_BRD_SUP_CFG,
	NVM_HSC_ADM1176_PS1_SUP_CFG,
	NVM_HSC_ADM1176_PS2_SUP_CFG,
	NVM_HSC_ADM1176_EDGE1_SUP_CFG,
	NVM_HSC_ADM1176_EDGE2_SUP_CFG,
	NVM_HSC_ADM1176_EDGE1_HEAT_COIL_CFG,
	NVM_HSC_ADM1176_EDGE2_HEAT_COIL_CFG,
	NVM_HSC_ADM1176_IO_BRD_SUP_CFG,
	NVM_HSC_ADM1176_IO_BRD_TOP1_CFG,
	NVM_HSC_ADM1176_IO_BRD_TOP2_CFG,
	NVM_HSC_ADM1176_IO_BRD_BOT1_CFG,
	NVM_HSC_ADM1176_IO_BRD_BOT2_CFG,

    NVM_HSC_ADM1176_EDGE_CFG,
    NVM_HSC_ADM1176_PS_1_CFG,
    NVM_HSC_ADM1176_PS_2_CFG,
    NVM_SNS_CFG_STS,
    NVM_RST_RSN_IDX,
    NVM_RST_CNT,
    NVM_RST_RSN_BUFF,
    NVM_SBAND_NAME,
    NVM_SBAND_BOOT_COUNT,
    NVM_SBAND_GWDT_INIT,
    NVM_SBAND_CSP_ADDRESS,
    NVM_SBAND_CSP_ROUTES,
    NVM_SBAND_CAN_RATE,
    NVM_SBAND_CAN_PROMISC,
    NVM_SBAND_UART_RATE,
    NVM_SBAND_UART_MULTIDROP,
    NVM_SBAND_IP_STACK_ENABLE,
    NVM_SBAND_ETH_IP_ADDRESS,
    NVM_SBAND_ETH_NET_PREFIX_BIT,
    NVM_SBAND_ETH_GATEWAY_IP_ADDRESS,
    NVM_SBAND_SPACELINK_IP_ADDRESS,
    NVM_SBAND_SPACELINK_NET_PREFIX_BIT,
    NVM_SBAND_SPACELINK_GATEWAY_IP_ADDRESS,
    NVM_SBAND_PWR_SNS_GAIN,
    NVM_SBAND_PWR_SNS_INTERCEPT,
    NVM_SBAND_VCTCXO,
    NVM_SBAND_TRANS_FREQ,
    NVM_SBAND_TRANS_MOD_TYP,
    NVM_SBAND_TRANS_SYMB_RATE,
    NVM_SBAND_TRANS_ROLL_OFF,
    NVM_SBAND_TRANS_PWR,
    NVM_SBAND_ALC_MODE,
    NVM_SBAND_TRANS_EN_REED_SOLOMON,
    NVM_SBAND_TRANS_EN_CONVOLUTIONAL,
    NVM_SBAND_TRANS_EN_RANDOMIZATION,
    NVM_SBAND_TRANS_EN_CRC_CHECKSUM,
    NVM_SBAND_IDLE_TIME,
    NVM_SBAND_PAYLOAD_SIZE,
    NVM_SBAND_SATEELITE_ID,
    NVM_SBAND_ENCRYPT_KEY,
    NVM_SBAND_ENCRYPT_FRAME,
    NVM_SBAND_TRANS_CRYPTO_AUTH,
    NVM_SBAND_PA_TEMP_LIMIT,
    NVM_SBAND_RECEIVE_FREQ,
    NVM_SBAND_MODULATION_TYP,
    NVM_SBAND_RECEIVE_SYMB_RATE,
    NVM_SBAND_RECEIVE_ROLL_OFF,
    NVM_SBAND_AFC_EN,
    NVM_SBAND_AFC_RANGE,
    NVM_SBAND_RECEIVE_EN_REED_SOLOMON,
    NVM_SBAND_RECEIVE_EN_CONVOLUTIONAL,
    NVM_SBAND_RECEIVE_EN_RANDOMIZATION,
    NVM_SBAND_RECEIVE_EN_CRC_CHECKSUM,
    NVM_SBAND_RECEIVE_PAYLOAD_SIZE,
    NVM_SBAND_RECEIVE_SATELLITE_ID,
    NVM_SBAND_DECRYPT_KEY,
    NVM_SBAND_DECRYPT_FRAME,
    NVM_SBAND_RECIEVE_CRYPTO_AUTH,
    NVM_UHF_TX_CHAN_NUM,
    NVM_UHF_TX_MOD_TYPE,
    NVM_UHF_TX_SYNC_MODE,
    NVM_UHF_TX_ENABLE_DC_FILTER,
    NVM_UHF_TX_FEC_ENB,
    NVM_UHF_TX_PREAM_NUM,
    NVM_UHF_TX_MANCHESTER_ENB,
    NVM_UHF_TX_RSVD,
    NVM_UHF_TX_BASE_FREQ,
    NVM_UHF_TX_IF_FREQ,
    NVM_UHF_TX_CHAN_SPACING,
    NVM_UHF_TX_FREQ_OFFSET,
    NVM_UHF_TX_DATA_RATE,
    NVM_UHF_TX_CHAN_BW,
    NVM_UHF_TX_FREQ_DEV,
    NVM_UHF_RX_CHAN_NUM,
    NVM_UHF_RX_MOD_TYPE,
    NVM_UHF_RX_SYNC_MOD,
    NVM_UHF_RX_ENB_DC_FILTER,
    NVM_UHF_RX_FEC_ENB,
    NVM_UHF_RX_PREM_NUM,
    NVM_UHF_RX_MANCHESTER_ENB,
    NVM_UHF_RX_ATTENUATION,
    NVM_UHF_RX_BASE_FREQ,
    NVM_UHF_RX_IF_FREQ,
    NVM_UHF_RX_CHAN_SPACING,
    NVM_UHF_RX_FREQ_OFFSET,
    NVM_UHF_RX_DATA_RATE,
    NVM_UHF_RX_CHAN_BW,
    NVM_UHF_RX_FREQ_DEV,
    NVM_UHF_RX_SYNC_TIME_OUT,
    NVM_UHF_PWR_MAX_DVGA_GAIN,
    NVM_UHF_PWR_MAX_LNA_GAIN,
    NVM_UHF_PWR_LNA_SEL,
    NVM_UHF_PWR_FILTER_LEN,
    NVM_UHF_PWR_PWR_TABLE_SEL,
    NVM_UHF_PWR_RF_OUTPUT_PWR,
    NVM_UHF_TX_PKT_DEMOD_SYNC_WORD,
    NVM_UHF_TX_PKT_MAX_PKT_LEN,
    NVM_UHF_TX_PKT_WHITE_ENB,
    NVM_UHF_TX_PKT_FORMAT,
    NVM_UHF_TX_PKT_CRC_ENB,
    NVM_UHF_TX_PKT_LEN_CFG,
    NVM_UHF_TX_PKT_DEV_ADDR,
    NVM_UHF_RX_PKT_DEMOD_SYNC_WORD,
    NVM_UHF_RX_PKT_MAX_PKT_LEN,
    NVM_UHF_RX_PKT_WHITE_ENB,
    NVM_UHF_RX_PKT_FORMAT,
    NVM_UHF_RX_PKT_CRC_ENB,
    NVM_UHF_RX_PKT_LEN_CFG,
    NVM_UHF_RX_PKT_DEV_ADDR,
    NVM_UHF_GS_FIRST_CONTACT,
    NVM_UHF_OTSU_FIRST_CONTACT,
    NVM_UHF_BEACON_TX_TIMEOUT,
    NVM_UHF_BEACON_TX_INTERVAL,
    NVM_UHF_BEACON_MODE_TIMEOUT,
    NVM_UHF_BEACON_PAYLOAD_LEN,
    NVM_UHF_TX_WIN_TIMEOUT,
    NVM_UHF_RX_WIN_TIMEOUT,
    NVM_UHF_LAST_UPTIME,
    NVM_UHF_FW_AES_KEY,
    NVM_SBAND_RX_FREQ,
    NVM_SBAND_RX_TYPE,
    NVM_SBAND_RX_RATE,
    NVM_SBAND_RX_ROLLOFF,
    NVM_SBAND_RX_AFC,
    NVM_SBAND_RX_RS,
    NVM_SBAND_RX_CC,
    NVM_SBAND_RX_RAND,
    NVM_SBAND_RX_CRC,
    NVM_SBAND_RX_SIZE,
    NVM_SBAND_RX_ID,
    NVM_SBAND_RX_RSVD1,
    NVM_SBAND_RX_FRAMES,
    NVM_SBAND_RX_DETECTED,
    NVM_SBAND_RX_RSSI,
    NVM_SBAND_RX_FREQERR,
    NVM_SBAND_RX_SYMERR,
    NVM_SBAND_RX_RSVD2,
    NVM_SBAND_RX_RSVD3,
    NVM_SBAND_RX_RSVD4,
    NVM_SBAND_TX_FREQ,
    NVM_SBAND_TX_TYPE,
    NVM_SBAND_TX_RATE,
    NVM_SBAND_TX_ROLLOFF,
    NVM_SBAND_TX_POUT,
    NVM_SBAND_TX_ALC,
    NVM_SBAND_TX_RS,
    NVM_SBAND_TX_CC,
    NVM_SBAND_TX_RAND,
    NVM_SBAND_TX_CRC,
    NVM_SBAND_TX_IDLETIME,
    NVM_SBAND_TX_SIZE,
    NVM_SBAND_TX_ID,
    NVM_SBAND_TX_RSVD1,
    NVM_SBAND_TMP_LIMIT,
    NVM_SBAND_TX_FRAMES,
    NVM_SBAND_TX_RSVD2,
    NVM_SBAND_TX_RSVD3,
    NVM_SBAND_IP_STAK_ENABLE,
    NVM_SBAND_IQS_DEV_IP,
    NVM_SBAND_IQS_DEV_PORT,
    NVM_SBAND_ETH_PREFIX_RSVD,
    NVM_SBAND_IQS_DEV_IP_TEMP,
    NVM_SBAND_IQS_DEV_PORT_UDP,
    NVM_SBAND_IQS_DEV_IP_UDP,
    NVM_SBAND_NET_PREFIX_RSVD,
    NVM_SBAND_LEOPS_PRD_KEY,
    NVM_SBAND_CONOPS_PRD_KEY,
    NVM_SBAND_RX_GAIN,
    NVM_SBAND_IDX_GAIN,
    NVM_SBAND_PWR_MIN,
    NVM_SBAND_PWR_MAX,
    NVM_SBAND_RX_CHAN_NUM,
    NVM_SBAND_MTU_SIZE,
    NVM_SBAND_PWR_ATTN_LUT,
    NVM_SBAND_TX_ATTN_GAIN,
    NVM_SBAND_FPGA_VER,
    NVM_SBAND_SWAP_VER,
    NVM_SBAND_CPU_VER,
    NVM_SBAND_GS_FIRST_CONTACT,
    NVM_SBAND_OTSU_FIRST_CONTACT,
    NVM_SBAND_BEACON_TX_TIMEOUT,
    NVM_SBAND_TX_WIN_TIMEOUT,
    BOOT_STS,
    NVM_HW_PL_TRANSCELESTIAL,
    NVM_HW_X_BAND,
    NVM_HW_S_BAND,
    NVM_HW_ADCS0,
    NVM_HW_ADCS,
    NVM_HW_PROP_UNIT_THRUSTER,
    NVM_HW_PL_ZES,
    NVM_HW_PL_SAYARLABS,
    NVM_HW_PL_NETRA,
    NVM_HW_EDGE_BRD,
    NVM_HW_OBC_PS_GPS_STD_PL_BRD,
    NVM_HW_HRM,
    NVM_HW_PL_SERVER,
    NVM_HW_GPS,
    NVM_SW_PL_TRANSCELESTIAL,
    NVM_SW_X_BAND,
    NVM_SW_S_BAND,
    NVM_SW_ADCS0,
    NVM_SW_ADCS,
    NVM_SW_PROP_UNIT_THRUSTER,
    NVM_SW_PL_ZES,
    NVM_SW_PL_SAYARLABS,
    NVM_SW_PL_NETRA,
    NVM_SW_EDGE_BRD,
    NVM_SW_OBC_PS_GPS_STD_PL_BRD,
    NVM_SW_HRM,
    NVM_SW_PL_SERVER,
    NVM_SW_GPS,
    NVM_SW_TC_TM,
    NVM_SW_SCH,
    NVM_SW_OTSU,
    NVM_GS_FIRST_CONTACT,
    NVM_GS_OTSU_CONTACT,
    RTC_TIME_DATE_TEMPORARY,
    RTC_TIME_DATE_PERMANENT,
    DBG_CB_IDX,
    DBG_CB_0,
    DBG_CB_1,
    DBG_CB_2,
    DBG_CB_3,
    DBG_CB_4,
    DBG_CB_5,
    DBG_CB_6,
    DBG_CB_7,
    DBG_CB_8,
    DBG_CB_9,
    DBG_CB_10,
    DBG_CB_11,
    DBG_CB_12,
    DBG_CB_13,
    DBG_CB_14,
    DBG_CB_15,
    DBG_CB_16,
    DBG_CB_17,
    DBG_CB_18,
    DBG_CB_19,
    NVM_REBOOT_RSN_BUFF,
    NVM_REBOOT_RSN_IDX,
    NVM_SSD_PL_HEAT_CTRL,
    NVM_SSD_EDGE_HEAT_CTRL,
    NVM_MIN_RBT_TIME,
    NVM_TLE_BUFF,
    NVM_OTSU_GS_SYNC_INT_TIM_CTR,
    NVM_TC_TM_ENCRYP_KEY,
    NVM_EPS_MCU1_FW_SIZE,
    NVM_EPS_MCU1_FW_CHECKSUM,
    NVM_EPS_MCU1_FW_AVAILABLITY,
    NVM_EPS_MCU2_FW_SIZE,
    NVM_EPS_MCU2_FW_CHECKSUM,
    NVM_EPS_MCU2_FW_AVAILABLITY,
	EPS_CHNL_PWR_STE,
	EPS_OP_CHNL_FW_MJR_VERS,
	EPS_OP_CHNL_FW_MNR_VERS,
	EPS_OP_CHNL_FW_PATCH_VERS,
	EPS_CONV_BRD_FW_MJR_VERS,
	EPS_CONV_BRD_FW_MNR_VERS,
	EPS_CONV_BRD_FW_PATCH_VERS,
	NVM_EPS_MCU1_BCKUP_FW_SIZE,
	NVM_EPS_MCU1_BCKUP_FW_CHECKSUM,
	NVM_EPS_MCU1_BCKUP_FW_AVAILABLITY,
	NVM_EPS_MCU2_BCKUP_FW_SIZE,
	NVM_EPS_MCU2_BCKUP_FW_CHECKSUM,
	NVM_EPS_MCU2_BCKUP_FW_AVAILABLITY,
	NVM_EPS_MCU1_SEC_FW_MJR_VERS,
	NVM_EPS_MCU1_SEC_FW_MNR_VERS,
	NVM_EPS_MCU1_SEC_FW_PATCH_VERS,
	NVM_EPS_MCU2_SEC_FW_MJR_VERS,
	NVM_EPS_MCU2_SEC_FW_MNR_VERS,
	NVM_EPS_MCU2_SEC_FW_PATCH_VERS,
	NVM_EPS_MCU1_BCKUP_FW_MJR_VERS,
	NVM_EPS_MCU1_BCKUP_FW_MNR_VERS,
	NVM_EPS_MCU1_BCKUP_FW_PATCH_VERS,
	NVM_EPS_MCU2_BCKUP_FW_MJR_VERS,
	NVM_EPS_MCU2_BCKUP_FW_MNR_VERS,
	NVM_EPS_MCU2_BCKUP_FW_PATCH_VERS,
    NVM_ADCS_FW_STATUS,
    NVM_ADCS_FW_SIZE,
    NVM_ADCS_FW_CRC,
    NVM_ADCS_DEFAULT_INTERFACE,
    NVM_ADCS_AUTO_COMMISIONING,
    NVM_EPS_FTM_FILE_CONTXT_DATA,
    NVM_EPS_FTM_CONTXT_DATA,
    NVM_ADCS_FTM_FILE_CONTXT_DATA,
    NVM_ADCS_FTM_CONTXT_DATA,
    NVM_COMMS_FTM_FILE_CONTXT_DATA,
    NVM_COMMS_FTM_CONTXT_DATA,
    NVM_LOGGER_BACKUP_DATA,
    NVM_LOGGER_BACKUP_CFG,
    NVM_LOGGER_BACKUP_SAVE_THRLD,
    NVM_EDGE_SSD_SLOT_CFG,
    NVM_PS_SSD_SLOT_CFG,
    NVM_PERIODICITY,
    NVM_PS_HEAT_COIL_PRDCTY,
    NVM_EDGE_HEAT_COIL_PRDCTY,
    NVM_LOGGER_LOG_LEVEL_CFG,
    NVM_LOGGER_LOG_LEVEL_CHKSUM,
    NVM_ERR_IO,
    NVM_ERR_AHW_SET_1,
    NVM_ERR_AHW_SET_2,
    NVM_ERR_SYSTEM,
    NVM_ERR_SERVICES,
    NVM_ERR_COMMS,
    NVM_ERR_ADCS_MODULE,
    NVM_ERR_EPS,
    NVM_ERR_RESV_1,
    NVM_ERR_HISTORY_SAVE_CURRENT_INDX_CNTR,
    NVM_ERR_HIS_0,
    NVM_ERR_HIS_1,
    NVM_ERR_HIS_2,
    NVM_ERR_HIS_3,
    NVM_ERR_HIS_4,
    NVM_ERR_HIS_5,
    NVM_ERR_HIS_6,
    NVM_ERR_HIS_7,
    NVM_ERR_HIS_8,
    NVM_ERR_HIS_9,
    NVM_ERR_HIS_10,
    NVM_ERR_HIS_11,
    NVM_ERR_HIS_12,
    NVM_ERR_HIS_13,
    NVM_ERR_HIS_14,
    NVM_ERR_HIS_15,
    NVM_ERR_HIS_16,
    NVM_ERR_HIS_17,
    NVM_ERR_HIS_18,
    NVM_ERR_HIS_19,
    NVM_GPS_LOC_NTFY_PRDCTY,
    NVM_GPS_TLE_NTFY_PRDCTY,
    NVM_GPS_SYNC_TIME_PRDCTY,
    NVM_UHF_FW_SIZE,
    NVM_UHF_FW_CRC,
    SDR_CFG_NUM_SDR,
    SDR_CFG_RADIO_ID_1,
    SDR_CFG_STS_1,
    SDR_CFG_DUPLEX_TYPE_1,
    SDR_CFG_NUM_RX_1,
    SDR_CFG_NUM_TX_1,
    SDR_CFG_COMBINED_RX_SUPPORT_1,
    SDR_CFG_COMBINED_TX_SUPPORT_1,
    SDR_CFG_MIN_FREQUENCY_1,
    SDR_CFG_MAX_FREQUENCY_1,
    SDR_CFG_MIN_FREQUENCY_RX_1,
    SDR_CFG_MAX_FREQUENCY_RX_1,
    SDR_CFG_RESERVED_1,
    SDR_BEACON_NORMAL_ENB_TMR_1,
    SDR_BEACON_NORMAL_PRD_TMR_1,
    SDR_BEACON_NORMAL_REP_TMR_1,
    SDR_BEACON_SAFE_ENB_TMR_1,
    SDR_BEACON_SAFE_PRD_TMR_1,
    SDR_BEACON_SAFE_REP_TMR_1,
    SDR_SAFE_TM_TMR_1,
    SDR_SAFE_TX_ON_TMR_1,
    SDR_SAFE_RX_ON_TMR_1,
    SDR_NORMAL_TM_TMR_1,
    SDR_NORMAL_TX_ON_TMR_1,
    SDR_NORMAL_RX_ON_TMR_1,
    SDR_TX_DATA_REP_CNT_1,
    SDR_RSSI_READ_TMR_1,
    SDR_VALID_RSSI_CNT_1,
    SDR_INV_RSSI_CNT_1,
    SDR_RSSI_MIN_1,
    SDR_RSSI_TYPE_1,
    SDR_RSSI_PRD_TMR_1,
    SDR_RSSI_SHORT_RX_ON_TMR_1,
    SDR_RSSI_LONG_RX_ON_TMR_1,
    SDR_TM_AUTO_READ_STS_1,
    SDR_TM_PERIODICITY_1,
    SDR_TM_SHORT_STORAGE_DURATION_1,
    SDR_TM_LONG_STORAGE_DURATION_1,
    SDR_TEMP_SENS_TYP_THRS_1_1,
    SDR_TEMP_SENS_TYP_THRS_1_2,
    SDR_TEMP_SENS_TYP_THRS_1_3,
    SDR_TEMP_SENS_TYP_THRS_1_4,
    SDR_TEMP_SENS_TYP_THRS_1_5,
    SDR_TEMP_SENS_TYP_THRS_1_6,
    SDR_TEMP_SENS_MIN_THRS_1_1,
    SDR_TEMP_SENS_MIN_THRS_1_2,
    SDR_TEMP_SENS_MIN_THRS_1_3,
    SDR_TEMP_SENS_MIN_THRS_1_4,
    SDR_TEMP_SENS_MIN_THRS_1_5,
    SDR_TEMP_SENS_MIN_THRS_1_6,
    SDR_TEMP_SENS_MAX_THRS_1_1,
    SDR_TEMP_SENS_MAX_THRS_1_2,
    SDR_TEMP_SENS_MAX_THRS_1_3,
    SDR_TEMP_SENS_MAX_THRS_1_4,
    SDR_TEMP_SENS_MAX_THRS_1_5,
    SDR_TEMP_SENS_MAX_THRS_1_6,
    SDR_VOLT_SENS_TYP_THRS_1_1,
    SDR_VOLT_SENS_TYP_THRS_1_2,
    SDR_VOLT_SENS_TYP_THRS_1_3,
    SDR_VOLT_SENS_TYP_THRS_1_4,
    SDR_VOLT_SENS_TYP_THRS_1_5,
    SDR_VOLT_SENS_TYP_THRS_1_6,
    SDR_VOLT_SENS_MIN_THRS_1_1,
    SDR_VOLT_SENS_MIN_THRS_1_2,
    SDR_VOLT_SENS_MIN_THRS_1_3,
    SDR_VOLT_SENS_MIN_THRS_1_4,
    SDR_VOLT_SENS_MIN_THRS_1_5,
    SDR_VOLT_SENS_MIN_THRS_1_6,
    SDR_VOLT_SENS_MAX_THRS_1_1,
    SDR_VOLT_SENS_MAX_THRS_1_2,
    SDR_VOLT_SENS_MAX_THRS_1_3,
    SDR_VOLT_SENS_MAX_THRS_1_4,
    SDR_VOLT_SENS_MAX_THRS_1_5,
    SDR_VOLT_SENS_MAX_THRS_1_6,
    SDR_CUR_SENS_TYP_THRS_1_1,
    SDR_CUR_SENS_TYP_THRS_1_2,
    SDR_CUR_SENS_TYP_THRS_1_3,
    SDR_CUR_SENS_TYP_THRS_1_4,
    SDR_CUR_SENS_TYP_THRS_1_5,
    SDR_CUR_SENS_TYP_THRS_1_6,
    SDR_CUR_SENS_MIN_THRS_1_1,
    SDR_CUR_SENS_MIN_THRS_1_2,
    SDR_CUR_SENS_MIN_THRS_1_3,
    SDR_CUR_SENS_MIN_THRS_1_4,
    SDR_CUR_SENS_MIN_THRS_1_5,
    SDR_CUR_SENS_MIN_THRS_1_6,
    SDR_CUR_SENS_MAX_THRS_1_1,
    SDR_CUR_SENS_MAX_THRS_1_2,
    SDR_CUR_SENS_MAX_THRS_1_3,
    SDR_CUR_SENS_MAX_THRS_1_4,
    SDR_CUR_SENS_MAX_THRS_1_5,
    SDR_CUR_SENS_MAX_THRS_1_6,
    SDR_CFG_RADIO_ID_2,
    SDR_CFG_STS_2,
    SDR_CFG_DUPLEX_TYPE_2,
    SDR_CFG_NUM_RX_2,
    SDR_CFG_NUM_TX_2,
    SDR_CFG_COMBINED_RX_SUPPORT_2,
    SDR_CFG_COMBINED_TX_SUPPORT_2,
    SDR_CFG_MIN_FREQUENCY_2,
    SDR_CFG_MAX_FREQUENCY_2,
    SDR_CFG_MIN_FREQUENCY_RX_2,
    SDR_CFG_MAX_FREQUENCY_RX_2,
    SDR_CFG_RESERVED_2,
    SDR_BEACON_NORMAL_ENB_TMR_2,
    SDR_BEACON_NORMAL_PRD_TMR_2,
    SDR_BEACON_NORMAL_REP_TMR_2,
    SDR_BEACON_SAFE_ENB_TMR_2,
    SDR_BEACON_SAFE_PRD_TMR_2,
    SDR_BEACON_SAFE_REP_TMR_2,
    SDR_SAFE_TM_TMR_2,
    SDR_SAFE_TX_ON_TMR_2,
    SDR_SAFE_RX_ON_TMR_2,
    SDR_NORMAL_TM_TMR_2,
    SDR_NORMAL_TX_ON_TMR_2,
    SDR_NORMAL_RX_ON_TMR_2,
    SDR_TX_DATA_REP_CNT_2,
    SDR_RSSI_READ_TMR_2,
    SDR_VALID_RSSI_CNT_2,
    SDR_INV_RSSI_CNT_2,
    SDR_RSSI_MIN_2,
    SDR_RSSI_TYPE_2,
    SDR_RSSI_PRD_TMR_2,
    SDR_RSSI_SHORT_RX_ON_TMR_2,
    SDR_RSSI_LONG_RX_ON_TMR_2,
    SDR_TM_AUTO_READ_STS_2,
    SDR_TM_PERIODICITY_2,
    SDR_TM_SHORT_STORAGE_DURATION_2,
    SDR_TM_LONG_STORAGE_DURATION_2,
    SDR_TEMP_SENS_TYP_THRS_2_1,
    SDR_TEMP_SENS_TYP_THRS_2_2,
    SDR_TEMP_SENS_TYP_THRS_2_3,
    SDR_TEMP_SENS_TYP_THRS_2_4,
    SDR_TEMP_SENS_TYP_THRS_2_5,
    SDR_TEMP_SENS_TYP_THRS_2_6,
    SDR_TEMP_SENS_MIN_THRS_2_1,
    SDR_TEMP_SENS_MIN_THRS_2_2,
    SDR_TEMP_SENS_MIN_THRS_2_3,
    SDR_TEMP_SENS_MIN_THRS_2_4,
    SDR_TEMP_SENS_MIN_THRS_2_5,
    SDR_TEMP_SENS_MIN_THRS_2_6,
    SDR_TEMP_SENS_MAX_THRS_2_1,
    SDR_TEMP_SENS_MAX_THRS_2_2,
    SDR_TEMP_SENS_MAX_THRS_2_3,
    SDR_TEMP_SENS_MAX_THRS_2_4,
    SDR_TEMP_SENS_MAX_THRS_2_5,
    SDR_TEMP_SENS_MAX_THRS_2_6,
    SDR_VOLT_SENS_TYP_THRS_2_1,
    SDR_VOLT_SENS_TYP_THRS_2_2,
    SDR_VOLT_SENS_TYP_THRS_2_3,
    SDR_VOLT_SENS_TYP_THRS_2_4,
    SDR_VOLT_SENS_TYP_THRS_2_5,
    SDR_VOLT_SENS_TYP_THRS_2_6,
    SDR_VOLT_SENS_MIN_THRS_2_1,
    SDR_VOLT_SENS_MIN_THRS_2_2,
    SDR_VOLT_SENS_MIN_THRS_2_3,
    SDR_VOLT_SENS_MIN_THRS_2_4,
    SDR_VOLT_SENS_MIN_THRS_2_5,
    SDR_VOLT_SENS_MIN_THRS_2_6,
    SDR_VOLT_SENS_MAX_THRS_2_1,
    SDR_VOLT_SENS_MAX_THRS_2_2,
    SDR_VOLT_SENS_MAX_THRS_2_3,
    SDR_VOLT_SENS_MAX_THRS_2_4,
    SDR_VOLT_SENS_MAX_THRS_2_5,
    SDR_VOLT_SENS_MAX_THRS_2_6,
    SDR_CUR_SENS_TYP_THRS_2_1,
    SDR_CUR_SENS_TYP_THRS_2_2,
    SDR_CUR_SENS_TYP_THRS_2_3,
    SDR_CUR_SENS_TYP_THRS_2_4,
    SDR_CUR_SENS_TYP_THRS_2_5,
    SDR_CUR_SENS_TYP_THRS_2_6,
    SDR_CUR_SENS_MIN_THRS_2_1,
    SDR_CUR_SENS_MIN_THRS_2_2,
    SDR_CUR_SENS_MIN_THRS_2_3,
    SDR_CUR_SENS_MIN_THRS_2_4,
    SDR_CUR_SENS_MIN_THRS_2_5,
    SDR_CUR_SENS_MIN_THRS_2_6,
    SDR_CUR_SENS_MAX_THRS_2_1,
    SDR_CUR_SENS_MAX_THRS_2_2,
    SDR_CUR_SENS_MAX_THRS_2_3,
    SDR_CUR_SENS_MAX_THRS_2_4,
    SDR_CUR_SENS_MAX_THRS_2_5,
    SDR_CUR_SENS_MAX_THRS_2_6,
    SDR_CFG_RADIO_ID_3,
    SDR_CFG_STS_3,
    SDR_CFG_DUPLEX_TYPE_3,
    SDR_CFG_NUM_RX_3,
    SDR_CFG_NUM_TX_3,
    SDR_CFG_COMBINED_RX_SUPPORT_3,
    SDR_CFG_COMBINED_TX_SUPPORT_3,
    SDR_CFG_MIN_FREQUENCY_3,
    SDR_CFG_MAX_FREQUENCY_3,
    SDR_CFG_MIN_FREQUENCY_RX_3,
    SDR_CFG_MAX_FREQUENCY_RX_3,
    SDR_CFG_RESERVED_3,
    SDR_BEACON_NORMAL_ENB_TMR_3,
    SDR_BEACON_NORMAL_PRD_TMR_3,
    SDR_BEACON_NORMAL_REP_TMR_3,
    SDR_BEACON_SAFE_ENB_TMR_3,
    SDR_BEACON_SAFE_PRD_TMR_3,
    SDR_BEACON_SAFE_REP_TMR_3,
    SDR_SAFE_TM_TMR_3,
    SDR_SAFE_TX_ON_TMR_3,
    SDR_SAFE_RX_ON_TMR_3,
    SDR_NORMAL_TM_TMR_3,
    SDR_NORMAL_TX_ON_TMR_3,
    SDR_NORMAL_RX_ON_TMR_3,
    SDR_TX_DATA_REP_CNT_3,
    SDR_RSSI_READ_TMR_3,
    SDR_VALID_RSSI_CNT_3,
    SDR_INV_RSSI_CNT_3,
    SDR_RSSI_MIN_3,
    SDR_RSSI_TYPE_3,
    SDR_RSSI_PRD_TMR_3,
    SDR_RSSI_SHORT_RX_ON_TMR_3,
    SDR_RSSI_LONG_RX_ON_TMR_3,
    SDR_TM_AUTO_READ_STS_3,
    SDR_TM_PERIODICITY_3,
    SDR_TM_SHORT_STORAGE_DURATION_3,
    SDR_TM_LONG_STORAGE_DURATION_3,
    SDR_TEMP_SENS_TYP_THRS_3_1,
    SDR_TEMP_SENS_TYP_THRS_3_2,
    SDR_TEMP_SENS_TYP_THRS_3_3,
    SDR_TEMP_SENS_TYP_THRS_3_4,
    SDR_TEMP_SENS_TYP_THRS_3_5,
    SDR_TEMP_SENS_TYP_THRS_3_6,
    SDR_TEMP_SENS_MIN_THRS_3_1,
    SDR_TEMP_SENS_MIN_THRS_3_2,
    SDR_TEMP_SENS_MIN_THRS_3_3,
    SDR_TEMP_SENS_MIN_THRS_3_4,
    SDR_TEMP_SENS_MIN_THRS_3_5,
    SDR_TEMP_SENS_MIN_THRS_3_6,
    SDR_TEMP_SENS_MAX_THRS_3_1,
    SDR_TEMP_SENS_MAX_THRS_3_2,
    SDR_TEMP_SENS_MAX_THRS_3_3,
    SDR_TEMP_SENS_MAX_THRS_3_4,
    SDR_TEMP_SENS_MAX_THRS_3_5,
    SDR_TEMP_SENS_MAX_THRS_3_6,
    SDR_VOLT_SENS_TYP_THRS_3_1,
    SDR_VOLT_SENS_TYP_THRS_3_2,
    SDR_VOLT_SENS_TYP_THRS_3_3,
    SDR_VOLT_SENS_TYP_THRS_3_4,
    SDR_VOLT_SENS_TYP_THRS_3_5,
    SDR_VOLT_SENS_TYP_THRS_3_6,
    SDR_VOLT_SENS_MIN_THRS_3_1,
    SDR_VOLT_SENS_MIN_THRS_3_2,
    SDR_VOLT_SENS_MIN_THRS_3_3,
    SDR_VOLT_SENS_MIN_THRS_3_4,
    SDR_VOLT_SENS_MIN_THRS_3_5,
    SDR_VOLT_SENS_MIN_THRS_3_6,
    SDR_VOLT_SENS_MAX_THRS_3_1,
    SDR_VOLT_SENS_MAX_THRS_3_2,
    SDR_VOLT_SENS_MAX_THRS_3_3,
    SDR_VOLT_SENS_MAX_THRS_3_4,
    SDR_VOLT_SENS_MAX_THRS_3_5,
    SDR_VOLT_SENS_MAX_THRS_3_6,
    SDR_CUR_SENS_TYP_THRS_3_1,
    SDR_CUR_SENS_TYP_THRS_3_2,
    SDR_CUR_SENS_TYP_THRS_3_3,
    SDR_CUR_SENS_TYP_THRS_3_4,
    SDR_CUR_SENS_TYP_THRS_3_5,
    SDR_CUR_SENS_TYP_THRS_3_6,
    SDR_CUR_SENS_MIN_THRS_3_1,
    SDR_CUR_SENS_MIN_THRS_3_2,
    SDR_CUR_SENS_MIN_THRS_3_3,
    SDR_CUR_SENS_MIN_THRS_3_4,
    SDR_CUR_SENS_MIN_THRS_3_5,
    SDR_CUR_SENS_MIN_THRS_3_6,
    SDR_CUR_SENS_MAX_THRS_3_1,
    SDR_CUR_SENS_MAX_THRS_3_2,
    SDR_CUR_SENS_MAX_THRS_3_3,
    SDR_CUR_SENS_MAX_THRS_3_4,
    SDR_CUR_SENS_MAX_THRS_3_5,
    SDR_CUR_SENS_MAX_THRS_3_6,
    SDR_CFG_RADIO_ID_4,
    SDR_CFG_STS_4,
    SDR_CFG_DUPLEX_TYPE_4,
    SDR_CFG_NUM_RX_4,
    SDR_CFG_NUM_TX_4,
    SDR_CFG_COMBINED_RX_SUPPORT_4,
    SDR_CFG_COMBINED_TX_SUPPORT_4,
    SDR_CFG_MIN_FREQUENCY_4,
    SDR_CFG_MAX_FREQUENCY_4,
    SDR_CFG_MIN_FREQUENCY_RX_4,
    SDR_CFG_MAX_FREQUENCY_RX_4,
    SDR_CFG_RESERVED_4,
    SDR_BEACON_NORMAL_ENB_TMR_4,
    SDR_BEACON_NORMAL_PRD_TMR_4,
    SDR_BEACON_NORMAL_REP_TMR_4,
    SDR_BEACON_SAFE_ENB_TMR_4,
    SDR_BEACON_SAFE_PRD_TMR_4,
    SDR_BEACON_SAFE_REP_TMR_4,
    SDR_SAFE_TM_TMR_4,
    SDR_SAFE_TX_ON_TMR_4,
    SDR_SAFE_RX_ON_TMR_4,
    SDR_NORMAL_TM_TMR_4,
    SDR_NORMAL_TX_ON_TMR_4,
    SDR_NORMAL_RX_ON_TMR_4,
    SDR_TX_DATA_REP_CNT_4,
    SDR_RSSI_READ_TMR_4,
    SDR_VALID_RSSI_CNT_4,
    SDR_INV_RSSI_CNT_4,
    SDR_RSSI_MIN_4,
    SDR_RSSI_TYPE_4,
    SDR_RSSI_PRD_TMR_4,
    SDR_RSSI_SHORT_RX_ON_TMR_4,
    SDR_RSSI_LONG_RX_ON_TMR_4,
    SDR_TM_AUTO_READ_STS_4,
    SDR_TM_PERIODICITY_4,
    SDR_TM_SHORT_STORAGE_DURATION_4,
    SDR_TM_LONG_STORAGE_DURATION_4,
    SDR_TEMP_SENS_TYP_THRS_4_1,
    SDR_TEMP_SENS_TYP_THRS_4_2,
    SDR_TEMP_SENS_TYP_THRS_4_3,
    SDR_TEMP_SENS_TYP_THRS_4_4,
    SDR_TEMP_SENS_TYP_THRS_4_5,
    SDR_TEMP_SENS_TYP_THRS_4_6,
    SDR_TEMP_SENS_MIN_THRS_4_1,
    SDR_TEMP_SENS_MIN_THRS_4_2,
    SDR_TEMP_SENS_MIN_THRS_4_3,
    SDR_TEMP_SENS_MIN_THRS_4_4,
    SDR_TEMP_SENS_MIN_THRS_4_5,
    SDR_TEMP_SENS_MIN_THRS_4_6,
    SDR_TEMP_SENS_MAX_THRS_4_1,
    SDR_TEMP_SENS_MAX_THRS_4_2,
    SDR_TEMP_SENS_MAX_THRS_4_3,
    SDR_TEMP_SENS_MAX_THRS_4_4,
    SDR_TEMP_SENS_MAX_THRS_4_5,
    SDR_TEMP_SENS_MAX_THRS_4_6,
    SDR_VOLT_SENS_TYP_THRS_4_1,
    SDR_VOLT_SENS_TYP_THRS_4_2,
    SDR_VOLT_SENS_TYP_THRS_4_3,
    SDR_VOLT_SENS_TYP_THRS_4_4,
    SDR_VOLT_SENS_TYP_THRS_4_5,
    SDR_VOLT_SENS_TYP_THRS_4_6,
    SDR_VOLT_SENS_MIN_THRS_4_1,
    SDR_VOLT_SENS_MIN_THRS_4_2,
    SDR_VOLT_SENS_MIN_THRS_4_3,
    SDR_VOLT_SENS_MIN_THRS_4_4,
    SDR_VOLT_SENS_MIN_THRS_4_5,
    SDR_VOLT_SENS_MIN_THRS_4_6,
    SDR_VOLT_SENS_MAX_THRS_4_1,
    SDR_VOLT_SENS_MAX_THRS_4_2,
    SDR_VOLT_SENS_MAX_THRS_4_3,
    SDR_VOLT_SENS_MAX_THRS_4_4,
    SDR_VOLT_SENS_MAX_THRS_4_5,
    SDR_VOLT_SENS_MAX_THRS_4_6,
    SDR_CUR_SENS_TYP_THRS_4_1,
    SDR_CUR_SENS_TYP_THRS_4_2,
    SDR_CUR_SENS_TYP_THRS_4_3,
    SDR_CUR_SENS_TYP_THRS_4_4,
    SDR_CUR_SENS_TYP_THRS_4_5,
    SDR_CUR_SENS_TYP_THRS_4_6,
    SDR_CUR_SENS_MIN_THRS_4_1,
    SDR_CUR_SENS_MIN_THRS_4_2,
    SDR_CUR_SENS_MIN_THRS_4_3,
    SDR_CUR_SENS_MIN_THRS_4_4,
    SDR_CUR_SENS_MIN_THRS_4_5,
    SDR_CUR_SENS_MIN_THRS_4_6,
    SDR_CUR_SENS_MAX_THRS_4_1,
    SDR_CUR_SENS_MAX_THRS_4_2,
    SDR_CUR_SENS_MAX_THRS_4_3,
    SDR_CUR_SENS_MAX_THRS_4_4,
    SDR_CUR_SENS_MAX_THRS_4_5,
    SDR_CUR_SENS_MAX_THRS_4_6,
    RSVD_BIT_1,
    RSVD_BIT_2,
    RSVD_BIT_3,
    RSVD_BIT_4,
    RSVD_BIT_5,
    RSVD_BIT_6,
    RSVD_BIT_7,
    RSVD_BIT_8,
    RSVD_BIT_9,
    RSVD_BIT_10,
    RSVD_BIT_11,
    RSVD_BIT_12,
    RSVD_BIT_13,
    RSVD_BIT_14,
    RSVD_BIT_15,
    RSVD_BIT_16,
    RSVD_BIT_17,
    RSVD_BIT_18,
    RSVD_BIT_19,
    RSVD_BIT_20,
    RSVD_BIT_21,
    RSVD_BIT_22,
    RSVD_BIT_23,
    RSVD_BIT_24,
    RSVD_BIT_25,
    RSVD_BIT_26,
    RSVD_BIT_27,
    RSVD_BIT_28,
    RSVD_BIT_29,
    RSVD_BIT_30,
    RSVD_BIT_31,
    RSVD_BIT_32,
    RSVD_BIT_33,
    RSVD_BIT_34,
    RSVD_BIT_35,
    RSVD_BIT_36,
    RSVD_BIT_37,
    RSVD_BIT_38,
    RSVD_BIT_39,
    RSVD_BIT_40,
    RSVD_BIT_41,
    RSVD_BIT_42,
    RSVD_BIT_43,
    RSVD_BIT_44,
    RSVD_BIT_45,
    RSVD_BIT_46,
    RSVD_BIT_47,
    RSVD_BIT_48,
    RSVD_BIT_49,
    RSVD_BIT_50,
    RSVD_BIT_51,
    RSVD_BIT_52,
    RSVD_BIT_53,
    RSVD_BIT_54,
    RSVD_BIT_55,
    RSVD_BIT_56,
    RSVD_BIT_57,
    RSVD_BIT_58,
    RSVD_BIT_59,
    RSVD_BIT_60,
    RSVD_BIT_61,
    RSVD_BIT_62,
    RSVD_BIT_63,
    RSVD_BIT_64,
    RSVD_BIT_65,
    RSVD_BIT_66,
    RSVD_BIT_67,
    RSVD_BIT_68,
    RSVD_BIT_69,
    RSVD_BIT_70,
    RSVD_BIT_71,
    RSVD_BIT_72,
    RSVD_BIT_73,
    RSVD_BIT_74,
    RSVD_BIT_75,
    RSVD_BIT_76,
    RSVD_BIT_77,
    RSVD_BIT_78,
    RSVD_BIT_79,
    RSVD_BIT_80,
    RSVD_BIT_81,
    RSVD_BIT_82,
    RSVD_BIT_83,
    RSVD_BIT_84,
    RSVD_BIT_85,
    RSVD_BIT_86,
    RSVD_BIT_87,
    RSVD_BIT_88,
    RSVD_BIT_89,
    RSVD_BIT_90,
    RSVD_BIT_91,
    RSVD_BIT_92,
    RSVD_BIT_93,
    RSVD_BIT_94,
    RSVD_BIT_95,
    RSVD_BIT_96,
    RSVD_BIT_97,
    RSVD_BIT_98,
    RSVD_BIT_99,
    RSVD_BIT_100,
    NVM_MAGIC_NUM,
    NVM_DUMMY_BYTES,
    NVM_CHECKSUM,
    NVM_MAX_PARM,

}nvm_param_id;

/**
 * @brief NVM read only parameter ID enumeration
 */
typedef enum
{

    NVM_RD_MAGIC_NUM=NVM_MAX_PARM,
    NVM_RD_MAX_PARM,

}nvm_rd_only_id;


/**
 * @brief NVM storage location ID enumeration
 */
typedef enum
{

    NVM_FW_UPDATE_LOC_A,
    NVM_FW_UPDATE_LOC_B,
    NVM_FW_UPDATE_LOC_C,
    NVM_FW_UPDATE_LOC_D,
    NVM_STORAGE_BANK1,
    NVM_STORAGE_BANK2,
    NVM_STORAGE_RAM
}nvm_mem_storage_id;




/**
 * @brief NVM firmware update states ID enumeration
 */
typedef enum
{

    NVM_FW_UPDATE_TRIGGER,
    NVM_FW_UPDATE_PASS,
    NVM_FW_UPDATE_FAIL,
    NVM_FW_UPDATE_UNDEF
}nvm_fw_upd_states_def;


/**
 * @brief nvm firmware info
 */
typedef struct nvm_firmware_info_type
{
	uint32_t size;				    ///< nvm bin size
	uint8_t version_number_major;	///< nvm version major
	uint8_t version_number_minor;	///< nvm version minor
}nvm_firmware_info_def;

/**
 * @brief API to initialize the NVM
 *
 * @retval uint8_t - returns the success or error code
 */


uint8_t* nvm_get_nvm_framework_bank_address(nvm_mem_storage_id bank_id);
void nvm_fw_update(nvm_fw_upd_states_def nvm_fw_state);
void nvm_fw_download_in_c(uint8_t *ftm_mem_buf, uint32_t size, uint32_t checksum);
uint8_t* nvm_get_nvm_fwupd_memory_partition_address(nvm_mem_storage_id id);

uint8_t nvm_init(void);

/**
 * @brief API to initialize the NVM partition
 *
 * @param[in]  nvm_partition_type - NVM partition type ID
 * @param[in]  buffer_len - buffer length in bytes
 * @param[out] nvm_vrsn - NVM version
 *
 * @retval uint8_t - returns the success or error code
 */
uint8_t NVM_data_init(nvm_partition_type partition, uint16_t buffer_len, uint8_t* nvm_vrsn);

/**
 * @brief API to calculate the checksum and store the NVM data in the respected flash partitions
 *
 * @return returns the success or error code
 *
 * @retval
 * NVM_ERROR - checksum success
 * INVALID_PARTITION - checksum error
 */
int8_t nvm_commit();

/**
 * @brief API to generate byte array for the given parameter ID
 *
 * @param[in]  ID - NVM parameter ID
 */
void nvm_gen_byte_array(uint16_t ID);

/**
 * @brief API to write the data in NVM partition with the specified parameter ID
 *
 * @param[in]  partition_type - NVM partition type ID
 * @param[in]  ID - NVM parameter ID
 * @param[in]  data - Pointer to the data
 *
 * @retval int8_t - returns the success or error code
 */
int8_t nvm_parameter_write(uint8_t partition_type,uint16_t ID, uint8_t *data);

/**
 * @brief API to read the data in NVM partition with the specified parameter ID
 *
 * @param[in]  partition_type - NVM partition type ID
 * @param[in]  ID - NVM parameter ID
 * @param[out] data - Pointer to the data
 *
 * @retval int8_t - returns the success or error code
 */
int8_t nvm_parameter_read(uint8_t partition_type,uint16_t ID, uint8_t *data);

/**
 * @brief API to write the NVM data in the specified flash partition
 *
 * @param[in]  nvm_buffer - Pointer to the NVM memory in the RAM
 * @param[in]  buffer_len - length in bytes of NVM memory
 * @param[out] partition - NVM partition type ID
 *
 * @retval int8_t - returns the success or error code
 */
int8_t nvm_data_write_flash(uint32_t flash_addr, uint8_t *nvm_buffer,uint16_t buffer_len);

/**
 * @brief API to replace the invalid NVM partition with valid NVM partition
 *
 * @param[in] valid_partition - valid partition ID
 * @param[in] invalid_partition - Invalid partition ID
 * @param[out] nvm_buffer - Pointer to the NVM data
 * @param[in] buffer_len - length of NVM data in byte
 *
 */
uint8_t replace_failed_partition(nvm_partition_type valid_partition, nvm_partition_type invalid_partition, uint8_t *nvm_buffer,uint16_t buffer_len);
uint8_t nvm_commit_periodicity_update(uint32_t time_sec);
uint8_t nvm_get_nvm_bin_info(uint8_t *nvm_buff_ptr, nvm_firmware_info_def *info);
void    nvm_load_defaults(uint8_t *buff);

#endif
