uart_cpu.h (157300) | uart_cpu.h (157380) |
---|---|
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 157300 2006-03-30 18:37:03Z marcel $ | 26 * $FreeBSD: head/sys/dev/uart/uart_cpu.h 157380 2006-04-01 19:04:54Z marcel $ |
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 *); | 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 *); |
45 int (*getc)(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 53extern bus_space_tag_t uart_bus_space_io; --- 91 unchanged lines hidden (view full) --- 145 res = di->ops.poll(&di->bas); 146 uart_unlock(di->hwmtx); 147 return (res); 148} 149 150static __inline int 151uart_getc(struct uart_devinfo *di) 152{ | 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 53extern bus_space_tag_t uart_bus_space_io; --- 91 unchanged lines hidden (view full) --- 145 res = di->ops.poll(&di->bas); 146 uart_unlock(di->hwmtx); 147 return (res); 148} 149 150static __inline int 151uart_getc(struct uart_devinfo *di) 152{ |
153 int res; | |
154 | 153 |
155 uart_lock(di->hwmtx); 156 res = di->ops.getc(&di->bas); 157 uart_unlock(di->hwmtx); 158 return (res); | 154 return (di->ops.getc(&di->bas, di->hwmtx)); |
159} 160 161#endif /* _DEV_UART_CPU_H_ */ | 155} 156 157#endif /* _DEV_UART_CPU_H_ */ |