check bootloader enalbe io line

This commit is contained in:
optixx 2009-09-02 21:34:10 +02:00
parent 6256cab7ef
commit a6e8d7e033

View File

@ -33,6 +33,10 @@
#include "config.h" #include "config.h"
#include "usbdrv/usbdrv.c" #include "usbdrv/usbdrv.c"
/* /*
* USBasp requests, taken from the original USBasp sourcecode * USBasp requests, taken from the original USBasp sourcecode
*/ */
@ -74,6 +78,10 @@
(LED_DIR ^= (1 << LED_PIN)));} (LED_DIR ^= (1 << LED_PIN)));}
#define AVR_BTLDR_EN_PORT PORTC
#define AVR_BTLDR_EN_DIR DDRC
#define AVR_BTLDR_EN_PIN PC1
#define AVR_BTLDR_EN_IN PINC
/* /*
@ -449,6 +457,18 @@ int __attribute__ ((noreturn, OS_main)) main(void)
uint16_t delay = 0; uint16_t delay = 0;
timeout = TIMEOUT; timeout = TIMEOUT;
DDRC &= ~(1 << AVR_BTLDR_EN_PIN);
PORTC &= ~(1 << AVR_BTLDR_EN_PIN);
if ((AVR_BTLDR_EN_IN & ( 1 << AVR_BTLDR_EN_PIN)) == 0){
banner();
uart_puts("Bootloader flashing is disabled\n\r");
MCUSR = 0;
leave_bootloader();
}
/* /*
* if power-on reset, quit bootloader via watchdog reset * if power-on reset, quit bootloader via watchdog reset