1 // license:BSD-3-Clause 2 // copyright-holders:Ryan Holtz, Ash Wolf 3 /*************************************************************************** 4 5 Psion 5mx (EPOC R5) series and peripherals 6 7 Skeleton driver by Ryan Holtz, ported from work by Ash Wolf 8 9 ****************************************************************************/ 10 11 #ifndef MAME_INCLUDES_PSION5_H 12 #define MAME_INCLUDES_PSION5_H 13 14 #pragma once 15 16 #include "emu.h" 17 #include "cpu/arm7/arm7.h" 18 #include "cpu/arm7/arm7core.h" 19 #include "machine/etna.h" 20 #include "sound/spkrdev.h" 21 22 #include "screen.h" 23 #include "emupal.h" 24 #include "speaker.h" 25 26 class psion5mx_state : public driver_device 27 { 28 public: psion5mx_state(const machine_config & mconfig,device_type type,const char * tag)29 psion5mx_state(const machine_config &mconfig, device_type type, const char *tag) 30 : driver_device(mconfig, type, tag) 31 , m_maincpu(*this, "maincpu") 32 , m_etna(*this, "etna") 33 , m_lcd_ram(*this, "lcd_ram") 34 , m_palette(*this, "palette") 35 , m_speaker(*this, "speaker") 36 , m_touchx(*this, "TOUCHX") 37 , m_touchy(*this, "TOUCHY") 38 , m_touch(*this, "TOUCH") 39 , m_kbd_cols(*this, "COL%u", 0U) 40 { 41 } 42 43 void psion5mx(machine_config &config); 44 45 DECLARE_INPUT_CHANGED_MEMBER(touch_down); 46 47 protected: 48 virtual void machine_start() override; 49 virtual void machine_reset() override; 50 51 virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; 52 53 private: 54 void palette_init(palette_device &palette); 55 56 uint32_t periphs_r(offs_t offset, uint32_t mem_mask = ~0); 57 void periphs_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 58 59 void update_timer(int timer); 60 void set_timer_ctrl(int timer, uint32_t value); 61 void check_interrupts(); 62 63 static constexpr device_timer_id TID_TIMER1 = 0; 64 static constexpr device_timer_id TID_TIMER2 = 1; 65 static constexpr device_timer_id TID_PERIODIC = 2; 66 static constexpr device_timer_id TID_RTC_TICKER = 3; 67 68 enum 69 { 70 REG_MEMCFG1 = 0x0000, 71 REG_MEMCFG2 = 0x0004, 72 73 REG_DRAMCFG = 0x0100, 74 75 REG_LCDCTL = 0x0200, 76 REG_LCDST = 0x0204, 77 REG_LCD_DBAR1 = 0x0210, 78 REG_LCDT0 = 0x0220, 79 REG_LCDT1 = 0x0224, 80 REG_LCDT2 = 0x0228, 81 82 REG_PWRSR = 0x0400, 83 REG_PWRCNT = 0x0404, 84 REG_HALT = 0x0408, 85 REG_STBY = 0x040c, 86 REG_BLEOI = 0x0410, 87 REG_MCEOI = 0x0414, 88 REG_TEOI = 0x0418, 89 REG_STFCLR = 0x041c, 90 REG_E2EOI = 0x0420, 91 92 REG_INTSR = 0x0500, 93 REG_INTRSR = 0x0504, 94 REG_INTENS = 0x0508, 95 REG_INTENC = 0x050c, 96 REG_INTTEST1 = 0x0514, 97 REG_INTTEST2 = 0x0518, 98 99 REG_PUMPCON = 0x0900, 100 101 REG_CODR = 0x0a00, 102 REG_CONFG = 0x0a04, 103 REG_COLFG = 0x0a08, 104 REG_COEOI = 0x0a0c, 105 REG_COTEST = 0x0a10, 106 107 REG_SSCR0 = 0x0b00, 108 REG_SSCR1 = 0x0b04, 109 REG_SSDR = 0x0b0c, 110 REG_SSSR = 0x0b14, 111 112 REG_TC1LOAD = 0x0c00, 113 REG_TC1VAL = 0x0c04, 114 REG_TC1CTRL = 0x0c08, 115 REG_TC1EOI = 0x0c0c, 116 REG_TC2LOAD = 0x0c20, 117 REG_TC2VAL = 0x0c24, 118 REG_TC2CTRL = 0x0c28, 119 REG_TC2EOI = 0x0c2c, 120 121 REG_BZCONT = 0x0c40, 122 123 REG_RTCDRL = 0x0d00, 124 REG_RTCDRU = 0x0d04, 125 REG_RTCMRL = 0x0d08, 126 REG_RTCMRU = 0x0d0c, 127 REG_RTCEOI = 0x0d10, 128 129 REG_PADR = 0x0e00, 130 REG_PBDR = 0x0e04, 131 REG_PCDR = 0x0e08, 132 REG_PDDR = 0x0e0c, 133 REG_PADDR = 0x0e10, 134 REG_PBDDR = 0x0e14, 135 REG_PCDDR = 0x0e18, 136 REG_PDDDR = 0x0e1c, 137 REG_PEDR = 0x0e20, 138 REG_PEDDR = 0x0e24, 139 140 REG_KSCAN = 0x0e28, 141 REG_LCDMUX = 0x0e2c 142 }; 143 144 enum 145 { 146 IRQ_EXTFIQ = 0, // FiqExternal 147 IRQ_BLINT = 1, // FiqBatLow 148 IRQ_WEINT = 2, // FiqWatchDog 149 IRQ_MCINT = 3, // FiqMediaChg 150 IRQ_CSINT = 4, // IrqCodec 151 IRQ_EINT1 = 5, // IrqExt1 152 IRQ_EINT2 = 6, // IrqExt2 153 IRQ_EINT3 = 7, // IrqExt3 154 IRQ_TC1OI = 8, // IrqTimer1 155 IRQ_TC2OI = 9, // IrqTimer2 156 IRQ_RTCMI = 10, // IrqRtcMatch 157 IRQ_TINT = 11, // IrqTick 158 IRQ_UART1 = 12, // IrqUart1 159 IRQ_UART2 = 13, // IrqUart2 160 IRQ_LCDINT = 14, // IrqLcd 161 IRQ_SSEOTI = 15, // IrqSpi 162 IRQ_FIQ_MASK = 0x000f, 163 IRQ_IRQ_MASK = 0xfff0 164 }; 165 166 enum 167 { 168 PORTA, 169 PORTB, 170 PORTC, 171 PORTD, 172 PORTE 173 }; 174 175 void main_map(address_map &map); 176 177 uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); 178 179 uint8_t read_keyboard(); 180 181 required_device<arm710t_cpu_device> m_maincpu; 182 required_device<etna_device> m_etna; 183 required_shared_ptr<uint32_t> m_lcd_ram; 184 required_device<palette_device> m_palette; 185 required_device<speaker_sound_device> m_speaker; 186 required_ioport m_touchx; 187 required_ioport m_touchy; 188 required_ioport m_touch; 189 required_ioport_array<8> m_kbd_cols; 190 191 emu_timer *m_timers[2]; 192 193 uint32_t m_memcfg[2]; 194 uint16_t m_dramcfg; 195 196 uint16_t m_timer_reload[2]; 197 uint16_t m_timer_ctrl[2]; 198 uint16_t m_timer_value[2]; 199 200 uint32_t m_pending_ints; 201 uint32_t m_int_mask; 202 203 uint32_t m_lcd_display_base_addr; 204 205 uint32_t m_rtc; 206 uint32_t m_pwrsr; 207 uint32_t m_last_ssi_request; 208 uint32_t m_ssi_read_counter; 209 uint8_t m_buzzer_ctrl; 210 211 uint8_t m_kbd_scan; 212 213 uint8_t m_ports[5]; 214 215 emu_timer *m_periodic; 216 emu_timer *m_rtc_ticker; 217 }; 218 219 #endif // MAME_INCLUDES_PSION5_H 220