X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;ds=sidebyside;f=bertos%2Fkern%2Fproc_p.h;h=56c810819b56964d2d16c83fe29075fbde8f3e5b;hb=77958b8e9d27594aa22e76132b4bbb8d0335bfc2;hp=85cb758f9ecfd7472ea540a3547bb2261fa5717b;hpb=ffc9d84f819c7480515ece4417329f4972510462;p=bertos.git diff --git a/bertos/kern/proc_p.h b/bertos/kern/proc_p.h index 85cb758f..56c81081 100644 --- a/bertos/kern/proc_p.h +++ b/bertos/kern/proc_p.h @@ -50,6 +50,20 @@ #include // struct Process +/* + * Check if the process context switch can be performed directly by the + * architecture-dependent asm_switch_context() or if it must be delayed + * because we're in the middle of an ISR. + * + * Return true if asm_switch_context() can be executed, false + * otherwise. + * + * NOTE: if an architecture does not implement IRQ_RUNNING() this function + * always returns true. + */ +#define CONTEXT_SWITCH_FROM_ISR() (!IRQ_RUNNING()) + +#ifndef asm_switch_context /** * CPU dependent context switching routines. * @@ -57,6 +71,7 @@ * support routine which usually needs to be written in assembly. */ EXTERN_C void asm_switch_context(cpu_stack_t **new_sp, cpu_stack_t **save_sp); +#endif /* * Save context of old process and switch to new process.