dsp32 devcb2 (nw)

This commit is contained in:
Miodrag Milanovic 2014-03-23 12:32:30 +00:00
parent a063ecccd6
commit eaeb87a280
6 changed files with 31 additions and 71 deletions

View File

@ -174,33 +174,21 @@ dsp32c_device::dsp32c_device(const machine_config &mconfig, const char *tag, dev
m_lastpins(0), m_lastpins(0),
m_ppc(0), m_ppc(0),
m_program(NULL), m_program(NULL),
m_direct(NULL) m_direct(NULL),
m_output_pins_changed(*this)
{ {
m_output_pins_changed = NULL;
// set our instruction counter // set our instruction counter
m_icountptr = &m_icount; 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 // device_start - start up the device
//------------------------------------------------- //-------------------------------------------------
void dsp32c_device::device_start() void dsp32c_device::device_start()
{ {
m_output_pins_changed.resolve_safe();
// get our address spaces // get our address spaces
m_program = &space(AS_PROGRAM); m_program = &space(AS_PROGRAM);
m_direct = &m_program->direct(); m_direct = &m_program->direct();
@ -297,8 +285,7 @@ void dsp32c_device::device_reset()
m_emr = 0xffff; m_emr = 0xffff;
// clear the output pins // clear the output pins
if (m_output_pins_changed != NULL) m_output_pins_changed(0);
(*m_output_pins_changed)(*this, 0);
// initialize fixed registers // initialize fixed registers
R0 = R0_ALT = 0; R0 = R0_ALT = 0;
@ -540,21 +527,18 @@ void dsp32c_device::update_pins(void)
{ {
if (m_pcr & PCR_ENI) 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; m_lastpins = newoutput;
m_output_pins_changed(newoutput);
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);
}
} }
} }
} }

View File

@ -95,29 +95,19 @@ enum
// TYPE DEFINITIONS // TYPE DEFINITIONS
//************************************************************************** //**************************************************************************
class dsp32c_device; #define MCFG_DSP32C_OUTPUT_CALLBACK(_write) \
devcb = &dsp32c_device::set_output_pins_callback(*device, DEVCB2_##_write);
// ======================> dsp32_config
struct dsp32_config
{
void (*m_output_pins_changed)(dsp32c_device &device, UINT32 pins); // a change has occurred on an output pin
};
// ======================> dsp32c_device // ======================> dsp32c_device
class dsp32c_device : public cpu_device, class dsp32c_device : public cpu_device
public dsp32_config
{ {
public: public:
// construction/destruction // construction/destruction
dsp32c_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); dsp32c_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
// inline configuration helpers 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); }
static void static_set_config(device_t &device, const dsp32_config &config);
// public interfaces // public interfaces
void pio_w(int reg, int data); void pio_w(int reg, int data);
@ -443,6 +433,7 @@ protected:
address_space * m_program; address_space * m_program;
direct_read_data *m_direct; direct_read_data *m_direct;
devcb2_write32 m_output_pins_changed;
// tables // tables
static void (dsp32c_device::*const s_dsp32ops[])(UINT32 op); static void (dsp32c_device::*const s_dsp32ops[])(UINT32 op);
static const UINT32 s_regmap[4][16]; static const UINT32 s_regmap[4][16];

View File

@ -393,12 +393,6 @@ static const tms34010_config msp_config =
hdmsp_irq_gen /* generate interrupt */ 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 * Driver board memory maps
@ -1460,7 +1454,7 @@ static MACHINE_CONFIG_FRAGMENT( dsk )
/* basic machine hardware */ /* basic machine hardware */
MCFG_CPU_ADD("dsp32", DSP32C, XTAL_40MHz) 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_CPU_PROGRAM_MAP(dsk_dsp32_map)
MCFG_EEPROM_2816_ADD("dsk_10c") // MK48Z02 MCFG_EEPROM_2816_ADD("dsk_10c") // MK48Z02
@ -1476,7 +1470,7 @@ static MACHINE_CONFIG_FRAGMENT( dsk2 )
/* basic machine hardware */ /* basic machine hardware */
MCFG_CPU_ADD("dsp32", DSP32C, XTAL_40MHz) 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) MCFG_CPU_PROGRAM_MAP(dsk2_dsp32_map)
/* ASIC65 */ /* ASIC65 */

View File

@ -706,12 +706,6 @@ static const tms34010_config gsp_config =
tms_interrupt, /* generate interrupt */ tms_interrupt, /* generate interrupt */
}; };
static const dsp32_config dsp32c_config =
{
NULL /* a change has occurred on an output pin */
};
/************************************* /*************************************
* *
* Machine driver * Machine driver
@ -733,11 +727,9 @@ static MACHINE_CONFIG_START( metalmx, metalmx_state )
MCFG_CPU_PROGRAM_MAP(gsp_map) MCFG_CPU_PROGRAM_MAP(gsp_map)
MCFG_CPU_ADD("dsp32c_1", DSP32C, 40000000) /* Unverified */ MCFG_CPU_ADD("dsp32c_1", DSP32C, 40000000) /* Unverified */
MCFG_CPU_CONFIG(dsp32c_config)
MCFG_CPU_PROGRAM_MAP(dsp32c_1_map) MCFG_CPU_PROGRAM_MAP(dsp32c_1_map)
MCFG_CPU_ADD("dsp32c_2", DSP32C, 40000000) /* Unverified */ MCFG_CPU_ADD("dsp32c_2", DSP32C, 40000000) /* Unverified */
MCFG_CPU_CONFIG(dsp32c_config)
MCFG_CPU_PROGRAM_MAP(dsp32c_2_map) MCFG_CPU_PROGRAM_MAP(dsp32c_2_map)

View File

@ -433,6 +433,9 @@ public:
DECLARE_WRITE16_MEMBER( hdgsp_paletteram_lo_w ); DECLARE_WRITE16_MEMBER( hdgsp_paletteram_lo_w );
DECLARE_READ16_MEMBER( hdgsp_paletteram_hi_r ); DECLARE_READ16_MEMBER( hdgsp_paletteram_hi_r );
DECLARE_WRITE16_MEMBER( hdgsp_paletteram_hi_w ); 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); void hdds3xdsp_serial_tx_callback(adsp21xx_device &device, int port, INT32 data);
INT32 hdds3xdsp_serial_rx_callback(adsp21xx_device &device, int port); 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 -----------*/ /*----------- defined in video/harddriv.c -----------*/

View File

@ -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>(); m_sound_int_state = ((data & DSP32_OUTPUT_PIF) != 0);
atarigen->m_sound_int_state = ((pins & DSP32_OUTPUT_PIF) != 0); update_interrupts();
atarigen->update_interrupts();
} }