foobar_device.h 1.12 KB
Newer Older
1
2
3
4
5
6
7
8
9
#ifndef _FOOBAR_DEVICE_H
#define _FOOBAR_DEVICE_H

typedef u64 foobar_features_t;

/* features */
#define FOOBAR_IRQ_DELAY	(1 << 10)
#define FOOBAR_SOFTIRQ_ENABLE	(1 << 11)
#define FOOBAR_ZERO_COPY	(1 << 12)
10
#define FOOBAR_PRIV_ALLOC	(1 << 13)
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53

/* flags */
#define FOO_LOOPBACK		4

struct foobar_device;

struct foobar_device_ops {
	int			(*init)(struct foobar_device *dev);
	void			(*uninit)(struct foobar_device *dev);
};

struct foo_stats {
	unsigned num_tx_packets;
	unsigned num_rx_packets;
};

struct foobar_device {
	char			name[32];
	unsigned long		id;
	unsigned long		mem_end;
	unsigned long		mem_start;
	unsigned long		base_addr;
	int			irq;

	unsigned long		state;

	unsigned int		flags;
	unsigned int		priv_flags;

	struct foo_stats	*dstats;
	foobar_features_t	features;
	foobar_features_t	hw_features;
	foobar_features_t	wanted_features;

	const struct foobar_device_ops *foobardev_ops;
};

int register_foobar(struct foobar_device *dev);
void unregister_foobar(struct foobar_device *dev);
struct foobar_device *alloc_foobardev(int id, const char* name);
void free_foobardev(struct foobar_device *dev);

#endif /* _FOOBAR_DEVICE_H */