summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/arm7/lpc210x.h
blob: fa5a20999d05074dc9ec6bf06978129aaa33fb7d (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
84
85
86
87
88
89
90
91
92
93
// license:BSD-3-Clause
// copyright-holders:David Haywood

#ifndef MAME_CPU_ARM7_LPC2103_H
#define MAME_CPU_ARM7_LPC2103_H

#pragma once

#include "arm7.h"
#include "arm7core.h"

/***************************************************************************
    DEVICE CONFIGURATION MACROS
***************************************************************************/


/***************************************************************************
    TYPE DEFINITIONS
***************************************************************************/

class lpc210x_device : public arm7_cpu_device
{
public:
	lpc210x_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t);

	// static configuration helpers


	DECLARE_READ32_MEMBER(arm_E01FC088_r);
	DECLARE_READ32_MEMBER(flash_r);
	DECLARE_WRITE32_MEMBER(flash_w);

	// timer 0 / 1
	DECLARE_READ32_MEMBER(timer0_r) { return read_timer(space, 0, offset, mem_mask); }
	DECLARE_WRITE32_MEMBER(timer0_w) { write_timer(space, 0, offset, data, mem_mask); }

	DECLARE_READ32_MEMBER(timer1_r) { return read_timer(space, 1, offset, mem_mask); }
	DECLARE_WRITE32_MEMBER(timer1_w) { write_timer(space, 1, offset, data, mem_mask); }

	void write_timer(address_space &space, int timer, int offset, uint32_t data, uint32_t mem_mask);
	uint32_t read_timer(address_space &space, int timer, int offset, uint32_t mem_mask);

	// VIC
	DECLARE_READ32_MEMBER(vic_r);
	DECLARE_WRITE32_MEMBER(vic_w);

	// PIN select block
	DECLARE_READ32_MEMBER(pin_r);
	DECLARE_WRITE32_MEMBER(pin_w);

	//PLL Phase Locked Loop
	DECLARE_READ32_MEMBER(pll_r);
	DECLARE_WRITE32_MEMBER(pll_w);

	//MAM memory controller
	DECLARE_READ32_MEMBER(mam_r);
	DECLARE_WRITE32_MEMBER(mam_w);

	//APB divider
	DECLARE_READ32_MEMBER(apbdiv_r);
	DECLARE_WRITE32_MEMBER(apbdiv_w);

	//syscon misc
	DECLARE_READ32_MEMBER(scs_r);
	DECLARE_WRITE32_MEMBER(scs_w);

	// fio
	DECLARE_READ32_MEMBER(fio_r);
	DECLARE_WRITE32_MEMBER(fio_w);

	// todo, use an appropriate flash type instead
	uint8_t m_flash[0x8000]; // needs to be public because the harmony/melody device injects contents with memcpy, yuck

	void lpc2103_map(address_map &map);
protected:
	// device-level overrides
	virtual void device_add_mconfig(machine_config &config) override;
	virtual void device_start() override;
	virtual void device_reset() override;

	virtual space_config_vector memory_space_config() const override;

	uint32_t m_TxPR[2];

private:
	address_space_config m_program_config;
};


// device type definition
DECLARE_DEVICE_TYPE(LPC2103, lpc210x_device)

#endif // MAME_CPU_ARM7_LPC2103_H