Hi
I have problem: I would like to find out if function is called from ISR or from main task context. I am not sure if it possible at all, but if I do not use nested interrupts than is enough for me to test if global maskable interrupts are masked or not, it is flag I in CCR register.
I wrote code but I am not sure if is correct, because I do not know how to use assembler with C code, may some one check:
uint8_t CC;
static uint8_t const BIT_I = 0x10;
__asm(pshc);
__asm(movb 1, SP+,CC);
__asm(DES);
__asm(pulc);
if (CC & BIT_I)
{
/* I flag is set */
}
issue for me are assembler macros, may someone looke at this macros if are they correct or there is easier soultion to read CCR register (maped to global memory?)?
Regards
/Greg