mirror of
https://github.com/holub/mame
synced 2025-10-06 17:08:28 +03:00
pic8259: updated to use devcb calls
This commit is contained in:
parent
b91b1b8018
commit
a480533230
@ -33,7 +33,7 @@ typedef struct pic8259 pic8259_t;
|
||||
|
||||
struct pic8259
|
||||
{
|
||||
const struct pic8259_interface *intf;
|
||||
devcb_resolved_write_line out_int_func;
|
||||
|
||||
emu_timer *timer;
|
||||
|
||||
@ -103,13 +103,13 @@ static TIMER_CALLBACK( pic8259_timerproc )
|
||||
{
|
||||
if (LOG_GENERAL)
|
||||
logerror("pic8259_timerproc(): PIC triggering IRQ #%d\n", irq);
|
||||
if ( ! ( pic8259->ocw3 & 0x04 ) && pic8259->intf->set_int_line)
|
||||
pic8259->intf->set_int_line(device, 1);
|
||||
if (!BIT(pic8259->ocw3, 2))
|
||||
devcb_call_write_line(&pic8259->out_int_func, 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if ( ! ( pic8259->ocw3 & 0x04 ) && pic8259->intf->set_int_line)
|
||||
pic8259->intf->set_int_line(device, 0);
|
||||
if (!BIT(pic8259->ocw3, 2))
|
||||
devcb_call_write_line(&pic8259->out_int_func, 0);
|
||||
}
|
||||
|
||||
|
||||
@ -398,12 +398,17 @@ WRITE8_DEVICE_HANDLER( pic8259_w )
|
||||
|
||||
|
||||
|
||||
static DEVICE_START( pic8259 ) {
|
||||
static DEVICE_START( pic8259 )
|
||||
{
|
||||
pic8259_t *pic8259 = get_safe_token(device);
|
||||
const struct pic8259_interface *intf = (const struct pic8259_interface *)device->baseconfig().static_config;
|
||||
|
||||
pic8259->intf = (const struct pic8259_interface *)device->baseconfig().static_config;
|
||||
assert(intf != NULL);
|
||||
|
||||
pic8259->timer = timer_alloc( device->machine, pic8259_timerproc, (void *)device );
|
||||
|
||||
/* resolve callbacks */
|
||||
devcb_resolve_write_line(&pic8259->out_int_func, &intf->out_int_func, device);
|
||||
}
|
||||
|
||||
|
||||
|
@ -25,19 +25,18 @@
|
||||
#ifndef __PIC8259_H__
|
||||
#define __PIC8259_H__
|
||||
|
||||
#include "devcb.h"
|
||||
|
||||
#define PIC8259 DEVICE_GET_INFO_NAME(pic8259)
|
||||
|
||||
/***************************************************************************
|
||||
TYPE DEFINITIONS
|
||||
***************************************************************************/
|
||||
|
||||
typedef void (*pic8259_set_int_line_func)(running_device *device, int interrupt);
|
||||
#define PIC8259_SET_INT_LINE(name) void name(running_device *device, int interrupt)
|
||||
|
||||
|
||||
struct pic8259_interface {
|
||||
struct pic8259_interface
|
||||
{
|
||||
/* Called when int line changes */
|
||||
pic8259_set_int_line_func set_int_line;
|
||||
devcb_write_line out_int_func;
|
||||
};
|
||||
|
||||
|
||||
|
@ -573,23 +573,19 @@ static MACHINE_START(calchase)
|
||||
*
|
||||
*************************************************************/
|
||||
|
||||
static PIC8259_SET_INT_LINE( calchase_pic8259_1_set_int_line ) {
|
||||
cputag_set_input_line(device->machine, "maincpu", 0, interrupt ? HOLD_LINE : CLEAR_LINE);
|
||||
static WRITE_LINE_DEVICE_HANDLER( calchase_pic8259_1_set_int_line )
|
||||
{
|
||||
cputag_set_input_line(device->machine, "maincpu", 0, state ? HOLD_LINE : CLEAR_LINE);
|
||||
}
|
||||
|
||||
|
||||
static PIC8259_SET_INT_LINE( calchase_pic8259_2_set_int_line ) {
|
||||
pic8259_ir2_w(calchase_devices.pic8259_1, interrupt);
|
||||
}
|
||||
|
||||
|
||||
static const struct pic8259_interface calchase_pic8259_1_config = {
|
||||
calchase_pic8259_1_set_int_line
|
||||
static const struct pic8259_interface calchase_pic8259_1_config =
|
||||
{
|
||||
DEVCB_LINE(calchase_pic8259_1_set_int_line)
|
||||
};
|
||||
|
||||
|
||||
static const struct pic8259_interface calchase_pic8259_2_config = {
|
||||
calchase_pic8259_2_set_int_line
|
||||
static const struct pic8259_interface calchase_pic8259_2_config =
|
||||
{
|
||||
DEVCB_DEVICE_LINE("pic8259_1", pic8259_ir2_w)
|
||||
};
|
||||
|
||||
|
||||
|
@ -615,25 +615,19 @@ static MACHINE_RESET(gamecstl)
|
||||
*
|
||||
*************************************************************/
|
||||
|
||||
static PIC8259_SET_INT_LINE( gamecstl_pic8259_1_set_int_line )
|
||||
static WRITE_LINE_DEVICE_HANDLER( gamecstl_pic8259_1_set_int_line )
|
||||
{
|
||||
cputag_set_input_line(device->machine, "maincpu", 0, interrupt ? HOLD_LINE : CLEAR_LINE);
|
||||
cputag_set_input_line(device->machine, "maincpu", 0, state ? HOLD_LINE : CLEAR_LINE);
|
||||
}
|
||||
|
||||
|
||||
static PIC8259_SET_INT_LINE( gamecstl_pic8259_2_set_int_line )
|
||||
static const struct pic8259_interface gamecstl_pic8259_1_config =
|
||||
{
|
||||
pic8259_ir2_w(gamecstl_devices.pic8259_1, interrupt);
|
||||
}
|
||||
|
||||
|
||||
static const struct pic8259_interface gamecstl_pic8259_1_config = {
|
||||
gamecstl_pic8259_1_set_int_line
|
||||
DEVCB_LINE(gamecstl_pic8259_1_set_int_line)
|
||||
};
|
||||
|
||||
|
||||
static const struct pic8259_interface gamecstl_pic8259_2_config = {
|
||||
gamecstl_pic8259_2_set_int_line
|
||||
static const struct pic8259_interface gamecstl_pic8259_2_config =
|
||||
{
|
||||
DEVCB_DEVICE_LINE("pic8259_1", pic8259_ir2_w)
|
||||
};
|
||||
|
||||
|
||||
|
@ -992,25 +992,19 @@ static MACHINE_RESET(mediagx)
|
||||
*
|
||||
*************************************************************/
|
||||
|
||||
static PIC8259_SET_INT_LINE( mediagx_pic8259_1_set_int_line )
|
||||
static WRITE_LINE_DEVICE_HANDLER( mediagx_pic8259_1_set_int_line )
|
||||
{
|
||||
cputag_set_input_line(device->machine, "maincpu", 0, interrupt ? HOLD_LINE : CLEAR_LINE);
|
||||
cputag_set_input_line(device->machine, "maincpu", 0, state ? HOLD_LINE : CLEAR_LINE);
|
||||
}
|
||||
|
||||
|
||||
static PIC8259_SET_INT_LINE( mediagx_pic8259_2_set_int_line )
|
||||
static const struct pic8259_interface mediagx_pic8259_1_config =
|
||||
{
|
||||
pic8259_ir2_w(mediagx_devices.pic8259_1, interrupt);
|
||||
}
|
||||
|
||||
|
||||
static const struct pic8259_interface mediagx_pic8259_1_config = {
|
||||
mediagx_pic8259_1_set_int_line
|
||||
DEVCB_LINE(mediagx_pic8259_1_set_int_line)
|
||||
};
|
||||
|
||||
|
||||
static const struct pic8259_interface mediagx_pic8259_2_config = {
|
||||
mediagx_pic8259_2_set_int_line
|
||||
static const struct pic8259_interface mediagx_pic8259_2_config =
|
||||
{
|
||||
DEVCB_DEVICE_LINE("pic8259_1", pic8259_ir2_w)
|
||||
};
|
||||
|
||||
|
||||
|
@ -231,22 +231,19 @@ static I8237_INTERFACE( dma8237_2_config )
|
||||
8259 IRQ controller
|
||||
******************/
|
||||
|
||||
static PIC8259_SET_INT_LINE( pic8259_1_set_int_line )
|
||||
static WRITE_LINE_DEVICE_HANDLER( pic8259_1_set_int_line )
|
||||
{
|
||||
cputag_set_input_line(device->machine, "maincpu", 0, interrupt ? HOLD_LINE : CLEAR_LINE);
|
||||
cputag_set_input_line(device->machine, "maincpu", 0, state ? HOLD_LINE : CLEAR_LINE);
|
||||
}
|
||||
|
||||
static const struct pic8259_interface pic8259_1_config = {
|
||||
pic8259_1_set_int_line
|
||||
static const struct pic8259_interface pic8259_1_config =
|
||||
{
|
||||
DEVCB_LINE(pic8259_1_set_int_line)
|
||||
};
|
||||
|
||||
static PIC8259_SET_INT_LINE( pic8259_2_set_int_line )
|
||||
static const struct pic8259_interface pic8259_2_config =
|
||||
{
|
||||
pic8259_ir2_w(pcat_dyn_devices.pic8259_1, interrupt);
|
||||
}
|
||||
|
||||
static const struct pic8259_interface pic8259_2_config = {
|
||||
pic8259_2_set_int_line
|
||||
DEVCB_DEVICE_LINE("pic8259_1", pic8259_ir2_w)
|
||||
};
|
||||
|
||||
static IRQ_CALLBACK(irq_callback)
|
||||
|
@ -294,22 +294,19 @@ static I8237_INTERFACE( dma8237_2_config )
|
||||
8259 IRQ controller
|
||||
******************/
|
||||
|
||||
static PIC8259_SET_INT_LINE( pic8259_1_set_int_line )
|
||||
static WRITE_LINE_DEVICE_HANDLER( pic8259_1_set_int_line )
|
||||
{
|
||||
cputag_set_input_line(device->machine, "maincpu", 0, interrupt ? HOLD_LINE : CLEAR_LINE);
|
||||
cputag_set_input_line(device->machine, "maincpu", 0, state ? HOLD_LINE : CLEAR_LINE);
|
||||
}
|
||||
|
||||
static const struct pic8259_interface pic8259_1_config = {
|
||||
pic8259_1_set_int_line
|
||||
static const struct pic8259_interface pic8259_1_config =
|
||||
{
|
||||
DEVCB_LINE(pic8259_1_set_int_line)
|
||||
};
|
||||
|
||||
static PIC8259_SET_INT_LINE( pic8259_2_set_int_line )
|
||||
static const struct pic8259_interface pic8259_2_config =
|
||||
{
|
||||
pic8259_ir2_w(streetg2_devices.pic8259_1, interrupt);
|
||||
}
|
||||
|
||||
static const struct pic8259_interface pic8259_2_config = {
|
||||
pic8259_2_set_int_line
|
||||
DEVCB_DEVICE_LINE("pic8259_1", pic8259_ir2_w)
|
||||
};
|
||||
|
||||
static IRQ_CALLBACK(irq_callback)
|
||||
|
@ -644,20 +644,19 @@ static I8237_INTERFACE( dma8237_1_config )
|
||||
8259 IRQ controller
|
||||
******************/
|
||||
|
||||
static PIC8259_SET_INT_LINE( pic8259_1_set_int_line ) {
|
||||
cputag_set_input_line(device->machine, "maincpu", 0, interrupt ? HOLD_LINE : CLEAR_LINE);
|
||||
static WRITE_LINE_DEVICE_HANDLER( pic8259_1_set_int_line )
|
||||
{
|
||||
cputag_set_input_line(device->machine, "maincpu", 0, state ? HOLD_LINE : CLEAR_LINE);
|
||||
}
|
||||
|
||||
static const struct pic8259_interface pic8259_1_config = {
|
||||
pic8259_1_set_int_line
|
||||
static const struct pic8259_interface pic8259_1_config =
|
||||
{
|
||||
DEVCB_LINE(pic8259_1_set_int_line)
|
||||
};
|
||||
|
||||
static PIC8259_SET_INT_LINE( pic8259_2_set_int_line ) {
|
||||
pic8259_ir2_w(filetto_devices.pic8259_1, interrupt);
|
||||
}
|
||||
|
||||
static const struct pic8259_interface pic8259_2_config = {
|
||||
pic8259_2_set_int_line
|
||||
static const struct pic8259_interface pic8259_2_config =
|
||||
{
|
||||
DEVCB_DEVICE_LINE("pic8259_1", pic8259_ir2_w)
|
||||
};
|
||||
|
||||
static IRQ_CALLBACK(irq_callback)
|
||||
|
@ -225,22 +225,19 @@ static I8237_INTERFACE( dma8237_2_config )
|
||||
8259 IRQ controller
|
||||
******************/
|
||||
|
||||
static PIC8259_SET_INT_LINE( pic8259_1_set_int_line )
|
||||
static WRITE_LINE_DEVICE_HANDLER( pic8259_1_set_int_line )
|
||||
{
|
||||
cputag_set_input_line(device->machine, "maincpu", 0, interrupt ? HOLD_LINE : CLEAR_LINE);
|
||||
cputag_set_input_line(device->machine, "maincpu", 0, state ? HOLD_LINE : CLEAR_LINE);
|
||||
}
|
||||
|
||||
static const struct pic8259_interface pic8259_1_config = {
|
||||
pic8259_1_set_int_line
|
||||
static const struct pic8259_interface pic8259_1_config =
|
||||
{
|
||||
DEVCB_LINE(pic8259_1_set_int_line)
|
||||
};
|
||||
|
||||
static PIC8259_SET_INT_LINE( pic8259_2_set_int_line )
|
||||
static const struct pic8259_interface pic8259_2_config =
|
||||
{
|
||||
pic8259_ir2_w(photoply_devices.pic8259_1, interrupt);
|
||||
}
|
||||
|
||||
static const struct pic8259_interface pic8259_2_config = {
|
||||
pic8259_2_set_int_line
|
||||
DEVCB_DEVICE_LINE("pic8259_1", pic8259_ir2_w)
|
||||
};
|
||||
|
||||
static IRQ_CALLBACK(irq_callback)
|
||||
|
@ -105,25 +105,19 @@ ADDRESS_MAP_END
|
||||
*
|
||||
*************************************************************/
|
||||
|
||||
static PIC8259_SET_INT_LINE( quakeat_pic8259_1_set_int_line )
|
||||
static WRITE_LINE_DEVICE_HANDLER( quakeat_pic8259_1_set_int_line )
|
||||
{
|
||||
cputag_set_input_line(device->machine, "maincpu", 0, interrupt ? HOLD_LINE : CLEAR_LINE);
|
||||
cputag_set_input_line(device->machine, "maincpu", 0, state ? HOLD_LINE : CLEAR_LINE);
|
||||
}
|
||||
|
||||
|
||||
static PIC8259_SET_INT_LINE( quakeat_pic8259_2_set_int_line )
|
||||
static const struct pic8259_interface quakeat_pic8259_1_config =
|
||||
{
|
||||
pic8259_ir2_w(quakeat_devices.pic8259_1, interrupt);
|
||||
}
|
||||
|
||||
|
||||
static const struct pic8259_interface quakeat_pic8259_1_config = {
|
||||
quakeat_pic8259_1_set_int_line
|
||||
DEVCB_LINE(quakeat_pic8259_1_set_int_line)
|
||||
};
|
||||
|
||||
|
||||
static const struct pic8259_interface quakeat_pic8259_2_config = {
|
||||
quakeat_pic8259_2_set_int_line
|
||||
static const struct pic8259_interface quakeat_pic8259_2_config =
|
||||
{
|
||||
DEVCB_DEVICE_LINE("pic8259_1", pic8259_ir2_w)
|
||||
};
|
||||
|
||||
/*************************************************************/
|
||||
|
@ -556,25 +556,19 @@ static MACHINE_RESET(taitowlf)
|
||||
*
|
||||
*************************************************************/
|
||||
|
||||
static PIC8259_SET_INT_LINE( taitowlf_pic8259_1_set_int_line )
|
||||
static WRITE_LINE_DEVICE_HANDLER( taitowlf_pic8259_1_set_int_line )
|
||||
{
|
||||
cputag_set_input_line(device->machine, "maincpu", 0, interrupt ? HOLD_LINE : CLEAR_LINE);
|
||||
cputag_set_input_line(device->machine, "maincpu", 0, state ? HOLD_LINE : CLEAR_LINE);
|
||||
}
|
||||
|
||||
|
||||
static PIC8259_SET_INT_LINE( taitowlf_pic8259_2_set_int_line )
|
||||
static const struct pic8259_interface taitowlf_pic8259_1_config =
|
||||
{
|
||||
pic8259_ir2_w(taitowlf_devices.pic8259_1, interrupt);
|
||||
}
|
||||
|
||||
|
||||
static const struct pic8259_interface taitowlf_pic8259_1_config = {
|
||||
taitowlf_pic8259_1_set_int_line
|
||||
DEVCB_LINE(taitowlf_pic8259_1_set_int_line)
|
||||
};
|
||||
|
||||
|
||||
static const struct pic8259_interface taitowlf_pic8259_2_config = {
|
||||
taitowlf_pic8259_2_set_int_line
|
||||
static const struct pic8259_interface taitowlf_pic8259_2_config =
|
||||
{
|
||||
DEVCB_DEVICE_LINE("pic8259_1", pic8259_ir2_w)
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user