Rev 56 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 56 | Rev 64 | ||
---|---|---|---|
Line 2... | Line 2... | ||
2 | * nvram.h |
2 | * nvram.h |
3 | * |
3 | * |
4 | * Created on: 4 Jun 2017 |
4 | * Created on: 4 Jun 2017 |
5 | * Author: Mike |
5 | * Author: Mike |
6 | */ |
6 | */ |
- | 7 | #include "libPLX/plx.h" |
|
7 | 8 | ||
8 | #pragma once |
9 | #pragma once |
9 | 10 | ||
- | 11 | ||
10 | #if defined __cplusplus |
12 | #if defined __cplusplus |
11 | extern "C" { |
13 | extern "C" |
- | 14 | { |
|
12 | #endif |
15 | #endif |
- | 16 | #pragma pack(push, 1) |
|
- | 17 | ///\brief State of currently displayed item |
|
- | 18 | typedef union |
|
- | 19 | { |
|
- | 20 | struct |
|
- | 21 | { |
|
- | 22 | unsigned tag : 8; |
|
- | 23 | unsigned : 8; |
|
- | 24 | enum PLX_Observations observation : 8; |
|
- | 25 | int instance : 8; |
|
- | 26 | } data; |
|
- | 27 | uint32_t u32; |
|
- | 28 | } nvram_info_t; |
|
- | 29 | #pragma pack(pop) |
|
- | 30 | ||
- | 31 | // Allocation of NVRAM words : there are 4k bytes |
|
- | 32 | #define NVRAM_WORDS (4096 / sizeof(nvram_info_t)) |
|
13 | 33 | ||
14 | extern void WriteUint16NVRAM(uint32_t Address, uint16_t data); |
- | |
15 | // define a pointer to be set up by the linker, pointing at the NVRAM base address used for data |
- | |
16 | 34 | ||
- | 35 | // Save data according to its tag field |
|
17 | extern void WriteUint32NVRAM(uint32_t Address, uint32_t data); |
36 | extern void write_nvram_data(nvram_info_t data); |
18 | 37 | ||
- | 38 | // find data according to the tag field or return null if no info, |
|
19 | #define NVRAM_BASE (uint8_t *)(&NVRAM_Base[0]) |
39 | extern nvram_info_t *find_nvram_data(uint8_t tag); |
20 | 40 | ||
21 | #if defined __cplusplus |
41 | #if defined __cplusplus |
22 | } |
42 | } |
23 | #endif |
43 | #endif |