]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - packages/devs/serial/mips/idt79s334a/v2_0/src/mipsidt_serial.h
Initial revision
[karo-tx-redboot.git] / packages / devs / serial / mips / idt79s334a / v2_0 / src / mipsidt_serial.h
1 //==========================================================================
2 //
3 //      io/serial/mips/idt79s334a/mipsidt_serial.h
4 //
5 //      MIPS IDT79S334A Serial I/O definitions.
6 //
7 //==========================================================================
8 //####ECOSGPLCOPYRIGHTBEGIN####
9 // -------------------------------------------
10 // This file is part of eCos, the Embedded Configurable Operating System.
11 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
12 //
13 // eCos is free software; you can redistribute it and/or modify it under
14 // the terms of the GNU General Public License as published by the Free
15 // Software Foundation; either version 2 or (at your option) any later version.
16 //
17 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY
18 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
20 // for more details.
21 //
22 // You should have received a copy of the GNU General Public License along
23 // with eCos; if not, write to the Free Software Foundation, Inc.,
24 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
25 //
26 // As a special exception, if other files instantiate templates or use macros
27 // or inline functions from this file, or you compile this file and link it
28 // with other works to produce a work based on this file, this file does not
29 // by itself cause the resulting work to be covered by the GNU General Public
30 // License. However the source code for this file must still be made available
31 // in accordance with section (3) of the GNU General Public License.
32 //
33 // This exception does not invalidate any other reasons why a work based on
34 // this file might be covered by the GNU General Public License.
35 //
36 // Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
37 // at http://sources.redhat.com/ecos/ecos-license/
38 // -------------------------------------------
39 //####ECOSGPLCOPYRIGHTEND####
40 //==========================================================================
41 //#####DESCRIPTIONBEGIN####
42 //
43 // Author(s):    tmichals based on driver by dmoseley, based on POWERPC driver by jskov
44 // Contributors: gthomas, jskov, dmoseley, tmichals
45 // Date:         2003-02-13
46 // Date:         2003-02-13
47 // Purpose:      MIPS IDT79s334a reference platform serial device driver definitions.
48 // Description:  IDT MIPS serial device driver definitions.
49 //####DESCRIPTIONEND####
50 //==========================================================================
51
52 // Description of serial ports on IDT board
53
54 // Interrupt Enable Register
55 #define IER_RCV 0x01
56 #define IER_XMT 0x02
57 #define IER_LS  0x04
58 #define IER_MS  0x08
59
60 // Line Control Register
61 #define LCR_WL5 0x00    // Word length
62 #define LCR_WL6 0x01
63 #define LCR_WL7 0x02
64 #define LCR_WL8 0x03
65 #define LCR_SB1 0x00    // Number of stop bits
66 #define LCR_SB1_5 0x04  // 1.5 -> only valid with 5 bit words
67 #define LCR_SB2 0x04
68 #define LCR_PN  0x00    // Parity mode - none
69 #define LCR_PE  0x0C    // Parity mode - even
70 #define LCR_PO  0x08    // Parity mode - odd
71 #define LCR_PM  0x28    // Forced "mark" parity
72 #define LCR_PS  0x38    // Forced "space" parity
73 #define LCR_DL  0x80    // Enable baud rate latch
74
75 // Line Status Register
76 #define LSR_RSR 0x01
77 #define LSR_THE 0x20
78
79 // Modem Control Register
80 #define MCR_DTR 0x01
81 #define MCR_RTS 0x02
82 #define MCR_INT 0x08   // Enable interrupts
83
84 // Interrupt status register
85 #define ISR_None             0x01
86 #define ISR_Rx_Line_Status   0x06
87 #define ISR_Rx_Avail         0x04
88 #define ISR_Rx_Char_Timeout  0x0C
89 #define ISR_Tx_Empty         0x02
90 #define IRS_Modem_Status     0x00
91
92 // FIFO control register
93 #define FCR_ENABLE     0x01
94 #define FCR_CLEAR_RCVR 0x02
95 #define FCR_CLEAR_XMIT 0x04
96
97
98 ////////////////////////////////////////////////////////////
99 // Clean this up.
100
101 #define IDTMIPS_SER_16550_BASE_A    0xB8000803
102 #define IDTMIPS_SER_16550_BASE_B    0xB8000823
103 #define SER_16550_BASE              IDTMIPS_SER_16550_BASE_A
104 #define INTR_COM0_REG               0xB8000554
105 #define INTR_COM1_REG               0xB8000564
106
107 //-----------------------------------------------------------------------------
108 // Define the serial registers. The IDT board is equipped with a 16550C
109 // serial chip.
110 #define SER_16550_RBR 0x00   // receiver buffer register, read, dlab = 0
111 #define SER_16550_THR 0x00   // transmitter holding register, write, dlab = 0
112 #define SER_16550_DLL 0x00   // divisor latch (LS), read/write, dlab = 1
113 #define SER_16550_IER 0x04   // interrupt enable register, read/write, dlab = 0
114 #define SER_16550_DLM 0x04   // divisor latch (MS), read/write, dlab = 1
115 #define SER_16550_IIR 0x08   // interrupt identification reg, read, dlab = 0
116 #define SER_16550_FCR 0x08   // fifo control register, write, dlab = 0
117 #define SER_16550_AFR 0x08   // alternate function reg, read/write, dlab = 1
118 #define SER_16550_LCR 0x0c   // line control register, read/write
119 #define SER_16550_MCR 0x10   // modem control register, read/write
120 #define SER_16550_LSR 0x14   // line status register, read
121 #define SER_16550_MSR 0x18   // modem status register, read
122 #define SER_16550_SCR 0x1c   // scratch pad register
123
124 // The interrupt enable register bits.
125 #define SIO_IER_ERDAI   0x01            // enable received data available irq
126 #define SIO_IER_ETHREI  0x02            // enable THR empty interrupt
127 #define SIO_IER_ELSI    0x04            // enable receiver line status irq
128 #define SIO_IER_EMSI    0x08            // enable modem status interrupt
129
130 // The interrupt identification register bits.
131 #define SIO_IIR_IP      0x01            // 0 if interrupt pending
132 #define SIO_IIR_ID_MASK 0x0e            // mask for interrupt ID bits
133
134 // The line status register bits.
135 #define SIO_LSR_DR      0x01            // data ready
136 #define SIO_LSR_OE      0x02            // overrun error
137 #define SIO_LSR_PE      0x04            // parity error
138 #define SIO_LSR_FE      0x08            // framing error
139 #define SIO_LSR_BI      0x10            // break interrupt
140 #define SIO_LSR_THRE    0x20            // transmitter holding register empty
141 #define SIO_LSR_TEMT    0x40            // transmitter register empty
142 #define SIO_LSR_ERR     0x80            // any error condition
143
144 // The modem status register bits.
145 #define SIO_MSR_DCTS  0x01              // delta clear to send
146 #define SIO_MSR_DDSR  0x02              // delta data set ready
147 #define SIO_MSR_TERI  0x04              // trailing edge ring indicator
148 #define SIO_MSR_DDCD  0x08              // delta data carrier detect
149 #define SIO_MSR_CTS   0x10              // clear to send
150 #define SIO_MSR_DSR   0x20              // data set ready
151 #define SIO_MSR_RI    0x40              // ring indicator
152 #define SIO_MSR_DCD   0x80              // data carrier detect
153
154 // The line control register bits.
155 #define SIO_LCR_WLS0   0x01             // word length select bit 0
156 #define SIO_LCR_WLS1   0x02             // word length select bit 1
157 #define SIO_LCR_STB    0x04             // number of stop bits
158 #define SIO_LCR_PEN    0x08             // parity enable
159 #define SIO_LCR_EPS    0x10             // even parity select
160 #define SIO_LCR_SP     0x20             // stick parity
161 #define SIO_LCR_SB     0x40             // set break
162 #define SIO_LCR_DLAB   0x80             // divisor latch access bit
163
164 // The FIFO control register
165 #define SIO_FCR_FCR0   0x01             // enable xmit and rcvr fifos
166 #define SIO_FCR_FCR1   0x02             // clear RCVR FIFO
167 #define SIO_FCR_FCR2   0x04             // clear XMIT FIFO
168 /////////////////////////////////////////
169
170
171 static unsigned char select_word_length[] = {
172     LCR_WL5,    // 5 bits / word (char)
173     LCR_WL6,
174     LCR_WL7,
175     LCR_WL8
176 };
177
178 static unsigned char select_stop_bits[] = {
179     0,
180     LCR_SB1,    // 1 stop bit
181     LCR_SB1_5,  // 1.5 stop bit
182     LCR_SB2     // 2 stop bits
183 };
184
185 static unsigned char select_parity[] = {
186     LCR_PN,     // No parity
187     LCR_PE,     // Even parity
188     LCR_PO,     // Odd parity
189     LCR_PM,     // Mark parity
190     LCR_PS,     // Space parity
191 };
192
193
194 static unsigned int select_baud[] = {
195     0,        // Unused
196     50,       // 50
197     75,       // 75
198     110,      // 110
199     134,      // 134.5
200     150,      // 150
201     200,      // 200
202     300,      // 300
203     600,      // 600
204     1200,     // 1200
205     1800,     // 1800
206     2400,     // 2400
207     3600,     // 3600
208     4800,     // 4800
209     7200,     // 7200
210     9600,     // 9600
211     14400,    // 14400
212     19200,    // 19200
213     38400,    // 38400
214     57600,    // 57600
215     115200,   // 115200
216     230400,   // 230400
217 };
218
219 // EOF mipsidt_serial.h