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

📄 21ic ucos+lwip应用心得[社区].htm

📁 44b0+lwip
💻 HTM
📖 第 1 页 / 共 3 页
字号:
            (h != NULL) 
            {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;h(arg);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//因为定时事件中的定时时间到或者是因为sys_arch_mbo_fetch超时到而执行到<BR>//这里,返回本函数开头重新等待mbox的消息<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;goto 
            again;<BR>&nbsp;&nbsp;&nbsp;&nbsp;} else 
            {<BR>&nbsp;&nbsp;&nbsp;&nbsp;//如果sys_arch_mbox_fetch无超时收到消息返回<BR>//则刷新定时事件链表中定时事件的time值.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if 
            (time &lt;= timeouts-&gt;next-&gt;time) 
            {<BR>&nbsp;&nbsp;timeouts-&gt;next-&gt;time -= 
            time;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} else 
            {<BR>&nbsp;&nbsp;timeouts-&gt;next-&gt;time = 
            0;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR><BR>&nbsp;&nbsp;}<BR>}<BR><BR>u32_t&nbsp;&nbsp;sys_arch_mbox_fetch(sys_mbox_t 
            mbox, void **data, u32_t 
            timeout)<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;u32_t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ucErr;<BR>&nbsp;&nbsp;&nbsp;&nbsp;u16_t 
            ucos_timeout;<BR>&nbsp;&nbsp;//在 lwip中 
            ,timeout的单位是ms&nbsp;&nbsp;<BR>&nbsp;&nbsp;// 在ucosII ,timeout 
            的单位是timer tick <BR>&nbsp;&nbsp;&nbsp;ucos_timeout = 
            0;<BR>&nbsp;&nbsp;if(timeout != 0){<BR>&nbsp;&nbsp;ucos_timeout = 
            (timeout )*( OS_TICKS_PER_SEC/1000);<BR>&nbsp;&nbsp;if(ucos_timeout 
            &lt; 1)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ucos_timeout = 
            1;<BR>&nbsp;&nbsp;else if(ucos_timeout &gt; 
            65535)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ucos_timeout = 
            65535;<BR>&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;//如果data!=NULL就返回消息指针,<BR>&nbsp;&nbsp;if(data 
            != NULL){<BR>&nbsp;&nbsp;&nbsp;&nbsp;*data = OSQPend( mbox-&gt;pQ, 
            (u16_t)ucos_timeout, &amp;ucErr 
            );&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;}else{<BR>&nbsp;&nbsp;&nbsp;&nbsp;OSQPend(mbox-&gt;pQ,(u16_t)ucos_timeout,&amp;ucErr);<BR>&nbsp;&nbsp;}<BR>//这里修改了ucos中的OSQPend系统调用, 
            <BR>//原来的void&nbsp;&nbsp;*OSQPend (OS_EVENT *pevent, INT16U timeout, 
            INT8U *err)<BR>// 
            err的返回值只有两种:收到消息就返回OS_NO_ERR,超时则返回OS_TIMEOUT<BR>//这里先将err从8位数据改变成了16位数据 
            OSQPend(*pevent,timeout, INT16U 
            *err)<BR>//重新定义了OS_TIMEOUT<BR>//在ucos中原有#define OS_TIMEOUT 
            20<BR>//改为 
            #define&nbsp;&nbsp;OS_TIMEOUT&nbsp;&nbsp;-1<BR>//err返回值的意义也改变了,如果超时返回OS_TIMEOUT<BR>// 
            如果收到消息,则返回OSTCBCur-&gt;OSTCBDly修改部分代码如下<BR>//if (msg != (void *)0) { 
            /* Did we get a message?&nbsp;&nbsp;*/<BR>// OSTCBCur-&gt;OSTCBMsg = 
            (void *)0;<BR>// 
            OSTCBCur-&gt;OSTCBStat&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;= 
            OS_STAT_RDY;<BR>// OSTCBCur-&gt;OSTCBEventPtr = (OS_EVENT *)0;<BR>// 
            *err = OSTCBCur-&gt;OSTCBDly;// zhangzs 
            @2003.12.12<BR>//&nbsp;&nbsp;&nbsp;&nbsp;OS_EXIT_CRITICAL();<BR>// 
            return (msg);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* Return message 
            received 
            */<BR>//&nbsp;&nbsp;&nbsp;&nbsp;}<BR>//关于ucos的OSTBCur-&gt;OSTCBDly的含义请查阅ucos的书籍<BR>&nbsp;&nbsp;if( 
            ucErr == OS_TIMEOUT ) 
            {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;timeout = 
            SYS_ARCH_TIMEOUT;<BR>&nbsp;&nbsp;&nbsp;&nbsp;} else 
            {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(*data == 
            (void*)&amp;pvNullPointer ) 
            <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*data = 
            NULL;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//单位转换,从ucos 
            tick-&gt;ms<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;timeout = 
            (ucos_timeout -ucErr)*(1000/ 
            OS_TICKS_PER_SEC);<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;return 
            timeout;<BR>}<BR>semaphone的实现和mbox类似,这里就不再重复了.<BR>&nbsp;</P>
            <P></P></DIV></TD></TR>
        <TR>
          <TD align=middle height=15>
            <TABLE cellSpacing=0 cellPadding=0 align=center border=0>
              <TBODY>
              <TR>
                <TD>
                  <DIV></DIV></TD></TR></TBODY></TABLE></TD></TR>
        <TR>
          <TD align=right height=2>
            <TABLE cellSpacing=0 cellPadding=0 width="80%" border=0>
              <TBODY>
              <TR>
                <TD width=75>【<A href="javascript:doPrint();">打印本稿</A>】</TD>
                <TD width=8></TD>
                <TD width=75>
                  <P>【<A 
                  href="http://www.21ic.com/new_info/news/review.asp?title=ucos+lwip应用心得[社区]target=" 
                  _blank?>发表评论</A>】</P></TD>
                <TD width=10></TD>
                <TD width=79>【<A 
                  href="http://www.21ic.com/new_info/news/sendmail.asp?num=ucos+lwip应用心得[社区]">推荐</A>】</TD></TR></TBODY></TABLE></TD></TR>
        <TR>
          <TD align=right height=2></TD></TR>
        <TR>
          <TD align=right height=2><A href="javascript:window.close();"><IMG 
            height=20 src="21IC ucos+lwip应用心得[社区].files/close_c.gif" width=77 
            border=0 name=Image161></A><FONT 
        color=#ffffff>----</FONT></TD></TR></TBODY></TABLE><BR><BR>
      <TABLE cellSpacing=0 cellPadding=0 width=520 align=center border=0>
        <TBODY>
        <TR>
          <TD vAlign=bottom align=middle width=114 bgColor=#999a76 
            height=1><IMG height=1 src="21IC ucos+lwip应用心得[社区].files/blank.gif" 
            width=1></TD>
          <TD width=466 height=1></TD></TR>
        <TR>
          <TD align=middle width=114 bgColor=#ece8db height=19>相关新闻</TD>
          <TD width=466 height=19></TD></TR>
        <TR bgColor=#999a76>
          <TD colSpan=2 height=1><IMG height=1 
            src="21IC ucos+lwip应用心得[社区].files/blank.gif" width=1></TD></TR>
        <TR>
          <TD colSpan=2 height=1></TD></TR></TBODY></TABLE>
      <TABLE borderColor=#000000 cellSpacing=0 cellPadding=0 width=520 
      align=center border=0>
        <TBODY>
        <TR>
          <TD vAlign=top>
            <TABLE class=RelatedTable width="100%" border=0>
              <TBODY>
              <TR class=RelatedTr>
                <TD class=RelatedTd>
                  <SCRIPT language=javascript 
                  src="21IC ucos+lwip应用心得[社区].files/about.htm"></SCRIPT>
                </TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE><BR></TD>
    <TD vAlign=top align=middle width=150 bgColor=#ece8db height=2>
      <TABLE cellSpacing=0 cellPadding=1 width="100%" border=0>
        <TBODY>
        <TR>
          <TD bgColor=#000000>
            <TABLE cellSpacing=0 cellPadding=2 width=150 bgColor=#ece8db 
            border=0>
              <TBODY>
              <TR>
                <TD>
                  <META content="Microsoft FrontPage 5.0" name=GENERATOR>
                  <META content=FrontPage.Editor.Document 
                  name=ProgId><BR>嵌入式系统<BR><A href="http://www.embedon.com/" 
                  target=blank>远峰</A> <BR><A 
                  href="http://www.21ic.com/custom/jhb/index.htm" 
                  target=blank>复旦金海博</A><BR><A 
                  href="http://www.emdoor.com/index.asp" 
                  target=blank>亿道</A><BR><A 
                  href="http://www.zlgmcu.com/philips/philips-arm.asp" 
                  target=blank>周立功</A><BR><BR>单片机 <BR><BR><A 
                  href="http://www.hk.renesas.com/" 
                  target=blank>Renesas</A><BR><A 
                  href="http://www.baite-group.com/chinese_simple/index.htm">百特(Atmel 
                  ARM)</A><BR><A 
                  href="http://www.21ic.com.cn/ads/adsclick.asp?id=75">Atmel 
                  (北天星)</A><BR><A 
                  href="http://www.zlgmcu.com/tools/kaifaban.asp" 
                  target=blank>周立功 Philips</A> <BR><A 
                  href="http://www.strong-ic.com/" target=blank>胜创特</A> <BR><A 
                  href="http://www.holtek.com.tw/" target=blank>盛群 Holtek</A> 
                  <BR><A href="http://www.xhl.com.cn/" 
                  target=blank>Cygnal单片机</A><BR><A href="http://www.lierda.com/" 
                  target=blank>利尔达MSP430</A> <BR><BR>接口电路:<BR><BR><A 
                  href="http://www.whjmw.com/" target=blank>金迈威</A> <BR><A 
                  href="http://www.21ic.com/custom/maiwei/mw.htm" 
                  target=blank>迈威</A> <BR><A href="http://www.rs232.net.cn/" 
                  target=_blank>瑞赛特</A><BR><A href="http://www.zlgmcu.com/" 
                  target=_blank>周立功USB,CAN,Lin,I2CBus</A><BR><BR><BR>存储器<BR><A 
                  href="http://www.huazhoucn.com/" 
                  target=blank>铁电存储器免费样品</A><BR><A 
                  href="http://www.21ic.com.cn/ads/adsclick.asp?id=75" 
                  target=_blank>北天星</A> <BR><BR>制版系统<BR><A 
                  href="http://www.whlongrun.com/1jieshao/index.htm" 
                  target=_blank>武汉隆润</A> <BR><BR>模拟器件<BR><A 
                  href="http://www.unique-ap.com.cn/" 
                  target=blank>Linear</A><BR><BR><BR>编程器<BR><A 
                  href="http://www.xeltek.com.cn/" target=blank>西尔特编程器</A><BR><A 
                  href="http://www.zlgmcu.com/tools/bianchengqi.asp" 
                  target=blank>周立功编程器</A><BR></TD></TR>
              <TR>
                <TD 
  height=5></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=766 align=center border=0>
  <TBODY>
  <TR>
    <TD vAlign=top colSpan=6></TD></TR>
  <TR>
    <TD vAlign=top colSpan=6 height=10></TD></TR>
  <TR>
    <TD vAlign=top bgColor=#999999 colSpan=6 height=2></TD></TR>
  <TR>
    <TD class=stxt vAlign=center align=middle colSpan=6 
height=6></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=766 align=center border=0>
  <TBODY>
  <TR>
    <TD class=s width=973 height=12></TD></TR>
  <TR>
    <TD class=s width=973 height=20>
      <DIV align=center><FONT face="Arial, Helvetica, sans-serif"><!--start copyright-->
      <DIV align=center><FONT color=black>
      <TABLE cellSpacing=0 cellPadding=0 width=600 align=center border=0>
        <TBODY>
        <TR>
          <TD align=middle width="100%" colSpan=2><BR>Better View:800*600 Best 
            View:1024x768 为了本系统能够更好的为您服务,请使用IE4.0或以上版本浏览器 
            <BR><BR>版权所有(C)21IC中国电子网 电话:010-82357510, 82357511 传真: 010-82357512 
          </TD></TR></TBODY></TABLE><!--start copyright--></FONT></DIV></FONT></DIV></TD></TR></TBODY></TABLE><BR></BODY></HTML>

⌨️ 快捷键说明

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