Discovering if inside an ISR
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2013-03-12 1:14 PM
Posted on March 12, 2013 at 21:14
Is there any way to discover if we are running inside any ISR (uart, systick, timers, etc.)? It would avoid dead-locks.
I thought reading IPSR would help, so if ISR_NUMBER is different from 0 (thread mode), then we would be running inside an ISR. But I couldn't find a way to read it.
This discussion is locked. Please start a new topic to ask your question.
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2013-03-12 1:51 PM
Posted on March 12, 2013 at 21:51
Couldn't you tell with consistent usage of Mutex/Semaphore type constructs?
Looking at the processor state seems a bit hackish, you can look at bit 2 of LR when it contains a magic value to see if it was called as an IRQ, or specifically what stack is in use, as I recall. You could also look at what region SP resides in.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Up vote any posts that you find helpful, it shows what's working..
