Extra CONFIG_BIOS Helpers
This commit is contained in:
107
src/device.c
107
src/device.c
@@ -429,6 +429,113 @@ device_available(const device_t *dev)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t
|
||||||
|
device_get_bios_type(const device_t *dev, const char *internal_name)
|
||||||
|
{
|
||||||
|
const device_config_t *config = NULL;
|
||||||
|
const device_config_bios_t *bios = NULL;
|
||||||
|
|
||||||
|
if (dev != NULL) {
|
||||||
|
config = dev->config;
|
||||||
|
if (config != NULL) {
|
||||||
|
while (config->type != CONFIG_END) {
|
||||||
|
if (config->type == CONFIG_BIOS) {
|
||||||
|
bios = config->bios;
|
||||||
|
while (bios->files_no != 0) {
|
||||||
|
if (!strcmp(internal_name, bios->internal_name))
|
||||||
|
return bios->bios_type;
|
||||||
|
bios++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
config++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t
|
||||||
|
device_get_bios_num_files(const device_t *dev, const char *internal_name)
|
||||||
|
{
|
||||||
|
const device_config_t *config = NULL;
|
||||||
|
const device_config_bios_t *bios = NULL;
|
||||||
|
|
||||||
|
if (dev != NULL) {
|
||||||
|
config = dev->config;
|
||||||
|
if (config != NULL) {
|
||||||
|
while (config->type != CONFIG_END) {
|
||||||
|
if (config->type == CONFIG_BIOS) {
|
||||||
|
bios = config->bios;
|
||||||
|
while (bios->files_no != 0) {
|
||||||
|
if (!strcmp(internal_name, bios->internal_name))
|
||||||
|
return bios->files_no;
|
||||||
|
bios++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
config++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t
|
||||||
|
device_get_bios_local(const device_t *dev, const char *internal_name)
|
||||||
|
{
|
||||||
|
const device_config_t *config = NULL;
|
||||||
|
const device_config_bios_t *bios = NULL;
|
||||||
|
|
||||||
|
if (dev != NULL) {
|
||||||
|
config = dev->config;
|
||||||
|
if (config != NULL) {
|
||||||
|
while (config->type != CONFIG_END) {
|
||||||
|
if (config->type == CONFIG_BIOS) {
|
||||||
|
bios = config->bios;
|
||||||
|
while (bios->files_no != 0) {
|
||||||
|
printf("Internal name was: %s", internal_name);
|
||||||
|
if (!strcmp(internal_name, bios->internal_name))
|
||||||
|
return bios->local;
|
||||||
|
bios++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
config++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t
|
||||||
|
device_get_bios_file_size(const device_t *dev, const char *internal_name)
|
||||||
|
{
|
||||||
|
const device_config_t *config = NULL;
|
||||||
|
const device_config_bios_t *bios = NULL;
|
||||||
|
|
||||||
|
if (dev != NULL) {
|
||||||
|
config = dev->config;
|
||||||
|
if (config != NULL) {
|
||||||
|
while (config->type != CONFIG_END) {
|
||||||
|
if (config->type == CONFIG_BIOS) {
|
||||||
|
bios = config->bios;
|
||||||
|
|
||||||
|
/* Go through the ROM's in the device configuration. */
|
||||||
|
while (bios->files_no != 0) {
|
||||||
|
if (!strcmp(internal_name, bios->internal_name))
|
||||||
|
return bios->size;
|
||||||
|
bios++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
config++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
device_get_bios_file(const device_t *dev, const char *internal_name, int file_no)
|
device_get_bios_file(const device_t *dev, const char *internal_name, int file_no)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -137,8 +137,8 @@ typedef struct device_config_spinner_t {
|
|||||||
typedef struct device_config_bios_t {
|
typedef struct device_config_bios_t {
|
||||||
const char *name;
|
const char *name;
|
||||||
const char *internal_name;
|
const char *internal_name;
|
||||||
int bios_type;
|
uint8_t bios_type;
|
||||||
int files_no;
|
uint8_t files_no;
|
||||||
uint32_t local;
|
uint32_t local;
|
||||||
uint32_t size;
|
uint32_t size;
|
||||||
void *dev1;
|
void *dev1;
|
||||||
@@ -211,6 +211,11 @@ extern void device_speed_changed(void);
|
|||||||
extern void device_force_redraw(void);
|
extern void device_force_redraw(void);
|
||||||
extern void device_get_name(const device_t *dev, int bus, char *name);
|
extern void device_get_name(const device_t *dev, int bus, char *name);
|
||||||
extern int device_has_config(const device_t *dev);
|
extern int device_has_config(const device_t *dev);
|
||||||
|
|
||||||
|
extern uint8_t device_get_bios_type(const device_t *dev, const char *internal_name);
|
||||||
|
extern uint8_t device_get_bios_num_files(const device_t *dev, const char *internal_name);
|
||||||
|
extern uint32_t device_get_bios_local(const device_t *dev, const char *internal_name);
|
||||||
|
extern uint32_t device_get_bios_file_size(const device_t *dev, const char *internal_name);
|
||||||
extern const char *device_get_bios_file(const device_t *dev, const char *internal_name, int file_no);
|
extern const char *device_get_bios_file(const device_t *dev, const char *internal_name, int file_no);
|
||||||
|
|
||||||
extern int device_is_valid(const device_t *, int mch);
|
extern int device_is_valid(const device_t *, int mch);
|
||||||
|
|||||||
Reference in New Issue
Block a user