1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Support for Intel Camera Imaging ISP subsystem. 4 * Copyright (c) 2015, Intel Corporation. 5 * 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. 9 * 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 13 * more details. 14 */ 15 16 #ifndef __ISP_PUBLIC_H_INCLUDED__ 17 #define __ISP_PUBLIC_H_INCLUDED__ 18 19 #include <type_support.h> 20 #include "system_local.h" 21 22 /*! Enable or disable the program complete irq signal of ISP[ID] 23 24 \param ID[in] SP identifier 25 \param cnd[in] predicate 26 27 \return none, if(cnd) enable(ISP[ID].irq) else disable(ISP[ID].irq) 28 */ 29 void cnd_isp_irq_enable( 30 const isp_ID_t ID, 31 const bool cnd); 32 33 /*! Read the state of cell ISP[ID] 34 35 \param ID[in] ISP identifier 36 \param state[out] isp state structure 37 \param stall[out] isp stall conditions 38 39 \return none, state = ISP[ID].state, stall = ISP[ID].stall 40 */ 41 void isp_get_state( 42 const isp_ID_t ID, 43 isp_state_t *state, 44 isp_stall_t *stall); 45 46 /*! Write to the status and control register of ISP[ID] 47 48 \param ID[in] ISP identifier 49 \param reg[in] register index 50 \param value[in] The data to be written 51 52 \return none, ISP[ID].sc[reg] = value 53 */ 54 STORAGE_CLASS_ISP_H void isp_ctrl_store( 55 const isp_ID_t ID, 56 const unsigned int reg, 57 const hrt_data value); 58 59 /*! Read from the status and control register of ISP[ID] 60 61 \param ID[in] ISP identifier 62 \param reg[in] register index 63 \param value[in] The data to be written 64 65 \return ISP[ID].sc[reg] 66 */ 67 STORAGE_CLASS_ISP_H hrt_data isp_ctrl_load( 68 const isp_ID_t ID, 69 const unsigned int reg); 70 71 /*! Get the status of a bitfield in the control register of ISP[ID] 72 73 \param ID[in] ISP identifier 74 \param reg[in] register index 75 \param bit[in] The bit index to be checked 76 77 \return (ISP[ID].sc[reg] & (1<<bit)) != 0 78 */ 79 STORAGE_CLASS_ISP_H bool isp_ctrl_getbit( 80 const isp_ID_t ID, 81 const unsigned int reg, 82 const unsigned int bit); 83 84 /*! Set a bitfield in the control register of ISP[ID] 85 86 \param ID[in] ISP identifier 87 \param reg[in] register index 88 \param bit[in] The bit index to be set 89 90 \return none, ISP[ID].sc[reg] |= (1<<bit) 91 */ 92 STORAGE_CLASS_ISP_H void isp_ctrl_setbit( 93 const isp_ID_t ID, 94 const unsigned int reg, 95 const unsigned int bit); 96 97 /*! Clear a bitfield in the control register of ISP[ID] 98 99 \param ID[in] ISP identifier 100 \param reg[in] register index 101 \param bit[in] The bit index to be set 102 103 \return none, ISP[ID].sc[reg] &= ~(1<<bit) 104 */ 105 STORAGE_CLASS_ISP_H void isp_ctrl_clearbit( 106 const isp_ID_t ID, 107 const unsigned int reg, 108 const unsigned int bit); 109 110 /*! Write to the DMEM of ISP[ID] 111 112 \param ID[in] ISP identifier 113 \param addr[in] the address in DMEM 114 \param data[in] The data to be written 115 \param size[in] The size(in bytes) of the data to be written 116 117 \return none, ISP[ID].dmem[addr...addr+size-1] = data 118 */ 119 STORAGE_CLASS_ISP_H void isp_dmem_store( 120 const isp_ID_t ID, 121 unsigned int addr, 122 const void *data, 123 const size_t size); 124 125 /*! Read from the DMEM of ISP[ID] 126 127 \param ID[in] ISP identifier 128 \param addr[in] the address in DMEM 129 \param data[in] The data to be read 130 \param size[in] The size(in bytes) of the data to be read 131 132 \return none, data = ISP[ID].dmem[addr...addr+size-1] 133 */ 134 STORAGE_CLASS_ISP_H void isp_dmem_load( 135 const isp_ID_t ID, 136 const unsigned int addr, 137 void *data, 138 const size_t size); 139 140 /*! Write a 32-bit datum to the DMEM of ISP[ID] 141 142 \param ID[in] ISP identifier 143 \param addr[in] the address in DMEM 144 \param data[in] The data to be written 145 \param size[in] The size(in bytes) of the data to be written 146 147 \return none, ISP[ID].dmem[addr] = data 148 */ 149 STORAGE_CLASS_ISP_H void isp_dmem_store_uint32( 150 const isp_ID_t ID, 151 unsigned int addr, 152 const uint32_t data); 153 154 /*! Load a 32-bit datum from the DMEM of ISP[ID] 155 156 \param ID[in] ISP identifier 157 \param addr[in] the address in DMEM 158 \param data[in] The data to be read 159 \param size[in] The size(in bytes) of the data to be read 160 161 \return none, data = ISP[ID].dmem[addr] 162 */ 163 STORAGE_CLASS_ISP_H uint32_t isp_dmem_load_uint32( 164 const isp_ID_t ID, 165 const unsigned int addr); 166 167 /*! Concatenate the LSW and MSW into a double precision word 168 169 \param x0[in] Integer containing the LSW 170 \param x1[in] Integer containing the MSW 171 172 \return x0 | (x1 << bits_per_vector_element) 173 */ 174 STORAGE_CLASS_ISP_H uint32_t isp_2w_cat_1w( 175 const u16 x0, 176 const uint16_t x1); 177 178 unsigned int isp_is_ready(isp_ID_t ID); 179 180 unsigned int isp_is_sleeping(isp_ID_t ID); 181 182 void isp_start(isp_ID_t ID); 183 184 void isp_wake(isp_ID_t ID); 185 186 #endif /* __ISP_PUBLIC_H_INCLUDED__ */ 187