Skip to contentSkip to conversation

Handling of null delay in asm/hal.h

Xenomai-core Applied Gilles Chanteperdrix 2 participants 2 messages Aug 18, 2006

lore
Share & tools
lore
#0 lore raw

Hi,

at some point in time, we decided to trigger directly the timer irq when called on x86 to program a null delay. Attached a patch which does the same for all other architectures.

Signature · 1 line
					    Gilles Chanteperdrix.
asm-arm/hal.h +3 -2
Index: include/asm-arm/hal.h
===================================================================
@@ -104,8 +104,9 @@
 static inline void rthal_timer_program_shot (unsigned long delay)
 {
     if(!delay)
-        delay = 10;
-    __ipipe_mach_set_dec(delay);
+	rthal_trigger_irq(RTHAL_TIMER_IRQ);
+    else
+	__ipipe_mach_set_dec(delay);
 }
 
     /* Private interface -- Internal use only */
asm-blackfin/hal.h +8 -5
Index: include/asm-blackfin/hal.h
===================================================================
@@ -61,11 +61,14 @@
 
 static inline void rthal_timer_program_shot (unsigned long delay)
 {
-    if (delay < 2) delay = 10;
-    *pTCOUNT = delay - 1;
-    __builtin_bfin_csync();
-    *pTCNTL = 3; /* Oneshot mode, no auto-reload. */
-    __builtin_bfin_csync();
+    if (delay < 2)
+	rthal_trigger_irq(RTHAL_TIMER_IRQ);
+    else {
+	*pTCOUNT = delay - 1;
+	__builtin_bfin_csync();
+	*pTCNTL = 3; /* Oneshot mode, no auto-reload. */
+	__builtin_bfin_csync();
+    }
 }
 
     /* Private interface -- Internal use only */
asm-ia64/hal.h +4 -2
Index: include/asm-ia64/hal.h
===================================================================
@@ -72,8 +72,10 @@
 
     rthal_local_irq_save_hw(flags);
 #endif /* CONFIG_XENO_OPT_PIPELINE_HEAD */
-    if (!delay) { delay = 10; }
-    ia64_set_itm(ia64_get_itc() + delay);
+    if (!delay)
+	rthal_trigger_irq(RTHAL_TIMER_IRQ);
+    else
+	ia64_set_itm(ia64_get_itc() + delay);
 #ifndef CONFIG_XENO_OPT_PIPELINE_HEAD
     rthal_local_irq_restore_hw(flags);
 #endif /* CONFIG_XENO_OPT_PIPELINE_HEAD */
asm-powerpc/hal.h +4 -3
Index: include/asm-powerpc/hal.h
===================================================================
@@ -73,11 +73,12 @@
 static inline void rthal_timer_program_shot(unsigned long delay)
 {
 	if (!delay)
-		delay = 1;
+		rthal_trigger_irq(RTHAL_TIMER_IRQ);
+	else
 #ifdef CONFIG_40x
-	mtspr(SPRN_PIT, delay);
+		mtspr(SPRN_PIT, delay);
 #else /* !CONFIG_40x */
-	set_dec((int)delay);	/* decrementer is only 32-bits */
+	        set_dec((int)delay);	/* decrementer is only 32-bits */
 #endif /* CONFIG_40x */
 }
 
#1 lore raw
Quoted 6 lines · Gilles Chanteperdrix

Hi,

at some point in time, we decided to trigger directly the timer irq when called on x86 to program a null delay. Attached a patch which does the same for all other architectures.

Applied, thanks.

Quoted 82 lines

plain text document attachment (xeno-trigger-irq-on-null-delay.patch)
Index: include/asm-arm/hal.h
===================================================================

asm-arm/hal.h +3 -2
@@ -104,8 +104,9 @@
 static inline void rthal_timer_program_shot (unsigned long delay)
 {
     if(!delay)
-        delay = 10;
-    __ipipe_mach_set_dec(delay);
+	rthal_trigger_irq(RTHAL_TIMER_IRQ);
+    else
+	__ipipe_mach_set_dec(delay);
 }
 
     /* Private interface -- Internal use only */

Index: include/asm-blackfin/hal.h
===================================================================

asm-blackfin/hal.h +8 -5
@@ -61,11 +61,14 @@
 
 static inline void rthal_timer_program_shot (unsigned long delay)
 {
-    if (delay < 2) delay = 10;
-    *pTCOUNT = delay - 1;
-    __builtin_bfin_csync();
-    *pTCNTL = 3; /* Oneshot mode, no auto-reload. */
-    __builtin_bfin_csync();
+    if (delay < 2)
+	rthal_trigger_irq(RTHAL_TIMER_IRQ);
+    else {
+	*pTCOUNT = delay - 1;
+	__builtin_bfin_csync();
+	*pTCNTL = 3; /* Oneshot mode, no auto-reload. */
+	__builtin_bfin_csync();
+    }
 }
 
     /* Private interface -- Internal use only */

Index: include/asm-ia64/hal.h
===================================================================

asm-ia64/hal.h +4 -2
@@ -72,8 +72,10 @@
 
     rthal_local_irq_save_hw(flags);
 #endif /* CONFIG_XENO_OPT_PIPELINE_HEAD */
-    if (!delay) { delay = 10; }
-    ia64_set_itm(ia64_get_itc() + delay);
+    if (!delay)
+	rthal_trigger_irq(RTHAL_TIMER_IRQ);
+    else
+	ia64_set_itm(ia64_get_itc() + delay);
 #ifndef CONFIG_XENO_OPT_PIPELINE_HEAD
     rthal_local_irq_restore_hw(flags);
 #endif /* CONFIG_XENO_OPT_PIPELINE_HEAD */

Index: include/asm-powerpc/hal.h
===================================================================

asm-powerpc/hal.h +4 -3
@@ -73,11 +73,12 @@
 static inline void rthal_timer_program_shot(unsigned long delay)
 {
 	if (!delay)
-		delay = 1;
+		rthal_trigger_irq(RTHAL_TIMER_IRQ);
+	else
 #ifdef CONFIG_40x
-	mtspr(SPRN_PIT, delay);
+		mtspr(SPRN_PIT, delay);
 #else /* !CONFIG_40x */
-	set_dec((int)delay);	/* decrementer is only 32-bits */
+	        set_dec((int)delay);	/* decrementer is only 32-bits */
 #endif /* CONFIG_40x */
 }
 

_______________________________________________
Xenomai-core mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-core

Signature · 1 line
Philippe.