I'm implementing a pseudo-real-time application using a SAM3U.
The idea is to have a timer running at a frequency of 4Khz, and calling a function when the end of the period (system tick) is completed. The complication is that the function (routine) is not as short as other ISRs I have seen before, but it is quite hard to make it any shorter, and I suspect that the system ticks may be running too fast for it.
What I would like to do is to have a deterministic, firmware based, way to tell when the function has executed for more than one "system tick period" time.
I was hoping to implement this using re-entrant interrupts. When the interrupt routine is called I raise a flag, and lower it when It leaves the routine. If I check for the flag when entering the routine I would be able to know if the execution is still on-going and notify the user about the situation. Unfortunately the SAM3U doesn't seem to support re-enty on interrupts, so I'm out of ideas.
Any help would be appreciated.