ne2000.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #define NE2000_PMEM_SIZE (32*1024)
  2. #define NE2000_PMEM_START (16*1024)
  3. #define NE2000_PMEM_END (NE2000_PMEM_SIZE+NE2000_PMEM_START)
  4. #define NE2000_MEM_SIZE NE2000_PMEM_END
  5. typedef struct NE2000State {
  6. uint8_t cmd;
  7. uint32_t start;
  8. uint32_t stop;
  9. uint8_t boundary;
  10. uint8_t tsr;
  11. uint8_t tpsr;
  12. uint16_t tcnt;
  13. uint16_t rcnt;
  14. uint32_t rsar;
  15. uint8_t rsr;
  16. uint8_t rxcr;
  17. uint8_t isr;
  18. uint8_t dcfg;
  19. uint8_t imr;
  20. uint8_t phys[6]; /* mac address */
  21. uint8_t curpag;
  22. uint8_t mult[8]; /* multicast mask array */
  23. qemu_irq irq;
  24. NICState *nic;
  25. NICConf c;
  26. uint8_t mem[NE2000_MEM_SIZE];
  27. } NE2000State;
  28. void ne2000_ioport_write(void *opaque, uint32_t addr, uint32_t val);
  29. uint32_t ne2000_ioport_read(void *opaque, uint32_t addr);
  30. void ne2000_asic_ioport_write(void *opaque, uint32_t addr, uint32_t val);
  31. uint32_t ne2000_asic_ioport_read(void *opaque, uint32_t addr);
  32. void ne2000_reset_ioport_write(void *opaque, uint32_t addr, uint32_t val);
  33. uint32_t ne2000_reset_ioport_read(void *opaque, uint32_t addr);
  34. extern const VMStateDescription vmstate_ne2000;
  35. void ne2000_reset(NE2000State *s);
  36. int ne2000_can_receive(VLANClientState *vc);
  37. ssize_t ne2000_receive(VLANClientState *vc, const uint8_t *buf, size_t size_);