#ifndef _SH_CSS_INTERNAL_H_
#define _SH_CSS_INTERNAL_H_
#include <linux/build_bug.h>
#include <linux/stdarg.h>
#include <system_global.h>
#include <math_support.h>
#include <type_support.h>
#include <platform_support.h>
#include "input_formatter.h"
#include "input_system.h"
#include "ia_css_types.h"
#include "ia_css_acc_types.h"
#include "ia_css_buffer.h"
#include "ia_css_binary.h"
#include "sh_css_firmware.h"
#include "sh_css_legacy.h"
#include "sh_css_defs.h"
#include "sh_css_uds.h"
#include "dma.h"
#include "ia_css_circbuf_comm.h"
#include "ia_css_frame_comm.h"
#include "ia_css_3a.h"
#include "ia_css_dvs.h"
#include "ia_css_metadata.h"
#include "runtime/bufq/interface/ia_css_bufq.h"
#include "ia_css_timer.h"
#define IA_CSS_NUM_CB_SEM_READ_RESOURCE …
#define IA_CSS_NUM_CB_SEM_WRITE_RESOURCE …
#define IA_CSS_NUM_CBS …
#define IA_CSS_CB_MAX_ELEMS …
#define IA_CSS_COPYSINK_SEM_INDEX …
#define IA_CSS_TAGGER_SEM_INDEX …
#define IA_CSS_POST_OUT_EVENT_FORCE …
#define SH_CSS_MAX_BINARY_NAME …
#define SP_DEBUG_NONE …
#define SP_DEBUG_DUMP …
#define SP_DEBUG_COPY …
#define SP_DEBUG_TRACE …
#define SP_DEBUG_MINIMAL …
#define SP_DEBUG …
#define SP_DEBUG_MINIMAL_OVERWRITE …
#define SH_CSS_TNR_BIT_DEPTH …
#define SH_CSS_REF_BIT_DEPTH …
#define NUM_CONTINUOUS_FRAMES …
#define NUM_MIPI_FRAMES_PER_STREAM …
#define NUM_ONLINE_INIT_CONTINUOUS_FRAMES …
#define NR_OF_PIPELINES …
#define SH_CSS_MAX_IF_CONFIGS …
#define SH_CSS_IF_CONFIG_NOT_NEEDED …
#define SH_CSS_MAX_SP_THREADS …
#define CALC_ALIGNMENT_MEMBER(x, y) …
#define SIZE_OF_HRT_VADDRESS …
#define NUM_OF_SPS …
#define NUM_OF_BLS …
enum sh_css_order_binaries { … };
enum sh_css_pipe_config_override { … };
enum host2sp_commands { … };
enum sh_css_sp_event_type { … };
struct sh_css_ddr_address_map { … };
#define SIZE_OF_SH_CSS_DDR_ADDRESS_MAP_STRUCT …
static_assert(…);
struct sh_css_ddr_address_map_size { … };
struct sh_css_ddr_address_map_compound { … };
struct ia_css_isp_parameter_set_info { … };
struct sh_css_binary_args { … };
#if SP_DEBUG == SP_DEBUG_DUMP
#define SH_CSS_NUM_SP_DEBUG …
struct sh_css_sp_debug_state {
unsigned int error;
unsigned int debug[SH_CSS_NUM_SP_DEBUG];
};
#elif SP_DEBUG == SP_DEBUG_COPY
#define SH_CSS_SP_DBG_TRACE_DEPTH …
struct sh_css_sp_debug_trace {
u16 frame;
u16 line;
u16 pixel_distance;
u16 mipi_used_dword;
u16 sp_index;
};
struct sh_css_sp_debug_state {
u16 if_start_line;
u16 if_start_column;
u16 if_cropped_height;
u16 if_cropped_width;
unsigned int index;
struct sh_css_sp_debug_trace
trace[SH_CSS_SP_DBG_TRACE_DEPTH];
};
#elif SP_DEBUG == SP_DEBUG_TRACE
#define SH_CSS_SP_DBG_NR_OF_TRACES …
#define SH_CSS_SP_DBG_TRACE_DEPTH …
#define SH_CSS_SP_DBG_TRACE_FILE_ID_BIT_POS …
struct sh_css_sp_debug_trace {
u16 time_stamp;
u16 location;
u32 data;
};
struct sh_css_sp_debug_state {
struct sh_css_sp_debug_trace
trace[SH_CSS_SP_DBG_NR_OF_TRACES][SH_CSS_SP_DBG_TRACE_DEPTH];
u16 index_last[SH_CSS_SP_DBG_NR_OF_TRACES];
u8 index[SH_CSS_SP_DBG_NR_OF_TRACES];
};
#elif SP_DEBUG == SP_DEBUG_MINIMAL
#define SH_CSS_NUM_SP_DEBUG …
struct sh_css_sp_debug_state {
unsigned int error;
unsigned int debug[SH_CSS_NUM_SP_DEBUG];
};
#endif
struct sh_css_sp_debug_command { … };
struct sh_css_sp_input_formatter_set { … };
#define IA_CSS_MIPI_SIZE_CHECK_MAX_NOF_ENTRIES_PER_PORT …
struct sh_css_sp_config { … };
enum sh_css_stage_type { … };
#define SH_CSS_NUM_STAGE_TYPES …
#define SH_CSS_PIPE_CONFIG_SAMPLE_PARAMS …
#define SH_CSS_PIPE_CONFIG_SAMPLE_PARAMS_MASK …
struct sh_css_sp_pipeline_terminal { … };
struct sh_css_sp_pipeline_io { … };
struct sh_css_sp_pipeline_io_status { … };
enum sh_css_port_dir { … };
enum sh_css_port_type { … };
#define SH_CSS_PORT_FLD_WIDTH_IN_BITS …
#define SH_CSS_PORT_TYPE_BIT_FLD(pt) …
#define SH_CSS_PORT_FLD(pd) …
#define SH_CSS_PIPE_PORT_CONFIG_ON(p, pd, pt) …
#define SH_CSS_PIPE_PORT_CONFIG_OFF(p, pd, pt) …
#define SH_CSS_PIPE_PORT_CONFIG_SET(p, pd, pt, val) …
#define SH_CSS_PIPE_PORT_CONFIG_GET(p, pd, pt) …
#define SH_CSS_PIPE_PORT_CONFIG_IS_CONTINUOUS(p) …
#define IA_CSS_ACQUIRE_ISP_POS …
#define SH_CSS_METADATA_ENABLED …
#define SH_CSS_METADATA_PROCESSED …
#define SH_CSS_METADATA_OFFLINE_MODE …
#define SH_CSS_METADATA_WAIT_INPUT …
void
ia_css_metadata_free_multiple(unsigned int num_bufs,
struct ia_css_metadata **bufs);
#define QOS_INVALID …
struct sh_css_sp_pipeline { … };
#define SH_CSS_NUM_DYNAMIC_FRAME_IDS …
struct ia_css_frames_sp { … };
struct sh_css_isp_stage { … };
struct sh_css_sp_stage { … };
struct sh_css_sp_group { … };
struct sh_css_sp_per_frame_data { … };
#define SH_CSS_NUM_SDW_IRQS …
struct sh_css_sp_output { … };
#define IA_CSS_NUM_ELEMS_HOST2SP_BUFFER_QUEUE …
#define IA_CSS_NUM_ELEMS_HOST2SP_PARAM_QUEUE …
#define IA_CSS_NUM_ELEMS_HOST2SP_TAG_CMD_QUEUE …
#define IA_CSS_NUM_ELEMS_SP2HOST_ISYS_EVENT_QUEUE …
#define IA_CSS_NUM_ELEMS_HOST2SP_ISYS_EVENT_QUEUE …
#define IA_CSS_NUM_ELEMS_HOST2SP_PSYS_EVENT_QUEUE …
#define IA_CSS_NUM_ELEMS_SP2HOST_BUFFER_QUEUE …
#define IA_CSS_NUM_ELEMS_SP2HOST_PSYS_EVENT_QUEUE …
struct sh_css_hmm_buffer { … };
#define SIZE_OF_FRAME_STRUCT …
#define SIZE_OF_PAYLOAD_UNION …
#define SIZE_OF_SH_CSS_HMM_BUFFER_STRUCT …
static_assert(…);
enum sh_css_queue_type { … };
struct sh_css_event_irq_mask { … };
#define SIZE_OF_SH_CSS_EVENT_IRQ_MASK_STRUCT …
static_assert(…);
struct host_sp_communication { … };
#define SIZE_OF_HOST_SP_COMMUNICATION_STRUCT …
static_assert(…);
struct host_sp_queues { … };
#define SIZE_OF_QUEUES_ELEMS …
#define IA_CSS_NUM_CIRCBUF_DESCS …
#define SIZE_OF_QUEUES_DESC …
#define SIZE_OF_HOST_SP_QUEUES_STRUCT …
static_assert(…);
extern int __printf(1, 0) (*sh_css_printf)(const char *fmt, va_list args);
static inline void __printf(1, 2) sh_css_print(const char *fmt, ...)
{ … }
static inline void __printf(1, 0) sh_css_vprint(const char *fmt, va_list args)
{ … }
ia_css_ptr sh_css_params_ddr_address_map(void);
int
sh_css_params_init(void);
void
sh_css_params_uninit(void);
void
sh_css_binary_args_reset(struct sh_css_binary_args *args);
bool
sh_css_frame_equal_types(const struct ia_css_frame *frame_a,
const struct ia_css_frame *frame_b);
bool
sh_css_frame_info_equal_resolution(const struct ia_css_frame_info *info_a,
const struct ia_css_frame_info *info_b);
void
sh_css_capture_enable_bayer_downscaling(bool enable);
void
sh_css_binary_print(const struct ia_css_binary *binary);
void
sh_css_frame_info_set_width(struct ia_css_frame_info *info,
unsigned int width,
unsigned int aligned);
unsigned int
sh_css_get_mipi_sizes_for_check(const unsigned int port,
const unsigned int idx);
ia_css_ptr
sh_css_store_sp_group_to_ddr(void);
ia_css_ptr
sh_css_store_sp_stage_to_ddr(unsigned int pipe, unsigned int stage);
ia_css_ptr
sh_css_store_isp_stage_to_ddr(unsigned int pipe, unsigned int stage);
void
sh_css_update_uds_and_crop_info(
const struct ia_css_binary_info *info,
const struct ia_css_frame_info *in_frame_info,
const struct ia_css_frame_info *out_frame_info,
const struct ia_css_resolution *dvs_env,
const struct ia_css_dz_config *zoom,
const struct ia_css_vector *motion_vector,
struct sh_css_uds_info *uds,
struct sh_css_crop_pos *sp_out_crop_pos,
bool enable_zoom
);
void
sh_css_invalidate_shading_tables(struct ia_css_stream *stream);
struct ia_css_pipeline *
ia_css_pipe_get_pipeline(const struct ia_css_pipe *pipe);
unsigned int
ia_css_pipe_get_pipe_num(const struct ia_css_pipe *pipe);
unsigned int
ia_css_pipe_get_isp_pipe_version(const struct ia_css_pipe *pipe);
bool
sh_css_continuous_is_enabled(uint8_t pipe_num);
struct ia_css_pipe *
find_pipe_by_num(uint32_t pipe_num);
void
ia_css_get_crop_offsets(
struct ia_css_pipe *pipe,
struct ia_css_frame_info *in_frame);
#endif