1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * This file contains the libchip configuration information |
---|
5 | * to instantiate the libchip driver for the on-CPU DUART |
---|
6 | * and any other serial ports in the system. |
---|
7 | */ |
---|
8 | |
---|
9 | /* |
---|
10 | * COPYRIGHT (c) 1989-2012. |
---|
11 | * On-Line Applications Research Corporation (OAR). |
---|
12 | * |
---|
13 | * The license and distribution terms for this file may be |
---|
14 | * found in the file LICENSE in this distribution or at |
---|
15 | * http://www.rtems.org/license/LICENSE. |
---|
16 | */ |
---|
17 | |
---|
18 | #include <unistd.h> /* write */ |
---|
19 | |
---|
20 | #include <bsp.h> |
---|
21 | #include <bsp/irq.h> |
---|
22 | |
---|
23 | #include <libchip/serial.h> |
---|
24 | #include <libchip/mg5uart.h> |
---|
25 | |
---|
26 | /* #define CONSOLE_USE_INTERRUPTS */ |
---|
27 | |
---|
28 | #ifdef CONSOLE_USE_INTERRUPTS |
---|
29 | #define MG5UART_FUNCTIONS &mg5uart_fns |
---|
30 | #else |
---|
31 | #define MG5UART_FUNCTIONS &mg5uart_fns_polled |
---|
32 | #endif |
---|
33 | |
---|
34 | console_tbl Console_Configuration_Ports[] = { |
---|
35 | { |
---|
36 | "/dev/com0", /* sDeviceName */ |
---|
37 | SERIAL_MG5UART, /* deviceType */ |
---|
38 | MG5UART_FUNCTIONS, /* pDeviceFns */ |
---|
39 | NULL, /* deviceProbe, assume it is there */ |
---|
40 | NULL, /* pDeviceFlow */ |
---|
41 | 16, /* ulMargin */ |
---|
42 | 8, /* ulHysteresis */ |
---|
43 | (void *) NULL, /* NULL */ /* pDeviceParams */ |
---|
44 | MONGOOSEV_PERIPHERAL_COMMAND_REGISTER, /* ulCtrlPort1 */ |
---|
45 | MONGOOSEV_UART0_BASE, /* ulCtrlPort2 */ |
---|
46 | MG5UART_UART0, /* ulDataPort */ |
---|
47 | NULL, /* getRegister */ |
---|
48 | NULL, /* setRegister */ |
---|
49 | NULL, /* unused */ /* getData */ |
---|
50 | NULL, /* unused */ /* setData */ |
---|
51 | CLOCK_RATE, /* ulClock */ |
---|
52 | MONGOOSEV_IRQ_UART0_RX_FRAME_ERROR /* ulIntVector -- base for port */ |
---|
53 | }, |
---|
54 | { |
---|
55 | "/dev/com1", /* sDeviceName */ |
---|
56 | SERIAL_MG5UART, /* deviceType */ |
---|
57 | MG5UART_FUNCTIONS, /* pDeviceFns */ |
---|
58 | NULL, /* deviceProbe, assume it is there */ |
---|
59 | NULL, /* pDeviceFlow */ |
---|
60 | 16, /* ulMargin */ |
---|
61 | 8, /* ulHysteresis */ |
---|
62 | (void *) NULL, /* NULL */ /* pDeviceParams */ |
---|
63 | MONGOOSEV_PERIPHERAL_COMMAND_REGISTER, /* ulCtrlPort1 */ |
---|
64 | MONGOOSEV_UART1_BASE, /* ulCtrlPort2 */ |
---|
65 | MG5UART_UART1, /* ulDataPort */ |
---|
66 | NULL, /* getRegister */ |
---|
67 | NULL, /* setRegister */ |
---|
68 | NULL, /* unused */ /* getData */ |
---|
69 | NULL, /* unused */ /* setData */ |
---|
70 | CLOCK_RATE, /* ulClock */ |
---|
71 | MONGOOSEV_IRQ_UART1_RX_FRAME_ERROR /* ulIntVector -- base for port */ |
---|
72 | }, |
---|
73 | }; |
---|
74 | |
---|
75 | /* |
---|
76 | * Declare some information used by the console driver |
---|
77 | */ |
---|
78 | |
---|
79 | #define NUM_CONSOLE_PORTS (sizeof(Console_Configuration_Ports)/sizeof(console_tbl)) |
---|
80 | |
---|
81 | unsigned long Console_Configuration_Count = NUM_CONSOLE_PORTS; |
---|
82 | |
---|
83 | /* |
---|
84 | * printk() support that simply routes printk to stderr |
---|
85 | */ |
---|
86 | |
---|
87 | #include <rtems/bspIo.h> |
---|
88 | |
---|
89 | void GENMG5_output_char(char c) { write( 2, &c, 1 ); } |
---|
90 | |
---|
91 | BSP_output_char_function_type BSP_output_char = GENMG5_output_char; |
---|
92 | BSP_polling_getchar_function_type BSP_poll_char = NULL; |
---|