summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author angelosa <salese_corp_ltd@email.it>2016-09-27 18:36:59 +0200
committer angelosa <salese_corp_ltd@email.it>2016-09-27 18:36:59 +0200
commitf4749d03f7f65cabde47aa8b62cd5776cf3b0140 (patch)
treebd9c254b587cf0d4630603f56f1264db151254f2
parentc8b7b13ca5a9eecb6d0dd1c7b1653eb8266a4d54 (diff)
Base WatchDog Timer device
-rw-r--r--scripts/src/cpu.lua4
-rw-r--r--src/devices/cpu/sh2/sh7604_wdt.cpp86
-rw-r--r--src/devices/cpu/sh2/sh7604_wdt.h62
3 files changed, 152 insertions, 0 deletions
diff --git a/scripts/src/cpu.lua b/scripts/src/cpu.lua
index 9c81a05051c..315412fb946 100644
--- a/scripts/src/cpu.lua
+++ b/scripts/src/cpu.lua
@@ -648,6 +648,10 @@ if (CPUS["SH2"]~=null) then
MAME_DIR .. "src/devices/cpu/sh2/sh2fe.cpp",
MAME_DIR .. "src/devices/cpu/sh2/sh7604_bus.cpp",
MAME_DIR .. "src/devices/cpu/sh2/sh7604_bus.h",
+ MAME_DIR .. "src/devices/cpu/sh2/sh7604_sci.cpp",
+ MAME_DIR .. "src/devices/cpu/sh2/sh7604_sci.h",
+ MAME_DIR .. "src/devices/cpu/sh2/sh7604_wdt.cpp",
+ MAME_DIR .. "src/devices/cpu/sh2/sh7604_wdt.h",
--MAME_DIR .. "src/devices/cpu/sh2/sh2comn.cpp",
--MAME_DIR .. "src/devices/cpu/sh2/sh2comn.h",
--MAME_DIR .. "src/devices/cpu/sh2/sh2drc.cpp",
diff --git a/src/devices/cpu/sh2/sh7604_wdt.cpp b/src/devices/cpu/sh2/sh7604_wdt.cpp
new file mode 100644
index 00000000000..722a7d59db2
--- /dev/null
+++ b/src/devices/cpu/sh2/sh7604_wdt.cpp
@@ -0,0 +1,86 @@
+// license:BSD-3-Clause
+// copyright-holders:Angelo Salese
+/***************************************************************************
+
+ SH7604 Watchdog Timer Controller
+
+ TODO:
+ - Host CPU setter (clock and callback for irq and reset lines);
+ - memory map (needs to verify if ID write is ok);
+
+***************************************************************************/
+
+#include "emu.h"
+#include "sh7604_wdt.h"
+
+
+
+//**************************************************************************
+// GLOBAL VARIABLES
+//**************************************************************************
+
+// device type definition
+const device_type SH7604_WDT = &device_creator<sh7604_wdt_device>;
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+static ADDRESS_MAP_START( wdt_regs, AS_0, 8, sh7604_wdt_device )
+// AM_RANGE(0x00, 0x00) timer control/status
+// AM_RANGE(0x01, 0x01) timer counter
+// AM_RANGE(0x02, 0x02) write only, reset control register
+// AM_RANGE(0x03, 0x03) read status register, write reset status register
+ADDRESS_MAP_END
+
+//-------------------------------------------------
+// sh7604_wdt_device - constructor
+//-------------------------------------------------
+
+sh7604_wdt_device::sh7604_wdt_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : device_t(mconfig, SH7604_WDT, "sh7604_wdt_longname", tag, owner, clock, "sh7604_wdt", __FILE__),
+ device_memory_interface(mconfig, *this),
+ m_space_config("regs", ENDIANNESS_BIG, 8, 4, 0, nullptr, *ADDRESS_MAP_NAME(wdt_regs))
+
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void sh7604_wdt_device::device_start()
+{
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void sh7604_wdt_device::device_reset()
+{
+}
+
+
+//**************************************************************************
+// READ/WRITE HANDLERS
+//**************************************************************************
+
+READ8_MEMBER( sh7604_wdt_device::read )
+{
+ return space.read_byte(offset);
+}
+
+WRITE16_MEMBER( sh7604_wdt_device::write )
+{
+ UINT8 id_param = data >> 8;
+ switch(id_param)
+ {
+ case 0xa5: space.write_byte(offset*2+0,data & 0xff); break;
+ case 0x5a: space.write_byte(offset*2+1,data & 0xff); break;
+ default: throw emu_fatalerror("%s: invalid id param write = %02x\n",tag(),id_param);
+ }
+}
diff --git a/src/devices/cpu/sh2/sh7604_wdt.h b/src/devices/cpu/sh2/sh7604_wdt.h
new file mode 100644
index 00000000000..e9d69f00227
--- /dev/null
+++ b/src/devices/cpu/sh2/sh7604_wdt.h
@@ -0,0 +1,62 @@
+// license:BSD-3-Clause
+// copyright-holders:Angelo Salese
+/***************************************************************************
+
+ SH7604 Watchdog Timer Controller
+
+***************************************************************************/
+
+#pragma once
+
+#ifndef __SH7604_WDTDEV_H__
+#define __SH7604_WDTDEV_H__
+
+
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_SH7604_WDT_ADD(_tag,_freq) \
+ MCFG_DEVICE_ADD(_tag, SH7604_WDT, _freq)
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> sh7604_wdt_device
+
+class sh7604_wdt_device : public device_t,
+ public device_memory_interface
+{
+public:
+ // construction/destruction
+ sh7604_wdt_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // I/O operations
+ DECLARE_WRITE16_MEMBER( write );
+ DECLARE_READ8_MEMBER( read );
+
+ virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override;
+protected:
+ // device-level overrides
+// virtual void device_validity_check(validity_checker &valid) const;
+ virtual void device_start() override;
+ virtual void device_reset() override;
+private:
+ const address_space_config m_space_config;
+};
+
+
+// device type definition
+extern const device_type SH7604_WDT;
+
+
+
+//**************************************************************************
+// GLOBAL VARIABLES
+//**************************************************************************
+
+
+
+#endif