source: rtems/cpukit/score/macros/rtems/score/coresem.inl @ 43b6f75

4.104.114.84.95
Last change on this file since 43b6f75 was 43b6f75, checked in by Joel Sherrill <joel.sherrill@…>, on Nov 30, 2000 at 2:08:30 PM

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.
  • Property mode set to 100644
File size: 2.1 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.OARcorp.com/rtems/license.html.
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 *  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
80
81#endif
82/* end of include file */
Note: See TracBrowser for help on using the repository browser.