This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to determine where function was called from

From my code I need to figure out has my function been called from the ISR or just regular application code. I do know that application is running is the User Thread mode and ISR is in privileged handler mode. Could you anyone please provide me with the sources of C-function(s) or inline assembly which will let me efficiently solve this issue.

Thanks.

Parents Reply Children
  • Eric, take my request as given please. Explaining it will spark more issues then bring answers.

  • whatever you (or someone else) come up with beware that it may fail.

    If I found a solution (I am not looking) I would go through EVERY step of the process and check if, when called from main(), an interrupt at that specific place would screw it up. NOTE that the setting og the bit causing the interrupt and the interrupt does not happen at the same time.

    These comment are triggered by my bootloader experience.

    Explaining it will spark more issues then bring answers.
    never heard of or seen that one.

    Erik

    PS why not just two functions, they can both call the same subfunction

    void mainfunc(void)
    { subfunc(1);

    void ISRfunc(void)
    { subfunc(0);

  • Having two function is too easy for me and requires my user to think more which is always dangerous: remember - thinking makes wrinkles and therefore harmful :)