avr-fw-modules/core/include/hwo/platform.h

66 lines
1.1 KiB
C
Executable File

#pragma once
#include <hwo/chksum.h>
/*****
platform.h Platform Definition für AVR8 / Bootloader / Externe EEPROMS
*****/
#define ENTITY_NULL 0x0000 // Kein Inhalt, Füller
#define ENTITY_FIRMWARE 0x0001 // Firmware Image
#define ENTITY_USER 0x8000 // Erster Type für Anwendungstypen
struct platform_entity
{
uint16_t type;
uint32_t size;
avrChksum chksum;
};
struct platform_eeprom_header
{
uint8_t magic[4]; // Magic bytes [ 0x43, 0x52, 0x65, 0xD2 ]
struct
{
uint8_t version_low;
uint8_t version_high;
uint8_t board_id_low;
uint8_t board_id_high;
uint16_t board_revision;
} bootloader;
struct
{
uint8_t version_low;
uint8_t version_high;
uint16_t build;
uint16_t size;
avrChksum chksum;
} firmware;
struct
{
uint32_t update_req:1; // Request Bootloader for Firmware Update
uint32_t update_ack:1; // Bootloader has Updated Firmware successfull
uint32_t update_err_chksum:1; // Bootloader denied update due to chksum error
uint32_t update_err_license:1; // Bootloader denied update due to license error
uint32_t reserve:28;
} flags;
};