xref: /plan9/sys/src/9/omap/etherif.h (revision 8e32b40042777e974f5a655264a3b7b672154d02)
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 
32 	Queue*	oq;
33 };
34 
35 extern Block* etheriq(Ether*, Block*, int);
36 extern void addethercard(char*, int(*)(Ether*));
37 extern ulong ethercrc(uchar*, int);
38 extern int parseether(uchar*, char*);
39 
40 #define NEXT(x, l)	(((x)+1)%(l))
41 #define PREV(x, l)	(((x) == 0) ? (l)-1: (x)-1)
42