Mercurial > flash_v2
changeset 1338:2a68919a1b99
Enable profiling using timer #1
| author | gthomas |
|---|---|
| date | Thu, 30 Oct 2003 14:12:55 +0000 |
| parents | 1ded88da2dd4 |
| children | 3fd78c0401ac |
| files | packages/hal/arm/sa11x0/var/current/ChangeLog packages/hal/arm/sa11x0/var/current/cdl/hal_arm_sa11x0.cdl packages/hal/arm/sa11x0/var/current/src/sa11x0_misc.c |
| diffstat | 3 files changed, 45 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/packages/hal/arm/sa11x0/var/current/ChangeLog +++ b/packages/hal/arm/sa11x0/var/current/ChangeLog @@ -1,3 +1,8 @@ +2003-10-30 Gary Thomas <gary@mlbassoc.com> + + * cdl/hal_arm_sa11x0.cdl: + * src/sa11x0_misc.c: Add support for profiling, using timer #1 + 2003-07-18 Nick Garnett <nickg@balti.calivar.com> * cdl/hal_arm_sa11x0.cdl:
--- a/packages/hal/arm/sa11x0/var/current/cdl/hal_arm_sa11x0.cdl +++ b/packages/hal/arm/sa11x0/var/current/cdl/hal_arm_sa11x0.cdl @@ -62,6 +62,7 @@ cdl_package CYGPKG_HAL_ARM_SA11X0 { implements CYGINT_HAL_ARM_ARCH_STRONGARM implements CYGINT_HAL_VIRTUAL_VECTOR_COMM_BAUD_SUPPORT + implements CYGINT_PROFILE_HAL_TIMER # Let the architectural HAL see this variant's interrupts file - # the SA11x0 has no variation between targets here.
--- a/packages/hal/arm/sa11x0/var/current/src/sa11x0_misc.c +++ b/packages/hal/arm/sa11x0/var/current/src/sa11x0_misc.c @@ -9,6 +9,7 @@ // ------------------------------------------- // This file is part of eCos, the Embedded Configurable Operating System. // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// Copyright (C) 2003 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 @@ -207,6 +208,44 @@ void hal_delay_us(cyg_int32 usecs) val -= 1000000; } } +#ifdef CYGPKG_PROFILE_GPROF +//-------------------------------------------------------------------------- +// +// Profiling support - uses a separate high-speed timer +// + +#include <cyg/hal/hal_arch.h> +#include <cyg/hal/hal_intr.h> +#include <cyg/profile/profile.h> + +// Can't rely on Cyg_Interrupt class being defined. +#define Cyg_InterruptHANDLED 1 + +// Profiling timer ISR +static cyg_uint32 +profile_isr(CYG_ADDRWORD vector, CYG_ADDRWORD data, HAL_SavedRegisters *regs) +{ + HAL_INTERRUPT_ACKNOWLEDGE(CYGNUM_HAL_INTERRUPT_TIMER1); + __profile_hit(regs->pc); + return Cyg_InterruptHANDLED; +} + +void +hal_enable_profile_timer(int resolution) +{ + // Run periodic timer interrupt for profile + // The resolution is specified in us, the hardware generates 3.6864 + // ticks/us + int period = (resolution*36864) / 10000; + + // Attach ISR. + HAL_INTERRUPT_ATTACH(CYGNUM_HAL_INTERRUPT_TIMER1, &profile_isr, 0x1111, 0); + HAL_INTERRUPT_UNMASK(CYGNUM_HAL_INTERRUPT_TIMER1); + + // Set period. + *SA11X0_OSMR1 = period; +} +#endif // -------------------------------------------------------------------------
