diff --git a/brewos.iso b/brewos.iso index aea4d7d..677398b 100644 Binary files a/brewos.iso and b/brewos.iso differ diff --git a/build/brewos.elf b/build/brewos.elf index 111c034..fa95a31 100755 Binary files a/build/brewos.elf and b/build/brewos.elf differ diff --git a/build/icmp.o b/build/icmp.o index 8d1834e..a66bf28 100644 Binary files a/build/icmp.o and b/build/icmp.o differ diff --git a/iso_root/brewos.elf b/iso_root/brewos.elf index 111c034..fa95a31 100755 Binary files a/iso_root/brewos.elf and b/iso_root/brewos.elf differ diff --git a/src/kernel/icmp.c b/src/kernel/icmp.c index ec3c25d..368ad65 100644 --- a/src/kernel/icmp.c +++ b/src/kernel/icmp.c @@ -1,6 +1,7 @@ #include "net_defs.h" #include "cmd.h" #include "memory_manager.h" +#include "wm.h" static volatile bool ping_reply_received = false; static uint16_t ping_id_counter = 0; @@ -71,16 +72,20 @@ void cli_cmd_ping(char *args) { ping_reply_received = false; ip_send_packet(dest, IP_PROTO_ICMP, packet, sizeof(packet)); - // Busy wait for reply. Increased timeout to ensure reply is caught. - for(volatile int w=0; w<2000000 && !ping_reply_received; w++) { + + uint32_t start_ticks = wm_get_ticks(); + while (!ping_reply_received && (wm_get_ticks() - start_ticks) < 180) { // 3 seconds timeout network_process_frames(); } if (!ping_reply_received) { - cmd_write("Request timed out.\n"); + cmd_write("Request timed out. (Did you run 'netinit'?)\n"); } else if (i < 3) { // Wait a bit before next ping - for(volatile int w=0; w<500000; w++) network_process_frames(); + uint32_t wait_start = wm_get_ticks(); + while ((wm_get_ticks() - wait_start) < 60) { + network_process_frames(); + } } } is_pinging = false;