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/rp2040_hwspi.c | |
parent | 41ac4f8dfddc8d003cb3174d466a58fa14701d35 (diff) |
libhw_generic: spi: Use libobj instead of vcall.h
Diffstat (limited to 'libhw/rp2040_hwspi.c')
-rw-r--r-- | libhw/rp2040_hwspi.c | 13 |
1 files changed, 3 insertions, 10 deletions
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 - <libhw/generic/spi.h> implementation for the RP2040's ARM Primecell SSP (PL022) * - * 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 */ @@ -8,16 +8,11 @@ #include <hardware/gpio.h> /* pico-sdk:hardware_gpio */ #include <libmisc/assert.h> -#include <libmisc/vcall.h> #define IMPLEMENTATION_FOR_LIBHW_RP2040_HWSPI_H YES #include <libhw/rp2040_hwspi.h> -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; |