Product: - u-boot Version: - 1.0.0-pre CHANGELOG: - Adding a number of options to control the user feedback during a TFTP operation: CFG_TFTP_BLINK_STATUS_ON_DATA_IN CFG_TFTP_BLOCKS_PER_HASH CFG_TFTP_HASHES_PER_FLASH CFG_TFTP_HASHES_PER_LINE CFG_TFTP_PROGESS_QUIET CFG_TFTP_TIMEOUT_COUNT CVS Comments: - Adding a number of options to control the user feedback during a TFTP operation: CFG_TFTP_BLINK_STATUS_ON_DATA_IN CFG_TFTP_BLOCKS_PER_HASH CFG_TFTP_HASHES_PER_FLASH CFG_TFTP_HASHES_PER_LINE CFG_TFTP_PROGESS_QUIET CFG_TFTP_TIMEOUT_COUNT Patched files: - README - net/tftp.c --- README 2003-10-14 07:12:06.000000000 -0400 +++ README 2003-10-14 20:50:25.000000000 -0400 @@ -1765,6 +1769,32 @@ use the "saveenv" command to store a val - CFG_FAULT_MII_ADDR: MII address of the PHY to check for the Ethernet link state. +- CFG_TFTP_BLINK_STATUS_ON_DATA_IN + Blink or toggle the status LED based on incoming data. + +- CFG_TFTP_BLOCKS_PER_HASH: + For every XX blocks, output a '#' to signify that the + tftp command is making progress on the file transfer. + The default value is 10. + +- CFG_TFTP_HASHES_PER_FLASH: + For every '#' hashes, flash the status LED. + The default value is 200. + +- CFG_TFTP_HASHES_PER_LINE: + Only output XX '#'s per line during the tftp file transfer. + The default value is 65. + +- CFG_TFTP_PROGESS_QUIET: + Suppress the progress displays '#'s from the tftp + command based on the quiet environment variable. + +- CFG_TFTP_TIMEOUT_COUNT: + This variable defines how many timeouts TFTP will + allow before it gives up. If this isn't defined, then + the value of 2 * CONFIG_NET_RETRY_COUNT is used instead. + + Low Level (hardware related) configuration options: --------------------------------------------------- --- net/tftp.c 2003-10-14 07:12:13.000000000 -0400 +++ net/tftp.c 2003-10-14 18:35:44.000000000 -0400 @@ -9,20 +9,38 @@ #include #include "tftp.h" #include "bootp.h" +#include "console.h" + +#ifdef CONFIG_STATUS_LED +#include +#endif #undef ET_DEBUG #if (CONFIG_COMMANDS & CFG_CMD_NET) #define WELL_KNOWN_PORT 69 /* Well known TFTP port # */ -#define TIMEOUT 5 /* Seconds to timeout for a lost pkt */ -#ifndef CONFIG_NET_RETRY_COUNT -# define TIMEOUT_COUNT 10 /* # of timeouts before giving up */ +#define TIMEOUT 2 /* Seconds to timeout for a lost pkt */ + +#ifdef CFG_TFTP_TIMEOUT_COUNT /* # of timeouts before giving up */ +# define TIMEOUT_COUNT CFG_TFTP_TIMEOUT_COUNT #else -# define TIMEOUT_COUNT (CONFIG_NET_RETRY_COUNT * 2) +# ifndef CONFIG_NET_RETRY_COUNT +# define TIMEOUT_COUNT 10 /* # of timeouts before giving up */ +# else +# define TIMEOUT_COUNT (CONFIG_NET_RETRY_COUNT * 2) +# endif /* # of timeouts before giving up */ +#endif /* CFG_TFTP_TIMEOUT_COUNT */ + +#ifndef CFG_TFTP_HASHES_PER_LINE +#define CFG_TFTP_HASHES_PER_LINE 65 /* Number of '#' hashes per line */ +#endif +#ifndef CFG_TFTP_BLOCKS_PER_HASH +#define CFG_TFTP_BLOCKS_PER_HASH 10 /* For every XX blocks, output a '#' */ +#endif +#ifndef CFG_TFTP_HASHES_PER_FLASH /* For every '#' hashes, flash the */ +#define CFG_TFTP_HASHES_PER_FLASH 200 /* status LED */ #endif - /* (for checking the image size) */ -#define HASHES_PER_LINE 65 /* Number of "loading" hashes per line */ /* * TFTP operations. @@ -196,9 +214,28 @@ TftpHandler (uchar * pkt, unsigned dest, return; len -= 2; TftpBlock = ntohs(*(ushort *)pkt); - if (((TftpBlock - 1) % 10) == 0) { + if (((TftpBlock - 1) % CFG_TFTP_BLOCKS_PER_HASH) == 0) { +#ifdef CFG_TFTP_PROGESS_QUIET + if (!is_console_quiet()) +#endif putc ('#'); - } else if ((TftpBlock % (10 * HASHES_PER_LINE)) == 0) { +#ifdef CFG_TFTP_BLINK_STATUS_ON_DATA_IN +#if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT) + /* + * Blink the status LED based on incoming data + */ + if (((TftpBlock - 1) % CFG_TFTP_HASHES_PER_FLASH) == 0) { + status_led_set(STATUS_LED_BOOT, STATUS_LED_ON); + } else { + status_led_set(STATUS_LED_BOOT, STATUS_LED_OFF); + } +#endif +#endif /* CFG_TFTP_BLINK_STATUS_ON_DATA_IN */ + } else if ((TftpBlock % + (CFG_TFTP_BLOCKS_PER_HASH * CFG_TFTP_HASHES_PER_LINE)) == 0) { +#ifdef CFG_TFTP_PROGESS_QUIET + if (!is_console_quiet()) +#endif puts ("\n\t "); } @@ -264,6 +301,15 @@ TftpHandler (uchar * pkt, unsigned dest, static void TftpTimeout (void) { +#ifdef CFG_TFTP_BLINK_STATUS_ON_DATA_IN +#if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT) + /* + * Restore the blinking behavior on timeout + */ + status_led_set(STATUS_LED_BOOT, STATUS_LED_BLINKING); +#endif +#endif /* CFG_TFTP_BLINK_STATUS_ON_DATA_IN */ + if (++TftpTimeoutCount > TIMEOUT_COUNT) { puts ("\nRetry count exceeded; starting again\n"); NetStartAgain (); @@ -294,6 +340,9 @@ TftpStart (void) tftp_filename = BootFile; } +#ifdef CFG_TFTP_STATUS_QUIET + if (!is_console_quiet()) { +#endif puts ("TFTP from server "); print_IPaddr (NetServerIP); puts ("; our IP address is "); print_IPaddr (NetOurIP); @@ -319,7 +368,13 @@ TftpStart (void) putc ('\n'); printf ("Load address: 0x%lx\n", load_addr); +#ifdef CFG_TFTP_STATUS_QUIET + } +#endif +#ifdef CFG_TFTP_PROGESS_QUIET + if (!is_console_quiet()) +#endif puts ("Loading: *\b"); NetSetTimeout (TIMEOUT * CFG_HZ, TftpTimeout);