Files

81 lines
2.2 KiB
C

#ifndef TASK01_SCHEDULER_H
#define TASK01_SCHEDULER_H
#include <stdint.h>
#include "FreeRTOS.h"
#include "task.h"
#define SCHED_TRACE_CAPACITY 16U
#define SCHED_PEER_STACK_WORDS 192U
#define SCHED_PROBE_STACK_WORDS 192U
#define SCHED_VERIFY_STACK_WORDS 192U
#define SCHED_PEER_PRIORITY 2U
#define SCHED_PROBE_INITIAL_PRIORITY 0U
#define SCHED_PROBE_TARGET_PRIORITY 3U
#define SCHED_VERIFY_PRIORITY 1U
#define SCHED_TIMEOUT_TICKS 100U
typedef enum
{
SCHED_PHASE_PREPARED = 0,
SCHED_PHASE_READY,
SCHED_PHASE_RUNNING,
SCHED_PHASE_COMPLETED
} SchedulerPhase;
typedef struct
{
uint32_t id;
UBaseType_t configured_priority;
volatile UBaseType_t observed_priority;
TaskHandle_t handle;
uintptr_t created_handle;
uintptr_t tcb_address;
uintptr_t entry_sp;
uintptr_t stack_low;
uintptr_t stack_high;
volatile uint32_t iterations;
volatile uint32_t checksum;
volatile TickType_t first_tick;
volatile TickType_t last_tick;
volatile SchedulerPhase phase;
} PeerContext;
typedef struct
{
UBaseType_t initial_priority;
UBaseType_t target_priority;
volatile UBaseType_t observed_initial_priority;
volatile UBaseType_t observed_priority;
TaskHandle_t handle;
uintptr_t created_handle;
uintptr_t tcb_address;
uintptr_t entry_sp;
uintptr_t stack_low;
uintptr_t stack_high;
volatile TickType_t run_tick;
volatile uint32_t ran_before_caller_returned;
volatile uint32_t verifier_was_not_running;
volatile SchedulerPhase phase;
} HighProbeContext;
typedef struct
{
UBaseType_t configured_priority;
volatile UBaseType_t observed_priority;
TaskHandle_t handle;
volatile uint32_t pass;
volatile SchedulerPhase phase;
} VerifierContext;
void peer_task_entry( void * pv_parameters );
void high_probe_task_entry( void * pv_parameters );
void verifier_task_entry( void * pv_parameters );
void task01_scheduler_checkpoint( uint32_t point, const void * subject );
void task01_scheduler_checkpoint_committed( uint32_t point,
const void * subject );
void task01_tick_checkpoint_committed( void );
#endif