// user_irq_pulse.c // // This program is used on a TS-7800 to count pulses on IRQ14 // // // compile: gcc -o user_irq_pulse user_irq_pulse.c
#include <stdio.h> #include <fcntl.h> #include <unistd.h> #include <sys/stat.h> #include <strings.h> #include <sys/mman.h>
#define GPIOD_DR 0x1C
int main(int argc, char** argv) { int num = 0, buffer, fd_gpio; unsigned char *start; //For reading GPIO D7 (IRQ14)
fd_gpio = open("/dev/mem", O_RDWR|O_SYNC); if (fd_gpio == -1) { perror("open(/dev/mem):"); return 1; }
start = mmap(0, getpagesize(), PROT_READ|PROT_WRITE, MAP_SHARED, fd_gpio, 0xe8000000); //Base address for syscon
while(1) { fd_irq = open("/proc/irq/78/irq", O_RDONLY| O_NONBLOCK, S_IREAD); //IRQ14 if(fd_ext == -1) { //Maybe use better error handling printf("Couldn't open IRQ78 file\n"); return 1; } read(fd_irq, (int *)buffer, sizeof(int)); //read will be blocking close(fd_irq); //We want to close it so we do not keep getting interrupts //If you want to note the time you could insert a gettimeofday() //here and record the time for(;((*(unsigned int *)(start + GPIOD_DR)) & 0x80);); //Watch this IO line and wait for it to go high before //watching the IRQ line again }
return 0; } //end of main
Juan Felipe Obando Obando Valencia.
To: From: Date: Thu, 11 Nov 2010 13:43:48 +0000 Subject: [ts-7000] TS-7260 External Interrupt
Hi everyone, we need some help!
Before anything, let me tell you that we are newbie in Embedded Linux and we are working with TS-7260 with TS-Linux.
We developed an external board called "Communication Board" that should send data to TS-7260 by PC/104. The device that talks with TS-7260 is a TL16C550 (Asynchronous Communications Element With Autoflow Control). As our ARM won't be waiting for this data we should implement an external interrupt to receive it when data is ready. So, we correctly configured the TL16C550 to generate an "interrupt signal" when data is ready and then this signal is sent to PC/104 B21, B22 and B23, which are IRQ5, IRQ6 and IRQ7 respectively. At this part we are having some troubles. Reading EP9302 user guide we set the configurations of VIC (Vectored Interrupt Controller) and thought that everything was work, but anything happened. Using a scope we saw our "interrupt signal" at IRQ's pins, although the ARM didn't recognize the interruption and continued running the code. So we decided to try timer interrupt to see if we made any wrong configuration. It didn't work too either configuring EP9302 as it's indicated in user guide. We read EP9301 user guide to get more information but anything helped. At this point, we started to look for samples at net but neither one worked. Looking at TS-7260 we read about RTAI. Is it necessary for external interrupt? If not, anyone have an idea about what should I do for this work? We are developing our codes in Eclipse IDE using C and our cross compiler is gcc-4.1.0-glibc-2.3.2. Our OS is Windows XP and we use Cygwin.
Other useful information is that we can't use libraries like interrupt.h because we get a lot of errors when we build the project.
Would someone help us? We are trying to solve this problem for about five weeks. I will appreciate any kind of help!
Thanks,
Silva
__._,_.___
__,_._,___
|