On Sat, 29 Oct 2016 13:20:34 -0500 Jon Elson <el...@pico-systems.com> wrote:
> On 10/28/2016 09:41 PM, Jon Elson wrote: > > This is why I keep popping up with asking about > > externally-triggered RT threads, which should relieve all > > the Pico Systems boards from the RT latency issue. I > > don't mind doing some work on this, especially testing and > > verification, but I'm not sure I'm competent to dive into > > rtapi to try to do it myself. > > > OK, I did a little reading of the code, to get some sense of > how much needed to be changed in rtapi superstructure for > externally-triggered threads. If thread is a function it could maybe be called from interrupt handler triggered from external pin interrupt. > First, you'd need to change emc/motion/motion.c to accept > parameters that defined an interrupt rather than a time in > ns for the thread. It would then need to pass this info to > hal/hal_lib.c function hal_create_thread() to actually > create the RT thread based on that interrupt #. One would > want to make this flexible enough to handle interrupt > numbers for not only the PC but ARM processors, too. To be flexible I think it need to be a function called regularly from an interrupt handler or os delay if executed such a thread. > hal_create_thread() has a lot of code in it to regularize > the thread period, make it an integral number of timer > ticks, make other threads multiples of the fastest thread, > and so on. All of this would be "broken" by > interrupt-scheduled threads. Maybe hal_create_thread() is the PC implementation. On others it is a simple interupt handler which in sort of is a function called then interrupt is triggered and regularly if triggered by a periodic interrupt. > At this point, I'd have to do a lot more reading to figure > out how the rtapi functions do what they do. > > Any comments? I used to program embeded systems and know about two fundamentally different methods for threads: 1. An operating system thread where with wait for a trigger, this may make software simpler, state machines may be possible to avoid. 2. A function called periodically, sequential execution between function exit have to be implented as a state machine. Periodically called function have an advantage then it come to flexibility because same function will work with both an operating system and an interrupt handler. A further advantage is possibility to write a test bench which is particularly useful for embedded systems there this test bench could be run on ordinary computer which make visualization simpler. Regards Nicklas Karlsson ------------------------------------------------------------------------------ The Command Line: Reinvented for Modern Developers Did the resurgence of CLI tooling catch you by surprise? Reconnect with the command line and become more productive. Learn the new .NET and ASP.NET CLI. Get your free copy! http://sdm.link/telerik _______________________________________________ Emc-developers mailing list Emc-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-developers