summaryrefslogtreecommitdiffstats
path: root/bsps/m68k/genmcf548x
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2018-04-20 12:08:42 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-04-20 13:52:19 +0200
commite0dd8a5ad830798bc8082b03b8c42c32fb9660e0 (patch)
treed147bfc4d670fcdfbd2e2d2e75eb209f92e07df1 /bsps/m68k/genmcf548x
parentbsps: Move startup files to bsps (diff)
downloadrtems-e0dd8a5ad830798bc8082b03b8c42c32fb9660e0.tar.bz2
bsps: Move benchmark timer to bsps
This patch is a part of the BSP source reorganization. Update #3285.
Diffstat (limited to 'bsps/m68k/genmcf548x')
-rw-r--r--bsps/m68k/genmcf548x/btimer/btimer.c83
1 files changed, 83 insertions, 0 deletions
diff --git a/bsps/m68k/genmcf548x/btimer/btimer.c b/bsps/m68k/genmcf548x/btimer/btimer.c
new file mode 100644
index 0000000000..acac6f8f9b
--- /dev/null
+++ b/bsps/m68k/genmcf548x/btimer/btimer.c
@@ -0,0 +1,83 @@
+/*===============================================================*\
+| Project: RTEMS generic mcf548x BSP |
++-----------------------------------------------------------------+
+| File: timer.c |
++-----------------------------------------------------------------+
+| The file contains the diagnostic timer code of generic MCF548x |
+| BSP. |
++-----------------------------------------------------------------+
+| Copyright (c) 2007 |
+| Embedded Brains GmbH |
+| Obere Lagerstr. 30 |
+| D-82178 Puchheim |
+| Germany |
+| rtems@embedded-brains.de |
++-----------------------------------------------------------------+
+| |
+| Parts of the code has been derived from the "dBUG source code" |
+| package Freescale is providing for M548X EVBs. The usage of |
+| the modified or unmodified code and it's integration into the |
+| generic mcf548x BSP has been done according to the Freescale |
+| license terms. |
+| |
+| The Freescale license terms can be reviewed in the file |
+| |
+| Freescale_license.txt |
+| |
++-----------------------------------------------------------------+
+| |
+| The generic mcf548x BSP has been developed on the basic |
+| structures and modules of the av5282 BSP. |
+| |
++-----------------------------------------------------------------+
+| |
+| The license and distribution terms for this file may be |
+| found in the file LICENSE in this distribution or at |
+| |
+| http://www.rtems.org/license/LICENSE. |
+| |
++-----------------------------------------------------------------+
+| |
+| date history ID |
+| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
+| 12.11.07 1.0 ras |
+| |
+\*===============================================================*/
+
+/*
+ * Timer Init
+ *
+ * Use the second slice timer (SLT1) as the diagnostic timer.
+ */
+
+#include <rtems.h>
+#include <rtems/btimer.h>
+#include <bsp.h>
+#include <mcf548x/mcf548x.h>
+
+bool benchmark_timer_find_average_overhead;
+static uint32_t microsecond_timer_value = 0;
+
+void benchmark_timer_initialize(void)
+{
+ MCF548X_SLT_SLTCNT1 = 0xFFFFFFFF;
+ MCF548X_SLT_SCR1 |= (MCF548X_SLT_SCR_TEN | MCF548X_SLT_SCR_RUN);
+}
+
+/*
+ * Return timer value in microsecond units
+ * XLB clock 100 MHz / 1us is equal to 100 counts
+ */
+uint32_t
+benchmark_timer_read(void)
+{
+ microsecond_timer_value = (0xFFFFFFFF - MCF548X_SLT_SCNT1)/100;
+
+ return microsecond_timer_value;
+}
+
+void
+benchmark_timer_disable_subtracting_average_overhead(bool find_flag)
+{
+ benchmark_timer_find_average_overhead = find_flag;
+}