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
|
// license:BSD-3-Clause
// copyright-holders:David Haywood, NaokiS
/* Modern device for the MCF5206e Peripherals
this can be hooked properly to the CPU once the CPU is a modern device too
*/
#include "emu.h"
#include "mcf5206e.h"
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
// device type definition
DEFINE_DEVICE_TYPE(MCF5206E_PERIPHERAL, mcf5206e_peripheral_device, "mcf5206e_peripheral", "MCF5206E Peripheral")
//-------------------------------------------------
// mcf5206e_peripheral_device - constructor
//-------------------------------------------------
mcf5206e_peripheral_device::mcf5206e_peripheral_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, MCF5206E_PERIPHERAL, tag, owner, clock)
, device_memory_interface(mconfig, *this)
{
}
device_memory_interface::space_config_vector mcf5206e_peripheral_device::memory_space_config() const
{
return space_config_vector {
//std::make_pair(0, &m_space_config)
};
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
uint32_t mcf5206e_peripheral_device::dev_r(offs_t offset, uint32_t mem_mask)
{
address_space ®_space = this->space();
return reg_space.read_dword(offset*4, mem_mask);
}
void mcf5206e_peripheral_device::dev_w(offs_t offset, uint32_t data, uint32_t mem_mask)
{
address_space ®_space = this->space();
reg_space.write_dword(offset*4, data, mem_mask);
}
// ColdFire peripherals
enum {
CF_PPDAT = 0x1c8/4,
CF_MBSR = 0x1ec/4
};
void mcf5206e_peripheral_device::seta2_coldfire_regs_w(offs_t offset, uint32_t data, uint32_t mem_mask)
{
COMBINE_DATA( &m_coldfire_regs[offset] );
}
uint32_t mcf5206e_peripheral_device::seta2_coldfire_regs_r(offs_t offset)
{
switch( offset )
{
case CF_MBSR:
return machine().rand();
case CF_PPDAT:
return ioport(":BATTERY")->read() << 16;
}
return m_coldfire_regs[offset];
}
|