1 // license:BSD-3-Clause
2 // copyright-holders:Tim Schuerewegen
3 /*****************************************************************************
4  *
5  * includes/cybiko.h
6  *
7  * Cybiko Wireless Inter-tainment System
8  *
9  * (c) 2001-2007 Tim Schuerewegen
10  *
11  * Cybiko Classic (V1)
12  * Cybiko Classic (V2)
13  * Cybiko Xtreme
14  *
15  ****************************************************************************/
16 
17 #ifndef MAME_INCLUDES_CYBIKO_H
18 #define MAME_INCLUDES_CYBIKO_H
19 
20 #include "bus/rs232/rs232.h"
21 
22 #include "cpu/h8/h8s2245.h"
23 #include "cpu/h8/h8s2320.h"
24 
25 #include "imagedev/snapquik.h"
26 
27 #include "machine/at45dbxx.h"
28 #include "machine/intelfsh.h"
29 #include "machine/nvram.h"
30 #include "machine/pcf8593.h"
31 #include "machine/ram.h"
32 
33 #include "sound/spkrdev.h"
34 
35 #include "video/hd66421.h"
36 
37 
38 class cybiko_state : public driver_device
39 {
40 public:
cybiko_state(const machine_config & mconfig,device_type type,const char * tag)41 	cybiko_state(const machine_config &mconfig, device_type type, const char *tag)
42 		: driver_device(mconfig, type, tag)
43 		, m_maincpu(*this, "maincpu")
44 		, m_crtc(*this, "hd66421")
45 		, m_speaker(*this, "speaker")
46 		, m_rtc(*this, "rtc")
47 		, m_ram(*this, RAM_TAG)
48 		, m_flash1(*this, "flash1")
49 		, m_nvram(*this, "nvram")
50 		, m_input(*this, "A.%u", 0)
51 		, m_debug_serial(*this, "debug_serial")
52 	{ }
53 
54 	void serflash_w(uint16_t data);
55 	uint16_t clock_r();
56 	void clock_w(uint16_t data);
57 	uint16_t xtclock_r();
58 	void xtclock_w(uint16_t data);
59 	uint16_t xtpower_r();
60 	uint16_t adc1_r();
61 	uint16_t adc2_r();
62 	uint16_t port0_r();
63 
64 	uint16_t cybiko_lcd_r(offs_t offset, uint16_t mem_mask = ~0);
65 	void cybiko_lcd_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
66 	uint16_t cybikov1_key_r(offs_t offset, uint16_t mem_mask = ~0);
67 	uint16_t cybikov2_key_r(offs_t offset, uint16_t mem_mask = ~0);
68 	uint16_t cybikoxt_key_r(offs_t offset, uint16_t mem_mask = ~0);
69 	void cybiko_usb_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
70 	int cybiko_key_r(offs_t offset, int mem_mask);
71 
72 	required_device<h8_device> m_maincpu;
73 	required_device<hd66421_device> m_crtc;
74 	required_device<speaker_sound_device> m_speaker;
75 	required_device<pcf8593_device> m_rtc;
76 	required_device<ram_device> m_ram;
77 	optional_device<at45db041_device> m_flash1;
78 	required_device<nvram_device>   m_nvram;
79 	optional_ioport_array<15> m_input;
80 	required_device<rs232_port_device> m_debug_serial;
81 	void init_cybikoxt();
82 	void init_cybiko();
83 	virtual void machine_start() override;
84 	virtual void machine_reset() override;
85 	DECLARE_QUICKLOAD_LOAD_MEMBER(quickload_cybiko);
86 	DECLARE_QUICKLOAD_LOAD_MEMBER(quickload_cybikoxt);
87 
88 	void cybikov1_base(machine_config &config);
89 	void cybikov1_flash(machine_config &config);
90 	void cybikov1_debug_serial(machine_config &config);
91 	void cybikov1(machine_config &config);
92 	void cybikov2(machine_config &config);
93 	void cybikoxt(machine_config &config);
94 
95 	void cybikov1_io(address_map &map);
96 	void cybikov1_mem(address_map &map);
97 	void cybikov2_io(address_map &map);
98 	void cybikov2_mem(address_map &map);
99 	void cybikoxt_io(address_map &map);
100 	void cybikoxt_mem(address_map &map);
101 };
102 
103 #endif // MAME_INCLUDES_CYBIKO_H
104