Hi

I wrote a patch for FIFO dsr too!
It's not the best solution but a simple one!

I already posted it under "kernel dsr handling new option"

Bye

diff -u5prN ecos-trunk-full/ecos/packages/kernel/current/ChangeLog 
ecos/packages/kernel/current/ChangeLog
--- ecos-trunk-full/ecos/packages/kernel/current/ChangeLog      2006-04-11 
21:18:02.000000000 +0200
+++ ecos/packages/kernel/current/ChangeLog      2006-07-31 15:34:06.478407300 
+0200
@@ -1,5 +1,14 @@
+2006-05-10  Jochen Gerster <[EMAIL PROTECTED]>
+       * added a option for defining the order the dsr are called
+         now you can choose that the dsr are called in the order the isr 
ocurred or reverse
+         it's not the best solution but when you need it it's acceptable
+         first I tried it with a chainlist and two pointers(in/out)
+         but I didn't work don't know why because when the chainlist was 
modified
+         the interrupts were disabled?? So I do it like now
+         
+
 2006-04-11  Sergei Organov <[EMAIL PROTECTED]>
 
        * doc/kernel.sgml: Fix typo
 
 2006-03-27  Marco Cruz  <[EMAIL PROTECTED]>
diff -u5prN ecos-trunk-full/ecos/packages/kernel/current/cdl/interrupts.cdl 
ecos/packages/kernel/current/cdl/interrupts.cdl
--- ecos-trunk-full/ecos/packages/kernel/current/cdl/interrupts.cdl     
2002-05-24 01:06:46.000000000 +0200
+++ ecos/packages/kernel/current/cdl/interrupts.cdl     2006-05-10 
13:23:56.733093500 +0200
@@ -72,21 +72,30 @@ cdl_component CYGIMP_KERNEL_INTERRUPTS_D
     }
 
     # NOTE: the choice of list vs table should not be two separate
     # options. There is a single option which must have one of
     # two legal values.
-    cdl_option CYGIMP_KERNEL_INTERRUPTS_DSRS_LIST {
+    cdl_component CYGIMP_KERNEL_INTERRUPTS_DSRS_LIST {
         display       "Use linked lists for DSRs"
         default_value 1
         implements    CYGINT_KERNEL_INTERRUPTS_DSRS
         description   "
             When DSR support is enabled the kernel must keep track of all
             the DSRs that are pending. This information can be kept in a
             fixed-size table or in a linked list. The list implementation
             requires that the kernel disable interrupts for a very short
             period of time outside interrupt handlers, but there is no
             possibility of a table overflow occurring."
+               
+               cdl_option CYGIMP_KERNEL_INTERRUPTS_DSRS_LIST_REVERSE {
+            display       "Call DSRs in reversed order"
+            flavor        bool
+            default_value 0
+            description "
+                               The DSRs will be called in reversed order they 
occured."
+        }
+
     }
 
     cdl_component CYGIMP_KERNEL_INTERRUPTS_DSRS_TABLE {
         display       "Use fixed-size table for DSRs"
         default_value 0
diff -u5prN ecos-trunk-full/ecos/packages/kernel/current/src/intr/intr.cxx 
ecos/packages/kernel/current/src/intr/intr.cxx
--- ecos-trunk-full/ecos/packages/kernel/current/src/intr/intr.cxx      
2002-05-24 01:06:54.000000000 +0200
+++ ecos/packages/kernel/current/src/intr/intr.cxx      2006-06-07 
11:04:25.164177300 +0200
@@ -243,19 +243,32 @@ Cyg_Interrupt::post_dsr(void)
 
 #ifdef CYGIMP_KERNEL_INTERRUPTS_DSRS_LIST
 
     // Only add the interrupt to the dsr list if this is
     // the first DSR call.
-    // At present DSRs are pushed onto the list and will be
-    // called in reverse order. We do not define the order
-    // in which DSRs are called, so this is acceptable.
-    
-    if( dsr_count++ == 0 )
-    {
-        next_dsr = dsr_list[cpu];
-        dsr_list[cpu] = this;
-    }
+#ifdef CYGIMP_KERNEL_INTERRUPTS_DSRS_LIST_REVERSE
+       if( dsr_count++ == 0 )
+       {
+               next_dsr = dsr_list[cpu];
+               dsr_list[cpu] = this;
+       }
+#else
+       if( dsr_count++ == 0 )
+       {
+               next_dsr = NULL;
+               if(dsr_list[cpu]==NULL)
+                       dsr_list[cpu]=this;
+               else
+               {
+                       Cyg_Interrupt* next=dsr_list[cpu]; 
+                       while((next->next_dsr)!=NULL)
+                               next=next->next_dsr;
+                       next->next_dsr = this;
+               }
+       }
+#endif
+
     
 #endif
     
     HAL_RESTORE_INTERRUPTS(old_intr);    
 };

Reply via email to