![]() |
AVR SD Safety Framework 1.0.0
|
Example main file for demonstrating usage of the Framework Task Managers. More...
#include <stdbool.h>#include <stdlib.h>#include <define_memory_sections.h>#include <main_example.h>#include <task_manager_interrupts.h>#include <task_manager_pre_startup.h>#include <task_manager_scheduler.h>#include <task_manager_shutdown.h>#include <task_manager_startup.h>#include <tasks_config.h>#include <avr/interrupt.h>#include <xc.h>Functions | |
| void | PreMain (void) |
| Runs the Pre-startup Task Manager before entering Main. | |
| int | main (void) |
| Runs the Startup, Scheduler and optionally Shutdown Task Managers. | |
| ISR_BADISR_vect () | |
| Runs the Interrupts Task Manager to handle interrupt requests without a dedicated ISR. | |
| ISR_NMI_vect () | |
| Runs the Interrupts Task Manager to handle a Non-maskable Interrupt (NMI). | |
| ISR_BOD_VLM_vect () | |
| Runs the Interrupts Task Manager to handle a Brown-out Detector (BOD) interrupt. | |
| ISR_ERRCTRL_INT_vect () | |
| Runs the Interrupts Task Manager to handle a Error Controller (ERRCTRL) channel interrupt. | |
| ISR_CLKCTRL_INT_vect () | |
| Runs the Interrupts Task Manager to handle a Clock Controller (CLKCTRL) interrupt. | |
| ISR_SLPCTRL_INT_vect () | |
| Runs the Interrupts Task Manager to handle a Sleep Controller (SLPCTRL) interrupt. | |
| ISR_SWDT_INT_vect () | |
| Runs the Interrupts Task Manager to handle a Synchronous Watchdog Timer (SWDT) interrupt. | |
| ISR_NVMCTRL_ERROR_vect () | |
| Runs the Interrupts Task Manager to handle a NVM Controller (NVMCTRL) error interrupt. | |
| ISR_RAMCTRL_INT_vect () | |
| Runs the Interrupts Task Manager to handle a RAM Controller (RAMCTRL) error interrupt. | |
| ISR_CRCSCAN_INT_vect () | |
| Runs the Interrupts Task Manager to handle a CRC Scan (CRCSCAN) interrupt. | |
Variables | |
| FUSES | |
| Sets a Framework compatible User Fuses configuration. | |
| LOCKBITS = LOCKBITS_DEFAULT | |
| Sets a Memory Sections Access Protection (Lock) Configuration. | |
| volatile bool | suspendScheduler = false |
| Defines an example boolean for the Application to optionally start the Shutdown sequence. | |
Example main file for demonstrating usage of the Framework Task Managers.
This file is used as an example to demonstrate how the Task Managers can be invoked from the main-file level. The PreMain function is responsible for running the Pre-startup Task Manager, resulting in multiple device resets before completing the Pre-startup sequence and entering the main function. The main function is responsible for calling the Startup Task Manager, which initializes both the Safety System and the Application, before exiting the Safe State and starting Mission Mode. In Mission Mode, the Scheduler Task Manager is called each Fault Detection Time Interval (FDTI) to manage system Watchdogs and run the Application defined schedule, with optional Tasks provided by the Framework. The Application can optionally suspend the Scheduler to run the Shutdown Task Manager, which will re-enter Safe State and maintain safe deep sleep modes (Standby or Power-Down) until the Application requests ending the Shutdown sequence with a system reset. Any Interrupt Requests (IRQs) related to interrupt vectors regarding errors reported by hardware safety mechanisms have dedicated Interrupt Service Routines (ISRs) that call the appropriate Interrupt Task Manager to handle them. Finally, a Framework compliant configuration for User Fuses are provided, with an interface for locking the device with the Lock Fuse.
To configure the compile-time behaviour of Task Managers and the Tasks they are calling, see tasks_config.h.
To configure the compile-time system error handling behaviour and the Error Handler called by Tasks, see error_handler_config.h.
To more easily demonstrate usage without concrete knowledge of Application requirements and to provide a straightforward overview, this example file and main_example.h are intentionally not MISRA C:2025-compliant. These files are considered out of scope for the deviation record, but the violations are listed here for completeness: