summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/sound/cdp1864.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/sound/cdp1864.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/sound/cdp1864.c')
-rw-r--r--src/emu/sound/cdp1864.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/emu/sound/cdp1864.c b/src/emu/sound/cdp1864.c
index 66366de82ad..0fc6c53f282 100644
--- a/src/emu/sound/cdp1864.c
+++ b/src/emu/sound/cdp1864.c
@@ -53,7 +53,7 @@ struct _cdp1864_t
devcb_resolved_write_line out_dmao_func;
devcb_resolved_write_line out_efx_func;
- const device_config *screen; /* screen */
+ running_device *screen; /* screen */
bitmap_t *bitmap; /* bitmap */
sound_stream *stream; /* sound output */
@@ -74,14 +74,14 @@ struct _cdp1864_t
emu_timer *efx_timer; /* EFx timer */
emu_timer *dma_timer; /* DMA timer */
- const device_config *cpu;
+ running_device *cpu;
};
/***************************************************************************
INLINE FUNCTIONS
***************************************************************************/
-INLINE cdp1864_t *get_safe_token(const device_config *device)
+INLINE cdp1864_t *get_safe_token(running_device *device)
{
assert(device != NULL);
assert(device->token != NULL);
@@ -98,7 +98,7 @@ INLINE cdp1864_t *get_safe_token(const device_config *device)
static TIMER_CALLBACK( cdp1864_int_tick )
{
- const device_config *device = (const device_config *) ptr;
+ running_device *device = (running_device *) ptr;
cdp1864_t *cdp1864 = get_safe_token(device);
int scanline = video_screen_get_vpos(cdp1864->screen);
@@ -129,7 +129,7 @@ static TIMER_CALLBACK( cdp1864_int_tick )
static TIMER_CALLBACK( cdp1864_efx_tick )
{
- const device_config *device = (const device_config *) ptr;
+ running_device *device = (running_device *) ptr;
cdp1864_t *cdp1864 = get_safe_token(device);
int scanline = video_screen_get_vpos(cdp1864->screen);
@@ -164,7 +164,7 @@ static TIMER_CALLBACK( cdp1864_efx_tick )
static TIMER_CALLBACK( cdp1864_dma_tick )
{
- const device_config *device = (const device_config *) ptr;
+ running_device *device = (running_device *) ptr;
cdp1864_t *cdp1864 = get_safe_token(device);
int scanline = video_screen_get_vpos(cdp1864->screen);
@@ -203,7 +203,7 @@ static TIMER_CALLBACK( cdp1864_dma_tick )
cdp1864_init_palette - initialize palette
-------------------------------------------------*/
-static void cdp1864_init_palette(const device_config *device, const cdp1864_interface *intf)
+static void cdp1864_init_palette(running_device *device, const cdp1864_interface *intf)
{
int i;
@@ -402,7 +402,7 @@ static STREAM_UPDATE( cdp1864_stream_update )
cdp1864_update - update screen
-------------------------------------------------*/
-void cdp1864_update(const device_config *device, bitmap_t *bitmap, const rectangle *cliprect)
+void cdp1864_update(running_device *device, bitmap_t *bitmap, const rectangle *cliprect)
{
cdp1864_t *cdp1864 = get_safe_token(device);
@@ -424,7 +424,7 @@ void cdp1864_update(const device_config *device, bitmap_t *bitmap, const rectang
static DEVICE_START( cdp1864 )
{
cdp1864_t *cdp1864 = get_safe_token(device);
- const cdp1864_interface *intf = (const cdp1864_interface *) device->static_config;
+ const cdp1864_interface *intf = (const cdp1864_interface *) device->baseconfig().static_config;
/* resolve callbacks */
devcb_resolve_read_line(&cdp1864->in_rdata_func, &intf->in_rdata_func, device);