1 //==========================================================================
3 // io/serial/powerpc/powerpc_ppc405_ser.inl
5 // PPC405GP/EP Serial I/O definitions
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
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.
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
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.
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.
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.
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####
47 // Purpose: PowerPC PPC405GP/EP serial drivers
50 //####DESCRIPTIONEND####
52 //==========================================================================
54 #include <cyg/hal/hal_intr.h>
55 #define CYGARC_HAL_COMMON_EXPORT_CPU_MACROS
56 #include <cyg/hal/ppc_regs.h>
58 //-----------------------------------------------------------------------------
59 // Baud rate specification
61 static unsigned int select_baud[] = {
62 9999, // Unused -- marker
86 externC int cyg_var_baud_generator(int baud);
87 #define CYG_IO_SERIAL_GENERIC_16X5X_BAUD_GENERATOR cyg_var_baud_generator
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};
93 #if defined(CYGHWR_HAL_POWERPC_PPC4XX_405EP)
94 static pc_serial_info ppc405_serial_info0 = {_PPC405EP_UART0, CYGNUM_HAL_INTERRUPT_UART0};
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];
100 static SERIAL_CHANNEL_USING_INTERRUPTS(ppc405_serial_channel0,
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)
112 static SERIAL_CHANNEL(ppc405_serial_channel0,
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
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,
128 pc_serial_lookup, // Serial driver may need initializing
129 &ppc405_serial_channel0
131 #endif // CYGPKG_IO_SERIAL_POWERPC_PPC405_SERIAL0
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};
137 #if defined(CYGHWR_HAL_POWERPC_PPC4XX_405EP)
138 static pc_serial_info ppc405_serial_info1 = {_PPC405EP_UART1, CYGNUM_HAL_INTERRUPT_UART1};
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];
144 static SERIAL_CHANNEL_USING_INTERRUPTS(ppc405_serial_channel1,
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)
156 static SERIAL_CHANNEL(ppc405_serial_channel1,
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
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,
172 pc_serial_lookup, // Serial driver may need initializing
173 &ppc405_serial_channel1
175 #endif // CYGPKG_IO_SERIAL_POWERPC_PPC405_SERIAL1
177 // EOF powerpc_ppc405_ser.inl