* Interrupt handling triggered by GPIO-input on 405EP?
@ 2004-05-18 12:29 Martin Egholm Nielsen
[not found] ` <008a01c43ce1$9a65fda0$0301a8c0@chuck2>
0 siblings, 1 reply; 4+ messages in thread
From: Martin Egholm Nielsen @ 2004-05-18 12:29 UTC (permalink / raw)
To: linuxppc-embedded
Hello there,
I've done some initial coding with the ibmgpio driver with my PPC405EP
(PPChamelon) board, and inspired by the "gpio_test.c"-application, I've
succeeded in turning on some attached LEDs on some of the ports, and
reading whether some of the others ports are set high or low using the
(manually) attached pushbutton-switches.
However, the way the application is at the moment I need to poll the
input-ports every so often in order to detect a pushbutton-activation.
Hence, I would like to register an interrupt-handler (of some sort) that
informs me when these events occur. Is that somehow possible?
Best regards,
Martin Egholm
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 4+ messages in thread[parent not found: <80908CC5B2C9DB47AAF8C77892FCB44315F780@lion.vector.com.pl>]
* Re: Interrupt handling triggered by GPIO-input on 405EP?
[not found] <80908CC5B2C9DB47AAF8C77892FCB44315F780@lion.vector.com.pl>
@ 2004-05-18 14:55 ` Martin Egholm Nielsen
0 siblings, 0 replies; 4+ messages in thread
From: Martin Egholm Nielsen @ 2004-05-18 14:55 UTC (permalink / raw)
To: linuxppc-embedded
[-- Attachment #1: Type: text/plain, Size: 650 bytes --]
Hi Andriy,
>> I've done some initial coding with the ibmgpio driver with my
>> PPC405EP (PPChamelon) board, and inspired by the
>> "gpio_test.c"-application, I've succeeded in turning on some
>> attached LEDs on some of the ports
> can you please share code for manipulating LEDs on PPChameleon? I'm
> using the same board and it would be fine to have such possibility.
I've attached my source-file for turning on LEDs (indirectly) connected
to GPIO-pins 11,13 and 15 on the PPChamelon board.
First of all I created the /dev/gpio device by the command:
mknod /dev/gpio c 10 185
and then you can open and close the pins as you like. :o)
// Martin
[-- Attachment #2: gpio_test.c --]
[-- Type: text/plain, Size: 836 bytes --]
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <linux/types.h>
#include <linux/ioctl.h>
#include <linux/ibm_ocp_gpio.h>
#define GPIO_DEV "/dev/gpio"
int main(int argc, char *argv[])
{
/* Open the device */
int fd = open("/dev/gpio", O_RDWR);
struct ibm_gpio_ioctl_data gpio_ioctl;
int result;
int command;
if(fd==-1) {
fprintf(stderr,"Unable to open /dev/gpio\n");
exit(1);
}
gpio_ioctl.device=0;
/* Set IRQ4 pin (GPIO0_21) high - turn on LED */
gpio_ioctl.mask=0x00000400;
gpio_ioctl.data=0x00000400;
ioctl(fd,IBMGPIO_OUT,(void *)&gpio_ioctl);
/* Sleep 1 second */
sleep(1);
/* Set IRQ3-5 pin (GPIO0_20-GPIO0_22) high - turn on LEDs */
gpio_ioctl.mask=0x00000E00;
gpio_ioctl.data=0x00000E00;
ioctl(fd,IBMGPIO_OUT,(void *)&gpio_ioctl);
close( fd );
return 0;
}
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-05-18 15:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-18 12:29 Interrupt handling triggered by GPIO-input on 405EP? Martin Egholm Nielsen
[not found] ` <008a01c43ce1$9a65fda0$0301a8c0@chuck2>
2004-05-18 15:01 ` Martin Egholm Nielsen
2004-05-18 15:51 ` Memory management problem with RAMDISK, any help? dong in kang
[not found] <80908CC5B2C9DB47AAF8C77892FCB44315F780@lion.vector.com.pl>
2004-05-18 14:55 ` Interrupt handling triggered by GPIO-input on 405EP? Martin Egholm Nielsen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).