1 /*
2  * Copyright (C) 2015-2018 Alibaba Group Holding Limited
3  */
4 
5 #ifndef DEBUG_OVERVIEW_H
6 #define DEBUG_OVERVIEW_H
7 
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11 
12 #define DEBUG_PANIC_IN_USER         1
13 #define DEBUG_PANIC_IN_KERNEL       0
14 
15 typedef struct {
16     int32_t total_size;
17     int32_t free_size;
18     int32_t used_size;
19     int32_t maxused_size;
20     int32_t maxblk_size;
21 } debug_mm_info_t;
22 
23 /**
24  * convert int to ascii(HEX)
25  * while using format % in libc, malloc/free is involved.
26  * this function avoid using malloc/free. so it works when heap corrupt.
27  * @param[in]   num      number
28  * @param[in]   str      fix 8 character str
29  * @return  str
30  */
31 char *k_int2str(int num, char *str);
32 
33 /**
34  * This function print the overview of heap
35  * @param[in]   print_func    function to output information, NULL for
36  * "printf"
37  */
38 void debug_mm_overview(int (*print_func)(const char *fmt, ...));
39 
40 /**
41  * This function print the overview of tasks
42  * @param[in]   print_func    function to output information, NULL for
43  * "printf"
44  */
45 void debug_task_overview(int (*print_func)(const char *fmt, ...));
46 
47 /**
48  * This function print the overview of buf_queues
49  * @param[in]   print_func    function to output information, NULL for
50  * "printf"
51  */
52 void debug_buf_queue_overview(int (*print_func)(const char *fmt, ...));
53 
54 /**
55  * This function print the overview of queues
56  * @param[in]   print_func    function to output information, NULL for
57  * "printf"
58  */
59 void debug_queue_overview(int (*print_func)(const char *fmt, ...));
60 
61 /**
62  * This function print the overview of sems
63  * @param[in]   print_func    function to output information, NULL for
64  * "printf"
65  */
66 void debug_sem_overview(int (*print_func)(const char *fmt, ...));
67 
68 /**
69  * This function print the overview of mutex
70  * @param[in]   print_func    function to output information, NULL for
71  * "printf"
72  */
73 void debug_mutex_overview(int (*print_func)(const char *fmt, ...));
74 
75 /**
76  * This function print the overview of all
77  * @param[in]   print_func    function to output information, NULL for
78  * "printf"
79  */
80 void debug_overview(int (*print_func)(const char *fmt, ...));
81 
82 void debug_heap_info_get(debug_mm_info_t *mm_info);
83 void debug_pool_info_get(debug_mm_info_t *mm_info);
84 
85 #ifdef __cplusplus
86 }
87 #endif
88 
89 #endif /* DEBUG_OVERVIEW_H */
90