Convert W6300 #defines to constexpr/inline across all headers

This commit is contained in:
Ian Gulliver
2026-04-04 17:21:57 +09:00
parent 92e00476da
commit 224fe4f7eb
5 changed files with 590 additions and 936 deletions

View File

@@ -1,6 +1,6 @@
#include "socket.h"
#define SOCK_ANY_PORT_NUM 0xC000
constexpr uint16_t SOCK_ANY_PORT_NUM = 0xC000;
static uint16_t sock_any_port = SOCK_ANY_PORT_NUM;
static uint16_t sock_io_mode = 0;
@@ -18,15 +18,6 @@ uint8_t sock_pack_info[_WIZCHIP_SOCK_NUM_] = {0,};
#define CHECK_SOCKDATA() do { if(len == 0) return SOCKERR_DATALEN; } 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) return SOCKERR_IPINVALID; } while(0)
#define Sn_MR_TCP4 (Sn_MR_TCP)
#define Sn_MR_UDP4 (Sn_MR_UDP)
#define Sn_MR_IPRAW4 (Sn_MR_IPRAW)
#define Sn_MR_TCP6 (0x09)
#define Sn_MR_UDP6 (0x0A)
#define Sn_MR_IPRAW6 (0x0B)
#define Sn_MR_TCPD (0x0D)
#define Sn_MR_UDPD (0x0E)
int8_t socket(uint8_t sn, uint8_t protocol, uint16_t port, uint8_t flag) {
uint8_t taddr[16];
CHECK_SOCKNUM();