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