MACRAW-only: simplify send/recv API, remove non-MACRAW code paths and unused types

This commit is contained in:
Ian Gulliver
2026-04-10 21:37:03 +09:00
parent bee0fa3aef
commit 394628b8da
4 changed files with 28 additions and 221 deletions

View File

@@ -9,7 +9,6 @@ namespace w6300 {
constexpr int sock_count = 8;
enum class socket_id : uint8_t {};
enum class port_num : uint16_t {};
enum class sock_error : int16_t {
busy = 0,
@@ -81,11 +80,6 @@ enum intr_kind : uint32_t {
ik_int_all = 0x00FFFF97
};
struct ip_address {
std::array<uint8_t, 16> ip;
uint8_t len;
};
void init_spi();
void reset();
void init();
@@ -94,9 +88,9 @@ bool check();
void clear_interrupt(intr_kind intr);
void set_interrupt_mask(intr_kind intr);
std::expected<socket_id, sock_error> open_socket(socket_id sn, protocol proto, port_num port, sock_flag flag);
std::expected<uint16_t, sock_error> sendto(socket_id sn, std::span<const uint8_t> buf, const ip_address& addr, port_num port);
std::expected<uint16_t, sock_error> recvfrom(socket_id sn, std::span<uint8_t> buf, ip_address& addr, port_num& port);
std::expected<socket_id, sock_error> open_socket(socket_id sn, protocol proto, sock_flag flag);
std::expected<uint16_t, sock_error> send(socket_id sn, std::span<const uint8_t> buf);
std::expected<uint16_t, sock_error> recv(socket_id sn, std::span<uint8_t> buf);
std::expected<void, sock_error> set_socket_io_mode(socket_id sn, sock_io_mode mode);
void set_socket_dest_mac(socket_id sn, const std::array<uint8_t, 6>& mac);