[drv.uart] Read everything from the channel in uartnnMake sure to keep reading until the channel is empty so output isn't behindnby a keystroke.

This commit is contained in:
2024-04-26 00:32:06 -07:00
parent 182d3b0a6a
commit 3b9efc11d0
5 changed files with 25 additions and 26 deletions

View File

@@ -37,17 +37,13 @@ gather_command(j6::channel &cout, j6::ring_buffer &buf)
while (i < n) {
start[i] = input[i];
outp[i] = input[i];
j6::syslog(j6::logs::app, j6::log_level::spam, "Read: %x", start[i]);
if (start[i++] == '\r') {
newline = true;
break;
}
}
size_t written = i;
if (newline)
outp[written++] = '\n';
cout.commit(written);
cout.commit(i);
cout.consume(i);
if (newline)

View File

@@ -96,7 +96,8 @@ main(int argc, const char **argv)
uint64_t signals = 0;
result = j6_event_wait(event, &signals, 500);
if (result == j6_err_timed_out) {
com1.handle_interrupt();
com1.do_read();
com1.do_write();
//com2.handle_interrupt();
continue;
}

View File

@@ -91,6 +91,7 @@ serial_port::do_write()
{
util::scoped_lock lock {m_lock};
while (true) {
uint8_t const *data = nullptr;
size_t n = m_chan.get_block(&data, false);
@@ -112,6 +113,7 @@ serial_port::do_write()
}
m_chan.consume(n);
}
}
void

View File

@@ -23,6 +23,7 @@ public:
void handle_interrupt();
void do_write();
void do_read();
private:
bool m_writing;
@@ -30,6 +31,5 @@ private:
j6::channel &m_chan;
util::spinlock m_lock;
void do_read();
void handle_error(uint16_t reg, uint8_t value);
};

View File

@@ -317,7 +317,7 @@ image::parse_rela_table(const util::counted<const rela> &table, image_list &ctx)
break;
default:
j6::syslog(j6::logs::app, j6::log_level::verbose, "Unknown rela relocation type %d in %s", rel.type, name);
j6::syslog(j6::logs::app, j6::log_level::error, "Unknown rela relocation type %d in %s", rel.type, name);
exit(126);
break;
}