Change from 16 to 24 Byte Config Code
[owSlave2.git] / common / OWRomFunctionsDual.s
index cb4ac7f..3c2d152 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (c) 2015, Tobias Mueller tm(at)tm3d.de\r
+// Copyright (c) 2017, Tobias Mueller tm(at)tm3d.de\r
 // All rights reserved. \r
 // \r
 // Redistribution and use in source and binary forms, with or without \r
@@ -401,29 +401,36 @@ h_fwconfiginfo2:
        configZ config_info2,r_bytep\r
 \r
 h_fwconfiginfo_go:\r
-       cpi  r_bytep,16\r
+       cpi  r_bytep,24\r
        breq h_fwconfiginfo_crc\r
 #ifdef _CRC8_\r
-       cpi  r_bytep,17\r
+       cpi  r_bytep,25\r
        breq h_fwconfiginfo_all\r
 #elif defined _CRC16_\r
-       cpi  r_bytep,17\r
-       breq h_fwconfiginfo_crc2\r
-       cpi  r_bytep,18\r
+       cpi  r_bytep,26\r
        breq h_fwconfiginfo_all\r
 #else\r
-       cpi  r_bytep,16\r
+       cpi  r_bytep,25\r
        breq h_fwconfiginfo_all\r
 #warning No CRC known code implemented\r
 #endif\r
+h_fwconfiginfo_end:\r
+       //configZ config_info1,r_bytep  //crc16 wird in config_info1 gespeichert, auch bei config_info2 \r
        ld   r_rwbyte,Z\r
        rjmp handle_end_inc\r
 h_fwconfiginfo_crc:\r
+#ifdef _CRC8_ \r
        lds r_rwbyte,crc\r
        rjmp handle_end_inc\r
-h_fwconfiginfo_crc2:\r
-       lds r_rwbyte,crc+1\r
-       rjmp handle_end_inc\r
+#elif defined _CRC16_\r
+       lds r_temp,crc\r
+       com r_temp\r
+       sts config_info1+24,r_temp\r
+       lds r_temp,crc+1\r
+       com r_temp\r
+       sts config_info1+25,r_temp\r
+       rjmp h_fwconfiginfo_end\r
+#endif\r
 h_fwconfiginfo_all:\r
        rjmp handle_end_sleep\r
 \r
@@ -630,8 +637,8 @@ owinit_odgen2:
        ;copy ids in config bytes\r
        ldi  xl,lo8(owid1)\r
        ldi  xh,hi8(owid1)\r
-       ldi      yl,lo8(config_info2+9)\r
-       ldi  yh,hi8(config_info2+9)\r
+       ldi      yl,lo8(config_info2+17)\r
+       ldi  yh,hi8(config_info2+17)\r
        ldi r_temp,7\r
 owinit_cpconfig1:\r
        ld r_rwbyte,X+\r
@@ -640,8 +647,8 @@ owinit_cpconfig1:
        brne owinit_cpconfig1\r
        ldi  xl,lo8(owid2)\r
        ldi  xh,hi8(owid2)\r
-       ldi      yl,lo8(config_info1+9)\r
-       ldi  yh,hi8(config_info1+9)\r
+       ldi      yl,lo8(config_info1+17)\r
+       ldi  yh,hi8(config_info1+17)\r
        ldi r_temp,7\r
 owinit_cpconfig2:\r
        ld r_rwbyte,X+\r