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

📄 compat-uitron-configuration-faq.html

📁 有关ecos2。0介绍了实时嵌入式的结构以及线程调度的实现和内存的管理等
💻 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"><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+"><LINKREL="HOME"TITLE="eCos Reference Manual"HREF="ecos-ref.html"><LINKREL="UP"TITLE="礗TRON API"HREF="compat-uitron-microitron-api.html"><LINKREL="PREVIOUS"TITLE="	  Network Support Functions"HREF="compat-uitron-network-support-functions.html"><LINKREL="NEXT"TITLE="TCP/IP Stack Support for eCos"HREF="net-common-tcpip.html"></HEAD><BODYCLASS="SECT1"BGCOLOR="#FFFFFF"TEXT="#000000"LINK="#0000FF"VLINK="#840084"ALINK="#0000FF"><DIVCLASS="NAVHEADER"><TABLESUMMARY="Header navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><THCOLSPAN="3"ALIGN="center">eCos Reference Manual</TH></TR><TR><TDWIDTH="10%"ALIGN="left"VALIGN="bottom"><AHREF="compat-uitron-network-support-functions.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom">Chapter 32. &micro;ITRON API</TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="net-common-tcpip.html"ACCESSKEY="N">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><DIVCLASS="SECT1"><H1CLASS="SECT1"><ANAME="COMPAT-UITRON-CONFIGURATION-FAQ">&micro;ITRON Configuration FAQ</H1><P><SPANCLASS="emphasis"><ICLASS="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 <SPANCLASS="emphasis"><ICLASS="EMPHASIS">maximum</I></SPAN> number of this type of object.</P></LI><LI><P>The number of these objects which exist <SPANCLASS="emphasis"><ICLASS="EMPHASIS">initially</I></SPAN>.</P></LI></UL><P>This is assuming that for the relevant object type,<SPANCLASS="emphasis"><ICLASS="EMPHASIS">create</I></SPAN> and <SPANCLASS="emphasis"><ICLASS="EMPHASIS">delete</I></SPAN>operations are enabled; enabled is the default.  For example, the option<TTCLASS="LITERAL">CYGPKG_UITRON_MBOXES_CREATE_DELETE</TT>controls whether the functions<TTCLASS="FUNCTION">cre_mbx()</TT>and<TTCLASS="FUNCTION">del_mbx()</TT>exist in the API.  If not, then the maximum number ofmboxes 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, simpleconfiguration options:</P><P></P><UL><LI><P><TTCLASS="LITERAL">CYGNUM_UITRON_MBOXES</TT>is the total number of mboxes that you can have in thesystem.  By default this is 4, so you can use mboxes 1,2,3 and 4.  Youcannot create mboxes outside this range; trying to<TTCLASS="FUNCTION">cre_mbx(5,...)</TT>will return an error.</P></LI><LI><P><TTCLASS="LITERAL">CYGNUM_UITRON_MBOXES_INITIALLY</TT>is the number of mboxes createdautomatically for you, during startup.  By default this is 4, so all 4mboxes exist already, and an attempt to create one of theseeg. <TTCLASS="FUNCTION">cre_mbx(3,...)</TT>will return an error because the mbox in quesion alreadyexists.  You can delete a pre-existing mbox, and then re-create it.</P></LI></UL><P>If you change <TTCLASS="LITERAL">CYGNUM_UITRON_MBOXES_INITIALLY</TT>,for example to 0, no mboxesare created automatically for you during startup.  Any attempt to use anmbox without creating it will return E_NOEXS because the mbox does notexist.  You can create an mbox, say <TTCLASS="FUNCTION">cre_mbx(3,...)</TT>and then use it, say<TTCLASS="FUNCTION">snd_msg(3,&amp;foo)</TT>, and all will be well.</P><P><SPANCLASS="emphasis"><ICLASS="EMPHASIS">Q: How are &micro;ITRON objects initialized?</I></SPAN></P><P>Some object types have optional initialization.  Semaphores are anexample.  You could have <TTCLASS="LITERAL">CYGNUM_UITRON_SEMAS</TT>=10 and<TTCLASS="LITERAL">CYGNUM_UITRON_SEMAS_INITIALLY</TT>=5which means you can use semaphores 1-5straight 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 aninitial count of zero.  If you decide to initialize them, you must supplya dummy initializer for semaphores 6-10 also.  For example,in terms of the configuration output in<TTCLASS="FILENAME">pkgconf/uitron.h</TT>:</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="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 notexist initially.</P><P>Aside: this is how the definition of the symbol would appear in theconfiguration header file <TTCLASS="FILENAME">pkgconf/uitron.h</TT> &#8212;unfortunately editing such a long, multi-line definition is somewhatcumbersome in the GUI config tool in current releases.  The macros<TTCLASS="LITERAL">CYG_UIT_SEMA()</TT>&#8212; to create a semaphore initializer &#8212; and<TTCLASS="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 areprovided for other object types.  The resulting #define symbol is used inthe context of a C++ array initializer, such as:<TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="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<TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="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 thatdefinition, otherwise the resulting code will not compile correctly.</P><P>If you choose <TTCLASS="LITERAL">CYGNUM_UITRON_SEMAS_INITIALLY</TT>=0it is meaningless to initialize them, for they must be created and soinitialized then, before use.</P><P><SPANCLASS="emphasis"><ICLASS="EMPHASIS">Q: What about &micro;ITRON tasks?</I></SPAN

⌨️ 快捷键说明

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