This instance will be upgraded to Heptapod 0.31.0 (final) on 2022-05-24 at 14:00 UTC+2 (a few minutes of down time)

Commit 47807365 authored by alex@thinkpad's avatar alex@thinkpad
Browse files

Tasks: new method for checking whether an interrupt is active

(old method was not compatible with DIGIC 7; to be tested on all models)

--HG--
branch : new-dryos-task-hooks
parent ba97711fa839
...@@ -106,11 +106,17 @@ copy_and_restart( int offset ) ...@@ -106,11 +106,17 @@ copy_and_restart( int offset )
char* get_current_task_name() char* get_current_task_name()
{ {
#if 0
/* DryOS: right after current_task we have a flag /* DryOS: right after current_task we have a flag
* set to 1 when handling an interrupt */ * set to 1 when handling an interrupt */
/* this doesn't work on DIGIC 7 */
uint32_t interrupt_active = MEM((uintptr_t)&current_task + 4); uint32_t interrupt_active = MEM((uintptr_t)&current_task + 4);
#endif
if (!interrupt_active)
/* DryOS: right before interrupt_active we have a counter showing the interrupt nesting level */
uint32_t interrupt_level = MEM((uintptr_t)&current_interrupt - 4);
if (!interrupt_level)
{ {
return current_task->name; return current_task->name;
} }
......
...@@ -22,11 +22,10 @@ int ml_shutdown_requested = 0; ...@@ -22,11 +22,10 @@ int ml_shutdown_requested = 0;
char* get_current_task_name() char* get_current_task_name()
{ {
/* DryOS: right after current_task we have a flag /* DryOS: right before interrupt_active we have a counter showing the interrupt nesting level */
* set to 1 when handling an interrupt */ uint32_t interrupt_level = MEM((uintptr_t)&current_interrupt - 4);
uint32_t interrupt_active = MEM((uintptr_t)&current_task + 4);
if (!interrupt_level)
if (!interrupt_active)
{ {
return current_task->name; return current_task->name;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment