blob: 543fcfe8a273852ad57dbe54d9852f99de9c0c4c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
/* $FreeBSD$ */
#define SPIBUS_IVAR(d) (struct spibus_ivar *) device_get_ivars(d)
#define SPIBUS_SOFTC(d) (struct spibus_softc *) device_get_softc(d)
struct spibus_softc
{
device_t dev;
};
struct spibus_ivar
{
uint32_t cs;
};
enum {
SPIBUS_IVAR_CS /* chip select that we're on */
};
#define SPIBUS_ACCESSOR(A, B, T) \
__inline static int \
spibus_get_ ## A(device_t dev, T *t) \
{ \
return BUS_READ_IVAR(device_get_parent(dev), dev, \
SPIBUS_IVAR_ ## B, (uintptr_t *) t); \
}
SPIBUS_ACCESSOR(cs, CS, uint32_t)
|