2 * Support for Intel Camera Imaging ISP subsystem.
3 * Copyright (c) 2010 - 2015, Intel Corporation.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 #include "ia_css_bayer_io.host.h"
17 #include "math_support.h"
18 #ifndef IA_CSS_NO_DEBUG
19 #include "ia_css_debug.h"
21 #include "ia_css_isp_params.h"
22 #include "ia_css_frame.h"
25 ia_css_bayer_io_config(
26 const struct ia_css_binary *binary,
27 const struct sh_css_binary_args *args)
29 const struct ia_css_frame *in_frame = args->in_frame;
30 const struct ia_css_frame **out_frames = (const struct ia_css_frame **)
32 const struct ia_css_frame_info *in_frame_info = (in_frame) ? &in_frame->info :
33 &binary->in_frame_info;
35 const unsigned int ddr_bits_per_element = sizeof(short) * 8;
36 const unsigned int ddr_elems_per_word = ceil_div(HIVE_ISP_DDR_WORD_BITS,
37 ddr_bits_per_element);
38 unsigned int size_get = 0, size_put = 0;
39 unsigned int offset = 0;
41 if (binary->info->mem_offsets.offsets.param) {
42 size_get = binary->info->mem_offsets.offsets.param->dmem.get.size;
43 offset = binary->info->mem_offsets.offsets.param->dmem.get.offset;
47 struct ia_css_common_io_config *to = (struct ia_css_common_io_config *)
48 &binary->mem_params.params[IA_CSS_PARAM_CLASS_PARAM][IA_CSS_ISP_DMEM].address[offset];
49 struct dma_port_config config;
50 #ifndef IA_CSS_NO_DEBUG
51 ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE,
52 "ia_css_bayer_io_config() get part enter:\n");
55 ia_css_dma_configure_from_info(&config, in_frame_info);
56 // The base_address of the input frame will be set in the ISP
57 to->width = in_frame_info->res.width;
58 to->height = in_frame_info->res.height;
59 to->stride = config.stride;
60 to->ddr_elems_per_word = ddr_elems_per_word;
61 #ifndef IA_CSS_NO_DEBUG
62 ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE,
63 "ia_css_bayer_io_config() get part leave:\n");
67 if (binary->info->mem_offsets.offsets.param) {
68 size_put = binary->info->mem_offsets.offsets.param->dmem.put.size;
69 offset = binary->info->mem_offsets.offsets.param->dmem.put.offset;
73 struct ia_css_common_io_config *to = (struct ia_css_common_io_config *)
74 &binary->mem_params.params[IA_CSS_PARAM_CLASS_PARAM][IA_CSS_ISP_DMEM].address[offset];
75 struct dma_port_config config;
76 #ifndef IA_CSS_NO_DEBUG
77 ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE,
78 "ia_css_bayer_io_config() put part enter:\n");
81 ia_css_dma_configure_from_info(&config, &out_frames[0]->info);
82 to->base_address = out_frames[0]->data;
83 to->width = out_frames[0]->info.res.width;
84 to->height = out_frames[0]->info.res.height;
85 to->stride = config.stride;
86 to->ddr_elems_per_word = ddr_elems_per_word;
88 #ifndef IA_CSS_NO_DEBUG
89 ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE,
90 "ia_css_bayer_io_config() put part leave:\n");