ts-7000
[Top] [All Lists]

[ts-7000] Re: TS7800 User interrupt (IRQ11-14) in Debian + C

To:
Subject: [ts-7000] Re: TS7800 User interrupt (IRQ11-14) in Debian + C
From: "tommessum" <>
Date: Mon, 20 Dec 2010 11:47:58 -0000
For more information on this (if anybody is interested) I got it to work as 
follows: 

                
        fd = open("/proc/irq/69/irq", O_RDONLY, S_IREAD); //    (1) 
//.............................................................         while 
(1) { 
                read(fd, (int *)buffer, sizeof(int));   // (2) 
                set( GPIOFEOI , 1<<3);                  // (3) 
                // process interrupt here
        }
//.............................................................
        close(fd);              // (4) 

Notes: 

(1) Various other web posts on this topic have fd = open("/proc/irq/69/irq", 
O_RDONLY|O_NONBCLOCK); which causes read() to return always without blocking! 
i.e. remove O_NONBLOCK. 

(2) The thread will block here until the IRQ pin has gone high. The return 
value in 'buffer' is the number of interrupts missed, which can be useful!

(3) Interrupts are level sensitive, not edge sensitive, so read() will block 
when the IRQ pin is low and return continuously when the IRQ pin is high! Extra 
facilities should be added here to make the hardware return the IRQ pin level 
back to zero. (the code shown is for the EP9302 chip).

(4) Important! The file "/proc/irq/78" must be programatically closed somehow 
(not shown here) when the program ends. I found that if the application exits 
unexpectedly (easily done under development), the handle for this file will 
hang and the program will fail if it is called again, necessitating a full 
power reboot. It is possible to dislodge the handle from the shell with 'fuser 
-k /proc/irq/69/irq' but I haven't found a way to do this programmatically. 
(any ideas?)

Hope this is of use.

Tom 


 
  


>




------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ts-7000/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/ts-7000/join
    (Yahoo! ID required)

<*> To change settings via email:
     
    

<*> To unsubscribe from this group, send an email to:
    

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU