- 105 -
[
[[
[
E
Ex
xa
am
mp
pl
le
e
p
pr
ro
og
gr
ra
am
m
s
st
ta
at
te
em
me
en
nt
t
]
]]
]
<<Example statement in C language>>
#include <itron.h>
#include <kernel.h>
#include “kernel_id.h”
void task()
{
:
if( wai_sem( ID_sem ) != E_OK )
printf(“Forced wakeup\n”);
:
if( pol_sem( ID_sem ) != E_OK )
printf(“Timeout\n”);
:
if( twai_sem( ID_sem, 10 ) != E_OK )
printf(“Forced wakeup or Timeout”n”);
:
}
<<Example statement in assembly language>>
.include mr100.inc
.GLB task
task: :
PUSH.W R2
pol_sem #ID_SEM1
:
PUSH.W R2
wai_sem #ID_SEM2
:
PUSH.W R2
PUSH.L R6R4
twai_sem #ID_SEM3,300
: