summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libcpu/powerpc/ppc403/timer/timer.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2001-11-09 00:04:57 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2001-11-09 00:04:57 +0000
commite9ae97fbc6221ffb11b1ce14f6fc320dc602b686 (patch)
treed3143d5a2ee19ac375731e462a59cca3339182fc /c/src/lib/libcpu/powerpc/ppc403/timer/timer.c
parent2001-11-08 Dennis Ehlin (ECS) <Dennis.Ehlin@ecs.ericsson.se> (diff)
downloadrtems-e9ae97fbc6221ffb11b1ce14f6fc320dc602b686.tar.bz2
2001-11-08 Dennis Ehlin (ECS) <Dennis.Ehlin@ecs.ericsson.se>
This modification is part of the submitted modifications necessary to support the IBM PPC405 family. This submission was reviewed by Thomas Doerfler <Thomas.Doerfler@imd-systems.de> who ensured it did not negatively impact the ppc403 BSPs. The submission and tracking process was captured as PR50. * ppc403/console/console405.c ppc403/tty_drv/.cvsignore, ppc403/tty_drv/Makefile.am, ppc403/tty_drv/tty_drv.c, ppc403/tty_drv/tty_drv.h: New files. * Makefile.am, README, configure.ac, old_exception_processing/cpu.c, old_exception_processing/cpu.h, ppc403/Makefile.am, ppc403/clock/clock.c, ppc403/console/Makefile.am, ppc403/console/console.c, ppc403/ictrl/ictrl.c, ppc403/ictrl/ictrl.h, ppc403/timer/timer.c: Modified.
Diffstat (limited to '')
-rw-r--r--c/src/lib/libcpu/powerpc/ppc403/timer/timer.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/c/src/lib/libcpu/powerpc/ppc403/timer/timer.c b/c/src/lib/libcpu/powerpc/ppc403/timer/timer.c
index 93a188da60..a29851e349 100644
--- a/c/src/lib/libcpu/powerpc/ppc403/timer/timer.c
+++ b/c/src/lib/libcpu/powerpc/ppc403/timer/timer.c
@@ -30,7 +30,10 @@
* found in the file LICENSE in this distribution or at
* http://www.OARcorp.com/rtems/license.html.
*
+ * Modifications for PPC405GP by Dennis Ehlin
+ *
* $Id$
+ *
*/
#include <rtems.h>
@@ -45,7 +48,13 @@ static inline rtems_unsigned32 get_itimer(void)
{
rtems_unsigned32 ret;
+#ifndef ppc405
asm volatile ("mfspr %0, 0x3dd" : "=r" ((ret))); /* TBLO */
+#else /* ppc405 */
+/* asm volatile ("mfspr %0, 0x3dd" : "=r" ((ret))); TBLO */
+
+ asm volatile ("mfspr %0, 0x10c" : "=r" ((ret))); /* 405GP TBL */
+#endif /* ppc405 */
return ret;
}
@@ -54,10 +63,21 @@ void Timer_initialize()
{
rtems_unsigned32 iocr;
+#ifndef ppc405
asm volatile ("mfdcr %0, 0xa0" : "=r" (iocr)); /* IOCR */
iocr &= ~4;
iocr |= 4; /* Select external timer clock */
asm volatile ("mtdcr 0xa0, %0" : "=r" (iocr) : "0" (iocr)); /* IOCR */
+#else /* ppc405 */
+ asm volatile ("mfdcr %0, 0x0b2" : "=r" (iocr)); /*405GP CPC0_CR1 */
+/* asm volatile ("mfdcr %0, 0xa0" : "=r" (iocr)); IOCR */
+
+ /* iocr |= 0x800000; select external timer clock CETE*/
+ iocr &= ~0x800000; /* timer clocked from system clock CETE*/
+
+ asm volatile ("mtdcr 0x0b2, %0" : "=r" (iocr) : "0" (iocr)); /* 405GP CPC0_CR1 */
+/* asm volatile ("mtdcr 0xa0, %0" : "=r" (iocr) : "0" (iocr)); IOCR */
+#endif /* ppc405 */
Timer_starting = get_itimer();
}