-pxa255: Converted to logmacro, added more GPIO callbacks, removed unnecessary prefixes. [Ryan Holtz]

-zaurus: Split into per-SoC-type machine configs, enabled RTC hack, and adjusted to correct clocks. [Ryan Holtz]
This commit is contained in:
MooglyGuy 2020-02-26 23:44:30 +01:00 committed by mooglyguy
parent 15205cf4a5
commit 13b6ea2ac1
4 changed files with 385 additions and 400 deletions

File diff suppressed because it is too large Load Diff

View File

@ -34,43 +34,43 @@ public:
pxa255_periphs_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
auto gpio0_set_cb() { return m_gpio0_set_func.bind(); }
auto gpio0_clear_cb() { return m_gpio0_clear_func.bind(); }
auto gpio0_in_cb() { return m_gpio0_in_func.bind(); }
auto gpio0_write() { return m_gpio0_w.bind(); }
auto gpio0_read() { return m_gpio0_r.bind(); }
DECLARE_READ32_MEMBER(pxa255_i2s_r);
DECLARE_WRITE32_MEMBER(pxa255_i2s_w);
DECLARE_READ32_MEMBER(pxa255_dma_r);
DECLARE_WRITE32_MEMBER(pxa255_dma_w);
DECLARE_READ32_MEMBER(pxa255_ostimer_r);
DECLARE_WRITE32_MEMBER(pxa255_ostimer_w);
DECLARE_READ32_MEMBER(pxa255_intc_r);
DECLARE_WRITE32_MEMBER(pxa255_intc_w);
DECLARE_READ32_MEMBER(pxa255_gpio_r);
DECLARE_WRITE32_MEMBER(pxa255_gpio_w);
DECLARE_READ32_MEMBER(pxa255_lcd_r);
DECLARE_WRITE32_MEMBER(pxa255_lcd_w);
DECLARE_READ32_MEMBER(i2s_r);
DECLARE_WRITE32_MEMBER(i2s_w);
DECLARE_READ32_MEMBER(dma_r);
DECLARE_WRITE32_MEMBER(dma_w);
DECLARE_READ32_MEMBER(ostimer_r);
DECLARE_WRITE32_MEMBER(ostimer_w);
DECLARE_READ32_MEMBER(intc_r);
DECLARE_WRITE32_MEMBER(intc_w);
DECLARE_READ32_MEMBER(gpio_r);
DECLARE_WRITE32_MEMBER(gpio_w);
DECLARE_READ32_MEMBER(lcd_r);
DECLARE_WRITE32_MEMBER(lcd_w);
void set_irq_line(uint32_t line, int state);
protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
virtual void device_reset() override;
void pxa255_dma_irq_check();
void pxa255_dma_load_descriptor_and_start(int channel);
void pxa255_ostimer_irq_check();
void pxa255_update_interrupts();
void pxa255_set_irq_line(uint32_t line, int state);
void pxa255_lcd_load_dma_descriptor(address_space & space, uint32_t address, int channel);
void pxa255_lcd_irq_check();
void pxa255_lcd_dma_kickoff(int channel);
void pxa255_lcd_check_load_next_branch(int channel);
void dma_irq_check();
void dma_load_descriptor_and_start(int channel);
void ostimer_irq_check();
void update_interrupts();
void lcd_load_dma_descriptor(address_space & space, uint32_t address, int channel);
void lcd_irq_check();
void lcd_dma_kickoff(int channel);
void lcd_check_load_next_branch(int channel);
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(pxa255_dma_dma_end);
TIMER_CALLBACK_MEMBER(pxa255_ostimer_match);
TIMER_CALLBACK_MEMBER(pxa255_lcd_dma_eof);
TIMER_CALLBACK_MEMBER(dma_dma_end);
TIMER_CALLBACK_MEMBER(ostimer_match);
TIMER_CALLBACK_MEMBER(lcd_dma_eof);
struct dma_regs_t
{
@ -205,20 +205,21 @@ protected:
gpio_regs_t m_gpio_regs;
lcd_regs_t m_lcd_regs;
devcb_write32 m_gpio0_set_func;
devcb_write32 m_gpio0_clear_func;
devcb_read32 m_gpio0_in_func;
devcb_write32 m_gpio0_w;
devcb_write32 m_gpio1_w;
devcb_write32 m_gpio2_w;
devcb_read32 m_gpio0_r;
devcb_read32 m_gpio1_r;
devcb_read32 m_gpio2_r;
required_device<cpu_device> m_maincpu;
required_device_array<dmadac_sound_device, 2> m_dmadac;
required_device<palette_device> m_palette;
std::unique_ptr<uint32_t[]> m_pxa255_lcd_palette; // 0x100
std::unique_ptr<uint8_t[]> m_pxa255_lcd_framebuffer; // 0x100000
std::unique_ptr<uint32_t[]> m_lcd_palette; // 0x100
std::unique_ptr<uint8_t[]> m_lcd_framebuffer; // 0x100000
std::unique_ptr<uint32_t[]> m_words; // 0x800
std::unique_ptr<int16_t[]> m_samples; // 0x1000
inline void ATTR_PRINTF(3,4) verboselog(int n_level, const char *s_fmt, ... );
};
DECLARE_DEVICE_TYPE(PXA255_PERIPHERALS, pxa255_periphs_device)

View File

@ -88,24 +88,14 @@ READ32_MEMBER(_39in1_state::eeprom_r)
return (m_eeprom->do_read() << 5) | (1 << 1); // Must be on. Probably a DIP switch.
}
WRITE32_MEMBER(_39in1_state::eeprom_set_w)
WRITE32_MEMBER(_39in1_state::eeprom_w)
{
if (BIT(data, 2))
if (BIT(mem_mask, 2))
m_eeprom->cs_write(ASSERT_LINE);
if (BIT(data, 3))
m_eeprom->clk_write(ASSERT_LINE);
if (BIT(data, 4))
m_eeprom->di_write(1);
}
WRITE32_MEMBER(_39in1_state::eeprom_clear_w)
{
if (BIT(data, 2))
m_eeprom->cs_write(ASSERT_LINE);
if (BIT(data, 3))
m_eeprom->clk_write(CLEAR_LINE);
if (BIT(data, 4))
m_eeprom->di_write(0);
if (BIT(mem_mask, 3))
m_eeprom->clk_write(BIT(data, 3) ? ASSERT_LINE : CLEAR_LINE);
if (BIT(mem_mask, 4))
m_eeprom->di_write(BIT(data, 4));
}
READ32_MEMBER(_39in1_state::cpld_r)
@ -206,12 +196,12 @@ void _39in1_state::_39in1_map(address_map &map)
map(0x00000000, 0x0007ffff).rom();
map(0x00400000, 0x005fffff).rom().region("data", 0);
map(0x04000000, 0x047fffff).rw(FUNC(_39in1_state::cpld_r), FUNC(_39in1_state::cpld_w));
map(0x40000000, 0x400002ff).rw(m_pxa_periphs, FUNC(pxa255_periphs_device::pxa255_dma_r), FUNC(pxa255_periphs_device::pxa255_dma_w));
map(0x40400000, 0x40400083).rw(m_pxa_periphs, FUNC(pxa255_periphs_device::pxa255_i2s_r), FUNC(pxa255_periphs_device::pxa255_i2s_w));
map(0x40a00000, 0x40a0001f).rw(m_pxa_periphs, FUNC(pxa255_periphs_device::pxa255_ostimer_r), FUNC(pxa255_periphs_device::pxa255_ostimer_w));
map(0x40d00000, 0x40d00017).rw(m_pxa_periphs, FUNC(pxa255_periphs_device::pxa255_intc_r), FUNC(pxa255_periphs_device::pxa255_intc_w));
map(0x40e00000, 0x40e0006b).rw(m_pxa_periphs, FUNC(pxa255_periphs_device::pxa255_gpio_r), FUNC(pxa255_periphs_device::pxa255_gpio_w));
map(0x44000000, 0x4400021f).rw(m_pxa_periphs, FUNC(pxa255_periphs_device::pxa255_lcd_r), FUNC(pxa255_periphs_device::pxa255_lcd_w));
map(0x40000000, 0x400002ff).rw(m_pxa_periphs, FUNC(pxa255_periphs_device::dma_r), FUNC(pxa255_periphs_device::dma_w));
map(0x40400000, 0x40400083).rw(m_pxa_periphs, FUNC(pxa255_periphs_device::i2s_r), FUNC(pxa255_periphs_device::i2s_w));
map(0x40a00000, 0x40a0001f).rw(m_pxa_periphs, FUNC(pxa255_periphs_device::ostimer_r), FUNC(pxa255_periphs_device::ostimer_w));
map(0x40d00000, 0x40d00017).rw(m_pxa_periphs, FUNC(pxa255_periphs_device::intc_r), FUNC(pxa255_periphs_device::intc_w));
map(0x40e00000, 0x40e0006b).rw(m_pxa_periphs, FUNC(pxa255_periphs_device::gpio_r), FUNC(pxa255_periphs_device::gpio_w));
map(0x44000000, 0x4400021f).rw(m_pxa_periphs, FUNC(pxa255_periphs_device::lcd_r), FUNC(pxa255_periphs_device::lcd_w));
map(0xa0000000, 0xa07fffff).ram().share("ram");
}
@ -281,9 +271,8 @@ void _39in1_state::_39in1(machine_config &config)
EEPROM_93C66_16BIT(config, "eeprom");
PXA255_PERIPHERALS(config, m_pxa_periphs, 200000000, m_maincpu);
m_pxa_periphs->gpio0_set_cb().set(FUNC(_39in1_state::eeprom_set_w));
m_pxa_periphs->gpio0_clear_cb().set(FUNC(_39in1_state::eeprom_clear_w));
m_pxa_periphs->gpio0_in_cb().set(FUNC(_39in1_state::eeprom_r));
m_pxa_periphs->gpio0_write().set(FUNC(_39in1_state::eeprom_w));
m_pxa_periphs->gpio0_read().set(FUNC(_39in1_state::eeprom_r));
}
void _39in1_state::_60in1(machine_config &config)

View File

@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Angelo Salese
// copyright-holders:Angelo Salese, Ryan Holtz
/****************************************************************************************************************************************
Sharp Zaurus PDA skeleton driver (SL, ARM/Linux based, 4th generation)
@ -7,9 +7,9 @@
TODO:
- PXA-255 ID opcode fails on this
- ARM TLB look-up errors?
- RTC irq doesn't fire?
- RTC IRQ doesn't fire?
- For whatever reason, after RTC check ARM executes invalid code at 0-0x200
- Dumps are questionable to say the least
- Dumps are questionable
=========================================================================================================================================
Sharp Zaurus
@ -1413,7 +1413,10 @@ Note:
#include "speaker.h"
#define MAIN_CLOCK XTAL(8'000'000)
#define SA1110_CLOCK 206000000
#define PXA250_CLOCK 400000000
#define PXA255_CLOCK 400000000
#define PXA270_CLOCK 416000000
class zaurus_state : public driver_device
{
@ -1425,74 +1428,59 @@ public:
, m_ram(*this, "ram")
{ }
void zaurus(machine_config &config);
void zaurus_base(machine_config &config);
void zaurus_sa1110(machine_config &config);
void zaurus_pxa250(machine_config &config);
void zaurus_pxa255(machine_config &config);
void zaurus_pxa270(machine_config &config);
private:
// driver_device overrides
virtual void machine_start() override;
virtual void machine_reset() override;
void zaurus_map(address_map &map);
// devices
required_device<pxa255_periphs_device> m_pxa_periphs;
required_device<cpu_device> m_maincpu;
required_shared_ptr<uint32_t> m_ram;
uint8_t m_rtc_tick;
DECLARE_READ32_MEMBER(pxa255_rtc_r);
DECLARE_WRITE32_MEMBER(pxa255_rtc_w);
DECLARE_READ32_MEMBER(rtc_r);
DECLARE_WRITE32_MEMBER(rtc_w);
TIMER_DEVICE_CALLBACK_MEMBER(rtc_irq_callback);
// screen updates
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
void zaurus_map(address_map &map);
// driver_device overrides
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
};
void zaurus_state::video_start()
READ32_MEMBER(zaurus_state::rtc_r)
{
}
uint32_t zaurus_state::screen_update( screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect )
{
return 0;
}
READ32_MEMBER(zaurus_state::pxa255_rtc_r)
{
printf("%08x\n",offset << 2);
osd_printf_debug("%08x\n", offset << 2);
return 0;
}
WRITE32_MEMBER(zaurus_state::pxa255_rtc_w)
WRITE32_MEMBER(zaurus_state::rtc_w)
{
printf("%08x %08x\n",offset << 2,data);
osd_printf_debug("%08x %08x\n", offset << 2, data);
}
void zaurus_state::zaurus_map(address_map &map)
{
map(0x00000000, 0x001fffff).ram().region("firmware", 0);
map(0x40900000, 0x4090000f).rw(FUNC(zaurus_state::pxa255_rtc_r), FUNC(zaurus_state::pxa255_rtc_w));
map(0x40000000, 0x400002ff).rw(m_pxa_periphs, FUNC(pxa255_periphs_device::pxa255_dma_r), FUNC(pxa255_periphs_device::pxa255_dma_w));
map(0x40400000, 0x40400083).rw(m_pxa_periphs, FUNC(pxa255_periphs_device::pxa255_i2s_r), FUNC(pxa255_periphs_device::pxa255_i2s_w));
map(0x40a00000, 0x40a0001f).rw(m_pxa_periphs, FUNC(pxa255_periphs_device::pxa255_ostimer_r), FUNC(pxa255_periphs_device::pxa255_ostimer_w));
map(0x40d00000, 0x40d00017).rw(m_pxa_periphs, FUNC(pxa255_periphs_device::pxa255_intc_r), FUNC(pxa255_periphs_device::pxa255_intc_w));
map(0x40e00000, 0x40e0006b).rw(m_pxa_periphs, FUNC(pxa255_periphs_device::pxa255_gpio_r), FUNC(pxa255_periphs_device::pxa255_gpio_w));
map(0x44000000, 0x4400021f).rw(m_pxa_periphs, FUNC(pxa255_periphs_device::pxa255_lcd_r), FUNC(pxa255_periphs_device::pxa255_lcd_w));
map(0x40900000, 0x4090000f).rw(FUNC(zaurus_state::rtc_r), FUNC(zaurus_state::rtc_w));
map(0x40000000, 0x400002ff).rw(m_pxa_periphs, FUNC(pxa255_periphs_device::dma_r), FUNC(pxa255_periphs_device::dma_w));
map(0x40400000, 0x40400083).rw(m_pxa_periphs, FUNC(pxa255_periphs_device::i2s_r), FUNC(pxa255_periphs_device::i2s_w));
map(0x40a00000, 0x40a0001f).rw(m_pxa_periphs, FUNC(pxa255_periphs_device::ostimer_r), FUNC(pxa255_periphs_device::ostimer_w));
map(0x40d00000, 0x40d00017).rw(m_pxa_periphs, FUNC(pxa255_periphs_device::intc_r), FUNC(pxa255_periphs_device::intc_w));
map(0x40e00000, 0x40e0006b).rw(m_pxa_periphs, FUNC(pxa255_periphs_device::gpio_r), FUNC(pxa255_periphs_device::gpio_w));
map(0x44000000, 0x4400021f).rw(m_pxa_periphs, FUNC(pxa255_periphs_device::lcd_r), FUNC(pxa255_periphs_device::lcd_w));
map(0xa0000000, 0xa07fffff).ram().share("ram");
}
static INPUT_PORTS_START( zaurus )
INPUT_PORTS_END
void zaurus_state::machine_start()
{
}
@ -1505,45 +1493,52 @@ void zaurus_state::machine_reset()
/* TODO: Hack */
TIMER_DEVICE_CALLBACK_MEMBER(zaurus_state::rtc_irq_callback)
{
#if 0
#if 1
m_rtc_tick++;
m_rtc_tick&=1;
m_rtc_tick &= 1;
if(m_rtc_tick & 1)
pxa255_set_irq_line(PXA255_INT_RTC_HZ,1);
m_pxa_periphs->set_irq_line(PXA255_INT_RTC_HZ, 1);
else
pxa255_set_irq_line(PXA255_INT_RTC_HZ,0);
m_pxa_periphs->set_irq_line(PXA255_INT_RTC_HZ, 0);
#else
(void)m_rtc_tick;
#endif
}
// TODO: main CPU differs greatly between versions!
void zaurus_state::zaurus(machine_config &config)
void zaurus_state::zaurus_base(machine_config &config)
{
/* basic machine hardware */
PXA255(config, m_maincpu, MAIN_CLOCK);
m_maincpu->set_addrmap(AS_PROGRAM, &zaurus_state::zaurus_map);
TIMER(config, "rtc_timer").configure_periodic(FUNC(zaurus_state::rtc_irq_callback), attotime::from_hz(XTAL(32'768)));
/* video hardware */
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
screen.set_refresh_hz(60);
screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500));
screen.set_screen_update(FUNC(zaurus_state::screen_update));
screen.set_size(32*8, 32*8);
screen.set_visarea(0*8, 32*8-1, 0*8, 32*8-1);
PALETTE(config, "palette").set_entries(8);
/* sound hardware */
SPEAKER(config, "mono").front_center();
// AY8910(config, "aysnd", MAIN_CLOCK/4).add_route(ALL_OUTPUTS, "mono", 0.30);
PXA255_PERIPHERALS(config, m_pxa_periphs, MAIN_CLOCK, m_maincpu);
}
void zaurus_state::zaurus_sa1110(machine_config &config)
{
SA1110(config, m_maincpu, SA1110_CLOCK);
PXA255_PERIPHERALS(config, m_pxa_periphs, SA1110_CLOCK, m_maincpu); // TODO: Correct peripherals
zaurus_base(config);
}
void zaurus_state::zaurus_pxa250(machine_config &config)
{
PXA255(config, m_maincpu, PXA250_CLOCK); // TODO: Correct CPU type
PXA255_PERIPHERALS(config, m_pxa_periphs, PXA250_CLOCK, m_maincpu); // TODO: Correct peripherals
zaurus_base(config);
}
void zaurus_state::zaurus_pxa255(machine_config &config)
{
PXA255(config, m_maincpu, PXA255_CLOCK);
PXA255_PERIPHERALS(config, m_pxa_periphs, PXA255_CLOCK, m_maincpu);
zaurus_base(config);
}
void zaurus_state::zaurus_pxa270(machine_config &config)
{
PXA255(config, m_maincpu, PXA270_CLOCK); // TODO: Correct CPU type
PXA255_PERIPHERALS(config, m_pxa_periphs, PXA270_CLOCK, m_maincpu); // TODO: Correct peripherals
zaurus_base(config);
}
/***************************************************************************
@ -1582,9 +1577,9 @@ ROM_START( zslc1000 )
ROM_LOAD( "openzaurus 3.5.3 - zimage-sharp sl-c1000-20050427214434.bin", 0x000000, 0x128980, BAD_DUMP CRC(1e1a9279) SHA1(909ac3f00385eced55822d6a155b79d9d25f43b3) )
ROM_END
COMP( 2002, zsl5500, 0, 0, zaurus, zaurus, zaurus_state, empty_init, "Sharp", "Zaurus SL-5500 \"Collie\"", MACHINE_IS_SKELETON )
COMP( 2002, zsl5600, 0, 0, zaurus, zaurus, zaurus_state, empty_init, "Sharp", "Zaurus SL-5600 / SL-B500 \"Poodle\"", MACHINE_IS_SKELETON )
COMP( 2003, zslc750, 0, 0, zaurus, zaurus, zaurus_state, empty_init, "Sharp", "Zaurus SL-C750 \"Shepherd\" (Japan)", MACHINE_IS_SKELETON )
COMP( 2004, zslc760, 0, 0, zaurus, zaurus, zaurus_state, empty_init, "Sharp", "Zaurus SL-C760 \"Husky\" (Japan)", MACHINE_IS_SKELETON )
COMP( 200?, zslc3000, 0, 0, zaurus, zaurus, zaurus_state, empty_init, "Sharp", "Zaurus SL-C3000 \"Spitz\" (Japan)", MACHINE_IS_SKELETON )
COMP( 200?, zslc1000, 0, 0, zaurus, zaurus, zaurus_state, empty_init, "Sharp", "Zaurus SL-C3000 \"Akita\" (Japan)", MACHINE_IS_SKELETON )
COMP( 2002, zsl5500, 0, 0, zaurus_sa1110, zaurus, zaurus_state, empty_init, "Sharp", "Zaurus SL-5500 \"Collie\"", MACHINE_IS_SKELETON )
COMP( 2002, zsl5600, 0, 0, zaurus_pxa250, zaurus, zaurus_state, empty_init, "Sharp", "Zaurus SL-5600 / SL-B500 \"Poodle\"", MACHINE_IS_SKELETON )
COMP( 2003, zslc750, 0, 0, zaurus_pxa255, zaurus, zaurus_state, empty_init, "Sharp", "Zaurus SL-C750 \"Shepherd\" (Japan)", MACHINE_IS_SKELETON )
COMP( 2004, zslc760, 0, 0, zaurus_pxa255, zaurus, zaurus_state, empty_init, "Sharp", "Zaurus SL-C760 \"Husky\" (Japan)", MACHINE_IS_SKELETON )
COMP( 200?, zslc3000, 0, 0, zaurus_pxa270, zaurus, zaurus_state, empty_init, "Sharp", "Zaurus SL-C3000 \"Spitz\" (Japan)", MACHINE_IS_SKELETON )
COMP( 200?, zslc1000, 0, 0, zaurus_pxa270, zaurus, zaurus_state, empty_init, "Sharp", "Zaurus SL-C3000 \"Akita\" (Japan)", MACHINE_IS_SKELETON )