summaryrefslogtreecommitdiffstatshomepage
path: root/src/mess/machine/apollo_kbd.h
diff options
context:
space:
mode:
author R. Belmont <rb6502@users.noreply.github.com>2014-02-24 02:43:26 +0000
committer R. Belmont <rb6502@users.noreply.github.com>2014-02-24 02:43:26 +0000
commit04cca4aa9139cebc98b2f09fe28c95a81125ec7a (patch)
tree8fae15d41960409411e6c005a10d44c2a7620f74 /src/mess/machine/apollo_kbd.h
parent020c376df5ae899da85cc366ebee5cdaca47c5a0 (diff)
(MESS) More apollo updates [R. Belmont]
- Old 68681 is gone - Apollo keyboard now speaks diserial - Headless configs use the serial terminal device nw: And Domain/OS still boots and X11 comes up and works.
Diffstat (limited to 'src/mess/machine/apollo_kbd.h')
-rw-r--r--src/mess/machine/apollo_kbd.h82
1 files changed, 24 insertions, 58 deletions
diff --git a/src/mess/machine/apollo_kbd.h b/src/mess/machine/apollo_kbd.h
index de9105fd84e..142fadbd83e 100644
--- a/src/mess/machine/apollo_kbd.h
+++ b/src/mess/machine/apollo_kbd.h
@@ -26,8 +26,6 @@
#undef putchar
#endif
-#define TX_FIFO_SIZE 128
-
//**************************************************************************
// DEVICE CONFIGURATION MACROS
//**************************************************************************
@@ -36,13 +34,10 @@
MCFG_DEVICE_ADD(_tag, APOLLO_KBD, 0) \
apollo_kbd_device::static_set_interface(*device, _interface);
-INPUT_PORTS_EXTERN(apollo_kbd);
-
-//**************************************************************************
-// Keyboard READ/WRITE
-//**************************************************************************
+#define MCFG_APOLLO_KBD_TX_CALLBACK(_cb) \
+ devcb = &apollo_kbd_device::set_tx_cb(*device, DEVCB2_##_cb);
-void apollo_kbd_getchar(device_t *device, UINT8 data);
+INPUT_PORTS_EXTERN(apollo_kbd);
//**************************************************************************
// TYPE DEFINITIONS
@@ -52,7 +47,6 @@ void apollo_kbd_getchar(device_t *device, UINT8 data);
struct apollo_kbd_interface
{
- devcb_write8 apollo_kbd_putchar_cb;
devcb_read8 apollo_kbd_has_beeper_cb;
devcb_read8 apollo_kbd_is_german_cb;
};
@@ -61,7 +55,7 @@ struct apollo_kbd_interface
// ======================> apollo_kbd_device
-class apollo_kbd_device : public device_t, public apollo_kbd_interface
+class apollo_kbd_device : public device_t, public device_serial_interface, public apollo_kbd_interface
{
public:
// construction/destruction
@@ -70,15 +64,28 @@ public:
// static configuration helpers
static void static_set_interface(device_t &device, const apollo_kbd_interface &interface);
- void getchar(UINT8 data);
+ template<class _Object> static devcb2_base &set_tx_cb(device_t &device, _Object object) { return downcast<apollo_kbd_device &>(device).m_tx_w.set_callback(object); }
+
+ devcb2_write_line m_tx_w;
private:
// device-level overrides
virtual void device_start();
virtual void device_reset();
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
+
+ // serial overrides
+ virtual void rcv_complete(); // Rx completed receiving byte
+ virtual void tra_complete(); // Tx completed sending byte
+ virtual void tra_callback(); // Tx send bit
+ void input_callback(UINT8 state);
+
+ TIMER_CALLBACK_MEMBER( kbd_scan_timer );
const char *cpu_context() ;
+ void kgetchar(UINT8 data);
+
int keyboard_is_german();
void set_mode(UINT16 mode);
@@ -127,59 +134,18 @@ private:
int m_tx_pending; // mouse data packet is pending
};
- /* Transmitter fifo */
- class tx_fifo
- {
- public:
- tx_fifo();
- void start(apollo_kbd_device *device);
- void reset();
- UINT8 getchar();
- void putchar(UINT8 data);
- int putdata(const UINT8 *data, int data_length);
- void flush();
-
- private:
- void timer_callback();
- static TIMER_CALLBACK( static_timer_callback );
-
- apollo_kbd_device *m_device; // pointer back to our device
+// const apollo_kbd_interface &m_config;
- UINT16 m_baud_rate;
+ static const int XMIT_RING_SIZE = 64;
- UINT16 fifo[TX_FIFO_SIZE];
- UINT16 m_read_ptr;
- UINT16 m_write_ptr;
- UINT16 m_char_count;
- UINT16 m_tx_pending;
- emu_timer *m_timer;
- };
+ UINT8 m_xmitring[XMIT_RING_SIZE];
+ int m_xmit_read, m_xmit_write;
+ bool m_tx_busy;
- // the keyboard tty
- class keyboard_tty
- {
- public:
- keyboard_tty();
- void start(apollo_kbd_device *device);
- void reset();
- int isConnected();
- int getchar();
- void putchar(UINT8 data);
- private:
- apollo_kbd_device *m_device; // pointer back to our device
-#if defined(KBD_TTY_NAME)
- const char *m_tty_name;
- int m_tty_fd; /* File descriptor of keyboard tty */
-#endif
- int m_connected;
- };
-
-// const apollo_kbd_interface &m_config;
+ void xmit_char(UINT8 data);
beeper m_beeper;
mouse m_mouse;
- tx_fifo m_tx_fifo;
- keyboard_tty m_keyboard_tty;
apollo_kbd_device *m_device; // pointer to myself (nasty: used for cpu_context)