introduce new feature: BOOTLOADER_ABORTTIMEOUTONACT
authorStephan Baerwolf <stephan.baerwolf@tu-ilmenau.de>
Wed, 11 Sep 2013 23:03:34 +0000 (01:03 +0200)
committerStephan Baerwolf <stephan.baerwolf@tu-ilmenau.de>
Wed, 11 Sep 2013 23:17:05 +0000 (23:17 +0000)
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 <stephan.baerwolf@tu-ilmenau.de>
firmware/bootloaderconfig.h
firmware/main.c

index 88a24fe..f469f8d 100644 (file)
@@ -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
 /*
index c609439..d08ed23 100644 (file)
@@ -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++;