This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gprof update - sa11x0 HAL support


Adjust the SA11x0 profile timer support to match the updated generic
gprof package.

Bart

Index: hal/arm/sa11x0/var/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/sa11x0/var/current/ChangeLog,v
retrieving revision 1.26
diff -u -r1.26 ChangeLog
--- hal/arm/sa11x0/var/current/ChangeLog	5 Dec 2003 09:56:57 -0000	1.26
+++ hal/arm/sa11x0/var/current/ChangeLog	21 Mar 2005 14:10:00 -0000
@@ -1,3 +1,10 @@
+2004-02-08  Bart Veer  <bartv@ecoscentric.com>
+
+	* src/sa11x0_misc.c (hal_enable_profile_timer): 
+	Update this function to return the actual resolution, as 
+	required by the updated gprof package. Make the profiling
+	actually work.
+
 2003-12-05  Andrew Lunn  <andrew.lunn@ascom.ch>
 
 	* include/hal_diag.h: hal_delay_us() is a C function.
Index: hal/arm/sa11x0/var/current/src/sa11x0_misc.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/sa11x0/var/current/src/sa11x0_misc.c,v
retrieving revision 1.10
diff -u -r1.10 sa11x0_misc.c
--- hal/arm/sa11x0/var/current/src/sa11x0_misc.c	30 Oct 2003 14:12:56 -0000	1.10
+++ hal/arm/sa11x0/var/current/src/sa11x0_misc.c	21 Mar 2005 14:11:18 -0000
@@ -221,29 +221,38 @@
 // Can't rely on Cyg_Interrupt class being defined.
 #define Cyg_InterruptHANDLED 1
 
+static int  profile_period  = 0;
+
 // Profiling timer ISR
 static cyg_uint32 
 profile_isr(CYG_ADDRWORD vector, CYG_ADDRWORD data, HAL_SavedRegisters *regs)
 {
+    // Load new match value
+    *SA11X0_OSMR1 = *SA11X0_OSCR + profile_period;
+    // Clear any pending interrupt
+    *SA11X0_OSSR = SA11X0_OSSR_TIMER1;
     HAL_INTERRUPT_ACKNOWLEDGE(CYGNUM_HAL_INTERRUPT_TIMER1);
     __profile_hit(regs->pc);
     return Cyg_InterruptHANDLED;
 }
 
-void
+int
 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;
+    profile_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;
+    // Set period and enable timer interrupts
+    *SA11X0_OSMR1 = *SA11X0_OSCR + profile_period;
+    *SA11X0_OIER |= SA11X0_OIER_TIMER1;
+
+    return resolution;
 }
 #endif
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]