Changeset 5d443559 in rtems


Ignore:
Timestamp:
Feb 2, 2012, 10:57:42 PM (7 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.11, master
Children:
935ae4a
Parents:
1e1d0189
Message:

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.

Files:
6 edited
1 moved

Legend:

Unmodified
Added
Removed
  • c/src/ada/rtems.ads

    r1e1d0189 r5d443559  
    207207   function Interrupt_Level (
    208208      Level : in     RTEMS.Unsigned32
    209    ) return RTEMS.Attribute;
    210    pragma Import (C, Interrupt_Level, "rtems_interrupt_level_attribute");
     209   ) return RTEMS.Mode;
     210   pragma Import (C, Interrupt_Level, "rtems_interrupt_level_body");
    211211
    212212   Minimum_Stack_Size : RTEMS.Unsigned32;
  • cpukit/rtems/Makefile.am

    r1e1d0189 r5d443559  
    256256librtems_a_SOURCES += src/workspace.c
    257257
    258 librtems_a_SOURCES += src/attr.c
     258librtems_a_SOURCES += src/modes.c
    259259
    260260librtems_a_SOURCES += src/status.c
  • cpukit/rtems/include/rtems/rtems/modes.h

    r1e1d0189 r5d443559  
    9797  ( (_mode_set) & RTEMS_INTERRUPT_MASK )
    9898
     99/**
     100 *  @brief Interrupt Mask Variable
     101 *
     102 *  This variable is used by bindings from languages other than C and C++.
     103 */
     104extern const uint32_t rtems_interrupt_mask;
     105
     106/**
     107 *  @brief Body for RTEMS_INTERRUPT_LEVEL macro.
     108 *
     109 *  @param[in] level is the desired interrupt level
     110 *
     111 *  @return This methods returns a mode with the desired interrupt
     112 *          @a level in the proper bitfield location.
     113 *
     114 *  @note This variable is used by bindings from languages other than
     115 *        C and C++.
     116 */
     117Modes_Control rtems_interrupt_level_body(
     118  uint32_t   level
     119);
    99120
    100121#ifndef __RTEMS_APPLICATION__
  • cpukit/rtems/src/modes.c

    r1e1d0189 r5d443559  
     1/**
     2 *  @file
     3 *
     4 *  @body Body for Mode Routines Implemented as Macros
     5 *
     6 *  This file contains bodies for Mode Macros which are
     7 *  needed by language bindings other than C and C++.
     8 */
     9
    110/*
    2  *  Body for Attribute Routines
    3  *
    4  *
    5  *  COPYRIGHT (c) 1989-1999.
     11 *  COPYRIGHT (c) 1989-2012.
    612 *  On-Line Applications Research Corporation (OAR).
    713 *
     
    915 *  found in the file LICENSE in this distribution or at
    1016 *  http://www.rtems.com/license/LICENSE.
    11  *
    12  *  $Id$
    1317 */
    1418
     
    2226#include <rtems/rtems/modes.h>
    2327
    24 uint32_t  rtems_interrupt_mask = RTEMS_INTERRUPT_MASK;
     28const uint32_t rtems_interrupt_mask = RTEMS_INTERRUPT_MASK;
    2529
    26 rtems_attribute rtems_interrupt_level_attribute(
     30Modes_Control rtems_interrupt_level_body(
    2731  uint32_t   level
    2832)
  • testsuites/sptests/sp37/init.c

    r1e1d0189 r5d443559  
    1 /*
     1/**
     2 *  @brief Test for Bodies of Macros
     3 *
    24 *  Interrupt Disable/Enable Tests
    35 *  Clock Tick from task level
    4  *
    5  *  COPYRIGHT (c) 1989-2011.
     6 */
     7
     8/*
     9 *  COPYRIGHT (c) 1989-2012.
    610 *  On-Line Applications Research Corporation (OAR).
    711 *
     
    913 *  found in the file LICENSE in this distribution or at
    1014 *  http://www.rtems.com/license/LICENSE.
    11  *
    12  *  $Id$
    1315 */
    1416
     
    1719#endif
    1820
    19 #define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
    2021#define CONFIGURE_INIT
    2122#include "system.h"
    22 
    23 /* HACK: API visibilty violation */
    24 extern rtems_attribute rtems_interrupt_level_attribute(uint32_t level);
    2523
    2624/* prototypes */
     
    4947{
    5048  rtems_interrupt_level level;
    51   rtems_attribute level_attribute;
    52   rtems_attribute level_attribute_macro;
    53   bool            in_isr;
     49  rtems_mode            level_mode_body;
     50  rtems_mode            level_mode_macro;
     51  bool                  in_isr;
    5452
    5553  puts( "interrupt is in progress (use body)" );
     
    6967  rtems_interrupt_enable( level );
    7068
    71   puts( "interrupt level attribute (use inline)" );
    72   level_attribute = rtems_interrupt_level_attribute( level );
    73   level_attribute_macro = RTEMS_INTERRUPT_LEVEL(level);
    74   if ( level_attribute_macro == level_attribute ) {
     69  puts( "interrupt level mode (use inline)" );
     70  level_mode_body = rtems_interrupt_level_body( level );
     71  level_mode_macro = RTEMS_INTERRUPT_LEVEL(level);
     72  if ( level_mode_macro == level_mode_body ) {
    7573    puts( "test case working.." );
    7674  }
     
    190188  rtems_status_code     status;
    191189  rtems_interrupt_level level;
    192   rtems_attribute level_attribute,level_attribute_macro;
     190  rtems_mode            level_mode_body;
     191  rtems_mode            level_mode_macro;
    193192  bool                  in_isr;
    194193  rtems_id              timer;
     
    297296  rtems_interrupt_enable( level );
    298297
    299   puts( "interrupt level attribute (use body)" );
    300   level_attribute = rtems_interrupt_level_attribute( level );
    301   level_attribute_macro = RTEMS_INTERRUPT_LEVEL(level);
    302   if ( level_attribute_macro == level_attribute ) {
     298  puts( "interrupt level mode (use body)" );
     299  level_mode_body = rtems_interrupt_level_body( level );
     300  level_mode_macro = RTEMS_INTERRUPT_LEVEL(level);
     301  if ( level_mode_macro == level_mode_body ) {
    303302    puts("test seems to work");
    304303  }
  • testsuites/sptests/sp37/system.h

    r1e1d0189 r5d443559  
    33 *  This include file contains information that is included in every
    44 *  function in the test set.
    5  *
    6  *  COPYRIGHT (c) 1989-2007.
     5 */
     6
     7/*
     8 *  COPYRIGHT (c) 1989-2012.
    79 *  On-Line Applications Research Corporation (OAR).
    810 *
     
    1012 *  found in the file LICENSE in this distribution or at
    1113 *  http://www.rtems.com/license/LICENSE.
    12  *
    13  *  $Id$
    1414 */
    1515
Note: See TracChangeset for help on using the changeset viewer.