Changeset a6524b9 in rtems


Ignore:
Timestamp:
Mar 22, 2015, 1:31:59 PM (5 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
5ce776ec
Parents:
d2bdf5c
Message:

score: Simplify debug code and use _Assert()

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • cpukit/sapi/src/interrtext.c

    rd2bdf5c ra6524b9  
    4545  "INTERNAL_ERROR_BAD_ATTRIBUTES",
    4646  "INTERNAL_ERROR_IMPLEMENTATION_KEY_CREATE_INCONSISTENCY",
    47   "INTERNAL_ERROR_IMPLEMENTATION_BLOCKING_OPERATION_CANCEL",
     47  "OBSOLETE_INTERNAL_ERROR_IMPLEMENTATION_BLOCKING_OPERATION_CANCEL",
    4848  "INTERNAL_ERROR_MUTEX_OBTAIN_FROM_BAD_STATE",
    4949  "INTERNAL_ERROR_UNLIMITED_AND_MAXIMUM_IS_0",
  • cpukit/score/include/rtems/score/interr.h

    rd2bdf5c ra6524b9  
    154154  INTERNAL_ERROR_BAD_ATTRIBUTES,
    155155  INTERNAL_ERROR_IMPLEMENTATION_KEY_CREATE_INCONSISTENCY,
    156   INTERNAL_ERROR_IMPLEMENTATION_BLOCKING_OPERATION_CANCEL,
     156  OBSOLETE_INTERNAL_ERROR_IMPLEMENTATION_BLOCKING_OPERATION_CANCEL,
    157157  INTERNAL_ERROR_MUTEX_OBTAIN_FROM_BAD_STATE,
    158158  INTERNAL_ERROR_UNLIMITED_AND_MAXIMUM_IS_0,
  • cpukit/score/src/threadqenqueue.c

    rd2bdf5c ra6524b9  
    2020
    2121#include <rtems/score/threadqimpl.h>
     22#include <rtems/score/assert.h>
    2223#include <rtems/score/isrlevel.h>
    2324#include <rtems/score/rbtreeimpl.h>
     
    7172    _Thread_MP_Free_proxy( the_thread );
    7273#endif
    73 }
    74 
    75 /**
    76  *  @brief Cancel a blocking operation due to ISR.
    77  *
    78  *  This method is used to cancel a blocking operation that was
    79  *  satisfied from an ISR while the thread executing was in the
    80  *  process of blocking.
    81  *
    82  *  This method will restore the previous ISR disable level during the cancel
    83  *  operation.  Thus it is an implicit _ISR_Enable().
    84  *
    85  *  @param[in] sync_state is the synchronization state
    86  *  @param[in] the_thread is the thread whose blocking is canceled
    87  *  @param[in] level is the previous ISR disable level
    88  *
    89  *  @note This is a rare routine in RTEMS.  It is called with
    90  *        interrupts disabled and only when an ISR completed
    91  *        a blocking condition in process.
    92  */
    93 static void _Thread_blocking_operation_Cancel(
    94   Thread_blocking_operation_States  sync_state,
    95   Thread_Control                   *the_thread,
    96   ISR_Level                         level
    97 )
    98 {
    99   /*
    100    *  Cases that should not happen and why.
    101    *
    102    *  THREAD_BLOCKING_OPERATION_SYNCHRONIZED:
    103    *
    104    *  This indicates that someone did not enter a blocking
    105    *  operation critical section.
    106    *
    107    *  THREAD_BLOCKING_OPERATION_NOTHING_HAPPENED:
    108    *
    109    *  This indicates that there was nothing to cancel so
    110    *  we should not have been called.
    111    */
    112 
    113   #if defined(RTEMS_DEBUG)
    114     if ( (sync_state == THREAD_BLOCKING_OPERATION_SYNCHRONIZED) ||
    115          (sync_state == THREAD_BLOCKING_OPERATION_NOTHING_HAPPENED) ) {
    116       _Terminate(
    117         INTERNAL_ERROR_CORE,
    118         true,
    119         INTERNAL_ERROR_IMPLEMENTATION_BLOCKING_OPERATION_CANCEL
    120       );
    121     }
    122   #else
    123     (void) sync_state;
    124   #endif
    125 
    126   _Thread_blocking_operation_Finalize( the_thread, level );
    12774}
    12875
     
    192139    the_thread_queue->sync_state = THREAD_BLOCKING_OPERATION_SYNCHRONIZED;
    193140    _ISR_Enable( level );
    194     return;
    195   } else { /* sync_state != THREAD_BLOCKING_OPERATION_NOTHING_HAPPENED ) */
    196     _Thread_blocking_operation_Cancel( sync_state, the_thread, level );
     141  } else {
     142    /* Cancel a blocking operation due to ISR */
     143
     144    _Assert(
     145      sync_state == THREAD_BLOCKING_OPERATION_TIMEOUT ||
     146        sync_state == THREAD_BLOCKING_OPERATION_SATISFIED
     147    );
     148
     149    _Thread_blocking_operation_Finalize( the_thread, level );
    197150  }
    198151}
  • testsuites/sptests/spinternalerror02/spinternalerror02.scn

    rd2bdf5c ra6524b9  
    1717INTERNAL_ERROR_BAD_ATTRIBUTES
    1818INTERNAL_ERROR_IMPLEMENTATION_KEY_CREATE_INCONSISTENCY
    19 INTERNAL_ERROR_IMPLEMENTATION_BLOCKING_OPERATION_CANCEL
     19OBSOLETE_INTERNAL_ERROR_IMPLEMENTATION_BLOCKING_OPERATION_CANCEL
    2020INTERNAL_ERROR_MUTEX_OBTAIN_FROM_BAD_STATE
    2121INTERNAL_ERROR_UNLIMITED_AND_MAXIMUM_IS_0
Note: See TracChangeset for help on using the changeset viewer.