Previous 199869 Revisions Next

r26658 Thursday 19th December, 2013 at 00:58:47 UTC by smf
Removed support for static config from slots and converted the two devices using it to machine config fragments [smf]
[src/emu]dislot.c dislot.h mconfig.c
[src/mess/drivers]at.c bebox.c
[src/mess/machine]i82439tx.c i82439tx.h mpc105.c mpc105.h

trunk/src/emu/dislot.c
r26657r26658
2727   m_default_bios(NULL),
2828   m_machine_config(NULL),
2929   m_input_device_defaults(NULL),
30   m_config(NULL),
3130   m_clock(0)
3231{
3332}
trunk/src/emu/dislot.h
r26657r26658
2323#define MCFG_DEVICE_CARD_DEFAULT_BIOS(_option, _default_bios) MCFG_SLOT_OPTION_DEFAULT_BIOS(_option, _default_bios)
2424#define MCFG_DEVICE_CARD_MACHINE_CONFIG(_option, _machine_config_name) MCFG_SLOT_OPTION_MACHINE_CONFIG(_option, _machine_config_name)
2525#define MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS(_option, _dev_inp_def) MCFG_SLOT_OPTION_DEVICE_INPUT_DEFAULTS(_option, _dev_inp_def)
26#define MCFG_DEVICE_CARD_CONFIG(_option, _config) MCFG_SLOT_OPTION_CONFIG(_option, _config)
2726#define MCFG_DEVICE_CARD_CLOCK(_option, _clock) MCFG_SLOT_OPTION_CLOCK(_option, _clock)
2827
2928
r26657r26658
5554#define MCFG_SLOT_OPTION_DEVICE_INPUT_DEFAULTS(_option, _dev_inp_def) \
5655   device_slot_interface::static_set_option_device_input_defaults(*device, _option, DEVICE_INPUT_DEFAULTS_NAME(_dev_inp_def));
5756
58#define MCFG_SLOT_OPTION_CONFIG(_option, _config) \
59   device_slot_interface::static_set_option_config(*device, _option, _config);
60
6157#define MCFG_SLOT_OPTION_CLOCK(_option, _clock) \
6258   device_slot_interface::static_set_option_clock(*device, _option, _clock);
6359
r26657r26658
8379   const char *default_bios() const { return m_default_bios; }
8480   machine_config_constructor machine_config() const { return m_machine_config; }
8581   const input_device_default *input_device_defaults() const { return m_input_device_defaults; }
86   const void *static_config() const { return m_config; }
8782   UINT32 clock() const { return m_clock; }
8883
8984private:
r26657r26658
9590   const char *m_default_bios;
9691   machine_config_constructor m_machine_config;
9792   const input_device_default *m_input_device_defaults;
98   const void *m_config;
9993   UINT32 m_clock;
10094};
10195
r26657r26658
117111   static void static_set_option_default_bios(device_t &device, const char *option, const char *default_bios) { static_option(device, option)->m_default_bios = default_bios; }
118112   static void static_set_option_machine_config(device_t &device, const char *option, const machine_config_constructor machine_config) { static_option(device, option)->m_machine_config = machine_config; }
119113   static void static_set_option_device_input_defaults(device_t &device, const char *option, const input_device_default *default_input) { static_option(device, option)->m_input_device_defaults = default_input; }
120   static void static_set_option_config(device_t &device, const char *option, const void *config) { static_option(device, option)->m_config = config; }
121114   static void static_set_option_clock(device_t &device, const char *option, UINT32 default_clock) { static_option(device, option)->m_clock = default_clock; }
122115   const bool fixed() const { return m_fixed; }
123116   const char *default_option() const { return m_default_option; }
trunk/src/emu/mconfig.c
r26657r26658
6969            const input_device_default *input_device_defaults = option->input_device_defaults();
7070            if (input_device_defaults)
7171               device_t::static_set_input_default(*new_dev, input_device_defaults);
72
73            const void *config = option->static_config();
74            if (config)
75               device_t::static_set_static_config(*new_dev, config);
7672         }
7773         else
7874            throw emu_fatalerror("Unknown slot option '%s' in slot '%s'", selval, owner.tag()+1);
trunk/src/mess/machine/mpc105.c
r26657r26658
3030mpc105_device::mpc105_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
3131   : device_t(mconfig, MPC105, "MPC105", tag, owner, clock, "mpc105", __FILE__),
3232   pci_device_interface( mconfig, *this ),
33   m_maincpu(NULL)
33   m_cpu_tag(NULL),
34   m_bank_base_default(0)
3435{
3536}
3637
r26657r26658
4041
4142void mpc105_device::device_start()
4243{
43   m_maincpu = machine().device<cpu_device>(m_cputag);
44   m_maincpu = machine().device<cpu_device>(m_cpu_tag);
4445}
4546
4647//-------------------------------------------------
r26657r26658
5556}
5657
5758//-------------------------------------------------
58//  device_config_complete - perform any
59//  operations now that the configuration is
60//  complete
61//-------------------------------------------------
62
63void mpc105_device::device_config_complete()
64{
65   // inherit a copy of the static data
66   const mpc105_interface *intf = reinterpret_cast<const mpc105_interface *>(static_config());
67   if (intf != NULL)
68   {
69      *static_cast<mpc105_interface *>(this) = *intf;
70   }
71
72   // or initialize to defaults if none provided
73   else
74   {
75      memset(&m_cputag, 0, sizeof(m_cputag));
76      m_bank_base_default = 0;
77
78   }
79}
80
81//-------------------------------------------------
8259//  update_memory - MMU update
8360//-------------------------------------------------
8461
trunk/src/mess/machine/mpc105.h
r26657r26658
1313
1414#define MPC105_MEMORYBANK_COUNT     8
1515
16// ======================> mpc105_interface
16#define MCFG_MPC105_CPU( _tag ) \
17   mpc105_device::static_set_cpu(*device, _tag);
1718
18struct mpc105_interface
19{
20   const char *m_cputag;
21   int m_bank_base_default;
22};
19#define MCFG_MPC105_BANK_BASE_DEFAULT( bank_base_default ) \
20   mpc105_device::static_set_bank_base_default(*device, bank_base_default);
2321
2422// ======================> mpc105_device
2523
2624class mpc105_device : public device_t,
27                  public pci_device_interface,
28                  public mpc105_interface
25   public pci_device_interface
2926{
3027public:
3128   // construction/destruction
3229   mpc105_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
3330
31   static void static_set_cpu(device_t &device, const char *tag) { dynamic_cast<mpc105_device &>(device).m_cpu_tag = tag; }
32   static void static_set_bank_base_default(device_t &device, int bank_base_default) { dynamic_cast<mpc105_device &>(device).m_bank_base_default = bank_base_default; }
33
3434   virtual UINT32 pci_read(pci_bus_device *pcibus, int function, int offset, UINT32 mem_mask);
3535   virtual void pci_write(pci_bus_device *pcibus, int function, int offset, UINT32 data, UINT32 mem_mask);
3636
r26657r26658
3838   // device-level overrides
3939   virtual void device_start();
4040   virtual void device_reset();
41   virtual void device_config_complete();
4241
4342   void update_memory();
4443
4544private:
45   const char *m_cpu_tag;
46   int m_bank_base_default;
4647   int m_bank_base;
4748   UINT8 m_bank_enable;
4849   UINT32 m_bank_registers[8];
trunk/src/mess/machine/i82439tx.c
r26657r26658
1515
1616
1717i82439tx_device::i82439tx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
18      : northbridge_device(mconfig, I82439TX, "Intel 82439TX", tag, owner, clock, "i82439tx", __FILE__),
19      pci_device_interface( mconfig, *this )
18   : northbridge_device(mconfig, I82439TX, "Intel 82439TX", tag, owner, clock, "i82439tx", __FILE__),
19   pci_device_interface( mconfig, *this ),
20   m_cpu_tag( NULL ),
21   m_region_tag( NULL )
2022{
2123}
2224
r26657r26658
251253   }
252254}
253255
254
255256//-------------------------------------------------
256//  device_config_complete - perform any
257//  operations now that the configuration is
258//  complete
259//-------------------------------------------------
260
261void i82439tx_device::device_config_complete()
262{
263   // inherit a copy of the static data
264   const i82439tx_interface *intf = reinterpret_cast<const i82439tx_interface *>(static_config());
265   if (intf != NULL)
266   {
267      *static_cast<i82439tx_interface *>(this) = *intf;
268   }
269
270   // or initialize to defaults if none provided
271   else
272   {
273      memset(&m_cputag, 0, sizeof(m_cputag));
274      memset(&m_rom_region, 0, sizeof(m_rom_region));
275   }
276}
277
278//-------------------------------------------------
279257//  device_start - device-specific startup
280258//-------------------------------------------------
281259
r26657r26658
283261{
284262   northbridge_device::device_start();
285263   /* get address space we are working on */
286   device_t *cpu = machine().device(m_cputag);
264   device_t *cpu = machine().device(m_cpu_tag);
287265   assert(cpu != NULL);
288266
289267   m_space = &cpu->memory().space(AS_PROGRAM);
290268
291269   /* get rom region */
292   m_rom = machine().root_device().memregion(m_rom_region)->base();
270   m_rom = machine().root_device().memregion(m_region_tag)->base();
293271
294272   /* setup save states */
295273   save_item(NAME(m_regs));
trunk/src/mess/machine/i82439tx.h
r26657r26658
1212#include "machine/pci.h"
1313#include "machine/northbridge.h"
1414
15// ======================> i82439tx_interface
15#define MCFG_I82439TX_CPU( _tag ) \
16   i82439tx_device::static_set_cpu(*device, _tag);
1617
17struct i82439tx_interface
18{
19   const char *m_cputag;
20   const char *m_rom_region;
21};
18#define MCFG_I82439TX_REGION( _tag ) \
19   i82439tx_device::static_set_region(*device, _tag);
2220
2321// ======================> i82439tx_device
2422
2523class i82439tx_device :  public northbridge_device,
26                     public pci_device_interface,
27                     public i82439tx_interface
24   public pci_device_interface
2825{
2926public:
3027   // construction/destruction
3128   i82439tx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
3229
30   static void static_set_cpu(device_t &device, const char *tag) { dynamic_cast<i82439tx_device &>(device).m_cpu_tag = tag; }
31   static void static_set_region(device_t &device, const char *tag) { dynamic_cast<i82439tx_device &>(device).m_region_tag = tag; }
32
3333   virtual UINT32 pci_read(pci_bus_device *pcibus, int function, int offset, UINT32 mem_mask);
3434   virtual void pci_write(pci_bus_device *pcibus, int function, int offset, UINT32 data, UINT32 mem_mask);
3535
r26657r26658
3737   // device-level overrides
3838   virtual void device_start();
3939   virtual void device_reset();
40   virtual void device_config_complete();
4140
4241   void i82439tx_configure_memory(UINT8 val, offs_t begin, offs_t end);
4342
4443private:
44   const char *m_cpu_tag;
45   const char *m_region_tag;
46
4547   address_space *m_space;
4648   UINT8 *m_rom;
4749
4850   UINT32 m_regs[8];
4951   UINT32 m_bios_ram[0x40000 / 4];
50
5152};
5253
5354// device type definition
trunk/src/mess/drivers/at.c
r26657r26658
601601MACHINE_CONFIG_END
602602
603603
604const struct i82439tx_interface tx_config =
605{
606   "maincpu",
607   "isa"
608};
604static MACHINE_CONFIG_FRAGMENT( tx_config )
605   MCFG_I82439TX_CPU( "maincpu" )
606   MCFG_I82439TX_REGION( "isa" )
607MACHINE_CONFIG_END
609608
610609static SLOT_INTERFACE_START( pci_devices )
611610   SLOT_INTERFACE_INTERNAL("i82439tx", I82439TX)
r26657r26658
625624
626625   MCFG_PCI_BUS_ADD("pcibus", 0)
627626   MCFG_PCI_BUS_DEVICE("pcibus:0", pci_devices, "i82439tx", true)
628   MCFG_DEVICE_CARD_CONFIG("i82439tx", &tx_config)
627   MCFG_SLOT_OPTION_MACHINE_CONFIG("i82439tx", tx_config)
629628
630629   MCFG_PCI_BUS_DEVICE("pcibus:1", pci_devices, "i82371ab", true)
631630
r26657r26658
648647
649648   MCFG_PCI_BUS_ADD("pcibus", 0)
650649   MCFG_PCI_BUS_DEVICE("pcibus:0", pci_devices, "i82439tx", true)
651   MCFG_DEVICE_CARD_CONFIG("i82439tx", &tx_config)
650   MCFG_SLOT_OPTION_MACHINE_CONFIG("i82439tx", tx_config)
652651
653652   MCFG_PCI_BUS_DEVICE("pcibus:1", pci_devices, "i82371sb", true)
654653
trunk/src/mess/drivers/bebox.c
r26657r26658
137137   SLOT_INTERFACE( "35hd", FLOPPY_35_HD )
138138SLOT_INTERFACE_END
139139
140const struct mpc105_interface mpc105_config =
141{
142   "ppc1",
143   0
144};
140static MACHINE_CONFIG_FRAGMENT( mpc105_config )
141   MCFG_MPC105_CPU( "ppc1" )
142   MCFG_MPC105_BANK_BASE_DEFAULT( 0 )
143MACHINE_CONFIG_END
145144
146145
147146/*************************************
r26657r26658
224223   /* pci */
225224   MCFG_PCI_BUS_ADD("pcibus", 0)
226225   MCFG_PCI_BUS_DEVICE("pcibus:0", pci_devices, "mpc105", true)
227   MCFG_DEVICE_CARD_CONFIG("mpc105", &mpc105_config)
226   MCFG_SLOT_OPTION_MACHINE_CONFIG("mpc105", mpc105_config)
228227
229228   MCFG_PCI_BUS_DEVICE("pcibus:1", pci_devices, "cirrus", true)
230229

Previous 199869 Revisions Next


© 1997-2024 The MAME Team