static int at91_pio_close(struct cdev *dev, int fflag, int devtype, struct thread *td) { struct at91_pio_softc *sc; sc = CDEV2SOFTC(dev); AT91_PIO_LOCK(sc); sc->flags &= ~OPENED; #if 0 /* Disable interrupts. */ #endif AT91_PIO_UNLOCK(sc); return (0); }
static int at91_pio_open(struct cdev *dev, int oflags, int devtype, struct thread *td) { struct at91_pio_softc *sc; sc = CDEV2SOFTC(dev); AT91_PIO_LOCK(sc); if (!(sc->flags & OPENED)) { sc->flags |= OPENED; #if 0 /* Enable interrupts. */ #endif } AT91_PIO_UNLOCK(sc); return (0); }
static int at91_pio_intr(void *xsc) { struct at91_pio_softc *sc = xsc; #if 0 uint32_t status; /* Reading the status also clears the interrupt. */ status = RD4(sc, PIO_SR); if (status == 0) return; AT91_PIO_LOCK(sc); AT91_PIO_UNLOCK(sc); #endif wakeup(sc); return (FILTER_HANDLED); }
static void at91_pio_intr(void *xsc) { struct at91_pio_softc *sc = xsc; uint32_t status; int i; /* Reading the status also clears the interrupt. */ status = RD4(sc, PIO_ISR) & RD4(sc, PIO_IMR); if (status != 0) { AT91_PIO_LOCK(sc); for (i = 0; status != 0 && sc->buflen < MAX_CHANGE; ++i) { if (status & 1) sc->buf[sc->buflen++] = (uint8_t)i; status >>= 1; } AT91_PIO_UNLOCK(sc); wakeup(sc); selwakeup(&sc->selp); }