90 lines
2.8 KiB
C
90 lines
2.8 KiB
C
//
|
|
// Created by CFIF on 20.10.25.
|
|
//
|
|
|
|
#ifndef HVAC_DEVICEDATANONVOLATILE_H
|
|
#define HVAC_DEVICEDATANONVOLATILE_H
|
|
|
|
#include <VariablesTable.h>
|
|
#include "DataRuntime.h"
|
|
|
|
#define DEVICE_DATA_NO_VOLATILE_VERSION 0x01
|
|
|
|
// BCD в двоичное число
|
|
#define bcd_to_binary(bcd) (((bcd >> 4) * 10) + (bcd & 0x0F))
|
|
|
|
// Двоичное число в BCD
|
|
#define binary_to_bcd(binary) (((binary / 10) << 4) | (binary % 10))
|
|
|
|
#pragma scalar_storage_order big-endian
|
|
typedef struct __attribute__ ((packed)) {
|
|
uint8_t year; // BCD: 0x18 = 2018 год
|
|
uint8_t month; // BCD: 0x10 = октябрь
|
|
uint8_t day; // BCD: 0x16 = 16 число
|
|
char tester_serial[9]; // ASCII: "123456789"
|
|
} reverse_tester_info_t;
|
|
#pragma scalar_storage_order little-endian
|
|
|
|
#pragma scalar_storage_order big-endian
|
|
typedef struct __attribute__ ((packed)) {
|
|
uint32_t software_crc; // CRC программного обеспечения
|
|
uint16_t major_version; // Старшая версия
|
|
uint16_t minor_version; // Младшая версия
|
|
uint16_t patch_version; // Патч-версия
|
|
uint8_t build_number; // Номер сборки
|
|
uint8_t checksum; // Контрольная сумма структуры
|
|
} reverse_app_boot_info_t;
|
|
#pragma scalar_storage_order little-endian
|
|
|
|
typedef struct __attribute__ ((packed)) {
|
|
uint8_t year; // BCD: 0x18 = 2018 год
|
|
uint8_t month; // BCD: 0x10 = октябрь
|
|
uint8_t day; // BCD: 0x16 = 16 число
|
|
tString16 tester_serial; // ASCII: "123456789"
|
|
} tester_info_t;
|
|
|
|
typedef struct __attribute__ ((packed)) {
|
|
uint32_t software_crc; // CRC программного обеспечения
|
|
uint16_t major_version; // Старшая версия
|
|
uint16_t minor_version; // Младшая версия
|
|
uint16_t patch_version; // Патч-версия
|
|
uint8_t build_number; // Номер сборки
|
|
uint8_t checksum; // Контрольная сумма структуры
|
|
} app_boot_info_t;
|
|
|
|
typedef struct {
|
|
tString16 software_classification;
|
|
tester_info_t tester_fingerprint;
|
|
app_boot_info_t bootloader_info;
|
|
app_boot_info_t application_info;
|
|
tString32 spare_part_number;
|
|
tString32 serial_number;
|
|
tString32 vin;
|
|
tString32 hardware_nami;
|
|
tString16 hardware_estra;
|
|
tString8 software_estra;
|
|
tString8 boot_version;
|
|
} ecu_identification_t;
|
|
|
|
typedef struct {
|
|
ecu_identification_t identification;
|
|
} tDeviceSettings;
|
|
|
|
|
|
typedef struct {
|
|
uint32_t version;
|
|
|
|
tDeviceSettings device;
|
|
|
|
} tDeviceDataNonVolatile;
|
|
|
|
void DeviceDataNonVolatile_InitDefaults(tDeviceDataNonVolatile *env);
|
|
|
|
void DeviceDataNonVolatile_AddToVarTab(
|
|
tDeviceDataNonVolatile *env,
|
|
tVariablesTable *variablesTable,
|
|
uint32_t VARIABLES_GROUP
|
|
);
|
|
|
|
#endif //HVAC_DEVICEDATANONVOLATILE_H
|