Split net stack into eth/arp/ipv4/icmp, deferred handler responses, ping tests

This commit is contained in:
Ian Gulliver
2026-04-11 08:15:41 +09:00
parent 34efaeefd5
commit c35c1de76a
16 changed files with 522 additions and 330 deletions

20
firmware/include/eth.h Normal file
View File

@@ -0,0 +1,20 @@
#pragma once
#include <array>
#include <cstdint>
namespace eth {
using mac_addr = std::array<uint8_t, 6>;
static constexpr mac_addr MAC_BROADCAST = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
static constexpr uint16_t ETH_ARP = __builtin_bswap16(0x0806);
static constexpr uint16_t ETH_IPV4 = __builtin_bswap16(0x0800);
struct __attribute__((packed)) header {
mac_addr dst;
mac_addr src;
uint16_t ethertype;
};
static_assert(sizeof(header) == 14);
} // namespace eth