out.elf: file format elf32-avr Sections: Idx Name Size VMA LMA File off Algn 0 .text 00000fe8 00000000 00000000 00000094 2**0 CONTENTS, ALLOC, LOAD, READONLY, CODE 1 .data 00000006 00800060 00000fe8 0000107c 2**0 CONTENTS, ALLOC, LOAD, DATA 2 .bss 0000004e 00800066 00800066 00001082 2**0 ALLOC 3 .noinit 00000001 008000b4 008000b4 00001082 2**0 ALLOC 4 .eeprom 00000000 00810000 00810000 00001082 2**0 CONTENTS 5 .stab 0000036c 00000000 00000000 00001084 2**2 CONTENTS, READONLY, DEBUGGING 6 .stabstr 00000084 00000000 00000000 000013f0 2**0 CONTENTS, READONLY, DEBUGGING 7 .debug_aranges 0000002c 00000000 00000000 00001474 2**0 CONTENTS, READONLY, DEBUGGING 8 .debug_pubnames 00000397 00000000 00000000 000014a0 2**0 CONTENTS, READONLY, DEBUGGING 9 .debug_info 00001097 00000000 00000000 00001837 2**0 CONTENTS, READONLY, DEBUGGING 10 .debug_abbrev 00000489 00000000 00000000 000028ce 2**0 CONTENTS, READONLY, DEBUGGING 11 .debug_line 00000c9b 00000000 00000000 00002d57 2**0 CONTENTS, READONLY, DEBUGGING 12 .debug_str 00000555 00000000 00000000 000039f2 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: 00000000 <__vectors>: 0: 42 c0 rjmp .+132 ; 0x86 <__init> 2: 36 c6 rjmp .+3180 ; 0xc70 <__vector_1> 4: 65 c0 rjmp .+202 ; 0xd0 <__bad_interrupt> 6: 64 c0 rjmp .+200 ; 0xd0 <__bad_interrupt> 8: 63 c0 rjmp .+198 ; 0xd0 <__bad_interrupt> a: 62 c0 rjmp .+196 ; 0xd0 <__bad_interrupt> c: 61 c0 rjmp .+194 ; 0xd0 <__bad_interrupt> e: 60 c0 rjmp .+192 ; 0xd0 <__bad_interrupt> 10: 5f c0 rjmp .+190 ; 0xd0 <__bad_interrupt> 12: 5e c0 rjmp .+188 ; 0xd0 <__bad_interrupt> 14: 5d c0 rjmp .+186 ; 0xd0 <__bad_interrupt> 16: 5c c0 rjmp .+184 ; 0xd0 <__bad_interrupt> 18: 5b c0 rjmp .+182 ; 0xd0 <__bad_interrupt> 1a: 5a c0 rjmp .+180 ; 0xd0 <__bad_interrupt> 1c: 59 c0 rjmp .+178 ; 0xd0 <__bad_interrupt> 0000001e <__ctors_end>: 1e: 09 02 muls r16, r25 20: 12 00 .word 0x0012 ; ???? 22: 01 01 movw r0, r2 24: 00 80 ld r0, Z 26: 64 09 sbc r22, r4 28: 04 00 .word 0x0004 ; ???? 2a: 00 00 nop 2c: 00 00 nop ... 00000030 : 30: 12 01 10 01 ff 00 00 08 c0 16 dc 05 00 01 01 02 ................ 40: 03 01 .. 00000042 : 42: 10 03 42 00 65 00 74 00 61 00 31 00 2e 00 31 00 ..B.e.t.a.1...1. 00000052 : 52: 16 03 44 00 47 00 38 00 53 00 41 00 51 00 2d 00 ..D.G.8.S.A.Q.-. 62: 49 00 32 00 43 00 I.2.C. 00000068 : 68: 1a 03 77 00 77 00 77 00 2e 00 6f 00 62 00 64 00 ..w.w.w...o.b.d. 78: 65 00 76 00 2e 00 61 00 74 00 e.v...a.t. 00000082 : 82: 04 03 09 04 .... 00000086 <__init>: 86: 11 24 eor r1, r1 88: 1f be out 0x3f, r1 ; 63 8a: cf e5 ldi r28, 0x5F ; 95 8c: d1 e0 ldi r29, 0x01 ; 1 8e: de bf out 0x3e, r29 ; 62 90: cd bf out 0x3d, r28 ; 61 00000092 : __attribute__((naked)) \ __attribute__((section(".init3"))); void get_mcusr(void) { mcusr_mirror = MCUSR; 92: 84 b7 in r24, 0x34 ; 52 94: 80 93 b4 00 sts 0x00B4, r24 MCUSR = 0; 98: 14 be out 0x34, r1 ; 52 wdt_disable(); 9a: 88 e1 ldi r24, 0x18 ; 24 9c: 0f b6 in r0, 0x3f ; 63 9e: f8 94 cli a0: 81 bd out 0x21, r24 ; 33 a2: 11 bc out 0x21, r1 ; 33 a4: 0f be out 0x3f, r0 ; 63 000000a6 <__do_copy_data>: a6: 10 e0 ldi r17, 0x00 ; 0 a8: a0 e6 ldi r26, 0x60 ; 96 aa: b0 e0 ldi r27, 0x00 ; 0 ac: e8 ee ldi r30, 0xE8 ; 232 ae: ff e0 ldi r31, 0x0F ; 15 b0: 03 c0 rjmp .+6 ; 0xb8 <.do_copy_data_start> 000000b2 <.do_copy_data_loop>: b2: c8 95 lpm b4: 31 96 adiw r30, 0x01 ; 1 b6: 0d 92 st X+, r0 000000b8 <.do_copy_data_start>: b8: a6 36 cpi r26, 0x66 ; 102 ba: b1 07 cpc r27, r17 bc: d1 f7 brne .-12 ; 0xb2 <.do_copy_data_loop> 000000be <__do_clear_bss>: be: 10 e0 ldi r17, 0x00 ; 0 c0: a6 e6 ldi r26, 0x66 ; 102 c2: b0 e0 ldi r27, 0x00 ; 0 c4: 01 c0 rjmp .+2 ; 0xc8 <.do_clear_bss_start> 000000c6 <.do_clear_bss_loop>: c6: 1d 92 st X+, r1 000000c8 <.do_clear_bss_start>: c8: a4 3b cpi r26, 0xB4 ; 180 ca: b1 07 cpc r27, r17 cc: e1 f7 brne .-8 ; 0xc6 <.do_clear_bss_loop> ce: 38 c4 rjmp .+2160 ; 0x940
000000d0 <__bad_interrupt>: d0: 97 cf rjmp .-210 ; 0x0 <__vectors> 000000d2 : int I2C_MINTIME = 40; void I2CDelay(int i){ // software delay loop while (i--); d2: 01 97 sbiw r24, 0x01 ; 1 d4: 2f ef ldi r18, 0xFF ; 255 d6: 8f 3f cpi r24, 0xFF ; 255 d8: 92 07 cpc r25, r18 da: d9 f7 brne .-10 ; 0xd2 dc: 08 95 ret 000000de : } void I2CStretch(){ // wait until clock hi while(!(PINB & SCL)); de: b3 9b sbis 0x16, 3 ; 22 e0: fe cf rjmp .-4 ; 0xde e2: 08 95 ret 000000e4 : } void I2CSendStart(void) { I2CErrors = 0; // reset error counter // switch ports to output direction e4: 10 92 78 00 sts 0x0078, r1 I2C_ALL_HI; I2CDelay(I2C_MINTIME); I2CStretch(); // all lines hi and wait e8: 87 b3 in r24, 0x17 ; 23 ea: 85 7f andi r24, 0xF5 ; 245 ec: 87 bb out 0x17, r24 ; 23 ee: 80 91 61 00 lds r24, 0x0061 f2: 90 91 62 00 lds r25, 0x0062 f6: ed df rcall .-38 ; 0xd2 f8: f2 df rcall .-28 ; 0xde I2C_SDA_LO; I2CDelay(I2C_MINTIME); // data line low and wait fa: 87 b3 in r24, 0x17 ; 23 fc: 82 60 ori r24, 0x02 ; 2 fe: 87 7f andi r24, 0xF7 ; 247 100: 87 bb out 0x17, r24 ; 23 102: 80 91 61 00 lds r24, 0x0061 106: 90 91 62 00 lds r25, 0x0062 10a: e3 df rcall .-58 ; 0xd2 I2C_ALL_LO; // also clock line low 10c: 87 b3 in r24, 0x17 ; 23 10e: 8a 60 ori r24, 0x0A ; 10 110: 87 bb out 0x17, r24 ; 23 112: 08 95 ret 00000114 : } void I2CSendStop(void) { I2C_ALL_LO; I2CDelay(I2C_MINTIME); // all lines low and wait 114: 87 b3 in r24, 0x17 ; 23 116: 8a 60 ori r24, 0x0A ; 10 118: 87 bb out 0x17, r24 ; 23 11a: 80 91 61 00 lds r24, 0x0061 11e: 90 91 62 00 lds r25, 0x0062 122: d7 df rcall .-82 ; 0xd2 I2C_SDA_LO; I2CDelay(I2C_MINTIME); I2CStretch();// clock hi and wait 124: 87 b3 in r24, 0x17 ; 23 126: 82 60 ori r24, 0x02 ; 2 128: 87 7f andi r24, 0xF7 ; 247 12a: 87 bb out 0x17, r24 ; 23 12c: 80 91 61 00 lds r24, 0x0061 130: 90 91 62 00 lds r25, 0x0062 134: ce df rcall .-100 ; 0xd2 136: d3 df rcall .-90 ; 0xde I2C_ALL_HI; // also data line hi 138: 87 b3 in r24, 0x17 ; 23 13a: 85 7f andi r24, 0xF5 ; 245 13c: 87 bb out 0x17, r24 ; 23 13e: 08 95 ret 00000140 : } void I2CSend0(void) { I2C_ALL_LO; I2CDelay(I2C_MINTIME); //apply data=0 and wait 140: 87 b3 in r24, 0x17 ; 23 142: 8a 60 ori r24, 0x0A ; 10 144: 87 bb out 0x17, r24 ; 23 146: 80 91 61 00 lds r24, 0x0061 14a: 90 91 62 00 lds r25, 0x0062 14e: c1 df rcall .-126 ; 0xd2 I2C_SDA_LO; I2CDelay(I2C_MINTIME); I2CStretch(); //clock hi and wait 150: 87 b3 in r24, 0x17 ; 23 152: 82 60 ori r24, 0x02 ; 2 154: 87 7f andi r24, 0xF7 ; 247 156: 87 bb out 0x17, r24 ; 23 158: 80 91 61 00 lds r24, 0x0061 15c: 90 91 62 00 lds r25, 0x0062 160: b8 df rcall .-144 ; 0xd2 162: bd df rcall .-134 ; 0xde I2C_ALL_LO; //clock low 164: 87 b3 in r24, 0x17 ; 23 166: 8a 60 ori r24, 0x0A ; 10 168: 87 bb out 0x17, r24 ; 23 16a: 08 95 ret 0000016c : } void I2CSend1(void) { I2C_SCL_LO; I2CDelay(I2C_MINTIME); //apply data hi and wait 16c: 87 b3 in r24, 0x17 ; 23 16e: 88 60 ori r24, 0x08 ; 8 170: 8d 7f andi r24, 0xFD ; 253 172: 87 bb out 0x17, r24 ; 23 174: 80 91 61 00 lds r24, 0x0061 178: 90 91 62 00 lds r25, 0x0062 17c: aa df rcall .-172 ; 0xd2 I2C_ALL_HI; I2CDelay(I2C_MINTIME); I2CStretch(); //also clock hi and wait 17e: 87 b3 in r24, 0x17 ; 23 180: 85 7f andi r24, 0xF5 ; 245 182: 87 bb out 0x17, r24 ; 23 184: 80 91 61 00 lds r24, 0x0061 188: 90 91 62 00 lds r25, 0x0062 18c: a2 df rcall .-188 ; 0xd2 18e: a7 df rcall .-178 ; 0xde I2C_SCL_LO; //clock low 190: 87 b3 in r24, 0x17 ; 23 192: 88 60 ori r24, 0x08 ; 8 194: 8d 7f andi r24, 0xFD ; 253 196: 87 bb out 0x17, r24 ; 23 198: 08 95 ret 0000019a : } char I2CGetBit(void) //open collector { char b; I2C_SCL_LO; I2CDelay(I2C_MINTIME); //SDA Hi Z and wait 19a: 87 b3 in r24, 0x17 ; 23 19c: 88 60 ori r24, 0x08 ; 8 19e: 8d 7f andi r24, 0xFD ; 253 1a0: 87 bb out 0x17, r24 ; 23 1a2: 80 91 61 00 lds r24, 0x0061 1a6: 90 91 62 00 lds r25, 0x0062 1aa: 93 df rcall .-218 ; 0xd2 I2C_ALL_HI; I2CDelay(I2C_MINTIME); I2CStretch(); //clock hi and wait 1ac: 87 b3 in r24, 0x17 ; 23 1ae: 85 7f andi r24, 0xF5 ; 245 1b0: 87 bb out 0x17, r24 ; 23 1b2: 80 91 61 00 lds r24, 0x0061 1b6: 90 91 62 00 lds r25, 0x0062 1ba: 8b df rcall .-234 ; 0xd2 1bc: 90 df rcall .-224 ; 0xde b = (PINB & SDA) >> BIT_SDA; //get bit 1be: 86 b3 in r24, 0x16 ; 22 1c0: 99 27 eor r25, r25 1c2: 82 70 andi r24, 0x02 ; 2 1c4: 90 70 andi r25, 0x00 ; 0 1c6: 95 95 asr r25 1c8: 87 95 ror r24 1ca: 98 2f mov r25, r24 I2C_SCL_LO; //clock low 1cc: 87 b3 in r24, 0x17 ; 23 1ce: 88 60 ori r24, 0x08 ; 8 1d0: 8d 7f andi r24, 0xFD ; 253 1d2: 87 bb out 0x17, r24 ; 23 return b; } 1d4: 89 2f mov r24, r25 1d6: 99 27 eor r25, r25 1d8: 08 95 ret 000001da : void I2CSendByte(char b) { 1da: 0f 93 push r16 1dc: 1f 93 push r17 1de: cf 93 push r28 1e0: 08 2f mov r16, r24 char i,p; p = 0x80; 1e2: 10 e8 ldi r17, 0x80 ; 128 1e4: c7 e0 ldi r28, 0x07 ; 7 for (i=0; i<8; i++){ if ((p & b) == 0) I2CSend0(); else I2CSend1(); 1e6: 81 2f mov r24, r17 1e8: 80 23 and r24, r16 1ea: 11 f4 brne .+4 ; 0x1f0 1ec: a9 df rcall .-174 ; 0x140 1ee: 01 c0 rjmp .+2 ; 0x1f2 1f0: bd df rcall .-134 ; 0x16c p = p >> 1; 1f2: 16 95 lsr r17 1f4: c1 50 subi r28, 0x01 ; 1 1f6: c7 ff sbrs r28, 7 1f8: f6 cf rjmp .-20 ; 0x1e6 }; I2CErrors = I2CErrors + I2CGetBit(); //Acknowledge 1fa: cf df rcall .-98 ; 0x19a 1fc: 90 91 78 00 lds r25, 0x0078 200: 98 0f add r25, r24 202: 90 93 78 00 sts 0x0078, r25 206: cf 91 pop r28 208: 1f 91 pop r17 20a: 0f 91 pop r16 20c: 08 95 ret 0000020e : return; } char I2CReceiveByte(void) //open collector { 20e: 1f 93 push r17 210: cf 93 push r28 char i; char b = 0; 212: 10 e0 ldi r17, 0x00 ; 0 214: c7 e0 ldi r28, 0x07 ; 7 for (i=0; i<8; i++){ b = b << 1; 216: 11 0f add r17, r17 b = b | I2CGetBit(); 218: c0 df rcall .-128 ; 0x19a 21a: 18 2b or r17, r24 21c: c1 50 subi r28, 0x01 ; 1 21e: c7 ff sbrs r28, 7 220: fa cf rjmp .-12 ; 0x216 }; I2CSend0(); //send Acknowledge 222: 8e df rcall .-228 ; 0x140 return b; } 224: 81 2f mov r24, r17 226: 99 27 eor r25, r25 228: cf 91 pop r28 22a: 1f 91 pop r17 22c: 08 95 ret 0000022e : char I2CReceiveLastByte(void) //open collector { 22e: 1f 93 push r17 230: cf 93 push r28 char i; char b = 0; 232: 10 e0 ldi r17, 0x00 ; 0 234: c7 e0 ldi r28, 0x07 ; 7 for (i=0; i<8; i++){ b = b << 1; 236: 11 0f add r17, r17 b = b | I2CGetBit(); 238: b0 df rcall .-160 ; 0x19a 23a: 18 2b or r17, r24 23c: c1 50 subi r28, 0x01 ; 1 23e: c7 ff sbrs r28, 7 240: fa cf rjmp .-12 ; 0x236 }; I2CSend1(); //send Acknowledge 242: 94 df rcall .-216 ; 0x16c return b; } 244: 81 2f mov r24, r17 246: 99 27 eor r25, r25 248: cf 91 pop r28 24a: 1f 91 pop r17 24c: 08 95 ret 0000024e : unsigned char N; //slow divider unsigned char HS_DIV; //fast divider unsigned long debug; unsigned char SI570CalcRegs(void){ //calculates SI570 registers from frequency*2^21, 34000clocks = 2ms required 24e: 3f 92 push r3 250: 4f 92 push r4 252: 5f 92 push r5 254: 6f 92 push r6 256: 7f 92 push r7 258: 8f 92 push r8 25a: 9f 92 push r9 25c: af 92 push r10 25e: bf 92 push r11 260: cf 92 push r12 262: df 92 push r13 264: ef 92 push r14 266: ff 92 push r15 268: 0f 93 push r16 26a: 1f 93 push r17 26c: cf 93 push r28 26e: df 93 push r29 270: cd b7 in r28, 0x3d ; 61 272: de b7 in r29, 0x3e ; 62 274: 28 97 sbiw r28, 0x08 ; 8 276: 0f b6 in r0, 0x3f ; 63 278: f8 94 cli 27a: de bf out 0x3e, r29 ; 62 27c: 0f be out 0x3f, r0 ; 63 27e: cd bf out 0x3d, r28 ; 61 unsigned long x; unsigned long vco; //VCO frequency [MHz]*2^19 unsigned long N0; unsigned char valid=0; 280: 44 24 eor r4, r4 uint16_t _N; unsigned char _HS_DIV; unsigned char i,d; vco=f_max; 282: a1 2c mov r10, r1 284: b1 2c mov r11, r1 286: 10 e3 ldi r17, 0x30 ; 48 288: c1 2e mov r12, r17 28a: 11 eb ldi r17, 0xB1 ; 177 28c: d1 2e mov r13, r17 N0=f_av/(f/8); //(f/2/4): last binary digit is 0.5 digit for rounding, note different scalings of f and f_av 28e: 60 90 70 00 lds r6, 0x0070 292: 70 90 71 00 lds r7, 0x0071 296: 80 90 72 00 lds r8, 0x0072 29a: 90 90 73 00 lds r9, 0x0073 29e: 59 2d mov r21, r9 2a0: 48 2d mov r20, r8 2a2: 37 2d mov r19, r7 2a4: 26 2d mov r18, r6 2a6: b3 e0 ldi r27, 0x03 ; 3 2a8: 56 95 lsr r21 2aa: 47 95 ror r20 2ac: 37 95 ror r19 2ae: 27 95 ror r18 2b0: ba 95 dec r27 2b2: d1 f7 brne .-12 ; 0x2a8 2b4: 60 e0 ldi r22, 0x00 ; 0 2b6: 70 e0 ldi r23, 0x00 ; 0 2b8: 80 e6 ldi r24, 0x60 ; 96 2ba: 94 ea ldi r25, 0xA4 ; 164 2bc: 5a d6 rcall .+3252 ; 0xf72 <__udivmodsi4> 2be: 29 83 std Y+1, r18 ; 0x01 2c0: 3a 83 std Y+2, r19 ; 0x02 2c2: 4b 83 std Y+3, r20 ; 0x03 2c4: 5c 83 std Y+4, r21 ; 0x04 _HS_DIV=11; 2c6: ab e0 ldi r26, 0x0B ; 11 2c8: fa 2e mov r15, r26 2ca: e0 90 6e 00 lds r14, 0x006E 2ce: 50 90 7e 00 lds r5, 0x007E while (_HS_DIV>3) { _N=(uint16_t)N0/_HS_DIV; //last digit of N is 0.5 digit for rounding 2d2: 2f 2d mov r18, r15 2d4: 33 27 eor r19, r19 2d6: 89 81 ldd r24, Y+1 ; 0x01 2d8: 9a 81 ldd r25, Y+2 ; 0x02 2da: 73 2f mov r23, r19 2dc: 62 2f mov r22, r18 2de: 33 d6 rcall .+3174 ; 0xf46 <__udivmodhi4> 2e0: 06 2f mov r16, r22 2e2: 17 2f mov r17, r23 _N=(_N+1)>>1; //rounded to the nearest integer 2e4: 0f 5f subi r16, 0xFF ; 255 2e6: 1f 4f sbci r17, 0xFF ; 255 2e8: 16 95 lsr r17 2ea: 07 95 ror r16 if (_N>2) _N&=0xFE; //N=1 or even 2ec: 03 30 cpi r16, 0x03 ; 3 2ee: 11 05 cpc r17, r1 2f0: 10 f0 brcs .+4 ; 0x2f6 2f2: 0e 7f andi r16, 0xFE ; 254 2f4: 10 70 andi r17, 0x00 ; 0 if (_N>128) _N=128; //N<=2^7 2f6: 01 38 cpi r16, 0x81 ; 129 2f8: 11 05 cpc r17, r1 2fa: 10 f0 brcs .+4 ; 0x300 2fc: 00 e8 ldi r16, 0x80 ; 128 2fe: 10 e0 ldi r17, 0x00 ; 0 300: 2f 2d mov r18, r15 302: 33 27 eor r19, r19 304: 44 27 eor r20, r20 306: 55 27 eor r21, r21 if (_N!=1) //calculate VCO frequency for these divider values, avoid overflows 308: 01 30 cpi r16, 0x01 ; 1 30a: 11 05 cpc r17, r1 30c: e1 f0 breq .+56 ; 0x346 { //better numerical accuracy, when cases are handled separately x=f/2; //f needs to be divided by 4 due to different scaling 30e: 99 2d mov r25, r9 310: 88 2d mov r24, r8 312: 77 2d mov r23, r7 314: 66 2d mov r22, r6 316: 96 95 lsr r25 318: 87 95 ror r24 31a: 77 95 ror r23 31c: 67 95 ror r22 x=x*_HS_DIV; 31e: f8 d5 rcall .+3056 ; 0xf10 <__mulsi3> 320: 6d 83 std Y+5, r22 ; 0x05 322: 7e 83 std Y+6, r23 ; 0x06 324: 8f 83 std Y+7, r24 ; 0x07 326: 98 87 std Y+8, r25 ; 0x08 x=x*(_N/2); //_N even here 328: 91 2f mov r25, r17 32a: 80 2f mov r24, r16 32c: 96 95 lsr r25 32e: 87 95 ror r24 330: aa 27 eor r26, r26 332: bb 27 eor r27, r27 334: 28 2f mov r18, r24 336: 39 2f mov r19, r25 338: 4a 2f mov r20, r26 33a: 5b 2f mov r21, r27 33c: 6d 81 ldd r22, Y+5 ; 0x05 33e: 7e 81 ldd r23, Y+6 ; 0x06 340: 8f 81 ldd r24, Y+7 ; 0x07 342: 98 85 ldd r25, Y+8 ; 0x08 344: 0f c0 rjmp .+30 ; 0x364 } else { x=f/4; 346: b9 2d mov r27, r9 348: a8 2d mov r26, r8 34a: 97 2d mov r25, r7 34c: 86 2d mov r24, r6 34e: 62 e0 ldi r22, 0x02 ; 2 350: b6 95 lsr r27 352: a7 95 ror r26 354: 97 95 ror r25 356: 87 95 ror r24 358: 6a 95 dec r22 35a: d1 f7 brne .-12 ; 0x350 x=x*_HS_DIV; 35c: 68 2f mov r22, r24 35e: 79 2f mov r23, r25 360: 8a 2f mov r24, r26 362: 9b 2f mov r25, r27 364: d5 d5 rcall .+2986 ; 0xf10 <__mulsi3> 366: 6d 83 std Y+5, r22 ; 0x05 368: 7e 83 std Y+6, r23 ; 0x06 36a: 8f 83 std Y+7, r24 ; 0x07 36c: 98 87 std Y+8, r25 ; 0x08 } if ((x>=f_min)&(x<=vco)) //find best divider values with vco smallest but still alowed 36e: 80 e0 ldi r24, 0x00 ; 0 370: 90 e0 ldi r25, 0x00 ; 0 372: 2d 81 ldd r18, Y+5 ; 0x05 374: 3e 81 ldd r19, Y+6 ; 0x06 376: 4f 81 ldd r20, Y+7 ; 0x07 378: 58 85 ldd r21, Y+8 ; 0x08 37a: 20 50 subi r18, 0x00 ; 0 37c: 30 40 sbci r19, 0x00 ; 0 37e: 40 49 sbci r20, 0x90 ; 144 380: 57 49 sbci r21, 0x97 ; 151 382: 10 f0 brcs .+4 ; 0x388 384: 81 e0 ldi r24, 0x01 ; 1 386: 90 e0 ldi r25, 0x00 ; 0 388: 20 e0 ldi r18, 0x00 ; 0 38a: 30 e0 ldi r19, 0x00 ; 0 38c: 4d 81 ldd r20, Y+5 ; 0x05 38e: 5e 81 ldd r21, Y+6 ; 0x06 390: 6f 81 ldd r22, Y+7 ; 0x07 392: 78 85 ldd r23, Y+8 ; 0x08 394: a4 16 cp r10, r20 396: b5 06 cpc r11, r21 398: c6 06 cpc r12, r22 39a: d7 06 cpc r13, r23 39c: 10 f0 brcs .+4 ; 0x3a2 39e: 21 e0 ldi r18, 0x01 ; 1 3a0: 30 e0 ldi r19, 0x00 ; 0 3a2: 82 23 and r24, r18 3a4: 93 23 and r25, r19 3a6: 89 2b or r24, r25 3a8: 41 f0 breq .+16 ; 0x3ba { valid=1; 3aa: 81 e0 ldi r24, 0x01 ; 1 3ac: 48 2e mov r4, r24 vco=x; 3ae: ad 80 ldd r10, Y+5 ; 0x05 3b0: be 80 ldd r11, Y+6 ; 0x06 3b2: cf 80 ldd r12, Y+7 ; 0x07 3b4: d8 84 ldd r13, Y+8 ; 0x08 N=_N; 3b6: e0 2e mov r14, r16 HS_DIV=_HS_DIV; 3b8: 5f 2c mov r5, r15 } _HS_DIV--; 3ba: fa 94 dec r15 if ((_HS_DIV==10)|(_HS_DIV==8)) _HS_DIV--; //skip unavailable divider ratios 3bc: 80 e0 ldi r24, 0x00 ; 0 3be: 90 e0 ldi r25, 0x00 ; 0 3c0: 5a e0 ldi r21, 0x0A ; 10 3c2: f5 16 cp r15, r21 3c4: 11 f4 brne .+4 ; 0x3ca 3c6: 81 e0 ldi r24, 0x01 ; 1 3c8: 90 e0 ldi r25, 0x00 ; 0 3ca: 20 e0 ldi r18, 0x00 ; 0 3cc: 30 e0 ldi r19, 0x00 ; 0 3ce: 68 e0 ldi r22, 0x08 ; 8 3d0: f6 16 cp r15, r22 3d2: 11 f4 brne .+4 ; 0x3d8 3d4: 21 e0 ldi r18, 0x01 ; 1 3d6: 30 e0 ldi r19, 0x00 ; 0 3d8: 82 2b or r24, r18 3da: 93 2b or r25, r19 3dc: 89 2b or r24, r25 3de: 09 f0 breq .+2 ; 0x3e2 3e0: fa 94 dec r15 3e2: 73 e0 ldi r23, 0x03 ; 3 3e4: 7f 15 cp r23, r15 3e6: 08 f4 brcc .+2 ; 0x3ea 3e8: 74 cf rjmp .-280 ; 0x2d2 3ea: 50 92 7e 00 sts 0x007E, r5 3ee: e0 92 6e 00 sts 0x006E, r14 } if (valid>0) 3f2: 44 20 and r4, r4 3f4: 09 f4 brne .+2 ; 0x3f8 3f6: 9b c0 rjmp .+310 ; 0x52e { ////////////////debug debug=vco/_2(19); 3f8: bd 2d mov r27, r13 3fa: ac 2d mov r26, r12 3fc: 9b 2d mov r25, r11 3fe: 8a 2d mov r24, r10 400: 13 e1 ldi r17, 0x13 ; 19 402: b6 95 lsr r27 404: a7 95 ror r26 406: 97 95 ror r25 408: 87 95 ror r24 40a: 1a 95 dec r17 40c: d1 f7 brne .-12 ; 0x402 40e: 80 93 7a 00 sts 0x007A, r24 412: 90 93 7b 00 sts 0x007B, r25 416: a0 93 7c 00 sts 0x007C, r26 41a: b0 93 7d 00 sts 0x007D, r27 ////////////////debug ende N=N-1; //convert divider ratio to SI570 register value 41e: ea 94 dec r14 420: e0 92 6e 00 sts 0x006E, r14 HS_DIV=HS_DIV-4; //convert divider ratio to SI570 register value 424: 8c ef ldi r24, 0xFC ; 252 426: 58 0e add r5, r24 428: 50 92 7e 00 sts 0x007E, r5 RFREQ=0; //higher 30 bit 42c: 10 92 86 00 sts 0x0086, r1 430: 10 92 87 00 sts 0x0087, r1 434: 10 92 88 00 sts 0x0088, r1 438: 10 92 89 00 sts 0x0089, r1 _RFREQ=0; //lower 8 bit 43c: 10 92 85 00 sts 0x0085, r1 for (i=1;i<=34;i++) //34 bit division RFREQ=vco/fcryst. Note that RFREQ only has 34 bits !=0 440: f1 e0 ldi r31, 0x01 ; 1 442: 3f 2e mov r3, r31 444: 60 90 74 00 lds r6, 0x0074 448: 70 90 75 00 lds r7, 0x0075 44c: 80 90 76 00 lds r8, 0x0076 450: 90 90 77 00 lds r9, 0x0077 454: ee 24 eor r14, r14 456: ff 24 eor r15, r15 458: 00 27 eor r16, r16 45a: 11 27 eor r17, r17 45c: 55 24 eor r5, r5 { d=vco/fcryst; 45e: 9d 2d mov r25, r13 460: 8c 2d mov r24, r12 462: 7b 2d mov r23, r11 464: 6a 2d mov r22, r10 466: 59 2d mov r21, r9 468: 48 2d mov r20, r8 46a: 37 2d mov r19, r7 46c: 26 2d mov r18, r6 46e: 81 d5 rcall .+2818 ; 0xf72 <__udivmodsi4> 470: b5 2f mov r27, r21 472: a4 2f mov r26, r20 474: 93 2f mov r25, r19 476: 82 2f mov r24, r18 if (i<=26) RFREQ=(RFREQ<<1)+d; 478: 9a e1 ldi r25, 0x1A ; 26 47a: 93 15 cp r25, r3 47c: 48 f0 brcs .+18 ; 0x490 47e: ee 0c add r14, r14 480: ff 1c adc r15, r15 482: 00 1f adc r16, r16 484: 11 1f adc r17, r17 486: e8 0e add r14, r24 488: f1 1c adc r15, r1 48a: 01 1d adc r16, r1 48c: 11 1d adc r17, r1 48e: 02 c0 rjmp .+4 ; 0x494 else _RFREQ=(_RFREQ<<1)+d; 490: 55 0c add r5, r5 492: 58 0e add r5, r24 vco=(vco-d*fcryst)<<1; 494: 99 27 eor r25, r25 496: aa 27 eor r26, r26 498: bb 27 eor r27, r27 49a: 59 2d mov r21, r9 49c: 48 2d mov r20, r8 49e: 37 2d mov r19, r7 4a0: 26 2d mov r18, r6 4a2: 68 2f mov r22, r24 4a4: 79 2f mov r23, r25 4a6: 8a 2f mov r24, r26 4a8: 9b 2f mov r25, r27 4aa: 32 d5 rcall .+2660 ; 0xf10 <__mulsi3> 4ac: b9 2f mov r27, r25 4ae: a8 2f mov r26, r24 4b0: 97 2f mov r25, r23 4b2: 86 2f mov r24, r22 4b4: a8 1a sub r10, r24 4b6: b9 0a sbc r11, r25 4b8: ca 0a sbc r12, r26 4ba: db 0a sbc r13, r27 4bc: aa 0c add r10, r10 4be: bb 1c adc r11, r11 4c0: cc 1c adc r12, r12 4c2: dd 1c adc r13, r13 4c4: 33 94 inc r3 4c6: a2 e2 ldi r26, 0x22 ; 34 4c8: a3 15 cp r26, r3 4ca: 48 f6 brcc .-110 ; 0x45e 4cc: 50 92 85 00 sts 0x0085, r5 4d0: e0 92 86 00 sts 0x0086, r14 4d4: f0 92 87 00 sts 0x0087, r15 4d8: 00 93 88 00 sts 0x0088, r16 4dc: 10 93 89 00 sts 0x0089, r17 } for (i=5;i>=1;i--) 4e0: 65 e0 ldi r22, 0x05 ; 5 4e2: 36 2e mov r3, r22 4e4: e4 e8 ldi r30, 0x84 ; 132 4e6: f0 e0 ldi r31, 0x00 ; 0 4e8: a5 e8 ldi r26, 0x85 ; 133 4ea: b0 e0 ldi r27, 0x00 ; 0 { SI570_data[i]=rfreq.w[5-i]; 4ec: 8d 91 ld r24, X+ 4ee: 80 83 st Z, r24 4f0: 31 97 sbiw r30, 0x01 ; 1 4f2: 3a 94 dec r3 4f4: d9 f7 brne .-10 ; 0x4ec } SI570_data[1]=(SI570_data[1] & 0x3f)|(N<<6); 4f6: 20 91 80 00 lds r18, 0x0080 4fa: 2f 73 andi r18, 0x3F ; 63 4fc: 30 91 6e 00 lds r19, 0x006E 500: 83 2f mov r24, r19 502: 99 27 eor r25, r25 504: 56 e0 ldi r21, 0x06 ; 6 506: 88 0f add r24, r24 508: 99 1f adc r25, r25 50a: 5a 95 dec r21 50c: e1 f7 brne .-8 ; 0x506 50e: 28 2b or r18, r24 510: 20 93 80 00 sts 0x0080, r18 SI570_data[0]=(N>>2) | (HS_DIV<<5); 514: 36 95 lsr r19 516: 36 95 lsr r19 518: 80 91 7e 00 lds r24, 0x007E 51c: 99 27 eor r25, r25 51e: 45 e0 ldi r20, 0x05 ; 5 520: 88 0f add r24, r24 522: 99 1f adc r25, r25 524: 4a 95 dec r20 526: e1 f7 brne .-8 ; 0x520 528: 38 2b or r19, r24 52a: 30 93 7f 00 sts 0x007F, r19 } //division done return(valid); //return 1 if valid register content found, else 0 } 52e: 84 2d mov r24, r4 530: 99 27 eor r25, r25 532: 28 96 adiw r28, 0x08 ; 8 534: 0f b6 in r0, 0x3f ; 63 536: f8 94 cli 538: de bf out 0x3e, r29 ; 62 53a: 0f be out 0x3f, r0 ; 63 53c: cd bf out 0x3d, r28 ; 61 53e: df 91 pop r29 540: cf 91 pop r28 542: 1f 91 pop r17 544: 0f 91 pop r16 546: ff 90 pop r15 548: ef 90 pop r14 54a: df 90 pop r13 54c: cf 90 pop r12 54e: bf 90 pop r11 550: af 90 pop r10 552: 9f 90 pop r9 554: 8f 90 pop r8 556: 7f 90 pop r7 558: 6f 90 pop r6 55a: 5f 90 pop r5 55c: 4f 90 pop r4 55e: 3f 90 pop r3 560: 08 95 ret 00000562 : void SI570_freezeNCO(void) { I2CSendStart(); 562: c0 dd rcall .-1152 ; 0xe4 I2CSendByte(I2C_adr<<1); // send device address 564: 80 91 6f 00 lds r24, 0x006F 568: 88 0f add r24, r24 56a: 37 de rcall .-914 ; 0x1da I2CSendByte(137); // send Byte address 137 56c: 89 e8 ldi r24, 0x89 ; 137 56e: 35 de rcall .-918 ; 0x1da I2CSendByte(0x10); // send freeze cmd 0x10 570: 80 e1 ldi r24, 0x10 ; 16 572: 33 de rcall .-922 ; 0x1da I2CSendStop(); 574: cf dd rcall .-1122 ; 0x114 576: 08 95 ret 00000578 : } void SI570_unfreezeNCO(void) { I2CSendStart(); 578: b5 dd rcall .-1174 ; 0xe4 I2CSendByte(I2C_adr<<1); // send device address 57a: 80 91 6f 00 lds r24, 0x006F 57e: 88 0f add r24, r24 580: 2c de rcall .-936 ; 0x1da I2CSendByte(137); // send Byte address 137 582: 89 e8 ldi r24, 0x89 ; 137 584: 2a de rcall .-940 ; 0x1da I2CSendByte(0x00); // send unfreeze cmd 0x00 586: 80 e0 ldi r24, 0x00 ; 0 588: 28 de rcall .-944 ; 0x1da I2CSendStop(); 58a: c4 dd rcall .-1144 ; 0x114 58c: 08 95 ret 0000058e : } void SI570_Load(void) { 58e: 0f 93 push r16 590: 1f 93 push r17 592: cf 93 push r28 uchar i; SI570_freezeNCO(); 594: e6 df rcall .-52 ; 0x562 I2CSendStart(); 596: a6 dd rcall .-1204 ; 0xe4 I2CSendByte((I2C_adr<<1) & 0xFE); // send device address 598: 80 91 6f 00 lds r24, 0x006F 59c: 88 0f add r24, r24 59e: 1d de rcall .-966 ; 0x1da I2CSendByte(byte_adr); // send Byte address 5a0: 80 91 60 00 lds r24, 0x0060 5a4: 1a de rcall .-972 ; 0x1da 5a6: 0f e7 ldi r16, 0x7F ; 127 5a8: 10 e0 ldi r17, 0x00 ; 0 5aa: c5 e0 ldi r28, 0x05 ; 5 for (i=0;i<=5;i++) I2CSendByte(SI570_data[i]); // send data 5ac: f1 2f mov r31, r17 5ae: e0 2f mov r30, r16 5b0: 81 91 ld r24, Z+ 5b2: 0e 2f mov r16, r30 5b4: 1f 2f mov r17, r31 5b6: 11 de rcall .-990 ; 0x1da 5b8: c1 50 subi r28, 0x01 ; 1 5ba: c7 ff sbrs r28, 7 5bc: f7 cf rjmp .-18 ; 0x5ac I2CSendStop(); 5be: aa dd rcall .-1196 ; 0x114 SI570_unfreezeNCO(); 5c0: db df rcall .-74 ; 0x578 I2CSendStart(); 5c2: 90 dd rcall .-1248 ; 0xe4 I2CSendByte((I2C_adr<<1) & 0xFE); // send device address 5c4: 80 91 6f 00 lds r24, 0x006F 5c8: 88 0f add r24, r24 5ca: 07 de rcall .-1010 ; 0x1da I2CSendByte(135); // send Byte address 5cc: 87 e8 ldi r24, 0x87 ; 135 5ce: 05 de rcall .-1014 ; 0x1da I2CSendByte(0x40); // send new frequency available 5d0: 80 e4 ldi r24, 0x40 ; 64 5d2: 03 de rcall .-1018 ; 0x1da I2CSendStop(); 5d4: 9f dd rcall .-1218 ; 0x114 5d6: cf 91 pop r28 5d8: 1f 91 pop r17 5da: 0f 91 pop r16 5dc: 08 95 ret 000005de : Read one byte from EEPROM address \c addr. */ uint8_t eeprom_read_byte (const uint8_t *addr) { 5de: a6 e0 ldi r26, 0x06 ; 6 5e0: b0 e0 ldi r27, 0x00 ; 0 uint8_t result; asm volatile 5e2: ee d4 rcall .+2524 ; 0xfc0 <__eeprom_read_byte_1C1D1E> 5e4: 80 2d mov r24, r0 5e6: 8f 3f cpi r24, 0xFF ; 255 5e8: 81 f0 breq .+32 ; 0x60a 5ea: ef e7 ldi r30, 0x7F ; 127 5ec: f0 e0 ldi r31, 0x00 ; 0 5ee: 20 e0 ldi r18, 0x00 ; 0 5f0: 30 e0 ldi r19, 0x00 ; 0 5f2: 95 e0 ldi r25, 0x05 ; 5 ( XCALL " __eeprom_read_byte_" _REG_LOCATION_SUFFIX CR_TAB "mov %1,__tmp_reg__" : "+x" (addr), "=r" (result) : ); return result; } /** \ingroup avr_eeprom Read one 16-bit word (little endian) from EEPROM address \c addr. */ uint16_t eeprom_read_word (const uint16_t *addr) { uint16_t result; asm ( XCALL " __eeprom_read_word_" _REG_LOCATION_SUFFIX CR_TAB : "+x" (addr), "=z" (result) : ); return result; } /** \ingroup avr_eeprom Read a block of \c n bytes from EEPROM address \c pointer_eeprom to \c pointer_ram. For constant n <= 256 bytes a library function is used. For block sizes unknown at compile time or block sizes > 256 an inline loop is expanded. */ void eeprom_read_block (void *pointer_ram, const void *pointer_eeprom, size_t n) { if (!__builtin_constant_p (n) || n > 256) { /* make sure size is a 16 bit variable. */ uint16_t size = n; asm volatile ( ".%=_start:" CR_TAB "sbiw %2,1" CR_TAB "brlt .%=_finished" CR_TAB XCALL " __eeprom_read_byte_" _REG_LOCATION_SUFFIX CR_TAB "st z+,__tmp_reg__" CR_TAB "rjmp .%=_start" CR_TAB ".%=_finished:" : "=x" (pointer_eeprom), "=z" (pointer_ram), "+w" (size) : "x" (pointer_eeprom), "z" (pointer_ram) : "memory"); } else { if (n != 0) { if (n == 256) { asm volatile ( XCALL " __eeprom_read_block_" _REG_LOCATION_SUFFIX : "+x" (pointer_eeprom), "=z" (pointer_ram) : "z" (pointer_ram) : "memory"); } else { /* Needed in order to truncate to 8 bit. */ uint8_t len; len = (uint8_t) n; asm volatile ( "mov __zero_reg__,%2" CR_TAB XCALL " __eeprom_read_block_" _REG_LOCATION_SUFFIX : "+x" (pointer_eeprom), "=z" (pointer_ram) : "r" (len), "z" (pointer_ram) : "memory"); } } } } /** \ingroup avr_eeprom Write a byte \c value to EEPROM address \c addr. */ void eeprom_write_byte (uint8_t *addr,uint8_t value) { 5f4: b3 2f mov r27, r19 5f6: a2 2f mov r26, r18 5f8: 17 96 adiw r26, 0x07 ; 7 5fa: 81 91 ld r24, Z+ asm volatile ( 5fc: 08 2e mov r0, r24 5fe: e8 d4 rcall .+2512 ; 0xfd0 <__eeprom_write_byte_1C1D1E> } /* ------------------------------------------------------------------------- */ /* ------------------------ interface to USB driver ------------------------ */ /* ------------------------------------------------------------------------- */ void safefreq(void) { uchar i; if (eeprom_read_byte((uint8_t *)INIT_SI570)!=0xff) // read init status for SI570 { for (i=0;i<6;i++) eeprom_write_byte((uint8_t *)(i+INIT_FREQ),SI570_data[i]); 600: 91 50 subi r25, 0x01 ; 1 602: 2f 5f subi r18, 0xFF ; 255 604: 3f 4f sbci r19, 0xFF ; 255 606: 97 ff sbrs r25, 7 608: f5 cf rjmp .-22 ; 0x5f4 60a: 08 95 ret 0000060c : } } USB_PUBLIC uchar usbFunctionWrite(uchar *data, uchar len) //sends len bytes to SI570 { 60c: cf 93 push r28 60e: df 93 push r29 610: f9 2f mov r31, r25 612: e8 2f mov r30, r24 uchar i; if (command==0x30) // get register contents and load to SI570 614: 80 91 79 00 lds r24, 0x0079 618: 80 33 cpi r24, 0x30 ; 48 61a: 59 f4 brne .+22 ; 0x632 { if (len<6) return 1; 61c: 66 30 cpi r22, 0x06 ; 6 61e: d0 f1 brcs .+116 ; 0x694 620: af e7 ldi r26, 0x7F ; 127 622: b0 e0 ldi r27, 0x00 ; 0 624: 25 e0 ldi r18, 0x05 ; 5 for (i=0;i<6;i++) SI570_data[i]=data[i]; 626: 81 91 ld r24, Z+ 628: 8d 93 st X+, r24 62a: 21 50 subi r18, 0x01 ; 1 62c: 27 ff sbrs r18, 7 62e: fb cf rjmp .-10 ; 0x626 630: 0f c0 rjmp .+30 ; 0x650 safefreq(); SI570_Load(); return 1; } if (len<4) return 1; 632: 64 30 cpi r22, 0x04 ; 4 634: 78 f1 brcs .+94 ; 0x694 if (command==0x32) // get frequency and load to SI570 636: 82 33 cpi r24, 0x32 ; 50 638: 71 f4 brne .+28 ; 0x656 63a: a0 e7 ldi r26, 0x70 ; 112 63c: b0 e0 ldi r27, 0x00 ; 0 63e: 23 e0 ldi r18, 0x03 ; 3 { for (i=0;i<4;i++) freq.bytes[i]=data[i]; 640: 81 91 ld r24, Z+ 642: 8d 93 st X+, r24 644: 21 50 subi r18, 0x01 ; 1 646: 27 ff sbrs r18, 7 648: fb cf rjmp .-10 ; 0x640 if (SI570CalcRegs()>0) 64a: 01 de rcall .-1022 ; 0x24e 64c: 88 23 and r24, r24 64e: 11 f1 breq .+68 ; 0x694 { safefreq(); 650: c6 df rcall .-116 ; 0x5de SI570_Load(); 652: 9d df rcall .-198 ; 0x58e } return 1; 654: 1f c0 rjmp .+62 ; 0x694 } if (command==0x33) // write new crystal frequency to EEPROM 656: 83 33 cpi r24, 0x33 ; 51 658: e9 f4 brne .+58 ; 0x694 65a: ce 2f mov r28, r30 65c: df 2f mov r29, r31 65e: 40 e0 ldi r20, 0x00 ; 0 660: 50 e0 ldi r21, 0x00 ; 0 662: 23 e0 ldi r18, 0x03 ; 3 Write a byte \c value to EEPROM address \c addr. */ void eeprom_write_byte (uint8_t *addr,uint8_t value) { 664: b5 2f mov r27, r21 666: a4 2f mov r26, r20 668: 12 96 adiw r26, 0x02 ; 2 66a: 89 91 ld r24, Y+ asm volatile ( 66c: 08 2e mov r0, r24 66e: b0 d4 rcall .+2400 ; 0xfd0 <__eeprom_write_byte_1C1D1E> { for (i=0;i<4;i++) eeprom_write_byte((uint8_t *)(F_CRYST+i), data[i]); 670: 21 50 subi r18, 0x01 ; 1 672: 4f 5f subi r20, 0xFF ; 255 674: 5f 4f sbci r21, 0xFF ; 255 676: 27 ff sbrs r18, 7 678: f5 cf rjmp .-22 ; 0x664 Write a byte \c value to EEPROM address \c addr. */ void eeprom_write_byte (uint8_t *addr,uint8_t value) { 67a: a1 e0 ldi r26, 0x01 ; 1 67c: b0 e0 ldi r27, 0x00 ; 0 67e: 80 e0 ldi r24, 0x00 ; 0 asm volatile ( 680: 08 2e mov r0, r24 682: a6 d4 rcall .+2380 ; 0xfd0 <__eeprom_write_byte_1C1D1E> 684: a4 e7 ldi r26, 0x74 ; 116 686: b0 e0 ldi r27, 0x00 ; 0 688: 23 e0 ldi r18, 0x03 ; 3 eeprom_write_byte((uint8_t *)(F_CAL_STATUS), 0); for (i=0;i<4;i++) fcr.bytes[i]=data[i]; 68a: 81 91 ld r24, Z+ 68c: 8d 93 st X+, r24 68e: 21 50 subi r18, 0x01 ; 1 690: 27 ff sbrs r18, 7 692: fb cf rjmp .-10 ; 0x68a return 1; } return 1; } 694: 81 e0 ldi r24, 0x01 ; 1 696: 90 e0 ldi r25, 0x00 ; 0 698: df 91 pop r29 69a: cf 91 pop r28 69c: 08 95 ret 0000069e : USB_PUBLIC uchar usbFunctionSetup(uchar data[8]) { 69e: 0f 93 push r16 6a0: 1f 93 push r17 6a2: cf 93 push r28 6a4: df 93 push r29 6a6: d9 2f mov r29, r25 6a8: c8 2f mov r28, r24 usbRequest_t *rq = (void *)data; static uchar replyBuf[6]; uchar i; usbMsgPtr = replyBuf; 6aa: 86 e6 ldi r24, 0x66 ; 102 6ac: 90 e0 ldi r25, 0x00 ; 0 6ae: 90 93 99 00 sts 0x0099, r25 6b2: 80 93 98 00 sts 0x0098, r24 if(rq->bRequest == 0){ // ECHO value 6b6: 99 81 ldd r25, Y+1 ; 0x01 6b8: 99 23 and r25, r25 6ba: 39 f4 brne .+14 ; 0x6ca replyBuf[0] = data[2]; // rq->bRequest identical data[1]! 6bc: 8a 81 ldd r24, Y+2 ; 0x02 6be: 80 93 66 00 sts 0x0066, r24 replyBuf[1] = data[3]; 6c2: 8b 81 ldd r24, Y+3 ; 0x03 6c4: 80 93 67 00 sts 0x0067, r24 6c8: 8f c0 rjmp .+286 ; 0x7e8 return 2; } if(rq->bRequest == 1){ // set port directions 6ca: 91 30 cpi r25, 0x01 ; 1 6cc: 21 f4 brne .+8 ; 0x6d6 DDRB = data[2] & 6ce: 8a 81 ldd r24, Y+2 ; 0x02 6d0: 8a 7f andi r24, 0xFA ; 250 6d2: 87 bb out 0x17, r24 ; 23 6d4: d6 c0 rjmp .+428 ; 0x882 ~((1 << USB_CFG_DMINUS_BIT) | (1 << USB_CFG_DPLUS_BIT)); // protect USB interface return 0; } if(rq->bRequest == 2){ // read ports 6d6: 92 30 cpi r25, 0x02 ; 2 6d8: 11 f4 brne .+4 ; 0x6de replyBuf[0] = PINB; 6da: 86 b3 in r24, 0x16 ; 22 6dc: e4 c0 rjmp .+456 ; 0x8a6 return 1; } if(rq->bRequest == 3){ // read port states 6de: 93 30 cpi r25, 0x03 ; 3 6e0: 11 f4 brne .+4 ; 0x6e6 replyBuf[0] = PORTB; 6e2: 88 b3 in r24, 0x18 ; 24 6e4: e0 c0 rjmp .+448 ; 0x8a6 return 1; } if(rq->bRequest == 4){ // set ports 6e6: 94 30 cpi r25, 0x04 ; 4 6e8: 21 f4 brne .+8 ; 0x6f2 PORTB = data[2] & 6ea: 8a 81 ldd r24, Y+2 ; 0x02 6ec: 8a 7f andi r24, 0xFA ; 250 6ee: 88 bb out 0x18, r24 ; 24 6f0: c8 c0 rjmp .+400 ; 0x882 ~((1 << USB_CFG_DMINUS_BIT) | (1 << USB_CFG_DPLUS_BIT)); // protect USB interface return 0; } if(rq->bRequest == 5){ // send I2C start sequence 6f2: 95 30 cpi r25, 0x05 ; 5 6f4: 11 f4 brne .+4 ; 0x6fa I2CSendStart(); 6f6: f6 dc rcall .-1556 ; 0xe4 6f8: c4 c0 rjmp .+392 ; 0x882 return 0; } if(rq->bRequest == 6){ // send I2C stop sequence 6fa: 96 30 cpi r25, 0x06 ; 6 6fc: 11 f4 brne .+4 ; 0x702 I2CSendStop(); 6fe: 0a dd rcall .-1516 ; 0x114 700: c0 c0 rjmp .+384 ; 0x882 return 0; } if(rq->bRequest == 7){ // send byte to I2C 702: 97 30 cpi r25, 0x07 ; 7 704: 21 f4 brne .+8 ; 0x70e I2CErrors = 0; // reset error counter 706: 10 92 78 00 sts 0x0078, r1 I2CSendByte(data[2]); 70a: 8a 81 ldd r24, Y+2 ; 0x02 70c: 07 c0 rjmp .+14 ; 0x71c replyBuf[0] = I2CErrors; // return number of I2C transmission errors return 1; } if(rq->bRequest == 8){ // send word to I2C 70e: 98 30 cpi r25, 0x08 ; 8 710: 49 f4 brne .+18 ; 0x724 I2CErrors = 0; // reset error counter 712: 10 92 78 00 sts 0x0078, r1 I2CSendByte(data[2]); 716: 8a 81 ldd r24, Y+2 ; 0x02 718: 60 dd rcall .-1344 ; 0x1da I2CSendByte(data[3]); 71a: 8b 81 ldd r24, Y+3 ; 0x03 71c: 5e dd rcall .-1348 ; 0x1da replyBuf[0] = I2CErrors; // return number of I2C transmission errors 71e: 80 91 78 00 lds r24, 0x0078 722: c1 c0 rjmp .+386 ; 0x8a6 return 1; } if(rq->bRequest == 9){ // send dword to I2C 724: 99 30 cpi r25, 0x09 ; 9 726: 51 f4 brne .+20 ; 0x73c I2CErrors = 0; // reset error counter 728: 10 92 78 00 sts 0x0078, r1 I2CSendByte(data[2]); 72c: 8a 81 ldd r24, Y+2 ; 0x02 72e: 55 dd rcall .-1366 ; 0x1da I2CSendByte(data[3]); 730: 8b 81 ldd r24, Y+3 ; 0x03 732: 53 dd rcall .-1370 ; 0x1da I2CSendByte(data[4]); 734: 8c 81 ldd r24, Y+4 ; 0x04 736: 51 dd rcall .-1374 ; 0x1da I2CSendByte(data[5]); 738: 8d 81 ldd r24, Y+5 ; 0x05 73a: f0 cf rjmp .-32 ; 0x71c replyBuf[0] = I2CErrors; // return number of I2C transmission errors return 1; } if(rq->bRequest == 0xa){ // send word to I2C with start and stop sequence 73c: 9a 30 cpi r25, 0x0A ; 10 73e: 21 f4 brne .+8 ; 0x748 I2CSendStart(); // send start sequence 740: d1 dc rcall .-1630 ; 0xe4 I2CSendByte(data[2] & 0xFE); // send device address from "value" 742: 8a 81 ldd r24, Y+2 ; 0x02 744: 8e 7f andi r24, 0xFE ; 254 746: 34 c0 rjmp .+104 ; 0x7b0 I2CSendByte(data[4]); // send data from "index" I2CSendStop(); // send stop sequence replyBuf[0] = I2CErrors; // return number of I2C transmission errors return 1; } if(rq->bRequest == 0xb){ // receive word from I2C with start and stop sequence 748: 9b 30 cpi r25, 0x0B ; 11 74a: 19 f4 brne .+6 ; 0x752 I2CSendStart(); 74c: cb dc rcall .-1642 ; 0xe4 I2CSendByte(data[2] | 1); // send device address from "value" 74e: 8a 81 ldd r24, Y+2 ; 0x02 750: 41 c0 rjmp .+130 ; 0x7d4 replyBuf[1] = I2CReceiveLastByte(); // receive data and return I2CSendStop(); replyBuf[0] = I2CErrors; // return number of I2C transmission errors return 2; } if(rq->bRequest == 0xc){ // modify I2C clock 752: 9c 30 cpi r25, 0x0C ; 12 754: 61 f4 brne .+24 ; 0x76e I2C_MINTIME = data[2]+256*data[3];// set time constant from "value" 756: 2a 81 ldd r18, Y+2 ; 0x02 758: 8b 81 ldd r24, Y+3 ; 0x03 75a: 99 27 eor r25, r25 75c: 98 2f mov r25, r24 75e: 88 27 eor r24, r24 760: 82 0f add r24, r18 762: 91 1d adc r25, r1 764: 90 93 62 00 sts 0x0062, r25 768: 80 93 61 00 sts 0x0061, r24 76c: 8a c0 rjmp .+276 ; 0x882 return 0; } /* if(rq->bRequest == 0xd){ // read OSCCAL to "value" replyBuf[0] = OSCCAL; return 1; } if(rq->bRequest == 0xe){ // Write "value" to OSCCAL OSCCAL = data[2]; return 0; } */ if(rq->bRequest == 0xf){ // Reset by Watchdog 76e: 9f 30 cpi r25, 0x0F ; 15 770: 09 f4 brne .+2 ; 0x774 for (;;){}; 772: ff cf rjmp .-2 ; 0x772 return 0; } if(rq->bRequest == 0x10){ // EEPROM write byte value=address, index=data 774: 90 31 cpi r25, 0x10 ; 16 776: 49 f4 brne .+18 ; 0x78a Write a byte \c value to EEPROM address \c addr. */ void eeprom_write_byte (uint8_t *addr,uint8_t value) { 778: 2a 81 ldd r18, Y+2 ; 0x02 77a: 8b 81 ldd r24, Y+3 ; 0x03 77c: 99 27 eor r25, r25 77e: b8 2f mov r27, r24 780: aa 27 eor r26, r26 782: a2 0f add r26, r18 784: b1 1d adc r27, r1 786: 8c 81 ldd r24, Y+4 ; 0x04 788: 7a c0 rjmp .+244 ; 0x87e eeprom_write_byte((uint8_t *)(data[2]+256*data[3]), data[4]); return 0; } if(rq->bRequest == 0x11){ // EEPROM read byte "value"=address 78a: 91 31 cpi r25, 0x11 ; 17 78c: 51 f4 brne .+20 ; 0x7a2 Read one byte from EEPROM address \c addr. */ uint8_t eeprom_read_byte (const uint8_t *addr) { 78e: 2a 81 ldd r18, Y+2 ; 0x02 790: 8b 81 ldd r24, Y+3 ; 0x03 792: 99 27 eor r25, r25 794: b8 2f mov r27, r24 796: aa 27 eor r26, r26 798: a2 0f add r26, r18 79a: b1 1d adc r27, r1 uint8_t result; asm volatile 79c: 11 d4 rcall .+2082 ; 0xfc0 <__eeprom_read_byte_1C1D1E> 79e: 80 2d mov r24, r0 7a0: 82 c0 rjmp .+260 ; 0x8a6 replyBuf[0] = eeprom_read_byte((uint8_t *)(data[2]+256*data[3])); return 1; } /* if(rq->bRequest == 0x13){ // return usb device address replyBuf[0] = usbDeviceAddr; return 1; } */ /////SI570 specific code///////////////////////////////////////////////////// if(rq->bRequest == 0x20){ // SI570: write byte from register index 7a2: 90 32 cpi r25, 0x20 ; 32 7a4: 51 f4 brne .+20 ; 0x7ba I2CSendStart(); 7a6: 9e dc rcall .-1732 ; 0xe4 I2CSendByte((data[2]<<1)&0xFE); // send device address from "value" low 7a8: 8a 81 ldd r24, Y+2 ; 0x02 7aa: 88 0f add r24, r24 7ac: 16 dd rcall .-1492 ; 0x1da I2CSendByte(data[3]); // send Byte address from "value" high 7ae: 8b 81 ldd r24, Y+3 ; 0x03 7b0: 14 dd rcall .-1496 ; 0x1da I2CSendByte(data[4]); // send data from "index" low 7b2: 8c 81 ldd r24, Y+4 ; 0x04 7b4: 12 dd rcall .-1500 ; 0x1da I2CSendStop(); 7b6: ae dc rcall .-1700 ; 0x114 7b8: b2 cf rjmp .-156 ; 0x71e replyBuf[0] = I2CErrors; // return number of I2C transmission errors return 1; } if(rq->bRequest == 0x21){ // SI570: read byte to register index 7ba: 91 32 cpi r25, 0x21 ; 33 7bc: c1 f4 brne .+48 ; 0x7ee I2CSendStart(); 7be: 92 dc rcall .-1756 ; 0xe4 I2CSendByte((data[2]<<1)&0xFE); // send device address from "value" low 7c0: 8a 81 ldd r24, Y+2 ; 0x02 7c2: 88 0f add r24, r24 7c4: 0a dd rcall .-1516 ; 0x1da I2CSendByte(data[3]); // send Byte address from "value" high 7c6: 8b 81 ldd r24, Y+3 ; 0x03 7c8: 08 dd rcall .-1520 ; 0x1da I2CSendStart(); 7ca: 8c dc rcall .-1768 ; 0xe4 I2CSendByte((data[2]<<1)|1); // send device address from "value" low, ready for read 7cc: 8a 81 ldd r24, Y+2 ; 0x02 7ce: 99 27 eor r25, r25 7d0: 88 0f add r24, r24 7d2: 99 1f adc r25, r25 7d4: 81 60 ori r24, 0x01 ; 1 7d6: 01 dd rcall .-1534 ; 0x1da replyBuf[1] = I2CReceiveLastByte(); // receive data and return 7d8: 2a dd rcall .-1452 ; 0x22e 7da: 80 93 67 00 sts 0x0067, r24 I2CSendStop(); 7de: 9a dc rcall .-1740 ; 0x114 replyBuf[0] = I2CErrors; // return number of I2C transmission errors 7e0: 80 91 78 00 lds r24, 0x0078 7e4: 80 93 66 00 sts 0x0066, r24 return 2; 7e8: 82 e0 ldi r24, 0x02 ; 2 7ea: 90 e0 ldi r25, 0x00 ; 0 7ec: 60 c0 rjmp .+192 ; 0x8ae } if(rq->bRequest == 0x22){ // SI570: freeze NCO 7ee: 92 32 cpi r25, 0x22 ; 34 7f0: 29 f4 brne .+10 ; 0x7fc I2C_adr = data[2]; 7f2: 8a 81 ldd r24, Y+2 ; 0x02 7f4: 80 93 6f 00 sts 0x006F, r24 SI570_freezeNCO(); 7f8: b4 de rcall .-664 ; 0x562 7fa: 91 cf rjmp .-222 ; 0x71e replyBuf[0] = I2CErrors; // return number of I2C transmission errors return 1; } if(rq->bRequest == 0x23){ // SI570: unfreeze NCO 7fc: 93 32 cpi r25, 0x23 ; 35 7fe: 29 f4 brne .+10 ; 0x80a I2C_adr = data[2]; 800: 8a 81 ldd r24, Y+2 ; 0x02 802: 80 93 6f 00 sts 0x006F, r24 SI570_unfreezeNCO(); 806: b8 de rcall .-656 ; 0x578 808: 8a cf rjmp .-236 ; 0x71e replyBuf[0] = I2CErrors; // return number of I2C transmission errors return 1; } if((rq->bRequest >= 0x30)& 80a: 89 2f mov r24, r25 80c: 80 53 subi r24, 0x30 ; 48 80e: 87 30 cpi r24, 0x07 ; 7 810: 60 f4 brcc .+24 ; 0x82a (rq->bRequest < 0x37)){ // use usbFunctionWrite to transfer data I2C_adr = data[2]; 812: 8a 81 ldd r24, Y+2 ; 0x02 814: 80 93 6f 00 sts 0x006F, r24 byte_adr= data[3]; 818: 8b 81 ldd r24, Y+3 ; 0x03 81a: 80 93 60 00 sts 0x0060, r24 command=rq->bRequest; 81e: 89 81 ldd r24, Y+1 ; 0x01 820: 80 93 79 00 sts 0x0079, r24 return 0xff; 824: 8f ef ldi r24, 0xFF ; 255 826: 90 e0 ldi r25, 0x00 ; 0 828: 42 c0 rjmp .+132 ; 0x8ae /* if(rq->bRequest == 0x3e){ // debug: read out calculated frequency control registers for (i=0;i<6;i++){ replyBuf[i] = SI570_data[i];// copy data bytes } return 6;}*/ } if(rq->bRequest == 0x3f){ // SI570: read out frequency control registers 82a: 9f 33 cpi r25, 0x3F ; 63 82c: 01 f5 brne .+64 ; 0x86e I2CSendStart(); // read all registers in one block 82e: 5a dc rcall .-1868 ; 0xe4 I2CSendByte(data[2]<<1); // send device address from "value" lo 830: 8a 81 ldd r24, Y+2 ; 0x02 832: 88 0f add r24, r24 834: d2 dc rcall .-1628 ; 0x1da I2CSendByte(7); // send Byte address 7 of first register 836: 87 e0 ldi r24, 0x07 ; 7 838: d0 dc rcall .-1632 ; 0x1da I2CSendStart(); 83a: 54 dc rcall .-1880 ; 0xe4 I2CSendByte((data[2]<<1)|1); // send device address from "value" lo for reading 83c: 8a 81 ldd r24, Y+2 ; 0x02 83e: 99 27 eor r25, r25 840: 88 0f add r24, r24 842: 99 1f adc r25, r25 844: 81 60 ori r24, 0x01 ; 1 846: c9 dc rcall .-1646 ; 0x1da 848: 06 e6 ldi r16, 0x66 ; 102 84a: 10 e0 ldi r17, 0x00 ; 0 84c: c4 e0 ldi r28, 0x04 ; 4 for (i=0;i<5;i++){ replyBuf[i] = I2CReceiveByte(); // receive data byte 84e: df dc rcall .-1602 ; 0x20e 850: f1 2f mov r31, r17 852: e0 2f mov r30, r16 854: 81 93 st Z+, r24 856: 0e 2f mov r16, r30 858: 1f 2f mov r17, r31 85a: c1 50 subi r28, 0x01 ; 1 85c: c7 ff sbrs r28, 7 85e: f7 cf rjmp .-18 ; 0x84e } replyBuf[5] = I2CReceiveLastByte(); // receive without Acknowledge 860: e6 dc rcall .-1588 ; 0x22e 862: 80 93 6b 00 sts 0x006B, r24 I2CSendStop(); 866: 56 dc rcall .-1876 ; 0x114 /* for (i=0;i<6;i++){ // alternatively, read register after register I2CSendStart(); I2CSendByte((data[2]<<1)&0xFE); // send device address from "value" low I2CSendByte(7+i); // send Byte address from "value" high I2CSendStart(); I2CSendByte((data[2]<<1)|1); // send device address from "value" low, ready for read replyBuf[i] = I2CReceiveLastByte(); // receive data without Acknowledge and return I2CSendStop(); }*/ return 6; 868: 86 e0 ldi r24, 0x06 ; 6 86a: 90 e0 ldi r25, 0x00 ; 0 86c: 20 c0 rjmp .+64 ; 0x8ae } if(rq->bRequest == 0x40){ // return number of I2C transmission errors 86e: 90 34 cpi r25, 0x40 ; 64 870: 09 f4 brne .+2 ; 0x874 872: 55 cf rjmp .-342 ; 0x71e replyBuf[0] = I2CErrors; return 1; } if(rq->bRequest == 0x41){ // set/reset init freq status 874: 91 34 cpi r25, 0x41 ; 65 876: 41 f4 brne .+16 ; 0x888 Write a byte \c value to EEPROM address \c addr. */ void eeprom_write_byte (uint8_t *addr,uint8_t value) { 878: a6 e0 ldi r26, 0x06 ; 6 87a: b0 e0 ldi r27, 0x00 ; 0 87c: 8a 81 ldd r24, Y+2 ; 0x02 asm volatile ( 87e: 08 2e mov r0, r24 880: a7 d3 rcall .+1870 ; 0xfd0 <__eeprom_write_byte_1C1D1E> eeprom_write_byte((uint8_t *)INIT_SI570,data[2]); //status: low byte of value = I2C address return 0; 882: 80 e0 ldi r24, 0x00 ; 0 884: 90 e0 ldi r25, 0x00 ; 0 886: 13 c0 rjmp .+38 ; 0x8ae } if(rq->bRequest == 0x50){ // set RXTX and get cw-key status 888: 90 35 cpi r25, 0x50 ; 80 88a: 39 f4 brne .+14 ; 0x89a if (data[2] == 0) PORTB = PORTB & ~RXTX; 88c: 8a 81 ldd r24, Y+2 ; 0x02 88e: 88 23 and r24, r24 890: 11 f4 brne .+4 ; 0x896 892: c4 98 cbi 0x18, 4 ; 24 894: 04 c0 rjmp .+8 ; 0x89e else PORTB = PORTB | RXTX; 896: c4 9a sbi 0x18, 4 ; 24 898: 02 c0 rjmp .+4 ; 0x89e replyBuf[0] = PINB & CWKEY; // read SDA and cw key level simultaneously return 1; } if(rq->bRequest == 0x51){ // read SDA and cw key level simultaneously 89a: 91 35 cpi r25, 0x51 ; 81 89c: 19 f4 brne .+6 ; 0x8a4 replyBuf[0] = PINB & CWKEY; 89e: 86 b3 in r24, 0x16 ; 22 8a0: 82 72 andi r24, 0x22 ; 34 8a2: 01 c0 rjmp .+2 ; 0x8a6 return 1; } replyBuf[0] = 0xff; // return value 0xff => command not supported 8a4: 8f ef ldi r24, 0xFF ; 255 8a6: 80 93 66 00 sts 0x0066, r24 return 1; 8aa: 81 e0 ldi r24, 0x01 ; 1 8ac: 90 e0 ldi r25, 0x00 ; 0 8ae: df 91 pop r29 8b0: cf 91 pop r28 8b2: 1f 91 pop r17 8b4: 0f 91 pop r16 8b6: 08 95 ret 000008b8 : } /* ------------------------------------------------------------------------- */ /* ------------------------ Oscillator Calibration ------------------------- */ /* ------------------------------------------------------------------------- */ /* Calibrate the RC oscillator to 8.25 MHz. The core clock of 16.5 MHz is * derived from the 66 MHz peripheral clock by dividing. Our timing reference * is the Start Of Frame signal (a single SE0 bit) available immediately after * a USB RESET. We first do a binary search for the OSCCAL value and then * optimize this value with a neighboorhod search. * This algorithm may also be used to calibrate the RC oscillator directly to * 12 MHz (no PLL involved, can therefore be used on almost ALL AVRs), but this * is wide outside the spec for the OSCCAL value and the required precision for * the 12 MHz clock! Use the RC oscillator calibrated to 12 MHz for * experimental purposes only! */ static void calibrateOscillator(void) { uchar step = 128; uchar trialValue = 0, optimumValue; int x, optimumDev, targetValue = (unsigned)(1499 * (double)F_CPU / 10.5e6 + 0.5); /* do a binary search: */ do{ OSCCAL = trialValue + step; x = usbMeasureFrameLength(); /* proportional to current real frequency */ if(x < targetValue) /* frequency still too low */ trialValue += step; step >>= 1; }while(step > 0); /* We have a precision of +/- 1 for optimum OSCCAL here */ /* now do a neighborhood search for optimum value */ optimumValue = trialValue; optimumDev = x; /* this is certainly far away from optimum */ for(OSCCAL = trialValue - 1; OSCCAL <= trialValue + 1; OSCCAL++){ x = usbMeasureFrameLength() - targetValue; if(x < 0) x = -x; if(x < optimumDev){ optimumDev = x; optimumValue = OSCCAL; } } OSCCAL = optimumValue; } /* Note: This calibration algorithm may try OSCCAL values of up to 192 even if the optimum value is far below 192. It may therefore exceed the allowed clock frequency of the CPU in low voltage designs! You may replace this search algorithm with any other algorithm you like if you have additional constraints such as a maximum CPU clock. For version 5.x RC oscillators (those with a split range of 2x128 steps, e.g. ATTiny25, ATTiny45, ATTiny85), it may be useful to search for the optimum in both regions. */ void usbEventResetReady(void) { 8b8: ef 92 push r14 8ba: ff 92 push r15 8bc: 0f 93 push r16 8be: 1f 93 push r17 8c0: cf 93 push r28 8c2: 10 e8 ldi r17, 0x80 ; 128 8c4: 00 e0 ldi r16, 0x00 ; 0 8c6: c0 2f mov r28, r16 8c8: c1 0f add r28, r17 8ca: c1 bf out 0x31, r28 ; 49 8cc: be d1 rcall .+892 ; 0xc4a 8ce: 29 e0 ldi r18, 0x09 ; 9 8d0: 84 33 cpi r24, 0x34 ; 52 8d2: 92 07 cpc r25, r18 8d4: 0c f4 brge .+2 ; 0x8d8 8d6: 0c 2f mov r16, r28 8d8: 16 95 lsr r17 8da: a9 f7 brne .-22 ; 0x8c6 8dc: c0 2f mov r28, r16 8de: e8 2e mov r14, r24 8e0: f9 2e mov r15, r25 8e2: c1 50 subi r28, 0x01 ; 1 8e4: c1 bf out 0x31, r28 ; 49 8e6: cf 5f subi r28, 0xFF ; 255 8e8: 81 b7 in r24, 0x31 ; 49 8ea: 28 2f mov r18, r24 8ec: 33 27 eor r19, r19 8ee: 0c 2f mov r16, r28 8f0: 11 27 eor r17, r17 8f2: 91 2f mov r25, r17 8f4: 80 2f mov r24, r16 8f6: 01 96 adiw r24, 0x01 ; 1 8f8: 82 17 cp r24, r18 8fa: 93 07 cpc r25, r19 8fc: ac f0 brlt .+42 ; 0x928 8fe: a5 d1 rcall .+842 ; 0xc4a 900: 84 53 subi r24, 0x34 ; 52 902: 99 40 sbci r25, 0x09 ; 9 904: 97 ff sbrs r25, 7 906: 03 c0 rjmp .+6 ; 0x90e 908: 90 95 com r25 90a: 81 95 neg r24 90c: 9f 4f sbci r25, 0xFF ; 255 90e: 8e 15 cp r24, r14 910: 9f 05 cpc r25, r15 912: 1c f4 brge .+6 ; 0x91a 914: e8 2e mov r14, r24 916: f9 2e mov r15, r25 918: c1 b7 in r28, 0x31 ; 49 91a: 81 b7 in r24, 0x31 ; 49 91c: 8f 5f subi r24, 0xFF ; 255 91e: 81 bf out 0x31, r24 ; 49 920: 81 b7 in r24, 0x31 ; 49 922: 28 2f mov r18, r24 924: 33 27 eor r19, r19 926: e5 cf rjmp .-54 ; 0x8f2 928: c1 bf out 0x31, r28 ; 49 Write a byte \c value to EEPROM address \c addr. */ void eeprom_write_byte (uint8_t *addr,uint8_t value) { 92a: a0 e0 ldi r26, 0x00 ; 0 92c: b0 e0 ldi r27, 0x00 ; 0 92e: 81 b7 in r24, 0x31 ; 49 asm volatile ( 930: 08 2e mov r0, r24 932: 4e d3 rcall .+1692 ; 0xfd0 <__eeprom_write_byte_1C1D1E> 934: cf 91 pop r28 936: 1f 91 pop r17 938: 0f 91 pop r16 93a: ff 90 pop r15 93c: ef 90 pop r14 93e: 08 95 ret 00000940
: calibrateOscillator(); eeprom_write_byte(0, OSCCAL); /* store the calibrated value in EEPROM */ } /* ------------------------------------------------------------------------- */ /* --------------------------------- main ---------------------------------- */ /* ------------------------------------------------------------------------- */ int main(void) { 940: cf e5 ldi r28, 0x5F ; 95 942: d1 e0 ldi r29, 0x01 ; 1 944: de bf out 0x3e, r29 ; 62 946: cd bf out 0x3d, r28 ; 61 uchar i; ////////////////////////////////////////////////////////////////////////////////////////////// fcryst=114.285*_2(19)*_2(5); //initialize fcryst to crystal frequency[MHz]*2^24 948: 80 e0 ldi r24, 0x00 ; 0 94a: 96 ef ldi r25, 0xF6 ; 246 94c: a8 e4 ldi r26, 0x48 ; 72 94e: b2 e7 ldi r27, 0x72 ; 114 950: 80 93 74 00 sts 0x0074, r24 954: 90 93 75 00 sts 0x0075, r25 958: a0 93 76 00 sts 0x0076, r26 95c: b0 93 77 00 sts 0x0077, r27 Read one byte from EEPROM address \c addr. */ uint8_t eeprom_read_byte (const uint8_t *addr) { 960: a1 e0 ldi r26, 0x01 ; 1 962: b0 e0 ldi r27, 0x00 ; 0 uint8_t result; asm volatile 964: 2d d3 rcall .+1626 ; 0xfc0 <__eeprom_read_byte_1C1D1E> 966: 80 2d mov r24, r0 968: 8f 3f cpi r24, 0xFF ; 255 96a: 81 f0 breq .+32 ; 0x98c 96c: e4 e7 ldi r30, 0x74 ; 116 96e: f0 e0 ldi r31, 0x00 ; 0 970: 20 e0 ldi r18, 0x00 ; 0 972: 30 e0 ldi r19, 0x00 ; 0 974: 43 e0 ldi r20, 0x03 ; 3 976: b3 2f mov r27, r19 978: a2 2f mov r26, r18 97a: 12 96 adiw r26, 0x02 ; 2 97c: 21 d3 rcall .+1602 ; 0xfc0 <__eeprom_read_byte_1C1D1E> 97e: 80 2d mov r24, r0 980: 81 93 st Z+, r24 if (eeprom_read_byte((uint8_t *)F_CAL_STATUS)!=0xff) // read calibrated crystal frequency if available { for (i=0;i<4;i++) 982: 41 50 subi r20, 0x01 ; 1 984: 2f 5f subi r18, 0xFF ; 255 986: 3f 4f sbci r19, 0xFF ; 255 988: 47 ff sbrs r20, 7 98a: f5 cf rjmp .-22 ; 0x976 Read one byte from EEPROM address \c addr. */ uint8_t eeprom_read_byte (const uint8_t *addr) { 98c: a6 e0 ldi r26, 0x06 ; 6 98e: b0 e0 ldi r27, 0x00 ; 0 uint8_t result; asm volatile 990: 17 d3 rcall .+1582 ; 0xfc0 <__eeprom_read_byte_1C1D1E> 992: 80 2d mov r24, r0 994: 99 27 eor r25, r25 996: 80 93 6f 00 sts 0x006F, r24 { fcr.bytes[i]=eeprom_read_byte((uint8_t *)(i+F_CRYST)); //read f_cryst from EEPROM if available } } // crystal frequency set /////////////////////////////////////////////////////////////////////////////////////////////// // Load frequency preset if available I2C_adr = eeprom_read_byte((uint8_t *)INIT_SI570); // read init status = I2C address for SI570 if (I2C_adr!=0xff) 99a: 8f 3f cpi r24, 0xFF ; 255 99c: 89 f0 breq .+34 ; 0x9c0 99e: ef e7 ldi r30, 0x7F ; 127 9a0: f0 e0 ldi r31, 0x00 ; 0 9a2: 20 e0 ldi r18, 0x00 ; 0 9a4: 30 e0 ldi r19, 0x00 ; 0 9a6: 45 e0 ldi r20, 0x05 ; 5 Read one byte from EEPROM address \c addr. */ uint8_t eeprom_read_byte (const uint8_t *addr) { 9a8: b3 2f mov r27, r19 9aa: a2 2f mov r26, r18 9ac: 17 96 adiw r26, 0x07 ; 7 uint8_t result; asm volatile 9ae: 08 d3 rcall .+1552 ; 0xfc0 <__eeprom_read_byte_1C1D1E> 9b0: 80 2d mov r24, r0 9b2: 81 93 st Z+, r24 { for (i=0;i<6;i++) 9b4: 41 50 subi r20, 0x01 ; 1 9b6: 2f 5f subi r18, 0xFF ; 255 9b8: 3f 4f sbci r19, 0xFF ; 255 9ba: 47 ff sbrs r20, 7 9bc: f5 cf rjmp .-22 ; 0x9a8 { SI570_data[i]=eeprom_read_byte((uint8_t *)(i+INIT_FREQ)); //read init frequency from EEPROM if available } SI570_Load(); 9be: e7 dd rcall .-1074 ; 0x58e Read one byte from EEPROM address \c addr. */ uint8_t eeprom_read_byte (const uint8_t *addr) { 9c0: a0 e0 ldi r26, 0x00 ; 0 9c2: b0 e0 ldi r27, 0x00 ; 0 uint8_t result; asm volatile 9c4: fd d2 rcall .+1530 ; 0xfc0 <__eeprom_read_byte_1C1D1E> 9c6: 80 2d mov r24, r0 9c8: 28 2f mov r18, r24 9ca: 33 27 eor r19, r19 } // Frequency preset done /////////////////////////////////////////////////////////////////////////////////////////////// uchar calibrationValue; // usbConnect sequence calibrationValue = eeprom_read_byte((uint8_t *)RC_CAL_VALUE); /* calibration value from last time */ if(calibrationValue != 0xff){ 9cc: 2f 3f cpi r18, 0xFF ; 255 9ce: 09 f0 breq .+2 ; 0x9d2 OSCCAL = calibrationValue; 9d0: 21 bf out 0x31, r18 ; 49 } usbDeviceDisconnect(); 9d2: ba 9a sbi 0x17, 2 ; 23 9d4: e3 eb ldi r30, 0xB3 ; 179 9d6: f1 ef ldi r31, 0xF1 ; 241 9d8: 4b e3 ldi r20, 0x3B ; 59 */ void _delay_loop_2(uint16_t __count) { __asm__ volatile ( 9da: 8e 2f mov r24, r30 9dc: 9f 2f mov r25, r31 9de: 01 97 sbiw r24, 0x01 ; 1 9e0: f1 f7 brne .-4 ; 0x9de for(i=0;i<60;i++){ // 900 ms disconnect 9e2: 41 50 subi r20, 0x01 ; 1 9e4: 47 ff sbrs r20, 7 9e6: f9 cf rjmp .-14 ; 0x9da _delay_ms(15); } usbDeviceConnect(); 9e8: ba 98 cbi 0x17, 2 ; 23 // usbConnect sequence done DDRB = RXTX; //all port pins inputs except RXTX switching output 9ea: 80 e1 ldi r24, 0x10 ; 16 9ec: 87 bb out 0x17, r24 ; 23 PORTB = 0; //RX on on startup, no pullups 9ee: 18 ba out 0x18, r1 ; 24 wdt_enable(WDTO_120MS ); //watchdog 1s 9f0: 88 e1 ldi r24, 0x18 ; 24 9f2: 90 e0 ldi r25, 0x00 ; 0 9f4: 2b e0 ldi r18, 0x0B ; 11 9f6: 0f b6 in r0, 0x3f ; 63 9f8: f8 94 cli 9fa: a8 95 wdr 9fc: 81 bd out 0x21, r24 ; 33 9fe: 0f be out 0x3f, r0 ; 63 a00: 21 bd out 0x21, r18 ; 33 usbInit(); a02: 03 d1 rcall .+518 ; 0xc0a sei(); a04: 78 94 sei for(;;) { /* main event loop */ wdt_reset(); a06: a8 95 wdr usbPoll(); a08: 01 d0 rcall .+2 ; 0xa0c a0a: fd cf rjmp .-6 ; 0xa06 00000a0c : /* ------------------------------------------------------------------------- */ USB_PUBLIC void usbPoll(void) { a0c: 1f 93 push r17 a0e: cf 93 push r28 a10: df 93 push r29 schar len; uchar i; if((len = usbRxLen) > 0){ a12: 60 91 9a 00 lds r22, 0x009A a16: 16 16 cp r1, r22 a18: 0c f0 brlt .+2 ; 0xa1c a1a: 92 c0 rjmp .+292 ; 0xb40 a1c: 80 91 97 00 lds r24, 0x0097 a20: ca ea ldi r28, 0xAA ; 170 a22: d0 e0 ldi r29, 0x00 ; 0 a24: c8 1b sub r28, r24 a26: d1 09 sbc r29, r1 a28: 63 50 subi r22, 0x03 ; 3 a2a: 30 e0 ldi r19, 0x00 ; 0 a2c: 10 e8 ldi r17, 0x80 ; 128 a2e: 80 91 96 00 lds r24, 0x0096 a32: 8d 32 cpi r24, 0x2D ; 45 a34: 09 f0 breq .+2 ; 0xa38 a36: 6b c0 rjmp .+214 ; 0xb0e a38: 8a e5 ldi r24, 0x5A ; 90 a3a: 80 93 63 00 sts 0x0063, r24 a3e: 68 30 cpi r22, 0x08 ; 8 a40: 09 f0 breq .+2 ; 0xa44 a42: 78 c0 rjmp .+240 ; 0xb34 a44: 88 81 ld r24, Y a46: 80 76 andi r24, 0x60 ; 96 a48: 09 f0 breq .+2 ; 0xa4c a4a: 4e c0 rjmp .+156 ; 0xae8 a4c: 83 e9 ldi r24, 0x93 ; 147 a4e: 90 e0 ldi r25, 0x00 ; 0 a50: 30 93 93 00 sts 0x0093, r19 a54: 29 81 ldd r18, Y+1 ; 0x01 a56: 22 23 and r18, r18 a58: 21 f4 brne .+8 ; 0xa62 a5a: 30 93 94 00 sts 0x0094, r19 a5e: 32 e0 ldi r19, 0x02 ; 2 a60: 0f c0 rjmp .+30 ; 0xa80 a62: 25 30 cpi r18, 0x05 ; 5 a64: 21 f4 brne .+8 ; 0xa6e a66: 8a 81 ldd r24, Y+2 ; 0x02 a68: 80 93 9b 00 sts 0x009B, r24 a6c: 48 c0 rjmp .+144 ; 0xafe a6e: 26 30 cpi r18, 0x06 ; 6 a70: 61 f5 brne .+88 ; 0xaca a72: 10 ec ldi r17, 0xC0 ; 192 a74: 8b 81 ldd r24, Y+3 ; 0x03 a76: 81 30 cpi r24, 0x01 ; 1 a78: 41 f4 brne .+16 ; 0xa8a a7a: 80 e3 ldi r24, 0x30 ; 48 a7c: 90 e0 ldi r25, 0x00 ; 0 a7e: 32 e1 ldi r19, 0x12 ; 18 a80: 90 93 99 00 sts 0x0099, r25 a84: 80 93 98 00 sts 0x0098, r24 a88: 3a c0 rjmp .+116 ; 0xafe a8a: 82 30 cpi r24, 0x02 ; 2 a8c: 19 f4 brne .+6 ; 0xa94 a8e: 8e e1 ldi r24, 0x1E ; 30 a90: 90 e0 ldi r25, 0x00 ; 0 a92: f5 cf rjmp .-22 ; 0xa7e a94: 83 30 cpi r24, 0x03 ; 3 a96: 99 f5 brne .+102 ; 0xafe a98: 8a 81 ldd r24, Y+2 ; 0x02 a9a: 88 23 and r24, r24 a9c: 21 f4 brne .+8 ; 0xaa6 a9e: 82 e8 ldi r24, 0x82 ; 130 aa0: 90 e0 ldi r25, 0x00 ; 0 aa2: 34 e0 ldi r19, 0x04 ; 4 aa4: ed cf rjmp .-38 ; 0xa80 aa6: 81 30 cpi r24, 0x01 ; 1 aa8: 21 f4 brne .+8 ; 0xab2 aaa: 88 e6 ldi r24, 0x68 ; 104 aac: 90 e0 ldi r25, 0x00 ; 0 aae: 3a e1 ldi r19, 0x1A ; 26 ab0: e7 cf rjmp .-50 ; 0xa80 ab2: 82 30 cpi r24, 0x02 ; 2 ab4: 21 f4 brne .+8 ; 0xabe ab6: 82 e5 ldi r24, 0x52 ; 82 ab8: 90 e0 ldi r25, 0x00 ; 0 aba: 36 e1 ldi r19, 0x16 ; 22 abc: e1 cf rjmp .-62 ; 0xa80 abe: 83 30 cpi r24, 0x03 ; 3 ac0: f1 f4 brne .+60 ; 0xafe ac2: 82 e4 ldi r24, 0x42 ; 66 ac4: 90 e0 ldi r25, 0x00 ; 0 ac6: 30 e1 ldi r19, 0x10 ; 16 ac8: db cf rjmp .-74 ; 0xa80 aca: 28 30 cpi r18, 0x08 ; 8 acc: 19 f4 brne .+6 ; 0xad4 ace: 8d e9 ldi r24, 0x9D ; 157 ad0: 90 e0 ldi r25, 0x00 ; 0 ad2: 08 c0 rjmp .+16 ; 0xae4 ad4: 29 30 cpi r18, 0x09 ; 9 ad6: 21 f4 brne .+8 ; 0xae0 ad8: 8a 81 ldd r24, Y+2 ; 0x02 ada: 80 93 9d 00 sts 0x009D, r24 ade: 0f c0 rjmp .+30 ; 0xafe ae0: 2a 30 cpi r18, 0x0A ; 10 ae2: 69 f4 brne .+26 ; 0xafe ae4: 31 e0 ldi r19, 0x01 ; 1 ae6: cc cf rjmp .-104 ; 0xa80 ae8: 8c 2f mov r24, r28 aea: 9d 2f mov r25, r29 aec: d8 dd rcall .-1104 ; 0x69e aee: 38 2f mov r19, r24 af0: 8f 3f cpi r24, 0xFF ; 255 af2: 29 f4 brne .+10 ; 0xafe af4: 88 81 ld r24, Y af6: 87 ff sbrs r24, 7 af8: 1c c0 rjmp .+56 ; 0xb32 afa: 3e 81 ldd r19, Y+6 ; 0x06 afc: 1a c0 rjmp .+52 ; 0xb32 afe: 8f 81 ldd r24, Y+7 ; 0x07 b00: 88 23 and r24, r24 b02: c1 f4 brne .+48 ; 0xb34 b04: 8e 81 ldd r24, Y+6 ; 0x06 b06: 83 17 cp r24, r19 b08: a8 f4 brcc .+42 ; 0xb34 b0a: 38 2f mov r19, r24 b0c: 13 c0 rjmp .+38 ; 0xb34 b0e: 80 91 6d 00 lds r24, 0x006D b12: 87 fd sbrc r24, 7 b14: 0f c0 rjmp .+30 ; 0xb34 b16: 8c 2f mov r24, r28 b18: 9d 2f mov r25, r29 b1a: 78 dd rcall .-1296 ; 0x60c b1c: 3f ef ldi r19, 0xFF ; 255 b1e: 83 17 cp r24, r19 b20: 31 f4 brne .+12 ; 0xb2e b22: 30 93 64 00 sts 0x0064, r19 b26: 8e e1 ldi r24, 0x1E ; 30 b28: 80 93 63 00 sts 0x0063, r24 b2c: 02 c0 rjmp .+4 ; 0xb32 b2e: 81 11 cpse r24, r1 b30: 30 e0 ldi r19, 0x00 ; 0 b32: 10 e0 ldi r17, 0x00 ; 0 b34: 10 93 6d 00 sts 0x006D, r17 b38: 30 93 64 00 sts 0x0064, r19 /* We could check CRC16 here -- but ACK has already been sent anyway. If you * need data integrity checks with this driver, check the CRC in your app * code and report errors back to the host. Since the ACK was already sent, * retries must be handled on application level. * unsigned crc = usbCrc16(buffer + 1, usbRxLen - 3); */ usbProcessRx(usbRxBuf + USB_BUFSIZE + 1 - usbInputBufOffset, len - 3); #if USB_CFG_HAVE_FLOWCONTROL if(usbRxLen > 0) /* only mark as available if not inactivated */ usbRxLen = 0; #else usbRxLen = 0; /* mark rx buffer as available */ b3c: 10 92 9a 00 sts 0x009A, r1 #endif } if(usbTxLen & 0x10){ /* transmit system idle */ b40: 80 91 63 00 lds r24, 0x0063 b44: 84 ff sbrs r24, 4 b46: 44 c0 rjmp .+136 ; 0xbd0 if(usbMsgLen != 0xff){ /* transmit data pending? */ b48: 80 91 64 00 lds r24, 0x0064 b4c: 8f 3f cpi r24, 0xFF ; 255 b4e: 09 f4 brne .+2 ; 0xb52 b50: 3f c0 rjmp .+126 ; 0xbd0 b52: 68 2f mov r22, r24 b54: 89 30 cpi r24, 0x09 ; 9 b56: 08 f0 brcs .+2 ; 0xb5a b58: 68 e0 ldi r22, 0x08 ; 8 b5a: 86 1b sub r24, r22 b5c: 80 93 64 00 sts 0x0064, r24 b60: 1b e4 ldi r17, 0x4B ; 75 b62: 80 91 6d 00 lds r24, 0x006D b66: 80 fd sbrc r24, 0 b68: 13 ec ldi r17, 0xC3 ; 195 b6a: 8f 5f subi r24, 0xFF ; 255 b6c: 80 93 6d 00 sts 0x006D, r24 b70: ab e8 ldi r26, 0x8B ; 139 b72: b0 e0 ldi r27, 0x00 ; 0 b74: e0 91 98 00 lds r30, 0x0098 b78: f0 91 99 00 lds r31, 0x0099 b7c: 96 2f mov r25, r22 b7e: 91 50 subi r25, 0x01 ; 1 b80: 86 ff sbrs r24, 6 b82: 08 c0 rjmp .+16 ; 0xb94 b84: 9f 3f cpi r25, 0xFF ; 255 b86: 61 f0 breq .+24 ; 0xba0 b88: c8 95 lpm b8a: 80 2d mov r24, r0 b8c: 8d 93 st X+, r24 b8e: 31 96 adiw r30, 0x01 ; 1 b90: 91 50 subi r25, 0x01 ; 1 b92: f8 cf rjmp .-16 ; 0xb84 b94: 9f 3f cpi r25, 0xFF ; 255 b96: 21 f0 breq .+8 ; 0xba0 b98: 81 91 ld r24, Z+ b9a: 8d 93 st X+, r24 b9c: 91 50 subi r25, 0x01 ; 1 b9e: fa cf rjmp .-12 ; 0xb94 ba0: f0 93 99 00 sts 0x0099, r31 ba4: e0 93 98 00 sts 0x0098, r30 ba8: 77 27 eor r23, r23 baa: c6 2f mov r28, r22 bac: 69 30 cpi r22, 0x09 ; 9 bae: 40 f4 brcc .+16 ; 0xbc0 bb0: 8b e8 ldi r24, 0x8B ; 139 bb2: 90 e0 ldi r25, 0x00 ; 0 bb4: 46 d0 rcall .+140 ; 0xc42 bb6: 9c 2f mov r25, r28 bb8: 9c 5f subi r25, 0xFC ; 252 bba: c8 30 cpi r28, 0x08 ; 8 bbc: 28 f4 brcc .+10 ; 0xbc8 bbe: 01 c0 rjmp .+2 ; 0xbc2 bc0: 9e e1 ldi r25, 0x1E ; 30 bc2: 8f ef ldi r24, 0xFF ; 255 bc4: 80 93 64 00 sts 0x0064, r24 bc8: 10 93 8a 00 sts 0x008A, r17 bcc: 90 93 63 00 sts 0x0063, r25 usbBuildTxBlock(); } } for(i = 10; i > 0; i--){ bd0: 9a e0 ldi r25, 0x0A ; 10 bd2: 86 b3 in r24, 0x16 ; 22 bd4: 85 70 andi r24, 0x05 ; 5 bd6: 11 f4 brne .+4 ; 0xbdc bd8: 91 50 subi r25, 0x01 ; 1 bda: d9 f7 brne .-10 ; 0xbd2 if(isNotSE0()) break; } if(i == 0){ /* RESET condition, called multiple times during reset */ bdc: 99 23 and r25, r25 bde: 21 f4 brne .+8 ; 0xbe8 usbNewDeviceAddr = 0; be0: 90 93 9b 00 sts 0x009B, r25 usbDeviceAddr = 0; be4: 90 93 95 00 sts 0x0095, r25 be8: c0 e0 ldi r28, 0x00 ; 0 bea: 99 23 and r25, r25 bec: 09 f4 brne .+2 ; 0xbf0 bee: c1 e0 ldi r28, 0x01 ; 1 bf0: 80 91 6c 00 lds r24, 0x006C bf4: 8c 17 cp r24, r28 bf6: 29 f0 breq .+10 ; 0xc02 bf8: cc 23 and r28, r28 bfa: 09 f4 brne .+2 ; 0xbfe bfc: 5d de rcall .-838 ; 0x8b8 bfe: c0 93 6c 00 sts 0x006C, r28 c02: df 91 pop r29 c04: cf 91 pop r28 c06: 1f 91 pop r17 c08: 08 95 ret 00000c0a : usbResetStall(); DBG1(0xff, 0, 0); } usbHandleResetHook(i); } /* ------------------------------------------------------------------------- */ USB_PUBLIC void usbInit(void) { #if USB_INTR_CFG_SET != 0 USB_INTR_CFG |= USB_INTR_CFG_SET; c0a: 85 b7 in r24, 0x35 ; 53 c0c: 83 60 ori r24, 0x03 ; 3 c0e: 85 bf out 0x35, r24 ; 53 #endif #if USB_INTR_CFG_CLR != 0 USB_INTR_CFG &= ~(USB_INTR_CFG_CLR); #endif USB_INTR_ENABLE |= (1 << USB_INTR_ENABLE_BIT); c10: 8b b7 in r24, 0x3b ; 59 c12: 80 64 ori r24, 0x40 ; 64 c14: 8b bf out 0x3b, r24 ; 59 c16: 08 95 ret 00000c18 : c18: a8 2f mov r26, r24 c1a: b9 2f mov r27, r25 c1c: 80 e0 ldi r24, 0x00 ; 0 c1e: 90 e0 ldi r25, 0x00 ; 0 c20: 41 e0 ldi r20, 0x01 ; 1 c22: 50 ea ldi r21, 0xA0 ; 160 c24: 60 95 com r22 00000c26 : c26: 6f 5f subi r22, 0xFF ; 255 c28: 58 f4 brcc .+22 ; 0xc40 c2a: 2d 91 ld r18, X+ c2c: 38 ef ldi r19, 0xF8 ; 248 c2e: 82 27 eor r24, r18 00000c30 : c30: 97 95 ror r25 c32: 87 95 ror r24 c34: 10 f0 brcs .+4 ; 0xc3a c36: 84 27 eor r24, r20 c38: 95 27 eor r25, r21 00000c3a : c3a: 3f 5f subi r19, 0xFF ; 255 c3c: c8 f3 brcs .-14 ; 0xc30 c3e: f3 cf rjmp .-26 ; 0xc26 00000c40 : c40: 08 95 ret 00000c42 : c42: ea df rcall .-44 ; 0xc18 c44: 8d 93 st X+, r24 c46: 9d 93 st X+, r25 c48: 08 95 ret 00000c4a : c4a: a6 e0 ldi r26, 0x06 ; 6 c4c: 88 27 eor r24, r24 c4e: 99 27 eor r25, r25 00000c50 : c50: aa 95 dec r26 c52: 69 f0 breq .+26 ; 0xc6e 00000c54 : c54: 01 97 sbiw r24, 0x01 ; 1 c56: e1 f3 breq .-8 ; 0xc50 c58: b2 99 sbic 0x16, 2 ; 22 c5a: fc cf rjmp .-8 ; 0xc54 00000c5c : c5c: b2 9b sbis 0x16, 2 ; 22 c5e: fe cf rjmp .-4 ; 0xc5c c60: 81 e0 ldi r24, 0x01 ; 1 c62: 99 27 eor r25, r25 00000c64 : c64: a6 b3 in r26, 0x16 ; 22 c66: 01 96 adiw r24, 0x01 ; 1 c68: 11 f0 breq .+4 ; 0xc6e c6a: a5 70 andi r26, 0x05 ; 5 c6c: d9 f7 brne .-10 ; 0xc64 00000c6e : c6e: 08 95 ret 00000c70 <__vector_1>: c70: cf 93 push r28 c72: cf b7 in r28, 0x3f ; 63 c74: cf 93 push r28 00000c76 : c76: b2 9b sbis 0x16, 2 ; 22 c78: fe cf rjmp .-4 ; 0xc76 00000c7a : c7a: b2 9b sbis 0x16, 2 ; 22 c7c: 0b c0 rjmp .+22 ; 0xc94 c7e: b2 9b sbis 0x16, 2 ; 22 c80: 09 c0 rjmp .+18 ; 0xc94 c82: b2 9b sbis 0x16, 2 ; 22 c84: 07 c0 rjmp .+14 ; 0xc94 c86: b2 9b sbis 0x16, 2 ; 22 c88: 05 c0 rjmp .+10 ; 0xc94 c8a: b2 9b sbis 0x16, 2 ; 22 c8c: 03 c0 rjmp .+6 ; 0xc94 c8e: b2 9b sbis 0x16, 2 ; 22 c90: 01 c0 rjmp .+2 ; 0xc94 c92: d3 c0 rjmp .+422 ; 0xe3a 00000c94 : c94: 0f 92 push r0 c96: df 93 push r29 c98: c0 91 97 00 lds r28, 0x0097 c9c: dd 27 eor r29, r29 c9e: c2 56 subi r28, 0x62 ; 98 ca0: df 4f sbci r29, 0xFF ; 255 ca2: 01 2e mov r0, r17 ca4: b2 9b sbis 0x16, 2 ; 22 ca6: 03 c0 rjmp .+6 ; 0xcae ca8: df 91 pop r29 caa: 0f 90 pop r0 cac: e6 cf rjmp .-52 ; 0xc7a 00000cae : cae: 2f 93 push r18 cb0: 0f 93 push r16 cb2: 1f 93 push r17 cb4: 4f 93 push r20 cb6: 2f ef ldi r18, 0xFF ; 255 cb8: 4f 6f ori r20, 0xFF ; 255 cba: 06 b3 in r16, 0x16 ; 22 cbc: 02 fb bst r16, 2 cbe: 20 f9 bld r18, 0 cc0: 5f 93 push r21 cc2: 3f 93 push r19 cc4: 50 e0 ldi r21, 0x00 ; 0 cc6: 3b e0 ldi r19, 0x0B ; 11 cc8: 65 c0 rjmp .+202 ; 0xd94 00000cca : cca: 16 b3 in r17, 0x16 ; 22 ccc: 01 26 eor r0, r17 cce: 50 29 or r21, r0 cd0: 52 fd sbrc r21, 2 cd2: c8 95 lpm cd4: 56 b3 in r21, 0x16 ; 22 cd6: 01 27 eor r16, r17 cd8: 02 fb bst r16, 2 cda: 25 f9 bld r18, 5 cdc: 2f 73 andi r18, 0x3F ; 63 cde: 06 b3 in r16, 0x16 ; 22 ce0: b1 f0 breq .+44 ; 0xd0e ce2: 50 27 eor r21, r16 ce4: 10 27 eor r17, r16 ce6: 12 fb bst r17, 2 ce8: 26 f9 bld r18, 6 00000cea : cea: 06 b2 in r0, 0x16 ; 22 cec: 22 30 cpi r18, 0x02 ; 2 cee: f0 f0 brcs .+60 ; 0xd2c 00000cf0 : cf0: 00 c0 rjmp .+0 ; 0xcf2 cf2: 16 b3 in r17, 0x16 ; 22 cf4: 01 27 eor r16, r17 cf6: 02 fb bst r16, 2 cf8: 27 f9 bld r18, 7 00000cfa : cfa: 01 26 eor r0, r17 cfc: 50 29 or r21, r0 cfe: 06 b2 in r0, 0x16 ; 22 d00: 24 30 cpi r18, 0x04 ; 4 d02: e8 f5 brcc .+122 ; 0xd7e 00000d04 : d04: 4f 77 andi r20, 0x7F ; 127 d06: 20 68 ori r18, 0x80 ; 128 d08: 16 b3 in r17, 0x16 ; 22 d0a: 00 00 nop d0c: f6 cf rjmp .-20 ; 0xcfa 00000d0e : d0e: 50 27 eor r21, r16 d10: 4f 7d andi r20, 0xDF ; 223 d12: 20 62 ori r18, 0x20 ; 32 d14: 06 b2 in r0, 0x16 ; 22 d16: 10 2f mov r17, r16 d18: 00 00 nop d1a: 00 c0 rjmp .+0 ; 0xd1c d1c: 06 b3 in r16, 0x16 ; 22 d1e: 00 26 eor r0, r16 d20: 50 29 or r21, r0 d22: 10 27 eor r17, r16 d24: 12 fb bst r17, 2 d26: 26 f9 bld r18, 6 d28: 06 b2 in r0, 0x16 ; 22 d2a: e2 cf rjmp .-60 ; 0xcf0 00000d2c : d2c: 4f 7b andi r20, 0xBF ; 191 d2e: 06 b3 in r16, 0x16 ; 22 d30: 20 64 ori r18, 0x40 ; 64 d32: 00 c0 rjmp .+0 ; 0xd34 d34: da cf rjmp .-76 ; 0xcea 00000d36 : d36: 01 26 eor r0, r17 d38: 50 29 or r21, r0 d3a: 15 70 andi r17, 0x05 ; 5 d3c: 06 b2 in r0, 0x16 ; 22 d3e: 69 f1 breq .+90 ; 0xd9a d40: 4e 7f andi r20, 0xFE ; 254 d42: 21 60 ori r18, 0x01 ; 1 d44: 01 2f mov r16, r17 d46: 16 b3 in r17, 0x16 ; 22 d48: 28 c0 rjmp .+80 ; 0xd9a 00000d4a : d4a: 00 26 eor r0, r16 d4c: 50 29 or r21, r0 d4e: 4d 7f andi r20, 0xFD ; 253 d50: 06 b2 in r0, 0x16 ; 22 d52: 22 60 ori r18, 0x02 ; 2 d54: 10 2f mov r17, r16 d56: 29 c0 rjmp .+82 ; 0xdaa 00000d58 : d58: 01 26 eor r0, r17 d5a: 50 29 or r21, r0 d5c: 4b 7f andi r20, 0xFB ; 251 d5e: 06 b2 in r0, 0x16 ; 22 d60: 24 60 ori r18, 0x04 ; 4 d62: 01 2f mov r16, r17 d64: 2d c0 rjmp .+90 ; 0xdc0 00000d66 : d66: 16 b3 in r17, 0x16 ; 22 d68: 01 26 eor r0, r17 d6a: 50 29 or r21, r0 d6c: 47 7f andi r20, 0xF7 ; 247 d6e: 28 60 ori r18, 0x08 ; 8 d70: 00 00 nop d72: 06 b2 in r0, 0x16 ; 22 d74: 2e c0 rjmp .+92 ; 0xdd2 00000d76 : d76: 4f 7e andi r20, 0xEF ; 239 d78: 06 b3 in r16, 0x16 ; 22 d7a: 20 61 ori r18, 0x10 ; 16 d7c: 30 c0 rjmp .+96 ; 0xdde 00000d7e : d7e: 42 27 eor r20, r18 d80: 06 b3 in r16, 0x16 ; 22 d82: 49 93 st Y+, r20 d84: 00 26 eor r0, r16 d86: 50 29 or r21, r0 d88: 10 27 eor r17, r16 d8a: 06 b2 in r0, 0x16 ; 22 d8c: 4f ef ldi r20, 0xFF ; 255 d8e: 12 fb bst r17, 2 d90: 20 f9 bld r18, 0 d92: 29 7f andi r18, 0xF9 ; 249 00000d94 : d94: 16 b3 in r17, 0x16 ; 22 d96: 79 f2 breq .-98 ; 0xd36 d98: 15 70 andi r17, 0x05 ; 5 00000d9a : d9a: 59 f1 breq .+86 ; 0xdf2 d9c: 01 26 eor r0, r17 d9e: 50 29 or r21, r0 da0: 06 b2 in r0, 0x16 ; 22 da2: 01 27 eor r16, r17 da4: 02 fb bst r16, 2 da6: 21 f9 bld r18, 1 da8: 23 7f andi r18, 0xF3 ; 243 00000daa : daa: 06 b3 in r16, 0x16 ; 22 dac: 71 f2 breq .-100 ; 0xd4a dae: 00 26 eor r0, r16 db0: 50 29 or r21, r0 db2: 31 50 subi r19, 0x01 ; 1 db4: d0 f0 brcs .+52 ; 0xdea db6: 06 b2 in r0, 0x16 ; 22 db8: 10 27 eor r17, r16 dba: 12 fb bst r17, 2 dbc: 22 f9 bld r18, 2 dbe: 27 7e andi r18, 0xE7 ; 231 00000dc0 : dc0: 16 b3 in r17, 0x16 ; 22 dc2: 51 f2 breq .-108 ; 0xd58 dc4: 01 26 eor r0, r17 dc6: 50 29 or r21, r0 dc8: 01 27 eor r16, r17 dca: 02 fb bst r16, 2 dcc: 06 b2 in r0, 0x16 ; 22 dce: 23 f9 bld r18, 3 dd0: 2f 7c andi r18, 0xCF ; 207 00000dd2 : dd2: 49 f2 breq .-110 ; 0xd66 dd4: 00 00 nop dd6: 06 b3 in r16, 0x16 ; 22 dd8: 10 27 eor r17, r16 dda: 12 fb bst r17, 2 ddc: 24 f9 bld r18, 4 00000dde : dde: 00 26 eor r0, r16 de0: 50 29 or r21, r0 de2: 06 b2 in r0, 0x16 ; 22 de4: 2f 79 andi r18, 0x9F ; 159 de6: 39 f2 breq .-114 ; 0xd76 de8: 70 cf rjmp .-288 ; 0xcca 00000dea : dea: 10 e4 ldi r17, 0x40 ; 64 dec: 1a bf out 0x3a, r17 ; 58 00000dee : dee: 00 27 eor r16, r16 df0: 17 c0 rjmp .+46 ; 0xe20 00000df2 : df2: 3b 50 subi r19, 0x0B ; 11 df4: 31 95 neg r19 df6: c3 1b sub r28, r19 df8: d0 40 sbci r29, 0x00 ; 0 dfa: 10 e4 ldi r17, 0x40 ; 64 dfc: 1a bf out 0x3a, r17 ; 58 dfe: 08 81 ld r16, Y e00: 03 3c cpi r16, 0xC3 ; 195 e02: f9 f0 breq .+62 ; 0xe42 e04: 0b 34 cpi r16, 0x4B ; 75 e06: e9 f0 breq .+58 ; 0xe42 e08: 20 91 95 00 lds r18, 0x0095 e0c: 19 81 ldd r17, Y+1 ; 0x01 e0e: 11 0f add r17, r17 e10: 12 13 cpse r17, r18 e12: ed cf rjmp .-38 ; 0xdee e14: 09 36 cpi r16, 0x69 ; 105 e16: 51 f1 breq .+84 ; 0xe6c e18: 0d 32 cpi r16, 0x2D ; 45 e1a: 11 f0 breq .+4 ; 0xe20 e1c: 01 3e cpi r16, 0xE1 ; 225 e1e: 39 f7 brne .-50 ; 0xdee 00000e20 : e20: 00 93 9c 00 sts 0x009C, r16 00000e24 : e24: 3f 91 pop r19 e26: 5f 91 pop r21 e28: 4f 91 pop r20 e2a: 1f 91 pop r17 e2c: 0f 91 pop r16 e2e: 2f 91 pop r18 e30: df 91 pop r29 e32: 0f 90 pop r0 e34: ca b7 in r28, 0x3a ; 58 e36: c6 fd sbrc r28, 6 e38: 1e cf rjmp .-452 ; 0xc76 00000e3a : e3a: cf 91 pop r28 e3c: cf bf out 0x3f, r28 ; 63 e3e: cf 91 pop r28 e40: 18 95 reti 00000e42 : e42: 00 91 9c 00 lds r16, 0x009C e46: 00 23 and r16, r16 e48: 69 f3 breq .-38 ; 0xe24 e4a: 10 91 9a 00 lds r17, 0x009A e4e: 11 23 and r17, r17 e50: 21 f5 brne .+72 ; 0xe9a e52: 34 30 cpi r19, 0x04 ; 4 e54: 22 f1 brmi .+72 ; 0xe9e e56: 30 93 9a 00 sts 0x009A, r19 e5a: 00 93 96 00 sts 0x0096, r16 e5e: 10 91 97 00 lds r17, 0x0097 e62: 3b e0 ldi r19, 0x0B ; 11 e64: 31 1b sub r19, r17 e66: 30 93 97 00 sts 0x0097, r19 e6a: 19 c0 rjmp .+50 ; 0xe9e 00000e6c : e6c: 00 91 9a 00 lds r16, 0x009A e70: 01 30 cpi r16, 0x01 ; 1 e72: 9c f4 brge .+38 ; 0xe9a e74: 0a e5 ldi r16, 0x5A ; 90 e76: 30 91 63 00 lds r19, 0x0063 e7a: 34 fd sbrc r19, 4 e7c: 11 c0 rjmp .+34 ; 0xea0 e7e: 00 93 63 00 sts 0x0063, r16 e82: ca e8 ldi r28, 0x8A ; 138 e84: d0 e0 ldi r29, 0x00 ; 0 e86: 10 c0 rjmp .+32 ; 0xea8 00000e88 : e88: 05 27 eor r16, r21 e8a: 10 e0 ldi r17, 0x00 ; 0 e8c: 00 c0 rjmp .+0 ; 0xe8e e8e: 21 c0 rjmp .+66 ; 0xed2 00000e90 : e90: 05 27 eor r16, r21 e92: 10 e0 ldi r17, 0x00 ; 0 e94: c8 95 lpm e96: 08 bb out 0x18, r16 ; 24 e98: 14 c0 rjmp .+40 ; 0xec2 00000e9a : e9a: 3a e5 ldi r19, 0x5A ; 90 e9c: 01 c0 rjmp .+2 ; 0xea0 00000e9e : e9e: 32 ed ldi r19, 0xD2 ; 210 00000ea0 : ea0: 03 2e mov r0, r19 ea2: c0 e0 ldi r28, 0x00 ; 0 ea4: d0 e0 ldi r29, 0x00 ; 0 ea6: 32 e0 ldi r19, 0x02 ; 2 00000ea8 : ea8: 17 b3 in r17, 0x17 ; 23 eaa: 15 60 ori r17, 0x05 ; 5 eac: c2 9a sbi 0x18, 2 ; 24 eae: 08 b3 in r16, 0x18 ; 24 eb0: 17 bb out 0x17, r17 ; 23 eb2: 55 e0 ldi r21, 0x05 ; 5 eb4: 20 e8 ldi r18, 0x80 ; 128 eb6: 4f ef ldi r20, 0xFF ; 255 00000eb8 : eb8: 20 ff sbrs r18, 0 eba: 05 27 eor r16, r21 ebc: 08 bb out 0x18, r16 ; 24 ebe: 27 95 ror r18 ec0: 17 95 ror r17 00000ec2 : ec2: 1c 3f cpi r17, 0xFC ; 252 ec4: 28 f7 brcc .-54 ; 0xe90 ec6: 00 00 nop ec8: 45 52 subi r20, 0x25 ; 37 eca: b0 f7 brcc .-20 ; 0xeb8 ecc: 20 ff sbrs r18, 0 ece: 05 27 eor r16, r21 ed0: 27 95 ror r18 00000ed2 : ed2: 08 bb out 0x18, r16 ; 24 ed4: 17 95 ror r17 ed6: 1c 3f cpi r17, 0xFC ; 252 ed8: b8 f6 brcc .-82 ; 0xe88 eda: 29 91 ld r18, Y+ edc: 3a 95 dec r19 ede: 61 f7 brne .-40 ; 0xeb8 ee0: 0a 7f andi r16, 0xFA ; 250 ee2: 10 91 9b 00 lds r17, 0x009B ee6: 11 0f add r17, r17 ee8: 08 bb out 0x18, r16 ; 24 eea: c2 50 subi r28, 0x02 ; 2 eec: d0 40 sbci r29, 0x00 ; 0 eee: 11 f0 breq .+4 ; 0xef4 ef0: 10 93 95 00 sts 0x0095, r17 00000ef4 : ef4: 10 e4 ldi r17, 0x40 ; 64 ef6: 1a bf out 0x3a, r17 ; 58 ef8: 04 60 ori r16, 0x04 ; 4 efa: 17 b3 in r17, 0x17 ; 23 efc: 1a 7f andi r17, 0xFA ; 250 efe: 40 2f mov r20, r16 f00: 4a 7f andi r20, 0xFA ; 250 f02: 54 e0 ldi r21, 0x04 ; 4 00000f04 : f04: 5a 95 dec r21 f06: f1 f7 brne .-4 ; 0xf04 f08: 08 bb out 0x18, r16 ; 24 f0a: 17 bb out 0x17, r17 ; 23 f0c: 48 bb out 0x18, r20 ; 24 f0e: 8a cf rjmp .-236 ; 0xe24 00000f10 <__mulsi3>: f10: ff 27 eor r31, r31 f12: ee 27 eor r30, r30 f14: bb 27 eor r27, r27 f16: aa 27 eor r26, r26 00000f18 <__mulsi3_loop>: f18: 60 ff sbrs r22, 0 f1a: 04 c0 rjmp .+8 ; 0xf24 <__mulsi3_skip1> f1c: a2 0f add r26, r18 f1e: b3 1f adc r27, r19 f20: e4 1f adc r30, r20 f22: f5 1f adc r31, r21 00000f24 <__mulsi3_skip1>: f24: 22 0f add r18, r18 f26: 33 1f adc r19, r19 f28: 44 1f adc r20, r20 f2a: 55 1f adc r21, r21 f2c: 96 95 lsr r25 f2e: 87 95 ror r24 f30: 77 95 ror r23 f32: 67 95 ror r22 f34: 89 f7 brne .-30 ; 0xf18 <__mulsi3_loop> f36: 00 97 sbiw r24, 0x00 ; 0 f38: 76 07 cpc r23, r22 f3a: 71 f7 brne .-36 ; 0xf18 <__mulsi3_loop> 00000f3c <__mulsi3_exit>: f3c: 9f 2f mov r25, r31 f3e: 8e 2f mov r24, r30 f40: 7b 2f mov r23, r27 f42: 6a 2f mov r22, r26 f44: 08 95 ret 00000f46 <__udivmodhi4>: f46: aa 1b sub r26, r26 f48: bb 1b sub r27, r27 f4a: 51 e1 ldi r21, 0x11 ; 17 f4c: 07 c0 rjmp .+14 ; 0xf5c <__udivmodhi4_ep> 00000f4e <__udivmodhi4_loop>: f4e: aa 1f adc r26, r26 f50: bb 1f adc r27, r27 f52: a6 17 cp r26, r22 f54: b7 07 cpc r27, r23 f56: 10 f0 brcs .+4 ; 0xf5c <__udivmodhi4_ep> f58: a6 1b sub r26, r22 f5a: b7 0b sbc r27, r23 00000f5c <__udivmodhi4_ep>: f5c: 88 1f adc r24, r24 f5e: 99 1f adc r25, r25 f60: 5a 95 dec r21 f62: a9 f7 brne .-22 ; 0xf4e <__udivmodhi4_loop> f64: 80 95 com r24 f66: 90 95 com r25 f68: 68 2f mov r22, r24 f6a: 79 2f mov r23, r25 f6c: 8a 2f mov r24, r26 f6e: 9b 2f mov r25, r27 f70: 08 95 ret 00000f72 <__udivmodsi4>: f72: a1 e2 ldi r26, 0x21 ; 33 f74: 1a 2e mov r1, r26 f76: aa 1b sub r26, r26 f78: bb 1b sub r27, r27 f7a: ea 2f mov r30, r26 f7c: fb 2f mov r31, r27 f7e: 0d c0 rjmp .+26 ; 0xf9a <__udivmodsi4_ep> 00000f80 <__udivmodsi4_loop>: f80: aa 1f adc r26, r26 f82: bb 1f adc r27, r27 f84: ee 1f adc r30, r30 f86: ff 1f adc r31, r31 f88: a2 17 cp r26, r18 f8a: b3 07 cpc r27, r19 f8c: e4 07 cpc r30, r20 f8e: f5 07 cpc r31, r21 f90: 20 f0 brcs .+8 ; 0xf9a <__udivmodsi4_ep> f92: a2 1b sub r26, r18 f94: b3 0b sbc r27, r19 f96: e4 0b sbc r30, r20 f98: f5 0b sbc r31, r21 00000f9a <__udivmodsi4_ep>: f9a: 66 1f adc r22, r22 f9c: 77 1f adc r23, r23 f9e: 88 1f adc r24, r24 fa0: 99 1f adc r25, r25 fa2: 1a 94 dec r1 fa4: 69 f7 brne .-38 ; 0xf80 <__udivmodsi4_loop> fa6: 60 95 com r22 fa8: 70 95 com r23 faa: 80 95 com r24 fac: 90 95 com r25 fae: 26 2f mov r18, r22 fb0: 37 2f mov r19, r23 fb2: 48 2f mov r20, r24 fb4: 59 2f mov r21, r25 fb6: 6a 2f mov r22, r26 fb8: 7b 2f mov r23, r27 fba: 8e 2f mov r24, r30 fbc: 9f 2f mov r25, r31 fbe: 08 95 ret 00000fc0 <__eeprom_read_byte_1C1D1E>: fc0: e1 99 sbic 0x1c, 1 ; 28 fc2: fe cf rjmp .-4 ; 0xfc0 <__eeprom_read_byte_1C1D1E> fc4: bf bb out 0x1f, r27 ; 31 fc6: ae bb out 0x1e, r26 ; 30 fc8: e0 9a sbi 0x1c, 0 ; 28 fca: 11 96 adiw r26, 0x01 ; 1 fcc: 0d b2 in r0, 0x1d ; 29 fce: 08 95 ret 00000fd0 <__eeprom_write_byte_1C1D1E>: fd0: e1 99 sbic 0x1c, 1 ; 28 fd2: fe cf rjmp .-4 ; 0xfd0 <__eeprom_write_byte_1C1D1E> fd4: bf bb out 0x1f, r27 ; 31 fd6: ae bb out 0x1e, r26 ; 30 fd8: 0d ba out 0x1d, r0 ; 29 fda: 11 96 adiw r26, 0x01 ; 1 fdc: 0f b6 in r0, 0x3f ; 63 fde: f8 94 cli fe0: e2 9a sbi 0x1c, 2 ; 28 fe2: e1 9a sbi 0x1c, 1 ; 28 fe4: 0f be out 0x3f, r0 ; 63 fe6: 08 95 ret