Add Exar XR68C681 support to mc68681.cpp (again) (#3755)
* skeleton support for Exar XR68C681 dual UART device * added support for XR68C681 MISR register * XR68C681 extended baud rate support Well, at least in theory. Here goes nothing! * copyright update * Style changes as described in mamedev pull request #3755 * More style changes for PR #3755 in mamedev hex literals should be lower case also some spacing corrected
This commit is contained in:
parent
47e045d545
commit
e6938b4226
File diff suppressed because it is too large
Load Diff
@ -59,7 +59,7 @@ public:
|
|||||||
|
|
||||||
uint8_t read_rx_fifo();
|
uint8_t read_rx_fifo();
|
||||||
|
|
||||||
void ACR_updated();
|
void baud_updated();
|
||||||
|
|
||||||
uint8_t get_chan_CSR();
|
uint8_t get_chan_CSR();
|
||||||
|
|
||||||
@ -123,8 +123,8 @@ public:
|
|||||||
virtual DECLARE_READ8_MEMBER(read);
|
virtual DECLARE_READ8_MEMBER(read);
|
||||||
virtual DECLARE_WRITE8_MEMBER(write);
|
virtual DECLARE_WRITE8_MEMBER(write);
|
||||||
|
|
||||||
DECLARE_WRITE_LINE_MEMBER( rx_a_w ) { m_chanA->device_serial_interface::rx_w((uint8_t)state); }
|
DECLARE_WRITE_LINE_MEMBER(rx_a_w) { m_chanA->device_serial_interface::rx_w((uint8_t)state); }
|
||||||
DECLARE_WRITE_LINE_MEMBER( rx_b_w ) { m_chanB->device_serial_interface::rx_w((uint8_t)state); }
|
DECLARE_WRITE_LINE_MEMBER(rx_b_w) { m_chanB->device_serial_interface::rx_w((uint8_t)state); }
|
||||||
|
|
||||||
template <class Object> devcb_base &set_irq_cb(Object &&cb) { return write_irq.set_callback(std::forward<Object>(cb)); }
|
template <class Object> devcb_base &set_irq_cb(Object &&cb) { return write_irq.set_callback(std::forward<Object>(cb)); }
|
||||||
template <class Object> devcb_base &set_a_tx_cb(Object &&cb) { return write_a_tx.set_callback(std::forward<Object>(cb)); }
|
template <class Object> devcb_base &set_a_tx_cb(Object &&cb) { return write_a_tx.set_callback(std::forward<Object>(cb)); }
|
||||||
@ -138,13 +138,13 @@ public:
|
|||||||
auto outport_cb() { return write_outport.bind(); }
|
auto outport_cb() { return write_outport.bind(); }
|
||||||
|
|
||||||
// new-style push handlers for input port bits
|
// new-style push handlers for input port bits
|
||||||
DECLARE_WRITE_LINE_MEMBER( ip0_w );
|
DECLARE_WRITE_LINE_MEMBER(ip0_w);
|
||||||
DECLARE_WRITE_LINE_MEMBER( ip1_w );
|
DECLARE_WRITE_LINE_MEMBER(ip1_w);
|
||||||
DECLARE_WRITE_LINE_MEMBER( ip2_w );
|
DECLARE_WRITE_LINE_MEMBER(ip2_w);
|
||||||
DECLARE_WRITE_LINE_MEMBER( ip3_w );
|
DECLARE_WRITE_LINE_MEMBER(ip3_w);
|
||||||
DECLARE_WRITE_LINE_MEMBER( ip4_w );
|
DECLARE_WRITE_LINE_MEMBER(ip4_w);
|
||||||
DECLARE_WRITE_LINE_MEMBER( ip5_w );
|
DECLARE_WRITE_LINE_MEMBER(ip5_w);
|
||||||
DECLARE_WRITE_LINE_MEMBER( ip6_w );
|
DECLARE_WRITE_LINE_MEMBER(ip6_w);
|
||||||
|
|
||||||
bool irq_pending() const { return (ISR & IMR) != 0; }
|
bool irq_pending() const { return (ISR & IMR) != 0; }
|
||||||
|
|
||||||
@ -165,12 +165,15 @@ protected:
|
|||||||
virtual void update_interrupts();
|
virtual void update_interrupts();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TIMER_CALLBACK_MEMBER( duart_timer_callback );
|
TIMER_CALLBACK_MEMBER(duart_timer_callback);
|
||||||
|
|
||||||
|
protected:
|
||||||
/* registers */
|
/* registers */
|
||||||
uint8_t ACR; /* Auxiliary Control Register */
|
uint8_t ACR; /* Auxiliary Control Register */
|
||||||
uint8_t IMR; /* Interrupt Mask Register */
|
uint8_t IMR; /* Interrupt Mask Register */
|
||||||
uint8_t ISR; /* Interrupt Status Register */
|
uint8_t ISR; /* Interrupt Status Register */
|
||||||
|
|
||||||
|
private:
|
||||||
uint8_t OPCR; /* Output Port Conf. Register */
|
uint8_t OPCR; /* Output Port Conf. Register */
|
||||||
uint8_t OPR; /* Output Port Register */
|
uint8_t OPR; /* Output Port Register */
|
||||||
PAIR CTR; /* Counter/Timer Preset Value */
|
PAIR CTR; /* Counter/Timer Preset Value */
|
||||||
@ -186,7 +189,7 @@ private:
|
|||||||
double get_ct_rate();
|
double get_ct_rate();
|
||||||
uint16_t get_ct_count();
|
uint16_t get_ct_count();
|
||||||
void start_ct(int count);
|
void start_ct(int count);
|
||||||
int calc_baud(int ch, uint8_t data);
|
virtual int calc_baud(int ch, bool rx, uint8_t data);
|
||||||
void clear_ISR_bits(int mask);
|
void clear_ISR_bits(int mask);
|
||||||
void set_ISR_bits(int mask);
|
void set_ISR_bits(int mask);
|
||||||
|
|
||||||
@ -230,6 +233,7 @@ protected:
|
|||||||
virtual void device_start() override;
|
virtual void device_start() override;
|
||||||
virtual void device_reset() override;
|
virtual void device_reset() override;
|
||||||
virtual void update_interrupts() override;
|
virtual void update_interrupts() override;
|
||||||
|
mc68681_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_read_vector; // if this is read and IRQ is active, it counts as pulling IACK
|
bool m_read_vector; // if this is read and IRQ is active, it counts as pulling IACK
|
||||||
@ -245,8 +249,8 @@ public:
|
|||||||
template <class Object> devcb_base &set_c_tx_cb(Object &&cb) { return write_c_tx.set_callback(std::forward<Object>(cb)); }
|
template <class Object> devcb_base &set_c_tx_cb(Object &&cb) { return write_c_tx.set_callback(std::forward<Object>(cb)); }
|
||||||
template <class Object> devcb_base &set_d_tx_cb(Object &&cb) { return write_d_tx.set_callback(std::forward<Object>(cb)); }
|
template <class Object> devcb_base &set_d_tx_cb(Object &&cb) { return write_d_tx.set_callback(std::forward<Object>(cb)); }
|
||||||
|
|
||||||
DECLARE_WRITE_LINE_MEMBER( rx_c_w ) { m_chanC->device_serial_interface::rx_w((uint8_t)state); }
|
DECLARE_WRITE_LINE_MEMBER(rx_c_w) { m_chanC->device_serial_interface::rx_w((uint8_t)state); }
|
||||||
DECLARE_WRITE_LINE_MEMBER( rx_d_w ) { m_chanD->device_serial_interface::rx_w((uint8_t)state); }
|
DECLARE_WRITE_LINE_MEMBER(rx_d_w) { m_chanD->device_serial_interface::rx_w((uint8_t)state); }
|
||||||
|
|
||||||
virtual DECLARE_READ8_MEMBER(read) override;
|
virtual DECLARE_READ8_MEMBER(read) override;
|
||||||
virtual DECLARE_WRITE8_MEMBER(write) override;
|
virtual DECLARE_WRITE8_MEMBER(write) override;
|
||||||
@ -270,10 +274,29 @@ protected:
|
|||||||
mc68340_duart_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
|
mc68340_duart_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class xr68c681_device : public mc68681_device
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
xr68c681_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||||
|
|
||||||
|
virtual DECLARE_READ8_MEMBER(read) override;
|
||||||
|
virtual DECLARE_WRITE8_MEMBER(write) override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void device_start() override;
|
||||||
|
virtual void device_reset() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
virtual int calc_baud(int ch, bool rx, uint8_t data) override;
|
||||||
|
|
||||||
|
bool m_XTXA,m_XRXA,m_XTXB,m_XRXB; /* X bits for the BRG (selects between 2 BRG tables) */
|
||||||
|
};
|
||||||
|
|
||||||
DECLARE_DEVICE_TYPE(SCN2681, scn2681_device)
|
DECLARE_DEVICE_TYPE(SCN2681, scn2681_device)
|
||||||
DECLARE_DEVICE_TYPE(MC68681, mc68681_device)
|
DECLARE_DEVICE_TYPE(MC68681, mc68681_device)
|
||||||
DECLARE_DEVICE_TYPE(SC28C94, sc28c94_device)
|
DECLARE_DEVICE_TYPE(SC28C94, sc28c94_device)
|
||||||
DECLARE_DEVICE_TYPE(MC68340_DUART, mc68340_duart_device)
|
DECLARE_DEVICE_TYPE(MC68340_DUART, mc68340_duart_device)
|
||||||
|
DECLARE_DEVICE_TYPE(XR68C681, xr68c681_device)
|
||||||
DECLARE_DEVICE_TYPE(DUART_CHANNEL, duart_channel)
|
DECLARE_DEVICE_TYPE(DUART_CHANNEL, duart_channel)
|
||||||
|
|
||||||
#endif // MAME_MACHINE_MC68681_H
|
#endif // MAME_MACHINE_MC68681_H
|
||||||
|
Loading…
Reference in New Issue
Block a user