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 __DEBUG_GLOBAL_H_INCLUDED__
8 #define __DEBUG_GLOBAL_H_INCLUDED__
9 
10 #include <type_support.h>
11 
12 #define DEBUG_BUF_SIZE	1024
13 #define DEBUG_BUF_MASK	(DEBUG_BUF_SIZE - 1)
14 
15 #define DEBUG_DATA_ENABLE_ADDR		0x00
16 #define DEBUG_DATA_BUF_MODE_ADDR	0x04
17 #define DEBUG_DATA_HEAD_ADDR		0x08
18 #define DEBUG_DATA_TAIL_ADDR		0x0C
19 #define DEBUG_DATA_BUF_ADDR			0x10
20 
21 #define DEBUG_DATA_ENABLE_DDR_ADDR		0x00
22 #define DEBUG_DATA_BUF_MODE_DDR_ADDR	HIVE_ISP_DDR_WORD_BYTES
23 #define DEBUG_DATA_HEAD_DDR_ADDR		(2 * HIVE_ISP_DDR_WORD_BYTES)
24 #define DEBUG_DATA_TAIL_DDR_ADDR		(3 * HIVE_ISP_DDR_WORD_BYTES)
25 #define DEBUG_DATA_BUF_DDR_ADDR			(4 * HIVE_ISP_DDR_WORD_BYTES)
26 
27 #define DEBUG_BUFFER_ISP_DMEM_ADDR       0x0
28 
29 /*
30  * The linear buffer mode will accept data until the first
31  * overflow and then stop accepting new data
32  * The circular buffer mode will accept if there is place
33  * and discard the data if the buffer is full
34  */
35 typedef enum {
36 	DEBUG_BUFFER_MODE_LINEAR = 0,
37 	DEBUG_BUFFER_MODE_CIRCULAR,
38 	N_DEBUG_BUFFER_MODE
39 } debug_buf_mode_t;
40 
41 struct debug_data_s {
42 	u32			enable;
43 	u32			bufmode;
44 	u32			head;
45 	u32			tail;
46 	u32			buf[DEBUG_BUF_SIZE];
47 };
48 
49 /* thread.sp.c doesn't have a notion of HIVE_ISP_DDR_WORD_BYTES
50    still one point of control is needed for debug purposes */
51 
52 #ifdef HIVE_ISP_DDR_WORD_BYTES
53 struct debug_data_ddr_s {
54 	u32			enable;
55 	s8				padding1[HIVE_ISP_DDR_WORD_BYTES - sizeof(uint32_t)];
56 	u32			bufmode;
57 	s8				padding2[HIVE_ISP_DDR_WORD_BYTES - sizeof(uint32_t)];
58 	u32			head;
59 	s8				padding3[HIVE_ISP_DDR_WORD_BYTES - sizeof(uint32_t)];
60 	u32			tail;
61 	s8				padding4[HIVE_ISP_DDR_WORD_BYTES - sizeof(uint32_t)];
62 	u32			buf[DEBUG_BUF_SIZE];
63 };
64 #endif
65 
66 #endif /* __DEBUG_GLOBAL_H_INCLUDED__ */
67