Strip non-MACRAW enums, unused macros, and set_socket_dest_mac
This commit is contained in:
@@ -272,7 +272,6 @@ constexpr uint32_t REG_SN_CR(uint8_t n) { return (0x0010 << 8) + SREG_BLOCK
|
||||
constexpr uint32_t REG_SN_IR(uint8_t n) { return (0x0020 << 8) + SREG_BLOCK(n); }
|
||||
constexpr uint32_t REG_SN_IRCLR(uint8_t n) { return (0x0028 << 8) + SREG_BLOCK(n); }
|
||||
constexpr uint32_t REG_SN_SR(uint8_t n) { return (0x0030 << 8) + SREG_BLOCK(n); }
|
||||
constexpr uint32_t REG_SN_DHAR(uint8_t n) { return (0x0118 << 8) + SREG_BLOCK(n); }
|
||||
constexpr uint32_t REG_SN_MR2(uint8_t n) { return (0x0144 << 8) + SREG_BLOCK(n); }
|
||||
constexpr uint32_t REG_SN_TX_BSR(uint8_t n) { return (0x0200 << 8) + SREG_BLOCK(n); }
|
||||
constexpr uint32_t REG_SN_TX_FSR(uint8_t n) { return (0x0204 << 8) + SREG_BLOCK(n); }
|
||||
@@ -339,7 +338,6 @@ uint8_t get_sn_ir(uint8_t sn) { return reg_read(REG_SN_IR(sn)); }
|
||||
void set_sn_irclr(uint8_t sn, uint8_t v) { reg_write(REG_SN_IRCLR(sn), v); }
|
||||
void set_sn_ir(uint8_t sn, uint8_t v) { set_sn_irclr(sn, v); }
|
||||
uint8_t get_sn_sr(uint8_t sn) { return reg_read(REG_SN_SR(sn)); }
|
||||
void set_sn_dhar(uint8_t sn, uint8_t* v) { reg_write_buf(REG_SN_DHAR(sn), v, 6); }
|
||||
void set_sn_mr2(uint8_t sn, uint8_t v) { reg_write(REG_SN_MR2(sn), v); }
|
||||
void set_sn_tx_bsr(uint8_t sn, uint8_t v) { reg_write(REG_SN_TX_BSR(sn), v); }
|
||||
void set_sn_txbuf_size(uint8_t sn, uint8_t v) { set_sn_tx_bsr(sn, v); }
|
||||
@@ -475,9 +473,7 @@ uint8_t sock_pack_info[sock_count] = {0,};
|
||||
|
||||
#define FAIL(e) return std::unexpected(sock_error::e)
|
||||
#define CHECK_SOCKNUM() do { if(sn >= sock_count) FAIL(sock_num); } while(0)
|
||||
#define CHECK_SOCKMODE(mode) do { if((get_sn_mr(sn) & 0x0F) != mode) FAIL(sock_mode); } while(0)
|
||||
#define CHECK_SOCKDATA() do { if(len == 0) FAIL(data_len); } while(0)
|
||||
#define CHECK_IPZERO(addr, addrlen) do { uint16_t ipzero=0; for(uint8_t i=0; i<addrlen; i++) ipzero += (uint16_t)addr[i]; if(ipzero == 0) FAIL(ip_invalid); } while(0)
|
||||
|
||||
std::expected<void, sock_error> close(socket_id sid) {
|
||||
uint8_t sn = static_cast<uint8_t>(sid);
|
||||
@@ -522,7 +518,6 @@ std::expected<socket_id, sock_error> open_socket(socket_id sid, protocol proto,
|
||||
set_sn_cr(sn, SN_CR_OPEN);
|
||||
while (get_sn_cr(sn));
|
||||
sock_io_mode_bits &= ~(1 << sn);
|
||||
sock_io_mode_bits |= ((fl & (static_cast<uint8_t>(sock_flag::io_nonblock) >> 3)) << sn);
|
||||
sock_is_sending &= ~(1 << sn);
|
||||
sock_remained_size[sn] = 0;
|
||||
sock_pack_info[sn] = PACK_COMPLETED;
|
||||
@@ -650,9 +645,6 @@ std::expected<void, sock_error> set_socket_io_mode(socket_id sid, sock_io_mode m
|
||||
return {};
|
||||
}
|
||||
|
||||
void set_socket_dest_mac(socket_id sid, const std::array<uint8_t, 6>& mac) {
|
||||
set_sn_dhar(static_cast<uint8_t>(sid), const_cast<uint8_t*>(mac.data()));
|
||||
}
|
||||
|
||||
uint16_t get_socket_recv_buf(socket_id sid) {
|
||||
return get_sn_rx_rsr(static_cast<uint8_t>(sid));
|
||||
|
||||
Reference in New Issue
Block a user