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 #include "timed_ctrl.h" 17 18 #ifndef __INLINE_TIMED_CTRL__ 19 #include "timed_ctrl_private.h" 20 #endif /* __INLINE_TIMED_CTRL__ */ 21 22 #include "assert_support.h" 23 24 void timed_ctrl_snd_commnd( 25 const timed_ctrl_ID_t ID, 26 hrt_data mask, 27 hrt_data condition, 28 hrt_data counter, 29 hrt_address addr, 30 hrt_data value) 31 { 32 OP___assert(ID == TIMED_CTRL0_ID); 33 OP___assert(TIMED_CTRL_BASE[ID] != (hrt_address)-1); 34 35 timed_ctrl_reg_store(ID, _HRT_TIMED_CONTROLLER_CMD_REG_IDX, mask); 36 timed_ctrl_reg_store(ID, _HRT_TIMED_CONTROLLER_CMD_REG_IDX, condition); 37 timed_ctrl_reg_store(ID, _HRT_TIMED_CONTROLLER_CMD_REG_IDX, counter); 38 timed_ctrl_reg_store(ID, _HRT_TIMED_CONTROLLER_CMD_REG_IDX, (hrt_data)addr); 39 timed_ctrl_reg_store(ID, _HRT_TIMED_CONTROLLER_CMD_REG_IDX, value); 40 } 41 42 /* pqiao TODO: make sure the following commands get 43 correct BASE address both for csim and android */ 44 45 void timed_ctrl_snd_sp_commnd( 46 const timed_ctrl_ID_t ID, 47 hrt_data mask, 48 hrt_data condition, 49 hrt_data counter, 50 const sp_ID_t SP_ID, 51 hrt_address offset, 52 hrt_data value) 53 { 54 OP___assert(SP_ID < N_SP_ID); 55 OP___assert(SP_DMEM_BASE[SP_ID] != (hrt_address)-1); 56 57 timed_ctrl_snd_commnd(ID, mask, condition, counter, 58 SP_DMEM_BASE[SP_ID] + offset, value); 59 } 60 61 void timed_ctrl_snd_gpio_commnd( 62 const timed_ctrl_ID_t ID, 63 hrt_data mask, 64 hrt_data condition, 65 hrt_data counter, 66 const gpio_ID_t GPIO_ID, 67 hrt_address offset, 68 hrt_data value) 69 { 70 OP___assert(GPIO_ID < N_GPIO_ID); 71 OP___assert(GPIO_BASE[GPIO_ID] != (hrt_address)-1); 72 73 timed_ctrl_snd_commnd(ID, mask, condition, counter, 74 GPIO_BASE[GPIO_ID] + offset, value); 75 } 76