summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorGravatarGravatar AJR <ajrhacker@users.noreply.github.com>2018-05-05 09:59:49 -0400
committerGravatarGravatar AJR <ajrhacker@users.noreply.github.com>2018-05-05 09:59:49 -0400
commitadf11afca41f45bbe785f409c610d35f262d5361 (patch)
treee685e506a381c086e9787dcb2a7178f0a443b528
parentadc6c47d9a383edeaaf23d98730361509dd7ff75 (diff)
39in1: Use finder array for DMADAC (nw)
-rw-r--r--src/mame/drivers/39in1.cpp37
1 files changed, 22 insertions, 15 deletions
diff --git a/src/mame/drivers/39in1.cpp b/src/mame/drivers/39in1.cpp
index 5492770ed48..d5a4a6c2fb2 100644
--- a/src/mame/drivers/39in1.cpp
+++ b/src/mame/drivers/39in1.cpp
@@ -35,12 +35,19 @@ class _39in1_state : public driver_device
{
public:
_39in1_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
- m_ram(*this, "ram"),
- m_eeprom(*this, "eeprom"),
- m_maincpu(*this, "maincpu"),
- m_palette(*this, "palette") { }
+ : driver_device(mconfig, type, tag)
+ , m_ram(*this, "ram")
+ , m_dmadac(*this, "dac%u", 1U)
+ , m_eeprom(*this, "eeprom")
+ , m_maincpu(*this, "maincpu")
+ , m_palette(*this, "palette")
+ { }
+ void _60in1(machine_config &config);
+ void _39in1(machine_config &config);
+
+ DECLARE_DRIVER_INIT(39in1);
+private:
uint32_t m_seed;
uint32_t m_magic;
uint32_t m_state;
@@ -54,7 +61,7 @@ public:
PXA255_GPIO_Regs m_gpio_regs;
PXA255_LCD_Regs m_lcd_regs;
- dmadac_sound_device *m_dmadac[2];
+ required_device_array<dmadac_sound_device, 2> m_dmadac;
required_device<eeprom_serial_93cxx_device> m_eeprom;
uint32_t m_pxa255_lcd_palette[0x100];
uint8_t m_pxa255_lcd_framebuffer[0x100000];
@@ -78,7 +85,6 @@ public:
DECLARE_READ32_MEMBER(cpld_r);
DECLARE_WRITE32_MEMBER(cpld_w);
DECLARE_READ32_MEMBER(prot_cheater_r);
- DECLARE_DRIVER_INIT(39in1);
DECLARE_MACHINE_START(60in1);
virtual void machine_start() override;
uint32_t screen_update_39in1(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
@@ -98,8 +104,6 @@ public:
void pxa255_start();
required_device<cpu_device> m_maincpu;
required_device<palette_device> m_palette;
- void _60in1(machine_config &config);
- void _39in1(machine_config &config);
void _39in1_map(address_map &map);
};
@@ -213,8 +217,11 @@ WRITE32_MEMBER(_39in1_state::pxa255_i2s_w)
case PXA255_SADIV:
verboselog(*this, 3, "pxa255_i2s_w: Serial Audio Clock Divider Register: %08x & %08x\n", data, mem_mask );
i2s_regs->sadiv = data & 0x0000007f;
- dmadac_set_frequency(&m_dmadac[0], 2, ((double)147600000 / (double)i2s_regs->sadiv) / 256.0);
- dmadac_enable(&m_dmadac[0], 2, 1);
+ for (auto &dac : m_dmadac)
+ {
+ dac->set_frequency(((double)147600000 / (double)i2s_regs->sadiv) / 256.0);
+ dac->enable(1);
+ }
break;
case PXA255_SADR:
verboselog(*this, 4, "pxa255_i2s_w: Serial Audio Data Register: %08x & %08x\n", data, mem_mask );
@@ -326,7 +333,10 @@ TIMER_CALLBACK_MEMBER(_39in1_state::pxa255_dma_dma_end)
m_samples[(index >> 1) + 1] = (int16_t)(m_words[index >> 2] & 0xffff);
sadr += 4;
}
- dmadac_transfer(&m_dmadac[0], 2, 2, 2, count/4, m_samples);
+ for (auto &dac : m_dmadac)
+ dac->flush();
+ m_dmadac[0]->transfer(0, 2, 2, count/4, m_samples);
+ m_dmadac[1]->transfer(1, 2, 2, count/4, m_samples);
break;
default:
for(index = 0; index < count;)
@@ -1445,9 +1455,6 @@ READ32_MEMBER(_39in1_state::prot_cheater_r)
DRIVER_INIT_MEMBER(_39in1_state,39in1)
{
- m_dmadac[0] = machine().device<dmadac_sound_device>("dac1");
- m_dmadac[1] = machine().device<dmadac_sound_device>("dac2");
-
address_space &space = m_maincpu->space(AS_PROGRAM);
space.install_read_handler (0xa0151648, 0xa015164b, read32_delegate(FUNC(_39in1_state::prot_cheater_r), this));
}