10#include <stk_config.h>
21#define _STK_HRT_TEST_TASKS_MAX 3
22#define _STK_HRT_TEST_PERIODICITY 100
23#define _STK_HRT_TEST_SLEEP 10
24#define _STK_HRT_TEST_ITRS 3
49template <EAccessMode _AccessMode>
70 printf(
"id=%d start=%d diff=%d\n",
m_task_id, (
int)start, (
int)diff);
94int main(
int argc,
char **argv)
107#define TICKS(MS) GetTicksFromMs((MS), PERIODICITY_DEFAULT)
126 int32_t diff_start =
g_Time[t][i].start - expect;
128 diff_start = -diff_start;
132 diff_sleep = -diff_sleep;
135 if ((diff_start > 10) || (diff_sleep > 10))
137 printf(
"failed time (%d): id=%d diff_start=%d diff_sleep=%d (>10)\n", (
int)i,
138 g_Time[t][i].
id, (
int)diff_start, (
int)diff_sleep);
Top-level STK include. Provides the Kernel class template and all built-in task-switching strategies.
int main(int argc, char **argv)
#define _STK_HRT_TEST_SLEEP
#define _STK_HRT_TEST_ITRS
#define _STK_HRT_TEST_TASKS_MAX
#define _STK_HRT_TEST_PERIODICITY
#define STK_TEST_DECL_ASSERT
Declare assertion redirector in the source file.
Namespace of STK package.
static int64_t GetTimeNowMs()
Get current time in milliseconds since kernel start.
void Yield()
Notify scheduler to switch to the next runnable task.
void Delay(uint32_t ticks)
Delay calling process by busy-waiting until the deadline expires.
Namespace of the test inventory.
static TestTask< ACCESS_PRIVILEGED > task2(1)
static TestTask< ACCESS_PRIVILEGED > task1(0)
Tasks (threads).
static TimeInfo g_Time[3][3]
static Kernel< KERNEL_DYNAMIC|KERNEL_HRT, 3, SwitchStrategyRoundRobin, PlatformDefault > kernel
Kernel.
static TestTask< ACCESS_PRIVILEGED > task3(2)
Concrete implementation of IKernel.
Task(const Task &)=delete
TestTask(uint8_t task_id)
void Run()
Entry point of the user task.
static void ShowTestSuitePrologue()
Show text string as prologue before tests start.
@ DEFAULT_FAILURE_EXIT_CODE
default exit code for exit() to denote failure of the test
@ SUCCESS_EXIT_CODE
exit code for exit() to denote the success of the test
static void ShowTestSuiteEpilogue(int32_t result)
Show text string as epilogue after tests end.