Rev 66 | Rev 79 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
66 | mjames | 1 | /* |
2 | * nvram.h |
||
3 | * |
||
4 | * Created on: 4 Jun 2017 |
||
5 | * Author: Mike |
||
6 | */ |
||
7 | #include "libPLX/plx.h" |
||
8 | |||
9 | #pragma once |
||
10 | |||
11 | |||
12 | #if defined __cplusplus |
||
13 | extern "C" |
||
14 | { |
||
15 | #endif |
||
16 | #pragma pack(push, 1) |
||
17 | |||
18 | ///\brief State of currently displayed item |
||
19 | /// this is expected to be packed into 32 bits |
||
20 | typedef union |
||
21 | { |
||
22 | struct |
||
23 | { |
||
24 | unsigned tag : 8; |
||
25 | unsigned : 8; |
||
26 | enum PLX_Observations observation : 8; |
||
27 | int instance : 8; |
||
28 | } data; |
||
29 | uint32_t u32; |
||
30 | } nvram_info_t; |
||
31 | #pragma pack(pop) |
||
32 | |||
33 | // Allocation of NVRAM words : there are 4k bytes |
||
34 | #define NVRAM_WORDS (4096 / sizeof(nvram_info_t)) |
||
35 | |||
70 | mjames | 36 | /// @brief Erase every NVRAM entry |
37 | extern void erase_nvram(); |
||
38 | |||
39 | /// @brief Save data, replacing any with a matching tag field. |
||
40 | /// @param data data item to write |
||
66 | mjames | 41 | extern void write_nvram_data(nvram_info_t data); |
42 | |||
70 | mjames | 43 | // |
44 | /// @brief Find data according to the tag field/ |
||
45 | /// @param tag tag code to find |
||
46 | /// @return a pointer to the nvram data with matching tag or NULL if not found |
||
66 | mjames | 47 | extern nvram_info_t *find_nvram_data(uint8_t tag); |
48 | |||
49 | #if defined __cplusplus |
||
50 | } |
||
51 | #endif |