Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6
[pandora-kernel.git] / 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 #include <linux/serialP.h>      /* for struct serial_state */
8 #ifndef __sparc__
9 #include <asm/serial.h>
10 #endif
11
12 /* countdown values for serial timeouts in us */
13 #define SPK_SERIAL_TIMEOUT 100000
14 /* countdown values transmitter/dsr timeouts in us */
15 #define SPK_XMITR_TIMEOUT 100000
16 /* countdown values cts timeouts in us */
17 #define SPK_CTS_TIMEOUT 100000
18 /* check ttyS0 ... ttyS3 */
19 #define SPK_LO_TTY 0
20 #define SPK_HI_TTY 3
21 /* # of timeouts permitted before disable */
22 #define NUM_DISABLE_TIMEOUTS 3
23 /* buffer timeout in ms */
24 #define SPK_TIMEOUT 100
25 #define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
26
27 #define spk_serial_tx_busy() ((inb(speakup_info.port_tts + UART_LSR) & BOTH_EMPTY) != BOTH_EMPTY)
28
29 /* 2.6.22 doesn't have them any more, hardcode it for now (these values should
30  * be fine for 99% cases) */
31 #ifndef BASE_BAUD
32 #define BASE_BAUD (1843200 / 16)
33 #endif
34 #ifndef STD_COM_FLAGS
35 #ifdef CONFIG_SERIAL_DETECT_IRQ
36 #define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ)
37 #define STD_COM4_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_AUTO_IRQ)
38 #else
39 #define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST)
40 #define STD_COM4_FLAGS ASYNC_BOOT_AUTOCONF
41 #endif
42 #endif
43 #ifndef SERIAL_PORT_DFNS
44 #define SERIAL_PORT_DFNS                        \
45         /* UART CLK   PORT IRQ     FLAGS        */                      \
46         { 0, BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS },      /* ttyS0 */     \
47         { 0, BASE_BAUD, 0x2F8, 3, STD_COM_FLAGS },      /* ttyS1 */     \
48         { 0, BASE_BAUD, 0x3E8, 4, STD_COM_FLAGS },      /* ttyS2 */     \
49         { 0, BASE_BAUD, 0x2E8, 3, STD_COM4_FLAGS },     /* ttyS3 */
50 #endif
51 #ifndef IRQF_SHARED
52 #define IRQF_SHARED SA_SHIRQ
53 #endif
54
55 #endif