Chapter 8 Sample Program Description

- 143 -

8.2 Program Source Listing
1 /*************************************************************************
2 * MR308 smaple program
3 *
4 * COPYRIGHT(C) 2003(2005) RENESAS TECHNOLOGY CORPORATION
5 * AND RENESAS SOLUTIONS CORPORATION ALL RIGHTS RESERVED
6 *
7 *
8 * $Id: demo.c,v 1.2 2005/06/15 05:29:02 inui Exp $
9 *************************************************************************/
10
11 #include <itron.h>
12 #include <kernel.h>
13 #include "kernel_id.h"
14 #include <stdio.h>
15
16
17 void main( VP_INT stacd )
18 {
19 sta_tsk(ID_task1,0);
20 sta_tsk(ID_task2,0);
21 sta_cyc(ID_cyh1);
22 }
23 void task1( VP_INT stacd )
24 {
25 while(1){
26 wai_sem(ID_sem1);
27 slp_tsk();
28 printf("task1 running\n");
29 sig_sem(ID_sem1);
30 }
31 }
32
33 void task2( VP_INT stacd )
34 {
35 while(1){
36 wai_sem(ID_sem1);
37 printf("task2 running\n");
38 sig_sem(ID_sem1);
39 }
40 }
41
42 void cyh1( VP_INT exinf )
43 {
44 iwup_tsk(ID_task1);
45 }
46