sys_api.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * sys_api.h
  3. *
  4. * Created on: 12.03.2017
  5. * Author: jesstr
  6. */
  7. #ifndef SYS_API_H_
  8. #define SYS_API_H_
  9. #include <stdbool.h>
  10. #include <stdint.h>
  11. #ifndef DEVICE_MAC
  12. #define DEVICE_MAC "EC-4C-4D-00-90-01"
  13. #endif
  14. #ifndef DEVICE_SERIAL
  15. #define DEVICE_SERIAL "7030000"
  16. #endif
  17. #define SYS_MAC DEVICE_MAC
  18. #define SYS_SERIAL DEVICE_SERIAL
  19. #define SYS_CUSTOMER "Rotek"
  20. #define MAC_LEN 18
  21. #define SER_LEN 16
  22. #define CUST_LEN 16
  23. #define PROD_LEN 20
  24. // Cтруктура системных настроек
  25. typedef struct
  26. {
  27. char mac[MAC_LEN]; // MAC адрес
  28. char serial[SER_LEN]; // Серийный номер
  29. char customer[CUST_LEN]; // Производитель
  30. char proddate[PROD_LEN]; // Дата производства
  31. char testState[16]; // Статус тестирования
  32. uint32_t controlword; // Контрольное слово
  33. uint32_t crc; // CRC
  34. } SYS_t;
  35. bool SYS_BackupInfo(char *mac, char *serial);
  36. bool SYS_RestoreInfo(SYS_t *settings);
  37. //
  38. uint32_t SYS_GetCRC(SYS_t *settings);
  39. // Загрузка структуры системных настроек из flash
  40. bool SYS_Load(SYS_t *settings);
  41. // Запись структуры настроек во flash
  42. bool SYS_Save(SYS_t *settings);
  43. //
  44. void SYS_Print(SYS_t *settings);
  45. #endif /* SYS_API_H_ */