sched: Introduce sched_wake_tasks() function to wake up tasks

Add function to indicate when tasks need to be run.  This will allow
the scheduler code to know if there are any tasks that need to be
processed.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2017-08-07 11:33:31 -04:00
parent e9d2ec7c41
commit a9982beacf
10 changed files with 74 additions and 10 deletions

View file

@ -65,6 +65,8 @@ DECL_INIT(serial_init);
ISR(USART0_RX_vect)
{
uint8_t data = UDR0;
if (data == MESSAGE_SYNC)
sched_wake_tasks();
if (receive_pos >= sizeof(receive_buf))
// Serial overflow - ignore it as crc error will force retransmit
return;
@ -104,6 +106,7 @@ console_pop_input(uint8_t len)
memmove(&receive_buf[copied], &receive_buf[copied + len]
, needcopy - copied);
copied = needcopy;
sched_wake_tasks();
}
irqstatus_t flag = irq_save();
if (rpos != readb(&receive_pos)) {

View file

@ -42,8 +42,10 @@ static void
console_pop_input(uint8_t len)
{
uint8_t needcopy = receive_pos - len;
if (needcopy)
if (needcopy) {
memmove(receive_buf, &receive_buf[len], needcopy);
sched_wake_tasks();
}
receive_pos = needcopy;
}