Ivo van Poorten
/
opus-una
A Small Cooperative Multitasking Kernel
Embed:
(wiki syntax)
Show/hide line numbers
tasks-printf-c.h
00001 #include "kernel.h" 00002 #include <stdio.h> 00003 00004 static void task_zero(void); 00005 static void task_one(void); 00006 00007 struct ou_task ou_tasks[] = { 00008 { task_zero, 2, 0, 0, 0, NULL }, 00009 { task_one, 1, 0, 0, 0, NULL } 00010 }; 00011 00012 const unsigned ou_ntasks = sizeof(ou_tasks)/sizeof(struct ou_task); 00013 00014 OU_TASK(task_zero) 00015 OU_WAIT(100); 00016 printf("hello\r\n"); 00017 OU_WAIT(100); 00018 printf("world\r\n"); 00019 OU_ENDTASK 00020 00021 OU_TASK(task_one) 00022 OU_WAIT(100); 00023 printf("goodbye\r\n"); 00024 OU_WAIT(100); 00025 printf("cruel\r\n"); 00026 OU_WAIT(100); 00027 printf("world...\r\n"); 00028 for(;;) { 00029 OU_WAIT(50); 00030 printf("loop\r\n"); 00031 } 00032 OU_ENDTASK
Generated on Wed Jul 13 2022 20:40:52 by 1.7.2