FuSa 8-Bit Libraries Safety Framework
Loading...
Searching...
No Matches
task_manager_scheduler.c
Go to the documentation of this file.
1
22
23// Standard Library Includes
24#include <stddef.h>
25#include <stdint.h>
26
27// Framework Includes
29#include <define_tasks_config.h>
31#include <tasks_shared.h>
32
33void TM_Scheduler(const scheduleEntry_t schedule[], uint8_t scheduleLength,
34 uint32_t nextScheduleDeadline)
35{
37 // Execute all Tasks in schedule, skip if Task function pointer is NULL.
38 for (uint8_t i = 0U; i < scheduleLength; i++)
39 {
40 task_t nextTask = schedule[i].task;
41 uint32_t nextDuration = schedule[i].duration;
42
43 if (nextTask != NULL)
44 {
45 // Ensure next Task has fixed duration
46 T_HandleSyncWatchdog(nextDuration);
47 nextTask();
48 }
49 }
50
51 T_HandleSyncWatchdog(nextScheduleDeadline);
52}
Defines type for Task scheduling.
void(* task_t)(void)
Defines a function pointer type for tasks.
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.
void T_HandleSyncWatchdog(uint32_t newTimeout)
Waits until the current Synchronous Watchdog timeout is completed before clearing and setting the nex...
void T_HandleWatchdog(void)
Clears the Watchdog Timer (WDT) while performing the WDT count diagnostic.
Defines a schedule entry containing a task function pointer and its duration.
uint32_t duration
task_t task