Bring net_cards in line with other device arrays

This commit is contained in:
Jasmine Iwanek
2024-12-27 22:08:36 -05:00
parent 3243ae66ee
commit 7dd540db96

View File

@@ -75,40 +75,46 @@
# include <winsock2.h> # include <winsock2.h>
#endif #endif
static const device_t *net_cards[] = { typedef struct {
&device_none, const device_t *device;
&device_internal, } NETWORK_CARD;
&threec501_device,
&threec503_device, static const NETWORK_CARD net_cards[] = {
&pcnet_am79c960_device, // clang-format off
&pcnet_am79c961_device, { &device_none },
&de220p_device, { &device_internal },
&ne1000_compat_device, { &threec501_device },
&ne2000_compat_device, { &threec503_device },
&ne2000_compat_8bit_device, { &pcnet_am79c960_device },
&ne1000_device, { &pcnet_am79c961_device },
&ne2000_device, { &de220p_device },
&pcnet_am79c960_eb_device, { &ne1000_compat_device },
&rtl8019as_device, { &ne2000_compat_device },
&wd8003e_device, { &ne2000_compat_8bit_device },
&wd8003eb_device, { &ne1000_device },
&wd8013ebt_device, { &ne2000_device },
&plip_device, { &pcnet_am79c960_eb_device },
&ethernext_mc_device, { &rtl8019as_device },
&wd8003eta_device, { &wd8003e_device },
&wd8003ea_device, { &wd8003eb_device },
&wd8013epa_device, { &wd8013ebt_device },
&pcnet_am79c973_device, { &plip_device },
&pcnet_am79c970a_device, { &ethernext_mc_device },
&dec_tulip_device, { &wd8003eta_device },
&rtl8029as_device, { &wd8003ea_device },
&rtl8139c_plus_device, { &wd8013epa_device },
&dec_tulip_21140_device, { &pcnet_am79c973_device },
&dec_tulip_21140_vpc_device, { &pcnet_am79c970a_device },
&dec_tulip_21040_device, { &dec_tulip_device },
&pcnet_am79c960_vlb_device, { &rtl8029as_device },
&modem_device, { &rtl8139c_plus_device },
NULL { &dec_tulip_21140_device },
{ &dec_tulip_21140_vpc_device },
{ &dec_tulip_21040_device },
{ &pcnet_am79c960_vlb_device },
{ &modem_device },
{ NULL }
// clang-format on
}; };
netcard_conf_t net_cards_conf[NET_CARD_MAX]; netcard_conf_t net_cards_conf[NET_CARD_MAX];
@@ -581,7 +587,7 @@ network_reset(void)
net_card_current = i; net_card_current = i;
if (net_cards_conf[i].device_num > NET_INTERNAL) if (net_cards_conf[i].device_num > NET_INTERNAL)
device_add_inst(net_cards[net_cards_conf[i].device_num], i + 1); device_add_inst(net_cards[net_cards_conf[i].device_num].device, i + 1);
} }
} }
@@ -712,8 +718,8 @@ network_available(void)
int int
network_card_available(int card) network_card_available(int card)
{ {
if (net_cards[card]) if (net_cards[card].device)
return (device_available(net_cards[card])); return (device_available(net_cards[card].device));
return 1; return 1;
} }
@@ -722,24 +728,24 @@ network_card_available(int card)
const device_t * const device_t *
network_card_getdevice(int card) network_card_getdevice(int card)
{ {
return (net_cards[card]); return (net_cards[card].device);
} }
/* UI */ /* UI */
int int
network_card_has_config(int card) network_card_has_config(int card)
{ {
if (!net_cards[card]) if (!net_cards[card].device)
return 0; return 0;
return (device_has_config(net_cards[card]) ? 1 : 0); return (device_has_config(net_cards[card].device) ? 1 : 0);
} }
/* UI */ /* UI */
const char * const char *
network_card_get_internal_name(int card) network_card_get_internal_name(int card)
{ {
return device_get_internal_name(net_cards[card]); return device_get_internal_name(net_cards[card].device);
} }
/* UI */ /* UI */
@@ -748,8 +754,8 @@ network_card_get_from_internal_name(char *s)
{ {
int c = 0; int c = 0;
while (net_cards[c] != NULL) { while (net_cards[c].device != NULL) {
if (!strcmp(net_cards[c]->internal_name, s)) if (!strcmp(net_cards[c].device->internal_name, s))
return c; return c;
c++; c++;
} }