summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu
diff options
context:
space:
mode:
author Couriersud <couriersud@users.noreply.github.com>2008-08-20 21:15:01 +0000
committer Couriersud <couriersud@users.noreply.github.com>2008-08-20 21:15:01 +0000
commit772082e0b88a348c6f68a83f1295dc42325fbbbe (patch)
treee135a41b9bfd1869ddbadc4130d12c511fef60f8 /src/emu
parent6f9eaf0908683e797f687293fb44d7af25041567 (diff)
devintrf.c: add devtag_get_device(machine, type, tag) to retrieve the device_config for (type, tag)
* This is needed, if you need to read a device or device status outside a AM_DEVREAD context.
Diffstat (limited to 'src/emu')
-rw-r--r--src/emu/devintrf.c20
-rw-r--r--src/emu/devintrf.h3
2 files changed, 23 insertions, 0 deletions
diff --git a/src/emu/devintrf.c b/src/emu/devintrf.c
index d684c1fed8d..b8fdd88b223 100644
--- a/src/emu/devintrf.c
+++ b/src/emu/devintrf.c
@@ -591,6 +591,26 @@ void *devtag_get_token(running_machine *machine, device_type type, const char *t
/*-------------------------------------------------
+ devtag_get_device - return the device associated
+ with a tag
+-------------------------------------------------*/
+
+const device_config *devtag_get_device(running_machine *machine, device_type type, const char *tag)
+{
+ const device_config *device;
+
+ assert(machine != NULL);
+ assert(type != NULL);
+ assert(tag != NULL);
+
+ device = device_list_find_by_tag(machine->config->devicelist, type, tag);
+ if (device == NULL)
+ fatalerror("devtag_get_device failed to find device: type=%s tag=%s\n", devtype_name(type), tag);
+ return device;
+}
+
+
+/*-------------------------------------------------
devtag_get_static_config - return a pointer to
the static configuration for a device based on
type and tag
diff --git a/src/emu/devintrf.h b/src/emu/devintrf.h
index 53f150b2c95..0331b666d0f 100644
--- a/src/emu/devintrf.h
+++ b/src/emu/devintrf.h
@@ -254,6 +254,9 @@ void devtag_reset(running_machine *machine, device_type type, const char *tag);
/* ----- device information getters ----- */
+/* return the device associated with a tag */
+const device_config *devtag_get_device(running_machine *machine, device_type type, const char *tag);
+
/* return the token associated with an allocated device */
void *devtag_get_token(running_machine *machine, device_type type, const char *tag);