Network support functions, Itron configuration faq, Μitron configuration faq – Comtrol eCos User Manual
Page 485

Chapter 32. µITRON API
Network Support Functions
None of these functions are supported in this release.
µ
ITRON Configuration FAQ
Q: How are µITRON objects created?
For each type of uITRON object (tasks, semaphores, flags, mboxes, mpf, mpl) these two quantities are controlled
by configuration:
•
The maximum number of this type of object.
•
The number of these objects which exist initially.
This is assuming that for the relevant object type, create and delete operations are enabled; enabled is the default.
For example, the option
CYGPKG_UITRON_MBOXES_CREATE_DELETE
controls whether the functions
cre_mbx()
and
del_mbx()
exist in the API. If not, then the maximum number of mboxes is the same as the initial number of
mboxes, and so on for all µITRON object types.
Mboxes have no initialization, so there are only a few, simple configuration options:
•
CYGNUM_UITRON_MBOXES
is the total number of mboxes that you can have in the system. By default this is 4, so
you can use mboxes 1,2,3 and 4. You cannot create mboxes outside this range; trying to
cre_mbx(5,...)
will
return an error.
•
CYGNUM_UITRON_MBOXES_INITIALLY
is the number of mboxes created automatically for you, during startup.
By default this is 4, so all 4 mboxes exist already, and an attempt to create one of these eg.
cre_mbx(3,...)
will return an error because the mbox in quesion already exists. You can delete a pre-existing mbox, and then
re-create it.
If you change
CYGNUM_UITRON_MBOXES_INITIALLY
, for example to 0, no mboxes are created automatically for
you during startup. Any attempt to use an mbox without creating it will return E_NOEXS because the mbox does
not exist. You can create an mbox, say
cre_mbx(3,...)
and then use it, say
snd_msg(3,&foo)
, and all will be
well.
Q: How are µITRON objects initialized?
Some
object
types
have
optional
initialization.
Semaphores
are
an
example.
You
could
have
CYGNUM_UITRON_SEMAS
=10 and
CYGNUM_UITRON_SEMAS_INITIALLY
=5 which means you can use semaphores
1-5 straight off, but you must create semaphores 6-10 before you can use them. If you decide not to initialize
semaphores, semaphores 1-5 will have an initial count of zero. If you decide to initialize them, you must
supply a dummy initializer for semaphores 6-10 also. For example, in terms of the configuration output in
pkgconf/uitron.h
:
#define CYGDAT_UITRON_SEMA_INITIALIZERS \
CYG_UIT_SEMA(
1 ),
\
CYG_UIT_SEMA(
0 ),
\
CYG_UIT_SEMA(
0 ),
\
CYG_UIT_SEMA( 99 ),
\
CYG_UIT_SEMA(
1 ),
\
CYG_UIT_SEMA_NOEXS,
\
CYG_UIT_SEMA_NOEXS,
\
381