Deleted Added
full compact
uart_dev_z8530.c (157300) uart_dev_z8530.c (157380)
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 157300 2006-03-30 18:37:03Z marcel $");
28__FBSDID("$FreeBSD: head/sys/dev/uart/uart_dev_z8530.c 157380 2006-04-01 19:04:54Z marcel $");
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>

--- 136 unchanged lines hidden (view full) ---

173/*
174 * Low-level UART interface.
175 */
176static int z8530_probe(struct uart_bas *bas);
177static void z8530_init(struct uart_bas *bas, int, int, int, int);
178static void z8530_term(struct uart_bas *bas);
179static void z8530_putc(struct uart_bas *bas, int);
180static int z8530_poll(struct uart_bas *bas);
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>

--- 136 unchanged lines hidden (view full) ---

173/*
174 * Low-level UART interface.
175 */
176static int z8530_probe(struct uart_bas *bas);
177static void z8530_init(struct uart_bas *bas, int, int, int, int);
178static void z8530_term(struct uart_bas *bas);
179static void z8530_putc(struct uart_bas *bas, int);
180static int z8530_poll(struct uart_bas *bas);
181static int z8530_getc(struct uart_bas *bas);
181static int z8530_getc(struct uart_bas *bas, struct mtx *);
182
183struct uart_ops uart_z8530_ops = {
184 .probe = z8530_probe,
185 .init = z8530_init,
186 .term = z8530_term,
187 .putc = z8530_putc,
188 .poll = z8530_poll,
189 .getc = z8530_getc,

--- 34 unchanged lines hidden (view full) ---

224{
225
226 if (!(uart_getreg(bas, REG_CTRL) & BES_RXA))
227 return (-1);
228 return (uart_getreg(bas, REG_DATA));
229}
230
231static int
182
183struct uart_ops uart_z8530_ops = {
184 .probe = z8530_probe,
185 .init = z8530_init,
186 .term = z8530_term,
187 .putc = z8530_putc,
188 .poll = z8530_poll,
189 .getc = z8530_getc,

--- 34 unchanged lines hidden (view full) ---

224{
225
226 if (!(uart_getreg(bas, REG_CTRL) & BES_RXA))
227 return (-1);
228 return (uart_getreg(bas, REG_DATA));
229}
230
231static int
232z8530_getc(struct uart_bas *bas)
232z8530_getc(struct uart_bas *bas, struct mtx *hwmtx)
233{
233{
234 int c;
234
235
235 while (!(uart_getreg(bas, REG_CTRL) & BES_RXA))
236 ;
237 return (uart_getreg(bas, REG_DATA));
236 uart_lock(hwmtx);
237
238 while (!(uart_getreg(bas, REG_CTRL) & BES_RXA)) {
239 uart_unlock(hwmtx);
240 DELAY(10);
241 uart_lock(hwmtx);
242 }
243
244 c = uart_getreg(bas, REG_DATA);
245
246 uart_unlock(hwmtx);
247
248 return (c);
238}
239
240/*
241 * High-level UART interface.
242 */
243struct z8530_softc {
244 struct uart_softc base;
245 uint8_t tpc;

--- 347 unchanged lines hidden ---
249}
250
251/*
252 * High-level UART interface.
253 */
254struct z8530_softc {
255 struct uart_softc base;
256 uint8_t tpc;

--- 347 unchanged lines hidden ---