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 2016/04/11 23:25:34 UTC

[04/28] incubator-mynewt-core git commit: Interrupts are not disabled when the Cortex-M is inside an ISR so replace OS_ASSERT_CRITICAL() with a OS_ENTER_CRITICAL/OS_EXIT_CRITICAL in os_time_tick().

Interrupts are not disabled when the Cortex-M is inside an ISR so replace
OS_ASSERT_CRITICAL() with a OS_ENTER_CRITICAL/OS_EXIT_CRITICAL in
os_time_tick().


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/e4185fd8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/e4185fd8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/e4185fd8

Branch: refs/heads/develop
Commit: e4185fd83a99fb0bd086e8896540f5a6e64b0754
Parents: 67ab7fe
Author: Neel Natu <ne...@nahannisys.com>
Authored: Mon Mar 21 14:54:00 2016 -0700
Committer: Neel Natu <ne...@nahannisys.com>
Committed: Mon Mar 21 14:54:00 2016 -0700

----------------------------------------------------------------------
 libs/os/src/os_time.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/e4185fd8/libs/os/src/os_time.c
----------------------------------------------------------------------
diff --git a/libs/os/src/os_time.c b/libs/os/src/os_time.c
index dc70dec..825fc13 100644
--- a/libs/os/src/os_time.c
+++ b/libs/os/src/os_time.c
@@ -59,11 +59,12 @@ os_time_get(void)
 static void
 os_time_tick(int ticks)
 {
+    os_sr_t sr;
     os_time_t delta, prev_os_time;
 
     assert(ticks >= 0);
 
-    OS_ASSERT_CRITICAL();
+    OS_ENTER_CRITICAL(sr);
     prev_os_time = g_os_time;
     g_os_time += ticks;
 
@@ -77,6 +78,7 @@ os_time_tick(int ticks)
         os_deltatime(delta, &basetod.utctime, &basetod.utctime);
         basetod.ostime = g_os_time;
     }
+    OS_EXIT_CRITICAL(sr);
 }
 
 void