33 lines
582 B
C
33 lines
582 B
C
#include <rt/task.h>
|
|
#include <rt/trap.h>
|
|
|
|
static volatile float v;
|
|
|
|
static void f(uintptr_t arg)
|
|
{
|
|
rt_task_drop_privilege();
|
|
|
|
float x = 0.0f;
|
|
float a = (float)arg;
|
|
for (;;)
|
|
{
|
|
x += a;
|
|
v = x;
|
|
rt_task_yield();
|
|
}
|
|
}
|
|
|
|
static void timeout(void)
|
|
{
|
|
rt_task_drop_privilege();
|
|
rt_task_sleep(100);
|
|
rt_trap();
|
|
}
|
|
|
|
/* These tasks use floating-point, so give them a larger stack size if the
|
|
* architecture requires it. */
|
|
RT_TASK_ARG(f, 1, RT_STACK_FP_MIN, 1);
|
|
RT_TASK_ARG(f, 2, RT_STACK_FP_MIN, 1);
|
|
|
|
RT_TASK(timeout, RT_STACK_MIN, 0);
|