forked from bootsector/XBOXPadMicro
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathXBOXPadMicro.lss
3117 lines (2892 loc) · 123 KB
/
XBOXPadMicro.lss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
XBOXPadMicro.elf: file format elf32-avr
Sections:
Idx Name Size VMA LMA File off Algn
0 .data 00000002 00800100 00000e5e 00000ef2 2**0
CONTENTS, ALLOC, LOAD, DATA
1 .text 00000e5e 00000000 00000000 00000094 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
2 .bss 00000049 00800102 00800102 00000ef4 2**0
ALLOC
3 .comment 00000011 00000000 00000000 00000ef4 2**0
CONTENTS, READONLY
4 .note.gnu.avr.deviceinfo 00000040 00000000 00000000 00000f08 2**2
CONTENTS, READONLY
5 .debug_aranges 000002e8 00000000 00000000 00000f48 2**0
CONTENTS, READONLY, DEBUGGING
6 .debug_info 000056a4 00000000 00000000 00001230 2**0
CONTENTS, READONLY, DEBUGGING
7 .debug_abbrev 00001c7b 00000000 00000000 000068d4 2**0
CONTENTS, READONLY, DEBUGGING
8 .debug_line 00002f17 00000000 00000000 0000854f 2**0
CONTENTS, READONLY, DEBUGGING
9 .debug_frame 000007b0 00000000 00000000 0000b468 2**2
CONTENTS, READONLY, DEBUGGING
10 .debug_str 00002147 00000000 00000000 0000bc18 2**0
CONTENTS, READONLY, DEBUGGING
11 .debug_loc 00002dcb 00000000 00000000 0000dd5f 2**0
CONTENTS, READONLY, DEBUGGING
12 .debug_ranges 00000430 00000000 00000000 00010b2a 2**0
CONTENTS, READONLY, DEBUGGING
Disassembly of section .text:
00000000 <__vectors>:
0: 9c c0 rjmp .+312 ; 0x13a <__ctors_end>
2: 00 00 nop
4: b5 c0 rjmp .+362 ; 0x170 <__bad_interrupt>
6: 00 00 nop
8: b3 c0 rjmp .+358 ; 0x170 <__bad_interrupt>
a: 00 00 nop
c: b1 c0 rjmp .+354 ; 0x170 <__bad_interrupt>
e: 00 00 nop
10: af c0 rjmp .+350 ; 0x170 <__bad_interrupt>
12: 00 00 nop
14: ad c0 rjmp .+346 ; 0x170 <__bad_interrupt>
16: 00 00 nop
18: ab c0 rjmp .+342 ; 0x170 <__bad_interrupt>
1a: 00 00 nop
1c: a9 c0 rjmp .+338 ; 0x170 <__bad_interrupt>
1e: 00 00 nop
20: a7 c0 rjmp .+334 ; 0x170 <__bad_interrupt>
22: 00 00 nop
24: a5 c0 rjmp .+330 ; 0x170 <__bad_interrupt>
26: 00 00 nop
28: d1 c4 rjmp .+2466 ; 0x9cc <__vector_10>
2a: 00 00 nop
2c: a1 c0 rjmp .+322 ; 0x170 <__bad_interrupt>
2e: 00 00 nop
30: 9f c0 rjmp .+318 ; 0x170 <__bad_interrupt>
32: 00 00 nop
34: 9d c0 rjmp .+314 ; 0x170 <__bad_interrupt>
36: 00 00 nop
38: 9b c0 rjmp .+310 ; 0x170 <__bad_interrupt>
3a: 00 00 nop
3c: 99 c0 rjmp .+306 ; 0x170 <__bad_interrupt>
3e: 00 00 nop
40: 97 c0 rjmp .+302 ; 0x170 <__bad_interrupt>
42: 00 00 nop
44: 95 c0 rjmp .+298 ; 0x170 <__bad_interrupt>
46: 00 00 nop
48: 93 c0 rjmp .+294 ; 0x170 <__bad_interrupt>
4a: 00 00 nop
4c: 91 c0 rjmp .+290 ; 0x170 <__bad_interrupt>
4e: 00 00 nop
50: 8f c0 rjmp .+286 ; 0x170 <__bad_interrupt>
52: 00 00 nop
54: 8d c0 rjmp .+282 ; 0x170 <__bad_interrupt>
56: 00 00 nop
58: 8b c0 rjmp .+278 ; 0x170 <__bad_interrupt>
5a: 00 00 nop
5c: 89 c0 rjmp .+274 ; 0x170 <__bad_interrupt>
5e: 00 00 nop
60: 87 c0 rjmp .+270 ; 0x170 <__bad_interrupt>
62: 00 00 nop
64: 85 c0 rjmp .+266 ; 0x170 <__bad_interrupt>
66: 00 00 nop
68: 83 c0 rjmp .+262 ; 0x170 <__bad_interrupt>
6a: 00 00 nop
6c: 81 c0 rjmp .+258 ; 0x170 <__bad_interrupt>
6e: 00 00 nop
70: 7f c0 rjmp .+254 ; 0x170 <__bad_interrupt>
72: 00 00 nop
74: 7d c0 rjmp .+250 ; 0x170 <__bad_interrupt>
76: 00 00 nop
78: 7b c0 rjmp .+246 ; 0x170 <__bad_interrupt>
7a: 00 00 nop
7c: 79 c0 rjmp .+242 ; 0x170 <__bad_interrupt>
7e: 00 00 nop
80: 77 c0 rjmp .+238 ; 0x170 <__bad_interrupt>
82: 00 00 nop
84: 75 c0 rjmp .+234 ; 0x170 <__bad_interrupt>
86: 00 00 nop
88: 73 c0 rjmp .+230 ; 0x170 <__bad_interrupt>
8a: 00 00 nop
8c: 71 c0 rjmp .+226 ; 0x170 <__bad_interrupt>
8e: 00 00 nop
90: 1f c2 rjmp .+1086 ; 0x4d0 <__vector_36>
92: 00 00 nop
94: 6d c0 rjmp .+218 ; 0x170 <__bad_interrupt>
96: 00 00 nop
98: 6b c0 rjmp .+214 ; 0x170 <__bad_interrupt>
9a: 00 00 nop
9c: 69 c0 rjmp .+210 ; 0x170 <__bad_interrupt>
9e: 00 00 nop
a0: 67 c0 rjmp .+206 ; 0x170 <__bad_interrupt>
a2: 00 00 nop
a4: 65 c0 rjmp .+202 ; 0x170 <__bad_interrupt>
a6: 00 00 nop
a8: 63 c0 rjmp .+198 ; 0x170 <__bad_interrupt>
aa: 00 00 nop
000000ac <ProductString>:
ac: 2a 03 55 00 53 00 42 00 20 00 52 00 65 00 74 00 *.U.S.B. .R.e.t.
bc: 72 00 6f 00 50 00 61 00 64 00 20 00 41 00 64 00 r.o.P.a.d. .A.d.
cc: 61 00 70 00 74 00 65 00 72 00 00 00 a.p.t.e.r...
000000d8 <ManufacturerString>:
d8: 2a 03 77 00 77 00 77 00 2e 00 62 00 72 00 75 00 *.w.w.w...b.r.u.
e8: 6e 00 6f 00 66 00 72 00 65 00 69 00 74 00 61 00 n.o.f.r.e.i.t.a.
f8: 73 00 2e 00 63 00 6f 00 6d 00 00 00 s...c.o.m...
00000104 <LanguageString>:
104: 04 03 09 04 ....
00000108 <ConfigurationDescriptor>:
108: 09 02 20 00 01 01 00 80 32 09 04 00 00 02 58 42 .. .....2.....XB
118: 00 00 07 05 82 03 20 00 04 07 05 02 03 08 00 04 ...... .........
00000128 <DeviceDescriptor>:
128: 12 01 10 01 00 00 00 08 5e 04 02 02 00 01 00 00 ........^.......
138: 00 01 ..
0000013a <__ctors_end>:
13a: 11 24 eor r1, r1
13c: 1f be out 0x3f, r1 ; 63
13e: cf ef ldi r28, 0xFF ; 255
140: da e0 ldi r29, 0x0A ; 10
142: de bf out 0x3e, r29 ; 62
144: cd bf out 0x3d, r28 ; 61
00000146 <__do_copy_data>:
146: 11 e0 ldi r17, 0x01 ; 1
148: a0 e0 ldi r26, 0x00 ; 0
14a: b1 e0 ldi r27, 0x01 ; 1
14c: ee e5 ldi r30, 0x5E ; 94
14e: fe e0 ldi r31, 0x0E ; 14
150: 02 c0 rjmp .+4 ; 0x156 <__do_copy_data+0x10>
152: 05 90 lpm r0, Z+
154: 0d 92 st X+, r0
156: a2 30 cpi r26, 0x02 ; 2
158: b1 07 cpc r27, r17
15a: d9 f7 brne .-10 ; 0x152 <__do_copy_data+0xc>
0000015c <__do_clear_bss>:
15c: 21 e0 ldi r18, 0x01 ; 1
15e: a2 e0 ldi r26, 0x02 ; 2
160: b1 e0 ldi r27, 0x01 ; 1
162: 01 c0 rjmp .+2 ; 0x166 <.do_clear_bss_start>
00000164 <.do_clear_bss_loop>:
164: 1d 92 st X+, r1
00000166 <.do_clear_bss_start>:
166: ab 34 cpi r26, 0x4B ; 75
168: b2 07 cpc r27, r18
16a: e1 f7 brne .-8 ; 0x164 <.do_clear_bss_loop>
16c: b6 d0 rcall .+364 ; 0x2da <main>
16e: 75 c6 rjmp .+3306 ; 0xe5a <_exit>
00000170 <__bad_interrupt>:
170: 47 cf rjmp .-370 ; 0x0 <__vectors>
00000172 <I2C_requested>:
}
void I2C_requested()
{
// transmit the last received byte
I2C_transmitByte(recData);
172: 80 91 11 01 lds r24, 0x0111 ; 0x800111 <recData>
void I2C_stop(void);
void I2C_setCallbacks(void (*recv)(uint8_t), void (*req)());
inline void __attribute__((always_inline)) I2C_transmitByte(uint8_t data)
{
TWDR = data;
176: 80 93 bb 00 sts 0x00BB, r24 ; 0x8000bb <__TEXT_REGION_LENGTH__+0x7e00bb>
17a: 08 95 ret
0000017c <forwardStateBuffer>:
forwardStateBuffer();
}
}
void forwardStateBuffer()
{
17c: 79 d1 rcall .+754 ; 0x470 <xbox_reset_watchdog>
17e: 80 91 12 01 lds r24, 0x0112 ; 0x800112 <stateBuffer>
182: 2f ef ldi r18, 0xFF ; 255
184: 82 9f mul r24, r18
186: c0 01 movw r24, r0
188: 11 24 eor r1, r1
18a: 90 58 subi r25, 0x80 ; 128
18c: 90 93 27 01 sts 0x0127, r25 ; 0x800127 <gamepad_state+0xd>
190: 80 93 26 01 sts 0x0126, r24 ; 0x800126 <gamepad_state+0xc>
194: 80 91 13 01 lds r24, 0x0113 ; 0x800113 <stateBuffer+0x1>
198: 2f ef ldi r18, 0xFF ; 255
19a: 82 9f mul r24, r18
19c: c0 01 movw r24, r0
19e: 11 24 eor r1, r1
1a0: 90 58 subi r25, 0x80 ; 128
1a2: 90 93 29 01 sts 0x0129, r25 ; 0x800129 <gamepad_state+0xf>
1a6: 80 93 28 01 sts 0x0128, r24 ; 0x800128 <gamepad_state+0xe>
1aa: 80 91 14 01 lds r24, 0x0114 ; 0x800114 <stateBuffer+0x2>
1ae: 2f ef ldi r18, 0xFF ; 255
1b0: 82 9f mul r24, r18
1b2: c0 01 movw r24, r0
1b4: 11 24 eor r1, r1
1b6: 90 58 subi r25, 0x80 ; 128
1b8: 90 93 2b 01 sts 0x012B, r25 ; 0x80012b <gamepad_state+0x11>
1bc: 80 93 2a 01 sts 0x012A, r24 ; 0x80012a <gamepad_state+0x10>
1c0: 80 91 15 01 lds r24, 0x0115 ; 0x800115 <stateBuffer+0x3>
1c4: 2f ef ldi r18, 0xFF ; 255
1c6: 82 9f mul r24, r18
1c8: c0 01 movw r24, r0
1ca: 11 24 eor r1, r1
1cc: 90 58 subi r25, 0x80 ; 128
1ce: 90 93 2d 01 sts 0x012D, r25 ; 0x80012d <gamepad_state+0x13>
1d2: 80 93 2c 01 sts 0x012C, r24 ; 0x80012c <gamepad_state+0x12>
1d6: 80 91 16 01 lds r24, 0x0116 ; 0x800116 <stateBuffer+0x4>
1da: 80 93 24 01 sts 0x0124, r24 ; 0x800124 <gamepad_state+0xa>
1de: 80 91 17 01 lds r24, 0x0117 ; 0x800117 <stateBuffer+0x5>
1e2: 80 93 25 01 sts 0x0125, r24 ; 0x800125 <gamepad_state+0xb>
1e6: 80 91 19 01 lds r24, 0x0119 ; 0x800119 <stateBuffer+0x7>
1ea: 80 93 1c 01 sts 0x011C, r24 ; 0x80011c <gamepad_state+0x2>
1ee: 80 91 18 01 lds r24, 0x0118 ; 0x800118 <stateBuffer+0x6>
1f2: 80 ff sbrs r24, 0
1f4: 04 c0 rjmp .+8 ; 0x1fe <forwardStateBuffer+0x82>
1f6: 8f ef ldi r24, 0xFF ; 255
1f8: 80 93 23 01 sts 0x0123, r24 ; 0x800123 <gamepad_state+0x9>
1fc: 02 c0 rjmp .+4 ; 0x202 <forwardStateBuffer+0x86>
1fe: 10 92 23 01 sts 0x0123, r1 ; 0x800123 <gamepad_state+0x9>
202: 80 91 18 01 lds r24, 0x0118 ; 0x800118 <stateBuffer+0x6>
206: 81 ff sbrs r24, 1
208: 04 c0 rjmp .+8 ; 0x212 <forwardStateBuffer+0x96>
20a: 8f ef ldi r24, 0xFF ; 255
20c: 80 93 22 01 sts 0x0122, r24 ; 0x800122 <gamepad_state+0x8>
210: 02 c0 rjmp .+4 ; 0x216 <forwardStateBuffer+0x9a>
212: 10 92 22 01 sts 0x0122, r1 ; 0x800122 <gamepad_state+0x8>
216: 80 91 18 01 lds r24, 0x0118 ; 0x800118 <stateBuffer+0x6>
21a: 84 ff sbrs r24, 4
21c: 04 c0 rjmp .+8 ; 0x226 <forwardStateBuffer+0xaa>
21e: 8f ef ldi r24, 0xFF ; 255
220: 80 93 1e 01 sts 0x011E, r24 ; 0x80011e <gamepad_state+0x4>
224: 02 c0 rjmp .+4 ; 0x22a <forwardStateBuffer+0xae>
226: 10 92 1e 01 sts 0x011E, r1 ; 0x80011e <gamepad_state+0x4>
22a: 80 91 18 01 lds r24, 0x0118 ; 0x800118 <stateBuffer+0x6>
22e: 85 ff sbrs r24, 5
230: 04 c0 rjmp .+8 ; 0x23a <forwardStateBuffer+0xbe>
232: 8f ef ldi r24, 0xFF ; 255
234: 80 93 1f 01 sts 0x011F, r24 ; 0x80011f <gamepad_state+0x5>
238: 02 c0 rjmp .+4 ; 0x23e <forwardStateBuffer+0xc2>
23a: 10 92 1f 01 sts 0x011F, r1 ; 0x80011f <gamepad_state+0x5>
23e: 80 91 18 01 lds r24, 0x0118 ; 0x800118 <stateBuffer+0x6>
242: 86 ff sbrs r24, 6
244: 04 c0 rjmp .+8 ; 0x24e <forwardStateBuffer+0xd2>
246: 8f ef ldi r24, 0xFF ; 255
248: 80 93 20 01 sts 0x0120, r24 ; 0x800120 <gamepad_state+0x6>
24c: 02 c0 rjmp .+4 ; 0x252 <forwardStateBuffer+0xd6>
24e: 10 92 20 01 sts 0x0120, r1 ; 0x800120 <gamepad_state+0x6>
252: 80 91 18 01 lds r24, 0x0118 ; 0x800118 <stateBuffer+0x6>
256: 87 ff sbrs r24, 7
258: 04 c0 rjmp .+8 ; 0x262 <forwardStateBuffer+0xe6>
25a: 8f ef ldi r24, 0xFF ; 255
25c: 80 93 21 01 sts 0x0121, r24 ; 0x800121 <gamepad_state+0x7>
260: 02 c0 rjmp .+4 ; 0x266 <forwardStateBuffer+0xea>
262: 10 92 21 01 sts 0x0121, r1 ; 0x800121 <gamepad_state+0x7>
266: 02 c1 rjmp .+516 ; 0x46c <xbox_send_pad_state>
00000268 <I2C_received>:
268: 80 93 11 01 sts 0x0111, r24 ; 0x800111 <recData>
26c: 9f ef ldi r25, 0xFF ; 255
26e: 98 b9 out 0x08, r25 ; 8
270: 84 36 cpi r24, 0x64 ; 100
272: 29 f4 brne .+10 ; 0x27e <I2C_received+0x16>
274: 10 92 04 01 sts 0x0104, r1 ; 0x800104 <byteIdx+0x1>
278: 10 92 03 01 sts 0x0103, r1 ; 0x800103 <byteIdx>
27c: 17 c0 rjmp .+46 ; 0x2ac <I2C_received+0x44>
27e: 20 91 03 01 lds r18, 0x0103 ; 0x800103 <byteIdx>
282: 30 91 04 01 lds r19, 0x0104 ; 0x800104 <byteIdx+0x1>
286: 28 30 cpi r18, 0x08 ; 8
288: 31 05 cpc r19, r1
28a: 3c f4 brge .+14 ; 0x29a <I2C_received+0x32>
28c: e0 91 03 01 lds r30, 0x0103 ; 0x800103 <byteIdx>
290: f0 91 04 01 lds r31, 0x0104 ; 0x800104 <byteIdx+0x1>
294: ee 5e subi r30, 0xEE ; 238
296: fe 4f sbci r31, 0xFE ; 254
298: 80 83 st Z, r24
29a: 80 91 03 01 lds r24, 0x0103 ; 0x800103 <byteIdx>
29e: 90 91 04 01 lds r25, 0x0104 ; 0x800104 <byteIdx+0x1>
2a2: 01 96 adiw r24, 0x01 ; 1
2a4: 90 93 04 01 sts 0x0104, r25 ; 0x800104 <byteIdx+0x1>
2a8: 80 93 03 01 sts 0x0103, r24 ; 0x800103 <byteIdx>
2ac: 80 91 03 01 lds r24, 0x0103 ; 0x800103 <byteIdx>
2b0: 90 91 04 01 lds r25, 0x0104 ; 0x800104 <byteIdx+0x1>
2b4: 08 97 sbiw r24, 0x08 ; 8
2b6: 19 f4 brne .+6 ; 0x2be <I2C_received+0x56>
2b8: 8f ef ldi r24, 0xFF ; 255
2ba: 88 b9 out 0x08, r24 ; 8
2bc: 5f cf rjmp .-322 ; 0x17c <forwardStateBuffer>
2be: 08 95 ret
000002c0 <twiTest>:
2c0: 8f ef ldi r24, 0xFF ; 255
2c2: 87 b9 out 0x07, r24 ; 7
2c4: 18 b8 out 0x08, r1 ; 8
2c6: 88 e0 ldi r24, 0x08 ; 8
2c8: fa d0 rcall .+500 ; 0x4be <I2C_init>
2ca: 69 eb ldi r22, 0xB9 ; 185
2cc: 70 e0 ldi r23, 0x00 ; 0
2ce: 84 e3 ldi r24, 0x34 ; 52
2d0: 91 e0 ldi r25, 0x01 ; 1
2d2: ec d0 rcall .+472 ; 0x4ac <I2C_setCallbacks>
2d4: 8f ef ldi r24, 0xFF ; 255
2d6: 88 b9 out 0x08, r24 ; 8
2d8: fe cf rjmp .-4 ; 0x2d6 <twiTest+0x16>
000002da <main>:
2da: e1 e6 ldi r30, 0x61 ; 97
2dc: f0 e0 ldi r31, 0x00 ; 0
2de: 80 e8 ldi r24, 0x80 ; 128
2e0: 80 83 st Z, r24
2e2: 10 82 st Z, r1
2e4: 85 b7 in r24, 0x35 ; 53
2e6: 80 68 ori r24, 0x80 ; 128
2e8: 85 bf out 0x35, r24 ; 53
2ea: 85 b7 in r24, 0x35 ; 53
2ec: 80 68 ori r24, 0x80 ; 128
2ee: 85 bf out 0x35, r24 ; 53
2f0: 81 e0 ldi r24, 0x01 ; 1
2f2: c0 d0 rcall .+384 ; 0x474 <xbox_init>
2f4: e5 df rcall .-54 ; 0x2c0 <twiTest>
000002f6 <CALLBACK_USB_GetDescriptor>:
const uint8_t DescriptorNumber = (wValue & 0xFF);
const void* Address = NULL;
uint16_t Size = NO_DESCRIPTOR;
switch (DescriptorType)
2f6: 29 2f mov r18, r25
2f8: 33 27 eor r19, r19
2fa: 22 30 cpi r18, 0x02 ; 2
2fc: 31 05 cpc r19, r1
2fe: 59 f0 breq .+22 ; 0x316 <CALLBACK_USB_GetDescriptor+0x20>
300: 23 30 cpi r18, 0x03 ; 3
302: 31 05 cpc r19, r1
304: 69 f0 breq .+26 ; 0x320 <CALLBACK_USB_GetDescriptor+0x2a>
306: 21 30 cpi r18, 0x01 ; 1
308: 31 05 cpc r19, r1
30a: e9 f4 brne .+58 ; 0x346 <CALLBACK_USB_GetDescriptor+0x50>
{
case DTYPE_Device:
Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
30c: 82 e1 ldi r24, 0x12 ; 18
30e: 90 e0 ldi r25, 0x00 ; 0
uint16_t Size = NO_DESCRIPTOR;
switch (DescriptorType)
{
case DTYPE_Device:
Address = &DeviceDescriptor;
310: 28 e2 ldi r18, 0x28 ; 40
312: 31 e0 ldi r19, 0x01 ; 1
314: 1c c0 rjmp .+56 ; 0x34e <CALLBACK_USB_GetDescriptor+0x58>
Size = sizeof(USB_Descriptor_Device_t);
break;
case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
316: 80 e2 ldi r24, 0x20 ; 32
318: 90 e0 ldi r25, 0x00 ; 0
case DTYPE_Device:
Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
31a: 28 e0 ldi r18, 0x08 ; 8
31c: 31 e0 ldi r19, 0x01 ; 1
Size = sizeof(USB_Descriptor_Configuration_t);
break;
31e: 17 c0 rjmp .+46 ; 0x34e <CALLBACK_USB_GetDescriptor+0x58>
case DTYPE_String:
switch (DescriptorNumber)
320: 99 27 eor r25, r25
322: 81 30 cpi r24, 0x01 ; 1
324: 91 05 cpc r25, r1
326: 49 f0 breq .+18 ; 0x33a <CALLBACK_USB_GetDescriptor+0x44>
328: 28 f0 brcs .+10 ; 0x334 <CALLBACK_USB_GetDescriptor+0x3e>
32a: 02 97 sbiw r24, 0x02 ; 2
32c: 61 f4 brne .+24 ; 0x346 <CALLBACK_USB_GetDescriptor+0x50>
Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
case 0x02:
Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
32e: ec ea ldi r30, 0xAC ; 172
330: f0 e0 ldi r31, 0x00 ; 0
332: 05 c0 rjmp .+10 ; 0x33e <CALLBACK_USB_GetDescriptor+0x48>
case DTYPE_String:
switch (DescriptorNumber)
{
case 0x00:
Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
334: e4 e0 ldi r30, 0x04 ; 4
336: f1 e0 ldi r31, 0x01 ; 1
338: 02 c0 rjmp .+4 ; 0x33e <CALLBACK_USB_GetDescriptor+0x48>
break;
case 0x01:
Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
33a: e8 ed ldi r30, 0xD8 ; 216
33c: f0 e0 ldi r31, 0x00 ; 0
break;
case 0x02:
Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
33e: 84 91 lpm r24, Z
340: 90 e0 ldi r25, 0x00 ; 0
case 0x01:
Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
case 0x02:
Address = &ProductString;
342: 9f 01 movw r18, r30
Size = pgm_read_byte(&ProductString.Header.Size);
break;
344: 04 c0 rjmp .+8 ; 0x34e <CALLBACK_USB_GetDescriptor+0x58>
{
const uint8_t DescriptorType = (wValue >> 8);
const uint8_t DescriptorNumber = (wValue & 0xFF);
const void* Address = NULL;
uint16_t Size = NO_DESCRIPTOR;
346: 80 e0 ldi r24, 0x00 ; 0
348: 90 e0 ldi r25, 0x00 ; 0
const void** const DescriptorAddress)
{
const uint8_t DescriptorType = (wValue >> 8);
const uint8_t DescriptorNumber = (wValue & 0xFF);
const void* Address = NULL;
34a: 20 e0 ldi r18, 0x00 ; 0
34c: 30 e0 ldi r19, 0x00 ; 0
}
break;
}
*DescriptorAddress = Address;
34e: fa 01 movw r30, r20
350: 31 83 std Z+1, r19 ; 0x01
352: 20 83 st Z, r18
return Size;
}
354: 08 95 ret
00000356 <EVENT_USB_Device_Connect>:
/** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs and
* starts the library USB task to begin the enumeration and USB management process.
*/
void EVENT_USB_Device_Connect(void) {
if(padUSBConnectEventCallback)
356: e0 91 07 01 lds r30, 0x0107 ; 0x800107 <padUSBConnectEventCallback>
35a: f0 91 08 01 lds r31, 0x0108 ; 0x800108 <padUSBConnectEventCallback+0x1>
35e: 30 97 sbiw r30, 0x00 ; 0
360: 09 f0 breq .+2 ; 0x364 <EVENT_USB_Device_Connect+0xe>
padUSBConnectEventCallback();
362: 09 94 ijmp
364: 08 95 ret
00000366 <EVENT_USB_Device_Disconnect>:
/** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via
* the status LEDs and stops the USB management and joystick reporting tasks.
*/
void EVENT_USB_Device_Disconnect(void) {
if(padUSBDisconnectEventCallback)
366: e0 91 05 01 lds r30, 0x0105 ; 0x800105 <padUSBDisconnectEventCallback>
36a: f0 91 06 01 lds r31, 0x0106 ; 0x800106 <padUSBDisconnectEventCallback+0x1>
36e: 30 97 sbiw r30, 0x00 ; 0
370: 09 f0 breq .+2 ; 0x374 <EVENT_USB_Device_Disconnect+0xe>
padUSBDisconnectEventCallback();
372: 09 94 ijmp
374: 08 95 ret
00000376 <EVENT_USB_Device_ConfigurationChanged>:
uint8_t Number = (Address & ENDPOINT_EPNUM_MASK);
if (Number >= ENDPOINT_TOTAL_ENDPOINTS)
return false;
return Endpoint_ConfigureEndpoint_Prv(Number,
376: 42 e2 ldi r20, 0x22 ; 34
378: 61 ec ldi r22, 0xC1 ; 193
37a: 82 e0 ldi r24, 0x02 ; 2
37c: 1a c2 rjmp .+1076 ; 0x7b2 <Endpoint_ConfigureEndpoint_Prv>
0000037e <EVENT_USB_Device_ControlRequest>:
* the device from the USB host before passing along unhandled control requests to the library for processing
* internally.
*/
void EVENT_USB_Device_ControlRequest(void) {
/* Handle HID Class specific requests */
switch (USB_ControlRequest.bRequest) {
37e: 80 91 44 01 lds r24, 0x0144 ; 0x800144 <USB_ControlRequest+0x1>
382: 90 91 43 01 lds r25, 0x0143 ; 0x800143 <USB_ControlRequest>
386: 81 30 cpi r24, 0x01 ; 1
388: 91 f4 brne .+36 ; 0x3ae <EVENT_USB_Device_ControlRequest+0x30>
case HID_REQ_GetReport:
if (USB_ControlRequest.bmRequestType
38a: 91 3a cpi r25, 0xA1 ; 161
38c: 81 f5 brne .+96 ; 0x3ee <EVENT_USB_Device_ControlRequest+0x70>
* \note This is not applicable for non CONTROL type endpoints.
*/
static inline void Endpoint_ClearSETUP(void) ATTR_ALWAYS_INLINE;
static inline void Endpoint_ClearSETUP(void)
{
UEINTX &= ~(1 << RXSTPI);
38e: 80 91 e8 00 lds r24, 0x00E8 ; 0x8000e8 <__TEXT_REGION_LENGTH__+0x7e00e8>
392: 87 7f andi r24, 0xF7 ; 247
394: 80 93 e8 00 sts 0x00E8, r24 ; 0x8000e8 <__TEXT_REGION_LENGTH__+0x7e00e8>
== (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)) {
Endpoint_ClearSETUP();
/* Write the report data to the control endpoint */
Endpoint_Write_Control_Stream_LE(&gamepad_state, 20);
398: 64 e1 ldi r22, 0x14 ; 20
39a: 70 e0 ldi r23, 0x00 ; 0
39c: 8a e1 ldi r24, 0x1A ; 26
39e: 91 e0 ldi r25, 0x01 ; 1
3a0: 23 d1 rcall .+582 ; 0x5e8 <Endpoint_Write_Control_Stream_LE>
*/
static inline void Endpoint_ClearOUT(void) ATTR_ALWAYS_INLINE;
static inline void Endpoint_ClearOUT(void)
{
#if !defined(CONTROL_ONLY_DEVICE)
UEINTX &= ~((1 << RXOUTI) | (1 << FIFOCON));
3a2: 80 91 e8 00 lds r24, 0x00E8 ; 0x8000e8 <__TEXT_REGION_LENGTH__+0x7e00e8>
3a6: 8b 77 andi r24, 0x7B ; 123
3a8: 80 93 e8 00 sts 0x00E8, r24 ; 0x8000e8 <__TEXT_REGION_LENGTH__+0x7e00e8>
3ac: 08 95 ret
}
break;
default:
if (USB_ControlRequest.bmRequestType
3ae: 91 3c cpi r25, 0xC1 ; 193
3b0: f1 f4 brne .+60 ; 0x3ee <EVENT_USB_Device_ControlRequest+0x70>
== (REQDIR_DEVICETOHOST | REQTYPE_VENDOR | REQREC_INTERFACE)) {
if (USB_ControlRequest.bRequest == 0x06) {
3b2: 86 30 cpi r24, 0x06 ; 6
3b4: e1 f4 brne .+56 ; 0x3ee <EVENT_USB_Device_ControlRequest+0x70>
* \note This is not applicable for non CONTROL type endpoints.
*/
static inline void Endpoint_ClearSETUP(void) ATTR_ALWAYS_INLINE;
static inline void Endpoint_ClearSETUP(void)
{
UEINTX &= ~(1 << RXSTPI);
3b6: 80 91 e8 00 lds r24, 0x00E8 ; 0x8000e8 <__TEXT_REGION_LENGTH__+0x7e00e8>
3ba: 87 7f andi r24, 0xF7 ; 247
3bc: 80 93 e8 00 sts 0x00E8, r24 ; 0x8000e8 <__TEXT_REGION_LENGTH__+0x7e00e8>
Endpoint_ClearSETUP();
/* Write the report data to the control endpoint */
Endpoint_Write_Control_Stream_LE(gamepad_state.reserved_2, 16);
3c0: 60 e1 ldi r22, 0x10 ; 16
3c2: 70 e0 ldi r23, 0x00 ; 0
3c4: 8e e2 ldi r24, 0x2E ; 46
3c6: 91 e0 ldi r25, 0x01 ; 1
3c8: 0f d1 rcall .+542 ; 0x5e8 <Endpoint_Write_Control_Stream_LE>
*/
static inline void Endpoint_ClearOUT(void) ATTR_ALWAYS_INLINE;
static inline void Endpoint_ClearOUT(void)
{
#if !defined(CONTROL_ONLY_DEVICE)
UEINTX &= ~((1 << RXOUTI) | (1 << FIFOCON));
3ca: 80 91 e8 00 lds r24, 0x00E8 ; 0x8000e8 <__TEXT_REGION_LENGTH__+0x7e00e8>
3ce: 8b 77 andi r24, 0x7B ; 123
3d0: 80 93 e8 00 sts 0x00E8, r24 ; 0x8000e8 <__TEXT_REGION_LENGTH__+0x7e00e8>
Endpoint_ClearOUT();
padDetected = 1;
3d4: 81 e0 ldi r24, 0x01 ; 1
3d6: 90 e0 ldi r25, 0x00 ; 0
3d8: 90 93 0c 01 sts 0x010C, r25 ; 0x80010c <padDetected+0x1>
3dc: 80 93 0b 01 sts 0x010B, r24 ; 0x80010b <padDetected>
if(padDetectedCallback)
3e0: e0 91 09 01 lds r30, 0x0109 ; 0x800109 <padDetectedCallback>
3e4: f0 91 0a 01 lds r31, 0x010A ; 0x80010a <padDetectedCallback+0x1>
3e8: 30 97 sbiw r30, 0x00 ; 0
3ea: 09 f0 breq .+2 ; 0x3ee <EVENT_USB_Device_ControlRequest+0x70>
padDetectedCallback();
3ec: 09 94 ijmp
3ee: 08 95 ret
000003f0 <HID_Task>:
}
/** Function to manage HID report generation and transmission to the host. */
void HID_Task(void) {
/* Device must be connected and configured for the task to run */
if (USB_DeviceState != DEVICE_STATE_Configured)
3f0: 80 91 42 01 lds r24, 0x0142 ; 0x800142 <USB_DeviceState>
3f4: 84 30 cpi r24, 0x04 ; 4
3f6: 99 f4 brne .+38 ; 0x41e <__LOCK_REGION_LENGTH__+0x1e>
*/
static inline void Endpoint_SelectEndpoint(const uint8_t Address) ATTR_ALWAYS_INLINE;
static inline void Endpoint_SelectEndpoint(const uint8_t Address)
{
#if !defined(CONTROL_ONLY_DEVICE)
UENUM = (Address & ENDPOINT_EPNUM_MASK);
3f8: 82 e0 ldi r24, 0x02 ; 2
3fa: 80 93 e9 00 sts 0x00E9, r24 ; 0x8000e9 <__TEXT_REGION_LENGTH__+0x7e00e9>
* \return Boolean \c true if the current endpoint is ready for an IN packet, \c false otherwise.
*/
static inline bool Endpoint_IsINReady(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline bool Endpoint_IsINReady(void)
{
return ((UEINTX & (1 << TXINI)) ? true : false);
3fe: 80 91 e8 00 lds r24, 0x00E8 ; 0x8000e8 <__TEXT_REGION_LENGTH__+0x7e00e8>
/* Select the Joystick Report Endpoint */
Endpoint_SelectEndpoint(JOYSTICK_EPADDR_IN);
/* Check to see if the host is ready for another packet */
if (Endpoint_IsINReady()) {
402: 80 ff sbrs r24, 0
404: 0c c0 rjmp .+24 ; 0x41e <__LOCK_REGION_LENGTH__+0x1e>
/* Write Joystick Report Data */
Endpoint_Write_Stream_LE(&gamepad_state, 20, NULL);
406: 40 e0 ldi r20, 0x00 ; 0
408: 50 e0 ldi r21, 0x00 ; 0
40a: 64 e1 ldi r22, 0x14 ; 20
40c: 70 e0 ldi r23, 0x00 ; 0
40e: 8a e1 ldi r24, 0x1A ; 26
410: 91 e0 ldi r25, 0x01 ; 1
412: a0 d0 rcall .+320 ; 0x554 <Endpoint_Write_Stream_LE>
*/
static inline void Endpoint_ClearIN(void) ATTR_ALWAYS_INLINE;
static inline void Endpoint_ClearIN(void)
{
#if !defined(CONTROL_ONLY_DEVICE)
UEINTX &= ~((1 << TXINI) | (1 << FIFOCON));
414: 80 91 e8 00 lds r24, 0x00E8 ; 0x8000e8 <__TEXT_REGION_LENGTH__+0x7e00e8>
418: 8e 77 andi r24, 0x7E ; 126
41a: 80 93 e8 00 sts 0x00E8, r24 ; 0x8000e8 <__TEXT_REGION_LENGTH__+0x7e00e8>
41e: 08 95 ret
00000420 <xbox_reset_pad_status>:
Endpoint_ClearIN();
}
}
void xbox_reset_pad_status(void) {
memset(&gamepad_state, 0x00, sizeof(USB_JoystickReport_Data_t));
420: 84 e2 ldi r24, 0x24 ; 36
422: ea e1 ldi r30, 0x1A ; 26
424: f1 e0 ldi r31, 0x01 ; 1
426: df 01 movw r26, r30
428: 1d 92 st X+, r1
42a: 8a 95 dec r24
42c: e9 f7 brne .-6 ; 0x428 <xbox_reset_pad_status+0x8>
gamepad_state.rsize = 20;
42e: 84 e1 ldi r24, 0x14 ; 20
430: 80 93 1b 01 sts 0x011B, r24 ; 0x80011b <gamepad_state+0x1>
gamepad_state.reserved_2[0] = 16; // 16 - must be greater than 7, length of this report?
434: 90 e1 ldi r25, 0x10 ; 16
436: 90 93 2e 01 sts 0x012E, r25 ; 0x80012e <gamepad_state+0x14>
gamepad_state.reserved_2[1] = 66; // 0 - needed, USB interface protocol?
43a: 92 e4 ldi r25, 0x42 ; 66
43c: 90 93 2f 01 sts 0x012F, r25 ; 0x80012f <gamepad_state+0x15>
gamepad_state.reserved_2[2] = 0; // 0 - needed, USB interface protocol?
gamepad_state.reserved_2[3] = 1; // 1 - must be greater than 0, number of interfaces?
440: 91 e0 ldi r25, 0x01 ; 1
442: 90 93 31 01 sts 0x0131, r25 ; 0x800131 <gamepad_state+0x17>
gamepad_state.reserved_2[4] = 1; // 1 - needed, configuration index?
446: 90 93 32 01 sts 0x0132, r25 ; 0x800132 <gamepad_state+0x18>
gamepad_state.reserved_2[5] = 2; // 2 - must be greater than 0, number of endpoints?
44a: 92 e0 ldi r25, 0x02 ; 2
44c: 90 93 33 01 sts 0x0133, r25 ; 0x800133 <gamepad_state+0x19>
gamepad_state.reserved_2[6] = 20; // 20 - must be less or equal than max packet size for in endpoint, in max packet size?
450: 80 93 34 01 sts 0x0134, r24 ; 0x800134 <gamepad_state+0x1a>
gamepad_state.reserved_2[7] = 6; // 6 - must be less or equal than max packet size for out endpoint, out max packet size?
454: 86 e0 ldi r24, 0x06 ; 6
456: 80 93 35 01 sts 0x0135, r24 ; 0x800135 <gamepad_state+0x1b>
45a: e6 e3 ldi r30, 0x36 ; 54
45c: f1 e0 ldi r31, 0x01 ; 1
for (int i = 0; i < 8; i++) {
gamepad_state.reserved_3[i] = 0xFF;
45e: 8f ef ldi r24, 0xFF ; 255
460: 81 93 st Z+, r24
gamepad_state.reserved_2[4] = 1; // 1 - needed, configuration index?
gamepad_state.reserved_2[5] = 2; // 2 - must be greater than 0, number of endpoints?
gamepad_state.reserved_2[6] = 20; // 20 - must be less or equal than max packet size for in endpoint, in max packet size?
gamepad_state.reserved_2[7] = 6; // 6 - must be less or equal than max packet size for out endpoint, out max packet size?
for (int i = 0; i < 8; i++) {
462: b1 e0 ldi r27, 0x01 ; 1
464: ee 33 cpi r30, 0x3E ; 62
466: fb 07 cpc r31, r27
468: d9 f7 brne .-10 ; 0x460 <xbox_reset_pad_status+0x40>
gamepad_state.reserved_3[i] = 0xFF;
}
}
46a: 08 95 ret
0000046c <xbox_send_pad_state>:
void xbox_send_pad_state(void) {
HID_Task();
USB_USBTask();
46c: c1 df rcall .-126 ; 0x3f0 <HID_Task>
46e: db c4 rjmp .+2486 ; 0xe26 <USB_USBTask>
00000470 <xbox_reset_watchdog>:
}
void xbox_reset_watchdog(void) {
wdt_reset();
470: a8 95 wdr
472: 08 95 ret
00000474 <xbox_init>:
}
void xbox_init(bool watchdog) {
if (watchdog) {
474: 88 23 and r24, r24
476: 59 f0 breq .+22 ; 0x48e <xbox_init+0x1a>
: "r0"
);
}
else
{
__asm__ __volatile__ (
478: 9f e0 ldi r25, 0x0F ; 15
47a: 88 e1 ldi r24, 0x18 ; 24
47c: 0f b6 in r0, 0x3f ; 63
47e: f8 94 cli
480: a8 95 wdr
482: 80 93 60 00 sts 0x0060, r24 ; 0x800060 <__TEXT_REGION_LENGTH__+0x7e0060>
486: 0f be out 0x3f, r0 ; 63
488: 90 93 60 00 sts 0x0060, r25 ; 0x800060 <__TEXT_REGION_LENGTH__+0x7e0060>
48c: 0b c0 rjmp .+22 ; 0x4a4 <xbox_init+0x30>
);
}
else
{
uint8_t register temp_reg;
__asm__ __volatile__ (
48e: 0f b6 in r0, 0x3f ; 63
490: f8 94 cli
492: a8 95 wdr
494: 80 91 60 00 lds r24, 0x0060 ; 0x800060 <__TEXT_REGION_LENGTH__+0x7e0060>
498: 88 61 ori r24, 0x18 ; 24
49a: 80 93 60 00 sts 0x0060, r24 ; 0x800060 <__TEXT_REGION_LENGTH__+0x7e0060>
49e: 10 92 60 00 sts 0x0060, r1 ; 0x800060 <__TEXT_REGION_LENGTH__+0x7e0060>
wdt_disable();
}
xbox_reset_pad_status();
USB_Init();
4a2: 0f be out 0x3f, r0 ; 63
4a4: bd df rcall .-134 ; 0x420 <xbox_reset_pad_status>
sei();
4a6: 75 d2 rcall .+1258 ; 0x992 <USB_Init>
4a8: 78 94 sei
4aa: 08 95 ret
000004ac <I2C_setCallbacks>:
{
// clear acknowledge and enable bits
cli();
TWCR = 0;
TWAR = 0;
sei();
4ac: 90 93 10 01 sts 0x0110, r25 ; 0x800110 <I2C_recv+0x1>
4b0: 80 93 0f 01 sts 0x010F, r24 ; 0x80010f <I2C_recv>
4b4: 70 93 0e 01 sts 0x010E, r23 ; 0x80010e <I2C_req+0x1>
4b8: 60 93 0d 01 sts 0x010D, r22 ; 0x80010d <I2C_req>
4bc: 08 95 ret
000004be <I2C_init>:
4be: f8 94 cli
4c0: 88 0f add r24, r24
4c2: 80 93 ba 00 sts 0x00BA, r24 ; 0x8000ba <__TEXT_REGION_LENGTH__+0x7e00ba>
4c6: 85 ec ldi r24, 0xC5 ; 197
4c8: 80 93 bc 00 sts 0x00BC, r24 ; 0x8000bc <__TEXT_REGION_LENGTH__+0x7e00bc>
4cc: 78 94 sei
4ce: 08 95 ret
000004d0 <__vector_36>:
}
ISR(TWI_vect)
{
4d0: 1f 92 push r1
4d2: 0f 92 push r0
4d4: 0f b6 in r0, 0x3f ; 63
4d6: 0f 92 push r0
4d8: 11 24 eor r1, r1
4da: 2f 93 push r18
4dc: 3f 93 push r19
4de: 4f 93 push r20
4e0: 5f 93 push r21
4e2: 6f 93 push r22
4e4: 7f 93 push r23
4e6: 8f 93 push r24
4e8: 9f 93 push r25
4ea: af 93 push r26
4ec: bf 93 push r27
4ee: ef 93 push r30
4f0: ff 93 push r31
switch(TW_STATUS)
4f2: 80 91 b9 00 lds r24, 0x00B9 ; 0x8000b9 <__TEXT_REGION_LENGTH__+0x7e00b9>
4f6: 88 7f andi r24, 0xF8 ; 248
4f8: 80 38 cpi r24, 0x80 ; 128
4fa: 59 f0 breq .+22 ; 0x512 <__vector_36+0x42>
4fc: 28 f4 brcc .+10 ; 0x508 <__vector_36+0x38>
4fe: 81 11 cpse r24, r1
500: 15 c0 rjmp .+42 ; 0x52c <__vector_36+0x5c>
I2C_req();
TWCR = (1<<TWIE) | (1<<TWINT) | (1<<TWEA) | (1<<TWEN);
break;
case TW_BUS_ERROR:
// some sort of erroneous state, prepare TWI to be readdressed
TWCR = 0;
502: 10 92 bc 00 sts 0x00BC, r1 ; 0x8000bc <__TEXT_REGION_LENGTH__+0x7e00bc>
506: 12 c0 rjmp .+36 ; 0x52c <__vector_36+0x5c>
sei();
}
ISR(TWI_vect)
{
switch(TW_STATUS)
508: 88 3a cpi r24, 0xA8 ; 168
50a: 59 f0 breq .+22 ; 0x522 <__vector_36+0x52>
50c: 88 3b cpi r24, 0xB8 ; 184
50e: 49 f0 breq .+18 ; 0x522 <__vector_36+0x52>
510: 0d c0 rjmp .+26 ; 0x52c <__vector_36+0x5c>
{
case TW_SR_DATA_ACK:
// received data from master, call the receive callback
I2C_recv(TWDR);
512: 80 91 bb 00 lds r24, 0x00BB ; 0x8000bb <__TEXT_REGION_LENGTH__+0x7e00bb>
516: e0 91 0f 01 lds r30, 0x010F ; 0x80010f <I2C_recv>
51a: f0 91 10 01 lds r31, 0x0110 ; 0x800110 <I2C_recv+0x1>
51e: 09 95 icall
520: 05 c0 rjmp .+10 ; 0x52c <__vector_36+0x5c>
I2C_req();
TWCR = (1<<TWIE) | (1<<TWINT) | (1<<TWEA) | (1<<TWEN);
break;
case TW_ST_DATA_ACK:
// master is requesting data, call the request callback
I2C_req();
522: e0 91 0d 01 lds r30, 0x010D ; 0x80010d <I2C_req>
526: f0 91 0e 01 lds r31, 0x010E ; 0x80010e <I2C_req+0x1>
52a: 09 95 icall
// some sort of erroneous state, prepare TWI to be readdressed
TWCR = 0;
TWCR = (1<<TWIE) | (1<<TWINT) | (1<<TWEA) | (1<<TWEN);
break;
default:
TWCR = (1<<TWIE) | (1<<TWINT) | (1<<TWEA) | (1<<TWEN);
52c: 85 ec ldi r24, 0xC5 ; 197
52e: 80 93 bc 00 sts 0x00BC, r24 ; 0x8000bc <__TEXT_REGION_LENGTH__+0x7e00bc>
break;
}
}
532: ff 91 pop r31
534: ef 91 pop r30
536: bf 91 pop r27
538: af 91 pop r26
53a: 9f 91 pop r25
53c: 8f 91 pop r24
53e: 7f 91 pop r23
540: 6f 91 pop r22
542: 5f 91 pop r21
544: 4f 91 pop r20
546: 3f 91 pop r19
548: 2f 91 pop r18
54a: 0f 90 pop r0
54c: 0f be out 0x3f, r0 ; 63
54e: 0f 90 pop r0
550: 1f 90 pop r1
552: 18 95 reti
00000554 <Endpoint_Write_Stream_LE>:
else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended)
return ENDPOINT_RWCSTREAM_BusSuspended;
}
return ENDPOINT_RWCSTREAM_NoError;
}
554: cf 92 push r12
556: df 92 push r13
558: ef 92 push r14
55a: ff 92 push r15
55c: 0f 93 push r16
55e: 1f 93 push r17
560: cf 93 push r28
562: df 93 push r29
564: ec 01 movw r28, r24
566: 8b 01 movw r16, r22
568: 7a 01 movw r14, r20
56a: 77 d1 rcall .+750 ; 0x85a <Endpoint_WaitUntilReady>
56c: 81 11 cpse r24, r1
56e: 33 c0 rjmp .+102 ; 0x5d6 <Endpoint_Write_Stream_LE+0x82>
570: e1 14 cp r14, r1
572: f1 04 cpc r15, r1
574: 39 f0 breq .+14 ; 0x584 <Endpoint_Write_Stream_LE+0x30>
576: f7 01 movw r30, r14
578: 80 81 ld r24, Z
57a: 91 81 ldd r25, Z+1 ; 0x01
57c: 08 1b sub r16, r24
57e: 19 0b sbc r17, r25
580: c8 0f add r28, r24
582: d9 1f adc r29, r25
584: c1 2c mov r12, r1
586: d1 2c mov r13, r1
588: 01 15 cp r16, r1
58a: 11 05 cpc r17, r1
58c: 19 f1 breq .+70 ; 0x5d4 <Endpoint_Write_Stream_LE+0x80>
58e: 80 91 e8 00 lds r24, 0x00E8 ; 0x8000e8 <__TEXT_REGION_LENGTH__+0x7e00e8>
592: 85 fd sbrc r24, 5
594: 16 c0 rjmp .+44 ; 0x5c2 <Endpoint_Write_Stream_LE+0x6e>
596: 80 91 e8 00 lds r24, 0x00E8 ; 0x8000e8 <__TEXT_REGION_LENGTH__+0x7e00e8>
59a: 8e 77 andi r24, 0x7E ; 126
59c: 80 93 e8 00 sts 0x00E8, r24 ; 0x8000e8 <__TEXT_REGION_LENGTH__+0x7e00e8>
5a0: 42 d4 rcall .+2180 ; 0xe26 <USB_USBTask>
5a2: e1 14 cp r14, r1
5a4: f1 04 cpc r15, r1
5a6: 49 f0 breq .+18 ; 0x5ba <Endpoint_Write_Stream_LE+0x66>
5a8: f7 01 movw r30, r14
5aa: 80 81 ld r24, Z
5ac: 91 81 ldd r25, Z+1 ; 0x01
5ae: c8 0e add r12, r24
5b0: d9 1e adc r13, r25
5b2: d1 82 std Z+1, r13 ; 0x01
5b4: c0 82 st Z, r12
5b6: 85 e0 ldi r24, 0x05 ; 5
5b8: 0e c0 rjmp .+28 ; 0x5d6 <Endpoint_Write_Stream_LE+0x82>
5ba: 4f d1 rcall .+670 ; 0x85a <Endpoint_WaitUntilReady>
5bc: 88 23 and r24, r24
5be: 21 f3 breq .-56 ; 0x588 <Endpoint_Write_Stream_LE+0x34>
5c0: 0a c0 rjmp .+20 ; 0x5d6 <Endpoint_Write_Stream_LE+0x82>
5c2: 89 91 ld r24, Y+
5c4: 80 93 f1 00 sts 0x00F1, r24 ; 0x8000f1 <__TEXT_REGION_LENGTH__+0x7e00f1>
5c8: 01 50 subi r16, 0x01 ; 1
5ca: 11 09 sbc r17, r1
5cc: ff ef ldi r31, 0xFF ; 255
5ce: cf 1a sub r12, r31
5d0: df 0a sbc r13, r31
5d2: da cf rjmp .-76 ; 0x588 <Endpoint_Write_Stream_LE+0x34>
5d4: 80 e0 ldi r24, 0x00 ; 0
5d6: df 91 pop r29
5d8: cf 91 pop r28
5da: 1f 91 pop r17
5dc: 0f 91 pop r16
5de: ff 90 pop r15
5e0: ef 90 pop r14
5e2: df 90 pop r13
5e4: cf 90 pop r12
5e6: 08 95 ret