arm.c: converted to use inline configs. nw.

This commit is contained in:
Fabio Priuli 2014-04-30 14:28:34 +00:00
parent 73e76f805a
commit 8b7a48ca8c
3 changed files with 10 additions and 33 deletions

View File

@ -230,6 +230,7 @@ arm_cpu_device::arm_cpu_device(const machine_config &mconfig, const char *tag, d
: cpu_device(mconfig, ARM, "ARM", tag, owner, clock, "arm", __FILE__) : cpu_device(mconfig, ARM, "ARM", tag, owner, clock, "arm", __FILE__)
, m_program_config("program", ENDIANNESS_LITTLE, 32, 26, 0) , m_program_config("program", ENDIANNESS_LITTLE, 32, 26, 0)
, m_endian(ENDIANNESS_LITTLE) , m_endian(ENDIANNESS_LITTLE)
, m_copro_type(ARM_COPRO_TYPE_UNKNOWN_CP15)
{ {
memset(m_sArmRegister, 0x00, sizeof(m_sArmRegister)); memset(m_sArmRegister, 0x00, sizeof(m_sArmRegister));
} }
@ -239,6 +240,7 @@ arm_cpu_device::arm_cpu_device(const machine_config &mconfig, device_type type,
: cpu_device(mconfig, type, name, tag, owner, clock, shortname, source) : cpu_device(mconfig, type, name, tag, owner, clock, shortname, source)
, m_program_config("program", endianness, 32, 26, 0) , m_program_config("program", endianness, 32, 26, 0)
, m_endian(endianness) , m_endian(endianness)
, m_copro_type(ARM_COPRO_TYPE_UNKNOWN_CP15)
{ {
memset(m_sArmRegister, 0x00, sizeof(m_sArmRegister)); memset(m_sArmRegister, 0x00, sizeof(m_sArmRegister));
} }
@ -312,20 +314,6 @@ void arm_cpu_device::SetModeRegister( int mode, int rIndex, UINT32 value )
/***************************************************************************/ /***************************************************************************/
void arm_cpu_device::device_config_complete()
{
// inherit a copy of the static data
const arm_interface *intf = reinterpret_cast<const arm_interface *>(static_config());
if (intf != NULL)
*static_cast<arm_interface *>(this) = *intf;
// or set default if none provided
else
{
coprotype = ARM_COPRO_TYPE_UNKNOWN_CP15;
}
}
void arm_cpu_device::device_reset() void arm_cpu_device::device_reset()
{ {
for ( int i = 0; i < 27; i++ ) for ( int i = 0; i < 27; i++ )
@ -430,7 +418,7 @@ void arm_cpu_device::execute_run()
} }
else if ((insn & 0x0f000000u) == 0x0e000000u) /* Coprocessor */ else if ((insn & 0x0f000000u) == 0x0e000000u) /* Coprocessor */
{ {
if(coprotype == 1) if (m_copro_type == ARM_COPRO_TYPE_VL86C020)
HandleCoProVL86C020(insn); HandleCoProVL86C020(insn);
else else
HandleCoPro(insn); HandleCoPro(insn);

View File

@ -20,13 +20,8 @@ enum
ARM_COPRO_TYPE_VL86C020 ARM_COPRO_TYPE_VL86C020
}; };
struct arm_interface #define MCFG_ARM_COPRO(_type) \
{ arm_cpu_device::set_copro_type(*device, _type);
UINT8 coprotype;
};
#define ARM_INTERFACE(name) \
const arm_interface (name) =
enum enum
@ -39,17 +34,17 @@ enum
}; };
class arm_cpu_device : public cpu_device, class arm_cpu_device : public cpu_device
public arm_interface
{ {
public: public:
// construction/destruction // construction/destruction
arm_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); arm_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
arm_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source, endianness_t endianness); arm_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source, endianness_t endianness);
static void set_copro_type(device_t &device, int type) { downcast<arm_cpu_device &>(device).m_copro_type = type; }
protected: protected:
// device-level overrides // device-level overrides
virtual void device_config_complete();
virtual void device_start(); virtual void device_start();
virtual void device_reset(); virtual void device_reset();
@ -81,6 +76,7 @@ protected:
address_space *m_program; address_space *m_program;
direct_read_data *m_direct; direct_read_data *m_direct;
endianness_t m_endian; endianness_t m_endian;
UINT8 m_copro_type;
void cpu_write32( int addr, UINT32 data ); void cpu_write32( int addr, UINT32 data );
void cpu_write8( int addr, UINT8 data ); void cpu_write8( int addr, UINT8 data );
@ -105,7 +101,6 @@ protected:
int storeDec(UINT32 pat, UINT32 rbv); int storeDec(UINT32 pat, UINT32 rbv);
static UINT32 BCDToDecimal(UINT32 value); static UINT32 BCDToDecimal(UINT32 value);
static UINT32 DecimalToBCD(UINT32 value); static UINT32 DecimalToBCD(UINT32 value);
}; };

View File

@ -350,17 +350,11 @@ WRITE_LINE_MEMBER( archimedes_state::a310_kart_rx_w )
archimedes_clear_irq_b(ARCHIMEDES_IRQB_KBD_XMIT_EMPTY); archimedes_clear_irq_b(ARCHIMEDES_IRQB_KBD_XMIT_EMPTY);
} }
static ARM_INTERFACE( a310_config )
{
ARM_COPRO_TYPE_VL86C020
};
static MACHINE_CONFIG_START( a310, a310_state ) static MACHINE_CONFIG_START( a310, a310_state )
/* basic machine hardware */ /* basic machine hardware */
MCFG_CPU_ADD("maincpu", ARM, 8000000) /* 8 MHz */ MCFG_CPU_ADD("maincpu", ARM, 8000000) /* 8 MHz */
MCFG_CPU_PROGRAM_MAP(a310_mem) MCFG_CPU_PROGRAM_MAP(a310_mem)
MCFG_CPU_CONFIG(a310_config) MCFG_ARM_COPRO(ARM_COPRO_TYPE_VL86C020)
MCFG_DEVICE_ADD("kart", AAKART, 8000000/256) MCFG_DEVICE_ADD("kart", AAKART, 8000000/256)
MCFG_AAKART_OUT_TX_CB(WRITELINE(archimedes_state, a310_kart_tx_w)) MCFG_AAKART_OUT_TX_CB(WRITELINE(archimedes_state, a310_kart_tx_w))