To: | <> |
---|---|
Subject: | Re: [ts-7000] wanted: a C/BASH coded example of a program woken up by an input momentary switch. |
From: | " [ts-7000]" <> |
Date: | 19 Jun 2014 08:40:23 -0700 |
wow! that looks really cool. sorry to take so long to get back, I must of missed this message. where can I get some documentation on waitqueue_active, atomic_set, wake_up_interruptible, poll_wait, etc... I have never heard of these functions, what library, .h file is it in? What does ISR stand for? I've never worked with wait queues, ISR's or interrupts other than some posix multi-threaded code where I left an io-handler thread waiting for an intterupt on a ethernet message.
Your snippet implies as if I have two daemon processes running, the "ISR driver" and the polling function. I'm afraid I'm only familiar with POSIX multi-threaded C code that I think is closest to what you are suggesting here. AFA the interrupts that are available, I'm working with a TS-7500, and I can use any of the 8 gpio pins that are broken out on the TS-752 enclosure box, where do I get the documentation for "the sord of interrupts are available for that [port?] i/o pin? TIA, Jleslie48 ---In <> wrote : It's fairly trivial. On the driver side you want to use a wait queue that gets woken up in response to an interrupt from the ioport, you will have to look up what sort of interrupts are available for
that port. Here's a sketch: in the ISR: /* Interrupt has occured */ rc=waitqueue_active(&wait_q); if (rc) { atomic_set(&irq_occured,1); wake_up_interruptible(&wait_q); } in the POLLING function: _poll(struct file *filp, poll_table *wait) { int mask = 0; /* Did irq occur? */ if (atomic_read(&irq_occured)) { mask = POLLIN | POLLRDNORM; atomic_set(&irq_occured,0); } else { /* otherwise we go to sleep */ poll_wait(filp, &wait_q, wait); } /* Returning a 0 will cause the select()/poll() to block */ return mask; } On Wednesday, June 11, 2014 12:40:37
PM, "Jonathan Leslie [ts-7000]" <> wrote: OK, that sounds great! how do I do that? Any examples around?
__._,_.___ Posted by: __,_._,___ |
<Prev in Thread] | Current Thread | [Next in Thread> |
---|---|---|
|
Previous by Date: | Re: [ts-7000] wanted: a C/BASH coded example of a program woken up by an input momentary switch., mike.mcdonald0@rogers.com [ts-7000] |
---|---|
Next by Date: | [ts-7000] using gpio to drive opto-isolator relays (ts-7500/ts-752 in my case), jleslie48@yahoo.com [ts-7000] |
Previous by Thread: | Re: [ts-7000] wanted: a C/BASH coded example of a program woken up by an input momentary switch., mike.mcdonald0@rogers.com [ts-7000] |
Next by Thread: | [ts-7000] using gpio to drive opto-isolator relays (ts-7500/ts-752 in my case), jleslie48@yahoo.com [ts-7000] |
Indexes: | [Date] [Thread] [Top] [All Lists] |
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