
/*
 * nvram.h
 *
 *  Created on: 4 Jun 2017
 *      Author: Mike
 */
#include "libPLX/plx.h"

#pragma once


#if defined __cplusplus
extern "C"
{
#endif
#pragma pack(push, 1)

    ///\brief State of item
    /// this is expected to be packed into 32 bits 
    typedef union
    {
        struct
        {
            unsigned tag : 8;
            int val : 8;
        } data;
        uint16_t u16;
    } nvram_info_t;
#pragma pack(pop)


    // Save data according to its tag field
    extern void write_nvram_data(nvram_info_t data);

    // find data according to the tag field or return null if no info
    extern nvram_info_t *find_nvram_data(uint8_t tag);

#if defined __cplusplus
}
#endif
