X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fkern%2Fproc_p.h;h=56c810819b56964d2d16c83fe29075fbde8f3e5b;hb=82aa9864bc5accc468d3c9ed109a8b44ef36da94;hp=85cb758f9ecfd7472ea540a3547bb2261fa5717b;hpb=f149112c04843df99b2c9e9fd2ef47d9cacae8a4;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.