2 * Support for Intel Camera Imaging ISP subsystem.
3 * Copyright (c) 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 #ifndef __IA_CSS_CONTROL_H
16 #define __IA_CSS_CONTROL_H
19 * This file contains functionality for starting and controlling CSS
22 #include <type_support.h>
23 #include <ia_css_env.h>
24 #include <ia_css_firmware.h>
25 #include <ia_css_irq.h>
27 /** @brief Initialize the CSS API.
28 * @param[in] env Environment, provides functions to access the
29 * environment in which the CSS code runs. This is
30 * used for host side memory access and message
31 * printing. May not be NULL.
32 * @param[in] fw Firmware package containing the firmware for all
33 * predefined ISP binaries.
34 * if fw is NULL the firmware must be loaded before
35 * through a call of ia_css_load_firmware
36 * @param[in] l1_base Base index (isp2400)
37 * of the L1 page table. This is a physical
39 * @param[in] irq_type The type of interrupt to be used (edge or level)
40 * @return Returns IA_CSS_ERR_INTERNAL_ERROR in case of any
41 * errors and IA_CSS_SUCCESS otherwise.
43 * This function initializes the API which includes allocating and initializing
44 * internal data structures. This also interprets the firmware package. All
45 * contents of this firmware package are copied into local data structures, so
46 * the fw pointer could be freed after this function completes.
48 enum ia_css_err ia_css_init(
49 const struct ia_css_env *env,
50 const struct ia_css_fw *fw,
52 enum ia_css_irq_type irq_type);
54 /** @brief Un-initialize the CSS API.
57 * This function deallocates all memory that has been allocated by the CSS API
58 * Exception: if you explicitly loaded firmware through ia_css_load_firmware
59 * you need to call ia_css_unload_firmware to deallocate the memory reserved
61 * After this function is called, no other CSS functions should be called
62 * with the exception of ia_css_init which will re-initialize the CSS code,
63 * ia_css_unload_firmware to unload the firmware or ia_css_load_firmware
64 * to load new firmware
69 /** @brief Suspend CSS API for power down
70 * @return success or faulure code
72 * suspend shuts down the system by:
73 * unloading all the streams
77 * Currently stream memory is deallocated because of rmmgr issues.
78 * Need to come up with a bypass that will leave the streams intact.
83 /** @brief Resume CSS API from power down
84 * @return success or failure code
86 * After a power cycle, this function will bring the CSS API back into
87 * a state where it can be started.
88 * This will re-initialize the hardware and all the streams.
89 * Call this function only after ia_css_suspend() has been called.
94 /** @brief Enable use of a separate queue for ISYS events.
96 * @param[in] enable: enable or disable use of separate ISYS event queues.
97 * @return error if called when SP is running.
99 * @deprecated{This is a temporary function that allows drivers to migrate to
100 * the use of the separate ISYS event queue. Once all drivers supports this, it
101 * will be made the default and this function will be removed.
102 * This function should only be called when the SP is not running, calling it
103 * when the SP is running will result in an error value being returned. }
106 ia_css_enable_isys_event_queue(bool enable);
108 /** @brief Test whether the ISP has started.
110 * @return Boolean flag true if the ISP has started or false otherwise.
112 * Temporary function to poll whether the ISP has been started. Once it has,
113 * the sensor can also be started. */
115 ia_css_isp_has_started(void);
117 /** @brief Test whether the SP has initialized.
119 * @return Boolean flag true if the SP has initialized or false otherwise.
121 * Temporary function to poll whether the SP has been initialized. Once it has,
122 * we can enqueue buffers. */
124 ia_css_sp_has_initialized(void);
126 /** @brief Test whether the SP has terminated.
128 * @return Boolean flag true if the SP has terminated or false otherwise.
130 * Temporary function to poll whether the SP has been terminated. Once it has,
131 * we can switch mode. */
133 ia_css_sp_has_terminated(void);
135 /** @brief start SP hardware
137 * @return IA_CSS_SUCCESS or error code upon error.
139 * It will boot the SP hardware and start multi-threading infrastructure.
140 * All threads will be started and blocked by semaphore. This function should
141 * be called before any ia_css_stream_start().
144 ia_css_start_sp(void);
147 /** @brief stop SP hardware
149 * @return IA_CSS_SUCCESS or error code upon error.
151 * This function will terminate all threads and shut down SP. It should be
152 * called after all ia_css_stream_stop().
155 ia_css_stop_sp(void);
157 #endif /* __IA_CSS_CONTROL_H */