From 35f42a488c2c00286e5986d2f96104e2efd3e401 Mon Sep 17 00:00:00 2001 From: marco Date: Wed, 20 Sep 2006 14:53:22 +0000 Subject: [PATCH] Added scheduler test. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@717 38d2e660-2303-0410-9eaa-f027e97ec537 --- kern/proc_test.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100755 kern/proc_test.c diff --git a/kern/proc_test.c b/kern/proc_test.c new file mode 100755 index 00000000..31915253 --- /dev/null +++ b/kern/proc_test.c @@ -0,0 +1,58 @@ + +#include +#include + +/** + * Proc scheduling test subthread 1 + */ +static void NORETURN proc_test_thread1(void) +{ + for (;;) + { + kputs(">task 1\n"); + timer_delay(50); + proc_switch(); + } +} + +/** + * Proc scheduling test subthread 2 + */ +static void NORETURN proc_test_thread2(void) +{ + for (;;) + { + kputs(">task 2\n"); + timer_delay(75); + proc_switch(); + } +} + +static cpustack_t proc_test_stack1[CONFIG_KERN_DEFSTACKSIZE/sizeof(cpustack_t)]; +static cpustack_t proc_test_stack2[CONFIG_KERN_DEFSTACKSIZE/sizeof(cpustack_t)]; + +/** + * Proc scheduling test + */ +void NORETURN proc_test(void) +{ + proc_new(proc_test_thread1, NULL, sizeof(proc_test_stack1), proc_test_stack1); + proc_new(proc_test_thread2, NULL, sizeof(proc_test_stack2), proc_test_stack2); + kputs("Created tasks\n"); + + kputs("stack1:\n"); + #warning FIXME + //kdump(proc_test_stack1+sizeof(proc_test_stack1)-64, 64); + kputs("stack2:\n"); + #warning FIXME + //kdump(proc_test_stack2+sizeof(proc_test_stack1)-64, 64); + + for (;;) + { + kputs(">main task\n"); + timer_delay(93); + proc_switch(); + } + + ASSERT(false); +} -- 2.25.1