aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/platforms/STM32F2xx/hal_lld.h
diff options
context:
space:
mode:
Diffstat (limited to 'os/hal/platforms/STM32F2xx/hal_lld.h')
-rw-r--r--os/hal/platforms/STM32F2xx/hal_lld.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/os/hal/platforms/STM32F2xx/hal_lld.h b/os/hal/platforms/STM32F2xx/hal_lld.h
index 528d4dec2..280cbea43 100644
--- a/os/hal/platforms/STM32F2xx/hal_lld.h
+++ b/os/hal/platforms/STM32F2xx/hal_lld.h
@@ -1320,10 +1320,43 @@
/* Driver data structures and types. */
/*===========================================================================*/
+/**
+ * @brief Type representing a system clock frequency.
+ */
+typedef uint32_t halclock_t;
+
+/**
+ * @brief Type of the realtime free counter value.
+ */
+typedef uint32_t halrtcnt_t;
+
/*===========================================================================*/
/* Driver macros. */
/*===========================================================================*/
+/**
+ * @brief Returns the current value of the system free running counter.
+ * @note This service is implemented by returning the content of the
+ * DWT_CYCCNT register.
+ *
+ * @return The value of the system free running counter of
+ * type halrtcnt_t.
+ *
+ * @notapi
+ */
+#define hal_lld_get_counter_value() DWT_CYCCNT
+
+/**
+ * @brief Realtime counter frequency.
+ * @note The DWT_CYCCNT register is incremented directly by the system
+ * clock so this function returns STM32_SYSCLK.
+ *
+ * @return The realtime counter frequency of type halclock_t.
+ *
+ * @notapi
+ */
+#define hal_lld_get_counter_frequency() STM32_SYSCLK
+
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/