Check usb/jtag for incoming chars too
This commit is contained in:
parent
827eaeb1f9
commit
bd097de277
@ -101,21 +101,28 @@ bool usb_serial_jtag_connected(void) {
|
||||
}
|
||||
|
||||
char usb_serial_jtag_read_char(void) {
|
||||
if (ringbuf_num_filled(&ringbuf) == 0) {
|
||||
if (ringbuf_num_filled(&ringbuf) == 0 && !usb_serial_jtag_ll_rxfifo_data_available()) {
|
||||
return -1;
|
||||
}
|
||||
char c = ringbuf_get(&ringbuf);
|
||||
char c = -1;
|
||||
if (ringbuf_num_filled(&ringbuf) > 0) {
|
||||
c = ringbuf_get(&ringbuf);
|
||||
}
|
||||
// Maybe re-enable the recv interrupt if we've emptied the ringbuf.
|
||||
if (ringbuf_num_filled(&ringbuf) == 0) {
|
||||
usb_serial_jtag_ll_disable_intr_mask(USB_SERIAL_JTAG_INTR_SERIAL_OUT_RECV_PKT);
|
||||
_copy_out_of_fifo();
|
||||
usb_serial_jtag_ll_ena_intr_mask(USB_SERIAL_JTAG_INTR_SERIAL_OUT_RECV_PKT);
|
||||
// May have only been ctrl-c.
|
||||
if (c == -1 && ringbuf_num_filled(&ringbuf) > 0) {
|
||||
c = ringbuf_get(&ringbuf);
|
||||
}
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
bool usb_serial_jtag_bytes_available(void) {
|
||||
return ringbuf_num_filled(&ringbuf) > 0;
|
||||
return ringbuf_num_filled(&ringbuf) > 0 || usb_serial_jtag_ll_rxfifo_data_available();
|
||||
}
|
||||
|
||||
void usb_serial_jtag_write(const char *text, uint32_t length) {
|
||||
|
Loading…
Reference in New Issue
Block a user