Previous 199869 Revisions Next

r20534 Sunday 27th January, 2013 at 15:54:04 UTC by David Haywood
ghosteo.c - reduce tag usage
( doesn't really help performance in this even if it was a big hitter, the 200Mhz ARM has more to do with it .. also QS1000 still needs hooking up here )
[src/emu/machine]s3c2400.h s3c2410.h s3c2440.h s3c24xx.c
[src/mame/drivers]ghosteo.c

trunk/src/mame/drivers/ghosteo.c
r20533r20534
4949- Compiler : ADS, SDT
5050
5151
52ToDo: hook up QS1000
53
54
5255*/
5356
5457#include "emu.h"
r20533r20534
8083public:
8184   ghosteo_state(const machine_config &mconfig, device_type type, const char *tag)
8285      : driver_device(mconfig, type, tag) ,
83      m_system_memory(*this, "systememory"){ }
86      m_system_memory(*this, "systememory"),
87      m_i2cmem(*this, "i2cmem")
88   { }
8489
8590   required_shared_ptr<UINT32> m_system_memory;
91   required_device<i2cmem_device> m_i2cmem;
92
8693   int m_security_count;
8794   UINT32 m_bballoon_port[20];
8895   struct nand_t m_nand;
r20533r20534
9198   DECLARE_READ32_MEMBER(touryuu_port_10000000_r);
9299
93100   int m_rom_pagesize;
101   UINT8* m_flash;
102   device_t* m_s3c2410;
94103   DECLARE_DRIVER_INIT(touryuu);
95104   DECLARE_DRIVER_INIT(bballoon);
105   virtual void machine_start();
96106   virtual void machine_reset();
97107};
98108
109         
99110
100111
101112/*
r20533r20534
282293      break;
283294      case NAND_M_READ :
284295      {
285         UINT8 *flash = (UINT8 *)space.machine().root_device().memregion( "user1")->base();
286296         if (nand.byte_addr < state->m_rom_pagesize)
287297         {
288            data = *(flash + nand.page_addr * state->m_rom_pagesize + nand.byte_addr);
298            data = *(state->m_flash + nand.page_addr * state->m_rom_pagesize + nand.byte_addr);
289299         }
290300         else
291301         {
292302            if ((nand.byte_addr >= 0x200) && (nand.byte_addr < 0x204))
293303            {
294304               UINT8 mecc[4];
295               s3c2410_nand_calculate_mecc( flash + nand.page_addr * 0x200, 0x200, mecc);
305               s3c2410_nand_calculate_mecc( state->m_flash + nand.page_addr * 0x200, 0x200, mecc);
296306               data = mecc[nand.byte_addr-0x200];
297307            }
298308            else
r20533r20534
328338
329339static WRITE_LINE_DEVICE_HANDLER( s3c2410_i2c_scl_w )
330340{
331   device_t *i2cmem = device->machine().device( "i2cmem");
341   ghosteo_state *sta = device->machine().driver_data<ghosteo_state>();
332342//  logerror( "s3c2410_i2c_scl_w %d\n", state ? 1 : 0);
333   i2cmem_scl_write( i2cmem, state);
343   i2cmem_scl_write( sta->m_i2cmem, state);
334344}
335345
336346static READ_LINE_DEVICE_HANDLER( s3c2410_i2c_sda_r )
337347{
338   device_t *i2cmem = device->machine().device( "i2cmem");
348   ghosteo_state *sta = device->machine().driver_data<ghosteo_state>();
339349   int state;
340   state = i2cmem_sda_read( i2cmem);
350   state = i2cmem_sda_read( sta->m_i2cmem );
341351//  logerror( "s3c2410_i2c_sda_r %d\n", state ? 1 : 0);
342352   return state;
343353}
344354
345355static WRITE_LINE_DEVICE_HANDLER( s3c2410_i2c_sda_w )
346356{
347   device_t *i2cmem = device->machine().device( "i2cmem");
357   ghosteo_state *sta = device->machine().driver_data<ghosteo_state>();
348358//  logerror( "s3c2410_i2c_sda_w %d\n", state ? 1 : 0);
349   i2cmem_sda_write( i2cmem, state);
359   i2cmem_sda_write( sta->m_i2cmem, state);
350360}
351361
352362WRITE32_MEMBER(ghosteo_state::sound_w)
r20533r20534
553563   I2CMEM_SLAVE_ADDRESS, 0, 1024
554564};
555565
556device_t* s3c2410;
557566
567
558568READ32_MEMBER(ghosteo_state::bballoon_speedup_r)
559569{
560   UINT32 ret = s3c2410_lcd_r(s3c2410, space, offset+0x10/4, mem_mask);
570   UINT32 ret = s3c2410_lcd_r(m_s3c2410, space, offset+0x10/4, mem_mask);
561571
562572
563573   int pc = space.device().safe_pc();
r20533r20534
579589   return ret;
580590}
581591
592void ghosteo_state::machine_start()
593{
594   m_flash = (UINT8 *)machine().root_device().memregion( "user1")->base();
595}
596
582597void ghosteo_state::machine_reset()
583598{
584599   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x4d000010, 0x4d000013,read32_delegate(FUNC(ghosteo_state::bballoon_speedup_r), this));
585   s3c2410 = machine().device("s3c2410");
600   m_s3c2410 = machine().device("s3c2410");
586601}
587602
588603static MACHINE_CONFIG_START( ghosteo, ghosteo_state )
trunk/src/emu/machine/s3c2440.h
r20533r20534
963963   s3c24xx_spi_t spi[S3C24XX_SPI_COUNT];
964964   s3c24xx_sdi_t sdi;
965965   s3c24xx_ac97_t ac97;
966   device_t *m_cpu;
966967};
967968
968969#endif
trunk/src/emu/machine/s3c24xx.c
r20533r20534
127127
128128static void s3c24xx_reset( device_t *device)
129129{
130   device_t *cpu = device->machine().device("maincpu");
130   s3c24xx_t *s3c24xx = get_token( device );
131131   verboselog( device->machine(), 1, "reset\n");
132   cpu->reset();
132   s3c24xx->m_cpu->reset();
133133   device->reset();
134134}
135135
r20533r20534
301301static UINT32 s3c24xx_lcd_dma_read( device_t *device)
302302{
303303   s3c24xx_t *s3c24xx = get_token( device);
304   address_space& space = device->machine().device( "maincpu")->memory().space( AS_PROGRAM);
304   address_space& space = m_cpu->memory().space( AS_PROGRAM);
305305   UINT8 *vram, data[4];
306306   vram = (UINT8 *)space.get_read_ptr( s3c24xx->lcd.vramaddr_cur);
307307   for (int i = 0; i < 2; i++)
r20533r20534
345345static UINT32 s3c24xx_lcd_dma_read( device_t *device)
346346{
347347   s3c24xx_t *s3c24xx = get_token( device);
348   address_space& space = device->machine().device( "maincpu")->memory().space( AS_PROGRAM);
348   address_space& space = s3c24xx->m_cpu->memory().space( AS_PROGRAM);
349349   UINT8 *vram, data[4];
350350   vram = (UINT8 *)space.get_read_ptr( s3c24xx->lcd.vramaddr_cur);
351351   for (int i = 0; i < 2; i++)
r20533r20534
11381138      case S3C24XX_MPLLCON :
11391139      {
11401140         verboselog( device->machine(), 5, "CLKPOW - fclk %d hclk %d pclk %d\n", s3c24xx_get_fclk( device), s3c24xx_get_hclk( device), s3c24xx_get_pclk( device));
1141         device->machine().device( "maincpu")->set_unscaled_clock(s3c24xx_get_fclk( device) * CLOCK_MULTIPLIER);
1141         s3c24xx->m_cpu->set_unscaled_clock(s3c24xx_get_fclk( device) * CLOCK_MULTIPLIER);
11421142      }
11431143      break;
11441144      case S3C24XX_CLKSLOW :
11451145      {
11461146         verboselog( device->machine(), 5, "CLKPOW - fclk %d hclk %d pclk %d\n", s3c24xx_get_fclk( device), s3c24xx_get_hclk( device), s3c24xx_get_pclk( device));
1147         device->machine().device( "maincpu")->set_unscaled_clock(s3c24xx_get_fclk( device) * CLOCK_MULTIPLIER);
1147         s3c24xx->m_cpu->set_unscaled_clock(s3c24xx_get_fclk( device) * CLOCK_MULTIPLIER);
11481148      }
11491149      break;
11501150   }
r20533r20534
11911191         if (s3c24xx->irq.line_irq != ASSERT_LINE)
11921192         {
11931193            verboselog( device->machine(), 5, "ARM7_IRQ_LINE -> ASSERT_LINE\n");
1194            device->machine().device("maincpu")->execute().set_input_line(ARM7_IRQ_LINE, ASSERT_LINE);
1194            s3c24xx->m_cpu->execute().set_input_line(ARM7_IRQ_LINE, ASSERT_LINE);
11951195            s3c24xx->irq.line_irq = ASSERT_LINE;
11961196         }
11971197      }
r20533r20534
12011201         {
12021202            verboselog( device->machine(), 5, "srcpnd %08X intmsk %08X intmod %08X\n", s3c24xx->irq.regs.srcpnd, s3c24xx->irq.regs.intmsk, s3c24xx->irq.regs.intmod);
12031203            verboselog( device->machine(), 5, "ARM7_IRQ_LINE -> CLEAR_LINE\n");
1204            device->machine().device("maincpu")->execute().set_input_line(ARM7_IRQ_LINE, CLEAR_LINE);
1204            s3c24xx->m_cpu->execute().set_input_line(ARM7_IRQ_LINE, CLEAR_LINE);
12051205            s3c24xx->irq.line_irq = CLEAR_LINE;
12061206         }
12071207      }
r20533r20534
12201220      if (s3c24xx->irq.line_fiq != ASSERT_LINE)
12211221      {
12221222         verboselog( device->machine(), 5, "ARM7_FIRQ_LINE -> ASSERT_LINE\n");
1223         device->machine().device("maincpu")->execute().set_input_line(ARM7_FIRQ_LINE, ASSERT_LINE);
1223         s3c24xx->m_cpu->execute().set_input_line(ARM7_FIRQ_LINE, ASSERT_LINE);
12241224         s3c24xx->irq.line_fiq = ASSERT_LINE;
12251225      }
12261226   }
r20533r20534
12291229      if (s3c24xx->irq.line_fiq != CLEAR_LINE)
12301230      {
12311231         verboselog( device->machine(), 5, "ARM7_FIRQ_LINE -> CLEAR_LINE\n");
1232         device->machine().device("maincpu")->execute().set_input_line(ARM7_FIRQ_LINE, CLEAR_LINE);
1232         s3c24xx->m_cpu->execute().set_input_line(ARM7_FIRQ_LINE, CLEAR_LINE);
12331233         s3c24xx->irq.line_fiq = CLEAR_LINE;
12341234      }
12351235   }
r20533r20534
16111611   s3c24xx_t *s3c24xx = get_token( device);
16121612   s3c24xx_dma_regs_t *regs = &s3c24xx->dma[ch].regs;
16131613   UINT32 curr_tc, curr_src, curr_dst;
1614   address_space &space = device->machine().device( "maincpu")->memory().space( AS_PROGRAM);
1614   address_space &space = s3c24xx->m_cpu->memory().space( AS_PROGRAM);
16151615   int dsz, inc_src, inc_dst, servmode, tsz;
16161616   const UINT32 ch_int[] = { S3C24XX_INT_DMA0, S3C24XX_INT_DMA1, S3C24XX_INT_DMA2, S3C24XX_INT_DMA3};
16171617   verboselog( device->machine(), 5, "DMA %d trigger\n", ch);
r20533r20534
36793679static DEVICE_START( s3c24xx )
36803680{
36813681   s3c24xx_t *s3c24xx = get_token( device);
3682   
3683   s3c24xx->m_cpu = device->machine().device( "maincpu");
3684
36823685   verboselog( device->machine(), 1, "s3c24xx device start\n");
36833686   s3c24xx->iface = (const s3c24xx_interface *)device->static_config();
36843687   for (int i = 0; i < 5; i++)
r20533r20534
37003703   int om1 = iface_core_pin_r( device, S3C24XX_CORE_PIN_OM1);
37013704   if ((om0 == 0) && (om1 == 0))
37023705   {
3703      address_space &space = device->machine().device( "maincpu")->memory().space( AS_PROGRAM);
3706      address_space &space = s3c24xx->m_cpu->memory().space( AS_PROGRAM);
37043707      space.install_ram( 0x00000000, 0x00000fff, s3c24xx->steppingstone);
37053708      space.install_ram( 0x40000000, 0x40000fff, s3c24xx->steppingstone);
37063709   }
trunk/src/emu/machine/s3c2400.h
r20533r20534
745745   s3c24xx_adc_t adc;
746746   s3c24xx_spi_t spi[S3C24XX_SPI_COUNT];
747747   s3c24xx_mmc_t mmc;
748   device_t *m_cpu;
748749};
749750
750751#endif
trunk/src/emu/machine/s3c2410.h
r20533r20534
892892   s3c24xx_adc_t adc;
893893   s3c24xx_spi_t spi[S3C24XX_SPI_COUNT];
894894   s3c24xx_sdi_t sdi;
895   device_t *m_cpu;
895896};
896897
897898#endif

Previous 199869 Revisions Next


© 1997-2024 The MAME Team