Nut/OS  4.10.3
API Reference
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$
00037  * Revision 1.5  2009/01/17 11:26:47  haraldkipp
00038  * Getting rid of two remaining BSD types in favor of stdint.
00039  * Replaced 'u_int' by 'unsinged int' and 'uptr_t' by 'uintptr_t'.
00040  *
00041  * Revision 1.4  2008/08/11 06:59:59  haraldkipp
00042  * BSD types replaced by stdint types (feature request #1282721).
00043  *
00044  * Revision 1.3  2007/05/24 07:29:10  haraldkipp
00045  * Update provided by Przemyslaw Rudy.
00046  *
00047  * Revision 1.2  2006/05/25 09:09:57  haraldkipp
00048  * API documentation updated and corrected.
00049  *
00050  * Revision 1.1  2005/11/24 11:24:06  haraldkipp
00051  * Initial check-in.
00052  * Many thanks to William Basser for this code and also to Przemyslaw Rudy
00053  * for several enhancements.
00054  *
00055  */
00056 
00057 /*
00058         Chip connections:
00059         Ax - to avr address lines
00060         CSx - to avr/PGA (chip select)
00061     Dn - to avr data lines
00062     INTN - to vcc (for 16c554 forces activation of interrupt lines)
00063     INTx - to avr interrupt lines (can be OR-ed and share common avr interrupt line)
00064         OIR - to avr /rd
00065         OIW - to avr /wr
00066     RESET - high is active
00067  */
00068 
00069 #include <sys/device.h>
00070 #include <dev/ace.h>
00071 
00081 
00082 #define ACE_MF_RTSSENSE         0x00000001UL    
00083 #define ACE_MF_CTSCONTROL       0x00000002UL    
00084 #define ACE_MF_DTRSENSE         0x00000004UL    
00085 #define ACE_MF_DSRCONTROL       0x00000008UL    
00086 #define ACE_MF_DCDCONTROL       0x00000010UL    
00088 #define ACE_MF_RTSCONTROL       0x00000020UL    
00089 #define ACE_MF_CTSSENSE         0x00000040UL    
00090 #define ACE_MF_DTRCONTROL       0x00000080UL    
00091 #define ACE_MF_DSRSENSE         0x00000100UL    
00092 #define ACE_MF_DCDSENSE         0x00000200UL    
00094 #define ACE_MF_SENSEMASK        0x0345  
00095 #define ACE_MF_CONTROLMASK      0x00BC  
00097 #define ACE_MF_XONXOFF          0x00000400UL    
00099 #define ACE_MF_HALFDUPLEX   0x00000800UL    
00101 #define ACE_MF_LOCALECHO        0x00010000UL    
00102 #define ACE_MF_COOKEDMODE       0x00020000UL    
00104 #define ACE_MF_NOBUFFER         0x00100000UL    
00105 #define ACE_MF_LINEBUFFER       0x00200000UL    
00106 #define ACE_MF_BUFFERMASK       0x00300000UL    
00109 #define ACE_SF_RTSOFF           0x00000001UL    
00110 #define ACE_SF_CTSOFF       0x00000002UL        
00111 #define ACE_SF_DTROFF       0x00000004UL        
00112 #define ACE_SF_DSROFF       0x00000008UL        
00113 #define ACE_SF_DCDOFF       0x00000010UL        
00115 #define ACE_SF_TXDISABLED       0x00000040UL    
00116 #define ACE_SF_RXDISABLED       0x00000080UL    
00118 #define ACE_HS_DCERTSCTS        0x00000003UL    
00119 #define ACE_HS_DCEFULL      0x0000001FUL        
00121 #define ACE_HS_DTERTSCTS        0x00000060UL    
00122 #define ACE_HS_DTEFULL      0x000003E0UL        
00124 #define ACE_HS_XONXOFF      0x00000400UL        
00126 #ifndef ACE_CLOCK
00127     #define ACE_CLOCK           14745600UL     /* in Hz - common for all devices (should be ok) */
00128 #endif
00129 
00130 #define ACE_FIFO_SIZE   16 /* hardware fifo size */
00131 
00132 /* define ACE_HDX_LINE to DTR or RTS to use HDX functionality */
00133 #ifdef ACE_HDX_LINE
00134 #undef ACE_HDX_LINE
00135 #endif
00136 #ifdef ACE_HDX_USE_RTS
00137         #define ACE_HDX_LINE MCR_RTS_MSK
00138 #endif
00139 #ifdef ACE_HDX_USE_DTR
00140         #define ACE_HDX_LINE MCR_DTR_MSK
00141 #endif  
00142 #ifdef ACE_HDX_LINE
00143     #ifdef ACE_HDX_LINE_FLIP
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     #else
00148         #define ACE_HDX_RECEIVE(base) *(uint8_t *) ((base) + ACE_MCR_OFS) |= ACE_HDX_LINE
00149         #define ACE_HDX_TRANSMIT(base) *(uint8_t *) ((base) + ACE_MCR_OFS) &= ~ACE_HDX_LINE
00150                 #define ACE_HDX_IS_TRANSMIT(base) (!(*(uint8_t *) ((base) + ACE_MCR_OFS) & ACE_HDX_LINE))
00151     #endif
00152 #endif
00153 
00157 typedef struct _ACEDCB ACEDCB;
00158 
00163 struct _ACEDCB {
00165     NUTDEVICE *dev_next;
00166 
00169     uint32_t dcb_rtimeout;
00170 
00173     uint32_t dcb_wtimeout;
00174 
00179     HANDLE dcb_tx_rdy;
00180 
00185     HANDLE dcb_rx_rdy;
00186 
00189     uint32_t dcb_modeflags;
00190 
00193     uint8_t dcb_rfifo;
00194 
00197     uint8_t dcb_wfifo;
00198 #ifdef ACE_HDX_LINE
00199 
00201         unsigned int hdxByteTime;
00202         
00205         unsigned int hdxOcrTime;
00206 #endif
00207 };
00208 
00211 #endif