]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - packages/devs/serial/powerpc/ppc405/v2_0/include/powerpc_ppc405_ser.inl
Initial revision
[karo-tx-redboot.git] / packages / devs / serial / powerpc / ppc405 / v2_0 / include / powerpc_ppc405_ser.inl
1 //==========================================================================
2 //
3 //      io/serial/powerpc/powerpc_ppc405_ser.inl
4 //
5 //      PPC405GP/EP 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 // Copyright (C) 2003 Gary Thomas
13 //
14 // eCos is free software; you can redistribute it and/or modify it under
15 // the terms of the GNU General Public License as published by the Free
16 // Software Foundation; either version 2 or (at your option) any later version.
17 //
18 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY
19 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
21 // for more details.
22 //
23 // You should have received a copy of the GNU General Public License along
24 // with eCos; if not, write to the Free Software Foundation, Inc.,
25 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
26 //
27 // As a special exception, if other files instantiate templates or use macros
28 // or inline functions from this file, or you compile this file and link it
29 // with other works to produce a work based on this file, this file does not
30 // by itself cause the resulting work to be covered by the GNU General Public
31 // License. However the source code for this file must still be made available
32 // in accordance with section (3) of the GNU General Public License.
33 //
34 // This exception does not invalidate any other reasons why a work based on
35 // this file might be covered by the GNU General Public License.
36 //
37 // Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
38 // at http://sources.redhat.com/ecos/ecos-license/
39 // -------------------------------------------
40 //####ECOSGPLCOPYRIGHTEND####
41 //==========================================================================
42 //#####DESCRIPTIONBEGIN####
43 //
44 // Author(s):    gthomas
45 // Contributors: 
46 // Date:         2003-09-16
47 // Purpose:      PowerPC PPC405GP/EP serial drivers
48 // Description: 
49 //
50 //####DESCRIPTIONEND####
51 //
52 //==========================================================================
53
54 #include <cyg/hal/hal_intr.h>
55 #define CYGARC_HAL_COMMON_EXPORT_CPU_MACROS
56 #include <cyg/hal/ppc_regs.h>
57
58 //-----------------------------------------------------------------------------
59 // Baud rate specification
60
61 static unsigned int select_baud[] = {
62     9999, // Unused -- marker
63     50,
64     75,
65     110,
66     134,
67     150,
68     200,
69     300,
70     600,
71     1200,
72     1800,
73     2400,
74     3600,
75     4800,
76     7200,
77     9600,
78     14400,
79     19200,
80     38400,
81     57600,
82     115200,
83     230400
84 };
85
86 externC int cyg_var_baud_generator(int baud);
87 #define CYG_IO_SERIAL_GENERIC_16X5X_BAUD_GENERATOR cyg_var_baud_generator
88
89 #ifdef CYGPKG_IO_SERIAL_POWERPC_PPC405_SERIAL0
90 #if defined(CYGHWR_HAL_POWERPC_PPC4XX_405GP)
91 static pc_serial_info ppc405_serial_info0 = {_PPC405GP_UART0, CYGNUM_HAL_INTERRUPT_UART0};
92 #endif
93 #if defined(CYGHWR_HAL_POWERPC_PPC4XX_405EP)
94 static pc_serial_info ppc405_serial_info0 = {_PPC405EP_UART0, CYGNUM_HAL_INTERRUPT_UART0};
95 #endif
96 #if CYGNUM_IO_SERIAL_POWERPC_PPC405_SERIAL0_BUFSIZE > 0
97 static unsigned char ppc405_serial_out_buf0[CYGNUM_IO_SERIAL_POWERPC_PPC405_SERIAL0_BUFSIZE];
98 static unsigned char ppc405_serial_in_buf0[CYGNUM_IO_SERIAL_POWERPC_PPC405_SERIAL0_BUFSIZE];
99
100 static SERIAL_CHANNEL_USING_INTERRUPTS(ppc405_serial_channel0,
101                                        pc_serial_funs, 
102                                        ppc405_serial_info0,
103                                        CYG_SERIAL_BAUD_RATE(CYGNUM_IO_SERIAL_POWERPC_PPC405_SERIAL0_BAUD),
104                                        CYG_SERIAL_STOP_DEFAULT,
105                                        CYG_SERIAL_PARITY_DEFAULT,
106                                        CYG_SERIAL_WORD_LENGTH_DEFAULT,
107                                        CYG_SERIAL_FLAGS_DEFAULT,
108                                        &ppc405_serial_out_buf0[0], sizeof(ppc405_serial_out_buf0),
109                                        &ppc405_serial_in_buf0[0], sizeof(ppc405_serial_in_buf0)
110     );
111 #else
112 static SERIAL_CHANNEL(ppc405_serial_channel0,
113                       pc_serial_funs, 
114                       ppc405_serial_info0,
115                       CYG_SERIAL_BAUD_RATE(CYGNUM_IO_SERIAL_POWERPC_PPC405_SERIAL0_BAUD),
116                       CYG_SERIAL_STOP_DEFAULT,
117                       CYG_SERIAL_PARITY_DEFAULT,
118                       CYG_SERIAL_WORD_LENGTH_DEFAULT,
119                       CYG_SERIAL_FLAGS_DEFAULT
120     );
121 #endif
122
123 DEVTAB_ENTRY(ppc405_serial_io0, 
124              CYGDAT_IO_SERIAL_POWERPC_PPC405_SERIAL0_NAME,
125              0,                     // Does not depend on a lower level interface
126              &cyg_io_serial_devio, 
127              pc_serial_init, 
128              pc_serial_lookup,     // Serial driver may need initializing
129              &ppc405_serial_channel0
130     );
131 #endif //  CYGPKG_IO_SERIAL_POWERPC_PPC405_SERIAL0
132
133 #ifdef CYGPKG_IO_SERIAL_POWERPC_PPC405_SERIAL1
134 #if defined(CYGHWR_HAL_POWERPC_PPC4XX_405GP)
135 static pc_serial_info ppc405_serial_info1 = {_PPC405GP_UART1, CYGNUM_HAL_INTERRUPT_UART1};
136 #endif
137 #if defined(CYGHWR_HAL_POWERPC_PPC4XX_405EP)
138 static pc_serial_info ppc405_serial_info1 = {_PPC405EP_UART1, CYGNUM_HAL_INTERRUPT_UART1};
139 #endif
140 #if CYGNUM_IO_SERIAL_POWERPC_PPC405_SERIAL1_BUFSIZE > 0
141 static unsigned char ppc405_serial_out_buf1[CYGNUM_IO_SERIAL_POWERPC_PPC405_SERIAL1_BUFSIZE];
142 static unsigned char ppc405_serial_in_buf1[CYGNUM_IO_SERIAL_POWERPC_PPC405_SERIAL1_BUFSIZE];
143
144 static SERIAL_CHANNEL_USING_INTERRUPTS(ppc405_serial_channel1,
145                                        pc_serial_funs, 
146                                        ppc405_serial_info1,
147                                        CYG_SERIAL_BAUD_RATE(CYGNUM_IO_SERIAL_POWERPC_PPC405_SERIAL1_BAUD),
148                                        CYG_SERIAL_STOP_DEFAULT,
149                                        CYG_SERIAL_PARITY_DEFAULT,
150                                        CYG_SERIAL_WORD_LENGTH_DEFAULT,
151                                        CYG_SERIAL_FLAGS_DEFAULT,
152                                        &ppc405_serial_out_buf1[0], sizeof(ppc405_serial_out_buf1),
153                                        &ppc405_serial_in_buf1[0], sizeof(ppc405_serial_in_buf1)
154     );
155 #else
156 static SERIAL_CHANNEL(ppc405_serial_channel1,
157                       pc_serial_funs, 
158                       ppc405_serial_info1,
159                       CYG_SERIAL_BAUD_RATE(CYGNUM_IO_SERIAL_POWERPC_PPC405_SERIAL1_BAUD),
160                       CYG_SERIAL_STOP_DEFAULT,
161                       CYG_SERIAL_PARITY_DEFAULT,
162                       CYG_SERIAL_WORD_LENGTH_DEFAULT,
163                       CYG_SERIAL_FLAGS_DEFAULT
164     );
165 #endif
166
167 DEVTAB_ENTRY(ppc405_serial_io1, 
168              CYGDAT_IO_SERIAL_POWERPC_PPC405_SERIAL1_NAME,
169              0,                     // Does not depend on a lower level interface
170              &cyg_io_serial_devio, 
171              pc_serial_init, 
172              pc_serial_lookup,     // Serial driver may need initializing
173              &ppc405_serial_channel1
174     );
175 #endif //  CYGPKG_IO_SERIAL_POWERPC_PPC405_SERIAL1
176
177 // EOF powerpc_ppc405_ser.inl