xref: /plan9-contrib/sys/src/9/loongson/etherif.h (revision a81c3ea0c7f009a3088ab7fe55ea9013d9d77a74)
1 enum
2 {
3 	MaxEther	= 4,
4 	Ntypes		= 8,
5 };
6 
7 typedef struct Ether Ether;
8 struct Ether {
9 	RWlock;
10 	ISAConf;			/* hardware info */
11 
12 	int	ctlrno;
13 	int	minmtu;
14 	int 	maxmtu;
15 
16 	Netif;
17 
18 	void	(*attach)(Ether*);	/* filled in by reset routine */
19 	void	(*detach)(Ether*);
20 	void	(*transmit)(Ether*);
21 	void	(*interrupt)(Ureg*, void*);
22 	long	(*ifstat)(Ether*, void*, long, ulong);
23 	long 	(*ctl)(Ether*, void*, long); /* custom ctl messages */
24 	void	(*power)(Ether*, int);	/* power on/off */
25 	void	(*shutdown)(Ether*);	/* shutdown hardware before reboot */
26 
27 	void*	ctlr;
28 	uchar	ea[Eaddrlen];
29 	void*	address;
30 	int	irq;
31 	int	tbdf;
32 
33 	Queue*	oq;
34 };
35 
36 extern Block* etheriq(Ether*, Block*, int);
37 extern void addethercard(char*, int(*)(Ether*));
38 extern ulong ethercrc(uchar*, int);
39 extern int parseether(uchar*, char*);
40 
41 #define NEXT(x, l)	(((x)+1)%(l))
42 #define PREV(x, l)	(((x) == 0) ? (l)-1: (x)-1)
43