]>
Commit | Line | Data |
---|---|---|
a49d2536 AC |
1 | /* |
2 | * Support for Intel Camera Imaging ISP subsystem. | |
3 | * Copyright (c) 2015, Intel Corporation. | |
4 | * | |
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. | |
8 | * | |
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 | |
12 | * more details. | |
13 | */ | |
14 | ||
15 | #ifndef __IA_CSS_CONTROL_H | |
16 | #define __IA_CSS_CONTROL_H | |
17 | ||
d929fb4e | 18 | /* @file |
a49d2536 AC |
19 | * This file contains functionality for starting and controlling CSS |
20 | */ | |
21 | ||
22 | #include <type_support.h> | |
23 | #include <ia_css_env.h> | |
24 | #include <ia_css_firmware.h> | |
25 | #include <ia_css_irq.h> | |
26 | ||
d929fb4e | 27 | /* @brief Initialize the CSS API. |
a49d2536 AC |
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 | |
38 | * address or index. | |
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. | |
42 | * | |
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. | |
47 | */ | |
48 | enum ia_css_err ia_css_init( | |
49 | const struct ia_css_env *env, | |
50 | const struct ia_css_fw *fw, | |
51 | uint32_t l1_base, | |
52 | enum ia_css_irq_type irq_type); | |
53 | ||
d929fb4e | 54 | /* @brief Un-initialize the CSS API. |
a49d2536 AC |
55 | * @return None |
56 | * | |
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 | |
60 | * for the firmware. | |
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 | |
65 | */ | |
66 | void | |
67 | ia_css_uninit(void); | |
68 | ||
d929fb4e | 69 | /* @brief Suspend CSS API for power down |
a49d2536 AC |
70 | * @return success or faulure code |
71 | * | |
72 | * suspend shuts down the system by: | |
73 | * unloading all the streams | |
74 | * stopping SP | |
75 | * performing uninit | |
76 | * | |
77 | * Currently stream memory is deallocated because of rmmgr issues. | |
78 | * Need to come up with a bypass that will leave the streams intact. | |
79 | */ | |
80 | enum ia_css_err | |
81 | ia_css_suspend(void); | |
82 | ||
d929fb4e | 83 | /* @brief Resume CSS API from power down |
a49d2536 AC |
84 | * @return success or failure code |
85 | * | |
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. | |
90 | */ | |
91 | enum ia_css_err | |
92 | ia_css_resume(void); | |
93 | ||
d929fb4e | 94 | /* @brief Enable use of a separate queue for ISYS events. |
a49d2536 AC |
95 | * |
96 | * @param[in] enable: enable or disable use of separate ISYS event queues. | |
97 | * @return error if called when SP is running. | |
98 | * | |
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. } | |
104 | */ | |
105 | enum ia_css_err | |
106 | ia_css_enable_isys_event_queue(bool enable); | |
107 | ||
d929fb4e | 108 | /* @brief Test whether the ISP has started. |
a49d2536 AC |
109 | * |
110 | * @return Boolean flag true if the ISP has started or false otherwise. | |
111 | * | |
112 | * Temporary function to poll whether the ISP has been started. Once it has, | |
113 | * the sensor can also be started. */ | |
114 | bool | |
115 | ia_css_isp_has_started(void); | |
116 | ||
d929fb4e | 117 | /* @brief Test whether the SP has initialized. |
a49d2536 AC |
118 | * |
119 | * @return Boolean flag true if the SP has initialized or false otherwise. | |
120 | * | |
121 | * Temporary function to poll whether the SP has been initialized. Once it has, | |
122 | * we can enqueue buffers. */ | |
123 | bool | |
124 | ia_css_sp_has_initialized(void); | |
125 | ||
d929fb4e | 126 | /* @brief Test whether the SP has terminated. |
a49d2536 AC |
127 | * |
128 | * @return Boolean flag true if the SP has terminated or false otherwise. | |
129 | * | |
130 | * Temporary function to poll whether the SP has been terminated. Once it has, | |
131 | * we can switch mode. */ | |
132 | bool | |
133 | ia_css_sp_has_terminated(void); | |
134 | ||
d929fb4e | 135 | /* @brief start SP hardware |
a49d2536 AC |
136 | * |
137 | * @return IA_CSS_SUCCESS or error code upon error. | |
138 | * | |
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(). | |
142 | */ | |
143 | enum ia_css_err | |
144 | ia_css_start_sp(void); | |
145 | ||
146 | ||
d929fb4e | 147 | /* @brief stop SP hardware |
a49d2536 AC |
148 | * |
149 | * @return IA_CSS_SUCCESS or error code upon error. | |
150 | * | |
151 | * This function will terminate all threads and shut down SP. It should be | |
152 | * called after all ia_css_stream_stop(). | |
153 | */ | |
154 | enum ia_css_err | |
155 | ia_css_stop_sp(void); | |
156 | ||
157 | #endif /* __IA_CSS_CONTROL_H */ |