summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/sound/msm5205.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/msm5205.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/msm5205.c')
-rw-r--r--src/emu/sound/msm5205.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/emu/sound/msm5205.c b/src/emu/sound/msm5205.c
index 8cb6a0c03e7..15f64b27c11 100644
--- a/src/emu/sound/msm5205.c
+++ b/src/emu/sound/msm5205.c
@@ -32,7 +32,7 @@ typedef struct _msm5205_state msm5205_state;
struct _msm5205_state
{
const msm5205_interface *intf;
- const device_config *device;
+ running_device *device;
sound_stream * stream; /* number of stream system */
INT32 clock; /* clock rate */
emu_timer *timer; /* VCLK callback timer */
@@ -46,7 +46,7 @@ struct _msm5205_state
int diff_lookup[49*16];
};
-INLINE msm5205_state *get_safe_token(const device_config *device)
+INLINE msm5205_state *get_safe_token(running_device *device)
{
assert(device != NULL);
assert(device->token != NULL);
@@ -182,7 +182,7 @@ static DEVICE_START( msm5205 )
msm5205_state *voice = get_safe_token(device);
/* save a global pointer to our interface */
- voice->intf = (const msm5205_interface *)device->static_config;
+ voice->intf = (const msm5205_interface *)device->baseconfig().static_config;
voice->device = device;
voice->clock = device->clock;
@@ -211,7 +211,7 @@ static DEVICE_START( msm5205 )
* Handle an update of the vclk status of a chip (1 is reset ON, 0 is reset OFF)
* This function can use selector = MSM5205_SEX only
*/
-void msm5205_vclk_w (const device_config *device, int vclk)
+void msm5205_vclk_w (running_device *device, int vclk)
{
msm5205_state *voice = get_safe_token(device);
@@ -233,7 +233,7 @@ void msm5205_vclk_w (const device_config *device, int vclk)
* Handle an update of the reset status of a chip (1 is reset ON, 0 is reset OFF)
*/
-void msm5205_reset_w (const device_config *device, int reset)
+void msm5205_reset_w (running_device *device, int reset)
{
msm5205_state *voice = get_safe_token(device);
voice->reset = reset;
@@ -243,7 +243,7 @@ void msm5205_reset_w (const device_config *device, int reset)
* Handle an update of the data to the chip
*/
-void msm5205_data_w (const device_config *device, int data)
+void msm5205_data_w (running_device *device, int data)
{
msm5205_state *voice = get_safe_token(device);
if( voice->bitwidth == 4)
@@ -256,7 +256,7 @@ void msm5205_data_w (const device_config *device, int data)
* Handle an change of the selector
*/
-void msm5205_playmode_w(const device_config *device, int select)
+void msm5205_playmode_w(running_device *device, int select)
{
msm5205_state *voice = get_safe_token(device);
msm5205_playmode(voice,select);
@@ -293,7 +293,7 @@ static void msm5205_playmode(msm5205_state *voice,int select)
}
-void msm5205_set_volume(const device_config *device,int volume)
+void msm5205_set_volume(running_device *device,int volume)
{
msm5205_state *voice = get_safe_token(device);