aboutsummaryrefslogtreecommitdiffstats
path: root/lib/pjrc_usb_serial
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 /lib/pjrc_usb_serial
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 'lib/pjrc_usb_serial')
-rw-r--r--lib/pjrc_usb_serial/usb_serial.c12
-rw-r--r--lib/pjrc_usb_serial/usb_serial.patch39
2 files changed, 46 insertions, 5 deletions
diff --git a/lib/pjrc_usb_serial/usb_serial.c b/lib/pjrc_usb_serial/usb_serial.c
index ac5bc8a2..0c2488d5 100644
--- a/lib/pjrc_usb_serial/usb_serial.c
+++ b/lib/pjrc_usb_serial/usb_serial.c
@@ -325,7 +325,7 @@ void usb_init(void)
UDCON = 0; // enable attach resistor
usb_configuration = 0;
cdc_line_rtsdtr = 0;
- UDIEN = (1<<EORSTE)|(1<<SOFE);
+ UDIEN = (1<<EORSTE);
sei();
}
@@ -359,6 +359,7 @@ int16_t usb_serial_getchar(void)
UEINTX = 0x6B;
goto retry;
}
+ UEIENX = (1<<RXOUTE);
SREG = intr_state;
return -1;
}
@@ -775,7 +776,14 @@ static inline void usb_ack_out(void)
//
ISR(USB_COM_vect)
{
- uint8_t intbits;
+ uint8_t intbits = UEINT;
+ if (intbits & (1<<CDC_RX_ENDPOINT)) {
+ UENUM = CDC_RX_ENDPOINT;
+ UEIENX = 0;
+ extern void sched_wake_tasks(void);
+ sched_wake_tasks();
+ return;
+ }
const uint8_t *list;
const uint8_t *cfg;
uint8_t i, n, len, en;
diff --git a/lib/pjrc_usb_serial/usb_serial.patch b/lib/pjrc_usb_serial/usb_serial.patch
index 5aaa08e8..73fef81a 100644
--- a/lib/pjrc_usb_serial/usb_serial.patch
+++ b/lib/pjrc_usb_serial/usb_serial.patch
@@ -1,5 +1,5 @@
---- usb_serial.c 2011-04-19 05:54:12.000000000 -0400
-+++ usb_serial.c 2016-06-04 23:48:52.590001697 -0400
+--- ../../../lib/pjrc/usb_serial/usb_serial.c 2011-04-19 05:54:12.000000000 -0400
++++ usb_serial.c 2017-08-07 11:32:47.106357362 -0400
@@ -30,6 +30,7 @@
// Version 1.6: fix zero length packet bug
// Version 1.7: fix usb_serial_set_control
@@ -62,7 +62,24 @@
uint16_t wValue;
uint16_t wIndex;
const uint8_t *addr;
-@@ -646,7 +647,9 @@
+@@ -324,7 +325,7 @@
+ UDCON = 0; // enable attach resistor
+ usb_configuration = 0;
+ cdc_line_rtsdtr = 0;
+- UDIEN = (1<<EORSTE)|(1<<SOFE);
++ UDIEN = (1<<EORSTE);
+ sei();
+ }
+
+@@ -358,6 +359,7 @@
+ UEINTX = 0x6B;
+ goto retry;
+ }
++ UEIENX = (1<<RXOUTE);
+ SREG = intr_state;
+ return -1;
+ }
+@@ -646,7 +648,9 @@
// communication
uint32_t usb_serial_get_baud(void)
{
@@ -73,3 +90,19 @@
}
uint8_t usb_serial_get_stopbits(void)
{
+@@ -772,7 +776,14 @@
+ //
+ ISR(USB_COM_vect)
+ {
+- uint8_t intbits;
++ uint8_t intbits = UEINT;
++ if (intbits & (1<<CDC_RX_ENDPOINT)) {
++ UENUM = CDC_RX_ENDPOINT;
++ UEIENX = 0;
++ extern void sched_wake_tasks(void);
++ sched_wake_tasks();
++ return;
++ }
+ const uint8_t *list;
+ const uint8_t *cfg;
+ uint8_t i, n, len, en;