1 |
27 |
unneback |
#ifndef CYGONCE_ARM_CMA230_SERIAL_H
|
2 |
|
|
#define CYGONCE_ARM_CMA230_SERIAL_H
|
3 |
|
|
|
4 |
|
|
// ====================================================================
|
5 |
|
|
//
|
6 |
|
|
// cma230_serial.h
|
7 |
|
|
//
|
8 |
|
|
// Device I/O - Description of Cogent CMA230 serial hardware
|
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 Red Hat, 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 version.
|
19 |
|
|
//
|
20 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
|
21 |
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
22 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
23 |
|
|
// for more details.
|
24 |
|
|
//
|
25 |
|
|
// You should have received a copy of the GNU General Public License along
|
26 |
|
|
// with eCos; if not, write to the Free Software Foundation, Inc.,
|
27 |
|
|
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
28 |
|
|
//
|
29 |
|
|
// As a special exception, if other files instantiate templates or use macros
|
30 |
|
|
// or inline functions from this file, or you compile this file and link it
|
31 |
|
|
// with other works to produce a work based on this file, this file does not
|
32 |
|
|
// by itself cause the resulting work to be covered by the GNU General Public
|
33 |
|
|
// License. However the source code for this file must still be made available
|
34 |
|
|
// in accordance with section (3) of the GNU General Public License.
|
35 |
|
|
//
|
36 |
|
|
// This exception does not invalidate any other reasons why a work based on
|
37 |
|
|
// this file might be covered by the GNU General Public License.
|
38 |
|
|
//
|
39 |
|
|
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
|
40 |
|
|
// at http://sources.redhat.com/ecos/ecos-license/
|
41 |
|
|
// -------------------------------------------
|
42 |
|
|
//####ECOSGPLCOPYRIGHTEND####
|
43 |
|
|
// ====================================================================
|
44 |
|
|
//#####DESCRIPTIONBEGIN####
|
45 |
|
|
//
|
46 |
|
|
// Author(s): gthomas
|
47 |
|
|
// Contributors: gthomas
|
48 |
|
|
// Date: 1999-05-20
|
49 |
|
|
// Purpose: Internal interfaces for serial I/O drivers
|
50 |
|
|
// Description:
|
51 |
|
|
//
|
52 |
|
|
//####DESCRIPTIONEND####
|
53 |
|
|
//
|
54 |
|
|
// ====================================================================
|
55 |
|
|
|
56 |
|
|
// Description of serial ports on Cogent CMA230
|
57 |
|
|
|
58 |
|
|
struct serial_port {
|
59 |
|
|
unsigned char _byte[32];
|
60 |
|
|
};
|
61 |
|
|
|
62 |
|
|
#define reg(n) _byte[n*8]
|
63 |
|
|
|
64 |
|
|
// Receive control registers
|
65 |
|
|
#define rhr reg(0) // Receive holding register
|
66 |
|
|
#define isr reg(2) // Interrupt status register
|
67 |
|
|
#define lsr reg(5) // Line status register
|
68 |
|
|
#define msr reg(6) // Modem status register
|
69 |
|
|
#define scr reg(7) // Scratch register
|
70 |
|
|
|
71 |
|
|
// Transmit control registers
|
72 |
|
|
#define thr reg(0) // Transmit holding register
|
73 |
|
|
#define ier reg(1) // Interrupt enable register
|
74 |
|
|
#define fcr reg(2) // FIFO control register
|
75 |
|
|
#define lcr reg(3) // Line control register
|
76 |
|
|
#define mcr reg(4) // Modem control register
|
77 |
|
|
#define ldl reg(0) // LSB of baud rate
|
78 |
|
|
#define mdl reg(1) // MSB of baud rate
|
79 |
|
|
|
80 |
|
|
// Interrupt Enable Register
|
81 |
|
|
#define IER_RCV 0x01
|
82 |
|
|
#define IER_XMT 0x02
|
83 |
|
|
#define IER_LS 0x04
|
84 |
|
|
#define IER_MS 0x08
|
85 |
|
|
|
86 |
|
|
// Line Control Register
|
87 |
|
|
#define LCR_WL5 0x00 // Word length
|
88 |
|
|
#define LCR_WL6 0x01
|
89 |
|
|
#define LCR_WL7 0x02
|
90 |
|
|
#define LCR_WL8 0x03
|
91 |
|
|
#define LCR_SB1 0x00 // Number of stop bits
|
92 |
|
|
#define LCR_SB1_5 0x04 // 1.5 -> only valid with 5 bit words
|
93 |
|
|
#define LCR_SB2 0x04
|
94 |
|
|
#define LCR_PN 0x00 // Parity mode - none
|
95 |
|
|
#define LCR_PE 0x0C // Parity mode - even
|
96 |
|
|
#define LCR_PO 0x08 // Parity mode - odd
|
97 |
|
|
#define LCR_PM 0x28 // Forced "mark" parity
|
98 |
|
|
#define LCR_PS 0x38 // Forced "space" parity
|
99 |
|
|
#define LCR_DL 0x80 // Enable baud rate latch
|
100 |
|
|
|
101 |
|
|
// Line Status Register
|
102 |
|
|
#define LSR_RSR 0x01
|
103 |
|
|
#define LSR_THE 0x20
|
104 |
|
|
|
105 |
|
|
// Modem Control Register
|
106 |
|
|
#define MCR_DTR 0x01
|
107 |
|
|
#define MCR_RTS 0x02
|
108 |
|
|
#define MCR_INT 0x08 // Enable interrupts
|
109 |
|
|
|
110 |
|
|
// Interrupt status register
|
111 |
|
|
#define ISR_Tx 0x02
|
112 |
|
|
#define ISR_Rx 0x04
|
113 |
|
|
|
114 |
|
|
static unsigned char select_word_length[] = {
|
115 |
|
|
LCR_WL5, // 5 bits / word (char)
|
116 |
|
|
LCR_WL6,
|
117 |
|
|
LCR_WL7,
|
118 |
|
|
LCR_WL8
|
119 |
|
|
};
|
120 |
|
|
|
121 |
|
|
static unsigned char select_stop_bits[] = {
|
122 |
|
|
0,
|
123 |
|
|
LCR_SB1, // 1 stop bit
|
124 |
|
|
LCR_SB1_5, // 1.5 stop bit
|
125 |
|
|
LCR_SB2 // 2 stop bits
|
126 |
|
|
};
|
127 |
|
|
|
128 |
|
|
static unsigned char select_parity[] = {
|
129 |
|
|
LCR_PN, // No parity
|
130 |
|
|
LCR_PE, // Even parity
|
131 |
|
|
LCR_PO, // Odd parity
|
132 |
|
|
LCR_PM, // Mark parity
|
133 |
|
|
LCR_PS, // Space parity
|
134 |
|
|
};
|
135 |
|
|
|
136 |
|
|
// The Cogent board has a 3.6864 MHz crystal
|
137 |
|
|
static unsigned short select_baud[] = {
|
138 |
|
|
0, // Unused
|
139 |
|
|
4608, // 50
|
140 |
|
|
0, // 75
|
141 |
|
|
2094, // 110
|
142 |
|
|
0, // 134.5
|
143 |
|
|
1536, // 150
|
144 |
|
|
0, // 200
|
145 |
|
|
768, // 300
|
146 |
|
|
384, // 600
|
147 |
|
|
182, // 1200
|
148 |
|
|
0, // 1800
|
149 |
|
|
96, // 2400
|
150 |
|
|
0, // 3600
|
151 |
|
|
48, // 4800
|
152 |
|
|
32, // 7200
|
153 |
|
|
24, // 9600
|
154 |
|
|
16, // 14400
|
155 |
|
|
12, // 19200
|
156 |
|
|
6, // 38400
|
157 |
|
|
4, // 57600
|
158 |
|
|
2, // 115200
|
159 |
|
|
0, // 230400
|
160 |
|
|
};
|
161 |
|
|
|
162 |
|
|
#endif // CYGONCE_ARM_CMA230_SERIAL_H
|