summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/sh2/sh7604_wdt.cpp
blob: 16b40f30768ab3762af5d0a98d2bd39a4da40782 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// 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
DEFINE_DEVICE_TYPE(SH7604_WDT, sh7604_wdt_device, "sh7604wdt", "SH7604 Watchdog Timer")


//**************************************************************************
//  LIVE DEVICE
//**************************************************************************

DEVICE_ADDRESS_MAP_START( wdt_regs, 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_t clock)
	: device_t(mconfig, SH7604_WDT, tag, owner, clock)
{
}


//-------------------------------------------------
//  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_t 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);
	}
}