AnsweredAssumed Answered

exam if method called from ISR context (S12X)

Question asked by Grzegorz Konopko on Jan 14, 2013
Latest reply on Jan 16, 2013 by Grzegorz Konopko



I have such problem:

I would like to write method (for S12X) what will be exam if is called from ISR or task. let me show example:



* Metod return TRUE if called from ISR or FALSE if called from task


extern bool S12X_ISR_context(void);


and use:




void CAN_ISR(void)


     bool context = S12X_ISR_context(); //return TRUE due called from ISR!




void main(void)


     bool context = S12X_ISR_context(); //return FALSE due called from main






Am I clear enough?

1. Is it possible to implement testing IPL bits in CCR register?


I found in datasheet such picture (attached below), but:

2. I do not know details of S12X core so please someone check it if I am going right way..

3. How to read to stack located variable IPL bits?