clang-format in src/scsi/
This commit is contained in:
@@ -42,37 +42,33 @@
|
||||
#include <86box/scsi_pcscsi.h>
|
||||
#include <86box/scsi_spock.h>
|
||||
#ifdef WALTJE
|
||||
# include "scsi_wd33c93.h"
|
||||
# include "scsi_wd33c93.h"
|
||||
#endif
|
||||
|
||||
int scsi_card_current[SCSI_BUS_MAX] = { 0, 0 };
|
||||
|
||||
int scsi_card_current[SCSI_BUS_MAX] = { 0, 0 };
|
||||
|
||||
static uint8_t next_scsi_bus = 0;
|
||||
|
||||
static uint8_t next_scsi_bus = 0;
|
||||
|
||||
static const device_t scsi_none_device = {
|
||||
.name = "None",
|
||||
.name = "None",
|
||||
.internal_name = "none",
|
||||
.flags = 0,
|
||||
.local = 0,
|
||||
.init = NULL,
|
||||
.close = NULL,
|
||||
.reset = NULL,
|
||||
.flags = 0,
|
||||
.local = 0,
|
||||
.init = NULL,
|
||||
.close = NULL,
|
||||
.reset = NULL,
|
||||
{ .available = NULL },
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
};
|
||||
|
||||
|
||||
typedef const struct {
|
||||
const device_t *device;
|
||||
const device_t *device;
|
||||
} SCSI_CARD;
|
||||
|
||||
|
||||
static SCSI_CARD scsi_cards[] = {
|
||||
// clang-format off
|
||||
// clang-format off
|
||||
{ &scsi_none_device, },
|
||||
{ &aha154xa_device, },
|
||||
{ &aha154xb_device, },
|
||||
@@ -107,79 +103,72 @@ static SCSI_CARD scsi_cards[] = {
|
||||
{ &buslogic_445s_device, },
|
||||
{ &buslogic_445c_device, },
|
||||
{ NULL, },
|
||||
// clang-format on
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
|
||||
void
|
||||
scsi_reset(void)
|
||||
{
|
||||
next_scsi_bus = 0;
|
||||
}
|
||||
|
||||
|
||||
uint8_t
|
||||
scsi_get_bus(void)
|
||||
{
|
||||
uint8_t ret = next_scsi_bus;
|
||||
|
||||
if (next_scsi_bus >= SCSI_BUS_MAX)
|
||||
return 0xff;
|
||||
return 0xff;
|
||||
|
||||
next_scsi_bus++;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
scsi_card_available(int card)
|
||||
{
|
||||
if (scsi_cards[card].device)
|
||||
return(device_available(scsi_cards[card].device));
|
||||
return (device_available(scsi_cards[card].device));
|
||||
|
||||
return(1);
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
||||
const device_t *
|
||||
scsi_card_getdevice(int card)
|
||||
{
|
||||
return(scsi_cards[card].device);
|
||||
return (scsi_cards[card].device);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
scsi_card_has_config(int card)
|
||||
{
|
||||
if (! scsi_cards[card].device) return(0);
|
||||
if (!scsi_cards[card].device)
|
||||
return (0);
|
||||
|
||||
return(device_has_config(scsi_cards[card].device) ? 1 : 0);
|
||||
return (device_has_config(scsi_cards[card].device) ? 1 : 0);
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
scsi_card_get_internal_name(int card)
|
||||
{
|
||||
return device_get_internal_name(scsi_cards[card].device);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
scsi_card_get_from_internal_name(char *s)
|
||||
{
|
||||
int c = 0;
|
||||
|
||||
while (scsi_cards[c].device != NULL) {
|
||||
if (!strcmp((char *) scsi_cards[c].device->internal_name, s))
|
||||
return(c);
|
||||
c++;
|
||||
if (!strcmp((char *) scsi_cards[c].device->internal_name, s))
|
||||
return (c);
|
||||
c++;
|
||||
}
|
||||
|
||||
return(0);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
scsi_card_init(void)
|
||||
{
|
||||
@@ -188,16 +177,16 @@ scsi_card_init(void)
|
||||
/* On-board SCSI controllers get the first bus, so if one is present,
|
||||
increase our instance number here. */
|
||||
if (machine_has_flags(machine, MACHINE_SCSI))
|
||||
max--;
|
||||
max--;
|
||||
|
||||
/* Do not initialize any controllers if we have do not have any SCSI
|
||||
/* Do not initialize any controllers if we have do not have any SCSI
|
||||
bus left. */
|
||||
if (max > 0) {
|
||||
for (i = 0; i < max; i++) {
|
||||
if (!scsi_cards[scsi_card_current[i]].device)
|
||||
continue;
|
||||
for (i = 0; i < max; i++) {
|
||||
if (!scsi_cards[scsi_card_current[i]].device)
|
||||
continue;
|
||||
|
||||
device_add_inst(scsi_cards[scsi_card_current[i]].device, i + 1);
|
||||
}
|
||||
device_add_inst(scsi_cards[scsi_card_current[i]].device, i + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user