source: rtems/cpukit/score/macros/rtems/score/coresem.inl @ c39b35f

Last change on this file since c39b35f was c39b35f, checked in by Joel Sherrill <joel.sherrill@…>, on 09/04/03 at 18:55:06

2003-09-04 Joel Sherrill <joel@…>

  • include/rtems/bspIo.h, include/rtems/fs.h, include/rtems/userenv.h, score/include/rtems/debug.h, score/include/rtems/seterr.h, score/include/rtems/system.h, score/include/rtems/score/address.h, score/include/rtems/score/apiext.h, score/include/rtems/score/apimutex.h, score/include/rtems/score/bitfield.h, score/include/rtems/score/chain.h, score/include/rtems/score/context.h, score/include/rtems/score/copyrt.h, score/include/rtems/score/coremsg.h, score/include/rtems/score/coremutex.h, score/include/rtems/score/coresem.h, score/include/rtems/score/heap.h, score/include/rtems/score/interr.h, score/include/rtems/score/isr.h, score/include/rtems/score/mpci.h, score/include/rtems/score/mppkt.h, score/include/rtems/score/object.h, score/include/rtems/score/objectmp.h, score/include/rtems/score/priority.h, score/include/rtems/score/stack.h, score/include/rtems/score/states.h, score/include/rtems/score/sysstate.h, score/include/rtems/score/thread.h, score/include/rtems/score/threadmp.h, score/include/rtems/score/threadq.h, score/include/rtems/score/tod.h, score/include/rtems/score/tqdata.h, score/include/rtems/score/userext.h, score/include/rtems/score/watchdog.h, score/include/rtems/score/wkspace.h, score/inline/rtems/score/address.inl, score/inline/rtems/score/chain.inl, score/inline/rtems/score/coremsg.inl, score/inline/rtems/score/coremutex.inl, score/inline/rtems/score/coresem.inl, score/inline/rtems/score/heap.inl, score/inline/rtems/score/isr.inl, score/inline/rtems/score/mppkt.inl, score/inline/rtems/score/object.inl, score/inline/rtems/score/objectmp.inl, score/inline/rtems/score/priority.inl, score/inline/rtems/score/stack.inl, score/inline/rtems/score/states.inl, score/inline/rtems/score/sysstate.inl, score/inline/rtems/score/thread.inl, score/inline/rtems/score/threadmp.inl, score/inline/rtems/score/tod.inl, score/inline/rtems/score/tqdata.inl, score/inline/rtems/score/userext.inl, score/inline/rtems/score/watchdog.inl, score/inline/rtems/score/wkspace.inl, score/macros/rtems/score/address.inl, score/macros/rtems/score/chain.inl, score/macros/rtems/score/coremsg.inl, score/macros/rtems/score/coremutex.inl, score/macros/rtems/score/coresem.inl, score/macros/rtems/score/heap.inl, score/macros/rtems/score/isr.inl, score/macros/rtems/score/mppkt.inl, score/macros/rtems/score/object.inl, score/macros/rtems/score/objectmp.inl, score/macros/rtems/score/priority.inl, score/macros/rtems/score/stack.inl, score/macros/rtems/score/states.inl, score/macros/rtems/score/sysstate.inl, score/macros/rtems/score/thread.inl, score/macros/rtems/score/threadmp.inl, score/macros/rtems/score/tod.inl, score/macros/rtems/score/tqdata.inl, score/macros/rtems/score/userext.inl, score/macros/rtems/score/watchdog.inl, score/macros/rtems/score/wkspace.inl: URL for license changed.
  • Property mode set to 100644
File size: 1.8 KB
Line 
1/*  macros/coresem.h
2 *
3 *  This include file contains all of the inlined routines associated
4 *  with core semaphores.
5 *
6 *  COPYRIGHT (c) 1989-1999.
7 *  On-Line Applications Research Corporation (OAR).
8 *
9 *  The license and distribution terms for this file may be
10 *  found in the file LICENSE in this distribution or at
11 *  http://www.rtems.com/license/LICENSE.
12 *
13 *  $Id$
14 */
15
16#ifndef __MACROS_CORE_SEMAPHORE_h
17#define __MACROS_CORE_SEMAPHORE_h
18
19/*PAGE
20 *
21 *  _CORE_semaphore_Is_priority
22 *
23 */
24
25#define _CORE_semaphore_Is_priority( _the_attribute ) \
26  ( (_the_attribute)->discipline == CORE_SEMAPHORE_DISCIPLINES_PRIORITY )
27
28/*PAGE
29 *
30 *  _CORE_semaphore_Get_count
31 *
32 */
33 
34#define _CORE_semaphore_Get_count( _the_semaphore ) \
35  ( (_the_semaphore)->count )
36
37/*PAGE
38 *
39 *  _CORE_semaphore_Seize_isr_disable
40 */
41
42#define _CORE_semaphore_Seize_isr_disable( \
43  _the_semaphore, _id, _wait, _timeout, _level_p) \
44{ \
45  Thread_Control *executing; \
46  ISR_Level       level = *(_level_p); \
47 \
48  /* disabled when you get here */ \
49 \
50  executing = _Thread_Executing; \
51  executing->Wait.return_code = CORE_SEMAPHORE_STATUS_SUCCESSFUL; \
52  if ( (_the_semaphore)->count != 0 ) { \
53    (_the_semaphore)->count -= 1; \
54    _ISR_Enable( level ); \
55  } else if ( !(_wait) ) { \
56    _ISR_Enable( level ); \
57    executing->Wait.return_code = CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT; \
58  } else { \
59    _Thread_Disable_dispatch(); \
60    _Thread_queue_Enter_critical_section( &(_the_semaphore)->Wait_queue ); \
61    executing->Wait.queue          = &(_the_semaphore)->Wait_queue; \
62    executing->Wait.id             = (_id); \
63    _ISR_Enable( level ); \
64 \
65    _Thread_queue_Enqueue( &(_the_semaphore)->Wait_queue, (_timeout) ); \
66    _Thread_Enable_dispatch(); \
67  } \
68}
69
70#endif
71/* end of include file */
Note: See TracBrowser for help on using the repository browser.