3 * Support for Intel Camera Imaging ISP subsystem.
4 * Copyright (c) 2015, Intel Corporation.
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 Support for Intel Camera Imaging ISP subsystem.
18 Copyright (c) 2010 - 2015, Intel Corporation.
20 This program is free software; you can redistribute it and/or modify it
21 under the terms and conditions of the GNU General Public License,
22 version 2, as published by the Free Software Foundation.
24 This program is distributed in the hope it will be useful, but WITHOUT
25 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
26 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
31 #ifndef __IA_CSS_ISYS_H__
32 #define __IA_CSS_ISYS_H__
34 #include <type_support.h>
35 #include <input_system.h>
36 #include <ia_css_input_port.h>
37 #include <ia_css_stream_format.h>
38 #include <ia_css_stream_public.h>
39 #include <system_global.h>
40 #include "ia_css_isys_comm.h"
42 #ifdef USE_INPUT_SYSTEM_VERSION_2401
44 * Virtual Input System. (Input System 2401)
46 typedef input_system_cfg_t ia_css_isys_descr_t
;
47 /* end of Virtual Input System */
50 #if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401)
51 input_system_error_t
ia_css_isys_init(void);
52 void ia_css_isys_uninit(void);
53 mipi_port_ID_t
ia_css_isys_port_to_mipi_port(
54 enum ia_css_csi2_port api_port
);
57 #if defined(USE_INPUT_SYSTEM_VERSION_2401)
60 * @brief Register one (virtual) stream. This is used to track when all
61 * virtual streams are configured inside the input system. The CSI RX is
62 * only started when all registered streams are configured.
64 * @param[in] port CSI port
65 * @param[in] isys_stream_id Stream handle generated with ia_css_isys_generate_stream_id()
66 * Must be lower than SH_CSS_MAX_ISYS_CHANNEL_NODES
67 * @return IA_CSS_SUCCESS if successful, IA_CSS_ERR_INTERNAL_ERROR if
68 * there is already a stream registered with the same handle
70 enum ia_css_err
ia_css_isys_csi_rx_register_stream(
71 enum ia_css_csi2_port port
,
72 uint32_t isys_stream_id
);
75 * @brief Unregister one (virtual) stream. This is used to track when all
76 * virtual streams are configured inside the input system. The CSI RX is
77 * only started when all registered streams are configured.
79 * @param[in] port CSI port
80 * @param[in] isys_stream_id Stream handle generated with ia_css_isys_generate_stream_id()
81 * Must be lower than SH_CSS_MAX_ISYS_CHANNEL_NODES
82 * @return IA_CSS_SUCCESS if successful, IA_CSS_ERR_INTERNAL_ERROR if
83 * there is no stream registered with that handle
85 enum ia_css_err
ia_css_isys_csi_rx_unregister_stream(
86 enum ia_css_csi2_port port
,
87 uint32_t isys_stream_id
);
89 enum ia_css_err
ia_css_isys_convert_compressed_format(
90 struct ia_css_csi2_compression
*comp
,
91 struct input_system_cfg_s
*cfg
);
92 unsigned int ia_css_csi2_calculate_input_system_alignment(
93 enum ia_css_stream_format fmt_type
);
96 #if !defined(USE_INPUT_SYSTEM_VERSION_2401)
98 void ia_css_isys_rx_configure(
99 const rx_cfg_t
*config
,
100 const enum ia_css_input_mode input_mode
);
102 void ia_css_isys_rx_disable(void);
104 void ia_css_isys_rx_enable_all_interrupts(mipi_port_ID_t port
);
106 unsigned int ia_css_isys_rx_get_interrupt_reg(mipi_port_ID_t port
);
107 void ia_css_isys_rx_get_irq_info(mipi_port_ID_t port
,
108 unsigned int *irq_infos
);
109 void ia_css_isys_rx_clear_irq_info(mipi_port_ID_t port
,
110 unsigned int irq_infos
);
111 unsigned int ia_css_isys_rx_translate_irq_infos(unsigned int bits
);
113 #endif /* #if !defined(USE_INPUT_SYSTEM_VERSION_2401) */
115 /* @brief Translate format and compression to format type.
117 * @param[in] input_format The input format.
118 * @param[in] compression The compression scheme.
119 * @param[out] fmt_type Pointer to the resulting format type.
120 * @return Error code.
122 * Translate an input format and mipi compression pair to the fmt_type.
123 * This is normally done by the sensor, but when using the input fifo, this
124 * format type must be sumitted correctly by the application.
126 enum ia_css_err
ia_css_isys_convert_stream_format_to_mipi_format(
127 enum ia_css_stream_format input_format
,
128 mipi_predictor_t compression
,
129 unsigned int *fmt_type
);
131 #ifdef USE_INPUT_SYSTEM_VERSION_2401
133 * Virtual Input System. (Input System 2401)
135 extern ia_css_isys_error_t
ia_css_isys_stream_create(
136 ia_css_isys_descr_t
*isys_stream_descr
,
137 ia_css_isys_stream_h isys_stream
,
138 uint32_t isys_stream_id
);
140 extern void ia_css_isys_stream_destroy(
141 ia_css_isys_stream_h isys_stream
);
143 extern ia_css_isys_error_t
ia_css_isys_stream_calculate_cfg(
144 ia_css_isys_stream_h isys_stream
,
145 ia_css_isys_descr_t
*isys_stream_descr
,
146 ia_css_isys_stream_cfg_t
*isys_stream_cfg
);
148 extern void ia_css_isys_csi_rx_lut_rmgr_init(void);
150 extern void ia_css_isys_csi_rx_lut_rmgr_uninit(void);
152 extern bool ia_css_isys_csi_rx_lut_rmgr_acquire(
153 csi_rx_backend_ID_t backend
,
154 csi_mipi_packet_type_t packet_type
,
155 csi_rx_backend_lut_entry_t
*entry
);
157 extern void ia_css_isys_csi_rx_lut_rmgr_release(
158 csi_rx_backend_ID_t backend
,
159 csi_mipi_packet_type_t packet_type
,
160 csi_rx_backend_lut_entry_t
*entry
);
163 extern void ia_css_isys_ibuf_rmgr_init(void);
165 extern void ia_css_isys_ibuf_rmgr_uninit(void);
167 extern bool ia_css_isys_ibuf_rmgr_acquire(
169 uint32_t *start_addr
);
171 extern void ia_css_isys_ibuf_rmgr_release(
172 uint32_t *start_addr
);
174 extern void ia_css_isys_dma_channel_rmgr_init(void);
176 extern void ia_css_isys_dma_channel_rmgr_uninit(void);
178 extern bool ia_css_isys_dma_channel_rmgr_acquire(
179 isys2401_dma_ID_t dma_id
,
180 isys2401_dma_channel
*channel
);
182 extern void ia_css_isys_dma_channel_rmgr_release(
183 isys2401_dma_ID_t dma_id
,
184 isys2401_dma_channel
*channel
);
186 extern void ia_css_isys_stream2mmio_sid_rmgr_init(void);
188 extern void ia_css_isys_stream2mmio_sid_rmgr_uninit(void);
190 extern bool ia_css_isys_stream2mmio_sid_rmgr_acquire(
191 stream2mmio_ID_t stream2mmio
,
192 stream2mmio_sid_ID_t
*sid
);
194 extern void ia_css_isys_stream2mmio_sid_rmgr_release(
195 stream2mmio_ID_t stream2mmio
,
196 stream2mmio_sid_ID_t
*sid
);
198 /* end of Virtual Input System */
201 #endif /* __IA_CSS_ISYS_H__ */