📄 m68681sio.html
字号:
<html><head><!-- /vobs/wpwr/docs/vxworks/ref/m68681Sio.html - generated by refgen from m68681Sio.c --> <title> m68681Sio </title></head><body bgcolor="#FFFFFF"> <hr><a name="top"></a><p align=right><a href="libIndex.html"><i>VxWorks Reference Manual : Libraries</i></a></p></blockquote><h1>m68681Sio</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>m68681Sio</strong> - M68681 serial communications driver </p></blockquote><h4>ROUTINES</h4><blockquote><p><p><b><i><a href="./m68681Sio.html#m68681DevInit">m68681DevInit</a></i>( )</b> - intialize a <b>M68681_DUART</b><br><b><i><a href="./m68681Sio.html#m68681DevInit2">m68681DevInit2</a></i>( )</b> - intialize a <b>M68681_DUART</b>, part 2<br><b><i><a href="./m68681Sio.html#m68681ImrSetClr">m68681ImrSetClr</a></i>( )</b> - set and clear bits in the DUART interrupt-mask register<br><b><i><a href="./m68681Sio.html#m68681Imr">m68681Imr</a></i>( )</b> - return the current contents of the DUART interrupt-mask register<br><b><i><a href="./m68681Sio.html#m68681AcrSetClr">m68681AcrSetClr</a></i>( )</b> - set and clear bits in the DUART auxiliary control register<br><b><i><a href="./m68681Sio.html#m68681Acr">m68681Acr</a></i>( )</b> - return the contents of the DUART auxiliary control register<br><b><i><a href="./m68681Sio.html#m68681OprSetClr">m68681OprSetClr</a></i>( )</b> - set and clear bits in the DUART output port register<br><b><i><a href="./m68681Sio.html#m68681Opr">m68681Opr</a></i>( )</b> - return the current state of the DUART output port register<br><b><i><a href="./m68681Sio.html#m68681OpcrSetClr">m68681OpcrSetClr</a></i>( )</b> - set and clear bits in the DUART output port configuration register<br><b><i><a href="./m68681Sio.html#m68681Opcr">m68681Opcr</a></i>( )</b> - return the state of the DUART output port configuration register<br><b><i><a href="./m68681Sio.html#m68681Int">m68681Int</a></i>( )</b> - handle all DUART interrupts in one vector<br><p></blockquote><h4>DESCRIPTION</h4><blockquote><p>This is the driver for the M68681 DUART. This device includes two universalasynchronous receiver/transmitters, a baud rate generator, and a counter/timerdevice. This driver module provides control of the two serial channels andthe baud-rate generator. The counter timer is controlled by a separatedriver, <b>src/drv/timer/m68681Timer.c</b>.<p>A <b>M68681_DUART</b> structure is used to describe the chip. This data structurecontains two <b>M68681_CHAN</b> structures which describe the chip's two serialchannels. The <b>M68681_DUART</b> structure is defined in <b>m68681Sio.h</b>.<p>Only asynchronous serial operation is supported by this driver.The default serial settings are 8 data bits, 1 stop bit, no parity, 9600baud, and software flow control. These default settings can be overriddenon a channel-by-channel basis by setting the <b>M68681_CHAN</b> options and <b>baudRate</b>fields to the desired values before calling <b><i><a href="./m68681Sio.html#m68681DevInit">m68681DevInit</a></i>( )</b>. See <b>sioLib.h</b>for option values. The defaults for the module can be changed byredefining the macros <b>M68681_DEFAULT_OPTIONS</b> and <b>M68681_DEFAULT_BAUD</b> andrecompiling this driver.<p>This driver supports baud rates of 75, 110, 134.5, 150, 300, 600, 1200,2000, 2400, 4800, 1800, 9600, 19200, and 38400.<p></blockquote><h4>USAGE</h4><blockquote><p>The BSP's <b><i><a href="./sysLib.html#sysHwInit">sysHwInit</a></i>( )</b> routine typically calls <b><i><a href="./sysLib.html#sysSerialHwInit">sysSerialHwInit</a></i>( )</b>which initializes all the hardware addresses in the <b>M68681_DUART</b> structurebefore calling <b><i><a href="./m68681Sio.html#m68681DevInit">m68681DevInit</a></i>( )</b>. This enables the chip to operate inpolled mode, but not in interrupt mode. Calling <b><i><a href="./m68681Sio.html#m68681DevInit2">m68681DevInit2</a></i>( )</b> fromthe <b><i><a href="./sysLib.html#sysSerialHwInit2">sysSerialHwInit2</a></i>( )</b> routine allows interrupts to be enabled andinterrupt-mode operation to be used.<p>The following example shows the first part of the initialization thorughcalling <b><i><a href="./m68681Sio.html#m68681DevInit">m68681DevInit</a></i>( )</b>:<pre>#include "drv/sio/m68681Sio.h"M68681_DUART myDuart; /* my device structure */#define MY_VEC (71) /* use single vector, #71 */sysSerialHwInit() { /* initialize the register pointers for portA */ myDuart.portA.mr = M68681_MRA; myDuart.portA.sr = M68681_SRA; myDuart.portA.csr = M68681_CSRA; myDuart.portA.cr = M68681_CRA; myDuart.portA.rb = M68681_RHRA; myDuart.portA.tb = M68681_THRA; /* initialize the register pointers for portB */ myDuart.portB.mr = M68681_MRB; ... /* initialize the register pointers/data for main duart */ myDuart.ivr = MY_VEC; myDuart.ipcr = M68681_IPCR; myDuart.acr = M68681_ACR; myDuart.isr = M68681_ISR; myDuart.imr = M68681_IMR; myDuart.ip = M68681_IP; myDuart.opcr = M68681_OPCR; myDuart.sopbc = M68681_SOPBC; myDuart.ropbc = M68681_ROPBC; myDuart.ctroff = M68681_CTROFF; myDuart.ctron = M68681_CTRON; myDuart.ctlr = M68681_CTLR; myDuart.ctur = M68681_CTUR; m68681DevInit (&myDuart); }</pre>The BSP's <b><i><a href="../bsp/ads360/sysLib.html#sysHwInit2" >sysHwInit2</a></i>( )</b> routine typically calls <b><i><a href="./sysLib.html#sysSerialHwInit2">sysSerialHwInit2</a></i>( )</b> whichconnects the chips interrupts via <b><i><a href="./intArchLib.html#intConnect">intConnect</a></i>( )</b> to the singleinterrupt handler <b><i><a href="./m68681Sio.html#m68681Int">m68681Int</a></i>( )</b>. After the interrupt service routines are connected, the user then calls <b><i><a href="./m68681Sio.html#m68681DevInit2">m68681DevInit2</a></i>( )</b> to allow the driver to turn on interrupt enable bits, as shown in the following example:<p><pre>sysSerialHwInit2 () { /* connect single vector for 68681 */ intConnect (INUM_TO_IVEC(MY_VEC), m68681Int, (int)&myDuart); ... /* allow interrupts to be enabled */ m68681DevInit2 (&myDuart); }</pre></blockquote><h4>SPECIAL CONSIDERATIONS</h4><blockquote><p><p>The CLOCAL hardware option presumes that OP0 and OP1 output bits are wiredto the CTS outputs for channel 0 and channel 1 respectively. If not wiredcorrectly, then the user must not select the CLOCAL option. CLOCAL isnot one of the default options for this reason.<p>This driver does not manipulate the output portor its configuration register in any way. If the userselects the CLOCAL option, then the output port bit must be wired correctlyor the hardware flow control will not function correctly.<p></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>drv/sio/m68681Sio.h</b><p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./m68681Sio.html#top">m68681Sio</a></b><hr><a name="m68681DevInit"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>m68681DevInit</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>m68681DevInit</i>( )</strong> - intialize a <b>M68681_DUART</b></p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>void m68681DevInit ( M68681_DUART * pDuart )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>The BSP must already have initialized all the device addresses andregister pointers in the <b>M68681_DUART</b> structure as described in<b><a href="./m68681Sio.html#top">m68681Sio</a></b>. This routine initializes some transmitter and receiver statusvalues to be used in the interrupt mask register and then resets the chipto a quiescent state.<p></blockquote><h4>RETURNS</h4><blockquote><p>N/A</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./m68681Sio.html#top">m68681Sio</a></b><hr><a name="m68681DevInit2"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>m68681DevInit2</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>m68681DevInit2</i>( )</strong> - intialize a <b>M68681_DUART</b>, part 2</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>void m68681DevInit2 ( M68681_DUART * pDuart )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine is called as part of <b><i><a href="./sysLib.html#sysSerialHwInit2">sysSerialHwInit2</a></i>( )</b>. It tellsthe driver that interrupt vectors are connected and that it issafe to allow interrupts to be enabled.<p></blockquote><h4>RETURNS</h4><blockquote><p>N/A</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./m68681Sio.html#top">m68681Sio</a></b><hr><a name="m68681ImrSetClr"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>m68681ImrSetClr</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>m68681ImrSetClr</i>( )</strong> - set and clear bits in the DUART interrupt-mask register</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>void m68681ImrSetClr ( M68681_DUART * pDuart, UCHAR setBits, /* which bits to set in the IMR */ UCHAR clearBits /* which bits to clear in the IMR */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine sets and clears bits in the DUART interrupt-mask register (IMR).It sets and clears bits in a local copy of the IMR, thenwrites that local copy to the DUART. This means that all changes tothe IMR must be performed by this routine. Any direct changesto the IMR are lost the next time this routine is called.<p>Set has priority over clear. Thus you can use this routine to updatemultiple bit fields by specifying the field mask as the clear bits.<p></blockquote><h4>RETURNS</h4><blockquote><p>N/A</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./m68681Sio.html#top">m68681Sio</a></b><hr>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -