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_SNS_CTRL_ADAPT_H__
17 #define __HI_SNS_CTRL_ADAPT_H__
18 
19 #include "hi_type.h"
20 #include "hi_comm_3a_adapt.h"
21 #include "hi_sns_ctrl.h"
22 
23 #ifdef __cplusplus
24 #if __cplusplus
25 extern "C" {
26 #endif
27 #endif /* End of #ifdef __cplusplus */
28 
29 typedef struct {
30     hi_bool      init;                   /* HI_TRUE: Sensor init */
31     hi_bool      sync_init;              /* HI_TRUE: Sync Reg init */
32     hi_u8        img_mode;
33     hi_u8        hdr;                 /* HI_TRUE: HDR enbale */
34     hi_wdr_mode  wdr_mode;
35 
36     hi_isp_sns_regs_info regs_info[ISP_SNS_SAVE_INFO_MAX]; /* [0]: Sensor reg info of cur-frame;
37                                                               [1]: Sensor reg info of pre-frame ; */
38 
39     hi_u32      fl[ISP_SNS_SAVE_INFO_MAX];                /* [0]: FullLines of cur-frame;
40                                                              [1]: Pre FullLines of pre-frame */
41     hi_u32      fl_std;                    /* FullLines std */
42     hi_u32      wdr_int_time[WDR_MAX_FRAME_NUM];
43     hi_u32      sensor_wb_gain[ISP_BAYER_CHN_NUM];
44 } hi_isp_sns_state;
45 
46 typedef ISP_SNS_MIRRORFLIP_TYPE_E hi_isp_sns_mirrorflip_type;
47 
48 typedef struct {
49     hi_s32  (*pfn_register_callback)(hi_vi_pipe vi_pipe, hi_isp_alg_lib *ae_lib, hi_isp_alg_lib *awb_lib);
50     hi_s32  (*pfn_un_register_callback)(hi_vi_pipe vi_pipe, hi_isp_alg_lib *ae_lib, hi_isp_alg_lib *awb_lib);
51     hi_s32  (*pfn_set_bus_info)(hi_vi_pipe vi_pipe, hi_isp_sns_commbus sns_bus_info);
52     hi_void (*pfn_standby)(hi_vi_pipe vi_pipe);
53     hi_void (*pfn_restart)(hi_vi_pipe vi_pipe);
54     hi_void (*pfn_mirror_flip)(hi_vi_pipe vi_pipe, hi_isp_sns_mirrorflip_type sns_mirror_flip);
55     hi_s32  (*pfn_write_reg)(hi_vi_pipe vi_pipe, hi_s32 addr, hi_s32 data);
56     hi_s32  (*pfn_read_reg)(hi_vi_pipe vi_pipe, hi_s32 addr);
57     hi_s32  (*pfn_set_init)(hi_vi_pipe vi_pipe, hi_isp_init_attr *init_attr);
58 } hi_isp_sns_obj;
59 
60 #ifdef __cplusplus
61 #if __cplusplus
62 }
63 #endif
64 #endif /* End of #ifdef __cplusplus */
65 
66 #endif /* __HI_SNS_CTRL_ADAPT_H__ */
67