Date: Fri, 1 Sep 2006 19:46:45 GMT From: Warner Losh <imp@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 105480 for review Message-ID: <200609011946.k81Jkj4L094279@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=105480 Change 105480 by imp@imp_lighthouse on 2006/09/01 19:45:57 quick hack: implement in/out gpio good. # Still need to do configuration and status query Affected files ... .. //depot/projects/arm/src/sys/arm/at91/at91_pio.c#16 edit .. //depot/projects/arm/src/sys/sys/gpio.h#1 add Differences ... ==== //depot/projects/arm/src/sys/arm/at91/at91_pio.c#16 (text+ko) ==== @@ -29,6 +29,7 @@ #include <sys/systm.h> #include <sys/bus.h> #include <sys/conf.h> +#include <sys/gpio.h> #include <sys/kernel.h> #include <sys/lock.h> #include <sys/mbuf.h> @@ -271,7 +272,26 @@ at91_pio_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, struct thread *td) { - return (ENXIO); + struct at91_pio_softc *sc = CDEV2SOFTC(dev); + + switch(cmd) { + case GPIO_SET: /* turn bits on */ + WR4(sc, PIO_SODR, *(uint32_t *)data); + return (0); + case GPIO_CLR: /* turn bits off */ + WR4(sc, PIO_CODR, *(uint32_t *)data); + return (0); + case GPIO_GET: /* Get the status of output bits */ + *(uint32_t *)data = RD4(sc, PIO_ODSR); + return (0); + case GPIO_READ: /* Get the status of input bits */ + *(uint32_t *)data = RD4(sc, PIO_PDSR); + return (0); + case GPIO_INFO: /* Learn about this device's GPIO bits */ + case GPIO_CFG: /* Configure GPIO pins */ + break; + } + return (ENOTTY); } /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200609011946.k81Jkj4L094279>