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.4  2008/08/11 06:59:59  haraldkipp
00038  * BSD types replaced by stdint types (feature request #1282721).
00039  *
00040  * Revision 1.3  2007/05/24 07:29:10  haraldkipp
00041  * Update provided by Przemyslaw Rudy.
00042  *
00043  * Revision 1.2  2006/05/25 09:09:57  haraldkipp
00044  * API documentation updated and corrected.
00045  *
00046  * Revision 1.1  2005/11/24 11:24:06  haraldkipp
00047  * Initial check-in.
00048  * Many thanks to William Basser for this code and also to Przemyslaw Rudy
00049  * for several enhancements.
00050  *
00051  */
00052 
00053 /*
00054     Chip connections:
00055     Ax - to avr address lines
00056     CSx - to avr/PGA (chip select)
00057     Dn - to avr data lines
00058     INTN - to vcc (for 16c554 forces activation of interrupt lines)
00059     INTx - to avr interrupt lines (can be OR-ed and share common avr interrupt line)
00060     OIR - to avr /rd
00061     OIW - to avr /wr
00062     RESET - high is active
00063  */
00064 
00065 #include <sys/device.h>
00066 #include <dev/ace.h>
00067 
00077 
00078 #define ACE_MF_RTSSENSE     0x00000001UL    
00079 #define ACE_MF_CTSCONTROL   0x00000002UL    
00080 #define ACE_MF_DTRSENSE     0x00000004UL    
00081 #define ACE_MF_DSRCONTROL   0x00000008UL    
00082 #define ACE_MF_DCDCONTROL   0x00000010UL    
00084 #define ACE_MF_RTSCONTROL   0x00000020UL    
00085 #define ACE_MF_CTSSENSE     0x00000040UL    
00086 #define ACE_MF_DTRCONTROL   0x00000080UL    
00087 #define ACE_MF_DSRSENSE     0x00000100UL    
00088 #define ACE_MF_DCDSENSE     0x00000200UL    
00090 #define ACE_MF_SENSEMASK    0x0345  
00091 #define ACE_MF_CONTROLMASK  0x00BC  
00093 #define ACE_MF_XONXOFF      0x00000400UL    
00095 #define ACE_MF_HALFDUPLEX   0x00000800UL    
00097 #define ACE_MF_LOCALECHO    0x00010000UL    
00098 #define ACE_MF_COOKEDMODE   0x00020000UL    
00100 #define ACE_MF_NOBUFFER     0x00100000UL    
00101 #define ACE_MF_LINEBUFFER   0x00200000UL    
00102 #define ACE_MF_BUFFERMASK   0x00300000UL    
00105 #define ACE_SF_RTSOFF       0x00000001UL    
00106 #define ACE_SF_CTSOFF       0x00000002UL        
00107 #define ACE_SF_DTROFF       0x00000004UL        
00108 #define ACE_SF_DSROFF       0x00000008UL        
00109 #define ACE_SF_DCDOFF       0x00000010UL        
00111 #define ACE_SF_TXDISABLED   0x00000040UL    
00112 #define ACE_SF_RXDISABLED   0x00000080UL    
00114 #define ACE_HS_DCERTSCTS    0x00000003UL    
00115 #define ACE_HS_DCEFULL      0x0000001FUL        
00117 #define ACE_HS_DTERTSCTS    0x00000060UL    
00118 #define ACE_HS_DTEFULL      0x000003E0UL        
00120 #define ACE_HS_XONXOFF      0x00000400UL        
00122 #ifndef ACE_CLOCK
00123     #define ACE_CLOCK           14745600UL     /* in Hz - common for all devices (should be ok) */
00124 #endif
00125 
00126 #define ACE_FIFO_SIZE   16 /* hardware fifo size */
00127 
00128 /* define ACE_HDX_LINE to DTR or RTS to use HDX functionality */
00129 #ifdef ACE_HDX_LINE
00130 #undef ACE_HDX_LINE
00131 #endif
00132 #ifdef ACE_HDX_USE_RTS
00133     #define ACE_HDX_LINE MCR_RTS_MSK
00134 #endif
00135 #ifdef ACE_HDX_USE_DTR
00136     #define ACE_HDX_LINE MCR_DTR_MSK
00137 #endif  
00138 #ifdef ACE_HDX_LINE
00139     #ifdef ACE_HDX_LINE_FLIP
00140         #define ACE_HDX_RECEIVE(base) *(uint8_t *) ((base) + ACE_MCR_OFS) &= ~ACE_HDX_LINE
00141         #define ACE_HDX_TRANSMIT(base) *(uint8_t *) ((base) + ACE_MCR_OFS) |= ACE_HDX_LINE
00142         #define ACE_HDX_IS_TRANSMIT(base) (*(uint8_t *) ((base) + ACE_MCR_OFS) & ACE_HDX_LINE)
00143     #else
00144         #define ACE_HDX_RECEIVE(base) *(uint8_t *) ((base) + ACE_MCR_OFS) |= ACE_HDX_LINE
00145         #define ACE_HDX_TRANSMIT(base) *(uint8_t *) ((base) + ACE_MCR_OFS) &= ~ACE_HDX_LINE
00146         #define ACE_HDX_IS_TRANSMIT(base) (!(*(uint8_t *) ((base) + ACE_MCR_OFS) & ACE_HDX_LINE))
00147     #endif
00148 #endif
00149 
00153 typedef struct _ACEDCB ACEDCB;
00154 
00159 struct _ACEDCB {
00161     NUTDEVICE *dev_next;
00162 
00165     uint32_t dcb_rtimeout;
00166 
00169     uint32_t dcb_wtimeout;
00170 
00175     HANDLE dcb_tx_rdy;
00176 
00181     HANDLE dcb_rx_rdy;
00182 
00185     uint32_t dcb_modeflags;
00186 
00189     uint8_t dcb_rfifo;
00190 
00193     uint8_t dcb_wfifo;
00194 #ifdef ACE_HDX_LINE
00195 
00197     u_int hdxByteTime;
00198     
00201     u_int hdxOcrTime;
00202 #endif
00203 };
00204 
00207 #endif

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