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

📄 c-iosys7.html

📁 vxworks相关论文
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<div class="CellBody"><a name="84694"> </a>Get the number of bytes in the output buffer.&nbsp;</div></td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="84697"> </a><b class="symbol_UC">FIOSETOPTIONS </b>&nbsp;</div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="84700"> </a>Set the device option word.&nbsp;</div></td></tr><tr><td colspan="20"><hr class="tablerule"></td></tr><tr valign="middle"><td colspan="20"></td></tr></table></p></p></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/caution.gif"></td><td><hr><div class="CalloutCell"><a name="95781"><b class="symbol_UC"><font face="Helvetica, sans-serif" size="-1" class="sans">CAUTION:  </font></b></a>To change the driver's hardware options (for example, the number of stop bits or parity bits), use the <b class="routine"><i class="routine">ioctl</i></b><b>(&nbsp;)</b> function <b class="symbol_UC">SIO_HW_OPTS_SET</b>. Because this command is not implemented in most drivers, you may need to add it to your BSP serial driver, which resides in <i class="textVariable">installDir</i><b class="file">/target/src/drv/sio</b>. The details of how to implement this command depend on your board's serial chip. The constants defined in the header file <i class="textVariable">installDir</i><b class="file">/target/h/sioLib.h </b>provide the POSIX definitions for setting the hardware options.</div></td></tr><tr valign="top"><td></td><td><hr></td></tr><tr valign="middle"><td colspan="20"></td></tr></table></p callout></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="84707">3.7.2  &nbsp;&nbsp;Pipe Devices</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84709"> </a>Pipes are virtual devices by which tasks communicate with each other through the I/O system. Tasks write messages to pipes; these messages can then be read by other tasks. Pipe devices are managed by <b class="library">pipeDrv</b> and use the kernel message queue facility to bear the actual message traffic.</p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="84712">Creating Pipes</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84713"> </a>Pipes are created by calling the pipe create routine:</p><dl class="margin"><dd><pre class="Code2"><b><a name="84714"><i class="textVariable">status</i> = pipeDevCreate ("/pipe/name",<i class="textVariable"> maxMsgs</i>,<i class="textVariable"> maxLength</i>);</a></b></pre></dl><dd><p class="Body"><a name="84715"> </a>The new pipe can have at most <i class="textVariable">maxMsgs</i> messages queued at a time. Tasks that write to a pipe that already has the maximum number of messages queued are delayed until a message is dequeued. Each message in the pipe can be at most <i class="textVariable">maxLength</i> bytes long; attempts to write longer messages result in an error.</p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="84717">Writing to Pipes from ISRs</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84718"> </a>VxWorks pipes are designed to allow ISRs to write to pipes in the same way as task-level code. Many VxWorks facilities cannot be used from ISRs, including I/O to devices other than pipes. However, ISRs can use pipes to communicate with tasks, which can then invoke such facilities.</p><dd><p class="Body"><a name="84720"> </a>ISRs write to a pipe using the <b class="routine"><i class="routine">write</i></b><b>(</b>&nbsp;<b>)</b> call. Tasks and ISRs can write to the same pipes. However, if the pipe is full, the message is discarded because the ISRs cannot pend. ISRs must not invoke any I/O function on pipes other than <b class="routine"><i class="routine">write</i></b><b>(</b>&nbsp;<b>)</b>. </p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="84721">I/O Control Functions</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84727"> </a>Pipe devices respond to the <b class="routine"><i class="routine">ioctl</i></b><b>(</b>&nbsp;<b>)</b> functions summarized in <a href="c-iosys7.html#84731">Table&nbsp;3-10</a>. The functions listed are defined in the header file <b class="file">ioLib.h</b>. For more information, see the reference entries for <b class="library">pipeDrv</b> and for <b class="routine"><i class="routine">ioctl</i></b><b>(</b>&nbsp;<b>)</b> in <b class="library">ioLib</b>. <p class="table"><h4 class="EntityTitle"><a name="84731"><font face="Helvetica, sans-serif" size="-1" class="sans">Table 3-10:&nbsp;&nbsp;I/O Control Functions Supported by <b class="library">pipeDrv</b></font></a></h4><table border="0" cellpadding="0" cellspacing="0"><tr><td colspan="20"><hr class="tablerule"></td></tr><tr valign="middle"><th rowspan="1" colspan="1"><div class="CellHeading"><b><a name="84735"> </a><font face="Helvetica, sans-serif" size="-1" class="sans">Function</font></b></div></th><th rowspan="1" colspan="1"><div class="CellHeading"><b><a name="84737"> </a><font face="Helvetica, sans-serif" size="-1" class="sans">Description</font></b></div></th></tr><tr><td colspan="20"><hr class="tablerule2"></td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="84744"> </a><b class="symbol_UC">FIOFLUSH</b> &nbsp;</div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="84746"> </a>Discard all messages in the pipe.&nbsp;</div></td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="84749"> </a><b class="symbol_UC">FIOGETNAME</b> &nbsp;</div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="84751"> </a>Get the pipe name of the <i class="acronym_lc">fd</i>.&nbsp;</div></td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="84754"> </a><b class="symbol_UC">FIONMSGS</b> &nbsp;</div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="84756"> </a>Get the number of messages remaining in the pipe.&nbsp;</div></td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="84759"> </a><b class="symbol_UC">FIONREAD</b> &nbsp;</div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="84762"> </a>Get the size in bytes of the first message in the pipe.<b></b>&nbsp;</div></td></tr><tr><td colspan="20"><hr class="tablerule"></td></tr><tr valign="middle"><td colspan="20"></td></tr></table></p></p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="84767">3.7.3  &nbsp;&nbsp;Pseudo Memory Devices</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84769"> </a>The <b class="library">memDrv</b> driver allows the I/O system to access memory directly as a pseudo-I/O device. Memory location and size are specified when the device is created. This feature is useful when data must be preserved between boots of VxWorks or when sharing data between CPUs. This driver does not implement a file system as does <b class="library">ramDrv</b>. The <b class="library">ramDrv</b> driver must be given memory over which it has absolute control; whereas <b class="library">memDrv</b> provides a high-level method of reading and writing bytes in absolute memory locations through I/O calls. </p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="84771">Installing the Memory Driver</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84772"> </a>The driver is first initialized and then the device is created:</p><dl class="margin"><dd><pre class="Code2"><b><a name="84773">STATUS memDrv     (void) STATUS memDevCreate     (char * name, char * base, int length)</a></b></pre></dl><dd><p class="Body"><a name="84777"> </a>Memory for the device is an absolute memory location beginning at <i class="term">base</i>. The <i class="term">length</i> parameter indicates the size of the memory. For additional information on the memory driver, see the reference entries for <b class="library">memDrv</b>, <b class="routine"><i class="routine">memDevCreate</i></b><b>(&nbsp;)</b>, and <b class="routine"><i class="routine">memDrv</i></b><b>(&nbsp;)</b>.</p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="84778">I/O Control Functions</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84783"> </a>The memory driver responds to the <b class="routine"><i class="routine">ioctl</i></b><b>(</b>&nbsp;<b>)</b> functions summarized in <a href="c-iosys7.html#84787">Table&nbsp;3-11</a>. The functions listed are defined in the header file <b class="file">ioLib.h</b>. For more information, see the reference entries for <b class="library">memDrv</b> and for <b class="routine"><i class="routine">ioctl</i></b><b>(</b>&nbsp;<b>)</b> in <b class="library">ioLib</b>. <p class="table"><h4 class="EntityTitle"><a name="84787"><font face="Helvetica, sans-serif" size="-1" class="sans">Table 3-11:&nbsp;&nbsp;I/O Control Functions Supported by <b class="library">memDrv</b></font></a></h4><table border="0" cellpadding="0" cellspacing="0"><tr><td colspan="20"><hr class="tablerule"></td></tr><tr valign="middle"><th rowspan="1" colspan="1"><div class="CellHeading"><b><a name="84791"> </a><font face="Helvetica, sans-serif" size="-1" class="sans">Function</font></b></div></th><th rowspan="1" colspan="1"><div class="CellHeading"><b><a name="84793"> </a><font face="Helvetica, sans-serif" size="-1" class="sans">Description</font></b></div></th></tr><tr><td colspan="20"><hr class="tablerule2"></td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="84800"> </a><b class="symbol_UC">FIOSEEK</b> &nbsp;</div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="84802"> </a>Set the current byte offset in the file.&nbsp;</div></td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="84805"> </a><b class="symbol_UC">FIOWHERE</b> &nbsp;</div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="84808"> </a>Return the current byte position in the file.&nbsp;</div></td></tr><tr><td colspan="20"><hr class="tablerule"></td></tr><tr valign="middle"><td colspan="20">

⌨️ 快捷键说明

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