From 81fa95d7e248af0102c70353efff189b9ac352f7 Mon Sep 17 00:00:00 2001 From: milo <1569491816@qq.com> Date: Sun, 29 Sep 2024 15:54:11 +0800 Subject: [PATCH 1/4] make rtc alarm internal thread's attributes configurable --- components/drivers/rtc/Kconfig | 14 ++++++++++++++ components/drivers/rtc/dev_alarm.c | 14 +++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/components/drivers/rtc/Kconfig b/components/drivers/rtc/Kconfig index e4310cb5b17..4caeca7df04 100644 --- a/components/drivers/rtc/Kconfig +++ b/components/drivers/rtc/Kconfig @@ -7,6 +7,20 @@ config RT_USING_RTC bool "Using RTC alarm" default n + if RT_USING_ALARM + config RT_ALARM_STACK_SIZE + int "stack size for internal thread" + default 2048 + + config RT_ALARM_TIMESLICE + int "timeslice for internal thread" + default 10 + + config RT_ALARM_PRIORITY + int "priority for internal thread" + default 5 + endif + config RT_USING_SOFT_RTC bool "Using software simulation RTC device" default n diff --git a/components/drivers/rtc/dev_alarm.c b/components/drivers/rtc/dev_alarm.c index b78528a04c1..6a303dd6e5f 100644 --- a/components/drivers/rtc/dev_alarm.c +++ b/components/drivers/rtc/dev_alarm.c @@ -9,6 +9,7 @@ * 2013-05-17 aozima initial alarm event & mutex in system init. * 2020-10-15 zhangsz add alarm flags hour minute second. * 2020-11-09 zhangsz fix alarm set when modify rtc time. + * 2024-09-29 milo make internal thread's attributes configurable. */ #include @@ -23,6 +24,15 @@ #endif #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; 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", rt_alarmsvc_thread_init, RT_NULL, - 2048, 10, 5); + RT_ALARM_STACK_SIZE, + RT_ALARM_TIMESLICE, + RT_ALARM_PRIORITY); if (tid != RT_NULL) rt_thread_startup(tid); From c782a0e439309cc61ba4e528722c0213bdab41d8 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Sun, 29 Sep 2024 13:15:49 -0400 Subject: [PATCH 2/4] Update components/drivers/rtc/Kconfig --- components/drivers/rtc/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/drivers/rtc/Kconfig b/components/drivers/rtc/Kconfig index 4caeca7df04..7493882f39c 100644 --- a/components/drivers/rtc/Kconfig +++ b/components/drivers/rtc/Kconfig @@ -9,7 +9,7 @@ config RT_USING_RTC if RT_USING_ALARM config RT_ALARM_STACK_SIZE - int "stack size for internal thread" + int "stack size for alarm thread" default 2048 config RT_ALARM_TIMESLICE From bc8dfef5eaaff249a09220da099f30ad93b9053d Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Sun, 29 Sep 2024 13:15:57 -0400 Subject: [PATCH 3/4] Update components/drivers/rtc/Kconfig --- components/drivers/rtc/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/drivers/rtc/Kconfig b/components/drivers/rtc/Kconfig index 7493882f39c..90349583911 100644 --- a/components/drivers/rtc/Kconfig +++ b/components/drivers/rtc/Kconfig @@ -13,7 +13,7 @@ config RT_USING_RTC default 2048 config RT_ALARM_TIMESLICE - int "timeslice for internal thread" + int "timeslice for alarm thread" default 10 config RT_ALARM_PRIORITY From 20fcd7e18cdc1dd2e48bb08f9182dcdfaee7ff06 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Sun, 29 Sep 2024 13:16:01 -0400 Subject: [PATCH 4/4] Update components/drivers/rtc/Kconfig --- components/drivers/rtc/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/drivers/rtc/Kconfig b/components/drivers/rtc/Kconfig index 90349583911..7ae99599af3 100644 --- a/components/drivers/rtc/Kconfig +++ b/components/drivers/rtc/Kconfig @@ -17,7 +17,7 @@ config RT_USING_RTC default 10 config RT_ALARM_PRIORITY - int "priority for internal thread" + int "priority for alarm thread" default 5 endif