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/rp2040_hwspi.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'libhw/rp2040_hwspi.c') diff --git a/libhw/rp2040_hwspi.c b/libhw/rp2040_hwspi.c index 47dfc97..23f3e8c 100644 --- a/libhw/rp2040_hwspi.c +++ b/libhw/rp2040_hwspi.c @@ -1,6 +1,6 @@ /* libhw/rp2040_hwspi.c - implementation for the RP2040's ARM Primecell SSP (PL022) * - * Copyright (C) 2024 Luke T. Shumaker + * Copyright (C) 2024-2025 Luke T. Shumaker * SPDX-License-Identifier: AGPL-3.0-or-later */ @@ -8,16 +8,11 @@ #include /* pico-sdk:hardware_gpio */ #include -#include #define IMPLEMENTATION_FOR_LIBHW_RP2040_HWSPI_H YES #include -static void rp2040_hwspi_readwritev(implements_spi *, const struct bidi_iovec *iov, int iovcnt); - -struct spi_vtable rp2040_hwspi_vtable = { - .readwritev = rp2040_hwspi_readwritev, -}; +LO_IMPLEMENTATION_C(spi, struct rp2040_hwspi, rp2040_hwspi, static) void _rp2040_hwspi_init(struct rp2040_hwspi *self, enum rp2040_hwspi_instance inst_num, @@ -84,13 +79,11 @@ void _rp2040_hwspi_init(struct rp2040_hwspi *self, gpio_put(pin_cs, 1); /* Return. */ - self->vtable = &rp2040_hwspi_vtable; self->inst = inst; self->pin_cs = pin_cs; } -static void rp2040_hwspi_readwritev(implements_spi *_self, const struct bidi_iovec *iov, int iovcnt) { - struct rp2040_hwspi *self = VCALL_SELF(struct rp2040_hwspi, implements_spi, _self); +static void rp2040_hwspi_readwritev(struct rp2040_hwspi *self, const struct bidi_iovec *iov, int iovcnt) { assert(self); spi_inst_t *inst = self->inst; -- cgit v1.2.3-2-g168b