Move all include files to src/include
- 86Box's own headers go to /86box - munt's public interface goes to /mt32emu - all slirp headers go to /slirp (might want to consider using only its public inteface) - single file headers from other projects go in include root
This commit is contained in:
@@ -1,231 +0,0 @@
|
||||
/*
|
||||
* VARCem Virtual ARchaeological Computer EMulator.
|
||||
* An emulator of (mostly) x86-based PC systems and devices,
|
||||
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
|
||||
* spanning the era between 1981 and 1995.
|
||||
*
|
||||
* This file is part of the VARCem Project.
|
||||
*
|
||||
* Various definitions for portable byte-swapping.
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* neozeed,
|
||||
*
|
||||
* Copyright 2017,2018 Fred N. van Kempen.
|
||||
* Copyright 2016-2018 neozeed.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the:
|
||||
*
|
||||
* Free Software Foundation, Inc.
|
||||
* 59 Temple Place - Suite 330
|
||||
* Boston, MA 02111-1307
|
||||
* USA.
|
||||
*/
|
||||
#ifndef BSWAP_H
|
||||
#define BSWAP_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef HAVE_BYTESWAP_H
|
||||
#include <byteswap.h>
|
||||
#else
|
||||
# define bswap_16(x) \
|
||||
( \
|
||||
((uint16_t)( \
|
||||
(((uint16_t)(x) & (uint16_t)0x00ffU) << 8) | \
|
||||
(((uint16_t)(x) & (uint16_t)0xff00U) >> 8) )) \
|
||||
)
|
||||
|
||||
# define bswap_32(x) \
|
||||
( \
|
||||
((uint32_t)( \
|
||||
(((uint32_t)(x) & (uint32_t)0x000000ffUL) << 24) | \
|
||||
(((uint32_t)(x) & (uint32_t)0x0000ff00UL) << 8) | \
|
||||
(((uint32_t)(x) & (uint32_t)0x00ff0000UL) >> 8) | \
|
||||
(((uint32_t)(x) & (uint32_t)0xff000000UL) >> 24) )) \
|
||||
)
|
||||
|
||||
# define bswap_64(x) \
|
||||
( \
|
||||
((uint64_t)( \
|
||||
(uint64_t)(((uint64_t)(x) & (uint64_t)0x00000000000000ffULL) << 56) | \
|
||||
(uint64_t)(((uint64_t)(x) & (uint64_t)0x000000000000ff00ULL) << 40) | \
|
||||
(uint64_t)(((uint64_t)(x) & (uint64_t)0x0000000000ff0000ULL) << 24) | \
|
||||
(uint64_t)(((uint64_t)(x) & (uint64_t)0x00000000ff000000ULL) << 8) | \
|
||||
(uint64_t)(((uint64_t)(x) & (uint64_t)0x000000ff00000000ULL) >> 8) | \
|
||||
(uint64_t)(((uint64_t)(x) & (uint64_t)0x0000ff0000000000ULL) >> 24) | \
|
||||
(uint64_t)(((uint64_t)(x) & (uint64_t)0x00ff000000000000ULL) >> 40) | \
|
||||
(uint64_t)(((uint64_t)(x) & (uint64_t)0xff00000000000000ULL) >> 56) )) \
|
||||
)
|
||||
#endif /*HAVE_BYTESWAP_H*/
|
||||
|
||||
static __inline uint16_t bswap16(uint16_t x)
|
||||
{
|
||||
return bswap_16(x);
|
||||
}
|
||||
|
||||
static __inline uint32_t bswap32(uint32_t x)
|
||||
{
|
||||
return bswap_32(x);
|
||||
}
|
||||
|
||||
static __inline uint64_t bswap64(uint64_t x)
|
||||
{
|
||||
return bswap_64(x);
|
||||
}
|
||||
|
||||
static __inline void bswap16s(uint16_t *s)
|
||||
{
|
||||
*s = bswap16(*s);
|
||||
}
|
||||
|
||||
static __inline void bswap32s(uint32_t *s)
|
||||
{
|
||||
*s = bswap32(*s);
|
||||
}
|
||||
|
||||
static __inline void bswap64s(uint64_t *s)
|
||||
{
|
||||
*s = bswap64(*s);
|
||||
}
|
||||
|
||||
#if defined(WORDS_BIGENDIAN)
|
||||
# define be_bswap(v, size) (v)
|
||||
# define le_bswap(v, size) bswap ## size(v)
|
||||
# define be_bswaps(v, size)
|
||||
# define le_bswaps(p, size) *p = bswap ## size(*p);
|
||||
#else
|
||||
# define le_bswap(v, size) (v)
|
||||
# define be_bswap(v, size) bswap ## size(v)
|
||||
# define le_bswaps(v, size)
|
||||
# define be_bswaps(p, size) *p = bswap ## size(*p);
|
||||
#endif
|
||||
|
||||
#define CPU_CONVERT(endian, size, type)\
|
||||
static __inline type endian ## size ## _to_cpu(type v)\
|
||||
{\
|
||||
return endian ## _bswap(v, size);\
|
||||
}\
|
||||
\
|
||||
static __inline type cpu_to_ ## endian ## size(type v)\
|
||||
{\
|
||||
return endian ## _bswap(v, size);\
|
||||
}\
|
||||
\
|
||||
static __inline void endian ## size ## _to_cpus(type *p)\
|
||||
{\
|
||||
endian ## _bswaps(p, size)\
|
||||
}\
|
||||
\
|
||||
static __inline void cpu_to_ ## endian ## size ## s(type *p)\
|
||||
{\
|
||||
endian ## _bswaps(p, size)\
|
||||
}\
|
||||
\
|
||||
static __inline type endian ## size ## _to_cpup(const type *p)\
|
||||
{\
|
||||
return endian ## size ## _to_cpu(*p);\
|
||||
}\
|
||||
\
|
||||
static __inline void cpu_to_ ## endian ## size ## w(type *p, type v)\
|
||||
{\
|
||||
*p = cpu_to_ ## endian ## size(v);\
|
||||
}
|
||||
|
||||
CPU_CONVERT(be, 16, uint16_t)
|
||||
CPU_CONVERT(be, 32, uint32_t)
|
||||
CPU_CONVERT(be, 64, uint64_t)
|
||||
|
||||
CPU_CONVERT(le, 16, uint16_t)
|
||||
CPU_CONVERT(le, 32, uint32_t)
|
||||
CPU_CONVERT(le, 64, uint64_t)
|
||||
|
||||
/* unaligned versions (optimized for frequent unaligned accesses)*/
|
||||
|
||||
#if defined(__i386__) || defined(__powerpc__)
|
||||
|
||||
#define cpu_to_le16wu(p, v) cpu_to_le16w(p, v)
|
||||
#define cpu_to_le32wu(p, v) cpu_to_le32w(p, v)
|
||||
#define le16_to_cpupu(p) le16_to_cpup(p)
|
||||
#define le32_to_cpupu(p) le32_to_cpup(p)
|
||||
|
||||
#define cpu_to_be16wu(p, v) cpu_to_be16w(p, v)
|
||||
#define cpu_to_be32wu(p, v) cpu_to_be32w(p, v)
|
||||
|
||||
#else
|
||||
|
||||
static __inline void cpu_to_le16wu(uint16_t *p, uint16_t v)
|
||||
{
|
||||
uint8_t *p1 = (uint8_t *)p;
|
||||
|
||||
p1[0] = v & 0xff;
|
||||
p1[1] = v >> 8;
|
||||
}
|
||||
|
||||
static __inline void cpu_to_le32wu(uint32_t *p, uint32_t v)
|
||||
{
|
||||
uint8_t *p1 = (uint8_t *)p;
|
||||
|
||||
p1[0] = v;
|
||||
p1[1] = v >> 8;
|
||||
p1[2] = v >> 16;
|
||||
p1[3] = v >> 24;
|
||||
}
|
||||
|
||||
static __inline uint16_t le16_to_cpupu(const uint16_t *p)
|
||||
{
|
||||
const uint8_t *p1 = (const uint8_t *)p;
|
||||
return p1[0] | (p1[1] << 8);
|
||||
}
|
||||
|
||||
static __inline uint32_t le32_to_cpupu(const uint32_t *p)
|
||||
{
|
||||
const uint8_t *p1 = (const uint8_t *)p;
|
||||
return p1[0] | (p1[1] << 8) | (p1[2] << 16) | (p1[3] << 24);
|
||||
}
|
||||
|
||||
static __inline void cpu_to_be16wu(uint16_t *p, uint16_t v)
|
||||
{
|
||||
uint8_t *p1 = (uint8_t *)p;
|
||||
|
||||
p1[0] = v >> 8;
|
||||
p1[1] = v & 0xff;
|
||||
}
|
||||
|
||||
static __inline void cpu_to_be32wu(uint32_t *p, uint32_t v)
|
||||
{
|
||||
uint8_t *p1 = (uint8_t *)p;
|
||||
|
||||
p1[0] = v >> 24;
|
||||
p1[1] = v >> 16;
|
||||
p1[2] = v >> 8;
|
||||
p1[3] = v;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
#define cpu_to_32wu cpu_to_be32wu
|
||||
#else
|
||||
#define cpu_to_32wu cpu_to_le32wu
|
||||
#endif
|
||||
|
||||
#undef le_bswap
|
||||
#undef be_bswap
|
||||
#undef le_bswaps
|
||||
#undef be_bswaps
|
||||
|
||||
#endif /* BSWAP_H */
|
||||
@@ -48,17 +48,17 @@
|
||||
#include <wchar.h>
|
||||
#include <time.h>
|
||||
#define HAVE_STDARG_H
|
||||
#include "86box.h"
|
||||
#include "86box_io.h"
|
||||
#include "dma.h"
|
||||
#include "pic.h"
|
||||
#include "mem.h"
|
||||
#include "random.h"
|
||||
#include "device.h"
|
||||
#include "network.h"
|
||||
#include "net_dp8390.h"
|
||||
#include "net_3c503.h"
|
||||
#include "bswap.h"
|
||||
#include <86box/86box.h>
|
||||
#include <86box/io.h>
|
||||
#include <86box/dma.h>
|
||||
#include <86box/pic.h>
|
||||
#include <86box/mem.h>
|
||||
#include <86box/random.h>
|
||||
#include <86box/device.h>
|
||||
#include <86box/network.h>
|
||||
#include <86box/net_dp8390.h>
|
||||
#include <86box/net_3c503.h>
|
||||
#include <86box/bswap.h>
|
||||
|
||||
typedef struct {
|
||||
dp8390_t *dp8390;
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
#ifndef NET_3C503_H
|
||||
# define NET_3C503_H
|
||||
|
||||
extern const device_t threec503_device;
|
||||
|
||||
|
||||
#endif /*NET_3C503_H*/
|
||||
@@ -23,10 +23,10 @@
|
||||
#include <wchar.h>
|
||||
#include <time.h>
|
||||
#define HAVE_STDARG_H
|
||||
#include "86box.h"
|
||||
#include "device.h"
|
||||
#include "network.h"
|
||||
#include "net_dp8390.h"
|
||||
#include <86box/86box.h>
|
||||
#include <86box/device.h>
|
||||
#include <86box/network.h>
|
||||
#include <86box/net_dp8390.h>
|
||||
|
||||
|
||||
static void dp8390_tx(dp8390_t *dev, uint32_t val);
|
||||
|
||||
@@ -1,215 +0,0 @@
|
||||
/*
|
||||
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
||||
* running old operating systems and software designed for IBM
|
||||
* PC systems and compatibles from 1981 through fairly recent
|
||||
* system designs based on the PCI bus.
|
||||
*
|
||||
* Header of the emulation of the DP8390 Network Interface
|
||||
* Controller used by the WD family, NE1000/NE2000 family, and
|
||||
* 3Com 3C503 NIC's.
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
* Bochs project,
|
||||
*
|
||||
* Copyright 2016-2018 Miran Grca.
|
||||
* Copyright 2008-2018 Bochs project.
|
||||
*/
|
||||
#ifndef NET_DP8390_H
|
||||
# define NET_DP8390_H
|
||||
|
||||
/* Never completely fill the ne2k ring so that we never
|
||||
hit the unclear completely full buffer condition. */
|
||||
#define DP8390_NEVER_FULL_RING (1)
|
||||
|
||||
#define DP8390_DWORD_MEMSIZ (32*1024)
|
||||
#define DP8390_DWORD_MEMSTART (16*1024)
|
||||
#define DP8390_DWORD_MEMEND (DP8390_DWORD_MEMSTART+DP8390_DWORD_MEMSIZ)
|
||||
|
||||
#define DP8390_WORD_MEMSIZ (16*1024)
|
||||
#define DP8390_WORD_MEMSTART (8*1024)
|
||||
#define DP8390_WORD_MEMEND (DP8390_WORD_MEMSTART+DP8390_WORD_MEMSIZ)
|
||||
|
||||
#define DP8390_FLAG_EVEN_MAC 0x01
|
||||
#define DP8390_FLAG_CHECK_CR 0x02
|
||||
#define DP8390_FLAG_CLEAR_IRQ 0x04
|
||||
|
||||
typedef struct {
|
||||
/* Page 0 */
|
||||
|
||||
/* Command Register - 00h read/write */
|
||||
struct CR_t {
|
||||
int stop; /* STP - Software Reset command */
|
||||
int start; /* START - start the NIC */
|
||||
int tx_packet; /* TXP - initiate packet transmission */
|
||||
uint8_t rdma_cmd; /* RD0,RD1,RD2 - Remote DMA command */
|
||||
uint8_t pgsel; /* PS0,PS1 - Page select */
|
||||
} CR;
|
||||
|
||||
/* Interrupt Status Register - 07h read/write */
|
||||
struct ISR_t {
|
||||
int pkt_rx; /* PRX - packet received with no errors */
|
||||
int pkt_tx; /* PTX - packet txed with no errors */
|
||||
int rx_err; /* RXE - packet rxed with 1 or more errors */
|
||||
int tx_err; /* TXE - packet txed " " " " " */
|
||||
int overwrite; /* OVW - rx buffer resources exhausted */
|
||||
int cnt_oflow; /* CNT - network tally counter MSB's set */
|
||||
int rdma_done; /* RDC - remote DMA complete */
|
||||
int reset; /* RST - reset status */
|
||||
} ISR;
|
||||
|
||||
/* Interrupt Mask Register - 0fh write */
|
||||
struct IMR_t {
|
||||
int rx_inte; /* PRXE - packet rx interrupt enable */
|
||||
int tx_inte; /* PTXE - packet tx interrput enable */
|
||||
int rxerr_inte; /* RXEE - rx error interrupt enable */
|
||||
int txerr_inte; /* TXEE - tx error interrupt enable */
|
||||
int overw_inte; /* OVWE - overwrite warn int enable */
|
||||
int cofl_inte; /* CNTE - counter o'flow int enable */
|
||||
int rdma_inte; /* RDCE - remote DMA complete int enable */
|
||||
int reserved; /* D7 - reserved */
|
||||
} IMR;
|
||||
|
||||
/* Data Configuration Register - 0eh write */
|
||||
struct DCR_t {
|
||||
int wdsize; /* WTS - 8/16-bit select */
|
||||
int endian; /* BOS - byte-order select */
|
||||
int longaddr; /* LAS - long-address select */
|
||||
int loop; /* LS - loopback select */
|
||||
int auto_rx; /* AR - auto-remove rx pkts with remote DMA */
|
||||
uint8_t fifo_size; /* FT0,FT1 - fifo threshold */
|
||||
} DCR;
|
||||
|
||||
/* Transmit Configuration Register - 0dh write */
|
||||
struct TCR_t {
|
||||
int crc_disable; /* CRC - inhibit tx CRC */
|
||||
uint8_t loop_cntl; /* LB0,LB1 - loopback control */
|
||||
int ext_stoptx; /* ATD - allow tx disable by external mcast */
|
||||
int coll_prio; /* OFST - backoff algorithm select */
|
||||
uint8_t reserved; /* D5,D6,D7 - reserved */
|
||||
} TCR;
|
||||
|
||||
/* Transmit Status Register - 04h read */
|
||||
struct TSR_t {
|
||||
int tx_ok; /* PTX - tx complete without error */
|
||||
int reserved; /* D1 - reserved */
|
||||
int collided; /* COL - tx collided >= 1 times */
|
||||
int aborted; /* ABT - aborted due to excessive collisions */
|
||||
int no_carrier; /* CRS - carrier-sense lost */
|
||||
int fifo_ur; /* FU - FIFO underrun */
|
||||
int cd_hbeat; /* CDH - no tx cd-heartbeat from transceiver */
|
||||
int ow_coll; /* OWC - out-of-window collision */
|
||||
} TSR;
|
||||
|
||||
/* Receive Configuration Register - 0ch write */
|
||||
struct RCR_t {
|
||||
int errors_ok; /* SEP - accept pkts with rx errors */
|
||||
int runts_ok; /* AR - accept < 64-byte runts */
|
||||
int broadcast; /* AB - accept eth broadcast address */
|
||||
int multicast; /* AM - check mcast hash array */
|
||||
int promisc; /* PRO - accept all packets */
|
||||
int monitor; /* MON - check pkts, but don't rx */
|
||||
uint8_t reserved; /* D6,D7 - reserved */
|
||||
} RCR;
|
||||
|
||||
/* Receive Status Register - 0ch read */
|
||||
struct RSR_t {
|
||||
int rx_ok; /* PRX - rx complete without error */
|
||||
int bad_crc; /* CRC - Bad CRC detected */
|
||||
int bad_falign; /* FAE - frame alignment error */
|
||||
int fifo_or; /* FO - FIFO overrun */
|
||||
int rx_missed; /* MPA - missed packet error */
|
||||
int rx_mbit; /* PHY - unicast or mcast/bcast address match */
|
||||
int rx_disabled; /* DIS - set when in monitor mode */
|
||||
int deferred; /* DFR - collision active */
|
||||
} RSR;
|
||||
|
||||
uint16_t local_dma; /* 01,02h read ; current local DMA addr */
|
||||
uint8_t page_start; /* 01h write ; page start regr */
|
||||
uint8_t page_stop; /* 02h write ; page stop regr */
|
||||
uint8_t bound_ptr; /* 03h read/write ; boundary pointer */
|
||||
uint8_t tx_page_start; /* 04h write ; transmit page start reg */
|
||||
uint8_t num_coll; /* 05h read ; number-of-collisions reg */
|
||||
uint16_t tx_bytes; /* 05,06h write ; transmit byte-count reg */
|
||||
uint8_t fifo; /* 06h read ; FIFO */
|
||||
uint16_t remote_dma; /* 08,09h read ; current remote DMA addr */
|
||||
uint16_t remote_start; /* 08,09h write ; remote start address reg */
|
||||
uint16_t remote_bytes; /* 0a,0bh write ; remote byte-count reg */
|
||||
uint8_t tallycnt_0; /* 0dh read ; tally ctr 0 (frame align errs) */
|
||||
uint8_t tallycnt_1; /* 0eh read ; tally ctr 1 (CRC errors) */
|
||||
uint8_t tallycnt_2; /* 0fh read ; tally ctr 2 (missed pkt errs) */
|
||||
|
||||
/* Page 1 */
|
||||
|
||||
/* Command Register 00h (repeated) */
|
||||
|
||||
uint8_t physaddr[6]; /* 01-06h read/write ; MAC address */
|
||||
uint8_t curr_page; /* 07h read/write ; current page register */
|
||||
uint8_t mchash[8]; /* 08-0fh read/write ; multicast hash array */
|
||||
|
||||
/* Page 2 - diagnostic use only */
|
||||
|
||||
/* Command Register 00h (repeated) */
|
||||
|
||||
/* Page Start Register 01h read (repeated)
|
||||
* Page Stop Register 02h read (repeated)
|
||||
* Current Local DMA Address 01,02h write (repeated)
|
||||
* Transmit Page start address 04h read (repeated)
|
||||
* Receive Configuration Register 0ch read (repeated)
|
||||
* Transmit Configuration Register 0dh read (repeated)
|
||||
* Data Configuration Register 0eh read (repeated)
|
||||
* Interrupt Mask Register 0fh read (repeated)
|
||||
*/
|
||||
uint8_t rempkt_ptr; /* 03h read/write ; rmt next-pkt ptr */
|
||||
uint8_t localpkt_ptr; /* 05h read/write ; lcl next-pkt ptr */
|
||||
uint16_t address_cnt; /* 06,07h read/write ; address cter */
|
||||
|
||||
/* Page 3 - should never be modified. */
|
||||
|
||||
/* DP8390 memory */
|
||||
uint8_t *mem; /* on-chip packet memory */
|
||||
|
||||
uint8_t macaddr[32]; /* ASIC ROM'd MAC address, even bytes */
|
||||
uint8_t macaddr_size, /* Defaults to 16 but can be 32 */
|
||||
flags, /* Flags affecting some behaviors. */
|
||||
id0, /* 0x50 for the Realtek NIC's, otherwise
|
||||
0xFF. */
|
||||
id1; /* 0x70 for the RTL8019AS, 0x43 for the
|
||||
RTL8029AS, otherwise 0xFF. */
|
||||
int mem_size, mem_start, mem_end;
|
||||
|
||||
int tx_timer_index;
|
||||
int tx_timer_active;
|
||||
|
||||
void *priv;
|
||||
|
||||
void (*interrupt)(void *priv, int set);
|
||||
} dp8390_t;
|
||||
|
||||
extern const device_t dp8390_device;
|
||||
|
||||
|
||||
extern uint32_t dp8390_chipmem_read(dp8390_t *dev, uint32_t addr, unsigned int len);
|
||||
extern void dp8390_chipmem_write(dp8390_t *dev, uint32_t addr, uint32_t val, unsigned len);
|
||||
|
||||
extern uint32_t dp8390_read_cr(dp8390_t *dev);
|
||||
extern void dp8390_write_cr(dp8390_t *dev, uint32_t val);
|
||||
|
||||
extern void dp8390_rx(void *priv, uint8_t *buf, int io_len);
|
||||
|
||||
extern uint32_t dp8390_page0_read(dp8390_t *dev, uint32_t off, unsigned int len);
|
||||
extern void dp8390_page0_write(dp8390_t *dev, uint32_t off, uint32_t val, unsigned len);
|
||||
extern uint32_t dp8390_page1_read(dp8390_t *dev, uint32_t off, unsigned int len);
|
||||
extern void dp8390_page1_write(dp8390_t *dev, uint32_t off, uint32_t val, unsigned len);
|
||||
extern uint32_t dp8390_page2_read(dp8390_t *dev, uint32_t off, unsigned int len);
|
||||
extern void dp8390_page2_write(dp8390_t *dev, uint32_t off, uint32_t val, unsigned len);
|
||||
|
||||
extern void dp8390_set_defaults(dp8390_t *dev, uint8_t flags);
|
||||
extern void dp8390_mem_alloc(dp8390_t *dev, uint32_t start, uint32_t size);
|
||||
extern void dp8390_set_id(dp8390_t *dev, uint8_t id0, uint8_t id1);
|
||||
extern void dp8390_reset(dp8390_t *dev);
|
||||
extern void dp8390_soft_reset(dp8390_t *dev);
|
||||
|
||||
|
||||
#endif /*NET_DP8390_H*/
|
||||
@@ -52,19 +52,19 @@
|
||||
#include <wchar.h>
|
||||
#include <time.h>
|
||||
#define HAVE_STDARG_H
|
||||
#include "86box.h"
|
||||
#include "86box_io.h"
|
||||
#include "mem.h"
|
||||
#include "rom.h"
|
||||
#include "mca.h"
|
||||
#include "pci.h"
|
||||
#include "pic.h"
|
||||
#include "random.h"
|
||||
#include "device.h"
|
||||
#include "network.h"
|
||||
#include "net_dp8390.h"
|
||||
#include "net_ne2000.h"
|
||||
#include "bswap.h"
|
||||
#include <86box/86box.h>
|
||||
#include <86box/io.h>
|
||||
#include <86box/mem.h>
|
||||
#include <86box/rom.h>
|
||||
#include <86box/mca.h>
|
||||
#include <86box/pci.h>
|
||||
#include <86box/pic.h>
|
||||
#include <86box/random.h>
|
||||
#include <86box/device.h>
|
||||
#include <86box/network.h>
|
||||
#include <86box/net_dp8390.h>
|
||||
#include <86box/net_ne2000.h>
|
||||
#include <86box/bswap.h>
|
||||
|
||||
|
||||
enum {
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* VARCem Virtual ARchaeological Computer EMulator.
|
||||
* An emulator of (mostly) x86-based PC systems and devices,
|
||||
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
|
||||
* spanning the era between 1981 and 1995.
|
||||
*
|
||||
* This file is part of the VARCem Project.
|
||||
*
|
||||
* Definitions for the NE2000 ethernet controller.
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*
|
||||
* Copyright 2017,2018 Fred N. van Kempen.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the:
|
||||
*
|
||||
* Free Software Foundation, Inc.
|
||||
* 59 Temple Place - Suite 330
|
||||
* Boston, MA 02111-1307
|
||||
* USA.
|
||||
*/
|
||||
#ifndef NET_NE2000_H
|
||||
# define NET_NE2000_H
|
||||
|
||||
|
||||
enum {
|
||||
NE2K_NONE = 0,
|
||||
NE2K_NE1000 = 1, /* 8-bit ISA NE1000 */
|
||||
NE2K_NE2000 = 2, /* 16-bit ISA NE2000 */
|
||||
NE2K_ETHERNEXT_MC = 3, /* 16-bit MCA EtherNext/MC */
|
||||
NE2K_RTL8019AS = 4, /* 16-bit ISA PnP Realtek 8019AS */
|
||||
NE2K_RTL8029AS = 5 /* 32-bit PCI Realtek 8029AS */
|
||||
};
|
||||
|
||||
|
||||
extern const device_t ne1000_device;
|
||||
extern const device_t ne2000_device;
|
||||
extern const device_t ethernext_mc_device;
|
||||
extern const device_t rtl8019as_device;
|
||||
extern const device_t rtl8029as_device;
|
||||
|
||||
|
||||
#endif /*NET_NE2000_H*/
|
||||
@@ -51,11 +51,11 @@
|
||||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
#define HAVE_STDARG_H
|
||||
#include "86box.h"
|
||||
#include "device.h"
|
||||
#include "plat.h"
|
||||
#include "plat_dynld.h"
|
||||
#include "network.h"
|
||||
#include <86box/86box.h>
|
||||
#include <86box/device.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/plat_dynld.h>
|
||||
#include <86box/network.h>
|
||||
|
||||
|
||||
typedef int bpf_int32;
|
||||
|
||||
@@ -31,19 +31,19 @@
|
||||
#include <wchar.h>
|
||||
#include <time.h>
|
||||
#define HAVE_STDARG_H
|
||||
#include "86box.h"
|
||||
#include "86box_io.h"
|
||||
#include "timer.h"
|
||||
#include "dma.h"
|
||||
#include "mem.h"
|
||||
#include "rom.h"
|
||||
#include "pci.h"
|
||||
#include "pic.h"
|
||||
#include "random.h"
|
||||
#include "device.h"
|
||||
#include "network.h"
|
||||
#include "net_pcnet.h"
|
||||
#include "bswap.h"
|
||||
#include <86box/86box.h>
|
||||
#include <86box/io.h>
|
||||
#include <86box/timer.h>
|
||||
#include <86box/dma.h>
|
||||
#include <86box/mem.h>
|
||||
#include <86box/rom.h>
|
||||
#include <86box/pci.h>
|
||||
#include <86box/pic.h>
|
||||
#include <86box/random.h>
|
||||
#include <86box/device.h>
|
||||
#include <86box/network.h>
|
||||
#include <86box/net_pcnet.h>
|
||||
#include <86box/bswap.h>
|
||||
|
||||
/* PCI info. */
|
||||
#define PCI_VENDID 0x1022 /* AMD */
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
||||
* running old operating systems and software designed for IBM
|
||||
* PC systems and compatibles from 1981 through fairly recent
|
||||
* system designs based on the PCI bus.
|
||||
*
|
||||
* Emulation of the AMD PCnet LANCE NIC controller for both the ISA
|
||||
* and PCI buses.
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
* TheCollector1995, <mariogplayer@gmail.com>
|
||||
* Antony T Curtis
|
||||
*
|
||||
* Copyright 2004-2019 Antony T Curtis
|
||||
* Copyright 2016-2019 Miran Grca.
|
||||
*/
|
||||
#ifndef NET_PCNET_H
|
||||
# define NET_PCNET_H
|
||||
|
||||
enum {
|
||||
DEV_NONE = 0,
|
||||
DEV_AM79C960 = 1, /* PCnet-ISA (ISA, 10 Mbps, NE2100/NE1500T compatible) */
|
||||
DEV_AM79C960_EB = 2, /* PCnet-ISA (ISA, 10 Mbps, Racal InterLan EtherBlaster compatible) */
|
||||
DEV_AM79C960_VLB = 3, /* PCnet-VLB (VLB, 10 Mbps, NE2100/NE1500T compatible) */
|
||||
DEV_AM79C970A = 4, /* PCnet-PCI II (PCI, 10 Mbps) */
|
||||
DEV_AM79C973 = 5 /* PCnet-FAST III (PCI, 10/100 Mbps) */
|
||||
};
|
||||
|
||||
|
||||
extern const device_t pcnet_am79c960_device;
|
||||
extern const device_t pcnet_am79c960_eb_device;
|
||||
extern const device_t pcnet_am79c960_vlb_device;
|
||||
extern const device_t pcnet_am79c970a_device;
|
||||
extern const device_t pcnet_am79c973_device;
|
||||
|
||||
#endif /*NET_PCNET_H*/
|
||||
@@ -51,12 +51,12 @@
|
||||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
#define HAVE_STDARG_H
|
||||
#include "slirp/slirp.h"
|
||||
#include "slirp/queue.h"
|
||||
#include "86box.h"
|
||||
#include "device.h"
|
||||
#include "plat.h"
|
||||
#include "network.h"
|
||||
#include <slirp/slirp.h>
|
||||
#include <slirp/queue.h>
|
||||
#include <86box/86box.h>
|
||||
#include <86box/device.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/network.h>
|
||||
|
||||
|
||||
static volatile queueADT slirpq; /* SLiRP library handle */
|
||||
|
||||
@@ -48,20 +48,20 @@
|
||||
#include <wchar.h>
|
||||
#include <time.h>
|
||||
#define HAVE_STDARG_H
|
||||
#include "86box.h"
|
||||
#include "86box_io.h"
|
||||
#include "mem.h"
|
||||
#include "rom.h"
|
||||
#include "machine.h"
|
||||
#include "mca.h"
|
||||
#include "pci.h"
|
||||
#include "pic.h"
|
||||
#include "random.h"
|
||||
#include "device.h"
|
||||
#include "network.h"
|
||||
#include "net_dp8390.h"
|
||||
#include "net_wd8003.h"
|
||||
#include "bswap.h"
|
||||
#include <86box/86box.h>
|
||||
#include <86box/io.h>
|
||||
#include <86box/mem.h>
|
||||
#include <86box/rom.h>
|
||||
#include <86box/machine.h>
|
||||
#include <86box/mca.h>
|
||||
#include <86box/pci.h>
|
||||
#include <86box/pic.h>
|
||||
#include <86box/random.h>
|
||||
#include <86box/device.h>
|
||||
#include <86box/network.h>
|
||||
#include <86box/net_dp8390.h>
|
||||
#include <86box/net_wd8003.h>
|
||||
#include <86box/bswap.h>
|
||||
|
||||
/* Board type codes in card ID */
|
||||
#define WE_TYPE_WD8003 0x01
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
/*
|
||||
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
||||
* running old operating systems and software designed for IBM
|
||||
* PC systems and compatibles from 1981 through fairly recent
|
||||
* system designs based on the PCI bus.
|
||||
*
|
||||
* This file is part of the 86Box distribution.
|
||||
*
|
||||
* Implementation of the following network controllers:
|
||||
* - SMC/WD 8003E (ISA 8-bit);
|
||||
* - SMC/WD 8013EBT (ISA 16-bit);
|
||||
* - SMC/WD 8013EP/A (MCA).
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* TheCollector1995, <mariogplayer@gmail.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Peter Grehan, <grehan@iprg.nokia.com>
|
||||
*
|
||||
* Copyright 2017,2018 Fred N. van Kempen.
|
||||
* Copyright 2016-2018 Miran Grca.
|
||||
* Portions Copyright (C) 2002 MandrakeSoft S.A.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the:
|
||||
*
|
||||
* Free Software Foundation, Inc.
|
||||
* 59 Temple Place - Suite 330
|
||||
* Boston, MA 02111-1307
|
||||
* USA.
|
||||
*/
|
||||
#ifndef NET_WD8003_H
|
||||
# define NET_WD8003_H
|
||||
|
||||
enum {
|
||||
WD_NONE = 0,
|
||||
WD8003E, /* WD8003E : 8-bit ISA, no interface chip */
|
||||
WD8003EB, /* WD8003EB : 8-bit ISA, 5x3 interface chip */
|
||||
WD8013EBT, /* WD8013EBT : 16-bit ISA, no interface chip */
|
||||
WD8003ETA, /* WD8003ET/A: 16-bit MCA, no interface chip */
|
||||
WD8003EA /* WD8003E/A : 16-bit MCA, 5x3 interface chip */
|
||||
};
|
||||
|
||||
extern const device_t wd8003e_device;
|
||||
extern const device_t wd8003eb_device;
|
||||
extern const device_t wd8013ebt_device;
|
||||
extern const device_t wd8003eta_device;
|
||||
extern const device_t wd8003ea_device;
|
||||
|
||||
#endif /*NET_WD8003_H*/
|
||||
@@ -55,15 +55,15 @@
|
||||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
#define HAVE_STDARG_H
|
||||
#include "86box.h"
|
||||
#include "device.h"
|
||||
#include "plat.h"
|
||||
#include "ui.h"
|
||||
#include "network.h"
|
||||
#include "net_3c503.h"
|
||||
#include "net_ne2000.h"
|
||||
#include "net_pcnet.h"
|
||||
#include "net_wd8003.h"
|
||||
#include <86box/86box.h>
|
||||
#include <86box/device.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/ui.h>
|
||||
#include <86box/network.h>
|
||||
#include <86box/net_3c503.h>
|
||||
#include <86box/net_ne2000.h>
|
||||
#include <86box/net_pcnet.h>
|
||||
#include <86box/net_wd8003.h>
|
||||
|
||||
|
||||
static netcard_t net_cards[] = {
|
||||
|
||||
@@ -1,137 +0,0 @@
|
||||
/*
|
||||
* VARCem Virtual ARchaeological Computer EMulator.
|
||||
* An emulator of (mostly) x86-based PC systems and devices,
|
||||
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
|
||||
* spanning the era between 1981 and 1995.
|
||||
*
|
||||
* This file is part of the VARCem Project.
|
||||
*
|
||||
* Definitions for the network module.
|
||||
*
|
||||
*
|
||||
*
|
||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*
|
||||
* Copyright 2017-2019 Fred N. van Kempen.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with
|
||||
* or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the entire
|
||||
* above notice, this list of conditions and the following
|
||||
* disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names
|
||||
* of its contributors may be used to endorse or promote
|
||||
* products derived from this software without specific
|
||||
* prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef EMU_NETWORK_H
|
||||
# define EMU_NETWORK_H
|
||||
# include <stdint.h>
|
||||
|
||||
|
||||
/* Network provider types. */
|
||||
#define NET_TYPE_NONE 0 /* networking disabled */
|
||||
#define NET_TYPE_PCAP 1 /* use the (Win)Pcap API */
|
||||
#define NET_TYPE_SLIRP 2 /* use the SLiRP port forwarder */
|
||||
|
||||
/* Supported network cards. */
|
||||
enum {
|
||||
NONE = 0,
|
||||
NE1000,
|
||||
NE2000,
|
||||
RTL8019AS,
|
||||
RTL8029AS
|
||||
};
|
||||
|
||||
|
||||
typedef void (*NETRXCB)(void *, uint8_t *, int);
|
||||
typedef int (*NETWAITCB)(void *);
|
||||
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
const char *internal_name;
|
||||
const device_t *device;
|
||||
void *priv;
|
||||
int (*poll)(void *);
|
||||
NETRXCB rx;
|
||||
NETWAITCB wait;
|
||||
} netcard_t;
|
||||
|
||||
typedef struct {
|
||||
char device[128];
|
||||
char description[128];
|
||||
} netdev_t;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Global variables. */
|
||||
extern int nic_do_log; /* config */
|
||||
extern int network_ndev;
|
||||
extern netdev_t network_devs[32];
|
||||
|
||||
|
||||
/* Function prototypes. */
|
||||
extern void network_wait(uint8_t wait);
|
||||
extern void network_poll(void);
|
||||
extern void network_busy(uint8_t set);
|
||||
extern void network_end(void);
|
||||
|
||||
extern void network_init(void);
|
||||
extern void network_attach(void *, uint8_t *, NETRXCB, NETWAITCB);
|
||||
extern void network_close(void);
|
||||
extern void network_reset(void);
|
||||
extern int network_available(void);
|
||||
extern void network_tx(uint8_t *, int);
|
||||
|
||||
extern int net_pcap_prepare(netdev_t *);
|
||||
extern int net_pcap_init(void);
|
||||
extern int net_pcap_reset(const netcard_t *, uint8_t *);
|
||||
extern void net_pcap_close(void);
|
||||
extern void net_pcap_in(uint8_t *, int);
|
||||
|
||||
extern int net_slirp_init(void);
|
||||
extern int net_slirp_reset(const netcard_t *, uint8_t *);
|
||||
extern void net_slirp_close(void);
|
||||
extern void net_slirp_in(uint8_t *, int);
|
||||
|
||||
extern int network_dev_to_id(char *);
|
||||
extern int network_card_available(int);
|
||||
extern char *network_card_getname(int);
|
||||
extern int network_card_has_config(int);
|
||||
extern char *network_card_get_internal_name(int);
|
||||
extern int network_card_get_from_internal_name(char *);
|
||||
extern const device_t *network_card_getdevice(int);
|
||||
|
||||
extern void network_set_wait(int wait);
|
||||
extern int network_get_wait(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /*EMU_NETWORK_H*/
|
||||
@@ -54,9 +54,9 @@
|
||||
#include <ctype.h>
|
||||
#include <pcap/pcap.h>
|
||||
#include <time.h>
|
||||
#include "86box.h"
|
||||
#include "plat.h"
|
||||
#include "plat_dynld.h"
|
||||
#include <86box/86box.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/plat_dynld.h>
|
||||
|
||||
|
||||
static void *pcap_handle; /* handle to WinPcap DLL */
|
||||
|
||||
Reference in New Issue
Block a user