Changeset 8d5b438b in rtems


Ignore:
Timestamp:
Jul 6, 2000, 7:27:03 PM (20 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
21e2b2b
Parents:
c6f111b
Message:

Added _CORE_semaphore_Seize_isr_disable.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • c/src/exec/score/inline/rtems/score/coresem.inl

    rc6f111b r8d5b438b  
    1616#ifndef __INLINE_CORE_SEMAPHORE_inl
    1717#define __INLINE_CORE_SEMAPHORE_inl
     18
     19#include <rtems/score/thread.h>
     20#include <rtems/score/threadq.h>
    1821
    1922/*PAGE
     
    5053}
    5154
     55/*PAGE
     56 *
     57 *  _CORE_semaphore_Seize_isr_disable
     58 *
     59 *  DESCRIPTION:
     60 *
     61 *  This routine attempts to receive a unit from the_semaphore.
     62 *  If a unit is available or if the wait flag is FALSE, then the routine
     63 *  returns.  Otherwise, the calling task is blocked until a unit becomes
     64 *  available.
     65 *
     66 *  NOTE: There is currently no MACRO version of this routine.
     67 */
     68 
     69RTEMS_INLINE_ROUTINE void _CORE_semaphore_Seize_isr_disable(
     70  CORE_semaphore_Control  *the_semaphore,
     71  Objects_Id               id,
     72  boolean                  wait,
     73  Watchdog_Interval        timeout,
     74  ISR_Level               *level_p
     75)
     76{
     77  Thread_Control *executing;
     78  ISR_Level       level = *level_p;
     79
     80  /* disabled when you get here */
     81 
     82  executing = _Thread_Executing;
     83  executing->Wait.return_code = CORE_SEMAPHORE_STATUS_SUCCESSFUL;
     84  if ( the_semaphore->count != 0 ) {
     85    the_semaphore->count -= 1;
     86    _ISR_Enable( level );
     87    return;
     88  }
     89
     90  if ( !wait ) {
     91    _ISR_Enable( level );
     92    executing->Wait.return_code = CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT;
     93    return;
     94  }
     95
     96  _Thread_Disable_dispatch();
     97  _ISR_Enable( level );
     98  _Thread_queue_Enter_critical_section( &the_semaphore->Wait_queue );
     99  executing->Wait.queue          = &the_semaphore->Wait_queue;
     100  executing->Wait.id             = id;
     101  _ISR_Enable( level );
     102
     103  _Thread_queue_Enqueue( &the_semaphore->Wait_queue, timeout );
     104  _Thread_Enable_dispatch();
     105}
     106#endif
     107
    52108#endif
    53109/* end of include file */
  • cpukit/score/inline/rtems/score/coresem.inl

    rc6f111b r8d5b438b  
    1616#ifndef __INLINE_CORE_SEMAPHORE_inl
    1717#define __INLINE_CORE_SEMAPHORE_inl
     18
     19#include <rtems/score/thread.h>
     20#include <rtems/score/threadq.h>
    1821
    1922/*PAGE
     
    5053}
    5154
     55/*PAGE
     56 *
     57 *  _CORE_semaphore_Seize_isr_disable
     58 *
     59 *  DESCRIPTION:
     60 *
     61 *  This routine attempts to receive a unit from the_semaphore.
     62 *  If a unit is available or if the wait flag is FALSE, then the routine
     63 *  returns.  Otherwise, the calling task is blocked until a unit becomes
     64 *  available.
     65 *
     66 *  NOTE: There is currently no MACRO version of this routine.
     67 */
     68 
     69RTEMS_INLINE_ROUTINE void _CORE_semaphore_Seize_isr_disable(
     70  CORE_semaphore_Control  *the_semaphore,
     71  Objects_Id               id,
     72  boolean                  wait,
     73  Watchdog_Interval        timeout,
     74  ISR_Level               *level_p
     75)
     76{
     77  Thread_Control *executing;
     78  ISR_Level       level = *level_p;
     79
     80  /* disabled when you get here */
     81 
     82  executing = _Thread_Executing;
     83  executing->Wait.return_code = CORE_SEMAPHORE_STATUS_SUCCESSFUL;
     84  if ( the_semaphore->count != 0 ) {
     85    the_semaphore->count -= 1;
     86    _ISR_Enable( level );
     87    return;
     88  }
     89
     90  if ( !wait ) {
     91    _ISR_Enable( level );
     92    executing->Wait.return_code = CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT;
     93    return;
     94  }
     95
     96  _Thread_Disable_dispatch();
     97  _ISR_Enable( level );
     98  _Thread_queue_Enter_critical_section( &the_semaphore->Wait_queue );
     99  executing->Wait.queue          = &the_semaphore->Wait_queue;
     100  executing->Wait.id             = id;
     101  _ISR_Enable( level );
     102
     103  _Thread_queue_Enqueue( &the_semaphore->Wait_queue, timeout );
     104  _Thread_Enable_dispatch();
     105}
     106#endif
     107
    52108#endif
    53109/* end of include file */
Note: See TracChangeset for help on using the changeset viewer.