DC11 test lines from debugger

This commit is contained in:
folkert van heusden 2024-05-11 20:54:01 +02:00
parent 06d189e08c
commit fc95b33b8b
Signed by untrusted user who does not match committer: folkert
GPG key ID: 6B6455EDFEED3BD1
3 changed files with 33 additions and 0 deletions

View file

@ -137,6 +137,31 @@ void dc11::show_state(console *const cnsl) const
}
}
void dc11::test_serial(const std::string & txt) const
{
for(int i=0; i<dc11_n_lines; i++) {
if (i == serial_line) {
DOLOG(info, false, "DC11 serial test line %d", i);
#if defined(ESP32)
uart_write_bytes(ESP32_UART, txt.c_str(), txt.size());
#elif IS_POSIX
if (write(serial_fd, txt.c_str(), txt.size()) != txt.size())
DOLOG(warning, false, "DC11 failed to send test string to line %d", i);
#endif
}
else if (pfds[dc11_n_lines + i].fd != INVALID_SOCKET) {
DOLOG(info, false, "DC11 socket line %d", i);
if (write(pfds[dc11_n_lines + i].fd, txt.c_str(), txt.size()) != txt.size())
DOLOG(warning, false, "DC11 failed to send test string to line %d", i);
}
else {
DOLOG(info, false, "DC11 line %d not connected", i);
}
}
}
void dc11::trigger_interrupt(const int line_nr, const bool is_tx)
{
TRACE("DC11: interrupt for line %d, %s", line_nr, is_tx ? "TX" : "RX");

2
dc11.h
View file

@ -73,6 +73,8 @@ public:
void show_state(console *const cnsl) const override;
void test_serial(const std::string & txt) const;
#if defined(ESP32)
void set_serial(const int bitrate, const int rx, const int tx);
void serial_handler();

View file

@ -970,6 +970,11 @@ void debugger(console *const cnsl, bus *const b, std::atomic_uint32_t *const sto
continue;
}
else if (parts[0] == "testdc11") {
b->getDC11()->test_serial(cmd);
continue;
}
else if (cmd == "dp") {
cnsl->stop_panel_thread();
@ -1040,6 +1045,7 @@ void debugger(console *const cnsl, bus *const b, std::atomic_uint32_t *const sto
"startnet - start network",
"chknet - check network status",
#endif
"testdc11 - test DC11",
"cfgdisk - configure disk",
"log ... - log a message to the logfile",
nullptr