Merge branch 'master' into psram

This commit is contained in:
folkert van heusden 2024-04-27 21:41:39 +02:00
commit f22af40572
Signed by untrusted user who does not match committer: folkert
GPG key ID: 6B6455EDFEED3BD1
12 changed files with 38 additions and 16 deletions

View file

@ -6,8 +6,8 @@ cmake_minimum_required(VERSION 3.9)
add_compile_options(-Wall -pedantic -Wextra) add_compile_options(-Wall -pedantic -Wextra)
#add_compile_options(-fsanitize=address) #add_compile_options(-fsanitize=undefined)
#add_link_options(-fsanitize=address) #add_link_options(-fsanitize=undefined)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True) set(CMAKE_CXX_STANDARD_REQUIRED True)

View file

@ -72,7 +72,6 @@ void console_esp32::panel_update_thread()
pixels.begin(); pixels.begin();
pixels.clear(); pixels.clear();
pixels.show(); pixels.show();
constexpr uint8_t brightness = 16; constexpr uint8_t brightness = 16;
@ -103,7 +102,7 @@ void console_esp32::panel_update_thread()
pixels.clear(); pixels.clear();
pixels.show(); pixels.show();
for(;;) { while(!stop_panel) {
vTaskDelay(20 / portTICK_PERIOD_MS); vTaskDelay(20 / portTICK_PERIOD_MS);
try { try {
@ -141,5 +140,10 @@ void console_esp32::panel_update_thread()
put_string_lf("Unknown exception in panel thread"); put_string_lf("Unknown exception in panel thread");
} }
} }
pixels.clear();
pixels.show();
Serial.println(F("panel task terminating"));
#endif #endif
} }

View file

@ -78,6 +78,8 @@ void console_thread_wrapper_panel(void *const c)
console *const cnsl = reinterpret_cast<console *>(c); console *const cnsl = reinterpret_cast<console *>(c);
cnsl->panel_update_thread(); cnsl->panel_update_thread();
vTaskSuspend(nullptr);
} }
uint32_t load_serial_speed_configuration() uint32_t load_serial_speed_configuration()

View file

@ -101,12 +101,12 @@ std::pair<breakpoint_register *, std::optional<std::string> > breakpoint_registe
else if (key == "PC" || key == "pc") { else if (key == "PC" || key == "pc") {
return { new breakpoint_register(b, 7, values), { } }; return { new breakpoint_register(b, 7, values), { } };
} }
else if (key.substr(0, 3) == "MMR" or key.substr(0, 3) == "mmr") { else if (key.substr(0, 3) == "MMR" || key.substr(0, 3) == "mmr") {
int which = key[3] - '0'; int which = key[3] - '0';
return { new breakpoint_register(b, hr_mmr0 + which, values), { } }; return { new breakpoint_register(b, hr_mmr0 + which, values), { } };
} }
else if (key.substr(0, 3) == "PSW" or key.substr(0, 3) == "psw") { else if (key.substr(0, 3) == "PSW" || key.substr(0, 3) == "psw") {
return { new breakpoint_register(b, hr_psw, values), { } }; return { new breakpoint_register(b, hr_psw, values), { } };
} }

View file

@ -30,6 +30,7 @@ private:
protected: protected:
std::atomic_uint32_t *const stop_event { nullptr }; std::atomic_uint32_t *const stop_event { nullptr };
std::atomic_bool stop_panel { false };
bus *b { nullptr }; bus *b { nullptr };
#if !defined(BUILD_FOR_RP2040) #if !defined(BUILD_FOR_RP2040)
@ -88,5 +89,6 @@ public:
std::atomic_bool * get_disk_read_activity_flag() { return &disk_read_activity_flag; } std::atomic_bool * get_disk_read_activity_flag() { return &disk_read_activity_flag; }
std::atomic_bool * get_disk_write_activity_flag() { return &disk_write_activity_flag; } std::atomic_bool * get_disk_write_activity_flag() { return &disk_write_activity_flag; }
void stop_panel_thread() { stop_panel = true; }
virtual void panel_update_thread() = 0; virtual void panel_update_thread() = 0;
}; };

View file

@ -133,7 +133,7 @@ void console_ncurses::panel_update_thread()
constexpr int refresh_rate = 50; constexpr int refresh_rate = 50;
while(*stop_event != EVENT_TERMINATE) { while(*stop_event != EVENT_TERMINATE && stop_panel == false) {
myusleep(1000000 / refresh_rate); myusleep(1000000 / refresh_rate);
// note that these are approximately as there's no mutex on the emulation // note that these are approximately as there's no mutex on the emulation

View file

@ -942,7 +942,10 @@ void debugger(console *const cnsl, bus *const b, std::atomic_uint32_t *const sto
} }
#endif #endif
else if (parts[0] == "setsl" && parts.size() == 3) { else if (parts[0] == "setsl" && parts.size() == 3) {
setloghost(parts.at(1).c_str(), parse_ll(parts[2])); if (setloghost(parts.at(1).c_str(), parse_ll(parts[2])) == false)
cnsl->put_string_lf("Failed parsing IP address");
else
send_syslog(info, "Hello, world!");
continue; continue;
} }
@ -951,6 +954,11 @@ void debugger(console *const cnsl, bus *const b, std::atomic_uint32_t *const sto
continue; continue;
} }
else if (cmd == "dp") {
cnsl->stop_panel_thread();
continue;
}
else if (cmd == "bt") { else if (cmd == "bt") {
if (c->get_debug() == false) if (c->get_debug() == false)
cnsl->put_string_lf("Debug mode is disabled!"); cnsl->put_string_lf("Debug mode is disabled!");
@ -1006,6 +1014,7 @@ void debugger(console *const cnsl, bus *const b, std::atomic_uint32_t *const sto
"ser - serialize state to a file", "ser - serialize state to a file",
// "dser - deserialize state from a file", // "dser - deserialize state from a file",
#endif #endif
"dp - disable panel",
#if defined(ESP32) #if defined(ESP32)
"cfgnet - configure network (e.g. WiFi)", "cfgnet - configure network (e.g. WiFi)",
"startnet - start network", "startnet - start network",

View file

@ -54,9 +54,10 @@ void setlogfile(const char *const lf, const log_level_t ll_file, const log_level
atexit(closelog); atexit(closelog);
} }
void setloghost(const char *const host, const log_level_t ll) bool setloghost(const char *const host, const log_level_t ll)
{ {
inet_aton(host, &syslog_ip_addr.sin_addr); syslog_ip_addr.sin_family = AF_INET;
bool ok = inet_aton(host, &syslog_ip_addr.sin_addr) == 1;
syslog_ip_addr.sin_port = htons(514); syslog_ip_addr.sin_port = htons(514);
is_file = false; is_file = false;
@ -64,6 +65,8 @@ void setloghost(const char *const host, const log_level_t ll)
log_level_file = ll; log_level_file = ll;
l_timestamp = false; l_timestamp = false;
return ok;
} }
void setll(const log_level_t ll_screen, const log_level_t ll_file) void setll(const log_level_t ll_screen, const log_level_t ll_file)

3
log.h
View file

@ -12,9 +12,10 @@ typedef enum { ll_emerg = 0, ll_alert, ll_critical, ll_error, warning, notice, i
log_level_t parse_ll(const std::string & str); log_level_t parse_ll(const std::string & str);
void setlogfile(const char *const lf, const log_level_t ll_file, const log_level_t ll_screen, const bool l_timestamp); void setlogfile(const char *const lf, const log_level_t ll_file, const log_level_t ll_screen, const bool l_timestamp);
void setloghost(const char *const host, const log_level_t ll); bool setloghost(const char *const host, const log_level_t ll);
void setll(const log_level_t ll_screen, const log_level_t ll_file); void setll(const log_level_t ll_screen, const log_level_t ll_file);
void setloguid(const int uid, const int gid); void setloguid(const int uid, const int gid);
void send_syslog(const int ll, const std::string & what);
void closelog(); void closelog();
void dolog(const log_level_t ll, const char *fmt, ...); void dolog(const log_level_t ll, const char *fmt, ...);

View file

@ -9,6 +9,7 @@
mmu::mmu() mmu::mmu()
{ {
reset();
} }
mmu::~mmu() mmu::~mmu()

View file

@ -365,7 +365,7 @@ void rl02::writeWord(const uint16_t addr, uint16_t v)
*disk_read_activity = false; *disk_read_activity = false;
} }
else { else {
DOLOG(warning, false, "RL02: command %d not implemented", command); DOLOG(debug, false, "RL02: command %d not implemented", command);
} }
if (do_int) { if (do_int) {