Deleted Added
full compact
uart_cpu.h (157380) uart_cpu.h (166100)
1/*-
2 * Copyright (c) 2003, 2004 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, 2004 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_cpu.h 157380 2006-04-01 19:04:54Z marcel $
26 * $FreeBSD: head/sys/dev/uart/uart_cpu.h 166100 2007-01-18 22:01:19Z marius $
27 */
28
29#ifndef _DEV_UART_CPU_H_
30#define _DEV_UART_CPU_H_
31
32#include <sys/kdb.h>
33#include <sys/lock.h>
34#include <sys/mutex.h>
35
36/*
37 * Low-level operations for use by console and/or debug port support.
38 */
39struct uart_ops {
40 int (*probe)(struct uart_bas *);
41 void (*init)(struct uart_bas *, int, int, int, int);
42 void (*term)(struct uart_bas *);
43 void (*putc)(struct uart_bas *, int);
27 */
28
29#ifndef _DEV_UART_CPU_H_
30#define _DEV_UART_CPU_H_
31
32#include <sys/kdb.h>
33#include <sys/lock.h>
34#include <sys/mutex.h>
35
36/*
37 * Low-level operations for use by console and/or debug port support.
38 */
39struct uart_ops {
40 int (*probe)(struct uart_bas *);
41 void (*init)(struct uart_bas *, int, int, int, int);
42 void (*term)(struct uart_bas *);
43 void (*putc)(struct uart_bas *, int);
44 int (*poll)(struct uart_bas *);
44 int (*rxready)(struct uart_bas *);
45 int (*getc)(struct uart_bas *, struct mtx *);
46};
47
48extern struct uart_ops uart_i8251_ops;
49extern struct uart_ops uart_ns8250_ops;
50extern struct uart_ops uart_sab82532_ops;
51extern struct uart_ops uart_z8530_ops;
52

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

132uart_putc(struct uart_devinfo *di, int c)
133{
134 uart_lock(di->hwmtx);
135 di->ops.putc(&di->bas, c);
136 uart_unlock(di->hwmtx);
137}
138
139static __inline int
45 int (*getc)(struct uart_bas *, struct mtx *);
46};
47
48extern struct uart_ops uart_i8251_ops;
49extern struct uart_ops uart_ns8250_ops;
50extern struct uart_ops uart_sab82532_ops;
51extern struct uart_ops uart_z8530_ops;
52

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

132uart_putc(struct uart_devinfo *di, int c)
133{
134 uart_lock(di->hwmtx);
135 di->ops.putc(&di->bas, c);
136 uart_unlock(di->hwmtx);
137}
138
139static __inline int
140uart_rxready(struct uart_devinfo *di)
141{
142 int res;
143
144 uart_lock(di->hwmtx);
145 res = di->ops.rxready(&di->bas);
146 uart_unlock(di->hwmtx);
147 return (res);
148}
149
150static __inline int
140uart_poll(struct uart_devinfo *di)
141{
142 int res;
143
144 uart_lock(di->hwmtx);
151uart_poll(struct uart_devinfo *di)
152{
153 int res;
154
155 uart_lock(di->hwmtx);
145 res = di->ops.poll(&di->bas);
156 if (di->ops.rxready(&di->bas))
157 res = di->ops.getc(&di->bas, NULL);
158 else
159 res = -1;
146 uart_unlock(di->hwmtx);
147 return (res);
148}
149
150static __inline int
151uart_getc(struct uart_devinfo *di)
152{
153
154 return (di->ops.getc(&di->bas, di->hwmtx));
155}
156
157#endif /* _DEV_UART_CPU_H_ */
160 uart_unlock(di->hwmtx);
161 return (res);
162}
163
164static __inline int
165uart_getc(struct uart_devinfo *di)
166{
167
168 return (di->ops.getc(&di->bas, di->hwmtx));
169}
170
171#endif /* _DEV_UART_CPU_H_ */