aboutsummaryrefslogtreecommitdiffstats
path: root/src/avr
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2017-08-07 11:33:31 -0400
committerKevin O'Connor <kevin@koconnor.net>2017-08-08 00:27:28 -0400
commita9982beacf184ccdc4bf1221852c900b0809537d (patch)
tree0c7774106b678688361ae8b4ffc346eb51b7b013 /src/avr
parente9d2ec7c41c60ab74fe2850fb0787af7bb3361f4 (diff)
downloadkutter-a9982beacf184ccdc4bf1221852c900b0809537d.tar.gz
kutter-a9982beacf184ccdc4bf1221852c900b0809537d.tar.xz
kutter-a9982beacf184ccdc4bf1221852c900b0809537d.zip
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>
Diffstat (limited to 'src/avr')
-rw-r--r--src/avr/serial.c3
-rw-r--r--src/avr/usbserial.c4
2 files changed, 6 insertions, 1 deletions
diff --git a/src/avr/serial.c b/src/avr/serial.c
index 10b95992..8b9dd14a 100644
--- a/src/avr/serial.c
+++ b/src/avr/serial.c
@@ -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)) {
diff --git a/src/avr/usbserial.c b/src/avr/usbserial.c
index 1b42d6d3..cc7bb12c 100644
--- a/src/avr/usbserial.c
+++ b/src/avr/usbserial.c
@@ -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;
}