1 | /* |
---|
2 | * This file contains the TTY driver table. The implementation is |
---|
3 | * based on libchip/serial drivers, but it uses internal SHx SCI so |
---|
4 | * the implementation of the driver is placed in |
---|
5 | * lib/libcpu/sh/sh7045/sci instead of libchip/serial. |
---|
6 | * |
---|
7 | * COPYRIGHT (c) 1989-2001. |
---|
8 | * On-Line Applications Research Corporation (OAR). |
---|
9 | * |
---|
10 | * The license and distribution terms for this file may be |
---|
11 | * found in the file LICENSE in this distribution or at |
---|
12 | * http://www.rtems.com/license/LICENSE. |
---|
13 | * |
---|
14 | * $Id$ |
---|
15 | * |
---|
16 | */ |
---|
17 | |
---|
18 | #include <bsp.h> |
---|
19 | #include <libchip/serial.h> |
---|
20 | #include <libchip/sersupp.h> |
---|
21 | #include <sh/sci_termios.h> |
---|
22 | #include <rtems/score/sh_io.h> |
---|
23 | #include <rtems/score/ispsh7045.h> |
---|
24 | #include <rtems/score/iosh7045.h> |
---|
25 | #include <rtems/termiostypes.h> |
---|
26 | |
---|
27 | /* |
---|
28 | * Function set for interrupt enabled termios console |
---|
29 | */ |
---|
30 | console_fns sh_sci_fns = |
---|
31 | { |
---|
32 | libchip_serial_default_probe, /* deviceProbe */ |
---|
33 | sh_sci_first_open, /* deviceFirstOpen */ |
---|
34 | NULL, /* deviceLastClose */ |
---|
35 | NULL, /* deviceRead */ |
---|
36 | sh_sci_write_support_int, /* deviceWrite */ |
---|
37 | sh_sci_initialize_interrupts, /* deviceInitialize */ |
---|
38 | sh_sci_write_polled, /* deviceWritePolled */ |
---|
39 | sh_sci_set_attributes, /* deviceSetAttributes */ |
---|
40 | TERMIOS_IRQ_DRIVEN /* deviceOutputUsesInterrupts */ |
---|
41 | }; |
---|
42 | |
---|
43 | /* |
---|
44 | * Function set for polled termios console |
---|
45 | */ |
---|
46 | console_fns sh_sci_fns_polled = |
---|
47 | { |
---|
48 | libchip_serial_default_probe, /* deviceProbe */ |
---|
49 | sh_sci_first_open, /* deviceFirstOpen */ |
---|
50 | sh_sci_last_close, /* deviceLastClose */ |
---|
51 | sh_sci_inbyte_nonblocking_polled, /* deviceRead */ |
---|
52 | sh_sci_write_support_polled, /* deviceWrite */ |
---|
53 | sh_sci_init, /* deviceInitialize */ |
---|
54 | sh_sci_write_polled, /* deviceWritePolled */ |
---|
55 | sh_sci_set_attributes, /* deviceSetAttributes */ |
---|
56 | TERMIOS_POLLED /* deviceOutputUsesInterrupts */ |
---|
57 | }; |
---|
58 | |
---|
59 | #if 1 /* (CONSOLE_USE_INTERRUPTS) */ |
---|
60 | #define SCI_FUNCTIONS &sh_sci_fns |
---|
61 | #else |
---|
62 | #define SCI_FUNCTIONS &sh_sci_fns_polled |
---|
63 | #endif |
---|
64 | |
---|
65 | static const struct termios term1 = { |
---|
66 | 0, |
---|
67 | 0, |
---|
68 | B9600 | CS8, |
---|
69 | 0, |
---|
70 | 0, |
---|
71 | { 0 } |
---|
72 | }; |
---|
73 | |
---|
74 | static const struct termios term2 = { |
---|
75 | 0, |
---|
76 | 0, |
---|
77 | B115200 | CS8, |
---|
78 | 0, |
---|
79 | 0, |
---|
80 | { 0 } |
---|
81 | }; |
---|
82 | |
---|
83 | console_tbl Console_Port_Tbl[] = { |
---|
84 | { |
---|
85 | "/dev/sci0", /* sDeviceName */ |
---|
86 | SERIAL_CUSTOM, /* deviceType */ |
---|
87 | SCI_FUNCTIONS, /* pDeviceFns */ |
---|
88 | NULL, /* deviceProbe */ |
---|
89 | NULL, /* pDeviceFlow */ |
---|
90 | 16, /* ulMargin */ |
---|
91 | 8, /* ulHysteresis */ |
---|
92 | (void *)&term1, /* baud rate */ /* pDeviceParams */ |
---|
93 | SCI_SMR0, /* ulCtrlPort1 */ |
---|
94 | 3, /* ulCtrlPort2 as IRQ priority level*/ |
---|
95 | TXI0_ISP_V, /* ulDataPort as TX end vector number*/ |
---|
96 | NULL, /* unused */ /* getRegister */ |
---|
97 | NULL, /* unused */ /* setRegister */ |
---|
98 | NULL, /* unused */ /* getData */ |
---|
99 | NULL, /* unused */ /* setData */ |
---|
100 | 0, /* ulClock */ |
---|
101 | RXI0_ISP_V, /* ulIntVector as RX end vector number*/ |
---|
102 | }, |
---|
103 | { |
---|
104 | "/dev/sci1", /* sDeviceName */ |
---|
105 | SERIAL_CUSTOM, /* deviceType */ |
---|
106 | SCI_FUNCTIONS, /* pDeviceFns */ |
---|
107 | NULL, /* deviceProbe */ |
---|
108 | NULL, /* pDeviceFlow */ |
---|
109 | 16, /* ulMargin */ |
---|
110 | 8, /* ulHysteresis */ |
---|
111 | (void *)&term2, /* baud rate */ /* pDeviceParams */ |
---|
112 | SCI_SMR1, /* ulCtrlPort1 */ |
---|
113 | 3, /* ulCtrlPort2 as IRQ priority level*/ |
---|
114 | TXI1_ISP_V, /* ulDataPort as TX end vector number*/ |
---|
115 | NULL, /* unused */ /* getRegister */ |
---|
116 | NULL, /* unused */ /* setRegister */ |
---|
117 | NULL, /* unused */ /* getData */ |
---|
118 | NULL, /* unused */ /* setData */ |
---|
119 | 0, /* ulClock */ |
---|
120 | RXI1_ISP_V, /* ulIntVector as RX end vector number*/ |
---|
121 | } |
---|
122 | }; |
---|
123 | |
---|
124 | /* |
---|
125 | * Declare some information used by the console driver |
---|
126 | */ |
---|
127 | |
---|
128 | #define NUM_CONSOLE_PORTS (sizeof(Console_Port_Tbl)/sizeof(console_tbl)) |
---|
129 | |
---|
130 | unsigned long Console_Port_Count = NUM_CONSOLE_PORTS; |
---|
131 | |
---|
132 | console_data Console_Port_Data[NUM_CONSOLE_PORTS]; |
---|
133 | |
---|
134 | rtems_device_minor_number Console_Port_Minor; |
---|