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

📄 c-iosys2.html

📁 vxworks相关论文
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><link rel="STYLESHEET" type="text/css" href="wrs.css"><title>    I/O System   </title></head><body bgcolor="FFFFFF"><p class="navbar" align="right"><a href="index.html"><img border="0" alt="[Contents]" src="icons/contents.gif"></a><a href="GuideIX.html"><img border="0" alt="[Index]" src="icons/index.gif"></a><a href="c-iosys.html"><img border="0" alt="[Top]" src="icons/top.gif"></a><a href="c-iosys1.html"><img border="0" alt="[Prev]" src="icons/prev.gif"></a><a href="c-iosys3.html"><img border="0" alt="[Next]" src="icons/next.gif"></a></p><font face="Helvetica, sans-serif" class="sans"><h3 class="H2"><i><a name="83627">3.2  &nbsp;&nbsp;Files, Devices, and Drivers</a></i></h3></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="83628"> </a>In VxWorks, applications access I/O devices by opening named <i class="term">files</i>. A <i class="term">file</i> can refer to one of two things:</p></dl><dl class="margin"><p class="listspace"><ul class="Bullet" type="disc"><li><a name="83629"> </a>An unstructured "<i class="term">raw</i>" <i class="term">device</i> such as a serial communications channel or an intertask pipe.</li></ul></p><p class="listspace"><ul class="Bullet" type="disc"><li><a name="83630"> </a>A <i class="term">logical file</i> on a structured, random-access device containing a file system.</li></ul></p></dl><dl class="margin"><dd><p class="Body"><a name="83631"> </a>Consider the following named files:<p class="table"><table border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td colspan=1 rowspan=1><p class="BodyLeft"><a name="87598"> </a><b class="file">/usr/myfile</b> </p></td><td colspan=1 rowspan=1><p class="BodyLeft"><a name="87600"> </a><b class="file">/pipe/mypipe</b> </p></td><td colspan=1 rowspan=1><p class="BodyLeft"><a name="87602"> </a><b class="file">/tyCo/0</b> </p></td></tr><tr valign="middle"><td colspan="20"></td></tr></table></p></p><dd><p class="Body"><a name="83633"> </a>The first refers to a file called <b class="file">myfile</b>, on a disk device called <b class="file">/usr</b>. The second is a named pipe (by convention, pipe names begin with <b class="file">/pipe</b>). The third refers to a physical serial channel. However, I/O can be done to or from any of these in the same way. Within VxWorks, they are all called <i class="term">files</i>, even though they refer to very different physical objects.</p><dd><p class="Body"><a name="83634"> </a>Devices are handled by program modules called <i class="term">drivers</i>. In general, using the I/O system does not require any further understanding of the implementation of devices and drivers. Note, however, that the VxWorks I/O system gives drivers considerable flexibility in the way they handle each specific device. Drivers strive to follow the conventional user view presented here, but can differ in the specifics. See <a href="c-iosys7.html#84371"><i class="title">3.7&nbsp;Devices in VxWorks</i></a>.</p><dd><p class="Body"><a name="83638"> </a>Although all I/O is directed at named files, it can be done at two different levels: <i class="term">basic</i> and <i class="term">buffered</i>. The two differ in the way data is buffered and in the types of calls that can be made. These two levels are discussed in later sections.</p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="83640">3.2.1  &nbsp;&nbsp;File Names and the Default Device</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="83641"> </a>A file name is specified as a character string. An unstructured device is specified with the device name. In the case of file system devices, the device name is followed by a file name. Thus the name <b class="file">/tyCo/0</b> might name a particular serial I/O channel, and the name <b class="file">DEV1:/file1</b> probably indicates the file <b class="file">file1</b> on the <b class="file">DEV1:</b> device.</p><dd><p class="Body"><a name="83642"> </a>When a file name is specified in an I/O call, the I/O system searches for a device with a name that matches at least an initial substring of the file name. The I/O function is then directed at this device.</p><dd><p class="Body"><a name="83643"> </a>If a matching device name cannot be found, then the I/O function is directed at a <i class="term">default device</i>. You can set this default device to be any device in the system, including no device at all, in which case failure to match a device name returns an error.</p><dd><p class="Body"><a name="83645"> </a>Non-block devices are named when they are added to the I/O system, usually at system initialization time. Block devices are named when they are initialized for use with a specific file system. The VxWorks I/O system imposes no restrictions on the names given to devices. The I/O system does not interpret device or file names in any way, other than during the search for matching device and file names.</p><dd><p class="Body"><a name="83646"> </a>It is useful to adopt some naming conventions for device and file names: most device names begin with a slash (<b>/</b>), except non-NFS network devices and VxWorks DOS devices (dosFs). </p><dd><p class="Body"><a name="83647"> </a>By convention, NFS-based network devices are <i class="term">mounted</i> with names that begin with a slash. For example:</p><dl class="margin"><dd><pre class="Code2"><b><a name="83648">/usr</a></b></pre></dl><dd><p class="Body"><a name="83649"> </a>Non-NFS network devices are named with the remote machine name followed by a colon. For example:</p><dl class="margin"><dd><pre class="Code2"><b><a name="83650">host:</a></b></pre></dl><dd><p class="Body"><a name="83651"> </a>The remainder of the name is the file name in the remote directory on the remote system.</p><dd><p class="Body"><a name="83652"> </a>File system devices using dosFs are often named with uppercase letters and/or digits followed by a colon. For example:</p><dl class="margin"><dd><pre class="Code2"><b><a name="83653">DEV1:</a></b></pre></dl></dl></dl><dl class="margin"><dd><p class="table" callout><table border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td valign="top" width="40"><br><img border="0" alt="*" src="icons/note.gif"></td><td><hr><div class="CalloutCell"><a name="95388"><b class="symbol_UC"><font face="Helvetica, sans-serif" size="-1" class="sans">NOTE:  </font></b></a>File names and directory names on dosFs devices are often separated by backslashes (<b>\</b>). These can be used interchangeably with forward slashes (<b>/</b>).</div></td></tr><tr valign="top"><td></td><td><hr></td></tr><tr valign="middle"><td colspan="20"></td></tr></table></p callout><dd><p class="table" callout><table border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td valign="top" width="40"><br><img border="0" alt="*" src="icons/caution.gif"></td><td><hr><div class="CalloutCell"><a name="95410"><b class="symbol_UC"><font face="Helvetica, sans-serif" size="-1" class="sans">CAUTION:  </font></b></a>Because device names are recognized by the I/O system using simple substring matching, a slash (<b>/</b>) should not be used alone as a device name. </div></td></tr><tr valign="top"><td></td><td><hr></td></tr><tr valign="middle"><td colspan="20"></td></tr></table></p callout></dl><a name="foot"><hr></a><p class="navbar" align="right"><a href="index.html"><img border="0" alt="[Contents]" src="icons/contents.gif"></a><a href="GuideIX.html"><img border="0" alt="[Index]" src="icons/index.gif"></a><a href="c-iosys.html"><img border="0" alt="[Top]" src="icons/top.gif"></a><a href="c-iosys1.html"><img border="0" alt="[Prev]" src="icons/prev.gif"></a><a href="c-iosys3.html"><img border="0" alt="[Next]" src="icons/next.gif"></a></p></body></html><!---by WRS Documentation (), Wind River Systems, Inc.    conversion tool:  Quadralay WebWorks Publisher 4.0.11    template:         CSS Template, Jan 1998 - Jefro --->

⌨️ 快捷键说明

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