File tree Expand file tree Collapse file tree 6 files changed +64
-43
lines changed
Expand file tree Collapse file tree 6 files changed +64
-43
lines changed Original file line number Diff line number Diff line change 2525#define FAL_DEBUG 0
2626#endif
2727
28- #if FAL_DEBUG
29- #ifdef assert
30- #undef assert
31- #endif
32- #define assert (EXPR ) \
33- if (!(EXPR)) \
34- { \
35- FAL_PRINTF("(%s) has assert failed at %s.\n", #EXPR, __FUNCTION__); \
36- while (1); \
37- }
38-
39- /* debug level log */
40- #ifdef log_d
41- #undef log_d
42- #endif
43- #define log_d (...) FAL_PRINTF("[D/FAL] (%s:%d) ", __FUNCTION__, __LINE__); FAL_PRINTF(__VA_ARGS__);FAL_PRINTF("\n")
44-
45- #else
46-
47- #ifdef assert
48- #undef assert
49- #endif
50- #define assert (EXPR ) ((void)0);
51-
52- /* debug level log */
53- #ifdef log_d
54- #undef log_d
55- #endif
56- #define log_d (...)
57- #endif /* FAL_DEBUG */
58-
59- /* error level log */
60- #ifdef log_e
61- #undef log_e
62- #endif
63- #define log_e (...) FAL_PRINTF("\033[31;22m[E/FAL] (%s:%d) ", __FUNCTION__, __LINE__);FAL_PRINTF(__VA_ARGS__);FAL_PRINTF("\033[0m\n")
64-
65- /* info level log */
66- #ifdef log_i
67- #undef log_i
68- #endif
69- #define log_i (...) FAL_PRINTF("\033[32;22m[I/FAL] "); FAL_PRINTF(__VA_ARGS__);FAL_PRINTF("\033[0m\n")
70-
7128/* FAL flash and partition device name max length */
7229#ifndef FAL_DEV_NAME_MAX
7330#define FAL_DEV_NAME_MAX 24
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (c) 2006-2018, RT-Thread Development Team
3+ *
4+ * SPDX-License-Identifier: Apache-2.0
5+ *
6+ * Change Logs:
7+ * Date Author Notes
8+ * 2024-11-18 yekai move fal log to fal_log.h to avoid TAG conflict
9+ */
10+
11+ #ifndef _FAL_LOG_H_
12+ #define _FAL_LOG_H_
13+
14+ #include "fal_def.h"
15+
16+ #if FAL_DEBUG
17+ #ifdef assert
18+ #undef assert
19+ #endif
20+ #define assert (EXPR ) \
21+ if (!(EXPR)) \
22+ { \
23+ FAL_PRINTF("(%s) has assert failed at %s.\n", #EXPR, __FUNCTION__); \
24+ while (1); \
25+ }
26+
27+ /* debug level log */
28+ #ifdef log_d
29+ #undef log_d
30+ #endif
31+ #define log_d (...) FAL_PRINTF("[D/FAL] (%s:%d) ", __FUNCTION__, __LINE__); FAL_PRINTF(__VA_ARGS__);FAL_PRINTF("\n")
32+
33+ #else
34+
35+ #ifdef assert
36+ #undef assert
37+ #endif
38+ #define assert (EXPR ) ((void)0);
39+
40+ /* debug level log */
41+ #ifdef log_d
42+ #undef log_d
43+ #endif
44+ #define log_d (...)
45+ #endif /* FAL_DEBUG */
46+
47+ /* error level log */
48+ #ifdef log_e
49+ #undef log_e
50+ #endif
51+ #define log_e (...) FAL_PRINTF("\033[31;22m[E/FAL] (%s:%d) ", __FUNCTION__, __LINE__);FAL_PRINTF(__VA_ARGS__);FAL_PRINTF("\033[0m\n")
52+
53+ /* info level log */
54+ #ifdef log_i
55+ #undef log_i
56+ #endif
57+ #define log_i (...) FAL_PRINTF("\033[32;22m[I/FAL] "); FAL_PRINTF(__VA_ARGS__);FAL_PRINTF("\033[0m\n")
58+
59+ #endif
Original file line number Diff line number Diff line change 99 */
1010
1111#include <fal.h>
12+ #include "fal_def.h"
13+ #include "fal_log.h"
1214
1315static uint8_t init_ok = 0 ;
1416
Original file line number Diff line number Diff line change 1010
1111#include <fal.h>
1212#include <string.h>
13+ #include "fal_log.h"
1314
1415/* flash device table, must defined by user */
1516#if !defined(FAL_FLASH_DEV_TABLE )
Original file line number Diff line number Diff line change 1111#include <fal.h>
1212#include <string.h>
1313#include <stdlib.h>
14+ #include "fal_log.h"
1415
1516/* partition magic word */
1617#define FAL_PART_MAGIC_WORD 0x45503130
Original file line number Diff line number Diff line change 1616#include <rtdevice.h>
1717#include <string.h>
1818#include <stdlib.h>
19+ #include "fal_log.h"
1920
2021/* ========================== block device ======================== */
2122struct fal_blk_device
You can’t perform that action at this time.
0 commit comments