summaryrefslogtreecommitdiff
path: root/cmd/sbc_harness
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2024-10-26 02:58:42 -0600
committerLuke T. Shumaker <lukeshu@lukeshu.com>2024-10-26 02:58:42 -0600
commit7f3507b606b0f5c0c44cc59eb27e87575cf87701 (patch)
tree7a94f620d7bb5920916f17139dcf37a2b68b065d /cmd/sbc_harness
parent1dad21650eb6fb3a4b9bba6c0ddd1402930163e2 (diff)
conventions: Don't have 2 ways to spell "implements_foo"
Stop defining "struct foo" as a synonym for "implements_foo".
Diffstat (limited to 'cmd/sbc_harness')
-rw-r--r--cmd/sbc_harness/hw/rp2040_hwspi.c2
-rw-r--r--cmd/sbc_harness/hw/rp2040_hwspi.h2
-rw-r--r--cmd/sbc_harness/hw/spi.h12
-rw-r--r--cmd/sbc_harness/hw/w5500.c2
-rw-r--r--cmd/sbc_harness/hw/w5500.h4
5 files changed, 11 insertions, 11 deletions
diff --git a/cmd/sbc_harness/hw/rp2040_hwspi.c b/cmd/sbc_harness/hw/rp2040_hwspi.c
index dd9a577..6742c60 100644
--- a/cmd/sbc_harness/hw/rp2040_hwspi.c
+++ b/cmd/sbc_harness/hw/rp2040_hwspi.c
@@ -1,4 +1,4 @@
-/* hw/rp2040_hwspi.c - `struct spi` implementation for the RP2040's
+/* hw/rp2040_hwspi.c - `implements_spi` implementation for the RP2040's
* ARM Primecell SSP (PL022) (implementation file)
*
* Copyright (C) 2024 Luke T. Shumaker <lukeshu@lukeshu.com>
diff --git a/cmd/sbc_harness/hw/rp2040_hwspi.h b/cmd/sbc_harness/hw/rp2040_hwspi.h
index 8bf783f..8cf8aff 100644
--- a/cmd/sbc_harness/hw/rp2040_hwspi.h
+++ b/cmd/sbc_harness/hw/rp2040_hwspi.h
@@ -1,4 +1,4 @@
-/* hw/rp2040_hwspi.h - `struct spi` implementation for the RP2040's
+/* hw/rp2040_hwspi.h - `implements_spi` implementation for the RP2040's
* ARM Primecell SSP (PL022) (header file)
*
* Copyright (C) 2024 Luke T. Shumaker <lukeshu@lukeshu.com>
diff --git a/cmd/sbc_harness/hw/spi.h b/cmd/sbc_harness/hw/spi.h
index 653e80f..da588de 100644
--- a/cmd/sbc_harness/hw/spi.h
+++ b/cmd/sbc_harness/hw/spi.h
@@ -22,7 +22,11 @@ struct bidi_iovec {
size_t iov_len;
};
-struct spi;
+struct spi_vtable;
+
+typedef struct {
+ struct spi_vtable *vtable;
+} implements_spi;
/* This API assumes that an SPI frame is a multiple of 8-bits.
*
@@ -37,11 +41,7 @@ struct spi;
* non-multiple-of-8 number of bits.
*/
struct spi_vtable {
- void (*readwritev)(struct spi *, const struct bidi_iovec *iov, int iovcnt);
+ void (*readwritev)(implements_spi *, const struct bidi_iovec *iov, int iovcnt);
};
-typedef struct spi {
- struct spi_vtable *vtable;
-} implements_spi;
-
#endif /* _HW_SPI_H_ */
diff --git a/cmd/sbc_harness/hw/w5500.c b/cmd/sbc_harness/hw/w5500.c
index a6cdc8b..5e36bcf 100644
--- a/cmd/sbc_harness/hw/w5500.c
+++ b/cmd/sbc_harness/hw/w5500.c
@@ -170,7 +170,7 @@ static void w5500_intrhandler(uint gpio, uint32_t UNUSED(event_mask)) {
}
void _w5500_init(struct w5500 *chip,
- struct spi* spi, uint pin_intr, uint pin_reset,
+ implements_spi *spi, uint pin_intr, uint pin_reset,
struct net_eth_addr addr) {
assert(chip);
assert(spi);
diff --git a/cmd/sbc_harness/hw/w5500.h b/cmd/sbc_harness/hw/w5500.h
index 1b485dd..2ff04df 100644
--- a/cmd/sbc_harness/hw/w5500.h
+++ b/cmd/sbc_harness/hw/w5500.h
@@ -35,7 +35,7 @@ struct _w5500_tcp_listener {
struct w5500 {
/* const-after-init */
- struct spi *spidev;
+ implements_spi *spidev;
uint pin_intr;
uint pin_reset;
struct net_eth_addr hwaddr;
@@ -66,7 +66,7 @@ struct w5500 {
_w5500_init(self, spi, pin_intr, pin_reset, eth_addr); \
} while (0)
void _w5500_init(struct w5500 *self,
- struct spi* spi, uint pin_intr, uint pin_reset,
+ implements_spi *spi, uint pin_intr, uint pin_reset,
struct net_eth_addr addr);
/**