USBaspLoader v0.97 stable release
[pub/USBaspLoader.git] / firmware / main.c
index c378d0f..fccec56 100644 (file)
@@ -11,7 +11,8 @@
 
 #include "spminterface.h"  /* must be included as first! */
 
-#include <avr/io.h>
+#include "../misc/iofixes.h"
+
 #include <avr/interrupt.h>
 #include <avr/pgmspace.h>
 #include <avr/wdt.h>
@@ -164,6 +165,8 @@ static const uchar  signatureBytes[4] = {
     0x1e, 0x93, 0x0a, 0
 #elif defined (__AVR_ATmega88PA__)
     0x1e, 0x93, 0x0F, 0
+#elif defined (__AVR_ATmega162__)
+    0x1e, 0x94, 0x04, 0
 #elif defined (__AVR_ATmega164A__)
     0x1e, 0x94, 0x0f, 0
 #elif defined (__AVR_ATmega164P__) || defined (__AVR_ATmega164PA__)
@@ -363,6 +366,7 @@ uchar usbFunctionSetup_USBASP_FUNC_TRANSMIT(usbRequest_t *rq) {
 
 #elif defined (__AVR_ATmega48__)   || defined (__AVR_ATmega48A__)   || defined (__AVR_ATmega48P__)   || defined (__AVR_ATmega48PA__)  ||  \
 defined (__AVR_ATmega88__)   || defined (__AVR_ATmega88A__)   || defined (__AVR_ATmega88P__)   || defined (__AVR_ATmega88PA__)  ||  \
+defined (__AVR_ATmega162__)  ||                                                                                                      \
 defined (__AVR_ATmega164A__) || defined (__AVR_ATmega164P__)  ||                                                                     \
 defined (__AVR_ATmega168__)  || defined (__AVR_ATmega168A__)  || defined (__AVR_ATmega168P__)  || defined (__AVR_ATmega168PA__) ||  \
 defined (__AVR_ATmega324A__) || defined (__AVR_ATmega324P__)  ||                                                                     \
@@ -698,10 +702,10 @@ static void _mywait(uint8_t waitloopcnt) {
        * ...if we loop 65536/F_CPU more or less...
        * ...unimportant - just save some opcodes
        */
-"_mywait_sleeploop:                                    \n\t"
+"_mywait_sleeploop%=:                                  \n\t"
       "sbiw    r30,    1                               \n\t"
       "sbci    %0,     0                               \n\t"
-      "brne    _mywait_sleeploop                       \n\t"
+      "brne    _mywait_sleeploop%=                     \n\t"
       : "+d" (waitloopcnt)
       :
       : "r30","r31"