spl: Always define preloader_console_init
[oweals/u-boot.git] / common / xyzModem.c
index a0c5dfeece505ad07f9973ee7706fb2451ee02b4..6bf2375671d2825668457472e29c9e81a12fef28 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: eCos-2.0
 /*
  *==========================================================================
  *
@@ -6,8 +7,6 @@
  *      RedBoot stream handler for xyzModem protocol
  *
  *==========================================================================
- * SPDX-License-Identifier:    eCos-2.0
- *==========================================================================
  *#####DESCRIPTIONBEGIN####
  *
  * Author(s):    gthomas
@@ -25,7 +24,8 @@
 #include <common.h>
 #include <xyzModem.h>
 #include <stdarg.h>
-#include <crc.h>
+#include <u-boot/crc.h>
+#include <watchdog.h>
 
 /* Assumption - run xyzModem protocol over the console port */
 
@@ -64,6 +64,7 @@ CYGACC_COMM_IF_GETC_TIMEOUT (char chan, char *c)
 {
 
   ulong now = get_timer(0);
+  WATCHDOG_RESET();
   while (!tstc ())
     {
       if (get_timer(now) > xyzModem_CHAR_TIMEOUT)
@@ -172,7 +173,7 @@ parse_num (char *s, unsigned long *val, char **es, char *delim)
 }
 
 
-#ifdef DEBUG
+#if defined(DEBUG) && !CONFIG_IS_ENABLED(USE_TINY_PRINTF)
 /*
  * Note: this debug setup works by storing the strings in a fixed buffer
  */
@@ -181,15 +182,16 @@ static char *zm_out = zm_debug_buf;
 static char *zm_out_start = zm_debug_buf;
 
 static int
-zm_dprintf (char *fmt, ...)
+zm_dprintf(char *fmt, ...)
 {
-  int len;
-  va_list args;
-
-  va_start (args, fmt);
-  len = diag_vsprintf (zm_out, fmt, args);
-  zm_out += len;
-  return len;
+       int len;
+       va_list args;
+
+       va_start(args, fmt);
+       len = diag_vsprintf(zm_out, fmt, args);
+       va_end(args);
+       zm_out += len;
+       return len;
 }
 
 static void