19d4fa1a1SMauro Carvalho Chehab /* 29d4fa1a1SMauro Carvalho Chehab * Support for Intel Camera Imaging ISP subsystem. 39d4fa1a1SMauro Carvalho Chehab * Copyright (c) 2015, Intel Corporation. 49d4fa1a1SMauro Carvalho Chehab * 59d4fa1a1SMauro Carvalho Chehab * This program is free software; you can redistribute it and/or modify it 69d4fa1a1SMauro Carvalho Chehab * under the terms and conditions of the GNU General Public License, 79d4fa1a1SMauro Carvalho Chehab * version 2, as published by the Free Software Foundation. 89d4fa1a1SMauro Carvalho Chehab * 99d4fa1a1SMauro Carvalho Chehab * This program is distributed in the hope it will be useful, but WITHOUT 109d4fa1a1SMauro Carvalho Chehab * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 119d4fa1a1SMauro Carvalho Chehab * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 129d4fa1a1SMauro Carvalho Chehab * more details. 139d4fa1a1SMauro Carvalho Chehab */ 149d4fa1a1SMauro Carvalho Chehab 159d4fa1a1SMauro Carvalho Chehab #ifndef __ISP_PUBLIC_H_INCLUDED__ 169d4fa1a1SMauro Carvalho Chehab #define __ISP_PUBLIC_H_INCLUDED__ 179d4fa1a1SMauro Carvalho Chehab 189d4fa1a1SMauro Carvalho Chehab #include <type_support.h> 19f90e73ceSMauro Carvalho Chehab #include "system_local.h" 209d4fa1a1SMauro Carvalho Chehab 219d4fa1a1SMauro Carvalho Chehab /*! Enable or disable the program complete irq signal of ISP[ID] 229d4fa1a1SMauro Carvalho Chehab 239d4fa1a1SMauro Carvalho Chehab \param ID[in] SP identifier 249d4fa1a1SMauro Carvalho Chehab \param cnd[in] predicate 259d4fa1a1SMauro Carvalho Chehab 269d4fa1a1SMauro Carvalho Chehab \return none, if(cnd) enable(ISP[ID].irq) else disable(ISP[ID].irq) 279d4fa1a1SMauro Carvalho Chehab */ 289d4fa1a1SMauro Carvalho Chehab void cnd_isp_irq_enable( 299d4fa1a1SMauro Carvalho Chehab const isp_ID_t ID, 309d4fa1a1SMauro Carvalho Chehab const bool cnd); 319d4fa1a1SMauro Carvalho Chehab 329d4fa1a1SMauro Carvalho Chehab /*! Read the state of cell ISP[ID] 339d4fa1a1SMauro Carvalho Chehab 349d4fa1a1SMauro Carvalho Chehab \param ID[in] ISP identifier 359d4fa1a1SMauro Carvalho Chehab \param state[out] isp state structure 369d4fa1a1SMauro Carvalho Chehab \param stall[out] isp stall conditions 379d4fa1a1SMauro Carvalho Chehab 389d4fa1a1SMauro Carvalho Chehab \return none, state = ISP[ID].state, stall = ISP[ID].stall 399d4fa1a1SMauro Carvalho Chehab */ 409d4fa1a1SMauro Carvalho Chehab void isp_get_state( 419d4fa1a1SMauro Carvalho Chehab const isp_ID_t ID, 429d4fa1a1SMauro Carvalho Chehab isp_state_t *state, 439d4fa1a1SMauro Carvalho Chehab isp_stall_t *stall); 449d4fa1a1SMauro Carvalho Chehab 459d4fa1a1SMauro Carvalho Chehab /*! Write to the status and control register of ISP[ID] 469d4fa1a1SMauro Carvalho Chehab 479d4fa1a1SMauro Carvalho Chehab \param ID[in] ISP identifier 489d4fa1a1SMauro Carvalho Chehab \param reg[in] register index 499d4fa1a1SMauro Carvalho Chehab \param value[in] The data to be written 509d4fa1a1SMauro Carvalho Chehab 519d4fa1a1SMauro Carvalho Chehab \return none, ISP[ID].sc[reg] = value 529d4fa1a1SMauro Carvalho Chehab */ 539d4fa1a1SMauro Carvalho Chehab STORAGE_CLASS_ISP_H void isp_ctrl_store( 549d4fa1a1SMauro Carvalho Chehab const isp_ID_t ID, 559d4fa1a1SMauro Carvalho Chehab const unsigned int reg, 569d4fa1a1SMauro Carvalho Chehab const hrt_data value); 579d4fa1a1SMauro Carvalho Chehab 589d4fa1a1SMauro Carvalho Chehab /*! Read from the status and control register of ISP[ID] 599d4fa1a1SMauro Carvalho Chehab 609d4fa1a1SMauro Carvalho Chehab \param ID[in] ISP identifier 619d4fa1a1SMauro Carvalho Chehab \param reg[in] register index 629d4fa1a1SMauro Carvalho Chehab \param value[in] The data to be written 639d4fa1a1SMauro Carvalho Chehab 649d4fa1a1SMauro Carvalho Chehab \return ISP[ID].sc[reg] 659d4fa1a1SMauro Carvalho Chehab */ 669d4fa1a1SMauro Carvalho Chehab STORAGE_CLASS_ISP_H hrt_data isp_ctrl_load( 679d4fa1a1SMauro Carvalho Chehab const isp_ID_t ID, 689d4fa1a1SMauro Carvalho Chehab const unsigned int reg); 699d4fa1a1SMauro Carvalho Chehab 709d4fa1a1SMauro Carvalho Chehab /*! Get the status of a bitfield in the control register of ISP[ID] 719d4fa1a1SMauro Carvalho Chehab 729d4fa1a1SMauro Carvalho Chehab \param ID[in] ISP identifier 739d4fa1a1SMauro Carvalho Chehab \param reg[in] register index 749d4fa1a1SMauro Carvalho Chehab \param bit[in] The bit index to be checked 759d4fa1a1SMauro Carvalho Chehab 769d4fa1a1SMauro Carvalho Chehab \return (ISP[ID].sc[reg] & (1<<bit)) != 0 779d4fa1a1SMauro Carvalho Chehab */ 789d4fa1a1SMauro Carvalho Chehab STORAGE_CLASS_ISP_H bool isp_ctrl_getbit( 799d4fa1a1SMauro Carvalho Chehab const isp_ID_t ID, 809d4fa1a1SMauro Carvalho Chehab const unsigned int reg, 819d4fa1a1SMauro Carvalho Chehab const unsigned int bit); 829d4fa1a1SMauro Carvalho Chehab 839d4fa1a1SMauro Carvalho Chehab /*! Set a bitfield in the control register of ISP[ID] 849d4fa1a1SMauro Carvalho Chehab 859d4fa1a1SMauro Carvalho Chehab \param ID[in] ISP identifier 869d4fa1a1SMauro Carvalho Chehab \param reg[in] register index 879d4fa1a1SMauro Carvalho Chehab \param bit[in] The bit index to be set 889d4fa1a1SMauro Carvalho Chehab 899d4fa1a1SMauro Carvalho Chehab \return none, ISP[ID].sc[reg] |= (1<<bit) 909d4fa1a1SMauro Carvalho Chehab */ 919d4fa1a1SMauro Carvalho Chehab STORAGE_CLASS_ISP_H void isp_ctrl_setbit( 929d4fa1a1SMauro Carvalho Chehab const isp_ID_t ID, 939d4fa1a1SMauro Carvalho Chehab const unsigned int reg, 949d4fa1a1SMauro Carvalho Chehab const unsigned int bit); 959d4fa1a1SMauro Carvalho Chehab 969d4fa1a1SMauro Carvalho Chehab /*! Clear a bitfield in the control register of ISP[ID] 979d4fa1a1SMauro Carvalho Chehab 989d4fa1a1SMauro Carvalho Chehab \param ID[in] ISP identifier 999d4fa1a1SMauro Carvalho Chehab \param reg[in] register index 1009d4fa1a1SMauro Carvalho Chehab \param bit[in] The bit index to be set 1019d4fa1a1SMauro Carvalho Chehab 1029d4fa1a1SMauro Carvalho Chehab \return none, ISP[ID].sc[reg] &= ~(1<<bit) 1039d4fa1a1SMauro Carvalho Chehab */ 1049d4fa1a1SMauro Carvalho Chehab STORAGE_CLASS_ISP_H void isp_ctrl_clearbit( 1059d4fa1a1SMauro Carvalho Chehab const isp_ID_t ID, 1069d4fa1a1SMauro Carvalho Chehab const unsigned int reg, 1079d4fa1a1SMauro Carvalho Chehab const unsigned int bit); 1089d4fa1a1SMauro Carvalho Chehab 1099d4fa1a1SMauro Carvalho Chehab /*! Write to the DMEM of ISP[ID] 1109d4fa1a1SMauro Carvalho Chehab 1119d4fa1a1SMauro Carvalho Chehab \param ID[in] ISP identifier 1129d4fa1a1SMauro Carvalho Chehab \param addr[in] the address in DMEM 1139d4fa1a1SMauro Carvalho Chehab \param data[in] The data to be written 1149d4fa1a1SMauro Carvalho Chehab \param size[in] The size(in bytes) of the data to be written 1159d4fa1a1SMauro Carvalho Chehab 1169d4fa1a1SMauro Carvalho Chehab \return none, ISP[ID].dmem[addr...addr+size-1] = data 1179d4fa1a1SMauro Carvalho Chehab */ 1189d4fa1a1SMauro Carvalho Chehab STORAGE_CLASS_ISP_H void isp_dmem_store( 1199d4fa1a1SMauro Carvalho Chehab const isp_ID_t ID, 1209d4fa1a1SMauro Carvalho Chehab unsigned int addr, 1219d4fa1a1SMauro Carvalho Chehab const void *data, 1229d4fa1a1SMauro Carvalho Chehab const size_t size); 1239d4fa1a1SMauro Carvalho Chehab 1249d4fa1a1SMauro Carvalho Chehab /*! Read from the DMEM of ISP[ID] 1259d4fa1a1SMauro Carvalho Chehab 1269d4fa1a1SMauro Carvalho Chehab \param ID[in] ISP identifier 1279d4fa1a1SMauro Carvalho Chehab \param addr[in] the address in DMEM 1289d4fa1a1SMauro Carvalho Chehab \param data[in] The data to be read 1299d4fa1a1SMauro Carvalho Chehab \param size[in] The size(in bytes) of the data to be read 1309d4fa1a1SMauro Carvalho Chehab 1319d4fa1a1SMauro Carvalho Chehab \return none, data = ISP[ID].dmem[addr...addr+size-1] 1329d4fa1a1SMauro Carvalho Chehab */ 1339d4fa1a1SMauro Carvalho Chehab STORAGE_CLASS_ISP_H void isp_dmem_load( 1349d4fa1a1SMauro Carvalho Chehab const isp_ID_t ID, 1359d4fa1a1SMauro Carvalho Chehab const unsigned int addr, 1369d4fa1a1SMauro Carvalho Chehab void *data, 1379d4fa1a1SMauro Carvalho Chehab const size_t size); 1389d4fa1a1SMauro Carvalho Chehab 1399d4fa1a1SMauro Carvalho Chehab /*! Write a 32-bit datum to the DMEM of ISP[ID] 1409d4fa1a1SMauro Carvalho Chehab 1419d4fa1a1SMauro Carvalho Chehab \param ID[in] ISP identifier 1429d4fa1a1SMauro Carvalho Chehab \param addr[in] the address in DMEM 1439d4fa1a1SMauro Carvalho Chehab \param data[in] The data to be written 1449d4fa1a1SMauro Carvalho Chehab \param size[in] The size(in bytes) of the data to be written 1459d4fa1a1SMauro Carvalho Chehab 1469d4fa1a1SMauro Carvalho Chehab \return none, ISP[ID].dmem[addr] = data 1479d4fa1a1SMauro Carvalho Chehab */ 1489d4fa1a1SMauro Carvalho Chehab STORAGE_CLASS_ISP_H void isp_dmem_store_uint32( 1499d4fa1a1SMauro Carvalho Chehab const isp_ID_t ID, 1509d4fa1a1SMauro Carvalho Chehab unsigned int addr, 1519d4fa1a1SMauro Carvalho Chehab const uint32_t data); 1529d4fa1a1SMauro Carvalho Chehab 1539d4fa1a1SMauro Carvalho Chehab /*! Load a 32-bit datum from the DMEM of ISP[ID] 1549d4fa1a1SMauro Carvalho Chehab 1559d4fa1a1SMauro Carvalho Chehab \param ID[in] ISP identifier 1569d4fa1a1SMauro Carvalho Chehab \param addr[in] the address in DMEM 1579d4fa1a1SMauro Carvalho Chehab \param data[in] The data to be read 1589d4fa1a1SMauro Carvalho Chehab \param size[in] The size(in bytes) of the data to be read 1599d4fa1a1SMauro Carvalho Chehab 1609d4fa1a1SMauro Carvalho Chehab \return none, data = ISP[ID].dmem[addr] 1619d4fa1a1SMauro Carvalho Chehab */ 1629d4fa1a1SMauro Carvalho Chehab STORAGE_CLASS_ISP_H uint32_t isp_dmem_load_uint32( 1639d4fa1a1SMauro Carvalho Chehab const isp_ID_t ID, 1649d4fa1a1SMauro Carvalho Chehab const unsigned int addr); 1659d4fa1a1SMauro Carvalho Chehab 1669d4fa1a1SMauro Carvalho Chehab /*! Concatenate the LSW and MSW into a double precision word 1679d4fa1a1SMauro Carvalho Chehab 1689d4fa1a1SMauro Carvalho Chehab \param x0[in] Integer containing the LSW 1699d4fa1a1SMauro Carvalho Chehab \param x1[in] Integer containing the MSW 1709d4fa1a1SMauro Carvalho Chehab 1719d4fa1a1SMauro Carvalho Chehab \return x0 | (x1 << bits_per_vector_element) 1729d4fa1a1SMauro Carvalho Chehab */ 1739d4fa1a1SMauro Carvalho Chehab STORAGE_CLASS_ISP_H uint32_t isp_2w_cat_1w( 1749d4fa1a1SMauro Carvalho Chehab const u16 x0, 1759d4fa1a1SMauro Carvalho Chehab const uint16_t x1); 1769d4fa1a1SMauro Carvalho Chehab 1779d4fa1a1SMauro Carvalho Chehab unsigned int isp_is_ready(isp_ID_t ID); 1789d4fa1a1SMauro Carvalho Chehab 1799d4fa1a1SMauro Carvalho Chehab unsigned int isp_is_sleeping(isp_ID_t ID); 1809d4fa1a1SMauro Carvalho Chehab 1819d4fa1a1SMauro Carvalho Chehab void isp_start(isp_ID_t ID); 1829d4fa1a1SMauro Carvalho Chehab 1839d4fa1a1SMauro Carvalho Chehab void isp_wake(isp_ID_t ID); 1849d4fa1a1SMauro Carvalho Chehab 1859d4fa1a1SMauro Carvalho Chehab #endif /* __ISP_PUBLIC_H_INCLUDED__ */ 186