<!-- Copyright (C) 2003 Red Hat, Inc. -->
|
<!-- Copyright (C) 2003 Red Hat, Inc. -->
|
<!-- This material may be distributed only subject to the terms -->
|
<!-- This material may be distributed only subject to the terms -->
|
<!-- and conditions set forth in the Open Publication License, v1.0 -->
|
<!-- and conditions set forth in the Open Publication License, v1.0 -->
|
<!-- or later (the latest version is presently available at -->
|
<!-- or later (the latest version is presently available at -->
|
<!-- http://www.opencontent.org/openpub/). -->
|
<!-- http://www.opencontent.org/openpub/). -->
|
<!-- Distribution of the work or derivative of the work in any -->
|
<!-- Distribution of the work or derivative of the work in any -->
|
<!-- standard (paper) book form is prohibited unless prior -->
|
<!-- standard (paper) book form is prohibited unless prior -->
|
<!-- permission is obtained from the copyright holder. -->
|
<!-- permission is obtained from the copyright holder. -->
|
<HTML
|
<HTML
|
><HEAD
|
><HEAD
|
><TITLE
|
><TITLE
|
>Introduction</TITLE
|
>Introduction</TITLE
|
><meta name="MSSmartTagsPreventParsing" content="TRUE">
|
><meta name="MSSmartTagsPreventParsing" content="TRUE">
|
<META
|
<META
|
NAME="GENERATOR"
|
NAME="GENERATOR"
|
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
|
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
|
"><LINK
|
"><LINK
|
REL="HOME"
|
REL="HOME"
|
TITLE="eCos Reference Manual"
|
TITLE="eCos Reference Manual"
|
HREF="ecos-ref.html"><LINK
|
HREF="ecos-ref.html"><LINK
|
REL="UP"
|
REL="UP"
|
TITLE="eCos Support for Developing USB-ethernet Peripherals"
|
TITLE="eCos Support for Developing USB-ethernet Peripherals"
|
HREF="io-usb-slave-eth.html"><LINK
|
HREF="io-usb-slave-eth.html"><LINK
|
REL="PREVIOUS"
|
REL="PREVIOUS"
|
TITLE="eCos Support for Developing USB-ethernet Peripherals"
|
TITLE="eCos Support for Developing USB-ethernet Peripherals"
|
HREF="io-usb-slave-eth.html"><LINK
|
HREF="io-usb-slave-eth.html"><LINK
|
REL="NEXT"
|
REL="NEXT"
|
TITLE="Initializing the USB-ethernet Package"
|
TITLE="Initializing the USB-ethernet Package"
|
HREF="usbseth-init.html"></HEAD
|
HREF="usbseth-init.html"></HEAD
|
><BODY
|
><BODY
|
CLASS="REFENTRY"
|
CLASS="REFENTRY"
|
BGCOLOR="#FFFFFF"
|
BGCOLOR="#FFFFFF"
|
TEXT="#000000"
|
TEXT="#000000"
|
LINK="#0000FF"
|
LINK="#0000FF"
|
VLINK="#840084"
|
VLINK="#840084"
|
ALINK="#0000FF"
|
ALINK="#0000FF"
|
><DIV
|
><DIV
|
CLASS="NAVHEADER"
|
CLASS="NAVHEADER"
|
><TABLE
|
><TABLE
|
SUMMARY="Header navigation table"
|
SUMMARY="Header navigation table"
|
WIDTH="100%"
|
WIDTH="100%"
|
BORDER="0"
|
BORDER="0"
|
CELLPADDING="0"
|
CELLPADDING="0"
|
CELLSPACING="0"
|
CELLSPACING="0"
|
><TR
|
><TR
|
><TH
|
><TH
|
COLSPAN="3"
|
COLSPAN="3"
|
ALIGN="center"
|
ALIGN="center"
|
>eCos Reference Manual</TH
|
>eCos Reference Manual</TH
|
></TR
|
></TR
|
><TR
|
><TR
|
><TD
|
><TD
|
WIDTH="10%"
|
WIDTH="10%"
|
ALIGN="left"
|
ALIGN="left"
|
VALIGN="bottom"
|
VALIGN="bottom"
|
><A
|
><A
|
HREF="io-usb-slave-eth.html"
|
HREF="io-usb-slave-eth.html"
|
ACCESSKEY="P"
|
ACCESSKEY="P"
|
>Prev</A
|
>Prev</A
|
></TD
|
></TD
|
><TD
|
><TD
|
WIDTH="80%"
|
WIDTH="80%"
|
ALIGN="center"
|
ALIGN="center"
|
VALIGN="bottom"
|
VALIGN="bottom"
|
></TD
|
></TD
|
><TD
|
><TD
|
WIDTH="10%"
|
WIDTH="10%"
|
ALIGN="right"
|
ALIGN="right"
|
VALIGN="bottom"
|
VALIGN="bottom"
|
><A
|
><A
|
HREF="usbseth-init.html"
|
HREF="usbseth-init.html"
|
ACCESSKEY="N"
|
ACCESSKEY="N"
|
>Next</A
|
>Next</A
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
><HR
|
><HR
|
ALIGN="LEFT"
|
ALIGN="LEFT"
|
WIDTH="100%"></DIV
|
WIDTH="100%"></DIV
|
><H1
|
><H1
|
><A
|
><A
|
NAME="USBSETH-INTRO">Introduction</H1
|
NAME="USBSETH-INTRO">Introduction</H1
|
><DIV
|
><DIV
|
CLASS="REFNAMEDIV"
|
CLASS="REFNAMEDIV"
|
><A
|
><A
|
NAME="AEN17361"
|
NAME="AEN17361"
|
></A
|
></A
|
><H2
|
><H2
|
>Name</H2
|
>Name</H2
|
>Introduction -- eCos support for developing USB ethernet peripherals</DIV
|
>Introduction -- eCos support for developing USB ethernet peripherals</DIV
|
><DIV
|
><DIV
|
CLASS="REFSECT1"
|
CLASS="REFSECT1"
|
><A
|
><A
|
NAME="AEN17364"
|
NAME="AEN17364"
|
></A
|
></A
|
><H2
|
><H2
|
>Introduction</H2
|
>Introduction</H2
|
><P
|
><P
|
>The eCos USB-ethernet package provides additional support for USB
|
>The eCos USB-ethernet package provides additional support for USB
|
peripherals that involve some sort of ethernet-style network. This can
|
peripherals that involve some sort of ethernet-style network. This can
|
be a traditional ethernet, or it can involve some other networking
|
be a traditional ethernet, or it can involve some other networking
|
technology that uses ethernet frames as a unit of transfer. It
|
technology that uses ethernet frames as a unit of transfer. It
|
provides functions to transfer ethernet frames over the USB bus,
|
provides functions to transfer ethernet frames over the USB bus,
|
handles certain control messages from the host, and optionally it can
|
handles certain control messages from the host, and optionally it can
|
provide a network device driver for use by the eCos TCP/IP stack.
|
provide a network device driver for use by the eCos TCP/IP stack.
|
The package comes with an example host-side device driver.</P
|
The package comes with an example host-side device driver.</P
|
><P
|
><P
|
>The USB-ethernet package is not tied to any specific hardware. It
|
>The USB-ethernet package is not tied to any specific hardware. It
|
requires the presence of USB hardware and a suitable device driver,
|
requires the presence of USB hardware and a suitable device driver,
|
but not all USB peripherals involve ethernet communications. Hence the
|
but not all USB peripherals involve ethernet communications. Hence the
|
configuration system cannot load the package automatically for
|
configuration system cannot load the package automatically for
|
specific targets, in the way that a USB device driver or an ethernet
|
specific targets, in the way that a USB device driver or an ethernet
|
driver can be loaded automatically. Instead, the package has to be
|
driver can be loaded automatically. Instead, the package has to be
|
added explicitly. When using the command line tools this will involve
|
added explicitly. When using the command line tools this will involve
|
an operation like the following:</P
|
an operation like the following:</P
|
><TABLE
|
><TABLE
|
BORDER="5"
|
BORDER="5"
|
BGCOLOR="#E0E0F0"
|
BGCOLOR="#E0E0F0"
|
WIDTH="70%"
|
WIDTH="70%"
|
><TR
|
><TR
|
><TD
|
><TD
|
><PRE
|
><PRE
|
CLASS="SCREEN"
|
CLASS="SCREEN"
|
>$ ecosconfig add usbs_eth</PRE
|
>$ ecosconfig add usbs_eth</PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
><P
|
><P
|
>Typically, this will automatically cause the USB device driver to
|
>Typically, this will automatically cause the USB device driver to
|
become active. Loading the USB-ethernet package automatically provides
|
become active. Loading the USB-ethernet package automatically provides
|
functionality for <A
|
functionality for <A
|
HREF="usbseth-init.html"
|
HREF="usbseth-init.html"
|
>initialization</A
|
>initialization</A
|
>,
|
>,
|
<A
|
<A
|
HREF="usbseth-data.html"
|
HREF="usbseth-data.html"
|
>data transfer</A
|
>data transfer</A
|
>, and the handling of
|
>, and the handling of
|
<A
|
<A
|
HREF="usbseth-control.html"
|
HREF="usbseth-control.html"
|
>control messages</A
|
>control messages</A
|
> and state
|
> and state
|
changes. If the current configuration includes the eCos TCP/IP stack
|
changes. If the current configuration includes the eCos TCP/IP stack
|
then the <A
|
then the <A
|
HREF="usbseth-netdev.html"
|
HREF="usbseth-netdev.html"
|
>network device driver</A
|
>network device driver</A
|
>
|
>
|
support will be enabled as well by default, allowing the stack to
|
support will be enabled as well by default, allowing the stack to
|
exchange ethernet frames over the USB bus.</P
|
exchange ethernet frames over the USB bus.</P
|
><P
|
><P
|
>There is a USB standard for a class of communication devices including
|
>There is a USB standard for a class of communication devices including
|
ethernet. The package does not implement this standard, due to
|
ethernet. The package does not implement this standard, due to
|
limitations in the hardware for which the package was first developed.
|
limitations in the hardware for which the package was first developed.
|
Instead, the package uses its own <A
|
Instead, the package uses its own <A
|
HREF="usbseth-protocol.html"
|
HREF="usbseth-protocol.html"
|
>protocol</A
|
>protocol</A
|
> between USB
|
> between USB
|
<A
|
<A
|
HREF="usbseth-host.html"
|
HREF="usbseth-host.html"
|
>host device driver</A
|
>host device driver</A
|
> and the
|
> and the
|
peripheral. </P
|
peripheral. </P
|
></DIV
|
></DIV
|
><DIV
|
><DIV
|
CLASS="REFSECT1"
|
CLASS="REFSECT1"
|
><A
|
><A
|
NAME="AEN17377"
|
NAME="AEN17377"
|
></A
|
></A
|
><H2
|
><H2
|
>Usage Scenarios</H2
|
>Usage Scenarios</H2
|
><P
|
><P
|
>The USB-ethernet package can be used several different scenarios. In
|
>The USB-ethernet package can be used several different scenarios. In
|
a simple scenario, the peripheral serves only to connect the USB host
|
a simple scenario, the peripheral serves only to connect the USB host
|
to a suitable network:</P
|
to a suitable network:</P
|
><DIV
|
><DIV
|
CLASS="INFORMALFIGURE"
|
CLASS="INFORMALFIGURE"
|
><A
|
><A
|
NAME="AEN17380"><P
|
NAME="AEN17380"><P
|
></P
|
></P
|
><DIV
|
><DIV
|
CLASS="MEDIAOBJECT"
|
CLASS="MEDIAOBJECT"
|
><P
|
><P
|
><IMG
|
><IMG
|
SRC="simple.png"
|
SRC="simple.png"
|
ALIGN="CENTER"></P
|
ALIGN="CENTER"></P
|
></DIV
|
></DIV
|
><P
|
><P
|
></P
|
></P
|
></DIV
|
></DIV
|
><P
|
><P
|
>After initialization, and once the USB connection between host and
|
>After initialization, and once the USB connection between host and
|
peripheral has been established, higher-level code needs to detect
|
peripheral has been established, higher-level code needs to detect
|
packets that are intended for the host, and to forward these. This can
|
packets that are intended for the host, and to forward these. This can
|
be achieved by the low-level <TT
|
be achieved by the low-level <TT
|
CLASS="FUNCTION"
|
CLASS="FUNCTION"
|
>usbs_eth_start_tx</TT
|
>usbs_eth_start_tx</TT
|
>
|
>
|
function. Similarly, higher-level code needs to detect packets coming
|
function. Similarly, higher-level code needs to detect packets coming
|
from the host, using <TT
|
from the host, using <TT
|
CLASS="FUNCTION"
|
CLASS="FUNCTION"
|
>usbs_eth_start_rx</TT
|
>usbs_eth_start_rx</TT
|
>, and to
|
>, and to
|
forward these using the real network. As far as the host is concerned
|
forward these using the real network. As far as the host is concerned
|
it is connected directly to the network. In this scenario there is no
|
it is connected directly to the network. In this scenario there is no
|
confusion about addresses: there is a single MAC address for the
|
confusion about addresses: there is a single MAC address for the
|
host/peripheral combination, corresponding to the connection to the
|
host/peripheral combination, corresponding to the connection to the
|
real network, and it is this address which should be supplied during
|
real network, and it is this address which should be supplied during
|
<A
|
<A
|
HREF="usbseth-init.html"
|
HREF="usbseth-init.html"
|
>initialization</A
|
>initialization</A
|
>.</P
|
>.</P
|
><P
|
><P
|
>In a more complicated scenario, there is a TCP/IP stack running inside
|
>In a more complicated scenario, there is a TCP/IP stack running inside
|
the peripheral.</P
|
the peripheral.</P
|
><DIV
|
><DIV
|
CLASS="INFORMALFIGURE"
|
CLASS="INFORMALFIGURE"
|
><A
|
><A
|
NAME="AEN17389"><P
|
NAME="AEN17389"><P
|
></P
|
></P
|
><DIV
|
><DIV
|
CLASS="MEDIAOBJECT"
|
CLASS="MEDIAOBJECT"
|
><P
|
><P
|
><IMG
|
><IMG
|
SRC="tcpip.png"
|
SRC="tcpip.png"
|
ALIGN="CENTER"></P
|
ALIGN="CENTER"></P
|
></DIV
|
></DIV
|
><P
|
><P
|
></P
|
></P
|
></DIV
|
></DIV
|
><P
|
><P
|
>This involves the USB-ethernet package providing a service both to the
|
>This involves the USB-ethernet package providing a service both to the
|
host and to the eCos TCP/IP stack. It achieves the latter by acting as
|
host and to the eCos TCP/IP stack. It achieves the latter by acting as
|
an eCos network device. Typically, the TCP/IP stack will be configured
|
an eCos network device. Typically, the TCP/IP stack will be configured
|
to act as a network bridge. The USB peripheral needs to examine the
|
to act as a network bridge. The USB peripheral needs to examine the
|
packets arriving over the real network. Some of these packets will be
|
packets arriving over the real network. Some of these packets will be
|
intended for the host, while others will be intended for the
|
intended for the host, while others will be intended for the
|
peripheral itself. To distinguish between these two scenarios, two
|
peripheral itself. To distinguish between these two scenarios, two
|
distinct MAC addresses are needed: one for the host, and one for the
|
distinct MAC addresses are needed: one for the host, and one for the
|
peripheral. Similarly, packets sent by the host may have to be
|
peripheral. Similarly, packets sent by the host may have to be
|
forwarded via the real network, or they may be intended for the TCP/IP
|
forwarded via the real network, or they may be intended for the TCP/IP
|
stack inside the peripheral. Packets generated inside the peripheral's
|
stack inside the peripheral. Packets generated inside the peripheral's
|
TCP/IP stack may need to be sent via the real network or over the USB
|
TCP/IP stack may need to be sent via the real network or over the USB
|
bus. The network bridge software will have to take care of all these
|
bus. The network bridge software will have to take care of all these
|
possibilities. Unusually for a network bridge, one of the network
|
possibilities. Unusually for a network bridge, one of the network
|
segments being bridged will only ever have one machine attached.</P
|
segments being bridged will only ever have one machine attached.</P
|
><P
|
><P
|
>There are other possible usage scenarios. For example, the peripheral
|
>There are other possible usage scenarios. For example, the peripheral
|
might not be attached to a real network at all. Instead it could be
|
might not be attached to a real network at all. Instead it could be
|
the USB host that acts as a network bridge, allowing a TCP/IP stack
|
the USB host that acts as a network bridge, allowing a TCP/IP stack
|
inside the peripheral to communicate with the outside world. The
|
inside the peripheral to communicate with the outside world. The
|
various details will depend on the exact type of peripheral being
|
various details will depend on the exact type of peripheral being
|
developed. </P
|
developed. </P
|
></DIV
|
></DIV
|
><DIV
|
><DIV
|
CLASS="NAVFOOTER"
|
CLASS="NAVFOOTER"
|
><HR
|
><HR
|
ALIGN="LEFT"
|
ALIGN="LEFT"
|
WIDTH="100%"><TABLE
|
WIDTH="100%"><TABLE
|
SUMMARY="Footer navigation table"
|
SUMMARY="Footer navigation table"
|
WIDTH="100%"
|
WIDTH="100%"
|
BORDER="0"
|
BORDER="0"
|
CELLPADDING="0"
|
CELLPADDING="0"
|
CELLSPACING="0"
|
CELLSPACING="0"
|
><TR
|
><TR
|
><TD
|
><TD
|
WIDTH="33%"
|
WIDTH="33%"
|
ALIGN="left"
|
ALIGN="left"
|
VALIGN="top"
|
VALIGN="top"
|
><A
|
><A
|
HREF="io-usb-slave-eth.html"
|
HREF="io-usb-slave-eth.html"
|
ACCESSKEY="P"
|
ACCESSKEY="P"
|
>Prev</A
|
>Prev</A
|
></TD
|
></TD
|
><TD
|
><TD
|
WIDTH="34%"
|
WIDTH="34%"
|
ALIGN="center"
|
ALIGN="center"
|
VALIGN="top"
|
VALIGN="top"
|
><A
|
><A
|
HREF="ecos-ref.html"
|
HREF="ecos-ref.html"
|
ACCESSKEY="H"
|
ACCESSKEY="H"
|
>Home</A
|
>Home</A
|
></TD
|
></TD
|
><TD
|
><TD
|
WIDTH="33%"
|
WIDTH="33%"
|
ALIGN="right"
|
ALIGN="right"
|
VALIGN="top"
|
VALIGN="top"
|
><A
|
><A
|
HREF="usbseth-init.html"
|
HREF="usbseth-init.html"
|
ACCESSKEY="N"
|
ACCESSKEY="N"
|
>Next</A
|
>Next</A
|
></TD
|
></TD
|
></TR
|
></TR
|
><TR
|
><TR
|
><TD
|
><TD
|
WIDTH="33%"
|
WIDTH="33%"
|
ALIGN="left"
|
ALIGN="left"
|
VALIGN="top"
|
VALIGN="top"
|
>eCos Support for Developing USB-ethernet Peripherals</TD
|
>eCos Support for Developing USB-ethernet Peripherals</TD
|
><TD
|
><TD
|
WIDTH="34%"
|
WIDTH="34%"
|
ALIGN="center"
|
ALIGN="center"
|
VALIGN="top"
|
VALIGN="top"
|
><A
|
><A
|
HREF="io-usb-slave-eth.html"
|
HREF="io-usb-slave-eth.html"
|
ACCESSKEY="U"
|
ACCESSKEY="U"
|
>Up</A
|
>Up</A
|
></TD
|
></TD
|
><TD
|
><TD
|
WIDTH="33%"
|
WIDTH="33%"
|
ALIGN="right"
|
ALIGN="right"
|
VALIGN="top"
|
VALIGN="top"
|
>Initializing the USB-ethernet Package</TD
|
>Initializing the USB-ethernet Package</TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
></DIV
|
></DIV
|
></BODY
|
></BODY
|
></HTML
|
></HTML
|
|
|