summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/machine/6840ptm.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/machine/6840ptm.h')
-rw-r--r--src/devices/machine/6840ptm.h51
1 files changed, 25 insertions, 26 deletions
diff --git a/src/devices/machine/6840ptm.h b/src/devices/machine/6840ptm.h
index 6836aa5d317..bd2c6304a73 100644
--- a/src/devices/machine/6840ptm.h
+++ b/src/devices/machine/6840ptm.h
@@ -20,7 +20,7 @@
// ======================> ptm6840_device
-class ptm6840_device : public device_t
+class ptm6840_device : public device_t
{
public:
// construction/destruction
@@ -33,24 +33,24 @@ public:
auto o3_callback() { return m_out_cb[2].bind(); }
auto irq_callback() { return m_irq_cb.bind(); }
- int status(int clock) const { return m_enabled[clock]; } // get whether timer is enabled
- int irq_state() const { return m_irq; } // get IRQ state
- uint16_t count(int counter) const { return compute_counter(counter); } // get counter value
- void set_ext_clock(int counter, double clock); // set clock frequency
- int ext_clock(int counter) const { return m_external_clock[counter]; } // get clock frequency
+ int status(int idx) const { return m_enabled[idx]; } // get whether timer is enabled
+ int irq_state() const { return m_irq; } // get IRQ state
+ int count(int idx) const { return compute_counter(idx); } // get counter value
+ void set_ext_clock(int counter, double clock); // set clock frequency
+ int ext_clock(int idx) const { return m_external_clock[idx]; } // get clock frequency
void write(offs_t offset, uint8_t data);
uint8_t read(offs_t offset);
void set_gate(int idx, int state);
- DECLARE_WRITE_LINE_MEMBER( set_g1 ) { set_gate(0, state); }
- DECLARE_WRITE_LINE_MEMBER( set_g2 ) { set_gate(1, state); }
- DECLARE_WRITE_LINE_MEMBER( set_g3 ) { set_gate(2, state); }
+ void set_g1(int state) { set_gate(0, state); }
+ void set_g2(int state) { set_gate(1, state); }
+ void set_g3(int state) { set_gate(2, state); }
void set_clock(int idx, int state);
- DECLARE_WRITE_LINE_MEMBER( set_c1 ) { set_clock(0, state); }
- DECLARE_WRITE_LINE_MEMBER( set_c2 ) { set_clock(1, state); }
- DECLARE_WRITE_LINE_MEMBER( set_c3 ) { set_clock(2, state); }
+ void set_c1(int state) { set_clock(0, state); }
+ void set_c2(int state) { set_clock(1, state); }
+ void set_c3(int state) { set_clock(2, state); }
void update_interrupts();
@@ -59,15 +59,15 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_resolve_objects() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
private:
- void subtract_from_counter(int counter, int count);
- void tick(int counter, int count);
- void timeout(int idx);
+ void deduct_from_counter(int idx);
+ void tick(int counter);
+ TIMER_CALLBACK_MEMBER(state_changed);
- uint16_t compute_counter(int counter) const;
- void reload_count(int idx);
+ int compute_counter(int idx) const;
+ void reload_counter(int idx);
+ void update_expiration_for_clock_source(int idx, bool changed_to_external = false, double new_external_clock = 0.0);
enum
{
@@ -89,6 +89,7 @@ private:
T3_PRESCALE_EN = 0x01,
INTERNAL_CLK_EN = 0x02,
COUNT_MODE_8BIT = 0x04,
+ MODE_BITS = 0x38,
INTERRUPT_EN = 0x40,
COUNT_OUT_EN = 0x80
};
@@ -107,12 +108,12 @@ private:
devcb_write_line m_irq_cb;
uint8_t m_control_reg[3];
- uint8_t m_output[3]; // Output states
- uint8_t m_gate[3]; // Input gate states
- uint8_t m_clk[3]; // Clock states
- uint8_t m_enabled[3];
+ bool m_output[3]; // Output states
+ bool m_gate[3]; // Counter gate states
+ bool m_clk[3]; // Clock states
+ bool m_enabled[3];
uint8_t m_mode[3];
- uint8_t m_fired[3];
+ bool m_single_fired[3];
uint8_t m_t3_divisor;
uint8_t m_t3_scaler;
uint8_t m_irq;
@@ -126,11 +127,9 @@ private:
uint16_t m_latch[3];
uint16_t m_counter[3];
+ attotime m_disable_time[3];
static const char *const opmode[];
-
- // set in dual 8 bit mode to indicate Output high time cycle
- bool m_hightime[3];
};