Linux Audio

Check our new training course

Loading...
Note: File does not exist in v6.8.
  1/* 68328serial.h: Definitions for the mc68328 serial driver.
  2 *
  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@uclinux.org>
  6 * Copyright (C) 1999       Vladimir Gurevich  <vgurevic@cisco.com>
  7 *
  8 * VZ Support/Fixes             Evan Stawnyczy <e@lineo.ca>
  9 */
 10
 11#ifndef _MC683XX_SERIAL_H
 12#define _MC683XX_SERIAL_H
 13
 14
 15struct serial_struct {
 16	int	type;
 17	int	line;
 18	int	port;
 19	int	irq;
 20	int	flags;
 21	int	xmit_fifo_size;
 22	int	custom_divisor;
 23	int	baud_base;
 24	unsigned short	close_delay;
 25	char	reserved_char[2];
 26	int	hub6;  /* FIXME: We don't have AT&T Hub6 boards! */
 27	unsigned short	closing_wait; /* time to wait before closing */
 28	unsigned short	closing_wait2; /* no longer used... */
 29	int	reserved[4];
 30};
 31
 32/*
 33 * For the close wait times, 0 means wait forever for serial port to
 34 * flush its output.  65535 means don't wait at all.
 35 */
 36#define S_CLOSING_WAIT_INF	0
 37#define S_CLOSING_WAIT_NONE	65535
 38
 39/*
 40 * Definitions for S_struct (and serial_struct) flags field
 41 */
 42#define S_HUP_NOTIFY 0x0001 /* Notify getty on hangups and closes 
 43				   on the callout port */
 44#define S_FOURPORT  0x0002	/* Set OU1, OUT2 per AST Fourport settings */
 45#define S_SAK	0x0004	/* Secure Attention Key (Orange book) */
 46#define S_SPLIT_TERMIOS 0x0008 /* Separate termios for dialin/callout */
 47
 48#define S_SPD_MASK	0x0030
 49#define S_SPD_HI	0x0010	/* Use 56000 instead of 38400 bps */
 50
 51#define S_SPD_VHI	0x0020  /* Use 115200 instead of 38400 bps */
 52#define S_SPD_CUST	0x0030  /* Use user-specified divisor */
 53
 54#define S_SKIP_TEST	0x0040 /* Skip UART test during autoconfiguration */
 55#define S_AUTO_IRQ  0x0080 /* Do automatic IRQ during autoconfiguration */
 56#define S_SESSION_LOCKOUT 0x0100 /* Lock out cua opens based on session */
 57#define S_PGRP_LOCKOUT    0x0200 /* Lock out cua opens based on pgrp */
 58#define S_CALLOUT_NOHUP   0x0400 /* Don't do hangups for cua device */
 59
 60#define S_FLAGS	0x0FFF	/* Possible legal S flags */
 61#define S_USR_MASK 0x0430	/* Legal flags that non-privileged
 62				 * users can set or reset */
 63
 64/* Internal flags used only by kernel/chr_drv/serial.c */
 65#define S_INITIALIZED	0x80000000 /* Serial port was initialized */
 66#define S_CALLOUT_ACTIVE	0x40000000 /* Call out device is active */
 67#define S_NORMAL_ACTIVE	0x20000000 /* Normal device is active */
 68#define S_BOOT_AUTOCONF	0x10000000 /* Autoconfigure port on bootup */
 69#define S_CLOSING		0x08000000 /* Serial port is closing */
 70#define S_CTS_FLOW		0x04000000 /* Do CTS flow control */
 71#define S_CHECK_CD		0x02000000 /* i.e., CLOCAL */
 72
 73/* Software state per channel */
 74
 75#ifdef __KERNEL__
 76
 77/*
 78 * I believe this is the optimal setting that reduces the number of interrupts.
 79 * At high speeds the output might become a little "bursted" (use USTCNT_TXHE
 80 * if that bothers you), but in most cases it will not, since we try to 
 81 * transmit characters every time rs_interrupt is called. Thus, quite often
 82 * you'll see that a receive interrupt occures before the transmit one.
 83 *                                  -- Vladimir Gurevich
 84 */
 85#define USTCNT_TX_INTR_MASK (USTCNT_TXEE)
 86
 87/*
 88 * 68328 and 68EZ328 UARTS are a little bit different. EZ328 has special
 89 * "Old data interrupt" which occures whenever the data stay in the FIFO
 90 * longer than 30 bits time. This allows us to use FIFO without compromising
 91 * latency. '328 does not have this feature and without the real  328-based
 92 * board I would assume that RXRE is the safest setting.
 93 *
 94 * For EZ328 I use RXHE (Half empty) interrupt to reduce the number of
 95 * interrupts. RXFE (receive queue full) causes the system to lose data
 96 * at least at 115200 baud
 97 *
 98 * If your board is busy doing other stuff, you might consider to use
 99 * RXRE (data ready intrrupt) instead.
100 *
101 * The other option is to make these INTR masks run-time configurable, so
102 * that people can dynamically adapt them according to the current usage.
103 *                                  -- Vladimir Gurevich
104 */
105
106/* (es) */
107#if defined(CONFIG_M68EZ328) || defined(CONFIG_M68VZ328)
108#define USTCNT_RX_INTR_MASK (USTCNT_RXHE | USTCNT_ODEN)
109#elif defined(CONFIG_M68328)
110#define USTCNT_RX_INTR_MASK (USTCNT_RXRE)
111#else
112#error Please, define the Rx interrupt events for your CPU
113#endif
114/* (/es) */
115
116/*
117 * This is our internal structure for each serial port's state.
118 * 
119 * Many fields are paralleled by the structure used by the serial_struct
120 * structure.
121 *
122 * For definitions of the flags field, see tty.h
123 */
124
125struct m68k_serial {
126	char soft_carrier;  /* Use soft carrier on this channel */
127	char break_abort;   /* Is serial console in, so process brk/abrt */
128	char is_cons;       /* Is this our console. */
129
130	/* We need to know the current clock divisor
131	 * to read the bps rate the chip has currently
132	 * loaded.
133	 */
134	unsigned char clk_divisor;  /* May be 1, 16, 32, or 64 */
135	int baud;
136	int			magic;
137	int			baud_base;
138	int			port;
139	int			irq;
140	int			flags; 		/* defined in tty.h */
141	int			type; 		/* UART type */
142	struct tty_struct 	*tty;
143	int			read_status_mask;
144	int			ignore_status_mask;
145	int			timeout;
146	int			xmit_fifo_size;
147	int			custom_divisor;
148	int			x_char;	/* xon/xoff character */
149	int			close_delay;
150	unsigned short		closing_wait;
151	unsigned short		closing_wait2;
152	unsigned long		event;
153	unsigned long		last_active;
154	int			line;
155	int			count;	    /* # of fd on device */
156	int			blocked_open; /* # of blocked opens */
157	unsigned char 		*xmit_buf;
158	int			xmit_head;
159	int			xmit_tail;
160	int			xmit_cnt;
161	struct work_struct	tqueue;
162	wait_queue_head_t	open_wait;
163	wait_queue_head_t	close_wait;
164};
165
166
167#define SERIAL_MAGIC 0x5301
168
169/*
170 * The size of the serial xmit buffer is 1 page, or 4096 bytes
171 */
172#define SERIAL_XMIT_SIZE 4096
173
174/*
175 * Events are used to schedule things to happen at timer-interrupt
176 * time, instead of at rs interrupt time.
177 */
178#define RS_EVENT_WRITE_WAKEUP	0
179
180/* 
181 * Define the number of ports supported and their irqs.
182 */
183#define NR_PORTS 1
184#define UART_IRQ_DEFNS {UART_IRQ_NUM}
185
186#endif /* __KERNEL__ */
187#endif /* !(_MC683XX_SERIAL_H) */