software/libliteeth/tftp: switch to progress bar.
This commit is contained in:
parent
f7e06a7e3f
commit
59a048b666
|
@ -10,6 +10,8 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <progress.h>
|
||||||
|
|
||||||
#include "udp.h"
|
#include "udp.h"
|
||||||
#include "tftp.h"
|
#include "tftp.h"
|
||||||
|
|
||||||
|
@ -116,7 +118,6 @@ int tftp_get(uint32_t ip, uint16_t server_port, const char *filename,
|
||||||
int tries;
|
int tries;
|
||||||
int i;
|
int i;
|
||||||
int length_before;
|
int length_before;
|
||||||
int spin = 0;
|
|
||||||
|
|
||||||
if(!udp_arp_resolve(ip))
|
if(!udp_arp_resolve(ip))
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -146,14 +147,13 @@ int tftp_get(uint32_t ip, uint16_t server_port, const char *filename,
|
||||||
|
|
||||||
i = 12000000;
|
i = 12000000;
|
||||||
length_before = total_length;
|
length_before = total_length;
|
||||||
|
init_progression_bar(0);
|
||||||
while(!transfer_finished) {
|
while(!transfer_finished) {
|
||||||
if(length_before != total_length) {
|
if(length_before != total_length) {
|
||||||
i = 12000000;
|
i = 12000000;
|
||||||
length_before = total_length;
|
length_before = total_length;
|
||||||
if ((total_length & 0x7fff) == 0) { // every 32K
|
if ((total_length & (0x8000 - 1)) == 0)
|
||||||
putchar("|/-\\"[spin++ % 4]);
|
show_progress(-1);
|
||||||
putchar('\b');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if(i-- == 0) {
|
if(i-- == 0) {
|
||||||
udp_set_callback(NULL);
|
udp_set_callback(NULL);
|
||||||
|
|
Loading…
Reference in New Issue