i need to start caring about carry >.<
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
#include <broadway/mmio/ai.hpp>
|
||||
#include <mem.hpp>
|
||||
#include <ircolib/log.hpp>
|
||||
|
||||
namespace weee::core {
|
||||
ai::ai(mem &mem) {
|
||||
mem.register_read32_handler(0x0c006c00, 0x0c006c1f, [&](ircolib::u32 addr) { return read32(addr); });
|
||||
mem.register_write32_handler(0x0c006c00, 0x0c006c1f,
|
||||
[&](ircolib::u32 addr, ircolib::u32 value) { return write32(addr, value); });
|
||||
}
|
||||
|
||||
ircolib::u32 ai::read32(ircolib::u32 addr) {
|
||||
switch (addr) {
|
||||
case 0:
|
||||
return ctrl.raw;
|
||||
default:
|
||||
ircolib::panic("ai::read32 from unimplemented addr 0x{:08X}", addr);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void ai::write32(ircolib::u32 addr, ircolib::u32 value) {
|
||||
switch (addr) {
|
||||
case 0:
|
||||
ctrl.raw = value;
|
||||
break;
|
||||
default:
|
||||
ircolib::panic("ai::write32 to unimplemented addr 0x{:08X} with value 0x{:08X}", addr, value);
|
||||
}
|
||||
}
|
||||
} // namespace weee::core
|
||||
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
#include <ircolib/types.hpp>
|
||||
|
||||
namespace weee::core {
|
||||
struct mem;
|
||||
struct ai {
|
||||
ai(mem &);
|
||||
|
||||
ircolib::u32 read32(ircolib::u32);
|
||||
void write32(ircolib::u32, ircolib::u32);
|
||||
|
||||
union {
|
||||
struct {
|
||||
unsigned pstat : 1;
|
||||
unsigned afr : 1;
|
||||
unsigned aiintmsk : 1;
|
||||
unsigned aiint : 1;
|
||||
unsigned aiintvld : 1;
|
||||
unsigned screset : 1;
|
||||
unsigned dsp_sr : 1;
|
||||
unsigned : 25;
|
||||
};
|
||||
ircolib::u32 raw;
|
||||
} ctrl;
|
||||
};
|
||||
} // namespace weee::core
|
||||
@@ -0,0 +1,31 @@
|
||||
#include <broadway/mmio/dsp.hpp>
|
||||
#include <mem.hpp>
|
||||
#include <ircolib/log.hpp>
|
||||
|
||||
namespace weee::core {
|
||||
dsp::dsp(mem &mem) {
|
||||
mem.register_read16_handler(0x0c005000, 0x0c0051ff, [&](ircolib::u32 addr) { return read16(addr); });
|
||||
mem.register_write16_handler(0x0c005000, 0x0c0051ff,
|
||||
[&](ircolib::u32 addr, ircolib::u16 value) { return write16(addr, value); });
|
||||
}
|
||||
|
||||
ircolib::u16 dsp::read16(ircolib::u32 addr) {
|
||||
switch (addr) {
|
||||
case 0x0a:
|
||||
return csr.raw;
|
||||
default:
|
||||
ircolib::panic("dsp::read16 from unimplemented addr 0x{:08X}", addr);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void dsp::write16(ircolib::u32 addr, ircolib::u16 value) {
|
||||
switch (addr) {
|
||||
case 0x0a:
|
||||
csr.raw = value;
|
||||
break;
|
||||
default:
|
||||
ircolib::panic("dsp::read16 from unimplemented addr 0x{:08X}", addr);
|
||||
}
|
||||
}
|
||||
} // namespace weee::core
|
||||
@@ -0,0 +1,30 @@
|
||||
#pragma once
|
||||
#include <ircolib/types.hpp>
|
||||
|
||||
namespace weee::core {
|
||||
struct mem;
|
||||
struct dsp {
|
||||
dsp(mem &);
|
||||
ircolib::u16 read16(ircolib::u32);
|
||||
void write16(ircolib::u32, ircolib::u16);
|
||||
|
||||
union {
|
||||
struct {
|
||||
unsigned res : 1;
|
||||
unsigned piint : 1;
|
||||
unsigned halt : 1;
|
||||
unsigned aidint : 1;
|
||||
unsigned aidint_mask : 1;
|
||||
unsigned arint : 1;
|
||||
unsigned arint_mask : 1;
|
||||
unsigned dspint : 1;
|
||||
unsigned dspint_mask : 1;
|
||||
unsigned int_status : 1;
|
||||
unsigned : 1;
|
||||
unsigned res2 : 1;
|
||||
unsigned : 4;
|
||||
};
|
||||
ircolib::u16 raw;
|
||||
} csr;
|
||||
};
|
||||
} // namespace weee::core
|
||||
@@ -0,0 +1,41 @@
|
||||
#include <broadway/mmio/exi.hpp>
|
||||
#include <mem.hpp>
|
||||
#include <ircolib/log.hpp>
|
||||
|
||||
namespace weee::core {
|
||||
exi::exi(mem &mem) {
|
||||
mem.register_read32_handler(0x0c006800, 0x0c00683f, [&](ircolib::u32 addr) { return read32(addr); });
|
||||
mem.register_write32_handler(0x0c006800, 0x0c00683f,
|
||||
[&](ircolib::u32 addr, ircolib::u32 value) { return write32(addr, value); });
|
||||
}
|
||||
|
||||
ircolib::u32 exi::read32(ircolib::u32 addr) {
|
||||
switch (addr) {
|
||||
case 0:
|
||||
return param0.raw;
|
||||
case 0x14:
|
||||
return param1.raw;
|
||||
case 0x28:
|
||||
return param2.raw;
|
||||
default:
|
||||
ircolib::panic("exi::read32 from unimplemented addr 0x{:08X}", addr);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void exi::write32(ircolib::u32 addr, ircolib::u32 value) {
|
||||
switch (addr) {
|
||||
case 0:
|
||||
param0.raw = value;
|
||||
break;
|
||||
case 0x14:
|
||||
param1.raw = value;
|
||||
break;
|
||||
case 0x28:
|
||||
param2.raw = value;
|
||||
break;
|
||||
default:
|
||||
ircolib::panic("exi::write32 to unimplemented addr 0x{:08X} with value 0x{:08X}", addr, value);
|
||||
}
|
||||
}
|
||||
} // namespace weee::core
|
||||
@@ -0,0 +1,30 @@
|
||||
#pragma once
|
||||
#include <ircolib/types.hpp>
|
||||
|
||||
namespace weee::core {
|
||||
struct mem;
|
||||
struct exi {
|
||||
exi(mem &);
|
||||
|
||||
ircolib::u32 read32(ircolib::u32);
|
||||
void write32(ircolib::u32, ircolib::u32);
|
||||
|
||||
union {
|
||||
struct {
|
||||
unsigned ext_int_mask : 1;
|
||||
unsigned ext_int : 1;
|
||||
unsigned tc_int_mask : 1;
|
||||
unsigned tc_int : 1;
|
||||
unsigned clk : 3;
|
||||
unsigned cs : 3;
|
||||
unsigned ext_int_mask2 : 1;
|
||||
unsigned ext_int2 : 1;
|
||||
unsigned ext : 1;
|
||||
unsigned romdis : 1;
|
||||
unsigned : 18;
|
||||
};
|
||||
|
||||
ircolib::u32 raw;
|
||||
} param0, param1, param2;
|
||||
};
|
||||
} // namespace weee::core
|
||||
@@ -0,0 +1,20 @@
|
||||
#include <mem.hpp>
|
||||
#include <broadway/mmio/mi.hpp>
|
||||
#include <ircolib/log.hpp>
|
||||
|
||||
namespace weee::core {
|
||||
memory_interface::memory_interface(mem &mem) {
|
||||
mem.register_write16_handler(0x0c004000, 0x0c00407f,
|
||||
[&](ircolib::u32 addr, ircolib::u16 value) { write16(addr, value); });
|
||||
}
|
||||
|
||||
void memory_interface::write16(ircolib::u32 addr, ircolib::u16 value) {
|
||||
switch (addr) {
|
||||
case 0x1C:
|
||||
int_mask.raw = value;
|
||||
break;
|
||||
default:
|
||||
ircolib::panic("memory_interface::write16 to unimplemented addr 0x{:08X} with value 0x{:04X}", addr, value);
|
||||
}
|
||||
}
|
||||
} // namespace weee::core
|
||||
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
#include <ircolib/types.hpp>
|
||||
|
||||
namespace weee::core {
|
||||
struct mem;
|
||||
|
||||
struct memory_interface {
|
||||
union {
|
||||
struct {
|
||||
unsigned mem0 : 1;
|
||||
unsigned mem1 : 1;
|
||||
unsigned mem2 : 1;
|
||||
unsigned mem3 : 1;
|
||||
unsigned all : 1;
|
||||
unsigned : 27;
|
||||
};
|
||||
ircolib::u32 raw;
|
||||
} int_mask;
|
||||
|
||||
memory_interface(mem &);
|
||||
void write16(ircolib::u32, ircolib::u16);
|
||||
};
|
||||
} // namespace weee::core
|
||||
@@ -0,0 +1,31 @@
|
||||
#include <mem.hpp>
|
||||
#include <broadway/mmio/pi.hpp>
|
||||
#include <ircolib/log.hpp>
|
||||
|
||||
namespace weee::core {
|
||||
processor_interface::processor_interface(mem &mem) {
|
||||
mem.register_write32_handler(0x0c003000, 0x0c0030ff,
|
||||
[&](ircolib::u32 addr, ircolib::u32 value) { return write32(addr, value); });
|
||||
mem.register_read32_handler(0x0c003000, 0x0c0030ff, [&](ircolib::u32 addr) { return read32(addr); });
|
||||
}
|
||||
|
||||
void processor_interface::write32(ircolib::u32 addr, ircolib::u32 value) {
|
||||
switch (addr) {
|
||||
case 0x04:
|
||||
intmr.raw = value;
|
||||
break;
|
||||
default:
|
||||
ircolib::panic("processor_interface::write32 to unimplemented addr 0x{:08X} with value 0x{:08X}", addr, value);
|
||||
}
|
||||
}
|
||||
|
||||
ircolib::u32 processor_interface::read32(ircolib::u32 addr) {
|
||||
switch (addr) {
|
||||
case 0x2c:
|
||||
return 2;
|
||||
default:
|
||||
ircolib::panic("processor_interface::read32 from unimplemented addr 0x{:08X}", addr);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
} // namespace weee::core
|
||||
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
#include <ircolib/types.hpp>
|
||||
|
||||
namespace weee::core {
|
||||
struct mem;
|
||||
|
||||
struct processor_interface {
|
||||
union {
|
||||
struct {
|
||||
unsigned error : 1;
|
||||
unsigned rsw : 1;
|
||||
unsigned di : 1;
|
||||
unsigned si : 1;
|
||||
unsigned exi : 1;
|
||||
unsigned ai : 1;
|
||||
unsigned dsp : 1;
|
||||
unsigned mem : 1;
|
||||
unsigned vi : 1;
|
||||
unsigned pe_token : 1;
|
||||
unsigned pe_finish : 1;
|
||||
unsigned cp : 1;
|
||||
unsigned debug : 1;
|
||||
unsigned hsp : 1;
|
||||
unsigned : 18;
|
||||
};
|
||||
ircolib::u32 raw;
|
||||
} intmr;
|
||||
|
||||
processor_interface(mem &);
|
||||
void write32(ircolib::u32, ircolib::u32);
|
||||
ircolib::u32 read32(ircolib::u32);
|
||||
};
|
||||
} // namespace weee::core
|
||||
Reference in New Issue
Block a user