summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/machine/pd4990a.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/machine/pd4990a.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/machine/pd4990a.c')
-rw-r--r--src/emu/machine/pd4990a.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/emu/machine/pd4990a.c b/src/emu/machine/pd4990a.c
index 08ca627db58..cf6efd601c5 100644
--- a/src/emu/machine/pd4990a.c
+++ b/src/emu/machine/pd4990a.c
@@ -82,7 +82,7 @@ struct _upd4990a_state
INLINE FUNCTIONS
***************************************************************************/
-INLINE upd4990a_state *get_safe_token(const device_config *device)
+INLINE upd4990a_state *get_safe_token(running_device *device)
{
assert(device != NULL);
assert(device->token != NULL);
@@ -104,7 +104,7 @@ INLINE UINT8 convert_to_bcd(int val)
upd4990a_increment_month
-------------------------------------------------*/
-static void upd4990a_increment_month( const device_config *device )
+static void upd4990a_increment_month( running_device *device )
{
upd4990a_state *upd4990a = get_safe_token(device);
@@ -127,7 +127,7 @@ static void upd4990a_increment_month( const device_config *device )
upd4990a_increment_day
-------------------------------------------------*/
-static void upd4990a_increment_day( const device_config *device )
+static void upd4990a_increment_day( running_device *device )
{
upd4990a_state *upd4990a = get_safe_token(device);
int real_year;
@@ -185,7 +185,7 @@ static void upd4990a_increment_day( const device_config *device )
upd4990a_addretrace
-------------------------------------------------*/
-void upd4990a_addretrace( const device_config *device )
+void upd4990a_addretrace( running_device *device )
{
upd4990a_state *upd4990a = get_safe_token(device);
@@ -258,7 +258,7 @@ READ8_DEVICE_HANDLER( upd4990a_databit_r )
upd4990a_readbit
-------------------------------------------------*/
-static void upd4990a_readbit( const device_config *device )
+static void upd4990a_readbit( running_device *device )
{
upd4990a_state *upd4990a = get_safe_token(device);
@@ -300,7 +300,7 @@ static void upd4990a_readbit( const device_config *device )
upd4990a_resetbitstream
-------------------------------------------------*/
-static void upd4990a_resetbitstream( const device_config *device )
+static void upd4990a_resetbitstream( running_device *device )
{
upd4990a_state *upd4990a = get_safe_token(device);
@@ -313,7 +313,7 @@ static void upd4990a_resetbitstream( const device_config *device )
upd4990a_writebit
-------------------------------------------------*/
-static void upd4990a_writebit( const device_config *device , UINT8 bit )
+static void upd4990a_writebit( running_device *device , UINT8 bit )
{
upd4990a_state *upd4990a = get_safe_token(device);
if (upd4990a->bitno <= 31) //low part
@@ -326,7 +326,7 @@ static void upd4990a_writebit( const device_config *device , UINT8 bit )
upd4990a_nextbit
-------------------------------------------------*/
-static void upd4990a_nextbit( const device_config *device )
+static void upd4990a_nextbit( running_device *device )
{
upd4990a_state *upd4990a = get_safe_token(device);
++upd4990a->bitno;
@@ -346,7 +346,7 @@ static void upd4990a_nextbit( const device_config *device )
upd4990a_getcommand
-------------------------------------------------*/
-static UINT8 upd4990a_getcommand( const device_config *device )
+static UINT8 upd4990a_getcommand( running_device *device )
{
upd4990a_state *upd4990a = get_safe_token(device);
//Warning: problems if the 4 bits are in different
@@ -361,7 +361,7 @@ static UINT8 upd4990a_getcommand( const device_config *device )
upd4990a_update_date
-------------------------------------------------*/
-static void upd4990a_update_date( const device_config *device )
+static void upd4990a_update_date( running_device *device )
{
upd4990a_state *upd4990a = get_safe_token(device);
@@ -378,7 +378,7 @@ static void upd4990a_update_date( const device_config *device )
upd4990a_process_command
-------------------------------------------------*/
-static void upd4990a_process_command( const device_config *device )
+static void upd4990a_process_command( running_device *device )
{
upd4990a_state *upd4990a = get_safe_token(device);
@@ -412,7 +412,7 @@ static void upd4990a_process_command( const device_config *device )
upd4990a_serial_control
-------------------------------------------------*/
-static void upd4990a_serial_control( const device_config *device, UINT8 data )
+static void upd4990a_serial_control( running_device *device, UINT8 data )
{
upd4990a_state *upd4990a = get_safe_token(device);