⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rthal5g-2.4.19.patch

📁 rtai-3.1-test3的源代码(Real-Time Application Interface )
💻 PATCH
📖 第 1 页 / 共 2 页
字号:
+EXPORT_SYMBOL_NOVERS(__Div);+#endif+ /* Platform dependent support */ EXPORT_SYMBOL(dump_thread); EXPORT_SYMBOL(enable_irq);diff -uNrp linux-2.4.19-cris/arch/cris/kernel/time.c linux-2.4.19-cris-rthal/arch/cris/kernel/time.c--- linux-2.4.19-cris/arch/cris/kernel/time.c	2004-01-02 15:40:15.000000000 +0100+++ linux-2.4.19-cris-rthal/arch/cris/kernel/time.c	2004-01-02 12:36:12.000000000 +0100@@ -428,6 +428,35 @@ timer_interrupt(int irq, void *dev_id, s 	} } +#ifdef CONFIG_RTHAL +/*+ * Soft timer interrupt. Called instead of timer_interrupt+ * from linux interrupt dispatcher when RTAI is mounted.+ */+void+soft_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)+{+	/* call the real timer interrupt handler */+	+	do_timer(regs);+	+	/*+	 * If we have an externally synchronized Linux clock, then update+	 * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be+	 * called as close as possible to 500 ms before the new second starts.+	 */+	if ((time_status & STA_UNSYNC) == 0 &&+	    xtime.tv_sec > last_rtc_update + 660 &&+	    xtime.tv_usec > 500000 - (tick >> 1) &&+	    xtime.tv_usec < 500000 + (tick >> 1)) {+		if (set_rtc_mmss(xtime.tv_sec) == 0)+			last_rtc_update = xtime.tv_sec;+		else+			last_rtc_update = xtime.tv_sec - 600;+	}+}+#endif /* CONFIG_RTHAL */+ #if 0 /* some old debug code for testing the microsecond timing of packets */ static unsigned int lastjiff;diff -uNrp linux-2.4.19-cris/arch/cris/mm/fault.c linux-2.4.19-cris-rthal/arch/cris/mm/fault.c--- linux-2.4.19-cris/arch/cris/mm/fault.c	2004-01-02 15:40:15.000000000 +0100+++ linux-2.4.19-cris-rthal/arch/cris/mm/fault.c	2004-01-02 12:36:12.000000000 +0100@@ -282,8 +282,12 @@ do_page_fault(unsigned long address, str 	    !user_mode(regs)) 		goto vmalloc_fault; -	/* we can and should enable interrupts at this point */+/* we can and should enable interrupts at this point */+#ifdef CONFIG_RTHAL+	hard_sti();+#else	 	sti();+#endif  	mm = tsk->mm; 	writeaccess = error_code & 2;diff -uNrp linux-2.4.19-cris/include/asm-cris/irq.h linux-2.4.19-cris-rthal/include/asm-cris/irq.h--- linux-2.4.19-cris/include/asm-cris/irq.h	2002-02-25 20:38:11.000000000 +0100+++ linux-2.4.19-cris-rthal/include/asm-cris/irq.h	2004-01-02 12:36:12.000000000 +0100@@ -92,6 +92,12 @@ extern struct etrax_interrupt_vector *et void set_int_vector(int n, irqvectptr addr, irqvectptr saddr); void set_break_vector(int n, irqvectptr addr); +#ifdef CONFIG_RTHAL+void startup_irq(int n);+void shutdown_irq(int n);+extern struct irqaction *irq_action[NR_IRQS];+#endif+ #define __STR(x) #x #define STR(x) __STR(x)  @@ -131,6 +137,32 @@ void set_break_vector(int n, irqvectptr     * will acknowledge the interrupt is run.    */ +#ifdef CONFIG_RTHAL+#define BUILD_IRQ(nr,mask) \+void IRQ_NAME(nr); \+void sIRQ_NAME(nr); \+void BAD_IRQ_NAME(nr); \+__asm__ ( \+      ".text\n\t" \+      "IRQ" #nr "_interrupt:\n\t" \+	  SAVE_ALL \+	  "sIRQ" #nr "_interrupt:\n\t" /* shortcut for the multiple irq handler */ \+	  BLOCK_IRQ(mask,nr) /* this must be done to prevent irq loops when we ei later */ \+	  "moveq "#nr",$r10\n\t" \+	  "move.d $sp,$r11\n\t" \+	  "jsr [rthal]\n\t" /* irq.c, r10 and r11 are arguments */ \+          "moveq "#nr",$r10\n\t" \+	  "move.d rthal, $r0\n\t" \+	  "jsr [$r0 + 36]\n\t" \+	  "moveq 0,$r9\n\t" /* make ret_from_intr realise we came from an irq */ \+	  "jump ret_from_intr\n\t" \+          "bad_IRQ" #nr "_interrupt:\n\t" \+	  "push $r0\n\t" \+	  BLOCK_IRQ(mask,nr) \+	  "pop $r0\n\t" \+          "reti\n\t" \+          "nop\n");+#else #define BUILD_IRQ(nr,mask) \ void IRQ_NAME(nr); \ void sIRQ_NAME(nr); \@@ -154,6 +186,8 @@ __asm__ ( \           "reti\n\t" \           "nop\n"); +#endif  /* RTHAL */+ /* This is subtle. The timer interrupt is crucial and it should not be disabled for   * too long. However, if it had been a normal interrupt as per BUILD_IRQ, it would  * have been BLOCK'ed, and then softirq's are run before we return here to UNBLOCK.@@ -169,6 +203,29 @@ __asm__ ( \  * be an sti() before the timer irq handler is run to acknowledge the interrupt.  */ +#ifdef CONFIG_RTHAL+#define BUILD_TIMER_IRQ(nr,mask) \+void IRQ_NAME(nr); \+void sIRQ_NAME(nr); \+void BAD_IRQ_NAME(nr); \+__asm__ ( \+          ".text\n\t" \+          "IRQ" #nr "_interrupt:\n\t" \+	  SAVE_ALL \+	  "sIRQ" #nr "_interrupt:\n\t" /* shortcut for the multiple irq handler */ \+	  "moveq "#nr",$r10\n\t" \+	  "move.d $sp,$r11\n\t" \+          "move.d rthal, $r0\n\t" \+	  "jsr [$r0+4]\n\t" \+          "moveq 0,$r9\n\t" /* make ret_from_intr realise we came from an irq */ \+	  "jump ret_from_intr\n\t" \+          "bad_IRQ" #nr "_interrupt:\n\t" \+	  "push $r0\n\t" \+	  BLOCK_IRQ(mask,nr) \+	  "pop $r0\n\t" \+          "reti\n\t" \+          "nop\n");+#else #define BUILD_TIMER_IRQ(nr,mask) \ void IRQ_NAME(nr); \ void sIRQ_NAME(nr); \@@ -190,6 +247,8 @@ __asm__ ( \           "reti\n\t" \           "nop\n"); +#endif  /* CONFIG_RTHAL */+ #endif  /* _ASM_IRQ_H */  diff -uNrp linux-2.4.19-cris/include/asm-cris/system.h linux-2.4.19-cris-rthal/include/asm-cris/system.h--- linux-2.4.19-cris/include/asm-cris/system.h	2002-08-03 02:39:45.000000000 +0200+++ linux-2.4.19-cris-rthal/include/asm-cris/system.h	2004-01-02 12:36:12.000000000 +0100@@ -54,6 +54,50 @@ static inline unsigned long _get_base(ch struct __xchg_dummy { unsigned long a[100]; }; #define __xg(x) ((struct __xchg_dummy *)(x)) +#ifdef CONFIG_RTHAL++/* includes pt_regs needed in rt_hal */+#include <asm/ptrace.h>++#define hard_save_flags(x) __asm__ __volatile__    ("move $ccr,%0" : "=rm" (x) :          : "memory");+#define hard_restore_flags(x) __asm__ __volatile__ ("move %0,$ccr" :           : "rm" (x) : "memory");+#define hard_cli() __asm__ __volatile__            ( "di"          :           :          : "memory");+#define hard_sti() __asm__ __volatile__            ( "ei"          :           :          : "memory");+#define hard_save_flags_cli(x) do { hard_save_flags(x); hard_cli(); } while (0) ++#define cli() __cli()+#define sti() __sti()+#define save_flags(x) __save_flags(x)+#define restore_flags(x) __restore_flags(x)+#define save_and_cli(x) do { __save_flags(x); cli(); } while(0)+struct rt_hal {+	void (*do_IRQ) (int, struct pt_regs*);      /*  0 */+	void (*do_timer_IRQ)(int, struct pt_regs*); /*  4 */+	long long (*do_SRQ) (int, unsigned long);   /*  8 */+	void (*disint)(void);                       /* 12 */+	void (*enint)(void);                        /* 16 */+	unsigned long (*getflags)(void);            /* 20 */+	void (*setflags)(unsigned long);            /* 24 */+	unsigned long (*getflags_and_cli)(void);    /* 28 */+	void (*ei_if_rtai)(void);                   /* 32 */+	void (*unmask_if_not_rtai)(unsigned int);   /* 36 */+};++extern struct rt_hal rthal;+ +#define __cli()		(rthal.disint())+#define __sti()		(rthal.enint())+#define __save_flags(x)	((x) = rthal.getflags())+#define __restore_flags(x)	(rthal.setflags(x))++/* For spinlocks etc */+#define local_irq_save(x)	((x) = rthal.getflags_and_cli())+#define local_irq_restore(x)	(rthal.setflags(x))+#define local_irq_disable()	(rthal.disint())+#define local_irq_enable()	(rthal.enint())++#else+ #if 0 /* use these and an oscilloscope to see the fraction of time we're running with IRQ's disabled */ /* it assumes the LED's are on port 0x90000000 of course. */@@ -82,6 +126,8 @@ struct __xchg_dummy { unsigned long a[10 #define restore_flags(x) __restore_flags(x) #define save_and_cli(x) do { __save_flags(x); cli(); } while(0) +#endif  /* CONFIG_RTHAL */+ static inline unsigned long __xchg(unsigned long x, void * ptr, int size) {   /* since Etrax doesn't have any atomic xchg instructions, we need to disablediff -uNrp linux-2.4.19-cris/include/linux/timex.h linux-2.4.19-cris-rthal/include/linux/timex.h--- linux-2.4.19-cris/include/linux/timex.h	2001-11-22 20:46:18.000000000 +0100+++ linux-2.4.19-cris-rthal/include/linux/timex.h	2004-01-02 15:03:03.000000000 +0100@@ -151,8 +151,12 @@  */ #include <asm/timex.h> +#ifdef CONFIG_ETRAX_DISABLE_CASCADED_TIMERS_IN_RTAI /* LATCH is used in the interval timer and ftape setup. */ #define LATCH  ((CLOCK_TICK_RATE + HZ/2) / HZ)	/* For divider */+#else /* !CONFIG_ETRAX_DISABLE_CASCADED_TIMERS_IN_RTAI */+#define LATCH 62500+#endif /* CONFIG_ETRAX_DISABLE_CASCADED_TIMERS_IN_RTAI */  /*  * syscall interface - used (mainly by NTP daemon)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -