⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 compat-uitron-configuration-faq.html

📁 ecos 很好的源代码
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!-- Copyright (C) 2003 Red Hat, Inc.                                -->
<!-- This material may be distributed only subject to the terms      -->
<!-- and conditions set forth in the Open Publication License, v1.0  -->
<!-- or later (the latest version is presently available at          -->
<!-- http://www.opencontent.org/openpub/).                           -->
<!-- Distribution of the work or derivative of the work in any       -->
<!-- standard (paper) book form is prohibited unless prior           -->
<!-- permission is obtained from the copyright holder.               -->
<HTML
><HEAD
><TITLE
>礗TRON Configuration FAQ</TITLE
><meta name="MSSmartTagsPreventParsing" content="TRUE">
<META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="eCos Reference Manual"
HREF="ecos-ref.html"><LINK
REL="UP"
TITLE="礗TRON API"
HREF="compat-uitron-microitron-api.html"><LINK
REL="PREVIOUS"
TITLE="	  Network Support Functions"
HREF="compat-uitron-network-support-functions.html"><LINK
REL="NEXT"
TITLE="TCP/IP Stack Support for eCos"
HREF="net-common-tcpip.html"></HEAD
><BODY
CLASS="SECT1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>eCos Reference Manual</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="compat-uitron-network-support-functions.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 32. &micro;ITRON API</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="net-common-tcpip.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="COMPAT-UITRON-CONFIGURATION-FAQ">&micro;ITRON Configuration FAQ</H1
><P
><SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>Q: How are &micro;ITRON objects created?</I
></SPAN
></P
><P
>For each type of uITRON object (tasks, semaphores, flags, mboxes, mpf, mpl)
these two quantities are controlled by configuration:</P
><P
></P
><UL
><LI
><P
>The <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>maximum</I
></SPAN
> number of this type of object.</P
></LI
><LI
><P
>The number of these objects which exist <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>initially</I
></SPAN
>.</P
></LI
></UL
><P
>This is assuming that for the relevant object type,
<SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>create</I
></SPAN
> and <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>delete</I
></SPAN
>
operations are enabled; enabled is the default.  For example, the option
<TT
CLASS="LITERAL"
>CYGPKG_UITRON_MBOXES_CREATE_DELETE</TT
>
controls whether the functions
<TT
CLASS="FUNCTION"
>cre_mbx()</TT
>
and
<TT
CLASS="FUNCTION"
>del_mbx()</TT
>
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
&micro;ITRON object types.</P
><P
>Mboxes have no initialization, so there are only a few, simple
configuration options:</P
><P
></P
><UL
><LI
><P
><TT
CLASS="LITERAL"
>CYGNUM_UITRON_MBOXES</TT
>
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
<TT
CLASS="FUNCTION"
>cre_mbx(5,...)</TT
>
will return an error.</P
></LI
><LI
><P
><TT
CLASS="LITERAL"
>CYGNUM_UITRON_MBOXES_INITIALLY</TT
>
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. <TT
CLASS="FUNCTION"
>cre_mbx(3,...)</TT
>
will return an error because the mbox in quesion already
exists.  You can delete a pre-existing mbox, and then re-create it.</P
></LI
></UL
><P
>If you change 
<TT
CLASS="LITERAL"
>CYGNUM_UITRON_MBOXES_INITIALLY</TT
>,
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 <TT
CLASS="FUNCTION"
>cre_mbx(3,...)</TT
>
and then use it, say
<TT
CLASS="FUNCTION"
>snd_msg(3,&amp;foo)</TT
>, and all will be well.</P
><P
><SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>Q: How are &micro;ITRON objects initialized?</I
></SPAN
></P
><P
>Some object types have optional initialization.  Semaphores are an
example.  You could have 
<TT
CLASS="LITERAL"
>CYGNUM_UITRON_SEMAS</TT
>=10 and
<TT
CLASS="LITERAL"
>CYGNUM_UITRON_SEMAS_INITIALLY</TT
>=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
<TT
CLASS="FILENAME"
>pkgconf/uitron.h</TT
>:</P
><TABLE
BORDER="5"
BGCOLOR="#E0E0F0"
WIDTH="70%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>   #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,     \
        CYG_UIT_SEMA_NOEXS,     \
        CYG_UIT_SEMA_NOEXS,     \
        CYG_UIT_SEMA_NOEXS</PRE
></TD
></TR
></TABLE
><P
>Semaphore 1 will have initial count 1, semaphores 2 and 3 will be zero,
number 4 will be 99 initially, 5 will be one and numbers 6 though 10 do not
exist initially.</P
><P
>Aside: this is how the definition of the symbol would appear in the
configuration header file <TT
CLASS="FILENAME"
>pkgconf/uitron.h</TT
> &#8212;
unfortunately editing such a long, multi-line definition is somewhat
cumbersome in the GUI config tool in current releases.  The macros
<TT
CLASS="LITERAL"
>CYG_UIT_SEMA()</TT
>
&#8212; to create a semaphore initializer &#8212; and
<TT
CLASS="LITERAL"
>CYG_UIT_SEMA_NOEXS</TT
>
&#8212; to invoke a dummy initializer &#8212;
are provided in in the environment to help with this.  Similar macros are
provided for other object types.  The resulting #define symbol is used in
the context of a C++ array initializer, such as:
<TABLE
BORDER="5"
BGCOLOR="#E0E0F0"
WIDTH="70%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>Cyg_Counting_Semaphore2 cyg_uitron_SEMAS[ CYGNUM_UITRON_SEMAS ] = {
	CYGDAT_UITRON_SEMA_INITIALIZERS
};</PRE
></TD
></TR
></TABLE
>
which is eventually macro-processed to give
<TABLE
BORDER="5"
BGCOLOR="#E0E0F0"
WIDTH="70%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>Cyg_Counting_Semaphore2 cyg_uitron_SEMAS[ 10 ] = {
	Cyg_Counting_Semaphore2( ( 1 ) ), 
	Cyg_Counting_Semaphore2( ( 0 ) ), 
	Cyg_Counting_Semaphore2( ( 0 ) ), 
	Cyg_Counting_Semaphore2( ( 99 ) ), 
	Cyg_Counting_Semaphore2( ( 1 ) ), 
	Cyg_Counting_Semaphore2(0), 
	Cyg_Counting_Semaphore2(0), 
	Cyg_Counting_Semaphore2(0), 
	Cyg_Counting_Semaphore2(0), 
	Cyg_Counting_Semaphore2(0), 
};</PRE
></TD
></TR
></TABLE
>
so you can see how it is necessary to include the dummy entries in that
definition, otherwise the resulting code will not compile correctly.</P
><P
>If you choose 
<TT
CLASS="LITERAL"
>CYGNUM_UITRON_SEMAS_INITIALLY</TT
>=0
it is meaningless to initialize them, for they must be created and so
initialized then, before use.</P
><P
><SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>Q: What about &micro;ITRON tasks?</I
></SPAN

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -