|
|
1.1 root 1: /*
2: * serial.c
3: *
4: * This module implements the rs232 io functions
5: * void rs_write(struct tty_struct * queue);
6: * void rs_init(void);
7: * and all interrupts pertaining to serial IO.
8: */
9:
10: #include <linux/tty.h>
11: #include <linux/sched.h>
12: #include <asm/system.h>
13: #include <asm/io.h>
14:
15: #define WAKEUP_CHARS (TTY_BUF_SIZE/4)
16:
17: extern void rs1_interrupt(void);
18: extern void rs2_interrupt(void);
19:
20: static void init(int port)
21: {
22: outb_p(0x80,port+3); /* set DLAB of line control reg */
23: outb_p(0x30,port); /* LS of divisor (48 -> 2400 bps */
24: outb_p(0x00,port+1); /* MS of divisor */
25: outb_p(0x03,port+3); /* reset DLAB */
26: outb_p(0x0b,port+4); /* set DTR,RTS, OUT_2 */
27: outb_p(0x0d,port+1); /* enable all intrs but writes */
28: (void)inb(port); /* read data port to reset things (?) */
29: }
30:
31: void rs_init(void)
32: {
33: set_intr_gate(0x24,rs1_interrupt);
34: set_intr_gate(0x23,rs2_interrupt);
35: init(tty_table[1].read_q.data);
36: init(tty_table[2].read_q.data);
37: outb(inb_p(0x21)&0xE7,0x21);
38: }
39:
40: /*
41: * This routine gets called when tty_write has put something into
42: * the write_queue. It must check wheter the queue is empty, and
43: * set the interrupt register accordingly
44: *
45: * void _rs_write(struct tty_struct * tty);
46: */
47: void rs_write(struct tty_struct * tty)
48: {
49: cli();
50: if (!EMPTY(tty->write_q))
51: outb(inb_p(tty->write_q.data+1)|0x02,tty->write_q.data+1);
52: sti();
53: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.