trunk/src/emu/cpu/avr8/avr8.c
| r32255 | r32256 | |
| 635 | 635 | m_program_config("program", ENDIANNESS_LITTLE, 8, 22), |
| 636 | 636 | m_data_config("data", ENDIANNESS_LITTLE, 8, 16, 0, internal_map), |
| 637 | 637 | m_io_config("io", ENDIANNESS_LITTLE, 8, 4), |
| 638 | m_eeprom_tag(NULL), |
| 638 | 639 | m_eeprom(NULL), |
| 639 | | m_cpu_type(cpu_type), |
| 640 | | m_lfuses(0x62), |
| 641 | | m_hfuses(0x99), |
| 642 | | m_efuses(0xFF), |
| 643 | | m_lock_bits(0xFF), |
| 640 | m_cpu_type(cpu_type), |
| 641 | m_lfuses(0x62), |
| 642 | m_hfuses(0x99), |
| 643 | m_efuses(0xFF), |
| 644 | m_lock_bits(0xFF), |
| 644 | 645 | m_pc(0), |
| 645 | 646 | m_spi_active(false), |
| 646 | 647 | m_spi_prescale(0), |
| r32255 | r32256 | |
| 661 | 662 | |
| 662 | 663 | |
| 663 | 664 | //------------------------------------------------- |
| 664 | | // static_set_config - set the configuration |
| 665 | | // structure |
| 666 | | //------------------------------------------------- |
| 667 | | |
| 668 | | void avr8_device::static_set_config(device_t &device, const avr8_config &config) |
| 669 | | { |
| 670 | | avr8_device &avr8 = downcast<avr8_device &>(device); |
| 671 | | static_cast<avr8_config &>(avr8) = config; |
| 672 | | } |
| 673 | | |
| 674 | | //------------------------------------------------- |
| 675 | 665 | // static_set_low_fuses |
| 676 | 666 | //------------------------------------------------- |
| 677 | 667 | |
| r32255 | r32256 | |
| 833 | 823 | // set our instruction counter |
| 834 | 824 | m_icountptr = &m_icount; |
| 835 | 825 | |
| 836 | | m_eeprom = machine().root_device().memregion(eeprom_region)->base(); |
| 826 | m_eeprom = machine().root_device().memregion(m_eeprom_tag)->base(); |
| 837 | 827 | } |
| 838 | 828 | |
| 839 | 829 | //------------------------------------------------- |
trunk/src/emu/cpu/avr8/avr8.h
| r32255 | r32256 | |
| 40 | 40 | #ifndef __AVR8_H__ |
| 41 | 41 | #define __AVR8_H__ |
| 42 | 42 | |
| 43 | | //************************************************************************** |
| 44 | | // INTERFACE CONFIGURATION MACROS |
| 45 | | //************************************************************************** |
| 46 | 43 | |
| 47 | | #define MCFG_CPU_AVR8_CONFIG(_config) \ |
| 48 | | avr8_device::static_set_config(*device, _config); |
| 49 | | |
| 50 | 44 | //************************************************************************** |
| 51 | 45 | // FUSE BITS CONFIGURATION MACROS |
| 52 | 46 | //************************************************************************** |
| r32255 | r32256 | |
| 64 | 58 | ((avr8_device*) device)->set_lock_bits(byte); |
| 65 | 59 | |
| 66 | 60 | //************************************************************************** |
| 67 | | // TYPE DEFINITIONS |
| 61 | // INTERFACE CONFIGURATION MACROS |
| 68 | 62 | //************************************************************************** |
| 69 | 63 | |
| 70 | | class avr8_device; |
| 64 | #define MCFG_CPU_AVR8_EEPROM(_tag) \ |
| 65 | avr8_device::set_eeprom_tag(*device, _tag); |
| 71 | 66 | |
| 72 | | // ======================> avr8_config |
| 73 | 67 | |
| 74 | | struct avr8_config |
| 75 | | { |
| 76 | | const char *eeprom_region; |
| 77 | | }; |
| 68 | //************************************************************************** |
| 69 | // TYPE DEFINITIONS |
| 70 | //************************************************************************** |
| 78 | 71 | |
| 72 | class avr8_device; |
| 79 | 73 | |
| 80 | 74 | // ======================> avr8_device |
| 81 | 75 | |
| 82 | 76 | // Used by core CPU interface |
| 83 | | class avr8_device : public cpu_device, |
| 84 | | public avr8_config |
| 77 | class avr8_device : public cpu_device |
| 85 | 78 | { |
| 86 | 79 | public: |
| 87 | 80 | // construction/destruction |
| 88 | 81 | avr8_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock, const device_type type, UINT32 address_mask); |
| 89 | 82 | |
| 90 | 83 | // inline configuration helpers |
| 91 | | static void static_set_config(device_t &device, const avr8_config &config); |
| 84 | static void set_eeprom_tag(device_t &device, const char *tag) { downcast<avr8_device &>(device).m_eeprom_tag = tag; } |
| 92 | 85 | |
| 93 | 86 | // fuse configs |
| 94 | 87 | void set_low_fuses(UINT8 byte); |
| r32255 | r32256 | |
| 145 | 138 | const address_space_config m_program_config; |
| 146 | 139 | const address_space_config m_data_config; |
| 147 | 140 | const address_space_config m_io_config; |
| 141 | const char *m_eeprom_tag; |
| 148 | 142 | UINT8 *m_eeprom; |
| 149 | 143 | |
| 150 | 144 | // bootloader |
trunk/src/mess/drivers/uzebox.c
| r32255 | r32256 | |
| 297 | 297 | * Machine definition * |
| 298 | 298 | \****************************************************/ |
| 299 | 299 | |
| 300 | | const avr8_config atmega644_config = |
| 301 | | { |
| 302 | | "eeprom" |
| 303 | | }; |
| 304 | | |
| 305 | 300 | static MACHINE_CONFIG_START( uzebox, uzebox_state ) |
| 306 | 301 | |
| 307 | 302 | /* basic machine hardware */ |
| 308 | 303 | MCFG_CPU_ADD("maincpu", ATMEGA644, MASTER_CLOCK) |
| 309 | | MCFG_CPU_AVR8_CONFIG(atmega644_config) |
| 310 | 304 | MCFG_CPU_PROGRAM_MAP(uzebox_prg_map) |
| 311 | 305 | MCFG_CPU_DATA_MAP(uzebox_data_map) |
| 312 | 306 | MCFG_CPU_IO_MAP(uzebox_io_map) |
| 307 | MCFG_CPU_AVR8_EEPROM("eeprom") |
| 313 | 308 | |
| 314 | 309 | /* video hardware */ |
| 315 | 310 | MCFG_SCREEN_ADD("screen", RASTER) |
trunk/src/mess/drivers/craft.c
| r32255 | r32256 | |
| 234 | 234 | m_last_cycles = 0; |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | | const avr8_config atmega88_config = |
| 238 | | { |
| 239 | | "eeprom" |
| 240 | | }; |
| 241 | | |
| 242 | 237 | static MACHINE_CONFIG_START( craft, craft_state ) |
| 243 | 238 | |
| 244 | 239 | /* basic machine hardware */ |
| 245 | 240 | MCFG_CPU_ADD("maincpu", ATMEGA88, MASTER_CLOCK) |
| 246 | | MCFG_CPU_AVR8_CONFIG(atmega88_config) |
| 247 | 241 | MCFG_CPU_PROGRAM_MAP(craft_prg_map) |
| 248 | 242 | MCFG_CPU_DATA_MAP(craft_data_map) |
| 249 | 243 | MCFG_CPU_IO_MAP(craft_io_map) |
| 244 | MCFG_CPU_AVR8_EEPROM("eeprom") |
| 250 | 245 | |
| 251 | 246 | /* video hardware */ |
| 252 | 247 | MCFG_SCREEN_ADD("screen", RASTER) |
trunk/src/mess/drivers/replicator.c
| r32255 | r32256 | |
| 604 | 604 | m_port_l = 0; |
| 605 | 605 | } |
| 606 | 606 | |
| 607 | | const avr8_config atmega1280_config = |
| 608 | | { |
| 609 | | "eeprom" |
| 610 | | }; |
| 611 | | |
| 612 | 607 | PALETTE_INIT_MEMBER(replicator_state, replicator) |
| 613 | 608 | { |
| 614 | 609 | //These colors were picked with the color picker in Inkscape, based on a photo of the LCD used in the Replicator 1 3d printer: |
| r32255 | r32256 | |
| 634 | 629 | static MACHINE_CONFIG_START( replicator, replicator_state ) |
| 635 | 630 | |
| 636 | 631 | MCFG_CPU_ADD("maincpu", ATMEGA1280, MASTER_CLOCK) |
| 637 | | MCFG_CPU_AVR8_CONFIG(atmega1280_config) |
| 638 | 632 | MCFG_CPU_PROGRAM_MAP(replicator_prg_map) |
| 639 | 633 | MCFG_CPU_DATA_MAP(replicator_data_map) |
| 640 | 634 | MCFG_CPU_IO_MAP(replicator_io_map) |
| 641 | 635 | |
| 636 | MCFG_CPU_AVR8_EEPROM("eeprom") |
| 642 | 637 | MCFG_CPU_AVR8_LFUSE(0xFF) |
| 643 | 638 | MCFG_CPU_AVR8_HFUSE(0xDA) |
| 644 | 639 | MCFG_CPU_AVR8_EFUSE(0xF4) |
trunk/src/mess/drivers/sbc6510.c
| r32255 | r32256 | |
| 260 | 260 | m_key_row = data; |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | | const avr8_config atmega88_config = |
| 264 | | { |
| 265 | | "eeprom" |
| 266 | | }; |
| 267 | | |
| 268 | 263 | static const gfx_layout charset_8x16 = |
| 269 | 264 | { |
| 270 | 265 | 8, 9, |
| r32255 | r32256 | |
| 289 | 284 | |
| 290 | 285 | MCFG_CPU_ADD("videocpu",ATMEGA88, XTAL_16MHz) |
| 291 | 286 | // MCFG_DEVICE_DISABLE() // trips SLEEP opcode, needs to be emulated |
| 292 | | MCFG_CPU_AVR8_CONFIG(atmega88_config) |
| 293 | 287 | MCFG_CPU_PROGRAM_MAP(sbc6510_video_mem) |
| 294 | 288 | MCFG_CPU_DATA_MAP(sbc6510_video_data) |
| 295 | 289 | MCFG_CPU_IO_MAP(sbc6510_video_io) |
| 290 | MCFG_CPU_AVR8_EEPROM("eeprom") |
| 296 | 291 | |
| 297 | 292 | MCFG_GFXDECODE_ADD("gfxdecode", TERMINAL_TAG":palette", sbc6510) |
| 298 | 293 | |