blob: e140114c243157e1284a0475873be6cec1616ba4 (
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
62
|
// license:BSD-3-Clause
// copyright-holders: F. Ulivi
/*********************************************************************
rs232_sync_io.h
Synchronous I/O on RS232 port
*********************************************************************/
#ifndef MAME_BUS_RS232_RS232_SYNC_IO_H
#define MAME_BUS_RS232_RS232_SYNC_IO_H
#pragma once
#include "rs232.h"
#include "imagedev/bitbngr.h"
class rs232_sync_io_device : public device_t, public device_rs232_port_interface
{
public:
// construction/destruction
rs232_sync_io_device(const machine_config &mconfig, const char *tag, device_t *owner, const XTAL &clock);
virtual ~rs232_sync_io_device();
virtual DECLARE_WRITE_LINE_MEMBER(input_txd) override;
virtual DECLARE_WRITE_LINE_MEMBER(input_rts) override;
DECLARE_WRITE_LINE_MEMBER(update_serial);
protected:
// device-level overrides
virtual ioport_constructor device_input_ports() const override;
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
virtual void device_reset() override;
TIMER_CALLBACK_MEMBER(clock_tick);
private:
required_device<bitbanger_device> m_stream;
required_ioport m_rs232_baud;
required_ioport m_rts_duplex;
required_ioport m_txc_setting;
required_ioport m_rxc_setting;
emu_timer *m_clk_timer;
bool m_clk;
bool m_txd;
bool m_rts;
bool m_tx_enabled;
bool m_rx_enabled;
uint8_t m_tx_byte;
uint8_t m_rx_byte;
uint8_t m_tx_counter;
uint8_t m_rx_counter;
};
// device type definitions
DECLARE_DEVICE_TYPE(RS232_SYNC_IO, rs232_sync_io_device)
#endif // MAME_BUS_RS232_RS232_SYNC_IO_H
|