PERFORCE change 105480 for review
Warner Losh
imp at FreeBSD.org
Fri Sep 1 19:46:49 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=105480
Change 105480 by imp at 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);
}
/*
More information about the p4-projects
mailing list