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

📄 io-eth-call-graph.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>Calling graph for Transmission and Reception</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="Generic Ethernet Device Driver"HREF="io-eth-drv-generic1.html"><LINKREL="PREVIOUS"TITLE="Upper Layer Functions"HREF="io-eth-drv-upper-api.html"><LINKREL="NEXT"TITLE="SNMP"HREF="net-snmp.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="io-eth-drv-upper-api.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom">Chapter 46. Generic Ethernet Device Driver</TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="net-snmp.html"ACCESSKEY="N">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><DIVCLASS="SECT1"><H1CLASS="SECT1"><ANAME="IO-ETH-CALL-GRAPH">Calling graph for Transmission and Reception</H1><P>It may be worth clarifying further the flow of control in the transmit andreceive cases, where the hardware driver does use interrupts and so DSRs totell the &#8220;foreground&#8221; when something asynchronous has occurred.</P><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="IO-ETH-CALL-GRAPH-TX">Transmission</H2><P></P><OLTYPE="1"><LI><P>Some foreground task such as the application, SNMP &#8220;daemon&#8221;,DHCP management thread or whatever, calls into network stack to send apacket, or the stack decides to send a packet in response to incomingtraffic such as a &#8220;ping&#8221; or <SPANCLASS="ACRONYM">ARP</SPAN> request.</P></LI><LI><P>The driver calls the<TTCLASS="FUNCTION"><TTCLASS="REPLACEABLE"><I>HRDWR</I></TT>_can_send()</TT>function in the hardware driver.</P></LI><LI><P><TTCLASS="FUNCTION"><TTCLASS="REPLACEABLE"><I>HRDWR</I></TT>_can_send()</TT>returns the number of available "slots" in which itcan store a pending transmit packet.If it cannot send at this time, the packet is queued outside thehardware driver for later; in this case, the hardware is already busytransmitting, so expect an interrupt as described below for completionof the packet currently outgoing.</P></LI><LI><P>If it can send right now, <TTCLASS="REPLACEABLE"><I>HRDWR</I></TT>_send() is called.<TTCLASS="FUNCTION"><TTCLASS="REPLACEABLE"><I>HRDWR</I></TT>_send()</TT> copies thedata into special hardware buffers, or instructs the hardware to&#8220;send that.&#8221; It also remembers the key that is associated withthis tx request.</P></LI><LI><P>These calls return &#8230; time passes &#8230;</P></LI><LI><P>Asynchronously, the hardware makes an interrupt to say&#8220;transmit is done.&#8221;The ISR quietens the interrupt source in the hardware andrequests that the associated DSR be run.</P></LI><LI><P>The DSR calls (or <SPANCLASS="emphasis"><ICLASS="EMPHASIS">is</I></SPAN>) the<TTCLASS="FUNCTION">eth_drv_dsr()</TT> function in the generic driver.</P></LI><LI><P><TTCLASS="FUNCTION">eth_drv_dsr()</TT> in the generic driver awakens the&#8220;Network Delivery Thread&#8221; which calls the deliver function<TTCLASS="REPLACEABLE"><I>HRDWR</I></TT>_deliver() in the driver.</P></LI><LI><P>The deliver function realizes that a transmit request has completed,and calls the callback tx-done function<TTCLASS="FUNCTION">(sc-&#62;funs-&#62;eth_drv-&#62;tx_done)()</TT>with the same key that it remembered for this tx.</P></LI><LI><P>The callback tx-done functionuses the key to find the resources associated withthis transmit request; thus the stack knows that the transmit hascompleted and its resources can be freed.</P></LI><LI><P>The callback tx-done functionalso enquires whether <TTCLASS="REPLACEABLE"><I>HRDWR</I></TT>_can_send() now says&#8220;yes, we can send&#8221;and if so, dequeues a further transmit requestwhich may have been queued as described above.  If so, then<TTCLASS="REPLACEABLE"><I>HRDWR</I></TT>_send() copies the data into the hardware buffers, orinstructs the hardware to "send that" and remembers the new key, as above.These calls then all return to the &#8220;Network Delivery Thread&#8221;which then sleeps, awaiting the next asynchronous event.</P></LI><LI><P>All done &#8230;</P></LI></OL></DIV><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="IO-ETH-CALL-GRAPH-RX">Receive</H2><P></P><OLTYPE="1"><LI><P>Asynchronously, the hardware makes an interrupt to say&#8220;there is ready data in a receive buffer.&#8221;The ISR quietens the interrupt source in the hardware andrequests that the associated DSR be run.</P></LI><LI><P>The DSR calls (or <SPANCLASS="emphasis"><ICLASS="EMPHASIS">is</I></SPAN>) the<TTCLASS="FUNCTION">eth_drv_dsr()</TT> function in the generic driver.</P></LI><LI><P><TTCLASS="FUNCTION">eth_drv_dsr()</TT> in the generic driver awakens the&#8220;Network Delivery Thread&#8221; which calls the deliver function<TTCLASS="REPLACEABLE"><I>HRDWR</I></TT>_deliver() in the driver.</P></LI><LI><P>The deliver function realizes that there is data ready and callsthe callback receive function<TTCLASS="FUNCTION">(sc-&#62;funs-&#62;eth_drv-&#62;recv)()</TT>to tell it how many bytes to prepare for.</P></LI><LI><P>The callback receive function allocates memory within the stack(eg. <SPANCLASS="TYPE">MBUFs</SPAN> in BSD/Unix style stacks) and preparesa set of scatter-gather buffers that canaccommodate the packet.</P></LI><LI><P>It then calls back into the hardware driver routine<TTCLASS="REPLACEABLE"><I>HRDWR</I></TT>_recv().<TTCLASS="REPLACEABLE"><I>HRDWR</I></TT>_recv() must copy the data from thehardware's buffers into the scatter-gather buffers provided, and return.</P></LI><LI><P>The network stack now has the data in-hand, and does with it what it will.This might include recursive calls to transmit a response packet.When this all is done, these calls return, and the&#8220;Network Delivery Thread&#8221;sleeps once more, awaiting the next asynchronous event.</P></LI></OL></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="io-eth-drv-upper-api.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="net-snmp.html"ACCESSKEY="N">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">Upper Layer Functions</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="io-eth-drv-generic1.html"ACCESSKEY="U">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">SNMP</TD></TR></TABLE></DIV></BODY></HTML>

⌨️ 快捷键说明

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