You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ma...@apache.org on 2019/06/26 07:34:10 UTC
[mynewt-core] 01/02: native;
enable os_cputime for native BSP. Make task priority for hal_timer
configurable.
This is an automated email from the ASF dual-hosted git repository.
marko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
commit 739fb673d1ad58d1b6da9675eacc8b85fd163c36
Author: Marko Kiiskila <ma...@apache.org>
AuthorDate: Tue Jun 25 17:01:54 2019 +0300
native; enable os_cputime for native BSP. Make task priority for
hal_timer configurable.
---
hw/bsp/native/src/hal_bsp.c | 5 +++++
hw/mcu/native/src/hal_timer.c | 4 ++--
hw/mcu/native/syscfg.yml | 4 ++++
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/hw/bsp/native/src/hal_bsp.c b/hw/bsp/native/src/hal_bsp.c
index 53b1dd0..f062e6b 100644
--- a/hw/bsp/native/src/hal_bsp.c
+++ b/hw/bsp/native/src/hal_bsp.c
@@ -113,6 +113,11 @@ hal_bsp_init(void)
OS_DEV_INIT_PRIMARY, 0, simaccel_init, (void *) NULL);
assert(rc == 0);
#endif
+
+#if MYNEWT_VAL(OS_CPUTIME_TIMER_NUM >= 0)
+ rc = os_cputime_init(MYNEWT_VAL(OS_CPUTIME_FREQ));
+ assert(rc == 0);
+#endif
}
void
diff --git a/hw/mcu/native/src/hal_timer.c b/hw/mcu/native/src/hal_timer.c
index 80d81dd..437d726 100644
--- a/hw/mcu/native/src/hal_timer.c
+++ b/hw/mcu/native/src/hal_timer.c
@@ -106,8 +106,8 @@ hal_timer_config(int num, uint32_t clock_freq)
nt->last_ostime = os_time_get();
if (!native_timer_task_started) {
os_task_init(&native_timer_task_struct, "native_timer",
- native_timer_task, NULL, OS_TASK_PRI_HIGHEST, OS_WAIT_FOREVER,
- native_timer_stack, NATIVE_TIMER_STACK_SIZE);
+ native_timer_task, NULL, MYNEWT_VAL(MCU_TIMER_POLLER_PRIO),
+ OS_WAIT_FOREVER, native_timer_stack, NATIVE_TIMER_STACK_SIZE);
/* Initialize the eventq and task */
os_eventq_init(&native_timer_evq);
diff --git a/hw/mcu/native/syscfg.yml b/hw/mcu/native/syscfg.yml
index ddde037..f4e7287 100644
--- a/hw/mcu/native/syscfg.yml
+++ b/hw/mcu/native/syscfg.yml
@@ -65,4 +65,8 @@ syscfg.defs:
MCU_UART_POLLER_PRIO:
description: 'Priority of native UART poller task.'
type: task_priority
+ value: 1
+ MCU_TIMER_POLLER_PRIO:
+ description: 'Priority of native UART poller task.'
+ type: task_priority
value: 0