Re: goto across functions/isrs?
- From: Vladimir Vassilevsky <antispam_bogus@xxxxxxxxxxx>
- Date: Thu, 14 Dec 2006 14:23:08 GMT
Tim Wescott wrote:
Actually, if he had decided to use an SST-like pseudo RTOS (or real time pseudo OS, to be more precise), it wouldn't be a problem because he would never stop in the middle of the loop -- the function would do one operation, change its state, and return. So checking for a disconnect would be simple.galapogos wrote:I have an isr that is called every 20ms that checks if something is
connected. If so it changes a global state variable to "connected". In
my main() I have a loop that checks if the device is connected.
That assumes that the OP is using an OS. If he's got a task loop in main() that kind of implies no OS.
Implement the processing function as a thread. Kill the thread if the device gets disconnected.
This can be done by a manipulation with the CPU context in SST-like pseudo RTOS or even without RTOS. A hack just for mental exercise. :)
Here is another solution: run the processing loop as the very bottom task in the SST, and run everything else as the different SST tasks. In this case, one can alter the context of main() while keepeng everything else alive. This requires hacking of the stack frame.
One of the responses in this thread did make me think that you could arrange the ISR to load the stack with just the right evil combination of stuff such that when you hit the 'iret' instruction you'd be in main() right before the while loop.
That would be difficult if there are any other interrupts and tasks. Also it is very position dependent.
Vladimir Vassilevsky
DSP and Mixed Signal Design Consultant
http://www.abvolt.com
.
- Follow-Ups:
- Re: goto across functions/isrs?
- From: Arlet
- Re: goto across functions/isrs?
- References:
- goto across functions/isrs?
- From: galapogos
- Re: goto across functions/isrs?
- From: Vladimir Vassilevsky
- Re: goto across functions/isrs?
- From: galapogos
- Re: goto across functions/isrs?
- From: Vladimir Vassilevsky
- Re: goto across functions/isrs?
- From: Tim Wescott
- Re: goto across functions/isrs?
- From: Vladimir Vassilevsky
- Re: goto across functions/isrs?
- From: Tim Wescott
- goto across functions/isrs?
- Prev by Date: Re: One of the 200 interrupts does not get executed sometimes due to a single statement
- Next by Date: Re: non load/store architecture?
- Previous by thread: Re: goto across functions/isrs?
- Next by thread: Re: goto across functions/isrs?
- Index(es):
Relevant Pages
|