#include "lwip/opt.h"
#include "lwip/arch.h"
#include "lwip/sys.h"

// External references to console
extern void console_write(const void* p, unsigned long len);

// Simple counter for monotonic time
static volatile u32_t lwip_ticks_ms = 0;

// 1. Initialization (Membrane version - minimal)
void sys_init(void) {
    // Silent init for Membrane
}

// 2. The Time Source
u32_t sys_now(void) {
    lwip_ticks_ms++;
    return lwip_ticks_ms;
}

// 3. Panic handler is in clib.c (nexus_lwip_panic)

// 4. Critical Sections (Stubbed)
#if SYS_LIGHTWEIGHT_PROT
sys_prot_t sys_arch_protect(void) { return 0; }
void sys_arch_unprotect(sys_prot_t pval) { (void)pval; }
#endif
