summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/hp_hil/hlekbd.h
blob: 3c7f3fdda8cec0d3aa38d590aa3c43803e06006c (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
// license:BSD-3-Clause
// copyright-holders:Sergey Svishchev
#ifndef MAME_DEVICES_HP_HIL_HLEKBD_H
#define MAME_DEVICES_HP_HIL_HLEKBD_H

#pragma once

#include "hp_hil.h"
#include "machine/keyboard.h"


namespace bus { namespace hp_hil {

class hle_device_base
	: public device_t
	, public device_hp_hil_interface
	, protected device_matrix_keyboard_interface<15U>
{
public:
	virtual ~hle_device_base() override;

protected:
	// constructor/destructor
	hle_device_base(machine_config const &mconfig, device_type type, char const *tag, device_t *owner, uint32_t clock);

	// device overrides
	virtual void device_start() override;
	virtual void device_reset() override;
	virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;

	// device_matrix_keyboard_interface overrides
	virtual void key_make(uint8_t row, uint8_t column) override;
	virtual void key_break(uint8_t row, uint8_t column) override;

	// device_hp_hil_interface overrides
	virtual void hil_write(uint16_t data) override;

private:
	// device_serial_interface uses 10'000 range
	// device_matrix_keyboard_interface uses 20'000 range

	void transmit_byte(uint8_t byte);

	util::fifo<uint8_t, 8> m_fifo;
};


class hle_hp_ipc_device : public hle_device_base
{
public:
	hle_hp_ipc_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock);

	virtual ioport_constructor device_input_ports() const override;
};

} } // namespace bus::hp_hil


DECLARE_DEVICE_TYPE_NS(HP_IPC_HLE_KEYBOARD, bus::hp_hil, hle_hp_ipc_device);

#endif // MAME_DEVICES_HP_HIL_HLEKBD_H