Separated main code from UI and PLATform support code, plus other generally small fixes here and there.
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
*
|
||||
* NOTE: The file will also implement an NE1000 for 8-bit ISA systems.
|
||||
*
|
||||
* Version: @(#)net_ne2000.c 1.0.17 2017/10/07
|
||||
* Version: @(#)net_ne2000.c 1.0.18 2017/10/09
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Peter Grehan, grehan@iprg.nokia.com>
|
||||
@@ -18,6 +18,7 @@
|
||||
*
|
||||
* Based on @(#)ne2k.cc v1.56.2.1 2004/02/02 22:37:22 cbothamy
|
||||
* Portions Copyright (C) 2002 MandrakeSoft S.A.
|
||||
* Copyright 2017 Fred N. van Kempen.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
@@ -35,18 +36,14 @@
|
||||
#include "../pic.h"
|
||||
#include "../random.h"
|
||||
#include "../device.h"
|
||||
#include "../win/win.h"
|
||||
#include "../ui.h"
|
||||
#include "network.h"
|
||||
#include "net_ne2000.h"
|
||||
#include "bswap.h"
|
||||
|
||||
|
||||
/* ROM BIOS file paths. */
|
||||
#ifdef DEV_BRANCH
|
||||
#ifdef USE_NE1000
|
||||
#define ROM_PATH_NE1000 L"roms/network/ne1000/ne1000.rom"
|
||||
#endif
|
||||
#endif
|
||||
#define ROM_PATH_NE2000 L"roms/network/ne2000/ne2000.rom"
|
||||
#define ROM_PATH_RTL8029 L"roms/network/rtl8029as/rtl8029as.rom"
|
||||
|
||||
@@ -1675,7 +1672,7 @@ mcast_index(const void *dst)
|
||||
static void
|
||||
nic_tx(nic_t *dev, uint32_t val)
|
||||
{
|
||||
StatusBarUpdateIcon(SB_NETWORK, 1);
|
||||
ui_sb_update_icon(SB_NETWORK, 1);
|
||||
|
||||
dev->CR.tx_packet = 0;
|
||||
dev->TSR.tx_ok = 1;
|
||||
@@ -1686,7 +1683,7 @@ nic_tx(nic_t *dev, uint32_t val)
|
||||
nic_interrupt(dev, 1);
|
||||
dev->tx_timer_active = 0;
|
||||
|
||||
StatusBarUpdateIcon(SB_NETWORK, 0);
|
||||
ui_sb_update_icon(SB_NETWORK, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -1707,7 +1704,7 @@ nic_rx(void *priv, uint8_t *buf, int io_len)
|
||||
int idx, nextpage;
|
||||
int endbytes;
|
||||
|
||||
StatusBarUpdateIcon(SB_NETWORK, 1);
|
||||
ui_sb_update_icon(SB_NETWORK, 1);
|
||||
|
||||
if (io_len != 60)
|
||||
nelog(2, "%s: rx_frame with length %d\n", dev->name, io_len);
|
||||
@@ -1738,14 +1735,14 @@ nic_rx(void *priv, uint8_t *buf, int io_len)
|
||||
) {
|
||||
nelog(1, "%s: no space\n", dev->name);
|
||||
|
||||
StatusBarUpdateIcon(SB_NETWORK, 0);
|
||||
ui_sb_update_icon(SB_NETWORK, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((io_len < 40/*60*/) && !dev->RCR.runts_ok) {
|
||||
nelog(1, "%s: rejected small packet, length %d\n", dev->name, io_len);
|
||||
|
||||
StatusBarUpdateIcon(SB_NETWORK, 0);
|
||||
ui_sb_update_icon(SB_NETWORK, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1767,7 +1764,7 @@ nic_rx(void *priv, uint8_t *buf, int io_len)
|
||||
if (! dev->RCR.broadcast) {
|
||||
nelog(2, "%s: RX BC disabled\n", dev->name);
|
||||
|
||||
StatusBarUpdateIcon(SB_NETWORK, 0);
|
||||
ui_sb_update_icon(SB_NETWORK, 0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1780,7 +1777,7 @@ nic_rx(void *priv, uint8_t *buf, int io_len)
|
||||
nelog(2, "%s: RX MC disabled\n", dev->name);
|
||||
#endif
|
||||
|
||||
StatusBarUpdateIcon(SB_NETWORK, 0);
|
||||
ui_sb_update_icon(SB_NETWORK, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1789,7 +1786,7 @@ nic_rx(void *priv, uint8_t *buf, int io_len)
|
||||
if (! (dev->mchash[idx>>3] & (1<<(idx&0x7)))) {
|
||||
nelog(2, "%s: RX MC not listed\n", dev->name);
|
||||
|
||||
StatusBarUpdateIcon(SB_NETWORK, 0);
|
||||
ui_sb_update_icon(SB_NETWORK, 0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1835,7 +1832,7 @@ nic_rx(void *priv, uint8_t *buf, int io_len)
|
||||
if (dev->IMR.rx_inte)
|
||||
nic_interrupt(dev, 1);
|
||||
|
||||
StatusBarUpdateIcon(SB_NETWORK, 0);
|
||||
ui_sb_update_icon(SB_NETWORK, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -1894,8 +1891,7 @@ nic_init(device_t *info)
|
||||
dev->board = info->local;
|
||||
rom = NULL;
|
||||
switch(dev->board) {
|
||||
#ifdef DEV_BRANCH
|
||||
#ifdef USE_NE1000
|
||||
#if defined(DEV_BRANCH) && defined(USE_NE1000)
|
||||
case NE2K_NE1000:
|
||||
strcpy(dev->name, "NE1000");
|
||||
dev->maclocal[0] = 0x00; /* 00:00:D8 (NE1000 ISA OID) */
|
||||
@@ -1903,7 +1899,6 @@ nic_init(device_t *info)
|
||||
dev->maclocal[2] = 0xD8;
|
||||
rom = ROM_PATH_NE1000;
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
case NE2K_NE2000:
|
||||
@@ -2051,6 +2046,8 @@ nic_init(device_t *info)
|
||||
nelog(1, "%s: %s attached IO=0x%X IRQ=%d\n", dev->name,
|
||||
dev->is_pci?"PCI":"ISA", dev->base_address, dev->base_irq);
|
||||
|
||||
ui_sb_update_icon(SB_NETWORK, 0);
|
||||
|
||||
return(dev);
|
||||
}
|
||||
|
||||
@@ -2071,8 +2068,7 @@ nic_close(void *priv)
|
||||
}
|
||||
|
||||
|
||||
#ifdef DEV_BRANCH
|
||||
#ifdef USE_NE1000
|
||||
#if defined(DEV_BRANCH) && defined(USE_NE1000)
|
||||
static device_config_t ne1000_config[] =
|
||||
{
|
||||
{
|
||||
@@ -2146,7 +2142,6 @@ static device_config_t ne1000_config[] =
|
||||
}
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static device_config_t ne2000_config[] =
|
||||
{
|
||||
@@ -2241,22 +2236,20 @@ static device_config_t rtl8029as_config[] =
|
||||
};
|
||||
|
||||
|
||||
#ifdef DEV_BRANCH
|
||||
#ifdef USE_NE1000
|
||||
#if defined(DEV_BRANCH) && defined(USE_NE1000)
|
||||
device_t ne1000_device = {
|
||||
"Novell NE1000",
|
||||
DEVICE_ISA,
|
||||
0,
|
||||
NE2K_NE1000,
|
||||
nic_init, nic_close, NULL,
|
||||
NULL, NULL, NULL, NULL,
|
||||
ne1000_config
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
|
||||
device_t ne2000_device = {
|
||||
"Novell NE2000",
|
||||
DEVICE_ISA | DEVICE_AT,
|
||||
DEVICE_AT,
|
||||
NE2K_NE2000,
|
||||
nic_init, nic_close, NULL,
|
||||
NULL, NULL, NULL, NULL,
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Handle WinPcap library processing.
|
||||
*
|
||||
* Version: @(#)net_pcap.c 1.0.6 2017/09/24
|
||||
* Version: @(#)net_pcap.c 1.0.7 2017/10/09
|
||||
*
|
||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*/
|
||||
@@ -21,9 +21,9 @@
|
||||
#include "../ibm.h"
|
||||
#include "../config.h"
|
||||
#include "../device.h"
|
||||
#include "network.h"
|
||||
#include "../win/plat_dynld.h"
|
||||
#include "../win/plat_thread.h"
|
||||
#include "network.h"
|
||||
|
||||
|
||||
static void *pcap_handle; /* handle to WinPcap DLL */
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Handle SLiRP library processing.
|
||||
*
|
||||
* Version: @(#)net_slirp.c 1.0.5 2017/09/24
|
||||
* Version: @(#)net_slirp.c 1.0.6 2017/10/09
|
||||
*
|
||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*/
|
||||
@@ -22,8 +22,8 @@
|
||||
#include "../ibm.h"
|
||||
#include "../config.h"
|
||||
#include "../device.h"
|
||||
#include "network.h"
|
||||
#include "../win/plat_thread.h"
|
||||
#include "network.h"
|
||||
|
||||
|
||||
static queueADT slirpq; /* SLiRP library handle */
|
||||
|
||||
@@ -12,9 +12,11 @@
|
||||
* it should be malloc'ed and then linked to the NETCARD def.
|
||||
* Will be done later.
|
||||
*
|
||||
* Version: @(#)network.c 1.0.12 2017/10/04
|
||||
* Version: @(#)network.c 1.0.13 2017/10/09
|
||||
*
|
||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*
|
||||
* Copyright 2017 Fred N. van Kempen.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
@@ -23,7 +25,7 @@
|
||||
#include <wchar.h>
|
||||
#include "../ibm.h"
|
||||
#include "../device.h"
|
||||
#include "../win/plat_ui.h"
|
||||
#include "../ui.h"
|
||||
#include "network.h"
|
||||
#include "net_ne2000.h"
|
||||
|
||||
@@ -31,15 +33,13 @@
|
||||
static netcard_t net_cards[] = {
|
||||
{ "None", "none", NULL,
|
||||
NULL, NULL },
|
||||
#ifdef DEV_BRANCH
|
||||
#ifdef USE_NE1000
|
||||
{ "[ISA] Novell NE1000", "ne1k", &ne1000_device,
|
||||
#if defined(DEV_BRANCH) && defined(USE_NE1000)
|
||||
{ "Novell NE1000", "ne1k", &ne1000_device,
|
||||
NULL, NULL },
|
||||
#endif
|
||||
#endif
|
||||
{ "[ISA] Novell NE2000", "ne2k", &ne2000_device,
|
||||
{ "Novell NE2000", "ne2k", &ne2000_device,
|
||||
NULL, NULL },
|
||||
{ "[PCI] Realtek RTL8029AS","ne2kpci", &rtl8029as_device,
|
||||
{ "Realtek RTL8029AS", "ne2kpci", &rtl8029as_device,
|
||||
NULL, NULL },
|
||||
{ "", "", NULL,
|
||||
NULL, NULL }
|
||||
@@ -115,7 +115,7 @@ network_attach(void *dev, uint8_t *mac, NETRXCB rx)
|
||||
case NET_TYPE_PCAP:
|
||||
ret = network_pcap_setup(mac, rx, dev);
|
||||
if (ret < 0) {
|
||||
plat_msgbox_error(IDS_2139);
|
||||
ui_msgbox(MBX_ERROR, (wchar_t *)IDS_2139);
|
||||
network_type = NET_TYPE_NONE;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -10,16 +10,18 @@
|
||||
*
|
||||
* Based on the "libpcap" examples.
|
||||
*
|
||||
* Version: @(#)pcap_if.c 1.0.3 2017/06/04
|
||||
* Version: @(#)pcap_if.c 1.0.4 2017/10/09
|
||||
*
|
||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*
|
||||
* Copyright 2017 Fred N. van Kempen.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <ctype.h>
|
||||
#include <pcap.h>
|
||||
#include "plat_dynld.h"
|
||||
#include "../win/plat_dynld.h"
|
||||
|
||||
|
||||
static void *pcap_handle; /* handle to WinPcap DLL */
|
||||
|
||||
Reference in New Issue
Block a user