Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Equivalent to IntContext()?: (3 Items)
   
Equivalent to IntContext()?  
Hi,

I'm sharing some common code with an interrupt and a thread.
While in the interrupt, I'd like to avoid the kernel calls.

What's the best way to determine whether or not I'm currently executing in an ISR?  In VxWorks intContext() call was 
available.

I'm running 6.3.2.

Cheers,
Rob
Re: Equivalent to IntContext()?  
What processor target is this?
On most processors, the cpupage (accessed via _cpupage_ptr) has some status
bits set by the kernel on interrupt handling, but x86 is different:

#if defined(__X86__)
     #include <x86/inline.h>
     #define in_interrupt()      ((_cs() & 0x3) == 0)
#else
     #include <sys/syspage.h>
     #define in_interrupt()      (_cpupage_ptr->state & 0x3)
#endif

	Sunil.

Rob Maher wrote:
> Hi,
> 
> I'm sharing some common code with an interrupt and a thread.
> While in the interrupt, I'd like to avoid the kernel calls.
> 
> What's the best way to determine whether or not I'm currently executing in an ISR?  In VxWorks intContext() call was 
available.
> 
> I'm running 6.3.2.
> 
> Cheers,
> Rob
> 
> 
> 
> _______________________________________________
> 
> QNX Momentics Community Support
> http://community.qnx.com/sf/go/post39605
> 
Re: Equivalent to IntContext()?  
Just what I need!  Thank you Sunil!!