diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2024-10-29 01:02:02 -0600 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2024-10-29 01:40:02 -0600 |
commit | 7ff738390e55d57a0f513c467a9da3b08c6902ab (patch) | |
tree | 384bd03462a9790c9c747b895cf5de0677659db7 /libhw | |
parent | affe77a2b068a9de236f0d7703092dbfafacff5e (diff) |
Add a way to make private object members
Diffstat (limited to 'libhw')
-rw-r--r-- | libhw/host_include/libhw/host_net.h | 8 | ||||
-rw-r--r-- | libhw/host_net.c | 2 | ||||
-rw-r--r-- | libhw/rp2040_hwspi.c | 1 | ||||
-rw-r--r-- | libhw/rp2040_include/libhw/rp2040_hwspi.h | 4 | ||||
-rw-r--r-- | libhw/rp2040_include/libhw/w5500.h | 7 | ||||
-rw-r--r-- | libhw/w5500.c | 1 |
6 files changed, 23 insertions, 0 deletions
diff --git a/libhw/host_include/libhw/host_net.h b/libhw/host_include/libhw/host_net.h index 1b1ba7a..bfef5c9 100644 --- a/libhw/host_include/libhw/host_net.h +++ b/libhw/host_include/libhw/host_net.h @@ -9,20 +9,26 @@ #include <stdint.h> /* for uint16_6 */ +#include <libmisc/private.h> + #include <libhw/generic/net.h> struct _hostnet_tcp_conn { implements_net_stream_conn; + BEGIN_PRIVATE(LIBHW_HOST_NET_H) int fd; uint64_t read_deadline_ns; + END_PRIVATE(LIBHW_HOST_NET_H) }; struct hostnet_tcp_listener { implements_net_stream_listener; + BEGIN_PRIVATE(LIBHW_HOST_NET_H) int fd; struct _hostnet_tcp_conn active_conn; + END_PRIVATE(LIBHW_HOST_NET_H) }; void hostnet_tcp_listener_init(struct hostnet_tcp_listener *self, uint16_t port); @@ -30,8 +36,10 @@ void hostnet_tcp_listener_init(struct hostnet_tcp_listener *self, uint16_t port) struct hostnet_udp_conn { implements_net_packet_conn; + BEGIN_PRIVATE(LIBHW_HOST_NET_H) int fd; uint64_t read_deadline_ns; + END_PRIVATE(LIBHW_HOST_NET_H) }; void hostnet_udp_conn_init(struct hostnet_udp_conn *self, uint16_t port); diff --git a/libhw/host_net.c b/libhw/host_net.c index 1563ced..904019a 100644 --- a/libhw/host_net.c +++ b/libhw/host_net.c @@ -23,6 +23,8 @@ #include <libmisc/vcall.h> #include <libhw/generic/bootclock.h> + +#define IMPLEMENTATION_FOR_LIBHW_HOST_NET_H YES #include <libhw/host_net.h> /* common *********************************************************************/ diff --git a/libhw/rp2040_hwspi.c b/libhw/rp2040_hwspi.c index 96c3d14..b4adeb7 100644 --- a/libhw/rp2040_hwspi.c +++ b/libhw/rp2040_hwspi.c @@ -12,6 +12,7 @@ #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); diff --git a/libhw/rp2040_include/libhw/rp2040_hwspi.h b/libhw/rp2040_include/libhw/rp2040_hwspi.h index db8285d..8d90dbb 100644 --- a/libhw/rp2040_include/libhw/rp2040_hwspi.h +++ b/libhw/rp2040_include/libhw/rp2040_hwspi.h @@ -10,6 +10,8 @@ #include <pico/binary_info.h> /* for bi_* */ +#include <libmisc/private.h> + #include <libhw/generic/spi.h> enum rp2040_hwspi_instance { @@ -20,8 +22,10 @@ enum rp2040_hwspi_instance { struct rp2040_hwspi { implements_spi; + BEGIN_PRIVATE(LIBHW_RP2040_HWSPI_H) void /*spi_inst_t*/ *inst; uint pin_cs; + END_PRIVATE(LIBHW_RP2040_HWSPI_H) }; /** diff --git a/libhw/rp2040_include/libhw/w5500.h b/libhw/rp2040_include/libhw/w5500.h index 6f12c39..037d4f1 100644 --- a/libhw/rp2040_include/libhw/w5500.h +++ b/libhw/rp2040_include/libhw/w5500.h @@ -9,6 +9,7 @@ #include <libcr_ipc/sema.h> #include <libcr_ipc/mutex.h> +#include <libmisc/private.h> #include <libhw/generic/net.h> #include <libhw/generic/spi.h> @@ -17,13 +18,16 @@ struct _w5500_tcp_conn { /* const-after-init */ implements_net_stream_conn; /* mutable */ + BEGIN_PRIVATE(LIBHW_W5500_H) bool read_open; bool write_open; + END_PRIVATE(LIBHW_W5500_H) }; struct _w5500_tcp_listener { /* const-after-init */ implements_net_stream_listener; + BEGIN_PRIVATE(LIBHW_W5500_H) uint8_t socknum; struct _w5500_tcp_conn active_conn; @@ -31,11 +35,13 @@ struct _w5500_tcp_listener { uint16_t port; cr_mutex_t cmd_mu; cr_sema_t listen_sema, read_sema; + END_PRIVATE(LIBHW_W5500_H) }; struct w5500 { /* const-after-init */ implements_spi *spidev; + BEGIN_PRIVATE(LIBHW_W5500_H) uint pin_intr; uint pin_reset; struct net_eth_addr hwaddr; @@ -44,6 +50,7 @@ struct w5500 { uint16_t next_local_port; struct _w5500_tcp_listener listeners[8]; cr_sema_t intr; + END_PRIVATE(LIBHW_W5500_H) }; /** diff --git a/libhw/w5500.c b/libhw/w5500.c index a141fb3..0d9cd01 100644 --- a/libhw/w5500.c +++ b/libhw/w5500.c @@ -73,6 +73,7 @@ #include <libcr/coroutine.h> /* for cr_yield() */ #include <libmisc/vcall.h> /* for VCALL_SELF() */ +#define IMPLEMENTATION_FOR_LIBHW_W5500_H YES #include <libhw/w5500.h> #include "w5500_ll.h" |