mirror of
https://github.com/holub/mame
synced 2025-04-23 00:39:36 +03:00
dsp32 devcb2 (nw)
This commit is contained in:
parent
a063ecccd6
commit
eaeb87a280
@ -174,33 +174,21 @@ dsp32c_device::dsp32c_device(const machine_config &mconfig, const char *tag, dev
|
||||
m_lastpins(0),
|
||||
m_ppc(0),
|
||||
m_program(NULL),
|
||||
m_direct(NULL)
|
||||
m_direct(NULL),
|
||||
m_output_pins_changed(*this)
|
||||
{
|
||||
m_output_pins_changed = NULL;
|
||||
|
||||
// set our instruction counter
|
||||
m_icountptr = &m_icount;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// static_set_config - set the configuration
|
||||
// structure
|
||||
//-------------------------------------------------
|
||||
|
||||
void dsp32c_device::static_set_config(device_t &device, const dsp32_config &config)
|
||||
{
|
||||
dsp32c_device &dsp = downcast<dsp32c_device &>(device);
|
||||
static_cast<dsp32_config &>(dsp) = config;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_start - start up the device
|
||||
//-------------------------------------------------
|
||||
|
||||
void dsp32c_device::device_start()
|
||||
{
|
||||
m_output_pins_changed.resolve_safe();
|
||||
|
||||
// get our address spaces
|
||||
m_program = &space(AS_PROGRAM);
|
||||
m_direct = &m_program->direct();
|
||||
@ -297,8 +285,7 @@ void dsp32c_device::device_reset()
|
||||
m_emr = 0xffff;
|
||||
|
||||
// clear the output pins
|
||||
if (m_output_pins_changed != NULL)
|
||||
(*m_output_pins_changed)(*this, 0);
|
||||
m_output_pins_changed(0);
|
||||
|
||||
// initialize fixed registers
|
||||
R0 = R0_ALT = 0;
|
||||
@ -540,21 +527,18 @@ void dsp32c_device::update_pins(void)
|
||||
{
|
||||
if (m_pcr & PCR_ENI)
|
||||
{
|
||||
if (m_output_pins_changed != NULL)
|
||||
UINT16 newoutput = 0;
|
||||
|
||||
if (m_pcr & PCR_PIFs)
|
||||
newoutput |= DSP32_OUTPUT_PIF;
|
||||
|
||||
if (m_pcr & PCR_PDFs)
|
||||
newoutput |= DSP32_OUTPUT_PDF;
|
||||
|
||||
if (newoutput != m_lastpins)
|
||||
{
|
||||
UINT16 newoutput = 0;
|
||||
|
||||
if (m_pcr & PCR_PIFs)
|
||||
newoutput |= DSP32_OUTPUT_PIF;
|
||||
|
||||
if (m_pcr & PCR_PDFs)
|
||||
newoutput |= DSP32_OUTPUT_PDF;
|
||||
|
||||
if (newoutput != m_lastpins)
|
||||
{
|
||||
m_lastpins = newoutput;
|
||||
(*m_output_pins_changed)(*this, newoutput);
|
||||
}
|
||||
m_lastpins = newoutput;
|
||||
m_output_pins_changed(newoutput);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -95,29 +95,19 @@ enum
|
||||
// TYPE DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
class dsp32c_device;
|
||||
|
||||
|
||||
// ======================> dsp32_config
|
||||
|
||||
struct dsp32_config
|
||||
{
|
||||
void (*m_output_pins_changed)(dsp32c_device &device, UINT32 pins); // a change has occurred on an output pin
|
||||
};
|
||||
|
||||
|
||||
#define MCFG_DSP32C_OUTPUT_CALLBACK(_write) \
|
||||
devcb = &dsp32c_device::set_output_pins_callback(*device, DEVCB2_##_write);
|
||||
|
||||
// ======================> dsp32c_device
|
||||
|
||||
class dsp32c_device : public cpu_device,
|
||||
public dsp32_config
|
||||
class dsp32c_device : public cpu_device
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
dsp32c_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
// inline configuration helpers
|
||||
static void static_set_config(device_t &device, const dsp32_config &config);
|
||||
template<class _Object> static devcb2_base &set_output_pins_callback(device_t &device, _Object object) { return downcast<dsp32c_device &>(device).m_output_pins_changed.set_callback(object); }
|
||||
|
||||
|
||||
// public interfaces
|
||||
void pio_w(int reg, int data);
|
||||
@ -443,6 +433,7 @@ protected:
|
||||
address_space * m_program;
|
||||
direct_read_data *m_direct;
|
||||
|
||||
devcb2_write32 m_output_pins_changed;
|
||||
// tables
|
||||
static void (dsp32c_device::*const s_dsp32ops[])(UINT32 op);
|
||||
static const UINT32 s_regmap[4][16];
|
||||
|
@ -393,12 +393,6 @@ static const tms34010_config msp_config =
|
||||
hdmsp_irq_gen /* generate interrupt */
|
||||
};
|
||||
|
||||
|
||||
static const dsp32_config dsp32c_config =
|
||||
{
|
||||
hddsk_update_pif /* a change has occurred on an output pin */
|
||||
};
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Driver board memory maps
|
||||
@ -1460,7 +1454,7 @@ static MACHINE_CONFIG_FRAGMENT( dsk )
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("dsp32", DSP32C, XTAL_40MHz)
|
||||
MCFG_DSP32C_CONFIG(dsp32c_config)
|
||||
MCFG_DSP32C_OUTPUT_CALLBACK(WRITE32(harddriv_state,hddsk_update_pif))
|
||||
MCFG_CPU_PROGRAM_MAP(dsk_dsp32_map)
|
||||
|
||||
MCFG_EEPROM_2816_ADD("dsk_10c") // MK48Z02
|
||||
@ -1476,7 +1470,7 @@ static MACHINE_CONFIG_FRAGMENT( dsk2 )
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("dsp32", DSP32C, XTAL_40MHz)
|
||||
MCFG_DSP32C_CONFIG(dsp32c_config)
|
||||
MCFG_DSP32C_OUTPUT_CALLBACK(WRITE32(harddriv_state,hddsk_update_pif))
|
||||
MCFG_CPU_PROGRAM_MAP(dsk2_dsp32_map)
|
||||
|
||||
/* ASIC65 */
|
||||
|
@ -706,12 +706,6 @@ static const tms34010_config gsp_config =
|
||||
tms_interrupt, /* generate interrupt */
|
||||
};
|
||||
|
||||
static const dsp32_config dsp32c_config =
|
||||
{
|
||||
NULL /* a change has occurred on an output pin */
|
||||
};
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Machine driver
|
||||
@ -732,12 +726,10 @@ static MACHINE_CONFIG_START( metalmx, metalmx_state )
|
||||
MCFG_CPU_CONFIG(gsp_config)
|
||||
MCFG_CPU_PROGRAM_MAP(gsp_map)
|
||||
|
||||
MCFG_CPU_ADD("dsp32c_1", DSP32C, 40000000) /* Unverified */
|
||||
MCFG_CPU_CONFIG(dsp32c_config)
|
||||
MCFG_CPU_ADD("dsp32c_1", DSP32C, 40000000) /* Unverified */
|
||||
MCFG_CPU_PROGRAM_MAP(dsp32c_1_map)
|
||||
|
||||
MCFG_CPU_ADD("dsp32c_2", DSP32C, 40000000) /* Unverified */
|
||||
MCFG_CPU_CONFIG(dsp32c_config)
|
||||
MCFG_CPU_PROGRAM_MAP(dsp32c_2_map)
|
||||
|
||||
|
||||
|
@ -433,6 +433,9 @@ public:
|
||||
DECLARE_WRITE16_MEMBER( hdgsp_paletteram_lo_w );
|
||||
DECLARE_READ16_MEMBER( hdgsp_paletteram_hi_r );
|
||||
DECLARE_WRITE16_MEMBER( hdgsp_paletteram_hi_w );
|
||||
|
||||
/* DSK board */
|
||||
DECLARE_WRITE32_MEMBER(hddsk_update_pif);
|
||||
};
|
||||
|
||||
|
||||
@ -455,9 +458,6 @@ void hdds3xdsp_timer_enable_callback(adsp21xx_device &device, int enable);
|
||||
void hdds3xdsp_serial_tx_callback(adsp21xx_device &device, int port, INT32 data);
|
||||
INT32 hdds3xdsp_serial_rx_callback(adsp21xx_device &device, int port);
|
||||
|
||||
/* DSK board */
|
||||
void hddsk_update_pif(dsp32c_device &device, UINT32 pins);
|
||||
|
||||
|
||||
/*----------- defined in video/harddriv.c -----------*/
|
||||
|
||||
|
@ -1516,11 +1516,10 @@ WRITE16_MEMBER( harddriv_state::hd68k_ds3_program_w )
|
||||
*
|
||||
*************************************/
|
||||
|
||||
void hddsk_update_pif(dsp32c_device &device, UINT32 pins)
|
||||
WRITE32_MEMBER(harddriv_state::hddsk_update_pif)
|
||||
{
|
||||
atarigen_state *atarigen = device.machine().driver_data<atarigen_state>();
|
||||
atarigen->m_sound_int_state = ((pins & DSP32_OUTPUT_PIF) != 0);
|
||||
atarigen->update_interrupts();
|
||||
m_sound_int_state = ((data & DSP32_OUTPUT_PIF) != 0);
|
||||
update_interrupts();
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user