lf_csr can be altered from an other thread

This commit is contained in:
folkert van heusden 2023-03-26 13:06:34 +02:00
parent 6729d182a8
commit ce1114a159
Signed by untrusted user who does not match committer: folkert
GPG key ID: 6B6455EDFEED3BD1
2 changed files with 11 additions and 1 deletions

View file

@ -211,6 +211,8 @@ uint16_t bus::read(const uint16_t addr_in, const word_mode_t word_mode, const rm
}
if (a == ADDR_LFC) { // line frequency clock and status register
std::unique_lock<std::mutex> lck(lf_csr_lock);
uint16_t temp = lf_csr;
if (!peek_only) DOLOG(debug, false, "READ-I/O line frequency clock: %o", temp);
return temp;
@ -855,6 +857,8 @@ void bus::write(const uint16_t addr_in, const word_mode_t word_mode, uint16_t va
}
if (a == ADDR_LFC) { // line frequency clock and status register
std::unique_lock<std::mutex> lck(lf_csr_lock);
DOLOG(debug, true, "WRITE-I/O set line frequency clock/status register: %06o", value);
lf_csr = value;
return;
@ -1025,10 +1029,14 @@ void bus::writeUnibusByte(const uint16_t a, const uint8_t v)
void bus::set_lf_crs_b7()
{
std::unique_lock<std::mutex> lck(lf_csr_lock);
lf_csr |= 128;
}
uint8_t bus::get_lf_crs()
{
std::unique_lock<std::mutex> lck(lf_csr_lock);
return lf_csr;
}

2
bus.h
View file

@ -5,6 +5,7 @@
// #define SYSTEM_11_44
#include <assert.h>
#include <mutex>
#include <stdint.h>
#include <stdio.h>
@ -91,6 +92,7 @@ private:
uint16_t MMR0 { 0 }, MMR1 { 0 }, MMR2 { 0 }, MMR3 { 0 }, CPUERR { 0 }, PIR { 0 }, CSR { 0 };
std::mutex lf_csr_lock;
uint16_t lf_csr { 0 };
uint16_t microprogram_break_register { 0 };