You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2016/08/24 00:54:01 UTC

[47/50] [abbrv] incubator-mynewt-core git commit: MYNEWT-329

MYNEWT-329

By default, we will assume that cputime counts at a 1 MHz rate.
If a different frequency is desired the user should define
HAL_CPUTIME in their target, project or bsp. See the jira ticket
for more information.


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/03c939a2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/03c939a2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/03c939a2

Branch: refs/heads/master
Commit: 03c939a22d76b045f55228ad61c1fc4b88cd5fc6
Parents: 6f3d956
Author: William San Filippo <wi...@runtime.io>
Authored: Mon Aug 22 15:20:30 2016 -0700
Committer: William San Filippo <wi...@runtime.io>
Committed: Mon Aug 22 15:20:30 2016 -0700

----------------------------------------------------------------------
 hw/hal/include/hal/hal_cputime.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/03c939a2/hw/hal/include/hal/hal_cputime.h
----------------------------------------------------------------------
diff --git a/hw/hal/include/hal/hal_cputime.h b/hw/hal/include/hal/hal_cputime.h
index 7932de6..08cf2de 100644
--- a/hw/hal/include/hal/hal_cputime.h
+++ b/hw/hal/include/hal/hal_cputime.h
@@ -26,6 +26,22 @@ extern "C" {
 
 #include "os/queue.h"
 
+/*
+ * NOTE: these definitions allow one to override the cputime frequency used.
+ * The reason these definitions exist is to make the code more efficient/smaller
+ * when CPUTIME counts at 1 MHz.
+ *
+ * For those who want a different cputime frequency, you can set the macro
+ * HAL_CPUTIME to the desired frequency in your project, target or bsp.
+ */
+#ifndef HAL_CPUTIME
+#define HAL_CPUTIME 1000000
+#endif
+
+#if (HAL_CPUTIME == 1000000)
+#define HAL_CPUTIME_1MHZ
+#endif
+
 /* CPU timer callback function */
 struct cpu_timer;
 typedef void (*cputimer_func)(void *arg);