]>
Commit | Line | Data |
---|---|---|
acd1c812 AK |
1 | #ifndef IORANGE_H |
2 | #define IORANGE_H | |
3 | ||
4 | #include <stdint.h> | |
5 | ||
6 | typedef struct IORange IORange; | |
7 | typedef struct IORangeOps IORangeOps; | |
8 | ||
9 | struct IORangeOps { | |
10 | void (*read)(IORange *iorange, uint64_t offset, unsigned width, | |
11 | uint64_t *data); | |
12 | void (*write)(IORange *iorange, uint64_t offset, unsigned width, | |
13 | uint64_t data); | |
c5b703ac | 14 | void (*destructor)(IORange *iorange); |
acd1c812 AK |
15 | }; |
16 | ||
17 | struct IORange { | |
18 | const IORangeOps *ops; | |
19 | uint64_t base; | |
20 | uint64_t len; | |
21 | }; | |
22 | ||
23 | static inline void iorange_init(IORange *iorange, const IORangeOps *ops, | |
24 | uint64_t base, uint64_t len) | |
25 | { | |
26 | iorange->ops = ops; | |
27 | iorange->base = base; | |
28 | iorange->len = len; | |
29 | } | |
30 | ||
31 | #endif |