The eCos kernel implements the functionality
used by the µITRON compatibility subsystem.
The configuration of the kernel influences the behavior of µITRON
programs.
In particular, the default configuration has time slicing
(also known as round-robin scheduling) switched on; this means that
a task can be moved from RUN state
to READY state at any time, in
order that one of its peers may run. This is not strictly conformant
to the µITRON specification, which
states that timeslicing may be implemented by periodically issuing
a rot_rdq(0) call from
within a periodic task or cyclic handler; otherwise it is expected
that a task runs until it is pre-empted in consequence of synchronization
or communication calls it makes, or the effects of an interrupt
or other external event on a higher priority task cause that task
to become READY. To disable timeslicing
functionality in the kernel and µITRON
compatibility environment, please disable the
CYGSEM_KERNEL_SCHED_TIMESLICE
configuration option in the kernel package. A description of kernel
scheduling is in Kernel Overview.
For another example, the semantics of task queueing when waiting
on a synchronization object depend solely on the way the underlying
kernel is configured. As discussed above, the multi-level queue
scheduler is the only one which is µITRON
compliant, and it queues waiting tasks in FIFO order. Future releases
of that scheduler might be configurable to support priority ordering
of task queues. Other schedulers might be different again: for example
the bitmap scheduler can be used with the µITRON
compatibility layer, even though it only allows one task at each
priority and as such is not µITRON
compliant, but it supports only priority ordering of task queues.
So which queueing scheme is supported is not really a property of
the µITRON compatibility layer; it
depends on the kernel.
In this version of the µITRON
compatibility layer, the calls to disable and enable scheduling
and interrupts (dis_dsp(),
ena_dsp(), loc_cpu()
and unl_cpu())
call underlying kernel functions; in particular, the xxx_dsp() functions
lock the scheduler entirely, which prevents dispatching of DSRs; functions
implemented by DSRs include clock counters and alarm timers. Thus time “stops” while
dispatching is disabled with dis_dsp().
Like all parts of the eCos system, the
detailed semantics of the µITRON layer
are dependent on its configuration and the configuration of other components
that it uses. The µITRON configuration
options are all defined in the file pkgconf/uitron.h,
and can be set using the configuration tool or editing the
.ecc
file in your build directory by hand.
An important configuration option for the µITRON
compatibility layer is “Option: Return Error Codes for Bad Params”
(
CYGSEM_UITRON_BAD_PARAMS_RETURN_ERRORS
), which allows a lot of the error
checking code in the µITRON compatibility layer to
be removed. Of course this leaves a program open to undetected errors,
so it should only be used once an application is fully debugged and
tested. Its benefits include reduced code size and faster execution.
However, it affects the API significantly, in that with this option
enabled, bad calls do not return errors, but cause an assert
failure (if that is itself enabled) or malfunction internally. There
is discussion in more detail about this in each section below.
We now give a brief description of the µITRON
functions which are implemented in this release. Note that all C
and C++ source files should have the following #include statement: