From bf23e8181a9e73f1d6763749225bb17b10b2b3b2 Mon Sep 17 00:00:00 2001 From: MooglyGuy Date: Tue, 14 Jan 2020 00:19:08 +0100 Subject: -s3c24xx: Removed redundant accessors, nw --- src/devices/machine/s3c2400.cpp | 2 +- src/devices/machine/s3c2400.h | 2 +- src/devices/machine/s3c2410.cpp | 2 +- src/devices/machine/s3c2410.h | 2 +- src/devices/machine/s3c2440.cpp | 2 +- src/devices/machine/s3c2440.h | 5 ++-- src/devices/machine/s3c24xx.h | 1 + src/devices/machine/s3c24xx.hxx | 56 +++++++++++++++++++++++++++++++++-------- 8 files changed, 55 insertions(+), 17 deletions(-) diff --git a/src/devices/machine/s3c2400.cpp b/src/devices/machine/s3c2400.cpp index 532ccbded85..00fbd49c2c5 100644 --- a/src/devices/machine/s3c2400.cpp +++ b/src/devices/machine/s3c2400.cpp @@ -209,7 +209,7 @@ void s3c2400_device::device_start() { s3c24xx_device_start(); - address_space &space = m_cpu->memory().space(AS_PROGRAM); + address_space &space = m_cpu->space(AS_PROGRAM); space.install_readwrite_handler(0x14000000, 0x1400003b, read32_delegate(*this, FUNC(s3c2400_device::s3c24xx_memcon_r)), write32_delegate(*this, FUNC(s3c2400_device::s3c24xx_memcon_w))); space.install_readwrite_handler(0x14200000, 0x1420005b, read32_delegate(*this, FUNC(s3c2400_device::s3c24xx_usb_host_r)), write32_delegate(*this, FUNC(s3c2400_device::s3c24xx_usb_host_w))); space.install_readwrite_handler(0x14400000, 0x14400017, read32_delegate(*this, FUNC(s3c2400_device::s3c24xx_irq_r)), write32_delegate(*this, FUNC(s3c2400_device::s3c24xx_irq_w))); diff --git a/src/devices/machine/s3c2400.h b/src/devices/machine/s3c2400.h index dd598177308..e8aeb2b14fc 100644 --- a/src/devices/machine/s3c2400.h +++ b/src/devices/machine/s3c2400.h @@ -451,7 +451,7 @@ private: }; // internal state - required_device m_cpu; + required_device m_cpu; required_device m_palette; required_device m_screen; diff --git a/src/devices/machine/s3c2410.cpp b/src/devices/machine/s3c2410.cpp index 93387f5eff9..4c5f102123e 100644 --- a/src/devices/machine/s3c2410.cpp +++ b/src/devices/machine/s3c2410.cpp @@ -271,7 +271,7 @@ void s3c2410_device::device_start() { s3c24xx_device_start(); - address_space &space = m_cpu->memory().space( AS_PROGRAM); + address_space &space = m_cpu->space(AS_PROGRAM); space.install_readwrite_handler( 0x48000000, 0x4800003b, read32_delegate(*this, FUNC(s3c2410_device::s3c24xx_memcon_r)), write32_delegate(*this, FUNC(s3c2410_device::s3c24xx_memcon_w))); space.install_readwrite_handler( 0x49000000, 0x4900005b, read32_delegate(*this, FUNC(s3c2410_device::s3c24xx_usb_host_r)), write32_delegate(*this, FUNC(s3c2410_device::s3c24xx_usb_host_w))); space.install_readwrite_handler( 0x4a000000, 0x4a00001f, read32_delegate(*this, FUNC(s3c2410_device::s3c24xx_irq_r)), write32_delegate(*this, FUNC(s3c2410_device::s3c24xx_irq_w))); diff --git a/src/devices/machine/s3c2410.h b/src/devices/machine/s3c2410.h index 9057e981528..8094c109128 100644 --- a/src/devices/machine/s3c2410.h +++ b/src/devices/machine/s3c2410.h @@ -559,7 +559,7 @@ private: }; // internal state - required_device m_cpu; + required_device m_cpu; required_device m_palette; required_device m_screen; diff --git a/src/devices/machine/s3c2440.cpp b/src/devices/machine/s3c2440.cpp index c60363cc88b..d20b8f9688b 100644 --- a/src/devices/machine/s3c2440.cpp +++ b/src/devices/machine/s3c2440.cpp @@ -286,7 +286,7 @@ s3c2440_device::~s3c2440_device() void s3c2440_device::device_start() { - address_space &space = m_cpu->memory().space( AS_PROGRAM); + address_space &space = m_cpu->space(AS_PROGRAM); space.install_readwrite_handler(0x48000000, 0x4800003b, read32_delegate(*this, FUNC(s3c2440_device::s3c24xx_memcon_r)), write32_delegate(*this, FUNC(s3c2440_device::s3c24xx_memcon_w))); space.install_readwrite_handler(0x49000000, 0x4900005b, read32_delegate(*this, FUNC(s3c2440_device::s3c24xx_usb_host_r)), write32_delegate(*this, FUNC(s3c2440_device::s3c24xx_usb_host_w))); space.install_readwrite_handler(0x4a000000, 0x4a00001f, read32_delegate(*this, FUNC(s3c2440_device::s3c24xx_irq_r)), write32_delegate(*this, FUNC(s3c2440_device::s3c24xx_irq_w))); diff --git a/src/devices/machine/s3c2440.h b/src/devices/machine/s3c2440.h index a16f6d49576..a29f7d8c765 100644 --- a/src/devices/machine/s3c2440.h +++ b/src/devices/machine/s3c2440.h @@ -182,6 +182,8 @@ public: void s3c2440_touch_screen( int state); void s3c2440_request_eint( uint32_t number); + void s3c2440_uart_fifo_w(int uart, uint8_t data); + protected: // device-level overrides virtual void device_start() override; @@ -363,7 +365,6 @@ protected: void s3c24xx_device_reset(); void s3c24xx_device_start(); - void s3c2440_uart_fifo_w( int uart, uint8_t data); void s3c2440_request_irq( uint32_t int_type); private: @@ -603,7 +604,7 @@ private: }; // internal state - required_device m_cpu; + required_device m_cpu; required_device m_palette; required_device m_screen; diff --git a/src/devices/machine/s3c24xx.h b/src/devices/machine/s3c24xx.h index 3cd6ae6303d..4309601b27d 100644 --- a/src/devices/machine/s3c24xx.h +++ b/src/devices/machine/s3c24xx.h @@ -5,6 +5,7 @@ #pragma once +#include "cpu/arm7/arm7.h" class s3c24xx_peripheral_types // TODO: better name for this { diff --git a/src/devices/machine/s3c24xx.hxx b/src/devices/machine/s3c24xx.hxx index fe0a13abfcf..de158c9d8e2 100644 --- a/src/devices/machine/s3c24xx.hxx +++ b/src/devices/machine/s3c24xx.hxx @@ -115,7 +115,7 @@ | LOG_DMA_REGS | LOG_AC97 | LOG_DMA_TIMERS | LOG_GPIO | LOG_MEMCON | LOG_USBHOST | LOG_UART | LOG_USB \ | LOG_WDT | LOG_I2C | LOG_I2S | LOG_RTC | LOG_SDI) -#define VERBOSE (0) +#define VERBOSE (LOG_ALL & ~(LOG_FLASH | LOG_UART)) #include "logmacro.h" /*************************************************************************** @@ -272,6 +272,11 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_dma_reload() LOGMASKED(LOG_LCD_DMA, "LCD - vramaddr %08X %08X offsize %08X pagewidth %08X\n", m_lcd.vramaddr_cur, m_lcd.vramaddr_max, m_lcd.offsize, m_lcd.pagewidth_max); m_lcd.dma_data = 0; m_lcd.dma_bits = 0; + + if (machine().input().code_pressed_once(KEYCODE_K)) + { + s3c24xx_uart_fifo_w(0, 0x55); + } } void S3C24_CLASS_NAME::s3c24xx_lcd_dma_init() @@ -289,7 +294,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_dma_init() #if 0 uint32_t S3C24_CLASS_NAME::s3c24xx_lcd_dma_read() { - address_space& space = m_cpu->memory().space( AS_PROGRAM); + address_space& space = m_cpu->space( AS_PROGRAM); uint8_t *vram, data[4]; vram = (uint8_t *)space.get_read_ptr( m_lcd.vramaddr_cur); for (int i = 0; i < 2; i++) @@ -332,7 +337,7 @@ uint32_t S3C24_CLASS_NAME::s3c24xx_lcd_dma_read() uint32_t S3C24_CLASS_NAME::s3c24xx_lcd_dma_read() { - address_space& space = m_cpu->memory().space( AS_PROGRAM); + address_space& space = m_cpu->space( AS_PROGRAM); uint8_t *vram, data[4]; vram = (uint8_t *)space.get_read_ptr( m_lcd.vramaddr_cur); for (int i = 0; i < 2; i++) @@ -1080,6 +1085,7 @@ READ32_MEMBER( S3C24_CLASS_NAME::s3c24xx_clkpow_r ) WRITE32_MEMBER( S3C24_CLASS_NAME::s3c24xx_clkpow_w ) { + const uint32_t old = ((uint32_t*)&m_clkpow.regs)[offset]; COMBINE_DATA(&((uint32_t*)&m_clkpow.regs)[offset]); switch (offset) { @@ -1087,10 +1093,17 @@ WRITE32_MEMBER( S3C24_CLASS_NAME::s3c24xx_clkpow_w ) LOGMASKED(LOG_CLKPOW, "%s: clock/power write: MPLLCON = %08x & %08x - fclk %d hclk %d pclk %d\n", machine().describe_context(), data, mem_mask, s3c24xx_get_fclk(), s3c24xx_get_hclk(), s3c24xx_get_pclk()); m_cpu->set_unscaled_clock(s3c24xx_get_fclk() * CLOCK_MULTIPLIER); break; - case S3C24XX_CLKSLOW : + case S3C24XX_CLKSLOW: LOGMASKED(LOG_CLKPOW, "%s: clock/power write: CLKSLOW = %08x & %08x - fclk %d hclk %d pclk %d\n", machine().describe_context(), data, mem_mask, s3c24xx_get_fclk(), s3c24xx_get_hclk(), s3c24xx_get_pclk()); m_cpu->set_unscaled_clock(s3c24xx_get_fclk() * CLOCK_MULTIPLIER); break; + case S3C24XX_CLKCON: + LOGMASKED(LOG_CLKPOW, "%s: clock/power write: CLKCON = %08x & %08x\n", machine().describe_context(), data, mem_mask); + if (BIT(data, 2) && !BIT(old, 2)) + { + m_cpu->suspend(SUSPEND_REASON_HALT, 1); + } + break; default: LOGMASKED(LOG_CLKPOW, "%s: clock/power write: %08x = %08x & %08x\n", machine().describe_context(), S3C24XX_BASE_CLKPOW + (offset << 2), data, mem_mask); } @@ -1134,7 +1147,8 @@ void S3C24_CLASS_NAME::s3c24xx_check_pending_irq() if (m_irq.line_irq != ASSERT_LINE) { LOGMASKED(LOG_IRQS, "triggering IRQ line\n"); - m_cpu->execute().set_input_line(ARM7_IRQ_LINE, ASSERT_LINE); + m_cpu->resume(SUSPEND_REASON_HALT); + m_cpu->set_input_line(ARM7_IRQ_LINE, ASSERT_LINE); m_irq.line_irq = ASSERT_LINE; } } @@ -1144,7 +1158,7 @@ void S3C24_CLASS_NAME::s3c24xx_check_pending_irq() { LOGMASKED(LOG_IRQS, "IRQ: srcpnd %08X intmsk %08X intmod %08X\n", m_irq.regs.srcpnd, m_irq.regs.intmsk, m_irq.regs.intmod); LOGMASKED(LOG_IRQS, "clearing IRQ line\n"); - m_cpu->execute().set_input_line(ARM7_IRQ_LINE, CLEAR_LINE); + m_cpu->set_input_line(ARM7_IRQ_LINE, CLEAR_LINE); m_irq.line_irq = CLEAR_LINE; } } @@ -1163,7 +1177,8 @@ void S3C24_CLASS_NAME::s3c24xx_check_pending_irq() if (m_irq.line_fiq != ASSERT_LINE) { LOGMASKED(LOG_IRQS, "asserting FIQ line\n"); - m_cpu->execute().set_input_line(ARM7_FIRQ_LINE, ASSERT_LINE); + m_cpu->resume(SUSPEND_REASON_HALT); + m_cpu->set_input_line(ARM7_FIRQ_LINE, ASSERT_LINE); m_irq.line_fiq = ASSERT_LINE; } } @@ -1172,7 +1187,7 @@ void S3C24_CLASS_NAME::s3c24xx_check_pending_irq() if (m_irq.line_fiq != CLEAR_LINE) { LOGMASKED(LOG_IRQS, "clearing FIQ line\n"); - m_cpu->execute().set_input_line(ARM7_FIRQ_LINE, CLEAR_LINE); + m_cpu->set_input_line(ARM7_FIRQ_LINE, CLEAR_LINE); m_irq.line_fiq = CLEAR_LINE; } } @@ -1523,7 +1538,7 @@ void S3C24_CLASS_NAME::s3c24xx_dma_trigger(int ch) { dma_regs_t *regs = &m_dma[ch].regs; uint32_t curr_tc, curr_src, curr_dst; - address_space &space = m_cpu->memory().space(AS_PROGRAM); + address_space &space = m_cpu->space(AS_PROGRAM); int dsz, inc_src, inc_dst, servmode, tsz; static constexpr uint32_t ch_int[] = { S3C24XX_INT_DMA0, S3C24XX_INT_DMA1, S3C24XX_INT_DMA2, S3C24XX_INT_DMA3 }; LOGMASKED(LOG_DMA, "DMA %d trigger\n", ch); @@ -2061,8 +2076,29 @@ WRITE32_MEMBER( S3C24_CLASS_NAME::s3c24xx_uart_2_w ) void S3C24_CLASS_NAME::s3c24xx_uart_fifo_w(int uart, uint8_t data) { +#if defined(DEVICE_S3C2400) + static const uint32_t s_int_bits[2] = { S3C24XX_INT_URXD0, S3C24XX_INT_URXD1 }; +#else + static const uint32_t s_int_bits[3] = { S3C24XX_SUBINT_RXD0, S3C24XX_SUBINT_RXD1, S3C24XX_SUBINT_RXD2 }; +#endif + m_uart[uart].regs.urxh = data; m_uart[uart].regs.utrstat |= 1; // [bit 0] Receive buffer data ready + + bool request_irq = true; + if (BIT(m_uart[uart].regs.ufcon, 0)) + { + request_irq = false; + } + + if (request_irq) + { +#if defined(DEVICE_S3C2400) + s3c24xx_request_irq(s_int_bits[uart]); +#else + s3c24xx_request_subirq(s_int_bits[uart]); +#endif + } } /* USB Device */ @@ -3264,7 +3300,7 @@ void S3C24_CLASS_NAME::s3c24xx_device_start() int om1 = iface_core_pin_r(S3C24XX_CORE_PIN_OM1); if ((om0 == 0) && (om1 == 0)) { - address_space &space = m_cpu->memory().space(AS_PROGRAM); + address_space &space = m_cpu->space(AS_PROGRAM); space.install_ram(0x00000000, 0x00000fff, m_steppingstone); space.install_ram(0x40000000, 0x40000fff, m_steppingstone); } -- cgit v1.2.3