summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@oarcorp.com>2012-02-02 16:57:42 -0600
committerJoel Sherrill <joel.sherrill@oarcorp.com>2012-02-02 16:57:42 -0600
commit5d44355937fddc26485ac691a4ceba3f1c169ecf (patch)
treea776fae3b49e32ddca1fce59c128e1736c4cf203
parentMerge remote branch 'upstream/master' (diff)
downloadrtems-5d44355937fddc26485ac691a4ceba3f1c169ecf.tar.bz2
PR 1991/cpukit - attr.c (really mode code) warning rework
This PR was about a warning for no previous prototype for rtems_interrupt_level_attribute. This method exists (like a few others) to have real bodies for Classic API services implemented as macros. These macros are not available from anything but C and C++. The most explicit use was in the Ada binding but these would be needed from assembly language or any other non-C based language. On top of needing a prototype, the methods were misnamed. They were related to modes. This renames them, moves the file, fixes test code, etc.
-rw-r--r--c/src/ada/rtems.ads4
-rw-r--r--cpukit/rtems/Makefile.am2
-rw-r--r--cpukit/rtems/include/rtems/rtems/modes.h21
-rw-r--r--cpukit/rtems/src/modes.c (renamed from cpukit/rtems/src/attr.c)18
-rw-r--r--testsuites/sptests/sp37/init.c41
-rw-r--r--testsuites/sptests/sp37/sp37.doc2
-rw-r--r--testsuites/sptests/sp37/system.h8
7 files changed, 60 insertions, 36 deletions
diff --git a/c/src/ada/rtems.ads b/c/src/ada/rtems.ads
index 32dc642100..bb6dcd1fe5 100644
--- a/c/src/ada/rtems.ads
+++ b/c/src/ada/rtems.ads
@@ -206,8 +206,8 @@ pragma Elaborate_Body (RTEMS);
function Interrupt_Level (
Level : in RTEMS.Unsigned32
- ) return RTEMS.Attribute;
- pragma Import (C, Interrupt_Level, "rtems_interrupt_level_attribute");
+ ) return RTEMS.Mode;
+ pragma Import (C, Interrupt_Level, "rtems_interrupt_level_body");
Minimum_Stack_Size : RTEMS.Unsigned32;
pragma Import (C, Minimum_Stack_Size, "rtems_minimum_stack_size");
diff --git a/cpukit/rtems/Makefile.am b/cpukit/rtems/Makefile.am
index 6dc67e03a1..e9f990626e 100644
--- a/cpukit/rtems/Makefile.am
+++ b/cpukit/rtems/Makefile.am
@@ -255,7 +255,7 @@ librtems_a_SOURCES += src/dpmemdata.c
## WORKSPACE_FILES
librtems_a_SOURCES += src/workspace.c
-librtems_a_SOURCES += src/attr.c
+librtems_a_SOURCES += src/modes.c
librtems_a_SOURCES += src/status.c
diff --git a/cpukit/rtems/include/rtems/rtems/modes.h b/cpukit/rtems/include/rtems/rtems/modes.h
index 0665d17c8b..c24b072acf 100644
--- a/cpukit/rtems/include/rtems/rtems/modes.h
+++ b/cpukit/rtems/include/rtems/rtems/modes.h
@@ -96,6 +96,27 @@ typedef uint32_t Modes_Control;
#define RTEMS_INTERRUPT_LEVEL( _mode_set ) \
( (_mode_set) & RTEMS_INTERRUPT_MASK )
+/**
+ * @brief Interrupt Mask Variable
+ *
+ * This variable is used by bindings from languages other than C and C++.
+ */
+extern const uint32_t rtems_interrupt_mask;
+
+/**
+ * @brief Body for RTEMS_INTERRUPT_LEVEL macro.
+ *
+ * @param[in] level is the desired interrupt level
+ *
+ * @return This methods returns a mode with the desired interrupt
+ * @a level in the proper bitfield location.
+ *
+ * @note This variable is used by bindings from languages other than
+ * C and C++.
+ */
+Modes_Control rtems_interrupt_level_body(
+ uint32_t level
+);
#ifndef __RTEMS_APPLICATION__
#include <rtems/rtems/modes.inl>
diff --git a/cpukit/rtems/src/attr.c b/cpukit/rtems/src/modes.c
index 2312d36bb5..0c51281177 100644
--- a/cpukit/rtems/src/attr.c
+++ b/cpukit/rtems/src/modes.c
@@ -1,15 +1,19 @@
-/*
- * Body for Attribute Routines
+/**
+ * @file
*
+ * @body Body for Mode Routines Implemented as Macros
*
- * COPYRIGHT (c) 1989-1999.
+ * This file contains bodies for Mode Macros which are
+ * needed by language bindings other than C and C++.
+ */
+
+/*
+ * COPYRIGHT (c) 1989-2012.
* 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$
*/
#if HAVE_CONFIG_H
@@ -21,9 +25,9 @@
#include <rtems/score/stack.h>
#include <rtems/rtems/modes.h>
-uint32_t rtems_interrupt_mask = RTEMS_INTERRUPT_MASK;
+const uint32_t rtems_interrupt_mask = RTEMS_INTERRUPT_MASK;
-rtems_attribute rtems_interrupt_level_attribute(
+Modes_Control rtems_interrupt_level_body(
uint32_t level
)
{
diff --git a/testsuites/sptests/sp37/init.c b/testsuites/sptests/sp37/init.c
index f62404a4fb..870316acfb 100644
--- a/testsuites/sptests/sp37/init.c
+++ b/testsuites/sptests/sp37/init.c
@@ -1,28 +1,26 @@
-/*
+/**
+ * @brief Test for Bodies of Macros
+ *
* Interrupt Disable/Enable Tests
* Clock Tick from task level
- *
- * COPYRIGHT (c) 1989-2011.
+ */
+
+/*
+ * COPYRIGHT (c) 1989-2012.
* 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
-#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
#define CONFIGURE_INIT
#include "system.h"
-/* HACK: API visibilty violation */
-extern rtems_attribute rtems_interrupt_level_attribute(uint32_t level);
-
/* prototypes */
void test_interrupt_inline(void);
void check_isr_in_progress_inline(void);
@@ -48,9 +46,9 @@ rtems_timer_service_routine test_isr_in_progress(
void test_interrupt_inline(void)
{
rtems_interrupt_level level;
- rtems_attribute level_attribute;
- rtems_attribute level_attribute_macro;
- bool in_isr;
+ rtems_mode level_mode_body;
+ rtems_mode level_mode_macro;
+ bool in_isr;
puts( "interrupt is in progress (use body)" );
in_isr = rtems_interrupt_is_in_progress();
@@ -68,10 +66,10 @@ void test_interrupt_inline(void)
puts( "interrupt enable (use inline)" );
rtems_interrupt_enable( level );
- puts( "interrupt level attribute (use inline)" );
- level_attribute = rtems_interrupt_level_attribute( level );
- level_attribute_macro = RTEMS_INTERRUPT_LEVEL(level);
- if ( level_attribute_macro == level_attribute ) {
+ puts( "interrupt level mode (use inline)" );
+ level_mode_body = rtems_interrupt_level_body( level );
+ level_mode_macro = RTEMS_INTERRUPT_LEVEL(level);
+ if ( level_mode_macro == level_mode_body ) {
puts( "test case working.." );
}
}
@@ -189,7 +187,8 @@ rtems_task Init(
rtems_time_of_day time;
rtems_status_code status;
rtems_interrupt_level level;
- rtems_attribute level_attribute,level_attribute_macro;
+ rtems_mode level_mode_body;
+ rtems_mode level_mode_macro;
bool in_isr;
rtems_id timer;
int i;
@@ -296,10 +295,10 @@ rtems_task Init(
puts( "interrupt enable (use body)" );
rtems_interrupt_enable( level );
- puts( "interrupt level attribute (use body)" );
- level_attribute = rtems_interrupt_level_attribute( level );
- level_attribute_macro = RTEMS_INTERRUPT_LEVEL(level);
- if ( level_attribute_macro == level_attribute ) {
+ puts( "interrupt level mode (use body)" );
+ level_mode_body = rtems_interrupt_level_body( level );
+ level_mode_macro = RTEMS_INTERRUPT_LEVEL(level);
+ if ( level_mode_macro == level_mode_body ) {
puts("test seems to work");
}
diff --git a/testsuites/sptests/sp37/sp37.doc b/testsuites/sptests/sp37/sp37.doc
index 5ac0e1a281..bc259471d7 100644
--- a/testsuites/sptests/sp37/sp37.doc
+++ b/testsuites/sptests/sp37/sp37.doc
@@ -20,7 +20,7 @@ directives:
rtems_interrupt_enable (inline/body)
rtems_interrupt_flash (inline/body)
RTEMS_INTERRUPT_LEVEL
- rtems_interrupt_level_attribute
+ rtems_interrupt_level_body
concepts:
diff --git a/testsuites/sptests/sp37/system.h b/testsuites/sptests/sp37/system.h
index e09c6a35a4..ab648fdbd8 100644
--- a/testsuites/sptests/sp37/system.h
+++ b/testsuites/sptests/sp37/system.h
@@ -2,15 +2,15 @@
*
* This include file contains information that is included in every
* function in the test set.
- *
- * COPYRIGHT (c) 1989-2007.
+ */
+
+/*
+ * COPYRIGHT (c) 1989-2012.
* 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 <tmacros.h>