- generating the interrupt signal from the GPIO in the FPGA and resetting it after the interrupt was serviced
- a kernelspace IOCTL function that blocks on a workqueue
Triple buffered digitizer
-
- Posts: 1441
- Joined: Sat Jun 07, 2014 12:49 pm
- Location: Königswinter
Re: Triple buffered digitizer
If I provide some framework, would you be able to fill in the blanks ? Things like:
-
- Posts: 6
- Joined: Fri Feb 05, 2016 9:57 am
- Location: Cape Town, South Africa
Re: Triple buffered digitizer
Hi Nils!
I would love to get my hands dirty with interrupts. Are there any plans to enable interrupts triggered by pins on the extension connector?
I am dealing with a very time sensitive radar application and require knowledge of when a pin has been pulsed. I then need to write an interrupt service routine in my C program to control what happens during the interrupt and call other functions. Does this sound possible in a short time frame?
Thank you for your continued hard work.
Kind Regards
Darryn Jordan
I would love to get my hands dirty with interrupts. Are there any plans to enable interrupts triggered by pins on the extension connector?
I am dealing with a very time sensitive radar application and require knowledge of when a pin has been pulsed. I then need to write an interrupt service routine in my C program to control what happens during the interrupt and call other functions. Does this sound possible in a short time frame?
Thank you for your continued hard work.
Kind Regards
Darryn Jordan
-
- Posts: 1441
- Joined: Sat Jun 07, 2014 12:49 pm
- Location: Königswinter
Re: Triple buffered digitizer
Hi Darryn,
when you say C program, are you talking about a bare-metal application or a linux userspace program?
In linux (and other popular OSs), only kernel modules can receive interrupts, and the interrupt handlers can not call functions from userspace.
If you need sub-microsecond precision for the occurence of the pulse, your best option would be to do it in the programmable logic - have a free running counter and capture its value into a buffer when the event happens. This could be supplemented by an interrupt handler that reads the stored value and makes it available to the userspace application.
But interrupts themselves don't offer truly reliable time performance on modern processors, even in bare-metal applications.
when you say C program, are you talking about a bare-metal application or a linux userspace program?
In linux (and other popular OSs), only kernel modules can receive interrupts, and the interrupt handlers can not call functions from userspace.
If you need sub-microsecond precision for the occurence of the pulse, your best option would be to do it in the programmable logic - have a free running counter and capture its value into a buffer when the event happens. This could be supplemented by an interrupt handler that reads the stored value and makes it available to the userspace application.
But interrupts themselves don't offer truly reliable time performance on modern processors, even in bare-metal applications.
-
- Posts: 6
- Joined: Fri Feb 05, 2016 9:57 am
- Location: Cape Town, South Africa
Re: Triple buffered digitizer
Thanks Nils,
I'm talking about a linux userspace program. Wow that seems like quite a bad limitation of modern processors
So if I understand you correctly, I would have to write an interrupt handler in a kernel module which would make the counter buffer available to the userspace. Then I would have to poll for new data from the userspace? Eeee...
I basically just need a function to be called in the userspace when an (extension connector) pin is triggered.
Thanks for your input!
I'm talking about a linux userspace program. Wow that seems like quite a bad limitation of modern processors
![Surprised :o](./images/smilies/icon_e_surprised.gif)
So if I understand you correctly, I would have to write an interrupt handler in a kernel module which would make the counter buffer available to the userspace. Then I would have to poll for new data from the userspace? Eeee...
![Sad :(](./images/smilies/icon_e_sad.gif)
I basically just need a function to be called in the userspace when an (extension connector) pin is triggered.
Thanks for your input!
-
- Posts: 1441
- Joined: Sat Jun 07, 2014 12:49 pm
- Location: Königswinter
Re: Triple buffered digitizer
It's fallout from all the optimizations that modern cores employ. For example, the time it takes for your interrupt handler to be executed depends heavily on whether the handler is already in the instruction cache or not. These kinds of things introduce a large uncertainty into the predictable time performance of code. It's generally pretty fast thanks to these mechanisms, but not predictable. Additionally, the interrupts from the programmable logic are somewhere in the middle of the priority spectrum, so it may well be that other interrupts are serviced before the GPIOs - or your handler gets interrupted itself.Wow that seems like quite a bad limitation of modern processors
Event-driven callbacks are not supported by the C runtime in this area. The POSIX compliant way of doing these things is to call blocking system functions like select() with a list of events you are interested in, and they will return when an observed event arrives - or a timer expires, optionally. You can do that in a dedicated thread which examines the result of select(), calls your callback and then calls select() again. Or you use polling like you suggested.
jadalnie klasyczne ekskluzywne meble wypoczynkowe do salonu ekskluzywne meble tapicerowane ekskluzywne meble do sypialni ekskluzywne meble włoskie
Who is online
Users browsing this forum: No registered users and 71 guests