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

📄 streams.doc16.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>Porting STREAMS Protocols to WindNet STREAMS    WindNet STREAMS for Tornado   </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="streams.doc15.html"><img border="0" alt="[Prev]" src="../../icons/prev.gif"></a><a href="streams.doc17.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="72104" class="autotag">4.4&nbsp;&nbsp;Configuration of STREAMS Drivers and Modules in WindNet STREAMS</a></i></h3></font><dl class="margin"><dd><dl class="margin"><dd><p class="Body"><a name="88076" class="autotag"> </a>Configuration of STREAMS drivers and modules into WindNet STREAMS is dynamic and can be done any time after WindNet STREAMS has been initialized.  WindNet STREAMS provides the routine <b class="routine"><i class="routine">strmDriverAdd</i></b><b>(&nbsp;)</b>for installing drivers, and the routine <b class="routine"><i class="routine">strmModuleAdd</i></b><b>(&nbsp;)</b> for installing modules.  Once installed, STREAMS applications can access the STREAMS drivers and modules.</p></dd></dl></dd></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="88077" class="autotag">4.4.1&nbsp;&nbsp;<b class="routine"><i class="routine">strmDriverAdd</i></b><b>(&nbsp;)</b></a></i></h4></font><dl class="margin"><dd><dl class="margin"><dd><p class="Body"><a name="88547" class="autotag"> </a>The routine <b class="routine"><i class="routine">strmDriverAdd</i></b><b>(&nbsp;)</b><b class="routine"><i class="routine"> </i></b>configures a single STREAMS driver.  You can configure multiple drivers with additional calls to <b class="routine"><i class="routine">strmDriverAdd</i></b><b>(&nbsp;)</b>.  The parameters that must be specified are as follows:</p></dd></dl><dl class="margin"><dd><div class="Item"><a name="88078" class="autotag"> </a><font face="Palatino, serif"><i class="textVariable">pStrmDriverName</i></font></div><dl class="margin"><dd><div class="Indent"><a name="95349" class="autotag"> </a>the driver name to be used by STREAMS applications to access the driver being configured.  Driver names begin with the prefix <b class="file">/dev/</b>,<b class="file"> </b>followed by the device name, which is referred to here as a base name.  The base name can be composed by the letters a-z or A-Z.  It is used by WindNet STREAMS as a major device number, and is followed by an optional minor device number specified with the digits 0-9. </div><br><div class="Indent"><a name="88216" class="autotag"> </a>For example, the name of a driver device with echo capabilities could be <b class="keyword">/dev/echo1</b>.  In this case, the base name is <b class="keyword">echo</b> and the minor device is <b class="keyword">1</b>.  The base name without a minor device number can be used as the name of the clone device for drivers that support clone devices.</div><br></dd></dl><div class="Item"><a name="88079" class="autotag"> </a><font face="Palatino, serif"><i class="textVariable">pStreamtab</i></font></div><dl class="margin"><dd><div class="Indent"><a name="95351" class="autotag"> </a>the data structure <b class="keyword">streamtab</b> that provides the driver entry points.</div><br></dd></dl><div class="Item"><a name="88080" class="autotag"> </a><font face="Palatino, serif"><i class="textVariable">cloneFlag</i></font></div><dl class="margin"><dd><div class="Indent"><a name="95353" class="autotag"> </a>the constant <b>TRUE </b>if the driver supports clone devices, otherwise the constant <b>FALSE</b> must be specified.  The <font face="Palatino, serif"><i class="textVariable">cloneFlag</i></font> parameter should only be set to TRUE when the driver base name is not associated with a minor number.</div><br></dd></dl><div class="Item"><a name="88081" class="autotag"> </a><font face="Palatino, serif"><i class="textVariable">pBuddyStreamtab</i></font></div><dl class="margin"><dd><div class="Indent"><a name="95355" class="autotag"> </a>the data structure <b class="keyword">streamtab</b> that provides the entry points of a writer buddy of the driver being configured.  If the driver being configured does not require a writer buddy, you must set the value of <font face="Palatino, serif"><i class="textVariable">pBuddyStreamtab</i></font> to <b class="keyword">NULL</b>.  For a description of writer buddies, see <a href="streams.doc13.html#82727"><i class="title">&#167;4.1.3.1&nbsp;Writer Buddies</i></a>.</div><br></dd></dl><div class="Item"><a name="88359" class="autotag"> </a><font face="Palatino, serif"><i class="textVariable">flags</i></font></div><dl class="margin"><dd><div class="Indent"><a name="95357" class="autotag"> </a>the constant <b>SVR3_STYLE_OPEN</b> if the driver supports SVR3-style open and close routines.  Set the argument to <b>SVR4_STYLE_OPEN</b>, if the driver supports SVR4-style open and close routines. </div><br></dd></dl><div class="Item"><a name="88360" class="autotag"> </a><font face="Palatino, serif"><i class="textVariable">sqlvl</i></font></div><dl class="margin"><dd><div class="Indent"><a name="95359" class="autotag"> </a>the synchronization level required by the driver to execute successfully in WindNet STREAMS.  For a description of synchronization levels, see <a href="streams.doc13.html#71746"><i class="title">&#167;4.1.1&nbsp;Synchronization Levels</i></a>.</div><br></dd></dl></dd></dl><dl class="margin"><dd><p class="Body"><a name="88444" class="autotag"> </a>After the routine <b class="routine"><i class="routine">strmDriverAdd</i></b><b>(&nbsp;)</b> is executed, the device name specified in that call is added to the list of VxWorks devices in the system and to the list of drivers managed by WindNet STREAMS.</p><p class="Body"><a name="88445" class="autotag"> </a>For example, the following code shows how to configure into WindNet STREAMS a STREAMS printer driver that has a clone device capable of selecting a printer that is not busy and that provides support for several printers with parallel interfaces:</p><dl class="margin"><dd><pre class="Code2"><a name="88446" class="autotag">#include "strmLib.h"</a><a name="88447" class="autotag"></a><a name="88448" class="autotag">/* Install the printer clone device */</a><a name="88449" class="autotag">strmDriverAdd ("/dev/printer", pPrinterStreamTab, TRUE, NULL, <br>                SVR4_STYLE_OPEN, SQLVL_QUEUE);</a><a name="88450" class="autotag"></a><a name="88451" class="autotag">/* Install the device for the printer with minor device 1 */</a><a name="88452" class="autotag">strmDriverAdd ("/dev/printer1", pPrinterStreamTab, FALSE, NULL, <br>                SVR4_STYLE_OPEN, SQLVL_QUEUE);</a><a name="91610" class="autotag"></a><a name="91611" class="autotag">/* Install the device for the printer with minor device 2 ... etc */</a><a name="91612" class="autotag">strmDriverAdd ("/dev/printer2", pPrinterStreamTab, FALSE, NULL, <br>                SVR4_STYLE_OPEN, SQLVL_QUEUE);</a></pre></dd></dl><p class="Body"><a name="88456" class="autotag"> </a>To list the devices created in the VxWorks system, use the VxWorks command <b class="keyword">devs</b> as follows:</p><dl class="margin"><dd><pre class="Code2"><a name="88457" class="autotag">-&gt; devs</a><a name="88538" class="autotag"></a><a name="88458" class="autotag"><tt><font class="output" color="#55AA55">drv name</font></tt></a><a name="88459" class="autotag"><tt><font class="output" color="#55AA55">  3 /dev/printer</font></tt></a><a name="88460" class="autotag"><tt><font class="output" color="#55AA55">  3 /dev/printer1</font></tt></a><a name="88461" class="autotag"><tt><font class="output" color="#55AA55">  3 /dev/printer2</font></tt></a></pre></dd></dl><p class="Body"><a name="88883" class="autotag"> </a>For more information on <b class="routine"><i class="routine">strmDriverAdd</i></b><b>(&nbsp;)</b>, see its manual entry.</p></dd></dl></dd></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="88884" class="autotag">4.4.2&nbsp;&nbsp;<b class="routine"><i class="routine">strmModuleAdd</i></b><b>(&nbsp;)</b> </a></i></h4></font><dl class="margin"><dd><dl class="margin"><dd><p class="Body"><a name="88885" class="autotag"> </a>The routine <b class="routine"><i class="routine">strmModuleAdd</i></b><b>(&nbsp;)</b><b class="routine"><i class="routine"> </i></b>configures a single STREAMS module.  Multiple modules can be configured with additional calls to <b class="routine"><i class="routine">strmModuleAdd</i></b><b>(&nbsp;)</b>.  The parameters that must be specified are as follows:</p></dd></dl><dl class="margin"><dd><div class="Item"><a name="88463" class="autotag"> </a><font face="Palatino, serif"><i class="textVariable">pModuleName</i></font></div><dl class="margin"><dd><div class="Indent"><a name="95361" class="autotag"> </a>the module name to be used by STREAMS applications to access the module being configured.</div><br></dd></dl><div class="Item"><a name="88464" class="autotag"> </a><font face="Palatino, serif"><i class="textVariable">pStreamtab</i></font></div><dl class="margin"><dd><div class="Indent"><a name="95363" class="autotag"> </a>the data structure <b class="keyword">streamtab</b> that provides the module entry points.</div><br></dd></dl><div class="Item"><a name="88465" class="autotag"> </a><font face="Palatino, serif"><i class="textVariable">pBuddyStreamtab</i></font></div><dl class="margin"><dd><div class="Indent"><a name="95365" class="autotag"> </a>the data structure <b class="keyword">streamtab</b> that provides the entry points of a writer buddy of the module being configured.  If the module being configured does not require a writer buddy, you must set the value of <font face="Palatino, serif"><i class="textVariable">pBuddyStreamtab</i></font> to <b class="keyword">NULL</b>.  For a description of writer buddies, see <a href="streams.doc13.html#82727"><i class="title">&#167;4.1.3.1&nbsp;Writer Buddies</i></a>.</div><br></dd></dl><div class="Item"><a name="90778" class="autotag"> </a><font face="Palatino, serif"><i class="textVariable">flags</i></font></div><dl class="margin"><dd><div class="Indent"><a name="95367" class="autotag"> </a>the constant <b>SVR3_STYLE_OPEN</b> if the driver supports SVR3-style open and close routines.  Set the argument to <b>SVR4_STYLE_OPEN</b>, if the driver supports SVR4-style open and close routines.</div><br></dd></dl><div class="Item"><a name="88470" class="autotag"> </a><font face="Palatino, serif"><i class="textVariable">sqlvl</i></font></div><dl class="margin"><dd><div class="Indent"><a name="95369" class="autotag"> </a>the synchronization level required by the module to execute successfuly in WindNet STREAMS.  For a description of synchronization levels, see <a href="streams.doc13.html#71746"><i class="title">&#167;4.1.1&nbsp;Synchronization Levels</i></a>.</div><br></dd></dl></dd></dl><dl class="margin"><dd><p class="Body"><a name="88474" class="autotag"> </a>For example, the following code shows how to configure into WindNet STREAMS a STREAMS module that converts upper case letters to lower case:</p><dl class="margin"><dd><pre class="Code2"><a name="88475" class="autotag"><b>#include "strmLib.h"</b></a><a name="88476" class="autotag"><b></b></a><a name="88477" class="autotag"><b>/* Install the upper to lower case conversion module */</b></a><a name="88478" class="autotag"><b>strmModuleAdd ("upToLow", pUptoLowStreamTab, NULL,</b></a><a name="94667" class="autotag"><b>                SVR4_STYLE_OPEN, SQLVL_QUEUE);</b></a></pre></dd></dl><p class="Body"><a name="88480" class="autotag"> </a>After the driver and modules have been configured into WindNet STREAMS, you can list them with <b class="routine"><i class="routine">strmDriverModShow</i></b><b>(&nbsp;)</b>, described in <a href="streams.doc23.html#80334"><i class="title">&#167;5.3.8&nbsp;strmDriverModShow(&nbsp;)</i></a>.</p><p class="Body"><a name="88550" class="autotag"> </a>For more information on <b class="routine"><i class="routine">strmModuleAdd</i></b><b>(&nbsp;)</b>, see its manual entry.</p></dd></dl></dd></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="streams.doc15.html"><img border="0" alt="[Prev]" src="../../icons/prev.gif"></a><a href="streams.doc17.html"><img border="0" alt="[Next]" src="../../icons/next.gif"></a></p></body></html><!---This file generated April 10, 1998, 12:25PM PDTby WRS Documentation (jeff), Wind River Systems, Inc.    conversion tool:  Quadralay WebWorks Publisher 3.5.0    template:         CSS Template, Jan 1998 - Jefro --->

⌨️ 快捷键说明

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