1/*
2 * Copyright (c) 2022 HiSilicon (Shanghai) Technologies CO., LIMITED.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16#ifndef __HI_COMM_SYS_H__
17#define __HI_COMM_SYS_H__
18
19#include "hi_type.h"
20#include "hi_errno.h"
21#include "hi_debug.h"
22#include "hi_comm_video.h"
23
24#ifdef __cplusplus
25extern "C" {
26#endif /* End of #ifdef __cplusplus */
27
28#define BIND_DEST_MAXNUM         64
29#define HI_UNIQUE_ID_NUM         6
30#define HI_GPS_ACCURACY_LEVEL    3  /* dd/mm/ss */
31#define HI_GPS_NUMBER_DIMENSION  2  /* numerator/denominator */
32
33typedef struct hiVPSS_VENC_WRAP_PARAM_S {
34    HI_BOOL bAllOnline;
35    /*
36     * Input frame rate of VIPROC(linear/Frame mode WDR is the sensor frame rate,
37     * and the line mode WDR is the frame rate after synthesis)
38     */
39    HI_U32 u32FrameRate;
40    HI_U32 u32FullLinesStd; /* Total height of sensor, include of VBlank */
41
42    SIZE_S stLargeStreamSize; /* VENC Large Stream Size */
43    SIZE_S stSmallStreamSize; /* VENC Small Stream Size */
44} VPSS_VENC_WRAP_PARAM_S;
45
46typedef struct hiMPP_SYS_CONFIG_S {
47    HI_U32 u32Align;
48} MPP_SYS_CONFIG_S;
49
50typedef struct hiSYS_VIRMEM_INFO_S {
51    HI_U64 u64PhyAddr;
52    HI_BOOL bCached;
53} SYS_VIRMEM_INFO_S;
54
55typedef struct hiMPP_BIND_DEST_S {
56    HI_U32 u32Num;
57    MPP_CHN_S astMppChn[BIND_DEST_MAXNUM];
58} MPP_BIND_DEST_S;
59
60typedef enum hiSCALE_RANGE_E {
61    SCALE_RANGE_0 = 0, /* scale range <   8/64 */
62    SCALE_RANGE_1, /* scale range >=  8/64 */
63    SCALE_RANGE_2, /* scale range >= 10/64 */
64    SCALE_RANGE_3, /* scale range >= 15/64 */
65    SCALE_RANGE_4, /* scale range >= 19/64 */
66    SCALE_RANGE_5, /* scale range >= 24/64 */
67    SCALE_RANGE_6, /* scale range >= 29/64 */
68    SCALE_RANGE_7, /* scale range >= 33/64 */
69    SCALE_RANGE_8, /* scale range >= 35/64 */
70    SCALE_RANGE_9, /* scale range >= 38/64 */
71    SCALE_RANGE_10, /* scale range >= 42/64 */
72    SCALE_RANGE_11, /* scale range >= 45/64 */
73    SCALE_RANGE_12, /* scale range >= 48/64 */
74    SCALE_RANGE_13, /* scale range >= 51/64 */
75    SCALE_RANGE_14, /* scale range >= 53/64 */
76    SCALE_RANGE_15, /* scale range >= 55/64 */
77    SCALE_RANGE_16, /* scale range >= 57/64 */
78    SCALE_RANGE_17, /* scale range >= 60/64 */
79    SCALE_RANGE_18, /* scale range >  1     */
80    SCALE_RANGE_BUTT,
81} SCALE_RANGE_E;
82
83typedef enum hiCOEFF_LEVEL_E {
84    COEFF_LEVEL_0 = 0, /* coefficient level 0 */
85    COEFF_LEVEL_1, /* coefficient level 1 */
86    COEFF_LEVEL_2, /* coefficient level 2 */
87    COEFF_LEVEL_3, /* coefficient level 3 */
88    COEFF_LEVEL_4, /* coefficient level 4 */
89    COEFF_LEVEL_5, /* coefficient level 5 */
90    COEFF_LEVEL_6, /* coefficient level 6 */
91    COEFF_LEVEL_7, /* coefficient level 7 */
92    COEFF_LEVEL_8, /* coefficient level 8 */
93    COEFF_LEVEL_9, /* coefficient level 9 */
94    COEFF_LEVEL_10, /* coefficient level 10 */
95    COEFF_LEVEL_11, /* coefficient level 11 */
96    COEFF_LEVEL_12, /* coefficient level 12 */
97    COEFF_LEVEL_13, /* coefficient level 13 */
98    COEFF_LEVEL_14, /* coefficient level 14 */
99    COEFF_LEVEL_15, /* coefficient level 15 */
100    COEFF_LEVEL_16, /* coefficient level 16 */
101    COEFF_LEVEL_17, /* coefficient level 17 */
102    COEFF_LEVEL_18, /* coefficient level 18 */
103    COEFF_LEVEL_BUTT,
104} COEFF_LEVEL_E;
105
106typedef struct hiSCALE_COEFF_LEVEL_S {
107    COEFF_LEVEL_E enHorLum; /* horizontal luminance coefficient level */
108    COEFF_LEVEL_E enHorChr; /* horizontal chrominance coefficient level */
109    COEFF_LEVEL_E enVerLum; /* vertical luminance coefficient level */
110    COEFF_LEVEL_E enVerChr; /* vertical chrominance coefficient level */
111} SCALE_COEFF_LEVEL_S;
112
113typedef struct hiSCALE_RANGE_S {
114    SCALE_RANGE_E enHorizontal;
115    SCALE_RANGE_E enVertical;
116} SCALE_RANGE_S;
117
118typedef struct hiSCALE_COEFF_INFO_S {
119    SCALE_RANGE_S stScaleRange;
120    SCALE_COEFF_LEVEL_S stScaleCoeffLevel;
121} SCALE_COEFF_INFO_S;
122
123typedef struct hiGPS_INFO_S {
124    /* GPS LatitudeRef Indicates whether the latitude is north or south latitude, 'N'/'S', default 'N' */
125    HI_CHAR chGPSLatitudeRef;
126    /*
127     * GPS Latitude is expressed as degrees, minutes and seconds,
128     * a typical format like "dd/1, mm/1, ss/1", default 0/1, 0/1, 0/1
129     */
130    HI_U32 au32GPSLatitude[HI_GPS_ACCURACY_LEVEL][HI_GPS_NUMBER_DIMENSION];
131    /* GPS LongitudeRef Indicates whether the longitude is east or west longitude, 'E'/'W', default 'E' */
132    HI_CHAR chGPSLongitudeRef;
133    /*
134     * GPS Longitude is expressed as degrees, minutes and seconds, a typical format
135     * like "dd/1, mm/1, ss/1", default 0/1, 0/1, 0/1
136     */
137    HI_U32 au32GPSLongitude[HI_GPS_ACCURACY_LEVEL][HI_GPS_NUMBER_DIMENSION];
138    /* GPS AltitudeRef Indicates the reference altitude used, 0 - above sea level,1 - below sea level default 0 */
139    HI_U8 u8GPSAltitudeRef;
140    /*
141     * GPS AltitudeRef Indicates the altitude based on the reference u8GPSAltitudeRef,
142     * the reference unit is meters, default 0/1
143     */
144    HI_U32 au32GPSAltitude[HI_GPS_NUMBER_DIMENSION];
145} GPS_INFO_S;
146
147typedef enum hiVI_VPSS_MODE_E {
148    VI_OFFLINE_VPSS_OFFLINE = 0,
149    VI_OFFLINE_VPSS_ONLINE,
150    VI_ONLINE_VPSS_OFFLINE,
151    VI_ONLINE_VPSS_ONLINE,
152    VI_PARALLEL_VPSS_OFFLINE,
153    VI_PARALLEL_VPSS_PARALLEL,
154    VI_VPSS_MODE_BUTT
155} VI_VPSS_MODE_E;
156
157typedef struct hiVI_VPSS_MODE_S {
158    VI_VPSS_MODE_E aenMode[VI_MAX_PIPE_NUM];
159} VI_VPSS_MODE_S;
160
161typedef struct hiRAW_FRAME_COMPRESS_PARAM_S {
162    HI_U32 u32CompRatio_10Bit; /* compression ratio of 10 bit */
163    HI_U32 u32CompRatio_12Bit; /* compression ratio of 12 bit */
164    HI_U32 u32CompRatio_14Bit; /* compression ratio of 14 bit */
165} RAW_FRAME_COMPRESS_PARAM_S;
166
167typedef struct hiHI_UNIQUE_ID_S {
168    HI_U32 u32Id[HI_UNIQUE_ID_NUM];
169} HI_UNIQUE_ID_S;
170
171#define HI_ERR_SYS_NULL_PTR      HI_DEF_ERR(HI_ID_SYS, EN_ERR_LEVEL_ERROR, EN_ERR_NULL_PTR)
172#define HI_ERR_SYS_NOTREADY      HI_DEF_ERR(HI_ID_SYS, EN_ERR_LEVEL_ERROR, EN_ERR_SYS_NOTREADY)
173#define HI_ERR_SYS_NOT_PERM      HI_DEF_ERR(HI_ID_SYS, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_PERM)
174#define HI_ERR_SYS_NOMEM         HI_DEF_ERR(HI_ID_SYS, EN_ERR_LEVEL_ERROR, EN_ERR_NOMEM)
175#define HI_ERR_SYS_ILLEGAL_PARAM HI_DEF_ERR(HI_ID_SYS, EN_ERR_LEVEL_ERROR, EN_ERR_ILLEGAL_PARAM)
176#define HI_ERR_SYS_BUSY          HI_DEF_ERR(HI_ID_SYS, EN_ERR_LEVEL_ERROR, EN_ERR_BUSY)
177#define HI_ERR_SYS_NOT_SUPPORT   HI_DEF_ERR(HI_ID_SYS, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_SUPPORT)
178
179#ifdef __cplusplus
180}
181#endif /* __cplusplus */
182
183#endif /* __HI_COMM_SYS_H__ */
184