1 /*
2  * Support for Intel Camera Imaging ISP subsystem.
3  * Copyright (c) 2015, Intel Corporation.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms and conditions of the GNU General Public License,
7  * version 2, as published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
12  * more details.
13  */
14 
15 #ifndef __DEBUG_PUBLIC_H_INCLUDED__
16 #define __DEBUG_PUBLIC_H_INCLUDED__
17 
18 #include <type_support.h>
19 #include <ia_css_types.h>
20 #include "system_types.h"
21 
22 /*! brief
23  *
24  * Simple queuing trace buffer for debug data
25  * instantiatable in SP DMEM
26  *
27  * The buffer has a remote and and a local store
28  * which contain duplicate data (when in sync).
29  * The buffers are automatically synched when the
30  * user dequeues, or manualy using the synch function
31  *
32  * An alternative (storage efficient) implementation
33  * could manage the buffers to contain unique data
34  *
35  * The buffer empty status is computed from local
36  * state which does not reflect the presence of data
37  * in the remote buffer (unless the alternative
38  * implementation is followed)
39  */
40 
41 typedef struct debug_data_s		debug_data_t;
42 typedef struct debug_data_ddr_s	debug_data_ddr_t;
43 
44 extern debug_data_t				*debug_data_ptr;
45 extern hrt_address				debug_buffer_address;
46 extern ia_css_ptr				debug_buffer_ddr_address;
47 
48 /*! Check the empty state of the local debug data buffer
49 
50  \return isEmpty(buffer)
51  */
52 STORAGE_CLASS_DEBUG_H bool is_debug_buffer_empty(void);
53 
54 /*! Dequeue a token from the debug data buffer
55 
56  \return isEmpty(buffer)?0:buffer[head]
57  */
58 STORAGE_CLASS_DEBUG_H hrt_data debug_dequeue(void);
59 
60 /*! Synchronise the remote buffer to the local buffer
61 
62  \return none
63  */
64 STORAGE_CLASS_DEBUG_H void debug_synch_queue(void);
65 
66 /*! Synchronise the remote buffer to the local buffer
67 
68  \return none
69  */
70 STORAGE_CLASS_DEBUG_H void debug_synch_queue_isp(void);
71 
72 /*! Synchronise the remote buffer to the local buffer
73 
74  \return none
75  */
76 STORAGE_CLASS_DEBUG_H void debug_synch_queue_ddr(void);
77 
78 /*! Set the offset/address of the (remote) debug buffer
79 
80  \return none
81  */
82 void debug_buffer_init(
83     const hrt_address		addr);
84 
85 /*! Set the offset/address of the (remote) debug buffer
86 
87  \return none
88  */
89 void debug_buffer_ddr_init(
90     const ia_css_ptr		addr);
91 
92 /*! Set the (remote) operating mode of the debug buffer
93 
94  \return none
95  */
96 void debug_buffer_setmode(
97     const debug_buf_mode_t	mode);
98 
99 #endif /* __DEBUG_PUBLIC_H_INCLUDED__ */
100