[U-Boot-Users] [PATCH] 1/5: cmd_boot

Robert Schwebel robert at schwebel.de
Mon Mar 31 11:28:50 CEST 2003


Hi, 

here are some last minute patches, I hope Wolfgang has time to check
them in before the release. 

-----

cmd_boot: 

- fix whitespace for bdinfo command
- fix garbage characters output
- add ctrl-c support for kermit download

Robert
-- 
 Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de
 Pengutronix - Linux Solutions for Science and Industry
   Braunschweiger Str. 79,  31134 Hildesheim, Germany
   Handelsregister:  Amtsgericht Hildesheim, HRA 2686
    Phone: +49-5121-28619-0 |  Fax: +49-5121-28619-4
-------------- next part --------------
diff -x CVS -x ptx-patches -urN u-boot/common/cmd_boot.c u-boot-ptx/common/cmd_boot.c
--- u-boot/common/cmd_boot.c	2003-03-31 08:34:19.000000000 +0200
+++ u-boot-ptx/common/cmd_boot.c	2003-03-31 08:39:33.000000000 +0200
@@ -163,10 +163,10 @@
 		printf ("%c%02X", i ? ':' : ' ', bd->bi_enetaddr[i]);
 	}
 	printf ("\n"
-		"ip_addr       = ");
+		"ip_addr     = ");
 	print_IPaddr (bd->bi_ip_addr);
 	printf ("\n"
-		"baudrate      = %d bps\n", bd->bi_baudrate);
+		"baudrate    = %d bps\n", bd->bi_baudrate);
 
 	return 0;
 }
@@ -575,6 +575,7 @@
 #define XON_CHAR        17
 #define XOFF_CHAR       19
 #define START_CHAR      0x01
+#define ETX_CHAR	0x03
 #define END_CHAR        0x0D
 #define SPACE           0x20
 #define K_ESCAPE        0x23
@@ -687,11 +688,24 @@
 
 static ulong load_serial_bin (ulong offset)
 {
-	int size;
+	int size, i;
 	char buf[32];
 
 	set_kerm_bin_mode ((ulong *) offset);
 	size = k_recv ();
+
+	/*
+	 * Gather any trailing characters (for instance, the ^D which
+	 * is sent by 'cu' after sending a file), and give the
+	 * box some time (100 * 1 ms)
+	 */
+	for (i=0; i<100; ++i) {
+		if (serial_tstc()) {
+			(void) serial_getc();
+		}
+		udelay(1000);
+	}
+
 	flush_cache (offset, size);
 
 	printf("## Total Size      = 0x%08x = %d Bytes\n", size, size);
@@ -996,10 +1011,16 @@
 
 		/* get a packet */
 		/* wait for the starting character */
-		while (serial_getc () != START_CHAR);
+		do {
+			new_char = serial_getc();
+			if (new_char == ETX_CHAR) return 0;
+
+		} while (new_char != START_CHAR);
+
 		/* get length of packet */
 		sum = 0;
 		new_char = serial_getc ();
+
 		if ((new_char & 0xE0) == 0)
 			goto packet_error;
 		sum += new_char & 0xff;


More information about the U-Boot mailing list