18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef _SPEAKUP_SERIAL_H
38c2ecf20Sopenharmony_ci#define _SPEAKUP_SERIAL_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include <linux/serial.h>	/* for rs_table, serial constants */
68c2ecf20Sopenharmony_ci#include <linux/serial_reg.h>	/* for more serial constants */
78c2ecf20Sopenharmony_ci#include <linux/serial_core.h>
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#include "spk_priv.h"
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci/*
128c2ecf20Sopenharmony_ci * this is cut&paste from 8250.h. Get rid of the structure, the definitions
138c2ecf20Sopenharmony_ci * and this whole broken driver.
148c2ecf20Sopenharmony_ci */
158c2ecf20Sopenharmony_cistruct old_serial_port {
168c2ecf20Sopenharmony_ci	unsigned int uart; /* unused */
178c2ecf20Sopenharmony_ci	unsigned int baud_base;
188c2ecf20Sopenharmony_ci	unsigned int port;
198c2ecf20Sopenharmony_ci	unsigned int irq;
208c2ecf20Sopenharmony_ci	upf_t flags; /* unused */
218c2ecf20Sopenharmony_ci};
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci/* countdown values for serial timeouts in us */
248c2ecf20Sopenharmony_ci#define SPK_SERIAL_TIMEOUT SPK_SYNTH_TIMEOUT
258c2ecf20Sopenharmony_ci/* countdown values transmitter/dsr timeouts in us */
268c2ecf20Sopenharmony_ci#define SPK_XMITR_TIMEOUT 100000
278c2ecf20Sopenharmony_ci/* countdown values cts timeouts in us */
288c2ecf20Sopenharmony_ci#define SPK_CTS_TIMEOUT 100000
298c2ecf20Sopenharmony_ci/* check ttyS0 ... ttyS3 */
308c2ecf20Sopenharmony_ci#define SPK_LO_TTY 0
318c2ecf20Sopenharmony_ci#define SPK_HI_TTY 3
328c2ecf20Sopenharmony_ci/* # of timeouts permitted before disable */
338c2ecf20Sopenharmony_ci#define NUM_DISABLE_TIMEOUTS 3
348c2ecf20Sopenharmony_ci/* buffer timeout in ms */
358c2ecf20Sopenharmony_ci#define SPK_TIMEOUT 100
368c2ecf20Sopenharmony_ci#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci#define spk_serial_tx_busy() \
398c2ecf20Sopenharmony_ci	((inb(speakup_info.port_tts + UART_LSR) & BOTH_EMPTY) != BOTH_EMPTY)
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci#endif
42