From 098c5a9064c9e8b87c4057e20f9ea4d43d485258 Mon Sep 17 00:00:00 2001 From: "R. Belmont" Date: Sun, 13 Jan 2013 03:50:33 +0000 Subject: [PATCH] (MESS) esq5505: add MIDI In capability to all of these drivers. [R. Belmont] --- .gitattributes | 2 ++ src/mess/drivers/esq5505.c | 26 +++++++++++++++++++++++++- src/mess/machine/midiinport.c | 32 ++++++++++++++++++++++++++++++++ src/mess/machine/midiinport.h | 35 +++++++++++++++++++++++++++++++++++ src/mess/mess.mak | 1 + 5 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 src/mess/machine/midiinport.c create mode 100644 src/mess/machine/midiinport.h diff --git a/.gitattributes b/.gitattributes index 18b18b6c4ab..d99a0d449d9 100644 --- a/.gitattributes +++ b/.gitattributes @@ -7208,6 +7208,8 @@ src/mess/machine/mface2.h svneol=native#text/plain src/mess/machine/micropolis.c svneol=native#text/plain src/mess/machine/micropolis.h svneol=native#text/plain src/mess/machine/microtan.c svneol=native#text/plain +src/mess/machine/midiinport.c svneol=native#text/plain +src/mess/machine/midiinport.h svneol=native#text/plain src/mess/machine/mikro80.c svneol=native#text/plain src/mess/machine/mm58274c.c svneol=native#text/plain src/mess/machine/mm58274c.h svneol=native#text/plain diff --git a/src/mess/drivers/esq5505.c b/src/mess/drivers/esq5505.c index 2736b0d2b30..2e4f846bea0 100644 --- a/src/mess/drivers/esq5505.c +++ b/src/mess/drivers/esq5505.c @@ -106,9 +106,10 @@ #include "machine/wd_fdc.h" #include "machine/hd63450.h" // compatible with MC68450, which is what these really have #include "formats/esq16_dsk.h" - #include "machine/esqvfd.h" #include "machine/esqpanel.h" +#include "machine/serial.h" +#include "machine/midiinport.h" #define GENERIC (0) #define EPS (1) @@ -756,6 +757,23 @@ static const esqpanel_interface esqpanel_config = DEVCB_DEVICE_LINE_MEMBER("duart", duartn68681_device, rx_b_w) }; +static SLOT_INTERFACE_START(midiin_slot) + SLOT_INTERFACE("midiin", MIDIIN_PORT) +SLOT_INTERFACE_END + +static const serial_port_interface midiin_intf = +{ + DEVCB_DEVICE_LINE_MEMBER("duart", duartn68681_device, rx_a_w) // route MIDI Tx send directly to 68681 channel A Rx +}; + +static SLOT_INTERFACE_START(midiout_slot) +SLOT_INTERFACE_END + +static const serial_port_interface midiout_intf = +{ + DEVCB_NULL // midi out ports don't transmit inward +}; + static MACHINE_CONFIG_START( vfx, esq5505_state ) MCFG_CPU_ADD("maincpu", M68000, XTAL_10MHz) MCFG_CPU_PROGRAM_MAP(vfx_map) @@ -764,6 +782,9 @@ static MACHINE_CONFIG_START( vfx, esq5505_state ) MCFG_DUARTN68681_ADD("duart", 4000000, duart_config) + MCFG_SERIAL_PORT_ADD("mdin", midiin_intf, midiin_slot, "midiin", NULL) + MCFG_SERIAL_PORT_ADD("mdout", midiout_intf, midiout_slot, NULL, NULL) + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") MCFG_SOUND_ADD("ensoniq", ES5505, XTAL_10MHz) MCFG_SOUND_CONFIG(es5505_config) @@ -801,6 +822,9 @@ static MACHINE_CONFIG_START(vfx32, esq5505_state) MCFG_DUARTN68681_ADD("duart", 4000000, duart_config) + MCFG_SERIAL_PORT_ADD("mdin", midiin_intf, midiin_slot, "midiin", NULL) + MCFG_SERIAL_PORT_ADD("mdout", midiout_intf, midiout_slot, NULL, NULL) + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") MCFG_SOUND_ADD("ensoniq", ES5505, XTAL_30_4761MHz / 2) MCFG_SOUND_CONFIG(es5505_config) diff --git a/src/mess/machine/midiinport.c b/src/mess/machine/midiinport.c new file mode 100644 index 00000000000..5a90999c02f --- /dev/null +++ b/src/mess/machine/midiinport.c @@ -0,0 +1,32 @@ +/********************************************************************* + + midiinport.c + + MIDI In serial port - glues the image device to the pluggable serial port + +*********************************************************************/ + +#include "machine/midiinport.h" + +const device_type MIDIIN_PORT = &device_creator; + +midiin_port_device::midiin_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, MIDIIN_PORT, "MIDI In port", tag, owner, clock), + device_serial_port_interface(mconfig, *this), + m_midiin(*this, "midiin") +{ +} + +static midiin_config midiin_port_image_config = +{ + DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, midiin_port_device, read) +}; + +static MACHINE_CONFIG_FRAGMENT(midiin_port_config) + MCFG_MIDIIN_ADD("midiin", midiin_port_image_config) +MACHINE_CONFIG_END + +machine_config_constructor midiin_port_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME(midiin_port_config); +} diff --git a/src/mess/machine/midiinport.h b/src/mess/machine/midiinport.h new file mode 100644 index 00000000000..173d114d6df --- /dev/null +++ b/src/mess/machine/midiinport.h @@ -0,0 +1,35 @@ +/********************************************************************* + + midiinport.h + + MIDI In serial port - glues the image device to the pluggable serial port + +*********************************************************************/ + +#ifndef _MIDIINPORT_H_ +#define _MIDIINPORT_H_ + +#include "emu.h" +#include "machine/serial.h" +#include "imagedev/midiin.h" + +class midiin_port_device : + public device_t, + public device_serial_port_interface +{ +public: + midiin_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + virtual machine_config_constructor device_mconfig_additions() const; + DECLARE_WRITE_LINE_MEMBER( read ) { m_owner->out_rx(state); } + virtual void tx(UINT8 state) { } +protected: + virtual void device_start() { m_owner = dynamic_cast(owner()); } + virtual void device_reset() { } + virtual void device_config_complete() { m_shortname = "midiin_port"; } +private: + serial_port_device *m_owner; + required_device m_midiin; +}; + +extern const device_type MIDIIN_PORT; +#endif diff --git a/src/mess/mess.mak b/src/mess/mess.mak index b0006122c80..f0dafa05440 100644 --- a/src/mess/mess.mak +++ b/src/mess/mess.mak @@ -558,6 +558,7 @@ $(MESSOBJ)/shared.a: \ $(MESS_DEVICES)/sonydriv.o \ $(MESS_DEVICES)/appldriv.o \ $(MESS_MACHINE)/dp8390.o \ + $(MESS_MACHINE)/midiinport.o \ $(MESS_MACHINE)/ne1000.o \ $(MESS_MACHINE)/ne2000.o \ $(MESS_MACHINE)/3c503.o \