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>
11 #ifndef _NIOS_SERIAL_H
12 #define _NIOS_SERIAL_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 */
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
67 * For definitions of the flags field, see tty.h
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
79 unsigned char clk_divisor
; /* May be 1, 16, 32, or 64 */
85 int flags
; /* defined in tty.h */
86 int type
; /* UART type */
87 struct tty_struct
*tty
;
89 int ignore_status_mask
;
93 int x_char
; /* xon/xoff character */
95 unsigned short closing_wait
;
96 unsigned short closing_wait2
;
98 unsigned long last_active
;
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
;
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) */