1 // license:BSD-3-Clause
2 // copyright-holders:David Haywood
3 #ifndef MAME_INCLUDES_MPU5_H
4 #define MAME_INCLUDES_MPU5_H
5 
6 #pragma once
7 
8 #include "machine/68340.h"
9 #include "machine/sec.h"
10 
11 
12 class mpu5_state : public driver_device
13 {
14 public:
mpu5_state(const machine_config & mconfig,device_type type,const char * tag)15 	mpu5_state(const machine_config &mconfig, device_type type, const char *tag)
16 		: driver_device(mconfig, type, tag)
17 		, m_maincpu(*this, "maincpu")
18 		, m_sec(*this, "sec")
19 	{ }
20 
21 	void mpu5(machine_config &config);
22 
23 private:
24 	uint32_t mpu5_mem_r(offs_t offset, uint32_t mem_mask = ~0);
25 	void mpu5_mem_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
26 
27 	uint32_t asic_r32(offs_t offset, uint32_t mem_mask = ~0);
28 	uint8_t asic_r8(offs_t offset);
29 	void asic_w32(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
30 	void asic_w8(offs_t offset, uint8_t data);
31 
32 	uint32_t pic_r(offs_t offset);
33 	void pic_w(offs_t offset, uint32_t data);
34 
35 	virtual void machine_start() override;
36 	void mpu5_map(address_map &map);
37 
38 	uint32_t* m_cpuregion;
39 	std::unique_ptr<uint32_t[]> m_mainram;
40 
41 	uint8_t m_led_strobe_temp;
42 	uint8_t m_led_strobe;
43 	uint8_t m_pic_clk;
44 	bool  m_pic_transfer_in_progress;
45 	uint8_t m_pic_bit1;
46 	uint8_t m_pic_data;
47 	uint8_t m_pic_clocked_bits;
48 	uint8_t m_pic_stored_input;
49 	uint8_t m_pic_output_bit;
50 	uint8_t m_input_strobe;
51 
52 	// devices
53 	required_device<m68340_cpu_device> m_maincpu;
54 	required_device<sec_device> m_sec;
55 };
56 
57 INPUT_PORTS_EXTERN( mpu5 );
58 
59 #endif // MAME_INCLUDES_MPU5_H
60