X-Git-Url: http://cloudbase.mooo.com/gitweb/z180-stamp.git/blobdiff_plain/35edb766593d019b89a3f40b6d6cdd2b50f18032..refs/tags/hexrel-6.7.1:/avr/con-utils.c diff --git a/avr/con-utils.c b/avr/con-utils.c index f20dbfe..4a96771 100644 --- a/avr/con-utils.c +++ b/avr/con-utils.c @@ -4,9 +4,11 @@ * SPDX-License-Identifier: GPL-2.0+ */ -#include #include "common.h" +#include +#include +#include "config.h" #include "serial.h" #include "background.h" #include "con-utils.h" @@ -26,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; } @@ -37,6 +64,7 @@ static uint_fast8_t ctrlc_was_pressed; uint_fast8_t ctrlc(void) { + bg_shed(); if (!ctrlc_disabled) { switch (serial_getc()) { case 0x03: /* ^C - Control C */