diff options
Diffstat (limited to 'src/emu/cpu/powerpc/ppccom.c')
| -rw-r--r-- | src/emu/cpu/powerpc/ppccom.c | 229 |
1 files changed, 113 insertions, 116 deletions
diff --git a/src/emu/cpu/powerpc/ppccom.c b/src/emu/cpu/powerpc/ppccom.c index 1d1eee99d4c..1b41c2c0c22 100644 --- a/src/emu/cpu/powerpc/ppccom.c +++ b/src/emu/cpu/powerpc/ppccom.c @@ -214,22 +214,19 @@ ppc_device::ppc_device(const machine_config &mconfig, device_type type, const ch , m_core(NULL) , m_bus_freq_multiplier(1) , m_vtlb(NULL) - , m_flavor(flavor) - , m_cap(cap) - , m_tb_divisor(tb_divisor) - , m_dcstore_handler(NULL) - , m_cache(CACHE_SIZE + sizeof(internal_ppc_state)) - , m_drcuml(NULL) - , m_drcfe(NULL) + , m_flavor(flavor)
+ , m_cap(cap)
+ , m_tb_divisor(tb_divisor)
+ , m_cache(CACHE_SIZE + sizeof(internal_ppc_state))
+ , m_drcuml(NULL)
+ , m_drcfe(NULL)
, m_drcoptions(0) -{ - m_program_config.m_logaddr_width = 32; - m_program_config.m_page_shift = POWERPC_MIN_PAGE_SHIFT; - memset(m_ext_dma_read_handler, 0, sizeof(m_ext_dma_read_handler)); - memset(m_ext_dma_write_handler, 0, sizeof(m_ext_dma_write_handler)); -} - -//ppc403_device::ppc403_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) +{
+ m_program_config.m_logaddr_width = 32;
+ m_program_config.m_page_shift = POWERPC_MIN_PAGE_SHIFT;
+}
+
+//ppc403_device::ppc403_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
// : ppc_device(mconfig, PPC403, "PPC403", tag, owner, clock, "ppc403", 32?, 64?) //{ //} @@ -1241,15 +1238,15 @@ offs_t ppc_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *opro ppccom_dcstore_callback - call the dcstore callback if installed -------------------------------------------------*/ - -void ppc_device::ppccom_dcstore_callback() -{ - if (m_dcstore_handler != NULL) - { - m_dcstore_handler(this, m_core->param0); - } -} - +
+void ppc_device::ppccom_dcstore_callback()
+{
+ if (!m_dcstore_cb.isnull())
+ {
+ m_dcstore_cb(*m_program, m_core->param0, 0, 0xffffffff);
+ }
+}
+
/*************************************************************************** TLB HANDLING @@ -2061,15 +2058,15 @@ TIMER_CALLBACK_MEMBER( ppc_device::decrementer_int_callback ) /*------------------------------------------------- ppc_set_dcstore_callback - installs a callback - for detecting datacache stores with dcbst --------------------------------------------------*/ - -void ppc_device::ppc_set_dcstore_callback(ppc_dcstore_handler handler) -{ - m_dcstore_handler = handler; -} - - + for detecting datacache stores with dcbst
+-------------------------------------------------*/
+
+void ppc_device::ppc_set_dcstore_callback(write32_delegate callback)
+{
+ m_dcstore_cb = callback;
+}
+
+
void ppc_device::execute_set_input(int inputnum, int state) { switch (inputnum) @@ -2288,38 +2285,38 @@ TIMER_CALLBACK_MEMBER( ppc_device::ppc4xx_buffered_dma_callback ) { /* byte transfer */ case 1: - do - { - UINT8 data = 0; - if (m_ext_dma_read_handler[dmachan] != NULL) - data = (*m_ext_dma_read_handler[dmachan])(this, 1); - m_program->write_byte(dmaregs[DCR4XX_DMADA0], data); - dmaregs[DCR4XX_DMADA0] += destinc; - } while (!ppc4xx_dma_decrement_count(dmachan)); + do
+ {
+ UINT8 data = 0;
+ if (!m_ext_dma_read_cb[dmachan].isnull())
+ data = (m_ext_dma_read_cb[dmachan])(*m_program, 1, 0xffffffff);
+ m_program->write_byte(dmaregs[DCR4XX_DMADA0], data);
+ dmaregs[DCR4XX_DMADA0] += destinc;
+ } while (!ppc4xx_dma_decrement_count(dmachan));
break; /* word transfer */ case 2: - do - { - UINT16 data = 0; - if (m_ext_dma_read_handler[dmachan] != NULL) - data = (*m_ext_dma_read_handler[dmachan])(this, 2); - m_program->write_word(dmaregs[DCR4XX_DMADA0], data); - dmaregs[DCR4XX_DMADA0] += destinc; - } while (!ppc4xx_dma_decrement_count(dmachan)); + do
+ {
+ UINT16 data = 0;
+ if (!m_ext_dma_read_cb[dmachan].isnull())
+ data = (m_ext_dma_read_cb[dmachan])(*m_program, 2, 0xffffffff);
+ m_program->write_word(dmaregs[DCR4XX_DMADA0], data);
+ dmaregs[DCR4XX_DMADA0] += destinc;
+ } while (!ppc4xx_dma_decrement_count(dmachan));
break; /* dword transfer */ case 4: - do - { - UINT32 data = 0; - if (m_ext_dma_read_handler[dmachan] != NULL) - data = (*m_ext_dma_read_handler[dmachan])(this, 4); - m_program->write_dword(dmaregs[DCR4XX_DMADA0], data); - dmaregs[DCR4XX_DMADA0] += destinc; - } while (!ppc4xx_dma_decrement_count(dmachan)); + do
+ {
+ UINT32 data = 0;
+ if (!m_ext_dma_read_cb[dmachan].isnull())
+ data = (m_ext_dma_read_cb[dmachan])(*m_program, 4, 0xffffffff);
+ m_program->write_dword(dmaregs[DCR4XX_DMADA0], data);
+ dmaregs[DCR4XX_DMADA0] += destinc;
+ } while (!ppc4xx_dma_decrement_count(dmachan));
break; } } @@ -2332,36 +2329,36 @@ TIMER_CALLBACK_MEMBER( ppc_device::ppc4xx_buffered_dma_callback ) { /* byte transfer */ case 1: - do - { - UINT8 data = m_program->read_byte(dmaregs[DCR4XX_DMADA0]); - if (m_ext_dma_write_handler[dmachan] != NULL) - (*m_ext_dma_write_handler[dmachan])(this, 1, data); - dmaregs[DCR4XX_DMADA0] += destinc; - } while (!ppc4xx_dma_decrement_count(dmachan)); - break; + do
+ {
+ UINT8 data = m_program->read_byte(dmaregs[DCR4XX_DMADA0]);
+ if (!m_ext_dma_write_cb[dmachan].isnull())
+ (m_ext_dma_write_cb[dmachan])(*m_program, 1, data, 0xffffffff);
+ dmaregs[DCR4XX_DMADA0] += destinc;
+ } while (!ppc4xx_dma_decrement_count(dmachan));
+ break;
/* word transfer */ case 2: - do - { - UINT16 data = m_program->read_word(dmaregs[DCR4XX_DMADA0]); - if (m_ext_dma_write_handler[dmachan] != NULL) - (*m_ext_dma_write_handler[dmachan])(this, 2, data); - dmaregs[DCR4XX_DMADA0] += destinc; - } while (!ppc4xx_dma_decrement_count(dmachan)); - break; + do
+ {
+ UINT16 data = m_program->read_word(dmaregs[DCR4XX_DMADA0]);
+ if (!m_ext_dma_write_cb[dmachan].isnull())
+ (m_ext_dma_write_cb[dmachan])(*m_program, 2, data, 0xffffffff);
+ dmaregs[DCR4XX_DMADA0] += destinc;
+ } while (!ppc4xx_dma_decrement_count(dmachan));
+ break;
/* dword transfer */ case 4: - do - { - UINT32 data = m_program->read_dword(dmaregs[DCR4XX_DMADA0]); - if (m_ext_dma_write_handler[dmachan] != NULL) - (*m_ext_dma_write_handler[dmachan])(this, 4, data); - dmaregs[DCR4XX_DMADA0] += destinc; - } while (!ppc4xx_dma_decrement_count(dmachan)); - break; + do
+ {
+ UINT32 data = m_program->read_dword(dmaregs[DCR4XX_DMADA0]);
+ if (!m_ext_dma_write_cb[dmachan].isnull())
+ (m_ext_dma_write_cb[dmachan])(*m_program, 4, data, 0xffffffff);
+ dmaregs[DCR4XX_DMADA0] += destinc;
+ } while (!ppc4xx_dma_decrement_count(dmachan));
+ break;
} } } @@ -2677,14 +2674,14 @@ TIMER_CALLBACK_MEMBER( ppc_device::ppc4xx_spu_callback ) int operation = (m_spu.regs[SPU4XX_TX_COMMAND] >> 5) & 3; /* if we have data to transmit, do it now */ - if (!(m_spu.regs[SPU4XX_LINE_STATUS] & 0x04)) - { - /* if we have a transmit handler, send it that way */ - if (m_spu.tx_handler != NULL) - (*m_spu.tx_handler)(this, m_spu.txbuf); - - /* indicate that we have moved it to the shift register */ - m_spu.regs[SPU4XX_LINE_STATUS] |= 0x04; + if (!(m_spu.regs[SPU4XX_LINE_STATUS] & 0x04))
+ {
+ /* if we have a transmit handler, send it that way */
+ if (!m_spu.tx_cb.isnull())
+ (m_spu.tx_cb)(*m_program, 0, m_spu.txbuf, 0xff);
+
+ /* indicate that we have moved it to the shift register */
+ m_spu.regs[SPU4XX_LINE_STATUS] |= 0x04;
m_spu.regs[SPU4XX_LINE_STATUS] &= ~0x02; } @@ -2823,15 +2820,15 @@ WRITE8_MEMBER( ppc4xx_device::ppc4xx_spu_w ) /*------------------------------------------------- ppc4xx_spu_set_tx_handler - PowerPC 4XX- - specific TX handler configuration --------------------------------------------------*/ - -void ppc4xx_device::ppc4xx_spu_set_tx_handler(ppc4xx_spu_tx_handler handler) -{ - m_spu.tx_handler = handler; -} - - + specific TX handler configuration
+-------------------------------------------------*/
+
+void ppc4xx_device::ppc4xx_spu_set_tx_handler(write8_delegate callback)
+{
+ m_spu.tx_cb = callback;
+}
+
+
/*------------------------------------------------- ppc4xx_spu_receive_byte - PowerPC 4XX- specific serial byte receive @@ -2844,26 +2841,26 @@ void ppc4xx_device::ppc4xx_spu_receive_byte(UINT8 byteval) /*------------------------------------------------- ppc4xx_set_dma_read_handler - PowerPC 4XX- - specific external DMA read handler configuration --------------------------------------------------*/ - -void ppc4xx_device::ppc4xx_set_dma_read_handler(int channel, ppc4xx_dma_read_handler handler, int rate) -{ - m_ext_dma_read_handler[channel] = handler; - m_buffered_dma_rate[channel] = rate; -} - + specific external DMA read handler configuration
+-------------------------------------------------*/
+
+void ppc4xx_device::ppc4xx_set_dma_read_handler(int channel, read32_delegate callback, int rate)
+{
+ m_ext_dma_read_cb[channel] = callback;
+ m_buffered_dma_rate[channel] = rate;
+}
+
/*------------------------------------------------- ppc4xx_set_dma_write_handler - PowerPC 4XX- - specific external DMA write handler configuration --------------------------------------------------*/ - -void ppc4xx_device::ppc4xx_set_dma_write_handler(int channel, ppc4xx_dma_write_handler handler, int rate) -{ - m_ext_dma_write_handler[channel] = handler; - m_buffered_dma_rate[channel] = rate; -} - + specific external DMA write handler configuration
+-------------------------------------------------*/
+
+void ppc4xx_device::ppc4xx_set_dma_write_handler(int channel, write32_delegate callback, int rate)
+{
+ m_ext_dma_write_cb[channel] = callback;
+ m_buffered_dma_rate[channel] = rate;
+}
+
/*------------------------------------------------- ppc4xx_set_dcr_read_handler -------------------------------------------------*/ |
