OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [hal/] [mips/] [idt79s334a/] [current/] [include/] [idt32334sio.h] - Blame information for rev 786

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
#ifndef CYGONCE_HAL_IDT32334SIO_H
2
#define CYGONCE_HAL_IDT32334SIO_H
3
 
4
/*=============================================================================
5
//
6
//      idt32334sio.h
7
//
8
//      IDT 32334 serial I/O definitions
9
//
10
//=============================================================================
11
// ####ECOSGPLCOPYRIGHTBEGIN####
12
// -------------------------------------------
13
// This file is part of eCos, the Embedded Configurable Operating System.
14
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
15
//
16
// eCos is free software; you can redistribute it and/or modify it under
17
// the terms of the GNU General Public License as published by the Free
18
// Software Foundation; either version 2 or (at your option) any later
19
// version.
20
//
21
// eCos is distributed in the hope that it will be useful, but WITHOUT
22
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
23
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
24
// for more details.
25
//
26
// You should have received a copy of the GNU General Public License
27
// along with eCos; if not, write to the Free Software Foundation, Inc.,
28
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
29
//
30
// As a special exception, if other files instantiate templates or use
31
// macros or inline functions from this file, or you compile this file
32
// and link it with other works to produce a work based on this file,
33
// this file does not by itself cause the resulting work to be covered by
34
// the GNU General Public License. However the source code for this file
35
// must still be made available in accordance with section (3) of the GNU
36
// General Public License v2.
37
//
38
// This exception does not invalidate any other reasons why a work based
39
// on this file might be covered by the GNU General Public License.
40
// -------------------------------------------
41
// ####ECOSGPLCOPYRIGHTEND####
42
//==========================================================================
43
//#####DESCRIPTIONBEGIN####
44
//
45
// Author(s):    Tim Michals
46
// Contributors: nickg
47
// Date:         2003-02-13
48
// Purpose:      IDT 32334 serial I/O definitions
49
// Description:
50
// Usage:
51
//####DESCRIPTIONEND####
52
//========================================================================*/
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_Tx  0x02
86
#define ISR_Rx  0x04
87
 
88
// FIFO control register
89
#define FCR_ENABLE     0x01
90
#define FCR_CLEAR_RCVR 0x02
91
#define FCR_CLEAR_XMIT 0x04
92
 
93
 
94
 
95
////////////////////////////////////////////////////////////
96
// Clean this up.
97
 
98
//-----------------------------------------------------------------------------
99
// There are two serial ports.
100
#define CMA_SER_16550_BASE_A    0xb8000803      // port A
101
#define CMA_SER_16550_BASE_B    0xb8000823      // port B
102
#define SER_16550_BASE CMA_SER_16550_BASE_A
103
 
104
//-----------------------------------------------------------------------------
105
// Define the serial registers. The Cogent board is equipped with a 16552
106
// serial chip.
107
#define SER_16550_RBR 0x00   // receiver buffer register, read, dlab = 0
108
#define SER_16550_THR 0x00   // transmitter holding register, write, dlab = 0
109
#define SER_16550_DLL 0x00   // divisor latch (LS), read/write, dlab = 1
110
#define SER_16550_IER 0x04   // interrupt enable register, read/write, dlab = 0
111
#define SER_16550_DLM 0x04   // divisor latch (MS), read/write, dlab = 1
112
#define SER_16550_IIR 0x08   // interrupt identification reg, read, dlab = 0
113
#define SER_16550_FCR 0x08   // fifo control register, write, dlab = 0
114
#define SER_16550_AFR 0x10   // alternate function reg, read/write, dlab = 1
115
#define SER_16550_LCR 0x0c   // line control register, read/write
116
#define SER_16550_MCR 0x10   // modem control register, read/write
117
#define SER_16550_LSR 0x14   // line status register, read
118
#define SER_16550_MSR 0x18   // modem status register, read
119
#define SER_16550_SCR 0x1C   // scratch pad register
120
 
121
// The interrupt enable register bits.
122
#define SIO_IER_ERDAI   0x01            // enable received data available irq
123
#define SIO_IER_ETHREI  0x02            // enable THR empty interrupt
124
#define SIO_IER_ELSI    0x04            // enable receiver line status irq
125
#define SIO_IER_EMSI    0x08            // enable modem status interrupt
126
 
127
// The interrupt identification register bits.
128
#define SIO_IIR_IP      0x01            // 0 if interrupt pending
129
#define SIO_IIR_ID_MASK 0x0e            // mask for interrupt ID bits
130
 
131
// The line status register bits.
132
#define SIO_LSR_DR      0x01            // data ready
133
#define SIO_LSR_OE      0x02            // overrun error
134
#define SIO_LSR_PE      0x04            // parity error
135
#define SIO_LSR_FE      0x08            // framing error
136
#define SIO_LSR_BI      0x10            // break interrupt
137
#define SIO_LSR_THRE    0x20            // transmitter holding register empty
138
#define SIO_LSR_TEMT    0x40            // transmitter register empty
139
#define SIO_LSR_ERR     0x80            // any error condition
140
 
141
// The modem status register bits.
142
#define SIO_MSR_DCTS  0x01              // delta clear to send
143
#define SIO_MSR_DDSR  0x02              // delta data set ready
144
#define SIO_MSR_TERI  0x04              // trailing edge ring indicator
145
#define SIO_MSR_DDCD  0x08              // delta data carrier detect
146
#define SIO_MSR_CTS   0x10              // clear to send
147
#define SIO_MSR_DSR   0x20              // data set ready
148
#define SIO_MSR_RI    0x40              // ring indicator
149
#define SIO_MSR_DCD   0x80              // data carrier detect
150
 
151
// The line control register bits.
152
#define SIO_LCR_WLS0   0x01             // word length select bit 0
153
#define SIO_LCR_WLS1   0x02             // word length select bit 1
154
#define SIO_LCR_STB    0x04             // number of stop bits
155
#define SIO_LCR_PEN    0x08             // parity enable
156
#define SIO_LCR_EPS    0x10             // even parity select
157
#define SIO_LCR_SP     0x20             // stick parity
158
#define SIO_LCR_SB     0x40             // set break
159
#define SIO_LCR_DLAB   0x80             // divisor latch access bit
160
 
161
// The FIFO control register
162
#define SIO_FCR_FCR0   0x01             // enable xmit and rcvr fifos
163
#define SIO_FCR_FCR1   0x02             // clear RCVR FIFO
164
#define SIO_FCR_FCR2   0x04             // clear XMIT FIFO
165
/////////////////////////////////////////
166
 
167
 
168
static unsigned char select_word_length[] = {
169
    LCR_WL5,    // 5 bits / word (char)
170
    LCR_WL6,
171
    LCR_WL7,
172
    LCR_WL8
173
};
174
 
175
static unsigned char select_stop_bits[] = {
176
    0,
177
    LCR_SB1,    // 1 stop bit
178
    LCR_SB1_5,  // 1.5 stop bit
179
    LCR_SB2     // 2 stop bits
180
};
181
 
182
static unsigned char select_parity[] = {
183
    LCR_PN,     // No parity
184
    LCR_PE,     // Even parity
185
    LCR_PO,     // Odd parity
186
    LCR_PM,     // Mark parity
187
    LCR_PS,     // Space parity
188
};
189
 
190
// FIXME: calc all properly
191
// The Cogent board has a 3.6864 MHz crystal
192
static unsigned short select_baud[] = {
193
    0,    // Unused
194
    4608, // 50
195
    0,    // 75
196
    2094, // 110
197
    0,    // 134.5
198
    1536, // 150
199
    0,    // 200
200
    768,  // 300
201
    384,  // 600
202
    182,  // 1200
203
    0,    // 1800
204
    96,   // 2400
205
    0,    // 3600
206
    48,   // 4800
207
    32,   // 7200
208
    24,   // 9600
209
    16,   // 14400
210
    12,   // 19200
211
    6,    // 38400
212
    4,    // 57600
213
    2,    // 115200
214
    0,    // 230400
215
};
216
 
217
 
218
#define NS16550_XTAL_FREQ       (75 * 1000000)
219
#define IDT_BAUD_RATE                   115200
220
 
221
#endif /* CYGONCE_HAL_IDT32334SIO_H */
222
/*---------------------------------------------------------------------------*/
223
/* end of idt32334sio.h                                                      */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.