mirror of
https://github.com/RfidResearchGroup/ChameleonMini.git
synced 2026-05-12 11:20:37 -07:00
16052 lines
599 KiB
Plaintext
16052 lines
599 KiB
Plaintext
|
|
Chameleon-Mini.elf: file format elf32-avr
|
|
|
|
Sections:
|
|
Idx Name Size VMA LMA File off Algn
|
|
0 .text 00004ef0 00000000 00000000 000000b4 2**1
|
|
CONTENTS, ALLOC, LOAD, READONLY, CODE
|
|
1 .data 00000092 00802000 00004ef0 00004fa4 2**0
|
|
CONTENTS, ALLOC, LOAD, DATA
|
|
2 .bss 0000060b 00802092 00802092 00005036 2**0
|
|
ALLOC
|
|
3 .eeprom 00000013 00810000 00810000 00005036 2**0
|
|
CONTENTS, ALLOC, LOAD, DATA
|
|
4 .stab 000014d0 00000000 00000000 0000504c 2**2
|
|
CONTENTS, READONLY, DEBUGGING
|
|
5 .stabstr 0000070f 00000000 00000000 0000651c 2**0
|
|
CONTENTS, READONLY, DEBUGGING
|
|
6 .comment 0000002f 00000000 00000000 00006c2b 2**0
|
|
CONTENTS, READONLY
|
|
7 .debug_aranges 00000be0 00000000 00000000 00006c5a 2**0
|
|
CONTENTS, READONLY, DEBUGGING
|
|
8 .debug_info 00019186 00000000 00000000 0000783a 2**0
|
|
CONTENTS, READONLY, DEBUGGING
|
|
9 .debug_abbrev 0000597c 00000000 00000000 000209c0 2**0
|
|
CONTENTS, READONLY, DEBUGGING
|
|
10 .debug_line 0000b338 00000000 00000000 0002633c 2**0
|
|
CONTENTS, READONLY, DEBUGGING
|
|
11 .debug_frame 00001e88 00000000 00000000 00031674 2**2
|
|
CONTENTS, READONLY, DEBUGGING
|
|
12 .debug_str 000077fe 00000000 00000000 000334fc 2**0
|
|
CONTENTS, READONLY, DEBUGGING
|
|
13 .debug_loc 0000ce27 00000000 00000000 0003acfa 2**0
|
|
CONTENTS, READONLY, DEBUGGING
|
|
14 .debug_ranges 00001a08 00000000 00000000 00047b21 2**0
|
|
CONTENTS, READONLY, DEBUGGING
|
|
|
|
Disassembly of section .text:
|
|
|
|
00000000 <__vectors>:
|
|
0: 33 c3 rjmp .+1638 ; 0x668 <__ctors_end>
|
|
2: 00 00 nop
|
|
4: 4d c3 rjmp .+1690 ; 0x6a0 <__bad_interrupt>
|
|
6: 00 00 nop
|
|
8: 4b c3 rjmp .+1686 ; 0x6a0 <__bad_interrupt>
|
|
a: 00 00 nop
|
|
c: 49 c3 rjmp .+1682 ; 0x6a0 <__bad_interrupt>
|
|
e: 00 00 nop
|
|
10: 47 c3 rjmp .+1678 ; 0x6a0 <__bad_interrupt>
|
|
12: 00 00 nop
|
|
14: 45 c3 rjmp .+1674 ; 0x6a0 <__bad_interrupt>
|
|
16: 00 00 nop
|
|
18: 43 c3 rjmp .+1670 ; 0x6a0 <__bad_interrupt>
|
|
1a: 00 00 nop
|
|
1c: 41 c3 rjmp .+1666 ; 0x6a0 <__bad_interrupt>
|
|
1e: 00 00 nop
|
|
20: 3f c3 rjmp .+1662 ; 0x6a0 <__bad_interrupt>
|
|
22: 00 00 nop
|
|
24: 3d c3 rjmp .+1658 ; 0x6a0 <__bad_interrupt>
|
|
26: 00 00 nop
|
|
28: 3b c3 rjmp .+1654 ; 0x6a0 <__bad_interrupt>
|
|
2a: 00 00 nop
|
|
2c: 39 c3 rjmp .+1650 ; 0x6a0 <__bad_interrupt>
|
|
2e: 00 00 nop
|
|
30: 37 c3 rjmp .+1646 ; 0x6a0 <__bad_interrupt>
|
|
32: 00 00 nop
|
|
34: 35 c3 rjmp .+1642 ; 0x6a0 <__bad_interrupt>
|
|
36: 00 00 nop
|
|
38: 33 c3 rjmp .+1638 ; 0x6a0 <__bad_interrupt>
|
|
3a: 00 00 nop
|
|
3c: 31 c3 rjmp .+1634 ; 0x6a0 <__bad_interrupt>
|
|
3e: 00 00 nop
|
|
40: 2f c3 rjmp .+1630 ; 0x6a0 <__bad_interrupt>
|
|
42: 00 00 nop
|
|
44: 2d c3 rjmp .+1626 ; 0x6a0 <__bad_interrupt>
|
|
46: 00 00 nop
|
|
48: 2b c3 rjmp .+1622 ; 0x6a0 <__bad_interrupt>
|
|
4a: 00 00 nop
|
|
4c: 29 c3 rjmp .+1618 ; 0x6a0 <__bad_interrupt>
|
|
4e: 00 00 nop
|
|
50: 27 c3 rjmp .+1614 ; 0x6a0 <__bad_interrupt>
|
|
52: 00 00 nop
|
|
54: 25 c3 rjmp .+1610 ; 0x6a0 <__bad_interrupt>
|
|
56: 00 00 nop
|
|
58: 0c 94 b7 10 jmp 0x216e ; 0x216e <__vector_22>
|
|
5c: 21 c3 rjmp .+1602 ; 0x6a0 <__bad_interrupt>
|
|
5e: 00 00 nop
|
|
60: 1f c3 rjmp .+1598 ; 0x6a0 <__bad_interrupt>
|
|
62: 00 00 nop
|
|
64: 1d c3 rjmp .+1594 ; 0x6a0 <__bad_interrupt>
|
|
66: 00 00 nop
|
|
68: 1b c3 rjmp .+1590 ; 0x6a0 <__bad_interrupt>
|
|
6a: 00 00 nop
|
|
6c: 19 c3 rjmp .+1586 ; 0x6a0 <__bad_interrupt>
|
|
6e: 00 00 nop
|
|
70: 17 c3 rjmp .+1582 ; 0x6a0 <__bad_interrupt>
|
|
72: 00 00 nop
|
|
74: 15 c3 rjmp .+1578 ; 0x6a0 <__bad_interrupt>
|
|
76: 00 00 nop
|
|
78: 13 c3 rjmp .+1574 ; 0x6a0 <__bad_interrupt>
|
|
7a: 00 00 nop
|
|
7c: 11 c3 rjmp .+1570 ; 0x6a0 <__bad_interrupt>
|
|
7e: 00 00 nop
|
|
80: 0f c3 rjmp .+1566 ; 0x6a0 <__bad_interrupt>
|
|
82: 00 00 nop
|
|
84: 0d c3 rjmp .+1562 ; 0x6a0 <__bad_interrupt>
|
|
86: 00 00 nop
|
|
88: 0c 94 73 10 jmp 0x20e6 ; 0x20e6 <__vector_34>
|
|
8c: 09 c3 rjmp .+1554 ; 0x6a0 <__bad_interrupt>
|
|
8e: 00 00 nop
|
|
90: 07 c3 rjmp .+1550 ; 0x6a0 <__bad_interrupt>
|
|
92: 00 00 nop
|
|
94: 05 c3 rjmp .+1546 ; 0x6a0 <__bad_interrupt>
|
|
96: 00 00 nop
|
|
98: 03 c3 rjmp .+1542 ; 0x6a0 <__bad_interrupt>
|
|
9a: 00 00 nop
|
|
9c: 01 c3 rjmp .+1538 ; 0x6a0 <__bad_interrupt>
|
|
9e: 00 00 nop
|
|
a0: ff c2 rjmp .+1534 ; 0x6a0 <__bad_interrupt>
|
|
a2: 00 00 nop
|
|
a4: fd c2 rjmp .+1530 ; 0x6a0 <__bad_interrupt>
|
|
a6: 00 00 nop
|
|
a8: fb c2 rjmp .+1526 ; 0x6a0 <__bad_interrupt>
|
|
aa: 00 00 nop
|
|
ac: f9 c2 rjmp .+1522 ; 0x6a0 <__bad_interrupt>
|
|
ae: 00 00 nop
|
|
b0: f7 c2 rjmp .+1518 ; 0x6a0 <__bad_interrupt>
|
|
b2: 00 00 nop
|
|
b4: f5 c2 rjmp .+1514 ; 0x6a0 <__bad_interrupt>
|
|
b6: 00 00 nop
|
|
b8: f3 c2 rjmp .+1510 ; 0x6a0 <__bad_interrupt>
|
|
ba: 00 00 nop
|
|
bc: f1 c2 rjmp .+1506 ; 0x6a0 <__bad_interrupt>
|
|
be: 00 00 nop
|
|
c0: ef c2 rjmp .+1502 ; 0x6a0 <__bad_interrupt>
|
|
c2: 00 00 nop
|
|
c4: ed c2 rjmp .+1498 ; 0x6a0 <__bad_interrupt>
|
|
c6: 00 00 nop
|
|
c8: eb c2 rjmp .+1494 ; 0x6a0 <__bad_interrupt>
|
|
ca: 00 00 nop
|
|
cc: e9 c2 rjmp .+1490 ; 0x6a0 <__bad_interrupt>
|
|
ce: 00 00 nop
|
|
d0: e7 c2 rjmp .+1486 ; 0x6a0 <__bad_interrupt>
|
|
d2: 00 00 nop
|
|
d4: e5 c2 rjmp .+1482 ; 0x6a0 <__bad_interrupt>
|
|
d6: 00 00 nop
|
|
d8: e3 c2 rjmp .+1478 ; 0x6a0 <__bad_interrupt>
|
|
da: 00 00 nop
|
|
dc: e1 c2 rjmp .+1474 ; 0x6a0 <__bad_interrupt>
|
|
de: 00 00 nop
|
|
e0: df c2 rjmp .+1470 ; 0x6a0 <__bad_interrupt>
|
|
e2: 00 00 nop
|
|
e4: dd c2 rjmp .+1466 ; 0x6a0 <__bad_interrupt>
|
|
e6: 00 00 nop
|
|
e8: db c2 rjmp .+1462 ; 0x6a0 <__bad_interrupt>
|
|
ea: 00 00 nop
|
|
ec: d9 c2 rjmp .+1458 ; 0x6a0 <__bad_interrupt>
|
|
ee: 00 00 nop
|
|
f0: d7 c2 rjmp .+1454 ; 0x6a0 <__bad_interrupt>
|
|
f2: 00 00 nop
|
|
f4: d5 c2 rjmp .+1450 ; 0x6a0 <__bad_interrupt>
|
|
f6: 00 00 nop
|
|
f8: d3 c2 rjmp .+1446 ; 0x6a0 <__bad_interrupt>
|
|
fa: 00 00 nop
|
|
fc: d1 c2 rjmp .+1442 ; 0x6a0 <__bad_interrupt>
|
|
fe: 00 00 nop
|
|
100: cf c2 rjmp .+1438 ; 0x6a0 <__bad_interrupt>
|
|
102: 00 00 nop
|
|
104: cd c2 rjmp .+1434 ; 0x6a0 <__bad_interrupt>
|
|
106: 00 00 nop
|
|
108: cb c2 rjmp .+1430 ; 0x6a0 <__bad_interrupt>
|
|
10a: 00 00 nop
|
|
10c: c9 c2 rjmp .+1426 ; 0x6a0 <__bad_interrupt>
|
|
10e: 00 00 nop
|
|
110: c7 c2 rjmp .+1422 ; 0x6a0 <__bad_interrupt>
|
|
112: 00 00 nop
|
|
114: c5 c2 rjmp .+1418 ; 0x6a0 <__bad_interrupt>
|
|
116: 00 00 nop
|
|
118: c3 c2 rjmp .+1414 ; 0x6a0 <__bad_interrupt>
|
|
11a: 00 00 nop
|
|
11c: c1 c2 rjmp .+1410 ; 0x6a0 <__bad_interrupt>
|
|
11e: 00 00 nop
|
|
120: bf c2 rjmp .+1406 ; 0x6a0 <__bad_interrupt>
|
|
122: 00 00 nop
|
|
124: bd c2 rjmp .+1402 ; 0x6a0 <__bad_interrupt>
|
|
126: 00 00 nop
|
|
128: bb c2 rjmp .+1398 ; 0x6a0 <__bad_interrupt>
|
|
12a: 00 00 nop
|
|
12c: b9 c2 rjmp .+1394 ; 0x6a0 <__bad_interrupt>
|
|
12e: 00 00 nop
|
|
130: b7 c2 rjmp .+1390 ; 0x6a0 <__bad_interrupt>
|
|
132: 00 00 nop
|
|
134: b5 c2 rjmp .+1386 ; 0x6a0 <__bad_interrupt>
|
|
136: 00 00 nop
|
|
138: b3 c2 rjmp .+1382 ; 0x6a0 <__bad_interrupt>
|
|
13a: 00 00 nop
|
|
13c: b1 c2 rjmp .+1378 ; 0x6a0 <__bad_interrupt>
|
|
13e: 00 00 nop
|
|
140: af c2 rjmp .+1374 ; 0x6a0 <__bad_interrupt>
|
|
142: 00 00 nop
|
|
144: ad c2 rjmp .+1370 ; 0x6a0 <__bad_interrupt>
|
|
146: 00 00 nop
|
|
148: ab c2 rjmp .+1366 ; 0x6a0 <__bad_interrupt>
|
|
14a: 00 00 nop
|
|
14c: 0c 94 5b 11 jmp 0x22b6 ; 0x22b6 <__vector_83>
|
|
150: a7 c2 rjmp .+1358 ; 0x6a0 <__bad_interrupt>
|
|
152: 00 00 nop
|
|
154: a5 c2 rjmp .+1354 ; 0x6a0 <__bad_interrupt>
|
|
156: 00 00 nop
|
|
158: a3 c2 rjmp .+1350 ; 0x6a0 <__bad_interrupt>
|
|
15a: 00 00 nop
|
|
15c: a1 c2 rjmp .+1346 ; 0x6a0 <__bad_interrupt>
|
|
15e: 00 00 nop
|
|
160: 9f c2 rjmp .+1342 ; 0x6a0 <__bad_interrupt>
|
|
162: 00 00 nop
|
|
164: 9d c2 rjmp .+1338 ; 0x6a0 <__bad_interrupt>
|
|
166: 00 00 nop
|
|
168: 9b c2 rjmp .+1334 ; 0x6a0 <__bad_interrupt>
|
|
16a: 00 00 nop
|
|
16c: 99 c2 rjmp .+1330 ; 0x6a0 <__bad_interrupt>
|
|
16e: 00 00 nop
|
|
170: 97 c2 rjmp .+1326 ; 0x6a0 <__bad_interrupt>
|
|
172: 00 00 nop
|
|
174: 95 c2 rjmp .+1322 ; 0x6a0 <__bad_interrupt>
|
|
176: 00 00 nop
|
|
178: 93 c2 rjmp .+1318 ; 0x6a0 <__bad_interrupt>
|
|
17a: 00 00 nop
|
|
17c: 91 c2 rjmp .+1314 ; 0x6a0 <__bad_interrupt>
|
|
17e: 00 00 nop
|
|
180: 8f c2 rjmp .+1310 ; 0x6a0 <__bad_interrupt>
|
|
182: 00 00 nop
|
|
184: 8d c2 rjmp .+1306 ; 0x6a0 <__bad_interrupt>
|
|
186: 00 00 nop
|
|
188: 8b c2 rjmp .+1302 ; 0x6a0 <__bad_interrupt>
|
|
18a: 00 00 nop
|
|
18c: 89 c2 rjmp .+1298 ; 0x6a0 <__bad_interrupt>
|
|
18e: 00 00 nop
|
|
190: 87 c2 rjmp .+1294 ; 0x6a0 <__bad_interrupt>
|
|
192: 00 00 nop
|
|
194: 85 c2 rjmp .+1290 ; 0x6a0 <__bad_interrupt>
|
|
196: 00 00 nop
|
|
198: 83 c2 rjmp .+1286 ; 0x6a0 <__bad_interrupt>
|
|
19a: 00 00 nop
|
|
19c: 81 c2 rjmp .+1282 ; 0x6a0 <__bad_interrupt>
|
|
19e: 00 00 nop
|
|
1a0: 7f c2 rjmp .+1278 ; 0x6a0 <__bad_interrupt>
|
|
1a2: 00 00 nop
|
|
1a4: 7d c2 rjmp .+1274 ; 0x6a0 <__bad_interrupt>
|
|
1a6: 00 00 nop
|
|
1a8: 7b c2 rjmp .+1270 ; 0x6a0 <__bad_interrupt>
|
|
1aa: 00 00 nop
|
|
1ac: 79 c2 rjmp .+1266 ; 0x6a0 <__bad_interrupt>
|
|
1ae: 00 00 nop
|
|
1b0: 77 c2 rjmp .+1262 ; 0x6a0 <__bad_interrupt>
|
|
1b2: 00 00 nop
|
|
1b4: 75 c2 rjmp .+1258 ; 0x6a0 <__bad_interrupt>
|
|
1b6: 00 00 nop
|
|
1b8: 73 c2 rjmp .+1254 ; 0x6a0 <__bad_interrupt>
|
|
1ba: 00 00 nop
|
|
1bc: 71 c2 rjmp .+1250 ; 0x6a0 <__bad_interrupt>
|
|
1be: 00 00 nop
|
|
1c0: 6f c2 rjmp .+1246 ; 0x6a0 <__bad_interrupt>
|
|
1c2: 00 00 nop
|
|
1c4: 6d c2 rjmp .+1242 ; 0x6a0 <__bad_interrupt>
|
|
1c6: 00 00 nop
|
|
1c8: 6b c2 rjmp .+1238 ; 0x6a0 <__bad_interrupt>
|
|
1ca: 00 00 nop
|
|
1cc: 69 c2 rjmp .+1234 ; 0x6a0 <__bad_interrupt>
|
|
1ce: 00 00 nop
|
|
1d0: 67 c2 rjmp .+1230 ; 0x6a0 <__bad_interrupt>
|
|
1d2: 00 00 nop
|
|
1d4: 65 c2 rjmp .+1226 ; 0x6a0 <__bad_interrupt>
|
|
1d6: 00 00 nop
|
|
1d8: 63 c2 rjmp .+1222 ; 0x6a0 <__bad_interrupt>
|
|
1da: 00 00 nop
|
|
1dc: 61 c2 rjmp .+1218 ; 0x6a0 <__bad_interrupt>
|
|
1de: 00 00 nop
|
|
1e0: 5f c2 rjmp .+1214 ; 0x6a0 <__bad_interrupt>
|
|
1e2: 00 00 nop
|
|
1e4: 5d c2 rjmp .+1210 ; 0x6a0 <__bad_interrupt>
|
|
1e6: 00 00 nop
|
|
1e8: 5b c2 rjmp .+1206 ; 0x6a0 <__bad_interrupt>
|
|
1ea: 00 00 nop
|
|
1ec: 59 c2 rjmp .+1202 ; 0x6a0 <__bad_interrupt>
|
|
1ee: 00 00 nop
|
|
1f0: 57 c2 rjmp .+1198 ; 0x6a0 <__bad_interrupt>
|
|
1f2: 00 00 nop
|
|
1f4: 0c 94 1b 21 jmp 0x4236 ; 0x4236 <__vector_125>
|
|
1f8: 53 c2 rjmp .+1190 ; 0x6a0 <__bad_interrupt>
|
|
1fa: 00 00 nop
|
|
|
|
000001fc <ProductString>:
|
|
1fc: 1c 03 4c 00 55 00 46 00 41 00 20 00 43 00 44 00 ..L.U.F.A. .C.D.
|
|
20c: 43 00 20 00 44 00 65 00 6d 00 6f 00 00 00 C. .D.e.m.o...
|
|
|
|
0000021a <ManufacturerString>:
|
|
21a: 18 03 44 00 65 00 61 00 6e 00 20 00 43 00 61 00 ..D.e.a.n. .C.a.
|
|
22a: 6d 00 65 00 72 00 61 00 00 00 m.e.r.a...
|
|
|
|
00000234 <LanguageString>:
|
|
234: 04 03 09 04 ....
|
|
|
|
00000238 <ConfigurationDescriptor>:
|
|
238: 09 02 3e 00 02 01 00 c0 32 09 04 00 00 01 02 02 ..>.....2.......
|
|
248: 01 00 05 24 00 10 01 04 24 02 06 05 24 06 00 01 ...$....$...$...
|
|
258: 07 05 82 03 08 00 ff 09 04 01 00 02 0a 00 00 00 ................
|
|
268: 07 05 04 02 10 00 05 07 05 83 02 10 00 05 ..............
|
|
|
|
00000276 <DeviceDescriptor>:
|
|
276: 12 01 10 01 02 00 00 08 eb 03 44 20 01 00 01 02 ..........D ....
|
|
286: dc 01 ..
|
|
|
|
00000288 <ConfigurationTable>:
|
|
288: 00 4e 4f 4e 45 00 00 00 00 00 00 00 00 00 00 00 .NONE...........
|
|
298: 00 40 04 41 04 42 04 43 04 44 04 45 04 48 04 49 .@.A.B.C.D.E.H.I
|
|
2a8: 04 00 00 00 01 01 4d 46 5f 43 4c 41 53 53 49 43 ......MF_CLASSIC
|
|
2b8: 5f 31 4b 00 00 00 4c 12 83 12 01 13 1b 13 1f 13 _1K...L.........
|
|
2c8: 20 13 9d 17 a3 17 00 04 04 00 02 4d 46 5f 43 4c ..........MF_CL
|
|
2d8: 41 53 53 49 43 5f 34 4b 00 00 00 4c 12 83 12 0e ASSIC_4K...L....
|
|
2e8: 13 1b 13 1f 13 20 13 9d 17 a3 17 00 10 04 00 ..... .........
|
|
|
|
000002f7 <ButtonActionTable>:
|
|
2f7: 4e 4f 4e 45 00 00 00 00 00 00 00 00 00 00 00 00 NONE............
|
|
307: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
|
|
317: 55 49 44 5f 52 41 4e 44 4f 4d 00 00 00 00 00 00 UID_RANDOM......
|
|
327: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
|
|
337: 55 49 44 5f 4c 45 46 54 5f 49 4e 43 52 45 4d 45 UID_LEFT_INCREME
|
|
347: 4e 54 00 00 00 00 00 00 00 00 00 00 00 00 00 00 NT..............
|
|
357: 55 49 44 5f 52 49 47 48 54 5f 49 4e 43 52 45 4d UID_RIGHT_INCREM
|
|
367: 45 4e 54 00 00 00 00 00 00 00 00 00 00 00 00 00 ENT.............
|
|
377: 55 49 44 5f 4c 45 46 54 5f 44 45 43 52 45 4d 45 UID_LEFT_DECREME
|
|
387: 4e 54 00 00 00 00 00 00 00 00 00 00 00 00 00 00 NT..............
|
|
397: 55 49 44 5f 52 49 47 48 54 5f 44 45 43 52 45 4d UID_RIGHT_DECREM
|
|
3a7: 45 4e 54 00 00 00 00 00 00 00 00 00 00 00 00 00 ENT.............
|
|
3b7: 43 59 43 4c 45 5f 53 45 54 54 49 4e 47 53 00 00 CYCLE_SETTINGS..
|
|
3c7: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
|
|
|
|
000003d7 <__c.6287>:
|
|
3d7: 43 68 61 6d 65 6c 65 6f 6e 2d 4d 69 6e 69 20 25 Chameleon-Mini %
|
|
3e7: 53 20 75 73 69 6e 67 20 4c 55 46 41 20 25 53 20 S using LUFA %S
|
|
3f7: 63 6f 6d 70 69 6c 65 64 20 77 69 74 68 20 41 56 compiled with AV
|
|
407: 52 2d 47 43 43 20 25 53 00 R-GCC %S.
|
|
|
|
00000410 <__c.6289>:
|
|
410: 31 34 30 35 31 31 00 140511.
|
|
|
|
00000417 <__c.6291>:
|
|
417: 31 33 30 39 30 31 00 130901.
|
|
|
|
0000041e <__c.6293>:
|
|
41e: 34 2e 37 2e 32 00 4.7.2.
|
|
|
|
00000424 <__c.6298>:
|
|
424: 25 73 00 %s.
|
|
|
|
00000427 <__c.6316>:
|
|
427: 52 41 4e 44 4f 4d 00 RANDOM.
|
|
|
|
0000042e <__c.6343>:
|
|
42e: 25 75 00 %u.
|
|
|
|
00000431 <__c.6348>:
|
|
431: 25 75 00 %u.
|
|
|
|
00000434 <__c.6387>:
|
|
434: 25 35 75 20 6d 56 00 %5u mV.
|
|
|
|
0000043b <CommandTable>:
|
|
43b: 56 45 52 53 49 4f 4e 00 00 00 00 00 00 00 00 00 VERSION.........
|
|
44b: 00 00 00 00 3a 0b 43 4f 4e 46 49 47 00 00 00 00 ....:.CONFIG....
|
|
45b: 00 00 00 00 00 00 76 0b 6e 0b 58 0b 55 49 44 00 ......v.n.X.UID.
|
|
46b: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 a1 0b ................
|
|
47b: 7b 0b 52 45 41 44 4f 4e 4c 59 00 00 00 00 00 00 {.READONLY......
|
|
48b: 00 00 00 00 0a 0c f8 0b 55 50 4c 4f 41 44 00 00 ........UPLOAD..
|
|
49b: 00 00 00 00 00 00 00 00 1e 0c 00 00 00 00 44 4f ..............DO
|
|
4ab: 57 4e 4c 4f 41 44 00 00 00 00 00 00 00 00 23 0c WNLOAD........#.
|
|
4bb: 00 00 00 00 52 45 53 45 54 00 00 00 00 00 00 00 ....RESET.......
|
|
4cb: 00 00 00 00 28 0c 00 00 00 00 55 50 47 52 41 44 ....(.....UPGRAD
|
|
4db: 45 00 00 00 00 00 00 00 00 00 33 0c 00 00 00 00 E.........3.....
|
|
4eb: 4d 45 4d 53 49 5a 45 00 00 00 00 00 00 00 00 00 MEMSIZE.........
|
|
4fb: 00 00 00 00 3e 0c 55 49 44 53 49 5a 45 00 00 00 ....>.UIDSIZE...
|
|
50b: 00 00 00 00 00 00 00 00 00 00 56 0c 42 55 54 54 ..........V.BUTT
|
|
51b: 4f 4e 00 00 00 00 00 00 00 00 00 00 6c 0c 76 0c ON..........l.v.
|
|
52b: 71 0c 53 45 54 54 49 4e 47 00 00 00 00 00 00 00 q.SETTING.......
|
|
53b: 00 00 00 00 83 0c 7e 0c 43 4c 45 41 52 00 00 00 ......~.CLEAR...
|
|
54b: 00 00 00 00 00 00 00 00 8b 0c 00 00 00 00 48 45 ..............HE
|
|
55b: 4c 50 00 00 00 00 00 00 00 00 00 00 00 00 8e 0c LP..............
|
|
56b: 00 00 00 00 52 53 53 49 00 00 00 00 00 00 00 00 ....RSSI........
|
|
57b: 00 00 00 00 00 00 00 00 da 0c 00 00 00 00 00 00 ................
|
|
58b: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
|
|
|
|
0000059b <__c.6083>:
|
|
59b: 0d 0a 00 ...
|
|
|
|
0000059e <__c.6085>:
|
|
59e: 0d 0a 00 ...
|
|
|
|
000005a1 <StatusTable>:
|
|
5a1: 64 31 30 30 3a 4f 4b 00 00 00 00 00 00 00 00 00 d100:OK.........
|
|
5b1: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
|
|
5c1: 00 65 31 30 31 3a 4f 4b 20 57 49 54 48 20 54 45 .e101:OK WITH TE
|
|
5d1: 58 54 00 00 00 00 00 00 00 00 00 00 00 00 00 00 XT..............
|
|
5e1: 00 00 6e 31 31 30 3a 57 41 49 54 49 4e 47 20 46 ..n110:WAITING F
|
|
5f1: 4f 52 20 58 4d 4f 44 45 4d 00 00 00 00 00 00 00 OR XMODEM.......
|
|
601: 00 00 00 c8 32 30 30 3a 55 4e 4b 4e 4f 57 4e 20 ....200:UNKNOWN
|
|
611: 43 4f 4d 4d 41 4e 44 00 00 00 00 00 00 00 00 00 COMMAND.........
|
|
621: 00 00 00 00 c9 32 30 31 3a 49 4e 56 41 4c 49 44 .....201:INVALID
|
|
631: 20 43 4f 4d 4d 41 4e 44 20 55 53 41 47 45 00 00 COMMAND USAGE..
|
|
641: 00 00 00 00 00 ca 32 30 32 3a 49 4e 56 41 4c 49 ......202:INVALI
|
|
651: 44 20 50 41 52 41 4d 45 54 45 52 00 00 00 00 00 D PARAMETER.....
|
|
661: 00 00 00 00 00 00 00 .......
|
|
|
|
00000668 <__ctors_end>:
|
|
668: 11 24 eor r1, r1
|
|
66a: 1f be out 0x3f, r1 ; 63
|
|
66c: cf ef ldi r28, 0xFF ; 255
|
|
66e: df e2 ldi r29, 0x2F ; 47
|
|
670: de bf out 0x3e, r29 ; 62
|
|
672: cd bf out 0x3d, r28 ; 61
|
|
|
|
00000674 <__do_copy_data>:
|
|
674: 10 e2 ldi r17, 0x20 ; 32
|
|
676: a0 e0 ldi r26, 0x00 ; 0
|
|
678: b0 e2 ldi r27, 0x20 ; 32
|
|
67a: e0 ef ldi r30, 0xF0 ; 240
|
|
67c: fe e4 ldi r31, 0x4E ; 78
|
|
67e: 02 c0 rjmp .+4 ; 0x684 <__do_copy_data+0x10>
|
|
680: 05 90 lpm r0, Z+
|
|
682: 0d 92 st X+, r0
|
|
684: a2 39 cpi r26, 0x92 ; 146
|
|
686: b1 07 cpc r27, r17
|
|
688: d9 f7 brne .-10 ; 0x680 <__do_copy_data+0xc>
|
|
|
|
0000068a <__do_clear_bss>:
|
|
68a: 26 e2 ldi r18, 0x26 ; 38
|
|
68c: a2 e9 ldi r26, 0x92 ; 146
|
|
68e: b0 e2 ldi r27, 0x20 ; 32
|
|
690: 01 c0 rjmp .+2 ; 0x694 <.do_clear_bss_start>
|
|
|
|
00000692 <.do_clear_bss_loop>:
|
|
692: 1d 92 st X+, r1
|
|
|
|
00000694 <.do_clear_bss_start>:
|
|
694: ad 39 cpi r26, 0x9D ; 157
|
|
696: b2 07 cpc r27, r18
|
|
698: e1 f7 brne .-8 ; 0x692 <.do_clear_bss_loop>
|
|
69a: 03 d0 rcall .+6 ; 0x6a2 <main>
|
|
69c: 0c 94 76 27 jmp 0x4eec ; 0x4eec <_exit>
|
|
|
|
000006a0 <__bad_interrupt>:
|
|
6a0: 78 c0 rjmp .+240 ; 0x792 <__vector_default>
|
|
|
|
000006a2 <main>:
|
|
|
|
#include "Chameleon-Mini.h"
|
|
|
|
int main(void)
|
|
{
|
|
SystemInit();
|
|
6a2: 7d d0 rcall .+250 ; 0x79e <SystemInit>
|
|
SettingsLoad();
|
|
6a4: ae d6 rcall .+3420 ; 0x1402 <SettingsLoad>
|
|
|
|
extern uint8_t LEDPulseMask;
|
|
|
|
static inline
|
|
void LEDInit(void) {
|
|
LED_PORT.DIRSET = LED_MASK;
|
|
6a6: 80 e3 ldi r24, 0x30 ; 48
|
|
6a8: 80 93 01 06 sts 0x0601, r24
|
|
LEDInit();
|
|
MemoryInit();
|
|
6ac: 27 d2 rcall .+1102 ; 0xafc <MemoryInit>
|
|
ConfigurationInit();
|
|
6ae: 0d d1 rcall .+538 ; 0x8ca <ConfigurationInit>
|
|
TerminalInit();
|
|
6b0: 6d d7 rcall .+3802 ; 0x158c <TerminalInit>
|
|
RandomInit();
|
|
6b2: 81 d1 rcall .+770 ; 0x9b6 <RandomInit>
|
|
ButtonInit();
|
|
6b4: 35 d5 rcall .+2666 ; 0x1120 <ButtonInit>
|
|
#define ANTENNA_LEVEL_DENOMINATOR (ANTENNA_LEVEL_SCALE)
|
|
|
|
static inline
|
|
void AntennaLevelInit(void)
|
|
{
|
|
ADCA.CTRLA = ADC_ENABLE_bm;
|
|
6b6: 81 e0 ldi r24, 0x01 ; 1
|
|
6b8: 80 93 00 02 sts 0x0200, r24
|
|
ADCA.CTRLB = ADC_RESOLUTION_12BIT_gc;
|
|
6bc: 10 92 01 02 sts 0x0201, r1
|
|
ADCA.REFCTRL = ADC_REFSEL_INT1V_gc | ADC_BANDGAP_bm;
|
|
6c0: 92 e0 ldi r25, 0x02 ; 2
|
|
6c2: 90 93 02 02 sts 0x0202, r25
|
|
ADCA.PRESCALER = ADC_PRESCALER_DIV32_gc;
|
|
6c6: 93 e0 ldi r25, 0x03 ; 3
|
|
6c8: 90 93 04 02 sts 0x0204, r25
|
|
ADCA.CH0.CTRL = ADC_CH_INPUTMODE_SINGLEENDED_gc;
|
|
6cc: 80 93 20 02 sts 0x0220, r24
|
|
ADCA.CH0.MUXCTRL = ADC_CH_MUXPOS_PIN7_gc;
|
|
6d0: 88 e3 ldi r24, 0x38 ; 56
|
|
6d2: 80 93 21 02 sts 0x0221, r24
|
|
AntennaLevelInit();
|
|
|
|
SystemInterruptInit();
|
|
6d6: ce d0 rcall .+412 ; 0x874 <SystemInterruptInit>
|
|
}
|
|
|
|
INLINE bool SystemTick100ms(void)
|
|
{
|
|
if (TCE0.INTFLAGS & TC0_OVFIF_bm) {
|
|
TCE0.INTFLAGS = TC0_OVFIF_bm;
|
|
6d8: c1 e0 ldi r28, 0x01 ; 1
|
|
|
|
while(1) {
|
|
TerminalTask();
|
|
6da: 5d d7 rcall .+3770 ; 0x1596 <TerminalTask>
|
|
INLINE void CodecInit(void) {
|
|
ActiveConfiguration.CodecInitFunc();
|
|
}
|
|
|
|
INLINE void CodecTask(void) {
|
|
ActiveConfiguration.CodecTaskFunc();
|
|
6dc: e0 91 eb 20 lds r30, 0x20EB
|
|
6e0: f0 91 ec 20 lds r31, 0x20EC
|
|
6e4: 09 95 icall
|
|
INLINE void ApplicationInit(void) {
|
|
ActiveConfiguration.ApplicationInitFunc();
|
|
}
|
|
|
|
INLINE void ApplicationTask(void) {
|
|
ActiveConfiguration.ApplicationTaskFunc();
|
|
6e6: e0 91 f1 20 lds r30, 0x20F1
|
|
6ea: f0 91 f2 20 lds r31, 0x20F2
|
|
6ee: 09 95 icall
|
|
return RTC.CNT;
|
|
}
|
|
|
|
INLINE bool SystemTick100ms(void)
|
|
{
|
|
if (TCE0.INTFLAGS & TC0_OVFIF_bm) {
|
|
6f0: 80 91 0c 0a lds r24, 0x0A0C
|
|
6f4: 80 ff sbrs r24, 0
|
|
6f6: f1 cf rjmp .-30 ; 0x6da <main+0x38>
|
|
TCE0.INTFLAGS = TC0_OVFIF_bm;
|
|
6f8: c0 93 0c 0a sts 0x0A0C, r28
|
|
CodecTask();
|
|
ApplicationTask();
|
|
|
|
if (SystemTick100ms()) {
|
|
RandomTick();
|
|
6fc: 6f d1 rcall .+734 ; 0x9dc <RandomTick>
|
|
TerminalTick();
|
|
6fe: 6a d7 rcall .+3796 ; 0x15d4 <TerminalTick>
|
|
ButtonTick();
|
|
700: 16 d5 rcall .+2604 ; 0x112e <ButtonTick>
|
|
LED_PORT.OUTSET = Mask;
|
|
}
|
|
|
|
static inline
|
|
void LEDTick(void) {
|
|
LED_PORT.OUTCLR = LEDPulseMask;
|
|
702: 80 91 93 20 lds r24, 0x2093
|
|
706: 80 93 06 06 sts 0x0606, r24
|
|
LEDPulseMask = 0;
|
|
70a: 10 92 93 20 sts 0x2093, r1
|
|
70e: e5 cf rjmp .-54 ; 0x6da <main+0x38>
|
|
|
|
00000710 <CALLBACK_USB_GetDescriptor>:
|
|
break;
|
|
}
|
|
|
|
*DescriptorAddress = Address;
|
|
return Size;
|
|
}
|
|
710: 29 2f mov r18, r25
|
|
712: 33 27 eor r19, r19
|
|
const uint8_t DescriptorNumber = (wValue & 0xFF);
|
|
|
|
const void* Address = NULL;
|
|
uint16_t Size = NO_DESCRIPTOR;
|
|
|
|
switch (DescriptorType)
|
|
714: 22 30 cpi r18, 0x02 ; 2
|
|
716: 31 05 cpc r19, r1
|
|
718: 39 f1 breq .+78 ; 0x768 <CALLBACK_USB_GetDescriptor+0x58>
|
|
71a: 23 30 cpi r18, 0x03 ; 3
|
|
71c: 31 05 cpc r19, r1
|
|
71e: a9 f0 breq .+42 ; 0x74a <CALLBACK_USB_GetDescriptor+0x3a>
|
|
720: 21 30 cpi r18, 0x01 ; 1
|
|
722: 31 05 cpc r19, r1
|
|
724: 49 f0 breq .+18 ; 0x738 <CALLBACK_USB_GetDescriptor+0x28>
|
|
{
|
|
const uint8_t DescriptorType = (wValue >> 8);
|
|
const uint8_t DescriptorNumber = (wValue & 0xFF);
|
|
|
|
const void* Address = NULL;
|
|
uint16_t Size = NO_DESCRIPTOR;
|
|
726: 20 e0 ldi r18, 0x00 ; 0
|
|
728: 30 e0 ldi r19, 0x00 ; 0
|
|
const void** const DescriptorAddress)
|
|
{
|
|
const uint8_t DescriptorType = (wValue >> 8);
|
|
const uint8_t DescriptorNumber = (wValue & 0xFF);
|
|
|
|
const void* Address = NULL;
|
|
72a: 80 e0 ldi r24, 0x00 ; 0
|
|
72c: 90 e0 ldi r25, 0x00 ; 0
|
|
}
|
|
|
|
break;
|
|
}
|
|
|
|
*DescriptorAddress = Address;
|
|
72e: fa 01 movw r30, r20
|
|
730: 80 83 st Z, r24
|
|
732: 91 83 std Z+1, r25 ; 0x01
|
|
return Size;
|
|
}
|
|
734: c9 01 movw r24, r18
|
|
736: 08 95 ret
|
|
|
|
switch (DescriptorType)
|
|
{
|
|
case DTYPE_Device:
|
|
Address = &DeviceDescriptor;
|
|
Size = sizeof(USB_Descriptor_Device_t);
|
|
738: 22 e1 ldi r18, 0x12 ; 18
|
|
73a: 30 e0 ldi r19, 0x00 ; 0
|
|
uint16_t Size = NO_DESCRIPTOR;
|
|
|
|
switch (DescriptorType)
|
|
{
|
|
case DTYPE_Device:
|
|
Address = &DeviceDescriptor;
|
|
73c: 86 e7 ldi r24, 0x76 ; 118
|
|
73e: 92 e0 ldi r25, 0x02 ; 2
|
|
}
|
|
|
|
break;
|
|
}
|
|
|
|
*DescriptorAddress = Address;
|
|
740: fa 01 movw r30, r20
|
|
742: 80 83 st Z, r24
|
|
744: 91 83 std Z+1, r25 ; 0x01
|
|
return Size;
|
|
}
|
|
746: c9 01 movw r24, r18
|
|
748: 08 95 ret
|
|
74a: 99 27 eor r25, r25
|
|
case DTYPE_Configuration:
|
|
Address = &ConfigurationDescriptor;
|
|
Size = sizeof(USB_Descriptor_Configuration_t);
|
|
break;
|
|
case DTYPE_String:
|
|
switch (DescriptorNumber)
|
|
74c: 81 30 cpi r24, 0x01 ; 1
|
|
74e: 91 05 cpc r25, r1
|
|
750: a1 f0 breq .+40 ; 0x77a <CALLBACK_USB_GetDescriptor+0x6a>
|
|
752: 82 30 cpi r24, 0x02 ; 2
|
|
754: 91 05 cpc r25, r1
|
|
756: b9 f0 breq .+46 ; 0x786 <CALLBACK_USB_GetDescriptor+0x76>
|
|
758: 89 2b or r24, r25
|
|
75a: 29 f7 brne .-54 ; 0x726 <CALLBACK_USB_GetDescriptor+0x16>
|
|
{
|
|
case 0x00:
|
|
Address = &LanguageString;
|
|
Size = pgm_read_byte(&LanguageString.Header.Size);
|
|
75c: e4 e3 ldi r30, 0x34 ; 52
|
|
75e: f2 e0 ldi r31, 0x02 ; 2
|
|
760: 24 91 lpm r18, Z
|
|
762: 30 e0 ldi r19, 0x00 ; 0
|
|
break;
|
|
case DTYPE_String:
|
|
switch (DescriptorNumber)
|
|
{
|
|
case 0x00:
|
|
Address = &LanguageString;
|
|
764: cf 01 movw r24, r30
|
|
Size = pgm_read_byte(&LanguageString.Header.Size);
|
|
break;
|
|
766: e3 cf rjmp .-58 ; 0x72e <CALLBACK_USB_GetDescriptor+0x1e>
|
|
Address = &DeviceDescriptor;
|
|
Size = sizeof(USB_Descriptor_Device_t);
|
|
break;
|
|
case DTYPE_Configuration:
|
|
Address = &ConfigurationDescriptor;
|
|
Size = sizeof(USB_Descriptor_Configuration_t);
|
|
768: 2e e3 ldi r18, 0x3E ; 62
|
|
76a: 30 e0 ldi r19, 0x00 ; 0
|
|
case DTYPE_Device:
|
|
Address = &DeviceDescriptor;
|
|
Size = sizeof(USB_Descriptor_Device_t);
|
|
break;
|
|
case DTYPE_Configuration:
|
|
Address = &ConfigurationDescriptor;
|
|
76c: 88 e3 ldi r24, 0x38 ; 56
|
|
76e: 92 e0 ldi r25, 0x02 ; 2
|
|
}
|
|
|
|
break;
|
|
}
|
|
|
|
*DescriptorAddress = Address;
|
|
770: fa 01 movw r30, r20
|
|
772: 80 83 st Z, r24
|
|
774: 91 83 std Z+1, r25 ; 0x01
|
|
return Size;
|
|
}
|
|
776: c9 01 movw r24, r18
|
|
778: 08 95 ret
|
|
Address = &LanguageString;
|
|
Size = pgm_read_byte(&LanguageString.Header.Size);
|
|
break;
|
|
case 0x01:
|
|
Address = &ManufacturerString;
|
|
Size = pgm_read_byte(&ManufacturerString.Header.Size);
|
|
77a: ea e1 ldi r30, 0x1A ; 26
|
|
77c: f2 e0 ldi r31, 0x02 ; 2
|
|
77e: 24 91 lpm r18, Z
|
|
780: 30 e0 ldi r19, 0x00 ; 0
|
|
case 0x00:
|
|
Address = &LanguageString;
|
|
Size = pgm_read_byte(&LanguageString.Header.Size);
|
|
break;
|
|
case 0x01:
|
|
Address = &ManufacturerString;
|
|
782: cf 01 movw r24, r30
|
|
Size = pgm_read_byte(&ManufacturerString.Header.Size);
|
|
break;
|
|
784: d4 cf rjmp .-88 ; 0x72e <CALLBACK_USB_GetDescriptor+0x1e>
|
|
case 0x02:
|
|
Address = &ProductString;
|
|
Size = pgm_read_byte(&ProductString.Header.Size);
|
|
786: ec ef ldi r30, 0xFC ; 252
|
|
788: f1 e0 ldi r31, 0x01 ; 1
|
|
78a: 24 91 lpm r18, Z
|
|
78c: 30 e0 ldi r19, 0x00 ; 0
|
|
case 0x01:
|
|
Address = &ManufacturerString;
|
|
Size = pgm_read_byte(&ManufacturerString.Header.Size);
|
|
break;
|
|
case 0x02:
|
|
Address = &ProductString;
|
|
78e: cf 01 movw r24, r30
|
|
Size = pgm_read_byte(&ProductString.Header.Size);
|
|
break;
|
|
790: ce cf rjmp .-100 ; 0x72e <CALLBACK_USB_GetDescriptor+0x1e>
|
|
|
|
00000792 <__vector_default>:
|
|
|
|
#include "System.h"
|
|
#include "LED.h"
|
|
|
|
ISR(BADISR_vect)
|
|
{
|
|
792: 1f 92 push r1
|
|
794: 0f 92 push r0
|
|
796: 0f b6 in r0, 0x3f ; 63
|
|
798: 0f 92 push r0
|
|
79a: 11 24 eor r1, r1
|
|
79c: ff cf rjmp .-2 ; 0x79c <__vector_default+0xa>
|
|
|
|
0000079e <SystemInit>:
|
|
while(1);
|
|
}
|
|
|
|
void SystemInit(void)
|
|
{
|
|
if (RST.STATUS & RST_WDRF_bm) {
|
|
79e: 80 91 78 00 lds r24, 0x0078
|
|
7a2: 83 ff sbrs r24, 3
|
|
7a4: 0a c0 rjmp .+20 ; 0x7ba <SystemInit+0x1c>
|
|
/* On Watchdog reset clear WDRF bit, disable watchdog
|
|
* and jump into bootloader */
|
|
RST.STATUS = RST_WDRF_bm;
|
|
7a6: 88 e0 ldi r24, 0x08 ; 8
|
|
7a8: 80 93 78 00 sts 0x0078, r24
|
|
|
|
CCP = CCP_IOREG_gc;
|
|
7ac: 88 ed ldi r24, 0xD8 ; 216
|
|
7ae: 84 bf out 0x34, r24 ; 52
|
|
WDT.CTRL = WDT_CEN_bm;
|
|
7b0: 81 e0 ldi r24, 0x01 ; 1
|
|
7b2: 80 93 80 00 sts 0x0080, r24
|
|
|
|
asm volatile ("jmp %0"::"i" (BOOT_SECTION_START + 0x1FC));
|
|
7b6: fd 95 fe c0 jmp 0x7f81fc ; 0x7f81fc <__data_load_end+0x7f327a>
|
|
}
|
|
|
|
/* 32MHz system clock using internal RC and 32K DFLL*/
|
|
OSC.CTRL |= OSC_RC32MEN_bm | OSC_RC32KEN_bm;
|
|
7ba: 80 91 50 00 lds r24, 0x0050
|
|
7be: 86 60 ori r24, 0x06 ; 6
|
|
7c0: 80 93 50 00 sts 0x0050, r24
|
|
while(!(OSC.STATUS & OSC_RC32MRDY_bm))
|
|
7c4: 80 91 51 00 lds r24, 0x0051
|
|
7c8: 81 ff sbrs r24, 1
|
|
7ca: fc cf rjmp .-8 ; 0x7c4 <SystemInit+0x26>
|
|
;
|
|
while(!(OSC.STATUS & OSC_RC32KRDY_bm))
|
|
7cc: 80 91 51 00 lds r24, 0x0051
|
|
7d0: 82 ff sbrs r24, 2
|
|
7d2: fc cf rjmp .-8 ; 0x7cc <SystemInit+0x2e>
|
|
;
|
|
|
|
OSC.DFLLCTRL = OSC_RC32MCREF_RC32K_gc;
|
|
7d4: 10 92 56 00 sts 0x0056, r1
|
|
DFLLRC32M.CTRL = DFLL_ENABLE_bm;
|
|
7d8: 21 e0 ldi r18, 0x01 ; 1
|
|
7da: 20 93 60 00 sts 0x0060, r18
|
|
|
|
CCP = CCP_IOREG_gc;
|
|
7de: 88 ed ldi r24, 0xD8 ; 216
|
|
7e0: 84 bf out 0x34, r24 ; 52
|
|
CLK.CTRL = CLK_SCLKSEL_RC32M_gc;
|
|
7e2: 20 93 40 00 sts 0x0040, r18
|
|
|
|
/* Use TCE0 as system tick */
|
|
TCE0.PER = F_CPU / 256 / SYSTEM_TICK_FREQ - 1;
|
|
7e6: 83 ed ldi r24, 0xD3 ; 211
|
|
7e8: 90 e3 ldi r25, 0x30 ; 48
|
|
7ea: 80 93 26 0a sts 0x0A26, r24
|
|
7ee: 90 93 27 0a sts 0x0A27, r25
|
|
TCE0.CTRLA = TC_CLKSEL_DIV256_gc;
|
|
7f2: 86 e0 ldi r24, 0x06 ; 6
|
|
7f4: 80 93 00 0a sts 0x0A00, r24
|
|
|
|
/* Enable RTC with roughly 1kHz clock */
|
|
CLK.RTCCTRL = CLK_RTCSRC_ULP_gc | CLK_RTCEN_bm;
|
|
7f8: 20 93 43 00 sts 0x0043, r18
|
|
RTC.CTRL = RTC_PRESCALER_DIV1_gc;
|
|
7fc: 20 93 00 04 sts 0x0400, r18
|
|
|
|
/* Enable EEPROM data memory mapping */
|
|
NVM.CTRLB |= NVM_EEMAPEN_bm;
|
|
800: 80 91 cc 01 lds r24, 0x01CC
|
|
804: 88 60 ori r24, 0x08 ; 8
|
|
806: 80 93 cc 01 sts 0x01CC, r24
|
|
80a: 08 95 ret
|
|
|
|
0000080c <SystemReset>:
|
|
}
|
|
|
|
void SystemReset(void)
|
|
{
|
|
CCP = CCP_IOREG_gc;
|
|
80c: 88 ed ldi r24, 0xD8 ; 216
|
|
80e: 84 bf out 0x34, r24 ; 52
|
|
RST.CTRL = RST_SWRST_bm;
|
|
810: 81 e0 ldi r24, 0x01 ; 1
|
|
812: e8 e7 ldi r30, 0x78 ; 120
|
|
814: f0 e0 ldi r31, 0x00 ; 0
|
|
816: 81 83 std Z+1, r24 ; 0x01
|
|
818: 08 95 ret
|
|
|
|
0000081a <SystemEnterBootloader>:
|
|
}
|
|
|
|
void SystemEnterBootloader(void)
|
|
{
|
|
/* Use Watchdog timer to reset into bootloader. */
|
|
CCP = CCP_IOREG_gc;
|
|
81a: 88 ed ldi r24, 0xD8 ; 216
|
|
81c: 84 bf out 0x34, r24 ; 52
|
|
WDT.CTRL = WDT_PER_500CLK_gc | WDT_ENABLE_bm | WDT_CEN_bm;
|
|
81e: 8b e1 ldi r24, 0x1B ; 27
|
|
820: 80 93 80 00 sts 0x0080, r24
|
|
824: 08 95 ret
|
|
|
|
00000826 <SystemStartUSBClock>:
|
|
|
|
|
|
void SystemStartUSBClock(void)
|
|
{
|
|
/* 48MHz USB Clock using 12MHz XTAL */
|
|
OSC.XOSCCTRL = OSC_FRQRANGE_12TO16_gc | OSC_XOSCSEL_XTAL_16KCLK_gc;
|
|
826: 8b ec ldi r24, 0xCB ; 203
|
|
828: 80 93 52 00 sts 0x0052, r24
|
|
OSC.CTRL |= OSC_XOSCEN_bm;
|
|
82c: 80 91 50 00 lds r24, 0x0050
|
|
830: 88 60 ori r24, 0x08 ; 8
|
|
832: 80 93 50 00 sts 0x0050, r24
|
|
while(!(OSC.STATUS & OSC_XOSCRDY_bm))
|
|
836: 80 91 51 00 lds r24, 0x0051
|
|
83a: 83 ff sbrs r24, 3
|
|
83c: fc cf rjmp .-8 ; 0x836 <SystemStartUSBClock+0x10>
|
|
;
|
|
|
|
OSC.PLLCTRL = OSC_PLLSRC_XOSC_gc | (4 << OSC_PLLFAC_gp);
|
|
83e: 84 ec ldi r24, 0xC4 ; 196
|
|
840: 80 93 55 00 sts 0x0055, r24
|
|
|
|
OSC.CTRL |= OSC_PLLEN_bm;
|
|
844: 80 91 50 00 lds r24, 0x0050
|
|
848: 80 61 ori r24, 0x10 ; 16
|
|
84a: 80 93 50 00 sts 0x0050, r24
|
|
while(!(OSC.STATUS & OSC_PLLRDY_bm))
|
|
84e: 80 91 51 00 lds r24, 0x0051
|
|
852: 84 ff sbrs r24, 4
|
|
854: fc cf rjmp .-8 ; 0x84e <SystemStartUSBClock+0x28>
|
|
;
|
|
}
|
|
856: 08 95 ret
|
|
|
|
00000858 <SystemStopUSBClock>:
|
|
|
|
void SystemStopUSBClock(void)
|
|
{
|
|
/* Disable USB Clock to minimize power consumption */
|
|
CLK.USBCTRL &= ~CLK_USBSEN_bm;
|
|
858: e0 e4 ldi r30, 0x40 ; 64
|
|
85a: f0 e0 ldi r31, 0x00 ; 0
|
|
85c: 84 81 ldd r24, Z+4 ; 0x04
|
|
85e: 8e 7f andi r24, 0xFE ; 254
|
|
860: 84 83 std Z+4, r24 ; 0x04
|
|
OSC.CTRL &= ~OSC_PLLEN_bm;
|
|
862: e0 e5 ldi r30, 0x50 ; 80
|
|
864: f0 e0 ldi r31, 0x00 ; 0
|
|
866: 80 81 ld r24, Z
|
|
868: 8f 7e andi r24, 0xEF ; 239
|
|
86a: 80 83 st Z, r24
|
|
OSC.CTRL &= ~OSC_XOSCEN_bm;
|
|
86c: 80 81 ld r24, Z
|
|
86e: 87 7f andi r24, 0xF7 ; 247
|
|
870: 80 83 st Z, r24
|
|
872: 08 95 ret
|
|
|
|
00000874 <SystemInterruptInit>:
|
|
}
|
|
|
|
void SystemInterruptInit(void)
|
|
{
|
|
/* Enable all interrupt levels */
|
|
PMIC.CTRL = PMIC_LOLVLEN_bm | PMIC_MEDLVLEN_bm | PMIC_HILVLEN_bm;
|
|
874: 87 e0 ldi r24, 0x07 ; 7
|
|
876: e0 ea ldi r30, 0xA0 ; 160
|
|
878: f0 e0 ldi r31, 0x00 ; 0
|
|
87a: 82 83 std Z+2, r24 ; 0x02
|
|
sei();
|
|
87c: 78 94 sei
|
|
87e: 08 95 ret
|
|
|
|
00000880 <CodecInitDummy>:
|
|
|
|
/* Include all Codecs and Applications */
|
|
#include "Codec/Codec.h"
|
|
#include "Application/Application.h"
|
|
|
|
static void CodecInitDummy(void) { }
|
|
880: 08 95 ret
|
|
|
|
00000882 <CodecTaskDummy>:
|
|
static void CodecTaskDummy(void) { }
|
|
882: 08 95 ret
|
|
|
|
00000884 <ApplicationInitDummy>:
|
|
static void ApplicationInitDummy(void) {}
|
|
884: 08 95 ret
|
|
|
|
00000886 <ApplicationResetDummy>:
|
|
static void ApplicationResetDummy(void) {}
|
|
886: 08 95 ret
|
|
|
|
00000888 <ApplicationTaskDummy>:
|
|
static void ApplicationTaskDummy(void) {}
|
|
888: 08 95 ret
|
|
|
|
0000088a <ApplicationProcessDummy>:
|
|
static uint16_t ApplicationProcessDummy(uint8_t* ByteBuffer, uint16_t ByteCount) { return 0; }
|
|
88a: 80 e0 ldi r24, 0x00 ; 0
|
|
88c: 90 e0 ldi r25, 0x00 ; 0
|
|
88e: 08 95 ret
|
|
|
|
00000890 <ApplicationGetUidDummy>:
|
|
static void ApplicationGetUidDummy(ConfigurationUidType Uid) { }
|
|
890: 08 95 ret
|
|
|
|
00000892 <ApplicationSetUidDummy>:
|
|
static void ApplicationSetUidDummy(ConfigurationUidType Uid) { }
|
|
892: 08 95 ret
|
|
|
|
00000894 <ConfigurationSetById>:
|
|
ConfigurationSetById(GlobalSettings.ActiveSettingPtr->Configuration);
|
|
}
|
|
|
|
void ConfigurationSetById( ConfigurationEnum Configuration )
|
|
{
|
|
GlobalSettings.ActiveSettingPtr->Configuration = Configuration;
|
|
894: e0 91 fe 20 lds r30, 0x20FE
|
|
898: f0 91 ff 20 lds r31, 0x20FF
|
|
89c: 81 83 std Z+1, r24 ; 0x01
|
|
|
|
/* Copy struct from PROGMEM to RAM */
|
|
memcpy_P(&ActiveConfiguration,
|
|
&ConfigurationTable[Configuration], sizeof(ConfigurationType));
|
|
89e: 95 e2 ldi r25, 0x25 ; 37
|
|
8a0: 89 9f mul r24, r25
|
|
8a2: b0 01 movw r22, r0
|
|
8a4: 11 24 eor r1, r1
|
|
8a6: 68 57 subi r22, 0x78 ; 120
|
|
8a8: 7d 4f sbci r23, 0xFD ; 253
|
|
void ConfigurationSetById( ConfigurationEnum Configuration )
|
|
{
|
|
GlobalSettings.ActiveSettingPtr->Configuration = Configuration;
|
|
|
|
/* Copy struct from PROGMEM to RAM */
|
|
memcpy_P(&ActiveConfiguration,
|
|
8aa: 45 e2 ldi r20, 0x25 ; 37
|
|
8ac: 50 e0 ldi r21, 0x00 ; 0
|
|
8ae: 88 ed ldi r24, 0xD8 ; 216
|
|
8b0: 90 e2 ldi r25, 0x20 ; 32
|
|
8b2: 0e 94 0d 24 call 0x481a ; 0x481a <memcpy_P>
|
|
/* Applications */
|
|
#include "MifareClassic.h"
|
|
|
|
/* Function wrappers */
|
|
INLINE void ApplicationInit(void) {
|
|
ActiveConfiguration.ApplicationInitFunc();
|
|
8b6: e0 91 ed 20 lds r30, 0x20ED
|
|
8ba: f0 91 ee 20 lds r31, 0x20EE
|
|
8be: 09 95 icall
|
|
#define CODEC_CARRIER_FREQ 13560000
|
|
|
|
extern uint8_t CodecBuffer[CODEC_BUFFER_SIZE];
|
|
|
|
INLINE void CodecInit(void) {
|
|
ActiveConfiguration.CodecInitFunc();
|
|
8c0: e0 91 e9 20 lds r30, 0x20E9
|
|
8c4: f0 91 ea 20 lds r31, 0x20EA
|
|
8c8: 09 94 ijmp
|
|
|
|
000008ca <ConfigurationInit>:
|
|
|
|
ConfigurationType ActiveConfiguration;
|
|
|
|
void ConfigurationInit(void)
|
|
{
|
|
ConfigurationSetById(GlobalSettings.ActiveSettingPtr->Configuration);
|
|
8ca: e0 91 fe 20 lds r30, 0x20FE
|
|
8ce: f0 91 ff 20 lds r31, 0x20FF
|
|
8d2: 81 81 ldd r24, Z+1 ; 0x01
|
|
8d4: df cf rjmp .-66 ; 0x894 <ConfigurationSetById>
|
|
|
|
000008d6 <ConfigurationSetByName>:
|
|
ApplicationInit();
|
|
CodecInit();
|
|
}
|
|
|
|
bool ConfigurationSetByName(const char* ConfigurationName)
|
|
{
|
|
8d6: 0f 93 push r16
|
|
8d8: 1f 93 push r17
|
|
8da: cf 93 push r28
|
|
8dc: df 93 push r29
|
|
8de: 20 e0 ldi r18, 0x00 ; 0
|
|
8e0: 30 e0 ldi r19, 0x00 ; 0
|
|
uint8_t i;
|
|
|
|
/* Loop through table trying to find the configuration */
|
|
for (i=0; i<(sizeof(ConfigurationTable) / sizeof(*ConfigurationTable)); i++) {
|
|
const char* pTableConfigName = ConfigurationTable[i].ConfigurationName;
|
|
8e2: 15 e2 ldi r17, 0x25 ; 37
|
|
|
|
ApplicationInit();
|
|
CodecInit();
|
|
}
|
|
|
|
bool ConfigurationSetByName(const char* ConfigurationName)
|
|
8e4: ac 01 movw r20, r24
|
|
8e6: 4f 5f subi r20, 0xFF ; 255
|
|
8e8: 5f 4f sbci r21, 0xFF ; 255
|
|
8ea: 02 2f mov r16, r18
|
|
{
|
|
uint8_t i;
|
|
|
|
/* Loop through table trying to find the configuration */
|
|
for (i=0; i<(sizeof(ConfigurationTable) / sizeof(*ConfigurationTable)); i++) {
|
|
const char* pTableConfigName = ConfigurationTable[i].ConfigurationName;
|
|
8ec: 12 9f mul r17, r18
|
|
8ee: f0 01 movw r30, r0
|
|
8f0: 13 9f mul r17, r19
|
|
8f2: f0 0d add r31, r0
|
|
8f4: 11 24 eor r1, r1
|
|
8f6: e7 57 subi r30, 0x77 ; 119
|
|
8f8: fd 4f sbci r31, 0xFD ; 253
|
|
const char* pRequestedConfigName = ConfigurationName;
|
|
bool StringMismatch = false;
|
|
char c = pgm_read_byte(pTableConfigName);
|
|
8fa: 64 91 lpm r22, Z
|
|
|
|
/* Try to keep running until both strings end at the same point */
|
|
while ( !(c == '\0' && *pRequestedConfigName == '\0') ) {
|
|
8fc: 61 11 cpse r22, r1
|
|
8fe: 0f c0 rjmp .+30 ; 0x91e <ConfigurationSetByName+0x48>
|
|
uint8_t i;
|
|
|
|
/* Loop through table trying to find the configuration */
|
|
for (i=0; i<(sizeof(ConfigurationTable) / sizeof(*ConfigurationTable)); i++) {
|
|
const char* pTableConfigName = ConfigurationTable[i].ConfigurationName;
|
|
const char* pRequestedConfigName = ConfigurationName;
|
|
900: ec 01 movw r28, r24
|
|
bool StringMismatch = false;
|
|
char c = pgm_read_byte(pTableConfigName);
|
|
|
|
/* Try to keep running until both strings end at the same point */
|
|
while ( !(c == '\0' && *pRequestedConfigName == '\0') ) {
|
|
902: 68 81 ld r22, Y
|
|
904: 66 23 and r22, r22
|
|
906: 01 f1 breq .+64 ; 0x948 <ConfigurationSetByName+0x72>
|
|
908: 2f 5f subi r18, 0xFF ; 255
|
|
90a: 3f 4f sbci r19, 0xFF ; 255
|
|
bool ConfigurationSetByName(const char* ConfigurationName)
|
|
{
|
|
uint8_t i;
|
|
|
|
/* Loop through table trying to find the configuration */
|
|
for (i=0; i<(sizeof(ConfigurationTable) / sizeof(*ConfigurationTable)); i++) {
|
|
90c: 23 30 cpi r18, 0x03 ; 3
|
|
90e: 31 05 cpc r19, r1
|
|
910: 61 f7 brne .-40 ; 0x8ea <ConfigurationSetByName+0x14>
|
|
ConfigurationSetById(i);
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return false;
|
|
912: 80 e0 ldi r24, 0x00 ; 0
|
|
}
|
|
914: df 91 pop r29
|
|
916: cf 91 pop r28
|
|
918: 1f 91 pop r17
|
|
91a: 0f 91 pop r16
|
|
91c: 08 95 ret
|
|
bool StringMismatch = false;
|
|
char c = pgm_read_byte(pTableConfigName);
|
|
|
|
/* Try to keep running until both strings end at the same point */
|
|
while ( !(c == '\0' && *pRequestedConfigName == '\0') ) {
|
|
if ( (c == '\0') || (*pRequestedConfigName == '\0') ) {
|
|
91e: dc 01 movw r26, r24
|
|
920: 7c 91 ld r23, X
|
|
922: 77 23 and r23, r23
|
|
924: 89 f3 breq .-30 ; 0x908 <ConfigurationSetByName+0x32>
|
|
/* One String ended before the other did -> unequal length */
|
|
StringMismatch = true;
|
|
break;
|
|
}
|
|
|
|
if (c != *pRequestedConfigName) {
|
|
926: 67 13 cpse r22, r23
|
|
928: ef cf rjmp .-34 ; 0x908 <ConfigurationSetByName+0x32>
|
|
|
|
ApplicationInit();
|
|
CodecInit();
|
|
}
|
|
|
|
bool ConfigurationSetByName(const char* ConfigurationName)
|
|
92a: da 01 movw r26, r20
|
|
92c: 05 c0 rjmp .+10 ; 0x938 <ConfigurationSetByName+0x62>
|
|
bool StringMismatch = false;
|
|
char c = pgm_read_byte(pTableConfigName);
|
|
|
|
/* Try to keep running until both strings end at the same point */
|
|
while ( !(c == '\0' && *pRequestedConfigName == '\0') ) {
|
|
if ( (c == '\0') || (*pRequestedConfigName == '\0') ) {
|
|
92e: 7d 91 ld r23, X+
|
|
930: 77 23 and r23, r23
|
|
932: 51 f3 breq .-44 ; 0x908 <ConfigurationSetByName+0x32>
|
|
/* One String ended before the other did -> unequal length */
|
|
StringMismatch = true;
|
|
break;
|
|
}
|
|
|
|
if (c != *pRequestedConfigName) {
|
|
934: 76 13 cpse r23, r22
|
|
936: e8 cf rjmp .-48 ; 0x908 <ConfigurationSetByName+0x32>
|
|
StringMismatch = true;
|
|
break;
|
|
}
|
|
|
|
/* Proceed to next character */
|
|
pTableConfigName++;
|
|
938: 31 96 adiw r30, 0x01 ; 1
|
|
pRequestedConfigName++;
|
|
93a: ed 01 movw r28, r26
|
|
|
|
c = pgm_read_byte(pTableConfigName);
|
|
93c: 64 91 lpm r22, Z
|
|
const char* pRequestedConfigName = ConfigurationName;
|
|
bool StringMismatch = false;
|
|
char c = pgm_read_byte(pTableConfigName);
|
|
|
|
/* Try to keep running until both strings end at the same point */
|
|
while ( !(c == '\0' && *pRequestedConfigName == '\0') ) {
|
|
93e: 61 11 cpse r22, r1
|
|
940: f6 cf rjmp .-20 ; 0x92e <ConfigurationSetByName+0x58>
|
|
942: 68 81 ld r22, Y
|
|
944: 61 11 cpse r22, r1
|
|
946: e0 cf rjmp .-64 ; 0x908 <ConfigurationSetByName+0x32>
|
|
c = pgm_read_byte(pTableConfigName);
|
|
}
|
|
|
|
if (!StringMismatch) {
|
|
/* Configuration found */
|
|
ConfigurationSetById(i);
|
|
948: 80 2f mov r24, r16
|
|
94a: a4 df rcall .-184 ; 0x894 <ConfigurationSetById>
|
|
return true;
|
|
94c: 81 e0 ldi r24, 0x01 ; 1
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
94e: df 91 pop r29
|
|
950: cf 91 pop r28
|
|
952: 1f 91 pop r17
|
|
954: 0f 91 pop r16
|
|
956: 08 95 ret
|
|
|
|
00000958 <ConfigurationGetList>:
|
|
|
|
void ConfigurationGetList(char* ConfigListOut, uint16_t ByteCount)
|
|
{
|
|
958: cf 93 push r28
|
|
95a: df 93 push r29
|
|
95c: ec 01 movw r28, r24
|
|
uint8_t i;
|
|
|
|
/* Account for '\0' */
|
|
ByteCount--;
|
|
95e: 61 50 subi r22, 0x01 ; 1
|
|
960: 71 09 sbc r23, r1
|
|
962: 80 e0 ldi r24, 0x00 ; 0
|
|
964: 90 e0 ldi r25, 0x00 ; 0
|
|
|
|
for (i=0; i<CONFIG_COUNT; i++) {
|
|
const char* ConfigName = ConfigurationTable[i].ConfigurationName;
|
|
966: 35 e2 ldi r19, 0x25 ; 37
|
|
ByteCount--;
|
|
}
|
|
|
|
if ( i < (CONFIG_COUNT - 1) ) {
|
|
/* No comma on last configuration */
|
|
*ConfigListOut++ = ',';
|
|
968: 4c e2 ldi r20, 0x2C ; 44
|
|
|
|
/* Account for '\0' */
|
|
ByteCount--;
|
|
|
|
for (i=0; i<CONFIG_COUNT; i++) {
|
|
const char* ConfigName = ConfigurationTable[i].ConfigurationName;
|
|
96a: 38 9f mul r19, r24
|
|
96c: f0 01 movw r30, r0
|
|
96e: 39 9f mul r19, r25
|
|
970: f0 0d add r31, r0
|
|
972: 11 24 eor r1, r1
|
|
974: e7 57 subi r30, 0x77 ; 119
|
|
976: fd 4f sbci r31, 0xFD ; 253
|
|
char c;
|
|
|
|
while( (c = pgm_read_byte(ConfigName)) != '\0' && ByteCount > CONFIGURATION_NAME_LENGTH_MAX) {
|
|
978: 24 91 lpm r18, Z
|
|
97a: 22 23 and r18, r18
|
|
97c: 81 f0 breq .+32 ; 0x99e <ConfigurationGetList+0x46>
|
|
97e: 61 31 cpi r22, 0x11 ; 17
|
|
980: 71 05 cpc r23, r1
|
|
982: 68 f0 brcs .+26 ; 0x99e <ConfigurationGetList+0x46>
|
|
984: de 01 movw r26, r28
|
|
986: 03 c0 rjmp .+6 ; 0x98e <ConfigurationGetList+0x36>
|
|
988: 60 31 cpi r22, 0x10 ; 16
|
|
98a: 71 05 cpc r23, r1
|
|
98c: 41 f0 breq .+16 ; 0x99e <ConfigurationGetList+0x46>
|
|
/* While not end-of-string and enough buffer to
|
|
* put a complete configuration name */
|
|
*ConfigListOut++ = c;
|
|
98e: 2d 93 st X+, r18
|
|
990: ed 01 movw r28, r26
|
|
ConfigName++;
|
|
992: 31 96 adiw r30, 0x01 ; 1
|
|
ByteCount--;
|
|
994: 61 50 subi r22, 0x01 ; 1
|
|
996: 71 09 sbc r23, r1
|
|
|
|
for (i=0; i<CONFIG_COUNT; i++) {
|
|
const char* ConfigName = ConfigurationTable[i].ConfigurationName;
|
|
char c;
|
|
|
|
while( (c = pgm_read_byte(ConfigName)) != '\0' && ByteCount > CONFIGURATION_NAME_LENGTH_MAX) {
|
|
998: 24 91 lpm r18, Z
|
|
99a: 21 11 cpse r18, r1
|
|
99c: f5 cf rjmp .-22 ; 0x988 <ConfigurationGetList+0x30>
|
|
*ConfigListOut++ = c;
|
|
ConfigName++;
|
|
ByteCount--;
|
|
}
|
|
|
|
if ( i < (CONFIG_COUNT - 1) ) {
|
|
99e: 82 30 cpi r24, 0x02 ; 2
|
|
9a0: 91 05 cpc r25, r1
|
|
9a2: 21 f4 brne .+8 ; 0x9ac <ConfigurationGetList+0x54>
|
|
*ConfigListOut++ = ',';
|
|
ByteCount--;
|
|
}
|
|
}
|
|
|
|
*ConfigListOut = '\0';
|
|
9a4: 18 82 st Y, r1
|
|
}
|
|
9a6: df 91 pop r29
|
|
9a8: cf 91 pop r28
|
|
9aa: 08 95 ret
|
|
ByteCount--;
|
|
}
|
|
|
|
if ( i < (CONFIG_COUNT - 1) ) {
|
|
/* No comma on last configuration */
|
|
*ConfigListOut++ = ',';
|
|
9ac: 49 93 st Y+, r20
|
|
ByteCount--;
|
|
9ae: 61 50 subi r22, 0x01 ; 1
|
|
9b0: 71 09 sbc r23, r1
|
|
9b2: 01 96 adiw r24, 0x01 ; 1
|
|
9b4: da cf rjmp .-76 ; 0x96a <ConfigurationGetList+0x12>
|
|
|
|
000009b6 <RandomInit>:
|
|
#include "Random.h"
|
|
|
|
#include <stdlib.h>
|
|
|
|
void RandomInit(void)
|
|
{
|
|
9b6: 08 95 ret
|
|
|
|
000009b8 <RandomGetByte>:
|
|
|
|
}
|
|
|
|
uint8_t RandomGetByte(void)
|
|
{
|
|
return rand() & 0xFF;
|
|
9b8: 0c 94 ff 23 jmp 0x47fe ; 0x47fe <rand>
|
|
}
|
|
9bc: 08 95 ret
|
|
|
|
000009be <RandomGetBuffer>:
|
|
|
|
void RandomGetBuffer(void* Buffer, uint8_t ByteCount)
|
|
{
|
|
9be: 1f 93 push r17
|
|
9c0: cf 93 push r28
|
|
9c2: df 93 push r29
|
|
9c4: 16 2f mov r17, r22
|
|
uint8_t* BufferPtr = (uint8_t*) Buffer;
|
|
|
|
while(ByteCount--) {
|
|
9c6: 66 23 and r22, r22
|
|
9c8: 29 f0 breq .+10 ; 0x9d4 <RandomGetBuffer+0x16>
|
|
9ca: ec 01 movw r28, r24
|
|
*BufferPtr++ = RandomGetByte();
|
|
9cc: f5 df rcall .-22 ; 0x9b8 <RandomGetByte>
|
|
9ce: 89 93 st Y+, r24
|
|
9d0: 11 50 subi r17, 0x01 ; 1
|
|
|
|
void RandomGetBuffer(void* Buffer, uint8_t ByteCount)
|
|
{
|
|
uint8_t* BufferPtr = (uint8_t*) Buffer;
|
|
|
|
while(ByteCount--) {
|
|
9d2: e1 f7 brne .-8 ; 0x9cc <RandomGetBuffer+0xe>
|
|
*BufferPtr++ = RandomGetByte();
|
|
}
|
|
}
|
|
9d4: df 91 pop r29
|
|
9d6: cf 91 pop r28
|
|
9d8: 1f 91 pop r17
|
|
9da: 08 95 ret
|
|
|
|
000009dc <RandomTick>:
|
|
|
|
void RandomTick(void)
|
|
{
|
|
rand();
|
|
9dc: 0e 94 ff 23 call 0x47fe ; 0x47fe <rand>
|
|
rand();
|
|
9e0: 0e 94 ff 23 call 0x47fe ; 0x47fe <rand>
|
|
rand();
|
|
9e4: 0e 94 ff 23 call 0x47fe ; 0x47fe <rand>
|
|
rand();
|
|
9e8: 0c 94 ff 23 jmp 0x47fe ; 0x47fe <rand>
|
|
|
|
000009ec <BufferToHexString>:
|
|
*/
|
|
|
|
#include "Common.h"
|
|
|
|
uint16_t BufferToHexString(char* HexOut, uint16_t MaxChars, const void* Buffer, uint16_t ByteCount)
|
|
{
|
|
9ec: cf 93 push r28
|
|
9ee: df 93 push r29
|
|
9f0: dc 01 movw r26, r24
|
|
uint8_t* ByteBuffer = (uint8_t*) Buffer;
|
|
uint16_t CharCount = 0;
|
|
|
|
/* Account for '\0' at the end */
|
|
MaxChars--;
|
|
9f2: 61 50 subi r22, 0x01 ; 1
|
|
9f4: 71 09 sbc r23, r1
|
|
|
|
while( (ByteCount > 0) && (MaxChars >= 2) ) {
|
|
9f6: 21 15 cp r18, r1
|
|
9f8: 31 05 cpc r19, r1
|
|
9fa: 99 f1 breq .+102 ; 0xa62 <BufferToHexString+0x76>
|
|
9fc: 62 30 cpi r22, 0x02 ; 2
|
|
9fe: 71 05 cpc r23, r1
|
|
a00: 80 f1 brcs .+96 ; 0xa62 <BufferToHexString+0x76>
|
|
a02: fa 01 movw r30, r20
|
|
* policies, either expressed or implied, of the ORIGINAL AUTHORS.
|
|
*/
|
|
|
|
#include "Common.h"
|
|
|
|
uint16_t BufferToHexString(char* HexOut, uint16_t MaxChars, const void* Buffer, uint16_t ByteCount)
|
|
a04: 24 0f add r18, r20
|
|
a06: 35 1f adc r19, r21
|
|
a08: 21 50 subi r18, 0x01 ; 1
|
|
a0a: 31 09 sbc r19, r1
|
|
{
|
|
uint8_t* ByteBuffer = (uint8_t*) Buffer;
|
|
uint16_t CharCount = 0;
|
|
a0c: 40 e0 ldi r20, 0x00 ; 0
|
|
a0e: 50 e0 ldi r21, 0x00 ; 0
|
|
a10: 17 c0 rjmp .+46 ; 0xa40 <BufferToHexString+0x54>
|
|
MaxChars--;
|
|
|
|
while( (ByteCount > 0) && (MaxChars >= 2) ) {
|
|
uint8_t Byte = *ByteBuffer;
|
|
|
|
HexOut[0] = NIBBLE_TO_HEXCHAR( (Byte >> 4) & 0x0F );
|
|
a12: d0 5d subi r29, 0xD0 ; 208
|
|
a14: dc 93 st X, r29
|
|
HexOut[1] = NIBBLE_TO_HEXCHAR( (Byte >> 0) & 0x0F );
|
|
a16: cf 70 andi r28, 0x0F ; 15
|
|
a18: 8c 2f mov r24, r28
|
|
a1a: 90 e0 ldi r25, 0x00 ; 0
|
|
a1c: 0a 97 sbiw r24, 0x0a ; 10
|
|
a1e: fc f4 brge .+62 ; 0xa5e <BufferToHexString+0x72>
|
|
a20: c0 5d subi r28, 0xD0 ; 208
|
|
a22: 11 96 adiw r26, 0x01 ; 1
|
|
a24: cc 93 st X, r28
|
|
a26: 11 97 sbiw r26, 0x01 ; 1
|
|
|
|
HexOut += 2;
|
|
a28: 12 96 adiw r26, 0x02 ; 2
|
|
MaxChars -= 2;
|
|
a2a: 62 50 subi r22, 0x02 ; 2
|
|
a2c: 71 09 sbc r23, r1
|
|
CharCount += 2;
|
|
a2e: 4e 5f subi r20, 0xFE ; 254
|
|
a30: 5f 4f sbci r21, 0xFF ; 255
|
|
uint16_t CharCount = 0;
|
|
|
|
/* Account for '\0' at the end */
|
|
MaxChars--;
|
|
|
|
while( (ByteCount > 0) && (MaxChars >= 2) ) {
|
|
a32: e2 17 cp r30, r18
|
|
a34: f3 07 cpc r31, r19
|
|
a36: b9 f0 breq .+46 ; 0xa66 <BufferToHexString+0x7a>
|
|
a38: 31 96 adiw r30, 0x01 ; 1
|
|
a3a: 62 30 cpi r22, 0x02 ; 2
|
|
a3c: 71 05 cpc r23, r1
|
|
a3e: 98 f0 brcs .+38 ; 0xa66 <BufferToHexString+0x7a>
|
|
uint8_t Byte = *ByteBuffer;
|
|
a40: c0 81 ld r28, Z
|
|
|
|
HexOut[0] = NIBBLE_TO_HEXCHAR( (Byte >> 4) & 0x0F );
|
|
a42: dc 2f mov r29, r28
|
|
a44: d2 95 swap r29
|
|
a46: df 70 andi r29, 0x0F ; 15
|
|
a48: 8d 2f mov r24, r29
|
|
a4a: 90 e0 ldi r25, 0x00 ; 0
|
|
a4c: 0a 97 sbiw r24, 0x0a ; 10
|
|
a4e: 0c f3 brlt .-62 ; 0xa12 <BufferToHexString+0x26>
|
|
a50: d9 5c subi r29, 0xC9 ; 201
|
|
a52: dc 93 st X, r29
|
|
HexOut[1] = NIBBLE_TO_HEXCHAR( (Byte >> 0) & 0x0F );
|
|
a54: cf 70 andi r28, 0x0F ; 15
|
|
a56: 8c 2f mov r24, r28
|
|
a58: 90 e0 ldi r25, 0x00 ; 0
|
|
a5a: 0a 97 sbiw r24, 0x0a ; 10
|
|
a5c: 0c f3 brlt .-62 ; 0xa20 <BufferToHexString+0x34>
|
|
a5e: c9 5c subi r28, 0xC9 ; 201
|
|
a60: e0 cf rjmp .-64 ; 0xa22 <BufferToHexString+0x36>
|
|
#include "Common.h"
|
|
|
|
uint16_t BufferToHexString(char* HexOut, uint16_t MaxChars, const void* Buffer, uint16_t ByteCount)
|
|
{
|
|
uint8_t* ByteBuffer = (uint8_t*) Buffer;
|
|
uint16_t CharCount = 0;
|
|
a62: 40 e0 ldi r20, 0x00 ; 0
|
|
a64: 50 e0 ldi r21, 0x00 ; 0
|
|
CharCount += 2;
|
|
ByteBuffer++;
|
|
ByteCount -= 1;
|
|
}
|
|
|
|
*HexOut = '\0';
|
|
a66: 1c 92 st X, r1
|
|
|
|
return CharCount;
|
|
}
|
|
a68: ca 01 movw r24, r20
|
|
a6a: df 91 pop r29
|
|
a6c: cf 91 pop r28
|
|
a6e: 08 95 ret
|
|
|
|
00000a70 <HexStringToBuffer>:
|
|
|
|
uint16_t HexStringToBuffer(void* Buffer, uint16_t MaxBytes, const char* HexIn)
|
|
{
|
|
a70: fa 01 movw r30, r20
|
|
uint8_t* ByteBuffer = (uint8_t*) Buffer;
|
|
uint16_t ByteCount = 0;
|
|
|
|
while( (HexIn[0] != '\0') && (HexIn[1] != '\0') && (MaxBytes > 0) ) {
|
|
a72: 40 81 ld r20, Z
|
|
a74: 44 23 and r20, r20
|
|
a76: f1 f1 breq .+124 ; 0xaf4 <HexStringToBuffer+0x84>
|
|
a78: 51 81 ldd r21, Z+1 ; 0x01
|
|
a7a: 55 23 and r21, r21
|
|
a7c: d9 f1 breq .+118 ; 0xaf4 <HexStringToBuffer+0x84>
|
|
a7e: 61 15 cp r22, r1
|
|
a80: 71 05 cpc r23, r1
|
|
a82: c1 f1 breq .+112 ; 0xaf4 <HexStringToBuffer+0x84>
|
|
a84: dc 01 movw r26, r24
|
|
a86: 20 e0 ldi r18, 0x00 ; 0
|
|
a88: 30 e0 ldi r19, 0x00 ; 0
|
|
a8a: 13 c0 rjmp .+38 ; 0xab2 <HexStringToBuffer+0x42>
|
|
if (VALID_HEXCHAR(HexIn[0]) && VALID_HEXCHAR(HexIn[1])) {
|
|
uint8_t Byte = 0;
|
|
|
|
Byte |= HEXCHAR_TO_NIBBLE(HexIn[0]) << 4;
|
|
a8c: 42 95 swap r20
|
|
a8e: 40 7f andi r20, 0xF0 ; 240
|
|
Byte |= HEXCHAR_TO_NIBBLE(HexIn[1]) << 0;
|
|
a90: 51 34 cpi r21, 0x41 ; 65
|
|
a92: 28 f5 brcc .+74 ; 0xade <HexStringToBuffer+0x6e>
|
|
a94: 58 2f mov r21, r24
|
|
a96: 45 2b or r20, r21
|
|
|
|
*ByteBuffer = Byte;
|
|
a98: 4d 93 st X+, r20
|
|
|
|
ByteBuffer++;
|
|
MaxBytes--;
|
|
ByteCount++;
|
|
a9a: 2f 5f subi r18, 0xFF ; 255
|
|
a9c: 3f 4f sbci r19, 0xFF ; 255
|
|
HexIn += 2;
|
|
a9e: 32 96 adiw r30, 0x02 ; 2
|
|
uint16_t HexStringToBuffer(void* Buffer, uint16_t MaxBytes, const char* HexIn)
|
|
{
|
|
uint8_t* ByteBuffer = (uint8_t*) Buffer;
|
|
uint16_t ByteCount = 0;
|
|
|
|
while( (HexIn[0] != '\0') && (HexIn[1] != '\0') && (MaxBytes > 0) ) {
|
|
aa0: 40 81 ld r20, Z
|
|
aa2: 44 23 and r20, r20
|
|
aa4: 29 f1 breq .+74 ; 0xaf0 <HexStringToBuffer+0x80>
|
|
aa6: 51 81 ldd r21, Z+1 ; 0x01
|
|
aa8: 55 23 and r21, r21
|
|
aaa: 21 f1 breq .+72 ; 0xaf4 <HexStringToBuffer+0x84>
|
|
aac: 62 17 cp r22, r18
|
|
aae: 73 07 cpc r23, r19
|
|
ab0: f9 f0 breq .+62 ; 0xaf0 <HexStringToBuffer+0x80>
|
|
if (VALID_HEXCHAR(HexIn[0]) && VALID_HEXCHAR(HexIn[1])) {
|
|
ab2: 84 2f mov r24, r20
|
|
ab4: 80 53 subi r24, 0x30 ; 48
|
|
ab6: 8a 30 cpi r24, 0x0A ; 10
|
|
ab8: 18 f0 brcs .+6 ; 0xac0 <HexStringToBuffer+0x50>
|
|
aba: 81 51 subi r24, 0x11 ; 17
|
|
abc: 86 30 cpi r24, 0x06 ; 6
|
|
abe: d0 f4 brcc .+52 ; 0xaf4 <HexStringToBuffer+0x84>
|
|
ac0: 85 2f mov r24, r21
|
|
ac2: 80 53 subi r24, 0x30 ; 48
|
|
ac4: 8a 30 cpi r24, 0x0A ; 10
|
|
ac6: 20 f0 brcs .+8 ; 0xad0 <HexStringToBuffer+0x60>
|
|
ac8: 95 2f mov r25, r21
|
|
aca: 91 54 subi r25, 0x41 ; 65
|
|
acc: 96 30 cpi r25, 0x06 ; 6
|
|
ace: 90 f4 brcc .+36 ; 0xaf4 <HexStringToBuffer+0x84>
|
|
uint8_t Byte = 0;
|
|
|
|
Byte |= HEXCHAR_TO_NIBBLE(HexIn[0]) << 4;
|
|
ad0: 41 34 cpi r20, 0x41 ; 65
|
|
ad2: e0 f2 brcs .-72 ; 0xa8c <HexStringToBuffer+0x1c>
|
|
ad4: 42 95 swap r20
|
|
ad6: 40 7f andi r20, 0xF0 ; 240
|
|
ad8: 40 57 subi r20, 0x70 ; 112
|
|
Byte |= HEXCHAR_TO_NIBBLE(HexIn[1]) << 0;
|
|
ada: 51 34 cpi r21, 0x41 ; 65
|
|
adc: d8 f2 brcs .-74 ; 0xa94 <HexStringToBuffer+0x24>
|
|
ade: 57 53 subi r21, 0x37 ; 55
|
|
ae0: 45 2b or r20, r21
|
|
|
|
*ByteBuffer = Byte;
|
|
ae2: 4d 93 st X+, r20
|
|
|
|
ByteBuffer++;
|
|
MaxBytes--;
|
|
ByteCount++;
|
|
ae4: 2f 5f subi r18, 0xFF ; 255
|
|
ae6: 3f 4f sbci r19, 0xFF ; 255
|
|
HexIn += 2;
|
|
ae8: 32 96 adiw r30, 0x02 ; 2
|
|
uint16_t HexStringToBuffer(void* Buffer, uint16_t MaxBytes, const char* HexIn)
|
|
{
|
|
uint8_t* ByteBuffer = (uint8_t*) Buffer;
|
|
uint16_t ByteCount = 0;
|
|
|
|
while( (HexIn[0] != '\0') && (HexIn[1] != '\0') && (MaxBytes > 0) ) {
|
|
aea: 40 81 ld r20, Z
|
|
aec: 41 11 cpse r20, r1
|
|
aee: db cf rjmp .-74 ; 0xaa6 <HexStringToBuffer+0x36>
|
|
/* Odd number of characters */
|
|
return 0;
|
|
}
|
|
|
|
return ByteCount;
|
|
}
|
|
af0: c9 01 movw r24, r18
|
|
af2: 08 95 ret
|
|
}
|
|
}
|
|
|
|
if ( (HexIn[0] != '\0') && (HexIn[1] == '\0') ) {
|
|
/* Odd number of characters */
|
|
return 0;
|
|
af4: 20 e0 ldi r18, 0x00 ; 0
|
|
af6: 30 e0 ldi r19, 0x00 ; 0
|
|
}
|
|
|
|
return ByteCount;
|
|
}
|
|
af8: c9 01 movw r24, r18
|
|
afa: 08 95 ret
|
|
|
|
00000afc <MemoryInit>:
|
|
SPITransferByte( 0 );
|
|
MEMORY_FLASH_PORT.OUTSET = MEMORY_FLASH_CS;
|
|
}
|
|
|
|
void MemoryInit(void)
|
|
{
|
|
afc: cf 93 push r28
|
|
afe: df 93 push r29
|
|
b00: 00 d0 rcall .+0 ; 0xb02 <MemoryInit+0x6>
|
|
b02: 00 d0 rcall .+0 ; 0xb04 <MemoryInit+0x8>
|
|
b04: cd b7 in r28, 0x3d ; 61
|
|
b06: de b7 in r29, 0x3e ; 62
|
|
/* Configure MEMORY_FLASH_USART for SPI master mode 0 with maximum clock frequency */
|
|
MEMORY_FLASH_PORT.OUTSET = MEMORY_FLASH_CS;
|
|
b08: 80 e1 ldi r24, 0x10 ; 16
|
|
b0a: 80 93 65 06 sts 0x0665, r24
|
|
|
|
MEMORY_FLASH_PORT.OUTCLR = MEMORY_FLASH_SCK;
|
|
b0e: 92 e0 ldi r25, 0x02 ; 2
|
|
b10: 90 93 66 06 sts 0x0666, r25
|
|
MEMORY_FLASH_PORT.OUTSET = MEMORY_FLASH_MOSI;
|
|
b14: 98 e0 ldi r25, 0x08 ; 8
|
|
b16: 90 93 65 06 sts 0x0665, r25
|
|
|
|
MEMORY_FLASH_PORT.DIRSET = MEMORY_FLASH_SCK | MEMORY_FLASH_MOSI | MEMORY_FLASH_CS;
|
|
b1a: 9a e1 ldi r25, 0x1A ; 26
|
|
b1c: 90 93 61 06 sts 0x0661, r25
|
|
|
|
MEMORY_FLASH_USART.BAUDCTRLA = 0;
|
|
b20: 10 92 a6 09 sts 0x09A6, r1
|
|
MEMORY_FLASH_USART.BAUDCTRLB = 0;
|
|
b24: 10 92 a7 09 sts 0x09A7, r1
|
|
MEMORY_FLASH_USART.CTRLC = USART_CMODE_MSPI_gc;
|
|
b28: 90 ec ldi r25, 0xC0 ; 192
|
|
b2a: 90 93 a5 09 sts 0x09A5, r25
|
|
MEMORY_FLASH_USART.CTRLB = USART_RXEN_bm | USART_TXEN_bm;
|
|
b2e: 98 e1 ldi r25, 0x18 ; 24
|
|
b30: 90 93 a4 09 sts 0x09A4, r25
|
|
|
|
INLINE uint8_t FlashReadStatusRegister(void)
|
|
{
|
|
uint8_t Register;
|
|
|
|
MEMORY_FLASH_PORT.OUTCLR = MEMORY_FLASH_CS;
|
|
b34: 80 93 66 06 sts 0x0666, r24
|
|
#define FLASH_STATUS_REG_PROTECT_BIT (1<<1)
|
|
#define FLASH_STATUS_REG_PAGESIZE_BIT (1<<0)
|
|
|
|
INLINE uint8_t SPITransferByte(uint8_t Data)
|
|
{
|
|
MEMORY_FLASH_USART.DATA = Data;
|
|
b38: 87 ed ldi r24, 0xD7 ; 215
|
|
b3a: 80 93 a0 09 sts 0x09A0, r24
|
|
|
|
while (!(MEMORY_FLASH_USART.STATUS & USART_TXCIF_bm));
|
|
b3e: 80 91 a1 09 lds r24, 0x09A1
|
|
b42: 86 ff sbrs r24, 6
|
|
b44: fc cf rjmp .-8 ; 0xb3e <MemoryInit+0x42>
|
|
|
|
MEMORY_FLASH_USART.STATUS = USART_TXCIF_bm;
|
|
b46: 80 e4 ldi r24, 0x40 ; 64
|
|
b48: 80 93 a1 09 sts 0x09A1, r24
|
|
|
|
return MEMORY_FLASH_USART.DATA;
|
|
b4c: 80 91 a0 09 lds r24, 0x09A0
|
|
#define FLASH_STATUS_REG_PROTECT_BIT (1<<1)
|
|
#define FLASH_STATUS_REG_PAGESIZE_BIT (1<<0)
|
|
|
|
INLINE uint8_t SPITransferByte(uint8_t Data)
|
|
{
|
|
MEMORY_FLASH_USART.DATA = Data;
|
|
b50: 10 92 a0 09 sts 0x09A0, r1
|
|
|
|
while (!(MEMORY_FLASH_USART.STATUS & USART_TXCIF_bm));
|
|
b54: 80 91 a1 09 lds r24, 0x09A1
|
|
b58: 86 ff sbrs r24, 6
|
|
b5a: fc cf rjmp .-8 ; 0xb54 <MemoryInit+0x58>
|
|
|
|
MEMORY_FLASH_USART.STATUS = USART_TXCIF_bm;
|
|
b5c: 80 e4 ldi r24, 0x40 ; 64
|
|
b5e: 80 93 a1 09 sts 0x09A1, r24
|
|
|
|
return MEMORY_FLASH_USART.DATA;
|
|
b62: 80 91 a0 09 lds r24, 0x09A0
|
|
uint8_t Register;
|
|
|
|
MEMORY_FLASH_PORT.OUTCLR = MEMORY_FLASH_CS;
|
|
SPITransferByte(FLASH_CMD_STATUS_REG_READ);
|
|
Register = SPITransferByte(0);
|
|
MEMORY_FLASH_PORT.OUTSET = MEMORY_FLASH_CS;
|
|
b66: 90 e1 ldi r25, 0x10 ; 16
|
|
b68: 90 93 65 06 sts 0x0665, r25
|
|
MEMORY_FLASH_USART.BAUDCTRLB = 0;
|
|
MEMORY_FLASH_USART.CTRLC = USART_CMODE_MSPI_gc;
|
|
MEMORY_FLASH_USART.CTRLB = USART_RXEN_bm | USART_TXEN_bm;
|
|
|
|
|
|
if ( !(FlashReadStatusRegister() & FLASH_STATUS_REG_PAGESIZE_BIT) ) {
|
|
b6c: 80 fd sbrc r24, 0
|
|
b6e: 3e c0 rjmp .+124 ; 0xbec <MemoryInit+0xf0>
|
|
return !(FlashReadStatusRegister() & FLASH_STATUS_REG_READY_BIT);
|
|
}
|
|
|
|
INLINE void FlashConfigurePageSize(void)
|
|
{
|
|
uint8_t Sequence[] = {0x3D, 0x2A, 0x80, 0xA6};
|
|
b70: 8d e3 ldi r24, 0x3D ; 61
|
|
b72: 89 83 std Y+1, r24 ; 0x01
|
|
b74: 8a e2 ldi r24, 0x2A ; 42
|
|
b76: 8a 83 std Y+2, r24 ; 0x02
|
|
b78: 80 e8 ldi r24, 0x80 ; 128
|
|
b7a: 8b 83 std Y+3, r24 ; 0x03
|
|
b7c: 86 ea ldi r24, 0xA6 ; 166
|
|
b7e: 8c 83 std Y+4, r24 ; 0x04
|
|
|
|
INLINE uint8_t FlashReadStatusRegister(void)
|
|
{
|
|
uint8_t Register;
|
|
|
|
MEMORY_FLASH_PORT.OUTCLR = MEMORY_FLASH_CS;
|
|
b80: 20 e1 ldi r18, 0x10 ; 16
|
|
#define FLASH_STATUS_REG_PROTECT_BIT (1<<1)
|
|
#define FLASH_STATUS_REG_PAGESIZE_BIT (1<<0)
|
|
|
|
INLINE uint8_t SPITransferByte(uint8_t Data)
|
|
{
|
|
MEMORY_FLASH_USART.DATA = Data;
|
|
b82: 37 ed ldi r19, 0xD7 ; 215
|
|
|
|
while (!(MEMORY_FLASH_USART.STATUS & USART_TXCIF_bm));
|
|
|
|
MEMORY_FLASH_USART.STATUS = USART_TXCIF_bm;
|
|
b84: 90 e4 ldi r25, 0x40 ; 64
|
|
|
|
INLINE uint8_t FlashReadStatusRegister(void)
|
|
{
|
|
uint8_t Register;
|
|
|
|
MEMORY_FLASH_PORT.OUTCLR = MEMORY_FLASH_CS;
|
|
b86: 20 93 66 06 sts 0x0666, r18
|
|
#define FLASH_STATUS_REG_PROTECT_BIT (1<<1)
|
|
#define FLASH_STATUS_REG_PAGESIZE_BIT (1<<0)
|
|
|
|
INLINE uint8_t SPITransferByte(uint8_t Data)
|
|
{
|
|
MEMORY_FLASH_USART.DATA = Data;
|
|
b8a: 30 93 a0 09 sts 0x09A0, r19
|
|
|
|
while (!(MEMORY_FLASH_USART.STATUS & USART_TXCIF_bm));
|
|
b8e: 80 91 a1 09 lds r24, 0x09A1
|
|
b92: 86 ff sbrs r24, 6
|
|
b94: fc cf rjmp .-8 ; 0xb8e <MemoryInit+0x92>
|
|
|
|
MEMORY_FLASH_USART.STATUS = USART_TXCIF_bm;
|
|
b96: 90 93 a1 09 sts 0x09A1, r25
|
|
|
|
return MEMORY_FLASH_USART.DATA;
|
|
b9a: 80 91 a0 09 lds r24, 0x09A0
|
|
#define FLASH_STATUS_REG_PROTECT_BIT (1<<1)
|
|
#define FLASH_STATUS_REG_PAGESIZE_BIT (1<<0)
|
|
|
|
INLINE uint8_t SPITransferByte(uint8_t Data)
|
|
{
|
|
MEMORY_FLASH_USART.DATA = Data;
|
|
b9e: 10 92 a0 09 sts 0x09A0, r1
|
|
|
|
while (!(MEMORY_FLASH_USART.STATUS & USART_TXCIF_bm));
|
|
ba2: 80 91 a1 09 lds r24, 0x09A1
|
|
ba6: 86 ff sbrs r24, 6
|
|
ba8: fc cf rjmp .-8 ; 0xba2 <MemoryInit+0xa6>
|
|
|
|
MEMORY_FLASH_USART.STATUS = USART_TXCIF_bm;
|
|
baa: 90 93 a1 09 sts 0x09A1, r25
|
|
|
|
return MEMORY_FLASH_USART.DATA;
|
|
bae: 80 91 a0 09 lds r24, 0x09A0
|
|
uint8_t Register;
|
|
|
|
MEMORY_FLASH_PORT.OUTCLR = MEMORY_FLASH_CS;
|
|
SPITransferByte(FLASH_CMD_STATUS_REG_READ);
|
|
Register = SPITransferByte(0);
|
|
MEMORY_FLASH_PORT.OUTSET = MEMORY_FLASH_CS;
|
|
bb2: 20 93 65 06 sts 0x0665, r18
|
|
|
|
INLINE void FlashConfigurePageSize(void)
|
|
{
|
|
uint8_t Sequence[] = {0x3D, 0x2A, 0x80, 0xA6};
|
|
|
|
while(FlashIsBusy());
|
|
bb6: 87 ff sbrs r24, 7
|
|
bb8: e6 cf rjmp .-52 ; 0xb86 <MemoryInit+0x8a>
|
|
|
|
MEMORY_FLASH_PORT.OUTCLR = MEMORY_FLASH_CS;
|
|
bba: 80 e1 ldi r24, 0x10 ; 16
|
|
bbc: 80 93 66 06 sts 0x0666, r24
|
|
}
|
|
}
|
|
|
|
INLINE void SPIWriteBlock(const void* Buffer, uint16_t ByteCount)
|
|
{
|
|
uint8_t* ByteBuffer = (uint8_t*) Buffer;
|
|
bc0: fe 01 movw r30, r28
|
|
bc2: 31 96 adiw r30, 0x01 ; 1
|
|
bc4: ce 01 movw r24, r28
|
|
bc6: 05 96 adiw r24, 0x05 ; 5
|
|
|
|
while(ByteCount-- > 0) {
|
|
MEMORY_FLASH_USART.DATA = *ByteBuffer++;
|
|
while (!(MEMORY_FLASH_USART.STATUS & USART_TXCIF_bm));
|
|
MEMORY_FLASH_USART.STATUS = USART_TXCIF_bm;
|
|
bc8: 30 e4 ldi r19, 0x40 ; 64
|
|
INLINE void SPIWriteBlock(const void* Buffer, uint16_t ByteCount)
|
|
{
|
|
uint8_t* ByteBuffer = (uint8_t*) Buffer;
|
|
|
|
while(ByteCount-- > 0) {
|
|
MEMORY_FLASH_USART.DATA = *ByteBuffer++;
|
|
bca: 21 91 ld r18, Z+
|
|
bcc: 20 93 a0 09 sts 0x09A0, r18
|
|
while (!(MEMORY_FLASH_USART.STATUS & USART_TXCIF_bm));
|
|
bd0: 20 91 a1 09 lds r18, 0x09A1
|
|
bd4: 26 ff sbrs r18, 6
|
|
bd6: fc cf rjmp .-8 ; 0xbd0 <MemoryInit+0xd4>
|
|
MEMORY_FLASH_USART.STATUS = USART_TXCIF_bm;
|
|
bd8: 30 93 a1 09 sts 0x09A1, r19
|
|
MEMORY_FLASH_USART.DATA; /* Flush Buffer */
|
|
bdc: 20 91 a0 09 lds r18, 0x09A0
|
|
|
|
INLINE void SPIWriteBlock(const void* Buffer, uint16_t ByteCount)
|
|
{
|
|
uint8_t* ByteBuffer = (uint8_t*) Buffer;
|
|
|
|
while(ByteCount-- > 0) {
|
|
be0: e8 17 cp r30, r24
|
|
be2: f9 07 cpc r31, r25
|
|
be4: 91 f7 brne .-28 ; 0xbca <MemoryInit+0xce>
|
|
|
|
while(FlashIsBusy());
|
|
|
|
MEMORY_FLASH_PORT.OUTCLR = MEMORY_FLASH_CS;
|
|
SPIWriteBlock(Sequence, sizeof(Sequence));
|
|
MEMORY_FLASH_PORT.OUTSET = MEMORY_FLASH_CS;
|
|
be6: 80 e1 ldi r24, 0x10 ; 16
|
|
be8: 80 93 65 06 sts 0x0665, r24
|
|
|
|
if ( !(FlashReadStatusRegister() & FLASH_STATUS_REG_PAGESIZE_BIT) ) {
|
|
/* Configure for 256 byte Dataflash if not already done. */
|
|
FlashConfigurePageSize();
|
|
}
|
|
}
|
|
bec: 24 96 adiw r28, 0x04 ; 4
|
|
bee: cd bf out 0x3d, r28 ; 61
|
|
bf0: de bf out 0x3e, r29 ; 62
|
|
bf2: df 91 pop r29
|
|
bf4: cf 91 pop r28
|
|
bf6: 08 95 ret
|
|
|
|
00000bf8 <MemoryReadBlock>:
|
|
|
|
void MemoryReadBlock(void* Buffer, uint16_t Address, uint16_t ByteCount)
|
|
{
|
|
bf8: cf 92 push r12
|
|
bfa: df 92 push r13
|
|
bfc: ef 92 push r14
|
|
bfe: ff 92 push r15
|
|
c00: 0f 93 push r16
|
|
c02: 1f 93 push r17
|
|
c04: fc 01 movw r30, r24
|
|
uint32_t FlashAddress = (uint32_t) Address + (uint32_t) GlobalSettings.ActiveSetting * MEMORY_SIZE_PER_SETTING;
|
|
c06: 00 91 fd 20 lds r16, 0x20FD
|
|
c0a: 10 e0 ldi r17, 0x00 ; 0
|
|
c0c: 20 e0 ldi r18, 0x00 ; 0
|
|
c0e: 30 e0 ldi r19, 0x00 ; 0
|
|
c10: 98 01 movw r18, r16
|
|
c12: 11 27 eor r17, r17
|
|
c14: 00 27 eor r16, r16
|
|
c16: 06 0f add r16, r22
|
|
c18: 17 1f adc r17, r23
|
|
c1a: 21 1d adc r18, r1
|
|
c1c: 31 1d adc r19, r1
|
|
|
|
INLINE uint8_t FlashReadStatusRegister(void)
|
|
{
|
|
uint8_t Register;
|
|
|
|
MEMORY_FLASH_PORT.OUTCLR = MEMORY_FLASH_CS;
|
|
c1e: 60 e1 ldi r22, 0x10 ; 16
|
|
#define FLASH_STATUS_REG_PROTECT_BIT (1<<1)
|
|
#define FLASH_STATUS_REG_PAGESIZE_BIT (1<<0)
|
|
|
|
INLINE uint8_t SPITransferByte(uint8_t Data)
|
|
{
|
|
MEMORY_FLASH_USART.DATA = Data;
|
|
c20: 77 ed ldi r23, 0xD7 ; 215
|
|
|
|
while (!(MEMORY_FLASH_USART.STATUS & USART_TXCIF_bm));
|
|
|
|
MEMORY_FLASH_USART.STATUS = USART_TXCIF_bm;
|
|
c22: 90 e4 ldi r25, 0x40 ; 64
|
|
|
|
INLINE uint8_t FlashReadStatusRegister(void)
|
|
{
|
|
uint8_t Register;
|
|
|
|
MEMORY_FLASH_PORT.OUTCLR = MEMORY_FLASH_CS;
|
|
c24: 60 93 66 06 sts 0x0666, r22
|
|
#define FLASH_STATUS_REG_PROTECT_BIT (1<<1)
|
|
#define FLASH_STATUS_REG_PAGESIZE_BIT (1<<0)
|
|
|
|
INLINE uint8_t SPITransferByte(uint8_t Data)
|
|
{
|
|
MEMORY_FLASH_USART.DATA = Data;
|
|
c28: 70 93 a0 09 sts 0x09A0, r23
|
|
|
|
while (!(MEMORY_FLASH_USART.STATUS & USART_TXCIF_bm));
|
|
c2c: 80 91 a1 09 lds r24, 0x09A1
|
|
c30: 86 ff sbrs r24, 6
|
|
c32: fc cf rjmp .-8 ; 0xc2c <MemoryReadBlock+0x34>
|
|
|
|
MEMORY_FLASH_USART.STATUS = USART_TXCIF_bm;
|
|
c34: 90 93 a1 09 sts 0x09A1, r25
|
|
|
|
return MEMORY_FLASH_USART.DATA;
|
|
c38: 80 91 a0 09 lds r24, 0x09A0
|
|
#define FLASH_STATUS_REG_PROTECT_BIT (1<<1)
|
|
#define FLASH_STATUS_REG_PAGESIZE_BIT (1<<0)
|
|
|
|
INLINE uint8_t SPITransferByte(uint8_t Data)
|
|
{
|
|
MEMORY_FLASH_USART.DATA = Data;
|
|
c3c: 10 92 a0 09 sts 0x09A0, r1
|
|
|
|
while (!(MEMORY_FLASH_USART.STATUS & USART_TXCIF_bm));
|
|
c40: 80 91 a1 09 lds r24, 0x09A1
|
|
c44: 86 ff sbrs r24, 6
|
|
c46: fc cf rjmp .-8 ; 0xc40 <MemoryReadBlock+0x48>
|
|
|
|
MEMORY_FLASH_USART.STATUS = USART_TXCIF_bm;
|
|
c48: 90 93 a1 09 sts 0x09A1, r25
|
|
|
|
return MEMORY_FLASH_USART.DATA;
|
|
c4c: 80 91 a0 09 lds r24, 0x09A0
|
|
uint8_t Register;
|
|
|
|
MEMORY_FLASH_PORT.OUTCLR = MEMORY_FLASH_CS;
|
|
SPITransferByte(FLASH_CMD_STATUS_REG_READ);
|
|
Register = SPITransferByte(0);
|
|
MEMORY_FLASH_PORT.OUTSET = MEMORY_FLASH_CS;
|
|
c50: 60 93 65 06 sts 0x0665, r22
|
|
MEMORY_FLASH_PORT.OUTSET = MEMORY_FLASH_CS;
|
|
}
|
|
|
|
INLINE void FlashRead(void* Buffer, uint32_t Address, uint16_t ByteCount)
|
|
{
|
|
while(FlashIsBusy());
|
|
c54: 87 ff sbrs r24, 7
|
|
c56: e6 cf rjmp .-52 ; 0xc24 <MemoryReadBlock+0x2c>
|
|
|
|
MEMORY_FLASH_PORT.OUTCLR = MEMORY_FLASH_CS;
|
|
c58: 80 e1 ldi r24, 0x10 ; 16
|
|
c5a: 80 93 66 06 sts 0x0666, r24
|
|
#define FLASH_STATUS_REG_PROTECT_BIT (1<<1)
|
|
#define FLASH_STATUS_REG_PAGESIZE_BIT (1<<0)
|
|
|
|
INLINE uint8_t SPITransferByte(uint8_t Data)
|
|
{
|
|
MEMORY_FLASH_USART.DATA = Data;
|
|
c5e: 83 e0 ldi r24, 0x03 ; 3
|
|
c60: 80 93 a0 09 sts 0x09A0, r24
|
|
|
|
while (!(MEMORY_FLASH_USART.STATUS & USART_TXCIF_bm));
|
|
c64: 80 91 a1 09 lds r24, 0x09A1
|
|
c68: 86 ff sbrs r24, 6
|
|
c6a: fc cf rjmp .-8 ; 0xc64 <MemoryReadBlock+0x6c>
|
|
|
|
MEMORY_FLASH_USART.STATUS = USART_TXCIF_bm;
|
|
c6c: 80 e4 ldi r24, 0x40 ; 64
|
|
c6e: 80 93 a1 09 sts 0x09A1, r24
|
|
|
|
return MEMORY_FLASH_USART.DATA;
|
|
c72: 80 91 a0 09 lds r24, 0x09A0
|
|
{
|
|
while(FlashIsBusy());
|
|
|
|
MEMORY_FLASH_PORT.OUTCLR = MEMORY_FLASH_CS;
|
|
SPITransferByte(0x03);
|
|
SPITransferByte( (Address >> 16) & 0xFF );
|
|
c76: 69 01 movw r12, r18
|
|
c78: ee 24 eor r14, r14
|
|
c7a: ff 24 eor r15, r15
|
|
#define FLASH_STATUS_REG_PROTECT_BIT (1<<1)
|
|
#define FLASH_STATUS_REG_PAGESIZE_BIT (1<<0)
|
|
|
|
INLINE uint8_t SPITransferByte(uint8_t Data)
|
|
{
|
|
MEMORY_FLASH_USART.DATA = Data;
|
|
c7c: c0 92 a0 09 sts 0x09A0, r12
|
|
|
|
while (!(MEMORY_FLASH_USART.STATUS & USART_TXCIF_bm));
|
|
c80: 80 91 a1 09 lds r24, 0x09A1
|
|
c84: 86 ff sbrs r24, 6
|
|
c86: fc cf rjmp .-8 ; 0xc80 <MemoryReadBlock+0x88>
|
|
|
|
MEMORY_FLASH_USART.STATUS = USART_TXCIF_bm;
|
|
c88: 80 e4 ldi r24, 0x40 ; 64
|
|
c8a: 80 93 a1 09 sts 0x09A1, r24
|
|
|
|
return MEMORY_FLASH_USART.DATA;
|
|
c8e: 80 91 a0 09 lds r24, 0x09A0
|
|
while(FlashIsBusy());
|
|
|
|
MEMORY_FLASH_PORT.OUTCLR = MEMORY_FLASH_CS;
|
|
SPITransferByte(0x03);
|
|
SPITransferByte( (Address >> 16) & 0xFF );
|
|
SPITransferByte( (Address >> 8) & 0xFF );
|
|
c92: c1 2e mov r12, r17
|
|
c94: d2 2e mov r13, r18
|
|
c96: e3 2e mov r14, r19
|
|
c98: ff 24 eor r15, r15
|
|
#define FLASH_STATUS_REG_PROTECT_BIT (1<<1)
|
|
#define FLASH_STATUS_REG_PAGESIZE_BIT (1<<0)
|
|
|
|
INLINE uint8_t SPITransferByte(uint8_t Data)
|
|
{
|
|
MEMORY_FLASH_USART.DATA = Data;
|
|
c9a: c0 92 a0 09 sts 0x09A0, r12
|
|
|
|
while (!(MEMORY_FLASH_USART.STATUS & USART_TXCIF_bm));
|
|
c9e: 80 91 a1 09 lds r24, 0x09A1
|
|
ca2: 86 ff sbrs r24, 6
|
|
ca4: fc cf rjmp .-8 ; 0xc9e <MemoryReadBlock+0xa6>
|
|
|
|
MEMORY_FLASH_USART.STATUS = USART_TXCIF_bm;
|
|
ca6: 80 e4 ldi r24, 0x40 ; 64
|
|
ca8: 80 93 a1 09 sts 0x09A1, r24
|
|
|
|
return MEMORY_FLASH_USART.DATA;
|
|
cac: 80 91 a0 09 lds r24, 0x09A0
|
|
#define FLASH_STATUS_REG_PROTECT_BIT (1<<1)
|
|
#define FLASH_STATUS_REG_PAGESIZE_BIT (1<<0)
|
|
|
|
INLINE uint8_t SPITransferByte(uint8_t Data)
|
|
{
|
|
MEMORY_FLASH_USART.DATA = Data;
|
|
cb0: 00 93 a0 09 sts 0x09A0, r16
|
|
|
|
while (!(MEMORY_FLASH_USART.STATUS & USART_TXCIF_bm));
|
|
cb4: 80 91 a1 09 lds r24, 0x09A1
|
|
cb8: 86 ff sbrs r24, 6
|
|
cba: fc cf rjmp .-8 ; 0xcb4 <MemoryReadBlock+0xbc>
|
|
|
|
MEMORY_FLASH_USART.STATUS = USART_TXCIF_bm;
|
|
cbc: 80 e4 ldi r24, 0x40 ; 64
|
|
cbe: 80 93 a1 09 sts 0x09A1, r24
|
|
|
|
return MEMORY_FLASH_USART.DATA;
|
|
cc2: 80 91 a0 09 lds r24, 0x09A0
|
|
|
|
INLINE void SPIReadBlock(void* Buffer, uint16_t ByteCount)
|
|
{
|
|
uint8_t* ByteBuffer = (uint8_t*) Buffer;
|
|
|
|
while(ByteCount-- > 0) {
|
|
cc6: 41 15 cp r20, r1
|
|
cc8: 51 05 cpc r21, r1
|
|
cca: 89 f0 breq .+34 ; 0xcee <MemoryReadBlock+0xf6>
|
|
/* Configure for 256 byte Dataflash if not already done. */
|
|
FlashConfigurePageSize();
|
|
}
|
|
}
|
|
|
|
void MemoryReadBlock(void* Buffer, uint16_t Address, uint16_t ByteCount)
|
|
ccc: 4e 0f add r20, r30
|
|
cce: 5f 1f adc r21, r31
|
|
uint8_t* ByteBuffer = (uint8_t*) Buffer;
|
|
|
|
while(ByteCount-- > 0) {
|
|
MEMORY_FLASH_USART.DATA = 0;
|
|
while (!(MEMORY_FLASH_USART.STATUS & USART_TXCIF_bm));
|
|
MEMORY_FLASH_USART.STATUS = USART_TXCIF_bm;
|
|
cd0: 90 e4 ldi r25, 0x40 ; 64
|
|
INLINE void SPIReadBlock(void* Buffer, uint16_t ByteCount)
|
|
{
|
|
uint8_t* ByteBuffer = (uint8_t*) Buffer;
|
|
|
|
while(ByteCount-- > 0) {
|
|
MEMORY_FLASH_USART.DATA = 0;
|
|
cd2: 10 92 a0 09 sts 0x09A0, r1
|
|
while (!(MEMORY_FLASH_USART.STATUS & USART_TXCIF_bm));
|
|
cd6: 80 91 a1 09 lds r24, 0x09A1
|
|
cda: 86 ff sbrs r24, 6
|
|
cdc: fc cf rjmp .-8 ; 0xcd6 <MemoryReadBlock+0xde>
|
|
MEMORY_FLASH_USART.STATUS = USART_TXCIF_bm;
|
|
cde: 90 93 a1 09 sts 0x09A1, r25
|
|
*ByteBuffer++ = MEMORY_FLASH_USART.DATA;
|
|
ce2: 80 91 a0 09 lds r24, 0x09A0
|
|
ce6: 81 93 st Z+, r24
|
|
|
|
INLINE void SPIReadBlock(void* Buffer, uint16_t ByteCount)
|
|
{
|
|
uint8_t* ByteBuffer = (uint8_t*) Buffer;
|
|
|
|
while(ByteCount-- > 0) {
|
|
ce8: e4 17 cp r30, r20
|
|
cea: f5 07 cpc r31, r21
|
|
cec: 91 f7 brne .-28 ; 0xcd2 <MemoryReadBlock+0xda>
|
|
SPITransferByte(0x03);
|
|
SPITransferByte( (Address >> 16) & 0xFF );
|
|
SPITransferByte( (Address >> 8) & 0xFF );
|
|
SPITransferByte( (Address >> 0) & 0xFF );
|
|
SPIReadBlock(Buffer, ByteCount);
|
|
MEMORY_FLASH_PORT.OUTSET = MEMORY_FLASH_CS;
|
|
cee: 80 e1 ldi r24, 0x10 ; 16
|
|
cf0: 80 93 65 06 sts 0x0665, r24
|
|
|
|
void MemoryReadBlock(void* Buffer, uint16_t Address, uint16_t ByteCount)
|
|
{
|
|
uint32_t FlashAddress = (uint32_t) Address + (uint32_t) GlobalSettings.ActiveSetting * MEMORY_SIZE_PER_SETTING;
|
|
FlashRead(Buffer, FlashAddress, ByteCount);
|
|
}
|
|
cf4: 1f 91 pop r17
|
|
cf6: 0f 91 pop r16
|
|
cf8: ff 90 pop r15
|
|
cfa: ef 90 pop r14
|
|
cfc: df 90 pop r13
|
|
cfe: cf 90 pop r12
|
|
d00: 08 95 ret
|
|
|
|
00000d02 <MemoryWriteBlock>:
|
|
|
|
void MemoryWriteBlock(const void* Buffer, uint16_t Address, uint16_t ByteCount)
|
|
{
|
|
d02: 4f 92 push r4
|
|
d04: 5f 92 push r5
|
|
d06: 6f 92 push r6
|
|
d08: 7f 92 push r7
|
|
d0a: 8f 92 push r8
|
|
d0c: 9f 92 push r9
|
|
d0e: af 92 push r10
|
|
d10: bf 92 push r11
|
|
d12: cf 92 push r12
|
|
d14: df 92 push r13
|
|
d16: ef 92 push r14
|
|
d18: ff 92 push r15
|
|
d1a: 0f 93 push r16
|
|
d1c: 1f 93 push r17
|
|
d1e: cf 93 push r28
|
|
d20: df 93 push r29
|
|
d22: 9c 01 movw r18, r24
|
|
d24: fa 01 movw r30, r20
|
|
uint32_t FlashAddress = (uint32_t) Address + (uint32_t) GlobalSettings.ActiveSetting * MEMORY_SIZE_PER_SETTING;
|
|
d26: 80 91 fd 20 lds r24, 0x20FD
|
|
d2a: 90 e0 ldi r25, 0x00 ; 0
|
|
d2c: a0 e0 ldi r26, 0x00 ; 0
|
|
d2e: b0 e0 ldi r27, 0x00 ; 0
|
|
d30: dc 01 movw r26, r24
|
|
d32: 99 27 eor r25, r25
|
|
d34: 88 27 eor r24, r24
|
|
d36: 86 0f add r24, r22
|
|
d38: 97 1f adc r25, r23
|
|
d3a: a1 1d adc r26, r1
|
|
d3c: b1 1d adc r27, r1
|
|
MEMORY_FLASH_PORT.OUTSET = MEMORY_FLASH_CS;
|
|
}
|
|
|
|
INLINE void FlashWrite(const void* Buffer, uint32_t Address, uint16_t ByteCount)
|
|
{
|
|
while(ByteCount > 0) {
|
|
d3e: 30 97 sbiw r30, 0x00 ; 0
|
|
d40: 09 f4 brne .+2 ; 0xd44 <MemoryWriteBlock+0x42>
|
|
d42: 11 c1 rjmp .+546 ; 0xf66 <MemoryWriteBlock+0x264>
|
|
uint16_t PageAddress = Address / MEMORY_PAGE_SIZE;
|
|
uint8_t ByteAddress = Address % MEMORY_PAGE_SIZE;
|
|
uint16_t PageBytes = MIN(MEMORY_PAGE_SIZE - ByteAddress, ByteCount);
|
|
d44: e1 2c mov r14, r1
|
|
d46: ff 24 eor r15, r15
|
|
d48: f3 94 inc r15
|
|
|
|
INLINE uint8_t FlashReadStatusRegister(void)
|
|
{
|
|
uint8_t Register;
|
|
|
|
MEMORY_FLASH_PORT.OUTCLR = MEMORY_FLASH_CS;
|
|
d4a: 10 e1 ldi r17, 0x10 ; 16
|
|
d4c: c1 2e mov r12, r17
|
|
#define FLASH_STATUS_REG_PROTECT_BIT (1<<1)
|
|
#define FLASH_STATUS_REG_PAGESIZE_BIT (1<<0)
|
|
|
|
INLINE uint8_t SPITransferByte(uint8_t Data)
|
|
{
|
|
MEMORY_FLASH_USART.DATA = Data;
|
|
d4e: 07 ed ldi r16, 0xD7 ; 215
|
|
d50: b0 2e mov r11, r16
|
|
|
|
while (!(MEMORY_FLASH_USART.STATUS & USART_TXCIF_bm));
|
|
|
|
MEMORY_FLASH_USART.STATUS = USART_TXCIF_bm;
|
|
d52: 40 e4 ldi r20, 0x40 ; 64
|
|
d54: d4 2e mov r13, r20
|
|
|
|
INLINE uint8_t FlashReadStatusRegister(void)
|
|
{
|
|
uint8_t Register;
|
|
|
|
MEMORY_FLASH_PORT.OUTCLR = MEMORY_FLASH_CS;
|
|
d56: 50 e1 ldi r21, 0x10 ; 16
|
|
d58: a5 2e mov r10, r21
|
|
#define FLASH_STATUS_REG_PROTECT_BIT (1<<1)
|
|
#define FLASH_STATUS_REG_PAGESIZE_BIT (1<<0)
|
|
|
|
INLINE uint8_t SPITransferByte(uint8_t Data)
|
|
{
|
|
MEMORY_FLASH_USART.DATA = Data;
|
|
d5a: 67 ed ldi r22, 0xD7 ; 215
|
|
d5c: 96 2e mov r9, r22
|
|
d5e: 73 e5 ldi r23, 0x53 ; 83
|
|
d60: 47 2e mov r4, r23
|
|
d62: c4 e8 ldi r28, 0x84 ; 132
|
|
d64: 5c 2e mov r5, r28
|
|
d66: d3 e8 ldi r29, 0x83 ; 131
|
|
d68: 6d 2e mov r6, r29
|
|
}
|
|
|
|
INLINE void FlashWrite(const void* Buffer, uint32_t Address, uint16_t ByteCount)
|
|
{
|
|
while(ByteCount > 0) {
|
|
uint16_t PageAddress = Address / MEMORY_PAGE_SIZE;
|
|
d6a: 49 2f mov r20, r25
|
|
d6c: 5a 2f mov r21, r26
|
|
d6e: 6b 2f mov r22, r27
|
|
d70: 77 27 eor r23, r23
|
|
d72: 85 2e mov r8, r21
|
|
uint8_t ByteAddress = Address % MEMORY_PAGE_SIZE;
|
|
d74: d8 2f mov r29, r24
|
|
uint16_t PageBytes = MIN(MEMORY_PAGE_SIZE - ByteAddress, ByteCount);
|
|
d76: 87 01 movw r16, r14
|
|
d78: 08 1b sub r16, r24
|
|
d7a: 11 09 sbc r17, r1
|
|
d7c: e0 17 cp r30, r16
|
|
d7e: f1 07 cpc r31, r17
|
|
d80: 08 f4 brcc .+2 ; 0xd84 <MemoryWriteBlock+0x82>
|
|
d82: 8f 01 movw r16, r30
|
|
|
|
INLINE uint8_t FlashReadStatusRegister(void)
|
|
{
|
|
uint8_t Register;
|
|
|
|
MEMORY_FLASH_PORT.OUTCLR = MEMORY_FLASH_CS;
|
|
d84: a0 92 66 06 sts 0x0666, r10
|
|
#define FLASH_STATUS_REG_PROTECT_BIT (1<<1)
|
|
#define FLASH_STATUS_REG_PAGESIZE_BIT (1<<0)
|
|
|
|
INLINE uint8_t SPITransferByte(uint8_t Data)
|
|
{
|
|
MEMORY_FLASH_USART.DATA = Data;
|
|
d88: 90 92 a0 09 sts 0x09A0, r9
|
|
|
|
while (!(MEMORY_FLASH_USART.STATUS & USART_TXCIF_bm));
|
|
d8c: c0 91 a1 09 lds r28, 0x09A1
|
|
d90: c6 ff sbrs r28, 6
|
|
d92: fc cf rjmp .-8 ; 0xd8c <MemoryWriteBlock+0x8a>
|
|
|
|
MEMORY_FLASH_USART.STATUS = USART_TXCIF_bm;
|
|
d94: d0 92 a1 09 sts 0x09A1, r13
|
|
|
|
return MEMORY_FLASH_USART.DATA;
|
|
d98: c0 91 a0 09 lds r28, 0x09A0
|
|
#define FLASH_STATUS_REG_PROTECT_BIT (1<<1)
|
|
#define FLASH_STATUS_REG_PAGESIZE_BIT (1<<0)
|
|
|
|
INLINE uint8_t SPITransferByte(uint8_t Data)
|
|
{
|
|
MEMORY_FLASH_USART.DATA = Data;
|
|
d9c: 10 92 a0 09 sts 0x09A0, r1
|
|
|
|
while (!(MEMORY_FLASH_USART.STATUS & USART_TXCIF_bm));
|
|
da0: c0 91 a1 09 lds r28, 0x09A1
|
|
da4: c6 ff sbrs r28, 6
|
|
da6: fc cf rjmp .-8 ; 0xda0 <MemoryWriteBlock+0x9e>
|
|
|
|
MEMORY_FLASH_USART.STATUS = USART_TXCIF_bm;
|
|
da8: d0 92 a1 09 sts 0x09A1, r13
|
|
|
|
return MEMORY_FLASH_USART.DATA;
|
|
dac: c0 91 a0 09 lds r28, 0x09A0
|
|
uint8_t Register;
|
|
|
|
MEMORY_FLASH_PORT.OUTCLR = MEMORY_FLASH_CS;
|
|
SPITransferByte(FLASH_CMD_STATUS_REG_READ);
|
|
Register = SPITransferByte(0);
|
|
MEMORY_FLASH_PORT.OUTSET = MEMORY_FLASH_CS;
|
|
db0: c0 92 65 06 sts 0x0665, r12
|
|
MEMORY_FLASH_PORT.OUTSET = MEMORY_FLASH_CS;
|
|
}
|
|
|
|
INLINE void FlashMemoryToBuffer(uint16_t PageAddress)
|
|
{
|
|
while(FlashIsBusy());
|
|
db4: c7 ff sbrs r28, 7
|
|
db6: e6 cf rjmp .-52 ; 0xd84 <MemoryWriteBlock+0x82>
|
|
|
|
MEMORY_FLASH_PORT.OUTCLR = MEMORY_FLASH_CS;
|
|
db8: a0 92 66 06 sts 0x0666, r10
|
|
#define FLASH_STATUS_REG_PROTECT_BIT (1<<1)
|
|
#define FLASH_STATUS_REG_PAGESIZE_BIT (1<<0)
|
|
|
|
INLINE uint8_t SPITransferByte(uint8_t Data)
|
|
{
|
|
MEMORY_FLASH_USART.DATA = Data;
|
|
dbc: 40 92 a0 09 sts 0x09A0, r4
|
|
|
|
while (!(MEMORY_FLASH_USART.STATUS & USART_TXCIF_bm));
|
|
dc0: c0 91 a1 09 lds r28, 0x09A1
|
|
dc4: c6 ff sbrs r28, 6
|
|
dc6: fc cf rjmp .-8 ; 0xdc0 <MemoryWriteBlock+0xbe>
|
|
|
|
MEMORY_FLASH_USART.STATUS = USART_TXCIF_bm;
|
|
dc8: d0 92 a1 09 sts 0x09A1, r13
|
|
|
|
return MEMORY_FLASH_USART.DATA;
|
|
dcc: c0 91 a0 09 lds r28, 0x09A0
|
|
#define FLASH_STATUS_REG_PROTECT_BIT (1<<1)
|
|
#define FLASH_STATUS_REG_PAGESIZE_BIT (1<<0)
|
|
|
|
INLINE uint8_t SPITransferByte(uint8_t Data)
|
|
{
|
|
MEMORY_FLASH_USART.DATA = Data;
|
|
dd0: 80 92 a0 09 sts 0x09A0, r8
|
|
|
|
while (!(MEMORY_FLASH_USART.STATUS & USART_TXCIF_bm));
|
|
dd4: c0 91 a1 09 lds r28, 0x09A1
|
|
dd8: c6 ff sbrs r28, 6
|
|
dda: fc cf rjmp .-8 ; 0xdd4 <MemoryWriteBlock+0xd2>
|
|
|
|
MEMORY_FLASH_USART.STATUS = USART_TXCIF_bm;
|
|
ddc: d0 92 a1 09 sts 0x09A1, r13
|
|
|
|
return MEMORY_FLASH_USART.DATA;
|
|
de0: c0 91 a0 09 lds r28, 0x09A0
|
|
while(FlashIsBusy());
|
|
|
|
MEMORY_FLASH_PORT.OUTCLR = MEMORY_FLASH_CS;
|
|
SPITransferByte(FLASH_CMD_MEM_TO_BUF1);
|
|
SPITransferByte( (PageAddress >> 8) & 0xFF );
|
|
SPITransferByte( (PageAddress >> 0) & 0xFF );
|
|
de4: 74 2e mov r7, r20
|
|
#define FLASH_STATUS_REG_PROTECT_BIT (1<<1)
|
|
#define FLASH_STATUS_REG_PAGESIZE_BIT (1<<0)
|
|
|
|
INLINE uint8_t SPITransferByte(uint8_t Data)
|
|
{
|
|
MEMORY_FLASH_USART.DATA = Data;
|
|
de6: 40 93 a0 09 sts 0x09A0, r20
|
|
|
|
while (!(MEMORY_FLASH_USART.STATUS & USART_TXCIF_bm));
|
|
dea: 40 91 a1 09 lds r20, 0x09A1
|
|
dee: 46 ff sbrs r20, 6
|
|
df0: fc cf rjmp .-8 ; 0xdea <MemoryWriteBlock+0xe8>
|
|
|
|
MEMORY_FLASH_USART.STATUS = USART_TXCIF_bm;
|
|
df2: d0 92 a1 09 sts 0x09A1, r13
|
|
|
|
return MEMORY_FLASH_USART.DATA;
|
|
df6: 40 91 a0 09 lds r20, 0x09A0
|
|
#define FLASH_STATUS_REG_PROTECT_BIT (1<<1)
|
|
#define FLASH_STATUS_REG_PAGESIZE_BIT (1<<0)
|
|
|
|
INLINE uint8_t SPITransferByte(uint8_t Data)
|
|
{
|
|
MEMORY_FLASH_USART.DATA = Data;
|
|
dfa: 10 92 a0 09 sts 0x09A0, r1
|
|
|
|
while (!(MEMORY_FLASH_USART.STATUS & USART_TXCIF_bm));
|
|
dfe: 40 91 a1 09 lds r20, 0x09A1
|
|
e02: 46 ff sbrs r20, 6
|
|
e04: fc cf rjmp .-8 ; 0xdfe <MemoryWriteBlock+0xfc>
|
|
|
|
MEMORY_FLASH_USART.STATUS = USART_TXCIF_bm;
|
|
e06: d0 92 a1 09 sts 0x09A1, r13
|
|
|
|
return MEMORY_FLASH_USART.DATA;
|
|
e0a: 40 91 a0 09 lds r20, 0x09A0
|
|
MEMORY_FLASH_PORT.OUTCLR = MEMORY_FLASH_CS;
|
|
SPITransferByte(FLASH_CMD_MEM_TO_BUF1);
|
|
SPITransferByte( (PageAddress >> 8) & 0xFF );
|
|
SPITransferByte( (PageAddress >> 0) & 0xFF );
|
|
SPITransferByte( 0 );
|
|
MEMORY_FLASH_PORT.OUTSET = MEMORY_FLASH_CS;
|
|
e0e: c0 92 65 06 sts 0x0665, r12
|
|
|
|
INLINE uint8_t FlashReadStatusRegister(void)
|
|
{
|
|
uint8_t Register;
|
|
|
|
MEMORY_FLASH_PORT.OUTCLR = MEMORY_FLASH_CS;
|
|
e12: c0 92 66 06 sts 0x0666, r12
|
|
#define FLASH_STATUS_REG_PROTECT_BIT (1<<1)
|
|
#define FLASH_STATUS_REG_PAGESIZE_BIT (1<<0)
|
|
|
|
INLINE uint8_t SPITransferByte(uint8_t Data)
|
|
{
|
|
MEMORY_FLASH_USART.DATA = Data;
|
|
e16: b0 92 a0 09 sts 0x09A0, r11
|
|
|
|
while (!(MEMORY_FLASH_USART.STATUS & USART_TXCIF_bm));
|
|
e1a: 40 91 a1 09 lds r20, 0x09A1
|
|
e1e: 46 ff sbrs r20, 6
|
|
e20: fc cf rjmp .-8 ; 0xe1a <MemoryWriteBlock+0x118>
|
|
|
|
MEMORY_FLASH_USART.STATUS = USART_TXCIF_bm;
|
|
e22: d0 92 a1 09 sts 0x09A1, r13
|
|
|
|
return MEMORY_FLASH_USART.DATA;
|
|
e26: 40 91 a0 09 lds r20, 0x09A0
|
|
#define FLASH_STATUS_REG_PROTECT_BIT (1<<1)
|
|
#define FLASH_STATUS_REG_PAGESIZE_BIT (1<<0)
|
|
|
|
INLINE uint8_t SPITransferByte(uint8_t Data)
|
|
{
|
|
MEMORY_FLASH_USART.DATA = Data;
|
|
e2a: 10 92 a0 09 sts 0x09A0, r1
|
|
|
|
while (!(MEMORY_FLASH_USART.STATUS & USART_TXCIF_bm));
|
|
e2e: 40 91 a1 09 lds r20, 0x09A1
|
|
e32: 46 ff sbrs r20, 6
|
|
e34: fc cf rjmp .-8 ; 0xe2e <MemoryWriteBlock+0x12c>
|
|
|
|
MEMORY_FLASH_USART.STATUS = USART_TXCIF_bm;
|
|
e36: d0 92 a1 09 sts 0x09A1, r13
|
|
|
|
return MEMORY_FLASH_USART.DATA;
|
|
e3a: 40 91 a0 09 lds r20, 0x09A0
|
|
uint8_t Register;
|
|
|
|
MEMORY_FLASH_PORT.OUTCLR = MEMORY_FLASH_CS;
|
|
SPITransferByte(FLASH_CMD_STATUS_REG_READ);
|
|
Register = SPITransferByte(0);
|
|
MEMORY_FLASH_PORT.OUTSET = MEMORY_FLASH_CS;
|
|
e3e: c0 92 65 06 sts 0x0665, r12
|
|
MEMORY_FLASH_PORT.OUTSET = MEMORY_FLASH_CS;
|
|
}
|
|
|
|
INLINE void FlashWriteBuffer(const void* Buffer, uint8_t Address, uint16_t ByteCount)
|
|
{
|
|
while(FlashIsBusy());
|
|
e42: 47 ff sbrs r20, 7
|
|
e44: e6 cf rjmp .-52 ; 0xe12 <MemoryWriteBlock+0x110>
|
|
|
|
MEMORY_FLASH_PORT.OUTCLR = MEMORY_FLASH_CS;
|
|
e46: a0 92 66 06 sts 0x0666, r10
|
|
#define FLASH_STATUS_REG_PROTECT_BIT (1<<1)
|
|
#define FLASH_STATUS_REG_PAGESIZE_BIT (1<<0)
|
|
|
|
INLINE uint8_t SPITransferByte(uint8_t Data)
|
|
{
|
|
MEMORY_FLASH_USART.DATA = Data;
|
|
e4a: 50 92 a0 09 sts 0x09A0, r5
|
|
|
|
while (!(MEMORY_FLASH_USART.STATUS & USART_TXCIF_bm));
|
|
e4e: 40 91 a1 09 lds r20, 0x09A1
|
|
e52: 46 ff sbrs r20, 6
|
|
e54: fc cf rjmp .-8 ; 0xe4e <MemoryWriteBlock+0x14c>
|
|
|
|
MEMORY_FLASH_USART.STATUS = USART_TXCIF_bm;
|
|
e56: d0 92 a1 09 sts 0x09A1, r13
|
|
|
|
return MEMORY_FLASH_USART.DATA;
|
|
e5a: 40 91 a0 09 lds r20, 0x09A0
|
|
#define FLASH_STATUS_REG_PROTECT_BIT (1<<1)
|
|
#define FLASH_STATUS_REG_PAGESIZE_BIT (1<<0)
|
|
|
|
INLINE uint8_t SPITransferByte(uint8_t Data)
|
|
{
|
|
MEMORY_FLASH_USART.DATA = Data;
|
|
e5e: 10 92 a0 09 sts 0x09A0, r1
|
|
|
|
while (!(MEMORY_FLASH_USART.STATUS & USART_TXCIF_bm));
|
|
e62: 40 91 a1 09 lds r20, 0x09A1
|
|
e66: 46 ff sbrs r20, 6
|
|
e68: fc cf rjmp .-8 ; 0xe62 <MemoryWriteBlock+0x160>
|
|
|
|
MEMORY_FLASH_USART.STATUS = USART_TXCIF_bm;
|
|
e6a: d0 92 a1 09 sts 0x09A1, r13
|
|
|
|
return MEMORY_FLASH_USART.DATA;
|
|
e6e: 40 91 a0 09 lds r20, 0x09A0
|
|
#define FLASH_STATUS_REG_PROTECT_BIT (1<<1)
|
|
#define FLASH_STATUS_REG_PAGESIZE_BIT (1<<0)
|
|
|
|
INLINE uint8_t SPITransferByte(uint8_t Data)
|
|
{
|
|
MEMORY_FLASH_USART.DATA = Data;
|
|
e72: 10 92 a0 09 sts 0x09A0, r1
|
|
|
|
while (!(MEMORY_FLASH_USART.STATUS & USART_TXCIF_bm));
|
|
e76: 40 91 a1 09 lds r20, 0x09A1
|
|
e7a: 46 ff sbrs r20, 6
|
|
e7c: fc cf rjmp .-8 ; 0xe76 <MemoryWriteBlock+0x174>
|
|
|
|
MEMORY_FLASH_USART.STATUS = USART_TXCIF_bm;
|
|
e7e: d0 92 a1 09 sts 0x09A1, r13
|
|
|
|
return MEMORY_FLASH_USART.DATA;
|
|
e82: 40 91 a0 09 lds r20, 0x09A0
|
|
#define FLASH_STATUS_REG_PROTECT_BIT (1<<1)
|
|
#define FLASH_STATUS_REG_PAGESIZE_BIT (1<<0)
|
|
|
|
INLINE uint8_t SPITransferByte(uint8_t Data)
|
|
{
|
|
MEMORY_FLASH_USART.DATA = Data;
|
|
e86: d0 93 a0 09 sts 0x09A0, r29
|
|
|
|
while (!(MEMORY_FLASH_USART.STATUS & USART_TXCIF_bm));
|
|
e8a: 40 91 a1 09 lds r20, 0x09A1
|
|
e8e: 46 ff sbrs r20, 6
|
|
e90: fc cf rjmp .-8 ; 0xe8a <MemoryWriteBlock+0x188>
|
|
|
|
MEMORY_FLASH_USART.STATUS = USART_TXCIF_bm;
|
|
e92: d0 92 a1 09 sts 0x09A1, r13
|
|
|
|
return MEMORY_FLASH_USART.DATA;
|
|
e96: 40 91 a0 09 lds r20, 0x09A0
|
|
|
|
INLINE void SPIWriteBlock(const void* Buffer, uint16_t ByteCount)
|
|
{
|
|
uint8_t* ByteBuffer = (uint8_t*) Buffer;
|
|
|
|
while(ByteCount-- > 0) {
|
|
e9a: 01 15 cp r16, r1
|
|
e9c: 11 05 cpc r17, r1
|
|
e9e: 91 f0 breq .+36 ; 0xec4 <MemoryWriteBlock+0x1c2>
|
|
{
|
|
uint32_t FlashAddress = (uint32_t) Address + (uint32_t) GlobalSettings.ActiveSetting * MEMORY_SIZE_PER_SETTING;
|
|
FlashRead(Buffer, FlashAddress, ByteCount);
|
|
}
|
|
|
|
void MemoryWriteBlock(const void* Buffer, uint16_t Address, uint16_t ByteCount)
|
|
ea0: a9 01 movw r20, r18
|
|
ea2: 40 0f add r20, r16
|
|
ea4: 51 1f adc r21, r17
|
|
}
|
|
}
|
|
|
|
INLINE void SPIWriteBlock(const void* Buffer, uint16_t ByteCount)
|
|
{
|
|
uint8_t* ByteBuffer = (uint8_t*) Buffer;
|
|
ea6: e9 01 movw r28, r18
|
|
|
|
while(ByteCount-- > 0) {
|
|
MEMORY_FLASH_USART.DATA = *ByteBuffer++;
|
|
ea8: 69 91 ld r22, Y+
|
|
eaa: 60 93 a0 09 sts 0x09A0, r22
|
|
while (!(MEMORY_FLASH_USART.STATUS & USART_TXCIF_bm));
|
|
eae: 60 91 a1 09 lds r22, 0x09A1
|
|
eb2: 66 ff sbrs r22, 6
|
|
eb4: fc cf rjmp .-8 ; 0xeae <MemoryWriteBlock+0x1ac>
|
|
MEMORY_FLASH_USART.STATUS = USART_TXCIF_bm;
|
|
eb6: d0 92 a1 09 sts 0x09A1, r13
|
|
MEMORY_FLASH_USART.DATA; /* Flush Buffer */
|
|
eba: 60 91 a0 09 lds r22, 0x09A0
|
|
|
|
INLINE void SPIWriteBlock(const void* Buffer, uint16_t ByteCount)
|
|
{
|
|
uint8_t* ByteBuffer = (uint8_t*) Buffer;
|
|
|
|
while(ByteCount-- > 0) {
|
|
ebe: c4 17 cp r28, r20
|
|
ec0: d5 07 cpc r29, r21
|
|
ec2: 91 f7 brne .-28 ; 0xea8 <MemoryWriteBlock+0x1a6>
|
|
SPITransferByte(FLASH_CMD_BUF1_WRITE);
|
|
SPITransferByte( 0 );
|
|
SPITransferByte( 0 );
|
|
SPITransferByte( Address );
|
|
SPIWriteBlock(Buffer, ByteCount);
|
|
MEMORY_FLASH_PORT.OUTSET = MEMORY_FLASH_CS;
|
|
ec4: c0 92 65 06 sts 0x0665, r12
|
|
|
|
INLINE uint8_t FlashReadStatusRegister(void)
|
|
{
|
|
uint8_t Register;
|
|
|
|
MEMORY_FLASH_PORT.OUTCLR = MEMORY_FLASH_CS;
|
|
ec8: c0 92 66 06 sts 0x0666, r12
|
|
#define FLASH_STATUS_REG_PROTECT_BIT (1<<1)
|
|
#define FLASH_STATUS_REG_PAGESIZE_BIT (1<<0)
|
|
|
|
INLINE uint8_t SPITransferByte(uint8_t Data)
|
|
{
|
|
MEMORY_FLASH_USART.DATA = Data;
|
|
ecc: b0 92 a0 09 sts 0x09A0, r11
|
|
|
|
while (!(MEMORY_FLASH_USART.STATUS & USART_TXCIF_bm));
|
|
ed0: 40 91 a1 09 lds r20, 0x09A1
|
|
ed4: 46 ff sbrs r20, 6
|
|
ed6: fc cf rjmp .-8 ; 0xed0 <MemoryWriteBlock+0x1ce>
|
|
|
|
MEMORY_FLASH_USART.STATUS = USART_TXCIF_bm;
|
|
ed8: d0 92 a1 09 sts 0x09A1, r13
|
|
|
|
return MEMORY_FLASH_USART.DATA;
|
|
edc: 40 91 a0 09 lds r20, 0x09A0
|
|
#define FLASH_STATUS_REG_PROTECT_BIT (1<<1)
|
|
#define FLASH_STATUS_REG_PAGESIZE_BIT (1<<0)
|
|
|
|
INLINE uint8_t SPITransferByte(uint8_t Data)
|
|
{
|
|
MEMORY_FLASH_USART.DATA = Data;
|
|
ee0: 10 92 a0 09 sts 0x09A0, r1
|
|
|
|
while (!(MEMORY_FLASH_USART.STATUS & USART_TXCIF_bm));
|
|
ee4: 40 91 a1 09 lds r20, 0x09A1
|
|
ee8: 46 ff sbrs r20, 6
|
|
eea: fc cf rjmp .-8 ; 0xee4 <MemoryWriteBlock+0x1e2>
|
|
|
|
MEMORY_FLASH_USART.STATUS = USART_TXCIF_bm;
|
|
eec: d0 92 a1 09 sts 0x09A1, r13
|
|
|
|
return MEMORY_FLASH_USART.DATA;
|
|
ef0: 40 91 a0 09 lds r20, 0x09A0
|
|
uint8_t Register;
|
|
|
|
MEMORY_FLASH_PORT.OUTCLR = MEMORY_FLASH_CS;
|
|
SPITransferByte(FLASH_CMD_STATUS_REG_READ);
|
|
Register = SPITransferByte(0);
|
|
MEMORY_FLASH_PORT.OUTSET = MEMORY_FLASH_CS;
|
|
ef4: c0 92 65 06 sts 0x0665, r12
|
|
MEMORY_FLASH_PORT.OUTSET = MEMORY_FLASH_CS;
|
|
}
|
|
|
|
INLINE void FlashBufferToMemory(uint16_t PageAddress)
|
|
{
|
|
while(FlashIsBusy());
|
|
ef8: 47 ff sbrs r20, 7
|
|
efa: e6 cf rjmp .-52 ; 0xec8 <MemoryWriteBlock+0x1c6>
|
|
|
|
MEMORY_FLASH_PORT.OUTCLR = MEMORY_FLASH_CS;
|
|
efc: a0 92 66 06 sts 0x0666, r10
|
|
#define FLASH_STATUS_REG_PROTECT_BIT (1<<1)
|
|
#define FLASH_STATUS_REG_PAGESIZE_BIT (1<<0)
|
|
|
|
INLINE uint8_t SPITransferByte(uint8_t Data)
|
|
{
|
|
MEMORY_FLASH_USART.DATA = Data;
|
|
f00: 60 92 a0 09 sts 0x09A0, r6
|
|
|
|
while (!(MEMORY_FLASH_USART.STATUS & USART_TXCIF_bm));
|
|
f04: 40 91 a1 09 lds r20, 0x09A1
|
|
f08: 46 ff sbrs r20, 6
|
|
f0a: fc cf rjmp .-8 ; 0xf04 <MemoryWriteBlock+0x202>
|
|
|
|
MEMORY_FLASH_USART.STATUS = USART_TXCIF_bm;
|
|
f0c: d0 92 a1 09 sts 0x09A1, r13
|
|
|
|
return MEMORY_FLASH_USART.DATA;
|
|
f10: 40 91 a0 09 lds r20, 0x09A0
|
|
#define FLASH_STATUS_REG_PROTECT_BIT (1<<1)
|
|
#define FLASH_STATUS_REG_PAGESIZE_BIT (1<<0)
|
|
|
|
INLINE uint8_t SPITransferByte(uint8_t Data)
|
|
{
|
|
MEMORY_FLASH_USART.DATA = Data;
|
|
f14: 80 92 a0 09 sts 0x09A0, r8
|
|
|
|
while (!(MEMORY_FLASH_USART.STATUS & USART_TXCIF_bm));
|
|
f18: 40 91 a1 09 lds r20, 0x09A1
|
|
f1c: 46 ff sbrs r20, 6
|
|
f1e: fc cf rjmp .-8 ; 0xf18 <MemoryWriteBlock+0x216>
|
|
|
|
MEMORY_FLASH_USART.STATUS = USART_TXCIF_bm;
|
|
f20: d0 92 a1 09 sts 0x09A1, r13
|
|
|
|
return MEMORY_FLASH_USART.DATA;
|
|
f24: 40 91 a0 09 lds r20, 0x09A0
|
|
#define FLASH_STATUS_REG_PROTECT_BIT (1<<1)
|
|
#define FLASH_STATUS_REG_PAGESIZE_BIT (1<<0)
|
|
|
|
INLINE uint8_t SPITransferByte(uint8_t Data)
|
|
{
|
|
MEMORY_FLASH_USART.DATA = Data;
|
|
f28: 70 92 a0 09 sts 0x09A0, r7
|
|
|
|
while (!(MEMORY_FLASH_USART.STATUS & USART_TXCIF_bm));
|
|
f2c: 40 91 a1 09 lds r20, 0x09A1
|
|
f30: 46 ff sbrs r20, 6
|
|
f32: fc cf rjmp .-8 ; 0xf2c <MemoryWriteBlock+0x22a>
|
|
|
|
MEMORY_FLASH_USART.STATUS = USART_TXCIF_bm;
|
|
f34: d0 92 a1 09 sts 0x09A1, r13
|
|
|
|
return MEMORY_FLASH_USART.DATA;
|
|
f38: 40 91 a0 09 lds r20, 0x09A0
|
|
#define FLASH_STATUS_REG_PROTECT_BIT (1<<1)
|
|
#define FLASH_STATUS_REG_PAGESIZE_BIT (1<<0)
|
|
|
|
INLINE uint8_t SPITransferByte(uint8_t Data)
|
|
{
|
|
MEMORY_FLASH_USART.DATA = Data;
|
|
f3c: 10 92 a0 09 sts 0x09A0, r1
|
|
|
|
while (!(MEMORY_FLASH_USART.STATUS & USART_TXCIF_bm));
|
|
f40: 40 91 a1 09 lds r20, 0x09A1
|
|
f44: 46 ff sbrs r20, 6
|
|
f46: fc cf rjmp .-8 ; 0xf40 <MemoryWriteBlock+0x23e>
|
|
|
|
MEMORY_FLASH_USART.STATUS = USART_TXCIF_bm;
|
|
f48: d0 92 a1 09 sts 0x09A1, r13
|
|
|
|
return MEMORY_FLASH_USART.DATA;
|
|
f4c: 40 91 a0 09 lds r20, 0x09A0
|
|
MEMORY_FLASH_PORT.OUTCLR = MEMORY_FLASH_CS;
|
|
SPITransferByte(FLASH_CMD_BUF1_TO_MEM_ERASE);
|
|
SPITransferByte( (PageAddress >> 8) & 0xFF );
|
|
SPITransferByte( (PageAddress >> 0) & 0xFF );
|
|
SPITransferByte( 0 );
|
|
MEMORY_FLASH_PORT.OUTSET = MEMORY_FLASH_CS;
|
|
f50: c0 92 65 06 sts 0x0665, r12
|
|
|
|
FlashMemoryToBuffer(PageAddress);
|
|
FlashWriteBuffer(Buffer, ByteAddress, PageBytes);
|
|
FlashBufferToMemory(PageAddress);
|
|
|
|
ByteCount -= PageBytes;
|
|
f54: e0 1b sub r30, r16
|
|
f56: f1 0b sbc r31, r17
|
|
Address += PageBytes;
|
|
f58: 80 0f add r24, r16
|
|
f5a: 91 1f adc r25, r17
|
|
f5c: a1 1d adc r26, r1
|
|
f5e: b1 1d adc r27, r1
|
|
MEMORY_FLASH_PORT.OUTSET = MEMORY_FLASH_CS;
|
|
}
|
|
|
|
INLINE void FlashWrite(const void* Buffer, uint32_t Address, uint16_t ByteCount)
|
|
{
|
|
while(ByteCount > 0) {
|
|
f60: 30 97 sbiw r30, 0x00 ; 0
|
|
f62: 09 f0 breq .+2 ; 0xf66 <MemoryWriteBlock+0x264>
|
|
f64: 02 cf rjmp .-508 ; 0xd6a <MemoryWriteBlock+0x68>
|
|
|
|
void MemoryWriteBlock(const void* Buffer, uint16_t Address, uint16_t ByteCount)
|
|
{
|
|
uint32_t FlashAddress = (uint32_t) Address + (uint32_t) GlobalSettings.ActiveSetting * MEMORY_SIZE_PER_SETTING;
|
|
FlashWrite(Buffer, FlashAddress, ByteCount);
|
|
}
|
|
f66: df 91 pop r29
|
|
f68: cf 91 pop r28
|
|
f6a: 1f 91 pop r17
|
|
f6c: 0f 91 pop r16
|
|
f6e: ff 90 pop r15
|
|
f70: ef 90 pop r14
|
|
f72: df 90 pop r13
|
|
f74: cf 90 pop r12
|
|
f76: bf 90 pop r11
|
|
f78: af 90 pop r10
|
|
f7a: 9f 90 pop r9
|
|
f7c: 8f 90 pop r8
|
|
f7e: 7f 90 pop r7
|
|
f80: 6f 90 pop r6
|
|
f82: 5f 90 pop r5
|
|
f84: 4f 90 pop r4
|
|
f86: 08 95 ret
|
|
|
|
00000f88 <MemoryClear>:
|
|
|
|
void MemoryClear(void)
|
|
{
|
|
uint32_t PageAddress = ((uint32_t) GlobalSettings.ActiveSetting * MEMORY_SIZE_PER_SETTING) / MEMORY_PAGE_SIZE;
|
|
f88: 80 91 fd 20 lds r24, 0x20FD
|
|
f8c: 90 e0 ldi r25, 0x00 ; 0
|
|
f8e: a0 e0 ldi r26, 0x00 ; 0
|
|
f90: b0 e0 ldi r27, 0x00 ; 0
|
|
f92: ba 2f mov r27, r26
|
|
f94: a9 2f mov r26, r25
|
|
f96: 98 2f mov r25, r24
|
|
f98: 88 27 eor r24, r24
|
|
{
|
|
uint32_t FlashAddress = (uint32_t) Address + (uint32_t) GlobalSettings.ActiveSetting * MEMORY_SIZE_PER_SETTING;
|
|
FlashWrite(Buffer, FlashAddress, ByteCount);
|
|
}
|
|
|
|
void MemoryClear(void)
|
|
f9a: 9c 01 movw r18, r24
|
|
f9c: 33 95 inc r19
|
|
|
|
INLINE uint8_t FlashReadStatusRegister(void)
|
|
{
|
|
uint8_t Register;
|
|
|
|
MEMORY_FLASH_PORT.OUTCLR = MEMORY_FLASH_CS;
|
|
f9e: 60 e1 ldi r22, 0x10 ; 16
|
|
#define FLASH_STATUS_REG_PROTECT_BIT (1<<1)
|
|
#define FLASH_STATUS_REG_PAGESIZE_BIT (1<<0)
|
|
|
|
INLINE uint8_t SPITransferByte(uint8_t Data)
|
|
{
|
|
MEMORY_FLASH_USART.DATA = Data;
|
|
fa0: 77 ed ldi r23, 0xD7 ; 215
|
|
|
|
while (!(MEMORY_FLASH_USART.STATUS & USART_TXCIF_bm));
|
|
|
|
MEMORY_FLASH_USART.STATUS = USART_TXCIF_bm;
|
|
fa2: 50 e4 ldi r21, 0x40 ; 64
|
|
#define FLASH_STATUS_REG_PROTECT_BIT (1<<1)
|
|
#define FLASH_STATUS_REG_PAGESIZE_BIT (1<<0)
|
|
|
|
INLINE uint8_t SPITransferByte(uint8_t Data)
|
|
{
|
|
MEMORY_FLASH_USART.DATA = Data;
|
|
fa4: e1 e8 ldi r30, 0x81 ; 129
|
|
|
|
INLINE uint8_t FlashReadStatusRegister(void)
|
|
{
|
|
uint8_t Register;
|
|
|
|
MEMORY_FLASH_PORT.OUTCLR = MEMORY_FLASH_CS;
|
|
fa6: 60 93 66 06 sts 0x0666, r22
|
|
#define FLASH_STATUS_REG_PROTECT_BIT (1<<1)
|
|
#define FLASH_STATUS_REG_PAGESIZE_BIT (1<<0)
|
|
|
|
INLINE uint8_t SPITransferByte(uint8_t Data)
|
|
{
|
|
MEMORY_FLASH_USART.DATA = Data;
|
|
faa: 70 93 a0 09 sts 0x09A0, r23
|
|
|
|
while (!(MEMORY_FLASH_USART.STATUS & USART_TXCIF_bm));
|
|
fae: 40 91 a1 09 lds r20, 0x09A1
|
|
fb2: 46 ff sbrs r20, 6
|
|
fb4: fc cf rjmp .-8 ; 0xfae <MemoryClear+0x26>
|
|
|
|
MEMORY_FLASH_USART.STATUS = USART_TXCIF_bm;
|
|
fb6: 50 93 a1 09 sts 0x09A1, r21
|
|
|
|
return MEMORY_FLASH_USART.DATA;
|
|
fba: 40 91 a0 09 lds r20, 0x09A0
|
|
#define FLASH_STATUS_REG_PROTECT_BIT (1<<1)
|
|
#define FLASH_STATUS_REG_PAGESIZE_BIT (1<<0)
|
|
|
|
INLINE uint8_t SPITransferByte(uint8_t Data)
|
|
{
|
|
MEMORY_FLASH_USART.DATA = Data;
|
|
fbe: 10 92 a0 09 sts 0x09A0, r1
|
|
|
|
while (!(MEMORY_FLASH_USART.STATUS & USART_TXCIF_bm));
|
|
fc2: 40 91 a1 09 lds r20, 0x09A1
|
|
fc6: 46 ff sbrs r20, 6
|
|
fc8: fc cf rjmp .-8 ; 0xfc2 <MemoryClear+0x3a>
|
|
|
|
MEMORY_FLASH_USART.STATUS = USART_TXCIF_bm;
|
|
fca: 50 93 a1 09 sts 0x09A1, r21
|
|
|
|
return MEMORY_FLASH_USART.DATA;
|
|
fce: 40 91 a0 09 lds r20, 0x09A0
|
|
uint8_t Register;
|
|
|
|
MEMORY_FLASH_PORT.OUTCLR = MEMORY_FLASH_CS;
|
|
SPITransferByte(FLASH_CMD_STATUS_REG_READ);
|
|
Register = SPITransferByte(0);
|
|
MEMORY_FLASH_PORT.OUTSET = MEMORY_FLASH_CS;
|
|
fd2: 60 93 65 06 sts 0x0665, r22
|
|
}
|
|
}
|
|
|
|
INLINE void FlashClearPage(uint16_t PageAddress)
|
|
{
|
|
while(FlashIsBusy());
|
|
fd6: 47 ff sbrs r20, 7
|
|
fd8: e6 cf rjmp .-52 ; 0xfa6 <MemoryClear+0x1e>
|
|
|
|
MEMORY_FLASH_PORT.OUTCLR = MEMORY_FLASH_CS;
|
|
fda: 60 93 66 06 sts 0x0666, r22
|
|
#define FLASH_STATUS_REG_PROTECT_BIT (1<<1)
|
|
#define FLASH_STATUS_REG_PAGESIZE_BIT (1<<0)
|
|
|
|
INLINE uint8_t SPITransferByte(uint8_t Data)
|
|
{
|
|
MEMORY_FLASH_USART.DATA = Data;
|
|
fde: e0 93 a0 09 sts 0x09A0, r30
|
|
|
|
while (!(MEMORY_FLASH_USART.STATUS & USART_TXCIF_bm));
|
|
fe2: 40 91 a1 09 lds r20, 0x09A1
|
|
fe6: 46 ff sbrs r20, 6
|
|
fe8: fc cf rjmp .-8 ; 0xfe2 <MemoryClear+0x5a>
|
|
|
|
MEMORY_FLASH_USART.STATUS = USART_TXCIF_bm;
|
|
fea: 50 93 a1 09 sts 0x09A1, r21
|
|
|
|
return MEMORY_FLASH_USART.DATA;
|
|
fee: 40 91 a0 09 lds r20, 0x09A0
|
|
#define FLASH_STATUS_REG_PROTECT_BIT (1<<1)
|
|
#define FLASH_STATUS_REG_PAGESIZE_BIT (1<<0)
|
|
|
|
INLINE uint8_t SPITransferByte(uint8_t Data)
|
|
{
|
|
MEMORY_FLASH_USART.DATA = Data;
|
|
ff2: 90 93 a0 09 sts 0x09A0, r25
|
|
|
|
while (!(MEMORY_FLASH_USART.STATUS & USART_TXCIF_bm));
|
|
ff6: 40 91 a1 09 lds r20, 0x09A1
|
|
ffa: 46 ff sbrs r20, 6
|
|
ffc: fc cf rjmp .-8 ; 0xff6 <MemoryClear+0x6e>
|
|
|
|
MEMORY_FLASH_USART.STATUS = USART_TXCIF_bm;
|
|
ffe: 50 93 a1 09 sts 0x09A1, r21
|
|
|
|
return MEMORY_FLASH_USART.DATA;
|
|
1002: 40 91 a0 09 lds r20, 0x09A0
|
|
#define FLASH_STATUS_REG_PROTECT_BIT (1<<1)
|
|
#define FLASH_STATUS_REG_PAGESIZE_BIT (1<<0)
|
|
|
|
INLINE uint8_t SPITransferByte(uint8_t Data)
|
|
{
|
|
MEMORY_FLASH_USART.DATA = Data;
|
|
1006: 80 93 a0 09 sts 0x09A0, r24
|
|
|
|
while (!(MEMORY_FLASH_USART.STATUS & USART_TXCIF_bm));
|
|
100a: 40 91 a1 09 lds r20, 0x09A1
|
|
100e: 46 ff sbrs r20, 6
|
|
1010: fc cf rjmp .-8 ; 0x100a <MemoryClear+0x82>
|
|
|
|
MEMORY_FLASH_USART.STATUS = USART_TXCIF_bm;
|
|
1012: 50 93 a1 09 sts 0x09A1, r21
|
|
|
|
return MEMORY_FLASH_USART.DATA;
|
|
1016: 40 91 a0 09 lds r20, 0x09A0
|
|
#define FLASH_STATUS_REG_PROTECT_BIT (1<<1)
|
|
#define FLASH_STATUS_REG_PAGESIZE_BIT (1<<0)
|
|
|
|
INLINE uint8_t SPITransferByte(uint8_t Data)
|
|
{
|
|
MEMORY_FLASH_USART.DATA = Data;
|
|
101a: 10 92 a0 09 sts 0x09A0, r1
|
|
|
|
while (!(MEMORY_FLASH_USART.STATUS & USART_TXCIF_bm));
|
|
101e: 40 91 a1 09 lds r20, 0x09A1
|
|
1022: 46 ff sbrs r20, 6
|
|
1024: fc cf rjmp .-8 ; 0x101e <MemoryClear+0x96>
|
|
|
|
MEMORY_FLASH_USART.STATUS = USART_TXCIF_bm;
|
|
1026: 50 93 a1 09 sts 0x09A1, r21
|
|
|
|
return MEMORY_FLASH_USART.DATA;
|
|
102a: 40 91 a0 09 lds r20, 0x09A0
|
|
MEMORY_FLASH_PORT.OUTCLR = MEMORY_FLASH_CS;
|
|
SPITransferByte(FLASH_CMD_PAGE_ERASE);
|
|
SPITransferByte( (PageAddress >> 8) & 0xFF );
|
|
SPITransferByte( (PageAddress >> 0) & 0xFF );
|
|
SPITransferByte( 0 );
|
|
MEMORY_FLASH_PORT.OUTSET = MEMORY_FLASH_CS;
|
|
102e: 60 93 65 06 sts 0x0665, r22
|
|
1032: 01 96 adiw r24, 0x01 ; 1
|
|
void MemoryClear(void)
|
|
{
|
|
uint32_t PageAddress = ((uint32_t) GlobalSettings.ActiveSetting * MEMORY_SIZE_PER_SETTING) / MEMORY_PAGE_SIZE;
|
|
uint16_t PageCount = MEMORY_SIZE_PER_SETTING / MEMORY_PAGE_SIZE;
|
|
|
|
while(PageCount > 0) {
|
|
1034: 82 17 cp r24, r18
|
|
1036: 93 07 cpc r25, r19
|
|
1038: 09 f0 breq .+2 ; 0x103c <MemoryClear+0xb4>
|
|
103a: b5 cf rjmp .-150 ; 0xfa6 <MemoryClear+0x1e>
|
|
FlashClearPage(PageAddress);
|
|
PageCount--;
|
|
PageAddress++;
|
|
}
|
|
}
|
|
103c: 08 95 ret
|
|
|
|
0000103e <MemoryUploadBlock>:
|
|
|
|
bool MemoryUploadBlock(void* Buffer, uint32_t BlockAddress, uint16_t ByteCount)
|
|
{
|
|
103e: cf 92 push r12
|
|
1040: df 92 push r13
|
|
1042: ef 92 push r14
|
|
1044: ff 92 push r15
|
|
1046: 0f 93 push r16
|
|
1048: 1f 93 push r17
|
|
104a: fc 01 movw r30, r24
|
|
104c: cb 01 movw r24, r22
|
|
104e: ba 01 movw r22, r20
|
|
1050: 69 01 movw r12, r18
|
|
if (BlockAddress >= MEMORY_SIZE_PER_SETTING) {
|
|
1052: 61 15 cp r22, r1
|
|
1054: 71 05 cpc r23, r1
|
|
1056: 21 e0 ldi r18, 0x01 ; 1
|
|
1058: 82 07 cpc r24, r18
|
|
105a: 91 05 cpc r25, r1
|
|
105c: 40 f0 brcs .+16 ; 0x106e <MemoryUploadBlock+0x30>
|
|
uint32_t BytesLeft = MEMORY_SIZE_PER_SETTING - BlockAddress;
|
|
ByteCount = MIN(ByteCount, BytesLeft);
|
|
MemoryWriteBlock(Buffer, BlockAddress, ByteCount);
|
|
return true;
|
|
}
|
|
}
|
|
105e: 81 e0 ldi r24, 0x01 ; 1
|
|
1060: 1f 91 pop r17
|
|
1062: 0f 91 pop r16
|
|
1064: ff 90 pop r15
|
|
1066: ef 90 pop r14
|
|
1068: df 90 pop r13
|
|
106a: cf 90 pop r12
|
|
106c: 08 95 ret
|
|
if (BlockAddress >= MEMORY_SIZE_PER_SETTING) {
|
|
/* Prevent writing out of bounds by silently ignoring it */
|
|
return true;
|
|
} else {
|
|
/* Calculate bytes left in memory and start writing */
|
|
uint32_t BytesLeft = MEMORY_SIZE_PER_SETTING - BlockAddress;
|
|
106e: 00 e0 ldi r16, 0x00 ; 0
|
|
1070: 10 e0 ldi r17, 0x00 ; 0
|
|
1072: 21 e0 ldi r18, 0x01 ; 1
|
|
1074: 30 e0 ldi r19, 0x00 ; 0
|
|
1076: 06 1b sub r16, r22
|
|
1078: 17 0b sbc r17, r23
|
|
107a: 28 0b sbc r18, r24
|
|
107c: 39 0b sbc r19, r25
|
|
ByteCount = MIN(ByteCount, BytesLeft);
|
|
107e: e1 2c mov r14, r1
|
|
1080: f1 2c mov r15, r1
|
|
1082: 0c 15 cp r16, r12
|
|
1084: 1d 05 cpc r17, r13
|
|
1086: 2e 05 cpc r18, r14
|
|
1088: 3f 05 cpc r19, r15
|
|
108a: 58 f0 brcs .+22 ; 0x10a2 <MemoryUploadBlock+0x64>
|
|
MemoryWriteBlock(Buffer, BlockAddress, ByteCount);
|
|
108c: a6 01 movw r20, r12
|
|
108e: cf 01 movw r24, r30
|
|
1090: 38 de rcall .-912 ; 0xd02 <MemoryWriteBlock>
|
|
return true;
|
|
}
|
|
}
|
|
1092: 81 e0 ldi r24, 0x01 ; 1
|
|
1094: 1f 91 pop r17
|
|
1096: 0f 91 pop r16
|
|
1098: ff 90 pop r15
|
|
109a: ef 90 pop r14
|
|
109c: df 90 pop r13
|
|
109e: cf 90 pop r12
|
|
10a0: 08 95 ret
|
|
/* Prevent writing out of bounds by silently ignoring it */
|
|
return true;
|
|
} else {
|
|
/* Calculate bytes left in memory and start writing */
|
|
uint32_t BytesLeft = MEMORY_SIZE_PER_SETTING - BlockAddress;
|
|
ByteCount = MIN(ByteCount, BytesLeft);
|
|
10a2: 68 01 movw r12, r16
|
|
10a4: 79 01 movw r14, r18
|
|
MemoryWriteBlock(Buffer, BlockAddress, ByteCount);
|
|
10a6: a6 01 movw r20, r12
|
|
10a8: cf 01 movw r24, r30
|
|
10aa: 2b de rcall .-938 ; 0xd02 <MemoryWriteBlock>
|
|
10ac: f2 cf rjmp .-28 ; 0x1092 <MemoryUploadBlock+0x54>
|
|
|
|
000010ae <MemoryDownloadBlock>:
|
|
return true;
|
|
}
|
|
}
|
|
|
|
bool MemoryDownloadBlock(void* Buffer, uint32_t BlockAddress, uint16_t ByteCount)
|
|
{
|
|
10ae: cf 92 push r12
|
|
10b0: df 92 push r13
|
|
10b2: ef 92 push r14
|
|
10b4: ff 92 push r15
|
|
10b6: 0f 93 push r16
|
|
10b8: 1f 93 push r17
|
|
10ba: fc 01 movw r30, r24
|
|
10bc: cb 01 movw r24, r22
|
|
10be: ba 01 movw r22, r20
|
|
10c0: 69 01 movw r12, r18
|
|
if (BlockAddress >= MEMORY_SIZE_PER_SETTING) {
|
|
10c2: 61 15 cp r22, r1
|
|
10c4: 71 05 cpc r23, r1
|
|
10c6: 21 e0 ldi r18, 0x01 ; 1
|
|
10c8: 82 07 cpc r24, r18
|
|
10ca: 91 05 cpc r25, r1
|
|
10cc: 40 f0 brcs .+16 ; 0x10de <MemoryDownloadBlock+0x30>
|
|
/* There are bytes out of bounds to be read. Notify that we are done. */
|
|
return false;
|
|
10ce: 80 e0 ldi r24, 0x00 ; 0
|
|
uint32_t BytesLeft = MEMORY_SIZE_PER_SETTING - BlockAddress;
|
|
ByteCount = MIN(ByteCount, BytesLeft);
|
|
MemoryReadBlock(Buffer, BlockAddress, ByteCount);
|
|
return true;
|
|
}
|
|
}
|
|
10d0: 1f 91 pop r17
|
|
10d2: 0f 91 pop r16
|
|
10d4: ff 90 pop r15
|
|
10d6: ef 90 pop r14
|
|
10d8: df 90 pop r13
|
|
10da: cf 90 pop r12
|
|
10dc: 08 95 ret
|
|
if (BlockAddress >= MEMORY_SIZE_PER_SETTING) {
|
|
/* There are bytes out of bounds to be read. Notify that we are done. */
|
|
return false;
|
|
} else {
|
|
/* Calculate bytes left in memory and issue reading */
|
|
uint32_t BytesLeft = MEMORY_SIZE_PER_SETTING - BlockAddress;
|
|
10de: 00 e0 ldi r16, 0x00 ; 0
|
|
10e0: 10 e0 ldi r17, 0x00 ; 0
|
|
10e2: 21 e0 ldi r18, 0x01 ; 1
|
|
10e4: 30 e0 ldi r19, 0x00 ; 0
|
|
10e6: 06 1b sub r16, r22
|
|
10e8: 17 0b sbc r17, r23
|
|
10ea: 28 0b sbc r18, r24
|
|
10ec: 39 0b sbc r19, r25
|
|
ByteCount = MIN(ByteCount, BytesLeft);
|
|
10ee: e1 2c mov r14, r1
|
|
10f0: f1 2c mov r15, r1
|
|
10f2: 0c 15 cp r16, r12
|
|
10f4: 1d 05 cpc r17, r13
|
|
10f6: 2e 05 cpc r18, r14
|
|
10f8: 3f 05 cpc r19, r15
|
|
10fa: 58 f0 brcs .+22 ; 0x1112 <MemoryDownloadBlock+0x64>
|
|
MemoryReadBlock(Buffer, BlockAddress, ByteCount);
|
|
10fc: a6 01 movw r20, r12
|
|
10fe: cf 01 movw r24, r30
|
|
1100: 7b dd rcall .-1290 ; 0xbf8 <MemoryReadBlock>
|
|
return true;
|
|
1102: 81 e0 ldi r24, 0x01 ; 1
|
|
}
|
|
}
|
|
1104: 1f 91 pop r17
|
|
1106: 0f 91 pop r16
|
|
1108: ff 90 pop r15
|
|
110a: ef 90 pop r14
|
|
110c: df 90 pop r13
|
|
110e: cf 90 pop r12
|
|
1110: 08 95 ret
|
|
/* There are bytes out of bounds to be read. Notify that we are done. */
|
|
return false;
|
|
} else {
|
|
/* Calculate bytes left in memory and issue reading */
|
|
uint32_t BytesLeft = MEMORY_SIZE_PER_SETTING - BlockAddress;
|
|
ByteCount = MIN(ByteCount, BytesLeft);
|
|
1112: 68 01 movw r12, r16
|
|
1114: 79 01 movw r14, r18
|
|
MemoryReadBlock(Buffer, BlockAddress, ByteCount);
|
|
1116: a6 01 movw r20, r12
|
|
1118: cf 01 movw r24, r30
|
|
111a: 6e dd rcall .-1316 ; 0xbf8 <MemoryReadBlock>
|
|
return true;
|
|
111c: 81 e0 ldi r24, 0x01 ; 1
|
|
111e: f2 cf rjmp .-28 ; 0x1104 <MemoryDownloadBlock+0x56>
|
|
|
|
00001120 <ButtonInit>:
|
|
[BUTTON_ACTION_CYCLE_SETTINGS] = "CYCLE_SETTINGS"
|
|
};
|
|
|
|
void ButtonInit(void)
|
|
{
|
|
BUTTON_PORT.DIRCLR = BUTTON_MASK;
|
|
1120: e0 e0 ldi r30, 0x00 ; 0
|
|
1122: f6 e0 ldi r31, 0x06 ; 6
|
|
1124: 80 e4 ldi r24, 0x40 ; 64
|
|
1126: 82 83 std Z+2, r24 ; 0x02
|
|
BUTTON_PORT.BUTTON_PINCTRL = PORT_OPC_PULLUP_gc;
|
|
1128: 88 e1 ldi r24, 0x18 ; 24
|
|
112a: 86 8b std Z+22, r24 ; 0x16
|
|
112c: 08 95 ret
|
|
|
|
0000112e <ButtonTick>:
|
|
}
|
|
|
|
void ButtonTick(void)
|
|
{
|
|
112e: ff 92 push r15
|
|
1130: 0f 93 push r16
|
|
1132: 1f 93 push r17
|
|
1134: cf 93 push r28
|
|
1136: df 93 push r29
|
|
1138: cd b7 in r28, 0x3d ; 61
|
|
113a: de b7 in r29, 0x3e ; 62
|
|
113c: a0 97 sbiw r28, 0x20 ; 32
|
|
113e: cd bf out 0x3d, r28 ; 61
|
|
1140: de bf out 0x3e, r29 ; 62
|
|
static uint8_t LastButtonState = 0;
|
|
uint8_t ThisButtonState = ~BUTTON_PORT.IN;
|
|
1142: 80 91 08 06 lds r24, 0x0608
|
|
1146: 80 95 com r24
|
|
uint8_t ThisButtonChange = ThisButtonState ^ LastButtonState;
|
|
1148: 90 91 92 20 lds r25, 0x2092
|
|
114c: 98 27 eor r25, r24
|
|
uint8_t ThisButtonPress = ThisButtonChange & ThisButtonState;
|
|
LastButtonState = ThisButtonState;
|
|
114e: 80 93 92 20 sts 0x2092, r24
|
|
void ButtonTick(void)
|
|
{
|
|
static uint8_t LastButtonState = 0;
|
|
uint8_t ThisButtonState = ~BUTTON_PORT.IN;
|
|
uint8_t ThisButtonChange = ThisButtonState ^ LastButtonState;
|
|
uint8_t ThisButtonPress = ThisButtonChange & ThisButtonState;
|
|
1152: 80 74 andi r24, 0x40 ; 64
|
|
LastButtonState = ThisButtonState;
|
|
|
|
if ( ThisButtonPress & BUTTON_MASK ) {
|
|
1154: 89 23 and r24, r25
|
|
1156: a9 f0 breq .+42 ; 0x1182 <ButtonTick+0x54>
|
|
uint8_t UidBuffer[32];
|
|
ButtonActionEnum ButtonAction = GlobalSettings.ActiveSettingPtr->ButtonAction;
|
|
1158: e0 91 fe 20 lds r30, 0x20FE
|
|
115c: f0 91 ff 20 lds r31, 0x20FF
|
|
1160: 80 81 ld r24, Z
|
|
|
|
if (ButtonAction == BUTTON_ACTION_UID_RANDOM) {
|
|
1162: 81 30 cpi r24, 0x01 ; 1
|
|
1164: b9 f0 breq .+46 ; 0x1194 <ButtonTick+0x66>
|
|
for (uint8_t i=0; i<ActiveConfiguration.UidSize; i++) {
|
|
UidBuffer[i] = RandomGetByte();
|
|
}
|
|
|
|
ApplicationSetUid(UidBuffer);
|
|
} else if (ButtonAction == BUTTON_ACTION_UID_LEFT_INCREMENT) {
|
|
1166: 82 30 cpi r24, 0x02 ; 2
|
|
1168: 79 f1 breq .+94 ; 0x11c8 <ButtonTick+0x9a>
|
|
UidBuffer[i] = (UidBuffer[i] + 1) & 0xFF;
|
|
}
|
|
}
|
|
|
|
ApplicationSetUid(UidBuffer);
|
|
} else if (ButtonAction == BUTTON_ACTION_UID_RIGHT_INCREMENT) {
|
|
116a: 83 30 cpi r24, 0x03 ; 3
|
|
116c: 09 f4 brne .+2 ; 0x1170 <ButtonTick+0x42>
|
|
116e: 4e c0 rjmp .+156 ; 0x120c <ButtonTick+0xde>
|
|
UidBuffer[i] = (UidBuffer[i] + 1) & 0xFF;
|
|
}
|
|
}
|
|
|
|
ApplicationSetUid(UidBuffer);
|
|
} else if (ButtonAction == BUTTON_ACTION_UID_LEFT_DECREMENT) {
|
|
1170: 84 30 cpi r24, 0x04 ; 4
|
|
1172: 09 f4 brne .+2 ; 0x1176 <ButtonTick+0x48>
|
|
1174: 6f c0 rjmp .+222 ; 0x1254 <ButtonTick+0x126>
|
|
UidBuffer[i] = (UidBuffer[i] - 1) & 0xFF;
|
|
}
|
|
}
|
|
|
|
ApplicationSetUid(UidBuffer);
|
|
} else if (ButtonAction == BUTTON_ACTION_UID_RIGHT_DECREMENT) {
|
|
1176: 85 30 cpi r24, 0x05 ; 5
|
|
1178: 09 f4 brne .+2 ; 0x117c <ButtonTick+0x4e>
|
|
117a: 8e c0 rjmp .+284 ; 0x1298 <ButtonTick+0x16a>
|
|
UidBuffer[i] = (UidBuffer[i] - 1) & 0xFF;
|
|
}
|
|
}
|
|
|
|
ApplicationSetUid(UidBuffer);
|
|
} else if (ButtonAction == BUTTON_ACTION_CYCLE_SETTINGS) {
|
|
117c: 86 30 cpi r24, 0x06 ; 6
|
|
117e: 09 f4 brne .+2 ; 0x1182 <ButtonTick+0x54>
|
|
1180: 67 c0 rjmp .+206 ; 0x1250 <ButtonTick+0x122>
|
|
SettingsCycle();
|
|
}
|
|
}
|
|
}
|
|
1182: a0 96 adiw r28, 0x20 ; 32
|
|
1184: cd bf out 0x3d, r28 ; 61
|
|
1186: de bf out 0x3e, r29 ; 62
|
|
1188: df 91 pop r29
|
|
118a: cf 91 pop r28
|
|
118c: 1f 91 pop r17
|
|
118e: 0f 91 pop r16
|
|
1190: ff 90 pop r15
|
|
1192: 08 95 ret
|
|
if ( ThisButtonPress & BUTTON_MASK ) {
|
|
uint8_t UidBuffer[32];
|
|
ButtonActionEnum ButtonAction = GlobalSettings.ActiveSettingPtr->ButtonAction;
|
|
|
|
if (ButtonAction == BUTTON_ACTION_UID_RANDOM) {
|
|
for (uint8_t i=0; i<ActiveConfiguration.UidSize; i++) {
|
|
1194: 80 91 fb 20 lds r24, 0x20FB
|
|
1198: 88 23 and r24, r24
|
|
119a: 09 f4 brne .+2 ; 0x119e <ButtonTick+0x70>
|
|
119c: 9f c0 rjmp .+318 ; 0x12dc <ButtonTick+0x1ae>
|
|
119e: f1 2c mov r15, r1
|
|
11a0: 8e 01 movw r16, r28
|
|
11a2: 0f 5f subi r16, 0xFF ; 255
|
|
11a4: 1f 4f sbci r17, 0xFF ; 255
|
|
UidBuffer[i] = RandomGetByte();
|
|
11a6: 08 dc rcall .-2032 ; 0x9b8 <RandomGetByte>
|
|
11a8: f8 01 movw r30, r16
|
|
11aa: ef 0d add r30, r15
|
|
11ac: f1 1d adc r31, r1
|
|
11ae: 80 83 st Z, r24
|
|
if ( ThisButtonPress & BUTTON_MASK ) {
|
|
uint8_t UidBuffer[32];
|
|
ButtonActionEnum ButtonAction = GlobalSettings.ActiveSettingPtr->ButtonAction;
|
|
|
|
if (ButtonAction == BUTTON_ACTION_UID_RANDOM) {
|
|
for (uint8_t i=0; i<ActiveConfiguration.UidSize; i++) {
|
|
11b0: f3 94 inc r15
|
|
11b2: 80 91 fb 20 lds r24, 0x20FB
|
|
11b6: f8 16 cp r15, r24
|
|
11b8: b0 f3 brcs .-20 ; 0x11a6 <ButtonTick+0x78>
|
|
INLINE void ApplicationGetUid(ConfigurationUidType Uid) {
|
|
ActiveConfiguration.ApplicationGetUidFunc(Uid);
|
|
}
|
|
|
|
INLINE void ApplicationSetUid(ConfigurationUidType Uid) {
|
|
ActiveConfiguration.ApplicationSetUidFunc(Uid);
|
|
11ba: e0 91 f7 20 lds r30, 0x20F7
|
|
11be: f0 91 f8 20 lds r31, 0x20F8
|
|
11c2: c8 01 movw r24, r16
|
|
11c4: 09 95 icall
|
|
11c6: dd cf rjmp .-70 ; 0x1182 <ButtonTick+0x54>
|
|
INLINE void ApplicationReset(void) {
|
|
ActiveConfiguration.ApplicationResetFunc();
|
|
}
|
|
|
|
INLINE void ApplicationGetUid(ConfigurationUidType Uid) {
|
|
ActiveConfiguration.ApplicationGetUidFunc(Uid);
|
|
11c8: e0 91 f5 20 lds r30, 0x20F5
|
|
11cc: f0 91 f6 20 lds r31, 0x20F6
|
|
11d0: 8e 01 movw r16, r28
|
|
11d2: 0f 5f subi r16, 0xFF ; 255
|
|
11d4: 1f 4f sbci r17, 0xFF ; 255
|
|
11d6: c8 01 movw r24, r16
|
|
11d8: 09 95 icall
|
|
} else if (ButtonAction == BUTTON_ACTION_UID_LEFT_INCREMENT) {
|
|
ApplicationGetUid(UidBuffer);
|
|
bool Carry = 1;
|
|
uint8_t i;
|
|
|
|
for (i=0; i<ActiveConfiguration.UidSize; i++) {
|
|
11da: 20 91 fb 20 lds r18, 0x20FB
|
|
11de: 22 23 and r18, r18
|
|
11e0: 61 f3 breq .-40 ; 0x11ba <ButtonTick+0x8c>
|
|
11e2: f8 01 movw r30, r16
|
|
{
|
|
BUTTON_PORT.DIRCLR = BUTTON_MASK;
|
|
BUTTON_PORT.BUTTON_PINCTRL = PORT_OPC_PULLUP_gc;
|
|
}
|
|
|
|
void ButtonTick(void)
|
|
11e4: ce 01 movw r24, r28
|
|
11e6: 02 96 adiw r24, 0x02 ; 2
|
|
11e8: 21 50 subi r18, 0x01 ; 1
|
|
11ea: 82 0f add r24, r18
|
|
11ec: 91 1d adc r25, r1
|
|
}
|
|
|
|
ApplicationSetUid(UidBuffer);
|
|
} else if (ButtonAction == BUTTON_ACTION_UID_LEFT_INCREMENT) {
|
|
ApplicationGetUid(UidBuffer);
|
|
bool Carry = 1;
|
|
11ee: 21 e0 ldi r18, 0x01 ; 1
|
|
uint8_t i;
|
|
|
|
for (i=0; i<ActiveConfiguration.UidSize; i++) {
|
|
if (Carry) {
|
|
11f0: 22 23 and r18, r18
|
|
11f2: 39 f0 breq .+14 ; 0x1202 <ButtonTick+0xd4>
|
|
if (UidBuffer[i] == 0xFF) {
|
|
11f4: 30 81 ld r19, Z
|
|
11f6: 21 e0 ldi r18, 0x01 ; 1
|
|
11f8: 3f 3f cpi r19, 0xFF ; 255
|
|
11fa: 09 f0 breq .+2 ; 0x11fe <ButtonTick+0xd0>
|
|
11fc: 20 e0 ldi r18, 0x00 ; 0
|
|
Carry = 1;
|
|
} else {
|
|
Carry = 0;
|
|
}
|
|
|
|
UidBuffer[i] = (UidBuffer[i] + 1) & 0xFF;
|
|
11fe: 3f 5f subi r19, 0xFF ; 255
|
|
1200: 30 83 st Z, r19
|
|
1202: 31 96 adiw r30, 0x01 ; 1
|
|
} else if (ButtonAction == BUTTON_ACTION_UID_LEFT_INCREMENT) {
|
|
ApplicationGetUid(UidBuffer);
|
|
bool Carry = 1;
|
|
uint8_t i;
|
|
|
|
for (i=0; i<ActiveConfiguration.UidSize; i++) {
|
|
1204: e8 17 cp r30, r24
|
|
1206: f9 07 cpc r31, r25
|
|
1208: 99 f7 brne .-26 ; 0x11f0 <ButtonTick+0xc2>
|
|
120a: d7 cf rjmp .-82 ; 0x11ba <ButtonTick+0x8c>
|
|
120c: e0 91 f5 20 lds r30, 0x20F5
|
|
1210: f0 91 f6 20 lds r31, 0x20F6
|
|
1214: 8e 01 movw r16, r28
|
|
1216: 0f 5f subi r16, 0xFF ; 255
|
|
1218: 1f 4f sbci r17, 0xFF ; 255
|
|
121a: c8 01 movw r24, r16
|
|
121c: 09 95 icall
|
|
|
|
ApplicationSetUid(UidBuffer);
|
|
} else if (ButtonAction == BUTTON_ACTION_UID_RIGHT_INCREMENT) {
|
|
ApplicationGetUid(UidBuffer);
|
|
bool Carry = 1;
|
|
uint8_t i = ActiveConfiguration.UidSize;
|
|
121e: 20 91 fb 20 lds r18, 0x20FB
|
|
}
|
|
|
|
ApplicationSetUid(UidBuffer);
|
|
} else if (ButtonAction == BUTTON_ACTION_UID_RIGHT_INCREMENT) {
|
|
ApplicationGetUid(UidBuffer);
|
|
bool Carry = 1;
|
|
1222: 31 e0 ldi r19, 0x01 ; 1
|
|
uint8_t i = ActiveConfiguration.UidSize;
|
|
|
|
while(i-- > 0) {
|
|
1224: 21 50 subi r18, 0x01 ; 1
|
|
1226: 48 f2 brcs .-110 ; 0x11ba <ButtonTick+0x8c>
|
|
if (Carry) {
|
|
1228: 33 23 and r19, r19
|
|
122a: e1 f3 breq .-8 ; 0x1224 <ButtonTick+0xf6>
|
|
if (UidBuffer[i] == 0xFF) {
|
|
122c: 82 2f mov r24, r18
|
|
122e: 90 e0 ldi r25, 0x00 ; 0
|
|
1230: f8 01 movw r30, r16
|
|
1232: e8 0f add r30, r24
|
|
1234: f9 1f adc r31, r25
|
|
1236: 40 81 ld r20, Z
|
|
1238: 31 e0 ldi r19, 0x01 ; 1
|
|
123a: 4f 3f cpi r20, 0xFF ; 255
|
|
123c: 09 f0 breq .+2 ; 0x1240 <ButtonTick+0x112>
|
|
123e: 30 e0 ldi r19, 0x00 ; 0
|
|
Carry = 1;
|
|
} else {
|
|
Carry = 0;
|
|
}
|
|
|
|
UidBuffer[i] = (UidBuffer[i] + 1) & 0xFF;
|
|
1240: f8 01 movw r30, r16
|
|
1242: e8 0f add r30, r24
|
|
1244: f9 1f adc r31, r25
|
|
1246: 4f 5f subi r20, 0xFF ; 255
|
|
1248: 40 83 st Z, r20
|
|
} else if (ButtonAction == BUTTON_ACTION_UID_RIGHT_INCREMENT) {
|
|
ApplicationGetUid(UidBuffer);
|
|
bool Carry = 1;
|
|
uint8_t i = ActiveConfiguration.UidSize;
|
|
|
|
while(i-- > 0) {
|
|
124a: 21 50 subi r18, 0x01 ; 1
|
|
124c: 68 f7 brcc .-38 ; 0x1228 <ButtonTick+0xfa>
|
|
124e: b5 cf rjmp .-150 ; 0x11ba <ButtonTick+0x8c>
|
|
}
|
|
}
|
|
|
|
ApplicationSetUid(UidBuffer);
|
|
} else if (ButtonAction == BUTTON_ACTION_CYCLE_SETTINGS) {
|
|
SettingsCycle();
|
|
1250: f7 d0 rcall .+494 ; 0x1440 <SettingsCycle>
|
|
1252: 97 cf rjmp .-210 ; 0x1182 <ButtonTick+0x54>
|
|
1254: e0 91 f5 20 lds r30, 0x20F5
|
|
1258: f0 91 f6 20 lds r31, 0x20F6
|
|
125c: 8e 01 movw r16, r28
|
|
125e: 0f 5f subi r16, 0xFF ; 255
|
|
1260: 1f 4f sbci r17, 0xFF ; 255
|
|
1262: c8 01 movw r24, r16
|
|
1264: 09 95 icall
|
|
} else if (ButtonAction == BUTTON_ACTION_UID_LEFT_DECREMENT) {
|
|
ApplicationGetUid(UidBuffer);
|
|
bool Carry = 1;
|
|
uint8_t i;
|
|
|
|
for (i=0; i<ActiveConfiguration.UidSize; i++) {
|
|
1266: 20 91 fb 20 lds r18, 0x20FB
|
|
126a: 22 23 and r18, r18
|
|
126c: 09 f4 brne .+2 ; 0x1270 <ButtonTick+0x142>
|
|
126e: a5 cf rjmp .-182 ; 0x11ba <ButtonTick+0x8c>
|
|
1270: f8 01 movw r30, r16
|
|
{
|
|
BUTTON_PORT.DIRCLR = BUTTON_MASK;
|
|
BUTTON_PORT.BUTTON_PINCTRL = PORT_OPC_PULLUP_gc;
|
|
}
|
|
|
|
void ButtonTick(void)
|
|
1272: ce 01 movw r24, r28
|
|
1274: 02 96 adiw r24, 0x02 ; 2
|
|
1276: 21 50 subi r18, 0x01 ; 1
|
|
1278: 82 0f add r24, r18
|
|
127a: 91 1d adc r25, r1
|
|
}
|
|
|
|
ApplicationSetUid(UidBuffer);
|
|
} else if (ButtonAction == BUTTON_ACTION_UID_LEFT_DECREMENT) {
|
|
ApplicationGetUid(UidBuffer);
|
|
bool Carry = 1;
|
|
127c: 21 e0 ldi r18, 0x01 ; 1
|
|
uint8_t i;
|
|
|
|
for (i=0; i<ActiveConfiguration.UidSize; i++) {
|
|
if (Carry) {
|
|
127e: 22 23 and r18, r18
|
|
1280: 31 f0 breq .+12 ; 0x128e <ButtonTick+0x160>
|
|
if (UidBuffer[i] == 0x00) {
|
|
1282: 30 81 ld r19, Z
|
|
1284: 21 e0 ldi r18, 0x01 ; 1
|
|
1286: 31 11 cpse r19, r1
|
|
1288: 20 e0 ldi r18, 0x00 ; 0
|
|
Carry = 1;
|
|
} else {
|
|
Carry = 0;
|
|
}
|
|
|
|
UidBuffer[i] = (UidBuffer[i] - 1) & 0xFF;
|
|
128a: 31 50 subi r19, 0x01 ; 1
|
|
128c: 30 83 st Z, r19
|
|
128e: 31 96 adiw r30, 0x01 ; 1
|
|
} else if (ButtonAction == BUTTON_ACTION_UID_LEFT_DECREMENT) {
|
|
ApplicationGetUid(UidBuffer);
|
|
bool Carry = 1;
|
|
uint8_t i;
|
|
|
|
for (i=0; i<ActiveConfiguration.UidSize; i++) {
|
|
1290: e8 17 cp r30, r24
|
|
1292: f9 07 cpc r31, r25
|
|
1294: a1 f7 brne .-24 ; 0x127e <ButtonTick+0x150>
|
|
1296: 91 cf rjmp .-222 ; 0x11ba <ButtonTick+0x8c>
|
|
1298: e0 91 f5 20 lds r30, 0x20F5
|
|
129c: f0 91 f6 20 lds r31, 0x20F6
|
|
12a0: 8e 01 movw r16, r28
|
|
12a2: 0f 5f subi r16, 0xFF ; 255
|
|
12a4: 1f 4f sbci r17, 0xFF ; 255
|
|
12a6: c8 01 movw r24, r16
|
|
12a8: 09 95 icall
|
|
|
|
ApplicationSetUid(UidBuffer);
|
|
} else if (ButtonAction == BUTTON_ACTION_UID_RIGHT_DECREMENT) {
|
|
ApplicationGetUid(UidBuffer);
|
|
bool Carry = 1;
|
|
uint8_t i = ActiveConfiguration.UidSize;
|
|
12aa: 20 91 fb 20 lds r18, 0x20FB
|
|
}
|
|
|
|
ApplicationSetUid(UidBuffer);
|
|
} else if (ButtonAction == BUTTON_ACTION_UID_RIGHT_DECREMENT) {
|
|
ApplicationGetUid(UidBuffer);
|
|
bool Carry = 1;
|
|
12ae: 31 e0 ldi r19, 0x01 ; 1
|
|
uint8_t i = ActiveConfiguration.UidSize;
|
|
|
|
while(i-- > 0) {
|
|
12b0: 21 50 subi r18, 0x01 ; 1
|
|
12b2: 08 f4 brcc .+2 ; 0x12b6 <ButtonTick+0x188>
|
|
12b4: 82 cf rjmp .-252 ; 0x11ba <ButtonTick+0x8c>
|
|
if (Carry) {
|
|
12b6: 33 23 and r19, r19
|
|
12b8: d9 f3 breq .-10 ; 0x12b0 <ButtonTick+0x182>
|
|
if (UidBuffer[i] == 0x00) {
|
|
12ba: 82 2f mov r24, r18
|
|
12bc: 90 e0 ldi r25, 0x00 ; 0
|
|
12be: f8 01 movw r30, r16
|
|
12c0: e8 0f add r30, r24
|
|
12c2: f9 1f adc r31, r25
|
|
12c4: 40 81 ld r20, Z
|
|
12c6: 31 e0 ldi r19, 0x01 ; 1
|
|
12c8: 41 11 cpse r20, r1
|
|
12ca: 30 e0 ldi r19, 0x00 ; 0
|
|
Carry = 1;
|
|
} else {
|
|
Carry = 0;
|
|
}
|
|
|
|
UidBuffer[i] = (UidBuffer[i] - 1) & 0xFF;
|
|
12cc: f8 01 movw r30, r16
|
|
12ce: e8 0f add r30, r24
|
|
12d0: f9 1f adc r31, r25
|
|
12d2: 41 50 subi r20, 0x01 ; 1
|
|
12d4: 40 83 st Z, r20
|
|
} else if (ButtonAction == BUTTON_ACTION_UID_RIGHT_DECREMENT) {
|
|
ApplicationGetUid(UidBuffer);
|
|
bool Carry = 1;
|
|
uint8_t i = ActiveConfiguration.UidSize;
|
|
|
|
while(i-- > 0) {
|
|
12d6: 21 50 subi r18, 0x01 ; 1
|
|
12d8: 70 f7 brcc .-36 ; 0x12b6 <ButtonTick+0x188>
|
|
12da: 6f cf rjmp .-290 ; 0x11ba <ButtonTick+0x8c>
|
|
12dc: 8e 01 movw r16, r28
|
|
12de: 0f 5f subi r16, 0xFF ; 255
|
|
12e0: 1f 4f sbci r17, 0xFF ; 255
|
|
12e2: 6b cf rjmp .-298 ; 0x11ba <ButtonTick+0x8c>
|
|
|
|
000012e4 <ButtonGetActionList>:
|
|
}
|
|
}
|
|
}
|
|
|
|
void ButtonGetActionList(char* ListOut, uint16_t BufferSize)
|
|
{
|
|
12e4: cf 93 push r28
|
|
12e6: df 93 push r29
|
|
12e8: ec 01 movw r28, r24
|
|
uint8_t i;
|
|
|
|
/* Account for '\0' */
|
|
BufferSize--;
|
|
12ea: 61 50 subi r22, 0x01 ; 1
|
|
12ec: 71 09 sbc r23, r1
|
|
12ee: 80 e0 ldi r24, 0x00 ; 0
|
|
12f0: 90 e0 ldi r25, 0x00 ; 0
|
|
BufferSize--;
|
|
}
|
|
|
|
if ( i < (BUTTON_ACTION_COUNT - 1) ) {
|
|
/* No comma on last configuration */
|
|
*ListOut++ = ',';
|
|
12f2: 3c e2 ldi r19, 0x2C ; 44
|
|
|
|
/* Account for '\0' */
|
|
BufferSize--;
|
|
|
|
for (i=0; i<BUTTON_ACTION_COUNT; i++) {
|
|
const char* ActionName = ButtonActionTable[i];
|
|
12f4: fc 01 movw r30, r24
|
|
12f6: ee 0f add r30, r30
|
|
12f8: ff 1f adc r31, r31
|
|
12fa: e2 95 swap r30
|
|
12fc: f2 95 swap r31
|
|
12fe: f0 7f andi r31, 0xF0 ; 240
|
|
1300: fe 27 eor r31, r30
|
|
1302: e0 7f andi r30, 0xF0 ; 240
|
|
1304: fe 27 eor r31, r30
|
|
1306: e9 50 subi r30, 0x09 ; 9
|
|
1308: fd 4f sbci r31, 0xFD ; 253
|
|
char c;
|
|
|
|
while( (c = pgm_read_byte(ActionName)) != '\0' && BufferSize > sizeof(ButtonActionTable[i]) ) {
|
|
130a: 24 91 lpm r18, Z
|
|
130c: 22 23 and r18, r18
|
|
130e: 81 f0 breq .+32 ; 0x1330 <ButtonGetActionList+0x4c>
|
|
1310: 61 32 cpi r22, 0x21 ; 33
|
|
1312: 71 05 cpc r23, r1
|
|
1314: 68 f0 brcs .+26 ; 0x1330 <ButtonGetActionList+0x4c>
|
|
1316: de 01 movw r26, r28
|
|
1318: 03 c0 rjmp .+6 ; 0x1320 <ButtonGetActionList+0x3c>
|
|
131a: 60 32 cpi r22, 0x20 ; 32
|
|
131c: 71 05 cpc r23, r1
|
|
131e: 41 f0 breq .+16 ; 0x1330 <ButtonGetActionList+0x4c>
|
|
/* While not end-of-string and enough buffer to
|
|
* put a complete configuration name */
|
|
*ListOut++ = c;
|
|
1320: 2d 93 st X+, r18
|
|
1322: ed 01 movw r28, r26
|
|
ActionName++;
|
|
1324: 31 96 adiw r30, 0x01 ; 1
|
|
BufferSize--;
|
|
1326: 61 50 subi r22, 0x01 ; 1
|
|
1328: 71 09 sbc r23, r1
|
|
|
|
for (i=0; i<BUTTON_ACTION_COUNT; i++) {
|
|
const char* ActionName = ButtonActionTable[i];
|
|
char c;
|
|
|
|
while( (c = pgm_read_byte(ActionName)) != '\0' && BufferSize > sizeof(ButtonActionTable[i]) ) {
|
|
132a: 24 91 lpm r18, Z
|
|
132c: 21 11 cpse r18, r1
|
|
132e: f5 cf rjmp .-22 ; 0x131a <ButtonGetActionList+0x36>
|
|
*ListOut++ = c;
|
|
ActionName++;
|
|
BufferSize--;
|
|
}
|
|
|
|
if ( i < (BUTTON_ACTION_COUNT - 1) ) {
|
|
1330: 86 30 cpi r24, 0x06 ; 6
|
|
1332: 91 05 cpc r25, r1
|
|
1334: 21 f4 brne .+8 ; 0x133e <ButtonGetActionList+0x5a>
|
|
*ListOut++ = ',';
|
|
BufferSize--;
|
|
}
|
|
}
|
|
|
|
*ListOut = '\0';
|
|
1336: 18 82 st Y, r1
|
|
}
|
|
1338: df 91 pop r29
|
|
133a: cf 91 pop r28
|
|
133c: 08 95 ret
|
|
BufferSize--;
|
|
}
|
|
|
|
if ( i < (BUTTON_ACTION_COUNT - 1) ) {
|
|
/* No comma on last configuration */
|
|
*ListOut++ = ',';
|
|
133e: 39 93 st Y+, r19
|
|
BufferSize--;
|
|
1340: 61 50 subi r22, 0x01 ; 1
|
|
1342: 71 09 sbc r23, r1
|
|
1344: 01 96 adiw r24, 0x01 ; 1
|
|
1346: d6 cf rjmp .-84 ; 0x12f4 <ButtonGetActionList+0x10>
|
|
|
|
00001348 <ButtonSetActionById>:
|
|
*ListOut = '\0';
|
|
}
|
|
|
|
void ButtonSetActionById(ButtonActionEnum Action)
|
|
{
|
|
GlobalSettings.ActiveSettingPtr->ButtonAction = Action;
|
|
1348: e0 91 fe 20 lds r30, 0x20FE
|
|
134c: f0 91 ff 20 lds r31, 0x20FF
|
|
1350: 80 83 st Z, r24
|
|
1352: 08 95 ret
|
|
|
|
00001354 <ButtonGetActionByName>:
|
|
}
|
|
|
|
void ButtonGetActionByName(char* ActionOut, uint16_t BufferSize)
|
|
{
|
|
1354: ab 01 movw r20, r22
|
|
strncpy_P(ActionOut, ButtonActionTable[GlobalSettings.ActiveSettingPtr->ButtonAction], BufferSize);
|
|
1356: e0 91 fe 20 lds r30, 0x20FE
|
|
135a: f0 91 ff 20 lds r31, 0x20FF
|
|
135e: 60 81 ld r22, Z
|
|
1360: 20 e2 ldi r18, 0x20 ; 32
|
|
1362: 62 9f mul r22, r18
|
|
1364: b0 01 movw r22, r0
|
|
1366: 11 24 eor r1, r1
|
|
1368: 69 50 subi r22, 0x09 ; 9
|
|
136a: 7d 4f sbci r23, 0xFD ; 253
|
|
136c: 0c 94 1f 24 jmp 0x483e ; 0x483e <strncpy_P>
|
|
|
|
00001370 <ButtonSetActionByName>:
|
|
}
|
|
|
|
bool ButtonSetActionByName(const char* Action)
|
|
{
|
|
1370: cf 93 push r28
|
|
1372: df 93 push r29
|
|
1374: ec 01 movw r28, r24
|
|
uint8_t i;
|
|
|
|
for (i=0; i<BUTTON_ACTION_COUNT; i++) {
|
|
if (strcmp_P(Action, ButtonActionTable[i]) == 0) {
|
|
1376: 67 ef ldi r22, 0xF7 ; 247
|
|
1378: 72 e0 ldi r23, 0x02 ; 2
|
|
137a: 0e 94 16 24 call 0x482c ; 0x482c <strcmp_P>
|
|
137e: 89 2b or r24, r25
|
|
1380: 71 f1 breq .+92 ; 0x13de <ButtonSetActionByName+0x6e>
|
|
1382: 67 e1 ldi r22, 0x17 ; 23
|
|
1384: 73 e0 ldi r23, 0x03 ; 3
|
|
1386: ce 01 movw r24, r28
|
|
1388: 0e 94 16 24 call 0x482c ; 0x482c <strcmp_P>
|
|
138c: 89 2b or r24, r25
|
|
138e: 69 f1 breq .+90 ; 0x13ea <ButtonSetActionByName+0x7a>
|
|
1390: 67 e3 ldi r22, 0x37 ; 55
|
|
1392: 73 e0 ldi r23, 0x03 ; 3
|
|
1394: ce 01 movw r24, r28
|
|
1396: 0e 94 16 24 call 0x482c ; 0x482c <strcmp_P>
|
|
139a: 89 2b or r24, r25
|
|
139c: 41 f1 breq .+80 ; 0x13ee <ButtonSetActionByName+0x7e>
|
|
139e: 67 e5 ldi r22, 0x57 ; 87
|
|
13a0: 73 e0 ldi r23, 0x03 ; 3
|
|
13a2: ce 01 movw r24, r28
|
|
13a4: 0e 94 16 24 call 0x482c ; 0x482c <strcmp_P>
|
|
13a8: 89 2b or r24, r25
|
|
13aa: 19 f1 breq .+70 ; 0x13f2 <ButtonSetActionByName+0x82>
|
|
13ac: 67 e7 ldi r22, 0x77 ; 119
|
|
13ae: 73 e0 ldi r23, 0x03 ; 3
|
|
13b0: ce 01 movw r24, r28
|
|
13b2: 0e 94 16 24 call 0x482c ; 0x482c <strcmp_P>
|
|
13b6: 89 2b or r24, r25
|
|
13b8: f1 f0 breq .+60 ; 0x13f6 <ButtonSetActionByName+0x86>
|
|
13ba: 67 e9 ldi r22, 0x97 ; 151
|
|
13bc: 73 e0 ldi r23, 0x03 ; 3
|
|
13be: ce 01 movw r24, r28
|
|
13c0: 0e 94 16 24 call 0x482c ; 0x482c <strcmp_P>
|
|
13c4: 89 2b or r24, r25
|
|
13c6: c9 f0 breq .+50 ; 0x13fa <ButtonSetActionByName+0x8a>
|
|
13c8: 67 eb ldi r22, 0xB7 ; 183
|
|
13ca: 73 e0 ldi r23, 0x03 ; 3
|
|
13cc: ce 01 movw r24, r28
|
|
13ce: 0e 94 16 24 call 0x482c ; 0x482c <strcmp_P>
|
|
13d2: 89 2b or r24, r25
|
|
13d4: a1 f0 breq .+40 ; 0x13fe <ButtonSetActionByName+0x8e>
|
|
return true;
|
|
}
|
|
}
|
|
|
|
/* Button action not found */
|
|
return false;
|
|
13d6: 80 e0 ldi r24, 0x00 ; 0
|
|
}
|
|
13d8: df 91 pop r29
|
|
13da: cf 91 pop r28
|
|
13dc: 08 95 ret
|
|
|
|
bool ButtonSetActionByName(const char* Action)
|
|
{
|
|
uint8_t i;
|
|
|
|
for (i=0; i<BUTTON_ACTION_COUNT; i++) {
|
|
13de: 80 e0 ldi r24, 0x00 ; 0
|
|
if (strcmp_P(Action, ButtonActionTable[i]) == 0) {
|
|
ButtonSetActionById(i);
|
|
13e0: b3 df rcall .-154 ; 0x1348 <ButtonSetActionById>
|
|
return true;
|
|
13e2: 81 e0 ldi r24, 0x01 ; 1
|
|
}
|
|
}
|
|
|
|
/* Button action not found */
|
|
return false;
|
|
}
|
|
13e4: df 91 pop r29
|
|
13e6: cf 91 pop r28
|
|
13e8: 08 95 ret
|
|
|
|
bool ButtonSetActionByName(const char* Action)
|
|
{
|
|
uint8_t i;
|
|
|
|
for (i=0; i<BUTTON_ACTION_COUNT; i++) {
|
|
13ea: 81 e0 ldi r24, 0x01 ; 1
|
|
13ec: f9 cf rjmp .-14 ; 0x13e0 <ButtonSetActionByName+0x70>
|
|
13ee: 82 e0 ldi r24, 0x02 ; 2
|
|
13f0: f7 cf rjmp .-18 ; 0x13e0 <ButtonSetActionByName+0x70>
|
|
13f2: 83 e0 ldi r24, 0x03 ; 3
|
|
13f4: f5 cf rjmp .-22 ; 0x13e0 <ButtonSetActionByName+0x70>
|
|
13f6: 84 e0 ldi r24, 0x04 ; 4
|
|
13f8: f3 cf rjmp .-26 ; 0x13e0 <ButtonSetActionByName+0x70>
|
|
13fa: 85 e0 ldi r24, 0x05 ; 5
|
|
13fc: f1 cf rjmp .-30 ; 0x13e0 <ButtonSetActionByName+0x70>
|
|
if (strcmp_P(Action, ButtonActionTable[i]) == 0) {
|
|
13fe: 86 e0 ldi r24, 0x06 ; 6
|
|
1400: ef cf rjmp .-34 ; 0x13e0 <ButtonSetActionByName+0x70>
|
|
|
|
00001402 <SettingsLoad>:
|
|
.ButtonAction = DEFAULT_BUTTON_ACTION,
|
|
} }
|
|
};
|
|
|
|
void SettingsLoad(void) {
|
|
eeprom_read_block(&GlobalSettings, &StoredSettings, sizeof(SettingsType));
|
|
1402: 43 e1 ldi r20, 0x13 ; 19
|
|
1404: 50 e0 ldi r21, 0x00 ; 0
|
|
1406: 60 e0 ldi r22, 0x00 ; 0
|
|
1408: 70 e0 ldi r23, 0x00 ; 0
|
|
140a: 8d ef ldi r24, 0xFD ; 253
|
|
140c: 90 e2 ldi r25, 0x20 ; 32
|
|
140e: 0c 94 31 26 jmp 0x4c62 ; 0x4c62 <__eerd_block_x32a4u>
|
|
|
|
00001412 <SettingsSave>:
|
|
}
|
|
|
|
void SettingsSave(void) {
|
|
#if ENABLE_EEPROM_SETTINGS
|
|
eeprom_write_block(&GlobalSettings, &StoredSettings, sizeof(SettingsType));
|
|
1412: 43 e1 ldi r20, 0x13 ; 19
|
|
1414: 50 e0 ldi r21, 0x00 ; 0
|
|
1416: 60 e0 ldi r22, 0x00 ; 0
|
|
1418: 70 e0 ldi r23, 0x00 ; 0
|
|
141a: 8d ef ldi r24, 0xFD ; 253
|
|
141c: 90 e2 ldi r25, 0x20 ; 32
|
|
141e: 0c 94 3c 26 jmp 0x4c78 ; 0x4c78 <__eewr_block_x32a4u>
|
|
|
|
00001422 <SettingsSetActiveById>:
|
|
}
|
|
}
|
|
}
|
|
|
|
void SettingsSetActiveById(uint8_t Setting) {
|
|
if (Setting < SETTINGS_COUNT) {
|
|
1422: 88 30 cpi r24, 0x08 ; 8
|
|
1424: 08 f0 brcs .+2 ; 0x1428 <SettingsSetActiveById+0x6>
|
|
1426: 08 95 ret
|
|
GlobalSettings.ActiveSetting = Setting;
|
|
1428: 80 93 fd 20 sts 0x20FD, r24
|
|
GlobalSettings.ActiveSettingPtr =
|
|
&GlobalSettings.Settings[GlobalSettings.ActiveSetting];
|
|
142c: 90 e0 ldi r25, 0x00 ; 0
|
|
142e: 88 0f add r24, r24
|
|
1430: 99 1f adc r25, r25
|
|
1432: 80 50 subi r24, 0x00 ; 0
|
|
1434: 9f 4d sbci r25, 0xDF ; 223
|
|
}
|
|
|
|
void SettingsSetActiveById(uint8_t Setting) {
|
|
if (Setting < SETTINGS_COUNT) {
|
|
GlobalSettings.ActiveSetting = Setting;
|
|
GlobalSettings.ActiveSettingPtr =
|
|
1436: 80 93 fe 20 sts 0x20FE, r24
|
|
143a: 90 93 ff 20 sts 0x20FF, r25
|
|
&GlobalSettings.Settings[GlobalSettings.ActiveSetting];
|
|
|
|
/* Settings have changed. Progress changes through system */
|
|
ConfigurationInit();
|
|
143e: 45 ca rjmp .-2934 ; 0x8ca <ConfigurationInit>
|
|
|
|
00001440 <SettingsCycle>:
|
|
void SettingsCycle(void) {
|
|
uint8_t i = SETTINGS_COUNT;
|
|
uint8_t Setting = GlobalSettings.ActiveSetting;
|
|
|
|
while (i-- > 0) {
|
|
Setting = (Setting + 1) % SETTINGS_COUNT;
|
|
1440: 20 91 fd 20 lds r18, 0x20FD
|
|
1444: 30 e0 ldi r19, 0x00 ; 0
|
|
1446: 2f 5f subi r18, 0xFF ; 255
|
|
1448: 3f 4f sbci r19, 0xFF ; 255
|
|
144a: 27 70 andi r18, 0x07 ; 7
|
|
144c: 33 27 eor r19, r19
|
|
144e: 82 2f mov r24, r18
|
|
|
|
if (GlobalSettings.Settings[Setting].Configuration != CONFIG_NONE) {
|
|
1450: f9 01 movw r30, r18
|
|
1452: ee 0f add r30, r30
|
|
1454: ff 1f adc r31, r31
|
|
1456: ef 5f subi r30, 0xFF ; 255
|
|
1458: fe 4d sbci r31, 0xDE ; 222
|
|
145a: 90 81 ld r25, Z
|
|
145c: 91 11 cpse r25, r1
|
|
145e: 5c c0 rjmp .+184 ; 0x1518 <SettingsCycle+0xd8>
|
|
void SettingsCycle(void) {
|
|
uint8_t i = SETTINGS_COUNT;
|
|
uint8_t Setting = GlobalSettings.ActiveSetting;
|
|
|
|
while (i-- > 0) {
|
|
Setting = (Setting + 1) % SETTINGS_COUNT;
|
|
1460: 2f 5f subi r18, 0xFF ; 255
|
|
1462: 3f 4f sbci r19, 0xFF ; 255
|
|
1464: 27 70 andi r18, 0x07 ; 7
|
|
1466: 33 27 eor r19, r19
|
|
1468: 82 2f mov r24, r18
|
|
|
|
if (GlobalSettings.Settings[Setting].Configuration != CONFIG_NONE) {
|
|
146a: f9 01 movw r30, r18
|
|
146c: ee 0f add r30, r30
|
|
146e: ff 1f adc r31, r31
|
|
1470: ef 5f subi r30, 0xFF ; 255
|
|
1472: fe 4d sbci r31, 0xDE ; 222
|
|
1474: 90 81 ld r25, Z
|
|
1476: 91 11 cpse r25, r1
|
|
1478: 4f c0 rjmp .+158 ; 0x1518 <SettingsCycle+0xd8>
|
|
void SettingsCycle(void) {
|
|
uint8_t i = SETTINGS_COUNT;
|
|
uint8_t Setting = GlobalSettings.ActiveSetting;
|
|
|
|
while (i-- > 0) {
|
|
Setting = (Setting + 1) % SETTINGS_COUNT;
|
|
147a: 2f 5f subi r18, 0xFF ; 255
|
|
147c: 3f 4f sbci r19, 0xFF ; 255
|
|
147e: 27 70 andi r18, 0x07 ; 7
|
|
1480: 33 27 eor r19, r19
|
|
1482: 82 2f mov r24, r18
|
|
|
|
if (GlobalSettings.Settings[Setting].Configuration != CONFIG_NONE) {
|
|
1484: f9 01 movw r30, r18
|
|
1486: ee 0f add r30, r30
|
|
1488: ff 1f adc r31, r31
|
|
148a: ef 5f subi r30, 0xFF ; 255
|
|
148c: fe 4d sbci r31, 0xDE ; 222
|
|
148e: 90 81 ld r25, Z
|
|
1490: 91 11 cpse r25, r1
|
|
1492: 42 c0 rjmp .+132 ; 0x1518 <SettingsCycle+0xd8>
|
|
void SettingsCycle(void) {
|
|
uint8_t i = SETTINGS_COUNT;
|
|
uint8_t Setting = GlobalSettings.ActiveSetting;
|
|
|
|
while (i-- > 0) {
|
|
Setting = (Setting + 1) % SETTINGS_COUNT;
|
|
1494: 2f 5f subi r18, 0xFF ; 255
|
|
1496: 3f 4f sbci r19, 0xFF ; 255
|
|
1498: 27 70 andi r18, 0x07 ; 7
|
|
149a: 33 27 eor r19, r19
|
|
149c: 82 2f mov r24, r18
|
|
|
|
if (GlobalSettings.Settings[Setting].Configuration != CONFIG_NONE) {
|
|
149e: f9 01 movw r30, r18
|
|
14a0: ee 0f add r30, r30
|
|
14a2: ff 1f adc r31, r31
|
|
14a4: ef 5f subi r30, 0xFF ; 255
|
|
14a6: fe 4d sbci r31, 0xDE ; 222
|
|
14a8: 90 81 ld r25, Z
|
|
14aa: 91 11 cpse r25, r1
|
|
14ac: 35 c0 rjmp .+106 ; 0x1518 <SettingsCycle+0xd8>
|
|
void SettingsCycle(void) {
|
|
uint8_t i = SETTINGS_COUNT;
|
|
uint8_t Setting = GlobalSettings.ActiveSetting;
|
|
|
|
while (i-- > 0) {
|
|
Setting = (Setting + 1) % SETTINGS_COUNT;
|
|
14ae: 2f 5f subi r18, 0xFF ; 255
|
|
14b0: 3f 4f sbci r19, 0xFF ; 255
|
|
14b2: 27 70 andi r18, 0x07 ; 7
|
|
14b4: 33 27 eor r19, r19
|
|
14b6: 82 2f mov r24, r18
|
|
|
|
if (GlobalSettings.Settings[Setting].Configuration != CONFIG_NONE) {
|
|
14b8: f9 01 movw r30, r18
|
|
14ba: ee 0f add r30, r30
|
|
14bc: ff 1f adc r31, r31
|
|
14be: ef 5f subi r30, 0xFF ; 255
|
|
14c0: fe 4d sbci r31, 0xDE ; 222
|
|
14c2: 90 81 ld r25, Z
|
|
14c4: 91 11 cpse r25, r1
|
|
14c6: 28 c0 rjmp .+80 ; 0x1518 <SettingsCycle+0xd8>
|
|
void SettingsCycle(void) {
|
|
uint8_t i = SETTINGS_COUNT;
|
|
uint8_t Setting = GlobalSettings.ActiveSetting;
|
|
|
|
while (i-- > 0) {
|
|
Setting = (Setting + 1) % SETTINGS_COUNT;
|
|
14c8: 2f 5f subi r18, 0xFF ; 255
|
|
14ca: 3f 4f sbci r19, 0xFF ; 255
|
|
14cc: 27 70 andi r18, 0x07 ; 7
|
|
14ce: 33 27 eor r19, r19
|
|
14d0: 82 2f mov r24, r18
|
|
|
|
if (GlobalSettings.Settings[Setting].Configuration != CONFIG_NONE) {
|
|
14d2: f9 01 movw r30, r18
|
|
14d4: ee 0f add r30, r30
|
|
14d6: ff 1f adc r31, r31
|
|
14d8: ef 5f subi r30, 0xFF ; 255
|
|
14da: fe 4d sbci r31, 0xDE ; 222
|
|
14dc: 90 81 ld r25, Z
|
|
14de: 91 11 cpse r25, r1
|
|
14e0: 1b c0 rjmp .+54 ; 0x1518 <SettingsCycle+0xd8>
|
|
void SettingsCycle(void) {
|
|
uint8_t i = SETTINGS_COUNT;
|
|
uint8_t Setting = GlobalSettings.ActiveSetting;
|
|
|
|
while (i-- > 0) {
|
|
Setting = (Setting + 1) % SETTINGS_COUNT;
|
|
14e2: 2f 5f subi r18, 0xFF ; 255
|
|
14e4: 3f 4f sbci r19, 0xFF ; 255
|
|
14e6: 27 70 andi r18, 0x07 ; 7
|
|
14e8: 33 27 eor r19, r19
|
|
14ea: 82 2f mov r24, r18
|
|
|
|
if (GlobalSettings.Settings[Setting].Configuration != CONFIG_NONE) {
|
|
14ec: f9 01 movw r30, r18
|
|
14ee: ee 0f add r30, r30
|
|
14f0: ff 1f adc r31, r31
|
|
14f2: ef 5f subi r30, 0xFF ; 255
|
|
14f4: fe 4d sbci r31, 0xDE ; 222
|
|
14f6: 90 81 ld r25, Z
|
|
14f8: 91 11 cpse r25, r1
|
|
14fa: 0e c0 rjmp .+28 ; 0x1518 <SettingsCycle+0xd8>
|
|
void SettingsCycle(void) {
|
|
uint8_t i = SETTINGS_COUNT;
|
|
uint8_t Setting = GlobalSettings.ActiveSetting;
|
|
|
|
while (i-- > 0) {
|
|
Setting = (Setting + 1) % SETTINGS_COUNT;
|
|
14fc: 2f 5f subi r18, 0xFF ; 255
|
|
14fe: 3f 4f sbci r19, 0xFF ; 255
|
|
1500: 27 70 andi r18, 0x07 ; 7
|
|
1502: 33 27 eor r19, r19
|
|
1504: 82 2f mov r24, r18
|
|
|
|
if (GlobalSettings.Settings[Setting].Configuration != CONFIG_NONE) {
|
|
1506: f9 01 movw r30, r18
|
|
1508: ee 0f add r30, r30
|
|
150a: ff 1f adc r31, r31
|
|
150c: ef 5f subi r30, 0xFF ; 255
|
|
150e: fe 4d sbci r31, 0xDE ; 222
|
|
1510: 90 81 ld r25, Z
|
|
1512: 91 11 cpse r25, r1
|
|
1514: 01 c0 rjmp .+2 ; 0x1518 <SettingsCycle+0xd8>
|
|
1516: 08 95 ret
|
|
SettingsSetActiveById(Setting);
|
|
1518: 84 cf rjmp .-248 ; 0x1422 <SettingsSetActiveById>
|
|
|
|
0000151a <SettingsGetActiveById>:
|
|
}
|
|
}
|
|
|
|
uint8_t SettingsGetActiveById(void) {
|
|
return GlobalSettings.ActiveSetting;
|
|
}
|
|
151a: 80 91 fd 20 lds r24, 0x20FD
|
|
151e: 08 95 ret
|
|
|
|
00001520 <SettingsGetActiveByName>:
|
|
|
|
void SettingsGetActiveByName(char* SettingOut, uint16_t BufferSize) {
|
|
1520: cf 93 push r28
|
|
1522: df 93 push r29
|
|
1524: ec 01 movw r28, r24
|
|
SettingOut[0] = SettingsGetActiveById() + '0';
|
|
1526: f9 df rcall .-14 ; 0x151a <SettingsGetActiveById>
|
|
1528: 80 5d subi r24, 0xD0 ; 208
|
|
152a: 88 83 st Y, r24
|
|
SettingOut[1] = '\0';
|
|
152c: 19 82 std Y+1, r1 ; 0x01
|
|
}
|
|
152e: df 91 pop r29
|
|
1530: cf 91 pop r28
|
|
1532: 08 95 ret
|
|
|
|
00001534 <SettingsSetActiveByName>:
|
|
|
|
bool SettingsSetActiveByName(const char* Setting) {
|
|
1534: fc 01 movw r30, r24
|
|
uint8_t SettingNr = Setting[0] - '0';
|
|
1536: 80 81 ld r24, Z
|
|
|
|
if ((Setting[1] == '\0') && (SettingNr < SETTINGS_COUNT)) {
|
|
1538: 91 81 ldd r25, Z+1 ; 0x01
|
|
153a: 91 11 cpse r25, r1
|
|
153c: 03 c0 rjmp .+6 ; 0x1544 <SettingsSetActiveByName+0x10>
|
|
SettingOut[0] = SettingsGetActiveById() + '0';
|
|
SettingOut[1] = '\0';
|
|
}
|
|
|
|
bool SettingsSetActiveByName(const char* Setting) {
|
|
uint8_t SettingNr = Setting[0] - '0';
|
|
153e: 80 53 subi r24, 0x30 ; 48
|
|
|
|
if ((Setting[1] == '\0') && (SettingNr < SETTINGS_COUNT)) {
|
|
1540: 88 30 cpi r24, 0x08 ; 8
|
|
1542: 10 f0 brcs .+4 ; 0x1548 <SettingsSetActiveByName+0x14>
|
|
SettingsSetActiveById(SettingNr);
|
|
return true;
|
|
} else {
|
|
return false;
|
|
1544: 80 e0 ldi r24, 0x00 ; 0
|
|
}
|
|
}
|
|
1546: 08 95 ret
|
|
|
|
bool SettingsSetActiveByName(const char* Setting) {
|
|
uint8_t SettingNr = Setting[0] - '0';
|
|
|
|
if ((Setting[1] == '\0') && (SettingNr < SETTINGS_COUNT)) {
|
|
SettingsSetActiveById(SettingNr);
|
|
1548: 6c df rcall .-296 ; 0x1422 <SettingsSetActiveById>
|
|
return true;
|
|
154a: 81 e0 ldi r24, 0x01 ; 1
|
|
154c: 08 95 ret
|
|
|
|
0000154e <TerminalSendString>:
|
|
uint8_t TerminalBuffer[TERMINAL_BUFFER_SIZE];
|
|
TerminalStateEnum TerminalState = TERMINAL_UNINITIALIZED;
|
|
static uint8_t TerminalInitDelay = INIT_DELAY;
|
|
|
|
void TerminalSendString(const char* s) {
|
|
CDC_Device_SendString(&TerminalHandle, s);
|
|
154e: bc 01 movw r22, r24
|
|
1550: 80 e0 ldi r24, 0x00 ; 0
|
|
1552: 90 e2 ldi r25, 0x20 ; 32
|
|
1554: 0c 94 ad 21 jmp 0x435a ; 0x435a <CDC_Device_SendString>
|
|
|
|
00001558 <TerminalSendStringP>:
|
|
}
|
|
|
|
void TerminalSendStringP(const char* s) {
|
|
1558: cf 93 push r28
|
|
155a: df 93 push r29
|
|
char c;
|
|
|
|
while( (c = pgm_read_byte(s++)) != '\0' ) {
|
|
155c: ec 01 movw r28, r24
|
|
155e: 21 96 adiw r28, 0x01 ; 1
|
|
1560: fc 01 movw r30, r24
|
|
1562: 64 91 lpm r22, Z
|
|
1564: 66 23 and r22, r22
|
|
1566: 49 f0 breq .+18 ; 0x157a <TerminalSendStringP+0x22>
|
|
void EVENT_USB_Device_Connect(void);
|
|
void EVENT_USB_Device_Disconnect(void);
|
|
void EVENT_USB_Device_ConfigurationChanged(void);
|
|
void EVENT_USB_Device_ControlRequest(void);
|
|
|
|
INLINE void TerminalSendChar(char c) { CDC_Device_SendByte(&TerminalHandle, c); }
|
|
1568: 80 e0 ldi r24, 0x00 ; 0
|
|
156a: 90 e2 ldi r25, 0x20 ; 32
|
|
156c: 0e 94 00 22 call 0x4400 ; 0x4400 <CDC_Device_SendByte>
|
|
1570: fe 01 movw r30, r28
|
|
1572: 21 96 adiw r28, 0x01 ; 1
|
|
1574: 64 91 lpm r22, Z
|
|
1576: 61 11 cpse r22, r1
|
|
1578: f7 cf rjmp .-18 ; 0x1568 <TerminalSendStringP+0x10>
|
|
TerminalSendChar(c);
|
|
}
|
|
}
|
|
157a: df 91 pop r29
|
|
157c: cf 91 pop r28
|
|
157e: 08 95 ret
|
|
|
|
00001580 <TerminalSendBlock>:
|
|
#endif
|
|
|
|
|
|
|
|
void TerminalSendBlock(void* Buffer, uint16_t ByteCount)
|
|
{
|
|
1580: ab 01 movw r20, r22
|
|
CDC_Device_SendData(&TerminalHandle, Buffer, ByteCount);
|
|
1582: bc 01 movw r22, r24
|
|
1584: 80 e0 ldi r24, 0x00 ; 0
|
|
1586: 90 e2 ldi r25, 0x20 ; 32
|
|
1588: 0c 94 d6 21 jmp 0x43ac ; 0x43ac <CDC_Device_SendData>
|
|
|
|
0000158c <TerminalInit>:
|
|
}
|
|
}
|
|
|
|
void TerminalInit(void)
|
|
{
|
|
TERMINAL_VBUS_PORT.DIRCLR = TERMINAL_VBUS_MASK;
|
|
158c: 80 e2 ldi r24, 0x20 ; 32
|
|
158e: e0 e6 ldi r30, 0x60 ; 96
|
|
1590: f6 e0 ldi r31, 0x06 ; 6
|
|
1592: 82 83 std Z+2, r24 ; 0x02
|
|
1594: 08 95 ret
|
|
|
|
00001596 <TerminalTask>:
|
|
}
|
|
|
|
void TerminalTask(void)
|
|
{
|
|
1596: cf 93 push r28
|
|
1598: df 93 push r29
|
|
CDC_Device_USBTask(&TerminalHandle);
|
|
159a: 80 e0 ldi r24, 0x00 ; 0
|
|
159c: 90 e2 ldi r25, 0x20 ; 32
|
|
159e: 0e 94 7f 22 call 0x44fe ; 0x44fe <CDC_Device_USBTask>
|
|
USB_USBTask();
|
|
15a2: 0e 94 80 1c call 0x3900 ; 0x3900 <USB_USBTask>
|
|
CDC_Device_SendData(&TerminalHandle, Buffer, ByteCount);
|
|
}
|
|
|
|
|
|
static void ProcessByte(void) {
|
|
int16_t Byte = CDC_Device_ReceiveByte(&TerminalHandle);
|
|
15a6: 80 e0 ldi r24, 0x00 ; 0
|
|
15a8: 90 e2 ldi r25, 0x20 ; 32
|
|
15aa: 0e 94 9a 22 call 0x4534 ; 0x4534 <CDC_Device_ReceiveByte>
|
|
15ae: ec 01 movw r28, r24
|
|
|
|
if (Byte >= 0) {
|
|
15b0: 97 fd sbrc r25, 7
|
|
15b2: 09 c0 rjmp .+18 ; 0x15c6 <TerminalTask+0x30>
|
|
LED_PORT.OUTTGL = Mask;
|
|
}
|
|
|
|
static inline
|
|
void LEDPulse(uint8_t Mask) {
|
|
LEDPulseMask = Mask;
|
|
15b4: 80 e1 ldi r24, 0x10 ; 16
|
|
15b6: 80 93 93 20 sts 0x2093, r24
|
|
LED_PORT.OUTSET = Mask;
|
|
15ba: 80 93 05 06 sts 0x0605, r24
|
|
/* Byte received */
|
|
LEDPulse(LED_RED);
|
|
|
|
if (XModemProcessByte(Byte)) {
|
|
15be: 8c 2f mov r24, r28
|
|
15c0: 62 d2 rcall .+1220 ; 0x1a86 <XModemProcessByte>
|
|
15c2: 88 23 and r24, r24
|
|
15c4: 19 f0 breq .+6 ; 0x15cc <TerminalTask+0x36>
|
|
{
|
|
CDC_Device_USBTask(&TerminalHandle);
|
|
USB_USBTask();
|
|
|
|
ProcessByte();
|
|
}
|
|
15c6: df 91 pop r29
|
|
15c8: cf 91 pop r28
|
|
15ca: 08 95 ret
|
|
/* Byte received */
|
|
LEDPulse(LED_RED);
|
|
|
|
if (XModemProcessByte(Byte)) {
|
|
/* XModem handled the byte */
|
|
} else if (CommandLineProcessByte(Byte)) {
|
|
15cc: 8c 2f mov r24, r28
|
|
{
|
|
CDC_Device_USBTask(&TerminalHandle);
|
|
USB_USBTask();
|
|
|
|
ProcessByte();
|
|
}
|
|
15ce: df 91 pop r29
|
|
15d0: cf 91 pop r28
|
|
/* Byte received */
|
|
LEDPulse(LED_RED);
|
|
|
|
if (XModemProcessByte(Byte)) {
|
|
/* XModem handled the byte */
|
|
} else if (CommandLineProcessByte(Byte)) {
|
|
15d2: c9 c3 rjmp .+1938 ; 0x1d66 <CommandLineProcessByte>
|
|
|
|
000015d4 <TerminalTick>:
|
|
}
|
|
}
|
|
|
|
static void SenseVBus(void)
|
|
{
|
|
switch(TerminalState) {
|
|
15d4: 80 91 94 20 lds r24, 0x2094
|
|
15d8: 81 30 cpi r24, 0x01 ; 1
|
|
15da: 01 f1 breq .+64 ; 0x161c <TerminalTick+0x48>
|
|
15dc: 30 f0 brcs .+12 ; 0x15ea <TerminalTick+0x16>
|
|
15de: 82 30 cpi r24, 0x02 ; 2
|
|
15e0: 59 f1 breq .+86 ; 0x1638 <TerminalTick+0x64>
|
|
15e2: 83 30 cpi r24, 0x03 ; 3
|
|
15e4: 71 f0 breq .+28 ; 0x1602 <TerminalTick+0x2e>
|
|
|
|
void TerminalTick(void)
|
|
{
|
|
SenseVBus();
|
|
|
|
XModemTick();
|
|
15e6: 91 d3 rcall .+1826 ; 0x1d0a <XModemTick>
|
|
CommandLineTick();
|
|
15e8: 5f c5 rjmp .+2750 ; 0x20a8 <CommandLineTick>
|
|
|
|
static void SenseVBus(void)
|
|
{
|
|
switch(TerminalState) {
|
|
case TERMINAL_UNINITIALIZED:
|
|
if (TERMINAL_VBUS_PORT.IN & TERMINAL_VBUS_MASK) {
|
|
15ea: 80 91 68 06 lds r24, 0x0668
|
|
15ee: 85 ff sbrs r24, 5
|
|
15f0: fa cf rjmp .-12 ; 0x15e6 <TerminalTick+0x12>
|
|
/* Not initialized and VBUS sense high */
|
|
TerminalInitDelay = INIT_DELAY;
|
|
15f2: 84 e1 ldi r24, 0x14 ; 20
|
|
15f4: 80 93 1b 20 sts 0x201B, r24
|
|
TerminalState = TERMINAL_INITIALIZING;
|
|
15f8: 81 e0 ldi r24, 0x01 ; 1
|
|
15fa: 80 93 94 20 sts 0x2094, r24
|
|
|
|
void TerminalTick(void)
|
|
{
|
|
SenseVBus();
|
|
|
|
XModemTick();
|
|
15fe: 85 d3 rcall .+1802 ; 0x1d0a <XModemTick>
|
|
CommandLineTick();
|
|
1600: 53 c5 rjmp .+2726 ; 0x20a8 <CommandLineTick>
|
|
TerminalState = TERMINAL_UNITIALIZING;
|
|
}
|
|
break;
|
|
|
|
case TERMINAL_UNITIALIZING:
|
|
if (--TerminalInitDelay == 0) {
|
|
1602: 80 91 1b 20 lds r24, 0x201B
|
|
1606: 81 50 subi r24, 0x01 ; 1
|
|
1608: 80 93 1b 20 sts 0x201B, r24
|
|
160c: 81 11 cpse r24, r1
|
|
160e: eb cf rjmp .-42 ; 0x15e6 <TerminalTick+0x12>
|
|
USB_Disable();
|
|
1610: 0e 94 aa 20 call 0x4154 ; 0x4154 <USB_Disable>
|
|
SystemStopUSBClock();
|
|
1614: 21 d9 rcall .-3518 ; 0x858 <SystemStopUSBClock>
|
|
TerminalState = TERMINAL_UNINITIALIZED;
|
|
1616: 10 92 94 20 sts 0x2094, r1
|
|
161a: e5 cf rjmp .-54 ; 0x15e6 <TerminalTick+0x12>
|
|
TerminalState = TERMINAL_INITIALIZING;
|
|
}
|
|
break;
|
|
|
|
case TERMINAL_INITIALIZING:
|
|
if (--TerminalInitDelay == 0) {
|
|
161c: 80 91 1b 20 lds r24, 0x201B
|
|
1620: 81 50 subi r24, 0x01 ; 1
|
|
1622: 80 93 1b 20 sts 0x201B, r24
|
|
1626: 81 11 cpse r24, r1
|
|
1628: de cf rjmp .-68 ; 0x15e6 <TerminalTick+0x12>
|
|
SystemStartUSBClock();
|
|
162a: fd d8 rcall .-3590 ; 0x826 <SystemStartUSBClock>
|
|
USB_Init();
|
|
162c: 0e 94 e5 20 call 0x41ca ; 0x41ca <USB_Init>
|
|
TerminalState = TERMINAL_INITIALIZED;
|
|
1630: 82 e0 ldi r24, 0x02 ; 2
|
|
1632: 80 93 94 20 sts 0x2094, r24
|
|
1636: d7 cf rjmp .-82 ; 0x15e6 <TerminalTick+0x12>
|
|
}
|
|
break;
|
|
|
|
case TERMINAL_INITIALIZED:
|
|
if (!(TERMINAL_VBUS_PORT.IN & TERMINAL_VBUS_MASK)) {
|
|
1638: 80 91 68 06 lds r24, 0x0668
|
|
163c: 85 fd sbrc r24, 5
|
|
163e: d3 cf rjmp .-90 ; 0x15e6 <TerminalTick+0x12>
|
|
/* Initialized and VBUS sense low */
|
|
TerminalInitDelay = INIT_DELAY;
|
|
1640: 84 e1 ldi r24, 0x14 ; 20
|
|
1642: 80 93 1b 20 sts 0x201B, r24
|
|
TerminalState = TERMINAL_UNITIALIZING;
|
|
1646: 83 e0 ldi r24, 0x03 ; 3
|
|
1648: 80 93 94 20 sts 0x2094, r24
|
|
|
|
void TerminalTick(void)
|
|
{
|
|
SenseVBus();
|
|
|
|
XModemTick();
|
|
164c: 5e d3 rcall .+1724 ; 0x1d0a <XModemTick>
|
|
CommandLineTick();
|
|
164e: 2c c5 rjmp .+2648 ; 0x20a8 <CommandLineTick>
|
|
|
|
00001650 <EVENT_USB_Device_Connect>:
|
|
LED_PORT.DIRSET = LED_MASK;
|
|
}
|
|
|
|
static inline
|
|
void LEDSetOn(uint8_t Mask) {
|
|
LED_PORT.OUTSET = Mask;
|
|
1650: 80 e2 ldi r24, 0x20 ; 32
|
|
1652: e0 e0 ldi r30, 0x00 ; 0
|
|
1654: f6 e0 ldi r31, 0x06 ; 6
|
|
1656: 85 83 std Z+5, r24 ; 0x05
|
|
1658: 08 95 ret
|
|
|
|
0000165a <EVENT_USB_Device_Disconnect>:
|
|
}
|
|
|
|
static inline
|
|
void LEDSetOff(uint8_t Mask) {
|
|
LED_PORT.OUTCLR = Mask;
|
|
165a: 80 e2 ldi r24, 0x20 ; 32
|
|
165c: e0 e0 ldi r30, 0x00 ; 0
|
|
165e: f6 e0 ldi r31, 0x06 ; 6
|
|
1660: 86 83 std Z+6, r24 ; 0x06
|
|
1662: 08 95 ret
|
|
|
|
00001664 <EVENT_USB_Device_ConfigurationChanged>:
|
|
|
|
|
|
/** Event handler for the library USB Configuration Changed event. */
|
|
void EVENT_USB_Device_ConfigurationChanged(void)
|
|
{
|
|
CDC_Device_ConfigureEndpoints(&TerminalHandle);
|
|
1664: 80 e0 ldi r24, 0x00 ; 0
|
|
1666: 90 e2 ldi r25, 0x20 ; 32
|
|
1668: 0c 94 88 21 jmp 0x4310 ; 0x4310 <CDC_Device_ConfigureEndpoints>
|
|
|
|
0000166c <EVENT_USB_Device_ControlRequest>:
|
|
}
|
|
|
|
/** Event handler for the library USB Control Request reception event. */
|
|
void EVENT_USB_Device_ControlRequest(void)
|
|
{
|
|
CDC_Device_ProcessControlRequest(&TerminalHandle);
|
|
166c: 80 e0 ldi r24, 0x00 ; 0
|
|
166e: 90 e2 ldi r25, 0x20 ; 32
|
|
1670: 0c 94 fa 22 jmp 0x45f4 ; 0x45f4 <CDC_Device_ProcessControlRequest>
|
|
|
|
00001674 <CommandGetVersion>:
|
|
|
|
extern const PROGMEM CommandEntryType CommandTable[];
|
|
|
|
CommandStatusIdType CommandGetVersion(char* OutParam)
|
|
{
|
|
snprintf_P(OutParam, TERMINAL_BUFFER_SIZE, PSTR(
|
|
1674: 2e e1 ldi r18, 0x1E ; 30
|
|
1676: 34 e0 ldi r19, 0x04 ; 4
|
|
1678: 3f 93 push r19
|
|
167a: 2f 93 push r18
|
|
167c: 27 e1 ldi r18, 0x17 ; 23
|
|
167e: 34 e0 ldi r19, 0x04 ; 4
|
|
1680: 3f 93 push r19
|
|
1682: 2f 93 push r18
|
|
1684: 20 e1 ldi r18, 0x10 ; 16
|
|
1686: 34 e0 ldi r19, 0x04 ; 4
|
|
1688: 3f 93 push r19
|
|
168a: 2f 93 push r18
|
|
168c: 27 ed ldi r18, 0xD7 ; 215
|
|
168e: 33 e0 ldi r19, 0x03 ; 3
|
|
1690: 3f 93 push r19
|
|
1692: 2f 93 push r18
|
|
1694: 21 e0 ldi r18, 0x01 ; 1
|
|
1696: 2f 93 push r18
|
|
1698: 1f 92 push r1
|
|
169a: 9f 93 push r25
|
|
169c: 8f 93 push r24
|
|
169e: 0e 94 37 24 call 0x486e ; 0x486e <snprintf_P>
|
|
"Chameleon-Mini %S using LUFA %S compiled with AVR-GCC %S"
|
|
), PSTR(CHAMELEON_MINI_VERSION_STRING), PSTR(LUFA_VERSION_STRING), PSTR(__VERSION__)
|
|
);
|
|
|
|
return COMMAND_INFO_OK_WITH_TEXT_ID;
|
|
16a2: 8d b7 in r24, 0x3d ; 61
|
|
16a4: 9e b7 in r25, 0x3e ; 62
|
|
16a6: 0c 96 adiw r24, 0x0c ; 12
|
|
16a8: 8d bf out 0x3d, r24 ; 61
|
|
16aa: 9e bf out 0x3e, r25 ; 62
|
|
}
|
|
16ac: 85 e6 ldi r24, 0x65 ; 101
|
|
16ae: 08 95 ret
|
|
|
|
000016b0 <CommandGetConfig>:
|
|
|
|
CommandStatusIdType CommandGetConfig(char* OutParam)
|
|
{
|
|
snprintf_P(OutParam, TERMINAL_BUFFER_SIZE,
|
|
16b0: 29 ed ldi r18, 0xD9 ; 217
|
|
16b2: 30 e2 ldi r19, 0x20 ; 32
|
|
16b4: 3f 93 push r19
|
|
16b6: 2f 93 push r18
|
|
16b8: 24 e2 ldi r18, 0x24 ; 36
|
|
16ba: 34 e0 ldi r19, 0x04 ; 4
|
|
16bc: 3f 93 push r19
|
|
16be: 2f 93 push r18
|
|
16c0: 21 e0 ldi r18, 0x01 ; 1
|
|
16c2: 2f 93 push r18
|
|
16c4: 1f 92 push r1
|
|
16c6: 9f 93 push r25
|
|
16c8: 8f 93 push r24
|
|
16ca: 0e 94 37 24 call 0x486e ; 0x486e <snprintf_P>
|
|
PSTR("%s"), ActiveConfiguration.ConfigurationName);
|
|
|
|
return COMMAND_INFO_OK_WITH_TEXT_ID;
|
|
16ce: 8d b7 in r24, 0x3d ; 61
|
|
16d0: 9e b7 in r25, 0x3e ; 62
|
|
16d2: 08 96 adiw r24, 0x08 ; 8
|
|
16d4: 8d bf out 0x3d, r24 ; 61
|
|
16d6: 9e bf out 0x3e, r25 ; 62
|
|
|
|
}
|
|
16d8: 85 e6 ldi r24, 0x65 ; 101
|
|
16da: 08 95 ret
|
|
|
|
000016dc <CommandSetConfig>:
|
|
|
|
CommandStatusIdType CommandSetConfig(const char* InParam)
|
|
{
|
|
if (ConfigurationSetByName(InParam)) {
|
|
16dc: fc d8 rcall .-3592 ; 0x8d6 <ConfigurationSetByName>
|
|
16de: 81 11 cpse r24, r1
|
|
16e0: 02 c0 rjmp .+4 ; 0x16e6 <CommandSetConfig+0xa>
|
|
SettingsSave();
|
|
return COMMAND_INFO_OK_ID;
|
|
} else {
|
|
return COMMAND_ERR_INVALID_PARAM_ID;
|
|
16e2: 8a ec ldi r24, 0xCA ; 202
|
|
}
|
|
}
|
|
16e4: 08 95 ret
|
|
}
|
|
|
|
CommandStatusIdType CommandSetConfig(const char* InParam)
|
|
{
|
|
if (ConfigurationSetByName(InParam)) {
|
|
SettingsSave();
|
|
16e6: 95 de rcall .-726 ; 0x1412 <SettingsSave>
|
|
return COMMAND_INFO_OK_ID;
|
|
16e8: 84 e6 ldi r24, 0x64 ; 100
|
|
16ea: 08 95 ret
|
|
|
|
000016ec <CommandExecConfig>:
|
|
}
|
|
}
|
|
|
|
CommandStatusIdType CommandExecConfig(char* OutMessage)
|
|
{
|
|
ConfigurationGetList(OutMessage, TERMINAL_BUFFER_SIZE);
|
|
16ec: 60 e0 ldi r22, 0x00 ; 0
|
|
16ee: 71 e0 ldi r23, 0x01 ; 1
|
|
16f0: 33 d9 rcall .-3482 ; 0x958 <ConfigurationGetList>
|
|
|
|
return COMMAND_INFO_OK_WITH_TEXT_ID;
|
|
}
|
|
16f2: 85 e6 ldi r24, 0x65 ; 101
|
|
16f4: 08 95 ret
|
|
|
|
000016f6 <CommandGetUid>:
|
|
|
|
CommandStatusIdType CommandGetUid(char* OutParam)
|
|
{
|
|
16f6: 0f 93 push r16
|
|
16f8: 1f 93 push r17
|
|
16fa: cf 93 push r28
|
|
16fc: df 93 push r29
|
|
16fe: cd b7 in r28, 0x3d ; 61
|
|
1700: de b7 in r29, 0x3e ; 62
|
|
1702: a1 97 sbiw r28, 0x21 ; 33
|
|
1704: cd bf out 0x3d, r28 ; 61
|
|
1706: de bf out 0x3e, r29 ; 62
|
|
1708: 8c 01 movw r16, r24
|
|
uint8_t UidBuffer[COMMAND_UID_BUFSIZE];
|
|
uint16_t UidSize = ActiveConfiguration.UidSize;
|
|
170a: 20 91 fb 20 lds r18, 0x20FB
|
|
INLINE void ApplicationReset(void) {
|
|
ActiveConfiguration.ApplicationResetFunc();
|
|
}
|
|
|
|
INLINE void ApplicationGetUid(ConfigurationUidType Uid) {
|
|
ActiveConfiguration.ApplicationGetUidFunc(Uid);
|
|
170e: e0 91 f5 20 lds r30, 0x20F5
|
|
1712: f0 91 f6 20 lds r31, 0x20F6
|
|
1716: ce 01 movw r24, r28
|
|
1718: 01 96 adiw r24, 0x01 ; 1
|
|
171a: 29 a3 std Y+33, r18 ; 0x21
|
|
171c: 09 95 icall
|
|
|
|
ApplicationGetUid(UidBuffer);
|
|
|
|
BufferToHexString(OutParam, TERMINAL_BUFFER_SIZE,
|
|
171e: 29 a1 ldd r18, Y+33 ; 0x21
|
|
1720: 30 e0 ldi r19, 0x00 ; 0
|
|
1722: ae 01 movw r20, r28
|
|
1724: 4f 5f subi r20, 0xFF ; 255
|
|
1726: 5f 4f sbci r21, 0xFF ; 255
|
|
1728: 60 e0 ldi r22, 0x00 ; 0
|
|
172a: 71 e0 ldi r23, 0x01 ; 1
|
|
172c: c8 01 movw r24, r16
|
|
172e: 5e d9 rcall .-3396 ; 0x9ec <BufferToHexString>
|
|
UidBuffer, UidSize);
|
|
|
|
return COMMAND_INFO_OK_WITH_TEXT_ID;
|
|
}
|
|
1730: 85 e6 ldi r24, 0x65 ; 101
|
|
1732: a1 96 adiw r28, 0x21 ; 33
|
|
1734: cd bf out 0x3d, r28 ; 61
|
|
1736: de bf out 0x3e, r29 ; 62
|
|
1738: df 91 pop r29
|
|
173a: cf 91 pop r28
|
|
173c: 1f 91 pop r17
|
|
173e: 0f 91 pop r16
|
|
1740: 08 95 ret
|
|
|
|
00001742 <CommandSetUid>:
|
|
|
|
CommandStatusIdType CommandSetUid(const char* InParam)
|
|
{
|
|
1742: bf 92 push r11
|
|
1744: cf 92 push r12
|
|
1746: df 92 push r13
|
|
1748: ef 92 push r14
|
|
174a: ff 92 push r15
|
|
174c: 0f 93 push r16
|
|
174e: 1f 93 push r17
|
|
1750: cf 93 push r28
|
|
1752: df 93 push r29
|
|
1754: cd b7 in r28, 0x3d ; 61
|
|
1756: de b7 in r29, 0x3e ; 62
|
|
1758: a0 97 sbiw r28, 0x20 ; 32
|
|
175a: cd bf out 0x3d, r28 ; 61
|
|
175c: de bf out 0x3e, r29 ; 62
|
|
175e: 8c 01 movw r16, r24
|
|
uint8_t UidBuffer[COMMAND_UID_BUFSIZE];
|
|
uint16_t UidSize = ActiveConfiguration.UidSize;
|
|
1760: c0 90 fb 20 lds r12, 0x20FB
|
|
1764: d1 2c mov r13, r1
|
|
|
|
if (strcmp_P(InParam, PSTR(COMMAND_UID_RANDOM)) == 0) {
|
|
1766: 67 e2 ldi r22, 0x27 ; 39
|
|
1768: 74 e0 ldi r23, 0x04 ; 4
|
|
176a: 0e 94 16 24 call 0x482c ; 0x482c <strcmp_P>
|
|
176e: 89 2b or r24, r25
|
|
1770: 51 f5 brne .+84 ; 0x17c6 <CommandSetUid+0x84>
|
|
/* Load with random bytes */
|
|
for (uint8_t i=0; i<UidSize; i++) {
|
|
1772: c1 14 cp r12, r1
|
|
1774: d1 04 cpc r13, r1
|
|
1776: b1 f1 breq .+108 ; 0x17e4 <CommandSetUid+0xa2>
|
|
1778: b1 2c mov r11, r1
|
|
177a: ee 24 eor r14, r14
|
|
177c: e3 94 inc r14
|
|
177e: f1 2c mov r15, r1
|
|
1780: ec 0e add r14, r28
|
|
1782: fd 1e adc r15, r29
|
|
1784: 00 e0 ldi r16, 0x00 ; 0
|
|
1786: 10 e0 ldi r17, 0x00 ; 0
|
|
UidBuffer[i] = RandomGetByte();
|
|
1788: 17 d9 rcall .-3538 ; 0x9b8 <RandomGetByte>
|
|
178a: f7 01 movw r30, r14
|
|
178c: e0 0f add r30, r16
|
|
178e: f1 1f adc r31, r17
|
|
1790: 80 83 st Z, r24
|
|
uint8_t UidBuffer[COMMAND_UID_BUFSIZE];
|
|
uint16_t UidSize = ActiveConfiguration.UidSize;
|
|
|
|
if (strcmp_P(InParam, PSTR(COMMAND_UID_RANDOM)) == 0) {
|
|
/* Load with random bytes */
|
|
for (uint8_t i=0; i<UidSize; i++) {
|
|
1792: b3 94 inc r11
|
|
1794: 0b 2d mov r16, r11
|
|
1796: 10 e0 ldi r17, 0x00 ; 0
|
|
1798: 0c 15 cp r16, r12
|
|
179a: 1d 05 cpc r17, r13
|
|
179c: a8 f3 brcs .-22 ; 0x1788 <CommandSetUid+0x46>
|
|
}
|
|
|
|
INLINE void ApplicationSetUid(ConfigurationUidType Uid) {
|
|
ActiveConfiguration.ApplicationSetUidFunc(Uid);
|
|
179e: e0 91 f7 20 lds r30, 0x20F7
|
|
17a2: f0 91 f8 20 lds r31, 0x20F8
|
|
17a6: c7 01 movw r24, r14
|
|
17a8: 09 95 icall
|
|
}
|
|
}
|
|
|
|
ApplicationSetUid(UidBuffer);
|
|
|
|
return COMMAND_INFO_OK_ID;
|
|
17aa: 84 e6 ldi r24, 0x64 ; 100
|
|
}
|
|
17ac: a0 96 adiw r28, 0x20 ; 32
|
|
17ae: cd bf out 0x3d, r28 ; 61
|
|
17b0: de bf out 0x3e, r29 ; 62
|
|
17b2: df 91 pop r29
|
|
17b4: cf 91 pop r28
|
|
17b6: 1f 91 pop r17
|
|
17b8: 0f 91 pop r16
|
|
17ba: ff 90 pop r15
|
|
17bc: ef 90 pop r14
|
|
17be: df 90 pop r13
|
|
17c0: cf 90 pop r12
|
|
17c2: bf 90 pop r11
|
|
17c4: 08 95 ret
|
|
for (uint8_t i=0; i<UidSize; i++) {
|
|
UidBuffer[i] = RandomGetByte();
|
|
}
|
|
} else {
|
|
/* Convert to Bytes */
|
|
if (HexStringToBuffer(UidBuffer, sizeof(UidBuffer), InParam) != UidSize) {
|
|
17c6: a8 01 movw r20, r16
|
|
17c8: 60 e2 ldi r22, 0x20 ; 32
|
|
17ca: 70 e0 ldi r23, 0x00 ; 0
|
|
17cc: ee 24 eor r14, r14
|
|
17ce: e3 94 inc r14
|
|
17d0: f1 2c mov r15, r1
|
|
17d2: ec 0e add r14, r28
|
|
17d4: fd 1e adc r15, r29
|
|
17d6: c7 01 movw r24, r14
|
|
17d8: 4b d9 rcall .-3434 ; 0xa70 <HexStringToBuffer>
|
|
17da: 8c 15 cp r24, r12
|
|
17dc: 9d 05 cpc r25, r13
|
|
17de: f9 f2 breq .-66 ; 0x179e <CommandSetUid+0x5c>
|
|
/* Malformed input. Abort */
|
|
return COMMAND_ERR_INVALID_PARAM_ID;
|
|
17e0: 8a ec ldi r24, 0xCA ; 202
|
|
17e2: e4 cf rjmp .-56 ; 0x17ac <CommandSetUid+0x6a>
|
|
17e4: ee 24 eor r14, r14
|
|
17e6: e3 94 inc r14
|
|
17e8: f1 2c mov r15, r1
|
|
17ea: ec 0e add r14, r28
|
|
17ec: fd 1e adc r15, r29
|
|
17ee: d7 cf rjmp .-82 ; 0x179e <CommandSetUid+0x5c>
|
|
|
|
000017f0 <CommandGetReadOnly>:
|
|
return COMMAND_INFO_OK_ID;
|
|
}
|
|
|
|
CommandStatusIdType CommandGetReadOnly(char* OutParam)
|
|
{
|
|
if (ActiveConfiguration.ReadOnly) {
|
|
17f0: 20 91 fc 20 lds r18, 0x20FC
|
|
17f4: 21 11 cpse r18, r1
|
|
17f6: 07 c0 rjmp .+14 ; 0x1806 <CommandGetReadOnly+0x16>
|
|
OutParam[0] = COMMAND_CHAR_TRUE;
|
|
} else {
|
|
OutParam[0] = COMMAND_CHAR_FALSE;
|
|
17f8: 20 e3 ldi r18, 0x30 ; 48
|
|
17fa: fc 01 movw r30, r24
|
|
17fc: 20 83 st Z, r18
|
|
}
|
|
|
|
OutParam[1] = '\0';
|
|
17fe: fc 01 movw r30, r24
|
|
1800: 11 82 std Z+1, r1 ; 0x01
|
|
|
|
return COMMAND_INFO_OK_WITH_TEXT_ID;
|
|
}
|
|
1802: 85 e6 ldi r24, 0x65 ; 101
|
|
1804: 08 95 ret
|
|
}
|
|
|
|
CommandStatusIdType CommandGetReadOnly(char* OutParam)
|
|
{
|
|
if (ActiveConfiguration.ReadOnly) {
|
|
OutParam[0] = COMMAND_CHAR_TRUE;
|
|
1806: 21 e3 ldi r18, 0x31 ; 49
|
|
1808: fc 01 movw r30, r24
|
|
180a: 20 83 st Z, r18
|
|
} else {
|
|
OutParam[0] = COMMAND_CHAR_FALSE;
|
|
}
|
|
|
|
OutParam[1] = '\0';
|
|
180c: fc 01 movw r30, r24
|
|
180e: 11 82 std Z+1, r1 ; 0x01
|
|
|
|
return COMMAND_INFO_OK_WITH_TEXT_ID;
|
|
}
|
|
1810: 85 e6 ldi r24, 0x65 ; 101
|
|
1812: 08 95 ret
|
|
|
|
00001814 <CommandSetReadOnly>:
|
|
|
|
CommandStatusIdType CommandSetReadOnly(const char* InParam)
|
|
{
|
|
if (InParam[1] == '\0') {
|
|
1814: fc 01 movw r30, r24
|
|
1816: 21 81 ldd r18, Z+1 ; 0x01
|
|
1818: 21 11 cpse r18, r1
|
|
181a: 05 c0 rjmp .+10 ; 0x1826 <CommandSetReadOnly+0x12>
|
|
if (InParam[0] == COMMAND_CHAR_TRUE) {
|
|
181c: 80 81 ld r24, Z
|
|
181e: 81 33 cpi r24, 0x31 ; 49
|
|
1820: 41 f0 breq .+16 ; 0x1832 <CommandSetReadOnly+0x1e>
|
|
ActiveConfiguration.ReadOnly = true;
|
|
return COMMAND_INFO_OK_ID;
|
|
} else if (InParam[0] == COMMAND_CHAR_FALSE) {
|
|
1822: 80 33 cpi r24, 0x30 ; 48
|
|
1824: 11 f0 breq .+4 ; 0x182a <CommandSetReadOnly+0x16>
|
|
ActiveConfiguration.ReadOnly = false;
|
|
return COMMAND_INFO_OK_ID;
|
|
}
|
|
}
|
|
|
|
return COMMAND_ERR_INVALID_PARAM_ID;
|
|
1826: 8a ec ldi r24, 0xCA ; 202
|
|
}
|
|
1828: 08 95 ret
|
|
if (InParam[1] == '\0') {
|
|
if (InParam[0] == COMMAND_CHAR_TRUE) {
|
|
ActiveConfiguration.ReadOnly = true;
|
|
return COMMAND_INFO_OK_ID;
|
|
} else if (InParam[0] == COMMAND_CHAR_FALSE) {
|
|
ActiveConfiguration.ReadOnly = false;
|
|
182a: 10 92 fc 20 sts 0x20FC, r1
|
|
return COMMAND_INFO_OK_ID;
|
|
182e: 84 e6 ldi r24, 0x64 ; 100
|
|
1830: 08 95 ret
|
|
|
|
CommandStatusIdType CommandSetReadOnly(const char* InParam)
|
|
{
|
|
if (InParam[1] == '\0') {
|
|
if (InParam[0] == COMMAND_CHAR_TRUE) {
|
|
ActiveConfiguration.ReadOnly = true;
|
|
1832: 81 e0 ldi r24, 0x01 ; 1
|
|
1834: 80 93 fc 20 sts 0x20FC, r24
|
|
return COMMAND_INFO_OK_ID;
|
|
1838: 84 e6 ldi r24, 0x64 ; 100
|
|
183a: 08 95 ret
|
|
|
|
0000183c <CommandExecUpload>:
|
|
return COMMAND_ERR_INVALID_PARAM_ID;
|
|
}
|
|
|
|
CommandStatusIdType CommandExecUpload(char* OutMessage)
|
|
{
|
|
XModemReceive(MemoryUploadBlock);
|
|
183c: 8f e1 ldi r24, 0x1F ; 31
|
|
183e: 98 e0 ldi r25, 0x08 ; 8
|
|
1840: f7 d0 rcall .+494 ; 0x1a30 <XModemReceive>
|
|
return COMMAND_INFO_XMODEM_WAIT_ID;
|
|
}
|
|
1842: 8e e6 ldi r24, 0x6E ; 110
|
|
1844: 08 95 ret
|
|
|
|
00001846 <CommandExecDownload>:
|
|
|
|
CommandStatusIdType CommandExecDownload(char* OutMessage)
|
|
{
|
|
XModemSend(MemoryDownloadBlock);
|
|
1846: 87 e5 ldi r24, 0x57 ; 87
|
|
1848: 98 e0 ldi r25, 0x08 ; 8
|
|
184a: 0a d1 rcall .+532 ; 0x1a60 <XModemSend>
|
|
return COMMAND_INFO_XMODEM_WAIT_ID;
|
|
}
|
|
184c: 8e e6 ldi r24, 0x6E ; 110
|
|
184e: 08 95 ret
|
|
|
|
00001850 <CommandExecReset>:
|
|
* enumerating the device once attached until \ref USB_Attach() is called.
|
|
*/
|
|
static inline void USB_Detach(void) ATTR_ALWAYS_INLINE;
|
|
static inline void USB_Detach(void)
|
|
{
|
|
USB.CTRLB &= ~USB_ATTACH_bm;
|
|
1850: e0 ec ldi r30, 0xC0 ; 192
|
|
1852: f4 e0 ldi r31, 0x04 ; 4
|
|
1854: 81 81 ldd r24, Z+1 ; 0x01
|
|
1856: 8e 7f andi r24, 0xFE ; 254
|
|
1858: 81 83 std Z+1, r24 ; 0x01
|
|
|
|
CommandStatusIdType CommandExecReset(char* OutMessage)
|
|
{
|
|
USB_Detach();
|
|
USB_Disable();
|
|
185a: 0e 94 aa 20 call 0x4154 ; 0x4154 <USB_Disable>
|
|
|
|
SystemReset();
|
|
185e: 0e 94 06 04 call 0x80c ; 0x80c <SystemReset>
|
|
|
|
return COMMAND_INFO_OK_ID;
|
|
}
|
|
1862: 84 e6 ldi r24, 0x64 ; 100
|
|
1864: 08 95 ret
|
|
|
|
00001866 <CommandExecUpgrade>:
|
|
1866: e0 ec ldi r30, 0xC0 ; 192
|
|
1868: f4 e0 ldi r31, 0x04 ; 4
|
|
186a: 81 81 ldd r24, Z+1 ; 0x01
|
|
186c: 8e 7f andi r24, 0xFE ; 254
|
|
186e: 81 83 std Z+1, r24 ; 0x01
|
|
|
|
#ifdef SUPPORT_FIRMWARE_UPGRADE
|
|
CommandStatusIdType CommandExecUpgrade(char* OutMessage)
|
|
{
|
|
USB_Detach();
|
|
USB_Disable();
|
|
1870: 0e 94 aa 20 call 0x4154 ; 0x4154 <USB_Disable>
|
|
|
|
SystemEnterBootloader();
|
|
1874: 0e 94 0d 04 call 0x81a ; 0x81a <SystemEnterBootloader>
|
|
|
|
return COMMAND_INFO_OK_ID;
|
|
}
|
|
1878: 84 e6 ldi r24, 0x64 ; 100
|
|
187a: 08 95 ret
|
|
|
|
0000187c <CommandGetMemSize>:
|
|
#endif
|
|
|
|
CommandStatusIdType CommandGetMemSize(char* OutParam)
|
|
{
|
|
snprintf_P(OutParam, TERMINAL_BUFFER_SIZE, PSTR("%u"), ActiveConfiguration.MemorySize);
|
|
187c: e9 ef ldi r30, 0xF9 ; 249
|
|
187e: f0 e2 ldi r31, 0x20 ; 32
|
|
1880: 21 81 ldd r18, Z+1 ; 0x01
|
|
1882: 2f 93 push r18
|
|
1884: 20 81 ld r18, Z
|
|
1886: 2f 93 push r18
|
|
1888: 2e e2 ldi r18, 0x2E ; 46
|
|
188a: 34 e0 ldi r19, 0x04 ; 4
|
|
188c: 3f 93 push r19
|
|
188e: 2f 93 push r18
|
|
1890: 21 e0 ldi r18, 0x01 ; 1
|
|
1892: 2f 93 push r18
|
|
1894: 1f 92 push r1
|
|
1896: 9f 93 push r25
|
|
1898: 8f 93 push r24
|
|
189a: 0e 94 37 24 call 0x486e ; 0x486e <snprintf_P>
|
|
|
|
return COMMAND_INFO_OK_WITH_TEXT_ID;
|
|
189e: 8d b7 in r24, 0x3d ; 61
|
|
18a0: 9e b7 in r25, 0x3e ; 62
|
|
18a2: 08 96 adiw r24, 0x08 ; 8
|
|
18a4: 8d bf out 0x3d, r24 ; 61
|
|
18a6: 9e bf out 0x3e, r25 ; 62
|
|
}
|
|
18a8: 85 e6 ldi r24, 0x65 ; 101
|
|
18aa: 08 95 ret
|
|
|
|
000018ac <CommandGetUidSize>:
|
|
|
|
CommandStatusIdType CommandGetUidSize(char* OutParam)
|
|
{
|
|
snprintf_P(OutParam, TERMINAL_BUFFER_SIZE, PSTR("%u"), ActiveConfiguration.UidSize);
|
|
18ac: 20 91 fb 20 lds r18, 0x20FB
|
|
18b0: 1f 92 push r1
|
|
18b2: 2f 93 push r18
|
|
18b4: 21 e3 ldi r18, 0x31 ; 49
|
|
18b6: 34 e0 ldi r19, 0x04 ; 4
|
|
18b8: 3f 93 push r19
|
|
18ba: 2f 93 push r18
|
|
18bc: 21 e0 ldi r18, 0x01 ; 1
|
|
18be: 2f 93 push r18
|
|
18c0: 1f 92 push r1
|
|
18c2: 9f 93 push r25
|
|
18c4: 8f 93 push r24
|
|
18c6: 0e 94 37 24 call 0x486e ; 0x486e <snprintf_P>
|
|
|
|
return COMMAND_INFO_OK_WITH_TEXT_ID;
|
|
18ca: 8d b7 in r24, 0x3d ; 61
|
|
18cc: 9e b7 in r25, 0x3e ; 62
|
|
18ce: 08 96 adiw r24, 0x08 ; 8
|
|
18d0: 8d bf out 0x3d, r24 ; 61
|
|
18d2: 9e bf out 0x3e, r25 ; 62
|
|
}
|
|
18d4: 85 e6 ldi r24, 0x65 ; 101
|
|
18d6: 08 95 ret
|
|
|
|
000018d8 <CommandExecButton>:
|
|
|
|
CommandStatusIdType CommandExecButton(char* OutMessage)
|
|
{
|
|
ButtonGetActionList(OutMessage, TERMINAL_BUFFER_SIZE);
|
|
18d8: 60 e0 ldi r22, 0x00 ; 0
|
|
18da: 71 e0 ldi r23, 0x01 ; 1
|
|
18dc: 03 dd rcall .-1530 ; 0x12e4 <ButtonGetActionList>
|
|
|
|
return COMMAND_INFO_OK_WITH_TEXT_ID;
|
|
}
|
|
18de: 85 e6 ldi r24, 0x65 ; 101
|
|
18e0: 08 95 ret
|
|
|
|
000018e2 <CommandGetButton>:
|
|
|
|
CommandStatusIdType CommandGetButton(char* OutParam)
|
|
{
|
|
ButtonGetActionByName(OutParam, TERMINAL_BUFFER_SIZE);
|
|
18e2: 60 e0 ldi r22, 0x00 ; 0
|
|
18e4: 71 e0 ldi r23, 0x01 ; 1
|
|
18e6: 36 dd rcall .-1428 ; 0x1354 <ButtonGetActionByName>
|
|
|
|
return COMMAND_INFO_OK_WITH_TEXT_ID;
|
|
}
|
|
18e8: 85 e6 ldi r24, 0x65 ; 101
|
|
18ea: 08 95 ret
|
|
|
|
000018ec <CommandSetButton>:
|
|
|
|
CommandStatusIdType CommandSetButton(const char* InParam)
|
|
{
|
|
if (ButtonSetActionByName(InParam)) {
|
|
18ec: 41 dd rcall .-1406 ; 0x1370 <ButtonSetActionByName>
|
|
18ee: 81 11 cpse r24, r1
|
|
18f0: 02 c0 rjmp .+4 ; 0x18f6 <CommandSetButton+0xa>
|
|
SettingsSave();
|
|
return COMMAND_INFO_OK_ID;
|
|
} else {
|
|
return COMMAND_ERR_INVALID_PARAM_ID;
|
|
18f2: 8a ec ldi r24, 0xCA ; 202
|
|
}
|
|
}
|
|
18f4: 08 95 ret
|
|
}
|
|
|
|
CommandStatusIdType CommandSetButton(const char* InParam)
|
|
{
|
|
if (ButtonSetActionByName(InParam)) {
|
|
SettingsSave();
|
|
18f6: 8d dd rcall .-1254 ; 0x1412 <SettingsSave>
|
|
return COMMAND_INFO_OK_ID;
|
|
18f8: 84 e6 ldi r24, 0x64 ; 100
|
|
18fa: 08 95 ret
|
|
|
|
000018fc <CommandGetSetting>:
|
|
}
|
|
}
|
|
|
|
CommandStatusIdType CommandGetSetting(char* OutParam)
|
|
{
|
|
SettingsGetActiveByName(OutParam, TERMINAL_BUFFER_SIZE);
|
|
18fc: 60 e0 ldi r22, 0x00 ; 0
|
|
18fe: 71 e0 ldi r23, 0x01 ; 1
|
|
1900: 0f de rcall .-994 ; 0x1520 <SettingsGetActiveByName>
|
|
return COMMAND_INFO_OK_WITH_TEXT_ID;
|
|
}
|
|
1902: 85 e6 ldi r24, 0x65 ; 101
|
|
1904: 08 95 ret
|
|
|
|
00001906 <CommandSetSetting>:
|
|
|
|
CommandStatusIdType CommandSetSetting(const char* InParam)
|
|
{
|
|
if (SettingsSetActiveByName(InParam)) {
|
|
1906: 16 de rcall .-980 ; 0x1534 <SettingsSetActiveByName>
|
|
1908: 81 11 cpse r24, r1
|
|
190a: 02 c0 rjmp .+4 ; 0x1910 <CommandSetSetting+0xa>
|
|
SettingsSave();
|
|
return COMMAND_INFO_OK_ID;
|
|
} else {
|
|
return COMMAND_ERR_INVALID_PARAM_ID;
|
|
190c: 8a ec ldi r24, 0xCA ; 202
|
|
}
|
|
}
|
|
190e: 08 95 ret
|
|
}
|
|
|
|
CommandStatusIdType CommandSetSetting(const char* InParam)
|
|
{
|
|
if (SettingsSetActiveByName(InParam)) {
|
|
SettingsSave();
|
|
1910: 80 dd rcall .-1280 ; 0x1412 <SettingsSave>
|
|
return COMMAND_INFO_OK_ID;
|
|
1912: 84 e6 ldi r24, 0x64 ; 100
|
|
1914: 08 95 ret
|
|
|
|
00001916 <CommandExecClear>:
|
|
}
|
|
}
|
|
|
|
CommandStatusIdType CommandExecClear(char* OutParam)
|
|
{
|
|
MemoryClear();
|
|
1916: 38 db rcall .-2448 ; 0xf88 <MemoryClear>
|
|
return COMMAND_INFO_OK_ID;
|
|
}
|
|
1918: 84 e6 ldi r24, 0x64 ; 100
|
|
191a: 08 95 ret
|
|
|
|
0000191c <CommandExecHelp>:
|
|
|
|
CommandStatusIdType CommandExecHelp(char* OutMessage)
|
|
{
|
|
191c: bf 92 push r11
|
|
191e: cf 92 push r12
|
|
1920: df 92 push r13
|
|
1922: ef 92 push r14
|
|
1924: ff 92 push r15
|
|
1926: 0f 93 push r16
|
|
1928: 1f 93 push r17
|
|
192a: cf 93 push r28
|
|
192c: df 93 push r29
|
|
192e: 7c 01 movw r14, r24
|
|
const CommandEntryType* EntryPtr = CommandTable;
|
|
uint16_t ByteCount = TERMINAL_BUFFER_SIZE - 1; /* Account for '\0' */
|
|
1930: cf ef ldi r28, 0xFF ; 255
|
|
1932: d0 e0 ldi r29, 0x00 ; 0
|
|
return COMMAND_INFO_OK_ID;
|
|
}
|
|
|
|
CommandStatusIdType CommandExecHelp(char* OutMessage)
|
|
{
|
|
const CommandEntryType* EntryPtr = CommandTable;
|
|
1934: 3b e3 ldi r19, 0x3B ; 59
|
|
1936: c3 2e mov r12, r19
|
|
1938: 34 e0 ldi r19, 0x04 ; 4
|
|
193a: d3 2e mov r13, r19
|
|
*OutMessage++ = c;
|
|
CommandName++;
|
|
ByteCount--;
|
|
}
|
|
|
|
*OutMessage++ = ',';
|
|
193c: 4c e2 ldi r20, 0x2C ; 44
|
|
193e: b4 2e mov r11, r20
|
|
CommandStatusIdType CommandExecHelp(char* OutMessage)
|
|
{
|
|
const CommandEntryType* EntryPtr = CommandTable;
|
|
uint16_t ByteCount = TERMINAL_BUFFER_SIZE - 1; /* Account for '\0' */
|
|
|
|
while(strcmp_P(COMMAND_LIST_END, EntryPtr->Command) != 0) {
|
|
1940: 86 01 movw r16, r12
|
|
1942: b6 01 movw r22, r12
|
|
1944: 80 e9 ldi r24, 0x90 ; 144
|
|
1946: 90 e2 ldi r25, 0x20 ; 32
|
|
1948: 0e 94 16 24 call 0x482c ; 0x482c <strcmp_P>
|
|
194c: 89 2b or r24, r25
|
|
194e: 21 f1 breq .+72 ; 0x1998 <CommandExecHelp+0x7c>
|
|
const char* CommandName = EntryPtr->Command;
|
|
char c;
|
|
|
|
while( (c = pgm_read_byte(CommandName)) != '\0' && ByteCount > 32) {
|
|
1950: f6 01 movw r30, r12
|
|
1952: 84 91 lpm r24, Z
|
|
1954: 88 23 and r24, r24
|
|
1956: 89 f0 breq .+34 ; 0x197a <CommandExecHelp+0x5e>
|
|
1958: c1 32 cpi r28, 0x21 ; 33
|
|
195a: d1 05 cpc r29, r1
|
|
195c: 70 f0 brcs .+28 ; 0x197a <CommandExecHelp+0x5e>
|
|
195e: d7 01 movw r26, r14
|
|
1960: 03 c0 rjmp .+6 ; 0x1968 <CommandExecHelp+0x4c>
|
|
1962: c0 32 cpi r28, 0x20 ; 32
|
|
1964: d1 05 cpc r29, r1
|
|
1966: 49 f0 breq .+18 ; 0x197a <CommandExecHelp+0x5e>
|
|
*OutMessage++ = c;
|
|
1968: 8d 93 st X+, r24
|
|
196a: 7d 01 movw r14, r26
|
|
CommandName++;
|
|
196c: 0f 5f subi r16, 0xFF ; 255
|
|
196e: 1f 4f sbci r17, 0xFF ; 255
|
|
ByteCount--;
|
|
1970: 21 97 sbiw r28, 0x01 ; 1
|
|
|
|
while(strcmp_P(COMMAND_LIST_END, EntryPtr->Command) != 0) {
|
|
const char* CommandName = EntryPtr->Command;
|
|
char c;
|
|
|
|
while( (c = pgm_read_byte(CommandName)) != '\0' && ByteCount > 32) {
|
|
1972: f8 01 movw r30, r16
|
|
1974: 84 91 lpm r24, Z
|
|
1976: 81 11 cpse r24, r1
|
|
1978: f4 cf rjmp .-24 ; 0x1962 <CommandExecHelp+0x46>
|
|
*OutMessage++ = c;
|
|
CommandName++;
|
|
ByteCount--;
|
|
}
|
|
|
|
*OutMessage++ = ',';
|
|
197a: f7 01 movw r30, r14
|
|
197c: b1 92 st Z+, r11
|
|
197e: 7f 01 movw r14, r30
|
|
ByteCount--;
|
|
1980: 21 97 sbiw r28, 0x01 ; 1
|
|
|
|
EntryPtr++;
|
|
1982: f6 e1 ldi r31, 0x16 ; 22
|
|
1984: cf 0e add r12, r31
|
|
1986: d1 1c adc r13, r1
|
|
CommandStatusIdType CommandExecHelp(char* OutMessage)
|
|
{
|
|
const CommandEntryType* EntryPtr = CommandTable;
|
|
uint16_t ByteCount = TERMINAL_BUFFER_SIZE - 1; /* Account for '\0' */
|
|
|
|
while(strcmp_P(COMMAND_LIST_END, EntryPtr->Command) != 0) {
|
|
1988: 86 01 movw r16, r12
|
|
198a: b6 01 movw r22, r12
|
|
198c: 80 e9 ldi r24, 0x90 ; 144
|
|
198e: 90 e2 ldi r25, 0x20 ; 32
|
|
1990: 0e 94 16 24 call 0x482c ; 0x482c <strcmp_P>
|
|
1994: 89 2b or r24, r25
|
|
1996: e1 f6 brne .-72 ; 0x1950 <CommandExecHelp+0x34>
|
|
ByteCount--;
|
|
|
|
EntryPtr++;
|
|
}
|
|
|
|
*--OutMessage = '\0';
|
|
1998: f7 01 movw r30, r14
|
|
199a: 31 97 sbiw r30, 0x01 ; 1
|
|
199c: 10 82 st Z, r1
|
|
|
|
return COMMAND_INFO_OK_WITH_TEXT_ID;
|
|
}
|
|
199e: 85 e6 ldi r24, 0x65 ; 101
|
|
19a0: df 91 pop r29
|
|
19a2: cf 91 pop r28
|
|
19a4: 1f 91 pop r17
|
|
19a6: 0f 91 pop r16
|
|
19a8: ff 90 pop r15
|
|
19aa: ef 90 pop r14
|
|
19ac: df 90 pop r13
|
|
19ae: cf 90 pop r12
|
|
19b0: bf 90 pop r11
|
|
19b2: 08 95 ret
|
|
|
|
000019b4 <CommandGetRssi>:
|
|
|
|
CommandStatusIdType CommandGetRssi(char* OutParam)
|
|
{
|
|
19b4: fc 01 movw r30, r24
|
|
}
|
|
|
|
static inline
|
|
uint16_t AntennaLevelGet(void)
|
|
{
|
|
ADCA.CH0.CTRL |= ADC_CH_START_bm;
|
|
19b6: 20 91 20 02 lds r18, 0x0220
|
|
19ba: 20 68 ori r18, 0x80 ; 128
|
|
19bc: 20 93 20 02 sts 0x0220, r18
|
|
while( !(ADCA.CH0.INTFLAGS & ADC_CH_CHIF_bm) );
|
|
19c0: 20 91 23 02 lds r18, 0x0223
|
|
19c4: 20 ff sbrs r18, 0
|
|
19c6: fc cf rjmp .-8 ; 0x19c0 <CommandGetRssi+0xc>
|
|
|
|
ADCA.CH0.INTFLAGS = ADC_CH_CHIF_bm;
|
|
19c8: 81 e0 ldi r24, 0x01 ; 1
|
|
19ca: 80 93 23 02 sts 0x0223, r24
|
|
|
|
int16_t Result = ADCA.CH0RES - ANTENNA_LEVEL_OFFSET;
|
|
19ce: a0 91 10 02 lds r26, 0x0210
|
|
19d2: b0 91 11 02 lds r27, 0x0211
|
|
if (Result < 0) Result = 0;
|
|
|
|
return (uint16_t) (((uint32_t) Result * ANTENNA_LEVEL_NUMERATOR) / ANTENNA_LEVEL_DENOMINATOR);
|
|
19d6: ae 5b subi r26, 0xBE ; 190
|
|
19d8: b1 09 sbc r27, r1
|
|
19da: b7 fd sbrc r27, 7
|
|
19dc: 1c c0 rjmp .+56 ; 0x1a16 <CommandGetRssi+0x62>
|
|
19de: 29 e6 ldi r18, 0x69 ; 105
|
|
19e0: 37 e5 ldi r19, 0x57 ; 87
|
|
19e2: 4b e0 ldi r20, 0x0B ; 11
|
|
19e4: 50 e0 ldi r21, 0x00 ; 0
|
|
19e6: 0e 94 97 23 call 0x472e ; 0x472e <__mulshisi3>
|
|
19ea: aa 27 eor r26, r26
|
|
19ec: bb 27 eor r27, r27
|
|
snprintf_P(OutParam, TERMINAL_BUFFER_SIZE,
|
|
19ee: 9f 93 push r25
|
|
19f0: 8f 93 push r24
|
|
19f2: 24 e3 ldi r18, 0x34 ; 52
|
|
19f4: 34 e0 ldi r19, 0x04 ; 4
|
|
19f6: 3f 93 push r19
|
|
19f8: 2f 93 push r18
|
|
19fa: 81 e0 ldi r24, 0x01 ; 1
|
|
19fc: 8f 93 push r24
|
|
19fe: 1f 92 push r1
|
|
1a00: ff 93 push r31
|
|
1a02: ef 93 push r30
|
|
1a04: 0e 94 37 24 call 0x486e ; 0x486e <snprintf_P>
|
|
PSTR("%5u mV"), AntennaLevelGet());
|
|
|
|
|
|
return COMMAND_INFO_OK_WITH_TEXT_ID;
|
|
1a08: 8d b7 in r24, 0x3d ; 61
|
|
1a0a: 9e b7 in r25, 0x3e ; 62
|
|
1a0c: 08 96 adiw r24, 0x08 ; 8
|
|
1a0e: 8d bf out 0x3d, r24 ; 61
|
|
1a10: 9e bf out 0x3e, r25 ; 62
|
|
}
|
|
1a12: 85 e6 ldi r24, 0x65 ; 101
|
|
1a14: 08 95 ret
|
|
1a16: a0 e0 ldi r26, 0x00 ; 0
|
|
1a18: b0 e0 ldi r27, 0x00 ; 0
|
|
1a1a: e1 cf rjmp .-62 ; 0x19de <CommandGetRssi+0x2a>
|
|
|
|
00001a1c <CalcChecksum.constprop.0>:
|
|
static uint32_t BlockAddress;
|
|
|
|
static XModemCallbackType CallbackFunc;
|
|
|
|
static uint8_t CalcChecksum(const void* Buffer, uint16_t ByteCount) {
|
|
uint8_t Checksum = CHECKSUM_INIT_VALUE;
|
|
1a1c: 80 e0 ldi r24, 0x00 ; 0
|
|
uint8_t* DataPtr = (uint8_t*) Buffer;
|
|
1a1e: e0 e1 ldi r30, 0x10 ; 16
|
|
1a20: f1 e2 ldi r31, 0x21 ; 33
|
|
|
|
while(ByteCount--) {
|
|
Checksum += *DataPtr++;
|
|
1a22: 91 91 ld r25, Z+
|
|
1a24: 89 0f add r24, r25
|
|
|
|
static uint8_t CalcChecksum(const void* Buffer, uint16_t ByteCount) {
|
|
uint8_t Checksum = CHECKSUM_INIT_VALUE;
|
|
uint8_t* DataPtr = (uint8_t*) Buffer;
|
|
|
|
while(ByteCount--) {
|
|
1a26: 91 e2 ldi r25, 0x21 ; 33
|
|
1a28: e0 39 cpi r30, 0x90 ; 144
|
|
1a2a: f9 07 cpc r31, r25
|
|
1a2c: d1 f7 brne .-12 ; 0x1a22 <CalcChecksum.constprop.0+0x6>
|
|
Checksum += *DataPtr++;
|
|
}
|
|
|
|
return Checksum;
|
|
}
|
|
1a2e: 08 95 ret
|
|
|
|
00001a30 <XModemReceive>:
|
|
|
|
void XModemReceive(XModemCallbackType TheCallbackFunc)
|
|
{
|
|
State = STATE_RECEIVE_INIT;
|
|
1a30: 21 e0 ldi r18, 0x01 ; 1
|
|
1a32: 20 93 95 20 sts 0x2095, r18
|
|
CurrentFrameNumber = FIRST_FRAME_NUMBER;
|
|
1a36: 20 93 96 20 sts 0x2096, r18
|
|
RetryCount = RECV_INIT_COUNT;
|
|
1a3a: 24 e1 ldi r18, 0x14 ; 20
|
|
1a3c: 20 93 97 20 sts 0x2097, r18
|
|
RetryTimeout = RECV_INIT_TIMEOUT;
|
|
1a40: 25 e0 ldi r18, 0x05 ; 5
|
|
1a42: 20 93 98 20 sts 0x2098, r18
|
|
BlockAddress = 0;
|
|
1a46: 10 92 99 20 sts 0x2099, r1
|
|
1a4a: 10 92 9a 20 sts 0x209A, r1
|
|
1a4e: 10 92 9b 20 sts 0x209B, r1
|
|
1a52: 10 92 9c 20 sts 0x209C, r1
|
|
|
|
CallbackFunc = TheCallbackFunc;
|
|
1a56: 80 93 9d 20 sts 0x209D, r24
|
|
1a5a: 90 93 9e 20 sts 0x209E, r25
|
|
1a5e: 08 95 ret
|
|
|
|
00001a60 <XModemSend>:
|
|
}
|
|
|
|
void XModemSend(XModemCallbackType TheCallbackFunc)
|
|
{
|
|
State = STATE_SEND_INIT;
|
|
1a60: 27 e0 ldi r18, 0x07 ; 7
|
|
1a62: 20 93 95 20 sts 0x2095, r18
|
|
RetryTimeout = SEND_INIT_TIMEOUT;
|
|
1a66: 24 e6 ldi r18, 0x64 ; 100
|
|
1a68: 20 93 98 20 sts 0x2098, r18
|
|
BlockAddress = 0;
|
|
1a6c: 10 92 99 20 sts 0x2099, r1
|
|
1a70: 10 92 9a 20 sts 0x209A, r1
|
|
1a74: 10 92 9b 20 sts 0x209B, r1
|
|
1a78: 10 92 9c 20 sts 0x209C, r1
|
|
|
|
CallbackFunc = TheCallbackFunc;
|
|
1a7c: 80 93 9d 20 sts 0x209D, r24
|
|
1a80: 90 93 9e 20 sts 0x209E, r25
|
|
1a84: 08 95 ret
|
|
|
|
00001a86 <XModemProcessByte>:
|
|
}
|
|
|
|
bool XModemProcessByte(uint8_t Byte)
|
|
{
|
|
1a86: cf 93 push r28
|
|
1a88: c8 2f mov r28, r24
|
|
switch(State) {
|
|
1a8a: 90 91 95 20 lds r25, 0x2095
|
|
1a8e: 95 30 cpi r25, 0x05 ; 5
|
|
1a90: 09 f4 brne .+2 ; 0x1a94 <XModemProcessByte+0xe>
|
|
1a92: 7f c0 rjmp .+254 ; 0x1b92 <XModemProcessByte+0x10c>
|
|
1a94: e0 f0 brcs .+56 ; 0x1ace <XModemProcessByte+0x48>
|
|
1a96: 97 30 cpi r25, 0x07 ; 7
|
|
1a98: 09 f4 brne .+2 ; 0x1a9c <XModemProcessByte+0x16>
|
|
1a9a: 4a c0 rjmp .+148 ; 0x1b30 <XModemProcessByte+0xaa>
|
|
1a9c: 60 f5 brcc .+88 ; 0x1af6 <XModemProcessByte+0x70>
|
|
}
|
|
|
|
break;
|
|
|
|
case STATE_RECEIVE_PROCESS:
|
|
if (ReceivedFrameNumber == CurrentFrameNumber) {
|
|
1a9e: 20 91 a2 20 lds r18, 0x20A2
|
|
1aa2: 80 91 96 20 lds r24, 0x2096
|
|
1aa6: 28 17 cp r18, r24
|
|
1aa8: 09 f4 brne .+2 ; 0x1aac <XModemProcessByte+0x26>
|
|
1aaa: df c0 rjmp .+446 ; 0x1c6a <XModemProcessByte+0x1e4>
|
|
} else {
|
|
/* Data seems to be damaged */
|
|
TerminalSendByte(BYTE_NAK);
|
|
State = STATE_RECEIVE_WAIT;
|
|
}
|
|
} else if (ReceivedFrameNumber == (CurrentFrameNumber - 1)) {
|
|
1aac: 30 e0 ldi r19, 0x00 ; 0
|
|
1aae: 90 e0 ldi r25, 0x00 ; 0
|
|
1ab0: 01 97 sbiw r24, 0x01 ; 1
|
|
1ab2: 28 17 cp r18, r24
|
|
1ab4: 39 07 cpc r19, r25
|
|
1ab6: 09 f4 brne .+2 ; 0x1aba <XModemProcessByte+0x34>
|
|
1ab8: 07 c1 rjmp .+526 ; 0x1cc8 <XModemProcessByte+0x242>
|
|
INLINE void TerminalSendByte(uint8_t Byte) { CDC_Device_SendByte(&TerminalHandle, Byte); }
|
|
1aba: 68 e1 ldi r22, 0x18 ; 24
|
|
1abc: 80 e0 ldi r24, 0x00 ; 0
|
|
1abe: 90 e2 ldi r25, 0x20 ; 32
|
|
1ac0: 0e 94 00 22 call 0x4400 ; 0x4400 <CDC_Device_SendByte>
|
|
TerminalSendByte(BYTE_ACK);
|
|
State = STATE_RECEIVE_WAIT;
|
|
} else {
|
|
/* This frame is completely out of order. Just cancel */
|
|
TerminalSendByte(BYTE_CAN);
|
|
State = STATE_OFF;
|
|
1ac4: 10 92 95 20 sts 0x2095, r1
|
|
default:
|
|
return false;
|
|
break;
|
|
}
|
|
|
|
return true;
|
|
1ac8: 81 e0 ldi r24, 0x01 ; 1
|
|
}
|
|
1aca: cf 91 pop r28
|
|
1acc: 08 95 ret
|
|
CallbackFunc = TheCallbackFunc;
|
|
}
|
|
|
|
bool XModemProcessByte(uint8_t Byte)
|
|
{
|
|
switch(State) {
|
|
1ace: 93 30 cpi r25, 0x03 ; 3
|
|
1ad0: 09 f4 brne .+2 ; 0x1ad4 <XModemProcessByte+0x4e>
|
|
1ad2: 57 c0 rjmp .+174 ; 0x1b82 <XModemProcessByte+0xfc>
|
|
1ad4: b8 f0 brcs .+46 ; 0x1b04 <XModemProcessByte+0x7e>
|
|
ReceivedFrameNumber = Byte;
|
|
State = STATE_RECEIVE_FRAMENUM2;
|
|
break;
|
|
|
|
case STATE_RECEIVE_FRAMENUM2:
|
|
if (Byte == (255 - ReceivedFrameNumber)) {
|
|
1ad6: 90 e0 ldi r25, 0x00 ; 0
|
|
1ad8: 40 91 a2 20 lds r20, 0x20A2
|
|
1adc: 2f ef ldi r18, 0xFF ; 255
|
|
1ade: 30 e0 ldi r19, 0x00 ; 0
|
|
1ae0: 24 1b sub r18, r20
|
|
1ae2: 31 09 sbc r19, r1
|
|
1ae4: 82 17 cp r24, r18
|
|
1ae6: 93 07 cpc r25, r19
|
|
1ae8: 09 f0 breq .+2 ; 0x1aec <XModemProcessByte+0x66>
|
|
1aea: 6a c0 rjmp .+212 ; 0x1bc0 <XModemProcessByte+0x13a>
|
|
/* frame-number check passed. */
|
|
State = STATE_RECEIVE_DATA;
|
|
1aec: 85 e0 ldi r24, 0x05 ; 5
|
|
1aee: 80 93 95 20 sts 0x2095, r24
|
|
default:
|
|
return false;
|
|
break;
|
|
}
|
|
|
|
return true;
|
|
1af2: 81 e0 ldi r24, 0x01 ; 1
|
|
1af4: ea cf rjmp .-44 ; 0x1aca <XModemProcessByte+0x44>
|
|
CallbackFunc = TheCallbackFunc;
|
|
}
|
|
|
|
bool XModemProcessByte(uint8_t Byte)
|
|
{
|
|
switch(State) {
|
|
1af6: 98 30 cpi r25, 0x08 ; 8
|
|
1af8: f1 f0 breq .+60 ; 0x1b36 <XModemProcessByte+0xb0>
|
|
1afa: 99 30 cpi r25, 0x09 ; 9
|
|
1afc: a1 f0 breq .+40 ; 0x1b26 <XModemProcessByte+0xa0>
|
|
/* Receive Ack */
|
|
State = STATE_OFF;
|
|
break;
|
|
|
|
default:
|
|
return false;
|
|
1afe: 80 e0 ldi r24, 0x00 ; 0
|
|
break;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
1b00: cf 91 pop r28
|
|
1b02: 08 95 ret
|
|
CallbackFunc = TheCallbackFunc;
|
|
}
|
|
|
|
bool XModemProcessByte(uint8_t Byte)
|
|
{
|
|
switch(State) {
|
|
1b04: 91 30 cpi r25, 0x01 ; 1
|
|
1b06: d8 f3 brcs .-10 ; 0x1afe <XModemProcessByte+0x78>
|
|
case STATE_RECEIVE_INIT:
|
|
case STATE_RECEIVE_WAIT:
|
|
if (Byte == BYTE_SOH) {
|
|
1b08: 81 30 cpi r24, 0x01 ; 1
|
|
1b0a: 09 f4 brne .+2 ; 0x1b0e <XModemProcessByte+0x88>
|
|
1b0c: df c0 rjmp .+446 ; 0x1ccc <XModemProcessByte+0x246>
|
|
/* Next frame incoming */
|
|
BufferIdx = 0;
|
|
Checksum = CHECKSUM_INIT_VALUE;
|
|
State = STATE_RECEIVE_FRAMENUM1;
|
|
} else if (Byte == BYTE_EOT) {
|
|
1b0e: 84 30 cpi r24, 0x04 ; 4
|
|
1b10: 29 f0 breq .+10 ; 0x1b1c <XModemProcessByte+0x96>
|
|
/* Transmission finished */
|
|
TerminalSendByte(BYTE_ACK);
|
|
State = STATE_OFF;
|
|
} else if (Byte == BYTE_CAN) {
|
|
1b12: 88 31 cpi r24, 0x18 ; 24
|
|
1b14: 41 f0 breq .+16 ; 0x1b26 <XModemProcessByte+0xa0>
|
|
default:
|
|
return false;
|
|
break;
|
|
}
|
|
|
|
return true;
|
|
1b16: 81 e0 ldi r24, 0x01 ; 1
|
|
}
|
|
1b18: cf 91 pop r28
|
|
1b1a: 08 95 ret
|
|
1b1c: 66 e0 ldi r22, 0x06 ; 6
|
|
1b1e: 80 e0 ldi r24, 0x00 ; 0
|
|
1b20: 90 e2 ldi r25, 0x20 ; 32
|
|
1b22: 0e 94 00 22 call 0x4400 ; 0x4400 <CDC_Device_SendByte>
|
|
|
|
case STATE_SEND_WAIT:
|
|
if (Byte == BYTE_CAN) {
|
|
/* Cancel */
|
|
TerminalSendByte(BYTE_ACK);
|
|
State = STATE_OFF;
|
|
1b26: 10 92 95 20 sts 0x2095, r1
|
|
default:
|
|
return false;
|
|
break;
|
|
}
|
|
|
|
return true;
|
|
1b2a: 81 e0 ldi r24, 0x01 ; 1
|
|
}
|
|
1b2c: cf 91 pop r28
|
|
1b2e: 08 95 ret
|
|
|
|
break;
|
|
|
|
case STATE_SEND_INIT:
|
|
/* Start sending on NAK */
|
|
if (Byte == BYTE_NAK) {
|
|
1b30: 85 31 cpi r24, 0x15 ; 21
|
|
1b32: 09 f4 brne .+2 ; 0x1b36 <XModemProcessByte+0xb0>
|
|
1b34: 50 c0 rjmp .+160 ; 0x1bd6 <XModemProcessByte+0x150>
|
|
}
|
|
|
|
/* Fallthrough */
|
|
|
|
case STATE_SEND_WAIT:
|
|
if (Byte == BYTE_CAN) {
|
|
1b36: c8 31 cpi r28, 0x18 ; 24
|
|
1b38: 89 f3 breq .-30 ; 0x1b1c <XModemProcessByte+0x96>
|
|
/* Cancel */
|
|
TerminalSendByte(BYTE_ACK);
|
|
State = STATE_OFF;
|
|
} else if (Byte == BYTE_ACK) {
|
|
1b3a: c6 30 cpi r28, 0x06 ; 6
|
|
1b3c: 09 f4 brne .+2 ; 0x1b40 <XModemProcessByte+0xba>
|
|
1b3e: e1 c0 rjmp .+450 ; 0x1d02 <XModemProcessByte+0x27c>
|
|
BlockAddress += XMODEM_BLOCK_SIZE;
|
|
} else {
|
|
TerminalSendByte(BYTE_EOT);
|
|
State = STATE_SEND_EOT;
|
|
}
|
|
} else if (Byte == BYTE_NAK){
|
|
1b40: c5 31 cpi r28, 0x15 ; 21
|
|
1b42: 49 f7 brne .-46 ; 0x1b16 <XModemProcessByte+0x90>
|
|
1b44: 61 e0 ldi r22, 0x01 ; 1
|
|
1b46: 80 e0 ldi r24, 0x00 ; 0
|
|
1b48: 90 e2 ldi r25, 0x20 ; 32
|
|
1b4a: 0e 94 00 22 call 0x4400 ; 0x4400 <CDC_Device_SendByte>
|
|
1b4e: 60 91 96 20 lds r22, 0x2096
|
|
1b52: 80 e0 ldi r24, 0x00 ; 0
|
|
1b54: 90 e2 ldi r25, 0x20 ; 32
|
|
1b56: 0e 94 00 22 call 0x4400 ; 0x4400 <CDC_Device_SendByte>
|
|
/* Resend frame */
|
|
TerminalSendByte(BYTE_SOH);
|
|
TerminalSendByte(CurrentFrameNumber);
|
|
TerminalSendByte(255 - CurrentFrameNumber);
|
|
1b5a: 60 91 96 20 lds r22, 0x2096
|
|
1b5e: 60 95 com r22
|
|
1b60: 80 e0 ldi r24, 0x00 ; 0
|
|
1b62: 90 e2 ldi r25, 0x20 ; 32
|
|
1b64: 0e 94 00 22 call 0x4400 ; 0x4400 <CDC_Device_SendByte>
|
|
TerminalSendBlock(TerminalBuffer, XMODEM_BLOCK_SIZE);
|
|
1b68: 60 e8 ldi r22, 0x80 ; 128
|
|
1b6a: 70 e0 ldi r23, 0x00 ; 0
|
|
1b6c: 80 e1 ldi r24, 0x10 ; 16
|
|
1b6e: 91 e2 ldi r25, 0x21 ; 33
|
|
1b70: 07 dd rcall .-1522 ; 0x1580 <TerminalSendBlock>
|
|
TerminalSendByte(CalcChecksum(TerminalBuffer, XMODEM_BLOCK_SIZE));
|
|
1b72: 54 df rcall .-344 ; 0x1a1c <CalcChecksum.constprop.0>
|
|
1b74: 68 2f mov r22, r24
|
|
1b76: 80 e0 ldi r24, 0x00 ; 0
|
|
1b78: 90 e2 ldi r25, 0x20 ; 32
|
|
1b7a: 0e 94 00 22 call 0x4400 ; 0x4400 <CDC_Device_SendByte>
|
|
default:
|
|
return false;
|
|
break;
|
|
}
|
|
|
|
return true;
|
|
1b7e: 81 e0 ldi r24, 0x01 ; 1
|
|
1b80: a4 cf rjmp .-184 ; 0x1aca <XModemProcessByte+0x44>
|
|
|
|
break;
|
|
|
|
case STATE_RECEIVE_FRAMENUM1:
|
|
/* Store frame number */
|
|
ReceivedFrameNumber = Byte;
|
|
1b82: 80 93 a2 20 sts 0x20A2, r24
|
|
State = STATE_RECEIVE_FRAMENUM2;
|
|
1b86: 84 e0 ldi r24, 0x04 ; 4
|
|
1b88: 80 93 95 20 sts 0x2095, r24
|
|
default:
|
|
return false;
|
|
break;
|
|
}
|
|
|
|
return true;
|
|
1b8c: 81 e0 ldi r24, 0x01 ; 1
|
|
}
|
|
1b8e: cf 91 pop r28
|
|
1b90: 08 95 ret
|
|
|
|
break;
|
|
|
|
case STATE_RECEIVE_DATA:
|
|
/* Process byte and update checksum */
|
|
TerminalBuffer[BufferIdx++] = Byte;
|
|
1b92: 20 91 9f 20 lds r18, 0x209F
|
|
1b96: 30 91 a0 20 lds r19, 0x20A0
|
|
1b9a: f9 01 movw r30, r18
|
|
1b9c: e0 5f subi r30, 0xF0 ; 240
|
|
1b9e: fe 4d sbci r31, 0xDE ; 222
|
|
1ba0: 80 83 st Z, r24
|
|
1ba2: c9 01 movw r24, r18
|
|
1ba4: 01 96 adiw r24, 0x01 ; 1
|
|
1ba6: 80 93 9f 20 sts 0x209F, r24
|
|
1baa: 90 93 a0 20 sts 0x20A0, r25
|
|
|
|
if (BufferIdx == XMODEM_BLOCK_SIZE) {
|
|
1bae: 80 38 cpi r24, 0x80 ; 128
|
|
1bb0: 91 05 cpc r25, r1
|
|
1bb2: 09 f0 breq .+2 ; 0x1bb6 <XModemProcessByte+0x130>
|
|
1bb4: b0 cf rjmp .-160 ; 0x1b16 <XModemProcessByte+0x90>
|
|
/* Block full */
|
|
State = STATE_RECEIVE_PROCESS;
|
|
1bb6: 86 e0 ldi r24, 0x06 ; 6
|
|
1bb8: 80 93 95 20 sts 0x2095, r24
|
|
default:
|
|
return false;
|
|
break;
|
|
}
|
|
|
|
return true;
|
|
1bbc: 81 e0 ldi r24, 0x01 ; 1
|
|
1bbe: 85 cf rjmp .-246 ; 0x1aca <XModemProcessByte+0x44>
|
|
1bc0: 65 e1 ldi r22, 0x15 ; 21
|
|
1bc2: 80 e0 ldi r24, 0x00 ; 0
|
|
1bc4: 90 e2 ldi r25, 0x20 ; 32
|
|
1bc6: 0e 94 00 22 call 0x4400 ; 0x4400 <CDC_Device_SendByte>
|
|
State = STATE_RECEIVE_WAIT;
|
|
}
|
|
} else if (ReceivedFrameNumber == (CurrentFrameNumber - 1)) {
|
|
/* This is a retransmission */
|
|
TerminalSendByte(BYTE_ACK);
|
|
State = STATE_RECEIVE_WAIT;
|
|
1bca: 82 e0 ldi r24, 0x02 ; 2
|
|
1bcc: 80 93 95 20 sts 0x2095, r24
|
|
default:
|
|
return false;
|
|
break;
|
|
}
|
|
|
|
return true;
|
|
1bd0: 81 e0 ldi r24, 0x01 ; 1
|
|
}
|
|
1bd2: cf 91 pop r28
|
|
1bd4: 08 95 ret
|
|
|
|
break;
|
|
|
|
case STATE_SEND_INIT:
|
|
/* Start sending on NAK */
|
|
if (Byte == BYTE_NAK) {
|
|
1bd6: 81 e0 ldi r24, 0x01 ; 1
|
|
/* Cancel */
|
|
TerminalSendByte(BYTE_ACK);
|
|
State = STATE_OFF;
|
|
} else if (Byte == BYTE_ACK) {
|
|
/* Acknowledge. Proceed to next frame, get data and calc checksum */
|
|
CurrentFrameNumber++;
|
|
1bd8: 80 93 96 20 sts 0x2096, r24
|
|
|
|
if (CallbackFunc(TerminalBuffer, BlockAddress, XMODEM_BLOCK_SIZE)) {
|
|
1bdc: 40 91 99 20 lds r20, 0x2099
|
|
1be0: 50 91 9a 20 lds r21, 0x209A
|
|
1be4: 60 91 9b 20 lds r22, 0x209B
|
|
1be8: 70 91 9c 20 lds r23, 0x209C
|
|
1bec: e0 91 9d 20 lds r30, 0x209D
|
|
1bf0: f0 91 9e 20 lds r31, 0x209E
|
|
1bf4: 20 e8 ldi r18, 0x80 ; 128
|
|
1bf6: 30 e0 ldi r19, 0x00 ; 0
|
|
1bf8: 80 e1 ldi r24, 0x10 ; 16
|
|
1bfa: 91 e2 ldi r25, 0x21 ; 33
|
|
1bfc: 09 95 icall
|
|
1bfe: 88 23 and r24, r24
|
|
1c00: 09 f4 brne .+2 ; 0x1c04 <XModemProcessByte+0x17e>
|
|
1c02: 6f c0 rjmp .+222 ; 0x1ce2 <XModemProcessByte+0x25c>
|
|
1c04: 61 e0 ldi r22, 0x01 ; 1
|
|
1c06: 80 e0 ldi r24, 0x00 ; 0
|
|
1c08: 90 e2 ldi r25, 0x20 ; 32
|
|
1c0a: 0e 94 00 22 call 0x4400 ; 0x4400 <CDC_Device_SendByte>
|
|
1c0e: 60 91 96 20 lds r22, 0x2096
|
|
1c12: 80 e0 ldi r24, 0x00 ; 0
|
|
1c14: 90 e2 ldi r25, 0x20 ; 32
|
|
1c16: 0e 94 00 22 call 0x4400 ; 0x4400 <CDC_Device_SendByte>
|
|
TerminalSendByte(BYTE_SOH);
|
|
TerminalSendByte(CurrentFrameNumber);
|
|
TerminalSendByte(255 - CurrentFrameNumber);
|
|
1c1a: 60 91 96 20 lds r22, 0x2096
|
|
1c1e: 60 95 com r22
|
|
1c20: 80 e0 ldi r24, 0x00 ; 0
|
|
1c22: 90 e2 ldi r25, 0x20 ; 32
|
|
1c24: 0e 94 00 22 call 0x4400 ; 0x4400 <CDC_Device_SendByte>
|
|
TerminalSendBlock(TerminalBuffer, XMODEM_BLOCK_SIZE);
|
|
1c28: 60 e8 ldi r22, 0x80 ; 128
|
|
1c2a: 70 e0 ldi r23, 0x00 ; 0
|
|
1c2c: 80 e1 ldi r24, 0x10 ; 16
|
|
1c2e: 91 e2 ldi r25, 0x21 ; 33
|
|
1c30: a7 dc rcall .-1714 ; 0x1580 <TerminalSendBlock>
|
|
TerminalSendByte(CalcChecksum(TerminalBuffer, XMODEM_BLOCK_SIZE));
|
|
1c32: f4 de rcall .-536 ; 0x1a1c <CalcChecksum.constprop.0>
|
|
1c34: 68 2f mov r22, r24
|
|
1c36: 80 e0 ldi r24, 0x00 ; 0
|
|
1c38: 90 e2 ldi r25, 0x20 ; 32
|
|
1c3a: 0e 94 00 22 call 0x4400 ; 0x4400 <CDC_Device_SendByte>
|
|
|
|
BlockAddress += XMODEM_BLOCK_SIZE;
|
|
1c3e: 80 91 99 20 lds r24, 0x2099
|
|
1c42: 90 91 9a 20 lds r25, 0x209A
|
|
1c46: a0 91 9b 20 lds r26, 0x209B
|
|
1c4a: b0 91 9c 20 lds r27, 0x209C
|
|
1c4e: 80 58 subi r24, 0x80 ; 128
|
|
1c50: 9f 4f sbci r25, 0xFF ; 255
|
|
1c52: af 4f sbci r26, 0xFF ; 255
|
|
1c54: bf 4f sbci r27, 0xFF ; 255
|
|
1c56: 80 93 99 20 sts 0x2099, r24
|
|
1c5a: 90 93 9a 20 sts 0x209A, r25
|
|
1c5e: a0 93 9b 20 sts 0x209B, r26
|
|
1c62: b0 93 9c 20 sts 0x209C, r27
|
|
default:
|
|
return false;
|
|
break;
|
|
}
|
|
|
|
return true;
|
|
1c66: 81 e0 ldi r24, 0x01 ; 1
|
|
1c68: 57 cf rjmp .-338 ; 0x1b18 <XModemProcessByte+0x92>
|
|
|
|
case STATE_RECEIVE_PROCESS:
|
|
if (ReceivedFrameNumber == CurrentFrameNumber) {
|
|
/* This is the expected frame. Calculate and verify checksum */
|
|
|
|
if (CalcChecksum(TerminalBuffer, XMODEM_BLOCK_SIZE) == Byte) {
|
|
1c6a: d8 de rcall .-592 ; 0x1a1c <CalcChecksum.constprop.0>
|
|
1c6c: 8c 13 cpse r24, r28
|
|
1c6e: a8 cf rjmp .-176 ; 0x1bc0 <XModemProcessByte+0x13a>
|
|
/* Checksum is valid. Pass received data to callback function */
|
|
if (CallbackFunc(TerminalBuffer, BlockAddress, XMODEM_BLOCK_SIZE)) {
|
|
1c70: 40 91 99 20 lds r20, 0x2099
|
|
1c74: 50 91 9a 20 lds r21, 0x209A
|
|
1c78: 60 91 9b 20 lds r22, 0x209B
|
|
1c7c: 70 91 9c 20 lds r23, 0x209C
|
|
1c80: e0 91 9d 20 lds r30, 0x209D
|
|
1c84: f0 91 9e 20 lds r31, 0x209E
|
|
1c88: 20 e8 ldi r18, 0x80 ; 128
|
|
1c8a: 30 e0 ldi r19, 0x00 ; 0
|
|
1c8c: 80 e1 ldi r24, 0x10 ; 16
|
|
1c8e: 91 e2 ldi r25, 0x21 ; 33
|
|
1c90: 09 95 icall
|
|
1c92: 88 23 and r24, r24
|
|
1c94: 81 f1 breq .+96 ; 0x1cf6 <XModemProcessByte+0x270>
|
|
/* Proceed to next frame and send ACK */
|
|
CurrentFrameNumber++;
|
|
1c96: 80 91 96 20 lds r24, 0x2096
|
|
1c9a: 8f 5f subi r24, 0xFF ; 255
|
|
1c9c: 80 93 96 20 sts 0x2096, r24
|
|
BlockAddress += XMODEM_BLOCK_SIZE;
|
|
1ca0: 80 91 99 20 lds r24, 0x2099
|
|
1ca4: 90 91 9a 20 lds r25, 0x209A
|
|
1ca8: a0 91 9b 20 lds r26, 0x209B
|
|
1cac: b0 91 9c 20 lds r27, 0x209C
|
|
1cb0: 80 58 subi r24, 0x80 ; 128
|
|
1cb2: 9f 4f sbci r25, 0xFF ; 255
|
|
1cb4: af 4f sbci r26, 0xFF ; 255
|
|
1cb6: bf 4f sbci r27, 0xFF ; 255
|
|
1cb8: 80 93 99 20 sts 0x2099, r24
|
|
1cbc: 90 93 9a 20 sts 0x209A, r25
|
|
1cc0: a0 93 9b 20 sts 0x209B, r26
|
|
1cc4: b0 93 9c 20 sts 0x209C, r27
|
|
1cc8: 66 e0 ldi r22, 0x06 ; 6
|
|
1cca: 7b cf rjmp .-266 ; 0x1bc2 <XModemProcessByte+0x13c>
|
|
switch(State) {
|
|
case STATE_RECEIVE_INIT:
|
|
case STATE_RECEIVE_WAIT:
|
|
if (Byte == BYTE_SOH) {
|
|
/* Next frame incoming */
|
|
BufferIdx = 0;
|
|
1ccc: 10 92 9f 20 sts 0x209F, r1
|
|
1cd0: 10 92 a0 20 sts 0x20A0, r1
|
|
Checksum = CHECKSUM_INIT_VALUE;
|
|
1cd4: 10 92 a1 20 sts 0x20A1, r1
|
|
State = STATE_RECEIVE_FRAMENUM1;
|
|
1cd8: 83 e0 ldi r24, 0x03 ; 3
|
|
1cda: 80 93 95 20 sts 0x2095, r24
|
|
default:
|
|
return false;
|
|
break;
|
|
}
|
|
|
|
return true;
|
|
1cde: 81 e0 ldi r24, 0x01 ; 1
|
|
1ce0: f4 ce rjmp .-536 ; 0x1aca <XModemProcessByte+0x44>
|
|
1ce2: 64 e0 ldi r22, 0x04 ; 4
|
|
1ce4: 80 e0 ldi r24, 0x00 ; 0
|
|
1ce6: 90 e2 ldi r25, 0x20 ; 32
|
|
1ce8: 0e 94 00 22 call 0x4400 ; 0x4400 <CDC_Device_SendByte>
|
|
TerminalSendByte(CalcChecksum(TerminalBuffer, XMODEM_BLOCK_SIZE));
|
|
|
|
BlockAddress += XMODEM_BLOCK_SIZE;
|
|
} else {
|
|
TerminalSendByte(BYTE_EOT);
|
|
State = STATE_SEND_EOT;
|
|
1cec: 89 e0 ldi r24, 0x09 ; 9
|
|
1cee: 80 93 95 20 sts 0x2095, r24
|
|
default:
|
|
return false;
|
|
break;
|
|
}
|
|
|
|
return true;
|
|
1cf2: 81 e0 ldi r24, 0x01 ; 1
|
|
1cf4: ea ce rjmp .-556 ; 0x1aca <XModemProcessByte+0x44>
|
|
1cf6: 68 e1 ldi r22, 0x18 ; 24
|
|
1cf8: 80 e0 ldi r24, 0x00 ; 0
|
|
1cfa: 90 e2 ldi r25, 0x20 ; 32
|
|
1cfc: 0e 94 00 22 call 0x4400 ; 0x4400 <CDC_Device_SendByte>
|
|
1d00: dc ce rjmp .-584 ; 0x1aba <XModemProcessByte+0x34>
|
|
1d02: 80 91 96 20 lds r24, 0x2096
|
|
1d06: 8f 5f subi r24, 0xFF ; 255
|
|
1d08: 67 cf rjmp .-306 ; 0x1bd8 <XModemProcessByte+0x152>
|
|
|
|
00001d0a <XModemTick>:
|
|
}
|
|
|
|
void XModemTick(void)
|
|
{
|
|
/* Timeouts go here */
|
|
switch(State) {
|
|
1d0a: 80 91 95 20 lds r24, 0x2095
|
|
1d0e: 81 30 cpi r24, 0x01 ; 1
|
|
1d10: 71 f0 breq .+28 ; 0x1d2e <XModemTick+0x24>
|
|
1d12: 87 30 cpi r24, 0x07 ; 7
|
|
1d14: 09 f0 breq .+2 ; 0x1d18 <XModemTick+0xe>
|
|
1d16: 08 95 ret
|
|
RetryTimeout = RECV_INIT_TIMEOUT;
|
|
}
|
|
break;
|
|
|
|
case STATE_SEND_INIT:
|
|
if (RetryTimeout-- == 0) {
|
|
1d18: 80 91 98 20 lds r24, 0x2098
|
|
1d1c: 98 2f mov r25, r24
|
|
1d1e: 91 50 subi r25, 0x01 ; 1
|
|
1d20: 90 93 98 20 sts 0x2098, r25
|
|
1d24: 81 11 cpse r24, r1
|
|
1d26: f7 cf rjmp .-18 ; 0x1d16 <XModemTick+0xc>
|
|
/* Abort */
|
|
State = STATE_OFF;
|
|
1d28: 10 92 95 20 sts 0x2095, r1
|
|
1d2c: 08 95 ret
|
|
void XModemTick(void)
|
|
{
|
|
/* Timeouts go here */
|
|
switch(State) {
|
|
case STATE_RECEIVE_INIT:
|
|
if (RetryTimeout-- == 0) {
|
|
1d2e: 80 91 98 20 lds r24, 0x2098
|
|
1d32: 98 2f mov r25, r24
|
|
1d34: 91 50 subi r25, 0x01 ; 1
|
|
1d36: 90 93 98 20 sts 0x2098, r25
|
|
1d3a: 81 11 cpse r24, r1
|
|
1d3c: ec cf rjmp .-40 ; 0x1d16 <XModemTick+0xc>
|
|
if (RetryCount-- > 0) {
|
|
1d3e: 80 91 97 20 lds r24, 0x2097
|
|
1d42: 98 2f mov r25, r24
|
|
1d44: 91 50 subi r25, 0x01 ; 1
|
|
1d46: 90 93 97 20 sts 0x2097, r25
|
|
1d4a: 81 11 cpse r24, r1
|
|
1d4c: 06 c0 rjmp .+12 ; 0x1d5a <XModemTick+0x50>
|
|
/* Put out communication request */
|
|
TerminalSendChar(BYTE_NAK);
|
|
} else {
|
|
/* Just shut off after some time. */
|
|
State = STATE_OFF;
|
|
1d4e: 10 92 95 20 sts 0x2095, r1
|
|
}
|
|
|
|
RetryTimeout = RECV_INIT_TIMEOUT;
|
|
1d52: 85 e0 ldi r24, 0x05 ; 5
|
|
1d54: 80 93 98 20 sts 0x2098, r24
|
|
1d58: 08 95 ret
|
|
void EVENT_USB_Device_Connect(void);
|
|
void EVENT_USB_Device_Disconnect(void);
|
|
void EVENT_USB_Device_ConfigurationChanged(void);
|
|
void EVENT_USB_Device_ControlRequest(void);
|
|
|
|
INLINE void TerminalSendChar(char c) { CDC_Device_SendByte(&TerminalHandle, c); }
|
|
1d5a: 65 e1 ldi r22, 0x15 ; 21
|
|
1d5c: 80 e0 ldi r24, 0x00 ; 0
|
|
1d5e: 90 e2 ldi r25, 0x20 ; 32
|
|
1d60: 0e 94 00 22 call 0x4400 ; 0x4400 <CDC_Device_SendByte>
|
|
1d64: f6 cf rjmp .-20 ; 0x1d52 <XModemTick+0x48>
|
|
|
|
00001d66 <CommandLineProcessByte>:
|
|
void CommandLineInit(void)
|
|
{
|
|
BufferIdx = 0;
|
|
}
|
|
|
|
bool CommandLineProcessByte(uint8_t Byte) {
|
|
1d66: 1f 93 push r17
|
|
1d68: cf 93 push r28
|
|
1d6a: df 93 push r29
|
|
if (IS_CHARACTER(Byte)){
|
|
1d6c: 98 2f mov r25, r24
|
|
1d6e: 91 54 subi r25, 0x41 ; 65
|
|
1d70: 9a 31 cpi r25, 0x1A ; 26
|
|
1d72: 20 f0 brcs .+8 ; 0x1d7c <CommandLineProcessByte+0x16>
|
|
1d74: 90 52 subi r25, 0x20 ; 32
|
|
1d76: 9a 31 cpi r25, 0x1A ; 26
|
|
1d78: b8 f4 brcc .+46 ; 0x1da8 <CommandLineProcessByte+0x42>
|
|
/* Store uppercase character */
|
|
if (IS_LOWERCASE(Byte)) {
|
|
Byte = TO_UPPERCASE(Byte);
|
|
1d7a: 80 52 subi r24, 0x20 ; 32
|
|
}
|
|
|
|
/* Prevent buffer overflow and account for '\0' */
|
|
if (BufferIdx < (sizeof(TerminalBuffer) / sizeof(*TerminalBuffer) - 1)) {
|
|
1d7c: 20 91 a3 20 lds r18, 0x20A3
|
|
1d80: 30 91 a4 20 lds r19, 0x20A4
|
|
1d84: 2f 3f cpi r18, 0xFF ; 255
|
|
1d86: 31 05 cpc r19, r1
|
|
1d88: 50 f4 brcc .+20 ; 0x1d9e <CommandLineProcessByte+0x38>
|
|
TerminalBuffer[BufferIdx++] = Byte;
|
|
1d8a: f9 01 movw r30, r18
|
|
1d8c: e0 5f subi r30, 0xF0 ; 240
|
|
1d8e: fe 4d sbci r31, 0xDE ; 222
|
|
1d90: 80 83 st Z, r24
|
|
1d92: 2f 5f subi r18, 0xFF ; 255
|
|
1d94: 3f 4f sbci r19, 0xFF ; 255
|
|
1d96: 20 93 a3 20 sts 0x20A3, r18
|
|
1d9a: 30 93 a4 20 sts 0x20A4, r19
|
|
} else {
|
|
/* Ignore other chars */
|
|
}
|
|
|
|
return true;
|
|
}
|
|
1d9e: 81 e0 ldi r24, 0x01 ; 1
|
|
1da0: df 91 pop r29
|
|
1da2: cf 91 pop r28
|
|
1da4: 1f 91 pop r17
|
|
1da6: 08 95 ret
|
|
{
|
|
BufferIdx = 0;
|
|
}
|
|
|
|
bool CommandLineProcessByte(uint8_t Byte) {
|
|
if (IS_CHARACTER(Byte)){
|
|
1da8: 9f 5c subi r25, 0xCF ; 207
|
|
1daa: 9a 30 cpi r25, 0x0A ; 10
|
|
1dac: 38 f3 brcs .-50 ; 0x1d7c <CommandLineProcessByte+0x16>
|
|
1dae: 8f 35 cpi r24, 0x5F ; 95
|
|
1db0: 29 f3 breq .-54 ; 0x1d7c <CommandLineProcessByte+0x16>
|
|
1db2: 8f 33 cpi r24, 0x3F ; 63
|
|
1db4: 19 f3 breq .-58 ; 0x1d7c <CommandLineProcessByte+0x16>
|
|
1db6: 8d 33 cpi r24, 0x3D ; 61
|
|
1db8: 09 f3 breq .-62 ; 0x1d7c <CommandLineProcessByte+0x16>
|
|
|
|
/* Prevent buffer overflow and account for '\0' */
|
|
if (BufferIdx < (sizeof(TerminalBuffer) / sizeof(*TerminalBuffer) - 1)) {
|
|
TerminalBuffer[BufferIdx++] = Byte;
|
|
}
|
|
}else if (Byte == '\r') {
|
|
1dba: 8d 30 cpi r24, 0x0D ; 13
|
|
1dbc: a9 f0 breq .+42 ; 0x1de8 <CommandLineProcessByte+0x82>
|
|
/* Process on \r. Terminate string and decode. */
|
|
TerminalBuffer[BufferIdx] = '\0';
|
|
BufferIdx = 0;
|
|
|
|
DecodeCommand();
|
|
}else if (Byte == '\b') {
|
|
1dbe: 88 30 cpi r24, 0x08 ; 8
|
|
1dc0: 39 f0 breq .+14 ; 0x1dd0 <CommandLineProcessByte+0x6a>
|
|
/* Backspace. Delete last character in buffer. */
|
|
if (BufferIdx > 0) {
|
|
BufferIdx--;
|
|
}
|
|
} else if (Byte == 0x1B){
|
|
1dc2: 8b 31 cpi r24, 0x1B ; 27
|
|
1dc4: 61 f7 brne .-40 ; 0x1d9e <CommandLineProcessByte+0x38>
|
|
/* Drop buffer on escape */
|
|
BufferIdx = 0;
|
|
1dc6: 10 92 a3 20 sts 0x20A3, r1
|
|
1dca: 10 92 a4 20 sts 0x20A4, r1
|
|
1dce: e7 cf rjmp .-50 ; 0x1d9e <CommandLineProcessByte+0x38>
|
|
BufferIdx = 0;
|
|
|
|
DecodeCommand();
|
|
}else if (Byte == '\b') {
|
|
/* Backspace. Delete last character in buffer. */
|
|
if (BufferIdx > 0) {
|
|
1dd0: 80 91 a3 20 lds r24, 0x20A3
|
|
1dd4: 90 91 a4 20 lds r25, 0x20A4
|
|
1dd8: 00 97 sbiw r24, 0x00 ; 0
|
|
1dda: 09 f3 breq .-62 ; 0x1d9e <CommandLineProcessByte+0x38>
|
|
BufferIdx--;
|
|
1ddc: 01 97 sbiw r24, 0x01 ; 1
|
|
1dde: 80 93 a3 20 sts 0x20A3, r24
|
|
1de2: 90 93 a4 20 sts 0x20A4, r25
|
|
1de6: db cf rjmp .-74 ; 0x1d9e <CommandLineProcessByte+0x38>
|
|
if (BufferIdx < (sizeof(TerminalBuffer) / sizeof(*TerminalBuffer) - 1)) {
|
|
TerminalBuffer[BufferIdx++] = Byte;
|
|
}
|
|
}else if (Byte == '\r') {
|
|
/* Process on \r. Terminate string and decode. */
|
|
TerminalBuffer[BufferIdx] = '\0';
|
|
1de8: e0 91 a3 20 lds r30, 0x20A3
|
|
1dec: f0 91 a4 20 lds r31, 0x20A4
|
|
1df0: e0 5f subi r30, 0xF0 ; 240
|
|
1df2: fe 4d sbci r31, 0xDE ; 222
|
|
1df4: 10 82 st Z, r1
|
|
BufferIdx = 0;
|
|
1df6: 10 92 a3 20 sts 0x20A3, r1
|
|
1dfa: 10 92 a4 20 sts 0x20A4, r1
|
|
bool CommandFound = false;
|
|
CommandStatusIdType StatusId = COMMAND_ERR_UNKNOWN_CMD_ID;
|
|
char* pTerminalBuffer = (char*) TerminalBuffer;
|
|
|
|
/* Do some sanity check first */
|
|
if (!IS_COMMAND_DELIMITER(pTerminalBuffer[0])) {
|
|
1dfe: 80 91 10 21 lds r24, 0x2110
|
|
1e02: 88 23 and r24, r24
|
|
1e04: 09 f4 brne .+2 ; 0x1e08 <CommandLineProcessByte+0xa2>
|
|
1e06: a2 c0 rjmp .+324 ; 0x1f4c <CommandLineProcessByte+0x1e6>
|
|
1e08: 8f 33 cpi r24, 0x3F ; 63
|
|
1e0a: 09 f4 brne .+2 ; 0x1e0e <CommandLineProcessByte+0xa8>
|
|
1e0c: 9f c0 rjmp .+318 ; 0x1f4c <CommandLineProcessByte+0x1e6>
|
|
1e0e: 8d 33 cpi r24, 0x3D ; 61
|
|
1e10: 09 f4 brne .+2 ; 0x1e14 <CommandLineProcessByte+0xae>
|
|
1e12: 9c c0 rjmp .+312 ; 0x1f4c <CommandLineProcessByte+0x1e6>
|
|
1e14: e1 e1 ldi r30, 0x11 ; 17
|
|
1e16: f1 e2 ldi r31, 0x21 ; 33
|
|
1e18: 04 c0 rjmp .+8 ; 0x1e22 <CommandLineProcessByte+0xbc>
|
|
char* pCommandDelimiter = pTerminalBuffer;
|
|
char CommandDelimiter = '\0';
|
|
|
|
/* Search for command delimiter, store it and replace with '\0' */
|
|
while(!(IS_COMMAND_DELIMITER(*pCommandDelimiter)))
|
|
1e1a: 1f 33 cpi r17, 0x3F ; 63
|
|
1e1c: 31 f0 breq .+12 ; 0x1e2a <CommandLineProcessByte+0xc4>
|
|
1e1e: 1d 33 cpi r17, 0x3D ; 61
|
|
1e20: 21 f0 breq .+8 ; 0x1e2a <CommandLineProcessByte+0xc4>
|
|
pCommandDelimiter++;
|
|
1e22: ef 01 movw r28, r30
|
|
if (!IS_COMMAND_DELIMITER(pTerminalBuffer[0])) {
|
|
char* pCommandDelimiter = pTerminalBuffer;
|
|
char CommandDelimiter = '\0';
|
|
|
|
/* Search for command delimiter, store it and replace with '\0' */
|
|
while(!(IS_COMMAND_DELIMITER(*pCommandDelimiter)))
|
|
1e24: 11 91 ld r17, Z+
|
|
1e26: 11 11 cpse r17, r1
|
|
1e28: f8 cf rjmp .-16 ; 0x1e1a <CommandLineProcessByte+0xb4>
|
|
pCommandDelimiter++;
|
|
|
|
CommandDelimiter = *pCommandDelimiter;
|
|
*pCommandDelimiter = '\0';
|
|
1e2a: 18 82 st Y, r1
|
|
|
|
/* Search in command table */
|
|
for (i=0; i<(sizeof(CommandTable) / sizeof(*CommandTable)); i++) {
|
|
if (strcmp_P(pTerminalBuffer, CommandTable[i].Command) == 0) {
|
|
1e2c: 6b e3 ldi r22, 0x3B ; 59
|
|
1e2e: 74 e0 ldi r23, 0x04 ; 4
|
|
1e30: 80 e1 ldi r24, 0x10 ; 16
|
|
1e32: 91 e2 ldi r25, 0x21 ; 33
|
|
1e34: 0e 94 16 24 call 0x482c ; 0x482c <strcmp_P>
|
|
1e38: 89 2b or r24, r25
|
|
1e3a: 09 f4 brne .+2 ; 0x1e3e <CommandLineProcessByte+0xd8>
|
|
1e3c: 32 c1 rjmp .+612 ; 0x20a2 <CommandLineProcessByte+0x33c>
|
|
1e3e: 61 e5 ldi r22, 0x51 ; 81
|
|
1e40: 74 e0 ldi r23, 0x04 ; 4
|
|
1e42: 80 e1 ldi r24, 0x10 ; 16
|
|
1e44: 91 e2 ldi r25, 0x21 ; 33
|
|
1e46: 0e 94 16 24 call 0x482c ; 0x482c <strcmp_P>
|
|
1e4a: 89 2b or r24, r25
|
|
1e4c: 09 f4 brne .+2 ; 0x1e50 <CommandLineProcessByte+0xea>
|
|
1e4e: 26 c1 rjmp .+588 ; 0x209c <CommandLineProcessByte+0x336>
|
|
1e50: 67 e6 ldi r22, 0x67 ; 103
|
|
1e52: 74 e0 ldi r23, 0x04 ; 4
|
|
1e54: 80 e1 ldi r24, 0x10 ; 16
|
|
1e56: 91 e2 ldi r25, 0x21 ; 33
|
|
1e58: 0e 94 16 24 call 0x482c ; 0x482c <strcmp_P>
|
|
1e5c: 89 2b or r24, r25
|
|
1e5e: 09 f4 brne .+2 ; 0x1e62 <CommandLineProcessByte+0xfc>
|
|
1e60: 1a c1 rjmp .+564 ; 0x2096 <CommandLineProcessByte+0x330>
|
|
1e62: 6d e7 ldi r22, 0x7D ; 125
|
|
1e64: 74 e0 ldi r23, 0x04 ; 4
|
|
1e66: 80 e1 ldi r24, 0x10 ; 16
|
|
1e68: 91 e2 ldi r25, 0x21 ; 33
|
|
1e6a: 0e 94 16 24 call 0x482c ; 0x482c <strcmp_P>
|
|
1e6e: 89 2b or r24, r25
|
|
1e70: 09 f4 brne .+2 ; 0x1e74 <CommandLineProcessByte+0x10e>
|
|
1e72: 0e c1 rjmp .+540 ; 0x2090 <CommandLineProcessByte+0x32a>
|
|
1e74: 63 e9 ldi r22, 0x93 ; 147
|
|
1e76: 74 e0 ldi r23, 0x04 ; 4
|
|
1e78: 80 e1 ldi r24, 0x10 ; 16
|
|
1e7a: 91 e2 ldi r25, 0x21 ; 33
|
|
1e7c: 0e 94 16 24 call 0x482c ; 0x482c <strcmp_P>
|
|
1e80: 89 2b or r24, r25
|
|
1e82: 09 f4 brne .+2 ; 0x1e86 <CommandLineProcessByte+0x120>
|
|
1e84: 02 c1 rjmp .+516 ; 0x208a <CommandLineProcessByte+0x324>
|
|
1e86: 69 ea ldi r22, 0xA9 ; 169
|
|
1e88: 74 e0 ldi r23, 0x04 ; 4
|
|
1e8a: 80 e1 ldi r24, 0x10 ; 16
|
|
1e8c: 91 e2 ldi r25, 0x21 ; 33
|
|
1e8e: 0e 94 16 24 call 0x482c ; 0x482c <strcmp_P>
|
|
1e92: 89 2b or r24, r25
|
|
1e94: 09 f4 brne .+2 ; 0x1e98 <CommandLineProcessByte+0x132>
|
|
1e96: f6 c0 rjmp .+492 ; 0x2084 <CommandLineProcessByte+0x31e>
|
|
1e98: 6f eb ldi r22, 0xBF ; 191
|
|
1e9a: 74 e0 ldi r23, 0x04 ; 4
|
|
1e9c: 80 e1 ldi r24, 0x10 ; 16
|
|
1e9e: 91 e2 ldi r25, 0x21 ; 33
|
|
1ea0: 0e 94 16 24 call 0x482c ; 0x482c <strcmp_P>
|
|
1ea4: 89 2b or r24, r25
|
|
1ea6: 09 f4 brne .+2 ; 0x1eaa <CommandLineProcessByte+0x144>
|
|
1ea8: ea c0 rjmp .+468 ; 0x207e <CommandLineProcessByte+0x318>
|
|
1eaa: 65 ed ldi r22, 0xD5 ; 213
|
|
1eac: 74 e0 ldi r23, 0x04 ; 4
|
|
1eae: 80 e1 ldi r24, 0x10 ; 16
|
|
1eb0: 91 e2 ldi r25, 0x21 ; 33
|
|
1eb2: 0e 94 16 24 call 0x482c ; 0x482c <strcmp_P>
|
|
1eb6: 89 2b or r24, r25
|
|
1eb8: 09 f4 brne .+2 ; 0x1ebc <CommandLineProcessByte+0x156>
|
|
1eba: de c0 rjmp .+444 ; 0x2078 <CommandLineProcessByte+0x312>
|
|
1ebc: 6b ee ldi r22, 0xEB ; 235
|
|
1ebe: 74 e0 ldi r23, 0x04 ; 4
|
|
1ec0: 80 e1 ldi r24, 0x10 ; 16
|
|
1ec2: 91 e2 ldi r25, 0x21 ; 33
|
|
1ec4: 0e 94 16 24 call 0x482c ; 0x482c <strcmp_P>
|
|
1ec8: 89 2b or r24, r25
|
|
1eca: 09 f4 brne .+2 ; 0x1ece <CommandLineProcessByte+0x168>
|
|
1ecc: d2 c0 rjmp .+420 ; 0x2072 <CommandLineProcessByte+0x30c>
|
|
1ece: 61 e0 ldi r22, 0x01 ; 1
|
|
1ed0: 75 e0 ldi r23, 0x05 ; 5
|
|
1ed2: 80 e1 ldi r24, 0x10 ; 16
|
|
1ed4: 91 e2 ldi r25, 0x21 ; 33
|
|
1ed6: 0e 94 16 24 call 0x482c ; 0x482c <strcmp_P>
|
|
1eda: 89 2b or r24, r25
|
|
1edc: 09 f4 brne .+2 ; 0x1ee0 <CommandLineProcessByte+0x17a>
|
|
1ede: c6 c0 rjmp .+396 ; 0x206c <CommandLineProcessByte+0x306>
|
|
1ee0: 67 e1 ldi r22, 0x17 ; 23
|
|
1ee2: 75 e0 ldi r23, 0x05 ; 5
|
|
1ee4: 80 e1 ldi r24, 0x10 ; 16
|
|
1ee6: 91 e2 ldi r25, 0x21 ; 33
|
|
1ee8: 0e 94 16 24 call 0x482c ; 0x482c <strcmp_P>
|
|
1eec: 89 2b or r24, r25
|
|
1eee: 09 f4 brne .+2 ; 0x1ef2 <CommandLineProcessByte+0x18c>
|
|
1ef0: ba c0 rjmp .+372 ; 0x2066 <CommandLineProcessByte+0x300>
|
|
1ef2: 6d e2 ldi r22, 0x2D ; 45
|
|
1ef4: 75 e0 ldi r23, 0x05 ; 5
|
|
1ef6: 80 e1 ldi r24, 0x10 ; 16
|
|
1ef8: 91 e2 ldi r25, 0x21 ; 33
|
|
1efa: 0e 94 16 24 call 0x482c ; 0x482c <strcmp_P>
|
|
1efe: 89 2b or r24, r25
|
|
1f00: 09 f4 brne .+2 ; 0x1f04 <CommandLineProcessByte+0x19e>
|
|
1f02: ae c0 rjmp .+348 ; 0x2060 <CommandLineProcessByte+0x2fa>
|
|
1f04: 63 e4 ldi r22, 0x43 ; 67
|
|
1f06: 75 e0 ldi r23, 0x05 ; 5
|
|
1f08: 80 e1 ldi r24, 0x10 ; 16
|
|
1f0a: 91 e2 ldi r25, 0x21 ; 33
|
|
1f0c: 0e 94 16 24 call 0x482c ; 0x482c <strcmp_P>
|
|
1f10: 89 2b or r24, r25
|
|
1f12: 09 f4 brne .+2 ; 0x1f16 <CommandLineProcessByte+0x1b0>
|
|
1f14: a2 c0 rjmp .+324 ; 0x205a <CommandLineProcessByte+0x2f4>
|
|
1f16: 69 e5 ldi r22, 0x59 ; 89
|
|
1f18: 75 e0 ldi r23, 0x05 ; 5
|
|
1f1a: 80 e1 ldi r24, 0x10 ; 16
|
|
1f1c: 91 e2 ldi r25, 0x21 ; 33
|
|
1f1e: 0e 94 16 24 call 0x482c ; 0x482c <strcmp_P>
|
|
1f22: 89 2b or r24, r25
|
|
1f24: 09 f4 brne .+2 ; 0x1f28 <CommandLineProcessByte+0x1c2>
|
|
1f26: 96 c0 rjmp .+300 ; 0x2054 <CommandLineProcessByte+0x2ee>
|
|
1f28: 6f e6 ldi r22, 0x6F ; 111
|
|
1f2a: 75 e0 ldi r23, 0x05 ; 5
|
|
1f2c: 80 e1 ldi r24, 0x10 ; 16
|
|
1f2e: 91 e2 ldi r25, 0x21 ; 33
|
|
1f30: 0e 94 16 24 call 0x482c ; 0x482c <strcmp_P>
|
|
1f34: 89 2b or r24, r25
|
|
1f36: 09 f4 brne .+2 ; 0x1f3a <CommandLineProcessByte+0x1d4>
|
|
1f38: 8a c0 rjmp .+276 ; 0x204e <CommandLineProcessByte+0x2e8>
|
|
1f3a: 65 e8 ldi r22, 0x85 ; 133
|
|
1f3c: 75 e0 ldi r23, 0x05 ; 5
|
|
1f3e: 80 e1 ldi r24, 0x10 ; 16
|
|
1f40: 91 e2 ldi r25, 0x21 ; 33
|
|
1f42: 0e 94 16 24 call 0x482c ; 0x482c <strcmp_P>
|
|
1f46: 89 2b or r24, r25
|
|
1f48: 09 f4 brne .+2 ; 0x1f4c <CommandLineProcessByte+0x1e6>
|
|
1f4a: 52 c0 rjmp .+164 ; 0x1ff0 <CommandLineProcessByte+0x28a>
|
|
|
|
static void DecodeCommand(void)
|
|
{
|
|
uint8_t i;
|
|
bool CommandFound = false;
|
|
CommandStatusIdType StatusId = COMMAND_ERR_UNKNOWN_CMD_ID;
|
|
1f4c: 88 ec ldi r24, 0xC8 ; 200
|
|
}
|
|
|
|
static void DecodeCommand(void)
|
|
{
|
|
uint8_t i;
|
|
bool CommandFound = false;
|
|
1f4e: c0 e0 ldi r28, 0x00 ; 0
|
|
static const char* GetStatusMessageP(CommandStatusIdType StatusId)
|
|
{
|
|
uint8_t i;
|
|
|
|
for (i=0; i<(sizeof(StatusTable)/sizeof(*StatusTable)); i++) {
|
|
if (pgm_read_byte(&StatusTable[i].Id) == StatusId)
|
|
1f50: e1 ea ldi r30, 0xA1 ; 161
|
|
1f52: f5 e0 ldi r31, 0x05 ; 5
|
|
1f54: e4 91 lpm r30, Z
|
|
1f56: 8e 17 cp r24, r30
|
|
1f58: 09 f4 brne .+2 ; 0x1f5c <CommandLineProcessByte+0x1f6>
|
|
1f5a: 30 c0 rjmp .+96 ; 0x1fbc <CommandLineProcessByte+0x256>
|
|
1f5c: e2 ec ldi r30, 0xC2 ; 194
|
|
1f5e: f5 e0 ldi r31, 0x05 ; 5
|
|
1f60: e4 91 lpm r30, Z
|
|
1f62: 8e 17 cp r24, r30
|
|
1f64: 09 f4 brne .+2 ; 0x1f68 <CommandLineProcessByte+0x202>
|
|
1f66: 41 c0 rjmp .+130 ; 0x1fea <CommandLineProcessByte+0x284>
|
|
1f68: e3 ee ldi r30, 0xE3 ; 227
|
|
1f6a: f5 e0 ldi r31, 0x05 ; 5
|
|
1f6c: e4 91 lpm r30, Z
|
|
1f6e: 8e 17 cp r24, r30
|
|
1f70: 09 f4 brne .+2 ; 0x1f74 <CommandLineProcessByte+0x20e>
|
|
1f72: 38 c0 rjmp .+112 ; 0x1fe4 <CommandLineProcessByte+0x27e>
|
|
1f74: e4 e0 ldi r30, 0x04 ; 4
|
|
1f76: f6 e0 ldi r31, 0x06 ; 6
|
|
1f78: e4 91 lpm r30, Z
|
|
1f7a: 8e 17 cp r24, r30
|
|
1f7c: 81 f1 breq .+96 ; 0x1fde <CommandLineProcessByte+0x278>
|
|
1f7e: e5 e2 ldi r30, 0x25 ; 37
|
|
1f80: f6 e0 ldi r31, 0x06 ; 6
|
|
1f82: e4 91 lpm r30, Z
|
|
1f84: 8e 17 cp r24, r30
|
|
1f86: 41 f1 breq .+80 ; 0x1fd8 <CommandLineProcessByte+0x272>
|
|
1f88: e6 e4 ldi r30, 0x46 ; 70
|
|
1f8a: f6 e0 ldi r31, 0x06 ; 6
|
|
1f8c: e4 91 lpm r30, Z
|
|
1f8e: 8e 17 cp r24, r30
|
|
1f90: 01 f1 breq .+64 ; 0x1fd2 <CommandLineProcessByte+0x26c>
|
|
return StatusTable[i].Message;
|
|
}
|
|
|
|
return (void*) 0;
|
|
1f92: 80 e0 ldi r24, 0x00 ; 0
|
|
1f94: 90 e0 ldi r25, 0x00 ; 0
|
|
}
|
|
}
|
|
}
|
|
|
|
/* Send command status message */
|
|
TerminalSendStringP(GetStatusMessageP(StatusId));
|
|
1f96: e0 da rcall .-2624 ; 0x1558 <TerminalSendStringP>
|
|
TerminalSendStringP(PSTR(STATUS_MESSAGE_TRAILER));
|
|
1f98: 8b e9 ldi r24, 0x9B ; 155
|
|
1f9a: 95 e0 ldi r25, 0x05 ; 5
|
|
1f9c: dd da rcall .-2630 ; 0x1558 <TerminalSendStringP>
|
|
|
|
if (CommandFound && (pTerminalBuffer[0] != '\0') ) {
|
|
1f9e: cc 23 and r28, r28
|
|
1fa0: 09 f4 brne .+2 ; 0x1fa4 <CommandLineProcessByte+0x23e>
|
|
1fa2: fd ce rjmp .-518 ; 0x1d9e <CommandLineProcessByte+0x38>
|
|
1fa4: 80 91 10 21 lds r24, 0x2110
|
|
1fa8: 88 23 and r24, r24
|
|
1faa: 09 f4 brne .+2 ; 0x1fae <CommandLineProcessByte+0x248>
|
|
1fac: f8 ce rjmp .-528 ; 0x1d9e <CommandLineProcessByte+0x38>
|
|
/* Send optional answer */
|
|
TerminalSendString(pTerminalBuffer);
|
|
1fae: 80 e1 ldi r24, 0x10 ; 16
|
|
1fb0: 91 e2 ldi r25, 0x21 ; 33
|
|
1fb2: cd da rcall .-2662 ; 0x154e <TerminalSendString>
|
|
TerminalSendStringP(PSTR(OPTIONAL_ANSWER_TRAILER));
|
|
1fb4: 8e e9 ldi r24, 0x9E ; 158
|
|
1fb6: 95 e0 ldi r25, 0x05 ; 5
|
|
1fb8: cf da rcall .-2658 ; 0x1558 <TerminalSendStringP>
|
|
1fba: f1 ce rjmp .-542 ; 0x1d9e <CommandLineProcessByte+0x38>
|
|
static const char* GetStatusMessageP(CommandStatusIdType StatusId)
|
|
{
|
|
uint8_t i;
|
|
|
|
for (i=0; i<(sizeof(StatusTable)/sizeof(*StatusTable)); i++) {
|
|
if (pgm_read_byte(&StatusTable[i].Id) == StatusId)
|
|
1fbc: 20 e0 ldi r18, 0x00 ; 0
|
|
1fbe: 30 e0 ldi r19, 0x00 ; 0
|
|
return StatusTable[i].Message;
|
|
1fc0: 41 e2 ldi r20, 0x21 ; 33
|
|
1fc2: 42 9f mul r20, r18
|
|
1fc4: c0 01 movw r24, r0
|
|
1fc6: 43 9f mul r20, r19
|
|
1fc8: 90 0d add r25, r0
|
|
1fca: 11 24 eor r1, r1
|
|
1fcc: 8e 55 subi r24, 0x5E ; 94
|
|
1fce: 9a 4f sbci r25, 0xFA ; 250
|
|
1fd0: e2 cf rjmp .-60 ; 0x1f96 <CommandLineProcessByte+0x230>
|
|
static const char* GetStatusMessageP(CommandStatusIdType StatusId)
|
|
{
|
|
uint8_t i;
|
|
|
|
for (i=0; i<(sizeof(StatusTable)/sizeof(*StatusTable)); i++) {
|
|
if (pgm_read_byte(&StatusTable[i].Id) == StatusId)
|
|
1fd2: 25 e0 ldi r18, 0x05 ; 5
|
|
1fd4: 30 e0 ldi r19, 0x00 ; 0
|
|
1fd6: f4 cf rjmp .-24 ; 0x1fc0 <CommandLineProcessByte+0x25a>
|
|
1fd8: 24 e0 ldi r18, 0x04 ; 4
|
|
1fda: 30 e0 ldi r19, 0x00 ; 0
|
|
1fdc: f1 cf rjmp .-30 ; 0x1fc0 <CommandLineProcessByte+0x25a>
|
|
1fde: 23 e0 ldi r18, 0x03 ; 3
|
|
1fe0: 30 e0 ldi r19, 0x00 ; 0
|
|
1fe2: ee cf rjmp .-36 ; 0x1fc0 <CommandLineProcessByte+0x25a>
|
|
1fe4: 22 e0 ldi r18, 0x02 ; 2
|
|
1fe6: 30 e0 ldi r19, 0x00 ; 0
|
|
1fe8: eb cf rjmp .-42 ; 0x1fc0 <CommandLineProcessByte+0x25a>
|
|
1fea: 21 e0 ldi r18, 0x01 ; 1
|
|
1fec: 30 e0 ldi r19, 0x00 ; 0
|
|
1fee: e8 cf rjmp .-48 ; 0x1fc0 <CommandLineProcessByte+0x25a>
|
|
CommandDelimiter = *pCommandDelimiter;
|
|
*pCommandDelimiter = '\0';
|
|
|
|
/* Search in command table */
|
|
for (i=0; i<(sizeof(CommandTable) / sizeof(*CommandTable)); i++) {
|
|
if (strcmp_P(pTerminalBuffer, CommandTable[i].Command) == 0) {
|
|
1ff0: 2f e0 ldi r18, 0x0F ; 15
|
|
1ff2: 30 e0 ldi r19, 0x00 ; 0
|
|
/* Command found. Clear buffer, and call appropriate function */
|
|
char* pParam = ++pCommandDelimiter;
|
|
|
|
pTerminalBuffer[0] = '\0';
|
|
1ff4: 10 92 10 21 sts 0x2110, r1
|
|
CommandFound = true;
|
|
|
|
StatusId = CallCommandFunc(&CommandTable[i], CommandDelimiter, pParam);
|
|
1ff8: 46 e1 ldi r20, 0x16 ; 22
|
|
1ffa: 42 9f mul r20, r18
|
|
1ffc: c0 01 movw r24, r0
|
|
1ffe: 43 9f mul r20, r19
|
|
2000: 90 0d add r25, r0
|
|
2002: 11 24 eor r1, r1
|
|
2004: 85 5c subi r24, 0xC5 ; 197
|
|
2006: 9b 4f sbci r25, 0xFB ; 251
|
|
static CommandStatusIdType CallCommandFunc(
|
|
const CommandEntryType* CommandEntry, char CommandDelimiter, char* pParam) {
|
|
char* pTerminalBuffer = (char*) TerminalBuffer;
|
|
|
|
/* Call appropriate function depending on CommandDelimiter */
|
|
if (CommandDelimiter == CHAR_GET_MODE) {
|
|
2008: 1f 33 cpi r17, 0x3F ; 63
|
|
200a: f9 f0 breq .+62 ; 0x204a <CommandLineProcessByte+0x2e4>
|
|
CommandGetFuncType GetFunc = pgm_read_ptr(&CommandEntry->GetFunc);
|
|
if (GetFunc != NO_FUNCTION) {
|
|
return GetFunc(pTerminalBuffer);
|
|
}
|
|
} else if (CommandDelimiter == CHAR_SET_MODE) {
|
|
200c: 1d 33 cpi r17, 0x3D ; 61
|
|
200e: 89 f0 breq .+34 ; 0x2032 <CommandLineProcessByte+0x2cc>
|
|
CommandSetFuncType SetFunc = pgm_read_ptr(&CommandEntry->SetFunc);
|
|
if (SetFunc != NO_FUNCTION) {
|
|
return SetFunc(pParam);
|
|
}
|
|
} else if (CommandDelimiter == CHAR_EXEC_MODE){
|
|
2010: 11 23 and r17, r17
|
|
2012: 19 f0 breq .+6 ; 0x201a <CommandLineProcessByte+0x2b4>
|
|
} else {
|
|
/* This should not happen (TM) */
|
|
}
|
|
|
|
/* This delimiter has not been registered with this command */
|
|
return COMMAND_ERR_INVALID_USAGE_ID;
|
|
2014: 89 ec ldi r24, 0xC9 ; 201
|
|
if (strcmp_P(pTerminalBuffer, CommandTable[i].Command) == 0) {
|
|
/* Command found. Clear buffer, and call appropriate function */
|
|
char* pParam = ++pCommandDelimiter;
|
|
|
|
pTerminalBuffer[0] = '\0';
|
|
CommandFound = true;
|
|
2016: c1 e0 ldi r28, 0x01 ; 1
|
|
2018: 9b cf rjmp .-202 ; 0x1f50 <CommandLineProcessByte+0x1ea>
|
|
CommandSetFuncType SetFunc = pgm_read_ptr(&CommandEntry->SetFunc);
|
|
if (SetFunc != NO_FUNCTION) {
|
|
return SetFunc(pParam);
|
|
}
|
|
} else if (CommandDelimiter == CHAR_EXEC_MODE){
|
|
CommandExecFuncType ExecFunc = pgm_read_ptr(&CommandEntry->ExecFunc);
|
|
201a: 40 96 adiw r24, 0x10 ; 16
|
|
201c: fc 01 movw r30, r24
|
|
201e: 85 91 lpm r24, Z+
|
|
2020: 94 91 lpm r25, Z
|
|
2022: fc 01 movw r30, r24
|
|
if (ExecFunc != NO_FUNCTION) {
|
|
2024: 00 97 sbiw r24, 0x00 ; 0
|
|
2026: b1 f3 breq .-20 ; 0x2014 <CommandLineProcessByte+0x2ae>
|
|
return ExecFunc(pTerminalBuffer);
|
|
2028: 80 e1 ldi r24, 0x10 ; 16
|
|
202a: 91 e2 ldi r25, 0x21 ; 33
|
|
202c: 09 95 icall
|
|
if (strcmp_P(pTerminalBuffer, CommandTable[i].Command) == 0) {
|
|
/* Command found. Clear buffer, and call appropriate function */
|
|
char* pParam = ++pCommandDelimiter;
|
|
|
|
pTerminalBuffer[0] = '\0';
|
|
CommandFound = true;
|
|
202e: c1 e0 ldi r28, 0x01 ; 1
|
|
2030: 8f cf rjmp .-226 ; 0x1f50 <CommandLineProcessByte+0x1ea>
|
|
CommandGetFuncType GetFunc = pgm_read_ptr(&CommandEntry->GetFunc);
|
|
if (GetFunc != NO_FUNCTION) {
|
|
return GetFunc(pTerminalBuffer);
|
|
}
|
|
} else if (CommandDelimiter == CHAR_SET_MODE) {
|
|
CommandSetFuncType SetFunc = pgm_read_ptr(&CommandEntry->SetFunc);
|
|
2032: 42 96 adiw r24, 0x12 ; 18
|
|
2034: fc 01 movw r30, r24
|
|
2036: 85 91 lpm r24, Z+
|
|
2038: 94 91 lpm r25, Z
|
|
203a: fc 01 movw r30, r24
|
|
if (SetFunc != NO_FUNCTION) {
|
|
203c: 00 97 sbiw r24, 0x00 ; 0
|
|
203e: 51 f3 breq .-44 ; 0x2014 <CommandLineProcessByte+0x2ae>
|
|
return SetFunc(pParam);
|
|
2040: ce 01 movw r24, r28
|
|
2042: 01 96 adiw r24, 0x01 ; 1
|
|
2044: 09 95 icall
|
|
if (strcmp_P(pTerminalBuffer, CommandTable[i].Command) == 0) {
|
|
/* Command found. Clear buffer, and call appropriate function */
|
|
char* pParam = ++pCommandDelimiter;
|
|
|
|
pTerminalBuffer[0] = '\0';
|
|
CommandFound = true;
|
|
2046: c1 e0 ldi r28, 0x01 ; 1
|
|
2048: 83 cf rjmp .-250 ; 0x1f50 <CommandLineProcessByte+0x1ea>
|
|
const CommandEntryType* CommandEntry, char CommandDelimiter, char* pParam) {
|
|
char* pTerminalBuffer = (char*) TerminalBuffer;
|
|
|
|
/* Call appropriate function depending on CommandDelimiter */
|
|
if (CommandDelimiter == CHAR_GET_MODE) {
|
|
CommandGetFuncType GetFunc = pgm_read_ptr(&CommandEntry->GetFunc);
|
|
204a: 44 96 adiw r24, 0x14 ; 20
|
|
204c: e7 cf rjmp .-50 ; 0x201c <CommandLineProcessByte+0x2b6>
|
|
CommandDelimiter = *pCommandDelimiter;
|
|
*pCommandDelimiter = '\0';
|
|
|
|
/* Search in command table */
|
|
for (i=0; i<(sizeof(CommandTable) / sizeof(*CommandTable)); i++) {
|
|
if (strcmp_P(pTerminalBuffer, CommandTable[i].Command) == 0) {
|
|
204e: 2e e0 ldi r18, 0x0E ; 14
|
|
2050: 30 e0 ldi r19, 0x00 ; 0
|
|
2052: d0 cf rjmp .-96 ; 0x1ff4 <CommandLineProcessByte+0x28e>
|
|
2054: 2d e0 ldi r18, 0x0D ; 13
|
|
2056: 30 e0 ldi r19, 0x00 ; 0
|
|
2058: cd cf rjmp .-102 ; 0x1ff4 <CommandLineProcessByte+0x28e>
|
|
205a: 2c e0 ldi r18, 0x0C ; 12
|
|
205c: 30 e0 ldi r19, 0x00 ; 0
|
|
205e: ca cf rjmp .-108 ; 0x1ff4 <CommandLineProcessByte+0x28e>
|
|
2060: 2b e0 ldi r18, 0x0B ; 11
|
|
2062: 30 e0 ldi r19, 0x00 ; 0
|
|
2064: c7 cf rjmp .-114 ; 0x1ff4 <CommandLineProcessByte+0x28e>
|
|
2066: 2a e0 ldi r18, 0x0A ; 10
|
|
2068: 30 e0 ldi r19, 0x00 ; 0
|
|
206a: c4 cf rjmp .-120 ; 0x1ff4 <CommandLineProcessByte+0x28e>
|
|
206c: 29 e0 ldi r18, 0x09 ; 9
|
|
206e: 30 e0 ldi r19, 0x00 ; 0
|
|
2070: c1 cf rjmp .-126 ; 0x1ff4 <CommandLineProcessByte+0x28e>
|
|
2072: 28 e0 ldi r18, 0x08 ; 8
|
|
2074: 30 e0 ldi r19, 0x00 ; 0
|
|
2076: be cf rjmp .-132 ; 0x1ff4 <CommandLineProcessByte+0x28e>
|
|
2078: 27 e0 ldi r18, 0x07 ; 7
|
|
207a: 30 e0 ldi r19, 0x00 ; 0
|
|
207c: bb cf rjmp .-138 ; 0x1ff4 <CommandLineProcessByte+0x28e>
|
|
207e: 26 e0 ldi r18, 0x06 ; 6
|
|
2080: 30 e0 ldi r19, 0x00 ; 0
|
|
2082: b8 cf rjmp .-144 ; 0x1ff4 <CommandLineProcessByte+0x28e>
|
|
2084: 25 e0 ldi r18, 0x05 ; 5
|
|
2086: 30 e0 ldi r19, 0x00 ; 0
|
|
2088: b5 cf rjmp .-150 ; 0x1ff4 <CommandLineProcessByte+0x28e>
|
|
208a: 24 e0 ldi r18, 0x04 ; 4
|
|
208c: 30 e0 ldi r19, 0x00 ; 0
|
|
208e: b2 cf rjmp .-156 ; 0x1ff4 <CommandLineProcessByte+0x28e>
|
|
2090: 23 e0 ldi r18, 0x03 ; 3
|
|
2092: 30 e0 ldi r19, 0x00 ; 0
|
|
2094: af cf rjmp .-162 ; 0x1ff4 <CommandLineProcessByte+0x28e>
|
|
2096: 22 e0 ldi r18, 0x02 ; 2
|
|
2098: 30 e0 ldi r19, 0x00 ; 0
|
|
209a: ac cf rjmp .-168 ; 0x1ff4 <CommandLineProcessByte+0x28e>
|
|
209c: 21 e0 ldi r18, 0x01 ; 1
|
|
209e: 30 e0 ldi r19, 0x00 ; 0
|
|
20a0: a9 cf rjmp .-174 ; 0x1ff4 <CommandLineProcessByte+0x28e>
|
|
20a2: 20 e0 ldi r18, 0x00 ; 0
|
|
20a4: 30 e0 ldi r19, 0x00 ; 0
|
|
20a6: a6 cf rjmp .-180 ; 0x1ff4 <CommandLineProcessByte+0x28e>
|
|
|
|
000020a8 <CommandLineTick>:
|
|
|
|
return true;
|
|
}
|
|
|
|
void CommandLineTick(void)
|
|
{
|
|
20a8: 08 95 ret
|
|
|
|
000020aa <StartDemod>:
|
|
INLINE void CodecTask(void) {
|
|
ActiveConfiguration.CodecTaskFunc();
|
|
}
|
|
|
|
INLINE void CodecSetDemodPower(bool bOnOff) {
|
|
CODEC_DEMOD_POWER_PORT.DIRSET = CODEC_DEMOD_POWER_MASK;
|
|
20aa: a0 e2 ldi r26, 0x20 ; 32
|
|
20ac: b6 e0 ldi r27, 0x06 ; 6
|
|
20ae: 82 e0 ldi r24, 0x02 ; 2
|
|
20b0: 11 96 adiw r26, 0x01 ; 1
|
|
20b2: 8c 93 st X, r24
|
|
20b4: 11 97 sbiw r26, 0x01 ; 1
|
|
|
|
if (bOnOff) {
|
|
CODEC_DEMOD_POWER_PORT.OUTSET = CODEC_DEMOD_POWER_MASK;
|
|
20b6: 15 96 adiw r26, 0x05 ; 5
|
|
20b8: 8c 93 st X, r24
|
|
20ba: 15 97 sbiw r26, 0x05 ; 5
|
|
static void StartDemod(void) {
|
|
/* Activate Power for demodulator */
|
|
CodecSetDemodPower(true);
|
|
|
|
/* Configure sampling-timer free running and sync to first modulation-pause. */
|
|
CODEC_TIMER_SAMPLING.CNT = 0;
|
|
20bc: e0 e4 ldi r30, 0x40 ; 64
|
|
20be: f8 e0 ldi r31, 0x08 ; 8
|
|
20c0: 10 a2 std Z+32, r1 ; 0x20
|
|
20c2: 11 a2 std Z+33, r1 ; 0x21
|
|
CODEC_TIMER_SAMPLING.PER = SAMPLE_RATE_SYSTEM_CYCLES - 1;
|
|
20c4: 8d e2 ldi r24, 0x2D ; 45
|
|
20c6: 91 e0 ldi r25, 0x01 ; 1
|
|
20c8: 86 a3 std Z+38, r24 ; 0x26
|
|
20ca: 97 a3 std Z+39, r25 ; 0x27
|
|
CODEC_TIMER_SAMPLING.CCA = 0xFFFF; /* CCA Interrupt is not active! */
|
|
20cc: 8f ef ldi r24, 0xFF ; 255
|
|
20ce: 9f ef ldi r25, 0xFF ; 255
|
|
20d0: 80 a7 std Z+40, r24 ; 0x28
|
|
20d2: 91 a7 std Z+41, r25 ; 0x29
|
|
CODEC_TIMER_SAMPLING.CTRLA = TC_CLKSEL_DIV1_gc;
|
|
20d4: 81 e0 ldi r24, 0x01 ; 1
|
|
20d6: 80 83 st Z, r24
|
|
CODEC_TIMER_SAMPLING.CTRLD = TC_EVACT_RESTART_gc | TC_EVSEL_CH0_gc;
|
|
20d8: 98 e8 ldi r25, 0x88 ; 136
|
|
20da: 93 83 std Z+3, r25 ; 0x03
|
|
CODEC_TIMER_SAMPLING.INTCTRLB = TC_CCAINTLVL_HI_gc;
|
|
20dc: 93 e0 ldi r25, 0x03 ; 3
|
|
20de: 97 83 std Z+7, r25 ; 0x07
|
|
|
|
/* Start looking out for modulation pause via interrupt. */
|
|
CODEC_DEMOD_IN_PORT.INT0MASK = CODEC_DEMOD_IN_MASK0;
|
|
20e0: 1a 96 adiw r26, 0x0a ; 10
|
|
20e2: 8c 93 st X, r24
|
|
20e4: 08 95 ret
|
|
|
|
000020e6 <__vector_34>:
|
|
}
|
|
|
|
ISR(CODEC_DEMOD_IN_INT0_VECT) {
|
|
20e6: 1f 92 push r1
|
|
20e8: 0f 92 push r0
|
|
20ea: 0f b6 in r0, 0x3f ; 63
|
|
20ec: 0f 92 push r0
|
|
20ee: 11 24 eor r1, r1
|
|
20f0: 8f 93 push r24
|
|
20f2: 9f 93 push r25
|
|
20f4: ef 93 push r30
|
|
20f6: ff 93 push r31
|
|
/* This is the first edge of the first modulation-pause after StartDemod.
|
|
* Now we have time to prepare our timers and variables to start
|
|
* demodulating beginning from one bit-width after this edge. */
|
|
CodecBufferPtr = CodecBuffer;
|
|
20f8: 80 e1 ldi r24, 0x10 ; 16
|
|
20fa: 92 e2 ldi r25, 0x22 ; 34
|
|
20fc: 80 93 b1 20 sts 0x20B1, r24
|
|
2100: 90 93 b2 20 sts 0x20B2, r25
|
|
ParityBufferPtr = &CodecBuffer[ISO14443A_BUFFER_PARITY_OFFSET];
|
|
2104: 80 e9 ldi r24, 0x90 ; 144
|
|
2106: 92 e2 ldi r25, 0x22 ; 34
|
|
2108: 80 93 b3 20 sts 0x20B3, r24
|
|
210c: 90 93 b4 20 sts 0x20B4, r25
|
|
DataRegister = 0;
|
|
2110: 10 92 aa 20 sts 0x20AA, r1
|
|
SampleRegister = 0;
|
|
2114: 10 92 a9 20 sts 0x20A9, r1
|
|
SamplePosition = 0;
|
|
2118: 10 92 a5 20 sts 0x20A5, r1
|
|
BitCount = 0;
|
|
211c: 10 92 ad 20 sts 0x20AD, r1
|
|
2120: 10 92 ae 20 sts 0x20AE, r1
|
|
IsParityBit = false;
|
|
2124: 10 92 a8 20 sts 0x20A8, r1
|
|
* XYZBUF mechanism of the xmega to automatically double the sampling rate on the
|
|
* next overflow. For this we have to temporarily deactivate the automatical alignment
|
|
* in order to catch next overflow event for updating the BUF registers.
|
|
* We want to sample the demodulated data stream in the first quarter of the half-bit
|
|
* where the pulsed miller encoded is located. */
|
|
CODEC_TIMER_SAMPLING.CTRLD = TC_EVACT_OFF_gc;
|
|
2128: e0 e4 ldi r30, 0x40 ; 64
|
|
212a: f8 e0 ldi r31, 0x08 ; 8
|
|
212c: 13 82 std Z+3, r1 ; 0x03
|
|
CODEC_TIMER_SAMPLING.PERBUF = SAMPLE_RATE_SYSTEM_CYCLES/2 - 1; /* Half bit width */
|
|
212e: 86 e9 ldi r24, 0x96 ; 150
|
|
2130: 90 e0 ldi r25, 0x00 ; 0
|
|
2132: 86 ab std Z+54, r24 ; 0x36
|
|
2134: 97 ab std Z+55, r25 ; 0x37
|
|
CODEC_TIMER_SAMPLING.CCABUF = SAMPLE_RATE_SYSTEM_CYCLES/8 - 10 - 1; /* Compensate for DIGFILT and ISR prolog */
|
|
2136: 8a e1 ldi r24, 0x1A ; 26
|
|
2138: 90 e0 ldi r25, 0x00 ; 0
|
|
213a: 80 af std Z+56, r24 ; 0x38
|
|
213c: 91 af std Z+57, r25 ; 0x39
|
|
/* Setup Frame Delay Timer and wire to EVSYS. Frame delay time is
|
|
* measured from last change in RF field, therefore we use
|
|
* the event channel 1 (end of modulation pause) as the restart event.
|
|
* The preliminary frame delay time chosen here is irrelevant, because
|
|
* the correct FDT gets set automatically after demodulation. */
|
|
CODEC_TIMER_LOADMOD.CNT = 0;
|
|
213e: e0 e4 ldi r30, 0x40 ; 64
|
|
2140: f9 e0 ldi r31, 0x09 ; 9
|
|
2142: 10 a2 std Z+32, r1 ; 0x20
|
|
2144: 11 a2 std Z+33, r1 ; 0x21
|
|
CODEC_TIMER_LOADMOD.PER = 0xFFFF;
|
|
2146: 8f ef ldi r24, 0xFF ; 255
|
|
2148: 9f ef ldi r25, 0xFF ; 255
|
|
214a: 86 a3 std Z+38, r24 ; 0x26
|
|
214c: 97 a3 std Z+39, r25 ; 0x27
|
|
CODEC_TIMER_LOADMOD.CTRLD = TC_EVACT_RESTART_gc | TC_EVSEL_CH1_gc;
|
|
214e: 89 e8 ldi r24, 0x89 ; 137
|
|
2150: 83 83 std Z+3, r24 ; 0x03
|
|
CODEC_TIMER_LOADMOD.CTRLA = TC_CLKSEL_EVCH6_gc;
|
|
2152: 8e e0 ldi r24, 0x0E ; 14
|
|
2154: 80 83 st Z, r24
|
|
|
|
/* Disable this interrupt */
|
|
CODEC_DEMOD_IN_PORT.INT0MASK = 0;
|
|
2156: e0 e2 ldi r30, 0x20 ; 32
|
|
2158: f6 e0 ldi r31, 0x06 ; 6
|
|
215a: 12 86 std Z+10, r1 ; 0x0a
|
|
}
|
|
215c: ff 91 pop r31
|
|
215e: ef 91 pop r30
|
|
2160: 9f 91 pop r25
|
|
2162: 8f 91 pop r24
|
|
2164: 0f 90 pop r0
|
|
2166: 0f be out 0x3f, r0 ; 63
|
|
2168: 0f 90 pop r0
|
|
216a: 1f 90 pop r1
|
|
216c: 18 95 reti
|
|
|
|
0000216e <__vector_22>:
|
|
|
|
ISR(CODEC_TIMER_SAMPLING_CCA_VECT) {
|
|
216e: 1f 92 push r1
|
|
2170: 0f 92 push r0
|
|
2172: 0f b6 in r0, 0x3f ; 63
|
|
2174: 0f 92 push r0
|
|
2176: 11 24 eor r1, r1
|
|
2178: 2f 93 push r18
|
|
217a: 8f 93 push r24
|
|
217c: 9f 93 push r25
|
|
217e: ef 93 push r30
|
|
2180: ff 93 push r31
|
|
/* This interrupt gets called twice for every bit to sample it. */
|
|
uint8_t SamplePin = CODEC_DEMOD_IN_PORT.IN & CODEC_DEMOD_IN_MASK;
|
|
2182: 90 91 28 06 lds r25, 0x0628
|
|
uint8_t NewSampleRegister;
|
|
|
|
/* Shift sampled bit into sampling register and hold a local copy for fast access. */
|
|
NewSampleRegister = SampleRegister << 1;
|
|
2186: 80 91 a9 20 lds r24, 0x20A9
|
|
CODEC_DEMOD_IN_PORT.INT0MASK = 0;
|
|
}
|
|
|
|
ISR(CODEC_TIMER_SAMPLING_CCA_VECT) {
|
|
/* This interrupt gets called twice for every bit to sample it. */
|
|
uint8_t SamplePin = CODEC_DEMOD_IN_PORT.IN & CODEC_DEMOD_IN_MASK;
|
|
218a: 95 70 andi r25, 0x05 ; 5
|
|
uint8_t NewSampleRegister;
|
|
|
|
/* Shift sampled bit into sampling register and hold a local copy for fast access. */
|
|
NewSampleRegister = SampleRegister << 1;
|
|
NewSampleRegister |= (!SamplePin ? 0x01 : 0x00);
|
|
218c: 21 e0 ldi r18, 0x01 ; 1
|
|
218e: 09 f0 breq .+2 ; 0x2192 <__vector_22+0x24>
|
|
2190: 20 e0 ldi r18, 0x00 ; 0
|
|
/* This interrupt gets called twice for every bit to sample it. */
|
|
uint8_t SamplePin = CODEC_DEMOD_IN_PORT.IN & CODEC_DEMOD_IN_MASK;
|
|
uint8_t NewSampleRegister;
|
|
|
|
/* Shift sampled bit into sampling register and hold a local copy for fast access. */
|
|
NewSampleRegister = SampleRegister << 1;
|
|
2192: 88 0f add r24, r24
|
|
NewSampleRegister |= (!SamplePin ? 0x01 : 0x00);
|
|
2194: 82 2b or r24, r18
|
|
SampleRegister = NewSampleRegister;
|
|
2196: 80 93 a9 20 sts 0x20A9, r24
|
|
|
|
if (SamplePosition) {
|
|
219a: 90 91 a5 20 lds r25, 0x20A5
|
|
219e: 99 23 and r25, r25
|
|
21a0: a1 f1 breq .+104 ; 0x220a <__vector_22+0x9c>
|
|
/* Analyze the sampling register after 2 samples. */
|
|
if ((NewSampleRegister & 0x07) == 0x07) {
|
|
21a2: 98 2f mov r25, r24
|
|
21a4: 97 70 andi r25, 0x07 ; 7
|
|
21a6: 97 30 cpi r25, 0x07 ; 7
|
|
21a8: 09 f4 brne .+2 ; 0x21ac <__vector_22+0x3e>
|
|
21aa: 42 c0 rjmp .+132 ; 0x2230 <__vector_22+0xc2>
|
|
|
|
/* Signal, that we have finished sampling */
|
|
Flags.DemodFinished = 1;
|
|
} else {
|
|
/* Otherwise, we check the two sample bits from the bit before. */
|
|
uint8_t BitSample = NewSampleRegister & 0xC;
|
|
21ac: 98 2f mov r25, r24
|
|
21ae: 9c 70 andi r25, 0x0C ; 12
|
|
uint8_t Bit = 0;
|
|
|
|
if (BitSample != (0x0 << 2)) {
|
|
21b0: 61 f1 breq .+88 ; 0x220a <__vector_22+0x9c>
|
|
/* We have a valid bit. decode and process it. */
|
|
if (BitSample & (0x1 << 2)) {
|
|
21b2: 91 e0 ldi r25, 0x01 ; 1
|
|
21b4: 82 fd sbrc r24, 2
|
|
21b6: 6b c0 rjmp .+214 ; 0x228e <__vector_22+0x120>
|
|
} else {
|
|
/* 10 sequence -> This is a one bit */
|
|
Bit = 1;
|
|
}
|
|
|
|
LastBit = Bit;
|
|
21b8: 90 93 a7 20 sts 0x20A7, r25
|
|
|
|
if (!IsParityBit) {
|
|
21bc: 80 91 a8 20 lds r24, 0x20A8
|
|
21c0: 81 11 cpse r24, r1
|
|
21c2: 6d c0 rjmp .+218 ; 0x229e <__vector_22+0x130>
|
|
/* This is a data bit, so shift it into the data register and
|
|
* hold a local copy of it. */
|
|
uint8_t NewDataRegister = DataRegister >> 1;
|
|
21c4: 80 91 aa 20 lds r24, 0x20AA
|
|
21c8: 86 95 lsr r24
|
|
NewDataRegister |= (Bit ? 0x80 : 0x00);
|
|
21ca: 99 23 and r25, r25
|
|
21cc: 09 f4 brne .+2 ; 0x21d0 <__vector_22+0x62>
|
|
21ce: 71 c0 rjmp .+226 ; 0x22b2 <__vector_22+0x144>
|
|
21d0: 20 e8 ldi r18, 0x80 ; 128
|
|
21d2: 28 2b or r18, r24
|
|
DataRegister = NewDataRegister;
|
|
21d4: 20 93 aa 20 sts 0x20AA, r18
|
|
|
|
/* Update bitcount */
|
|
uint16_t NewBitCount = ++BitCount;
|
|
21d8: 80 91 ad 20 lds r24, 0x20AD
|
|
21dc: 90 91 ae 20 lds r25, 0x20AE
|
|
21e0: 01 96 adiw r24, 0x01 ; 1
|
|
21e2: 80 93 ad 20 sts 0x20AD, r24
|
|
21e6: 90 93 ae 20 sts 0x20AE, r25
|
|
if ((NewBitCount & 0x07) == 0) {
|
|
21ea: 87 70 andi r24, 0x07 ; 7
|
|
21ec: 99 27 eor r25, r25
|
|
21ee: 89 2b or r24, r25
|
|
21f0: 61 f4 brne .+24 ; 0x220a <__vector_22+0x9c>
|
|
/* We have reached a byte boundary! Store the data register. */
|
|
/* TODO: Prevent buffer overflow */
|
|
*CodecBufferPtr++ = NewDataRegister;
|
|
21f2: e0 91 b1 20 lds r30, 0x20B1
|
|
21f6: f0 91 b2 20 lds r31, 0x20B2
|
|
21fa: 21 93 st Z+, r18
|
|
21fc: e0 93 b1 20 sts 0x20B1, r30
|
|
2200: f0 93 b2 20 sts 0x20B2, r31
|
|
|
|
/* Store bit for determining FDT at EOC and enable parity
|
|
* handling on next bit. */
|
|
IsParityBit = true;
|
|
2204: 81 e0 ldi r24, 0x01 ; 1
|
|
2206: 80 93 a8 20 sts 0x20A8, r24
|
|
}
|
|
} else {
|
|
/* On odd sample position just sample. */
|
|
}
|
|
|
|
SamplePosition = !SamplePosition;
|
|
220a: 80 91 a5 20 lds r24, 0x20A5
|
|
220e: 91 e0 ldi r25, 0x01 ; 1
|
|
2210: 89 27 eor r24, r25
|
|
2212: 80 93 a5 20 sts 0x20A5, r24
|
|
|
|
/* Make sure the sampling timer gets automatically aligned to the
|
|
* modulation pauses by using the RESTART event.
|
|
* This can be understood as a "poor mans PLL" and makes sure that we are
|
|
* never too far out the bit-grid while sampling. */
|
|
CODEC_TIMER_SAMPLING.CTRLD = TC_EVACT_RESTART_gc | TC_EVSEL_CH0_gc;
|
|
2216: 88 e8 ldi r24, 0x88 ; 136
|
|
2218: 80 93 43 08 sts 0x0843, r24
|
|
}
|
|
221c: ff 91 pop r31
|
|
221e: ef 91 pop r30
|
|
2220: 9f 91 pop r25
|
|
2222: 8f 91 pop r24
|
|
2224: 2f 91 pop r18
|
|
2226: 0f 90 pop r0
|
|
2228: 0f be out 0x3f, r0 ; 63
|
|
222a: 0f 90 pop r0
|
|
222c: 1f 90 pop r1
|
|
222e: 18 95 reti
|
|
|
|
if (SamplePosition) {
|
|
/* Analyze the sampling register after 2 samples. */
|
|
if ((NewSampleRegister & 0x07) == 0x07) {
|
|
/* No carrier modulation for 3 sample points. EOC! */
|
|
CODEC_TIMER_SAMPLING.CTRLA = TC_CLKSEL_OFF_gc;
|
|
2230: 10 92 40 08 sts 0x0840, r1
|
|
CODEC_TIMER_SAMPLING.INTFLAGS = TC0_CCAIF_bm;
|
|
2234: 80 e1 ldi r24, 0x10 ; 16
|
|
2236: 80 93 4c 08 sts 0x084C, r24
|
|
|
|
/* By this time, the FDT timer is aligned to the last modulation
|
|
* edge of the reader. So we disable the auto-synchronization and
|
|
* let it count the frame delay time in the background, and generate
|
|
* an interrupt once it has reached the FDT. */
|
|
CODEC_TIMER_LOADMOD.CTRLD = TC_EVACT_OFF_gc;
|
|
223a: 10 92 43 09 sts 0x0943, r1
|
|
|
|
if (LastBit) {
|
|
223e: 80 91 a7 20 lds r24, 0x20A7
|
|
2242: 88 23 and r24, r24
|
|
2244: 79 f1 breq .+94 ; 0x22a4 <__vector_22+0x136>
|
|
CODEC_TIMER_LOADMOD.PER = ISO14443A_FRAME_DELAY_PREV1;
|
|
2246: 8c eb ldi r24, 0xBC ; 188
|
|
2248: 94 e0 ldi r25, 0x04 ; 4
|
|
224a: 80 93 66 09 sts 0x0966, r24
|
|
224e: 90 93 67 09 sts 0x0967, r25
|
|
} else {
|
|
CODEC_TIMER_LOADMOD.PER = ISO14443A_FRAME_DELAY_PREV0;
|
|
}
|
|
|
|
LoadModState = LOADMOD_FDT;
|
|
2252: 10 92 a6 20 sts 0x20A6, r1
|
|
|
|
CODEC_TIMER_LOADMOD.INTFLAGS = TC1_OVFIF_bm;
|
|
2256: 81 e0 ldi r24, 0x01 ; 1
|
|
2258: 80 93 4c 09 sts 0x094C, r24
|
|
CODEC_TIMER_LOADMOD.INTCTRLA = TC_OVFINTLVL_HI_gc;
|
|
225c: 83 e0 ldi r24, 0x03 ; 3
|
|
225e: 80 93 46 09 sts 0x0946, r24
|
|
|
|
/* Determine if we did not receive a multiple of 8 bits.
|
|
* If this is the case, right-align the remaining data and
|
|
* store it into the buffer. */
|
|
uint8_t RemainingBits = BitCount % 8;
|
|
2262: 80 91 ad 20 lds r24, 0x20AD
|
|
2266: 90 91 ae 20 lds r25, 0x20AE
|
|
226a: 87 70 andi r24, 0x07 ; 7
|
|
if (RemainingBits != 0) {
|
|
226c: 61 f0 breq .+24 ; 0x2286 <__vector_22+0x118>
|
|
uint8_t NewDataRegister = DataRegister;
|
|
226e: 90 91 aa 20 lds r25, 0x20AA
|
|
|
|
while (RemainingBits++ < 8) {
|
|
2272: 8f 5f subi r24, 0xFF ; 255
|
|
/* Pad with zeroes to right-align. */
|
|
NewDataRegister >>= 1;
|
|
2274: 96 95 lsr r25
|
|
* store it into the buffer. */
|
|
uint8_t RemainingBits = BitCount % 8;
|
|
if (RemainingBits != 0) {
|
|
uint8_t NewDataRegister = DataRegister;
|
|
|
|
while (RemainingBits++ < 8) {
|
|
2276: 8f 5f subi r24, 0xFF ; 255
|
|
2278: 89 30 cpi r24, 0x09 ; 9
|
|
227a: e1 f7 brne .-8 ; 0x2274 <__vector_22+0x106>
|
|
/* Pad with zeroes to right-align. */
|
|
NewDataRegister >>= 1;
|
|
}
|
|
|
|
/* TODO: Prevent buffer overflow */
|
|
*CodecBufferPtr = NewDataRegister;
|
|
227c: e0 91 b1 20 lds r30, 0x20B1
|
|
2280: f0 91 b2 20 lds r31, 0x20B2
|
|
2284: 90 83 st Z, r25
|
|
}
|
|
|
|
/* Signal, that we have finished sampling */
|
|
Flags.DemodFinished = 1;
|
|
2286: 81 e0 ldi r24, 0x01 ; 1
|
|
2288: 80 93 af 20 sts 0x20AF, r24
|
|
228c: be cf rjmp .-132 ; 0x220a <__vector_22+0x9c>
|
|
uint8_t BitSample = NewSampleRegister & 0xC;
|
|
uint8_t Bit = 0;
|
|
|
|
if (BitSample != (0x0 << 2)) {
|
|
/* We have a valid bit. decode and process it. */
|
|
if (BitSample & (0x1 << 2)) {
|
|
228e: 90 e0 ldi r25, 0x00 ; 0
|
|
} else {
|
|
/* 10 sequence -> This is a one bit */
|
|
Bit = 1;
|
|
}
|
|
|
|
LastBit = Bit;
|
|
2290: 90 93 a7 20 sts 0x20A7, r25
|
|
|
|
if (!IsParityBit) {
|
|
2294: 80 91 a8 20 lds r24, 0x20A8
|
|
2298: 88 23 and r24, r24
|
|
229a: 09 f4 brne .+2 ; 0x229e <__vector_22+0x130>
|
|
229c: 93 cf rjmp .-218 ; 0x21c4 <__vector_22+0x56>
|
|
|
|
} else {
|
|
/* This is a parity bit. Store it */
|
|
/* TODO: Store parity and prevent overflow */
|
|
//*ParityBufferPtr++ = Bit;
|
|
IsParityBit = false;
|
|
229e: 10 92 a8 20 sts 0x20A8, r1
|
|
22a2: b3 cf rjmp .-154 ; 0x220a <__vector_22+0x9c>
|
|
CODEC_TIMER_LOADMOD.CTRLD = TC_EVACT_OFF_gc;
|
|
|
|
if (LastBit) {
|
|
CODEC_TIMER_LOADMOD.PER = ISO14443A_FRAME_DELAY_PREV1;
|
|
} else {
|
|
CODEC_TIMER_LOADMOD.PER = ISO14443A_FRAME_DELAY_PREV0;
|
|
22a4: 8c e7 ldi r24, 0x7C ; 124
|
|
22a6: 94 e0 ldi r25, 0x04 ; 4
|
|
22a8: 80 93 66 09 sts 0x0966, r24
|
|
22ac: 90 93 67 09 sts 0x0967, r25
|
|
22b0: d0 cf rjmp .-96 ; 0x2252 <__vector_22+0xe4>
|
|
|
|
if (!IsParityBit) {
|
|
/* This is a data bit, so shift it into the data register and
|
|
* hold a local copy of it. */
|
|
uint8_t NewDataRegister = DataRegister >> 1;
|
|
NewDataRegister |= (Bit ? 0x80 : 0x00);
|
|
22b2: 20 e0 ldi r18, 0x00 ; 0
|
|
22b4: 8e cf rjmp .-228 ; 0x21d2 <__vector_22+0x64>
|
|
|
|
000022b6 <__vector_83>:
|
|
* This can be understood as a "poor mans PLL" and makes sure that we are
|
|
* never too far out the bit-grid while sampling. */
|
|
CODEC_TIMER_SAMPLING.CTRLD = TC_EVACT_RESTART_gc | TC_EVSEL_CH0_gc;
|
|
}
|
|
|
|
ISR(CODEC_TIMER_OVF_VECT) {
|
|
22b6: 1f 92 push r1
|
|
22b8: 0f 92 push r0
|
|
22ba: 0f b6 in r0, 0x3f ; 63
|
|
22bc: 0f 92 push r0
|
|
22be: 11 24 eor r1, r1
|
|
22c0: 2f 93 push r18
|
|
22c2: 3f 93 push r19
|
|
22c4: 8f 93 push r24
|
|
22c6: 9f 93 push r25
|
|
22c8: ef 93 push r30
|
|
22ca: ff 93 push r31
|
|
/* Bit rate timer. Output a half bit on the output. */
|
|
uint8_t Temp8;
|
|
uint16_t Temp16;
|
|
|
|
switch (LoadModState) {
|
|
22cc: 80 91 a6 20 lds r24, 0x20A6
|
|
22d0: 85 30 cpi r24, 0x05 ; 5
|
|
22d2: 09 f4 brne .+2 ; 0x22d6 <__vector_83+0x20>
|
|
22d4: 4d c0 rjmp .+154 ; 0x2370 <__vector_83+0xba>
|
|
22d6: a8 f0 brcs .+42 ; 0x2302 <__vector_83+0x4c>
|
|
22d8: 88 30 cpi r24, 0x08 ; 8
|
|
22da: 09 f4 brne .+2 ; 0x22de <__vector_83+0x28>
|
|
22dc: 7c c0 rjmp .+248 ; 0x23d6 <__vector_83+0x120>
|
|
22de: 20 f5 brcc .+72 ; 0x2328 <__vector_83+0x72>
|
|
22e0: 86 30 cpi r24, 0x06 ; 6
|
|
22e2: 09 f4 brne .+2 ; 0x22e6 <__vector_83+0x30>
|
|
22e4: b8 c0 rjmp .+368 ; 0x2456 <__vector_83+0x1a0>
|
|
22e6: 87 30 cpi r24, 0x07 ; 7
|
|
22e8: 09 f4 brne .+2 ; 0x22ec <__vector_83+0x36>
|
|
22ea: 8a c0 rjmp .+276 ; 0x2400 <__vector_83+0x14a>
|
|
break;
|
|
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
22ec: ff 91 pop r31
|
|
22ee: ef 91 pop r30
|
|
22f0: 9f 91 pop r25
|
|
22f2: 8f 91 pop r24
|
|
22f4: 3f 91 pop r19
|
|
22f6: 2f 91 pop r18
|
|
22f8: 0f 90 pop r0
|
|
22fa: 0f be out 0x3f, r0 ; 63
|
|
22fc: 0f 90 pop r0
|
|
22fe: 1f 90 pop r1
|
|
2300: 18 95 reti
|
|
ISR(CODEC_TIMER_OVF_VECT) {
|
|
/* Bit rate timer. Output a half bit on the output. */
|
|
uint8_t Temp8;
|
|
uint16_t Temp16;
|
|
|
|
switch (LoadModState) {
|
|
2302: 82 30 cpi r24, 0x02 ; 2
|
|
2304: 71 f1 breq .+92 ; 0x2362 <__vector_83+0xac>
|
|
2306: f8 f0 brcs .+62 ; 0x2346 <__vector_83+0x90>
|
|
2308: 83 30 cpi r24, 0x03 ; 3
|
|
230a: 09 f4 brne .+2 ; 0x230e <__vector_83+0x58>
|
|
230c: 56 c0 rjmp .+172 ; 0x23ba <__vector_83+0x104>
|
|
230e: 84 30 cpi r24, 0x04 ; 4
|
|
2310: 69 f7 brne .-38 ; 0x22ec <__vector_83+0x36>
|
|
/* Fetch first byte */
|
|
DataRegister = *CodecBufferPtr;
|
|
break;
|
|
|
|
case LOADMOD_DATA0:
|
|
if (DataRegister & 1) {
|
|
2312: 80 91 aa 20 lds r24, 0x20AA
|
|
2316: 80 fd sbrc r24, 0
|
|
2318: b7 c0 rjmp .+366 ; 0x2488 <__vector_83+0x1d2>
|
|
CODEC_LOADMOD_PORT.OUTSET = CODEC_LOADMOD_MASK;
|
|
} else {
|
|
CODEC_LOADMOD_PORT.OUTCLR = CODEC_LOADMOD_MASK;
|
|
231a: 80 e4 ldi r24, 0x40 ; 64
|
|
231c: 80 93 46 06 sts 0x0646, r24
|
|
}
|
|
|
|
LoadModState = LOADMOD_DATA1;
|
|
2320: 85 e0 ldi r24, 0x05 ; 5
|
|
2322: 80 93 a6 20 sts 0x20A6, r24
|
|
break;
|
|
2326: e2 cf rjmp .-60 ; 0x22ec <__vector_83+0x36>
|
|
ISR(CODEC_TIMER_OVF_VECT) {
|
|
/* Bit rate timer. Output a half bit on the output. */
|
|
uint8_t Temp8;
|
|
uint16_t Temp16;
|
|
|
|
switch (LoadModState) {
|
|
2328: 89 30 cpi r24, 0x09 ; 9
|
|
232a: 09 f4 brne .+2 ; 0x232e <__vector_83+0x78>
|
|
232c: 5b c0 rjmp .+182 ; 0x23e4 <__vector_83+0x12e>
|
|
232e: 8a 30 cpi r24, 0x0A ; 10
|
|
2330: e9 f6 brne .-70 ; 0x22ec <__vector_83+0x36>
|
|
|
|
case LOADMOD_FINISHED:
|
|
/* We have written all of our bits. Deactivate the loadmod
|
|
* timer. Also disable the bit-rate interrupt again. And
|
|
* stop the subcarrier divider. */
|
|
CODEC_TIMER_LOADMOD.CTRLA = TC_CLKSEL_OFF_gc;
|
|
2332: 10 92 40 09 sts 0x0940, r1
|
|
CODEC_TIMER_LOADMOD.INTCTRLA = 0;
|
|
2336: 10 92 46 09 sts 0x0946, r1
|
|
CODEC_SUBCARRIER_TIMER.CTRLA = TC_CLKSEL_OFF_gc;
|
|
233a: 10 92 00 08 sts 0x0800, r1
|
|
|
|
/* Signal application that we have finished loadmod */
|
|
Flags.LoadmodFinished = 1;
|
|
233e: 81 e0 ldi r24, 0x01 ; 1
|
|
2340: 80 93 b0 20 sts 0x20B0, r24
|
|
break;
|
|
2344: d3 cf rjmp .-90 ; 0x22ec <__vector_83+0x36>
|
|
ISR(CODEC_TIMER_OVF_VECT) {
|
|
/* Bit rate timer. Output a half bit on the output. */
|
|
uint8_t Temp8;
|
|
uint16_t Temp16;
|
|
|
|
switch (LoadModState) {
|
|
2346: 88 23 and r24, r24
|
|
2348: 09 f4 brne .+2 ; 0x234c <__vector_83+0x96>
|
|
234a: 53 c0 rjmp .+166 ; 0x23f2 <__vector_83+0x13c>
|
|
234c: 81 30 cpi r24, 0x01 ; 1
|
|
234e: 71 f6 brne .-100 ; 0x22ec <__vector_83+0x36>
|
|
break;
|
|
|
|
case LOADMOD_START:
|
|
/* Application produced data. With this interrupt we are aligned to the bit-grid.
|
|
* Start subcarrier generation and align to bitrate. */
|
|
CODEC_TIMER_LOADMOD.PER = ISO14443A_BIT_RATE_CYCLES / 2 - 1;
|
|
2350: 8f e3 ldi r24, 0x3F ; 63
|
|
2352: 90 e0 ldi r25, 0x00 ; 0
|
|
2354: 80 93 66 09 sts 0x0966, r24
|
|
2358: 90 93 67 09 sts 0x0967, r25
|
|
CODEC_SUBCARRIER_TIMER.CTRLA = TC_CLKSEL_EVCH6_gc;
|
|
235c: 8e e0 ldi r24, 0x0E ; 14
|
|
235e: 80 93 00 08 sts 0x0800, r24
|
|
|
|
/* Fallthrough to first bit */
|
|
|
|
case LOADMOD_START_BIT0:
|
|
CODEC_LOADMOD_PORT.OUTSET = CODEC_LOADMOD_MASK;
|
|
2362: 80 e4 ldi r24, 0x40 ; 64
|
|
2364: 80 93 45 06 sts 0x0645, r24
|
|
LoadModState = LOADMOD_START_BIT1;
|
|
2368: 83 e0 ldi r24, 0x03 ; 3
|
|
236a: 80 93 a6 20 sts 0x20A6, r24
|
|
break;
|
|
236e: be cf rjmp .-132 ; 0x22ec <__vector_83+0x36>
|
|
|
|
LoadModState = LOADMOD_DATA1;
|
|
break;
|
|
|
|
case LOADMOD_DATA1:
|
|
Temp8 = DataRegister;
|
|
2370: 80 91 aa 20 lds r24, 0x20AA
|
|
|
|
if (Temp8 & 1) {
|
|
CODEC_LOADMOD_PORT.OUTCLR = CODEC_LOADMOD_MASK;
|
|
2374: 90 e4 ldi r25, 0x40 ; 64
|
|
break;
|
|
|
|
case LOADMOD_DATA1:
|
|
Temp8 = DataRegister;
|
|
|
|
if (Temp8 & 1) {
|
|
2376: 80 fd sbrc r24, 0
|
|
2378: 84 c0 rjmp .+264 ; 0x2482 <__vector_83+0x1cc>
|
|
CODEC_LOADMOD_PORT.OUTCLR = CODEC_LOADMOD_MASK;
|
|
} else {
|
|
CODEC_LOADMOD_PORT.OUTSET = CODEC_LOADMOD_MASK;
|
|
237a: 90 93 45 06 sts 0x0645, r25
|
|
}
|
|
|
|
DataRegister = Temp8 >> 1;
|
|
237e: 86 95 lsr r24
|
|
2380: 80 93 aa 20 sts 0x20AA, r24
|
|
|
|
Temp16 = BitSent;
|
|
2384: 80 91 ab 20 lds r24, 0x20AB
|
|
2388: 90 91 ac 20 lds r25, 0x20AC
|
|
BitSent = ++Temp16;
|
|
238c: 01 96 adiw r24, 0x01 ; 1
|
|
238e: 80 93 ab 20 sts 0x20AB, r24
|
|
2392: 90 93 ac 20 sts 0x20AC, r25
|
|
|
|
if ((Temp16 & 0x07) == 0) {
|
|
2396: 9c 01 movw r18, r24
|
|
2398: 27 70 andi r18, 0x07 ; 7
|
|
239a: 33 27 eor r19, r19
|
|
239c: 23 2b or r18, r19
|
|
239e: 09 f4 brne .+2 ; 0x23a2 <__vector_83+0xec>
|
|
23a0: 77 c0 rjmp .+238 ; 0x2490 <__vector_83+0x1da>
|
|
/* Byte boundary. Load parity bit and output it later. */
|
|
LoadModState = LOADMOD_PARITY0;
|
|
break;
|
|
}
|
|
|
|
if (Temp16 == BitCount) {
|
|
23a2: 20 91 ad 20 lds r18, 0x20AD
|
|
23a6: 30 91 ae 20 lds r19, 0x20AE
|
|
23aa: 82 17 cp r24, r18
|
|
23ac: 93 07 cpc r25, r19
|
|
23ae: 09 f0 breq .+2 ; 0x23b2 <__vector_83+0xfc>
|
|
23b0: 4e c0 rjmp .+156 ; 0x244e <__vector_83+0x198>
|
|
CODEC_LOADMOD_PORT.OUTSET = CODEC_LOADMOD_MASK;
|
|
}
|
|
|
|
if (BitSent == BitCount) {
|
|
/* No data left */
|
|
LoadModState = LOADMOD_STOP_BIT0;
|
|
23b2: 88 e0 ldi r24, 0x08 ; 8
|
|
23b4: 80 93 a6 20 sts 0x20A6, r24
|
|
23b8: 99 cf rjmp .-206 ; 0x22ec <__vector_83+0x36>
|
|
CODEC_LOADMOD_PORT.OUTSET = CODEC_LOADMOD_MASK;
|
|
LoadModState = LOADMOD_START_BIT1;
|
|
break;
|
|
|
|
case LOADMOD_START_BIT1:
|
|
CODEC_LOADMOD_PORT.OUTCLR = CODEC_LOADMOD_MASK;
|
|
23ba: 80 e4 ldi r24, 0x40 ; 64
|
|
23bc: 80 93 46 06 sts 0x0646, r24
|
|
LoadModState = LOADMOD_DATA0;
|
|
23c0: 84 e0 ldi r24, 0x04 ; 4
|
|
23c2: 80 93 a6 20 sts 0x20A6, r24
|
|
|
|
/* Fetch first byte */
|
|
DataRegister = *CodecBufferPtr;
|
|
23c6: e0 91 b1 20 lds r30, 0x20B1
|
|
23ca: f0 91 b2 20 lds r31, 0x20B2
|
|
23ce: 80 81 ld r24, Z
|
|
23d0: 80 93 aa 20 sts 0x20AA, r24
|
|
break;
|
|
23d4: 8b cf rjmp .-234 ; 0x22ec <__vector_83+0x36>
|
|
}
|
|
|
|
break;
|
|
|
|
case LOADMOD_STOP_BIT0:
|
|
CODEC_LOADMOD_PORT.OUTCLR = CODEC_LOADMOD_MASK;
|
|
23d6: 80 e4 ldi r24, 0x40 ; 64
|
|
23d8: 80 93 46 06 sts 0x0646, r24
|
|
LoadModState = LOADMOD_STOP_BIT1;
|
|
23dc: 89 e0 ldi r24, 0x09 ; 9
|
|
23de: 80 93 a6 20 sts 0x20A6, r24
|
|
break;
|
|
23e2: 84 cf rjmp .-248 ; 0x22ec <__vector_83+0x36>
|
|
|
|
case LOADMOD_STOP_BIT1:
|
|
CODEC_LOADMOD_PORT.OUTCLR = CODEC_LOADMOD_MASK;
|
|
23e4: 80 e4 ldi r24, 0x40 ; 64
|
|
23e6: 80 93 46 06 sts 0x0646, r24
|
|
LoadModState = LOADMOD_FINISHED;
|
|
23ea: 8a e0 ldi r24, 0x0A ; 10
|
|
23ec: 80 93 a6 20 sts 0x20A6, r24
|
|
break;
|
|
23f0: 7d cf rjmp .-262 ; 0x22ec <__vector_83+0x36>
|
|
uint16_t Temp16;
|
|
|
|
switch (LoadModState) {
|
|
case LOADMOD_FDT:
|
|
/* No data has been produced, but FDT has ended. Switch over to bit-grid aligning. */
|
|
CODEC_TIMER_LOADMOD.PER = ISO14443A_BIT_GRID_CYCLES - 1;
|
|
23f2: 8f e7 ldi r24, 0x7F ; 127
|
|
23f4: 90 e0 ldi r25, 0x00 ; 0
|
|
23f6: 80 93 66 09 sts 0x0966, r24
|
|
23fa: 90 93 67 09 sts 0x0967, r25
|
|
break;
|
|
23fe: 76 cf rjmp .-276 ; 0x22ec <__vector_83+0x36>
|
|
|
|
LoadModState = LOADMOD_PARITY1;
|
|
break;
|
|
|
|
case LOADMOD_PARITY1:
|
|
if (*ParityBufferPtr) {
|
|
2400: e0 91 b3 20 lds r30, 0x20B3
|
|
2404: f0 91 b4 20 lds r31, 0x20B4
|
|
2408: 80 81 ld r24, Z
|
|
240a: 81 11 cpse r24, r1
|
|
240c: 36 c0 rjmp .+108 ; 0x247a <__vector_83+0x1c4>
|
|
CODEC_LOADMOD_PORT.OUTCLR = CODEC_LOADMOD_MASK;
|
|
} else {
|
|
CODEC_LOADMOD_PORT.OUTSET = CODEC_LOADMOD_MASK;
|
|
240e: 80 e4 ldi r24, 0x40 ; 64
|
|
2410: 80 93 45 06 sts 0x0645, r24
|
|
}
|
|
|
|
if (BitSent == BitCount) {
|
|
2414: 20 91 ab 20 lds r18, 0x20AB
|
|
2418: 30 91 ac 20 lds r19, 0x20AC
|
|
241c: 80 91 ad 20 lds r24, 0x20AD
|
|
2420: 90 91 ae 20 lds r25, 0x20AE
|
|
2424: 28 17 cp r18, r24
|
|
2426: 39 07 cpc r19, r25
|
|
2428: 21 f2 breq .-120 ; 0x23b2 <__vector_83+0xfc>
|
|
/* No data left */
|
|
LoadModState = LOADMOD_STOP_BIT0;
|
|
} else {
|
|
/* Fetch next data and continue sending bits. */
|
|
ParityBufferPtr++;
|
|
242a: 31 96 adiw r30, 0x01 ; 1
|
|
242c: e0 93 b3 20 sts 0x20B3, r30
|
|
2430: f0 93 b4 20 sts 0x20B4, r31
|
|
DataRegister = *++CodecBufferPtr;
|
|
2434: e0 91 b1 20 lds r30, 0x20B1
|
|
2438: f0 91 b2 20 lds r31, 0x20B2
|
|
243c: cf 01 movw r24, r30
|
|
243e: 01 96 adiw r24, 0x01 ; 1
|
|
2440: 80 93 b1 20 sts 0x20B1, r24
|
|
2444: 90 93 b2 20 sts 0x20B2, r25
|
|
2448: 81 81 ldd r24, Z+1 ; 0x01
|
|
244a: 80 93 aa 20 sts 0x20AA, r24
|
|
LoadModState = LOADMOD_DATA0;
|
|
244e: 84 e0 ldi r24, 0x04 ; 4
|
|
2450: 80 93 a6 20 sts 0x20A6, r24
|
|
2454: 4b cf rjmp .-362 ; 0x22ec <__vector_83+0x36>
|
|
LoadModState = LOADMOD_DATA0;
|
|
|
|
break;
|
|
|
|
case LOADMOD_PARITY0:
|
|
if (*ParityBufferPtr) {
|
|
2456: e0 91 b3 20 lds r30, 0x20B3
|
|
245a: f0 91 b4 20 lds r31, 0x20B4
|
|
245e: 80 81 ld r24, Z
|
|
2460: 81 11 cpse r24, r1
|
|
2462: 07 c0 rjmp .+14 ; 0x2472 <__vector_83+0x1bc>
|
|
CODEC_LOADMOD_PORT.OUTSET = CODEC_LOADMOD_MASK;
|
|
} else {
|
|
CODEC_LOADMOD_PORT.OUTCLR = CODEC_LOADMOD_MASK;
|
|
2464: 80 e4 ldi r24, 0x40 ; 64
|
|
2466: 80 93 46 06 sts 0x0646, r24
|
|
}
|
|
|
|
LoadModState = LOADMOD_PARITY1;
|
|
246a: 87 e0 ldi r24, 0x07 ; 7
|
|
246c: 80 93 a6 20 sts 0x20A6, r24
|
|
break;
|
|
2470: 3d cf rjmp .-390 ; 0x22ec <__vector_83+0x36>
|
|
|
|
break;
|
|
|
|
case LOADMOD_PARITY0:
|
|
if (*ParityBufferPtr) {
|
|
CODEC_LOADMOD_PORT.OUTSET = CODEC_LOADMOD_MASK;
|
|
2472: 80 e4 ldi r24, 0x40 ; 64
|
|
2474: 80 93 45 06 sts 0x0645, r24
|
|
2478: f8 cf rjmp .-16 ; 0x246a <__vector_83+0x1b4>
|
|
LoadModState = LOADMOD_PARITY1;
|
|
break;
|
|
|
|
case LOADMOD_PARITY1:
|
|
if (*ParityBufferPtr) {
|
|
CODEC_LOADMOD_PORT.OUTCLR = CODEC_LOADMOD_MASK;
|
|
247a: 80 e4 ldi r24, 0x40 ; 64
|
|
247c: 80 93 46 06 sts 0x0646, r24
|
|
2480: c9 cf rjmp .-110 ; 0x2414 <__vector_83+0x15e>
|
|
|
|
case LOADMOD_DATA1:
|
|
Temp8 = DataRegister;
|
|
|
|
if (Temp8 & 1) {
|
|
CODEC_LOADMOD_PORT.OUTCLR = CODEC_LOADMOD_MASK;
|
|
2482: 90 93 46 06 sts 0x0646, r25
|
|
2486: 7b cf rjmp .-266 ; 0x237e <__vector_83+0xc8>
|
|
DataRegister = *CodecBufferPtr;
|
|
break;
|
|
|
|
case LOADMOD_DATA0:
|
|
if (DataRegister & 1) {
|
|
CODEC_LOADMOD_PORT.OUTSET = CODEC_LOADMOD_MASK;
|
|
2488: 80 e4 ldi r24, 0x40 ; 64
|
|
248a: 80 93 45 06 sts 0x0645, r24
|
|
248e: 48 cf rjmp .-368 ; 0x2320 <__vector_83+0x6a>
|
|
Temp16 = BitSent;
|
|
BitSent = ++Temp16;
|
|
|
|
if ((Temp16 & 0x07) == 0) {
|
|
/* Byte boundary. Load parity bit and output it later. */
|
|
LoadModState = LOADMOD_PARITY0;
|
|
2490: 86 e0 ldi r24, 0x06 ; 6
|
|
2492: 80 93 a6 20 sts 0x20A6, r24
|
|
break;
|
|
2496: 2a cf rjmp .-428 ; 0x22ec <__vector_83+0x36>
|
|
|
|
00002498 <ISO14443ACodecInit>:
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
|
|
void ISO14443ACodecInit(void) {
|
|
2498: cf 93 push r28
|
|
249a: df 93 push r29
|
|
static volatile LoadModStateType LoadModState;
|
|
static volatile bool SamplePosition;
|
|
|
|
static void Initialize(void) {
|
|
/* Configure CARRIER input pin and route it to EVSYS */
|
|
CODEC_CARRIER_IN_PORT.DIRCLR = CODEC_CARRIER_IN_MASK;
|
|
249c: e0 e4 ldi r30, 0x40 ; 64
|
|
249e: f6 e0 ldi r31, 0x06 ; 6
|
|
24a0: 84 e0 ldi r24, 0x04 ; 4
|
|
24a2: 82 83 std Z+2, r24 ; 0x02
|
|
CODEC_CARRIER_IN_PORT.CODEC_CARRIER_IN_PINCTRL = PORT_ISC_BOTHEDGES_gc;
|
|
24a4: 12 8a std Z+18, r1 ; 0x12
|
|
EVSYS.CH6MUX = CODEC_CARRIER_IN_EVMUX;
|
|
24a6: c0 e8 ldi r28, 0x80 ; 128
|
|
24a8: d1 e0 ldi r29, 0x01 ; 1
|
|
24aa: 82 e6 ldi r24, 0x62 ; 98
|
|
24ac: 8e 83 std Y+6, r24 ; 0x06
|
|
|
|
/* Configure two DEMOD pins for input.
|
|
* Configure event channel 0 for rising edge (begin of modulation pause)
|
|
* Configure event channel 1 for falling edge (end of modulation pause) */
|
|
CODEC_DEMOD_IN_PORT.DIRCLR = CODEC_DEMOD_IN_MASK;
|
|
24ae: a0 e2 ldi r26, 0x20 ; 32
|
|
24b0: b6 e0 ldi r27, 0x06 ; 6
|
|
24b2: 85 e0 ldi r24, 0x05 ; 5
|
|
24b4: 12 96 adiw r26, 0x02 ; 2
|
|
24b6: 8c 93 st X, r24
|
|
24b8: 12 97 sbiw r26, 0x02 ; 2
|
|
CODEC_DEMOD_IN_PORT.CODEC_DEMOD_IN_PINCTRL0 = PORT_ISC_RISING_gc;
|
|
24ba: 81 e0 ldi r24, 0x01 ; 1
|
|
24bc: 50 96 adiw r26, 0x10 ; 16
|
|
24be: 8c 93 st X, r24
|
|
24c0: 50 97 sbiw r26, 0x10 ; 16
|
|
CODEC_DEMOD_IN_PORT.CODEC_DEMOD_IN_PINCTRL1 = PORT_ISC_FALLING_gc;
|
|
24c2: 82 e0 ldi r24, 0x02 ; 2
|
|
24c4: 52 96 adiw r26, 0x12 ; 18
|
|
24c6: 8c 93 st X, r24
|
|
24c8: 52 97 sbiw r26, 0x12 ; 18
|
|
CODEC_DEMOD_IN_PORT.INT0MASK = 0;
|
|
24ca: 1a 96 adiw r26, 0x0a ; 10
|
|
24cc: 1c 92 st X, r1
|
|
24ce: 1a 97 sbiw r26, 0x0a ; 10
|
|
CODEC_DEMOD_IN_PORT.INTCTRL = PORT_INT0LVL_HI_gc;
|
|
24d0: 83 e0 ldi r24, 0x03 ; 3
|
|
24d2: 19 96 adiw r26, 0x09 ; 9
|
|
24d4: 8c 93 st X, r24
|
|
EVSYS.CH0MUX = CODEC_DEMOD_IN_EVMUX0;
|
|
24d6: 98 e5 ldi r25, 0x58 ; 88
|
|
24d8: 98 83 st Y, r25
|
|
EVSYS.CH1MUX = CODEC_DEMOD_IN_EVMUX1;
|
|
24da: 9a e5 ldi r25, 0x5A ; 90
|
|
24dc: 99 83 std Y+1, r25 ; 0x01
|
|
|
|
/* Configure LOADMOD and SUBCARRIER output pins.
|
|
* Disable PSK modulation by setting pin to low. */
|
|
CODEC_LOADMOD_PORT.DIRSET = CODEC_LOADMOD_MASK;
|
|
24de: 90 e4 ldi r25, 0x40 ; 64
|
|
24e0: 91 83 std Z+1, r25 ; 0x01
|
|
CODEC_LOADMOD_PORT.OUTCLR = CODEC_LOADMOD_MASK;
|
|
24e2: 96 83 std Z+6, r25 ; 0x06
|
|
CODEC_SUBCARRIER_PORT.DIRSET = CODEC_SUBCARRIER_MASK;
|
|
24e4: 81 83 std Z+1, r24 ; 0x01
|
|
CODEC_SUBCARRIER_PORT.OUTCLR = CODEC_SUBCARRIER_MASK;
|
|
24e6: 86 83 std Z+6, r24 ; 0x06
|
|
|
|
/* Configure subcarrier generation with 50% DC output using OOK */
|
|
CODEC_SUBCARRIER_TIMER.PER = ISO14443A_SUBCARRIER_DIVIDER - 1;
|
|
24e8: e0 e0 ldi r30, 0x00 ; 0
|
|
24ea: f8 e0 ldi r31, 0x08 ; 8
|
|
24ec: 8f e0 ldi r24, 0x0F ; 15
|
|
24ee: 90 e0 ldi r25, 0x00 ; 0
|
|
24f0: 86 a3 std Z+38, r24 ; 0x26
|
|
24f2: 97 a3 std Z+39, r25 ; 0x27
|
|
CODEC_SUBCARRIER_TIMER.CODEC_SUBCARRIER_CC_OOK = ISO14443A_SUBCARRIER_DIVIDER/2;
|
|
24f4: 88 e0 ldi r24, 0x08 ; 8
|
|
24f6: 90 e0 ldi r25, 0x00 ; 0
|
|
24f8: 82 a7 std Z+42, r24 ; 0x2a
|
|
24fa: 93 a7 std Z+43, r25 ; 0x2b
|
|
CODEC_SUBCARRIER_TIMER.CTRLB = CODEC_SUBCARRIER_CCEN_OOK | TC_WGMODE_SINGLESLOPE_gc;
|
|
24fc: 83 e2 ldi r24, 0x23 ; 35
|
|
24fe: 81 83 std Z+1, r24 ; 0x01
|
|
void ISO14443ACodecInit(void) {
|
|
/* Initialize common peripherals and start listening
|
|
* for incoming data. */
|
|
Initialize();
|
|
StartDemod();
|
|
}
|
|
2500: df 91 pop r29
|
|
2502: cf 91 pop r28
|
|
|
|
void ISO14443ACodecInit(void) {
|
|
/* Initialize common peripherals and start listening
|
|
* for incoming data. */
|
|
Initialize();
|
|
StartDemod();
|
|
2504: d2 cd rjmp .-1116 ; 0x20aa <StartDemod>
|
|
|
|
00002506 <ISO14443ACodecTask>:
|
|
}
|
|
|
|
void ISO14443ACodecTask(void) {
|
|
2506: cf 93 push r28
|
|
2508: df 93 push r29
|
|
if (Flags.DemodFinished) {
|
|
250a: 80 91 af 20 lds r24, 0x20AF
|
|
250e: 88 23 and r24, r24
|
|
2510: c1 f0 breq .+48 ; 0x2542 <ISO14443ACodecTask+0x3c>
|
|
Flags.DemodFinished = 0;
|
|
2512: 10 92 af 20 sts 0x20AF, r1
|
|
INLINE void CodecTask(void) {
|
|
ActiveConfiguration.CodecTaskFunc();
|
|
}
|
|
|
|
INLINE void CodecSetDemodPower(bool bOnOff) {
|
|
CODEC_DEMOD_POWER_PORT.DIRSET = CODEC_DEMOD_POWER_MASK;
|
|
2516: 82 e0 ldi r24, 0x02 ; 2
|
|
2518: 80 93 21 06 sts 0x0621, r24
|
|
|
|
if (bOnOff) {
|
|
CODEC_DEMOD_POWER_PORT.OUTSET = CODEC_DEMOD_POWER_MASK;
|
|
} else {
|
|
CODEC_DEMOD_POWER_PORT.OUTCLR = CODEC_DEMOD_POWER_MASK;
|
|
251c: 80 93 26 06 sts 0x0626, r24
|
|
/* Reception finished. Process the received bytes */
|
|
CodecSetDemodPower(false);
|
|
|
|
uint16_t DemodBitCount = BitCount;
|
|
2520: 60 91 ad 20 lds r22, 0x20AD
|
|
2524: 70 91 ae 20 lds r23, 0x20AE
|
|
uint16_t AnswerBitCount = ISO14443A_APP_NO_RESPONSE;
|
|
|
|
if (DemodBitCount > 0) {
|
|
2528: 61 15 cp r22, r1
|
|
252a: 71 05 cpc r23, r1
|
|
252c: 89 f4 brne .+34 ; 0x2550 <ISO14443ACodecTask+0x4a>
|
|
INLINE uint16_t ApplicationProcess(uint8_t* ByteBuffer, uint16_t ByteCount) {
|
|
return ActiveConfiguration.ApplicationProcessFunc(ByteBuffer, ByteCount);
|
|
}
|
|
|
|
INLINE void ApplicationReset(void) {
|
|
ActiveConfiguration.ApplicationResetFunc();
|
|
252e: e0 91 ef 20 lds r30, 0x20EF
|
|
2532: f0 91 f0 20 lds r31, 0x20F0
|
|
2536: 09 95 icall
|
|
CodecBufferPtr = CodecBuffer;
|
|
ParityBufferPtr = &CodecBuffer[ISO14443A_BUFFER_PARITY_OFFSET];
|
|
LoadModState = LOADMOD_START;
|
|
} else {
|
|
/* No data to be processed. Disable loadmodding and start listening again */
|
|
CODEC_TIMER_LOADMOD.CTRLA = TC_CLKSEL_OFF_gc;
|
|
2538: 10 92 40 09 sts 0x0940, r1
|
|
CODEC_TIMER_LOADMOD.INTCTRLA = 0;
|
|
253c: 10 92 46 09 sts 0x0946, r1
|
|
|
|
StartDemod();
|
|
2540: b4 dd rcall .-1176 ; 0x20aa <StartDemod>
|
|
}
|
|
}
|
|
|
|
if (Flags.LoadmodFinished) {
|
|
2542: 80 91 b0 20 lds r24, 0x20B0
|
|
2546: 81 11 cpse r24, r1
|
|
2548: 2a c0 rjmp .+84 ; 0x259e <ISO14443ACodecTask+0x98>
|
|
Flags.LoadmodFinished = 0;
|
|
/* Load modulation has been finished. Stop it and start to listen
|
|
* for incoming data again. */
|
|
StartDemod();
|
|
}
|
|
}
|
|
254a: df 91 pop r29
|
|
254c: cf 91 pop r28
|
|
254e: 08 95 ret
|
|
INLINE void ApplicationTask(void) {
|
|
ActiveConfiguration.ApplicationTaskFunc();
|
|
}
|
|
|
|
INLINE uint16_t ApplicationProcess(uint8_t* ByteBuffer, uint16_t ByteCount) {
|
|
return ActiveConfiguration.ApplicationProcessFunc(ByteBuffer, ByteCount);
|
|
2550: e0 91 f3 20 lds r30, 0x20F3
|
|
2554: f0 91 f4 20 lds r31, 0x20F4
|
|
2558: 80 e1 ldi r24, 0x10 ; 16
|
|
255a: 92 e2 ldi r25, 0x22 ; 34
|
|
255c: 09 95 icall
|
|
|
|
if (DemodBitCount > 0) {
|
|
/* Call application if we received data */
|
|
AnswerBitCount = ApplicationProcess(CodecBuffer, DemodBitCount);
|
|
|
|
if (AnswerBitCount & ISO14443A_APP_CUSTOM_PARITY) {
|
|
255e: 94 ff sbrs r25, 4
|
|
2560: 23 c0 rjmp .+70 ; 0x25a8 <ISO14443ACodecTask+0xa2>
|
|
/* Application has generated it's own parity bits.
|
|
* Clear this option bit. */
|
|
AnswerBitCount &= ~ISO14443A_APP_CUSTOM_PARITY;
|
|
2562: 9f 7e andi r25, 0xEF ; 239
|
|
}
|
|
} else {
|
|
ApplicationReset();
|
|
}
|
|
|
|
if (AnswerBitCount != ISO14443A_APP_NO_RESPONSE) {
|
|
2564: 00 97 sbiw r24, 0x00 ; 0
|
|
2566: 41 f3 breq .-48 ; 0x2538 <ISO14443ACodecTask+0x32>
|
|
BitCount = AnswerBitCount;
|
|
2568: 80 93 ad 20 sts 0x20AD, r24
|
|
256c: 90 93 ae 20 sts 0x20AE, r25
|
|
BitSent = 0;
|
|
2570: 10 92 ab 20 sts 0x20AB, r1
|
|
2574: 10 92 ac 20 sts 0x20AC, r1
|
|
CodecBufferPtr = CodecBuffer;
|
|
2578: 80 e1 ldi r24, 0x10 ; 16
|
|
257a: 92 e2 ldi r25, 0x22 ; 34
|
|
257c: 80 93 b1 20 sts 0x20B1, r24
|
|
2580: 90 93 b2 20 sts 0x20B2, r25
|
|
ParityBufferPtr = &CodecBuffer[ISO14443A_BUFFER_PARITY_OFFSET];
|
|
2584: 80 e9 ldi r24, 0x90 ; 144
|
|
2586: 92 e2 ldi r25, 0x22 ; 34
|
|
2588: 80 93 b3 20 sts 0x20B3, r24
|
|
258c: 90 93 b4 20 sts 0x20B4, r25
|
|
LoadModState = LOADMOD_START;
|
|
2590: 81 e0 ldi r24, 0x01 ; 1
|
|
2592: 80 93 a6 20 sts 0x20A6, r24
|
|
|
|
StartDemod();
|
|
}
|
|
}
|
|
|
|
if (Flags.LoadmodFinished) {
|
|
2596: 80 91 b0 20 lds r24, 0x20B0
|
|
259a: 88 23 and r24, r24
|
|
259c: b1 f2 breq .-84 ; 0x254a <ISO14443ACodecTask+0x44>
|
|
Flags.LoadmodFinished = 0;
|
|
259e: 10 92 b0 20 sts 0x20B0, r1
|
|
/* Load modulation has been finished. Stop it and start to listen
|
|
* for incoming data again. */
|
|
StartDemod();
|
|
}
|
|
}
|
|
25a2: df 91 pop r29
|
|
25a4: cf 91 pop r28
|
|
|
|
if (Flags.LoadmodFinished) {
|
|
Flags.LoadmodFinished = 0;
|
|
/* Load modulation has been finished. Stop it and start to listen
|
|
* for incoming data again. */
|
|
StartDemod();
|
|
25a6: 81 cd rjmp .-1278 ; 0x20aa <StartDemod>
|
|
/* Application has generated it's own parity bits.
|
|
* Clear this option bit. */
|
|
AnswerBitCount &= ~ISO14443A_APP_CUSTOM_PARITY;
|
|
} else {
|
|
/* We have to generate the parity bits ourself */
|
|
for (uint8_t i = 0; i < (AnswerBitCount / 8); i++) {
|
|
25a8: ac 01 movw r20, r24
|
|
25aa: 56 95 lsr r21
|
|
25ac: 47 95 ror r20
|
|
25ae: 56 95 lsr r21
|
|
25b0: 47 95 ror r20
|
|
25b2: 56 95 lsr r21
|
|
25b4: 47 95 ror r20
|
|
25b6: 41 15 cp r20, r1
|
|
25b8: 51 05 cpc r21, r1
|
|
25ba: a1 f2 breq .-88 ; 0x2564 <ISO14443ACodecTask+0x5e>
|
|
25bc: 60 e0 ldi r22, 0x00 ; 0
|
|
25be: 20 e0 ldi r18, 0x00 ; 0
|
|
25c0: 30 e0 ldi r19, 0x00 ; 0
|
|
/* For each whole byte, generate a parity bit. */
|
|
CodecBuffer[ISO14443A_BUFFER_PARITY_OFFSET + i] =
|
|
ODD_PARITY(CodecBuffer[i]);
|
|
25c2: f9 01 movw r30, r18
|
|
25c4: e0 5f subi r30, 0xF0 ; 240
|
|
25c6: fd 4d sbci r31, 0xDD ; 221
|
|
25c8: 20 81 ld r18, Z
|
|
25ca: 02 2e mov r0, r18
|
|
25cc: 22 95 swap r18
|
|
25ce: 20 25 eor r18, r0
|
|
25d0: 02 2e mov r0, r18
|
|
25d2: 26 95 lsr r18
|
|
25d4: 26 95 lsr r18
|
|
25d6: 20 25 eor r18, r0
|
|
AnswerBitCount &= ~ISO14443A_APP_CUSTOM_PARITY;
|
|
} else {
|
|
/* We have to generate the parity bits ourself */
|
|
for (uint8_t i = 0; i < (AnswerBitCount / 8); i++) {
|
|
/* For each whole byte, generate a parity bit. */
|
|
CodecBuffer[ISO14443A_BUFFER_PARITY_OFFSET + i] =
|
|
25d8: e0 58 subi r30, 0x80 ; 128
|
|
25da: ff 4f sbci r31, 0xFF ; 255
|
|
ODD_PARITY(CodecBuffer[i]);
|
|
25dc: 30 e0 ldi r19, 0x00 ; 0
|
|
25de: 2f 5f subi r18, 0xFF ; 255
|
|
25e0: 3f 4f sbci r19, 0xFF ; 255
|
|
25e2: 21 fb bst r18, 1
|
|
25e4: 77 27 eor r23, r23
|
|
25e6: 70 f9 bld r23, 0
|
|
25e8: c7 2f mov r28, r23
|
|
25ea: 20 e0 ldi r18, 0x00 ; 0
|
|
25ec: d2 2f mov r29, r18
|
|
25ee: 71 e0 ldi r23, 0x01 ; 1
|
|
25f0: c7 27 eor r28, r23
|
|
25f2: c0 83 st Z, r28
|
|
/* Application has generated it's own parity bits.
|
|
* Clear this option bit. */
|
|
AnswerBitCount &= ~ISO14443A_APP_CUSTOM_PARITY;
|
|
} else {
|
|
/* We have to generate the parity bits ourself */
|
|
for (uint8_t i = 0; i < (AnswerBitCount / 8); i++) {
|
|
25f4: 6f 5f subi r22, 0xFF ; 255
|
|
25f6: 26 2f mov r18, r22
|
|
25f8: 30 e0 ldi r19, 0x00 ; 0
|
|
25fa: 24 17 cp r18, r20
|
|
25fc: 35 07 cpc r19, r21
|
|
25fe: 08 f3 brcs .-62 ; 0x25c2 <ISO14443ACodecTask+0xbc>
|
|
2600: b1 cf rjmp .-158 ; 0x2564 <ISO14443ACodecTask+0x5e>
|
|
|
|
00002602 <MifareClassicAppInit1K>:
|
|
Block[11] = Block[3];
|
|
}
|
|
|
|
void MifareClassicAppInit1K(void)
|
|
{
|
|
State = STATE_IDLE;
|
|
2602: 81 e0 ldi r24, 0x01 ; 1
|
|
2604: 80 93 b5 20 sts 0x20B5, r24
|
|
CardATQAValue = MFCLASSIC_1K_ATQA_VALUE;
|
|
2608: 84 e0 ldi r24, 0x04 ; 4
|
|
260a: 90 e0 ldi r25, 0x00 ; 0
|
|
260c: 80 93 b6 20 sts 0x20B6, r24
|
|
2610: 90 93 b7 20 sts 0x20B7, r25
|
|
CardSAKValue = MFCLASSIC_1K_SAK_CL1_VALUE;
|
|
2614: 88 e0 ldi r24, 0x08 ; 8
|
|
2616: 80 93 b8 20 sts 0x20B8, r24
|
|
261a: 08 95 ret
|
|
|
|
0000261c <MifareClassicAppInit4K>:
|
|
}
|
|
|
|
void MifareClassicAppInit4K(void)
|
|
{
|
|
State = STATE_IDLE;
|
|
261c: 81 e0 ldi r24, 0x01 ; 1
|
|
261e: 80 93 b5 20 sts 0x20B5, r24
|
|
CardATQAValue = MFCLASSIC_4K_ATQA_VALUE;
|
|
2622: 82 e0 ldi r24, 0x02 ; 2
|
|
2624: 90 e0 ldi r25, 0x00 ; 0
|
|
2626: 80 93 b6 20 sts 0x20B6, r24
|
|
262a: 90 93 b7 20 sts 0x20B7, r25
|
|
CardSAKValue = MFCLASSIC_4K_SAK_CL1_VALUE;
|
|
262e: 88 e1 ldi r24, 0x18 ; 24
|
|
2630: 80 93 b8 20 sts 0x20B8, r24
|
|
2634: 08 95 ret
|
|
|
|
00002636 <MifareClassicAppReset>:
|
|
}
|
|
|
|
void MifareClassicAppReset(void)
|
|
{
|
|
State = STATE_IDLE;
|
|
2636: 81 e0 ldi r24, 0x01 ; 1
|
|
2638: 80 93 b5 20 sts 0x20B5, r24
|
|
263c: 08 95 ret
|
|
|
|
0000263e <MifareClassicAppTask>:
|
|
}
|
|
|
|
void MifareClassicAppTask(void)
|
|
{
|
|
263e: 08 95 ret
|
|
|
|
00002640 <MifareClassicAppProcess>:
|
|
|
|
}
|
|
|
|
uint16_t MifareClassicAppProcess(uint8_t* Buffer, uint16_t BitCount)
|
|
{
|
|
2640: 6f 92 push r6
|
|
2642: 7f 92 push r7
|
|
2644: 8f 92 push r8
|
|
2646: 9f 92 push r9
|
|
2648: af 92 push r10
|
|
264a: bf 92 push r11
|
|
264c: cf 92 push r12
|
|
264e: df 92 push r13
|
|
2650: ef 92 push r14
|
|
2652: ff 92 push r15
|
|
2654: 0f 93 push r16
|
|
2656: 1f 93 push r17
|
|
2658: cf 93 push r28
|
|
265a: df 93 push r29
|
|
265c: cd b7 in r28, 0x3d ; 61
|
|
265e: de b7 in r29, 0x3e ; 62
|
|
2660: 2e 97 sbiw r28, 0x0e ; 14
|
|
2662: cd bf out 0x3d, r28 ; 61
|
|
2664: de bf out 0x3e, r29 ; 62
|
|
2666: 8c 01 movw r16, r24
|
|
switch(State) {
|
|
2668: 80 91 b5 20 lds r24, 0x20B5
|
|
266c: 84 30 cpi r24, 0x04 ; 4
|
|
266e: 09 f4 brne .+2 ; 0x2672 <MifareClassicAppProcess+0x32>
|
|
2670: f4 c0 rjmp .+488 ; 0x285a <MifareClassicAppProcess+0x21a>
|
|
2672: 08 f4 brcc .+2 ; 0x2676 <MifareClassicAppProcess+0x36>
|
|
2674: 3b c0 rjmp .+118 ; 0x26ec <MifareClassicAppProcess+0xac>
|
|
2676: 86 30 cpi r24, 0x06 ; 6
|
|
2678: 09 f4 brne .+2 ; 0x267c <MifareClassicAppProcess+0x3c>
|
|
267a: bd c0 rjmp .+378 ; 0x27f6 <MifareClassicAppProcess+0x1b6>
|
|
267c: 08 f0 brcs .+2 ; 0x2680 <MifareClassicAppProcess+0x40>
|
|
267e: 60 c0 rjmp .+192 ; 0x2740 <MifareClassicAppProcess+0x100>
|
|
|
|
case STATE_AUTHED_IDLE:
|
|
/* In this state, all communication is encrypted. Thus we first have to encrypt
|
|
* the incoming data. */
|
|
for (uint8_t i=0; i<4; i++)
|
|
Buffer[i] ^= Crypto1Byte();
|
|
2680: f8 01 movw r30, r16
|
|
2682: d0 80 ld r13, Z
|
|
2684: 31 d7 rcall .+3682 ; 0x34e8 <Crypto1Byte>
|
|
2686: 8d 25 eor r24, r13
|
|
2688: d8 01 movw r26, r16
|
|
268a: 8c 93 st X, r24
|
|
268c: 11 96 adiw r26, 0x01 ; 1
|
|
268e: dc 90 ld r13, X
|
|
2690: 2b d7 rcall .+3670 ; 0x34e8 <Crypto1Byte>
|
|
2692: 8d 25 eor r24, r13
|
|
2694: f8 01 movw r30, r16
|
|
2696: 81 83 std Z+1, r24 ; 0x01
|
|
2698: d2 80 ldd r13, Z+2 ; 0x02
|
|
269a: 26 d7 rcall .+3660 ; 0x34e8 <Crypto1Byte>
|
|
269c: 8d 25 eor r24, r13
|
|
269e: d8 01 movw r26, r16
|
|
26a0: 12 96 adiw r26, 0x02 ; 2
|
|
26a2: 8c 93 st X, r24
|
|
26a4: 12 97 sbiw r26, 0x02 ; 2
|
|
26a6: 13 96 adiw r26, 0x03 ; 3
|
|
26a8: dc 90 ld r13, X
|
|
26aa: 1e d7 rcall .+3644 ; 0x34e8 <Crypto1Byte>
|
|
26ac: 8d 25 eor r24, r13
|
|
26ae: f8 01 movw r30, r16
|
|
26b0: 83 83 std Z+3, r24 ; 0x03
|
|
|
|
if (Buffer[0] == CMD_READ) {
|
|
26b2: 80 81 ld r24, Z
|
|
26b4: 80 33 cpi r24, 0x30 ; 48
|
|
26b6: 09 f4 brne .+2 ; 0x26ba <MifareClassicAppProcess+0x7a>
|
|
26b8: ac c2 rjmp .+1368 ; 0x2c12 <MifareClassicAppProcess+0x5d2>
|
|
* BITS_PER_BYTE) | ISO14443A_APP_CUSTOM_PARITY;
|
|
} else {
|
|
Buffer[0] = NAK_CRC_ERROR ^ Crypto1Nibble();
|
|
return ACK_NAK_FRAME_SIZE;
|
|
}
|
|
} else if (Buffer[0] == CMD_WRITE) {
|
|
26ba: 80 3a cpi r24, 0xA0 ; 160
|
|
26bc: 09 f4 brne .+2 ; 0x26c0 <MifareClassicAppProcess+0x80>
|
|
26be: 1f c3 rjmp .+1598 ; 0x2cfe <MifareClassicAppProcess+0x6be>
|
|
Buffer[0] = ACK_VALUE ^ Crypto1Nibble();
|
|
} else {
|
|
Buffer[0] = NAK_CRC_ERROR ^ Crypto1Nibble();
|
|
}
|
|
return ACK_NAK_FRAME_SIZE;
|
|
} else if (Buffer[0] == CMD_DECREMENT) {
|
|
26c0: 80 3c cpi r24, 0xC0 ; 192
|
|
26c2: 09 f4 brne .+2 ; 0x26c6 <MifareClassicAppProcess+0x86>
|
|
26c4: 3a c3 rjmp .+1652 ; 0x2d3a <MifareClassicAppProcess+0x6fa>
|
|
Buffer[0] = ACK_VALUE ^ Crypto1Nibble();
|
|
} else {
|
|
Buffer[0] = NAK_CRC_ERROR ^ Crypto1Nibble();
|
|
}
|
|
return ACK_NAK_FRAME_SIZE;
|
|
} else if (Buffer[0] == CMD_INCREMENT) {
|
|
26c6: 81 3c cpi r24, 0xC1 ; 193
|
|
26c8: 09 f4 brne .+2 ; 0x26cc <MifareClassicAppProcess+0x8c>
|
|
26ca: da c3 rjmp .+1972 ; 0x2e80 <MifareClassicAppProcess+0x840>
|
|
Buffer[0] = ACK_VALUE ^ Crypto1Nibble();
|
|
} else {
|
|
Buffer[0] = NAK_CRC_ERROR ^ Crypto1Nibble();
|
|
}
|
|
return ACK_NAK_FRAME_SIZE;
|
|
} else if (Buffer[0] == CMD_RESTORE) {
|
|
26cc: 82 3c cpi r24, 0xC2 ; 194
|
|
26ce: 09 f4 brne .+2 ; 0x26d2 <MifareClassicAppProcess+0x92>
|
|
26d0: e7 c3 rjmp .+1998 ; 0x2ea0 <MifareClassicAppProcess+0x860>
|
|
Buffer[0] = ACK_VALUE ^ Crypto1Nibble();
|
|
} else {
|
|
Buffer[0] = NAK_CRC_ERROR ^ Crypto1Nibble();
|
|
}
|
|
return ACK_NAK_FRAME_SIZE;
|
|
}else if (Buffer[0] == CMD_TRANSFER) {
|
|
26d2: 80 3b cpi r24, 0xB0 ; 176
|
|
26d4: 09 f4 brne .+2 ; 0x26d8 <MifareClassicAppProcess+0x98>
|
|
26d6: f1 c3 rjmp .+2018 ; 0x2eba <MifareClassicAppProcess+0x87a>
|
|
} else {
|
|
Buffer[0] = NAK_CRC_ERROR ^ Crypto1Nibble();
|
|
}
|
|
|
|
return ACK_NAK_FRAME_SIZE;
|
|
} else if ( (Buffer[0] == CMD_AUTH_A) || (Buffer[0] == CMD_AUTH_B) ) {
|
|
26d8: 80 56 subi r24, 0x60 ; 96
|
|
26da: 82 30 cpi r24, 0x02 ; 2
|
|
26dc: 08 f4 brcc .+2 ; 0x26e0 <MifareClassicAppProcess+0xa0>
|
|
26de: 94 c1 rjmp .+808 ; 0x2a08 <MifareClassicAppProcess+0x3c8>
|
|
Buffer[0] = NAK_CRC_ERROR ^ Crypto1Nibble();
|
|
return ACK_NAK_FRAME_SIZE;
|
|
}
|
|
} else {
|
|
/* Unknown command. Enter HALT state */
|
|
State = STATE_IDLE;
|
|
26e0: 81 e0 ldi r24, 0x01 ; 1
|
|
26e2: 80 93 b5 20 sts 0x20B5, r24
|
|
/* Unknown state? Should never happen. */
|
|
break;
|
|
}
|
|
|
|
/* No response has been sent, when we reach here */
|
|
return ISO14443A_APP_NO_RESPONSE;
|
|
26e6: 20 e0 ldi r18, 0x00 ; 0
|
|
26e8: 30 e0 ldi r19, 0x00 ; 0
|
|
} else {
|
|
/* Unknown command. Enter HALT state */
|
|
State = STATE_IDLE;
|
|
}
|
|
|
|
break;
|
|
26ea: 63 c0 rjmp .+198 ; 0x27b2 <MifareClassicAppProcess+0x172>
|
|
|
|
}
|
|
|
|
uint16_t MifareClassicAppProcess(uint8_t* Buffer, uint16_t BitCount)
|
|
{
|
|
switch(State) {
|
|
26ec: 82 30 cpi r24, 0x02 ; 2
|
|
26ee: 09 f4 brne .+2 ; 0x26f2 <MifareClassicAppProcess+0xb2>
|
|
26f0: a0 c0 rjmp .+320 ; 0x2832 <MifareClassicAppProcess+0x1f2>
|
|
26f2: 08 f4 brcc .+2 ; 0x26f6 <MifareClassicAppProcess+0xb6>
|
|
26f4: 71 c0 rjmp .+226 ; 0x27d8 <MifareClassicAppProcess+0x198>
|
|
INLINE
|
|
bool ISO14443AWakeUp(void* Buffer, uint16_t* BitCount, uint16_t ATQAValue)
|
|
{
|
|
uint8_t* DataPtr = (uint8_t*) Buffer;
|
|
|
|
if ( (DataPtr[0] == ISO14443A_CMD_REQA) || (DataPtr[0] == ISO14443A_CMD_WUPA) ){
|
|
26f6: f8 01 movw r30, r16
|
|
26f8: 80 81 ld r24, Z
|
|
26fa: 86 32 cpi r24, 0x26 ; 38
|
|
26fc: 09 f4 brne .+2 ; 0x2700 <MifareClassicAppProcess+0xc0>
|
|
26fe: 6f c1 rjmp .+734 ; 0x29de <MifareClassicAppProcess+0x39e>
|
|
2700: 82 35 cpi r24, 0x52 ; 82
|
|
2702: 09 f4 brne .+2 ; 0x2706 <MifareClassicAppProcess+0xc6>
|
|
2704: 6c c1 rjmp .+728 ; 0x29de <MifareClassicAppProcess+0x39e>
|
|
|
|
case STATE_ACTIVE:
|
|
if (ISO14443AWakeUp(Buffer, &BitCount, MFCLASSIC_1K_ATQA_VALUE)) {
|
|
State = STATE_READY;
|
|
return BitCount;
|
|
} else if (Buffer[0] == CMD_HALT) {
|
|
2706: 80 35 cpi r24, 0x50 ; 80
|
|
2708: 09 f4 brne .+2 ; 0x270c <MifareClassicAppProcess+0xcc>
|
|
270a: 74 c1 rjmp .+744 ; 0x29f4 <MifareClassicAppProcess+0x3b4>
|
|
}
|
|
} else {
|
|
Buffer[0] = NAK_INVALID_ARG;
|
|
return ACK_NAK_FRAME_SIZE;
|
|
}
|
|
} else if ( (Buffer[0] == CMD_AUTH_A) || (Buffer[0] == CMD_AUTH_B)) {
|
|
270c: 98 2f mov r25, r24
|
|
270e: 90 56 subi r25, 0x60 ; 96
|
|
2710: 92 30 cpi r25, 0x02 ; 2
|
|
2712: 08 f4 brcc .+2 ; 0x2716 <MifareClassicAppProcess+0xd6>
|
|
2714: e6 c1 rjmp .+972 ; 0x2ae2 <MifareClassicAppProcess+0x4a2>
|
|
return CMD_AUTH_RB_FRAME_SIZE * BITS_PER_BYTE;
|
|
} else {
|
|
Buffer[0] = NAK_CRC_ERROR;
|
|
return ACK_NAK_FRAME_SIZE;
|
|
}
|
|
} else if ( (Buffer[0] == CMD_READ) || (Buffer[0] == CMD_WRITE) || (Buffer[0] == CMD_DECREMENT)
|
|
2716: 80 33 cpi r24, 0x30 ; 48
|
|
2718: 51 f0 breq .+20 ; 0x272e <MifareClassicAppProcess+0xee>
|
|
271a: 80 3a cpi r24, 0xA0 ; 160
|
|
271c: 41 f0 breq .+16 ; 0x272e <MifareClassicAppProcess+0xee>
|
|
271e: 80 3c cpi r24, 0xC0 ; 192
|
|
2720: 31 f0 breq .+12 ; 0x272e <MifareClassicAppProcess+0xee>
|
|
|| (Buffer[0] == CMD_INCREMENT) || (Buffer[0] == CMD_RESTORE) || (Buffer[0] == CMD_TRANSFER) ) {
|
|
2722: 81 3c cpi r24, 0xC1 ; 193
|
|
2724: 21 f0 breq .+8 ; 0x272e <MifareClassicAppProcess+0xee>
|
|
2726: 82 3c cpi r24, 0xC2 ; 194
|
|
2728: 11 f0 breq .+4 ; 0x272e <MifareClassicAppProcess+0xee>
|
|
272a: 80 3b cpi r24, 0xB0 ; 176
|
|
272c: c9 f6 brne .-78 ; 0x26e0 <MifareClassicAppProcess+0xa0>
|
|
State = STATE_IDLE;
|
|
272e: 81 e0 ldi r24, 0x01 ; 1
|
|
2730: 80 93 b5 20 sts 0x20B5, r24
|
|
Buffer[0] = NAK_NOT_AUTHED;
|
|
2734: 84 e0 ldi r24, 0x04 ; 4
|
|
2736: f8 01 movw r30, r16
|
|
2738: 80 83 st Z, r24
|
|
return ACK_NAK_FRAME_SIZE;
|
|
273a: 24 e0 ldi r18, 0x04 ; 4
|
|
273c: 30 e0 ldi r19, 0x00 ; 0
|
|
273e: 39 c0 rjmp .+114 ; 0x27b2 <MifareClassicAppProcess+0x172>
|
|
|
|
}
|
|
|
|
uint16_t MifareClassicAppProcess(uint8_t* Buffer, uint16_t BitCount)
|
|
{
|
|
switch(State) {
|
|
2740: 8a 30 cpi r24, 0x0A ; 10
|
|
2742: 08 f0 brcs .+2 ; 0x2746 <MifareClassicAppProcess+0x106>
|
|
2744: 55 c0 rjmp .+170 ; 0x27f0 <MifareClassicAppProcess+0x1b0>
|
|
* decrypt the data and check CRC. Read data from the requested block
|
|
* address into the global block buffer and check for integrity. Then
|
|
* add or subtract according to issued command if necessary and store
|
|
* the block back into the global block buffer. */
|
|
for (uint8_t i=0; i<(MEM_VALUE_SIZE + ISO14443A_CRCA_SIZE); i++)
|
|
Buffer[i] ^= Crypto1Byte();
|
|
2746: d8 01 movw r26, r16
|
|
2748: fc 90 ld r15, X
|
|
274a: ce d6 rcall .+3484 ; 0x34e8 <Crypto1Byte>
|
|
274c: 8f 25 eor r24, r15
|
|
274e: f8 01 movw r30, r16
|
|
2750: 80 83 st Z, r24
|
|
2752: f1 80 ldd r15, Z+1 ; 0x01
|
|
2754: c9 d6 rcall .+3474 ; 0x34e8 <Crypto1Byte>
|
|
2756: 8f 25 eor r24, r15
|
|
2758: d8 01 movw r26, r16
|
|
275a: 11 96 adiw r26, 0x01 ; 1
|
|
275c: 8c 93 st X, r24
|
|
275e: 11 97 sbiw r26, 0x01 ; 1
|
|
2760: 12 96 adiw r26, 0x02 ; 2
|
|
2762: fc 90 ld r15, X
|
|
2764: c1 d6 rcall .+3458 ; 0x34e8 <Crypto1Byte>
|
|
2766: 8f 25 eor r24, r15
|
|
2768: f8 01 movw r30, r16
|
|
276a: 82 83 std Z+2, r24 ; 0x02
|
|
276c: f3 80 ldd r15, Z+3 ; 0x03
|
|
276e: bc d6 rcall .+3448 ; 0x34e8 <Crypto1Byte>
|
|
2770: 8f 25 eor r24, r15
|
|
2772: d8 01 movw r26, r16
|
|
2774: 13 96 adiw r26, 0x03 ; 3
|
|
2776: 8c 93 st X, r24
|
|
2778: 13 97 sbiw r26, 0x03 ; 3
|
|
277a: 14 96 adiw r26, 0x04 ; 4
|
|
277c: fc 90 ld r15, X
|
|
277e: b4 d6 rcall .+3432 ; 0x34e8 <Crypto1Byte>
|
|
2780: 8f 25 eor r24, r15
|
|
2782: f8 01 movw r30, r16
|
|
2784: 84 83 std Z+4, r24 ; 0x04
|
|
2786: f5 80 ldd r15, Z+5 ; 0x05
|
|
2788: af d6 rcall .+3422 ; 0x34e8 <Crypto1Byte>
|
|
278a: 8f 25 eor r24, r15
|
|
278c: d8 01 movw r26, r16
|
|
278e: 15 96 adiw r26, 0x05 ; 5
|
|
2790: 8c 93 st X, r24
|
|
|
|
if (ISO14443ACheckCRCA(Buffer, MEM_VALUE_SIZE )) {
|
|
2792: 64 e0 ldi r22, 0x04 ; 4
|
|
2794: 70 e0 ldi r23, 0x00 ; 0
|
|
2796: c8 01 movw r24, r16
|
|
2798: 25 d4 rcall .+2122 ; 0x2fe4 <ISO14443ACheckCRCA>
|
|
279a: 81 11 cpse r24, r1
|
|
279c: 0c c2 rjmp .+1048 ; 0x2bb6 <MifareClassicAppProcess+0x576>
|
|
/* Not sure if this is the correct error code.. */
|
|
Buffer[0] = NAK_OTHER_ERROR ^ Crypto1Nibble();
|
|
}
|
|
} else {
|
|
/* CRC Error. */
|
|
Buffer[0] = NAK_CRC_ERROR ^ Crypto1Nibble();
|
|
279e: e5 d6 rcall .+3530 ; 0x356a <Crypto1Nibble>
|
|
27a0: 91 e0 ldi r25, 0x01 ; 1
|
|
27a2: 98 27 eor r25, r24
|
|
27a4: f8 01 movw r30, r16
|
|
27a6: 90 83 st Z, r25
|
|
}
|
|
|
|
State = STATE_AUTHED_IDLE;
|
|
27a8: 85 e0 ldi r24, 0x05 ; 5
|
|
27aa: 80 93 b5 20 sts 0x20B5, r24
|
|
return ACK_NAK_FRAME_SIZE;
|
|
27ae: 24 e0 ldi r18, 0x04 ; 4
|
|
27b0: 30 e0 ldi r19, 0x00 ; 0
|
|
break;
|
|
}
|
|
|
|
/* No response has been sent, when we reach here */
|
|
return ISO14443A_APP_NO_RESPONSE;
|
|
}
|
|
27b2: c9 01 movw r24, r18
|
|
27b4: 2e 96 adiw r28, 0x0e ; 14
|
|
27b6: cd bf out 0x3d, r28 ; 61
|
|
27b8: de bf out 0x3e, r29 ; 62
|
|
27ba: df 91 pop r29
|
|
27bc: cf 91 pop r28
|
|
27be: 1f 91 pop r17
|
|
27c0: 0f 91 pop r16
|
|
27c2: ff 90 pop r15
|
|
27c4: ef 90 pop r14
|
|
27c6: df 90 pop r13
|
|
27c8: cf 90 pop r12
|
|
27ca: bf 90 pop r11
|
|
27cc: af 90 pop r10
|
|
27ce: 9f 90 pop r9
|
|
27d0: 8f 90 pop r8
|
|
27d2: 7f 90 pop r7
|
|
27d4: 6f 90 pop r6
|
|
27d6: 08 95 ret
|
|
uint16_t MifareClassicAppProcess(uint8_t* Buffer, uint16_t BitCount)
|
|
{
|
|
switch(State) {
|
|
case STATE_IDLE:
|
|
case STATE_HALT:
|
|
if (ISO14443AWakeUp(Buffer, &BitCount, CardATQAValue)) {
|
|
27d8: 20 91 b6 20 lds r18, 0x20B6
|
|
27dc: 90 91 b7 20 lds r25, 0x20B7
|
|
27e0: d8 01 movw r26, r16
|
|
27e2: 8c 91 ld r24, X
|
|
27e4: 86 32 cpi r24, 0x26 ; 38
|
|
27e6: 09 f4 brne .+2 ; 0x27ea <MifareClassicAppProcess+0x1aa>
|
|
27e8: f1 c0 rjmp .+482 ; 0x29cc <MifareClassicAppProcess+0x38c>
|
|
27ea: 82 35 cpi r24, 0x52 ; 82
|
|
27ec: 09 f4 brne .+2 ; 0x27f0 <MifareClassicAppProcess+0x1b0>
|
|
27ee: ee c0 rjmp .+476 ; 0x29cc <MifareClassicAppProcess+0x38c>
|
|
|
|
*BitCount = ISO14443A_SAK_FRAME_SIZE;
|
|
return true;
|
|
} else {
|
|
/* We have not been selected. Don't send anything. */
|
|
*BitCount = 0;
|
|
27f0: 20 e0 ldi r18, 0x00 ; 0
|
|
27f2: 30 e0 ldi r19, 0x00 ; 0
|
|
27f4: de cf rjmp .-68 ; 0x27b2 <MifareClassicAppProcess+0x172>
|
|
27f6: 78 01 movw r14, r16
|
|
|
|
}
|
|
|
|
uint16_t MifareClassicAppProcess(uint8_t* Buffer, uint16_t BitCount)
|
|
{
|
|
switch(State) {
|
|
27f8: 52 e1 ldi r21, 0x12 ; 18
|
|
27fa: d5 2e mov r13, r21
|
|
* check for CRC. Then write the data when ReadOnly mode is not
|
|
* activated. */
|
|
|
|
/* We receive 16 bytes of data to be written and 2 bytes CRCA. Decrypt */
|
|
for (uint8_t i=0; i<(MEM_BYTES_PER_BLOCK + ISO14443A_CRCA_SIZE); i++)
|
|
Buffer[i] ^= Crypto1Byte();
|
|
27fc: d7 01 movw r26, r14
|
|
27fe: cc 90 ld r12, X
|
|
2800: 73 d6 rcall .+3302 ; 0x34e8 <Crypto1Byte>
|
|
2802: 8c 25 eor r24, r12
|
|
2804: f7 01 movw r30, r14
|
|
2806: 81 93 st Z+, r24
|
|
2808: 7f 01 movw r14, r30
|
|
280a: da 94 dec r13
|
|
* sending the data to be written. Decrypt the data first and
|
|
* check for CRC. Then write the data when ReadOnly mode is not
|
|
* activated. */
|
|
|
|
/* We receive 16 bytes of data to be written and 2 bytes CRCA. Decrypt */
|
|
for (uint8_t i=0; i<(MEM_BYTES_PER_BLOCK + ISO14443A_CRCA_SIZE); i++)
|
|
280c: b9 f7 brne .-18 ; 0x27fc <MifareClassicAppProcess+0x1bc>
|
|
Buffer[i] ^= Crypto1Byte();
|
|
|
|
if (ISO14443ACheckCRCA(Buffer, MEM_BYTES_PER_BLOCK)) {
|
|
280e: 60 e1 ldi r22, 0x10 ; 16
|
|
2810: 70 e0 ldi r23, 0x00 ; 0
|
|
2812: c8 01 movw r24, r16
|
|
2814: e7 d3 rcall .+1998 ; 0x2fe4 <ISO14443ACheckCRCA>
|
|
2816: 88 23 and r24, r24
|
|
2818: 09 f4 brne .+2 ; 0x281c <MifareClassicAppProcess+0x1dc>
|
|
281a: c1 cf rjmp .-126 ; 0x279e <MifareClassicAppProcess+0x15e>
|
|
if (!ActiveConfiguration.ReadOnly) {
|
|
281c: 80 91 fc 20 lds r24, 0x20FC
|
|
2820: 88 23 and r24, r24
|
|
2822: 09 f4 brne .+2 ; 0x2826 <MifareClassicAppProcess+0x1e6>
|
|
2824: e2 c1 rjmp .+964 ; 0x2bea <MifareClassicAppProcess+0x5aa>
|
|
MemoryWriteBlock(Buffer, CurrentAddress * MEM_BYTES_PER_BLOCK, MEM_BYTES_PER_BLOCK);
|
|
} else {
|
|
/* Silently ignore in ReadOnly mode */
|
|
}
|
|
|
|
Buffer[0] = ACK_VALUE ^ Crypto1Nibble();
|
|
2826: a1 d6 rcall .+3394 ; 0x356a <Crypto1Nibble>
|
|
2828: 9a e0 ldi r25, 0x0A ; 10
|
|
282a: 98 27 eor r25, r24
|
|
282c: d8 01 movw r26, r16
|
|
282e: 9c 93 st X, r25
|
|
2830: bb cf rjmp .-138 ; 0x27a8 <MifareClassicAppProcess+0x168>
|
|
return BitCount;
|
|
}
|
|
break;
|
|
|
|
case STATE_READY:
|
|
if (ISO14443AWakeUp(Buffer, &BitCount, CardATQAValue)) {
|
|
2832: 20 91 b6 20 lds r18, 0x20B6
|
|
2836: 90 91 b7 20 lds r25, 0x20B7
|
|
INLINE
|
|
bool ISO14443AWakeUp(void* Buffer, uint16_t* BitCount, uint16_t ATQAValue)
|
|
{
|
|
uint8_t* DataPtr = (uint8_t*) Buffer;
|
|
|
|
if ( (DataPtr[0] == ISO14443A_CMD_REQA) || (DataPtr[0] == ISO14443A_CMD_WUPA) ){
|
|
283a: d8 01 movw r26, r16
|
|
283c: 8c 91 ld r24, X
|
|
283e: 86 32 cpi r24, 0x26 ; 38
|
|
2840: 09 f4 brne .+2 ; 0x2844 <MifareClassicAppProcess+0x204>
|
|
2842: c4 c0 rjmp .+392 ; 0x29cc <MifareClassicAppProcess+0x38c>
|
|
2844: 82 35 cpi r24, 0x52 ; 82
|
|
2846: 09 f4 brne .+2 ; 0x284a <MifareClassicAppProcess+0x20a>
|
|
2848: c1 c0 rjmp .+386 ; 0x29cc <MifareClassicAppProcess+0x38c>
|
|
State = STATE_READY;
|
|
return BitCount;
|
|
} else if (Buffer[0] == ISO14443A_CMD_SELECT_CL1) {
|
|
284a: 83 39 cpi r24, 0x93 ; 147
|
|
284c: 09 f4 brne .+2 ; 0x2850 <MifareClassicAppProcess+0x210>
|
|
284e: 20 c2 rjmp .+1088 ; 0x2c90 <MifareClassicAppProcess+0x650>
|
|
* byte is supposed to be 0. */
|
|
if (Buffer[1] == 0) {
|
|
if (ISO14443ACheckCRCA(Buffer, CMD_HALT_FRAME_SIZE)) {
|
|
/* According to ISO14443, we must not send anything
|
|
* in order to acknowledge the HALT command. */
|
|
State = STATE_HALT;
|
|
2850: 10 92 b5 20 sts 0x20B5, r1
|
|
return ISO14443A_APP_NO_RESPONSE;
|
|
2854: 20 e0 ldi r18, 0x00 ; 0
|
|
2856: 30 e0 ldi r19, 0x00 ; 0
|
|
2858: ac cf rjmp .-168 ; 0x27b2 <MifareClassicAppProcess+0x172>
|
|
|
|
case STATE_AUTHING:
|
|
/* Reader delivers an encrypted nonce. We use it
|
|
* to setup the crypto1 LFSR in nonlinear feedback mode.
|
|
* Furthermore it delivers an encrypted answer. Decrypt and check it */
|
|
Crypto1Auth(&Buffer[0]);
|
|
285a: c8 01 movw r24, r16
|
|
285c: 1c d6 rcall .+3128 ; 0x3496 <Crypto1Auth>
|
|
|
|
for (uint8_t i=0; i<4; i++)
|
|
Buffer[i+4] ^= Crypto1Byte();
|
|
285e: d8 01 movw r26, r16
|
|
2860: 14 96 adiw r26, 0x04 ; 4
|
|
2862: fc 90 ld r15, X
|
|
2864: 41 d6 rcall .+3202 ; 0x34e8 <Crypto1Byte>
|
|
2866: 8f 25 eor r24, r15
|
|
2868: f8 01 movw r30, r16
|
|
286a: 84 83 std Z+4, r24 ; 0x04
|
|
286c: f5 80 ldd r15, Z+5 ; 0x05
|
|
286e: 3c d6 rcall .+3192 ; 0x34e8 <Crypto1Byte>
|
|
2870: 8f 25 eor r24, r15
|
|
2872: d8 01 movw r26, r16
|
|
2874: 15 96 adiw r26, 0x05 ; 5
|
|
2876: 8c 93 st X, r24
|
|
2878: 15 97 sbiw r26, 0x05 ; 5
|
|
287a: 16 96 adiw r26, 0x06 ; 6
|
|
287c: fc 90 ld r15, X
|
|
287e: 34 d6 rcall .+3176 ; 0x34e8 <Crypto1Byte>
|
|
2880: 8f 25 eor r24, r15
|
|
2882: f8 01 movw r30, r16
|
|
2884: 86 83 std Z+6, r24 ; 0x06
|
|
2886: f7 80 ldd r15, Z+7 ; 0x07
|
|
2888: 2f d6 rcall .+3166 ; 0x34e8 <Crypto1Byte>
|
|
288a: 8f 25 eor r24, r15
|
|
288c: d8 01 movw r26, r16
|
|
288e: 17 96 adiw r26, 0x07 ; 7
|
|
2890: 8c 93 st X, r24
|
|
2892: 17 97 sbiw r26, 0x07 ; 7
|
|
|
|
if ((Buffer[4] == ReaderResponse[0]) &&
|
|
2894: 14 96 adiw r26, 0x04 ; 4
|
|
2896: 2c 91 ld r18, X
|
|
2898: 14 97 sbiw r26, 0x04 ; 4
|
|
289a: 90 91 b9 20 lds r25, 0x20B9
|
|
289e: 29 13 cpse r18, r25
|
|
28a0: 1f cf rjmp .-450 ; 0x26e0 <MifareClassicAppProcess+0xa0>
|
|
28a2: 15 96 adiw r26, 0x05 ; 5
|
|
28a4: 2c 91 ld r18, X
|
|
28a6: 15 97 sbiw r26, 0x05 ; 5
|
|
28a8: 90 91 ba 20 lds r25, 0x20BA
|
|
28ac: 29 13 cpse r18, r25
|
|
28ae: 18 cf rjmp .-464 ; 0x26e0 <MifareClassicAppProcess+0xa0>
|
|
(Buffer[5] == ReaderResponse[1]) &&
|
|
28b0: 16 96 adiw r26, 0x06 ; 6
|
|
28b2: 2c 91 ld r18, X
|
|
28b4: 90 91 bb 20 lds r25, 0x20BB
|
|
28b8: 29 13 cpse r18, r25
|
|
28ba: 12 cf rjmp .-476 ; 0x26e0 <MifareClassicAppProcess+0xa0>
|
|
(Buffer[6] == ReaderResponse[2]) &&
|
|
28bc: 90 91 bc 20 lds r25, 0x20BC
|
|
28c0: 89 13 cpse r24, r25
|
|
28c2: 0e cf rjmp .-484 ; 0x26e0 <MifareClassicAppProcess+0xa0>
|
|
(Buffer[7] == ReaderResponse[3])) {
|
|
/* Reader is authenticated. Encrypt the precalculated card response
|
|
* and generate the parity bits. */
|
|
for (uint8_t i=0; i<sizeof(CardResponse); i++) {
|
|
Buffer[i] = CardResponse[i] ^ Crypto1Byte();
|
|
28c4: f0 90 bd 20 lds r15, 0x20BD
|
|
28c8: 0f d6 rcall .+3102 ; 0x34e8 <Crypto1Byte>
|
|
28ca: 8f 25 eor r24, r15
|
|
28cc: f8 01 movw r30, r16
|
|
28ce: 80 83 st Z, r24
|
|
Buffer[ISO14443A_BUFFER_PARITY_OFFSET + i] = ODD_PARITY(CardResponse[i]) ^ Crypto1FilterOutput();
|
|
28d0: f0 90 bd 20 lds r15, 0x20BD
|
|
28d4: 0f 2c mov r0, r15
|
|
28d6: f2 94 swap r15
|
|
28d8: f0 24 eor r15, r0
|
|
28da: 0f 2c mov r0, r15
|
|
28dc: f6 94 lsr r15
|
|
28de: f6 94 lsr r15
|
|
28e0: f0 24 eor r15, r0
|
|
28e2: 05 d4 rcall .+2058 ; 0x30ee <Crypto1FilterOutput>
|
|
28e4: f8 01 movw r30, r16
|
|
28e6: e0 58 subi r30, 0x80 ; 128
|
|
28e8: ff 4f sbci r31, 0xFF ; 255
|
|
28ea: 2f 2d mov r18, r15
|
|
28ec: 30 e0 ldi r19, 0x00 ; 0
|
|
28ee: 2f 5f subi r18, 0xFF ; 255
|
|
28f0: 3f 4f sbci r19, 0xFF ; 255
|
|
28f2: 21 fb bst r18, 1
|
|
28f4: 88 24 eor r8, r8
|
|
28f6: 80 f8 bld r8, 0
|
|
28f8: 91 2c mov r9, r1
|
|
28fa: 31 e0 ldi r19, 0x01 ; 1
|
|
28fc: 83 26 eor r8, r19
|
|
28fe: 88 25 eor r24, r8
|
|
2900: 80 83 st Z, r24
|
|
(Buffer[6] == ReaderResponse[2]) &&
|
|
(Buffer[7] == ReaderResponse[3])) {
|
|
/* Reader is authenticated. Encrypt the precalculated card response
|
|
* and generate the parity bits. */
|
|
for (uint8_t i=0; i<sizeof(CardResponse); i++) {
|
|
Buffer[i] = CardResponse[i] ^ Crypto1Byte();
|
|
2902: f0 90 be 20 lds r15, 0x20BE
|
|
2906: f0 d5 rcall .+3040 ; 0x34e8 <Crypto1Byte>
|
|
2908: 8f 25 eor r24, r15
|
|
290a: d8 01 movw r26, r16
|
|
290c: 11 96 adiw r26, 0x01 ; 1
|
|
290e: 8c 93 st X, r24
|
|
Buffer[ISO14443A_BUFFER_PARITY_OFFSET + i] = ODD_PARITY(CardResponse[i]) ^ Crypto1FilterOutput();
|
|
2910: f0 90 be 20 lds r15, 0x20BE
|
|
2914: 0f 2c mov r0, r15
|
|
2916: f2 94 swap r15
|
|
2918: f0 24 eor r15, r0
|
|
291a: 0f 2c mov r0, r15
|
|
291c: f6 94 lsr r15
|
|
291e: f6 94 lsr r15
|
|
2920: f0 24 eor r15, r0
|
|
2922: e5 d3 rcall .+1994 ; 0x30ee <Crypto1FilterOutput>
|
|
2924: f8 01 movw r30, r16
|
|
2926: ef 57 subi r30, 0x7F ; 127
|
|
2928: ff 4f sbci r31, 0xFF ; 255
|
|
292a: 2f 2d mov r18, r15
|
|
292c: 30 e0 ldi r19, 0x00 ; 0
|
|
292e: 2f 5f subi r18, 0xFF ; 255
|
|
2930: 3f 4f sbci r19, 0xFF ; 255
|
|
2932: 21 fb bst r18, 1
|
|
2934: aa 24 eor r10, r10
|
|
2936: a0 f8 bld r10, 0
|
|
2938: b1 2c mov r11, r1
|
|
293a: b1 e0 ldi r27, 0x01 ; 1
|
|
293c: ab 26 eor r10, r27
|
|
293e: 8a 25 eor r24, r10
|
|
2940: 80 83 st Z, r24
|
|
(Buffer[6] == ReaderResponse[2]) &&
|
|
(Buffer[7] == ReaderResponse[3])) {
|
|
/* Reader is authenticated. Encrypt the precalculated card response
|
|
* and generate the parity bits. */
|
|
for (uint8_t i=0; i<sizeof(CardResponse); i++) {
|
|
Buffer[i] = CardResponse[i] ^ Crypto1Byte();
|
|
2942: f0 90 bf 20 lds r15, 0x20BF
|
|
2946: d0 d5 rcall .+2976 ; 0x34e8 <Crypto1Byte>
|
|
2948: 8f 25 eor r24, r15
|
|
294a: f8 01 movw r30, r16
|
|
294c: 82 83 std Z+2, r24 ; 0x02
|
|
Buffer[ISO14443A_BUFFER_PARITY_OFFSET + i] = ODD_PARITY(CardResponse[i]) ^ Crypto1FilterOutput();
|
|
294e: f0 90 bf 20 lds r15, 0x20BF
|
|
2952: 0f 2c mov r0, r15
|
|
2954: f2 94 swap r15
|
|
2956: f0 24 eor r15, r0
|
|
2958: 0f 2c mov r0, r15
|
|
295a: f6 94 lsr r15
|
|
295c: f6 94 lsr r15
|
|
295e: f0 24 eor r15, r0
|
|
2960: c6 d3 rcall .+1932 ; 0x30ee <Crypto1FilterOutput>
|
|
2962: f8 01 movw r30, r16
|
|
2964: ee 57 subi r30, 0x7E ; 126
|
|
2966: ff 4f sbci r31, 0xFF ; 255
|
|
2968: 2f 2d mov r18, r15
|
|
296a: 30 e0 ldi r19, 0x00 ; 0
|
|
296c: 2f 5f subi r18, 0xFF ; 255
|
|
296e: 3f 4f sbci r19, 0xFF ; 255
|
|
2970: 21 fb bst r18, 1
|
|
2972: cc 24 eor r12, r12
|
|
2974: c0 f8 bld r12, 0
|
|
2976: d1 2c mov r13, r1
|
|
2978: 31 e0 ldi r19, 0x01 ; 1
|
|
297a: c3 26 eor r12, r19
|
|
297c: 8c 25 eor r24, r12
|
|
297e: 80 83 st Z, r24
|
|
(Buffer[6] == ReaderResponse[2]) &&
|
|
(Buffer[7] == ReaderResponse[3])) {
|
|
/* Reader is authenticated. Encrypt the precalculated card response
|
|
* and generate the parity bits. */
|
|
for (uint8_t i=0; i<sizeof(CardResponse); i++) {
|
|
Buffer[i] = CardResponse[i] ^ Crypto1Byte();
|
|
2980: f0 90 c0 20 lds r15, 0x20C0
|
|
2984: b1 d5 rcall .+2914 ; 0x34e8 <Crypto1Byte>
|
|
2986: 8f 25 eor r24, r15
|
|
2988: d8 01 movw r26, r16
|
|
298a: 13 96 adiw r26, 0x03 ; 3
|
|
298c: 8c 93 st X, r24
|
|
Buffer[ISO14443A_BUFFER_PARITY_OFFSET + i] = ODD_PARITY(CardResponse[i]) ^ Crypto1FilterOutput();
|
|
298e: f0 90 c0 20 lds r15, 0x20C0
|
|
2992: 0f 2c mov r0, r15
|
|
2994: f2 94 swap r15
|
|
2996: f0 24 eor r15, r0
|
|
2998: 0f 2c mov r0, r15
|
|
299a: f6 94 lsr r15
|
|
299c: f6 94 lsr r15
|
|
299e: f0 24 eor r15, r0
|
|
29a0: a6 d3 rcall .+1868 ; 0x30ee <Crypto1FilterOutput>
|
|
29a2: f8 01 movw r30, r16
|
|
29a4: ed 57 subi r30, 0x7D ; 125
|
|
29a6: ff 4f sbci r31, 0xFF ; 255
|
|
29a8: 2f 2d mov r18, r15
|
|
29aa: 30 e0 ldi r19, 0x00 ; 0
|
|
29ac: 2f 5f subi r18, 0xFF ; 255
|
|
29ae: 3f 4f sbci r19, 0xFF ; 255
|
|
29b0: 21 fb bst r18, 1
|
|
29b2: 66 24 eor r6, r6
|
|
29b4: 60 f8 bld r6, 0
|
|
29b6: 71 2c mov r7, r1
|
|
29b8: b1 e0 ldi r27, 0x01 ; 1
|
|
29ba: 6b 26 eor r6, r27
|
|
29bc: 86 25 eor r24, r6
|
|
29be: 80 83 st Z, r24
|
|
}
|
|
|
|
State = STATE_AUTHED_IDLE;
|
|
29c0: 85 e0 ldi r24, 0x05 ; 5
|
|
29c2: 80 93 b5 20 sts 0x20B5, r24
|
|
|
|
return (CMD_AUTH_BA_FRAME_SIZE * BITS_PER_BYTE) | ISO14443A_APP_CUSTOM_PARITY;
|
|
29c6: 20 e2 ldi r18, 0x20 ; 32
|
|
29c8: 30 e1 ldi r19, 0x10 ; 16
|
|
29ca: f3 ce rjmp .-538 ; 0x27b2 <MifareClassicAppProcess+0x172>
|
|
DataPtr[0] = (ATQAValue >> 0) & 0x00FF;
|
|
29cc: f8 01 movw r30, r16
|
|
29ce: 20 83 st Z, r18
|
|
DataPtr[1] = (ATQAValue >> 8) & 0x00FF;
|
|
29d0: 91 83 std Z+1, r25 ; 0x01
|
|
}
|
|
break;
|
|
|
|
case STATE_READY:
|
|
if (ISO14443AWakeUp(Buffer, &BitCount, CardATQAValue)) {
|
|
State = STATE_READY;
|
|
29d2: 82 e0 ldi r24, 0x02 ; 2
|
|
29d4: 80 93 b5 20 sts 0x20B5, r24
|
|
|
|
*BitCount = ISO14443A_ATQA_FRAME_SIZE;
|
|
29d8: 20 e1 ldi r18, 0x10 ; 16
|
|
29da: 30 e0 ldi r19, 0x00 ; 0
|
|
return BitCount;
|
|
29dc: ea ce rjmp .-556 ; 0x27b2 <MifareClassicAppProcess+0x172>
|
|
bool ISO14443AWakeUp(void* Buffer, uint16_t* BitCount, uint16_t ATQAValue)
|
|
{
|
|
uint8_t* DataPtr = (uint8_t*) Buffer;
|
|
|
|
if ( (DataPtr[0] == ISO14443A_CMD_REQA) || (DataPtr[0] == ISO14443A_CMD_WUPA) ){
|
|
DataPtr[0] = (ATQAValue >> 0) & 0x00FF;
|
|
29de: 84 e0 ldi r24, 0x04 ; 4
|
|
29e0: d8 01 movw r26, r16
|
|
29e2: 8c 93 st X, r24
|
|
DataPtr[1] = (ATQAValue >> 8) & 0x00FF;
|
|
29e4: 11 96 adiw r26, 0x01 ; 1
|
|
29e6: 1c 92 st X, r1
|
|
}
|
|
break;
|
|
|
|
case STATE_ACTIVE:
|
|
if (ISO14443AWakeUp(Buffer, &BitCount, MFCLASSIC_1K_ATQA_VALUE)) {
|
|
State = STATE_READY;
|
|
29e8: 82 e0 ldi r24, 0x02 ; 2
|
|
29ea: 80 93 b5 20 sts 0x20B5, r24
|
|
|
|
*BitCount = ISO14443A_ATQA_FRAME_SIZE;
|
|
29ee: 20 e1 ldi r18, 0x10 ; 16
|
|
29f0: 30 e0 ldi r19, 0x00 ; 0
|
|
return BitCount;
|
|
29f2: df ce rjmp .-578 ; 0x27b2 <MifareClassicAppProcess+0x172>
|
|
} else if (Buffer[0] == CMD_HALT) {
|
|
/* Halts the tag. According to the ISO14443, the second
|
|
* byte is supposed to be 0. */
|
|
if (Buffer[1] == 0) {
|
|
29f4: f8 01 movw r30, r16
|
|
29f6: 81 81 ldd r24, Z+1 ; 0x01
|
|
29f8: 88 23 and r24, r24
|
|
29fa: 09 f4 brne .+2 ; 0x29fe <MifareClassicAppProcess+0x3be>
|
|
29fc: 7c c2 rjmp .+1272 ; 0x2ef6 <MifareClassicAppProcess+0x8b6>
|
|
} else {
|
|
Buffer[0] = NAK_CRC_ERROR;
|
|
return ACK_NAK_FRAME_SIZE;
|
|
}
|
|
} else {
|
|
Buffer[0] = NAK_INVALID_ARG;
|
|
29fe: f8 01 movw r30, r16
|
|
2a00: 10 82 st Z, r1
|
|
return ACK_NAK_FRAME_SIZE;
|
|
2a02: 24 e0 ldi r18, 0x04 ; 4
|
|
2a04: 30 e0 ldi r19, 0x00 ; 0
|
|
2a06: d5 ce rjmp .-598 ; 0x27b2 <MifareClassicAppProcess+0x172>
|
|
Buffer[0] = NAK_CRC_ERROR ^ Crypto1Nibble();
|
|
}
|
|
|
|
return ACK_NAK_FRAME_SIZE;
|
|
} else if ( (Buffer[0] == CMD_AUTH_A) || (Buffer[0] == CMD_AUTH_B) ) {
|
|
if (ISO14443ACheckCRCA(Buffer, CMD_AUTH_FRAME_SIZE)) {
|
|
2a08: 62 e0 ldi r22, 0x02 ; 2
|
|
2a0a: 70 e0 ldi r23, 0x00 ; 0
|
|
2a0c: c8 01 movw r24, r16
|
|
2a0e: ea d2 rcall .+1492 ; 0x2fe4 <ISO14443ACheckCRCA>
|
|
2a10: 88 23 and r24, r24
|
|
2a12: 09 f4 brne .+2 ; 0x2a16 <MifareClassicAppProcess+0x3d6>
|
|
2a14: f6 c0 rjmp .+492 ; 0x2c02 <MifareClassicAppProcess+0x5c2>
|
|
/* Nested authentication. */
|
|
uint8_t SectorAddress = Buffer[1] & MEM_SECTOR_ADDR_MASK;
|
|
2a16: f8 01 movw r30, r16
|
|
2a18: 81 81 ldd r24, Z+1 ; 0x01
|
|
2a1a: 8c 73 andi r24, 0x3C ; 60
|
|
uint8_t KeyOffset = (Buffer[0] == CMD_AUTH_A ? MEM_KEY_A_OFFSET : MEM_KEY_B_OFFSET);
|
|
2a1c: 90 81 ld r25, Z
|
|
2a1e: 90 36 cpi r25, 0x60 ; 96
|
|
2a20: 09 f4 brne .+2 ; 0x2a24 <MifareClassicAppProcess+0x3e4>
|
|
2a22: 85 c2 rjmp .+1290 ; 0x2f2e <MifareClassicAppProcess+0x8ee>
|
|
2a24: 6a e3 ldi r22, 0x3A ; 58
|
|
2a26: 70 e0 ldi r23, 0x00 ; 0
|
|
uint16_t KeyAddress = (uint16_t) SectorAddress * MEM_BYTES_PER_BLOCK + KeyOffset;
|
|
2a28: 7b 01 movw r14, r22
|
|
2a2a: f0 e1 ldi r31, 0x10 ; 16
|
|
2a2c: 8f 9f mul r24, r31
|
|
2a2e: e0 0c add r14, r0
|
|
2a30: f1 1c adc r15, r1
|
|
2a32: 11 24 eor r1, r1
|
|
uint8_t Key[6];
|
|
uint8_t Uid[4];
|
|
uint8_t CardNonce[4];
|
|
|
|
/* Generate a random nonce and read UID and key from memory */
|
|
RandomGetBuffer(CardNonce, sizeof(CardNonce));
|
|
2a34: 64 e0 ldi r22, 0x04 ; 4
|
|
2a36: ce 01 movw r24, r28
|
|
2a38: 07 96 adiw r24, 0x07 ; 7
|
|
2a3a: 0e 94 df 04 call 0x9be ; 0x9be <RandomGetBuffer>
|
|
MemoryReadBlock(Uid, MEM_UID_CL1_ADDRESS, MEM_UID_CL1_SIZE);
|
|
2a3e: 44 e0 ldi r20, 0x04 ; 4
|
|
2a40: 50 e0 ldi r21, 0x00 ; 0
|
|
2a42: 60 e0 ldi r22, 0x00 ; 0
|
|
2a44: 70 e0 ldi r23, 0x00 ; 0
|
|
2a46: ce 01 movw r24, r28
|
|
2a48: 0b 96 adiw r24, 0x0b ; 11
|
|
2a4a: 0e 94 fc 05 call 0xbf8 ; 0xbf8 <MemoryReadBlock>
|
|
MemoryReadBlock(Key, KeyAddress, MEM_KEY_SIZE);
|
|
2a4e: 46 e0 ldi r20, 0x06 ; 6
|
|
2a50: 50 e0 ldi r21, 0x00 ; 0
|
|
2a52: b7 01 movw r22, r14
|
|
2a54: ce 01 movw r24, r28
|
|
2a56: 01 96 adiw r24, 0x01 ; 1
|
|
2a58: 0e 94 fc 05 call 0xbf8 ; 0xbf8 <MemoryReadBlock>
|
|
|
|
/* Precalculate the reader response from card-nonce */
|
|
for (uint8_t i=0; i<sizeof(ReaderResponse); i++)
|
|
ReaderResponse[i] = CardNonce[i];
|
|
2a5c: 8f 81 ldd r24, Y+7 ; 0x07
|
|
2a5e: 80 93 b9 20 sts 0x20B9, r24
|
|
2a62: 88 85 ldd r24, Y+8 ; 0x08
|
|
2a64: 80 93 ba 20 sts 0x20BA, r24
|
|
2a68: 89 85 ldd r24, Y+9 ; 0x09
|
|
2a6a: 80 93 bb 20 sts 0x20BB, r24
|
|
2a6e: 8a 85 ldd r24, Y+10 ; 0x0a
|
|
2a70: 80 93 bc 20 sts 0x20BC, r24
|
|
|
|
Crypto1PRNG(ReaderResponse, 64);
|
|
2a74: 60 e4 ldi r22, 0x40 ; 64
|
|
2a76: 70 e0 ldi r23, 0x00 ; 0
|
|
2a78: 89 eb ldi r24, 0xB9 ; 185
|
|
2a7a: 90 e2 ldi r25, 0x20 ; 32
|
|
2a7c: 9a d5 rcall .+2868 ; 0x35b2 <Crypto1PRNG>
|
|
|
|
/* Precalculate our response from the reader response */
|
|
for (uint8_t i=0; i<sizeof(CardResponse); i++)
|
|
CardResponse[i] = ReaderResponse[i];
|
|
2a7e: 80 91 b9 20 lds r24, 0x20B9
|
|
2a82: 80 93 bd 20 sts 0x20BD, r24
|
|
2a86: 80 91 ba 20 lds r24, 0x20BA
|
|
2a8a: 80 93 be 20 sts 0x20BE, r24
|
|
2a8e: 80 91 bb 20 lds r24, 0x20BB
|
|
2a92: 80 93 bf 20 sts 0x20BF, r24
|
|
2a96: 80 91 bc 20 lds r24, 0x20BC
|
|
2a9a: 80 93 c0 20 sts 0x20C0, r24
|
|
|
|
Crypto1PRNG(CardResponse, 32);
|
|
2a9e: 60 e2 ldi r22, 0x20 ; 32
|
|
2aa0: 70 e0 ldi r23, 0x00 ; 0
|
|
2aa2: 8d eb ldi r24, 0xBD ; 189
|
|
2aa4: 90 e2 ldi r25, 0x20 ; 32
|
|
2aa6: 85 d5 rcall .+2826 ; 0x35b2 <Crypto1PRNG>
|
|
|
|
/* Setup crypto1 cipher. */
|
|
Crypto1Setup(Key, Uid, CardNonce);
|
|
2aa8: ae 01 movw r20, r28
|
|
2aaa: 49 5f subi r20, 0xF9 ; 249
|
|
2aac: 5f 4f sbci r21, 0xFF ; 255
|
|
2aae: be 01 movw r22, r28
|
|
2ab0: 65 5f subi r22, 0xF5 ; 245
|
|
2ab2: 7f 4f sbci r23, 0xFF ; 255
|
|
2ab4: ce 01 movw r24, r28
|
|
2ab6: 01 96 adiw r24, 0x01 ; 1
|
|
2ab8: 4e d3 rcall .+1692 ; 0x3156 <Crypto1Setup>
|
|
|
|
for (uint8_t i=0; i<sizeof(CardNonce); i++)
|
|
Buffer[i] = CardNonce[i];
|
|
2aba: 8f 81 ldd r24, Y+7 ; 0x07
|
|
2abc: d8 01 movw r26, r16
|
|
2abe: 8c 93 st X, r24
|
|
2ac0: 88 85 ldd r24, Y+8 ; 0x08
|
|
2ac2: 11 96 adiw r26, 0x01 ; 1
|
|
2ac4: 8c 93 st X, r24
|
|
2ac6: 11 97 sbiw r26, 0x01 ; 1
|
|
2ac8: 89 85 ldd r24, Y+9 ; 0x09
|
|
2aca: 12 96 adiw r26, 0x02 ; 2
|
|
2acc: 8c 93 st X, r24
|
|
2ace: 12 97 sbiw r26, 0x02 ; 2
|
|
2ad0: 8a 85 ldd r24, Y+10 ; 0x0a
|
|
2ad2: 13 96 adiw r26, 0x03 ; 3
|
|
2ad4: 8c 93 st X, r24
|
|
|
|
/* Respond with the encrypted random card nonce and expect further authentication
|
|
* form the reader in the next frame. */
|
|
State = STATE_AUTHING;
|
|
2ad6: 84 e0 ldi r24, 0x04 ; 4
|
|
2ad8: 80 93 b5 20 sts 0x20B5, r24
|
|
|
|
return CMD_AUTH_RB_FRAME_SIZE * BITS_PER_BYTE;
|
|
2adc: 20 e2 ldi r18, 0x20 ; 32
|
|
2ade: 30 e0 ldi r19, 0x00 ; 0
|
|
2ae0: 68 ce rjmp .-816 ; 0x27b2 <MifareClassicAppProcess+0x172>
|
|
} else {
|
|
Buffer[0] = NAK_INVALID_ARG;
|
|
return ACK_NAK_FRAME_SIZE;
|
|
}
|
|
} else if ( (Buffer[0] == CMD_AUTH_A) || (Buffer[0] == CMD_AUTH_B)) {
|
|
if (ISO14443ACheckCRCA(Buffer, CMD_AUTH_FRAME_SIZE)) {
|
|
2ae2: 62 e0 ldi r22, 0x02 ; 2
|
|
2ae4: 70 e0 ldi r23, 0x00 ; 0
|
|
2ae6: c8 01 movw r24, r16
|
|
2ae8: 7d d2 rcall .+1274 ; 0x2fe4 <ISO14443ACheckCRCA>
|
|
2aea: 88 23 and r24, r24
|
|
2aec: 09 f4 brne .+2 ; 0x2af0 <MifareClassicAppProcess+0x4b0>
|
|
2aee: 09 c2 rjmp .+1042 ; 0x2f02 <MifareClassicAppProcess+0x8c2>
|
|
uint8_t SectorAddress = Buffer[1] & MEM_SECTOR_ADDR_MASK;
|
|
2af0: d8 01 movw r26, r16
|
|
2af2: 11 96 adiw r26, 0x01 ; 1
|
|
2af4: 2c 91 ld r18, X
|
|
2af6: 11 97 sbiw r26, 0x01 ; 1
|
|
2af8: 2c 73 andi r18, 0x3C ; 60
|
|
uint8_t KeyOffset = (Buffer[0] == CMD_AUTH_A ? MEM_KEY_A_OFFSET : MEM_KEY_B_OFFSET);
|
|
2afa: 8c 91 ld r24, X
|
|
2afc: 80 36 cpi r24, 0x60 ; 96
|
|
2afe: 09 f4 brne .+2 ; 0x2b02 <MifareClassicAppProcess+0x4c2>
|
|
2b00: 19 c2 rjmp .+1074 ; 0x2f34 <MifareClassicAppProcess+0x8f4>
|
|
2b02: 8a e3 ldi r24, 0x3A ; 58
|
|
2b04: 90 e0 ldi r25, 0x00 ; 0
|
|
uint16_t KeyAddress = (uint16_t) SectorAddress * MEM_BYTES_PER_BLOCK + KeyOffset;
|
|
2b06: 7c 01 movw r14, r24
|
|
2b08: b0 e1 ldi r27, 0x10 ; 16
|
|
2b0a: 2b 9f mul r18, r27
|
|
2b0c: e0 0c add r14, r0
|
|
2b0e: f1 1c adc r15, r1
|
|
2b10: 11 24 eor r1, r1
|
|
uint8_t Key[6];
|
|
uint8_t Uid[4];
|
|
uint8_t CardNonce[4];
|
|
|
|
/* Generate a random nonce and read UID and key from memory */
|
|
RandomGetBuffer(CardNonce, sizeof(CardNonce));
|
|
2b12: 64 e0 ldi r22, 0x04 ; 4
|
|
2b14: ce 01 movw r24, r28
|
|
2b16: 07 96 adiw r24, 0x07 ; 7
|
|
2b18: 0e 94 df 04 call 0x9be ; 0x9be <RandomGetBuffer>
|
|
MemoryReadBlock(Uid, MEM_UID_CL1_ADDRESS, MEM_UID_CL1_SIZE);
|
|
2b1c: 44 e0 ldi r20, 0x04 ; 4
|
|
2b1e: 50 e0 ldi r21, 0x00 ; 0
|
|
2b20: 60 e0 ldi r22, 0x00 ; 0
|
|
2b22: 70 e0 ldi r23, 0x00 ; 0
|
|
2b24: ce 01 movw r24, r28
|
|
2b26: 0b 96 adiw r24, 0x0b ; 11
|
|
2b28: 0e 94 fc 05 call 0xbf8 ; 0xbf8 <MemoryReadBlock>
|
|
MemoryReadBlock(Key, KeyAddress, MEM_KEY_SIZE);
|
|
2b2c: 46 e0 ldi r20, 0x06 ; 6
|
|
2b2e: 50 e0 ldi r21, 0x00 ; 0
|
|
2b30: b7 01 movw r22, r14
|
|
2b32: ce 01 movw r24, r28
|
|
2b34: 01 96 adiw r24, 0x01 ; 1
|
|
2b36: 0e 94 fc 05 call 0xbf8 ; 0xbf8 <MemoryReadBlock>
|
|
|
|
/* Precalculate the reader response from card-nonce */
|
|
for (uint8_t i=0; i<sizeof(ReaderResponse); i++)
|
|
ReaderResponse[i] = CardNonce[i];
|
|
2b3a: 8f 81 ldd r24, Y+7 ; 0x07
|
|
2b3c: 80 93 b9 20 sts 0x20B9, r24
|
|
2b40: 88 85 ldd r24, Y+8 ; 0x08
|
|
2b42: 80 93 ba 20 sts 0x20BA, r24
|
|
2b46: 89 85 ldd r24, Y+9 ; 0x09
|
|
2b48: 80 93 bb 20 sts 0x20BB, r24
|
|
2b4c: 8a 85 ldd r24, Y+10 ; 0x0a
|
|
2b4e: 80 93 bc 20 sts 0x20BC, r24
|
|
|
|
Crypto1PRNG(ReaderResponse, 64);
|
|
2b52: 60 e4 ldi r22, 0x40 ; 64
|
|
2b54: 70 e0 ldi r23, 0x00 ; 0
|
|
2b56: 89 eb ldi r24, 0xB9 ; 185
|
|
2b58: 90 e2 ldi r25, 0x20 ; 32
|
|
2b5a: 2b d5 rcall .+2646 ; 0x35b2 <Crypto1PRNG>
|
|
|
|
/* Precalculate our response from the reader response */
|
|
for (uint8_t i=0; i<sizeof(CardResponse); i++)
|
|
CardResponse[i] = ReaderResponse[i];
|
|
2b5c: 80 91 b9 20 lds r24, 0x20B9
|
|
2b60: 80 93 bd 20 sts 0x20BD, r24
|
|
2b64: 80 91 ba 20 lds r24, 0x20BA
|
|
2b68: 80 93 be 20 sts 0x20BE, r24
|
|
2b6c: 80 91 bb 20 lds r24, 0x20BB
|
|
2b70: 80 93 bf 20 sts 0x20BF, r24
|
|
2b74: 80 91 bc 20 lds r24, 0x20BC
|
|
2b78: 80 93 c0 20 sts 0x20C0, r24
|
|
|
|
Crypto1PRNG(CardResponse, 32);
|
|
2b7c: 60 e2 ldi r22, 0x20 ; 32
|
|
2b7e: 70 e0 ldi r23, 0x00 ; 0
|
|
2b80: 8d eb ldi r24, 0xBD ; 189
|
|
2b82: 90 e2 ldi r25, 0x20 ; 32
|
|
2b84: 16 d5 rcall .+2604 ; 0x35b2 <Crypto1PRNG>
|
|
|
|
/* Respond with the random card nonce and expect further authentication
|
|
* form the reader in the next frame. */
|
|
State = STATE_AUTHING;
|
|
2b86: 84 e0 ldi r24, 0x04 ; 4
|
|
2b88: 80 93 b5 20 sts 0x20B5, r24
|
|
|
|
for (uint8_t i=0; i<sizeof(CardNonce); i++)
|
|
Buffer[i] = CardNonce[i];
|
|
2b8c: 8f 81 ldd r24, Y+7 ; 0x07
|
|
2b8e: f8 01 movw r30, r16
|
|
2b90: 80 83 st Z, r24
|
|
2b92: 88 85 ldd r24, Y+8 ; 0x08
|
|
2b94: 81 83 std Z+1, r24 ; 0x01
|
|
2b96: 89 85 ldd r24, Y+9 ; 0x09
|
|
2b98: 82 83 std Z+2, r24 ; 0x02
|
|
2b9a: 8a 85 ldd r24, Y+10 ; 0x0a
|
|
2b9c: 83 83 std Z+3, r24 ; 0x03
|
|
|
|
/* Setup crypto1 cipher. Discard in-place encrypted CardNonce. */
|
|
Crypto1Setup(Key, Uid, CardNonce);
|
|
2b9e: ae 01 movw r20, r28
|
|
2ba0: 49 5f subi r20, 0xF9 ; 249
|
|
2ba2: 5f 4f sbci r21, 0xFF ; 255
|
|
2ba4: be 01 movw r22, r28
|
|
2ba6: 65 5f subi r22, 0xF5 ; 245
|
|
2ba8: 7f 4f sbci r23, 0xFF ; 255
|
|
2baa: ce 01 movw r24, r28
|
|
2bac: 01 96 adiw r24, 0x01 ; 1
|
|
2bae: d3 d2 rcall .+1446 ; 0x3156 <Crypto1Setup>
|
|
|
|
return CMD_AUTH_RB_FRAME_SIZE * BITS_PER_BYTE;
|
|
2bb0: 20 e2 ldi r18, 0x20 ; 32
|
|
2bb2: 30 e0 ldi r19, 0x00 ; 0
|
|
2bb4: fe cd rjmp .-1028 ; 0x27b2 <MifareClassicAppProcess+0x172>
|
|
* the block back into the global block buffer. */
|
|
for (uint8_t i=0; i<(MEM_VALUE_SIZE + ISO14443A_CRCA_SIZE); i++)
|
|
Buffer[i] ^= Crypto1Byte();
|
|
|
|
if (ISO14443ACheckCRCA(Buffer, MEM_VALUE_SIZE )) {
|
|
MemoryReadBlock(BlockBuffer, (uint16_t) CurrentAddress * MEM_BYTES_PER_BLOCK, MEM_BYTES_PER_BLOCK);
|
|
2bb6: 60 91 c1 20 lds r22, 0x20C1
|
|
2bba: b0 e1 ldi r27, 0x10 ; 16
|
|
2bbc: 6b 9f mul r22, r27
|
|
2bbe: b0 01 movw r22, r0
|
|
2bc0: 11 24 eor r1, r1
|
|
2bc2: 40 e1 ldi r20, 0x10 ; 16
|
|
2bc4: 50 e0 ldi r21, 0x00 ; 0
|
|
2bc6: 82 ec ldi r24, 0xC2 ; 194
|
|
2bc8: 90 e2 ldi r25, 0x20 ; 32
|
|
2bca: 0e 94 fc 05 call 0xbf8 ; 0xbf8 <MemoryReadBlock>
|
|
|
|
INLINE bool CheckValueIntegrity(uint8_t* Block)
|
|
{
|
|
/* Value Blocks contain a value stored three times, with
|
|
* the middle portion inverted. */
|
|
if ( (Block[0] == (uint8_t) ~Block[4]) && (Block[0] == Block[8])
|
|
2bce: 20 91 c2 20 lds r18, 0x20C2
|
|
2bd2: 80 91 c6 20 lds r24, 0x20C6
|
|
2bd6: 80 95 com r24
|
|
2bd8: 28 17 cp r18, r24
|
|
2bda: 09 f4 brne .+2 ; 0x2bde <MifareClassicAppProcess+0x59e>
|
|
2bdc: c4 c0 rjmp .+392 ; 0x2d66 <MifareClassicAppProcess+0x726>
|
|
State = STATE_AUTHED_IDLE;
|
|
/* No ACK response on value commands part 2 */
|
|
return ISO14443A_APP_NO_RESPONSE;
|
|
} else {
|
|
/* Not sure if this is the correct error code.. */
|
|
Buffer[0] = NAK_OTHER_ERROR ^ Crypto1Nibble();
|
|
2bde: c5 d4 rcall .+2442 ; 0x356a <Crypto1Nibble>
|
|
2be0: 96 e0 ldi r25, 0x06 ; 6
|
|
2be2: 98 27 eor r25, r24
|
|
2be4: d8 01 movw r26, r16
|
|
2be6: 9c 93 st X, r25
|
|
2be8: df cd rjmp .-1090 ; 0x27a8 <MifareClassicAppProcess+0x168>
|
|
for (uint8_t i=0; i<(MEM_BYTES_PER_BLOCK + ISO14443A_CRCA_SIZE); i++)
|
|
Buffer[i] ^= Crypto1Byte();
|
|
|
|
if (ISO14443ACheckCRCA(Buffer, MEM_BYTES_PER_BLOCK)) {
|
|
if (!ActiveConfiguration.ReadOnly) {
|
|
MemoryWriteBlock(Buffer, CurrentAddress * MEM_BYTES_PER_BLOCK, MEM_BYTES_PER_BLOCK);
|
|
2bea: 60 91 c1 20 lds r22, 0x20C1
|
|
2bee: f0 e1 ldi r31, 0x10 ; 16
|
|
2bf0: 6f 9f mul r22, r31
|
|
2bf2: b0 01 movw r22, r0
|
|
2bf4: 11 24 eor r1, r1
|
|
2bf6: 40 e1 ldi r20, 0x10 ; 16
|
|
2bf8: 50 e0 ldi r21, 0x00 ; 0
|
|
2bfa: c8 01 movw r24, r16
|
|
2bfc: 0e 94 81 06 call 0xd02 ; 0xd02 <MemoryWriteBlock>
|
|
2c00: 12 ce rjmp .-988 ; 0x2826 <MifareClassicAppProcess+0x1e6>
|
|
* form the reader in the next frame. */
|
|
State = STATE_AUTHING;
|
|
|
|
return CMD_AUTH_RB_FRAME_SIZE * BITS_PER_BYTE;
|
|
} else {
|
|
Buffer[0] = NAK_CRC_ERROR ^ Crypto1Nibble();
|
|
2c02: b3 d4 rcall .+2406 ; 0x356a <Crypto1Nibble>
|
|
2c04: 91 e0 ldi r25, 0x01 ; 1
|
|
2c06: 98 27 eor r25, r24
|
|
2c08: f8 01 movw r30, r16
|
|
2c0a: 90 83 st Z, r25
|
|
return ACK_NAK_FRAME_SIZE;
|
|
2c0c: 24 e0 ldi r18, 0x04 ; 4
|
|
2c0e: 30 e0 ldi r19, 0x00 ; 0
|
|
2c10: d0 cd rjmp .-1120 ; 0x27b2 <MifareClassicAppProcess+0x172>
|
|
* the incoming data. */
|
|
for (uint8_t i=0; i<4; i++)
|
|
Buffer[i] ^= Crypto1Byte();
|
|
|
|
if (Buffer[0] == CMD_READ) {
|
|
if (ISO14443ACheckCRCA(Buffer, CMD_READ_FRAME_SIZE)) {
|
|
2c12: 62 e0 ldi r22, 0x02 ; 2
|
|
2c14: 70 e0 ldi r23, 0x00 ; 0
|
|
2c16: c8 01 movw r24, r16
|
|
2c18: e5 d1 rcall .+970 ; 0x2fe4 <ISO14443ACheckCRCA>
|
|
2c1a: 88 23 and r24, r24
|
|
2c1c: 91 f3 breq .-28 ; 0x2c02 <MifareClassicAppProcess+0x5c2>
|
|
/* Read command. Read data from memory and append CRCA. */
|
|
MemoryReadBlock(Buffer, (uint16_t) Buffer[1] * MEM_BYTES_PER_BLOCK, MEM_BYTES_PER_BLOCK);
|
|
2c1e: d8 01 movw r26, r16
|
|
2c20: 11 96 adiw r26, 0x01 ; 1
|
|
2c22: 6c 91 ld r22, X
|
|
2c24: b0 e1 ldi r27, 0x10 ; 16
|
|
2c26: 6b 9f mul r22, r27
|
|
2c28: b0 01 movw r22, r0
|
|
2c2a: 11 24 eor r1, r1
|
|
2c2c: 40 e1 ldi r20, 0x10 ; 16
|
|
2c2e: 50 e0 ldi r21, 0x00 ; 0
|
|
2c30: c8 01 movw r24, r16
|
|
2c32: 0e 94 fc 05 call 0xbf8 ; 0xbf8 <MemoryReadBlock>
|
|
ISO14443AAppendCRCA(Buffer, MEM_BYTES_PER_BLOCK);
|
|
2c36: 60 e1 ldi r22, 0x10 ; 16
|
|
2c38: 70 e0 ldi r23, 0x00 ; 0
|
|
2c3a: c8 01 movw r24, r16
|
|
2c3c: a4 d1 rcall .+840 ; 0x2f86 <ISO14443AAppendCRCA>
|
|
void MifareClassicAppTask(void)
|
|
{
|
|
|
|
}
|
|
|
|
uint16_t MifareClassicAppProcess(uint8_t* Buffer, uint16_t BitCount)
|
|
2c3e: 68 01 movw r12, r16
|
|
2c40: e0 e8 ldi r30, 0x80 ; 128
|
|
2c42: ce 0e add r12, r30
|
|
2c44: d1 1c adc r13, r1
|
|
/* Read command. Read data from memory and append CRCA. */
|
|
MemoryReadBlock(Buffer, (uint16_t) Buffer[1] * MEM_BYTES_PER_BLOCK, MEM_BYTES_PER_BLOCK);
|
|
ISO14443AAppendCRCA(Buffer, MEM_BYTES_PER_BLOCK);
|
|
|
|
/* Encrypt and calculate parity bits. */
|
|
for (uint8_t i=0; i<(ISO14443A_CRCA_SIZE + MEM_BYTES_PER_BLOCK); i++) {
|
|
2c46: a1 2c mov r10, r1
|
|
uint8_t Plain = Buffer[i];
|
|
2c48: d8 01 movw r26, r16
|
|
2c4a: bc 90 ld r11, X
|
|
Buffer[i] = Plain ^ Crypto1Byte();
|
|
2c4c: 4d d4 rcall .+2202 ; 0x34e8 <Crypto1Byte>
|
|
2c4e: 8b 25 eor r24, r11
|
|
2c50: f8 01 movw r30, r16
|
|
2c52: 81 93 st Z+, r24
|
|
2c54: 8f 01 movw r16, r30
|
|
Buffer[ISO14443A_BUFFER_PARITY_OFFSET + i] = ODD_PARITY(Plain) ^ Crypto1FilterOutput();
|
|
2c56: 0b 2c mov r0, r11
|
|
2c58: b2 94 swap r11
|
|
2c5a: b0 24 eor r11, r0
|
|
2c5c: 0b 2c mov r0, r11
|
|
2c5e: b6 94 lsr r11
|
|
2c60: b6 94 lsr r11
|
|
2c62: b0 24 eor r11, r0
|
|
2c64: 44 d2 rcall .+1160 ; 0x30ee <Crypto1FilterOutput>
|
|
2c66: 2b 2d mov r18, r11
|
|
2c68: 30 e0 ldi r19, 0x00 ; 0
|
|
2c6a: 2f 5f subi r18, 0xFF ; 255
|
|
2c6c: 3f 4f sbci r19, 0xFF ; 255
|
|
2c6e: 21 fb bst r18, 1
|
|
2c70: ee 24 eor r14, r14
|
|
2c72: e0 f8 bld r14, 0
|
|
2c74: f1 2c mov r15, r1
|
|
2c76: f1 e0 ldi r31, 0x01 ; 1
|
|
2c78: ef 26 eor r14, r31
|
|
2c7a: 8e 25 eor r24, r14
|
|
2c7c: d6 01 movw r26, r12
|
|
2c7e: 8d 93 st X+, r24
|
|
2c80: 6d 01 movw r12, r26
|
|
/* Read command. Read data from memory and append CRCA. */
|
|
MemoryReadBlock(Buffer, (uint16_t) Buffer[1] * MEM_BYTES_PER_BLOCK, MEM_BYTES_PER_BLOCK);
|
|
ISO14443AAppendCRCA(Buffer, MEM_BYTES_PER_BLOCK);
|
|
|
|
/* Encrypt and calculate parity bits. */
|
|
for (uint8_t i=0; i<(ISO14443A_CRCA_SIZE + MEM_BYTES_PER_BLOCK); i++) {
|
|
2c82: a3 94 inc r10
|
|
2c84: b2 e1 ldi r27, 0x12 ; 18
|
|
2c86: ab 12 cpse r10, r27
|
|
2c88: df cf rjmp .-66 ; 0x2c48 <MifareClassicAppProcess+0x608>
|
|
uint8_t Plain = Buffer[i];
|
|
Buffer[i] = Plain ^ Crypto1Byte();
|
|
Buffer[ISO14443A_BUFFER_PARITY_OFFSET + i] = ODD_PARITY(Plain) ^ Crypto1FilterOutput();
|
|
}
|
|
|
|
return ( (CMD_READ_RESPONSE_FRAME_SIZE + ISO14443A_CRCA_SIZE )
|
|
2c8a: 20 e9 ldi r18, 0x90 ; 144
|
|
2c8c: 30 e1 ldi r19, 0x10 ; 16
|
|
2c8e: 91 cd rjmp .-1246 ; 0x27b2 <MifareClassicAppProcess+0x172>
|
|
State = STATE_READY;
|
|
return BitCount;
|
|
} else if (Buffer[0] == ISO14443A_CMD_SELECT_CL1) {
|
|
/* Load UID CL1 and perform anticollision */
|
|
uint8_t UidCL1[4];
|
|
MemoryReadBlock(UidCL1, MEM_UID_CL1_ADDRESS, MEM_UID_CL1_SIZE);
|
|
2c90: 44 e0 ldi r20, 0x04 ; 4
|
|
2c92: 50 e0 ldi r21, 0x00 ; 0
|
|
2c94: 60 e0 ldi r22, 0x00 ; 0
|
|
2c96: 70 e0 ldi r23, 0x00 ; 0
|
|
2c98: ce 01 movw r24, r28
|
|
2c9a: 01 96 adiw r24, 0x01 ; 1
|
|
2c9c: 0e 94 fc 05 call 0xbf8 ; 0xbf8 <MemoryReadBlock>
|
|
|
|
if (ISO14443ASelect(Buffer, &BitCount, UidCL1, CardSAKValue)) {
|
|
2ca0: 90 91 b8 20 lds r25, 0x20B8
|
|
uint8_t* DataPtr = (uint8_t*) Buffer;
|
|
uint8_t NVB = DataPtr[1];
|
|
//uint8_t CollisionByteCount = (NVB >> 4) & 0x0F;
|
|
//uint8_t CollisionBitCount = (NVB >> 0) & 0x0F;
|
|
|
|
switch (NVB) {
|
|
2ca4: d8 01 movw r26, r16
|
|
2ca6: 11 96 adiw r26, 0x01 ; 1
|
|
2ca8: 8c 91 ld r24, X
|
|
2caa: 80 32 cpi r24, 0x20 ; 32
|
|
2cac: 09 f4 brne .+2 ; 0x2cb0 <MifareClassicAppProcess+0x670>
|
|
2cae: 2f c1 rjmp .+606 ; 0x2f0e <MifareClassicAppProcess+0x8ce>
|
|
2cb0: 80 37 cpi r24, 0x70 ; 112
|
|
2cb2: 09 f0 breq .+2 ; 0x2cb6 <MifareClassicAppProcess+0x676>
|
|
2cb4: 9d cd rjmp .-1222 ; 0x27f0 <MifareClassicAppProcess+0x1b0>
|
|
return false;
|
|
|
|
case ISO14443A_NVB_AC_END:
|
|
/* End of anticollision procedure.
|
|
* Send SAK CLn if we are selected. */
|
|
if ( (DataPtr[2] == UidCL[0]) &&
|
|
2cb6: d8 01 movw r26, r16
|
|
2cb8: 12 96 adiw r26, 0x02 ; 2
|
|
2cba: 2c 91 ld r18, X
|
|
2cbc: 12 97 sbiw r26, 0x02 ; 2
|
|
2cbe: 89 81 ldd r24, Y+1 ; 0x01
|
|
2cc0: 28 13 cpse r18, r24
|
|
2cc2: 96 cd rjmp .-1236 ; 0x27f0 <MifareClassicAppProcess+0x1b0>
|
|
2cc4: 13 96 adiw r26, 0x03 ; 3
|
|
2cc6: 2c 91 ld r18, X
|
|
2cc8: 13 97 sbiw r26, 0x03 ; 3
|
|
2cca: 8a 81 ldd r24, Y+2 ; 0x02
|
|
2ccc: 28 13 cpse r18, r24
|
|
2cce: 90 cd rjmp .-1248 ; 0x27f0 <MifareClassicAppProcess+0x1b0>
|
|
(DataPtr[3] == UidCL[1]) &&
|
|
2cd0: 14 96 adiw r26, 0x04 ; 4
|
|
2cd2: 2c 91 ld r18, X
|
|
2cd4: 14 97 sbiw r26, 0x04 ; 4
|
|
2cd6: 8b 81 ldd r24, Y+3 ; 0x03
|
|
2cd8: 28 13 cpse r18, r24
|
|
2cda: 8a cd rjmp .-1260 ; 0x27f0 <MifareClassicAppProcess+0x1b0>
|
|
(DataPtr[4] == UidCL[2]) &&
|
|
2cdc: 15 96 adiw r26, 0x05 ; 5
|
|
2cde: 2c 91 ld r18, X
|
|
2ce0: 15 97 sbiw r26, 0x05 ; 5
|
|
2ce2: 8c 81 ldd r24, Y+4 ; 0x04
|
|
2ce4: 28 13 cpse r18, r24
|
|
2ce6: 84 cd rjmp .-1272 ; 0x27f0 <MifareClassicAppProcess+0x1b0>
|
|
(DataPtr[5] == UidCL[3]) ) {
|
|
|
|
DataPtr[0] = SAKValue;
|
|
2ce8: 9c 93 st X, r25
|
|
ISO14443AAppendCRCA(Buffer, 1);
|
|
2cea: 61 e0 ldi r22, 0x01 ; 1
|
|
2cec: 70 e0 ldi r23, 0x00 ; 0
|
|
2cee: c8 01 movw r24, r16
|
|
2cf0: 4a d1 rcall .+660 ; 0x2f86 <ISO14443AAppendCRCA>
|
|
State = STATE_ACTIVE;
|
|
2cf2: 83 e0 ldi r24, 0x03 ; 3
|
|
2cf4: 80 93 b5 20 sts 0x20B5, r24
|
|
|
|
*BitCount = ISO14443A_SAK_FRAME_SIZE;
|
|
2cf8: 28 e1 ldi r18, 0x18 ; 24
|
|
2cfa: 30 e0 ldi r19, 0x00 ; 0
|
|
2cfc: 5a cd rjmp .-1356 ; 0x27b2 <MifareClassicAppProcess+0x172>
|
|
} else {
|
|
Buffer[0] = NAK_CRC_ERROR ^ Crypto1Nibble();
|
|
return ACK_NAK_FRAME_SIZE;
|
|
}
|
|
} else if (Buffer[0] == CMD_WRITE) {
|
|
if (ISO14443ACheckCRCA(Buffer, CMD_WRITE_FRAME_SIZE)) {
|
|
2cfe: 62 e0 ldi r22, 0x02 ; 2
|
|
2d00: 70 e0 ldi r23, 0x00 ; 0
|
|
2d02: c8 01 movw r24, r16
|
|
2d04: 6f d1 rcall .+734 ; 0x2fe4 <ISO14443ACheckCRCA>
|
|
2d06: 88 23 and r24, r24
|
|
2d08: 81 f0 breq .+32 ; 0x2d2a <MifareClassicAppProcess+0x6ea>
|
|
/* Write command. Store the address and prepare for the upcoming data.
|
|
* Respond with ACK. */
|
|
CurrentAddress = Buffer[1];
|
|
2d0a: d8 01 movw r26, r16
|
|
2d0c: 11 96 adiw r26, 0x01 ; 1
|
|
2d0e: 8c 91 ld r24, X
|
|
2d10: 80 93 c1 20 sts 0x20C1, r24
|
|
State = STATE_WRITE;
|
|
2d14: 86 e0 ldi r24, 0x06 ; 6
|
|
2d16: 80 93 b5 20 sts 0x20B5, r24
|
|
MemoryWriteBlock(BlockBuffer, (uint16_t) Buffer[1] * MEM_BYTES_PER_BLOCK, MEM_BYTES_PER_BLOCK );
|
|
} else {
|
|
/* In read only mode, silently ignore the write */
|
|
}
|
|
|
|
Buffer[0] = ACK_VALUE ^ Crypto1Nibble();
|
|
2d1a: 27 d4 rcall .+2126 ; 0x356a <Crypto1Nibble>
|
|
2d1c: 9a e0 ldi r25, 0x0A ; 10
|
|
2d1e: 98 27 eor r25, r24
|
|
2d20: f8 01 movw r30, r16
|
|
2d22: 90 83 st Z, r25
|
|
} else {
|
|
Buffer[0] = NAK_CRC_ERROR ^ Crypto1Nibble();
|
|
}
|
|
|
|
return ACK_NAK_FRAME_SIZE;
|
|
2d24: 24 e0 ldi r18, 0x04 ; 4
|
|
2d26: 30 e0 ldi r19, 0x00 ; 0
|
|
2d28: 44 cd rjmp .-1400 ; 0x27b2 <MifareClassicAppProcess+0x172>
|
|
/* In read only mode, silently ignore the write */
|
|
}
|
|
|
|
Buffer[0] = ACK_VALUE ^ Crypto1Nibble();
|
|
} else {
|
|
Buffer[0] = NAK_CRC_ERROR ^ Crypto1Nibble();
|
|
2d2a: 1f d4 rcall .+2110 ; 0x356a <Crypto1Nibble>
|
|
2d2c: 91 e0 ldi r25, 0x01 ; 1
|
|
2d2e: 98 27 eor r25, r24
|
|
2d30: d8 01 movw r26, r16
|
|
2d32: 9c 93 st X, r25
|
|
}
|
|
|
|
return ACK_NAK_FRAME_SIZE;
|
|
2d34: 24 e0 ldi r18, 0x04 ; 4
|
|
2d36: 30 e0 ldi r19, 0x00 ; 0
|
|
2d38: 3c cd rjmp .-1416 ; 0x27b2 <MifareClassicAppProcess+0x172>
|
|
} else {
|
|
Buffer[0] = NAK_CRC_ERROR ^ Crypto1Nibble();
|
|
}
|
|
return ACK_NAK_FRAME_SIZE;
|
|
} else if (Buffer[0] == CMD_DECREMENT) {
|
|
if (ISO14443ACheckCRCA(Buffer, CMD_DECREMENT_FRAME_SIZE)) {
|
|
2d3a: 62 e0 ldi r22, 0x02 ; 2
|
|
2d3c: 70 e0 ldi r23, 0x00 ; 0
|
|
2d3e: c8 01 movw r24, r16
|
|
2d40: 51 d1 rcall .+674 ; 0x2fe4 <ISO14443ACheckCRCA>
|
|
2d42: 88 23 and r24, r24
|
|
2d44: 09 f4 brne .+2 ; 0x2d48 <MifareClassicAppProcess+0x708>
|
|
2d46: 5d cf rjmp .-326 ; 0x2c02 <MifareClassicAppProcess+0x5c2>
|
|
CurrentAddress = Buffer[1];
|
|
2d48: f8 01 movw r30, r16
|
|
2d4a: 81 81 ldd r24, Z+1 ; 0x01
|
|
2d4c: 80 93 c1 20 sts 0x20C1, r24
|
|
State = STATE_DECREMENT;
|
|
2d50: 88 e0 ldi r24, 0x08 ; 8
|
|
}
|
|
return ACK_NAK_FRAME_SIZE;
|
|
} else if (Buffer[0] == CMD_RESTORE) {
|
|
if (ISO14443ACheckCRCA(Buffer, CMD_DECREMENT_FRAME_SIZE)) {
|
|
CurrentAddress = Buffer[1];
|
|
State = STATE_RESTORE;
|
|
2d52: 80 93 b5 20 sts 0x20B5, r24
|
|
Buffer[0] = ACK_VALUE ^ Crypto1Nibble();
|
|
2d56: 09 d4 rcall .+2066 ; 0x356a <Crypto1Nibble>
|
|
2d58: 9a e0 ldi r25, 0x0A ; 10
|
|
2d5a: 98 27 eor r25, r24
|
|
2d5c: d8 01 movw r26, r16
|
|
2d5e: 9c 93 st X, r25
|
|
} else {
|
|
Buffer[0] = NAK_CRC_ERROR ^ Crypto1Nibble();
|
|
}
|
|
return ACK_NAK_FRAME_SIZE;
|
|
2d60: 24 e0 ldi r18, 0x04 ; 4
|
|
2d62: 30 e0 ldi r19, 0x00 ; 0
|
|
2d64: 26 cd rjmp .-1460 ; 0x27b2 <MifareClassicAppProcess+0x172>
|
|
|
|
INLINE bool CheckValueIntegrity(uint8_t* Block)
|
|
{
|
|
/* Value Blocks contain a value stored three times, with
|
|
* the middle portion inverted. */
|
|
if ( (Block[0] == (uint8_t) ~Block[4]) && (Block[0] == Block[8])
|
|
2d66: 80 91 ca 20 lds r24, 0x20CA
|
|
2d6a: 28 13 cpse r18, r24
|
|
2d6c: 38 cf rjmp .-400 ; 0x2bde <MifareClassicAppProcess+0x59e>
|
|
&& (Block[1] == (uint8_t) ~Block[5]) && (Block[1] == Block[9])
|
|
2d6e: e0 91 c3 20 lds r30, 0x20C3
|
|
2d72: 80 91 c7 20 lds r24, 0x20C7
|
|
2d76: 80 95 com r24
|
|
2d78: e8 13 cpse r30, r24
|
|
2d7a: 31 cf rjmp .-414 ; 0x2bde <MifareClassicAppProcess+0x59e>
|
|
2d7c: 80 91 cb 20 lds r24, 0x20CB
|
|
2d80: e8 13 cpse r30, r24
|
|
2d82: 2d cf rjmp .-422 ; 0x2bde <MifareClassicAppProcess+0x59e>
|
|
&& (Block[2] == (uint8_t) ~Block[6]) && (Block[2] == Block[10])
|
|
2d84: 80 91 c4 20 lds r24, 0x20C4
|
|
2d88: 90 91 c8 20 lds r25, 0x20C8
|
|
2d8c: 90 95 com r25
|
|
2d8e: 89 13 cpse r24, r25
|
|
2d90: 26 cf rjmp .-436 ; 0x2bde <MifareClassicAppProcess+0x59e>
|
|
2d92: 90 91 cc 20 lds r25, 0x20CC
|
|
2d96: 89 13 cpse r24, r25
|
|
2d98: 22 cf rjmp .-444 ; 0x2bde <MifareClassicAppProcess+0x59e>
|
|
&& (Block[3] == (uint8_t) ~Block[7]) && (Block[3] == Block[11])
|
|
2d9a: 30 91 c5 20 lds r19, 0x20C5
|
|
2d9e: 90 91 c9 20 lds r25, 0x20C9
|
|
2da2: 90 95 com r25
|
|
2da4: 39 13 cpse r19, r25
|
|
2da6: 1b cf rjmp .-458 ; 0x2bde <MifareClassicAppProcess+0x59e>
|
|
2da8: 90 91 cd 20 lds r25, 0x20CD
|
|
2dac: 39 13 cpse r19, r25
|
|
2dae: 17 cf rjmp .-466 ; 0x2bde <MifareClassicAppProcess+0x59e>
|
|
&& (Block[12] == (uint8_t) ~Block[13])
|
|
2db0: 40 91 ce 20 lds r20, 0x20CE
|
|
2db4: 90 91 cf 20 lds r25, 0x20CF
|
|
2db8: 90 95 com r25
|
|
2dba: 49 13 cpse r20, r25
|
|
2dbc: 10 cf rjmp .-480 ; 0x2bde <MifareClassicAppProcess+0x59e>
|
|
&& (Block[12] == Block[14])
|
|
2dbe: 90 91 d0 20 lds r25, 0x20D0
|
|
2dc2: 49 13 cpse r20, r25
|
|
2dc4: 0c cf rjmp .-488 ; 0x2bde <MifareClassicAppProcess+0x59e>
|
|
&& (Block[14] == (uint8_t) ~Block[15])) {
|
|
2dc6: 90 91 d1 20 lds r25, 0x20D1
|
|
2dca: 90 95 com r25
|
|
2dcc: 49 13 cpse r20, r25
|
|
2dce: 07 cf rjmp .-498 ; 0x2bde <MifareClassicAppProcess+0x59e>
|
|
}
|
|
|
|
INLINE void ValueFromBlock(uint32_t* Value, uint8_t* Block)
|
|
{
|
|
*Value = 0;
|
|
*Value |= ((uint32_t) Block[0] << 0);
|
|
2dd0: d8 01 movw r26, r16
|
|
2dd2: 9c 91 ld r25, X
|
|
*Value |= ((uint32_t) Block[1] << 8);
|
|
2dd4: 11 96 adiw r26, 0x01 ; 1
|
|
2dd6: fc 91 ld r31, X
|
|
2dd8: 11 97 sbiw r26, 0x01 ; 1
|
|
*Value |= ((uint32_t) Block[2] << 16);
|
|
2dda: 12 96 adiw r26, 0x02 ; 2
|
|
2ddc: 4c 91 ld r20, X
|
|
2dde: 12 97 sbiw r26, 0x02 ; 2
|
|
2de0: 50 e0 ldi r21, 0x00 ; 0
|
|
2de2: 60 e0 ldi r22, 0x00 ; 0
|
|
2de4: 70 e0 ldi r23, 0x00 ; 0
|
|
2de6: ba 01 movw r22, r20
|
|
2de8: 55 27 eor r21, r21
|
|
2dea: 44 27 eor r20, r20
|
|
|
|
INLINE void ValueFromBlock(uint32_t* Value, uint8_t* Block)
|
|
{
|
|
*Value = 0;
|
|
*Value |= ((uint32_t) Block[0] << 0);
|
|
*Value |= ((uint32_t) Block[1] << 8);
|
|
2dec: 5f 2b or r21, r31
|
|
*Value |= ((uint32_t) Block[2] << 16);
|
|
2dee: 49 2b or r20, r25
|
|
*Value |= ((uint32_t) Block[3] << 24);
|
|
2df0: 13 96 adiw r26, 0x03 ; 3
|
|
2df2: 9c 91 ld r25, X
|
|
2df4: 79 2b or r23, r25
|
|
INLINE void ValueFromBlock(uint32_t* Value, uint8_t* Block)
|
|
{
|
|
*Value = 0;
|
|
*Value |= ((uint32_t) Block[0] << 0);
|
|
*Value |= ((uint32_t) Block[1] << 8);
|
|
*Value |= ((uint32_t) Block[2] << 16);
|
|
2df6: 90 e0 ldi r25, 0x00 ; 0
|
|
2df8: a0 e0 ldi r26, 0x00 ; 0
|
|
2dfa: b0 e0 ldi r27, 0x00 ; 0
|
|
2dfc: dc 01 movw r26, r24
|
|
2dfe: 99 27 eor r25, r25
|
|
2e00: 88 27 eor r24, r24
|
|
|
|
INLINE void ValueFromBlock(uint32_t* Value, uint8_t* Block)
|
|
{
|
|
*Value = 0;
|
|
*Value |= ((uint32_t) Block[0] << 0);
|
|
*Value |= ((uint32_t) Block[1] << 8);
|
|
2e02: 9e 2b or r25, r30
|
|
*Value |= ((uint32_t) Block[2] << 16);
|
|
2e04: 82 2b or r24, r18
|
|
*Value |= ((uint32_t) Block[3] << 24);
|
|
2e06: b3 2b or r27, r19
|
|
uint32_t BlockValue;
|
|
|
|
ValueFromBlock(&ParamValue, Buffer);
|
|
ValueFromBlock(&BlockValue, BlockBuffer);
|
|
|
|
if (State == STATE_DECREMENT) {
|
|
2e08: 20 91 b5 20 lds r18, 0x20B5
|
|
2e0c: 28 30 cpi r18, 0x08 ; 8
|
|
2e0e: 09 f4 brne .+2 ; 0x2e12 <MifareClassicAppProcess+0x7d2>
|
|
2e10: 6d c0 rjmp .+218 ; 0x2eec <MifareClassicAppProcess+0x8ac>
|
|
BlockValue -= ParamValue;
|
|
} else if (State == STATE_INCREMENT) {
|
|
2e12: 27 30 cpi r18, 0x07 ; 7
|
|
2e14: 21 f4 brne .+8 ; 0x2e1e <MifareClassicAppProcess+0x7de>
|
|
BlockValue += ParamValue;
|
|
2e16: 84 0f add r24, r20
|
|
2e18: 95 1f adc r25, r21
|
|
2e1a: a6 1f adc r26, r22
|
|
2e1c: b7 1f adc r27, r23
|
|
*Value |= ((uint32_t) Block[3] << 24);
|
|
}
|
|
|
|
INLINE void ValueToBlock(uint8_t* Block, uint32_t Value)
|
|
{
|
|
Block[0] = (uint8_t) (Value >> 0);
|
|
2e1e: 80 93 c2 20 sts 0x20C2, r24
|
|
Block[1] = (uint8_t) (Value >> 8);
|
|
2e22: c9 2e mov r12, r25
|
|
2e24: da 2e mov r13, r26
|
|
2e26: eb 2e mov r14, r27
|
|
2e28: ff 24 eor r15, r15
|
|
2e2a: c0 92 c3 20 sts 0x20C3, r12
|
|
Block[2] = (uint8_t) (Value >> 16);
|
|
2e2e: 8d 01 movw r16, r26
|
|
2e30: 22 27 eor r18, r18
|
|
2e32: 33 27 eor r19, r19
|
|
2e34: 00 93 c4 20 sts 0x20C4, r16
|
|
Block[3] = (uint8_t) (Value >> 24);
|
|
2e38: 4b 2f mov r20, r27
|
|
2e3a: 55 27 eor r21, r21
|
|
2e3c: 66 27 eor r22, r22
|
|
2e3e: 77 27 eor r23, r23
|
|
2e40: 40 93 c5 20 sts 0x20C5, r20
|
|
Block[4] = ~Block[0];
|
|
2e44: e8 2f mov r30, r24
|
|
2e46: e0 95 com r30
|
|
2e48: e0 93 c6 20 sts 0x20C6, r30
|
|
Block[5] = ~Block[1];
|
|
2e4c: ec 2d mov r30, r12
|
|
2e4e: e0 95 com r30
|
|
2e50: e0 93 c7 20 sts 0x20C7, r30
|
|
Block[6] = ~Block[2];
|
|
2e54: e0 2f mov r30, r16
|
|
2e56: e0 95 com r30
|
|
2e58: e0 93 c8 20 sts 0x20C8, r30
|
|
Block[7] = ~Block[3];
|
|
2e5c: e4 2f mov r30, r20
|
|
2e5e: e0 95 com r30
|
|
2e60: e0 93 c9 20 sts 0x20C9, r30
|
|
Block[8] = Block[0];
|
|
2e64: 80 93 ca 20 sts 0x20CA, r24
|
|
Block[9] = Block[1];
|
|
2e68: c0 92 cb 20 sts 0x20CB, r12
|
|
Block[10] = Block[2];
|
|
2e6c: 00 93 cc 20 sts 0x20CC, r16
|
|
Block[11] = Block[3];
|
|
2e70: 40 93 cd 20 sts 0x20CD, r20
|
|
/* Do nothing */
|
|
}
|
|
|
|
ValueToBlock(BlockBuffer, BlockValue);
|
|
|
|
State = STATE_AUTHED_IDLE;
|
|
2e74: 85 e0 ldi r24, 0x05 ; 5
|
|
2e76: 80 93 b5 20 sts 0x20B5, r24
|
|
/* No ACK response on value commands part 2 */
|
|
return ISO14443A_APP_NO_RESPONSE;
|
|
2e7a: 20 e0 ldi r18, 0x00 ; 0
|
|
2e7c: 30 e0 ldi r19, 0x00 ; 0
|
|
2e7e: 99 cc rjmp .-1742 ; 0x27b2 <MifareClassicAppProcess+0x172>
|
|
} else {
|
|
Buffer[0] = NAK_CRC_ERROR ^ Crypto1Nibble();
|
|
}
|
|
return ACK_NAK_FRAME_SIZE;
|
|
} else if (Buffer[0] == CMD_INCREMENT) {
|
|
if (ISO14443ACheckCRCA(Buffer, CMD_DECREMENT_FRAME_SIZE)) {
|
|
2e80: 62 e0 ldi r22, 0x02 ; 2
|
|
2e82: 70 e0 ldi r23, 0x00 ; 0
|
|
2e84: c8 01 movw r24, r16
|
|
2e86: ae d0 rcall .+348 ; 0x2fe4 <ISO14443ACheckCRCA>
|
|
2e88: 88 23 and r24, r24
|
|
2e8a: 09 f4 brne .+2 ; 0x2e8e <MifareClassicAppProcess+0x84e>
|
|
2e8c: 4e cf rjmp .-356 ; 0x2d2a <MifareClassicAppProcess+0x6ea>
|
|
CurrentAddress = Buffer[1];
|
|
2e8e: d8 01 movw r26, r16
|
|
2e90: 11 96 adiw r26, 0x01 ; 1
|
|
2e92: 8c 91 ld r24, X
|
|
2e94: 80 93 c1 20 sts 0x20C1, r24
|
|
State = STATE_INCREMENT;
|
|
2e98: 87 e0 ldi r24, 0x07 ; 7
|
|
2e9a: 80 93 b5 20 sts 0x20B5, r24
|
|
2e9e: 3d cf rjmp .-390 ; 0x2d1a <MifareClassicAppProcess+0x6da>
|
|
} else {
|
|
Buffer[0] = NAK_CRC_ERROR ^ Crypto1Nibble();
|
|
}
|
|
return ACK_NAK_FRAME_SIZE;
|
|
} else if (Buffer[0] == CMD_RESTORE) {
|
|
if (ISO14443ACheckCRCA(Buffer, CMD_DECREMENT_FRAME_SIZE)) {
|
|
2ea0: 62 e0 ldi r22, 0x02 ; 2
|
|
2ea2: 70 e0 ldi r23, 0x00 ; 0
|
|
2ea4: c8 01 movw r24, r16
|
|
2ea6: 9e d0 rcall .+316 ; 0x2fe4 <ISO14443ACheckCRCA>
|
|
2ea8: 88 23 and r24, r24
|
|
2eaa: 09 f4 brne .+2 ; 0x2eae <MifareClassicAppProcess+0x86e>
|
|
2eac: aa ce rjmp .-684 ; 0x2c02 <MifareClassicAppProcess+0x5c2>
|
|
CurrentAddress = Buffer[1];
|
|
2eae: f8 01 movw r30, r16
|
|
2eb0: 81 81 ldd r24, Z+1 ; 0x01
|
|
2eb2: 80 93 c1 20 sts 0x20C1, r24
|
|
State = STATE_RESTORE;
|
|
2eb6: 89 e0 ldi r24, 0x09 ; 9
|
|
2eb8: 4c cf rjmp .-360 ; 0x2d52 <MifareClassicAppProcess+0x712>
|
|
Buffer[0] = NAK_CRC_ERROR ^ Crypto1Nibble();
|
|
}
|
|
return ACK_NAK_FRAME_SIZE;
|
|
}else if (Buffer[0] == CMD_TRANSFER) {
|
|
/* Write back the global block buffer to the desired block address */
|
|
if (ISO14443ACheckCRCA(Buffer, CMD_TRANSFER_FRAME_SIZE)) {
|
|
2eba: 62 e0 ldi r22, 0x02 ; 2
|
|
2ebc: 70 e0 ldi r23, 0x00 ; 0
|
|
2ebe: c8 01 movw r24, r16
|
|
2ec0: 91 d0 rcall .+290 ; 0x2fe4 <ISO14443ACheckCRCA>
|
|
2ec2: 88 23 and r24, r24
|
|
2ec4: 09 f4 brne .+2 ; 0x2ec8 <MifareClassicAppProcess+0x888>
|
|
2ec6: 31 cf rjmp .-414 ; 0x2d2a <MifareClassicAppProcess+0x6ea>
|
|
if (!ActiveConfiguration.ReadOnly) {
|
|
2ec8: 80 91 fc 20 lds r24, 0x20FC
|
|
2ecc: 81 11 cpse r24, r1
|
|
2ece: 25 cf rjmp .-438 ; 0x2d1a <MifareClassicAppProcess+0x6da>
|
|
MemoryWriteBlock(BlockBuffer, (uint16_t) Buffer[1] * MEM_BYTES_PER_BLOCK, MEM_BYTES_PER_BLOCK );
|
|
2ed0: d8 01 movw r26, r16
|
|
2ed2: 11 96 adiw r26, 0x01 ; 1
|
|
2ed4: 6c 91 ld r22, X
|
|
2ed6: b0 e1 ldi r27, 0x10 ; 16
|
|
2ed8: 6b 9f mul r22, r27
|
|
2eda: b0 01 movw r22, r0
|
|
2edc: 11 24 eor r1, r1
|
|
2ede: 40 e1 ldi r20, 0x10 ; 16
|
|
2ee0: 50 e0 ldi r21, 0x00 ; 0
|
|
2ee2: 82 ec ldi r24, 0xC2 ; 194
|
|
2ee4: 90 e2 ldi r25, 0x20 ; 32
|
|
2ee6: 0e 94 81 06 call 0xd02 ; 0xd02 <MemoryWriteBlock>
|
|
2eea: 17 cf rjmp .-466 ; 0x2d1a <MifareClassicAppProcess+0x6da>
|
|
|
|
ValueFromBlock(&ParamValue, Buffer);
|
|
ValueFromBlock(&BlockValue, BlockBuffer);
|
|
|
|
if (State == STATE_DECREMENT) {
|
|
BlockValue -= ParamValue;
|
|
2eec: 84 1b sub r24, r20
|
|
2eee: 95 0b sbc r25, r21
|
|
2ef0: a6 0b sbc r26, r22
|
|
2ef2: b7 0b sbc r27, r23
|
|
2ef4: 94 cf rjmp .-216 ; 0x2e1e <MifareClassicAppProcess+0x7de>
|
|
return BitCount;
|
|
} else if (Buffer[0] == CMD_HALT) {
|
|
/* Halts the tag. According to the ISO14443, the second
|
|
* byte is supposed to be 0. */
|
|
if (Buffer[1] == 0) {
|
|
if (ISO14443ACheckCRCA(Buffer, CMD_HALT_FRAME_SIZE)) {
|
|
2ef6: 62 e0 ldi r22, 0x02 ; 2
|
|
2ef8: 70 e0 ldi r23, 0x00 ; 0
|
|
2efa: c8 01 movw r24, r16
|
|
2efc: 73 d0 rcall .+230 ; 0x2fe4 <ISO14443ACheckCRCA>
|
|
2efe: 81 11 cpse r24, r1
|
|
2f00: a7 cc rjmp .-1714 ; 0x2850 <MifareClassicAppProcess+0x210>
|
|
/* Setup crypto1 cipher. Discard in-place encrypted CardNonce. */
|
|
Crypto1Setup(Key, Uid, CardNonce);
|
|
|
|
return CMD_AUTH_RB_FRAME_SIZE * BITS_PER_BYTE;
|
|
} else {
|
|
Buffer[0] = NAK_CRC_ERROR;
|
|
2f02: 81 e0 ldi r24, 0x01 ; 1
|
|
2f04: d8 01 movw r26, r16
|
|
2f06: 8c 93 st X, r24
|
|
return ACK_NAK_FRAME_SIZE;
|
|
2f08: 24 e0 ldi r18, 0x04 ; 4
|
|
2f0a: 30 e0 ldi r19, 0x00 ; 0
|
|
2f0c: 52 cc rjmp .-1884 ; 0x27b2 <MifareClassicAppProcess+0x172>
|
|
|
|
switch (NVB) {
|
|
case ISO14443A_NVB_AC_START:
|
|
/* Start of anticollision procedure.
|
|
* Send whole UID CLn + BCC */
|
|
DataPtr[0] = UidCL[0];
|
|
2f0e: 89 81 ldd r24, Y+1 ; 0x01
|
|
2f10: f8 01 movw r30, r16
|
|
2f12: 80 83 st Z, r24
|
|
DataPtr[1] = UidCL[1];
|
|
2f14: 3a 81 ldd r19, Y+2 ; 0x02
|
|
2f16: 31 83 std Z+1, r19 ; 0x01
|
|
DataPtr[2] = UidCL[2];
|
|
2f18: 2b 81 ldd r18, Y+3 ; 0x03
|
|
2f1a: 22 83 std Z+2, r18 ; 0x02
|
|
DataPtr[3] = UidCL[3];
|
|
2f1c: 9c 81 ldd r25, Y+4 ; 0x04
|
|
2f1e: 93 83 std Z+3, r25 ; 0x03
|
|
DataPtr[4] = ISO14443A_CALC_BCC(DataPtr);
|
|
2f20: 83 27 eor r24, r19
|
|
2f22: 82 27 eor r24, r18
|
|
2f24: 89 27 eor r24, r25
|
|
2f26: 84 83 std Z+4, r24 ; 0x04
|
|
|
|
*BitCount = ISO14443A_CL_FRAME_SIZE;
|
|
2f28: 28 e2 ldi r18, 0x28 ; 40
|
|
2f2a: 30 e0 ldi r19, 0x00 ; 0
|
|
2f2c: 42 cc rjmp .-1916 ; 0x27b2 <MifareClassicAppProcess+0x172>
|
|
return ACK_NAK_FRAME_SIZE;
|
|
} else if ( (Buffer[0] == CMD_AUTH_A) || (Buffer[0] == CMD_AUTH_B) ) {
|
|
if (ISO14443ACheckCRCA(Buffer, CMD_AUTH_FRAME_SIZE)) {
|
|
/* Nested authentication. */
|
|
uint8_t SectorAddress = Buffer[1] & MEM_SECTOR_ADDR_MASK;
|
|
uint8_t KeyOffset = (Buffer[0] == CMD_AUTH_A ? MEM_KEY_A_OFFSET : MEM_KEY_B_OFFSET);
|
|
2f2e: 60 e3 ldi r22, 0x30 ; 48
|
|
2f30: 70 e0 ldi r23, 0x00 ; 0
|
|
2f32: 7a cd rjmp .-1292 ; 0x2a28 <MifareClassicAppProcess+0x3e8>
|
|
return ACK_NAK_FRAME_SIZE;
|
|
}
|
|
} else if ( (Buffer[0] == CMD_AUTH_A) || (Buffer[0] == CMD_AUTH_B)) {
|
|
if (ISO14443ACheckCRCA(Buffer, CMD_AUTH_FRAME_SIZE)) {
|
|
uint8_t SectorAddress = Buffer[1] & MEM_SECTOR_ADDR_MASK;
|
|
uint8_t KeyOffset = (Buffer[0] == CMD_AUTH_A ? MEM_KEY_A_OFFSET : MEM_KEY_B_OFFSET);
|
|
2f34: 80 e3 ldi r24, 0x30 ; 48
|
|
2f36: 90 e0 ldi r25, 0x00 ; 0
|
|
2f38: e6 cd rjmp .-1076 ; 0x2b06 <MifareClassicAppProcess+0x4c6>
|
|
|
|
00002f3a <MifareClassicGetUid>:
|
|
return ISO14443A_APP_NO_RESPONSE;
|
|
}
|
|
|
|
void MifareClassicGetUid(ConfigurationUidType Uid)
|
|
{
|
|
MemoryReadBlock(Uid, MEM_UID_CL1_ADDRESS, MEM_UID_CL1_SIZE);
|
|
2f3a: 44 e0 ldi r20, 0x04 ; 4
|
|
2f3c: 50 e0 ldi r21, 0x00 ; 0
|
|
2f3e: 60 e0 ldi r22, 0x00 ; 0
|
|
2f40: 70 e0 ldi r23, 0x00 ; 0
|
|
2f42: 0c 94 fc 05 jmp 0xbf8 ; 0xbf8 <MemoryReadBlock>
|
|
|
|
00002f46 <MifareClassicSetUid>:
|
|
}
|
|
|
|
void MifareClassicSetUid(ConfigurationUidType Uid)
|
|
{
|
|
2f46: cf 93 push r28
|
|
2f48: df 93 push r29
|
|
2f4a: 1f 92 push r1
|
|
2f4c: cd b7 in r28, 0x3d ; 61
|
|
2f4e: de b7 in r29, 0x3e ; 62
|
|
uint8_t BCC = Uid[0] ^ Uid[1] ^ Uid[2] ^ Uid[3];
|
|
2f50: fc 01 movw r30, r24
|
|
2f52: 21 81 ldd r18, Z+1 ; 0x01
|
|
2f54: 30 81 ld r19, Z
|
|
2f56: 23 27 eor r18, r19
|
|
2f58: 32 81 ldd r19, Z+2 ; 0x02
|
|
2f5a: 23 27 eor r18, r19
|
|
2f5c: 33 81 ldd r19, Z+3 ; 0x03
|
|
2f5e: 23 27 eor r18, r19
|
|
2f60: 29 83 std Y+1, r18 ; 0x01
|
|
|
|
MemoryWriteBlock(Uid, MEM_UID_CL1_ADDRESS, MEM_UID_CL1_SIZE);
|
|
2f62: 44 e0 ldi r20, 0x04 ; 4
|
|
2f64: 50 e0 ldi r21, 0x00 ; 0
|
|
2f66: 60 e0 ldi r22, 0x00 ; 0
|
|
2f68: 70 e0 ldi r23, 0x00 ; 0
|
|
2f6a: 0e 94 81 06 call 0xd02 ; 0xd02 <MemoryWriteBlock>
|
|
MemoryWriteBlock(&BCC, MEM_UID_BCC1_ADDRESS, ISO14443A_CL_BCC_SIZE);
|
|
2f6e: 41 e0 ldi r20, 0x01 ; 1
|
|
2f70: 50 e0 ldi r21, 0x00 ; 0
|
|
2f72: 64 e0 ldi r22, 0x04 ; 4
|
|
2f74: 70 e0 ldi r23, 0x00 ; 0
|
|
2f76: ce 01 movw r24, r28
|
|
2f78: 01 96 adiw r24, 0x01 ; 1
|
|
2f7a: 0e 94 81 06 call 0xd02 ; 0xd02 <MemoryWriteBlock>
|
|
}
|
|
2f7e: 0f 90 pop r0
|
|
2f80: df 91 pop r29
|
|
2f82: cf 91 pop r28
|
|
2f84: 08 95 ret
|
|
|
|
00002f86 <ISO14443AAppendCRCA>:
|
|
|
|
void ISO14443AAppendCRCA(void* Buffer, uint16_t ByteCount) {
|
|
uint16_t Checksum = 0x6363;
|
|
uint8_t* DataPtr = (uint8_t*) Buffer;
|
|
|
|
while(ByteCount--) {
|
|
2f86: 61 15 cp r22, r1
|
|
2f88: 71 05 cpc r23, r1
|
|
2f8a: 41 f1 breq .+80 ; 0x2fdc <ISO14443AAppendCRCA+0x56>
|
|
* policies, either expressed or implied, of the ORIGINAL AUTHORS.
|
|
*/
|
|
|
|
#include "ISO14443-3A.h"
|
|
|
|
void ISO14443AAppendCRCA(void* Buffer, uint16_t ByteCount) {
|
|
2f8c: 68 0f add r22, r24
|
|
2f8e: 79 1f adc r23, r25
|
|
uint16_t Checksum = 0x6363;
|
|
uint8_t* DataPtr = (uint8_t*) Buffer;
|
|
2f90: fc 01 movw r30, r24
|
|
*/
|
|
|
|
#include "ISO14443-3A.h"
|
|
|
|
void ISO14443AAppendCRCA(void* Buffer, uint16_t ByteCount) {
|
|
uint16_t Checksum = 0x6363;
|
|
2f92: 23 e6 ldi r18, 0x63 ; 99
|
|
2f94: 33 e6 ldi r19, 0x63 ; 99
|
|
uint8_t* DataPtr = (uint8_t*) Buffer;
|
|
|
|
while(ByteCount--) {
|
|
uint8_t Byte = *DataPtr++;
|
|
2f96: 41 91 ld r20, Z+
|
|
|
|
Byte ^= (uint8_t) (Checksum & 0x00FF);
|
|
2f98: 42 27 eor r20, r18
|
|
Byte ^= Byte << 4;
|
|
2f9a: 50 e1 ldi r21, 0x10 ; 16
|
|
2f9c: 45 9f mul r20, r21
|
|
2f9e: c0 01 movw r24, r0
|
|
2fa0: 11 24 eor r1, r1
|
|
2fa2: a4 2f mov r26, r20
|
|
2fa4: a8 27 eor r26, r24
|
|
|
|
Checksum = (Checksum >> 8) ^ ( (uint16_t) Byte << 8 ) ^
|
|
2fa6: 8a 2f mov r24, r26
|
|
2fa8: 90 e0 ldi r25, 0x00 ; 0
|
|
2faa: 58 2f mov r21, r24
|
|
2fac: 44 27 eor r20, r20
|
|
( (uint16_t) Byte << 3 ) ^ ( (uint16_t) Byte >> 4 );
|
|
2fae: 88 0f add r24, r24
|
|
2fb0: 99 1f adc r25, r25
|
|
2fb2: 88 0f add r24, r24
|
|
2fb4: 99 1f adc r25, r25
|
|
2fb6: 88 0f add r24, r24
|
|
2fb8: 99 1f adc r25, r25
|
|
uint8_t Byte = *DataPtr++;
|
|
|
|
Byte ^= (uint8_t) (Checksum & 0x00FF);
|
|
Byte ^= Byte << 4;
|
|
|
|
Checksum = (Checksum >> 8) ^ ( (uint16_t) Byte << 8 ) ^
|
|
2fba: 48 27 eor r20, r24
|
|
2fbc: 59 27 eor r21, r25
|
|
2fbe: 23 2f mov r18, r19
|
|
2fc0: 33 27 eor r19, r19
|
|
2fc2: 24 27 eor r18, r20
|
|
2fc4: 35 27 eor r19, r21
|
|
( (uint16_t) Byte << 3 ) ^ ( (uint16_t) Byte >> 4 );
|
|
2fc6: a2 95 swap r26
|
|
2fc8: af 70 andi r26, 0x0F ; 15
|
|
uint8_t Byte = *DataPtr++;
|
|
|
|
Byte ^= (uint8_t) (Checksum & 0x00FF);
|
|
Byte ^= Byte << 4;
|
|
|
|
Checksum = (Checksum >> 8) ^ ( (uint16_t) Byte << 8 ) ^
|
|
2fca: 2a 27 eor r18, r26
|
|
|
|
void ISO14443AAppendCRCA(void* Buffer, uint16_t ByteCount) {
|
|
uint16_t Checksum = 0x6363;
|
|
uint8_t* DataPtr = (uint8_t*) Buffer;
|
|
|
|
while(ByteCount--) {
|
|
2fcc: e6 17 cp r30, r22
|
|
2fce: f7 07 cpc r31, r23
|
|
2fd0: 11 f7 brne .-60 ; 0x2f96 <ISO14443AAppendCRCA+0x10>
|
|
2fd2: 92 2f mov r25, r18
|
|
2fd4: 83 2f mov r24, r19
|
|
|
|
Checksum = (Checksum >> 8) ^ ( (uint16_t) Byte << 8 ) ^
|
|
( (uint16_t) Byte << 3 ) ^ ( (uint16_t) Byte >> 4 );
|
|
}
|
|
|
|
*DataPtr++ = (Checksum >> 0) & 0x00FF;
|
|
2fd6: 90 83 st Z, r25
|
|
*DataPtr = (Checksum >> 8) & 0x00FF;
|
|
2fd8: 81 83 std Z+1, r24 ; 0x01
|
|
2fda: 08 95 ret
|
|
|
|
#include "ISO14443-3A.h"
|
|
|
|
void ISO14443AAppendCRCA(void* Buffer, uint16_t ByteCount) {
|
|
uint16_t Checksum = 0x6363;
|
|
uint8_t* DataPtr = (uint8_t*) Buffer;
|
|
2fdc: fc 01 movw r30, r24
|
|
|
|
while(ByteCount--) {
|
|
2fde: 83 e6 ldi r24, 0x63 ; 99
|
|
2fe0: 93 e6 ldi r25, 0x63 ; 99
|
|
2fe2: f9 cf rjmp .-14 ; 0x2fd6 <ISO14443AAppendCRCA+0x50>
|
|
|
|
00002fe4 <ISO14443ACheckCRCA>:
|
|
bool ISO14443ACheckCRCA(void* Buffer, uint16_t ByteCount)
|
|
{
|
|
uint16_t Checksum = 0x6363;
|
|
uint8_t* DataPtr = (uint8_t*) Buffer;
|
|
|
|
while(ByteCount--) {
|
|
2fe4: 61 15 cp r22, r1
|
|
2fe6: 71 05 cpc r23, r1
|
|
2fe8: b1 f1 breq .+108 ; 0x3056 <__stack+0x57>
|
|
|
|
*DataPtr++ = (Checksum >> 0) & 0x00FF;
|
|
*DataPtr = (Checksum >> 8) & 0x00FF;
|
|
}
|
|
|
|
bool ISO14443ACheckCRCA(void* Buffer, uint16_t ByteCount)
|
|
2fea: 68 0f add r22, r24
|
|
2fec: 79 1f adc r23, r25
|
|
{
|
|
uint16_t Checksum = 0x6363;
|
|
uint8_t* DataPtr = (uint8_t*) Buffer;
|
|
2fee: fc 01 movw r30, r24
|
|
*DataPtr = (Checksum >> 8) & 0x00FF;
|
|
}
|
|
|
|
bool ISO14443ACheckCRCA(void* Buffer, uint16_t ByteCount)
|
|
{
|
|
uint16_t Checksum = 0x6363;
|
|
2ff0: 23 e6 ldi r18, 0x63 ; 99
|
|
2ff2: 33 e6 ldi r19, 0x63 ; 99
|
|
uint8_t* DataPtr = (uint8_t*) Buffer;
|
|
|
|
while(ByteCount--) {
|
|
uint8_t Byte = *DataPtr++;
|
|
2ff4: 41 91 ld r20, Z+
|
|
|
|
Byte ^= (uint8_t) (Checksum & 0x00FF);
|
|
2ff6: 42 27 eor r20, r18
|
|
Byte ^= Byte << 4;
|
|
2ff8: 50 e1 ldi r21, 0x10 ; 16
|
|
2ffa: 45 9f mul r20, r21
|
|
2ffc: c0 01 movw r24, r0
|
|
2ffe: 11 24 eor r1, r1
|
|
3000: a4 2f mov r26, r20
|
|
3002: a8 27 eor r26, r24
|
|
|
|
Checksum = (Checksum >> 8) ^ ( (uint16_t) Byte << 8 ) ^
|
|
3004: 8a 2f mov r24, r26
|
|
3006: 90 e0 ldi r25, 0x00 ; 0
|
|
3008: 58 2f mov r21, r24
|
|
300a: 44 27 eor r20, r20
|
|
( (uint16_t) Byte << 3 ) ^ ( (uint16_t) Byte >> 4 );
|
|
300c: 88 0f add r24, r24
|
|
300e: 99 1f adc r25, r25
|
|
3010: 88 0f add r24, r24
|
|
3012: 99 1f adc r25, r25
|
|
3014: 88 0f add r24, r24
|
|
3016: 99 1f adc r25, r25
|
|
uint8_t Byte = *DataPtr++;
|
|
|
|
Byte ^= (uint8_t) (Checksum & 0x00FF);
|
|
Byte ^= Byte << 4;
|
|
|
|
Checksum = (Checksum >> 8) ^ ( (uint16_t) Byte << 8 ) ^
|
|
3018: 48 27 eor r20, r24
|
|
301a: 59 27 eor r21, r25
|
|
301c: 23 2f mov r18, r19
|
|
301e: 33 27 eor r19, r19
|
|
3020: 24 27 eor r18, r20
|
|
3022: 35 27 eor r19, r21
|
|
( (uint16_t) Byte << 3 ) ^ ( (uint16_t) Byte >> 4 );
|
|
3024: a2 95 swap r26
|
|
3026: af 70 andi r26, 0x0F ; 15
|
|
uint8_t Byte = *DataPtr++;
|
|
|
|
Byte ^= (uint8_t) (Checksum & 0x00FF);
|
|
Byte ^= Byte << 4;
|
|
|
|
Checksum = (Checksum >> 8) ^ ( (uint16_t) Byte << 8 ) ^
|
|
3028: 2a 27 eor r18, r26
|
|
bool ISO14443ACheckCRCA(void* Buffer, uint16_t ByteCount)
|
|
{
|
|
uint16_t Checksum = 0x6363;
|
|
uint8_t* DataPtr = (uint8_t*) Buffer;
|
|
|
|
while(ByteCount--) {
|
|
302a: e6 17 cp r30, r22
|
|
302c: f7 07 cpc r31, r23
|
|
302e: 11 f7 brne .-60 ; 0x2ff4 <ISO14443ACheckCRCA+0x10>
|
|
3030: a9 01 movw r20, r18
|
|
3032: 55 27 eor r21, r21
|
|
|
|
Checksum = (Checksum >> 8) ^ ( (uint16_t) Byte << 8 ) ^
|
|
( (uint16_t) Byte << 3 ) ^ ( (uint16_t) Byte >> 4 );
|
|
}
|
|
|
|
return (DataPtr[0] == ((Checksum >> 0) & 0xFF)) && (DataPtr[1] == ((Checksum >> 8) & 0xFF));
|
|
3034: 80 81 ld r24, Z
|
|
3036: 90 e0 ldi r25, 0x00 ; 0
|
|
3038: 84 17 cp r24, r20
|
|
303a: 95 07 cpc r25, r21
|
|
303c: 11 f0 breq .+4 ; 0x3042 <__stack+0x43>
|
|
303e: 80 e0 ldi r24, 0x00 ; 0
|
|
}
|
|
3040: 08 95 ret
|
|
|
|
Checksum = (Checksum >> 8) ^ ( (uint16_t) Byte << 8 ) ^
|
|
( (uint16_t) Byte << 3 ) ^ ( (uint16_t) Byte >> 4 );
|
|
}
|
|
|
|
return (DataPtr[0] == ((Checksum >> 0) & 0xFF)) && (DataPtr[1] == ((Checksum >> 8) & 0xFF));
|
|
3042: 41 81 ldd r20, Z+1 ; 0x01
|
|
3044: 50 e0 ldi r21, 0x00 ; 0
|
|
3046: 23 2f mov r18, r19
|
|
3048: 33 27 eor r19, r19
|
|
304a: 81 e0 ldi r24, 0x01 ; 1
|
|
304c: 42 17 cp r20, r18
|
|
304e: 53 07 cpc r21, r19
|
|
3050: b9 f3 breq .-18 ; 0x3040 <__stack+0x41>
|
|
3052: 80 e0 ldi r24, 0x00 ; 0
|
|
3054: f5 cf rjmp .-22 ; 0x3040 <__stack+0x41>
|
|
}
|
|
|
|
bool ISO14443ACheckCRCA(void* Buffer, uint16_t ByteCount)
|
|
{
|
|
uint16_t Checksum = 0x6363;
|
|
uint8_t* DataPtr = (uint8_t*) Buffer;
|
|
3056: fc 01 movw r30, r24
|
|
|
|
while(ByteCount--) {
|
|
3058: 43 e6 ldi r20, 0x63 ; 99
|
|
305a: 50 e0 ldi r21, 0x00 ; 0
|
|
*DataPtr = (Checksum >> 8) & 0x00FF;
|
|
}
|
|
|
|
bool ISO14443ACheckCRCA(void* Buffer, uint16_t ByteCount)
|
|
{
|
|
uint16_t Checksum = 0x6363;
|
|
305c: 23 e6 ldi r18, 0x63 ; 99
|
|
305e: 33 e6 ldi r19, 0x63 ; 99
|
|
3060: e9 cf rjmp .-46 ; 0x3034 <__stack+0x35>
|
|
|
|
00003062 <Crypto1LFSR>:
|
|
/* Split Crypto1 state into even and odd bits to speed up the output filter network */
|
|
static uint8_t StateEven[LFSR_SIZE/2] = {0};
|
|
static uint8_t StateOdd[LFSR_SIZE/2] = {0};
|
|
|
|
/* Proceed LFSR by one clock cycle */
|
|
static void Crypto1LFSR(uint8_t In) {
|
|
3062: cf 93 push r28
|
|
uint8_t Feedback = 0;
|
|
|
|
/* Calculate feedback according to LFSR taps. XOR all 6 state bytes
|
|
* into a single bit. */
|
|
Feedback ^= StateEven[0] & (uint8_t) (LFSR_MASK_EVEN >> 0);
|
|
3064: b0 91 d5 20 lds r27, 0x20D5
|
|
Feedback ^= StateEven[1] & (uint8_t) (LFSR_MASK_EVEN >> 8);
|
|
3068: c0 91 d6 20 lds r28, 0x20D6
|
|
Feedback ^= StateEven[2] & (uint8_t) (LFSR_MASK_EVEN >> 16);
|
|
306c: 40 91 d7 20 lds r20, 0x20D7
|
|
|
|
Feedback ^= StateOdd[0] & (uint8_t) (LFSR_MASK_ODD >> 0);
|
|
3070: a0 91 d2 20 lds r26, 0x20D2
|
|
Feedback ^= StateOdd[1] & (uint8_t) (LFSR_MASK_ODD >> 8);
|
|
3074: f0 91 d3 20 lds r31, 0x20D3
|
|
Feedback ^= StateOdd[2] & (uint8_t) (LFSR_MASK_ODD >> 16);
|
|
3078: e0 91 d4 20 lds r30, 0x20D4
|
|
uint8_t Feedback = 0;
|
|
|
|
/* Calculate feedback according to LFSR taps. XOR all 6 state bytes
|
|
* into a single bit. */
|
|
Feedback ^= StateEven[0] & (uint8_t) (LFSR_MASK_EVEN >> 0);
|
|
Feedback ^= StateEven[1] & (uint8_t) (LFSR_MASK_EVEN >> 8);
|
|
307c: 9c 2f mov r25, r28
|
|
307e: 90 71 andi r25, 0x10 ; 16
|
|
static void Crypto1LFSR(uint8_t In) {
|
|
uint8_t Feedback = 0;
|
|
|
|
/* Calculate feedback according to LFSR taps. XOR all 6 state bytes
|
|
* into a single bit. */
|
|
Feedback ^= StateEven[0] & (uint8_t) (LFSR_MASK_EVEN >> 0);
|
|
3080: 2b 2f mov r18, r27
|
|
3082: 21 7e andi r18, 0xE1 ; 225
|
|
Feedback ^= StateEven[1] & (uint8_t) (LFSR_MASK_EVEN >> 8);
|
|
3084: 92 27 eor r25, r18
|
|
Feedback ^= StateEven[2] & (uint8_t) (LFSR_MASK_EVEN >> 16);
|
|
3086: 24 2f mov r18, r20
|
|
3088: 20 72 andi r18, 0x20 ; 32
|
|
308a: 92 27 eor r25, r18
|
|
|
|
Feedback ^= StateOdd[0] & (uint8_t) (LFSR_MASK_ODD >> 0);
|
|
308c: 2a 2f mov r18, r26
|
|
308e: 24 79 andi r18, 0x94 ; 148
|
|
3090: 92 27 eor r25, r18
|
|
Feedback ^= StateOdd[1] & (uint8_t) (LFSR_MASK_ODD >> 8);
|
|
3092: 2f 2f mov r18, r31
|
|
3094: 23 77 andi r18, 0x73 ; 115
|
|
3096: 92 27 eor r25, r18
|
|
Feedback ^= StateOdd[2] & (uint8_t) (LFSR_MASK_ODD >> 16);
|
|
3098: 2e 2f mov r18, r30
|
|
309a: 2a 73 andi r18, 0x3A ; 58
|
|
309c: 92 27 eor r25, r18
|
|
|
|
Feedback ^= Feedback >> 4;
|
|
309e: 39 2f mov r19, r25
|
|
30a0: 32 95 swap r19
|
|
30a2: 3f 70 andi r19, 0x0F ; 15
|
|
30a4: 39 27 eor r19, r25
|
|
Feedback ^= Feedback >> 2;
|
|
30a6: 23 2f mov r18, r19
|
|
30a8: 26 95 lsr r18
|
|
30aa: 26 95 lsr r18
|
|
30ac: 23 27 eor r18, r19
|
|
Feedback ^= Feedback >> 1;
|
|
30ae: 92 2f mov r25, r18
|
|
30b0: 96 95 lsr r25
|
|
* - the new odd state becomes the old even state right-shifted by 1.
|
|
* For shifting the even state, we convert it into a 32 bit int first */
|
|
uint32_t Temp = 0;
|
|
Temp |= ((uint32_t) StateEven[0] << 0);
|
|
Temp |= ((uint32_t) StateEven[1] << 8);
|
|
Temp |= ((uint32_t) StateEven[2] << 16);
|
|
30b2: 50 e0 ldi r21, 0x00 ; 0
|
|
30b4: 60 e0 ldi r22, 0x00 ; 0
|
|
30b6: 70 e0 ldi r23, 0x00 ; 0
|
|
30b8: ba 01 movw r22, r20
|
|
30ba: 55 27 eor r21, r21
|
|
30bc: 44 27 eor r20, r20
|
|
* - the new even state becomes the old odd state
|
|
* - the new odd state becomes the old even state right-shifted by 1.
|
|
* For shifting the even state, we convert it into a 32 bit int first */
|
|
uint32_t Temp = 0;
|
|
Temp |= ((uint32_t) StateEven[0] << 0);
|
|
Temp |= ((uint32_t) StateEven[1] << 8);
|
|
30be: 5c 2b or r21, r28
|
|
Temp |= ((uint32_t) StateEven[2] << 16);
|
|
30c0: 4b 2b or r20, r27
|
|
|
|
/* Proceed LFSR. Try to force compiler not to shift the unneded upper bits. */
|
|
Temp = (Temp >> 1) & 0x00FFFFFF;
|
|
30c2: 76 95 lsr r23
|
|
30c4: 67 95 ror r22
|
|
30c6: 57 95 ror r21
|
|
30c8: 47 95 ror r20
|
|
Feedback ^= StateOdd[1] & (uint8_t) (LFSR_MASK_ODD >> 8);
|
|
Feedback ^= StateOdd[2] & (uint8_t) (LFSR_MASK_ODD >> 16);
|
|
|
|
Feedback ^= Feedback >> 4;
|
|
Feedback ^= Feedback >> 2;
|
|
Feedback ^= Feedback >> 1;
|
|
30ca: 92 27 eor r25, r18
|
|
|
|
/* Proceed LFSR. Try to force compiler not to shift the unneded upper bits. */
|
|
Temp = (Temp >> 1) & 0x00FFFFFF;
|
|
|
|
/* Calculate MSBit of even state as input bit to LFSR */
|
|
if ( (Feedback & 0x01) ^ In ) {
|
|
30cc: 91 70 andi r25, 0x01 ; 1
|
|
30ce: 98 13 cpse r25, r24
|
|
Temp |= (uint32_t) 1 << (8 * LFSR_SIZE/2 - 1);
|
|
30d0: 60 68 ori r22, 0x80 ; 128
|
|
}
|
|
|
|
/* Convert even state back into byte array and swap odd/even state
|
|
* as explained above. */
|
|
StateEven[0] = StateOdd[0];
|
|
30d2: a0 93 d5 20 sts 0x20D5, r26
|
|
StateEven[1] = StateOdd[1];
|
|
30d6: f0 93 d6 20 sts 0x20D6, r31
|
|
StateEven[2] = StateOdd[2];
|
|
30da: e0 93 d7 20 sts 0x20D7, r30
|
|
|
|
StateOdd[0] = (uint8_t) (Temp >> 0);
|
|
30de: 40 93 d2 20 sts 0x20D2, r20
|
|
StateOdd[1] = (uint8_t) (Temp >> 8);
|
|
30e2: 50 93 d3 20 sts 0x20D3, r21
|
|
StateOdd[2] = (uint8_t) (Temp >> 16);
|
|
30e6: 60 93 d4 20 sts 0x20D4, r22
|
|
}
|
|
30ea: cf 91 pop r28
|
|
30ec: 08 95 ret
|
|
|
|
000030ee <Crypto1FilterOutput>:
|
|
|
|
uint8_t Crypto1FilterOutput(void) {
|
|
30ee: cf 93 push r28
|
|
30f0: df 93 push r29
|
|
* 5 bits that are used to lookup the output bit.
|
|
*/
|
|
uint8_t Sum = 0;
|
|
|
|
Sum |= TableAB[0][(StateOdd[0] >> 4) & 0x0F];
|
|
Sum |= TableAB[1][(StateOdd[1] >> 0) & 0x0F];
|
|
30f2: c0 91 d3 20 lds r28, 0x20D3
|
|
Sum |= TableAB[2][(StateOdd[1] >> 4) & 0x0F];
|
|
Sum |= TableAB[3][(StateOdd[2] >> 0) & 0x0F];
|
|
30f6: 90 91 d4 20 lds r25, 0x20D4
|
|
30fa: a9 2f mov r26, r25
|
|
30fc: af 70 andi r26, 0x0F ; 15
|
|
30fe: b0 e0 ldi r27, 0x00 ; 0
|
|
3100: a0 5e subi r26, 0xE0 ; 224
|
|
3102: bf 4d sbci r27, 0xDF ; 223
|
|
* 5 bits that are used to lookup the output bit.
|
|
*/
|
|
uint8_t Sum = 0;
|
|
|
|
Sum |= TableAB[0][(StateOdd[0] >> 4) & 0x0F];
|
|
Sum |= TableAB[1][(StateOdd[1] >> 0) & 0x0F];
|
|
3104: ec 2f mov r30, r28
|
|
3106: ef 70 andi r30, 0x0F ; 15
|
|
3108: f0 e0 ldi r31, 0x00 ; 0
|
|
310a: e0 5e subi r30, 0xE0 ; 224
|
|
310c: ff 4d sbci r31, 0xDF ; 223
|
|
310e: d0 96 adiw r26, 0x30 ; 48
|
|
3110: 8c 91 ld r24, X
|
|
3112: 20 89 ldd r18, Z+16 ; 0x10
|
|
3114: 82 2b or r24, r18
|
|
* can simply be ORed together to produce the resulting
|
|
* 5 bits that are used to lookup the output bit.
|
|
*/
|
|
uint8_t Sum = 0;
|
|
|
|
Sum |= TableAB[0][(StateOdd[0] >> 4) & 0x0F];
|
|
3116: e0 91 d2 20 lds r30, 0x20D2
|
|
311a: e2 95 swap r30
|
|
311c: ef 70 andi r30, 0x0F ; 15
|
|
311e: f0 e0 ldi r31, 0x00 ; 0
|
|
3120: e0 5e subi r30, 0xE0 ; 224
|
|
3122: ff 4d sbci r31, 0xDF ; 223
|
|
Sum |= TableAB[1][(StateOdd[1] >> 0) & 0x0F];
|
|
Sum |= TableAB[2][(StateOdd[1] >> 4) & 0x0F];
|
|
3124: 20 81 ld r18, Z
|
|
3126: 82 2b or r24, r18
|
|
3128: c2 95 swap r28
|
|
312a: cf 70 andi r28, 0x0F ; 15
|
|
312c: d0 e0 ldi r29, 0x00 ; 0
|
|
312e: c0 5e subi r28, 0xE0 ; 224
|
|
3130: df 4d sbci r29, 0xDF ; 223
|
|
Sum |= TableAB[3][(StateOdd[2] >> 0) & 0x0F];
|
|
3132: 28 a1 ldd r18, Y+32 ; 0x20
|
|
3134: 82 2b or r24, r18
|
|
Sum |= TableAB[4][(StateOdd[2] >> 4) & 0x0F];
|
|
3136: 92 95 swap r25
|
|
3138: 9f 70 andi r25, 0x0F ; 15
|
|
313a: a9 2f mov r26, r25
|
|
313c: b0 e0 ldi r27, 0x00 ; 0
|
|
313e: a0 5a subi r26, 0xA0 ; 160
|
|
3140: bf 4d sbci r27, 0xDF ; 223
|
|
3142: 9c 91 ld r25, X
|
|
3144: 89 2b or r24, r25
|
|
|
|
return TableC[Sum];
|
|
3146: e8 2f mov r30, r24
|
|
3148: f0 e0 ldi r31, 0x00 ; 0
|
|
314a: e0 59 subi r30, 0x90 ; 144
|
|
314c: ff 4d sbci r31, 0xDF ; 223
|
|
}
|
|
314e: 80 81 ld r24, Z
|
|
3150: df 91 pop r29
|
|
3152: cf 91 pop r28
|
|
3154: 08 95 ret
|
|
|
|
00003156 <Crypto1Setup>:
|
|
|
|
void Crypto1Setup(uint8_t Key[6], uint8_t Uid[4], uint8_t CardNonce[4])
|
|
{
|
|
3156: cf 92 push r12
|
|
3158: df 92 push r13
|
|
315a: ef 92 push r14
|
|
315c: ff 92 push r15
|
|
315e: 0f 93 push r16
|
|
3160: 1f 93 push r17
|
|
3162: cf 93 push r28
|
|
3164: df 93 push r29
|
|
3166: fc 01 movw r30, r24
|
|
3168: db 01 movw r26, r22
|
|
316a: ea 01 movw r28, r20
|
|
* The inner loop generates 8 even and 8 odd bits from 16 key bits and
|
|
* the outer loop stores them. */
|
|
for (i=0; i<(LFSR_SIZE/2); i++) {
|
|
uint8_t EvenByte = 0;
|
|
uint8_t OddByte = 0;
|
|
uint16_t KeyWord = ((uint16_t) Key[2*i+1] << 8) | Key[2*i+0];
|
|
316c: 91 81 ldd r25, Z+1 ; 0x01
|
|
316e: 80 e0 ldi r24, 0x00 ; 0
|
|
3170: 20 81 ld r18, Z
|
|
3172: 82 2b or r24, r18
|
|
3174: 80 fd sbrc r24, 0
|
|
3176: 8d c1 rjmp .+794 ; 0x3492 <Crypto1Setup+0x33c>
|
|
3178: 30 e0 ldi r19, 0x00 ; 0
|
|
317a: 81 fd sbrc r24, 1
|
|
317c: 88 c1 rjmp .+784 ; 0x348e <Crypto1Setup+0x338>
|
|
317e: 20 e0 ldi r18, 0x00 ; 0
|
|
|
|
if (KeyWord & (1<<1)) {
|
|
OddByte |= 0x80;
|
|
}
|
|
|
|
KeyWord >>= 2;
|
|
3180: 96 95 lsr r25
|
|
3182: 87 95 ror r24
|
|
3184: 96 95 lsr r25
|
|
3186: 87 95 ror r24
|
|
for (j=0; j<8; j++) {
|
|
EvenByte >>= 1;
|
|
OddByte >>= 1;
|
|
|
|
if (KeyWord & (1<<0)) {
|
|
EvenByte |= 0x80;
|
|
3188: 43 2f mov r20, r19
|
|
318a: 40 68 ori r20, 0x80 ; 128
|
|
318c: 80 fd sbrc r24, 0
|
|
318e: 34 2f mov r19, r20
|
|
}
|
|
|
|
if (KeyWord & (1<<1)) {
|
|
OddByte |= 0x80;
|
|
3190: 42 2f mov r20, r18
|
|
3192: 40 68 ori r20, 0x80 ; 128
|
|
3194: 81 fd sbrc r24, 1
|
|
3196: 24 2f mov r18, r20
|
|
}
|
|
|
|
KeyWord >>= 2;
|
|
3198: 96 95 lsr r25
|
|
319a: 87 95 ror r24
|
|
319c: 96 95 lsr r25
|
|
319e: 87 95 ror r24
|
|
uint8_t OddByte = 0;
|
|
uint16_t KeyWord = ((uint16_t) Key[2*i+1] << 8) | Key[2*i+0];
|
|
uint8_t j;
|
|
|
|
for (j=0; j<8; j++) {
|
|
EvenByte >>= 1;
|
|
31a0: 36 95 lsr r19
|
|
OddByte >>= 1;
|
|
31a2: 26 95 lsr r18
|
|
|
|
if (KeyWord & (1<<0)) {
|
|
EvenByte |= 0x80;
|
|
31a4: 43 2f mov r20, r19
|
|
31a6: 40 68 ori r20, 0x80 ; 128
|
|
31a8: 80 fd sbrc r24, 0
|
|
31aa: 34 2f mov r19, r20
|
|
}
|
|
|
|
if (KeyWord & (1<<1)) {
|
|
OddByte |= 0x80;
|
|
31ac: 42 2f mov r20, r18
|
|
31ae: 40 68 ori r20, 0x80 ; 128
|
|
31b0: 81 fd sbrc r24, 1
|
|
31b2: 24 2f mov r18, r20
|
|
}
|
|
|
|
KeyWord >>= 2;
|
|
31b4: 96 95 lsr r25
|
|
31b6: 87 95 ror r24
|
|
31b8: 96 95 lsr r25
|
|
31ba: 87 95 ror r24
|
|
uint8_t OddByte = 0;
|
|
uint16_t KeyWord = ((uint16_t) Key[2*i+1] << 8) | Key[2*i+0];
|
|
uint8_t j;
|
|
|
|
for (j=0; j<8; j++) {
|
|
EvenByte >>= 1;
|
|
31bc: 36 95 lsr r19
|
|
OddByte >>= 1;
|
|
31be: 26 95 lsr r18
|
|
|
|
if (KeyWord & (1<<0)) {
|
|
EvenByte |= 0x80;
|
|
31c0: 43 2f mov r20, r19
|
|
31c2: 40 68 ori r20, 0x80 ; 128
|
|
31c4: 80 fd sbrc r24, 0
|
|
31c6: 34 2f mov r19, r20
|
|
}
|
|
|
|
if (KeyWord & (1<<1)) {
|
|
OddByte |= 0x80;
|
|
31c8: 42 2f mov r20, r18
|
|
31ca: 40 68 ori r20, 0x80 ; 128
|
|
31cc: 81 fd sbrc r24, 1
|
|
31ce: 24 2f mov r18, r20
|
|
}
|
|
|
|
KeyWord >>= 2;
|
|
31d0: 96 95 lsr r25
|
|
31d2: 87 95 ror r24
|
|
31d4: 96 95 lsr r25
|
|
31d6: 87 95 ror r24
|
|
uint8_t OddByte = 0;
|
|
uint16_t KeyWord = ((uint16_t) Key[2*i+1] << 8) | Key[2*i+0];
|
|
uint8_t j;
|
|
|
|
for (j=0; j<8; j++) {
|
|
EvenByte >>= 1;
|
|
31d8: 36 95 lsr r19
|
|
OddByte >>= 1;
|
|
31da: 26 95 lsr r18
|
|
|
|
if (KeyWord & (1<<0)) {
|
|
EvenByte |= 0x80;
|
|
31dc: 43 2f mov r20, r19
|
|
31de: 40 68 ori r20, 0x80 ; 128
|
|
31e0: 80 fd sbrc r24, 0
|
|
31e2: 34 2f mov r19, r20
|
|
}
|
|
|
|
if (KeyWord & (1<<1)) {
|
|
OddByte |= 0x80;
|
|
31e4: 42 2f mov r20, r18
|
|
31e6: 40 68 ori r20, 0x80 ; 128
|
|
31e8: 81 fd sbrc r24, 1
|
|
31ea: 24 2f mov r18, r20
|
|
}
|
|
|
|
KeyWord >>= 2;
|
|
31ec: 96 95 lsr r25
|
|
31ee: 87 95 ror r24
|
|
31f0: 96 95 lsr r25
|
|
31f2: 87 95 ror r24
|
|
uint8_t OddByte = 0;
|
|
uint16_t KeyWord = ((uint16_t) Key[2*i+1] << 8) | Key[2*i+0];
|
|
uint8_t j;
|
|
|
|
for (j=0; j<8; j++) {
|
|
EvenByte >>= 1;
|
|
31f4: 36 95 lsr r19
|
|
OddByte >>= 1;
|
|
31f6: 26 95 lsr r18
|
|
|
|
if (KeyWord & (1<<0)) {
|
|
EvenByte |= 0x80;
|
|
31f8: 43 2f mov r20, r19
|
|
31fa: 40 68 ori r20, 0x80 ; 128
|
|
31fc: 80 fd sbrc r24, 0
|
|
31fe: 34 2f mov r19, r20
|
|
}
|
|
|
|
if (KeyWord & (1<<1)) {
|
|
OddByte |= 0x80;
|
|
3200: 42 2f mov r20, r18
|
|
3202: 40 68 ori r20, 0x80 ; 128
|
|
3204: 81 fd sbrc r24, 1
|
|
3206: 24 2f mov r18, r20
|
|
}
|
|
|
|
KeyWord >>= 2;
|
|
3208: 96 95 lsr r25
|
|
320a: 87 95 ror r24
|
|
320c: 96 95 lsr r25
|
|
320e: 87 95 ror r24
|
|
uint8_t OddByte = 0;
|
|
uint16_t KeyWord = ((uint16_t) Key[2*i+1] << 8) | Key[2*i+0];
|
|
uint8_t j;
|
|
|
|
for (j=0; j<8; j++) {
|
|
EvenByte >>= 1;
|
|
3210: 36 95 lsr r19
|
|
OddByte >>= 1;
|
|
3212: 26 95 lsr r18
|
|
|
|
if (KeyWord & (1<<0)) {
|
|
EvenByte |= 0x80;
|
|
3214: 43 2f mov r20, r19
|
|
3216: 40 68 ori r20, 0x80 ; 128
|
|
3218: 80 fd sbrc r24, 0
|
|
321a: 34 2f mov r19, r20
|
|
}
|
|
|
|
if (KeyWord & (1<<1)) {
|
|
OddByte |= 0x80;
|
|
321c: 42 2f mov r20, r18
|
|
321e: 40 68 ori r20, 0x80 ; 128
|
|
3220: 81 fd sbrc r24, 1
|
|
3222: 24 2f mov r18, r20
|
|
}
|
|
|
|
KeyWord >>= 2;
|
|
3224: 96 95 lsr r25
|
|
3226: 87 95 ror r24
|
|
3228: 96 95 lsr r25
|
|
322a: 87 95 ror r24
|
|
uint8_t OddByte = 0;
|
|
uint16_t KeyWord = ((uint16_t) Key[2*i+1] << 8) | Key[2*i+0];
|
|
uint8_t j;
|
|
|
|
for (j=0; j<8; j++) {
|
|
EvenByte >>= 1;
|
|
322c: 36 95 lsr r19
|
|
OddByte >>= 1;
|
|
322e: 26 95 lsr r18
|
|
|
|
if (KeyWord & (1<<0)) {
|
|
EvenByte |= 0x80;
|
|
3230: 53 2f mov r21, r19
|
|
3232: 50 68 ori r21, 0x80 ; 128
|
|
}
|
|
|
|
if (KeyWord & (1<<1)) {
|
|
OddByte |= 0x80;
|
|
3234: 42 2f mov r20, r18
|
|
3236: 40 68 ori r20, 0x80 ; 128
|
|
}
|
|
|
|
KeyWord >>= 2;
|
|
}
|
|
|
|
StateEven[i] = EvenByte;
|
|
3238: 80 fd sbrc r24, 0
|
|
323a: 35 2f mov r19, r21
|
|
323c: 30 93 d5 20 sts 0x20D5, r19
|
|
StateOdd[i] = OddByte;
|
|
3240: 81 fd sbrc r24, 1
|
|
3242: 24 2f mov r18, r20
|
|
3244: 20 93 d2 20 sts 0x20D2, r18
|
|
* The inner loop generates 8 even and 8 odd bits from 16 key bits and
|
|
* the outer loop stores them. */
|
|
for (i=0; i<(LFSR_SIZE/2); i++) {
|
|
uint8_t EvenByte = 0;
|
|
uint8_t OddByte = 0;
|
|
uint16_t KeyWord = ((uint16_t) Key[2*i+1] << 8) | Key[2*i+0];
|
|
3248: 93 81 ldd r25, Z+3 ; 0x03
|
|
324a: 80 e0 ldi r24, 0x00 ; 0
|
|
324c: 22 81 ldd r18, Z+2 ; 0x02
|
|
324e: 82 2b or r24, r18
|
|
3250: 80 fd sbrc r24, 0
|
|
3252: 1b c1 rjmp .+566 ; 0x348a <Crypto1Setup+0x334>
|
|
3254: 30 e0 ldi r19, 0x00 ; 0
|
|
3256: 81 fd sbrc r24, 1
|
|
3258: 16 c1 rjmp .+556 ; 0x3486 <Crypto1Setup+0x330>
|
|
325a: 20 e0 ldi r18, 0x00 ; 0
|
|
|
|
if (KeyWord & (1<<1)) {
|
|
OddByte |= 0x80;
|
|
}
|
|
|
|
KeyWord >>= 2;
|
|
325c: 96 95 lsr r25
|
|
325e: 87 95 ror r24
|
|
3260: 96 95 lsr r25
|
|
3262: 87 95 ror r24
|
|
for (j=0; j<8; j++) {
|
|
EvenByte >>= 1;
|
|
OddByte >>= 1;
|
|
|
|
if (KeyWord & (1<<0)) {
|
|
EvenByte |= 0x80;
|
|
3264: 43 2f mov r20, r19
|
|
3266: 40 68 ori r20, 0x80 ; 128
|
|
3268: 80 fd sbrc r24, 0
|
|
326a: 34 2f mov r19, r20
|
|
}
|
|
|
|
if (KeyWord & (1<<1)) {
|
|
OddByte |= 0x80;
|
|
326c: 42 2f mov r20, r18
|
|
326e: 40 68 ori r20, 0x80 ; 128
|
|
3270: 81 fd sbrc r24, 1
|
|
3272: 24 2f mov r18, r20
|
|
}
|
|
|
|
KeyWord >>= 2;
|
|
3274: 96 95 lsr r25
|
|
3276: 87 95 ror r24
|
|
3278: 96 95 lsr r25
|
|
327a: 87 95 ror r24
|
|
uint8_t OddByte = 0;
|
|
uint16_t KeyWord = ((uint16_t) Key[2*i+1] << 8) | Key[2*i+0];
|
|
uint8_t j;
|
|
|
|
for (j=0; j<8; j++) {
|
|
EvenByte >>= 1;
|
|
327c: 36 95 lsr r19
|
|
OddByte >>= 1;
|
|
327e: 26 95 lsr r18
|
|
|
|
if (KeyWord & (1<<0)) {
|
|
EvenByte |= 0x80;
|
|
3280: 43 2f mov r20, r19
|
|
3282: 40 68 ori r20, 0x80 ; 128
|
|
3284: 80 fd sbrc r24, 0
|
|
3286: 34 2f mov r19, r20
|
|
}
|
|
|
|
if (KeyWord & (1<<1)) {
|
|
OddByte |= 0x80;
|
|
3288: 42 2f mov r20, r18
|
|
328a: 40 68 ori r20, 0x80 ; 128
|
|
328c: 81 fd sbrc r24, 1
|
|
328e: 24 2f mov r18, r20
|
|
}
|
|
|
|
KeyWord >>= 2;
|
|
3290: 96 95 lsr r25
|
|
3292: 87 95 ror r24
|
|
3294: 96 95 lsr r25
|
|
3296: 87 95 ror r24
|
|
uint8_t OddByte = 0;
|
|
uint16_t KeyWord = ((uint16_t) Key[2*i+1] << 8) | Key[2*i+0];
|
|
uint8_t j;
|
|
|
|
for (j=0; j<8; j++) {
|
|
EvenByte >>= 1;
|
|
3298: 36 95 lsr r19
|
|
OddByte >>= 1;
|
|
329a: 26 95 lsr r18
|
|
|
|
if (KeyWord & (1<<0)) {
|
|
EvenByte |= 0x80;
|
|
329c: 43 2f mov r20, r19
|
|
329e: 40 68 ori r20, 0x80 ; 128
|
|
32a0: 80 fd sbrc r24, 0
|
|
32a2: 34 2f mov r19, r20
|
|
}
|
|
|
|
if (KeyWord & (1<<1)) {
|
|
OddByte |= 0x80;
|
|
32a4: 42 2f mov r20, r18
|
|
32a6: 40 68 ori r20, 0x80 ; 128
|
|
32a8: 81 fd sbrc r24, 1
|
|
32aa: 24 2f mov r18, r20
|
|
}
|
|
|
|
KeyWord >>= 2;
|
|
32ac: 96 95 lsr r25
|
|
32ae: 87 95 ror r24
|
|
32b0: 96 95 lsr r25
|
|
32b2: 87 95 ror r24
|
|
uint8_t OddByte = 0;
|
|
uint16_t KeyWord = ((uint16_t) Key[2*i+1] << 8) | Key[2*i+0];
|
|
uint8_t j;
|
|
|
|
for (j=0; j<8; j++) {
|
|
EvenByte >>= 1;
|
|
32b4: 36 95 lsr r19
|
|
OddByte >>= 1;
|
|
32b6: 26 95 lsr r18
|
|
|
|
if (KeyWord & (1<<0)) {
|
|
EvenByte |= 0x80;
|
|
32b8: 43 2f mov r20, r19
|
|
32ba: 40 68 ori r20, 0x80 ; 128
|
|
32bc: 80 fd sbrc r24, 0
|
|
32be: 34 2f mov r19, r20
|
|
}
|
|
|
|
if (KeyWord & (1<<1)) {
|
|
OddByte |= 0x80;
|
|
32c0: 42 2f mov r20, r18
|
|
32c2: 40 68 ori r20, 0x80 ; 128
|
|
32c4: 81 fd sbrc r24, 1
|
|
32c6: 24 2f mov r18, r20
|
|
}
|
|
|
|
KeyWord >>= 2;
|
|
32c8: 96 95 lsr r25
|
|
32ca: 87 95 ror r24
|
|
32cc: 96 95 lsr r25
|
|
32ce: 87 95 ror r24
|
|
uint8_t OddByte = 0;
|
|
uint16_t KeyWord = ((uint16_t) Key[2*i+1] << 8) | Key[2*i+0];
|
|
uint8_t j;
|
|
|
|
for (j=0; j<8; j++) {
|
|
EvenByte >>= 1;
|
|
32d0: 36 95 lsr r19
|
|
OddByte >>= 1;
|
|
32d2: 26 95 lsr r18
|
|
|
|
if (KeyWord & (1<<0)) {
|
|
EvenByte |= 0x80;
|
|
32d4: 43 2f mov r20, r19
|
|
32d6: 40 68 ori r20, 0x80 ; 128
|
|
32d8: 80 fd sbrc r24, 0
|
|
32da: 34 2f mov r19, r20
|
|
}
|
|
|
|
if (KeyWord & (1<<1)) {
|
|
OddByte |= 0x80;
|
|
32dc: 42 2f mov r20, r18
|
|
32de: 40 68 ori r20, 0x80 ; 128
|
|
32e0: 81 fd sbrc r24, 1
|
|
32e2: 24 2f mov r18, r20
|
|
}
|
|
|
|
KeyWord >>= 2;
|
|
32e4: 96 95 lsr r25
|
|
32e6: 87 95 ror r24
|
|
32e8: 96 95 lsr r25
|
|
32ea: 87 95 ror r24
|
|
uint8_t OddByte = 0;
|
|
uint16_t KeyWord = ((uint16_t) Key[2*i+1] << 8) | Key[2*i+0];
|
|
uint8_t j;
|
|
|
|
for (j=0; j<8; j++) {
|
|
EvenByte >>= 1;
|
|
32ec: 36 95 lsr r19
|
|
OddByte >>= 1;
|
|
32ee: 26 95 lsr r18
|
|
|
|
if (KeyWord & (1<<0)) {
|
|
EvenByte |= 0x80;
|
|
32f0: 43 2f mov r20, r19
|
|
32f2: 40 68 ori r20, 0x80 ; 128
|
|
32f4: 80 fd sbrc r24, 0
|
|
32f6: 34 2f mov r19, r20
|
|
}
|
|
|
|
if (KeyWord & (1<<1)) {
|
|
OddByte |= 0x80;
|
|
32f8: 42 2f mov r20, r18
|
|
32fa: 40 68 ori r20, 0x80 ; 128
|
|
32fc: 81 fd sbrc r24, 1
|
|
32fe: 24 2f mov r18, r20
|
|
}
|
|
|
|
KeyWord >>= 2;
|
|
3300: 96 95 lsr r25
|
|
3302: 87 95 ror r24
|
|
3304: 96 95 lsr r25
|
|
3306: 87 95 ror r24
|
|
uint8_t OddByte = 0;
|
|
uint16_t KeyWord = ((uint16_t) Key[2*i+1] << 8) | Key[2*i+0];
|
|
uint8_t j;
|
|
|
|
for (j=0; j<8; j++) {
|
|
EvenByte >>= 1;
|
|
3308: 36 95 lsr r19
|
|
OddByte >>= 1;
|
|
330a: 26 95 lsr r18
|
|
|
|
if (KeyWord & (1<<0)) {
|
|
EvenByte |= 0x80;
|
|
330c: 53 2f mov r21, r19
|
|
330e: 50 68 ori r21, 0x80 ; 128
|
|
}
|
|
|
|
if (KeyWord & (1<<1)) {
|
|
OddByte |= 0x80;
|
|
3310: 42 2f mov r20, r18
|
|
3312: 40 68 ori r20, 0x80 ; 128
|
|
}
|
|
|
|
KeyWord >>= 2;
|
|
}
|
|
|
|
StateEven[i] = EvenByte;
|
|
3314: 80 fd sbrc r24, 0
|
|
3316: 35 2f mov r19, r21
|
|
3318: 30 93 d6 20 sts 0x20D6, r19
|
|
StateOdd[i] = OddByte;
|
|
331c: 81 fd sbrc r24, 1
|
|
331e: 24 2f mov r18, r20
|
|
3320: 20 93 d3 20 sts 0x20D3, r18
|
|
* The inner loop generates 8 even and 8 odd bits from 16 key bits and
|
|
* the outer loop stores them. */
|
|
for (i=0; i<(LFSR_SIZE/2); i++) {
|
|
uint8_t EvenByte = 0;
|
|
uint8_t OddByte = 0;
|
|
uint16_t KeyWord = ((uint16_t) Key[2*i+1] << 8) | Key[2*i+0];
|
|
3324: 95 81 ldd r25, Z+5 ; 0x05
|
|
3326: 80 e0 ldi r24, 0x00 ; 0
|
|
3328: 24 81 ldd r18, Z+4 ; 0x04
|
|
332a: 82 2b or r24, r18
|
|
332c: 80 fd sbrc r24, 0
|
|
332e: a9 c0 rjmp .+338 ; 0x3482 <Crypto1Setup+0x32c>
|
|
3330: 30 e0 ldi r19, 0x00 ; 0
|
|
3332: 81 fd sbrc r24, 1
|
|
3334: a4 c0 rjmp .+328 ; 0x347e <Crypto1Setup+0x328>
|
|
3336: 20 e0 ldi r18, 0x00 ; 0
|
|
|
|
if (KeyWord & (1<<1)) {
|
|
OddByte |= 0x80;
|
|
}
|
|
|
|
KeyWord >>= 2;
|
|
3338: 96 95 lsr r25
|
|
333a: 87 95 ror r24
|
|
333c: 96 95 lsr r25
|
|
333e: 87 95 ror r24
|
|
for (j=0; j<8; j++) {
|
|
EvenByte >>= 1;
|
|
OddByte >>= 1;
|
|
|
|
if (KeyWord & (1<<0)) {
|
|
EvenByte |= 0x80;
|
|
3340: 43 2f mov r20, r19
|
|
3342: 40 68 ori r20, 0x80 ; 128
|
|
3344: 80 fd sbrc r24, 0
|
|
3346: 34 2f mov r19, r20
|
|
}
|
|
|
|
if (KeyWord & (1<<1)) {
|
|
OddByte |= 0x80;
|
|
3348: 42 2f mov r20, r18
|
|
334a: 40 68 ori r20, 0x80 ; 128
|
|
334c: 81 fd sbrc r24, 1
|
|
334e: 24 2f mov r18, r20
|
|
}
|
|
|
|
KeyWord >>= 2;
|
|
3350: 96 95 lsr r25
|
|
3352: 87 95 ror r24
|
|
3354: 96 95 lsr r25
|
|
3356: 87 95 ror r24
|
|
uint8_t OddByte = 0;
|
|
uint16_t KeyWord = ((uint16_t) Key[2*i+1] << 8) | Key[2*i+0];
|
|
uint8_t j;
|
|
|
|
for (j=0; j<8; j++) {
|
|
EvenByte >>= 1;
|
|
3358: 36 95 lsr r19
|
|
OddByte >>= 1;
|
|
335a: 26 95 lsr r18
|
|
|
|
if (KeyWord & (1<<0)) {
|
|
EvenByte |= 0x80;
|
|
335c: 43 2f mov r20, r19
|
|
335e: 40 68 ori r20, 0x80 ; 128
|
|
3360: 80 fd sbrc r24, 0
|
|
3362: 34 2f mov r19, r20
|
|
}
|
|
|
|
if (KeyWord & (1<<1)) {
|
|
OddByte |= 0x80;
|
|
3364: 42 2f mov r20, r18
|
|
3366: 40 68 ori r20, 0x80 ; 128
|
|
3368: 81 fd sbrc r24, 1
|
|
336a: 24 2f mov r18, r20
|
|
}
|
|
|
|
KeyWord >>= 2;
|
|
336c: 96 95 lsr r25
|
|
336e: 87 95 ror r24
|
|
3370: 96 95 lsr r25
|
|
3372: 87 95 ror r24
|
|
uint8_t OddByte = 0;
|
|
uint16_t KeyWord = ((uint16_t) Key[2*i+1] << 8) | Key[2*i+0];
|
|
uint8_t j;
|
|
|
|
for (j=0; j<8; j++) {
|
|
EvenByte >>= 1;
|
|
3374: 36 95 lsr r19
|
|
OddByte >>= 1;
|
|
3376: 26 95 lsr r18
|
|
|
|
if (KeyWord & (1<<0)) {
|
|
EvenByte |= 0x80;
|
|
3378: 43 2f mov r20, r19
|
|
337a: 40 68 ori r20, 0x80 ; 128
|
|
337c: 80 fd sbrc r24, 0
|
|
337e: 34 2f mov r19, r20
|
|
}
|
|
|
|
if (KeyWord & (1<<1)) {
|
|
OddByte |= 0x80;
|
|
3380: 42 2f mov r20, r18
|
|
3382: 40 68 ori r20, 0x80 ; 128
|
|
3384: 81 fd sbrc r24, 1
|
|
3386: 24 2f mov r18, r20
|
|
}
|
|
|
|
KeyWord >>= 2;
|
|
3388: 96 95 lsr r25
|
|
338a: 87 95 ror r24
|
|
338c: 96 95 lsr r25
|
|
338e: 87 95 ror r24
|
|
uint8_t OddByte = 0;
|
|
uint16_t KeyWord = ((uint16_t) Key[2*i+1] << 8) | Key[2*i+0];
|
|
uint8_t j;
|
|
|
|
for (j=0; j<8; j++) {
|
|
EvenByte >>= 1;
|
|
3390: 36 95 lsr r19
|
|
OddByte >>= 1;
|
|
3392: 26 95 lsr r18
|
|
|
|
if (KeyWord & (1<<0)) {
|
|
EvenByte |= 0x80;
|
|
3394: 43 2f mov r20, r19
|
|
3396: 40 68 ori r20, 0x80 ; 128
|
|
3398: 80 fd sbrc r24, 0
|
|
339a: 34 2f mov r19, r20
|
|
}
|
|
|
|
if (KeyWord & (1<<1)) {
|
|
OddByte |= 0x80;
|
|
339c: 42 2f mov r20, r18
|
|
339e: 40 68 ori r20, 0x80 ; 128
|
|
33a0: 81 fd sbrc r24, 1
|
|
33a2: 24 2f mov r18, r20
|
|
}
|
|
|
|
KeyWord >>= 2;
|
|
33a4: 96 95 lsr r25
|
|
33a6: 87 95 ror r24
|
|
33a8: 96 95 lsr r25
|
|
33aa: 87 95 ror r24
|
|
uint8_t OddByte = 0;
|
|
uint16_t KeyWord = ((uint16_t) Key[2*i+1] << 8) | Key[2*i+0];
|
|
uint8_t j;
|
|
|
|
for (j=0; j<8; j++) {
|
|
EvenByte >>= 1;
|
|
33ac: 36 95 lsr r19
|
|
OddByte >>= 1;
|
|
33ae: 26 95 lsr r18
|
|
|
|
if (KeyWord & (1<<0)) {
|
|
EvenByte |= 0x80;
|
|
33b0: 43 2f mov r20, r19
|
|
33b2: 40 68 ori r20, 0x80 ; 128
|
|
33b4: 80 fd sbrc r24, 0
|
|
33b6: 34 2f mov r19, r20
|
|
}
|
|
|
|
if (KeyWord & (1<<1)) {
|
|
OddByte |= 0x80;
|
|
33b8: 42 2f mov r20, r18
|
|
33ba: 40 68 ori r20, 0x80 ; 128
|
|
33bc: 81 fd sbrc r24, 1
|
|
33be: 24 2f mov r18, r20
|
|
}
|
|
|
|
KeyWord >>= 2;
|
|
33c0: 96 95 lsr r25
|
|
33c2: 87 95 ror r24
|
|
33c4: 96 95 lsr r25
|
|
33c6: 87 95 ror r24
|
|
uint8_t OddByte = 0;
|
|
uint16_t KeyWord = ((uint16_t) Key[2*i+1] << 8) | Key[2*i+0];
|
|
uint8_t j;
|
|
|
|
for (j=0; j<8; j++) {
|
|
EvenByte >>= 1;
|
|
33c8: 36 95 lsr r19
|
|
OddByte >>= 1;
|
|
33ca: 26 95 lsr r18
|
|
|
|
if (KeyWord & (1<<0)) {
|
|
EvenByte |= 0x80;
|
|
33cc: 43 2f mov r20, r19
|
|
33ce: 40 68 ori r20, 0x80 ; 128
|
|
33d0: 80 fd sbrc r24, 0
|
|
33d2: 34 2f mov r19, r20
|
|
}
|
|
|
|
if (KeyWord & (1<<1)) {
|
|
OddByte |= 0x80;
|
|
33d4: 42 2f mov r20, r18
|
|
33d6: 40 68 ori r20, 0x80 ; 128
|
|
33d8: 81 fd sbrc r24, 1
|
|
33da: 24 2f mov r18, r20
|
|
}
|
|
|
|
KeyWord >>= 2;
|
|
33dc: 96 95 lsr r25
|
|
33de: 87 95 ror r24
|
|
33e0: 96 95 lsr r25
|
|
33e2: 87 95 ror r24
|
|
uint8_t OddByte = 0;
|
|
uint16_t KeyWord = ((uint16_t) Key[2*i+1] << 8) | Key[2*i+0];
|
|
uint8_t j;
|
|
|
|
for (j=0; j<8; j++) {
|
|
EvenByte >>= 1;
|
|
33e4: 36 95 lsr r19
|
|
OddByte >>= 1;
|
|
33e6: 26 95 lsr r18
|
|
|
|
if (KeyWord & (1<<0)) {
|
|
EvenByte |= 0x80;
|
|
33e8: 53 2f mov r21, r19
|
|
33ea: 50 68 ori r21, 0x80 ; 128
|
|
}
|
|
|
|
if (KeyWord & (1<<1)) {
|
|
OddByte |= 0x80;
|
|
33ec: 42 2f mov r20, r18
|
|
33ee: 40 68 ori r20, 0x80 ; 128
|
|
}
|
|
|
|
KeyWord >>= 2;
|
|
}
|
|
|
|
StateEven[i] = EvenByte;
|
|
33f0: 80 fd sbrc r24, 0
|
|
33f2: 35 2f mov r19, r21
|
|
33f4: 30 93 d7 20 sts 0x20D7, r19
|
|
StateOdd[i] = OddByte;
|
|
33f8: 81 fd sbrc r24, 1
|
|
33fa: 24 2f mov r18, r20
|
|
33fc: 20 93 d4 20 sts 0x20D4, r18
|
|
/* Use Uid XOR CardNonce as feed-in and do 32 clocks on the
|
|
* Crypto1 LFSR.*/
|
|
uint32_t Temp = 0;
|
|
|
|
Temp |= (uint32_t) (Uid[0] ^ CardNonce[0]) << 0;
|
|
Temp |= (uint32_t) (Uid[1] ^ CardNonce[1]) << 8;
|
|
3400: 89 81 ldd r24, Y+1 ; 0x01
|
|
3402: 11 96 adiw r26, 0x01 ; 1
|
|
3404: 9c 91 ld r25, X
|
|
3406: 11 97 sbiw r26, 0x01 ; 1
|
|
3408: 89 27 eor r24, r25
|
|
Temp |= (uint32_t) (Uid[2] ^ CardNonce[2]) << 16;
|
|
340a: ca 80 ldd r12, Y+2 ; 0x02
|
|
340c: 12 96 adiw r26, 0x02 ; 2
|
|
340e: 9c 91 ld r25, X
|
|
3410: 12 97 sbiw r26, 0x02 ; 2
|
|
3412: c9 26 eor r12, r25
|
|
3414: d1 2c mov r13, r1
|
|
3416: e1 2c mov r14, r1
|
|
3418: f1 2c mov r15, r1
|
|
341a: 76 01 movw r14, r12
|
|
341c: dd 24 eor r13, r13
|
|
341e: cc 24 eor r12, r12
|
|
/* Use Uid XOR CardNonce as feed-in and do 32 clocks on the
|
|
* Crypto1 LFSR.*/
|
|
uint32_t Temp = 0;
|
|
|
|
Temp |= (uint32_t) (Uid[0] ^ CardNonce[0]) << 0;
|
|
Temp |= (uint32_t) (Uid[1] ^ CardNonce[1]) << 8;
|
|
3420: d8 2a or r13, r24
|
|
|
|
/* Use Uid XOR CardNonce as feed-in and do 32 clocks on the
|
|
* Crypto1 LFSR.*/
|
|
uint32_t Temp = 0;
|
|
|
|
Temp |= (uint32_t) (Uid[0] ^ CardNonce[0]) << 0;
|
|
3422: 88 81 ld r24, Y
|
|
3424: 9c 91 ld r25, X
|
|
3426: 89 27 eor r24, r25
|
|
Temp |= (uint32_t) (Uid[1] ^ CardNonce[1]) << 8;
|
|
Temp |= (uint32_t) (Uid[2] ^ CardNonce[2]) << 16;
|
|
3428: c8 2a or r12, r24
|
|
Temp |= (uint32_t) (Uid[3] ^ CardNonce[3]) << 24;
|
|
342a: 8b 81 ldd r24, Y+3 ; 0x03
|
|
342c: 13 96 adiw r26, 0x03 ; 3
|
|
342e: 9c 91 ld r25, X
|
|
3430: 89 27 eor r24, r25
|
|
3432: f8 2a or r15, r24
|
|
3434: 10 e2 ldi r17, 0x20 ; 32
|
|
|
|
for (i=0; i<32; i++) {
|
|
uint8_t Out = Crypto1FilterOutput();
|
|
3436: 5b de rcall .-842 ; 0x30ee <Crypto1FilterOutput>
|
|
3438: 08 2f mov r16, r24
|
|
|
|
Crypto1LFSR(Temp & 0x01);
|
|
343a: 8c 2d mov r24, r12
|
|
343c: 81 70 andi r24, 0x01 ; 1
|
|
343e: 11 de rcall .-990 ; 0x3062 <Crypto1LFSR>
|
|
Temp >>= 1;
|
|
3440: f6 94 lsr r15
|
|
3442: e7 94 ror r14
|
|
3444: d7 94 ror r13
|
|
3446: c7 94 ror r12
|
|
|
|
/* Store the keystream for later use */
|
|
if (Out) {
|
|
3448: 00 23 and r16, r16
|
|
344a: 11 f0 breq .+4 ; 0x3450 <Crypto1Setup+0x2fa>
|
|
Temp |= (uint32_t) 1 << 31;
|
|
344c: 68 94 set
|
|
344e: f7 f8 bld r15, 7
|
|
3450: 11 50 subi r17, 0x01 ; 1
|
|
Temp |= (uint32_t) (Uid[0] ^ CardNonce[0]) << 0;
|
|
Temp |= (uint32_t) (Uid[1] ^ CardNonce[1]) << 8;
|
|
Temp |= (uint32_t) (Uid[2] ^ CardNonce[2]) << 16;
|
|
Temp |= (uint32_t) (Uid[3] ^ CardNonce[3]) << 24;
|
|
|
|
for (i=0; i<32; i++) {
|
|
3452: 89 f7 brne .-30 ; 0x3436 <Crypto1Setup+0x2e0>
|
|
}
|
|
|
|
/* Crypto1 state register is now set up to be used for authentication.
|
|
* In case of nested authentication, we need to use the produced keystream
|
|
* to encrypt the CardNonce. For this case we do the encryption in-place. */
|
|
CardNonce[0] ^= (uint8_t) (Temp >> 0);
|
|
3454: 88 81 ld r24, Y
|
|
3456: 8c 25 eor r24, r12
|
|
3458: 88 83 st Y, r24
|
|
CardNonce[1] ^= (uint8_t) (Temp >> 8);
|
|
345a: 89 81 ldd r24, Y+1 ; 0x01
|
|
345c: 8d 25 eor r24, r13
|
|
345e: 89 83 std Y+1, r24 ; 0x01
|
|
CardNonce[2] ^= (uint8_t) (Temp >> 16);
|
|
3460: 8a 81 ldd r24, Y+2 ; 0x02
|
|
3462: 8e 25 eor r24, r14
|
|
3464: 8a 83 std Y+2, r24 ; 0x02
|
|
CardNonce[3] ^= (uint8_t) (Temp >> 24);
|
|
3466: 8b 81 ldd r24, Y+3 ; 0x03
|
|
3468: 8f 25 eor r24, r15
|
|
346a: 8b 83 std Y+3, r24 ; 0x03
|
|
}
|
|
346c: df 91 pop r29
|
|
346e: cf 91 pop r28
|
|
3470: 1f 91 pop r17
|
|
3472: 0f 91 pop r16
|
|
3474: ff 90 pop r15
|
|
3476: ef 90 pop r14
|
|
3478: df 90 pop r13
|
|
347a: cf 90 pop r12
|
|
347c: 08 95 ret
|
|
347e: 20 e4 ldi r18, 0x40 ; 64
|
|
3480: 5b cf rjmp .-330 ; 0x3338 <Crypto1Setup+0x1e2>
|
|
3482: 30 e4 ldi r19, 0x40 ; 64
|
|
3484: 56 cf rjmp .-340 ; 0x3332 <Crypto1Setup+0x1dc>
|
|
3486: 20 e4 ldi r18, 0x40 ; 64
|
|
3488: e9 ce rjmp .-558 ; 0x325c <Crypto1Setup+0x106>
|
|
348a: 30 e4 ldi r19, 0x40 ; 64
|
|
348c: e4 ce rjmp .-568 ; 0x3256 <Crypto1Setup+0x100>
|
|
348e: 20 e4 ldi r18, 0x40 ; 64
|
|
3490: 77 ce rjmp .-786 ; 0x3180 <Crypto1Setup+0x2a>
|
|
3492: 30 e4 ldi r19, 0x40 ; 64
|
|
3494: 72 ce rjmp .-796 ; 0x317a <Crypto1Setup+0x24>
|
|
|
|
00003496 <Crypto1Auth>:
|
|
|
|
void Crypto1Auth(uint8_t EncryptedReaderNonce[4])
|
|
{
|
|
3496: cf 92 push r12
|
|
3498: df 92 push r13
|
|
349a: ef 92 push r14
|
|
349c: ff 92 push r15
|
|
349e: cf 93 push r28
|
|
34a0: fc 01 movw r30, r24
|
|
uint32_t Temp = 0;
|
|
|
|
/* For ease of processing, we convert the encrypted reader nonce
|
|
* into a 32 bit integer */
|
|
Temp |= (uint32_t) EncryptedReaderNonce[0] << 0;
|
|
Temp |= (uint32_t) EncryptedReaderNonce[1] << 8;
|
|
34a2: 81 81 ldd r24, Z+1 ; 0x01
|
|
Temp |= (uint32_t) EncryptedReaderNonce[2] << 16;
|
|
34a4: c2 80 ldd r12, Z+2 ; 0x02
|
|
34a6: d1 2c mov r13, r1
|
|
34a8: e1 2c mov r14, r1
|
|
34aa: f1 2c mov r15, r1
|
|
34ac: 76 01 movw r14, r12
|
|
34ae: dd 24 eor r13, r13
|
|
34b0: cc 24 eor r12, r12
|
|
uint32_t Temp = 0;
|
|
|
|
/* For ease of processing, we convert the encrypted reader nonce
|
|
* into a 32 bit integer */
|
|
Temp |= (uint32_t) EncryptedReaderNonce[0] << 0;
|
|
Temp |= (uint32_t) EncryptedReaderNonce[1] << 8;
|
|
34b2: d8 2a or r13, r24
|
|
{
|
|
uint32_t Temp = 0;
|
|
|
|
/* For ease of processing, we convert the encrypted reader nonce
|
|
* into a 32 bit integer */
|
|
Temp |= (uint32_t) EncryptedReaderNonce[0] << 0;
|
|
34b4: 80 81 ld r24, Z
|
|
Temp |= (uint32_t) EncryptedReaderNonce[1] << 8;
|
|
Temp |= (uint32_t) EncryptedReaderNonce[2] << 16;
|
|
34b6: c8 2a or r12, r24
|
|
Temp |= (uint32_t) EncryptedReaderNonce[3] << 24;
|
|
34b8: 83 81 ldd r24, Z+3 ; 0x03
|
|
34ba: f8 2a or r15, r24
|
|
34bc: c0 e2 ldi r28, 0x20 ; 32
|
|
uint8_t i;
|
|
|
|
for (i=0; i<32; i++) {
|
|
/* Decrypt one output bit of the given encrypted nonce using the
|
|
* filter output as keystream. */
|
|
uint8_t Out = Crypto1FilterOutput();
|
|
34be: 17 de rcall .-978 ; 0x30ee <Crypto1FilterOutput>
|
|
uint8_t Bit = Out ^ (Temp & 0x01);
|
|
34c0: b7 01 movw r22, r14
|
|
34c2: a6 01 movw r20, r12
|
|
34c4: 41 70 andi r20, 0x01 ; 1
|
|
34c6: 55 27 eor r21, r21
|
|
34c8: 66 27 eor r22, r22
|
|
34ca: 77 27 eor r23, r23
|
|
|
|
/* Feed back the bit to load the LFSR with the (decrypted) nonce */
|
|
Crypto1LFSR(Bit);
|
|
34cc: 84 27 eor r24, r20
|
|
34ce: c9 dd rcall .-1134 ; 0x3062 <Crypto1LFSR>
|
|
Temp >>= 1;
|
|
34d0: f6 94 lsr r15
|
|
34d2: e7 94 ror r14
|
|
34d4: d7 94 ror r13
|
|
34d6: c7 94 ror r12
|
|
34d8: c1 50 subi r28, 0x01 ; 1
|
|
Temp |= (uint32_t) EncryptedReaderNonce[2] << 16;
|
|
Temp |= (uint32_t) EncryptedReaderNonce[3] << 24;
|
|
|
|
uint8_t i;
|
|
|
|
for (i=0; i<32; i++) {
|
|
34da: 89 f7 brne .-30 ; 0x34be <Crypto1Auth+0x28>
|
|
|
|
/* Feed back the bit to load the LFSR with the (decrypted) nonce */
|
|
Crypto1LFSR(Bit);
|
|
Temp >>= 1;
|
|
}
|
|
}
|
|
34dc: cf 91 pop r28
|
|
34de: ff 90 pop r15
|
|
34e0: ef 90 pop r14
|
|
34e2: df 90 pop r13
|
|
34e4: cf 90 pop r12
|
|
34e6: 08 95 ret
|
|
|
|
000034e8 <Crypto1Byte>:
|
|
|
|
uint8_t Crypto1Byte(void)
|
|
{
|
|
34e8: cf 93 push r28
|
|
34ea: df 93 push r29
|
|
/* Generate 8 keystream-bits */
|
|
for (i=0; i<8; i++) {
|
|
|
|
/* Calculate output of function-network and cycle LFSR with no
|
|
* additional input, thus linearly! */
|
|
uint8_t Out = Crypto1FilterOutput();
|
|
34ec: 00 de rcall .-1024 ; 0x30ee <Crypto1FilterOutput>
|
|
34ee: c8 2f mov r28, r24
|
|
Crypto1LFSR(0);
|
|
34f0: 80 e0 ldi r24, 0x00 ; 0
|
|
34f2: b7 dd rcall .-1170 ; 0x3062 <Crypto1LFSR>
|
|
|
|
/* Store keystream bit */
|
|
KeyStream >>= 1;
|
|
|
|
if (Out) {
|
|
34f4: cc 23 and r28, r28
|
|
34f6: 09 f4 brne .+2 ; 0x34fa <Crypto1Byte+0x12>
|
|
34f8: 36 c0 rjmp .+108 ; 0x3566 <Crypto1Byte+0x7e>
|
|
KeyStream |= (1<<7);
|
|
34fa: c0 e8 ldi r28, 0x80 ; 128
|
|
/* Generate 8 keystream-bits */
|
|
for (i=0; i<8; i++) {
|
|
|
|
/* Calculate output of function-network and cycle LFSR with no
|
|
* additional input, thus linearly! */
|
|
uint8_t Out = Crypto1FilterOutput();
|
|
34fc: f8 dd rcall .-1040 ; 0x30ee <Crypto1FilterOutput>
|
|
34fe: d8 2f mov r29, r24
|
|
Crypto1LFSR(0);
|
|
3500: 80 e0 ldi r24, 0x00 ; 0
|
|
3502: af dd rcall .-1186 ; 0x3062 <Crypto1LFSR>
|
|
|
|
/* Store keystream bit */
|
|
KeyStream >>= 1;
|
|
3504: c6 95 lsr r28
|
|
|
|
if (Out) {
|
|
3506: d1 11 cpse r29, r1
|
|
KeyStream |= (1<<7);
|
|
3508: c0 68 ori r28, 0x80 ; 128
|
|
/* Generate 8 keystream-bits */
|
|
for (i=0; i<8; i++) {
|
|
|
|
/* Calculate output of function-network and cycle LFSR with no
|
|
* additional input, thus linearly! */
|
|
uint8_t Out = Crypto1FilterOutput();
|
|
350a: f1 dd rcall .-1054 ; 0x30ee <Crypto1FilterOutput>
|
|
350c: d8 2f mov r29, r24
|
|
Crypto1LFSR(0);
|
|
350e: 80 e0 ldi r24, 0x00 ; 0
|
|
3510: a8 dd rcall .-1200 ; 0x3062 <Crypto1LFSR>
|
|
|
|
/* Store keystream bit */
|
|
KeyStream >>= 1;
|
|
3512: c6 95 lsr r28
|
|
|
|
if (Out) {
|
|
3514: d1 11 cpse r29, r1
|
|
KeyStream |= (1<<7);
|
|
3516: c0 68 ori r28, 0x80 ; 128
|
|
/* Generate 8 keystream-bits */
|
|
for (i=0; i<8; i++) {
|
|
|
|
/* Calculate output of function-network and cycle LFSR with no
|
|
* additional input, thus linearly! */
|
|
uint8_t Out = Crypto1FilterOutput();
|
|
3518: ea dd rcall .-1068 ; 0x30ee <Crypto1FilterOutput>
|
|
351a: d8 2f mov r29, r24
|
|
Crypto1LFSR(0);
|
|
351c: 80 e0 ldi r24, 0x00 ; 0
|
|
351e: a1 dd rcall .-1214 ; 0x3062 <Crypto1LFSR>
|
|
|
|
/* Store keystream bit */
|
|
KeyStream >>= 1;
|
|
3520: c6 95 lsr r28
|
|
|
|
if (Out) {
|
|
3522: d1 11 cpse r29, r1
|
|
KeyStream |= (1<<7);
|
|
3524: c0 68 ori r28, 0x80 ; 128
|
|
/* Generate 8 keystream-bits */
|
|
for (i=0; i<8; i++) {
|
|
|
|
/* Calculate output of function-network and cycle LFSR with no
|
|
* additional input, thus linearly! */
|
|
uint8_t Out = Crypto1FilterOutput();
|
|
3526: e3 dd rcall .-1082 ; 0x30ee <Crypto1FilterOutput>
|
|
3528: d8 2f mov r29, r24
|
|
Crypto1LFSR(0);
|
|
352a: 80 e0 ldi r24, 0x00 ; 0
|
|
352c: 9a dd rcall .-1228 ; 0x3062 <Crypto1LFSR>
|
|
|
|
/* Store keystream bit */
|
|
KeyStream >>= 1;
|
|
352e: c6 95 lsr r28
|
|
|
|
if (Out) {
|
|
3530: d1 11 cpse r29, r1
|
|
KeyStream |= (1<<7);
|
|
3532: c0 68 ori r28, 0x80 ; 128
|
|
/* Generate 8 keystream-bits */
|
|
for (i=0; i<8; i++) {
|
|
|
|
/* Calculate output of function-network and cycle LFSR with no
|
|
* additional input, thus linearly! */
|
|
uint8_t Out = Crypto1FilterOutput();
|
|
3534: dc dd rcall .-1096 ; 0x30ee <Crypto1FilterOutput>
|
|
3536: d8 2f mov r29, r24
|
|
Crypto1LFSR(0);
|
|
3538: 80 e0 ldi r24, 0x00 ; 0
|
|
353a: 93 dd rcall .-1242 ; 0x3062 <Crypto1LFSR>
|
|
|
|
/* Store keystream bit */
|
|
KeyStream >>= 1;
|
|
353c: c6 95 lsr r28
|
|
|
|
if (Out) {
|
|
353e: d1 11 cpse r29, r1
|
|
KeyStream |= (1<<7);
|
|
3540: c0 68 ori r28, 0x80 ; 128
|
|
/* Generate 8 keystream-bits */
|
|
for (i=0; i<8; i++) {
|
|
|
|
/* Calculate output of function-network and cycle LFSR with no
|
|
* additional input, thus linearly! */
|
|
uint8_t Out = Crypto1FilterOutput();
|
|
3542: d5 dd rcall .-1110 ; 0x30ee <Crypto1FilterOutput>
|
|
3544: d8 2f mov r29, r24
|
|
Crypto1LFSR(0);
|
|
3546: 80 e0 ldi r24, 0x00 ; 0
|
|
3548: 8c dd rcall .-1256 ; 0x3062 <Crypto1LFSR>
|
|
|
|
/* Store keystream bit */
|
|
KeyStream >>= 1;
|
|
354a: c6 95 lsr r28
|
|
|
|
if (Out) {
|
|
354c: d1 11 cpse r29, r1
|
|
KeyStream |= (1<<7);
|
|
354e: c0 68 ori r28, 0x80 ; 128
|
|
/* Generate 8 keystream-bits */
|
|
for (i=0; i<8; i++) {
|
|
|
|
/* Calculate output of function-network and cycle LFSR with no
|
|
* additional input, thus linearly! */
|
|
uint8_t Out = Crypto1FilterOutput();
|
|
3550: ce dd rcall .-1124 ; 0x30ee <Crypto1FilterOutput>
|
|
3552: d8 2f mov r29, r24
|
|
Crypto1LFSR(0);
|
|
3554: 80 e0 ldi r24, 0x00 ; 0
|
|
3556: 85 dd rcall .-1270 ; 0x3062 <Crypto1LFSR>
|
|
|
|
/* Store keystream bit */
|
|
KeyStream >>= 1;
|
|
3558: 8c 2f mov r24, r28
|
|
355a: 86 95 lsr r24
|
|
|
|
if (Out) {
|
|
355c: d1 11 cpse r29, r1
|
|
KeyStream |= (1<<7);
|
|
355e: 80 68 ori r24, 0x80 ; 128
|
|
}
|
|
}
|
|
|
|
return KeyStream;
|
|
}
|
|
3560: df 91 pop r29
|
|
3562: cf 91 pop r28
|
|
3564: 08 95 ret
|
|
* additional input, thus linearly! */
|
|
uint8_t Out = Crypto1FilterOutput();
|
|
Crypto1LFSR(0);
|
|
|
|
/* Store keystream bit */
|
|
KeyStream >>= 1;
|
|
3566: c0 e0 ldi r28, 0x00 ; 0
|
|
3568: c9 cf rjmp .-110 ; 0x34fc <Crypto1Byte+0x14>
|
|
|
|
0000356a <Crypto1Nibble>:
|
|
|
|
return KeyStream;
|
|
}
|
|
|
|
uint8_t Crypto1Nibble(void)
|
|
{
|
|
356a: cf 93 push r28
|
|
356c: df 93 push r29
|
|
/* Generate 4 keystream-bits */
|
|
for (i=0; i<4; i++) {
|
|
|
|
/* Calculate output of function-network and cycle LFSR with no
|
|
* additional input, thus linearly! */
|
|
uint8_t Out = Crypto1FilterOutput();
|
|
356e: bf dd rcall .-1154 ; 0x30ee <Crypto1FilterOutput>
|
|
3570: c8 2f mov r28, r24
|
|
Crypto1LFSR(0);
|
|
3572: 80 e0 ldi r24, 0x00 ; 0
|
|
3574: 76 dd rcall .-1300 ; 0x3062 <Crypto1LFSR>
|
|
|
|
/* Store keystream bit */
|
|
KeyStream >>= 1;
|
|
|
|
if (Out) {
|
|
3576: cc 23 and r28, r28
|
|
3578: d1 f0 breq .+52 ; 0x35ae <Crypto1Nibble+0x44>
|
|
KeyStream |= (1<<3);
|
|
357a: c8 e0 ldi r28, 0x08 ; 8
|
|
/* Generate 4 keystream-bits */
|
|
for (i=0; i<4; i++) {
|
|
|
|
/* Calculate output of function-network and cycle LFSR with no
|
|
* additional input, thus linearly! */
|
|
uint8_t Out = Crypto1FilterOutput();
|
|
357c: b8 dd rcall .-1168 ; 0x30ee <Crypto1FilterOutput>
|
|
357e: d8 2f mov r29, r24
|
|
Crypto1LFSR(0);
|
|
3580: 80 e0 ldi r24, 0x00 ; 0
|
|
3582: 6f dd rcall .-1314 ; 0x3062 <Crypto1LFSR>
|
|
|
|
/* Store keystream bit */
|
|
KeyStream >>= 1;
|
|
3584: c6 95 lsr r28
|
|
|
|
if (Out) {
|
|
3586: d1 11 cpse r29, r1
|
|
KeyStream |= (1<<3);
|
|
3588: c8 60 ori r28, 0x08 ; 8
|
|
/* Generate 4 keystream-bits */
|
|
for (i=0; i<4; i++) {
|
|
|
|
/* Calculate output of function-network and cycle LFSR with no
|
|
* additional input, thus linearly! */
|
|
uint8_t Out = Crypto1FilterOutput();
|
|
358a: b1 dd rcall .-1182 ; 0x30ee <Crypto1FilterOutput>
|
|
358c: d8 2f mov r29, r24
|
|
Crypto1LFSR(0);
|
|
358e: 80 e0 ldi r24, 0x00 ; 0
|
|
3590: 68 dd rcall .-1328 ; 0x3062 <Crypto1LFSR>
|
|
|
|
/* Store keystream bit */
|
|
KeyStream >>= 1;
|
|
3592: c6 95 lsr r28
|
|
|
|
if (Out) {
|
|
3594: d1 11 cpse r29, r1
|
|
KeyStream |= (1<<3);
|
|
3596: c8 60 ori r28, 0x08 ; 8
|
|
/* Generate 4 keystream-bits */
|
|
for (i=0; i<4; i++) {
|
|
|
|
/* Calculate output of function-network and cycle LFSR with no
|
|
* additional input, thus linearly! */
|
|
uint8_t Out = Crypto1FilterOutput();
|
|
3598: aa dd rcall .-1196 ; 0x30ee <Crypto1FilterOutput>
|
|
359a: d8 2f mov r29, r24
|
|
Crypto1LFSR(0);
|
|
359c: 80 e0 ldi r24, 0x00 ; 0
|
|
359e: 61 dd rcall .-1342 ; 0x3062 <Crypto1LFSR>
|
|
|
|
/* Store keystream bit */
|
|
KeyStream >>= 1;
|
|
35a0: 8c 2f mov r24, r28
|
|
35a2: 86 95 lsr r24
|
|
|
|
if (Out) {
|
|
35a4: d1 11 cpse r29, r1
|
|
KeyStream |= (1<<3);
|
|
35a6: 88 60 ori r24, 0x08 ; 8
|
|
}
|
|
}
|
|
|
|
return KeyStream;
|
|
}
|
|
35a8: df 91 pop r29
|
|
35aa: cf 91 pop r28
|
|
35ac: 08 95 ret
|
|
* additional input, thus linearly! */
|
|
uint8_t Out = Crypto1FilterOutput();
|
|
Crypto1LFSR(0);
|
|
|
|
/* Store keystream bit */
|
|
KeyStream >>= 1;
|
|
35ae: c0 e0 ldi r28, 0x00 ; 0
|
|
35b0: e5 cf rjmp .-54 ; 0x357c <Crypto1Nibble+0x12>
|
|
|
|
000035b2 <Crypto1PRNG>:
|
|
|
|
return KeyStream;
|
|
}
|
|
|
|
void Crypto1PRNG(uint8_t State[4], uint16_t ClockCount)
|
|
{
|
|
35b2: 6f 92 push r6
|
|
35b4: 7f 92 push r7
|
|
35b6: 8f 92 push r8
|
|
35b8: 9f 92 push r9
|
|
35ba: af 92 push r10
|
|
35bc: bf 92 push r11
|
|
35be: cf 92 push r12
|
|
35c0: df 92 push r13
|
|
35c2: ef 92 push r14
|
|
35c4: ff 92 push r15
|
|
35c6: 0f 93 push r16
|
|
35c8: 1f 93 push r17
|
|
35ca: cf 93 push r28
|
|
35cc: df 93 push r29
|
|
35ce: 3c 01 movw r6, r24
|
|
while(ClockCount--) {
|
|
35d0: cb 01 movw r24, r22
|
|
35d2: 01 97 sbiw r24, 0x01 ; 1
|
|
35d4: 67 2b or r22, r23
|
|
35d6: c9 f1 breq .+114 ; 0x364a <Crypto1PRNG+0x98>
|
|
35d8: f3 01 movw r30, r6
|
|
35da: a2 81 ldd r26, Z+2 ; 0x02
|
|
35dc: c0 81 ld r28, Z
|
|
35de: b1 81 ldd r27, Z+1 ; 0x01
|
|
35e0: d3 81 ldd r29, Z+3 ; 0x03
|
|
* XOR all tapped bits to a single feedback bit. */
|
|
uint8_t Feedback = 0;
|
|
|
|
Feedback ^= State[0] & (uint8_t) (PRNG_MASK >> 0);
|
|
Feedback ^= State[1] & (uint8_t) (PRNG_MASK >> 8);
|
|
Feedback ^= State[2] & (uint8_t) (PRNG_MASK >> 16);
|
|
35e2: 2a 2f mov r18, r26
|
|
35e4: 2d 72 andi r18, 0x2D ; 45
|
|
Feedback ^= State[3] & (uint8_t) (PRNG_MASK >> 24);
|
|
|
|
Feedback ^= Feedback >> 4;
|
|
35e6: 32 2f mov r19, r18
|
|
35e8: 32 95 swap r19
|
|
35ea: 3f 70 andi r19, 0x0F ; 15
|
|
35ec: 32 27 eor r19, r18
|
|
Feedback ^= Feedback >> 2;
|
|
35ee: 23 2f mov r18, r19
|
|
35f0: 26 95 lsr r18
|
|
35f2: 26 95 lsr r18
|
|
35f4: 23 27 eor r18, r19
|
|
Feedback ^= Feedback >> 1;
|
|
35f6: 32 2f mov r19, r18
|
|
35f8: 36 95 lsr r19
|
|
uint32_t Temp = 0;
|
|
|
|
Temp |= (uint32_t) State[0] << 0;
|
|
Temp |= (uint32_t) State[1] << 8;
|
|
Temp |= (uint32_t) State[2] << 16;
|
|
Temp |= (uint32_t) State[3] << 24;
|
|
35fa: 4d 2f mov r20, r29
|
|
35fc: 50 e0 ldi r21, 0x00 ; 0
|
|
35fe: 60 e0 ldi r22, 0x00 ; 0
|
|
3600: 70 e0 ldi r23, 0x00 ; 0
|
|
3602: 74 2f mov r23, r20
|
|
3604: 66 27 eor r22, r22
|
|
3606: 55 27 eor r21, r21
|
|
3608: 44 27 eor r20, r20
|
|
|
|
/* For ease of processing convert the state into a 32 bit integer first */
|
|
uint32_t Temp = 0;
|
|
|
|
Temp |= (uint32_t) State[0] << 0;
|
|
Temp |= (uint32_t) State[1] << 8;
|
|
360a: 5b 2b or r21, r27
|
|
Temp |= (uint32_t) State[2] << 16;
|
|
360c: 4c 2b or r20, r28
|
|
Temp |= (uint32_t) State[3] << 24;
|
|
360e: 6a 2b or r22, r26
|
|
|
|
/* Cycle LFSR and feed back. */
|
|
Temp >>= 1;
|
|
3610: 76 95 lsr r23
|
|
3612: 67 95 ror r22
|
|
3614: 57 95 ror r21
|
|
3616: 47 95 ror r20
|
|
Feedback ^= State[2] & (uint8_t) (PRNG_MASK >> 16);
|
|
Feedback ^= State[3] & (uint8_t) (PRNG_MASK >> 24);
|
|
|
|
Feedback ^= Feedback >> 4;
|
|
Feedback ^= Feedback >> 2;
|
|
Feedback ^= Feedback >> 1;
|
|
3618: 32 27 eor r19, r18
|
|
Temp |= (uint32_t) State[3] << 24;
|
|
|
|
/* Cycle LFSR and feed back. */
|
|
Temp >>= 1;
|
|
|
|
if (Feedback & 0x01) {
|
|
361a: 30 fd sbrc r19, 0
|
|
Temp |= (uint32_t) 1 << (8 * PRNG_SIZE - 1);
|
|
361c: 70 68 ori r23, 0x80 ; 128
|
|
}
|
|
|
|
/* Store back state */
|
|
State[0] = (uint8_t) (Temp >> 0);
|
|
361e: c4 2f mov r28, r20
|
|
State[1] = (uint8_t) (Temp >> 8);
|
|
3620: 85 2e mov r8, r21
|
|
3622: 96 2e mov r9, r22
|
|
3624: a7 2e mov r10, r23
|
|
3626: bb 24 eor r11, r11
|
|
3628: b8 2d mov r27, r8
|
|
State[2] = (uint8_t) (Temp >> 16);
|
|
362a: 6b 01 movw r12, r22
|
|
362c: ee 24 eor r14, r14
|
|
362e: ff 24 eor r15, r15
|
|
3630: ac 2d mov r26, r12
|
|
State[3] = (uint8_t) (Temp >> 24);
|
|
3632: 07 2f mov r16, r23
|
|
3634: 11 27 eor r17, r17
|
|
3636: 22 27 eor r18, r18
|
|
3638: 33 27 eor r19, r19
|
|
363a: d0 2f mov r29, r16
|
|
return KeyStream;
|
|
}
|
|
|
|
void Crypto1PRNG(uint8_t State[4], uint16_t ClockCount)
|
|
{
|
|
while(ClockCount--) {
|
|
363c: 01 97 sbiw r24, 0x01 ; 1
|
|
363e: 88 f6 brcc .-94 ; 0x35e2 <Crypto1PRNG+0x30>
|
|
3640: f3 01 movw r30, r6
|
|
3642: 40 83 st Z, r20
|
|
3644: 81 82 std Z+1, r8 ; 0x01
|
|
3646: c2 82 std Z+2, r12 ; 0x02
|
|
3648: 03 83 std Z+3, r16 ; 0x03
|
|
State[2] = (uint8_t) (Temp >> 16);
|
|
State[3] = (uint8_t) (Temp >> 24);
|
|
}
|
|
|
|
|
|
}
|
|
364a: df 91 pop r29
|
|
364c: cf 91 pop r28
|
|
364e: 1f 91 pop r17
|
|
3650: 0f 91 pop r16
|
|
3652: ff 90 pop r15
|
|
3654: ef 90 pop r14
|
|
3656: df 90 pop r13
|
|
3658: cf 90 pop r12
|
|
365a: bf 90 pop r11
|
|
365c: af 90 pop r10
|
|
365e: 9f 90 pop r9
|
|
3660: 8f 90 pop r8
|
|
3662: 7f 90 pop r7
|
|
3664: 6f 90 pop r6
|
|
3666: 08 95 ret
|
|
|
|
00003668 <USB_Device_ProcessControlRequest>:
|
|
#if !defined(NO_DEVICE_REMOTE_WAKEUP)
|
|
bool USB_Device_RemoteWakeupEnabled;
|
|
#endif
|
|
|
|
void USB_Device_ProcessControlRequest(void)
|
|
{
|
|
3668: 0f 93 push r16
|
|
366a: 1f 93 push r17
|
|
366c: cf 93 push r28
|
|
366e: df 93 push r29
|
|
3670: cd b7 in r28, 0x3d ; 61
|
|
3672: de b7 in r29, 0x3e ; 62
|
|
3674: ec 97 sbiw r28, 0x3c ; 60
|
|
3676: cd bf out 0x3d, r28 ; 61
|
|
3678: de bf out 0x3e, r29 ; 62
|
|
USB_ControlRequest.wLength = Endpoint_Read_16_LE();
|
|
#else
|
|
uint8_t* RequestHeader = (uint8_t*)&USB_ControlRequest;
|
|
|
|
for (uint8_t RequestHeaderByte = 0; RequestHeaderByte < sizeof(USB_Request_Header_t); RequestHeaderByte++)
|
|
*(RequestHeader++) = Endpoint_Read_8();
|
|
367a: 2b d3 rcall .+1622 ; 0x3cd2 <Endpoint_Read_8>
|
|
367c: 80 93 15 23 sts 0x2315, r24
|
|
3680: 28 d3 rcall .+1616 ; 0x3cd2 <Endpoint_Read_8>
|
|
3682: 80 93 16 23 sts 0x2316, r24
|
|
3686: 25 d3 rcall .+1610 ; 0x3cd2 <Endpoint_Read_8>
|
|
3688: 80 93 17 23 sts 0x2317, r24
|
|
368c: 22 d3 rcall .+1604 ; 0x3cd2 <Endpoint_Read_8>
|
|
368e: 80 93 18 23 sts 0x2318, r24
|
|
3692: 1f d3 rcall .+1598 ; 0x3cd2 <Endpoint_Read_8>
|
|
3694: 80 93 19 23 sts 0x2319, r24
|
|
3698: 1c d3 rcall .+1592 ; 0x3cd2 <Endpoint_Read_8>
|
|
369a: 80 93 1a 23 sts 0x231A, r24
|
|
369e: 19 d3 rcall .+1586 ; 0x3cd2 <Endpoint_Read_8>
|
|
36a0: 80 93 1b 23 sts 0x231B, r24
|
|
36a4: 16 d3 rcall .+1580 ; 0x3cd2 <Endpoint_Read_8>
|
|
36a6: 80 93 1c 23 sts 0x231C, r24
|
|
#endif
|
|
|
|
EVENT_USB_Device_ControlRequest();
|
|
36aa: 0e 94 36 0b call 0x166c ; 0x166c <EVENT_USB_Device_ControlRequest>
|
|
|
|
if (Endpoint_IsSETUPReceived())
|
|
36ae: b0 d3 rcall .+1888 ; 0x3e10 <Endpoint_IsSETUPReceived>
|
|
36b0: 88 23 and r24, r24
|
|
36b2: 89 f0 breq .+34 ; 0x36d6 <USB_Device_ProcessControlRequest+0x6e>
|
|
{
|
|
uint8_t bmRequestType = USB_ControlRequest.bmRequestType;
|
|
36b4: 90 91 15 23 lds r25, 0x2315
|
|
|
|
switch (USB_ControlRequest.bRequest)
|
|
36b8: 80 91 16 23 lds r24, 0x2316
|
|
36bc: 85 30 cpi r24, 0x05 ; 5
|
|
36be: 09 f4 brne .+2 ; 0x36c2 <USB_Device_ProcessControlRequest+0x5a>
|
|
36c0: 52 c0 rjmp .+164 ; 0x3766 <USB_Device_ProcessControlRequest+0xfe>
|
|
36c2: b0 f0 brcs .+44 ; 0x36f0 <USB_Device_ProcessControlRequest+0x88>
|
|
36c4: 88 30 cpi r24, 0x08 ; 8
|
|
36c6: 09 f4 brne .+2 ; 0x36ca <USB_Device_ProcessControlRequest+0x62>
|
|
36c8: b3 c0 rjmp .+358 ; 0x3830 <USB_Device_ProcessControlRequest+0x1c8>
|
|
36ca: 89 30 cpi r24, 0x09 ; 9
|
|
36cc: 09 f4 brne .+2 ; 0x36d0 <USB_Device_ProcessControlRequest+0x68>
|
|
36ce: 98 c0 rjmp .+304 ; 0x3800 <USB_Device_ProcessControlRequest+0x198>
|
|
36d0: 86 30 cpi r24, 0x06 ; 6
|
|
36d2: 09 f4 brne .+2 ; 0x36d6 <USB_Device_ProcessControlRequest+0x6e>
|
|
36d4: 5a c0 rjmp .+180 ; 0x378a <USB_Device_ProcessControlRequest+0x122>
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (Endpoint_IsSETUPReceived())
|
|
36d6: 9c d3 rcall .+1848 ; 0x3e10 <Endpoint_IsSETUPReceived>
|
|
36d8: 88 23 and r24, r24
|
|
36da: 11 f0 breq .+4 ; 0x36e0 <USB_Device_ProcessControlRequest+0x78>
|
|
{
|
|
Endpoint_ClearSETUP();
|
|
36dc: 6d d3 rcall .+1754 ; 0x3db8 <Endpoint_ClearSETUP>
|
|
Endpoint_StallTransaction();
|
|
36de: 50 d3 rcall .+1696 ; 0x3d80 <Endpoint_StallTransaction>
|
|
}
|
|
}
|
|
36e0: ec 96 adiw r28, 0x3c ; 60
|
|
36e2: cd bf out 0x3d, r28 ; 61
|
|
36e4: de bf out 0x3e, r29 ; 62
|
|
36e6: df 91 pop r29
|
|
36e8: cf 91 pop r28
|
|
36ea: 1f 91 pop r17
|
|
36ec: 0f 91 pop r16
|
|
36ee: 08 95 ret
|
|
|
|
if (Endpoint_IsSETUPReceived())
|
|
{
|
|
uint8_t bmRequestType = USB_ControlRequest.bmRequestType;
|
|
|
|
switch (USB_ControlRequest.bRequest)
|
|
36f0: 81 30 cpi r24, 0x01 ; 1
|
|
36f2: 21 f0 breq .+8 ; 0x36fc <USB_Device_ProcessControlRequest+0x94>
|
|
36f4: 08 f4 brcc .+2 ; 0x36f8 <USB_Device_ProcessControlRequest+0x90>
|
|
36f6: 68 c0 rjmp .+208 ; 0x37c8 <USB_Device_ProcessControlRequest+0x160>
|
|
36f8: 83 30 cpi r24, 0x03 ; 3
|
|
36fa: 69 f7 brne .-38 ; 0x36d6 <USB_Device_ProcessControlRequest+0x6e>
|
|
}
|
|
|
|
break;
|
|
case REQ_ClearFeature:
|
|
case REQ_SetFeature:
|
|
if ((bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_DEVICE)) ||
|
|
36fc: 99 23 and r25, r25
|
|
36fe: 09 f4 brne .+2 ; 0x3702 <USB_Device_ProcessControlRequest+0x9a>
|
|
3700: a1 c0 rjmp .+322 ; 0x3844 <USB_Device_ProcessControlRequest+0x1dc>
|
|
3702: 92 30 cpi r25, 0x02 ; 2
|
|
3704: 41 f7 brne .-48 ; 0x36d6 <USB_Device_ProcessControlRequest+0x6e>
|
|
|
|
break;
|
|
#endif
|
|
#if !defined(CONTROL_ONLY_DEVICE)
|
|
case REQREC_ENDPOINT:
|
|
if ((uint8_t)USB_ControlRequest.wValue == FEATURE_SEL_EndpointHalt)
|
|
3706: 80 91 17 23 lds r24, 0x2317
|
|
370a: 81 11 cpse r24, r1
|
|
370c: 27 c0 rjmp .+78 ; 0x375c <USB_Device_ProcessControlRequest+0xf4>
|
|
{
|
|
uint8_t EndpointIndex = ((uint8_t)USB_ControlRequest.wIndex & ENDPOINT_EPNUM_MASK);
|
|
370e: 00 91 19 23 lds r16, 0x2319
|
|
3712: 10 91 1a 23 lds r17, 0x231A
|
|
3716: 0f 70 andi r16, 0x0F ; 15
|
|
3718: 11 27 eor r17, r17
|
|
|
|
if (EndpointIndex == ENDPOINT_CONTROLEP)
|
|
371a: 01 15 cp r16, r1
|
|
371c: 11 05 cpc r17, r1
|
|
371e: d9 f2 breq .-74 ; 0x36d6 <USB_Device_ProcessControlRequest+0x6e>
|
|
return;
|
|
|
|
Endpoint_SelectEndpoint(EndpointIndex);
|
|
3720: 80 2f mov r24, r16
|
|
3722: f5 d2 rcall .+1514 ; 0x3d0e <Endpoint_SelectEndpoint>
|
|
|
|
if (Endpoint_IsEnabled())
|
|
{
|
|
if (USB_ControlRequest.bRequest == REQ_SetFeature)
|
|
3724: 80 91 16 23 lds r24, 0x2316
|
|
3728: 83 30 cpi r24, 0x03 ; 3
|
|
372a: 09 f4 brne .+2 ; 0x372e <USB_Device_ProcessControlRequest+0xc6>
|
|
372c: e6 c0 rjmp .+460 ; 0x38fa <USB_Device_ProcessControlRequest+0x292>
|
|
* \ingroup Group_EndpointPacketManagement_XMEGA
|
|
*/
|
|
static inline void Endpoint_ClearStall(void) ATTR_ALWAYS_INLINE;
|
|
static inline void Endpoint_ClearStall(void)
|
|
{
|
|
USB_Endpoint_SelectedHandle->CTRL &= ~USB_EP_STALL_bm;
|
|
372e: e0 91 1f 23 lds r30, 0x231F
|
|
3732: f0 91 20 23 lds r31, 0x2320
|
|
3736: 81 81 ldd r24, Z+1 ; 0x01
|
|
3738: 8b 7f andi r24, 0xFB ; 251
|
|
373a: 81 83 std Z+1, r24 ; 0x01
|
|
static inline void Endpoint_ResetEndpoint(const uint8_t Address)
|
|
{
|
|
if (Address & ENDPOINT_DIR_IN)
|
|
USB_Endpoint_FIFOs[Address & ENDPOINT_EPNUM_MASK].IN.Position = 0;
|
|
else
|
|
USB_Endpoint_FIFOs[Address & ENDPOINT_EPNUM_MASK].OUT.Position = 0;
|
|
373c: 84 e8 ldi r24, 0x84 ; 132
|
|
373e: 80 9f mul r24, r16
|
|
3740: f0 01 movw r30, r0
|
|
3742: 81 9f mul r24, r17
|
|
3744: f0 0d add r31, r0
|
|
3746: 11 24 eor r1, r1
|
|
3748: ed 59 subi r30, 0x9D ; 157
|
|
374a: fc 4d sbci r31, 0xDC ; 220
|
|
374c: 10 82 st Z, r1
|
|
|
|
/** Resets the data toggle of the currently selected endpoint. */
|
|
static inline void Endpoint_ResetDataToggle(void) ATTR_ALWAYS_INLINE;
|
|
static inline void Endpoint_ResetDataToggle(void)
|
|
{
|
|
USB_Endpoint_SelectedHandle->STATUS &= ~USB_EP_TOGGLE_bm;
|
|
374e: e0 91 1f 23 lds r30, 0x231F
|
|
3752: f0 91 20 23 lds r31, 0x2320
|
|
3756: 80 81 ld r24, Z
|
|
3758: 8e 7f andi r24, 0xFE ; 254
|
|
375a: 80 83 st Z, r24
|
|
#endif
|
|
default:
|
|
return;
|
|
}
|
|
|
|
Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP);
|
|
375c: 80 e0 ldi r24, 0x00 ; 0
|
|
375e: d7 d2 rcall .+1454 ; 0x3d0e <Endpoint_SelectEndpoint>
|
|
|
|
Endpoint_ClearSETUP();
|
|
3760: 2b d3 rcall .+1622 ; 0x3db8 <Endpoint_ClearSETUP>
|
|
|
|
Endpoint_ClearStatusStage();
|
|
3762: 8f d4 rcall .+2334 ; 0x4082 <Endpoint_ClearStatusStage>
|
|
3764: b8 cf rjmp .-144 ; 0x36d6 <USB_Device_ProcessControlRequest+0x6e>
|
|
USB_Device_ClearSetFeature();
|
|
}
|
|
|
|
break;
|
|
case REQ_SetAddress:
|
|
if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_DEVICE))
|
|
3766: 91 11 cpse r25, r1
|
|
3768: b6 cf rjmp .-148 ; 0x36d6 <USB_Device_ProcessControlRequest+0x6e>
|
|
}
|
|
}
|
|
|
|
static void USB_Device_SetAddress(void)
|
|
{
|
|
uint8_t DeviceAddress = (USB_ControlRequest.wValue & 0x7F);
|
|
376a: 10 91 17 23 lds r17, 0x2317
|
|
376e: 1f 77 andi r17, 0x7F ; 127
|
|
|
|
USB_Device_SetDeviceAddress(DeviceAddress);
|
|
|
|
Endpoint_ClearSETUP();
|
|
3770: 23 d3 rcall .+1606 ; 0x3db8 <Endpoint_ClearSETUP>
|
|
|
|
Endpoint_ClearStatusStage();
|
|
3772: 87 d4 rcall .+2318 ; 0x4082 <Endpoint_ClearStatusStage>
|
|
|
|
while (!(Endpoint_IsINReady()));
|
|
3774: 7f d3 rcall .+1790 ; 0x3e74 <Endpoint_IsINReady>
|
|
3776: 88 23 and r24, r24
|
|
3778: e9 f3 breq .-6 ; 0x3774 <USB_Device_ProcessControlRequest+0x10c>
|
|
}
|
|
|
|
static inline void USB_Device_EnableDeviceAddress(const uint8_t Address) ATTR_ALWAYS_INLINE;
|
|
static inline void USB_Device_EnableDeviceAddress(const uint8_t Address)
|
|
{
|
|
USB.ADDR = Address;
|
|
377a: 10 93 c3 04 sts 0x04C3, r17
|
|
|
|
USB_Device_EnableDeviceAddress(DeviceAddress);
|
|
|
|
USB_DeviceState = (DeviceAddress) ? DEVICE_STATE_Addressed : DEVICE_STATE_Default;
|
|
377e: 11 11 cpse r17, r1
|
|
3780: 76 c0 rjmp .+236 ; 0x386e <USB_Device_ProcessControlRequest+0x206>
|
|
3782: 82 e0 ldi r24, 0x02 ; 2
|
|
3784: 80 93 14 23 sts 0x2314, r24
|
|
3788: a6 cf rjmp .-180 ; 0x36d6 <USB_Device_ProcessControlRequest+0x6e>
|
|
if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_DEVICE))
|
|
USB_Device_SetAddress();
|
|
|
|
break;
|
|
case REQ_GetDescriptor:
|
|
if ((bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE)) ||
|
|
378a: 90 58 subi r25, 0x80 ; 128
|
|
378c: 92 30 cpi r25, 0x02 ; 2
|
|
378e: 08 f0 brcs .+2 ; 0x3792 <USB_Device_ProcessControlRequest+0x12a>
|
|
3790: a2 cf rjmp .-188 ; 0x36d6 <USB_Device_ProcessControlRequest+0x6e>
|
|
!(defined(USE_FLASH_DESCRIPTORS) || defined(USE_EEPROM_DESCRIPTORS) || defined(USE_RAM_DESCRIPTORS))
|
|
uint8_t DescriptorAddressSpace;
|
|
#endif
|
|
|
|
#if !defined(NO_INTERNAL_SERIAL) && (USE_INTERNAL_SERIAL != NO_DESCRIPTOR)
|
|
if (USB_ControlRequest.wValue == ((DTYPE_String << 8) | USE_INTERNAL_SERIAL))
|
|
3792: 80 91 17 23 lds r24, 0x2317
|
|
3796: 90 91 18 23 lds r25, 0x2318
|
|
379a: 8c 3d cpi r24, 0xDC ; 220
|
|
379c: 23 e0 ldi r18, 0x03 ; 3
|
|
379e: 92 07 cpc r25, r18
|
|
37a0: 09 f4 brne .+2 ; 0x37a4 <USB_Device_ProcessControlRequest+0x13c>
|
|
37a2: 67 c0 rjmp .+206 ; 0x3872 <USB_Device_ProcessControlRequest+0x20a>
|
|
USB_Device_GetInternalSerialDescriptor();
|
|
return;
|
|
}
|
|
#endif
|
|
|
|
if ((DescriptorSize = CALLBACK_USB_GetDescriptor(USB_ControlRequest.wValue, USB_ControlRequest.wIndex,
|
|
37a4: ae 01 movw r20, r28
|
|
37a6: 45 5c subi r20, 0xC5 ; 197
|
|
37a8: 5f 4f sbci r21, 0xFF ; 255
|
|
37aa: 60 91 19 23 lds r22, 0x2319
|
|
37ae: 0e 94 88 03 call 0x710 ; 0x710 <CALLBACK_USB_GetDescriptor>
|
|
37b2: 8c 01 movw r16, r24
|
|
37b4: 00 97 sbiw r24, 0x00 ; 0
|
|
37b6: 09 f4 brne .+2 ; 0x37ba <USB_Device_ProcessControlRequest+0x152>
|
|
37b8: 8e cf rjmp .-228 ; 0x36d6 <USB_Device_ProcessControlRequest+0x6e>
|
|
)) == NO_DESCRIPTOR)
|
|
{
|
|
return;
|
|
}
|
|
|
|
Endpoint_ClearSETUP();
|
|
37ba: fe d2 rcall .+1532 ; 0x3db8 <Endpoint_ClearSETUP>
|
|
#if defined(USE_RAM_DESCRIPTORS) || !defined(ARCH_HAS_MULTI_ADDRESS_SPACE)
|
|
Endpoint_Write_Control_Stream_LE(DescriptorPointer, DescriptorSize);
|
|
#elif defined(USE_EEPROM_DESCRIPTORS)
|
|
Endpoint_Write_Control_EStream_LE(DescriptorPointer, DescriptorSize);
|
|
#elif defined(USE_FLASH_DESCRIPTORS)
|
|
Endpoint_Write_Control_PStream_LE(DescriptorPointer, DescriptorSize);
|
|
37bc: b8 01 movw r22, r16
|
|
37be: 8b ad ldd r24, Y+59 ; 0x3b
|
|
37c0: 9c ad ldd r25, Y+60 ; 0x3c
|
|
37c2: c0 d1 rcall .+896 ; 0x3b44 <Endpoint_Write_Control_PStream_LE>
|
|
Endpoint_Write_Control_EStream_LE(DescriptorPointer, DescriptorSize);
|
|
else
|
|
Endpoint_Write_Control_Stream_LE(DescriptorPointer, DescriptorSize);
|
|
#endif
|
|
|
|
Endpoint_ClearOUT();
|
|
37c4: 77 d2 rcall .+1262 ; 0x3cb4 <Endpoint_ClearOUT>
|
|
37c6: 87 cf rjmp .-242 ; 0x36d6 <USB_Device_ProcessControlRequest+0x6e>
|
|
uint8_t bmRequestType = USB_ControlRequest.bmRequestType;
|
|
|
|
switch (USB_ControlRequest.bRequest)
|
|
{
|
|
case REQ_GetStatus:
|
|
if ((bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE)) ||
|
|
37c8: 90 38 cpi r25, 0x80 ; 128
|
|
37ca: 09 f4 brne .+2 ; 0x37ce <USB_Device_ProcessControlRequest+0x166>
|
|
37cc: 47 c0 rjmp .+142 ; 0x385c <USB_Device_ProcessControlRequest+0x1f4>
|
|
37ce: 92 38 cpi r25, 0x82 ; 130
|
|
37d0: 09 f0 breq .+2 ; 0x37d4 <USB_Device_ProcessControlRequest+0x16c>
|
|
37d2: 81 cf rjmp .-254 ; 0x36d6 <USB_Device_ProcessControlRequest+0x6e>
|
|
CurrentStatus |= FEATURE_REMOTE_WAKEUP_ENABLED;
|
|
#endif
|
|
break;
|
|
case (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_ENDPOINT):
|
|
#if !defined(CONTROL_ONLY_DEVICE)
|
|
Endpoint_SelectEndpoint((uint8_t)USB_ControlRequest.wIndex & ENDPOINT_EPNUM_MASK);
|
|
37d4: 80 91 19 23 lds r24, 0x2319
|
|
37d8: 8f 70 andi r24, 0x0F ; 15
|
|
37da: 99 d2 rcall .+1330 ; 0x3d0e <Endpoint_SelectEndpoint>
|
|
* \return Boolean \c true if the currently selected endpoint is stalled, \c false otherwise.
|
|
*/
|
|
static inline bool Endpoint_IsStalled(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
|
|
static inline bool Endpoint_IsStalled(void)
|
|
{
|
|
return ((USB_Endpoint_SelectedHandle->CTRL & USB_EP_STALL_bm) ? true : false);
|
|
37dc: e0 91 1f 23 lds r30, 0x231F
|
|
37e0: f0 91 20 23 lds r31, 0x2320
|
|
37e4: 11 81 ldd r17, Z+1 ; 0x01
|
|
37e6: 12 fb bst r17, 2
|
|
37e8: 11 27 eor r17, r17
|
|
37ea: 10 f9 bld r17, 0
|
|
|
|
CurrentStatus = Endpoint_IsStalled();
|
|
|
|
Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP);
|
|
37ec: 80 e0 ldi r24, 0x00 ; 0
|
|
37ee: 8f d2 rcall .+1310 ; 0x3d0e <Endpoint_SelectEndpoint>
|
|
break;
|
|
default:
|
|
return;
|
|
}
|
|
|
|
Endpoint_ClearSETUP();
|
|
37f0: e3 d2 rcall .+1478 ; 0x3db8 <Endpoint_ClearSETUP>
|
|
* \param[in] Data Data to write to the currently selected endpoint's FIFO buffer.
|
|
*/
|
|
static inline void Endpoint_Write_16_LE(const uint16_t Data) ATTR_ALWAYS_INLINE;
|
|
static inline void Endpoint_Write_16_LE(const uint16_t Data)
|
|
{
|
|
Endpoint_Write_8(Data & 0xFF);
|
|
37f2: 81 2f mov r24, r17
|
|
37f4: 7d d2 rcall .+1274 ; 0x3cf0 <Endpoint_Write_8>
|
|
Endpoint_Write_8(Data >> 8);
|
|
37f6: 80 e0 ldi r24, 0x00 ; 0
|
|
37f8: 7b d2 rcall .+1270 ; 0x3cf0 <Endpoint_Write_8>
|
|
|
|
Endpoint_Write_16_LE(CurrentStatus);
|
|
Endpoint_ClearIN();
|
|
37fa: 43 d2 rcall .+1158 ; 0x3c82 <Endpoint_ClearIN>
|
|
|
|
Endpoint_ClearStatusStage();
|
|
37fc: 42 d4 rcall .+2180 ; 0x4082 <Endpoint_ClearStatusStage>
|
|
37fe: 6b cf rjmp .-298 ; 0x36d6 <USB_Device_ProcessControlRequest+0x6e>
|
|
if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE))
|
|
USB_Device_GetConfiguration();
|
|
|
|
break;
|
|
case REQ_SetConfiguration:
|
|
if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_DEVICE))
|
|
3800: 91 11 cpse r25, r1
|
|
3802: 69 cf rjmp .-302 ; 0x36d6 <USB_Device_ProcessControlRequest+0x6e>
|
|
}
|
|
|
|
static void USB_Device_SetConfiguration(void)
|
|
{
|
|
#if defined(FIXED_NUM_CONFIGURATIONS)
|
|
if ((uint8_t)USB_ControlRequest.wValue > FIXED_NUM_CONFIGURATIONS)
|
|
3804: 80 91 17 23 lds r24, 0x2317
|
|
3808: 82 30 cpi r24, 0x02 ; 2
|
|
380a: 08 f0 brcs .+2 ; 0x380e <USB_Device_ProcessControlRequest+0x1a6>
|
|
380c: 64 cf rjmp .-312 ; 0x36d6 <USB_Device_ProcessControlRequest+0x6e>
|
|
if ((uint8_t)USB_ControlRequest.wValue > DevDescriptorPtr->NumberOfConfigurations)
|
|
return;
|
|
#endif
|
|
#endif
|
|
|
|
Endpoint_ClearSETUP();
|
|
380e: d4 d2 rcall .+1448 ; 0x3db8 <Endpoint_ClearSETUP>
|
|
|
|
USB_Device_ConfigurationNumber = (uint8_t)USB_ControlRequest.wValue;
|
|
3810: 80 91 17 23 lds r24, 0x2317
|
|
3814: 80 93 10 23 sts 0x2310, r24
|
|
|
|
Endpoint_ClearStatusStage();
|
|
3818: 34 d4 rcall .+2152 ; 0x4082 <Endpoint_ClearStatusStage>
|
|
|
|
if (USB_Device_ConfigurationNumber)
|
|
381a: 80 91 10 23 lds r24, 0x2310
|
|
381e: 88 23 and r24, r24
|
|
3820: 09 f4 brne .+2 ; 0x3824 <USB_Device_ProcessControlRequest+0x1bc>
|
|
3822: 61 c0 rjmp .+194 ; 0x38e6 <USB_Device_ProcessControlRequest+0x27e>
|
|
USB_DeviceState = DEVICE_STATE_Configured;
|
|
3824: 84 e0 ldi r24, 0x04 ; 4
|
|
3826: 80 93 14 23 sts 0x2314, r24
|
|
else
|
|
USB_DeviceState = (USB_Device_IsAddressSet()) ? DEVICE_STATE_Configured : DEVICE_STATE_Powered;
|
|
|
|
EVENT_USB_Device_ConfigurationChanged();
|
|
382a: 0e 94 32 0b call 0x1664 ; 0x1664 <EVENT_USB_Device_ConfigurationChanged>
|
|
382e: 53 cf rjmp .-346 ; 0x36d6 <USB_Device_ProcessControlRequest+0x6e>
|
|
USB_Device_GetDescriptor();
|
|
}
|
|
|
|
break;
|
|
case REQ_GetConfiguration:
|
|
if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE))
|
|
3830: 90 38 cpi r25, 0x80 ; 128
|
|
3832: 09 f0 breq .+2 ; 0x3836 <USB_Device_ProcessControlRequest+0x1ce>
|
|
3834: 50 cf rjmp .-352 ; 0x36d6 <USB_Device_ProcessControlRequest+0x6e>
|
|
EVENT_USB_Device_ConfigurationChanged();
|
|
}
|
|
|
|
static void USB_Device_GetConfiguration(void)
|
|
{
|
|
Endpoint_ClearSETUP();
|
|
3836: c0 d2 rcall .+1408 ; 0x3db8 <Endpoint_ClearSETUP>
|
|
|
|
Endpoint_Write_8(USB_Device_ConfigurationNumber);
|
|
3838: 80 91 10 23 lds r24, 0x2310
|
|
383c: 59 d2 rcall .+1202 ; 0x3cf0 <Endpoint_Write_8>
|
|
Endpoint_ClearIN();
|
|
383e: 21 d2 rcall .+1090 ; 0x3c82 <Endpoint_ClearIN>
|
|
|
|
Endpoint_ClearStatusStage();
|
|
3840: 20 d4 rcall .+2112 ; 0x4082 <Endpoint_ClearStatusStage>
|
|
3842: 49 cf rjmp .-366 ; 0x36d6 <USB_Device_ProcessControlRequest+0x6e>
|
|
{
|
|
switch (USB_ControlRequest.bmRequestType & CONTROL_REQTYPE_RECIPIENT)
|
|
{
|
|
#if !defined(NO_DEVICE_REMOTE_WAKEUP)
|
|
case REQREC_DEVICE:
|
|
if ((uint8_t)USB_ControlRequest.wValue == FEATURE_SEL_DeviceRemoteWakeup)
|
|
3844: 90 91 17 23 lds r25, 0x2317
|
|
3848: 91 30 cpi r25, 0x01 ; 1
|
|
384a: 09 f0 breq .+2 ; 0x384e <USB_Device_ProcessControlRequest+0x1e6>
|
|
384c: 44 cf rjmp .-376 ; 0x36d6 <USB_Device_ProcessControlRequest+0x6e>
|
|
USB_Device_RemoteWakeupEnabled = (USB_ControlRequest.bRequest == REQ_SetFeature);
|
|
384e: 91 e0 ldi r25, 0x01 ; 1
|
|
3850: 83 30 cpi r24, 0x03 ; 3
|
|
3852: 09 f0 breq .+2 ; 0x3856 <USB_Device_ProcessControlRequest+0x1ee>
|
|
3854: 90 e0 ldi r25, 0x00 ; 0
|
|
3856: 90 93 12 23 sts 0x2312, r25
|
|
385a: 80 cf rjmp .-256 ; 0x375c <USB_Device_ProcessControlRequest+0xf4>
|
|
Endpoint_ClearOUT();
|
|
}
|
|
|
|
static void USB_Device_GetStatus(void)
|
|
{
|
|
uint8_t CurrentStatus = 0;
|
|
385c: 10 91 11 23 lds r17, 0x2311
|
|
if (USB_Device_CurrentlySelfPowered)
|
|
CurrentStatus |= FEATURE_SELFPOWERED_ENABLED;
|
|
#endif
|
|
|
|
#if !defined(NO_DEVICE_REMOTE_WAKEUP)
|
|
if (USB_Device_RemoteWakeupEnabled)
|
|
3860: 80 91 12 23 lds r24, 0x2312
|
|
3864: 88 23 and r24, r24
|
|
3866: 09 f4 brne .+2 ; 0x386a <USB_Device_ProcessControlRequest+0x202>
|
|
3868: c3 cf rjmp .-122 ; 0x37f0 <USB_Device_ProcessControlRequest+0x188>
|
|
CurrentStatus |= FEATURE_REMOTE_WAKEUP_ENABLED;
|
|
386a: 12 60 ori r17, 0x02 ; 2
|
|
386c: c1 cf rjmp .-126 ; 0x37f0 <USB_Device_ProcessControlRequest+0x188>
|
|
|
|
while (!(Endpoint_IsINReady()));
|
|
|
|
USB_Device_EnableDeviceAddress(DeviceAddress);
|
|
|
|
USB_DeviceState = (DeviceAddress) ? DEVICE_STATE_Addressed : DEVICE_STATE_Default;
|
|
386e: 83 e0 ldi r24, 0x03 ; 3
|
|
3870: 89 cf rjmp .-238 ; 0x3784 <USB_Device_ProcessControlRequest+0x11c>
|
|
{
|
|
USB_Descriptor_Header_t Header;
|
|
uint16_t UnicodeString[INTERNAL_SERIAL_LENGTH_BITS / 4];
|
|
} SignatureDescriptor;
|
|
|
|
SignatureDescriptor.Header.Type = DTYPE_String;
|
|
3872: 83 e0 ldi r24, 0x03 ; 3
|
|
3874: 8a 83 std Y+2, r24 ; 0x02
|
|
SignatureDescriptor.Header.Size = USB_STRING_LEN(INTERNAL_SERIAL_LENGTH_BITS / 4);
|
|
3876: 8a e3 ldi r24, 0x3A ; 58
|
|
3878: 89 83 std Y+1, r24 ; 0x01
|
|
#if (ARCH == ARCH_AVR8)
|
|
return SREG;
|
|
#elif (ARCH == ARCH_UC3)
|
|
return __builtin_mfsr(AVR32_SR);
|
|
#elif (ARCH == ARCH_XMEGA)
|
|
return SREG;
|
|
387a: 5f b7 in r21, 0x3f ; 63
|
|
#if (ARCH == ARCH_AVR8)
|
|
cli();
|
|
#elif (ARCH == ARCH_UC3)
|
|
__builtin_ssrf(AVR32_SR_GM_OFFSET);
|
|
#elif (ARCH == ARCH_XMEGA)
|
|
cli();
|
|
387c: f8 94 cli
|
|
|
|
for (uint8_t SerialCharNum = 0; SerialCharNum < (INTERNAL_SERIAL_LENGTH_BITS / 4); SerialCharNum++)
|
|
{
|
|
uint8_t SerialByte;
|
|
|
|
NVM.CMD = NVM_CMD_READ_CALIB_ROW_gc;
|
|
387e: 82 e0 ldi r24, 0x02 ; 2
|
|
3880: 80 93 ca 01 sts 0x01CA, r24
|
|
SerialByte = pgm_read_byte(SigReadAddress);
|
|
3884: e8 e0 ldi r30, 0x08 ; 8
|
|
3886: f0 e0 ldi r31, 0x00 ; 0
|
|
3888: e4 91 lpm r30, Z
|
|
NVM.CMD = 0;
|
|
388a: 10 92 ca 01 sts 0x01CA, r1
|
|
|
|
USB_Device_GetSerialString(SignatureDescriptor.UnicodeString);
|
|
388e: de 01 movw r26, r28
|
|
3890: 13 96 adiw r26, 0x03 ; 3
|
|
uint_reg_t CurrentGlobalInt = GetGlobalInterruptMask();
|
|
GlobalInterruptDisable();
|
|
|
|
uint8_t SigReadAddress = INTERNAL_SERIAL_START_ADDRESS;
|
|
|
|
for (uint8_t SerialCharNum = 0; SerialCharNum < (INTERNAL_SERIAL_LENGTH_BITS / 4); SerialCharNum++)
|
|
3892: 20 e0 ldi r18, 0x00 ; 0
|
|
static inline void USB_Device_GetSerialString(uint16_t* const UnicodeString)
|
|
{
|
|
uint_reg_t CurrentGlobalInt = GetGlobalInterruptMask();
|
|
GlobalInterruptDisable();
|
|
|
|
uint8_t SigReadAddress = INTERNAL_SERIAL_START_ADDRESS;
|
|
3894: 38 e0 ldi r19, 0x08 ; 8
|
|
|
|
for (uint8_t SerialCharNum = 0; SerialCharNum < (INTERNAL_SERIAL_LENGTH_BITS / 4); SerialCharNum++)
|
|
{
|
|
uint8_t SerialByte;
|
|
|
|
NVM.CMD = NVM_CMD_READ_CALIB_ROW_gc;
|
|
3896: 42 e0 ldi r20, 0x02 ; 2
|
|
{
|
|
SerialByte >>= 4;
|
|
SigReadAddress++;
|
|
}
|
|
|
|
SerialByte &= 0x0F;
|
|
3898: ef 70 andi r30, 0x0F ; 15
|
|
|
|
UnicodeString[SerialCharNum] = cpu_to_le16((SerialByte >= 10) ?
|
|
389a: 8e 2f mov r24, r30
|
|
389c: 90 e0 ldi r25, 0x00 ; 0
|
|
389e: ea 30 cpi r30, 0x0A ; 10
|
|
38a0: b8 f0 brcs .+46 ; 0x38d0 <USB_Device_ProcessControlRequest+0x268>
|
|
38a2: c7 96 adiw r24, 0x37 ; 55
|
|
38a4: 8d 93 st X+, r24
|
|
38a6: 9d 93 st X+, r25
|
|
uint_reg_t CurrentGlobalInt = GetGlobalInterruptMask();
|
|
GlobalInterruptDisable();
|
|
|
|
uint8_t SigReadAddress = INTERNAL_SERIAL_START_ADDRESS;
|
|
|
|
for (uint8_t SerialCharNum = 0; SerialCharNum < (INTERNAL_SERIAL_LENGTH_BITS / 4); SerialCharNum++)
|
|
38a8: 2f 5f subi r18, 0xFF ; 255
|
|
38aa: 2c 31 cpi r18, 0x1C ; 28
|
|
38ac: 99 f0 breq .+38 ; 0x38d4 <USB_Device_ProcessControlRequest+0x26c>
|
|
{
|
|
uint8_t SerialByte;
|
|
|
|
NVM.CMD = NVM_CMD_READ_CALIB_ROW_gc;
|
|
38ae: 40 93 ca 01 sts 0x01CA, r20
|
|
SerialByte = pgm_read_byte(SigReadAddress);
|
|
38b2: e3 2f mov r30, r19
|
|
38b4: f0 e0 ldi r31, 0x00 ; 0
|
|
38b6: e4 91 lpm r30, Z
|
|
NVM.CMD = 0;
|
|
38b8: 10 92 ca 01 sts 0x01CA, r1
|
|
|
|
if (SerialCharNum & 0x01)
|
|
38bc: 20 ff sbrs r18, 0
|
|
38be: ec cf rjmp .-40 ; 0x3898 <USB_Device_ProcessControlRequest+0x230>
|
|
{
|
|
SerialByte >>= 4;
|
|
38c0: e2 95 swap r30
|
|
38c2: ef 70 andi r30, 0x0F ; 15
|
|
SigReadAddress++;
|
|
38c4: 3f 5f subi r19, 0xFF ; 255
|
|
}
|
|
|
|
SerialByte &= 0x0F;
|
|
38c6: ef 70 andi r30, 0x0F ; 15
|
|
|
|
UnicodeString[SerialCharNum] = cpu_to_le16((SerialByte >= 10) ?
|
|
38c8: 8e 2f mov r24, r30
|
|
38ca: 90 e0 ldi r25, 0x00 ; 0
|
|
38cc: ea 30 cpi r30, 0x0A ; 10
|
|
38ce: 48 f7 brcc .-46 ; 0x38a2 <USB_Device_ProcessControlRequest+0x23a>
|
|
38d0: c0 96 adiw r24, 0x30 ; 48
|
|
38d2: e8 cf rjmp .-48 ; 0x38a4 <USB_Device_ProcessControlRequest+0x23c>
|
|
if (GlobalIntState & AVR32_SR_GM)
|
|
__builtin_ssrf(AVR32_SR_GM_OFFSET);
|
|
else
|
|
__builtin_csrf(AVR32_SR_GM_OFFSET);
|
|
#elif (ARCH == ARCH_XMEGA)
|
|
SREG = GlobalIntState;
|
|
38d4: 5f bf out 0x3f, r21 ; 63
|
|
|
|
Endpoint_ClearSETUP();
|
|
38d6: 70 d2 rcall .+1248 ; 0x3db8 <Endpoint_ClearSETUP>
|
|
|
|
Endpoint_Write_Control_Stream_LE(&SignatureDescriptor, sizeof(SignatureDescriptor));
|
|
38d8: 6a e3 ldi r22, 0x3A ; 58
|
|
38da: 70 e0 ldi r23, 0x00 ; 0
|
|
38dc: ce 01 movw r24, r28
|
|
38de: 01 96 adiw r24, 0x01 ; 1
|
|
38e0: 90 d0 rcall .+288 ; 0x3a02 <Endpoint_Write_Control_Stream_LE>
|
|
Endpoint_ClearOUT();
|
|
38e2: e8 d1 rcall .+976 ; 0x3cb4 <Endpoint_ClearOUT>
|
|
38e4: f8 ce rjmp .-528 ; 0x36d6 <USB_Device_ProcessControlRequest+0x6e>
|
|
}
|
|
|
|
static inline bool USB_Device_IsAddressSet(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;
|
|
static inline bool USB_Device_IsAddressSet(void)
|
|
{
|
|
return ((USB.ADDR != 0) ? true : false);
|
|
38e6: 80 91 c3 04 lds r24, 0x04C3
|
|
Endpoint_ClearStatusStage();
|
|
|
|
if (USB_Device_ConfigurationNumber)
|
|
USB_DeviceState = DEVICE_STATE_Configured;
|
|
else
|
|
USB_DeviceState = (USB_Device_IsAddressSet()) ? DEVICE_STATE_Configured : DEVICE_STATE_Powered;
|
|
38ea: 88 23 and r24, r24
|
|
38ec: 21 f0 breq .+8 ; 0x38f6 <USB_Device_ProcessControlRequest+0x28e>
|
|
38ee: 84 e0 ldi r24, 0x04 ; 4
|
|
38f0: 80 93 14 23 sts 0x2314, r24
|
|
38f4: 9a cf rjmp .-204 ; 0x382a <USB_Device_ProcessControlRequest+0x1c2>
|
|
38f6: 81 e0 ldi r24, 0x01 ; 1
|
|
38f8: fb cf rjmp .-10 ; 0x38f0 <USB_Device_ProcessControlRequest+0x288>
|
|
|
|
if (Endpoint_IsEnabled())
|
|
{
|
|
if (USB_ControlRequest.bRequest == REQ_SetFeature)
|
|
{
|
|
Endpoint_StallTransaction();
|
|
38fa: 42 d2 rcall .+1156 ; 0x3d80 <Endpoint_StallTransaction>
|
|
38fc: 2f cf rjmp .-418 ; 0x375c <USB_Device_ProcessControlRequest+0xf4>
|
|
|
|
000038fe <USB_Event_Stub>:
|
|
#define __INCLUDE_FROM_EVENTS_C
|
|
#define __INCLUDE_FROM_USB_DRIVER
|
|
#include "Events.h"
|
|
|
|
void USB_Event_Stub(void)
|
|
{
|
|
38fe: 08 95 ret
|
|
|
|
00003900 <USB_USBTask>:
|
|
#if defined(USB_CAN_BE_DEVICE) && !defined(DEVICE_STATE_AS_GPIOR)
|
|
volatile uint8_t USB_DeviceState;
|
|
#endif
|
|
|
|
void USB_USBTask(void)
|
|
{
|
|
3900: cf 93 push r28
|
|
}
|
|
|
|
#if defined(USB_CAN_BE_DEVICE)
|
|
static void USB_DeviceTask(void)
|
|
{
|
|
if (USB_DeviceState == DEVICE_STATE_Unattached)
|
|
3902: 80 91 14 23 lds r24, 0x2314
|
|
3906: 81 11 cpse r24, r1
|
|
3908: 02 c0 rjmp .+4 ; 0x390e <USB_USBTask+0xe>
|
|
#elif defined(USB_CAN_BE_HOST)
|
|
USB_HostTask();
|
|
#elif defined(USB_CAN_BE_DEVICE)
|
|
USB_DeviceTask();
|
|
#endif
|
|
}
|
|
390a: cf 91 pop r28
|
|
390c: 08 95 ret
|
|
* \return Index of the currently selected endpoint.
|
|
*/
|
|
static inline uint8_t Endpoint_GetCurrentEndpoint(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
|
|
static inline uint8_t Endpoint_GetCurrentEndpoint(void)
|
|
{
|
|
return USB_Endpoint_SelectedEndpoint;
|
|
390e: c0 91 21 23 lds r28, 0x2321
|
|
if (USB_DeviceState == DEVICE_STATE_Unattached)
|
|
return;
|
|
|
|
uint8_t PrevEndpoint = Endpoint_GetCurrentEndpoint();
|
|
|
|
Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP);
|
|
3912: 80 e0 ldi r24, 0x00 ; 0
|
|
3914: fc d1 rcall .+1016 ; 0x3d0e <Endpoint_SelectEndpoint>
|
|
|
|
if (Endpoint_IsSETUPReceived())
|
|
3916: 7c d2 rcall .+1272 ; 0x3e10 <Endpoint_IsSETUPReceived>
|
|
3918: 81 11 cpse r24, r1
|
|
391a: 03 c0 rjmp .+6 ; 0x3922 <USB_USBTask+0x22>
|
|
USB_Device_ProcessControlRequest();
|
|
|
|
Endpoint_SelectEndpoint(PrevEndpoint);
|
|
391c: 8c 2f mov r24, r28
|
|
#elif defined(USB_CAN_BE_HOST)
|
|
USB_HostTask();
|
|
#elif defined(USB_CAN_BE_DEVICE)
|
|
USB_DeviceTask();
|
|
#endif
|
|
}
|
|
391e: cf 91 pop r28
|
|
Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP);
|
|
|
|
if (Endpoint_IsSETUPReceived())
|
|
USB_Device_ProcessControlRequest();
|
|
|
|
Endpoint_SelectEndpoint(PrevEndpoint);
|
|
3920: f6 c1 rjmp .+1004 ; 0x3d0e <Endpoint_SelectEndpoint>
|
|
uint8_t PrevEndpoint = Endpoint_GetCurrentEndpoint();
|
|
|
|
Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP);
|
|
|
|
if (Endpoint_IsSETUPReceived())
|
|
USB_Device_ProcessControlRequest();
|
|
3922: a2 de rcall .-700 ; 0x3668 <USB_Device_ProcessControlRequest>
|
|
|
|
Endpoint_SelectEndpoint(PrevEndpoint);
|
|
3924: 8c 2f mov r24, r28
|
|
#elif defined(USB_CAN_BE_HOST)
|
|
USB_HostTask();
|
|
#elif defined(USB_CAN_BE_DEVICE)
|
|
USB_DeviceTask();
|
|
#endif
|
|
}
|
|
3926: cf 91 pop r28
|
|
Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP);
|
|
|
|
if (Endpoint_IsSETUPReceived())
|
|
USB_Device_ProcessControlRequest();
|
|
|
|
Endpoint_SelectEndpoint(PrevEndpoint);
|
|
3928: f2 c1 rjmp .+996 ; 0x3d0e <Endpoint_SelectEndpoint>
|
|
|
|
0000392a <Endpoint_Write_Stream_LE>:
|
|
return ENDPOINT_RWCSTREAM_DeviceDisconnected;
|
|
else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended)
|
|
return ENDPOINT_RWCSTREAM_BusSuspended;
|
|
}
|
|
|
|
return ENDPOINT_RWCSTREAM_NoError;
|
|
392a: af 92 push r10
|
|
392c: bf 92 push r11
|
|
392e: df 92 push r13
|
|
3930: ef 92 push r14
|
|
3932: ff 92 push r15
|
|
3934: 0f 93 push r16
|
|
3936: 1f 93 push r17
|
|
3938: cf 93 push r28
|
|
393a: df 93 push r29
|
|
393c: 8c 01 movw r16, r24
|
|
393e: eb 01 movw r28, r22
|
|
3940: 7a 01 movw r14, r20
|
|
3942: b5 d3 rcall .+1898 ; 0x40ae <Endpoint_WaitUntilReady>
|
|
3944: d8 2e mov r13, r24
|
|
3946: 81 11 cpse r24, r1
|
|
3948: 27 c0 rjmp .+78 ; 0x3998 <Endpoint_Write_Stream_LE+0x6e>
|
|
394a: e1 14 cp r14, r1
|
|
394c: f1 04 cpc r15, r1
|
|
394e: a1 f1 breq .+104 ; 0x39b8 <Endpoint_Write_Stream_LE+0x8e>
|
|
3950: f7 01 movw r30, r14
|
|
3952: 20 81 ld r18, Z
|
|
3954: 31 81 ldd r19, Z+1 ; 0x01
|
|
3956: c2 1b sub r28, r18
|
|
3958: d3 0b sbc r29, r19
|
|
395a: 02 0f add r16, r18
|
|
395c: 13 1f adc r17, r19
|
|
395e: 20 97 sbiw r28, 0x00 ; 0
|
|
3960: d9 f0 breq .+54 ; 0x3998 <Endpoint_Write_Stream_LE+0x6e>
|
|
3962: a1 2c mov r10, r1
|
|
3964: b1 2c mov r11, r1
|
|
3966: 80 91 1d 23 lds r24, 0x231D
|
|
396a: 90 91 1e 23 lds r25, 0x231E
|
|
396e: fc 01 movw r30, r24
|
|
3970: ef 5b subi r30, 0xBF ; 191
|
|
3972: ff 4f sbci r31, 0xFF ; 255
|
|
3974: 20 81 ld r18, Z
|
|
3976: fc 01 movw r30, r24
|
|
3978: e0 5c subi r30, 0xC0 ; 192
|
|
397a: ff 4f sbci r31, 0xFF ; 255
|
|
397c: 80 81 ld r24, Z
|
|
397e: 28 17 cp r18, r24
|
|
3980: 90 f1 brcs .+100 ; 0x39e6 <Endpoint_Write_Stream_LE+0xbc>
|
|
3982: 7f d1 rcall .+766 ; 0x3c82 <Endpoint_ClearIN>
|
|
3984: bd df rcall .-134 ; 0x3900 <USB_USBTask>
|
|
3986: f7 01 movw r30, r14
|
|
3988: 80 81 ld r24, Z
|
|
398a: 91 81 ldd r25, Z+1 ; 0x01
|
|
398c: 8a 0d add r24, r10
|
|
398e: 9b 1d adc r25, r11
|
|
3990: 80 83 st Z, r24
|
|
3992: 91 83 std Z+1, r25 ; 0x01
|
|
3994: 25 e0 ldi r18, 0x05 ; 5
|
|
3996: d2 2e mov r13, r18
|
|
3998: 8d 2d mov r24, r13
|
|
399a: df 91 pop r29
|
|
399c: cf 91 pop r28
|
|
399e: 1f 91 pop r17
|
|
39a0: 0f 91 pop r16
|
|
39a2: ff 90 pop r15
|
|
39a4: ef 90 pop r14
|
|
39a6: df 90 pop r13
|
|
39a8: bf 90 pop r11
|
|
39aa: af 90 pop r10
|
|
39ac: 08 95 ret
|
|
39ae: 69 d1 rcall .+722 ; 0x3c82 <Endpoint_ClearIN>
|
|
39b0: a7 df rcall .-178 ; 0x3900 <USB_USBTask>
|
|
39b2: 7d d3 rcall .+1786 ; 0x40ae <Endpoint_WaitUntilReady>
|
|
39b4: 81 11 cpse r24, r1
|
|
39b6: 23 c0 rjmp .+70 ; 0x39fe <Endpoint_Write_Stream_LE+0xd4>
|
|
39b8: 20 97 sbiw r28, 0x00 ; 0
|
|
39ba: 71 f3 breq .-36 ; 0x3998 <Endpoint_Write_Stream_LE+0x6e>
|
|
39bc: 20 91 1d 23 lds r18, 0x231D
|
|
39c0: 30 91 1e 23 lds r19, 0x231E
|
|
39c4: f9 01 movw r30, r18
|
|
39c6: ef 5b subi r30, 0xBF ; 191
|
|
39c8: ff 4f sbci r31, 0xFF ; 255
|
|
39ca: 90 81 ld r25, Z
|
|
39cc: f9 01 movw r30, r18
|
|
39ce: e0 5c subi r30, 0xC0 ; 192
|
|
39d0: ff 4f sbci r31, 0xFF ; 255
|
|
39d2: 80 81 ld r24, Z
|
|
39d4: 98 17 cp r25, r24
|
|
39d6: 58 f7 brcc .-42 ; 0x39ae <Endpoint_Write_Stream_LE+0x84>
|
|
39d8: f8 01 movw r30, r16
|
|
39da: 81 91 ld r24, Z+
|
|
39dc: 8f 01 movw r16, r30
|
|
39de: 88 d1 rcall .+784 ; 0x3cf0 <Endpoint_Write_8>
|
|
39e0: 21 97 sbiw r28, 0x01 ; 1
|
|
39e2: 61 f7 brne .-40 ; 0x39bc <Endpoint_Write_Stream_LE+0x92>
|
|
39e4: d9 cf rjmp .-78 ; 0x3998 <Endpoint_Write_Stream_LE+0x6e>
|
|
39e6: f8 01 movw r30, r16
|
|
39e8: 81 91 ld r24, Z+
|
|
39ea: 8f 01 movw r16, r30
|
|
39ec: 81 d1 rcall .+770 ; 0x3cf0 <Endpoint_Write_8>
|
|
39ee: ff ef ldi r31, 0xFF ; 255
|
|
39f0: af 1a sub r10, r31
|
|
39f2: bf 0a sbc r11, r31
|
|
39f4: ca 15 cp r28, r10
|
|
39f6: db 05 cpc r29, r11
|
|
39f8: 09 f0 breq .+2 ; 0x39fc <Endpoint_Write_Stream_LE+0xd2>
|
|
39fa: b5 cf rjmp .-150 ; 0x3966 <Endpoint_Write_Stream_LE+0x3c>
|
|
39fc: cd cf rjmp .-102 ; 0x3998 <Endpoint_Write_Stream_LE+0x6e>
|
|
39fe: d8 2e mov r13, r24
|
|
3a00: cb cf rjmp .-106 ; 0x3998 <Endpoint_Write_Stream_LE+0x6e>
|
|
|
|
00003a02 <Endpoint_Write_Control_Stream_LE>:
|
|
3a02: cf 92 push r12
|
|
3a04: df 92 push r13
|
|
3a06: ef 92 push r14
|
|
3a08: ff 92 push r15
|
|
3a0a: 0f 93 push r16
|
|
3a0c: 1f 93 push r17
|
|
3a0e: cf 93 push r28
|
|
3a10: df 93 push r29
|
|
3a12: 6c 01 movw r12, r24
|
|
3a14: eb 01 movw r28, r22
|
|
3a16: 80 91 21 23 lds r24, 0x2321
|
|
3a1a: 80 68 ori r24, 0x80 ; 128
|
|
3a1c: 78 d1 rcall .+752 ; 0x3d0e <Endpoint_SelectEndpoint>
|
|
3a1e: 00 91 1b 23 lds r16, 0x231B
|
|
3a22: 10 91 1c 23 lds r17, 0x231C
|
|
3a26: 0c 17 cp r16, r28
|
|
3a28: 1d 07 cpc r17, r29
|
|
3a2a: 20 f0 brcs .+8 ; 0x3a34 <Endpoint_Write_Control_Stream_LE+0x32>
|
|
3a2c: 20 97 sbiw r28, 0x00 ; 0
|
|
3a2e: 09 f4 brne .+2 ; 0x3a32 <Endpoint_Write_Control_Stream_LE+0x30>
|
|
3a30: 83 c0 rjmp .+262 ; 0x3b38 <Endpoint_Write_Control_Stream_LE+0x136>
|
|
3a32: 8e 01 movw r16, r28
|
|
3a34: c0 e0 ldi r28, 0x00 ; 0
|
|
3a36: 01 15 cp r16, r1
|
|
3a38: 11 05 cpc r17, r1
|
|
3a3a: 09 f0 breq .+2 ; 0x3a3e <Endpoint_Write_Control_Stream_LE+0x3c>
|
|
3a3c: 4a c0 rjmp .+148 ; 0x3ad2 <Endpoint_Write_Control_Stream_LE+0xd0>
|
|
3a3e: cc 23 and r28, r28
|
|
3a40: 09 f4 brne .+2 ; 0x3a44 <Endpoint_Write_Control_Stream_LE+0x42>
|
|
3a42: 5c c0 rjmp .+184 ; 0x3afc <Endpoint_Write_Control_Stream_LE+0xfa>
|
|
3a44: 80 91 14 23 lds r24, 0x2314
|
|
3a48: 88 23 and r24, r24
|
|
3a4a: 09 f4 brne .+2 ; 0x3a4e <Endpoint_Write_Control_Stream_LE+0x4c>
|
|
3a4c: 55 c0 rjmp .+170 ; 0x3af8 <Endpoint_Write_Control_Stream_LE+0xf6>
|
|
3a4e: 85 30 cpi r24, 0x05 ; 5
|
|
3a50: 09 f4 brne .+2 ; 0x3a54 <Endpoint_Write_Control_Stream_LE+0x52>
|
|
3a52: 5d c0 rjmp .+186 ; 0x3b0e <Endpoint_Write_Control_Stream_LE+0x10c>
|
|
3a54: dd d1 rcall .+954 ; 0x3e10 <Endpoint_IsSETUPReceived>
|
|
3a56: 81 11 cpse r24, r1
|
|
3a58: 6d c0 rjmp .+218 ; 0x3b34 <Endpoint_Write_Control_Stream_LE+0x132>
|
|
3a5a: f3 d1 rcall .+998 ; 0x3e42 <Endpoint_IsOUTReceived>
|
|
3a5c: 81 11 cpse r24, r1
|
|
3a5e: 4e c0 rjmp .+156 ; 0x3afc <Endpoint_Write_Control_Stream_LE+0xfa>
|
|
3a60: 09 d2 rcall .+1042 ; 0x3e74 <Endpoint_IsINReady>
|
|
3a62: 88 23 and r24, r24
|
|
3a64: 79 f3 breq .-34 ; 0x3a44 <Endpoint_Write_Control_Stream_LE+0x42>
|
|
3a66: 80 91 21 23 lds r24, 0x2321
|
|
3a6a: 87 fd sbrc r24, 7
|
|
3a6c: 5a c0 rjmp .+180 ; 0x3b22 <Endpoint_Write_Control_Stream_LE+0x120>
|
|
3a6e: 20 91 1d 23 lds r18, 0x231D
|
|
3a72: 30 91 1e 23 lds r19, 0x231E
|
|
3a76: f9 01 movw r30, r18
|
|
3a78: e0 5c subi r30, 0xC0 ; 192
|
|
3a7a: ff 4f sbci r31, 0xFF ; 255
|
|
3a7c: e0 80 ld r14, Z
|
|
3a7e: f9 01 movw r30, r18
|
|
3a80: ef 5b subi r30, 0xBF ; 191
|
|
3a82: ff 4f sbci r31, 0xFF ; 255
|
|
3a84: 80 81 ld r24, Z
|
|
3a86: f1 2c mov r15, r1
|
|
3a88: e8 1a sub r14, r24
|
|
3a8a: f1 08 sbc r15, r1
|
|
3a8c: 01 15 cp r16, r1
|
|
3a8e: 11 05 cpc r17, r1
|
|
3a90: a9 f0 breq .+42 ; 0x3abc <Endpoint_Write_Control_Stream_LE+0xba>
|
|
3a92: 88 e0 ldi r24, 0x08 ; 8
|
|
3a94: e8 16 cp r14, r24
|
|
3a96: f1 04 cpc r15, r1
|
|
3a98: 88 f4 brcc .+34 ; 0x3abc <Endpoint_Write_Control_Stream_LE+0xba>
|
|
3a9a: e6 01 movw r28, r12
|
|
3a9c: 04 c0 rjmp .+8 ; 0x3aa6 <Endpoint_Write_Control_Stream_LE+0xa4>
|
|
3a9e: 88 e0 ldi r24, 0x08 ; 8
|
|
3aa0: e8 16 cp r14, r24
|
|
3aa2: f1 04 cpc r15, r1
|
|
3aa4: 59 f0 breq .+22 ; 0x3abc <Endpoint_Write_Control_Stream_LE+0xba>
|
|
3aa6: 89 91 ld r24, Y+
|
|
3aa8: 23 d1 rcall .+582 ; 0x3cf0 <Endpoint_Write_8>
|
|
3aaa: 6e 01 movw r12, r28
|
|
3aac: 01 50 subi r16, 0x01 ; 1
|
|
3aae: 11 09 sbc r17, r1
|
|
3ab0: 8f ef ldi r24, 0xFF ; 255
|
|
3ab2: e8 1a sub r14, r24
|
|
3ab4: f8 0a sbc r15, r24
|
|
3ab6: 01 15 cp r16, r1
|
|
3ab8: 11 05 cpc r17, r1
|
|
3aba: 89 f7 brne .-30 ; 0x3a9e <Endpoint_Write_Control_Stream_LE+0x9c>
|
|
3abc: c1 e0 ldi r28, 0x01 ; 1
|
|
3abe: 88 e0 ldi r24, 0x08 ; 8
|
|
3ac0: e8 16 cp r14, r24
|
|
3ac2: f1 04 cpc r15, r1
|
|
3ac4: 09 f0 breq .+2 ; 0x3ac8 <Endpoint_Write_Control_Stream_LE+0xc6>
|
|
3ac6: c0 e0 ldi r28, 0x00 ; 0
|
|
3ac8: dc d0 rcall .+440 ; 0x3c82 <Endpoint_ClearIN>
|
|
3aca: 01 15 cp r16, r1
|
|
3acc: 11 05 cpc r17, r1
|
|
3ace: 09 f4 brne .+2 ; 0x3ad2 <Endpoint_Write_Control_Stream_LE+0xd0>
|
|
3ad0: b6 cf rjmp .-148 ; 0x3a3e <Endpoint_Write_Control_Stream_LE+0x3c>
|
|
3ad2: 80 91 14 23 lds r24, 0x2314
|
|
3ad6: 88 23 and r24, r24
|
|
3ad8: 79 f0 breq .+30 ; 0x3af8 <Endpoint_Write_Control_Stream_LE+0xf6>
|
|
3ada: 85 30 cpi r24, 0x05 ; 5
|
|
3adc: c1 f0 breq .+48 ; 0x3b0e <Endpoint_Write_Control_Stream_LE+0x10c>
|
|
3ade: 98 d1 rcall .+816 ; 0x3e10 <Endpoint_IsSETUPReceived>
|
|
3ae0: 81 11 cpse r24, r1
|
|
3ae2: 28 c0 rjmp .+80 ; 0x3b34 <Endpoint_Write_Control_Stream_LE+0x132>
|
|
3ae4: ae d1 rcall .+860 ; 0x3e42 <Endpoint_IsOUTReceived>
|
|
3ae6: 81 11 cpse r24, r1
|
|
3ae8: 09 c0 rjmp .+18 ; 0x3afc <Endpoint_Write_Control_Stream_LE+0xfa>
|
|
3aea: c4 d1 rcall .+904 ; 0x3e74 <Endpoint_IsINReady>
|
|
3aec: 81 11 cpse r24, r1
|
|
3aee: bb cf rjmp .-138 ; 0x3a66 <Endpoint_Write_Control_Stream_LE+0x64>
|
|
3af0: 80 91 14 23 lds r24, 0x2314
|
|
3af4: 81 11 cpse r24, r1
|
|
3af6: f1 cf rjmp .-30 ; 0x3ada <Endpoint_Write_Control_Stream_LE+0xd8>
|
|
3af8: 82 e0 ldi r24, 0x02 ; 2
|
|
3afa: 0a c0 rjmp .+20 ; 0x3b10 <Endpoint_Write_Control_Stream_LE+0x10e>
|
|
3afc: a2 d1 rcall .+836 ; 0x3e42 <Endpoint_IsOUTReceived>
|
|
3afe: 81 11 cpse r24, r1
|
|
3b00: 1f c0 rjmp .+62 ; 0x3b40 <Endpoint_Write_Control_Stream_LE+0x13e>
|
|
3b02: 80 91 14 23 lds r24, 0x2314
|
|
3b06: 88 23 and r24, r24
|
|
3b08: b9 f3 breq .-18 ; 0x3af8 <Endpoint_Write_Control_Stream_LE+0xf6>
|
|
3b0a: 85 30 cpi r24, 0x05 ; 5
|
|
3b0c: b9 f7 brne .-18 ; 0x3afc <Endpoint_Write_Control_Stream_LE+0xfa>
|
|
3b0e: 83 e0 ldi r24, 0x03 ; 3
|
|
3b10: df 91 pop r29
|
|
3b12: cf 91 pop r28
|
|
3b14: 1f 91 pop r17
|
|
3b16: 0f 91 pop r16
|
|
3b18: ff 90 pop r15
|
|
3b1a: ef 90 pop r14
|
|
3b1c: df 90 pop r13
|
|
3b1e: cf 90 pop r12
|
|
3b20: 08 95 ret
|
|
3b22: e0 91 1d 23 lds r30, 0x231D
|
|
3b26: f0 91 1e 23 lds r31, 0x231E
|
|
3b2a: ef 5b subi r30, 0xBF ; 191
|
|
3b2c: ff 4f sbci r31, 0xFF ; 255
|
|
3b2e: e0 80 ld r14, Z
|
|
3b30: f1 2c mov r15, r1
|
|
3b32: ac cf rjmp .-168 ; 0x3a8c <Endpoint_Write_Control_Stream_LE+0x8a>
|
|
3b34: 81 e0 ldi r24, 0x01 ; 1
|
|
3b36: ec cf rjmp .-40 ; 0x3b10 <Endpoint_Write_Control_Stream_LE+0x10e>
|
|
3b38: a4 d0 rcall .+328 ; 0x3c82 <Endpoint_ClearIN>
|
|
3b3a: 00 e0 ldi r16, 0x00 ; 0
|
|
3b3c: 10 e0 ldi r17, 0x00 ; 0
|
|
3b3e: 7a cf rjmp .-268 ; 0x3a34 <Endpoint_Write_Control_Stream_LE+0x32>
|
|
3b40: 80 e0 ldi r24, 0x00 ; 0
|
|
3b42: e6 cf rjmp .-52 ; 0x3b10 <Endpoint_Write_Control_Stream_LE+0x10e>
|
|
|
|
00003b44 <Endpoint_Write_Control_PStream_LE>:
|
|
|
|
#if defined(TEMPLATE_FUNC_NAME)
|
|
|
|
uint8_t TEMPLATE_FUNC_NAME (const void* const Buffer,
|
|
uint16_t Length)
|
|
{
|
|
3b44: cf 92 push r12
|
|
3b46: df 92 push r13
|
|
3b48: ef 92 push r14
|
|
3b4a: ff 92 push r15
|
|
3b4c: 0f 93 push r16
|
|
3b4e: 1f 93 push r17
|
|
3b50: cf 93 push r28
|
|
3b52: df 93 push r29
|
|
3b54: d8 2e mov r13, r24
|
|
3b56: c9 2e mov r12, r25
|
|
3b58: 8b 01 movw r16, r22
|
|
uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length));
|
|
bool LastPacketFull = false;
|
|
|
|
Endpoint_SelectEndpoint(USB_Endpoint_SelectedEndpoint | ENDPOINT_DIR_IN);
|
|
3b5a: 80 91 21 23 lds r24, 0x2321
|
|
3b5e: 80 68 ori r24, 0x80 ; 128
|
|
3b60: d6 d0 rcall .+428 ; 0x3d0e <Endpoint_SelectEndpoint>
|
|
|
|
if (Length > USB_ControlRequest.wLength)
|
|
3b62: c0 91 1b 23 lds r28, 0x231B
|
|
3b66: d0 91 1c 23 lds r29, 0x231C
|
|
3b6a: c0 17 cp r28, r16
|
|
3b6c: d1 07 cpc r29, r17
|
|
3b6e: 28 f0 brcs .+10 ; 0x3b7a <Endpoint_Write_Control_PStream_LE+0x36>
|
|
Length = USB_ControlRequest.wLength;
|
|
else if (!(Length))
|
|
3b70: 01 15 cp r16, r1
|
|
3b72: 11 05 cpc r17, r1
|
|
3b74: 09 f4 brne .+2 ; 0x3b78 <Endpoint_Write_Control_PStream_LE+0x34>
|
|
3b76: 7f c0 rjmp .+254 ; 0x3c76 <Endpoint_Write_Control_PStream_LE+0x132>
|
|
3b78: e8 01 movw r28, r16
|
|
3b7a: ed 2c mov r14, r13
|
|
3b7c: fc 2c mov r15, r12
|
|
3b7e: d1 2c mov r13, r1
|
|
3b80: 20 97 sbiw r28, 0x00 ; 0
|
|
3b82: 09 f0 breq .+2 ; 0x3b86 <Endpoint_Write_Control_PStream_LE+0x42>
|
|
3b84: 45 c0 rjmp .+138 ; 0x3c10 <Endpoint_Write_Control_PStream_LE+0xcc>
|
|
3b86: dd 20 and r13, r13
|
|
3b88: 09 f4 brne .+2 ; 0x3b8c <Endpoint_Write_Control_PStream_LE+0x48>
|
|
3b8a: 57 c0 rjmp .+174 ; 0x3c3a <Endpoint_Write_Control_PStream_LE+0xf6>
|
|
Endpoint_ClearIN();
|
|
|
|
while (Length || LastPacketFull)
|
|
{
|
|
uint8_t USB_DeviceState_LCL = USB_DeviceState;
|
|
3b8c: 80 91 14 23 lds r24, 0x2314
|
|
|
|
if (USB_DeviceState_LCL == DEVICE_STATE_Unattached)
|
|
3b90: 88 23 and r24, r24
|
|
3b92: 09 f4 brne .+2 ; 0x3b96 <Endpoint_Write_Control_PStream_LE+0x52>
|
|
3b94: 50 c0 rjmp .+160 ; 0x3c36 <Endpoint_Write_Control_PStream_LE+0xf2>
|
|
return ENDPOINT_RWCSTREAM_DeviceDisconnected;
|
|
else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended)
|
|
3b96: 85 30 cpi r24, 0x05 ; 5
|
|
3b98: 09 f4 brne .+2 ; 0x3b9c <Endpoint_Write_Control_PStream_LE+0x58>
|
|
3b9a: 58 c0 rjmp .+176 ; 0x3c4c <Endpoint_Write_Control_PStream_LE+0x108>
|
|
return ENDPOINT_RWCSTREAM_BusSuspended;
|
|
else if (Endpoint_IsSETUPReceived())
|
|
3b9c: 39 d1 rcall .+626 ; 0x3e10 <Endpoint_IsSETUPReceived>
|
|
3b9e: 81 11 cpse r24, r1
|
|
3ba0: 68 c0 rjmp .+208 ; 0x3c72 <Endpoint_Write_Control_PStream_LE+0x12e>
|
|
return ENDPOINT_RWCSTREAM_HostAborted;
|
|
else if (Endpoint_IsOUTReceived())
|
|
3ba2: 4f d1 rcall .+670 ; 0x3e42 <Endpoint_IsOUTReceived>
|
|
3ba4: 81 11 cpse r24, r1
|
|
3ba6: 49 c0 rjmp .+146 ; 0x3c3a <Endpoint_Write_Control_PStream_LE+0xf6>
|
|
break;
|
|
|
|
if (Endpoint_IsINReady())
|
|
3ba8: 65 d1 rcall .+714 ; 0x3e74 <Endpoint_IsINReady>
|
|
3baa: 88 23 and r24, r24
|
|
3bac: 79 f3 breq .-34 ; 0x3b8c <Endpoint_Write_Control_PStream_LE+0x48>
|
|
* \return Total number of bytes in the currently selected Endpoint's FIFO buffer.
|
|
*/
|
|
static inline uint16_t Endpoint_BytesInEndpoint(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
|
|
static inline uint16_t Endpoint_BytesInEndpoint(void)
|
|
{
|
|
if (USB_Endpoint_SelectedEndpoint & ENDPOINT_DIR_IN)
|
|
3bae: 80 91 21 23 lds r24, 0x2321
|
|
3bb2: 87 fd sbrc r24, 7
|
|
3bb4: 55 c0 rjmp .+170 ; 0x3c60 <Endpoint_Write_Control_PStream_LE+0x11c>
|
|
return USB_Endpoint_SelectedFIFO->Position;
|
|
else
|
|
return (USB_Endpoint_SelectedFIFO->Length - USB_Endpoint_SelectedFIFO->Position);
|
|
3bb6: 80 91 1d 23 lds r24, 0x231D
|
|
3bba: 90 91 1e 23 lds r25, 0x231E
|
|
3bbe: fc 01 movw r30, r24
|
|
3bc0: e0 5c subi r30, 0xC0 ; 192
|
|
3bc2: ff 4f sbci r31, 0xFF ; 255
|
|
3bc4: 00 81 ld r16, Z
|
|
3bc6: fc 01 movw r30, r24
|
|
3bc8: ef 5b subi r30, 0xBF ; 191
|
|
3bca: ff 4f sbci r31, 0xFF ; 255
|
|
3bcc: 80 81 ld r24, Z
|
|
3bce: 10 e0 ldi r17, 0x00 ; 0
|
|
3bd0: 08 1b sub r16, r24
|
|
3bd2: 11 09 sbc r17, r1
|
|
{
|
|
uint16_t BytesInEndpoint = Endpoint_BytesInEndpoint();
|
|
|
|
while (Length && (BytesInEndpoint < USB_Device_ControlEndpointSize))
|
|
3bd4: 20 97 sbiw r28, 0x00 ; 0
|
|
3bd6: 91 f0 breq .+36 ; 0x3bfc <Endpoint_Write_Control_PStream_LE+0xb8>
|
|
3bd8: 08 30 cpi r16, 0x08 ; 8
|
|
3bda: 11 05 cpc r17, r1
|
|
3bdc: 20 f0 brcs .+8 ; 0x3be6 <Endpoint_Write_Control_PStream_LE+0xa2>
|
|
3bde: 0e c0 rjmp .+28 ; 0x3bfc <Endpoint_Write_Control_PStream_LE+0xb8>
|
|
3be0: 08 30 cpi r16, 0x08 ; 8
|
|
3be2: 11 05 cpc r17, r1
|
|
3be4: 59 f0 breq .+22 ; 0x3bfc <Endpoint_Write_Control_PStream_LE+0xb8>
|
|
{
|
|
TEMPLATE_TRANSFER_BYTE(DataStream);
|
|
3be6: f7 01 movw r30, r14
|
|
3be8: 84 91 lpm r24, Z
|
|
3bea: 82 d0 rcall .+260 ; 0x3cf0 <Endpoint_Write_8>
|
|
TEMPLATE_BUFFER_MOVE(DataStream, 1);
|
|
3bec: ff ef ldi r31, 0xFF ; 255
|
|
3bee: ef 1a sub r14, r31
|
|
3bf0: ff 0a sbc r15, r31
|
|
Length--;
|
|
3bf2: 21 97 sbiw r28, 0x01 ; 1
|
|
BytesInEndpoint++;
|
|
3bf4: 0f 5f subi r16, 0xFF ; 255
|
|
3bf6: 1f 4f sbci r17, 0xFF ; 255
|
|
|
|
if (Endpoint_IsINReady())
|
|
{
|
|
uint16_t BytesInEndpoint = Endpoint_BytesInEndpoint();
|
|
|
|
while (Length && (BytesInEndpoint < USB_Device_ControlEndpointSize))
|
|
3bf8: 20 97 sbiw r28, 0x00 ; 0
|
|
3bfa: 91 f7 brne .-28 ; 0x3be0 <Endpoint_Write_Control_PStream_LE+0x9c>
|
|
TEMPLATE_BUFFER_MOVE(DataStream, 1);
|
|
Length--;
|
|
BytesInEndpoint++;
|
|
}
|
|
|
|
LastPacketFull = (BytesInEndpoint == USB_Device_ControlEndpointSize);
|
|
3bfc: dd 24 eor r13, r13
|
|
3bfe: d3 94 inc r13
|
|
3c00: 08 30 cpi r16, 0x08 ; 8
|
|
3c02: 11 05 cpc r17, r1
|
|
3c04: 09 f0 breq .+2 ; 0x3c08 <Endpoint_Write_Control_PStream_LE+0xc4>
|
|
3c06: d1 2c mov r13, r1
|
|
Endpoint_ClearIN();
|
|
3c08: 3c d0 rcall .+120 ; 0x3c82 <Endpoint_ClearIN>
|
|
3c0a: 20 97 sbiw r28, 0x00 ; 0
|
|
3c0c: 09 f4 brne .+2 ; 0x3c10 <Endpoint_Write_Control_PStream_LE+0xcc>
|
|
3c0e: bb cf rjmp .-138 ; 0x3b86 <Endpoint_Write_Control_PStream_LE+0x42>
|
|
else if (!(Length))
|
|
Endpoint_ClearIN();
|
|
|
|
while (Length || LastPacketFull)
|
|
{
|
|
uint8_t USB_DeviceState_LCL = USB_DeviceState;
|
|
3c10: 80 91 14 23 lds r24, 0x2314
|
|
|
|
if (USB_DeviceState_LCL == DEVICE_STATE_Unattached)
|
|
3c14: 88 23 and r24, r24
|
|
3c16: 79 f0 breq .+30 ; 0x3c36 <Endpoint_Write_Control_PStream_LE+0xf2>
|
|
return ENDPOINT_RWCSTREAM_DeviceDisconnected;
|
|
else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended)
|
|
3c18: 85 30 cpi r24, 0x05 ; 5
|
|
3c1a: c1 f0 breq .+48 ; 0x3c4c <Endpoint_Write_Control_PStream_LE+0x108>
|
|
return ENDPOINT_RWCSTREAM_BusSuspended;
|
|
else if (Endpoint_IsSETUPReceived())
|
|
3c1c: f9 d0 rcall .+498 ; 0x3e10 <Endpoint_IsSETUPReceived>
|
|
3c1e: 81 11 cpse r24, r1
|
|
3c20: 28 c0 rjmp .+80 ; 0x3c72 <Endpoint_Write_Control_PStream_LE+0x12e>
|
|
return ENDPOINT_RWCSTREAM_HostAborted;
|
|
else if (Endpoint_IsOUTReceived())
|
|
3c22: 0f d1 rcall .+542 ; 0x3e42 <Endpoint_IsOUTReceived>
|
|
3c24: 81 11 cpse r24, r1
|
|
3c26: 09 c0 rjmp .+18 ; 0x3c3a <Endpoint_Write_Control_PStream_LE+0xf6>
|
|
break;
|
|
|
|
if (Endpoint_IsINReady())
|
|
3c28: 25 d1 rcall .+586 ; 0x3e74 <Endpoint_IsINReady>
|
|
3c2a: 81 11 cpse r24, r1
|
|
3c2c: c0 cf rjmp .-128 ; 0x3bae <Endpoint_Write_Control_PStream_LE+0x6a>
|
|
else if (!(Length))
|
|
Endpoint_ClearIN();
|
|
|
|
while (Length || LastPacketFull)
|
|
{
|
|
uint8_t USB_DeviceState_LCL = USB_DeviceState;
|
|
3c2e: 80 91 14 23 lds r24, 0x2314
|
|
|
|
if (USB_DeviceState_LCL == DEVICE_STATE_Unattached)
|
|
3c32: 81 11 cpse r24, r1
|
|
3c34: f1 cf rjmp .-30 ; 0x3c18 <Endpoint_Write_Control_PStream_LE+0xd4>
|
|
return ENDPOINT_RWCSTREAM_DeviceDisconnected;
|
|
3c36: 82 e0 ldi r24, 0x02 ; 2
|
|
3c38: 0a c0 rjmp .+20 ; 0x3c4e <Endpoint_Write_Control_PStream_LE+0x10a>
|
|
LastPacketFull = (BytesInEndpoint == USB_Device_ControlEndpointSize);
|
|
Endpoint_ClearIN();
|
|
}
|
|
}
|
|
|
|
while (!(Endpoint_IsOUTReceived()))
|
|
3c3a: 03 d1 rcall .+518 ; 0x3e42 <Endpoint_IsOUTReceived>
|
|
3c3c: 81 11 cpse r24, r1
|
|
3c3e: 1f c0 rjmp .+62 ; 0x3c7e <Endpoint_Write_Control_PStream_LE+0x13a>
|
|
{
|
|
uint8_t USB_DeviceState_LCL = USB_DeviceState;
|
|
3c40: 80 91 14 23 lds r24, 0x2314
|
|
|
|
if (USB_DeviceState_LCL == DEVICE_STATE_Unattached)
|
|
3c44: 88 23 and r24, r24
|
|
3c46: b9 f3 breq .-18 ; 0x3c36 <Endpoint_Write_Control_PStream_LE+0xf2>
|
|
return ENDPOINT_RWCSTREAM_DeviceDisconnected;
|
|
else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended)
|
|
3c48: 85 30 cpi r24, 0x05 ; 5
|
|
3c4a: b9 f7 brne .-18 ; 0x3c3a <Endpoint_Write_Control_PStream_LE+0xf6>
|
|
uint8_t USB_DeviceState_LCL = USB_DeviceState;
|
|
|
|
if (USB_DeviceState_LCL == DEVICE_STATE_Unattached)
|
|
return ENDPOINT_RWCSTREAM_DeviceDisconnected;
|
|
else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended)
|
|
return ENDPOINT_RWCSTREAM_BusSuspended;
|
|
3c4c: 83 e0 ldi r24, 0x03 ; 3
|
|
else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended)
|
|
return ENDPOINT_RWCSTREAM_BusSuspended;
|
|
}
|
|
|
|
return ENDPOINT_RWCSTREAM_NoError;
|
|
}
|
|
3c4e: df 91 pop r29
|
|
3c50: cf 91 pop r28
|
|
3c52: 1f 91 pop r17
|
|
3c54: 0f 91 pop r16
|
|
3c56: ff 90 pop r15
|
|
3c58: ef 90 pop r14
|
|
3c5a: df 90 pop r13
|
|
3c5c: cf 90 pop r12
|
|
3c5e: 08 95 ret
|
|
*/
|
|
static inline uint16_t Endpoint_BytesInEndpoint(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
|
|
static inline uint16_t Endpoint_BytesInEndpoint(void)
|
|
{
|
|
if (USB_Endpoint_SelectedEndpoint & ENDPOINT_DIR_IN)
|
|
return USB_Endpoint_SelectedFIFO->Position;
|
|
3c60: e0 91 1d 23 lds r30, 0x231D
|
|
3c64: f0 91 1e 23 lds r31, 0x231E
|
|
3c68: ef 5b subi r30, 0xBF ; 191
|
|
3c6a: ff 4f sbci r31, 0xFF ; 255
|
|
3c6c: 00 81 ld r16, Z
|
|
3c6e: 10 e0 ldi r17, 0x00 ; 0
|
|
3c70: b1 cf rjmp .-158 ; 0x3bd4 <Endpoint_Write_Control_PStream_LE+0x90>
|
|
if (USB_DeviceState_LCL == DEVICE_STATE_Unattached)
|
|
return ENDPOINT_RWCSTREAM_DeviceDisconnected;
|
|
else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended)
|
|
return ENDPOINT_RWCSTREAM_BusSuspended;
|
|
else if (Endpoint_IsSETUPReceived())
|
|
return ENDPOINT_RWCSTREAM_HostAborted;
|
|
3c72: 81 e0 ldi r24, 0x01 ; 1
|
|
3c74: ec cf rjmp .-40 ; 0x3c4e <Endpoint_Write_Control_PStream_LE+0x10a>
|
|
Endpoint_SelectEndpoint(USB_Endpoint_SelectedEndpoint | ENDPOINT_DIR_IN);
|
|
|
|
if (Length > USB_ControlRequest.wLength)
|
|
Length = USB_ControlRequest.wLength;
|
|
else if (!(Length))
|
|
Endpoint_ClearIN();
|
|
3c76: 05 d0 rcall .+10 ; 0x3c82 <Endpoint_ClearIN>
|
|
3c78: c0 e0 ldi r28, 0x00 ; 0
|
|
3c7a: d0 e0 ldi r29, 0x00 ; 0
|
|
3c7c: 7e cf rjmp .-260 ; 0x3b7a <Endpoint_Write_Control_PStream_LE+0x36>
|
|
return ENDPOINT_RWCSTREAM_DeviceDisconnected;
|
|
else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended)
|
|
return ENDPOINT_RWCSTREAM_BusSuspended;
|
|
}
|
|
|
|
return ENDPOINT_RWCSTREAM_NoError;
|
|
3c7e: 80 e0 ldi r24, 0x00 ; 0
|
|
3c80: e6 cf rjmp .-52 ; 0x3c4e <Endpoint_Write_Control_PStream_LE+0x10a>
|
|
|
|
00003c82 <Endpoint_ClearIN>:
|
|
USB_Endpoint_SelectedFIFO->Position = 0;
|
|
}
|
|
|
|
void Endpoint_ClearIN(void)
|
|
{
|
|
USB_Endpoint_SelectedHandle->CNT = USB_Endpoint_SelectedFIFO->Position;
|
|
3c82: e0 91 1f 23 lds r30, 0x231F
|
|
3c86: f0 91 20 23 lds r31, 0x2320
|
|
3c8a: a0 91 1d 23 lds r26, 0x231D
|
|
3c8e: b0 91 1e 23 lds r27, 0x231E
|
|
3c92: af 5b subi r26, 0xBF ; 191
|
|
3c94: bf 4f sbci r27, 0xFF ; 255
|
|
3c96: 8c 91 ld r24, X
|
|
3c98: 90 e0 ldi r25, 0x00 ; 0
|
|
3c9a: 82 83 std Z+2, r24 ; 0x02
|
|
3c9c: 93 83 std Z+3, r25 ; 0x03
|
|
USB_Endpoint_SelectedHandle->STATUS &= ~(USB_EP_TRNCOMPL0_bm | USB_EP_BUSNACK0_bm | USB_EP_OVF_bm);
|
|
3c9e: 80 81 ld r24, Z
|
|
3ca0: 8d 79 andi r24, 0x9D ; 157
|
|
3ca2: 80 83 st Z, r24
|
|
USB_Endpoint_SelectedFIFO->Position = 0;
|
|
3ca4: e0 91 1d 23 lds r30, 0x231D
|
|
3ca8: f0 91 1e 23 lds r31, 0x231E
|
|
3cac: ef 5b subi r30, 0xBF ; 191
|
|
3cae: ff 4f sbci r31, 0xFF ; 255
|
|
3cb0: 10 82 st Z, r1
|
|
3cb2: 08 95 ret
|
|
|
|
00003cb4 <Endpoint_ClearOUT>:
|
|
}
|
|
|
|
void Endpoint_ClearOUT(void)
|
|
{
|
|
USB_Endpoint_SelectedHandle->STATUS &= ~(USB_EP_TRNCOMPL0_bm | USB_EP_BUSNACK0_bm | USB_EP_OVF_bm);
|
|
3cb4: e0 91 1f 23 lds r30, 0x231F
|
|
3cb8: f0 91 20 23 lds r31, 0x2320
|
|
3cbc: 80 81 ld r24, Z
|
|
3cbe: 8d 79 andi r24, 0x9D ; 157
|
|
3cc0: 80 83 st Z, r24
|
|
USB_Endpoint_SelectedFIFO->Position = 0;
|
|
3cc2: e0 91 1d 23 lds r30, 0x231D
|
|
3cc6: f0 91 1e 23 lds r31, 0x231E
|
|
3cca: ef 5b subi r30, 0xBF ; 191
|
|
3ccc: ff 4f sbci r31, 0xFF ; 255
|
|
3cce: 10 82 st Z, r1
|
|
3cd0: 08 95 ret
|
|
|
|
00003cd2 <Endpoint_Read_8>:
|
|
}
|
|
}
|
|
|
|
uint8_t Endpoint_Read_8(void)
|
|
{
|
|
return USB_Endpoint_SelectedFIFO->Data[USB_Endpoint_SelectedFIFO->Position++];
|
|
3cd2: 80 91 1d 23 lds r24, 0x231D
|
|
3cd6: 90 91 1e 23 lds r25, 0x231E
|
|
3cda: fc 01 movw r30, r24
|
|
3cdc: ef 5b subi r30, 0xBF ; 191
|
|
3cde: ff 4f sbci r31, 0xFF ; 255
|
|
3ce0: 20 81 ld r18, Z
|
|
3ce2: dc 01 movw r26, r24
|
|
3ce4: a2 0f add r26, r18
|
|
3ce6: b1 1d adc r27, r1
|
|
3ce8: 8c 91 ld r24, X
|
|
3cea: 2f 5f subi r18, 0xFF ; 255
|
|
3cec: 20 83 st Z, r18
|
|
}
|
|
3cee: 08 95 ret
|
|
|
|
00003cf0 <Endpoint_Write_8>:
|
|
|
|
void Endpoint_Write_8(const uint8_t Data)
|
|
{
|
|
USB_Endpoint_SelectedFIFO->Data[USB_Endpoint_SelectedFIFO->Position++] = Data;
|
|
3cf0: 20 91 1d 23 lds r18, 0x231D
|
|
3cf4: 30 91 1e 23 lds r19, 0x231E
|
|
3cf8: f9 01 movw r30, r18
|
|
3cfa: ef 5b subi r30, 0xBF ; 191
|
|
3cfc: ff 4f sbci r31, 0xFF ; 255
|
|
3cfe: 90 81 ld r25, Z
|
|
3d00: d9 01 movw r26, r18
|
|
3d02: a9 0f add r26, r25
|
|
3d04: b1 1d adc r27, r1
|
|
3d06: 8c 93 st X, r24
|
|
3d08: 9f 5f subi r25, 0xFF ; 255
|
|
3d0a: 90 83 st Z, r25
|
|
3d0c: 08 95 ret
|
|
|
|
00003d0e <Endpoint_SelectEndpoint>:
|
|
|
|
void Endpoint_SelectEndpoint(const uint8_t Address)
|
|
{
|
|
uint8_t EndpointNumber = (Address & ENDPOINT_EPNUM_MASK);
|
|
|
|
USB_Endpoint_SelectedEndpoint = Address;
|
|
3d0e: 80 93 21 23 sts 0x2321, r24
|
|
USB_Endpoint_SelectedFIFO->Data[USB_Endpoint_SelectedFIFO->Position++] = Data;
|
|
}
|
|
|
|
void Endpoint_SelectEndpoint(const uint8_t Address)
|
|
{
|
|
uint8_t EndpointNumber = (Address & ENDPOINT_EPNUM_MASK);
|
|
3d12: 28 2f mov r18, r24
|
|
3d14: 2f 70 andi r18, 0x0F ; 15
|
|
|
|
USB_Endpoint_SelectedEndpoint = Address;
|
|
|
|
Endpoint_FIFOPair_t* EndpointFIFOPair = &USB_Endpoint_FIFOs[EndpointNumber];
|
|
3d16: 62 2f mov r22, r18
|
|
3d18: 70 e0 ldi r23, 0x00 ; 0
|
|
3d1a: 94 e8 ldi r25, 0x84 ; 132
|
|
3d1c: 29 9f mul r18, r25
|
|
3d1e: 90 01 movw r18, r0
|
|
3d20: 11 24 eor r1, r1
|
|
3d22: 2e 5d subi r18, 0xDE ; 222
|
|
3d24: 3c 4d sbci r19, 0xDC ; 220
|
|
USB_EndpointTable_t* EndpointTable = (USB_EndpointTable_t*)USB.EPPTR;
|
|
3d26: 40 91 c6 04 lds r20, 0x04C6
|
|
3d2a: 50 91 c7 04 lds r21, 0x04C7
|
|
|
|
if (Address & ENDPOINT_DIR_IN)
|
|
3d2e: 87 fd sbrc r24, 7
|
|
3d30: 12 c0 rjmp .+36 ; 0x3d56 <Endpoint_SelectEndpoint+0x48>
|
|
USB_Endpoint_SelectedFIFO = &EndpointFIFOPair->IN;
|
|
USB_Endpoint_SelectedHandle = &EndpointTable->Endpoints[EndpointNumber].IN;
|
|
}
|
|
else
|
|
{
|
|
USB_Endpoint_SelectedFIFO = &EndpointFIFOPair->OUT;
|
|
3d32: 20 93 1d 23 sts 0x231D, r18
|
|
3d36: 30 93 1e 23 sts 0x231E, r19
|
|
USB_Endpoint_SelectedHandle = &EndpointTable->Endpoints[EndpointNumber].OUT;
|
|
3d3a: cb 01 movw r24, r22
|
|
3d3c: 82 95 swap r24
|
|
3d3e: 92 95 swap r25
|
|
3d40: 90 7f andi r25, 0xF0 ; 240
|
|
3d42: 98 27 eor r25, r24
|
|
3d44: 80 7f andi r24, 0xF0 ; 240
|
|
3d46: 98 27 eor r25, r24
|
|
3d48: 84 0f add r24, r20
|
|
3d4a: 95 1f adc r25, r21
|
|
3d4c: 80 93 1f 23 sts 0x231F, r24
|
|
3d50: 90 93 20 23 sts 0x2320, r25
|
|
3d54: 08 95 ret
|
|
Endpoint_FIFOPair_t* EndpointFIFOPair = &USB_Endpoint_FIFOs[EndpointNumber];
|
|
USB_EndpointTable_t* EndpointTable = (USB_EndpointTable_t*)USB.EPPTR;
|
|
|
|
if (Address & ENDPOINT_DIR_IN)
|
|
{
|
|
USB_Endpoint_SelectedFIFO = &EndpointFIFOPair->IN;
|
|
3d56: 2e 5b subi r18, 0xBE ; 190
|
|
3d58: 3f 4f sbci r19, 0xFF ; 255
|
|
3d5a: 20 93 1d 23 sts 0x231D, r18
|
|
3d5e: 30 93 1e 23 sts 0x231E, r19
|
|
USB_Endpoint_SelectedHandle = &EndpointTable->Endpoints[EndpointNumber].IN;
|
|
3d62: 62 95 swap r22
|
|
3d64: 72 95 swap r23
|
|
3d66: 70 7f andi r23, 0xF0 ; 240
|
|
3d68: 76 27 eor r23, r22
|
|
3d6a: 60 7f andi r22, 0xF0 ; 240
|
|
3d6c: 76 27 eor r23, r22
|
|
3d6e: 68 5f subi r22, 0xF8 ; 248
|
|
3d70: 7f 4f sbci r23, 0xFF ; 255
|
|
3d72: 64 0f add r22, r20
|
|
3d74: 75 1f adc r23, r21
|
|
3d76: 60 93 1f 23 sts 0x231F, r22
|
|
3d7a: 70 93 20 23 sts 0x2320, r23
|
|
3d7e: 08 95 ret
|
|
|
|
00003d80 <Endpoint_StallTransaction>:
|
|
USB_Endpoint_SelectedFIFO->Position = 0;
|
|
}
|
|
|
|
void Endpoint_StallTransaction(void)
|
|
{
|
|
USB_Endpoint_SelectedHandle->CTRL |= USB_EP_STALL_bm;
|
|
3d80: e0 91 1f 23 lds r30, 0x231F
|
|
3d84: f0 91 20 23 lds r31, 0x2320
|
|
3d88: 81 81 ldd r24, Z+1 ; 0x01
|
|
3d8a: 84 60 ori r24, 0x04 ; 4
|
|
3d8c: 81 83 std Z+1, r24 ; 0x01
|
|
|
|
if ((USB_Endpoint_SelectedHandle->CTRL & USB_EP_TYPE_gm) == USB_EP_TYPE_CONTROL_gc)
|
|
3d8e: e0 91 1f 23 lds r30, 0x231F
|
|
3d92: f0 91 20 23 lds r31, 0x2320
|
|
3d96: 81 81 ldd r24, Z+1 ; 0x01
|
|
3d98: 80 7c andi r24, 0xC0 ; 192
|
|
3d9a: 80 34 cpi r24, 0x40 ; 64
|
|
3d9c: 09 f0 breq .+2 ; 0x3da0 <Endpoint_StallTransaction+0x20>
|
|
3d9e: 08 95 ret
|
|
{
|
|
Endpoint_SelectEndpoint(USB_Endpoint_SelectedEndpoint ^ ENDPOINT_DIR_IN);
|
|
3da0: 80 91 21 23 lds r24, 0x2321
|
|
3da4: 80 58 subi r24, 0x80 ; 128
|
|
3da6: b3 df rcall .-154 ; 0x3d0e <Endpoint_SelectEndpoint>
|
|
USB_Endpoint_SelectedHandle->CTRL |= USB_EP_STALL_bm;
|
|
3da8: e0 91 1f 23 lds r30, 0x231F
|
|
3dac: f0 91 20 23 lds r31, 0x2320
|
|
3db0: 81 81 ldd r24, Z+1 ; 0x01
|
|
3db2: 84 60 ori r24, 0x04 ; 4
|
|
3db4: 81 83 std Z+1, r24 ; 0x01
|
|
3db6: 08 95 ret
|
|
|
|
00003db8 <Endpoint_ClearSETUP>:
|
|
return false;
|
|
}
|
|
|
|
void Endpoint_ClearSETUP(void)
|
|
{
|
|
Endpoint_SelectEndpoint(USB_Endpoint_SelectedEndpoint & ~ENDPOINT_DIR_IN);
|
|
3db8: 80 91 21 23 lds r24, 0x2321
|
|
3dbc: 8f 77 andi r24, 0x7F ; 127
|
|
3dbe: a7 df rcall .-178 ; 0x3d0e <Endpoint_SelectEndpoint>
|
|
USB_Endpoint_SelectedHandle->STATUS &= ~(USB_EP_SETUP_bm | USB_EP_TRNCOMPL0_bm | USB_EP_BUSNACK0_bm | USB_EP_OVF_bm);
|
|
3dc0: e0 91 1f 23 lds r30, 0x231F
|
|
3dc4: f0 91 20 23 lds r31, 0x2320
|
|
3dc8: 80 81 ld r24, Z
|
|
3dca: 8d 78 andi r24, 0x8D ; 141
|
|
3dcc: 80 83 st Z, r24
|
|
USB_Endpoint_SelectedHandle->STATUS |= USB_EP_TOGGLE_bm;
|
|
3dce: e0 91 1f 23 lds r30, 0x231F
|
|
3dd2: f0 91 20 23 lds r31, 0x2320
|
|
3dd6: 80 81 ld r24, Z
|
|
3dd8: 81 60 ori r24, 0x01 ; 1
|
|
3dda: 80 83 st Z, r24
|
|
USB_Endpoint_SelectedFIFO->Position = 0;
|
|
3ddc: e0 91 1d 23 lds r30, 0x231D
|
|
3de0: f0 91 1e 23 lds r31, 0x231E
|
|
3de4: ef 5b subi r30, 0xBF ; 191
|
|
3de6: ff 4f sbci r31, 0xFF ; 255
|
|
3de8: 10 82 st Z, r1
|
|
|
|
Endpoint_SelectEndpoint(USB_Endpoint_SelectedEndpoint | ENDPOINT_DIR_IN);
|
|
3dea: 80 91 21 23 lds r24, 0x2321
|
|
3dee: 80 68 ori r24, 0x80 ; 128
|
|
3df0: 8e df rcall .-228 ; 0x3d0e <Endpoint_SelectEndpoint>
|
|
USB_Endpoint_SelectedHandle->STATUS |= USB_EP_TOGGLE_bm;
|
|
3df2: e0 91 1f 23 lds r30, 0x231F
|
|
3df6: f0 91 20 23 lds r31, 0x2320
|
|
3dfa: 80 81 ld r24, Z
|
|
3dfc: 81 60 ori r24, 0x01 ; 1
|
|
3dfe: 80 83 st Z, r24
|
|
USB_Endpoint_SelectedFIFO->Position = 0;
|
|
3e00: e0 91 1d 23 lds r30, 0x231D
|
|
3e04: f0 91 1e 23 lds r31, 0x231E
|
|
3e08: ef 5b subi r30, 0xBF ; 191
|
|
3e0a: ff 4f sbci r31, 0xFF ; 255
|
|
3e0c: 10 82 st Z, r1
|
|
3e0e: 08 95 ret
|
|
|
|
00003e10 <Endpoint_IsSETUPReceived>:
|
|
return false;
|
|
}
|
|
|
|
bool Endpoint_IsSETUPReceived(void)
|
|
{
|
|
Endpoint_SelectEndpoint(USB_Endpoint_SelectedEndpoint & ~ENDPOINT_DIR_IN);
|
|
3e10: 80 91 21 23 lds r24, 0x2321
|
|
3e14: 8f 77 andi r24, 0x7F ; 127
|
|
3e16: 7b df rcall .-266 ; 0x3d0e <Endpoint_SelectEndpoint>
|
|
|
|
if (USB_Endpoint_SelectedHandle->STATUS & USB_EP_SETUP_bm)
|
|
3e18: e0 91 1f 23 lds r30, 0x231F
|
|
3e1c: f0 91 20 23 lds r31, 0x2320
|
|
3e20: 80 81 ld r24, Z
|
|
3e22: 84 ff sbrs r24, 4
|
|
3e24: 0c c0 rjmp .+24 ; 0x3e3e <Endpoint_IsSETUPReceived+0x2e>
|
|
{
|
|
USB_Endpoint_SelectedFIFO->Length = USB_Endpoint_SelectedHandle->CNT;
|
|
3e26: 20 91 1d 23 lds r18, 0x231D
|
|
3e2a: 30 91 1e 23 lds r19, 0x231E
|
|
3e2e: 82 81 ldd r24, Z+2 ; 0x02
|
|
3e30: 93 81 ldd r25, Z+3 ; 0x03
|
|
3e32: f9 01 movw r30, r18
|
|
3e34: e0 5c subi r30, 0xC0 ; 192
|
|
3e36: ff 4f sbci r31, 0xFF ; 255
|
|
3e38: 80 83 st Z, r24
|
|
return true;
|
|
3e3a: 81 e0 ldi r24, 0x01 ; 1
|
|
3e3c: 08 95 ret
|
|
}
|
|
|
|
return false;
|
|
3e3e: 80 e0 ldi r24, 0x00 ; 0
|
|
}
|
|
3e40: 08 95 ret
|
|
|
|
00003e42 <Endpoint_IsOUTReceived>:
|
|
return ((USB_Endpoint_SelectedHandle->STATUS & USB_EP_BUSNACK0_bm) ? true : false);
|
|
}
|
|
|
|
bool Endpoint_IsOUTReceived(void)
|
|
{
|
|
Endpoint_SelectEndpoint(USB_Endpoint_SelectedEndpoint & ~ENDPOINT_DIR_IN);
|
|
3e42: 80 91 21 23 lds r24, 0x2321
|
|
3e46: 8f 77 andi r24, 0x7F ; 127
|
|
3e48: 62 df rcall .-316 ; 0x3d0e <Endpoint_SelectEndpoint>
|
|
|
|
if (USB_Endpoint_SelectedHandle->STATUS & USB_EP_TRNCOMPL0_bm)
|
|
3e4a: e0 91 1f 23 lds r30, 0x231F
|
|
3e4e: f0 91 20 23 lds r31, 0x2320
|
|
3e52: 80 81 ld r24, Z
|
|
3e54: 85 ff sbrs r24, 5
|
|
3e56: 0c c0 rjmp .+24 ; 0x3e70 <Endpoint_IsOUTReceived+0x2e>
|
|
{
|
|
USB_Endpoint_SelectedFIFO->Length = USB_Endpoint_SelectedHandle->CNT;
|
|
3e58: 20 91 1d 23 lds r18, 0x231D
|
|
3e5c: 30 91 1e 23 lds r19, 0x231E
|
|
3e60: 82 81 ldd r24, Z+2 ; 0x02
|
|
3e62: 93 81 ldd r25, Z+3 ; 0x03
|
|
3e64: f9 01 movw r30, r18
|
|
3e66: e0 5c subi r30, 0xC0 ; 192
|
|
3e68: ff 4f sbci r31, 0xFF ; 255
|
|
3e6a: 80 83 st Z, r24
|
|
return true;
|
|
3e6c: 81 e0 ldi r24, 0x01 ; 1
|
|
3e6e: 08 95 ret
|
|
}
|
|
|
|
return false;
|
|
3e70: 80 e0 ldi r24, 0x00 ; 0
|
|
}
|
|
3e72: 08 95 ret
|
|
|
|
00003e74 <Endpoint_IsINReady>:
|
|
volatile USB_EP_t* USB_Endpoint_SelectedHandle;
|
|
volatile Endpoint_FIFO_t* USB_Endpoint_SelectedFIFO;
|
|
|
|
bool Endpoint_IsINReady(void)
|
|
{
|
|
Endpoint_SelectEndpoint(USB_Endpoint_SelectedEndpoint | ENDPOINT_DIR_IN);
|
|
3e74: 80 91 21 23 lds r24, 0x2321
|
|
3e78: 80 68 ori r24, 0x80 ; 128
|
|
3e7a: 49 df rcall .-366 ; 0x3d0e <Endpoint_SelectEndpoint>
|
|
|
|
return ((USB_Endpoint_SelectedHandle->STATUS & USB_EP_BUSNACK0_bm) ? true : false);
|
|
3e7c: e0 91 1f 23 lds r30, 0x231F
|
|
3e80: f0 91 20 23 lds r31, 0x2320
|
|
3e84: 80 81 ld r24, Z
|
|
}
|
|
3e86: 86 95 lsr r24
|
|
3e88: 81 70 andi r24, 0x01 ; 1
|
|
3e8a: 08 95 ret
|
|
|
|
00003e8c <Endpoint_ConfigureEndpoint_PRV>:
|
|
}
|
|
|
|
bool Endpoint_ConfigureEndpoint_PRV(const uint8_t Address,
|
|
const uint8_t Config,
|
|
const uint8_t Size)
|
|
{
|
|
3e8c: 1f 93 push r17
|
|
3e8e: cf 93 push r28
|
|
3e90: df 93 push r29
|
|
3e92: 00 d0 rcall .+0 ; 0x3e94 <Endpoint_ConfigureEndpoint_PRV+0x8>
|
|
3e94: cd b7 in r28, 0x3d ; 61
|
|
3e96: de b7 in r29, 0x3e ; 62
|
|
3e98: 18 2f mov r17, r24
|
|
Endpoint_SelectEndpoint(Address);
|
|
3e9a: 4a 83 std Y+2, r20 ; 0x02
|
|
3e9c: 69 83 std Y+1, r22 ; 0x01
|
|
3e9e: 37 df rcall .-402 ; 0x3d0e <Endpoint_SelectEndpoint>
|
|
|
|
USB_Endpoint_SelectedHandle->CTRL = 0;
|
|
3ea0: e0 91 1f 23 lds r30, 0x231F
|
|
3ea4: f0 91 20 23 lds r31, 0x2320
|
|
3ea8: 11 82 std Z+1, r1 ; 0x01
|
|
USB_Endpoint_SelectedHandle->STATUS = (Address & ENDPOINT_DIR_IN) ? USB_EP_BUSNACK0_bm : 0;
|
|
3eaa: e0 91 1f 23 lds r30, 0x231F
|
|
3eae: f0 91 20 23 lds r31, 0x2320
|
|
3eb2: 4a 81 ldd r20, Y+2 ; 0x02
|
|
3eb4: 69 81 ldd r22, Y+1 ; 0x01
|
|
3eb6: 17 fd sbrc r17, 7
|
|
3eb8: 22 c0 rjmp .+68 ; 0x3efe <Endpoint_ConfigureEndpoint_PRV+0x72>
|
|
3eba: 10 82 st Z, r1
|
|
USB_Endpoint_SelectedHandle->CTRL = Config;
|
|
3ebc: e0 91 1f 23 lds r30, 0x231F
|
|
3ec0: f0 91 20 23 lds r31, 0x2320
|
|
3ec4: 61 83 std Z+1, r22 ; 0x01
|
|
USB_Endpoint_SelectedHandle->CNT = 0;
|
|
3ec6: e0 91 1f 23 lds r30, 0x231F
|
|
3eca: f0 91 20 23 lds r31, 0x2320
|
|
3ece: 12 82 std Z+2, r1 ; 0x02
|
|
3ed0: 13 82 std Z+3, r1 ; 0x03
|
|
USB_Endpoint_SelectedHandle->DATAPTR = (intptr_t)USB_Endpoint_SelectedFIFO->Data;
|
|
3ed2: 80 91 1d 23 lds r24, 0x231D
|
|
3ed6: 90 91 1e 23 lds r25, 0x231E
|
|
3eda: 84 83 std Z+4, r24 ; 0x04
|
|
3edc: 95 83 std Z+5, r25 ; 0x05
|
|
|
|
USB_Endpoint_SelectedFIFO->Length = (Address & ENDPOINT_DIR_IN) ? Size : 0;
|
|
3ede: 40 e0 ldi r20, 0x00 ; 0
|
|
3ee0: fc 01 movw r30, r24
|
|
3ee2: e0 5c subi r30, 0xC0 ; 192
|
|
3ee4: ff 4f sbci r31, 0xFF ; 255
|
|
3ee6: 40 83 st Z, r20
|
|
USB_Endpoint_SelectedFIFO->Position = 0;
|
|
3ee8: fc 01 movw r30, r24
|
|
3eea: ef 5b subi r30, 0xBF ; 191
|
|
3eec: ff 4f sbci r31, 0xFF ; 255
|
|
3eee: 10 82 st Z, r1
|
|
|
|
return true;
|
|
}
|
|
3ef0: 81 e0 ldi r24, 0x01 ; 1
|
|
3ef2: 0f 90 pop r0
|
|
3ef4: 0f 90 pop r0
|
|
3ef6: df 91 pop r29
|
|
3ef8: cf 91 pop r28
|
|
3efa: 1f 91 pop r17
|
|
3efc: 08 95 ret
|
|
const uint8_t Size)
|
|
{
|
|
Endpoint_SelectEndpoint(Address);
|
|
|
|
USB_Endpoint_SelectedHandle->CTRL = 0;
|
|
USB_Endpoint_SelectedHandle->STATUS = (Address & ENDPOINT_DIR_IN) ? USB_EP_BUSNACK0_bm : 0;
|
|
3efe: 82 e0 ldi r24, 0x02 ; 2
|
|
3f00: 80 83 st Z, r24
|
|
USB_Endpoint_SelectedHandle->CTRL = Config;
|
|
3f02: e0 91 1f 23 lds r30, 0x231F
|
|
3f06: f0 91 20 23 lds r31, 0x2320
|
|
3f0a: 61 83 std Z+1, r22 ; 0x01
|
|
USB_Endpoint_SelectedHandle->CNT = 0;
|
|
3f0c: e0 91 1f 23 lds r30, 0x231F
|
|
3f10: f0 91 20 23 lds r31, 0x2320
|
|
3f14: 12 82 std Z+2, r1 ; 0x02
|
|
3f16: 13 82 std Z+3, r1 ; 0x03
|
|
USB_Endpoint_SelectedHandle->DATAPTR = (intptr_t)USB_Endpoint_SelectedFIFO->Data;
|
|
3f18: 80 91 1d 23 lds r24, 0x231D
|
|
3f1c: 90 91 1e 23 lds r25, 0x231E
|
|
3f20: 84 83 std Z+4, r24 ; 0x04
|
|
3f22: 95 83 std Z+5, r25 ; 0x05
|
|
3f24: dd cf rjmp .-70 ; 0x3ee0 <Endpoint_ConfigureEndpoint_PRV+0x54>
|
|
|
|
00003f26 <Endpoint_ConfigureEndpointTable>:
|
|
}
|
|
}
|
|
|
|
bool Endpoint_ConfigureEndpointTable(const USB_Endpoint_Table_t* const Table,
|
|
const uint8_t Entries)
|
|
{
|
|
3f26: af 92 push r10
|
|
3f28: bf 92 push r11
|
|
3f2a: df 92 push r13
|
|
3f2c: ef 92 push r14
|
|
3f2e: ff 92 push r15
|
|
3f30: 0f 93 push r16
|
|
3f32: 1f 93 push r17
|
|
3f34: cf 93 push r28
|
|
3f36: df 93 push r29
|
|
3f38: 00 d0 rcall .+0 ; 0x3f3a <Endpoint_ConfigureEndpointTable+0x14>
|
|
3f3a: cd b7 in r28, 0x3d ; 61
|
|
3f3c: de b7 in r29, 0x3e ; 62
|
|
3f3e: e6 2e mov r14, r22
|
|
for (uint8_t i = 0; i < Entries; i++)
|
|
3f40: 66 23 and r22, r22
|
|
3f42: 09 f4 brne .+2 ; 0x3f46 <Endpoint_ConfigureEndpointTable+0x20>
|
|
3f44: 4a c0 rjmp .+148 ; 0x3fda <Endpoint_ConfigureEndpointTable+0xb4>
|
|
3f46: 5c 01 movw r10, r24
|
|
USB_Endpoint_SelectedFIFO = &EndpointFIFOPair->OUT;
|
|
USB_Endpoint_SelectedHandle = &EndpointTable->Endpoints[EndpointNumber].OUT;
|
|
}
|
|
}
|
|
|
|
bool Endpoint_ConfigureEndpointTable(const USB_Endpoint_Table_t* const Table,
|
|
3f48: 8c 01 movw r16, r24
|
|
3f4a: 0c 5f subi r16, 0xFC ; 252
|
|
3f4c: 1f 4f sbci r17, 0xFF ; 255
|
|
const uint8_t Entries)
|
|
{
|
|
for (uint8_t i = 0; i < Entries; i++)
|
|
3f4e: f1 2c mov r15, r1
|
|
{
|
|
if (!(Table[i].Address))
|
|
3f50: d5 01 movw r26, r10
|
|
3f52: 5c 91 ld r21, X
|
|
3f54: 55 23 and r21, r21
|
|
3f56: c9 f1 breq .+114 ; 0x3fca <Endpoint_ConfigureEndpointTable+0xa4>
|
|
continue;
|
|
|
|
if (!(Endpoint_ConfigureEndpoint(Table[i].Address, Table[i].Type, Table[i].Size, Table[i].Banks)))
|
|
3f58: d5 01 movw r26, r10
|
|
3f5a: 11 96 adiw r26, 0x01 ; 1
|
|
3f5c: ed 91 ld r30, X+
|
|
3f5e: fc 91 ld r31, X
|
|
3f60: 12 97 sbiw r26, 0x02 ; 2
|
|
USB_Endpoint_SelectedFIFO = &EndpointFIFOPair->OUT;
|
|
USB_Endpoint_SelectedHandle = &EndpointTable->Endpoints[EndpointNumber].OUT;
|
|
}
|
|
}
|
|
|
|
bool Endpoint_ConfigureEndpointTable(const USB_Endpoint_Table_t* const Table,
|
|
3f62: d8 01 movw r26, r16
|
|
3f64: 11 97 sbiw r26, 0x01 ; 1
|
|
for (uint8_t i = 0; i < Entries; i++)
|
|
{
|
|
if (!(Table[i].Address))
|
|
continue;
|
|
|
|
if (!(Endpoint_ConfigureEndpoint(Table[i].Address, Table[i].Type, Table[i].Size, Table[i].Banks)))
|
|
3f66: 4c 91 ld r20, X
|
|
static inline bool Endpoint_ConfigureEndpoint(const uint8_t Address,
|
|
const uint8_t Type,
|
|
const uint16_t Size,
|
|
const uint8_t Banks)
|
|
{
|
|
uint8_t EPConfigMask = (USB_EP_INTDSBL_bm | ((Banks > 1) ? USB_EP_PINGPONG_bm : 0) | Endpoint_BytesToEPSizeMask(Size));
|
|
3f68: d8 01 movw r26, r16
|
|
3f6a: 8c 91 ld r24, X
|
|
3f6c: 82 30 cpi r24, 0x02 ; 2
|
|
3f6e: 08 f4 brcc .+2 ; 0x3f72 <Endpoint_ConfigureEndpointTable+0x4c>
|
|
3f70: 43 c0 rjmp .+134 ; 0x3ff8 <Endpoint_ConfigureEndpointTable+0xd2>
|
|
3f72: 98 e1 ldi r25, 0x18 ; 24
|
|
3f74: 88 e1 ldi r24, 0x18 ; 24
|
|
static inline uint8_t Endpoint_BytesToEPSizeMask(const uint16_t Bytes)
|
|
{
|
|
uint8_t MaskVal = 0;
|
|
uint16_t CheckBytes = 8;
|
|
|
|
while (CheckBytes < Bytes)
|
|
3f76: e9 30 cpi r30, 0x09 ; 9
|
|
3f78: f1 05 cpc r31, r1
|
|
3f7a: 50 f0 brcs .+20 ; 0x3f90 <Endpoint_ConfigureEndpointTable+0x6a>
|
|
3f7c: 28 e0 ldi r18, 0x08 ; 8
|
|
3f7e: 30 e0 ldi r19, 0x00 ; 0
|
|
3f80: 90 e0 ldi r25, 0x00 ; 0
|
|
{
|
|
MaskVal++;
|
|
3f82: 9f 5f subi r25, 0xFF ; 255
|
|
CheckBytes <<= 1;
|
|
3f84: 22 0f add r18, r18
|
|
3f86: 33 1f adc r19, r19
|
|
static inline uint8_t Endpoint_BytesToEPSizeMask(const uint16_t Bytes)
|
|
{
|
|
uint8_t MaskVal = 0;
|
|
uint16_t CheckBytes = 8;
|
|
|
|
while (CheckBytes < Bytes)
|
|
3f88: 2e 17 cp r18, r30
|
|
3f8a: 3f 07 cpc r19, r31
|
|
3f8c: d0 f3 brcs .-12 ; 0x3f82 <Endpoint_ConfigureEndpointTable+0x5c>
|
|
3f8e: 98 2b or r25, r24
|
|
const uint16_t Size,
|
|
const uint8_t Banks)
|
|
{
|
|
uint8_t EPConfigMask = (USB_EP_INTDSBL_bm | ((Banks > 1) ? USB_EP_PINGPONG_bm : 0) | Endpoint_BytesToEPSizeMask(Size));
|
|
|
|
if ((Address & ENDPOINT_EPNUM_MASK) >= ENDPOINT_TOTAL_ENDPOINTS)
|
|
3f90: 25 2f mov r18, r21
|
|
3f92: 2f 70 andi r18, 0x0F ; 15
|
|
3f94: 30 e0 ldi r19, 0x00 ; 0
|
|
3f96: 26 30 cpi r18, 0x06 ; 6
|
|
3f98: 31 05 cpc r19, r1
|
|
3f9a: 64 f5 brge .+88 ; 0x3ff4 <Endpoint_ConfigureEndpointTable+0xce>
|
|
return false;
|
|
|
|
// TODO - Fix once limitations are lifted
|
|
EPConfigMask &= ~USB_EP_PINGPONG_bm;
|
|
if (Size > 64)
|
|
3f9c: e1 34 cpi r30, 0x41 ; 65
|
|
3f9e: f1 05 cpc r31, r1
|
|
3fa0: 48 f5 brcc .+82 ; 0x3ff4 <Endpoint_ConfigureEndpointTable+0xce>
|
|
|
|
if ((Address & ENDPOINT_EPNUM_MASK) >= ENDPOINT_TOTAL_ENDPOINTS)
|
|
return false;
|
|
|
|
// TODO - Fix once limitations are lifted
|
|
EPConfigMask &= ~USB_EP_PINGPONG_bm;
|
|
3fa2: 9f 7e andi r25, 0xEF ; 239
|
|
if (Size > 64)
|
|
return false;
|
|
|
|
switch (Type)
|
|
3fa4: 41 11 cpse r20, r1
|
|
3fa6: 2b c0 rjmp .+86 ; 0x3ffe <Endpoint_ConfigureEndpointTable+0xd8>
|
|
{
|
|
case EP_TYPE_CONTROL:
|
|
EPConfigMask |= USB_EP_TYPE_CONTROL_gc;
|
|
3fa8: 90 64 ori r25, 0x40 ; 64
|
|
EPConfigMask |= USB_EP_TYPE_BULK_gc;
|
|
break;
|
|
}
|
|
|
|
if (Type == EP_TYPE_CONTROL)
|
|
Endpoint_ConfigureEndpoint_PRV(Address ^ ENDPOINT_DIR_IN, EPConfigMask, Size);
|
|
3faa: de 2e mov r13, r30
|
|
3fac: 4e 2f mov r20, r30
|
|
3fae: 69 2f mov r22, r25
|
|
3fb0: 85 2f mov r24, r21
|
|
3fb2: 80 58 subi r24, 0x80 ; 128
|
|
3fb4: 59 83 std Y+1, r21 ; 0x01
|
|
3fb6: 9a 83 std Y+2, r25 ; 0x02
|
|
3fb8: 69 df rcall .-302 ; 0x3e8c <Endpoint_ConfigureEndpoint_PRV>
|
|
3fba: 9a 81 ldd r25, Y+2 ; 0x02
|
|
3fbc: 59 81 ldd r21, Y+1 ; 0x01
|
|
|
|
return Endpoint_ConfigureEndpoint_PRV(Address, EPConfigMask, Size);
|
|
3fbe: 4d 2d mov r20, r13
|
|
3fc0: 69 2f mov r22, r25
|
|
3fc2: 85 2f mov r24, r21
|
|
3fc4: 63 df rcall .-314 ; 0x3e8c <Endpoint_ConfigureEndpoint_PRV>
|
|
3fc6: 88 23 and r24, r24
|
|
3fc8: a9 f0 breq .+42 ; 0x3ff4 <Endpoint_ConfigureEndpointTable+0xce>
|
|
}
|
|
|
|
bool Endpoint_ConfigureEndpointTable(const USB_Endpoint_Table_t* const Table,
|
|
const uint8_t Entries)
|
|
{
|
|
for (uint8_t i = 0; i < Entries; i++)
|
|
3fca: f3 94 inc r15
|
|
3fcc: b5 e0 ldi r27, 0x05 ; 5
|
|
3fce: ab 0e add r10, r27
|
|
3fd0: b1 1c adc r11, r1
|
|
3fd2: 0b 5f subi r16, 0xFB ; 251
|
|
3fd4: 1f 4f sbci r17, 0xFF ; 255
|
|
3fd6: fe 10 cpse r15, r14
|
|
3fd8: bb cf rjmp .-138 ; 0x3f50 <Endpoint_ConfigureEndpointTable+0x2a>
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
return true;
|
|
3fda: 81 e0 ldi r24, 0x01 ; 1
|
|
}
|
|
3fdc: 0f 90 pop r0
|
|
3fde: 0f 90 pop r0
|
|
3fe0: df 91 pop r29
|
|
3fe2: cf 91 pop r28
|
|
3fe4: 1f 91 pop r17
|
|
3fe6: 0f 91 pop r16
|
|
3fe8: ff 90 pop r15
|
|
3fea: ef 90 pop r14
|
|
3fec: df 90 pop r13
|
|
3fee: bf 90 pop r11
|
|
3ff0: af 90 pop r10
|
|
3ff2: 08 95 ret
|
|
if (!(Table[i].Address))
|
|
continue;
|
|
|
|
if (!(Endpoint_ConfigureEndpoint(Table[i].Address, Table[i].Type, Table[i].Size, Table[i].Banks)))
|
|
{
|
|
return false;
|
|
3ff4: 80 e0 ldi r24, 0x00 ; 0
|
|
3ff6: f2 cf rjmp .-28 ; 0x3fdc <Endpoint_ConfigureEndpointTable+0xb6>
|
|
static inline bool Endpoint_ConfigureEndpoint(const uint8_t Address,
|
|
const uint8_t Type,
|
|
const uint16_t Size,
|
|
const uint8_t Banks)
|
|
{
|
|
uint8_t EPConfigMask = (USB_EP_INTDSBL_bm | ((Banks > 1) ? USB_EP_PINGPONG_bm : 0) | Endpoint_BytesToEPSizeMask(Size));
|
|
3ff8: 98 e0 ldi r25, 0x08 ; 8
|
|
3ffa: 88 e0 ldi r24, 0x08 ; 8
|
|
3ffc: bc cf rjmp .-136 ; 0x3f76 <Endpoint_ConfigureEndpointTable+0x50>
|
|
// TODO - Fix once limitations are lifted
|
|
EPConfigMask &= ~USB_EP_PINGPONG_bm;
|
|
if (Size > 64)
|
|
return false;
|
|
|
|
switch (Type)
|
|
3ffe: 41 30 cpi r20, 0x01 ; 1
|
|
4000: 29 f0 breq .+10 ; 0x400c <Endpoint_ConfigureEndpointTable+0xe6>
|
|
break;
|
|
case EP_TYPE_ISOCHRONOUS:
|
|
EPConfigMask |= USB_EP_TYPE_ISOCHRONOUS_gc;
|
|
break;
|
|
default:
|
|
EPConfigMask |= USB_EP_TYPE_BULK_gc;
|
|
4002: 90 68 ori r25, 0x80 ; 128
|
|
break;
|
|
}
|
|
|
|
if (Type == EP_TYPE_CONTROL)
|
|
4004: 44 23 and r20, r20
|
|
4006: 89 f2 breq .-94 ; 0x3faa <Endpoint_ConfigureEndpointTable+0x84>
|
|
4008: de 2e mov r13, r30
|
|
400a: d9 cf rjmp .-78 ; 0x3fbe <Endpoint_ConfigureEndpointTable+0x98>
|
|
{
|
|
case EP_TYPE_CONTROL:
|
|
EPConfigMask |= USB_EP_TYPE_CONTROL_gc;
|
|
break;
|
|
case EP_TYPE_ISOCHRONOUS:
|
|
EPConfigMask |= USB_EP_TYPE_ISOCHRONOUS_gc;
|
|
400c: 90 6c ori r25, 0xC0 ; 192
|
|
400e: de 2e mov r13, r30
|
|
4010: d6 cf rjmp .-84 ; 0x3fbe <Endpoint_ConfigureEndpointTable+0x98>
|
|
|
|
00004012 <Endpoint_ClearEndpoints>:
|
|
|
|
void Endpoint_ClearEndpoints(void)
|
|
{
|
|
for (uint8_t EPNum = 0; EPNum < ENDPOINT_TOTAL_ENDPOINTS; EPNum++)
|
|
{
|
|
((USB_EndpointTable_t*)USB.EPPTR)->Endpoints[EPNum].IN.CTRL = 0;
|
|
4012: e0 ec ldi r30, 0xC0 ; 192
|
|
4014: f4 e0 ldi r31, 0x04 ; 4
|
|
4016: a6 81 ldd r26, Z+6 ; 0x06
|
|
4018: b7 81 ldd r27, Z+7 ; 0x07
|
|
401a: 19 96 adiw r26, 0x09 ; 9
|
|
401c: 1c 92 st X, r1
|
|
((USB_EndpointTable_t*)USB.EPPTR)->Endpoints[EPNum].OUT.CTRL = 0;
|
|
401e: a6 81 ldd r26, Z+6 ; 0x06
|
|
4020: b7 81 ldd r27, Z+7 ; 0x07
|
|
4022: 11 96 adiw r26, 0x01 ; 1
|
|
4024: 1c 92 st X, r1
|
|
|
|
void Endpoint_ClearEndpoints(void)
|
|
{
|
|
for (uint8_t EPNum = 0; EPNum < ENDPOINT_TOTAL_ENDPOINTS; EPNum++)
|
|
{
|
|
((USB_EndpointTable_t*)USB.EPPTR)->Endpoints[EPNum].IN.CTRL = 0;
|
|
4026: a6 81 ldd r26, Z+6 ; 0x06
|
|
4028: b7 81 ldd r27, Z+7 ; 0x07
|
|
402a: 59 96 adiw r26, 0x19 ; 25
|
|
402c: 1c 92 st X, r1
|
|
((USB_EndpointTable_t*)USB.EPPTR)->Endpoints[EPNum].OUT.CTRL = 0;
|
|
402e: a6 81 ldd r26, Z+6 ; 0x06
|
|
4030: b7 81 ldd r27, Z+7 ; 0x07
|
|
4032: 51 96 adiw r26, 0x11 ; 17
|
|
4034: 1c 92 st X, r1
|
|
|
|
void Endpoint_ClearEndpoints(void)
|
|
{
|
|
for (uint8_t EPNum = 0; EPNum < ENDPOINT_TOTAL_ENDPOINTS; EPNum++)
|
|
{
|
|
((USB_EndpointTable_t*)USB.EPPTR)->Endpoints[EPNum].IN.CTRL = 0;
|
|
4036: a6 81 ldd r26, Z+6 ; 0x06
|
|
4038: b7 81 ldd r27, Z+7 ; 0x07
|
|
403a: 99 96 adiw r26, 0x29 ; 41
|
|
403c: 1c 92 st X, r1
|
|
((USB_EndpointTable_t*)USB.EPPTR)->Endpoints[EPNum].OUT.CTRL = 0;
|
|
403e: a6 81 ldd r26, Z+6 ; 0x06
|
|
4040: b7 81 ldd r27, Z+7 ; 0x07
|
|
4042: 91 96 adiw r26, 0x21 ; 33
|
|
4044: 1c 92 st X, r1
|
|
|
|
void Endpoint_ClearEndpoints(void)
|
|
{
|
|
for (uint8_t EPNum = 0; EPNum < ENDPOINT_TOTAL_ENDPOINTS; EPNum++)
|
|
{
|
|
((USB_EndpointTable_t*)USB.EPPTR)->Endpoints[EPNum].IN.CTRL = 0;
|
|
4046: a6 81 ldd r26, Z+6 ; 0x06
|
|
4048: b7 81 ldd r27, Z+7 ; 0x07
|
|
404a: d9 96 adiw r26, 0x39 ; 57
|
|
404c: 1c 92 st X, r1
|
|
((USB_EndpointTable_t*)USB.EPPTR)->Endpoints[EPNum].OUT.CTRL = 0;
|
|
404e: a6 81 ldd r26, Z+6 ; 0x06
|
|
4050: b7 81 ldd r27, Z+7 ; 0x07
|
|
4052: d1 96 adiw r26, 0x31 ; 49
|
|
4054: 1c 92 st X, r1
|
|
|
|
void Endpoint_ClearEndpoints(void)
|
|
{
|
|
for (uint8_t EPNum = 0; EPNum < ENDPOINT_TOTAL_ENDPOINTS; EPNum++)
|
|
{
|
|
((USB_EndpointTable_t*)USB.EPPTR)->Endpoints[EPNum].IN.CTRL = 0;
|
|
4056: a6 81 ldd r26, Z+6 ; 0x06
|
|
4058: b7 81 ldd r27, Z+7 ; 0x07
|
|
405a: a7 5b subi r26, 0xB7 ; 183
|
|
405c: bf 4f sbci r27, 0xFF ; 255
|
|
405e: 1c 92 st X, r1
|
|
((USB_EndpointTable_t*)USB.EPPTR)->Endpoints[EPNum].OUT.CTRL = 0;
|
|
4060: a6 81 ldd r26, Z+6 ; 0x06
|
|
4062: b7 81 ldd r27, Z+7 ; 0x07
|
|
4064: af 5b subi r26, 0xBF ; 191
|
|
4066: bf 4f sbci r27, 0xFF ; 255
|
|
4068: 1c 92 st X, r1
|
|
|
|
void Endpoint_ClearEndpoints(void)
|
|
{
|
|
for (uint8_t EPNum = 0; EPNum < ENDPOINT_TOTAL_ENDPOINTS; EPNum++)
|
|
{
|
|
((USB_EndpointTable_t*)USB.EPPTR)->Endpoints[EPNum].IN.CTRL = 0;
|
|
406a: a6 81 ldd r26, Z+6 ; 0x06
|
|
406c: b7 81 ldd r27, Z+7 ; 0x07
|
|
406e: a7 5a subi r26, 0xA7 ; 167
|
|
4070: bf 4f sbci r27, 0xFF ; 255
|
|
4072: 1c 92 st X, r1
|
|
((USB_EndpointTable_t*)USB.EPPTR)->Endpoints[EPNum].OUT.CTRL = 0;
|
|
4074: 06 80 ldd r0, Z+6 ; 0x06
|
|
4076: f7 81 ldd r31, Z+7 ; 0x07
|
|
4078: e0 2d mov r30, r0
|
|
407a: ef 5a subi r30, 0xAF ; 175
|
|
407c: ff 4f sbci r31, 0xFF ; 255
|
|
407e: 10 82 st Z, r1
|
|
4080: 08 95 ret
|
|
|
|
00004082 <Endpoint_ClearStatusStage>:
|
|
}
|
|
}
|
|
|
|
void Endpoint_ClearStatusStage(void)
|
|
{
|
|
if (USB_ControlRequest.bmRequestType & REQDIR_DEVICETOHOST)
|
|
4082: 80 91 15 23 lds r24, 0x2315
|
|
4086: 87 fd sbrc r24, 7
|
|
4088: 08 c0 rjmp .+16 ; 0x409a <Endpoint_ClearStatusStage+0x18>
|
|
|
|
Endpoint_ClearOUT();
|
|
}
|
|
else
|
|
{
|
|
while (!(Endpoint_IsINReady()))
|
|
408a: f4 de rcall .-536 ; 0x3e74 <Endpoint_IsINReady>
|
|
408c: 81 11 cpse r24, r1
|
|
408e: 0d c0 rjmp .+26 ; 0x40aa <Endpoint_ClearStatusStage+0x28>
|
|
{
|
|
if (USB_DeviceState == DEVICE_STATE_Unattached)
|
|
4090: 80 91 14 23 lds r24, 0x2314
|
|
4094: 81 11 cpse r24, r1
|
|
4096: f9 cf rjmp .-14 ; 0x408a <Endpoint_ClearStatusStage+0x8>
|
|
4098: 08 95 ret
|
|
|
|
void Endpoint_ClearStatusStage(void)
|
|
{
|
|
if (USB_ControlRequest.bmRequestType & REQDIR_DEVICETOHOST)
|
|
{
|
|
while (!(Endpoint_IsOUTReceived()))
|
|
409a: d3 de rcall .-602 ; 0x3e42 <Endpoint_IsOUTReceived>
|
|
409c: 81 11 cpse r24, r1
|
|
409e: 06 c0 rjmp .+12 ; 0x40ac <Endpoint_ClearStatusStage+0x2a>
|
|
{
|
|
if (USB_DeviceState == DEVICE_STATE_Unattached)
|
|
40a0: 80 91 14 23 lds r24, 0x2314
|
|
40a4: 81 11 cpse r24, r1
|
|
40a6: f9 cf rjmp .-14 ; 0x409a <Endpoint_ClearStatusStage+0x18>
|
|
40a8: 08 95 ret
|
|
{
|
|
if (USB_DeviceState == DEVICE_STATE_Unattached)
|
|
return;
|
|
}
|
|
|
|
Endpoint_ClearIN();
|
|
40aa: eb cd rjmp .-1066 ; 0x3c82 <Endpoint_ClearIN>
|
|
{
|
|
if (USB_DeviceState == DEVICE_STATE_Unattached)
|
|
return;
|
|
}
|
|
|
|
Endpoint_ClearOUT();
|
|
40ac: 03 ce rjmp .-1018 ; 0x3cb4 <Endpoint_ClearOUT>
|
|
|
|
000040ae <Endpoint_WaitUntilReady>:
|
|
}
|
|
}
|
|
|
|
#if !defined(CONTROL_ONLY_DEVICE)
|
|
uint8_t Endpoint_WaitUntilReady(void)
|
|
{
|
|
40ae: 1f 93 push r17
|
|
40b0: cf 93 push r28
|
|
40b2: df 93 push r29
|
|
* \return Current USB frame number from the USB controller.
|
|
*/
|
|
static inline uint16_t USB_Device_GetFrameNumber(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;
|
|
static inline uint16_t USB_Device_GetFrameNumber(void)
|
|
{
|
|
return ((USB_EndpointTable_t*)USB.EPPTR)->FrameNum;
|
|
40b4: e0 91 c6 04 lds r30, 0x04C6
|
|
40b8: f0 91 c7 04 lds r31, 0x04C7
|
|
40bc: e0 5a subi r30, 0xA0 ; 160
|
|
40be: ff 4f sbci r31, 0xFF ; 255
|
|
40c0: c0 81 ld r28, Z
|
|
40c2: d1 81 ldd r29, Z+1 ; 0x01
|
|
#if (USB_STREAM_TIMEOUT_MS < 0xFF)
|
|
uint8_t TimeoutMSRem = USB_STREAM_TIMEOUT_MS;
|
|
40c4: 14 e6 ldi r17, 0x64 ; 100
|
|
* \return The currently selected endpoint's direction, as a \c ENDPOINT_DIR_* mask.
|
|
*/
|
|
static inline uint8_t Endpoint_GetEndpointDirection(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
|
|
static inline uint8_t Endpoint_GetEndpointDirection(void)
|
|
{
|
|
return (USB_Endpoint_SelectedEndpoint & ENDPOINT_DIR_IN);
|
|
40c6: 80 91 21 23 lds r24, 0x2321
|
|
40ca: 80 78 andi r24, 0x80 ; 128
|
|
|
|
uint16_t PreviousFrameNumber = USB_Device_GetFrameNumber();
|
|
|
|
for (;;)
|
|
{
|
|
if (Endpoint_GetEndpointDirection() == ENDPOINT_DIR_IN)
|
|
40cc: 80 38 cpi r24, 0x80 ; 128
|
|
40ce: 31 f1 breq .+76 ; 0x411c <Endpoint_WaitUntilReady+0x6e>
|
|
if (Endpoint_IsINReady())
|
|
return ENDPOINT_READYWAIT_NoError;
|
|
}
|
|
else
|
|
{
|
|
if (Endpoint_IsOUTReceived())
|
|
40d0: b8 de rcall .-656 ; 0x3e42 <Endpoint_IsOUTReceived>
|
|
40d2: 81 11 cpse r24, r1
|
|
40d4: 26 c0 rjmp .+76 ; 0x4122 <Endpoint_WaitUntilReady+0x74>
|
|
return ENDPOINT_READYWAIT_NoError;
|
|
}
|
|
|
|
uint8_t USB_DeviceState_LCL = USB_DeviceState;
|
|
40d6: 80 91 14 23 lds r24, 0x2314
|
|
|
|
if (USB_DeviceState_LCL == DEVICE_STATE_Unattached)
|
|
40da: 88 23 and r24, r24
|
|
40dc: 39 f1 breq .+78 ; 0x412c <Endpoint_WaitUntilReady+0x7e>
|
|
return ENDPOINT_READYWAIT_DeviceDisconnected;
|
|
else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended)
|
|
40de: 85 30 cpi r24, 0x05 ; 5
|
|
40e0: 51 f1 breq .+84 ; 0x4136 <Endpoint_WaitUntilReady+0x88>
|
|
* \return Boolean \c true if the currently selected endpoint is stalled, \c false otherwise.
|
|
*/
|
|
static inline bool Endpoint_IsStalled(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
|
|
static inline bool Endpoint_IsStalled(void)
|
|
{
|
|
return ((USB_Endpoint_SelectedHandle->CTRL & USB_EP_STALL_bm) ? true : false);
|
|
40e2: e0 91 1f 23 lds r30, 0x231F
|
|
40e6: f0 91 20 23 lds r31, 0x2320
|
|
40ea: 81 81 ldd r24, Z+1 ; 0x01
|
|
return ENDPOINT_READYWAIT_BusSuspended;
|
|
else if (Endpoint_IsStalled())
|
|
40ec: 82 fd sbrc r24, 2
|
|
40ee: 28 c0 rjmp .+80 ; 0x4140 <Endpoint_WaitUntilReady+0x92>
|
|
40f0: e0 91 c6 04 lds r30, 0x04C6
|
|
40f4: f0 91 c7 04 lds r31, 0x04C7
|
|
40f8: e0 5a subi r30, 0xA0 ; 160
|
|
40fa: ff 4f sbci r31, 0xFF ; 255
|
|
40fc: 80 81 ld r24, Z
|
|
40fe: 91 81 ldd r25, Z+1 ; 0x01
|
|
return ENDPOINT_READYWAIT_EndpointStalled;
|
|
|
|
uint16_t CurrentFrameNumber = USB_Device_GetFrameNumber();
|
|
|
|
if (CurrentFrameNumber != PreviousFrameNumber)
|
|
4100: c8 17 cp r28, r24
|
|
4102: d9 07 cpc r29, r25
|
|
4104: 01 f3 breq .-64 ; 0x40c6 <Endpoint_WaitUntilReady+0x18>
|
|
{
|
|
PreviousFrameNumber = CurrentFrameNumber;
|
|
|
|
if (!(TimeoutMSRem--))
|
|
4106: 21 2f mov r18, r17
|
|
4108: 21 50 subi r18, 0x01 ; 1
|
|
410a: 11 23 and r17, r17
|
|
410c: f1 f0 breq .+60 ; 0x414a <Endpoint_WaitUntilReady+0x9c>
|
|
410e: ec 01 movw r28, r24
|
|
4110: 12 2f mov r17, r18
|
|
* \return The currently selected endpoint's direction, as a \c ENDPOINT_DIR_* mask.
|
|
*/
|
|
static inline uint8_t Endpoint_GetEndpointDirection(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
|
|
static inline uint8_t Endpoint_GetEndpointDirection(void)
|
|
{
|
|
return (USB_Endpoint_SelectedEndpoint & ENDPOINT_DIR_IN);
|
|
4112: 80 91 21 23 lds r24, 0x2321
|
|
4116: 80 78 andi r24, 0x80 ; 128
|
|
|
|
uint16_t PreviousFrameNumber = USB_Device_GetFrameNumber();
|
|
|
|
for (;;)
|
|
{
|
|
if (Endpoint_GetEndpointDirection() == ENDPOINT_DIR_IN)
|
|
4118: 80 38 cpi r24, 0x80 ; 128
|
|
411a: d1 f6 brne .-76 ; 0x40d0 <Endpoint_WaitUntilReady+0x22>
|
|
{
|
|
if (Endpoint_IsINReady())
|
|
411c: ab de rcall .-682 ; 0x3e74 <Endpoint_IsINReady>
|
|
411e: 88 23 and r24, r24
|
|
4120: d1 f2 breq .-76 ; 0x40d6 <Endpoint_WaitUntilReady+0x28>
|
|
return ENDPOINT_READYWAIT_NoError;
|
|
4122: 80 e0 ldi r24, 0x00 ; 0
|
|
|
|
if (!(TimeoutMSRem--))
|
|
return ENDPOINT_READYWAIT_Timeout;
|
|
}
|
|
}
|
|
}
|
|
4124: df 91 pop r29
|
|
4126: cf 91 pop r28
|
|
4128: 1f 91 pop r17
|
|
412a: 08 95 ret
|
|
}
|
|
|
|
uint8_t USB_DeviceState_LCL = USB_DeviceState;
|
|
|
|
if (USB_DeviceState_LCL == DEVICE_STATE_Unattached)
|
|
return ENDPOINT_READYWAIT_DeviceDisconnected;
|
|
412c: 82 e0 ldi r24, 0x02 ; 2
|
|
|
|
if (!(TimeoutMSRem--))
|
|
return ENDPOINT_READYWAIT_Timeout;
|
|
}
|
|
}
|
|
}
|
|
412e: df 91 pop r29
|
|
4130: cf 91 pop r28
|
|
4132: 1f 91 pop r17
|
|
4134: 08 95 ret
|
|
uint8_t USB_DeviceState_LCL = USB_DeviceState;
|
|
|
|
if (USB_DeviceState_LCL == DEVICE_STATE_Unattached)
|
|
return ENDPOINT_READYWAIT_DeviceDisconnected;
|
|
else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended)
|
|
return ENDPOINT_READYWAIT_BusSuspended;
|
|
4136: 83 e0 ldi r24, 0x03 ; 3
|
|
|
|
if (!(TimeoutMSRem--))
|
|
return ENDPOINT_READYWAIT_Timeout;
|
|
}
|
|
}
|
|
}
|
|
4138: df 91 pop r29
|
|
413a: cf 91 pop r28
|
|
413c: 1f 91 pop r17
|
|
413e: 08 95 ret
|
|
if (USB_DeviceState_LCL == DEVICE_STATE_Unattached)
|
|
return ENDPOINT_READYWAIT_DeviceDisconnected;
|
|
else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended)
|
|
return ENDPOINT_READYWAIT_BusSuspended;
|
|
else if (Endpoint_IsStalled())
|
|
return ENDPOINT_READYWAIT_EndpointStalled;
|
|
4140: 81 e0 ldi r24, 0x01 ; 1
|
|
|
|
if (!(TimeoutMSRem--))
|
|
return ENDPOINT_READYWAIT_Timeout;
|
|
}
|
|
}
|
|
}
|
|
4142: df 91 pop r29
|
|
4144: cf 91 pop r28
|
|
4146: 1f 91 pop r17
|
|
4148: 08 95 ret
|
|
if (CurrentFrameNumber != PreviousFrameNumber)
|
|
{
|
|
PreviousFrameNumber = CurrentFrameNumber;
|
|
|
|
if (!(TimeoutMSRem--))
|
|
return ENDPOINT_READYWAIT_Timeout;
|
|
414a: 84 e0 ldi r24, 0x04 ; 4
|
|
}
|
|
}
|
|
}
|
|
414c: df 91 pop r29
|
|
414e: cf 91 pop r28
|
|
4150: 1f 91 pop r17
|
|
4152: 08 95 ret
|
|
|
|
00004154 <USB_Disable>:
|
|
USB_ResetInterface();
|
|
}
|
|
|
|
void USB_Disable(void)
|
|
{
|
|
USB_INT_DisableAllInterrupts();
|
|
4154: 63 d0 rcall .+198 ; 0x421c <USB_INT_DisableAllInterrupts>
|
|
USB_INT_ClearAllInterrupts();
|
|
4156: 69 d0 rcall .+210 ; 0x422a <USB_INT_ClearAllInterrupts>
|
|
* enumerating the device once attached until \ref USB_Attach() is called.
|
|
*/
|
|
static inline void USB_Detach(void) ATTR_ALWAYS_INLINE;
|
|
static inline void USB_Detach(void)
|
|
{
|
|
USB.CTRLB &= ~USB_ATTACH_bm;
|
|
4158: e0 ec ldi r30, 0xC0 ; 192
|
|
415a: f4 e0 ldi r31, 0x04 ; 4
|
|
415c: 81 81 ldd r24, Z+1 ; 0x01
|
|
415e: 8e 7f andi r24, 0xFE ; 254
|
|
4160: 81 83 std Z+1, r24 ; 0x01
|
|
}
|
|
|
|
static inline void USB_Controller_Disable(void) ATTR_ALWAYS_INLINE;
|
|
static inline void USB_Controller_Disable(void)
|
|
{
|
|
USB.CTRLA &= ~USB_ENABLE_bm;
|
|
4162: 80 81 ld r24, Z
|
|
4164: 8f 77 andi r24, 0x7F ; 127
|
|
4166: 80 83 st Z, r24
|
|
|
|
USB_Detach();
|
|
USB_Controller_Disable();
|
|
|
|
USB_IsInitialized = false;
|
|
4168: 10 92 13 23 sts 0x2313, r1
|
|
416c: 08 95 ret
|
|
|
|
0000416e <USB_ResetInterface>:
|
|
}
|
|
|
|
void USB_ResetInterface(void)
|
|
{
|
|
416e: cf 93 push r28
|
|
4170: df 93 push r29
|
|
#if defined(USB_DEVICE_OPT_FULLSPEED)
|
|
if (USB_Options & USB_DEVICE_OPT_LOWSPEED)
|
|
CLK.USBCTRL = (((F_USB / 6000000) - 1) << CLK_USBPSDIV_gp);
|
|
else
|
|
CLK.USBCTRL = (((F_USB / 48000000) - 1) << CLK_USBPSDIV_gp);
|
|
4172: e0 e4 ldi r30, 0x40 ; 64
|
|
4174: f0 e0 ldi r31, 0x00 ; 0
|
|
4176: 14 82 std Z+4, r1 ; 0x04
|
|
#else
|
|
CLK.USBCTRL = (((F_USB / 6000000) - 1) << CLK_USBPSDIV_gp);
|
|
#endif
|
|
|
|
if (USB_Options & USB_OPT_PLLCLKSRC)
|
|
CLK.USBCTRL |= (CLK_USBSRC_PLL_gc | CLK_USBSEN_bm);
|
|
4178: 84 81 ldd r24, Z+4 ; 0x04
|
|
417a: 81 60 ori r24, 0x01 ; 1
|
|
417c: 84 83 std Z+4, r24 ; 0x04
|
|
else
|
|
CLK.USBCTRL |= (CLK_USBSRC_RC32M_gc | CLK_USBSEN_bm);
|
|
|
|
USB_Device_SetDeviceAddress(0);
|
|
|
|
USB_INT_DisableAllInterrupts();
|
|
417e: 4e d0 rcall .+156 ; 0x421c <USB_INT_DisableAllInterrupts>
|
|
USB_INT_ClearAllInterrupts();
|
|
4180: 54 d0 rcall .+168 ; 0x422a <USB_INT_ClearAllInterrupts>
|
|
}
|
|
|
|
static inline void USB_Controller_Reset(void) ATTR_ALWAYS_INLINE;
|
|
static inline void USB_Controller_Reset(void)
|
|
{
|
|
USB.CTRLA &= ~USB_ENABLE_bm;
|
|
4182: c0 ec ldi r28, 0xC0 ; 192
|
|
4184: d4 e0 ldi r29, 0x04 ; 4
|
|
4186: 88 81 ld r24, Y
|
|
4188: 8f 77 andi r24, 0x7F ; 127
|
|
418a: 88 83 st Y, r24
|
|
USB.CTRLA |= USB_ENABLE_bm;
|
|
418c: 88 81 ld r24, Y
|
|
418e: 80 68 ori r24, 0x80 ; 128
|
|
4190: 88 83 st Y, r24
|
|
}
|
|
|
|
#if defined(USB_CAN_BE_DEVICE)
|
|
static void USB_Init_Device(void)
|
|
{
|
|
USB_DeviceState = DEVICE_STATE_Unattached;
|
|
4192: 10 92 14 23 sts 0x2314, r1
|
|
USB_Device_ConfigurationNumber = 0;
|
|
4196: 10 92 10 23 sts 0x2310, r1
|
|
|
|
#if !defined(NO_DEVICE_REMOTE_WAKEUP)
|
|
USB_Device_RemoteWakeupEnabled = false;
|
|
419a: 10 92 12 23 sts 0x2312, r1
|
|
#endif
|
|
|
|
#if !defined(NO_DEVICE_SELF_POWER)
|
|
USB_Device_CurrentlySelfPowered = false;
|
|
419e: 10 92 11 23 sts 0x2311, r1
|
|
}
|
|
|
|
static inline void USB_Device_SetFullSpeed(void) ATTR_ALWAYS_INLINE;
|
|
static inline void USB_Device_SetFullSpeed(void)
|
|
{
|
|
USB.CTRLA |= USB_SPEED_bm;
|
|
41a2: 88 81 ld r24, Y
|
|
41a4: 80 64 ori r24, 0x40 ; 64
|
|
41a6: 88 83 st Y, r24
|
|
EPConfigMask |= USB_EP_TYPE_BULK_gc;
|
|
break;
|
|
}
|
|
|
|
if (Type == EP_TYPE_CONTROL)
|
|
Endpoint_ConfigureEndpoint_PRV(Address ^ ENDPOINT_DIR_IN, EPConfigMask, Size);
|
|
41a8: 48 e0 ldi r20, 0x08 ; 8
|
|
41aa: 68 e4 ldi r22, 0x48 ; 72
|
|
41ac: 80 e8 ldi r24, 0x80 ; 128
|
|
41ae: 6e de rcall .-804 ; 0x3e8c <Endpoint_ConfigureEndpoint_PRV>
|
|
|
|
return Endpoint_ConfigureEndpoint_PRV(Address, EPConfigMask, Size);
|
|
41b0: 48 e0 ldi r20, 0x08 ; 8
|
|
41b2: 68 e4 ldi r22, 0x48 ; 72
|
|
41b4: 80 e0 ldi r24, 0x00 ; 0
|
|
41b6: 6a de rcall .-812 ; 0x3e8c <Endpoint_ConfigureEndpoint_PRV>
|
|
static inline void USB_INT_Enable(const uint8_t Interrupt)
|
|
{
|
|
switch (Interrupt)
|
|
{
|
|
case USB_INT_BUSEVENTI:
|
|
USB.INTCTRLA |= USB_BUSEVIE_bm;
|
|
41b8: 88 85 ldd r24, Y+8 ; 0x08
|
|
41ba: 80 64 ori r24, 0x40 ; 64
|
|
41bc: 88 87 std Y+8, r24 ; 0x08
|
|
* register and despite the datasheet making no mention of its requirement in host mode.
|
|
*/
|
|
static inline void USB_Attach(void) ATTR_ALWAYS_INLINE;
|
|
static inline void USB_Attach(void)
|
|
{
|
|
USB.CTRLB |= USB_ATTACH_bm;
|
|
41be: 89 81 ldd r24, Y+1 ; 0x01
|
|
41c0: 81 60 ori r24, 0x01 ; 1
|
|
41c2: 89 83 std Y+1, r24 ; 0x01
|
|
USB_INT_DisableAllInterrupts();
|
|
USB_INT_ClearAllInterrupts();
|
|
|
|
USB_Controller_Reset();
|
|
USB_Init_Device();
|
|
}
|
|
41c4: df 91 pop r29
|
|
41c6: cf 91 pop r28
|
|
41c8: 08 95 ret
|
|
|
|
000041ca <USB_Init>:
|
|
|
|
#if !defined(USE_STATIC_OPTIONS)
|
|
const uint8_t Options
|
|
#endif
|
|
)
|
|
{
|
|
41ca: cf 93 push r28
|
|
41cc: df 93 push r29
|
|
#if (ARCH == ARCH_AVR8)
|
|
return SREG;
|
|
#elif (ARCH == ARCH_UC3)
|
|
return __builtin_mfsr(AVR32_SR);
|
|
#elif (ARCH == ARCH_XMEGA)
|
|
return SREG;
|
|
41ce: 3f b7 in r19, 0x3f ; 63
|
|
#if (ARCH == ARCH_AVR8)
|
|
cli();
|
|
#elif (ARCH == ARCH_UC3)
|
|
__builtin_ssrf(AVR32_SR_GM_OFFSET);
|
|
#elif (ARCH == ARCH_XMEGA)
|
|
cli();
|
|
41d0: f8 94 cli
|
|
#endif
|
|
|
|
uint_reg_t CurrentGlobalInt = GetGlobalInterruptMask();
|
|
GlobalInterruptDisable();
|
|
|
|
NVM.CMD = NVM_CMD_READ_CALIB_ROW_gc;
|
|
41d2: c0 ec ldi r28, 0xC0 ; 192
|
|
41d4: d1 e0 ldi r29, 0x01 ; 1
|
|
41d6: 22 e0 ldi r18, 0x02 ; 2
|
|
41d8: 2a 87 std Y+10, r18 ; 0x0a
|
|
USB.CAL0 = pgm_read_byte(offsetof(NVM_PROD_SIGNATURES_t, USBCAL0));
|
|
41da: ea e1 ldi r30, 0x1A ; 26
|
|
41dc: f0 e0 ldi r31, 0x00 ; 0
|
|
41de: e4 91 lpm r30, Z
|
|
41e0: a0 ec ldi r26, 0xC0 ; 192
|
|
41e2: b4 e0 ldi r27, 0x04 ; 4
|
|
41e4: da 96 adiw r26, 0x3a ; 58
|
|
41e6: ec 93 st X, r30
|
|
41e8: da 97 sbiw r26, 0x3a ; 58
|
|
USB.CAL1 = pgm_read_byte(offsetof(NVM_PROD_SIGNATURES_t, USBCAL1));
|
|
41ea: eb e1 ldi r30, 0x1B ; 27
|
|
41ec: f0 e0 ldi r31, 0x00 ; 0
|
|
41ee: e4 91 lpm r30, Z
|
|
41f0: db 96 adiw r26, 0x3b ; 59
|
|
41f2: ec 93 st X, r30
|
|
41f4: db 97 sbiw r26, 0x3b ; 59
|
|
NVM.CMD = NVM_CMD_NO_OPERATION_gc;
|
|
41f6: 1a 86 std Y+10, r1 ; 0x0a
|
|
|
|
/* Ugly workaround to ensure an aligned table, since __BIGGEST_ALIGNMENT__ == 1 for the 8-bit AVR-GCC toolchain */
|
|
USB.EPPTR = ((intptr_t)&USB_EndpointTable[1] & ~(1 << 0));
|
|
41f8: 8b e3 ldi r24, 0x3B ; 59
|
|
41fa: 96 e2 ldi r25, 0x26 ; 38
|
|
41fc: 8e 7f andi r24, 0xFE ; 254
|
|
41fe: 16 96 adiw r26, 0x06 ; 6
|
|
4200: 8d 93 st X+, r24
|
|
4202: 9c 93 st X, r25
|
|
4204: 17 97 sbiw r26, 0x07 ; 7
|
|
USB.CTRLA = (USB_STFRNUM_bm | ((ENDPOINT_TOTAL_ENDPOINTS - 1) << USB_MAXEP_gp));
|
|
4206: 85 e1 ldi r24, 0x15 ; 21
|
|
4208: 8c 93 st X, r24
|
|
|
|
if ((USB_Options & USB_OPT_BUSEVENT_PRIHIGH) == USB_OPT_BUSEVENT_PRIHIGH)
|
|
USB.INTCTRLA = (3 << USB_INTLVL_gp);
|
|
else if ((USB_Options & USB_OPT_BUSEVENT_PRIMED) == USB_OPT_BUSEVENT_PRIMED)
|
|
USB.INTCTRLA = (2 << USB_INTLVL_gp);
|
|
420a: 18 96 adiw r26, 0x08 ; 8
|
|
420c: 2c 93 st X, r18
|
|
if (GlobalIntState & AVR32_SR_GM)
|
|
__builtin_ssrf(AVR32_SR_GM_OFFSET);
|
|
else
|
|
__builtin_csrf(AVR32_SR_GM_OFFSET);
|
|
#elif (ARCH == ARCH_XMEGA)
|
|
SREG = GlobalIntState;
|
|
420e: 3f bf out 0x3f, r19 ; 63
|
|
|
|
#if defined(USB_CAN_BE_BOTH)
|
|
USB_CurrentMode = Mode;
|
|
#endif
|
|
|
|
USB_IsInitialized = true;
|
|
4210: 81 e0 ldi r24, 0x01 ; 1
|
|
4212: 80 93 13 23 sts 0x2313, r24
|
|
|
|
USB_ResetInterface();
|
|
}
|
|
4216: df 91 pop r29
|
|
4218: cf 91 pop r28
|
|
USB_CurrentMode = Mode;
|
|
#endif
|
|
|
|
USB_IsInitialized = true;
|
|
|
|
USB_ResetInterface();
|
|
421a: a9 cf rjmp .-174 ; 0x416e <USB_ResetInterface>
|
|
|
|
0000421c <USB_INT_DisableAllInterrupts>:
|
|
#define __INCLUDE_FROM_USB_DRIVER
|
|
#include "../USBInterrupt.h"
|
|
|
|
void USB_INT_DisableAllInterrupts(void)
|
|
{
|
|
USB.INTCTRLA &= USB_INTLVL_gm;
|
|
421c: e0 ec ldi r30, 0xC0 ; 192
|
|
421e: f4 e0 ldi r31, 0x04 ; 4
|
|
4220: 80 85 ldd r24, Z+8 ; 0x08
|
|
4222: 83 70 andi r24, 0x03 ; 3
|
|
4224: 80 87 std Z+8, r24 ; 0x08
|
|
USB.INTCTRLB = 0;
|
|
4226: 11 86 std Z+9, r1 ; 0x09
|
|
4228: 08 95 ret
|
|
|
|
0000422a <USB_INT_ClearAllInterrupts>:
|
|
}
|
|
|
|
void USB_INT_ClearAllInterrupts(void)
|
|
{
|
|
USB.INTFLAGSACLR = 0xFF;
|
|
422a: e0 ec ldi r30, 0xC0 ; 192
|
|
422c: f4 e0 ldi r31, 0x04 ; 4
|
|
422e: 8f ef ldi r24, 0xFF ; 255
|
|
4230: 82 87 std Z+10, r24 ; 0x0a
|
|
USB.INTFLAGSBCLR = 0xFF;
|
|
4232: 84 87 std Z+12, r24 ; 0x0c
|
|
4234: 08 95 ret
|
|
|
|
00004236 <__vector_125>:
|
|
}
|
|
|
|
ISR(USB_BUSEVENT_vect)
|
|
{
|
|
4236: 1f 92 push r1
|
|
4238: 0f 92 push r0
|
|
423a: 0f b6 in r0, 0x3f ; 63
|
|
423c: 0f 92 push r0
|
|
423e: 11 24 eor r1, r1
|
|
4240: 2f 93 push r18
|
|
4242: 3f 93 push r19
|
|
4244: 4f 93 push r20
|
|
4246: 5f 93 push r21
|
|
4248: 6f 93 push r22
|
|
424a: 7f 93 push r23
|
|
424c: 8f 93 push r24
|
|
424e: 9f 93 push r25
|
|
4250: af 93 push r26
|
|
4252: bf 93 push r27
|
|
4254: ef 93 push r30
|
|
4256: ff 93 push r31
|
|
case USB_INT_BUSEVENTI_Resume:
|
|
return ((USB.INTFLAGSACLR & USB_RESUMEIF_bm) ? true : false);
|
|
case USB_INT_BUSEVENTI_Reset:
|
|
return ((USB.INTFLAGSACLR & USB_RSTIF_bm) ? true : false);
|
|
case USB_INT_SOFI:
|
|
return ((USB.INTFLAGSACLR & USB_SOFIF_bm) ? true : false);
|
|
4258: 80 91 ca 04 lds r24, 0x04CA
|
|
#if !defined(NO_SOF_EVENTS)
|
|
if (USB_INT_HasOccurred(USB_INT_SOFI) && USB_INT_IsEnabled(USB_INT_SOFI))
|
|
425c: 87 fd sbrc r24, 7
|
|
425e: 4d c0 rjmp .+154 ; 0x42fa <__vector_125+0xc4>
|
|
static inline bool USB_INT_HasOccurred(const uint8_t Interrupt)
|
|
{
|
|
switch (Interrupt)
|
|
{
|
|
case USB_INT_BUSEVENTI_Suspend:
|
|
return ((USB.INTFLAGSACLR & USB_SUSPENDIF_bm) ? true : false);
|
|
4260: 80 91 ca 04 lds r24, 0x04CA
|
|
|
|
EVENT_USB_Device_StartOfFrame();
|
|
}
|
|
#endif
|
|
|
|
if (USB_INT_HasOccurred(USB_INT_BUSEVENTI_Suspend))
|
|
4264: 86 fd sbrc r24, 6
|
|
4266: 41 c0 rjmp .+130 ; 0x42ea <__vector_125+0xb4>
|
|
case USB_INT_BUSEVENTI_Resume:
|
|
return ((USB.INTFLAGSACLR & USB_RESUMEIF_bm) ? true : false);
|
|
4268: 80 91 ca 04 lds r24, 0x04CA
|
|
USB_DeviceState = DEVICE_STATE_Suspended;
|
|
EVENT_USB_Device_Suspend();
|
|
#endif
|
|
}
|
|
|
|
if (USB_INT_HasOccurred(USB_INT_BUSEVENTI_Resume))
|
|
426c: 85 ff sbrs r24, 5
|
|
426e: 0c c0 rjmp .+24 ; 0x4288 <__vector_125+0x52>
|
|
{
|
|
case USB_INT_BUSEVENTI_Suspend:
|
|
USB.INTFLAGSACLR = USB_SUSPENDIF_bm;
|
|
break;
|
|
case USB_INT_BUSEVENTI_Resume:
|
|
USB.INTFLAGSACLR = USB_RESUMEIF_bm;
|
|
4270: 80 e2 ldi r24, 0x20 ; 32
|
|
4272: 80 93 ca 04 sts 0x04CA, r24
|
|
{
|
|
USB_INT_Clear(USB_INT_BUSEVENTI_Resume);
|
|
|
|
if (USB_Device_ConfigurationNumber)
|
|
4276: 80 91 10 23 lds r24, 0x2310
|
|
427a: 88 23 and r24, r24
|
|
427c: 71 f1 breq .+92 ; 0x42da <__vector_125+0xa4>
|
|
USB_DeviceState = DEVICE_STATE_Configured;
|
|
427e: 84 e0 ldi r24, 0x04 ; 4
|
|
4280: 80 93 14 23 sts 0x2314, r24
|
|
else
|
|
USB_DeviceState = (USB_Device_IsAddressSet()) ? DEVICE_STATE_Addressed : DEVICE_STATE_Powered;
|
|
|
|
#if !defined(NO_LIMITED_CONTROLLER_CONNECT)
|
|
EVENT_USB_Device_Connect();
|
|
4284: 0e 94 28 0b call 0x1650 ; 0x1650 <EVENT_USB_Device_Connect>
|
|
case USB_INT_BUSEVENTI_Suspend:
|
|
return ((USB.INTFLAGSACLR & USB_SUSPENDIF_bm) ? true : false);
|
|
case USB_INT_BUSEVENTI_Resume:
|
|
return ((USB.INTFLAGSACLR & USB_RESUMEIF_bm) ? true : false);
|
|
case USB_INT_BUSEVENTI_Reset:
|
|
return ((USB.INTFLAGSACLR & USB_RSTIF_bm) ? true : false);
|
|
4288: 80 91 ca 04 lds r24, 0x04CA
|
|
#else
|
|
EVENT_USB_Device_WakeUp();
|
|
#endif
|
|
}
|
|
|
|
if (USB_INT_HasOccurred(USB_INT_BUSEVENTI_Reset))
|
|
428c: 84 ff sbrs r24, 4
|
|
428e: 14 c0 rjmp .+40 ; 0x42b8 <__vector_125+0x82>
|
|
break;
|
|
case USB_INT_BUSEVENTI_Resume:
|
|
USB.INTFLAGSACLR = USB_RESUMEIF_bm;
|
|
break;
|
|
case USB_INT_BUSEVENTI_Reset:
|
|
USB.INTFLAGSACLR = USB_RSTIF_bm;
|
|
4290: 80 e1 ldi r24, 0x10 ; 16
|
|
4292: 80 93 ca 04 sts 0x04CA, r24
|
|
{
|
|
USB_INT_Clear(USB_INT_BUSEVENTI_Reset);
|
|
|
|
USB_DeviceState = DEVICE_STATE_Default;
|
|
4296: 82 e0 ldi r24, 0x02 ; 2
|
|
4298: 80 93 14 23 sts 0x2314, r24
|
|
USB_Device_ConfigurationNumber = 0;
|
|
429c: 10 92 10 23 sts 0x2310, r1
|
|
}
|
|
|
|
static inline void USB_Device_EnableDeviceAddress(const uint8_t Address) ATTR_ALWAYS_INLINE;
|
|
static inline void USB_Device_EnableDeviceAddress(const uint8_t Address)
|
|
{
|
|
USB.ADDR = Address;
|
|
42a0: 10 92 c3 04 sts 0x04C3, r1
|
|
|
|
USB_Device_EnableDeviceAddress(0);
|
|
|
|
Endpoint_ClearEndpoints();
|
|
42a4: b6 de rcall .-660 ; 0x4012 <Endpoint_ClearEndpoints>
|
|
EPConfigMask |= USB_EP_TYPE_BULK_gc;
|
|
break;
|
|
}
|
|
|
|
if (Type == EP_TYPE_CONTROL)
|
|
Endpoint_ConfigureEndpoint_PRV(Address ^ ENDPOINT_DIR_IN, EPConfigMask, Size);
|
|
42a6: 48 e0 ldi r20, 0x08 ; 8
|
|
42a8: 68 e4 ldi r22, 0x48 ; 72
|
|
42aa: 80 e8 ldi r24, 0x80 ; 128
|
|
42ac: ef dd rcall .-1058 ; 0x3e8c <Endpoint_ConfigureEndpoint_PRV>
|
|
|
|
return Endpoint_ConfigureEndpoint_PRV(Address, EPConfigMask, Size);
|
|
42ae: 48 e0 ldi r20, 0x08 ; 8
|
|
42b0: 68 e4 ldi r22, 0x48 ; 72
|
|
42b2: 80 e0 ldi r24, 0x00 ; 0
|
|
42b4: eb dd rcall .-1066 ; 0x3e8c <Endpoint_ConfigureEndpoint_PRV>
|
|
Endpoint_ConfigureEndpoint(ENDPOINT_CONTROLEP, EP_TYPE_CONTROL,
|
|
USB_Device_ControlEndpointSize, 1);
|
|
|
|
EVENT_USB_Device_Reset();
|
|
42b6: 23 db rcall .-2490 ; 0x38fe <USB_Event_Stub>
|
|
}
|
|
}
|
|
42b8: ff 91 pop r31
|
|
42ba: ef 91 pop r30
|
|
42bc: bf 91 pop r27
|
|
42be: af 91 pop r26
|
|
42c0: 9f 91 pop r25
|
|
42c2: 8f 91 pop r24
|
|
42c4: 7f 91 pop r23
|
|
42c6: 6f 91 pop r22
|
|
42c8: 5f 91 pop r21
|
|
42ca: 4f 91 pop r20
|
|
42cc: 3f 91 pop r19
|
|
42ce: 2f 91 pop r18
|
|
42d0: 0f 90 pop r0
|
|
42d2: 0f be out 0x3f, r0 ; 63
|
|
42d4: 0f 90 pop r0
|
|
42d6: 1f 90 pop r1
|
|
42d8: 18 95 reti
|
|
}
|
|
|
|
static inline bool USB_Device_IsAddressSet(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;
|
|
static inline bool USB_Device_IsAddressSet(void)
|
|
{
|
|
return ((USB.ADDR != 0) ? true : false);
|
|
42da: 80 91 c3 04 lds r24, 0x04C3
|
|
USB_INT_Clear(USB_INT_BUSEVENTI_Resume);
|
|
|
|
if (USB_Device_ConfigurationNumber)
|
|
USB_DeviceState = DEVICE_STATE_Configured;
|
|
else
|
|
USB_DeviceState = (USB_Device_IsAddressSet()) ? DEVICE_STATE_Addressed : DEVICE_STATE_Powered;
|
|
42de: 81 11 cpse r24, r1
|
|
42e0: 15 c0 rjmp .+42 ; 0x430c <__vector_125+0xd6>
|
|
42e2: 81 e0 ldi r24, 0x01 ; 1
|
|
42e4: 80 93 14 23 sts 0x2314, r24
|
|
42e8: cd cf rjmp .-102 ; 0x4284 <__vector_125+0x4e>
|
|
static inline void USB_INT_Clear(const uint8_t Interrupt)
|
|
{
|
|
switch (Interrupt)
|
|
{
|
|
case USB_INT_BUSEVENTI_Suspend:
|
|
USB.INTFLAGSACLR = USB_SUSPENDIF_bm;
|
|
42ea: 80 e4 ldi r24, 0x40 ; 64
|
|
42ec: 80 93 ca 04 sts 0x04CA, r24
|
|
if (USB_INT_HasOccurred(USB_INT_BUSEVENTI_Suspend))
|
|
{
|
|
USB_INT_Clear(USB_INT_BUSEVENTI_Suspend);
|
|
|
|
#if !defined(NO_LIMITED_CONTROLLER_CONNECT)
|
|
USB_DeviceState = DEVICE_STATE_Unattached;
|
|
42f0: 10 92 14 23 sts 0x2314, r1
|
|
EVENT_USB_Device_Disconnect();
|
|
42f4: 0e 94 2d 0b call 0x165a ; 0x165a <EVENT_USB_Device_Disconnect>
|
|
42f8: b7 cf rjmp .-146 ; 0x4268 <__vector_125+0x32>
|
|
switch (Interrupt)
|
|
{
|
|
case USB_INT_BUSEVENTI:
|
|
return ((USB.INTCTRLA & USB_BUSEVIE_bm) ? true : false);
|
|
case USB_INT_SOFI:
|
|
return ((USB.INTCTRLA & USB_SOFIE_bm) ? true : false);
|
|
42fa: 80 91 c8 04 lds r24, 0x04C8
|
|
}
|
|
|
|
ISR(USB_BUSEVENT_vect)
|
|
{
|
|
#if !defined(NO_SOF_EVENTS)
|
|
if (USB_INT_HasOccurred(USB_INT_SOFI) && USB_INT_IsEnabled(USB_INT_SOFI))
|
|
42fe: 87 ff sbrs r24, 7
|
|
4300: af cf rjmp .-162 ; 0x4260 <__vector_125+0x2a>
|
|
break;
|
|
case USB_INT_BUSEVENTI_Reset:
|
|
USB.INTFLAGSACLR = USB_RSTIF_bm;
|
|
break;
|
|
case USB_INT_SOFI:
|
|
USB.INTFLAGSACLR = USB_SOFIF_bm;
|
|
4302: 80 e8 ldi r24, 0x80 ; 128
|
|
4304: 80 93 ca 04 sts 0x04CA, r24
|
|
{
|
|
USB_INT_Clear(USB_INT_SOFI);
|
|
|
|
EVENT_USB_Device_StartOfFrame();
|
|
4308: fa da rcall .-2572 ; 0x38fe <USB_Event_Stub>
|
|
430a: aa cf rjmp .-172 ; 0x4260 <__vector_125+0x2a>
|
|
USB_INT_Clear(USB_INT_BUSEVENTI_Resume);
|
|
|
|
if (USB_Device_ConfigurationNumber)
|
|
USB_DeviceState = DEVICE_STATE_Configured;
|
|
else
|
|
USB_DeviceState = (USB_Device_IsAddressSet()) ? DEVICE_STATE_Addressed : DEVICE_STATE_Powered;
|
|
430c: 83 e0 ldi r24, 0x03 ; 3
|
|
430e: ea cf rjmp .-44 ; 0x42e4 <__vector_125+0xae>
|
|
|
|
00004310 <CDC_Device_ConfigureEndpoints>:
|
|
|
|
void CDC_Device_CreateBlockingStream(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo,
|
|
FILE* const Stream)
|
|
{
|
|
*Stream = (FILE)FDEV_SETUP_STREAM(CDC_Device_putchar, CDC_Device_getchar_Blocking, _FDEV_SETUP_RW);
|
|
fdev_set_udata(Stream, CDCInterfaceInfo);
|
|
4310: cf 93 push r28
|
|
4312: df 93 push r29
|
|
4314: ec 01 movw r28, r24
|
|
4316: 40 96 adiw r24, 0x10 ; 16
|
|
4318: fc 01 movw r30, r24
|
|
431a: 8b e0 ldi r24, 0x0B ; 11
|
|
431c: df 01 movw r26, r30
|
|
431e: 1d 92 st X+, r1
|
|
4320: 8a 95 dec r24
|
|
4322: e9 f7 brne .-6 ; 0x431e <CDC_Device_ConfigureEndpoints+0xe>
|
|
4324: 82 e0 ldi r24, 0x02 ; 2
|
|
4326: 8c 83 std Y+4, r24 ; 0x04
|
|
4328: 89 87 std Y+9, r24 ; 0x09
|
|
432a: 83 e0 ldi r24, 0x03 ; 3
|
|
432c: 8e 87 std Y+14, r24 ; 0x0e
|
|
432e: 61 e0 ldi r22, 0x01 ; 1
|
|
4330: ce 01 movw r24, r28
|
|
4332: 01 96 adiw r24, 0x01 ; 1
|
|
4334: f8 dd rcall .-1040 ; 0x3f26 <Endpoint_ConfigureEndpointTable>
|
|
4336: 81 11 cpse r24, r1
|
|
4338: 04 c0 rjmp .+8 ; 0x4342 <CDC_Device_ConfigureEndpoints+0x32>
|
|
433a: 80 e0 ldi r24, 0x00 ; 0
|
|
433c: df 91 pop r29
|
|
433e: cf 91 pop r28
|
|
4340: 08 95 ret
|
|
4342: 61 e0 ldi r22, 0x01 ; 1
|
|
4344: ce 01 movw r24, r28
|
|
4346: 06 96 adiw r24, 0x06 ; 6
|
|
4348: ee dd rcall .-1060 ; 0x3f26 <Endpoint_ConfigureEndpointTable>
|
|
434a: 88 23 and r24, r24
|
|
434c: b1 f3 breq .-20 ; 0x433a <CDC_Device_ConfigureEndpoints+0x2a>
|
|
434e: 61 e0 ldi r22, 0x01 ; 1
|
|
4350: ce 01 movw r24, r28
|
|
4352: 0b 96 adiw r24, 0x0b ; 11
|
|
4354: df 91 pop r29
|
|
4356: cf 91 pop r28
|
|
4358: e6 cd rjmp .-1076 ; 0x3f26 <Endpoint_ConfigureEndpointTable>
|
|
|
|
0000435a <CDC_Device_SendString>:
|
|
435a: cf 93 push r28
|
|
435c: df 93 push r29
|
|
435e: d6 2f mov r29, r22
|
|
4360: c7 2f mov r28, r23
|
|
4362: 20 91 14 23 lds r18, 0x2314
|
|
4366: 24 30 cpi r18, 0x04 ; 4
|
|
4368: 21 f0 breq .+8 ; 0x4372 <CDC_Device_SendString+0x18>
|
|
436a: 82 e0 ldi r24, 0x02 ; 2
|
|
436c: df 91 pop r29
|
|
436e: cf 91 pop r28
|
|
4370: 08 95 ret
|
|
4372: fc 01 movw r30, r24
|
|
4374: 44 89 ldd r20, Z+20 ; 0x14
|
|
4376: 55 89 ldd r21, Z+21 ; 0x15
|
|
4378: 66 89 ldd r22, Z+22 ; 0x16
|
|
437a: 77 89 ldd r23, Z+23 ; 0x17
|
|
437c: 45 2b or r20, r21
|
|
437e: 46 2b or r20, r22
|
|
4380: 47 2b or r20, r23
|
|
4382: 99 f3 breq .-26 ; 0x436a <CDC_Device_SendString+0x10>
|
|
4384: 81 81 ldd r24, Z+1 ; 0x01
|
|
4386: c3 dc rcall .-1658 ; 0x3d0e <Endpoint_SelectEndpoint>
|
|
4388: ad 2f mov r26, r29
|
|
438a: bc 2f mov r27, r28
|
|
438c: fd 01 movw r30, r26
|
|
438e: 01 90 ld r0, Z+
|
|
4390: 00 20 and r0, r0
|
|
4392: e9 f7 brne .-6 ; 0x438e <CDC_Device_SendString+0x34>
|
|
4394: bf 01 movw r22, r30
|
|
4396: 61 50 subi r22, 0x01 ; 1
|
|
4398: 71 09 sbc r23, r1
|
|
439a: 6a 1b sub r22, r26
|
|
439c: 7b 0b sbc r23, r27
|
|
439e: 40 e0 ldi r20, 0x00 ; 0
|
|
43a0: 50 e0 ldi r21, 0x00 ; 0
|
|
43a2: 8d 2f mov r24, r29
|
|
43a4: 9c 2f mov r25, r28
|
|
43a6: df 91 pop r29
|
|
43a8: cf 91 pop r28
|
|
43aa: bf ca rjmp .-2690 ; 0x392a <Endpoint_Write_Stream_LE>
|
|
|
|
000043ac <CDC_Device_SendData>:
|
|
43ac: ef 92 push r14
|
|
43ae: ff 92 push r15
|
|
43b0: 0f 93 push r16
|
|
43b2: 1f 93 push r17
|
|
43b4: cf 93 push r28
|
|
43b6: df 93 push r29
|
|
43b8: eb 01 movw r28, r22
|
|
43ba: 7a 01 movw r14, r20
|
|
43bc: 20 91 14 23 lds r18, 0x2314
|
|
43c0: 24 30 cpi r18, 0x04 ; 4
|
|
43c2: 41 f0 breq .+16 ; 0x43d4 <CDC_Device_SendData+0x28>
|
|
43c4: 82 e0 ldi r24, 0x02 ; 2
|
|
43c6: df 91 pop r29
|
|
43c8: cf 91 pop r28
|
|
43ca: 1f 91 pop r17
|
|
43cc: 0f 91 pop r16
|
|
43ce: ff 90 pop r15
|
|
43d0: ef 90 pop r14
|
|
43d2: 08 95 ret
|
|
43d4: fc 01 movw r30, r24
|
|
43d6: 04 89 ldd r16, Z+20 ; 0x14
|
|
43d8: 15 89 ldd r17, Z+21 ; 0x15
|
|
43da: 26 89 ldd r18, Z+22 ; 0x16
|
|
43dc: 37 89 ldd r19, Z+23 ; 0x17
|
|
43de: 01 2b or r16, r17
|
|
43e0: 02 2b or r16, r18
|
|
43e2: 03 2b or r16, r19
|
|
43e4: 79 f3 breq .-34 ; 0x43c4 <CDC_Device_SendData+0x18>
|
|
43e6: 81 81 ldd r24, Z+1 ; 0x01
|
|
43e8: 92 dc rcall .-1756 ; 0x3d0e <Endpoint_SelectEndpoint>
|
|
43ea: 40 e0 ldi r20, 0x00 ; 0
|
|
43ec: 50 e0 ldi r21, 0x00 ; 0
|
|
43ee: b7 01 movw r22, r14
|
|
43f0: ce 01 movw r24, r28
|
|
43f2: df 91 pop r29
|
|
43f4: cf 91 pop r28
|
|
43f6: 1f 91 pop r17
|
|
43f8: 0f 91 pop r16
|
|
43fa: ff 90 pop r15
|
|
43fc: ef 90 pop r14
|
|
43fe: 95 ca rjmp .-2774 ; 0x392a <Endpoint_Write_Stream_LE>
|
|
|
|
00004400 <CDC_Device_SendByte>:
|
|
4400: 0f 93 push r16
|
|
4402: 1f 93 push r17
|
|
4404: cf 93 push r28
|
|
4406: df 93 push r29
|
|
4408: 1f 92 push r1
|
|
440a: cd b7 in r28, 0x3d ; 61
|
|
440c: de b7 in r29, 0x3e ; 62
|
|
440e: 20 91 14 23 lds r18, 0x2314
|
|
4412: 24 30 cpi r18, 0x04 ; 4
|
|
4414: 39 f0 breq .+14 ; 0x4424 <CDC_Device_SendByte+0x24>
|
|
4416: 82 e0 ldi r24, 0x02 ; 2
|
|
4418: 0f 90 pop r0
|
|
441a: df 91 pop r29
|
|
441c: cf 91 pop r28
|
|
441e: 1f 91 pop r17
|
|
4420: 0f 91 pop r16
|
|
4422: 08 95 ret
|
|
4424: fc 01 movw r30, r24
|
|
4426: 04 89 ldd r16, Z+20 ; 0x14
|
|
4428: 15 89 ldd r17, Z+21 ; 0x15
|
|
442a: 26 89 ldd r18, Z+22 ; 0x16
|
|
442c: 37 89 ldd r19, Z+23 ; 0x17
|
|
442e: 01 2b or r16, r17
|
|
4430: 02 2b or r16, r18
|
|
4432: 03 2b or r16, r19
|
|
4434: 81 f3 breq .-32 ; 0x4416 <CDC_Device_SendByte+0x16>
|
|
4436: 81 81 ldd r24, Z+1 ; 0x01
|
|
4438: 69 83 std Y+1, r22 ; 0x01
|
|
443a: 69 dc rcall .-1838 ; 0x3d0e <Endpoint_SelectEndpoint>
|
|
443c: 20 91 1d 23 lds r18, 0x231D
|
|
4440: 30 91 1e 23 lds r19, 0x231E
|
|
4444: f9 01 movw r30, r18
|
|
4446: ef 5b subi r30, 0xBF ; 191
|
|
4448: ff 4f sbci r31, 0xFF ; 255
|
|
444a: 90 81 ld r25, Z
|
|
444c: f9 01 movw r30, r18
|
|
444e: e0 5c subi r30, 0xC0 ; 192
|
|
4450: ff 4f sbci r31, 0xFF ; 255
|
|
4452: 80 81 ld r24, Z
|
|
4454: 69 81 ldd r22, Y+1 ; 0x01
|
|
4456: 98 17 cp r25, r24
|
|
4458: 30 f0 brcs .+12 ; 0x4466 <CDC_Device_SendByte+0x66>
|
|
445a: 69 83 std Y+1, r22 ; 0x01
|
|
445c: 12 dc rcall .-2012 ; 0x3c82 <Endpoint_ClearIN>
|
|
445e: 27 de rcall .-946 ; 0x40ae <Endpoint_WaitUntilReady>
|
|
4460: 69 81 ldd r22, Y+1 ; 0x01
|
|
4462: 81 11 cpse r24, r1
|
|
4464: d9 cf rjmp .-78 ; 0x4418 <CDC_Device_SendByte+0x18>
|
|
4466: 86 2f mov r24, r22
|
|
4468: 43 dc rcall .-1914 ; 0x3cf0 <Endpoint_Write_8>
|
|
446a: 80 e0 ldi r24, 0x00 ; 0
|
|
446c: d5 cf rjmp .-86 ; 0x4418 <CDC_Device_SendByte+0x18>
|
|
|
|
0000446e <CDC_Device_Flush>:
|
|
446e: 0f 93 push r16
|
|
4470: 1f 93 push r17
|
|
4472: cf 93 push r28
|
|
4474: df 93 push r29
|
|
4476: 1f 92 push r1
|
|
4478: cd b7 in r28, 0x3d ; 61
|
|
447a: de b7 in r29, 0x3e ; 62
|
|
447c: 20 91 14 23 lds r18, 0x2314
|
|
4480: 24 30 cpi r18, 0x04 ; 4
|
|
4482: 39 f0 breq .+14 ; 0x4492 <CDC_Device_Flush+0x24>
|
|
4484: 82 e0 ldi r24, 0x02 ; 2
|
|
4486: 0f 90 pop r0
|
|
4488: df 91 pop r29
|
|
448a: cf 91 pop r28
|
|
448c: 1f 91 pop r17
|
|
448e: 0f 91 pop r16
|
|
4490: 08 95 ret
|
|
4492: fc 01 movw r30, r24
|
|
4494: 44 89 ldd r20, Z+20 ; 0x14
|
|
4496: 55 89 ldd r21, Z+21 ; 0x15
|
|
4498: 66 89 ldd r22, Z+22 ; 0x16
|
|
449a: 77 89 ldd r23, Z+23 ; 0x17
|
|
449c: 45 2b or r20, r21
|
|
449e: 46 2b or r20, r22
|
|
44a0: 47 2b or r20, r23
|
|
44a2: 81 f3 breq .-32 ; 0x4484 <CDC_Device_Flush+0x16>
|
|
44a4: 81 81 ldd r24, Z+1 ; 0x01
|
|
44a6: 33 dc rcall .-1946 ; 0x3d0e <Endpoint_SelectEndpoint>
|
|
44a8: 80 91 21 23 lds r24, 0x2321
|
|
44ac: 20 91 1d 23 lds r18, 0x231D
|
|
44b0: 30 91 1e 23 lds r19, 0x231E
|
|
44b4: f9 01 movw r30, r18
|
|
44b6: 87 fd sbrc r24, 7
|
|
44b8: 1d c0 rjmp .+58 ; 0x44f4 <CDC_Device_Flush+0x86>
|
|
44ba: e0 5c subi r30, 0xC0 ; 192
|
|
44bc: ff 4f sbci r31, 0xFF ; 255
|
|
44be: 80 81 ld r24, Z
|
|
44c0: f9 01 movw r30, r18
|
|
44c2: ef 5b subi r30, 0xBF ; 191
|
|
44c4: ff 4f sbci r31, 0xFF ; 255
|
|
44c6: 40 81 ld r20, Z
|
|
44c8: 90 e0 ldi r25, 0x00 ; 0
|
|
44ca: 84 1b sub r24, r20
|
|
44cc: 91 09 sbc r25, r1
|
|
44ce: 89 2b or r24, r25
|
|
44d0: 11 f4 brne .+4 ; 0x44d6 <CDC_Device_Flush+0x68>
|
|
44d2: 80 e0 ldi r24, 0x00 ; 0
|
|
44d4: d8 cf rjmp .-80 ; 0x4486 <CDC_Device_Flush+0x18>
|
|
44d6: 00 81 ld r16, Z
|
|
44d8: f9 01 movw r30, r18
|
|
44da: e0 5c subi r30, 0xC0 ; 192
|
|
44dc: ff 4f sbci r31, 0xFF ; 255
|
|
44de: 10 81 ld r17, Z
|
|
44e0: d0 db rcall .-2144 ; 0x3c82 <Endpoint_ClearIN>
|
|
44e2: 01 17 cp r16, r17
|
|
44e4: b0 f3 brcs .-20 ; 0x44d2 <CDC_Device_Flush+0x64>
|
|
44e6: e3 dd rcall .-1082 ; 0x40ae <Endpoint_WaitUntilReady>
|
|
44e8: 81 11 cpse r24, r1
|
|
44ea: cd cf rjmp .-102 ; 0x4486 <CDC_Device_Flush+0x18>
|
|
44ec: 89 83 std Y+1, r24 ; 0x01
|
|
44ee: c9 db rcall .-2158 ; 0x3c82 <Endpoint_ClearIN>
|
|
44f0: 89 81 ldd r24, Y+1 ; 0x01
|
|
44f2: c9 cf rjmp .-110 ; 0x4486 <CDC_Device_Flush+0x18>
|
|
44f4: ef 5b subi r30, 0xBF ; 191
|
|
44f6: ff 4f sbci r31, 0xFF ; 255
|
|
44f8: 80 81 ld r24, Z
|
|
44fa: 90 e0 ldi r25, 0x00 ; 0
|
|
44fc: e8 cf rjmp .-48 ; 0x44ce <CDC_Device_Flush+0x60>
|
|
|
|
000044fe <CDC_Device_USBTask>:
|
|
44fe: cf 93 push r28
|
|
4500: df 93 push r29
|
|
4502: ec 01 movw r28, r24
|
|
4504: 80 91 14 23 lds r24, 0x2314
|
|
4508: 84 30 cpi r24, 0x04 ; 4
|
|
450a: 19 f0 breq .+6 ; 0x4512 <CDC_Device_USBTask+0x14>
|
|
450c: df 91 pop r29
|
|
450e: cf 91 pop r28
|
|
4510: 08 95 ret
|
|
4512: 4c 89 ldd r20, Y+20 ; 0x14
|
|
4514: 5d 89 ldd r21, Y+21 ; 0x15
|
|
4516: 6e 89 ldd r22, Y+22 ; 0x16
|
|
4518: 7f 89 ldd r23, Y+23 ; 0x17
|
|
451a: 45 2b or r20, r21
|
|
451c: 46 2b or r20, r22
|
|
451e: 47 2b or r20, r23
|
|
4520: a9 f3 breq .-22 ; 0x450c <CDC_Device_USBTask+0xe>
|
|
4522: 89 81 ldd r24, Y+1 ; 0x01
|
|
4524: f4 db rcall .-2072 ; 0x3d0e <Endpoint_SelectEndpoint>
|
|
4526: a6 dc rcall .-1716 ; 0x3e74 <Endpoint_IsINReady>
|
|
4528: 88 23 and r24, r24
|
|
452a: 81 f3 breq .-32 ; 0x450c <CDC_Device_USBTask+0xe>
|
|
452c: ce 01 movw r24, r28
|
|
452e: df 91 pop r29
|
|
4530: cf 91 pop r28
|
|
4532: 9d cf rjmp .-198 ; 0x446e <CDC_Device_Flush>
|
|
|
|
00004534 <CDC_Device_ReceiveByte>:
|
|
4534: cf 93 push r28
|
|
4536: df 93 push r29
|
|
4538: 20 91 14 23 lds r18, 0x2314
|
|
453c: 24 30 cpi r18, 0x04 ; 4
|
|
453e: c1 f5 brne .+112 ; 0x45b0 <CDC_Device_ReceiveByte+0x7c>
|
|
4540: fc 01 movw r30, r24
|
|
4542: 44 89 ldd r20, Z+20 ; 0x14
|
|
4544: 55 89 ldd r21, Z+21 ; 0x15
|
|
4546: 66 89 ldd r22, Z+22 ; 0x16
|
|
4548: 77 89 ldd r23, Z+23 ; 0x17
|
|
454a: 45 2b or r20, r21
|
|
454c: 46 2b or r20, r22
|
|
454e: 47 2b or r20, r23
|
|
4550: 79 f1 breq .+94 ; 0x45b0 <CDC_Device_ReceiveByte+0x7c>
|
|
4552: 86 81 ldd r24, Z+6 ; 0x06
|
|
4554: dc db rcall .-2120 ; 0x3d0e <Endpoint_SelectEndpoint>
|
|
4556: 75 dc rcall .-1814 ; 0x3e42 <Endpoint_IsOUTReceived>
|
|
4558: 88 23 and r24, r24
|
|
455a: 51 f1 breq .+84 ; 0x45b0 <CDC_Device_ReceiveByte+0x7c>
|
|
455c: 80 91 21 23 lds r24, 0x2321
|
|
4560: 87 fd sbrc r24, 7
|
|
4562: 3d c0 rjmp .+122 ; 0x45de <CDC_Device_ReceiveByte+0xaa>
|
|
4564: 80 91 1d 23 lds r24, 0x231D
|
|
4568: 90 91 1e 23 lds r25, 0x231E
|
|
456c: fc 01 movw r30, r24
|
|
456e: e0 5c subi r30, 0xC0 ; 192
|
|
4570: ff 4f sbci r31, 0xFF ; 255
|
|
4572: 20 81 ld r18, Z
|
|
4574: fc 01 movw r30, r24
|
|
4576: ef 5b subi r30, 0xBF ; 191
|
|
4578: ff 4f sbci r31, 0xFF ; 255
|
|
457a: 40 81 ld r20, Z
|
|
457c: 30 e0 ldi r19, 0x00 ; 0
|
|
457e: 24 1b sub r18, r20
|
|
4580: 31 09 sbc r19, r1
|
|
4582: 23 2b or r18, r19
|
|
4584: d9 f4 brne .+54 ; 0x45bc <CDC_Device_ReceiveByte+0x88>
|
|
4586: cf ef ldi r28, 0xFF ; 255
|
|
4588: df ef ldi r29, 0xFF ; 255
|
|
458a: 20 91 21 23 lds r18, 0x2321
|
|
458e: 27 fd sbrc r18, 7
|
|
4590: 23 c0 rjmp .+70 ; 0x45d8 <CDC_Device_ReceiveByte+0xa4>
|
|
4592: dc 01 movw r26, r24
|
|
4594: a0 5c subi r26, 0xC0 ; 192
|
|
4596: bf 4f sbci r27, 0xFF ; 255
|
|
4598: 8c 91 ld r24, X
|
|
459a: 20 81 ld r18, Z
|
|
459c: 90 e0 ldi r25, 0x00 ; 0
|
|
459e: 82 1b sub r24, r18
|
|
45a0: 91 09 sbc r25, r1
|
|
45a2: 89 2b or r24, r25
|
|
45a4: 39 f4 brne .+14 ; 0x45b4 <CDC_Device_ReceiveByte+0x80>
|
|
45a6: 86 db rcall .-2292 ; 0x3cb4 <Endpoint_ClearOUT>
|
|
45a8: ce 01 movw r24, r28
|
|
45aa: df 91 pop r29
|
|
45ac: cf 91 pop r28
|
|
45ae: 08 95 ret
|
|
45b0: cf ef ldi r28, 0xFF ; 255
|
|
45b2: df ef ldi r29, 0xFF ; 255
|
|
45b4: ce 01 movw r24, r28
|
|
45b6: df 91 pop r29
|
|
45b8: cf 91 pop r28
|
|
45ba: 08 95 ret
|
|
45bc: 8a db rcall .-2284 ; 0x3cd2 <Endpoint_Read_8>
|
|
45be: c8 2f mov r28, r24
|
|
45c0: d0 e0 ldi r29, 0x00 ; 0
|
|
45c2: 80 91 1d 23 lds r24, 0x231D
|
|
45c6: 90 91 1e 23 lds r25, 0x231E
|
|
45ca: fc 01 movw r30, r24
|
|
45cc: ef 5b subi r30, 0xBF ; 191
|
|
45ce: ff 4f sbci r31, 0xFF ; 255
|
|
45d0: 20 91 21 23 lds r18, 0x2321
|
|
45d4: 27 ff sbrs r18, 7
|
|
45d6: dd cf rjmp .-70 ; 0x4592 <CDC_Device_ReceiveByte+0x5e>
|
|
45d8: 80 81 ld r24, Z
|
|
45da: 90 e0 ldi r25, 0x00 ; 0
|
|
45dc: e2 cf rjmp .-60 ; 0x45a2 <CDC_Device_ReceiveByte+0x6e>
|
|
45de: 80 91 1d 23 lds r24, 0x231D
|
|
45e2: 90 91 1e 23 lds r25, 0x231E
|
|
45e6: fc 01 movw r30, r24
|
|
45e8: ef 5b subi r30, 0xBF ; 191
|
|
45ea: ff 4f sbci r31, 0xFF ; 255
|
|
45ec: 20 81 ld r18, Z
|
|
45ee: 30 e0 ldi r19, 0x00 ; 0
|
|
45f0: c8 cf rjmp .-112 ; 0x4582 <CDC_Device_ReceiveByte+0x4e>
|
|
|
|
000045f2 <CDC_Device_Event_Stub>:
|
|
return ReceivedByte;
|
|
}
|
|
#endif
|
|
|
|
void CDC_Device_Event_Stub(void)
|
|
{
|
|
45f2: 08 95 ret
|
|
|
|
000045f4 <CDC_Device_ProcessControlRequest>:
|
|
#define __INCLUDE_FROM_CDC_DRIVER
|
|
#define __INCLUDE_FROM_CDC_DEVICE_C
|
|
#include "CDCClassDevice.h"
|
|
|
|
void CDC_Device_ProcessControlRequest(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo)
|
|
{
|
|
45f4: ff 92 push r15
|
|
45f6: 0f 93 push r16
|
|
45f8: 1f 93 push r17
|
|
45fa: cf 93 push r28
|
|
45fc: df 93 push r29
|
|
45fe: ec 01 movw r28, r24
|
|
if (!(Endpoint_IsSETUPReceived()))
|
|
4600: 07 dc rcall .-2034 ; 0x3e10 <Endpoint_IsSETUPReceived>
|
|
4602: 88 23 and r24, r24
|
|
4604: 49 f0 breq .+18 ; 0x4618 <CDC_Device_ProcessControlRequest+0x24>
|
|
return;
|
|
|
|
if (USB_ControlRequest.wIndex != CDCInterfaceInfo->Config.ControlInterfaceNumber)
|
|
4606: 88 81 ld r24, Y
|
|
4608: 90 e0 ldi r25, 0x00 ; 0
|
|
460a: 20 91 19 23 lds r18, 0x2319
|
|
460e: 30 91 1a 23 lds r19, 0x231A
|
|
4612: 28 17 cp r18, r24
|
|
4614: 39 07 cpc r19, r25
|
|
4616: 31 f0 breq .+12 ; 0x4624 <CDC_Device_ProcessControlRequest+0x30>
|
|
EVENT_CDC_Device_BreakSent(CDCInterfaceInfo, (uint8_t)USB_ControlRequest.wValue);
|
|
}
|
|
|
|
break;
|
|
}
|
|
}
|
|
4618: df 91 pop r29
|
|
461a: cf 91 pop r28
|
|
461c: 1f 91 pop r17
|
|
461e: 0f 91 pop r16
|
|
4620: ff 90 pop r15
|
|
4622: 08 95 ret
|
|
return;
|
|
|
|
if (USB_ControlRequest.wIndex != CDCInterfaceInfo->Config.ControlInterfaceNumber)
|
|
return;
|
|
|
|
switch (USB_ControlRequest.bRequest)
|
|
4624: 80 91 16 23 lds r24, 0x2316
|
|
4628: 81 32 cpi r24, 0x21 ; 33
|
|
462a: 09 f4 brne .+2 ; 0x462e <CDC_Device_ProcessControlRequest+0x3a>
|
|
462c: 4b c0 rjmp .+150 ; 0x46c4 <CDC_Device_ProcessControlRequest+0xd0>
|
|
462e: 08 f0 brcs .+2 ; 0x4632 <CDC_Device_ProcessControlRequest+0x3e>
|
|
4630: 33 c0 rjmp .+102 ; 0x4698 <CDC_Device_ProcessControlRequest+0xa4>
|
|
4632: 80 32 cpi r24, 0x20 ; 32
|
|
4634: 89 f7 brne .-30 ; 0x4618 <CDC_Device_ProcessControlRequest+0x24>
|
|
Endpoint_ClearStatusStage();
|
|
}
|
|
|
|
break;
|
|
case CDC_REQ_SetLineEncoding:
|
|
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
|
|
4636: 80 91 15 23 lds r24, 0x2315
|
|
463a: 81 32 cpi r24, 0x21 ; 33
|
|
463c: 69 f7 brne .-38 ; 0x4618 <CDC_Device_ProcessControlRequest+0x24>
|
|
{
|
|
Endpoint_ClearSETUP();
|
|
463e: bc db rcall .-2184 ; 0x3db8 <Endpoint_ClearSETUP>
|
|
|
|
while (!(Endpoint_IsOUTReceived()))
|
|
4640: 04 c0 rjmp .+8 ; 0x464a <CDC_Device_ProcessControlRequest+0x56>
|
|
{
|
|
if (USB_DeviceState == DEVICE_STATE_Unattached)
|
|
4642: 80 91 14 23 lds r24, 0x2314
|
|
4646: 88 23 and r24, r24
|
|
4648: 39 f3 breq .-50 ; 0x4618 <CDC_Device_ProcessControlRequest+0x24>
|
|
case CDC_REQ_SetLineEncoding:
|
|
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
|
|
{
|
|
Endpoint_ClearSETUP();
|
|
|
|
while (!(Endpoint_IsOUTReceived()))
|
|
464a: fb db rcall .-2058 ; 0x3e42 <Endpoint_IsOUTReceived>
|
|
464c: 88 23 and r24, r24
|
|
464e: c9 f3 breq .-14 ; 0x4642 <CDC_Device_ProcessControlRequest+0x4e>
|
|
* \return Next four bytes in the currently selected endpoint's FIFO buffer.
|
|
*/
|
|
static inline uint32_t Endpoint_Read_32_LE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
|
|
static inline uint32_t Endpoint_Read_32_LE(void)
|
|
{
|
|
uint32_t Byte0 = Endpoint_Read_8();
|
|
4650: 40 db rcall .-2432 ; 0x3cd2 <Endpoint_Read_8>
|
|
4652: 08 2f mov r16, r24
|
|
uint32_t Byte1 = Endpoint_Read_8();
|
|
4654: 3e db rcall .-2436 ; 0x3cd2 <Endpoint_Read_8>
|
|
4656: 18 2f mov r17, r24
|
|
uint32_t Byte2 = Endpoint_Read_8();
|
|
4658: 3c db rcall .-2440 ; 0x3cd2 <Endpoint_Read_8>
|
|
465a: f8 2e mov r15, r24
|
|
uint32_t Byte3 = Endpoint_Read_8();
|
|
465c: 3a db rcall .-2444 ; 0x3cd2 <Endpoint_Read_8>
|
|
static inline uint32_t Endpoint_Read_32_LE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
|
|
static inline uint32_t Endpoint_Read_32_LE(void)
|
|
{
|
|
uint32_t Byte0 = Endpoint_Read_8();
|
|
uint32_t Byte1 = Endpoint_Read_8();
|
|
uint32_t Byte2 = Endpoint_Read_8();
|
|
465e: 4f 2d mov r20, r15
|
|
4660: 50 e0 ldi r21, 0x00 ; 0
|
|
4662: 60 e0 ldi r22, 0x00 ; 0
|
|
4664: 70 e0 ldi r23, 0x00 ; 0
|
|
uint32_t Byte3 = Endpoint_Read_8();
|
|
|
|
return ((Byte3 << 24) | (Byte2 << 16) | (Byte1 << 8) | Byte0);
|
|
4666: ba 01 movw r22, r20
|
|
4668: 55 27 eor r21, r21
|
|
466a: 44 27 eor r20, r20
|
|
466c: 78 2b or r23, r24
|
|
466e: 40 2b or r20, r16
|
|
4670: 51 2b or r21, r17
|
|
{
|
|
if (USB_DeviceState == DEVICE_STATE_Unattached)
|
|
return;
|
|
}
|
|
|
|
CDCInterfaceInfo->State.LineEncoding.BaudRateBPS = Endpoint_Read_32_LE();
|
|
4672: 4c 8b std Y+20, r20 ; 0x14
|
|
4674: 5d 8b std Y+21, r21 ; 0x15
|
|
4676: 6e 8b std Y+22, r22 ; 0x16
|
|
4678: 7f 8b std Y+23, r23 ; 0x17
|
|
CDCInterfaceInfo->State.LineEncoding.CharFormat = Endpoint_Read_8();
|
|
467a: 2b db rcall .-2474 ; 0x3cd2 <Endpoint_Read_8>
|
|
467c: 88 8f std Y+24, r24 ; 0x18
|
|
CDCInterfaceInfo->State.LineEncoding.ParityType = Endpoint_Read_8();
|
|
467e: 29 db rcall .-2478 ; 0x3cd2 <Endpoint_Read_8>
|
|
4680: 89 8f std Y+25, r24 ; 0x19
|
|
CDCInterfaceInfo->State.LineEncoding.DataBits = Endpoint_Read_8();
|
|
4682: 27 db rcall .-2482 ; 0x3cd2 <Endpoint_Read_8>
|
|
4684: 8a 8f std Y+26, r24 ; 0x1a
|
|
|
|
Endpoint_ClearOUT();
|
|
4686: 16 db rcall .-2516 ; 0x3cb4 <Endpoint_ClearOUT>
|
|
Endpoint_ClearStatusStage();
|
|
4688: fc dc rcall .-1544 ; 0x4082 <Endpoint_ClearStatusStage>
|
|
|
|
EVENT_CDC_Device_LineEncodingChanged(CDCInterfaceInfo);
|
|
468a: ce 01 movw r24, r28
|
|
EVENT_CDC_Device_BreakSent(CDCInterfaceInfo, (uint8_t)USB_ControlRequest.wValue);
|
|
}
|
|
|
|
break;
|
|
}
|
|
}
|
|
468c: df 91 pop r29
|
|
468e: cf 91 pop r28
|
|
4690: 1f 91 pop r17
|
|
4692: 0f 91 pop r16
|
|
4694: ff 90 pop r15
|
|
CDCInterfaceInfo->State.LineEncoding.DataBits = Endpoint_Read_8();
|
|
|
|
Endpoint_ClearOUT();
|
|
Endpoint_ClearStatusStage();
|
|
|
|
EVENT_CDC_Device_LineEncodingChanged(CDCInterfaceInfo);
|
|
4696: ad cf rjmp .-166 ; 0x45f2 <CDC_Device_Event_Stub>
|
|
return;
|
|
|
|
if (USB_ControlRequest.wIndex != CDCInterfaceInfo->Config.ControlInterfaceNumber)
|
|
return;
|
|
|
|
switch (USB_ControlRequest.bRequest)
|
|
4698: 82 32 cpi r24, 0x22 ; 34
|
|
469a: 09 f4 brne .+2 ; 0x469e <CDC_Device_ProcessControlRequest+0xaa>
|
|
469c: 34 c0 rjmp .+104 ; 0x4706 <CDC_Device_ProcessControlRequest+0x112>
|
|
469e: 83 32 cpi r24, 0x23 ; 35
|
|
46a0: 09 f0 breq .+2 ; 0x46a4 <CDC_Device_ProcessControlRequest+0xb0>
|
|
46a2: ba cf rjmp .-140 ; 0x4618 <CDC_Device_ProcessControlRequest+0x24>
|
|
EVENT_CDC_Device_ControLineStateChanged(CDCInterfaceInfo);
|
|
}
|
|
|
|
break;
|
|
case CDC_REQ_SendBreak:
|
|
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
|
|
46a4: 80 91 15 23 lds r24, 0x2315
|
|
46a8: 81 32 cpi r24, 0x21 ; 33
|
|
46aa: 09 f0 breq .+2 ; 0x46ae <CDC_Device_ProcessControlRequest+0xba>
|
|
46ac: b5 cf rjmp .-150 ; 0x4618 <CDC_Device_ProcessControlRequest+0x24>
|
|
{
|
|
Endpoint_ClearSETUP();
|
|
46ae: 84 db rcall .-2296 ; 0x3db8 <Endpoint_ClearSETUP>
|
|
Endpoint_ClearStatusStage();
|
|
46b0: e8 dc rcall .-1584 ; 0x4082 <Endpoint_ClearStatusStage>
|
|
|
|
EVENT_CDC_Device_BreakSent(CDCInterfaceInfo, (uint8_t)USB_ControlRequest.wValue);
|
|
46b2: 60 91 17 23 lds r22, 0x2317
|
|
46b6: ce 01 movw r24, r28
|
|
}
|
|
|
|
break;
|
|
}
|
|
}
|
|
46b8: df 91 pop r29
|
|
46ba: cf 91 pop r28
|
|
46bc: 1f 91 pop r17
|
|
46be: 0f 91 pop r16
|
|
46c0: ff 90 pop r15
|
|
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
|
|
{
|
|
Endpoint_ClearSETUP();
|
|
Endpoint_ClearStatusStage();
|
|
|
|
EVENT_CDC_Device_BreakSent(CDCInterfaceInfo, (uint8_t)USB_ControlRequest.wValue);
|
|
46c2: 97 cf rjmp .-210 ; 0x45f2 <CDC_Device_Event_Stub>
|
|
return;
|
|
|
|
switch (USB_ControlRequest.bRequest)
|
|
{
|
|
case CDC_REQ_GetLineEncoding:
|
|
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
|
|
46c4: 80 91 15 23 lds r24, 0x2315
|
|
46c8: 81 3a cpi r24, 0xA1 ; 161
|
|
46ca: 09 f0 breq .+2 ; 0x46ce <CDC_Device_ProcessControlRequest+0xda>
|
|
46cc: a5 cf rjmp .-182 ; 0x4618 <CDC_Device_ProcessControlRequest+0x24>
|
|
{
|
|
Endpoint_ClearSETUP();
|
|
46ce: 74 db rcall .-2328 ; 0x3db8 <Endpoint_ClearSETUP>
|
|
|
|
while (!(Endpoint_IsINReady()));
|
|
46d0: d1 db rcall .-2142 ; 0x3e74 <Endpoint_IsINReady>
|
|
46d2: 88 23 and r24, r24
|
|
46d4: e9 f3 breq .-6 ; 0x46d0 <CDC_Device_ProcessControlRequest+0xdc>
|
|
|
|
Endpoint_Write_32_LE(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS);
|
|
46d6: 8c 89 ldd r24, Y+20 ; 0x14
|
|
46d8: fd 88 ldd r15, Y+21 ; 0x15
|
|
46da: 0e 89 ldd r16, Y+22 ; 0x16
|
|
46dc: 1f 89 ldd r17, Y+23 ; 0x17
|
|
* \param[in] Data Data to write to the currently selected endpoint's FIFO buffer.
|
|
*/
|
|
static inline void Endpoint_Write_32_LE(const uint32_t Data) ATTR_ALWAYS_INLINE;
|
|
static inline void Endpoint_Write_32_LE(const uint32_t Data)
|
|
{
|
|
Endpoint_Write_8(Data & 0xFF);
|
|
46de: 08 db rcall .-2544 ; 0x3cf0 <Endpoint_Write_8>
|
|
Endpoint_Write_8(Data >> 8);
|
|
46e0: 8f 2d mov r24, r15
|
|
46e2: 06 db rcall .-2548 ; 0x3cf0 <Endpoint_Write_8>
|
|
Endpoint_Write_8(Data >> 16);
|
|
46e4: 80 2f mov r24, r16
|
|
46e6: 04 db rcall .-2552 ; 0x3cf0 <Endpoint_Write_8>
|
|
Endpoint_Write_8(Data >> 24);
|
|
46e8: 81 2f mov r24, r17
|
|
46ea: 02 db rcall .-2556 ; 0x3cf0 <Endpoint_Write_8>
|
|
Endpoint_Write_8(CDCInterfaceInfo->State.LineEncoding.CharFormat);
|
|
46ec: 88 8d ldd r24, Y+24 ; 0x18
|
|
46ee: 00 db rcall .-2560 ; 0x3cf0 <Endpoint_Write_8>
|
|
Endpoint_Write_8(CDCInterfaceInfo->State.LineEncoding.ParityType);
|
|
46f0: 89 8d ldd r24, Y+25 ; 0x19
|
|
46f2: fe da rcall .-2564 ; 0x3cf0 <Endpoint_Write_8>
|
|
Endpoint_Write_8(CDCInterfaceInfo->State.LineEncoding.DataBits);
|
|
46f4: 8a 8d ldd r24, Y+26 ; 0x1a
|
|
46f6: fc da rcall .-2568 ; 0x3cf0 <Endpoint_Write_8>
|
|
|
|
Endpoint_ClearIN();
|
|
46f8: c4 da rcall .-2680 ; 0x3c82 <Endpoint_ClearIN>
|
|
EVENT_CDC_Device_BreakSent(CDCInterfaceInfo, (uint8_t)USB_ControlRequest.wValue);
|
|
}
|
|
|
|
break;
|
|
}
|
|
}
|
|
46fa: df 91 pop r29
|
|
46fc: cf 91 pop r28
|
|
46fe: 1f 91 pop r17
|
|
4700: 0f 91 pop r16
|
|
4702: ff 90 pop r15
|
|
Endpoint_Write_8(CDCInterfaceInfo->State.LineEncoding.CharFormat);
|
|
Endpoint_Write_8(CDCInterfaceInfo->State.LineEncoding.ParityType);
|
|
Endpoint_Write_8(CDCInterfaceInfo->State.LineEncoding.DataBits);
|
|
|
|
Endpoint_ClearIN();
|
|
Endpoint_ClearStatusStage();
|
|
4704: be cc rjmp .-1668 ; 0x4082 <Endpoint_ClearStatusStage>
|
|
EVENT_CDC_Device_LineEncodingChanged(CDCInterfaceInfo);
|
|
}
|
|
|
|
break;
|
|
case CDC_REQ_SetControlLineState:
|
|
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
|
|
4706: 80 91 15 23 lds r24, 0x2315
|
|
470a: 81 32 cpi r24, 0x21 ; 33
|
|
470c: 09 f0 breq .+2 ; 0x4710 <CDC_Device_ProcessControlRequest+0x11c>
|
|
470e: 84 cf rjmp .-248 ; 0x4618 <CDC_Device_ProcessControlRequest+0x24>
|
|
{
|
|
Endpoint_ClearSETUP();
|
|
4710: 53 db rcall .-2394 ; 0x3db8 <Endpoint_ClearSETUP>
|
|
Endpoint_ClearStatusStage();
|
|
4712: b7 dc rcall .-1682 ; 0x4082 <Endpoint_ClearStatusStage>
|
|
|
|
CDCInterfaceInfo->State.ControlLineStates.HostToDevice = USB_ControlRequest.wValue;
|
|
4714: 80 91 17 23 lds r24, 0x2317
|
|
4718: 90 91 18 23 lds r25, 0x2318
|
|
471c: 88 8b std Y+16, r24 ; 0x10
|
|
471e: 99 8b std Y+17, r25 ; 0x11
|
|
|
|
EVENT_CDC_Device_ControLineStateChanged(CDCInterfaceInfo);
|
|
4720: ce 01 movw r24, r28
|
|
EVENT_CDC_Device_BreakSent(CDCInterfaceInfo, (uint8_t)USB_ControlRequest.wValue);
|
|
}
|
|
|
|
break;
|
|
}
|
|
}
|
|
4722: df 91 pop r29
|
|
4724: cf 91 pop r28
|
|
4726: 1f 91 pop r17
|
|
4728: 0f 91 pop r16
|
|
472a: ff 90 pop r15
|
|
Endpoint_ClearSETUP();
|
|
Endpoint_ClearStatusStage();
|
|
|
|
CDCInterfaceInfo->State.ControlLineStates.HostToDevice = USB_ControlRequest.wValue;
|
|
|
|
EVENT_CDC_Device_ControLineStateChanged(CDCInterfaceInfo);
|
|
472c: 62 cf rjmp .-316 ; 0x45f2 <CDC_Device_Event_Stub>
|
|
|
|
0000472e <__mulshisi3>:
|
|
472e: b7 ff sbrs r27, 7
|
|
4730: 04 c0 rjmp .+8 ; 0x473a <__muluhisi3>
|
|
|
|
00004732 <__mulohisi3>:
|
|
4732: 03 d0 rcall .+6 ; 0x473a <__muluhisi3>
|
|
4734: 82 1b sub r24, r18
|
|
4736: 93 0b sbc r25, r19
|
|
4738: 08 95 ret
|
|
|
|
0000473a <__muluhisi3>:
|
|
473a: 09 d0 rcall .+18 ; 0x474e <__umulhisi3>
|
|
473c: a5 9f mul r26, r21
|
|
473e: 90 0d add r25, r0
|
|
4740: b4 9f mul r27, r20
|
|
4742: 90 0d add r25, r0
|
|
4744: a4 9f mul r26, r20
|
|
4746: 80 0d add r24, r0
|
|
4748: 91 1d adc r25, r1
|
|
474a: 11 24 eor r1, r1
|
|
474c: 08 95 ret
|
|
|
|
0000474e <__umulhisi3>:
|
|
474e: a2 9f mul r26, r18
|
|
4750: b0 01 movw r22, r0
|
|
4752: b3 9f mul r27, r19
|
|
4754: c0 01 movw r24, r0
|
|
4756: a3 9f mul r26, r19
|
|
4758: 01 d0 rcall .+2 ; 0x475c <__umulhisi3+0xe>
|
|
475a: b2 9f mul r27, r18
|
|
475c: 70 0d add r23, r0
|
|
475e: 81 1d adc r24, r1
|
|
4760: 11 24 eor r1, r1
|
|
4762: 91 1d adc r25, r1
|
|
4764: 08 95 ret
|
|
|
|
00004766 <do_rand>:
|
|
4766: 8f 92 push r8
|
|
4768: 9f 92 push r9
|
|
476a: af 92 push r10
|
|
476c: bf 92 push r11
|
|
476e: cf 92 push r12
|
|
4770: df 92 push r13
|
|
4772: ef 92 push r14
|
|
4774: ff 92 push r15
|
|
4776: cf 93 push r28
|
|
4778: df 93 push r29
|
|
477a: ec 01 movw r28, r24
|
|
477c: 68 81 ld r22, Y
|
|
477e: 79 81 ldd r23, Y+1 ; 0x01
|
|
4780: 8a 81 ldd r24, Y+2 ; 0x02
|
|
4782: 9b 81 ldd r25, Y+3 ; 0x03
|
|
4784: 61 15 cp r22, r1
|
|
4786: 71 05 cpc r23, r1
|
|
4788: 81 05 cpc r24, r1
|
|
478a: 91 05 cpc r25, r1
|
|
478c: 21 f4 brne .+8 ; 0x4796 <do_rand+0x30>
|
|
478e: 64 e2 ldi r22, 0x24 ; 36
|
|
4790: 79 ed ldi r23, 0xD9 ; 217
|
|
4792: 8b e5 ldi r24, 0x5B ; 91
|
|
4794: 97 e0 ldi r25, 0x07 ; 7
|
|
4796: 2d e1 ldi r18, 0x1D ; 29
|
|
4798: 33 ef ldi r19, 0xF3 ; 243
|
|
479a: 41 e0 ldi r20, 0x01 ; 1
|
|
479c: 50 e0 ldi r21, 0x00 ; 0
|
|
479e: 38 d3 rcall .+1648 ; 0x4e10 <__divmodsi4>
|
|
47a0: 49 01 movw r8, r18
|
|
47a2: 5a 01 movw r10, r20
|
|
47a4: 9b 01 movw r18, r22
|
|
47a6: ac 01 movw r20, r24
|
|
47a8: a7 ea ldi r26, 0xA7 ; 167
|
|
47aa: b1 e4 ldi r27, 0x41 ; 65
|
|
47ac: c6 df rcall .-116 ; 0x473a <__muluhisi3>
|
|
47ae: 6b 01 movw r12, r22
|
|
47b0: 7c 01 movw r14, r24
|
|
47b2: ac ee ldi r26, 0xEC ; 236
|
|
47b4: b4 ef ldi r27, 0xF4 ; 244
|
|
47b6: a5 01 movw r20, r10
|
|
47b8: 94 01 movw r18, r8
|
|
47ba: bb df rcall .-138 ; 0x4732 <__mulohisi3>
|
|
47bc: c6 0e add r12, r22
|
|
47be: d7 1e adc r13, r23
|
|
47c0: e8 1e adc r14, r24
|
|
47c2: f9 1e adc r15, r25
|
|
47c4: f7 fe sbrs r15, 7
|
|
47c6: 06 c0 rjmp .+12 ; 0x47d4 <do_rand+0x6e>
|
|
47c8: 81 e0 ldi r24, 0x01 ; 1
|
|
47ca: c8 1a sub r12, r24
|
|
47cc: d1 08 sbc r13, r1
|
|
47ce: e1 08 sbc r14, r1
|
|
47d0: 80 e8 ldi r24, 0x80 ; 128
|
|
47d2: f8 0a sbc r15, r24
|
|
47d4: c8 82 st Y, r12
|
|
47d6: d9 82 std Y+1, r13 ; 0x01
|
|
47d8: ea 82 std Y+2, r14 ; 0x02
|
|
47da: fb 82 std Y+3, r15 ; 0x03
|
|
47dc: e8 94 clt
|
|
47de: d7 f8 bld r13, 7
|
|
47e0: ee 24 eor r14, r14
|
|
47e2: ff 24 eor r15, r15
|
|
47e4: c6 01 movw r24, r12
|
|
47e6: df 91 pop r29
|
|
47e8: cf 91 pop r28
|
|
47ea: ff 90 pop r15
|
|
47ec: ef 90 pop r14
|
|
47ee: df 90 pop r13
|
|
47f0: cf 90 pop r12
|
|
47f2: bf 90 pop r11
|
|
47f4: af 90 pop r10
|
|
47f6: 9f 90 pop r9
|
|
47f8: 8f 90 pop r8
|
|
47fa: 08 95 ret
|
|
|
|
000047fc <rand_r>:
|
|
47fc: b4 cf rjmp .-152 ; 0x4766 <do_rand>
|
|
|
|
000047fe <rand>:
|
|
47fe: 8c e1 ldi r24, 0x1C ; 28
|
|
4800: 90 e2 ldi r25, 0x20 ; 32
|
|
4802: b1 cf rjmp .-158 ; 0x4766 <do_rand>
|
|
|
|
00004804 <srand>:
|
|
4804: a0 e0 ldi r26, 0x00 ; 0
|
|
4806: b0 e0 ldi r27, 0x00 ; 0
|
|
4808: 80 93 1c 20 sts 0x201C, r24
|
|
480c: 90 93 1d 20 sts 0x201D, r25
|
|
4810: a0 93 1e 20 sts 0x201E, r26
|
|
4814: b0 93 1f 20 sts 0x201F, r27
|
|
4818: 08 95 ret
|
|
|
|
0000481a <memcpy_P>:
|
|
481a: fb 01 movw r30, r22
|
|
481c: dc 01 movw r26, r24
|
|
481e: 02 c0 rjmp .+4 ; 0x4824 <memcpy_P+0xa>
|
|
4820: 05 90 lpm r0, Z+
|
|
4822: 0d 92 st X+, r0
|
|
4824: 41 50 subi r20, 0x01 ; 1
|
|
4826: 50 40 sbci r21, 0x00 ; 0
|
|
4828: d8 f7 brcc .-10 ; 0x4820 <memcpy_P+0x6>
|
|
482a: 08 95 ret
|
|
|
|
0000482c <strcmp_P>:
|
|
482c: fb 01 movw r30, r22
|
|
482e: dc 01 movw r26, r24
|
|
4830: 8d 91 ld r24, X+
|
|
4832: 05 90 lpm r0, Z+
|
|
4834: 80 19 sub r24, r0
|
|
4836: 01 10 cpse r0, r1
|
|
4838: d9 f3 breq .-10 ; 0x4830 <strcmp_P+0x4>
|
|
483a: 99 0b sbc r25, r25
|
|
483c: 08 95 ret
|
|
|
|
0000483e <strncpy_P>:
|
|
483e: fb 01 movw r30, r22
|
|
4840: dc 01 movw r26, r24
|
|
4842: 41 50 subi r20, 0x01 ; 1
|
|
4844: 50 40 sbci r21, 0x00 ; 0
|
|
4846: 48 f0 brcs .+18 ; 0x485a <strncpy_P+0x1c>
|
|
4848: 05 90 lpm r0, Z+
|
|
484a: 0d 92 st X+, r0
|
|
484c: 00 20 and r0, r0
|
|
484e: c9 f7 brne .-14 ; 0x4842 <strncpy_P+0x4>
|
|
4850: 01 c0 rjmp .+2 ; 0x4854 <strncpy_P+0x16>
|
|
4852: 1d 92 st X+, r1
|
|
4854: 41 50 subi r20, 0x01 ; 1
|
|
4856: 50 40 sbci r21, 0x00 ; 0
|
|
4858: e0 f7 brcc .-8 ; 0x4852 <strncpy_P+0x14>
|
|
485a: 08 95 ret
|
|
|
|
0000485c <memcpy>:
|
|
485c: fb 01 movw r30, r22
|
|
485e: dc 01 movw r26, r24
|
|
4860: 02 c0 rjmp .+4 ; 0x4866 <memcpy+0xa>
|
|
4862: 01 90 ld r0, Z+
|
|
4864: 0d 92 st X+, r0
|
|
4866: 41 50 subi r20, 0x01 ; 1
|
|
4868: 50 40 sbci r21, 0x00 ; 0
|
|
486a: d8 f7 brcc .-10 ; 0x4862 <memcpy+0x6>
|
|
486c: 08 95 ret
|
|
|
|
0000486e <snprintf_P>:
|
|
486e: ae e0 ldi r26, 0x0E ; 14
|
|
4870: b0 e0 ldi r27, 0x00 ; 0
|
|
4872: ec e3 ldi r30, 0x3C ; 60
|
|
4874: f4 e2 ldi r31, 0x24 ; 36
|
|
4876: f5 c2 rjmp .+1514 ; 0x4e62 <__prologue_saves__+0x1c>
|
|
4878: 0d 89 ldd r16, Y+21 ; 0x15
|
|
487a: 1e 89 ldd r17, Y+22 ; 0x16
|
|
487c: 8f 89 ldd r24, Y+23 ; 0x17
|
|
487e: 98 8d ldd r25, Y+24 ; 0x18
|
|
4880: 2e e0 ldi r18, 0x0E ; 14
|
|
4882: 2c 83 std Y+4, r18 ; 0x04
|
|
4884: 09 83 std Y+1, r16 ; 0x01
|
|
4886: 1a 83 std Y+2, r17 ; 0x02
|
|
4888: 97 ff sbrs r25, 7
|
|
488a: 02 c0 rjmp .+4 ; 0x4890 <snprintf_P+0x22>
|
|
488c: 80 e0 ldi r24, 0x00 ; 0
|
|
488e: 90 e8 ldi r25, 0x80 ; 128
|
|
4890: 01 97 sbiw r24, 0x01 ; 1
|
|
4892: 8d 83 std Y+5, r24 ; 0x05
|
|
4894: 9e 83 std Y+6, r25 ; 0x06
|
|
4896: ce 01 movw r24, r28
|
|
4898: 4b 96 adiw r24, 0x1b ; 27
|
|
489a: ac 01 movw r20, r24
|
|
489c: 69 8d ldd r22, Y+25 ; 0x19
|
|
489e: 7a 8d ldd r23, Y+26 ; 0x1a
|
|
48a0: ce 01 movw r24, r28
|
|
48a2: 01 96 adiw r24, 0x01 ; 1
|
|
48a4: 11 d0 rcall .+34 ; 0x48c8 <vfprintf>
|
|
48a6: 4d 81 ldd r20, Y+5 ; 0x05
|
|
48a8: 5e 81 ldd r21, Y+6 ; 0x06
|
|
48aa: 57 fd sbrc r21, 7
|
|
48ac: 0a c0 rjmp .+20 ; 0x48c2 <snprintf_P+0x54>
|
|
48ae: 2f 81 ldd r18, Y+7 ; 0x07
|
|
48b0: 38 85 ldd r19, Y+8 ; 0x08
|
|
48b2: 42 17 cp r20, r18
|
|
48b4: 53 07 cpc r21, r19
|
|
48b6: 0c f4 brge .+2 ; 0x48ba <snprintf_P+0x4c>
|
|
48b8: 9a 01 movw r18, r20
|
|
48ba: f8 01 movw r30, r16
|
|
48bc: e2 0f add r30, r18
|
|
48be: f3 1f adc r31, r19
|
|
48c0: 10 82 st Z, r1
|
|
48c2: 2e 96 adiw r28, 0x0e ; 14
|
|
48c4: e4 e0 ldi r30, 0x04 ; 4
|
|
48c6: e6 c2 rjmp .+1484 ; 0x4e94 <__epilogue_restores__+0x1c>
|
|
|
|
000048c8 <vfprintf>:
|
|
48c8: ac e0 ldi r26, 0x0C ; 12
|
|
48ca: b0 e0 ldi r27, 0x00 ; 0
|
|
48cc: e9 e6 ldi r30, 0x69 ; 105
|
|
48ce: f4 e2 ldi r31, 0x24 ; 36
|
|
48d0: ba c2 rjmp .+1396 ; 0x4e46 <__prologue_saves__>
|
|
48d2: 7c 01 movw r14, r24
|
|
48d4: 6b 01 movw r12, r22
|
|
48d6: 8a 01 movw r16, r20
|
|
48d8: fc 01 movw r30, r24
|
|
48da: 16 82 std Z+6, r1 ; 0x06
|
|
48dc: 17 82 std Z+7, r1 ; 0x07
|
|
48de: 83 81 ldd r24, Z+3 ; 0x03
|
|
48e0: 81 ff sbrs r24, 1
|
|
48e2: b9 c1 rjmp .+882 ; 0x4c56 <vfprintf+0x38e>
|
|
48e4: 88 24 eor r8, r8
|
|
48e6: 83 94 inc r8
|
|
48e8: 91 2c mov r9, r1
|
|
48ea: 8c 0e add r8, r28
|
|
48ec: 9d 1e adc r9, r29
|
|
48ee: f7 01 movw r30, r14
|
|
48f0: 93 81 ldd r25, Z+3 ; 0x03
|
|
48f2: f6 01 movw r30, r12
|
|
48f4: 93 fd sbrc r25, 3
|
|
48f6: 85 91 lpm r24, Z+
|
|
48f8: 93 ff sbrs r25, 3
|
|
48fa: 81 91 ld r24, Z+
|
|
48fc: 6f 01 movw r12, r30
|
|
48fe: 88 23 and r24, r24
|
|
4900: 09 f4 brne .+2 ; 0x4904 <vfprintf+0x3c>
|
|
4902: a5 c1 rjmp .+842 ; 0x4c4e <vfprintf+0x386>
|
|
4904: 85 32 cpi r24, 0x25 ; 37
|
|
4906: 39 f4 brne .+14 ; 0x4916 <vfprintf+0x4e>
|
|
4908: 93 fd sbrc r25, 3
|
|
490a: 85 91 lpm r24, Z+
|
|
490c: 93 ff sbrs r25, 3
|
|
490e: 81 91 ld r24, Z+
|
|
4910: 6f 01 movw r12, r30
|
|
4912: 85 32 cpi r24, 0x25 ; 37
|
|
4914: 21 f4 brne .+8 ; 0x491e <vfprintf+0x56>
|
|
4916: b7 01 movw r22, r14
|
|
4918: 90 e0 ldi r25, 0x00 ; 0
|
|
491a: f0 d1 rcall .+992 ; 0x4cfc <fputc>
|
|
491c: e8 cf rjmp .-48 ; 0x48ee <vfprintf+0x26>
|
|
491e: 51 2c mov r5, r1
|
|
4920: 31 2c mov r3, r1
|
|
4922: 20 e0 ldi r18, 0x00 ; 0
|
|
4924: 20 32 cpi r18, 0x20 ; 32
|
|
4926: a8 f4 brcc .+42 ; 0x4952 <vfprintf+0x8a>
|
|
4928: 8b 32 cpi r24, 0x2B ; 43
|
|
492a: 61 f0 breq .+24 ; 0x4944 <vfprintf+0x7c>
|
|
492c: 28 f4 brcc .+10 ; 0x4938 <vfprintf+0x70>
|
|
492e: 80 32 cpi r24, 0x20 ; 32
|
|
4930: 51 f0 breq .+20 ; 0x4946 <vfprintf+0x7e>
|
|
4932: 83 32 cpi r24, 0x23 ; 35
|
|
4934: 71 f4 brne .+28 ; 0x4952 <vfprintf+0x8a>
|
|
4936: 0b c0 rjmp .+22 ; 0x494e <vfprintf+0x86>
|
|
4938: 8d 32 cpi r24, 0x2D ; 45
|
|
493a: 39 f0 breq .+14 ; 0x494a <vfprintf+0x82>
|
|
493c: 80 33 cpi r24, 0x30 ; 48
|
|
493e: 49 f4 brne .+18 ; 0x4952 <vfprintf+0x8a>
|
|
4940: 21 60 ori r18, 0x01 ; 1
|
|
4942: 28 c0 rjmp .+80 ; 0x4994 <vfprintf+0xcc>
|
|
4944: 22 60 ori r18, 0x02 ; 2
|
|
4946: 24 60 ori r18, 0x04 ; 4
|
|
4948: 25 c0 rjmp .+74 ; 0x4994 <vfprintf+0xcc>
|
|
494a: 28 60 ori r18, 0x08 ; 8
|
|
494c: 23 c0 rjmp .+70 ; 0x4994 <vfprintf+0xcc>
|
|
494e: 20 61 ori r18, 0x10 ; 16
|
|
4950: 21 c0 rjmp .+66 ; 0x4994 <vfprintf+0xcc>
|
|
4952: 27 fd sbrc r18, 7
|
|
4954: 27 c0 rjmp .+78 ; 0x49a4 <vfprintf+0xdc>
|
|
4956: 38 2f mov r19, r24
|
|
4958: 30 53 subi r19, 0x30 ; 48
|
|
495a: 3a 30 cpi r19, 0x0A ; 10
|
|
495c: 78 f4 brcc .+30 ; 0x497c <vfprintf+0xb4>
|
|
495e: 26 ff sbrs r18, 6
|
|
4960: 06 c0 rjmp .+12 ; 0x496e <vfprintf+0xa6>
|
|
4962: fa e0 ldi r31, 0x0A ; 10
|
|
4964: 5f 9e mul r5, r31
|
|
4966: 30 0d add r19, r0
|
|
4968: 11 24 eor r1, r1
|
|
496a: 53 2e mov r5, r19
|
|
496c: 13 c0 rjmp .+38 ; 0x4994 <vfprintf+0xcc>
|
|
496e: 8a e0 ldi r24, 0x0A ; 10
|
|
4970: 38 9e mul r3, r24
|
|
4972: 30 0d add r19, r0
|
|
4974: 11 24 eor r1, r1
|
|
4976: 33 2e mov r3, r19
|
|
4978: 20 62 ori r18, 0x20 ; 32
|
|
497a: 0c c0 rjmp .+24 ; 0x4994 <vfprintf+0xcc>
|
|
497c: 8e 32 cpi r24, 0x2E ; 46
|
|
497e: 21 f4 brne .+8 ; 0x4988 <vfprintf+0xc0>
|
|
4980: 26 fd sbrc r18, 6
|
|
4982: 65 c1 rjmp .+714 ; 0x4c4e <vfprintf+0x386>
|
|
4984: 20 64 ori r18, 0x40 ; 64
|
|
4986: 06 c0 rjmp .+12 ; 0x4994 <vfprintf+0xcc>
|
|
4988: 8c 36 cpi r24, 0x6C ; 108
|
|
498a: 11 f4 brne .+4 ; 0x4990 <vfprintf+0xc8>
|
|
498c: 20 68 ori r18, 0x80 ; 128
|
|
498e: 02 c0 rjmp .+4 ; 0x4994 <vfprintf+0xcc>
|
|
4990: 88 36 cpi r24, 0x68 ; 104
|
|
4992: 41 f4 brne .+16 ; 0x49a4 <vfprintf+0xdc>
|
|
4994: f6 01 movw r30, r12
|
|
4996: 93 fd sbrc r25, 3
|
|
4998: 85 91 lpm r24, Z+
|
|
499a: 93 ff sbrs r25, 3
|
|
499c: 81 91 ld r24, Z+
|
|
499e: 6f 01 movw r12, r30
|
|
49a0: 81 11 cpse r24, r1
|
|
49a2: c0 cf rjmp .-128 ; 0x4924 <vfprintf+0x5c>
|
|
49a4: 98 2f mov r25, r24
|
|
49a6: 95 54 subi r25, 0x45 ; 69
|
|
49a8: 93 30 cpi r25, 0x03 ; 3
|
|
49aa: 18 f0 brcs .+6 ; 0x49b2 <vfprintf+0xea>
|
|
49ac: 90 52 subi r25, 0x20 ; 32
|
|
49ae: 93 30 cpi r25, 0x03 ; 3
|
|
49b0: 28 f4 brcc .+10 ; 0x49bc <vfprintf+0xf4>
|
|
49b2: 0c 5f subi r16, 0xFC ; 252
|
|
49b4: 1f 4f sbci r17, 0xFF ; 255
|
|
49b6: ff e3 ldi r31, 0x3F ; 63
|
|
49b8: f9 83 std Y+1, r31 ; 0x01
|
|
49ba: 0d c0 rjmp .+26 ; 0x49d6 <vfprintf+0x10e>
|
|
49bc: 83 36 cpi r24, 0x63 ; 99
|
|
49be: 31 f0 breq .+12 ; 0x49cc <vfprintf+0x104>
|
|
49c0: 83 37 cpi r24, 0x73 ; 115
|
|
49c2: 71 f0 breq .+28 ; 0x49e0 <vfprintf+0x118>
|
|
49c4: 83 35 cpi r24, 0x53 ; 83
|
|
49c6: 09 f0 breq .+2 ; 0x49ca <vfprintf+0x102>
|
|
49c8: 5a c0 rjmp .+180 ; 0x4a7e <vfprintf+0x1b6>
|
|
49ca: 22 c0 rjmp .+68 ; 0x4a10 <vfprintf+0x148>
|
|
49cc: f8 01 movw r30, r16
|
|
49ce: 80 81 ld r24, Z
|
|
49d0: 89 83 std Y+1, r24 ; 0x01
|
|
49d2: 0e 5f subi r16, 0xFE ; 254
|
|
49d4: 1f 4f sbci r17, 0xFF ; 255
|
|
49d6: 44 24 eor r4, r4
|
|
49d8: 43 94 inc r4
|
|
49da: 51 2c mov r5, r1
|
|
49dc: 54 01 movw r10, r8
|
|
49de: 14 c0 rjmp .+40 ; 0x4a08 <vfprintf+0x140>
|
|
49e0: 38 01 movw r6, r16
|
|
49e2: f2 e0 ldi r31, 0x02 ; 2
|
|
49e4: 6f 0e add r6, r31
|
|
49e6: 71 1c adc r7, r1
|
|
49e8: f8 01 movw r30, r16
|
|
49ea: a0 80 ld r10, Z
|
|
49ec: b1 80 ldd r11, Z+1 ; 0x01
|
|
49ee: 26 ff sbrs r18, 6
|
|
49f0: 03 c0 rjmp .+6 ; 0x49f8 <vfprintf+0x130>
|
|
49f2: 65 2d mov r22, r5
|
|
49f4: 70 e0 ldi r23, 0x00 ; 0
|
|
49f6: 02 c0 rjmp .+4 ; 0x49fc <vfprintf+0x134>
|
|
49f8: 6f ef ldi r22, 0xFF ; 255
|
|
49fa: 7f ef ldi r23, 0xFF ; 255
|
|
49fc: c5 01 movw r24, r10
|
|
49fe: 2c 87 std Y+12, r18 ; 0x0c
|
|
4a00: 72 d1 rcall .+740 ; 0x4ce6 <strnlen>
|
|
4a02: 2c 01 movw r4, r24
|
|
4a04: 83 01 movw r16, r6
|
|
4a06: 2c 85 ldd r18, Y+12 ; 0x0c
|
|
4a08: 6f e7 ldi r22, 0x7F ; 127
|
|
4a0a: 26 2e mov r2, r22
|
|
4a0c: 22 22 and r2, r18
|
|
4a0e: 17 c0 rjmp .+46 ; 0x4a3e <vfprintf+0x176>
|
|
4a10: 38 01 movw r6, r16
|
|
4a12: f2 e0 ldi r31, 0x02 ; 2
|
|
4a14: 6f 0e add r6, r31
|
|
4a16: 71 1c adc r7, r1
|
|
4a18: f8 01 movw r30, r16
|
|
4a1a: a0 80 ld r10, Z
|
|
4a1c: b1 80 ldd r11, Z+1 ; 0x01
|
|
4a1e: 26 ff sbrs r18, 6
|
|
4a20: 03 c0 rjmp .+6 ; 0x4a28 <vfprintf+0x160>
|
|
4a22: 65 2d mov r22, r5
|
|
4a24: 70 e0 ldi r23, 0x00 ; 0
|
|
4a26: 02 c0 rjmp .+4 ; 0x4a2c <vfprintf+0x164>
|
|
4a28: 6f ef ldi r22, 0xFF ; 255
|
|
4a2a: 7f ef ldi r23, 0xFF ; 255
|
|
4a2c: c5 01 movw r24, r10
|
|
4a2e: 2c 87 std Y+12, r18 ; 0x0c
|
|
4a30: 4f d1 rcall .+670 ; 0x4cd0 <strnlen_P>
|
|
4a32: 2c 01 movw r4, r24
|
|
4a34: 2c 85 ldd r18, Y+12 ; 0x0c
|
|
4a36: 50 e8 ldi r21, 0x80 ; 128
|
|
4a38: 25 2e mov r2, r21
|
|
4a3a: 22 2a or r2, r18
|
|
4a3c: 83 01 movw r16, r6
|
|
4a3e: 23 fc sbrc r2, 3
|
|
4a40: 1a c0 rjmp .+52 ; 0x4a76 <vfprintf+0x1ae>
|
|
4a42: 05 c0 rjmp .+10 ; 0x4a4e <vfprintf+0x186>
|
|
4a44: b7 01 movw r22, r14
|
|
4a46: 80 e2 ldi r24, 0x20 ; 32
|
|
4a48: 90 e0 ldi r25, 0x00 ; 0
|
|
4a4a: 58 d1 rcall .+688 ; 0x4cfc <fputc>
|
|
4a4c: 3a 94 dec r3
|
|
4a4e: 83 2d mov r24, r3
|
|
4a50: 90 e0 ldi r25, 0x00 ; 0
|
|
4a52: 48 16 cp r4, r24
|
|
4a54: 59 06 cpc r5, r25
|
|
4a56: b0 f3 brcs .-20 ; 0x4a44 <vfprintf+0x17c>
|
|
4a58: 0e c0 rjmp .+28 ; 0x4a76 <vfprintf+0x1ae>
|
|
4a5a: f5 01 movw r30, r10
|
|
4a5c: 27 fc sbrc r2, 7
|
|
4a5e: 85 91 lpm r24, Z+
|
|
4a60: 27 fe sbrs r2, 7
|
|
4a62: 81 91 ld r24, Z+
|
|
4a64: 5f 01 movw r10, r30
|
|
4a66: b7 01 movw r22, r14
|
|
4a68: 90 e0 ldi r25, 0x00 ; 0
|
|
4a6a: 48 d1 rcall .+656 ; 0x4cfc <fputc>
|
|
4a6c: 31 10 cpse r3, r1
|
|
4a6e: 3a 94 dec r3
|
|
4a70: f1 e0 ldi r31, 0x01 ; 1
|
|
4a72: 4f 1a sub r4, r31
|
|
4a74: 51 08 sbc r5, r1
|
|
4a76: 41 14 cp r4, r1
|
|
4a78: 51 04 cpc r5, r1
|
|
4a7a: 79 f7 brne .-34 ; 0x4a5a <vfprintf+0x192>
|
|
4a7c: e5 c0 rjmp .+458 ; 0x4c48 <vfprintf+0x380>
|
|
4a7e: 84 36 cpi r24, 0x64 ; 100
|
|
4a80: 11 f0 breq .+4 ; 0x4a86 <vfprintf+0x1be>
|
|
4a82: 89 36 cpi r24, 0x69 ; 105
|
|
4a84: 39 f5 brne .+78 ; 0x4ad4 <vfprintf+0x20c>
|
|
4a86: f8 01 movw r30, r16
|
|
4a88: 27 ff sbrs r18, 7
|
|
4a8a: 07 c0 rjmp .+14 ; 0x4a9a <vfprintf+0x1d2>
|
|
4a8c: 60 81 ld r22, Z
|
|
4a8e: 71 81 ldd r23, Z+1 ; 0x01
|
|
4a90: 82 81 ldd r24, Z+2 ; 0x02
|
|
4a92: 93 81 ldd r25, Z+3 ; 0x03
|
|
4a94: 0c 5f subi r16, 0xFC ; 252
|
|
4a96: 1f 4f sbci r17, 0xFF ; 255
|
|
4a98: 08 c0 rjmp .+16 ; 0x4aaa <vfprintf+0x1e2>
|
|
4a9a: 60 81 ld r22, Z
|
|
4a9c: 71 81 ldd r23, Z+1 ; 0x01
|
|
4a9e: 88 27 eor r24, r24
|
|
4aa0: 77 fd sbrc r23, 7
|
|
4aa2: 80 95 com r24
|
|
4aa4: 98 2f mov r25, r24
|
|
4aa6: 0e 5f subi r16, 0xFE ; 254
|
|
4aa8: 1f 4f sbci r17, 0xFF ; 255
|
|
4aaa: 4f e6 ldi r20, 0x6F ; 111
|
|
4aac: b4 2e mov r11, r20
|
|
4aae: b2 22 and r11, r18
|
|
4ab0: 97 ff sbrs r25, 7
|
|
4ab2: 09 c0 rjmp .+18 ; 0x4ac6 <vfprintf+0x1fe>
|
|
4ab4: 90 95 com r25
|
|
4ab6: 80 95 com r24
|
|
4ab8: 70 95 com r23
|
|
4aba: 61 95 neg r22
|
|
4abc: 7f 4f sbci r23, 0xFF ; 255
|
|
4abe: 8f 4f sbci r24, 0xFF ; 255
|
|
4ac0: 9f 4f sbci r25, 0xFF ; 255
|
|
4ac2: f0 e8 ldi r31, 0x80 ; 128
|
|
4ac4: bf 2a or r11, r31
|
|
4ac6: 2a e0 ldi r18, 0x0A ; 10
|
|
4ac8: 30 e0 ldi r19, 0x00 ; 0
|
|
4aca: a4 01 movw r20, r8
|
|
4acc: 43 d1 rcall .+646 ; 0x4d54 <__ultoa_invert>
|
|
4ace: a8 2e mov r10, r24
|
|
4ad0: a8 18 sub r10, r8
|
|
4ad2: 42 c0 rjmp .+132 ; 0x4b58 <vfprintf+0x290>
|
|
4ad4: 85 37 cpi r24, 0x75 ; 117
|
|
4ad6: 31 f4 brne .+12 ; 0x4ae4 <vfprintf+0x21c>
|
|
4ad8: 3f ee ldi r19, 0xEF ; 239
|
|
4ada: b3 2e mov r11, r19
|
|
4adc: b2 22 and r11, r18
|
|
4ade: 2a e0 ldi r18, 0x0A ; 10
|
|
4ae0: 30 e0 ldi r19, 0x00 ; 0
|
|
4ae2: 24 c0 rjmp .+72 ; 0x4b2c <vfprintf+0x264>
|
|
4ae4: 99 ef ldi r25, 0xF9 ; 249
|
|
4ae6: b9 2e mov r11, r25
|
|
4ae8: b2 22 and r11, r18
|
|
4aea: 8f 36 cpi r24, 0x6F ; 111
|
|
4aec: b9 f0 breq .+46 ; 0x4b1c <vfprintf+0x254>
|
|
4aee: 20 f4 brcc .+8 ; 0x4af8 <vfprintf+0x230>
|
|
4af0: 88 35 cpi r24, 0x58 ; 88
|
|
4af2: 09 f0 breq .+2 ; 0x4af6 <vfprintf+0x22e>
|
|
4af4: ac c0 rjmp .+344 ; 0x4c4e <vfprintf+0x386>
|
|
4af6: 0d c0 rjmp .+26 ; 0x4b12 <vfprintf+0x24a>
|
|
4af8: 80 37 cpi r24, 0x70 ; 112
|
|
4afa: 21 f0 breq .+8 ; 0x4b04 <vfprintf+0x23c>
|
|
4afc: 88 37 cpi r24, 0x78 ; 120
|
|
4afe: 09 f0 breq .+2 ; 0x4b02 <vfprintf+0x23a>
|
|
4b00: a6 c0 rjmp .+332 ; 0x4c4e <vfprintf+0x386>
|
|
4b02: 02 c0 rjmp .+4 ; 0x4b08 <vfprintf+0x240>
|
|
4b04: 20 e1 ldi r18, 0x10 ; 16
|
|
4b06: b2 2a or r11, r18
|
|
4b08: b4 fe sbrs r11, 4
|
|
4b0a: 0b c0 rjmp .+22 ; 0x4b22 <vfprintf+0x25a>
|
|
4b0c: 84 e0 ldi r24, 0x04 ; 4
|
|
4b0e: b8 2a or r11, r24
|
|
4b10: 08 c0 rjmp .+16 ; 0x4b22 <vfprintf+0x25a>
|
|
4b12: 24 ff sbrs r18, 4
|
|
4b14: 09 c0 rjmp .+18 ; 0x4b28 <vfprintf+0x260>
|
|
4b16: e6 e0 ldi r30, 0x06 ; 6
|
|
4b18: be 2a or r11, r30
|
|
4b1a: 06 c0 rjmp .+12 ; 0x4b28 <vfprintf+0x260>
|
|
4b1c: 28 e0 ldi r18, 0x08 ; 8
|
|
4b1e: 30 e0 ldi r19, 0x00 ; 0
|
|
4b20: 05 c0 rjmp .+10 ; 0x4b2c <vfprintf+0x264>
|
|
4b22: 20 e1 ldi r18, 0x10 ; 16
|
|
4b24: 30 e0 ldi r19, 0x00 ; 0
|
|
4b26: 02 c0 rjmp .+4 ; 0x4b2c <vfprintf+0x264>
|
|
4b28: 20 e1 ldi r18, 0x10 ; 16
|
|
4b2a: 32 e0 ldi r19, 0x02 ; 2
|
|
4b2c: f8 01 movw r30, r16
|
|
4b2e: b7 fe sbrs r11, 7
|
|
4b30: 07 c0 rjmp .+14 ; 0x4b40 <vfprintf+0x278>
|
|
4b32: 60 81 ld r22, Z
|
|
4b34: 71 81 ldd r23, Z+1 ; 0x01
|
|
4b36: 82 81 ldd r24, Z+2 ; 0x02
|
|
4b38: 93 81 ldd r25, Z+3 ; 0x03
|
|
4b3a: 0c 5f subi r16, 0xFC ; 252
|
|
4b3c: 1f 4f sbci r17, 0xFF ; 255
|
|
4b3e: 06 c0 rjmp .+12 ; 0x4b4c <vfprintf+0x284>
|
|
4b40: 60 81 ld r22, Z
|
|
4b42: 71 81 ldd r23, Z+1 ; 0x01
|
|
4b44: 80 e0 ldi r24, 0x00 ; 0
|
|
4b46: 90 e0 ldi r25, 0x00 ; 0
|
|
4b48: 0e 5f subi r16, 0xFE ; 254
|
|
4b4a: 1f 4f sbci r17, 0xFF ; 255
|
|
4b4c: a4 01 movw r20, r8
|
|
4b4e: 02 d1 rcall .+516 ; 0x4d54 <__ultoa_invert>
|
|
4b50: a8 2e mov r10, r24
|
|
4b52: a8 18 sub r10, r8
|
|
4b54: ff e7 ldi r31, 0x7F ; 127
|
|
4b56: bf 22 and r11, r31
|
|
4b58: b6 fe sbrs r11, 6
|
|
4b5a: 0b c0 rjmp .+22 ; 0x4b72 <vfprintf+0x2aa>
|
|
4b5c: 2b 2d mov r18, r11
|
|
4b5e: 2e 7f andi r18, 0xFE ; 254
|
|
4b60: a5 14 cp r10, r5
|
|
4b62: 50 f4 brcc .+20 ; 0x4b78 <vfprintf+0x2b0>
|
|
4b64: b4 fe sbrs r11, 4
|
|
4b66: 0a c0 rjmp .+20 ; 0x4b7c <vfprintf+0x2b4>
|
|
4b68: b2 fc sbrc r11, 2
|
|
4b6a: 08 c0 rjmp .+16 ; 0x4b7c <vfprintf+0x2b4>
|
|
4b6c: 2b 2d mov r18, r11
|
|
4b6e: 2e 7e andi r18, 0xEE ; 238
|
|
4b70: 05 c0 rjmp .+10 ; 0x4b7c <vfprintf+0x2b4>
|
|
4b72: 7a 2c mov r7, r10
|
|
4b74: 2b 2d mov r18, r11
|
|
4b76: 03 c0 rjmp .+6 ; 0x4b7e <vfprintf+0x2b6>
|
|
4b78: 7a 2c mov r7, r10
|
|
4b7a: 01 c0 rjmp .+2 ; 0x4b7e <vfprintf+0x2b6>
|
|
4b7c: 75 2c mov r7, r5
|
|
4b7e: 24 ff sbrs r18, 4
|
|
4b80: 0d c0 rjmp .+26 ; 0x4b9c <vfprintf+0x2d4>
|
|
4b82: fe 01 movw r30, r28
|
|
4b84: ea 0d add r30, r10
|
|
4b86: f1 1d adc r31, r1
|
|
4b88: 80 81 ld r24, Z
|
|
4b8a: 80 33 cpi r24, 0x30 ; 48
|
|
4b8c: 11 f4 brne .+4 ; 0x4b92 <vfprintf+0x2ca>
|
|
4b8e: 29 7e andi r18, 0xE9 ; 233
|
|
4b90: 09 c0 rjmp .+18 ; 0x4ba4 <vfprintf+0x2dc>
|
|
4b92: 22 ff sbrs r18, 2
|
|
4b94: 06 c0 rjmp .+12 ; 0x4ba2 <vfprintf+0x2da>
|
|
4b96: 73 94 inc r7
|
|
4b98: 73 94 inc r7
|
|
4b9a: 04 c0 rjmp .+8 ; 0x4ba4 <vfprintf+0x2dc>
|
|
4b9c: 82 2f mov r24, r18
|
|
4b9e: 86 78 andi r24, 0x86 ; 134
|
|
4ba0: 09 f0 breq .+2 ; 0x4ba4 <vfprintf+0x2dc>
|
|
4ba2: 73 94 inc r7
|
|
4ba4: 23 fd sbrc r18, 3
|
|
4ba6: 13 c0 rjmp .+38 ; 0x4bce <vfprintf+0x306>
|
|
4ba8: 20 ff sbrs r18, 0
|
|
4baa: 0e c0 rjmp .+28 ; 0x4bc8 <vfprintf+0x300>
|
|
4bac: 5a 2c mov r5, r10
|
|
4bae: 73 14 cp r7, r3
|
|
4bb0: 58 f4 brcc .+22 ; 0x4bc8 <vfprintf+0x300>
|
|
4bb2: 53 0c add r5, r3
|
|
4bb4: 57 18 sub r5, r7
|
|
4bb6: 73 2c mov r7, r3
|
|
4bb8: 07 c0 rjmp .+14 ; 0x4bc8 <vfprintf+0x300>
|
|
4bba: b7 01 movw r22, r14
|
|
4bbc: 80 e2 ldi r24, 0x20 ; 32
|
|
4bbe: 90 e0 ldi r25, 0x00 ; 0
|
|
4bc0: 2c 87 std Y+12, r18 ; 0x0c
|
|
4bc2: 9c d0 rcall .+312 ; 0x4cfc <fputc>
|
|
4bc4: 73 94 inc r7
|
|
4bc6: 2c 85 ldd r18, Y+12 ; 0x0c
|
|
4bc8: 73 14 cp r7, r3
|
|
4bca: b8 f3 brcs .-18 ; 0x4bba <vfprintf+0x2f2>
|
|
4bcc: 04 c0 rjmp .+8 ; 0x4bd6 <vfprintf+0x30e>
|
|
4bce: 73 14 cp r7, r3
|
|
4bd0: 10 f4 brcc .+4 ; 0x4bd6 <vfprintf+0x30e>
|
|
4bd2: 37 18 sub r3, r7
|
|
4bd4: 01 c0 rjmp .+2 ; 0x4bd8 <vfprintf+0x310>
|
|
4bd6: 31 2c mov r3, r1
|
|
4bd8: 24 ff sbrs r18, 4
|
|
4bda: 11 c0 rjmp .+34 ; 0x4bfe <vfprintf+0x336>
|
|
4bdc: b7 01 movw r22, r14
|
|
4bde: 80 e3 ldi r24, 0x30 ; 48
|
|
4be0: 90 e0 ldi r25, 0x00 ; 0
|
|
4be2: 2c 87 std Y+12, r18 ; 0x0c
|
|
4be4: 8b d0 rcall .+278 ; 0x4cfc <fputc>
|
|
4be6: 2c 85 ldd r18, Y+12 ; 0x0c
|
|
4be8: 22 ff sbrs r18, 2
|
|
4bea: 1c c0 rjmp .+56 ; 0x4c24 <vfprintf+0x35c>
|
|
4bec: 21 ff sbrs r18, 1
|
|
4bee: 03 c0 rjmp .+6 ; 0x4bf6 <vfprintf+0x32e>
|
|
4bf0: 88 e5 ldi r24, 0x58 ; 88
|
|
4bf2: 90 e0 ldi r25, 0x00 ; 0
|
|
4bf4: 02 c0 rjmp .+4 ; 0x4bfa <vfprintf+0x332>
|
|
4bf6: 88 e7 ldi r24, 0x78 ; 120
|
|
4bf8: 90 e0 ldi r25, 0x00 ; 0
|
|
4bfa: b7 01 movw r22, r14
|
|
4bfc: 0c c0 rjmp .+24 ; 0x4c16 <vfprintf+0x34e>
|
|
4bfe: 82 2f mov r24, r18
|
|
4c00: 86 78 andi r24, 0x86 ; 134
|
|
4c02: 81 f0 breq .+32 ; 0x4c24 <vfprintf+0x35c>
|
|
4c04: 21 fd sbrc r18, 1
|
|
4c06: 02 c0 rjmp .+4 ; 0x4c0c <vfprintf+0x344>
|
|
4c08: 80 e2 ldi r24, 0x20 ; 32
|
|
4c0a: 01 c0 rjmp .+2 ; 0x4c0e <vfprintf+0x346>
|
|
4c0c: 8b e2 ldi r24, 0x2B ; 43
|
|
4c0e: 27 fd sbrc r18, 7
|
|
4c10: 8d e2 ldi r24, 0x2D ; 45
|
|
4c12: b7 01 movw r22, r14
|
|
4c14: 90 e0 ldi r25, 0x00 ; 0
|
|
4c16: 72 d0 rcall .+228 ; 0x4cfc <fputc>
|
|
4c18: 05 c0 rjmp .+10 ; 0x4c24 <vfprintf+0x35c>
|
|
4c1a: b7 01 movw r22, r14
|
|
4c1c: 80 e3 ldi r24, 0x30 ; 48
|
|
4c1e: 90 e0 ldi r25, 0x00 ; 0
|
|
4c20: 6d d0 rcall .+218 ; 0x4cfc <fputc>
|
|
4c22: 5a 94 dec r5
|
|
4c24: a5 14 cp r10, r5
|
|
4c26: c8 f3 brcs .-14 ; 0x4c1a <vfprintf+0x352>
|
|
4c28: aa 94 dec r10
|
|
4c2a: f4 01 movw r30, r8
|
|
4c2c: ea 0d add r30, r10
|
|
4c2e: f1 1d adc r31, r1
|
|
4c30: b7 01 movw r22, r14
|
|
4c32: 80 81 ld r24, Z
|
|
4c34: 90 e0 ldi r25, 0x00 ; 0
|
|
4c36: 62 d0 rcall .+196 ; 0x4cfc <fputc>
|
|
4c38: a1 10 cpse r10, r1
|
|
4c3a: f6 cf rjmp .-20 ; 0x4c28 <vfprintf+0x360>
|
|
4c3c: 05 c0 rjmp .+10 ; 0x4c48 <vfprintf+0x380>
|
|
4c3e: b7 01 movw r22, r14
|
|
4c40: 80 e2 ldi r24, 0x20 ; 32
|
|
4c42: 90 e0 ldi r25, 0x00 ; 0
|
|
4c44: 5b d0 rcall .+182 ; 0x4cfc <fputc>
|
|
4c46: 3a 94 dec r3
|
|
4c48: 31 10 cpse r3, r1
|
|
4c4a: f9 cf rjmp .-14 ; 0x4c3e <vfprintf+0x376>
|
|
4c4c: 50 ce rjmp .-864 ; 0x48ee <vfprintf+0x26>
|
|
4c4e: f7 01 movw r30, r14
|
|
4c50: 26 81 ldd r18, Z+6 ; 0x06
|
|
4c52: 37 81 ldd r19, Z+7 ; 0x07
|
|
4c54: 02 c0 rjmp .+4 ; 0x4c5a <vfprintf+0x392>
|
|
4c56: 2f ef ldi r18, 0xFF ; 255
|
|
4c58: 3f ef ldi r19, 0xFF ; 255
|
|
4c5a: c9 01 movw r24, r18
|
|
4c5c: 2c 96 adiw r28, 0x0c ; 12
|
|
4c5e: e2 e1 ldi r30, 0x12 ; 18
|
|
4c60: 0b c1 rjmp .+534 ; 0x4e78 <__epilogue_restores__>
|
|
|
|
00004c62 <__eerd_block_x32a4u>:
|
|
4c62: e0 ec ldi r30, 0xC0 ; 192
|
|
4c64: f1 e0 ldi r31, 0x01 ; 1
|
|
4c66: a7 85 ldd r26, Z+15 ; 0x0f
|
|
4c68: a7 fd sbrc r26, 7
|
|
4c6a: fd cf rjmp .-6 ; 0x4c66 <__eerd_block_x32a4u+0x4>
|
|
4c6c: a4 85 ldd r26, Z+12 ; 0x0c
|
|
4c6e: a8 60 ori r26, 0x08 ; 8
|
|
4c70: a4 87 std Z+12, r26 ; 0x0c
|
|
4c72: 60 50 subi r22, 0x00 ; 0
|
|
4c74: 70 4f sbci r23, 0xF0 ; 240
|
|
4c76: f2 cd rjmp .-1052 ; 0x485c <memcpy>
|
|
|
|
00004c78 <__eewr_block_x32a4u>:
|
|
4c78: dc 01 movw r26, r24
|
|
4c7a: cb 01 movw r24, r22
|
|
4c7c: 02 c0 rjmp .+4 ; 0x4c82 <__eewr_block_x32a4u+0xa>
|
|
4c7e: 2d 91 ld r18, X+
|
|
4c80: 05 d0 rcall .+10 ; 0x4c8c <__eewr_r18_x32a4u>
|
|
4c82: 41 50 subi r20, 0x01 ; 1
|
|
4c84: 50 40 sbci r21, 0x00 ; 0
|
|
4c86: d8 f7 brcc .-10 ; 0x4c7e <__eewr_block_x32a4u+0x6>
|
|
4c88: 08 95 ret
|
|
|
|
00004c8a <__eewr_byte_x32a4u>:
|
|
4c8a: 26 2f mov r18, r22
|
|
|
|
00004c8c <__eewr_r18_x32a4u>:
|
|
4c8c: e0 ec ldi r30, 0xC0 ; 192
|
|
4c8e: f1 e0 ldi r31, 0x01 ; 1
|
|
4c90: 37 85 ldd r19, Z+15 ; 0x0f
|
|
4c92: 37 fd sbrc r19, 7
|
|
4c94: fd cf rjmp .-6 ; 0x4c90 <__eewr_r18_x32a4u+0x4>
|
|
4c96: 34 85 ldd r19, Z+12 ; 0x0c
|
|
4c98: 37 7f andi r19, 0xF7 ; 247
|
|
4c9a: 34 87 std Z+12, r19 ; 0x0c
|
|
4c9c: 37 85 ldd r19, Z+15 ; 0x0f
|
|
4c9e: 31 ff sbrs r19, 1
|
|
4ca0: 09 c0 rjmp .+18 ; 0x4cb4 <__eewr_r18_x32a4u+0x28>
|
|
4ca2: 36 e3 ldi r19, 0x36 ; 54
|
|
4ca4: 32 87 std Z+10, r19 ; 0x0a
|
|
4ca6: 38 ed ldi r19, 0xD8 ; 216
|
|
4ca8: 34 bf out 0x34, r19 ; 52
|
|
4caa: 31 e0 ldi r19, 0x01 ; 1
|
|
4cac: 33 87 std Z+11, r19 ; 0x0b
|
|
4cae: 37 85 ldd r19, Z+15 ; 0x0f
|
|
4cb0: 37 fd sbrc r19, 7
|
|
4cb2: fd cf rjmp .-6 ; 0x4cae <__eewr_r18_x32a4u+0x22>
|
|
4cb4: 33 e3 ldi r19, 0x33 ; 51
|
|
4cb6: 32 87 std Z+10, r19 ; 0x0a
|
|
4cb8: 80 83 st Z, r24
|
|
4cba: 91 83 std Z+1, r25 ; 0x01
|
|
4cbc: 12 82 std Z+2, r1 ; 0x02
|
|
4cbe: 24 83 std Z+4, r18 ; 0x04
|
|
4cc0: 25 e3 ldi r18, 0x35 ; 53
|
|
4cc2: 22 87 std Z+10, r18 ; 0x0a
|
|
4cc4: 28 ed ldi r18, 0xD8 ; 216
|
|
4cc6: 31 e0 ldi r19, 0x01 ; 1
|
|
4cc8: 24 bf out 0x34, r18 ; 52
|
|
4cca: 33 87 std Z+11, r19 ; 0x0b
|
|
4ccc: 01 96 adiw r24, 0x01 ; 1
|
|
4cce: 08 95 ret
|
|
|
|
00004cd0 <strnlen_P>:
|
|
4cd0: fc 01 movw r30, r24
|
|
4cd2: 05 90 lpm r0, Z+
|
|
4cd4: 61 50 subi r22, 0x01 ; 1
|
|
4cd6: 70 40 sbci r23, 0x00 ; 0
|
|
4cd8: 01 10 cpse r0, r1
|
|
4cda: d8 f7 brcc .-10 ; 0x4cd2 <strnlen_P+0x2>
|
|
4cdc: 80 95 com r24
|
|
4cde: 90 95 com r25
|
|
4ce0: 8e 0f add r24, r30
|
|
4ce2: 9f 1f adc r25, r31
|
|
4ce4: 08 95 ret
|
|
|
|
00004ce6 <strnlen>:
|
|
4ce6: fc 01 movw r30, r24
|
|
4ce8: 61 50 subi r22, 0x01 ; 1
|
|
4cea: 70 40 sbci r23, 0x00 ; 0
|
|
4cec: 01 90 ld r0, Z+
|
|
4cee: 01 10 cpse r0, r1
|
|
4cf0: d8 f7 brcc .-10 ; 0x4ce8 <strnlen+0x2>
|
|
4cf2: 80 95 com r24
|
|
4cf4: 90 95 com r25
|
|
4cf6: 8e 0f add r24, r30
|
|
4cf8: 9f 1f adc r25, r31
|
|
4cfa: 08 95 ret
|
|
|
|
00004cfc <fputc>:
|
|
4cfc: 0f 93 push r16
|
|
4cfe: 1f 93 push r17
|
|
4d00: cf 93 push r28
|
|
4d02: df 93 push r29
|
|
4d04: 8c 01 movw r16, r24
|
|
4d06: eb 01 movw r28, r22
|
|
4d08: 8b 81 ldd r24, Y+3 ; 0x03
|
|
4d0a: 81 fd sbrc r24, 1
|
|
4d0c: 03 c0 rjmp .+6 ; 0x4d14 <fputc+0x18>
|
|
4d0e: 0f ef ldi r16, 0xFF ; 255
|
|
4d10: 1f ef ldi r17, 0xFF ; 255
|
|
4d12: 1a c0 rjmp .+52 ; 0x4d48 <fputc+0x4c>
|
|
4d14: 82 ff sbrs r24, 2
|
|
4d16: 0d c0 rjmp .+26 ; 0x4d32 <fputc+0x36>
|
|
4d18: 2e 81 ldd r18, Y+6 ; 0x06
|
|
4d1a: 3f 81 ldd r19, Y+7 ; 0x07
|
|
4d1c: 8c 81 ldd r24, Y+4 ; 0x04
|
|
4d1e: 9d 81 ldd r25, Y+5 ; 0x05
|
|
4d20: 28 17 cp r18, r24
|
|
4d22: 39 07 cpc r19, r25
|
|
4d24: 64 f4 brge .+24 ; 0x4d3e <fputc+0x42>
|
|
4d26: e8 81 ld r30, Y
|
|
4d28: f9 81 ldd r31, Y+1 ; 0x01
|
|
4d2a: 01 93 st Z+, r16
|
|
4d2c: e8 83 st Y, r30
|
|
4d2e: f9 83 std Y+1, r31 ; 0x01
|
|
4d30: 06 c0 rjmp .+12 ; 0x4d3e <fputc+0x42>
|
|
4d32: e8 85 ldd r30, Y+8 ; 0x08
|
|
4d34: f9 85 ldd r31, Y+9 ; 0x09
|
|
4d36: 80 2f mov r24, r16
|
|
4d38: 09 95 icall
|
|
4d3a: 89 2b or r24, r25
|
|
4d3c: 41 f7 brne .-48 ; 0x4d0e <fputc+0x12>
|
|
4d3e: 8e 81 ldd r24, Y+6 ; 0x06
|
|
4d40: 9f 81 ldd r25, Y+7 ; 0x07
|
|
4d42: 01 96 adiw r24, 0x01 ; 1
|
|
4d44: 8e 83 std Y+6, r24 ; 0x06
|
|
4d46: 9f 83 std Y+7, r25 ; 0x07
|
|
4d48: c8 01 movw r24, r16
|
|
4d4a: df 91 pop r29
|
|
4d4c: cf 91 pop r28
|
|
4d4e: 1f 91 pop r17
|
|
4d50: 0f 91 pop r16
|
|
4d52: 08 95 ret
|
|
|
|
00004d54 <__ultoa_invert>:
|
|
4d54: fa 01 movw r30, r20
|
|
4d56: aa 27 eor r26, r26
|
|
4d58: 28 30 cpi r18, 0x08 ; 8
|
|
4d5a: 51 f1 breq .+84 ; 0x4db0 <__ultoa_invert+0x5c>
|
|
4d5c: 20 31 cpi r18, 0x10 ; 16
|
|
4d5e: 81 f1 breq .+96 ; 0x4dc0 <__ultoa_invert+0x6c>
|
|
4d60: e8 94 clt
|
|
4d62: 6f 93 push r22
|
|
4d64: 6e 7f andi r22, 0xFE ; 254
|
|
4d66: 6e 5f subi r22, 0xFE ; 254
|
|
4d68: 7f 4f sbci r23, 0xFF ; 255
|
|
4d6a: 8f 4f sbci r24, 0xFF ; 255
|
|
4d6c: 9f 4f sbci r25, 0xFF ; 255
|
|
4d6e: af 4f sbci r26, 0xFF ; 255
|
|
4d70: b1 e0 ldi r27, 0x01 ; 1
|
|
4d72: 3e d0 rcall .+124 ; 0x4df0 <__ultoa_invert+0x9c>
|
|
4d74: b4 e0 ldi r27, 0x04 ; 4
|
|
4d76: 3c d0 rcall .+120 ; 0x4df0 <__ultoa_invert+0x9c>
|
|
4d78: 67 0f add r22, r23
|
|
4d7a: 78 1f adc r23, r24
|
|
4d7c: 89 1f adc r24, r25
|
|
4d7e: 9a 1f adc r25, r26
|
|
4d80: a1 1d adc r26, r1
|
|
4d82: 68 0f add r22, r24
|
|
4d84: 79 1f adc r23, r25
|
|
4d86: 8a 1f adc r24, r26
|
|
4d88: 91 1d adc r25, r1
|
|
4d8a: a1 1d adc r26, r1
|
|
4d8c: 6a 0f add r22, r26
|
|
4d8e: 71 1d adc r23, r1
|
|
4d90: 81 1d adc r24, r1
|
|
4d92: 91 1d adc r25, r1
|
|
4d94: a1 1d adc r26, r1
|
|
4d96: 20 d0 rcall .+64 ; 0x4dd8 <__ultoa_invert+0x84>
|
|
4d98: 09 f4 brne .+2 ; 0x4d9c <__ultoa_invert+0x48>
|
|
4d9a: 68 94 set
|
|
4d9c: 3f 91 pop r19
|
|
4d9e: 2a e0 ldi r18, 0x0A ; 10
|
|
4da0: 26 9f mul r18, r22
|
|
4da2: 11 24 eor r1, r1
|
|
4da4: 30 19 sub r19, r0
|
|
4da6: 30 5d subi r19, 0xD0 ; 208
|
|
4da8: 31 93 st Z+, r19
|
|
4daa: de f6 brtc .-74 ; 0x4d62 <__ultoa_invert+0xe>
|
|
4dac: cf 01 movw r24, r30
|
|
4dae: 08 95 ret
|
|
4db0: 46 2f mov r20, r22
|
|
4db2: 47 70 andi r20, 0x07 ; 7
|
|
4db4: 40 5d subi r20, 0xD0 ; 208
|
|
4db6: 41 93 st Z+, r20
|
|
4db8: b3 e0 ldi r27, 0x03 ; 3
|
|
4dba: 0f d0 rcall .+30 ; 0x4dda <__ultoa_invert+0x86>
|
|
4dbc: c9 f7 brne .-14 ; 0x4db0 <__ultoa_invert+0x5c>
|
|
4dbe: f6 cf rjmp .-20 ; 0x4dac <__ultoa_invert+0x58>
|
|
4dc0: 46 2f mov r20, r22
|
|
4dc2: 4f 70 andi r20, 0x0F ; 15
|
|
4dc4: 40 5d subi r20, 0xD0 ; 208
|
|
4dc6: 4a 33 cpi r20, 0x3A ; 58
|
|
4dc8: 18 f0 brcs .+6 ; 0x4dd0 <__ultoa_invert+0x7c>
|
|
4dca: 49 5d subi r20, 0xD9 ; 217
|
|
4dcc: 31 fd sbrc r19, 1
|
|
4dce: 40 52 subi r20, 0x20 ; 32
|
|
4dd0: 41 93 st Z+, r20
|
|
4dd2: 02 d0 rcall .+4 ; 0x4dd8 <__ultoa_invert+0x84>
|
|
4dd4: a9 f7 brne .-22 ; 0x4dc0 <__ultoa_invert+0x6c>
|
|
4dd6: ea cf rjmp .-44 ; 0x4dac <__ultoa_invert+0x58>
|
|
4dd8: b4 e0 ldi r27, 0x04 ; 4
|
|
4dda: a6 95 lsr r26
|
|
4ddc: 97 95 ror r25
|
|
4dde: 87 95 ror r24
|
|
4de0: 77 95 ror r23
|
|
4de2: 67 95 ror r22
|
|
4de4: ba 95 dec r27
|
|
4de6: c9 f7 brne .-14 ; 0x4dda <__ultoa_invert+0x86>
|
|
4de8: 00 97 sbiw r24, 0x00 ; 0
|
|
4dea: 61 05 cpc r22, r1
|
|
4dec: 71 05 cpc r23, r1
|
|
4dee: 08 95 ret
|
|
4df0: 9b 01 movw r18, r22
|
|
4df2: ac 01 movw r20, r24
|
|
4df4: 0a 2e mov r0, r26
|
|
4df6: 06 94 lsr r0
|
|
4df8: 57 95 ror r21
|
|
4dfa: 47 95 ror r20
|
|
4dfc: 37 95 ror r19
|
|
4dfe: 27 95 ror r18
|
|
4e00: ba 95 dec r27
|
|
4e02: c9 f7 brne .-14 ; 0x4df6 <__ultoa_invert+0xa2>
|
|
4e04: 62 0f add r22, r18
|
|
4e06: 73 1f adc r23, r19
|
|
4e08: 84 1f adc r24, r20
|
|
4e0a: 95 1f adc r25, r21
|
|
4e0c: a0 1d adc r26, r0
|
|
4e0e: 08 95 ret
|
|
|
|
00004e10 <__divmodsi4>:
|
|
4e10: 05 2e mov r0, r21
|
|
4e12: 97 fb bst r25, 7
|
|
4e14: 16 f4 brtc .+4 ; 0x4e1a <__divmodsi4+0xa>
|
|
4e16: 00 94 com r0
|
|
4e18: 06 d0 rcall .+12 ; 0x4e26 <__divmodsi4_neg1>
|
|
4e1a: 57 fd sbrc r21, 7
|
|
4e1c: 0c d0 rcall .+24 ; 0x4e36 <__divmodsi4_neg2>
|
|
4e1e: 44 d0 rcall .+136 ; 0x4ea8 <__udivmodsi4>
|
|
4e20: 07 fc sbrc r0, 7
|
|
4e22: 09 d0 rcall .+18 ; 0x4e36 <__divmodsi4_neg2>
|
|
4e24: 7e f4 brtc .+30 ; 0x4e44 <__divmodsi4_exit>
|
|
|
|
00004e26 <__divmodsi4_neg1>:
|
|
4e26: 90 95 com r25
|
|
4e28: 80 95 com r24
|
|
4e2a: 70 95 com r23
|
|
4e2c: 61 95 neg r22
|
|
4e2e: 7f 4f sbci r23, 0xFF ; 255
|
|
4e30: 8f 4f sbci r24, 0xFF ; 255
|
|
4e32: 9f 4f sbci r25, 0xFF ; 255
|
|
4e34: 08 95 ret
|
|
|
|
00004e36 <__divmodsi4_neg2>:
|
|
4e36: 50 95 com r21
|
|
4e38: 40 95 com r20
|
|
4e3a: 30 95 com r19
|
|
4e3c: 21 95 neg r18
|
|
4e3e: 3f 4f sbci r19, 0xFF ; 255
|
|
4e40: 4f 4f sbci r20, 0xFF ; 255
|
|
4e42: 5f 4f sbci r21, 0xFF ; 255
|
|
|
|
00004e44 <__divmodsi4_exit>:
|
|
4e44: 08 95 ret
|
|
|
|
00004e46 <__prologue_saves__>:
|
|
4e46: 2f 92 push r2
|
|
4e48: 3f 92 push r3
|
|
4e4a: 4f 92 push r4
|
|
4e4c: 5f 92 push r5
|
|
4e4e: 6f 92 push r6
|
|
4e50: 7f 92 push r7
|
|
4e52: 8f 92 push r8
|
|
4e54: 9f 92 push r9
|
|
4e56: af 92 push r10
|
|
4e58: bf 92 push r11
|
|
4e5a: cf 92 push r12
|
|
4e5c: df 92 push r13
|
|
4e5e: ef 92 push r14
|
|
4e60: ff 92 push r15
|
|
4e62: 0f 93 push r16
|
|
4e64: 1f 93 push r17
|
|
4e66: cf 93 push r28
|
|
4e68: df 93 push r29
|
|
4e6a: cd b7 in r28, 0x3d ; 61
|
|
4e6c: de b7 in r29, 0x3e ; 62
|
|
4e6e: ca 1b sub r28, r26
|
|
4e70: db 0b sbc r29, r27
|
|
4e72: cd bf out 0x3d, r28 ; 61
|
|
4e74: de bf out 0x3e, r29 ; 62
|
|
4e76: 09 94 ijmp
|
|
|
|
00004e78 <__epilogue_restores__>:
|
|
4e78: 2a 88 ldd r2, Y+18 ; 0x12
|
|
4e7a: 39 88 ldd r3, Y+17 ; 0x11
|
|
4e7c: 48 88 ldd r4, Y+16 ; 0x10
|
|
4e7e: 5f 84 ldd r5, Y+15 ; 0x0f
|
|
4e80: 6e 84 ldd r6, Y+14 ; 0x0e
|
|
4e82: 7d 84 ldd r7, Y+13 ; 0x0d
|
|
4e84: 8c 84 ldd r8, Y+12 ; 0x0c
|
|
4e86: 9b 84 ldd r9, Y+11 ; 0x0b
|
|
4e88: aa 84 ldd r10, Y+10 ; 0x0a
|
|
4e8a: b9 84 ldd r11, Y+9 ; 0x09
|
|
4e8c: c8 84 ldd r12, Y+8 ; 0x08
|
|
4e8e: df 80 ldd r13, Y+7 ; 0x07
|
|
4e90: ee 80 ldd r14, Y+6 ; 0x06
|
|
4e92: fd 80 ldd r15, Y+5 ; 0x05
|
|
4e94: 0c 81 ldd r16, Y+4 ; 0x04
|
|
4e96: 1b 81 ldd r17, Y+3 ; 0x03
|
|
4e98: aa 81 ldd r26, Y+2 ; 0x02
|
|
4e9a: b9 81 ldd r27, Y+1 ; 0x01
|
|
4e9c: ce 0f add r28, r30
|
|
4e9e: d1 1d adc r29, r1
|
|
4ea0: cd bf out 0x3d, r28 ; 61
|
|
4ea2: de bf out 0x3e, r29 ; 62
|
|
4ea4: ed 01 movw r28, r26
|
|
4ea6: 08 95 ret
|
|
|
|
00004ea8 <__udivmodsi4>:
|
|
4ea8: a1 e2 ldi r26, 0x21 ; 33
|
|
4eaa: 1a 2e mov r1, r26
|
|
4eac: aa 1b sub r26, r26
|
|
4eae: bb 1b sub r27, r27
|
|
4eb0: fd 01 movw r30, r26
|
|
4eb2: 0d c0 rjmp .+26 ; 0x4ece <__udivmodsi4_ep>
|
|
|
|
00004eb4 <__udivmodsi4_loop>:
|
|
4eb4: aa 1f adc r26, r26
|
|
4eb6: bb 1f adc r27, r27
|
|
4eb8: ee 1f adc r30, r30
|
|
4eba: ff 1f adc r31, r31
|
|
4ebc: a2 17 cp r26, r18
|
|
4ebe: b3 07 cpc r27, r19
|
|
4ec0: e4 07 cpc r30, r20
|
|
4ec2: f5 07 cpc r31, r21
|
|
4ec4: 20 f0 brcs .+8 ; 0x4ece <__udivmodsi4_ep>
|
|
4ec6: a2 1b sub r26, r18
|
|
4ec8: b3 0b sbc r27, r19
|
|
4eca: e4 0b sbc r30, r20
|
|
4ecc: f5 0b sbc r31, r21
|
|
|
|
00004ece <__udivmodsi4_ep>:
|
|
4ece: 66 1f adc r22, r22
|
|
4ed0: 77 1f adc r23, r23
|
|
4ed2: 88 1f adc r24, r24
|
|
4ed4: 99 1f adc r25, r25
|
|
4ed6: 1a 94 dec r1
|
|
4ed8: 69 f7 brne .-38 ; 0x4eb4 <__udivmodsi4_loop>
|
|
4eda: 60 95 com r22
|
|
4edc: 70 95 com r23
|
|
4ede: 80 95 com r24
|
|
4ee0: 90 95 com r25
|
|
4ee2: 9b 01 movw r18, r22
|
|
4ee4: ac 01 movw r20, r24
|
|
4ee6: bd 01 movw r22, r26
|
|
4ee8: cf 01 movw r24, r30
|
|
4eea: 08 95 ret
|
|
|
|
00004eec <_exit>:
|
|
4eec: f8 94 cli
|
|
|
|
00004eee <__stop_program>:
|
|
4eee: ff cf rjmp .-2 ; 0x4eee <__stop_program>
|