BIOS: TFTP: ASCII spinner progress indicator (cosmetic)
authorGabriel L. Somlo <gsomlo@gmail.com>
Thu, 27 Jun 2019 14:31:33 +0000 (10:31 -0400)
committerGabriel L. Somlo <gsomlo@gmail.com>
Thu, 27 Jun 2019 14:31:33 +0000 (10:31 -0400)
litex/soc/software/libnet/tftp.c

index 10e31e55f51a7ffcbaab2aec440d687abd18687b..65885de9bf19bcae9b4c9d308c16e1baec767fd6 100644 (file)
@@ -115,6 +115,7 @@ int tftp_get(uint32_t ip, uint16_t server_port, const char *filename,
        int tries;
        int i;
        int length_before;
+       int spin = 0;
 
        if(!microudp_arp_resolve(ip))
                return -1;
@@ -148,6 +149,10 @@ int tftp_get(uint32_t ip, uint16_t server_port, const char *filename,
                if(length_before != total_length) {
                        i = 12000000;
                        length_before = total_length;
+                       if ((total_length & 0x7fff) == 0) { // every 32K
+                               putchar("|/-\\"[spin++ % 4]);
+                               putchar('\b');
+                       }
                }
                if(i-- == 0) {
                        microudp_set_callback(NULL);