summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/cpu/adsp2100/adsp2100.c
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2010-01-18 09:34:43 +0000
committer Aaron Giles <aaron@aarongiles.com>2010-01-18 09:34:43 +0000
commite738b79785852050ce8b83e369a7fc4dd46a071b (patch)
tree1ac39e9f40790b375c57fea4e5d56ca8d132babc /src/emu/cpu/adsp2100/adsp2100.c
parent3f87f47a2ecdccb9d9627d0d52b76f262becb949 (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/adsp2100/adsp2100.c')
-rw-r--r--src/emu/cpu/adsp2100/adsp2100.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/emu/cpu/adsp2100/adsp2100.c b/src/emu/cpu/adsp2100/adsp2100.c
index 48f7ad0e0fd..b20adf021d4 100644
--- a/src/emu/cpu/adsp2100/adsp2100.c
+++ b/src/emu/cpu/adsp2100/adsp2100.c
@@ -242,7 +242,7 @@ typedef struct
UINT8 irq_state[9];
UINT8 irq_latch[9];
cpu_irq_callback irq_callback;
- const device_config *device;
+ running_device *device;
/* other internal states */
int icount;
@@ -425,7 +425,7 @@ static void check_irqs(adsp2100_state *adsp);
STATE ACCESSORS
***************************************************************************/
-INLINE adsp2100_state *get_safe_token(const device_config *device)
+INLINE adsp2100_state *get_safe_token(running_device *device)
{
assert(device != NULL);
assert(device->token != NULL);
@@ -691,9 +691,9 @@ static void set_irq_line(adsp2100_state *adsp, int irqline, int state)
INITIALIZATION AND SHUTDOWN
***************************************************************************/
-static adsp2100_state *adsp21xx_init(const device_config *device, cpu_irq_callback irqcallback, int chiptype)
+static adsp2100_state *adsp21xx_init(running_device *device, cpu_irq_callback irqcallback, int chiptype)
{
- const adsp21xx_config *config = (const adsp21xx_config *)device->static_config;
+ const adsp21xx_config *config = (const adsp21xx_config *)device->baseconfig().static_config;
adsp2100_state *adsp = get_safe_token(device);
/* create the tables */
@@ -2171,20 +2171,20 @@ CPU_GET_INFO( adsp2181 )
}
}
-void adsp2181_idma_addr_w(const device_config *device, UINT16 data)
+void adsp2181_idma_addr_w(running_device *device, UINT16 data)
{
adsp2100_state *adsp = get_safe_token(device);
adsp->idma_addr = data;
adsp->idma_offs = 0;
}
-UINT16 adsp2181_idma_addr_r(const device_config *device)
+UINT16 adsp2181_idma_addr_r(running_device *device)
{
adsp2100_state *adsp = get_safe_token(device);
return adsp->idma_addr;
}
-void adsp2181_idma_data_w(const device_config *device, UINT16 data)
+void adsp2181_idma_data_w(running_device *device, UINT16 data)
{
adsp2100_state *adsp = get_safe_token(device);
@@ -2211,7 +2211,7 @@ void adsp2181_idma_data_w(const device_config *device, UINT16 data)
WWORD_DATA(adsp, adsp->idma_addr++ & 0x3fff, data);
}
-UINT16 adsp2181_idma_data_r(const device_config *device)
+UINT16 adsp2181_idma_data_r(running_device *device)
{
adsp2100_state *adsp = get_safe_token(device);
UINT16 result = 0xffff;