This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
PowerPC - support application profiling
- From: Gary Thomas <gthomas at ecoscentric dot com>
- To: eCos patches <ecos-patches at sources dot redhat dot com>
- Date: 14 Nov 2002 16:37:10 -0700
- Subject: PowerPC - support application profiling
Index: hal/powerpc/arch/current/ChangeLog
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/hal/powerpc/arch/current/ChangeLog,v
retrieving revision 1.44
diff -u -5 -p -r1.44 ChangeLog
--- hal/powerpc/arch/current/ChangeLog 13 Nov 2002 21:05:25 -0000 1.44
+++ hal/powerpc/arch/current/ChangeLog 14 Nov 2002 23:35:56 -0000
@@ -1,5 +1,10 @@
+2002-11-14 Gary Thomas <gthomas@ecoscentric.com>
+
+ * src/vectors.S: Provide pointer to saved registers on interrupt.
+ This is necessary for profiling support.
+
2002-11-13 Gary Thomas <gthomas@ecoscentric.com>
* src/hal_misc.c (hal_enable_caches): Support new CDL options for
how [mode] to enable DATA cache.
Index: hal/powerpc/arch/current/src/vectors.S
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/hal/powerpc/arch/current/src/vectors.S,v
retrieving revision 1.26
diff -u -5 -p -r1.26 vectors.S
--- hal/powerpc/arch/current/src/vectors.S 23 May 2002 23:04:14 -0000 1.26
+++ hal/powerpc/arch/current/src/vectors.S 14 Nov 2002 23:35:57 -0000
@@ -7,10 +7,11 @@
##==========================================================================
#####ECOSGPLCOPYRIGHTBEGIN####
## -------------------------------------------
## This file is part of eCos, the Embedded Configurable Operating System.
## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+## Copyright (C) 2002 Gary Thomas
##
## eCos is free software; you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free
## Software Foundation; either version 2 or (at your option) any later version.
##
@@ -742,10 +743,11 @@ cyg_hal_default_interrupt_vsr:
lwzx r6,r6,r15 # load routine pointer
lwi r4,hal_interrupt_data # get interrupt data table
lwzx r4,r4,r15 # load data pointer
# R4 = data argument
+ mr r5,r14 # R5 = saved registers
mtctr r6 # put isr address in ctr
bctrl # branch to ctr reg and link
Index: hal/powerpc/mpc8xx/current/ChangeLog
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/hal/powerpc/mpc8xx/current/ChangeLog,v
retrieving revision 1.17
diff -u -5 -p -r1.17 ChangeLog
--- hal/powerpc/mpc8xx/current/ChangeLog 13 Nov 2002 21:05:26 -0000 1.17
+++ hal/powerpc/mpc8xx/current/ChangeLog 14 Nov 2002 23:36:26 -0000
@@ -1,5 +1,10 @@
+2002-11-14 Gary Thomas <gthomas@ecoscentric.com>
+
+ * src/var_misc.c:
+ * cdl/hal_powerpc_mpc8xx.cdl: Add support for profiling.
+
2002-11-13 Gary Thomas <gthomas@ecoscentric.com>
* include/var_cache.h (HAL_DCACHE_WRITE_MODE): Define for support
of various modes (copyback/writethru)
Index: hal/powerpc/mpc8xx/current/cdl/hal_powerpc_mpc8xx.cdl
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/hal/powerpc/mpc8xx/current/cdl/hal_powerpc_mpc8xx.cdl,v
retrieving revision 1.6
diff -u -5 -p -r1.6 hal_powerpc_mpc8xx.cdl
--- hal/powerpc/mpc8xx/current/cdl/hal_powerpc_mpc8xx.cdl 23 May 2002 23:04:27 -0000 1.6
+++ hal/powerpc/mpc8xx/current/cdl/hal_powerpc_mpc8xx.cdl 14 Nov 2002 22:12:45 -0000
@@ -7,10 +7,11 @@
# ====================================================================
#####ECOSGPLCOPYRIGHTBEGIN####
## -------------------------------------------
## This file is part of eCos, the Embedded Configurable Operating System.
## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+## Copyright (C) 2002 Gary Thomas
##
## eCos is free software; you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free
## Software Foundation; either version 2 or (at your option) any later version.
##
@@ -39,11 +40,11 @@
#####ECOSGPLCOPYRIGHTEND####
# ====================================================================
######DESCRIPTIONBEGIN####
#
# Author(s): jskov
-# Contributors:
+# Contributors: gthomas
# Date: 2000-02-04
#
#####DESCRIPTIONEND####
#
# ====================================================================
@@ -56,10 +57,12 @@ cdl_package CYGPKG_HAL_POWERPC_MPC8xx {
define_header hal_powerpc_mpc8xx.h
description "
The PowerPC 8xx variant HAL package provides generic support
for this processor variant. It is also necessary to
select a specific target platform HAL package."
+
+ implements CYGPKG_PROFILE_TIMER
cdl_interface CYGINT_HAL_USE_ROM_MONITOR_UNSUPPORTED {
display "ROM monitor configuration is unsupported"
no_define
}
Index: hal/powerpc/mpc8xx/current/src/var_misc.c
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/hal/powerpc/mpc8xx/current/src/var_misc.c,v
retrieving revision 1.7
diff -u -5 -p -r1.7 var_misc.c
--- hal/powerpc/mpc8xx/current/src/var_misc.c 13 Nov 2002 21:18:17 -0000 1.7
+++ hal/powerpc/mpc8xx/current/src/var_misc.c 14 Nov 2002 22:15:08 -0000
@@ -204,7 +204,67 @@ cyg_hal_clear_MMU (void)
// Make caches default disabled when MMU is disabled.
CYGARC_MTSPR (MI_CTR, ctr | CYGARC_REG_MI_CTR_CIDEF);
CYGARC_MTSPR (MD_CTR, ctr | CYGARC_REG_MD_CTR_CIDEF);
}
+#ifdef CYGPKG_PROFILE
+//--------------------------------------------------------------------------
+//
+// Profiling support - uses a separate high-speed timer
+//
+
+#include <cyg/hal/hal_arch.h>
+#include <cyg/hal/hal_intr.h>
+#include <cyg/hal/quicc/ppc8xx.h>
+#include <cyg/infra/profile.h>
+
+// Can't rely on Cyg_Interrupt class being defined.
+#define Cyg_InterruptHANDLED 1
+
+#define PIT_IRQ_LEVEL 4
+#define PIT_IRQ CYGNUM_HAL_INTERRUPT_SIU_LVL4
+#define ID_PIT 34512
+
+
+// Periodic timer ISR.
+static cyg_uint32
+isr_pit(CYG_ADDRWORD vector, CYG_ADDRWORD data, HAL_SavedRegisters *regs)
+{
+
+ HAL_INTERRUPT_ACKNOWLEDGE (CYGNUM_HAL_INTERRUPT_SIU_PIT);
+ profile_hit(regs->pc);
+
+ return Cyg_InterruptHANDLED;
+}
+
+void
+hal_enable_profile_timer(int resolution)
+{
+ // Run periodic timer interrupt for profile
+ cyg_uint16 piscr;
+ int period = resolution / 100;
+
+ // Attach pit arbiter.
+ HAL_INTERRUPT_ATTACH (PIT_IRQ,
+ &hal_arbitration_isr_pit, ID_PIT, 0);
+ HAL_INTERRUPT_UNMASK (PIT_IRQ);
+
+ // Attach pit isr.
+ HAL_INTERRUPT_ATTACH (CYGNUM_HAL_INTERRUPT_SIU_PIT, &isr_pit,
+ ID_PIT, 0);
+ HAL_INTERRUPT_SET_LEVEL (CYGNUM_HAL_INTERRUPT_SIU_PIT, PIT_IRQ_LEVEL);
+ HAL_INTERRUPT_UNMASK (CYGNUM_HAL_INTERRUPT_SIU_PIT);
+
+
+ // Set period.
+ HAL_WRITE_UINT32 (CYGARC_REG_IMM_PITC,
+ (2*period) << CYGARC_REG_IMM_PITC_COUNT_SHIFT);
+
+ // Enable.
+ HAL_READ_UINT16 (CYGARC_REG_IMM_PISCR, piscr);
+ piscr |= CYGARC_REG_IMM_PISCR_PTE;
+ HAL_WRITE_UINT16 (CYGARC_REG_IMM_PISCR, piscr);
+}
+#endif
+
//--------------------------------------------------------------------------
// End of var_misc.c
--
------------------------------------------------------------
Gary Thomas |
eCosCentric, Ltd. |
+1 (970) 229-1963 | eCos & RedBoot experts
gthomas@ecoscentric.com |
http://www.ecoscentric.com/ |
------------------------------------------------------------