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

📄 compat-uitron-sync-and-comm-functions.html

📁 有关ecos2。0介绍了实时嵌入式的结构以及线程调度的实现和内存的管理等
💻 HTML
字号:
<!-- 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>	  Synchronization and Communication Functions</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="Task-Dependent Synchronization Functions"HREF="compat-uitron-task-dependent-synch-functions.html"><LINKREL="NEXT"TITLE="Extended Synchronization and Communication Functions"HREF="compat-uitron-extended-sync-comm-functions.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-task-dependent-synch-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="compat-uitron-extended-sync-comm-functions.html"ACCESSKEY="N">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><DIVCLASS="SECT1"><H1CLASS="SECT1"><ANAME="COMPAT-UITRON-SYNC-AND-COMM-FUNCTIONS">Synchronization and Communication Functions</H1><P>These functions are fully supported in this release: </P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">ER <TTCLASS="FUNCTION">sig_sem</TT>(     ID <SPANCLASS="emphasis"><ICLASS="EMPHASIS">semid</I></SPAN> )</PRE></TD></TR></TABLE><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">ER <TTCLASS="FUNCTION">wai_sem</TT>(     ID <SPANCLASS="emphasis"><ICLASS="EMPHASIS">semid</I></SPAN> )</PRE></TD></TR></TABLE><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">ER <TTCLASS="FUNCTION">preq_sem</TT>(     ID <SPANCLASS="emphasis"><ICLASS="EMPHASIS">semid</I></SPAN> )</PRE></TD></TR></TABLE><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">ER <TTCLASS="FUNCTION">twai_sem</TT>(     ID <SPANCLASS="emphasis"><ICLASS="EMPHASIS">semid,</I></SPAN>    TMO <SPANCLASS="emphasis"><ICLASS="EMPHASIS">tmout</I></SPAN> )</PRE></TD></TR></TABLE><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">ER <TTCLASS="FUNCTION">ref_sem</TT>(     T_RSEM *<SPANCLASS="emphasis"><ICLASS="EMPHASIS">pk_rsem ,</I></SPAN>    ID <SPANCLASS="emphasis"><ICLASS="EMPHASIS">semid</I></SPAN> )</PRE></TD></TR></TABLE><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">ER <TTCLASS="FUNCTION">set_flg</TT>(     ID <SPANCLASS="emphasis"><ICLASS="EMPHASIS">flgid,</I></SPAN>    UINT <SPANCLASS="emphasis"><ICLASS="EMPHASIS">setptn</I></SPAN> )</PRE></TD></TR></TABLE><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">ER <TTCLASS="FUNCTION">clr_flg</TT>(     ID <SPANCLASS="emphasis"><ICLASS="EMPHASIS">flgid,</I></SPAN>    UINT <SPANCLASS="emphasis"><ICLASS="EMPHASIS">clrptn</I></SPAN> )</PRE></TD></TR></TABLE><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">ER <TTCLASS="FUNCTION">wai_flg</TT>(     UINT *<SPANCLASS="emphasis"><ICLASS="EMPHASIS">p_flgptn,</I></SPAN>    ID <SPANCLASS="emphasis"><ICLASS="EMPHASIS">flgid ,</I></SPAN>    UINT <SPANCLASS="emphasis"><ICLASS="EMPHASIS">waiptn ,</I></SPAN>    UINT <SPANCLASS="emphasis"><ICLASS="EMPHASIS">wfmode</I></SPAN> )</PRE></TD></TR></TABLE><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">ER <TTCLASS="FUNCTION">pol_flg</TT>(     UINT *<SPANCLASS="emphasis"><ICLASS="EMPHASIS">p_flgptn,</I></SPAN>    ID <SPANCLASS="emphasis"><ICLASS="EMPHASIS">flgid ,</I></SPAN>    UINT <SPANCLASS="emphasis"><ICLASS="EMPHASIS">waiptn ,</I></SPAN>    UINT <SPANCLASS="emphasis"><ICLASS="EMPHASIS">wfmode</I></SPAN> )</PRE></TD></TR></TABLE><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">ER <TTCLASS="FUNCTION">twai_flg</TT>(     UINT *<SPANCLASS="emphasis"><ICLASS="EMPHASIS">p_flgptn</I></SPAN>    ID <SPANCLASS="emphasis"><ICLASS="EMPHASIS">flgid ,</I></SPAN>    UINT <SPANCLASS="emphasis"><ICLASS="EMPHASIS">waiptn ,</I></SPAN>    UINT <SPANCLASS="emphasis"><ICLASS="EMPHASIS">wfmode,</I></SPAN>    TMO <SPANCLASS="emphasis"><ICLASS="EMPHASIS">tmout</I></SPAN> )</PRE></TD></TR></TABLE><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">ER <TTCLASS="FUNCTION">ref_flg</TT>(     T_RFLG *<SPANCLASS="emphasis"><ICLASS="EMPHASIS">pk_rflg,</I></SPAN>    ID <SPANCLASS="emphasis"><ICLASS="EMPHASIS">flgid</I></SPAN> )</PRE></TD></TR></TABLE><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">ER <TTCLASS="FUNCTION">snd_msg</TT>(     ID <SPANCLASS="emphasis"><ICLASS="EMPHASIS">mbxid,</I></SPAN>    T_MSG <SPANCLASS="emphasis"><ICLASS="EMPHASIS">*pk_msg</I></SPAN> )</PRE></TD></TR></TABLE><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">ER <TTCLASS="FUNCTION">rcv_msg</TT>(     T_MSG **<SPANCLASS="emphasis"><ICLASS="EMPHASIS">ppk_msg,</I></SPAN>    ID <SPANCLASS="emphasis"><ICLASS="EMPHASIS">mbxid</I></SPAN> )</PRE></TD></TR></TABLE><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">ER <TTCLASS="FUNCTION">prcv_msg</TT>(     T_MSG **<SPANCLASS="emphasis"><ICLASS="EMPHASIS">ppk_msg,</I></SPAN>    ID <SPANCLASS="emphasis"><ICLASS="EMPHASIS">mbxid</I></SPAN> )</PRE></TD></TR></TABLE><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">ER <TTCLASS="FUNCTION">trcv_msg</TT>(     T_MSG **<SPANCLASS="emphasis"><ICLASS="EMPHASIS">ppk_msg,</I></SPAN>    ID <SPANCLASS="emphasis"><ICLASS="EMPHASIS">mbxid ,</I></SPAN>    TMO <SPANCLASS="emphasis"><ICLASS="EMPHASIS">tmout</I></SPAN> )</PRE></TD></TR></TABLE><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">ER <TTCLASS="FUNCTION">ref_mbx</TT>(     T_RMBX *<SPANCLASS="emphasis"><ICLASS="EMPHASIS">pk_rmbx,</I></SPAN>    ID <SPANCLASS="emphasis"><ICLASS="EMPHASIS">mbxid</I></SPAN> )</PRE></TD></TR></TABLE><P>The following functions are supported in this release (withsome restrictions) if enabled with the appropriate configurationoption for the object type (for example <TTCLASS="LITERAL">CYGPKG_UITRON_SEMAS_CREATE_DELETE</TT>):</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">ER <TTCLASS="FUNCTION">cre_sem</TT>(     ID <SPANCLASS="emphasis"><ICLASS="EMPHASIS">semid,</I></SPAN>    T_CSEM *<SPANCLASS="emphasis"><ICLASS="EMPHASIS">pk_csem</I></SPAN> )</PRE></TD></TR></TABLE><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">ER <TTCLASS="FUNCTION">del_sem</TT>(     ID <SPANCLASS="emphasis"><ICLASS="EMPHASIS">semid</I></SPAN> )</PRE></TD></TR></TABLE><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">ER <TTCLASS="FUNCTION">cre_flg</TT>(     ID <SPANCLASS="emphasis"><ICLASS="EMPHASIS">flgid,</I></SPAN>    T_CFLG *<SPANCLASS="emphasis"><ICLASS="EMPHASIS">pk_cflg</I></SPAN> )</PRE></TD></TR></TABLE><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">ER <TTCLASS="FUNCTION">del_flg</TT>(     ID <SPANCLASS="emphasis"><ICLASS="EMPHASIS">flgid</I></SPAN> )</PRE></TD></TR></TABLE><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">ER <TTCLASS="FUNCTION">cre_mbx</TT>(     ID <SPANCLASS="emphasis"><ICLASS="EMPHASIS">mbxid,</I></SPAN>    T_CMBX *<SPANCLASS="emphasis"><ICLASS="EMPHASIS">pk_cmbx</I></SPAN> )</PRE></TD></TR></TABLE><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">ER <TTCLASS="FUNCTION">del_mbx</TT>(     ID <SPANCLASS="emphasis"><ICLASS="EMPHASIS">mbxid</I></SPAN> )</PRE></TD></TR></TABLE><P>In general the queueing order when waiting on a synchronizationobject depends on the underlying kernel configuration. The multi-levelqueue scheduler is required for strict &micro;ITRONconformance and it queues tasks in FIFO order, so requests to createan object with priority queueing of tasks (<TTCLASS="LITERAL">pk_cxxx-&gt;xxxatr = TA_TPRI</TT>)are rejected with E_RSATR. Additional undefined bits inthe attributes fields must be zero. </P><P>In general, extended information (pk_cxxx-&gt;exinf)is ignored. </P><P>For semaphores, the initial semaphore count (pk_csem-&gt;isemcnt)is supported; the new semaphore's count is set. The maximumcount is not supported, and is not in fact defined in type pk_csem. </P><P>For flags, multiple tasks are allowed to wait. Because singletask waiting is a subset of this, the W bit (TA_WMUL) ofthe flag attributes is ignored; all other bits must be zero. Theinitial flag value is supported. </P><P>For mailboxes, the buffer count is defined statically by kernelconfiguration option <TTCLASS="LITERAL">CYGNUM_KERNEL_SYNCH_MBOX_QUEUE_SIZE</TT>;therefore the buffer count field is not supported and is not infact defined in type pk_cmbx. Queueing of messages is FIFOordered only, so TA_MPRI (in pk_cmbx-&gt;mbxatr)is not supported. </P><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="AEN13716">Error checking</H2><P>The following conditions are only checked for, and only returnerrors if <TTCLASS="LITERAL">CYGSEM_UITRON_BAD_PARAMS_RETURN_ERRORS</TT>is enabled:</P><P></P><UL><LI><P>invalid object id; less than 1 or greater than <TTCLASS="LITERAL">CYGNUM_UITRON_TASKS/SEMAS/MBOXES</TT>as appropriate returns E_ID</P></LI><LI><P>dispatching is enabled in any call which can sleep, orE_CTX</P></LI><LI><P>tmout must be positive, otherwise E_PAR</P></LI><LI><P>pk_cxxx pointers in <TTCLASS="FUNCTION">cre_xxx()</TT> must be valid pointers, or E_PAR</P></LI><LI><P>return value pointer in <TTCLASS="FUNCTION">ref_xxx()</TT> is valid pointer, or E_PAR</P></LI><LI><P>flag wait pattern must be non-zero, and mode must be valid,or E_PAR</P></LI><LI><P>return value pointer in flag wait calls is a valid pointer,or E_PAR</P></LI></UL><P>The following conditions are checked for, and can return errorcodes, regardless of the setting of<TTCLASS="LITERAL">CYGSEM_UITRON_BAD_PARAMS_RETURN_ERRORS</TT>:</P><P></P><UL><LI><P>When create and delete functions <TTCLASS="FUNCTION">cre_xxx()</TT> and <TTCLASS="FUNCTION">del_xxx()</TT> are supported, all calls which use a valid object ID number checkthat the object exists. If not, E_NOEXS is returned.</P></LI><LI><P>In create functions <TTCLASS="FUNCTION">cre_xxx()</TT>, when supported, if the object already exists, then E_OBJ</P></LI><LI><P>In any call which can sleep, such as <TTCLASS="FUNCTION">twai_sem()</TT>: return codes E_TMOUT, E_RLWAI, E_DLTor of course E_OK are returned depending on the reasonfor terminating the sleep</P></LI><LI><P>In polling functions such as <TTCLASS="FUNCTION">preq_sem()</TT>return codes E_TMOUT or E_OK are returned dependingon the state of the synchronization object</P></LI><LI><P>In creation functions, the attributes must be compatiblewith the selected underlying kernel configuration: in <TTCLASS="FUNCTION">cre_sem()</TT> <TTCLASS="LITERAL">pk_csem-&gt;sematr</TT> must be equal to <TTCLASS="LITERAL">TA_TFIFO</TT> else E_RSATR.</P></LI><LI><P>In <TTCLASS="FUNCTION">cre_flg()</TT> <TTCLASS="LITERAL">pk_cflg-&gt;flgatr</TT> must be either <TTCLASS="VARNAME">TA_WMUL</TT> or <TTCLASS="VARNAME">TA_WSGL</TT> else <TTCLASS="VARNAME">E_RSATR</TT>.</P></LI><LI><P>In <TTCLASS="FUNCTION">cre_mbx()</TT> <TTCLASS="LITERAL">pk_cmbx-&gt;mbxatr</TT> must be <TTCLASS="LITERAL">TA_TFIFO &#0043; TA_MFIFO</TT> else E_RSATR.</P></LI></UL></DIV></DIV><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLESUMMARY="Footer navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><AHREF="compat-uitron-task-dependent-synch-functions.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="ecos-ref.html"ACCESSKEY="H">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="compat-uitron-extended-sync-comm-functions.html"ACCESSKEY="N">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">Task-Dependent Synchronization Functions</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="compat-uitron-microitron-api.html"ACCESSKEY="U">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">Extended Synchronization and Communication Functions</TD></TR></TABLE></DIV></BODY></HTML>

⌨️ 快捷键说明

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