r_vdce_api.h 169 KB
Newer Older
hu's avatar
hu committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217
/*
****************************************************************************
PROJECT : VDCE driver
FILE    : $Id: r_vdce_api.h 15479 2018-01-11 14:04:31Z florian.zimmermann $
============================================================================
DESCRIPTION
Driver for the VDCE macro
============================================================================
                            C O P Y R I G H T
============================================================================
                           Copyright (c) 2013 - 2014
                                  by
                       Renesas Electronics (Europe) GmbH.
                           Arcadiastrasse 10
                          D-40472 Duesseldorf
                               Germany
                          All rights reserved.
============================================================================

DISCLAIMER

LICENSEE has read, understood and accepted the terms and conditions defined in
the license agreement, especially the usage rights. In any case, it is
LICENSEE's responsibility to make sure that any user of the software complies
with the terms and conditions of the signed license agreement.

****************************************************************************
*/

/***************************************************************************
  Title: VDCE Driver API

  VDCE (Video Data Controller E) driver API.

  VDCE driver controls VDCE H/W macro and accesses only register of VDCE H/W macro.

  An application using VDCE driver should include the following header files.

  * r_typedefs.h
  * r_ddb_api.h
  * r_vdce_api.h

*/

#ifndef R_VDCE_API_H
#define R_VDCE_API_H

#ifdef __cplusplus
extern "C" {
#endif


/***************************************************************************
  Section: Global Defines
*/

/***************************************************************************
  Constants: API Version

  This constant is the value which shows the version information of the VDCE driver.
  It refers at the <R_VDCE_VersionStringGet> function.
  High and Low number of the API version

  Values:
  R_VDCE_VERSION_HI - This constant is the high byte of the version information.
                      It is major version information.
  R_VDCE_VERSION_LO - This constant is the low byte of the version information.
                      It is miner version information.
*/

#define R_VDCE_VERSION_HI  1
#define R_VDCE_VERSION_LO  16

/***************************************************************************
  Constants: Layer Number

  The definition of the layer to specify a layer.

  R_VDCE_LAYER_SCALER0 - This constant is Scaler 0.
  R_VDCE_LAYER_SCALER1 - This constant is Scaler 1.
  R_VDCE_LAYER_IMAGE2  - This constant is Image Synthesizer 2.
  R_VDCE_LAYER_IMAGE3  - This constant is Image Synthesizer 3.
  R_VDCE_LAYER_INPUT   - This constant is Input Controller.
*/

#define R_VDCE_LAYER_SCALER0           (0u)
#define R_VDCE_LAYER_SCALER1           (R_VDCE_LAYER_SCALER0 + 1u)
#define R_VDCE_LAYER_IMAGE2            (R_VDCE_LAYER_SCALER1 + 1u)
#define R_VDCE_LAYER_IMAGE3            (R_VDCE_LAYER_IMAGE2  + 1u)
#define R_VDCE_LAYER_LAST              (R_VDCE_LAYER_IMAGE3  + 1u)

#define R_VDCE_LAYER_INPUT             (R_VDCE_LAYER_LAST    + 1u)

/***************************************************************************
  Constants: Capture without display

  This is used when specifying capturing without the display by <R_VDCE_CapEnable>.

  Values:
  R_VDCE_CAP_NO_DISPLAY - Capture without display.
*/

#define R_VDCE_CAP_NO_DISPLAY  (0xFFFFFFFFu)


/***************************************************************************
  Constants: Number of Gamma correction area 

  The definition of the number of area to gamma correction.

  Values:
  R_VDCE_GAMMA_AREA_NUM - Number of Gamma correction area.
*/

#define R_VDCE_GAMMA_AREA_NUM  (32u)

/***************************************************************************
  Section: Global Types
*/
/***************************************************************************
  Group: Enumerations and Types
*/

/***************************************************************************
  Enum: r_vdce_Error_t

  Description:
  The type describes the error code of VDCE driver functions.

  Values:
  R_VDCE_ERR_OK                    - No error has occurred.
  R_VDCE_ERR_NG                    - An error has occurred,
                                     but no specific error code is defined for it.
  R_VDCE_ERR_PARAM_INCORRECT       - A parameter provided to a function is incorrect.
  R_VDCE_ERR_RANGE_UNIT            - The unit-number is the outside of the range.
  R_VDCE_ERR_RANGE_PARAM           - A parameter is the outside of the range.
  R_VDCE_ERR_NOT_ACCEPTABLE        - A function was called in an incorrect state.
  R_VDCE_ERR_FATAL_OS              - Fatal Error has occurred at OS interface.
  R_VDCE_ERR_FATAL_HW              - Fatal Error has occurred at H/W.
  R_VDCE_ERR_RANGE_LAYER           - The layer-number is the outside of the range.
  R_VDCE_ERR_UNIT_LOCKED           - VDCE is already initialized.
  R_VDCE_ERR_UNIT_NOTLOCKED        - VDCE is not initialized.
  R_VDCE_ERR_DISPLAY_NO_TIMING     - <R_VDCE_DisplayTimingSet> is not done.
  R_VDCE_ERR_LAYER_NO_FORMAT       - <R_VDCE_LayerFormatSet> or <R_VDCE_OirFormatSet> is not done.
  R_VDCE_ERR_LAYER_NO_MEM_GEOMETRY - <R_VDCE_LayerMemGeometrySet> or <R_VDCE_OirMemGeometrySet>
                                     is not done.
  R_VDCE_ERR_LAYER_NO_VIEW_PORT    - <R_VDCE_LayerViewPortSet> or <R_VDCE_OirViewPortSet>
                                     is not done.
  R_VDCE_ERR_LAYER_NO_BASE         - <R_VDCE_LayerBaseSet> or <R_VDCE_OirBaseSet> is not done.
  R_VDCE_ERR_CAP_NO_BUF_GEOMETRY   - <R_VDCE_CapBufGeometrySetup> is not done.
  R_VDCE_ERR_CAP_NO_MODE           - <R_VDCE_CapModeSet> is not done.
  R_VDCE_ERR_PIXELCLOCK            - It failed in the pixel clock setting.
  R_VDCE_ERR_STRIDE_INCORRECT      - The setting of Stride is incorrect.
  R_VDCE_ERR_CHROMAKEY_INCORRECT   - The setting of Chroma-key is incorrect.
  R_VDCE_ERR_SCALED_SIZE_INCORRECT - The setting of Scaled size is incorrect.
  R_VDCE_ERR_INTERRUPT_ENABLED     - Enabled interrupt is remained.
  R_VDCE_ERR_NOT_SUPPORTED         - The function is not supported with target device.
*/

typedef enum
{
    R_VDCE_ERR_OK = 0,
    R_VDCE_ERR_NG,
    R_VDCE_ERR_PARAM_INCORRECT,
    R_VDCE_ERR_RANGE_UNIT,
    R_VDCE_ERR_RANGE_PARAM,
    R_VDCE_ERR_NOT_ACCEPTABLE,
    R_VDCE_ERR_FATAL_OS,
    R_VDCE_ERR_FATAL_HW,
    R_VDCE_ERR_RANGE_LAYER,
    R_VDCE_ERR_UNIT_LOCKED,
    R_VDCE_ERR_UNIT_NOTLOCKED,
    R_VDCE_ERR_DISPLAY_NO_TIMING,
    R_VDCE_ERR_LAYER_NO_FORMAT,
    R_VDCE_ERR_LAYER_NO_MEM_GEOMETRY,
    R_VDCE_ERR_LAYER_NO_VIEW_PORT,
    R_VDCE_ERR_LAYER_NO_BASE,
    R_VDCE_ERR_CAP_NO_BUF_GEOMETRY,
    R_VDCE_ERR_CAP_NO_MODE,
    R_VDCE_ERR_PIXEL_CLOCK,
    R_VDCE_ERR_STRIDE_INCORRECT,
    R_VDCE_ERR_CHROMAKEY_INCORRECT,
    R_VDCE_ERR_SCALED_SIZE_INCORRECT,
    R_VDCE_ERR_INTERRUPT_ENABLED,
    R_VDCE_ERR_NOT_SUPPORTED,
    R_VDCE_ERR_LAST
} r_vdce_Error_t;

/***************************************************************************
  Enum: r_vdce_IntType_t

  Description:
  This type holds the different interrupt types.
  In the function <R_VDCE_IntcEnable> they must be order to enable multiple interrupts
  at the same time.

  Values:
  R_VDCE_INTC_NONE                   - No interrupt event.
  R_VDCE_INTC_VBLANK                 - VBLANK signal from timing controller 0.
  R_VDCE_INTC_VBLANK_1               - VBLANK signal from timing controller 1.
  R_VDCE_INTC_SCANLINE               - This event is caused if a special scan line in video
                                       output is hit.
  R_VDCE_INTC_NO_VI_VSYNC_SIGNAL     - No VSync signal from video input at video layer 0.
  R_VDCE_INTC_NO_VI_VSYNC_SIGNAL_1   - No VSync signal from video input at video layer 1.
  R_VDCE_INTC_OIR_SCANLINE           - This event is caused if a special scan line in video
                                       output is hit.
  R_VDCE_INTC_OIR_VBLANK             - VBLANK signal from timing controller OIR.
  R_VDCE_INTC_OIR_VSCYNC_WRITE       - Vsync signal from timing controller OIR.
  R_VDCE_INTC_ERR_OIR_UNDERFLOW      - Underflow during reading in output image renderer interface.
  R_VDCE_INTC_ERR_LAYER0_UNDERFLOW   - Underflow during reading in layer 0 interface.
  R_VDCE_INTC_ERR_LAYER1_UNDERFLOW   - Underflow during reading in layer 1 interface.
  R_VDCE_INTC_ERR_LAYER2_UNDERFLOW   - Underflow during reading in layer 2 interface.
  R_VDCE_INTC_ERR_LAYER3_UNDERFLOW   - Underflow during reading in layer 3 interface.
  R_VDCE_INTC_CAP_VBLANK             - Captured external VSYNC input. 
  R_VDCE_INTC_CAP_END_OF_FIELD       - Undefined.
  R_VDCE_INTC_ERR_CAP_WRITE_OVERFLOW - Frame buffer write overflow with captured data.

*/

typedef enum
{
    R_VDCE_INTC_NONE                   = 0,
    R_VDCE_INTC_VBLANK                 = 1, /* R_VDCE_S0_LO_VSYNC */
    R_VDCE_INTC_VBLANK_1               = 2, /* R_VDCE_S1_LO_VSYNC */
    R_VDCE_INTC_VBLANK_DELAY           = 3, /* R_VDCE_GR3_VBLANK delayed for discom */
    R_VDCE_INTC_SCANLINE               = 4, /* R_VDCE_GR3_VLINE */
    R_VDCE_INTC_OIR_SCANLINE           = 5, /* R_VDCE_OIR_VLINE */
    R_VDCE_INTC_OIR_VBLANK             = 6, /* R_VDCE_OIR_LO_VSYNC */
    R_VDCE_INTC_OIR_VSCYNC_WRITE       = 7, /* R_VDCE_OIR_VI_VSYNC */
    R_VDCE_INTC_ERROR                  = 8, /* R_VDCE_S0_LO_VSYNC */ 
    R_VDCE_INTC_NO_VI_VSYNC_SIGNAL     = 9, /* R_VDCE_S0_VSYNCERR */
    R_VDCE_INTC_NO_VI_VSYNC_SIGNAL_1   = 10, /* R_VDCE_S1_VSYNCERR */
    R_VDCE_INTC_ERR_OIR_UNDERFLOW      = 11, /* R_VDCE_IV8_VBUFERR */
    R_VDCE_INTC_ERR_LAYER0_UNDERFLOW   = 12, /* R_VDCE_IV3_VBUFERR */
    R_VDCE_INTC_ERR_LAYER1_UNDERFLOW   = 13, /* R_VDCE_IV4_VBUFERR */
    R_VDCE_INTC_ERR_LAYER2_UNDERFLOW   = 14, /* R_VDCE_IV5_VBUFERR */
    R_VDCE_INTC_ERR_LAYER3_UNDERFLOW   = 15, /* R_VDCE_IV6_VBUFERR */
    R_VDCE_INTC_CAP_VBLANK             = 16, /* R_VDCE_S0_VI_VSYNC */
    R_VDCE_INTC_CAP_END_OF_FIELD       = 17, /* R_VDCE_S0_VFIELD */
    R_VDCE_INTC_ERR_CAP_WRITE_OVERFLOW = 18, /* R_VDCE_IV1_VBUFERR */
    R_VDCE_INTC_MAX                    = 19  /* End of table */
} r_vdce_IntType_t;

/***************************************************************************
  Enum: r_vdce_OutEndian_t

  Description:
  This type is used to select the output data endian in the function <R_VDCE_DisplayOutEndianSet>.
  According to the combination with <r_vdce_OutEndian_t> and <r_vdce_OutFormat_t>, LCD data is as followed.

> r_vdce_OutFormat_t |            RGB888              |            RGB666              |            RGB565              |
> r_vdce_OutSwap_t   |  OFF     OFF      ON     ON    |  OFF     OFF      ON     ON    |  OFF     OFF      ON     ON    |
> r_vdce_OutEndian_t | LITTLE   BIG    LITTLE   BIG   | LITTLE   BIG    LITTLE   BIG   | LITTLE   BIG    LITTLE   BIG   |
> -------------------+--------------------------------+--------------------------------+--------------------------------+
>    LCD_DATA23      |  R[7]    R[0]    B[7]    B[0]  |   0       0       0       0    |   0       0       0       0    |
>         :          |   :       :       :       :    |   :       :       :       :    |   :       :       :       :    |
>    LCD_DATA18      |  R[2]    R[5]    B[2]    B[5]  |   0       0       0       0    |   0       0       0       0    |
>    LCD_DATA17      |  R[1]    R[6]    B[1]    B[6]  |  R[7]    R[2]    B[7]    B[2]  |   0       0       0       0    |
>    LCD_DATA16      |  R[0]    R[7]    B[0]    B[7]  |  R[6]    R[3]    B[6]    B[3]  |   0       0       0       0    |
>    LCD_DATA15      |  G[7]    G[0]    G[7]    G[0]  |  R[5]    R[4]    B[5]    B[4]  |  R[7]    R[3]    B[7]    B[3]  |
>    LCD_DATA14      |  G[6]    G[1]    G[6]    G[1]  |  R[4]    R[5]    B[4]    B[5]  |  R[6]    R[4]    B[6]    B[4]  |
>    LCD_DATA13      |  G[5]    G[2]    G[5]    G[2]  |  R[3]    R[6]    B[3]    B[6]  |  R[5]    R[5]    B[5]    B[5]  |
>    LCD_DATA12      |  G[4]    G[3]    G[4]    G[3]  |  R[2]    R[7]    B[2]    B[7]  |  R[4]    R[6]    B[4]    B[6]  |
>    LCD_DATA11      |  G[3]    G[4]    G[3]    G[4]  |  G[7]    G[2]    G[7]    G[2]  |  R[3]    R[7]    B[3]    B[7]  |
>    LCD_DATA10      |  G[2]    G[5]    G[2]    G[5]  |  G[6]    G[3]    G[6]    G[3]  |  G[7]    G[2]    G[7]    G[2]  |
>    LCD_DATA9       |  G[1]    G[6]    G[1]    G[6]  |  G[5]    G[4]    G[5]    G[4]  |  G[6]    G[3]    G[6]    G[3]  |
>    LCD_DATA8       |  G[0]    G[7]    G[0]    G[7]  |  G[4]    G[5]    G[4]    G[5]  |  G[5]    G[4]    G[5]    G[4]  |
>    LCD_DATA7       |  B[7]    B[0]    R[7]    R[0]  |  G[3]    G[6]    G[3]    G[6]  |  G[4]    G[5]    G[4]    G[5]  |
>    LCD_DATA6       |  B[6]    B[1]    R[6]    R[1]  |  G[2]    G[7]    G[2]    G[7]  |  G[3]    G[6]    G[3]    G[6]  |
>    LCD_DATA5       |  B[5]    B[2]    R[5]    R[2]  |  B[7]    B[2]    R[7]    R[2]  |  G[2]    G[7]    G[2]    G[7]  |
>    LCD_DATA4       |  B[4]    B[3]    R[4]    R[3]  |  B[6]    B[3]    R[6]    R[3]  |  B[7]    B[3]    R[7]    R[3]  |
>         :          |   :       :       :       :    |   :       :       :       :    |   :       :       :       :    |
>    LCD_DATA0       |  B[0]    B[7]    R[0]    R[7]  |  B[2]    B[7]    R[2]    R[7]  |  B[3]    B[7]    R[3]    R[7]  |
> -------------------+--------------------------------+--------------------------------+--------------------------------+


  Values:
  R_VDCE_OUT_ENDIAN_LITTLE - Output data is little endian.
  R_VDCE_OUT_ENDIAN_BIG    - Output data is big endian.
*/
typedef enum
{
    R_VDCE_OUT_ENDIAN_LITTLE = 0,
    R_VDCE_OUT_ENDIAN_BIG,
    R_VDCE_OUT_ENDIAN_LAST
} r_vdce_OutEndian_t;

/***************************************************************************
  Enum: r_vdce_OutSwap_t

  Description:
  This type is used to select whether the output data' blue and red is swapped <R_VDCE_DisplayOutSwapBR>.

  Values:
  R_VDCE_OUT_SWAP_BR_OFF - Output data red & blue is not changed
  R_VDCE_OUT_SWAP_BR_ON  - Output data' blue channel is swapped with red
*/
typedef enum
{
    R_VDCE_OUT_SWAP_BR_OFF = 0,
    R_VDCE_OUT_SWAP_BR_ON,
    R_VDCE_OUT_SWAP_BR_LAST
} r_vdce_OutSwap_t;

/***************************************************************************
  typedef: r_vdce_Hsync_t

  Description:
  The structure holding the value of TCON reference timing in the function 
  <R_VDCE_DisplayHsyncSet> and <R_VDCE_DisplayHsyncGet>.

  Struct members:
  Half     - Clock count from the rising edge of the Hsync signal as the counting timing 
             of horizontal counter. 1/2fH Timing. Range is 0 to 0x7FF.
  Offset   - Offset Hsync Signal Timing. The clock cycle count from the rising edge of 
             the Hsync signal. Range is 0 to 0x7FF.
*/

typedef struct
{
    uint16_t Half;
    uint16_t Offset;
} r_vdce_Hsync_t;

/***************************************************************************
  Enum: r_vdce_Pin_t

  Description:
  This type is used to select a specific signal in the function <R_VDCE_DisplaySignalSet>, 
  <R_VDCE_DisplaySignalGet>, <R_VDCE_DisplayTconPinSet> and <R_VDCE_DisplayTconPinGet>.

  Values:
  R_VDCE_PIN_ENABLE  - DE        Data enable signal.
  R_VDCE_PIN_VSYNC   - STVA/VS   Vsync signal.
  R_VDCE_PIN_HSYNC   - STH/SP/HS Hsync signal.
  R_VDCE_PIN_VSYNC_E - STVB/VE   Gate start signal / Vertical enable signal.
  R_VDCE_PIN_HSYNC_E - STB/LP/HE Source strobe signal / Horizontal enable signal.
  R_VDCE_PIN_CPV_GCK - CPV/GCK   Gate clock signal.
  R_VDCE_PIN_POLA    - POLA      VCOM voltage polarity control signal A.
  R_VDCE_PIN_POLB    - POLB      VCOM voltage polarity control signal B.
*/

typedef enum
{
    R_VDCE_PIN_ENABLE = 0,
    R_VDCE_PIN_VSYNC,
    R_VDCE_PIN_HSYNC,
    R_VDCE_PIN_VSYNC_E,
    R_VDCE_PIN_HSYNC_E,
    R_VDCE_PIN_CPV_GCK,
    R_VDCE_PIN_POLA,
    R_VDCE_PIN_POLB,
    R_VDCE_PIN_LAST
} r_vdce_Pin_t;

/***************************************************************************
  Enum: r_vdce_TconPolmode_t

  Description:
  This type is used to select the signal generation mode in the function 
  <R_VDCE_DisplaySignalSet> and <R_VDCE_DisplaySignalGet>.

  Values:
  R_VDCE_TCON_POLMD_NORMAL - Normal mode. 
                             Generates the signal that changes twice a horizontal period.
  R_VDCE_TCON_POLMD_1X1REV - 1x1 reverse mode. 
                             Generates the signal whose polarity is inverted every horizontal period.
  R_VDCE_TCON_POLMD_1X2REV - 1x2 reverse mode
                             Generates the signal whose polarity is inverted in the first horizontal 
                             period and is subsequently inverted every two horizontal periods.
  R_VDCE_TCON_POLMD_2X2REV - 2x2 reverse mode
                             Generates the signal whose polarity is inverted every two horizontal periods.
*/

typedef enum
{
    R_VDCE_TCON_POLMD_NORMAL = 0,
    R_VDCE_TCON_POLMD_1X1REV,
    R_VDCE_TCON_POLMD_1X2REV,
    R_VDCE_TCON_POLMD_2X2REV,
    R_VDCE_TCON_POLMD_LAST
} r_vdce_TconPolmode_t;

/***************************************************************************
  Enum: r_vdce_TconRefsel_t

  Description:
  This type is used to select the signal operating reference in the function 
  <R_VDCE_DisplaySignalSet> and <R_VDCE_DisplaySignalGet>.

  Values:
  R_VDCE_TCON_REFSEL_HSYNC    - Hsync signal reference
  R_VDCE_TCON_REFSEL_OFFSET_H - Offset Hsync signal reference
*/

typedef enum
{
    R_VDCE_TCON_REFSEL_HSYNC = 0,
    R_VDCE_TCON_REFSEL_OFFSET_H,
    R_VDCE_TCON_REFSEL_LAST
} r_vdce_TconRefsel_t;

/***************************************************************************
  typedef: r_vdce_Signal_t

  Description:
  The structure holding the value of TCON signal configuration in the function 
  <R_VDCE_DisplaySignalSet> and <R_VDCE_DisplaySignalGet>.

  Struct members:
  TconHsvs  - Signal Pulse Start Position (First Changing Timing). 
              If signal type is <R_VDCE_PIN_VSYNC> or <R_VDCE_PIN_VSYNC_E>, 
              Starts pulse output after the time specified by this value from the rising edge of 
              the Vsync signal (1/2fH cycles). Range is 0 to 0x7FF.
              If signal type is <R_VDCE_PIN_HSYNC>, <R_VDCE_PIN_HSYNC_E> or <R_VDCE_PIN_CPV_GCK>, 
              Starts pulse output after the time specified by this value + 1 from the rising edge of 
              the Hsync signal (clock cycles). Range is 0 to 0x7FF.
              If signal type is <R_VDCE_PIN_POLA> or <R_VDCE_PIN_POLB>, 
              Starts pulse output after the time specified by this value from the rising edge of 
              the Hsync signal (clock cycles). 
              If signal generation mode is <R_VDCE_TCON_POLMD_NORMAL>, range is 0 to 0x7FF.
              If signal generation mode is not <R_VDCE_TCON_POLMD_NORMAL>, range is 1 to 0x7FF.
  TconHwvw  - Pulse Width (Second Changing Timing). Range is 0 to 0x7FF.
              Outputs a pulse of the duration of this value.
              If signal type is <R_VDCE_PIN_VSYNC> or <R_VDCE_PIN_VSYNC_E>, the value is by the 
              1/2fH cycles. Otherwise, the value is by the clock cycles.
  TconMd    - Signal generation mode select. 
              This is valid when signal type is <R_VDCE_PIN_POLA> or <R_VDCE_PIN_POLB>.
  TconHsSel - Signal operating reference select.
              This is valid when signal type is not <R_VDCE_PIN_VSYNC> or <R_VDCE_PIN_VSYNC_E>.
*/

typedef struct
{
    uint16_t             TconHsvs;
    uint16_t             TconHwvw;
    r_vdce_TconPolmode_t TconMd;
    r_vdce_TconRefsel_t  TconHsSel;
} r_vdce_Signal_t;

/***************************************************************************
  Enum: r_vdce_TconPin_t

  Description:
  This type is used to select the output pin for LCD driving signal 
  in the function <R_VDCE_DisplayTconPinSet> and <R_VDCE_DisplayTconPinGet>.

  Values:
  R_VDCE_TCON_PIN_0   - Pin0
  R_VDCE_TCON_PIN_1   - Pin1
  R_VDCE_TCON_PIN_2   - Pin2
  R_VDCE_TCON_PIN_3   - Pin3
  R_VDCE_TCON_PIN_4   - Pin4
  R_VDCE_TCON_PIN_5   - Pin5
  R_VDCE_TCON_PIN_6   - Pin6
*/

typedef enum
{
    R_VDCE_TCON_PIN_0 = 0,
    R_VDCE_TCON_PIN_1,
    R_VDCE_TCON_PIN_2,
    R_VDCE_TCON_PIN_3,
    R_VDCE_TCON_PIN_4,
    R_VDCE_TCON_PIN_5,
    R_VDCE_TCON_PIN_6,
    R_VDCE_TCON_PIN_LAST
} r_vdce_TconPin_t;

/***************************************************************************
  Enum: r_vdce_SigEdge_t

  Description:
  This type is used to select the signal edge in the function <R_VDCE_DisplayTconPinSet>
  and <R_VDCE_DisplayTconPinGet>.

  Values:
  R_VDCE_SIG_EDGE_RISING  - Rising edge
  R_VDCE_SIG_EDGE_FALLING - Falling edge
*/

typedef enum
{
    R_VDCE_SIG_EDGE_RISING = 0,
    R_VDCE_SIG_EDGE_FALLING,
    R_VDCE_SIG_EDGE_LAST
} r_vdce_SigEdge_t;

/***************************************************************************
  typedef: r_vdce_TconSig_t

  Description:
  The structure holding the value of TCON pin setting in the function  <R_VDCE_DisplayTconPinSet>
  and <R_VDCE_DisplayTconPinGet>.

  Struct members:
  SigType - Signal type to output
  Edge    - Signal edge 
*/

typedef struct
{
    r_vdce_Pin_t     SigType;
    r_vdce_SigEdge_t Edge;
} r_vdce_TconSig_t;

/***************************************************************************
  Enum: r_vdce_Polarity_t

  Description:
  This type is used to select the polarity in the function <R_VDCE_DisplayPolaritySet>.

  Values:
  R_VDCE_POLARITY_POSITIVE - Polarity is positive.
  R_VDCE_POLARITY_NEGATIVE - Polarity is negative.
*/

typedef enum
{
    R_VDCE_POLARITY_POSITIVE = 0,
    R_VDCE_POLARITY_NEGATIVE,
    R_VDCE_POLARITY_LAST
} r_vdce_Polarity_t;

/***************************************************************************
  typedef: r_vdce_Bright_t

  Description:
  The structure holding the value of Brightness DC in the function <R_VDCE_DisplayCalibrationSet>.

  Struct members:
  B - Brightness (DC) adjustment of B signal.
  G - Brightness (DC) adjustment of G signal.
  R - Brightness (DC) adjustment of R signal.
*/

typedef struct
{
    uint16_t B;
    uint16_t G;
    uint16_t R;
} r_vdce_Bright_t;

/***************************************************************************
  typedef: r_vdce_Contrast_t

  Description:
  The structure holding the value of Contrast gain in the function <R_VDCE_DisplayCalibrationSet>.

  Struct members:
  B - Contrast (gain) adjustment of B signal.
  G - Contrast (gain) adjustment of G signal.
  R - Contrast (gain) adjustment of R signal.
*/

typedef struct
{
    uint8_t B;
    uint8_t G;
    uint8_t R;
} r_vdce_Contrast_t;

/***************************************************************************
  typedef: r_vdce_DitherMd_t

  Description:
  The structure holding the value of dithering mode in the function <R_VDCE_DisplayCalibrationSet>.

  Values:
  R_VDCE_DTH_MD_TRU  - Truncate.
  R_VDCE_DTH_MD_RDOF - Round-off.
  R_VDCE_DTH_MD_2X2  - 2x2 pattern dither.
  R_VDCE_DTH_MD_RAND - Random pattern dither.
*/

typedef enum
{
    R_VDCE_DTH_MD_TRU = 0,
    R_VDCE_DTH_MD_RDOF,
    R_VDCE_DTH_MD_2X2,
    R_VDCE_DTH_MD_RAND,
    R_VDCE_DTH_MD_NUM
} r_vdce_DitherMd_t;

/***************************************************************************
  typedef: r_vdce_Dither_t

  Description:
  Panel dithering

  Struct members:
  Sel - Panel dither operation mode. The default value is R_VDCE_DTH_MD_TRU.
  Pa  - Pattern value (A) of 2x2 pattern dither. The default value is 3.
  Pb  - Pattern value (B) of 2x2 pattern dither. The default value is 0.
  Pc  - Pattern value (C) of 2x2 pattern dither. The default value is 2.
  Pd  - Pattern value (D) of 2x2 pattern dither. The default value is 1.
*/
typedef struct
{
    r_vdce_DitherMd_t Sel;
    uint8_t           Pa;
    uint8_t           Pb;
    uint8_t           Pc;
    uint8_t           Pd;
} r_vdce_Dither_t;

/***************************************************************************
  typedef: r_vdce_GammaCorrect_t

  Description:
  Gamma correction parameters. This is used by <r_vdce_Gamma_t>.
  Gamma correction is carried out by dividing an input signal having 256 gradation 
  levels into 32 and controlling the gain of each area. 
  Gain coefficient of each area can be set as 0 to approx. 2.0 [times].

  Struct members:
  Area[n] - Start threshold of area#n.  
            The range of area#n is as followed.  
              Area#0  is from Area[0] to Area[1].  
              Area#1  is from Area[1] to Area[2].  
              ...
              Area#31 is from Area[31] to 255.  
            Each value should be set as following conditions.
              Area[0] = 0.
              Area[n-1] < Area[n]  < Area[n+1] (1 <= n <=30). 
              Area[31] <= 255.
            Initial value of Area[n] = n*8.
            
  Gain[n] - Gain coefficient of area#n. 
            The value of gain coefficient is Gain[n]/1024 [times].
            The range of Gain[n] is from 0 to 2047.
            Initial value of Gain[n] = 1024 (coefficient = 1).
*/

typedef struct
{
    uint8_t            Area[R_VDCE_GAMMA_AREA_NUM];
    uint16_t           Gain[R_VDCE_GAMMA_AREA_NUM];
} r_vdce_GammaCorrect_t;

/***************************************************************************
  typedef: r_vdce_Gamma_t

  Description:
  This structure is used to set the Gamma correction in the function 
  <R_VDCE_DisplayGammaCorrectSet>.

  Struct members:
  B - Pointer to structure of Gamma adjustment of B signal. 
      If this is set to NULL, Gamma adjustment of B signal is not changed.
  G - Pointer to structure of Gamma adjustment of G signal.
      If this is set to NULL, Gamma adjustment of G signal is not changed.
  R - Pointer to structure of Gamma adjustment of R signal.
      If this is set to NULL, Gamma adjustment of R signal is not changed.
*/
typedef struct
{
    r_vdce_GammaCorrect_t*   B;
    r_vdce_GammaCorrect_t*   G;
    r_vdce_GammaCorrect_t*   R;
} r_vdce_Gamma_t;

/***************************************************************************
  typedef: r_vdce_OutFormat_t

  Description:
  This type is used to select the output format in the function <R_VDCE_DisplayOutFormatSet>.

  Values:
    R_VDCE_OUT_FORMAT_RGB888     - RGB888.
    R_VDCE_OUT_FORMAT_RGB666     - RGB666.
    R_VDCE_OUT_FORMAT_RGB565     - RGB565.
    R_VDCE_OUT_FORMAT_SERIAL_RGB - Serial RGB. Serial RGB can be selected in case of RH850/D1M1A 
                                   and RH850/D1M1-V2.
*/

typedef enum
{
    R_VDCE_OUT_FORMAT_RGB888 = 0,
    R_VDCE_OUT_FORMAT_RGB666,
    R_VDCE_OUT_FORMAT_RGB565,
    R_VDCE_OUT_FORMAT_SERIAL_RGB,
    R_VDCE_OUT_FORMAT_LAST
} r_vdce_OutFormat_t;

/***************************************************************************
  Enum: r_vdce_SerialClkfreqsel_t

  Description:
  Clock frequency control for serial RGB.
  When the serial RGB output is selected, the pixel clock frequency is 1/3 or 1/4 
  of the panel clock (LCD_CLK) frequency.
  
  Note:
  PixelClock of <R_VDCE_DisplayTimingSet> should be set the panel clock (LCD_CLK) 
  frequency.

  Values:
  R_VDCE_SERIAL_CLKFRQ_3   - Triple (x3) speed 
  R_VDCE_SERIAL_CLKFRQ_4   - Quadruple (x4) speed 
  R_VDCE_SERIAL_CLKFRQ_NUM - The number of clock frequency control
*/
typedef enum
{
    R_VDCE_SERIAL_CLKFRQ_3 = 0,
    R_VDCE_SERIAL_CLKFRQ_4,
    R_VDCE_SERIAL_CLKFRQ_NUM
} r_vdce_SerialClkfreqsel_t;


/***************************************************************************
  Enum: r_vdce_SerialClkphase_t

  Description:
  Clock phase adjustment for serial RGB.
  Clock phase can be set 0 - 2clk in case of Triple speed mode (R_VDCE_SERIAL_CLKFRQ_3). 
  Clock phase can be set 0 - 3clk in case of Quadruple speed mode (R_VDCE_SERIAL_CLKFRQ_4). 

  Values:
  R_VDCE_SERIAL_CLKPHASE_0   - 0[clk]
  R_VDCE_SERIAL_CLKPHASE_1   - 1[clk]
  R_VDCE_SERIAL_CLKPHASE_2   - 2[clk]
  R_VDCE_SERIAL_CLKPHASE_3   - 3[clk]
  R_VDCE_SERIAL_CLKPHASE_NUM - The number of clock phase adjustment
*/
typedef enum
{
    R_VDCE_SERIAL_CLKPHASE_0 = 0,
    R_VDCE_SERIAL_CLKPHASE_1,
    R_VDCE_SERIAL_CLKPHASE_2,
    R_VDCE_SERIAL_CLKPHASE_3,
    R_VDCE_SERIAL_CLKPHASE_NUM
} r_vdce_SerialClkphase_t;


/***************************************************************************
  Enum: r_vdce_SerialScan_t

  Description:
  Scan direction select for serial RGB.

  Values:
  R_VDCE_SERIAL_SCAN_FORWARD - Forward scan
  R_VDCE_SERIAL_SCAN_REVERSE - Reverse scan
*/
typedef enum
{
    R_VDCE_SERIAL_SCAN_FORWARD   = 0,
    R_VDCE_SERIAL_SCAN_REVERSE,
    R_VDCE_SERIAL_SCAN_NUM
} r_vdce_SerialScan_t;


/***************************************************************************
  Enum: r_vdce_SerialSwap_t

  Description:
  Swap On/Off for serial RGB.
  This setting is effctive in case of Triple (x3) speed.

  Values:
  R_VDCE_SERIAL_SWAP_ON  - Swap On
  R_VDCE_SERIAL_SWAP_OFF - Swap Off
  
  Note:
  According to the combination with Swap, Frequency (see <r_vdce_SerialClkfreqsel_t>), and Scan 
  direction (see <r_vdce_SerialScan_t>), RGB order is as followed.

> Frequency      | CLKFRQ_3 | CLKFRQ_3 | CLKFRQ_3 | CLKFRQ_3 | CLKFRQ_3 | CLKFRQ_3 | 
> Scan direction | FORWARD  | REVERSE  | FORWARD  | REVERSE  | FORWARD  | REVERSE  | 
> Swap           |  ON      |  ON      |  OFF     |  OFF     |  n/a     |  n/a     | 
> ---------------+----------+----------+----------+----------+----------+----------+
>    Line(2n-1)  | r->g->b  | b->g->r  | r->g->b  | b->g->r  |r->g->b->X|b->g->r->X| 
>    Line(2n)    | g->b->r  | r->b->g  | r->g->b  | b->g->r  |r->g->b->X|b->g->r->X| 

*/

typedef enum
{
    R_VDCE_SERIAL_SWAP_ON   = 0,
    R_VDCE_SERIAL_SWAP_OFF,
    R_VDCE_SERIAL_SWAP_NUM
} r_vdce_SerialSwap_t;

/***************************************************************************
  Enum: r_vdce_Format_t

  Description:
  The type is used to specify the Frame buffer format in the function <R_VDCE_LayerFormatSet>.

  Values:
  R_VDCE_RGB565    - RGB565.
  R_VDCE_RGB0888   - RGB888.
  R_VDCE_ARGB1555  - ARGB1555.
  R_VDCE_ARGB4444  - ARGB4444.
  R_VDCE_ARGB8888  - ARGB8888.
  R_VDCE_CLUT8     - CLUT8.
  R_VDCE_CLUT4     - CLUT4.
  R_VDCE_CLUT1     - CLUT1.
  R_VDCE_YCBCR_422 - YCbCr422.
  R_VDCE_YCBCR_444 - YCbCr444.
  R_VDCE_RGBA5551  - RGBA5551.
  R_VDCE_RGBA8888  - RGBA8888.
  R_VDCE_YUV_YUYV  - YUV422.
  R_VDCE_YUV_UYVY  - YUV422.
  R_VDCE_YUV_YVYU  - YUV422.
  R_VDCE_YUV_VYUY  - YUV422.
*/

typedef enum
{
    R_VDCE_RGB565 = 0,
    R_VDCE_RGB0888,
    R_VDCE_ARGB1555,
    R_VDCE_ARGB4444,
    R_VDCE_ARGB8888,
    R_VDCE_CLUT8,
    R_VDCE_CLUT4,
    R_VDCE_CLUT1,
    R_VDCE_YCBCR_422,
    R_VDCE_YCBCR_444,
    R_VDCE_RGBA5551,
    R_VDCE_RGBA8888,
    R_VDCE_YUV_YUYV,
    R_VDCE_YUV_UYVY,
    R_VDCE_YUV_YVYU,
    R_VDCE_YUV_VYUY,
    R_VDCE_FORMAT_LAST
} r_vdce_Format_t;

/***************************************************************************
  typedef: r_vdce_Matrix_t

  Description:
  The structure holding the conversion coefficients for the YUV conversion matrix
  in the function <R_VDCE_LayerMatrixSet>.

  Struct members:
  RY            - Value of RY.
  RU            - Value of RU.
  RV            - Value of RV.
  GY            - Value of GY.
  GU            - Value of GU.
  GV            - Value of GV.
  BY            - Value of BY.
  BU            - Value of BU.
  BV            - Value of BV.
  Y_OFF         - Value of offset of Y.
  U_OFF         - Value of offset of U.
  V_OFF         - Value of offset of V.
  UV_SHIFT_ZERO - When this value is 0, it converts GBR into GBR.
                  When this value is 1, it converts GBR into YCbCr. (<R_VDCE_LAYER_INPUT> only)
                  When this value is 2, it converts YCbCr to GBR.
                  When this value is 3, it converts YCbCr to YCbCr. (<R_VDCE_LAYER_INPUT> only)
*/

typedef struct
{ 
    float32_t RY;
    float32_t RU;
    float32_t RV;
    float32_t GY;
    float32_t GU;
    float32_t GV;
    float32_t BY;
    float32_t BU;
    float32_t BV;
    int32_t Y_OFF;
    int32_t U_OFF;
    int32_t V_OFF;
    uint32_t UV_SHIFT_ZERO;
} r_vdce_Matrix_t;

/***************************************************************************
  Enum: r_vdce_Scale_t

  Description:
  The type is used to specify scale-up/scale-down behavior.
  See also functions <R_VDCE_LayerImgScaleX> and <R_VDCE_LayerImgScaleY>.

  Values:
  R_VDCE_SCALING_LARGER  - Select scale-up.
  R_VDCE_SCALING_SMALLER - Select scale-down.
  R_VDCE_SCALING_DISABLE - Select both disabled.
*/

typedef enum
{
    R_VDCE_SCALING_LARGER =  0,
    R_VDCE_SCALING_SMALLER,
    R_VDCE_SCALING_DISABLE,
    R_VDCE_SCALING_LAST
} r_vdce_Scale_t;

/***************************************************************************
  Enum: r_vdce_ScaleMode_t

  Description:
  The type is used to specify the optional mode for enlargement and reduction.
  See also function <R_VDCE_LayerImgScaleModeSet>.

  Values:
  R_VDCE_SCALE_MODE_NONE       - All flags are off.
  R_VDCE_SCALE_H_PREFILTER     - Enable a horizontal prefilter.
                                 Horizontal prefilter can be used when the horizontal scale is 
                                 reduced. If this flag is on, the frequency band for Brightness 
                                 (Y) and RGB signals are suppressed. If this flag is off, 
                                 horizontal prefilter is disabled.
  R_VDCE_SCALE_H_HOLD_INTERPOL - Use hold interpolation mode as horizontal interpolation.
                                 Horizontal interpolation mode can be selected when the 
                                 horizontal scale is enlarged or reduced. If this flag is off, 
                                 linear interpolation mode is used. When the interpolation 
                                 position is between input pixels Xn and Xn+1, the Xinterpo 
                                 interpolation value is defined as follows. phase depends on 
                                 interruption position.
                                 > hold mode  : Xinterpo = Xn
                                 > linear mode: Xinterpo = (Xn*(4096-phase)+Xn+1*phase)/4096
  R_VDCE_SCALE_V_HOLD_INTERPOL - Use hold interpolation mode as vertical interpolation.
                                 Vertical interpolation mode can be selected when the vertical 
                                 scale is enlarged or reduced. If this flag is off, linear 
                                 interpolation mode is used.
*/

typedef enum
{
    R_VDCE_SCALE_MODE_NONE        = 0,
    R_VDCE_SCALE_H_PREFILTER      = (int32_t)(1uL<< 0),
    R_VDCE_SCALE_H_HOLD_INTERPOL  = (int32_t)(1uL<< 1),
    R_VDCE_SCALE_V_HOLD_INTERPOL  = (int32_t)(1uL<< 2),
} r_vdce_ScaleMode_t;

/***************************************************************************
  typedef: r_vdce_ClutARGB32_t

  Description:
  The structure holding the value of ARGB for CLUT in the function <R_VDCE_LayerClutSet>.

  Struct members:
  B - Value of Blue.
  G - Value of Green.
  R - Value of Red.
  A - Value of Alpha.
*/

typedef struct
{
    uint8_t B;
    uint8_t G;
    uint8_t R;
    uint8_t A;
} r_vdce_ClutARGB32_t;

/***************************************************************************
  typedef: r_vdce_CkARGB32_t

  Description:
  The structure holding the value of ARGB for Chroma-key
  in the function <R_VDCE_LayerChromaKeyEnable>.

  Struct members:
  B - Value of Blue.
  G - Value of Green.
  R - Value of Red.
  A - Value of Alpha.
*/

typedef struct
{
    uint8_t B;
    uint8_t G;
    uint8_t R;
    uint8_t A;
} r_vdce_CkARGB32_t;

/***************************************************************************
  Enum: r_vdce_CapMode_t

  Description:
  The type is used to specify the mode in the function <R_VDCE_CapModeSet>.

  Values:
  R_VDCE_CAP_MODE_YUV_ITU656       - Select ITU-R BT.656 mode with external sync.
  R_VDCE_CAP_MODE_YUV_8BIT         - Select ITU-R BT.601 mode with external sync.
  R_VDCE_CAP_MODE_YUV_16BIT        - Select YCbCr422 mode with external sync.
  R_VDCE_CAP_MODE_RGB_16BPP        - Select RGB565 mode with external sync.
  R_VDCE_CAP_MODE_RGB_18BPP        - Select RGB666 mode with external sync.
  R_VDCE_CAP_MODE_RGB_24BPP        - Select RGB888 / YCbCr444 mode with external sync.
  R_VDCE_CAP_MODE_DITHER           - Use a dithering. Dithering can be used with frame buffer format 
                                     R_VDCE_FB_FORMAT_RGB565
  R_VDCE_CAP_MODE_YUV_Y_UV_INVERT  - Invert the position of Y and UV in the ITU stream. (YUYV -> UYVY) 
  R_VDCE_CAP_MODE_VSYNC_INVERT     - Invert the polarity of the vsync signals. 
                                     (default: pos polarity, inverted: neg polarity)
  R_VDCE_CAP_MODE_HSYNC_INVERT     - Invert the polarity of the hsync signals. 
                                     (default: pos polarity, inverted: neg polarity)
  R_VDCE_CAP_MODE_DATA_CLK_INVERT  - Invert the clock phase for the incoming data signals
                                     (default: falling clock edge, inverted: rising clock edge)
  R_VDCE_CAP_MODE_VSYNC_CLK_INVERT - Invert the Vsync Clock. default neg clock edge.
                                     (default: falling clock edge, inverted: rising clock edge)
  R_VDCE_CAP_MODE_HSYNC_CLK_INVERT - Invert the Hsync Clock. default neg clock edge.
                                     (default: falling clock edge, inverted: rising clock edge)
  R_VDCE_CAP_MODE_H_MIRRORING      - Use horizontal mirroring.
  R_VDCE_CAP_MODE_V_MIRRORING      - Use vertical mirroring.
  R_VDCE_CAP_MODE_FIXED_VSYNC      - Output Vsync from connecting layer is fixed as internally generated 
                                     free-running Vsync signal. 
                                     If this flag is not set, output Vsync changes to externally input 
                                     Vsync signal while the capturing is enabled. 
  R_VDCE_CAP_MODE_BIG_ENDIAN       - Captureing with big endian. If this flag is not set, little endian 
                                     is selected.
  
  Note:
  If R_VDCE_CAP_MODE_YUV_ITU656 or R_VDCE_CAP_MODE_YUV_8BIT is selected, each pixels are 
  captured twice. Therefore width of <R_VDCE_CapBufGeometrySetup> must be doubled and 
  horizontal size must be scaled down by half in order to keep original input size.

  Note:
  If R_VDCE_CAP_MODE_FIXED_VSYNC is set, the interrupt R_VDCE_INTC_NO_VI_VSYNC_SIGNAL or 
  R_VDCE_INTC_NO_VI_VSYNC_SIGNAL_1 does not occur.
  If R_VDCE_CAP_MODE_FIXED_VSYNC is not set, flickering may be displayed at the capture enable/disable 
  timing. 

  Note:
  According to the combination with Format, Endian and Swap (set by <r_vdce_Fbformat_t>), 
  input video image signal (DV_DATA)is as followed.

> Format(CapMode_t) |        RGB888/YCbCr444          |        RGB666            |          RGB565          |
> Endian(CapMode_t) | LITTLE  LITTLE   BIG     BIG    | LITTLE LITTLE BIG   BIG  | LITTLE LITTLE BIG   BIG  |
> Swap  (Fbformat_t)|  OFF     ON      OFF     ON     |  OFF     ON   OFF   ON   |  OFF    ON    OFF   ON   |
> ------------------+---------------------------------+--------------------------+--------------------------+
>    DV_DATA23      | Cr/R[7] Cb/B[7] Cr/R[0] Cb/B[0] |   0      0     0     0   |   0      0     0     0   |
>         :         |   :       :       :       :     |   :      :     :     :   |   :      :     :     :   |
>    DV_DATA18      | Cr/R[2] Cb/B[2] Cr/R[5] Cb/B[5] |   0      0     0     0   |   0      0     0     0   |
>    DV_DATA17      | Cr/R[1] Cb/B[1] Cr/R[6] Cb/B[6] |  R[7]   B[7]  R[2]  B[2] |   0      0     0     0   |
>    DV_DATA16      | Cr/R[0] Cb/B[0] Cr/R[7] Cb/B[7] |  R[6]   B[6]  R[3]  B[3] |   0      0     0     0   |
>    DV_DATA15      | Y /G[7] Y /G[7] Y /G[0] Y /G[0] |  R[5]   B[5]  R[4]  B[4] |  R[7]   B[7]  R[3]  B[3] |
>    DV_DATA14      | Y /G[6] Y /G[6] Y /G[1] Y /G[1] |  R[4]   B[4]  R[5]  B[5] |  R[6]   B[6]  R[4]  B[4] |
>    DV_DATA13      | Y /G[5] Y /G[5] Y /G[2] Y /G[2] |  R[3]   B[3]  R[6]  B[6] |  R[5]   B[5]  R[5]  B[5] |
>    DV_DATA12      | Y /G[4] Y /G[4] Y /G[3] Y /G[3] |  R[2]   B[2]  R[7]  B[7] |  R[4]   B[4]  R[6]  B[6] |
>    DV_DATA11      | Y /G[3] Y /G[3] Y /G[4] Y /G[4] |  G[7]   G[7]  G[2]  G[2] |  R[3]   B[3]  R[7]  B[7] |
>    DV_DATA10      | Y /G[2] Y /G[2] Y /G[5] Y /G[5] |  G[6]   G[6]  G[3]  G[3] |  G[7]   G[7]  G[2]  G[2] |
>    DV_DATA9       | Y /G[1] Y /G[1] Y /G[6] Y /G[6] |  G[5]   G[5]  G[4]  G[4] |  G[6]   G[6]  G[3]  G[3] |
>    DV_DATA8       | Y /G[0] Y /G[0] Y /G[7] Y /G[7] |  G[4]   G[4]  G[5]  G[5] |  G[5]   G[5]  G[4]  G[4] |
>    DV_DATA7       | Cb/B[7] Cr/R[7] Cb/B[0] Cr/R[0] |  G[3]   G[3]  G[6]  G[6] |  G[4]   G[4]  G[5]  G[5] |
>    DV_DATA6       | Cb/B[6] Cr/R[6] Cb/B[1] Cr/R[1] |  G[2]   G[2]  G[7]  G[7] |  G[3]   G[3]  G[6]  G[6] |
>    DV_DATA5       | Cb/B[5] Cr/R[5] Cb/B[2] Cr/R[2] |  B[7]   R[7]  B[2]  R[2] |  G[2]   G[2]  G[7]  G[7] |
>    DV_DATA4       | Cb/B[4] Cr/R[4] Cb/B[3] Cr/R[3] |  B[6]   R[6]  B[3]  R[3] |  B[7]   R[7]  B[3]  R[3] |
>         :         |   :       :       :       :     |   :      :     :     :   |   :      :     :     :   |
>    DV_DATA0       | Cb/B[0] Cr/R[0] Cb/B[7] Cr/R[7] |  B[2]   R[2]  B[7]  R[7] |  B[3]   R[3]  B[7]  R[7] |
> -------------------+--------------------------------+--------------------------+------------------- ------+

> Format(CapMode_t) | BT.656/BT.601  |              YCbCr422               |
> Endian(CapMode_t) | LITTLE  BIG    | LITTLE   LITTLE      BIG      BIG   |
> Swap  (Fbformat_t)|  OFF    OFF    |  OFF       ON        OFF      ON    |
> ------------------+----------------+-------------------------------------+
>    DV_DATA23      |   0       0    |    0        0        0        0     |
>         :         |   :       :    |    :        :        :        :     |
>    DV_DATA16      |   0       0    |    0        0        0        0     |
>    DV_DATA15      |   0       0    |   Y[7]   Cb/Cr[7]   Y[0]   Cb/Cr[0] |
>    DV_DATA14      |   0       0    |   Y[6]   Cb/Cr[6]   Y[1]   Cb/Cr[1] |
>         :         |   :       :    |    :        :        :        :     |
>    DV_DATA8       |   0       0    |   Y[0]   Cb/Cr[0]   Y[7]   Cb/Cr[7] |
>    DV_DATA7       |  BT[7]   BT[0] | Cb/Cr[7]   Y[7]   Cb/Cr[0]   Y[0]   |
>    DV_DATA6       |  BT[6]   BT[1] | Cb/Cr[6]   Y[6]   Cb/Cr[1]   Y[1]   |
>         :         |   :       :    |    :        :        :        :     |
>    DV_DATA0       |  BT[0]   BT[7] | Cb/Cr[0]   Y[0]   Cb/Cr[7]   Y[7]   |
> ------------------+----------------+-------------------------------------+

*/

typedef enum
{
    R_VDCE_CAP_MODE_NONE             = 0,
    R_VDCE_CAP_MODE_YUV_ITU656       = (int32_t)(1uL<< 0),
    R_VDCE_CAP_MODE_YUV_8BIT         = (int32_t)(1uL<< 1),
    R_VDCE_CAP_MODE_YUV_16BIT        = (int32_t)(1uL<< 2),
    R_VDCE_CAP_MODE_RGB_16BPP        = (int32_t)(1uL<< 3),
    R_VDCE_CAP_MODE_RGB_18BPP        = (int32_t)(1uL<< 4),
    R_VDCE_CAP_MODE_RGB_24BPP        = (int32_t)(1uL<< 5),
    R_VDCE_CAP_MODE_DITHER           = (int32_t)(1uL<< 6),
    R_VDCE_CAP_MODE_YUV_Y_UV_INVERT  = (int32_t)(1uL<< 10),
    R_VDCE_CAP_MODE_VSYNC_INVERT     = (int32_t)(1uL<< 11),
    R_VDCE_CAP_MODE_HSYNC_INVERT     = (int32_t)(1uL<< 12),
    R_VDCE_CAP_MODE_DATA_CLK_INVERT  = (int32_t)(1uL<< 15),
    R_VDCE_CAP_MODE_VSYNC_CLK_INVERT = (int32_t)(1uL<< 16),
    R_VDCE_CAP_MODE_HSYNC_CLK_INVERT = (int32_t)(1uL<< 17),
    R_VDCE_CAP_MODE_H_MIRRORING      = (int32_t)(1uL<< 18),
    R_VDCE_CAP_MODE_V_MIRRORING      = (int32_t)(1uL<< 19),
    R_VDCE_CAP_MODE_FIXED_VSYNC      = (int32_t)(1uL<< 20),
    R_VDCE_CAP_MODE_BIG_ENDIAN       = (int32_t)(1uL<< 21),
} r_vdce_CapMode_t;

/***************************************************************************
  Enum: r_vdce_Fbformat_t

  Description:
  The type is used to specify the Frame buffer format in the function <R_VDCE_CapBufGeometrySetup>.

  Values:
  R_VDCE_FB_FORMAT_YCBCR_422 - YCbCr422.
  R_VDCE_FB_FORMAT_RGB565    - RGB565.
  R_VDCE_FB_FORMAT_RGB0888   - RGB0888.
  R_VDCE_FB_FORMAT_YCBCR_444 - YCbCr444.
  R_VDCE_FB_RB_SWAP          - Option flag for Swap R and B. See <r_vdce_CapMode_t>.
                               This flag is used with above format
                               e.g. (R_VDCE_FB_FORMAT_RGB0888 | R_VDCE_FB_RB_SWAP).
*/

typedef enum
{
    R_VDCE_FB_FORMAT_YCBCR_422   = 0,
    R_VDCE_FB_FORMAT_RGB565      = 1,
    R_VDCE_FB_FORMAT_RGB0888     = 2,
    R_VDCE_FB_FORMAT_YCBCR_444   = 3,
    R_VDCE_FB_RB_SWAP            = (int32_t)(1uL << 16)
} r_vdce_Fbformat_t;

/***************************************************************************
  Enum: r_vdce_LayerMode_t

  Description:
  The type is used to specify the optional mode for layer.
  See also function <R_VDCE_LayerModeSet>.

  Values:
  R_VDCE_LAYER_MODE_NONE       - All flags are off.
  R_VDCE_LAYER_MODE_V_MIRORING - Enable vertical mirroring. 
                                 This flag can be selected when graphic data is input.
                                 When capture data is input, vertical mirroring should be set 
                                 by <R_VDCE_CapModeSet>.
*/

typedef enum
{
    R_VDCE_LAYER_MODE_NONE       = 0,
    R_VDCE_LAYER_MODE_V_MIRORING = (int32_t)(1uL<< 0),
} r_vdce_LayerMode_t;

/***************************************************************************
  Enum: r_vdce_OirMode_t

  Description:
  This type is used to select the OIR mode in the function <R_VDCE_OirModeSet>.

  Values:
  R_VDCE_OIR_MODE_NORMAL       - OIR mode is normal.
  R_VDCE_OIR_MODE_SCREEN_SHOTS - OIR mode is screen shots. 
                                 A distortion image by VOWE is not output to 
                                 LCD panel. A distortion image data is only 
                                 extracted by the frame buffer of OIR.
*/

typedef enum
{
    R_VDCE_OIR_MODE_NORMAL = 0,
    R_VDCE_OIR_MODE_SCREEN_SHOTS,
    R_VDCE_OIR_MODE_LAST
} r_vdce_OirMode_t;

/***************************************************************************
  Section: Global API functions
*/
/***************************************************************************
  Group: Basic functions
*/

/***************************************************************************
  Function: R_VDCE_Init

  Description:
  This function initializes the driver and the hardware as far as necessary. 
  The Unit parameter holds a number that specifies the video output number being initialized. 
  A used flag is set inside the driver structure to lock it being initialized and currently used.
  The driver makes sure, that the macro is set into a default configuration.
  It is also in the responsibility of the driver to keep track of the macro instance status and
  to avoid, that the macro instance is initialized more than one time or that
  any other function can be executed before the initialization has been completed successfully.
  If the function successfully execute, the return code will be <R_VDCE_ERR_OK> and
  the state will be in the initialized state.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit - It specifies the video output number. 

  Return value:
  See <r_vdce_Error_t>.

  Executable VDCE Status:
  Uninitialized - OK [All (VDCE, layer, OIR and capture) status will be changed to "Initialized".]
  Initialized   - NG
  Idle          - NG
  Executing     - NG

  Supported Device:
  RH850/D1M2(H) - OK (Unit=0 and Unit=1 are available.)
  RH850/D1M1A   - OK (Unit=0 and Unit=1 are available.)
  RH850/D1M1-V2 - OK (Unit=0 is available.)
  RH850/D1M1(H) - OK (Unit=0 is available.)
  RH850/D1L2(H) - OK (Unit=0 is available.)
*/

r_vdce_Error_t R_VDCE_Init(const uint32_t Unit);

/***************************************************************************
  Function: R_VDCE_DeInit

  Description:
  This function deinitializes the driver and the hardware as far as 
  necessary and frees the resources by deleting the used flag.
  The function disables all layers and the display.
  If the function successfully execute, the return code will be <R_VDCE_ERR_OK> and
  the state will be in the uninitialized state.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit - It specifies the video output number.

  Return value:
  See <r_vdce_Error_t>.

  Executable VDCE Status:
  Uninitialized - OK (Do nothing)
  Initialized   - OK [All (VDCE, layer, OIR and capture) will be changed to "Uninitialized".]
  Idle          - OK [All (VDCE, layer, OIR and capture) will be changed to "Uninitialized".]
  Executing     - OK [All (VDCE, layer, OIR and capture) will be changed to "Uninitialized".]
*/

r_vdce_Error_t R_VDCE_DeInit(const uint32_t Unit);

/***************************************************************************
  Function: R_VDCE_VersionStringGet

  Description:
  This function returns the version string of this VDCE driver.

  Parameter:
  None.

  Return value:
  Pointer of version string.

  Executable VDCE Status:
  Uninitialized - OK
  Initialized   - OK
  Idle          - OK
  Executing     - OK
*/

const uint8_t *R_VDCE_VersionStringGet(void);

/***************************************************************************
  Function: R_VDCE_MacroVersionGet

  Description:
  This function returns the major and minor version of the H/W macro.

  Parameter:
  Major - The macro version as a major version.
  Minor - The macro version as a minor version.

  Return value:
  See <r_vdce_Error_t>.

  Uninitialized - OK
  Initialized   - OK
  Idle          - OK
  Executing     - OK
*/

r_vdce_Error_t R_VDCE_MacroVersionGet(uint32_t * const Major,
                                      uint32_t * const Minor);

/***************************************************************************
  Function: R_VDCE_ErrorCallbackSet

  Description:
  This function sets a callback function that is called in case of an error.
  If ErrorCallback is NULL (R_NULL) no callback function will be called in case an error occurs and
  just the error code is returned. The ErrorCallback is global for all VDCE units.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  ErrorCallback - A function that is called in case an error occurred.

  Return value:
  See <r_vdce_Error_t>.

  Executable VDCE Status:
  Uninitialized - OK
  Initialized   - OK
  Idle          - OK
  Executing     - OK
*/

r_vdce_Error_t R_VDCE_ErrorCallbackSet(void (* const ErrorCallback)(const uint32_t       Unit,
                                                                    const r_vdce_Error_t Error));


/***************************************************************************
  Group: Interrupt functions
*/

/***************************************************************************
  Function: R_VDCE_IntcCallbackSet

  Description:
  This function sets a callback for a special interrupt type.
  The function is called in case an Interrupt of IntType occurs and the interrupt is enabled.
  This setting is valid until <R_VDCE_DeInit> is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit    - It specifies the video output number.
  IntType - The interrupt type specifies the Interrupt event, which can be selected.
            See <r_vdce_IntType_t>.
  Isr     - A function that is called in case an interrupt occurred.

  Return value:
  See <r_vdce_Error_t>.

  Executable VDCE Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK
  Executing     - OK
*/

r_vdce_Error_t R_VDCE_IntcCallbackSet(const uint32_t         Unit,
                                      const r_vdce_IntType_t IntType,
                                      void                   (* const Isr)(void));

/***************************************************************************
  Function: R_VDCE_IntcCallbackGet

  Description:
  This function gets the pointer to the callback for the given interrupt type.

  Parameter:
  Unit    - It specifies the video output number.
  IntType - The interrupt type specifies the Interrupt event, which can be selected.
            See <r_vdce_IntType_t>.
  Isr     - A function that is called in case an interrupt occurred.

  Return value:
  See <r_vdce_Error_t>.

  Executable VDCE Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK
  Executing     - OK
*/

r_vdce_Error_t R_VDCE_IntcCallbackGet(const uint32_t         Unit,
                                      const r_vdce_IntType_t IntType,
                                      void                   (** const Isr)(void));

/***************************************************************************
  Function: R_VDCE_IntcEnable

  Description:
  This function enables the activation of an interrupt of type IntType.
  IntType can be an order value of <r_vdce_IntType_t>.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit    - It specifies the video output number.
  IntType - The interrupt type specifies the Interrupt event, which can be selected.
            See <r_vdce_IntType_t>.

  Return value:
  See <r_vdce_Error_t>.

  Executable VDCE Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK
  Executing     - OK
*/

r_vdce_Error_t R_VDCE_IntcEnable(const uint32_t         Unit,
                                 const r_vdce_IntType_t IntType);

/***************************************************************************
  Function: R_VDCE_IntcDisable

  Description:
  This function disables the activation of an interrupt of type IntType.
  IntType can be an order value of <r_vdce_IntType_t>.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit    - It specifies the video output number.
  IntType - The interrupt type specifies the Interrupt event, which can be selected.
            See <r_vdce_IntType_t>.

  Return value:
  See <r_vdce_Error_t>.

  Executable VDCE Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK
  Executing     - OK
*/

r_vdce_Error_t R_VDCE_IntcDisable(const uint32_t         Unit,
                                  const r_vdce_IntType_t IntType);

/****************************************************************************
  Function: R_VDCE_IntcScanlineSet

  Description:
  This function sets the interrupt occurrence timing by the location of image line at Graphic 3 
  layer.  When the location of image line read by Graphic 3 layer matches this setting, 
  R_VDCE_INTC_SCANLINE callback is notified. 
  The interrupt occurs even if Graphic 3 layer is disabled.
  This setting is valid until <R_VDCE_DeInit> is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit     - It specifies the video output number.
  Scanline - It specifies the interrupt occurrence timing by the location of image line at the 
             Graphics 3 layer.

  Return value:
  See <r_vdce_Error_t>.

  Executable VDCE Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK
  Executing     - OK
*/

r_vdce_Error_t R_VDCE_IntcScanlineSet(const uint32_t Unit,
                                      const uint32_t Scanline);

/****************************************************************************
  Function: R_VDCE_IntcScanlineGet

  Description:
  This function gets the current location of image line being read on Graphics 3 layer.

  Parameter:
  Unit     - It specifies the video output number.
  Scanline - This is a pointer to the current location of image line being read on Graphics 3 
             layer.

  Return value:
  See <r_vdce_Error_t>.

  Executable VDCE Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK
  Executing     - OK
*/

r_vdce_Error_t R_VDCE_IntcScanlineGet(const uint32_t   Unit,
                                      uint32_t * const Scanline);

/****************************************************************************
  Function: R_VDCE_IntcOirScanlineSet

  Description:
  This function sets interrupt occurrence timing by the location of image line at OIR layer. 
  When the location of image line output from OIR layer matches this setting, 
  R_VDCE_INTC_OIR_SCANLINE callback is notified.
  This setting is valid until <R_VDCE_DeInit> is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit     - It specifies the video output number.
  Scanline - It specifies the interrupt occurrence timing by the location of image line at OIR layer.

  Return value:
  See <r_vdce_Error_t>.

  Executable VDCE Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK
  Executing     - OK
*/

r_vdce_Error_t R_VDCE_IntcOirScanlineSet(const uint32_t Unit,
                                         const uint32_t Scanline);

/****************************************************************************
  Function: R_VDCE_IntcOirScanlineGet

  Description:
  This function gets the current location of image line output from OIR layer.

  Parameter:
  Unit     - It specifies the video output number.
  Scanline - This is a pointer to the current location of image line output from OIR layer.

  Return value:
  See <r_vdce_Error_t>.

  Executable VDCE Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK
  Executing     - OK
*/

r_vdce_Error_t R_VDCE_IntcOirScanlineGet(const uint32_t   Unit,
                                         uint32_t * const Scanline);

/****************************************************************************
  Function: R_VDCE_IntcCapScanlineSet

  Description:
  This function is not supported.

  Parameter:
  Unit     - VDCE unit number to capture.
  Scanline - It specifies the interrupt occurrence timing by the location of capturing line.

  Return value:
  See <r_vdce_Error_t>.

*/

r_vdce_Error_t R_VDCE_IntcCapScanlineSet(const uint32_t Unit,
                                         const uint32_t Scanline);

/****************************************************************************
  Function: R_VDCE_IntcCapScanlineGet

  Description:
  This function gets the current location of capturing line input to Scaler 0 (or Scaler 1) layer.

  Parameter:
  Unit     - VDCE unit number to capture.
  Scanline - This is a pointer to the current location of capturing line input to Scaler 0 (or 
             Scaler 1) layer.

  Return value:
  See <r_vdce_Error_t>.
*/

r_vdce_Error_t R_VDCE_IntcCapScanlineGet(const uint32_t   Unit,
                                         uint32_t * const Scanline);

/****************************************************************************
  Function: R_VDCE_Isr

  Description:
  This function is called from ISR (Interrupt Service Routines) and processes
  the interrupt factor which excludes the error of VDCE.
  It depends on the CPU which is loaded into the device for ISR.

  Parameter:
  Unit     - It specifies the video output number.
  IntType - The interrupt type specifies the Interrupt event, which can be selected.
            See <r_vdce_IntType_t>.

  Return value:
  See <r_vdce_Error_t>.

  Executable VDCE Status:
  Uninitialized - OK
  Initialized   - OK
  Idle          - OK
  Executing     - OK
*/
r_vdce_Error_t R_VDCE_Isr(const uint32_t         Unit,
                          const r_vdce_IntType_t IntType);

/****************************************************************************
  Function: R_VDCE_IsrError

  Description:
  This function is called from ISR (Interrupt Service Routines) and processes
  the error interrupt factor of VDCE.
  It depends on the CPU which is loaded into the device for ISR.

  Parameter:
  Unit     - It specifies the video output number.

  Return value:
  See <r_vdce_Error_t>.

  Executable VDCE Status:
  Uninitialized - OK
  Initialized   - OK
  Idle          - OK
  Executing     - OK
*/
r_vdce_Error_t R_VDCE_IsrError(const uint32_t Unit);


/***************************************************************************
  Group: Display functions
*/

/***************************************************************************
  Function: R_VDCE_DisplayTimingSet

  Description:
  This function sets the display timing, including display resolution,
  sync position blank widths and pixel clocks.

  Include the header r_ddb_api.h to use this function, see <Display Data Base>.
  It contains the <r_ddb_Timing_t> parameter.
  
  Pixel clock setting process is dependent on <R_VDCE_Sys_PixelClockSet>.
  
  This setting is valid until <R_VDCE_DeInit> is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit   - It specifies the video output number.
  Timing - The timing parameter contains all the information to driver the display.
           See <r_ddb_Timing_t>.
           
           > Range of Timing->ScreenWidth   is 16 to 1280/1024/480 (Depending on device). 
           > Range of Timing->ScreenHeight  is 16 to 1024/320 (Depending on device).
           > Range of Timing->H.Total       is 32 to 2048.
           > Range of Timing->V.Total       is 21 to 2048.
           > Range of Timing->H.BlankWidth  is 16 to 2032.
           > Range of Timing->V.BlankWidth  is 5  to 2032.
           > Range of Timing->H.SyncWidth   is 1  to (Timing->H.BlankWidth - 1).
           > Range of Timing->V.SyncWidth   is 1  to (Timing->V.BlankWidth - 2).
           > Range of Timing->H.FrontPorch  is 0  to (Timing->H.BlankWidth - 2).
           > Range of Timing->V.FrontPorch  is 1  to (Timing->V.BlankWidth - 2).
           > Range of horizontal back porch is 1  to (Timing->H.BlankWidth - 1).
           > Range of vertical   back porch is 1  to (Timing->V.BlankWidth - 2).
           >     *back porch = BlankWidth - SyncWidth - FrontPorch
           > 
           > Following equations must be satisfied.
           > (Timing->H.BlankWidth + Timing->ScreenWidth)  = Timing->H.Total
           > (Timing->V.BlankWidth + Timing->ScreenHeight) = Timing->V.Total
           >
           > Range of Timing->PixelClock is depending on device. 
           > 
  Return value:
  See <r_vdce_Error_t>.
  
  Executable VDCE Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - NG
  Executing     - NG

  Supported Device:
  RH850/D1M2(H) - OK (Maximum ScreenWidth is 1280. Maximum ScreenHeight is 1024. 
                      Maximum PicelClock is 48MHz.)
  RH850/D1M1A   - OK (Maximum ScreenWidth is 1280. Maximum ScreenHeight is 1024. 
                      Maximum PicelClock of Unit0 is 48MHz(LVTTL)/34MHz(OpenLDI)/30MHz(VODDR).
                      Maximum PicelClock of Unit1 is 40MHz(SerialRGB)/10MHz(VODDR).)
  RH850/D1M1-V2 - OK (Maximum ScreenWidth is 1024. Maximum ScreenHeight is 1024. 
                      Maximum PicelClock is 30MHz(LVTTL)/40MHz(SerialRGB).)
  RH850/D1M1(H) - OK (Maximum ScreenWidth is 1024. Maximum ScreenHeight is 1024. 
                      Maximum PicelClock is 30MHz.)
  RH850/D1L2(H) - OK (Maximum ScreenWidth is  480. Maximum ScreenHeight is  320. 
                      Maximum PicelClock is 10MHz.)
  
*/

r_vdce_Error_t R_VDCE_DisplayTimingSet(const uint32_t               Unit,
                                       const r_ddb_Timing_t * const Timing);

/***************************************************************************
  Function: R_VDCE_DisplayTimingAdjust

  Description:
  This function adjusts the display timing.
  This setting is valid until <R_VDCE_DeInit> is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit   - It specifies the video output number.
  VLines - It specifies an adjustment by the number of the vertical lines.
           When 0 is set, it doesn't adjust display timing.
           The upper limit of the set value is 16 lines.

  Return value:
  See <r_vdce_Error_t>.

  Executable VDCE Status:
  Uninitialized - NG
  Initialized   - OK 
  Idle          - OK (Parameters become effective at the timing of next Vsync.)
  Executing     - NG
*/

r_vdce_Error_t R_VDCE_DisplayTimingAdjust(const uint32_t Unit,
                                          const uint32_t VLines);

/***************************************************************************
  Function: R_VDCE_DisplayOutEndianSet

  Description:
  This function sets the video output data endian.
  This setting is valid until <R_VDCE_DeInit> is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit      - It specifies the video output number.
  OutEndian - It specifies the video output data endian. See <r_vdce_OutEndian_t>.

  Return value:
  See <r_vdce_Error_t>.

  Executable VDCE Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - NG
  Executing     - NG
*/

r_vdce_Error_t R_VDCE_DisplayOutEndianSet(const uint32_t           Unit, 
                                          const r_vdce_OutEndian_t OutEndian);

/***************************************************************************
  Function: R_VDCE_DisplayOutSwapBR

  Description:
  This function swaps the video output data red and blue channel.
  This setting is valid until <R_VDCE_DeInit> is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit    - It specifies the video output number.
  OutSwap - It specifies the video output data swap. See <r_vdce_OutSwap_t>.

  Return value:
  See <r_vdce_Error_t>.

  Executable VDCE Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - NG
  Executing     - NG
*/

r_vdce_Error_t R_VDCE_DisplayOutSwapBR(const uint32_t           Unit,
                                       const r_vdce_OutSwap_t   OutSwap);

/***************************************************************************
  Function: R_VDCE_DisplayColorSet

  Description:
  This function sets the display background color.
  It is seen, if no layer (or a transparent one) is on top of it.
  The default background color is black (All value is 0).
  This setting is valid until <R_VDCE_DeInit> is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit           - It specifies the video output number.
  Red/Green/Blue - The individual color components of the background color.

  Return value:
  See <r_vdce_Error_t>.

  Executable VDCE Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK (Parameters become effective at the timing of next Vsync.)
  Executing     - OK (Parameters become effective at the timing of next Vsync.)
*/

r_vdce_Error_t R_VDCE_DisplayColorSet(const uint32_t Unit,
                                      const uint8_t  Red,
                                      const uint8_t  Green,
                                      const uint8_t  Blue);

/***************************************************************************
  Function: R_VDCE_DisplayHsyncSet

  Description:
  This function sets the TCON reference timing of Hsync. 
  Execute <R_VDCE_DisplayTimingSet> before executing this function.
  This setting is valid until <R_VDCE_DisplayTimingSet>, <R_VDCE_DisplayTimingAdjust>, or <R_VDCE_DeInit>
  is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit     - It specifies the video output number.
  Hsync    - This is a pointer to the value of TCON reference timing of Hsync. See <r_vdce_Hsync_t>.

  Return value:
  See <r_vdce_Error_t>.

  Executable VDCE Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - NG
  Executing     - NG
*/

r_vdce_Error_t R_VDCE_DisplayHsyncSet(const uint32_t               Unit,
                                      const r_vdce_Hsync_t * const Hsync);

/***************************************************************************
  Function: R_VDCE_DisplayHsyncGet

  Description:
  This function gets the TCON reference timing of Hsync. 
  Execute <R_VDCE_DisplayTimingSet> before executing this function.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit     - It specifies the video output number.
  Hsync    - This is a pointer to the value of TCON reference timing of Hsync. See <r_vdce_Hsync_t>.

  Return value:
  See <r_vdce_Error_t>.

  Executable VDCE Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK
  Executing     - OK
*/

r_vdce_Error_t R_VDCE_DisplayHsyncGet(const uint32_t         Unit,
                                      r_vdce_Hsync_t * const Hsync);

/***************************************************************************
  Function: R_VDCE_DisplaySignalSet

  Description:
  This function sets the TCON signal configuration.
  Execute <R_VDCE_DisplayTimingSet> before executing this function
  This setting is valid until <R_VDCE_DisplayTimingSet>, <R_VDCE_DisplayTimingAdjust>, or <R_VDCE_DeInit>
  is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit     - It specifies the video output number.
  SigType  - Here the TCON signal type can be selected from <r_vdce_Pin_t> except for DE signal.
  Signal   - This is a pointer to the value of TCON signal configuration. See <r_vdce_Signal_t>.

  Return value:
  See <r_vdce_Error_t>.

  Executable VDCE Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - NG
  Executing     - NG
*/

r_vdce_Error_t R_VDCE_DisplaySignalSet(const uint32_t                Unit,
                                       const r_vdce_Pin_t            SigType,
                                       const r_vdce_Signal_t * const Signal);

/***************************************************************************
  Function: R_VDCE_DisplaySignalGet

  Description:
  This function gets the TCON signal configuration.
  Execute <R_VDCE_DisplayTimingSet> before executing this function
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit     - It specifies the video output number.
  SigType  - Here the TCON signal type can be selected from <r_vdce_Pin_t> except for DE signal.
  Signal   - This is a pointer to the value of TCON signal configuration. See <r_vdce_Signal_t>.

  Return value:
  See <r_vdce_Error_t>.

  Executable VDCE Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK
  Executing     - OK
*/

r_vdce_Error_t R_VDCE_DisplaySignalGet(const uint32_t          Unit,
                                       const r_vdce_Pin_t      SigType,
                                       r_vdce_Signal_t * const Signal);

/***************************************************************************
  Function: R_VDCE_DisplayTconPinSet

  Description:
  This function sets the TCON signal type which is output from the specified Tcon pin.
  This setting is valid until <R_VDCE_DeInit> is executed.
  The signal type of Pin0(Vsync) and Pin2(Hsync) cannot be changed. Only edge is changeable.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit     - It specifies the video output number.
  Pin      - Here the TCON pin type can be selected from <r_vdce_TconPin_t>.
  TconSig  - This is a pointer to the value of TCON signal type. See <r_vdce_TconSig_t>.

  Return value:
  See <r_vdce_Error_t>.

  Executable VDCE Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - NG
  Executing     - NG
*/

r_vdce_Error_t R_VDCE_DisplayTconPinSet(const uint32_t                 Unit,
                                        const r_vdce_TconPin_t         Pin,
                                        const r_vdce_TconSig_t * const TconSig);

/***************************************************************************
  Function: R_VDCE_DisplayTconPinGet

  Description:
  This function gets the TCON signal type which is output from the specified Tcon pin.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit     - It specifies the video output number.
  Pin      - Here the TCON pin type can be selected from <r_vdce_TconPin_t>.
  TconSig  - This is a pointer to the value of TCON signal type. See <r_vdce_TconSig_t>.

  Return value:
  See <r_vdce_Error_t>.

  Executable VDCE Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK
  Executing     - OK
*/

r_vdce_Error_t R_VDCE_DisplayTconPinGet(const uint32_t           Unit,
                                        const r_vdce_TconPin_t   Pin,
                                        r_vdce_TconSig_t * const TconSig);

/***************************************************************************
  Function: R_VDCE_DisplayPolaritySet

  Description:
  This function sets the polarity of the specified TCON signal type.
  But, the polarity of some TCON signals has to be set by <R_VDCE_DisplayTimingSet> (Timing->Flags).
  About R_VDCE_PIN_ENABLE, <R_VDCE_Sys_DesyncActLevelSet> is called with the polarity setting 
  by <R_VDCE_DisplayTimingSet>. If <R_VDCE_Sys_DesyncActLevelSet> returns 0, the polarity setting 
  by <R_VDCE_DisplayTimingSet> is effective for VDCE hardware. This function does not have effect.
  If <R_VDCE_Sys_DesyncActLevelSet> returns non-0, the polarity setting by this function is 
  effective for VDCE hardware.
  About R_VDCE_PIN_VSYNC, R_VDCE_Sys_VsyncActLevelSet is called with the polarity setting by 
  <R_VDCE_DisplayTimingSet>. If <R_VDCE_Sys_VsyncActLevelSet> returns 0, the polarity setting by 
  <R_VDCE_DisplayTimingSet> is effective for VDCE hardware. This function does not have effect.
  If <R_VDCE_Sys_VsyncActLevelSet> returns non-0, the polarity setting by this function is effective 
  for VDCE hardware.
  About R_VDCE_PIN_HSYNC, <R_VDCE_Sys_HsyncActLevelSet> is called with the polarity setting by 
  <R_VDCE_DisplayTimingSet>. If <R_VDCE_Sys_HsyncActLevelSet> returns 0, the polarity setting by 
  <R_VDCE_DisplayTimingSet> is effective for VDCE hardware. This function does not have effect.
  If <R_VDCE_Sys_HsyncActLevelSet> returns non-0, the polarity setting by this function is effective 
  for VDCE hardware.
  About other signals, the polarity setting by this function is always effective for VDCE hardware.
  This setting is valid until <R_VDCE_DeInit> is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit     - It specifies the video output number.
  Pin      - Here the pin can be selected from <r_vdce_Pin_t>.
  Polarity - Here the polarity can be set to <r_vdce_Polarity_t>.

  Return value:
  See <r_vdce_Error_t>.

  Executable VDCE Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - NG
  Executing     - NG
*/

r_vdce_Error_t R_VDCE_DisplayPolaritySet(const uint32_t          Unit,
                                         const r_vdce_Pin_t      Pin,
                                         const r_vdce_Polarity_t Polarity);

/***************************************************************************
  Function: R_VDCE_DisplayCalibrationSet

  Description:
  This function sets the brightness, contrast and panel dithering.
  This setting is valid until <R_VDCE_DeInit> is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit     - It specifies the video output number.
  Bright   - This is a pointer to the value of Brightness. When not changing, set NULL (R_NULL).
             Each default value is 512. See <r_vdce_Bright_t>.
  Contrast - This is a pointer to the value of Contrast gain. When not changing, set NULL (R_NULL).
             Each default value is 128. See <r_vdce_Contrast_t>.
  Dither   - This is a pointer to the value of panel dithering. When not changing, set NULL (R_NULL).
             See <r_vdce_Dither_t>.

  Return value:
  See <r_vdce_Error_t>.

  Executable VDCE Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK (Parameters become effective at the timing of next Vsync.)
  Executing     - OK (Parameters become effective at the timing of next Vsync.)
*/

r_vdce_Error_t R_VDCE_DisplayCalibrationSet(const uint32_t                  Unit,
                                            const r_vdce_Bright_t * const   Bright, 
                                            const r_vdce_Contrast_t * const Contrast,
                                            const r_vdce_Dither_t *const Dither);

/***************************************************************************
  Function: R_VDCE_DisplayGammaCorrectSet

  Description:
  This function sets the RGB gamma correction parameters.
  If Gamma is set to R_NULL, this function disables the gamma correction.
  Gamma correction is processed after brightness and contrast control
  (Brightness -> Contrast -> Gamma correction).
  This setting is valid until <R_VDCE_DeInit> is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit     - It specifies the video output number.
  Gamma    - This is a pointer to the value of Gamma Correction parameter.
             When the gamma correction is disabled, set to R_NULL.
             See <r_vdce_Gamma_t>.

  Return value:
  See <r_vdce_Error_t>.

  Executable VDCE Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK (Parameters become effective at the timing of next Vsync.)
  Executing     - OK (Parameters become effective at the timing of next Vsync.)

  Supported Device:
  RH850/D1M2(H) - OK
  RH850/D1M1A   - OK
  RH850/D1M1-V2 - OK
  RH850/D1M1(H) - OK
  RH850/D1L2(H) - NG
*/

r_vdce_Error_t R_VDCE_DisplayGammaCorrectSet(const uint32_t                  Unit,
                                             const r_vdce_Gamma_t * const    Gamma);

/***************************************************************************
  Function: R_VDCE_DisplayOutFormatSet

  Description:
  This function sets the output format.
  This setting is valid until <R_VDCE_DeInit> is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit      - It specifies the video output number.
  OutFormat - Here the output format can be set to <r_vdce_OutFormat_t>.

  Return value:
  See <r_vdce_Error_t>.

  Executable VDCE Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - NG
  Executing     - NG

  Supported Device:
  RH850/D1M2(H) - OK (Serial RGB is not supported.)
  RH850/D1M1A   - OK (Serial RGB is supported.)
  RH850/D1M1-V2 - OK (Serial RGB is supported.)
  RH850/D1M1(H) - OK (Serial RGB is not supported.)
  RH850/D1L2(H) - OK (Serial RGB is not supported.)
*/

r_vdce_Error_t R_VDCE_DisplayOutFormatSet ( const uint32_t Unit, 
                                            const r_vdce_OutFormat_t OutFormat );


/***************************************************************************
  Function: R_VDCE_DisplaySerialRGBSet

  Description:
  This function sets the Setial RGB output setting.
  This stting is valid when Setial RGB output is selected by <R_VDCE_DisplayOutFormatSet>.
  This setting is valid until <R_VDCE_DeInit> is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit  - It specifies the video output number.
  Freq  - Clock frequency control. See <r_vdce_SerialClkfreqsel_t>.
  Phase - Clock phase adjustment. See <r_vdce_SerialClkphase_t>.
  Scan  - Scan direction select. See <r_vdce_SerialScan_t>.
  Swap  - Swap . See <r_vdce_SerialSwap_t>

  Return value:
  See <r_vdce_Error_t>.

  Executable VDCE Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - NG
  Executing     - NG
  
  Supported Device:
  RH850/D1M2(H) - NG
  RH850/D1M1A   - OK
  RH850/D1M1-V2 - OK
  RH850/D1M1(H) - NG
  RH850/D1L2(H) - NG
  
*/
r_vdce_Error_t R_VDCE_DisplaySerialRGBSet(const uint32_t                   Unit,
                                          const r_vdce_SerialClkfreqsel_t  Freq,
                                          const r_vdce_SerialClkphase_t    Phase,
                                          const r_vdce_SerialScan_t        Scan,
                                          const r_vdce_SerialSwap_t        Swap);

/***************************************************************************
  Function: R_VDCE_DisplayVsyncProtectionSet

  Description:
  This function sets the Vsync protection.
  Vsync protection timing is made by PixelClock set by <R_VDCE_DisplayTimingSet>.
  The maximum value of MaskMs and LackMs is about (8,388,480,000 / PixelClock[Hz])[msec].
  If setting value is over the range, this function assumes that the maximum value is set.
  If Vsync lack is detected by compensation protection, R_VDCE_INTC_NO_VI_VSYNC_SIGNAL or 
  R_VDCE_INTC_NO_VI_VSYNC_SIGNAL_1 interrupt occurs.
  Vsync protections are disabled by default. 
  This setting is valid until <R_VDCE_DeInit> is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit      - It specifies the video output number.
  MaskMs    - Prevent vsyncs coming faster than MaskMs msec.
              If non-0 value is set, vsync masking is enabled. 
              If 0 is set, vsync masking is disabled.
  LackMs    - Compensate vsyncs coming slower than LackMs msec. 
              If non-0 value is set, vsync compensation is enabled. 
              If 0 is set, vsync compensation is disabled.

  Return value:
  See <r_vdce_Error_t>.

  Executable VDCE Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - NG
  Executing     - NG
*/

r_vdce_Error_t R_VDCE_DisplayVsyncProtectionSet(const uint32_t Unit,
                                                const uint16_t MaskMs,
                                                const uint16_t LackMs);

/***************************************************************************
  Function: R_VDCE_DisplayEnable

  Description:
  This function enables the display output.
  Execute <R_VDCE_DisplayTimingSet> before executing this function.
  If the function successfully execute, the return code will be <R_VDCE_ERR_OK> and
  the state will be in the idle state.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit - It specifies the video output number.

  Return value:
  See <r_vdce_Error_t>.

  Executable VDCE Status:
  Uninitialized - NG
  Initialized   - OK [All (VDCE, layer, OIR and capture) will be changed to "Idle".]
  Idle          - OK (Do nothing)
  Executing     - OK (Do nothing)
*/

r_vdce_Error_t R_VDCE_DisplayEnable(const uint32_t Unit);

/***************************************************************************
  Function: R_VDCE_DisplayDisable

  Description:
  This function disables the display output.
  All interrupt must be disabled by <R_VDCE_IntcDisable> before executing this function.
  If the function successfully execute, the return code will be R_VDCE_ERR_OK and
  the state will be in the initialized state.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit - It specifies the video output number.

  Return value:
  See <r_vdce_Error_t>.

  Executable VDCE Status:
  Uninitialized - OK (Do nothing)
  Initialized   - OK (Do nothing)
  Idle          - OK [All (VDCE, layer, OIR and capture) will be changed to "Initialized".]
  Executing     - NG
*/

r_vdce_Error_t R_VDCE_DisplayDisable(const uint32_t Unit);


/***************************************************************************
  Group: Layer functions
*/

/***************************************************************************
  Function: R_VDCE_LayerBaseSet

  Description:
  This function sets the layers base address.
  This setting is valid until <R_VDCE_DeInit> is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit    - It specifies the video output number.
  LayerNr - It specifies the layer from the following.
              R_VDCE_LAYER_SCALER0 / 
              R_VDCE_LAYER_SCALER1 / 
              R_VDCE_LAYER_IMAGE2  / 
              R_VDCE_LAYER_IMAGE3  
  Address - This is the 32 bit address of the layer buffer.
            Lower 7 bits are clamped to 0. If this is set to 0 then returns error.

  Return value:
  See <r_vdce_Error_t>.

  Executable Layer Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK
  Executing     - OK (Parameters become effective at the timing of next Vsync.)

  Note:
  In addition to the memory area occupied by the frame buffer, the next 512 bytes of memory must 
  be readable by the VDCE H/W. VDCE will neither use or modify the data in this area, so it may 
  be used by any other purpose. 
  Please be careful when you assign the frame buffer at the end of VRAM, SDRAM or other memory 
  area. 
  For details consult the D1x H/W User-manual (section: 38.6.1.2 (6) Restriction).

*/

r_vdce_Error_t R_VDCE_LayerBaseSet(const uint32_t Unit,
                                   const uint32_t LayerNr,
                                   const uint32_t Address);

/***************************************************************************
  Function: R_VDCE_OirBaseSet

  Description:
  This function sets the output image renderer read layer base address.
  This setting is valid until <R_VDCE_DeInit> is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit    - It specifies the video output number.
  Address - This is the 32 bit address of the layer buffer.
            Lower 7 bits are clamped to 0. If this is set to 0 then returns error.

  Return value:
  See <r_vdce_Error_t>.

  Executable OIR Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK
  Executing     - OK (Parameters become effective at the timing of next Vsync.)

  Note:
  In addition to the memory area occupied by the oir buffer, the next 512 bytes of memory must 
  be readable by the VDCE H/W. VDCE will neither use or modify the data in this area, so it may 
  be used by any other purpose. 
  Please be careful when you assign the oir buffer at the end of VRAM, SDRAM or other memory area.
  For details consult the D1x H/W User-manual (section: 38.6.1.2 (6) Restriction).

*/

r_vdce_Error_t R_VDCE_OirBaseSet(const uint32_t Unit,
                                 const uint32_t Address);

/***************************************************************************
  Function: R_VDCE_LayerMemGeometrySet

  Description:
  This function sets the layers memory geometry.
  It is the width and height of the layer's virtual memory window.
  This setting is valid until <R_VDCE_DeInit> is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit      - It specifies the video output number.
  LayerNr   - It specifies the layer from the following.
                R_VDCE_LAYER_SCALER0 / 
                R_VDCE_LAYER_SCALER1 / 
                R_VDCE_LAYER_IMAGE2  / 
                R_VDCE_LAYER_IMAGE3  
  Stride    - This is the width of the virtual memory window in pixel. Range is 1 to 4096.
              Lower 7 bits of Stride multiplied by bytes per pixel are clamped to 0.
  MemHeight - This is the height of the virtual memory window. Range is 1 to 4096.

  Return value:
  See <r_vdce_Error_t>.

  Executable Layer Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK
  Executing     - OK (Parameters become effective after the layer status is changed from Idle to Executing.)
*/

r_vdce_Error_t R_VDCE_LayerMemGeometrySet(const uint32_t Unit,
                                          const uint32_t LayerNr,
                                          const uint32_t Stride,
                                          const uint32_t MemHeight);

/***************************************************************************
  Function: R_VDCE_OirMemGeometrySet

  Description:
  This function sets the output image renderer read layer memory geometry.
  It is the width and height of the layer's virtual memory window.
  This setting is valid until <R_VDCE_DeInit> is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit      - It specifies the video output number.
  Stride    - This is the width of the virtual memory window in pixel. Range is 1 to 4096.
              Lower 7 bits of Stride multiplied by bytes per pixel are clamped to 0.
  MemHeight - This is the height of the virtual memory window. Range is 1 to 4096.

  Return value:
  See <r_vdce_Error_t>.

  Executable OIR Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK
  Executing     - OK (Parameters become effective after OIR status is changed from Idle to Executing.)
*/

r_vdce_Error_t R_VDCE_OirMemGeometrySet(const uint32_t Unit,
                                        const uint32_t Stride,
                                        const uint32_t MemHeight);

/***************************************************************************
  Function: R_VDCE_LayerFormatSet

  Description:
  This function sets the color format for the layer.
  This setting is valid until <R_VDCE_DeInit> is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit    - It specifies the video output number.
  LayerNr - It specifies the layer from the following.
              R_VDCE_LAYER_SCALER0 / 
              R_VDCE_LAYER_SCALER1 / 
              R_VDCE_LAYER_IMAGE2  / 
              R_VDCE_LAYER_IMAGE3  
  Format  - The color format. See <r_vdce_Format_t>.

  Return value:
  See <r_vdce_Error_t>.

  Executable Layer Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK
  Executing     - OK (This function executes R_VDCE_LayerDisable and R_VDCE_LayerEnable internally.)
*/

r_vdce_Error_t R_VDCE_LayerFormatSet(const uint32_t        Unit,
                                     const uint32_t        LayerNr,
                                     const r_vdce_Format_t Format);

/***************************************************************************
  Function: R_VDCE_OirFormatSet

  Description:
  This function sets the color format for the output image renderer read layer.
  This setting is valid until <R_VDCE_DeInit> is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit   - It specifies the video output number.
  Format - It specifies the color format from the following. 
              R_VDCE_RGB565 /
              R_VDCE_ARGB8888 
           See <r_vdce_Format_t>.
  
  Return value:
  See <r_vdce_Error_t>.

  Executable OIR Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK
  Executing     - OK (This function executes R_VDCE_OirDisable and R_VDCE_OirEnable internally.)
*/

r_vdce_Error_t R_VDCE_OirFormatSet(const uint32_t        Unit,
                                   const r_vdce_Format_t Format);

/***************************************************************************
  Function: R_VDCE_LayerViewPortSet

  Description:
  This function sets the layers viewport parameters.
  This setting is valid until <R_VDCE_DeInit> is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit       - It specifies the video output number.
  LayerNr    - It specifies the layer from the following.
                 R_VDCE_LAYER_SCALER0 / 
                 R_VDCE_LAYER_SCALER1 / 
                 R_VDCE_LAYER_IMAGE2  / 
                 R_VDCE_LAYER_IMAGE3  
  MemPosX    - This is the memory position x coordinate. Range is 0 only.
  MemPosY    - This is the memory position y coordinate. Range is 0 only.
  DispPosX   - This is the display position x coordinate. Range is -1280 to 1279.
               And the range is (3 - DispWidth) to (ScreenWidth - 3). 
               ScreenWidth is set by <R_VDCE_DisplayTimingSet>.
               Origin is at the left of visual screen area.
               If DispPosX is less than minimum value, this function will round up to the minimum 
               value. 
               If DispPosX is more than maximum value, this function will round down to the maximum 
               value. 
  DispPosY   - This is the display position y coordinate. Range is -1024 to 1023.
               And the range is (1 - DispHeight) to (ScreenHeight - 1). 
               ScreenHeight is set by <R_VDCE_DisplayTimingSet>.
               Origin is at the top of visual screen area.
               If DispPosY is less than minimum value, this function will round up to the minimum 
               value. 
               If DispPosY is more than maximum value, this function will round down to the maximum 
               value. 
  DispWidth  - This is the displayed width of the layer. Range is 3 to 1280.
  DispHeight - This is the displayed height of the layer. Range is 1 to 1024.

  Return value:
  See <r_vdce_Error_t>.

  Executable Layer Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK
  Executing     - OK (Parameters become effective at the timing of next Vsync.)

  Figure:
   *[Frame Buffer]*
  
   - Frame Buffer image without <R_VDCE_SCALING_LARGER>
   
       Address is parameter of <R_VDCE_LayerBaseSet>.
       
       Stride is parameter of <R_VDCE_LayerMemGeometrySet>.
       
       MemHeight is parameter of <R_VDCE_LayerMemGeometrySet>.

>                             Stride
>                      :<------------------------->:
>                      :                           :
>                      :      DispWidth            :
>                      :<-------------------->|    :
>                      :                      :    :
>          Address --> +----------------------+----+ - - - - - - - - - - - - - 
>                      |                      |    |   A              A
>                      |                      |    |   |              |
>                      |                      |    |   |              |
>                      |  Graphic Image Area  |    |   | DispHeight   |
>                      |                      |    |   |              |
>                      |                      |    |   |              |
>                      |                      |    |   V              | MemHeight 
>                      +----------------------+ - -| - - -            |
>                      |                           |                  |
>                      |                           |                  |
>                      |              Frame Buffer |                  V
>                      +---------------------------+ - - - - - - - - - - - - - 
>                      

   - Frame Buffer image with <R_VDCE_SCALING_LARGER>
   
       Address is parameter of <R_VDCE_LayerBaseSet>.
       
       ScaledWidth is parameter of <R_VDCE_LayerImgScaleX>. 
       It should be (ScaledWidth < DispWidth).
       
       ScaledHeight is parameter of <R_VDCE_LayerImgScaleY>. 
       It should be (ScaledHeight < DispHeight).
       
>                             Stride
>                      :<------------------------->:
>                      :                           :
>                      : ScaledWidth               :
>                      :<----------->|             :
>                      :             :             :
>          Address --> +-------------+-------------+ - - - - - - - - - - - - 
>                      |             |             |   A              A
>                      |  Graphic    |             |   |              |
>                      |  Image      |             |   | ScaledHeight |
>                      |  Area       |             |   |              |
>                      |             |             |   V              | MemHeight 
>                      +-------------+ - - - - - - | - - -            |
>                      |                           |                  |
>                      |                           |                  |
>                      |              Frame Buffer |                  V
>                      +---------------------------+ - - - - - - - - - - - - 
>                      

   *[Disaplay]*
   
   Shared area is the output image area of the layer.
   
   - Display Image (normal position case)
   
      ScreenWidth is parameter of <R_VDCE_DisplayTimingSet>.
   
      ScreenHeight is parameter of <R_VDCE_DisplayTimingSet>.
      
>                      :          ScreenWidth                   :   
>                      :<-------------------------------------->:   
>                      :                                        :   
>                      : DispPosX       DispWidth               :   
>                 (0,0):-------->:<-------------------->:       :   
>              - - - - +----------------------------------------+ - - - -    
>                 |    |         :                      :       |   A  
>        DispPosY |    |         :                      :       |   |  
>                 V    |         :                      :       |   |  
>                - - - |- - - - -+----------------------+       |   |  
>                 A    |         |//////////////////////|       |   |  
>                 |    |         |//////////////////////|       |   |  
>                 |    |         |///// Read data   ////|       |   |  
>      DispHeight |    |         |///// from        ////|       |   | ScreenHeight 
>                 |    |         |///// Frame Buffer////|       |   |  
>                 |    |         |//////////////////////|       |   |  
>                 V    |         |//////////////////////|       |   |  
>                - - - |- - - - -+----------------------+       |   |  
>                      |                                        |   |  
>                      |                                        |   |  
>                      |                       SCREEN AREA      |   V  
>                      +----------------------------------------+ - - - -    
>                      

   - Display Image (maximum position case)

      ScreenWidth is parameter of <R_VDCE_DisplayTimingSet>.
      It should be (DispPosX < ScreenWidth).

      ScreenHeight is parameter of <R_VDCE_DisplayTimingSet>.
      It should be (DispPosY < ScreenHeight).


>                      :          ScreenWidth                   : 
>                      :<-------------------------------------->: 
>                 (0,0):                                        : 
>                - - - +----------------------------------------+ 
>                  A   |                        |               | 
>                  |   |                        |               | 
>                  |   |                        |               | 
>                  |   |                        |               | 
>                  |   |       SCREEN           |               | 
>                  |   |        AREA            |               | 
>                  |   |                        |DispPosY       | 
>    ScreenHeight  |   |                        |               | 
>                  |   |                        |    Minimum    | 
>                  |   |                        |    3 pixel    | 
>                  |   |             DispPosX   V<------------->| 
>                  |   |----------------------->+----------------------+ - - -  
>                  |   |                      A |///////////////|      | A      
>                  |   |        Minimum 1Line | |///////////////|      | |      
>                  V   |                      V |///////////////|      | |      
>                - - - +----------------------------------------+      | |      
>                                               |                      | |Disp  
>                                               |       Read data      | |Height
>                                               |       from           | |      
>                                               |       Frame Buffer   | V      
>                                               +----------------------+ - - -  
>                                               :      DispWidth       : 
>                                               :<-------------------->:
>

   - Display Image (minimum position case)

      ScreenWidth is parameter of <R_VDCE_DisplayTimingSet>.

      ScreenHeight is parameter of <R_VDCE_DisplayTimingSet>.


>               :                               : 
>               :           DispWidth           : 
>               :<----------------------------->: 
>       - - - - +-------------------------------+ - -                      
>             A |                               | A                        
>             | |  Read data                    | | DispPosY               
>             | |  from        (0,0)            | |(Negative number)       
>       Disp  | |  Frame          +-------------+--------------------------+- - - - 
>       Height| |  Buffer         |/////////////| A                        |  A  
>             | |                 |/////////////| | Minimum 1Line          |  |  
>             V |                 |/////////////| V                        |  |  
>       - - - - +-----------------+-------------+- - -                     |  |  
>               :<----------------|<----------->:                          |  |  
>               :    DispPosX     |   Minimum   :    SCREEN                |  |  
>               :(Negative number)|   3 pixel   :     AREA                 |  |  
>                                 |                                        |  | ScreenHeight 
>                                 |                                        |  |  
>                                 |<-------------------------------------->|  |  
>                                 |             ScreenWidth                |  |  
>                                 |                                        |  |  
>                                 |                                        |  |  
>                                 |                                        |  |  
>                                 |                                        |  V  
>                                 +----------------------------------------+- - - - 
>

*/

r_vdce_Error_t R_VDCE_LayerViewPortSet(const uint32_t Unit,
                                       const uint32_t LayerNr,
                                       const int32_t  MemPosX,
                                       const int32_t  MemPosY,
                                       const int32_t  DispPosX,
                                       const int32_t  DispPosY,
                                       const int32_t  DispWidth,
                                       const int32_t  DispHeight);

/***************************************************************************
  Function: R_VDCE_OirViewPortSet

  Description:
  This function sets the output image renderer read layers viewport parameters.
  This setting is valid until <R_VDCE_DeInit> is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit       - It specifies the video output number.
  MemPosX    - This is the memory position x coordinate. Range is 0 only.
  MemPosY    - This is the memory position y coordinate. Range is 0 only.
  DispPosX   - This is the display position x coordinate. Range is -1280 to 1279.
  DispPosY   - This is the display position y coordinate. Range is -1024 to 1023.
  DispWidth  - This is the displayed width of the layer. Range is 3 to 1280.
  DispHeight - This is the displayed height of the layer. Range is 1 to 1024.

  Return value:
  See <r_vdce_Error_t>.

  Executable OIR Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK
  Executing     - OK (Parameters become effective at the timing of next Vsync.)
*/

r_vdce_Error_t R_VDCE_OirViewPortSet(const uint32_t Unit,
                                     const int32_t  MemPosX,
                                     const int32_t  MemPosY,
                                     const int32_t  DispPosX,
                                     const int32_t  DispPosY,
                                     const int32_t  DispWidth,
                                     const int32_t  DispHeight);

/***************************************************************************
  Function: R_VDCE_LayerRingBufferEnable

  Description:
  This function switches from a full framebuffers for the layer to a ring buffer usage.
  The size of the ring buffer in lines is given in Size parameter.
  This setting is valid until <R_VDCE_DeInit> is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit    - It specifies the video output number.
  LayerNr - It specifies the layer from the following.
              R_VDCE_LAYER_SCALER0 / 
              R_VDCE_LAYER_SCALER1  
  Size    - Size of the ring buffer in lines,
            e.g. 1 -> one line ring buffer, 2 -> two line ring buffer etc.
            Range is 1 to 2048.

  Return value:
  See <r_vdce_Error_t>.

  Executable Layer Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK
  Executing     - OK (Parameters become effective after the layer status is changed from Idle to Executing.)
*/

r_vdce_Error_t R_VDCE_LayerRingBufferEnable(const uint32_t Unit,
                                            const uint32_t LayerNr,
                                            const uint32_t Size);

/***************************************************************************
  Function: R_VDCE_OirRingBufferEnable

  Description:
  This function switches from a full framebuffers for the output image renderer read layer
  to a ring buffer usage. The size of the ring buffer in lines is given in Size parameter.
  This setting is valid until <R_VDCE_DeInit> is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit - It specifies the video output number.
  Size - Size of the ring buffer in lines,
         e.g. 1 -> one line ring buffer, 2 -> two line ring buffer etc.
         Range is 1 to 2048.

  Return value:
  See <r_vdce_Error_t>.

  Executable OIR Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK
  Executing     - OK (Parameters become effective after OIR status is changed from Idle to Executing.)
*/

r_vdce_Error_t R_VDCE_OirRingBufferEnable(const uint32_t Unit,
                                          const uint32_t Size);

/***************************************************************************
  Function: R_VDCE_LayerRingBufferDisable

  Description:
  This function switches back from ring buffer a full framebuffers usage of the layer.
  This setting is valid until <R_VDCE_DeInit> is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit    - It specifies the video output number.
  LayerNr - It specifies the layer from the following.
              R_VDCE_LAYER_SCALER0 / 
              R_VDCE_LAYER_SCALER1  

  Return value:
  See <r_vdce_Error_t>.

  Executable Layer Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK
  Executing     - OK (Parameters become effective after the layer status is changed from Idle to Executing.)
*/

r_vdce_Error_t R_VDCE_LayerRingBufferDisable(const uint32_t Unit,
                                             const uint32_t LayerNr);

/***************************************************************************
  Function: R_VDCE_OirRingBufferDisable

  Description:
  This function switches back from ring buffer a full framebuffers usage of the
  output image renderer read layer.
  This setting is valid until <R_VDCE_DeInit> is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit - It specifies the video output number.

  Return value:
  See <r_vdce_Error_t>.

  Executable OIR Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK
  Executing     - OK (Parameters become effective after OIR status is changed from Idle to Executing.)
*/

r_vdce_Error_t R_VDCE_OirRingBufferDisable(const uint32_t Unit);

/***************************************************************************
  Function: R_VDCE_LayerVSyncDelaySet

  Description:
  This function sets the Vsync signal delay between input Vsync to the scaler and output Vsync 
  from the scaler.
  This delay can be adjusted the reading timing from frame buffer. 
  It is useful when the input data is captured.
  This setting is valid until <R_VDCE_DeInit> is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit    - It specifies the video output number.
  LayerNr - It specifies the layer from the following.
              R_VDCE_LAYER_SCALER0 / 
              R_VDCE_LAYER_SCALER1  
  Delay   - It specifies the delays in the output Hsync period units.
            e.g. 1 -> 1 line delay, 2 -> 2 line delay etc.
            Default value is 0. Range is 0 to 255.

  Return value:
  See <r_vdce_Error_t>.

  Executable OIR Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK
  Executing     - OK (Parameters become effective after the layer status is changed from Idle to Executing.)
*/

r_vdce_Error_t R_VDCE_LayerVSyncDelaySet(const uint32_t Unit,
                                         const uint32_t LayerNr,
                                         const uint32_t Delay);

/***************************************************************************
  Function: R_VDCE_OirVSyncDelaySet

  Description:
  This function adjusts the read delay between output from Graphics 3 and input
  of output image renderer read layer.
  The output image renderer read layer is always running in sync with the output
  from the 4 graphics layers (Graphics 0 - Graphics 3).
  This setting is valid until <R_VDCE_DeInit> is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit  - It specifies the video output number.
  Delay - It specifies the delays between output from Graphics 3 and input
          of output image renderer read layer.
          The delay is specified in line units,
          e.g. 1 -> 1 line delay, 2 -> 2 line delay etc.
          Default value is 1. Range is 1 to 255.

  Return value:
  See <r_vdce_Error_t>.

  Executable OIR Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK
  Executing     - OK (Parameters become effective after OIR status is changed from Idle to Executing.)
*/

r_vdce_Error_t R_VDCE_OirVSyncDelaySet(const uint32_t Unit,
                                       const uint32_t Delay);

/****************************************************************************
  Function: R_VDCE_LayerModeSet

  Description:
  This function sets the optional mode for layer.
  This setting is valid until <R_VDCE_DeInit> is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit         - It specifies the video output number.
  LayerNr      - It specifies the layer from the following.
                   R_VDCE_LAYER_SCALER0 / 
                   R_VDCE_LAYER_SCALER1 / 
                   R_VDCE_LAYER_IMAGE2  / 
                   R_VDCE_LAYER_IMAGE3  
  LayerMode    - The layer mode. The flags of type <r_vdce_ScaleMode_t> can be combined with '|'.
                 See <r_vdce_ScaleMode_t>.

  Return value:
  See <r_vdce_Error_t>.

  Executable Layer Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK
  Executing     - OK (Parameters become effective after the layer status is changed from Idle to Executing.)
*/

r_vdce_Error_t R_VDCE_LayerModeSet(const uint32_t           Unit,
                                   const uint32_t           LayerNr,
                                   const r_vdce_LayerMode_t LayerMode);

/***************************************************************************
  Function: R_VDCE_OirModeSet

  Description:
  This function sets the OIR layer mode.
  This setting is valid until <R_VDCE_DeInit> is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit    - It specifies the video output number.
  OirMode - It specifies the OIR layer mode.
            See <r_vdce_OirMode_t>.

  Return value:
  See <r_vdce_Error_t>.

  Executable OIR Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK
  Executing     - NG
*/

r_vdce_Error_t R_VDCE_OirModeSet(const uint32_t         Unit,
                                 const r_vdce_OirMode_t OirMode);

/***************************************************************************
  Function: R_VDCE_LayerEnable

  Description:
  This function enables the layer display.
  Execute <R_VDCE_LayerFormatSet>, <R_VDCE_LayerMemGeometrySet> and <R_VDCE_LayerViewPortSet>
  before executing this function.
  If the function successfully execute, the return code will be <R_VDCE_ERR_OK> and
  the state will be in the executing state.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit    - It specifies the video output number.
  LayerNr - It specifies the layer from the following.
              R_VDCE_LAYER_SCALER0 / 
              R_VDCE_LAYER_SCALER1 / 
              R_VDCE_LAYER_IMAGE2  / 
              R_VDCE_LAYER_IMAGE3  

  Return value:
  See <r_vdce_Error_t>.

  Executable Layer Status:
  Uninitialized - NG
  Initialized   - NG
  Idle          - OK [The layer status will be changed to "Executing". 
                      VDCE status will also be changed to "Executing" if VDCE status is "Idle". ]
  Executing     - OK (Do nothing)
*/

r_vdce_Error_t R_VDCE_LayerEnable(const uint32_t Unit,
                                  const uint32_t LayerNr);

/***************************************************************************
  Function: R_VDCE_OirEnable

  Description:
  This function enables the output image renderer layer display.
  Execute <R_VDCE_OirFormatSet>, <R_VDCE_OirMemGeometrySet> and <R_VDCE_OirViewPortSet>
  before executing this function.
  If the function successfully execute, the return code will be <R_VDCE_ERR_OK> and
  the state will be in the executing state.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit - It specifies the video output number.

  Return value:
  See <r_vdce_Error_t>.

  Executable OIR Status:
  Uninitialized - NG
  Initialized   - NG
  Idle          - OK [OIR status will be changed to "Executing". 
                      VDCE status will also be changed to "Executing" if VDCE status is "Idle". ]
  Executing     - OK (Do nothing)
*/

r_vdce_Error_t R_VDCE_OirEnable(const uint32_t Unit);

/***************************************************************************
  Function: R_VDCE_LayerDisable

  Description:
  This function disables the layer display.
  If the function successfully execute, the return code will be R_VDCE_ERR_OK and
  the state will be in the idle state.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit    - It specifies the video output number.
  LayerNr - It specifies the layer from the following.
              R_VDCE_LAYER_SCALER0 / 
              R_VDCE_LAYER_SCALER1 / 
              R_VDCE_LAYER_IMAGE2  / 
              R_VDCE_LAYER_IMAGE3  

  Return value:
  See <r_vdce_Error_t>.

  Executable Layer Status:
  Uninitialized - OK (Do nothing)
  Initialized   - OK (Do nothing)
  Idle          - NG
  Executing     - OK [The layer status will be changed to "Idle". 
                      VDCE status will also be changed to "Idle" if all block (layer, OIR and capture) status are "Idle". ]
*/

r_vdce_Error_t R_VDCE_LayerDisable(const uint32_t Unit,
                                   const uint32_t LayerNr);

/***************************************************************************
  Function: R_VDCE_OirDisable

  Description:
  This function disables the output image renderer layer display.
  If the function successfully execute, the return code will be R_VDCE_ERR_OK and
  the state will be in the idle state.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit - It specifies the video output number.

  Return value:
  See <r_vdce_Error_t>.

  Executable OIR Status:
  Uninitialized - OK (Do nothing)
  Initialized   - OK (Do nothing)
  Idle          - NG
  Executing     - OK [OIR status will be changed to "Idle". 
                      VDCE status will also be changed to "Idle" if all block (layer, OIR and capture) status are "Idle".]
*/

r_vdce_Error_t R_VDCE_OirDisable(const uint32_t Unit);

/***************************************************************************
  Function: R_VDCE_LayerMatrixSet

  Description:
  This function sets the color conversion matrix of layer 0, layer 1 and video input.
  This setting is valid until <R_VDCE_DeInit> is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit    - It specifies the video output number.
  LayerNr - It specifies the layer from the following.
              R_VDCE_LAYER_SCALER0 / 
              R_VDCE_LAYER_SCALER1 / 
              R_VDCE_LAYER_INPUT  
  Matrix  - Contains the conversion matrix including offsets. See <r_vdce_Matrix_t>.

  Return value:
  See <r_vdce_Error_t>.

  Executable Layer Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK
  Executing     - OK (Parameters become effective at the timing of next Vsync.)
*/

r_vdce_Error_t R_VDCE_LayerMatrixSet(const uint32_t                Unit,
                                     const uint32_t                LayerNr,
                                     const r_vdce_Matrix_t * const Matrix);

/***************************************************************************
  Function: R_VDCE_LayerMatrixBT601Set

  Description:
  This function sets the color conversion matrix of layer 0, layer 1 and video input to BT601 spec.
  This setting is valid until <R_VDCE_DeInit> is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit    - It specifies the video output number.
  LayerNr - It specifies the layer from the following.
              R_VDCE_LAYER_SCALER0 / 
              R_VDCE_LAYER_SCALER1 / 
              R_VDCE_LAYER_INPUT  

  Return value:
  See <r_vdce_Error_t>.

  Executable Layer Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK
  Executing     - OK (Parameters become effective at the timing of next Vsync.)
*/

r_vdce_Error_t R_VDCE_LayerMatrixBT601Set(const uint32_t Unit,
                                          const uint32_t LayerNr);

/***************************************************************************
  Function: R_VDCE_LayerMatrixJPEGSet

  Description:
  This function sets the color conversion matrix of layer 0, layer 1 and video input to JPEG spec.
  This setting is valid until <R_VDCE_DeInit> is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit    - It specifies the video output number.
  LayerNr - It specifies the layer from the following.
              R_VDCE_LAYER_SCALER0 / 
              R_VDCE_LAYER_SCALER1 / 
              R_VDCE_LAYER_INPUT  

  Return value:
  See <r_vdce_Error_t>.

  Executable Layer Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK
  Executing     - OK (Parameters become effective at the timing of next Vsync.)
*/

r_vdce_Error_t R_VDCE_LayerMatrixJPEGSet(const uint32_t Unit,
                                         const uint32_t LayerNr);

/***************************************************************************
  Function: R_VDCE_LayerMatrixUnitySet

  Description:
  This function sets the color conversion matrix of layer 0, layer 1 and video input to bypass mode.
  This setting is valid until <R_VDCE_DeInit> is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit    - It specifies the video output number.
  LayerNr - It specifies the layer from the following.
              R_VDCE_LAYER_SCALER0 / 
              R_VDCE_LAYER_SCALER1 / 
              R_VDCE_LAYER_INPUT  

  Return value:
  See <r_vdce_Error_t>.

  Executable Layer Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK
  Executing     - OK (Parameters become effective at the timing of next Vsync.)
*/

r_vdce_Error_t R_VDCE_LayerMatrixUnitySet(const uint32_t Unit,
                                          const uint32_t LayerNr);

/***************************************************************************
  Function: R_VDCE_LayerImgScaleX

  Description:
  This function sets the scaling parameters in X direction. 
  
  When <R_VDCE_SCALING_LARGER> is selected, enlarged image will be displayed.
  ScaledWidth should be specified the original size in frame buffer.
  See <R_VDCE_LayerViewPortSet> for details.
  
  When <R_VDCE_SCALING_SMALLER> is selected, reduced image will be captured.
  ScaledWidth should be specified the scaled size in frame buffer.
  See <R_VDCE_CapBufGeometrySetup> for details.
  
  This setting is valid until <R_VDCE_DeInit> is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit        - It specifies the video output number.
  LayerNr     - It specifies the layer from the following.
                  R_VDCE_LAYER_SCALER0 / 
                  R_VDCE_LAYER_SCALER1 
  ScaledWidth - The parameter defines the size to calculate the scaling ratio. 
                Range is 4 and over.
                If Scaling is <R_VDCE_SCALING_LARGER>, range is less than DispWidth of
                <R_VDCE_LayerViewPortSet>. 
                If Scaling is <R_VDCE_SCALING_SMALLER>, range is less than Width of
                <R_VDCE_CapBufGeometrySetup> and range is 1024 and less. Lower 2 bits 
                are clamped to 0. 
  Scaling     - The parameter defines the behavior. See <r_vdce_Scale_t>.
                 R_VDCE_SCALING_LARGER  /
                 R_VDCE_SCALING_SMALLER /
                 R_VDCE_SCALING_DISABLE

  Return value:
   ScaledWidth - No error occurs.
   0           - Error occurs. 
   

  Executable Layer Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK
  Executing     - OK (Parameters become effective at the timing of next Vsync.)

  Supported Device:
  RH850/D1M2(H) - OK
  RH850/D1M1A   - OK
  RH850/D1M1-V2 - OK
  RH850/D1M1(H) - OK
  RH850/D1L2(H) - NG (Scaling = R_VDCE_SCALING_LARGER, R_VDCE_SCALING_SMALLER) 
                / OK (Scaling = R_VDCE_SCALING_DISABLE)
  
  Note:
  If <R_VDCE_SCALING_LARGER> is selected, following function is not effective in the layer.
  - alpha channel per pixel data.
  - premultiplied alpha channel.
  - constant alpha channel 
  - chroma key

  If <R_VDCE_SCALING_LARGER> or <R_VDCE_SCALING_SMALLER> is selected, it is necessary to 
  input the clock selected by the register below.
  In particular, please be careful when you do not use video capturing.

  > +--------------------+-----------------------+
  > | parameter setting  |  Clock                |
  > +-----+--------------+                       |
  > |Unit |   LayerNr    |                       |
  > |============================================|
  > |  0  |      0       | CKSC_IVDCE0VIS_CTL    |
  > |  0  |      1       | VDCECTL.VI1CTL (*1)   |
  > |  1  |      0       | VDCECTL.VI1CTL (*1)   |
  > |  1  |      0       | CKSC_IVDCE0VIS_CTL    |
  > +-----+--------------+-----------------------+
  > (*) RH850/D1M2(H) Only. It is not necessary to select the clock on other devices. 

*/

uint32_t R_VDCE_LayerImgScaleX(const uint32_t       Unit,
                               const uint32_t       LayerNr,
                               const uint32_t       ScaledWidth,
                               const r_vdce_Scale_t Scaling);

/***************************************************************************
  Function: R_VDCE_LayerImgScaleY

  Description:
  This function sets the scaling parameters in Y direction. 
  
  When <R_VDCE_SCALING_LARGER> is selected, enlarged image will be displayed.
  ScaledHeight should be specified the original size in frame buffer.
  See <R_VDCE_LayerViewPortSet> for details.
  
  When <R_VDCE_SCALING_SMALLER> is selected, reduced image will be captured.
  ScaledHeight should be specified the scaled size in frame buffer.
  See <R_VDCE_CapBufGeometrySetup> for details.
  
  This setting is valid until <R_VDCE_DeInit> is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit         - It specifies the video output number.
  LayerNr      - It specifies the layer from the following.
                   R_VDCE_LAYER_SCALER0 / 
                   R_VDCE_LAYER_SCALER1 
  ScaledHeight - The parameter defines the size to calculate the scaling ratio. 
                 Range is 4 and over.
                 If Scaling is <R_VDCE_SCALING_LARGER>, range is less than DispHeight of
                 <R_VDCE_LayerViewPortSet>.
                 If Scaling is <R_VDCE_SCALING_SMALLER>, range is less than Height of
                 <R_VDCE_CapBufGeometrySetup> and range is 1024 and less. Lower 2 bits 
                 are clamped to 0.
  Scaling      - The parameter defines the behavior. See <r_vdce_Scale_t>.
                 R_VDCE_SCALING_LARGER  /
                 R_VDCE_SCALING_SMALLER /
                 R_VDCE_SCALING_DISABLE

  Return value:
   ScaledHeight - No error occurs.
   0            - Error occurs. 

  Executable Layer Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK
  Executing     - OK (Parameters become effective at the timing of next Vsync.)
  
  Supported Device:
  RH850/D1M2(H) - OK
  RH850/D1M1A   - OK
  RH850/D1M1-V2 - OK
  RH850/D1M1(H) - OK
  RH850/D1L2(H) - NG (Scaling = R_VDCE_SCALING_LARGER, R_VDCE_SCALING_SMALLER) 
                / OK (Scaling = R_VDCE_SCALING_DISABLE)
  
  Note:
  If <R_VDCE_SCALING_LARGER> is selected, following function is not effective in the layer.
  - alpha channel per pixel data
  - premultiplied alpha channel
  - constant alpha channel 
  - chroma key

  If <R_VDCE_SCALING_LARGER> or <R_VDCE_SCALING_SMALLER> is selected, it is necessary to 
  input the clock selected by the register below.
  In particular, please be careful when you do not use video capturing.

  > +--------------------+-----------------------+
  > | parameter setting  |  Clock                |
  > +-----+--------------+                       |
  > |Unit |   LayerNr    |                       |
  > |============================================|
  > |  0  |      0       | CKSC_IVDCE0VIS_CTL    |
  > |  0  |      1       | VDCECTL.VI1CTL (*1)   |
  > |  1  |      0       | VDCECTL.VI1CTL (*1)   |
  > |  1  |      0       | CKSC_IVDCE0VIS_CTL    |
  > +-----+--------------+-----------------------+
  > (*) RH850/D1M2(H) Only. It is not necessary to select the clock on other devices. 

*/

uint32_t R_VDCE_LayerImgScaleY(const uint32_t       Unit,
                               const uint32_t       LayerNr,
                               const uint32_t       ScaledHeight,
                               const r_vdce_Scale_t Scaling);


/***************************************************************************
  Function: R_VDCE_LayerImgScaleModeSet

  Description:
  This function sets the optional mode for enlargement and reduction.
  This setting is valid until <R_VDCE_DeInit> is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit         - It specifies the video output number.
  LayerNr      - It specifies the layer from the following.
                   R_VDCE_LAYER_SCALER0 / 
                   R_VDCE_LAYER_SCALER1 
  Mode         - The scaler mode. The flags of type <r_vdce_ScaleMode_t> can be combined with '|'.
                 See <r_vdce_ScaleMode_t>.

  Return value:
  See <r_vdce_Error_t>.

  Executable Layer Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK
  Executing     - OK (Parameters become effective at the next following timing.)
                  - R_VDCE_LayerImgScaleX is executed while layer is executing.
                  - R_VDCE_LayerImgScaleY is executed while layer is executing.
                  - The layer status is changed from Idle to Executing.

  Supported Device:
  RH850/D1M2(H) - OK
  RH850/D1M1A   - OK
  RH850/D1M1-V2 - OK
  RH850/D1M1(H) - OK
  RH850/D1L2(H) - NG
  
*/

r_vdce_Error_t R_VDCE_LayerImgScaleModeSet(const uint32_t           Unit,
                                           const uint32_t           LayerNr,
                                           const r_vdce_ScaleMode_t Mode);

/***************************************************************************
  Group: Extended Layer functions
*/

/***************************************************************************
  Function: R_VDCE_LayerAlphaChannelEnable

  Description:
  This function re-enables the alpha channel per pixel data that is disabled 
  by <R_VDCE_LayerAlphaChannelDisable>. 
  This setting is valid until <R_VDCE_DeInit> is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit    - It specifies the video output number.
  LayerNr - It specifies the layer from the following.
              R_VDCE_LAYER_SCALER1 / 
              R_VDCE_LAYER_IMAGE2  / 
              R_VDCE_LAYER_IMAGE3    

  Return value:
  See <r_vdce_Error_t>.

  Executable Layer Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK
  Executing     - OK (Parameters become effective after the layer status is changed from Idle to Executing.)
*/

r_vdce_Error_t R_VDCE_LayerAlphaChannelEnable(const uint32_t Unit,
                                              const uint32_t LayerNr);

/***************************************************************************
  Function: R_VDCE_LayerAlphaChannelDisable

  Description:
  This function disables the alpha channel per pixel data.
  If color format set by <R_VDCE_LayerFormatSet> has alpha channel (i.e. ARGBxxxx, RGBAxxxx, CLUTx ),
  the alpha channel per pixel data is enabled at first. This function can disable this alpha channel.
  This setting is valid until <R_VDCE_DeInit> is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit    - It specifies the video output number.
  LayerNr - It specifies the layer from the following.
              R_VDCE_LAYER_SCALER1 / 
              R_VDCE_LAYER_IMAGE2  / 
              R_VDCE_LAYER_IMAGE3    

  Return value:
  See <r_vdce_Error_t>.

  Executable Layer Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK
  Executing     - OK (Parameters become effective after the layer status is changed from Idle to Executing.)
*/

r_vdce_Error_t R_VDCE_LayerAlphaChannelDisable(const uint32_t Unit,
                                               const uint32_t LayerNr);

/***************************************************************************
  Function: R_VDCE_LayerPremultipliedAlphaEnable

  Description:
  This function enables the layers premultiplied alpha channel.
  This setting is valid until <R_VDCE_DeInit> is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit    - It specifies the video output number.
  LayerNr - It specifies the layer from the following.
              R_VDCE_LAYER_SCALER1 / 
              R_VDCE_LAYER_IMAGE2  / 
              R_VDCE_LAYER_IMAGE3    

  Return value:
  See <r_vdce_Error_t>.

  Executable Layer Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK
  Executing     - OK (Parameters become effective after the layer status is changed from Idle to Executing.)
*/

r_vdce_Error_t R_VDCE_LayerPremultipliedAlphaEnable(const uint32_t Unit,
                                                    const uint32_t LayerNr);

/***************************************************************************
  Function: R_VDCE_LayerPremultipliedAlphaDisable

  Description:
  This function disables the layers premultiplied alpha channel.
  This setting is valid until <R_VDCE_DeInit> is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit    - It specifies the video output number.
  LayerNr - It specifies the layer from the following.
              R_VDCE_LAYER_SCALER1 / 
              R_VDCE_LAYER_IMAGE2  / 
              R_VDCE_LAYER_IMAGE3    

  Return value:
  See <r_vdce_Error_t>.

  Executable Layer Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK
  Executing     - OK (Parameters become effective after the layer status is changed from Idle to Executing.)
*/

r_vdce_Error_t R_VDCE_LayerPremultipliedAlphaDisable(const uint32_t Unit,
                                                     const uint32_t LayerNr);

/***************************************************************************
  Function: R_VDCE_LayerAlphaConstEnable

  Description:
  This function enables the layers alpha constant alpha function.
  This setting is valid until <R_VDCE_DeInit> is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit       - It specifies the video output number.
  LayerNr    - It specifies the layer from the following.
                 R_VDCE_LAYER_SCALER1 / 
                 R_VDCE_LAYER_IMAGE2  / 
                 R_VDCE_LAYER_IMAGE3    
  AlphaConst - This is a constant alpha value from 0-255 that is used for every pixel in the layer.
               It is multiplied with the alpha value from alpha channel
               to construct the final alpha value that is used to blend the pixel.

  Return value:
  See <r_vdce_Error_t>.

  Executable Layer Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK
  Executing     - OK (Parameters become effective at the timing of next Vsync.)

  Note:
  If constant alpha channel is enabled, following function is not effective in the layer.
  - chroma key
  
*/

r_vdce_Error_t R_VDCE_LayerAlphaConstEnable(const uint32_t Unit,
                                            const uint32_t LayerNr,
                                            const uint8_t  AlphaConst);

/***************************************************************************
  Function: R_VDCE_LayerAlphaConstDisable

  Description:
  This function disables the layers alpha constant alpha function.
  This setting is valid until <R_VDCE_DeInit> is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit    - It specifies the video output number.
  LayerNr - It specifies the layer from the following.
              R_VDCE_LAYER_SCALER1 / 
              R_VDCE_LAYER_IMAGE2  / 
              R_VDCE_LAYER_IMAGE3    

  Return value:
  See <r_vdce_Error_t>.

  Executable Layer Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK
  Executing     - OK (Parameters become effective after the layer status is changed from Idle to Executing.)
*/

r_vdce_Error_t R_VDCE_LayerAlphaConstDisable(const uint32_t Unit,
                                             const uint32_t LayerNr);

/***************************************************************************
  Function: R_VDCE_LayerClutSet

  Description:
  This function updates and switches between these two CLUTs.
  The CLUT in VDCE is double buffered. One CLUT is shown and one can be written to.
  This function can be executed only once in Vsync period. 
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit     - It specifies the video output number.
  LayerNr  - It specifies the layer from the following.
               R_VDCE_LAYER_SCALER0 / 
               R_VDCE_LAYER_SCALER1 / 
               R_VDCE_LAYER_IMAGE2  / 
               R_VDCE_LAYER_IMAGE3    
  Offset   - ID of the first CLUT Entry to be written. Range is 0 to ClutSize -1.
  ClutSize - Number of Clut Entry to be written.
             When format is <R_VDCE_CLUT1>, range is 1 to 2.
             When format is <R_VDCE_CLUT4>, range is 1 to 16.
             When format is <R_VDCE_CLUT8>, range is 1 to 256.
  Clut     - The Color Look up Table.

  Return value:
  See <r_vdce_Error_t>.

  Executable Layer Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK
  Executing     - OK (Parameters become effective at the timing of next Vsync.)
*/

r_vdce_Error_t R_VDCE_LayerClutSet(const uint32_t                    Unit,
                                   const uint32_t                    LayerNr,
                                   const uint32_t                    Offset,
                                   const uint32_t                    ClutSize,
                                   const r_vdce_ClutARGB32_t * const Clut);

/***************************************************************************
  Function: R_VDCE_LayerChromaKeyEnable

  Description:
  This function enables the layers Chroma key.
  If color format is YCbCr, this setting is invalid.
  This setting is valid until <R_VDCE_DeInit> is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit      - It specifies the video output number.
  LayerNr   - It specifies the layer from the following.
                R_VDCE_LAYER_SCALER1 / 
                R_VDCE_LAYER_IMAGE2  / 
                R_VDCE_LAYER_IMAGE3    
  CkTarget  - The parameter specifies the color signal to process. Range changes by the format.
              (e.g. color format is ARGB4444, range of CkTarget.R,G,B is 0 to 15)
              When a format is CLUT8, CLUT4 or CLUT1, it sets an index to CkTarget.A and
              the range of CkTarget.R,G,B is only 0.
              When a format is RGB format of the other, the range of CkTarget.A is only 0.
  CkReplace - The parameter specifies the color signal to replace. Range changes by the format.
              (e.g. color format is ARGB4444, range of CkReplace.R,G,B is 0 to 15)
              When a format is CLUT8, CLUT4 or CLUT1, the range of CkReplace.A,R,G,B is 0 to 255.
              When a format is RGB format of the other, the range of CkReplace.A is 0 to 255.

  Return value:
  See <r_vdce_Error_t>.

  Executable Layer Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK
  Executing     - OK (Parameters become effective at the timing of next Vsync.)

  Note:
  If chroma-key is enabled, following function is not effective in the layer.
  - alpha channel per pixel data
  - premultiplied alpha channel

*/

r_vdce_Error_t R_VDCE_LayerChromaKeyEnable(const uint32_t                  Unit,
                                           const uint32_t                  LayerNr,
                                           const r_vdce_CkARGB32_t * const CkTarget,
                                           const r_vdce_CkARGB32_t * const CkReplace);

/***************************************************************************
  Function: R_VDCE_LayerChromaKeyDisable

  Description:
  This function disables the layers Chroma key.
  This setting is valid until <R_VDCE_DeInit> is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit      - It specifies the video output number.
  LayerNr   - It specifies the layer from the following.
                R_VDCE_LAYER_SCALER1 / 
                R_VDCE_LAYER_IMAGE2  / 
                R_VDCE_LAYER_IMAGE3    

  Return value:
  See <r_vdce_Error_t>.

  Executable Layer Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK
  Executing     - OK (Parameters become effective after the layer status is changed from Idle to Executing.)
*/

r_vdce_Error_t R_VDCE_LayerChromaKeyDisable(const uint32_t Unit,
                                            const uint32_t LayerNr);


/***************************************************************************
  Group: Capture functions
*/

/***************************************************************************
  Function: R_VDCE_CapBufGeometrySetup

  Description:
  This function sets the parameters for the capture buffers and the size of the incoming video data.
  This setting is valid until <R_VDCE_DeInit> is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit     - VDCE unit number to capture.
  Buffer1  - Address of the first buffer, which is used to capture the first field.
             Lower 7 bits are clamped to 0. If this is set to 0 then returns error.
  Buffer2  - Address of the second buffer, which is used to capture the second field.
             Lower 7 bits are clamped to 0. If this is set to 0 then Buffer2 = Buffer1.
  Stride   - When switching to the next line of the capture buffer, Stride pixels will be added.
             Range is 1 to 4096.
             Lower 7 bits of Stride multiplied by bytes per pixel are clamped to 0.
  Width    - The parameter specifies the width of the incoming video in pixels.
             Range is 4 to 2011. Lower 2 bits are clamped to 0.
             Range of sum of StartX and Width is 2015 and less.
             When Width is greater than 1024 pixels, horizontal image size must be reduced to 1024 
             pixels or less.
  Height   - The parameter specifies the Height of the incoming video in pixels.
             For an interlaced video, the height will be the height of one frame.
             Range is 4 to 1024. Lower 2 bits are clamped to 0.
             Range of sum of StartY and Height is 2039 and less.
  StartX   - The parameter specifies the synchronized mode and skipped pixels. 
             When StartX is set to the range of 16 to 2011, video input synchronize with Hsync signal 
             and StartX pixels are skipped after horizontal synchronization, before capturing starts. 
             When StartX is set to 0, video input synchronize with Data Enable signal and capture starts 
             from first cycle of data enable. This mode can't be supported in case of interlace input.
  StartY   - When StartY is set to the range of 4 to 2035, StartY+1 lines are skipped after vertical 
             synchronization, before capturing of the first field starts.
             When StartY is set to 0, no line is skipped. 
             When video input synchronize with Data Enable signal (StartX = 0), StartY must be setting 
             to 0.
             When video data is input from MIPI, capturing should start from top/left screen if 
             StartX = 17 and StartY = 0 are set. 
             
  FBformat - It specifies the frame buffer format. See <r_vdce_Fbformat_t>.
                - R_VDCE_FB_FORMAT_YCBCR_422  
                - R_VDCE_FB_FORMAT_RGB565  
                - R_VDCE_FB_FORMAT_RGB0888 
                - R_VDCE_FB_FORMAT_YCBCR_444  

  Return value:
  See <r_vdce_Error_t>.

  Executable Capture Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK
  Executing     - OK (Parameters become effective after the capture status is changed from Idle to Executing.)

  Supported Device:
  RH850/D1M2H   - OK (StartX=0 is supported. StartY=0 is supported.)
  RH850/D1M2    - OK (StartX=0 is supported. StartY=0 is supported. Unit=1 is only available.)
  RH850/D1M1A   - OK (StartX=0 is supported. StartY=0 is supported. Unit=0 is only available.)
  RH850/D1M1-V2 - OK (StartX=0 is supported. StartY=0 is supported.)
  RH850/D1M1(H) - OK (StartX=0 is not supported. StartY=0 is not supported.)
  RH850/D1L2(H) - NG 


  Figure:
   - Input signal

     VDCE captures following video data.

>                        +--+                                     +--+     
>                        |  |      Input Hsync signal             |  |     
>                    ----+  +-------------------------------------+  +---  
>         |                 :  StartX         Width                  :     
>         |                 :<------->:<-------------------->:       :     
>         +--+      - - - - +----------------------------------------+     
>            |         A    |         :                      :       |     
>         +--+  StartY |    |         :                      :       |     
>         |       +1   V    |         :                      :       |     
>         |           - - - |- - - - -+----------------------+       |     
>         |            A    |         |                      |       |     
>  Input  |            |    |         |                      |       |     
>  Vsync  |            |    |         |    Image Area        |       |     
>  signal |     Height |    |         |    to be captured    |       |     
>         |            |    |         |                      |       |     
>         |            |    |         |                      |       |     
>         |            V    |         |                      |       |     
>         |           - - - |- - - - -+----------------------+       |     
>         |                 |                                        |     
>         +--+              |                                        |     
>            |              |                                        |     
>         +--+              +----------------------------------------+     
>         |                                                                
>


   - Frame buffer geometry without <R_VDCE_SCALING_SMALLER>

     Captured data is stored to frame buffer.

>                             Stride
>                      :<------------------------->:
>                      :                           :
>                      :      Width                :
>                      :<-------------------->|    :
>                      :                      :    :
>          Buffer1 --> +----------------------+----+ - - -
>         or Buffer2   |                      |    |   A
>                      |                      |    |   |
>                      |                      |    |   |
>                      |    Video Image Area  |    |   | Height
>                      |                      |    |   |
>                      |                      |    |   |
>                      |                      |    |   V
>                      +----------------------+----+ - - -
>

   - Frame Buffer geometry with <R_VDCE_SCALING_SMALLER>

     Captured data is stored to frame buffer after scale-down.

     ScaledWidth is parameter of <R_VDCE_LayerImgScaleX>.
     It should be (ScaledWidth < Width).
     
     ScaledHeight is parameter of <R_VDCE_LayerImgScaleY>.
     It should be (ScaledHeight < Height).
     
>                             Stride
>                      :<------------------------->:
>                      :                           :
>                      : ScaledWidth               :
>                      :<------------>:            :
>                      :              :            :
>          Buffer1 --> +--------------+------------+ - - -
>         or Buffer2   |              |            |   A
>                      |  Video       |            |   | 
>                      |  Image       |            |   | ScaledHeight
>                      |  Area        |            |   | 
>                      |              |            |   V
>                      +--------------+------------+ - - -  
*/

r_vdce_Error_t R_VDCE_CapBufGeometrySetup(const uint32_t          Unit,
                                          const uint32_t          Buffer1,
                                          const uint32_t          Buffer2,
                                          const uint32_t          Stride,
                                          const uint32_t          Width,
                                          const uint32_t          Height,
                                          const uint32_t          StartX,
                                          const uint32_t          StartY,
                                          const r_vdce_Fbformat_t FBformat);

/***************************************************************************
  Function: R_VDCE_CapModeSet

  Description:
  This function sets the capturing mode.
  This setting is valid until <R_VDCE_DeInit> is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit - VDCE unit number to capture.
  Mode - The following flags of type <r_vdce_CapMode_t> can be combined with '|'.
         
         One of these six flags must be selected.
           -  R_VDCE_CAP_MODE_YUV_ITU656
           -  R_VDCE_CAP_MODE_YUV_8BIT  
           -  R_VDCE_CAP_MODE_YUV_16BIT 
           -  R_VDCE_CAP_MODE_RGB_16BPP 
           -  R_VDCE_CAP_MODE_RGB_18BPP 
           -  R_VDCE_CAP_MODE_RGB_24BPP 
         
         The following flags are optional.
           -  R_VDCE_CAP_MODE_DITHER    
           -  R_VDCE_CAP_MODE_YUV_Y_UV_INVERT 
           -  R_VDCE_CAP_MODE_VSYNC_INVERT    
           -  R_VDCE_CAP_MODE_HSYNC_INVERT    
           -  R_VDCE_CAP_MODE_DATA_CLK_INVERT 
           -  R_VDCE_CAP_MODE_VSYNC_CLK_INVERT
           -  R_VDCE_CAP_MODE_HSYNC_CLK_INVERT
           -  R_VDCE_CAP_MODE_H_MIRRORING     
           -  R_VDCE_CAP_MODE_V_MIRRORING     
           -  R_VDCE_CAP_MODE_FIXED_VSYNC     
           -  R_VDCE_CAP_MODE_BIG_ENDIAN      

  Return value:
  See <r_vdce_Error_t>.

  Executable Capture Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK
  Executing     - OK (Parameters become effective after the capture status is changed from Idle to Executing.)

  Supported Device:
  RH850/D1M2(H) - OK 
  RH850/D1M2    - OK (Unit=1 is only available.)
  RH850/D1M1A   - OK (Unit=0 is only available.)
  RH850/D1M1-V2 - OK 
  RH850/D1M1(H) - OK 
  RH850/D1L2(H) - NG 
*/

r_vdce_Error_t R_VDCE_CapModeSet(const uint32_t         Unit,
                                 const r_vdce_CapMode_t Mode);

/***************************************************************************
  Function: R_VDCE_CapBufSet

  Description:
  This function sets the parameters for the capture.
  This setting is valid until <R_VDCE_DeInit> is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit     - VDCE unit number to capture.
  Buffer1  - Address of the first buffer, which is used to capture the first field.
             Lower 7 bits are clamped to 0. If this is set to 0 then returns error.
             This parameter is the same as Buffer1 of <R_VDCE_CapBufGeometrySetup>.
  Buffer2  - Address of the second buffer, which is used to capture the second field.
             Lower 7 bits are clamped to 0. If this is set to 0 then returns error.
             This parameter is the same as Buffer2 of <R_VDCE_CapBufGeometrySetup>.

  Return value:
  See <r_vdce_Error_t>.

  Executable Capture Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK
  Executing     - OK (Parameters become effective at the timing of next Vsync.)

  Supported Device:
  RH850/D1M2H   - OK 
  RH850/D1M2    - OK (Unit=1 is only available.)
  RH850/D1M1A   - OK (Unit=0 is only available.)
  RH850/D1M1-V2 - OK 
  RH850/D1M1(H) - OK 
  RH850/D1L2(H) - NG 
*/

r_vdce_Error_t R_VDCE_CapBufSet(const uint32_t Unit,
                                const uint32_t Buffer1,
                                const uint32_t Buffer2);

/***************************************************************************
  Function: R_VDCE_CapBufFieldSetup1

  Description:
  This function sets the parameters for the capture.
  This setting is valid until <R_VDCE_DeInit> is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit     - VDCE unit number to capture.
  Buffer1  - Address of the first buffer, which is used to capture the first field.
             Lower 7 bits are clamped to 0. If this is set to 0 then returns error.
             This parameter is the same as Buffer1 of <R_VDCE_CapBufGeometrySetup>.
  StartY   - When StartY is set to the range of 4 to 2035, StartY+1 lines are skipped after vertical 
             synchronization, before capturing of the first field starts.
             When StartY is set to 0, no line is skipped.  
             This parameter is the same as StartY of <R_VDCE_CapBufGeometrySetup>.

  Return value:
  See <r_vdce_Error_t>.

  Executable Capture Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK
  Executing     - OK (Parameters become effective at the timing of next Vsync.)

  Supported Device:
  RH850/D1M2H   - OK (StartY=0 is supported.)
  RH850/D1M2    - OK (StartY=0 is supported. Unit=1 is only available.)
  RH850/D1M1A   - OK (StartY=0 is supported. Unit=0 is only available.)
  RH850/D1M1-V2 - OK (StartY=0 is supported.)
  RH850/D1M1(H) - OK (StartY=0 is not supported.)
  RH850/D1L2(H) - NG 
*/

r_vdce_Error_t R_VDCE_CapBufFieldSetup1(const uint32_t Unit,
                                        const uint32_t Buffer1,
                                        const uint32_t StartY);

/***************************************************************************
  Function: R_VDCE_CapBufFieldSetup2

  Description:
  This function sets the parameters for the capture.
  This setting is valid until <R_VDCE_DeInit> is executed.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit     - VDCE unit number to capture.
  Buffer2  - Address of the second buffer, which is used to capture the second field.
             Lower 7 bits are clamped to 0.
             If this is set to 0 then Buffer2 = Buffer1 of <R_VDCE_CapBufGeometrySetup>.
             This parameter is the same as Buffer2 of <R_VDCE_CapBufGeometrySetup>.
  StartY   - When StartY is set to the range of 4 to 2035, StartY+1 lines are skipped after vertical 
             synchronization, before capturing of the first field starts.
             When StartY is set to 0, no line is skipped.  
             This parameter is the same as StartY of <R_VDCE_CapBufGeometrySetup>.

  Return value:
  See <r_vdce_Error_t>.

  Executable Capture Status:
  Uninitialized - NG
  Initialized   - OK
  Idle          - OK
  Executing     - OK (Parameters become effective at the timing of next Vsync.)

  Supported Device:
  RH850/D1M2H   - OK (StartY=0 is supported.)
  RH850/D1M2    - OK (StartY=0 is supported. Unit=1 is only available.)
  RH850/D1M1A   - OK (StartY=0 is supported. Unit=0 is only available.)
  RH850/D1M1-V2 - OK (StartY=0 is supported.)
  RH850/D1M1(H) - OK (StartY=0 is not supported.)
  RH850/D1L2(H) - NG 
*/

r_vdce_Error_t R_VDCE_CapBufFieldSetup2(const uint32_t Unit,
                                        const uint32_t Buffer2,
                                        const uint32_t StartY);

/***************************************************************************
  Function: R_VDCE_CapEnable

  Description:
  This function enables the video capturing.
  Execute <R_VDCE_CapBufGeometrySetup> and <R_VDCE_CapModeSet> before executing this function.
  If the function successfully execute, the return code will be <R_VDCE_ERR_OK> and
  the state will be in the executing state.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.
  
  Capture data is connected to the following layer by conformation of geometry setup. 
  If OutputUnit is set as 0 or 1, this function enables the connecting layer. So Execute 
  <R_VDCE_LayerFormatSet>, <R_VDCE_LayerMemGeometrySet> and <R_VDCE_LayerViewPortSet>
  before executing this function. Layer control like a Scaling-down should be set to connecting 
  layer.
  > +---------------------------+------------------+
  > |  parameter setting        |                  |
  > +-----+---------------------+                  |
  > |Unit |     OutputUnit      | Connecting Layer |
  > |==============================================|
  > |  0  |         0           | Scaler0 of Unit0 |
  > |  1  |         1           | Scaler0 of Unit1 |
  > |  0  |         1           | Scaler1 of Unit1 |
  > |  1  |         0           | Scaler1 of Unit0 |
  > |  0  |R_VDCE_CAP_NO_DISPLAY| No connection    |
  > |  1  |R_VDCE_CAP_NO_DISPLAY| No connection    |
  > +-----+---------------------+------------------+
  
  If R_VDCE_CAP_NO_DISPLAY is specified, the capturing starts independently of the layer control and 
  displaying. So, layer control like a Scaling-down is not available. And, capture option of 
  R_VDCE_CAP_MODE_H_MIRRORING and R_VDCE_CAP_MODE_V_MIRRORING are not available too.
  
  
  Parameter:
  Unit       - VDCE unit number to capture.
  OutputUnit - VDCE unit number to display.
               R_VDCE_CAP_NO_DISPLAY is also selectable when capture is independently of displaying.
  
  Return value:
  See <r_vdce_Error_t>.

  Executable Capture Status:
  Uninitialized - NG
  Initialized   - NG (when OutputUnit is 0 or 1.) / OK (when OutputUnit is R_VDCE_CAP_NO_DISPLAY.)
  Idle          - OK [Capture status will be changed to "Executing". 
                      VDCE status will also be changed to "Executing" if VDCE status is "Idle". ]
  Executing     - OK (Do nothing)

  Supported Device:
  RH850/D1M2H   - OK 
  RH850/D1M2    - OK (Unit=1 is only available.)
  RH850/D1M1A   - OK (Unit=0 is only available.)
  RH850/D1M1-V2 - OK 
  RH850/D1M1(H) - OK 
  RH850/D1L2(H) - NG 

  Note:
  It is necessary to input the clock selected by the register below before you enable the video 
  capturing.

  > +------------------------------+
  > | Unit |  Clock                |
  > |==============================|
  > |  0   | CKSC_IVDCE0VIS_CTL    |
  > |  1   | VDCECTL.VI1CTL (*1)   |
  > +------+-----------------------+
  > (*) RH850/D1M2(H) Only. 

*/

r_vdce_Error_t R_VDCE_CapEnable(const uint32_t Unit,
                                const uint32_t OutputUnit);

/***************************************************************************
  Function: R_VDCE_CapDisable

  Description:
  This function disables the video capturing.
  If the function successfully execute, the return code will be <R_VDCE_ERR_OK> and
  the state will be in the idle state.
  This API function uses <R_VDCE_Sys_Lock> and <R_VDCE_Sys_Unlock> to prevent multiple execution.
  When executing this API function by the interrupt handler, be careful of <R_VDCE_Sys_Lock> and
  <R_VDCE_Sys_Unlock> having to be able to be executed by the interrupt handler.

  Parameter:
  Unit - VDCE unit number to capture.

  Return value:
  See <r_vdce_Error_t>.

  Executable Capture Status:
  Uninitialized - OK (Do nothing)
  Initialized   - OK (Do nothing)
  Idle          - NG 
  Executing     - OK [Capture status will be changed to "Idle". 
                      VDCE status will also be changed to "Idle" if all block (layer, OIR and capture) status are "Idle".]

  Supported Device:
  RH850/D1M2H   - OK 
  RH850/D1M2    - OK (Unit=1 is only available.)
  RH850/D1M1A   - OK (Unit=0 is only available.)
  RH850/D1M1-V2 - OK 
  RH850/D1M1(H) - OK 
  RH850/D1L2(H) - NG 
*/

r_vdce_Error_t R_VDCE_CapDisable(const uint32_t Unit);


#ifdef __cplusplus
}
#endif


#endif /* R_VDCE_API_H */