12 #include <linux/module.h>
13 #include <linux/kernel.h>
14 #include <linux/sched.h>
21 #include <linux/serial.h>
23 #include <asm/uaccess.h>
28 #include <linux/tty.h>
32 #define _INLINE_ inline
35 #define SERIAL_MAX_NUM_LINES 1
36 #define SERIAL_TIMER_VALUE (HZ / 10)
44 static char *serial_version =
"0.1";
45 static char *serial_name =
"ISS serial driver";
54 static void rs_poll(
unsigned long);
58 tty->
port = &serial_port;
59 spin_lock(&timer_lock);
60 if (tty->
count == 1) {
61 setup_timer(&serial_timer, rs_poll, (
unsigned long)tty);
64 spin_unlock(&timer_lock);
82 spin_lock_bh(&timer_lock);
85 spin_unlock_bh(&timer_lock);
94 simc_write(1, buf, count);
98 static void rs_poll(
unsigned long priv)
106 spin_lock(&timer_lock);
109 __simc (
SYS_read, 0, (
unsigned long)&c, 1, 0, 0);
119 spin_unlock(&timer_lock);
123 static int rs_put_char(
struct tty_struct *tty,
unsigned char ch)
125 return rs_write(tty, &ch, 1);
128 static void rs_flush_chars(
struct tty_struct *tty)
132 static int rs_write_room(
struct tty_struct *tty)
138 static int rs_chars_in_buffer(
struct tty_struct *tty)
149 static void rs_wait_until_sent(
struct tty_struct *tty,
int timeout)
154 static int rs_proc_show(
struct seq_file *
m,
void *
v)
156 seq_printf(m,
"serinfo:1.0 driver:%s\n", serial_version);
167 .open = rs_proc_open,
177 .put_char = rs_put_char,
178 .flush_chars = rs_flush_chars,
179 .write_room = rs_write_room,
180 .chars_in_buffer = rs_chars_in_buffer,
182 .wait_until_sent = rs_wait_until_sent,
183 .proc_fops = &rs_proc_fops,
192 printk (
"%s %s\n", serial_name, serial_version);
197 serial_driver->
name =
"ttyS";
211 panic(
"Couldn't register serial driver\n");
216 static __exit void rs_exit(
void)
221 printk(
"ISS_SERIAL: failed to unregister serial driver (%d)\n",
239 #ifdef CONFIG_SERIAL_CONSOLE
241 static void iss_console_write(
struct console *co,
const char *
s,
unsigned count)
245 if (s != 0 && *s != 0)
247 count < len ? count : len,0,0);
253 return serial_driver;
257 static struct console sercons = {
259 .write = iss_console_write,
260 .device = iss_console_device,
265 static int __init iss_console_init(
void)