Ejemplo n.º 1
0
static void
aju_ac_callout(void *arg)
{
	struct altera_jtag_uart_softc *sc = arg;
	struct tty *tp = sc->ajus_ttyp;
	uint32_t v;

	tty_lock(tp);
	AJU_LOCK(sc);
	v = aju_control_read(sc);
	if (v & ALTERA_JTAG_UART_CONTROL_AC) {
		v &= ~ALTERA_JTAG_UART_CONTROL_AC;
		aju_control_write(sc, v);
		if (*sc->ajus_jtag_presentp == 0) {
			*sc->ajus_jtag_missedp = 0;
			*sc->ajus_jtag_presentp = 1;
			aju_handle_output(sc, tp);
		}
	} else if (*sc->ajus_jtag_presentp != 0) {
		(*sc->ajus_jtag_missedp)++;
		if (*sc->ajus_jtag_missedp >= AJU_JTAG_MAXMISS) {
			*sc->ajus_jtag_presentp = 0;
			aju_handle_output(sc, tp);
		}
	}
	callout_reset(&sc->ajus_ac_callout, AJU_AC_POLLINTERVAL,
	    aju_ac_callout, sc);
	AJU_UNLOCK(sc);
	tty_unlock(tp);
}
Ejemplo n.º 2
0
static void
aju_intr_disable(struct altera_jtag_uart_softc *sc)
{
	uint32_t v;

	AJU_LOCK_ASSERT(sc);

	v = aju_control_read(sc);
	v &= ~(ALTERA_JTAG_UART_CONTROL_RE | ALTERA_JTAG_UART_CONTROL_WE);
	aju_control_write(sc, v);
}
Ejemplo n.º 3
0
static void
aju_intr_writable_disable(struct altera_jtag_uart_softc *sc)
{
	uint32_t v;

	AJU_LOCK_ASSERT(sc);

	atomic_add_int(&aju_intr_writable_disabled, 1);
	v = aju_control_read(sc);
	v &= ~ALTERA_JTAG_UART_CONTROL_WE;
	aju_control_write(sc, v);
}
Ejemplo n.º 4
0
static void
aju_ac_callout(void *arg)
{
	struct altera_jtag_uart_softc *sc = arg;
	struct tty *tp = sc->ajus_ttyp;
	uint32_t v;

	tty_lock(tp);
	AJU_LOCK(sc);
	v = aju_control_read(sc);
	if (v & ALTERA_JTAG_UART_CONTROL_AC) {
		v &= ~ALTERA_JTAG_UART_CONTROL_AC;
		aju_control_write(sc, v);
		if (*sc->ajus_jtag_presentp == 0) {
			*sc->ajus_jtag_presentp = 1;
			atomic_add_int(&aju_jtag_appeared, 1);
			aju_handle_output(sc, tp);
		}

		/* Any hit eliminates all recent misses. */
		*sc->ajus_jtag_missedp = 0;
	} else if (*sc->ajus_jtag_presentp != 0) {
		/*
		 * If we've exceeded our tolerance for misses, mark JTAG as
		 * disconnected and drain output.  Otherwise, bump the miss
		 * counter.
		 */
		if (*sc->ajus_jtag_missedp > AJU_JTAG_MAXMISS) {
			*sc->ajus_jtag_presentp = 0;
			atomic_add_int(&aju_jtag_vanished, 1);
			aju_handle_output(sc, tp);
		} else
			(*sc->ajus_jtag_missedp)++;
	}
	callout_reset(&sc->ajus_ac_callout, AJU_AC_POLLINTERVAL,
	    aju_ac_callout, sc);
	AJU_UNLOCK(sc);
	tty_unlock(tp);
}