microvg  3.0.1
microvg
microvg_trace.h
1 /*
2  * C
3  *
4  * Copyright 2023 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 
9 #if !defined MICROVG_TRACE_H
10 #define MICROVG_TRACE_H
11 
12 #if defined __cplusplus
13 extern "C" {
14 #endif
15 
16 // -----------------------------------------------------------------------------
17 // Includes
18 // -----------------------------------------------------------------------------
19 
20 #include "LLTRACE_impl.h"
21 
22 // -----------------------------------------------------------------------------
23 // Defines
24 // -----------------------------------------------------------------------------
25 
26 /*
27  * @brief Available number of events: IMAGE, FONT and DRAWING
28  */
29 #define LOG_MICROVG_EVENTS 3
30 
31 /*
32  * Events identifiers
33  */
34 #define LOG_MICROVG_IMAGE_ID 0
35 #define LOG_MICROVG_FONT_ID 1
36 #define LOG_MICROVG_DRAWING_ID 2
37 
38 /*
39  * @brief Types of Image events
40  */
41 #define LOG_MICROVG_IMAGE_load 0
42 #define LOG_MICROVG_IMAGE_create 1
43 #define LOG_MICROVG_IMAGE_close 2
44 
45 /*
46  * @brief Types of Font events
47  */
48 #define LOG_MICROVG_FONT_load 0
49 #define LOG_MICROVG_FONT_baseline 1
50 #define LOG_MICROVG_FONT_height 2
51 #define LOG_MICROVG_FONT_stringWidth 3
52 #define LOG_MICROVG_FONT_stringHeight 4
53 
54 /*
55  * @brief Types of Drawing events
56  */
57 #define LOG_MICROVG_DRAW_path 0
58 #define LOG_MICROVG_DRAW_pathGradient 1
59 #define LOG_MICROVG_DRAW_string 2
60 #define LOG_MICROVG_DRAW_stringGradient 3
61 #define LOG_MICROVG_DRAW_stringOnCircle 4
62 #define LOG_MICROVG_DRAW_stringOnCircleGradient 5
63 #define LOG_MICROVG_DRAW_image 6
64 
65 /*
66  * @brief Useful macros to concatenate easily some strings and defines.
67  */
68 #define CONCAT_STRINGS(p, s) p ## s
69 #define CONCAT_DEFINES(p, s) CONCAT_STRINGS(p,s)
70 
71 /*
72  * @brief Macro to add an event and its type.
73  */
74 #define LOG_MICROVG_START(event, type) \
75  if((int32_t)(&LOG_DRAWING_OPERATION) != -1) { \
76  LLTRACE_IMPL_record_event_u32(vg_trace_group_id, event, type); \
77  }
78 
79 /*
80  * @brief Macro to notify the end of an event and its type.
81  */
82 #define LOG_MICROVG_END(event, type) \
83  if((int32_t)(&LOG_DRAWING_OPERATION) != -1) { \
84  LLTRACE_IMPL_record_event_end_u32(vg_trace_group_id, event, type); \
85  }
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  * @brief External variable which is set when the execution trace is enabled
125  * in the application launcher.
126  */
127 extern void LOG_DRAWING_OPERATION(void);
128 
129 // -----------------------------------------------------------------------------
130 // EOF
131 // -----------------------------------------------------------------------------
132 
133 #ifdef __cplusplus
134 }
135 #endif
136 
137 #endif // !defined MICROVG_TRACE_H