FactoryModeQuickTest.c
120 KB
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
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
/*****************************************************************************
* Copyright Statement:
* --------------------
* This software is protected by Copyright and the information contained
* herein is confidential. The software may not be copied and the information
* contained herein may not be used or disclosed except with the written
* permission of MediaTek Inc. (C) 2005
*
* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
*
* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
*
* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
*
*****************************************************************************/
/*****************************************************************************
*
* Filename:
* ---------
* FactoryModeQuickTest.c
*
* Project:
* --------
* MAUI
*
* Description:
* ------------
* This file is for Factory Mode Quick test
*
* Author:
* -------
* -------
*
*============================================================================
* HISTORY
* Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*------------------------------------------------------------------------------
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
********************************************************************************/
#include "MMI_features.h"
#ifdef __MMI_FACTORY_MODE__
/*****************************************************************************
* Include Files
*****************************************************************************/
#if defined(__DCM_WITH_COMPRESSION_MMI_POOL_A__)
#include "dcmgr.h"
#elif defined (__DCM_WITH_COMPRESSION_MMI_AP__) && defined(__MTK_TARGET__)
#include "MMI_ap_dcm_config.h"
#endif /* __DCM_WITH_COMPRESSION_MMI_POOL_A__ */
#if defined(__MMI_AP_DCM_FM__)
#pragma arm section rodata = "DYNAMIC_CODE_FM_RODATA" , code = "DYNAMIC_CODE_FM_ROCODE"
#elif defined(__DCM_WITH_COMPRESSION_MMI_POOL_A__)
#pragma arm section rodata = "DYNAMIC_CODE_COSMOS_FM_RODATA" , code = "DYNAMIC_CODE_COSMOS_FM_ROCODE"
#endif /* #ifdef __MMI_AP_DCM_FM__ */
#include "MMIDataType.h"
#include "kal_general_types.h"
#include "gdi_datatype.h"
#include "gui_data_types.h"
#include "GlobalConstants.h"
#include "ps_public_struct.h"
#include "stack_config.h"
#include "mmi_frm_input_gprot.h"
#include "stack_msgs.h"
#include "mmi_frm_events_gprot.h"
#include "GpioSrvGprot.h"
#include "gpiosrvgprot.h"
#include "Unicodexdcl.h"
#include "stdio.h"
#include "CustDataRes.h"
#include "GlobalResDef.h"
#include "TimerEvents.h"
#include "mmi_frm_timer_gprot.h"
#include "wgui_categories_util.h"
#include "kal_public_api.h"
#include "mmi_frm_history_gprot.h"
#include "CustMenuRes.h"
#include "GlobalMenuItems.h"
#include "wgui_categories_list.h"
#include "gui_typedef.h"
#include "wgui_include.h"
#include "string.h"
#include "mmi_frm_nvram_gprot.h"
#include "wgui_categories_text_viewer.h"
#include "nvram_defs.h"
#include "gui.h"
#include "FontRes.h"
#include "gdi_include.h"
#include "wgui_categories.h"
#include "custom_mmi_default_value.h"
#include "wgui.h"
#include "mmi_frm_scenario_gprot.h"
#include "mmi_msg_struct.h"
#include "AlarmFrameworkProt.h"
#include "mmi_res_range_def.h"
#include "mmi_frm_queue_gprot.h"
#include "app_ltlcom.h"
#include "wgui_touch_screen.h"
#include "gui_config.h"
#include "SensorSrvGport.h"
#include "ProtocolEvents.h"
#include "CommonScreens.h"
#include "PixcomFontEngine.h"
#include "resource_audio.h"
#include "IdleAppDef.h"
//#include "FactoryModeDef.h"
#include "EngineerModeUtil.h"
#include "EngineerModeGprot.h"
#include "mdi_datatype.h"
#include "mdi_include.h"
#include "mdi_audio.h"
#include "CommonScreens.h"
#include "fmt_struct.h"
#include "mmi_rp_srv_gpio_def.h"
#include "wgui_categories.h"
#include "dcl.h"
#if defined(__MSDC_MS__) || defined(__MSDC_SD_MMC__) || defined(__MSDC_MSPRO__)
#include "Msdc_def.h"
#endif
#if defined __MMI_FM_CAMERA_PREVIEW__
#include "lcd_if.h"
#include "lcd_sw_rnd.h" /* LCD layer enable flag */
#include "mdi_datatype.h"
#include "med_api.h" /* media task camera module */
#include "MMI_features_camera.h"
#include "resource_camera_skins.h"
#include "mdi_camera.h"
#include "CameraApp.h"
#if defined(ISP_SUPPORT)
#include "image_sensor.h"
#endif
#endif /* __MMI_FM_CAMERA_PREVIEW__ */
#include "init.h"
#include "init_public.h"
#include "device.h"
#include "custom_em.h"
#ifdef __MMI_FM_KEYPAD_TEST__
#include "custom_fm.h"
#endif
#include "custom_equipment.h"
//#include "custom_hw_default.h"
#include "nvram_data_items.h"
#include "nvram_interface.h"
#include "lcd_sw_inc.h"
#include "resource_verno.h"
#ifdef __MTK_TARGET__
#include "l1audio.h"
#else
#define L1SP_Tones kal_uint16
#endif
#include "datetimetype.h"
#include "app_datetime.h"
#ifdef __MMI_FM_RADIO__
#include "aud_defs.h"
#ifdef __PLUTO_MMI_PACKAGE__
#include "mmi_rp_app_fmrdo_def.h"
#endif /*__PLUTO_MMI_PACKAGE__*/
#endif
#include "adc_channel.h"
#include "ShutdownSrvGprot.h"
#include "mmi_rp_app_factorymode_def.h"
#include "MenuCuiGprot.h"
#include "FactoryModeGProt.h"
/* For MRE version */
#include "vmsys.h"
#include "stack_msgs.h"
#ifdef __GADGET_SUPPORT__
#include "WgtMgrSrvGprot.h"
#endif
#include "PowerOnChargerProt.h"
#include "FileMgrSrvGProt.h"
#include "aud_main.h"
#include "FactoryModeConfig.h"
#include "FactoryModeProt.h"
#include "FactoryModeUtil.h"
//#include "AlarmGprot.h"
/*****************************************************************************
* Define
*****************************************************************************/
#define NOSENDKEY_CNT_START_SHOW 0
#define NOSENDKEY_CNT_START_HIDE 1
#define NOSENDKEY_CNT_STOP_SHOW 2
#define NOSENDKEY_UNCNT_STOP_SHOW 6
#define NOSENDKEY_UNCNT_STOP_HIDE 7
#define SENDKEY_CNT_START_SHOW 8
#define SENDKEY_CNT_START_HIDE 9
#define SENDKEY_CNT_STOP_SHOW 10
#define SENDKEY_UNCNT_STOP_SHOW 14
#define SENDKEY_UNCNT_STOP_HIDE 15
#define SENDKEYFLAG 0x08
#define CONTINUSFLAG 0x04
#define STOPFLAG 0x02
#define SHOWSCRNFLAG 0x01
#if defined(__TOPWELL_BASE_BUG__)
#if defined(__BT_SUPPORT__)
#if defined(__TOPWELL_FM_NOT_TEST_BT__)
//Not test
#else
#define __TOPWELL_FACTORYMODE_QUICK_BT__
#endif
#endif
#ifdef __MMI_FM_RADIO__
#define __TOPWELL_FACTORYMODE_QUICK_FM_RADIO__
#define __TOPWELL_FACTORYMODE_QUICK_FM_RADIO_USE_KEY__
#endif
#endif
#if defined(__TOPWELL_BASE_BUG__)
#define __TOPWELL_FM_TEST_VERSION_SLIM__
#endif
/*****************************************************************************
* typedef enum/struct/...
*****************************************************************************/
/*****************************************************************************
* global val / function
*****************************************************************************/
extern U16 g_cameraStartFlag;
extern U8 gCurrentMode;
extern MMI_ID g_fm_gourp_id;
extern mmi_fm_item_cntxt_struct *g_fm_contxt;
/*-------------auto test-----------------*/
/* Auto Testing Settings */
extern S32 g_fm_PriorityValue ;
extern S16 g_fm_AutoTestListSize ;
extern U16 g_fm_HiliteAutoTestCurrSelIdx ;
extern U16 g_fm_HiliteAllTestListIdx ;
extern U16 g_fm_newPriority ;
extern AutoTestItemArray g_fm_nvramTestItemArray;
extern AutoTestResultArray g_fm_nvramTestResultArray;
extern rtc_format_struct g_fm_myclocktime;
extern PU8 g_fm_AutoTestSelectedItems[MAX_AUTO_TEST_ITEMS];
/* -----------Camera ------------- */
#if defined(__MMI_FM_CAMERA_PREVIEW__)
extern camera_context_struct g_camera_cntx;
extern const U8 camera_ev_command_map[];
extern const U8 camera_zoom_command_map[];
extern const U8 camera_effect_command_map[];
extern const U8 camera_wb_command_map[];
extern const U8 camera_banding_command_map[];
extern const U8 camera_jpg_size_command_map[];
extern const U8 camera_image_qty_command_map[];
/* extern gdi_color GDI_COLOR_BLACK; */
extern wgui_inline_item wgui_inline_items[];
extern gdi_handle wgui_base_layer;
extern gdi_handle wgui_layer_1;
#endif /* defined(__FM_CAMERA_PREVIEW__) */
#if defined(__MMI_FM_CAMERA_PREVIEW__)
extern void mmi_fm_camera_entry_sublcd_screen(void);
#endif
#if defined(__MMI_FM_TC01_CAMERA_TEST__)
extern void mmi_fm_camera_test_entry_cam_test(void);
#endif
/*--- For Quick test setting----- */
extern void mmi_fm_select_auto_test_setting(void);
extern void mmi_fm_WriteTestResultToNVRAM(void);
extern void FM_SendStopAudioReq(U8 index);
extern void FM_SetGpioReq(U8 type, U8 level);
extern void gui_touch_feedback_enable_tone_internal(void);
extern void gui_touch_feedback_enable_vibrate_internal(void);
extern void gui_touch_feedback_disable_tone_internal(void);
extern void gui_touch_feedback_disable_vibrate_internal(void);
extern void mmi_fm_ReadTimeFromNVRAM(void);
extern void mmi_fm_WriteCurrentTimeToNVRAM(void);
extern void mmi_fm_ReadTestResultFromNVRAM(void);
extern void FM_SendADCStartReq(void);
extern void FM_SetGpioVirbateReq(U8 level);
extern void InitFactoryModeEvent(void);
extern void DeinitFactoryModeEvent(void);
/*****************************************************************************
* static function
*****************************************************************************/
/*-----------auto test-------------------*/
static void EntryFMAutoTestStart(void);
static void EntryFMAutoTestReport(void);
static void FM_InitAutoTest(void);
static U8 mmi_fm_auto_test_delete_history_hdlr(void);
#ifdef __SUPPORT_LED_FEATURE__
static void FM_AutoTest_LED(void);
#endif /* __SUPPORT_LED_FEATURE__ */
static void FM_AutoTest_CLAM(void);
static void FM_AutoTest_Version(void);
static void FM_AutoTest_Backlight(void);
static void FM_AutoTest_Keypad(void);
static void FM_AutoTest_LCD(void);
static void FM_AutoTest_Receiver(void);
static void FM_AutoTest_MIC(void);
static void FM_AutoTest_Speaker(void);
static void FM_AutoTest_Headset(void);
static void FM_AutoTest_Battery(void);
static void FM_AutoTest_Melody(void);
#if !defined(__TOPWELL_HW_NO_VIBRATOR__)
static void FM_AutoTest_VIB(void);
#endif
static void FM_AutoTest_NAND(void);
#ifdef __MMI_FM_UART_TEST__
static void FM_AutoTest_UART(void);
#endif
static void FM_AutoTest_Double_Speaker(void);
static void FM_AutoTest_CAMERA(void);
static void FM_AutoTest_MemoryCard(void);
#ifdef __MMI_TOUCH_SCREEN__
#if !defined(__TOPWELL_FM_NOT_TEST_PEN_PARALLEL_LINES__)
static void FM_AutoTest_Pen_Parallel_Test(void);
#endif
#endif /* __MMI_TOUCH_SCREEN__ */
static void FM_ReTest(void);
static void FM_Handle_Pass_Key_Press(void);
static void FM_Handle_Fail_Key_Press(void);
//static void FM_Autotest_Stop_Test(void);
static void mmi_fm_select_atv(void);
static void mmi_fm_highlight_atv(void);
static void mmi_fm_reenter_auto_test(void);
static void mmi_fm_enter_auto_test(void);
static void mmi_fm_enter_autotest_nand(void);
#if defined(__TOPWELL_HW_TORCH__)
static void FM_AutoTest_TORCH(void);
#endif
#if defined(__TOPWELL_HW_LED_SIGNAL__)
#if !defined(__TOPWELL_FM_NOT_TEST_INFORMATION_LED__)
static void FM_AutoTest_Information_LED(void);
#endif
#endif
#ifdef __TOPWELL_FACTORYMODE_QUICK_FM_RADIO__
void FM_AutoTest_FM_RADIO(void);
#endif
#ifdef __TOPWELL_FACTORYMODE_QUICK_BT__
void FM_AutoTest_BT(void);
#endif
#if defined(__TOPWELL_FM_TEST_CHARGE__)
void FM_AutoTest_Charge(void);
#endif
/*=============== Auto Testing =============== */
const testlet Tests[MAX_AUTO_TEST_ITEMS] = { /* Maximum name length = MAX_TEST_ITEM_NAME_LEN*ENCODING_LENGTH */
#if defined(__TOPWELL_BASE_BUG__)
{"Version", FM_AutoTest_Version}
#if !defined(__TOPWELL_FM_NOT_TEST_BACKLIGHT__)
,{"Backlight", FM_AutoTest_Backlight}
#endif
#if !defined(__TOPWELL_FM_NOT_TEST_LCD__)
,{"LCD", FM_AutoTest_LCD}
#endif
#if !defined(__TOPWELL_FM_NOT_TEST_KEYPAD__)
,{"KeyPad", FM_AutoTest_Keypad}
#endif
#if !defined(__TOPWELL_FM_NOT_TEST_RECEIVER__)
,{"Recevier", FM_AutoTest_Receiver}
#endif
#if !defined(__TOPWELL_FM_NOT_TEST_MIC__)
,{"MIC", FM_AutoTest_MIC}
#endif
#if !defined(__TOPWELL_FM_NOT_TEST_SPEAKER__)
,{"Speaker", FM_AutoTest_Speaker}
#endif
#if !defined(__TOPWELL_FM_NOT_TEST_HEADSET__)
,{"Headset", FM_AutoTest_Headset}
#endif
#if defined(__TOPWELL_FM_TEST_CHARGE__)
,{"Charge", FM_AutoTest_Charge}
#endif
#if !defined(__TOPWELL_FM_NOT_TEST_MELODY__)
,{"Melody", FM_AutoTest_Melody}
#endif
#if !defined(__TOPWELL_HW_NO_VIBRATOR__)
#if !defined(__TOPWELL_FM_NOT_TEST_VIB__)
,{"Vibrator", FM_AutoTest_VIB}
#endif
#endif
#if defined(__TOPWELL_HW_TORCH__)
#if !defined(__TOPWELL_FM_NOT_TEST_TORCH__)
,{"Torch", FM_AutoTest_TORCH}
#endif
#endif
#if defined(__TOPWELL_HW_LED_SIGNAL__)
#if !defined(__TOPWELL_FM_NOT_TEST_INFORMATION_LED__)
,{"Information LED", FM_AutoTest_Information_LED}
#endif
#endif
#if !defined(__TOPWELL_FM_NOT_TEST_CAMERA__)
,{"Camera", FM_AutoTest_CAMERA}
#endif
#ifdef __MMI_FM_RADIO__
#if !defined(__TOPWELL_FM_NOT_TEST_FM_RADIO__)
,{"FmRadio", FM_AutoTest_FM_RADIO}
#endif
#endif
#if defined(__BT_SUPPORT__)
#if !defined(__TOPWELL_FM_NOT_TEST_BT__)
,{"BlueTooth", FM_AutoTest_BT}
#endif
#endif
#if !defined(__TOPWELL_FM_NOT_TEST_MEMORYCARD__)
,{"MemoryCard", FM_AutoTest_MemoryCard}
#endif
#ifdef __MMI_TOUCH_SCREEN__
#if !defined(__TOPWELL_FM_NOT_TEST_PEN_PARALLEL_LINES__)
,{"ParallelLine", FM_AutoTest_Pen_Parallel_Test}
#endif
#if !defined(__TOPWELL_FM_NOT_TEST_PEN_N_CROSS_M_POINTS__)
,{"NxMPoint", FM_AutoTest_Pen_N_Cross_M_Test}
#endif
#endif /* __MMI_TOUCH_SCREEN__ */
#else
#ifdef __SUPPORT_LED_FEATURE__
{"LED", FM_AutoTest_LED},
#endif
{"Clam", FM_AutoTest_CLAM},
{"Version", FM_AutoTest_Version},
{"Backlight", FM_AutoTest_Backlight},
#ifndef __MMI_MAINLCD_96X64__
{"LCD", FM_AutoTest_LCD},
#endif
{"KeyPad", FM_AutoTest_Keypad},
{"Recevier", FM_AutoTest_Receiver},
{"MIC", FM_AutoTest_MIC},
{"Speaker", FM_AutoTest_Speaker},
{"Headset", FM_AutoTest_Headset},
{"Battery", FM_AutoTest_Battery},
{"Melody", FM_AutoTest_Melody},
{"Vibrator", FM_AutoTest_VIB},
{"NAND", FM_AutoTest_NAND},
#ifdef __MMI_FM_UART_TEST__
{"UART", FM_AutoTest_UART},
#endif
{"Doublespeaker", FM_AutoTest_Double_Speaker}, /* 17 */
#ifndef __MMI_MAINLCD_96X64__
{"CAMERA", FM_AutoTest_CAMERA}, /* 18 */
#endif
{"MemoryCard", FM_AutoTest_MemoryCard} /* 19 */
#ifdef __MMI_TOUCH_SCREEN__
#if !defined(__TOPWELL_FM_NOT_TEST_PEN_PARALLEL_LINES__)
, {"ParallelLine", FM_AutoTest_Pen_Parallel_Test} /* 20 */
#endif
, {"NxMPoint", FM_AutoTest_Pen_N_Cross_M_Test} /* 21 */
#endif /* __MMI_TOUCH_SCREEN__ */
#endif
};
/*****************************************************************************
* Code body
*****************************************************************************/
#define MMI_FM_AUTO_TEST
/*--------------------------- AUTO TEST ----------------------------------------*/
/*****************************************************************************
* FUNCTION
* FM_ReTest
* DESCRIPTION
*
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
static void FM_ReTest(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
mmi_fm_common_struct *common_cntx;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
common_cntx = &(g_fm_contxt->common_contxt);
/* currTestItem--; */
common_cntx->sequence_counter = 0; /* Reset the sequence counter */
common_cntx->TestExecuted[common_cntx->currTestItem] = FALSE;
EntryFMAutoTestStart();
}
/*****************************************************************************
* FUNCTION
* FM_Handle_Pass_Key_Press
* DESCRIPTION
*
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
static void FM_Handle_Pass_Key_Press(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
mmi_fm_back_to_normal_state();
g_fm_nvramTestResultArray.result[g_fm_contxt->common_contxt.currTestItem] = FM_TEST_PASSED;
g_fm_contxt->common_contxt.currTestItem++;
mmi_fm_WriteTestResultToNVRAM();
mmi_frm_scrn_close(g_fm_gourp_id, SCR_ID_FM_AUTO_TEST_START);
EntryFMAutoTestStart();
}
/*****************************************************************************
* FUNCTION
* FM_Handle_Fail_Key_Press
* DESCRIPTION
*
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
static void FM_Handle_Fail_Key_Press(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
mmi_fm_back_to_normal_state();
g_fm_nvramTestResultArray.result[g_fm_contxt->common_contxt.currTestItem] = FM_TEST_FAILED;
g_fm_contxt->common_contxt.currTestItem++;
mmi_fm_WriteTestResultToNVRAM();
mmi_frm_scrn_close(g_fm_gourp_id, SCR_ID_FM_AUTO_TEST_START);
EntryFMAutoTestStart();
}
/*****************************************************************************
* FUNCTION
* FM_Autotest_set_key_handlers
* DESCRIPTION
*
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
extern void FM_Autotest_set_key_handlers(U8 is_reg_sendkey)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (is_reg_sendkey)
SetKeyDownHandler(FM_ReTest, KEY_SEND);
PowerAndEndKeyHandler();
SetLeftSoftkeyFunction(FM_Handle_Pass_Key_Press, KEY_EVENT_UP);
SetRightSoftkeyFunction(FM_Handle_Fail_Key_Press, KEY_EVENT_UP);
}
#if 0
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
#endif
static MMI_RET mmi_fm_auto_test_group_proc(mmi_event_struct *evt)
{
switch(evt->evt_id)
{
case EVT_ID_GROUP_DEINIT:
StopTimer(FM_AUTO_TEST_COMMNON_TIMER);
applib_mem_ap_free(g_fm_contxt);
g_fm_contxt = 0;
g_fm_gourp_id = 0;
mmi_fm_auto_test_delete_history_hdlr();
StopTimer(FM_LCD_COLOR_CHANGE_TIMER);
FM_SendStopAudioReq(0);
FM_SetGpioVirbateReq(VIBRATOR_OFF);
FM_SendSetAudioModeReq(AUD_MODE_NORMAL);
mdi_audio_stop_id(TONE_KEY_NORMAL);
//#ifdef __MMI_FM_CAMERA_PREVIEW__
/* For camera */
#ifdef __MMI_FM_CAMERA_PREVIEW__
mmi_fm_close_camera();
#endif
/* Enable tone internal */
gui_touch_feedback_enable_tone_internal();
gui_touch_feedback_enable_vibrate_internal();
/* DCM Require */
MMI_FM_DCM_POST_UNLOAD();
break;
}
return MMI_RET_OK;
}
MMI_BOOL NeedInitAuto = MMI_FALSE; /*It is to mark if need sync nvram info*/
#if defined(__TOPWELL_MMI_FACTORYMODE_TEST_RESULT__)
MMI_BOOL g_is_first_enter = MMI_FALSE; /*It is to mark if first enter quicktest without testing*/
U8 g_is_qsttest_result_fix = 0;
U8 g_is_qsttest_test_type = 0; // 1 = Board test , 2 = assem test
#else
MMI_BOOL g_is_first_enter = MMI_TRUE; /*It is to mark if first enter quicktest without testing*/
#endif
static void mmi_fm_reenter_auto_test(void)
{
NeedInitAuto = MMI_TRUE;
mmi_frm_scrn_close(g_fm_gourp_id, SCR_ID_FM_AUTO_TEST_ROOT);
mmi_fm_enter_auto_test();
}
static void mmi_frm_clearResult()
{
U32 i;
for (i = 0; i < g_fm_AutoTestListSize; i++)
{
g_fm_nvramTestResultArray.result[i] = FM_TEST_UNTESTED;
}
}
/*****************************************************************************
* FUNCTION
* mmi_fm_enter_auto_test
* DESCRIPTION
* Enter quick test
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
static void mmi_fm_enter_auto_test(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U8 *guiBuffer;
mmi_fm_common_struct *common_cntx;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
common_cntx = &(g_fm_contxt->common_contxt);
if (g_fm_contxt == NULL)
{
//g_fm_contxt = MMI_FM_MALLOC(sizeof(mmi_fm_item_cntxt_struct));
g_fm_contxt = applib_mem_ap_alloc(APPLIB_MEM_AP_ID_FM_COMM_MEM,sizeof(mmi_fm_item_cntxt_struct));
memset(g_fm_contxt, 0, sizeof(mmi_fm_item_cntxt_struct));
mmi_fm_init_mem_contxt();
}
//mmi_frm_scrn_close(g_fm_gourp_id, SCR_ID_FM_AUTO_TEST_ROOT);
if (mmi_frm_scrn_enter
(g_fm_gourp_id,
SCR_ID_FM_AUTO_TEST_ROOT,
NULL,
mmi_fm_enter_auto_test,
MMI_FRM_FULL_SCRN) != MMI_TRUE)
{
return;
}
common_cntx->autoTestMode = 1;
guiBuffer = mmi_frm_scrn_get_active_gui_buf();
RegisterHighlightHandler(ExecuteCurrHiliteHandler);
kal_wsprintf((WCHAR *) common_cntx->EMFMUnicodeDisplayBuf,"%w\n\n\n\nEndkey: %w",
GetString(STR_ID_FM_AUTO_TEST_ROOT),GetString(STR_GLOBAL_EXIT));
ShowCategory7Screen(
STR_ID_FM_AUTO_TEST_ROOT,
NULL,
STR_GLOBAL_START,
IMG_GLOBAL_OK,
STR_ID_FM_AUTO_TEST_REPORT,
IMG_GLOBAL_BACK,
(PU8) common_cntx->EMFMUnicodeDisplayBuf,
guiBuffer);
SetLeftSoftkeyFunction(EntryFMAutoTestStart, KEY_EVENT_UP);
SetRightSoftkeyFunction(EntryFMAutoTestReport, KEY_EVENT_UP);
#ifdef __COSMOS_MMI_PACKAGE__
SetKeyUpHandler(EntryFMAutoTestReport, KEY_BACK);
#endif
if (NeedInitAuto == TRUE) /*Reenter quick test , need read NVRAM info*/
{
FM_InitAutoTest();
NeedInitAuto = MMI_FALSE;
}
/* If first enter quick test and select report, the NVRAM default test reslut
is wrong, and there is no info to justify if it is the first entry through NVRAM data.
So add this code.
If it is first entry of EM quick, g_fm_nvramTestResultArray.result[] should be set
FM_TEST_UNTESTED */
if (g_is_first_enter)
{
mmi_frm_clearResult();
}
}
/*****************************************************************************
* FUNCTION
* EntryFMAutoTestStart
* DESCRIPTION
*
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void EntryFMAutoTestStart(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U16 testitem;
U8 *guiBuffer;
mmi_fm_common_struct *common_cntx;
#ifdef __TOPWELL_MMI_FACTORYMODE_TEST_RESULT__
S16 error;
#endif
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* currTestItem++; */
common_cntx = &(g_fm_contxt->common_contxt);
if (common_cntx->currTestItem == 0) /* Testing just began, clear all tet results */
{
mmi_frm_clearResult();
mmi_fm_ReadTimeFromNVRAM();
g_is_first_enter = MMI_FALSE;
#ifdef __TOPWELL_MMI_FACTORYMODE_TEST_RESULT__
WriteValue(NVRAM_EF_QTEST_RESULT_ID, &g_is_first_enter, DS_BYTE, &error);
#endif
}
if (common_cntx->currTestItem < g_fm_AutoTestListSize)
{
/* Call test item according to the selected order */
testitem = g_fm_nvramTestItemArray.priority[common_cntx->currTestItem];
if (common_cntx->TestExecuted[common_cntx->currTestItem] == FALSE) /* prevent reentry of the same tests on interrupts */
{
/* Execute the test */
//g_fm_contxt->common_contxt.NeedExitFunc = FALSE;
(Tests[testitem].func) ();
TONE_SetOutputVolume(255, 0);
common_cntx->TestExecuted[common_cntx->currTestItem] = TRUE;
}
}
else
{
mmi_frm_scrn_close(g_fm_gourp_id, SCR_ID_FM_AUTO_TEST_START);
if (mmi_frm_scrn_enter
(g_fm_gourp_id,
SCR_ID_FM_AUTO_TEST_START,
NULL,
NULL,
MMI_FRM_FULL_SCRN) != MMI_TRUE)
{
return;
}
guiBuffer = mmi_frm_scrn_get_active_gui_buf();
ShowCategory7Screen(
STR_ID_FM_AUTO_TEST_ROOT,
NULL,//IMG_ID_FM_AUTO_TEST_ROOT,
STR_ID_FM_AUTO_TEST_REPORT,
IMG_GLOBAL_OK,
STR_GLOBAL_DONE,
IMG_GLOBAL_BACK,
(PU8) GetString(STR_ID_FM_AUTO_TEST_ALLDONE),
guiBuffer);
SetLeftSoftkeyFunction(EntryFMAutoTestReport, KEY_EVENT_UP);
SetRightSoftkeyFunction(mmi_fm_reenter_auto_test, KEY_EVENT_UP);
}
}
/*****************************************************************************
* FUNCTION
* FM_Handle_RTC_Stop_Key_Press
* DESCRIPTION
*
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
static void FM_Handle_RTC_Stop_Key_Press(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
g_fm_contxt->common_contxt.sequence_counter = 0;
StopTimer(FM_AUTO_TEST_COMMNON_TIMER);
mmi_fm_WriteCurrentTimeToNVRAM();
mmi_fm_reenter_auto_test();
}
/*****************************************************************************
* FUNCTION
* FM_ManualTest_RTC
* DESCRIPTION
*
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void FM_ManualTest_RTC(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
CHAR uniBuf[240];
U16 msec = 1000;
U16 sec = 2;
MYTIME t;
rtc_format_struct currtime;
mmi_fm_common_struct *common_cntx;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
//EntryNewScreen(SCR_ID_FM_RTC, NULL, NULL, NULL);
common_cntx = &(g_fm_contxt->common_contxt);
mmi_frm_scrn_close(g_fm_gourp_id,SCR_ID_FM_RTC);
if (mmi_frm_scrn_enter
(g_fm_gourp_id,
SCR_ID_FM_RTC,
NULL,
NULL,
MMI_FRM_FULL_SCRN) != MMI_TRUE)
{
return;
}
if (common_cntx->sequence_counter < sec)
{
common_cntx->sequence_counter++;
StartTimer(FM_AUTO_TEST_COMMNON_TIMER, msec, FM_ManualTest_RTC);
DTGetRTCTime(&t);
/*
currtime.rtc_sec = t.nSec;
currtime.rtc_min = t.nMin;
currtime.rtc_hour = t.nHour;
currtime.rtc_day = t.nDay;
currtime.rtc_mon = t.nMonth;
*/
//currtime = (rtc_format_struct)t;
memcpy(&currtime,&t,sizeof(rtc_format_struct));
currtime.rtc_wday = 0;
currtime.rtc_year = (kal_uint8) (t.nYear - 2000);
kal_wsprintf((WCHAR *) uniBuf,
"Last RTC:\n%d.%d.%d %02d:%02d:%02d\nCurrent RTC:\n%d.%d.%d %02d:%02d:%02d\n\npoweroff in %d sec",
2000 + g_fm_myclocktime.rtc_year,
g_fm_myclocktime.rtc_mon,
g_fm_myclocktime.rtc_day,
g_fm_myclocktime.rtc_hour,
g_fm_myclocktime.rtc_min,
g_fm_myclocktime.rtc_sec,
2000 + currtime.rtc_year,
currtime.rtc_mon,
currtime.rtc_day,
currtime.rtc_hour,
currtime.rtc_min,
currtime.rtc_sec,
sec - common_cntx->sequence_counter);
ShowCategory7Screen(
STR_ID_FM_AUTO_TEST_ROOT,
NULL,//IMG_ID_FM_AUTO_TEST_ROOT,
(U16) NULL,
IMG_GLOBAL_OK,
STR_GLOBAL_STOP,
IMG_GLOBAL_BACK,
(PU8) uniBuf,
NULL);
SetRightSoftkeyFunction(FM_Handle_RTC_Stop_Key_Press, KEY_EVENT_UP);
}
else
{
common_cntx->sequence_counter = 0;
StopTimer(FM_AUTO_TEST_COMMNON_TIMER);
mmi_fm_WriteCurrentTimeToNVRAM();
g_fm_contxt->rtc_contxt.gFactoryAlarm = 1;
FactorySetAlarm(3);
}
}
void mmi_fm_set_auto_test_goback_func()
{
SetRightSoftkeyFunction( mmi_frm_scrn_close_active_id, KEY_EVENT_UP);
#if defined(__COSMOS_MMI_PACKAGE__)
SetKeyUpHandler(mmi_frm_scrn_close_active_id, KEY_BACK);
#endif
}
void mmi_fm_set_auto_test_report(U32 untested, U8 *untested_items, U16 StringId, U8 *guiBuffer)
{
U32 i = 0;
mmi_fm_common_struct *common_cntx;
common_cntx = &(g_fm_contxt->common_contxt);
if (untested > 1)
{
sprintf((CHAR*) common_cntx->EMFMAsciiDisplayBuf, "\n\n%d Untested items:\n", untested);
}
else
{
sprintf((CHAR*) common_cntx->EMFMAsciiDisplayBuf, "\n\n1 Untested item:\n");
}
for (i = 0; i < untested; i++)
{
CHAR str[40];
if (i == untested - 1)
{
sprintf(str, "%d", 1 + untested_items[i]);
}
else
{
sprintf(str, "%d-", 1 + untested_items[i]);
}
strcat((CHAR*) common_cntx->EMFMAsciiDisplayBuf, (const CHAR*)str);
}
kal_wsprintf((WCHAR *) common_cntx->EMFMUnicodeDisplayBuf,
"%w%s",
GetString(StringId),(CHAR*) common_cntx->EMFMAsciiDisplayBuf);
ShowCategory7Screen(
STR_ID_FM_AUTO_TEST_REPORT,
NULL,//IMG_ID_FM_AUTO_TEST_ROOT,
(U16) NULL,
IMG_GLOBAL_OK,
STR_GLOBAL_BACK,
IMG_GLOBAL_BACK,
(PU8) common_cntx->EMFMUnicodeDisplayBuf,
guiBuffer);
SetLeftSoftkeyFunction(NULL, KEY_EVENT_UP);
SetRightSoftkeyFunction(mmi_fm_reenter_auto_test, KEY_EVENT_UP);
}
/*****************************************************************************
* FUNCTION
* EntryFMAutoTestReport
* DESCRIPTION
*
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void EntryFMAutoTestReport(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U8 *guiBuffer;
U32 i, passed, failed, untested;
U8 fail_items[MAX_AUTO_TEST_ITEMS];
U8 untested_items[MAX_AUTO_TEST_ITEMS];
S16 error;
#ifdef __TOPWELL_MMI_BT_AND_FT_CODE_FLAG__
U8 bt_test_status = 0;
#endif
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
NeedInitAuto = MMI_TRUE;
if (mmi_frm_scrn_enter
(g_fm_gourp_id,
SCR_ID_FM_AUTO_TEST_REPORT,
NULL,
NULL,
MMI_FRM_FULL_SCRN) != MMI_TRUE)
{
return;
}
guiBuffer = mmi_frm_scrn_get_active_gui_buf();
for (i = 0, passed = 0, failed = 0, untested = 0; i < g_fm_AutoTestListSize; i++)
{
if (g_fm_nvramTestResultArray.result[i] == FM_TEST_UNTESTED)
{
untested_items[untested] = (U8) i;
untested++;
}
else if (g_fm_nvramTestResultArray.result[i] == FM_TEST_FAILED)
{
fail_items[failed] = (U8) i;
failed++;
}
else if (g_fm_nvramTestResultArray.result[i] >= FM_TEST_PASSED)
{
passed++;
}
}
#ifdef __TOPWELL_MMI_FACTORYMODE_TEST_RESULT__
if (g_is_qsttest_test_type == TOPWELL_BOARD_TYPE )
{
g_is_qsttest_result_fix |= TOPWELL_BOARD_TYPE; //结果封存
WriteValue(NVRAM_EF_QTEST_RESULT_FIX_ID, &g_is_qsttest_result_fix, DS_BYTE, &error);
}
else if (g_is_qsttest_test_type == TOPWELL_ASSEM_TYPE )
{
g_is_qsttest_result_fix |= TOPWELL_ASSEM_TYPE; //结果封存
WriteValue(NVRAM_EF_QTEST_RESULT_FIX_ID, &g_is_qsttest_result_fix, DS_BYTE, &error);
}
#else
#ifdef __TOPWELL_MMI_BT_AND_FT_CODE_FLAG__
ReadValue(NVRAM_EF_BT_TEST_ID, &bt_test_status, DS_BYTE, &error);
if(bt_test_status==1)
{
untested = 0;
failed = 0;
}
#endif
#endif
if (untested > 0)
{
mmi_fm_set_auto_test_report(untested, untested_items, STR_ID_FM_AUTO_TEST_UNFINISHED,guiBuffer);
#ifdef __TOPWELL_MMI_BT_AND_FT_CODE_FLAG__
bt_test_status = 0;
WriteValue(NVRAM_EF_BT_TEST_ID, &bt_test_status, DS_BYTE, &error);
#endif
}
else if (failed > 0)
{
mmi_fm_set_auto_test_report(failed, fail_items, STR_GLOBAL_FAILED, guiBuffer);
#ifdef __TOPWELL_MMI_BT_AND_FT_CODE_FLAG__
bt_test_status = 0;
WriteValue(NVRAM_EF_BT_TEST_ID, &bt_test_status, DS_BYTE, &error);
#endif
#ifdef __TOPWELL_MMI_CHECK_FTEST_BEFORE_WRITE_IMEI__
g_fm_contxt->version_contxt.gBarCode[62] = 'F';
WriteRecordSlim(NVRAM_EF_BARCODE_NUM_LID, 1, g_fm_contxt->version_contxt.gBarCode, 64);
#endif
}
else
{
#if WIN32
//
#else
ShowCategory7Screen(
STR_ID_FM_AUTO_TEST_REPORT,
NULL,//IMG_ID_FM_AUTO_TEST_ROOT,
#if defined(__TOPWELL_FM_NOT_TEST_RTC__)
0,
#else
STR_ID_FM_RTC,
#endif
IMG_GLOBAL_OK,
STR_GLOBAL_BACK,
IMG_GLOBAL_BACK,
(PU8) GetString(STR_ID_FM_AUTO_TEST_ALLPASSED),
guiBuffer);
#ifdef __TOPWELL_MMI_BT_AND_FT_CODE_FLAG__
bt_test_status = 1;
WriteValue(NVRAM_EF_BT_TEST_ID, &bt_test_status, DS_BYTE, &error);
#endif
#ifdef __TOPWELL_MMI_CHECK_FTEST_BEFORE_WRITE_IMEI__
g_fm_contxt->version_contxt.gBarCode[62] = 'P';
WriteRecordSlim(NVRAM_EF_BARCODE_NUM_LID, 1, g_fm_contxt->version_contxt.gBarCode, 64);
#endif
#if defined(__TOPWELL_FM_NOT_TEST_RTC__)
SetLeftSoftkeyFunction(NULL, KEY_EVENT_UP);
#else
SetLeftSoftkeyFunction(FM_ManualTest_RTC, KEY_EVENT_UP);
#endif
SetRightSoftkeyFunction(mmi_fm_reenter_auto_test, KEY_EVENT_UP);
#endif
}
}
/*****************************************************************************
* FUNCTION
* InitFactoryModeSetting
* DESCRIPTION
*
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void InitFactoryModeSetting(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
gCurrentMode = FACTORY_MODE;
mdi_audio_suspend_background_play();
mdi_audio_stop_all();
srv_gpio_play_pattern((srv_gpio_pattern_id_enum)srv_led_pattern_get_bg_pattern(), SRV_GPIO_PATN_PLAY_STOP);
}
/*****************************************************************************
* FUNCTION
* FM_Autotest_test_done_USC2string
* DESCRIPTION
*
* PARAMETERS
* name [IN]
* RETURNS
* void
*****************************************************************************/
extern void FM_Autotest_test_done_USC2string(const CHAR *name)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
mmi_fm_common_struct *common_cntx;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
common_cntx = &(g_fm_contxt->common_contxt);
#if (defined(__MSDC_MS__) || defined(__MSDC_SD_MMC__) || defined(__MSDC_MSPRO__))
if (common_cntx->currentTest == FM_AUTOTEST_MEMORYCARD)
{
kal_wsprintf((WCHAR *) common_cntx->EMFMUnicodeDisplayBuf,
"%s (%d/%d)\n%w.\n\nSendkey: %w\nEndkey: %w",
(CHAR*) name,common_cntx->currTestItem + 1, g_fm_AutoTestListSize,
g_fm_contxt->memcard_contxt.CardType,GetString(STR_ID_FM_AUTO_TEST_RETEST),GetString(STR_GLOBAL_EXIT));
}
else
#endif /*(defined(__MSDC_MS__) || defined(__MSDC_SD_MMC__) || defined(__MSDC_MSPRO__))*/
{
kal_wsprintf((WCHAR *) common_cntx->EMFMUnicodeDisplayBuf,
"%s (%d/%d)\n%w.\n\nSendkey: %w\nEndkey: %w",
(CHAR*) name,common_cntx->currTestItem + 1, g_fm_AutoTestListSize,
GetString(STR_GLOBAL_DONE),GetString(STR_ID_FM_AUTO_TEST_RETEST),GetString(STR_GLOBAL_EXIT));
}
}
/*****************************************************************************
* FUNCTION
* FM_InitAutoTest
* DESCRIPTION
*
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void FM_InitAutoTest(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U32 i;
#ifdef __TOPWELL_MMI_FACTORYMODE_TEST_RESULT__
U8 Result;
S16 error;
#endif
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
#ifdef __TOPWELL_MMI_FACTORYMODE_TEST_RESULT__
ReadValue(NVRAM_EF_QTEST_RESULT_ID, &Result, DS_BYTE, &error);
g_is_first_enter = Result;
ReadValue(NVRAM_EF_QTEST_RESULT_FIX_ID, &Result, DS_BYTE, &error);
g_is_qsttest_result_fix = Result;
#endif
mmi_fm_ReadSettingsFromNVRAM(FM_SETTINGINFO);
mmi_fm_ReadSettingsFromNVRAM(FM_RESULTINFO);
g_fm_contxt->common_contxt.currTestItem = 0;
for (i = 0; i < MAX_AUTO_TEST_ITEMS; i++)
{
g_fm_contxt->common_contxt.TestExecuted[i] = FALSE;
}
InitFactoryModeSetting();
}
/*****************************************************************************
* FUNCTION
* mmi_fm_auto_test_delete_history_hdlr
* DESCRIPTION
*
* PARAMETERS
* param [?]
* RETURNS
*
*****************************************************************************/
U8 mmi_fm_auto_test_delete_history_hdlr(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
gCurrentMode = NORMAL_MODE;
mdi_switch_device_ownership(MOD_MMI, MDI_DEVICE_AUDIO | MDI_DEVICE_CAMER | MDI_DEVICE_VIDEO);
mdi_audio_start_background_timer();
mdi_audio_resume_background_play();
srv_gpio_play_pattern((srv_gpio_pattern_id_enum)srv_led_pattern_get_bg_pattern(), SRV_GPIO_PATN_PLAY_START);
//mmi_profiles_restore_activated_profile();
return FALSE;
}
/*****************************************************************************
* FUNCTION
* FM_AutoTest_LED
* DESCRIPTION
*
* PARAMETERS
* counter_flag: if flag==0 then sequence_counter++ else sequence_counter = 0
* timer_flag: if timer_flag == 0 then start timer,else stop timer
* is_show: if is_show==0, show category
* is_reg_sendkey: if is_reg_sendkey==1 register sendkey or not register
* RETURNS
* void
*****************************************************************************/
void mmi_fm_auto_test_common(U8 param ,U8 * StringId, U16 duration, FuncPtr func)
{
U8 is_reg_sendkey = (SENDKEYFLAG == (param & SENDKEYFLAG))?1:0;
if(0 == (param & CONTINUSFLAG))
{
g_fm_contxt->common_contxt.sequence_counter++;
}
else
{
g_fm_contxt->common_contxt.sequence_counter = 0;
}
if(0 == (param & STOPFLAG))
{
StartTimer(FM_AUTO_TEST_COMMNON_TIMER, duration, func);
}
else
{
StopTimer(FM_AUTO_TEST_COMMNON_TIMER);
}
if(0 == (param & SHOWSCRNFLAG))
{
ShowCategory7Screen(
STR_ID_FM_AUTO_TEST_ROOT,
NULL,//IMG_ID_FM_AUTO_TEST_ROOT,
STR_ID_FM_AUTO_TEST_PASS,
IMG_GLOBAL_OK,
STR_ID_FM_AUTO_TEST_FAIL,
IMG_GLOBAL_BACK,
(U8*) StringId,
NULL);
}
FM_Autotest_set_key_handlers(is_reg_sendkey);
}
#ifdef __SUPPORT_LED_FEATURE__
#define MMI_FM_QUICK_TEST_LED
static void mmi_fm_enter_quick_test_led(void);
static void FM_AutoTest_LED(void)
{
mmi_frm_scrn_close(g_fm_gourp_id, SCR_ID_FM_AUTO_TEST_START);
mmi_fm_enter_quick_test_led();
}
/*****************************************************************************
* FUNCTION
* FM_AutoTest_LED
* DESCRIPTION
*
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void mmi_fm_enter_quick_test_led(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
S8 *StringInfo = NULL;
U8 UcTestInfo = NOSENDKEY_CNT_START_SHOW;
U16 UsDuration = LED_DURATION;
FuncPtr FMAutoLEDFunc = FM_AutoTest_LED;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (mmi_frm_scrn_enter
(g_fm_gourp_id,
SCR_ID_FM_AUTO_TEST_START,
NULL,
mmi_fm_enter_quick_test_led,
MMI_FRM_FULL_SCRN) != MMI_TRUE)
{
return;
}
g_fm_contxt->common_contxt.currentTest = FM_TEST_LED;
switch (g_fm_contxt->common_contxt.sequence_counter)
{
case 0:
FM_SetGpioReq(GPIO_DEV_LED_STATUS_1, LED_LIGHT_LEVEL5);
StringInfo = (U8*)GetString(STR_ID_FM_AUTOTEST_LED_R);
break;
case 1:
FM_SetGpioReq(GPIO_DEV_LED_STATUS_1, LED_LIGHT_LEVEL0);
FM_SetGpioReq(GPIO_DEV_LED_STATUS_2, LED_LIGHT_LEVEL5);
StringInfo = (U8*)GetString(STR_ID_FM_AUTOTEST_LED_G);
break;
case 2:
FM_SetGpioReq(GPIO_DEV_LED_STATUS_2, LED_LIGHT_LEVEL0);
FM_SetGpioReq(GPIO_DEV_LED_STATUS_3, LED_LIGHT_LEVEL5);
StringInfo = (U8*)GetString(STR_ID_FM_AUTOTEST_LED_B);
break;
default:
FM_SetGpioReq(GPIO_DEV_LED_STATUS_3, LED_LIGHT_LEVEL0);
FM_Autotest_test_done_USC2string(Tests[FM_AUTOTEST_LED].name);
UcTestInfo = SENDKEY_UNCNT_STOP_SHOW;
StringInfo = g_fm_contxt->common_contxt.EMFMUnicodeDisplayBuf;
UsDuration = 0;
FMAutoLEDFunc = NULL;
}
mmi_fm_auto_test_common(UcTestInfo, StringInfo, UsDuration, FMAutoLEDFunc);
}
#endif /* __SUPPORT_LED_FEATURE__ */
#ifdef CLAM_SUPPORT
#define MMI_FM_QUICK_TEST_CLAM
static void mmi_fm_enter_quick_test_clam(void);
void FM_AutoTest_CLAM(void)
{
mmi_frm_scrn_close(g_fm_gourp_id, SCR_ID_FM_AUTO_TEST_START);
mmi_fm_enter_quick_test_clam();
}
/*****************************************************************************
* FUNCTION
* FM_AutoTest_CLAM
* DESCRIPTION
*
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void mmi_fm_enter_quick_test_clam(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
// EntryNewScreen(SCR_ID_FM_AUTO_TEST_START, ExitFMAutoTestStart, NULL, NULL);
if (mmi_frm_scrn_enter
(g_fm_gourp_id,
SCR_ID_FM_AUTO_TEST_START,
NULL,
mmi_fm_enter_quick_test_clam,
MMI_FRM_FULL_SCRN) != MMI_TRUE)
{
return;
}
g_fm_contxt->common_contxt.currentTest = FM_TEST_CLAM_DETECT;
switch (g_fm_contxt->common_contxt.sequence_counter)
{
case 0:
mmi_fm_auto_test_common(NOSENDKEY_CNT_START_SHOW,(U8*) GetString(STR_ID_FM_AUTOTEST_CLAM),CLAM_DURATION,FM_AutoTest_CLAM);
break;
default:
FM_Autotest_test_done_USC2string(Tests[FM_AUTOTEST_CLAM].name);
mmi_fm_auto_test_common(SENDKEY_UNCNT_STOP_SHOW,(U8*)g_fm_contxt->common_contxt.EMFMUnicodeDisplayBuf,0,NULL);
}
}
#endif
#ifdef __TOPWELL_FACTORYMODE_QUICK_FM_RADIO__
S8 fm_radio_freq_is_init=0;
void mmi_fm_radio_quick_test_pass(void)
{
StopTimer(FM_AUTO_TEST_COMMNON_TIMER);
#ifdef __MMI_FM_RADIO__
/* If FM Radio is turned on, then stop/turn-off it */
if (g_fm_contxt->radio_contxt.g_fm_fm_radio_cntx.is_FMRDO_on)
{
mdi_audio_stop_fmr();
g_fm_contxt->radio_contxt.g_fm_fm_radio_cntx.is_FMRDO_on = 0;
}
#endif
fm_radio_freq_is_init=0;
FM_Handle_Pass_Key_Press();
}
void mmi_fm_radio_quick_test_rsk_fuc(void)
{
StopTimer(FM_AUTO_TEST_COMMNON_TIMER);
#ifdef __MMI_FM_RADIO__
/* If FM Radio is turned on, then stop/turn-off it */
if (g_fm_contxt->radio_contxt.g_fm_fm_radio_cntx.is_FMRDO_on)
{
mdi_audio_stop_fmr();
g_fm_contxt->radio_contxt.g_fm_fm_radio_cntx.is_FMRDO_on = 0;
}
#endif
fm_radio_freq_is_init=0;
FM_Handle_Fail_Key_Press();
}
void EntryFMRADIOChannelQuickTest(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U8* guiBuffer;
CHAR* stringbuf;
fm_fm_radio_struct *g_fm_fm_radio_cntx;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
g_fm_fm_radio_cntx = &(g_fm_contxt->radio_contxt.g_fm_fm_radio_cntx);
g_fm_fm_radio_cntx->is_FMRDO_on = 1;
/* set audio volume */
mdi_audio_set_volume( AUD_VOLUME_FMR, MDI_AUD_VOL_MUTE(g_fm_fm_radio_cntx->CurrVolume));
/* set FM Radio Frequency */
mdi_fmr_set_freq( g_fm_fm_radio_cntx->Currfreq);
/* initialize display string */
stringbuf = OslMalloc(MMI_FM_RADIO_STRING_LEN);
stringbuf[0] = stringbuf[1] = 0;
kal_wsprintf((WCHAR *)stringbuf, "\nFre: %d.%d \n\nVol: %d\n\n",
g_fm_fm_radio_cntx->Currfreq/10, g_fm_fm_radio_cntx->Currfreq%10,
g_fm_fm_radio_cntx->CurrVolume);
//guiBuffer = mmi_frm_scrn_get_active_gui_buf();
#if defined(__TOPWELL_FACTORYMODE_QUICK_FM_RADIO_USE_KEY__)
ShowCategory7Screen(STR_ID_FM_AUTO_TEST_RESULT, 0, STR_ID_FM_AUTO_TEST_PASS, IMG_GLOBAL_OK,
STR_ID_FM_AUTO_TEST_FAIL, IMG_GLOBAL_BACK, (PU8)stringbuf, NULL);
SetRightSoftkeyFunction( mmi_fm_radio_quick_test_rsk_fuc, KEY_EVENT_UP);
SetKeyHandler(mmi_fm_radio_quick_test_rsk_fuc, KEY_END , KEY_EVENT_DOWN);
SetLeftSoftkeyFunction(mmi_fm_radio_quick_test_pass, KEY_EVENT_UP);
#else
ShowCategory7Screen(g_fm_fm_radio_cntx->text_id, 0, 0, 0,
STR_GLOBAL_BACK, IMG_GLOBAL_BACK, (PU8)stringbuf, NULL);
#endif
OslMfree(stringbuf);
}
void mmi_fm_quick_test_init_freq(void)
{
if(fm_radio_freq_is_init==0)
{
fm_radio_freq_is_init=1;
#ifdef __TOPWELL_FM_NOT_TEST_FM_RADIO_START_100HZ__
g_fm_contxt->radio_contxt.g_fm_fm_radio_cntx.Currfreq=1000;
#else
g_fm_contxt->radio_contxt.g_fm_fm_radio_cntx.Currfreq=875;
#endif
}
}
void mmi_fm_enter_quick_test_fm_radio(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
//EntryNewScreen(SCR_ID_FM_AUTO_TEST_START, ExitFMAutoTestStart, NULL, NULL);
if (mmi_frm_scrn_enter
(g_fm_gourp_id,
SCR_ID_FM_AUTO_TEST_START,
NULL,
mmi_fm_enter_quick_test_fm_radio,
MMI_FRM_FULL_SCRN) != MMI_TRUE)
{
return;
}
/* init volume */
g_fm_contxt->radio_contxt.g_fm_fm_radio_cntx.CurrVolume = 5;
mmi_fm_quick_test_init_freq();
/* Turn on FM Radio */
mdi_fmr_power_on_with_path( MDI_DEVICE_SPEAKER2, NULL, NULL);
g_fm_contxt->common_contxt.currentTest = FM_TEST_FM_RADIO;
#ifdef __TOPWELL_FM_NOT_TEST_FM_RADIO_START_100HZ__
if(g_fm_contxt->radio_contxt.g_fm_fm_radio_cntx.Currfreq<=1080&&g_fm_contxt->radio_contxt.g_fm_fm_radio_cntx.Currfreq>=1000)
#else
if(g_fm_contxt->radio_contxt.g_fm_fm_radio_cntx.Currfreq<=1080&&g_fm_contxt->radio_contxt.g_fm_fm_radio_cntx.Currfreq>=875)
#endif
{
EntryFMRADIOChannelQuickTest();
g_fm_contxt->radio_contxt.g_fm_fm_radio_cntx.Currfreq +=5;
StartTimer(FM_AUTO_TEST_COMMNON_TIMER, 600, FM_AutoTest_FM_RADIO);
}
else
{
StopTimer(FM_AUTO_TEST_COMMNON_TIMER);
#ifdef __MMI_FM_RADIO__
/* If FM Radio is turned on, then stop/turn-off it */
if (g_fm_contxt->radio_contxt.g_fm_fm_radio_cntx.is_FMRDO_on)
{
mdi_audio_stop_fmr();
g_fm_contxt->radio_contxt.g_fm_fm_radio_cntx.is_FMRDO_on = 0;
}
#endif
fm_radio_freq_is_init=0;
FM_Autotest_test_done_USC2string(Tests[FM_AUTOTEST_FM_RADIO].name);
ShowCategory7Screen(
STR_ID_FM_AUTO_TEST_RESULT,
NULL,//IMG_ID_FM_AUTO_TEST_ROOT,
STR_ID_FM_AUTO_TEST_PASS,
IMG_GLOBAL_OK,
STR_ID_FM_AUTO_TEST_FAIL,
IMG_GLOBAL_BACK,
(PU8) g_fm_contxt->common_contxt.EMFMUnicodeDisplayBuf,
NULL);
FM_Autotest_set_key_handlers(1);
}
}
void FM_AutoTest_FM_RADIO(void)
{
mmi_frm_scrn_close(g_fm_gourp_id, SCR_ID_FM_AUTO_TEST_START);
mmi_fm_enter_quick_test_fm_radio();
}
#endif
#ifdef __TOPWELL_FACTORYMODE_QUICK_BT__
#include "BtcmSrvGprot.h"
extern S32 srv_bt_cm_switch_on(void);
extern void srv_bt_cm_switch_off(void);
void FM_AutoTest_BT_Power_On(void)
{
// if (mmi_bt_is_bt_in_flight_mode())
{
if (srv_bt_cm_get_power_status() == SRV_BT_CM_POWER_ON)
return;
else
srv_bt_cm_switch_on();
}
}
void FM_AutoTest_BT_Power_Off(void)
{
if (srv_bt_cm_get_power_status() == SRV_BT_CM_POWER_ON)
srv_bt_cm_switch_off();
}
void mmi_fm_enter_quick_test_bt(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
//EntryNewScreen(SCR_ID_FM_AUTO_TEST_START, ExitFMAutoTestStart, NULL, NULL);
if (mmi_frm_scrn_enter
(g_fm_gourp_id,
SCR_ID_FM_AUTO_TEST_START,
NULL,
mmi_fm_enter_quick_test_bt,
MMI_FRM_FULL_SCRN) != MMI_TRUE)
{
return;
}
g_fm_contxt->common_contxt.currentTest = FM_TEST_BT;
switch (g_fm_contxt->common_contxt.sequence_counter)
{
case 0:
case 2:
mmi_fm_auto_test_common(NOSENDKEY_CNT_START_SHOW,(U8*)L"BlueTooth test",1000,FM_AutoTest_BT);
FM_AutoTest_BT_Power_On();
break;
case 1:
mmi_fm_auto_test_common(NOSENDKEY_CNT_START_SHOW,(U8*) L"BlueTooth test",1000,FM_AutoTest_BT);
FM_AutoTest_BT_Power_Off();
break;
default:
FM_Autotest_test_done_USC2string(Tests[FM_AUTOTEST_BT].name);
mmi_fm_auto_test_common(SENDKEY_UNCNT_STOP_SHOW,(U8*) g_fm_contxt->common_contxt.EMFMUnicodeDisplayBuf,0,NULL);
FM_AutoTest_BT_Power_Off();
}
}
void FM_AutoTest_BT(void)
{
mmi_frm_scrn_close(g_fm_gourp_id, SCR_ID_FM_AUTO_TEST_START);
mmi_fm_enter_quick_test_bt();
}
#endif
#define MMI_FM_QUICK_TEST_VERSION
static void mmi_fm_enter_quick_test_version(void);
void FM_AutoTest_Version(void)
{
mmi_frm_scrn_close(g_fm_gourp_id, SCR_ID_FM_AUTO_TEST_START);
mmi_fm_enter_quick_test_version();
}
#if defined(__TOPWELL_BASE_BUG__)
extern kal_char* topwell_release_verno(void) ;
#define TOPWELL_VERSION_DURATION 2000
static void mmi_fm_quick_test_get_structed_version_number(CHAR * str, CHAR * format)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U8 tempbuf[MAX_TEST_STRING_BUF * 2];
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
kal_wsprintf((WCHAR *) tempbuf, format, str);
mmi_ucs2cat((CHAR*) g_fm_contxt->version_contxt.UnicodeDisplayBuf, (const CHAR*)tempbuf);
}
#endif
/*****************************************************************************
* FUNCTION
* FM_AutoTest_Version
* DESCRIPTION
*
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void mmi_fm_enter_quick_test_version(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
#if defined(__MTK_TARGET__)
version_struct ver_struct;
#endif
#if defined(__TOPWELL_BASE_BUG__)
#ifdef __GADGET_SUPPORT__
U8 AsciiDisplayBuf[MAX_TEST_STRING_BUF];
U8 tempbuf[MAX_TEST_STRING_BUF * 2];
U8 gadgetTempbuf[WGTMGR_VERSION_MAX_LEN] = {0};
#endif /* __GADGET_SUPPORT__ */
S16 ErrorCode, Ret;
#ifdef __TOPWELL_MMI_BT_AND_FT_CODE_FLAG__
S16 error;
U8 bt_test_status = 0;
U8 bt_str[MAX_SUB_MENU_SIZE]={0};
U8 ft_test_status = 0;
U8 ft_str[MAX_SUB_MENU_SIZE]={0};
#endif
CHAR * str[7];
CHAR * format[7];
U32 i = 0;
mmi_fm_version_struct *version_cntx;
#endif
mmi_fm_common_struct *common_cntx;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
common_cntx = &(g_fm_contxt->common_contxt);
if (mmi_frm_scrn_enter
(g_fm_gourp_id,
SCR_ID_FM_AUTO_TEST_START,
NULL,
mmi_fm_enter_quick_test_version,
MMI_FRM_FULL_SCRN) != MMI_TRUE)
{
return;
}
common_cntx->currentTest = FM_TEST_SW_VERSION;
switch (common_cntx->sequence_counter)
{
case 0:
#if defined(__TOPWELL_BASE_BUG__) && defined(__MTK_TARGET__)
version_cntx = &(g_fm_contxt->version_contxt);
/* Get Barcode from Nvram */
if (version_cntx->gBarCodeReadFlag == 0)
{
Ret = ReadRecord(NVRAM_EF_BARCODE_NUM_LID, 1, version_cntx->gBarCode, 64, &ErrorCode);
if (!(ErrorCode == NVRAM_READ_SUCCESS && Ret == NVRAM_EF_BARCODE_NUM_SIZE) )
{
strcpy((CHAR*) version_cntx->gBarCode, "SN001234567");
}
version_cntx->gBarCodeReadFlag = 1;
}
INT_VersionNumbers(&ver_struct);
#ifdef __TOPWELL_MMI_BT_AND_FT_CODE_FLAG__
#if defined(__TOPWELL_MMI_BT_AND_FT_CODE_NEED_BOARD_TEST__) //必须板测通过
ReadValue(NVRAM_EF_BT_TEST_ID, &bt_test_status, DS_BYTE, &error);
if(bt_test_status!=0)
strcpy((CHAR*)bt_str, "Passed");
else
strcpy((CHAR*)bt_str, "");
if (strcmp((CHAR*)version_cntx->gBarCode, "SN001234567") == 0)
strcpy((CHAR*)ft_str, "");
else
strcpy((CHAR*)ft_str, "Passed");
#else //只需校准即可
if (strcmp((CHAR*)version_cntx->gBarCode, "SN001234567") == 0)
{
strcpy((CHAR*)bt_str, "");
strcpy((CHAR*)ft_str, "");
}
else
{
strcpy((CHAR*)bt_str, "Passed");
strcpy((CHAR*)ft_str, "Passed");
}
#endif
#endif
#if defined(__TOPWELL_FM_TEST_VERSION_SLIM__)
#ifdef __TOPWELL_MMI_BT_AND_FT_CODE_FLAG__
str[0] = (CHAR*)bt_str;
str[1] = (CHAR*)ft_str;
str[2] = (CHAR*) version_cntx->gBarCode;
str[3] = NULL;
str[4] = NULL;
str[5] = NULL;
str[6] = NULL;
format[0] = "[BT]: %s\n";
format[1] = "[FT]: %s\n";
format[2] = "SERIAL#: %s\n";
format[3] = "";
format[4] = "";
format[5] = "";
format[6] = "";
#else
str[0] = (CHAR*) version_cntx->gBarCode;
str[1] = NULL;
str[2] = NULL;
str[3] = NULL;
str[4] = NULL;
str[5] = NULL;
str[6] = NULL;
format[0] = "SERIAL#: %s\n";
format[1] = "";
format[2] = "";
format[3] = "";
format[4] = "";
format[5] = "";
format[6] = "";
#endif
#else
str[0] = (CHAR*) ver_struct.mcu_sw_branch;
str[1] = (CHAR*) release_build();
str[2] = (CHAR*) version_cntx->gBarCode;
str[3] = NULL;
#if defined(__TOPWELL_BASE_BUG__)
str[4] = (CHAR*) topwell_build_date_time();
#else
str[4] = (CHAR*) build_date_time();
#endif
#ifdef __MRE_CORE_BASE__
str[5] = (CHAR*) vm_get_mre_version();
#else
str[5] = NULL;
#endif
str[6] = (CHAR *)release_hal_verno();
format[0] = " %s\n";
format[1] = "BUILD: %s\n";
format[2] = "SERIAL#: %s\n";
format[3] = "[BUILD TIME] \n";
format[4] = "%s\n";
#ifdef __MRE_CORE_BASE__
format[5] = "[MRE VERSION] %d\n";
#else
format[5] = "";
#endif
format[6] = "HAL_VERNO: %s\n";
#endif
//TOPWELL Fuz modified on 2013-03-14 start:
#if defined(__TOPWELL_BASE_BUG__)
#if defined(__TOPWELL_FM_TEST_VERSION_SLIM__)
kal_wsprintf((WCHAR *)version_cntx->UnicodeDisplayBuf ,
"[VERSION] %s\n",(CHAR*) topwell_release_verno());
#else
kal_wsprintf((WCHAR *)version_cntx->UnicodeDisplayBuf ,
"[VERSION] %s\n[BRANCH]:",(CHAR*) topwell_release_verno());
#endif
#else
kal_wsprintf((WCHAR *)version_cntx->UnicodeDisplayBuf ,
"[VERSION] %s\n[BRANCH]:",(CHAR*) ver_struct.mcu_sw);
#endif
//TOPWELL Fuz modified on 2013-03-14 end
for (i = 0; i<7; i++)
{
mmi_fm_quick_test_get_structed_version_number(str[i],format[i]);
}
#ifdef __GADGET_SUPPORT__
/* Add one more item to show gadget engine version */
sprintf((CHAR*) AsciiDisplayBuf, "[GADGET ENGINE] \n");
mmi_asc_to_ucs2((CHAR*) tempbuf, (CHAR*) AsciiDisplayBuf);
mmi_ucs2cat((CHAR*) version_cntx->UnicodeDisplayBuf, (const CHAR*)tempbuf);
/* Get gadget engine version */
srv_wgtmgr_get_engine_version(gadgetTempbuf);
sprintf((CHAR*) AsciiDisplayBuf, "%s\n", gadgetTempbuf);
mmi_asc_to_ucs2((CHAR*) tempbuf, (CHAR*) AsciiDisplayBuf);
mmi_ucs2cat((CHAR*) version_cntx->UnicodeDisplayBuf, (const CHAR*)tempbuf);
#endif /* __GADGET_SUPPORT__ */
mmi_ucs2cpy((CHAR*) common_cntx->EMFMUnicodeDisplayBuf, (CHAR*) version_cntx->UnicodeDisplayBuf);
#else
#if defined(__MTK_TARGET__)
/* Get sturctured version number */
INT_VersionNumbers(&ver_struct);
/* MCU (SW Ver.) */
memcpy(common_cntx->EMFMAsciiDisplayBuf, (CHAR*) ver_struct.mcu_sw, MAX_TEST_STRING_BUF - 2);
mmi_asc_to_ucs2((CHAR*) common_cntx->EMFMUnicodeDisplayBuf, (CHAR*) g_fm_contxt->common_contxt.EMFMAsciiDisplayBuf);
#else /* defined(__MTK_TARGET__)) */
/* For PC Simulatior */
mmi_asc_to_ucs2((CHAR*) common_cntx->EMFMUnicodeDisplayBuf, (CHAR*) "MTK_SW.V0");
#endif /* defined(__MTK_TARGET__)) */
#endif
#if defined(__TOPWELL_BASE_BUG__)
mmi_fm_auto_test_common(SENDKEY_CNT_START_SHOW, (U8*)common_cntx->EMFMUnicodeDisplayBuf,TOPWELL_VERSION_DURATION,FM_AutoTest_Version);
#else
mmi_fm_auto_test_common(SENDKEY_CNT_START_SHOW, (U8*)common_cntx->EMFMUnicodeDisplayBuf,VERSION_DURATION,FM_AutoTest_Version);
#endif
break;
default:
FM_Autotest_test_done_USC2string(Tests[FM_AUTOTEST_VERSION].name);
mmi_fm_auto_test_common(SENDKEY_UNCNT_STOP_SHOW, (U8*)common_cntx->EMFMUnicodeDisplayBuf,0,NULL);
}
}
#define MMI_FM_QUICK_TEST_BACKLIGHT
static void mmi_fm_enter_quick_test_backlight(void);
void FM_AutoTest_Backlight(void)
{
mmi_frm_scrn_close(g_fm_gourp_id, SCR_ID_FM_AUTO_TEST_START);
mmi_fm_enter_quick_test_backlight();
}
/*****************************************************************************
* FUNCTION
* FM_AutoTest_Backlight
* DESCRIPTION
*
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void mmi_fm_enter_quick_test_backlight(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
// EntryNewScreen(SCR_ID_FM_AUTO_TEST_START, ExitFMAutoTestStart, NULL, NULL);
if (mmi_frm_scrn_enter
(g_fm_gourp_id,
SCR_ID_FM_AUTO_TEST_START,
NULL,
mmi_fm_enter_quick_test_backlight,
MMI_FRM_FULL_SCRN) != MMI_TRUE)
{
return;
}
g_fm_contxt->common_contxt.currentTest = FM_TEST_BACKLIGHT;
switch (g_fm_contxt->common_contxt.sequence_counter)
{
case 0:
mmi_fm_auto_test_common(NOSENDKEY_CNT_START_SHOW,(U8*) GetString(STR_ID_FM_AUTOTEST_BACKLIGHT),BACKLIGHT_DURATION,FM_AutoTest_Backlight);
break;
case 1:
FM_SetGpioReq(GPIO_DEV_LED_MAINLCD, LED_LIGHT_LEVEL0);
FM_SetGpioReq(GPIO_DEV_LED_KEY, LED_LIGHT_LEVEL0);
mmi_fm_auto_test_common(NOSENDKEY_CNT_START_SHOW,(U8*) GetString(STR_ID_FM_AUTOTEST_BACKLIGHT),BACKLIGHT_DURATION,FM_AutoTest_Backlight);
break;
case 2:
FM_SetGpioReq(GPIO_DEV_LED_MAINLCD, LED_LIGHT_LEVEL5);
mmi_fm_auto_test_common(NOSENDKEY_CNT_START_SHOW,(U8*) GetString(STR_ID_FM_AUTOTEST_BACKLIGHT),BACKLIGHT_DURATION,FM_AutoTest_Backlight);
break;
case 3:
FM_SetGpioReq(GPIO_DEV_LED_MAINLCD, LED_LIGHT_LEVEL0);
FM_SetGpioReq(GPIO_DEV_LED_KEY, LED_LIGHT_LEVEL5);
mmi_fm_auto_test_common(NOSENDKEY_CNT_START_SHOW,(U8*) GetString(STR_ID_FM_AUTOTEST_BACKLIGHT),BACKLIGHT_DURATION,FM_AutoTest_Backlight);
break;
default:
FM_SetGpioReq(GPIO_DEV_LED_MAINLCD, LED_LIGHT_LEVEL5);
FM_SetGpioReq(GPIO_DEV_LED_KEY, LED_LIGHT_LEVEL0);
FM_Autotest_test_done_USC2string(Tests[FM_AUTOTEST_BACKLIGHT].name);
mmi_fm_auto_test_common(SENDKEY_UNCNT_STOP_SHOW,(U8*)g_fm_contxt->common_contxt.EMFMUnicodeDisplayBuf,0,NULL);
}
}
#define MMI_FM_QUICK_TEST_KEYPAD
/*****************************************************************************
* FUNCTION
* FM_AutoTest_Keypad
* DESCRIPTION
*
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void FM_AutoTest_Keypad(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
mmi_fm_common_struct *common_cntx;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
common_cntx = &(g_fm_contxt->common_contxt);
#ifdef __MMI_FM_KEYPAD_TEST__
common_cntx->currentTest = FM_TEST_KEYPAD;
mmi_fm_select_keypad_test();
#else
g_fm_nvramTestResultArray.result[common_cntx->currTestItem] = FM_TEST_PASSED;
common_cntx->currTestItem++;
mmi_fm_WriteTestResultToNVRAM();
EntryFMAutoTestStart();
#endif
}
#define MMI_FM_QUICK_TEST_LCD
#ifndef __MMI_MAINLCD_96X64__
/*****************************************************************************
* FUNCTION
* FM_AutoTest_LCD
* DESCRIPTION
*
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void FM_AutoTest_LCD(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
g_fm_contxt->common_contxt.currentTest = FM_TEST_LCD;
g_fm_contxt->common_contxt.sequence_counter = 0;
mmi_fm_handle_color_set_change();
}
#endif /* __MMI_MAINLCD_96X64__ */
#define MMI_FM_QUICK_TEST_RECEIVER
static void mmi_fm_enter_quick_test_receiver(void);
void FM_AutoTest_Receiver(void)
{
mmi_frm_scrn_close(g_fm_gourp_id, SCR_ID_FM_AUTO_TEST_START);
mmi_fm_enter_quick_test_receiver();
}
/*****************************************************************************
* FUNCTION
* FM_AutoTest_Receiver
* DESCRIPTION
*
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void mmi_fm_enter_quick_test_receiver(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
mmi_fm_common_struct *common_cntx;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
common_cntx = &(g_fm_contxt->common_contxt);
if (mmi_frm_scrn_enter
(g_fm_gourp_id,
SCR_ID_FM_AUTO_TEST_START,
NULL,
mmi_fm_enter_quick_test_receiver,
MMI_FRM_FULL_SCRN) != MMI_TRUE)
{
return;
}
common_cntx->currentTest = FM_TEST_RECEIVER;
FM_SendStopAudioReq(0);
//Media_Stop();
g_fm_contxt->eachloop_contxt.ReceiverTestOn = TRUE;
FM_SendSetAudioModeReq(AUD_MODE_NORMAL);
/* play 1K tone */
TONE_SetOutputVolume(255, 6);
mdi_audio_play_id(TONE_KEY_NORMAL, DEVICE_AUDIO_PLAY_INFINITE);
if(0 == common_cntx->sequence_counter)
{
mmi_fm_auto_test_common(NOSENDKEY_CNT_START_SHOW,(U8*) GetString(STR_ID_FM_AUTOTEST_RECEIVER),RECEIVER_DURATION,FM_AutoTest_Receiver);
}
else
{
g_fm_contxt->eachloop_contxt.ReceiverTestOn = FALSE;
FM_SendSetAudioModeReq(AUD_MODE_NORMAL);
/* stop 1K tone */
mdi_audio_stop_id(TONE_KEY_NORMAL);
FM_Autotest_test_done_USC2string(Tests[FM_AUTOTEST_RECEIVER].name);
mmi_fm_auto_test_common(SENDKEY_UNCNT_STOP_SHOW,(U8*)common_cntx->EMFMUnicodeDisplayBuf,0,NULL);
}
}
#define MMI_FM_QUICK_TEST_MIC
void mmi_fm_enter_quick_test_mic(void);
void FM_AutoTest_MIC(void)
{
mmi_frm_scrn_close(g_fm_gourp_id, SCR_ID_FM_AUTO_TEST_START);
mmi_fm_enter_quick_test_mic();
}
/*****************************************************************************
* FUNCTION
* FM_AutoTest_MIC
* DESCRIPTION
*
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void mmi_fm_enter_quick_test_mic(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
mmi_fm_common_struct *common_cntx;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
// EntryNewScreen(SCR_ID_FM_AUTO_TEST_START, ExitFMAutoTestStart, NULL, NULL);
common_cntx = &(g_fm_contxt->common_contxt);
if (mmi_frm_scrn_enter
(g_fm_gourp_id,
SCR_ID_FM_AUTO_TEST_START,
NULL,
mmi_fm_enter_quick_test_mic,
MMI_FRM_FULL_SCRN) != MMI_TRUE)
{
return;
}
common_cntx->currentTest = (U8)FM_TEST_MIC;
FM_SendStopAudioReq(0);
//Media_Stop();
g_fm_contxt->eachloop_contxt.EchoLoopTestOn = MMI_TRUE;
#if !defined(__TOPWELL_FM_ECHOLOOP_BY_HEADSET__)
/*??????*/
FM_SendSetAudioModeReq(AUD_MODE_LOUDSPK);
/* open loopback */
kal_sleep_task(kal_milli_secs_to_ticks(100));
L1SP_SetOutputVolume(1,0);
#else
/*??????*/
FM_SendSetAudioModeReq(AUD_MODE_NORMAL);
/* open loopback */
kal_sleep_task(kal_milli_secs_to_ticks(100));
L1SP_SetOutputVolume(255,6);
#endif
//mmi_fm_set_loopback(MMI_TRUE);
aud_util_proc_in_med(MOD_MMI,
mmi_fm_set_loopback,
MMI_TRUE,
NULL);
switch (common_cntx->sequence_counter)
{
case 0:
mmi_fm_auto_test_common(NOSENDKEY_CNT_START_SHOW,(U8*) GetString(STR_ID_FM_AUTOTEST_MIC),MIC_DURATION,FM_AutoTest_MIC);
break;
default:
FM_Autotest_test_done_USC2string(Tests[FM_AUTOTEST_MIC].name);
mmi_fm_auto_test_common(SENDKEY_UNCNT_STOP_SHOW,(U8*)common_cntx->EMFMUnicodeDisplayBuf,0,NULL);
g_fm_contxt->eachloop_contxt.EchoLoopTestOn = MMI_FALSE;
/* close loopback */
//mmi_fm_set_loopback(MMI_FALSE);
aud_util_proc_in_med(MOD_MMI,
mmi_fm_set_loopback,
MMI_FALSE,
NULL);
}
}
#define MMI_FM_QUICK_TEST_SPEAKER
void mmi_fm_enter_quick_test_speaker(void);
void FM_AutoTest_Speaker(void)
{
mmi_frm_scrn_close(g_fm_gourp_id, SCR_ID_FM_AUTO_TEST_START);
mmi_fm_enter_quick_test_speaker();
}
/*****************************************************************************
* FUNCTION
* FM_AutoTest_Speaker
* DESCRIPTION
*
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void mmi_fm_enter_quick_test_speaker(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
mmi_fm_common_struct *common_cntx;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
//EntryNewScreen(SCR_ID_FM_AUTO_TEST_START, ExitFMAutoTestStart, NULL, NULL);
common_cntx = &(g_fm_contxt->common_contxt);
if (mmi_frm_scrn_enter
(g_fm_gourp_id,
SCR_ID_FM_AUTO_TEST_START,
NULL,
mmi_fm_enter_quick_test_speaker,
MMI_FRM_FULL_SCRN) != MMI_TRUE)
{
return;
}
common_cntx->currentTest = FM_TEST_SPEAKER;
FM_SendStopAudioReq(0);
g_fm_contxt->loudspk_contxt.LoudSpkTestOn = MMI_TRUE;
FM_SendSetAudioModeReq(AUD_MODE_LOUDSPK);
kal_sleep_task(kal_milli_secs_to_ticks(800));
// play 1K tone
TONE_SetOutputVolume(255, 0);
mdi_audio_play_id(TONE_KEY_NORMAL, DEVICE_AUDIO_PLAY_INFINITE);
switch (common_cntx->sequence_counter)
{
case 0:
mmi_fm_auto_test_common(NOSENDKEY_CNT_START_SHOW,(U8*) GetString(STR_ID_FM_AUTOTEST_SPEAKER),SPEAKER_DURATION,FM_AutoTest_Speaker);
break;
default:
FM_Autotest_test_done_USC2string(Tests[FM_AUTOTEST_SPEAKER].name);
mmi_fm_auto_test_common(SENDKEY_UNCNT_STOP_SHOW,(U8*)common_cntx->EMFMUnicodeDisplayBuf,0,NULL);
g_fm_contxt->loudspk_contxt.LoudSpkTestOn = MMI_FALSE;
FM_SendSetAudioModeReq(AUD_MODE_NORMAL);
/* stop 1K tone */
mdi_audio_stop_id(TONE_KEY_NORMAL);
break;
}
}
#if !defined(__TOPWELL_FM_NOT_TEST_HEADSET__)
#define MMI_FM_QUICK_TEST_HEADSET
void mmi_fm_enter_quick_test_headset(void);
void FM_AutoTest_Headset(void)
{
mmi_frm_scrn_close(g_fm_gourp_id, SCR_ID_FM_AUTO_TEST_START);
mmi_fm_enter_quick_test_headset();
}
/*****************************************************************************
* FUNCTION
* FM_AutoTest_Headset
* DESCRIPTION
*
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void mmi_fm_enter_quick_test_headset(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
mmi_fm_common_struct *common_cntx;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
// EntryNewScreen(SCR_ID_FM_AUTO_TEST_START, ExitFMAutoTestStart, NULL, NULL);
common_cntx = &(g_fm_contxt->common_contxt);
if (mmi_frm_scrn_enter
(g_fm_gourp_id,
SCR_ID_FM_AUTO_TEST_START,
NULL,
mmi_fm_enter_quick_test_headset,
MMI_FRM_FULL_SCRN) != MMI_TRUE)
{
return;
}
common_cntx->currentTest = FM_TEST_HEADSET;
FM_SendStopAudioReq(0);
//Media_Stop();
g_fm_contxt->eachloop_contxt.HeadsetTestOn = TRUE;
FM_SendSetAudioModeReq(AUD_MODE_HEADSET);
// open loopback
kal_sleep_task(kal_milli_secs_to_ticks(800));
//mmi_fm_set_loopback(MMI_TRUE);
TONE_SetOutputVolume(255, 6);
aud_util_proc_in_med(MOD_MMI,
mmi_fm_set_loopback,
MMI_TRUE,
NULL);
switch (common_cntx->sequence_counter)
{
case 0:
mmi_fm_auto_test_common(NOSENDKEY_CNT_START_SHOW,(U8*) GetString(STR_ID_FM_AUTOTEST_HEADSET),HEADSET_DURATION,FM_AutoTest_Headset);
break;
default:
FM_Autotest_test_done_USC2string(Tests[FM_AUTOTEST_HEADSET].name);
g_fm_contxt->eachloop_contxt.HeadsetTestOn = FALSE;
/* set headset mode */
FM_SendSetAudioModeReq(AUD_MODE_NORMAL);
/* close loopback */
kal_sleep_task(kal_milli_secs_to_ticks(800));
//mmi_fm_set_loopback(MMI_FALSE);
aud_util_proc_in_med(MOD_MMI,
mmi_fm_set_loopback,
MMI_FALSE,
NULL);
mmi_fm_auto_test_common(SENDKEY_CNT_STOP_SHOW,(U8*)common_cntx->EMFMUnicodeDisplayBuf,0,NULL);
}
}
#endif
/*****************************************************************************
* FUNCTION
* FM_AutoTestUpdateADCHdlr
* DESCRIPTION
*
* PARAMETERS
* inMsg [?]
* RETURNS
* void
*****************************************************************************/
void FM_AutoTestUpdateADCHdlr(void *inMsg)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
double vbat, temp;
mmi_eq_adc_all_channel_ind_struct *adc_struct = (mmi_eq_adc_all_channel_ind_struct*) inMsg;
mmi_fm_common_struct *common_cntx;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
common_cntx = &(g_fm_contxt->common_contxt);
vbat = ((double)adc_struct->vbat) / 1000000.0;
temp = ((double)adc_struct->bat_temp) / 1000.0;
if (vbat < VBAT_LOWER_BOUNDARY || vbat > VBAT_UPPER_BOUNDARY)
{
sprintf(
(CHAR*) common_cntx->EMFMAsciiDisplayBuf,
"%s%4.2f V\nValid Range:\n%4.2f V - %4.2f V\n\nsuggest: FAIL",
"vbat=",
vbat,
VBAT_LOWER_BOUNDARY,
VBAT_UPPER_BOUNDARY);
}
else if (temp < TEMP_LOWER_BOUNDARY || temp > TEMP_UPPER_BOUNDARY)
{
sprintf(
(CHAR*) common_cntx->EMFMAsciiDisplayBuf,
"%s%4.2f C\nValid Range:\n%d C - %d C\n\nsuggest: FAIL",
"temp=",
temp,
TEMP_LOWER_BOUNDARY,
TEMP_UPPER_BOUNDARY);
}
else
{
sprintf((CHAR*) common_cntx->EMFMAsciiDisplayBuf, "BATTERY OK!");
}
mmi_asc_to_ucs2((CHAR *) common_cntx->EMFMUnicodeDisplayBuf, (CHAR*) common_cntx->EMFMAsciiDisplayBuf);
mmi_frm_scrn_enter
(g_fm_gourp_id,
GLOBAL_SCR_DUMMY,
NULL,
NULL,
MMI_FRM_FULL_SCRN);
mmi_frm_scrn_close_active_id();
mmi_frm_set_single_protocol_event_handler(MSG_ID_MMI_EQ_ADC_ALL_CHANNEL_IND,
NULL);
mmi_frm_set_single_protocol_event_handler(PRT_BATTERY_STATUS_IND,
(PsIntFuncPtr)BatteryStatusRsp);
FM_SendADCStopReq();
}
#if defined(__TOPWELL_FM_TEST_BATTERY__)
#define MMI_FM_QUICK_TEST_BATTERY_CHARGER
void mmi_fm_autotest_battery_charger()
{
switch (g_fm_contxt->common_contxt.sequence_counter)
{
case 0:
mmi_fm_auto_test_common(NOSENDKEY_CNT_START_HIDE,0,ADC_DURATION,mmi_fm_autotest_battery_charger);
break;
default:
mmi_fm_auto_test_common(SENDKEY_UNCNT_STOP_HIDE,0,0,NULL);
}
}
static void mmi_fm_enter_quick_test_battery(void);
/*****************************************************************************
* FUNCTION
* FM_AutoTest_Battery
* DESCRIPTION
*
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void FM_AutoTest_Battery(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
g_fm_contxt->common_contxt.currentTest = FM_TEST_BATTERY;
mmi_frm_set_single_protocol_event_handler(MSG_ID_MMI_EQ_ADC_ALL_CHANNEL_IND,
(PsIntFuncPtr)FM_AutoTestUpdateADCHdlr);
FM_SendADCStartReq();
mmi_frm_scrn_close(g_fm_gourp_id, SCR_ID_FM_AUTO_TEST_START);
mmi_fm_enter_quick_test_battery();
}
static void mmi_fm_enter_quick_test_battery(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
mmi_fm_common_struct *common_cntx = &(g_fm_contxt->common_contxt);
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (mmi_frm_scrn_enter
(g_fm_gourp_id,
SCR_ID_FM_AUTO_TEST_START,
NULL,
mmi_fm_enter_quick_test_battery,
MMI_FRM_FULL_SCRN) != MMI_TRUE)
{
return;
}
ShowCategory7Screen(
STR_ID_FM_AUTO_TEST_RESULT,
NULL,//IMG_ID_FM_AUTO_TEST_ROOT,
STR_ID_FM_AUTO_TEST_PASS,
IMG_GLOBAL_OK,
STR_ID_FM_AUTO_TEST_FAIL,
IMG_GLOBAL_BACK,
(PU8) common_cntx->EMFMUnicodeDisplayBuf,
NULL);
mmi_fm_autotest_battery_charger();
}
#endif
#if defined(__TOPWELL_FM_TEST_CHARGE__)
#define MMI_FM_QUICK_TEST_CHARGER
#if defined(__TOPWELL_FM_TEST_CHARGE_MODE2__)
extern void BatteryStatusRsp(void *);
extern void FM_SendADCStopReq(void);
#define TOPWELL_MAX_ADC_MAP_TAB_SIZE 5 /* size of adc_map_tab */
typedef struct
{
DCL_ADC_CHANNEL_TYPE_ENUM type;
CHAR format[15];
double adc_value;
MMI_ID str_id;
}topwell_mmi_fm_adc_view_struct;
/*This table is for showing ADC menu list*/
topwell_mmi_fm_adc_view_struct topwell_adc_map_tab[5]=
{
{DCL_VBAT_ADC_CHANNEL, "%s %4.3f V", 0.0, STR_ID_FM_VBAT},
{DCL_VBATTMP_ADC_CHANNEL, "%s %4.3f C", 0.0, STR_ID_FM_BTEMP},
{DCL_AUX_ADC_CHANNEL, "%s %4.3f V", 0.0, STR_ID_FM_VAUX},
{DCL_VISENSE_ADC_CHANNEL, "%s %4.3f A", 0.0, STR_ID_FM_CURRENT},
{DCL_VCHARGER_ADC_CHANNEL, "%s %4.3f V", 0.0, STR_ID_FM_VCHGR},
};
static void topwell_mmi_fm_stop_adc(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
mmi_frm_set_protocol_event_handler(MSG_ID_MMI_EQ_ADC_ALL_CHANNEL_IND, NULL, MMI_FALSE);
mmi_frm_set_protocol_event_handler(PRT_BATTERY_STATUS_IND, (PsIntFuncPtr)BatteryStatusRsp, MMI_FALSE);
FM_SendADCStopReq();
mmi_frm_scrn_close_active_id();
}
static void topwell_mmi_fm_pass_adc(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
topwell_mmi_fm_stop_adc();
FM_Handle_Pass_Key_Press();
}
static void topwell_mmi_fm_fail_adc(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
topwell_mmi_fm_stop_adc();
FM_Handle_Fail_Key_Press();
}
static void topwell_mmi_fm_update_adc(char * str, double adc_value, MMI_ID srt_id, U32 i)
{
CHAR buffer[32];
CHAR strr[20];
mmi_ucs2_to_asc(strr,GetString(srt_id));
sprintf(buffer, str, strr, adc_value);
mmi_asc_to_ucs2((CHAR *) subMenuData[i], buffer);
subMenuDataPtrs[i] = subMenuData[i];
}
static void topwell_mmi_fm_update_adc_hdlr(void *inMsg)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U32 i = 0,j = 0;
mmi_eq_adc_all_channel_ind_struct *adc_struct = (mmi_eq_adc_all_channel_ind_struct*) inMsg;
MMI_ID gid;
MMI_ID sid;
DCL_HANDLE adc_handle;
ADC_CTRL_GET_PHYSICAL_CHANNEL_T adc_ch;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* update adc_value */
topwell_adc_map_tab[0].adc_value = (double)adc_struct->vbat / 1000000.0+0.04;
topwell_adc_map_tab[1].adc_value = (double)adc_struct->bat_temp / 1000.0;
topwell_adc_map_tab[2].adc_value = (double)adc_struct->vaux / 1000000.0;
topwell_adc_map_tab[3].adc_value = (double)adc_struct->charge_current / 1000000.0;
topwell_adc_map_tab[4].adc_value = (double)adc_struct->vcharge / 1000000.0;
mmi_frm_get_active_scrn_id(&gid,&sid);
if (sid != SCR_ID_FM_ADC)
{
return;
}
adc_handle = DclSADC_Open(DCL_ADC, FLAGS_NONE);
if(adc_handle == DCL_HANDLE_INVALID)
{
ASSERT(0);
}
for (i=0,j=0; i<TOPWELL_MAX_ADC_MAP_TAB_SIZE; i++)
{
adc_ch.u2AdcName = topwell_adc_map_tab[i].type;
DclSADC_Control(adc_handle, ADC_CMD_GET_CHANNEL, (DCL_CTRL_DATA_T *)&adc_ch);
if (adc_ch.u1AdcPhyCh != DCL_ADC_ERR_CHANNEL_NO)
{
if (((adc_struct->charge_current) & 0x80000000) &&
topwell_adc_map_tab[i].type == DCL_VISENSE_ADC_CHANNEL)
{
memcpy(topwell_adc_map_tab[i].format, "%s n/a", 7); // This is a special condition
}
else if (topwell_adc_map_tab[i].type == DCL_VISENSE_ADC_CHANNEL)
{
memcpy(topwell_adc_map_tab[i].format, "%s %4.3f A", 13);
}
topwell_mmi_fm_update_adc(topwell_adc_map_tab[i].format,topwell_adc_map_tab[i].adc_value,topwell_adc_map_tab[i].str_id,j);
j++;
}
}
DclSADC_Close(adc_handle);
ShowCategory6Screen(
STR_ID_FM_ADC,
0,
STR_ID_FM_AUTO_TEST_PASS,
IMG_GLOBAL_OK,
STR_ID_FM_AUTO_TEST_FAIL,
IMG_GLOBAL_BACK,
g_fm_contxt->adc_contxt.gFM_MenuItemNum,
(PU8*) subMenuDataPtrs,
NULL,
0,
NULL);
PowerAndEndKeyHandler();
SetLeftSoftkeyFunction(topwell_mmi_fm_pass_adc, KEY_EVENT_UP);
SetRightSoftkeyFunction(topwell_mmi_fm_fail_adc, KEY_EVENT_UP);
}
static void topwell_mmi_fm_prepare_adc_list(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U32 i = 0, j = 0;
U8 * MenuItemNum;
DCL_HANDLE adc_handle;
ADC_CTRL_GET_PHYSICAL_CHANNEL_T adc_ch;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
MenuItemNum = &(g_fm_contxt->adc_contxt.gFM_MenuItemNum);
*MenuItemNum = 0;
adc_handle = DclSADC_Open(DCL_ADC, FLAGS_NONE);
if(adc_handle == DCL_HANDLE_INVALID)
{
ASSERT(0);
}
for (i=0,j=0; i<TOPWELL_MAX_ADC_MAP_TAB_SIZE; i++)
{
adc_ch.u2AdcName = topwell_adc_map_tab[i].type;
DclSADC_Control(adc_handle, ADC_CMD_GET_CHANNEL, (DCL_CTRL_DATA_T *)&adc_ch);
if (adc_ch.u1AdcPhyCh != DCL_ADC_ERR_CHANNEL_NO)
{
topwell_mmi_fm_update_adc("%s %4.2f",topwell_adc_map_tab[i].adc_value,topwell_adc_map_tab[i].str_id,j);
j++;
(*MenuItemNum)++;
}
}
DclSADC_Close(adc_handle);
}
static void topwell_mmi_fm_enter_adc_menu(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U8 *guiBuffer;
U8 * MenuItemNum;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
MenuItemNum = &(g_fm_contxt->adc_contxt.gFM_MenuItemNum);
mmi_frm_scrn_enter
(g_fm_gourp_id,
SCR_ID_FM_ADC,
NULL,
topwell_mmi_fm_enter_adc_menu,
MMI_FRM_FULL_SCRN);
guiBuffer = mmi_frm_scrn_get_active_gui_buf();
#ifdef __MTK_TARGET__
topwell_mmi_fm_prepare_adc_list();
#endif
if (*MenuItemNum < 1)
{
*MenuItemNum = 0;
}
ShowCategory6Screen(
STR_ID_FM_ADC,
0,
STR_ID_FM_AUTO_TEST_PASS,
IMG_GLOBAL_OK,
STR_ID_FM_AUTO_TEST_FAIL,
IMG_GLOBAL_BACK,
*MenuItemNum,
(PU8*) subMenuDataPtrs,
NULL,
0,
guiBuffer);
//SetKeyHandler(FM_ReTest, KEY_SEND, KEY_EVENT_DOWN);
PowerAndEndKeyHandler();
SetLeftSoftkeyFunction(topwell_mmi_fm_pass_adc, KEY_EVENT_UP);
SetRightSoftkeyFunction(topwell_mmi_fm_fail_adc, KEY_EVENT_UP);
}
void FM_AutoTest_Charge(void)
{
mmi_frm_set_protocol_event_handler(MSG_ID_MMI_EQ_ADC_ALL_CHANNEL_IND,
(PsIntFuncPtr)topwell_mmi_fm_update_adc_hdlr, MMI_FALSE);
FM_SendADCStartReq();
topwell_mmi_fm_enter_adc_menu();
}
#else
void FM_AutoTestUpdateChargeHdlr(void *inMsg)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
double charge_current;
mmi_eq_adc_all_channel_ind_struct *adc_struct = (mmi_eq_adc_all_channel_ind_struct*) inMsg;
mmi_fm_common_struct *common_cntx;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
common_cntx = &(g_fm_contxt->common_contxt);
memset(common_cntx->FMChargeDisplayBuffer, 0, sizeof(common_cntx->FMChargeDisplayBuffer));
charge_current = ((double)adc_struct->charge_current) / 1000000.0;
if (charge_current < CURR__LOWER_BOUNDARY )
{
sprintf(
(CHAR*) common_cntx->EMFMAsciiDisplayBuf,
"%s%4.2f A\nMust be at least%4.2f A\n\nsuggest: FAIL\nSendkey: Reset\nEndkey: Exit",
"current=",
charge_current,
CURR__LOWER_BOUNDARY);
}
else
{
sprintf(
(CHAR*) common_cntx->EMFMAsciiDisplayBuf,
"CHARGE OK!\nSendkey: Reset\nEndkey: Exit");
}
mmi_asc_to_ucs2((CHAR *) common_cntx->FMChargeDisplayBuffer, (CHAR*) common_cntx->EMFMAsciiDisplayBuf);
mmi_frm_scrn_enter
(g_fm_gourp_id,
GLOBAL_SCR_DUMMY,
NULL,
NULL,
MMI_FRM_FULL_SCRN);
mmi_frm_scrn_close_active_id();
mmi_frm_set_protocol_event_handler(MSG_ID_MMI_EQ_ADC_ALL_CHANNEL_IND,
NULL, MMI_FALSE);
mmi_frm_set_protocol_event_handler(PRT_BATTERY_STATUS_IND,
(PsIntFuncPtr)BatteryStatusRsp, MMI_FALSE);
FM_SendADCStopReq();
}
void mmi_fm_autotest_charger()
{
switch (g_fm_contxt->common_contxt.sequence_counter)
{
case 0:
mmi_fm_auto_test_common(NOSENDKEY_CNT_START_HIDE,0,ADC_DURATION,mmi_fm_autotest_charger);
break;
default:
mmi_fm_auto_test_common(SENDKEY_UNCNT_STOP_HIDE,0,0,NULL);
}
}
static void mmi_fm_enter_quick_test_charge(void);
void FM_AutoTest_Entry_Charge(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
mmi_fm_common_struct *common_cntx = &(g_fm_contxt->common_contxt);
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
mmi_frm_scrn_close_active_id();
StopTimer(FM_AUTO_TEST_COMMNON_TIMER);
FM_SendADCStartReq();
mmi_frm_scrn_close(g_fm_gourp_id, SCR_ID_FM_AUTO_TEST_START);
mmi_fm_enter_quick_test_charge();
}
void FM_AutoTest_Charge(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
PS8 buffer;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
g_fm_contxt->common_contxt.currentTest = FM_TEST_CHARGE;
mmi_frm_set_protocol_event_handler(MSG_ID_MMI_EQ_ADC_ALL_CHANNEL_IND,
(PsIntFuncPtr)FM_AutoTestUpdateChargeHdlr, MMI_FALSE);
mmi_frm_scrn_enter
(g_fm_gourp_id,
GLOBAL_SCR_DUMMY,
NULL,
FM_AutoTest_Charge,
MMI_FRM_FULL_SCRN);
mmi_ucs2cpy((CHAR *)buffer, (CHAR *)L"Charger");
ShowCategory7Screen(
STR_ID_FM_AUTO_TEST_RESULT,
NULL,//IMG_ID_FM_AUTO_TEST_ROOT,
STR_ID_FM_AUTO_TEST_PASS,
IMG_GLOBAL_OK,
STR_ID_FM_AUTO_TEST_FAIL,
IMG_GLOBAL_BACK,
(PU8) buffer,
NULL);
StartTimer(FM_AUTO_TEST_COMMNON_TIMER, 1000, FM_AutoTest_Entry_Charge);
}
static void mmi_fm_enter_quick_test_charge(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
mmi_fm_common_struct *common_cntx = &(g_fm_contxt->common_contxt);
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (mmi_frm_scrn_enter
(g_fm_gourp_id,
SCR_ID_FM_AUTO_TEST_START,
NULL,
mmi_fm_enter_quick_test_charge,
MMI_FRM_FULL_SCRN) != MMI_TRUE)
{
return;
}
ShowCategory7Screen(
STR_ID_FM_AUTO_TEST_RESULT,
NULL,//IMG_ID_FM_AUTO_TEST_ROOT,
STR_ID_FM_AUTO_TEST_PASS,
IMG_GLOBAL_OK,
STR_ID_FM_AUTO_TEST_FAIL,
IMG_GLOBAL_BACK,
(PU8) common_cntx->FMChargeDisplayBuffer,
NULL);
mmi_fm_autotest_charger();
}
#endif //__TOPWELL_FM_TEST_CHARGE_MODE2__
#endif
#define MMI_FM_QUICK_TEST_MELODY
void mmi_fm_enter_quick_test_melody(void);
void FM_AutoTest_Melody(void)
{
mmi_frm_scrn_close(g_fm_gourp_id, SCR_ID_FM_AUTO_TEST_START);
mmi_fm_enter_quick_test_melody();
}
/*****************************************************************************
* FUNCTION
* FM_AutoTest_Melody
* DESCRIPTION
*
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void mmi_fm_enter_quick_test_melody(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
//EntryNewScreen(SCR_ID_FM_AUTO_TEST_START, ExitFMAutoTestStart, NULL, NULL);
if (mmi_frm_scrn_enter
(g_fm_gourp_id,
SCR_ID_FM_AUTO_TEST_START,
NULL,
mmi_fm_enter_quick_test_melody,
MMI_FRM_FULL_SCRN) != MMI_TRUE)
{
return;
}
g_fm_contxt->common_contxt.currentTest = FM_TEST_MELODY;
switch (g_fm_contxt->common_contxt.sequence_counter)
{
case 0:
mmi_fm_auto_test_common(NOSENDKEY_CNT_START_SHOW,(U8*) GetString(STR_ID_FM_AUTOTEST_MELODY),MELODY_DURATION,FM_AutoTest_Melody);
g_fm_contxt->eachloop_contxt.RingToneTestOn = TRUE;
Media_SetOutputVolume(255, 0);
/* stop MIDI */
FM_SendStopAudioReq(0);
/* play MIDI_1 */
FM_SendPlayAudioReq(0);
break;
default:
FM_Autotest_test_done_USC2string(Tests[FM_AUTOTEST_MELODY].name);
g_fm_contxt->eachloop_contxt.RingToneTestOn = FALSE;
FM_SendSetAudioModeReq(AUD_MODE_NORMAL);
/* stop MIDI */
FM_SendStopAudioReq(0);
mmi_fm_auto_test_common(SENDKEY_UNCNT_STOP_SHOW,(U8*)g_fm_contxt->common_contxt.EMFMUnicodeDisplayBuf,0,NULL);
}
}
#if !defined(__TOPWELL_HW_NO_VIBRATOR__)
#define MMI_FM_QUICK_TEST_VIB
void mmi_fm_enter_quick_test_vib(void);
void FM_AutoTest_VIB(void)
{
mmi_frm_scrn_close(g_fm_gourp_id, SCR_ID_FM_AUTO_TEST_START);
mmi_fm_enter_quick_test_vib();
}
/*****************************************************************************
* FUNCTION
* FM_AutoTest_VIB
* DESCRIPTION
*
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void mmi_fm_enter_quick_test_vib(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
//EntryNewScreen(SCR_ID_FM_AUTO_TEST_START, ExitFMAutoTestStart, NULL, NULL);
if (mmi_frm_scrn_enter
(g_fm_gourp_id,
SCR_ID_FM_AUTO_TEST_START,
NULL,
mmi_fm_enter_quick_test_vib,
MMI_FRM_FULL_SCRN) != MMI_TRUE)
{
return;
}
g_fm_contxt->common_contxt.currentTest = FM_TEST_VIB;
switch (g_fm_contxt->common_contxt.sequence_counter)
{
case 0:
case 2:
mmi_fm_auto_test_common(NOSENDKEY_CNT_START_SHOW,(U8*) GetString(STR_ID_FM_AUTOTEST_VIB),VIB_DURATION,FM_AutoTest_VIB);
FM_SetGpioVirbateReq(VIBRATOR_ON);
break;
case 1:
#if defined(__TOPWELL_BASE_BUG__)
mmi_fm_auto_test_common(NOSENDKEY_CNT_START_SHOW,(U8*) GetString(STR_ID_FM_AUTOTEST_VIB),VIB_DURATION,FM_AutoTest_VIB);
#else
mmi_fm_auto_test_common(NOSENDKEY_CNT_START_SHOW,(U8*) GetString(STR_ID_FM_AUTO_TEST_FAIL),VIB_DURATION,FM_AutoTest_VIB);
#endif
FM_SetGpioVirbateReq(VIBRATOR_OFF);
break;
default:
FM_Autotest_test_done_USC2string(Tests[FM_AUTOTEST_VIB].name);
mmi_fm_auto_test_common(SENDKEY_UNCNT_STOP_SHOW,(U8*) g_fm_contxt->common_contxt.EMFMUnicodeDisplayBuf,0,NULL);
FM_SetGpioVirbateReq(VIBRATOR_OFF);
}
}
#endif
#if defined(__TOPWELL_HW_TORCH__)
#if !defined(__TOPWELL_FM_NOT_TEST_TORCH__)
static void mmi_fm_enter_quick_test_torch(void);
//<xiemeng add for modis 20130703
#ifdef __MTK_TARGET__
extern void topwell_torch_off(void) ;
extern void topwell_torch_on(void) ;
#else
//void topwell_torch_on(void) {}
//void topwell_torch_off(void) {}
#endif
//>xiemeng add for modis 20130703
void FM_AutoTest_TORCH(void)
{
mmi_frm_scrn_close(g_fm_gourp_id, SCR_ID_FM_AUTO_TEST_START);
mmi_fm_enter_quick_test_torch();
}
void mmi_fm_enter_quick_test_torch(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
//EntryNewScreen(SCR_ID_FM_AUTO_TEST_START, ExitFMAutoTestStart, NULL, NULL);
if (mmi_frm_scrn_enter
(g_fm_gourp_id,
SCR_ID_FM_AUTO_TEST_START,
NULL,
mmi_fm_enter_quick_test_torch,
MMI_FRM_FULL_SCRN) != MMI_TRUE)
{
return;
}
g_fm_contxt->common_contxt.currentTest = FM_TEST_TORCH;
switch (g_fm_contxt->common_contxt.sequence_counter)
{
case 0:
case 2:
mmi_fm_auto_test_common(NOSENDKEY_CNT_START_SHOW,(U8*)L"Torch test",1000,FM_AutoTest_TORCH);
topwell_torch_on();
break;
case 1:
mmi_fm_auto_test_common(NOSENDKEY_CNT_START_SHOW,(U8*) L"Torch test",1000,FM_AutoTest_TORCH);
topwell_torch_off();
break;
default:
FM_Autotest_test_done_USC2string(Tests[FM_AUTOTEST_TORCH].name);
mmi_fm_auto_test_common(SENDKEY_UNCNT_STOP_SHOW,(U8*) g_fm_contxt->common_contxt.EMFMUnicodeDisplayBuf,0,NULL);
topwell_torch_off();
}
}
#endif
#endif
#if defined(__TOPWELL_HW_LED_SIGNAL__)
#if !defined(__TOPWELL_FM_NOT_TEST_INFORMATION_LED__)
static void mmi_fm_enter_quick_test_information_led(void);
extern void Gpio_Information_Led_On(void);
extern void Gpio_Information_Led_Off(void);
void FM_AutoTest_Information_LED(void)
{
mmi_frm_scrn_close(g_fm_gourp_id, SCR_ID_FM_AUTO_TEST_START);
mmi_fm_enter_quick_test_information_led();
}
void mmi_fm_enter_quick_test_information_led(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
//EntryNewScreen(SCR_ID_FM_AUTO_TEST_START, ExitFMAutoTestStart, NULL, NULL);
if (mmi_frm_scrn_enter
(g_fm_gourp_id,
SCR_ID_FM_AUTO_TEST_START,
NULL,
mmi_fm_enter_quick_test_information_led,
MMI_FRM_FULL_SCRN) != MMI_TRUE)
{
return;
}
g_fm_contxt->common_contxt.currentTest = FM_TEST_INFORMATION_LED;
switch (g_fm_contxt->common_contxt.sequence_counter)
{
case 0:
case 2:
mmi_fm_auto_test_common(NOSENDKEY_CNT_START_SHOW,(U8*)L"Information LED test",1000,FM_AutoTest_Information_LED);
Gpio_Information_Led_On();
break;
case 1:
mmi_fm_auto_test_common(NOSENDKEY_CNT_START_SHOW,(U8*) L"Information LED test",1000,FM_AutoTest_Information_LED);
Gpio_Information_Led_Off();
break;
default:
FM_Autotest_test_done_USC2string(Tests[FM_AUTOTEST_INFORMATION_LED].name);
mmi_fm_auto_test_common(SENDKEY_UNCNT_STOP_SHOW,(U8*) g_fm_contxt->common_contxt.EMFMUnicodeDisplayBuf,0,NULL);
Gpio_Information_Led_Off();
}
}
#endif
#endif
#if defined(__TOPWELL_FM_TEST_NAND__)
#define MMI_FM_QUICK_TEST_NAND
/*****************************************************************************
* FUNCTION
* FM_AutoTest_NAND
* DESCRIPTION
*
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void FM_AutoTest_NAND(void)
{
mmi_frm_scrn_close(g_fm_gourp_id, SCR_ID_FM_AUTO_TEST_START);
mmi_fm_enter_autotest_nand();
}
/*****************************************************************************
* FUNCTION
* FM_AutoTest_NAND
* DESCRIPTION
*
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void mmi_fm_enter_autotest_nand(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (mmi_frm_scrn_enter
(g_fm_gourp_id,
SCR_ID_FM_AUTO_TEST_START,
NULL,
mmi_fm_enter_autotest_nand,
MMI_FRM_FULL_SCRN) != MMI_TRUE)
{
return;
}
g_fm_contxt->common_contxt.currentTest = FM_TEST_NAND;
switch (g_fm_contxt->common_contxt.sequence_counter)
{
case 0:
mmi_fm_auto_test_common(NOSENDKEY_CNT_START_SHOW,(U8*) GetString(STR_ID_FM_AUTOTEST_NAND),3000,FM_AutoTest_NAND);
break;
case 1:
mmi_fm_auto_test_common(NOSENDKEY_CNT_START_HIDE,0,2000,FM_AutoTest_NAND);
mmi_fm_select_nand_flash();
break;
default:
FM_Autotest_test_done_USC2string(Tests[FM_AUTOTEST_NAND].name);
mmi_fm_auto_test_common(SENDKEY_UNCNT_STOP_SHOW,(U8*) g_fm_contxt->common_contxt.EMFMUnicodeDisplayBuf,0,NULL);
}
}
#endif
#define MMI_FM_QUICK_TEST_UART
/*****************************************************************************
* FUNCTION
* FM_AutoTest_UART
* DESCRIPTION
*
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
#ifdef __MMI_FM_UART_TEST__
void FM_AutoTest_UART(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
// EntryNewScreen(SCR_ID_FM_AUTO_TEST_START, ExitFMAutoTestStart, NULL, NULL);
mmi_frm_scrn_close(g_fm_gourp_id, SCR_ID_FM_AUTO_TEST_START);
if (mmi_frm_scrn_enter
(g_fm_gourp_id,
SCR_ID_FM_AUTO_TEST_START,
NULL,
FM_AutoTest_UART,
MMI_FRM_FULL_SCRN) != MMI_TRUE)
{
return;
}
g_fm_contxt->common_contxt.currentTest = FM_TEST_UART;
switch (g_fm_contxt->common_contxt.sequence_counter)
{
case 0:
mmi_fm_auto_test_common(NOSENDKEY_CNT_START_SHOW,(U8*) GetString(STR_ID_FM_AUTOTEST_UART),1000,FM_AutoTest_UART);
break;
case 1:
mmi_fm_auto_test_common(NOSENDKEY_CNT_START_HIDE,0,2000,FM_AutoTest_UART);
mmi_fm_select_uart(); //EntryFMUARTMenu();
break;
default:
FM_Autotest_test_done_USC2string(Tests[FM_AUTOTEST_UART].name);
mmi_fm_auto_test_common(SENDKEY_UNCNT_STOP_SHOW,(U8*) g_fm_contxt->common_contxt.EMFMUnicodeDisplayBuf,0,NULL);
}
}
#endif /*__MMI_FM_UART_TEST__*/
#if defined(__TOPWELL_FM_TEST_DOUBLE_SPEAKER__)
#define MMI_FM_QUICK_TEST_DOUBLE_SPEAKER
void mmi_fm_enter_quick_test_double_spk(void);
void FM_AutoTest_Double_Speaker(void)
{
mmi_frm_scrn_close(g_fm_gourp_id, SCR_ID_FM_AUTO_TEST_START);
mmi_fm_enter_quick_test_double_spk();
}
/*****************************************************************************
* FUNCTION
* FM_AutoTest_Double_Speaker
* DESCRIPTION
*
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void mmi_fm_enter_quick_test_double_spk(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (mmi_frm_scrn_enter
(g_fm_gourp_id,
SCR_ID_FM_AUTO_TEST_START,
NULL,
mmi_fm_enter_quick_test_double_spk,
MMI_FRM_FULL_SCRN) != MMI_TRUE)
{
return;
}
g_fm_contxt->common_contxt.currentTest = FM_TEST_DOUBLE_SPEAKER;
FM_SendStopAudioReq(0);
//Media_Stop();
g_fm_contxt->loudspk_contxt.LoudSpkTestOn = MMI_TRUE;
FM_SendSetAudioModeReq(AUD_MODE_LOUDSPK);
/* play 1K tone */
TONE_SetOutputVolume(255, 0);
/* sequence_counter=0; */
switch (g_fm_contxt->common_contxt.sequence_counter)
{
case 0:
mdi_audio_play_id(TONE_KEY_NORMAL, DEVICE_AUDIO_PLAY_INFINITE);
mmi_fm_auto_test_common(NOSENDKEY_CNT_START_SHOW,(U8*) GetString(STR_ID_FM_AUTOTEST_LEFT_SPEAKER),SPEAKER_DURATION,FM_AutoTest_Double_Speaker);
break;
case 1:
mmi_fm_auto_test_common(NOSENDKEY_CNT_START_SHOW,(U8*) GetString(STR_GLOBAL_STOP),1000,FM_AutoTest_Double_Speaker);
mdi_audio_stop_id(TONE_KEY_NORMAL);
break;
case 2:
mdi_audio_play_id(TONE_KEY_NORMAL, DEVICE_AUDIO_PLAY_INFINITE);
mmi_fm_auto_test_common(NOSENDKEY_CNT_START_SHOW,(U8*) GetString(STR_ID_FM_AUTOTEST_RIGHT_SPEAKER),SPEAKER_DURATION,FM_AutoTest_Double_Speaker);
break;
default:
FM_Autotest_test_done_USC2string(Tests[FM_AUTOTEST_DOUBLE_SPEAKER].name);
mmi_fm_auto_test_common(SENDKEY_UNCNT_STOP_SHOW,(U8*) g_fm_contxt->common_contxt.EMFMUnicodeDisplayBuf,0,NULL);
g_fm_contxt->loudspk_contxt.LoudSpkTestOn = MMI_FALSE;
FM_SendSetAudioModeReq(AUD_MODE_NORMAL);
/* stop 1K tone */
mdi_audio_stop_id(TONE_KEY_NORMAL);
}
}
#endif
#define MMI_FM_QUICK_TEST_CAMERA
#ifndef __MMI_MAINLCD_96X64__
/*****************************************************************************
* FUNCTION
* EntryFMCameraTransientScreen
* DESCRIPTION
*
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
static void EntryFMCameraTransientScreen(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
mmi_frm_scrn_close(g_fm_gourp_id, SCR_ID_FM_AUTO_TEST_START);
if (mmi_frm_scrn_enter
(g_fm_gourp_id,
SCR_ID_FM_AUTO_TEST_START,
NULL,
FM_AutoTest_CAMERA,
MMI_FRM_FULL_SCRN) != MMI_TRUE)
{
return;
}
FM_Autotest_test_done_USC2string(Tests[FM_AUTOTEST_CAMERA].name);
ShowCategory7Screen(
STR_ID_FM_AUTO_TEST_RESULT,
NULL,//IMG_ID_FM_AUTO_TEST_ROOT,
STR_ID_FM_AUTO_TEST_PASS,
IMG_GLOBAL_OK,
STR_ID_FM_AUTO_TEST_FAIL,
IMG_GLOBAL_BACK,
(PU8) g_fm_contxt->common_contxt.EMFMUnicodeDisplayBuf,
NULL);
FM_Autotest_set_key_handlers(1);
}
/*****************************************************************************
* FUNCTION
* FM_AutoTest_CAMERA
* DESCRIPTION
*
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void FM_AutoTest_CAMERA(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
static U16 isRedraw = 0;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
g_fm_contxt->common_contxt.currentTest = FM_TEST_CAMERA;
#ifdef __MMI_FM_CAMERA_PREVIEW__
switch (g_fm_contxt->common_contxt.sequence_counter)
{
case 0:
if(0 == isRedraw)
{
g_fm_contxt->common_contxt.sequence_counter++;
mmi_fm_camera_entry_preview_screen();
StartTimer(FM_AUTO_TEST_COMMNON_TIMER, CAMERA_DURATION, FM_AutoTest_CAMERA);
}
break;
default:
isRedraw = 1;
g_fm_contxt->common_contxt.sequence_counter = 0;
StopTimer(FM_AUTO_TEST_COMMNON_TIMER);
mmi_fm_close_camera();
EntryFMCameraTransientScreen();
isRedraw = 0;
}
#else
{
EntryFMCameraTransientScreen();
}
#endif
}
#endif /* __MMI_MAINLCD_96X64__ */
#define MMI_FM_QUICK_TEST_MEMORYCARD
void mmi_fm_enter_quick_test_memorycard(void);
void FM_AutoTest_MemoryCard(void)
{
mmi_frm_scrn_close(g_fm_gourp_id,SCR_ID_FM_AUTO_TEST_START);//SCR_ID_FM_MEMORY_CARD);
mmi_fm_enter_quick_test_memorycard();
}
#if defined(__TOPWELL_BASE_BUG__) //!defined(__TOPWELL_MMI_MEDIA_STORAGE_IS_PHONE__)
extern MMI_BOOL srv_fmgr_memorycard_is_exist(void);
#endif
/*****************************************************************************
* FUNCTION
* FM_AutoTest_MemoryCard
* DESCRIPTION
*
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void mmi_fm_enter_quick_test_memorycard(void)
{
#if defined(__MSDC_MS__) || defined(__MSDC_SD_MMC__) || defined(__MSDC_MSPRO__)
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
UI_character_type text1[32];
U8 u8text[32];
mmi_fm_memcard_struct *memcard_cntx;
#endif /* defined(__MSDC_MS__) || defined(__MSDC_SD_MMC__) || defined(__MSDC_MSPRO__) */
mmi_fm_common_struct *common_cntx;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
common_cntx = &(g_fm_contxt->common_contxt);
common_cntx->currentTest = FM_TEST_MEMORYCARD;
if (mmi_frm_scrn_enter
(g_fm_gourp_id,
SCR_ID_FM_AUTO_TEST_START,//SCR_ID_FM_MEMORY_CARD,
NULL,
mmi_fm_enter_quick_test_memorycard,
MMI_FRM_FULL_SCRN) != MMI_TRUE)
{
return;
}
// EntryNewScreen(SCR_ID_FM_MEMORY_CARD, NULL, FM_AutoTest_MemoryCard, NULL);
#if defined(__MSDC_MS__) || defined(__MSDC_SD_MMC__) || defined(__MSDC_MSPRO__)
memcard_cntx = &(g_fm_contxt->memcard_contxt);
if (common_cntx->sequence_counter < 6)
{
if (memcard_cntx->FM_Card_Status.present == TRUE)
{
common_cntx->sequence_counter = 6;
switch (memcard_cntx->FM_Card_Status.type)
{
case MS_CARD:
mmi_asc_to_ucs2((CHAR*) memcard_cntx->CardType, "MS_CARD.");
break;
case SD_CARD:
mmi_asc_to_ucs2((CHAR*) memcard_cntx->CardType, "SD_CARD.");
break;
case MMC_CARD:
mmi_asc_to_ucs2((CHAR*) memcard_cntx->CardType, "MMC_CARD.");
break;
default:
mmi_asc_to_ucs2((CHAR*) memcard_cntx->CardType, "Error!!!");
}
StartTimer(FM_AUTO_TEST_COMMNON_TIMER, 300, FM_AutoTest_MemoryCard);
}
else
{
common_cntx->sequence_counter++;
if (memcard_cntx->Card_Response_Sent == FALSE)
{
FM_MemoryCardReq();
}
sprintf(
(CHAR*) u8text,
"\nPlease Insert Memory Card....%d",
(MEMORYCARD_DURATION / 1000) - common_cntx->sequence_counter);
mmi_asc_to_ucs2((CHAR*) text1, (CHAR*) u8text);
ShowCategory7Screen(
STR_GLOBAL_MEMORY_CARD,
NULL,
STR_ID_FM_AUTO_TEST_PASS,
0,
STR_ID_FM_AUTO_TEST_FAIL,
0,
(PU8) text1,
NULL);
FM_Autotest_set_key_handlers(1);
StartTimer(FM_AUTO_TEST_COMMNON_TIMER, 1000, FM_AutoTest_MemoryCard);
if ((common_cntx->sequence_counter >= (MEMORYCARD_DURATION / 1000) - 1) && memcard_cntx->FM_Card_Status.present == FALSE)
{ /* No Card inserted. */
mmi_asc_to_ucs2((CHAR*) memcard_cntx->CardType, "No Card.");
//StopTimer(FM_AUTO_TEST_COMMNON_TIMER);
//StartTimer(FM_AUTO_TEST_COMMNON_TIMER, 300, FM_AutoTest_MemoryCard);
//common_cntx->sequence_counter++;
common_cntx->sequence_counter = 6;
}
}
}
else
#endif /* defined(__MSDC_MS__) || defined(__MSDC_SD_MMC__) || defined(__MSDC_MSPRO__) */
{
common_cntx->sequence_counter = 0;
StopTimer(FM_AUTO_TEST_COMMNON_TIMER);
FM_Autotest_test_done_USC2string(Tests[FM_AUTOTEST_MEMORYCARD].name);
ShowCategory7Screen(
STR_ID_FM_AUTO_TEST_RESULT,
NULL,//IMG_ID_FM_AUTO_TEST_ROOT,
STR_ID_FM_AUTO_TEST_PASS,
IMG_GLOBAL_OK,
STR_ID_FM_AUTO_TEST_FAIL,
IMG_GLOBAL_BACK,
(PU8) common_cntx->EMFMUnicodeDisplayBuf,
NULL);
FM_Autotest_set_key_handlers(1);
}
}
#define MMI_FM_QUICK_TEST_TOUCH_SCREEN
#ifdef __MMI_TOUCH_SCREEN__
/*****************************************************************************
* FUNCTION
* FM_AutoTest_Pen_Parallel_Test
* DESCRIPTION
* This function is for Parallel line Test in Auto Test mode
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
#if !defined(__TOPWELL_FM_NOT_TEST_PEN_PARALLEL_LINES__)
void FM_AutoTest_Pen_Parallel_Test(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
g_fm_contxt->common_contxt.currentTest = FM_TEST_PEN_PARALLEL_LINES;
mmi_fm_select_pen_parallel_test();
}
#endif
#endif /*__MMI_TOUCH_SCREEN__*/
/*****************************************************************************
* FUNCTION
* EntryFMMenuAutoTestProcess
* DESCRIPTION
*
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void EntryFMMenuAutoTestProcess(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
InitFactoryModeEvent();
/* Disable tone internal */
gui_touch_feedback_disable_tone_internal();
gui_touch_feedback_disable_vibrate_internal();
/* create group and init ASM */
g_fm_contxt = applib_mem_ap_alloc(APPLIB_MEM_AP_ID_FM_COMM_MEM,sizeof(mmi_fm_item_cntxt_struct));
if (g_fm_contxt == NULL)
{
DisplayPopup((PU8) GetString(STR_GLOBAL_INSUFFICIENT_MEMORY), NULL, 0, 1000, 0);
MMI_FM_DCM_POST_UNLOAD();
return;
}
g_fm_gourp_id = mmi_frm_group_create(GRP_ID_ROOT,
GRP_ID_AUTO_GEN, mmi_fm_auto_test_group_proc, NULL);
mmi_frm_group_enter(g_fm_gourp_id, MMI_FRM_NODE_NONE_FLAG);
if (g_fm_contxt != NULL)
{
memset(g_fm_contxt, 0, sizeof(mmi_fm_item_cntxt_struct));
mmi_fm_init_mem_contxt();
}
FM_InitAutoTest();
/* Enter auto test */
mmi_fm_enter_auto_test();
}
#if (defined(__MMI_AP_DCM_FM__) || defined(__DCM_WITH_COMPRESSION_MMI_POOL_A__))
#pragma arm section rodata , code
#endif /* (defined(__MMI_AP_DCM_FM__) || defined(__DCM_WITH_COMPRESSION_MMI_POOL_A__)) */
/*****************************************************************************
* FUNCTION
* EntryFMMenuAutoTest
* DESCRIPTION
* extern API. *#87#
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
extern void EntryFMMenuAutoTest(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
#if defined(__TOPWELL_MMI_FACTORYMODE_TEST_RESULT__)
g_is_qsttest_test_type = 0;
#endif
MMI_FM_DCM_LOAD();
EntryFMMenuAutoTestProcess();
}
#if defined(__TOPWELL_MMI_FACTORYMODE_TEST_RESULT__)
extern void EntryFMMenuAutoTest_Board(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
g_is_qsttest_test_type = TOPWELL_BOARD_TYPE;
MMI_FM_DCM_LOAD();
EntryFMMenuAutoTestProcess();
}
extern void EntryFMMenuAutoTest_Assem(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
g_is_qsttest_test_type = TOPWELL_ASSEM_TYPE;
MMI_FM_DCM_LOAD();
EntryFMMenuAutoTestProcess();
}
#endif
#if defined(__TOPWELL_BASE_BUG__) // __TOPWELL_MMI_EXTERN_VERSION__
extern void EntryFMMenuAutoTestExt(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
MMI_FM_DCM_LOAD();
topwell_version_flag_exchange(TEST_VERSION_FLAG_IS_EXT);
EntryFMMenuAutoTestProcess();
}
#endif
#endif