1cb9c377fSPaolo Bonzini #ifndef HW_NE2000_H 2175de524SMarkus Armbruster #define HW_NE2000_H 3cb9c377fSPaolo Bonzini 4*872a2b7cSPhilippe Mathieu-Daudé #include "qemu/units.h" 5489983d6SPhilippe Mathieu-Daudé #include "hw/hw.h" 6489983d6SPhilippe Mathieu-Daudé #include "net/net.h" 7489983d6SPhilippe Mathieu-Daudé 8*872a2b7cSPhilippe Mathieu-Daudé #define NE2000_PMEM_SIZE (32 * KiB) 9*872a2b7cSPhilippe Mathieu-Daudé #define NE2000_PMEM_START (16 * KiB) 109453c5bcSGerd Hoffmann #define NE2000_PMEM_END (NE2000_PMEM_SIZE+NE2000_PMEM_START) 119453c5bcSGerd Hoffmann #define NE2000_MEM_SIZE NE2000_PMEM_END 129453c5bcSGerd Hoffmann 139453c5bcSGerd Hoffmann typedef struct NE2000State { 141ec4e1ddSAvi Kivity MemoryRegion io; 159453c5bcSGerd Hoffmann uint8_t cmd; 169453c5bcSGerd Hoffmann uint32_t start; 179453c5bcSGerd Hoffmann uint32_t stop; 189453c5bcSGerd Hoffmann uint8_t boundary; 199453c5bcSGerd Hoffmann uint8_t tsr; 209453c5bcSGerd Hoffmann uint8_t tpsr; 219453c5bcSGerd Hoffmann uint16_t tcnt; 229453c5bcSGerd Hoffmann uint16_t rcnt; 239453c5bcSGerd Hoffmann uint32_t rsar; 249453c5bcSGerd Hoffmann uint8_t rsr; 259453c5bcSGerd Hoffmann uint8_t rxcr; 269453c5bcSGerd Hoffmann uint8_t isr; 279453c5bcSGerd Hoffmann uint8_t dcfg; 289453c5bcSGerd Hoffmann uint8_t imr; 299453c5bcSGerd Hoffmann uint8_t phys[6]; /* mac address */ 309453c5bcSGerd Hoffmann uint8_t curpag; 319453c5bcSGerd Hoffmann uint8_t mult[8]; /* multicast mask array */ 329453c5bcSGerd Hoffmann qemu_irq irq; 331c2045b5SMark McLoughlin NICState *nic; 3493db6685SGerd Hoffmann NICConf c; 359453c5bcSGerd Hoffmann uint8_t mem[NE2000_MEM_SIZE]; 369453c5bcSGerd Hoffmann } NE2000State; 379453c5bcSGerd Hoffmann 38dcb117bfSPaolo Bonzini void ne2000_setup_io(NE2000State *s, DeviceState *dev, unsigned size); 397c131dd5SJuan Quintela extern const VMStateDescription vmstate_ne2000; 409453c5bcSGerd Hoffmann void ne2000_reset(NE2000State *s); 4135277d14SStefan Hajnoczi ssize_t ne2000_receive(NetClientState *nc, const uint8_t *buf, size_t size_); 42cb9c377fSPaolo Bonzini 43cb9c377fSPaolo Bonzini #endif 44