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/cpu/sh4/sh4comn.c | |
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/cpu/sh4/sh4comn.c')
-rw-r--r-- | src/emu/cpu/sh4/sh4comn.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/emu/cpu/sh4/sh4comn.c b/src/emu/cpu/sh4/sh4comn.c index 93ee5f542b8..1e31bd9ede5 100644 --- a/src/emu/cpu/sh4/sh4comn.c +++ b/src/emu/cpu/sh4/sh4comn.c @@ -30,7 +30,7 @@ static const UINT16 tcnt[] = { TCNT0, TCNT1, TCNT2 }; static const UINT16 tcor[] = { TCOR0, TCOR1, TCOR2 }; static const UINT16 tcr[] = { TCR0, TCR1, TCR2 }; -INLINE SH4 *get_safe_token(const device_config *device) +INLINE SH4 *get_safe_token(running_device *device) { assert(device != NULL); assert(device->token != NULL); @@ -997,7 +997,7 @@ READ32_HANDLER( sh4_internal_r ) return sh4->m[offset]; } -void sh4_set_frt_input(const device_config *device, int state) +void sh4_set_frt_input(running_device *device, int state) { SH4 *sh4 = get_safe_token(device); @@ -1033,7 +1033,7 @@ void sh4_set_frt_input(const device_config *device, int state) #endif } -void sh4_set_irln_input(const device_config *device, int value) +void sh4_set_irln_input(running_device *device, int value) { SH4 *sh4 = get_safe_token(device); @@ -1162,7 +1162,7 @@ void sh4_parse_configuration(SH4 *sh4, const struct sh4_config *conf) } } -void sh4_common_init(const device_config *device) +void sh4_common_init(running_device *device) { SH4 *sh4 = get_safe_token(device); int i; @@ -1189,7 +1189,7 @@ void sh4_common_init(const device_config *device) sh4->m = auto_alloc_array(device->machine, UINT32, 16384); } -void sh4_dma_ddt(const device_config *device, struct sh4_ddt_dma *s) +void sh4_dma_ddt(running_device *device, struct sh4_ddt_dma *s) { SH4 *sh4 = get_safe_token(device); UINT32 chcr; |