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 18 /* @file 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 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 38 * address or index. 39 * @param[in] irq_type The type of interrupt to be used (edge or level) 40 * @return Returns -EINVAL in case of any 41 * errors and 0 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 int ia_css_init(struct device *dev, 49 const struct ia_css_env *env, 50 const struct ia_css_fw *fw, 51 u32 l1_base, 52 enum ia_css_irq_type irq_type); 53 54 /* @brief Un-initialize the CSS API. 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 69 /* @brief Enable use of a separate queue for ISYS events. 70 * 71 * @param[in] enable: enable or disable use of separate ISYS event queues. 72 * @return error if called when SP is running. 73 * 74 * @deprecated{This is a temporary function that allows drivers to migrate to 75 * the use of the separate ISYS event queue. Once all drivers supports this, it 76 * will be made the default and this function will be removed. 77 * This function should only be called when the SP is not running, calling it 78 * when the SP is running will result in an error value being returned. } 79 */ 80 int 81 ia_css_enable_isys_event_queue(bool enable); 82 83 /* @brief Test whether the ISP has started. 84 * 85 * @return Boolean flag true if the ISP has started or false otherwise. 86 * 87 * Temporary function to poll whether the ISP has been started. Once it has, 88 * the sensor can also be started. */ 89 bool 90 ia_css_isp_has_started(void); 91 92 /* @brief Test whether the SP has initialized. 93 * 94 * @return Boolean flag true if the SP has initialized or false otherwise. 95 * 96 * Temporary function to poll whether the SP has been initialized. Once it has, 97 * we can enqueue buffers. */ 98 bool 99 ia_css_sp_has_initialized(void); 100 101 /* @brief Test whether the SP has terminated. 102 * 103 * @return Boolean flag true if the SP has terminated or false otherwise. 104 * 105 * Temporary function to poll whether the SP has been terminated. Once it has, 106 * we can switch mode. */ 107 bool 108 ia_css_sp_has_terminated(void); 109 110 /* @brief start SP hardware 111 * 112 * @return 0 or error code upon error. 113 * 114 * It will boot the SP hardware and start multi-threading infrastructure. 115 * All threads will be started and blocked by semaphore. This function should 116 * be called before any ia_css_stream_start(). 117 */ 118 int 119 ia_css_start_sp(void); 120 121 /* @brief stop SP hardware 122 * 123 * @return 0 or error code upon error. 124 * 125 * This function will terminate all threads and shut down SP. It should be 126 * called after all ia_css_stream_stop(). 127 */ 128 int 129 ia_css_stop_sp(void); 130 131 #endif /* __IA_CSS_CONTROL_H */ 132