mirror of
https://github.com/holub/mame
synced 2025-06-06 04:43:45 +03:00
h8_dma: Enable DEND interrupts
* h83002: Clean up TEND configuration * h8s2320: Enable DREQ inputs and add TEND outputs
This commit is contained in:
parent
76918a4a18
commit
2c749b00c4
@ -28,8 +28,7 @@ h83002_device::h83002_device(const machine_config &mconfig, const char *tag, dev
|
||||
sci0(*this, "sci0"),
|
||||
sci1(*this, "sci1"),
|
||||
watchdog(*this, "watchdog"),
|
||||
tend0_cb(*this),
|
||||
tend1_cb(*this)
|
||||
tend_cb(*this)
|
||||
{
|
||||
syscr = 0;
|
||||
}
|
||||
@ -170,11 +169,11 @@ void h83002_device::device_add_mconfig(machine_config &config)
|
||||
|
||||
void h83002_device::execute_set_input(int inputnum, int state)
|
||||
{
|
||||
if(inputnum == H8_INPUT_LINE_TEND0 && !tend0_cb.isnull())
|
||||
tend0_cb(state);
|
||||
else if(inputnum == H8_INPUT_LINE_TEND1 && !tend1_cb.isnull())
|
||||
tend1_cb(state);
|
||||
else if(inputnum >= H8_INPUT_LINE_DREQ0 && inputnum <= H8_INPUT_LINE_DREQ3)
|
||||
if(inputnum == H8_INPUT_LINE_TEND0 || inputnum == H8_INPUT_LINE_TEND1) {
|
||||
if(!tend_cb[inputnum - H8_INPUT_LINE_TEND0].isnull())
|
||||
tend_cb[inputnum - H8_INPUT_LINE_TEND0](state);
|
||||
}
|
||||
else if(inputnum == H8_INPUT_LINE_DREQ0 || inputnum == H8_INPUT_LINE_DREQ1)
|
||||
dma->set_input(inputnum, state);
|
||||
else
|
||||
intc->set_input(inputnum, state);
|
||||
@ -244,8 +243,7 @@ void h83002_device::device_start()
|
||||
h8h_device::device_start();
|
||||
dma_device = dma;
|
||||
|
||||
tend0_cb.resolve();
|
||||
tend1_cb.resolve();
|
||||
tend_cb.resolve_all();
|
||||
}
|
||||
|
||||
void h83002_device::device_reset()
|
||||
|
@ -29,8 +29,8 @@ class h83002_device : public h8h_device {
|
||||
public:
|
||||
h83002_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
auto tend0() { return tend0_cb.bind(); }
|
||||
auto tend1() { return tend1_cb.bind(); }
|
||||
auto tend0() { return tend_cb[0].bind(); }
|
||||
auto tend1() { return tend_cb[1].bind(); }
|
||||
|
||||
void set_mode_a20() { mode_a20 = true; }
|
||||
void set_mode_a24() { mode_a20 = false; }
|
||||
@ -67,7 +67,7 @@ protected:
|
||||
uint8_t syscr;
|
||||
uint8_t rtmcsr;
|
||||
|
||||
devcb_write_line tend0_cb, tend1_cb;
|
||||
devcb_write_line::array<2> tend_cb;
|
||||
|
||||
virtual void update_irq_filter() override;
|
||||
virtual void interrupt_taken() override;
|
||||
|
@ -121,13 +121,13 @@ void h8_dma_device::dmabcr_w(offs_t offset, uint16_t data, uint16_t mem_mask)
|
||||
h8_dma_channel_device::h8_dma_channel_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
|
||||
device_t(mconfig, H8_DMA_CHANNEL, tag, owner, clock),
|
||||
dmac(*this, "^"),
|
||||
cpu(*this, "^^")
|
||||
cpu(*this, "^^"),
|
||||
intc(*this, finder_base::DUMMY_TAG)
|
||||
{
|
||||
}
|
||||
|
||||
void h8_dma_channel_device::set_info(const char *_intc, int _irq_base, int v0, int v1, int v2, int v3, int v4, int v5, int v6, int v7, int v8, int v9, int va, int vb, int vc, int vd, int ve, int vf)
|
||||
void h8_dma_channel_device::set_info(int _irq_base, int v0, int v1, int v2, int v3, int v4, int v5, int v6, int v7, int v8, int v9, int va, int vb, int vc, int vd, int ve, int vf)
|
||||
{
|
||||
intc_tag = _intc;
|
||||
irq_base = _irq_base;
|
||||
activation_vectors[ 0] = v0;
|
||||
activation_vectors[ 1] = v1;
|
||||
@ -538,7 +538,7 @@ void h8_dma_channel_device::count_done(int submodule)
|
||||
dmac->clear_dte(state[0].id);
|
||||
dtcr[0] &= ~0x80; // clear DTE (for H8H)
|
||||
if(dtie & 1)
|
||||
throw emu_fatalerror("%s: DMA end-of-transfer interrupt in full address/normal mode unimplemented.\n", tag());
|
||||
intc->internal_interrupt(irq_base + submodule);
|
||||
}
|
||||
} else {
|
||||
uint8_t cr = submodule ? dmacr & 0x00ff : dmacr >> 8;
|
||||
@ -554,7 +554,7 @@ void h8_dma_channel_device::count_done(int submodule)
|
||||
dmac->clear_dte(state[0].id + submodule);
|
||||
dtcr[submodule] &= ~0x80; // clear DTE (for H8H)
|
||||
if(dtie & (1 << submodule))
|
||||
throw emu_fatalerror("%s: DMA end-of-transfer interrupt in short address mode unimplemented.\n", tag());
|
||||
intc->internal_interrupt(irq_base + submodule);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -89,8 +89,8 @@ public:
|
||||
};
|
||||
|
||||
h8_dma_channel_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
h8_dma_channel_device(const machine_config &mconfig, const char *tag, device_t *owner,
|
||||
const char *intc, int irq_base, int v0, int v1, int v2, int v3, int v4, int v5, int v6, int v7, int v8,
|
||||
template <typename T> h8_dma_channel_device(const machine_config &mconfig, const char *tag, device_t *owner,
|
||||
T &&intc_tag, int irq_base, int v0, int v1, int v2, int v3, int v4, int v5, int v6, int v7, int v8,
|
||||
int v9 = h8_dma_channel_device::NONE,
|
||||
int va = h8_dma_channel_device::NONE,
|
||||
int vb = h8_dma_channel_device::NONE,
|
||||
@ -100,9 +100,10 @@ public:
|
||||
int vf = h8_dma_channel_device::NONE)
|
||||
: h8_dma_channel_device(mconfig, tag, owner, 0)
|
||||
{
|
||||
set_info(intc, irq_base, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, va, vb, vc, vd, ve, vf);
|
||||
intc.set_tag(std::forward<T>(intc_tag));
|
||||
set_info(irq_base, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, va, vb, vc, vd, ve, vf);
|
||||
}
|
||||
void set_info(const char *intc, int irq_base, int v0, int v1, int v2, int v3, int v4, int v5, int v6, int v7, int v8, int v9, int va, int vb, int vc, int vd, int ve, int vf);
|
||||
void set_info(int irq_base, int v0, int v1, int v2, int v3, int v4, int v5, int v6, int v7, int v8, int v9, int va, int vb, int vc, int vd, int ve, int vf);
|
||||
|
||||
uint16_t marah_r();
|
||||
void marah_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
|
||||
@ -141,8 +142,7 @@ public:
|
||||
protected:
|
||||
required_device<h8_dma_device> dmac;
|
||||
required_device<h8_device> cpu;
|
||||
h8_intc_device *intc;
|
||||
const char *intc_tag;
|
||||
required_device<h8_intc_device> intc;
|
||||
h8_dma_state state[2];
|
||||
int irq_base;
|
||||
|
||||
|
@ -48,6 +48,7 @@ h8s2320_device::h8s2320_device(const machine_config &mconfig, device_type type,
|
||||
sci1(*this, "sci1"),
|
||||
sci2(*this, "sci2"),
|
||||
watchdog(*this, "watchdog"),
|
||||
tend_cb(*this),
|
||||
ram_start(start),
|
||||
syscr(0)
|
||||
{
|
||||
@ -350,6 +351,13 @@ void h8s2320_device::device_add_mconfig(machine_config &config)
|
||||
|
||||
void h8s2320_device::execute_set_input(int inputnum, int state)
|
||||
{
|
||||
if(inputnum == H8_INPUT_LINE_TEND0 || inputnum == H8_INPUT_LINE_TEND1) {
|
||||
if(!tend_cb[inputnum - H8_INPUT_LINE_TEND0].isnull())
|
||||
tend_cb[inputnum - H8_INPUT_LINE_TEND0](state);
|
||||
}
|
||||
else if(inputnum == H8_INPUT_LINE_DREQ0 || inputnum == H8_INPUT_LINE_DREQ1)
|
||||
dma->set_input(inputnum, state);
|
||||
else
|
||||
intc->set_input(inputnum, state);
|
||||
}
|
||||
|
||||
@ -435,6 +443,8 @@ void h8s2320_device::device_start()
|
||||
h8s2000_device::device_start();
|
||||
dma_device = dma;
|
||||
dtc_device = dtc;
|
||||
|
||||
tend_cb.resolve_all();
|
||||
}
|
||||
|
||||
void h8s2320_device::device_reset()
|
||||
|
@ -43,6 +43,9 @@ class h8s2320_device : public h8s2000_device {
|
||||
public:
|
||||
h8s2320_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
auto tend0_cb() { return tend_cb[0].bind(); }
|
||||
auto tend1_cb() { return tend_cb[1].bind(); }
|
||||
|
||||
uint8_t syscr_r();
|
||||
void syscr_w(uint8_t data);
|
||||
|
||||
@ -80,6 +83,8 @@ protected:
|
||||
required_device<h8_sci_device> sci2;
|
||||
required_device<h8_watchdog_device> watchdog;
|
||||
|
||||
devcb_write_line::array<2> tend_cb;
|
||||
|
||||
uint32_t ram_start;
|
||||
uint8_t syscr;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user