1 #ifndef _DEV_RESET_INTERNAL_H_
2 #define _DEV_RESET_INTERNAL_H_
3 
4 #include <stdio.h>
5 #include <string.h>
6 
7 #include "linkkit/infra/infra_config.h"
8 #include "linkkit/infra/infra_types.h"
9 #include "linkkit/infra/infra_defs.h"
10 #include "linkkit/infra/infra_report.h"
11 #include "dev_reset_internal.h"
12 #include "linkkit/dev_reset_api.h"
13 #include "linkkit/mqtt_api.h"
14 #include "linkkit/wrappers/wrappers.h"
15 
16 #ifdef INFRA_LOG
17 #include "linkkit/infra/infra_log.h"
18 #define devrst_err(...)   log_err("devrst", __VA_ARGS__)
19 #define devrst_info(...)  log_info("devrst", __VA_ARGS__)
20 #define devrst_debug(...) log_debug("devrst", __VA_ARGS__)
21 #else
22 #define devrst_info(...)         \
23     do {                         \
24         HAL_Printf(__VA_ARGS__); \
25         HAL_Printf("\r\n");      \
26     } while (0)
27 #define devrst_err(...)          \
28     do {                         \
29         HAL_Printf(__VA_ARGS__); \
30         HAL_Printf("\r\n");      \
31     } while (0)
32 #define devrst_debug(...)        \
33     do {                         \
34         HAL_Printf(__VA_ARGS__); \
35         HAL_Printf("\r\n");      \
36     } while (0)
37 #endif
38 
39 #ifdef INFRA_MEM_STATS
40 #include "linkkit/infra/infra_mem_stats.h"
41 #define devrst_malloc(size) LITE_malloc(size, MEM_MAGIC, "devrst")
42 #define devrst_free(ptr)    LITE_free(ptr)
43 #else
44 #define devrst_malloc(size) HAL_Malloc(size)
45 #define devrst_free(ptr)       \
46     {                          \
47         HAL_Free((void *)ptr); \
48         ptr = NULL;            \
49     }
50 #endif
51 
52 #endif
53