diff options
Diffstat (limited to 'cmd/sbc_harness/hw/rp2040_hwspi.c')
-rw-r--r-- | cmd/sbc_harness/hw/rp2040_hwspi.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/cmd/sbc_harness/hw/rp2040_hwspi.c b/cmd/sbc_harness/hw/rp2040_hwspi.c index 2f0bec4..7019954 100644 --- a/cmd/sbc_harness/hw/rp2040_hwspi.c +++ b/cmd/sbc_harness/hw/rp2040_hwspi.c @@ -3,7 +3,8 @@ #include <assert.h> -#include <hardware/spi.h> /* pico-sdk:hardware_spi */ +#include <hardware/spi.h> /* pico-sdk:hardware_spi */ +#include <hardware/gpio.h> /* pico-sdk:hardware_gpio5 */ #include "hw/rp2040_hwspi.h" @@ -13,13 +14,14 @@ struct spi_vtable rp2040_hwspi_vtable = { .readwritev = rp2040_hwspi_readwritev, }; -static inline void _rp2040_hwspi_init(struct rp2040_hwspi *self, - enum rp2040_hwspi_instance inst_num, - uint baudrate_hz; - uint pin_miso, - uint pin_mosi, - uint pin_clk, - uint pin_cs) { +void _rp2040_hwspi_init(struct rp2040_hwspi *self, + enum rp2040_hwspi_instance inst_num, + enum spi_mode mode, + uint baudrate_hz, + uint pin_miso, + uint pin_mosi, + uint pin_clk, + uint pin_cs) { /* Be not weary: This is but 12 lines of actual code; and many * lines of comments and assert()s. */ spi_inst_t *inst; @@ -90,8 +92,8 @@ static inline void _rp2040_hwspi_init(struct rp2040_hwspi *self, self->pin_cs = pin_cs; } -static void rp2040_hwspi_readwritev(struct spi *_self, const struct bidi_iovec *iov, int iovcnt); { - struct rp2040_hwspi* self = _self; +static void rp2040_hwspi_readwritev(struct spi *_self, const struct bidi_iovec *iov, int iovcnt) { + struct rp2040_hwspi *self = (struct rp2040_hwspi *)_self; assert(self); spi_inst_t *inst = self->inst; @@ -107,7 +109,7 @@ static void rp2040_hwspi_readwritev(struct spi *_self, const struct bidi_iovec * else if (iov[i].iov_write_src) spi_write_blocking(inst, iov[i].iov_write_src, iov[i].iov_len); else if (iov[i].iov_read_dst) - spi_read_blocking(inst, iov[i].iov_read_dst, iov[i].iov_len); + spi_read_blocking(inst, 0, iov[i].iov_read_dst, iov[i].iov_len); else assert(false); } |