tlc16c550.h

Go to the documentation of this file.
00001 #ifndef _DEV_TLC16C550_H_
00002 #define _DEV_TLC16C550_H_
00003 
00004 /*
00005  * Copyright (C) 2001-2003 by Cyber Integration, LLC. All rights reserved.
00006  *
00007  * Redistribution and use in source and binary forms, with or without
00008  * modification, are permitted provided that the following conditions
00009  * are met:
00010  *
00011  * 1. Redistributions of source code must retain the above copyright
00012  *    notice, this list of conditions and the following disclaimer.
00013  * 2. Redistributions in binary form must reproduce the above copyright
00014  *    notice, this list of conditions and the following disclaimer in the
00015  *    documentation and/or other materials provided with the distribution.
00016  * 3. Neither the name of the copyright holders nor the names of
00017  *    contributors may be used to endorse or promote products derived
00018  *    from this software without specific prior written permission.
00019  *
00020  * THIS SOFTWARE IS PROVIDED BY CYBER INTEGRATION, LLC AND CONTRIBUTORS
00021  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00022  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00023  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CYBER
00024  * INTEGRATION, LLC OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00025  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00026  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
00027  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
00028  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00029  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
00030  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00031  * SUCH DAMAGE.
00032  *
00033  */
00034 
00035 /*
00036  * $Log: tlc16c550.h,v $
00037  * Revision 1.3  2007/05/24 07:29:10  haraldkipp
00038  * Update provided by Przemyslaw Rudy.
00039  *
00040  * Revision 1.2  2006/05/25 09:09:57  haraldkipp
00041  * API documentation updated and corrected.
00042  *
00043  * Revision 1.1  2005/11/24 11:24:06  haraldkipp
00044  * Initial check-in.
00045  * Many thanks to William Basser for this code and also to Przemyslaw Rudy
00046  * for several enhancements.
00047  *
00048  */
00049 
00050 /*
00051     Chip connections:
00052     Ax - to avr address lines
00053     CSx - to avr/PGA (chip select)
00054     Dn - to avr data lines
00055     INTN - to vcc (for 16c554 forces activation of interrupt lines)
00056     INTx - to avr interrupt lines (can be OR-ed and share common avr interrupt line)
00057     OIR - to avr /rd
00058     OIW - to avr /wr
00059     RESET - high is active
00060  */
00061 
00062 #include <sys/device.h>
00063 #include <dev/ace.h>
00064 
00074 
00075 #define ACE_MF_RTSSENSE     0x00000001UL    
00076 #define ACE_MF_CTSCONTROL   0x00000002UL    
00077 #define ACE_MF_DTRSENSE     0x00000004UL    
00078 #define ACE_MF_DSRCONTROL   0x00000008UL    
00079 #define ACE_MF_DCDCONTROL   0x00000010UL    
00081 #define ACE_MF_RTSCONTROL   0x00000020UL    
00082 #define ACE_MF_CTSSENSE     0x00000040UL    
00083 #define ACE_MF_DTRCONTROL   0x00000080UL    
00084 #define ACE_MF_DSRSENSE     0x00000100UL    
00085 #define ACE_MF_DCDSENSE     0x00000200UL    
00087 #define ACE_MF_SENSEMASK    0x0345  
00088 #define ACE_MF_CONTROLMASK  0x00BC  
00090 #define ACE_MF_XONXOFF      0x00000400UL    
00092 #define ACE_MF_HALFDUPLEX   0x00000800UL    
00094 #define ACE_MF_LOCALECHO    0x00010000UL    
00095 #define ACE_MF_COOKEDMODE   0x00020000UL    
00097 #define ACE_MF_NOBUFFER     0x00100000UL    
00098 #define ACE_MF_LINEBUFFER   0x00200000UL    
00099 #define ACE_MF_BUFFERMASK   0x00300000UL    
00102 #define ACE_SF_RTSOFF       0x00000001UL    
00103 #define ACE_SF_CTSOFF       0x00000002UL        
00104 #define ACE_SF_DTROFF       0x00000004UL        
00105 #define ACE_SF_DSROFF       0x00000008UL        
00106 #define ACE_SF_DCDOFF       0x00000010UL        
00108 #define ACE_SF_TXDISABLED   0x00000040UL    
00109 #define ACE_SF_RXDISABLED   0x00000080UL    
00111 #define ACE_HS_DCERTSCTS    0x00000003UL    
00112 #define ACE_HS_DCEFULL      0x0000001FUL        
00114 #define ACE_HS_DTERTSCTS    0x00000060UL    
00115 #define ACE_HS_DTEFULL      0x000003E0UL        
00117 #define ACE_HS_XONXOFF      0x00000400UL        
00119 #ifndef ACE_CLOCK
00120     #define ACE_CLOCK           14745600UL     /* in Hz - common for all devices (should be ok) */
00121 #endif
00122 
00123 #define ACE_FIFO_SIZE   16 /* hardware fifo size */
00124 
00125 /* define ACE_HDX_LINE to DTR or RTS to use HDX functionality */
00126 #ifdef ACE_HDX_LINE
00127 #undef ACE_HDX_LINE
00128 #endif
00129 #ifdef ACE_HDX_USE_RTS
00130     #define ACE_HDX_LINE MCR_RTS_MSK
00131 #endif
00132 #ifdef ACE_HDX_USE_DTR
00133     #define ACE_HDX_LINE MCR_DTR_MSK
00134 #endif  
00135 #ifdef ACE_HDX_LINE
00136     #ifdef ACE_HDX_LINE_FLIP
00137         #define ACE_HDX_RECEIVE(base) *(u_char *) ((base) + ACE_MCR_OFS) &= ~ACE_HDX_LINE
00138         #define ACE_HDX_TRANSMIT(base) *(u_char *) ((base) + ACE_MCR_OFS) |= ACE_HDX_LINE
00139         #define ACE_HDX_IS_TRANSMIT(base) (*(u_char *) ((base) + ACE_MCR_OFS) & ACE_HDX_LINE)
00140     #else
00141         #define ACE_HDX_RECEIVE(base) *(u_char *) ((base) + ACE_MCR_OFS) |= ACE_HDX_LINE
00142         #define ACE_HDX_TRANSMIT(base) *(u_char *) ((base) + ACE_MCR_OFS) &= ~ACE_HDX_LINE
00143         #define ACE_HDX_IS_TRANSMIT(base) (!(*(u_char *) ((base) + ACE_MCR_OFS) & ACE_HDX_LINE))
00144     #endif
00145 #endif
00146 
00150 typedef struct _ACEDCB ACEDCB;
00151 
00156 struct _ACEDCB {
00158     NUTDEVICE *dev_next;
00159 
00162     u_long dcb_rtimeout;
00163 
00166     u_long dcb_wtimeout;
00167 
00172     HANDLE dcb_tx_rdy;
00173 
00178     HANDLE dcb_rx_rdy;
00179 
00182     u_long dcb_modeflags;
00183 
00186     u_char dcb_rfifo;
00187 
00190     u_char dcb_wfifo;
00191 #ifdef ACE_HDX_LINE
00192 
00194     u_int hdxByteTime;
00195     
00198     u_int hdxOcrTime;
00199 #endif
00200 };
00201 
00204 #endif

© 2000-2007 by egnite Software GmbH - visit http://www.ethernut.de/