io-serial-testing-with-serfilter.html
来自「ecos3.0 beta 的官方文档,html格式」· HTML 代码 · 共 712 行 · 第 1/2 页
HTML
712 行
<!-- Copyright (C) 2009 Free Software Foundation, 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. -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>Serial testing with ser_filter</TITLE
><meta name="MSSmartTagsPreventParsing" content="TRUE">
<META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REL="HOME"
TITLE="eCos Reference Manual"
HREF="ecos-ref.html"><LINK
REL="UP"
TITLE="How to Write a Driver"
HREF="io-how-to-write-a-driver.html"><LINK
REL="PREVIOUS"
TITLE="How to Write a Driver"
HREF="io-how-to-write-a-driver.html"><LINK
REL="NEXT"
TITLE="Device Driver Interface to the Kernel"
HREF="devapi-device-driver-interface-to-the-kernel.html"></HEAD
><BODY
CLASS="SECTION"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>eCos Reference Manual</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="io-how-to-write-a-driver.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 12. How to Write a Driver</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="devapi-device-driver-interface-to-the-kernel.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECTION"
><H1
CLASS="SECTION"
><A
NAME="IO-SERIAL-TESTING-WITH-SERFILTER"
>Serial testing with ser_filter</A
></H1
><DIV
CLASS="SECTION"
><H2
CLASS="SECTION"
><A
NAME="IO-SERFILTER-RATIONALE"
>Rationale</A
></H2
><P
>Since some targets only have one serial connection, a serial testing harness
needs to be able to share the connection with <SPAN
CLASS="APPLICATION"
>GDB</SPAN
>
(however, the test and <SPAN
CLASS="APPLICATION"
>GDB</SPAN
> can also run on separate
lines).</P
><P
>The <I
CLASS="FIRSTTERM"
>serial filter</I
> (<SPAN
CLASS="APPLICATION"
>ser_filter</SPAN
>)
sits between the serial port and <SPAN
CLASS="APPLICATION"
>GDB</SPAN
> and monitors
the exchange of data between <SPAN
CLASS="APPLICATION"
>GDB</SPAN
> and the target.
Normally, no changes are made to the data.</P
><P
>When a test request packet is sent from the test on the target, it is
intercepted by the filter.</P
><P
>The filter and target then enter a loop, exchanging protocol data between
them which <SPAN
CLASS="APPLICATION"
>GDB</SPAN
> never sees.</P
><P
>In the event of a timeout, or a crash on the target, the filter falls
back into its pass-through mode. If this happens due to a crash it should be
possible to start regular debugging with <SPAN
CLASS="APPLICATION"
>GDB</SPAN
>. The
filter will stay in the pass-though mode until <SPAN
CLASS="APPLICATION"
>GDB</SPAN
>
disconnects.</P
></DIV
><DIV
CLASS="SECTION"
><H2
CLASS="SECTION"
><A
NAME="IO-SERFILTER-PROTOCOL"
>The Protocol</A
></H2
><P
>The protocol commands are prefixed with an <TT
CLASS="LITERAL"
>"@"</TT
>
character which the serial filter is looking for. The protocol
commands include:</P
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
><TT
CLASS="LITERAL"
>PING</TT
></DT
><DD
><P
>Allows the test on the target to probe for the filter. The
filter responds with <TT
CLASS="LITERAL"
>OK</TT
>, while
<SPAN
CLASS="APPLICATION"
>GDB</SPAN
> would just ignore the
command. This allows the tests to do nothing if they require the
filter and it is not present.</P
></DD
><DT
><TT
CLASS="LITERAL"
>CONFIG</TT
></DT
><DD
><P
>Requests a change of serial line configuration. Arguments
to the command specify baud rate, data bits, stop bits, and
parity. [This command is not fully implemented yet - there is no
attempt made to recover if the new configuration turns out to
cause loss of data.]</P
></DD
><DT
><TT
CLASS="LITERAL"
>BINARY</TT
></DT
><DD
><P
>Requests data to be sent from the filter to the
target. The data is checksummed, allowing errors in the transfer
to be detected. Sub-options of this command control how the
data transfer is made:</P
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
><TT
CLASS="LITERAL"
>NO_ECHO</TT
></DT
><DD
><P
>(serial driver receive test) Just send data from the
filter to the target. The test verifies the checksum and
PASS/FAIL depending on the result. </P
></DD
><DT
><TT
CLASS="LITERAL"
>EOP_ECHO</TT
></DT
><DD
><P
>(serial driver half-duplex receive and send test) As
<TT
CLASS="LITERAL"
>NO_ECHO</TT
> but the test echoes back the
data to the filter. The filter does a checksum on the
received data and sends the result to the target. The test
PASS/FAIL depending on the result of both checksum
verifications.</P
></DD
><DT
><TT
CLASS="LITERAL"
>DUPLEX_ECHO</TT
></DT
><DD
><P
>(serial driver duplex receive and send test) Smaller
packets of data are sent back and forth in a pattern that
ensures that the serial driver will be both sending and
receiving at the same time. Again, checksums are computed
and verified resulting in PASS/FAIL.
</P
></DD
></DL
></DIV
></DD
><DT
><TT
CLASS="LITERAL"
>TEXT</TT
></DT
><DD
><P
> This is a test of the text translations in the TTY layer.
Requests a transfer of text data from the target to the filter
and possibly back again. The filter treats this as a binary
transfer, while the target ma be doing translations on the
data. The target provides the filter with checksums for what it
should expect to see. This test is not implemented yet.
</P
></DD
></DL
></DIV
><P
>The above commands may be extended, and new commands added, as
required to test (new) parts of the serial drivers in
<SPAN
CLASS="PRODUCTNAME"
>eCos</SPAN
>.</P
></DIV
><DIV
CLASS="SECTION"
><H2
CLASS="SECTION"
><A
NAME="IO-SERFILTER-SERIAL-TESTS"
>The Serial Tests</A
></H2
><P
>The serial tests are built as any other eCos test. After running the
<B
CLASS="COMMAND"
>make tests</B
> command, the tests can be found in
<TT
CLASS="FILENAME"
>install/tests/io_serial/</TT
></P
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
><TT
CLASS="FILENAME"
>serial1</TT
></DT
><DD
><P
>A simple API test.</P
></DD
><DT
><TT
CLASS="FILENAME"
>serial2</TT
></DT
><DD
><P
>A simple serial send test. It writes out two strings, one
raw and one encoded as a <SPAN
CLASS="APPLICATION"
>GDB</SPAN
>
O-packet</P
></DD
><DT
><TT
CLASS="FILENAME"
>serial3</TT
> [ requires the serial filter ]</DT
><DD
><P
>This tests the half-duplex send and receive capabilities
of the serial driver. </P
></DD
><DT
><TT
CLASS="FILENAME"
>serial4</TT
> [ requires the serial filter ]</DT
><DD
><P
>This test attempts to use a few different serial
configurations, testing the driver's configuration/setup
functionality. </P
></DD
><DT
><TT
CLASS="FILENAME"
>serial5</TT
> [ requires the serial filter ]</DT
><DD
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?