1 // license:BSD-3-Clause 2 // copyright-holders:R. Belmont 3 #ifndef MAME_CPU_F2MC16_MB9061X_H 4 #define MAME_CPU_F2MC16_MB9061X_H 5 6 #pragma once 7 8 #include "f2mc16.h" 9 10 //************************************************************************** 11 // CONSTANTS 12 //************************************************************************** 13 14 //************************************************************************** 15 // TYPE DEFINITIONS 16 //************************************************************************** 17 18 // ======================> m5074x_device 19 20 class mb9061x_device : public f2mc16_device 21 { 22 friend class mb90610_device; 23 friend class mb90611_device; 24 25 public: 26 const address_space_config m_program_config; 27 28 // interrupts handled by the interrupt controller 29 enum 30 { 31 ICR0 = 0, ICR1, ICR2, ICR3, ICR4, ICR5, ICR6, ICR7, ICR8, ICR9, ICR10, ICR11, ICR12, ICR13, ICR14, ICR15 32 }; 33 34 // timer external counter tick functions 35 DECLARE_WRITE_LINE_MEMBER(tin0_w); 36 DECLARE_WRITE_LINE_MEMBER(tin1_w); 37 38 protected: 39 // construction/destruction 40 mb9061x_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, address_map_constructor internal_map); 41 42 // device-level overrides 43 virtual void device_start() override; 44 virtual void device_reset() override; 45 virtual void execute_set_input(int inputnum, int state) override; 46 virtual space_config_vector memory_space_config() const override; 47 48 private: 49 // TBC 50 TIMER_CALLBACK_MEMBER(tbtc_tick); 51 u8 tbtc_r(); 52 void tbtc_w(u8 data); 53 54 // INTC 55 u8 intc_r(offs_t offset); 56 void intc_w(offs_t offset, u8 data); 57 void intc_trigger_irq(int icr, int vector); 58 void intc_clear_irq(int icr, int vector); 59 60 // TIMERS 61 TIMER_CALLBACK_MEMBER(timer0_tick); 62 TIMER_CALLBACK_MEMBER(timer1_tick); 63 u8 timer_r(offs_t offset); 64 void timer_w(offs_t offset, u8 data); 65 void recalc_timer(int tnum); 66 void tin_common(int timer, int base, int state); 67 68 u8 m_timer_regs[8]; 69 u32 m_timer_hz[2]; 70 emu_timer *m_timer[2]; 71 int m_event_state[2]; 72 u16 m_event_count[2]; 73 74 u8 m_tbtc; 75 emu_timer *m_tbtc_timer; 76 77 u8 m_intc[0x10]; 78 }; 79 80 class mb90610_device : public mb9061x_device 81 { 82 public: 83 mb90610_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); 84 85 void mb90610_map(address_map &map); 86 protected: 87 mb90610_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); 88 }; 89 90 class mb90611_device : public mb9061x_device 91 { 92 public: 93 mb90611_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); 94 95 void mb90611_map(address_map &map); 96 protected: 97 mb90611_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); 98 }; 99 100 DECLARE_DEVICE_TYPE(MB90610A, mb90610_device) 101 DECLARE_DEVICE_TYPE(MB90611A, mb90611_device) 102 103 #endif // MAME_CPU_F2MC16_MB9061X_H 104