From 29dd96ec351919a3eca34729335c4d1ded637c43 Mon Sep 17 00:00:00 2001 From: armink Date: Wed, 31 Oct 2018 10:57:52 +0800 Subject: [rtdbg] Add ulog compatible with rtdbg. --- include/rtdbg.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/rtdbg.h b/include/rtdbg.h index d19a191227..9036a0cd66 100644 --- a/include/rtdbg.h +++ b/include/rtdbg.h @@ -23,10 +23,7 @@ * #define DBG_LEVEL DBG_INFO * #include // must after of DEBUG_ENABLE or some other options * - * Then in your C/C++ file, you can use dbg_log macro to print out logs: - * dbg_log(DBG_INFO, "this is a log!\n"); - * - * Or if you want to using the simple API, you can + * Then in your C/C++ file, you can use LOG_X macro to print out logs: * LOG_D("this is a debug log!"); * LOG_E("this is a error log!"); * @@ -39,6 +36,11 @@ #include +#if defined(RT_USING_ULOG) && defined(DBG_ENABLE) +/* using ulog compatible with rtdbg */ +#include +#else + /* DEBUG level */ #define DBG_ERROR 0 #define DBG_WARNING 1 @@ -82,6 +84,8 @@ /* * static debug routine + * NOTE: This is a NOT RECOMMENDED API. Please using LOG_X API. + * It will be DISCARDED later. Because it will take up more resources. */ #define dbg_log(level, fmt, ...) \ if ((level) <= DBG_LEVEL) \ @@ -167,4 +171,6 @@ #define LOG_RAW(...) dbg_raw(__VA_ARGS__) +#endif /* defined(RT_USING_ULOG) && define(DBG_ENABLE) */ + #endif /* RT_DBG_H__ */ -- cgit v1.3.1 From e108dfe4a521355c454cf4d61b4297840264080b Mon Sep 17 00:00:00 2001 From: Bernard Xiong Date: Sat, 10 Nov 2018 16:58:07 +0800 Subject: [libc] Fix the _EXFUN issue in newlib --- components/dfs/include/dfs_posix.h | 4 +++- components/dfs/src/dfs_posix.c | 4 ++-- include/libc/libc_signal.h | 18 +++++++++--------- 3 files changed, 14 insertions(+), 12 deletions(-) (limited to 'include') diff --git a/components/dfs/include/dfs_posix.h b/components/dfs/include/dfs_posix.h index 79607fc8b4..bc8ff1c698 100644 --- a/components/dfs/include/dfs_posix.h +++ b/components/dfs/include/dfs_posix.h @@ -41,13 +41,15 @@ int closedir(DIR* d); /* file api*/ int open(const char *file, int flags, ...); int close(int d); -#ifdef RT_USING_NEWLIB + +#if defined(RT_USING_NEWLIB) && defined(_EXFUN) _READ_WRITE_RETURN_TYPE _EXFUN(read, (int __fd, void *__buf, size_t __nbyte)); _READ_WRITE_RETURN_TYPE _EXFUN(write, (int __fd, const void *__buf, size_t __nbyte)); #else int read(int fd, void *buf, size_t len); int write(int fd, const void *buf, size_t len); #endif + off_t lseek(int fd, off_t offset, int whence); int rename(const char *from, const char *to); int unlink(const char *pathname); diff --git a/components/dfs/src/dfs_posix.c b/components/dfs/src/dfs_posix.c index 59acde1f8c..97531ad59c 100644 --- a/components/dfs/src/dfs_posix.c +++ b/components/dfs/src/dfs_posix.c @@ -110,7 +110,7 @@ RTM_EXPORT(close); * @return the actual read data buffer length. If the returned value is 0, it * may be reach the end of file, please check errno. */ -#ifdef RT_USING_NEWLIB +#if defined(RT_USING_NEWLIB) && defined(_EXFUN) _READ_WRITE_RETURN_TYPE _EXFUN(read, (int fd, void *buf, size_t len)) #else int read(int fd, void *buf, size_t len) @@ -154,7 +154,7 @@ RTM_EXPORT(read); * * @return the actual written data buffer length. */ -#ifdef RT_USING_NEWLIB +#if defined(RT_USING_NEWLIB) && defined(_EXFUN) _READ_WRITE_RETURN_TYPE _EXFUN(write, (int fd, const void *buf, size_t len)) #else int write(int fd, const void *buf, size_t len) diff --git a/include/libc/libc_signal.h b/include/libc/libc_signal.h index b592b8227e..61a7e445e9 100644 --- a/include/libc/libc_signal.h +++ b/include/libc/libc_signal.h @@ -76,20 +76,20 @@ typedef struct siginfo siginfo_t; typedef unsigned long sigset_t; #define SIGHUP 1 -// #define SIGINT 2 +/* #define SIGINT 2 */ #define SIGQUIT 3 -// #define SIGILL 4 +/* #define SIGILL 4 */ #define SIGTRAP 5 -// #define SIGABRT 6 +/* #define SIGABRT 6 */ #define SIGEMT 7 -// #define SIGFPE 8 +/* #define SIGFPE 8 */ #define SIGKILL 9 #define SIGBUS 10 -// #define SIGSEGV 11 +/* #define SIGSEGV 11 */ #define SIGSYS 12 #define SIGPIPE 13 #define SIGALRM 14 -// #define SIGTERM 15 +/* #define SIGTERM 15 */ #define SIGURG 16 #define SIGSTOP 17 #define SIGTSTP 18 @@ -99,8 +99,8 @@ typedef unsigned long sigset_t; #define SIGTTOU 22 #define SIGPOLL 23 #define SIGWINCH 24 -// #define SIGUSR1 25 -// #define SIGUSR2 26 +/* #define SIGUSR1 25 */ +/* #define SIGUSR2 26 */ #define SIGRTMIN 27 #define SIGRTMAX 31 #define NSIG 32 @@ -136,7 +136,7 @@ typedef unsigned long sigset_t; #define SIGQUIT 3 #define SIGILL 4 #define SIGTRAP 5 -// #define SIGABRT 6 +/* #define SIGABRT 6 */ #define SIGEMT 7 #define SIGFPE 8 #define SIGKILL 9 -- cgit v1.3.1 From d343c6578a0c12c4bdc98e7634907fb9779ba0d7 Mon Sep 17 00:00:00 2001 From: guozhanxin Date: Tue, 13 Nov 2018 11:32:01 +0800 Subject: [kernel]Change 'rt_timer_timeout_hook' function to 'rt_timer_enter_hook' and add 'rt_timer_exit_hook' hook function. --- include/rtthread.h | 3 ++- src/timer.c | 28 +++++++++++++++++++++------- 2 files changed, 23 insertions(+), 8 deletions(-) (limited to 'include') diff --git a/include/rtthread.h b/include/rtthread.h index fc5029a220..96ebe1940a 100644 --- a/include/rtthread.h +++ b/include/rtthread.h @@ -100,7 +100,8 @@ rt_tick_t rt_timer_next_timeout_tick(void); void rt_timer_check(void); #ifdef RT_USING_HOOK -void rt_timer_timeout_sethook(void (*hook)(struct rt_timer *timer)); +void rt_timer_enter_sethook(void (*hook)(struct rt_timer *timer)); +void rt_timer_exit_sethook(void (*hook)(struct rt_timer *timer)); #endif /**@}*/ diff --git a/src/timer.c b/src/timer.c index dc489a2d0d..fd938065db 100644 --- a/src/timer.c +++ b/src/timer.c @@ -43,7 +43,8 @@ static rt_uint8_t timer_thread_stack[RT_TIMER_THREAD_STACK_SIZE]; #ifdef RT_USING_HOOK extern void (*rt_object_take_hook)(struct rt_object *object); extern void (*rt_object_put_hook)(struct rt_object *object); -static void (*rt_timer_timeout_hook)(struct rt_timer *timer); +static void (*rt_timer_enter_hook)(struct rt_timer *timer); +static void (*rt_timer_exit_hook)(struct rt_timer *timer); /** * @addtogroup Hook @@ -52,14 +53,25 @@ static void (*rt_timer_timeout_hook)(struct rt_timer *timer); /**@{*/ /** - * This function will set a hook function, which will be invoked when timer - * is timeout. + * This function will set a hook function, which will be invoked when enter + * timer timeout callback function. * * @param hook the hook function */ -void rt_timer_timeout_sethook(void (*hook)(struct rt_timer *timer)) +void rt_timer_enter_sethook(void (*hook)(struct rt_timer *timer)) { - rt_timer_timeout_hook = hook; + rt_timer_enter_hook = hook; +} + +/** + * This function will set a hook function, which will be invoked when exit + * timer timeout callback function. + * + * @param hook the hook function + */ +void rt_timer_exit_sethook(void (*hook)(struct rt_timer *timer)) +{ + rt_timer_exit_hook = hook; } /**@}*/ @@ -503,7 +515,7 @@ void rt_timer_check(void) */ if ((current_tick - t->timeout_tick) < RT_TICK_MAX / 2) { - RT_OBJECT_HOOK_CALL(rt_timer_timeout_hook, (t)); + RT_OBJECT_HOOK_CALL(rt_timer_enter_hook, (t)); /* remove timer from timer list firstly */ _rt_timer_remove(t); @@ -514,6 +526,7 @@ void rt_timer_check(void) /* re-get tick */ current_tick = rt_tick_get(); + RT_OBJECT_HOOK_CALL(rt_timer_exit_hook, (t)); RT_DEBUG_LOG(RT_DEBUG_TIMER, ("current tick: %d\n", current_tick)); if ((t->parent.flag & RT_TIMER_FLAG_PERIODIC) && @@ -578,7 +591,7 @@ void rt_soft_timer_check(void) */ if ((current_tick - t->timeout_tick) < RT_TICK_MAX / 2) { - RT_OBJECT_HOOK_CALL(rt_timer_timeout_hook, (t)); + RT_OBJECT_HOOK_CALL(rt_timer_enter_hook, (t)); /* move node to the next */ n = n->next; @@ -594,6 +607,7 @@ void rt_soft_timer_check(void) /* re-get tick */ current_tick = rt_tick_get(); + RT_OBJECT_HOOK_CALL(rt_timer_exit_hook, (t)); RT_DEBUG_LOG(RT_DEBUG_TIMER, ("current tick: %d\n", current_tick)); /* lock scheduler */ -- cgit v1.3.1 From 8a3cfe09b7a56e14b3bf5dcc324f73cff93aa310 Mon Sep 17 00:00:00 2001 From: Bernard Xiong Date: Sun, 18 Nov 2018 08:59:29 +0800 Subject: Update rtdef.h --- include/rtdef.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/rtdef.h b/include/rtdef.h index deb3295e27..12f7031ca6 100644 --- a/include/rtdef.h +++ b/include/rtdef.h @@ -24,6 +24,7 @@ * 2018-05-31 Bernard change version number to v3.1.0 * 2018-09-04 Bernard change version number to v3.1.1 * 2018-09-14 Bernard apply Apache License v2.0 to RT-Thread Kernel + * 2018-11-18 Bernard change version number to v4.0.0 */ #ifndef __RT_DEF_H__ -- cgit v1.3.1 From c8d38b79ff02760632cf356e562716d6f7f7845b Mon Sep 17 00:00:00 2001 From: Bernard Xiong Date: Sun, 18 Nov 2018 08:59:48 +0800 Subject: Update rtdef.h --- include/rtdef.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/rtdef.h b/include/rtdef.h index 12f7031ca6..bed9a5a076 100644 --- a/include/rtdef.h +++ b/include/rtdef.h @@ -44,9 +44,9 @@ extern "C" { /*@{*/ /* RT-Thread version information */ -#define RT_VERSION 3L /**< major version number */ -#define RT_SUBVERSION 1L /**< minor version number */ -#define RT_REVISION 1L /**< revise version number */ +#define RT_VERSION 4L /**< major version number */ +#define RT_SUBVERSION 0L /**< minor version number */ +#define RT_REVISION 0L /**< revise version number */ /* RT-Thread version */ #define RTTHREAD_VERSION ((RT_VERSION * 10000) + \ -- cgit v1.3.1