1 <!-- Copyright (C) 2003 Red Hat, Inc. -->
2 <!-- This material may be distributed only subject to the terms -->
3 <!-- and conditions set forth in the Open Publication License, v1.0 -->
4 <!-- or later (the latest version is presently available at -->
5 <!-- http://www.opencontent.org/openpub/). -->
6 <!-- Distribution of the work or derivative of the work in any -->
7 <!-- standard (paper) book form is prohibited unless prior -->
8 <!-- permission is obtained from the copyright holder. -->
12 >Upper Layer Functions</TITLE
13 ><meta name="MSSmartTagsPreventParsing" content="TRUE">
16 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
19 TITLE="eCos Reference Manual"
20 HREF="ecos-ref.html"><LINK
22 TITLE="Generic Ethernet Device Driver"
23 HREF="io-eth-drv-generic1.html"><LINK
25 TITLE="Review of the functions"
26 HREF="io-eth-drv-api-funcs.html"><LINK
28 TITLE="Calling graph for Transmission and Reception"
29 HREF="io-eth-call-graph.html"></HEAD
40 SUMMARY="Header navigation table"
49 >eCos Reference Manual</TH
57 HREF="io-eth-drv-api-funcs.html"
65 >Chapter 46. Generic Ethernet Device Driver</TD
71 HREF="io-eth-call-graph.html"
85 NAME="IO-ETH-DRV-UPPER-API">Upper Layer Functions</H1
87 >Upper layer functions are called by drivers to deliver received packets
88 or transmission completion status back up into the network stack.</P
90 >These functions are defined by the hardware independent upper layers of
91 the networking driver support. They are present to hide the interfaces
92 to the actual networking stack so that the hardware drivers may
93 be used by different network stack implementations without change.</P
95 >These functions require a pointer to a <SPAN
97 >struct eth_drv_sc</SPAN
99 which describes the interface at a logical level. It is assumed that the
100 low level hardware driver will keep track of this pointer so
101 it may be passed “up” as appropriate.</P
107 NAME="IO-ETH-DRV-UPPER-INIT">Callback Init function</H2
116 CLASS="PROGRAMLISTING"
117 >void (sc->funs->eth_drv->init)(
118 struct eth_drv_sc *sc, unsigned char *enaddr)</PRE
123 This function establishes the device at initialization time.
124 It should be called once per device instance only, from the
125 initialization function, if all is well
127 HREF="io-eth-drv-api-funcs.html#IO-ETH-DRV-API-INIT"
128 >the Section called <I
132 The hardware should be totally initialized
139 > “started”)
140 when this function is called.</P
147 NAME="IO-ETH-DRV-TX-DONE">Callback Tx-Done function</H2
156 CLASS="PROGRAMLISTING"
157 >void (sc->funs->eth_drv->tx_done)(
158 struct eth_drv_sc *sc,
159 unsigned long key, int status)</PRE
164 This function is called when a packet completes transmission on the
171 value must be one of the keys provided to
187 (details currently undefined) to indicate that an error occurred during the
188 transmission, and zero if all was well.</P
190 >It should be called from the deliver function
192 HREF="io-eth-drv-api-funcs.html#IO-ETH-DRV-API-DELIVER"
193 >the Section called <I
199 HREF="io-eth-drv-api-funcs.html#IO-ETH-DRV-API-POLL"
200 >the Section called <I
210 NAME="IO-ETH-DRV-UPPER-RECV">Callback Receive function</H2
219 CLASS="PROGRAMLISTING"
220 >void (sc->funs->eth_drv->recv)(struct eth_drv_sc *sc, int len)</PRE
225 This function is called to indicate that a packet of length
232 arrived at the interface.
243 described above will be used to actually unload the data from the
244 interface into buffers used by the device independent layers.</P
246 >It should be called from the deliver function
248 HREF="io-eth-drv-api-funcs.html#IO-ETH-DRV-API-DELIVER"
249 >the Section called <I
255 HREF="io-eth-drv-api-funcs.html#IO-ETH-DRV-API-POLL"
256 >the Section called <I
267 SUMMARY="Footer navigation table"
278 HREF="io-eth-drv-api-funcs.html"
296 HREF="io-eth-call-graph.html"
306 >Review of the functions</TD
312 HREF="io-eth-drv-generic1.html"
320 >Calling graph for Transmission and Reception</TD