From cb0c00a240c0d803e7202433f9940a91db849a5c Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Sun, 2 Feb 2025 02:42:00 -0700 Subject: libhw_generic: spi: Use libobj instead of vcall.h --- libhw_generic/include/libhw/generic/spi.h | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'libhw_generic/include/libhw/generic') 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 + * Copyright (C) 2024-2025 Luke T. Shumaker * SPDX-License-Identifier: AGPL-3.0-or-later */ @@ -9,6 +9,8 @@ #include /* for size_t */ +#include + 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_ */ -- cgit v1.2.3-2-g168b