Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

serial_reg.h

Go to the documentation of this file.
00001 /*
00002  * include/linux/serial_reg.h
00003  *
00004  * Copyright (C) 1992, 1994 by Theodore Ts'o.
00005  * 
00006  * Redistribution of this file is permitted under the terms of the GNU 
00007  * Public License (GPL)
00008  * 
00009  * These are the UART port assignments, expressed as offsets from the base
00010  * register.  These assignments should hold for any serial port based on
00011  * a 8250, 16450, or 16550(A).
00012  */
00013 
00014 #ifndef _LINUX_SERIAL_REG_H
00015 #define _LINUX_SERIAL_REG_H
00016 
00017 #define UART_RX         0       /* In:  Receive buffer (DLAB=0) */
00018 #define UART_TX         0       /* Out: Transmit buffer (DLAB=0) */
00019 #define UART_DLL        0       /* Out: Divisor Latch Low (DLAB=1) */
00020 #define UART_DLM        1       /* Out: Divisor Latch High (DLAB=1) */
00021 #define UART_IER        1       /* Out: Interrupt Enable Register */
00022 #define UART_IIR        2       /* In:  Interrupt ID Register */
00023 #define UART_FCR        2       /* Out: FIFO Control Register */
00024 #define UART_EFR        2       /* I/O: Extended Features Register */
00025                                 /* (DLAB=1, 16C660 only) */
00026 #define UART_LCR        3       /* Out: Line Control Register */
00027 #define UART_MCR        4       /* Out: Modem Control Register */
00028 #define UART_LSR        5       /* In:  Line Status Register */
00029 #define UART_MSR        6       /* In:  Modem Status Register */
00030 #define UART_SCR        7       /* I/O: Scratch Register */
00031 
00032 /*
00033  * These are the definitions for the FIFO Control Register
00034  * (16650 only)
00035  */
00036 #define UART_FCR_ENABLE_FIFO    0x01 /* Enable the FIFO */
00037 #define UART_FCR_CLEAR_RCVR     0x02 /* Clear the RCVR FIFO */
00038 #define UART_FCR_CLEAR_XMIT     0x04 /* Clear the XMIT FIFO */
00039 #define UART_FCR_DMA_SELECT     0x08 /* For DMA applications */
00040 #define UART_FCR_TRIGGER_MASK   0xC0 /* Mask for the FIFO trigger range */
00041 #define UART_FCR_TRIGGER_1      0x00 /* Mask for trigger set at 1 */
00042 #define UART_FCR_TRIGGER_4      0x40 /* Mask for trigger set at 4 */
00043 #define UART_FCR_TRIGGER_8      0x80 /* Mask for trigger set at 8 */
00044 #define UART_FCR_TRIGGER_14     0xC0 /* Mask for trigger set at 14 */
00045 /* 16650 redefinitions */
00046 #define UART_FCR6_R_TRIGGER_8   0x00 /* Mask for receive trigger set at 1 */
00047 #define UART_FCR6_R_TRIGGER_16  0x40 /* Mask for receive trigger set at 4 */
00048 #define UART_FCR6_R_TRIGGER_24  0x80 /* Mask for receive trigger set at 8 */
00049 #define UART_FCR6_R_TRIGGER_28  0xC0 /* Mask for receive trigger set at 14 */
00050 #define UART_FCR6_T_TRIGGER_16  0x00 /* Mask for transmit trigger set at 16 */
00051 #define UART_FCR6_T_TRIGGER_8   0x10 /* Mask for transmit trigger set at 8 */
00052 #define UART_FCR6_T_TRIGGER_24  0x20 /* Mask for transmit trigger set at 24 */
00053 #define UART_FCR6_T_TRIGGER_30  0x30 /* Mask for transmit trigger set at 30 */
00054 /* TI 16750 definitions */
00055 #define UART_FCR7_64BYTE        0x20 /* Go into 64 byte mode */
00056 
00057 /*
00058  * These are the definitions for the Line Control Register
00059  * 
00060  * Note: if the word length is 5 bits (UART_LCR_WLEN5), then setting 
00061  * UART_LCR_STOP will select 1.5 stop bits, not 2 stop bits.
00062  */
00063 #define UART_LCR_DLAB   0x80    /* Divisor latch access bit */
00064 #define UART_LCR_SBC    0x40    /* Set break control */
00065 #define UART_LCR_SPAR   0x20    /* Stick parity (?) */
00066 #define UART_LCR_EPAR   0x10    /* Even parity select */
00067 #define UART_LCR_PARITY 0x08    /* Parity Enable */
00068 #define UART_LCR_STOP   0x04    /* Stop bits: 0=1 stop bit, 1= 2 stop bits */
00069 #define UART_LCR_WLEN5  0x00    /* Wordlength: 5 bits */
00070 #define UART_LCR_WLEN6  0x01    /* Wordlength: 6 bits */
00071 #define UART_LCR_WLEN7  0x02    /* Wordlength: 7 bits */
00072 #define UART_LCR_WLEN8  0x03    /* Wordlength: 8 bits */
00073 
00074 /*
00075  * These are the definitions for the Line Status Register
00076  */
00077 #define UART_LSR_TEMT   0x40    /* Transmitter empty */
00078 #define UART_LSR_THRE   0x20    /* Transmit-hold-register empty */
00079 #define UART_LSR_BI     0x10    /* Break interrupt indicator */
00080 #define UART_LSR_FE     0x08    /* Frame error indicator */
00081 #define UART_LSR_PE     0x04    /* Parity error indicator */
00082 #define UART_LSR_OE     0x02    /* Overrun error indicator */
00083 #define UART_LSR_DR     0x01    /* Receiver data ready */
00084 
00085 /*
00086  * These are the definitions for the Interrupt Identification Register
00087  */
00088 #define UART_IIR_NO_INT 0x01    /* No interrupts pending */
00089 #define UART_IIR_ID     0x06    /* Mask for the interrupt ID */
00090 
00091 #define UART_IIR_MSI    0x00    /* Modem status interrupt */
00092 #define UART_IIR_THRI   0x02    /* Transmitter holding register empty */
00093 #define UART_IIR_RDI    0x04    /* Receiver data interrupt */
00094 #define UART_IIR_RLSI   0x06    /* Receiver line status interrupt */
00095 
00096 /*
00097  * These are the definitions for the Interrupt Enable Register
00098  */
00099 #define UART_IER_MSI    0x08    /* Enable Modem status interrupt */
00100 #define UART_IER_RLSI   0x04    /* Enable receiver line status interrupt */
00101 #define UART_IER_THRI   0x02    /* Enable Transmitter holding register int. */
00102 #define UART_IER_RDI    0x01    /* Enable receiver data interrupt */
00103 /*
00104  * Sleep mode for ST16650 and TI16750.
00105  * Note that for 16650, EFR-bit 4 must be selected as well.
00106  */
00107 #define UART_IERX_SLEEP  0x10   /* Enable sleep mode */
00108 
00109 /*
00110  * These are the definitions for the Modem Control Register
00111  */
00112 #define UART_MCR_LOOP   0x10    /* Enable loopback test mode */
00113 #define UART_MCR_OUT2   0x08    /* Out2 complement */
00114 #define UART_MCR_OUT1   0x04    /* Out1 complement */
00115 #define UART_MCR_RTS    0x02    /* RTS complement */
00116 #define UART_MCR_DTR    0x01    /* DTR complement */
00117 
00118 /*
00119  * These are the definitions for the Modem Status Register
00120  */
00121 #define UART_MSR_DCD    0x80    /* Data Carrier Detect */
00122 #define UART_MSR_RI     0x40    /* Ring Indicator */
00123 #define UART_MSR_DSR    0x20    /* Data Set Ready */
00124 #define UART_MSR_CTS    0x10    /* Clear to Send */
00125 #define UART_MSR_DDCD   0x08    /* Delta DCD */
00126 #define UART_MSR_TERI   0x04    /* Trailing edge ring indicator */
00127 #define UART_MSR_DDSR   0x02    /* Delta DSR */
00128 #define UART_MSR_DCTS   0x01    /* Delta CTS */
00129 #define UART_MSR_ANY_DELTA 0x0F /* Any of the delta bits! */
00130 
00131 /*
00132  * These are the definitions for the Extended Features Register
00133  * (StarTech 16C660 only, when DLAB=1)
00134  */
00135 #define UART_EFR_CTS    0x80    /* CTS flow control */
00136 #define UART_EFR_RTS    0x40    /* RTS flow control */
00137 #define UART_EFR_SCD    0x20    /* Special character detect */
00138 #define UART_EFR_ECB    0x10    /* Enhanced control bit */
00139 /*
00140  * the low four bits control software flow control
00141  */
00142 
00143 #endif /* _LINUX_SERIAL_REG_H */
00144