2012-12-06 12:15:58 +01:00
|
|
|
#ifndef HW_NE2000_H
|
2016-06-29 15:29:06 +02:00
|
|
|
#define HW_NE2000_H
|
2012-12-06 12:15:58 +01:00
|
|
|
|
2018-06-25 14:42:26 +02:00
|
|
|
#include "qemu/units.h"
|
2017-10-17 18:44:22 +02:00
|
|
|
#include "hw/hw.h"
|
|
|
|
#include "net/net.h"
|
|
|
|
|
2018-06-25 14:42:26 +02:00
|
|
|
#define NE2000_PMEM_SIZE (32 * KiB)
|
|
|
|
#define NE2000_PMEM_START (16 * KiB)
|
2009-09-10 11:43:33 +02:00
|
|
|
#define NE2000_PMEM_END (NE2000_PMEM_SIZE+NE2000_PMEM_START)
|
|
|
|
#define NE2000_MEM_SIZE NE2000_PMEM_END
|
|
|
|
|
|
|
|
typedef struct NE2000State {
|
2011-08-08 15:09:18 +02:00
|
|
|
MemoryRegion io;
|
2009-09-10 11:43:33 +02:00
|
|
|
uint8_t cmd;
|
|
|
|
uint32_t start;
|
|
|
|
uint32_t stop;
|
|
|
|
uint8_t boundary;
|
|
|
|
uint8_t tsr;
|
|
|
|
uint8_t tpsr;
|
|
|
|
uint16_t tcnt;
|
|
|
|
uint16_t rcnt;
|
|
|
|
uint32_t rsar;
|
|
|
|
uint8_t rsr;
|
|
|
|
uint8_t rxcr;
|
|
|
|
uint8_t isr;
|
|
|
|
uint8_t dcfg;
|
|
|
|
uint8_t imr;
|
|
|
|
uint8_t phys[6]; /* mac address */
|
|
|
|
uint8_t curpag;
|
|
|
|
uint8_t mult[8]; /* multicast mask array */
|
|
|
|
qemu_irq irq;
|
2009-11-25 19:49:14 +01:00
|
|
|
NICState *nic;
|
2009-10-21 15:25:27 +02:00
|
|
|
NICConf c;
|
2009-09-10 11:43:33 +02:00
|
|
|
uint8_t mem[NE2000_MEM_SIZE];
|
|
|
|
} NE2000State;
|
|
|
|
|
2013-06-25 15:04:35 +02:00
|
|
|
void ne2000_setup_io(NE2000State *s, DeviceState *dev, unsigned size);
|
2009-10-19 18:26:11 +02:00
|
|
|
extern const VMStateDescription vmstate_ne2000;
|
2009-09-10 11:43:33 +02:00
|
|
|
void ne2000_reset(NE2000State *s);
|
2012-07-24 17:35:14 +02:00
|
|
|
ssize_t ne2000_receive(NetClientState *nc, const uint8_t *buf, size_t size_);
|
2012-12-06 12:15:58 +01:00
|
|
|
|
|
|
|
#endif
|