MACRAW-only: simplify send/recv API, remove non-MACRAW code paths and unused types
This commit is contained in:
@@ -108,9 +108,7 @@ static bool ip_match_or_broadcast(const ip4_addr& dst) {
|
||||
|
||||
static void send_raw(const void* data, size_t len) {
|
||||
dlog_if_slow("send_raw", 1000, [&]{
|
||||
w6300::ip_address dummy = {};
|
||||
w6300::sendto(raw_socket, std::span<const uint8_t>{static_cast<const uint8_t*>(data), len},
|
||||
dummy, w6300::port_num{0});
|
||||
w6300::send(raw_socket, std::span<const uint8_t>{static_cast<const uint8_t*>(data), len});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -280,7 +278,7 @@ bool net_init() {
|
||||
state.ip[2] = state.mac[4];
|
||||
state.ip[3] = state.mac[5];
|
||||
|
||||
w6300::open_socket(raw_socket, w6300::protocol::macraw, w6300::port_num{0}, w6300::sock_flag::none);
|
||||
w6300::open_socket(raw_socket, w6300::protocol::macraw, w6300::sock_flag::none);
|
||||
w6300::set_socket_io_mode(raw_socket, w6300::sock_io_mode::nonblock);
|
||||
w6300::set_interrupt_mask(w6300::ik_sock_0);
|
||||
|
||||
@@ -299,9 +297,7 @@ void net_poll() {
|
||||
w6300::clear_interrupt(w6300::ik_int_all);
|
||||
if (w6300::get_socket_recv_buf(raw_socket) == 0) return;
|
||||
static uint8_t rx_buf[1518];
|
||||
w6300::ip_address dummy_addr = {};
|
||||
w6300::port_num dummy_port{0};
|
||||
auto result = w6300::recvfrom(raw_socket, std::span{rx_buf}, dummy_addr, dummy_port);
|
||||
auto result = w6300::recv(raw_socket, std::span{rx_buf});
|
||||
if (!result) return;
|
||||
process_frame(rx_buf, *result);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user