1 // SPDX-License-Identifier: GPL-2.0 2 /* 3 * Support for Intel Camera Imaging ISP subsystem. 4 * Copyright (c) 2010-2016, 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 "debug.h" 17 18 #include "hmm.h" 19 20 #ifndef __INLINE_DEBUG__ 21 #include "debug_private.h" 22 #endif /* __INLINE_DEBUG__ */ 23 24 #define __INLINE_SP__ 25 #include "sp.h" 26 27 #include "assert_support.h" 28 29 /* The address of the remote copy */ 30 hrt_address debug_buffer_address = (hrt_address) - 1; 31 ia_css_ptr debug_buffer_ddr_address = (ia_css_ptr)-1; 32 /* The local copy */ 33 static debug_data_t debug_data; 34 debug_data_t *debug_data_ptr = &debug_data; 35 36 void debug_buffer_init(const hrt_address addr) 37 { 38 debug_buffer_address = addr; 39 40 debug_data.head = 0; 41 debug_data.tail = 0; 42 } 43 44 void debug_buffer_ddr_init(const ia_css_ptr addr) 45 { 46 debug_buf_mode_t mode = DEBUG_BUFFER_MODE_LINEAR; 47 u32 enable = 1; 48 u32 head = 0; 49 u32 tail = 0; 50 /* set the ddr queue */ 51 debug_buffer_ddr_address = addr; 52 hmm_store(addr + DEBUG_DATA_BUF_MODE_DDR_ADDR, 53 &mode, sizeof(debug_buf_mode_t)); 54 hmm_store(addr + DEBUG_DATA_HEAD_DDR_ADDR, 55 &head, sizeof(uint32_t)); 56 hmm_store(addr + DEBUG_DATA_TAIL_DDR_ADDR, 57 &tail, sizeof(uint32_t)); 58 hmm_store(addr + DEBUG_DATA_ENABLE_DDR_ADDR, 59 &enable, sizeof(uint32_t)); 60 61 /* set the local copy */ 62 debug_data.head = 0; 63 debug_data.tail = 0; 64 } 65 66 void debug_buffer_setmode(const debug_buf_mode_t mode) 67 { 68 assert(debug_buffer_address != ((hrt_address)-1)); 69 70 sp_dmem_store_uint32(SP0_ID, 71 debug_buffer_address + DEBUG_DATA_BUF_MODE_ADDR, mode); 72 } 73