OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [doc/] [html/] [ref/] [usbseth-control.html] - Diff between revs 28 and 174

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 28 Rev 174
<!-- 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
>USB-ethernet State Handling</TITLE
>USB-ethernet State Handling</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="USB-ethernet Data Transfers"
TITLE="USB-ethernet Data Transfers"
HREF="usbseth-data.html"><LINK
HREF="usbseth-data.html"><LINK
REL="NEXT"
REL="NEXT"
TITLE="Network Device for the eCos TCP/IP Stack"
TITLE="Network Device for the eCos TCP/IP Stack"
HREF="usbseth-netdev.html"></HEAD
HREF="usbseth-netdev.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="usbseth-data.html"
HREF="usbseth-data.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-netdev.html"
HREF="usbseth-netdev.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-CONTROL">USB-ethernet State Handling</H1
NAME="USBSETH-CONTROL">USB-ethernet State Handling</H1
><DIV
><DIV
CLASS="REFNAMEDIV"
CLASS="REFNAMEDIV"
><A
><A
NAME="AEN17514"
NAME="AEN17514"
></A
></A
><H2
><H2
>Name</H2
>Name</H2
>USB-ethernet State Handling&nbsp;--&nbsp;Maintaining the USB-ethernet connection with the host</DIV
>USB-ethernet State Handling&nbsp;--&nbsp;Maintaining the USB-ethernet connection with the host</DIV
><DIV
><DIV
CLASS="REFSYNOPSISDIV"
CLASS="REFSYNOPSISDIV"
><A
><A
NAME="AEN17517"><H2
NAME="AEN17517"><H2
>Synopsis</H2
>Synopsis</H2
><DIV
><DIV
CLASS="FUNCSYNOPSIS"
CLASS="FUNCSYNOPSIS"
><A
><A
NAME="AEN17518"><P
NAME="AEN17518"><P
></P
></P
><TABLE
><TABLE
BORDER="5"
BORDER="5"
BGCOLOR="#E0E0F0"
BGCOLOR="#E0E0F0"
WIDTH="70%"
WIDTH="70%"
><TR
><TR
><TD
><TD
><PRE
><PRE
CLASS="FUNCSYNOPSISINFO"
CLASS="FUNCSYNOPSISINFO"
>#include &lt;cyg/io/usb/usbs_eth.h&gt;</PRE
>#include &lt;cyg/io/usb/usbs_eth.h&gt;</PRE
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><P
><P
><CODE
><CODE
><CODE
><CODE
CLASS="FUNCDEF"
CLASS="FUNCDEF"
>usbs_control_return usbs_eth_class_control_handler</CODE
>usbs_control_return usbs_eth_class_control_handler</CODE
>(usbs_control_endpoint* ep0, void* callback_data);</CODE
>(usbs_control_endpoint* ep0, void* callback_data);</CODE
></P
></P
><P
><P
><CODE
><CODE
><CODE
><CODE
CLASS="FUNCDEF"
CLASS="FUNCDEF"
>void usbs_eth_state_change_handler</CODE
>void usbs_eth_state_change_handler</CODE
>(usbs_control_endpoint* ep0, void* callback_data, usbs_state_change change, int old_state);</CODE
>(usbs_control_endpoint* ep0, void* callback_data, usbs_state_change change, int old_state);</CODE
></P
></P
><P
><P
><CODE
><CODE
><CODE
><CODE
CLASS="FUNCDEF"
CLASS="FUNCDEF"
>void usbs_eth_disable</CODE
>void usbs_eth_disable</CODE
>(usbs_eth* usbseth&#62;);</CODE
>(usbs_eth* usbseth&#62;);</CODE
></P
></P
><P
><P
><CODE
><CODE
><CODE
><CODE
CLASS="FUNCDEF"
CLASS="FUNCDEF"
>void usbs_eth_enable</CODE
>void usbs_eth_enable</CODE
>(usbs_eth* usbseth&#62;);</CODE
>(usbs_eth* usbseth&#62;);</CODE
></P
></P
><P
><P
></P
></P
></DIV
></DIV
></DIV
></DIV
><DIV
><DIV
CLASS="REFSECT1"
CLASS="REFSECT1"
><A
><A
NAME="AEN17548"
NAME="AEN17548"
></A
></A
><H2
><H2
>Description</H2
>Description</H2
><P
><P
>When the USB-ethernet package is initialized by a call to <A
>When the USB-ethernet package is initialized by a call to <A
HREF="usbseth-init.html"
HREF="usbseth-init.html"
><TT
><TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>usbs_eth_init</TT
>usbs_eth_init</TT
></A
></A
> it
> it
installs <TT
installs <TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>usbs_eth_state_change_handler</TT
>usbs_eth_state_change_handler</TT
> to handle
> to handle
USB state changes. This allows the package to detect when the
USB state changes. This allows the package to detect when the
connection between the host and the peripheral is established or
connection between the host and the peripheral is established or
broken, resulting in internal calls to
broken, resulting in internal calls to
<TT
<TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>usbs_eth_enable</TT
>usbs_eth_enable</TT
> and
> and
<TT
<TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>usbs_eth_disable</TT
>usbs_eth_disable</TT
> respectively. This is
> respectively. This is
appropriate if no other code needs to access the USB device. However,
appropriate if no other code needs to access the USB device. However,
if there is other code, either other USB-related packages or the
if there is other code, either other USB-related packages or the
application itself, that needs to perform I/O over the USB bus, then
application itself, that needs to perform I/O over the USB bus, then
typically the USB-ethernet package should not have exclusive access to
typically the USB-ethernet package should not have exclusive access to
state change events. Instead, the assumption is that higher-level
state change events. Instead, the assumption is that higher-level
code, typically provided by the application, will install an
code, typically provided by the application, will install an
alternative state change handler in the control endpoint data
alternative state change handler in the control endpoint data
structure after the call to <TT
structure after the call to <TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>usbs_eth_init</TT
>usbs_eth_init</TT
>. This
>. This
alternative handler will either chain into
alternative handler will either chain into
<TT
<TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>usbs_eth_state_change_handler</TT
>usbs_eth_state_change_handler</TT
> when appropriate,
> when appropriate,
or else it will invoke <TT
or else it will invoke <TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>usbs_eth_enable</TT
>usbs_eth_enable</TT
> and
> and
<TT
<TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>usbs_eth_disable</TT
>usbs_eth_disable</TT
> directly. For further details of
> directly. For further details of
state change handlers and control endpoints generally, see the
state change handlers and control endpoints generally, see the
documentation for the common USB-slave package.</P
documentation for the common USB-slave package.</P
><P
><P
>Similarly, <TT
>Similarly, <TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>usbs_eth_init</TT
>usbs_eth_init</TT
> will install
> will install
<TT
<TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>usbs_eth_class_control_handler</TT
>usbs_eth_class_control_handler</TT
> in the control
> in the control
endpoint data structure as the appropriate handler for class-specific
endpoint data structure as the appropriate handler for class-specific
USB control messages. This code will handle the ethernet-specific
USB control messages. This code will handle the ethernet-specific
<A
<A
HREF="usbseth-protocol.html"
HREF="usbseth-protocol.html"
>control messages </A
>control messages </A
>, for example
>, for example
requests by the host to enable or disable promiscuous mode or to
requests by the host to enable or disable promiscuous mode or to
obtain the MAC address. If the USB device is not shared with any other
obtain the MAC address. If the USB device is not shared with any other
code then this is both necessary and sufficient. However, if other code
code then this is both necessary and sufficient. However, if other code
is involved and if that code also needs to process certain control
is involved and if that code also needs to process certain control
messages, higher-level code should install its own handler and chain
messages, higher-level code should install its own handler and chain
to the USB-ethernet one when appropriate. It should be noted that the
to the USB-ethernet one when appropriate. It should be noted that the
request code is encoded in just a single byte, so there is a real
request code is encoded in just a single byte, so there is a real
possibility that exactly the same number will be used by different
possibility that exactly the same number will be used by different
protocols for different requests. Any such problems will have to be
protocols for different requests. Any such problems will have to be
identified and resolved by application developers, and may involve
identified and resolved by application developers, and may involve
modifying the source code for the USB-ethernet package.</P
modifying the source code for the USB-ethernet package.</P
><P
><P
>As an alternative to chaining the state change handler, higher-level
>As an alternative to chaining the state change handler, higher-level
code can instead call <TT
code can instead call <TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>usbs_eth_disable</TT
>usbs_eth_disable</TT
> and
> and
<TT
<TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>usbs_eth_enable</TT
>usbs_eth_enable</TT
> directly. These functions may
> directly. These functions may
also be called if the USB-ethernet package should become inactive for
also be called if the USB-ethernet package should become inactive for
reasons not related directly to events on the USB bus. The main effect
reasons not related directly to events on the USB bus. The main effect
of <TT
of <TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>usbs_eth_enable</TT
>usbs_eth_enable</TT
> is to restart receive
> is to restart receive
operations and to allow transmits. The main effect of
operations and to allow transmits. The main effect of
<TT
<TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>usbs_eth_disable</TT
>usbs_eth_disable</TT
> is to block further transmits:
> is to block further transmits:
any current receive operations need to be aborted at the USB level,
any current receive operations need to be aborted at the USB level,
for example by halting the appropriate endpoint.</P
for example by halting the appropriate endpoint.</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="usbseth-data.html"
HREF="usbseth-data.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-netdev.html"
HREF="usbseth-netdev.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"
>USB-ethernet Data Transfers</TD
>USB-ethernet Data Transfers</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"
>Network Device for the eCos TCP/IP Stack</TD
>Network Device for the eCos TCP/IP Stack</TD
></TR
></TR
></TABLE
></TABLE
></DIV
></DIV
></BODY
></BODY
></HTML
></HTML
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.