uart_dev_z8530.c (160717) | uart_dev_z8530.c (166100) |
---|---|
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 * --- 11 unchanged lines hidden (view full) --- 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 27#include <sys/cdefs.h> | 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 * --- 11 unchanged lines hidden (view full) --- 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 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/dev/uart/uart_dev_z8530.c 160717 2006-07-26 17:29:37Z marcel $"); | 28__FBSDID("$FreeBSD: head/sys/dev/uart/uart_dev_z8530.c 166100 2007-01-18 22:01:19Z marius $"); |
29 30#include <sys/param.h> 31#include <sys/systm.h> 32#include <sys/bus.h> 33#include <sys/conf.h> 34#include <machine/bus.h> 35 36#include <dev/uart/uart.h> --- 150 unchanged lines hidden (view full) --- 187 188/* 189 * Low-level UART interface. 190 */ 191static int z8530_probe(struct uart_bas *bas); 192static void z8530_init(struct uart_bas *bas, int, int, int, int); 193static void z8530_term(struct uart_bas *bas); 194static void z8530_putc(struct uart_bas *bas, int); | 29 30#include <sys/param.h> 31#include <sys/systm.h> 32#include <sys/bus.h> 33#include <sys/conf.h> 34#include <machine/bus.h> 35 36#include <dev/uart/uart.h> --- 150 unchanged lines hidden (view full) --- 187 188/* 189 * Low-level UART interface. 190 */ 191static int z8530_probe(struct uart_bas *bas); 192static void z8530_init(struct uart_bas *bas, int, int, int, int); 193static void z8530_term(struct uart_bas *bas); 194static void z8530_putc(struct uart_bas *bas, int); |
195static int z8530_poll(struct uart_bas *bas); | 195static int z8530_rxready(struct uart_bas *bas); |
196static int z8530_getc(struct uart_bas *bas, struct mtx *); 197 198struct uart_ops uart_z8530_ops = { 199 .probe = z8530_probe, 200 .init = z8530_init, 201 .term = z8530_term, 202 .putc = z8530_putc, | 196static int z8530_getc(struct uart_bas *bas, struct mtx *); 197 198struct uart_ops uart_z8530_ops = { 199 .probe = z8530_probe, 200 .init = z8530_init, 201 .term = z8530_term, 202 .putc = z8530_putc, |
203 .poll = z8530_poll, | 203 .rxready = z8530_rxready, |
204 .getc = z8530_getc, 205}; 206 207static int 208z8530_probe(struct uart_bas *bas) 209{ 210 211 return (0); --- 18 unchanged lines hidden (view full) --- 230 231 while (!(uart_getreg(bas, REG_CTRL) & BES_TXE)) 232 ; 233 uart_setreg(bas, REG_DATA, c); 234 uart_barrier(bas); 235} 236 237static int | 204 .getc = z8530_getc, 205}; 206 207static int 208z8530_probe(struct uart_bas *bas) 209{ 210 211 return (0); --- 18 unchanged lines hidden (view full) --- 230 231 while (!(uart_getreg(bas, REG_CTRL) & BES_TXE)) 232 ; 233 uart_setreg(bas, REG_DATA, c); 234 uart_barrier(bas); 235} 236 237static int |
238z8530_poll(struct uart_bas *bas) | 238z8530_rxready(struct uart_bas *bas) |
239{ 240 | 239{ 240 |
241 if (!(uart_getreg(bas, REG_CTRL) & BES_RXA)) 242 return (-1); 243 return (uart_getreg(bas, REG_DATA)); | 241 return ((uart_getreg(bas, REG_CTRL) & BES_RXA) != 0 ? 1 : 0); |
244} 245 246static int 247z8530_getc(struct uart_bas *bas, struct mtx *hwmtx) 248{ 249 int c; 250 251 uart_lock(hwmtx); --- 373 unchanged lines hidden --- | 242} 243 244static int 245z8530_getc(struct uart_bas *bas, struct mtx *hwmtx) 246{ 247 int c; 248 249 uart_lock(hwmtx); --- 373 unchanged lines hidden --- |