aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/platforms
diff options
context:
space:
mode:
Diffstat (limited to 'os/hal/platforms')
-rw-r--r--os/hal/platforms/SAM4L/hal_lld.c4
-rw-r--r--os/hal/platforms/SAM4L/hal_lld.h43
2 files changed, 46 insertions, 1 deletions
diff --git a/os/hal/platforms/SAM4L/hal_lld.c b/os/hal/platforms/SAM4L/hal_lld.c
index 2564ac49d..02dbfb9a3 100644
--- a/os/hal/platforms/SAM4L/hal_lld.c
+++ b/os/hal/platforms/SAM4L/hal_lld.c
@@ -53,6 +53,10 @@
/* Driver exported functions. */
/*===========================================================================*/
+void sam4l_clock_init(void) {
+
+}
+
/**
* @brief Low level HAL driver initialization.
*
diff --git a/os/hal/platforms/SAM4L/hal_lld.h b/os/hal/platforms/SAM4L/hal_lld.h
index 1b7106962..fb78792b9 100644
--- a/os/hal/platforms/SAM4L/hal_lld.h
+++ b/os/hal/platforms/SAM4L/hal_lld.h
@@ -29,14 +29,21 @@
#ifndef _HAL_LLD_H_
#define _HAL_LLD_H_
+#include "sam4l.h"
+
/*===========================================================================*/
/* Driver constants. */
/*===========================================================================*/
/**
+ * @brief Defines the support for realtime counters in the HAL.
+ */
+#define HAL_IMPLEMENTS_COUNTERS TRUE
+
+/**
* @brief Platform name.
*/
-#define PLATFORM_NAME ""
+#define PLATFORM_NAME "SAM4L Series"
/*===========================================================================*/
/* Driver pre-compile time settings. */
@@ -50,10 +57,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_HCLK.
+ *
+ * @return The realtime counter frequency of type halclock_t.
+ *
+ * @notapi
+ */
+#define hal_lld_get_counter_frequency() STM32_HCLK
+
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/
@@ -61,6 +101,7 @@
#ifdef __cplusplus
extern "C" {
#endif
+ void sam4l_clock_init(void);
void hal_lld_init(void);
#ifdef __cplusplus
}