Changeset 43b6f75 in rtems


Ignore:
Timestamp:
Nov 30, 2000, 2:08:30 PM (20 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
c1a24fbe
Parents:
7f8c11c
Message:

2000-11-30 Joel Sherrill <joel@…>

  • General effort to make things compile with macros not inlines
  • inline/rtems/score/coremutex.inl: Added comment indicating for macros there is another copy of _CORE_mutex_Seize_interrupt_trylock() in src/coremutexseize.c.
  • src/coremutexseize.c: Added body of _CORE_mutex_Seize_interrupt_trylock() for macro case.
  • macros/rtems/score/coremutex.inl: Added prototype for _CORE_mutex_Seize_interrupt_trylock() since there is a real body when macros are enabled.
  • macros/rtems/score/coresem.inl: Added macro implementation of _CORE_semaphore_Seize_isr_disable.
  • macros/score/Makefile.am: Fixed typos.
  • rtems/score/address.inl: Correct macro implementation of _Addresses_Is_aligned() so it would compile.
  • macros/rtems/score/coremsg.inl: Added closing parentheses.
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • c/src/exec/score/ChangeLog

    r7f8c11c r43b6f75  
     1
     22000-11-30      Joel Sherrill <joel@OARcorp.com>
     3
     4        * General effort to make things compile with macros not inlines
     5        * inline/rtems/score/coremutex.inl: Added comment indicating
     6        for macros there is another copy of
     7        _CORE_mutex_Seize_interrupt_trylock() in src/coremutexseize.c.
     8        * src/coremutexseize.c: Added body of
     9        _CORE_mutex_Seize_interrupt_trylock() for macro case.
     10        * macros/rtems/score/coremutex.inl: Added prototype for
     11        _CORE_mutex_Seize_interrupt_trylock() since there is a real
     12        body when macros are enabled.
     13        * macros/rtems/score/coresem.inl: Added macro implementation of
     14        _CORE_semaphore_Seize_isr_disable.
     15        * macros/score/Makefile.am: Fixed typos.
     16        * rtems/score/address.inl: Correct macro implementation of
     17        _Addresses_Is_aligned() so it would compile.
     18        * macros/rtems/score/coremsg.inl: Added closing parentheses.
    119       
    2202000-11-28      Chris Johns <ccj@acm.org>
  • c/src/exec/score/inline/rtems/score/coremutex.inl

    r7f8c11c r43b6f75  
    114114 *
    115115 *  NOTE: There is no MACRO version of this routine.
     116 *        A body is in coremutexseize.c that is duplicated
     117 *        from the .inl by hand.
    116118 */
    117119
  • c/src/exec/score/macros/rtems/score/Makefile.am

    r7f8c11c r43b6f75  
    1919I_FILES = $(STD_I_FILES) $(MP_I_FILES)
    2020else
    21 I_FILES = $(STD_I_FILES
     21I_FILES = $(STD_I_FILES)
    2222endif
    2323
    2424PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score \
    25     $(I_FILES:%=$(PROJECT_INCLUDE)/rtems/score%)
     25    $(I_FILES:%=$(PROJECT_INCLUDE)/rtems/score/%)
    2626
    2727$(PROJECT_INCLUDE)/rtems/score:
  • c/src/exec/score/macros/rtems/score/address.inl

    r7f8c11c r43b6f75  
    5353
    5454#if (CPU_ALIGNMENT == 0)
     55#define _Addresses_Is_aligned( _address ) \
    5556    (TRUE)
    5657#elif defined(RTEMS_CPU_HAS_16_BIT_ADDRESSES)
     58#define _Addresses_Is_aligned( _address ) \
    5759    ( ( (unsigned short)(_address) % CPU_ALIGNMENT ) == 0 )
     60#else
    5861#define _Addresses_Is_aligned( _address ) \
    5962    ( ( (unsigned32)(_address) % CPU_ALIGNMENT ) == 0 )
    60 #else
    6163#endif
    6264
  • c/src/exec/score/macros/rtems/score/coremsg.inl

    r7f8c11c r43b6f75  
    2222 *
    2323 */
    24  
     24
    2525#define _CORE_message_queue_Send( _the_message_queue, _buffer, _size, \
    2626       _id, _api_message_queue_mp_support, _wait, _timeout ) \
    2727  _CORE_message_queue_Submit( (_the_message_queue), (_buffer), (_size), \
    2828     (_id), (_api_message_queue_mp_support), \
    29      CORE_MESSAGE_QUEUE_SEND_REQUEST, (_wait), (_timeout)
     29     CORE_MESSAGE_QUEUE_SEND_REQUEST, (_wait), (_timeout) )
    3030 
    3131/*PAGE
     
    3939  _CORE_message_queue_Submit( (_the_message_queue), (_buffer), (_size), \
    4040     (_id), (_api_message_queue_mp_support), \
    41      CORE_MESSAGE_QUEUE_URGENT_REQUEST, (_wait), (_timeout)
     41     CORE_MESSAGE_QUEUE_URGENT_REQUEST, (_wait), (_timeout) )
    4242
    4343/*PAGE
  • c/src/exec/score/macros/rtems/score/coremutex.inl

    r7f8c11c r43b6f75  
    6464  ( (_the_attribute)->discipline == CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING )
    6565 
     66/*PAGE
     67 *
     68 *  _CORE_mutex_Seize_interrupt_trylock
     69 *
     70 *  NOTE: This is not really a MACRO version of this routine.
     71 *        A body is in coremutexseize.c that is duplicated
     72 *        from the .inl by hand.
     73 */
     74
     75int _CORE_mutex_Seize_interrupt_trylock(
     76  CORE_mutex_Control  *the_mutex,
     77  ISR_Level           *level_p
     78);
     79
    6680#endif
    6781/* end of include file */
  • c/src/exec/score/macros/rtems/score/coresem.inl

    r7f8c11c r43b6f75  
    3535  ( (_the_semaphore)->count )
    3636
     37/*PAGE
     38 *
     39 *  _CORE_semaphore_Seize_isr_disable
     40 *
     41 *  DESCRIPTION:
     42 *
     43 *  This routine attempts to receive a unit from the_semaphore.
     44 *  If a unit is available or if the wait flag is FALSE, then the routine
     45 *  returns.  Otherwise, the calling task is blocked until a unit becomes
     46 *  available.
     47 *
     48 *  NOTE: There is currently no MACRO version of this routine.
     49 */
     50
     51#define _CORE_semaphore_Seize_isr_disable( \
     52  _the_semaphore, _id, _wait, _timeout, _level_p) \
     53{ \
     54  Thread_Control *executing; \
     55  ISR_Level       level = *(_level_p); \
     56 \
     57  /* disabled when you get here */ \
     58 \
     59  executing = _Thread_Executing; \
     60  executing->Wait.return_code = CORE_SEMAPHORE_STATUS_SUCCESSFUL; \
     61  if ( (_the_semaphore)->count != 0 ) { \
     62    (_the_semaphore)->count -= 1; \
     63    _ISR_Enable( level ); \
     64  } else if ( !(_wait) ) { \
     65    _ISR_Enable( level ); \
     66    executing->Wait.return_code = CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT; \
     67  } else { \
     68    _Thread_Disable_dispatch(); \
     69    _ISR_Enable( level ); \
     70    _Thread_queue_Enter_critical_section( &(_the_semaphore)->Wait_queue ); \
     71    executing->Wait.queue          = &(_the_semaphore)->Wait_queue; \
     72    executing->Wait.id             = (_id); \
     73    _ISR_Enable( level ); \
     74 \
     75    _Thread_queue_Enqueue( &(_the_semaphore)->Wait_queue, (_timeout) ); \
     76    _Thread_Enable_dispatch(); \
     77  } \
     78}
     79
    3780
    3881#endif
  • c/src/exec/score/src/coremutexseize.c

    r7f8c11c r43b6f75  
    8383  _Thread_Enable_dispatch();
    8484}
     85
     86#if !defined(USE_INLINES)
     87int _CORE_mutex_Seize_interrupt_trylock(
     88  CORE_mutex_Control  *the_mutex,
     89  ISR_Level           *level_p
     90)
     91{
     92  Thread_Control   *executing;
     93  ISR_Level         level = *level_p;
     94 
     95  /* disabled when you get here */
     96   
     97  executing = _Thread_Executing;
     98  executing->Wait.return_code = CORE_MUTEX_STATUS_SUCCESSFUL;
     99  if ( !_CORE_mutex_Is_locked( the_mutex ) ) {
     100    the_mutex->lock       = CORE_MUTEX_LOCKED;
     101    the_mutex->holder     = executing;
     102    the_mutex->holder_id  = executing->Object.id;
     103    the_mutex->nest_count = 1;
     104    executing->resource_count++;
     105    if ( the_mutex->Attributes.discipline !=
     106           CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING ) {
     107        _ISR_Enable( level );
     108        return 0;
     109    }
     110    /* else must be CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING */
     111    {
     112       Priority_Control  ceiling;
     113       Priority_Control  current;
     114
     115       ceiling = the_mutex->Attributes.priority_ceiling;
     116       current = executing->current_priority;
     117       if ( current == ceiling ) {
     118         _ISR_Enable( level );
     119         return 0;
     120       }
     121       if ( current > ceiling ) {
     122        _Thread_Disable_dispatch();
     123        _ISR_Enable( level );
     124        _Thread_Change_priority(
     125          the_mutex->holder,
     126          the_mutex->Attributes.priority_ceiling,
     127          FALSE
     128        );
     129        _Thread_Enable_dispatch();
     130        return 0;
     131      }
     132      /* if ( current < ceiling ) */ {
     133        executing->Wait.return_code = CORE_MUTEX_STATUS_CEILING_VIOLATED;
     134        the_mutex->nest_count = 0;     /* undo locking above */
     135        executing->resource_count--;   /* undo locking above */
     136        _ISR_Enable( level );
     137        return 0;
     138      }
     139    }
     140    return 0;
     141  }
     142  return 1;
     143}
     144#endif
  • cpukit/score/ChangeLog

    r7f8c11c r43b6f75  
     1
     22000-11-30      Joel Sherrill <joel@OARcorp.com>
     3
     4        * General effort to make things compile with macros not inlines
     5        * inline/rtems/score/coremutex.inl: Added comment indicating
     6        for macros there is another copy of
     7        _CORE_mutex_Seize_interrupt_trylock() in src/coremutexseize.c.
     8        * src/coremutexseize.c: Added body of
     9        _CORE_mutex_Seize_interrupt_trylock() for macro case.
     10        * macros/rtems/score/coremutex.inl: Added prototype for
     11        _CORE_mutex_Seize_interrupt_trylock() since there is a real
     12        body when macros are enabled.
     13        * macros/rtems/score/coresem.inl: Added macro implementation of
     14        _CORE_semaphore_Seize_isr_disable.
     15        * macros/score/Makefile.am: Fixed typos.
     16        * rtems/score/address.inl: Correct macro implementation of
     17        _Addresses_Is_aligned() so it would compile.
     18        * macros/rtems/score/coremsg.inl: Added closing parentheses.
    119       
    2202000-11-28      Chris Johns <ccj@acm.org>
  • cpukit/score/inline/rtems/score/coremutex.inl

    r7f8c11c r43b6f75  
    114114 *
    115115 *  NOTE: There is no MACRO version of this routine.
     116 *        A body is in coremutexseize.c that is duplicated
     117 *        from the .inl by hand.
    116118 */
    117119
  • cpukit/score/macros/rtems/score/address.inl

    r7f8c11c r43b6f75  
    5353
    5454#if (CPU_ALIGNMENT == 0)
     55#define _Addresses_Is_aligned( _address ) \
    5556    (TRUE)
    5657#elif defined(RTEMS_CPU_HAS_16_BIT_ADDRESSES)
     58#define _Addresses_Is_aligned( _address ) \
    5759    ( ( (unsigned short)(_address) % CPU_ALIGNMENT ) == 0 )
     60#else
    5861#define _Addresses_Is_aligned( _address ) \
    5962    ( ( (unsigned32)(_address) % CPU_ALIGNMENT ) == 0 )
    60 #else
    6163#endif
    6264
  • cpukit/score/macros/rtems/score/coremsg.inl

    r7f8c11c r43b6f75  
    2222 *
    2323 */
    24  
     24
    2525#define _CORE_message_queue_Send( _the_message_queue, _buffer, _size, \
    2626       _id, _api_message_queue_mp_support, _wait, _timeout ) \
    2727  _CORE_message_queue_Submit( (_the_message_queue), (_buffer), (_size), \
    2828     (_id), (_api_message_queue_mp_support), \
    29      CORE_MESSAGE_QUEUE_SEND_REQUEST, (_wait), (_timeout)
     29     CORE_MESSAGE_QUEUE_SEND_REQUEST, (_wait), (_timeout) )
    3030 
    3131/*PAGE
     
    3939  _CORE_message_queue_Submit( (_the_message_queue), (_buffer), (_size), \
    4040     (_id), (_api_message_queue_mp_support), \
    41      CORE_MESSAGE_QUEUE_URGENT_REQUEST, (_wait), (_timeout)
     41     CORE_MESSAGE_QUEUE_URGENT_REQUEST, (_wait), (_timeout) )
    4242
    4343/*PAGE
  • cpukit/score/macros/rtems/score/coremutex.inl

    r7f8c11c r43b6f75  
    6464  ( (_the_attribute)->discipline == CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING )
    6565 
     66/*PAGE
     67 *
     68 *  _CORE_mutex_Seize_interrupt_trylock
     69 *
     70 *  NOTE: This is not really a MACRO version of this routine.
     71 *        A body is in coremutexseize.c that is duplicated
     72 *        from the .inl by hand.
     73 */
     74
     75int _CORE_mutex_Seize_interrupt_trylock(
     76  CORE_mutex_Control  *the_mutex,
     77  ISR_Level           *level_p
     78);
     79
    6680#endif
    6781/* end of include file */
  • cpukit/score/macros/rtems/score/coresem.inl

    r7f8c11c r43b6f75  
    3535  ( (_the_semaphore)->count )
    3636
     37/*PAGE
     38 *
     39 *  _CORE_semaphore_Seize_isr_disable
     40 *
     41 *  DESCRIPTION:
     42 *
     43 *  This routine attempts to receive a unit from the_semaphore.
     44 *  If a unit is available or if the wait flag is FALSE, then the routine
     45 *  returns.  Otherwise, the calling task is blocked until a unit becomes
     46 *  available.
     47 *
     48 *  NOTE: There is currently no MACRO version of this routine.
     49 */
     50
     51#define _CORE_semaphore_Seize_isr_disable( \
     52  _the_semaphore, _id, _wait, _timeout, _level_p) \
     53{ \
     54  Thread_Control *executing; \
     55  ISR_Level       level = *(_level_p); \
     56 \
     57  /* disabled when you get here */ \
     58 \
     59  executing = _Thread_Executing; \
     60  executing->Wait.return_code = CORE_SEMAPHORE_STATUS_SUCCESSFUL; \
     61  if ( (_the_semaphore)->count != 0 ) { \
     62    (_the_semaphore)->count -= 1; \
     63    _ISR_Enable( level ); \
     64  } else if ( !(_wait) ) { \
     65    _ISR_Enable( level ); \
     66    executing->Wait.return_code = CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT; \
     67  } else { \
     68    _Thread_Disable_dispatch(); \
     69    _ISR_Enable( level ); \
     70    _Thread_queue_Enter_critical_section( &(_the_semaphore)->Wait_queue ); \
     71    executing->Wait.queue          = &(_the_semaphore)->Wait_queue; \
     72    executing->Wait.id             = (_id); \
     73    _ISR_Enable( level ); \
     74 \
     75    _Thread_queue_Enqueue( &(_the_semaphore)->Wait_queue, (_timeout) ); \
     76    _Thread_Enable_dispatch(); \
     77  } \
     78}
     79
    3780
    3881#endif
  • cpukit/score/src/coremutexseize.c

    r7f8c11c r43b6f75  
    8383  _Thread_Enable_dispatch();
    8484}
     85
     86#if !defined(USE_INLINES)
     87int _CORE_mutex_Seize_interrupt_trylock(
     88  CORE_mutex_Control  *the_mutex,
     89  ISR_Level           *level_p
     90)
     91{
     92  Thread_Control   *executing;
     93  ISR_Level         level = *level_p;
     94 
     95  /* disabled when you get here */
     96   
     97  executing = _Thread_Executing;
     98  executing->Wait.return_code = CORE_MUTEX_STATUS_SUCCESSFUL;
     99  if ( !_CORE_mutex_Is_locked( the_mutex ) ) {
     100    the_mutex->lock       = CORE_MUTEX_LOCKED;
     101    the_mutex->holder     = executing;
     102    the_mutex->holder_id  = executing->Object.id;
     103    the_mutex->nest_count = 1;
     104    executing->resource_count++;
     105    if ( the_mutex->Attributes.discipline !=
     106           CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING ) {
     107        _ISR_Enable( level );
     108        return 0;
     109    }
     110    /* else must be CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING */
     111    {
     112       Priority_Control  ceiling;
     113       Priority_Control  current;
     114
     115       ceiling = the_mutex->Attributes.priority_ceiling;
     116       current = executing->current_priority;
     117       if ( current == ceiling ) {
     118         _ISR_Enable( level );
     119         return 0;
     120       }
     121       if ( current > ceiling ) {
     122        _Thread_Disable_dispatch();
     123        _ISR_Enable( level );
     124        _Thread_Change_priority(
     125          the_mutex->holder,
     126          the_mutex->Attributes.priority_ceiling,
     127          FALSE
     128        );
     129        _Thread_Enable_dispatch();
     130        return 0;
     131      }
     132      /* if ( current < ceiling ) */ {
     133        executing->Wait.return_code = CORE_MUTEX_STATUS_CEILING_VIOLATED;
     134        the_mutex->nest_count = 0;     /* undo locking above */
     135        executing->resource_count--;   /* undo locking above */
     136        _ISR_Enable( level );
     137        return 0;
     138      }
     139    }
     140    return 0;
     141  }
     142  return 1;
     143}
     144#endif
Note: See TracChangeset for help on using the changeset viewer.