removed static config from avr8. nw.

This commit is contained in:
Fabio Priuli 2014-09-21 16:25:33 +00:00
parent d2fd226800
commit d7d4d78699
6 changed files with 22 additions and 58 deletions

View File

@ -635,12 +635,13 @@ avr8_device::avr8_device(const machine_config &mconfig, const char *name, const
m_program_config("program", ENDIANNESS_LITTLE, 8, 22),
m_data_config("data", ENDIANNESS_LITTLE, 8, 16, 0, internal_map),
m_io_config("io", ENDIANNESS_LITTLE, 8, 4),
m_eeprom_tag(NULL),
m_eeprom(NULL),
m_cpu_type(cpu_type),
m_lfuses(0x62),
m_hfuses(0x99),
m_efuses(0xFF),
m_lock_bits(0xFF),
m_cpu_type(cpu_type),
m_lfuses(0x62),
m_hfuses(0x99),
m_efuses(0xFF),
m_lock_bits(0xFF),
m_pc(0),
m_spi_active(false),
m_spi_prescale(0),
@ -660,17 +661,6 @@ avr8_device::avr8_device(const machine_config &mconfig, const char *name, const
}
//-------------------------------------------------
// static_set_config - set the configuration
// structure
//-------------------------------------------------
void avr8_device::static_set_config(device_t &device, const avr8_config &config)
{
avr8_device &avr8 = downcast<avr8_device &>(device);
static_cast<avr8_config &>(avr8) = config;
}
//-------------------------------------------------
// static_set_low_fuses
//-------------------------------------------------
@ -833,7 +823,7 @@ void avr8_device::device_start()
// set our instruction counter
m_icountptr = &m_icount;
m_eeprom = machine().root_device().memregion(eeprom_region)->base();
m_eeprom = machine().root_device().memregion(m_eeprom_tag)->base();
}
//-------------------------------------------------

View File

@ -40,12 +40,6 @@
#ifndef __AVR8_H__
#define __AVR8_H__
//**************************************************************************
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
#define MCFG_CPU_AVR8_CONFIG(_config) \
avr8_device::static_set_config(*device, _config);
//**************************************************************************
// FUSE BITS CONFIGURATION MACROS
@ -63,32 +57,31 @@
#define MCFG_CPU_AVR8_LOCK(byte) \
((avr8_device*) device)->set_lock_bits(byte);
//**************************************************************************
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
#define MCFG_CPU_AVR8_EEPROM(_tag) \
avr8_device::set_eeprom_tag(*device, _tag);
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
class avr8_device;
// ======================> avr8_config
struct avr8_config
{
const char *eeprom_region;
};
// ======================> avr8_device
// Used by core CPU interface
class avr8_device : public cpu_device,
public avr8_config
class avr8_device : public cpu_device
{
public:
// construction/destruction
avr8_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock, const device_type type, UINT32 address_mask);
// inline configuration helpers
static void static_set_config(device_t &device, const avr8_config &config);
static void set_eeprom_tag(device_t &device, const char *tag) { downcast<avr8_device &>(device).m_eeprom_tag = tag; }
// fuse configs
void set_low_fuses(UINT8 byte);
@ -145,6 +138,7 @@ protected:
const address_space_config m_program_config;
const address_space_config m_data_config;
const address_space_config m_io_config;
const char *m_eeprom_tag;
UINT8 *m_eeprom;
// bootloader

View File

@ -234,19 +234,14 @@ void craft_state::machine_reset()
m_last_cycles = 0;
}
const avr8_config atmega88_config =
{
"eeprom"
};
static MACHINE_CONFIG_START( craft, craft_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", ATMEGA88, MASTER_CLOCK)
MCFG_CPU_AVR8_CONFIG(atmega88_config)
MCFG_CPU_PROGRAM_MAP(craft_prg_map)
MCFG_CPU_DATA_MAP(craft_data_map)
MCFG_CPU_IO_MAP(craft_io_map)
MCFG_CPU_AVR8_EEPROM("eeprom")
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)

View File

@ -604,11 +604,6 @@ void replicator_state::machine_reset()
m_port_l = 0;
}
const avr8_config atmega1280_config =
{
"eeprom"
};
PALETTE_INIT_MEMBER(replicator_state, replicator)
{
//These colors were picked with the color picker in Inkscape, based on a photo of the LCD used in the Replicator 1 3d printer:
@ -634,11 +629,11 @@ GFXDECODE_END
static MACHINE_CONFIG_START( replicator, replicator_state )
MCFG_CPU_ADD("maincpu", ATMEGA1280, MASTER_CLOCK)
MCFG_CPU_AVR8_CONFIG(atmega1280_config)
MCFG_CPU_PROGRAM_MAP(replicator_prg_map)
MCFG_CPU_DATA_MAP(replicator_data_map)
MCFG_CPU_IO_MAP(replicator_io_map)
MCFG_CPU_AVR8_EEPROM("eeprom")
MCFG_CPU_AVR8_LFUSE(0xFF)
MCFG_CPU_AVR8_HFUSE(0xDA)
MCFG_CPU_AVR8_EFUSE(0xF4)

View File

@ -260,11 +260,6 @@ WRITE8_MEMBER( sbc6510_state::key_w )
m_key_row = data;
}
const avr8_config atmega88_config =
{
"eeprom"
};
static const gfx_layout charset_8x16 =
{
8, 9,
@ -289,10 +284,10 @@ static MACHINE_CONFIG_START( sbc6510, sbc6510_state )
MCFG_CPU_ADD("videocpu",ATMEGA88, XTAL_16MHz)
// MCFG_DEVICE_DISABLE() // trips SLEEP opcode, needs to be emulated
MCFG_CPU_AVR8_CONFIG(atmega88_config)
MCFG_CPU_PROGRAM_MAP(sbc6510_video_mem)
MCFG_CPU_DATA_MAP(sbc6510_video_data)
MCFG_CPU_IO_MAP(sbc6510_video_io)
MCFG_CPU_AVR8_EEPROM("eeprom")
MCFG_GFXDECODE_ADD("gfxdecode", TERMINAL_TAG":palette", sbc6510)

View File

@ -297,19 +297,14 @@ DEVICE_IMAGE_LOAD_MEMBER(uzebox_state, uzebox_cart)
* Machine definition *
\****************************************************/
const avr8_config atmega644_config =
{
"eeprom"
};
static MACHINE_CONFIG_START( uzebox, uzebox_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", ATMEGA644, MASTER_CLOCK)
MCFG_CPU_AVR8_CONFIG(atmega644_config)
MCFG_CPU_PROGRAM_MAP(uzebox_prg_map)
MCFG_CPU_DATA_MAP(uzebox_data_map)
MCFG_CPU_IO_MAP(uzebox_io_map)
MCFG_CPU_AVR8_EEPROM("eeprom")
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)