summaryrefslogtreecommitdiffstatshomepage
path: root/src/mess/machine/nextkbd.h
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2012-08-21 10:41:19 +0000
committer Miodrag Milanovic <mmicko@gmail.com>2012-08-21 10:41:19 +0000
commit7285b359d259b2ae0fdf85096571c386ec8c991a (patch)
treea027aff57f1a255f9ec6cfd3b68cabe4b6683998 /src/mess/machine/nextkbd.h
parent67c425e90757876a6716b7867df30c0149912e74 (diff)
Merge of MESS sources (no whatsnew)
Diffstat (limited to 'src/mess/machine/nextkbd.h')
-rw-r--r--src/mess/machine/nextkbd.h57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/mess/machine/nextkbd.h b/src/mess/machine/nextkbd.h
new file mode 100644
index 00000000000..b9ec06db77e
--- /dev/null
+++ b/src/mess/machine/nextkbd.h
@@ -0,0 +1,57 @@
+#ifndef __NEXTKBD_H__
+#define __NEXTKBD_H__
+
+#include "emu.h"
+
+#define MCFG_NEXTKBD_ADD(_tag, _int_change_cb, _int_power_cb, _int_nmi_cb) \
+ MCFG_DEVICE_ADD(_tag, NEXTKBD, 0) \
+ downcast<nextkbd_device *>(device)->setup(_int_change_cb, _int_power_cb, _int_nmi_cb);
+
+class nextkbd_device : public device_t {
+public:
+ nextkbd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+ void setup(line_cb_t int_change_cb, line_cb_t _int_power_cb, line_cb_t _int_nmi_cb);
+
+ DECLARE_ADDRESS_MAP(amap, 32);
+ ioport_constructor device_input_ports() const;
+
+ DECLARE_READ32_MEMBER(ctrl_r);
+ DECLARE_READ32_MEMBER(ctrl2_r);
+ DECLARE_READ32_MEMBER(data_r);
+
+ DECLARE_WRITE32_MEMBER(ctrl_w);
+ DECLARE_WRITE32_MEMBER(ctrl2_w);
+ DECLARE_WRITE32_MEMBER(data_w);
+
+ bool int_level_get();
+
+ DECLARE_INPUT_CHANGED_MEMBER(update);
+
+protected:
+ virtual void device_start();
+ virtual void device_reset();
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
+
+private:
+ enum { FLAG_INT = 0x800000, FLAG_DATA = 0x400000, FLAG_RESET = 0x000200 };
+ enum { FIFO_SIZE = 32 };
+ enum { KEYDOWN = 0x0080, KEYVALID = 0x8000 };
+
+ line_cb_t int_change_cb, int_power_cb, int_nmi_cb;
+ emu_timer *kbd_timer;
+ bool nmi_active;
+
+ UINT32 control, control2, data, fifo_ir, fifo_iw, fifo_size;
+ UINT32 fifo[FIFO_SIZE];
+ UINT16 modifiers_state;
+
+ void fifo_push(UINT32 val);
+ UINT32 fifo_pop();
+ bool fifo_empty() const;
+
+ void send();
+};
+
+extern const device_type NEXTKBD;
+
+#endif