예제 #1
0
int
pckbcintr(void *vsc)
{
	struct pckbc_softc *sc = (struct pckbc_softc *)vsc;
	struct pckbc_internal *t = sc->id;
	u_char stat;
	pckbc_slot_t slot;
	struct pckbc_slotdata *q;
	int served = 0, data;

	for(;;) {
		stat = bus_space_read_1(t->t_iot, t->t_ioh_c, 0);
		if (!(stat & KBS_DIB))
			break;

		slot = (t->t_haveaux && (stat & 0x20)) ?
		    PCKBC_AUX_SLOT : PCKBC_KBD_SLOT;
		q = t->t_slotdata[slot];

		if (q != NULL && q->polling)
			return 0;

		served = 1;
		KBD_DELAY;
		data = bus_space_read_1(t->t_iot, t->t_ioh_d, 0);

		rnd_add_uint32(&q->rnd_source, (stat<<8)|data);

		pckbportintr(t->t_pt, slot, data);
	}

	return (served);
}
예제 #2
0
void
pckbcintr_soft(void *vsc)
{
	struct pckbc_softc *sc = vsc;
	struct pckbc_internal *t = sc->id;
	int data, slot, s;
#ifndef __GENERIC_SOFT_INTERRUPTS_ALL_LEVELS
	int st;

	st = spltty();
#endif

	s = splhigh();
	while (t->rbuf_read != t->rbuf_write) {
		slot = t->rbuf[t->rbuf_read].slot;
		data = t->rbuf[t->rbuf_read].data;
		t->rbuf_read = (t->rbuf_read+1) % PCKBC_RBUF_SIZE;
		splx(s);
		pckbportintr(t->t_pt, slot, data);
		s = splhigh();
	}
	splx(s);


#ifndef __GENERIC_SOFT_INTERRUPTS_ALL_LEVELS
	splx(st);
#endif
}
static int
sackbc_rxint(void *cookie)
{
	struct sackbc_softc *sc = cookie;
	int stat, code = -1;

	stat = bus_space_read_4(sc->iot, sc->ioh, SACCKBD_STAT);
	DPRINTF(("sackbc_rxint stat=%x\n", stat));
	if (stat & KBDSTAT_RXF) {
		code = bus_space_read_4(sc->iot, sc->ioh, SACCKBD_DATA);

		rnd_add_uint32(&sc->rnd_source, (stat<<8)|code);

		if (sc->polling) {
			sc->poll_data = code;
			sc->poll_stat = stat;
		} else
			pckbportintr(sc->pt, sc->slot, code);
		return 1;
	}

	return 0;
}