AVR SD Safety Framework 1.0.0
Loading...
Searching...
No Matches

Contains API prototype for the Scheduler Task Manager. More...

Files

file  task_manager_scheduler.c
 Implements API for the Scheduler Task Manager.
file  task_manager_scheduler.h
 Contains API prototype for the Scheduler Task Manager.

Functions

void TM_Scheduler (const scheduleEntry_t schedule[], uint8_t scheduleLength, uint32_t nextScheduleDeadline)
 Manages and synchronizes safety system and application Tasks from a user defined schedule.

Detailed Description

Contains API prototype for the Scheduler Task Manager.

The Scheduler Task Manager is responsible for running both safety system and application specific Tasks when the device is initialized and has exited the Safe State.

UML Class Diagrams

UML Sequence Diagrams

Function Documentation

◆ TM_Scheduler()

void TM_Scheduler ( const scheduleEntry_t schedule[],
uint8_t scheduleLength,
uint32_t nextScheduleDeadline )

Manages and synchronizes safety system and application Tasks from a user defined schedule.

This function executes safety system and application-specific scheduler Tasks with fixed durations, while ensuring the FDTI of the system.

After clearing the Watchdog Timer, all Tasks in the schedule are executed in sequence. Once the Task manager has handled the last Task in the schedule, the Synchronous Watchdog Timer is cleared and sets a deadline for when the first task in the next schedule should run Tasks.

Note
The T_RunNextLatentFaultDiag, T_HandleNotificationErrors and

T_EnterIdleSleep Tasks are optional Tasks provided for inclusion in the schedule. See Tips and Tricks for recommended scheduling frequency and ordering. Note that any Error IDs reported to the Error Handler with NOTIFICATION criticality is only handled when T_HandleNotificationErrors is called.

Note

The total duration of all tasks in the schedule, combined with the nextScheduleDeadline, is intended to be slightly less than the configured watchdog timeout to ensure timely execution and clearing. See Tips and Tricks for information on extending the duration if the amount of application tasks demands it.

Warning

The first action in this function is to clear the Watchdog Timer (WDT). After the first call to this function following TM_Startup, the Windowed Watchdog Timer (WWDT) is enabled. All subsequent calls are therefore assumed to occur while the WWDT is inside its open window, otherwise the device will reset. To satisfy this requirement, WWDT_CLOSED_WINDOW should be configured to be shorter than the total duration of the schedule (sum of all Task durations), plus nextScheduleDeadline, ensuring that execution reaches the open window before the next call to this function. Additionally, the sum of WWDT_CLOSED_WINDOW and WWDT_OPEN_WINDOW must be longer than that total duration, otherwise the WWDT will expire and reset the device.

Parameters
scheduleArray of schedule entries with a Task function pointer and duration in system clock cycles. Any Task set to a NULL pointer is skipped. Duration is limited to a 24-bit value minus SWDT_OPEN_WINDOW.
scheduleLengthNumber of entries in schedule. A value of '0' indicates an empty schedule and no application Tasks will run.
nextScheduleDeadlineDuration in system clock cycles for the time between completion of the last Task in the current schedule to calling the first Task in the next schedule, limited to a 24-bit value minus SWDT_OPEN_WINDOW.
Warning
An invalid Task function pointer in schedule leads to undefined behavior.
Warning
Passing a scheduleLength larger than the size of schedule results in undefined behavior.
Here is the call graph for this function:
Here is the caller graph for this function: