diff options
author | 2010-01-18 09:34:43 +0000 | |
---|---|---|
committer | 2010-01-18 09:34:43 +0000 | |
commit | e738b79785852050ce8b83e369a7fc4dd46a071b (patch) | |
tree | 1ac39e9f40790b375c57fea4e5d56ca8d132babc /src/emu/devconv.h | |
parent | 3f87f47a2ecdccb9d9627d0d52b76f262becb949 (diff) |
Correct a long-standing design flaw: device configuration state
is now separate from runtime device state. I have larger plans
for devices, so there is some temporary scaffolding to hold
everything together, but this first step does separate things
out.
There is a new class 'running_device' which represents the
state of a live device. A list of these running_devices sits
in machine->devicelist and is created when a running_machine
is instantiated.
To access the configuration state, use device->baseconfig()
which returns a reference to the configuration.
The list of running_devices in machine->devicelist has a 1:1
correspondance with the list of device configurations in
machine->config->devicelist, and most navigation options work
equally on either (scanning by class, type, etc.)
For the most part, drivers will now deal with running_device
objects instead of const device_config objects. In fact, in
order to do this patch, I did the following global search &
replace:
const device_config -> running_device
device->static_config -> device->baseconfig().static_config
device->inline_config -> device->baseconfig().inline_config
and then fixed up the compiler errors that fell out.
Some specifics:
Removed device_get_info_* functions and replaced them with
methods called get_config_*.
Added methods for get_runtime_* to access runtime state from
the running_device.
DEVICE_GET_INFO callbacks are only passed a device_config *.
This means they have no access to the token or runtime state
at all. For most cases this is fine.
Added new DEVICE_GET_RUNTIME_INFO callback that is passed
the running_device for accessing data that is live at runtime.
In the future this will go away to make room for a cleaner
mechanism.
Cleaned up the handoff of memory regions from the memory
subsystem to the devices.
Diffstat (limited to 'src/emu/devconv.h')
-rw-r--r-- | src/emu/devconv.h | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/src/emu/devconv.h b/src/emu/devconv.h index 0d67f83c990..3772194c227 100644 --- a/src/emu/devconv.h +++ b/src/emu/devconv.h @@ -85,7 +85,7 @@ * *************************************/ -INLINE UINT16 read16be_with_read8_device_handler(read8_device_func handler, const device_config *device, offs_t offset, UINT16 mem_mask) +INLINE UINT16 read16be_with_read8_device_handler(read8_device_func handler, running_device *device, offs_t offset, UINT16 mem_mask) { UINT16 result = 0; if (ACCESSING_BITS_8_15) @@ -96,7 +96,7 @@ INLINE UINT16 read16be_with_read8_device_handler(read8_device_func handler, cons } -INLINE void write16be_with_write8_device_handler(write8_device_func handler, const device_config *device, offs_t offset, UINT16 data, UINT16 mem_mask) +INLINE void write16be_with_write8_device_handler(write8_device_func handler, running_device *device, offs_t offset, UINT16 data, UINT16 mem_mask) { if (ACCESSING_BITS_8_15) (*handler)(device, offset * 2 + 0, data >> 8); @@ -111,7 +111,7 @@ INLINE void write16be_with_write8_device_handler(write8_device_func handler, con * *************************************/ -INLINE UINT16 read16le_with_read8_device_handler(read8_device_func handler, const device_config *device, offs_t offset, UINT16 mem_mask) +INLINE UINT16 read16le_with_read8_device_handler(read8_device_func handler, running_device *device, offs_t offset, UINT16 mem_mask) { UINT16 result = 0; if (ACCESSING_BITS_0_7) @@ -122,7 +122,7 @@ INLINE UINT16 read16le_with_read8_device_handler(read8_device_func handler, cons } -INLINE void write16le_with_write8_device_handler(write8_device_func handler, const device_config *device, offs_t offset, UINT16 data, UINT16 mem_mask) +INLINE void write16le_with_write8_device_handler(write8_device_func handler, running_device *device, offs_t offset, UINT16 data, UINT16 mem_mask) { if (ACCESSING_BITS_0_7) (*handler)(device, offset * 2 + 0, data >> 0); @@ -137,7 +137,7 @@ INLINE void write16le_with_write8_device_handler(write8_device_func handler, con * *************************************/ -INLINE UINT32 read32be_with_read8_device_handler(read8_device_func handler, const device_config *device, offs_t offset, UINT32 mem_mask) +INLINE UINT32 read32be_with_read8_device_handler(read8_device_func handler, running_device *device, offs_t offset, UINT32 mem_mask) { UINT32 result = 0; if (ACCESSING_BITS_16_31) @@ -148,7 +148,7 @@ INLINE UINT32 read32be_with_read8_device_handler(read8_device_func handler, cons } -INLINE void write32be_with_write8_device_handler(write8_device_func handler, const device_config *device, offs_t offset, UINT32 data, UINT32 mem_mask) +INLINE void write32be_with_write8_device_handler(write8_device_func handler, running_device *device, offs_t offset, UINT32 data, UINT32 mem_mask) { if (ACCESSING_BITS_16_31) write16be_with_write8_device_handler(handler, device, offset * 2 + 0, data >> 16, mem_mask >> 16); @@ -163,7 +163,7 @@ INLINE void write32be_with_write8_device_handler(write8_device_func handler, con * *************************************/ -INLINE UINT32 read32le_with_read8_device_handler(read8_device_func handler, const device_config *device, offs_t offset, UINT32 mem_mask) +INLINE UINT32 read32le_with_read8_device_handler(read8_device_func handler, running_device *device, offs_t offset, UINT32 mem_mask) { UINT32 result = 0; if (ACCESSING_BITS_0_15) @@ -174,7 +174,7 @@ INLINE UINT32 read32le_with_read8_device_handler(read8_device_func handler, cons } -INLINE void write32le_with_write8_device_handler(write8_device_func handler, const device_config *device, offs_t offset, UINT32 data, UINT32 mem_mask) +INLINE void write32le_with_write8_device_handler(write8_device_func handler, running_device *device, offs_t offset, UINT32 data, UINT32 mem_mask) { if (ACCESSING_BITS_0_15) write16le_with_write8_device_handler(handler, device, offset * 2 + 0, data, mem_mask); @@ -189,7 +189,7 @@ INLINE void write32le_with_write8_device_handler(write8_device_func handler, con * *************************************/ -INLINE UINT32 read32be_with_16be_device_handler(read16_device_func handler, const device_config *device, offs_t offset, UINT32 mem_mask) +INLINE UINT32 read32be_with_16be_device_handler(read16_device_func handler, running_device *device, offs_t offset, UINT32 mem_mask) { UINT32 result = 0; if (ACCESSING_BITS_16_31) @@ -200,7 +200,7 @@ INLINE UINT32 read32be_with_16be_device_handler(read16_device_func handler, cons } -INLINE void write32be_with_16be_device_handler(write16_device_func handler, const device_config *device, offs_t offset, UINT32 data, UINT32 mem_mask) +INLINE void write32be_with_16be_device_handler(write16_device_func handler, running_device *device, offs_t offset, UINT32 data, UINT32 mem_mask) { if (ACCESSING_BITS_16_31) (*handler)(device, offset * 2 + 0, data >> 16, mem_mask >> 16); @@ -215,7 +215,7 @@ INLINE void write32be_with_16be_device_handler(write16_device_func handler, cons * *************************************/ -INLINE UINT32 read32le_with_16le_device_handler(read16_device_func handler, const device_config *device, offs_t offset, UINT32 mem_mask) +INLINE UINT32 read32le_with_16le_device_handler(read16_device_func handler, running_device *device, offs_t offset, UINT32 mem_mask) { UINT32 result = 0; if (ACCESSING_BITS_0_15) @@ -226,7 +226,7 @@ INLINE UINT32 read32le_with_16le_device_handler(read16_device_func handler, cons } -INLINE void write32le_with_16le_device_handler(write16_device_func handler, const device_config *device, offs_t offset, UINT32 data, UINT32 mem_mask) +INLINE void write32le_with_16le_device_handler(write16_device_func handler, running_device *device, offs_t offset, UINT32 data, UINT32 mem_mask) { if (ACCESSING_BITS_0_15) (*handler)(device, offset * 2 + 0, data, mem_mask); @@ -241,7 +241,7 @@ INLINE void write32le_with_16le_device_handler(write16_device_func handler, cons * *************************************/ -INLINE UINT32 read32be_with_16le_device_handler(read16_device_func handler, const device_config *device, offs_t offset, UINT32 mem_mask) +INLINE UINT32 read32be_with_16le_device_handler(read16_device_func handler, running_device *device, offs_t offset, UINT32 mem_mask) { UINT32 result = 0; mem_mask = FLIPENDIAN_INT32(mem_mask); @@ -250,7 +250,7 @@ INLINE UINT32 read32be_with_16le_device_handler(read16_device_func handler, cons } -INLINE void write32be_with_16le_device_handler(write16_device_func handler, const device_config *device, offs_t offset, UINT32 data, UINT32 mem_mask) +INLINE void write32be_with_16le_device_handler(write16_device_func handler, running_device *device, offs_t offset, UINT32 data, UINT32 mem_mask) { data = FLIPENDIAN_INT32(data); mem_mask = FLIPENDIAN_INT32(mem_mask); @@ -264,7 +264,7 @@ INLINE void write32be_with_16le_device_handler(write16_device_func handler, cons * *************************************/ -INLINE UINT32 read32le_with_16be_device_handler(read16_device_func handler, const device_config *device, offs_t offset, UINT32 mem_mask) +INLINE UINT32 read32le_with_16be_device_handler(read16_device_func handler, running_device *device, offs_t offset, UINT32 mem_mask) { UINT32 result = 0; mem_mask = FLIPENDIAN_INT32(mem_mask); @@ -273,7 +273,7 @@ INLINE UINT32 read32le_with_16be_device_handler(read16_device_func handler, cons } -INLINE void write32le_with_16be_device_handler(write16_device_func handler, const device_config *device, offs_t offset, UINT32 data, UINT32 mem_mask) +INLINE void write32le_with_16be_device_handler(write16_device_func handler, running_device *device, offs_t offset, UINT32 data, UINT32 mem_mask) { data = FLIPENDIAN_INT32(data); mem_mask = FLIPENDIAN_INT32(mem_mask); @@ -287,7 +287,7 @@ INLINE void write32le_with_16be_device_handler(write16_device_func handler, cons * *************************************/ -INLINE UINT64 read64be_with_read8_device_handler(read8_device_func handler, const device_config *device, offs_t offset, UINT64 mem_mask) +INLINE UINT64 read64be_with_read8_device_handler(read8_device_func handler, running_device *device, offs_t offset, UINT64 mem_mask) { UINT64 result = 0; if (ACCESSING_BITS_32_63) @@ -298,7 +298,7 @@ INLINE UINT64 read64be_with_read8_device_handler(read8_device_func handler, cons } -INLINE void write64be_with_write8_device_handler(write8_device_func handler, const device_config *device, offs_t offset, UINT64 data, UINT64 mem_mask) +INLINE void write64be_with_write8_device_handler(write8_device_func handler, running_device *device, offs_t offset, UINT64 data, UINT64 mem_mask) { if (ACCESSING_BITS_32_63) write32be_with_write8_device_handler(handler, device, offset * 2 + 0, data >> 32, mem_mask >> 32); @@ -313,7 +313,7 @@ INLINE void write64be_with_write8_device_handler(write8_device_func handler, con * *************************************/ -INLINE UINT64 read64le_with_read8_device_handler(read8_device_func handler, const device_config *device, offs_t offset, UINT64 mem_mask) +INLINE UINT64 read64le_with_read8_device_handler(read8_device_func handler, running_device *device, offs_t offset, UINT64 mem_mask) { UINT64 result = 0; if (ACCESSING_BITS_0_31) @@ -324,7 +324,7 @@ INLINE UINT64 read64le_with_read8_device_handler(read8_device_func handler, cons } -INLINE void write64le_with_write8_device_handler(write8_device_func handler, const device_config *device, offs_t offset, UINT64 data, UINT64 mem_mask) +INLINE void write64le_with_write8_device_handler(write8_device_func handler, running_device *device, offs_t offset, UINT64 data, UINT64 mem_mask) { if (ACCESSING_BITS_0_31) write32le_with_write8_device_handler(handler, device, offset * 2 + 0, data >> 0, mem_mask >> 0); @@ -339,7 +339,7 @@ INLINE void write64le_with_write8_device_handler(write8_device_func handler, con * *************************************/ -INLINE UINT32 read64be_with_16be_device_handler(read16_device_func handler, const device_config *device, offs_t offset, UINT64 mem_mask) +INLINE UINT32 read64be_with_16be_device_handler(read16_device_func handler, running_device *device, offs_t offset, UINT64 mem_mask) { UINT64 result = 0; if (ACCESSING_BITS_32_63) @@ -350,7 +350,7 @@ INLINE UINT32 read64be_with_16be_device_handler(read16_device_func handler, cons } -INLINE void write64be_with_16be_device_handler(write16_device_func handler, const device_config *device, offs_t offset, UINT64 data, UINT64 mem_mask) +INLINE void write64be_with_16be_device_handler(write16_device_func handler, running_device *device, offs_t offset, UINT64 data, UINT64 mem_mask) { if (ACCESSING_BITS_32_63) write32be_with_16be_device_handler(handler, device, offset * 2 + 0, data >> 32, mem_mask >> 32); @@ -365,7 +365,7 @@ INLINE void write64be_with_16be_device_handler(write16_device_func handler, cons * *************************************/ -INLINE UINT32 read64le_with_16le_device_handler(read16_device_func handler, const device_config *device, offs_t offset, UINT64 mem_mask) +INLINE UINT32 read64le_with_16le_device_handler(read16_device_func handler, running_device *device, offs_t offset, UINT64 mem_mask) { UINT64 result = 0; if (ACCESSING_BITS_0_31) @@ -376,7 +376,7 @@ INLINE UINT32 read64le_with_16le_device_handler(read16_device_func handler, cons } -INLINE void write64le_with_16le_device_handler(write16_device_func handler, const device_config *device, offs_t offset, UINT64 data, UINT64 mem_mask) +INLINE void write64le_with_16le_device_handler(write16_device_func handler, running_device *device, offs_t offset, UINT64 data, UINT64 mem_mask) { if (ACCESSING_BITS_0_31) write32le_with_16le_device_handler(handler, device, offset * 2 + 0, data >> 0, mem_mask >> 0); @@ -391,7 +391,7 @@ INLINE void write64le_with_16le_device_handler(write16_device_func handler, cons * *************************************/ -INLINE UINT32 read64be_with_16le_device_handler(read16_device_func handler, const device_config *device, offs_t offset, UINT64 mem_mask) +INLINE UINT32 read64be_with_16le_device_handler(read16_device_func handler, running_device *device, offs_t offset, UINT64 mem_mask) { UINT64 result = 0; if (ACCESSING_BITS_32_63) @@ -402,7 +402,7 @@ INLINE UINT32 read64be_with_16le_device_handler(read16_device_func handler, cons } -INLINE void write64be_with_16le_device_handler(write16_device_func handler, const device_config *device, offs_t offset, UINT64 data, UINT64 mem_mask) +INLINE void write64be_with_16le_device_handler(write16_device_func handler, running_device *device, offs_t offset, UINT64 data, UINT64 mem_mask) { if (ACCESSING_BITS_32_63) write32be_with_16le_device_handler(handler, device, offset * 2 + 0, data >> 32, mem_mask >> 32); @@ -417,7 +417,7 @@ INLINE void write64be_with_16le_device_handler(write16_device_func handler, cons * *************************************/ -INLINE UINT32 read64le_with_16be_device_handler(read16_device_func handler, const device_config *device, offs_t offset, UINT64 mem_mask) +INLINE UINT32 read64le_with_16be_device_handler(read16_device_func handler, running_device *device, offs_t offset, UINT64 mem_mask) { UINT64 result = 0; if (ACCESSING_BITS_0_31) @@ -428,7 +428,7 @@ INLINE UINT32 read64le_with_16be_device_handler(read16_device_func handler, cons } -INLINE void write64le_with_16be_device_handler(write16_device_func handler, const device_config *device, offs_t offset, UINT64 data, UINT64 mem_mask) +INLINE void write64le_with_16be_device_handler(write16_device_func handler, running_device *device, offs_t offset, UINT64 data, UINT64 mem_mask) { if (ACCESSING_BITS_0_31) write32le_with_16be_device_handler(handler, device, offset * 2 + 0, data >> 0, mem_mask >> 0); @@ -443,7 +443,7 @@ INLINE void write64le_with_16be_device_handler(write16_device_func handler, cons * *************************************/ -INLINE UINT64 read64be_with_32be_device_handler(read32_device_func handler, const device_config *device, offs_t offset, UINT64 mem_mask) +INLINE UINT64 read64be_with_32be_device_handler(read32_device_func handler, running_device *device, offs_t offset, UINT64 mem_mask) { UINT64 result = 0; if (ACCESSING_BITS_32_63) @@ -454,7 +454,7 @@ INLINE UINT64 read64be_with_32be_device_handler(read32_device_func handler, cons } -INLINE void write64be_with_32be_device_handler(write32_device_func handler, const device_config *device, offs_t offset, UINT64 data, UINT64 mem_mask) +INLINE void write64be_with_32be_device_handler(write32_device_func handler, running_device *device, offs_t offset, UINT64 data, UINT64 mem_mask) { if (ACCESSING_BITS_32_63) (*handler)(device, offset * 2 + 0, data >> 32, mem_mask >> 32); @@ -469,7 +469,7 @@ INLINE void write64be_with_32be_device_handler(write32_device_func handler, cons * *************************************/ -INLINE UINT64 read64le_with_32le_device_handler(read32_device_func handler, const device_config *device, offs_t offset, UINT64 mem_mask) +INLINE UINT64 read64le_with_32le_device_handler(read32_device_func handler, running_device *device, offs_t offset, UINT64 mem_mask) { UINT64 result = 0; if (ACCESSING_BITS_0_31) @@ -480,7 +480,7 @@ INLINE UINT64 read64le_with_32le_device_handler(read32_device_func handler, cons } -INLINE void write64le_with_32le_device_handler(write32_device_func handler, const device_config *device, offs_t offset, UINT64 data, UINT64 mem_mask) +INLINE void write64le_with_32le_device_handler(write32_device_func handler, running_device *device, offs_t offset, UINT64 data, UINT64 mem_mask) { if (ACCESSING_BITS_0_31) (*handler)(device, offset * 2 + 0, data >> 0, mem_mask >> 0); @@ -495,7 +495,7 @@ INLINE void write64le_with_32le_device_handler(write32_device_func handler, cons * *************************************/ -INLINE UINT64 read64be_with_32le_device_handler(read32_device_func handler, const device_config *device, offs_t offset, UINT64 mem_mask) +INLINE UINT64 read64be_with_32le_device_handler(read32_device_func handler, running_device *device, offs_t offset, UINT64 mem_mask) { UINT64 result; mem_mask = FLIPENDIAN_INT64(mem_mask); @@ -504,7 +504,7 @@ INLINE UINT64 read64be_with_32le_device_handler(read32_device_func handler, cons } -INLINE void write64be_with_32le_device_handler(write32_device_func handler, const device_config *device, offs_t offset, UINT64 data, UINT64 mem_mask) +INLINE void write64be_with_32le_device_handler(write32_device_func handler, running_device *device, offs_t offset, UINT64 data, UINT64 mem_mask) { data = FLIPENDIAN_INT64(data); mem_mask = FLIPENDIAN_INT64(mem_mask); @@ -518,7 +518,7 @@ INLINE void write64be_with_32le_device_handler(write32_device_func handler, cons * *************************************/ -INLINE UINT64 read64le_with_32be_device_handler(read32_device_func handler, const device_config *device, offs_t offset, UINT64 mem_mask) +INLINE UINT64 read64le_with_32be_device_handler(read32_device_func handler, running_device *device, offs_t offset, UINT64 mem_mask) { UINT64 result; mem_mask = FLIPENDIAN_INT64(mem_mask); @@ -527,7 +527,7 @@ INLINE UINT64 read64le_with_32be_device_handler(read32_device_func handler, cons } -INLINE void write64le_with_32be_device_handler(write32_device_func handler, const device_config *device, offs_t offset, UINT64 data, UINT64 mem_mask) +INLINE void write64le_with_32be_device_handler(write32_device_func handler, running_device *device, offs_t offset, UINT64 data, UINT64 mem_mask) { data = FLIPENDIAN_INT64(data); mem_mask = FLIPENDIAN_INT64(mem_mask); |