Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic Add support for com(4) without an interrupt by se...



details:   https://anonhg.NetBSD.org/src/rev/07c527eed925
branches:  trunk
changeset: 446325:07c527eed925
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Fri Nov 30 16:26:19 2018 +0000

description:
Add support for com(4) without an interrupt by setting the COM_HW_POLL flag

diffstat:

 sys/dev/ic/com.c    |  19 +++++++++++++++++--
 sys/dev/ic/comvar.h |   6 ++++--
 2 files changed, 21 insertions(+), 4 deletions(-)

diffs (81 lines):

diff -r 8a7fa4e65150 -r 07c527eed925 sys/dev/ic/com.c
--- a/sys/dev/ic/com.c  Fri Nov 30 15:05:35 2018 +0000
+++ b/sys/dev/ic/com.c  Fri Nov 30 16:26:19 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: com.c,v 1.349 2018/11/28 22:28:46 jmcneill Exp $ */
+/* $NetBSD: com.c,v 1.350 2018/11/30 16:26:19 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2004, 2008 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.349 2018/11/28 22:28:46 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.350 2018/11/30 16:26:19 jmcneill Exp $");
 
 #include "opt_com.h"
 #include "opt_ddb.h"
@@ -379,6 +379,16 @@
        CSR_WRITE_1(&sc->sc_regs, COM_REG_MCR, sc->sc_mcr);
 }
 
+static void
+com_intr_poll(void *arg)
+{
+       struct com_softc * const sc = arg;
+
+       comintr(sc);
+
+       callout_schedule(&sc->sc_poll_callout, 1);
+}
+
 void
 com_attach_subr(struct com_softc *sc)
 {
@@ -396,6 +406,8 @@
        prop_dictionary_get_bool(dict, "is_console", &is_console);
        prop_dictionary_get_bool(dict, "force_console", &force_console);
        callout_init(&sc->sc_diag_callout, 0);
+       callout_init(&sc->sc_poll_callout, 0);
+       callout_setfunc(&sc->sc_poll_callout, com_intr_poll, sc);
        mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_HIGH);
 
 #if defined(COM_16650)
@@ -676,6 +688,9 @@
        com_config(sc);
 
        SET(sc->sc_hwflags, COM_HW_DEV_OK);
+
+       if (ISSET(sc->sc_hwflags, COM_HW_POLL))
+               callout_schedule(&sc->sc_poll_callout, 1);
 }
 
 void
diff -r 8a7fa4e65150 -r 07c527eed925 sys/dev/ic/comvar.h
--- a/sys/dev/ic/comvar.h       Fri Nov 30 15:05:35 2018 +0000
+++ b/sys/dev/ic/comvar.h       Fri Nov 30 16:26:19 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: comvar.h,v 1.87 2018/05/27 17:05:06 jmcneill Exp $     */
+/*     $NetBSD: comvar.h,v 1.88 2018/11/30 16:26:19 jmcneill Exp $     */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -69,6 +69,7 @@
 #define        COM_HW_TXFIFO_DISABLE   0x100
 #define        COM_HW_NO_TXPRELOAD     0x200
 #define        COM_HW_AFE      0x400
+#define        COM_HW_POLL     0x800
 
 /* Buffer size for character buffer */
 #ifndef COM_RING_SIZE
@@ -166,7 +167,8 @@
        void *sc_si;
        struct tty *sc_tty;
 
-       struct callout sc_diag_callout;
+       callout_t sc_diag_callout;
+       callout_t sc_poll_callout;
 
        int sc_frequency;
 



Home | Main Index | Thread Index | Old Index