]> git.lizzy.rs Git - plan9front.git/blob - sys/src/9/bitsy/etherif.h
merge
[plan9front.git] / sys / src / 9 / bitsy / etherif.h
1 enum {
2         MaxEther        = 24,
3         Ntypes          = 8,
4 };
5
6 typedef struct Ether Ether;
7 struct Ether {
8         DevConf;
9
10         int     ctlrno;
11         int     tbdf;                   /* type+busno+devno+funcno */
12         int     minmtu;
13         int     maxmtu;
14         uchar   ea[Eaddrlen];
15         int     encry;
16
17         void    (*attach)(Ether*);      /* filled in by reset routine */
18         void    (*detach)(Ether*);
19         void    (*transmit)(Ether*);
20         void    (*interrupt)(Ureg*, void*);
21         long    (*ifstat)(Ether*, void*, long, ulong);
22         long    (*ctl)(Ether*, void*, long); /* custom ctl messages */
23         void    (*power)(Ether*, int);  /* power on/off */
24         void    (*shutdown)(Ether*);    /* shutdown hardware before reboot */
25         void    *ctlr;
26
27         Queue*  oq;
28
29         Netif;
30 };
31
32 extern Block* etheriq(Ether*, Block*, int);
33 extern void addethercard(char*, int(*)(Ether*));
34 extern ulong ethercrc(uchar*, int);
35
36 #define NEXT(x, l)      (((x)+1)%(l))
37 #define PREV(x, l)      (((x) == 0) ? (l)-1: (x)-1)
38 #define HOWMANY(x, y)   (((x)+((y)-1))/(y))
39 #define ROUNDUP(x, y)   (HOWMANY((x), (y))*(y))