Subversion Repositories DashDisplay

Rev

Rev 79 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. /*
  2.  * nvram.h
  3.  *
  4.  *  Created on: 4 Jun 2017
  5.  *      Author: Mike
  6.  */
  7. #if defined SEMIHOSTING
  8. #include <stdio.h>
  9. extern void initialise_monitor_handles(void);
  10. #endif
  11.  
  12. #include "libPLX/plx.h"
  13.  
  14. #pragma once
  15.  
  16.  
  17. #if defined __cplusplus
  18. extern "C"
  19. {
  20. #endif
  21. #pragma pack(push, 1)
  22.  
  23.     ///\brief State of currently displayed item
  24.     /// this is expected to be packed into 32 bits
  25.     typedef union
  26.     {
  27.         struct
  28.         {
  29.             unsigned tag : 8; // dial tag
  30.             unsigned : 16;  // filler
  31.             int pos:  8;   // dial position code
  32.         } data;
  33.         uint32_t u32;
  34.     } nvram_info_t;
  35. #pragma pack(pop)
  36.  
  37. // Allocation of NVRAM words : there are 4k bytes
  38. #define NVRAM_WORDS (4096 / sizeof(nvram_info_t))
  39.  
  40.     /// @brief Erase every NVRAM entry
  41.     extern void erase_nvram();
  42.    
  43.     /// @brief Save data, replacing any with a matching tag field.
  44.     /// @param data data item to write
  45.     extern void write_nvram_data(nvram_info_t data);
  46.  
  47.     //
  48.     /// @brief Find data according to the tag field/
  49.     /// @param tag tag code to find
  50.     /// @return a pointer to the nvram data with matching tag or NULL if not found
  51.     extern nvram_info_t *find_nvram_data(uint8_t tag);
  52.  
  53. #if defined __cplusplus
  54. }
  55. #endif
  56.