diff options
| author | aozima <[email protected]> | 2013-05-17 20:58:40 +0800 |
|---|---|---|
| committer | aozima <[email protected]> | 2013-05-17 20:58:40 +0800 |
| commit | 9a671a50024138b8072bbaa7a4084e8c3a7fc701 (patch) | |
| tree | f8b919e4b8f0bc9304ff32fbc0842a17e145f324 | |
| parent | 36fc5520cb5211858c402a3ca96c665e5aea23ed (diff) | |
move initial alarm event & mutex in system init.
| -rw-r--r-- | components/drivers/rtc/alarm.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/components/drivers/rtc/alarm.c b/components/drivers/rtc/alarm.c index 7fde2ce03c..e3cb7aa70d 100644 --- a/components/drivers/rtc/alarm.c +++ b/components/drivers/rtc/alarm.c @@ -1,7 +1,7 @@ /* * File : alarm.c * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team + * COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at @@ -10,6 +10,7 @@ * Change Logs: * Date Author Notes * 2012-10-27 heyuanjie87 first version. + * 2013-05-17 aozima initial alarm event & mutex in system init. */ #include <rtthread.h> @@ -21,7 +22,7 @@ #define RT_ALARM_STATE_START 0x01 #define RT_ALARM_STATE_STOP 0x00 -#if(defined(RT_USING_RTC) && defined(RT_USING_ALARM)) +#if (defined(RT_USING_RTC) && defined(RT_USING_ALARM)) static struct rt_alarm_container _container; rt_inline rt_uint32_t alarm_mkdaysec(struct tm *time) @@ -576,9 +577,6 @@ static void rt_alarmsvc_thread_init(void *param) { rt_uint32_t recv; - rt_list_init(&_container.head); - rt_event_init(&_container.event, "alarmsvc", RT_IPC_FLAG_FIFO); - rt_mutex_init(&_container.mutex, "alarmsvc", RT_IPC_FLAG_FIFO); _container.current = RT_NULL; while (1) @@ -602,6 +600,10 @@ void rt_alarm_system_init(void) { rt_thread_t tid; + rt_list_init(&_container.head); + rt_event_init(&_container.event, "alarmsvc", RT_IPC_FLAG_FIFO); + rt_mutex_init(&_container.mutex, "alarmsvc", RT_IPC_FLAG_FIFO); + tid = rt_thread_create("alarmsvc", rt_alarmsvc_thread_init, RT_NULL, 512, 8, 1); |
