12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- /*
- * sys_api.h
- *
- * Created on: 12.03.2017
- * Author: jesstr
- */
- #ifndef SYS_API_H_
- #define SYS_API_H_
- #include <stdbool.h>
- #include <stdint.h>
- #ifndef DEVICE_MAC
- #define DEVICE_MAC "EC-4C-4D-00-90-01"
- #endif
- #ifndef DEVICE_SERIAL
- #define DEVICE_SERIAL "7030000"
- #endif
- #define SYS_MAC DEVICE_MAC
- #define SYS_SERIAL DEVICE_SERIAL
- #define SYS_CUSTOMER "Rotek"
- #define MAC_LEN 18
- #define SER_LEN 16
- #define CUST_LEN 16
- #define PROD_LEN 20
- // Cтруктура системных настроек
- typedef struct
- {
- char mac[MAC_LEN]; // MAC адрес
- char serial[SER_LEN]; // Серийный номер
- char customer[CUST_LEN]; // Производитель
- char proddate[PROD_LEN]; // Дата производства
- char testState[16]; // Статус тестирования
- uint32_t controlword; // Контрольное слово
- uint32_t crc; // CRC
- } SYS_t;
- bool SYS_BackupInfo(char *mac, char *serial);
- bool SYS_RestoreInfo(SYS_t *settings);
- //
- uint32_t SYS_GetCRC(SYS_t *settings);
- // Загрузка структуры системных настроек из flash
- bool SYS_Load(SYS_t *settings);
- // Запись структуры настроек во flash
- bool SYS_Save(SYS_t *settings);
- //
- void SYS_Print(SYS_t *settings);
- #endif /* SYS_API_H_ */
|