diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2024-11-10 22:08:02 -0700 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2024-11-10 22:08:02 -0700 |
commit | d84daf84d2ced072782ef3c61e5088b06d950939 (patch) | |
tree | fff4e2f44f01113dff27328e9e74caf4a12f962a /libhw/rp2040_include | |
parent | 1e8897a61addec5c2067ffbab38122d6c236ced3 (diff) |
libhw: net.h: Add listener close(), add 'iface'
Diffstat (limited to 'libhw/rp2040_include')
-rw-r--r-- | libhw/rp2040_include/libhw/w5500.h | 35 |
1 files changed, 9 insertions, 26 deletions
diff --git a/libhw/rp2040_include/libhw/w5500.h b/libhw/rp2040_include/libhw/w5500.h index 16f88cc..7538bbc 100644 --- a/libhw/rp2040_include/libhw/w5500.h +++ b/libhw/rp2040_include/libhw/w5500.h @@ -25,16 +25,17 @@ struct _w5500_socket { uint8_t socknum; /* mutable */ + struct _w5500_socket *next_free; enum { W5500_MODE_NONE = 0, W5500_MODE_TCP, W5500_MODE_UDP, } mode; - uint16_t port; /* MODE_{TCP,UDP} */ - uint64_t read_deadline_ns; /* MODE_{TCP,UDP} */ - cr_sema_t listen_sema; /* MODE_TCP */ - cr_sema_t read_sema; /* MODE_{TCP,UDP} */ - bool read_open, write_open; /* MODE_TCP */ + uint16_t port; /* MODE_{TCP,UDP} */ + uint64_t read_deadline_ns; /* MODE_{TCP,UDP} */ + cr_sema_t listen_sema; /* MODE_TCP */ + cr_sema_t read_sema; /* MODE_{TCP,UDP} */ + bool list_open, read_open, write_open; /* MODE_TCP */ cr_mutex_t cmd_mu; END_PRIVATE(LIBHW_W5500_H) @@ -42,8 +43,9 @@ struct _w5500_socket { struct w5500 { /* const-after-init */ - implements_spi *spidev; + implements_net_iface; BEGIN_PRIVATE(LIBHW_W5500_H) + implements_spi *spidev; uint pin_intr; uint pin_reset; struct net_eth_addr hwaddr; @@ -51,6 +53,7 @@ struct w5500 { /* mutable */ uint16_t next_local_port; struct _w5500_socket sockets[8]; + struct _w5500_socket *free; cr_sema_t intr; END_PRIVATE(LIBHW_W5500_H) }; @@ -88,24 +91,4 @@ void w5500_hard_reset(struct w5500 *self); */ void w5500_soft_reset(struct w5500 *self); -struct w5500_netcfg { - struct net_ip4_addr gateway_addr; - struct net_ip4_addr subnet_mask; - struct net_ip4_addr addr; -}; - -/** - * TODO. - */ -void w5500_netcfg(struct w5500 *self, struct w5500_netcfg cfg); - -implements_net_stream_listener *w5500_tcp_listen(struct w5500 *self, uint8_t socknum, - uint16_t port); - -/** - * TODO. - */ -implements_net_packet_conn *w5500_udp_conn(struct w5500 *self, uint8_t socknum, - uint16_t port); - #endif /* _LIBHW_W5500_H_ */ |