xref: /freebsd/sys/dev/uart/uart_dev_ns8250.h (revision 09ef538713e08a98584dbcf66ff80290cc1b41a2)
1167cb33fSIan Lepore /*-
24d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
3718cf2ccSPedro F. Giffuni  *
4167cb33fSIan Lepore  * Copyright (c) 2003 Marcel Moolenaar
5167cb33fSIan Lepore  * All rights reserved.
6167cb33fSIan Lepore  *
7167cb33fSIan Lepore  * Redistribution and use in source and binary forms, with or without
8167cb33fSIan Lepore  * modification, are permitted provided that the following conditions
9167cb33fSIan Lepore  * are met:
10167cb33fSIan Lepore  *
11167cb33fSIan Lepore  * 1. Redistributions of source code must retain the above copyright
12167cb33fSIan Lepore  *    notice, this list of conditions and the following disclaimer.
13167cb33fSIan Lepore  * 2. Redistributions in binary form must reproduce the above copyright
14167cb33fSIan Lepore  *    notice, this list of conditions and the following disclaimer in the
15167cb33fSIan Lepore  *    documentation and/or other materials provided with the distribution.
16167cb33fSIan Lepore  *
17167cb33fSIan Lepore  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18167cb33fSIan Lepore  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19167cb33fSIan Lepore  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20167cb33fSIan Lepore  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21167cb33fSIan Lepore  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22167cb33fSIan Lepore  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23167cb33fSIan Lepore  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24167cb33fSIan Lepore  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25167cb33fSIan Lepore  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26167cb33fSIan Lepore  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27167cb33fSIan Lepore  */
28167cb33fSIan Lepore 
29167cb33fSIan Lepore #ifndef _DEV_UART_DEV_NS8250_H_
30167cb33fSIan Lepore #define _DEV_UART_DEV_NS8250_H_
31167cb33fSIan Lepore 
32167cb33fSIan Lepore /*
33167cb33fSIan Lepore  * High-level UART interface.
34167cb33fSIan Lepore  */
35167cb33fSIan Lepore struct ns8250_softc {
36167cb33fSIan Lepore 	struct uart_softc base;
37167cb33fSIan Lepore 	uint8_t		fcr;
38167cb33fSIan Lepore 	uint8_t		ier;
39167cb33fSIan Lepore 	uint8_t		mcr;
40167cb33fSIan Lepore 
41167cb33fSIan Lepore 	uint8_t		ier_mask;
42167cb33fSIan Lepore 	uint8_t		ier_rxbits;
43167cb33fSIan Lepore 	uint8_t		busy_detect;
44*09ef5387SJustin Hibbits 	int		noise_count;
45167cb33fSIan Lepore };
46167cb33fSIan Lepore 
47167cb33fSIan Lepore extern struct uart_ops uart_ns8250_ops;
48167cb33fSIan Lepore 
49167cb33fSIan Lepore int ns8250_bus_attach(struct uart_softc *);
50167cb33fSIan Lepore int ns8250_bus_detach(struct uart_softc *);
51167cb33fSIan Lepore int ns8250_bus_flush(struct uart_softc *, int);
52167cb33fSIan Lepore int ns8250_bus_getsig(struct uart_softc *);
53167cb33fSIan Lepore int ns8250_bus_ioctl(struct uart_softc *, int, intptr_t);
54167cb33fSIan Lepore int ns8250_bus_ipend(struct uart_softc *);
55167cb33fSIan Lepore int ns8250_bus_param(struct uart_softc *, int, int, int, int);
56167cb33fSIan Lepore int ns8250_bus_probe(struct uart_softc *);
57167cb33fSIan Lepore int ns8250_bus_receive(struct uart_softc *);
58167cb33fSIan Lepore int ns8250_bus_setsig(struct uart_softc *, int);
59167cb33fSIan Lepore int ns8250_bus_transmit(struct uart_softc *);
60d76a1ef4SWarner Losh void ns8250_bus_grab(struct uart_softc *);
61353e4c5aSMarius Strobl bool ns8250_bus_txbusy(struct uart_softc *);
62d76a1ef4SWarner Losh void ns8250_bus_ungrab(struct uart_softc *);
63167cb33fSIan Lepore 
64167cb33fSIan Lepore #endif /* _DEV_UART_DEV_NS8250_H_ */
65