[rtems commit] bsps/arm: Add a9mpcore_clock_initialize_early()
Sebastian Huber
sebh at rtems.org
Wed Sep 10 14:09:56 UTC 2014
Module: rtems
Branch: master
Commit: ecf64a5eb94c8a7f2852b049793a96fdfb47a81e
Changeset: http://git.rtems.org/rtems/commit/?id=ecf64a5eb94c8a7f2852b049793a96fdfb47a81e
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Wed Sep 10 16:17:02 2014 +0200
bsps/arm: Add a9mpcore_clock_initialize_early()
This is necessary to use the CPU counter converter even in case no clock
driver is present, e.g. in tmcontext01.
---
.../libbsp/arm/altera-cyclone-v/startup/bspstart.c | 2 ++
.../libbsp/arm/realview-pbx-a9/startup/bspstart.c | 2 ++
.../libbsp/arm/shared/arm-a9mpcore-clock-config.c | 4 ----
.../libbsp/arm/shared/include/arm-a9mpcore-clock.h | 11 ++++++++++-
.../lib/libbsp/arm/xilinx-zynq/startup/bspstart.c | 2 ++
5 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/c/src/lib/libbsp/arm/altera-cyclone-v/startup/bspstart.c b/c/src/lib/libbsp/arm/altera-cyclone-v/startup/bspstart.c
index a5e63e2..85eadbf 100644
--- a/c/src/lib/libbsp/arm/altera-cyclone-v/startup/bspstart.c
+++ b/c/src/lib/libbsp/arm/altera-cyclone-v/startup/bspstart.c
@@ -13,11 +13,13 @@
*/
#include <bsp/bootcard.h>
+#include <bsp/arm-a9mpcore-clock.h>
#include <bsp/irq-generic.h>
#include <bsp/nocache-heap.h>
void bsp_start( void )
{
+ a9mpcore_clock_initialize_early();
bsp_interrupt_initialize();
altera_cyclone_v_nocache_init_heap();
}
diff --git a/c/src/lib/libbsp/arm/realview-pbx-a9/startup/bspstart.c b/c/src/lib/libbsp/arm/realview-pbx-a9/startup/bspstart.c
index 8660c66..0be515c 100644
--- a/c/src/lib/libbsp/arm/realview-pbx-a9/startup/bspstart.c
+++ b/c/src/lib/libbsp/arm/realview-pbx-a9/startup/bspstart.c
@@ -14,9 +14,11 @@
#include <bsp.h>
#include <bsp/bootcard.h>
+#include <bsp/arm-a9mpcore-clock.h>
#include <bsp/irq-generic.h>
void bsp_start(void)
{
+ a9mpcore_clock_initialize_early();
bsp_interrupt_initialize();
}
diff --git a/c/src/lib/libbsp/arm/shared/arm-a9mpcore-clock-config.c b/c/src/lib/libbsp/arm/shared/arm-a9mpcore-clock-config.c
index fb8cf38..f2ce07e 100644
--- a/c/src/lib/libbsp/arm/shared/arm-a9mpcore-clock-config.c
+++ b/c/src/lib/libbsp/arm/shared/arm-a9mpcore-clock-config.c
@@ -12,8 +12,6 @@
* http://www.rtems.org/license/LICENSE.
*/
-#include <rtems/counter.h>
-
#include <bsp.h>
#include <bsp/fatal.h>
#include <bsp/irq.h>
@@ -108,8 +106,6 @@ static void a9mpcore_clock_initialize(void)
| A9MPCORE_GT_CTRL_IRQ_EN
| A9MPCORE_GT_CTRL_COMP_EN
| A9MPCORE_GT_CTRL_TMR_EN;
-
- rtems_counter_initialize_converter((uint32_t) periphclk);
}
CPU_Counter_ticks _CPU_Counter_read(void)
diff --git a/c/src/lib/libbsp/arm/shared/include/arm-a9mpcore-clock.h b/c/src/lib/libbsp/arm/shared/include/arm-a9mpcore-clock.h
index 52b871b..9a8c653 100644
--- a/c/src/lib/libbsp/arm/shared/include/arm-a9mpcore-clock.h
+++ b/c/src/lib/libbsp/arm/shared/include/arm-a9mpcore-clock.h
@@ -9,7 +9,7 @@
#ifndef LIBBSP_ARM_SHARED_ARM_A9MPCORE_CLOCK_H
#define LIBBSP_ARM_SHARED_ARM_A9MPCORE_CLOCK_H
-#include <bsp.h>
+#include <rtems/counter.h>
#ifdef __cplusplus
extern "C" {
@@ -22,6 +22,15 @@ extern "C" {
*/
uint32_t a9mpcore_clock_periphclk(void);
+/**
+ * @brief Do early clock initialization so that the CPU counter conversion
+ * works.
+ */
+static inline void a9mpcore_clock_initialize_early(void)
+{
+ rtems_counter_initialize_converter(a9mpcore_clock_periphclk());
+}
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/c/src/lib/libbsp/arm/xilinx-zynq/startup/bspstart.c b/c/src/lib/libbsp/arm/xilinx-zynq/startup/bspstart.c
index 8660c66..0be515c 100644
--- a/c/src/lib/libbsp/arm/xilinx-zynq/startup/bspstart.c
+++ b/c/src/lib/libbsp/arm/xilinx-zynq/startup/bspstart.c
@@ -14,9 +14,11 @@
#include <bsp.h>
#include <bsp/bootcard.h>
+#include <bsp/arm-a9mpcore-clock.h>
#include <bsp/irq-generic.h>
void bsp_start(void)
{
+ a9mpcore_clock_initialize_early();
bsp_interrupt_initialize();
}
More information about the vc
mailing list