Changeset 7d91d72 in rtems


Ignore:
Timestamp:
Dec 13, 1999, 3:29:20 PM (22 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
d16faa2
Parents:
e9067989
Message:

First attempt at adding simple binary semaphore in addition to the current
"mutex" and counting semaphore. This is at the request of Eric Norum
and his EPICS porting effort.

Files:
8 added
17 edited

Legend:

Unmodified
Added
Removed
  • c/src/exec/rtems/include/rtems/rtems/attr.h

    re9067989 r7d91d72  
    4747#define RTEMS_PRIORITY_CEILING    0x00000040
    4848
     49#define RTEMS_NESTING_ALLOWED     0x00000000
     50#define RTEMS_NO_NESTING_ALLOWED  0x00000080
     51
    4952#define RTEMS_APPLICATION_TASK    0x00000000
    50 #define RTEMS_SYSTEM_TASK         0x00000080
     53#define RTEMS_SYSTEM_TASK         0x00000100
     54
    5155
    5256#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
  • c/src/exec/rtems/inline/rtems/rtems/attr.inl

    re9067989 r7d91d72  
    159159/*PAGE
    160160 *
     161 *  _Attributes_Is_nesting_allowed
     162 *
     163 *  DESCRIPTION:
     164 *
     165 *  This function returns TRUE if the nesting allowed attribute
     166 *  is enabled in the attribute_set and FALSE otherwise.
     167 */
     168 
     169RTEMS_INLINE_ROUTINE boolean _Attributes_Is_nesting_allowed(
     170  rtems_attribute attribute_set
     171)
     172{
     173   return ( !(attribute_set & RTEMS_NO_NESTING_ALLOWED) );
     174}
     175
     176/*PAGE
     177 *
    161178 *  _Attributes_Is_system_task
    162179 *
  • c/src/exec/rtems/macros/rtems/rtems/attr.inl

    re9067989 r7d91d72  
    9191/*PAGE
    9292 *
     93 *  _Attributes_Is_nesting_allowed
     94 *
     95 */
     96
     97#define _Attributes_Is_nesting_allowed( _attribute_set ) \
     98   ( !((_attribute_set) & RTEMS_NO_NESTING_ALLOWED) )
     99
     100/*PAGE
     101 *
    93102 *  _Attributes_Is_system_task
    94103 *
  • c/src/exec/rtems/src/semcreate.c

    re9067989 r7d91d72  
    130130    if ( _Attributes_Is_inherit_priority( attribute_set ) )
    131131      the_mutex_attributes.discipline = CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT;
    132     else if (_Attributes_Is_priority_ceiling( attribute_set ) )
     132    else if ( _Attributes_Is_priority_ceiling( attribute_set ) )
    133133      the_mutex_attributes.discipline = CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING;
    134     else if (_Attributes_Is_priority( attribute_set ) )
     134    else if ( _Attributes_Is_priority( attribute_set ) )
    135135      the_mutex_attributes.discipline = CORE_MUTEX_DISCIPLINES_PRIORITY;
    136136    else
    137137      the_mutex_attributes.discipline = CORE_MUTEX_DISCIPLINES_FIFO;
    138138
    139     the_mutex_attributes.allow_nesting = TRUE;
     139    if ( _Attributes_Is_nesting_allowed( attribute_set ) )
     140      the_mutex_attributes.allow_nesting = TRUE;
     141    else
     142      the_mutex_attributes.allow_nesting = FALSE;
    140143
    141144    /* Add priority ceiling code here ????? */
  • c/src/exec/rtems/src/semtranslatereturncode.c

    re9067989 r7d91d72  
    6868      return RTEMS_UNSATISFIED;
    6969    case CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED:
    70       return RTEMS_INTERNAL_ERROR;
     70      return RTEMS_UNSATISFIED;
    7171    case CORE_MUTEX_STATUS_NOT_OWNER_OF_RESOURCE:
    7272      return RTEMS_NOT_OWNER_OF_RESOURCE;
  • c/src/exec/score/src/coremutexseize.c

    re9067989 r7d91d72  
    9191      }
    9292    }
     93    executing->Wait.return_code = CORE_MUTEX_STATUS_SUCCESSFUL;
    9394    return;
    9495  }
  • c/src/exec/score/src/coremutexsurrender.c

    re9067989 r7d91d72  
    6262   */
    6363
    64   if ( !_Objects_Are_ids_equal(
    65            _Thread_Executing->Object.id, the_mutex->holder_id ) ) {
    66 
    67     switch ( the_mutex->Attributes.discipline ) {
    68       case CORE_MUTEX_DISCIPLINES_FIFO:
    69       case CORE_MUTEX_DISCIPLINES_PRIORITY:
    70         break;
    71       case CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING:
    72       case CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT:
    73         return( CORE_MUTEX_STATUS_NOT_OWNER_OF_RESOURCE );
    74         break;
     64  if ( the_mutex->Attributes.allow_nesting ) {
     65    if ( !_Objects_Are_ids_equal(
     66             _Thread_Executing->Object.id, the_mutex->holder_id ) ) {
     67 
     68      switch ( the_mutex->Attributes.discipline ) {
     69        case CORE_MUTEX_DISCIPLINES_FIFO:
     70        case CORE_MUTEX_DISCIPLINES_PRIORITY:
     71          break;
     72        case CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING:
     73        case CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT:
     74          return( CORE_MUTEX_STATUS_NOT_OWNER_OF_RESOURCE );
     75          break;
     76      }
    7577    }
    7678  }
     79
     80  /* XXX already unlocked -- not right status */
     81
     82  if ( !the_mutex->nest_count )
     83    return( CORE_MUTEX_STATUS_SUCCESSFUL );
    7784
    7885  the_mutex->nest_count--;
    7986
    8087  if ( the_mutex->nest_count != 0 )
    81     return( CORE_MUTEX_STATUS_SUCCESSFUL );
     88    return( CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED );
    8289
    8390  _Thread_Executing->resource_count--;
  • c/src/tests/sptests/Makefile.am

    re9067989 r7d91d72  
    88## sp10 and spfatal are not included for now
    99SUBDIRS = sp01 sp02 sp03 sp04 sp05 sp06 sp07 sp08 sp09 sp11 sp12 sp13 sp14 \
    10     sp15 sp16 sp17 sp19 sp20 sp21 sp22 sp23 sp24 sp25 sp26 sp27 sp28 spsize
     10    sp15 sp16 sp17 sp19 sp20 sp21 sp22 sp23 sp24 sp25 sp26 sp27 sp28 sp29 \
     11    spsize
    1112
    1213EXTRA_DIST = sptests.am spfatal
  • c/src/tests/sptests/configure.in

    re9067989 r7d91d72  
    6767sp27/Makefile
    6868sp28/Makefile
     69sp29/Makefile
    6970spsize/Makefile
    7071)
  • cpukit/rtems/include/rtems/rtems/attr.h

    re9067989 r7d91d72  
    4747#define RTEMS_PRIORITY_CEILING    0x00000040
    4848
     49#define RTEMS_NESTING_ALLOWED     0x00000000
     50#define RTEMS_NO_NESTING_ALLOWED  0x00000080
     51
    4952#define RTEMS_APPLICATION_TASK    0x00000000
    50 #define RTEMS_SYSTEM_TASK         0x00000080
     53#define RTEMS_SYSTEM_TASK         0x00000100
     54
    5155
    5256#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
  • cpukit/rtems/inline/rtems/rtems/attr.inl

    re9067989 r7d91d72  
    159159/*PAGE
    160160 *
     161 *  _Attributes_Is_nesting_allowed
     162 *
     163 *  DESCRIPTION:
     164 *
     165 *  This function returns TRUE if the nesting allowed attribute
     166 *  is enabled in the attribute_set and FALSE otherwise.
     167 */
     168 
     169RTEMS_INLINE_ROUTINE boolean _Attributes_Is_nesting_allowed(
     170  rtems_attribute attribute_set
     171)
     172{
     173   return ( !(attribute_set & RTEMS_NO_NESTING_ALLOWED) );
     174}
     175
     176/*PAGE
     177 *
    161178 *  _Attributes_Is_system_task
    162179 *
  • cpukit/rtems/macros/rtems/rtems/attr.inl

    re9067989 r7d91d72  
    9191/*PAGE
    9292 *
     93 *  _Attributes_Is_nesting_allowed
     94 *
     95 */
     96
     97#define _Attributes_Is_nesting_allowed( _attribute_set ) \
     98   ( !((_attribute_set) & RTEMS_NO_NESTING_ALLOWED) )
     99
     100/*PAGE
     101 *
    93102 *  _Attributes_Is_system_task
    94103 *
  • cpukit/rtems/src/semcreate.c

    re9067989 r7d91d72  
    130130    if ( _Attributes_Is_inherit_priority( attribute_set ) )
    131131      the_mutex_attributes.discipline = CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT;
    132     else if (_Attributes_Is_priority_ceiling( attribute_set ) )
     132    else if ( _Attributes_Is_priority_ceiling( attribute_set ) )
    133133      the_mutex_attributes.discipline = CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING;
    134     else if (_Attributes_Is_priority( attribute_set ) )
     134    else if ( _Attributes_Is_priority( attribute_set ) )
    135135      the_mutex_attributes.discipline = CORE_MUTEX_DISCIPLINES_PRIORITY;
    136136    else
    137137      the_mutex_attributes.discipline = CORE_MUTEX_DISCIPLINES_FIFO;
    138138
    139     the_mutex_attributes.allow_nesting = TRUE;
     139    if ( _Attributes_Is_nesting_allowed( attribute_set ) )
     140      the_mutex_attributes.allow_nesting = TRUE;
     141    else
     142      the_mutex_attributes.allow_nesting = FALSE;
    140143
    141144    /* Add priority ceiling code here ????? */
  • cpukit/rtems/src/semtranslatereturncode.c

    re9067989 r7d91d72  
    6868      return RTEMS_UNSATISFIED;
    6969    case CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED:
    70       return RTEMS_INTERNAL_ERROR;
     70      return RTEMS_UNSATISFIED;
    7171    case CORE_MUTEX_STATUS_NOT_OWNER_OF_RESOURCE:
    7272      return RTEMS_NOT_OWNER_OF_RESOURCE;
  • cpukit/score/src/coremutexseize.c

    re9067989 r7d91d72  
    9191      }
    9292    }
     93    executing->Wait.return_code = CORE_MUTEX_STATUS_SUCCESSFUL;
    9394    return;
    9495  }
  • cpukit/score/src/coremutexsurrender.c

    re9067989 r7d91d72  
    6262   */
    6363
    64   if ( !_Objects_Are_ids_equal(
    65            _Thread_Executing->Object.id, the_mutex->holder_id ) ) {
    66 
    67     switch ( the_mutex->Attributes.discipline ) {
    68       case CORE_MUTEX_DISCIPLINES_FIFO:
    69       case CORE_MUTEX_DISCIPLINES_PRIORITY:
    70         break;
    71       case CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING:
    72       case CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT:
    73         return( CORE_MUTEX_STATUS_NOT_OWNER_OF_RESOURCE );
    74         break;
     64  if ( the_mutex->Attributes.allow_nesting ) {
     65    if ( !_Objects_Are_ids_equal(
     66             _Thread_Executing->Object.id, the_mutex->holder_id ) ) {
     67 
     68      switch ( the_mutex->Attributes.discipline ) {
     69        case CORE_MUTEX_DISCIPLINES_FIFO:
     70        case CORE_MUTEX_DISCIPLINES_PRIORITY:
     71          break;
     72        case CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING:
     73        case CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT:
     74          return( CORE_MUTEX_STATUS_NOT_OWNER_OF_RESOURCE );
     75          break;
     76      }
    7577    }
    7678  }
     79
     80  /* XXX already unlocked -- not right status */
     81
     82  if ( !the_mutex->nest_count )
     83    return( CORE_MUTEX_STATUS_SUCCESSFUL );
    7784
    7885  the_mutex->nest_count--;
    7986
    8087  if ( the_mutex->nest_count != 0 )
    81     return( CORE_MUTEX_STATUS_SUCCESSFUL );
     88    return( CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED );
    8289
    8390  _Thread_Executing->resource_count--;
  • testsuites/sptests/Makefile.am

    re9067989 r7d91d72  
    88## sp10 and spfatal are not included for now
    99SUBDIRS = sp01 sp02 sp03 sp04 sp05 sp06 sp07 sp08 sp09 sp11 sp12 sp13 sp14 \
    10     sp15 sp16 sp17 sp19 sp20 sp21 sp22 sp23 sp24 sp25 sp26 sp27 sp28 spsize
     10    sp15 sp16 sp17 sp19 sp20 sp21 sp22 sp23 sp24 sp25 sp26 sp27 sp28 sp29 \
     11    spsize
    1112
    1213EXTRA_DIST = sptests.am spfatal
Note: See TracChangeset for help on using the changeset viewer.