Changeset 8ce962c0 in rtems


Ignore:
Timestamp:
Jul 6, 2000, 8:00:44 PM (20 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
e6faa6ac
Parents:
9d27732
Message:

Modfied to execute faster and have fewer instructions.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • c/src/exec/rtems/src/semtranslatereturncode.c

    r9d27732 r8ce962c0  
    5858 */
    5959 
     60rtems_status_code _Semaphore_Translate_core_mutex_return_code_[] = {
     61  RTEMS_SUCCESSFUL,         /* CORE_MUTEX_STATUS_SUCCESSFUL */
     62  RTEMS_UNSATISFIED,        /* CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT */
     63  RTEMS_UNSATISFIED,        /* CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED */
     64  RTEMS_NOT_OWNER_OF_RESOURCE, /* CORE_MUTEX_STATUS_NOT_OWNER_OF_RESOURCE */
     65  RTEMS_OBJECT_WAS_DELETED, /* CORE_MUTEX_WAS_DELETED */
     66  RTEMS_TIMEOUT,            /* CORE_MUTEX_TIMEOUT */
     67  RTEMS_INTERNAL_ERROR,     /* CORE_MUTEX_STATUS_CEILING_VIOLATED */
     68};
     69
     70
    6071rtems_status_code _Semaphore_Translate_core_mutex_return_code (
    6172  unsigned32 the_mutex_status
    6273)
    6374{
    64   switch ( the_mutex_status ) {
    65     case  CORE_MUTEX_STATUS_SUCCESSFUL:
    66       return RTEMS_SUCCESSFUL;
    67     case CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT:
    68       return RTEMS_UNSATISFIED;
    69     case CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED:
    70       return RTEMS_UNSATISFIED;
    71     case CORE_MUTEX_STATUS_NOT_OWNER_OF_RESOURCE:
    72       return RTEMS_NOT_OWNER_OF_RESOURCE;
    73     case CORE_MUTEX_WAS_DELETED:
    74       return RTEMS_OBJECT_WAS_DELETED;
    75     case CORE_MUTEX_TIMEOUT:
    76       return RTEMS_TIMEOUT;
    77     case THREAD_STATUS_PROXY_BLOCKING:
    78       return RTEMS_PROXY_BLOCKING;
    79   }
    80   return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
     75#if defined(RTEMS_MULTIPROCESSING)
     76  if ( the_mutex_status == THREAD_STATUS_PROXY_BLOCKING )
     77    return RTEMS_PROXY_BLOCKING;
     78  else
     79#endif
     80  if ( the_mutex_status > CORE_MUTEX_STATUS_CEILING_VIOLATED )
     81    return RTEMS_INTERNAL_ERROR;
     82  else
     83    return _Semaphore_Translate_core_mutex_return_code_[the_mutex_status];
    8184}
    8285
     
    9396 */
    9497 
     98rtems_status_code _Semaphore_Translate_core_semaphore_return_code_[] = {
     99  RTEMS_SUCCESSFUL,         /* CORE_SEMAPHORE_STATUS_SUCCESSFUL */
     100  RTEMS_UNSATISFIED,        /* CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT */
     101  RTEMS_OBJECT_WAS_DELETED, /* CORE_SEMAPHORE_WAS_DELETED */
     102  RTEMS_TIMEOUT,            /* CORE_SEMAPHORE_TIMEOUT  */
     103  RTEMS_INTERNAL_ERROR,     /* CORE_SEMAPHORE_MAXIMUM_COUNT_EXCEEDED */
     104 
     105};
     106
    95107rtems_status_code _Semaphore_Translate_core_semaphore_return_code (
    96108  unsigned32 the_semaphore_status
    97109)
    98110{
    99   switch ( the_semaphore_status ) {
    100     case  CORE_SEMAPHORE_STATUS_SUCCESSFUL:
    101       return RTEMS_SUCCESSFUL;
    102     case CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT:
    103       return RTEMS_UNSATISFIED;
    104     case CORE_SEMAPHORE_WAS_DELETED:
    105       return RTEMS_OBJECT_WAS_DELETED;
    106     case CORE_SEMAPHORE_TIMEOUT:
    107       return RTEMS_TIMEOUT;
    108    
    109     /*
    110      *  An overflow should not occur in the Classic API.
    111      */
    112 
    113     case CORE_SEMAPHORE_MAXIMUM_COUNT_EXCEEDED:
    114       return RTEMS_INTERNAL_ERROR;
    115 
    116     case THREAD_STATUS_PROXY_BLOCKING:
    117       return RTEMS_PROXY_BLOCKING;
    118   }
    119   return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
     111#if defined(RTEMS_MULTIPROCESSING)
     112  if ( the_semaphore_status == THREAD_STATUS_PROXY_BLOCKING )
     113    return RTEMS_PROXY_BLOCKING;
     114  else
     115#endif
     116  if ( the_semaphore_status > CORE_MUTEX_STATUS_CEILING_VIOLATED )
     117    return RTEMS_INTERNAL_ERROR;
     118  else
     119    return _Semaphore_Translate_core_semaphore_return_code_[the_semaphore_status];
    120120}
  • cpukit/rtems/src/semtranslatereturncode.c

    r9d27732 r8ce962c0  
    5858 */
    5959 
     60rtems_status_code _Semaphore_Translate_core_mutex_return_code_[] = {
     61  RTEMS_SUCCESSFUL,         /* CORE_MUTEX_STATUS_SUCCESSFUL */
     62  RTEMS_UNSATISFIED,        /* CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT */
     63  RTEMS_UNSATISFIED,        /* CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED */
     64  RTEMS_NOT_OWNER_OF_RESOURCE, /* CORE_MUTEX_STATUS_NOT_OWNER_OF_RESOURCE */
     65  RTEMS_OBJECT_WAS_DELETED, /* CORE_MUTEX_WAS_DELETED */
     66  RTEMS_TIMEOUT,            /* CORE_MUTEX_TIMEOUT */
     67  RTEMS_INTERNAL_ERROR,     /* CORE_MUTEX_STATUS_CEILING_VIOLATED */
     68};
     69
     70
    6071rtems_status_code _Semaphore_Translate_core_mutex_return_code (
    6172  unsigned32 the_mutex_status
    6273)
    6374{
    64   switch ( the_mutex_status ) {
    65     case  CORE_MUTEX_STATUS_SUCCESSFUL:
    66       return RTEMS_SUCCESSFUL;
    67     case CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT:
    68       return RTEMS_UNSATISFIED;
    69     case CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED:
    70       return RTEMS_UNSATISFIED;
    71     case CORE_MUTEX_STATUS_NOT_OWNER_OF_RESOURCE:
    72       return RTEMS_NOT_OWNER_OF_RESOURCE;
    73     case CORE_MUTEX_WAS_DELETED:
    74       return RTEMS_OBJECT_WAS_DELETED;
    75     case CORE_MUTEX_TIMEOUT:
    76       return RTEMS_TIMEOUT;
    77     case THREAD_STATUS_PROXY_BLOCKING:
    78       return RTEMS_PROXY_BLOCKING;
    79   }
    80   return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
     75#if defined(RTEMS_MULTIPROCESSING)
     76  if ( the_mutex_status == THREAD_STATUS_PROXY_BLOCKING )
     77    return RTEMS_PROXY_BLOCKING;
     78  else
     79#endif
     80  if ( the_mutex_status > CORE_MUTEX_STATUS_CEILING_VIOLATED )
     81    return RTEMS_INTERNAL_ERROR;
     82  else
     83    return _Semaphore_Translate_core_mutex_return_code_[the_mutex_status];
    8184}
    8285
     
    9396 */
    9497 
     98rtems_status_code _Semaphore_Translate_core_semaphore_return_code_[] = {
     99  RTEMS_SUCCESSFUL,         /* CORE_SEMAPHORE_STATUS_SUCCESSFUL */
     100  RTEMS_UNSATISFIED,        /* CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT */
     101  RTEMS_OBJECT_WAS_DELETED, /* CORE_SEMAPHORE_WAS_DELETED */
     102  RTEMS_TIMEOUT,            /* CORE_SEMAPHORE_TIMEOUT  */
     103  RTEMS_INTERNAL_ERROR,     /* CORE_SEMAPHORE_MAXIMUM_COUNT_EXCEEDED */
     104 
     105};
     106
    95107rtems_status_code _Semaphore_Translate_core_semaphore_return_code (
    96108  unsigned32 the_semaphore_status
    97109)
    98110{
    99   switch ( the_semaphore_status ) {
    100     case  CORE_SEMAPHORE_STATUS_SUCCESSFUL:
    101       return RTEMS_SUCCESSFUL;
    102     case CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT:
    103       return RTEMS_UNSATISFIED;
    104     case CORE_SEMAPHORE_WAS_DELETED:
    105       return RTEMS_OBJECT_WAS_DELETED;
    106     case CORE_SEMAPHORE_TIMEOUT:
    107       return RTEMS_TIMEOUT;
    108    
    109     /*
    110      *  An overflow should not occur in the Classic API.
    111      */
    112 
    113     case CORE_SEMAPHORE_MAXIMUM_COUNT_EXCEEDED:
    114       return RTEMS_INTERNAL_ERROR;
    115 
    116     case THREAD_STATUS_PROXY_BLOCKING:
    117       return RTEMS_PROXY_BLOCKING;
    118   }
    119   return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
     111#if defined(RTEMS_MULTIPROCESSING)
     112  if ( the_semaphore_status == THREAD_STATUS_PROXY_BLOCKING )
     113    return RTEMS_PROXY_BLOCKING;
     114  else
     115#endif
     116  if ( the_semaphore_status > CORE_MUTEX_STATUS_CEILING_VIOLATED )
     117    return RTEMS_INTERNAL_ERROR;
     118  else
     119    return _Semaphore_Translate_core_semaphore_return_code_[the_semaphore_status];
    120120}
Note: See TracChangeset for help on using the changeset viewer.