mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 00:14:32 -08:00
[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:
@@ -37,17 +37,13 @@ gather_command(j6::channel &cout, j6::ring_buffer &buf)
|
|||||||
while (i < n) {
|
while (i < n) {
|
||||||
start[i] = input[i];
|
start[i] = input[i];
|
||||||
outp[i] = input[i];
|
outp[i] = input[i];
|
||||||
j6::syslog(j6::logs::app, j6::log_level::spam, "Read: %x", start[i]);
|
|
||||||
if (start[i++] == '\r') {
|
if (start[i++] == '\r') {
|
||||||
newline = true;
|
newline = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t written = i;
|
cout.commit(i);
|
||||||
if (newline)
|
|
||||||
outp[written++] = '\n';
|
|
||||||
cout.commit(written);
|
|
||||||
cout.consume(i);
|
cout.consume(i);
|
||||||
|
|
||||||
if (newline)
|
if (newline)
|
||||||
|
|||||||
@@ -96,7 +96,8 @@ main(int argc, const char **argv)
|
|||||||
uint64_t signals = 0;
|
uint64_t signals = 0;
|
||||||
result = j6_event_wait(event, &signals, 500);
|
result = j6_event_wait(event, &signals, 500);
|
||||||
if (result == j6_err_timed_out) {
|
if (result == j6_err_timed_out) {
|
||||||
com1.handle_interrupt();
|
com1.do_read();
|
||||||
|
com1.do_write();
|
||||||
//com2.handle_interrupt();
|
//com2.handle_interrupt();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ serial_port::do_write()
|
|||||||
{
|
{
|
||||||
util::scoped_lock lock {m_lock};
|
util::scoped_lock lock {m_lock};
|
||||||
|
|
||||||
|
while (true) {
|
||||||
uint8_t const *data = nullptr;
|
uint8_t const *data = nullptr;
|
||||||
size_t n = m_chan.get_block(&data, false);
|
size_t n = m_chan.get_block(&data, false);
|
||||||
|
|
||||||
@@ -112,6 +113,7 @@ serial_port::do_write()
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_chan.consume(n);
|
m_chan.consume(n);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ public:
|
|||||||
|
|
||||||
void handle_interrupt();
|
void handle_interrupt();
|
||||||
void do_write();
|
void do_write();
|
||||||
|
void do_read();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_writing;
|
bool m_writing;
|
||||||
@@ -30,6 +31,5 @@ private:
|
|||||||
j6::channel &m_chan;
|
j6::channel &m_chan;
|
||||||
util::spinlock m_lock;
|
util::spinlock m_lock;
|
||||||
|
|
||||||
void do_read();
|
|
||||||
void handle_error(uint16_t reg, uint8_t value);
|
void handle_error(uint16_t reg, uint8_t value);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -317,7 +317,7 @@ image::parse_rela_table(const util::counted<const rela> &table, image_list &ctx)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
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);
|
exit(126);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user