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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
|
MassStorage.elf: file format elf32-avr
Sections:
Idx Name Size VMA LMA File off Algn
0 .data 0000006e 00800100 0000103a 000010ce 2**0
CONTENTS, ALLOC, LOAD, DATA
1 .text 0000103a 00000000 00000000 00000094 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
2 .bss 0000000d 0080016e 0080016e 0000113c 2**0
ALLOC
3 .debug_aranges 00000448 00000000 00000000 0000113c 2**0
CONTENTS, READONLY, DEBUGGING
4 .debug_pubnames 00000b66 00000000 00000000 00001584 2**0
CONTENTS, READONLY, DEBUGGING
5 .debug_info 000072b9 00000000 00000000 000020ea 2**0
CONTENTS, READONLY, DEBUGGING
6 .debug_abbrev 00001e78 00000000 00000000 000093a3 2**0
CONTENTS, READONLY, DEBUGGING
7 .debug_line 00005642 00000000 00000000 0000b21b 2**0
CONTENTS, READONLY, DEBUGGING
8 .debug_frame 00000650 00000000 00000000 00010860 2**2
CONTENTS, READONLY, DEBUGGING
9 .debug_str 00002d8d 00000000 00000000 00010eb0 2**0
CONTENTS, READONLY, DEBUGGING
10 .debug_loc 00002dce 00000000 00000000 00013c3d 2**0
CONTENTS, READONLY, DEBUGGING
11 .debug_ranges 00000448 00000000 00000000 00016a0b 2**0
CONTENTS, READONLY, DEBUGGING
Disassembly of section .text:
00000000 <__vectors>:
return Endpoint_IsConfigured();
}
void Endpoint_ClearEndpoints(void)
{
0: 9a c0 rjmp .+308 ; 0x136 <__ctors_end>
#if defined(USB_CAN_BE_BOTH)
USB_CurrentMode = USB_MODE_None;
#endif
USB_IsInitialized = false;
}
2: 00 00 nop
else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended)
return ENDPOINT_RWCSTREAM_BusSuspended;
}
return ENDPOINT_RWCSTREAM_NoError;
}
4: b3 c0 rjmp .+358 ; 0x16c <__bad_interrupt>
6: 00 00 nop
8: b1 c0 rjmp .+354 ; 0x16c <__bad_interrupt>
a: 00 00 nop
c: af c0 rjmp .+350 ; 0x16c <__bad_interrupt>
e: 00 00 nop
10: ad c0 rjmp .+346 ; 0x16c <__bad_interrupt>
12: 00 00 nop
14: ab c0 rjmp .+342 ; 0x16c <__bad_interrupt>
16: 00 00 nop
18: a9 c0 rjmp .+338 ; 0x16c <__bad_interrupt>
1a: 00 00 nop
1c: a7 c0 rjmp .+334 ; 0x16c <__bad_interrupt>
1e: 00 00 nop
20: a5 c0 rjmp .+330 ; 0x16c <__bad_interrupt>
22: 00 00 nop
24: a3 c0 rjmp .+326 ; 0x16c <__bad_interrupt>
26: 00 00 nop
28: a1 c0 rjmp .+322 ; 0x16c <__bad_interrupt>
2a: 00 00 nop
2c: bf c3 rjmp .+1918 ; 0x7ac <__vector_11>
2e: 00 00 nop
30: 9d c0 rjmp .+314 ; 0x16c <__bad_interrupt>
32: 00 00 nop
34: 9b c0 rjmp .+310 ; 0x16c <__bad_interrupt>
36: 00 00 nop
38: 99 c0 rjmp .+306 ; 0x16c <__bad_interrupt>
3a: 00 00 nop
3c: 97 c0 rjmp .+302 ; 0x16c <__bad_interrupt>
3e: 00 00 nop
40: 95 c0 rjmp .+298 ; 0x16c <__bad_interrupt>
42: 00 00 nop
44: 93 c0 rjmp .+294 ; 0x16c <__bad_interrupt>
46: 00 00 nop
48: 91 c0 rjmp .+290 ; 0x16c <__bad_interrupt>
4a: 00 00 nop
4c: 8f c0 rjmp .+286 ; 0x16c <__bad_interrupt>
4e: 00 00 nop
50: 8d c0 rjmp .+282 ; 0x16c <__bad_interrupt>
52: 00 00 nop
54: 8b c0 rjmp .+278 ; 0x16c <__bad_interrupt>
56: 00 00 nop
58: 89 c0 rjmp .+274 ; 0x16c <__bad_interrupt>
5a: 00 00 nop
5c: 87 c0 rjmp .+270 ; 0x16c <__bad_interrupt>
5e: 00 00 nop
60: 85 c0 rjmp .+266 ; 0x16c <__bad_interrupt>
62: 00 00 nop
64: 83 c0 rjmp .+262 ; 0x16c <__bad_interrupt>
66: 00 00 nop
68: 81 c0 rjmp .+258 ; 0x16c <__bad_interrupt>
6a: 00 00 nop
6c: 7f c0 rjmp .+254 ; 0x16c <__bad_interrupt>
6e: 00 00 nop
70: 7d c0 rjmp .+250 ; 0x16c <__bad_interrupt>
72: 00 00 nop
74: 7b c0 rjmp .+246 ; 0x16c <__bad_interrupt>
76: 00 00 nop
78: 79 c0 rjmp .+242 ; 0x16c <__bad_interrupt>
7a: 00 00 nop
7c: 77 c0 rjmp .+238 ; 0x16c <__bad_interrupt>
7e: 00 00 nop
80: 75 c0 rjmp .+234 ; 0x16c <__bad_interrupt>
82: 00 00 nop
84: 73 c0 rjmp .+230 ; 0x16c <__bad_interrupt>
86: 00 00 nop
88: 71 c0 rjmp .+226 ; 0x16c <__bad_interrupt>
8a: 00 00 nop
8c: 6f c0 rjmp .+222 ; 0x16c <__bad_interrupt>
8e: 00 00 nop
90: 6d c0 rjmp .+218 ; 0x16c <__bad_interrupt>
92: 00 00 nop
94: 6b c0 rjmp .+214 ; 0x16c <__bad_interrupt>
96: 00 00 nop
00000098 <DeviceDescriptor>:
98: 12 01 10 01 00 00 00 08 a0 20 59 41 01 00 01 02 ......... YA....
a8: 00 01 ..
000000aa <ConfigurationDescriptor>:
aa: 09 02 20 00 01 01 00 80 32 09 04 00 00 02 08 06 .. .....2.......
ba: 50 00 07 05 83 02 40 00 01 07 05 04 02 40 00 01 P.....@......@..
000000ca <LanguageString>:
ca: 04 03 09 04 ....
000000ce <ManufacturerString>:
ce: 10 03 4f 00 70 00 65 00 6e 00 50 00 43 00 52 00 ..O.p.e.n.P.C.R.
de: 00 00 ..
000000e0 <ProductString>:
e0: 16 03 4f 00 70 00 65 00 6e 00 50 00 43 00 52 00 ..O.p.e.n.P.C.R.
f0: 20 00 76 00 31 00 00 00 .v.1...
000000f8 <fatBootData>:
f8: eb 3c 90 4f 70 65 6e 50 43 52 00 00 02 01 01 00 .<.OpenPCR......
108: 02 00 02 80 00 f0 40 00 00 00 00 00 00 00 00 00 ......@.........
118: 00 00 00 00 00 00 29 00 00 00 00 4e 6f 20 4e 61 ......)....No Na
128: 6d 65 00 00 00 00 46 41 54 31 36 00 00 00 me....FAT16...
00000136 <__ctors_end>:
136: 11 24 eor r1, r1
138: 1f be out 0x3f, r1 ; 63
13a: cf ef ldi r28, 0xFF ; 255
13c: d2 e0 ldi r29, 0x02 ; 2
13e: de bf out 0x3e, r29 ; 62
140: cd bf out 0x3d, r28 ; 61
00000142 <__do_copy_data>:
142: 11 e0 ldi r17, 0x01 ; 1
144: a0 e0 ldi r26, 0x00 ; 0
146: b1 e0 ldi r27, 0x01 ; 1
148: ea e3 ldi r30, 0x3A ; 58
14a: f0 e1 ldi r31, 0x10 ; 16
14c: 02 c0 rjmp .+4 ; 0x152 <.do_copy_data_start>
0000014e <.do_copy_data_loop>:
14e: 05 90 lpm r0, Z+
150: 0d 92 st X+, r0
00000152 <.do_copy_data_start>:
152: ae 36 cpi r26, 0x6E ; 110
154: b1 07 cpc r27, r17
156: d9 f7 brne .-10 ; 0x14e <.do_copy_data_loop>
00000158 <__do_clear_bss>:
158: 11 e0 ldi r17, 0x01 ; 1
15a: ae e6 ldi r26, 0x6E ; 110
15c: b1 e0 ldi r27, 0x01 ; 1
15e: 01 c0 rjmp .+2 ; 0x162 <.do_clear_bss_start>
00000160 <.do_clear_bss_loop>:
160: 1d 92 st X+, r1
00000162 <.do_clear_bss_start>:
162: ab 37 cpi r26, 0x7B ; 123
164: b1 07 cpc r27, r17
166: e1 f7 brne .-8 ; 0x160 <.do_clear_bss_loop>
168: 18 d0 rcall .+48 ; 0x19a <main>
16a: 65 c7 rjmp .+3786 ; 0x1036 <_exit>
0000016c <__bad_interrupt>:
16c: 49 cf rjmp .-366 ; 0x0 <__vectors>
0000016e <EVENT_USB_Device_Connect>:
/** Event handler for the library USB Connection event. */
void EVENT_USB_Device_Connect(void)
{
}
16e: 08 95 ret
00000170 <EVENT_USB_Device_Disconnect>:
/** Event handler for the library USB Disconnection event. */
void EVENT_USB_Device_Disconnect(void)
{
}
170: 08 95 ret
00000172 <CALLBACK_MS_Device_SCSICommandReceived>:
*/
bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
{
bool CommandSuccess;
CommandSuccess = SCSI_DecodeSCSICommand(MSInterfaceInfo);
172: cc c1 rjmp .+920 ; 0x50c <SCSI_DecodeSCSICommand>
return CommandSuccess;
}
174: 08 95 ret
00000176 <EVENT_USB_Device_ControlRequest>:
}
/** Event handler for the library USB Control Request reception event. */
void EVENT_USB_Device_ControlRequest(void)
{
MS_Device_ProcessControlRequest(&Disk_MS_Interface);
176: 80 e0 ldi r24, 0x00 ; 0
178: 91 e0 ldi r25, 0x01 ; 1
}
17a: 24 c7 rjmp .+3656 ; 0xfc4 <MS_Device_ProcessControlRequest>
0000017c <EVENT_USB_Device_ConfigurationChanged>:
/** Event handler for the library USB Configuration Changed event. */
void EVENT_USB_Device_ConfigurationChanged(void)
{
bool ConfigSuccess = true;
ConfigSuccess &= MS_Device_ConfigureEndpoints(&Disk_MS_Interface);
17c: 80 e0 ldi r24, 0x00 ; 0
17e: 91 e0 ldi r25, 0x01 ; 1
}
180: e6 c6 rjmp .+3532 ; 0xf4e <MS_Device_ConfigureEndpoints>
00000182 <SetupHardware>:
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
/* Disable watchdog if enabled by bootloader/fuses */
MCUSR &= ~(1 << WDRF);
182: 84 b7 in r24, 0x34 ; 52
184: 87 7f andi r24, 0xF7 ; 247
186: 84 bf out 0x34, r24 ; 52
wdt_disable();
188: 88 e1 ldi r24, 0x18 ; 24
18a: 0f b6 in r0, 0x3f ; 63
18c: f8 94 cli
18e: 80 93 60 00 sts 0x0060, r24
192: 10 92 60 00 sts 0x0060, r1
196: 0f be out 0x3f, r0 ; 63
/* Hardware Initialization */
// LEDs_Init();
// SPI_Init(SPI_SPEED_FCPU_DIV_2 | SPI_ORDER_MSB_FIRST | SPI_SCK_LEAD_FALLING | SPI_SAMPLE_TRAILING | SPI_MODE_MASTER);
USB_Init();
}
198: fa c2 rjmp .+1524 ; 0x78e <USB_Init>
0000019a <main>:
/** Main program entry point. This routine contains the overall program flow, including initial
* setup of all components and the main program loop.
*/
int main(void)
{
SetupHardware();
19a: f3 df rcall .-26 ; 0x182 <SetupHardware>
sei();
19c: 78 94 sei
for (;;)
{
MS_Device_USBTask(&Disk_MS_Interface);
19e: 80 e0 ldi r24, 0x00 ; 0
1a0: 91 e0 ldi r25, 0x01 ; 1
1a2: e5 d5 rcall .+3018 ; 0xd6e <MS_Device_USBTask>
USB_USBTask();
1a4: cb d5 rcall .+2966 ; 0xd3c <USB_USBTask>
1a6: fb cf rjmp .-10 ; 0x19e <main+0x4>
000001a8 <CALLBACK_USB_GetDescriptor>:
* USB host.
*/
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
const void** const DescriptorAddress)
{
1a8: da 01 movw r26, r20
const uint8_t DescriptorNumber = (wValue & 0xFF);
const void* Address = NULL;
uint16_t Size = NO_DESCRIPTOR;
switch (DescriptorType)
1aa: 92 30 cpi r25, 0x02 ; 2
1ac: 49 f0 breq .+18 ; 0x1c0 <CALLBACK_USB_GetDescriptor+0x18>
1ae: 93 30 cpi r25, 0x03 ; 3
1b0: 61 f0 breq .+24 ; 0x1ca <CALLBACK_USB_GetDescriptor+0x22>
1b2: 91 30 cpi r25, 0x01 ; 1
1b4: f9 f4 brne .+62 ; 0x1f4 <CALLBACK_USB_GetDescriptor+0x4c>
1b6: e8 e9 ldi r30, 0x98 ; 152
1b8: f0 e0 ldi r31, 0x00 ; 0
1ba: 22 e1 ldi r18, 0x12 ; 18
1bc: 30 e0 ldi r19, 0x00 ; 0
1be: 1e c0 rjmp .+60 ; 0x1fc <CALLBACK_USB_GetDescriptor+0x54>
1c0: ea ea ldi r30, 0xAA ; 170
1c2: f0 e0 ldi r31, 0x00 ; 0
1c4: 20 e2 ldi r18, 0x20 ; 32
1c6: 30 e0 ldi r19, 0x00 ; 0
1c8: 19 c0 rjmp .+50 ; 0x1fc <CALLBACK_USB_GetDescriptor+0x54>
case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
case DTYPE_String:
switch (DescriptorNumber)
1ca: 81 30 cpi r24, 0x01 ; 1
1cc: 49 f0 breq .+18 ; 0x1e0 <CALLBACK_USB_GetDescriptor+0x38>
1ce: 81 30 cpi r24, 0x01 ; 1
1d0: 18 f0 brcs .+6 ; 0x1d8 <CALLBACK_USB_GetDescriptor+0x30>
1d2: 82 30 cpi r24, 0x02 ; 2
1d4: 79 f4 brne .+30 ; 0x1f4 <CALLBACK_USB_GetDescriptor+0x4c>
1d6: 08 c0 rjmp .+16 ; 0x1e8 <CALLBACK_USB_GetDescriptor+0x40>
{
case 0x00:
Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
1d8: ea ec ldi r30, 0xCA ; 202
1da: f0 e0 ldi r31, 0x00 ; 0
1dc: 84 91 lpm r24, Z+
1de: 07 c0 rjmp .+14 ; 0x1ee <CALLBACK_USB_GetDescriptor+0x46>
break;
case 0x01:
Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
1e0: ee ec ldi r30, 0xCE ; 206
1e2: f0 e0 ldi r31, 0x00 ; 0
1e4: 84 91 lpm r24, Z+
1e6: 03 c0 rjmp .+6 ; 0x1ee <CALLBACK_USB_GetDescriptor+0x46>
break;
case 0x02:
Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
1e8: e0 ee ldi r30, 0xE0 ; 224
1ea: f0 e0 ldi r31, 0x00 ; 0
1ec: 84 91 lpm r24, Z+
1ee: 28 2f mov r18, r24
1f0: 30 e0 ldi r19, 0x00 ; 0
1f2: 04 c0 rjmp .+8 ; 0x1fc <CALLBACK_USB_GetDescriptor+0x54>
1f4: e0 e0 ldi r30, 0x00 ; 0
1f6: f0 e0 ldi r31, 0x00 ; 0
1f8: 20 e0 ldi r18, 0x00 ; 0
1fa: 30 e0 ldi r19, 0x00 ; 0
}
break;
}
*DescriptorAddress = Address;
1fc: ed 93 st X+, r30
1fe: fc 93 st X, r31
return Size;
}
200: c9 01 movw r24, r18
202: 08 95 ret
00000204 <SCSI_Command_Inquiry>:
*
* \return Boolean true if the command completed successfully, false otherwise.
*/
static bool SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
{
204: af 92 push r10
206: bf 92 push r11
208: cf 92 push r12
20a: df 92 push r13
20c: ef 92 push r14
20e: ff 92 push r15
210: 0f 93 push r16
212: 1f 93 push r17
214: df 93 push r29
216: cf 93 push r28
218: cd b7 in r28, 0x3d ; 61
21a: de b7 in r29, 0x3e ; 62
21c: 6c 01 movw r12, r24
/* Succeed the command and update the bytes transferred counter */
MSInterfaceInfo->State.CommandBlock.DataTransferLength -= BytesTransferred;
return true;
}
21e: ad b6 in r10, 0x3d ; 61
220: be b6 in r11, 0x3e ; 62
Temp = Data.Bytes[0];
Data.Bytes[0] = Data.Bytes[1];
Data.Bytes[1] = Temp;
return Data.Word;
222: fc 01 movw r30, r24
224: 05 8d ldd r16, Z+29 ; 0x1d
226: 14 8d ldd r17, Z+28 ; 0x1c
uint16_t AllocationLength = SwapEndian_16(*(uint16_t*)&MSInterfaceInfo->State.CommandBlock.SCSICommandData[3]);
uint16_t BytesTransferred = (AllocationLength < sizeof(InquiryData))? AllocationLength :
sizeof(InquiryData);
/* Only the standard INQUIRY data is supported, check if any optional INQUIRY bits set */
if ((MSInterfaceInfo->State.CommandBlock.SCSICommandData[1] & ((1 << 0) | (1 << 1))) ||
228: 82 8d ldd r24, Z+26 ; 0x1a
22a: 90 e0 ldi r25, 0x00 ; 0
22c: 83 70 andi r24, 0x03 ; 3
22e: 90 70 andi r25, 0x00 ; 0
230: 89 2b or r24, r25
232: 19 f4 brne .+6 ; 0x23a <SCSI_Command_Inquiry+0x36>
234: 83 8d ldd r24, Z+27 ; 0x1b
236: 88 23 and r24, r24
238: 69 f0 breq .+26 ; 0x254 <SCSI_Command_Inquiry+0x50>
MSInterfaceInfo->State.CommandBlock.SCSICommandData[2])
{
/* Optional but unsupported bits set - update the SENSE key and fail the request */
SCSI_SET_SENSE(SCSI_SENSE_KEY_ILLEGAL_REQUEST,
23a: 80 91 5d 01 lds r24, 0x015D
23e: 80 7f andi r24, 0xF0 ; 240
240: 85 60 ori r24, 0x05 ; 5
242: 80 93 5d 01 sts 0x015D, r24
246: 84 e2 ldi r24, 0x24 ; 36
248: 80 93 67 01 sts 0x0167, r24
24c: 10 92 68 01 sts 0x0168, r1
250: 80 e0 ldi r24, 0x00 ; 0
252: 33 c0 rjmp .+102 ; 0x2ba <SCSI_Command_Inquiry+0xb6>
static bool SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
{
uint16_t AllocationLength = SwapEndian_16(*(uint16_t*)&MSInterfaceInfo->State.CommandBlock.SCSICommandData[3]);
uint16_t BytesTransferred = (AllocationLength < sizeof(InquiryData))? AllocationLength :
sizeof(InquiryData);
254: 78 01 movw r14, r16
256: 05 32 cpi r16, 0x25 ; 37
258: 11 05 cpc r17, r1
25a: 18 f0 brcs .+6 ; 0x262 <SCSI_Command_Inquiry+0x5e>
25c: 84 e2 ldi r24, 0x24 ; 36
25e: e8 2e mov r14, r24
260: f1 2c mov r15, r1
SCSI_ASENSEQ_NO_QUALIFIER);
return false;
}
Endpoint_Write_Stream_LE(&InquiryData, BytesTransferred, NO_STREAM_CALLBACK);
262: 87 e3 ldi r24, 0x37 ; 55
264: 91 e0 ldi r25, 0x01 ; 1
266: b7 01 movw r22, r14
268: 40 e0 ldi r20, 0x00 ; 0
26a: 50 e0 ldi r21, 0x00 ; 0
26c: 2c d5 rcall .+2648 ; 0xcc6 <Endpoint_Write_Stream_LE>
uint8_t PadBytes[AllocationLength - BytesTransferred];
26e: b8 01 movw r22, r16
270: 6e 19 sub r22, r14
272: 7f 09 sbc r23, r15
274: 8d b7 in r24, 0x3d ; 61
276: 9e b7 in r25, 0x3e ; 62
278: 86 1b sub r24, r22
27a: 97 0b sbc r25, r23
27c: 0f b6 in r0, 0x3f ; 63
27e: f8 94 cli
280: 9e bf out 0x3e, r25 ; 62
282: 0f be out 0x3f, r0 ; 63
284: 8d bf out 0x3d, r24 ; 61
/* Pad out remaining bytes with 0x00 */
Endpoint_Write_Stream_LE(&PadBytes, sizeof(PadBytes), NO_STREAM_CALLBACK);
286: 01 96 adiw r24, 0x01 ; 1
288: 40 e0 ldi r20, 0x00 ; 0
28a: 50 e0 ldi r21, 0x00 ; 0
28c: 1c d5 rcall .+2616 ; 0xcc6 <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));
28e: 80 91 e8 00 lds r24, 0x00E8
292: 8e 77 andi r24, 0x7E ; 126
294: 80 93 e8 00 sts 0x00E8, r24
/* Finalize the stream transfer to send the last packet */
Endpoint_ClearIN();
/* Succeed the command and update the bytes transferred counter */
MSInterfaceInfo->State.CommandBlock.DataTransferLength -= BytesTransferred;
298: 97 01 movw r18, r14
29a: 40 e0 ldi r20, 0x00 ; 0
29c: 50 e0 ldi r21, 0x00 ; 0
29e: f6 01 movw r30, r12
2a0: 82 89 ldd r24, Z+18 ; 0x12
2a2: 93 89 ldd r25, Z+19 ; 0x13
2a4: a4 89 ldd r26, Z+20 ; 0x14
2a6: b5 89 ldd r27, Z+21 ; 0x15
2a8: 82 1b sub r24, r18
2aa: 93 0b sbc r25, r19
2ac: a4 0b sbc r26, r20
2ae: b5 0b sbc r27, r21
2b0: 82 8b std Z+18, r24 ; 0x12
2b2: 93 8b std Z+19, r25 ; 0x13
2b4: a4 8b std Z+20, r26 ; 0x14
2b6: b5 8b std Z+21, r27 ; 0x15
2b8: 81 e0 ldi r24, 0x01 ; 1
return true;
}
2ba: 0f b6 in r0, 0x3f ; 63
2bc: f8 94 cli
2be: be be out 0x3e, r11 ; 62
2c0: 0f be out 0x3f, r0 ; 63
2c2: ad be out 0x3d, r10 ; 61
2c4: cf 91 pop r28
2c6: df 91 pop r29
2c8: 1f 91 pop r17
2ca: 0f 91 pop r16
2cc: ff 90 pop r15
2ce: ef 90 pop r14
2d0: df 90 pop r13
2d2: cf 90 pop r12
2d4: bf 90 pop r11
2d6: af 90 pop r10
2d8: 08 95 ret
000002da <SCSI_Command_Request_Sense>:
* \param[in] MSInterfaceInfo Pointer to the Mass Storage class interface structure that the command is associated with
*
* \return Boolean true if the command completed successfully, false otherwise.
*/
static bool SCSI_Command_Request_Sense(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
{
2da: 8f 92 push r8
2dc: 9f 92 push r9
2de: bf 92 push r11
2e0: cf 92 push r12
2e2: df 92 push r13
2e4: ef 92 push r14
2e6: ff 92 push r15
2e8: 0f 93 push r16
2ea: 1f 93 push r17
2ec: df 93 push r29
2ee: cf 93 push r28
2f0: cd b7 in r28, 0x3d ; 61
2f2: de b7 in r29, 0x3e ; 62
2f4: 6c 01 movw r12, r24
/* Succeed the command and update the bytes transferred counter */
MSInterfaceInfo->State.CommandBlock.DataTransferLength -= BytesTransferred;
return true;
}
2f6: 8d b6 in r8, 0x3d ; 61
2f8: 9e b6 in r9, 0x3e ; 62
*
* \return Boolean true if the command completed successfully, false otherwise.
*/
static bool SCSI_Command_Request_Sense(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
{
uint8_t AllocationLength = MSInterfaceInfo->State.CommandBlock.SCSICommandData[4];
2fa: fc 01 movw r30, r24
2fc: 05 8d ldd r16, Z+29 ; 0x1d
uint8_t BytesTransferred = (AllocationLength < sizeof(SenseData))? AllocationLength : sizeof(SenseData);
2fe: b0 2e mov r11, r16
300: 03 31 cpi r16, 0x13 ; 19
302: 10 f0 brcs .+4 ; 0x308 <__stack+0x9>
304: 92 e1 ldi r25, 0x12 ; 18
306: b9 2e mov r11, r25
uint8_t PadBytes[AllocationLength - BytesTransferred];
308: 10 e0 ldi r17, 0x00 ; 0
30a: 0b 19 sub r16, r11
30c: 11 09 sbc r17, r1
30e: 8d b7 in r24, 0x3d ; 61
310: 9e b7 in r25, 0x3e ; 62
312: 80 1b sub r24, r16
314: 91 0b sbc r25, r17
316: 0f b6 in r0, 0x3f ; 63
318: f8 94 cli
31a: 9e bf out 0x3e, r25 ; 62
31c: 0f be out 0x3f, r0 ; 63
31e: 8d bf out 0x3d, r24 ; 61
320: ed b6 in r14, 0x3d ; 61
322: fe b6 in r15, 0x3e ; 62
324: 08 94 sec
326: e1 1c adc r14, r1
328: f1 1c adc r15, r1
Endpoint_Write_Stream_LE(&SenseData, BytesTransferred, NO_STREAM_CALLBACK);
32a: 8b e5 ldi r24, 0x5B ; 91
32c: 91 e0 ldi r25, 0x01 ; 1
32e: 6b 2d mov r22, r11
330: 70 e0 ldi r23, 0x00 ; 0
332: 40 e0 ldi r20, 0x00 ; 0
334: 50 e0 ldi r21, 0x00 ; 0
336: c7 d4 rcall .+2446 ; 0xcc6 <Endpoint_Write_Stream_LE>
Endpoint_Write_Stream_LE(&PadBytes, sizeof(PadBytes), NO_STREAM_CALLBACK);
338: c7 01 movw r24, r14
33a: b8 01 movw r22, r16
33c: 40 e0 ldi r20, 0x00 ; 0
33e: 50 e0 ldi r21, 0x00 ; 0
340: c2 d4 rcall .+2436 ; 0xcc6 <Endpoint_Write_Stream_LE>
342: 80 91 e8 00 lds r24, 0x00E8
346: 8e 77 andi r24, 0x7E ; 126
348: 80 93 e8 00 sts 0x00E8, r24
Endpoint_ClearIN();
/* Succeed the command and update the bytes transferred counter */
MSInterfaceInfo->State.CommandBlock.DataTransferLength -= BytesTransferred;
34c: f6 01 movw r30, r12
34e: 82 89 ldd r24, Z+18 ; 0x12
350: 93 89 ldd r25, Z+19 ; 0x13
352: a4 89 ldd r26, Z+20 ; 0x14
354: b5 89 ldd r27, Z+21 ; 0x15
356: 8b 19 sub r24, r11
358: 91 09 sbc r25, r1
35a: a1 09 sbc r26, r1
35c: b1 09 sbc r27, r1
35e: 82 8b std Z+18, r24 ; 0x12
360: 93 8b std Z+19, r25 ; 0x13
362: a4 8b std Z+20, r26 ; 0x14
364: b5 8b std Z+21, r27 ; 0x15
return true;
}
366: 81 e0 ldi r24, 0x01 ; 1
368: 0f b6 in r0, 0x3f ; 63
36a: f8 94 cli
36c: 9e be out 0x3e, r9 ; 62
36e: 0f be out 0x3f, r0 ; 63
370: 8d be out 0x3d, r8 ; 61
372: cf 91 pop r28
374: df 91 pop r29
376: 1f 91 pop r17
378: 0f 91 pop r16
37a: ff 90 pop r15
37c: ef 90 pop r14
37e: df 90 pop r13
380: cf 90 pop r12
382: bf 90 pop r11
384: 9f 90 pop r9
386: 8f 90 pop r8
388: 08 95 ret
0000038a <SCSI_Command_ReadWrite_10>:
// .exeEndMarker = {0x55, 0xaa}
};
static int SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo,
const bool IsDataRead)
{
38a: 6f 92 push r6
38c: 7f 92 push r7
38e: 8f 92 push r8
390: 9f 92 push r9
392: af 92 push r10
394: bf 92 push r11
396: cf 92 push r12
398: df 92 push r13
39a: ef 92 push r14
39c: ff 92 push r15
39e: 0f 93 push r16
3a0: 1f 93 push r17
3a2: df 93 push r29
3a4: cf 93 push r28
3a6: 00 d0 rcall .+0 ; 0x3a8 <SCSI_Command_ReadWrite_10+0x1e>
3a8: cd b7 in r28, 0x3d ; 61
3aa: de b7 in r29, 0x3e ; 62
3ac: 6c 01 movw r12, r24
Temp = Data.Bytes[1];
Data.Bytes[1] = Data.Bytes[2];
Data.Bytes[2] = Temp;
return Data.DWord;
3ae: fc 01 movw r30, r24
3b0: 26 8d ldd r18, Z+30 ; 0x1e
3b2: 35 8d ldd r19, Z+29 ; 0x1d
3b4: 44 8d ldd r20, Z+28 ; 0x1c
3b6: 53 8d ldd r21, Z+27 ; 0x1b
3b8: c9 01 movw r24, r18
3ba: da 01 movw r26, r20
3bc: 7c 01 movw r14, r24
3be: 8d 01 movw r16, r26
Temp = Data.Bytes[0];
Data.Bytes[0] = Data.Bytes[1];
Data.Bytes[1] = Temp;
return Data.Word;
3c0: 21 a1 ldd r18, Z+33 ; 0x21
3c2: 30 a1 ldd r19, Z+32 ; 0x20
3c4: c9 01 movw r24, r18
3c6: 5c 01 movw r10, r24
/* Load in the 16-bit total blocks (SCSI uses big-endian, so have to reverse the byte order) */
TotalBlocks = SwapEndian_16(*(uint16_t*)&MSInterfaceInfo->State.CommandBlock.SCSICommandData[7]);
/* Check if the block address is outside the maximum allowable value for the LUN */
if (BlockAddress >= LUN_MEDIA_BLOCKS)
3c8: f0 e0 ldi r31, 0x00 ; 0
3ca: ef 16 cp r14, r31
3cc: f4 e0 ldi r31, 0x04 ; 4
3ce: ff 06 cpc r15, r31
3d0: f0 e0 ldi r31, 0x00 ; 0
3d2: 0f 07 cpc r16, r31
3d4: f0 e0 ldi r31, 0x00 ; 0
3d6: 1f 07 cpc r17, r31
3d8: 70 f0 brcs .+28 ; 0x3f6 <SCSI_Command_ReadWrite_10+0x6c>
{
/* Block address is invalid, update SENSE key and return command fail */
SCSI_SET_SENSE(SCSI_SENSE_KEY_ILLEGAL_REQUEST,
3da: 80 91 5d 01 lds r24, 0x015D
3de: 80 7f andi r24, 0xF0 ; 240
3e0: 85 60 ori r24, 0x05 ; 5
3e2: 80 93 5d 01 sts 0x015D, r24
3e6: 81 e2 ldi r24, 0x21 ; 33
3e8: 80 93 67 01 sts 0x0167, r24
3ec: 10 92 68 01 sts 0x0168, r1
3f0: 20 e0 ldi r18, 0x00 ; 0
3f2: 30 e0 ldi r19, 0x00 ; 0
3f4: 79 c0 rjmp .+242 ; 0x4e8 <SCSI_Command_ReadWrite_10+0x15e>
/* Adjust the given block address to the real media address based on the selected LUN */
BlockAddress += ((uint32_t)MSInterfaceInfo->State.CommandBlock.LUN * LUN_MEDIA_BLOCKS);
#endif
/* Determine if the packet is a READ (10) or WRITE (10) command, call appropriate function */
if (IsDataRead == DATA_READ){
3f6: 66 23 and r22, r22
3f8: 09 f4 brne .+2 ; 0x3fc <SCSI_Command_ReadWrite_10+0x72>
3fa: 58 c0 rjmp .+176 ; 0x4ac <SCSI_Command_ReadWrite_10+0x122>
int block_index = 0;
uint16_t firstBlock = 0xfff0;
uint16_t secondBlock = 0xffff;
3fc: 8f ef ldi r24, 0xFF ; 255
3fe: 9f ef ldi r25, 0xFF ; 255
400: 9a 83 std Y+2, r25 ; 0x02
402: 89 83 std Y+1, r24 ; 0x01
}
else if (BlockAddress == 1 || BlockAddress == 2){ //FAT TABLE 1 and 2
// Endpoint_Write_Stream_BE(&firstBlock, sizeof(firstBlock), NO_STREAM_CALLBACK);
Endpoint_Write_Stream_BE(&secondBlock, sizeof(secondBlock), NO_STREAM_CALLBACK);
404: 4e 01 movw r8, r28
406: 08 94 sec
408: 81 1c adc r8, r1
40a: 91 1c adc r9, r1
* \param[in] Byte Next byte to write into the the currently selected endpoint's FIFO buffer.
*/
static inline void Endpoint_Write_Byte(const uint8_t Byte) ATTR_ALWAYS_INLINE;
static inline void Endpoint_Write_Byte(const uint8_t Byte)
{
UEDATX = Byte;
40c: e5 e5 ldi r30, 0x55 ; 85
40e: 6e 2e mov r6, r30
int block_index = 0;
uint16_t firstBlock = 0xfff0;
uint16_t secondBlock = 0xffff;
while (TotalBlocks){
if (BlockAddress == 0){ //BOOT Record
410: 7a ea ldi r23, 0xAA ; 170
412: 77 2e mov r7, r23
414: 47 c0 rjmp .+142 ; 0x4a4 <SCSI_Command_ReadWrite_10+0x11a>
416: e1 14 cp r14, r1
418: f1 04 cpc r15, r1
41a: 01 05 cpc r16, r1
41c: 11 05 cpc r17, r1
41e: c1 f4 brne .+48 ; 0x450 <SCSI_Command_ReadWrite_10+0xc6>
420: e8 ef ldi r30, 0xF8 ; 248
422: f0 e0 ldi r31, 0x00 ; 0
for (block_index=0; block_index<62; block_index++){
Endpoint_Write_Byte(pgm_read_byte(((char*)&fatBootData)+block_index));
424: 84 91 lpm r24, Z+
426: 80 93 f1 00 sts 0x00F1, r24
42a: 31 96 adiw r30, 0x01 ; 1
uint16_t firstBlock = 0xfff0;
uint16_t secondBlock = 0xffff;
while (TotalBlocks){
if (BlockAddress == 0){ //BOOT Record
for (block_index=0; block_index<62; block_index++){
42c: 21 e0 ldi r18, 0x01 ; 1
42e: e6 33 cpi r30, 0x36 ; 54
430: f2 07 cpc r31, r18
432: c1 f7 brne .-16 ; 0x424 <SCSI_Command_ReadWrite_10+0x9a>
434: 80 e0 ldi r24, 0x00 ; 0
436: 90 e0 ldi r25, 0x00 ; 0
438: 10 92 f1 00 sts 0x00F1, r1
Endpoint_Write_Byte(pgm_read_byte(((char*)&fatBootData)+block_index));
}
for (block_index=0; block_index<448; block_index++){
43c: 01 96 adiw r24, 0x01 ; 1
43e: e1 e0 ldi r30, 0x01 ; 1
440: 80 3c cpi r24, 0xC0 ; 192
442: 9e 07 cpc r25, r30
444: c9 f7 brne .-14 ; 0x438 <SCSI_Command_ReadWrite_10+0xae>
446: 60 92 f1 00 sts 0x00F1, r6
44a: 70 92 f1 00 sts 0x00F1, r7
44e: 22 c0 rjmp .+68 ; 0x494 <SCSI_Command_ReadWrite_10+0x10a>
Endpoint_Write_Byte(0xaa);
}
else if (BlockAddress == 1 || BlockAddress == 2){ //FAT TABLE 1 and 2
450: d8 01 movw r26, r16
452: c7 01 movw r24, r14
454: 01 97 sbiw r24, 0x01 ; 1
456: a1 09 sbc r26, r1
458: b1 09 sbc r27, r1
45a: 02 97 sbiw r24, 0x02 ; 2
45c: a1 05 cpc r26, r1
45e: b1 05 cpc r27, r1
460: 80 f4 brcc .+32 ; 0x482 <SCSI_Command_ReadWrite_10+0xf8>
// Endpoint_Write_Stream_BE(&firstBlock, sizeof(firstBlock), NO_STREAM_CALLBACK);
Endpoint_Write_Stream_BE(&secondBlock, sizeof(secondBlock), NO_STREAM_CALLBACK);
462: c4 01 movw r24, r8
464: 62 e0 ldi r22, 0x02 ; 2
466: 70 e0 ldi r23, 0x00 ; 0
468: 40 e0 ldi r20, 0x00 ; 0
46a: 50 e0 ldi r21, 0x00 ; 0
46c: f1 d3 rcall .+2018 ; 0xc50 <Endpoint_Write_Stream_BE>
46e: 84 e0 ldi r24, 0x04 ; 4
470: 90 e0 ldi r25, 0x00 ; 0
472: 10 92 f1 00 sts 0x00F1, r1
for (block_index=4; block_index<VIRTUAL_MEMORY_BLOCK_SIZE; block_index++){
476: 01 96 adiw r24, 0x01 ; 1
478: f2 e0 ldi r31, 0x02 ; 2
47a: 80 30 cpi r24, 0x00 ; 0
47c: 9f 07 cpc r25, r31
47e: c9 f7 brne .-14 ; 0x472 <SCSI_Command_ReadWrite_10+0xe8>
480: 09 c0 rjmp .+18 ; 0x494 <SCSI_Command_ReadWrite_10+0x10a>
482: 80 e0 ldi r24, 0x00 ; 0
484: 90 e0 ldi r25, 0x00 ; 0
486: 10 92 f1 00 sts 0x00F1, r1
Endpoint_Write_Byte(0x00);
}
}
else{
for (block_index=0; block_index<VIRTUAL_MEMORY_BLOCK_SIZE; block_index++){
48a: 01 96 adiw r24, 0x01 ; 1
48c: 22 e0 ldi r18, 0x02 ; 2
48e: 80 30 cpi r24, 0x00 ; 0
490: 92 07 cpc r25, r18
492: c9 f7 brne .-14 ; 0x486 <SCSI_Command_ReadWrite_10+0xfc>
Endpoint_Write_Byte(0x00);
}
}
BlockAddress++;
494: 08 94 sec
496: e1 1c adc r14, r1
498: f1 1c adc r15, r1
49a: 01 1d adc r16, r1
49c: 11 1d adc r17, r1
TotalBlocks--;
49e: 08 94 sec
4a0: a1 08 sbc r10, r1
4a2: b1 08 sbc r11, r1
if (IsDataRead == DATA_READ){
int block_index = 0;
uint16_t firstBlock = 0xfff0;
uint16_t secondBlock = 0xffff;
while (TotalBlocks){
4a4: a1 14 cp r10, r1
4a6: b1 04 cpc r11, r1
4a8: 09 f0 breq .+2 ; 0x4ac <SCSI_Command_ReadWrite_10+0x122>
4aa: b5 cf rjmp .-150 ; 0x416 <SCSI_Command_ReadWrite_10+0x8c>
*/
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));
4ac: 80 91 e8 00 lds r24, 0x00E8
4b0: 8e 77 andi r24, 0x7E ; 126
4b2: 80 93 e8 00 sts 0x00E8, r24
DataflashManager_ReadBlocks(MSInterfaceInfo, BlockAddress, TotalBlocks);
else
DataflashManager_WriteBlocks(MSInterfaceInfo, BlockAddress, TotalBlocks);
*/
/* Update the bytes transferred counter and succeed the command */
MSInterfaceInfo->State.CommandBlock.DataTransferLength -= ((uint32_t)TotalBlocks * VIRTUAL_MEMORY_BLOCK_SIZE);
4b6: 95 01 movw r18, r10
4b8: 40 e0 ldi r20, 0x00 ; 0
4ba: 50 e0 ldi r21, 0x00 ; 0
4bc: 69 e0 ldi r22, 0x09 ; 9
4be: 22 0f add r18, r18
4c0: 33 1f adc r19, r19
4c2: 44 1f adc r20, r20
4c4: 55 1f adc r21, r21
4c6: 6a 95 dec r22
4c8: d1 f7 brne .-12 ; 0x4be <SCSI_Command_ReadWrite_10+0x134>
4ca: f6 01 movw r30, r12
4cc: 82 89 ldd r24, Z+18 ; 0x12
4ce: 93 89 ldd r25, Z+19 ; 0x13
4d0: a4 89 ldd r26, Z+20 ; 0x14
4d2: b5 89 ldd r27, Z+21 ; 0x15
4d4: 82 1b sub r24, r18
4d6: 93 0b sbc r25, r19
4d8: a4 0b sbc r26, r20
4da: b5 0b sbc r27, r21
4dc: 82 8b std Z+18, r24 ; 0x12
4de: 93 8b std Z+19, r25 ; 0x13
4e0: a4 8b std Z+20, r26 ; 0x14
4e2: b5 8b std Z+21, r27 ; 0x15
4e4: 21 e0 ldi r18, 0x01 ; 1
4e6: 30 e0 ldi r19, 0x00 ; 0
return true;
}
4e8: c9 01 movw r24, r18
4ea: 0f 90 pop r0
4ec: 0f 90 pop r0
4ee: cf 91 pop r28
4f0: df 91 pop r29
4f2: 1f 91 pop r17
4f4: 0f 91 pop r16
4f6: ff 90 pop r15
4f8: ef 90 pop r14
4fa: df 90 pop r13
4fc: cf 90 pop r12
4fe: bf 90 pop r11
500: af 90 pop r10
502: 9f 90 pop r9
504: 8f 90 pop r8
506: 7f 90 pop r7
508: 6f 90 pop r6
50a: 08 95 ret
0000050c <SCSI_DecodeSCSICommand>:
* \param[in] MSInterfaceInfo Pointer to the Mass Storage class interface structure that the command is associated with
*
* \return Boolean true if the command completed successfully, false otherwise
*/
bool SCSI_DecodeSCSICommand(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
{
50c: 0f 93 push r16
50e: 1f 93 push r17
510: df 93 push r29
512: cf 93 push r28
514: cd b7 in r28, 0x3d ; 61
516: de b7 in r29, 0x3e ; 62
518: 28 97 sbiw r28, 0x08 ; 8
51a: 0f b6 in r0, 0x3f ; 63
51c: f8 94 cli
51e: de bf out 0x3e, r29 ; 62
520: 0f be out 0x3f, r0 ; 63
522: cd bf out 0x3d, r28 ; 61
524: 8c 01 movw r16, r24
bool CommandSuccess = false;
/* Run the appropriate SCSI command hander function based on the passed command */
switch (MSInterfaceInfo->State.CommandBlock.SCSICommandData[0])
526: fc 01 movw r30, r24
528: 81 8d ldd r24, Z+25 ; 0x19
52a: 8e 31 cpi r24, 0x1E ; 30
52c: 09 f4 brne .+2 ; 0x530 <SCSI_DecodeSCSICommand+0x24>
52e: 6b c0 rjmp .+214 ; 0x606 <SCSI_DecodeSCSICommand+0xfa>
530: 8f 31 cpi r24, 0x1F ; 31
532: 70 f4 brcc .+28 ; 0x550 <SCSI_DecodeSCSICommand+0x44>
534: 83 30 cpi r24, 0x03 ; 3
536: f9 f0 breq .+62 ; 0x576 <SCSI_DecodeSCSICommand+0x6a>
538: 84 30 cpi r24, 0x04 ; 4
53a: 20 f4 brcc .+8 ; 0x544 <SCSI_DecodeSCSICommand+0x38>
53c: 88 23 and r24, r24
53e: 09 f4 brne .+2 ; 0x542 <SCSI_DecodeSCSICommand+0x36>
540: 62 c0 rjmp .+196 ; 0x606 <SCSI_DecodeSCSICommand+0xfa>
542: 67 c0 rjmp .+206 ; 0x612 <SCSI_DecodeSCSICommand+0x106>
544: 82 31 cpi r24, 0x12 ; 18
546: a1 f0 breq .+40 ; 0x570 <SCSI_DecodeSCSICommand+0x64>
548: 8d 31 cpi r24, 0x1D ; 29
54a: 09 f0 breq .+2 ; 0x54e <SCSI_DecodeSCSICommand+0x42>
54c: 62 c0 rjmp .+196 ; 0x612 <SCSI_DecodeSCSICommand+0x106>
54e: 46 c0 rjmp .+140 ; 0x5dc <SCSI_DecodeSCSICommand+0xd0>
550: 88 32 cpi r24, 0x28 ; 40
552: 09 f4 brne .+2 ; 0x556 <SCSI_DecodeSCSICommand+0x4a>
554: 52 c0 rjmp .+164 ; 0x5fa <SCSI_DecodeSCSICommand+0xee>
556: 89 32 cpi r24, 0x29 ; 41
558: 20 f4 brcc .+8 ; 0x562 <SCSI_DecodeSCSICommand+0x56>
55a: 85 32 cpi r24, 0x25 ; 37
55c: 09 f0 breq .+2 ; 0x560 <SCSI_DecodeSCSICommand+0x54>
55e: 59 c0 rjmp .+178 ; 0x612 <SCSI_DecodeSCSICommand+0x106>
560: 0d c0 rjmp .+26 ; 0x57c <SCSI_DecodeSCSICommand+0x70>
562: 8a 32 cpi r24, 0x2A ; 42
564: 09 f4 brne .+2 ; 0x568 <SCSI_DecodeSCSICommand+0x5c>
566: 46 c0 rjmp .+140 ; 0x5f4 <SCSI_DecodeSCSICommand+0xe8>
568: 8f 32 cpi r24, 0x2F ; 47
56a: 09 f0 breq .+2 ; 0x56e <SCSI_DecodeSCSICommand+0x62>
56c: 52 c0 rjmp .+164 ; 0x612 <SCSI_DecodeSCSICommand+0x106>
56e: 4b c0 rjmp .+150 ; 0x606 <SCSI_DecodeSCSICommand+0xfa>
{
case SCSI_CMD_INQUIRY:
CommandSuccess = SCSI_Command_Inquiry(MSInterfaceInfo);
570: c8 01 movw r24, r16
572: 48 de rcall .-880 ; 0x204 <SCSI_Command_Inquiry>
574: 5a c0 rjmp .+180 ; 0x62a <SCSI_DecodeSCSICommand+0x11e>
break;
case SCSI_CMD_REQUEST_SENSE:
CommandSuccess = SCSI_Command_Request_Sense(MSInterfaceInfo);
576: c8 01 movw r24, r16
578: b0 de rcall .-672 ; 0x2da <SCSI_Command_Request_Sense>
57a: 57 c0 rjmp .+174 ; 0x62a <SCSI_DecodeSCSICommand+0x11e>
*
* \return Boolean true if the command completed successfully, false otherwise.
*/
static bool SCSI_Command_Read_Capacity_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
{
uint32_t LastBlockAddressInLUN = (LUN_MEDIA_BLOCKS - 1);
57c: 8f ef ldi r24, 0xFF ; 255
57e: 93 e0 ldi r25, 0x03 ; 3
580: a0 e0 ldi r26, 0x00 ; 0
582: b0 e0 ldi r27, 0x00 ; 0
584: 89 83 std Y+1, r24 ; 0x01
586: 9a 83 std Y+2, r25 ; 0x02
588: ab 83 std Y+3, r26 ; 0x03
58a: bc 83 std Y+4, r27 ; 0x04
uint32_t MediaBlockSize = VIRTUAL_MEMORY_BLOCK_SIZE;
58c: 80 e0 ldi r24, 0x00 ; 0
58e: 92 e0 ldi r25, 0x02 ; 2
590: a0 e0 ldi r26, 0x00 ; 0
592: b0 e0 ldi r27, 0x00 ; 0
594: 8d 83 std Y+5, r24 ; 0x05
596: 9e 83 std Y+6, r25 ; 0x06
598: af 83 std Y+7, r26 ; 0x07
59a: b8 87 std Y+8, r27 ; 0x08
Endpoint_Write_Stream_BE(&LastBlockAddressInLUN, sizeof(LastBlockAddressInLUN), NO_STREAM_CALLBACK);
59c: ce 01 movw r24, r28
59e: 01 96 adiw r24, 0x01 ; 1
5a0: 64 e0 ldi r22, 0x04 ; 4
5a2: 70 e0 ldi r23, 0x00 ; 0
5a4: 40 e0 ldi r20, 0x00 ; 0
5a6: 50 e0 ldi r21, 0x00 ; 0
5a8: 53 d3 rcall .+1702 ; 0xc50 <Endpoint_Write_Stream_BE>
Endpoint_Write_Stream_BE(&MediaBlockSize, sizeof(MediaBlockSize), NO_STREAM_CALLBACK);
5aa: ce 01 movw r24, r28
5ac: 05 96 adiw r24, 0x05 ; 5
5ae: 64 e0 ldi r22, 0x04 ; 4
5b0: 70 e0 ldi r23, 0x00 ; 0
5b2: 40 e0 ldi r20, 0x00 ; 0
5b4: 50 e0 ldi r21, 0x00 ; 0
5b6: 4c d3 rcall .+1688 ; 0xc50 <Endpoint_Write_Stream_BE>
5b8: 80 91 e8 00 lds r24, 0x00E8
5bc: 8e 77 andi r24, 0x7E ; 126
5be: 80 93 e8 00 sts 0x00E8, r24
Endpoint_ClearIN();
/* Succeed the command and update the bytes transferred counter */
MSInterfaceInfo->State.CommandBlock.DataTransferLength -= 8;
5c2: f8 01 movw r30, r16
5c4: 82 89 ldd r24, Z+18 ; 0x12
5c6: 93 89 ldd r25, Z+19 ; 0x13
5c8: a4 89 ldd r26, Z+20 ; 0x14
5ca: b5 89 ldd r27, Z+21 ; 0x15
5cc: 08 97 sbiw r24, 0x08 ; 8
5ce: a1 09 sbc r26, r1
5d0: b1 09 sbc r27, r1
5d2: 82 8b std Z+18, r24 ; 0x12
5d4: 93 8b std Z+19, r25 ; 0x13
5d6: a4 8b std Z+20, r26 ; 0x14
5d8: b5 8b std Z+21, r27 ; 0x15
5da: 2b c0 rjmp .+86 ; 0x632 <SCSI_DecodeSCSICommand+0x126>
* \return Boolean true if the command completed successfully, false otherwise.
*/
static bool SCSI_Command_Send_Diagnostic(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
{
/* Check to see if the SELF TEST bit is not set */
if (!(MSInterfaceInfo->State.CommandBlock.SCSICommandData[1] & (1 << 2)))
5dc: f8 01 movw r30, r16
5de: 82 8d ldd r24, Z+26 ; 0x1a
5e0: 82 fd sbrc r24, 2
5e2: 11 c0 rjmp .+34 ; 0x606 <SCSI_DecodeSCSICommand+0xfa>
{
/* Only self-test supported - update SENSE key and fail the command */
SCSI_SET_SENSE(SCSI_SENSE_KEY_ILLEGAL_REQUEST,
5e4: 80 91 5d 01 lds r24, 0x015D
5e8: 80 7f andi r24, 0xF0 ; 240
5ea: 85 60 ori r24, 0x05 ; 5
5ec: 80 93 5d 01 sts 0x015D, r24
5f0: 84 e2 ldi r24, 0x24 ; 36
5f2: 16 c0 rjmp .+44 ; 0x620 <SCSI_DecodeSCSICommand+0x114>
break;
case SCSI_CMD_SEND_DIAGNOSTIC:
CommandSuccess = SCSI_Command_Send_Diagnostic(MSInterfaceInfo);
break;
case SCSI_CMD_WRITE_10:
CommandSuccess = SCSI_Command_ReadWrite_10(MSInterfaceInfo, DATA_WRITE);
5f4: c8 01 movw r24, r16
5f6: 60 e0 ldi r22, 0x00 ; 0
5f8: 02 c0 rjmp .+4 ; 0x5fe <SCSI_DecodeSCSICommand+0xf2>
break;
case SCSI_CMD_READ_10:
CommandSuccess = SCSI_Command_ReadWrite_10(MSInterfaceInfo, DATA_READ);
5fa: c8 01 movw r24, r16
5fc: 61 e0 ldi r22, 0x01 ; 1
5fe: c5 de rcall .-630 ; 0x38a <SCSI_Command_ReadWrite_10>
600: 89 2b or r24, r25
602: a9 f0 breq .+42 ; 0x62e <SCSI_DecodeSCSICommand+0x122>
604: 16 c0 rjmp .+44 ; 0x632 <SCSI_DecodeSCSICommand+0x126>
case SCSI_CMD_TEST_UNIT_READY:
case SCSI_CMD_PREVENT_ALLOW_MEDIUM_REMOVAL:
case SCSI_CMD_VERIFY_10:
/* These commands should just succeed, no handling required */
CommandSuccess = true;
MSInterfaceInfo->State.CommandBlock.DataTransferLength = 0;
606: f8 01 movw r30, r16
608: 12 8a std Z+18, r1 ; 0x12
60a: 13 8a std Z+19, r1 ; 0x13
60c: 14 8a std Z+20, r1 ; 0x14
60e: 15 8a std Z+21, r1 ; 0x15
610: 10 c0 rjmp .+32 ; 0x632 <SCSI_DecodeSCSICommand+0x126>
break;
default:
/* Update the SENSE key to reflect the invalid command */
SCSI_SET_SENSE(SCSI_SENSE_KEY_ILLEGAL_REQUEST,
612: 80 91 5d 01 lds r24, 0x015D
616: 80 7f andi r24, 0xF0 ; 240
618: 85 60 ori r24, 0x05 ; 5
61a: 80 93 5d 01 sts 0x015D, r24
61e: 80 e2 ldi r24, 0x20 ; 32
620: 80 93 67 01 sts 0x0167, r24
624: 10 92 68 01 sts 0x0168, r1
628: 02 c0 rjmp .+4 ; 0x62e <SCSI_DecodeSCSICommand+0x122>
SCSI_ASENSEQ_NO_QUALIFIER);
break;
}
/* Check if command was successfully processed */
if (CommandSuccess)
62a: 88 23 and r24, r24
62c: 11 f4 brne .+4 ; 0x632 <SCSI_DecodeSCSICommand+0x126>
62e: 80 e0 ldi r24, 0x00 ; 0
630: 0a c0 rjmp .+20 ; 0x646 <SCSI_DecodeSCSICommand+0x13a>
{
SCSI_SET_SENSE(SCSI_SENSE_KEY_GOOD,
632: 80 91 5d 01 lds r24, 0x015D
636: 80 7f andi r24, 0xF0 ; 240
638: 80 93 5d 01 sts 0x015D, r24
63c: 10 92 67 01 sts 0x0167, r1
640: 10 92 68 01 sts 0x0168, r1
644: 81 e0 ldi r24, 0x01 ; 1
return true;
}
return false;
}
646: 28 96 adiw r28, 0x08 ; 8
648: 0f b6 in r0, 0x3f ; 63
64a: f8 94 cli
64c: de bf out 0x3e, r29 ; 62
64e: 0f be out 0x3f, r0 ; 63
650: cd bf out 0x3d, r28 ; 61
652: cf 91 pop r28
654: df 91 pop r29
656: 1f 91 pop r17
658: 0f 91 pop r16
65a: 08 95 ret
0000065c <Endpoint_ConfigureEndpoint_Prv>:
*/
static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber) ATTR_ALWAYS_INLINE;
static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber)
{
#if !defined(CONTROL_ONLY_DEVICE)
UENUM = EndpointNumber;
65c: 80 93 e9 00 sts 0x00E9, r24
* \note Endpoints must first be configured properly via \ref Endpoint_ConfigureEndpoint().
*/
static inline void Endpoint_EnableEndpoint(void) ATTR_ALWAYS_INLINE;
static inline void Endpoint_EnableEndpoint(void)
{
UECONX |= (1 << EPEN);
660: 80 91 eb 00 lds r24, 0x00EB
664: 81 60 ori r24, 0x01 ; 1
666: 80 93 eb 00 sts 0x00EB, r24
const uint8_t UECFG1XData)
{
Endpoint_SelectEndpoint(Number);
Endpoint_EnableEndpoint();
UECFG1X = 0;
66a: 10 92 ed 00 sts 0x00ED, r1
UECFG0X = UECFG0XData;
66e: 60 93 ec 00 sts 0x00EC, r22
UECFG1X = UECFG1XData;
672: 40 93 ed 00 sts 0x00ED, r20
* \return Boolean true if the currently selected endpoint has been configured, false otherwise.
*/
static inline bool Endpoint_IsConfigured(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline bool Endpoint_IsConfigured(void)
{
return ((UESTA0X & (1 << CFGOK)) ? true : false);
676: 80 91 ee 00 lds r24, 0x00EE
return Endpoint_IsConfigured();
}
67a: 88 1f adc r24, r24
67c: 88 27 eor r24, r24
67e: 88 1f adc r24, r24
680: 08 95 ret
00000682 <Endpoint_ClearStatusStage>:
}
}
void Endpoint_ClearStatusStage(void)
{
if (USB_ControlRequest.bmRequestType & REQDIR_DEVICETOHOST)
682: 80 91 73 01 lds r24, 0x0173
686: 88 23 and r24, r24
688: 8c f4 brge .+34 ; 0x6ac <Endpoint_ClearStatusStage+0x2a>
68a: 03 c0 rjmp .+6 ; 0x692 <Endpoint_ClearStatusStage+0x10>
{
while (!(Endpoint_IsOUTReceived()))
{
if (USB_DeviceState == DEVICE_STATE_Unattached)
68c: 8e b3 in r24, 0x1e ; 30
68e: 88 23 and r24, r24
690: b1 f0 breq .+44 ; 0x6be <Endpoint_ClearStatusStage+0x3c>
* \return Boolean true if current endpoint is has received an OUT packet, false otherwise.
*/
static inline bool Endpoint_IsOUTReceived(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline bool Endpoint_IsOUTReceived(void)
{
return ((UEINTX & (1 << RXOUTI)) ? true : false);
692: 80 91 e8 00 lds r24, 0x00E8
void Endpoint_ClearStatusStage(void)
{
if (USB_ControlRequest.bmRequestType & REQDIR_DEVICETOHOST)
{
while (!(Endpoint_IsOUTReceived()))
696: 82 ff sbrs r24, 2
698: f9 cf rjmp .-14 ; 0x68c <Endpoint_ClearStatusStage+0xa>
*/
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));
69a: 80 91 e8 00 lds r24, 0x00E8
69e: 8b 77 andi r24, 0x7B ; 123
6a0: 80 93 e8 00 sts 0x00E8, r24
6a4: 08 95 ret
}
else
{
while (!(Endpoint_IsINReady()))
{
if (USB_DeviceState == DEVICE_STATE_Unattached)
6a6: 8e b3 in r24, 0x1e ; 30
6a8: 88 23 and r24, r24
6aa: 49 f0 breq .+18 ; 0x6be <Endpoint_ClearStatusStage+0x3c>
* \return Boolean true if the current endpoint is ready for an IN packet, 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);
6ac: 80 91 e8 00 lds r24, 0x00E8
Endpoint_ClearOUT();
}
else
{
while (!(Endpoint_IsINReady()))
6b0: 80 ff sbrs r24, 0
6b2: f9 cf rjmp .-14 ; 0x6a6 <Endpoint_ClearStatusStage+0x24>
*/
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));
6b4: 80 91 e8 00 lds r24, 0x00E8
6b8: 8e 77 andi r24, 0x7E ; 126
6ba: 80 93 e8 00 sts 0x00E8, r24
6be: 08 95 ret
000006c0 <Endpoint_WaitUntilReady>:
/** Returns the current USB frame number, when in device mode. Every millisecond the USB bus is active (i.e. enumerated to a host)
* the frame number is incremented by one.
*/
static inline uint16_t USB_Device_GetFrameNumber(void)
{
return UDFNUM;
6c0: 40 91 e4 00 lds r20, 0x00E4
6c4: 50 91 e5 00 lds r21, 0x00E5
6c8: 24 e6 ldi r18, 0x64 ; 100
* \return The currently selected endpoint's direction, as a 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 (UECFG0X & ENDPOINT_DIR_IN);
6ca: 80 91 ec 00 lds r24, 0x00EC
uint16_t PreviousFrameNumber = USB_Device_GetFrameNumber();
for (;;)
{
if (Endpoint_GetEndpointDirection() == ENDPOINT_DIR_IN)
6ce: 80 ff sbrs r24, 0
6d0: 05 c0 rjmp .+10 ; 0x6dc <Endpoint_WaitUntilReady+0x1c>
* \return Boolean true if the current endpoint is ready for an IN packet, 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);
6d2: 80 91 e8 00 lds r24, 0x00E8
{
if (Endpoint_IsINReady())
6d6: 80 ff sbrs r24, 0
6d8: 05 c0 rjmp .+10 ; 0x6e4 <Endpoint_WaitUntilReady+0x24>
6da: 21 c0 rjmp .+66 ; 0x71e <Endpoint_WaitUntilReady+0x5e>
* \return Boolean true if current endpoint is has received an OUT packet, false otherwise.
*/
static inline bool Endpoint_IsOUTReceived(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline bool Endpoint_IsOUTReceived(void)
{
return ((UEINTX & (1 << RXOUTI)) ? true : false);
6dc: 80 91 e8 00 lds r24, 0x00E8
return ENDPOINT_READYWAIT_NoError;
}
else
{
if (Endpoint_IsOUTReceived())
6e0: 82 fd sbrc r24, 2
6e2: 1d c0 rjmp .+58 ; 0x71e <Endpoint_WaitUntilReady+0x5e>
return ENDPOINT_READYWAIT_NoError;
}
uint8_t USB_DeviceState_LCL = USB_DeviceState;
6e4: 8e b3 in r24, 0x1e ; 30
if (USB_DeviceState_LCL == DEVICE_STATE_Unattached)
6e6: 88 23 and r24, r24
6e8: 11 f4 brne .+4 ; 0x6ee <Endpoint_WaitUntilReady+0x2e>
6ea: 82 e0 ldi r24, 0x02 ; 2
6ec: 08 95 ret
return ENDPOINT_READYWAIT_DeviceDisconnected;
else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended)
6ee: 85 30 cpi r24, 0x05 ; 5
6f0: 11 f4 brne .+4 ; 0x6f6 <Endpoint_WaitUntilReady+0x36>
6f2: 83 e0 ldi r24, 0x03 ; 3
6f4: 08 95 ret
* \return Boolean true if the currently selected endpoint is stalled, false otherwise.
*/
static inline bool Endpoint_IsStalled(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline bool Endpoint_IsStalled(void)
{
return ((UECONX & (1 << STALLRQ)) ? true : false);
6f6: 80 91 eb 00 lds r24, 0x00EB
return ENDPOINT_READYWAIT_BusSuspended;
else if (Endpoint_IsStalled())
6fa: 85 ff sbrs r24, 5
6fc: 02 c0 rjmp .+4 ; 0x702 <Endpoint_WaitUntilReady+0x42>
6fe: 81 e0 ldi r24, 0x01 ; 1
700: 08 95 ret
702: 80 91 e4 00 lds r24, 0x00E4
706: 90 91 e5 00 lds r25, 0x00E5
return ENDPOINT_READYWAIT_EndpointStalled;
uint16_t CurrentFrameNumber = USB_Device_GetFrameNumber();
if (CurrentFrameNumber != PreviousFrameNumber)
70a: 84 17 cp r24, r20
70c: 95 07 cpc r25, r21
70e: e9 f2 breq .-70 ; 0x6ca <Endpoint_WaitUntilReady+0xa>
{
PreviousFrameNumber = CurrentFrameNumber;
if (!(TimeoutMSRem--))
710: 22 23 and r18, r18
712: 11 f4 brne .+4 ; 0x718 <Endpoint_WaitUntilReady+0x58>
714: 84 e0 ldi r24, 0x04 ; 4
716: 08 95 ret
718: 21 50 subi r18, 0x01 ; 1
71a: ac 01 movw r20, r24
71c: d6 cf rjmp .-84 ; 0x6ca <Endpoint_WaitUntilReady+0xa>
71e: 80 e0 ldi r24, 0x00 ; 0
return ENDPOINT_READYWAIT_Timeout;
}
}
}
720: 08 95 ret
00000722 <USB_ResetInterface>:
{
#if defined(USB_CAN_BE_BOTH)
bool UIDModeSelectEnabled = ((UHWCON & (1 << UIDE)) != 0);
#endif
USB_INT_DisableAllInterrupts();
722: 3e d0 rcall .+124 ; 0x7a0 <USB_INT_DisableAllInterrupts>
USB_INT_ClearAllInterrupts();
724: 40 d0 rcall .+128 ; 0x7a6 <USB_INT_ClearAllInterrupts>
}
static inline void USB_Controller_Reset(void) ATTR_ALWAYS_INLINE;
static inline void USB_Controller_Reset(void)
{
const uint8_t Temp = USBCON;
726: 80 91 d8 00 lds r24, 0x00D8
USBCON = (Temp & ~(1 << USBE));
72a: 98 2f mov r25, r24
72c: 9f 77 andi r25, 0x7F ; 127
72e: 90 93 d8 00 sts 0x00D8, r25
USBCON = (Temp | (1 << USBE));
732: 80 68 ori r24, 0x80 ; 128
734: 80 93 d8 00 sts 0x00D8, r24
/* Inline Functions: */
static inline void USB_PLL_On(void) ATTR_ALWAYS_INLINE;
static inline void USB_PLL_On(void)
{
PLLCSR = USB_PLL_PSC;
738: 84 e0 ldi r24, 0x04 ; 4
73a: 89 bd out 0x29, r24 ; 41
PLLCSR |= (1 << PLLE);
73c: 89 b5 in r24, 0x29 ; 41
73e: 82 60 ori r24, 0x02 ; 2
740: 89 bd out 0x29, r24 ; 41
#if defined(USB_SERIES_4_AVR)
PLLFRQ = ((1 << PLLUSB) | (1 << PDIV3) | (1 << PDIV1));
#endif
USB_PLL_On();
while (!(USB_PLL_IsReady()));
742: 09 b4 in r0, 0x29 ; 41
744: 00 fe sbrs r0, 0
746: fd cf rjmp .-6 ; 0x742 <USB_ResetInterface+0x20>
}
static inline void USB_CLK_Unfreeze(void) ATTR_ALWAYS_INLINE;
static inline void USB_CLK_Unfreeze(void)
{
USBCON &= ~(1 << FRZCLK);
748: 80 91 d8 00 lds r24, 0x00D8
74c: 8f 7d andi r24, 0xDF ; 223
74e: 80 93 d8 00 sts 0x00D8, r24
}
#if defined(USB_CAN_BE_DEVICE)
static void USB_Init_Device(void)
{
USB_DeviceState = DEVICE_STATE_Unattached;
752: 1e ba out 0x1e, r1 ; 30
USB_ConfigurationNumber = 0;
754: 10 92 71 01 sts 0x0171, r1
#if !defined(NO_DEVICE_REMOTE_WAKEUP)
USB_RemoteWakeupEnabled = false;
#endif
#if !defined(NO_DEVICE_SELF_POWER)
USB_CurrentlySelfPowered = false;
758: 10 92 70 01 sts 0x0170, r1
const uint8_t Type,
const uint8_t Direction,
const uint16_t Size,
const uint8_t Banks)
{
return Endpoint_ConfigureEndpoint_Prv(Number, (((Type) << EPTYPE0) | (Direction)),
75c: 80 e0 ldi r24, 0x00 ; 0
75e: 60 e0 ldi r22, 0x00 ; 0
760: 42 e0 ldi r20, 0x02 ; 2
762: 7c df rcall .-264 ; 0x65c <Endpoint_ConfigureEndpoint_Prv>
Endpoint_ConfigureEndpoint(ENDPOINT_CONTROLEP, EP_TYPE_CONTROL,
ENDPOINT_DIR_OUT, USB_ControlEndpointSize,
ENDPOINT_BANK_SINGLE);
USB_INT_Clear(USB_INT_SUSPI);
764: 80 91 e1 00 lds r24, 0x00E1
768: 8e 7f andi r24, 0xFE ; 254
76a: 80 93 e1 00 sts 0x00E1, r24
USB_INT_Enable(USB_INT_SUSPI);
76e: 80 91 e2 00 lds r24, 0x00E2
772: 81 60 ori r24, 0x01 ; 1
774: 80 93 e2 00 sts 0x00E2, r24
USB_INT_Enable(USB_INT_EORSTI);
778: 80 91 e2 00 lds r24, 0x00E2
77c: 88 60 ori r24, 0x08 ; 8
77e: 80 93 e2 00 sts 0x00E2, r24
* 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)
{
UDCON &= ~(1 << DETACH);
782: 80 91 e0 00 lds r24, 0x00E0
786: 8e 7f andi r24, 0xFE ; 254
788: 80 93 e0 00 sts 0x00E0, r24
}
#if (defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR))
USB_OTGPAD_On();
#endif
}
78c: 08 95 ret
0000078e <USB_Init>:
static inline void USB_REG_On(void)
{
#if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)
UHWCON |= (1 << UVREGE);
#else
REGCR &= ~(1 << REGDIS);
78e: e3 e6 ldi r30, 0x63 ; 99
790: f0 e0 ldi r31, 0x00 ; 0
792: 80 81 ld r24, Z
794: 8e 7f andi r24, 0xFE ; 254
796: 80 83 st Z, r24
{
USB_CurrentMode = Mode;
}
#endif
USB_IsInitialized = true;
798: 81 e0 ldi r24, 0x01 ; 1
79a: 80 93 72 01 sts 0x0172, r24
USB_ResetInterface();
}
79e: c1 cf rjmp .-126 ; 0x722 <USB_ResetInterface>
000007a0 <USB_INT_DisableAllInterrupts>:
#if defined(USB_CAN_BE_HOST)
UHIEN = 0;
#endif
#if defined(USB_CAN_BE_DEVICE)
UDIEN = 0;
7a0: 10 92 e2 00 sts 0x00E2, r1
#endif
}
7a4: 08 95 ret
000007a6 <USB_INT_ClearAllInterrupts>:
#if defined(USB_CAN_BE_HOST)
UHINT = 0;
#endif
#if defined(USB_CAN_BE_DEVICE)
UDINT = 0;
7a6: 10 92 e1 00 sts 0x00E1, r1
#endif
}
7aa: 08 95 ret
000007ac <__vector_11>:
ISR(USB_GEN_vect, ISR_BLOCK)
{
7ac: 1f 92 push r1
7ae: 0f 92 push r0
7b0: 0f b6 in r0, 0x3f ; 63
7b2: 0f 92 push r0
7b4: 11 24 eor r1, r1
7b6: 2f 93 push r18
7b8: 3f 93 push r19
7ba: 4f 93 push r20
7bc: 5f 93 push r21
7be: 6f 93 push r22
7c0: 7f 93 push r23
7c2: 8f 93 push r24
7c4: 9f 93 push r25
7c6: af 93 push r26
7c8: bf 93 push r27
7ca: ef 93 push r30
7cc: ff 93 push r31
EVENT_USB_Device_Disconnect();
}
}
#endif
if (USB_INT_HasOccurred(USB_INT_SUSPI) && USB_INT_IsEnabled(USB_INT_SUSPI))
7ce: 80 91 e1 00 lds r24, 0x00E1
7d2: 80 ff sbrs r24, 0
7d4: 1b c0 rjmp .+54 ; 0x80c <__vector_11+0x60>
7d6: 80 91 e2 00 lds r24, 0x00E2
7da: 80 ff sbrs r24, 0
7dc: 17 c0 rjmp .+46 ; 0x80c <__vector_11+0x60>
{
USB_INT_Clear(USB_INT_SUSPI);
7de: 80 91 e1 00 lds r24, 0x00E1
7e2: 8e 7f andi r24, 0xFE ; 254
7e4: 80 93 e1 00 sts 0x00E1, r24
USB_INT_Disable(USB_INT_SUSPI);
7e8: 80 91 e2 00 lds r24, 0x00E2
7ec: 8e 7f andi r24, 0xFE ; 254
7ee: 80 93 e2 00 sts 0x00E2, r24
USB_INT_Enable(USB_INT_WAKEUPI);
7f2: 80 91 e2 00 lds r24, 0x00E2
7f6: 80 61 ori r24, 0x10 ; 16
7f8: 80 93 e2 00 sts 0x00E2, r24
#endif
static inline void USB_CLK_Freeze(void) ATTR_ALWAYS_INLINE;
static inline void USB_CLK_Freeze(void)
{
USBCON |= (1 << FRZCLK);
7fc: 80 91 d8 00 lds r24, 0x00D8
800: 80 62 ori r24, 0x20 ; 32
802: 80 93 d8 00 sts 0x00D8, r24
}
static inline void USB_PLL_Off(void) ATTR_ALWAYS_INLINE;
static inline void USB_PLL_Off(void)
{
PLLCSR = 0;
806: 19 bc out 0x29, r1 ; 41
if (!(USB_Options & USB_OPT_MANUAL_PLL))
USB_PLL_Off();
#if defined(USB_SERIES_2_AVR) && !defined(NO_LIMITED_CONTROLLER_CONNECT)
USB_DeviceState = DEVICE_STATE_Unattached;
808: 1e ba out 0x1e, r1 ; 30
EVENT_USB_Device_Disconnect();
80a: b2 dc rcall .-1692 ; 0x170 <EVENT_USB_Device_Disconnect>
USB_DeviceState = DEVICE_STATE_Suspended;
EVENT_USB_Device_Suspend();
#endif
}
if (USB_INT_HasOccurred(USB_INT_WAKEUPI) && USB_INT_IsEnabled(USB_INT_WAKEUPI))
80c: 80 91 e1 00 lds r24, 0x00E1
810: 84 ff sbrs r24, 4
812: 2d c0 rjmp .+90 ; 0x86e <__vector_11+0xc2>
814: 80 91 e2 00 lds r24, 0x00E2
818: 84 ff sbrs r24, 4
81a: 29 c0 rjmp .+82 ; 0x86e <__vector_11+0xc2>
/* Inline Functions: */
static inline void USB_PLL_On(void) ATTR_ALWAYS_INLINE;
static inline void USB_PLL_On(void)
{
PLLCSR = USB_PLL_PSC;
81c: 84 e0 ldi r24, 0x04 ; 4
81e: 89 bd out 0x29, r24 ; 41
PLLCSR |= (1 << PLLE);
820: 89 b5 in r24, 0x29 ; 41
822: 82 60 ori r24, 0x02 ; 2
824: 89 bd out 0x29, r24 ; 41
{
if (!(USB_Options & USB_OPT_MANUAL_PLL))
{
USB_PLL_On();
while (!(USB_PLL_IsReady()));
826: 09 b4 in r0, 0x29 ; 41
828: 00 fe sbrs r0, 0
82a: fd cf rjmp .-6 ; 0x826 <__vector_11+0x7a>
}
static inline void USB_CLK_Unfreeze(void) ATTR_ALWAYS_INLINE;
static inline void USB_CLK_Unfreeze(void)
{
USBCON &= ~(1 << FRZCLK);
82c: 80 91 d8 00 lds r24, 0x00D8
830: 8f 7d andi r24, 0xDF ; 223
832: 80 93 d8 00 sts 0x00D8, r24
}
USB_CLK_Unfreeze();
USB_INT_Clear(USB_INT_WAKEUPI);
836: 80 91 e1 00 lds r24, 0x00E1
83a: 8f 7e andi r24, 0xEF ; 239
83c: 80 93 e1 00 sts 0x00E1, r24
USB_INT_Disable(USB_INT_WAKEUPI);
840: 80 91 e2 00 lds r24, 0x00E2
844: 8f 7e andi r24, 0xEF ; 239
846: 80 93 e2 00 sts 0x00E2, r24
USB_INT_Enable(USB_INT_SUSPI);
84a: 80 91 e2 00 lds r24, 0x00E2
84e: 81 60 ori r24, 0x01 ; 1
850: 80 93 e2 00 sts 0x00E2, r24
if (USB_ConfigurationNumber)
854: 80 91 71 01 lds r24, 0x0171
858: 88 23 and r24, r24
85a: 31 f4 brne .+12 ; 0x868 <__vector_11+0xbc>
}
static inline bool USB_Device_IsAddressSet(void) ATTR_ALWAYS_INLINE;
static inline bool USB_Device_IsAddressSet(void)
{
return (UDADDR & (1 << ADDEN));
85c: 80 91 e3 00 lds r24, 0x00E3
USB_DeviceState = DEVICE_STATE_Configured;
else
USB_DeviceState = (USB_Device_IsAddressSet()) ? DEVICE_STATE_Configured : DEVICE_STATE_Powered;
860: 87 fd sbrc r24, 7
862: 02 c0 rjmp .+4 ; 0x868 <__vector_11+0xbc>
864: 81 e0 ldi r24, 0x01 ; 1
866: 01 c0 rjmp .+2 ; 0x86a <__vector_11+0xbe>
868: 84 e0 ldi r24, 0x04 ; 4
86a: 8e bb out 0x1e, r24 ; 30
#if defined(USB_SERIES_2_AVR) && !defined(NO_LIMITED_CONTROLLER_CONNECT)
EVENT_USB_Device_Connect();
86c: 80 dc rcall .-1792 ; 0x16e <EVENT_USB_Device_Connect>
#else
EVENT_USB_Device_WakeUp();
#endif
}
if (USB_INT_HasOccurred(USB_INT_EORSTI) && USB_INT_IsEnabled(USB_INT_EORSTI))
86e: 80 91 e1 00 lds r24, 0x00E1
872: 83 ff sbrs r24, 3
874: 21 c0 rjmp .+66 ; 0x8b8 <__vector_11+0x10c>
876: 80 91 e2 00 lds r24, 0x00E2
87a: 83 ff sbrs r24, 3
87c: 1d c0 rjmp .+58 ; 0x8b8 <__vector_11+0x10c>
{
USB_INT_Clear(USB_INT_EORSTI);
87e: 80 91 e1 00 lds r24, 0x00E1
882: 87 7f andi r24, 0xF7 ; 247
884: 80 93 e1 00 sts 0x00E1, r24
USB_DeviceState = DEVICE_STATE_Default;
888: 82 e0 ldi r24, 0x02 ; 2
88a: 8e bb out 0x1e, r24 ; 30
USB_ConfigurationNumber = 0;
88c: 10 92 71 01 sts 0x0171, r1
USB_INT_Clear(USB_INT_SUSPI);
890: 80 91 e1 00 lds r24, 0x00E1
894: 8e 7f andi r24, 0xFE ; 254
896: 80 93 e1 00 sts 0x00E1, r24
USB_INT_Disable(USB_INT_SUSPI);
89a: 80 91 e2 00 lds r24, 0x00E2
89e: 8e 7f andi r24, 0xFE ; 254
8a0: 80 93 e2 00 sts 0x00E2, r24
USB_INT_Enable(USB_INT_WAKEUPI);
8a4: 80 91 e2 00 lds r24, 0x00E2
8a8: 80 61 ori r24, 0x10 ; 16
8aa: 80 93 e2 00 sts 0x00E2, r24
8ae: 80 e0 ldi r24, 0x00 ; 0
8b0: 60 e0 ldi r22, 0x00 ; 0
8b2: 42 e0 ldi r20, 0x02 ; 2
8b4: d3 de rcall .-602 ; 0x65c <Endpoint_ConfigureEndpoint_Prv>
#if defined(INTERRUPT_CONTROL_ENDPOINT)
USB_INT_Enable(USB_INT_RXSTPI);
#endif
EVENT_USB_Device_Reset();
8b6: 33 d1 rcall .+614 ; 0xb1e <USB_Event_Stub>
}
#if !defined(NO_SOF_EVENTS)
if (USB_INT_HasOccurred(USB_INT_SOFI) && USB_INT_IsEnabled(USB_INT_SOFI))
8b8: 80 91 e1 00 lds r24, 0x00E1
8bc: 82 ff sbrs r24, 2
8be: 0a c0 rjmp .+20 ; 0x8d4 <__vector_11+0x128>
8c0: 80 91 e2 00 lds r24, 0x00E2
8c4: 82 ff sbrs r24, 2
8c6: 06 c0 rjmp .+12 ; 0x8d4 <__vector_11+0x128>
{
USB_INT_Clear(USB_INT_SOFI);
8c8: 80 91 e1 00 lds r24, 0x00E1
8cc: 8b 7f andi r24, 0xFB ; 251
8ce: 80 93 e1 00 sts 0x00E1, r24
EVENT_USB_Device_StartOfFrame();
8d2: 25 d1 rcall .+586 ; 0xb1e <USB_Event_Stub>
USB_ResetInterface();
EVENT_USB_UIDChange();
}
#endif
}
8d4: ff 91 pop r31
8d6: ef 91 pop r30
8d8: bf 91 pop r27
8da: af 91 pop r26
8dc: 9f 91 pop r25
8de: 8f 91 pop r24
8e0: 7f 91 pop r23
8e2: 6f 91 pop r22
8e4: 5f 91 pop r21
8e6: 4f 91 pop r20
8e8: 3f 91 pop r19
8ea: 2f 91 pop r18
8ec: 0f 90 pop r0
8ee: 0f be out 0x3f, r0 ; 63
8f0: 0f 90 pop r0
8f2: 1f 90 pop r1
8f4: 18 95 reti
000008f6 <USB_Device_ProcessControlRequest>:
#if !defined(NO_DEVICE_REMOTE_WAKEUP)
bool USB_RemoteWakeupEnabled;
#endif
void USB_Device_ProcessControlRequest(void)
{
8f6: 0f 93 push r16
8f8: 1f 93 push r17
8fa: df 93 push r29
8fc: cf 93 push r28
8fe: 00 d0 rcall .+0 ; 0x900 <USB_Device_ProcessControlRequest+0xa>
900: cd b7 in r28, 0x3d ; 61
902: de b7 in r29, 0x3e ; 62
904: e3 e7 ldi r30, 0x73 ; 115
906: f1 e0 ldi r31, 0x01 ; 1
* \return Next byte in the currently selected endpoint's FIFO buffer.
*/
static inline uint8_t Endpoint_Read_Byte(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint8_t Endpoint_Read_Byte(void)
{
return UEDATX;
908: 80 91 f1 00 lds r24, 0x00F1
uint8_t* RequestHeader = (uint8_t*)&USB_ControlRequest;
for (uint8_t RequestHeaderByte = 0; RequestHeaderByte < sizeof(USB_Request_Header_t); RequestHeaderByte++)
*(RequestHeader++) = Endpoint_Read_Byte();
90c: 81 93 st Z+, r24
void USB_Device_ProcessControlRequest(void)
{
uint8_t* RequestHeader = (uint8_t*)&USB_ControlRequest;
for (uint8_t RequestHeaderByte = 0; RequestHeaderByte < sizeof(USB_Request_Header_t); RequestHeaderByte++)
90e: 81 e0 ldi r24, 0x01 ; 1
910: eb 37 cpi r30, 0x7B ; 123
912: f8 07 cpc r31, r24
914: c9 f7 brne .-14 ; 0x908 <USB_Device_ProcessControlRequest+0x12>
*(RequestHeader++) = Endpoint_Read_Byte();
EVENT_USB_Device_ControlRequest();
916: 2f dc rcall .-1954 ; 0x176 <EVENT_USB_Device_ControlRequest>
* \return Boolean true if the selected endpoint has received a SETUP packet, false otherwise.
*/
static inline bool Endpoint_IsSETUPReceived(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline bool Endpoint_IsSETUPReceived(void)
{
return ((UEINTX & (1 << RXSTPI)) ? true : false);
918: 80 91 e8 00 lds r24, 0x00E8
if (Endpoint_IsSETUPReceived())
91c: 83 ff sbrs r24, 3
91e: ea c0 rjmp .+468 ; 0xaf4 <USB_Device_ProcessControlRequest+0x1fe>
{
uint8_t bmRequestType = USB_ControlRequest.bmRequestType;
920: 80 91 73 01 lds r24, 0x0173
switch (USB_ControlRequest.bRequest)
924: 90 91 74 01 lds r25, 0x0174
928: 95 30 cpi r25, 0x05 ; 5
92a: 09 f4 brne .+2 ; 0x92e <USB_Device_ProcessControlRequest+0x38>
92c: 71 c0 rjmp .+226 ; 0xa10 <USB_Device_ProcessControlRequest+0x11a>
92e: 96 30 cpi r25, 0x06 ; 6
930: 40 f4 brcc .+16 ; 0x942 <USB_Device_ProcessControlRequest+0x4c>
932: 91 30 cpi r25, 0x01 ; 1
934: a1 f1 breq .+104 ; 0x99e <USB_Device_ProcessControlRequest+0xa8>
936: 91 30 cpi r25, 0x01 ; 1
938: 70 f0 brcs .+28 ; 0x956 <USB_Device_ProcessControlRequest+0x60>
93a: 93 30 cpi r25, 0x03 ; 3
93c: 09 f0 breq .+2 ; 0x940 <USB_Device_ProcessControlRequest+0x4a>
93e: da c0 rjmp .+436 ; 0xaf4 <USB_Device_ProcessControlRequest+0x1fe>
940: 2e c0 rjmp .+92 ; 0x99e <USB_Device_ProcessControlRequest+0xa8>
942: 98 30 cpi r25, 0x08 ; 8
944: 09 f4 brne .+2 ; 0x948 <USB_Device_ProcessControlRequest+0x52>
946: a9 c0 rjmp .+338 ; 0xa9a <USB_Device_ProcessControlRequest+0x1a4>
948: 99 30 cpi r25, 0x09 ; 9
94a: 09 f4 brne .+2 ; 0x94e <USB_Device_ProcessControlRequest+0x58>
94c: b8 c0 rjmp .+368 ; 0xabe <USB_Device_ProcessControlRequest+0x1c8>
94e: 96 30 cpi r25, 0x06 ; 6
950: 09 f0 breq .+2 ; 0x954 <USB_Device_ProcessControlRequest+0x5e>
952: d0 c0 rjmp .+416 ; 0xaf4 <USB_Device_ProcessControlRequest+0x1fe>
954: 82 c0 rjmp .+260 ; 0xa5a <USB_Device_ProcessControlRequest+0x164>
{
case REQ_GetStatus:
if ((bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE)) ||
956: 80 38 cpi r24, 0x80 ; 128
958: 21 f0 breq .+8 ; 0x962 <USB_Device_ProcessControlRequest+0x6c>
95a: 82 38 cpi r24, 0x82 ; 130
95c: 09 f0 breq .+2 ; 0x960 <USB_Device_ProcessControlRequest+0x6a>
95e: ca c0 rjmp .+404 ; 0xaf4 <USB_Device_ProcessControlRequest+0x1fe>
960: 03 c0 rjmp .+6 ; 0x968 <USB_Device_ProcessControlRequest+0x72>
962: 90 91 70 01 lds r25, 0x0170
966: 11 c0 rjmp .+34 ; 0x98a <USB_Device_ProcessControlRequest+0x94>
#endif
break;
#endif
#if !defined(CONTROL_ONLY_DEVICE)
case (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_ENDPOINT):
Endpoint_SelectEndpoint((uint8_t)USB_ControlRequest.wIndex & ENDPOINT_EPNUM_MASK);
968: 80 91 77 01 lds r24, 0x0177
96c: 87 70 andi r24, 0x07 ; 7
*/
static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber) ATTR_ALWAYS_INLINE;
static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber)
{
#if !defined(CONTROL_ONLY_DEVICE)
UENUM = EndpointNumber;
96e: 80 93 e9 00 sts 0x00E9, r24
* \return Boolean true if the currently selected endpoint is stalled, false otherwise.
*/
static inline bool Endpoint_IsStalled(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline bool Endpoint_IsStalled(void)
{
return ((UECONX & (1 << STALLRQ)) ? true : false);
972: 80 91 eb 00 lds r24, 0x00EB
CurrentStatus = Endpoint_IsStalled();
976: 90 e0 ldi r25, 0x00 ; 0
978: 25 e0 ldi r18, 0x05 ; 5
97a: 96 95 lsr r25
97c: 87 95 ror r24
97e: 2a 95 dec r18
980: e1 f7 brne .-8 ; 0x97a <USB_Device_ProcessControlRequest+0x84>
982: 98 2f mov r25, r24
984: 91 70 andi r25, 0x01 ; 1
*/
static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber) ATTR_ALWAYS_INLINE;
static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber)
{
#if !defined(CONTROL_ONLY_DEVICE)
UENUM = EndpointNumber;
986: 10 92 e9 00 sts 0x00E9, r1
* \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);
98a: 80 91 e8 00 lds r24, 0x00E8
98e: 87 7f andi r24, 0xF7 ; 247
990: 80 93 e8 00 sts 0x00E8, r24
* \param[in] Word Next word to write to the currently selected endpoint's FIFO buffer.
*/
static inline void Endpoint_Write_Word_LE(const uint16_t Word) ATTR_ALWAYS_INLINE;
static inline void Endpoint_Write_Word_LE(const uint16_t Word)
{
UEDATX = (Word & 0xFF);
994: 90 93 f1 00 sts 0x00F1, r25
UEDATX = (Word >> 8);
998: 10 92 f1 00 sts 0x00F1, r1
99c: 89 c0 rjmp .+274 ; 0xab0 <USB_Device_ProcessControlRequest+0x1ba>
}
break;
case REQ_ClearFeature:
case REQ_SetFeature:
if ((bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_DEVICE)) ||
99e: 88 23 and r24, r24
9a0: 19 f0 breq .+6 ; 0x9a8 <USB_Device_ProcessControlRequest+0xb2>
9a2: 82 30 cpi r24, 0x02 ; 2
9a4: 09 f0 breq .+2 ; 0x9a8 <USB_Device_ProcessControlRequest+0xb2>
9a6: a6 c0 rjmp .+332 ; 0xaf4 <USB_Device_ProcessControlRequest+0x1fe>
Endpoint_ClearStatusStage();
}
static void USB_Device_ClearSetFeature(void)
{
switch (USB_ControlRequest.bmRequestType & CONTROL_REQTYPE_RECIPIENT)
9a8: 8f 71 andi r24, 0x1F ; 31
9aa: 82 30 cpi r24, 0x02 ; 2
9ac: 09 f0 breq .+2 ; 0x9b0 <USB_Device_ProcessControlRequest+0xba>
9ae: a2 c0 rjmp .+324 ; 0xaf4 <USB_Device_ProcessControlRequest+0x1fe>
break;
#endif
#if !defined(CONTROL_ONLY_DEVICE)
case REQREC_ENDPOINT:
if ((uint8_t)USB_ControlRequest.wValue == FEATURE_SEL_EndpointHalt)
9b0: 80 91 75 01 lds r24, 0x0175
9b4: 88 23 and r24, r24
9b6: 31 f5 brne .+76 ; 0xa04 <USB_Device_ProcessControlRequest+0x10e>
{
uint8_t EndpointIndex = ((uint8_t)USB_ControlRequest.wIndex & ENDPOINT_EPNUM_MASK);
9b8: 20 91 77 01 lds r18, 0x0177
9bc: 27 70 andi r18, 0x07 ; 7
if (EndpointIndex == ENDPOINT_CONTROLEP)
9be: 09 f4 brne .+2 ; 0x9c2 <USB_Device_ProcessControlRequest+0xcc>
9c0: 99 c0 rjmp .+306 ; 0xaf4 <USB_Device_ProcessControlRequest+0x1fe>
*/
static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber) ATTR_ALWAYS_INLINE;
static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber)
{
#if !defined(CONTROL_ONLY_DEVICE)
UENUM = EndpointNumber;
9c2: 20 93 e9 00 sts 0x00E9, r18
* \return Boolean True if the currently selected endpoint is enabled, false otherwise.
*/
static inline bool Endpoint_IsEnabled(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline bool Endpoint_IsEnabled(void)
{
return ((UECONX & (1 << EPEN)) ? true : false);
9c6: 80 91 eb 00 lds r24, 0x00EB
return;
Endpoint_SelectEndpoint(EndpointIndex);
if (Endpoint_IsEnabled())
9ca: 80 ff sbrs r24, 0
9cc: 1b c0 rjmp .+54 ; 0xa04 <USB_Device_ProcessControlRequest+0x10e>
{
if (USB_ControlRequest.bRequest == REQ_SetFeature)
9ce: 93 30 cpi r25, 0x03 ; 3
9d0: 21 f4 brne .+8 ; 0x9da <USB_Device_ProcessControlRequest+0xe4>
* \ingroup Group_EndpointPacketManagement
*/
static inline void Endpoint_StallTransaction(void) ATTR_ALWAYS_INLINE;
static inline void Endpoint_StallTransaction(void)
{
UECONX |= (1 << STALLRQ);
9d2: 80 91 eb 00 lds r24, 0x00EB
9d6: 80 62 ori r24, 0x20 ; 32
9d8: 13 c0 rjmp .+38 ; 0xa00 <USB_Device_ProcessControlRequest+0x10a>
* \ingroup Group_EndpointPacketManagement
*/
static inline void Endpoint_ClearStall(void) ATTR_ALWAYS_INLINE;
static inline void Endpoint_ClearStall(void)
{
UECONX |= (1 << STALLRQC);
9da: 80 91 eb 00 lds r24, 0x00EB
9de: 80 61 ori r24, 0x10 ; 16
9e0: 80 93 eb 00 sts 0x00EB, r24
* \param[in] EndpointNumber Endpoint number whose FIFO buffers are to be reset.
*/
static inline void Endpoint_ResetFIFO(const uint8_t EndpointNumber) ATTR_ALWAYS_INLINE;
static inline void Endpoint_ResetFIFO(const uint8_t EndpointNumber)
{
UERST = (1 << EndpointNumber);
9e4: 81 e0 ldi r24, 0x01 ; 1
9e6: 90 e0 ldi r25, 0x00 ; 0
9e8: 02 c0 rjmp .+4 ; 0x9ee <USB_Device_ProcessControlRequest+0xf8>
9ea: 88 0f add r24, r24
9ec: 99 1f adc r25, r25
9ee: 2a 95 dec r18
9f0: e2 f7 brpl .-8 ; 0x9ea <USB_Device_ProcessControlRequest+0xf4>
9f2: 80 93 ea 00 sts 0x00EA, r24
UERST = 0;
9f6: 10 92 ea 00 sts 0x00EA, 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)
{
UECONX |= (1 << RSTDT);
9fa: 80 91 eb 00 lds r24, 0x00EB
9fe: 88 60 ori r24, 0x08 ; 8
a00: 80 93 eb 00 sts 0x00EB, r24
*/
static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber) ATTR_ALWAYS_INLINE;
static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber)
{
#if !defined(CONTROL_ONLY_DEVICE)
UENUM = EndpointNumber;
a04: 10 92 e9 00 sts 0x00E9, r1
* \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);
a08: 80 91 e8 00 lds r24, 0x00E8
a0c: 87 7f andi r24, 0xF7 ; 247
a0e: 53 c0 rjmp .+166 ; 0xab6 <USB_Device_ProcessControlRequest+0x1c0>
USB_Device_ClearSetFeature();
}
break;
case REQ_SetAddress:
if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_DEVICE))
a10: 88 23 and r24, r24
a12: 09 f0 breq .+2 ; 0xa16 <USB_Device_ProcessControlRequest+0x120>
a14: 6f c0 rjmp .+222 ; 0xaf4 <USB_Device_ProcessControlRequest+0x1fe>
}
}
static void USB_Device_SetAddress(void)
{
uint8_t DeviceAddress = (USB_ControlRequest.wValue & 0x7F);
a16: 10 91 75 01 lds r17, 0x0175
a1a: 1f 77 andi r17, 0x7F ; 127
ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
a1c: 0f b7 in r16, 0x3f ; 63
return 1;
}
static __inline__ uint8_t __iCliRetVal(void)
{
cli();
a1e: f8 94 cli
a20: 80 91 e8 00 lds r24, 0x00E8
a24: 87 7f andi r24, 0xF7 ; 247
a26: 80 93 e8 00 sts 0x00E8, r24
{
Endpoint_ClearSETUP();
Endpoint_ClearStatusStage();
a2a: 2b de rcall .-938 ; 0x682 <Endpoint_ClearStatusStage>
* \return Boolean true if the current endpoint is ready for an IN packet, 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);
a2c: 80 91 e8 00 lds r24, 0x00E8
while (!(Endpoint_IsINReady()));
a30: 80 ff sbrs r24, 0
a32: fc cf rjmp .-8 ; 0xa2c <USB_Device_ProcessControlRequest+0x136>
USB_DeviceState = (DeviceAddress) ? DEVICE_STATE_Addressed : DEVICE_STATE_Default;
a34: 11 23 and r17, r17
a36: 11 f4 brne .+4 ; 0xa3c <USB_Device_ProcessControlRequest+0x146>
a38: 82 e0 ldi r24, 0x02 ; 2
a3a: 01 c0 rjmp .+2 ; 0xa3e <USB_Device_ProcessControlRequest+0x148>
a3c: 83 e0 ldi r24, 0x03 ; 3
a3e: 8e bb out 0x1e, r24 ; 30
#endif
static inline void USB_Device_SetDeviceAddress(const uint8_t Address) ATTR_ALWAYS_INLINE;
static inline void USB_Device_SetDeviceAddress(const uint8_t Address)
{
UDADDR = ((UDADDR & (1 << ADDEN)) | (Address & 0x7F));
a40: 80 91 e3 00 lds r24, 0x00E3
a44: 80 78 andi r24, 0x80 ; 128
a46: 18 2b or r17, r24
a48: 10 93 e3 00 sts 0x00E3, r17
UDADDR |= (1 << ADDEN);
a4c: 80 91 e3 00 lds r24, 0x00E3
a50: 80 68 ori r24, 0x80 ; 128
a52: 80 93 e3 00 sts 0x00E3, r24
(void)__s;
}
static __inline__ void __iRestore(const uint8_t *__s)
{
SREG = *__s;
a56: 0f bf out 0x3f, r16 ; 63
__asm__ volatile ("" ::: "memory");
a58: 4d c0 rjmp .+154 ; 0xaf4 <USB_Device_ProcessControlRequest+0x1fe>
if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_DEVICE))
USB_Device_SetAddress();
break;
case REQ_GetDescriptor:
if ((bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE)) ||
a5a: 80 58 subi r24, 0x80 ; 128
a5c: 82 30 cpi r24, 0x02 ; 2
a5e: 08 f0 brcs .+2 ; 0xa62 <USB_Device_ProcessControlRequest+0x16c>
a60: 49 c0 rjmp .+146 ; 0xaf4 <USB_Device_ProcessControlRequest+0x1fe>
USB_Device_GetInternalSerialDescriptor();
return;
}
#endif
if ((DescriptorSize = CALLBACK_USB_GetDescriptor(USB_ControlRequest.wValue, USB_ControlRequest.wIndex,
a62: 80 91 75 01 lds r24, 0x0175
a66: 90 91 76 01 lds r25, 0x0176
a6a: 60 91 77 01 lds r22, 0x0177
a6e: ae 01 movw r20, r28
a70: 4f 5f subi r20, 0xFF ; 255
a72: 5f 4f sbci r21, 0xFF ; 255
a74: 99 db rcall .-2254 ; 0x1a8 <CALLBACK_USB_GetDescriptor>
a76: bc 01 movw r22, r24
a78: 00 97 sbiw r24, 0x00 ; 0
a7a: 09 f4 brne .+2 ; 0xa7e <USB_Device_ProcessControlRequest+0x188>
a7c: 3b c0 rjmp .+118 ; 0xaf4 <USB_Device_ProcessControlRequest+0x1fe>
* \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);
a7e: 80 91 e8 00 lds r24, 0x00E8
a82: 87 7f andi r24, 0xF7 ; 247
a84: 80 93 e8 00 sts 0x00E8, r24
#if defined(USE_RAM_DESCRIPTORS)
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);
a88: 89 81 ldd r24, Y+1 ; 0x01
a8a: 9a 81 ldd r25, Y+2 ; 0x02
a8c: 49 d0 rcall .+146 ; 0xb20 <Endpoint_Write_Control_PStream_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));
a8e: 80 91 e8 00 lds r24, 0x00E8
a92: 8b 77 andi r24, 0x7B ; 123
a94: 80 93 e8 00 sts 0x00E8, r24
a98: 2d c0 rjmp .+90 ; 0xaf4 <USB_Device_ProcessControlRequest+0x1fe>
USB_Device_GetDescriptor();
}
break;
case REQ_GetConfiguration:
if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE))
a9a: 80 38 cpi r24, 0x80 ; 128
a9c: 59 f5 brne .+86 ; 0xaf4 <USB_Device_ProcessControlRequest+0x1fe>
* \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);
a9e: 80 91 e8 00 lds r24, 0x00E8
aa2: 87 7f andi r24, 0xF7 ; 247
aa4: 80 93 e8 00 sts 0x00E8, r24
static void USB_Device_GetConfiguration(void)
{
Endpoint_ClearSETUP();
Endpoint_Write_Byte(USB_ConfigurationNumber);
aa8: 80 91 71 01 lds r24, 0x0171
* \param[in] Byte Next byte to write into the the currently selected endpoint's FIFO buffer.
*/
static inline void Endpoint_Write_Byte(const uint8_t Byte) ATTR_ALWAYS_INLINE;
static inline void Endpoint_Write_Byte(const uint8_t Byte)
{
UEDATX = Byte;
aac: 80 93 f1 00 sts 0x00F1, r24
*/
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));
ab0: 80 91 e8 00 lds r24, 0x00E8
ab4: 8e 77 andi r24, 0x7E ; 126
ab6: 80 93 e8 00 sts 0x00E8, r24
Endpoint_ClearIN();
Endpoint_ClearStatusStage();
aba: e3 dd rcall .-1082 ; 0x682 <Endpoint_ClearStatusStage>
abc: 1b c0 rjmp .+54 ; 0xaf4 <USB_Device_ProcessControlRequest+0x1fe>
if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE))
USB_Device_GetConfiguration();
break;
case REQ_SetConfiguration:
if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_DEVICE))
abe: 88 23 and r24, r24
ac0: c9 f4 brne .+50 ; 0xaf4 <USB_Device_ProcessControlRequest+0x1fe>
}
static void USB_Device_SetConfiguration(void)
{
#if defined(FIXED_NUM_CONFIGURATIONS)
if ((uint8_t)USB_ControlRequest.wValue > FIXED_NUM_CONFIGURATIONS)
ac2: 90 91 75 01 lds r25, 0x0175
ac6: 92 30 cpi r25, 0x02 ; 2
ac8: a8 f4 brcc .+42 ; 0xaf4 <USB_Device_ProcessControlRequest+0x1fe>
* \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);
aca: 80 91 e8 00 lds r24, 0x00E8
ace: 87 7f andi r24, 0xF7 ; 247
ad0: 80 93 e8 00 sts 0x00E8, r24
}
#endif
Endpoint_ClearSETUP();
USB_ConfigurationNumber = (uint8_t)USB_ControlRequest.wValue;
ad4: 90 93 71 01 sts 0x0171, r25
Endpoint_ClearStatusStage();
ad8: d4 dd rcall .-1112 ; 0x682 <Endpoint_ClearStatusStage>
if (USB_ConfigurationNumber)
ada: 80 91 71 01 lds r24, 0x0171
ade: 88 23 and r24, r24
ae0: 31 f4 brne .+12 ; 0xaee <USB_Device_ProcessControlRequest+0x1f8>
}
static inline bool USB_Device_IsAddressSet(void) ATTR_ALWAYS_INLINE;
static inline bool USB_Device_IsAddressSet(void)
{
return (UDADDR & (1 << ADDEN));
ae2: 80 91 e3 00 lds r24, 0x00E3
USB_DeviceState = DEVICE_STATE_Configured;
else
USB_DeviceState = (USB_Device_IsAddressSet()) ? DEVICE_STATE_Configured : DEVICE_STATE_Powered;
ae6: 87 fd sbrc r24, 7
ae8: 02 c0 rjmp .+4 ; 0xaee <USB_Device_ProcessControlRequest+0x1f8>
aea: 81 e0 ldi r24, 0x01 ; 1
aec: 01 c0 rjmp .+2 ; 0xaf0 <USB_Device_ProcessControlRequest+0x1fa>
aee: 84 e0 ldi r24, 0x04 ; 4
af0: 8e bb out 0x1e, r24 ; 30
EVENT_USB_Device_ConfigurationChanged();
af2: 44 db rcall .-2424 ; 0x17c <EVENT_USB_Device_ConfigurationChanged>
* \return Boolean true if the selected endpoint has received a SETUP packet, false otherwise.
*/
static inline bool Endpoint_IsSETUPReceived(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline bool Endpoint_IsSETUPReceived(void)
{
return ((UEINTX & (1 << RXSTPI)) ? true : false);
af4: 80 91 e8 00 lds r24, 0x00E8
break;
}
}
if (Endpoint_IsSETUPReceived())
af8: 83 ff sbrs r24, 3
afa: 0a c0 rjmp .+20 ; 0xb10 <USB_Device_ProcessControlRequest+0x21a>
* \ingroup Group_EndpointPacketManagement
*/
static inline void Endpoint_StallTransaction(void) ATTR_ALWAYS_INLINE;
static inline void Endpoint_StallTransaction(void)
{
UECONX |= (1 << STALLRQ);
afc: 80 91 eb 00 lds r24, 0x00EB
b00: 80 62 ori r24, 0x20 ; 32
b02: 80 93 eb 00 sts 0x00EB, r24
* \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);
b06: 80 91 e8 00 lds r24, 0x00E8
b0a: 87 7f andi r24, 0xF7 ; 247
b0c: 80 93 e8 00 sts 0x00E8, r24
{
Endpoint_StallTransaction();
Endpoint_ClearSETUP();
}
}
b10: 0f 90 pop r0
b12: 0f 90 pop r0
b14: cf 91 pop r28
b16: df 91 pop r29
b18: 1f 91 pop r17
b1a: 0f 91 pop r16
b1c: 08 95 ret
00000b1e <USB_Event_Stub>:
#include "Events.h"
void USB_Event_Stub(void)
{
}
b1e: 08 95 ret
00000b20 <Endpoint_Write_Control_PStream_LE>:
uint8_t TEMPLATE_FUNC_NAME (const void* Buffer,
uint16_t Length)
{
b20: 9c 01 movw r18, r24
uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length));
bool LastPacketFull = false;
if (Length > USB_ControlRequest.wLength)
b22: 40 91 79 01 lds r20, 0x0179
b26: 50 91 7a 01 lds r21, 0x017A
b2a: 46 17 cp r20, r22
b2c: 57 07 cpc r21, r23
b2e: 10 f4 brcc .+4 ; 0xb34 <Endpoint_Write_Control_PStream_LE+0x14>
uint8_t TEMPLATE_FUNC_NAME (const void* Buffer,
uint16_t Length)
{
uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length));
b30: 60 e0 ldi r22, 0x00 ; 0
b32: 3e c0 rjmp .+124 ; 0xbb0 <Endpoint_Write_Control_PStream_LE+0x90>
bool LastPacketFull = false;
if (Length > USB_ControlRequest.wLength)
Length = USB_ControlRequest.wLength;
else if (!(Length))
b34: 61 15 cp r22, r1
b36: 71 05 cpc r23, r1
b38: 11 f0 breq .+4 ; 0xb3e <Endpoint_Write_Control_PStream_LE+0x1e>
b3a: ab 01 movw r20, r22
b3c: f9 cf rjmp .-14 ; 0xb30 <Endpoint_Write_Control_PStream_LE+0x10>
*/
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));
b3e: 80 91 e8 00 lds r24, 0x00E8
b42: 8e 77 andi r24, 0x7E ; 126
b44: 80 93 e8 00 sts 0x00E8, r24
b48: 40 e0 ldi r20, 0x00 ; 0
b4a: 50 e0 ldi r21, 0x00 ; 0
b4c: f1 cf rjmp .-30 ; 0xb30 <Endpoint_Write_Control_PStream_LE+0x10>
Endpoint_ClearIN();
while (Length || LastPacketFull)
{
uint8_t USB_DeviceState_LCL = USB_DeviceState;
b4e: 8e b3 in r24, 0x1e ; 30
if (USB_DeviceState_LCL == DEVICE_STATE_Unattached)
b50: 88 23 and r24, r24
b52: 09 f4 brne .+2 ; 0xb56 <Endpoint_Write_Control_PStream_LE+0x36>
b54: 3e c0 rjmp .+124 ; 0xbd2 <Endpoint_Write_Control_PStream_LE+0xb2>
return ENDPOINT_RWCSTREAM_DeviceDisconnected;
else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended)
b56: 85 30 cpi r24, 0x05 ; 5
b58: 09 f4 brne .+2 ; 0xb5c <Endpoint_Write_Control_PStream_LE+0x3c>
b5a: 3d c0 rjmp .+122 ; 0xbd6 <Endpoint_Write_Control_PStream_LE+0xb6>
* \return Boolean true if the selected endpoint has received a SETUP packet, false otherwise.
*/
static inline bool Endpoint_IsSETUPReceived(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline bool Endpoint_IsSETUPReceived(void)
{
return ((UEINTX & (1 << RXSTPI)) ? true : false);
b5c: 80 91 e8 00 lds r24, 0x00E8
return ENDPOINT_RWCSTREAM_BusSuspended;
else if (Endpoint_IsSETUPReceived())
b60: 83 ff sbrs r24, 3
b62: 02 c0 rjmp .+4 ; 0xb68 <Endpoint_Write_Control_PStream_LE+0x48>
b64: 81 e0 ldi r24, 0x01 ; 1
b66: 08 95 ret
* \return Boolean true if current endpoint is has received an OUT packet, false otherwise.
*/
static inline bool Endpoint_IsOUTReceived(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline bool Endpoint_IsOUTReceived(void)
{
return ((UEINTX & (1 << RXOUTI)) ? true : false);
b68: 80 91 e8 00 lds r24, 0x00E8
return ENDPOINT_RWCSTREAM_HostAborted;
else if (Endpoint_IsOUTReceived())
b6c: 82 fd sbrc r24, 2
b6e: 2b c0 rjmp .+86 ; 0xbc6 <Endpoint_Write_Control_PStream_LE+0xa6>
* \return Boolean true if the current endpoint is ready for an IN packet, 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);
b70: 80 91 e8 00 lds r24, 0x00E8
break;
if (Endpoint_IsINReady())
b74: 80 ff sbrs r24, 0
b76: 1c c0 rjmp .+56 ; 0xbb0 <Endpoint_Write_Control_PStream_LE+0x90>
#if defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)
return UEBCX;
#elif defined(USB_SERIES_4_AVR)
return (((uint16_t)UEBCHX << 8) | UEBCLX);
#elif defined(USB_SERIES_2_AVR)
return UEBCLX;
b78: 80 91 f2 00 lds r24, 0x00F2
b7c: 90 e0 ldi r25, 0x00 ; 0
b7e: 09 c0 rjmp .+18 ; 0xb92 <Endpoint_Write_Control_PStream_LE+0x72>
{
uint16_t BytesInEndpoint = Endpoint_BytesInEndpoint();
while (Length && (BytesInEndpoint < USB_ControlEndpointSize))
b80: f9 01 movw r30, r18
{
TEMPLATE_TRANSFER_BYTE(DataStream);
b82: 2f 5f subi r18, 0xFF ; 255
b84: 3f 4f sbci r19, 0xFF ; 255
b86: e4 91 lpm r30, Z+
* \param[in] Byte Next byte to write into the the currently selected endpoint's FIFO buffer.
*/
static inline void Endpoint_Write_Byte(const uint8_t Byte) ATTR_ALWAYS_INLINE;
static inline void Endpoint_Write_Byte(const uint8_t Byte)
{
UEDATX = Byte;
b88: e0 93 f1 00 sts 0x00F1, r30
Length--;
b8c: 41 50 subi r20, 0x01 ; 1
b8e: 50 40 sbci r21, 0x00 ; 0
BytesInEndpoint++;
b90: 01 96 adiw r24, 0x01 ; 1
if (Endpoint_IsINReady())
{
uint16_t BytesInEndpoint = Endpoint_BytesInEndpoint();
while (Length && (BytesInEndpoint < USB_ControlEndpointSize))
b92: 41 15 cp r20, r1
b94: 51 05 cpc r21, r1
b96: 19 f0 breq .+6 ; 0xb9e <Endpoint_Write_Control_PStream_LE+0x7e>
b98: 88 30 cpi r24, 0x08 ; 8
b9a: 91 05 cpc r25, r1
b9c: 88 f3 brcs .-30 ; 0xb80 <Endpoint_Write_Control_PStream_LE+0x60>
TEMPLATE_TRANSFER_BYTE(DataStream);
Length--;
BytesInEndpoint++;
}
LastPacketFull = (BytesInEndpoint == USB_ControlEndpointSize);
b9e: 60 e0 ldi r22, 0x00 ; 0
ba0: 08 97 sbiw r24, 0x08 ; 8
ba2: 09 f4 brne .+2 ; 0xba6 <Endpoint_Write_Control_PStream_LE+0x86>
ba4: 61 e0 ldi r22, 0x01 ; 1
*/
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));
ba6: 80 91 e8 00 lds r24, 0x00E8
baa: 8e 77 andi r24, 0x7E ; 126
bac: 80 93 e8 00 sts 0x00E8, r24
if (Length > USB_ControlRequest.wLength)
Length = USB_ControlRequest.wLength;
else if (!(Length))
Endpoint_ClearIN();
while (Length || LastPacketFull)
bb0: 41 15 cp r20, r1
bb2: 51 05 cpc r21, r1
bb4: 61 f6 brne .-104 ; 0xb4e <Endpoint_Write_Control_PStream_LE+0x2e>
bb6: 66 23 and r22, r22
bb8: 51 f6 brne .-108 ; 0xb4e <Endpoint_Write_Control_PStream_LE+0x2e>
bba: 05 c0 rjmp .+10 ; 0xbc6 <Endpoint_Write_Control_PStream_LE+0xa6>
}
}
while (!(Endpoint_IsOUTReceived()))
{
uint8_t USB_DeviceState_LCL = USB_DeviceState;
bbc: 8e b3 in r24, 0x1e ; 30
if (USB_DeviceState_LCL == DEVICE_STATE_Unattached)
bbe: 88 23 and r24, r24
bc0: 41 f0 breq .+16 ; 0xbd2 <Endpoint_Write_Control_PStream_LE+0xb2>
return ENDPOINT_RWCSTREAM_DeviceDisconnected;
else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended)
bc2: 85 30 cpi r24, 0x05 ; 5
bc4: 41 f0 breq .+16 ; 0xbd6 <Endpoint_Write_Control_PStream_LE+0xb6>
* \return Boolean true if current endpoint is has received an OUT packet, false otherwise.
*/
static inline bool Endpoint_IsOUTReceived(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline bool Endpoint_IsOUTReceived(void)
{
return ((UEINTX & (1 << RXOUTI)) ? true : false);
bc6: 80 91 e8 00 lds r24, 0x00E8
LastPacketFull = (BytesInEndpoint == USB_ControlEndpointSize);
Endpoint_ClearIN();
}
}
while (!(Endpoint_IsOUTReceived()))
bca: 82 ff sbrs r24, 2
bcc: f7 cf rjmp .-18 ; 0xbbc <Endpoint_Write_Control_PStream_LE+0x9c>
bce: 80 e0 ldi r24, 0x00 ; 0
bd0: 08 95 ret
bd2: 82 e0 ldi r24, 0x02 ; 2
bd4: 08 95 ret
bd6: 83 e0 ldi r24, 0x03 ; 3
else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended)
return ENDPOINT_RWCSTREAM_BusSuspended;
}
return ENDPOINT_RWCSTREAM_NoError;
}
bd8: 08 95 ret
00000bda <Endpoint_Read_Stream_LE>:
uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE Buffer,
uint16_t Length
__CALLBACK_PARAM)
{
bda: df 92 push r13
bdc: ef 92 push r14
bde: ff 92 push r15
be0: 0f 93 push r16
be2: 1f 93 push r17
be4: cf 93 push r28
be6: df 93 push r29
be8: 18 2f mov r17, r24
bea: 09 2f mov r16, r25
bec: eb 01 movw r28, r22
bee: 7a 01 movw r14, r20
uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length));
uint8_t ErrorCode;
if ((ErrorCode = Endpoint_WaitUntilReady()))
bf0: 67 dd rcall .-1330 ; 0x6c0 <Endpoint_WaitUntilReady>
bf2: d8 2e mov r13, r24
bf4: 88 23 and r24, r24
bf6: 19 f5 brne .+70 ; 0xc3e <Endpoint_Read_Stream_LE+0x64>
uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE Buffer,
uint16_t Length
__CALLBACK_PARAM)
{
uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length));
bf8: 81 2f mov r24, r17
bfa: 90 2f mov r25, r16
bfc: 9c 01 movw r18, r24
bfe: 89 01 movw r16, r18
c00: 1c c0 rjmp .+56 ; 0xc3a <Endpoint_Read_Stream_LE+0x60>
* \return Boolean true if the currently selected endpoint may be read from or written to, depending on its direction.
*/
static inline bool Endpoint_IsReadWriteAllowed(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline bool Endpoint_IsReadWriteAllowed(void)
{
return ((UEINTX & (1 << RWAL)) ? true : false);
c02: 80 91 e8 00 lds r24, 0x00E8
}
#endif
while (Length)
{
if (!(Endpoint_IsReadWriteAllowed()))
c06: 85 fd sbrc r24, 5
c08: 12 c0 rjmp .+36 ; 0xc2e <Endpoint_Read_Stream_LE+0x54>
*/
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));
c0a: 80 91 e8 00 lds r24, 0x00E8
c0e: 8b 77 andi r24, 0x7B ; 123
c10: 80 93 e8 00 sts 0x00E8, r24
{
TEMPLATE_CLEAR_ENDPOINT();
#if !defined(NO_STREAM_CALLBACKS)
if ((Callback != NULL) && (Callback() == STREAMCALLBACK_Abort))
c14: e1 14 cp r14, r1
c16: f1 04 cpc r15, r1
c18: 31 f0 breq .+12 ; 0xc26 <Endpoint_Read_Stream_LE+0x4c>
c1a: f7 01 movw r30, r14
c1c: 09 95 icall
c1e: 81 30 cpi r24, 0x01 ; 1
c20: 11 f4 brne .+4 ; 0xc26 <Endpoint_Read_Stream_LE+0x4c>
c22: 85 e0 ldi r24, 0x05 ; 5
c24: 0d c0 rjmp .+26 ; 0xc40 <Endpoint_Read_Stream_LE+0x66>
return ENDPOINT_RWSTREAM_CallbackAborted;
#endif
if ((ErrorCode = Endpoint_WaitUntilReady()))
c26: 4c dd rcall .-1384 ; 0x6c0 <Endpoint_WaitUntilReady>
c28: 88 23 and r24, r24
c2a: 39 f0 breq .+14 ; 0xc3a <Endpoint_Read_Stream_LE+0x60>
c2c: 09 c0 rjmp .+18 ; 0xc40 <Endpoint_Read_Stream_LE+0x66>
* \return Next byte in the currently selected endpoint's FIFO buffer.
*/
static inline uint8_t Endpoint_Read_Byte(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint8_t Endpoint_Read_Byte(void)
{
return UEDATX;
c2e: 80 91 f1 00 lds r24, 0x00F1
return ErrorCode;
}
else
{
TEMPLATE_TRANSFER_BYTE(DataStream);
c32: f8 01 movw r30, r16
c34: 81 93 st Z+, r24
c36: 8f 01 movw r16, r30
Length--;
c38: 21 97 sbiw r28, 0x01 ; 1
} while (Length >= 8);
}
}
#endif
while (Length)
c3a: 20 97 sbiw r28, 0x00 ; 0
c3c: 11 f7 brne .-60 ; 0xc02 <Endpoint_Read_Stream_LE+0x28>
c3e: 8d 2d mov r24, r13
Length--;
}
}
return ENDPOINT_RWSTREAM_NoError;
}
c40: df 91 pop r29
c42: cf 91 pop r28
c44: 1f 91 pop r17
c46: 0f 91 pop r16
c48: ff 90 pop r15
c4a: ef 90 pop r14
c4c: df 90 pop r13
c4e: 08 95 ret
00000c50 <Endpoint_Write_Stream_BE>:
uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE Buffer,
uint16_t Length
__CALLBACK_PARAM)
{
c50: df 92 push r13
c52: ef 92 push r14
c54: ff 92 push r15
c56: 0f 93 push r16
c58: 1f 93 push r17
c5a: cf 93 push r28
c5c: df 93 push r29
c5e: 8c 01 movw r16, r24
c60: eb 01 movw r28, r22
c62: 7a 01 movw r14, r20
uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length));
uint8_t ErrorCode;
if ((ErrorCode = Endpoint_WaitUntilReady()))
c64: 2d dd rcall .-1446 ; 0x6c0 <Endpoint_WaitUntilReady>
c66: d8 2e mov r13, r24
c68: 88 23 and r24, r24
c6a: 21 f5 brne .+72 ; 0xcb4 <Endpoint_Write_Stream_BE+0x64>
uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE Buffer,
uint16_t Length
__CALLBACK_PARAM)
{
uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length));
c6c: 21 97 sbiw r28, 0x01 ; 1
c6e: 0c 0f add r16, r28
c70: 1d 1f adc r17, r29
c72: 21 96 adiw r28, 0x01 ; 1
c74: 1d c0 rjmp .+58 ; 0xcb0 <Endpoint_Write_Stream_BE+0x60>
* \return Boolean true if the currently selected endpoint may be read from or written to, depending on its direction.
*/
static inline bool Endpoint_IsReadWriteAllowed(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline bool Endpoint_IsReadWriteAllowed(void)
{
return ((UEINTX & (1 << RWAL)) ? true : false);
c76: 80 91 e8 00 lds r24, 0x00E8
}
#endif
while (Length)
{
if (!(Endpoint_IsReadWriteAllowed()))
c7a: 85 fd sbrc r24, 5
c7c: 12 c0 rjmp .+36 ; 0xca2 <Endpoint_Write_Stream_BE+0x52>
*/
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));
c7e: 80 91 e8 00 lds r24, 0x00E8
c82: 8e 77 andi r24, 0x7E ; 126
c84: 80 93 e8 00 sts 0x00E8, r24
{
TEMPLATE_CLEAR_ENDPOINT();
#if !defined(NO_STREAM_CALLBACKS)
if ((Callback != NULL) && (Callback() == STREAMCALLBACK_Abort))
c88: e1 14 cp r14, r1
c8a: f1 04 cpc r15, r1
c8c: 31 f0 breq .+12 ; 0xc9a <Endpoint_Write_Stream_BE+0x4a>
c8e: f7 01 movw r30, r14
c90: 09 95 icall
c92: 81 30 cpi r24, 0x01 ; 1
c94: 11 f4 brne .+4 ; 0xc9a <Endpoint_Write_Stream_BE+0x4a>
c96: 85 e0 ldi r24, 0x05 ; 5
c98: 0e c0 rjmp .+28 ; 0xcb6 <Endpoint_Write_Stream_BE+0x66>
return ENDPOINT_RWSTREAM_CallbackAborted;
#endif
if ((ErrorCode = Endpoint_WaitUntilReady()))
c9a: 12 dd rcall .-1500 ; 0x6c0 <Endpoint_WaitUntilReady>
c9c: 88 23 and r24, r24
c9e: 41 f0 breq .+16 ; 0xcb0 <Endpoint_Write_Stream_BE+0x60>
ca0: 0a c0 rjmp .+20 ; 0xcb6 <Endpoint_Write_Stream_BE+0x66>
return ErrorCode;
}
else
{
TEMPLATE_TRANSFER_BYTE(DataStream);
ca2: f8 01 movw r30, r16
ca4: 80 81 ld r24, Z
ca6: 01 50 subi r16, 0x01 ; 1
ca8: 10 40 sbci r17, 0x00 ; 0
* \param[in] Byte Next byte to write into the the currently selected endpoint's FIFO buffer.
*/
static inline void Endpoint_Write_Byte(const uint8_t Byte) ATTR_ALWAYS_INLINE;
static inline void Endpoint_Write_Byte(const uint8_t Byte)
{
UEDATX = Byte;
caa: 80 93 f1 00 sts 0x00F1, r24
Length--;
cae: 21 97 sbiw r28, 0x01 ; 1
} while (Length >= 8);
}
}
#endif
while (Length)
cb0: 20 97 sbiw r28, 0x00 ; 0
cb2: 09 f7 brne .-62 ; 0xc76 <Endpoint_Write_Stream_BE+0x26>
cb4: 8d 2d mov r24, r13
Length--;
}
}
return ENDPOINT_RWSTREAM_NoError;
}
cb6: df 91 pop r29
cb8: cf 91 pop r28
cba: 1f 91 pop r17
cbc: 0f 91 pop r16
cbe: ff 90 pop r15
cc0: ef 90 pop r14
cc2: df 90 pop r13
cc4: 08 95 ret
00000cc6 <Endpoint_Write_Stream_LE>:
uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE Buffer,
uint16_t Length
__CALLBACK_PARAM)
{
cc6: df 92 push r13
cc8: ef 92 push r14
cca: ff 92 push r15
ccc: 0f 93 push r16
cce: 1f 93 push r17
cd0: cf 93 push r28
cd2: df 93 push r29
cd4: 18 2f mov r17, r24
cd6: 09 2f mov r16, r25
cd8: eb 01 movw r28, r22
cda: 7a 01 movw r14, r20
uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length));
uint8_t ErrorCode;
if ((ErrorCode = Endpoint_WaitUntilReady()))
cdc: f1 dc rcall .-1566 ; 0x6c0 <Endpoint_WaitUntilReady>
cde: d8 2e mov r13, r24
ce0: 88 23 and r24, r24
ce2: 19 f5 brne .+70 ; 0xd2a <Endpoint_Write_Stream_LE+0x64>
uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE Buffer,
uint16_t Length
__CALLBACK_PARAM)
{
uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length));
ce4: 81 2f mov r24, r17
ce6: 90 2f mov r25, r16
ce8: 9c 01 movw r18, r24
cea: 89 01 movw r16, r18
cec: 1c c0 rjmp .+56 ; 0xd26 <Endpoint_Write_Stream_LE+0x60>
* \return Boolean true if the currently selected endpoint may be read from or written to, depending on its direction.
*/
static inline bool Endpoint_IsReadWriteAllowed(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline bool Endpoint_IsReadWriteAllowed(void)
{
return ((UEINTX & (1 << RWAL)) ? true : false);
cee: 80 91 e8 00 lds r24, 0x00E8
}
#endif
while (Length)
{
if (!(Endpoint_IsReadWriteAllowed()))
cf2: 85 fd sbrc r24, 5
cf4: 12 c0 rjmp .+36 ; 0xd1a <Endpoint_Write_Stream_LE+0x54>
*/
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));
cf6: 80 91 e8 00 lds r24, 0x00E8
cfa: 8e 77 andi r24, 0x7E ; 126
cfc: 80 93 e8 00 sts 0x00E8, r24
{
TEMPLATE_CLEAR_ENDPOINT();
#if !defined(NO_STREAM_CALLBACKS)
if ((Callback != NULL) && (Callback() == STREAMCALLBACK_Abort))
d00: e1 14 cp r14, r1
d02: f1 04 cpc r15, r1
d04: 31 f0 breq .+12 ; 0xd12 <Endpoint_Write_Stream_LE+0x4c>
d06: f7 01 movw r30, r14
d08: 09 95 icall
d0a: 81 30 cpi r24, 0x01 ; 1
d0c: 11 f4 brne .+4 ; 0xd12 <Endpoint_Write_Stream_LE+0x4c>
d0e: 85 e0 ldi r24, 0x05 ; 5
d10: 0d c0 rjmp .+26 ; 0xd2c <Endpoint_Write_Stream_LE+0x66>
return ENDPOINT_RWSTREAM_CallbackAborted;
#endif
if ((ErrorCode = Endpoint_WaitUntilReady()))
d12: d6 dc rcall .-1620 ; 0x6c0 <Endpoint_WaitUntilReady>
d14: 88 23 and r24, r24
d16: 39 f0 breq .+14 ; 0xd26 <Endpoint_Write_Stream_LE+0x60>
d18: 09 c0 rjmp .+18 ; 0xd2c <Endpoint_Write_Stream_LE+0x66>
return ErrorCode;
}
else
{
TEMPLATE_TRANSFER_BYTE(DataStream);
d1a: f8 01 movw r30, r16
d1c: 81 91 ld r24, Z+
d1e: 8f 01 movw r16, r30
* \param[in] Byte Next byte to write into the the currently selected endpoint's FIFO buffer.
*/
static inline void Endpoint_Write_Byte(const uint8_t Byte) ATTR_ALWAYS_INLINE;
static inline void Endpoint_Write_Byte(const uint8_t Byte)
{
UEDATX = Byte;
d20: 80 93 f1 00 sts 0x00F1, r24
Length--;
d24: 21 97 sbiw r28, 0x01 ; 1
} while (Length >= 8);
}
}
#endif
while (Length)
d26: 20 97 sbiw r28, 0x00 ; 0
d28: 11 f7 brne .-60 ; 0xcee <Endpoint_Write_Stream_LE+0x28>
d2a: 8d 2d mov r24, r13
Length--;
}
}
return ENDPOINT_RWSTREAM_NoError;
}
d2c: df 91 pop r29
d2e: cf 91 pop r28
d30: 1f 91 pop r17
d32: 0f 91 pop r16
d34: ff 90 pop r15
d36: ef 90 pop r14
d38: df 90 pop r13
d3a: 08 95 ret
00000d3c <USB_USBTask>:
#if defined(USB_CAN_BE_DEVICE) && !defined(DEVICE_STATE_AS_GPIOR)
volatile uint8_t USB_DeviceState;
#endif
void USB_USBTask(void)
{
d3c: 1f 93 push r17
}
#if defined(USB_CAN_BE_DEVICE)
static void USB_DeviceTask(void)
{
if (USB_DeviceState != DEVICE_STATE_Unattached)
d3e: 8e b3 in r24, 0x1e ; 30
d40: 88 23 and r24, r24
d42: 61 f0 breq .+24 ; 0xd5c <USB_USBTask+0x20>
*/
static inline uint8_t Endpoint_GetCurrentEndpoint(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint8_t Endpoint_GetCurrentEndpoint(void)
{
#if !defined(CONTROL_ONLY_DEVICE)
return (UENUM & ENDPOINT_EPNUM_MASK);
d44: 10 91 e9 00 lds r17, 0x00E9
*/
static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber) ATTR_ALWAYS_INLINE;
static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber)
{
#if !defined(CONTROL_ONLY_DEVICE)
UENUM = EndpointNumber;
d48: 10 92 e9 00 sts 0x00E9, r1
* \return Boolean true if the selected endpoint has received a SETUP packet, false otherwise.
*/
static inline bool Endpoint_IsSETUPReceived(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline bool Endpoint_IsSETUPReceived(void)
{
return ((UEINTX & (1 << RXSTPI)) ? true : false);
d4c: 80 91 e8 00 lds r24, 0x00E8
{
uint8_t PrevEndpoint = Endpoint_GetCurrentEndpoint();
Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP);
if (Endpoint_IsSETUPReceived())
d50: 83 ff sbrs r24, 3
d52: 01 c0 rjmp .+2 ; 0xd56 <USB_USBTask+0x1a>
USB_Device_ProcessControlRequest();
d54: d0 dd rcall .-1120 ; 0x8f6 <USB_Device_ProcessControlRequest>
*/
static inline uint8_t Endpoint_GetCurrentEndpoint(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint8_t Endpoint_GetCurrentEndpoint(void)
{
#if !defined(CONTROL_ONLY_DEVICE)
return (UENUM & ENDPOINT_EPNUM_MASK);
d56: 17 70 andi r17, 0x07 ; 7
*/
static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber) ATTR_ALWAYS_INLINE;
static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber)
{
#if !defined(CONTROL_ONLY_DEVICE)
UENUM = EndpointNumber;
d58: 10 93 e9 00 sts 0x00E9, r17
if (USB_CurrentMode == USB_MODE_Device)
USB_DeviceTask();
else if (USB_CurrentMode == USB_MODE_Host)
USB_HostTask();
#endif
}
d5c: 1f 91 pop r17
d5e: 08 95 ret
00000d60 <StreamCallback_MS_Device_AbortOnMassStoreReset>:
}
static uint8_t StreamCallback_MS_Device_AbortOnMassStoreReset(void)
{
#if !defined(INTERRUPT_CONTROL_ENDPOINT)
USB_USBTask();
d60: ed df rcall .-38 ; 0xd3c <USB_USBTask>
#endif
if (*CallbackIsResetSource)
d62: e0 91 6e 01 lds r30, 0x016E
d66: f0 91 6f 01 lds r31, 0x016F
d6a: 80 81 ld r24, Z
return STREAMCALLBACK_Abort;
else
return STREAMCALLBACK_Continue;
}
d6c: 08 95 ret
00000d6e <MS_Device_USBTask>:
return true;
}
void MS_Device_USBTask(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
{
d6e: 0f 93 push r16
d70: 1f 93 push r17
d72: cf 93 push r28
d74: df 93 push r29
d76: ec 01 movw r28, r24
if (USB_DeviceState != DEVICE_STATE_Configured)
d78: 8e b3 in r24, 0x1e ; 30
d7a: 84 30 cpi r24, 0x04 ; 4
d7c: 09 f0 breq .+2 ; 0xd80 <MS_Device_USBTask+0x12>
d7e: e2 c0 rjmp .+452 ; 0xf44 <MS_Device_USBTask+0x1d6>
return;
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataOUTEndpointNumber);
d80: 9d 81 ldd r25, Y+5 ; 0x05
*/
static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber) ATTR_ALWAYS_INLINE;
static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber)
{
#if !defined(CONTROL_ONLY_DEVICE)
UENUM = EndpointNumber;
d82: 90 93 e9 00 sts 0x00E9, r25
* \return Boolean true if the currently selected endpoint may be read from or written to, depending on its direction.
*/
static inline bool Endpoint_IsReadWriteAllowed(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline bool Endpoint_IsReadWriteAllowed(void)
{
return ((UEINTX & (1 << RWAL)) ? true : false);
d86: 80 91 e8 00 lds r24, 0x00E8
if (Endpoint_IsReadWriteAllowed())
d8a: 85 ff sbrs r24, 5
d8c: a6 c0 rjmp .+332 ; 0xeda <MS_Device_USBTask+0x16c>
*/
static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber) ATTR_ALWAYS_INLINE;
static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber)
{
#if !defined(CONTROL_ONLY_DEVICE)
UENUM = EndpointNumber;
d8e: 90 93 e9 00 sts 0x00E9, r25
static bool MS_Device_ReadInCommandBlock(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
{
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataOUTEndpointNumber);
CallbackIsResetSource = &MSInterfaceInfo->State.IsMassStoreReset;
d92: 8e 01 movw r16, r28
d94: 0a 5c subi r16, 0xCA ; 202
d96: 1f 4f sbci r17, 0xFF ; 255
d98: 10 93 6f 01 sts 0x016F, r17
d9c: 00 93 6e 01 sts 0x016E, r16
if (Endpoint_Read_Stream_LE(&MSInterfaceInfo->State.CommandBlock,
da0: ce 01 movw r24, r28
da2: 0a 96 adiw r24, 0x0a ; 10
da4: 6f e0 ldi r22, 0x0F ; 15
da6: 70 e0 ldi r23, 0x00 ; 0
da8: 40 eb ldi r20, 0xB0 ; 176
daa: 56 e0 ldi r21, 0x06 ; 6
dac: 16 df rcall .-468 ; 0xbda <Endpoint_Read_Stream_LE>
dae: 88 23 and r24, r24
db0: 09 f0 breq .+2 ; 0xdb4 <MS_Device_USBTask+0x46>
db2: 93 c0 rjmp .+294 ; 0xeda <MS_Device_USBTask+0x16c>
StreamCallback_MS_Device_AbortOnMassStoreReset))
{
return false;
}
if ((MSInterfaceInfo->State.CommandBlock.Signature != MS_CBW_SIGNATURE) ||
db4: 8a 85 ldd r24, Y+10 ; 0x0a
db6: 9b 85 ldd r25, Y+11 ; 0x0b
db8: ac 85 ldd r26, Y+12 ; 0x0c
dba: bd 85 ldd r27, Y+13 ; 0x0d
dbc: 85 55 subi r24, 0x55 ; 85
dbe: 93 45 sbci r25, 0x53 ; 83
dc0: a2 44 sbci r26, 0x42 ; 66
dc2: b3 44 sbci r27, 0x43 ; 67
dc4: 79 f4 brne .+30 ; 0xde4 <MS_Device_USBTask+0x76>
dc6: 9f 89 ldd r25, Y+23 ; 0x17
dc8: 89 85 ldd r24, Y+9 ; 0x09
dca: 98 17 cp r25, r24
dcc: 58 f4 brcc .+22 ; 0xde4 <MS_Device_USBTask+0x76>
dce: 8e 89 ldd r24, Y+22 ; 0x16
dd0: 90 e0 ldi r25, 0x00 ; 0
dd2: 8f 71 andi r24, 0x1F ; 31
dd4: 90 70 andi r25, 0x00 ; 0
dd6: 89 2b or r24, r25
dd8: 29 f4 brne .+10 ; 0xde4 <MS_Device_USBTask+0x76>
dda: 68 8d ldd r22, Y+24 ; 0x18
ddc: 66 23 and r22, r22
dde: 11 f0 breq .+4 ; 0xde4 <MS_Device_USBTask+0x76>
de0: 61 31 cpi r22, 0x11 ; 17
de2: 70 f0 brcs .+28 ; 0xe00 <MS_Device_USBTask+0x92>
* \ingroup Group_EndpointPacketManagement
*/
static inline void Endpoint_StallTransaction(void) ATTR_ALWAYS_INLINE;
static inline void Endpoint_StallTransaction(void)
{
UECONX |= (1 << STALLRQ);
de4: 80 91 eb 00 lds r24, 0x00EB
de8: 80 62 ori r24, 0x20 ; 32
dea: 80 93 eb 00 sts 0x00EB, r24
(MSInterfaceInfo->State.CommandBlock.Flags & 0x1F) ||
(MSInterfaceInfo->State.CommandBlock.SCSICommandLength == 0) ||
(MSInterfaceInfo->State.CommandBlock.SCSICommandLength > 16))
{
Endpoint_StallTransaction();
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataINEndpointNumber);
dee: 89 81 ldd r24, Y+1 ; 0x01
*/
static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber) ATTR_ALWAYS_INLINE;
static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber)
{
#if !defined(CONTROL_ONLY_DEVICE)
UENUM = EndpointNumber;
df0: 80 93 e9 00 sts 0x00E9, r24
* \ingroup Group_EndpointPacketManagement
*/
static inline void Endpoint_StallTransaction(void) ATTR_ALWAYS_INLINE;
static inline void Endpoint_StallTransaction(void)
{
UECONX |= (1 << STALLRQ);
df4: 80 91 eb 00 lds r24, 0x00EB
df8: 80 62 ori r24, 0x20 ; 32
dfa: 80 93 eb 00 sts 0x00EB, r24
dfe: 6d c0 rjmp .+218 ; 0xeda <MS_Device_USBTask+0x16c>
Endpoint_StallTransaction();
return false;
}
CallbackIsResetSource = &MSInterfaceInfo->State.IsMassStoreReset;
e00: 10 93 6f 01 sts 0x016F, r17
e04: 00 93 6e 01 sts 0x016E, r16
if (Endpoint_Read_Stream_LE(&MSInterfaceInfo->State.CommandBlock.SCSICommandData,
e08: ce 01 movw r24, r28
e0a: 49 96 adiw r24, 0x19 ; 25
e0c: 70 e0 ldi r23, 0x00 ; 0
e0e: 40 eb ldi r20, 0xB0 ; 176
e10: 56 e0 ldi r21, 0x06 ; 6
e12: e3 de rcall .-570 ; 0xbda <Endpoint_Read_Stream_LE>
e14: 88 23 and r24, r24
e16: 09 f0 breq .+2 ; 0xe1a <MS_Device_USBTask+0xac>
e18: 60 c0 rjmp .+192 ; 0xeda <MS_Device_USBTask+0x16c>
*/
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));
e1a: 80 91 e8 00 lds r24, 0x00E8
e1e: 8b 77 andi r24, 0x7B ; 123
e20: 80 93 e8 00 sts 0x00E8, r24
if (Endpoint_IsReadWriteAllowed())
{
if (MS_Device_ReadInCommandBlock(MSInterfaceInfo))
{
if (MSInterfaceInfo->State.CommandBlock.Flags & MS_COMMAND_DIR_DATA_IN)
e24: 8e 89 ldd r24, Y+22 ; 0x16
e26: 87 ff sbrs r24, 7
e28: 03 c0 rjmp .+6 ; 0xe30 <MS_Device_USBTask+0xc2>
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataINEndpointNumber);
e2a: 89 81 ldd r24, Y+1 ; 0x01
*/
static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber) ATTR_ALWAYS_INLINE;
static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber)
{
#if !defined(CONTROL_ONLY_DEVICE)
UENUM = EndpointNumber;
e2c: 80 93 e9 00 sts 0x00E9, r24
MSInterfaceInfo->State.CommandStatus.Status = CALLBACK_MS_Device_SCSICommandReceived(MSInterfaceInfo) ?
e30: ce 01 movw r24, r28
e32: 9f d9 rcall .-3266 ; 0x172 <CALLBACK_MS_Device_SCSICommandReceived>
e34: 91 e0 ldi r25, 0x01 ; 1
e36: 98 27 eor r25, r24
e38: 9d ab std Y+53, r25 ; 0x35
MS_SCSI_COMMAND_Pass : MS_SCSI_COMMAND_Fail;
MSInterfaceInfo->State.CommandStatus.Signature = MS_CSW_SIGNATURE;
e3a: 25 e5 ldi r18, 0x55 ; 85
e3c: 33 e5 ldi r19, 0x53 ; 83
e3e: 42 e4 ldi r20, 0x42 ; 66
e40: 53 e5 ldi r21, 0x53 ; 83
e42: 29 a7 std Y+41, r18 ; 0x29
e44: 3a a7 std Y+42, r19 ; 0x2a
e46: 4b a7 std Y+43, r20 ; 0x2b
e48: 5c a7 std Y+44, r21 ; 0x2c
MSInterfaceInfo->State.CommandStatus.Tag = MSInterfaceInfo->State.CommandBlock.Tag;
e4a: 2e 85 ldd r18, Y+14 ; 0x0e
e4c: 3f 85 ldd r19, Y+15 ; 0x0f
e4e: 48 89 ldd r20, Y+16 ; 0x10
e50: 59 89 ldd r21, Y+17 ; 0x11
e52: 2d a7 std Y+45, r18 ; 0x2d
e54: 3e a7 std Y+46, r19 ; 0x2e
e56: 4f a7 std Y+47, r20 ; 0x2f
e58: 58 ab std Y+48, r21 ; 0x30
MSInterfaceInfo->State.CommandStatus.DataTransferResidue = MSInterfaceInfo->State.CommandBlock.DataTransferLength;
e5a: 2a 89 ldd r18, Y+18 ; 0x12
e5c: 3b 89 ldd r19, Y+19 ; 0x13
e5e: 4c 89 ldd r20, Y+20 ; 0x14
e60: 5d 89 ldd r21, Y+21 ; 0x15
e62: 29 ab std Y+49, r18 ; 0x31
e64: 3a ab std Y+50, r19 ; 0x32
e66: 4b ab std Y+51, r20 ; 0x33
e68: 5c ab std Y+52, r21 ; 0x34
if ((MSInterfaceInfo->State.CommandStatus.Status == MS_SCSI_COMMAND_Fail) &&
e6a: 91 30 cpi r25, 0x01 ; 1
e6c: 51 f4 brne .+20 ; 0xe82 <MS_Device_USBTask+0x114>
e6e: 21 15 cp r18, r1
e70: 31 05 cpc r19, r1
e72: 41 05 cpc r20, r1
e74: 51 05 cpc r21, r1
e76: 29 f0 breq .+10 ; 0xe82 <MS_Device_USBTask+0x114>
* \ingroup Group_EndpointPacketManagement
*/
static inline void Endpoint_StallTransaction(void) ATTR_ALWAYS_INLINE;
static inline void Endpoint_StallTransaction(void)
{
UECONX |= (1 << STALLRQ);
e78: 80 91 eb 00 lds r24, 0x00EB
e7c: 80 62 ori r24, 0x20 ; 32
e7e: 80 93 eb 00 sts 0x00EB, r24
return true;
}
static void MS_Device_ReturnCommandStatus(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
{
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataOUTEndpointNumber);
e82: 8d 81 ldd r24, Y+5 ; 0x05
*/
static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber) ATTR_ALWAYS_INLINE;
static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber)
{
#if !defined(CONTROL_ONLY_DEVICE)
UENUM = EndpointNumber;
e84: 80 93 e9 00 sts 0x00E9, r24
e88: 04 c0 rjmp .+8 ; 0xe92 <MS_Device_USBTask+0x124>
while (Endpoint_IsStalled())
{
#if !defined(INTERRUPT_CONTROL_ENDPOINT)
USB_USBTask();
e8a: 58 df rcall .-336 ; 0xd3c <USB_USBTask>
#endif
if (MSInterfaceInfo->State.IsMassStoreReset)
e8c: 8e a9 ldd r24, Y+54 ; 0x36
e8e: 88 23 and r24, r24
e90: 21 f5 brne .+72 ; 0xeda <MS_Device_USBTask+0x16c>
* \return Boolean true if the currently selected endpoint is stalled, false otherwise.
*/
static inline bool Endpoint_IsStalled(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline bool Endpoint_IsStalled(void)
{
return ((UECONX & (1 << STALLRQ)) ? true : false);
e92: 80 91 eb 00 lds r24, 0x00EB
static void MS_Device_ReturnCommandStatus(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
{
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataOUTEndpointNumber);
while (Endpoint_IsStalled())
e96: 85 fd sbrc r24, 5
e98: f8 cf rjmp .-16 ; 0xe8a <MS_Device_USBTask+0x11c>
if (MSInterfaceInfo->State.IsMassStoreReset)
return;
}
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataINEndpointNumber);
e9a: 89 81 ldd r24, Y+1 ; 0x01
*/
static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber) ATTR_ALWAYS_INLINE;
static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber)
{
#if !defined(CONTROL_ONLY_DEVICE)
UENUM = EndpointNumber;
e9c: 80 93 e9 00 sts 0x00E9, r24
ea0: 04 c0 rjmp .+8 ; 0xeaa <MS_Device_USBTask+0x13c>
while (Endpoint_IsStalled())
{
#if !defined(INTERRUPT_CONTROL_ENDPOINT)
USB_USBTask();
ea2: 4c df rcall .-360 ; 0xd3c <USB_USBTask>
#endif
if (MSInterfaceInfo->State.IsMassStoreReset)
ea4: 8e a9 ldd r24, Y+54 ; 0x36
ea6: 88 23 and r24, r24
ea8: c1 f4 brne .+48 ; 0xeda <MS_Device_USBTask+0x16c>
* \return Boolean true if the currently selected endpoint is stalled, false otherwise.
*/
static inline bool Endpoint_IsStalled(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline bool Endpoint_IsStalled(void)
{
return ((UECONX & (1 << STALLRQ)) ? true : false);
eaa: 80 91 eb 00 lds r24, 0x00EB
return;
}
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataINEndpointNumber);
while (Endpoint_IsStalled())
eae: 85 fd sbrc r24, 5
eb0: f8 cf rjmp .-16 ; 0xea2 <MS_Device_USBTask+0x134>
if (MSInterfaceInfo->State.IsMassStoreReset)
return;
}
CallbackIsResetSource = &MSInterfaceInfo->State.IsMassStoreReset;
eb2: e6 96 adiw r28, 0x36 ; 54
eb4: d0 93 6f 01 sts 0x016F, r29
eb8: c0 93 6e 01 sts 0x016E, r28
ebc: e6 97 sbiw r28, 0x36 ; 54
if (Endpoint_Write_Stream_LE(&MSInterfaceInfo->State.CommandStatus, sizeof(MS_CommandStatusWrapper_t),
ebe: ce 01 movw r24, r28
ec0: 89 96 adiw r24, 0x29 ; 41
ec2: 6d e0 ldi r22, 0x0D ; 13
ec4: 70 e0 ldi r23, 0x00 ; 0
ec6: 40 eb ldi r20, 0xB0 ; 176
ec8: 56 e0 ldi r21, 0x06 ; 6
eca: fd de rcall .-518 ; 0xcc6 <Endpoint_Write_Stream_LE>
ecc: 88 23 and r24, r24
ece: 29 f4 brne .+10 ; 0xeda <MS_Device_USBTask+0x16c>
*/
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));
ed0: 80 91 e8 00 lds r24, 0x00E8
ed4: 8e 77 andi r24, 0x7E ; 126
ed6: 80 93 e8 00 sts 0x00E8, r24
MS_Device_ReturnCommandStatus(MSInterfaceInfo);
}
}
if (MSInterfaceInfo->State.IsMassStoreReset)
eda: 8e a9 ldd r24, Y+54 ; 0x36
edc: 88 23 and r24, r24
ede: 91 f1 breq .+100 ; 0xf44 <MS_Device_USBTask+0x1d6>
{
Endpoint_ResetFIFO(MSInterfaceInfo->Config.DataOUTEndpointNumber);
ee0: 4d 81 ldd r20, Y+5 ; 0x05
* \param[in] EndpointNumber Endpoint number whose FIFO buffers are to be reset.
*/
static inline void Endpoint_ResetFIFO(const uint8_t EndpointNumber) ATTR_ALWAYS_INLINE;
static inline void Endpoint_ResetFIFO(const uint8_t EndpointNumber)
{
UERST = (1 << EndpointNumber);
ee2: 21 e0 ldi r18, 0x01 ; 1
ee4: 30 e0 ldi r19, 0x00 ; 0
ee6: c9 01 movw r24, r18
ee8: 04 2e mov r0, r20
eea: 02 c0 rjmp .+4 ; 0xef0 <MS_Device_USBTask+0x182>
eec: 88 0f add r24, r24
eee: 99 1f adc r25, r25
ef0: 0a 94 dec r0
ef2: e2 f7 brpl .-8 ; 0xeec <MS_Device_USBTask+0x17e>
ef4: 80 93 ea 00 sts 0x00EA, r24
UERST = 0;
ef8: 10 92 ea 00 sts 0x00EA, r1
Endpoint_ResetFIFO(MSInterfaceInfo->Config.DataINEndpointNumber);
efc: 99 81 ldd r25, Y+1 ; 0x01
* \param[in] EndpointNumber Endpoint number whose FIFO buffers are to be reset.
*/
static inline void Endpoint_ResetFIFO(const uint8_t EndpointNumber) ATTR_ALWAYS_INLINE;
static inline void Endpoint_ResetFIFO(const uint8_t EndpointNumber)
{
UERST = (1 << EndpointNumber);
efe: 09 2e mov r0, r25
f00: 02 c0 rjmp .+4 ; 0xf06 <MS_Device_USBTask+0x198>
f02: 22 0f add r18, r18
f04: 33 1f adc r19, r19
f06: 0a 94 dec r0
f08: e2 f7 brpl .-8 ; 0xf02 <MS_Device_USBTask+0x194>
f0a: 20 93 ea 00 sts 0x00EA, r18
UERST = 0;
f0e: 10 92 ea 00 sts 0x00EA, r1
*/
static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber) ATTR_ALWAYS_INLINE;
static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber)
{
#if !defined(CONTROL_ONLY_DEVICE)
UENUM = EndpointNumber;
f12: 40 93 e9 00 sts 0x00E9, r20
* \ingroup Group_EndpointPacketManagement
*/
static inline void Endpoint_ClearStall(void) ATTR_ALWAYS_INLINE;
static inline void Endpoint_ClearStall(void)
{
UECONX |= (1 << STALLRQC);
f16: 80 91 eb 00 lds r24, 0x00EB
f1a: 80 61 ori r24, 0x10 ; 16
f1c: 80 93 eb 00 sts 0x00EB, r24
/** Resets the data toggle of the currently selected endpoint. */
static inline void Endpoint_ResetDataToggle(void) ATTR_ALWAYS_INLINE;
static inline void Endpoint_ResetDataToggle(void)
{
UECONX |= (1 << RSTDT);
f20: 80 91 eb 00 lds r24, 0x00EB
f24: 88 60 ori r24, 0x08 ; 8
f26: 80 93 eb 00 sts 0x00EB, r24
*/
static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber) ATTR_ALWAYS_INLINE;
static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber)
{
#if !defined(CONTROL_ONLY_DEVICE)
UENUM = EndpointNumber;
f2a: 90 93 e9 00 sts 0x00E9, r25
* \ingroup Group_EndpointPacketManagement
*/
static inline void Endpoint_ClearStall(void) ATTR_ALWAYS_INLINE;
static inline void Endpoint_ClearStall(void)
{
UECONX |= (1 << STALLRQC);
f2e: 80 91 eb 00 lds r24, 0x00EB
f32: 80 61 ori r24, 0x10 ; 16
f34: 80 93 eb 00 sts 0x00EB, r24
/** Resets the data toggle of the currently selected endpoint. */
static inline void Endpoint_ResetDataToggle(void) ATTR_ALWAYS_INLINE;
static inline void Endpoint_ResetDataToggle(void)
{
UECONX |= (1 << RSTDT);
f38: 80 91 eb 00 lds r24, 0x00EB
f3c: 88 60 ori r24, 0x08 ; 8
f3e: 80 93 eb 00 sts 0x00EB, r24
Endpoint_ResetDataToggle();
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataINEndpointNumber);
Endpoint_ClearStall();
Endpoint_ResetDataToggle();
MSInterfaceInfo->State.IsMassStoreReset = false;
f42: 1e aa std Y+54, r1 ; 0x36
}
}
f44: df 91 pop r29
f46: cf 91 pop r28
f48: 1f 91 pop r17
f4a: 0f 91 pop r16
f4c: 08 95 ret
00000f4e <MS_Device_ConfigureEndpoints>:
break;
}
}
bool MS_Device_ConfigureEndpoints(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
{
f4e: 1f 93 push r17
f50: cf 93 push r28
f52: df 93 push r29
f54: ec 01 movw r28, r24
memset(&MSInterfaceInfo->State, 0x00, sizeof(MSInterfaceInfo->State));
f56: 0a 96 adiw r24, 0x0a ; 10
f58: fc 01 movw r30, r24
f5a: 8d e2 ldi r24, 0x2D ; 45
f5c: df 01 movw r26, r30
f5e: 1d 92 st X+, r1
f60: 8a 95 dec r24
f62: e9 f7 brne .-6 ; 0xf5e <MS_Device_ConfigureEndpoints+0x10>
f64: 11 e0 ldi r17, 0x01 ; 1
uint16_t Size;
uint8_t Type;
uint8_t Direction;
bool DoubleBanked;
if (EndpointNum == MSInterfaceInfo->Config.DataINEndpointNumber)
f66: 89 81 ldd r24, Y+1 ; 0x01
f68: 18 17 cp r17, r24
f6a: 29 f4 brne .+10 ; 0xf76 <MS_Device_ConfigureEndpoints+0x28>
{
Size = MSInterfaceInfo->Config.DataINEndpointSize;
f6c: ea 81 ldd r30, Y+2 ; 0x02
f6e: fb 81 ldd r31, Y+3 ; 0x03
Direction = ENDPOINT_DIR_IN;
Type = EP_TYPE_BULK;
DoubleBanked = MSInterfaceInfo->Config.DataINEndpointDoubleBank;
f70: 8c 81 ldd r24, Y+4 ; 0x04
f72: 61 e0 ldi r22, 0x01 ; 1
f74: 07 c0 rjmp .+14 ; 0xf84 <MS_Device_ConfigureEndpoints+0x36>
}
else if (EndpointNum == MSInterfaceInfo->Config.DataOUTEndpointNumber)
f76: 8d 81 ldd r24, Y+5 ; 0x05
f78: 18 17 cp r17, r24
f7a: e1 f4 brne .+56 ; 0xfb4 <MS_Device_ConfigureEndpoints+0x66>
{
Size = MSInterfaceInfo->Config.DataOUTEndpointSize;
f7c: ee 81 ldd r30, Y+6 ; 0x06
f7e: ff 81 ldd r31, Y+7 ; 0x07
Direction = ENDPOINT_DIR_OUT;
Type = EP_TYPE_BULK;
DoubleBanked = MSInterfaceInfo->Config.DataOUTEndpointDoubleBank;
f80: 88 85 ldd r24, Y+8 ; 0x08
f82: 60 e0 ldi r22, 0x00 ; 0
else
{
continue;
}
if (!(Endpoint_ConfigureEndpoint(EndpointNum, Type, Direction, Size,
f84: 88 23 and r24, r24
f86: 11 f4 brne .+4 ; 0xf8c <MS_Device_ConfigureEndpoints+0x3e>
f88: 40 e0 ldi r20, 0x00 ; 0
f8a: 01 c0 rjmp .+2 ; 0xf8e <MS_Device_ConfigureEndpoints+0x40>
f8c: 44 e0 ldi r20, 0x04 ; 4
f8e: 20 e0 ldi r18, 0x00 ; 0
f90: 88 e0 ldi r24, 0x08 ; 8
f92: 90 e0 ldi r25, 0x00 ; 0
f94: 03 c0 rjmp .+6 ; 0xf9c <MS_Device_ConfigureEndpoints+0x4e>
uint8_t MaskVal = 0;
uint16_t CheckBytes = 8;
while (CheckBytes < Bytes)
{
MaskVal++;
f96: 2f 5f subi r18, 0xFF ; 255
CheckBytes <<= 1;
f98: 88 0f add r24, r24
f9a: 99 1f adc r25, r25
static inline uint8_t Endpoint_BytesToEPSizeMask(const uint16_t Bytes)
{
uint8_t MaskVal = 0;
uint16_t CheckBytes = 8;
while (CheckBytes < Bytes)
f9c: 8e 17 cp r24, r30
f9e: 9f 07 cpc r25, r31
fa0: d0 f3 brcs .-12 ; 0xf96 <MS_Device_ConfigureEndpoints+0x48>
const uint8_t Type,
const uint8_t Direction,
const uint16_t Size,
const uint8_t Banks)
{
return Endpoint_ConfigureEndpoint_Prv(Number, (((Type) << EPTYPE0) | (Direction)),
fa2: 60 68 ori r22, 0x80 ; 128
fa4: 42 60 ori r20, 0x02 ; 2
fa6: 22 95 swap r18
fa8: 20 7f andi r18, 0xF0 ; 240
faa: 42 2b or r20, r18
fac: 81 2f mov r24, r17
fae: 56 db rcall .-2388 ; 0x65c <Endpoint_ConfigureEndpoint_Prv>
fb0: 88 23 and r24, r24
fb2: 21 f0 breq .+8 ; 0xfbc <MS_Device_ConfigureEndpoints+0x6e>
bool MS_Device_ConfigureEndpoints(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
{
memset(&MSInterfaceInfo->State, 0x00, sizeof(MSInterfaceInfo->State));
for (uint8_t EndpointNum = 1; EndpointNum < ENDPOINT_TOTAL_ENDPOINTS; EndpointNum++)
fb4: 1f 5f subi r17, 0xFF ; 255
fb6: 15 30 cpi r17, 0x05 ; 5
fb8: b1 f6 brne .-84 ; 0xf66 <MS_Device_ConfigureEndpoints+0x18>
fba: 81 e0 ldi r24, 0x01 ; 1
return false;
}
}
return true;
}
fbc: df 91 pop r29
fbe: cf 91 pop r28
fc0: 1f 91 pop r17
fc2: 08 95 ret
00000fc4 <MS_Device_ProcessControlRequest>:
#include "MassStorage.h"
static volatile bool* CallbackIsResetSource;
void MS_Device_ProcessControlRequest(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
{
fc4: cf 93 push r28
fc6: df 93 push r29
fc8: ec 01 movw r28, r24
* \return Boolean true if the selected endpoint has received a SETUP packet, false otherwise.
*/
static inline bool Endpoint_IsSETUPReceived(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline bool Endpoint_IsSETUPReceived(void)
{
return ((UEINTX & (1 << RXSTPI)) ? true : false);
fca: 80 91 e8 00 lds r24, 0x00E8
if (!(Endpoint_IsSETUPReceived()))
fce: 83 ff sbrs r24, 3
fd0: 2f c0 rjmp .+94 ; 0x1030 <MS_Device_ProcessControlRequest+0x6c>
return;
if (USB_ControlRequest.wIndex != MSInterfaceInfo->Config.InterfaceNumber)
fd2: 88 81 ld r24, Y
fd4: 90 e0 ldi r25, 0x00 ; 0
fd6: 20 91 77 01 lds r18, 0x0177
fda: 30 91 78 01 lds r19, 0x0178
fde: 28 17 cp r18, r24
fe0: 39 07 cpc r19, r25
fe2: 31 f5 brne .+76 ; 0x1030 <MS_Device_ProcessControlRequest+0x6c>
return;
switch (USB_ControlRequest.bRequest)
fe4: 80 91 74 01 lds r24, 0x0174
fe8: 8e 3f cpi r24, 0xFE ; 254
fea: 79 f0 breq .+30 ; 0x100a <MS_Device_ProcessControlRequest+0x46>
fec: 8f 3f cpi r24, 0xFF ; 255
fee: 01 f5 brne .+64 ; 0x1030 <MS_Device_ProcessControlRequest+0x6c>
{
case MS_REQ_MassStorageReset:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
ff0: 80 91 73 01 lds r24, 0x0173
ff4: 81 32 cpi r24, 0x21 ; 33
ff6: e1 f4 brne .+56 ; 0x1030 <MS_Device_ProcessControlRequest+0x6c>
* \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);
ff8: 80 91 e8 00 lds r24, 0x00E8
ffc: 87 7f andi r24, 0xF7 ; 247
ffe: 80 93 e8 00 sts 0x00E8, r24
{
Endpoint_ClearSETUP();
Endpoint_ClearStatusStage();
1002: 3f db rcall .-2434 ; 0x682 <Endpoint_ClearStatusStage>
MSInterfaceInfo->State.IsMassStoreReset = true;
1004: 81 e0 ldi r24, 0x01 ; 1
1006: 8e ab std Y+54, r24 ; 0x36
1008: 13 c0 rjmp .+38 ; 0x1030 <MS_Device_ProcessControlRequest+0x6c>
}
break;
case MS_REQ_GetMaxLUN:
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
100a: 80 91 73 01 lds r24, 0x0173
100e: 81 3a cpi r24, 0xA1 ; 161
1010: 79 f4 brne .+30 ; 0x1030 <MS_Device_ProcessControlRequest+0x6c>
1012: 80 91 e8 00 lds r24, 0x00E8
1016: 87 7f andi r24, 0xF7 ; 247
1018: 80 93 e8 00 sts 0x00E8, r24
{
Endpoint_ClearSETUP();
Endpoint_Write_Byte(MSInterfaceInfo->Config.TotalLUNs - 1);
101c: 89 85 ldd r24, Y+9 ; 0x09
101e: 81 50 subi r24, 0x01 ; 1
* \param[in] Byte Next byte to write into the the currently selected endpoint's FIFO buffer.
*/
static inline void Endpoint_Write_Byte(const uint8_t Byte) ATTR_ALWAYS_INLINE;
static inline void Endpoint_Write_Byte(const uint8_t Byte)
{
UEDATX = Byte;
1020: 80 93 f1 00 sts 0x00F1, r24
*/
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));
1024: 80 91 e8 00 lds r24, 0x00E8
1028: 8e 77 andi r24, 0x7E ; 126
102a: 80 93 e8 00 sts 0x00E8, r24
Endpoint_ClearIN();
Endpoint_ClearStatusStage();
102e: 29 db rcall .-2478 ; 0x682 <Endpoint_ClearStatusStage>
}
break;
}
}
1030: df 91 pop r29
1032: cf 91 pop r28
1034: 08 95 ret
00001036 <_exit>:
1036: f8 94 cli
00001038 <__stop_program>:
1038: ff cf rjmp .-2 ; 0x1038 <__stop_program>
|