1 /**
2  * @file lv_gc.h
3  *
4  */
5 
6 #ifndef LV_GC_H
7 #define LV_GC_H
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 /*********************
14  *      INCLUDES
15  *********************/
16 #include "../lv_conf_internal.h"
17 #include <stdint.h>
18 #include "lv_mem.h"
19 #include "lv_ll.h"
20 #include "lv_timer.h"
21 #include "lv_types.h"
22 #include "../draw/lv_img_cache.h"
23 #include "../draw/lv_draw_mask.h"
24 #include "../core/lv_obj_pos.h"
25 
26 /*********************
27  *      DEFINES
28  *********************/
29 #if LV_IMG_CACHE_DEF_SIZE
30 #    define LV_IMG_CACHE_DEF            1
31 #else
32 #    define LV_IMG_CACHE_DEF            0
33 #endif
34 
35 #define LV_DISPATCH(f, t, n)            f(t, n)
36 #define LV_DISPATCH_COND(f, t, n, m, v) LV_CONCAT3(LV_DISPATCH, m, v)(f, t, n)
37 
38 #define LV_DISPATCH00(f, t, n)          LV_DISPATCH(f, t, n)
39 #define LV_DISPATCH01(f, t, n)
40 #define LV_DISPATCH10(f, t, n)
41 #define LV_DISPATCH11(f, t, n)          LV_DISPATCH(f, t, n)
42 
43 #define LV_ITERATE_ROOTS(f)                                                                            \
44     LV_DISPATCH(f, lv_ll_t, _lv_timer_ll) /*Linked list to store the lv_timers*/                       \
45     LV_DISPATCH(f, lv_ll_t, _lv_disp_ll)  /*Linked list of display device*/                            \
46     LV_DISPATCH(f, lv_ll_t, _lv_indev_ll) /*Linked list of input device*/                              \
47     LV_DISPATCH(f, lv_ll_t, _lv_fsdrv_ll)                                                              \
48     LV_DISPATCH(f, lv_ll_t, _lv_anim_ll)                                                               \
49     LV_DISPATCH(f, lv_ll_t, _lv_group_ll)                                                              \
50     LV_DISPATCH(f, lv_ll_t, _lv_img_decoder_ll)                                                        \
51     LV_DISPATCH(f, lv_ll_t, _lv_obj_style_trans_ll)                                                    \
52     LV_DISPATCH(f, lv_layout_dsc_t *, _lv_layout_list)                                                 \
53     LV_DISPATCH_COND(f, _lv_img_cache_entry_t*, _lv_img_cache_array, LV_IMG_CACHE_DEF, 1)              \
54     LV_DISPATCH_COND(f, _lv_img_cache_entry_t, _lv_img_cache_single, LV_IMG_CACHE_DEF, 0)              \
55     LV_DISPATCH(f, lv_timer_t*, _lv_timer_act)                                                         \
56     LV_DISPATCH(f, lv_mem_buf_arr_t , lv_mem_buf)                                                      \
57     LV_DISPATCH_COND(f, _lv_draw_mask_radius_circle_dsc_arr_t , _lv_circle_cache, LV_DRAW_COMPLEX, 1)  \
58     LV_DISPATCH_COND(f, _lv_draw_mask_saved_arr_t , _lv_draw_mask_list, LV_DRAW_COMPLEX, 1)            \
59     LV_DISPATCH(f, void * , _lv_theme_default_styles)                                                  \
60     LV_DISPATCH(f, void * , _lv_theme_basic_styles)                                                  \
61     LV_DISPATCH_COND(f, uint8_t *, _lv_font_decompr_buf, LV_USE_FONT_COMPRESSED, 1)                    \
62     LV_DISPATCH(f, uint8_t * , _lv_grad_cache_mem)                                                     \
63     LV_DISPATCH(f, uint8_t * , _lv_style_custom_prop_flag_lookup_table)
64 
65 #define LV_DEFINE_ROOT(root_type, root_name) root_type root_name;
66 #define LV_ROOTS LV_ITERATE_ROOTS(LV_DEFINE_ROOT)
67 
68 #if LV_ENABLE_GC == 1
69 #if LV_MEM_CUSTOM != 1
70 #error "GC requires CUSTOM_MEM"
71 #endif /*LV_MEM_CUSTOM*/
72 #include LV_GC_INCLUDE
73 #else  /*LV_ENABLE_GC*/
74 #define LV_GC_ROOT(x) x
75 #define LV_EXTERN_ROOT(root_type, root_name) extern root_type root_name;
76 LV_ITERATE_ROOTS(LV_EXTERN_ROOT)
77 #endif /*LV_ENABLE_GC*/
78 
79 /**********************
80  *      TYPEDEFS
81  **********************/
82 
83 /**********************
84  * GLOBAL PROTOTYPES
85  **********************/
86 
87 void _lv_gc_clear_roots(void);
88 
89 /**********************
90  *      MACROS
91  **********************/
92 
93 #ifdef __cplusplus
94 } /*extern "C"*/
95 #endif
96 
97 #endif /*LV_GC_H*/
98