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 #ifndef __DEBUG_PUBLIC_H_INCLUDED__
17 #define __DEBUG_PUBLIC_H_INCLUDED__
18 
19 #include <type_support.h>
20 #include <ia_css_types.h>
21 #include "system_local.h"
22 
23 /*! brief
24  *
25  * Simple queuing trace buffer for debug data
26  * instantiatable in SP DMEM
27  *
28  * The buffer has a remote and a local store
29  * which contain duplicate data (when in sync).
30  * The buffers are automatically synched when the
31  * user dequeues, or manualy using the synch function
32  *
33  * An alternative (storage efficient) implementation
34  * could manage the buffers to contain unique data
35  *
36  * The buffer empty status is computed from local
37  * state which does not reflect the presence of data
38  * in the remote buffer (unless the alternative
39  * implementation is followed)
40  */
41 
42 typedef struct debug_data_s		debug_data_t;
43 typedef struct debug_data_ddr_s	debug_data_ddr_t;
44 
45 extern debug_data_t				*debug_data_ptr;
46 extern hrt_address				debug_buffer_address;
47 extern ia_css_ptr				debug_buffer_ddr_address;
48 
49 /*! Check the empty state of the local debug data buffer
50 
51  \return isEmpty(buffer)
52  */
53 STORAGE_CLASS_DEBUG_H bool is_debug_buffer_empty(void);
54 
55 /*! Dequeue a token from the debug data buffer
56 
57  \return isEmpty(buffer)?0:buffer[head]
58  */
59 STORAGE_CLASS_DEBUG_H hrt_data debug_dequeue(void);
60 
61 /*! Synchronise the remote buffer to the local buffer
62 
63  \return none
64  */
65 STORAGE_CLASS_DEBUG_H void debug_synch_queue(void);
66 
67 /*! Synchronise the remote buffer to the local buffer
68 
69  \return none
70  */
71 STORAGE_CLASS_DEBUG_H void debug_synch_queue_isp(void);
72 
73 /*! Synchronise the remote buffer to the local buffer
74 
75  \return none
76  */
77 STORAGE_CLASS_DEBUG_H void debug_synch_queue_ddr(void);
78 
79 /*! Set the offset/address of the (remote) debug buffer
80 
81  \return none
82  */
83 void debug_buffer_init(
84     const hrt_address		addr);
85 
86 /*! Set the offset/address of the (remote) debug buffer
87 
88  \return none
89  */
90 void debug_buffer_ddr_init(
91     const ia_css_ptr		addr);
92 
93 /*! Set the (remote) operating mode of the debug buffer
94 
95  \return none
96  */
97 void debug_buffer_setmode(
98     const debug_buf_mode_t	mode);
99 
100 #endif /* __DEBUG_PUBLIC_H_INCLUDED__ */
101