#pragma once #include #include #include #include namespace w6300 { enum class socket_id : uint8_t {}; enum class sock_error : int16_t { busy = 0, sock_num = -1, sock_closed = -4, sock_mode = -5, arg = -10, timeout = -13, data_len = -14, fatal_packlen = -1001, }; enum class protocol : uint8_t { macraw = 0x07, }; enum class sock_flag : uint8_t { none = 0, }; enum intr_kind : uint32_t { ik_sock_0 = (1 << 8), ik_int_all = 0x00FFFF97 }; void init_spi(); void reset(); void init(); bool check(); void clear_interrupt(intr_kind intr); void set_interrupt_mask(intr_kind intr); std::expected open_socket(socket_id sn, protocol proto, sock_flag flag); std::expected send(socket_id sn, std::span buf); std::expected recv(socket_id sn, std::span buf); uint16_t get_socket_recv_buf(socket_id sn); } // namespace w6300