beautypg.com

11 time management function – Renesas Emulator System M3T-MR100 User Manual

Page 70

background image

- 54 -

4.1.11

Time Management Function

The time management function provides system time management, time reading

26

, time setup

27

, and the functions of the

alarm handler, which actuates at preselected times, and the cyclic handler, which actuates at preselected time intervals.

The MR100 kernel requires one timer for use as the system clock. There are following time management service calls that
are provided by the MR100 kernel. Note, however, that the system clock is not an essential function of MR100. Therefore,
if the service calls described below and the time management function of the MR100 are unused, a timer does not need to
be occupied for use by MR100.

Place a task in a finite time wait state by specifying a timeout value

A timeout can be specified in a service call that places the issuing task into WAITING state.

28

This service call

includes tslp_tsk, twai_flg, twai_sem, tsnd_dtq, trcv_dtq, trcv_mbx, tget_mpf, vtsnd_dtq, and vtrcv_dtq. If the
wait cancel condition is not met before the specified timeout time elapses, the error code E_TMOUT is returned,
and the task is freed from the waiting state. If the wait cancel condition is met, the error code E_OK is returned.
The timeout time should be specified in ms units.

50

tslp_tsk(50)

READY state

tslp_tsk(50)

iwup_tsk

E_OK

E_TMOUT

WAITING state

WAITING state

RUNNING state

Timeout value

Figure 4.20 Timeout Processing

MR100 guarantees that as stipulated in µITRON specification, timeout processing is not performed until a time
equal to or greater than the specified timeout value elapses. More specifically, timeout processing is performed
with the following timing.

1. If the timeout value is 0 (for only dly_tsk)

29

The task times out at the first time tick after the service call is issued.

30

2. If the timeout value is a multiple of time tick interval

The timer times out at the (timeout value / time tick interval) + first time tick. For example, if the time
tick interval is 10 ms and the specified timeout value is 40 ms, then the timer times out at the fifth oc-
currence of the time tick. Similarly, if the time tick interval is 5 ms and the specified timeout value is 15
ms, then the timer times out at the fourth occurrence of the time tick.

26

get_tim service call

27

set_tim service call

28

SUSPENDED state is not included.

29

Strictly, in a dly_tsk service call, the "timeout value" is not correct. "delay time" is correct.

30

Strictly, in a dly_tsk service call, a timeout is not carried out, but the waiting for delay is canceled and the service call carries out the nor-

mal end.