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

📄 usbseth-protocol.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>Communication Protocol</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="eCos Support for Developing USB-ethernet Peripherals"HREF="io-usb-slave-eth.html"><LINKREL="PREVIOUS"TITLE="Example Host-side Device Driver"HREF="usbseth-host.html"><LINKREL="NEXT"TITLE="eCos Synthetic Target"HREF="hal-synth-arch.html"></HEAD><BODYCLASS="REFENTRY"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="usbseth-host.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom"></TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="hal-synth-arch.html"ACCESSKEY="N">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><H1><ANAME="USBSETH-PROTOCOL">Communication Protocol</H1><DIVCLASS="REFNAMEDIV"><ANAME="AEN17632"></A><H2>Name</H2>Communication Protocol&nbsp;--&nbsp;Protocol used between the host-side device driver and the eCosUSB-ethernet package </DIV><DIVCLASS="REFSECT1"><ANAME="AEN17635"></A><H2>Description</H2><P>There is a USB standard for the protocol to be used between the hostand a class of communication devices, including ethernet. However, theeCos USB-ethernet package does not implement this protocol: the targethardware for which the package was first developed had certainlimitations, and could not implement the standard. Instead, the packageimplements a simple new protocol.</P><P>A USB-ethernet peripheral involves bulk transfers on two endpoints:one endpoint will be used for packets from host to peripheral and theother will be used for the opposite direction. Transfers in bothdirections are variable length, with a lower limit of 16 bytes and anupper limit of 1516 bytes. The first two bytes of each transferconstitute a header specific to USB-ethernet. The next 14 bytes formthe normal header for an ethernet frame: destination MAC address,source MAC address, and a protocol field. The remaining data, up to1500 bytes, are the payload. The first two bytes give the size of theethernet frame, least significant byte first, with a value between 14and 1514.</P><P>For example an ARP request from host to peripheral involves anethernet frame of 42 bytes (0x002A), with the usual 14-byte header anda 28-byte payload. The destination is the broadcast address0xFFFFFFFFFFFF. The source depends on the MAC address specified forthe host in the call to <AHREF="usbseth-init.html"><TTCLASS="FUNCTION">usbs_eth_init</TT></A>, e.g.0x405D90A9BC02. The remaining data is as specified by the appropriate<AHREF="http://www.ietf.org"TARGET="_top">IETF RFC's</A>. The actual bulkUSB transfer involves the following sequence of 44 bytes:</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="SCREEN">2a 00 ff ff ff ff ff ff 40 5d 90 a9 bc 02 08 0600 01 08 00 06 04 00 01 40 5d 90 a9 bc 02 0a 0000 01 00 00 00 00 00 00 0a 00 00 02</PRE></TD></TR></TABLE><P>In addition there are two control messages. These will be sent by thehost to endpoint 0, the control endpoint, and by default they willbe handled by <AHREF="usbseth-control.html"><TTCLASS="FUNCTION">usbs_eth_class_control_handler</TT></A>. If class-specificcontrol messages are intercepted by other code then it is theresponsibility of that code to invoke the USB-ethernet handler whenappropriate.</P><P>The first control message can be used by the host to obtain a MACaddress:</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">#define ECOS_USBETH_CONTROL_GET_MAC_ADDRESS         0x01</PRE></TD></TR></TABLE><P>The control message's type field should specify IN as the direction.The request field should be <TTCLASS="LITERAL">0x01</TT>. The length fieldsshould specify a size of 6 bytes. The remaining fields of the controlmessage will be ignored by the USB-ethernet package. The responseconsists of the 6-byte MAC address supplied by the initialization call<AHREF="usbseth-init.html"><TTCLASS="FUNCTION">usbs_eth_init</TT></A>.</P><P>The second control message can be used by the host to enable ordisable promiscuous mode.</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">#define ECOS_USBETH_CONTROL_SET_PROMISCUOUS_MODE    0x02</PRE></TD></TR></TABLE><P>This control message involves no further data so the length fieldshould be set to 0. The value field should be non-zero to enablepromiscuous mode, zero to disable it. The request field should be<TTCLASS="LITERAL">0x02</TT>. The remaining fields in the control messagewill be ignored. It is the responsibility of the host-side devicedriver to keep track of whether or not promiscuous mode is currentlyenabled. It will be disabled when the peripheral changes toConfigured state, typically at the point where the host-side devicedriver has been activated.</P></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="usbseth-host.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="hal-synth-arch.html"ACCESSKEY="N">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">Example Host-side Device Driver</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="io-usb-slave-eth.html"ACCESSKEY="U">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">eCos Synthetic Target</TD></TR></TABLE></DIV></BODY></HTML>

⌨️ 快捷键说明

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