]> git.proxmox.com Git - mirror_qemu.git/blob - hw/pcnet.h
net: Rename non_vlan_clients to net_clients
[mirror_qemu.git] / hw / pcnet.h
1 #define PCNET_IOPORT_SIZE 0x20
2 #define PCNET_PNPMMIO_SIZE 0x20
3
4 #define PCNET_LOOPTEST_CRC 1
5 #define PCNET_LOOPTEST_NOCRC 2
6
7 #include "memory.h"
8
9 /* BUS CONFIGURATION REGISTERS */
10 #define BCR_MSRDA 0
11 #define BCR_MSWRA 1
12 #define BCR_MC 2
13 #define BCR_LNKST 4
14 #define BCR_LED1 5
15 #define BCR_LED2 6
16 #define BCR_LED3 7
17 #define BCR_FDC 9
18 #define BCR_BSBC 18
19 #define BCR_EECAS 19
20 #define BCR_SWS 20
21 #define BCR_PLAT 22
22
23 #define BCR_TMAULOOP(S) !!((S)->bcr[BCR_MC ] & 0x4000)
24 #define BCR_APROMWE(S) !!((S)->bcr[BCR_MC ] & 0x0100)
25 #define BCR_DWIO(S) !!((S)->bcr[BCR_BSBC] & 0x0080)
26 #define BCR_SSIZE32(S) !!((S)->bcr[BCR_SWS ] & 0x0100)
27 #define BCR_SWSTYLE(S) ((S)->bcr[BCR_SWS ] & 0x00FF)
28
29 typedef struct PCNetState_st PCNetState;
30
31 struct PCNetState_st {
32 NICState *nic;
33 NICConf conf;
34 QEMUTimer *poll_timer;
35 int rap, isr, lnkst;
36 uint32_t rdra, tdra;
37 uint8_t prom[16];
38 uint16_t csr[128];
39 uint16_t bcr[32];
40 int xmit_pos;
41 uint64_t timer;
42 MemoryRegion mmio;
43 uint8_t buffer[4096];
44 qemu_irq irq;
45 void (*phys_mem_read)(void *dma_opaque, target_phys_addr_t addr,
46 uint8_t *buf, int len, int do_bswap);
47 void (*phys_mem_write)(void *dma_opaque, target_phys_addr_t addr,
48 uint8_t *buf, int len, int do_bswap);
49 void *dma_opaque;
50 int tx_busy;
51 int looptest;
52 };
53
54 void pcnet_h_reset(void *opaque);
55 void pcnet_ioport_writew(void *opaque, uint32_t addr, uint32_t val);
56 uint32_t pcnet_ioport_readw(void *opaque, uint32_t addr);
57 void pcnet_ioport_writel(void *opaque, uint32_t addr, uint32_t val);
58 uint32_t pcnet_ioport_readl(void *opaque, uint32_t addr);
59 uint32_t pcnet_bcr_readw(PCNetState *s, uint32_t rap);
60 int pcnet_can_receive(VLANClientState *nc);
61 ssize_t pcnet_receive(VLANClientState *nc, const uint8_t *buf, size_t size_);
62 void pcnet_set_link_status(VLANClientState *nc);
63 void pcnet_common_cleanup(PCNetState *d);
64 int pcnet_common_init(DeviceState *dev, PCNetState *s, NetClientInfo *info);
65 extern const VMStateDescription vmstate_pcnet;