Set correct debug pins for A
[bertos.git] / kern / proc_test.c
1
2 #include <kern/proc.h>
3 #include <kern/monitor.h>
4 #include <drv/timer.h>
5
6 /**
7  * Proc scheduling test subthread 1
8  */
9 static void NORETURN proc_test_thread1(void)
10 {
11         for (;;)
12         {
13                 kputs(">task 1\n");
14                 timer_delay(50);
15                 proc_switch();
16         }
17 }
18
19 /**
20  * Proc scheduling test subthread 2
21  */
22 static void NORETURN proc_test_thread2(void)
23 {
24         for (;;)
25         {
26                 kputs(">task 2\n");
27                 timer_delay(75);
28                 proc_switch();
29         }
30 }
31
32 static cpustack_t proc_test_stack1[256];//CONFIG_PROC_DEFSTACKSIZE / sizeof(cpustack_t)];
33 static cpustack_t proc_test_stack2[256];//CONFIG_PROC_DEFSTACKSIZE / sizeof(cpustack_t)];
34 static cpustack_t monitor_stack[256];//CONFIG_PROC_DEFSTACKSIZE / sizeof(cpustack_t)];
35
36 /**
37  * Proc scheduling test
38  */
39 void NORETURN proc_test(void)
40 {
41         monitor_start(sizeof(monitor_stack), monitor_stack);
42         proc_new(proc_test_thread1, NULL, sizeof(proc_test_stack1), proc_test_stack1);
43         proc_new(proc_test_thread2, NULL, sizeof(proc_test_stack2), proc_test_stack2);
44         kputs("Created tasks\n");
45
46         kputs("stack1:\n");
47 //      #warning FIXME
48         kdump(proc_test_stack1+sizeof(proc_test_stack1)-64, 64);
49         kputs("stack2:\n");
50 //      #warning FIXME
51         kdump(proc_test_stack2+sizeof(proc_test_stack1)-64, 64);
52
53         for (;;)
54         {
55                 kputs(">main task\n");
56                 timer_delay(93);
57                 proc_switch();
58         }
59
60         ASSERT(false);
61 }