#ifndef TASK01_DELAY_STATE_H #define TASK01_DELAY_STATE_H #include #include "FreeRTOS.h" #include "task.h" #define FC04_PERIOD_TICKS 2U #define FC04_RELEASE_COUNT 3U #define FC04_TASK_STACK_WORDS 192U #define FC04_PERIODIC_PRIORITY 3U #define FC04_SUSPEND_PRIORITY 2U #define FC04_OBSERVER_PRIORITY 1U #define FC04_TIMEOUT_TICKS 20U typedef enum { FC04_PHASE_PREPARED = 0, FC04_PHASE_READY, FC04_PHASE_BLOCKED, FC04_PHASE_SUSPENDED, FC04_PHASE_RUNNING, FC04_PHASE_COMPLETED } Fc04Phase; typedef struct { TaskHandle_t handle; uintptr_t created_handle; volatile Fc04Phase phase; TickType_t initial_tick; TickType_t release_tick[ FC04_RELEASE_COUNT ]; volatile uint32_t release_count; uintptr_t entry_sp; uintptr_t stack_low; uintptr_t stack_high; } PeriodicContext; typedef struct { TaskHandle_t handle; uintptr_t created_handle; volatile Fc04Phase phase; volatile uint32_t resumed; uintptr_t entry_sp; } SuspendContext; typedef struct { TaskHandle_t handle; volatile Fc04Phase phase; volatile eTaskState periodic_state; volatile eTaskState suspend_state; volatile uint32_t pass; } ObserverContext; void periodic_task_entry( void * context ); void suspend_task_entry( void * context ); void observer_task_entry( void * context ); void fc04_checkpoint( uint32_t point, const void * subject ); void fc04_checkpoint_committed( uint32_t point, const void * subject ); #endif