From: Stephan Baerwolf Date: Wed, 11 Sep 2013 23:03:34 +0000 (+0200) Subject: introduce new feature: BOOTLOADER_ABORTTIMEOUTONACT X-Git-Tag: testing-head~18 X-Git-Url: http://git.linex4red.de/pub/USBaspLoader.git/commitdiff_plain/d7ac76b34c7ead103afb231d705976faa5c4beae?ds=sidebyside introduce new feature: BOOTLOADER_ABORTTIMEOUTONACT When defined, the bootloader will abort the timeout when it sees some activity (bootLoaderConditionSimple() or programming). After aborting timeout, the bootloader falls back to conventional exitting. By default this feature is deactivated. Activate it via the "DEFINES" varibale within Makefile.inc. There add: -DCONFIG_HAVE__BOOTLOADER_ABORTTIMEOUTONACT Signed-off-by: Stephan Baerwolf --- diff --git a/firmware/bootloaderconfig.h b/firmware/bootloaderconfig.h index 88a24fe..f469f8d 100644 --- a/firmware/bootloaderconfig.h +++ b/firmware/bootloaderconfig.h @@ -347,6 +347,16 @@ these macros are defined, the boot loader usees them. * exit as long as bootLoaderConditionSimple stays on. */ +#ifdef CONFIG_HAVE__BOOTLOADER_ABORTTIMEOUTONACT +#endif +/* + * When defined, the bootloader will abort the timeout when + * it sees some activity (bootLoaderConditionSimple() or + * programming). + * After aborting timeout, the bootloader falls back to + * conventional exitting. + */ + #ifdef CONFIG_HAVE__BOOTLOADER_ALWAYSENTERPROGRAMMODE #endif /* diff --git a/firmware/main.c b/firmware/main.c index c609439..d08ed23 100644 --- a/firmware/main.c +++ b/firmware/main.c @@ -493,7 +493,12 @@ static uchar replyBuffer[4]; }else if(rq->bRequest == USBASP_FUNC_DISCONNECT){ #if BOOTLOADER_CAN_EXIT +# ifdef CONFIG_HAVE__BOOTLOADER_ABORTTIMEOUTONACT + /* let the main loop know for ever that here was activity */ + stayinloader &= (0xfc); +# else stayinloader &= (0xfe); +# endif #endif }else{ /* ignore: others, but could be USBASP_FUNC_CONNECT */ @@ -761,7 +766,12 @@ int __attribute__((__noreturn__)) main(void) initForUsbConnectivity(); do{ #if ((BOOTLOADER_LOOPCYCLES_TIMEOUT) && (BOOTLOADER_CAN_EXIT)) - if (stayinloader & 0x1) { +# ifdef CONFIG_HAVE__BOOTLOADER_ABORTTIMEOUTONACT + if (stayinloader != 0x0e) { + /* can be reached, since high-nibble is decreased every cycle... */ +#else + if (stayinloader & 0x01) { +#endif timeout_remaining = BOOTLOADER_LOOPCYCLES_TIMEOUT; } else { __loopscycles++;