📄 ambasio.html
字号:
<html><head><!-- /vobs/wpwr/docs/vxworks/ref/ambaSio.html - generated by refgen from ambaSio.c --> <title> ambaSio </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>ambaSio</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>ambaSio</strong> - ARM AMBA UART tty driver </p></blockquote><h4>ROUTINES</h4><blockquote><p><p><b><i><a href="./ambaSio.html#ambaDevInit">ambaDevInit</a></i>( )</b> - initialise an AMBA channel<br><b><i><a href="./ambaSio.html#ambaIntTx">ambaIntTx</a></i>( )</b> - handle a transmitter interrupt <br><b><i><a href="./ambaSio.html#ambaIntRx">ambaIntRx</a></i>( )</b> - handle a receiver interrupt <br><p></blockquote><h4>DESCRIPTION</h4><blockquote><p>This is the device driver for the Advanced RISC Machines (ARM) AMBAUART. This is a generic design of UART used within a number of chipscontaining (or for use with) ARM CPUs such as in the Digital Semiconductor21285 chip as used in the EBSA-285 BSP.<p>This design contains a universal asynchronous receiver/transmitter, abaud-rate generator, and an InfraRed Data Association (IrDa) SerialInfraRed (SiR) protocol encoder. The Sir encoder is not supported bythis driver. The UART contains two 16-entry deep FIFOs for receive andtransmit: if a framing, overrun or parity error occurs duringreception, the appropriate error bits are stored in the receive FIFOalong with the received data. The FIFOs can be programmed to be onebyte deep only, like a conventional UART with double buffering, but theonly mode of operation supported is with the FIFOs enabled.<p>The UART design does not support the modem control output signals: DTR,RI and RTS. Moreover, the implementation in the 21285 chip does notsupport the modem control inputs: DCD, CTS and DSR.<p>The UART design can generate four interrupts: Rx, Tx, modem statuschange and a UART disabled interrupt (which is asserted when a startbit is detected on the receive line when the UART is disabled). Theimplementation in the 21285 chip has only two interrupts: Rx and Tx,but the Rx interrupt is a combination of the normal Rx interrupt statusand the UART disabled interrupt status.<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>AMBA_CHAN</b> structure beforecalling <b><i><a href="./ambaSio.html#ambaDevInit">ambaDevInit</a></i>( )</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 300 to about 115200are possible.<p>In theory, any number of UART channels could be implemented within achip. This driver has been designed to cope with an arbitrary number ofchannels, but at the time of writing, has only ever been tested withone channel.<p></blockquote><h4>DATA STRUCTURES</h4><blockquote><p>An <b>AMBA_CHAN</b> data structure is used to describe each channel, thisstructure is 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 modules are <b><i><a href="./ambaSio.html#ambaDevInit">ambaDevInit</a></i>( )</b>, <b><i><a href="./ambaSio.html#ambaIntTx">ambaIntTx</a></i>( )</b> and<b><i><a href="./ambaSio.html#ambaIntRx">ambaIntRx</a></i>( )</b>.<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>, whichinitialises the hardware-specific fields in the <b>AMBA_CHAN</b> structure(e.g. register I/O addresses etc) before calling <b><i><a href="./ambaSio.html#ambaDevInit">ambaDevInit</a></i>( )</b> whichresets the device and installs the driver function pointers. Afterthis the UART will be enabled and ready to generate interrupts, butthose interrupts will be disabled in the interrupt controller.<p>The following example shows the first parts of the initialisation:<p><pre>#include "drv/sio/ambaSio.h"LOCAL AMBA_CHAN ambaChan[N_AMBA_UART_CHANS];void sysSerialHwInit (void) { int i; for (i = 0; i < N_AMBA_UART_CHANS; i++) { ambaChan[i].regs = devParas[i].baseAdrs; ambaChan[i].baudRate = CONSOLE_BAUD_RATE; ambaChan[i].xtal = UART_XTAL_FREQ; ambaChan[i].levelRx = devParas[i].intLevelRx; ambaChan[i].levelTx = devParas[i].intLevelTx; /* * Initialise driver functions, getTxChar, putRcvChar and * channelMode, then initialise UART */ ambaDevInit(&ambaChan[i]); } }</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>,which connects the chips interrupts via <b><i><a href="./intArchLib.html#intConnect">intConnect</a></i>( )</b> (the twointerrupts <b>ambaIntTx</b> and <b>ambaIntRx</b>) and enables those interrupts,as shown in the following example:<p><pre>void sysSerialHwInit2 (void) { /* connect and enable Rx interrupt */ (void) intConnect (INUM_TO_IVEC(devParas[0].vectorRx), ambaIntRx, (int) &ambaChan[0]); intEnable (devParas[0].intLevelRx); /* connect Tx interrupt */ (void) intConnect (INUM_TO_IVEC(devParas[0].vectorTx), ambaIntTx, (int) &ambaChan[0]); /* * There is no point in enabling the Tx interrupt, as it will * interrupt immediately and then be disabled. */ }</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>( )</b><b><i><a href="./sysLib.html#sysSerialHwInit2">sysSerialHwInit2</a></i>( )</b>, <b><i><a href="./sysLib.html#sysSerialChanGet">sysSerialChanGet</a></i>( )</b>, and <b><i><a href="./sysLib.html#sysSerialReset">sysSerialReset</a></i>( )</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>AMBA_CHAN</b> structure.<p>sysSerialReset is called from <b><i><a href="./sysLib.html#sysToMonitor">sysToMonitor</a></i>( )</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/ambaSio.h</b> <b>sioLib.h</b><p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./ambaSio.html#top">ambaSio</a></b>, <i>Advanced RISC Machines AMBA UART (AP13) Data Sheet, </i><i>Digital Semiconductor 21285 Core Logic for SA-110 Microprocessor Data </i>Sheet, "<i>Digital Semiconductor EBSA-285 Evaluation Board Reference Manual. </i><hr><a name="ambaDevInit"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>ambaDevInit</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>ambaDevInit</i>( )</strong> - initialise an AMBA channel</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>void ambaDevInit ( AMBA_CHAN * pChan /* ptr to AMBA_CHAN describing this channel */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine initialises some <b>SIO_CHAN</b> function pointers and then resetsthe chip to a quiescent state. Before this routine is called, the BSPmust already have initialised all the device addresses, etc. in the<b>AMBA_CHAN</b> structure.<p></blockquote><h4>RETURNS</h4><blockquote><p>N/A</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./ambaSio.html#top">ambaSio</a></b><hr><a name="ambaIntTx"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>ambaIntTx</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>ambaIntTx</i>( )</strong> - handle a transmitter interrupt </p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>void ambaIntTx ( AMBA_CHAN * pChan /* ptr to AMBA_CHAN describing this 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="./ambaSio.html#top">ambaSio</a></b><hr><a name="ambaIntRx"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>ambaIntRx</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>ambaIntRx</i>( )</strong> - handle a receiver interrupt </p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>void ambaIntRx ( AMBA_CHAN * pChan /* ptr to AMBA_CHAN describing this 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="./ambaSio.html#top">ambaSio</a></b></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -