MOXA linux-2.6.x / linux-2.6.19-uc1 from UC-7110-LX-BOOTLOADER-1.9_VERSION-4.2.tgz
[linux-2.6.19-moxart.git] / drivers / serial / NIOSserial.h
blob0818408475141ae403d2ad0b7acbb3a769fe226d
1 /* NIOSserial.h: Definitions for the NIOS serial driver.
3 * Copyright (C) 1995 David S. Miller <davem@caip.rutgers.edu>
4 * Copyright (C) 1998 Kenneth Albanowski <kjahds@kjahds.com>
5 * Copyright (C) 1998, 1999 D. Jeff Dionne <jeff@rt-control.com>
6 * Copyright (C) 1999 Vladimir Gurevich <vgurevic@cisco.com>
7 * Copyright (C) 2001 Vic Phillips <vic@microtronix.com>
9 */
11 #ifndef _NIOS_SERIAL_H
12 #define _NIOS_SERIAL_H
14 #include <asm/nios.h>
17 * For the close wait times, 0 means wait forever for serial port to
18 * flush its output. 65535 means don't wait at all.
20 #define S_CLOSING_WAIT_INF 0
21 #define S_CLOSING_WAIT_NONE 65535
24 * Definitions for S_struct (and serial_struct) flags field
26 #define S_HUP_NOTIFY 0x0001 /* Notify getty on hangups and closes
27 on the callout port */
28 #define S_FOURPORT 0x0002 /* Set OU1, OUT2 per AST Fourport settings */
29 #define S_SAK 0x0004 /* Secure Attention Key (Orange book) */
30 #define S_SPLIT_TERMIOS 0x0008 /* Separate termios for dialin/callout */
32 #define S_SPD_MASK 0x0030
33 #define S_SPD_HI 0x0010 /* Use 56000 instead of 38400 bps */
35 #define S_SPD_VHI 0x0020 /* Use 115200 instead of 38400 bps */
36 #define S_SPD_CUST 0x0030 /* Use user-specified divisor */
38 #define S_SKIP_TEST 0x0040 /* Skip UART test during autoconfiguration */
39 #define S_AUTO_IRQ 0x0080 /* Do automatic IRQ during autoconfiguration */
40 #define S_SESSION_LOCKOUT 0x0100 /* Lock out cua opens based on session */
41 #define S_PGRP_LOCKOUT 0x0200 /* Lock out cua opens based on pgrp */
42 #define S_CALLOUT_NOHUP 0x0400 /* Don't do hangups for cua device */
44 #define S_FLAGS 0x0FFF /* Possible legal S flags */
45 #define S_USR_MASK 0x0430 /* Legal flags that non-privileged
46 * users can set or reset */
48 /* Internal flags used only by kernel/chr_drv/serial.c */
49 #define S_INITIALIZED 0x80000000 /* Serial port was initialized */
50 #define S_CALLOUT_ACTIVE 0x40000000 /* Call out device is active */
51 #define S_NORMAL_ACTIVE 0x20000000 /* Normal device is active */
52 #define S_BOOT_AUTOCONF 0x10000000 /* Autoconfigure port on bootup */
53 #define S_CLOSING 0x08000000 /* Serial port is closing */
54 #define S_CTS_FLOW 0x04000000 /* Do CTS flow control */
55 #define S_CHECK_CD 0x02000000 /* i.e., CLOCAL */
57 /* Software state per channel */
59 #ifdef __KERNEL__
62 * This is our internal structure for each serial port's state.
64 * Many fields are paralleled by the structure used by the serial_struct
65 * structure.
67 * For definitions of the flags field, see tty.h
70 struct NIOS_serial {
71 char soft_carrier; /* Use soft carrier on this channel */
72 char break_abort; /* Is serial console in, so process brk/abrt */
73 char is_cons; /* Is this our console. */
75 /* We need to know the current clock divisor
76 * to read the bps rate the chip has currently
77 * loaded.
79 unsigned char clk_divisor; /* May be 1, 16, 32, or 64 */
80 int baud;
81 int magic;
82 int baud_base;
83 int port;
84 int irq;
85 int flags; /* defined in tty.h */
86 int type; /* UART type */
87 struct tty_struct *tty;
88 int read_status_mask;
89 int ignore_status_mask;
90 int timeout;
91 int xmit_fifo_size;
92 int custom_divisor;
93 int x_char; /* xon/xoff character */
94 int close_delay;
95 unsigned short closing_wait;
96 unsigned short closing_wait2;
97 unsigned long event;
98 unsigned long last_active;
99 int line;
100 int count; /* # of fd on device */
101 int blocked_open; /* # of blocked opens */
102 long session; /* Session of opening process */
103 long pgrp; /* pgrp of opening process */
104 unsigned char *xmit_buf;
105 int xmit_head;
106 int xmit_tail;
107 int xmit_cnt;
108 struct work_struct tqueue;
109 struct work_struct tqueue_hangup;
110 wait_queue_head_t open_wait;
111 wait_queue_head_t close_wait;
114 #define SERIAL_MAGIC 0x5301
117 * Events are used to schedule things to happen at timer-interrupt
118 * time, instead of at rs interrupt time.
120 #define RS_EVENT_WRITE_WAKEUP 0
122 #endif /* __KERNEL__ */
123 #endif /* !(_NIOS_SERIAL_H) */