]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - packages/devs/serial/powerpc/ec555/v2_0/src/ec555_serial.h
Initial revision
[karo-tx-redboot.git] / packages / devs / serial / powerpc / ec555 / v2_0 / src / ec555_serial.h
1 #ifndef CYGONCE_DEVS_SERIAL_POWERPC_EC555_SERIAL_H
2 #define CYGONCE_DEVS_SERIAL_POWERPC_EC555_SERIAL_H
3 //==========================================================================
4 //
5 //      ec555_serial.h
6 //
7 //      PowerPC 5xx EC555 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 Red Hat, 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 version.
18 //
19 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY
20 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
22 // for more details.
23 //
24 // You should have received a copy of the GNU General Public License along
25 // with eCos; if not, write to the Free Software Foundation, Inc.,
26 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
27 //
28 // As a special exception, if other files instantiate templates or use macros
29 // or inline functions from this file, or you compile this file and link it
30 // with other works to produce a work based on this file, this file does not
31 // by itself cause the resulting work to be covered by the GNU General Public
32 // License. However the source code for this file must still be made available
33 // in accordance with section (3) of the GNU General Public License.
34 //
35 // This exception does not invalidate any other reasons why a work based on
36 // this file might be covered by the GNU General Public License.
37 //
38 // Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
39 // at http://sources.redhat.com/ecos/ecos-license/
40 // -------------------------------------------
41 //####ECOSGPLCOPYRIGHTEND####
42 //==========================================================================
43 //#####DESCRIPTIONBEGIN####
44 //
45 // Author(s):   Bob Koninckx
46 // Contributors:
47 // Date:        2002-04-25
48 // Purpose:     EC555 Serial I/O definitions.
49 // Description: 
50 //
51 //   
52 //####DESCRIPTIONEND####
53 //==========================================================================
54
55 //----------------------------------
56 // Includes and forward declarations
57 //----------------------------------
58
59 //----------------------
60 // Constants definitions
61 //----------------------
62 // Base addresses for the two serial ports
63 #define MPC555_SERIAL_BASE_A          0x305008
64 #define MPC555_SERIAL_BASE_B          0x305020
65
66 // The offset from the base for all serial registers
67 #define MPC555_SERIAL_SCCxR0          0
68 #define MPC555_SERIAL_SCCxR1          2
69 #define MPC555_SERIAL_SCxSR           4
70 #define MPC555_SERIAL_SCxDR           6
71
72 // The bits in the serial registers
73 #define MPC555_SERIAL_SCCxR0_OTHR     0x8000
74 #define MPC555_SERIAL_SCCxR0_LINKBD   0x4000
75 #define MPC555_SERIAL_SCCxR0_SCxBR    0x1fff
76
77 #define MPC555_SERIAL_SCCxR1_LOOPS    0x4000
78 #define MPC555_SERIAL_SCCxR1_WOMS     0x2000
79 #define MPC555_SERIAL_SCCxR1_ILT      0x1000
80 #define MPC555_SERIAL_SCCxR1_PT       0x0800
81 #define MPC555_SERIAL_SCCxR1_PE       0x0400
82 #define MPC555_SERIAL_SCCxR1_M        0x0200
83 #define MPC555_SERIAL_SCCxR1_WAKE     0x0100
84 #define MPC555_SERIAL_SCCxR1_TIE      0x0080
85 #define MPC555_SERIAL_SCCxR1_TCIE     0x0040
86 #define MPC555_SERIAL_SCCxR1_RIE      0x0020
87 #define MPC555_SERIAL_SCCxR1_ILIE     0x0010
88 #define MPC555_SERIAL_SCCxR1_TE       0x0008
89 #define MPC555_SERIAL_SCCxR1_RE       0x0004
90 #define MPC555_SERIAL_SCCxR1_RWU      0x0002
91 #define MPC555_SERIAL_SCCxR1_SBK      0x0001
92
93 #define MPC555_SERIAL_SCxSR_TDRE      0x0100
94 #define MPC555_SERIAL_SCxSR_TC        0x0080
95 #define MPC555_SERIAL_SCxSR_RDRF      0x0040
96 #define MPC555_SERIAL_SCxSR_RAF       0x0020
97 #define MPC555_SERIAL_SCxSR_IDLE      0x0010
98 #define MPC555_SERIAL_SCxSR_OR        0x0008
99 #define MPC555_SERIAL_SCxSR_NF        0x0004
100 #define MPC555_SERIAL_SCxSR_FE        0x0002
101 #define MPC555_SERIAL_SCxSR_PF        0x0001
102
103 // The available baud rates
104 // These are calculated for a busclock of 40 MHz
105 // It is not necessary to let the compiler calculate these
106 // values, we did not provide clockfrequency as a configuarion
107 // option anyway.
108 static unsigned short select_baud[] = {
109     0,        // Unused
110     0,        // 50     bps unsupported
111     0,        // 75     bps unsupported
112     0,        // 110    bps unsupported
113     0,        // 134_5  bps unsupported
114     0,        // 150    bps unsupported
115     0,        // 200    bps unsupported
116     4167,     // 300    bps
117     2083,     // 600    bps
118     1042,     // 1200   bps
119     0,        // 1800   bps unsupported
120     521,      // 2400   bps
121     0,        // 3600   bps unsupported
122     260,      // 4800   bps
123     0,        // 7200   bps unsupported
124     130,      // 9600   bps
125     87,       // 14400  bps
126     65,       // 19200  bps
127     33,       // 38400  bps
128     22,       // 57600  bps
129     11,       // 115200 bps
130     0         // 230400 bps unsupported
131 };
132
133 static unsigned char select_word_length[] = {
134     0,        // 5 bits / word (char) not supported
135     0,        // 6 bits / word (char) not supported
136     7,        // 7 bits / word (char) ->> 7 bits per frame
137     8         // 8 bits / word (char) ->> 8 bits per frame
138 };
139
140 static unsigned char select_stop_bits[] = {
141     0,
142     1,        // 1 stop bit ->> 1 bit per frame
143     0,        // 1.5 stop bit not supported
144     2         // 2 stop bits ->> 2 bits per frame 
145 };
146
147 static unsigned char select_parity[] = {
148     0,        // No parity ->> 0 bits per frame
149     1,        // Even parity ->> 1 bit per frame
150     1,        // Odd parityv ->> 1 bit per frame
151     0,        // Mark parity not supported
152     0,        // Space parity not supported
153 };
154
155 #endif // CYGONCE_DEVS_SERIAL_POWERPC_EC555_SERIAL_H
156
157 // EOF ec555_serial.h