[dev] make RTC alarm internal thread's attributes configurable
This commit is contained in:
parent
b4b010f4a3
commit
e6a3b30993
|
@ -7,6 +7,20 @@ config RT_USING_RTC
|
||||||
bool "Using RTC alarm"
|
bool "Using RTC alarm"
|
||||||
default n
|
default n
|
||||||
|
|
||||||
|
if RT_USING_ALARM
|
||||||
|
config RT_ALARM_STACK_SIZE
|
||||||
|
int "stack size for alarm thread"
|
||||||
|
default 2048
|
||||||
|
|
||||||
|
config RT_ALARM_TIMESLICE
|
||||||
|
int "timeslice for alarm thread"
|
||||||
|
default 10
|
||||||
|
|
||||||
|
config RT_ALARM_PRIORITY
|
||||||
|
int "priority for alarm thread"
|
||||||
|
default 5
|
||||||
|
endif
|
||||||
|
|
||||||
config RT_USING_SOFT_RTC
|
config RT_USING_SOFT_RTC
|
||||||
bool "Using software simulation RTC device"
|
bool "Using software simulation RTC device"
|
||||||
default n
|
default n
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* 2013-05-17 aozima initial alarm event & mutex in system init.
|
* 2013-05-17 aozima initial alarm event & mutex in system init.
|
||||||
* 2020-10-15 zhangsz add alarm flags hour minute second.
|
* 2020-10-15 zhangsz add alarm flags hour minute second.
|
||||||
* 2020-11-09 zhangsz fix alarm set when modify rtc time.
|
* 2020-11-09 zhangsz fix alarm set when modify rtc time.
|
||||||
|
* 2024-09-29 milo make internal thread's attributes configurable.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <rtthread.h>
|
#include <rtthread.h>
|
||||||
|
@ -23,6 +24,15 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (defined(RT_USING_RTC) && defined(RT_USING_ALARM))
|
#if (defined(RT_USING_RTC) && defined(RT_USING_ALARM))
|
||||||
|
#ifndef RT_ALARM_STACK_SIZE
|
||||||
|
#define RT_ALARM_STACK_SIZE 2048
|
||||||
|
#endif
|
||||||
|
#ifndef RT_ALARM_TIMESLICE
|
||||||
|
#define RT_ALARM_TIMESLICE 10
|
||||||
|
#endif
|
||||||
|
#ifndef RT_ALARM_PRIORITY
|
||||||
|
#define RT_ALARM_PRIORITY 5
|
||||||
|
#endif
|
||||||
static struct rt_alarm_container _container;
|
static struct rt_alarm_container _container;
|
||||||
|
|
||||||
rt_inline rt_uint32_t alarm_mkdaysec(struct tm *time)
|
rt_inline rt_uint32_t alarm_mkdaysec(struct tm *time)
|
||||||
|
@ -789,7 +799,9 @@ int rt_alarm_system_init(void)
|
||||||
|
|
||||||
tid = rt_thread_create("alarmsvc",
|
tid = rt_thread_create("alarmsvc",
|
||||||
rt_alarmsvc_thread_init, RT_NULL,
|
rt_alarmsvc_thread_init, RT_NULL,
|
||||||
2048, 10, 5);
|
RT_ALARM_STACK_SIZE,
|
||||||
|
RT_ALARM_TIMESLICE,
|
||||||
|
RT_ALARM_PRIORITY);
|
||||||
if (tid != RT_NULL)
|
if (tid != RT_NULL)
|
||||||
rt_thread_startup(tid);
|
rt_thread_startup(tid);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue