summaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-u3v.c
blob: cc5573ee708816ca239c825f2a11faf419b4e801 (plain)
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
/* packet-u3v.c
 * Routines for AIA USB3 Vision (TM) Protocol dissection
 * Copyright 2016, AIA (www.visiononline.org)
 *
 * USB3 Vision (TM): USB3 Vision a standard developed under the sponsorship of
 * the AIA for the benefit of the machine vision industry.
 * U3V stands for USB3 Vision (TM) Protocol.
 *
 * Wireshark - Network traffic analyzer
 * By Gerald Combs <gerald@wireshark.org>
 * Copyright 1998 Gerald Combs
 *
 * SPDX-License-Identifier: GPL-2.0-or-later
 */

#include "config.h"

#include <epan/packet.h>
#include <epan/proto_data.h>
#include "packet-usb.h"

/*
U3V descriptor constants
*/
#define DESCRIPTOR_TYPE_U3V_INTERFACE 0x24
#define DESCRIPTOR_SUBTYPE_U3V_DEVICE_INFO 0x01

/*
 Bootstrap registers addresses
 */
#define U3V_ABRM_GENCP_VERSION 0x00000000
#define U3V_ABRM_MANUFACTURER_NAME 0x00000004
#define U3V_ABRM_MODEL_NAME 0x00000044
#define U3V_ABRM_FAMILY_NAME 0x00000084
#define U3V_ABRM_DEVICE_VERSION 0x000000C4
#define U3V_ABRM_MANUFACTURER_INFO 0x00000104
#define U3V_ABRM_SERIAL_NUMBER 0x00000144
#define U3V_ABRM_USER_DEFINED_NAME 0x00000184
#define U3V_ABRM_DEVICE_CAPABILITY 0x000001C4
#define U3V_ABRM_MAXIMUM_DEVICE_RESPONSE_TIME 0x000001CC
#define U3V_ABRM_MANIFEST_TABLE_ADDRESS 0x000001D0
#define U3V_ABRM_SBRM_ADDRESS 0x000001D8
#define U3V_ABRM_DEVICE_CONFIGURATION 0x000001E0
#define U3V_ABRM_HEARTBEAT_TIMEOUT 0x000001E8
#define U3V_ABRM_MESSAGE_CHANNEL_CHANNEL_ID 0x000001EC
#define U3V_ABRM_TIMESTAMP 0x000001F0
#define U3V_ABRM_TIMESTAMP_LATCH 0x000001F8
#define U3V_ABRM_TIMESTAMP_INCREMENT 0x000001FC
#define U3V_ABRM_ACCESS_PRIVILEGE 0x00000204
#define U3V_ABRM_PROTOCOL_ENDIANNESS 0x00000208
#define U3V_ABRM_IMPLEMENTATION_ENDIANNESS 0x0000020C
#define U3V_SBRM_U3V_VERSION 0x00000000
#define U3V_SBRM_U3VCP_CAPABILITY_REGISTER 0x00000004
#define U3V_SBRM_U3VCP_CONFIGURATION_REGISTER 0x0000000C
#define U3V_SBRM_MAXIMUM_COMMAND_TRANSFER_LENGTH 0x00000014
#define U3V_SBRM_MAXIMUM_ACKNOWLEDGE_TRANSFER_LENGTH 0x00000018
#define U3V_SBRM_NUMBER_OF_STREAM_CHANNELS 0x0000001C
#define U3V_SBRM_SIRM_ADDRESS 0x00000020
#define U3V_SBRM_SIRM_LENGTH 0x00000028
#define U3V_SBRM_EIRM_ADDRESS 0x0000002C
#define U3V_SBRM_EIRM_LENGTH 0x00000034
#define U3V_SBRM_IIDC2_ADDRESS 0x00000038
#define U3V_SBRM_CURRENT_SPEED 0x00000040
#define U3V_SIRM_SI_INFO 0x00000000
#define U3V_SIRM_SI_CONTROL 0x00000004
#define U3V_SIRM_SI_REQUIRED_PAYLOAD_SIZE 0x00000008
#define U3V_SIRM_SI_REQUIRED_LEADER_SIZE 0x00000010
#define U3V_SIRM_SI_REQUIRED_TRAILER_SIZE 0x00000014
#define U3V_SIRM_SI_MAXIMUM_LEADER_SIZE 0x00000018
#define U3V_SIRM_SI_PAYLOAD_TRANSFER_SIZE 0x0000001C
#define U3V_SIRM_SI_PAYLOAD_TRANSFER_COUNT 0x00000020
#define U3V_SIRM_SI_PAYLOAD_FINAL_TRANSFER1_SIZE 0x00000024
#define U3V_SIRM_SI_PAYLOAD_FINAL_TRANSFER2_SIZE 0x00000028
#define U3V_SIRM_SI_MAXIMUM_TRAILER_SIZE 0x0000002C
#define U3V_EIRM_EI_CONTROL 0x00000000
#define U3V_EIRM_MAXIMUM_EVENT_TRANSFER_LENGTH 0x00000004
#define U3V_EIRM_EVENT_TEST_CONTROL 0x00000008

/*
 Command and acknowledge IDs
*/
#define U3V_READMEM_CMD 0x0800
#define U3V_READMEM_ACK 0x0801
#define U3V_WRITEMEM_CMD 0x0802
#define U3V_WRITEMEM_ACK 0x0803
#define U3V_PENDING_ACK 0x0805
#define U3V_EVENT_CMD 0x0C00
#define U3V_EVENT_ACK 0x0C01

/*
 Status codes
*/
#define U3V_STATUS_GENCP_SUCCESS               0x0000
#define U3V_STATUS_GENCP_NOT_IMPLEMENTED       0x8001
#define U3V_STATUS_GENCP_INVALID_PARAMETER     0x8002
#define U3V_STATUS_GENCP_INVALID_ADDRESS       0x8003
#define U3V_STATUS_GENCP_WRITE_PROTECT         0x8004
#define U3V_STATUS_GENCP_BAD_ALIGNMENT         0x8005
#define U3V_STATUS_GENCP_ACCESS_DENIED         0x8006
#define U3V_STATUS_GENCP_BUSY                  0x8007
/* 0x8008 - 0x800A have been used in GEV 1.x but are now deprecated. The GenCP specification did NOT recycle these values! */
#define U3V_STATUS_GENCP_MSG_TIMEOUT           0x800B
/* 0x800C - 0x800D are used in GEV only. The GenCP specification did NOT recycle these values! */
#define U3V_STATUS_GENCP_INVALID_HEADER        0x800E
#define U3V_STATUS_GENCP_WRONG_CONFIG          0x800F

#define U3V_STATUS_GENCP_ERROR                 0x8FFF

#define U3V_STATUS_RESEND_NOT_SUPPORTED        0xA001
#define U3V_STATUS_DSI_ENDPOINT_HALTED         0xA002
#define U3V_STATUS_SI_PAYLOAD_SIZE_NOT_ALIGNED 0xA003
#define U3V_STATUS_SI_REGISTERS_INCONSISTENT   0xA004
#define U3V_STATUS_DATA_DISCARDED              0xA100
#define U3V_STATUS_DATA_OVERRUN                0xA101

/*
 Prefix
*/
#define U3V_CONTROL_PREFIX 0x43563355
#define U3V_EVENT_PREFIX   0x45563355

#define U3V_STREAM_LEADER_PREFIX  0x4C563355
#define U3V_STREAM_TRAILER_PREFIX 0x54563355

/*
 Event IDs
*/
#define U3V_EVENT_TESTEVENT 0x4FFF

/*
 * Pixel Format IDs
*/
#define PFNC_U3V_MONO1P 0x01010037
#define PFNC_U3V_MONO2P 0x01020038
#define PFNC_U3V_MONO4P 0x01040039
#define PFNC_U3V_MONO8 0x01080001
#define PFNC_U3V_MONO8S 0x01080002
#define PFNC_U3V_MONO10 0x01100003
#define PFNC_U3V_MONO10P 0x010A0046
#define PFNC_U3V_MONO12 0x01100005
#define PFNC_U3V_MONO12P 0x010C0047
#define PFNC_U3V_MONO14 0x01100025
#define PFNC_U3V_MONO14P 0x010E0104
#define PFNC_U3V_MONO16 0x01100007
#define PFNC_U3V_MONO32 0x01200111
#define PFNC_U3V_BAYERBG4P 0x01040110
#define PFNC_U3V_BAYERBG8 0x0108000B
#define PFNC_U3V_BAYERBG10 0x0110000F
#define PFNC_U3V_BAYERBG10P 0x010A0052
#define PFNC_U3V_BAYERBG12 0x01100013
#define PFNC_U3V_BAYERBG12P 0x010C0053
#define PFNC_U3V_BAYERBG14 0x0110010C
#define PFNC_U3V_BAYERBG14P 0x010E0108
#define PFNC_U3V_BAYERBG16 0x01100031
#define PFNC_U3V_BAYERGB4P 0x0104010F
#define PFNC_U3V_BAYERGB8 0x0108000A
#define PFNC_U3V_BAYERGB10 0x0110000E
#define PFNC_U3V_BAYERGB10P 0x010A0054
#define PFNC_U3V_BAYERGB12 0x01100012
#define PFNC_U3V_BAYERGB12P 0x010C0055
#define PFNC_U3V_BAYERGB14 0x0110010B
#define PFNC_U3V_BAYERGB14P 0x010E0107
#define PFNC_U3V_BAYERGB16 0x01100030
#define PFNC_U3V_BAYERGR4P 0x0104010D
#define PFNC_U3V_BAYERGR8 0x01080008
#define PFNC_U3V_BAYERGR10 0x0110000C
#define PFNC_U3V_BAYERGR10P 0x010A0056
#define PFNC_U3V_BAYERGR12 0x01100010
#define PFNC_U3V_BAYERGR12P 0x010C0057
#define PFNC_U3V_BAYERGR14 0x01100109
#define PFNC_U3V_BAYERGR14P 0x010E0105
#define PFNC_U3V_BAYERGR16 0x0110002E
#define PFNC_U3V_BAYERRG4P 0x0104010E
#define PFNC_U3V_BAYERRG8 0x01080009
#define PFNC_U3V_BAYERRG10 0x0110000D
#define PFNC_U3V_BAYERRG10P 0x010A0058
#define PFNC_U3V_BAYERRG12 0x01100011
#define PFNC_U3V_BAYERRG12P 0x010C0059
#define PFNC_U3V_BAYERRG14 0x0110010A
#define PFNC_U3V_BAYERRG14P 0x010E0106
#define PFNC_U3V_BAYERRG16 0x0110002F
#define PFNC_U3V_RGBA8 0x02200016
#define PFNC_U3V_RGBA10 0x0240005F
#define PFNC_U3V_RGBA10P 0x02280060
#define PFNC_U3V_RGBA12 0x02400061
#define PFNC_U3V_RGBA12P 0x02300062
#define PFNC_U3V_RGBA14 0x02400063
#define PFNC_U3V_RGBA16 0x02400064
#define PFNC_U3V_RGB8 0x02180014
#define PFNC_U3V_RGB8_PLANAR 0x02180021
#define PFNC_U3V_RGB10 0x02300018
#define PFNC_U3V_RGB10_PLANAR 0x02300022
#define PFNC_U3V_RGB10P 0x021E005C
#define PFNC_U3V_RGB10P32 0x0220001D
#define PFNC_U3V_RGB12 0x0230001A
#define PFNC_U3V_RGB12_PLANAR 0x02300023
#define PFNC_U3V_RGB12P 0x0224005D
#define PFNC_U3V_RGB14 0x0230005E
#define PFNC_U3V_RGB16 0x02300033
#define PFNC_U3V_RGB16_PLANAR 0x02300024
#define PFNC_U3V_RGB565P 0x02100035
#define PFNC_U3V_BGRA8 0x02200017
#define PFNC_U3V_BGRA10 0x0240004C
#define PFNC_U3V_BGRA10P 0x0228004D
#define PFNC_U3V_BGRA12 0x0240004E
#define PFNC_U3V_BGRA12P 0x0230004F
#define PFNC_U3V_BGRA14 0x02400050
#define PFNC_U3V_BGRA16 0x02400051
#define PFNC_U3V_BGR8 0x02180015
#define PFNC_U3V_BGR10 0x02300019
#define PFNC_U3V_BGR10P 0x021E0048
#define PFNC_U3V_BGR12 0x0230001B
#define PFNC_U3V_BGR12P 0x02240049
#define PFNC_U3V_BGR14 0x0230004A
#define PFNC_U3V_BGR16 0x0230004B
#define PFNC_U3V_BGR565P 0x02100036
#define PFNC_U3V_R8 0x010800C9
#define PFNC_U3V_R10 0x01100120
#define PFNC_U3V_R10_DEPRECATED 0x010A00CA
#define PFNC_U3V_R12 0x01100121
#define PFNC_U3V_R12_DEPRECATED 0x010C00CB
#define PFNC_U3V_R16 0x011000CC
#define PFNC_U3V_G8 0x010800CD
#define PFNC_U3V_G10 0x01100122
#define PFNC_U3V_G10_DEPRECATED 0x010A00CE
#define PFNC_U3V_G12 0x01100123
#define PFNC_U3V_G12_DEPRECATED 0x010C00CF
#define PFNC_U3V_G16 0x011000D0
#define PFNC_U3V_B8 0x010800D1
#define PFNC_U3V_B10 0x01100124
#define PFNC_U3V_B10_DEPRECATED 0x010A00D2
#define PFNC_U3V_B12 0x01100125
#define PFNC_U3V_B12_DEPRECATED 0x010C00D3
#define PFNC_U3V_B16 0x011000D4
#define PFNC_U3V_COORD3D_ABC8 0x021800B2
#define PFNC_U3V_COORD3D_ABC8_PLANAR 0x021800B3
#define PFNC_U3V_COORD3D_ABC10P 0x021E00DB
#define PFNC_U3V_COORD3D_ABC10P_PLANAR 0x021E00DC
#define PFNC_U3V_COORD3D_ABC12P 0x022400DE
#define PFNC_U3V_COORD3D_ABC12P_PLANAR 0x022400DF
#define PFNC_U3V_COORD3D_ABC16 0x023000B9
#define PFNC_U3V_COORD3D_ABC16_PLANAR 0x023000BA
#define PFNC_U3V_COORD3D_ABC32F 0x026000C0
#define PFNC_U3V_COORD3D_ABC32F_PLANAR 0x026000C1
#define PFNC_U3V_COORD3D_AC8 0x021000B4
#define PFNC_U3V_COORD3D_AC8_PLANAR 0x021000B5
#define PFNC_U3V_COORD3D_AC10P 0x021400F0
#define PFNC_U3V_COORD3D_AC10P_PLANAR 0x021400F1
#define PFNC_U3V_COORD3D_AC12P 0x021800F2
#define PFNC_U3V_COORD3D_AC12P_PLANAR 0x021800F3
#define PFNC_U3V_COORD3D_AC16 0x022000BB
#define PFNC_U3V_COORD3D_AC16_PLANAR 0x022000BC
#define PFNC_U3V_COORD3D_AC32F 0x024000C2
#define PFNC_U3V_COORD3D_AC32F_PLANAR 0x024000C3
#define PFNC_U3V_COORD3D_A8 0x010800AF
#define PFNC_U3V_COORD3D_A10P 0x010A00D5
#define PFNC_U3V_COORD3D_A12P 0x010C00D8
#define PFNC_U3V_COORD3D_A16 0x011000B6
#define PFNC_U3V_COORD3D_A32F 0x012000BD
#define PFNC_U3V_COORD3D_B8 0x010800B0
#define PFNC_U3V_COORD3D_B10P 0x010A00D6
#define PFNC_U3V_COORD3D_B12P 0x010C00D9
#define PFNC_U3V_COORD3D_B16 0x011000B7
#define PFNC_U3V_COORD3D_B32F 0x012000BE
#define PFNC_U3V_COORD3D_C8 0x010800B1
#define PFNC_U3V_COORD3D_C10P 0x010A00D7
#define PFNC_U3V_COORD3D_C12P 0x010C00DA
#define PFNC_U3V_COORD3D_C16 0x011000B8
#define PFNC_U3V_COORD3D_C32F 0x012000BF
#define PFNC_U3V_CONFIDENCE1 0x010800C4
#define PFNC_U3V_CONFIDENCE1P 0x010100C5
#define PFNC_U3V_CONFIDENCE8 0x010800C6
#define PFNC_U3V_CONFIDENCE16 0x011000C7
#define PFNC_U3V_CONFIDENCE32F 0x012000C8
#define PFNC_U3V_BICOLORBGRG8 0x021000A6
#define PFNC_U3V_BICOLORBGRG10 0x022000A9
#define PFNC_U3V_BICOLORBGRG10P 0x021400AA
#define PFNC_U3V_BICOLORBGRG12 0x022000AD
#define PFNC_U3V_BICOLORBGRG12P 0x021800AE
#define PFNC_U3V_BICOLORRGBG8 0x021000A5
#define PFNC_U3V_BICOLORRGBG10 0x022000A7
#define PFNC_U3V_BICOLORRGBG10P 0x021400A8
#define PFNC_U3V_BICOLORRGBG12 0x022000AB
#define PFNC_U3V_BICOLORRGBG12P 0x021800AC
#define PFNC_U3V_DATA8 0x01080116
#define PFNC_U3V_DATA8S 0x01080117
#define PFNC_U3V_DATA16 0x01100118
#define PFNC_U3V_DATA16S 0x01100119
#define PFNC_U3V_DATA32 0x0120011A
#define PFNC_U3V_DATA32F 0x0120011C
#define PFNC_U3V_DATA32S 0x0120011B
#define PFNC_U3V_DATA64 0x0140011D
#define PFNC_U3V_DATA64F 0x0140011F
#define PFNC_U3V_DATA64S 0x0140011E
#define PFNC_U3V_SCF1WBWG8 0x01080067
#define PFNC_U3V_SCF1WBWG10 0x01100068
#define PFNC_U3V_SCF1WBWG10P 0x010A0069
#define PFNC_U3V_SCF1WBWG12 0x0110006A
#define PFNC_U3V_SCF1WBWG12P 0x010C006B
#define PFNC_U3V_SCF1WBWG14 0x0110006C
#define PFNC_U3V_SCF1WBWG16 0x0110006D
#define PFNC_U3V_SCF1WGWB8 0x0108006E
#define PFNC_U3V_SCF1WGWB10 0x0110006F
#define PFNC_U3V_SCF1WGWB10P 0x010A0070
#define PFNC_U3V_SCF1WGWB12 0x01100071
#define PFNC_U3V_SCF1WGWB12P 0x010C0072
#define PFNC_U3V_SCF1WGWB14 0x01100073
#define PFNC_U3V_SCF1WGWB16 0x01100074
#define PFNC_U3V_SCF1WGWR8 0x01080075
#define PFNC_U3V_SCF1WGWR10 0x01100076
#define PFNC_U3V_SCF1WGWR10P 0x010A0077
#define PFNC_U3V_SCF1WGWR12 0x01100078
#define PFNC_U3V_SCF1WGWR12P 0x010C0079
#define PFNC_U3V_SCF1WGWR14 0x0110007A
#define PFNC_U3V_SCF1WGWR16 0x0110007B
#define PFNC_U3V_SCF1WRWG8 0x0108007C
#define PFNC_U3V_SCF1WRWG10 0x0110007D
#define PFNC_U3V_SCF1WRWG10P 0x010A007E
#define PFNC_U3V_SCF1WRWG12 0x0110007F
#define PFNC_U3V_SCF1WRWG12P 0x010C0080
#define PFNC_U3V_SCF1WRWG14 0x01100081
#define PFNC_U3V_SCF1WRWG16 0x01100082
#define PFNC_U3V_YCBCR8 0x0218005B
#define PFNC_U3V_YCBCR8_CBYCR 0x0218003A
#define PFNC_U3V_YCBCR10_CBYCR 0x02300083
#define PFNC_U3V_YCBCR10P_CBYCR 0x021E0084
#define PFNC_U3V_YCBCR12_CBYCR 0x02300085
#define PFNC_U3V_YCBCR12P_CBYCR 0x02240086
#define PFNC_U3V_YCBCR411_8 0x020C005A
#define PFNC_U3V_YCBCR411_8_CBYYCRYY 0x020C003C
#define PFNC_U3V_YCBCR420_8_YY_CBCR_SEMIPLANAR 0x020C0112
#define PFNC_U3V_YCBCR420_8_YY_CRCB_SEMIPLANAR 0x020C0114
#define PFNC_U3V_YCBCR422_8 0x0210003B
#define PFNC_U3V_YCBCR422_8_CBYCRY 0x02100043
#define PFNC_U3V_YCBCR422_8_YY_CBCR_SEMIPLANAR 0x02100113
#define PFNC_U3V_YCBCR422_8_YY_CRCB_SEMIPLANAR 0x02100115
#define PFNC_U3V_YCBCR422_10 0x02200065
#define PFNC_U3V_YCBCR422_10_CBYCRY 0x02200099
#define PFNC_U3V_YCBCR422_10P 0x02140087
#define PFNC_U3V_YCBCR422_10P_CBYCRY 0x0214009A
#define PFNC_U3V_YCBCR422_12 0x02200066
#define PFNC_U3V_YCBCR422_12_CBYCRY 0x0220009B
#define PFNC_U3V_YCBCR422_12P 0x02180088
#define PFNC_U3V_YCBCR422_12P_CBYCRY 0x0218009C
#define PFNC_U3V_YCBCR601_8_CBYCR 0x0218003D
#define PFNC_U3V_YCBCR601_10_CBYCR 0x02300089
#define PFNC_U3V_YCBCR601_10P_CBYCR 0x021E008A
#define PFNC_U3V_YCBCR601_12_CBYCR 0x0230008B
#define PFNC_U3V_YCBCR601_12P_CBYCR 0x0224008C
#define PFNC_U3V_YCBCR601_411_8_CBYYCRYY 0x020C003F
#define PFNC_U3V_YCBCR601_422_8 0x0210003E
#define PFNC_U3V_YCBCR601_422_8_CBYCRY 0x02100044
#define PFNC_U3V_YCBCR601_422_10 0x0220008D
#define PFNC_U3V_YCBCR601_422_10_CBYCRY 0x0220009D
#define PFNC_U3V_YCBCR601_422_10P 0x0214008E
#define PFNC_U3V_YCBCR601_422_10P_CBYCRY 0x0214009E
#define PFNC_U3V_YCBCR601_422_12 0x0220008F
#define PFNC_U3V_YCBCR601_422_12_CBYCRY 0x0220009F
#define PFNC_U3V_YCBCR601_422_12P 0x02180090
#define PFNC_U3V_YCBCR601_422_12P_CBYCRY 0x021800A0
#define PFNC_U3V_YCBCR709_8_CBYCR 0x02180040
#define PFNC_U3V_YCBCR709_10_CBYCR 0x02300091
#define PFNC_U3V_YCBCR709_10P_CBYCR 0x021E0092
#define PFNC_U3V_YCBCR709_12_CBYCR 0x02300093
#define PFNC_U3V_YCBCR709_12P_CBYCR 0x02240094
#define PFNC_U3V_YCBCR709_411_8_CBYYCRYY 0x020C0042
#define PFNC_U3V_YCBCR709_422_8 0x02100041
#define PFNC_U3V_YCBCR709_422_8_CBYCRY 0x02100045
#define PFNC_U3V_YCBCR709_422_10 0x02200095
#define PFNC_U3V_YCBCR709_422_10_CBYCRY 0x022000A1
#define PFNC_U3V_YCBCR709_422_10P 0x02140096
#define PFNC_U3V_YCBCR709_422_10P_CBYCRY 0x021400A2
#define PFNC_U3V_YCBCR709_422_12 0x02200097
#define PFNC_U3V_YCBCR709_422_12_CBYCRY 0x022000A3
#define PFNC_U3V_YCBCR709_422_12P 0x02180098
#define PFNC_U3V_YCBCR709_422_12P_CBYCRY 0x021800A4
#define PFNC_U3V_YCBCR2020_8_CBYCR 0x021800F4
#define PFNC_U3V_YCBCR2020_10_CBYCR 0x023000F5
#define PFNC_U3V_YCBCR2020_10P_CBYCR 0x021E00F6
#define PFNC_U3V_YCBCR2020_12_CBYCR 0x023000F7
#define PFNC_U3V_YCBCR2020_12P_CBYCR 0x022400F8
#define PFNC_U3V_YCBCR2020_411_8_CBYYCRYY 0x020C00F9
#define PFNC_U3V_YCBCR2020_422_8 0x021000FA
#define PFNC_U3V_YCBCR2020_422_8_CBYCRY 0x021000FB
#define PFNC_U3V_YCBCR2020_422_10 0x022000FC
#define PFNC_U3V_YCBCR2020_422_10_CBYCRY 0x022000FD
#define PFNC_U3V_YCBCR2020_422_10P 0x021400FE
#define PFNC_U3V_YCBCR2020_422_10P_CBYCRY 0x021400FF
#define PFNC_U3V_YCBCR2020_422_12 0x02200100
#define PFNC_U3V_YCBCR2020_422_12_CBYCRY 0x02200101
#define PFNC_U3V_YCBCR2020_422_12P 0x02180102
#define PFNC_U3V_YCBCR2020_422_12P_CBYCRY 0x02180103
#define PFNC_U3V_YUV8_UYV 0x02180020
#define PFNC_U3V_YUV411_8_UYYVYY 0x020C001E
#define PFNC_U3V_YUV422_8 0x02100032
#define PFNC_U3V_YUV422_8_UYVY 0x0210001F
#define GVSP_MONO10PACKED 0x010C0004
#define GVSP_MONO12PACKED 0x010C0006
#define GVSP_BAYERBG10PACKED 0x010C0029
#define GVSP_BAYERBG12PACKED 0x010C002D
#define GVSP_BAYERGB10PACKED 0x010C0028
#define GVSP_BAYERGB12PACKED 0x010C002C
#define GVSP_BAYERGR10PACKED 0x010C0026
#define GVSP_BAYERGR12PACKED 0x010C002A
#define GVSP_BAYERRG10PACKED 0x010C0027
#define GVSP_BAYERRG12PACKED 0x010C002B
#define GVSP_RGB10V1PACKED 0x0220001C
#define GVSP_RGB12V1PACKED 0x02240034

/*
 Payload Types
*/
#define U3V_STREAM_PAYLOAD_IMAGE            0x0001
#define U3V_STREAM_PAYLOAD_IMAGE_EXT_CHUNK  0x4001
#define U3V_STREAM_PAYLOAD_CHUNK            0x4000

void proto_register_u3v(void);
void proto_reg_handoff_u3v(void);

/* Define the u3v protocol */
static int proto_u3v = -1;

/* GenCP transaction tracking
 * the protocol only allows strict sequential
 * communication.
 *
 * we track the current cmd/ack/pend_ack information
 * in a struct that is created per GenCP communication
 *
 * in each request/response packet we add pointers
 * to this information, that allow navigation between packets
 * and dissection of addresses
 */
typedef struct _gencp_transaction_t {
    guint32  cmd_frame;
    guint32  ack_frame;
    nstime_t cmd_time;
    /* list of pending acknowledges */
    wmem_array_t *pend_ack_frame_list;
    /* current requested address */
    guint64 address;
    /* current requested count read/write */
    guint32 count;
} gencp_transaction_t;

typedef struct _u3v_conv_info_t {
    guint64 abrm_addr;
    guint64 sbrm_addr;
    guint64 sirm_addr;
    guint64 eirm_addr;
    guint64 iidc2_addr;
    guint64 manifest_addr;
    guint32 ep_stream;
    gencp_transaction_t *trans_info;
} u3v_conv_info_t;

/*
 \brief IDs used for bootstrap dissection
*/
static int hf_u3v_gencp_prefix = -1;
static int hf_u3v_flag = -1;
static int hf_u3v_acknowledge_required_flag = -1;
static int hf_u3v_command_id = -1;
static int hf_u3v_length = -1;
static int hf_u3v_request_id = -1;
static int hf_u3v_status = -1;
static int hf_u3v_address = -1;
static int hf_u3v_count = -1;
static int hf_u3v_eventcmd_id = -1;
static int hf_u3v_eventcmd_error_id = -1;
static int hf_u3v_eventcmd_device_specific_id = -1;
static int hf_u3v_eventcmd_timestamp = -1;
static int hf_u3v_eventcmd_data = -1;
static int hf_u3v_time_to_completion = -1;
static int hf_u3v_payloaddata = -1;
static int hf_u3v_reserved = -1;

static int hf_u3v_bootstrap_GenCP_Version = -1;
static int hf_u3v_bootstrap_Manufacturer_Name = -1;
static int hf_u3v_bootstrap_Model_Name = -1;
static int hf_u3v_bootstrap_Family_Name = -1;
static int hf_u3v_bootstrap_Device_Version = -1;
static int hf_u3v_bootstrap_Manufacturer_Info = -1;
static int hf_u3v_bootstrap_Serial_Number = -1;
static int hf_u3v_bootstrap_User_Defined_Name = -1;
static int hf_u3v_bootstrap_Device_Capability = -1;
static int hf_u3v_bootstrap_Maximum_Device_Response_Time = -1;
static int hf_u3v_bootstrap_Manifest_Table_Address = -1;
static int hf_u3v_bootstrap_SBRM_Address = -1;
static int hf_u3v_bootstrap_Device_Configuration = -1;
static int hf_u3v_bootstrap_Heartbeat_Timeout = -1;
static int hf_u3v_bootstrap_Message_Channel_channel_id = -1;
static int hf_u3v_bootstrap_Timestamp = -1;
static int hf_u3v_bootstrap_Timestamp_Latch = -1;
static int hf_u3v_bootstrap_Timestamp_Increment = -1;
static int hf_u3v_bootstrap_Access_Privilege = -1;
static int hf_u3v_bootstrap_Protocol_Endianness = -1;
static int hf_u3v_bootstrap_Implementation_Endianness = -1;
static int hf_u3v_bootstrap_U3V_Version = -1;
static int hf_u3v_bootstrap_U3VCP_Capability_Register = -1;
static int hf_u3v_bootstrap_U3VCP_Configuration_Register = -1;
static int hf_u3v_bootstrap_Maximum_Command_Transfer_Length = -1;
static int hf_u3v_bootstrap_Maximum_Acknowledge_Transfer_Length = -1;
static int hf_u3v_bootstrap_Number_of_Stream_Channels = -1;
static int hf_u3v_bootstrap_SIRM_Address = -1;
static int hf_u3v_bootstrap_SIRM_Length = -1;
static int hf_u3v_bootstrap_EIRM_Address = -1;
static int hf_u3v_bootstrap_EIRM_Length = -1;
static int hf_u3v_bootstrap_IIDC2_Address = -1;
static int hf_u3v_bootstrap_Current_Speed = -1;
static int hf_u3v_bootstrap_SI_Info = -1;
static int hf_u3v_bootstrap_SI_Control = -1;
static int hf_u3v_bootstrap_SI_Required_Payload_Size = -1;
static int hf_u3v_bootstrap_SI_Required_Leader_Size = -1;
static int hf_u3v_bootstrap_SI_Required_Trailer_Size = -1;
static int hf_u3v_bootstrap_SI_Maximum_Leader_Size = -1;
static int hf_u3v_bootstrap_SI_Payload_Transfer_Size = -1;
static int hf_u3v_bootstrap_SI_Payload_Transfer_Count = -1;
static int hf_u3v_bootstrap_SI_Payload_Final_Transfer1_Size = -1;
static int hf_u3v_bootstrap_SI_Payload_Final_Transfer2_Size = -1;
static int hf_u3v_bootstrap_SI_Maximum_Trailer_Size = -1;
static int hf_u3v_bootstrap_EI_Control = -1;
static int hf_u3v_bootstrap_Maximum_Event_Transfer_Length = -1;
static int hf_u3v_bootstrap_Event_Test_Control = -1;
static int hf_u3v_custom_memory_addr = -1;
static int hf_u3v_custom_memory_data = -1;

static int hf_u3v_scd_readmem_cmd = -1;
static int hf_u3v_scd_writemem_cmd = -1;
static int hf_u3v_scd_event_cmd = -1;
static int hf_u3v_scd_ack_readmem_ack = -1;
static int hf_u3v_scd_writemem_ack = -1;
static int hf_u3v_ccd_pending_ack = -1;
static int hf_u3v_stream_leader = -1;
static int hf_u3v_stream_trailer = -1;
static int hf_u3v_stream_payload = -1;
static int hf_u3v_ccd_cmd = -1;
static int hf_u3v_ccd_ack = -1;
static int hf_u3v_device_info_descriptor = -1;

/* stream elements */
static int hf_u3v_stream_reserved = -1;
static int hf_u3v_stream_leader_size = -1;

static int hf_u3v_stream_prefix = -1;
static int hf_u3v_stream_trailer_size = -1;

static int hf_u3v_stream_block_id = -1;
static int hf_u3v_stream_payload_type = -1;
static int hf_u3v_stream_status = -1;
static int hf_u3v_stream_valid_payload_size = -1;

static int hf_u3v_stream_timestamp = -1;
static int hf_u3v_stream_pixel_format = -1;
static int hf_u3v_stream_size_x = -1;
static int hf_u3v_stream_size_y = -1;
static int hf_u3v_stream_offset_x = -1;
static int hf_u3v_stream_offset_y = -1;
static int hf_u3v_stream_padding_x = -1;
static int hf_u3v_stream_chunk_layout_id = -1;

static int hf_u3v_stream_data = -1;

/* U3V device info descriptor */
static int hf_u3v_device_info_descriptor_bLength = -1;
static int hf_u3v_device_info_descriptor_bDescriptorType = -1;
static int hf_u3v_device_info_descriptor_bDescriptorSubtype = -1;
static int hf_u3v_device_info_descriptor_bGenCPVersion = -1;
static int hf_u3v_device_info_descriptor_bGenCPVersion_minor = -1;
static int hf_u3v_device_info_descriptor_bGenCPVersion_major = -1;
static int hf_u3v_device_info_descriptor_bU3VVersion = -1;
static int hf_u3v_device_info_descriptor_bU3VVersion_minor = -1;
static int hf_u3v_device_info_descriptor_bU3VVersion_major = -1;
static int hf_u3v_device_info_descriptor_iDeviceGUID = -1;
static int hf_u3v_device_info_descriptor_iVendorName = -1;
static int hf_u3v_device_info_descriptor_iModelName = -1;
static int hf_u3v_device_info_descriptor_iFamilyName = -1;
static int hf_u3v_device_info_descriptor_iDeviceVersion = -1;
static int hf_u3v_device_info_descriptor_iManufacturerInfo = -1;
static int hf_u3v_device_info_descriptor_iSerialNumber = -1;
static int hf_u3v_device_info_descriptor_iUserDefinedName = -1;
static int hf_u3v_device_info_descriptor_bmSpeedSupport = -1;
static int hf_u3v_device_info_descriptor_bmSpeedSupport_low_speed = -1;
static int hf_u3v_device_info_descriptor_bmSpeedSupport_full_speed = -1;
static int hf_u3v_device_info_descriptor_bmSpeedSupport_high_speed = -1;
static int hf_u3v_device_info_descriptor_bmSpeedSupport_super_speed = -1;
static int hf_u3v_device_info_descriptor_bmSpeedSupport_reserved = -1;

/*Define the tree for u3v*/
static int ett_u3v = -1;
static int ett_u3v_cmd = -1;
static int ett_u3v_flags = -1;
static int ett_u3v_ack = -1;
static int ett_u3v_payload_cmd = -1;
static int ett_u3v_payload_ack = -1;
static int ett_u3v_payload_cmd_subtree = -1;
static int ett_u3v_payload_ack_subtree = -1;
static int ett_u3v_bootstrap_fields = -1;
static int ett_u3v_stream_leader = -1;
static int ett_u3v_stream_trailer = -1;
static int ett_u3v_stream_payload = -1;

static int ett_u3v_device_info_descriptor = -1;
static int ett_u3v_device_info_descriptor_speed_support = -1;
static int ett_u3v_device_info_descriptor_gencp_version = -1;
static int ett_u3v_device_info_descriptor_u3v_version = -1;

static dissector_handle_t u3v_handle = NULL;

static const value_string command_names[] =
{
    { U3V_READMEM_CMD, "READMEM_CMD" },
    { U3V_WRITEMEM_CMD, "WRITEMEM_CMD" },
    { U3V_EVENT_CMD, "EVENT_CMD" },
    { U3V_READMEM_ACK, "READMEM_ACK" },
    { U3V_WRITEMEM_ACK, "WRITEMEM_ACK" },
    { U3V_PENDING_ACK, "PENDING_ACK" },
    { U3V_EVENT_ACK, "EVENT_ACK" },
    { 0, NULL }
};

static const value_string event_id_names[] =
{
    { U3V_EVENT_TESTEVENT, "U3V_EVENT_TESTEVENT" },
    { 0, NULL }
};

static const value_string status_names[] =
{
    { U3V_STATUS_GENCP_SUCCESS, "U3V_STATUS_GENCP_SUCCESS" },
    { U3V_STATUS_GENCP_NOT_IMPLEMENTED, "U3V_STATUS_GENCP_NOT_IMPLEMENTED" },
    { U3V_STATUS_GENCP_INVALID_PARAMETER, "U3V_STATUS_GENCP_INVALID_PARAMETER" },
    { U3V_STATUS_GENCP_INVALID_ADDRESS, "U3V_STATUS_GENCP_INVALID_ADDRESS" },
    { U3V_STATUS_GENCP_WRITE_PROTECT, "U3V_STATUS_GENCP_WRITE_PROTECT" },
    { U3V_STATUS_GENCP_BAD_ALIGNMENT, "U3V_STATUS_GENCP_BAD_ALIGNMENT" },
    { U3V_STATUS_GENCP_ACCESS_DENIED, "U3V_STATUS_GENCP_ACCESS_DENIED" },
    { U3V_STATUS_GENCP_BUSY, "U3V_STATUS_GENCP_BUSY" },
    { U3V_STATUS_GENCP_WRONG_CONFIG, "U3V_STATUS_GENCP_WRONG_CONFIG" },
    { U3V_STATUS_RESEND_NOT_SUPPORTED, "U3V_STATUS_RESEND_NOT_SUPPORTED" },
    { U3V_STATUS_DSI_ENDPOINT_HALTED, "U3V_STATUS_DSI_ENDPOINT_HALTED" },
    { U3V_STATUS_SI_PAYLOAD_SIZE_NOT_ALIGNED, "U3V_STATUS_SI_PAYLOAD_SIZE_NOT_ALIGNED" },
    { U3V_STATUS_SI_REGISTERS_INCONSISTENT, "U3V_STATUS_SI_REGISTERS_INCONSISTENT" },
    { U3V_STATUS_DATA_DISCARDED, "U3V_STATUS_DATA_DISCARDED" },
    { U3V_STATUS_DATA_OVERRUN, "U3V_STATUS_DATA_OVERRUN" },
    { 0, NULL }
};

static const value_string status_names_short[] =
{
    { U3V_STATUS_GENCP_SUCCESS, "" },
    { U3V_STATUS_GENCP_NOT_IMPLEMENTED, "U3V_STATUS_GENCP_NOT_IMPLEMENTED" },
    { U3V_STATUS_GENCP_INVALID_PARAMETER, "U3V_STATUS_GENCP_INVALID_PARAMETER" },
    { U3V_STATUS_GENCP_INVALID_ADDRESS, "U3V_STATUS_GENCP_INVALID_ADDRESS" },
    { U3V_STATUS_GENCP_WRITE_PROTECT, "U3V_STATUS_GENCP_WRITE_PROTECT" },
    { U3V_STATUS_GENCP_BAD_ALIGNMENT, "U3V_STATUS_GENCP_BAD_ALIGNMENT" },
    { U3V_STATUS_GENCP_ACCESS_DENIED, "U3V_STATUS_GENCP_ACCESS_DENIED" },
    { U3V_STATUS_GENCP_BUSY, "U3V_STATUS_GENCP_BUSY" },
    { U3V_STATUS_GENCP_WRONG_CONFIG, "U3V_STATUS_GENCP_WRONG_CONFIG" },
    { U3V_STATUS_RESEND_NOT_SUPPORTED, "U3V_STATUS_RESEND_NOT_SUPPORTED" },
    { U3V_STATUS_DSI_ENDPOINT_HALTED, "U3V_STATUS_DSI_ENDPOINT_HALTED" },
    { U3V_STATUS_SI_PAYLOAD_SIZE_NOT_ALIGNED, "U3V_STATUS_SI_PAYLOAD_SIZE_NOT_ALIGNED" },
    { U3V_STATUS_SI_REGISTERS_INCONSISTENT, "U3V_STATUS_SI_REGISTERS_INCONSISTENT" },
    { U3V_STATUS_DATA_DISCARDED, "U3V_STATUS_DATA_DISCARDED" },
    { U3V_STATUS_DATA_OVERRUN, "U3V_STATUS_DATA_OVERRUN" },
    { 0, NULL }
};

/*
 \brief Register name to address mappings
 */
static const value_string bootstrap_register_names_abrm[] =
{
    { U3V_ABRM_GENCP_VERSION, "[GenCP_Version]" },
    { U3V_ABRM_MANUFACTURER_NAME, "[Manufacturer_Name]" },
    { U3V_ABRM_MODEL_NAME, "[Model_Name]" },
    { U3V_ABRM_FAMILY_NAME, "[Family_Name]" },
    { U3V_ABRM_DEVICE_VERSION, "[Device_Version]" },
    { U3V_ABRM_MANUFACTURER_INFO, "[Manufacturer_Info]" },
    { U3V_ABRM_SERIAL_NUMBER, "[Serial_Number]" },
    { U3V_ABRM_USER_DEFINED_NAME, "[User_Defined_Name]" },
    { U3V_ABRM_DEVICE_CAPABILITY, "[Device_Capability]" },
    { U3V_ABRM_MAXIMUM_DEVICE_RESPONSE_TIME, "[Maximum_Device_Response_Time]" },
    { U3V_ABRM_MANIFEST_TABLE_ADDRESS, "[Manifest_Table_Address]" },
    { U3V_ABRM_SBRM_ADDRESS, "[SBRM_Address]" },
    { U3V_ABRM_DEVICE_CONFIGURATION, "[Device_Configuration]" },
    { U3V_ABRM_HEARTBEAT_TIMEOUT, "[Heartbeat_Timeout]" },
    { U3V_ABRM_MESSAGE_CHANNEL_CHANNEL_ID, "[Message_Channel_channel_id]" },
    { U3V_ABRM_TIMESTAMP, "[Timestamp]" },
    { U3V_ABRM_TIMESTAMP_LATCH, "[Timestamp_Latch]" },
    { U3V_ABRM_TIMESTAMP_INCREMENT, "[Timestamp_Increment]" },
    { U3V_ABRM_ACCESS_PRIVILEGE, "[Access_Privilege]" },
    { U3V_ABRM_PROTOCOL_ENDIANNESS, "[Protocol_Endianness]" },
    { U3V_ABRM_IMPLEMENTATION_ENDIANNESS, "[Implementation_Endianness]" },
    { 0, NULL }
};

static const value_string bootstrap_register_names_sbrm[] =
{
    { U3V_SBRM_U3V_VERSION, "[U3V_Version]" },
    { U3V_SBRM_U3VCP_CAPABILITY_REGISTER, "[U3VCP_Capability_Register]" },
    { U3V_SBRM_U3VCP_CONFIGURATION_REGISTER, "[U3VCP_Configuration_Register]" },
    { U3V_SBRM_MAXIMUM_COMMAND_TRANSFER_LENGTH, "[Maximum_Command_Transfer_Length]" },
    { U3V_SBRM_MAXIMUM_ACKNOWLEDGE_TRANSFER_LENGTH, "[Maximum_Acknowledge_Transfer_Length]" },
    { U3V_SBRM_NUMBER_OF_STREAM_CHANNELS, "[Number_of_Stream_Channels]" },
    { U3V_SBRM_SIRM_ADDRESS, "[SIRM_Address]" },
    { U3V_SBRM_SIRM_LENGTH, "[SIRM_Length]" },
    { U3V_SBRM_EIRM_ADDRESS, "[EIRM_Address]" },
    { U3V_SBRM_EIRM_LENGTH, "[EIRM_Length]" },
    { U3V_SBRM_IIDC2_ADDRESS, "[IIDC2_Address]" },
    { U3V_SBRM_CURRENT_SPEED, "[Current_Speed]" },
    { 0, NULL }
};

static const value_string bootstrap_register_names_sirm[] =
{
    { U3V_SIRM_SI_INFO, "[SI_Info]" },
    { U3V_SIRM_SI_CONTROL, "[SI_Control]" },
    { U3V_SIRM_SI_REQUIRED_PAYLOAD_SIZE, "[SI_Required_Payload_Size]" },
    { U3V_SIRM_SI_REQUIRED_LEADER_SIZE, "[SI_Required_Leader_Size]" },
    { U3V_SIRM_SI_REQUIRED_TRAILER_SIZE, "[SI_Required_Trailer_Size]" },
    { U3V_SIRM_SI_MAXIMUM_LEADER_SIZE, "[SI_Maximum_Leader_Size]" },
    { U3V_SIRM_SI_PAYLOAD_TRANSFER_SIZE, "[SI_Payload_Transfer_Size]" },
    { U3V_SIRM_SI_PAYLOAD_TRANSFER_COUNT, "[SI_Payload_Transfer_Count]" },
    { U3V_SIRM_SI_PAYLOAD_FINAL_TRANSFER1_SIZE, "[SI_Payload_Final_Transfer1_Size]" },
    { U3V_SIRM_SI_PAYLOAD_FINAL_TRANSFER2_SIZE, "[SI_Payload_Final_Transfer2_Size]" },
    { U3V_SIRM_SI_MAXIMUM_TRAILER_SIZE, "[SI_Maximum_Trailer_Size]" },
    { 0, NULL }
};

static const value_string bootstrap_register_names_eirm[] =
{
    { U3V_EIRM_EI_CONTROL, "[EI_Control]" },
    { U3V_EIRM_MAXIMUM_EVENT_TRANSFER_LENGTH, "[Maximum_Event_Transfer_Length]" },
    { U3V_EIRM_EVENT_TEST_CONTROL, "[Event_Test_Control]" },
    { 0, NULL }
};

static const value_string pixel_format_names[] =
{
    { PFNC_U3V_MONO1P, "Mono1p (Monochrome 1-bit packed)" },
    { PFNC_U3V_CONFIDENCE1P, "Confidence1p (Confidence 1-bit packed)" },
    { PFNC_U3V_MONO2P, "Mono2p (Monochrome 2-bit packed)" },
    { PFNC_U3V_MONO4P, "Mono4p (Monochrome 4-bit packed)" },
    { PFNC_U3V_BAYERGR4P, "BayerGR4p (Bayer Green-Red 4-bit packed)" },
    { PFNC_U3V_BAYERRG4P, "BayerRG4p (Bayer Red-Green 4-bit packed)" },
    { PFNC_U3V_BAYERGB4P, "BayerGB4p (Bayer Green-Blue 4-bit packed)" },
    { PFNC_U3V_BAYERBG4P, "BayerBG4p (Bayer Blue-Green 4-bit packed)" },
    { PFNC_U3V_MONO8, "Mono8 (Monochrome 8-bit)" },
    { PFNC_U3V_MONO8S, "Mono8s (Monochrome 8-bit signed)" },
    { PFNC_U3V_BAYERGR8, "BayerGR8 (Bayer Green-Red 8-bit)" },
    { PFNC_U3V_BAYERRG8, "BayerRG8 (Bayer Red-Green 8-bit)" },
    { PFNC_U3V_BAYERGB8, "BayerGB8 (Bayer Green-Blue 8-bit)" },
    { PFNC_U3V_BAYERBG8, "BayerBG8 (Bayer Blue-Green 8-bit)" },
    { PFNC_U3V_SCF1WBWG8, "SCF1WBWG8 (Sparse Color Filter #1 White-Blue-White-Green 8-bit)" },
    { PFNC_U3V_SCF1WGWB8, "SCF1WGWB8 (Sparse Color Filter #1 White-Green-White-Blue 8-bit)" },
    { PFNC_U3V_SCF1WGWR8, "SCF1WGWR8 (Sparse Color Filter #1 White-Green-White-Red 8-bit)" },
    { PFNC_U3V_SCF1WRWG8, "SCF1WRWG8 (Sparse Color Filter #1 White-Red-White-Green 8-bit)" },
    { PFNC_U3V_COORD3D_A8, "Coord3D_A8 (3D coordinate A 8-bit)" },
    { PFNC_U3V_COORD3D_B8, "Coord3D_B8 (3D coordinate B 8-bit)" },
    { PFNC_U3V_COORD3D_C8, "Coord3D_C8 (3D coordinate C 8-bit)" },
    { PFNC_U3V_CONFIDENCE1, "Confidence1 (Confidence 1-bit unpacked)" },
    { PFNC_U3V_CONFIDENCE8, "Confidence8 (Confidence 8-bit)" },
    { PFNC_U3V_R8, "R8 (Red 8-bit)" },
    { PFNC_U3V_G8, "G8 (Green 8-bit)" },
    { PFNC_U3V_B8, "B8 (Blue 8-bit)" },
    { PFNC_U3V_DATA8, "Data8 (Data 8-bit)" },
    { PFNC_U3V_DATA8S, "Data8s (Data 8-bit signed)" },
    { PFNC_U3V_MONO10P, "Mono10p (Monochrome 10-bit packed)" },
    { PFNC_U3V_BAYERBG10P, "BayerBG10p (Bayer Blue-Green 10-bit packed)" },
    { PFNC_U3V_BAYERGB10P, "BayerGB10p (Bayer Green-Blue 10-bit packed)" },
    { PFNC_U3V_BAYERGR10P, "BayerGR10p (Bayer Green-Red 10-bit packed)" },
    { PFNC_U3V_BAYERRG10P, "BayerRG10p (Bayer Red-Green 10-bit packed)" },
    { PFNC_U3V_SCF1WBWG10P, "SCF1WBWG10p (Sparse Color Filter #1 White-Blue-White-Green 10-bit packed)" },
    { PFNC_U3V_SCF1WGWB10P, "SCF1WGWB10p (Sparse Color Filter #1 White-Green-White-Blue 10-bit packed)" },
    { PFNC_U3V_SCF1WGWR10P, "SCF1WGWR10p (Sparse Color Filter #1 White-Green-White-Red 10-bit packed)" },
    { PFNC_U3V_SCF1WRWG10P, "SCF1WRWG10p (Sparse Color Filter #1 White-Red-White-Green 10-bit packed)" },
    { PFNC_U3V_R10_DEPRECATED, "R10_Deprecated (Deprecated because size field is wrong)" },
    { PFNC_U3V_G10_DEPRECATED, "G10_Deprecated (Deprecated because size field is wrong)" },
    { PFNC_U3V_B10_DEPRECATED, "B10_Deprecated (Deprecated because size field is wrong)" },
    { PFNC_U3V_COORD3D_A10P, "Coord3D_A10p (3D coordinate A 10-bit packed)" },
    { PFNC_U3V_COORD3D_B10P, "Coord3D_B10p (3D coordinate B 10-bit packed)" },
    { PFNC_U3V_COORD3D_C10P, "Coord3D_C10p (3D coordinate C 10-bit packed)" },
    { GVSP_MONO10PACKED, "GVSP_Mono10Packed (GigE Vision specific format, Monochrome 10-bit packed)" },
    { GVSP_MONO12PACKED, "GVSP_Mono12Packed (GigE Vision specific format, Monochrome 12-bit packed)" },
    { GVSP_BAYERGR10PACKED, "GVSP_BayerGR10Packed (GigE Vision specific format, Bayer Green-Red 10-bit packed)" },
    { GVSP_BAYERRG10PACKED, "GVSP_BayerRG10Packed (GigE Vision specific format, Bayer Red-Green 10-bit packed)" },
    { GVSP_BAYERGB10PACKED, "GVSP_BayerGB10Packed (GigE Vision specific format, Bayer Green-Blue 10-bit packed)" },
    { GVSP_BAYERBG10PACKED, "GVSP_BayerBG10Packed (GigE Vision specific format, Bayer Blue-Green 10-bit packed)" },
    { GVSP_BAYERGR12PACKED, "GVSP_BayerGR12Packed (GigE Vision specific format, Bayer Green-Red 12-bit packed)" },
    { GVSP_BAYERRG12PACKED, "GVSP_BayerRG12Packed (GigE Vision specific format, Bayer Red-Green 12-bit packed)" },
    { GVSP_BAYERGB12PACKED, "GVSP_BayerGB12Packed (GigE Vision specific format, Bayer Green-Blue 12-bit packed)" },
    { GVSP_BAYERBG12PACKED, "GVSP_BayerBG12Packed (GigE Vision specific format, Bayer Blue-Green 12-bit packed)" },
    { PFNC_U3V_MONO12P, "Mono12p (Monochrome 12-bit packed)" },
    { PFNC_U3V_BAYERBG12P, "BayerBG12p (Bayer Blue-Green 12-bit packed)" },
    { PFNC_U3V_BAYERGB12P, "BayerGB12p (Bayer Green-Blue 12-bit packed)" },
    { PFNC_U3V_BAYERGR12P, "BayerGR12p (Bayer Green-Red 12-bit packed)" },
    { PFNC_U3V_BAYERRG12P, "BayerRG12p (Bayer Red-Green 12-bit packed)" },
    { PFNC_U3V_SCF1WBWG12P, "SCF1WBWG12p (Sparse Color Filter #1 White-Blue-White-Green 12-bit packed)" },
    { PFNC_U3V_SCF1WGWB12P, "SCF1WGWB12p (Sparse Color Filter #1 White-Green-White-Blue 12-bit packed)" },
    { PFNC_U3V_SCF1WGWR12P, "SCF1WGWR12p (Sparse Color Filter #1 White-Green-White-Red 12-bit packed)" },
    { PFNC_U3V_SCF1WRWG12P, "SCF1WRWG12p (Sparse Color Filter #1 White-Red-White-Green 12-bit packed)" },
    { PFNC_U3V_R12_DEPRECATED, "R12_Deprecated (Deprecated because size field is wrong)" },
    { PFNC_U3V_G12_DEPRECATED, "G12_Deprecated (Deprecated because size field is wrong)" },
    { PFNC_U3V_B12_DEPRECATED, "B12_Deprecated (Deprecated because size field is wrong)" },
    { PFNC_U3V_COORD3D_A12P, "Coord3D_A12p (3D coordinate A 12-bit packed)" },
    { PFNC_U3V_COORD3D_B12P, "Coord3D_B12p (3D coordinate B 12-bit packed)" },
    { PFNC_U3V_COORD3D_C12P, "Coord3D_C12p (3D coordinate C 12-bit packed)" },
    { PFNC_U3V_MONO14P, "Mono14p (Monochrome 14-bit packed)" },
    { PFNC_U3V_BAYERGR14P, "BayerGR14p (Bayer Green-Red 14-bit packed)" },
    { PFNC_U3V_BAYERRG14P, "BayerRG14p (Bayer Red-Green 14-bit packed)" },
    { PFNC_U3V_BAYERGB14P, "BayerGB14p (Bayer Green-Blue 14-bit packed)" },
    { PFNC_U3V_BAYERBG14P, "BayerBG14p (Bayer Blue-Green 14-bit packed)" },
    { PFNC_U3V_MONO10, "Mono10 (Monochrome 10-bit unpacked)" },
    { PFNC_U3V_MONO12, "Mono12 (Monochrome 12-bit unpacked)" },
    { PFNC_U3V_MONO16, "Mono16 (Monochrome 16-bit)" },
    { PFNC_U3V_BAYERGR10, "BayerGR10 (Bayer Green-Red 10-bit unpacked)" },
    { PFNC_U3V_BAYERRG10, "BayerRG10 (Bayer Red-Green 10-bit unpacked)" },
    { PFNC_U3V_BAYERGB10, "BayerGB10 (Bayer Green-Blue 10-bit unpacked)" },
    { PFNC_U3V_BAYERBG10, "BayerBG10 (Bayer Blue-Green 10-bit unpacked)" },
    { PFNC_U3V_BAYERGR12, "BayerGR12 (Bayer Green-Red 12-bit unpacked)" },
    { PFNC_U3V_BAYERRG12, "BayerRG12 (Bayer Red-Green 12-bit unpacked)" },
    { PFNC_U3V_BAYERGB12, "BayerGB12 (Bayer Green-Blue 12-bit unpacked)" },
    { PFNC_U3V_BAYERBG12, "BayerBG12 (Bayer Blue-Green 12-bit unpacked)" },
    { PFNC_U3V_MONO14, "Mono14 (Monochrome 14-bit unpacked)" },
    { PFNC_U3V_BAYERGR16, "BayerGR16 (Bayer Green-Red 16-bit)" },
    { PFNC_U3V_BAYERRG16, "BayerRG16 (Bayer Red-Green 16-bit)" },
    { PFNC_U3V_BAYERGB16, "BayerGB16 (Bayer Green-Blue 16-bit)" },
    { PFNC_U3V_BAYERBG16, "BayerBG16 (Bayer Blue-Green 16-bit)" },
    { PFNC_U3V_SCF1WBWG10, "SCF1WBWG10 (Sparse Color Filter #1 White-Blue-White-Green 10-bit unpacked)" },
    { PFNC_U3V_SCF1WBWG12, "SCF1WBWG12 (Sparse Color Filter #1 White-Blue-White-Green 12-bit unpacked)" },
    { PFNC_U3V_SCF1WBWG14, "SCF1WBWG14 (Sparse Color Filter #1 White-Blue-White-Green 14-bit unpacked)" },
    { PFNC_U3V_SCF1WBWG16, "SCF1WBWG16 (Sparse Color Filter #1 White-Blue-White-Green 16-bit unpacked)" },
    { PFNC_U3V_SCF1WGWB10, "SCF1WGWB10 (Sparse Color Filter #1 White-Green-White-Blue 10-bit unpacked)" },
    { PFNC_U3V_SCF1WGWB12, "SCF1WGWB12 (Sparse Color Filter #1 White-Green-White-Blue 12-bit unpacked)" },
    { PFNC_U3V_SCF1WGWB14, "SCF1WGWB14 (Sparse Color Filter #1 White-Green-White-Blue 14-bit unpacked)" },
    { PFNC_U3V_SCF1WGWB16, "SCF1WGWB16 (Sparse Color Filter #1 White-Green-White-Blue 16-bit)" },
    { PFNC_U3V_SCF1WGWR10, "SCF1WGWR10 (Sparse Color Filter #1 White-Green-White-Red 10-bit unpacked)" },
    { PFNC_U3V_SCF1WGWR12, "SCF1WGWR12 (Sparse Color Filter #1 White-Green-White-Red 12-bit unpacked)" },
    { PFNC_U3V_SCF1WGWR14, "SCF1WGWR14 (Sparse Color Filter #1 White-Green-White-Red 14-bit unpacked)" },
    { PFNC_U3V_SCF1WGWR16, "SCF1WGWR16 (Sparse Color Filter #1 White-Green-White-Red 16-bit)" },
    { PFNC_U3V_SCF1WRWG10, "SCF1WRWG10 (Sparse Color Filter #1 White-Red-White-Green 10-bit unpacked)" },
    { PFNC_U3V_SCF1WRWG12, "SCF1WRWG12 (Sparse Color Filter #1 White-Red-White-Green 12-bit unpacked)" },
    { PFNC_U3V_SCF1WRWG14, "SCF1WRWG14 (Sparse Color Filter #1 White-Red-White-Green 14-bit unpacked)" },
    { PFNC_U3V_SCF1WRWG16, "SCF1WRWG16 (Sparse Color Filter #1 White-Red-White-Green 16-bit)" },
    { PFNC_U3V_COORD3D_A16, "Coord3D_A16 (3D coordinate A 16-bit)" },
    { PFNC_U3V_COORD3D_B16, "Coord3D_B16 (3D coordinate B 16-bit)" },
    { PFNC_U3V_COORD3D_C16, "Coord3D_C16 (3D coordinate C 16-bit)" },
    { PFNC_U3V_CONFIDENCE16, "Confidence16 (Confidence 16-bit)" },
    { PFNC_U3V_R16, "R16 (Red 16-bit)" },
    { PFNC_U3V_G16, "G16 (Green 16-bit)" },
    { PFNC_U3V_B16, "B16 (Blue 16-bit)" },
    { PFNC_U3V_BAYERGR14, "BayerGR14 (Bayer Green-Red 14-bit)" },
    { PFNC_U3V_BAYERRG14, "BayerRG14 (Bayer Red-Green 14-bit)" },
    { PFNC_U3V_BAYERGB14, "BayerGB14 (Bayer Green-Blue 14-bit)" },
    { PFNC_U3V_BAYERBG14, "BayerBG14 (Bayer Blue-Green 14-bit)" },
    { PFNC_U3V_DATA16, "Data16 (Data 16-bit)" },
    { PFNC_U3V_DATA16S, "Data16s (Data 16-bit signed)" },
    { PFNC_U3V_R10, "R10 (Red 10-bit)" },
    { PFNC_U3V_R12, "R12 (Red 12-bit)" },
    { PFNC_U3V_G10, "G10 (Green 10-bit)" },
    { PFNC_U3V_G12, "G12 (Green 12-bit)" },
    { PFNC_U3V_B10, "B10 (Blue 10-bit)" },
    { PFNC_U3V_B12, "B12 (Blue 12-bit)" },
    { PFNC_U3V_COORD3D_A32F, "Coord3D_A32f (3D coordinate A 32-bit floating point)" },
    { PFNC_U3V_COORD3D_B32F, "Coord3D_B32f (3D coordinate B 32-bit floating point)" },
    { PFNC_U3V_COORD3D_C32F, "Coord3D_C32f (3D coordinate C 32-bit floating point)" },
    { PFNC_U3V_CONFIDENCE32F, "Confidence32f (Confidence 32-bit floating point)" },
    { PFNC_U3V_MONO32, "Mono32 (Monochrome 32-bit)" },
    { PFNC_U3V_DATA32, "Data32 (Data 32-bit)" },
    { PFNC_U3V_DATA32S, "Data32s (Data 32-bit signed)" },
    { PFNC_U3V_DATA32F, "Data32f (Data 32-bit floating point)" },
    { PFNC_U3V_DATA64, "Data64 (Data 64-bit)" },
    { PFNC_U3V_DATA64S, "Data64s (Data 64-bit signed)" },
    { PFNC_U3V_DATA64F, "Data64f (Data 64-bit floating point)" },
    { PFNC_U3V_YUV411_8_UYYVYY, "YUV411_8_UYYVYY (YUV 4:1:1 8-bit)" },
    { PFNC_U3V_YCBCR411_8_CBYYCRYY, "YCbCr411_8_CbYYCrYY (YCbCr 4:1:1 8-bit)" },
    { PFNC_U3V_YCBCR601_411_8_CBYYCRYY, "YCbCr601_411_8_CbYYCrYY (YCbCr 4:1:1 8-bit BT.601)" },
    { PFNC_U3V_YCBCR709_411_8_CBYYCRYY, "YCbCr709_411_8_CbYYCrYY (YCbCr 4:1:1 8-bit BT.709)" },
    { PFNC_U3V_YCBCR411_8, "YCbCr411_8 (YCbCr 4:1:1 8-bit)" },
    { PFNC_U3V_YCBCR2020_411_8_CBYYCRYY, "YCbCr2020_411_8_CbYYCrYY (YCbCr 4:1:1 8-bit BT.2020)" },
    { PFNC_U3V_YCBCR420_8_YY_CBCR_SEMIPLANAR, "YCbCr420_8_YY_CbCr_Semiplanar (YCbCr 4:2:0 8-bit YY/CbCr Semiplanar)" },
    { PFNC_U3V_YCBCR420_8_YY_CRCB_SEMIPLANAR, "YCbCr420_8_YY_CrCb_Semiplanar (YCbCr 4:2:0 8-bit YY/CrCb Semiplanar)" },
    { PFNC_U3V_YUV422_8_UYVY, "YUV422_8_UYVY (YUV 4:2:2 8-bit)" },
    { PFNC_U3V_YUV422_8, "YUV422_8 (YUV 4:2:2 8-bit)" },
    { PFNC_U3V_RGB565P, "RGB565p (Red-Green-Blue 5/6/5-bit packed)" },
    { PFNC_U3V_BGR565P, "BGR565p (Blue-Green-Red 5/6/5-bit packed)" },
    { PFNC_U3V_YCBCR422_8, "YCbCr422_8 (YCbCr 4:2:2 8-bit)" },
    { PFNC_U3V_YCBCR601_422_8, "YCbCr601_422_8 (YCbCr 4:2:2 8-bit BT.601)" },
    { PFNC_U3V_YCBCR709_422_8, "YCbCr709_422_8 (YCbCr 4:2:2 8-bit BT.709)" },
    { PFNC_U3V_YCBCR422_8_CBYCRY, "YCbCr422_8_CbYCrY (YCbCr 4:2:2 8-bit)" },
    { PFNC_U3V_YCBCR601_422_8_CBYCRY, "YCbCr601_422_8_CbYCrY (YCbCr 4:2:2 8-bit BT.601)" },
    { PFNC_U3V_YCBCR709_422_8_CBYCRY, "YCbCr709_422_8_CbYCrY (YCbCr 4:2:2 8-bit BT.709)" },
    { PFNC_U3V_BICOLORRGBG8, "BiColorRGBG8 (Bi-color Red/Green - Blue/Green 8-bit)" },
    { PFNC_U3V_BICOLORBGRG8, "BiColorBGRG8 (Bi-color Blue/Green - Red/Green 8-bit)" },
    { PFNC_U3V_COORD3D_AC8, "Coord3D_AC8 (3D coordinate A-C 8-bit)" },
    { PFNC_U3V_COORD3D_AC8_PLANAR, "Coord3D_AC8_Planar (3D coordinate A-C 8-bit planar)" },
    { PFNC_U3V_YCBCR2020_422_8, "YCbCr2020_422_8 (YCbCr 4:2:2 8-bit BT.2020)" },
    { PFNC_U3V_YCBCR2020_422_8_CBYCRY, "YCbCr2020_422_8_CbYCrY (YCbCr 4:2:2 8-bit BT.2020)" },
    { PFNC_U3V_YCBCR422_8_YY_CBCR_SEMIPLANAR, "YCbCr422_8_YY_CbCr_Semiplanar (YCbCr 4:2:2 8-bit YY/CbCr Semiplanar)" },
    { PFNC_U3V_YCBCR422_8_YY_CRCB_SEMIPLANAR, "YCbCr422_8_YY_CrCb_Semiplanar (YCbCr 4:2:2 8-bit YY/CrCb Semiplanar)" },
    { PFNC_U3V_YCBCR422_10P, "YCbCr422_10p (YCbCr 4:2:2 10-bit packed)" },
    { PFNC_U3V_YCBCR601_422_10P, "YCbCr601_422_10p (YCbCr 4:2:2 10-bit packed BT.601)" },
    { PFNC_U3V_YCBCR709_422_10P, "YCbCr709_422_10p (YCbCr 4:2:2 10-bit packed BT.709)" },
    { PFNC_U3V_YCBCR422_10P_CBYCRY, "YCbCr422_10p_CbYCrY (YCbCr 4:2:2 10-bit packed)" },
    { PFNC_U3V_YCBCR601_422_10P_CBYCRY, "YCbCr601_422_10p_CbYCrY (YCbCr 4:2:2 10-bit packed BT.601)" },
    { PFNC_U3V_YCBCR709_422_10P_CBYCRY, "YCbCr709_422_10p_CbYCrY (YCbCr 4:2:2 10-bit packed BT.709)" },
    { PFNC_U3V_BICOLORRGBG10P, "BiColorRGBG10p (Bi-color Red/Green - Blue/Green 10-bit packed)" },
    { PFNC_U3V_BICOLORBGRG10P, "BiColorBGRG10p (Bi-color Blue/Green - Red/Green 10-bit packed)" },
    { PFNC_U3V_COORD3D_AC10P, "Coord3D_AC10p (3D coordinate A-C 10-bit packed)" },
    { PFNC_U3V_COORD3D_AC10P_PLANAR, "Coord3D_AC10p_Planar (3D coordinate A-C 10-bit packed planar)" },
    { PFNC_U3V_YCBCR2020_422_10P, "YCbCr2020_422_10p (YCbCr 4:2:2 10-bit packed BT.2020)" },
    { PFNC_U3V_YCBCR2020_422_10P_CBYCRY, "YCbCr2020_422_10p_CbYCrY (YCbCr 4:2:2 10-bit packed BT.2020)" },
    { PFNC_U3V_RGB8, "RGB8 (Red-Green-Blue 8-bit)" },
    { PFNC_U3V_BGR8, "BGR8 (Blue-Green-Red 8-bit)" },
    { PFNC_U3V_YUV8_UYV, "YUV8_UYV (YUV 4:4:4 8-bit)" },
    { PFNC_U3V_RGB8_PLANAR, "RGB8_Planar (Red-Green-Blue 8-bit planar)" },
    { PFNC_U3V_YCBCR8_CBYCR, "YCbCr8_CbYCr (YCbCr 4:4:4 8-bit)" },
    { PFNC_U3V_YCBCR601_8_CBYCR, "YCbCr601_8_CbYCr (YCbCr 4:4:4 8-bit BT.601)" },
    { PFNC_U3V_YCBCR709_8_CBYCR, "YCbCr709_8_CbYCr (YCbCr 4:4:4 8-bit BT.709)" },
    { PFNC_U3V_YCBCR8, "YCbCr8 (YCbCr 4:4:4 8-bit)" },
    { PFNC_U3V_YCBCR422_12P, "YCbCr422_12p (YCbCr 4:2:2 12-bit packed)" },
    { PFNC_U3V_YCBCR601_422_12P, "YCbCr601_422_12p (YCbCr 4:2:2 12-bit packed BT.601)" },
    { PFNC_U3V_YCBCR709_422_12P, "YCbCr709_422_12p (YCbCr 4:2:2 12-bit packed BT.709)" },
    { PFNC_U3V_YCBCR422_12P_CBYCRY, "YCbCr422_12p_CbYCrY (YCbCr 4:2:2 12-bit packed)" },
    { PFNC_U3V_YCBCR601_422_12P_CBYCRY, "YCbCr601_422_12p_CbYCrY (YCbCr 4:2:2 12-bit packed BT.601)" },
    { PFNC_U3V_YCBCR709_422_12P_CBYCRY, "YCbCr709_422_12p_CbYCrY (YCbCr 4:2:2 12-bit packed BT.709)" },
    { PFNC_U3V_BICOLORRGBG12P, "BiColorRGBG12p (Bi-color Red/Green - Blue/Green 12-bit packed)" },
    { PFNC_U3V_BICOLORBGRG12P, "BiColorBGRG12p (Bi-color Blue/Green - Red/Green 12-bit packed)" },
    { PFNC_U3V_COORD3D_ABC8, "Coord3D_ABC8 (3D coordinate A-B-C 8-bit)" },
    { PFNC_U3V_COORD3D_ABC8_PLANAR, "Coord3D_ABC8_Planar (3D coordinate A-B-C 8-bit planar)" },
    { PFNC_U3V_COORD3D_AC12P, "Coord3D_AC12p (3D coordinate A-C 12-bit packed)" },
    { PFNC_U3V_COORD3D_AC12P_PLANAR, "Coord3D_AC12p_Planar (3D coordinate A-C 12-bit packed planar)" },
    { PFNC_U3V_YCBCR2020_8_CBYCR, "YCbCr2020_8_CbYCr (YCbCr 4:4:4 8-bit BT.2020)" },
    { PFNC_U3V_YCBCR2020_422_12P, "YCbCr2020_422_12p (YCbCr 4:2:2 12-bit packed BT.2020)" },
    { PFNC_U3V_YCBCR2020_422_12P_CBYCRY, "YCbCr2020_422_12p_CbYCrY (YCbCr 4:2:2 12-bit packed BT.2020)" },
    { PFNC_U3V_BGR10P, "BGR10p (Blue-Green-Red 10-bit packed)" },
    { PFNC_U3V_RGB10P, "RGB10p (Red-Green-Blue 10-bit packed)" },
    { PFNC_U3V_YCBCR10P_CBYCR, "YCbCr10p_CbYCr (YCbCr 4:4:4 10-bit packed)" },
    { PFNC_U3V_YCBCR601_10P_CBYCR, "YCbCr601_10p_CbYCr (YCbCr 4:4:4 10-bit packed BT.601)" },
    { PFNC_U3V_YCBCR709_10P_CBYCR, "YCbCr709_10p_CbYCr (YCbCr 4:4:4 10-bit packed BT.709)" },
    { PFNC_U3V_COORD3D_ABC10P, "Coord3D_ABC10p (3D coordinate A-B-C 10-bit packed)" },
    { PFNC_U3V_COORD3D_ABC10P_PLANAR, "Coord3D_ABC10p_Planar (3D coordinate A-B-C 10-bit packed planar)" },
    { PFNC_U3V_YCBCR2020_10P_CBYCR, "YCbCr2020_10p_CbYCr (YCbCr 4:4:4 10-bit packed BT.2020)" },
    { PFNC_U3V_RGBA8, "RGBa8 (Red-Green-Blue-alpha 8-bit)" },
    { PFNC_U3V_BGRA8, "BGRa8 (Blue-Green-Red-alpha 8-bit)" },
    { GVSP_RGB10V1PACKED, "GVSP_RGB10V1Packed (GigE Vision specific format, Red-Green-Blue 10-bit packed - variant 1)" },
    { PFNC_U3V_RGB10P32, "RGB10p32 (Red-Green-Blue 10-bit packed into 32-bit)" },
    { PFNC_U3V_YCBCR422_10, "YCbCr422_10 (YCbCr 4:2:2 10-bit unpacked)" },
    { PFNC_U3V_YCBCR422_12, "YCbCr422_12 (YCbCr 4:2:2 12-bit unpacked)" },
    { PFNC_U3V_YCBCR601_422_10, "YCbCr601_422_10 (YCbCr 4:2:2 10-bit unpacked BT.601)" },
    { PFNC_U3V_YCBCR601_422_12, "YCbCr601_422_12 (YCbCr 4:2:2 12-bit unpacked BT.601)" },
    { PFNC_U3V_YCBCR709_422_10, "YCbCr709_422_10 (YCbCr 4:2:2 10-bit unpacked BT.709)" },
    { PFNC_U3V_YCBCR709_422_12, "YCbCr709_422_12 (YCbCr 4:2:2 12-bit unpacked BT.709)" },
    { PFNC_U3V_YCBCR422_10_CBYCRY, "YCbCr422_10_CbYCrY (YCbCr 4:2:2 10-bit unpacked)" },
    { PFNC_U3V_YCBCR422_12_CBYCRY, "YCbCr422_12_CbYCrY (YCbCr 4:2:2 12-bit unpacked)" },
    { PFNC_U3V_YCBCR601_422_10_CBYCRY, "YCbCr601_422_10_CbYCrY (YCbCr 4:2:2 10-bit unpacked BT.601)" },
    { PFNC_U3V_YCBCR601_422_12_CBYCRY, "YCbCr601_422_12_CbYCrY (YCbCr 4:2:2 12-bit unpacked BT.601)" },
    { PFNC_U3V_YCBCR709_422_10_CBYCRY, "YCbCr709_422_10_CbYCrY (YCbCr 4:2:2 10-bit unpacked BT.709)" },
    { PFNC_U3V_YCBCR709_422_12_CBYCRY, "YCbCr709_422_12_CbYCrY (YCbCr 4:2:2 12-bit unpacked BT.709)" },
    { PFNC_U3V_BICOLORRGBG10, "BiColorRGBG10 (Bi-color Red/Green - Blue/Green 10-bit unpacked)" },
    { PFNC_U3V_BICOLORBGRG10, "BiColorBGRG10 (Bi-color Blue/Green - Red/Green 10-bit unpacked)" },
    { PFNC_U3V_BICOLORRGBG12, "BiColorRGBG12 (Bi-color Red/Green - Blue/Green 12-bit unpacked)" },
    { PFNC_U3V_BICOLORBGRG12, "BiColorBGRG12 (Bi-color Blue/Green - Red/Green 12-bit unpacked)" },
    { PFNC_U3V_COORD3D_AC16, "Coord3D_AC16 (3D coordinate A-C 16-bit)" },
    { PFNC_U3V_COORD3D_AC16_PLANAR, "Coord3D_AC16_Planar (3D coordinate A-C 16-bit planar)" },
    { PFNC_U3V_YCBCR2020_422_10, "YCbCr2020_422_10 (YCbCr 4:2:2 10-bit unpacked BT.2020)" },
    { PFNC_U3V_YCBCR2020_422_10_CBYCRY, "YCbCr2020_422_10_CbYCrY (YCbCr 4:2:2 10-bit unpacked BT.2020)" },
    { PFNC_U3V_YCBCR2020_422_12, "YCbCr2020_422_12 (YCbCr 4:2:2 12-bit unpacked BT.2020)" },
    { PFNC_U3V_YCBCR2020_422_12_CBYCRY, "YCbCr2020_422_12_CbYCrY (YCbCr 4:2:2 12-bit unpacked BT.2020)" },
    { GVSP_RGB12V1PACKED, "GVSP_RGB12V1Packed (GigE Vision specific format, Red-Green-Blue 12-bit packed - variant 1)" },
    { PFNC_U3V_BGR12P, "BGR12p (Blue-Green-Red 12-bit packed)" },
    { PFNC_U3V_RGB12P, "RGB12p (Red-Green-Blue 12-bit packed)" },
    { PFNC_U3V_YCBCR12P_CBYCR, "YCbCr12p_CbYCr (YCbCr 4:4:4 12-bit packed)" },
    { PFNC_U3V_YCBCR601_12P_CBYCR, "YCbCr601_12p_CbYCr (YCbCr 4:4:4 12-bit packed BT.601)" },
    { PFNC_U3V_YCBCR709_12P_CBYCR, "YCbCr709_12p_CbYCr (YCbCr 4:4:4 12-bit packed BT.709)" },
    { PFNC_U3V_COORD3D_ABC12P, "Coord3D_ABC12p (3D coordinate A-B-C 12-bit packed)" },
    { PFNC_U3V_COORD3D_ABC12P_PLANAR, "Coord3D_ABC12p_Planar (3D coordinate A-B-C 12-bit packed planar)" },
    { PFNC_U3V_YCBCR2020_12P_CBYCR, "YCbCr2020_12p_CbYCr (YCbCr 4:4:4 12-bit packed BT.2020)" },
    { PFNC_U3V_BGRA10P, "BGRa10p (Blue-Green-Red-alpha 10-bit packed)" },
    { PFNC_U3V_RGBA10P, "RGBa10p (Red-Green-Blue-alpha 10-bit packed)" },
    { PFNC_U3V_RGB10, "RGB10 (Red-Green-Blue 10-bit unpacked)" },
    { PFNC_U3V_BGR10, "BGR10 (Blue-Green-Red 10-bit unpacked)" },
    { PFNC_U3V_RGB12, "RGB12 (Red-Green-Blue 12-bit unpacked)" },
    { PFNC_U3V_BGR12, "BGR12 (Blue-Green-Red 12-bit unpacked)" },
    { PFNC_U3V_RGB10_PLANAR, "RGB10_Planar (Red-Green-Blue 10-bit unpacked planar)" },
    { PFNC_U3V_RGB12_PLANAR, "RGB12_Planar (Red-Green-Blue 12-bit unpacked planar)" },
    { PFNC_U3V_RGB16_PLANAR, "RGB16_Planar (Red-Green-Blue 16-bit planar)" },
    { PFNC_U3V_RGB16, "RGB16 (Red-Green-Blue 16-bit)" },
    { PFNC_U3V_BGR14, "BGR14 (Blue-Green-Red 14-bit unpacked)" },
    { PFNC_U3V_BGR16, "BGR16 (Blue-Green-Red 16-bit)" },
    { PFNC_U3V_BGRA12P, "BGRa12p (Blue-Green-Red-alpha 12-bit packed)" },
    { PFNC_U3V_RGB14, "RGB14 (Red-Green-Blue 14-bit unpacked)" },
    { PFNC_U3V_RGBA12P, "RGBa12p (Red-Green-Blue-alpha 12-bit packed)" },
    { PFNC_U3V_YCBCR10_CBYCR, "YCbCr10_CbYCr (YCbCr 4:4:4 10-bit unpacked)" },
    { PFNC_U3V_YCBCR12_CBYCR, "YCbCr12_CbYCr (YCbCr 4:4:4 12-bit unpacked)" },
    { PFNC_U3V_YCBCR601_10_CBYCR, "YCbCr601_10_CbYCr (YCbCr 4:4:4 10-bit unpacked BT.601)" },
    { PFNC_U3V_YCBCR601_12_CBYCR, "YCbCr601_12_CbYCr (YCbCr 4:4:4 12-bit unpacked BT.601)" },
    { PFNC_U3V_YCBCR709_10_CBYCR, "YCbCr709_10_CbYCr (YCbCr 4:4:4 10-bit unpacked BT.709)" },
    { PFNC_U3V_YCBCR709_12_CBYCR, "YCbCr709_12_CbYCr (YCbCr 4:4:4 12-bit unpacked BT.709)" },
    { PFNC_U3V_COORD3D_ABC16, "Coord3D_ABC16 (3D coordinate A-B-C 16-bit)" },
    { PFNC_U3V_COORD3D_ABC16_PLANAR, "Coord3D_ABC16_Planar (3D coordinate A-B-C 16-bit planar)" },
    { PFNC_U3V_YCBCR2020_10_CBYCR, "YCbCr2020_10_CbYCr (YCbCr 4:4:4 10-bit unpacked BT.2020)" },
    { PFNC_U3V_YCBCR2020_12_CBYCR, "YCbCr2020_12_CbYCr (YCbCr 4:4:4 12-bit unpacked BT.2020)" },
    { PFNC_U3V_BGRA10, "BGRa10 (Blue-Green-Red-alpha 10-bit unpacked)" },
    { PFNC_U3V_BGRA12, "BGRa12 (Blue-Green-Red-alpha 12-bit unpacked)" },
    { PFNC_U3V_BGRA14, "BGRa14 (Blue-Green-Red-alpha 14-bit unpacked)" },
    { PFNC_U3V_BGRA16, "BGRa16 (Blue-Green-Red-alpha 16-bit)" },
    { PFNC_U3V_RGBA10, "RGBa10 (Red-Green-Blue-alpha 10-bit unpacked)" },
    { PFNC_U3V_RGBA12, "RGBa12 (Red-Green-Blue-alpha 12-bit unpacked)" },
    { PFNC_U3V_RGBA14, "RGBa14 (Red-Green-Blue-alpha 14-bit unpacked)" },
    { PFNC_U3V_RGBA16, "RGBa16 (Red-Green-Blue-alpha 16-bit)" },
    { PFNC_U3V_COORD3D_AC32F, "Coord3D_AC32f (3D coordinate A-C 32-bit floating point)" },
    { PFNC_U3V_COORD3D_AC32F_PLANAR, "Coord3D_AC32f_Planar (3D coordinate A-C 32-bit floating point planar)" },
    { PFNC_U3V_COORD3D_ABC32F, "Coord3D_ABC32f (3D coordinate A-B-C 32-bit floating point)" },
    { PFNC_U3V_COORD3D_ABC32F_PLANAR, "Coord3D_ABC32f_Planar (3D coordinate A-B-C 32-bit floating point planar)" },
    { 0, NULL }
};

static value_string_ext pixel_format_names_ext = VALUE_STRING_EXT_INIT(pixel_format_names);

static const value_string payload_type_names[] =
{
    { U3V_STREAM_PAYLOAD_IMAGE, "Image" },
    { U3V_STREAM_PAYLOAD_IMAGE_EXT_CHUNK, "Image Extended Chunk" },
    { U3V_STREAM_PAYLOAD_CHUNK, "Chunk" },
    { 0, NULL }
};

static const value_string u3v_descriptor_subtypes[] =
{
    { DESCRIPTOR_SUBTYPE_U3V_DEVICE_INFO, "U3V DEVICE INFO" },
    { 0, NULL }
};

static int * const speed_support_fields[] = {
    &hf_u3v_device_info_descriptor_bmSpeedSupport_low_speed,
    &hf_u3v_device_info_descriptor_bmSpeedSupport_full_speed,
    &hf_u3v_device_info_descriptor_bmSpeedSupport_high_speed,
    &hf_u3v_device_info_descriptor_bmSpeedSupport_super_speed,
    &hf_u3v_device_info_descriptor_bmSpeedSupport_reserved,
    NULL
};


/*
 \brief Returns a register name based on its address
 */
static const gchar*
get_register_name_from_address(guint64 addr, gboolean* is_custom_register, u3v_conv_info_t * u3v_conv_info)
{
    const gchar* address_string = NULL;
    guint32 offset_address;

    if (is_custom_register != NULL) {
        *is_custom_register = FALSE;
    }

    /* check if this is the access to one of the base address registers */
    if ( addr < 0x10000 ) {
        offset_address = (guint32)addr;
        address_string = try_val_to_str(offset_address, bootstrap_register_names_abrm);
    }
    if ( u3v_conv_info && u3v_conv_info->sbrm_addr != 0 && (addr >= u3v_conv_info->sbrm_addr)) {
        offset_address = (guint32)( addr - u3v_conv_info->sbrm_addr);
        address_string = try_val_to_str(offset_address, bootstrap_register_names_sbrm);
    }
    if ( u3v_conv_info && u3v_conv_info->sirm_addr != 0 && (addr >= u3v_conv_info->sirm_addr)) {
        offset_address = (guint32)( addr - u3v_conv_info->sirm_addr);
        address_string = try_val_to_str(offset_address, bootstrap_register_names_sirm);
    }
    if ( u3v_conv_info && u3v_conv_info->eirm_addr != 0 && (addr >= u3v_conv_info->eirm_addr)) {
        offset_address = (guint32)( addr - u3v_conv_info->eirm_addr);
        address_string = try_val_to_str(offset_address, bootstrap_register_names_eirm);
    }

    if (!address_string) {
        address_string = wmem_strdup_printf(wmem_packet_scope(), "[Addr:0x%016" PRIX64 "]", addr);
        if (is_custom_register != NULL) {
            *is_custom_register = TRUE;
        }
    }

    return address_string;
}

/*
 \brief Returns true if a register (identified by its address) is a known bootstrap register
 */
static int
is_known_bootstrap_register(guint64 addr, u3v_conv_info_t * u3v_conv_info)
{
    const gchar* address_string = NULL;
    guint32 offset_address;
    /* check if this is the access to one of the base address registers */
    if ( addr < 0x10000 ) {
        offset_address = (guint32)addr;
        address_string = try_val_to_str(offset_address, bootstrap_register_names_abrm);
    }
    if ( u3v_conv_info->sbrm_addr != 0 &&  (addr >= u3v_conv_info->sbrm_addr)) {
        offset_address = (guint32)( addr - u3v_conv_info->sbrm_addr);
        address_string = try_val_to_str(offset_address, bootstrap_register_names_sbrm);
    }
    if ( u3v_conv_info->sirm_addr != 0 &&  (addr >= u3v_conv_info->sirm_addr)) {
        offset_address = (guint32)( addr - u3v_conv_info->sirm_addr);
        address_string = try_val_to_str(offset_address, bootstrap_register_names_sirm);
    }
    if ( u3v_conv_info->eirm_addr != 0 &&  (addr >= u3v_conv_info->eirm_addr)) {
        offset_address = (guint32)( addr - u3v_conv_info->eirm_addr);
        address_string = try_val_to_str(offset_address, bootstrap_register_names_eirm);
    }
    return address_string != NULL;
}

/*
 \brief Identify Base Address Pointer
*/
static void
dissect_u3v_register_bases(guint64 addr, tvbuff_t *tvb, gint offset, u3v_conv_info_t * u3v_conv_info)
{
    if ( addr < 0x10000 ) {
        switch (addr) {
        case U3V_ABRM_SBRM_ADDRESS:
            u3v_conv_info->sbrm_addr = tvb_get_letoh64(tvb, offset);
            break;
        case U3V_ABRM_MANIFEST_TABLE_ADDRESS:
            u3v_conv_info->manifest_addr = tvb_get_letoh64(tvb, offset);
            break;
        }
    }
    if ( u3v_conv_info->sbrm_addr != 0 && (addr >= u3v_conv_info->sbrm_addr)) {
        addr -= u3v_conv_info->sbrm_addr;
        switch(addr) {
        case U3V_SBRM_SIRM_ADDRESS:
            u3v_conv_info->sirm_addr = tvb_get_letoh64(tvb, offset);
            break;
        case U3V_SBRM_EIRM_ADDRESS:
            u3v_conv_info->eirm_addr = tvb_get_letoh64(tvb, offset);
            break;
        case U3V_SBRM_IIDC2_ADDRESS:
            u3v_conv_info->iidc2_addr = tvb_get_letoh64(tvb, offset);
            break;
        }
    }
}

/*
 \brief Attempt to dissect a bootstrap register
*/
static int
dissect_u3v_register(guint64 addr, proto_tree *branch, tvbuff_t *tvb, gint offset, gint length, u3v_conv_info_t *u3v_conv_info)
{
    gint isABRM = FALSE, isSBRM = FALSE, isSIRM = FALSE,isEIRM = FALSE;
    /* check if this is the access to one of the base address registers */
    if ( addr < 0x10000 ) {
        isABRM = TRUE;
        switch (addr) {
        case U3V_ABRM_GENCP_VERSION:
            proto_tree_add_item(branch, hf_u3v_bootstrap_GenCP_Version, tvb, offset, 4, ENC_LITTLE_ENDIAN);
            break;
        case U3V_ABRM_MANUFACTURER_NAME:
            if ( length <= 64 ) {
                proto_tree_add_item(branch, hf_u3v_bootstrap_Manufacturer_Name, tvb, offset, length, ENC_ASCII);
            }
            break;
        case U3V_ABRM_MODEL_NAME:
            if ( length <= 64 ) {
                proto_tree_add_item(branch, hf_u3v_bootstrap_Model_Name, tvb, offset, length, ENC_ASCII);
            }
            break;
        case U3V_ABRM_FAMILY_NAME:
            if ( length <= 64 ) {
                proto_tree_add_item(branch, hf_u3v_bootstrap_Family_Name, tvb, offset, length, ENC_ASCII);
            }
            break;
        case U3V_ABRM_DEVICE_VERSION:
            if ( length <= 64 ) {
                proto_tree_add_item(branch, hf_u3v_bootstrap_Device_Version, tvb, offset, length, ENC_ASCII);
            }
            break;
        case U3V_ABRM_MANUFACTURER_INFO:
            if ( length <= 64 ) {
                proto_tree_add_item(branch, hf_u3v_bootstrap_Manufacturer_Info, tvb, offset, length, ENC_ASCII);
            }
            break;
        case U3V_ABRM_SERIAL_NUMBER:
            if ( length <= 64 ) {
                proto_tree_add_item(branch, hf_u3v_bootstrap_Serial_Number, tvb, offset, length, ENC_ASCII);
            }
            break;
        case U3V_ABRM_USER_DEFINED_NAME:
            if ( length <= 64 ) {
                proto_tree_add_item(branch, hf_u3v_bootstrap_User_Defined_Name, tvb, offset, length, ENC_ASCII);
            }
            break;
        case U3V_ABRM_DEVICE_CAPABILITY:
            proto_tree_add_item(branch, hf_u3v_bootstrap_Device_Capability, tvb, offset, 8, ENC_LITTLE_ENDIAN);
            break;
        case U3V_ABRM_MAXIMUM_DEVICE_RESPONSE_TIME:
            proto_tree_add_item(branch, hf_u3v_bootstrap_Maximum_Device_Response_Time, tvb, offset, 4, ENC_LITTLE_ENDIAN);
            break;
        case U3V_ABRM_MANIFEST_TABLE_ADDRESS:
            proto_tree_add_item(branch, hf_u3v_bootstrap_Manifest_Table_Address, tvb, offset, 8, ENC_LITTLE_ENDIAN);
            break;
        case U3V_ABRM_SBRM_ADDRESS:
            proto_tree_add_item(branch, hf_u3v_bootstrap_SBRM_Address, tvb, offset, 8, ENC_LITTLE_ENDIAN);
            break;
        case U3V_ABRM_DEVICE_CONFIGURATION:
            proto_tree_add_item(branch, hf_u3v_bootstrap_Device_Configuration, tvb, offset, 8, ENC_LITTLE_ENDIAN);
            break;
        case U3V_ABRM_HEARTBEAT_TIMEOUT:
            proto_tree_add_item(branch, hf_u3v_bootstrap_Heartbeat_Timeout, tvb, offset, 4, ENC_LITTLE_ENDIAN);
            break;
        case U3V_ABRM_MESSAGE_CHANNEL_CHANNEL_ID:
            proto_tree_add_item(branch, hf_u3v_bootstrap_Message_Channel_channel_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);
            break;
        case U3V_ABRM_TIMESTAMP:
            proto_tree_add_item(branch, hf_u3v_bootstrap_Timestamp, tvb, offset, 8, ENC_LITTLE_ENDIAN);
            break;
        case U3V_ABRM_TIMESTAMP_LATCH:
            proto_tree_add_item(branch, hf_u3v_bootstrap_Timestamp_Latch, tvb, offset, 4, ENC_LITTLE_ENDIAN);
            break;
        case U3V_ABRM_TIMESTAMP_INCREMENT:
            proto_tree_add_item(branch, hf_u3v_bootstrap_Timestamp_Increment, tvb, offset, 8, ENC_LITTLE_ENDIAN);
            break;
        case U3V_ABRM_ACCESS_PRIVILEGE:
            proto_tree_add_item(branch, hf_u3v_bootstrap_Access_Privilege, tvb, offset, 4, ENC_LITTLE_ENDIAN);
            break;
        case U3V_ABRM_PROTOCOL_ENDIANNESS:
            proto_tree_add_item(branch, hf_u3v_bootstrap_Protocol_Endianness, tvb, offset, 4, ENC_LITTLE_ENDIAN);
            break;
        case U3V_ABRM_IMPLEMENTATION_ENDIANNESS:
            proto_tree_add_item(branch, hf_u3v_bootstrap_Implementation_Endianness, tvb, offset, 4, ENC_LITTLE_ENDIAN);
            break;
        default:
            isABRM = FALSE;
            break;
        }
    }
    if ( u3v_conv_info->sbrm_addr != 0 && (addr >= u3v_conv_info->sbrm_addr)) {
        guint64 map_offset = addr - u3v_conv_info->sbrm_addr;
        isSBRM = TRUE;
        switch(map_offset) {
        case U3V_SBRM_U3V_VERSION:
            proto_tree_add_item(branch, hf_u3v_bootstrap_U3V_Version, tvb, offset, 4, ENC_LITTLE_ENDIAN);
            break;
        case U3V_SBRM_U3VCP_CAPABILITY_REGISTER:
            proto_tree_add_item(branch, hf_u3v_bootstrap_U3VCP_Capability_Register, tvb, offset, 8, ENC_LITTLE_ENDIAN);
            break;
        case U3V_SBRM_U3VCP_CONFIGURATION_REGISTER:
            proto_tree_add_item(branch, hf_u3v_bootstrap_U3VCP_Configuration_Register, tvb, offset, 8, ENC_LITTLE_ENDIAN);
            break;
        case U3V_SBRM_MAXIMUM_COMMAND_TRANSFER_LENGTH:
            proto_tree_add_item(branch, hf_u3v_bootstrap_Maximum_Command_Transfer_Length, tvb, offset, 4, ENC_LITTLE_ENDIAN);
            break;
        case U3V_SBRM_MAXIMUM_ACKNOWLEDGE_TRANSFER_LENGTH:
            proto_tree_add_item(branch, hf_u3v_bootstrap_Maximum_Acknowledge_Transfer_Length, tvb, offset, 4, ENC_LITTLE_ENDIAN);
            break;
        case U3V_SBRM_NUMBER_OF_STREAM_CHANNELS:
            proto_tree_add_item(branch, hf_u3v_bootstrap_Number_of_Stream_Channels, tvb, offset, 4, ENC_LITTLE_ENDIAN);
            break;
        case U3V_SBRM_SIRM_ADDRESS:
            proto_tree_add_item(branch, hf_u3v_bootstrap_SIRM_Address, tvb, offset, 8, ENC_LITTLE_ENDIAN);
            break;
        case U3V_SBRM_SIRM_LENGTH:
            proto_tree_add_item(branch, hf_u3v_bootstrap_SIRM_Length, tvb, offset, 4, ENC_LITTLE_ENDIAN);
            break;
        case U3V_SBRM_EIRM_ADDRESS:
            proto_tree_add_item(branch, hf_u3v_bootstrap_EIRM_Address, tvb, offset, 8, ENC_LITTLE_ENDIAN);
            break;
        case U3V_SBRM_EIRM_LENGTH:
            proto_tree_add_item(branch, hf_u3v_bootstrap_EIRM_Length, tvb, offset, 4, ENC_LITTLE_ENDIAN);
            break;
        case U3V_SBRM_IIDC2_ADDRESS:
            proto_tree_add_item(branch, hf_u3v_bootstrap_IIDC2_Address, tvb, offset, 8, ENC_LITTLE_ENDIAN);
            break;
        case U3V_SBRM_CURRENT_SPEED:
            proto_tree_add_item(branch, hf_u3v_bootstrap_Current_Speed, tvb, offset, 4, ENC_LITTLE_ENDIAN);
            break;
        default:
            isSBRM = FALSE;
            break;
        }
    }
    if ( u3v_conv_info->sirm_addr != 0 && (addr >= u3v_conv_info->sirm_addr)) {
        guint64 map_offset = addr - u3v_conv_info->sirm_addr;
        isSIRM = TRUE;
        switch(map_offset) {
        case U3V_SIRM_SI_INFO:
            proto_tree_add_item(branch, hf_u3v_bootstrap_SI_Info, tvb, offset, 4, ENC_LITTLE_ENDIAN);
            break;
        case U3V_SIRM_SI_CONTROL:
            proto_tree_add_item(branch, hf_u3v_bootstrap_SI_Control, tvb, offset, 4, ENC_LITTLE_ENDIAN);
            break;
        case U3V_SIRM_SI_REQUIRED_PAYLOAD_SIZE:
            proto_tree_add_item(branch, hf_u3v_bootstrap_SI_Required_Payload_Size, tvb, offset, 8, ENC_LITTLE_ENDIAN);
            break;
        case U3V_SIRM_SI_REQUIRED_LEADER_SIZE:
            proto_tree_add_item(branch, hf_u3v_bootstrap_SI_Required_Leader_Size, tvb, offset, 4, ENC_LITTLE_ENDIAN);
            break;
        case U3V_SIRM_SI_REQUIRED_TRAILER_SIZE:
            proto_tree_add_item(branch, hf_u3v_bootstrap_SI_Required_Trailer_Size, tvb, offset, 4, ENC_LITTLE_ENDIAN);
            break;
        case U3V_SIRM_SI_MAXIMUM_LEADER_SIZE:
            proto_tree_add_item(branch, hf_u3v_bootstrap_SI_Maximum_Leader_Size, tvb, offset, 4, ENC_LITTLE_ENDIAN);
            break;
        case U3V_SIRM_SI_PAYLOAD_TRANSFER_SIZE:
            proto_tree_add_item(branch, hf_u3v_bootstrap_SI_Payload_Transfer_Size, tvb, offset, 4, ENC_LITTLE_ENDIAN);
            break;
        case U3V_SIRM_SI_PAYLOAD_TRANSFER_COUNT:
            proto_tree_add_item(branch, hf_u3v_bootstrap_SI_Payload_Transfer_Count, tvb, offset, 4, ENC_LITTLE_ENDIAN);
            break;
        case U3V_SIRM_SI_PAYLOAD_FINAL_TRANSFER1_SIZE:
            proto_tree_add_item(branch, hf_u3v_bootstrap_SI_Payload_Final_Transfer1_Size, tvb, offset, 4, ENC_LITTLE_ENDIAN);
            break;
        case U3V_SIRM_SI_PAYLOAD_FINAL_TRANSFER2_SIZE:
            proto_tree_add_item(branch, hf_u3v_bootstrap_SI_Payload_Final_Transfer2_Size, tvb, offset, 4, ENC_LITTLE_ENDIAN);
            break;
        case U3V_SIRM_SI_MAXIMUM_TRAILER_SIZE:
            proto_tree_add_item(branch, hf_u3v_bootstrap_SI_Maximum_Trailer_Size, tvb, offset, 4, ENC_LITTLE_ENDIAN);
            break;
        default:
            isSIRM = FALSE;
            break;
        }
    }
    if ( u3v_conv_info->eirm_addr != 0 && (addr >= u3v_conv_info->eirm_addr)) {
        guint64 map_offset = addr -u3v_conv_info->eirm_addr;
        isEIRM=TRUE;
        switch(map_offset) {
        case U3V_EIRM_EI_CONTROL:
            proto_tree_add_item(branch, hf_u3v_bootstrap_EI_Control, tvb, offset, 4, ENC_LITTLE_ENDIAN);
            break;
        case U3V_EIRM_MAXIMUM_EVENT_TRANSFER_LENGTH:
            proto_tree_add_item(branch, hf_u3v_bootstrap_Maximum_Event_Transfer_Length, tvb, offset, 4, ENC_LITTLE_ENDIAN);
            break;
        case U3V_EIRM_EVENT_TEST_CONTROL:
            proto_tree_add_item(branch, hf_u3v_bootstrap_Event_Test_Control, tvb, offset, 4, ENC_LITTLE_ENDIAN);
            break;
        default:
            isEIRM = FALSE;
            break;
        }
    }
    if(isABRM || isSBRM || isSIRM || isEIRM ) {
        return 1;
    }
    return 0;
}

/*
 \brief DISSECT: Read memory command
*/
static void
dissect_u3v_read_mem_cmd(proto_tree *u3v_telegram_tree, tvbuff_t *tvb, packet_info *pinfo, gint startoffset, gint length, u3v_conv_info_t *u3v_conv_info, gencp_transaction_t * gencp_trans)
{
    guint64 addr = 0;
    const gchar* address_string = NULL;
    gboolean is_custom_register = FALSE;
    guint16 count = 0;
    gint offset = startoffset;
    proto_item *item = NULL;

    addr = tvb_get_letoh64(tvb, offset);
    gencp_trans->address = addr;

    address_string = get_register_name_from_address(addr, &is_custom_register, u3v_conv_info);
    count = tvb_get_letohs(tvb, offset + 10);   /* Number of bytes to read from memory */

    gencp_trans->count = count;
    if ( 0xffffffff00000000 & addr ) {
        col_append_fstr(pinfo->cinfo, COL_INFO, " (0x%016" PRIX64 " (%d) bytes) %s", addr, count, address_string);
    } else {
        col_append_fstr(pinfo->cinfo, COL_INFO, " (0x%08X (%d) bytes)", (guint32)addr, count);
    }


    item = proto_tree_add_item(u3v_telegram_tree, hf_u3v_scd_readmem_cmd, tvb, offset, length, ENC_NA);
    u3v_telegram_tree = proto_item_add_subtree(item, ett_u3v_payload_cmd);

    /* address */
    if (is_known_bootstrap_register(addr, u3v_conv_info)) {
        item = proto_tree_add_uint64(u3v_telegram_tree, hf_u3v_address, tvb, offset, 8, addr);
        proto_item_append_text(item, " %s", address_string);
    } else {
        proto_tree_add_item(u3v_telegram_tree, hf_u3v_custom_memory_addr, tvb, offset, 8, ENC_LITTLE_ENDIAN);
    }
    offset += 8;

    /* reserved field */
    proto_tree_add_item(u3v_telegram_tree, hf_u3v_reserved, tvb, offset, 2, ENC_NA);
    offset += 2;

    /* count */
    proto_tree_add_item(u3v_telegram_tree, hf_u3v_count, tvb, offset, 2, ENC_LITTLE_ENDIAN);
}

/*
 \brief DISSECT: Write memory command
*/
static void
dissect_u3v_write_mem_cmd(proto_tree *u3v_telegram_tree, tvbuff_t *tvb, packet_info *pinfo, gint startoffset, gint length, u3v_conv_info_t *u3v_conv_info, gencp_transaction_t *gencp_trans)
{
    const gchar* address_string = NULL;
    gboolean is_custom_register = FALSE;
    guint64 addr = 0;
    guint byte_count = 0;
    proto_item *item = NULL;
    guint offset = startoffset + 8;

    addr = tvb_get_letoh64(tvb, startoffset);
    byte_count = length - 8;
    address_string = get_register_name_from_address(addr, &is_custom_register, u3v_conv_info);

    gencp_trans->address = addr;
    gencp_trans->count = byte_count;

    /* fill in Info column in Wireshark GUI */
    col_append_fstr(pinfo->cinfo, COL_INFO, "%s: %d bytes", address_string, byte_count);


    /* Subtree initialization for Payload Data: WRITEMEM_CMD */
    item = proto_tree_add_item(u3v_telegram_tree, hf_u3v_scd_writemem_cmd, tvb, startoffset, length, ENC_NA);
    u3v_telegram_tree = proto_item_add_subtree(item, ett_u3v_payload_cmd);

    if (is_known_bootstrap_register(addr, u3v_conv_info)) {
        item = proto_tree_add_uint64(u3v_telegram_tree, hf_u3v_address, tvb, startoffset, 8, addr);
        proto_item_append_text(item, " %s", address_string);
        dissect_u3v_register(addr, u3v_telegram_tree, tvb, offset, byte_count, u3v_conv_info);
    } else {
        proto_tree_add_item(u3v_telegram_tree, hf_u3v_custom_memory_addr, tvb, startoffset, 8, ENC_LITTLE_ENDIAN);
        proto_tree_add_item(u3v_telegram_tree, hf_u3v_custom_memory_data, tvb, startoffset + 8, byte_count, ENC_NA);
    }

}

/*
 *  \brief DISSECT: Event command
 */
static void
dissect_u3v_event_cmd(proto_tree *u3v_telegram_tree, tvbuff_t *tvb, packet_info *pinfo, gint startoffset, gint length)
{
    gint32 eventid;
    gint offset = startoffset;
    proto_item *item = NULL;

    /* Get event ID */
    eventid = tvb_get_letohs(tvb, offset + 2);

    /* fill in Info column in Wireshark GUI */
    col_append_fstr(pinfo->cinfo, COL_INFO, "[ID: 0x%04X]", eventid);


    item = proto_tree_add_item(u3v_telegram_tree, hf_u3v_scd_event_cmd, tvb, offset, length, ENC_NA);
    u3v_telegram_tree = proto_item_add_subtree(item, ett_u3v_payload_cmd);

    offset += 2;

    /* Use range to determine type of event */
    if ((eventid >= 0x0000) && (eventid <= 0x8000)) {
        /* Standard ID */
        proto_tree_add_item(u3v_telegram_tree, hf_u3v_eventcmd_id, tvb, offset, 2, ENC_LITTLE_ENDIAN);
    } else if ((eventid >= 0x8001) && (eventid <= 0x8FFF)) {
        /* Error */
        proto_tree_add_item(u3v_telegram_tree, hf_u3v_eventcmd_error_id, tvb, offset, 2, ENC_LITTLE_ENDIAN);
    } else if ((eventid >= 0x9000) && (eventid <= 0xFFFF)) {
        /* Device specific */
        proto_tree_add_item(u3v_telegram_tree, hf_u3v_eventcmd_device_specific_id, tvb, offset, 2, ENC_LITTLE_ENDIAN);
    }
    offset += 2;

    /* Timestamp (64 bit) associated with event */
    proto_tree_add_item(u3v_telegram_tree, hf_u3v_eventcmd_timestamp, tvb, offset, 8, ENC_LITTLE_ENDIAN);
    offset += 8;

    /* Data */
    if (length > offset ) {
        proto_tree_add_item(u3v_telegram_tree, hf_u3v_eventcmd_data, tvb, offset, length - 12, ENC_NA);
    }
}

/*
 \brief DISSECT: Read memory acknowledge
*/
static void
dissect_u3v_read_mem_ack(proto_tree *u3v_telegram_tree, tvbuff_t *tvb, packet_info *pinfo, gint startoffset, gint length, u3v_conv_info_t *u3v_conv_info, gencp_transaction_t * gencp_trans)
{
    guint64 addr = 0;
    const gchar *address_string = NULL;
    gboolean is_custom_register = FALSE;
    gboolean have_address = (0 != gencp_trans->cmd_frame);
    proto_item *item = NULL;
    guint offset = startoffset;
    guint byte_count = (length);

    addr = gencp_trans->address;
    dissect_u3v_register_bases(addr, tvb, startoffset, u3v_conv_info);
    if (have_address) {
        address_string = get_register_name_from_address(addr, &is_custom_register, u3v_conv_info);
        /* Fill in Wireshark GUI Info column */
        col_append_str(pinfo->cinfo, COL_INFO, address_string);
    }


    /* Subtree initialization for Payload Data: READMEM_ACK */
    item = proto_tree_add_item(u3v_telegram_tree, hf_u3v_scd_ack_readmem_ack, tvb, startoffset, length, ENC_NA);
    u3v_telegram_tree = proto_item_add_subtree(item, ett_u3v_payload_cmd);

    /* Bootstrap register known address */
    if (have_address) {
        item = proto_tree_add_uint64(u3v_telegram_tree, hf_u3v_address, tvb, 0,0 , addr);
        proto_item_set_generated(item);

        if (is_known_bootstrap_register(addr, u3v_conv_info)) {
            dissect_u3v_register(addr, u3v_telegram_tree, tvb, offset, byte_count, u3v_conv_info);
        } else {
            proto_tree_add_item(u3v_telegram_tree, hf_u3v_custom_memory_data, tvb, startoffset, length, ENC_NA);
        }
    }
}

/*
 \brief DISSECT: Write memory acknowledge
*/
static void
dissect_u3v_write_mem_ack(proto_tree *u3v_telegram_tree, tvbuff_t *tvb, packet_info *pinfo, gint startoffset, gint length, u3v_conv_info_t *u3v_conv_info , gencp_transaction_t * gencp_trans)
{
    guint64 addr = 0;
    gint offset = startoffset;
    const gchar *address_string = NULL;
    gboolean is_custom_register = FALSE;
    gboolean have_address = (0 != gencp_trans->cmd_frame);
    proto_item *item = NULL;

    addr = gencp_trans->address;
    if (have_address) {
        address_string = get_register_name_from_address(addr, &is_custom_register, u3v_conv_info);

        /* Fill in Wireshark GUI Info column */
        col_append_str(pinfo->cinfo, COL_INFO, address_string);
    }

    item = proto_tree_add_item(u3v_telegram_tree, hf_u3v_scd_writemem_ack, tvb, startoffset, length, ENC_NA);
    u3v_telegram_tree = proto_item_add_subtree(item, ett_u3v_payload_cmd);

    if (have_address) {
            item = proto_tree_add_uint64(u3v_telegram_tree, hf_u3v_address, tvb, 0,0 , addr);
            proto_item_set_generated(item);
        }
    /* Number of bytes successfully written to the device register map */
    if ( length == 4 ) {

        /* reserved field */
        proto_tree_add_item(u3v_telegram_tree, hf_u3v_reserved, tvb, offset, 2, ENC_NA);
        offset += 2;

        proto_tree_add_item(u3v_telegram_tree, hf_u3v_count, tvb, offset, 2, ENC_LITTLE_ENDIAN);
    }
}

/*
 \brief DISSECT: Pending acknowledge
*/
static void
dissect_u3v_pending_ack(proto_tree *u3v_telegram_tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint startoffset, gint length, u3v_conv_info_t *u3v_conv_info _U_, gencp_transaction_t *gencp_trans _U_)
{
    proto_item *item = NULL;
    guint offset = startoffset;

    /* Fill in Wireshark GUI Info column */
    col_append_fstr(pinfo->cinfo, COL_INFO, " %d ms", tvb_get_letohs(tvb, startoffset+2));

    item = proto_tree_add_item(u3v_telegram_tree, hf_u3v_ccd_pending_ack, tvb, startoffset, length, ENC_NA);
    u3v_telegram_tree = proto_item_add_subtree(item, ett_u3v_payload_cmd);

    /* reserved field */
    proto_tree_add_item(u3v_telegram_tree, hf_u3v_reserved, tvb, offset, 2, ENC_NA);
    offset += 2;

    proto_tree_add_item(u3v_telegram_tree, hf_u3v_time_to_completion, tvb, offset, 2, ENC_LITTLE_ENDIAN);
}

/*
 \brief DISSECT: Stream Leader
*/
static void
dissect_u3v_stream_leader(proto_tree *u3v_telegram_tree, tvbuff_t *tvb, packet_info *pinfo, usb_conv_info_t *usb_conv_info _U_)
{
    guint32 offset = 0;
    guint32 payload_type = 0;
    guint64 block_id = 0;
    proto_item *item = NULL;

    /* Subtree initialization for Stream Leader */
    item = proto_tree_add_item(u3v_telegram_tree, hf_u3v_stream_leader, tvb, 0, -1, ENC_NA);
    u3v_telegram_tree = proto_item_add_subtree(item, ett_u3v_stream_leader);

    /* Add the prefix code: */
    proto_tree_add_item(u3v_telegram_tree, hf_u3v_stream_prefix, tvb, offset, 4, ENC_LITTLE_ENDIAN);
    offset += 4;

    /* reserved field */
    proto_tree_add_item(u3v_telegram_tree, hf_u3v_stream_reserved, tvb, offset, 2, ENC_NA);
    offset += 2;

    /* leader size */
    proto_tree_add_item(u3v_telegram_tree, hf_u3v_stream_leader_size, tvb, offset, 2, ENC_LITTLE_ENDIAN);
    offset += 2;

    /* block id */
    block_id = tvb_get_letoh64(tvb, offset);
    proto_tree_add_item(u3v_telegram_tree, hf_u3v_stream_block_id, tvb, offset, 8, ENC_LITTLE_ENDIAN);
    offset += 8;

    /* reserved field */
    proto_tree_add_item(u3v_telegram_tree, hf_u3v_stream_reserved, tvb, offset, 2, ENC_NA);
    offset += 2;

    /* payload type */
    payload_type = tvb_get_letohs(tvb, offset);
    proto_tree_add_item(u3v_telegram_tree, hf_u3v_stream_payload_type, tvb, offset, 2, ENC_LITTLE_ENDIAN);
    offset += 2;

    /* Add payload type to information string */
    col_append_fstr(pinfo->cinfo, COL_INFO, "Stream Leader  [ Block ID: %" PRIu64 " , Type %s]",
                    block_id,
                    val_to_str_const(payload_type, payload_type_names, "Unknown Payload Type"));

    if (payload_type == U3V_STREAM_PAYLOAD_IMAGE ||
        payload_type == U3V_STREAM_PAYLOAD_IMAGE_EXT_CHUNK ||
        payload_type == U3V_STREAM_PAYLOAD_CHUNK) {
        /* timestamp */
        proto_tree_add_item(u3v_telegram_tree, hf_u3v_stream_timestamp, tvb, offset, 8, ENC_LITTLE_ENDIAN);
        offset += 8;
    }

    if (payload_type == U3V_STREAM_PAYLOAD_IMAGE ||
        payload_type == U3V_STREAM_PAYLOAD_IMAGE_EXT_CHUNK ) {
        /* pixel format */
        proto_tree_add_item(u3v_telegram_tree, hf_u3v_stream_pixel_format, tvb, offset, 4, ENC_LITTLE_ENDIAN);
        offset += 4;

        /* size_x */
        proto_tree_add_item(u3v_telegram_tree, hf_u3v_stream_size_x, tvb, offset, 4, ENC_LITTLE_ENDIAN);
        offset += 4;

        /* size_y */
        proto_tree_add_item(u3v_telegram_tree, hf_u3v_stream_size_y, tvb, offset, 4, ENC_LITTLE_ENDIAN);
        offset += 4;

        /* offset_x */
        proto_tree_add_item(u3v_telegram_tree, hf_u3v_stream_offset_x, tvb, offset, 4, ENC_LITTLE_ENDIAN);
        offset += 4;

        /* offset_x */
        proto_tree_add_item(u3v_telegram_tree, hf_u3v_stream_offset_y, tvb, offset, 4, ENC_LITTLE_ENDIAN);
        offset += 4;

        /* padding_x */
        proto_tree_add_item(u3v_telegram_tree, hf_u3v_stream_padding_x, tvb, offset, 2, ENC_LITTLE_ENDIAN);
        /* offset += 2; */

        /* reserved field */
        proto_tree_add_item(u3v_telegram_tree, hf_u3v_stream_reserved, tvb, offset, 2, ENC_NA);
        /* offset += 2; */
    }
}

/*
 \brief DISSECT: Stream Trailer
*/
static void
dissect_u3v_stream_trailer(proto_tree *u3v_telegram_tree, tvbuff_t *tvb, packet_info *pinfo, usb_conv_info_t *usb_conv_info _U_)
{
    gint offset = 0;
    guint64 block_id;
    proto_item *item = NULL;

    /* Subtree initialization for Stream Trailer */
    item = proto_tree_add_item(u3v_telegram_tree, hf_u3v_stream_trailer, tvb, 0, -1, ENC_NA);
    u3v_telegram_tree = proto_item_add_subtree(item, ett_u3v_stream_trailer);

    /* Add the prefix code: */
    proto_tree_add_item(u3v_telegram_tree, hf_u3v_stream_prefix, tvb, offset, 4, ENC_LITTLE_ENDIAN);
    offset += 4;

    /* reserved field */
    proto_tree_add_item(u3v_telegram_tree, hf_u3v_stream_reserved, tvb, offset, 2, ENC_NA);
    offset += 2;

    /* trailer size */
    proto_tree_add_item(u3v_telegram_tree, hf_u3v_stream_trailer_size, tvb, offset, 2, ENC_LITTLE_ENDIAN);
    offset += 2;

    /* block id */
    block_id = tvb_get_letoh64(tvb, offset);
    proto_tree_add_item(u3v_telegram_tree, hf_u3v_stream_block_id, tvb, offset, 8, ENC_LITTLE_ENDIAN);
    offset += 8;

    /* status*/
    proto_tree_add_item(u3v_telegram_tree, hf_u3v_stream_status, tvb, offset, 2, ENC_LITTLE_ENDIAN);
    offset += 2;

    /* reserved field */
    proto_tree_add_item(u3v_telegram_tree, hf_u3v_stream_reserved, tvb, offset, 2, ENC_NA);
    offset += 2;

    /* block id */
    proto_tree_add_item(u3v_telegram_tree, hf_u3v_stream_valid_payload_size, tvb, offset, 8, ENC_LITTLE_ENDIAN);
    offset += 8;

    /* Add payload type to information string */
    col_append_fstr(pinfo->cinfo, COL_INFO, "Stream Trailer [ Block ID: %" PRIu64 "]", block_id);

    if (tvb_captured_length_remaining(tvb,offset) >=4 ) {
        /* size_y */
        proto_tree_add_item(u3v_telegram_tree, hf_u3v_stream_size_y, tvb, offset, 4, ENC_LITTLE_ENDIAN);
        offset += 4;
    }

    if (tvb_captured_length_remaining(tvb,offset) >=4 ) {
        /* chunk layout id */
        proto_tree_add_item(u3v_telegram_tree, hf_u3v_stream_chunk_layout_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);
        /* offset += 4; */
    }
}

/*
 \brief DISSECT: Stream Payload
*/
static void
dissect_u3v_stream_payload(proto_tree *u3v_telegram_tree, tvbuff_t *tvb, packet_info *pinfo, usb_conv_info_t *usb_conv_info _U_)
{
    proto_item *item = NULL;

    /* Subtree initialization for Stream Payload */
    item = proto_tree_add_item(u3v_telegram_tree, hf_u3v_stream_payload, tvb, 0, -1, ENC_NA);
    u3v_telegram_tree = proto_item_add_subtree(item, ett_u3v_stream_payload);

    /* Data */
    proto_tree_add_item(u3v_telegram_tree, hf_u3v_stream_data, tvb, 0, -1, ENC_NA);

    /* Add payload type to information string */
    col_append_str(pinfo->cinfo, COL_INFO, "Stream Payload");
}

/*
  \brief Point of entry of all U3V packet dissection
*/
static int
dissect_u3v(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
    gint offset = 0;
    proto_tree *u3v_tree = NULL, *ccd_tree_flag, *u3v_telegram_tree = NULL, *ccd_tree = NULL;
    gint data_length = 0;
    gint req_id = 0;
    gint command_id = -1;
    gint status = 0;
    guint prefix = 0;
    proto_item *ti = NULL;
    proto_item *item = NULL;
    const char *command_string;
    usb_conv_info_t *usb_conv_info;
    gint stream_detected = FALSE;
    gint control_detected = FALSE;
    u3v_conv_info_t *u3v_conv_info = NULL;
    gencp_transaction_t *gencp_trans = NULL;

    usb_conv_info = (usb_conv_info_t *)data;

    /* decide if this packet belongs to U3V protocol */
    u3v_conv_info = (u3v_conv_info_t *)usb_conv_info->class_data;

    if (!u3v_conv_info) {
        u3v_conv_info = wmem_new0(wmem_file_scope(), u3v_conv_info_t);
        usb_conv_info->class_data = u3v_conv_info;
        usb_conv_info->class_data_type = USB_CONV_U3V;
    } else if (usb_conv_info->class_data_type != USB_CONV_U3V) {
        /* Don't dissect if another USB type is in the conversation */
        return 0;
    }

    prefix = tvb_get_letohl(tvb, 0);
    if ((tvb_reported_length(tvb) >= 4) && ( ( U3V_CONTROL_PREFIX == prefix ) || ( U3V_EVENT_PREFIX == prefix ) ) ) {
        control_detected = TRUE;
    }

    if (((tvb_reported_length(tvb) >= 4) && (( U3V_STREAM_LEADER_PREFIX == prefix ) || ( U3V_STREAM_TRAILER_PREFIX == prefix )))
         || (usb_conv_info->endpoint == u3v_conv_info->ep_stream)) {
        stream_detected = TRUE;
    }

    /* initialize interface class/subclass in case no descriptors have been dissected yet */
    if ( control_detected || stream_detected){
        if ( usb_conv_info->interfaceClass  == IF_CLASS_UNKNOWN &&
             usb_conv_info->interfaceSubclass  == IF_SUBCLASS_UNKNOWN){
            usb_conv_info->interfaceClass = IF_CLASS_MISCELLANEOUS;
            usb_conv_info->interfaceSubclass = IF_SUBCLASS_MISC_U3V;
        }
    }

    if ( control_detected ) {
        /* Set the protocol column */
        col_set_str(pinfo->cinfo, COL_PROTOCOL, "U3V");

        /* Clear out stuff in the info column */
        col_clear(pinfo->cinfo, COL_INFO);

        /* Adds "USB3Vision" heading to protocol tree */
        /* We will add fields to this using the u3v_tree pointer */
        ti = proto_tree_add_item(tree, proto_u3v, tvb, offset, -1, ENC_NA);
        u3v_tree = proto_item_add_subtree(ti, ett_u3v);

        prefix = tvb_get_letohl(tvb, offset);
        command_id = tvb_get_letohs(tvb, offset+6);

        /* decode CCD ( DCI/DCE command data layout) */
        if ((prefix == U3V_CONTROL_PREFIX || prefix == U3V_EVENT_PREFIX) && ((command_id % 2) == 0)) {
            command_string = val_to_str(command_id,command_names,"Unknown Command (0x%x)");
            item = proto_tree_add_item(u3v_tree, hf_u3v_ccd_cmd, tvb, offset, 8, ENC_NA);
            proto_item_append_text(item, ": %s", command_string);
            ccd_tree = proto_item_add_subtree(item, ett_u3v_cmd);

            /* Add the prefix code: */
            proto_tree_add_item(ccd_tree, hf_u3v_gencp_prefix, tvb, offset, 4, ENC_LITTLE_ENDIAN);
            offset += 4;

            /* Add the flags */
            item = proto_tree_add_item(ccd_tree, hf_u3v_flag, tvb, offset, 2, ENC_LITTLE_ENDIAN);
            ccd_tree_flag  = proto_item_add_subtree(item, ett_u3v_flags);
            proto_tree_add_item(ccd_tree_flag, hf_u3v_acknowledge_required_flag, tvb, offset, 2, ENC_LITTLE_ENDIAN);

            offset += 2;
            col_append_fstr(pinfo->cinfo, COL_INFO, "> %s ", command_string);
        } else if (prefix == U3V_CONTROL_PREFIX && ((command_id % 2) == 1)) {
            command_string = val_to_str(command_id,command_names,"Unknown Acknowledge (0x%x)");
            item = proto_tree_add_item(u3v_tree, hf_u3v_ccd_ack, tvb, offset, 8, ENC_NA);
            proto_item_append_text(item, ": %s", command_string);
            ccd_tree = proto_item_add_subtree(item, ett_u3v_ack);

            /* Add the prefix code: */
            proto_tree_add_item(ccd_tree, hf_u3v_gencp_prefix, tvb, offset, 4, ENC_LITTLE_ENDIAN);
            offset += 4;

            /* Add the status: */
            proto_tree_add_item(ccd_tree, hf_u3v_status, tvb, offset, 2,ENC_LITTLE_ENDIAN);
            status = tvb_get_letohs(tvb, offset);
            offset += 2;
            col_append_fstr(pinfo->cinfo, COL_INFO, "< %s %s",
                    command_string,
                    val_to_str(status, status_names_short, "Unknown status (0x%04X)"));
        } else {
            return 0;
        }

        /* Add the command id*/
        proto_tree_add_item(ccd_tree, hf_u3v_command_id, tvb, offset, 2,ENC_LITTLE_ENDIAN);
        offset += 2;

        /* Parse the second part of both the command and the acknowledge header:
        0          15 16         31
        -------- -------- -------- --------
        |     status      |   acknowledge   |
        -------- -------- -------- --------
        |     length      |      req_id     |
        -------- -------- -------- --------

        Add the data length
        Number of valid data bytes in this message, not including this header. This
        represents the number of bytes of payload appended after this header */

        proto_tree_add_item(ccd_tree, hf_u3v_length, tvb, offset, 2, ENC_LITTLE_ENDIAN);
        data_length = tvb_get_letohs(tvb, offset);
        offset += 2;

        /* Add the request ID */
        proto_tree_add_item(ccd_tree, hf_u3v_request_id, tvb, offset, 2, ENC_LITTLE_ENDIAN);
        req_id = tvb_get_letohs(tvb, offset);
        offset += 2;

        /* Add telegram subtree */
        u3v_telegram_tree = proto_item_add_subtree(u3v_tree, ett_u3v);

        if (!PINFO_FD_VISITED(pinfo)) {
              if ((command_id % 2) == 0) {
                    /* This is a command */
                    gencp_trans = wmem_new0(wmem_file_scope(), gencp_transaction_t);
                    gencp_trans->cmd_frame = pinfo->fd->num;
                    gencp_trans->ack_frame = 0;
                    gencp_trans->cmd_time = pinfo->abs_ts;
                    /* add reference to current packet */
                    p_add_proto_data(wmem_file_scope(), pinfo, proto_u3v, req_id, gencp_trans);
                    /* add reference to current */
                    u3v_conv_info->trans_info = gencp_trans;
                } else {
                    gencp_trans = u3v_conv_info->trans_info;
                    if (gencp_trans) {
                        gencp_trans->ack_frame = pinfo->fd->num;
                        /* add reference to current packet */
                        p_add_proto_data(wmem_file_scope(), pinfo, proto_u3v, req_id, gencp_trans);
                    }
                }
         } else {
            gencp_trans = (gencp_transaction_t*)p_get_proto_data(wmem_file_scope(),pinfo, proto_u3v, req_id);
         }

        if (!gencp_trans) {
            /* create a "fake" gencp_trans structure */
            gencp_trans = wmem_new0(wmem_packet_scope(), gencp_transaction_t);
            gencp_trans->cmd_frame = 0;
            gencp_trans->ack_frame = 0;
            gencp_trans->cmd_time = pinfo->abs_ts;
        }

        /* dissect depending on command? */
        switch (command_id) {
        case U3V_READMEM_CMD:
            dissect_u3v_read_mem_cmd(u3v_telegram_tree, tvb, pinfo, offset, data_length,u3v_conv_info,gencp_trans);
            break;
        case U3V_WRITEMEM_CMD:
            dissect_u3v_write_mem_cmd(u3v_telegram_tree, tvb, pinfo, offset, data_length,u3v_conv_info,gencp_trans);
            break;
        case U3V_EVENT_CMD:
            dissect_u3v_event_cmd(u3v_telegram_tree, tvb, pinfo, offset, data_length);
            break;
        case U3V_READMEM_ACK:
            if ( U3V_STATUS_GENCP_SUCCESS == status ) {
                dissect_u3v_read_mem_ack(u3v_telegram_tree, tvb, pinfo, offset, data_length,u3v_conv_info,gencp_trans);
            }
            break;
        case U3V_WRITEMEM_ACK:
            dissect_u3v_write_mem_ack(u3v_telegram_tree, tvb, pinfo, offset, data_length, u3v_conv_info,gencp_trans);
            break;
        case U3V_PENDING_ACK:
            dissect_u3v_pending_ack(u3v_telegram_tree, tvb, pinfo, offset, data_length, u3v_conv_info,gencp_trans);
            break;
        default:
            proto_tree_add_item(u3v_telegram_tree, hf_u3v_payloaddata, tvb, offset, data_length, ENC_NA);
            break;
        }
        return data_length + 12;
    } else if ( stream_detected ) {
        /* this is streaming data */

        /* init this stream configuration */
        u3v_conv_info = (u3v_conv_info_t *)usb_conv_info->class_data;
        u3v_conv_info->ep_stream = usb_conv_info->endpoint;

        /* Set the protocol column */
        col_set_str(pinfo->cinfo, COL_PROTOCOL, "U3V");

        /* Clear out stuff in the info column */
        col_clear(pinfo->cinfo, COL_INFO);

        /* Adds "USB3Vision" heading to protocol tree */
        /* We will add fields to this using the u3v_tree pointer */
        ti = proto_tree_add_item(tree, proto_u3v, tvb, offset, -1, ENC_NA);
        u3v_tree = proto_item_add_subtree(ti, ett_u3v);

        if(tvb_captured_length(tvb) >=4) {
            prefix = tvb_get_letohl(tvb, offset);
            switch (prefix) {
            case U3V_STREAM_LEADER_PREFIX:
                dissect_u3v_stream_leader(u3v_tree, tvb, pinfo, usb_conv_info);
                break;
            case U3V_STREAM_TRAILER_PREFIX:
                dissect_u3v_stream_trailer(u3v_tree, tvb, pinfo, usb_conv_info);
                break;
            default:
                dissect_u3v_stream_payload(u3v_tree, tvb, pinfo, usb_conv_info);
                break;
            }
        }
        return tvb_captured_length(tvb);
    }
    return 0;
}


static gboolean
dissect_u3v_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
    guint32 prefix;
    usb_conv_info_t *usb_conv_info;

    /* all control and meta data packets of U3V contain at least the prefix */
    if (tvb_reported_length(tvb) < 4)
        return FALSE;
    prefix = tvb_get_letohl(tvb, 0);

    /* check if stream endpoint has been already set up for this conversation */
    usb_conv_info = (usb_conv_info_t *)data;
    if (!usb_conv_info)
        return FALSE;

    /* either right prefix or the endpoint of the interface descriptor
       set the correct class and subclass */
    if ((U3V_STREAM_LEADER_PREFIX  == prefix) || (U3V_STREAM_TRAILER_PREFIX == prefix) ||
        (U3V_CONTROL_PREFIX        == prefix) || (U3V_EVENT_PREFIX          == prefix) ||
        ((usb_conv_info->interfaceClass == IF_CLASS_MISCELLANEOUS &&
          usb_conv_info->interfaceSubclass == IF_SUBCLASS_MISC_U3V))) {
        dissect_u3v(tvb, pinfo, tree, data);
        return TRUE;
    }

    return FALSE;
}

static gint
dissect_u3v_descriptors(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
{
    guint8          type;
    gint            offset = 0;
    proto_item *    ti;
    proto_tree *    sub_tree;
    guint32         version;


    /* The descriptor must at least have a length and type field. */
    if (tvb_reported_length(tvb) < 2) {
        return 0;
    }

    /* skip len */
    type = tvb_get_guint8(tvb, 1);

    /* Check for U3V device info descriptor. */
    if (type != DESCRIPTOR_TYPE_U3V_INTERFACE) {
        return 0;
    }

    ti = proto_tree_add_item(tree, hf_u3v_device_info_descriptor, tvb, offset, -1, ENC_NA);
    tree = proto_item_add_subtree(ti, ett_u3v_device_info_descriptor);

    /* bLength */
    proto_tree_add_item(tree, hf_u3v_device_info_descriptor_bLength, tvb, offset, 1, ENC_LITTLE_ENDIAN);
    offset++;

    /* bDescriptorType */
    ti = proto_tree_add_item(tree, hf_u3v_device_info_descriptor_bDescriptorType, tvb, offset, 1, ENC_LITTLE_ENDIAN);
    proto_item_append_text(ti, " (U3V INTERFACE)");
    offset++;

    /* bDescriptorSubtype */
    proto_tree_add_item(tree, hf_u3v_device_info_descriptor_bDescriptorSubtype, tvb, offset, 1, ENC_LITTLE_ENDIAN);
    offset++;

    /* bGenCPVersion */
    if (!tvb_bytes_exist(tvb, offset, 4)) {
        /* Version not completely in buffer -> break dissection here. */
        return offset;
    }
    version = tvb_get_letohl(tvb, offset);
    ti = proto_tree_add_item(tree, hf_u3v_device_info_descriptor_bGenCPVersion, tvb, offset, 4, ENC_NA);
    proto_item_append_text(ti, ": %u.%u", version >> 16, version & 0xFFFF);
    sub_tree = proto_item_add_subtree(ti, ett_u3v_device_info_descriptor_gencp_version);
    proto_tree_add_item(sub_tree, hf_u3v_device_info_descriptor_bGenCPVersion_minor, tvb, offset, 4, ENC_LITTLE_ENDIAN);
    proto_tree_add_item(sub_tree, hf_u3v_device_info_descriptor_bGenCPVersion_major, tvb, offset, 4, ENC_LITTLE_ENDIAN);
    offset += 4;

    /* bU3VVersion */
    if (!tvb_bytes_exist(tvb, offset, 4)) {
        /* Version not completely in buffer -> break dissection here. */
        return offset;
    }
    version = tvb_get_letohl(tvb, offset);
    ti = proto_tree_add_item(tree, hf_u3v_device_info_descriptor_bU3VVersion, tvb, offset, 4, ENC_NA);
    proto_item_append_text(ti, ": %u.%u", version >> 16, version & 0xFFFF);
    sub_tree = proto_item_add_subtree(ti, ett_u3v_device_info_descriptor_u3v_version);
    proto_tree_add_item(sub_tree, hf_u3v_device_info_descriptor_bU3VVersion_minor, tvb, offset, 4, ENC_LITTLE_ENDIAN);
    proto_tree_add_item(sub_tree, hf_u3v_device_info_descriptor_bU3VVersion_major, tvb, offset, 4, ENC_LITTLE_ENDIAN);
    offset += 4;

    /* iDeviceGUID */
    proto_tree_add_item(tree, hf_u3v_device_info_descriptor_iDeviceGUID, tvb, offset, 1, ENC_LITTLE_ENDIAN);
    offset++;

    /* iVendorName */
    proto_tree_add_item(tree, hf_u3v_device_info_descriptor_iVendorName, tvb, offset, 1, ENC_LITTLE_ENDIAN);
    offset++;

    /* iModelName */
    proto_tree_add_item(tree, hf_u3v_device_info_descriptor_iModelName, tvb, offset, 1, ENC_LITTLE_ENDIAN);
    offset++;

    /* iFamilyName */
    proto_tree_add_item(tree, hf_u3v_device_info_descriptor_iFamilyName, tvb, offset, 1, ENC_LITTLE_ENDIAN);
    offset++;

    /* iDeviceVersion */
    proto_tree_add_item(tree, hf_u3v_device_info_descriptor_iDeviceVersion, tvb, offset, 1, ENC_LITTLE_ENDIAN);
    offset++;

    /* iManufacturerInfo */
    proto_tree_add_item(tree, hf_u3v_device_info_descriptor_iManufacturerInfo, tvb, offset, 1, ENC_LITTLE_ENDIAN);
    offset++;

    /* iSerialNumber */
    proto_tree_add_item(tree, hf_u3v_device_info_descriptor_iSerialNumber, tvb, offset, 1, ENC_LITTLE_ENDIAN);
    offset++;

    /* iUserDefinedName */
    proto_tree_add_item(tree, hf_u3v_device_info_descriptor_iUserDefinedName, tvb, offset, 1, ENC_LITTLE_ENDIAN);
    offset++;

    /* bmSpeedSupport */
    proto_tree_add_bitmask(tree, tvb, offset, hf_u3v_device_info_descriptor_bmSpeedSupport,
                           ett_u3v_device_info_descriptor_speed_support, speed_support_fields, ENC_LITTLE_ENDIAN);

    offset++;

    return offset;
}

/*
 \brief Structures for register dissection
 */
static hf_register_info hf[] =
{
    /* Common U3V data */
    { &hf_u3v_gencp_prefix,
    { "Prefix", "u3v.gencp.prefix",
    FT_UINT32, BASE_HEX, NULL, 0x0,
    "U3V GenCP Prefix", HFILL
    } },

    { &hf_u3v_flag,
    { "Flags", "u3v.gencp.flags",
    FT_UINT16, BASE_HEX, NULL, 0x0,
    "U3V Flags", HFILL
    } },

    { &hf_u3v_acknowledge_required_flag,
    { "Acknowledge Required", "u3v.gencp.flag.acq_required",
    FT_BOOLEAN, 16, NULL, 0x4000,
    "U3V Acknowledge Required", HFILL
    } },

    { &hf_u3v_command_id,
    { "Command", "u3v.gencp.command_id",
    FT_UINT16, BASE_HEX, VALS( command_names ), 0x0,
    "U3V Command", HFILL
    } },

    { &hf_u3v_length,
    { "Payload Length", "u3v.gencp.payloadlength",
    FT_UINT16, BASE_HEX_DEC, NULL, 0x0,
    "U3V Payload Length", HFILL
    } },

    { &hf_u3v_request_id,
    { "Request ID", "u3v.gencp.req_id",
    FT_UINT16, BASE_HEX, NULL, 0x0,
    "U3V Request ID", HFILL
    } },

    { &hf_u3v_payloaddata,
    { "Payload Data", "u3v.gencp.payloaddata",
    FT_BYTES, BASE_NONE, NULL, 0x0,
    "U3V Payload", HFILL
    } },

    { &hf_u3v_status,
    { "Status", "u3v.gencp.status",
    FT_UINT16, BASE_HEX, VALS( status_names ), 0x0,
    "U3V Status", HFILL
    } },

    /* Read memory */
    { &hf_u3v_address,
    { "Address", "u3v.gencp.address",
    FT_UINT64, BASE_HEX, NULL, 0x0,
    "U3V Address", HFILL } },

    { &hf_u3v_count,
    { "Count", "u3v.gencp.count",
    FT_UINT16, BASE_HEX_DEC, NULL, 0x0,
    "U3V Count", HFILL
    } },

    /* Event */

    { &hf_u3v_eventcmd_id,
    { "ID", "u3v.cmd.event.id",
    FT_UINT16, BASE_HEX_DEC, VALS( event_id_names ), 0x0,
    "U3V Event ID", HFILL
    } },

    { &hf_u3v_eventcmd_error_id,
    { "Error ID", "u3v.cmd.event.errorid",
    FT_UINT16, BASE_HEX_DEC, NULL, 0x0,
    "U3V Event Error ID", HFILL
    } },

    { &hf_u3v_eventcmd_device_specific_id,
    { "Device Specific ID", "u3v.cmd.event.devicespecificid",
    FT_UINT16, BASE_HEX_DEC, NULL, 0x0,
    "U3V Event Device Specific ID", HFILL
    } },

    { &hf_u3v_eventcmd_timestamp,
    { "Timestamp", "u3v.cmd.event.timestamp",
    FT_UINT64, BASE_HEX_DEC, NULL, 0x0,
    "U3V Event Timestamp", HFILL
    } },

    { &hf_u3v_eventcmd_data,
    { "Data", "u3v.cmd.event.data",
    FT_BYTES, BASE_NONE, NULL, 0x0,
    "U3V Event Data", HFILL
    } },

    /* Pending acknowledge */
    { &hf_u3v_time_to_completion,
    { "Time to completion", "u3v.gencp.timetocompletion",
    FT_UINT16, BASE_DEC, NULL, 0x0,
    "U3V Time to completion [ms]", HFILL
    } },

    { &hf_u3v_reserved,
    { "Reserved", "u3v.reserved",
    FT_BYTES, BASE_NONE, NULL, 0,
    NULL, HFILL
    } },

    /* Custom */
    { &hf_u3v_custom_memory_addr,
    { "Custom Memory Address", "u3v.gencp.custom_addr",
    FT_UINT64, BASE_HEX, NULL, 0x0,
    "U3V Custom Memory Address", HFILL
    } },

    { &hf_u3v_custom_memory_data,
    { "Custom Memory Data", "u3v.gencp.custom_data",
    FT_BYTES, BASE_NONE, NULL, 0x0,
    "U3V Custom Memory Data", HFILL
    } },

    /* Bootstrap Defines */
    { &hf_u3v_bootstrap_GenCP_Version,
    { "GenCP Version", "u3v.bootstrap.GenCP_Version",
    FT_UINT32, BASE_DEC, NULL, 0x0,
    "Complying GenCP Version", HFILL
    } },

    { &hf_u3v_bootstrap_Manufacturer_Name,
    { "Manufacturer Name", "u3v.bootstrap.Manufacturer_Name",
    FT_STRING, BASE_NONE, NULL, 0x0,
    "String containing the self-describing name of the manufacturer", HFILL
    } },

    { &hf_u3v_bootstrap_Model_Name,
    { "Model Name", "u3v.bootstrap.Model_Name",
    FT_STRING, BASE_NONE, NULL, 0x0,
    "String containing the self-describing name of the device model", HFILL
    } },

    { &hf_u3v_bootstrap_Family_Name,
    { "Family Name", "u3v.bootstrap.Family_Name",
    FT_STRING, BASE_NONE, NULL, 0x0,
    "String containing the name of the family of this device", HFILL
    } },

    { &hf_u3v_bootstrap_Device_Version,
    { "Device Version", "u3v.bootstrap.Device_Version",
    FT_STRING, BASE_NONE, NULL, 0x0,
    "String containing the version of this device", HFILL
    } },

    { &hf_u3v_bootstrap_Manufacturer_Info,
    { "Manufacturer Information", "u3v.bootstrap.Manufacturer_Info",
    FT_STRING, BASE_NONE, NULL, 0x0,
    "String containing additional manufacturer information", HFILL
    } },

    { &hf_u3v_bootstrap_Serial_Number,
    { "Serial Number", "u3v.bootstrap.Serial_Number",
    FT_STRING, BASE_NONE, NULL, 0x0,
    "String containing the serial number of the device", HFILL
    } },

    { &hf_u3v_bootstrap_User_Defined_Name,
    { "User Defined Name", "u3v.bootstrap.User_Defined_Name",
    FT_STRING, BASE_NONE, NULL, 0x0,
    "String containing the user defined name of the device", HFILL
    } },

    { &hf_u3v_bootstrap_Device_Capability,
    { "Device Capabilities", "u3v.bootstrap.Device_Capability",
    FT_UINT64, BASE_DEC, NULL, 0x0,
    "Bit field describing the device?s capabilities", HFILL
    } },

    { &hf_u3v_bootstrap_Maximum_Device_Response_Time,
    { "Device Maximum response time in ms", "u3v.bootstrap.Maximum_Device_Response_Time",
    FT_UINT32, BASE_DEC, NULL, 0x0,
    "Maximum response time in ms", HFILL
    } },

    { &hf_u3v_bootstrap_Manifest_Table_Address,
    { "Pointer to the Manifest Table", "u3v.bootstrap.Manifest_Table_Address",
    FT_UINT64, BASE_HEX, NULL, 0x0,
    NULL, HFILL
    } },

    { &hf_u3v_bootstrap_SBRM_Address,
    { "Pointer to the SBRM", "u3v.bootstrap.SBRM_Address",
    FT_UINT64, BASE_HEX, NULL, 0x0,
    "Pointer to the Technology Specific Bootstrap Register Map", HFILL
    } },

    { &hf_u3v_bootstrap_Device_Configuration,
    { "Device Configuration", "u3v.bootstrap.Device_Configuration",
    FT_UINT64, BASE_DEC, NULL, 0x0,
    "Bit field describing the device?s configuration", HFILL
    } },

    { &hf_u3v_bootstrap_Heartbeat_Timeout,
    { "Heartbeat Timeout in ms.", "u3v.bootstrap.Heartbeat_Timeout",
    FT_UINT32, BASE_DEC, NULL, 0x0,
    "Heartbeat Timeout in ms. Not used for these specification.", HFILL
    } },

    { &hf_u3v_bootstrap_Message_Channel_channel_id,
    { "Message channel id", "u3v.bootstrap.Message_Channel_channel_id",
    FT_UINT32, BASE_DEC, NULL, 0x0,
    "channel_id use for the message channel", HFILL
    } },

    { &hf_u3v_bootstrap_Timestamp,
    { "Timestamp", "u3v.bootstrap.Timestamp",
    FT_UINT64, BASE_DEC, NULL, 0x0,
    "Current device time in ns", HFILL
    } },

    { &hf_u3v_bootstrap_Timestamp_Latch,
    { "Latch Timestamp", "u3v.bootstrap.Timestamp_Latch",
    FT_UINT32, BASE_DEC, NULL, 0x0,
    "Timestamp Latch", HFILL
    } },

    { &hf_u3v_bootstrap_Timestamp_Increment,
    { "Timestamp Increment Value", "u3v.bootstrap.Timestamp_Increment",
    FT_UINT64, BASE_DEC, NULL, 0x0,
    "Timestamp Increment", HFILL
    } },

    { &hf_u3v_bootstrap_Access_Privilege,
    { "Access Privilege.", "u3v.bootstrap.Access_Privilege",
    FT_UINT32, BASE_DEC, NULL, 0x0,
    "Access Privilege. Not used for these specification.", HFILL
    } },

    { &hf_u3v_bootstrap_Protocol_Endianness,
    { "Protocol Endianness", "u3v.bootstrap.Protocol_Endianness",
    FT_UINT32, BASE_DEC, NULL, 0x0,
    "Endianness of protocol fields and bootstrap registers. Only little endian is supported by these specification.", HFILL
    } },

    { &hf_u3v_bootstrap_Implementation_Endianness,
    { "Device Endianness", "u3v.bootstrap.Implementation_Endianness",
    FT_UINT32, BASE_DEC, NULL, 0x0,
    "Endianness of device implementation registers.  Only little endian is supported by these specification.", HFILL
    } },

    { &hf_u3v_bootstrap_U3V_Version,
    { "TL Version", "u3v.bootstrap.U3V_Version",
    FT_UINT32, BASE_DEC, NULL, 0x0,
    "Version of the TL specification", HFILL
    } },

    { &hf_u3v_bootstrap_U3VCP_Capability_Register,
    { "Control channel capabilities", "u3v.bootstrap.U3VCP_Capability_Register",
    FT_UINT64, BASE_DEC, NULL, 0x0,
    "Indicates additional features on the control channel", HFILL
    } },

    { &hf_u3v_bootstrap_U3VCP_Configuration_Register,
    { "Control channel configuration", "u3v.bootstrap.U3VCP_Configuration_Register",
    FT_UINT64, BASE_DEC, NULL, 0x0,
    "Configures additional features on the control channel", HFILL
    } },

    { &hf_u3v_bootstrap_Maximum_Command_Transfer_Length,
    { "Maximum Command Transfer Length", "u3v.bootstrap.Maximum_Command_Transfer_Length",
    FT_UINT32, BASE_DEC, NULL, 0x0,
    "Specifies the maximum supported command transfer length of the device", HFILL
    } },

    { &hf_u3v_bootstrap_Maximum_Acknowledge_Transfer_Length,
    { "Maximum Acknowledge Transfer Length", "u3v.bootstrap.Maximum_Acknowledge_Transfer_Length",
    FT_UINT32, BASE_DEC, NULL, 0x0,
    "Specifies the maximum supported acknowledge transfer length of the device", HFILL
    } },

    { &hf_u3v_bootstrap_Number_of_Stream_Channels,
    { "Number of Stream Channels", "u3v.bootstrap.Number_of_Stream_Channels",
    FT_UINT32, BASE_DEC, NULL, 0x0,
    "Number of Stream Channels and its corresponding Streaming Interface Register Maps (SIRM)", HFILL
    } },

    { &hf_u3v_bootstrap_SIRM_Address,
    { "Pointer to the first SIRM", "u3v.bootstrap.SIRM_Address",
    FT_UINT64, BASE_HEX, NULL, 0x0,
    "Pointer to the first Streaming Interface Register Map.", HFILL
    } },

    { &hf_u3v_bootstrap_SIRM_Length,
    { "Length of SIRM", "u3v.bootstrap.SIRM_Length",
    FT_UINT32, BASE_HEX, NULL, 0x0,
    "Specifies the length of each SIRM", HFILL
    } },

    { &hf_u3v_bootstrap_EIRM_Address,
    { "Pointer to the EIRM", "u3v.bootstrap.EIRM_Address",
    FT_UINT64, BASE_HEX, NULL, 0x0,
    "Pointer to the Event Interface Register Map.", HFILL
    } },

    { &hf_u3v_bootstrap_EIRM_Length,
    { "Length of EIRM", "u3v.bootstrap.EIRM_Length",
    FT_UINT32, BASE_DEC, NULL, 0x0,
    "Specifies the length of the EIRM", HFILL
    } },

    { &hf_u3v_bootstrap_IIDC2_Address,
    { "Pointer to the IIDC2", "u3v.bootstrap.IIDC2_Address",
    FT_UINT64, BASE_HEX, NULL, 0x0,
    "Pointer to the IIDC2 register set.", HFILL
    } },

    { &hf_u3v_bootstrap_Current_Speed,
    { "LinkSpeed", "u3v.bootstrap.Current_Speed",
    FT_UINT32, BASE_DEC, NULL, 0x0,
    "Specifies the current speed of the USB link.", HFILL
    } },

    { &hf_u3v_bootstrap_SI_Info,
    { "Stream Info", "u3v.bootstrap.SI_Info",
    FT_UINT32, BASE_DEC, NULL, 0x0,
    "Device reports information about stream interface", HFILL
    } },

    { &hf_u3v_bootstrap_SI_Control,
    { "Stream Control", "u3v.bootstrap.SI_Control",
    FT_UINT32, BASE_DEC, NULL, 0x0,
    "Stream interface Operation Control", HFILL
    } },

    { &hf_u3v_bootstrap_SI_Required_Payload_Size,
    { "Stream Max Required Payload Size", "u3v.bootstrap.SI_Required_Payload_Size",
    FT_UINT64, BASE_DEC, NULL, 0x0,
    "Device reports maximum payload size with current settings", HFILL
    } },

    { &hf_u3v_bootstrap_SI_Required_Leader_Size,
    { "Stream Max Required Leader Size", "u3v.bootstrap.SI_Required_Leader_Size",
    FT_UINT32, BASE_DEC, NULL, 0x0,
    "Device reports maximum leader  size it will use", HFILL
    } },

    { &hf_u3v_bootstrap_SI_Required_Trailer_Size,
    { "Stream Max Required Trailer Size", "u3v.bootstrap.SI_Required_Trailer_Size",
    FT_UINT32, BASE_DEC, NULL, 0x0,
    "Device reports maximum trailer  size it will use", HFILL
    } },

    { &hf_u3v_bootstrap_SI_Maximum_Leader_Size,
    { "Stream Max leader size", "u3v.bootstrap.SI_Maximum_Leader_Size",
    FT_UINT32, BASE_DEC, NULL, 0x0,
    "Maximum leader size", HFILL
    } },

    { &hf_u3v_bootstrap_SI_Payload_Transfer_Size,
    { "Stream transfer size", "u3v.bootstrap.SI_Payload_Transfer_Size",
    FT_UINT32, BASE_DEC, NULL, 0x0,
    "Expected Size of a single Payload Transfer", HFILL
    } },

    { &hf_u3v_bootstrap_SI_Payload_Transfer_Count,
    { "Stream transfer count", "u3v.bootstrap.SI_Payload_Transfer_Count",
    FT_UINT32, BASE_DEC, NULL, 0x0,
    "Expected Number of Payload Transfers", HFILL
    } },

    { &hf_u3v_bootstrap_SI_Payload_Final_Transfer1_Size,
    { "Stream final transfer 1 size", "u3v.bootstrap.SI_Payload_Final_Transfer1_Size",
    FT_UINT32, BASE_DEC, NULL, 0x0,
    "Size of first final Payload transfer", HFILL
    } },

    { &hf_u3v_bootstrap_SI_Payload_Final_Transfer2_Size,
    { "Stream final transfer 2 size", "u3v.bootstrap.SI_Payload_Final_Transfer2_Size",
    FT_UINT32, BASE_DEC, NULL, 0x0,
    "Size of second final Payload transfer", HFILL
    } },

    { &hf_u3v_bootstrap_SI_Maximum_Trailer_Size,
    { "Stream Max trailer size", "u3v.bootstrap.SI_Maximum_Trailer_Size",
    FT_UINT32, BASE_DEC, NULL, 0x0,
    "Maximum trailer size", HFILL
    } },

    { &hf_u3v_bootstrap_EI_Control,
    { "Event Interface Control", "u3v.bootstrap.EI_Control",
    FT_UINT32, BASE_DEC, NULL, 0x0,
    "Event Interface Control Register", HFILL
    } },

    { &hf_u3v_bootstrap_Maximum_Event_Transfer_Length,
    { "Event max Transfer size", "u3v.bootstrap.Maximum_Event_Transfer_Length",
    FT_UINT32, BASE_DEC, NULL, 0x0,
    "Specifies the maximum supported event command transfer length of the device.", HFILL
    } },

    { &hf_u3v_bootstrap_Event_Test_Control,
    { "Event test event control", "u3v.bootstrap.Event_Test_Control",
    FT_UINT32, BASE_DEC, NULL, 0x0,
    "Control the generation of test events.", HFILL
    } },

    { &hf_u3v_stream_prefix,
    { "Stream Prefix", "u3v.stream.prefix",
    FT_UINT32, BASE_HEX, NULL, 0,
    "U3V stream prefix", HFILL
    } },

    { &hf_u3v_stream_reserved,
    { "Reserved", "u3v.stream.reserved",
    FT_BYTES, BASE_NONE, NULL, 0,
    NULL, HFILL
    } },

    { &hf_u3v_stream_leader_size,
    { "Leader Size", "u3v.stream.leader_size",
    FT_UINT16, BASE_DEC, NULL, 0x0,
    "U3V stream leader size", HFILL
    } },

    { &hf_u3v_stream_trailer_size,
    { "Trailer Size", "u3v.stream.trailer_size",
    FT_UINT16, BASE_DEC, NULL, 0x0,
    "U3V stream trailer size", HFILL
    } },

    { &hf_u3v_stream_block_id,
    { "Block ID", "u3v.stream.block_id",
    FT_UINT64, BASE_DEC, NULL, 0x0,
    "U3V stream block id", HFILL
    } },

    { &hf_u3v_stream_payload_type,
    { "Payload Type", "u3v.stream.payload_type",
    FT_UINT16, BASE_HEX, VALS( payload_type_names ), 0x0,
    "U3V Payload Type", HFILL
    } },

    { &hf_u3v_stream_timestamp,
    { "Timestamp", "u3v.stream.timestamp",
    FT_UINT64, BASE_HEX_DEC, NULL, 0x0,
    "U3V Stream Timestamp", HFILL
    } },

    { &hf_u3v_stream_pixel_format,
    { "Pixel Format", "u3v.stream.pixel_format",
    FT_UINT32, BASE_HEX|BASE_EXT_STRING, VALS_EXT_PTR( &pixel_format_names_ext ), 0x0,
    "U3V Stream Pixel Format", HFILL
    } },

    { &hf_u3v_stream_size_x,
    { "Size X", "u3v.stream.sizex",
    FT_UINT32, BASE_DEC, NULL, 0x0,
    "U3V Stream Size X", HFILL
    } },

    { &hf_u3v_stream_size_y,
    { "Size Y", "u3v.stream.sizey",
    FT_UINT32, BASE_DEC, NULL, 0x0,
    "U3V Stream Size Y", HFILL
    } },

    { &hf_u3v_stream_offset_x,
    { "Offset X", "u3v.stream.offsetx",
    FT_UINT32, BASE_DEC, NULL, 0x0,
    "U3V Stream Offset X", HFILL
    } },

    { &hf_u3v_stream_offset_y,
    { "Offset Y", "u3v.stream.offsety",
    FT_UINT32, BASE_DEC, NULL, 0x0,
    "U3V Stream Offset Y", HFILL
    } },

    { &hf_u3v_stream_padding_x,
    { "Padding X", "u3v.stream.paddingx",
    FT_UINT16, BASE_DEC, NULL, 0x0,
    "U3V Stream Padding X", HFILL
    } },

    { &hf_u3v_stream_chunk_layout_id,
    { "Chunk Layout ID", "u3v.stream.chunk_layout_id",
    FT_UINT32, BASE_HEX, NULL, 0x0,
    "U3V Stream Chunk Layout ID", HFILL
    } },

    { &hf_u3v_stream_valid_payload_size,
    { "Valid Payload Size", "u3v.stream.valid_payload_size",
    FT_UINT64, BASE_HEX, NULL, 0x0,
    "U3V Stream Valid Payload Size", HFILL
    } },

    { &hf_u3v_stream_status,
    { "Status", "u3v.stream.status",
    FT_UINT16, BASE_HEX, VALS( status_names ), 0x0,
    "U3V Stream Status", HFILL
    } },

    { &hf_u3v_stream_data,
    { "Payload Data", "u3v.stream.data",
    FT_BYTES, BASE_NONE, NULL, 0x0,
    "U3V Stream Payload Data", HFILL
    } },

    /* U3V device info descriptor */
    { &hf_u3v_device_info_descriptor_bLength,
    { "bLength", "u3v.device_info.bLength",
    FT_UINT8, BASE_DEC, NULL, 0x0,
    NULL, HFILL } },

    { &hf_u3v_device_info_descriptor_bDescriptorType,
    { "bDescriptorType", "u3v.device_info.bDescriptorType",
    FT_UINT8, BASE_HEX, NULL, 0x0,
    NULL, HFILL } },

    { &hf_u3v_device_info_descriptor_bDescriptorSubtype,
    { "bDescriptorSubtype", "u3v.device_info.bDescriptorSubtype",
    FT_UINT8, BASE_HEX, VALS( u3v_descriptor_subtypes ), 0x0,
    NULL, HFILL } },

    { &hf_u3v_device_info_descriptor_bGenCPVersion,
    { "bGenCPVersion", "u3v.device_info.bGenCPVersion",
    FT_NONE, BASE_NONE, NULL, 0x0,
    NULL, HFILL } },

    { &hf_u3v_device_info_descriptor_bGenCPVersion_minor,
    { "Minor Version", "u3v.device_info.bGenCPVersion.minor",
    FT_UINT32, BASE_DEC, NULL, 0x0000FFFF,
    NULL, HFILL } },

    { &hf_u3v_device_info_descriptor_bGenCPVersion_major,
    { "Major Version", "u3v.device_info.bGenCPVersion.major",
    FT_UINT32, BASE_DEC, NULL, 0xFFFF0000,
    NULL, HFILL } },

    { &hf_u3v_device_info_descriptor_bU3VVersion,
    { "bU3VVersion", "u3v.device_info.bU3VVersion",
    FT_NONE, BASE_NONE, NULL, 0x0,
    NULL, HFILL } },

    { &hf_u3v_device_info_descriptor_bU3VVersion_minor,
    { "Minor Version", "u3v.device_info.bU3VVersion.minor",
    FT_UINT32, BASE_DEC, NULL, 0x0000FFFF,
    NULL, HFILL } },

    { &hf_u3v_device_info_descriptor_bU3VVersion_major,
    { "Major Version", "u3v.device_info.bU3VVersion.major",
    FT_UINT32, BASE_DEC, NULL, 0xFFFF0000,
    NULL, HFILL } },

    { &hf_u3v_device_info_descriptor_iDeviceGUID,
    { "iDeviceGUID", "u3v.device_info.iDeviceGUID",
    FT_UINT8, BASE_DEC, NULL, 0x0,
    NULL, HFILL } },

    { &hf_u3v_device_info_descriptor_iVendorName,
    { "iVendorName", "u3v.device_info.iVendorName",
    FT_UINT8, BASE_DEC, NULL, 0x0,
    NULL, HFILL } },

    { &hf_u3v_device_info_descriptor_iModelName,
    { "iModelName", "u3v.device_info.iModelName",
    FT_UINT8, BASE_DEC, NULL, 0x0,
    NULL, HFILL } },

    { &hf_u3v_device_info_descriptor_iFamilyName,
    { "iFamilyName", "u3v.device_info.iFamilyName",
    FT_UINT8, BASE_DEC, NULL, 0x0,
    NULL, HFILL } },

    { &hf_u3v_device_info_descriptor_iDeviceVersion,
    { "iDeviceVersion", "u3v.device_info.iDeviceVersion",
    FT_UINT8, BASE_DEC, NULL, 0x0,
    NULL, HFILL } },

    { &hf_u3v_device_info_descriptor_iManufacturerInfo,
    { "iManufacturerInfo", "u3v.device_info.iManufacturerInfo",
    FT_UINT8, BASE_DEC, NULL, 0x0,
    NULL, HFILL } },

    { &hf_u3v_device_info_descriptor_iSerialNumber,
    { "iSerialNumber", "u3v.device_info.iSerialNumber",
    FT_UINT8, BASE_DEC, NULL, 0x0,
    NULL, HFILL } },

    { &hf_u3v_device_info_descriptor_iUserDefinedName,
    { "iUserDefinedName", "u3v.device_info.iUserDefinedName",
    FT_UINT8, BASE_DEC, NULL, 0x0,
    NULL, HFILL } },

    { &hf_u3v_device_info_descriptor_bmSpeedSupport,
    { "bmSpeedSupport", "u3v.device_info.bmSpeedSupport",
    FT_UINT8, BASE_HEX, NULL, 0x0,
    NULL, HFILL } },

    { &hf_u3v_device_info_descriptor_bmSpeedSupport_low_speed,
    { "Low-Speed", "u3v.device_info.bmSpeedSupport.lowSpeed",
    FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
    NULL, HFILL } },

    { &hf_u3v_device_info_descriptor_bmSpeedSupport_full_speed,
    { "Full-Speed", "u3v.device_info.bmSpeedSupport.fullSpeed",
    FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
    NULL, HFILL } },

    { &hf_u3v_device_info_descriptor_bmSpeedSupport_high_speed,
    { "High-Speed", "u3v.device_info.bmSpeedSupport.highSpeed",
    FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
    NULL, HFILL } },

    { &hf_u3v_device_info_descriptor_bmSpeedSupport_super_speed,
    { "Super-Speed", "u3v.device_info.bmSpeedSupport.superSpeed",
    FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
    NULL, HFILL } },

    { &hf_u3v_device_info_descriptor_bmSpeedSupport_reserved,
    { "Reserved", "u3v.device_info.bmSpeedSupport.reserved",
    FT_UINT8, BASE_HEX, NULL, 0xF0,
    NULL, HFILL } },

    { &hf_u3v_scd_readmem_cmd,
    { "SCD: READMEM_CMD", "u3v.scd_readmem_cmd",
    FT_NONE, BASE_NONE, NULL, 0x0,
    NULL, HFILL } },

    { &hf_u3v_scd_writemem_cmd,
    { "SCD: WRITEMEM_CMD", "u3v.scd_writemem_cmd",
    FT_NONE, BASE_NONE, NULL, 0x0,
    NULL, HFILL } },

    { &hf_u3v_scd_event_cmd,
    { "SCD: EVENT_CMD", "u3v.scd_event_cmd",
    FT_NONE, BASE_NONE, NULL, 0x0,
    NULL, HFILL } },

    { &hf_u3v_scd_ack_readmem_ack,
    { "SCD: READMEM_ACK", "u3v.scd_ack_readmem_ack",
    FT_NONE, BASE_NONE, NULL, 0x0,
    NULL, HFILL } },

    { &hf_u3v_scd_writemem_ack,
    { "SCD: WRITEMEM_ACK", "u3v.scd_writemem_ack",
    FT_NONE, BASE_NONE, NULL, 0x0,
    NULL, HFILL } },

    { &hf_u3v_ccd_pending_ack,
    { "CCD: PENDING_ACK", "u3v.ccd_pending_ack",
    FT_NONE, BASE_NONE, NULL, 0x0,
    NULL, HFILL } },

    { &hf_u3v_stream_leader,
    { "Stream: Leader", "u3v.stream_leader",
    FT_NONE, BASE_NONE, NULL, 0x0,
    NULL, HFILL } },

    { &hf_u3v_stream_trailer,
    { "Stream: Trailer", "u3v.stream_trailer",
    FT_NONE, BASE_NONE, NULL, 0x0,
    NULL, HFILL } },

    { &hf_u3v_stream_payload,
    { "Stream: Payload", "u3v.stream_payload",
    FT_NONE, BASE_NONE, NULL, 0x0,
    NULL, HFILL } },

    { &hf_u3v_ccd_cmd,
    { "CCD", "u3v.ccd_cmd",
    FT_NONE, BASE_NONE, NULL, 0x0,
    NULL, HFILL } },

    { &hf_u3v_ccd_ack,
    { "CCD", "u3v.ccd_ack",
    FT_NONE, BASE_NONE, NULL, 0x0,
    NULL, HFILL } },

    { &hf_u3v_device_info_descriptor,
    { "U3V DEVICE INFO DESCRIPTOR", "u3v.device_info_descriptor",
    FT_NONE, BASE_NONE, NULL, 0x0,
    NULL, HFILL } }
};

void
proto_register_u3v(void)
{
    static gint *ett[] = {
        &ett_u3v,
        &ett_u3v_cmd,
        &ett_u3v_flags,
        &ett_u3v_ack,
        &ett_u3v_payload_cmd,
        &ett_u3v_payload_ack,
        &ett_u3v_payload_ack_subtree,
        &ett_u3v_payload_cmd_subtree,
        &ett_u3v_bootstrap_fields,
        &ett_u3v_stream_leader,
        &ett_u3v_stream_trailer,
        &ett_u3v_stream_payload,
        &ett_u3v_device_info_descriptor,
        &ett_u3v_device_info_descriptor_speed_support,
        &ett_u3v_device_info_descriptor_gencp_version,
        &ett_u3v_device_info_descriptor_u3v_version,
    };

    proto_u3v = proto_register_protocol("USB 3 Vision", "U3V", "u3v");
    proto_register_field_array(proto_u3v, hf, array_length(hf));
    proto_register_subtree_array(ett, array_length(ett));
    u3v_handle = register_dissector("u3v", dissect_u3v, proto_u3v);
}



void
proto_reg_handoff_u3v(void)
{
    dissector_handle_t u3v_descr_handle = NULL;

    dissector_add_uint("usb.bulk", IF_CLASS_MISCELLANEOUS, u3v_handle);
    heur_dissector_add("usb.bulk", dissect_u3v_heur, "USB3Vision Protocol", "u3v", proto_u3v,HEURISTIC_ENABLE);
    u3v_descr_handle = create_dissector_handle(dissect_u3v_descriptors, proto_u3v);
    dissector_add_uint("usb.descriptor", IF_CLASS_MISCELLANEOUS, u3v_descr_handle);
}

/*
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
 *
 * Local variables:
 * c-basic-offset: 4
 * tab-width: 8
 * indent-tabs-mode: nil
 * End:
 *
 * vi: set shiftwidth=4 tabstop=8 expandtab:
 * :indentSize=4:tabSize=8:noTabs=true:
 */