summaryrefslogtreecommitdiff
path: root/avr/con-utils.c
diff options
context:
space:
mode:
authorLeo C2015-06-11 17:43:28 +0200
committerLeo C2015-06-11 17:43:28 +0200
commit1157e75889d3d6d23d1e2514f401cd5b354bd149 (patch)
treeedad2bcaddaec49a18a1b4bac2b813ce9e5a36bf /avr/con-utils.c
parent8506d791786eea8ee55db5418a8f646bb2dd3a6d (diff)
parent057817cb1dc71416bc798b5cd592acfcea87efaa (diff)
downloadz180-stamp-1157e75889d3d6d23d1e2514f401cd5b354bd149.zip
Merge branch 'master' into cmdline_edit
Diffstat (limited to 'avr/con-utils.c')
-rw-r--r--avr/con-utils.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/avr/con-utils.c b/avr/con-utils.c
index f4023ff..5ee1ff1 100644
--- a/avr/con-utils.c
+++ b/avr/con-utils.c
@@ -1,7 +1,14 @@
+/*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
-#include <string.h>
#include "common.h"
+#include <string.h>
+#include <avr/wdt.h>
+#include "config.h"
#include "serial.h"
#include "background.h"
#include "con-utils.h"
@@ -21,6 +28,31 @@ int my_getchar(uint_fast8_t waitforchar)
c = serial_getc();
} while ((c < 0) && waitforchar);
+#ifdef CONFIG_SYS_FBOOTSIG
+ if (c < 0)
+ return c;
+
+ static const FLASH unsigned char bootsig[] = {CONFIG_SYS_FBOOTSIG};
+ static uint8_t pb;
+ unsigned char uc = c;
+
+
+ if (bootsig[pb] == 0) {
+ if (uc == 0xff) {
+ wdt_enable(WDTO_15MS);
+ for(;;)
+ ;
+ } else
+ pb = 0;
+
+ } else {
+ if (bootsig[pb] == uc)
+ pb++;
+ else
+ pb = 0;
+ }
+#endif
+
return c;
}