1 /* 2 * 3 * SPDX-License-Identifier: GPL-2.0 4 * 5 * Copyright (C) 2011-2018 ARM or its affiliates 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; version 2. 10 * This program is distributed in the hope that it will be useful, but 11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 * for more details. 14 * You should have received a copy of the GNU General Public License along 15 * with this program; if not, write to the Free Software Foundation, Inc., 16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 * 18 */ 19 20 #if !defined( __AE_FSM_H__ ) 21 #define __AE_FSM_H__ 22 23 24 #include "sbuf.h" 25 26 typedef struct _AE_fsm_t AE_fsm_t; 27 typedef struct _AE_fsm_t *AE_fsm_ptr_t; 28 typedef const struct _AE_fsm_t *AE_fsm_const_ptr_t; 29 30 #define ISP_HAS_AE_FSM 1 31 32 typedef struct _ae_manual_param_t { 33 uint32_t pi_coeff; 34 uint32_t target_point; 35 uint32_t tail_weight; 36 uint32_t long_clip; 37 uint32_t er_avg_coeff; 38 uint32_t AE_tol; 39 } ae_manual_param_t; 40 void ae_initialize( AE_fsm_ptr_t p_fsm ); 41 int ae_calculate_exposure( AE_fsm_ptr_t p_fsm ); 42 void ae_roi_update( AE_fsm_ptr_t p_fsm ); 43 void ae_set_new_param( AE_fsm_ptr_t p_fsm, sbuf_ae_t *p_sbuf_ae ); 44 int ae_set_zone_weight(AE_fsm_ptr_t p_fsm, void *u_wg_ptr); 45 46 struct _AE_fsm_t { 47 fsm_common_t cmn; 48 49 acamera_fsm_mgr_t *p_fsm_mgr; 50 fsm_irq_mask_t mask; 51 int32_t error_log2; 52 int32_t ae_hist_mean; 53 int32_t exposure_log2; 54 int32_t new_exposure_log2; 55 int64_t integrator; 56 uint32_t exposure_ratio; 57 uint32_t new_exposure_ratio; 58 uint32_t exposure_ratio_avg; 59 uint32_t fullhist[ISP_FULL_HISTOGRAM_SIZE]; 60 uint32_t fullhist_sum; 61 uint32_t ae_roi_api; 62 uint32_t roi; 63 uint8_t save_hist_api; 64 #if FW_ZONE_AE 65 uint8_t smart_zone_enable; 66 uint16_t hist4[ACAMERA_ISP_METERING_AEXP_NODES_USED_HORIZ_DEFAULT * ACAMERA_ISP_METERING_AEXP_NODES_USED_VERT_DEFAULT]; 67 uint8_t zone_weight[ACAMERA_ISP_METERING_AEXP_NODES_USED_HORIZ_DEFAULT * ACAMERA_ISP_METERING_AEXP_NODES_USED_VERT_DEFAULT]; 68 uint8_t x1; 69 uint8_t y1; 70 uint8_t x2; 71 uint8_t y2; 72 #endif 73 uint32_t frame_id_tracking; 74 }; 75 76 77 void AE_fsm_clear( AE_fsm_ptr_t p_fsm ); 78 79 void AE_fsm_init( void *fsm, fsm_init_param_t *init_param ); 80 int AE_fsm_set_param( void *fsm, uint32_t param_id, void *input, uint32_t input_size ); 81 int AE_fsm_get_param( void *fsm, uint32_t param_id, void *input, uint32_t input_size, void *output, uint32_t output_size ); 82 83 uint8_t AE_fsm_process_event( AE_fsm_ptr_t p_fsm, event_id_t event_id ); 84 85 void AE_fsm_process_interrupt( AE_fsm_const_ptr_t p_fsm, uint8_t irq_event ); 86 87 void AE_request_interrupt( AE_fsm_ptr_t p_fsm, system_fw_interrupt_mask_t mask ); 88 89 #endif /* __AE_FSM_H__ */ 90