[PATCH 033/111] GPTIMER: support separate & shared irq by clearing pending bit after ISR

Daniel Hellstrom daniel at gaisler.com
Thu Feb 26 16:38:35 UTC 2015


---
 c/src/lib/libbsp/sparc/shared/timer/gptimer.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/c/src/lib/libbsp/sparc/shared/timer/gptimer.c b/c/src/lib/libbsp/sparc/shared/timer/gptimer.c
index 2314a3b..6a7e835 100644
--- a/c/src/lib/libbsp/sparc/shared/timer/gptimer.c
+++ b/c/src/lib/libbsp/sparc/shared/timer/gptimer.c
@@ -400,14 +400,16 @@ void gptimer_isr(void *data)
 
 	/* Check all timers for IRQ */
 	for (i=0;i<priv->timer_cnt; i++) {
-		if (gptimer_tlib_int_pend((void *)&priv->timers[i], 1)) {
-			/* IRQ Was generated by Timer and Pending flag has been
-			 * cleared. Call ISR registered
+		if (gptimer_tlib_int_pend((void *)&priv->timers[i], 0)) {
+			/* IRQ Was generated by Timer and Pending flag has *not*
+			 * yet been cleared, this is to allow ISR to look at
+			 * pending bit. Call ISR registered. Clear pending bit.
 			 */
 			if (priv->timers[i].tdev.isr_func) {
 				priv->timers[i].tdev.isr_func(
 					priv->timers[i].tdev.isr_data);
 			}
+			gptimer_tlib_int_pend((void *)&priv->timers[i], 1);
 		}
 	}
 }
-- 
1.7.0.4




More information about the devel mailing list