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