📄 io-package-intro.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>Introduction</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="I/O Package (Device Drivers)"HREF="io.html"><LINKREL="PREVIOUS"TITLE="I/O Package (Device Drivers)"HREF="io.html"><LINKREL="NEXT"TITLE="User API"HREF="io-user-api.html"></HEAD><BODYCLASS="CHAPTER"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="io.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom"></TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="io-user-api.html"ACCESSKEY="N">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><DIVCLASS="CHAPTER"><H1><ANAME="IO-PACKAGE-INTRO">Chapter 14. Introduction</H1><P>The I/O package is designed as a general purpose framework forsupporting device drivers. This includes all classes ofdrivers from simple serial to networking stacks and beyond.</P><P>Components of the I/O package, such as device drivers, areconfigured into the system just like all other components.Additionally, end users may add their own drivers to this set.</P><P>While the set of drivers (and the devices they represent) may beconsidered static, they must be accessed via an opaque“handle”. Each device in the system has a unique name andthe <TTCLASS="FUNCTION">cyg_io_lookup()</TT> function is used to map thatname onto the handle for the device. This “hiding” of thedevice implementation allows for generic, named devices, as well asmore flexibility. Also, the <TTCLASS="FUNCTION">cyg_io_lookup()</TT>function provides drivers the opportunity to initialize the devicewhen usage actually starts.</P><P>All devices have a name. The standard provided devices use names suchas <TTCLASS="FILENAME">“/dev/console”</TT> and<TTCLASS="FILENAME">“/dev/serial0”</TT>, where the<TTCLASS="FILENAME">“/dev/”</TT> prefix indicates that this isthe name of a device.</P><P>The entire I/O package API, as well as the standardset of provided drivers, is written in C. </P><P>Basic functions are provided to send data to and receive datafrom a device. The details of how this is done is left to the device [class] itself.For example, writing data to a block device like a disk drive mayhave different semantics than writing to a serial port. </P><P>Additional functions are provided to manipulate the stateof the driver and/or the actual device. These functionsare, by design, quite specific to the actual driver. </P><P>This driver model supports layering; in other words, a devicemay actually be created “on top of” another device.For example, the “tty” (terminal-like) devices arebuilt on top of simple serial devices. The upper layer then hasthe flexibility to add features and functions not found at the lowerlayers. In this case the “tty” device providesfor line buffering and editing not available from the simple serialdrivers.</P><P>Some drivers will support visibility of the layers they dependupon. The “tty” driver allows information aboutthe actual serial device to be manipulated by passing get/setconfig calls that use a serial driver “key” downto the serial driver itself. </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="io.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="io-user-api.html"ACCESSKEY="N">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">I/O Package (Device Drivers)</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="io.html"ACCESSKEY="U">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">User API</TD></TR></TABLE></DIV></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -