xref: /haiku/src/libs/compat/freebsd_network/shared.h (revision 820dca4df6c7bf955c46e8f6521b9408f50b2900)
1 /*
2  * Copyright 2009, Colin Günther, coling@gmx.de. All Rights Reserved.
3  * Copyright 2007, Axel Dörfler, axeld@pinc-software.de. All Rights Reserved.
4  * Copyright 2007, Hugo Santos. All Rights Reserved.
5  * Copyright 2004, Marcus Overhagen. All Rights Reserved.
6  * Distributed under the terms of the MIT License.
7  */
8 #ifndef SHARED_H_
9 #define SHARED_H_
10 
11 
12 #define MAX_DEVICES	8
13 
14 
15 struct ifnet;
16 
17 struct device {
18 	struct device	*parent;
19 	struct device	*root;
20 
21 	driver_t		*driver;
22 	struct list		children;
23 
24 	uint32			flags;
25 
26 	char			device_name[128];
27 	int				unit;
28 	char			nameunit[64];
29 	const char		*description;
30 	void			*softc;
31 	void			*ivars;
32 
33 	struct {
34 		int (*probe)(device_t dev);
35 		int (*attach)(device_t dev);
36 		int (*detach)(device_t dev);
37 		int (*suspend)(device_t dev);
38 		int (*resume)(device_t dev);
39 		void (*shutdown)(device_t dev);
40 
41 		int (*miibus_readreg)(device_t, int, int);
42 		int (*miibus_writereg)(device_t, int, int, int);
43 		void (*miibus_statchg)(device_t);
44 		void (*miibus_linkchg)(device_t);
45 		void (*miibus_mediainit)(device_t);
46 	} methods;
47 
48 	struct list_link link;
49 };
50 
51 
52 extern const char *gDeviceNameList[];
53 extern struct ifnet *gDevices[];
54 extern int32 gDeviceCount;
55 
56 #endif /* SHARED_H_ */
57