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
|
/*------------------------------------------------------------------------------------------------*/
/* UNICENS V2.1.0-3491 */
/* Copyright (c) 2017 Microchip Technology Germany II GmbH & Co. KG. */
/* */
/* This program is free software: you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation, either version 2 of the License, or */
/* (at your option) any later version. */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/* You may also obtain this software under a propriety license from Microchip. */
/* Please contact Microchip for further information. */
/*------------------------------------------------------------------------------------------------*/
/*!
* \file
* \brief Implementation of FBlock INIC (resource management parts of INIC management)
* \details Contains the resource management parts of INIC management
*
* \cond UCS_INTERNAL_DOC
* \addtogroup G_INIC
* @{
*/
/*------------------------------------------------------------------------------------------------*/
/* Includes */
/*------------------------------------------------------------------------------------------------*/
#include "ucs_misc.h"
#include "ucs_ret_pb.h"
#include "ucs_inic.h"
#include "ucs_base.h"
/*------------------------------------------------------------------------------------------------*/
/* Internal macros */
/*------------------------------------------------------------------------------------------------*/
/*! \brief API locking Bitmask for all INIC create methods. */
#define INIC_API_CREATE_CLASS 0x0001U
/*! \brief API locking Bitmask of method Inic_ResourceDestroy(). */
#define INIC_API_RESOURCE_DESTROY 0x0002U
/*! \brief API locking Bitmask of method Inic_ResourceInvalidList_Get(). */
#define INIC_API_RESOURCE_INVAL_LIST 0x0004U
/*! \brief API locking Bitmask of method Inic_Notification_Set(). */
#define INIC_API_NOTIFICATION 0x0008U
/*! \brief API locking Bitmask of method Inic_StreamPortConfig_Get(). */
#define INIC_API_STREAM_PORT_CONFIG 0x0010U
/*! \brief API locking Bitmask of method Inic_SyncMute(). */
#define INIC_API_SYNC_MUTE 0x0020U
/*! \brief API locking Bitmask of method Inic_SyncDemute(). */
#define INIC_API_SYNC_DEMUTE 0x0040U
/*! \brief API locking Bitmask of method Inic_MostPortEnable(). */
#define INIC_API_MOST_PORT_ENABLE 0x0080U
/*! \brief API locking Bitmask of method Inic_MostPortEnFullStr(). */
#define INIC_API_MOST_PORT_EN_FULL_STR 0x0100U
/*! \brief API locking Bitmask of method Inic_GpioPortPinMode_SetGet(). */
#define INIC_API_GPIO_PIN_MODE 0x0200U
/*! \brief API locking Bitmask of method Inic_GpioPortPinState_SetGet(). */
#define INIC_API_GPIO_PIN_STATE 0x0400U
/*! \brief API locking Bitmask of methods Inic_I2cPortRead_StartResultAck() and Inic_I2cPortWrite_StartResultAck(). */
#define INIC_API_I2C_PORT_WR 0x0800U
/*! \brief Bitmask for API method Inic_DeviceSync() used by API locking manager */
#define INIC_API_DEVICE_SYNC 0x1000U
/*------------------------------------------------------------------------------------------------*/
/* Internal prototypes */
/*------------------------------------------------------------------------------------------------*/
static void Inic_HandleResApiTimeout(void *self, void *method_mask_ptr);
static void Inic_ResMsgTxStatusCb(void *self, Msg_MostTel_t *tel_ptr, Ucs_MsgTxStatus_t status);
/*------------------------------------------------------------------------------------------------*/
/* Implementation */
/*------------------------------------------------------------------------------------------------*/
/*! \brief Initialization function of the INIC Resource Management part. Called by Inic_Ctor().
* \param self Instance pointer
*/
void Inic_InitResourceManagement(CInic *self)
{
Sobs_Ctor(&self->lock.res_observer, self, &Inic_HandleResApiTimeout);
Al_Ctor(&self->lock.res_api, &self->lock.res_observer, self->base_ptr->ucs_user_ptr);
Alm_RegisterApi(&self->base_ptr->alm, &self->lock.res_api);
/* initializes the gpio report time status */
self->gpio_rt_status.first_report = true;
}
/*! \brief Handles an API timeout
* \param self Instance pointer
* \param method_mask_ptr Bitmask to signal which API method has caused the timeout
*/
static void Inic_HandleResApiTimeout(void *self, void *method_mask_ptr)
{
CInic *self_ = (CInic *)self;
Alm_ModuleMask_t method_mask = *((Alm_ModuleMask_t *)method_mask_ptr);
Inic_StdResult_t res_data;
res_data.data_info = NULL;
res_data.result.code = UCS_RES_ERR_TIMEOUT;
res_data.result.info_ptr = NULL;
switch(method_mask)
{
case INIC_API_CREATE_CLASS:
Ssub_Notify(&self_->ssubs[INIC_SSUB_CREATE_CLASS], &res_data, true);
TR_ERROR((self_->base_ptr->ucs_user_ptr, "[INIC_RES]", "API locking timeout occurred for INIC create method.", 0U));
break;
case INIC_API_RESOURCE_DESTROY:
Ssub_Notify(&self_->ssubs[INIC_SSUB_RESOURCE_DESTROY], &res_data, true);
TR_ERROR((self_->base_ptr->ucs_user_ptr, "[INIC_RES]", "API locking timeout occurred for method Inic_ResourceDestroy().", 0U));
break;
case INIC_API_RESOURCE_INVAL_LIST:
Ssub_Notify(&self_->ssubs[INIC_SSUB_RESOURCE_INVAL_LIST], &res_data, true);
TR_ERROR((self_->base_ptr->ucs_user_ptr, "[INIC_RES]", "API locking timeout occurred for method Inic_ResourceInvalidList_Get().", 0U));
break;
case INIC_API_NOTIFICATION:
Ssub_Notify(&self_->ssubs[INIC_SSUB_NOTIFICATION], &res_data, true);
TR_ERROR((self_->base_ptr->ucs_user_ptr, "[INIC_RES]", "API locking timeout occurred for method Inic_Notification_Get().", 0U));
break;
case INIC_API_STREAM_PORT_CONFIG:
Ssub_Notify(&self_->ssubs[INIC_SSUB_STREAM_PORT_CONFIG], &res_data, true);
TR_ERROR((self_->base_ptr->ucs_user_ptr, "[INIC_RES]", "API locking timeout occurred for method Inic_StreamPortConfig_Get().", 0U));
break;
case INIC_API_SYNC_MUTE:
Ssub_Notify(&self_->ssubs[INIC_SSUB_SYNC_MUTE], &res_data, true);
TR_ERROR((self_->base_ptr->ucs_user_ptr, "[INIC_RES]", "API locking timeout occurred for method Inic_SyncMute().", 0U));
break;
case INIC_API_SYNC_DEMUTE:
Ssub_Notify(&self_->ssubs[INIC_SSUB_SYNC_DEMUTE], &res_data, true);
TR_ERROR((self_->base_ptr->ucs_user_ptr, "[INIC_RES]", "API locking timeout occurred for method Inic_SyncDemute().", 0U));
break;
case INIC_API_MOST_PORT_ENABLE:
Ssub_Notify(&self_->ssubs[INIC_SSUB_MOST_PORT_ENABLE], &res_data, true);
TR_ERROR((self_->base_ptr->ucs_user_ptr, "[INIC_RES]", "API locking timeout occurred for method Inic_MostPortEnable().", 0U));
break;
case INIC_API_MOST_PORT_EN_FULL_STR:
Ssub_Notify(&self_->ssubs[INIC_SSUB_MOST_PORT_EN_FULL_STR], &res_data, true);
TR_ERROR((self_->base_ptr->ucs_user_ptr, "[INIC_RES]", "API locking timeout occurred for method Inic_MostPortEnFullStr().", 0U));
break;
case INIC_API_GPIO_PIN_MODE:
Ssub_Notify(&self_->ssubs[INIC_SSUB_GPIO_PIN_MODE], &res_data, true);
TR_ERROR((self_->base_ptr->ucs_user_ptr, "[INIC_RES]", "API locking timeout occurred for method Inic_GpioPortPinMode_SetGet().", 0U));
break;
case INIC_API_GPIO_PIN_STATE:
Ssub_Notify(&self_->ssubs[INIC_SSUB_GPIO_PIN_STATE], &res_data, true);
TR_ERROR((self_->base_ptr->ucs_user_ptr, "[INIC_RES]", "API locking timeout occurred for method Inic_GpioPortPinState_SetGet().", 0U));
break;
case INIC_API_DEVICE_SYNC:
Ssub_Notify(&self_->ssubs[INIC_SSUB_DEVICE_SYNC], &res_data, true);
TR_ERROR((self_->base_ptr->ucs_user_ptr, "[INIC_RES]", "API locking timeout occurred for method Inic_DeviceSync_StartResult().", 0U));
break;
default:
TR_ERROR((self_->base_ptr->ucs_user_ptr, "[INIC_RES]", "Unknown API locking bitmask detected. Mask: 0x%02X", 1U, method_mask));
break;
}
}
/*! \brief Add an observer to the ResourceMonitor subject
* \param self Instance of CInic
* \param obs_ptr Pointer to observer to be informed
*/
void Inic_AddObsrvResMonitor(CInic *self, CObserver *obs_ptr)
{
(void)Sub_AddObserver(&self->subs[INIC_SUB_RES_MONITOR], obs_ptr);
}
/*! \brief Delete an observer from the ResourceMonitor subject
* \param self Instance of CInic
* \param obs_ptr Pointer to observer to be informed
*/
void Inic_DelObsrvResMonitor(CInic *self, CObserver *obs_ptr)
{
(void)Sub_RemoveObserver(&self->subs[INIC_SUB_RES_MONITOR], obs_ptr);
}
/*! \brief Add an observer to the MOSTPortStatus subject
* \param self Instance of CInic
* \param obs_ptr Pointer to observer to be informed
*/
void Inic_AddObsrvMostPortStatus(CInic *self, CObserver *obs_ptr)
{
if (Sub_AddObserver(&self->subs[INIC_SUB_MOST_PORT_STATUS], obs_ptr) != SUB_UNKNOWN_OBSERVER)
{
Sub_Notify(&self->subs[INIC_SUB_MOST_PORT_STATUS], &self->most_port_status);
}
}
/*! \brief Delete an observer from the MOSTPortStatus subject
* \param self Instance of CInic
* \param obs_ptr Pointer to observer to be informed
*/
void Inic_DelObsrvMostPortStatus(CInic *self, CObserver *obs_ptr)
{
(void)Sub_RemoveObserver(&self->subs[INIC_SUB_MOST_PORT_STATUS], obs_ptr);
}
/*! \brief Add an observer to the GpioTriggerEvent subject
* \param self Instance of CInic
* \param obs_ptr Pointer to observer to be informed
*/
void Inic_AddObsrvGpioTriggerEvent(CInic *self, CObserver *obs_ptr)
{
(void)Sub_AddObserver(&self->subs[INIC_SUB_GPIO_TRIGGER_EVENT], obs_ptr);
}
/*! \brief Removes an observer from the GpioTriggerEvent subject
* \param self Instance of CInic
* \param obs_ptr Pointer to observer to be informed
*/
void Inic_DelObsrvGpioTriggerEvent(CInic *self, CObserver *obs_ptr)
{
(void)Sub_RemoveObserver(&self->subs[INIC_SUB_GPIO_TRIGGER_EVENT], obs_ptr);
}
/*! \brief Destroys the resources associated with the given resource handles
* \param self Reference to CInic instance
* \param res_handle_list resource handle list
* \param obs_ptr Reference to an optional observer. The result must be casted into type
* Inic_StdResult_t.
* \return UCS_RET_SUCCESS message was created
* \return UCS_RET_ERR_BUFFER_OVERFLOW no message buffer available
* \return UCS_RET_ERR_API_LOCKED Resource API is already used by another command
* \return UCS_RET_ERR_PARAM Wrong length of resource handle list
*/
Ucs_Return_t Inic_ResourceDestroy(CInic *self,
Inic_ResHandleList_t res_handle_list,
CSingleObserver *obs_ptr)
{
Ucs_Return_t result = UCS_RET_SUCCESS;
uint8_t len;
if(Al_Lock(&self->lock.res_api, INIC_API_RESOURCE_DESTROY) != false)
{
/* sender handle + number of resource handles */
len = 2U * res_handle_list.num_handles;
if ((len == 0U) || ((MAX_INVALID_HANDLES_LIST << 1) < len))
{
Al_Release(&self->lock.res_api, INIC_API_RESOURCE_DESTROY);
result = UCS_RET_ERR_PARAM;
}
else
{
Msg_MostTel_t *msg_ptr = Trcv_TxAllocateMsg(self->xcvr_ptr, len);
if (msg_ptr != NULL)
{
uint8_t i;
msg_ptr->destination_addr = self->target_address;
msg_ptr->id.fblock_id = FB_INIC;
msg_ptr->id.instance_id = 0U;
msg_ptr->id.function_id = INIC_FID_RESOURCE_DESTROY;
msg_ptr->id.op_type = UCS_OP_STARTRESULT;
for (i=0U; i < res_handle_list.num_handles; ++i)
{
msg_ptr->tel.tel_data_ptr[2U*i] = MISC_HB(res_handle_list.res_handles[i]);
msg_ptr->tel.tel_data_ptr[1U + (2U*i)] = MISC_LB(res_handle_list.res_handles[i]);
}
self->ssubs[INIC_SSUB_RESOURCE_DESTROY].user_mask = INIC_API_RESOURCE_DESTROY;
msg_ptr->info_ptr = &self->ssubs[INIC_SSUB_RESOURCE_DESTROY];
Trcv_TxSendMsgExt(self->xcvr_ptr, msg_ptr, &Inic_ResMsgTxStatusCb, self);
(void)Ssub_AddObserver(&self->ssubs[INIC_SSUB_RESOURCE_DESTROY], obs_ptr);
}
else
{
Al_Release(&self->lock.res_api, INIC_API_RESOURCE_DESTROY);
result = UCS_RET_ERR_BUFFER_OVERFLOW;
}
}
}
else
{
result = UCS_RET_ERR_API_LOCKED;
}
return result;
}
/*! \brief Retrieves the list of invalid resources
* \param self Reference to CInic instance
* \param obs_ptr Reference to an optional observer. The result must be casted into type
* Inic_StdResult_t.
* \return UCS_RET_SUCCESS message was created
* \return UCS_RET_ERR_BUFFER_OVERFLOW no message buffer available
* \return UCS_RET_ERR_API_LOCKED Resource API is already used by another command
*/
Ucs_Return_t Inic_ResourceInvalidList_Get(CInic *self, CSingleObserver *obs_ptr)
{
Ucs_Return_t result = UCS_RET_SUCCESS;
if(Al_Lock(&self->lock.res_api, INIC_API_RESOURCE_INVAL_LIST) != false)
{
Msg_MostTel_t *msg_ptr = Trcv_TxAllocateMsg(self->xcvr_ptr, 0U);
if (msg_ptr != NULL)
{
msg_ptr->destination_addr = self->target_address;
msg_ptr->id.fblock_id = FB_INIC;
msg_ptr->id.instance_id = 0U;
msg_ptr->id.function_id = INIC_FID_RESOURCE_INVALID_LIST;
msg_ptr->id.op_type = UCS_OP_GET;
self->ssubs[INIC_SSUB_RESOURCE_INVAL_LIST].user_mask = INIC_API_RESOURCE_INVAL_LIST;
msg_ptr->info_ptr = &self->ssubs[INIC_SSUB_RESOURCE_INVAL_LIST];
Trcv_TxSendMsgExt(self->xcvr_ptr, msg_ptr, &Inic_ResMsgTxStatusCb, self);
(void)Ssub_AddObserver(&self->ssubs[INIC_SSUB_RESOURCE_INVAL_LIST], obs_ptr);
}
else
{
Al_Release(&self->lock.res_api, INIC_API_RESOURCE_INVAL_LIST);
result = UCS_RET_ERR_BUFFER_OVERFLOW;
}
}
else
{
result = UCS_RET_ERR_API_LOCKED;
}
return result;
}
/*! \brief Resets the resource monitor back to its default state.
* \param self Reference to CInic instance
* \param control Used to reset the resource monitor
* \return UCS_RET_SUCCESS message was created
* \return UCS_RET_ERR_BUFFER_OVERFLOW no message buffer available
*/
Ucs_Return_t Inic_ResourceMonitor_Set(CInic *self, Ucs_Resource_MonitorCtrl_t control)
{
Ucs_Return_t result = UCS_RET_SUCCESS;
Msg_MostTel_t *msg_ptr = Trcv_TxAllocateMsg(self->xcvr_ptr, 1U);
if (msg_ptr != NULL)
{
msg_ptr->destination_addr = self->target_address;
msg_ptr->id.fblock_id = FB_INIC;
msg_ptr->id.instance_id = 0U;
msg_ptr->id.function_id = INIC_FID_RESOURCE_MONITOR;
msg_ptr->id.op_type = UCS_OP_SET;
msg_ptr->tel.tel_data_ptr[0] = (uint8_t)control;
Trcv_TxSendMsgExt(self->xcvr_ptr, msg_ptr, &Inic_ResMsgTxStatusCb, self);
}
else
{
result = UCS_RET_ERR_BUFFER_OVERFLOW;
}
return result;
}
/*! \brief Triggers notification of the given function_id list.
* \param self Reference to CInic instance
* \param control control command used
* \param device_id Id of the sending device (local node address).
* \param fktid_list function ids list.
* \return UCS_RET_SUCCESS message was created
* \return UCS_RET_ERR_PARAM parameter exceeds its admissible range was created
* \return UCS_RET_ERR_BUFFER_OVERFLOW no message buffer available
*/
Ucs_Return_t Inic_Notification_Set(CInic *self, Ucs_Inic_NotificationCtrl_t control, uint16_t device_id, Inic_FktIdList_t fktid_list)
{
Ucs_Return_t result = UCS_RET_SUCCESS;
/* control + device_id + size of the funcids list */
uint8_t len = 1U + 2U + (2U * fktid_list.num_fktids);
if (len > MSG_MAX_SIZE_PAYLOAD)
{
result = UCS_RET_ERR_PARAM;
}
else
{
Msg_MostTel_t *msg_ptr = Trcv_TxAllocateMsg(self->xcvr_ptr, len);
if (msg_ptr != NULL)
{
uint8_t i;
msg_ptr->destination_addr = self->target_address;
msg_ptr->id.fblock_id = FB_INIC;
msg_ptr->id.instance_id = 0U;
msg_ptr->id.function_id = INIC_FID_NOTIFICATION;
msg_ptr->id.op_type = UCS_OP_SET;
msg_ptr->tel.tel_data_ptr[0] = (uint8_t)control;
msg_ptr->tel.tel_data_ptr[1] = MISC_HB(device_id);
msg_ptr->tel.tel_data_ptr[2] = MISC_LB(device_id);
if ((len > 3U) && (fktid_list.fktids_ptr != NULL) )
{
for (i=0U; i < fktid_list.num_fktids; ++i)
{
msg_ptr->tel.tel_data_ptr[3U+(2U*i)] = MISC_HB(fktid_list.fktids_ptr[i]);
msg_ptr->tel.tel_data_ptr[4U+(2U*i)] = MISC_LB(fktid_list.fktids_ptr[i]);
}
}
msg_ptr->info_ptr = &self->ssubs[INIC_SSUB_NOTIFICATION];
Trcv_TxSendMsgExt(self->xcvr_ptr, msg_ptr, &Inic_ResMsgTxStatusCb, self);
}
else
{
result = UCS_RET_ERR_BUFFER_OVERFLOW;
}
}
return result;
}
/*! \brief Gets the device id that has notified the given function_id
* \param self Reference to CInic instance
* \param fktid The function id to be looked for
* \param obs_ptr Reference to an optional observer
* \return UCS_RET_SUCCESS message was created
* \return UCS_RET_ERR_BUFFER_OVERFLOW no message buffer available
* \return UCS_RET_ERR_API_LOCKED Resource API is already used by another command
*/
Ucs_Return_t Inic_Notification_Get(CInic *self, uint16_t fktid, CSingleObserver *obs_ptr)
{
Ucs_Return_t result = UCS_RET_SUCCESS;
if(Al_Lock(&self->lock.res_api, INIC_API_NOTIFICATION) != false)
{
Msg_MostTel_t * msg_ptr = Trcv_TxAllocateMsg(self->xcvr_ptr, 2U);
if (msg_ptr != NULL)
{
msg_ptr->destination_addr = self->target_address;
msg_ptr->id.fblock_id = FB_INIC;
msg_ptr->id.instance_id = 0U;
msg_ptr->id.function_id = INIC_FID_NOTIFICATION;
msg_ptr->id.op_type = UCS_OP_GET;
msg_ptr->tel.tel_data_ptr[0] = MISC_HB(fktid);
msg_ptr->tel.tel_data_ptr[1] = MISC_LB(fktid);
self->ssubs[INIC_SSUB_NOTIFICATION].user_mask = INIC_API_NOTIFICATION;
msg_ptr->info_ptr = &self->ssubs[INIC_SSUB_NOTIFICATION];
Trcv_TxSendMsgExt(self->xcvr_ptr, msg_ptr, &Inic_ResMsgTxStatusCb, self);
(void)Ssub_AddObserver(&self->ssubs[INIC_SSUB_NOTIFICATION], obs_ptr);
}
else
{
Al_Release(&self->lock.res_api, INIC_API_NOTIFICATION);
result = UCS_RET_ERR_BUFFER_OVERFLOW;
}
}
else
{
result = UCS_RET_ERR_API_LOCKED;
}
return result;
}
/*! \brief Creates a synchronous data connection. The connection can be directly associated with
* an input and output socket.
* \param self Reference to CInic instance
* \param resource_handle_in The ID number of the socket or splitter resource that is the
* starting point of the link.
* \param resource_handle_out The ID number of the socket or splitter resource that is the ending
* point of the link.
* \param default_mute specifies if the connection is muted by default
* \param mute_mode Configures how the resource monitor shall handle events that may
* the streamed data invalid.
* \param offset Denotes the offset from/to where data from/to a socket should be
* routed from/to a splitter/combiner.
* \param obs_ptr Reference to an optional observer
* \return UCS_RET_SUCCESS message was created
* \return UCS_RET_ERR_BUFFER_OVERFLOW no message buffer available
* \return UCS_RET_ERR_API_LOCKED Resource API is already used by another command
*/
Ucs_Return_t Inic_SyncCreate(CInic *self,
uint16_t resource_handle_in,
uint16_t resource_handle_out,
bool default_mute,
Ucs_Sync_MuteMode_t mute_mode,
uint16_t offset,
CSingleObserver *obs_ptr)
{
Ucs_Return_t result = UCS_RET_SUCCESS;
if(Al_Lock(&self->lock.res_api, INIC_API_CREATE_CLASS) != false)
{
Msg_MostTel_t *msg_ptr = Trcv_TxAllocateMsg(self->xcvr_ptr, 8U);
if (msg_ptr != NULL)
{
msg_ptr->destination_addr = self->target_address;
msg_ptr->id.fblock_id = FB_INIC;
msg_ptr->id.instance_id = 0U;
msg_ptr->id.function_id = INIC_FID_SYNC_CREATE;
msg_ptr->id.op_type = UCS_OP_STARTRESULT;
msg_ptr->tel.tel_data_ptr[0] = MISC_HB(resource_handle_in);
msg_ptr->tel.tel_data_ptr[1] = MISC_LB(resource_handle_in);
msg_ptr->tel.tel_data_ptr[2] = MISC_HB(resource_handle_out);
msg_ptr->tel.tel_data_ptr[3] = MISC_LB(resource_handle_out);
msg_ptr->tel.tel_data_ptr[4] = (default_mute != false) ? 1U : 0U;
msg_ptr->tel.tel_data_ptr[5] = (uint8_t)mute_mode;
msg_ptr->tel.tel_data_ptr[6] = MISC_HB(offset);
msg_ptr->tel.tel_data_ptr[7] = MISC_LB(offset);
self->ssubs[INIC_SSUB_CREATE_CLASS].user_mask = INIC_API_CREATE_CLASS;
msg_ptr->info_ptr = &self->ssubs[INIC_SSUB_CREATE_CLASS];
Trcv_TxSendMsgExt(self->xcvr_ptr, msg_ptr, &Inic_ResMsgTxStatusCb, self);
(void)Ssub_AddObserver(&self->ssubs[INIC_SSUB_CREATE_CLASS], obs_ptr);
}
else
{
Al_Release(&self->lock.res_api, INIC_API_CREATE_CLASS);
result = UCS_RET_ERR_BUFFER_OVERFLOW;
}
}
else
{
result = UCS_RET_ERR_API_LOCKED;
}
return result;
}
/*! \brief This function manually mutes a synchronous data connection.
* \param self Reference to CInic instance
* \param sync_handle Resource handle of the synchronous connection
* \param obs_ptr Reference to an optional observer
* \return UCS_RET_SUCCESS message was created
* \return UCS_RET_ERR_BUFFER_OVERFLOW no message buffer available
* \return UCS_RET_ERR_API_LOCKED Resource API is already used by another command
*/
Ucs_Return_t Inic_SyncMute(CInic *self,
uint16_t sync_handle,
CSingleObserver *obs_ptr)
{
Ucs_Return_t result = UCS_RET_SUCCESS;
if(Al_Lock(&self->lock.res_api, INIC_API_SYNC_MUTE) != false)
{
Msg_MostTel_t *msg_ptr = Trcv_TxAllocateMsg(self->xcvr_ptr, 2U);
if (msg_ptr != NULL)
{
msg_ptr->destination_addr = self->target_address;
msg_ptr->id.fblock_id = FB_INIC;
msg_ptr->id.instance_id = 0U;
msg_ptr->id.function_id = INIC_FID_SYNC_MUTE;
msg_ptr->id.op_type = UCS_OP_STARTRESULT;
msg_ptr->tel.tel_data_ptr[0] = MISC_HB(sync_handle);
msg_ptr->tel.tel_data_ptr[1] = MISC_LB(sync_handle);
self->ssubs[INIC_SSUB_SYNC_MUTE].user_mask = INIC_API_SYNC_MUTE;
msg_ptr->info_ptr = &self->ssubs[INIC_SSUB_SYNC_MUTE];
Trcv_TxSendMsgExt(self->xcvr_ptr, msg_ptr, &Inic_ResMsgTxStatusCb, self);
(void)Ssub_AddObserver(&self->ssubs[INIC_SSUB_SYNC_MUTE], obs_ptr);
}
else
{
Al_Release(&self->lock.res_api, INIC_API_SYNC_MUTE);
result = UCS_RET_ERR_BUFFER_OVERFLOW;
}
}
else
{
result = UCS_RET_ERR_API_LOCKED;
}
return result;
}
/*! \brief This function manually de-mutes a synchronous data connection.
* \param self Reference to CInic instance
* \param sync_handle Resource handle of the synchronous connection
* \param obs_ptr Reference to an optional observer
* \return UCS_RET_SUCCESS message was created
* \return UCS_RET_ERR_BUFFER_OVERFLOW no message buffer available
* \return UCS_RET_ERR_API_LOCKED Resource API is already used by another command
*/
Ucs_Return_t Inic_SyncDemute(CInic *self,
uint16_t sync_handle,
CSingleObserver *obs_ptr)
{
Ucs_Return_t result = UCS_RET_SUCCESS;
if(Al_Lock(&self->lock.res_api, INIC_API_SYNC_DEMUTE) != false)
{
Msg_MostTel_t *msg_ptr = Trcv_TxAllocateMsg(self->xcvr_ptr, 2U);
if (msg_ptr != NULL)
{
msg_ptr->destination_addr = self->target_address;
msg_ptr->id.fblock_id = FB_INIC;
msg_ptr->id.instance_id = 0U;
msg_ptr->id.function_id = INIC_FID_SYNC_DEMUTE;
msg_ptr->id.op_type = UCS_OP_STARTRESULT;
msg_ptr->tel.tel_data_ptr[0] = MISC_HB(sync_handle);
msg_ptr->tel.tel_data_ptr[1] = MISC_LB(sync_handle);
self->ssubs[INIC_SSUB_SYNC_DEMUTE].user_mask = INIC_API_SYNC_DEMUTE;
msg_ptr->info_ptr = &self->ssubs[INIC_SSUB_SYNC_DEMUTE];
Trcv_TxSendMsgExt(self->xcvr_ptr, msg_ptr, &Inic_ResMsgTxStatusCb, self);
(void)Ssub_AddObserver(&self->ssubs[INIC_SSUB_SYNC_DEMUTE], obs_ptr);
}
else
{
Al_Release(&self->lock.res_api, INIC_API_SYNC_DEMUTE);
result = UCS_RET_ERR_BUFFER_OVERFLOW;
}
}
else
{
result = UCS_RET_ERR_API_LOCKED;
}
return result;
}
/*! \brief Creates a DiscreteFrame Isochronous streaming phase connection. The connection can be
* directly associated with an input and output socket.
* \param self Reference to CInic instance
* \param resource_handle_in The ID number of the socket or splitter resource that is the
* starting point of the link.
* \param resource_handle_out The ID number of the socket or splitter resource that is the ending
* point of the link.
* \param obs_ptr Reference to an optional observer
* \return UCS_RET_SUCCESS message was created
* \return UCS_RET_ERR_BUFFER_OVERFLOW no message buffer available
* \return UCS_RET_ERR_API_LOCKED Resource API is already used by another command
*/
Ucs_Return_t Inic_DfiPhaseCreate(CInic *self,
uint16_t resource_handle_in,
uint16_t resource_handle_out,
CSingleObserver *obs_ptr)
{
Ucs_Return_t result = UCS_RET_SUCCESS;
if(Al_Lock(&self->lock.res_api, INIC_API_CREATE_CLASS) != false)
{
Msg_MostTel_t *msg_ptr = Trcv_TxAllocateMsg(self->xcvr_ptr, 4U);
if (msg_ptr != NULL)
{
msg_ptr->destination_addr = self->target_address;
msg_ptr->id.fblock_id = FB_INIC;
msg_ptr->id.instance_id = 0U;
msg_ptr->id.function_id = INIC_FID_DFIPHASE_CREATE;
msg_ptr->id.op_type = UCS_OP_STARTRESULT;
msg_ptr->tel.tel_data_ptr[0] = MISC_HB(resource_handle_in);
msg_ptr->tel.tel_data_ptr[1] = MISC_LB(resource_handle_in);
msg_ptr->tel.tel_data_ptr[2] = MISC_HB(resource_handle_out);
msg_ptr->tel.tel_data_ptr[3] = MISC_LB(resource_handle_out);
self->ssubs[INIC_SSUB_CREATE_CLASS].user_mask = INIC_API_CREATE_CLASS;
msg_ptr->info_ptr = &self->ssubs[INIC_SSUB_CREATE_CLASS];
Trcv_TxSendMsgExt(self->xcvr_ptr, msg_ptr, &Inic_ResMsgTxStatusCb, self);
(void)Ssub_AddObserver(&self->ssubs[INIC_SSUB_CREATE_CLASS], obs_ptr);
}
else
{
Al_Release(&self->lock.res_api, INIC_API_CREATE_CLASS);
result = UCS_RET_ERR_BUFFER_OVERFLOW;
}
}
else
{
result = UCS_RET_ERR_API_LOCKED;
}
return result;
}
/*! \brief Creates a combiner resource. A Combiner enables grouping of data from multiple network
* sockets into the same port socket.
* \param self Reference to CInic instance
* \param port_socket_handle Only supported sockets are Streaming Port, MLB, USB (OS81118) or PCI
* (OS81160) sockets of data type Synchronous. Direction must be OUT.
* \param most_port_handle When the splitter is created with a MOST socket, the socket must be
* created on the same port indicated by this handle.
* \param bytes_per_frame Specifies the total number of data bytes that are to be transferred
* each MOST frame.
* \param obs_ptr Reference to an optional observer
* \return UCS_RET_SUCCESS message was created
* \return UCS_RET_ERR_BUFFER_OVERFLOW no message buffer available
* \return UCS_RET_ERR_API_LOCKED Resource API is already used by another command
*/
Ucs_Return_t Inic_CombinerCreate(CInic *self,
uint16_t port_socket_handle,
uint16_t most_port_handle,
uint16_t bytes_per_frame,
CSingleObserver *obs_ptr)
{
Ucs_Return_t result = UCS_RET_SUCCESS;
if(Al_Lock(&self->lock.res_api, INIC_API_CREATE_CLASS) != false)
{
Msg_MostTel_t *msg_ptr = Trcv_TxAllocateMsg(self->xcvr_ptr, 6U);
if (msg_ptr != NULL)
{
msg_ptr->destination_addr = self->target_address;
msg_ptr->id.fblock_id = FB_INIC;
msg_ptr->id.instance_id = 0U;
msg_ptr->id.function_id = INIC_FID_COMBINER_CREATE;
msg_ptr->id.op_type = UCS_OP_STARTRESULT;
msg_ptr->tel.tel_data_ptr[0] = MISC_HB(port_socket_handle);
msg_ptr->tel.tel_data_ptr[1] = MISC_LB(port_socket_handle);
msg_ptr->tel.tel_data_ptr[2] = MISC_HB(most_port_handle);
msg_ptr->tel.tel_data_ptr[3] = MISC_LB(most_port_handle);
msg_ptr->tel.tel_data_ptr[4] = MISC_HB(bytes_per_frame);
msg_ptr->tel.tel_data_ptr[5] = MISC_LB(bytes_per_frame);
self->ssubs[INIC_SSUB_CREATE_CLASS].user_mask = INIC_API_CREATE_CLASS;
msg_ptr->info_ptr = &self->ssubs[INIC_SSUB_CREATE_CLASS];
Trcv_TxSendMsgExt(self->xcvr_ptr, msg_ptr, &Inic_ResMsgTxStatusCb, self);
(void)Ssub_AddObserver(&self->ssubs[INIC_SSUB_CREATE_CLASS], obs_ptr);
}
else
{
Al_Release(&self->lock.res_api, INIC_API_CREATE_CLASS);
result = UCS_RET_ERR_BUFFER_OVERFLOW;
}
}
else
{
result = UCS_RET_ERR_API_LOCKED;
}
return result;
}
/*! \brief Creates a splitter resource. A Splitter enables splitting up the data from a single
* channel into multiple channels.
* \param self Reference to CInic instance
* \param socket_handle_in All sockets of data type Synchronous are supported, regardless of
* the port the socket is created on. The direction must be IN.
* \param most_port_handle When the splitter is created with a MOST socket, the socket must be
* created on the same port indicated by this handle.
* \param bytes_per_frame Specifies the total number of data bytes that are to be transferred
* each MOST frame.
* \param obs_ptr Reference to an optional observer
* \return UCS_RET_SUCCESS message was created
* \return UCS_RET_ERR_BUFFER_OVERFLOW no message buffer available
* \return UCS_RET_ERR_API_LOCKED Resource API is already used by another command
*/
Ucs_Return_t Inic_SplitterCreate(CInic *self,
uint16_t socket_handle_in,
uint16_t most_port_handle,
uint16_t bytes_per_frame,
CSingleObserver *obs_ptr)
{
Ucs_Return_t result = UCS_RET_SUCCESS;
if(Al_Lock(&self->lock.res_api, INIC_API_CREATE_CLASS) != false)
{
Msg_MostTel_t *msg_ptr = Trcv_TxAllocateMsg(self->xcvr_ptr, 6U);
if (msg_ptr != NULL)
{
msg_ptr->destination_addr = self->target_address;
msg_ptr->id.fblock_id = FB_INIC;
msg_ptr->id.instance_id = 0U;
msg_ptr->id.function_id = INIC_FID_SPLITTER_CREATE;
msg_ptr->id.op_type = UCS_OP_STARTRESULT;
msg_ptr->tel.tel_data_ptr[0] = MISC_HB(socket_handle_in);
msg_ptr->tel.tel_data_ptr[1] = MISC_LB(socket_handle_in);
msg_ptr->tel.tel_data_ptr[2] = MISC_HB(most_port_handle);
msg_ptr->tel.tel_data_ptr[3] = MISC_LB(most_port_handle);
msg_ptr->tel.tel_data_ptr[4] = MISC_HB(bytes_per_frame);
msg_ptr->tel.tel_data_ptr[5] = MISC_LB(bytes_per_frame);
self->ssubs[INIC_SSUB_CREATE_CLASS].user_mask = INIC_API_CREATE_CLASS;
msg_ptr->info_ptr = &self->ssubs[INIC_SSUB_CREATE_CLASS];
Trcv_TxSendMsgExt(self->xcvr_ptr, msg_ptr, &Inic_ResMsgTxStatusCb, self);
(void)Ssub_AddObserver(&self->ssubs[INIC_SSUB_CREATE_CLASS], obs_ptr);
}
else
{
Al_Release(&self->lock.res_api, INIC_API_CREATE_CLASS);
result = UCS_RET_ERR_BUFFER_OVERFLOW;
}
}
else
{
result = UCS_RET_ERR_API_LOCKED;
}
return result;
}
/*! \brief Creates an Quality of Service IP Streaming data connection.
* \param self Reference to CInic instance
* \param socket_in_handle The ID number of the created socket that is the starting point of
* the link. Must be a socket of type Input.
* \param socket_out_handle The ID number of the created socket that is the ending point of
* the link. Must be a socket of type Output.
* \param obs_ptr Reference to an optional observer
* \return UCS_RET_SUCCESS message was created
* \return UCS_RET_ERR_BUFFER_OVERFLOW no message buffer available
* \return UCS_RET_ERR_API_LOCKED Resource API is already used by another command
*/
Ucs_Return_t Inic_QoSCreate(CInic *self,
uint16_t socket_in_handle,
uint16_t socket_out_handle,
CSingleObserver *obs_ptr)
{
Ucs_Return_t result = UCS_RET_SUCCESS;
if(Al_Lock(&self->lock.res_api, INIC_API_CREATE_CLASS) != false)
{
Msg_MostTel_t *msg_ptr = Trcv_TxAllocateMsg(self->xcvr_ptr, 4U);
if (msg_ptr != NULL)
{
msg_ptr->destination_addr = self->target_address;
msg_ptr->id.fblock_id = FB_INIC;
msg_ptr->id.instance_id = 0U;
msg_ptr->id.function_id = INIC_FID_QOS_CREATE;
msg_ptr->id.op_type = UCS_OP_STARTRESULT;
msg_ptr->tel.tel_data_ptr[0] = MISC_HB(socket_in_handle);
msg_ptr->tel.tel_data_ptr[1] = MISC_LB(socket_in_handle);
msg_ptr->tel.tel_data_ptr[2] = MISC_HB(socket_out_handle);
msg_ptr->tel.tel_data_ptr[3] = MISC_LB(socket_out_handle);
self->ssubs[INIC_SSUB_CREATE_CLASS].user_mask = INIC_API_CREATE_CLASS;
msg_ptr->info_ptr = &self->ssubs[INIC_SSUB_CREATE_CLASS];
Trcv_TxSendMsgExt(self->xcvr_ptr, msg_ptr, &Inic_ResMsgTxStatusCb, self);
(void)Ssub_AddObserver(&self->ssubs[INIC_SSUB_CREATE_CLASS], obs_ptr);
}
else
{
Al_Release(&self->lock.res_api, INIC_API_CREATE_CLASS);
result = UCS_RET_ERR_BUFFER_OVERFLOW;
}
}
else
{
result = UCS_RET_ERR_API_LOCKED;
}
return result;
}
/*! \brief Creates an IPC (Inter-Processor Communication) packet connection.
* \param self Reference to CInic instance
* \param socket_in_handle The ID number of the created socket that is the starting point of
* the link. Must be a socket of type Input.
* \param socket_out_handle The ID number of the created socket that is the ending point of
* the link. Must be a socket of type Output.
* \param obs_ptr Reference to an optional observer
* \return UCS_RET_SUCCESS message was created
* \return UCS_RET_ERR_BUFFER_OVERFLOW no message buffer available
* \return UCS_RET_ERR_API_LOCKED Resource API is already used by another command
*/
Ucs_Return_t Inic_IpcCreate(CInic *self,
uint16_t socket_in_handle,
uint16_t socket_out_handle,
CSingleObserver *obs_ptr)
{
Ucs_Return_t result = UCS_RET_SUCCESS;
if(Al_Lock(&self->lock.res_api, INIC_API_CREATE_CLASS) != false)
{
Msg_MostTel_t *msg_ptr = Trcv_TxAllocateMsg(self->xcvr_ptr, 4U);
if (msg_ptr != NULL)
{
msg_ptr->destination_addr = self->target_address;
msg_ptr->id.fblock_id = FB_INIC;
msg_ptr->id.instance_id = 0U;
msg_ptr->id.function_id = INIC_FID_IPC_CREATE;
msg_ptr->id.op_type = UCS_OP_STARTRESULT;
msg_ptr->tel.tel_data_ptr[0] = MISC_HB(socket_in_handle);
msg_ptr->tel.tel_data_ptr[1] = MISC_LB(socket_in_handle);
msg_ptr->tel.tel_data_ptr[2] = MISC_HB(socket_out_handle);
msg_ptr->tel.tel_data_ptr[3] = MISC_LB(socket_out_handle);
self->ssubs[INIC_SSUB_CREATE_CLASS].user_mask = INIC_API_CREATE_CLASS;
msg_ptr->info_ptr = &self->ssubs[INIC_SSUB_CREATE_CLASS];
Trcv_TxSendMsgExt(self->xcvr_ptr, msg_ptr, &Inic_ResMsgTxStatusCb, self);
(void)Ssub_AddObserver(&self->ssubs[INIC_SSUB_CREATE_CLASS], obs_ptr);
}
else
{
Al_Release(&self->lock.res_api, INIC_API_CREATE_CLASS);
result = UCS_RET_ERR_BUFFER_OVERFLOW;
}
}
else
{
result = UCS_RET_ERR_API_LOCKED;
}
return result;
}
/*! \brief Creates an A/V Packetized Isochronous Streaming data connection.
* \param self Reference to CInic instance
* \param socket_in_handle The ID number of the created socket that is the starting point of
* the link. Must be a socket of type Input.
* \param socket_out_handle The ID number of the created socket that is the ending point of
* the link. Must be a socket of type Output.
* \param isoc_packet_size Specifies the size of data packets that are to be transported over
* the isochronous channel.
* \param obs_ptr Reference to an optional observer
* \return UCS_RET_SUCCESS message was created
* \return UCS_RET_ERR_BUFFER_OVERFLOW no message buffer available
* \return UCS_RET_ERR_API_LOCKED Resource API is already used by another command
*/
Ucs_Return_t Inic_AvpCreate(CInic *self,
uint16_t socket_in_handle,
uint16_t socket_out_handle,
Ucs_Avp_IsocPacketSize_t isoc_packet_size,
CSingleObserver *obs_ptr)
{
Ucs_Return_t result = UCS_RET_SUCCESS;
if(Al_Lock(&self->lock.res_api, INIC_API_CREATE_CLASS) != false)
{
Msg_MostTel_t *msg_ptr = Trcv_TxAllocateMsg(self->xcvr_ptr, 6U);
if (msg_ptr != NULL)
{
msg_ptr->destination_addr = self->target_address;
msg_ptr->id.fblock_id = FB_INIC;
msg_ptr->id.instance_id = 0U;
msg_ptr->id.function_id = INIC_FID_AVP_CREATE;
msg_ptr->id.op_type = UCS_OP_STARTRESULT;
msg_ptr->tel.tel_data_ptr[0] = MISC_HB(socket_in_handle);
msg_ptr->tel.tel_data_ptr[1] = MISC_LB(socket_in_handle);
msg_ptr->tel.tel_data_ptr[2] = MISC_HB(socket_out_handle);
msg_ptr->tel.tel_data_ptr[3] = MISC_LB(socket_out_handle);
msg_ptr->tel.tel_data_ptr[4] = MISC_HB((uint16_t)isoc_packet_size);
msg_ptr->tel.tel_data_ptr[5] = MISC_LB((uint16_t)isoc_packet_size);
self->ssubs[INIC_SSUB_CREATE_CLASS].user_mask = INIC_API_CREATE_CLASS;
msg_ptr->info_ptr = &self->ssubs[INIC_SSUB_CREATE_CLASS];
Trcv_TxSendMsgExt(self->xcvr_ptr, msg_ptr, &Inic_ResMsgTxStatusCb, self);
(void)Ssub_AddObserver(&self->ssubs[INIC_SSUB_CREATE_CLASS], obs_ptr);
}
else
{
Al_Release(&self->lock.res_api, INIC_API_CREATE_CLASS);
result = UCS_RET_ERR_BUFFER_OVERFLOW;
}
}
else
{
result = UCS_RET_ERR_API_LOCKED;
}
return result;
}
/*! \brief This function creates a MOST socket bound to the MOST Network Port.
* \param self Reference to CInic instance
* \param most_port_handle MOST Network Port resource handle
* \param direction indicates the direction of the data stream from the perspective of
* the INIC
* \param data_type Specifies the data type
* \param bandwidth Required socket bandwidth in bytes. Maximum value depends on current
* free network resources.
* \param connection_label MOST network connection label. When used as parameter with direction
* Input, the connection label is used to connect to the appropriate MOST
* frame bytes. When used as parameter with direction Output, the
* connection label is not used and must be set to 0xFFFF.
* \param obs_ptr Reference to an optional observer
* \return UCS_RET_SUCCESS message was created
* \return UCS_RET_ERR_BUFFER_OVERFLOW no message buffer available
* \return UCS_RET_ERR_API_LOCKED Resource API is already used by another command
*/
Ucs_Return_t Inic_MostSocketCreate(CInic *self,
uint16_t most_port_handle,
Ucs_SocketDirection_t direction,
Ucs_Most_SocketDataType_t data_type,
uint16_t bandwidth,
uint16_t connection_label,
CSingleObserver *obs_ptr)
{
Ucs_Return_t result = UCS_RET_SUCCESS;
if(Al_Lock(&self->lock.res_api, INIC_API_CREATE_CLASS) != false)
{
Msg_MostTel_t *msg_ptr = Trcv_TxAllocateMsg(self->xcvr_ptr, 8U);
if (msg_ptr != NULL)
{
msg_ptr->destination_addr = self->target_address;
msg_ptr->id.fblock_id = FB_INIC;
msg_ptr->id.instance_id = 0U;
msg_ptr->id.function_id = INIC_FID_MOST_SOCKET_CREATE;
msg_ptr->id.op_type = UCS_OP_STARTRESULT;
msg_ptr->tel.tel_data_ptr[0] = MISC_HB(most_port_handle);
msg_ptr->tel.tel_data_ptr[1] = MISC_LB(most_port_handle);
msg_ptr->tel.tel_data_ptr[2] = (uint8_t)direction;
msg_ptr->tel.tel_data_ptr[3] = (uint8_t)data_type;
msg_ptr->tel.tel_data_ptr[4] = MISC_HB(bandwidth);
msg_ptr->tel.tel_data_ptr[5] = MISC_LB(bandwidth);
msg_ptr->tel.tel_data_ptr[6] = MISC_HB(connection_label);
msg_ptr->tel.tel_data_ptr[7] = MISC_LB(connection_label);
self->ssubs[INIC_SSUB_CREATE_CLASS].user_mask = INIC_API_CREATE_CLASS;
msg_ptr->info_ptr = &self->ssubs[INIC_SSUB_CREATE_CLASS];
Trcv_TxSendMsgExt(self->xcvr_ptr, msg_ptr, &Inic_ResMsgTxStatusCb, self);
(void)Ssub_AddObserver(&self->ssubs[INIC_SSUB_CREATE_CLASS], obs_ptr);
}
else
{
Al_Release(&self->lock.res_api, INIC_API_CREATE_CLASS);
result = UCS_RET_ERR_BUFFER_OVERFLOW;
}
}
else
{
result = UCS_RET_ERR_API_LOCKED;
}
return result;
}
/*! \brief Creates the MediaLB Port with its associated port instance identifier.
* \param self Reference to CInic instance
* \param index MediaLB Port instance
* \param clock_config Stores the clock speed configuration. The value is a multiple
* of the MOST network frame rate Fs; this means the MediaLB Port
* can only be frequency locked to the network's system clock.
* \param obs_ptr Reference to an optional observer
* \return UCS_RET_SUCCESS message was created
* \return UCS_RET_ERR_BUFFER_OVERFLOW no message buffer available
* \return UCS_RET_ERR_API_LOCKED Resource API is already used by another command
*/
Ucs_Return_t Inic_MlbPortCreate(CInic *self,
uint8_t index,
Ucs_Mlb_ClockConfig_t clock_config,
CSingleObserver *obs_ptr)
{
Ucs_Return_t result = UCS_RET_SUCCESS;
if(Al_Lock(&self->lock.res_api, INIC_API_CREATE_CLASS) != false)
{
Msg_MostTel_t *msg_ptr = Trcv_TxAllocateMsg(self->xcvr_ptr, 2U);
if (msg_ptr != NULL)
{
msg_ptr->destination_addr = self->target_address;
msg_ptr->id.fblock_id = FB_INIC;
msg_ptr->id.instance_id = 0U;
msg_ptr->id.function_id = INIC_FID_MLB_PORT_CREATE;
msg_ptr->id.op_type = UCS_OP_STARTRESULT;
msg_ptr->tel.tel_data_ptr[0] = index;
msg_ptr->tel.tel_data_ptr[1] = (uint8_t)clock_config;
self->ssubs[INIC_SSUB_CREATE_CLASS].user_mask = INIC_API_CREATE_CLASS;
msg_ptr->info_ptr = &self->ssubs[INIC_SSUB_CREATE_CLASS];
Trcv_TxSendMsgExt(self->xcvr_ptr, msg_ptr, &Inic_ResMsgTxStatusCb, self);
(void)Ssub_AddObserver(&self->ssubs[INIC_SSUB_CREATE_CLASS], obs_ptr);
}
else
{
Al_Release(&self->lock.res_api, INIC_API_CREATE_CLASS);
result = UCS_RET_ERR_BUFFER_OVERFLOW;
}
}
else
{
result = UCS_RET_ERR_API_LOCKED;
}
return result;
}
/*! \brief Creates a MediaLB socket bound to the MediaLB Port with the associated port instance
* identifier. If INIC enters Protected Mode, the MediaLB socket will be automatically
* destroyed.
* \param self Reference to CInic instance
* \param mlb_port_handle MediaLB Port resource handle
* \param direction Indicates the direction of the data stream from the perspective of
* the INIC
* \param data_type Specifies the data type
* \param bandwidth Required socket bandwidth in bytes
* \param channel_address Indicates the MediaLB ChannelAddress where the socket is mapped to.
* If the MediaLB Port is created by default, ChannelAddresses 0x0002
* and 0x0004 are reserved and cannot be used.
* \param obs_ptr Reference to an optional observer
* \return UCS_RET_SUCCESS message was created
* \return UCS_RET_ERR_BUFFER_OVERFLOW no message buffer available
* \return UCS_RET_ERR_API_LOCKED Resource API is already used by another command
*/
Ucs_Return_t Inic_MlbSocketCreate(CInic *self,
uint16_t mlb_port_handle,
Ucs_SocketDirection_t direction,
Ucs_Mlb_SocketDataType_t data_type,
uint16_t bandwidth,
uint16_t channel_address,
CSingleObserver *obs_ptr)
{
Ucs_Return_t result = UCS_RET_SUCCESS;
if(Al_Lock(&self->lock.res_api, INIC_API_CREATE_CLASS) != false)
{
Msg_MostTel_t *msg_ptr = Trcv_TxAllocateMsg(self->xcvr_ptr, 8U);
if (msg_ptr != NULL)
{
msg_ptr->destination_addr = self->target_address;
msg_ptr->id.fblock_id = FB_INIC;
msg_ptr->id.instance_id = 0U;
msg_ptr->id.function_id = INIC_FID_MLB_SOCKET_CREATE;
msg_ptr->id.op_type = UCS_OP_STARTRESULT;
msg_ptr->tel.tel_data_ptr[0] = MISC_HB(mlb_port_handle);
msg_ptr->tel.tel_data_ptr[1] = MISC_LB(mlb_port_handle);
msg_ptr->tel.tel_data_ptr[2] = (uint8_t)direction;
msg_ptr->tel.tel_data_ptr[3] = (uint8_t)data_type;
msg_ptr->tel.tel_data_ptr[4] = MISC_HB(bandwidth);
msg_ptr->tel.tel_data_ptr[5] = MISC_LB(bandwidth);
msg_ptr->tel.tel_data_ptr[6] = MISC_HB(channel_address);
msg_ptr->tel.tel_data_ptr[7] = MISC_LB(channel_address);
self->ssubs[INIC_SSUB_CREATE_CLASS].user_mask = INIC_API_CREATE_CLASS;
msg_ptr->info_ptr = &self->ssubs[INIC_SSUB_CREATE_CLASS];
Trcv_TxSendMsgExt(self->xcvr_ptr, msg_ptr, &Inic_ResMsgTxStatusCb, self);
(void)Ssub_AddObserver(&self->ssubs[INIC_SSUB_CREATE_CLASS], obs_ptr);
}
else
{
Al_Release(&self->lock.res_api, INIC_API_CREATE_CLASS);
result = UCS_RET_ERR_BUFFER_OVERFLOW;
}
}
else
{
result = UCS_RET_ERR_API_LOCKED;
}
return result;
}
/*! \brief Creates the USB Port with its associated port instance identifier. The instance
* identifier of an USB Port is always directly bound to a specific hardware port.
* \param self Reference to CInic instance
* \param index USB Port instance
* \param physical_layer USB Port physical layer
* \param devices_interfaces USB Interfaces supported by the device
* \param streaming_if_ep_out_count number of USB OUT Endpoints being provided through the USB streaming interface
* \param streaming_if_ep_in_count number of USB IN Endpoints being provided through the USB Streaming interface
* \param obs_ptr Reference to an optional observer
* \return UCS_RET_SUCCESS message was created
* \return UCS_RET_ERR_BUFFER_OVERFLOW no message buffer available
* \return UCS_RET_ERR_API_LOCKED Resource API is already used by another command
*/
Ucs_Return_t Inic_UsbPortCreate(CInic *self,
uint8_t index,
Ucs_Usb_PhysicalLayer_t physical_layer,
uint16_t devices_interfaces,
uint8_t streaming_if_ep_out_count,
uint8_t streaming_if_ep_in_count,
CSingleObserver *obs_ptr)
{
Ucs_Return_t result = UCS_RET_SUCCESS;
if(Al_Lock(&self->lock.res_api, INIC_API_CREATE_CLASS) != false)
{
Msg_MostTel_t *msg_ptr = Trcv_TxAllocateMsg(self->xcvr_ptr, 6U);
if (msg_ptr != NULL)
{
msg_ptr->destination_addr = self->target_address;
msg_ptr->id.fblock_id = FB_INIC;
msg_ptr->id.instance_id = 0U;
msg_ptr->id.function_id = INIC_FID_USB_PORT_CREATE;
msg_ptr->id.op_type = UCS_OP_STARTRESULT;
msg_ptr->tel.tel_data_ptr[0] = index;
msg_ptr->tel.tel_data_ptr[1] = (uint8_t)physical_layer;
msg_ptr->tel.tel_data_ptr[2] = MISC_HB(devices_interfaces);
msg_ptr->tel.tel_data_ptr[3] = MISC_LB(devices_interfaces);
msg_ptr->tel.tel_data_ptr[4] = streaming_if_ep_out_count;
msg_ptr->tel.tel_data_ptr[5] = streaming_if_ep_in_count;
self->ssubs[INIC_SSUB_CREATE_CLASS].user_mask = INIC_API_CREATE_CLASS;
msg_ptr->info_ptr = &self->ssubs[INIC_SSUB_CREATE_CLASS];
Trcv_TxSendMsgExt(self->xcvr_ptr, msg_ptr, &Inic_ResMsgTxStatusCb, self);
(void)Ssub_AddObserver(&self->ssubs[INIC_SSUB_CREATE_CLASS], obs_ptr);
}
else
{
Al_Release(&self->lock.res_api, INIC_API_CREATE_CLASS);
result = UCS_RET_ERR_BUFFER_OVERFLOW;
}
}
else
{
result = UCS_RET_ERR_API_LOCKED;
}
return result;
}
/*! \brief Creates a USB socket bound to the USB port with its associated port instance identifier.
* If INIC enters Protected Mode, the USB socket will be automatically destroyed.
* \param self Reference to CInic instance
* \param usb_port_handle USB Port resource handle
* \param direction Indicates the direction of the data stream from the perspective of
* the INIC
* \param data_type Specifies the data type
* \param end_point_addr Denotes the address of a USB endpoint as per its description in the
* USB 2.0 Specification
* \param frames_per_transfer Indicates the number of MOST frames per transfer per one USB
* transaction
* \param obs_ptr Reference to an optional observer
* \return UCS_RET_SUCCESS message was created
* \return UCS_RET_ERR_BUFFER_OVERFLOW no message buffer available
* \return UCS_RET_ERR_API_LOCKED Resource API is already used by another command
*/
Ucs_Return_t Inic_UsbSocketCreate(CInic *self,
uint16_t usb_port_handle,
Ucs_SocketDirection_t direction,
Ucs_Usb_SocketDataType_t data_type,
uint8_t end_point_addr,
uint16_t frames_per_transfer,
CSingleObserver *obs_ptr)
{
Ucs_Return_t result = UCS_RET_SUCCESS;
if(Al_Lock(&self->lock.res_api, INIC_API_CREATE_CLASS) != false)
{
Msg_MostTel_t *msg_ptr = Trcv_TxAllocateMsg(self->xcvr_ptr, 7U);
if (msg_ptr != NULL)
{
msg_ptr->destination_addr = self->target_address;
msg_ptr->id.fblock_id = FB_INIC;
msg_ptr->id.instance_id = 0U;
msg_ptr->id.function_id = INIC_FID_USB_SOCKET_CREATE;
msg_ptr->id.op_type = UCS_OP_STARTRESULT;
msg_ptr->tel.tel_data_ptr[0] = MISC_HB(usb_port_handle);
msg_ptr->tel.tel_data_ptr[1] = MISC_LB(usb_port_handle);
msg_ptr->tel.tel_data_ptr[2] = (uint8_t)direction;
msg_ptr->tel.tel_data_ptr[3] = (uint8_t)data_type;
msg_ptr->tel.tel_data_ptr[4] = end_point_addr;
msg_ptr->tel.tel_data_ptr[5] = MISC_HB(frames_per_transfer);
msg_ptr->tel.tel_data_ptr[6] = MISC_LB(frames_per_transfer);
self->ssubs[INIC_SSUB_CREATE_CLASS].user_mask = INIC_API_CREATE_CLASS;
msg_ptr->info_ptr = &self->ssubs[INIC_SSUB_CREATE_CLASS];
Trcv_TxSendMsgExt(self->xcvr_ptr, msg_ptr, &Inic_ResMsgTxStatusCb, self);
(void)Ssub_AddObserver(&self->ssubs[INIC_SSUB_CREATE_CLASS], obs_ptr);
}
else
{
Al_Release(&self->lock.res_api, INIC_API_CREATE_CLASS);
result = UCS_RET_ERR_BUFFER_OVERFLOW;
}
}
else
{
result = UCS_RET_ERR_API_LOCKED;
}
return result;
}
/*! \brief This function is used to configure the Streaming Ports.
* \param self Reference to CInic instance
* \param index Streaming Port instance
* \param op_mode Streaming Port Operation mode
* \param port_option Streaming Port Options
* \param clock_mode Stream Port Clock Mode
* \param clock_data_delay Stream Port Clock Data Delay
* \param obs_ptr Reference to an optional observer
* \return UCS_RET_SUCCESS message was created
* \return UCS_RET_ERR_BUFFER_OVERFLOW no message buffer available
*/
Ucs_Return_t Inic_StreamPortConfig_SetGet(CInic *self,
uint8_t index,
Ucs_Stream_PortOpMode_t op_mode,
Ucs_Stream_PortOption_t port_option,
Ucs_Stream_PortClockMode_t clock_mode,
Ucs_Stream_PortClockDataDelay_t clock_data_delay,
CSingleObserver *obs_ptr)
{
Ucs_Return_t result = UCS_RET_SUCCESS;
if(Al_Lock(&self->lock.res_api, INIC_API_STREAM_PORT_CONFIG) != false)
{
Msg_MostTel_t *msg_ptr = Trcv_TxAllocateMsg(self->xcvr_ptr, 5U);
if (msg_ptr != NULL)
{
msg_ptr->destination_addr = self->target_address;
msg_ptr->id.fblock_id = FB_INIC;
msg_ptr->id.instance_id = 0U;
msg_ptr->id.function_id = INIC_FID_STREAM_PORT_CONFIG;
msg_ptr->id.op_type = UCS_OP_SETGET;
msg_ptr->tel.tel_data_ptr[0] = (uint8_t)index;
msg_ptr->tel.tel_data_ptr[1] = (uint8_t)op_mode;
msg_ptr->tel.tel_data_ptr[2] = (uint8_t)port_option;
msg_ptr->tel.tel_data_ptr[3] = (uint8_t)clock_mode;
msg_ptr->tel.tel_data_ptr[4] = (uint8_t)clock_data_delay;
self->ssubs[INIC_SSUB_STREAM_PORT_CONFIG].user_mask = INIC_API_STREAM_PORT_CONFIG;
msg_ptr->info_ptr = &self->ssubs[INIC_SSUB_STREAM_PORT_CONFIG];
Trcv_TxSendMsgExt(self->xcvr_ptr, msg_ptr, &Inic_ResMsgTxStatusCb, self);
(void)Ssub_AddObserver(&self->ssubs[INIC_SSUB_STREAM_PORT_CONFIG], obs_ptr);
}
else
{
Al_Release(&self->lock.res_api, INIC_API_STREAM_PORT_CONFIG);
result = UCS_RET_ERR_BUFFER_OVERFLOW;
}
}
else
{
result = UCS_RET_ERR_API_LOCKED;
}
return result;
}
/*! \brief This function is used to request the configurations of the Streaming Ports.
* \param self Reference to CInic instance
* \param index Streaming Port Instance ID
* \param obs_ptr Reference to an optional observer
* \return UCS_RET_SUCCESS message was created
* \return UCS_RET_ERR_BUFFER_OVERFLOW no message buffer available
* \return UCS_RET_ERR_API_LOCKED Resource API is already used by another command
*/
Ucs_Return_t Inic_StreamPortConfig_Get(CInic *self,
uint8_t index,
CSingleObserver *obs_ptr)
{
Ucs_Return_t result = UCS_RET_SUCCESS;
if(Al_Lock(&self->lock.res_api, INIC_API_STREAM_PORT_CONFIG) != false)
{
Msg_MostTel_t *msg_ptr = Trcv_TxAllocateMsg(self->xcvr_ptr, 1U);
if (msg_ptr != NULL)
{
msg_ptr->destination_addr = self->target_address;
msg_ptr->id.fblock_id = FB_INIC;
msg_ptr->id.instance_id = 0U;
msg_ptr->id.function_id = INIC_FID_STREAM_PORT_CONFIG;
msg_ptr->id.op_type = UCS_OP_GET;
msg_ptr->tel.tel_data_ptr[0] = (uint8_t)index;
self->ssubs[INIC_SSUB_STREAM_PORT_CONFIG].user_mask = INIC_API_STREAM_PORT_CONFIG;
msg_ptr->info_ptr = &self->ssubs[INIC_SSUB_STREAM_PORT_CONFIG];
Trcv_TxSendMsgExt(self->xcvr_ptr, msg_ptr, &Inic_ResMsgTxStatusCb, self);
(void)Ssub_AddObserver(&self->ssubs[INIC_SSUB_STREAM_PORT_CONFIG], obs_ptr);
}
else
{
Al_Release(&self->lock.res_api, INIC_API_STREAM_PORT_CONFIG);
result = UCS_RET_ERR_BUFFER_OVERFLOW;
}
}
else
{
result = UCS_RET_ERR_API_LOCKED;
}
return result;
}
/*! \brief This function creates the Streaming Port with its associated port instance identifier.
* \param self Reference to CInic instance
* \param index Streaming Port instance
* \param clock_config Clock speed configuration of the SCK signal
* \param data_alignment Defines the alignment of the data bytes within the streaming port frame
* \param obs_ptr Reference to an optional observer
* \return UCS_RET_SUCCESS message was created
* \return UCS_RET_ERR_BUFFER_OVERFLOW no message buffer available
* \return UCS_RET_ERR_API_LOCKED Resource API is already used by another command
*/
Ucs_Return_t Inic_StreamPortCreate(CInic *self,
uint8_t index,
Ucs_Stream_PortClockConfig_t clock_config,
Ucs_Stream_PortDataAlign_t data_alignment,
CSingleObserver *obs_ptr)
{
Ucs_Return_t result = UCS_RET_SUCCESS;
if(Al_Lock(&self->lock.res_api, INIC_API_CREATE_CLASS) != false)
{
Msg_MostTel_t *msg_ptr = Trcv_TxAllocateMsg(self->xcvr_ptr, 3U);
if (msg_ptr != NULL)
{
msg_ptr->destination_addr = self->target_address;
msg_ptr->id.fblock_id = FB_INIC;
msg_ptr->id.instance_id = 0U;
msg_ptr->id.function_id = INIC_FID_STREAM_PORT_CREATE;
msg_ptr->id.op_type = UCS_OP_STARTRESULT;
msg_ptr->tel.tel_data_ptr[0] = index;
msg_ptr->tel.tel_data_ptr[1] = (uint8_t)clock_config;
msg_ptr->tel.tel_data_ptr[2] = (uint8_t)data_alignment;
self->ssubs[INIC_SSUB_CREATE_CLASS].user_mask = INIC_API_CREATE_CLASS;
msg_ptr->info_ptr = &self->ssubs[INIC_SSUB_CREATE_CLASS];
Trcv_TxSendMsgExt(self->xcvr_ptr, msg_ptr, &Inic_ResMsgTxStatusCb, self);
(void)Ssub_AddObserver(&self->ssubs[INIC_SSUB_CREATE_CLASS], obs_ptr);
}
else
{
Al_Release(&self->lock.res_api, INIC_API_CREATE_CLASS);
result = UCS_RET_ERR_BUFFER_OVERFLOW;
}
}
else
{
result = UCS_RET_ERR_API_LOCKED;
}
return result;
}
/*! \brief This function creates a Synchronous or DiscreteFrame Isochronous Streaming data socket
* bound to the Streaming Port with the denoted port instance identifier.
* \param self Reference to CInic instance
* \param stream_port_handle Streaming Port resource handle
* \param direction Indicates the direction of the data stream, from the INIC's
* perspective
* \param data_type Specifies the data type
* \param bandwidth Required socket bandwidth in bytes
* \param stream_pin_id ID of the serial interface pin of the addressed Streaming Port
* instance
* \param obs_ptr Reference to an optional observer
* \return UCS_RET_SUCCESS message was created
* \return UCS_RET_ERR_BUFFER_OVERFLOW no message buffer available
* \return UCS_RET_ERR_API_LOCKED Resource API is already used by another command
*/
Ucs_Return_t Inic_StreamSocketCreate(CInic *self,
uint16_t stream_port_handle,
Ucs_SocketDirection_t direction,
Ucs_Stream_SocketDataType_t data_type,
uint16_t bandwidth,
Ucs_Stream_PortPinId_t stream_pin_id,
CSingleObserver *obs_ptr)
{
Ucs_Return_t result = UCS_RET_SUCCESS;
if(Al_Lock(&self->lock.res_api, INIC_API_CREATE_CLASS) != false)
{
Msg_MostTel_t *msg_ptr = Trcv_TxAllocateMsg(self->xcvr_ptr, 7U);
if (msg_ptr != NULL)
{
msg_ptr->destination_addr = self->target_address;
msg_ptr->id.fblock_id = FB_INIC;
msg_ptr->id.instance_id = 0U;
msg_ptr->id.function_id = INIC_FID_STREAM_SOCKET_CREATE;
msg_ptr->id.op_type = UCS_OP_STARTRESULT;
msg_ptr->tel.tel_data_ptr[0] = MISC_HB(stream_port_handle);
msg_ptr->tel.tel_data_ptr[1] = MISC_LB(stream_port_handle);
msg_ptr->tel.tel_data_ptr[2] = (uint8_t)direction;
msg_ptr->tel.tel_data_ptr[3] = (uint8_t)data_type;
msg_ptr->tel.tel_data_ptr[4] = MISC_HB(bandwidth);
msg_ptr->tel.tel_data_ptr[5] = MISC_LB(bandwidth);
msg_ptr->tel.tel_data_ptr[6] = (uint8_t)stream_pin_id;
self->ssubs[INIC_SSUB_CREATE_CLASS].user_mask = INIC_API_CREATE_CLASS;
msg_ptr->info_ptr = &self->ssubs[INIC_SSUB_CREATE_CLASS];
Trcv_TxSendMsgExt(self->xcvr_ptr, msg_ptr, &Inic_ResMsgTxStatusCb, self);
(void)Ssub_AddObserver(&self->ssubs[INIC_SSUB_CREATE_CLASS], obs_ptr);
}
else
{
Al_Release(&self->lock.res_api, INIC_API_CREATE_CLASS);
result = UCS_RET_ERR_BUFFER_OVERFLOW;
}
}
else
{
result = UCS_RET_ERR_API_LOCKED;
}
return result;
}
/*! \brief This function creates an RMCK Port with its associated port instance identifier.
* \param self Reference to CInic instance
* \param index RMCK Port instance
* \param clock_source Indicates the source of the RMCK clock
* \param divisor Divisor of the clock source
* \param obs_ptr Reference to an optional observer
* \return UCS_RET_SUCCESS message was created
* \return UCS_RET_ERR_BUFFER_OVERFLOW no message buffer available
* \return UCS_RET_ERR_API_LOCKED Resource API is already used by another command
*/
Ucs_Return_t Inic_RmckPortCreate(CInic *self,
uint8_t index,
Ucs_Rmck_PortClockSource_t clock_source,
uint16_t divisor,
CSingleObserver *obs_ptr)
{
Ucs_Return_t result = UCS_RET_SUCCESS;
if(Al_Lock(&self->lock.res_api, INIC_API_CREATE_CLASS) != false)
{
Msg_MostTel_t *msg_ptr = Trcv_TxAllocateMsg(self->xcvr_ptr, 4U);
if (msg_ptr != NULL)
{
msg_ptr->destination_addr = self->target_address;
msg_ptr->id.fblock_id = FB_INIC;
msg_ptr->id.instance_id = 0U;
msg_ptr->id.function_id = INIC_FID_RMCK_PORT_CREATE;
msg_ptr->id.op_type = UCS_OP_STARTRESULT;
msg_ptr->tel.tel_data_ptr[0] = index;
msg_ptr->tel.tel_data_ptr[1] = (uint8_t)clock_source;
msg_ptr->tel.tel_data_ptr[2] = MISC_HB(divisor);
msg_ptr->tel.tel_data_ptr[3] = MISC_LB(divisor);
self->ssubs[INIC_SSUB_CREATE_CLASS].user_mask = INIC_API_CREATE_CLASS;
msg_ptr->info_ptr = &self->ssubs[INIC_SSUB_CREATE_CLASS];
Trcv_TxSendMsgExt(self->xcvr_ptr, msg_ptr, &Inic_ResMsgTxStatusCb, self);
(void)Ssub_AddObserver(&self->ssubs[INIC_SSUB_CREATE_CLASS], obs_ptr);
}
else
{
Al_Release(&self->lock.res_api, INIC_API_CREATE_CLASS);
result = UCS_RET_ERR_BUFFER_OVERFLOW;
}
}
else
{
result = UCS_RET_ERR_API_LOCKED;
}
return result;
}
/*! \brief This function creates an I2C Port with its associated port instance identifier.
* \param self Reference to CInic instance
* \param index I2C Port instance
* \param address The 7-bit I2C slave address of the peripheral to be read.
* \param mode The operation mode of the I2C Port
* \param speed The speed grade of the I2C Port
* \param obs_ptr Reference to an optional observer
* \return UCS_RET_SUCCESS message was created
* \return UCS_RET_ERR_BUFFER_OVERFLOW no message buffer available
* \return UCS_RET_ERR_API_LOCKED Resource API is already used by another command
*/
Ucs_Return_t Inic_I2cPortCreate(CInic *self,
uint8_t index,
uint8_t address,
uint8_t mode,
Ucs_I2c_Speed_t speed,
CSingleObserver *obs_ptr)
{
Ucs_Return_t result = UCS_RET_SUCCESS;
if(Al_Lock(&self->lock.res_api, INIC_API_CREATE_CLASS) != false)
{
Msg_MostTel_t *msg_ptr = Trcv_TxAllocateMsg(self->xcvr_ptr, 4U);
if (msg_ptr != NULL)
{
msg_ptr->destination_addr = self->target_address;
msg_ptr->id.fblock_id = FB_INIC;
msg_ptr->id.instance_id = 0U;
msg_ptr->id.function_id = INIC_FID_I2C_PORT_CREATE;
msg_ptr->id.op_type = UCS_OP_STARTRESULT;
msg_ptr->tel.tel_data_ptr[0] = index;
msg_ptr->tel.tel_data_ptr[1] = address;
msg_ptr->tel.tel_data_ptr[2] = mode;
msg_ptr->tel.tel_data_ptr[3] = (uint8_t)speed;
self->ssubs[INIC_SSUB_CREATE_CLASS].user_mask = INIC_API_CREATE_CLASS;
msg_ptr->info_ptr = &self->ssubs[INIC_SSUB_CREATE_CLASS];
Trcv_TxSendMsgExt(self->xcvr_ptr, msg_ptr, &Inic_ResMsgTxStatusCb, self);
(void)Ssub_AddObserver(&self->ssubs[INIC_SSUB_CREATE_CLASS], obs_ptr);
}
else
{
Al_Release(&self->lock.res_api, INIC_API_CREATE_CLASS);
result = UCS_RET_ERR_BUFFER_OVERFLOW;
}
}
else
{
result = UCS_RET_ERR_API_LOCKED;
}
return result;
}
/*! \brief This function reads a block of bytes from an I2C device at a specified I2C address.
* \param self Reference to CInic instance
* \param port_handle Port resource handle
* \param slave_address The 7-bit I2C slave address of the peripheral to be read
* \param data_len Number of bytes to be read from the address
* \param timeout The timeout for the I2C Port read
* \param obs_ptr Reference to an optional observer
* \return UCS_RET_SUCCESS message was created
* \return UCS_RET_ERR_BUFFER_OVERFLOW no message buffer available
* \return UCS_RET_ERR_API_LOCKED Resource API is already used by another command
*/
Ucs_Return_t Inic_I2cPortRead(CInic *self,
uint16_t port_handle,
uint8_t slave_address,
uint8_t data_len,
uint16_t timeout,
CSingleObserver *obs_ptr)
{
Ucs_Return_t result = UCS_RET_SUCCESS;
if(Al_Lock(&self->lock.res_api, INIC_API_I2C_PORT_WR) != false)
{
Msg_MostTel_t *msg_ptr = Trcv_TxAllocateMsg(self->xcvr_ptr, 6U);
if (msg_ptr != NULL)
{
msg_ptr->destination_addr = self->target_address;
msg_ptr->id.fblock_id = FB_INIC;
msg_ptr->id.instance_id = 0U;
msg_ptr->id.function_id = INIC_FID_I2C_PORT_READ;
msg_ptr->id.op_type = UCS_OP_STARTRESULT;
msg_ptr->tel.tel_data_ptr[0] = MISC_HB(port_handle);
msg_ptr->tel.tel_data_ptr[1] = MISC_LB(port_handle);
msg_ptr->tel.tel_data_ptr[2] = slave_address;
msg_ptr->tel.tel_data_ptr[3] = data_len;
msg_ptr->tel.tel_data_ptr[4] = MISC_HB(timeout);
msg_ptr->tel.tel_data_ptr[5] = MISC_LB(timeout);
self->ssubs[INIC_SSUB_I2C_PORT_WR].user_mask = INIC_API_I2C_PORT_WR;
msg_ptr->info_ptr = &self->ssubs[INIC_SSUB_I2C_PORT_WR];
Trcv_TxSendMsgExt(self->xcvr_ptr, msg_ptr, &Inic_ResMsgTxStatusCb, self);
(void)Ssub_AddObserver(&self->ssubs[INIC_SSUB_I2C_PORT_WR], obs_ptr);
}
else
{
Al_Release(&self->lock.res_api, INIC_API_I2C_PORT_WR);
result = UCS_RET_ERR_BUFFER_OVERFLOW;
}
}
else
{
result = UCS_RET_ERR_API_LOCKED;
}
return result;
}
/*! \brief This function writes a block of bytes to an I2C device at a specified I2C address.
* \param self Reference to CInic instance
* \param port_handle Port resource handle
* \param mode The write transfer mode
* \param block_count The number of blocks to be written to the I2C address.
* \param slave_address The 7-bit I2C slave address of the peripheral to be read
* \param timeout The timeout for the I2C Port write
* \param data_len Number of bytes to be written to the addressed I2C peripheral
* \param data_list Reference to the data list to be written
* \param obs_ptr Reference to an optional observer
* \return UCS_RET_SUCCESS message was created
* \return UCS_RET_ERR_BUFFER_OVERFLOW no message buffer available
* \return UCS_RET_ERR_API_LOCKED Resource API is already used by another command
*/
Ucs_Return_t Inic_I2cPortWrite(CInic *self,
uint16_t port_handle,
Ucs_I2c_TrMode_t mode,
uint8_t block_count,
uint8_t slave_address,
uint16_t timeout,
uint8_t data_len,
uint8_t data_list[],
CSingleObserver *obs_ptr)
{
Ucs_Return_t result = UCS_RET_SUCCESS;
if(Al_Lock(&self->lock.res_api, INIC_API_I2C_PORT_WR) != false)
{
uint8_t i;
Msg_MostTel_t *msg_ptr = Trcv_TxAllocateMsg(self->xcvr_ptr, (8U + data_len));
if (msg_ptr != NULL)
{
msg_ptr->destination_addr = self->target_address;
msg_ptr->id.fblock_id = FB_INIC;
msg_ptr->id.instance_id = 0U;
msg_ptr->id.function_id = INIC_FID_I2C_PORT_WRITE;
msg_ptr->id.op_type = UCS_OP_STARTRESULT;
msg_ptr->tel.tel_data_ptr[0] = MISC_HB(port_handle);
msg_ptr->tel.tel_data_ptr[1] = MISC_LB(port_handle);
msg_ptr->tel.tel_data_ptr[2] = (uint8_t)mode;
msg_ptr->tel.tel_data_ptr[3] = block_count;
msg_ptr->tel.tel_data_ptr[4] = slave_address;
msg_ptr->tel.tel_data_ptr[5] = (mode == UCS_I2C_BURST_MODE) ? (data_len/block_count):data_len;
msg_ptr->tel.tel_data_ptr[6] = MISC_HB(timeout);
msg_ptr->tel.tel_data_ptr[7] = MISC_LB(timeout);
if (data_list != NULL)
{
for (i = 0U; i < data_len; i++)
{
msg_ptr->tel.tel_data_ptr[8U + i] = data_list[i];
}
}
self->ssubs[INIC_SSUB_I2C_PORT_WR].user_mask = INIC_API_I2C_PORT_WR;
msg_ptr->info_ptr = &self->ssubs[INIC_SSUB_I2C_PORT_WR];
Trcv_TxSendMsgExt(self->xcvr_ptr, msg_ptr, &Inic_ResMsgTxStatusCb, self);
(void)Ssub_AddObserver(&self->ssubs[INIC_SSUB_I2C_PORT_WR], obs_ptr);
}
else
{
Al_Release(&self->lock.res_api, INIC_API_I2C_PORT_WR);
result = UCS_RET_ERR_BUFFER_OVERFLOW;
}
}
else
{
result = UCS_RET_ERR_API_LOCKED;
}
return result;
}
/*! \brief This function creates an PCIe Port with its associated port instance identifier.
* \param self Reference to CInic instance
* \param index PCIe Port instance
* \param obs_ptr Reference to an optional observer
* \return UCS_RET_SUCCESS message was created
* \return UCS_RET_ERR_BUFFER_OVERFLOW no message buffer available
* \return UCS_RET_ERR_API_LOCKED Resource API is already used by another command
*/
Ucs_Return_t Inic_PciPortCreate(CInic *self,
uint8_t index,
CSingleObserver *obs_ptr)
{
Ucs_Return_t result = UCS_RET_SUCCESS;
if(Al_Lock(&self->lock.res_api, INIC_API_CREATE_CLASS) != false)
{
Msg_MostTel_t *msg_ptr = Trcv_TxAllocateMsg(self->xcvr_ptr, 1U);
if (msg_ptr != NULL)
{
msg_ptr->destination_addr = self->target_address;
msg_ptr->id.fblock_id = FB_INIC;
msg_ptr->id.instance_id = 0U;
msg_ptr->id.function_id = INIC_FID_PCI_PORT_CREATE;
msg_ptr->id.op_type = UCS_OP_STARTRESULT;
msg_ptr->tel.tel_data_ptr[0] = index;
self->ssubs[INIC_SSUB_CREATE_CLASS].user_mask = INIC_API_CREATE_CLASS;
msg_ptr->info_ptr = &self->ssubs[INIC_SSUB_CREATE_CLASS];
Trcv_TxSendMsgExt(self->xcvr_ptr, msg_ptr, &Inic_ResMsgTxStatusCb, self);
(void)Ssub_AddObserver(&self->ssubs[INIC_SSUB_CREATE_CLASS], obs_ptr);
}
else
{
Al_Release(&self->lock.res_api, INIC_API_CREATE_CLASS);
result = UCS_RET_ERR_BUFFER_OVERFLOW;
}
}
else
{
result = UCS_RET_ERR_API_LOCKED;
}
return result;
}
/*! \brief This function creates a PCIe socket bound to the PCIe Port with the associated port
* instance identifier. If the EHC detaches, the PCIe socket will be automatically
* destroyed.
* \param self Reference to CInic instance
* \param pci_port_handle PCIe Port resource handle
* \param direction Indicates the direction of the data stream from the perspective of
* the INIC
* \param data_type Specifies the data type
* \param dma_channel Specifies the DMA channel
* \param obs_ptr Reference to an optional observer
* \return UCS_RET_SUCCESS message was created
* \return UCS_RET_ERR_BUFFER_OVERFLOW no message buffer available
* \return UCS_RET_ERR_API_LOCKED Resource API is already used by another command
*/
Ucs_Return_t Inic_PciSocketCreate(CInic *self,
uint16_t pci_port_handle,
Ucs_SocketDirection_t direction,
Ucs_Pci_SocketDataType_t data_type,
uint8_t dma_channel,
CSingleObserver *obs_ptr)
{
Ucs_Return_t result = UCS_RET_SUCCESS;
if(Al_Lock(&self->lock.res_api, INIC_API_CREATE_CLASS) != false)
{
Msg_MostTel_t *msg_ptr = Trcv_TxAllocateMsg(self->xcvr_ptr, 5U);
if (msg_ptr != NULL)
{
msg_ptr->destination_addr = self->target_address;
msg_ptr->id.fblock_id = FB_INIC;
msg_ptr->id.instance_id = 0U;
msg_ptr->id.function_id = INIC_FID_PCI_SOCKET_CREATE;
msg_ptr->id.op_type = UCS_OP_STARTRESULT;
msg_ptr->tel.tel_data_ptr[0] = MISC_HB(pci_port_handle);
msg_ptr->tel.tel_data_ptr[1] = MISC_LB(pci_port_handle);
msg_ptr->tel.tel_data_ptr[2] = (uint8_t)direction;
msg_ptr->tel.tel_data_ptr[3] = (uint8_t)data_type;
msg_ptr->tel.tel_data_ptr[4] = dma_channel;
self->ssubs[INIC_SSUB_CREATE_CLASS].user_mask = INIC_API_CREATE_CLASS;
msg_ptr->info_ptr = &self->ssubs[INIC_SSUB_CREATE_CLASS];
Trcv_TxSendMsgExt(self->xcvr_ptr, msg_ptr, &Inic_ResMsgTxStatusCb, self);
(void)Ssub_AddObserver(&self->ssubs[INIC_SSUB_CREATE_CLASS], obs_ptr);
}
else
{
Al_Release(&self->lock.res_api, INIC_API_CREATE_CLASS);
result = UCS_RET_ERR_BUFFER_OVERFLOW;
}
}
else
{
result = UCS_RET_ERR_API_LOCKED;
}
return result;
}
/*! \brief This function creates a GPIO Port with its associated port instance identifier.
* \param self Reference to CInic instance
* \param gpio_port_index GPIO Port instance
* \param debounce_time Timeout for the GPIO debounce timer
* \param obs_ptr Reference to an optional observer
* \return UCS_RET_SUCCESS message was created
* \return UCS_RET_ERR_BUFFER_OVERFLOW no message buffer available
* \return UCS_RET_ERR_API_LOCKED Resource API is already used by another command
*/
Ucs_Return_t Inic_GpioPortCreate(CInic *self,
uint8_t gpio_port_index,
uint16_t debounce_time,
CSingleObserver *obs_ptr)
{
Ucs_Return_t result = UCS_RET_SUCCESS;
if(Al_Lock(&self->lock.res_api, INIC_API_CREATE_CLASS) != false)
{
Msg_MostTel_t *msg_ptr = Trcv_TxAllocateMsg(self->xcvr_ptr, 3U);
if (msg_ptr != NULL)
{
msg_ptr->destination_addr = self->target_address;
msg_ptr->id.fblock_id = FB_INIC;
msg_ptr->id.instance_id = 0U;
msg_ptr->id.function_id = INIC_FID_GPIO_PORT_CREATE;
msg_ptr->id.op_type = UCS_OP_STARTRESULT;
msg_ptr->tel.tel_data_ptr[0] = gpio_port_index;
msg_ptr->tel.tel_data_ptr[1] = MISC_HB(debounce_time);
msg_ptr->tel.tel_data_ptr[2] = MISC_LB(debounce_time);
self->ssubs[INIC_SSUB_CREATE_CLASS].user_mask = INIC_API_CREATE_CLASS;
msg_ptr->info_ptr = &self->ssubs[INIC_SSUB_CREATE_CLASS];
Trcv_TxSendMsgExt(self->xcvr_ptr, msg_ptr, &Inic_ResMsgTxStatusCb, self);
(void)Ssub_AddObserver(&self->ssubs[INIC_SSUB_CREATE_CLASS], obs_ptr);
}
else
{
Al_Release(&self->lock.res_api, INIC_API_CREATE_CLASS);
result = UCS_RET_ERR_BUFFER_OVERFLOW;
}
}
else
{
result = UCS_RET_ERR_API_LOCKED;
}
return result;
}
/*! \brief This function enables or disables a specific MOST Network Port.
* \param self Reference to CInic instance
* \param most_port_handle Port resource handle
* \param enabled Indicates whether a MOST Network Port should be enabled or disabled
* \param obs_ptr Reference to an optional observer
* \return UCS_RET_SUCCESS message was created
* \return UCS_RET_ERR_BUFFER_OVERFLOW no message buffer available
* \return UCS_RET_ERR_API_LOCKED Resource API is already used by another command
*/
Ucs_Return_t Inic_MostPortEnable(CInic *self,
uint16_t most_port_handle,
bool enabled,
CSingleObserver *obs_ptr)
{
Ucs_Return_t result = UCS_RET_SUCCESS;
if(Al_Lock(&self->lock.res_api, INIC_API_MOST_PORT_ENABLE) != false)
{
Msg_MostTel_t *msg_ptr = Trcv_TxAllocateMsg(self->xcvr_ptr, 3U);
if (msg_ptr != NULL)
{
msg_ptr->destination_addr = self->target_address;
msg_ptr->id.fblock_id = FB_INIC;
msg_ptr->id.instance_id = 0U;
msg_ptr->id.function_id = INIC_FID_MOST_PORT_ENABLE;
msg_ptr->id.op_type = UCS_OP_STARTRESULT;
msg_ptr->tel.tel_data_ptr[0] = MISC_HB(most_port_handle);
msg_ptr->tel.tel_data_ptr[1] = MISC_LB(most_port_handle);
msg_ptr->tel.tel_data_ptr[2] = (enabled != false) ? 1U : 0U;
self->ssubs[INIC_SSUB_MOST_PORT_ENABLE].user_mask = INIC_API_MOST_PORT_ENABLE;
msg_ptr->info_ptr = &self->ssubs[INIC_SSUB_MOST_PORT_ENABLE];
Trcv_TxSendMsgExt(self->xcvr_ptr, msg_ptr, &Inic_ResMsgTxStatusCb, self);
(void)Ssub_AddObserver(&self->ssubs[INIC_SSUB_MOST_PORT_ENABLE], obs_ptr);
}
else
{
Al_Release(&self->lock.res_api, INIC_API_MOST_PORT_ENABLE);
result = UCS_RET_ERR_BUFFER_OVERFLOW;
}
}
else
{
result = UCS_RET_ERR_API_LOCKED;
}
return result;
}
/*! \brief This function retrieves the current pin mode of the given GPIO Port.
* \param self Reference to CInic instance
* \param gpio_handle GPIO Port instance
* \param obs_ptr Reference to an optional observer
* \return UCS_RET_SUCCESS message was created
* \return UCS_RET_ERR_BUFFER_OVERFLOW no message buffer available
* \return UCS_RET_ERR_API_LOCKED Resource API is already used by another command
*/
Ucs_Return_t Inic_GpioPortPinMode_Get(CInic *self, uint16_t gpio_handle, CSingleObserver *obs_ptr)
{
Ucs_Return_t result = UCS_RET_SUCCESS;
if(Al_Lock(&self->lock.res_api, INIC_API_GPIO_PIN_MODE) != false)
{
Msg_MostTel_t *msg_ptr = Trcv_TxAllocateMsg(self->xcvr_ptr, 2U);
if (msg_ptr != NULL)
{
msg_ptr->destination_addr = self->target_address;
msg_ptr->id.fblock_id = FB_INIC;
msg_ptr->id.instance_id = 0U;
msg_ptr->id.function_id = INIC_FID_GPIO_PORT_PIN_MODE;
msg_ptr->id.op_type = UCS_OP_GET;
msg_ptr->tel.tel_data_ptr[0] = MISC_HB(gpio_handle);
msg_ptr->tel.tel_data_ptr[1] = MISC_LB(gpio_handle);
self->ssubs[INIC_SSUB_GPIO_PIN_MODE].user_mask = INIC_API_GPIO_PIN_MODE;
msg_ptr->info_ptr = &self->ssubs[INIC_SSUB_GPIO_PIN_MODE];
Trcv_TxSendMsgExt(self->xcvr_ptr, msg_ptr, &Inic_ResMsgTxStatusCb, self);
(void)Ssub_AddObserver(&self->ssubs[INIC_SSUB_GPIO_PIN_MODE], obs_ptr);
}
else
{
Al_Release(&self->lock.res_api, INIC_API_GPIO_PIN_MODE);
result = UCS_RET_ERR_BUFFER_OVERFLOW;
}
}
else
{
result = UCS_RET_ERR_API_LOCKED;
}
return result;
}
/*! \brief This function sets and retrieves the mode of a pin on the GPIO Port
* \param self Reference to CInic instance
* \param gpio_handle GPIO Port instance
* \param pin The GPIO pin that is to be configured
* \param mode The mode of the GPIO pin
* \param obs_ptr Reference to an optional observer
* \return UCS_RET_SUCCESS message was created
* \return UCS_RET_ERR_BUFFER_OVERFLOW no message buffer available
* \return UCS_RET_ERR_API_LOCKED Resource API is already used by another command
*/
Ucs_Return_t Inic_GpioPortPinMode_SetGet(CInic *self, uint16_t gpio_handle, uint8_t pin, Ucs_Gpio_PinMode_t mode, CSingleObserver *obs_ptr)
{
Ucs_Return_t result = UCS_RET_SUCCESS;
if(Al_Lock(&self->lock.res_api, INIC_API_GPIO_PIN_MODE) != false)
{
Msg_MostTel_t *msg_ptr = Trcv_TxAllocateMsg(self->xcvr_ptr, 4U);
if (msg_ptr != NULL)
{
msg_ptr->destination_addr = self->target_address;
msg_ptr->id.fblock_id = FB_INIC;
msg_ptr->id.instance_id = 0U;
msg_ptr->id.function_id = INIC_FID_GPIO_PORT_PIN_MODE;
msg_ptr->id.op_type = UCS_OP_SETGET;
msg_ptr->tel.tel_data_ptr[0] = MISC_HB(gpio_handle);
msg_ptr->tel.tel_data_ptr[1] = MISC_LB(gpio_handle);
msg_ptr->tel.tel_data_ptr[2] = pin;
msg_ptr->tel.tel_data_ptr[3] = (uint8_t)mode;
self->ssubs[INIC_SSUB_GPIO_PIN_MODE].user_mask = INIC_API_GPIO_PIN_MODE;
msg_ptr->info_ptr = &self->ssubs[INIC_SSUB_GPIO_PIN_MODE];
Trcv_TxSendMsgExt(self->xcvr_ptr, msg_ptr, &Inic_ResMsgTxStatusCb, self);
(void)Ssub_AddObserver(&self->ssubs[INIC_SSUB_GPIO_PIN_MODE], obs_ptr);
}
else
{
Al_Release(&self->lock.res_api, INIC_API_GPIO_PIN_MODE);
result = UCS_RET_ERR_BUFFER_OVERFLOW;
}
}
else
{
result = UCS_RET_ERR_API_LOCKED;
}
return result;
}
/*! \brief This function retrieves the pin state of the given GPIO Port.
* \param self Reference to CInic instance
* \param gpio_handle GPIO Port instance
* \param obs_ptr Reference to an optional observer
* \return UCS_RET_SUCCESS message was created
* \return UCS_RET_ERR_BUFFER_OVERFLOW no message buffer available
* \return UCS_RET_ERR_API_LOCKED Resource API is already used by another command
*/
Ucs_Return_t Inic_GpioPortPinState_Get(CInic *self, uint16_t gpio_handle, CSingleObserver *obs_ptr)
{
Ucs_Return_t result = UCS_RET_SUCCESS;
if(Al_Lock(&self->lock.res_api, INIC_API_GPIO_PIN_STATE) != false)
{
Msg_MostTel_t *msg_ptr = Trcv_TxAllocateMsg(self->xcvr_ptr, 2U);
if (msg_ptr != NULL)
{
msg_ptr->destination_addr = self->target_address;
msg_ptr->id.fblock_id = FB_INIC;
msg_ptr->id.instance_id = 0U;
msg_ptr->id.function_id = INIC_FID_GPIO_PORT_PIN_STATE;
msg_ptr->id.op_type = UCS_OP_GET;
msg_ptr->tel.tel_data_ptr[0] = MISC_HB(gpio_handle);
msg_ptr->tel.tel_data_ptr[1] = MISC_LB(gpio_handle);
self->ssubs[INIC_SSUB_GPIO_PIN_STATE].user_mask = INIC_API_GPIO_PIN_STATE;
msg_ptr->info_ptr = &self->ssubs[INIC_SSUB_GPIO_PIN_STATE];
Trcv_TxSendMsgExt(self->xcvr_ptr, msg_ptr, &Inic_ResMsgTxStatusCb, self);
(void)Ssub_AddObserver(&self->ssubs[INIC_SSUB_GPIO_PIN_STATE], obs_ptr);
}
else
{
Al_Release(&self->lock.res_api, INIC_API_GPIO_PIN_STATE);
result = UCS_RET_ERR_BUFFER_OVERFLOW;
}
}
else
{
result = UCS_RET_ERR_API_LOCKED;
}
return result;
}
/*! \brief This function sets and retrieves the state of a pin on the GPIO Port
* \param self Reference to CInic instance
* \param gpio_handle GPIO Port instance
* \param mask The GPIO pins to be written
* \param data The state of the GPIO pins to be written
* \param obs_ptr Reference to an optional observer
* \return UCS_RET_SUCCESS message was created
* \return UCS_RET_ERR_BUFFER_OVERFLOW no message buffer available
* \return UCS_RET_ERR_API_LOCKED Resource API is already used by another command
*/
Ucs_Return_t Inic_GpioPortPinState_SetGet(CInic *self, uint16_t gpio_handle, uint16_t mask, uint16_t data, CSingleObserver *obs_ptr)
{
Ucs_Return_t result = UCS_RET_SUCCESS;
if(Al_Lock(&self->lock.res_api, INIC_API_GPIO_PIN_STATE) != false)
{
Msg_MostTel_t *msg_ptr = Trcv_TxAllocateMsg(self->xcvr_ptr, 6U);
if (msg_ptr != NULL)
{
msg_ptr->destination_addr = self->target_address;
msg_ptr->id.fblock_id = FB_INIC;
msg_ptr->id.instance_id = 0U;
msg_ptr->id.function_id = INIC_FID_GPIO_PORT_PIN_STATE;
msg_ptr->id.op_type = UCS_OP_SETGET;
msg_ptr->tel.tel_data_ptr[0] = MISC_HB(gpio_handle);
msg_ptr->tel.tel_data_ptr[1] = MISC_LB(gpio_handle);
msg_ptr->tel.tel_data_ptr[2] = MISC_HB(mask);
msg_ptr->tel.tel_data_ptr[3] = MISC_LB(mask);
msg_ptr->tel.tel_data_ptr[4] = MISC_HB(data);
msg_ptr->tel.tel_data_ptr[5] = MISC_LB(data);
self->ssubs[INIC_SSUB_GPIO_PIN_STATE].user_mask = INIC_API_GPIO_PIN_STATE;
msg_ptr->info_ptr = &self->ssubs[INIC_SSUB_GPIO_PIN_STATE];
Trcv_TxSendMsgExt(self->xcvr_ptr, msg_ptr, &Inic_ResMsgTxStatusCb, self);
(void)Ssub_AddObserver(&self->ssubs[INIC_SSUB_GPIO_PIN_STATE], obs_ptr);
}
else
{
Al_Release(&self->lock.res_api, INIC_API_GPIO_PIN_STATE);
result = UCS_RET_ERR_BUFFER_OVERFLOW;
}
}
else
{
result = UCS_RET_ERR_API_LOCKED;
}
return result;
}
/*! \brief This function enables full streaming for a specific MOST Network Port.
* \param self Reference to CInic instance
* \param most_port_handle Port resource handle
* \param enabled Indicates whether full streaming is enabled or disabled
* \param obs_ptr Reference to an optional observer
* \return UCS_RET_SUCCESS message was created
* \return UCS_RET_ERR_BUFFER_OVERFLOW no message buffer available
* \return UCS_RET_ERR_API_LOCKED Resource API is already used by another command
*/
Ucs_Return_t Inic_MostPortEnFullStr(CInic *self,
uint16_t most_port_handle,
bool enabled,
CSingleObserver *obs_ptr)
{
MISC_UNUSED(self);
MISC_UNUSED(most_port_handle);
MISC_UNUSED(enabled);
MISC_UNUSED(obs_ptr);
return UCS_RET_ERR_NOT_SUPPORTED;
}
/*! \brief Allows remote synchronization of the given device
* \param self Reference to CInic instance
* \param obs_ptr Reference to an optional observer
* \return UCS_RET_SUCCESS message was created
* \return UCS_RET_ERR_BUFFER_OVERFLOW no message buffer available
*/
Ucs_Return_t Inic_DeviceSync(CInic *self, CSingleObserver *obs_ptr)
{
Ucs_Return_t result = UCS_RET_SUCCESS;
if(Al_Lock(&self->lock.res_api, INIC_API_DEVICE_SYNC) != false)
{
Msg_MostTel_t *msg_ptr = Trcv_TxAllocateMsg(self->xcvr_ptr, 1U);
if (msg_ptr != NULL)
{
msg_ptr->destination_addr = self->target_address;
msg_ptr->id.fblock_id = FB_INIC;
msg_ptr->id.instance_id = 0U;
msg_ptr->id.function_id = INIC_FID_DEVICE_SYNC;
msg_ptr->id.op_type = UCS_OP_STARTRESULT;
msg_ptr->tel.tel_data_ptr[0] = 0x01U;
self->ssubs[INIC_SSUB_DEVICE_SYNC].user_mask = INIC_API_DEVICE_SYNC;
msg_ptr->info_ptr = &self->ssubs[INIC_SSUB_DEVICE_SYNC];
Trcv_TxSendMsgExt(self->xcvr_ptr, msg_ptr, &Inic_ResMsgTxStatusCb, self);
(void)Ssub_AddObserver(&self->ssubs[INIC_SSUB_DEVICE_SYNC], obs_ptr);
}
else
{
Al_Release(&self->lock.res_api, INIC_API_DEVICE_SYNC);
result = UCS_RET_ERR_BUFFER_OVERFLOW;
}
}
else
{
result = UCS_RET_ERR_API_LOCKED;
}
return result;
}
/*! \brief Un-synchronizes to the given remote device
* \param self Reference to CInic instance
* \param obs_ptr Reference to an optional observer
* \return UCS_RET_SUCCESS message was created
* \return UCS_RET_ERR_BUFFER_OVERFLOW no message buffer available
*/
Ucs_Return_t Inic_DeviceUnsync(CInic *self, CSingleObserver *obs_ptr)
{
Ucs_Return_t result = UCS_RET_SUCCESS;
Msg_MostTel_t *msg_ptr = Trcv_TxAllocateMsg(self->xcvr_ptr, 1U);
if(Al_Lock(&self->lock.res_api, INIC_API_DEVICE_SYNC) != false)
{
if (msg_ptr != NULL)
{
msg_ptr->destination_addr = self->target_address;
msg_ptr->id.fblock_id = FB_INIC;
msg_ptr->id.instance_id = 0U;
msg_ptr->id.function_id = INIC_FID_DEVICE_SYNC;
msg_ptr->id.op_type = UCS_OP_STARTRESULT;
msg_ptr->tel.tel_data_ptr[0] = 0U;
self->ssubs[INIC_SSUB_DEVICE_SYNC].user_mask = INIC_API_DEVICE_SYNC;
msg_ptr->info_ptr = &self->ssubs[INIC_SSUB_DEVICE_SYNC];
Trcv_TxSendMsgExt(self->xcvr_ptr, msg_ptr, &Inic_ResMsgTxStatusCb, self);
(void)Ssub_AddObserver(&self->ssubs[INIC_SSUB_DEVICE_SYNC], obs_ptr);
}
else
{
Al_Release(&self->lock.res_api, INIC_API_DEVICE_SYNC);
result = UCS_RET_ERR_BUFFER_OVERFLOW;
}
}
else
{
result = UCS_RET_ERR_API_LOCKED;
}
return result;
}
/*------------------------------------------------------------------------------------------------*/
/* Handler functions */
/*------------------------------------------------------------------------------------------------*/
/*! \brief Handle message Tx status, Unlock the API and free the message objects
* \param self The instance
* \param tel_ptr Reference to transmitted message
* \param status Status of the transmitted message
*/
static void Inic_ResMsgTxStatusCb(void *self, Msg_MostTel_t *tel_ptr, Ucs_MsgTxStatus_t status)
{
CInic *self_ = (CInic *)self;
CSingleSubject *ssub_ptr = (CSingleSubject *)tel_ptr->info_ptr;
if ((status != UCS_MSG_STAT_OK) && (tel_ptr->info_ptr != NULL))
{
Inic_StdResult_t res_data;
res_data.data_info = &status;
res_data.result.code = UCS_RES_ERR_TRANSMISSION;
res_data.result.info_ptr = NULL;
res_data.result.info_size = 0U;
Ssub_Notify(ssub_ptr, &res_data, true);
if ((ssub_ptr != NULL) && (ssub_ptr->user_mask != 0U))
{
Al_Release(&self_->lock.res_api, (Alm_ModuleMask_t)ssub_ptr->user_mask);
}
}
Trcv_TxReleaseMsg(tel_ptr);
/* Reset user mask of the single subject if available */
if (ssub_ptr != NULL)
{
ssub_ptr->user_mask = 0U;
}
/* ICM messages pending? */
if (Sub_GetNumObservers(&self_->subs[INIC_SUB_TX_MSG_OBJ_AVAIL]) > 0U)
{
Sub_Notify(&self_->subs[INIC_SUB_TX_MSG_OBJ_AVAIL], NULL);
}
}
/*! \brief Handler function for INIC.ResourceDestroy.ErrorAck
* \param self reference to INIC object
* \param msg_ptr received message
*/
void Inic_ResourceDestroy_Error(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_StdResult_t res_data;
res_data.data_info = NULL;
res_data.result = Inic_TranslateError(self_,
&msg_ptr->tel.tel_data_ptr[0],
(msg_ptr->tel.tel_len));
Ssub_Notify(&self_->ssubs[INIC_SSUB_RESOURCE_DESTROY], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_RESOURCE_DESTROY);
}
/*! \brief Handler function for INIC.ResourceDestroy.ResultAck
* \param self reference to INIC object
* \param msg_ptr received message
*/
void Inic_ResourceDestroy_Result(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_StdResult_t res_data;
MISC_UNUSED(msg_ptr);
res_data.data_info = NULL;
res_data.result.code = UCS_RES_SUCCESS;
res_data.result.info_ptr = NULL;
Ssub_Notify(&self_->ssubs[INIC_SSUB_RESOURCE_DESTROY], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_RESOURCE_DESTROY);
}
/*! \brief Handler function for INIC.ResourceInvalidList.Status
* \param self reference to INIC object
* \param msg_ptr received message
*/
void Inic_ResourceInvalidList_Status(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_StdResult_t res_data;
Inic_ResHandleList_t result;
uint8_t i;
uint16_t inv_res_handles[22]; /* Max. ICM message size is 45 -> max. 22 16-bit values */
res_data.data_info = &result;
res_data.result.code = UCS_RES_SUCCESS;
res_data.result.info_ptr = NULL;
/* Length of message must be even, since 16-Bit values are transmitted via two 8-bit fields. */
TR_ASSERT(self_->base_ptr->ucs_user_ptr, "[INIC_RES]", ((msg_ptr->tel.tel_len % 2U) == 0U));
for(i=0U; (i < (uint8_t)(msg_ptr->tel.tel_len >> 1)); i++)
{
MISC_DECODE_WORD(&inv_res_handles[i],
&(msg_ptr->tel.tel_data_ptr[(uint8_t)((uint8_t)i << 1)]));
}
result.res_handles = &inv_res_handles[0];
result.num_handles = (uint8_t)((uint8_t)msg_ptr->tel.tel_len >> 1);
Ssub_Notify(&self_->ssubs[INIC_SSUB_RESOURCE_INVAL_LIST], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_RESOURCE_INVAL_LIST);
}
/*! \brief Handler function for INIC.ResourceInvalidList.Error
* \param self reference to INIC object
* \param msg_ptr received message
*/
void Inic_ResourceInvalidList_Error(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_StdResult_t res_data;
res_data.data_info = NULL;
res_data.result = Inic_TranslateError(self_,
&msg_ptr->tel.tel_data_ptr[0],
msg_ptr->tel.tel_len);
Ssub_Notify(&self_->ssubs[INIC_SSUB_RESOURCE_INVAL_LIST], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_RESOURCE_INVAL_LIST);
}
/*! \brief Handler function for INIC.ResourceMonitor.Status
* \param self reference to INIC object
* \param msg_ptr received message
*/
void Inic_ResourceMonitor_Status(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_StdResult_t res_data;
Ucs_Resource_MonitorState_t state;
res_data.data_info = &state;
res_data.result.code = UCS_RES_SUCCESS;
res_data.result.info_ptr = NULL;
state = (Ucs_Resource_MonitorState_t)msg_ptr->tel.tel_data_ptr[0];
Sub_Notify(&self_->subs[INIC_SUB_RES_MONITOR], &res_data);
}
/*! \brief Handler function for INIC.ResourceMonitor.Error
* \param self reference to INIC object
* \param msg_ptr received message
*/
void Inic_ResourceMonitor_Error(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_StdResult_t res_data;
res_data.data_info = NULL;
res_data.result = Inic_TranslateError(self_,
&msg_ptr->tel.tel_data_ptr[0],
msg_ptr->tel.tel_len);
Sub_Notify(&self_->subs[INIC_SUB_RES_MONITOR], &res_data);
}
/*! \brief Handler function for INIC.SyncCreate.ErrorAck
* \param self reference to INIC object
* \param msg_ptr received message
*/
void Inic_SyncCreate_Error(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_StdResult_t res_data;
res_data.data_info = NULL;
res_data.result = Inic_TranslateError(self_,
&msg_ptr->tel.tel_data_ptr[0],
(msg_ptr->tel.tel_len));
Ssub_Notify(&self_->ssubs[INIC_SSUB_CREATE_CLASS], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_CREATE_CLASS);
}
/*! \brief Handler function for INIC.SyncCreate.ResultAck. res_data.data_info points to the
* resource handle of the synchronous connection which was created.
* \param self reference to INIC object
* \param msg_ptr received message
*/
void Inic_SyncCreate_Result(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
uint16_t handle;
Inic_StdResult_t res_data;
MISC_DECODE_WORD(&handle, &(msg_ptr->tel.tel_data_ptr[0]));
res_data.data_info = &handle;
res_data.result.code = UCS_RES_SUCCESS;
res_data.result.info_ptr = NULL;
Ssub_Notify(&self_->ssubs[INIC_SSUB_CREATE_CLASS], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_CREATE_CLASS);
}
/*! \brief Handler function for INIC.SyncMute.ErrorAck
* \param self reference to INIC object
* \param msg_ptr received message
*/
void Inic_SyncMute_Error(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_StdResult_t res_data;
res_data.data_info = NULL;
res_data.result = Inic_TranslateError(self_,
&msg_ptr->tel.tel_data_ptr[0],
(msg_ptr->tel.tel_len));
Ssub_Notify(&self_->ssubs[INIC_SSUB_SYNC_MUTE], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_SYNC_MUTE);
}
/*! \brief Handler function for INIC.SyncMute.ResultAck
* \param self reference to INIC object
* \param msg_ptr received message
*/
void Inic_SyncMute_Result(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_StdResult_t res_data;
MISC_UNUSED(msg_ptr);
res_data.data_info = NULL;
res_data.result.code = UCS_RES_SUCCESS;
res_data.result.info_ptr = NULL;
Ssub_Notify(&self_->ssubs[INIC_SSUB_SYNC_MUTE], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_SYNC_MUTE);
}
/*! \brief Handler function for INIC.SyncDemute.ErrorAck
* \param self reference to INIC object
* \param msg_ptr received message
*/
void Inic_SyncDemute_Error(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_StdResult_t res_data;
res_data.data_info = NULL;
res_data.result = Inic_TranslateError(self_,
&msg_ptr->tel.tel_data_ptr[0],
(msg_ptr->tel.tel_len));
Ssub_Notify(&self_->ssubs[INIC_SSUB_SYNC_DEMUTE], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_SYNC_DEMUTE);
}
/*! \brief Handler function for INIC.SyncDemute.ResultAck
* \param self reference to INIC object
* \param msg_ptr received message
*/
void Inic_SyncDemute_Result(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_StdResult_t res_data;
MISC_UNUSED(msg_ptr);
res_data.data_info = NULL;
res_data.result.code = UCS_RES_SUCCESS;
res_data.result.info_ptr = NULL;
Ssub_Notify(&self_->ssubs[INIC_SSUB_SYNC_DEMUTE], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_SYNC_DEMUTE);
}
/*! \brief Handler function for INIC.DFIPhaseCreate.ErrorAck
* \param self reference to INIC object
* \param msg_ptr received message
*/
void Inic_DfiPhaseCreate_Error(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_StdResult_t res_data;
res_data.data_info = NULL;
res_data.result = Inic_TranslateError(self_,
&msg_ptr->tel.tel_data_ptr[0],
(msg_ptr->tel.tel_len));
Ssub_Notify(&self_->ssubs[INIC_SSUB_CREATE_CLASS], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_CREATE_CLASS);
}
/*! \brief Handler function for INIC.DFIPhaseCreate.ResultAck. res_data.data_info points to the
* resource handle of the DFIPhase streaming phase connection which was created.
* \param self reference to INIC object
* \param msg_ptr received message
*/
void Inic_DfiPhaseCreate_Result(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
uint16_t handle;
Inic_StdResult_t res_data;
MISC_DECODE_WORD(&handle, &(msg_ptr->tel.tel_data_ptr[0]));
res_data.data_info = &handle;
res_data.result.code = UCS_RES_SUCCESS;
res_data.result.info_ptr = NULL;
Ssub_Notify(&self_->ssubs[INIC_SSUB_CREATE_CLASS], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_CREATE_CLASS);
}
/*! \brief Handler function for INIC.CombinerCreate.ErrorAck
* \param self reference to INIC object
* \param msg_ptr received message
*/
void Inic_CombinerCreate_Error(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_StdResult_t res_data;
res_data.data_info = NULL;
res_data.result = Inic_TranslateError(self_,
&msg_ptr->tel.tel_data_ptr[0],
(msg_ptr->tel.tel_len));
Ssub_Notify(&self_->ssubs[INIC_SSUB_CREATE_CLASS], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_CREATE_CLASS);
}
/*! \brief Handler function for INIC.CombinerCreate.ResultAck
* \param self reference to INIC object
* \param msg_ptr received message
*/
void Inic_CombinerCreate_Result(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
uint16_t handle;
Inic_StdResult_t res_data;
MISC_DECODE_WORD(&handle, &(msg_ptr->tel.tel_data_ptr[0]));
res_data.data_info = &handle;
res_data.result.code = UCS_RES_SUCCESS;
res_data.result.info_ptr = NULL;
Ssub_Notify(&self_->ssubs[INIC_SSUB_CREATE_CLASS], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_CREATE_CLASS);
}
/*! \brief Handler function for INIC.SplitterCreate.ErrorAck
* \param self reference to INIC object
* \param msg_ptr received message
*/
void Inic_SplitterCreate_Error(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_StdResult_t res_data;
res_data.data_info = NULL;
res_data.result = Inic_TranslateError(self_,
&msg_ptr->tel.tel_data_ptr[0],
(msg_ptr->tel.tel_len));
Ssub_Notify(&self_->ssubs[INIC_SSUB_CREATE_CLASS], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_CREATE_CLASS);
}
/*! \brief Handler function for INIC.SplitterCreate.ResultAck
* \param self reference to INIC object
* \param msg_ptr received message
*/
void Inic_SplitterCreate_Result(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
uint16_t handle;
Inic_StdResult_t res_data;
MISC_DECODE_WORD(&handle, &(msg_ptr->tel.tel_data_ptr[0]));
res_data.data_info = &handle;
res_data.result.code = UCS_RES_SUCCESS;
res_data.result.info_ptr = NULL;
Ssub_Notify(&self_->ssubs[INIC_SSUB_CREATE_CLASS], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_CREATE_CLASS);
}
/*! \brief Handler function for INIC.QoSCreate.ErrorAck
* \param self reference to INIC object
* \param msg_ptr received message
*/
void Inic_QoSCreate_Error(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_StdResult_t res_data;
res_data.data_info = NULL;
res_data.result = Inic_TranslateError(self_,
&msg_ptr->tel.tel_data_ptr[0],
(msg_ptr->tel.tel_len));
Ssub_Notify(&self_->ssubs[INIC_SSUB_CREATE_CLASS], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_CREATE_CLASS);
}
/*! \brief Handler function for INIC.QoSCreate.ResultAck.res_data.data_info points to the Resource
* handle of the Quality of Service IP Streaming data connection which was created.
* \param self reference to INIC object
* \param msg_ptr received message
*/
void Inic_QoSCreate_Result(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
uint16_t handle;
Inic_StdResult_t res_data;
MISC_DECODE_WORD(&handle, &(msg_ptr->tel.tel_data_ptr[0]));
res_data.data_info = &handle;
res_data.result.code = UCS_RES_SUCCESS;
res_data.result.info_ptr = NULL;
Ssub_Notify(&self_->ssubs[INIC_SSUB_CREATE_CLASS], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_CREATE_CLASS);
}
/*! \brief Handler function for INIC.IPCPacketCreate.ErrorAck
* \param self reference to INIC object
* \param msg_ptr received message
*/
void Inic_IpcCreate_Error(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_StdResult_t res_data;
res_data.data_info = NULL;
res_data.result = Inic_TranslateError(self_,
&msg_ptr->tel.tel_data_ptr[0],
(msg_ptr->tel.tel_len));
Ssub_Notify(&self_->ssubs[INIC_SSUB_CREATE_CLASS], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_CREATE_CLASS);
}
/*! \brief Handler function for INIC.IPCPacketCreate.ResultAck.res_data.data_info points to the resource
* handle of the Inter-Processor Communication packet connection which was created.
* \param self reference to INIC object
* \param msg_ptr received message
*/
void Inic_IpcCreate_Result(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
uint16_t handle;
Inic_StdResult_t res_data;
MISC_DECODE_WORD(&handle, &(msg_ptr->tel.tel_data_ptr[0]));
res_data.data_info = &handle;
res_data.result.code = UCS_RES_SUCCESS;
res_data.result.info_ptr = NULL;
Ssub_Notify(&self_->ssubs[INIC_SSUB_CREATE_CLASS], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_CREATE_CLASS);
}
/*! \brief Handler function for INIC.AVPCreate.ErrorAck
* \param self reference to INIC object
* \param msg_ptr received message
*/
void Inic_AvpCreate_Error(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_StdResult_t res_data;
res_data.data_info = NULL;
res_data.result = Inic_TranslateError(self_,
&msg_ptr->tel.tel_data_ptr[0],
(msg_ptr->tel.tel_len));
Ssub_Notify(&self_->ssubs[INIC_SSUB_CREATE_CLASS], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_CREATE_CLASS);
}
/*! \brief Handler function for INIC.AVPCreate.ResultAck. res_data.data_info points to the Resource
* handle of the A/V Packetized Isochronous Streaming connection which was created.
* \param self reference to INIC object
* \param msg_ptr received message
*/
void Inic_AvpCreate_Result(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
uint16_t handle;
Inic_StdResult_t res_data;
MISC_DECODE_WORD(&handle, &(msg_ptr->tel.tel_data_ptr[0]));
res_data.data_info = &handle;
res_data.result.code = UCS_RES_SUCCESS;
res_data.result.info_ptr = NULL;
Ssub_Notify(&self_->ssubs[INIC_SSUB_CREATE_CLASS], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_CREATE_CLASS);
}
/*! \brief Handler function for INIC.MOSTPortStatus.Status
* \param self Reference to CInic instance
* \param msg_ptr Pointer to received message
*/
void Inic_MostPortStatus_Status(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_MostPortStatus_t result;
MISC_DECODE_WORD(&(result.most_port_handle), &(msg_ptr->tel.tel_data_ptr[0]));
result.availability = (Ucs_Most_PortAvail_t)msg_ptr->tel.tel_data_ptr[2];
result.avail_info = (Ucs_Most_PortAvailInfo_t)msg_ptr->tel.tel_data_ptr[3];
result.fullstreaming_enabled = (msg_ptr->tel.tel_data_ptr[4] != 0U) ? true : false;
MISC_DECODE_WORD(&(result.freestreaming_bw), &(msg_ptr->tel.tel_data_ptr[5]));
self_->most_port_status = result;
Sub_Notify(&self_->subs[INIC_SUB_MOST_PORT_STATUS], &result);
}
/*! \brief Handler function for INIC.MOSTPortStatus.Error
* \param self Reference to CInic instance
* \param msg_ptr Pointer to received message
*/
void Inic_MostPortStatus_Error(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_StdResult_t res_data;
res_data.data_info = NULL;
res_data.result = Inic_TranslateError(self_,
&msg_ptr->tel.tel_data_ptr[0],
msg_ptr->tel.tel_len);
Sub_Notify(&self_->subs[INIC_SUB_MOST_PORT_STATUS], &res_data);
}
/*! \brief Handler function for INIC.MOSTSocketCreate.ErrorAck. Result is delivered via the
* SingleObserver object ssubs[INIC_SSUB_CREATE_CLASS].
* \param self Reference to CInic instance
* \param msg_ptr Pointer to received message
*/
void Inic_MostSocketCreate_Error(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_StdResult_t res_data;
res_data.data_info = NULL;
res_data.result = Inic_TranslateError(self_,
&msg_ptr->tel.tel_data_ptr[0],
(msg_ptr->tel.tel_len));
Ssub_Notify(&self_->ssubs[INIC_SSUB_CREATE_CLASS], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_CREATE_CLASS);
}
/*! \brief Handler function for INIC.MOSTSocketCreate.ResultAck
* \details Result is delivered via the SingleObserver element ssubs[INIC_SSUB_CREATE_CLASS]. Element
* res_data.data_info points to a variable of type Inic_MostSocketCreate_Result_t
* which holds the results of the MOSTSocketCreate command.
* \param self Reference to CInic instance
* \param msg_ptr Pointer to received message
*/
void Inic_MostSocketCreate_Result(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_StdResult_t res_data;
Inic_MostSocketCreate_Result_t res;
MISC_DECODE_WORD(&(res.most_socket_handle), &(msg_ptr->tel.tel_data_ptr[0]));
MISC_DECODE_WORD(&(res.conn_label), &(msg_ptr->tel.tel_data_ptr[2]));
res_data.data_info = &res;
res_data.result.code = UCS_RES_SUCCESS;
res_data.result.info_ptr = NULL;
Ssub_Notify(&self_->ssubs[INIC_SSUB_CREATE_CLASS], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_CREATE_CLASS);
}
/*! \brief Handler function for INIC.MLBPortCreate.ErrorAck
* \details Result is delivered via the SingleObserver object ssubs[INIC_SSUB_CREATE_CLASS].
* \param self Reference to CInic instance
* \param msg_ptr Pointer to received message
*/
void Inic_MlbPortCreate_Error(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_StdResult_t res_data;
res_data.data_info = NULL;
res_data.result = Inic_TranslateError(self_,
&msg_ptr->tel.tel_data_ptr[0],
(msg_ptr->tel.tel_len));
Ssub_Notify(&self_->ssubs[INIC_SSUB_CREATE_CLASS], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_CREATE_CLASS);
}
/*! \brief Handler function for INIC.MLBPortCreate.ResultAck
* \details Result is delivered via the SingleObserver object ssubs[INIC_SSUB_CREATE_CLASS].
* Element res_data.data_info points to the variable mlb_port_handle which holds the
* MediaLB Port resource handle.
* \param self Reference to CInic instance
* \param msg_ptr Pointer to received message
*/
void Inic_MlbPortCreate_Result(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
uint16_t mlb_port_handle;
Inic_StdResult_t res_data;
MISC_DECODE_WORD(&mlb_port_handle, &(msg_ptr->tel.tel_data_ptr[0]));
res_data.data_info = &mlb_port_handle;
res_data.result.code = UCS_RES_SUCCESS;
res_data.result.info_ptr = NULL;
Ssub_Notify(&self_->ssubs[INIC_SSUB_CREATE_CLASS], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_CREATE_CLASS);
}
/*! \brief Handler function for INIC.MLBSocketCreate.ErrorAck
* \details Result is delivered via the SingleObserver object ssubs[INIC_SSUB_CREATE_CLASS].
* \param self Reference to CInic instance
* \param msg_ptr Pointer to received message
*/
void Inic_MlbSocketCreate_Error(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_StdResult_t res_data;
res_data.data_info = NULL;
res_data.result = Inic_TranslateError(self_,
&msg_ptr->tel.tel_data_ptr[0],
(msg_ptr->tel.tel_len));
Ssub_Notify(&self_->ssubs[INIC_SSUB_CREATE_CLASS], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_CREATE_CLASS);
}
/*! \brief Handler function for INIC.MLBSocketCreate.ResultAck
* \details Element res_data.data_info points to the variable mlb_socket_handle which holds the
* MediaLB Socket resource handle of the created socket. Result is delivered via the
* SingleObserver object ssubs[INIC_SSUB_CREATE_CLASS].
* \param self Reference to CInic instance
* \param msg_ptr Pointer to received message
*/
void Inic_MlbSocketCreate_Result(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
uint16_t mlb_socket_handle;
Inic_StdResult_t res_data;
MISC_DECODE_WORD(&mlb_socket_handle, &(msg_ptr->tel.tel_data_ptr[0]));
res_data.data_info = &mlb_socket_handle;
res_data.result.code = UCS_RES_SUCCESS;
res_data.result.info_ptr = NULL;
Ssub_Notify(&self_->ssubs[INIC_SSUB_CREATE_CLASS], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_CREATE_CLASS);
}
/*! \brief Handler function for INIC.USBPortCreate.ErrorAck
* \details Result is delivered via the SingleObserver object ssubs[INIC_SSUB_CREATE_CLASS].
* \param self Reference to CInic instance
* \param msg_ptr Pointer to received message
*/
void Inic_UsbPortCreate_Error(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_StdResult_t res_data;
res_data.data_info = NULL;
res_data.result = Inic_TranslateError(self_,
&msg_ptr->tel.tel_data_ptr[0],
(msg_ptr->tel.tel_len));
Ssub_Notify(&self_->ssubs[INIC_SSUB_CREATE_CLASS], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_CREATE_CLASS);
}
/*! \brief Handler function for INIC.USBPortCreate.ResultAck
* \details Element res_data.data_info points to the variable usb_port_handle which holds the USB
* Port resource handle.
* \param self Reference to CInic instance
* \param msg_ptr Pointer to received message
*/
void Inic_UsbPortCreate_Result(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
uint16_t usb_port_handle;
Inic_StdResult_t res_data;
MISC_DECODE_WORD(&usb_port_handle, &(msg_ptr->tel.tel_data_ptr[0]));
res_data.data_info = &usb_port_handle;
res_data.result.code = UCS_RES_SUCCESS;
res_data.result.info_ptr = NULL;
Ssub_Notify(&self_->ssubs[INIC_SSUB_CREATE_CLASS], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_CREATE_CLASS);
}
/*! \brief Handler function for INIC.USBSocketCreate.ErrorAck
* \details Result is delivered via the SingleObserver object ssubs[INIC_SSUB_CREATE_CLASS].
* \param self Reference to CInic instance
* \param msg_ptr Pointer to received message
*/
void Inic_UsbSocketCreate_Error(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_StdResult_t res_data;
res_data.data_info = NULL;
res_data.result = Inic_TranslateError(self_,
&msg_ptr->tel.tel_data_ptr[0],
(msg_ptr->tel.tel_len));
Ssub_Notify(&self_->ssubs[INIC_SSUB_CREATE_CLASS], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_CREATE_CLASS);
}
/*! \brief Handler function for INIC.USBSocketCreate.ResultAck
* \details Element res_data.data_info points to the variable usb_socket_handle which holds the
* Socket resource handle of the created socket. Result is delivered via the
* SingleObserver object ssubs[INIC_SSUB_CREATE_CLASS].
* \param self Reference to CInic instance
* \param msg_ptr Pointer to received message
*/
void Inic_UsbSocketCreate_Result(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
uint16_t usb_socket_handle;
Inic_StdResult_t res_data;
MISC_DECODE_WORD(&usb_socket_handle, &(msg_ptr->tel.tel_data_ptr[0]));
res_data.data_info = &usb_socket_handle;
res_data.result.code = UCS_RES_SUCCESS;
res_data.result.info_ptr = NULL;
Ssub_Notify(&self_->ssubs[INIC_SSUB_CREATE_CLASS], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_CREATE_CLASS);
}
/*! \brief Handler function for INIC.StreamPortConfiguration.Status
* \details Result is delivered via the SingleObserver object ssubs[INIC_SSUB_STREAM_PORT_CONFIG].
* Element res_data.data_info points to a variable of type Inic_StreamPortConfigStatus_t
* which holds the results of the INIC.StreamPortConfiguration.Get command.
* \param self Reference to CInic instance
* \param msg_ptr Pointer to received message
*/
void Inic_StreamPortConfig_Status(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_StreamPortConfigStatus_t res;
Inic_StdResult_t res_data;
res_data.data_info = &res;
res_data.result.code = UCS_RES_SUCCESS;
res_data.result.info_ptr = NULL;
res.index = msg_ptr->tel.tel_data_ptr[0];
res.op_mode = (Ucs_Stream_PortOpMode_t)msg_ptr->tel.tel_data_ptr[1];
res.port_option = (Ucs_Stream_PortOption_t)msg_ptr->tel.tel_data_ptr[2];
res.clock_mode = (Ucs_Stream_PortClockMode_t)msg_ptr->tel.tel_data_ptr[3];
res.clock_data_delay = (Ucs_Stream_PortClockDataDelay_t)msg_ptr->tel.tel_data_ptr[4];
Ssub_Notify(&self_->ssubs[INIC_SSUB_STREAM_PORT_CONFIG], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_STREAM_PORT_CONFIG);
}
/*! \brief Handler function for INIC.StreamPortConfiguration.Error
* \details Result is delivered via the SingleObserver object ssubs[INIC_SSUB_STREAM_PORT_CONFIG].
* \param self Reference to CInic instance
* \param msg_ptr Pointer to received message
*/
void Inic_StreamPortConfig_Error(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_StdResult_t res_data;
res_data.data_info = NULL;
res_data.result = Inic_TranslateError(self_,
&msg_ptr->tel.tel_data_ptr[0],
msg_ptr->tel.tel_len);
Ssub_Notify(&self_->ssubs[INIC_SSUB_STREAM_PORT_CONFIG], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_STREAM_PORT_CONFIG);
}
/*! \brief Handler function for INIC.StreamPortCreate.ErrorAck
* \details Result is delivered via the SingleObserver object ssubs[INIC_SSUB_CREATE_CLASS].
* \param self Reference to CInic instance
* \param msg_ptr Pointer to received message
*/
void Inic_StreamPortCreate_Error(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_StdResult_t res_data;
res_data.data_info = NULL;
res_data.result = Inic_TranslateError(self_,
&msg_ptr->tel.tel_data_ptr[0],
(msg_ptr->tel.tel_len));
Ssub_Notify(&self_->ssubs[INIC_SSUB_CREATE_CLASS], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_CREATE_CLASS);
}
/*! \brief Handler function for INIC.StreamPortCreate.ResultAck
* \details Element res_data.data_info points to the variable stream_port_handle which holds the
* Streaming Port resource handle. Result is delivered via the SingleObserver object
* ssubs[INIC_SSUB_CREATE_CLASS].
* \param self Reference to CInic instance
* \param msg_ptr Pointer to received message
*/
void Inic_StreamPortCreate_Result(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
uint16_t stream_port_handle;
Inic_StdResult_t res_data;
MISC_DECODE_WORD(&stream_port_handle, &(msg_ptr->tel.tel_data_ptr[0]));
res_data.data_info = &stream_port_handle;
res_data.result.code = UCS_RES_SUCCESS;
res_data.result.info_ptr = NULL;
Ssub_Notify(&self_->ssubs[INIC_SSUB_CREATE_CLASS], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_CREATE_CLASS);
}
/*! \brief Handler function for INIC.StreamSocketCreate.ErrorAck
* \details Result is delivered via the SingleObserver object ssubs[INIC_SSUB_CREATE_CLASS].
* \param self Reference to CInic instance
* \param msg_ptr Pointer to received message
*/
void Inic_StreamSocketCreate_Error(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_StdResult_t res_data;
res_data.data_info = NULL;
res_data.result = Inic_TranslateError(self_,
&msg_ptr->tel.tel_data_ptr[0],
(msg_ptr->tel.tel_len));
Ssub_Notify(&self_->ssubs[INIC_SSUB_CREATE_CLASS], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_CREATE_CLASS);
}
/*! \brief Handler function for INIC.StreamSocketCreate.ResultAck
* \details Element res_data.data_info points to the variable stream_socket_handle which holds
* the Socket resource handle of the created socket. Result is delivered via the
* SingleObserver object ssubs[INIC_SSUB_CREATE_CLASS].
* \param self Reference to CInic instance
* \param msg_ptr Pointer to received message
*/
void Inic_StreamSocketCreate_Result(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
uint16_t stream_socket_handle;
Inic_StdResult_t res_data;
MISC_DECODE_WORD(&stream_socket_handle, &(msg_ptr->tel.tel_data_ptr[0]));
res_data.data_info = &stream_socket_handle;
res_data.result.code = UCS_RES_SUCCESS;
res_data.result.info_ptr = NULL;
Ssub_Notify(&self_->ssubs[INIC_SSUB_CREATE_CLASS], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_CREATE_CLASS);
}
/*! \brief Handler function for INIC.RMCKOutPortCreate.ErrorAck
* \details Result is delivered via the SingleObserver object ssubs[INIC_SSUB_CREATE_CLASS].
* \param self Reference to CInic instance
* \param msg_ptr Pointer to received message
*/
void Inic_RmckPortCreate_Error(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_StdResult_t res_data;
res_data.data_info = NULL;
res_data.result = Inic_TranslateError(self_,
&msg_ptr->tel.tel_data_ptr[0],
(msg_ptr->tel.tel_len));
Ssub_Notify(&self_->ssubs[INIC_SSUB_CREATE_CLASS], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_CREATE_CLASS);
}
/*! \brief Handler function for INIC.RMCKOutPortCreate.ResultAck
* \details Element res_data.data_info points to the variable rmck_port_handle which holds the
* RMCK Port resource handle. Result is delivered via the SingleObserver object
* ssubs[INIC_SSUB_CREATE_CLASS].
* \param self Reference to CInic instance
* \param msg_ptr Pointer to received message
*/
void Inic_RmckPortCreate_Result(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
uint16_t rmck_port_handle;
Inic_StdResult_t res_data;
MISC_DECODE_WORD(&rmck_port_handle, &(msg_ptr->tel.tel_data_ptr[0]));
res_data.data_info = &rmck_port_handle;
res_data.result.code = UCS_RES_SUCCESS;
res_data.result.info_ptr = NULL;
Ssub_Notify(&self_->ssubs[INIC_SSUB_CREATE_CLASS], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_CREATE_CLASS);
}
/*! \brief Handler function for INIC.I2CPortCreate.ErrorAck
* \details Result is delivered via the SingleObserver object ssubs[INIC_SSUB_CREATE_CLASS].
* \param self Reference to CInic instance
* \param msg_ptr Pointer to received message
*/
void Inic_I2cPortCreate_Error(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_StdResult_t res_data;
res_data.data_info = NULL;
res_data.result = Inic_TranslateError(self_,
&msg_ptr->tel.tel_data_ptr[0],
(msg_ptr->tel.tel_len));
Ssub_Notify(&self_->ssubs[INIC_SSUB_CREATE_CLASS], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_CREATE_CLASS);
}
/*! \brief Handler function for INIC.I2CPortCreate.ResultAck
* \details Element res_data.data_info points to the variable i2c_port_handle which holds the
* I2C Port resource handle. Result is delivered via the SingleObserver object
* ssubs[INIC_SSUB_CREATE_CLASS].
* \param self Reference to CInic instance
* \param msg_ptr Pointer to received message
*/
void Inic_I2cPortCreate_Result(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
uint16_t i2c_port_handle;
Inic_StdResult_t res_data;
MISC_DECODE_WORD(&i2c_port_handle, &(msg_ptr->tel.tel_data_ptr[0]));
res_data.data_info = &i2c_port_handle;
res_data.result.code = UCS_RES_SUCCESS;
res_data.result.info_ptr = NULL;
Ssub_Notify(&self_->ssubs[INIC_SSUB_CREATE_CLASS], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_CREATE_CLASS);
}
/*! \brief Handler function for INIC.I2CPortRead.ErrorAck
* \details Result is delivered via the SingleObserver object ssubs[INIC_SSUB_I2C_PORT_WR].
* \param self Reference to CInic instance
* \param msg_ptr Pointer to received message
*/
void Inic_I2cPortRead_Error(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_StdResult_t res_data;
res_data.data_info = NULL;
res_data.result = Inic_TranslateError(self_,
&msg_ptr->tel.tel_data_ptr[0],
(msg_ptr->tel.tel_len));
Ssub_Notify(&self_->ssubs[INIC_SSUB_I2C_PORT_WR], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_I2C_PORT_WR);
}
/*! \brief Handler function for INIC.I2CPortRead.ResultAck
* \details Element res_data.data_info points to a variable of type Inic_I2cReadResStatus_t which holds the
* the results of the INIC.I2CPortRead.StartResultAck command.
* Result is delivered via the SingleObserver object ssubs[INIC_SSUB_I2C_PORT_WR].
* \param self Reference to CInic instance
* \param msg_ptr Pointer to received message
*/
void Inic_I2cPortRead_Result(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_I2cReadResStatus_t i2c_read_res;
Inic_StdResult_t res_data;
res_data.data_info = &i2c_read_res;
res_data.result.code = UCS_RES_SUCCESS;
res_data.result.info_ptr = NULL;
MISC_DECODE_WORD(&i2c_read_res.port_handle, &(msg_ptr->tel.tel_data_ptr[0]));
i2c_read_res.slave_address = msg_ptr->tel.tel_data_ptr[2];
i2c_read_res.data_len = msg_ptr->tel.tel_data_ptr[3];
i2c_read_res.data_ptr = &msg_ptr->tel.tel_data_ptr[4];
Ssub_Notify(&self_->ssubs[INIC_SSUB_I2C_PORT_WR], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_I2C_PORT_WR);
}
/*! \brief Handler function for INIC.I2CPortWrite.ErrorAck
* \details Result is delivered via the SingleObserver object ssubs[INIC_SSUB_I2C_PORT_WR].
* \param self Reference to CInic instance
* \param msg_ptr Pointer to received message
*/
void Inic_I2cPortWrite_Error(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_StdResult_t res_data;
res_data.data_info = NULL;
res_data.result = Inic_TranslateError(self_,
&msg_ptr->tel.tel_data_ptr[0],
(msg_ptr->tel.tel_len));
Ssub_Notify(&self_->ssubs[INIC_SSUB_I2C_PORT_WR], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_I2C_PORT_WR);
}
/*! \brief Handler function for INIC.I2CPortWrite.ResultAck
* \details Element res_data.data_info points to a variable of type Inic_I2cWriteResStatus_t which holds the
* the results of the INIC.I2CPortWrite.StartResultAck command.
* Result is delivered via the SingleObserver object ssubs[INIC_SSUB_I2C_PORT_WR].
* \param self Reference to CInic instance
* \param msg_ptr Pointer to received message
*/
void Inic_I2cPortWrite_Result(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_I2cWriteResStatus_t i2c_write_res;
Inic_StdResult_t res_data;
res_data.data_info = &i2c_write_res;
res_data.result.code = UCS_RES_SUCCESS;
res_data.result.info_ptr = NULL;
MISC_DECODE_WORD(&i2c_write_res.port_handle, &(msg_ptr->tel.tel_data_ptr[0]));
i2c_write_res.slave_address = msg_ptr->tel.tel_data_ptr[2];
i2c_write_res.data_len = msg_ptr->tel.tel_data_ptr[3];
Ssub_Notify(&self_->ssubs[INIC_SSUB_I2C_PORT_WR], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_I2C_PORT_WR);
}
/*! \brief Handler function for INIC.PCIPortCreate.ErrorAck
* \details Result is delivered via the SingleObserver object ssubs[INIC_SSUB_CREATE_CLASS].
* \param self Reference to CInic instance
* \param msg_ptr Pointer to received message
*/
void Inic_PciPortCreate_Error(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_StdResult_t res_data;
res_data.data_info = NULL;
res_data.result = Inic_TranslateError(self_,
&msg_ptr->tel.tel_data_ptr[0],
(msg_ptr->tel.tel_len));
Ssub_Notify(&self_->ssubs[INIC_SSUB_CREATE_CLASS], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_CREATE_CLASS);
}
/*! \brief Handler function for INIC.PCIPortCreate.ResultAck
* \details Result is delivered via the SingleObserver object ssubs[INIC_SSUB_CREATE_CLASS].
* \param self Reference to CInic instance
* \param msg_ptr Pointer to received message
*/
void Inic_PciPortCreate_Result(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
uint16_t pci_port_handle;
Inic_StdResult_t res_data;
MISC_DECODE_WORD(&pci_port_handle, &(msg_ptr->tel.tel_data_ptr[0]));
res_data.data_info = &pci_port_handle;
res_data.result.code = UCS_RES_SUCCESS;
res_data.result.info_ptr = NULL;
Ssub_Notify(&self_->ssubs[INIC_SSUB_CREATE_CLASS], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_CREATE_CLASS);
}
/*! \brief Handler function for INIC.PCISocketCreate.ErrorAck
* \details Result is delivered via the SingleObserver object ssubs[INIC_SSUB_CREATE_CLASS].
* \param self Reference to CInic instance
* \param msg_ptr Pointer to received message
*/
void Inic_PciSocketCreate_Error(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_StdResult_t res_data;
res_data.data_info = NULL;
res_data.result = Inic_TranslateError(self_,
&msg_ptr->tel.tel_data_ptr[0],
(msg_ptr->tel.tel_len));
Ssub_Notify(&self_->ssubs[INIC_SSUB_CREATE_CLASS], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_CREATE_CLASS);
}
/*! \brief Handler function for INIC.PCISocketCreate.ResultAck
* \details Result is delivered via the SingleObserver object ssubs[INIC_SSUB_CREATE_CLASS].
* \param self Reference to CInic instance
* \param msg_ptr Pointer to received message
*/
void Inic_PciSocketCreate_Result(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
uint16_t pci_socket_port_handle;
Inic_StdResult_t res_data;
MISC_DECODE_WORD(&pci_socket_port_handle, &(msg_ptr->tel.tel_data_ptr[0]));
res_data.data_info = &pci_socket_port_handle;
res_data.result.code = UCS_RES_SUCCESS;
res_data.result.info_ptr = NULL;
Ssub_Notify(&self_->ssubs[INIC_SSUB_CREATE_CLASS], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_CREATE_CLASS);
}
/*! \brief Handler function for INIC.GPIOPortCreate.ErrorAck
* \details Result is delivered via the SingleObserver object ssubs[INIC_SSUB_CREATE_CLASS].
* \param self Reference to CInic instance
* \param msg_ptr Pointer to received message
*/
void Inic_GpioPortCreate_Error(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_StdResult_t res_data;
res_data.data_info = NULL;
res_data.result = Inic_TranslateError(self_,
&msg_ptr->tel.tel_data_ptr[0],
(msg_ptr->tel.tel_len));
Ssub_Notify(&self_->ssubs[INIC_SSUB_CREATE_CLASS], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_CREATE_CLASS);
}
/*! \brief Handler function for INIC.GPIOPortCreate.ResultAck
* \details Result is delivered via the SingleObserver object ssubs[INIC_SSUB_CREATE_CLASS].
* \param self Reference to CInic instance
* \param msg_ptr Pointer to received message
*/
void Inic_GpioPortCreate_Result(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
uint16_t gpio_port_handle;
Inic_StdResult_t res_data;
MISC_DECODE_WORD(&gpio_port_handle, &(msg_ptr->tel.tel_data_ptr[0]));
res_data.data_info = &gpio_port_handle;
res_data.result.code = UCS_RES_SUCCESS;
res_data.result.info_ptr = NULL;
Ssub_Notify(&self_->ssubs[INIC_SSUB_CREATE_CLASS], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_CREATE_CLASS);
}
/*! \brief Handler function for INIC.MOSTPortEnable.ErrorAck
* \details Result is delivered via the SingleObserver object ssubs[INIC_SSUB_MOST_PORT_ENABLE].
* \param self Reference to CInic instance
* \param msg_ptr Pointer to received message
*/
void Inic_MostPortEnable_Error(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_StdResult_t res_data;
res_data.data_info = NULL;
res_data.result = Inic_TranslateError(self_,
&msg_ptr->tel.tel_data_ptr[0],
(msg_ptr->tel.tel_len));
Ssub_Notify(&self_->ssubs[INIC_SSUB_MOST_PORT_ENABLE], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_MOST_PORT_ENABLE);
}
/*! \brief Handler function for INIC.MOSTPortEnable.ResultAck
* \details Result is delivered via the SingleObserver object ssubs[INIC_SSUB_MOST_PORT_ENABLE].
* \param self Reference to CInic instance
* \param msg_ptr Pointer to received message
*/
void Inic_MostPortEnable_Result(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_StdResult_t res_data;
MISC_UNUSED(msg_ptr);
res_data.data_info = NULL;
res_data.result.code = UCS_RES_SUCCESS;
res_data.result.info_ptr = NULL;
Ssub_Notify(&self_->ssubs[INIC_SSUB_MOST_PORT_ENABLE], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_MOST_PORT_ENABLE);
}
/*! \brief Handler function for INIC.GPIOPortPinMode.Status
* \details Result is delivered via the SingleObserver object ssubs[INIC_SSUB_GPIO_PIN_MODE].
* Element res_data.data_info points to a variable of type Inic_GpioPortPinModeStatus_t
* which holds the results of the INIC.GPIOPortPinMode.Get command.
* \param self Reference to CInic instance
* \param msg_ptr Pointer to received message
*/
void Inic_GpioPortPinMode_Status(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_GpioPortPinModeStatus_t res;
Inic_StdResult_t res_data;
uint8_t i = 2U, j = 0U;
Ucs_Gpio_PinConfiguration_t pin_ls[16U];
res.cfg_list = &pin_ls[0];
res.len = (msg_ptr->tel.tel_len - 2U) >> 1U;
res_data.data_info = &res;
res_data.result.code = UCS_RES_SUCCESS;
res_data.result.info_ptr = NULL;
MISC_DECODE_WORD(&res.gpio_handle, &(msg_ptr->tel.tel_data_ptr[0]));
for (; (i < msg_ptr->tel.tel_len) && (j < 16U); i=i+2U)
{
pin_ls[j].pin = msg_ptr->tel.tel_data_ptr[i];
pin_ls[j].mode = (Ucs_Gpio_PinMode_t)msg_ptr->tel.tel_data_ptr[i+1U];
j++;
}
Ssub_Notify(&self_->ssubs[INIC_SSUB_GPIO_PIN_MODE], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_GPIO_PIN_MODE);
}
/*! \brief Handler function for INIC.GPIOPortPinMode.Error
* \details Result is delivered via the SingleObserver object ssubs[INIC_SSUB_GPIO_PIN_MODE].
* \param self Reference to CInic instance
* \param msg_ptr Pointer to received message
*/
void Inic_GpioPortPinMode_Error(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_StdResult_t res_data;
res_data.data_info = NULL;
res_data.result = Inic_TranslateError(self_,
&msg_ptr->tel.tel_data_ptr[0],
msg_ptr->tel.tel_len);
Ssub_Notify(&self_->ssubs[INIC_SSUB_GPIO_PIN_MODE], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_GPIO_PIN_MODE);
}
/*! \brief Handler function for INIC.GPIOPortPinState.Status
* \details Result is delivered via the SingleObserver object ssubs[INIC_SSUB_GPIO_PIN_STATE].
* Element res_data.data_info points to a variable of type Inic_GpioPortPinStateStatus_t
* which holds the results of the INIC.GPIOPortPinState.Get command.
* \param self Reference to CInic instance
* \param msg_ptr Pointer to received message
*/
void Inic_GpioPortPinState_Status(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_GpioPortPinStateStatus_t res;
Inic_StdResult_t res_data;
res_data.data_info = &res;
res_data.result.code = UCS_RES_SUCCESS;
res_data.result.info_ptr = NULL;
MISC_DECODE_WORD(&res.gpio_handle, &(msg_ptr->tel.tel_data_ptr[0]));
MISC_DECODE_WORD(&res.current_state, &(msg_ptr->tel.tel_data_ptr[2]));
MISC_DECODE_WORD(&res.sticky_state, &(msg_ptr->tel.tel_data_ptr[4]));
Ssub_Notify(&self_->ssubs[INIC_SSUB_GPIO_PIN_STATE], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_GPIO_PIN_STATE);
}
/*! \brief Handler function for INIC.GPIOPortPinState.Error
* \details Result is delivered via the SingleObserver object ssubs[INIC_SSUB_GPIO_PIN_STATE].
* \param self Reference to CInic instance
* \param msg_ptr Pointer to received message
*/
void Inic_GpioPortPinState_Error(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_StdResult_t res_data;
res_data.data_info = NULL;
res_data.result = Inic_TranslateError(self_,
&msg_ptr->tel.tel_data_ptr[0],
msg_ptr->tel.tel_len);
Ssub_Notify(&self_->ssubs[INIC_SSUB_GPIO_PIN_STATE], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_GPIO_PIN_STATE);
}
/*! \brief Handler function for INIC.GPIOPortTriggerEvent.Status
* \details Result is delivered via the SingleObserver object ssubs[INIC_SSUB_GPIO_TRIGGER_EVENT].
* Element res_data.data_info points to a variable of type Inic_GpioTriggerEventStatus_t
* \param self Reference to CInic instance
* \param msg_ptr Pointer to received message
*/
void Inic_GpioPortTrigger_Status(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_GpioTriggerEventStatus_t res;
Inic_StdResult_t res_data;
res_data.data_info = &res;
res_data.result.code = UCS_RES_SUCCESS;
res_data.result.info_ptr = NULL;
MISC_DECODE_WORD(&res.gpio_handle, &(msg_ptr->tel.tel_data_ptr[0]));
MISC_DECODE_WORD(&res.rising_edges, &(msg_ptr->tel.tel_data_ptr[2]));
MISC_DECODE_WORD(&res.falling_edges, &(msg_ptr->tel.tel_data_ptr[4]));
MISC_DECODE_WORD(&res.levels, &(msg_ptr->tel.tel_data_ptr[6]));
res.is_first_report = self_->gpio_rt_status.first_report;
if (self_->gpio_rt_status.first_report)
{
self_->gpio_rt_status.first_report = false;
}
Sub_Notify(&self_->subs[INIC_SUB_GPIO_TRIGGER_EVENT], &res_data);
}
/*! \brief Handler function for INIC.GPIOPortTriggerEvent.Error
* \details Result is delivered via the SingleObserver object ssubs[INIC_SSUB_GPIO_TRIGGER_EVENT].
* \param self Reference to CInic instance
* \param msg_ptr Pointer to received message
*/
void Inic_GpioPortTrigger_Error(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_StdResult_t res_data;
res_data.data_info = NULL;
res_data.result = Inic_TranslateError(self_,
&msg_ptr->tel.tel_data_ptr[0],
msg_ptr->tel.tel_len);
Sub_Notify(&self_->subs[INIC_SUB_GPIO_TRIGGER_EVENT], &res_data);
}
/*! \brief Handler function for INIC.MOSTPortEnableFullStreaming.ErrorAck
* \details Result is delivered via the SingleObserver object ssubs[INIC_SSUB_MOST_PORT_EN_FULL_STR].
* \param self Reference to CInic instance
* \param msg_ptr Pointer to received message
*/
void Inic_MostPortEnFullStr_Error(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_StdResult_t res_data;
res_data.data_info = NULL;
res_data.result = Inic_TranslateError(self_,
&msg_ptr->tel.tel_data_ptr[0],
(msg_ptr->tel.tel_len));
Ssub_Notify(&self_->ssubs[INIC_SSUB_MOST_PORT_EN_FULL_STR], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_MOST_PORT_EN_FULL_STR);
}
/*! \brief Handler function for INIC.MOSTPortEnableFullStreaming.ResultAck
* \details Result is delivered via the SingleObserver object ssubs[INIC_SSUB_MOST_PORT_EN_FULL_STR].
* \param self Reference to CInic instance
* \param msg_ptr Pointer to received message
*/
void Inic_MostPortEnFullStr_Result(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_StdResult_t res_data;
MISC_UNUSED(msg_ptr);
res_data.data_info = NULL;
res_data.result.code = UCS_RES_SUCCESS;
res_data.result.info_ptr = NULL;
Ssub_Notify(&self_->ssubs[INIC_SSUB_MOST_PORT_EN_FULL_STR], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_MOST_PORT_EN_FULL_STR);
}
/*! \brief Handler function for INIC.Notification.Error
* \param self reference to INIC object
* \param msg_ptr received message
*/
void Inic_Notification_Error(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_StdResult_t res_data;
res_data.data_info = NULL;
res_data.result = Inic_TranslateError(self_,
&msg_ptr->tel.tel_data_ptr[0],
(msg_ptr->tel.tel_len));
Ssub_Notify(&self_->ssubs[INIC_SSUB_NOTIFICATION], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_NOTIFICATION);
}
/*! \brief Handler function for INIC.Notification.ResultAck
* \param self reference to INIC object
* \param msg_ptr received message
*/
void Inic_Notification_Status(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_StdResult_t res_data;
Inic_NotificationResult_t notif_res;
res_data.data_info = ¬if_res;
res_data.result.code = UCS_RES_SUCCESS;
res_data.result.info_ptr = NULL;
MISC_DECODE_WORD(¬if_res.func_id, &(msg_ptr->tel.tel_data_ptr[0]));
if (msg_ptr->tel.tel_len == 4U)
{
MISC_DECODE_WORD(¬if_res.device_id, &(msg_ptr->tel.tel_data_ptr[2]));
}
else
{
notif_res.device_id = 0U;
}
Ssub_Notify(&self_->ssubs[INIC_SSUB_NOTIFICATION], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_NOTIFICATION);
}
/*! \brief Handler function for INIC.DeviceSync.Error
* \param self reference to INIC object
* \param msg_ptr received message
*/
void Inic_DeviceSync_Error(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_StdResult_t res_data;
res_data.data_info = NULL;
res_data.result = Inic_TranslateError(self_,
&msg_ptr->tel.tel_data_ptr[0],
(msg_ptr->tel.tel_len));
Ssub_Notify(&self_->ssubs[INIC_SSUB_DEVICE_SYNC], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_DEVICE_SYNC);
}
/*! \brief Handler function for INIC.DeviceSync.Result
* \param self reference to INIC object
* \param msg_ptr received message
*/
void Inic_DeviceSync_Result(void *self, Msg_MostTel_t *msg_ptr)
{
CInic *self_ = (CInic *)self;
Inic_StdResult_t res_data;
MISC_UNUSED(msg_ptr);
res_data.data_info = NULL;
res_data.result.code = UCS_RES_SUCCESS;
res_data.result.info_ptr = NULL;
Ssub_Notify(&self_->ssubs[INIC_SSUB_DEVICE_SYNC], &res_data, true);
Al_Release(&self_->lock.res_api, INIC_API_DEVICE_SYNC);
}
/*!
* @}
* \endcond
*/
/*------------------------------------------------------------------------------------------------*/
/* End of file */
/*------------------------------------------------------------------------------------------------*/
|