• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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( __SENSOR_FSM_H__ )
21 #define __SENSOR_FSM_H__
22 
23 
24 
25 typedef struct _sensor_fsm_t sensor_fsm_t;
26 typedef struct _sensor_fsm_t *sensor_fsm_ptr_t;
27 typedef const struct _sensor_fsm_t *sensor_fsm_const_ptr_t;
28 
29 #include "sensor_init.h"
30 #include "system_spi.h"
31 #include "acamera_sbus_api.h"
32 #include "acamera_sensor_api.h"
33 #include "acamera_firmware_config.h"
34 
35 uint32_t sensor_boot_init( sensor_fsm_ptr_t p_fsm );
36 void sensor_configure_buffers( sensor_fsm_ptr_t p_fsm );
37 void sensor_hw_init( sensor_fsm_ptr_t p_fsm );
38 void sensor_sw_init( sensor_fsm_ptr_t p_fsm );
39 void sensor_deinit( sensor_fsm_ptr_t p_fsm );
40 void sensor_update_black( sensor_fsm_ptr_t p_fsm );
41 uint32_t sensor_get_lines_second( sensor_fsm_ptr_t p_fsm );
42 
43 struct _sensor_fsm_t {
44     fsm_common_t cmn;
45 
46     acamera_fsm_mgr_t *p_fsm_mgr;
47     fsm_irq_mask_t mask;
48     sensor_control_t ctrl;
49     void *sensor_ctx;
50     uint8_t mode;
51     uint8_t preset_mode;
52     uint16_t isp_output_mode;
53     uint16_t black_level;
54     uint8_t is_streaming;
55     uint8_t info_preset_num;
56     uint32_t boot_status;
57 };
58 
59 struct sqrt_ext_param_t {
60     uint32_t gain;
61     uint32_t black_level_in;
62     uint32_t black_level_out;
63 };
64 
65 struct square_be_ext_param_t {
66     uint32_t gain;
67     uint32_t black_level_in;
68     uint32_t black_level_out;
69 };
70 
71 void sensor_fsm_clear( sensor_fsm_ptr_t p_fsm );
72 void sensor_fsm_init( void *fsm, fsm_init_param_t *init_param );
73 
74 int sensor_fsm_set_param( void *fsm, uint32_t param_id, void *input, uint32_t input_size );
75 int sensor_fsm_get_param( void *fsm, uint32_t param_id, void *input, uint32_t input_size, void *output, uint32_t output_size );
76 
77 uint8_t sensor_fsm_process_event( sensor_fsm_ptr_t p_fsm, event_id_t event_id );
78 void sensor_fsm_process_interrupt( sensor_fsm_const_ptr_t p_fsm, uint8_t irq_event );
79 
80 void sensor_request_interrupt( sensor_fsm_ptr_t p_fsm, system_fw_interrupt_mask_t mask );
81 
82 #endif /* __SENSOR_FSM_H__ */
83