2
0

ne2000.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #ifndef HW_NE2000_H
  2. #define HW_NE2000_H
  3. #include "qemu/units.h"
  4. #include "net/net.h"
  5. #define NE2000_PMEM_SIZE (32 * KiB)
  6. #define NE2000_PMEM_START (16 * KiB)
  7. #define NE2000_PMEM_END (NE2000_PMEM_SIZE+NE2000_PMEM_START)
  8. #define NE2000_MEM_SIZE NE2000_PMEM_END
  9. typedef struct NE2000State {
  10. MemoryRegion io;
  11. uint8_t cmd;
  12. uint32_t start;
  13. uint32_t stop;
  14. uint8_t boundary;
  15. uint8_t tsr;
  16. uint8_t tpsr;
  17. uint16_t tcnt;
  18. uint16_t rcnt;
  19. uint32_t rsar;
  20. uint8_t rsr;
  21. uint8_t rxcr;
  22. uint8_t isr;
  23. uint8_t dcfg;
  24. uint8_t imr;
  25. uint8_t phys[6]; /* mac address */
  26. uint8_t curpag;
  27. uint8_t mult[8]; /* multicast mask array */
  28. qemu_irq irq;
  29. NICState *nic;
  30. NICConf c;
  31. uint8_t mem[NE2000_MEM_SIZE];
  32. } NE2000State;
  33. void ne2000_setup_io(NE2000State *s, DeviceState *dev, unsigned size);
  34. extern const VMStateDescription vmstate_ne2000;
  35. void ne2000_reset(NE2000State *s);
  36. ssize_t ne2000_receive(NetClientState *nc, const uint8_t *buf, size_t size_);
  37. #endif