1 
2 #ifndef _GENIE_PORT_H_
3 #define _GENIE_PORT_H_
4 
5 #define GENIE_DEBUG_COLOR
6 
7 #ifdef GENIE_DEBUG_COLOR
8 #define F_BLACK  "\033[0;30m"
9 #define F_RED    "\033[0;31m"
10 #define F_GREEN  "\033[0;32m"
11 #define F_YELLOW "\033[0;33m"
12 #define F_BLUE   "\033[0;34m"
13 #define F_PURPLE "\033[0;35m"
14 #define F_DGREEN "\033[0;36m"
15 #define F_WHITE  "\033[0;37m"
16 #define F_END    "\033[0m"
17 #define BT_DBG_R(fmt, ...)                    \
18                                 if (BT_DBG_ENABLED) {                   \
19                                     LOGV("GENIE",F_RED "[%s]" fmt F_END, __func__,   \
20                 ##__VA_ARGS__);             \
21                                 }
22 #else
23 #define F_BLACK
24 #define F_RED
25 #define F_GREEN
26 #define F_YELLOW
27 #define F_BLUE
28 #define F_PURPLE
29 #define F_DGREEN
30 #define F_WHITE
31 #define F_END
32 
33 #define BT_DBG_R(fmt, ...)
34 #endif
35 
36 extern uint8_t g_mesh_log_mode;
37 
38 #define printk(...) \
39 { \
40     if(g_mesh_log_mode) { \
41       printf(__VA_ARGS__); \
42     }\
43 }
44 
45 #define k_malloc malloc
46 
47 #if defined(CONFIG_BT_DEBUG_LOG)
48 //#define BT_DBG(fmt, ...)  SYS_LOG_DBG(fmt, ##__VA_ARGS__)
49 //#define BT_ERR(fmt, ...) SYS_LOG_ERR(fmt, ##__VA_ARGS__)
50 //#define BT_WARN(fmt, ...) SYS_LOG_WRN(fmt, ##__VA_ARGS__)
51 //#define BT_INFO(fmt, ...) SYS_LOG_INF(fmt, ##__VA_ARGS__)
52 #else
53 //#define BT_DBG(fmt, ...)
54 //#define BT_ERR BT_DBG
55 //#define BT_WARN BT_DBG
56 //#define BT_INFO BT_DBG
57 #endif
58 
59 #ifdef GENIE_DEBUG_COLOR
60 //#define F_RED    "\033[0;31m"
61 //#define F_GREEN  "\033[0;32m"
62 //#define F_BLUE   "\033[0;34m"
63 //#define F_END    "\033[0m"
64 #define BT_INFO_R(fmt, ...) SYS_LOG_DBG(F_RED fmt F_END, ##__VA_ARGS__);
65 #define BT_INFO_G(fmt, ...) SYS_LOG_DBG(F_GREEN fmt F_END, ##__VA_ARGS__);
66 #define BT_INFO_B(fmt, ...) SYS_LOG_DBG(F_BLUE fmt F_END, ##__VA_ARGS__);
67 #else
68 #define F_RED
69 #define F_GREEN
70 #define F_BLUE
71 #define F_END
72 #define BT_INFO_R(fmt, ...)
73 #define BT_INFO_G(fmt, ...)
74 #define BT_INFO_B(fmt, ...)
75 #endif
76 
77 int bt_mesh_aes_encrypt(const uint8_t key[16], const uint8_t plaintext[16],
78                         uint8_t enc_data[16]);
79 int bt_mesh_aes_decrypt(const uint8_t key[16], const uint8_t enc_data[16],
80                         uint8_t dec_data[16]);
81 
82 int bt_mesh_adv_stop(void);
83 
84 #define hal_malloc malloc
85 #define hal_free   free
86 
87 void genie_mesh_setup(void);
88 
89 #endif
90