diff options
| author | Warner Losh <imp@FreeBSD.org> | 2007-03-23 23:02:33 +0000 |
|---|---|---|
| committer | Warner Losh <imp@FreeBSD.org> | 2007-03-23 23:02:33 +0000 |
| commit | ee952d0ef6d9b492f3694741208bfd1ea09e73a2 (patch) | |
| tree | ec1d8e516c9f57881ff72d209aff7e3925490ab3 /sys/dev | |
| parent | e3da012f00f4ebd14b437ccf9639ffb38ba76065 (diff) | |
Notes
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/iicbus/iicbus.h | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/sys/dev/iicbus/iicbus.h b/sys/dev/iicbus/iicbus.h index f0c061ca5d70a..55f3b937aa4ed 100644 --- a/sys/dev/iicbus/iicbus.h +++ b/sys/dev/iicbus/iicbus.h @@ -29,13 +29,36 @@ #ifndef __IICBUS_H #define __IICBUS_H -struct iicbus_softc { +#define IICBUS_IVAR(d) (struct iicbus_ivar *) device_get_ivars(d) +#define IICBUS_SOFTC(d) (struct iicbus_softc *) device_get_softc(d) +struct iicbus_softc +{ + device_t dev; /* Myself */ device_t owner; /* iicbus owner device structure */ u_char started; /* address of the 'started' slave * 0 if no start condition succeeded */ }; +struct iicbus_ivar +{ + uint32_t addr; +}; + +enum { + IICBUS_IVAR_ADDR /* Address or base address */ +}; + +#define IICBUS_ACCESSOR(A, B, T) \ +__inline static int \ +iicbus_get_ ## A(device_t dev, T *t) \ +{ \ + return BUS_READ_IVAR(device_get_parent(dev), dev, \ + IICBUS_IVAR_ ## B, (uintptr_t *) t); \ +} + +IICBUS_ACCESSOR(addr, ADDR, uint32_t) + extern int iicbus_generic_intr(device_t dev, int event, char *buf); extern driver_t iicbus_driver; |
