uart_bus.h (168281) | uart_bus.h (197721) |
---|---|
1/*- 2 * Copyright (c) 2003 Marcel Moolenaar 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * --- 9 unchanged lines hidden (view full) --- 18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 2003 Marcel Moolenaar 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * --- 9 unchanged lines hidden (view full) --- 18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * |
26 * $FreeBSD: head/sys/dev/uart/uart_bus.h 168281 2007-04-02 22:00:22Z marcel $ | 26 * $FreeBSD: head/sys/dev/uart/uart_bus.h 197721 2009-10-02 22:30:44Z marcel $ |
27 */ 28 29#ifndef _DEV_UART_BUS_H_ 30#define _DEV_UART_BUS_H_ 31 32#ifndef KLD_MODULE 33#include "opt_uart.h" 34#endif --- 56 unchanged lines hidden (view full) --- 91 int sc_callout:1; /* This UART is opened for callout. */ 92 int sc_fastintr:1; /* This UART uses fast interrupts. */ 93 int sc_hwiflow:1; /* This UART has HW input flow ctl. */ 94 int sc_hwoflow:1; /* This UART has HW output flow ctl. */ 95 int sc_leaving:1; /* This UART is going away. */ 96 int sc_opened:1; /* This UART is open for business. */ 97 int sc_polled:1; /* This UART has no interrupts. */ 98 int sc_txbusy:1; /* This UART is transmitting. */ | 27 */ 28 29#ifndef _DEV_UART_BUS_H_ 30#define _DEV_UART_BUS_H_ 31 32#ifndef KLD_MODULE 33#include "opt_uart.h" 34#endif --- 56 unchanged lines hidden (view full) --- 91 int sc_callout:1; /* This UART is opened for callout. */ 92 int sc_fastintr:1; /* This UART uses fast interrupts. */ 93 int sc_hwiflow:1; /* This UART has HW input flow ctl. */ 94 int sc_hwoflow:1; /* This UART has HW output flow ctl. */ 95 int sc_leaving:1; /* This UART is going away. */ 96 int sc_opened:1; /* This UART is open for business. */ 97 int sc_polled:1; /* This UART has no interrupts. */ 98 int sc_txbusy:1; /* This UART is transmitting. */ |
99 int sc_isquelch:1; /* This UART has input squelched. */ |
|
99 100 struct uart_devinfo *sc_sysdev; /* System device (or NULL). */ 101 102 int sc_altbrk; /* State for alt break sequence. */ 103 uint32_t sc_hwsig; /* Signal state. Used by HW driver. */ 104 105 /* Receiver data. */ 106 uint16_t *sc_rxbuf; --- 29 unchanged lines hidden (view full) --- 136 137int uart_bus_attach(device_t dev); 138int uart_bus_detach(device_t dev); 139serdev_intr_t *uart_bus_ihand(device_t dev, int ipend); 140int uart_bus_ipend(device_t dev); 141int uart_bus_probe(device_t dev, int regshft, int rclk, int rid, int chan); 142int uart_bus_sysdev(device_t dev); 143 | 100 101 struct uart_devinfo *sc_sysdev; /* System device (or NULL). */ 102 103 int sc_altbrk; /* State for alt break sequence. */ 104 uint32_t sc_hwsig; /* Signal state. Used by HW driver. */ 105 106 /* Receiver data. */ 107 uint16_t *sc_rxbuf; --- 29 unchanged lines hidden (view full) --- 137 138int uart_bus_attach(device_t dev); 139int uart_bus_detach(device_t dev); 140serdev_intr_t *uart_bus_ihand(device_t dev, int ipend); 141int uart_bus_ipend(device_t dev); 142int uart_bus_probe(device_t dev, int regshft, int rclk, int rid, int chan); 143int uart_bus_sysdev(device_t dev); 144 |
145void uart_sched_softih(struct uart_softc *, uint32_t); 146 |
|
144int uart_tty_attach(struct uart_softc *); 145int uart_tty_detach(struct uart_softc *); 146void uart_tty_intr(void *arg); 147 148/* 149 * Receive buffer operations. 150 */ 151static __inline int --- 18 unchanged lines hidden (view full) --- 170 if (ptr == sc->sc_rxput) 171 return (-1); 172 xc = sc->sc_rxbuf[ptr++]; 173 sc->sc_rxget = (ptr < sc->sc_rxbufsz) ? ptr : 0; 174 return (xc); 175} 176 177static __inline int | 147int uart_tty_attach(struct uart_softc *); 148int uart_tty_detach(struct uart_softc *); 149void uart_tty_intr(void *arg); 150 151/* 152 * Receive buffer operations. 153 */ 154static __inline int --- 18 unchanged lines hidden (view full) --- 173 if (ptr == sc->sc_rxput) 174 return (-1); 175 xc = sc->sc_rxbuf[ptr++]; 176 sc->sc_rxget = (ptr < sc->sc_rxbufsz) ? ptr : 0; 177 return (xc); 178} 179 180static __inline int |
181uart_rx_next(struct uart_softc *sc) 182{ 183 int ptr; 184 185 ptr = sc->sc_rxget; 186 if (ptr == sc->sc_rxput) 187 return (-1); 188 ptr += 1; 189 sc->sc_rxget = (ptr < sc->sc_rxbufsz) ? ptr : 0; 190 return (0); 191} 192 193static __inline int 194uart_rx_peek(struct uart_softc *sc) 195{ 196 int ptr; 197 198 ptr = sc->sc_rxget; 199 return ((ptr == sc->sc_rxput) ? -1 : sc->sc_rxbuf[ptr]); 200} 201 202static __inline int |
|
178uart_rx_put(struct uart_softc *sc, int xc) 179{ 180 int ptr; 181 182 ptr = (sc->sc_rxput + 1 < sc->sc_rxbufsz) ? sc->sc_rxput + 1 : 0; 183 if (ptr == sc->sc_rxget) 184 return (ENOSPC); 185 sc->sc_rxbuf[sc->sc_rxput] = xc; 186 sc->sc_rxput = ptr; 187 return (0); 188} 189 190#endif /* _DEV_UART_BUS_H_ */ | 203uart_rx_put(struct uart_softc *sc, int xc) 204{ 205 int ptr; 206 207 ptr = (sc->sc_rxput + 1 < sc->sc_rxbufsz) ? sc->sc_rxput + 1 : 0; 208 if (ptr == sc->sc_rxget) 209 return (ENOSPC); 210 sc->sc_rxbuf[sc->sc_rxput] = xc; 211 sc->sc_rxput = ptr; 212 return (0); 213} 214 215#endif /* _DEV_UART_BUS_H_ */ |