<!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-09-01)</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>sh</strong></font>
</td></tr>
<tr><td colspan='3' bgcolor='#dddddd'><pre>2011-09-01 Sebastian Huber <sebastian.huber@embedded-brains.de>
* cpu.c, cpu_asm.S: Removed files.
* nios2-context-initialize.c, nios2-context-switch.S,
nios2-fatal-halt.c, nios2-initialize-vectors.c, nios2-initialize.c,
nios2-isr-get-level.c, nios2-isr-install-raw-handler.c,
nios2-isr-install-vector.c, nios2-isr-is-in-progress.c,
nios2-isr-set-level.c, nios2-thread-dispatch-disabled.c,
rtems/score/nios2-utility.h: New files.
* Makefile.am, preinstall.am: Reflect changes above.
* irq.c: Update due to API changes.
* rtems/score/cpu.h: New functions _CPU_Initialize_vectors(),
_CPU_ISR_Set_level(), and _CPU_Fatal_halt() (instead of macros).
Support for external interrupt controller (EIC). Documentation
changes.
</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.35&r2=text&tr2=1.36&diff_format=h">M</a></td><td width='1%'>1.36</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/Makefile.am.diff?r1=text&tr1=1.5&r2=text&tr2=1.6&diff_format=h">M</a></td><td width='1%'>1.6</td><td width='100%'>cpukit/score/cpu/nios2/Makefile.am</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/score/cpu/nios2/cpu.c?rev=1.15&content-type=text/vnd.viewcvs-markup">R</a></td><td width='1%'><font color="#880000">1.15</font></td><td width='100%'><font color="#880000">cpukit/score/cpu/nios2/cpu.c</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/score/cpu/nios2/cpu_asm.S?rev=1.9&content-type=text/vnd.viewcvs-markup">R</a></td><td width='1%'><font color="#880000">1.9</font></td><td width='100%'><font color="#880000">cpukit/score/cpu/nios2/cpu_asm.S</font></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.11&r2=text&tr2=1.12&diff_format=h">M</a></td><td width='1%'>1.12</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-context-initialize.c?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">cpukit/score/cpu/nios2/nios2-context-initialize.c</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/score/cpu/nios2/nios2-context-switch.S?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">cpukit/score/cpu/nios2/nios2-context-switch.S</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/score/cpu/nios2/nios2-fatal-halt.c?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">cpukit/score/cpu/nios2/nios2-fatal-halt.c</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/score/cpu/nios2/nios2-initialize-vectors.c?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">cpukit/score/cpu/nios2/nios2-initialize-vectors.c</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/score/cpu/nios2/nios2-initialize.c?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">cpukit/score/cpu/nios2/nios2-initialize.c</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/score/cpu/nios2/nios2-isr-get-level.c?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">cpukit/score/cpu/nios2/nios2-isr-get-level.c</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/score/cpu/nios2/nios2-isr-install-raw-handler.c?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">cpukit/score/cpu/nios2/nios2-isr-install-raw-handler.c</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/score/cpu/nios2/nios2-isr-install-vector.c?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">cpukit/score/cpu/nios2/nios2-isr-install-vector.c</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/score/cpu/nios2/nios2-isr-is-in-progress.c?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">cpukit/score/cpu/nios2/nios2-isr-is-in-progress.c</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/score/cpu/nios2/nios2-isr-set-level.c?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">cpukit/score/cpu/nios2/nios2-isr-set-level.c</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/score/cpu/nios2/nios2-thread-dispatch-disabled.c?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">cpukit/score/cpu/nios2/nios2-thread-dispatch-disabled.c</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/score/cpu/nios2/preinstall.am.diff?r1=text&tr1=1.5&r2=text&tr2=1.6&diff_format=h">M</a></td><td width='1%'>1.6</td><td width='100%'>cpukit/score/cpu/nios2/preinstall.am</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.22&r2=text&tr2=1.23&diff_format=h">M</a></td><td width='1%'>1.23</td><td width='100%'>cpukit/score/cpu/nios2/rtems/score/cpu.h</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/score/cpu/nios2/rtems/score/nios2-utility.h?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">cpukit/score/cpu/nios2/rtems/score/nios2-utility.h</font></td></tr>
</table>
<pre>
<font color='#006600'>diff -u rtems/cpukit/score/cpu/nios2/ChangeLog:1.35 rtems/cpukit/score/cpu/nios2/ChangeLog:1.36
--- rtems/cpukit/score/cpu/nios2/ChangeLog:1.35 Thu Aug 18 04:00:14 2011
+++ rtems/cpukit/score/cpu/nios2/ChangeLog Thu Sep 1 10:52:12 2011
</font><font color='#997700'>@@ -1,3 +1,19 @@
</font><font color='#000088'>+2011-09-01 Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+ * cpu.c, cpu_asm.S: Removed files.
+ * nios2-context-initialize.c, nios2-context-switch.S,
+ nios2-fatal-halt.c, nios2-initialize-vectors.c, nios2-initialize.c,
+ nios2-isr-get-level.c, nios2-isr-install-raw-handler.c,
+ nios2-isr-install-vector.c, nios2-isr-is-in-progress.c,
+ nios2-isr-set-level.c, nios2-thread-dispatch-disabled.c,
+ rtems/score/nios2-utility.h: New files.
+ * Makefile.am, preinstall.am: Reflect changes above.
+ * irq.c: Update due to API changes.
+ * rtems/score/cpu.h: New functions _CPU_Initialize_vectors(),
+ _CPU_ISR_Set_level(), and _CPU_Fatal_halt() (instead of macros).
+ Support for external interrupt controller (EIC). Documentation
+ changes.
+
</font> 2011-08-18 Chris Johns <chrisj@rtems.org>
* cpu.c: Fix the ISR get level for the IIC. Make
<font color='#006600'>diff -u rtems/cpukit/score/cpu/nios2/Makefile.am:1.5 rtems/cpukit/score/cpu/nios2/Makefile.am:1.6
--- rtems/cpukit/score/cpu/nios2/Makefile.am:1.5 Tue Aug 9 06:11:30 2011
+++ rtems/cpukit/score/cpu/nios2/Makefile.am Thu Sep 1 10:52:12 2011
</font><font color='#997700'>@@ -8,19 +8,35 @@
</font> DISTCLEANFILES =
include_rtemsdir = $(includedir)/rtems
<font color='#000088'>+
</font> include_rtems_HEADERS = rtems/asm.h
include_rtems_scoredir = $(includedir)/rtems/score
<font color='#880000'>-include_rtems_score_HEADERS = rtems/score/cpu.h
</font><font color='#000088'>+
+include_rtems_score_HEADERS =
+include_rtems_score_HEADERS += rtems/score/cpu.h
</font> include_rtems_score_HEADERS += rtems/score/nios2.h
<font color='#000088'>+include_rtems_score_HEADERS += rtems/score/nios2-utility.h
</font> include_rtems_score_HEADERS += rtems/score/cpu_asm.h
include_rtems_score_HEADERS += rtems/score/types.h
noinst_LIBRARIES = libscorecpu.a
<font color='#880000'>-libscorecpu_a_SOURCES = cpu.c \
- irq.c \
- nios2-iic-low-level.S \
- cpu_asm.S
</font><font color='#000088'>+
+libscorecpu_a_SOURCES =
+libscorecpu_a_SOURCES += irq.c
+libscorecpu_a_SOURCES += nios2-context-initialize.c
+libscorecpu_a_SOURCES += nios2-context-switch.S
+libscorecpu_a_SOURCES += nios2-fatal-halt.c
+libscorecpu_a_SOURCES += nios2-iic-low-level.S
+libscorecpu_a_SOURCES += nios2-initialize.c
+libscorecpu_a_SOURCES += nios2-initialize-vectors.c
+libscorecpu_a_SOURCES += nios2-isr-get-level.c
+libscorecpu_a_SOURCES += nios2-isr-install-raw-handler.c
+libscorecpu_a_SOURCES += nios2-isr-install-vector.c
+libscorecpu_a_SOURCES += nios2-isr-is-in-progress.c
+libscorecpu_a_SOURCES += nios2-isr-set-level.c
+libscorecpu_a_SOURCES += nios2-thread-dispatch-disabled.c
+
</font> libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
all-local: $(PREINSTALL_FILES)
<font color='#006600'>diff -u rtems/cpukit/score/cpu/nios2/irq.c:1.11 rtems/cpukit/score/cpu/nios2/irq.c:1.12
--- rtems/cpukit/score/cpu/nios2/irq.c:1.11 Thu Aug 18 04:00:14 2011
+++ rtems/cpukit/score/cpu/nios2/irq.c Thu Sep 1 10:52:12 2011
</font><font color='#997700'>@@ -21,6 +21,7 @@
</font> #include <rtems/score/cpu.h>
#include <rtems/score/isr.h>
#include <rtems/score/thread.h>
<font color='#000088'>+#include <rtems/score/nios2-utility.h>
</font>
/*
* This routine provides the RTEMS interrupt management.
<font color='#997700'>@@ -53,7 +54,7 @@
</font> * this is the case.
*/
<font color='#880000'>- _CPU_read_ipending (active);
</font><font color='#000088'>+ active = _Nios2_Get_ctlreg_ipending();
</font>
while (active)
{
<font color='#997700'>@@ -77,7 +78,7 @@
</font> ++vector;
};
<font color='#880000'>- _CPU_read_ipending (active);
</font><font color='#000088'>+ active = _Nios2_Get_ctlreg_ipending();
</font> }
}
<font color='#006600'>diff -u /dev/null rtems/cpukit/score/cpu/nios2/nios2-context-initialize.c:1.1
--- /dev/null Thu Sep 1 11:12:14 2011
+++ rtems/cpukit/score/cpu/nios2/nios2-context-initialize.c Thu Sep 1 10:52:12 2011
</font><font color='#997700'>@@ -0,0 +1,41 @@
</font><font color='#000088'>+/*
+ * Copyright (c) 2011 embedded brains GmbH
+ *
+ * Copyright (c) 2006 Kolja Waschk (rtemsdev/ixo.de)
+ *
+ * COPYRIGHT (c) 1989-2006
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
+#include <rtems/score/cpu.h>
+#include <string.h>
+
+void _CPU_Context_Initialize(
+ Context_Control *context,
+ void *stack_area_begin,
+ size_t stack_area_size,
+ uint32_t new_level,
+ void (*entry_point)( void ),
+ bool is_fp
+)
+{
+ uint32_t stack = (uint32_t) stack_area_begin + stack_area_size - 4;
+
+ memset(context, 0, sizeof(*context));
+
+ context->fp = stack;
+ context->sp = stack;
+ context->ra = (uint32_t) entry_point;
+ /* @todo Add EIC support. */
+ context->status = new_level ? 0 : 1;
+}
</font>
<font color='#006600'>diff -u /dev/null rtems/cpukit/score/cpu/nios2/nios2-context-switch.S:1.1
--- /dev/null Thu Sep 1 11:12:14 2011
+++ rtems/cpukit/score/cpu/nios2/nios2-context-switch.S Thu Sep 1 10:52:12 2011
</font><font color='#997700'>@@ -0,0 +1,71 @@
</font><font color='#000088'>+/*
+ * Copyright (c) 2011 embedded brains GmbH
+ *
+ * Copyright (c) 2006 Kolja Waschk (rtemsdev/ixo.de)
+ *
+ * Derived from no_cpu/cpu_asm.S, copyright (c) 1989-1999,
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
+#include <rtems/score/cpu.h>
+#include <rtems/score/nios2-utility.h>
+
+ .extern _Nios2_Thread_dispatch_disabled
+
+ .globl _CPU_Context_switch
+ .globl _CPU_Context_restore
+
+_CPU_Context_switch:
+
+ movhi r12, %hiadj(_Nios2_Thread_dispatch_disabled)
+ addi r12, r12, %lo(_Nios2_Thread_dispatch_disabled)
+ ldw r9, 0(r12)
+ rdctl r8, status
+ stw r16, NIOS2_CONTEXT_OFFSET_R16(r4)
+ stw r17, NIOS2_CONTEXT_OFFSET_R17(r4)
+ stw r18, NIOS2_CONTEXT_OFFSET_R18(r4)
+ stw r19, NIOS2_CONTEXT_OFFSET_R19(r4)
+ stw r20, NIOS2_CONTEXT_OFFSET_R20(r4)
+ stw r21, NIOS2_CONTEXT_OFFSET_R21(r4)
+ stw r22, NIOS2_CONTEXT_OFFSET_R22(r4)
+ stw r23, NIOS2_CONTEXT_OFFSET_R23(r4)
+ stw fp, NIOS2_CONTEXT_OFFSET_FP(r4)
+ stw r8, NIOS2_CONTEXT_OFFSET_STATUS(r4)
+ stw sp, NIOS2_CONTEXT_OFFSET_SP(r4)
+ stw ra, NIOS2_CONTEXT_OFFSET_RA(r4)
+ stw r9, NIOS2_CONTEXT_OFFSET_TDD(r4)
+
+restore:
+
+ ldw r10, NIOS2_CONTEXT_OFFSET_TDD(r5)
+ ldw r16, NIOS2_CONTEXT_OFFSET_R16(r5)
+ ldw r17, NIOS2_CONTEXT_OFFSET_R17(r5)
+ ldw r18, NIOS2_CONTEXT_OFFSET_R18(r5)
+ ldw r19, NIOS2_CONTEXT_OFFSET_R19(r5)
+ ldw r20, NIOS2_CONTEXT_OFFSET_R20(r5)
+ ldw r21, NIOS2_CONTEXT_OFFSET_R21(r5)
+ ldw r22, NIOS2_CONTEXT_OFFSET_R22(r5)
+ ldw r23, NIOS2_CONTEXT_OFFSET_R23(r5)
+ ldw fp, NIOS2_CONTEXT_OFFSET_FP(r5)
+ stw r10, 0(r12)
+ ldw r11, NIOS2_CONTEXT_OFFSET_STATUS(r5)
+ ldw sp, NIOS2_CONTEXT_OFFSET_SP(r5)
+ ldw ra, NIOS2_CONTEXT_OFFSET_RA(r5)
+ wrctl status, r11
+
+ ret
+
+_CPU_Context_restore:
+
+ mov r5, r4
+ br restore
</font>
<font color='#006600'>diff -u /dev/null rtems/cpukit/score/cpu/nios2/nios2-fatal-halt.c:1.1
--- /dev/null Thu Sep 1 11:12:14 2011
+++ rtems/cpukit/score/cpu/nios2/nios2-fatal-halt.c Thu Sep 1 10:52:12 2011
</font><font color='#997700'>@@ -0,0 +1,27 @@
</font><font color='#000088'>+/*
+ * Copyright (c) 2011 embedded brains GmbH
+ *
+ * Copyright (c) 2006 Kolja Waschk (rtemsdev/ixo.de)
+ *
+ * COPYRIGHT (c) 1989-2004.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#include <rtems/score/cpu.h>
+
+void _CPU_Fatal_halt( uint32_t _error )
+{
+ /* write 0 to status register (disable interrupts) */
+ __builtin_wrctl( 0, 0 );
+
+ /* write error code to ET register */
+ __asm__ volatile ("mov et, %z0" : : "rM" (_error));
+
+ while (1);
+}
</font>
<font color='#006600'>diff -u /dev/null rtems/cpukit/score/cpu/nios2/nios2-initialize-vectors.c:1.1
--- /dev/null Thu Sep 1 11:12:14 2011
+++ rtems/cpukit/score/cpu/nios2/nios2-initialize-vectors.c Thu Sep 1 10:52:12 2011
</font><font color='#997700'>@@ -0,0 +1,27 @@
</font><font color='#000088'>+/*
+ * Copyright (c) 2011 embedded brains GmbH
+ *
+ * Copyright (c) 2006 Kolja Waschk (rtemsdev/ixo.de)
+ *
+ * COPYRIGHT (c) 1989-2006
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
+#include <rtems/score/isr.h>
+
+#include <string.h>
+
+void _CPU_Initialize_vectors( void )
+{
+ memset(_ISR_Vector_table, 0, sizeof(ISR_Handler_entry) * ISR_NUMBER_OF_VECTORS);
+}
</font>
<font color='#006600'>diff -u /dev/null rtems/cpukit/score/cpu/nios2/nios2-initialize.c:1.1
--- /dev/null Thu Sep 1 11:12:14 2011
+++ rtems/cpukit/score/cpu/nios2/nios2-initialize.c Thu Sep 1 10:52:12 2011
</font><font color='#997700'>@@ -0,0 +1,23 @@
</font><font color='#000088'>+/*
+ * Copyright (c) 2006 Kolja Waschk (rtemsdev/ixo.de)
+ *
+ * COPYRIGHT (c) 1989-2006
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
+#include <rtems/score/cpu.h>
+
+void _CPU_Initialize( void )
+{
+ /* Nothing to do */
+}
</font>
<font color='#006600'>diff -u /dev/null rtems/cpukit/score/cpu/nios2/nios2-isr-get-level.c:1.1
--- /dev/null Thu Sep 1 11:12:14 2011
+++ rtems/cpukit/score/cpu/nios2/nios2-isr-get-level.c Thu Sep 1 10:52:12 2011
</font><font color='#997700'>@@ -0,0 +1,46 @@
</font><font color='#000088'>+/*
+ * Copyright (c) 2011 embedded brains GmbH
+ *
+ * Copyright (c) 2006 Kolja Waschk (rtemsdev/ixo.de)
+ *
+ * COPYRIGHT (c) 1989-2006
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
+#include <rtems/score/cpu.h>
+#include <rtems/score/interr.h>
+#include <rtems/score/nios2-utility.h>
+
+uint32_t _CPU_ISR_Get_level( void )
+{
+ uint32_t status = _Nios2_Get_ctlreg_status();
+ uint32_t level = 0;
+
+ switch ( _Nios2_Get_ISR_status_mask() ) {
+ case NIOS2_ISR_STATUS_MASK_IIC:
+ level = (status & NIOS2_STATUS_PIE) == 0;
+ break;
+ case NIOS2_ISR_STATUS_MASK_EIC_IL:
+ level = (status & NIOS2_STATUS_IL_MASK) >> NIOS2_STATUS_IL_OFFSET;
+ break;
+ case NIOS2_ISR_STATUS_MASK_EIC_RSIE:
+ level = (status & NIOS2_STATUS_RSIE) == 0;
+ break;
+ default:
+ /* FIXME */
+ _Internal_error_Occurred( INTERNAL_ERROR_CORE, false, 0xdeadbeef );
+ break;
+ }
+
+ return level;
+}
</font>
<font color='#006600'>diff -u /dev/null rtems/cpukit/score/cpu/nios2/nios2-isr-install-raw-handler.c:1.1
--- /dev/null Thu Sep 1 11:12:14 2011
+++ rtems/cpukit/score/cpu/nios2/nios2-isr-install-raw-handler.c Thu Sep 1 10:52:12 2011
</font><font color='#997700'>@@ -0,0 +1,38 @@
</font><font color='#000088'>+/*
+ * Copyright (c) 2006 Kolja Waschk (rtemsdev/ixo.de)
+ *
+ * COPYRIGHT (c) 1989-2006
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
+#include <rtems/score/cpu.h>
+
+/*
+ * _CPU_ISR_install_raw_handler
+ *
+ * NO_CPU Specific Information:
+ *
+ * XXX document implementation including references if appropriate
+ */
+
+void _CPU_ISR_install_raw_handler(
+ uint32_t vector,
+ proc_ptr new_handler,
+ proc_ptr *old_handler
+)
+{
+ /*
+ * This is where we install the interrupt handler into the "raw" interrupt
+ * table used by the CPU to dispatch interrupt handlers.
+ */
+}
</font>
<font color='#006600'>diff -u /dev/null rtems/cpukit/score/cpu/nios2/nios2-isr-install-vector.c:1.1
--- /dev/null Thu Sep 1 11:12:14 2011
+++ rtems/cpukit/score/cpu/nios2/nios2-isr-install-vector.c Thu Sep 1 10:52:12 2011
</font><font color='#997700'>@@ -0,0 +1,61 @@
</font><font color='#000088'>+/*
+ * Copyright (c) 2006 Kolja Waschk (rtemsdev/ixo.de)
+ *
+ * COPYRIGHT (c) 1989-2006
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
+#include <rtems/score/isr.h>
+
+/*
+ * _CPU_ISR_install_vector
+ *
+ * This kernel routine installs the RTEMS handler for the
+ * specified vector.
+ *
+ * Input parameters:
+ * vector - interrupt vector number
+ * old_handler - former ISR for this vector number
+ * new_handler - replacement ISR for this vector number
+ *
+ * Output parameters: NONE
+ *
+ *
+ * NO_CPU Specific Information:
+ *
+ * XXX document implementation including references if appropriate
+ */
+
+void _CPU_ISR_install_vector(
+ uint32_t vector,
+ proc_ptr new_handler,
+ proc_ptr *old_handler
+)
+{
+ *old_handler = _ISR_Vector_table[ vector ];
+
+ /*
+ * If the interrupt vector table is a table of pointer to isr entry
+ * points, then we need to install the appropriate RTEMS interrupt
+ * handler for this vector number.
+ */
+
+ _CPU_ISR_install_raw_handler( vector, new_handler, old_handler );
+
+ /*
+ * We put the actual user ISR address in '_ISR_vector_table'. This will
+ * be used by the _ISR_Handler so the user gets control.
+ */
+
+ _ISR_Vector_table[ vector ] = new_handler;
+}
</font>
<font color='#006600'>diff -u /dev/null rtems/cpukit/score/cpu/nios2/nios2-isr-is-in-progress.c:1.1
--- /dev/null Thu Sep 1 11:12:14 2011
+++ rtems/cpukit/score/cpu/nios2/nios2-isr-is-in-progress.c Thu Sep 1 10:52:12 2011
</font><font color='#997700'>@@ -0,0 +1,34 @@
</font><font color='#000088'>+/*
+ * Copyright (c) 2011 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Obere Lagerstr. 30
+ * 82178 Puchheim
+ * Germany
+ * <rtems@embedded-brains.de>
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/nios2-utility.h>
+
+bool _ISR_Is_in_progress( void )
+{
+ if ( _Nios2_Has_internal_interrupt_controller() ) {
+ return _ISR_Nest_level != 0;
+ } else {
+ uint32_t status = _Nios2_Get_ctlreg_status();
+
+ return (status & NIOS2_STATUS_IH) != 0;
+ }
+}
</font>
<font color='#006600'>diff -u /dev/null rtems/cpukit/score/cpu/nios2/nios2-isr-set-level.c:1.1
--- /dev/null Thu Sep 1 11:12:14 2011
+++ rtems/cpukit/score/cpu/nios2/nios2-isr-set-level.c Thu Sep 1 10:52:12 2011
</font><font color='#997700'>@@ -0,0 +1,54 @@
</font><font color='#000088'>+/*
+ * Copyright (c) 2011 embedded brains GmbH
+ *
+ * Copyright (c) 2006 Kolja Waschk (rtemsdev/ixo.de)
+ *
+ * COPYRIGHT (c) 1989-2006
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
+#include <rtems/score/cpu.h>
+#include <rtems/score/interr.h>
+#include <rtems/score/nios2-utility.h>
+
+void _CPU_ISR_Set_level( uint32_t new_level )
+{
+ uint32_t status = _Nios2_Get_ctlreg_status();
+
+ switch ( _Nios2_Get_ISR_status_mask() ) {
+ case NIOS2_ISR_STATUS_MASK_IIC:
+ if ( new_level == 0 ) {
+ status |= NIOS2_STATUS_PIE;
+ } else {
+ status &= ~NIOS2_STATUS_PIE;
+ }
+ break;
+ case NIOS2_ISR_STATUS_MASK_EIC_IL:
+ status &= ~NIOS2_STATUS_IL_MASK;
+ status |= (new_level << NIOS2_STATUS_IL_OFFSET) & NIOS2_STATUS_IL_MASK;
+ break;
+ case NIOS2_ISR_STATUS_MASK_EIC_RSIE:
+ if ( new_level == 0 ) {
+ status |= NIOS2_STATUS_RSIE;
+ } else {
+ status &= ~NIOS2_STATUS_RSIE;
+ }
+ break;
+ default:
+ /* FIXME */
+ _Internal_error_Occurred( INTERNAL_ERROR_CORE, false, 0xdeadbeef );
+ break;
+ }
+
+ _Nios2_Set_ctlreg_status( status );
+}
</font>
<font color='#006600'>diff -u /dev/null rtems/cpukit/score/cpu/nios2/nios2-thread-dispatch-disabled.c:1.1
--- /dev/null Thu Sep 1 11:12:14 2011
+++ rtems/cpukit/score/cpu/nios2/nios2-thread-dispatch-disabled.c Thu Sep 1 10:52:12 2011
</font><font color='#997700'>@@ -0,0 +1,45 @@
</font><font color='#000088'>+/*
+ * Copyright (c) 2011 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Obere Lagerstr. 30
+ * 82178 Puchheim
+ * Germany
+ * <rtems@embedded-brains.de>
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/nios2-utility.h>
+
+#define NIOS2_ASSERT_OFFSET(field, off) \
+ RTEMS_STATIC_ASSERT( \
+ RTEMS_offsetof(Context_Control, field) \
+ == NIOS2_CONTEXT_OFFSET_ ## off, \
+ nios2_context_offset_ ## field \
+ )
+
+NIOS2_ASSERT_OFFSET(r16, R16);
+NIOS2_ASSERT_OFFSET(r17, R17);
+NIOS2_ASSERT_OFFSET(r18, R18);
+NIOS2_ASSERT_OFFSET(r19, R19);
+NIOS2_ASSERT_OFFSET(r20, R20);
+NIOS2_ASSERT_OFFSET(r21, R21);
+NIOS2_ASSERT_OFFSET(r22, R22);
+NIOS2_ASSERT_OFFSET(r23, R23);
+NIOS2_ASSERT_OFFSET(fp, FP);
+NIOS2_ASSERT_OFFSET(status, STATUS);
+NIOS2_ASSERT_OFFSET(sp, SP);
+NIOS2_ASSERT_OFFSET(ra, RA);
+NIOS2_ASSERT_OFFSET(thread_dispatch_disabled, TDD);
+
+uint32_t _Nios2_Thread_dispatch_disabled;
</font>
<font color='#006600'>diff -u rtems/cpukit/score/cpu/nios2/preinstall.am:1.5 rtems/cpukit/score/cpu/nios2/preinstall.am:1.6
--- rtems/cpukit/score/cpu/nios2/preinstall.am:1.5 Wed Sep 10 10:41:37 2008
+++ rtems/cpukit/score/cpu/nios2/preinstall.am Thu Sep 1 10:52:12 2011
</font><font color='#997700'>@@ -35,6 +35,10 @@
</font> $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/nios2.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/nios2.h
<font color='#000088'>+$(PROJECT_INCLUDE)/rtems/score/nios2-utility.h: rtems/score/nios2-utility.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/nios2-utility.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/nios2-utility.h
+
</font> $(PROJECT_INCLUDE)/rtems/score/cpu_asm.h: rtems/score/cpu_asm.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/cpu_asm.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/cpu_asm.h
<font color='#006600'>diff -u rtems/cpukit/score/cpu/nios2/rtems/score/cpu.h:1.22 rtems/cpukit/score/cpu/nios2/rtems/score/cpu.h:1.23
--- rtems/cpukit/score/cpu/nios2/rtems/score/cpu.h:1.22 Thu Aug 18 04:00:14 2011
+++ rtems/cpukit/score/cpu/nios2/rtems/score/cpu.h Thu Sep 1 10:52:12 2011
</font><font color='#997700'>@@ -41,7 +41,7 @@
</font>
#define CPU_INTERRUPT_MAXIMUM_VECTOR_NUMBER (CPU_INTERRUPT_NUMBER_OF_VECTORS - 1)
<font color='#880000'>-#define CPU_PROVIDES_ISR_IS_IN_PROGRESS FALSE
</font><font color='#000088'>+#define CPU_PROVIDES_ISR_IS_IN_PROGRESS TRUE
</font>
#define CPU_HAS_HARDWARE_INTERRUPT_STACK FALSE
<font color='#997700'>@@ -86,9 +86,20 @@
</font>
#define CPU_PARTITION_ALIGNMENT CPU_ALIGNMENT
<font color='#880000'>-#define CPU_STACK_ALIGNMENT CPU_ALIGNMENT
</font><font color='#000088'>+/*
+ * Alignment value according to "Nios II Processor Reference" chapter 7
+ * "Application Binary Interface" section "Stacks".
+ */
+#define CPU_STACK_ALIGNMENT 4
</font>
<font color='#880000'>-#define CPU_MODES_INTERRUPT_MASK 0x1
</font><font color='#000088'>+/*
+ * A Nios II configuration with an external interrupt controller (EIC) supports
+ * up to 64 interrupt levels. A Nios II configuration with an internal
+ * interrupt controller (IIC) has only two interrupt levels (enabled and
+ * disabled). The _CPU_ISR_Get_level() and _CPU_ISR_Set_level() functions will
+ * take care about configuration specific mappings.
+ */
+#define CPU_MODES_INTERRUPT_MASK 0x3f
</font>
#define CPU_USE_GENERIC_BITFIELD_CODE TRUE
<font color='#997700'>@@ -106,6 +117,11 @@
</font> *
* There is no need to save the global pointer (gp) since it is a system wide
* constant and set-up with the C runtime environment.
<font color='#000088'>+ *
+ * The @a thread_dispatch_disabled field is used for the external interrupt
+ * controller (EIC) support.
+ *
+ * @see _Nios2_Thread_dispatch_disabled
</font> */
typedef struct {
uint32_t r16;
<font color='#997700'>@@ -117,9 +133,10 @@
</font> uint32_t r22;
uint32_t r23;
uint32_t fp;
<font color='#000088'>+ uint32_t status;
</font> uint32_t sp;
uint32_t ra;
<font color='#880000'>- uint32_t status;
</font><font color='#000088'>+ uint32_t thread_dispatch_disabled;
</font> } Context_Control;
#define _CPU_Context_Get_SP( _context ) \
<font color='#997700'>@@ -182,118 +199,123 @@
</font> uint32_t ipending;
} CPU_Exception_frame;
<font color='#880000'>-#if (CPU_SIMPLE_VECTORED_INTERRUPTS == TRUE)
-#define _CPU_Initialize_vectors() \
- memset(_ISR_Vector_table, 0, sizeof(ISR_Handler_entry) * ISR_NUMBER_OF_VECTORS)
-#else
-#define _CPU_Initialize_vectors()
-#endif
-
-/**
- * @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)
</font><font color='#000088'>+void _CPU_Initialize_vectors( void );
</font>
/**
<font color='#880000'>- * Disable all interrupts for a critical section. The previous
- * level is returned in _level.
</font><font color='#000088'>+ * @brief Macro to disable interrupts.
+ *
+ * The processor status before disabling the interrupts will be stored in
+ * @a _isr_cookie. This value will be used in _CPU_ISR_Flash() and
+ * _CPU_ISR_Enable().
+ *
+ * The global symbol _Nios2_ISR_Status_mask will be used to clear the bits in
+ * the status register representing the interrupt level. The global symbol
+ * _Nios2_ISR_Status_bits will be used to set the bits representing an
+ * interrupt level that disables interrupts. Both global symbols must be
+ * provided by the board support package.
+ *
+ * In case the Nios II uses the internal interrupt controller (IIC), then only
+ * the PIE status bit is used.
+ *
+ * In case the Nios II uses the external interrupt controller (EIC), then the
+ * RSIE status bit or the IL status field is used depending on the interrupt
+ * handling variant and the shadow register usage.
</font> */
#define _CPU_ISR_Disable( _isr_cookie ) \
do { \
<font color='#880000'>- _isr_cookie = __builtin_rdctl( 0 ); \
- __builtin_wrctl( 0, 0 ); \
</font><font color='#000088'>+ int _tmp; \
+ __asm__ volatile ( \
+ "rdctl %0, status\n" \
+ "movhi %1, %%hiadj(_Nios2_ISR_Status_mask)\n" \
+ "addi %1, %1, %%lo(_Nios2_ISR_Status_mask)\n" \
+ "and %1, %0, %1\n" \
+ "ori %1, %1, %%lo(_Nios2_ISR_Status_bits)\n" \
+ "wrctl status, %1" \
+ : "=&r" (_isr_cookie), "=&r" (_tmp) \
+ ); \
</font> } while ( 0 )
/**
<font color='#880000'>- * 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><font color='#000088'>+ * @brief Macro to restore the processor status.
+ *
+ * The @a _isr_cookie must contain the processor status returned by
+ * _CPU_ISR_Disable(). The value is not modified.
</font> */
#define _CPU_ISR_Enable( _isr_cookie ) \
<font color='#880000'>- do { \
- __builtin_wrctl( 0, (int) _isr_cookie ); \
- } while ( 0 )
</font><font color='#000088'>+ __builtin_wrctl( 0, (int) _isr_cookie )
</font>
/**
<font color='#880000'>- * 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><font color='#000088'>+ * @brief Macro to restore the processor status and disable the interrupts
+ * again.
+ *
+ * The @a _isr_cookie must contain the processor status returned by
+ * _CPU_ISR_Disable(). The value is not modified.
+ *
+ * This flash code is optimal for all Nios II configurations. The rdctl does
+ * not flush the pipeline and has only a late result penalty. The wrctl on the
+ * other hand leads to a pipeline flush.
</font> */
#define _CPU_ISR_Flash( _isr_cookie ) \
do { \
<font color='#000088'>+ int _status = __builtin_rdctl( 0 ); \
</font> __builtin_wrctl( 0, (int) _isr_cookie ); \
<font color='#880000'>- __builtin_wrctl( 0, 0 ); \
</font><font color='#000088'>+ __builtin_wrctl( 0, _status ); \
</font> } while ( 0 )
/**
<font color='#880000'>- * 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.
</font><font color='#000088'>+ * @brief Sets the interrupt level for the executing thread.
+ *
+ * The valid values of @a new_level depend on the Nios II configuration. A
+ * value of zero represents enabled interrupts in all configurations.
+ *
+ * @see _CPU_ISR_Get_level()
</font> */
<font color='#880000'>-#define _CPU_ISR_Set_level( new_level ) \
- _CPU_ISR_Enable( new_level == 0 ? 1 : 0 );
</font><font color='#000088'>+void _CPU_ISR_Set_level( uint32_t new_level );
</font>
/**
<font color='#880000'>- * @brief Obtain the Current Interrupt Disable Level
- *
- * This method is invoked to return the current interrupt disable level.
</font><font color='#000088'>+ * @brief Returns the interrupt level of the executing thread.
</font> *
<font color='#880000'>- * @return This method returns the current interrupt disable level.
</font><font color='#000088'>+ * @retval 0 Interrupts are enabled.
+ * @retval otherwise The value depends on the Nios II configuration. In case
+ * of an internal interrupt controller (IIC) the only valid value is one which
+ * indicates disabled interrupts. In case of an external interrupt controller
+ * (EIC) there are two possibilities. Firstly if the RSIE status bit is used
+ * to disable interrupts, then one is the only valid value indicating disabled
+ * interrupts. Secondly if the IL status field is used to disable interrupts,
+ * then this value will be returned. Interrupts are disabled at the maximum
+ * level specified by the _Nios2_ISR_Status_bits.
</font> */
uint32_t _CPU_ISR_Get_level( void );
/**
<font color='#880000'>- * Initialize the context to a state suitable for starting a
- * task after a context restore operation. Generally, this
- * involves:
- *
</font><font color='#000088'>+ * @brief Initializes the CPU context.
+ *<span style="background-color: #FF0000"> </span>
+ * The following steps are performed:
</font> * - setting a starting address
* - preparing the stack
* - preparing the stack and frame pointers
* - setting the proper interrupt level in the context
<font color='#880000'>- * - initializing the floating point context
</font> *
<font color='#880000'>- * @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
</font><font color='#000088'>+ * @param[in] context points to the context area
+ * @param[in] stack_area_begin is the low address of the allocated stack area
+ * @param[in] stack_area_size is the size of the stack area in bytes
</font> * @param[in] new_level is the interrupt level for the task
* @param[in] entry_point is the task's entry point
<font color='#880000'>- * @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='#000088'>+ * @param[in] is_fp is set to @c true if the task is a floating point task
</font> */
void _CPU_Context_Initialize(
<font color='#880000'>- Context_Control *the_context,
- uint32_t *stack_base,
- uint32_t size,
- uint32_t new_level,
- void *entry_point,
- bool is_fp
</font><font color='#000088'>+ Context_Control *context,
+ void *stack_area_begin,
+ size_t stack_area_size,
+ uint32_t new_level,
+ void (*entry_point)( void ),
+ bool is_fp
</font> );
#define _CPU_Context_Restart_self( _the_context ) \
_CPU_Context_restore( (_the_context) );
<font color='#880000'>-#define _CPU_Fatal_halt( _error ) \
- do { \
- __builtin_wrctl(0, 0); /* write 0 to status register (disable interrupts) */ \
- __asm volatile ("mov et, %z0" : : "rM" (_error)); /* write error code to ET register */ \
- for (;;); \
- } while ( 0 )
</font><font color='#000088'>+void _CPU_Fatal_halt( uint32_t _error ) RTEMS_COMPILER_NO_RETURN_ATTRIBUTE;
</font>
void _CPU_Initialize( void );
<font color='#006600'>diff -u /dev/null rtems/cpukit/score/cpu/nios2/rtems/score/nios2-utility.h:1.1
--- /dev/null Thu Sep 1 11:12:15 2011
+++ rtems/cpukit/score/cpu/nios2/rtems/score/nios2-utility.h Thu Sep 1 10:52:12 2011
</font><font color='#997700'>@@ -0,0 +1,300 @@
</font><font color='#000088'>+/*
+ * Copyright (c) 2011 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Obere Lagerstr. 30
+ * 82178 Puchheim
+ * Germany
+ * <rtems@embedded-brains.de>
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#ifndef _RTEMS_SCORE_NIOS2_UTILITY_H
+#define _RTEMS_SCORE_NIOS2_UTILITY_H
+
+#define NIOS2_CTLREG_INDEX_STATUS 0
+#define NIOS2_CTLREG_INDEX_ESTATUS 1
+#define NIOS2_CTLREG_INDEX_BSTATUS 2
+#define NIOS2_CTLREG_INDEX_IENABLE 3
+#define NIOS2_CTLREG_INDEX_IPENDING 4
+#define NIOS2_CTLREG_INDEX_CPUID 5
+#define NIOS2_CTLREG_INDEX_EXCEPTION 7
+#define NIOS2_CTLREG_INDEX_PTEADDR 8
+#define NIOS2_CTLREG_INDEX_TLBACC 9
+#define NIOS2_CTLREG_INDEX_TLBMISC 10
+#define NIOS2_CTLREG_INDEX_BADADDR 12
+#define NIOS2_CTLREG_INDEX_CONFIG 13
+#define NIOS2_CTLREG_INDEX_MPUBASE 14
+#define NIOS2_CTLREG_INDEX_MPUACC 15
+
+#define NIOS2_CONTEXT_OFFSET_R16 0
+#define NIOS2_CONTEXT_OFFSET_R17 4
+#define NIOS2_CONTEXT_OFFSET_R18 8
+#define NIOS2_CONTEXT_OFFSET_R19 12
+#define NIOS2_CONTEXT_OFFSET_R20 16
+#define NIOS2_CONTEXT_OFFSET_R21 20
+#define NIOS2_CONTEXT_OFFSET_R22 24
+#define NIOS2_CONTEXT_OFFSET_R23 28
+#define NIOS2_CONTEXT_OFFSET_FP 32
+#define NIOS2_CONTEXT_OFFSET_STATUS 36
+#define NIOS2_CONTEXT_OFFSET_SP 40
+#define NIOS2_CONTEXT_OFFSET_RA 44
+#define NIOS2_CONTEXT_OFFSET_TDD 48
+
+#define NIOS2_ISR_STATUS_MASK_IIC 0xfffffffe
+#define NIOS2_ISR_STATUS_BITS_IIC 0x00000000
+
+#define NIOS2_ISR_STATUS_MASK_EIC_IL 0xfffffc0f
+#define NIOS2_ISR_STATUS_BITS_EIC_IL 0x000003f0
+
+#define NIOS2_ISR_STATUS_MASK_EIC_RSIE 0xf7ffffff
+#define NIOS2_ISR_STATUS_BITS_EIC_RSIE 0x00000000
+
+#define NIOS2_STATUS_RSIE (1 << 23)
+#define NIOS2_STATUS_NMI (1 << 22)
+#define NIOS2_STATUS_PRS_OFFSET 16
+#define NIOS2_STATUS_PRS_MASK (0x3f << NIOS2_STATUS_PRS_OFFSET)
+#define NIOS2_STATUS_CRS_OFFSET 10
+#define NIOS2_STATUS_CRS_MASK (0x3f << NIOS2_STATUS_CRS_OFFSET)
+#define NIOS2_STATUS_IL_OFFSET 4
+#define NIOS2_STATUS_IL_MASK (0x3f << NIOS2_STATUS_IL_OFFSET)
+#define NIOS2_STATUS_IH (1 << 3)
+#define NIOS2_STATUS_EH (1 << 2)
+#define NIOS2_STATUS_U (1 << 1)
+#define NIOS2_STATUS_PIE (1 << 0)
+
+#define NIOS2_EXCEPTION_CAUSE_OFFSET 2
+#define NIOS2_EXCEPTION_CAUSE_MASK (0x1f << NIOS2_EXCEPTION_CAUSE_OFFSET)
+
+#define NIOS2_PTEADDR_PTBASE_OFFSET 22
+#define NIOS2_PTEADDR_PTBASE_MASK (0x3ff << NIOS2_PTEADDR_PTBASE_OFFSET)
+#define NIOS2_PTEADDR_VPN_OFFSET 2
+#define NIOS2_PTEADDR_VPN_MASK (0xfffff << NIOS2_PTEADDR_VPN_OFFSET)
+
+#define NIOS2_TLBACC_IG_OFFSET 25
+#define NIOS2_TLBACC_IG_MASK (0x3ff << NIOS2_TLBACC_IG_OFFSET)
+#define NIOS2_TLBACC_C (1 << 24)
+#define NIOS2_TLBACC_R (1 << 23)
+#define NIOS2_TLBACC_W (1 << 22)
+#define NIOS2_TLBACC_X (1 << 21)
+#define NIOS2_TLBACC_G (1 << 20)
+#define NIOS2_TLBACC_PFN_OFFSET 2
+#define NIOS2_TLBACC_PFN_MASK (0xfffff << NIOS2_TLBACC_PFN_OFFSET)
+
+#define NIOS2_TLBMISC_WAY_OFFSET 20
+#define NIOS2_TLBMISC_WAY_MASK (0xf << NIOS2_TLBMISC_WAY_OFFSET)
+#define NIOS2_TLBMISC_RD (1 << 19)
+#define NIOS2_TLBMISC_WE (1 << 18)
+#define NIOS2_TLBMISC_PID_OFFSET 5
+#define NIOS2_TLBMISC_PID_MASK (0x3fff << NIOS2_TLBMISC_PID_OFFSET)
+#define NIOS2_TLBMISC_DBL (1 << 3)
+#define NIOS2_TLBMISC_BAD (1 << 2)
+#define NIOS2_TLBMISC_PERM (1 << 1)
+#define NIOS2_TLBMISC_D (1 << 0)
+
+#define NIOS2_CONFIG_ANI (1 << 1)
+#define NIOS2_CONFIG_PE (1 << 0)
+
+#define NIOS2_MPUBASE_BASE_OFFSET 5
+#define NIOS2_MPUBASE_BASE_MASK (0x1ffffff << NIOS2_MPUBASE_BASE_OFFSET)
+#define NIOS2_MPUBASE_INDEX_OFFSET 1
+#define NIOS2_MPUBASE_INDEX_MASK (0x1f << NIOS2_MPUBASE_INDEX_OFFSET)
+#define NIOS2_MPUBASE_D (1 << 0)
+
+#define NIOS2_MPUACC_MASK_OFFSET 6
+#define NIOS2_MPUACC_MASK_MASK (0x1ffffff << NIOS2_MPUACC_MASK_OFFSET)
+#define NIOS2_MPUACC_LIMIT_OFFSET 6
+#define NIOS2_MPUACC_LIMIT_MASK (0x3ffffff << NIOS2_MPUACC_LIMIT_OFFSET)
+#define NIOS2_MPUACC_C (1 << 5)
+#define NIOS2_MPUACC_PERM_OFFSET 2
+#define NIOS2_MPUACC_PERM_MASK (0x7 << NIOS2_MPUACC_PERM_OFFSET)
+#define NIOS2_MPUACC_RD (1 << 1)
+#define NIOS2_MPUACC_WR (1 << 0)
+
+#ifndef ASM
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * @brief Nios II specific thread dispatch disabled indicator.
+ *
+ * This global variable is used by the interrupt dispatch support for the
+ * external interrupt controller (EIC) with shadow registers. This makes it
+ * possible to do the thread dispatch after an interrupt without disabled
+ * interrupts and thus probably reduce the maximum interrupt latency. Its
+ * purpose is to prevent unbounded stack usage of the interrupted thread.
+ */
+extern uint32_t _Nios2_Thread_dispatch_disabled;
+
+/**
+ * @brief This global symbol specifies the status register mask used to disable
+ * interrupts.
+ *
+ * The board support package must provide a global symbol with this name to
+ * specifiy the status register mask used in _CPU_ISR_Disable().
+ */
+extern char _Nios2_ISR_Status_mask [];
+
+/**
+ * @brief This symbol specifies the status register bits used to disable
+ * interrupts.
+ *
+ * The board support package must provide a global symbol with this name to
+ * specifiy the status register bits used in _CPU_ISR_Disable().
+ */
+extern char _Nios2_ISR_Status_bits [];
+
+static inline uint32_t _Nios2_Get_ctlreg_status( void )
+{
+ return (uint32_t) __builtin_rdctl( NIOS2_CTLREG_INDEX_STATUS );
+}
+
+static inline void _Nios2_Set_ctlreg_status( uint32_t value )
+{
+ __builtin_wrctl( NIOS2_CTLREG_INDEX_STATUS, (int) value );
+}
+
+static inline uint32_t _Nios2_Get_ctlreg_estatus( void )
+{
+ return (uint32_t) __builtin_rdctl( NIOS2_CTLREG_INDEX_ESTATUS );
+}
+
+static inline void _Nios2_Set_ctlreg_estatus( uint32_t value )
+{
+ __builtin_wrctl( NIOS2_CTLREG_INDEX_ESTATUS, (int) value );
+}
+
+static inline uint32_t _Nios2_Get_ctlreg_bstatus( void )
+{
+ return (uint32_t) __builtin_rdctl( NIOS2_CTLREG_INDEX_BSTATUS );
+}
+
+static inline void _Nios2_Set_ctlreg_bstatus( uint32_t value )
+{
+ __builtin_wrctl( NIOS2_CTLREG_INDEX_BSTATUS, (int) value );
+}
+
+static inline uint32_t _Nios2_Get_ctlreg_ienable( void )
+{
+ return (uint32_t) __builtin_rdctl( NIOS2_CTLREG_INDEX_IENABLE );
+}
+
+static inline void _Nios2_Set_ctlreg_ienable( uint32_t value )
+{
+ __builtin_wrctl( NIOS2_CTLREG_INDEX_IENABLE, (int) value );
+}
+
+static inline uint32_t _Nios2_Get_ctlreg_ipending( void )
+{
+ return (uint32_t) __builtin_rdctl( NIOS2_CTLREG_INDEX_IPENDING );
+}
+
+static inline uint32_t _Nios2_Get_ctlreg_cpuid( void )
+{
+ return (uint32_t) __builtin_rdctl( NIOS2_CTLREG_INDEX_CPUID );
+}
+
+static inline uint32_t _Nios2_Get_ctlreg_exception( void )
+{
+ return (uint32_t) __builtin_rdctl( NIOS2_CTLREG_INDEX_EXCEPTION );
+}
+
+static inline uint32_t _Nios2_Get_ctlreg_pteaddr( void )
+{
+ return (uint32_t) __builtin_rdctl( NIOS2_CTLREG_INDEX_PTEADDR );
+}
+
+static inline void _Nios2_Set_ctlreg_pteaddr( uint32_t value )
+{
+ __builtin_wrctl( NIOS2_CTLREG_INDEX_PTEADDR, (int) value );
+}
+
+static inline uint32_t _Nios2_Get_ctlreg_tlbacc( void )
+{
+ return (uint32_t) __builtin_rdctl( NIOS2_CTLREG_INDEX_TLBACC );
+}
+
+static inline void _Nios2_Set_ctlreg_tlbacc( uint32_t value )
+{
+ __builtin_wrctl( NIOS2_CTLREG_INDEX_TLBACC, (int) value );
+}
+
+static inline uint32_t _Nios2_Get_ctlreg_tlbmisc( void )
+{
+ return (uint32_t) __builtin_rdctl( NIOS2_CTLREG_INDEX_TLBMISC );
+}
+
+static inline void _Nios2_Set_ctlreg_tlbmisc( uint32_t value )
+{
+ __builtin_wrctl( NIOS2_CTLREG_INDEX_TLBMISC, (int) value );
+}
+
+static inline uint32_t _Nios2_Get_ctlreg_badaddr( void )
+{
+ return (uint32_t) __builtin_rdctl( NIOS2_CTLREG_INDEX_BADADDR );
+}
+
+static inline uint32_t _Nios2_Get_ctlreg_config( void )
+{
+ return (uint32_t) __builtin_rdctl( NIOS2_CTLREG_INDEX_CONFIG );
+}
+
+static inline void _Nios2_Set_ctlreg_config( uint32_t value )
+{
+ __builtin_wrctl( NIOS2_CTLREG_INDEX_CONFIG, (int) value );
+}
+
+static inline uint32_t _Nios2_Get_ctlreg_mpubase( void )
+{
+ return (uint32_t) __builtin_rdctl( NIOS2_CTLREG_INDEX_MPUBASE );
+}
+
+static inline void _Nios2_Set_ctlreg_mpubase( uint32_t value )
+{
+ __builtin_wrctl( NIOS2_CTLREG_INDEX_MPUBASE, (int) value );
+}
+
+static inline uint32_t _Nios2_Get_ctlreg_mpuacc( void )
+{
+ return (uint32_t) __builtin_rdctl( NIOS2_CTLREG_INDEX_MPUACC );
+}
+
+static inline void _Nios2_Set_ctlreg_mpuacc( uint32_t value )
+{
+ __builtin_wrctl( NIOS2_CTLREG_INDEX_MPUACC, (int) value );
+}
+
+static inline uint32_t _Nios2_Get_ISR_status_mask( void )
+{
+ return (uint32_t) &_Nios2_ISR_Status_mask [0];
+}
+
+static inline uint32_t _Nios2_Get_ISR_status_bits( void )
+{
+ return (uint32_t) &_Nios2_ISR_Status_bits [0];
+}
+
+static inline bool _Nios2_Has_internal_interrupt_controller( void )
+{
+ uint32_t isr_status_mask = _Nios2_Get_ISR_status_mask();
+
+ return isr_status_mask == NIOS2_ISR_STATUS_MASK_IIC;
+}
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* !ASM */
+
+#endif /* _RTEMS_SCORE_NIOS2_UTILITY_H */
</font></pre>
<p> </p>
<a name='cs2'></a>
<table border='0' cellspacing='0' cellpadding='5' width='100%' bgcolor='#eeeeee'>
<tr><td colspan='3' bgcolor='#dddddd'>
<font color='#bb2222'><strong>sh</strong></font>
</td></tr>
<tr><td colspan='3' bgcolor='#dddddd'><pre>2011-09-01 Sebastian Huber <sebastian.huber@embedded-brains.de>
* startup/bspstart.c: Update due to API changes.
</pre></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libbsp/nios2/nios2_iss/ChangeLog.diff?r1=text&tr1=1.50&r2=text&tr2=1.51&diff_format=h">M</a></td><td width='1%'>1.51</td><td width='100%'>c/src/lib/libbsp/nios2/nios2_iss/ChangeLog</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libbsp/nios2/nios2_iss/startup/bspstart.c.diff?r1=text&tr1=1.7&r2=text&tr2=1.8&diff_format=h">M</a></td><td width='1%'>1.8</td><td width='100%'>c/src/lib/libbsp/nios2/nios2_iss/startup/bspstart.c</td></tr>
</table>
<pre>
<font color='#006600'>diff -u rtems/c/src/lib/libbsp/nios2/nios2_iss/ChangeLog:1.50 rtems/c/src/lib/libbsp/nios2/nios2_iss/ChangeLog:1.51
--- rtems/c/src/lib/libbsp/nios2/nios2_iss/ChangeLog:1.50 Fri Jul 29 09:06:56 2011
+++ rtems/c/src/lib/libbsp/nios2/nios2_iss/ChangeLog Thu Sep 1 10:57:09 2011
</font><font color='#997700'>@@ -1,3 +1,7 @@
</font><font color='#000088'>+2011-09-01 Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+ * startup/bspstart.c: Update due to API changes.
+
</font> 2011-07-29 Ralf Corsépius <ralf.corsepius@rtems.org>
* bsp_specs: Remove *lib (Anachronism).
<font color='#006600'>diff -u rtems/c/src/lib/libbsp/nios2/nios2_iss/startup/bspstart.c:1.7 rtems/c/src/lib/libbsp/nios2/nios2_iss/startup/bspstart.c:1.8
--- rtems/c/src/lib/libbsp/nios2/nios2_iss/startup/bspstart.c:1.7 Sun Sep 14 16:57:13 2008
+++ rtems/c/src/lib/libbsp/nios2/nios2_iss/startup/bspstart.c Thu Sep 1 10:57:09 2011
</font><font color='#997700'>@@ -16,16 +16,19 @@
</font> * $Id$
*/
<font color='#880000'>-#include <string.h>
</font><font color='#000088'>+#include <sys/cdefs.h>
</font>
<font color='#880000'>-#include <bsp.h>
</font><font color='#000088'>+#include <rtems.h>
+#include <rtems/score/nios2-utility.h>
</font>
<font color='#880000'>-/*
- * bsp_start
- *
- * This routine does the bulk of the system initialization.
- */
</font><font color='#000088'>+#include <bsp.h>
</font>
void bsp_start( void )
{
<font color='#000088'>+ __asm__ volatile (
+ ".globl _Nios2_ISR_Status_mask\n"
+ ".globl _Nios2_ISR_Status_bits\n"
+ ".set _Nios2_ISR_Status_mask, " __XSTRING(NIOS2_ISR_STATUS_MASK_IIC) "\n"
+ ".set _Nios2_ISR_Status_bits, " __XSTRING(NIOS2_ISR_STATUS_BITS_IIC)
+ );
</font> }
</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>