diff options
Diffstat (limited to 'sys/dev/uart/uart_cpu.h')
-rw-r--r-- | sys/dev/uart/uart_cpu.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/sys/dev/uart/uart_cpu.h b/sys/dev/uart/uart_cpu.h index db64d49..99ced1a 100644 --- a/sys/dev/uart/uart_cpu.h +++ b/sys/dev/uart/uart_cpu.h @@ -43,6 +43,8 @@ struct uart_ops { void (*putc)(struct uart_bas *, int); int (*rxready)(struct uart_bas *); int (*getc)(struct uart_bas *, struct mtx *); + void (*grab)(struct uart_bas *); + void (*ungrab)(struct uart_bas *); }; extern bus_space_tag_t uart_bus_space_io; @@ -135,6 +137,27 @@ uart_putc(struct uart_devinfo *di, int c) uart_unlock(di->hwmtx); } +static __inline void +uart_grab(struct uart_devinfo *di) +{ + + uart_lock(di->hwmtx); + if (di->ops->grab) + di->ops->grab(&di->bas); + uart_unlock(di->hwmtx); +} + +static __inline void +uart_ungrab(struct uart_devinfo *di) +{ + + uart_lock(di->hwmtx); + if (di->ops->ungrab) + di->ops->ungrab(&di->bas); + uart_unlock(di->hwmtx); +} + + static __inline int uart_rxready(struct uart_devinfo *di) { |