From 41f7f2c28411472cf99cdedf0abaaab823ba185f Mon Sep 17 00:00:00 2001 From: Bernard Xiong Date: Fri, 14 Sep 2018 22:37:43 +0800 Subject: [Kernel] Update to Apache License v2.0 Update license for RT-Thread kernel. --- src/timer.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) (limited to 'src/timer.c') diff --git a/src/timer.c b/src/timer.c index 042826f41b..01e6211e04 100644 --- a/src/timer.c +++ b/src/timer.c @@ -1,21 +1,11 @@ /* - * File : timer.c - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * Copyright (c) 2006-2018, RT-Thread Development Team * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * File : timer.c * * Change Logs: * Date Author Notes -- cgit v1.3.1 From ff08faf605d683a462a2bedd17a6d3ef6ad61761 Mon Sep 17 00:00:00 2001 From: Bernard Xiong Date: Tue, 25 Sep 2018 11:06:07 +0800 Subject: [Kernel] Adjust the copyright information --- libcpu/arm/cortex-m4/context_rvds.S | 12 ++++-------- src/clock.c | 5 ----- src/components.c | 4 ---- src/device.c | 4 ---- src/idle.c | 4 ---- src/ipc.c | 4 ---- src/irq.c | 4 ---- src/kservice.c | 4 ---- src/mem.c | 4 ---- src/mempool.c | 4 ---- src/object.c | 4 ---- src/scheduler.c | 4 ---- src/signal.c | 4 ---- src/thread.c | 4 ---- src/timer.c | 4 ---- 15 files changed, 4 insertions(+), 65 deletions(-) (limited to 'src/timer.c') diff --git a/libcpu/arm/cortex-m4/context_rvds.S b/libcpu/arm/cortex-m4/context_rvds.S index 6d20ab8e3e..f6d2447c5e 100644 --- a/libcpu/arm/cortex-m4/context_rvds.S +++ b/libcpu/arm/cortex-m4/context_rvds.S @@ -1,12 +1,8 @@ ;/* -; * File : context_rvds.S -; * This file is part of RT-Thread RTOS -; * COPYRIGHT (C) 2006 - 2018, RT-Thread Development Team -; * -; * The license and distribution terms for this file may be -; * found in the file LICENSE in this distribution or at -; * http://www.rt-thread.org/license/LICENSE -; * +;* Copyright (c) 2006-2018, RT-Thread Development Team +;* +;* SPDX-License-Identifier: Apache-2.0 +;* ; * Change Logs: ; * Date Author Notes ; * 2009-01-17 Bernard first version. diff --git a/src/clock.c b/src/clock.c index 9834f0f95c..651465e0a8 100644 --- a/src/clock.c +++ b/src/clock.c @@ -3,11 +3,6 @@ * * SPDX-License-Identifier: Apache-2.0 * - */ - -/* - * File : clock.c - * * Change Logs: * Date Author Notes * 2006-03-12 Bernard first version diff --git a/src/components.c b/src/components.c index 09f0680b55..679a88ef11 100644 --- a/src/components.c +++ b/src/components.c @@ -2,10 +2,6 @@ * Copyright (c) 2006-2018, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 - */ - -/* - * File : init.c * * Change Logs: * Date Author Notes diff --git a/src/device.c b/src/device.c index 94f550d682..51fc6176a6 100644 --- a/src/device.c +++ b/src/device.c @@ -2,10 +2,6 @@ * Copyright (c) 2006-2018, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 - */ - -/* - * File : device.c * * Change Logs: * Date Author Notes diff --git a/src/idle.c b/src/idle.c index 8a4734ab49..ec7d6bea6e 100644 --- a/src/idle.c +++ b/src/idle.c @@ -2,10 +2,6 @@ * Copyright (c) 2006-2018, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 - */ - -/* - * File : idle.c * * Change Logs: * Date Author Notes diff --git a/src/ipc.c b/src/ipc.c index d2a3ba766c..56045911a8 100644 --- a/src/ipc.c +++ b/src/ipc.c @@ -2,10 +2,6 @@ * Copyright (c) 2006-2018, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 - */ - -/* - * File : ipc.c * * Change Logs: * Date Author Notes diff --git a/src/irq.c b/src/irq.c index 98a6fd3a04..72d220bd92 100644 --- a/src/irq.c +++ b/src/irq.c @@ -2,10 +2,6 @@ * Copyright (c) 2006-2018, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 - */ - -/* - * File : irq.c * * Change Logs: * Date Author Notes diff --git a/src/kservice.c b/src/kservice.c index e10c093c70..dbc4a2fb0e 100644 --- a/src/kservice.c +++ b/src/kservice.c @@ -2,10 +2,6 @@ * Copyright (c) 2006-2018, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 - */ - -/* - * File : kservice.c * * Change Logs: * Date Author Notes diff --git a/src/mem.c b/src/mem.c index 03e6f34eb4..cb96ab9ee0 100644 --- a/src/mem.c +++ b/src/mem.c @@ -2,10 +2,6 @@ * Copyright (c) 2006-2018, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 - */ - -/* - * File : mem.c * * Change Logs: * Date Author Notes diff --git a/src/mempool.c b/src/mempool.c index e1af7d9e42..2184586aba 100644 --- a/src/mempool.c +++ b/src/mempool.c @@ -2,10 +2,6 @@ * Copyright (c) 2006-2018, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 - */ - -/* - * File : mempool.c * * Change Logs: * Date Author Notes diff --git a/src/object.c b/src/object.c index 8dcfb2e57e..70b9a5c04e 100644 --- a/src/object.c +++ b/src/object.c @@ -2,10 +2,6 @@ * Copyright (c) 2006-2018, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 - */ - -/* - * File : object.c * * Change Logs: * Date Author Notes diff --git a/src/scheduler.c b/src/scheduler.c index 8b5ffc9f4c..95b5d487df 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -2,10 +2,6 @@ * Copyright (c) 2006-2018, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 - */ - -/* - * File : scheduler.c * * Change Logs: * Date Author Notes diff --git a/src/signal.c b/src/signal.c index 6499d05a97..c783420514 100644 --- a/src/signal.c +++ b/src/signal.c @@ -2,10 +2,6 @@ * Copyright (c) 2006-2018, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 - */ - -/* - * File : signal.c * * Change Logs: * Date Author Notes diff --git a/src/thread.c b/src/thread.c index 249219b8aa..6d79ece54b 100644 --- a/src/thread.c +++ b/src/thread.c @@ -2,10 +2,6 @@ * Copyright (c) 2006-2018, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 - */ - -/* - * File : thread.c * * Change Logs: * Date Author Notes diff --git a/src/timer.c b/src/timer.c index 01e6211e04..dc489a2d0d 100644 --- a/src/timer.c +++ b/src/timer.c @@ -2,10 +2,6 @@ * Copyright (c) 2006-2018, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 - */ - -/* - * File : timer.c * * Change Logs: * Date Author Notes -- 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 'src/timer.c') 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