#define HIVE_MEM_histogram_args scalar_processor_dmem
#define HIVE_ADDR_histogram_args 0x2810
#define HIVE_SIZE_histogram_args 4
-#define HIVE_ADDR_capture_pp_dynamic_entry 0x32A1
+#define HIVE_ADDR_capture_pp_dynamic_entry 0x32F7
#define HIVE_MEM_isp_sdis_horiproj_num scalar_processor_dmem
#define HIVE_ADDR_isp_sdis_horiproj_num 0x1464
#define HIVE_SIZE_isp_sdis_horiproj_num 4
}
void
+sh_css_input_get_format(enum sh_css_input_format *format)
+{
+ *format = my_css.input_format;
+}
+
+
+void
sh_css_input_set_binning_factor(unsigned int binning_factor)
{
my_css.sensor_binning = binning_factor;
}
void
-sh_css_input_set_two_pixels_per_clock(bool two_ppc)
+sh_css_input_set_two_pixels_per_clock(bool two_pixels_per_clock)
{
- if (my_css.two_ppc != two_ppc) {
- my_css.two_ppc = two_ppc;
+ if (my_css.two_ppc != two_pixels_per_clock) {
+ my_css.two_ppc = two_pixels_per_clock;
my_css.reconfigure_css_rx = true;
}
}
void
+sh_css_input_get_two_pixels_per_clock(bool *two_pixels_per_clock)
+{
+ *two_pixels_per_clock = my_css.two_ppc;
+}
+
+
+void
sh_css_input_set_bayer_order(enum sh_css_bayer_order bayer_order)
{
my_css.bayer_order = bayer_order;
my_css.two_ppc);
}
+
+void
+sh_css_streaming_to_mipi_start_frame(unsigned int channel_id,
+ enum sh_css_input_format input_format,
+ bool two_pixels_per_clock)
+{
+ sh_css_hrt_streaming_to_mipi_start_frame(channel_id,
+ input_format,
+ two_pixels_per_clock);
+}
+
+
+void
+sh_css_streaming_to_mipi_send_line(unsigned int channel_id,
+ unsigned short *data,
+ unsigned int width)
+{
+ sh_css_hrt_streaming_to_mipi_send_line(channel_id,
+ data,
+ width);
+}
+
+
+void
+sh_css_streaming_to_mipi_end_frame(unsigned int channel_id)
+{
+ sh_css_hrt_streaming_to_mipi_end_frame(channel_id);
+}
+
+
static enum sh_css_err
allocate_frame_data(struct sh_css_frame *frame, unsigned int bytes)
{
void
sh_css_input_set_format(enum sh_css_input_format format);
+/*
+ * Return the last set format of the input data
+ */
+void
+sh_css_input_get_format(enum sh_css_input_format *format);
+
void
sh_css_input_set_binning_factor(unsigned int binning_factor);
void
sh_css_input_set_two_pixels_per_clock(bool two_pixels_per_clock);
+/*
+ * Return the last set "2 pixels per clock" setting
+ */
+void
+sh_css_input_get_two_pixels_per_clock(bool *two_pixels_per_clock);
+
/* Specify the bayer order of the input. The default is grbg. */
void
sh_css_input_set_bayer_order(enum sh_css_bayer_order bayer_order);
unsigned int width,
unsigned int height);
+/*
+ * For higher flexibility the sh_css_send_input_frame is replaced by
+ * three seperate functions:
+ * 1) sh_css_streaming_to_mipi_start_frame
+ * 2) sh_css_streaming_to_mipi_send_line
+ * 3) sh_css_streaming_to_mipi_end_frame
+ * In this way it is possible to stream multiple frames on different
+ * channel ID's on a line basis. It will be possible to simulate
+ * line-interleaved Stereo 3D muxed on 1 mipi port.
+ * These 3 functions are for testing purpose only and can be used in
+ * conjunction with sh_css_send_input_frame
+ */
+
+/*
+ * Starts the streaming to mipi frame by sending SoF for channel channel_id.
+ * It will use the input_format and two_pixels_per_clock as provided by
+ * the user.
+ * For the "correct" use-case, input_format and two_pixels_per_clock must match
+ * with the values as set by the user with the regular functions.
+ * To simulate an error, the user can provide "incorrect" values for
+ * input_format and/or two_pixels_per_clock.
+ */
+void
+sh_css_streaming_to_mipi_start_frame(unsigned int channel_id,
+ enum sh_css_input_format input_format,
+ bool two_pixels_per_clock);
+
+
+/*
+ * Sends 1 line of frame data, with length width, to the streaming to mipi FIFO.
+ * SoL and EoL will be appended.
+ * It will use the input_format and two_pixels_per_clock settings as provided
+ * with the sh_css_streaming_to_mipi_start_frame function call.
+ *
+ * This function blocks until the entire line has been written into the
+ * input FIFO.
+ */
+void
+sh_css_streaming_to_mipi_send_line(unsigned int channel_id,
+ unsigned short *data,
+ unsigned int width);
+
+
+/*
+ * Stops the streaming to mipi frame by sending EoF for channel channel_id.
+ */
+void
+sh_css_streaming_to_mipi_end_frame(unsigned int channel_id);
+
/* Temporary function to poll whether the ISP has been started. Once it has,
* the sensor can also be started. */
bool
sh_css_acc_set_argument(struct sh_css_acc_fw *firmware,
unsigned num, void *val, size_t size)
{
- if (!firmware->header.sp_args)
- return sh_css_err_invalid_arguments;
if (num >= firmware->header.sp.args_cnt)
return sh_css_err_invalid_arguments;
+
+ if (!firmware->header.sp_args)
+ return sh_css_err_invalid_arguments;
firmware->header.sp_args[num].type = sh_css_argument_type(firmware,
num);
firmware->header.sp_args[num].value = val;
return sh_css_success;
}
-/* Get type for argument <num> */
-enum sh_css_acc_arg_type
-sh_css_argument_type(struct sh_css_acc_fw *firmware, unsigned num)
-{
- return SH_CSS_ACC_SP_ARGS(firmware)[num];
-}
-
/* Set host private data for argument <num> */
enum sh_css_err
sh_css_argument_set_host(struct sh_css_acc_fw *firmware,
return firmware->header.sp_args[num].host;
}
+/* Get type for argument <num> */
+enum sh_css_acc_arg_type
+sh_css_argument_type(struct sh_css_acc_fw *firmware, unsigned num)
+{
+ return SH_CSS_ACC_SP_ARGS(firmware)[num];
+}
+
static void
copy_sp_arguments(struct sh_css_acc_fw *firmware, bool to_sp)
{
#define ISP_PRIMARY_DS_MAX_OUTPUT_HEIGHT 1920
#define ISP_PRIMARY_DS_MIN_OUTPUT_WIDTH SH_CSS_MIN_SENSOR_WIDTH
#define ISP_PRIMARY_DS_MIN_OUTPUT_HEIGHT SH_CSS_MIN_SENSOR_HEIGHT
-#define ISP_PRIMARY_DS_OUTPUT_FORMATS SH_CSS_CAPTURE_OUTPUT_FORMATS
+#define ISP_PRIMARY_DS_OUTPUT_FORMATS SH_CSS_CAPTURE_DS_OUTPUT_FORMATS
#define ISP_PRIMARY_DS_MAX_VF_LOG_DOWNSCALE 1
#define ISP_PRIMARY_DS_INPUT SH_CSS_BINARY_INPUT_VARIABLE
#define ISP_PRIMARY_DS_C_SUBSAMPLING SH_CSS_DEFAULT_C_SUBSAMPLING
#define ISP_PRIMARY_SMALL_BINARY isp_primary_small
#define ISP_PRIMARY_SMALL_MODE SH_CSS_BINARY_MODE_PRIMARY
#define ISP_PRIMARY_SMALL_LEFT_CROPPING SH_CSS_MAX_LEFT_CROPPING
-#define ISP_PRIMARY_SMALL_PIPELINING 2
+#define ISP_PRIMARY_SMALL_PIPELINING 3
#define ISP_PRIMARY_SMALL_ENABLE_FPNR 1
#define ISP_PRIMARY_SMALL_ENABLE_SC 1
#define ISP_PRIMARY_SMALL_ENABLE_S3A 1
#define ISP_PRIMARY_SMALL_MIN_OUTPUT_WIDTH SH_CSS_MIN_SENSOR_WIDTH
#define ISP_PRIMARY_SMALL_MIN_OUTPUT_HEIGHT SH_CSS_MIN_SENSOR_HEIGHT
#define ISP_PRIMARY_SMALL_OUTPUT_FORMATS SH_CSS_YUV422_OUTPUT_FORMATS
-#define ISP_PRIMARY_SMALL_MAX_VF_LOG_DOWNSCALE 1
+#define ISP_PRIMARY_SMALL_MAX_VF_LOG_DOWNSCALE 2
#define ISP_PRIMARY_SMALL_INPUT SH_CSS_BINARY_INPUT_VARIABLE
#define ISP_PRIMARY_SMALL_C_SUBSAMPLING SH_CSS_DEFAULT_C_SUBSAMPLING
#define ISP_PRIMARY_SMALL_FIXED_S3A_DECI_LOG 0
SH_CSS_FRAME_FORMAT_RGBA888 \
}
+#define SH_CSS_CAPTURE_DS_OUTPUT_FORMATS \
+ { \
+ SH_CSS_FRAME_FORMAT_NV12, \
+ SH_CSS_FRAME_FORMAT_NV16, \
+ SH_CSS_FRAME_FORMAT_NV21, \
+ SH_CSS_FRAME_FORMAT_NV61, \
+ SH_CSS_FRAME_FORMAT_YV12, \
+ SH_CSS_FRAME_FORMAT_YV16, \
+ SH_CSS_FRAME_FORMAT_YUV420, \
+ SH_CSS_FRAME_FORMAT_YUV420_16, \
+ SH_CSS_FRAME_FORMAT_YUV422, \
+ SH_CSS_FRAME_FORMAT_YUV422_16, \
+ SH_CSS_FRAME_FORMAT_UYVY, \
+ SH_CSS_FRAME_FORMAT_YUYV, \
+ SH_CSS_FRAME_FORMAT_YUV444, \
+ SH_CSS_FRAME_FORMAT_RGB565, \
+ SH_CSS_FRAME_FORMAT_PLANAR_RGB888 \
+ }
+
#define SH_CSS_YUV422_OUTPUT_FORMATS \
{ \
SH_CSS_FRAME_FORMAT_NV12, \
#include "sh_css_hw.h"
#include "sh_css_debug.h"
+#define HBLANK_CYCLES (187)
+#define MARKER_CYCLES (6)
+
/* The data type is used to send special cases:
* yuv420: odd lines (1, 3 etc) are twice as wide as even
* lines (0, 2, 4 etc).
static unsigned int curr_ch_id, curr_fmt_type;
+
+struct streamining_to_mipi_instance {
+ unsigned int ch_id;
+ enum sh_css_input_format input_format;
+ bool two_ppc;
+ bool streaming;
+ unsigned int hblank_cycles;
+ unsigned int marker_cycles;
+ unsigned int fmt_type;
+ enum sh_css_mipi_data_type type;
+};
+
+/*
+ * Maintain a basic streaming to Mipi administration with ch_id as index
+ * ch_id maps on the "Mipi virtual channel ID" and can have value 0..3
+ */
+#define NR_OF_S2M_CHANNELS (4)
+static struct streamining_to_mipi_instance s2m_inst_admin[NR_OF_S2M_CHANNELS];
+
void
sh_css_sp_ctrl_store(unsigned int reg, unsigned int value)
{
}
static inline void
-sh_css_streaming_to_mipi_start_frame(unsigned int ch_id,
+sh_css_hrt_s2m_start_frame(unsigned int ch_id,
unsigned int fmt_type)
{
sh_css_streaming_to_mipi_send_ch_id_and_fmt_type(ch_id, fmt_type);
}
static void
-sh_css_streaming_to_mipi_end_frame(unsigned int marker_cycles)
+sh_css_hrt_s2m_end_frame(unsigned int marker_cycles)
{
unsigned int i;
for (i = 0; i < marker_cycles; i++)
}
static void
-sh_css_streaming_to_mipi_send_line(unsigned short *data,
+sh_css_hrt_s2m_send_line(unsigned short *data,
unsigned int width,
unsigned int hblank_cycles,
unsigned int marker_cycles,
* documentation for details on the data formats.
*/
static void
-sh_css_streaming_to_mipi_send_frame(unsigned short *data,
+sh_css_hrt_s2m_send_frame(unsigned short *data,
unsigned int width,
unsigned int height,
unsigned int ch_id,
{
unsigned int i;
- sh_css_streaming_to_mipi_start_frame(ch_id, fmt_type);
+ sh_css_hrt_s2m_start_frame(ch_id, fmt_type);
for (i = 0; i < height; i++) {
if ((type == sh_css_mipi_data_type_yuv420) &&
(i & 1) == 1) {
- sh_css_streaming_to_mipi_send_line(data, 2 * width,
+ sh_css_hrt_s2m_send_line(data, 2 * width,
hblank_cycles,
marker_cycles,
two_ppc, type);
data += 2 * width;
} else {
- sh_css_streaming_to_mipi_send_line(data, width,
+ sh_css_hrt_s2m_send_line(data, width,
hblank_cycles,
marker_cycles,
two_ppc, type);
data += width;
}
}
- sh_css_streaming_to_mipi_end_frame(marker_cycles);
+ sh_css_hrt_s2m_end_frame(marker_cycles);
+}
+
+static enum sh_css_mipi_data_type
+sh_css_hrt_s2m_determine_type(enum sh_css_input_format input_format)
+{
+ enum sh_css_mipi_data_type type;
+
+ type = sh_css_mipi_data_type_regular;
+ if (input_format == SH_CSS_INPUT_FORMAT_YUV420_8_LEGACY) {
+ type =
+ sh_css_mipi_data_type_yuv420_legacy;
+ } else if (input_format == SH_CSS_INPUT_FORMAT_YUV420_8 ||
+ input_format == SH_CSS_INPUT_FORMAT_YUV420_10) {
+ type =
+ sh_css_mipi_data_type_yuv420;
+ } else if (input_format >= SH_CSS_INPUT_FORMAT_RGB_444 &&
+ input_format <= SH_CSS_INPUT_FORMAT_RGB_888) {
+ type =
+ sh_css_mipi_data_type_rgb;
+ }
+ return type;
+}
+
+static struct streamining_to_mipi_instance *
+sh_css_hrt_s2m_get_inst(unsigned int ch_id)
+{
+ return &s2m_inst_admin[ch_id];
}
void
bool two_ppc)
{
unsigned int fmt_type, hblank_cycles, marker_cycles;
- enum sh_css_mipi_data_type str_to_mipi_type;
+ enum sh_css_mipi_data_type type;
- hblank_cycles = 187;
- marker_cycles = 6;
+ hblank_cycles = HBLANK_CYCLES;
+ marker_cycles = MARKER_CYCLES;
sh_css_input_format_type(input_format,
SH_CSS_MIPI_COMPRESSION_NONE,
&fmt_type);
- str_to_mipi_type = sh_css_mipi_data_type_regular;
- if (input_format == SH_CSS_INPUT_FORMAT_YUV420_8_LEGACY) {
- str_to_mipi_type =
- sh_css_mipi_data_type_yuv420_legacy;
- } else if (input_format == SH_CSS_INPUT_FORMAT_YUV420_8 ||
- input_format == SH_CSS_INPUT_FORMAT_YUV420_10) {
- str_to_mipi_type =
- sh_css_mipi_data_type_yuv420;
- } else if (input_format >= SH_CSS_INPUT_FORMAT_RGB_444 &&
- input_format <= SH_CSS_INPUT_FORMAT_RGB_888) {
- str_to_mipi_type =
- sh_css_mipi_data_type_rgb;
- }
- sh_css_streaming_to_mipi_send_frame(data, width, height,
+
+ type = sh_css_hrt_s2m_determine_type(input_format);
+
+ sh_css_hrt_s2m_send_frame(data, width, height,
ch_id, fmt_type, hblank_cycles, marker_cycles,
- two_ppc, str_to_mipi_type);
+ two_ppc, type);
+}
+
+void
+sh_css_hrt_streaming_to_mipi_start_frame(unsigned int ch_id,
+ enum sh_css_input_format input_format,
+ bool two_ppc)
+{
+ struct streamining_to_mipi_instance *s2mi;
+ s2mi = sh_css_hrt_s2m_get_inst(ch_id);
+
+ s2mi->ch_id = ch_id;
+ sh_css_input_format_type(input_format, SH_CSS_MIPI_COMPRESSION_NONE,
+ &s2mi->fmt_type);
+ s2mi->two_ppc = two_ppc;
+ s2mi->type = sh_css_hrt_s2m_determine_type(input_format);
+ s2mi->hblank_cycles = HBLANK_CYCLES;
+ s2mi->marker_cycles = MARKER_CYCLES;
+ s2mi->streaming = true;
+
+ sh_css_hrt_s2m_start_frame(ch_id, s2mi->fmt_type);
}
+
+void
+sh_css_hrt_streaming_to_mipi_send_line(unsigned int ch_id,
+ unsigned short *data,
+ unsigned int width)
+{
+ struct streamining_to_mipi_instance *s2mi;
+ s2mi = sh_css_hrt_s2m_get_inst(ch_id);
+
+ /* Set global variables that indicate channel_id and format_type */
+ curr_ch_id = (s2mi->ch_id) & _HIVE_ISP_CH_ID_MASK;
+ curr_fmt_type = (s2mi->fmt_type) & _HIVE_ISP_FMT_TYPE_MASK;
+
+ /* Call existing HRT function */
+ sh_css_hrt_s2m_send_line(data, width,
+ s2mi->hblank_cycles,
+ s2mi->marker_cycles,
+ s2mi->two_ppc,
+ s2mi->type);
+
+}
+
+void
+sh_css_hrt_streaming_to_mipi_end_frame(unsigned int ch_id)
+{
+ struct streamining_to_mipi_instance *s2mi;
+ s2mi = sh_css_hrt_s2m_get_inst(ch_id);
+
+ /* Set global variables that indicate channel_id and format_type */
+ curr_ch_id = (s2mi->ch_id) & _HIVE_ISP_CH_ID_MASK;
+ curr_fmt_type = (s2mi->fmt_type) & _HIVE_ISP_FMT_TYPE_MASK;
+
+ /* Call existing HRT function */
+ sh_css_hrt_s2m_end_frame(s2mi->marker_cycles);
+
+ s2mi->streaming = false;
+}
+
enum sh_css_input_format input_format,
bool two_ppc);
+void
+sh_css_hrt_streaming_to_mipi_start_frame(unsigned int ch_id,
+ enum sh_css_input_format input_format,
+ bool two_ppc);
+
+void
+sh_css_hrt_streaming_to_mipi_send_line(unsigned int ch_id ,
+ unsigned short *data,
+ unsigned int width);
+
+void
+sh_css_hrt_streaming_to_mipi_end_frame(unsigned int ch_id);
+
+
#endif /* _SH_CSS_HRT_H_ */
s0_15 af_fir2_coef[7]; /* [factor] AF FIR coefficients of fir2 */
};
+/* Guard this declaration, because this struct is also defined by
+ * Sh3a_Types.h now
+ */
+#ifndef __SH_CSS_3A_OUTPUT__
+#define __SH_CSS_3A_OUTPUT__
+
/* Workaround: hivecc complains about "tag "sh_css_3a_output" already declared"
without this extra decl. */
struct sh_css_3a_output;
int af_hpf2;
};
+#endif /* End of guard */
+
/* Descriptor of sp firmware blob */
struct sh_css_sp_fw {
const void *text; /* Sp text section */