xref: /OK3568_Linux_fs/external/rockit/tgi/sdk/include/rt_type.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  * Copyright 2018 Rockchip Electronics Co. LTD
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * author: martin.cheng@rock-chips.com
17  *   date: 20180704
18  */
19 
20 #ifndef INCLUDE_RT_BASE_RT_TYPE_H_
21 #define INCLUDE_RT_BASE_RT_TYPE_H_
22 
23 #include <stdint.h>
24 
25 #define RT_NULL     0
26 #define RT_NONE     "none"
27 #define RT_BOOL     char
28 #define RT_TRUE     1
29 #define RT_FALSE    0
30 
31 #define TODO_FLAG   0
32 
33 #ifndef uid_t
34 #define uid_t        uint32_t
35 #endif
36 typedef int32_t      rt_status;
37 
38 typedef int8_t       INT8;
39 typedef int16_t      INT16;
40 typedef int32_t      INT32;
41 typedef int64_t      INT64;
42 
43 typedef uint8_t      UINT8;
44 typedef uint8_t      UCHAR;
45 typedef uint16_t     UINT16;
46 typedef uint32_t     UINT32;
47 typedef uint64_t     UINT64;
48 
49 typedef void*        RT_PTR;
50 typedef void         RT_VOID;
51 typedef float        RT_FLOAT;
52 typedef short        RT_SHORT;   // NOLINT
53 
54 #define RtToBool(cond)  ((cond) != 0)
55 #define RtToS8(x)       ((INT8)(x))
56 #define RtToU8(x)       ((UINT8)(x))
57 #define RtToS16(x)      ((INT16)(x))
58 #define RtToU16(x)      ((UINT16)(x))
59 #define RtToS32(x)      ((INT32)(x))
60 #define RtToU32(x)      ((UINT32)(x))
61 
62 #define RT_MaxS16   32767
63 #define RT_MinS16   -32767
64 #define RT_MaxU16   0xFFFF
65 #define RT_MinU16   0
66 #define RT_MaxS32   0x7FFFFFFF
67 #define RT_MinS32   -SK_MaxS32
68 #define RT_MaxU32   0xFFFFFFFF
69 #define RT_MinU32   0
70 #define RT_NaN32    (1 << 31)
71 
72 #define RtAlign2(x)     (((x) + 1) >> 1 << 1)
73 #define RtIsAlign2(x)   (0 == ((x) & 1))
74 
75 #define RtAlign4(x)     (((x) + 3) >> 2 << 2)
76 #define RtIsAlign4(x)   (0 == ((x) & 3))
77 
78 #define RtAlign8(x)     (((x) + 7) >> 3 << 3)
79 #define RtIsAlign8(x)   (0 == ((x) & 7))
80 
81 #define MKTAG(a, b, c, d) ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24))
82 
83 #define RT_RB(type, x)     (((const type*)(x))[0])
84 #define RT_WB(type, p, d)  do { ((type*)(p))[0] = (d); } while (0)   // NOLINT
85 
86 typedef struct _RTRect {
87     INT32 x;
88     INT32 y;
89     INT32 w;
90     INT32 h;
91 } RTRect;
92 
93 typedef struct _RTCropInfo {
94     RTRect region;
95     UINT32 virWidth;
96     UINT32 virHeight;
97 } RTCropInfo;
98 
99 #endif  // INCLUDE_RT_BASE_RT_TYPE_H_
100