2020-09-04 22:55:34 +02:00
/* Reflow Oven Controller
*
* Copyright ( C ) 2020 Mario Hüttel < mario . huettel @ gmx . net >
*
* This file is part of the Reflow Oven Controller Project .
*
* The reflow oven controller is free software : you can redistribute it and / or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation .
*
* The Reflow Oven Control Firmware is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
* along with the reflow oven controller project .
* If not , see < http : //www.gnu.org/licenses/>.
*/
2020-09-04 23:02:23 +02:00
# ifndef __SAFETY_MEMORY_H__
# define __SAFETY_MEMORY_H__
2020-09-04 22:55:34 +02:00
# include <stdint.h>
/**
2020-09-04 23:02:23 +02:00
* @ brief Magic number to signal a valid safety memory header .
2020-09-04 22:55:34 +02:00
*/
2020-09-04 23:02:23 +02:00
# define SAFETY_MEMORY_MAGIC 0x12AA5CB7
2020-09-04 22:55:34 +02:00
/**
2020-09-04 23:02:23 +02:00
* @ brief Offset address for the safety_memory_header .
* @ note Any other value than 0UL doesn ' t really make sense . Therfore , this should not be changed .
2020-09-04 22:55:34 +02:00
*/
2020-09-04 23:02:23 +02:00
# define SAFETY_MEMORY_HEADER_ADDRESS 0UL
2020-09-04 22:55:34 +02:00
/**
2020-09-04 23:02:23 +02:00
* @ brief Safety memory header
2020-09-04 22:55:34 +02:00
*/
2020-09-04 23:02:23 +02:00
struct safety_memory_header {
uint32_t magic ; /**< @brief Magic. Set to @ref SAFETY_MEMORY_MAGIC */
uint32_t boot_status_offset ; /**< @brief Offset of the safety_memory_boot_status struct (in 32 bit words)*/
uint32_t err_memory_offset ; /**< @brief Offset of the error memory */
uint32_t err_memory_end ; /**< @brief End of the error memory. This points to the word after the error memory, containing the CRC of the whole backup RAM. */
uint32_t magic_i ; /**< @brief Invers Magic. Set to the bitwise inverse of @ref SAFETY_MEMORY_MAGIC */
} ;
2020-09-04 22:55:34 +02:00
2020-09-04 23:02:23 +02:00
struct safety_memory_boot_status {
uint32_t reboot_to_bootloader ;
uint32_t code_updated ;
} ;
# endif /* __SAFETY_MEMORY_H__ */