s3c24xx, s3c44b0: Replace get_read_ptr with memory_access_cache (nw)

This commit is contained in:
AJR 2020-01-27 19:26:26 -05:00
parent f7d8a10da5
commit 93cb850ad7
6 changed files with 33 additions and 39 deletions

View File

@ -455,6 +455,8 @@ private:
required_device<palette_device> m_palette; required_device<palette_device> m_palette;
required_device<screen_device> m_screen; required_device<screen_device> m_screen;
memory_access_cache<2, 0, ENDIANNESS_LITTLE> *m_cache;
memcon_t m_memcon; memcon_t m_memcon;
usbhost_t m_usbhost; usbhost_t m_usbhost;
irq_t m_irq; irq_t m_irq;

View File

@ -563,6 +563,8 @@ private:
required_device<palette_device> m_palette; required_device<palette_device> m_palette;
required_device<screen_device> m_screen; required_device<screen_device> m_screen;
memory_access_cache<2, 0, ENDIANNESS_LITTLE> *m_cache;
uint8_t m_steppingstone[4*1024]; uint8_t m_steppingstone[4*1024];
memcon_t m_memcon; memcon_t m_memcon;
usbhost_t m_usbhost; usbhost_t m_usbhost;

View File

@ -608,6 +608,8 @@ private:
required_device<palette_device> m_palette; required_device<palette_device> m_palette;
required_device<screen_device> m_screen; required_device<screen_device> m_screen;
memory_access_cache<2, 0, ENDIANNESS_LITTLE> *m_cache;
uint8_t m_steppingstone[4*1024]; uint8_t m_steppingstone[4*1024];
memcon_t m_memcon; memcon_t m_memcon;
usbhost_t m_usbhost; usbhost_t m_usbhost;

View File

@ -294,20 +294,17 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_dma_init()
#if 0 #if 0
uint32_t S3C24_CLASS_NAME::s3c24xx_lcd_dma_read() uint32_t S3C24_CLASS_NAME::s3c24xx_lcd_dma_read()
{ {
address_space& space = m_cpu->space( AS_PROGRAM); uint8_t data[4];
uint8_t *vram, data[4];
vram = (uint8_t *)space.get_read_ptr( m_lcd.vramaddr_cur);
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
data[i*2+0] = *vram++; data[i*2+0] = m_cache->read_byte(m_lcd.vramaddr_cur + 0);
data[i*2+1] = *vram++; data[i*2+1] = m_cache->read_byte(m_lcd.vramaddr_cur + 1);
m_lcd.vramaddr_cur += 2; m_lcd.vramaddr_cur += 2;
m_lcd.pagewidth_cur++; m_lcd.pagewidth_cur++;
if (m_lcd.pagewidth_cur >= m_lcd.pagewidth_max) if (m_lcd.pagewidth_cur >= m_lcd.pagewidth_max)
{ {
m_lcd.vramaddr_cur += m_lcd.offsize << 1; m_lcd.vramaddr_cur += m_lcd.offsize << 1;
m_lcd.pagewidth_cur = 0; m_lcd.pagewidth_cur = 0;
vram = (uint8_t *)space.get_read_ptr( m_lcd.vramaddr_cur);
} }
} }
if (m_lcd.hwswp == 0) if (m_lcd.hwswp == 0)
@ -337,9 +334,7 @@ uint32_t S3C24_CLASS_NAME::s3c24xx_lcd_dma_read()
uint32_t S3C24_CLASS_NAME::s3c24xx_lcd_dma_read() uint32_t S3C24_CLASS_NAME::s3c24xx_lcd_dma_read()
{ {
address_space& space = m_cpu->space( AS_PROGRAM); uint8_t data[4];
uint8_t *vram, data[4];
vram = (uint8_t *)space.get_read_ptr( m_lcd.vramaddr_cur);
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
if (m_lcd.hwswp == 0) if (m_lcd.hwswp == 0)
@ -348,39 +343,39 @@ uint32_t S3C24_CLASS_NAME::s3c24xx_lcd_dma_read()
{ {
if ((m_lcd.vramaddr_cur & 2) == 0) if ((m_lcd.vramaddr_cur & 2) == 0)
{ {
data[i*2+0] = *(vram + 3); data[i*2+0] = m_cache->read_byte(m_lcd.vramaddr_cur + 3);
data[i*2+1] = *(vram + 2); data[i*2+1] = m_cache->read_byte(m_lcd.vramaddr_cur + 2);
} }
else else
{ {
data[i*2+0] = *(vram - 1); data[i*2+0] = m_cache->read_byte(m_lcd.vramaddr_cur - 1);
data[i*2+1] = *(vram - 2); data[i*2+1] = m_cache->read_byte(m_lcd.vramaddr_cur - 2);
} }
} }
else else
{ {
data[i*2+0] = *(vram + 0); data[i*2+0] = m_cache->read_byte(m_lcd.vramaddr_cur + 0);
data[i*2+1] = *(vram + 1); data[i*2+1] = m_cache->read_byte(m_lcd.vramaddr_cur + 1);
} }
} }
else else
{ {
if (m_lcd.bswp == 0) if (m_lcd.bswp == 0)
{ {
data[i*2+0] = *(vram + 1); data[i*2+0] = m_cache->read_byte(m_lcd.vramaddr_cur + 1);
data[i*2+1] = *(vram + 0); data[i*2+1] = m_cache->read_byte(m_lcd.vramaddr_cur + 0);
} }
else else
{ {
if ((m_lcd.vramaddr_cur & 2) == 0) if ((m_lcd.vramaddr_cur & 2) == 0)
{ {
data[i*2+0] = *(vram + 2); data[i*2+0] = m_cache->read_byte(m_lcd.vramaddr_cur + 2);
data[i*2+1] = *(vram + 3); data[i*2+1] = m_cache->read_byte(m_lcd.vramaddr_cur + 3);
} }
else else
{ {
data[i*2+0] = *(vram - 2); data[i*2+0] = m_cache->read_byte(m_lcd.vramaddr_cur - 2);
data[i*2+1] = *(vram - 1); data[i*2+1] = m_cache->read_byte(m_lcd.vramaddr_cur - 1);
} }
} }
} }
@ -390,11 +385,6 @@ uint32_t S3C24_CLASS_NAME::s3c24xx_lcd_dma_read()
{ {
m_lcd.vramaddr_cur += m_lcd.offsize << 1; m_lcd.vramaddr_cur += m_lcd.offsize << 1;
m_lcd.pagewidth_cur = 0; m_lcd.pagewidth_cur = 0;
vram = (uint8_t *)space.get_read_ptr( m_lcd.vramaddr_cur);
}
else
{
vram += 2;
} }
} }
if (m_flags & S3C24XX_INTERFACE_LCD_REVERSE) if (m_flags & S3C24XX_INTERFACE_LCD_REVERSE)
@ -758,6 +748,8 @@ void S3C24_CLASS_NAME::s3c24xx_video_start()
{ {
m_lcd.bitmap[0] = std::make_unique<bitmap_rgb32>(m_screen->width(), m_screen->height()); m_lcd.bitmap[0] = std::make_unique<bitmap_rgb32>(m_screen->width(), m_screen->height());
m_lcd.bitmap[1] = std::make_unique<bitmap_rgb32>(m_screen->width(), m_screen->height()); m_lcd.bitmap[1] = std::make_unique<bitmap_rgb32>(m_screen->width(), m_screen->height());
m_cache = m_cpu->space(AS_PROGRAM).cache<2, 0, ENDIANNESS_LITTLE>();
} }
void S3C24_CLASS_NAME::bitmap_blend( bitmap_rgb32 &bitmap_dst, bitmap_rgb32 &bitmap_src_1, bitmap_rgb32 &bitmap_src_2) void S3C24_CLASS_NAME::bitmap_blend( bitmap_rgb32 &bitmap_dst, bitmap_rgb32 &bitmap_src_1, bitmap_rgb32 &bitmap_src_2)

View File

@ -264,6 +264,7 @@ void s3c44b0_device::device_start()
m_data_r_cb.resolve_safe(0); m_data_r_cb.resolve_safe(0);
m_data_w_cb.resolve(); m_data_w_cb.resolve();
m_cache = m_cpu->space(AS_PROGRAM).cache<2, 0, ENDIANNESS_LITTLE>();
for (int i = 0; i < 6; i++) m_pwm.timer[i] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(s3c44b0_device::pwm_timer_exp),this)); for (int i = 0; i < 6; i++) m_pwm.timer[i] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(s3c44b0_device::pwm_timer_exp),this));
for (auto & elem : m_uart) elem.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(s3c44b0_device::uart_timer_exp),this)); for (auto & elem : m_uart) elem.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(s3c44b0_device::uart_timer_exp),this));
@ -536,27 +537,25 @@ void s3c44b0_device::lcd_dma_init()
void s3c44b0_device::lcd_dma_read(int count, uint8_t *data) void s3c44b0_device::lcd_dma_read(int count, uint8_t *data)
{ {
address_space &space = m_cpu->space(AS_PROGRAM);
uint8_t *vram = (uint8_t *)space.get_read_ptr(m_lcd.vramaddr_cur);
for (int i = 0; i < count / 2; i++) for (int i = 0; i < count / 2; i++)
{ {
if (m_lcd.bswp == 0) if (m_lcd.bswp == 0)
{ {
if ((m_lcd.vramaddr_cur & 2) == 0) if ((m_lcd.vramaddr_cur & 2) == 0)
{ {
data[0] = *(vram + 3); data[0] = m_cache->read_byte(m_lcd.vramaddr_cur + 3);
data[1] = *(vram + 2); data[1] = m_cache->read_byte(m_lcd.vramaddr_cur + 2);
} }
else else
{ {
data[0] = *(vram - 1); data[0] = m_cache->read_byte(m_lcd.vramaddr_cur - 1);
data[1] = *(vram - 2); data[1] = m_cache->read_byte(m_lcd.vramaddr_cur - 2);
} }
} }
else else
{ {
data[0] = *(vram + 0); data[0] = m_cache->read_byte(m_lcd.vramaddr_cur + 0);
data[1] = *(vram + 1); data[1] = m_cache->read_byte(m_lcd.vramaddr_cur + 1);
} }
m_lcd.vramaddr_cur += 2; m_lcd.vramaddr_cur += 2;
m_lcd.pagewidth_cur++; m_lcd.pagewidth_cur++;
@ -568,11 +567,6 @@ void s3c44b0_device::lcd_dma_read(int count, uint8_t *data)
lcd_dma_reload(); lcd_dma_reload();
} }
m_lcd.pagewidth_cur = 0; m_lcd.pagewidth_cur = 0;
vram = (uint8_t *)space.get_read_ptr(m_lcd.vramaddr_cur);
}
else
{
vram += 2;
} }
data += 2; data += 2;
} }

View File

@ -599,6 +599,8 @@ private:
devcb_write_line m_sda_w_cb; devcb_write_line m_sda_w_cb;
devcb_read32 m_data_r_cb; devcb_read32 m_data_r_cb;
devcb_write16 m_data_w_cb; devcb_write16 m_data_w_cb;
memory_access_cache<2, 0, ENDIANNESS_LITTLE> *m_cache;
}; };
DECLARE_DEVICE_TYPE(S3C44B0, s3c44b0_device) DECLARE_DEVICE_TYPE(S3C44B0, s3c44b0_device)