<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>change log for rtems (2011-08-18)</title>
</head>
<body text='#000000' bgcolor='#ffffff'>
<a name='cs1'></a>
<table border='0' cellspacing='0' cellpadding='5' width='100%' bgcolor='#eeeeee'>
<tr><td colspan='3' bgcolor='#dddddd'>
 <font color='#bb2222'><strong>ccj</strong></font>
</td></tr>
<tr><td colspan='3' bgcolor='#dddddd'><pre>2011-08-18      Chris Johns <chrisj@rtems.org>

        * cpu.c: Fix the ISR get level for the IIC. Make
        _CPU_Context_Initialize a function rather than inlined.
        * cpu_asm.S: Do not enable interrupt on return, rather resume the
        state on entry to the ISR.
        * irq.c, nios2/nios2-iic-low-level.S: Change the ISR handler so
        the ipending decoding is in C and within the interrupt
        context. This is usable with the Altera HAL directly.
        * rtems/score/cpu.h: Add ienable and ipending interfaces. Add some
        comments. Remove _CPU_Context_Initialize.
</pre></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/score/cpu/nios2/ChangeLog.diff?r1=text&tr1=1.34&r2=text&tr2=1.35&diff_format=h">M</a></td><td width='1%'>1.35</td><td width='100%'>cpukit/score/cpu/nios2/ChangeLog</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/score/cpu/nios2/cpu.c.diff?r1=text&tr1=1.14&r2=text&tr2=1.15&diff_format=h">M</a></td><td width='1%'>1.15</td><td width='100%'>cpukit/score/cpu/nios2/cpu.c</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/score/cpu/nios2/cpu_asm.S.diff?r1=text&tr1=1.8&r2=text&tr2=1.9&diff_format=h">M</a></td><td width='1%'>1.9</td><td width='100%'>cpukit/score/cpu/nios2/cpu_asm.S</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/score/cpu/nios2/irq.c.diff?r1=text&tr1=1.10&r2=text&tr2=1.11&diff_format=h">M</a></td><td width='1%'>1.11</td><td width='100%'>cpukit/score/cpu/nios2/irq.c</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/score/cpu/nios2/nios2-iic-low-level.S.diff?r1=text&tr1=1.1&r2=text&tr2=1.2&diff_format=h">M</a></td><td width='1%'>1.2</td><td width='100%'>cpukit/score/cpu/nios2/nios2-iic-low-level.S</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/score/cpu/nios2/rtems/score/cpu.h.diff?r1=text&tr1=1.21&r2=text&tr2=1.22&diff_format=h">M</a></td><td width='1%'>1.22</td><td width='100%'>cpukit/score/cpu/nios2/rtems/score/cpu.h</td></tr>
</table>
<pre>
<font color='#006600'>diff -u rtems/cpukit/score/cpu/nios2/ChangeLog:1.34 rtems/cpukit/score/cpu/nios2/ChangeLog:1.35
--- rtems/cpukit/score/cpu/nios2/ChangeLog:1.34 Sun Aug 14 02:38:14 2011
+++ rtems/cpukit/score/cpu/nios2/ChangeLog      Thu Aug 18 04:00:14 2011
</font><font color='#997700'>@@ -1,3 +1,15 @@
</font><font color='#000088'>+2011-08-18    Chris Johns <chrisj@rtems.org>
+
+       * cpu.c: Fix the ISR get level for the IIC. Make
+       _CPU_Context_Initialize a function rather than inlined.
+       * cpu_asm.S: Do not enable interrupt on return, rather resume the
+       state on entry to the ISR.
+       * irq.c, nios2/nios2-iic-low-level.S: Change the ISR handler so
+       the ipending decoding is in C and within the interrupt
+       context. This is usable with the Altera HAL directly.
+       * rtems/score/cpu.h: Add ienable and ipending interfaces. Add some
+       comments. Remove _CPU_Context_Initialize.
+
</font> 2011-08-14        Chris Johns <chrisj@rtems.org>
 
        * rtems/score/cpu.h: Clear the vector table for simple vectored

<font color='#006600'>diff -u rtems/cpukit/score/cpu/nios2/cpu.c:1.14 rtems/cpukit/score/cpu/nios2/cpu.c:1.15
--- rtems/cpukit/score/cpu/nios2/cpu.c:1.14     Wed Aug 10 09:10:09 2011
+++ rtems/cpukit/score/cpu/nios2/cpu.c  Thu Aug 18 04:00:14 2011
</font><font color='#997700'>@@ -19,6 +19,8 @@
</font> #include <rtems/score/isr.h>
 #include <rtems/score/wkspace.h>
 
<font color='#000088'>+#include <rtems/score/nios2.h>
+
</font> /*  _CPU_Initialize
  *
  *  This routine performs processor dependent initialization.
<font color='#997700'>@@ -44,19 +46,33 @@
</font> 
 /*
  *  _CPU_ISR_Get_level
<font color='#880000'>- *
- *  NO_CPU Specific Information:
- *
- *  XXX document implementation including references if appropriate
</font>  */
 
 uint32_t   _CPU_ISR_Get_level( void )
 {
<font color='#880000'>-  /*
-   *  This routine returns the current interrupt level.
-   */
</font><font color='#000088'>+  /* @todo Add EIC support. */
+  uint32_t status = __builtin_rdctl(0);
+  return status & 1 ? 0 : 1;
+}
</font> 
<font color='#880000'>-  return 0;
</font><font color='#000088'>+/*
+ * FIXME: Evaluate interrupt level.
+ */
+void _CPU_Context_Initialize(
+  Context_Control  *the_context,
+  uint32_t         *stack_base,
+  uint32_t          size,
+  uint32_t          new_level,
+  void             *entry_point,
+  bool              is_fp
+)
+{
+  uint32_t stack = (uint32_t)stack_base + size - 4;
+  the_context->fp = stack;
+  the_context->sp = stack;
+  the_context->ra = (intptr_t) entry_point;
+  /* @todo Add EIC support. */
+  the_context->status = new_level ? 0 : 1;
</font> }
 
 /*

<font color='#006600'>diff -u rtems/cpukit/score/cpu/nios2/cpu_asm.S:1.8 rtems/cpukit/score/cpu/nios2/cpu_asm.S:1.9
--- rtems/cpukit/score/cpu/nios2/cpu_asm.S:1.8  Tue Aug  9 06:11:30 2011
+++ rtems/cpukit/score/cpu/nios2/cpu_asm.S      Thu Aug 18 04:00:14 2011
</font><font color='#997700'>@@ -70,8 +70,6 @@
</font> 
     ldw ea,  40(r5)
     ldw at,  44(r5)
<font color='#880000'>-    /* FIXME: Always have interrupts enabled when we return from Context_switch */
-    ori at, at, 1
</font>     wrctl estatus, at
 
     eret

<font color='#006600'>diff -u rtems/cpukit/score/cpu/nios2/irq.c:1.10 rtems/cpukit/score/cpu/nios2/irq.c:1.11
--- rtems/cpukit/score/cpu/nios2/irq.c:1.10     Sun Aug 14 02:38:14 2011
+++ rtems/cpukit/score/cpu/nios2/irq.c  Thu Aug 18 04:00:14 2011
</font><font color='#997700'>@@ -34,19 +34,6 @@
</font> 
 register unsigned long  *stack_ptr __asm__ ("sp");
 
<font color='#880000'>-RTEMS_INLINE_ROUTINE void
-__Dipatch_interrupt_vector(uint32_t vector, proc_ptr pp)
-{
-  if ( _ISR_Vector_table[ vector] )
-  {
-    (*_ISR_Vector_table[ vector ])(vector, pp);
-  };
-}
-
-#if (RTEMS_NIOS_USE_ALT_HAL == TRUE)
-
-#include <bsp/alt/nios2.h>
-
</font> RTEMS_INLINE_ROUTINE void __IIC_Handler(void)
 {
   uint32_t active;
<font color='#997700'>@@ -56,7 +43,7 @@
</font>   /*
    * Obtain from the interrupt controller a bit list of pending interrupts,
    * and then process the highest priority interrupt. This process loops,
<font color='#880000'>-   * loading the active interrupt list on each pass until alt_irq_pending()
</font><font color='#000088'>+   * loading the active interrupt list on each pass until ipending
</font>    * return zero.
    *
    * The maximum interrupt latency for the highest priority interrupt is
<font color='#997700'>@@ -66,7 +53,7 @@
</font>    * this is the case.
    */
 
<font color='#880000'>-  NIOS2_READ_IPENDING (active);
</font><font color='#000088'>+  _CPU_read_ipending (active);
</font> 
   while (active)
   {
<font color='#997700'>@@ -75,34 +62,29 @@
</font> 
     /*
      * Test each bit in turn looking for an active interrupt. Once one is
<font color='#880000'>-     * found, the interrupt handler asigned by a call to alt_irq_register() is
-     * called to clear the interrupt condition.
</font><font color='#000088'>+     * found call it to clear the interrupt condition.
</font>      */
 
     while (active)
     {
       if (active & mask)
       {
<font color='#880000'>-        __Dipatch_interrupt_vector(vector, NULL);
</font><font color='#000088'>+        if ( _ISR_Vector_table[ vector] )
+          (*_ISR_Vector_table[ vector ])(vector, NULL);
</font>         active &= ~mask;
       }
       mask <<= 1;
       ++vector;
     };
 
<font color='#880000'>-    NIOS2_READ_IPENDING (active);
</font><font color='#000088'>+    _CPU_read_ipending (active);
</font>   }
   
 }
<font color='#880000'>-#endif
</font> 
<font color='#880000'>-#if (RTEMS_NIOS_USE_ALT_HAL == TRUE)
</font> void __ISR_Handler(void)
<font color='#880000'>-#else
-void __ISR_Handler(uint32_t vector, CPU_Interrupt_frame *ifr)
-#endif
</font> {
<font color='#880000'>-  register uint32_t   level;
</font><font color='#000088'>+  register uint32_t level;
</font> 
   /* Interrupts are disabled upon entry to this Handler */
 
<font color='#997700'>@@ -118,11 +100,7 @@
</font> 
   _Thread_Dispatch_increment_disable_level();
 
<font color='#880000'>-#if (RTEMS_NIOS_USE_ALT_HAL == TRUE)
</font>   __IIC_Handler();
<font color='#880000'>-#else
-  __Dipatch_interrupt_vector(vector, ifr);
-#endif
</font>   
   /* Make sure that interrupts are disabled again */
   _CPU_ISR_Disable( level );

<font color='#006600'>diff -u rtems/cpukit/score/cpu/nios2/nios2-iic-low-level.S:1.1 rtems/cpukit/score/cpu/nios2/nios2-iic-low-level.S:1.2
--- rtems/cpukit/score/cpu/nios2/nios2-iic-low-level.S:1.1      Tue Aug  9 06:11:30 2011
+++ rtems/cpukit/score/cpu/nios2/nios2-iic-low-level.S  Thu Aug 18 04:00:14 2011
</font><font color='#997700'>@@ -231,6 +231,7 @@
</font>     stw et,  68(sp)
     stw ea,  72(sp)
 
<font color='#000088'>+#if REMOVED_BY_CCJ
</font>     /*
      * Obtain a bitlist of the pending interrupts.
      */
<font color='#997700'>@@ -266,7 +267,8 @@
</font>      */
 
     mov     r5, sp
<font color='#880000'>-
</font><font color='#000088'>+#endif
+<span style="background-color: #FF0000">       </span>
</font>     .extern __ISR_Handler
     call    __ISR_Handler
 

<font color='#006600'>diff -u rtems/cpukit/score/cpu/nios2/rtems/score/cpu.h:1.21 rtems/cpukit/score/cpu/nios2/rtems/score/cpu.h:1.22
--- rtems/cpukit/score/cpu/nios2/rtems/score/cpu.h:1.21 Sun Aug 14 02:38:14 2011
+++ rtems/cpukit/score/cpu/nios2/rtems/score/cpu.h      Thu Aug 18 04:00:14 2011
</font><font color='#997700'>@@ -189,40 +189,101 @@
</font> #define _CPU_Initialize_vectors()
 #endif
 
<font color='#000088'>+/**
+ *  @brief Read the ienable register.
+ */
+#define _CPU_read_ienable( value ) \
+    do { value = __builtin_rdctl(3); } while (0)
+
+/**
+ *  @brief Write the ienable register.
+ */
+#define _CPU_write_ienable( value ) \
+    do { __builtin_wrctl(3, value); } while (0)
+
+/**
+ *  @brief Read the ipending register.
+ */
+#define _CPU_read_ipending( value ) \
+    do { value = __builtin_rdctl(4); } while (0)
+
+/**
+ *  Disable all interrupts for a critical section.  The previous
+ *  level is returned in _level.
+ */
</font> #define _CPU_ISR_Disable( _isr_cookie ) \
   do { \
     _isr_cookie = __builtin_rdctl( 0 ); \
     __builtin_wrctl( 0, 0 ); \
   } while ( 0 )
 
<font color='#000088'>+/**
+ *  Enable interrupts to the previous level (returned by _CPU_ISR_Disable).
+ *  This indicates the end of a critical section.  The parameter
+ *  _level is not modified.
+ */
</font> #define _CPU_ISR_Enable( _isr_cookie ) \
   do { \
     __builtin_wrctl( 0, (int) _isr_cookie ); \
   } while ( 0 )
 
<font color='#000088'>+/**
+ *  This temporarily restores the interrupt to _level before immediately
+ *  disabling them again.  This is used to divide long critical
+ *  sections into two or more parts.  The parameter _level is not
+ *  modified.
+ */
</font> #define _CPU_ISR_Flash( _isr_cookie ) \
   do { \
     __builtin_wrctl( 0, (int) _isr_cookie ); \
     __builtin_wrctl( 0, 0 ); \
   } while ( 0 )
 
<font color='#880000'>-#define _CPU_ISR_Set_level( new_level ) \
</font><font color='#000088'>+/**
+ *  Map interrupt level in task mode onto the hardware that the CPU
+ *  actually provides.  Currently, interrupt levels which do not
+ *  map onto the CPU in a straight fashion are undefined.
+ */
+#define _CPU_ISR_Set_level( new_level )      \
</font>   _CPU_ISR_Enable( new_level == 0 ? 1 : 0 );
 
<font color='#000088'>+/**
+ *  @brief Obtain the Current Interrupt Disable Level
+ *
+ *  This method is invoked to return the current interrupt disable level.
+ *
+ *  @return This method returns the current interrupt disable level.
+ */
</font> uint32_t _CPU_ISR_Get_level( void );
 
<font color='#880000'>-/*
- * FIXME: Evaluate interrupt level.
</font><font color='#000088'>+/**
+ *  Initialize the context to a state suitable for starting a
+ *  task after a context restore operation.  Generally, this
+ *  involves:
+ *
+ *  - setting a starting address
+ *  - preparing the stack
+ *  - preparing the stack and frame pointers
+ *  - setting the proper interrupt level in the context
+ *  - initializing the floating point context
+ *
+ * @param[in] the_context points to the context area
+ * @param[in] stack_base is the low address of the allocated stack area
+ * @param[in] size is the size of the stack area in bytes
+ * @param[in] new_level is the interrupt level for the task
+ * @param[in] entry_point is the task's entry point
+ * @param[in] is_fp is set to TRUE if the task is a floating point task
+ *
+ *  @note  Implemented as a subroutine for the NIOS2 port.
</font>  */
<font color='#880000'>-#define _CPU_Context_Initialize( _the_context, _stack_base, _size, \
-                                 _isr, _entry_point, _is_fp ) \
-  do { \
-    uint32_t _stack = (uint32_t)(_stack_base) + (_size) - 4; \
-    (_the_context)->fp = (void *)_stack; \
-    (_the_context)->sp = (void *)_stack; \
-    (_the_context)->ra = (void *)(_entry_point); \
-    (_the_context)->status  = 0x1; /* IRQs enabled */ \
-  } while ( 0 )
</font><font color='#000088'>+void _CPU_Context_Initialize(
+  Context_Control  *the_context,
+  uint32_t         *stack_base,
+  uint32_t          size,
+  uint32_t          new_level,
+  void             *entry_point,
+  bool              is_fp
+);
</font> 
 #define _CPU_Context_Restart_self( _the_context ) \
   _CPU_Context_restore( (_the_context) );
</pre>
<p> </p>

<p>--<br />
<small>Generated by <a href="http://www.codewiz.org/projects/index.html#loginfo">Deluxe Loginfo</a> 2.122 by Bernardo Innocenti <bernie@develer.com></small></p>
</body>
</html>