uart_dev_sab82532.c (157380) | uart_dev_sab82532.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_sab82532.c 157380 2006-04-01 19:04:54Z marcel $"); | 28__FBSDID("$FreeBSD: head/sys/dev/uart/uart_dev_sab82532.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> --- 131 unchanged lines hidden (view full) --- 168 169/* 170 * Low-level UART interface. 171 */ 172static int sab82532_probe(struct uart_bas *bas); 173static void sab82532_init(struct uart_bas *bas, int, int, int, int); 174static void sab82532_term(struct uart_bas *bas); 175static void sab82532_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> --- 131 unchanged lines hidden (view full) --- 168 169/* 170 * Low-level UART interface. 171 */ 172static int sab82532_probe(struct uart_bas *bas); 173static void sab82532_init(struct uart_bas *bas, int, int, int, int); 174static void sab82532_term(struct uart_bas *bas); 175static void sab82532_putc(struct uart_bas *bas, int); |
176static int sab82532_poll(struct uart_bas *bas); | 176static int sab82532_rxready(struct uart_bas *bas); |
177static int sab82532_getc(struct uart_bas *bas, struct mtx *); 178 179struct uart_ops uart_sab82532_ops = { 180 .probe = sab82532_probe, 181 .init = sab82532_init, 182 .term = sab82532_term, 183 .putc = sab82532_putc, | 177static int sab82532_getc(struct uart_bas *bas, struct mtx *); 178 179struct uart_ops uart_sab82532_ops = { 180 .probe = sab82532_probe, 181 .init = sab82532_init, 182 .term = sab82532_term, 183 .putc = sab82532_putc, |
184 .poll = sab82532_poll, | 184 .rxready = sab82532_rxready, |
185 .getc = sab82532_getc, 186}; 187 188static int 189sab82532_probe(struct uart_bas *bas) 190{ 191 192 return (0); --- 105 unchanged lines hidden (view full) --- 298 DELAY(delay); 299 uart_setreg(bas, SAB_TIC, c); 300 limit = 20; 301 while ((uart_getreg(bas, SAB_STAR) & SAB_STAR_TEC) && --limit) 302 DELAY(delay); 303} 304 305static int | 185 .getc = sab82532_getc, 186}; 187 188static int 189sab82532_probe(struct uart_bas *bas) 190{ 191 192 return (0); --- 105 unchanged lines hidden (view full) --- 298 DELAY(delay); 299 uart_setreg(bas, SAB_TIC, c); 300 limit = 20; 301 while ((uart_getreg(bas, SAB_STAR) & SAB_STAR_TEC) && --limit) 302 DELAY(delay); 303} 304 305static int |
306sab82532_poll(struct uart_bas *bas) | 306sab82532_rxready(struct uart_bas *bas) |
307{ 308 | 307{ 308 |
309 if (uart_getreg(bas, SAB_STAR) & SAB_STAR_RFNE) 310 return (sab82532_getc(bas, NULL)); 311 return (-1); | 309 return ((uart_getreg(bas, SAB_STAR) & SAB_STAR_RFNE) != 0 ? 1 : 0); |
312} 313 314static int 315sab82532_getc(struct uart_bas *bas, struct mtx *hwmtx) 316{ 317 int c, delay; 318 319 uart_lock(hwmtx); --- 408 unchanged lines hidden --- | 310} 311 312static int 313sab82532_getc(struct uart_bas *bas, struct mtx *hwmtx) 314{ 315 int c, delay; 316 317 uart_lock(hwmtx); --- 408 unchanged lines hidden --- |