fix sample code
This commit is contained in:
@@ -40,11 +40,11 @@ void entry_task_wizard(void *arg)
|
|||||||
printf("wizard: I will set 3 warriors to find the fragments\n");
|
printf("wizard: I will set 3 warriors to find the fragments\n");
|
||||||
tos_countdownlatch_create(&countdownlatch, 3);
|
tos_countdownlatch_create(&countdownlatch, 3);
|
||||||
(void)tos_task_create(&task_warrior_0, "warrior_0", entry_task_warrior_0, NULL,
|
(void)tos_task_create(&task_warrior_0, "warrior_0", entry_task_warrior_0, NULL,
|
||||||
4, stack_task_warrior_0, STK_SIZE_TASK_WIZARD, 0);
|
4, stack_task_warrior_0, STK_SIZE_TASK_WARRIOR, 0);
|
||||||
(void)tos_task_create(&task_warrior_1, "warrior_1", entry_task_warrior_1, NULL,
|
(void)tos_task_create(&task_warrior_1, "warrior_1", entry_task_warrior_1, NULL,
|
||||||
4, stack_task_warrior_1, STK_SIZE_TASK_WIZARD, 0);
|
4, stack_task_warrior_1, STK_SIZE_TASK_WARRIOR, 0);
|
||||||
(void)tos_task_create(&task_warrior_2, "warrior_2", entry_task_warrior_2, NULL,
|
(void)tos_task_create(&task_warrior_2, "warrior_2", entry_task_warrior_2, NULL,
|
||||||
4, stack_task_warrior_2, STK_SIZE_TASK_WIZARD, 0);
|
4, stack_task_warrior_2, STK_SIZE_TASK_WARRIOR, 0);
|
||||||
printf("wizard: now warriors are on their way, I will wait here until they all done the job\n");
|
printf("wizard: now warriors are on their way, I will wait here until they all done the job\n");
|
||||||
tos_countdownlatch_pend(&countdownlatch);
|
tos_countdownlatch_pend(&countdownlatch);
|
||||||
printf("wizard: the warriors all have done their jobs, let's make the weapon\n");
|
printf("wizard: the warriors all have done their jobs, let's make the weapon\n");
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
#include "tos_k.h"
|
#include "tos_k.h"
|
||||||
#include "mcu_init.h"
|
#include "mcu_init.h"
|
||||||
|
|
||||||
#define STK_SIZE_TASK_WIZARD 512
|
|
||||||
#define STK_SIZE_TASK_WARRIOR 512
|
#define STK_SIZE_TASK_WARRIOR 512
|
||||||
|
|
||||||
k_stack_t stack_task_warrior_0[STK_SIZE_TASK_WARRIOR];
|
k_stack_t stack_task_warrior_0[STK_SIZE_TASK_WARRIOR];
|
||||||
@@ -48,11 +47,11 @@ int main(void)
|
|||||||
tos_barrier_create(&barrier, 3);
|
tos_barrier_create(&barrier, 3);
|
||||||
|
|
||||||
(void)tos_task_create(&task_warrior_0, "warrior_0", entry_task_warrior_0, NULL,
|
(void)tos_task_create(&task_warrior_0, "warrior_0", entry_task_warrior_0, NULL,
|
||||||
4, stack_task_warrior_0, STK_SIZE_TASK_WIZARD, 0);
|
4, stack_task_warrior_0, STK_SIZE_TASK_WARRIOR, 0);
|
||||||
(void)tos_task_create(&task_warrior_1, "warrior_1", entry_task_warrior_1, NULL,
|
(void)tos_task_create(&task_warrior_1, "warrior_1", entry_task_warrior_1, NULL,
|
||||||
4, stack_task_warrior_1, STK_SIZE_TASK_WIZARD, 0);
|
4, stack_task_warrior_1, STK_SIZE_TASK_WARRIOR, 0);
|
||||||
(void)tos_task_create(&task_warrior_2, "warrior_2", entry_task_warrior_2, NULL,
|
(void)tos_task_create(&task_warrior_2, "warrior_2", entry_task_warrior_2, NULL,
|
||||||
4, stack_task_warrior_2, STK_SIZE_TASK_WIZARD, 0);
|
4, stack_task_warrior_2, STK_SIZE_TASK_WARRIOR, 0);
|
||||||
tos_knl_start();
|
tos_knl_start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user