summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam San Filippo <wills@runtime.io>2016-08-22 15:20:30 -0700
committerWilliam San Filippo <wills@runtime.io>2016-08-22 15:20:30 -0700
commit03c939a22d76b045f55228ad61c1fc4b88cd5fc6 (patch)
tree5115cb8223b85902aa9bfb87674f18d7ddda847d
parent6f3d956f863e03f52ef22513c4b8501a58d6843d (diff)
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.
-rw-r--r--hw/hal/include/hal/hal_cputime.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/hw/hal/include/hal/hal_cputime.h b/hw/hal/include/hal/hal_cputime.h
index 7932de65..08cf2dec 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);