- int i;
- char str[10] ;
-
- // semaphore to sync task startup on
- rt_sem_create(&mysync,"MySemaphore",0,S_FIFO);
-
- // change to period mode because round robin does not work
- // in one shot mode
- rt_timer_set_mode(BASEPERIOD);// set tick period
- for(i=0; i < NTASKS; i++) {
- rt_printf("start task : %d\n",i);
- sprintf(str,"task%d",i);
- rt_task_create(&demo_task[i], str, 0, 50, 0);
- rt_task_start(&demo_task[i], &demo, &i);
- }
- rt_printf("wake up all tasks\n");
- rt_sem_broadcast(&mysync);
+ int i;
+ char str[10] ;
+
+ // semaphore to sync task startup on
+ rt_sem_create(&mysync, "MySemaphore", 0, S_FIFO);
+
+ // change to period mode because round robin does not work
+ // in one shot mode
+ rt_timer_set_mode(BASEPERIOD);// set tick period
+ for(i = 0; i < NTASKS; i++) {
+ rt_printf("start task: %d\n", i);
+ sprintf(str, "task%d", i);
+ rt_task_create(&demo_task[i], str, 0, 50, 0);
+ rt_task_start(&demo_task[i], &demo, &i);
+ }
+ rt_printf("wake up all tasks\n");
+ rt_sem_broadcast(&mysync);