public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] AT91: fiq patch
@ 2004-09-15 17:19 Andrea Michelotti
  2004-09-16  8:02 ` [ECOS] " Andrew Lunn
  0 siblings, 1 reply; 4+ messages in thread
From: Andrea Michelotti @ 2004-09-15 17:19 UTC (permalink / raw)
  To: Andrew Lunn, Nick Garnett; +Cc: ecos-discuss

[-- Attachment #1: Type: text/plain, Size: 262 bytes --]

Hi all,
I corrected the patch as Andrew suggested.
I kept my spurious interrupt detection because I think is more correct and
quick than
the actual one, as explained in my previous mail.

best regards

Andrea.
--------------------
Andrea Michelotti -
ATMEL Rome

[-- Attachment #2: at91_fiq.patch --]
[-- Type: application/octet-stream, Size: 7472 bytes --]

Index: var/current/cdl/hal_arm_at91.cdl
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/at91/var/current/cdl/hal_arm_at91.cdl,v
retrieving revision 1.7
diff -u -5 -p -r1.7 hal_arm_at91.cdl
--- var/current/cdl/hal_arm_at91.cdl	13 Sep 2004 09:56:40 -0000	1.7
+++ var/current/cdl/hal_arm_at91.cdl	15 Sep 2004 17:07:44 -0000
@@ -83,6 +83,17 @@ cdl_package CYGPKG_HAL_ARM_AT91 {
                         the main differences being the amount of on-chip SRAM,
                         peripherals and their layout. This option allows the
                         platform HALs to select the specific microcontroller
                         being used."
     }
+
+   cdl_option CYGHWR_HAL_ARM_AT91_FIQ {
+        display       "handle FIQ as IRQ"
+        flavor        bool
+        default_value 0
+        description   "
+            Enable this option if you need a default way to handle FIQ interrupts,
+	    FIQs will be treated as IRQs with the highest priority"
+
+    }
+
 }
Index: var/current/include/var_io.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/at91/var/current/include/var_io.h,v
retrieving revision 1.7
diff -u -5 -p -r1.7 var_io.h
--- var/current/include/var_io.h	24 May 2004 08:41:47 -0000	1.7
+++ var/current/include/var_io.h	15 Sep 2004 17:07:45 -0000
@@ -638,8 +638,12 @@
 #define AT91_WD_CR_RSTKEY   0x0000C071
 #define AT91_WD_SR          0x0C
 #define AT91_WD_SR_WDOVF    0x00000001
 
 
+//=============================================================================
+// FIQ interrupt line
+
+#define CYGNUM_HAL_INTERRUPT_FIQ 0
 //-----------------------------------------------------------------------------
 // end of var_io.h
 #endif // CYGONCE_HAL_VAR_IO_H
Index: var/current/src/at91_misc.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/at91/var/current/src/at91_misc.c,v
retrieving revision 1.8
diff -u -5 -p -r1.8 at91_misc.c
--- var/current/src/at91_misc.c	12 Aug 2004 13:02:24 -0000	1.8
+++ var/current/src/at91_misc.c	15 Sep 2004 17:07:46 -0000
@@ -178,18 +178,28 @@ void hal_hardware_init(void)
 
 int hal_IRQ_handler(void)
 {
     cyg_uint32 irq_num;
     cyg_uint32 ivr;
-    
+#ifdef CYGHWR_HAL_ARM_AT91_FIQ
+    // handle fiq interrupts as irq 
+    cyg_uint32 ipr,imr;
+    HAL_READ_UINT32(AT91_AIC+AT91_AIC_IPR, ipr);
+    HAL_READ_UINT32(AT91_AIC+AT91_AIC_IMR, imr);
+    if(imr & ipr & (1<<CYGNUM_HAL_INTERRUPT_FIQ)){
+      HAL_WRITE_UINT32(AT91_AIC+AT91_AIC_ICCR, (1<<CYGNUM_HAL_INTERRUPT_FIQ));
+      return CYGNUM_HAL_INTERRUPT_FIQ;
+    }
+#endif
     // Calculate active interrupt (updates ISR)
     HAL_READ_UINT32(AT91_AIC+AT91_AIC_IVR, ivr);
 
     HAL_READ_UINT32(AT91_AIC+AT91_AIC_ISR, irq_num);
-
+    
     // No valid interrrupt source, treat as spurious interrupt    
-    if (irq_num < CYGNUM_HAL_ISR_MIN || irq_num > CYGNUM_HAL_ISR_MAX)
+    // ISR return > 0 in case of valid IRQ, otherwise is spurious
+    if (irq_num == 0)
       irq_num = CYGNUM_HAL_INTERRUPT_NONE;
     
     return irq_num;
 }
 
Index: eb40/current/include/hal_platform_ints.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/at91/eb40/current/include/hal_platform_ints.h,v
retrieving revision 1.2
diff -u -5 -p -r1.2 hal_platform_ints.h
--- eb40/current/include/hal_platform_ints.h	15 Jul 2003 01:54:44 -0000	1.2
+++ eb40/current/include/hal_platform_ints.h	15 Sep 2004 17:07:46 -0000
@@ -66,11 +66,16 @@
 #define CYGNUM_HAL_INTERRUPT_PIO               8
 #define CYGNUM_HAL_INTERRUPT_EXT0              16
 #define CYGNUM_HAL_INTERRUPT_EXT1              17
 #define CYGNUM_HAL_INTERRUPT_EXT2              18
 
+#ifdef CYGHWR_HAL_ARM_AT91_FIQ
+#define CYGNUM_HAL_ISR_MIN                     0
+#else
 #define CYGNUM_HAL_ISR_MIN                     2
+#endif
+
 #define CYGNUM_HAL_ISR_MAX                     18
 // Note: extra slots (0,1) to avoid messing with vector translation
 #define CYGNUM_HAL_ISR_COUNT                   (CYGNUM_HAL_ISR_MAX + 1)
 
 // The vector used by the Real time clock
Index: eb40a/current/include/hal_platform_ints.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/at91/eb40a/current/include/hal_platform_ints.h,v
retrieving revision 1.2
diff -u -5 -p -r1.2 hal_platform_ints.h
--- eb40a/current/include/hal_platform_ints.h	15 Jul 2003 01:54:44 -0000	1.2
+++ eb40a/current/include/hal_platform_ints.h	15 Sep 2004 17:07:46 -0000
@@ -66,11 +66,16 @@
 #define CYGNUM_HAL_INTERRUPT_PIO               8
 #define CYGNUM_HAL_INTERRUPT_EXT0              16
 #define CYGNUM_HAL_INTERRUPT_EXT1              17
 #define CYGNUM_HAL_INTERRUPT_EXT2              18
 
+#ifdef CYGHWR_HAL_ARM_AT91_FIQ
+#define CYGNUM_HAL_ISR_MIN                     0
+#else
 #define CYGNUM_HAL_ISR_MIN                     2
+#endif
+
 #define CYGNUM_HAL_ISR_MAX                     18
 // Note: extra slots (0,1) to avoid messing with vector translation
 #define CYGNUM_HAL_ISR_COUNT                   (CYGNUM_HAL_ISR_MAX + 1)
 
 // The vector used by the Real time clock
Index: eb42/current/include/hal_platform_ints.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/at91/eb42/current/include/hal_platform_ints.h,v
retrieving revision 1.2
diff -u -5 -p -r1.2 hal_platform_ints.h
--- eb42/current/include/hal_platform_ints.h	15 Jul 2003 01:54:45 -0000	1.2
+++ eb42/current/include/hal_platform_ints.h	15 Sep 2004 17:07:46 -0000
@@ -76,11 +76,16 @@
 #define CYGNUM_HAL_INTERRUPT_EXT3              28
 #define CYGNUM_HAL_INTERRUPT_EXT2              29
 #define CYGNUM_HAL_INTERRUPT_EXT1              30
 #define CYGNUM_HAL_INTERRUPT_EXT0              31
 
+#ifdef CYGHWR_HAL_ARM_AT91_FIQ
+#define CYGNUM_HAL_ISR_MIN                     0
+#else
 #define CYGNUM_HAL_ISR_MIN                     2
+#endif
+
 #define CYGNUM_HAL_ISR_MAX                     31
 // Note: extra slots (0,1) to avoid messing with vector translation
 #define CYGNUM_HAL_ISR_COUNT                   (CYGNUM_HAL_ISR_MAX + 1)
 
 // The vector used by the Real time clock
Index: eb55/current/include/hal_platform_ints.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/at91/eb55/current/include/hal_platform_ints.h,v
retrieving revision 1.2
diff -u -5 -p -r1.2 hal_platform_ints.h
--- eb55/current/include/hal_platform_ints.h	15 Jul 2003 01:54:45 -0000	1.2
+++ eb55/current/include/hal_platform_ints.h	15 Sep 2004 17:07:47 -0000
@@ -87,12 +87,16 @@
 #define CYGNUM_HAL_INTERRUPT_EXT1               28
 #define CYGNUM_HAL_INTERRUPT_EXT0               29
 #define CYGNUM_HAL_INTERRUPT_COMMRX             30
 #define CYGNUM_HAL_INTERRUPT_COMMTX             31
 
-
+#ifdef CYGHWR_HAL_ARM_AT91_FIQ
+#define CYGNUM_HAL_ISR_MIN                     0
+#else
 #define CYGNUM_HAL_ISR_MIN                     2
+#endif
+
 #define CYGNUM_HAL_ISR_MAX                     31
 // Note: extra slots (0,1) to avoid messing with vector translation
 #define CYGNUM_HAL_ISR_COUNT                   (CYGNUM_HAL_ISR_MAX + 1)
 
 // The vector used by the Real time clock


[-- Attachment #3: Type: text/plain, Size: 148 bytes --]

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ECOS] Re: AT91: fiq patch
  2004-09-15 17:19 [ECOS] AT91: fiq patch Andrea Michelotti
@ 2004-09-16  8:02 ` Andrew Lunn
  2004-09-16  8:37   ` [ECOS] " Andrea Michelotti
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Lunn @ 2004-09-16  8:02 UTC (permalink / raw)
  To: Andrea Michelotti; +Cc: Andrew Lunn, Nick Garnett, ecos-discuss

On Wed, Sep 15, 2004 at 07:23:49PM +0200, Andrea Michelotti wrote:
> Hi all,
> I corrected the patch as Andrew suggested.

Its just missing ChangeLog entries now...

> I kept my spurious interrupt detection because I think is more correct and
> quick than the actual one, as explained in my previous mail.

I thought about this some more. I prefer to keep the check as it
was. eCos will have an array of interrupt handlers. If for some reason
the interrupts control returns a value outside of the handled range of
interrupts, its going to access outside of the bounds of the array to
some psuedo random data to get the address of the interrupt handler
and jump off into oblivion. Such problems are very difficult to find
since they are generally hard to reproduce and have nothing to do with
the flow of code currently running. The check means that it will at
least do something controlled and give the programmer some hope of
finding whats wrong.

        Andrew

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ECOS] AT91: fiq  patch
  2004-09-16  8:02 ` [ECOS] " Andrew Lunn
@ 2004-09-16  8:37   ` Andrea Michelotti
  2004-09-16 12:15     ` Andrew Lunn
  0 siblings, 1 reply; 4+ messages in thread
From: Andrea Michelotti @ 2004-09-16  8:37 UTC (permalink / raw)
  To: Andrew Lunn; +Cc: Nick Garnett, ecos-discuss

[-- Attachment #1: Type: text/plain, Size: 968 bytes --]

Hi Andrew,
here's the patch corrected as you suggested and with Changelogs.
thanks.
Andrea.
>
> Its just missing ChangeLog entries now...
>
> > I kept my spurious interrupt detection because I think is more correct
and
> > quick than the actual one, as explained in my previous mail.
>
> I thought about this some more. I prefer to keep the check as it
> was. eCos will have an array of interrupt handlers. If for some reason
> the interrupts control returns a value outside of the handled range of
> interrupts, its going to access outside of the bounds of the array to
> some psuedo random data to get the address of the interrupt handler
> and jump off into oblivion. Such problems are very difficult to find
> since they are generally hard to reproduce and have nothing to do with
> the flow of code currently running. The check means that it will at
> least do something controlled and give the programmer some hope of
> finding whats wrong.
>
>         Andrew
>

[-- Attachment #2: at91_fiq.patch --]
[-- Type: application/octet-stream, Size: 10882 bytes --]

Index: var/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/at91/var/current/ChangeLog,v
retrieving revision 1.20
diff -u -5 -p -r1.20 ChangeLog
--- var/current/ChangeLog	13 Sep 2004 09:56:39 -0000	1.20
+++ var/current/ChangeLog	16 Sep 2004 08:28:59 -0000
@@ -1,5 +1,12 @@
+2004-09-16  Andrea Michelotti <amichelotti@atmel.com>
+
+	* cdl/hal_arm_at91.cdl (CYGHWR_HAL_ARM_AT91_FIQ): to handle FIQ as 
+	highest priority IRQ.
+	* src/at91_misc.c : handling of FIQ if CYGHWR_HAL_ARM_AT91_FIQ
+	* include/var_io.h: added CYGNUM_HAL_INTERRUPT_FIQ define
+	
 2004-08-30  Thomas Koeller <thomas.koeller@baslerweb.com>
 
 	* cdl/hal_arm_at91.cdl: Reversed change of 2004-02-12 that move
 	seemingly 'common' options from the platform to the variant. This
 	was breaking some platform HALs.
Index: var/current/cdl/hal_arm_at91.cdl
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/at91/var/current/cdl/hal_arm_at91.cdl,v
retrieving revision 1.7
diff -u -5 -p -r1.7 hal_arm_at91.cdl
--- var/current/cdl/hal_arm_at91.cdl	13 Sep 2004 09:56:40 -0000	1.7
+++ var/current/cdl/hal_arm_at91.cdl	16 Sep 2004 08:28:59 -0000
@@ -83,6 +83,17 @@ cdl_package CYGPKG_HAL_ARM_AT91 {
                         the main differences being the amount of on-chip SRAM,
                         peripherals and their layout. This option allows the
                         platform HALs to select the specific microcontroller
                         being used."
     }
+
+   cdl_option CYGHWR_HAL_ARM_AT91_FIQ {
+        display       "handle FIQ as IRQ"
+        flavor        bool
+        default_value 0
+        description   "
+            Enable this option if you need a default way to handle FIQ interrupts,
+	    FIQs will be treated as IRQs with the highest priority"
+
+    }
+
 }
Index: var/current/include/var_io.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/at91/var/current/include/var_io.h,v
retrieving revision 1.7
diff -u -5 -p -r1.7 var_io.h
--- var/current/include/var_io.h	24 May 2004 08:41:47 -0000	1.7
+++ var/current/include/var_io.h	16 Sep 2004 08:29:00 -0000
@@ -638,8 +638,12 @@
 #define AT91_WD_CR_RSTKEY   0x0000C071
 #define AT91_WD_SR          0x0C
 #define AT91_WD_SR_WDOVF    0x00000001
 
 
+//=============================================================================
+// FIQ interrupt line
+
+#define CYGNUM_HAL_INTERRUPT_FIQ 0
 //-----------------------------------------------------------------------------
 // end of var_io.h
 #endif // CYGONCE_HAL_VAR_IO_H
Index: var/current/src/at91_misc.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/at91/var/current/src/at91_misc.c,v
retrieving revision 1.8
diff -u -5 -p -r1.8 at91_misc.c
--- var/current/src/at91_misc.c	12 Aug 2004 13:02:24 -0000	1.8
+++ var/current/src/at91_misc.c	16 Sep 2004 08:29:00 -0000
@@ -178,11 +178,20 @@ void hal_hardware_init(void)
 
 int hal_IRQ_handler(void)
 {
     cyg_uint32 irq_num;
     cyg_uint32 ivr;
-    
+#ifdef CYGHWR_HAL_ARM_AT91_FIQ
+    // handle fiq interrupts as irq 
+    cyg_uint32 ipr,imr;
+    HAL_READ_UINT32(AT91_AIC+AT91_AIC_IPR, ipr);
+    HAL_READ_UINT32(AT91_AIC+AT91_AIC_IMR, imr);
+    if(imr & ipr & (1<<CYGNUM_HAL_INTERRUPT_FIQ)){
+      HAL_WRITE_UINT32(AT91_AIC+AT91_AIC_ICCR, (1<<CYGNUM_HAL_INTERRUPT_FIQ));
+      return CYGNUM_HAL_INTERRUPT_FIQ;
+    }
+#endif
     // Calculate active interrupt (updates ISR)
     HAL_READ_UINT32(AT91_AIC+AT91_AIC_IVR, ivr);
 
     HAL_READ_UINT32(AT91_AIC+AT91_AIC_ISR, irq_num);
 
Index: eb40/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/at91/eb40/current/ChangeLog,v
retrieving revision 1.7
diff -u -5 -p -r1.7 ChangeLog
--- eb40/current/ChangeLog	13 Sep 2004 09:56:36 -0000	1.7
+++ eb40/current/ChangeLog	16 Sep 2004 08:29:00 -0000
@@ -1,5 +1,9 @@
+2004-09-16  Andrea Michelotti <amichelotti@atmel.com>
+	* include/hal_platform_ints.h: CYGNUM_HAL_ISR_MIN equal to zero if
+	defined CYGHWR_HAL_ARM_AT91_FIQ
+	
 2004-08-30  Thomas Koeller <thomas.koeller@baslerweb.com>
 
 	* cdl//hal_arm_at91_eb42.cdl: Undid last change. These
 	options are not really common among all platforms.
 
Index: eb40/current/include/hal_platform_ints.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/at91/eb40/current/include/hal_platform_ints.h,v
retrieving revision 1.2
diff -u -5 -p -r1.2 hal_platform_ints.h
--- eb40/current/include/hal_platform_ints.h	15 Jul 2003 01:54:44 -0000	1.2
+++ eb40/current/include/hal_platform_ints.h	16 Sep 2004 08:29:00 -0000
@@ -66,11 +66,16 @@
 #define CYGNUM_HAL_INTERRUPT_PIO               8
 #define CYGNUM_HAL_INTERRUPT_EXT0              16
 #define CYGNUM_HAL_INTERRUPT_EXT1              17
 #define CYGNUM_HAL_INTERRUPT_EXT2              18
 
+#ifdef CYGHWR_HAL_ARM_AT91_FIQ
+#define CYGNUM_HAL_ISR_MIN                     0
+#else
 #define CYGNUM_HAL_ISR_MIN                     2
+#endif
+
 #define CYGNUM_HAL_ISR_MAX                     18
 // Note: extra slots (0,1) to avoid messing with vector translation
 #define CYGNUM_HAL_ISR_COUNT                   (CYGNUM_HAL_ISR_MAX + 1)
 
 // The vector used by the Real time clock
Index: eb40a/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/at91/eb40a/current/ChangeLog,v
retrieving revision 1.7
diff -u -5 -p -r1.7 ChangeLog
--- eb40a/current/ChangeLog	13 Sep 2004 09:56:37 -0000	1.7
+++ eb40a/current/ChangeLog	16 Sep 2004 08:29:01 -0000
@@ -1,5 +1,9 @@
+2004-09-16  Andrea Michelotti <amichelotti@atmel.com>
+	* include/hal_platform_ints.h: CYGNUM_HAL_ISR_MIN equal to zero if
+	defined CYGHWR_HAL_ARM_AT91_FIQ
+
 2004-08-30  Thomas Koeller <thomas.koeller@baslerweb.com>
 
 	* cdl//hal_arm_at91_eb42.cdl: Undid last change. These
 	options are not really common among all platforms.
 
Index: eb40a/current/include/hal_platform_ints.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/at91/eb40a/current/include/hal_platform_ints.h,v
retrieving revision 1.2
diff -u -5 -p -r1.2 hal_platform_ints.h
--- eb40a/current/include/hal_platform_ints.h	15 Jul 2003 01:54:44 -0000	1.2
+++ eb40a/current/include/hal_platform_ints.h	16 Sep 2004 08:29:01 -0000
@@ -66,11 +66,16 @@
 #define CYGNUM_HAL_INTERRUPT_PIO               8
 #define CYGNUM_HAL_INTERRUPT_EXT0              16
 #define CYGNUM_HAL_INTERRUPT_EXT1              17
 #define CYGNUM_HAL_INTERRUPT_EXT2              18
 
+#ifdef CYGHWR_HAL_ARM_AT91_FIQ
+#define CYGNUM_HAL_ISR_MIN                     0
+#else
 #define CYGNUM_HAL_ISR_MIN                     2
+#endif
+
 #define CYGNUM_HAL_ISR_MAX                     18
 // Note: extra slots (0,1) to avoid messing with vector translation
 #define CYGNUM_HAL_ISR_COUNT                   (CYGNUM_HAL_ISR_MAX + 1)
 
 // The vector used by the Real time clock
Index: eb42/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/at91/eb42/current/ChangeLog,v
retrieving revision 1.6
diff -u -5 -p -r1.6 ChangeLog
--- eb42/current/ChangeLog	13 Sep 2004 09:56:39 -0000	1.6
+++ eb42/current/ChangeLog	16 Sep 2004 08:29:01 -0000
@@ -1,5 +1,9 @@
+2004-09-16  Andrea Michelotti <amichelotti@atmel.com>
+	* include/hal_platform_ints.h: CYGNUM_HAL_ISR_MIN equal to zero if
+	defined CYGHWR_HAL_ARM_AT91_FIQ
+	
 2004-08-30  Thomas Koeller <thomas.koeller@baslerweb.com>
 
 	* cdl//hal_arm_at91_eb42.cdl: Undid last change. These
 	options are not really common among all platforms.
 
Index: eb42/current/include/hal_platform_ints.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/at91/eb42/current/include/hal_platform_ints.h,v
retrieving revision 1.2
diff -u -5 -p -r1.2 hal_platform_ints.h
--- eb42/current/include/hal_platform_ints.h	15 Jul 2003 01:54:45 -0000	1.2
+++ eb42/current/include/hal_platform_ints.h	16 Sep 2004 08:29:01 -0000
@@ -76,11 +76,16 @@
 #define CYGNUM_HAL_INTERRUPT_EXT3              28
 #define CYGNUM_HAL_INTERRUPT_EXT2              29
 #define CYGNUM_HAL_INTERRUPT_EXT1              30
 #define CYGNUM_HAL_INTERRUPT_EXT0              31
 
+#ifdef CYGHWR_HAL_ARM_AT91_FIQ
+#define CYGNUM_HAL_ISR_MIN                     0
+#else
 #define CYGNUM_HAL_ISR_MIN                     2
+#endif
+
 #define CYGNUM_HAL_ISR_MAX                     31
 // Note: extra slots (0,1) to avoid messing with vector translation
 #define CYGNUM_HAL_ISR_COUNT                   (CYGNUM_HAL_ISR_MAX + 1)
 
 // The vector used by the Real time clock
Index: eb55/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/at91/eb55/current/ChangeLog,v
retrieving revision 1.7
diff -u -5 -p -r1.7 ChangeLog
--- eb55/current/ChangeLog	13 Sep 2004 09:56:39 -0000	1.7
+++ eb55/current/ChangeLog	16 Sep 2004 08:29:01 -0000
@@ -1,5 +1,9 @@
+2004-09-16  Andrea Michelotti <amichelotti@atmel.com>
+	* include/hal_platform_ints.h: CYGNUM_HAL_ISR_MIN equal to zero if
+	defined CYGHWR_HAL_ARM_AT91_FIQ
+
 2004-08-30  Thomas Koeller  <thomas.koeller@baslerweb.com>
 
 	* cdl/hal_arm_at91_eb55.cdl: Reversed change of 2004-02-12.
 	The options moved to the variant hal were not truly common
 	amoung all platforms.
Index: eb55/current/include/hal_platform_ints.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/at91/eb55/current/include/hal_platform_ints.h,v
retrieving revision 1.2
diff -u -5 -p -r1.2 hal_platform_ints.h
--- eb55/current/include/hal_platform_ints.h	15 Jul 2003 01:54:45 -0000	1.2
+++ eb55/current/include/hal_platform_ints.h	16 Sep 2004 08:29:01 -0000
@@ -87,12 +87,16 @@
 #define CYGNUM_HAL_INTERRUPT_EXT1               28
 #define CYGNUM_HAL_INTERRUPT_EXT0               29
 #define CYGNUM_HAL_INTERRUPT_COMMRX             30
 #define CYGNUM_HAL_INTERRUPT_COMMTX             31
 
-
+#ifdef CYGHWR_HAL_ARM_AT91_FIQ
+#define CYGNUM_HAL_ISR_MIN                     0
+#else
 #define CYGNUM_HAL_ISR_MIN                     2
+#endif
+
 #define CYGNUM_HAL_ISR_MAX                     31
 // Note: extra slots (0,1) to avoid messing with vector translation
 #define CYGNUM_HAL_ISR_COUNT                   (CYGNUM_HAL_ISR_MAX + 1)
 
 // The vector used by the Real time clock


[-- Attachment #3: Type: text/plain, Size: 148 bytes --]

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [ECOS] AT91: fiq  patch
  2004-09-16  8:37   ` [ECOS] " Andrea Michelotti
@ 2004-09-16 12:15     ` Andrew Lunn
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Lunn @ 2004-09-16 12:15 UTC (permalink / raw)
  To: Andrea Michelotti; +Cc: Andrew Lunn, Nick Garnett, ecos-discuss

[-- Attachment #1: Type: text/plain, Size: 278 bytes --]

On Thu, Sep 16, 2004 at 10:41:42AM +0200, Andrea Michelotti wrote:
> Hi Andrew,
> here's the patch corrected as you suggested and with Changelogs.
> thanks.
> Andrea.

Great. I made a few minor changes to the ChangeLog entries. Attached
is the patch i commited.

        Andrew

[-- Attachment #2: at91_fiq.patch --]
[-- Type: text/plain, Size: 10421 bytes --]

Index: hal/arm/at91/eb40/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/at91/eb40/current/ChangeLog,v
retrieving revision 1.7
diff -u -r1.7 ChangeLog
--- hal/arm/at91/eb40/current/ChangeLog	13 Sep 2004 09:56:36 -0000	1.7
+++ hal/arm/at91/eb40/current/ChangeLog	16 Sep 2004 12:15:06 -0000
@@ -1,6 +1,11 @@
+2004-09-16  Andrea Michelotti <amichelotti@atmel.com>
+
+	* include/hal_platform_ints.h: When CYGHWR_HAL_ARM_AT91_FIQ is defined 
+	  CYGNUM_HAL_ISR_MIN is equal to zero.
+	
 2004-08-30  Thomas Koeller <thomas.koeller@baslerweb.com>
 
-	* cdl//hal_arm_at91_eb42.cdl: Undid last change. These
+	* cdl/hal_arm_at91_eb42.cdl: Undid last change. These
 	options are not really common among all platforms.
 
 2004-02-12  Jani Monoses <jani@iv.ro>
Index: hal/arm/at91/eb40/current/include/hal_platform_ints.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/at91/eb40/current/include/hal_platform_ints.h,v
retrieving revision 1.2
diff -u -r1.2 hal_platform_ints.h
--- hal/arm/at91/eb40/current/include/hal_platform_ints.h	15 Jul 2003 01:54:44 -0000	1.2
+++ hal/arm/at91/eb40/current/include/hal_platform_ints.h	16 Sep 2004 12:15:06 -0000
@@ -68,7 +68,12 @@
 #define CYGNUM_HAL_INTERRUPT_EXT1              17
 #define CYGNUM_HAL_INTERRUPT_EXT2              18
 
+#ifdef CYGHWR_HAL_ARM_AT91_FIQ
+#define CYGNUM_HAL_ISR_MIN                     0
+#else
 #define CYGNUM_HAL_ISR_MIN                     2
+#endif
+
 #define CYGNUM_HAL_ISR_MAX                     18
 // Note: extra slots (0,1) to avoid messing with vector translation
 #define CYGNUM_HAL_ISR_COUNT                   (CYGNUM_HAL_ISR_MAX + 1)
Index: hal/arm/at91/eb40a/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/at91/eb40a/current/ChangeLog,v
retrieving revision 1.7
diff -u -r1.7 ChangeLog
--- hal/arm/at91/eb40a/current/ChangeLog	13 Sep 2004 09:56:37 -0000	1.7
+++ hal/arm/at91/eb40a/current/ChangeLog	16 Sep 2004 12:15:07 -0000
@@ -1,3 +1,8 @@
+2004-09-16  Andrea Michelotti <amichelotti@atmel.com>
+
+	* include/hal_platform_ints.h: When CYGHWR_HAL_ARM_AT91_FIQ is defined 
+	  CYGNUM_HAL_ISR_MIN is equal to zero.
+	
 2004-08-30  Thomas Koeller <thomas.koeller@baslerweb.com>
 
 	* cdl//hal_arm_at91_eb42.cdl: Undid last change. These
Index: hal/arm/at91/eb40a/current/include/hal_platform_ints.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/at91/eb40a/current/include/hal_platform_ints.h,v
retrieving revision 1.2
diff -u -r1.2 hal_platform_ints.h
--- hal/arm/at91/eb40a/current/include/hal_platform_ints.h	15 Jul 2003 01:54:44 -0000	1.2
+++ hal/arm/at91/eb40a/current/include/hal_platform_ints.h	16 Sep 2004 12:15:07 -0000
@@ -68,7 +68,12 @@
 #define CYGNUM_HAL_INTERRUPT_EXT1              17
 #define CYGNUM_HAL_INTERRUPT_EXT2              18
 
+#ifdef CYGHWR_HAL_ARM_AT91_FIQ
+#define CYGNUM_HAL_ISR_MIN                     0
+#else
 #define CYGNUM_HAL_ISR_MIN                     2
+#endif
+
 #define CYGNUM_HAL_ISR_MAX                     18
 // Note: extra slots (0,1) to avoid messing with vector translation
 #define CYGNUM_HAL_ISR_COUNT                   (CYGNUM_HAL_ISR_MAX + 1)
Index: hal/arm/at91/eb42/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/at91/eb42/current/ChangeLog,v
retrieving revision 1.6
diff -u -r1.6 ChangeLog
--- hal/arm/at91/eb42/current/ChangeLog	13 Sep 2004 09:56:39 -0000	1.6
+++ hal/arm/at91/eb42/current/ChangeLog	16 Sep 2004 12:15:07 -0000
@@ -1,3 +1,8 @@
+2004-09-16  Andrea Michelotti <amichelotti@atmel.com>
+
+	* include/hal_platform_ints.h: When CYGHWR_HAL_ARM_AT91_FIQ is defined 
+	  CYGNUM_HAL_ISR_MIN is equal to zero.
+	
 2004-08-30  Thomas Koeller <thomas.koeller@baslerweb.com>
 
 	* cdl//hal_arm_at91_eb42.cdl: Undid last change. These
Index: hal/arm/at91/eb42/current/include/hal_platform_ints.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/at91/eb42/current/include/hal_platform_ints.h,v
retrieving revision 1.2
diff -u -r1.2 hal_platform_ints.h
--- hal/arm/at91/eb42/current/include/hal_platform_ints.h	15 Jul 2003 01:54:45 -0000	1.2
+++ hal/arm/at91/eb42/current/include/hal_platform_ints.h	16 Sep 2004 12:15:07 -0000
@@ -78,7 +78,12 @@
 #define CYGNUM_HAL_INTERRUPT_EXT1              30
 #define CYGNUM_HAL_INTERRUPT_EXT0              31
 
+#ifdef CYGHWR_HAL_ARM_AT91_FIQ
+#define CYGNUM_HAL_ISR_MIN                     0
+#else
 #define CYGNUM_HAL_ISR_MIN                     2
+#endif
+
 #define CYGNUM_HAL_ISR_MAX                     31
 // Note: extra slots (0,1) to avoid messing with vector translation
 #define CYGNUM_HAL_ISR_COUNT                   (CYGNUM_HAL_ISR_MAX + 1)
Index: hal/arm/at91/eb55/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/at91/eb55/current/ChangeLog,v
retrieving revision 1.7
diff -u -r1.7 ChangeLog
--- hal/arm/at91/eb55/current/ChangeLog	13 Sep 2004 09:56:39 -0000	1.7
+++ hal/arm/at91/eb55/current/ChangeLog	16 Sep 2004 12:15:07 -0000
@@ -1,3 +1,8 @@
+2004-09-16  Andrea Michelotti <amichelotti@atmel.com>
+
+	* include/hal_platform_ints.h: When CYGHWR_HAL_ARM_AT91_FIQ is defined 
+	  CYGNUM_HAL_ISR_MIN is equal to zero.
+	
 2004-08-30  Thomas Koeller  <thomas.koeller@baslerweb.com>
 
 	* cdl/hal_arm_at91_eb55.cdl: Reversed change of 2004-02-12.
Index: hal/arm/at91/eb55/current/include/hal_platform_ints.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/at91/eb55/current/include/hal_platform_ints.h,v
retrieving revision 1.2
diff -u -r1.2 hal_platform_ints.h
--- hal/arm/at91/eb55/current/include/hal_platform_ints.h	15 Jul 2003 01:54:45 -0000	1.2
+++ hal/arm/at91/eb55/current/include/hal_platform_ints.h	16 Sep 2004 12:15:08 -0000
@@ -89,8 +89,12 @@
 #define CYGNUM_HAL_INTERRUPT_COMMRX             30
 #define CYGNUM_HAL_INTERRUPT_COMMTX             31
 
-
+#ifdef CYGHWR_HAL_ARM_AT91_FIQ
+#define CYGNUM_HAL_ISR_MIN                     0
+#else
 #define CYGNUM_HAL_ISR_MIN                     2
+#endif
+
 #define CYGNUM_HAL_ISR_MAX                     31
 // Note: extra slots (0,1) to avoid messing with vector translation
 #define CYGNUM_HAL_ISR_COUNT                   (CYGNUM_HAL_ISR_MAX + 1)
Index: hal/arm/at91/var/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/at91/var/current/ChangeLog,v
retrieving revision 1.20
diff -u -r1.20 ChangeLog
--- hal/arm/at91/var/current/ChangeLog	13 Sep 2004 09:56:39 -0000	1.20
+++ hal/arm/at91/var/current/ChangeLog	16 Sep 2004 12:15:08 -0000
@@ -1,3 +1,12 @@
+2004-09-16  Andrea Michelotti <amichelotti@atmel.com>
+
+	* cdl/hal_arm_at91.cdl:
+	* src/at91_misc.c:
+	* include/var_io.h: Support FIQ as a high priority interrupt using the normal
+	mechanism. This is controlled by the CDL option CYGHWR_HAL_ARM_AT91_FIQ and uses the
+	interrupt number CYGHWR_HAL_ARM_AT91_FIQ which is common to all platforms using
+	this HAL variant. 
+		
 2004-08-30  Thomas Koeller <thomas.koeller@baslerweb.com>
 
 	* cdl/hal_arm_at91.cdl: Reversed change of 2004-02-12 that move
Index: hal/arm/at91/var/current/cdl/hal_arm_at91.cdl
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/at91/var/current/cdl/hal_arm_at91.cdl,v
retrieving revision 1.7
diff -u -r1.7 hal_arm_at91.cdl
--- hal/arm/at91/var/current/cdl/hal_arm_at91.cdl	13 Sep 2004 09:56:40 -0000	1.7
+++ hal/arm/at91/var/current/cdl/hal_arm_at91.cdl	16 Sep 2004 12:15:08 -0000
@@ -85,4 +85,14 @@
                         platform HALs to select the specific microcontroller
                         being used."
     }
+
+    cdl_option CYGHWR_HAL_ARM_AT91_FIQ {
+        display       "handle FIQ as an IRQ"
+        flavor        bool
+        default_value 0
+        description   "
+            Enable this option if you need to handle FIQ interrupts in the
+            normal way, i.e. a FIQ interrupt will be treated as a normal IRQ 
+            using the highest priority"
+    }
 }
Index: hal/arm/at91/var/current/include/var_io.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/at91/var/current/include/var_io.h,v
retrieving revision 1.7
diff -u -r1.7 var_io.h
--- hal/arm/at91/var/current/include/var_io.h	24 May 2004 08:41:47 -0000	1.7
+++ hal/arm/at91/var/current/include/var_io.h	16 Sep 2004 12:15:09 -0000
@@ -640,6 +640,10 @@
 #define AT91_WD_SR_WDOVF    0x00000001
 
 
+//=============================================================================
+// FIQ interrupt vector which is shared by all HAL varients.
+
+#define CYGNUM_HAL_INTERRUPT_FIQ 0
 //-----------------------------------------------------------------------------
 // end of var_io.h
 #endif // CYGONCE_HAL_VAR_IO_H
Index: hal/arm/at91/var/current/src/at91_misc.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/at91/var/current/src/at91_misc.c,v
retrieving revision 1.8
diff -u -r1.8 at91_misc.c
--- hal/arm/at91/var/current/src/at91_misc.c	12 Aug 2004 13:02:24 -0000	1.8
+++ hal/arm/at91/var/current/src/at91_misc.c	16 Sep 2004 12:15:09 -0000
@@ -180,13 +180,24 @@
 {
     cyg_uint32 irq_num;
     cyg_uint32 ivr;
-    
+#ifdef CYGHWR_HAL_ARM_AT91_FIQ
+    // handle fiq interrupts as irq 
+    cyg_uint32 ipr,imr;
+
+    HAL_READ_UINT32(AT91_AIC+AT91_AIC_IPR, ipr);
+    HAL_READ_UINT32(AT91_AIC+AT91_AIC_IMR, imr);
+
+    if (imr & ipr & (1 << CYGNUM_HAL_INTERRUPT_FIQ)) {
+      HAL_WRITE_UINT32(AT91_AIC+AT91_AIC_ICCR, (1 << CYGNUM_HAL_INTERRUPT_FIQ));
+      return CYGNUM_HAL_INTERRUPT_FIQ;
+    }
+#endif
     // Calculate active interrupt (updates ISR)
     HAL_READ_UINT32(AT91_AIC+AT91_AIC_IVR, ivr);
 
     HAL_READ_UINT32(AT91_AIC+AT91_AIC_ISR, irq_num);
 
-    // No valid interrrupt source, treat as spurious interrupt    
+    // An invalid interrrupt source is treated as a spurious interrupt    
     if (irq_num < CYGNUM_HAL_ISR_MIN || irq_num > CYGNUM_HAL_ISR_MAX)
       irq_num = CYGNUM_HAL_INTERRUPT_NONE;
     


[-- Attachment #3: Type: text/plain, Size: 148 bytes --]

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-09-16 12:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-15 17:19 [ECOS] AT91: fiq patch Andrea Michelotti
2004-09-16  8:02 ` [ECOS] " Andrew Lunn
2004-09-16  8:37   ` [ECOS] " Andrea Michelotti
2004-09-16 12:15     ` Andrew Lunn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).