microvg  7.0.0
microvg
vg_trace.h
1 /*
2  * C
3  *
4  * Copyright 2023-2024 MicroEJ Corp. All rights reserved.
5  * Use of this source code is governed by a BSD-style license that can be found with this software.
6  */
7 
8 #if !defined VG_TRACE_H
9 #define VG_TRACE_H
10 
11 #if defined __cplusplus
12 extern "C" {
13 #endif
14 
15 /*
16  * @file
17  * @brief Provides the logs of the CCO MicroVG.
18  * @author MicroEJ Developer Team
19  * @version 7.0.0
20  */
21 
22 // -----------------------------------------------------------------------------
23 // Includes
24 // -----------------------------------------------------------------------------
25 
26 #include "LLTRACE_impl.h"
27 
28 // -----------------------------------------------------------------------------
29 // Defines
30 // -----------------------------------------------------------------------------
31 
32 /*
33  * @brief Available number of events: IMAGE, FONT and DRAWING
34  */
35 #define LOG_MICROVG_EVENTS 3
36 
37 /*
38  * Events identifiers
39  */
40 #define LOG_MICROVG_IMAGE_ID 0
41 #define LOG_MICROVG_FONT_ID 1
42 #define LOG_MICROVG_DRAWING_ID 2
43 
44 /*
45  * @brief Types of Image events
46  */
47 #define LOG_MICROVG_IMAGE_load 0
48 #define LOG_MICROVG_IMAGE_create 1
49 #define LOG_MICROVG_IMAGE_close 2
50 
51 /*
52  * @brief Types of Font events
53  */
54 #define LOG_MICROVG_FONT_load 0
55 #define LOG_MICROVG_FONT_baseline 1
56 #define LOG_MICROVG_FONT_height 2
57 #define LOG_MICROVG_FONT_stringWidth 3
58 #define LOG_MICROVG_FONT_stringHeight 4
59 
60 /*
61  * @brief Types of Drawing events
62  */
63 #define LOG_MICROVG_DRAW_path 0
64 #define LOG_MICROVG_DRAW_pathGradient 1
65 #define LOG_MICROVG_DRAW_string 2
66 #define LOG_MICROVG_DRAW_stringGradient 3
67 #define LOG_MICROVG_DRAW_stringOnCircle 4
68 #define LOG_MICROVG_DRAW_stringOnCircleGradient 5
69 #define LOG_MICROVG_DRAW_image 6
70 
71 /*
72  * @brief Useful macros to concatenate easily some strings and defines.
73  */
74 #define CONCAT_STRINGS(p, s) p ## s
75 #define CONCAT_DEFINES(p, s) CONCAT_STRINGS(p, s)
76 
77 /*
78  * @brief Macro to add an event and its type.
79  */
80 #define LOG_MICROVG_START(event, type) LLTRACE_IMPL_record_event_u32(VG_TRACE_group_id, event, type);
81 
82 /*
83  * @brief Macro to notify the end of an event and its type.
84  */
85 #define LOG_MICROVG_END(event, type) LLTRACE_IMPL_record_event_end_u32(VG_TRACE_group_id, event, type);
86 
87 /* The following lines must be added to a SYSVIEW_MicroVG.txt file
88  * in the <SYSTEMVIEW instalation dir>/Description folder
89  *
90  * NamedType VGImage 0=LOAD_IMAGE
91  * NamedType VGImage 1=CREATE_IMAGE
92  * NamedType VGImage 2=CLOSE_IMAGE
93  *
94  * NamedType VGFont 0=LOAD_FONT
95  * NamedType VGFont 1=FONT_BASELINE
96  * NamedType VGFont 2=FONT_HEIGHT
97  * NamedType VGFont 3=STRING_WIDTH
98  * NamedType VGFont 4=STRING_HEIGHT
99  *
100  * NamedType VGDraw 0=DRAW_PATH
101  * NamedType VGDraw 1=DRAW_PATH_GRADIENT
102  * NamedType VGDraw 2=DRAW_STRING
103  * NamedType VGDraw 3=DRAW_STRING_GRADIENT
104  * NamedType VGDraw 4=DRAW_STRING_ON_CIRCLE
105  * NamedType VGDraw 5=DRAW_STRING_ON_CIRCLE_GRADIENT
106  * NamedType VGDraw 6=DRAW_IMAGE
107  *
108  * 0 VG_ImageEvent (MicroVG) Execute image event %VGImage | (MicroVG) Image event %VGImage done
109  * 1 VG_FontEvent (MicroVG) Execute font event %VGFont | (MicroVG) Font event %VGFont done
110  * 2 VG_DrawingEvent (MicroVG) Execute drawing event %VGDraw | (MicroVG) Drawing event %VGDraw done
111  *
112  */
113 
114 // -----------------------------------------------------------------------------
115 // Extern symbols
116 // -----------------------------------------------------------------------------
117 
118 /*
119  * @brief External variable that contains the id for each trace group.
120  */
121 extern int32_t VG_TRACE_group_id;
122 
123 // -----------------------------------------------------------------------------
124 // EOF
125 // -----------------------------------------------------------------------------
126 
127 #ifdef __cplusplus
128 }
129 #endif
130 
131 #endif // !defined VG_TRACE_H