]> Pileus Git - ~andy/linux/blob - drivers/staging/speakup/serialio.h
Merge tag 'dm-3.6-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/agk/linux-dm
[~andy/linux] / drivers / staging / speakup / serialio.h
1 #ifndef _SPEAKUP_SERIAL_H
2 #define _SPEAKUP_SERIAL_H
3
4 #include <linux/serial.h>       /* for rs_table, serial constants &
5                                    serial_uart_config */
6 #include <linux/serial_reg.h>   /* for more serial constants */
7 #ifndef __sparc__
8 #include <asm/serial.h>
9 #endif
10
11 /*
12  * this is cut&paste from 8250.h. Get rid of the structure, the definitions
13  * and this whole broken driver.
14  */
15 struct old_serial_port {
16         unsigned int uart; /* unused */
17         unsigned int baud_base;
18         unsigned int port;
19         unsigned int irq;
20         unsigned int flags; /* unused */
21 };
22
23 /* countdown values for serial timeouts in us */
24 #define SPK_SERIAL_TIMEOUT 100000
25 /* countdown values transmitter/dsr timeouts in us */
26 #define SPK_XMITR_TIMEOUT 100000
27 /* countdown values cts timeouts in us */
28 #define SPK_CTS_TIMEOUT 100000
29 /* check ttyS0 ... ttyS3 */
30 #define SPK_LO_TTY 0
31 #define SPK_HI_TTY 3
32 /* # of timeouts permitted before disable */
33 #define NUM_DISABLE_TIMEOUTS 3
34 /* buffer timeout in ms */
35 #define SPK_TIMEOUT 100
36 #define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
37
38 #define spk_serial_tx_busy() ((inb(speakup_info.port_tts + UART_LSR) & BOTH_EMPTY) != BOTH_EMPTY)
39
40 /* 2.6.22 doesn't have them any more, hardcode it for now (these values should
41  * be fine for 99% cases) */
42 #ifndef BASE_BAUD
43 #define BASE_BAUD (1843200 / 16)
44 #endif
45 #ifndef STD_COM_FLAGS
46 #ifdef CONFIG_SERIAL_DETECT_IRQ
47 #define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ)
48 #define STD_COM4_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_AUTO_IRQ)
49 #else
50 #define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST)
51 #define STD_COM4_FLAGS ASYNC_BOOT_AUTOCONF
52 #endif
53 #endif
54 #ifndef SERIAL_PORT_DFNS
55 #define SERIAL_PORT_DFNS                        \
56         /* UART CLK   PORT IRQ     FLAGS        */                      \
57         { 0, BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS },      /* ttyS0 */     \
58         { 0, BASE_BAUD, 0x2F8, 3, STD_COM_FLAGS },      /* ttyS1 */     \
59         { 0, BASE_BAUD, 0x3E8, 4, STD_COM_FLAGS },      /* ttyS2 */     \
60         { 0, BASE_BAUD, 0x2E8, 3, STD_COM4_FLAGS },     /* ttyS3 */
61 #endif
62 #ifndef IRQF_SHARED
63 #define IRQF_SHARED SA_SHIRQ
64 #endif
65
66 #endif