diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-02-02 02:42:00 -0700 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-02-09 23:42:11 -0700 |
commit | cb0c00a240c0d803e7202433f9940a91db849a5c (patch) | |
tree | 4d9a25b1ef15dac74aa9bb33da4b2327eb9aefd2 /libhw_generic/include/libhw/generic/spi.h | |
parent | 41ac4f8dfddc8d003cb3174d466a58fa14701d35 (diff) |
libhw_generic: spi: Use libobj instead of vcall.h
Diffstat (limited to 'libhw_generic/include/libhw/generic/spi.h')
-rw-r--r-- | libhw_generic/include/libhw/generic/spi.h | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/libhw_generic/include/libhw/generic/spi.h b/libhw_generic/include/libhw/generic/spi.h index 2207a2c..aeeca37 100644 --- a/libhw_generic/include/libhw/generic/spi.h +++ b/libhw_generic/include/libhw/generic/spi.h @@ -1,6 +1,6 @@ /* libhw/generic/spi.h - Device-independent SPI definitions * - * Copyright (C) 2024 Luke T. Shumaker <lukeshu@lukeshu.com> + * Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com> * SPDX-License-Identifier: AGPL-3.0-or-later */ @@ -9,6 +9,8 @@ #include <stddef.h> /* for size_t */ +#include <libobj/obj.h> + enum spi_mode { SPI_MODE_0 = 0, /* clk_polarity=0 (idle low), clk_phase=0 (sample on rise) */ SPI_MODE_1 = 1, /* clk_polarity=0 (idle low), clk_phase=1 (sample on fall) */ @@ -22,12 +24,6 @@ struct bidi_iovec { size_t iov_len; }; -struct spi_vtable; - -typedef struct { - struct spi_vtable *vtable; -} implements_spi; - /* This API assumes that an SPI frame is a multiple of 8-bits. * * It is my understanding that this is a common constraint of SPI @@ -40,8 +36,8 @@ typedef struct { * octets; so we have no need for an API that allows a * non-multiple-of-8 number of bits. */ -struct spi_vtable { - void (*readwritev)(implements_spi *, const struct bidi_iovec *iov, int iovcnt); -}; +#define spi_LO_IFACE \ + LO_FUNC(void, readwritev, const struct bidi_iovec *iov, int iovcnt) +LO_INTERFACE(spi) #endif /* _LIBHW_GENERIC_SPI_H_ */ |