1
0
mirror of https://github.com/livingcomputermuseum/UniBone.git synced 2026-05-02 14:21:21 +00:00

Big summer rework:

Interrupt and DMA system now handles multiple levels and multiple devices in parallel
Interrupt Register changes synced with INTR transaction
DL11 and KW11 clock pass the ZDLDI0 diagnostic.
Devices can now be enabled and disabled individually.
This commit is contained in:
Joerg Hoppe
2019-08-02 16:45:54 +02:00
parent 471df2d8ea
commit 974aeed8eb
89 changed files with 4350 additions and 3085 deletions

View File

@@ -36,6 +36,11 @@
#include "unibusdevice.hpp" // definition of class device_c
#include "cpu.hpp"
/* Adapter procs to Angelos CPU are not members of cpu_c calss
and need one global reference.
*/
static cpu_c *the_cpu = NULL;
cpu_c::cpu_c() :
unibusdevice_c() // super class constructor
{
@@ -46,6 +51,9 @@ cpu_c::cpu_c() :
default_base_addr = 0; // none
default_intr_vector = 0;
default_intr_level = 0;
priority_slot.value = 1 ;
dma_request.set_priority_slot(priority_slot.value);
// init parameters
runmode.value = false;
@@ -58,10 +66,13 @@ cpu_c::cpu_c() :
memset(&bus, 0, sizeof(bus));
memset(&ka11, 0, sizeof(ka11));
ka11.bus = &bus;
assert(the_cpu == NULL); // only one possible
the_cpu = this; // Singleton
}
cpu_c::~cpu_c() {
the_cpu = NULL;
}
bool cpu_c::on_param_changed(parameter_c *param) {
@@ -71,7 +82,7 @@ bool cpu_c::on_param_changed(parameter_c *param) {
runmode.value = false;
init.value = false;
}
}
}
return device_c::on_param_changed(param); // more actions (for enable)
}
@@ -79,34 +90,31 @@ extern "C" {
// functions to be used by Angelos CPU emulator
// Result: 1 = OK, 0 = bus timeout
int cpu_dato(unsigned addr, unsigned data) {
bool timeout;
mailbox->dma.words[0] = data;
timeout = !unibus->dma(unibus_c::ARBITRATION_MODE_MASTER, UNIBUS_CONTROL_DATO, addr, 1);
return !timeout;
uint16_t wordbuffer = (uint16_t) data;
unibusadapter->DMA(the_cpu->dma_request, true, UNIBUS_CONTROL_DATO, addr, &wordbuffer, 1);
return the_cpu->dma_request.success;
}
int cpu_datob(unsigned addr, unsigned data) {
uint16_t wordbuffer = (uint16_t) data;
// TODO DATOB als 1 byte-DMA !
bool timeout;
mailbox->dma.words[0] = data;
timeout = !unibus->dma(unibus_c::ARBITRATION_MODE_MASTER, UNIBUS_CONTROL_DATOB, addr, 1);
return !timeout;
unibusadapter->DMA(the_cpu->dma_request, true, UNIBUS_CONTROL_DATOB, addr, &wordbuffer, 1);
return the_cpu->dma_request.success;
}
int cpu_dati(unsigned addr, unsigned *data) {
bool timeout;
timeout = !unibus->dma(unibus_c::ARBITRATION_MODE_MASTER, UNIBUS_CONTROL_DATI, addr, 1);
*data = mailbox->dma.words[0];
uint16_t wordbuffer;
unibusadapter->DMA(the_cpu->dma_request, true, UNIBUS_CONTROL_DATI, addr, &wordbuffer, 1);
*data = wordbuffer;
// printf("DATI; ba=%o, data=%o\n", addr, *data) ;
return !timeout;
return the_cpu->dma_request.success;
}
}
// background worker.
void cpu_c::worker(unsigned instance) {
UNUSED(instance) ; // only one
UNUSED(instance); // only one
timeout_c timeout;
bool nxm;
unsigned pc = 0;