1 |
786 |
skrzyp |
#ifndef CYGONCE_DEVS_SERIAL_POWERPC_MPC555_SERIAL_H
|
2 |
|
|
#define CYGONCE_DEVS_SERIAL_POWERPC_MPC555_SERIAL_H
|
3 |
|
|
//==========================================================================
|
4 |
|
|
//
|
5 |
|
|
// mpc555_serial.h
|
6 |
|
|
//
|
7 |
|
|
// PowerPC 5xx MPC555 Serial I/O definitions.
|
8 |
|
|
//
|
9 |
|
|
//==========================================================================
|
10 |
|
|
// ####ECOSGPLCOPYRIGHTBEGIN####
|
11 |
|
|
// -------------------------------------------
|
12 |
|
|
// This file is part of eCos, the Embedded Configurable Operating System.
|
13 |
|
|
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
14 |
|
|
//
|
15 |
|
|
// eCos is free software; you can redistribute it and/or modify it under
|
16 |
|
|
// the terms of the GNU General Public License as published by the Free
|
17 |
|
|
// Software Foundation; either version 2 or (at your option) any later
|
18 |
|
|
// version.
|
19 |
|
|
//
|
20 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT
|
21 |
|
|
// ANY 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
|
26 |
|
|
// along with eCos; if not, write to the Free Software Foundation, Inc.,
|
27 |
|
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
28 |
|
|
//
|
29 |
|
|
// As a special exception, if other files instantiate templates or use
|
30 |
|
|
// macros or inline functions from this file, or you compile this file
|
31 |
|
|
// and link it with other works to produce a work based on this file,
|
32 |
|
|
// this file does not by itself cause the resulting work to be covered by
|
33 |
|
|
// the GNU General Public License. However the source code for this file
|
34 |
|
|
// must still be made available in accordance with section (3) of the GNU
|
35 |
|
|
// General Public License v2.
|
36 |
|
|
//
|
37 |
|
|
// This exception does not invalidate any other reasons why a work based
|
38 |
|
|
// on this file might be covered by the GNU General Public License.
|
39 |
|
|
// -------------------------------------------
|
40 |
|
|
// ####ECOSGPLCOPYRIGHTEND####
|
41 |
|
|
//==========================================================================
|
42 |
|
|
//#####DESCRIPTIONBEGIN####
|
43 |
|
|
//
|
44 |
|
|
// Author(s): Bob Koninckx
|
45 |
|
|
// Contributors:
|
46 |
|
|
// Date: 2002-04-25
|
47 |
|
|
// Purpose: MPC555 Serial I/O definitions.
|
48 |
|
|
// Description:
|
49 |
|
|
//
|
50 |
|
|
//
|
51 |
|
|
//####DESCRIPTIONEND####
|
52 |
|
|
//==========================================================================
|
53 |
|
|
|
54 |
|
|
//----------------------------------
|
55 |
|
|
// Includes and forward declarations
|
56 |
|
|
//----------------------------------
|
57 |
|
|
|
58 |
|
|
//----------------------
|
59 |
|
|
// Constants definitions
|
60 |
|
|
//----------------------
|
61 |
|
|
// Base addresses for the two serial ports
|
62 |
|
|
#define MPC555_SERIAL_BASE_A 0x305008
|
63 |
|
|
#define MPC555_SERIAL_BASE_B 0x305020
|
64 |
|
|
|
65 |
|
|
// The offset from the base for all serial registers
|
66 |
|
|
#define MPC555_SERIAL_SCCxR0 0
|
67 |
|
|
#define MPC555_SERIAL_SCCxR1 2
|
68 |
|
|
#define MPC555_SERIAL_SCxSR 4
|
69 |
|
|
#define MPC555_SERIAL_SCxDR 6
|
70 |
|
|
|
71 |
|
|
// The bits in the serial registers
|
72 |
|
|
#define MPC555_SERIAL_SCCxR0_OTHR 0x8000
|
73 |
|
|
#define MPC555_SERIAL_SCCxR0_LINKBD 0x4000
|
74 |
|
|
#define MPC555_SERIAL_SCCxR0_SCxBR 0x1fff
|
75 |
|
|
|
76 |
|
|
#define MPC555_SERIAL_SCCxR1_LOOPS 0x4000
|
77 |
|
|
#define MPC555_SERIAL_SCCxR1_WOMS 0x2000
|
78 |
|
|
#define MPC555_SERIAL_SCCxR1_ILT 0x1000
|
79 |
|
|
#define MPC555_SERIAL_SCCxR1_PT 0x0800
|
80 |
|
|
#define MPC555_SERIAL_SCCxR1_PE 0x0400
|
81 |
|
|
#define MPC555_SERIAL_SCCxR1_M 0x0200
|
82 |
|
|
#define MPC555_SERIAL_SCCxR1_WAKE 0x0100
|
83 |
|
|
#define MPC555_SERIAL_SCCxR1_TIE 0x0080
|
84 |
|
|
#define MPC555_SERIAL_SCCxR1_TCIE 0x0040
|
85 |
|
|
#define MPC555_SERIAL_SCCxR1_RIE 0x0020
|
86 |
|
|
#define MPC555_SERIAL_SCCxR1_ILIE 0x0010
|
87 |
|
|
#define MPC555_SERIAL_SCCxR1_TE 0x0008
|
88 |
|
|
#define MPC555_SERIAL_SCCxR1_RE 0x0004
|
89 |
|
|
#define MPC555_SERIAL_SCCxR1_RWU 0x0002
|
90 |
|
|
#define MPC555_SERIAL_SCCxR1_SBK 0x0001
|
91 |
|
|
|
92 |
|
|
#define MPC555_SERIAL_SCxSR_TDRE 0x0100
|
93 |
|
|
#define MPC555_SERIAL_SCxSR_TC 0x0080
|
94 |
|
|
#define MPC555_SERIAL_SCxSR_RDRF 0x0040
|
95 |
|
|
#define MPC555_SERIAL_SCxSR_RAF 0x0020
|
96 |
|
|
#define MPC555_SERIAL_SCxSR_IDLE 0x0010
|
97 |
|
|
#define MPC555_SERIAL_SCxSR_OR 0x0008
|
98 |
|
|
#define MPC555_SERIAL_SCxSR_NF 0x0004
|
99 |
|
|
#define MPC555_SERIAL_SCxSR_FE 0x0002
|
100 |
|
|
#define MPC555_SERIAL_SCxSR_PF 0x0001
|
101 |
|
|
|
102 |
|
|
// The available baud rates
|
103 |
|
|
// These are calculated for a busclock of 40 MHz
|
104 |
|
|
// It is not necessary to let the compiler calculate these
|
105 |
|
|
// values, we did not provide clockfrequency as a configuarion
|
106 |
|
|
// option anyway.
|
107 |
|
|
static unsigned short select_baud[] = {
|
108 |
|
|
0, // Unused
|
109 |
|
|
0, // 50 bps unsupported
|
110 |
|
|
0, // 75 bps unsupported
|
111 |
|
|
0, // 110 bps unsupported
|
112 |
|
|
0, // 134_5 bps unsupported
|
113 |
|
|
0, // 150 bps unsupported
|
114 |
|
|
0, // 200 bps unsupported
|
115 |
|
|
4167, // 300 bps
|
116 |
|
|
2083, // 600 bps
|
117 |
|
|
1042, // 1200 bps
|
118 |
|
|
0, // 1800 bps unsupported
|
119 |
|
|
521, // 2400 bps
|
120 |
|
|
0, // 3600 bps unsupported
|
121 |
|
|
260, // 4800 bps
|
122 |
|
|
0, // 7200 bps unsupported
|
123 |
|
|
130, // 9600 bps
|
124 |
|
|
87, // 14400 bps
|
125 |
|
|
65, // 19200 bps
|
126 |
|
|
33, // 38400 bps
|
127 |
|
|
22, // 57600 bps
|
128 |
|
|
11, // 115200 bps
|
129 |
|
|
|
130 |
|
|
};
|
131 |
|
|
|
132 |
|
|
static unsigned char select_word_length[] = {
|
133 |
|
|
0, // 5 bits / word (char) not supported
|
134 |
|
|
0, // 6 bits / word (char) not supported
|
135 |
|
|
7, // 7 bits / word (char) ->> 7 bits per frame
|
136 |
|
|
8 // 8 bits / word (char) ->> 8 bits per frame
|
137 |
|
|
};
|
138 |
|
|
|
139 |
|
|
static unsigned char select_stop_bits[] = {
|
140 |
|
|
0,
|
141 |
|
|
1, // 1 stop bit ->> 1 bit per frame
|
142 |
|
|
0, // 1.5 stop bit not supported
|
143 |
|
|
2 // 2 stop bits ->> 2 bits per frame
|
144 |
|
|
};
|
145 |
|
|
|
146 |
|
|
static unsigned char select_parity[] = {
|
147 |
|
|
0, // No parity ->> 0 bits per frame
|
148 |
|
|
1, // Even parity ->> 1 bit per frame
|
149 |
|
|
1, // Odd parityv ->> 1 bit per frame
|
150 |
|
|
0, // Mark parity not supported
|
151 |
|
|
0, // Space parity not supported
|
152 |
|
|
};
|
153 |
|
|
|
154 |
|
|
#endif // CYGONCE_DEVS_SERIAL_POWERPC_MPC555_SERIAL_H
|
155 |
|
|
|
156 |
|
|
// EOF mpc555_serial.h
|