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.
This commit is contained in:
Couriersud 2008-08-20 21:15:01 +00:00
parent 6f9eaf0908
commit 772082e0b8
2 changed files with 23 additions and 0 deletions

View File

@ -590,6 +590,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

View File

@ -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);