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