st16552sio.html

来自「vxworks相关论文」· HTML 代码 · 共 291 行

HTML
291
字号
<html><head><!-- /vobs/wpwr/docs/vxworks/ref/st16552Sio.html - generated by refgen from st16552Sio.c --> <title> st16552Sio </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>st16552Sio</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>st16552Sio</strong> - ST 16C552 DUART tty driver </p></blockquote><h4>ROUTINES</h4><blockquote><p><p><b><i><a href="./st16552Sio.html#st16552DevInit">st16552DevInit</a></i>(&nbsp;)</b>  -  initialise an ST16552 channel<br><b><i><a href="./st16552Sio.html#st16552IntWr">st16552IntWr</a></i>(&nbsp;)</b>  -  handle a transmitter interrupt<br><b><i><a href="./st16552Sio.html#st16552IntRd">st16552IntRd</a></i>(&nbsp;)</b>  -  handle a receiver interrupt<br><b><i><a href="./st16552Sio.html#st16552IntEx">st16552IntEx</a></i>(&nbsp;)</b>  -  miscellaneous interrupt processing<br><b><i><a href="./st16552Sio.html#st16552Int">st16552Int</a></i>(&nbsp;)</b>  -  interrupt level processing<br><b><i><a href="./st16552Sio.html#st16552MuxInt">st16552MuxInt</a></i>(&nbsp;)</b>  -  multiplexed interrupt level processing<br><p></blockquote><h4>DESCRIPTION</h4><blockquote><p>This is the device driver for the Startech ST16C552 DUART, similar, butnot quite identical to the National Semiconductor 16550 UART.<p>The chip is a dual universal asynchronous receiver/transmitter with 16byte transmit and receive FIFOs and a programmable baud-rategenerator. Full modem control capability is included and control overthe four interrupts that can be generated: Tx, Rx, Line status, andmodem status.  Only the Rx and Tx interrupts are used by this driver.The FIFOs are enabled for both Tx and Rx by this driver.<p>Only asynchronous serial operation is supported by the UART whichsupports 5 to 8 bit bit word lengths with or without parity and withone or two stop bits. The only serial word format supported by thedriver is 8 data bits, 1 stop bit, no parity,  The default baud rate isdetermined by the BSP by filling in the <b>ST16552_CHAN</b> structure beforecalling <b><i><a href="./ambaSio.html#ambaDevInit">ambaDevInit</a></i>(&nbsp;)</b>.<p>The exact baud rates supported by this driver will depend on thecrystal fitted (and consequently the input clock to the baud-rategenerator), but in general, baud rates from about 50 to about 115200are possible.<p></blockquote><h4>DATA STRUCTURES</h4><blockquote><p>An <b>ST16552_CHAN</b> data structure is used to describe the two channels ofthe chip and, if necessary, an <b>ST16552_MUX</b> structure is used todescribe the multiplexing of the interrupts for the two channels of theDUART.  These structures are described in <b>h/drv/sio/ambaSio.h</b>.<p></blockquote><h4>CALLBACKS</h4><blockquote><p>Servicing a "transmitter ready" interrupt involves making a callback toa higher level library in order to get a character to transmit.  Bydefault, this driver installs dummy callback routines which do nothing.A higher layer library that wants to use this driver (e.g. <b><a href="./ttyDrv.html#top">ttyDrv</a></b>)will install its own callback routine using the <b>SIO_INSTALL_CALLBACK</b>ioctl command.  Likewise, a receiver interrupt handler makes a callbackto pass the character to the higher layer library.<p></blockquote><h4>MODES</h4><blockquote><p>This driver supports both polled and interrupt modes.<p></blockquote><h4>USAGE</h4><blockquote><p>The driver is typically only called by the BSP. The directly callableroutines in this module are <b><i><a href="./st16552Sio.html#st16552DevInit">st16552DevInit</a></i>(&nbsp;)</b>, <b><i><a href="./st16552Sio.html#st16552Int">st16552Int</a></i>(&nbsp;)</b>,<b><i><a href="./st16552Sio.html#st16552IntRd">st16552IntRd</a></i>(&nbsp;)</b>, <b><i><a href="./st16552Sio.html#st16552IntWr">st16552IntWr</a></i>(&nbsp;)</b>, and st16552MuxInt.<p>The BSP's <b><i><a href="./sysLib.html#sysHwInit">sysHwInit</a></i>(&nbsp;)</b> routine typically calls <b><i><a href="./sysLib.html#sysSerialHwInit">sysSerialHwInit</a></i>(&nbsp;)</b>, whichinitialises all the hardware-specific values in the <b>ST16552_CHAN</b>structure before calling <b><i><a href="./st16552Sio.html#st16552DevInit">st16552DevInit</a></i>(&nbsp;)</b> which resets the device andinstalls the driver function pointers. After this the UART will beenabled and ready to generate interrupts, but those interrupts will bedisabled in the interrupt controller.<p>The following example shows the first parts of the initialisation:<p><pre>#include "drv/sio/st16552Sio.h"LOCAL ST16552_CHAN st16552Chan[N_16552_CHANNELS];void sysSerialHwInit (void)    {    int i;    for (i = 0; i &lt; N_16552_CHANNELS; i++)        {        st16552Chan[i].regDelta = devParas[i].regSpace;        st16552Chan[i].regs = devParas[i].baseAdrs;        st16552Chan[i].baudRate = CONSOLE_BAUD_RATE;        st16552Chan[i].xtal = UART_XTAL_FREQ;        st16552Chan[i].level = devParas[i].intLevel;        /*         * Initialise driver functions, getTxChar, putRcvChar and         * channelMode and init UART.         */        st16552DevInit(&amp;st16552Chan[i]);        }    }</pre>The BSP's <b><i><a href="../bsp/ads360/sysLib.html#sysHwInit2" >sysHwInit2</a></i>(&nbsp;)</b> routine typically calls <b><i><a href="./sysLib.html#sysSerialHwInit2">sysSerialHwInit2</a></i>(&nbsp;)</b>,which connects the chips interrupts via <b><i><a href="./intArchLib.html#intConnect">intConnect</a></i>(&nbsp;)</b> (either the singleinterrupt <b>st16552Int</b>, the three interrupts <b>st16552IntWr</b>,<b>st16552IntRd</b>, and <b>st16552IntEx</b>, or the multiplexed interrupthandler <b>st16552MuxInt</b> which will cope with both channels of a DUARTproducing the same interrupt). It then enables those interrupts in theinterrupt controller as shown in the following example:<p><pre>void sysSerialHwInit2 (void)    {    /* Connect the multiplexed interrupt handler */    (void) intConnect (INUM_TO_IVEC(devParas[0].vector),                        st16552MuxInt, (int) &amp;st16552Mux);    intEnable (devParas[0].intLevel);    }</pre></blockquote><h4>BSP</h4><blockquote><p>By convention all the BSP-specific serial initialisation is performedin a file called <b>sysSerial.c</b>, which is #include'ed by <b>sysLib.c</b>.<b>sysSerial.c</b> implements at least four functions, <b><i><a href="./sysLib.html#sysSerialHwInit">sysSerialHwInit</a></i>(&nbsp;)</b><b><i><a href="./sysLib.html#sysSerialHwInit2">sysSerialHwInit2</a></i>(&nbsp;)</b>, <b><i><a href="./sysLib.html#sysSerialChanGet">sysSerialChanGet</a></i>(&nbsp;)</b>, and <b><i><a href="./sysLib.html#sysSerialReset">sysSerialReset</a></i>(&nbsp;)</b>. The firsttwo have been described above, the others work as follows:<p>sysSerialChanGet is called by usrRoot to get the serial channeldescriptor associated with a serial channel number. The routine takes asingle parameter which is a channel number ranging between zero and<b>NUM_TTY</b>. It returns a pointer to the corresponding channel descriptor,<b>SIO_CHAN</b> *, which is just the address of the <b>ST16552_CHAN</b> strucure.<p>sysSerialReset is called from <b><i><a href="./sysLib.html#sysToMonitor">sysToMonitor</a></i>(&nbsp;)</b> and should reset theserial devices to an inactive state (prevent them from generating anyinterrupts).<p></blockquote><h4>INCLUDE FILES</h4><blockquote><p><p><b>drv/sio/st16552Sio.h</b> <b>sioLib.h</b><p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./st16552Sio.html#top">st16552Sio</a></b>, <i>Startech ST16C552 Data Sheet </i><hr><a name="st16552DevInit"></a><p align=right><a href="rtnIndex.html"><i>Libraries :  Routines</i></a></p></blockquote><h1><i>st16552DevInit</i>(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong><i>st16552DevInit</i>(&nbsp;)</strong> - initialise an ST16552 channel</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>void st16552DevInit    (    ST16552_CHAN * pChan    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine initialises some <b>SIO_CHAN</b> function pointers and then resetsthe chip in a quiescent state.  Before this routine is called, the BSPmust already have initialised all the device addresses, etc. in the<b>ST16552_CHAN</b> structure.<p></blockquote><h4>RETURNS</h4><blockquote><p>N/A</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./st16552Sio.html#top">st16552Sio</a></b><hr><a name="st16552IntWr"></a><p align=right><a href="rtnIndex.html"><i>Libraries :  Routines</i></a></p></blockquote><h1><i>st16552IntWr</i>(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong><i>st16552IntWr</i>(&nbsp;)</strong> - handle a transmitter interrupt</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>void st16552IntWr    (    ST16552_CHAN * pChan /* ptr to struct describing channel */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine handles write interrupts from the UART.<p></blockquote><h4>RETURNS</h4><blockquote><p>N/A</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./st16552Sio.html#top">st16552Sio</a></b><hr><a name="st16552IntRd"></a><p align=right><a href="rtnIndex.html"><i>Libraries :  Routines</i></a></p></blockquote><h1><i>st16552IntRd</i>(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong><i>st16552IntRd</i>(&nbsp;)</strong> - handle a receiver interrupt</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>void st16552IntRd    (    ST16552_CHAN * pChan /* ptr to struct describing channel */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine handles read interrupts from the UART.<p></blockquote><h4>RETURNS</h4><blockquote><p>N/A</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./st16552Sio.html#top">st16552Sio</a></b><hr><a name="st16552IntEx"></a><p align=right><a href="rtnIndex.html"><i>Libraries :  Routines</i></a></p></blockquote><h1><i>st16552IntEx</i>(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong><i>st16552IntEx</i>(&nbsp;)</strong> - miscellaneous interrupt processing</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>void st16552IntEx    (    ST16552_CHAN * pChan /* ptr to struct describing channel */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine handles miscellaneous interrupts on the UART.<p></blockquote><h4>RETURNS</h4><blockquote><p>N/A</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./st16552Sio.html#top">st16552Sio</a></b><hr><a name="st16552Int"></a><p align=right><a href="rtnIndex.html"><i>Libraries :  Routines</i></a></p></blockquote><h1><i>st16552Int</i>(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong><i>st16552Int</i>(&nbsp;)</strong> - interrupt level processing</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>void st16552Int    (    ST16552_CHAN * pChan /* ptr to struct describing channel */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine handles interrupts from the UART.<p></blockquote><h4>RETURNS</h4><blockquote><p>N/A</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./st16552Sio.html#top">st16552Sio</a></b><hr><a name="st16552MuxInt"></a><p align=right><a href="rtnIndex.html"><i>Libraries :  Routines</i></a></p></blockquote><h1><i>st16552MuxInt</i>(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong><i>st16552MuxInt</i>(&nbsp;)</strong> - multiplexed interrupt level processing</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>void st16552MuxInt    (    ST16552_MUX * pMux /* ptr to struct describing multiplexed chans */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine handles multiplexed interrupts from the DUART. It assumes thatchannels 0 and 1 are connected so that they produce the same interrupt.<p></blockquote><h4>RETURNS</h4><blockquote><p>N/A</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./st16552Sio.html#top">st16552Sio</a></b></body></html>

⌨️ 快捷键说明

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