summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libcpu/powerpc
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2018-03-21 06:27:24 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-03-22 07:01:36 +0100
commitbb22a3f3af86c00d70f51b4a3531640c0808261a (patch)
tree11cfc463d71bd86bd28bd1d01e1bd6c15636e893 /c/src/lib/libcpu/powerpc
parentbsps/powerpc: Remove bsp_timer_internal_clock (diff)
downloadrtems-bb22a3f3af86c00d70f51b4a3531640c0808261a.tar.bz2
bsp/powerpc: Move libcpu timer to bsps
Use only one timer driver variant based on the standard PowerPC time base. This patch is a part of the BSP source reorganization. Update #3285.
Diffstat (limited to 'c/src/lib/libcpu/powerpc')
-rw-r--r--c/src/lib/libcpu/powerpc/Makefile.am38
-rw-r--r--c/src/lib/libcpu/powerpc/mpc6xx/timer/timer.c84
-rw-r--r--c/src/lib/libcpu/powerpc/mpc8260/timer/timer.c103
-rw-r--r--c/src/lib/libcpu/powerpc/mpc8xx/timer/timer.c94
-rw-r--r--c/src/lib/libcpu/powerpc/ppc403/timer/timer.c73
5 files changed, 0 insertions, 392 deletions
diff --git a/c/src/lib/libcpu/powerpc/Makefile.am b/c/src/lib/libcpu/powerpc/Makefile.am
index 6d5bc19e5b..e83d47a772 100644
--- a/c/src/lib/libcpu/powerpc/Makefile.am
+++ b/c/src/lib/libcpu/powerpc/Makefile.am
@@ -24,12 +24,6 @@ endif
ppc403_console_rel_CPPFLAGS = $(AM_CPPFLAGS)
ppc403_console_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
-# ppc403/timer
-noinst_PROGRAMS += ppc403/timer.rel
-ppc403_timer_rel_SOURCES = ppc403/timer/timer.c
-ppc403_timer_rel_CPPFLAGS = $(AM_CPPFLAGS)
-ppc403_timer_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
-
# ppc403/tty_drv
if ppc405
noinst_PROGRAMS += ppc403/tty_drv.rel
@@ -61,12 +55,6 @@ mpc6xx_clock_rel_SOURCES = mpc6xx/clock/c_clock.c mpc6xx/clock/c_clock.h
mpc6xx_clock_rel_CPPFLAGS = $(AM_CPPFLAGS)
mpc6xx_clock_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
-# mpc6xx/timer
-noinst_PROGRAMS += mpc6xx/timer.rel
-mpc6xx_timer_rel_SOURCES = mpc6xx/timer/timer.c
-mpc6xx_timer_rel_CPPFLAGS = $(AM_CPPFLAGS)
-mpc6xx_timer_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
-
# mpc6xx/altivec
noinst_PROGRAMS += mpc6xx/altivec.rel
mpc6xx_altivec_rel_SOURCES = mpc6xx/altivec/vec_sup.c mpc6xx/altivec/vec_sup_asm.S
@@ -83,14 +71,6 @@ e500_clock_rel_CPPFLAGS = $(AM_CPPFLAGS)
e500_clock_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
endif
-# e500/timer
-if e500_timer
-noinst_PROGRAMS += e500/timer.rel
-e500_timer_rel_SOURCES = mpc6xx/timer/timer.c
-e500_timer_rel_CPPFLAGS = $(AM_CPPFLAGS)
-e500_timer_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
-endif
-
# e500/mmu
if e500_mmu
noinst_PROGRAMS += e500/mmu.rel
@@ -124,12 +104,6 @@ noinst_PROGRAMS += mpc8xx/mmu.rel
mpc8xx_mmu_rel_SOURCES = mpc8xx/mmu/mmu.c
mpc8xx_mmu_rel_CPPFLAGS = $(AM_CPPFLAGS)
mpc8xx_mmu_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
-
-# mpc8xx/timer
-noinst_PROGRAMS += mpc8xx/timer.rel
-mpc8xx_timer_rel_SOURCES = mpc8xx/timer/timer.c
-mpc8xx_timer_rel_CPPFLAGS = $(AM_CPPFLAGS)
-mpc8xx_timer_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
endif
EXTRA_DIST += mpc8260/README
@@ -154,12 +128,6 @@ mpc8260_mmu_rel_SOURCES = mpc8260/mmu/mmu.c \
mpc8260/include/mmu.h
mpc8260_mmu_rel_CPPFLAGS = $(AM_CPPFLAGS)
mpc8260_mmu_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
-
-# mpc8260/timer
-noinst_PROGRAMS += mpc8260/timer.rel
-mpc8260_timer_rel_SOURCES = mpc8260/timer/timer.c
-mpc8260_timer_rel_CPPFLAGS = $(AM_CPPFLAGS)
-mpc8260_timer_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
endif
##############################################################################
@@ -209,12 +177,6 @@ noinst_PROGRAMS += mpc55xx/irq.rel
mpc55xx_irq_rel_SOURCES = mpc55xx/irq/irq.c
mpc55xx_irq_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
-# mpc6xx/timer
-noinst_PROGRAMS += mpc55xx/timer.rel
-mpc55xx_timer_rel_SOURCES = mpc6xx/timer/timer.c
-mpc55xx_timer_rel_CPPFLAGS = $(AM_CPPFLAGS)
-mpc55xx_timer_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
-
# FEC
noinst_PROGRAMS += mpc55xx/fec.rel
mpc55xx_fec_rel_SOURCES = mpc55xx/fec/fec.c
diff --git a/c/src/lib/libcpu/powerpc/mpc6xx/timer/timer.c b/c/src/lib/libcpu/powerpc/mpc6xx/timer/timer.c
deleted file mode 100644
index 2131b6017d..0000000000
--- a/c/src/lib/libcpu/powerpc/mpc6xx/timer/timer.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/**
- * @file
- * @brief
- *
- * This file implements a benchmark timer using the PPC Timebase Register.
- */
-
-/*
- * COPYRIGHT (c) 1989-2014.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may in
- * the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#include <bsp.h>
-#include <rtems.h>
-#include <rtems/system.h>
-#include <rtems/btimer.h>
-#include <assert.h>
-#include <libcpu/powerpc-utility.h>
-
-uint64_t Timer_driver_Start_time;
-
-bool benchmark_timer_find_average_overhead = false;
-unsigned clicks_overhead = 0;
-
-/*
- * Timer Get overhead
- */
-static int Timer_get_clicks_overhead(void)
-{
- uint64_t clicks;
-
- PPC_Set_timebase_register((uint64_t) 0);
- clicks = PPC_Get_timebase_register();
- assert(clicks <= 0xffffffff);
- clicks_overhead = (unsigned) clicks;
- return clicks_overhead;
-}
-
-/*
- * benchmark_timer_initialize
- */
-void benchmark_timer_initialize(void)
-{
-
- /*
- * Timer runs long and accurate enough not to require an interrupt.
- */
-
- if (clicks_overhead == 0) clicks_overhead = Timer_get_clicks_overhead();
- PPC_Set_timebase_register((uint64_t) 0);
-}
-
-
-/*
- * benchmark_timer_read
- */
-
-benchmark_timer_t benchmark_timer_read(void)
-{
- uint64_t total64;
- uint32_t total;
-
- /* approximately CLOCK_SPEED clicks per microsecond */
-
- total64 = PPC_Get_timebase_register();
-
- assert( total64 <= 0xffffffff ); /* fits into a uint32_t */
-
- total = (uint32_t) total64;
-
- if ( benchmark_timer_find_average_overhead == true )
- return total; /* in "clicks" of the decrementer units */
-
- return (int) BSP_Convert_decrementer(total - clicks_overhead);
-}
-
-void benchmark_timer_disable_subtracting_average_overhead(bool find_flag)
-{
- benchmark_timer_find_average_overhead = find_flag;
-}
diff --git a/c/src/lib/libcpu/powerpc/mpc8260/timer/timer.c b/c/src/lib/libcpu/powerpc/mpc8260/timer/timer.c
deleted file mode 100644
index c20fdc5cca..0000000000
--- a/c/src/lib/libcpu/powerpc/mpc8260/timer/timer.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/**
- * @file
- * @brief Timer for the PowerPC MPC860
- *
- * We shall use the bottom 32 bits of the timebase register,
- *
- * @note This is not the PIT, but rather the RTEMS interval timer.
- */
-
-/*
- * Author: Andy Dachs <a.dachs@sstl.co.uk>
- * Surrey Satellite Technlogy Limited
- * Modified for MPC8260
- * Derived from c/src/lib/libcpu/powerpc/mpc860/timer/timer.c:
- *
- * Author: Jay Monkman (jmonkman@frasca.com)
- * Copywright (C) 1998 by Frasca International, Inc.
- *
- * Derived from c/src/lib/libcpu/ppc/ppc403/timer/timer.c:
- *
- * Author: Andrew Bray <andy@i-cubed.co.uk>
- *
- * COPYRIGHT (c) 1995 by i-cubed ltd.
- *
- * To anyone who acknowledges that this file is provided "AS IS"
- * without any express or implied warranty:
- * permission to use, copy, modify, and distribute this file
- * for any purpose is hereby granted without fee, provided that
- * the above copyright notice and this notice appears in all
- * copies, and that the name of i-cubed limited not be used in
- * advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- * i-cubed limited makes no representations about the suitability
- * of this software for any purpose.
- *
- * Derived from c/src/lib/libcpu/hppa1_1/timer/timer.c:
- *
- * COPYRIGHT (c) 1989-2007.
- * On-Line Applications Research Corporation (OAR).
- *
- * 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.
- */
-
-#include <rtems.h>
-#include <rtems/btimer.h>
-#include <mpc8260.h>
-
-static volatile uint32_t Timer_starting;
-static bool benchmark_timer_find_average_overhead;
-
-/*
- * This is so small that this code will be reproduced where needed.
- */
-static inline uint32_t get_itimer(void)
-{
- uint32_t ret;
-
- __asm__ volatile ("mftb %0" : "=r" ((ret))); /* TBLO */
-
- return ret;
-}
-
-void benchmark_timer_initialize(void)
-{
- /* set interrupt level and enable timebase. This should never */
- /* generate an interrupt however. */
-
-/*
- m860.tbscr |= M860_TBSCR_TBIRQ(4) | M860_TBSCR_TBE;
-*/
-
-
- Timer_starting = get_itimer();
-}
-
-extern uint32_t bsp_timer_least_valid;
-extern uint32_t bsp_timer_average_overhead;
-benchmark_timer_t benchmark_timer_read(void)
-{
- uint32_t clicks;
- uint32_t total;
-
- clicks = get_itimer();
-
- total = clicks - Timer_starting;
-
- if ( benchmark_timer_find_average_overhead == 1 )
- return total; /* in XXX microsecond units */
-
- else {
- if ( total < bsp_timer_least_valid ) {
- return 0; /* below timer resolution */
- }
- return (total - bsp_timer_average_overhead);
- }
-}
-
-void benchmark_timer_disable_subtracting_average_overhead(bool find_flag)
-{
- benchmark_timer_find_average_overhead = find_flag;
-}
diff --git a/c/src/lib/libcpu/powerpc/mpc8xx/timer/timer.c b/c/src/lib/libcpu/powerpc/mpc8xx/timer/timer.c
deleted file mode 100644
index b82d76497d..0000000000
--- a/c/src/lib/libcpu/powerpc/mpc8xx/timer/timer.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/**
- * @file
- * @brief Timer Driver for the PowerPC MPC8xx.
- *
- * This file manages the interval timer on the PowerPC MPC8xx.
- * We shall use the bottom 32 bits of the timebase register,
- *
- * @note This is not the PIT, but rather the RTEMS interval timer
- */
-
-/*
- * Author: Jay Monkman (jmonkman@frasca.com)
- * Copywright (C) 1998 by Frasca International, Inc.
- *
- * Derived from c/src/lib/libcpu/ppc/ppc403/timer/timer.c:
- *
- * Author: Andrew Bray <andy@i-cubed.co.uk>
- *
- * COPYRIGHT (c) 1995 by i-cubed ltd.
- *
- * To anyone who acknowledges that this file is provided "AS IS"
- * without any express or implied warranty:
- * permission to use, copy, modify, and distribute this file
- * for any purpose is hereby granted without fee, provided that
- * the above copyright notice and this notice appears in all
- * copies, and that the name of i-cubed limited not be used in
- * advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- * i-cubed limited makes no representations about the suitability
- * of this software for any purpose.
- *
- * Derived from c/src/lib/libcpu/hppa1_1/timer/timer.c:
- *
- * COPYRIGHT (c) 1989-2007.
- * On-Line Applications Research Corporation (OAR).
- *
- * 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.
- */
-
-#include <rtems.h>
-#include <rtems/btimer.h>
-#include <mpc8xx.h>
-
-static volatile uint32_t Timer_starting;
-static bool benchmark_timer_find_average_overhead;
-extern uint32_t bsp_timer_least_valid;
-extern uint32_t bsp_timer_average_overhead;
-
-/*
- * This is so small that this code will be reproduced where needed.
- */
-static inline uint32_t get_itimer(void)
-{
- uint32_t ret;
-
- __asm__ volatile ("mftb %0" : "=r" ((ret))); /* TBLO */
-
- return ret;
-}
-
-void benchmark_timer_initialize(void)
-{
- /* set interrupt level and enable timebase. This should never */
- /* generate an interrupt however. */
- m8xx.tbscr |= M8xx_TBSCR_TBIRQ(4) | M8xx_TBSCR_TBE;
-
- Timer_starting = get_itimer();
-}
-
-benchmark_timer_t benchmark_timer_read(void)
-{
- uint32_t clicks;
- uint32_t total;
-
- clicks = get_itimer();
-
- total = clicks - Timer_starting;
-
- if ( benchmark_timer_find_average_overhead == 1 )
- return total; /* in XXX microsecond units */
- else {
- if ( total < bsp_timer_least_valid ) {
- return 0; /* below timer resolution */
- }
- return (total - bsp_timer_average_overhead);
- }
-}
-
-void benchmark_timer_disable_subtracting_average_overhead(bool find_flag)
-{
- benchmark_timer_find_average_overhead = find_flag;
-}
diff --git a/c/src/lib/libcpu/powerpc/ppc403/timer/timer.c b/c/src/lib/libcpu/powerpc/ppc403/timer/timer.c
deleted file mode 100644
index f883facb80..0000000000
--- a/c/src/lib/libcpu/powerpc/ppc403/timer/timer.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * @file
- * @brief Timer Driver for the PowerPC 405.
- *
- * This file manages the interval timer on the PowerPC 405.
- * We shall use the bottom 32 bits of the timebase register,
- */
-
-/*
- * Author: Andrew Bray <andy@i-cubed.co.uk>
- *
- * COPYRIGHT (c) 1995 by i-cubed ltd.
- *
- * To anyone who acknowledges that this file is provided "AS IS"
- * without any express or implied warranty:
- * permission to use, copy, modify, and distribute this file
- * for any purpose is hereby granted without fee, provided that
- * the above copyright notice and this notice appears in all
- * copies, and that the name of i-cubed limited not be used in
- * advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- * i-cubed limited makes no representations about the suitability
- * of this software for any purpose.
- *
- * Derived from c/src/lib/libcpu/hppa1.1/timer/timer.c:
- *
- * COPYRIGHT (c) 1989-2007.
- * On-Line Applications Research Corporation (OAR).
- *
- * 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.
- *
- * Modifications for PPC405GP by Dennis Ehlin
- *
- * Further mods for PPC405EX/EXr by Michael Hamel
- *
- */
-
-#include <rtems.h>
-#include <rtems/btimer.h>
-#include <libcpu/powerpc-utility.h>
-
-extern uint32_t bsp_timer_least_valid;
-extern uint32_t bsp_timer_average_overhead;
-
-static volatile uint32_t startedAt;
-static bool subtractOverhead;
-
-void benchmark_timer_initialize(void)
-{
- /* We are going to rely on clock.c to sort out where the clock comes from */
- startedAt = ppc_time_base();
-}
-
-benchmark_timer_t benchmark_timer_read(void)
-{
- uint32_t clicks, total;
-
- clicks = ppc_time_base();
- total = clicks - startedAt;
- if ( ! subtractOverhead )
- return total; /* in XXX microsecond units */
- else if ( total < bsp_timer_least_valid )
- return 0; /* below timer resolution */
- else
- return (total - bsp_timer_average_overhead);
-}
-
-void benchmark_timer_disable_subtracting_average_overhead(bool find_flag)
-{
- subtractOverhead = find_flag;
-}