When set, this causes the task switching code to avoid blocking IRQs
while looking for an idle task as that can increase IRQ latencies
enough to drop characters at 115200 baud on the cc1111. Note that this
*also* eliminates the ability to use low power modes as we cannot know
at any point whether some interrupt has come along and woken a task.
Has no effect when using task queues as those require IRQs to be
blocked while looking at the queue. Shouldn't be a problem there
though as the check for no running tasks is very cheap.
Signed-off-by: Keith Packard <keithp@keithp.com>
);
}
+__data uint8_t ao_task_minimize_latency;
+
/* Task switching function. This must not use any stack variables */
void
ao_yield(void) ao_arch_naked_define
}
ao_arch_isr_stack();
- ao_arch_block_interrupts();
+#if !HAS_TASK_QUEUE
+ if (ao_task_minimize_latency)
+ ao_arch_release_interrupts();
+ else
+#endif
+ ao_arch_block_interrupts();
#if AO_CHECK_STACK
in_yield = 1;
break;
/* Wait for interrupts when there's nothing ready */
- if (ao_cur_task_index == ao_last_task_index)
+ if (ao_cur_task_index == ao_last_task_index && !ao_task_minimize_latency)
ao_arch_wait_interrupt();
}
}
extern __xdata struct ao_task * __xdata ao_tasks[AO_NUM_TASKS];
extern __data uint8_t ao_num_tasks;
extern __xdata struct ao_task *__data ao_cur_task;
+extern __data uint8_t ao_task_minimize_latency; /* Reduce IRQ latency */
/*
ao_task.c