clang-format in src/disk/
This commit is contained in:
@@ -29,33 +29,30 @@
|
||||
#include <86box/hdc_ide.h>
|
||||
#include <86box/hdd.h>
|
||||
|
||||
|
||||
int hdc_current;
|
||||
|
||||
int hdc_current;
|
||||
|
||||
#ifdef ENABLE_HDC_LOG
|
||||
int hdc_do_log = ENABLE_HDC_LOG;
|
||||
|
||||
|
||||
static void
|
||||
hdc_log(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
if (hdc_do_log) {
|
||||
va_start(ap, fmt);
|
||||
pclog_ex(fmt, ap);
|
||||
va_end(ap);
|
||||
va_start(ap, fmt);
|
||||
pclog_ex(fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
}
|
||||
#else
|
||||
#define hdc_log(fmt, ...)
|
||||
# define hdc_log(fmt, ...)
|
||||
#endif
|
||||
|
||||
static void *
|
||||
nullhdc_init(const device_t *info)
|
||||
{
|
||||
return(NULL);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -66,7 +63,7 @@ nullhdc_close(void *priv)
|
||||
static void *
|
||||
inthdc_init(const device_t *info)
|
||||
{
|
||||
return(NULL);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -75,37 +72,37 @@ inthdc_close(void *priv)
|
||||
}
|
||||
|
||||
static const device_t hdc_none_device = {
|
||||
.name = "None",
|
||||
.name = "None",
|
||||
.internal_name = "none",
|
||||
.flags = 0,
|
||||
.local = 0,
|
||||
.init = nullhdc_init,
|
||||
.close = nullhdc_close,
|
||||
.reset = NULL,
|
||||
.flags = 0,
|
||||
.local = 0,
|
||||
.init = nullhdc_init,
|
||||
.close = nullhdc_close,
|
||||
.reset = NULL,
|
||||
{ .available = NULL },
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
};
|
||||
|
||||
static const device_t hdc_internal_device = {
|
||||
.name = "Internal",
|
||||
.name = "Internal",
|
||||
.internal_name = "internal",
|
||||
.flags = 0,
|
||||
.local = 0,
|
||||
.init = inthdc_init,
|
||||
.close = inthdc_close,
|
||||
.reset = NULL,
|
||||
.flags = 0,
|
||||
.local = 0,
|
||||
.init = inthdc_init,
|
||||
.close = inthdc_close,
|
||||
.reset = NULL,
|
||||
{ .available = NULL },
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
};
|
||||
|
||||
static const struct {
|
||||
const device_t *device;
|
||||
const device_t *device;
|
||||
} controllers[] = {
|
||||
// clang-format off
|
||||
// clang-format off
|
||||
{ &hdc_none_device },
|
||||
{ &hdc_internal_device },
|
||||
{ &st506_xt_xebec_device },
|
||||
@@ -133,7 +130,7 @@ static const struct {
|
||||
{ &ide_vlb_device },
|
||||
{ &ide_vlb_2ch_device },
|
||||
{ NULL }
|
||||
// clang-format on
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
/* Initialize the 'hdc_current' value based on configured HDC name. */
|
||||
@@ -146,77 +143,72 @@ hdc_init(void)
|
||||
hdd_image_init();
|
||||
}
|
||||
|
||||
|
||||
/* Reset the HDC, whichever one that is. */
|
||||
void
|
||||
hdc_reset(void)
|
||||
{
|
||||
hdc_log("HDC: reset(current=%d, internal=%d)\n",
|
||||
hdc_current, (machines[machine].flags & MACHINE_HDC) ? 1 : 0);
|
||||
hdc_current, (machines[machine].flags & MACHINE_HDC) ? 1 : 0);
|
||||
|
||||
/* If we have a valid controller, add its device. */
|
||||
if (hdc_current > 1)
|
||||
device_add(controllers[hdc_current].device);
|
||||
device_add(controllers[hdc_current].device);
|
||||
|
||||
/* Now, add the tertiary and/or quaternary IDE controllers. */
|
||||
if (ide_ter_enabled)
|
||||
device_add(&ide_ter_device);
|
||||
device_add(&ide_ter_device);
|
||||
if (ide_qua_enabled)
|
||||
device_add(&ide_qua_device);
|
||||
device_add(&ide_qua_device);
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
hdc_get_internal_name(int hdc)
|
||||
{
|
||||
return device_get_internal_name(controllers[hdc].device);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
hdc_get_from_internal_name(char *s)
|
||||
{
|
||||
int c = 0;
|
||||
|
||||
while (controllers[c].device != NULL) {
|
||||
if (!strcmp((char *) controllers[c].device->internal_name, s))
|
||||
return c;
|
||||
c++;
|
||||
if (!strcmp((char *) controllers[c].device->internal_name, s))
|
||||
return c;
|
||||
c++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
const device_t *
|
||||
hdc_get_device(int hdc)
|
||||
{
|
||||
return(controllers[hdc].device);
|
||||
return (controllers[hdc].device);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
hdc_has_config(int hdc)
|
||||
{
|
||||
const device_t *dev = hdc_get_device(hdc);
|
||||
|
||||
if (dev == NULL) return(0);
|
||||
if (dev == NULL)
|
||||
return (0);
|
||||
|
||||
if (!device_has_config(dev)) return(0);
|
||||
if (!device_has_config(dev))
|
||||
return (0);
|
||||
|
||||
return(1);
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
hdc_get_flags(int hdc)
|
||||
{
|
||||
return(controllers[hdc].device->flags);
|
||||
return (controllers[hdc].device->flags);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
hdc_available(int hdc)
|
||||
{
|
||||
return(device_available(controllers[hdc].device));
|
||||
return (device_available(controllers[hdc].device));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user