xref: /openbsd-src/sys/dev/ic/pluartvar.h (revision c1f87e31ce87e006b3e8b0603d28c939786efb68)
1*c1f87e31Santon /*	$OpenBSD: pluartvar.h,v 1.5 2022/06/27 13:03:32 anton Exp $	*/
2e474e71dSkettenis /*
3e474e71dSkettenis  * Copyright (c) 2014 Patrick Wildt <patrick@blueri.se>
4e474e71dSkettenis  * Copyright (c) 2005 Dale Rahn <drahn@dalerahn.com>
5e474e71dSkettenis  *
6e474e71dSkettenis  * Permission to use, copy, modify, and distribute this software for any
7e474e71dSkettenis  * purpose with or without fee is hereby granted, provided that the above
8e474e71dSkettenis  * copyright notice and this permission notice appear in all copies.
9e474e71dSkettenis  *
10e474e71dSkettenis  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11e474e71dSkettenis  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12e474e71dSkettenis  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13e474e71dSkettenis  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14e474e71dSkettenis  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15e474e71dSkettenis  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16e474e71dSkettenis  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17e474e71dSkettenis  */
18e474e71dSkettenis 
19e474e71dSkettenis struct pluart_softc {
20e474e71dSkettenis 	struct device	sc_dev;
21e474e71dSkettenis 	bus_space_tag_t sc_iot;
22e474e71dSkettenis 	bus_space_handle_t sc_ioh;
23e474e71dSkettenis 	struct soft_intrhand *sc_si;
24e474e71dSkettenis 	void *sc_irq;
25e474e71dSkettenis 	struct tty	*sc_tty;
26e474e71dSkettenis 	struct timeout	sc_diag_tmo;
27e474e71dSkettenis 	struct timeout	sc_dtr_tmo;
28e474e71dSkettenis 	int		sc_overflows;
29e474e71dSkettenis 	int		sc_floods;
30e474e71dSkettenis 	int		sc_errors;
31e474e71dSkettenis 	int		sc_halt;
32e474e71dSkettenis 	u_int16_t	sc_ucr1;
33e474e71dSkettenis 	u_int16_t	sc_ucr2;
34e474e71dSkettenis 	u_int16_t	sc_ucr3;
35e474e71dSkettenis 	u_int16_t	sc_ucr4;
36e474e71dSkettenis 	u_int8_t	sc_hwflags;
376a0d4444Santon 	u_int8_t	sc_hwrev;
38e474e71dSkettenis #define COM_HW_NOIEN    0x01
39e474e71dSkettenis #define COM_HW_FIFO     0x02
40e474e71dSkettenis #define COM_HW_SIR      0x20
41e474e71dSkettenis #define COM_HW_CONSOLE  0x40
426a0d4444Santon #define COM_HW_SBSA	0x80
43e474e71dSkettenis 	u_int8_t	sc_swflags;
44e474e71dSkettenis #define COM_SW_SOFTCAR  0x01
45e474e71dSkettenis #define COM_SW_CLOCAL   0x02
46e474e71dSkettenis #define COM_SW_CRTSCTS  0x04
47e474e71dSkettenis #define COM_SW_MDMBUF   0x08
48e474e71dSkettenis #define COM_SW_PPS      0x10
49e474e71dSkettenis 	int		sc_fifolen;
506a0d4444Santon 	int		sc_imsc;
51*c1f87e31Santon 	int		sc_clkfreq;
52e474e71dSkettenis 
53e474e71dSkettenis 	u_int8_t	sc_initialize;
54e474e71dSkettenis 	u_int8_t	sc_cua;
55e474e71dSkettenis 	u_int16_t 	*sc_ibuf, *sc_ibufp, *sc_ibufhigh, *sc_ibufend;
56e474e71dSkettenis #define UART_IBUFSIZE 128
57e474e71dSkettenis #define UART_IHIGHWATER 100
58e474e71dSkettenis 	u_int16_t		sc_ibufs[2][UART_IBUFSIZE];
59e474e71dSkettenis 
60e474e71dSkettenis 	struct clk	*sc_clk;
61e474e71dSkettenis };
62e474e71dSkettenis 
63e474e71dSkettenis void	pluart_attach_common(struct pluart_softc *, int);
64e474e71dSkettenis int	pluart_intr(void *);
65e474e71dSkettenis 
66e474e71dSkettenis int	pluartcnattach(bus_space_tag_t iot, bus_addr_t iobase, int rate,
67e474e71dSkettenis 	    tcflag_t cflag);
68