Changeset 3a4ae6c in rtems for cpukit/rtems


Ignore:
Timestamp:
Sep 11, 1995, 7:35:39 PM (26 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
ced11f99
Parents:
5072b07
Message:

The word "RTEMS" almost completely removed from the core.

Configuration Table Template file added and all tests
modified to use this. All gvar.h and conftbl.h files
removed from test directories.

Configuration parameter maximum_devices added.

Core semaphore and mutex handlers added and RTEMS API Semaphore
Manager updated to reflect this.

Initialization sequence changed to invoke API specific initialization
routines. Initialization tasks table now owned by RTEMS Tasks Manager.

Added user extension for post-switch.

Utilized user extensions to implement API specific functionality
like signal dispatching.

Added extensions to the System Initialization Thread so that an
API can register a function to be invoked while the system
is being initialized. These are largely equivalent to the
pre-driver and post-driver hooks.

Added the Modules file oar-go32_p5, modified oar-go32, and modified
the file make/custom/go32.cfg to look at an environment varable which
determines what CPU model is being used.

All BSPs updated to reflect named devices and clock driver's IOCTL
used by the Shared Memory Driver. Also merged clock isr into
main file and removed ckisr.c where possible.

Updated spsize to reflect new and moved variables.

Makefiles for the executive source and include files updated to show
break down of files into Core, RTEMS API, and Neither.

Header and inline files installed into subdirectory based on whether
logically in the Core or a part of the RTEMS API.

Location:
cpukit/rtems
Files:
1 added
62 edited

Legend:

Unmodified
Added
Removed
  • cpukit/rtems/include/rtems.h

    r5072b07 r3a4ae6c  
    2525
    2626#include <rtems/system.h>
    27 #include <rtems/types.h>
     27#include <rtems/rtems/status.h>
     28#include <rtems/rtems/types.h>
    2829
     30#include <rtems/config.h>
    2931#include <rtems/init.h>
    30 #include <rtems/tasks.h>
    31 #include <rtems/intr.h>
    32 #include <rtems/clock.h>
     32#include <rtems/rtems/tasks.h>
     33#include <rtems/rtems/intr.h>
     34#include <rtems/rtems/clock.h>
    3335#include <rtems/extension.h>
    34 #include <rtems/timer.h>
    35 #include <rtems/sem.h>
    36 #include <rtems/message.h>
    37 #include <rtems/event.h>
    38 #include <rtems/signal.h>
    39 #include <rtems/event.h>
    40 #include <rtems/part.h>
    41 #include <rtems/region.h>
    42 #include <rtems/dpmem.h>
     36#include <rtems/rtems/timer.h>
     37#include <rtems/rtems/sem.h>
     38#include <rtems/rtems/message.h>
     39#include <rtems/rtems/event.h>
     40#include <rtems/rtems/signal.h>
     41#include <rtems/rtems/event.h>
     42#include <rtems/rtems/part.h>
     43#include <rtems/rtems/region.h>
     44#include <rtems/rtems/dpmem.h>
    4345#include <rtems/io.h>
    4446#include <rtems/fatal.h>
    45 #include <rtems/ratemon.h>
    46 #include <rtems/mp.h>
     47#include <rtems/rtems/ratemon.h>
     48#include <rtems/rtems/mp.h>
    4749
    48 #include <rtems/support.h>
     50#include <rtems/rtems/support.h>
     51#include <rtems/sysstate.h>
    4952
    5053#define RTEMS_HAS_HARDWARE_FP CPU_HARDWARE_FP
     54
     55/*
     56 *  The following define the constants which may be used in name searches.
     57 */
     58 
     59#define RTEMS_SEARCH_ALL_NODES   OBJECTS_SEARCH_ALL_NODES
     60#define RTEMS_SEARCH_OTHER_NODES OBJECTS_SEARCH_OTHER_NODES
     61#define RTEMS_SEARCH_LOCAL_NODE  OBJECTS_SEARCH_LOCAL_NODE
     62#define RTEMS_WHO_AM_I           OBJECTS_WHO_AM_I
     63 
     64/*
     65 * Parameters and return id's for _Objects_Get_next
     66 */
     67 
     68#define RTEMS_OBJECT_ID_INITIAL_INDEX   OBJECTS_ID_INITIAL_INDEX
     69#define RTEMS_OBJECT_ID_FINAL_INDEX     OBJECTS_ID_FINAL_INDEX
     70 
     71#define RTEMS_OBJECT_ID_INITIAL(node)   OBJECTS_ID_INITIAL(node)
     72#define RTEMS_OBJECT_ID_FINAL           OBJECTS_ID_FINAL
     73 
     74/*
     75 *  The following constant defines the minimum stack size which every
     76 *  thread must exceed.
     77 */
     78
     79#define RTEMS_MINIMUM_STACK_SIZE  STACK_MINIMUM_SIZE
     80
     81/*
     82 *  Constant for indefinite wait.  (actually an illegal interval)
     83 */
     84
     85#define RTEMS_NO_TIMEOUT  WATCHDOG_NO_TIMEOUT
     86
     87/*
     88 *  An MPCI must support packets of at least this size.
     89 */
     90 
     91#define RTEMS_MINIMUM_PACKET_SIZE  MP_PACKET_MINIMUM_PACKET_SIZE
     92 
     93/*
     94 *  The following constant defines the number of unsigned32's
     95 *  in a packet which must be converted to native format in a
     96 *  heterogeneous system.  In packets longer than
     97 *  MP_PACKET_MINIMUN_HETERO_CONVERSION unsigned32's, some of the "extra" data
     98 *  may a user message buffer which is not automatically endian swapped.
     99 */
     100 
     101#define RTEMS_MINIMUN_HETERO_CONVERSION  MP_PACKET_MINIMUN_HETERO_CONVERSION
     102
    51103
    52104#ifdef __cplusplus
  • cpukit/rtems/include/rtems/rtems/asr.h

    r5072b07 r3a4ae6c  
    2323#endif
    2424
    25 #include <rtems/modes.h>
     25#include <rtems/rtems/modes.h>
    2626
    2727/*
     
    5555
    5656typedef struct {
     57  boolean           is_enabled;       /* are ASRs enabled currently? */
    5758  rtems_asr_entry   handler;          /* address of RTEMS_ASR */
    5859  Modes_Control     mode_set;         /* RTEMS_ASR mode */
     
    168169);
    169170
    170 #include <rtems/asr.inl>
     171#include <rtems/rtems/asr.inl>
    171172
    172173#ifdef __cplusplus
  • cpukit/rtems/include/rtems/rtems/attr.h

    r5072b07 r3a4ae6c  
    4444#define RTEMS_NO_INHERIT_PRIORITY 0x00000000
    4545#define RTEMS_INHERIT_PRIORITY    0x00000020
     46
     47#define RTEMS_NO_PRIORITY_CEILING 0x00000000
     48#define RTEMS_PRIORITY_CEILING    0x00000040
    4649
    4750#if ( CPU_HARDWARE_FP == TRUE )
     
    178181);
    179182
    180 #include <rtems/attr.inl>
     183/*
     184 *  _Attributes_Is_priority_ceiling
     185 *
     186 *  DESCRIPTION:
     187 *
     188 *  This function returns TRUE if the priority ceiling attribute
     189 *  is enabled in the attribute_set and FALSE otherwise.
     190 */
     191 
     192STATIC INLINE boolean _Attributes_Is_priority_ceiling(
     193  rtems_attribute attribute_set
     194);
     195 
     196
     197#include <rtems/rtems/attr.inl>
    181198
    182199#ifdef __cplusplus
  • cpukit/rtems/include/rtems/rtems/clock.h

    r5072b07 r3a4ae6c  
    3030#endif
    3131
    32 #include <rtems/tod.h>
     32#include <rtems/core/tod.h>
     33#include <rtems/rtems/types.h>
    3334
    3435/*
  • cpukit/rtems/include/rtems/rtems/dpmem.h

    r5072b07 r3a4ae6c  
    3333#endif
    3434
    35 #include <rtems.h>
    36 #include <rtems/object.h>
     35#include <rtems/core/object.h>
    3736
    3837/*
     
    202201);
    203202
    204 #include <rtems/dpmem.inl>
     203#include <rtems/rtems/dpmem.inl>
    205204
    206205#ifdef __cplusplus
  • cpukit/rtems/include/rtems/rtems/event.h

    r5072b07 r3a4ae6c  
    2929#endif
    3030
    31 #include <rtems/object.h>
    32 #include <rtems/options.h>
    33 #include <rtems/thread.h>
    34 #include <rtems/watchdog.h>
    35 #include <rtems/eventset.h>
     31#include <rtems/core/object.h>
     32#include <rtems/rtems/types.h>
     33#include <rtems/rtems/options.h>
     34#include <rtems/core/thread.h>
     35#include <rtems/core/watchdog.h>
     36#include <rtems/rtems/eventset.h>
    3637
    3738/*
     
    105106
    106107void _Event_Seize (
    107   rtems_event_set event_in,
    108   rtems_option    option_set,
    109   rtems_interval  ticks
     108  rtems_event_set  event_in,
     109  rtems_option     option_set,
     110  rtems_interval   ticks,
     111  rtems_event_set *event_out
    110112);
    111113
     
    148150EXTERN boolean _Event_Sync;    /* event manager sync flag */
    149151
    150 #include <rtems/event.inl>
    151 #include <rtems/eventmp.h>
     152#include <rtems/rtems/eventmp.h>
     153#include <rtems/rtems/event.inl>
    152154
    153155#ifdef __cplusplus
  • cpukit/rtems/include/rtems/rtems/eventmp.h

    r5072b07 r3a4ae6c  
    2222#endif
    2323
    24 #include <rtems/event.h>
    25 #include <rtems/mppkt.h>
    26 #include <rtems/object.h>
    27 #include <rtems/thread.h>
    28 #include <rtems/watchdog.h>
     24#include <rtems/rtems/event.h>
     25#include <rtems/core/mppkt.h>
     26#include <rtems/core/object.h>
     27#include <rtems/core/thread.h>
     28#include <rtems/core/watchdog.h>
    2929
    3030/*
  • cpukit/rtems/include/rtems/rtems/eventset.h

    r5072b07 r3a4ae6c  
    133133);
    134134
    135 #include <rtems/eventset.inl>
     135#include <rtems/rtems/eventset.inl>
    136136
    137137#ifdef __cplusplus
  • cpukit/rtems/include/rtems/rtems/intr.h

    r5072b07 r3a4ae6c  
    2222#endif
    2323
    24 #include <rtems/isr.h>
     24#include <rtems/core/isr.h>
    2525
    2626/*
     
    2929
    3030typedef ISR_Level rtems_interrupt_level;
     31
     32/*
     33 *  The following type defines the control block used to manage
     34 *  the vectors.
     35 */
     36 
     37typedef ISR_Vector_number rtems_vector_number;
     38
     39/*
     40 *  Return type for ISR Handler
     41 */
     42 
     43typedef void rtems_isr;
     44
     45/*
     46 *  Pointer to an ISR Handler
     47 */
     48 
     49typedef rtems_isr ( *rtems_isr_entry )(
     50                 rtems_vector_number
     51             );
    3152
    3253/*
  • cpukit/rtems/include/rtems/rtems/message.h

    r5072b07 r3a4ae6c  
    3535#endif
    3636
    37 #include <rtems/types.h>
    38 #include <rtems/chain.h>
    39 #include <rtems/object.h>
    40 #include <rtems/threadq.h>
     37#include <rtems/rtems/types.h>
     38#include <rtems/core/chain.h>
     39#include <rtems/core/object.h>
     40#include <rtems/rtems/attr.h>
     41#include <rtems/core/threadq.h>
    4142
    4243/*
     
    469470);
    470471
    471 #include <rtems/message.inl>
    472 #include <rtems/msgmp.h>
     472#include <rtems/rtems/message.inl>
     473#include <rtems/rtems/msgmp.h>
    473474
    474475#ifdef __cplusplus
  • cpukit/rtems/include/rtems/rtems/modes.h

    r5072b07 r3a4ae6c  
    2222#endif
    2323
    24 #include <rtems/isr.h>
     24#include <rtems/core/isr.h>
    2525
    2626/*
     
    174174);
    175175
    176 #include <rtems/modes.inl>
     176#include <rtems/rtems/modes.inl>
    177177
    178178#ifdef __cplusplus
  • cpukit/rtems/include/rtems/rtems/mp.h

    r5072b07 r3a4ae6c  
    4646void rtems_multiprocessing_announce ( void );
    4747
    48 /*
    49  *
    50  *  _Multiprocessing_Receive_server
    51  *
    52  *  DESCRIPTION:
    53  *
    54  *  This routine is a server thread which processes remote requests
    55  *  from other nodes.
    56  */
    57 
    58 Thread _Multiprocessing_Receive_server (
    59   Thread_Argument ignored
    60 );
    61 
    6248#ifdef __cplusplus
    6349}
  • cpukit/rtems/include/rtems/rtems/msgmp.h

    r5072b07 r3a4ae6c  
    2222#endif
    2323
    24 #include <rtems/message.h>
    25 #include <rtems/mppkt.h>
    26 #include <rtems/object.h>
    27 #include <rtems/options.h>
    28 #include <rtems/thread.h>
    29 #include <rtems/watchdog.h>
     24#include <rtems/rtems/message.h>
     25#include <rtems/core/mppkt.h>
     26#include <rtems/core/object.h>
     27#include <rtems/rtems/options.h>
     28#include <rtems/core/thread.h>
     29#include <rtems/core/watchdog.h>
    3030
    3131/*
     
    9898  unsigned32                         *size_p,
    9999  rtems_option                        option_set,
    100   rtems_interval                      timeout
     100  Watchdog_Interval                   timeout
    101101);
    102102
  • cpukit/rtems/include/rtems/rtems/options.h

    r5072b07 r3a4ae6c  
    7070);
    7171
    72 #include <rtems/options.inl>
     72#include <rtems/rtems/options.inl>
    7373
    7474#ifdef __cplusplus
  • cpukit/rtems/include/rtems/rtems/part.h

    r5072b07 r3a4ae6c  
    3232#endif
    3333
    34 #include <rtems.h>
    35 #include <rtems/address.h>
    36 #include <rtems/attr.h>
    37 #include <rtems/object.h>
     34#include <rtems/core/address.h>
     35#include <rtems/core/object.h>
     36#include <rtems/rtems/attr.h>
     37#include <rtems/rtems/types.h>
    3838
    3939/*
     
    281281);
    282282
    283 #include <rtems/part.inl>
    284 #include <rtems/partmp.h>
     283#include <rtems/rtems/part.inl>
     284#include <rtems/rtems/partmp.h>
    285285
    286286#ifdef __cplusplus
  • cpukit/rtems/include/rtems/rtems/partmp.h

    r5072b07 r3a4ae6c  
    2222#endif
    2323
    24 #include <rtems/mppkt.h>
    25 #include <rtems/object.h>
    26 #include <rtems/options.h>
    27 #include <rtems/part.h>
    28 #include <rtems/thread.h>
     24#include <rtems/core/mppkt.h>
     25#include <rtems/core/object.h>
     26#include <rtems/rtems/options.h>
     27#include <rtems/core/thread.h>
     28
     29#include <rtems/rtems/part.h>
    2930
    3031/*
  • cpukit/rtems/include/rtems/rtems/ratemon.h

    r5072b07 r3a4ae6c  
    3030#endif
    3131
    32 #include <rtems.h>
    33 #include <rtems/object.h>
    34 #include <rtems/thread.h>
    35 #include <rtems/watchdog.h>
     32#include <rtems/core/object.h>
     33#include <rtems/core/thread.h>
     34#include <rtems/core/watchdog.h>
    3635
    3736/*
     
    5150 */
    5251
    53 #define RTEMS_PERIOD_STATUS       RTEMS_NO_TIMEOUT
     52#define RTEMS_PERIOD_STATUS       WATCHDOG_NO_TIMEOUT
    5453
    5554/*
     
    149148
    150149rtems_status_code rtems_rate_monotonic_period(
    151   Objects_Id        id,
    152   rtems_interval length
     150  Objects_Id      id,
     151  rtems_interval  length
    153152);
    154153
     
    277276);
    278277
    279 #include <rtems/ratemon.inl>
     278#include <rtems/rtems/ratemon.inl>
    280279
    281280#ifdef __cplusplus
  • cpukit/rtems/include/rtems/rtems/region.h

    r5072b07 r3a4ae6c  
    3131#endif
    3232
    33 #include <rtems.h>
    34 #include <rtems/object.h>
    35 #include <rtems/threadq.h>
    36 #include <rtems/heap.h>
     33#include <rtems/core/object.h>
     34#include <rtems/core/threadq.h>
     35#include <rtems/core/heap.h>
    3736#include <rtems/debug.h>
     37#include <rtems/rtems/attr.h>
     38#include <rtems/rtems/types.h>
    3839
    3940/*
     
    159160  Objects_Id         id,
    160161  unsigned32         size,
    161   rtems_option    option_set,
    162   rtems_interval  timeout,
     162  rtems_option       option_set,
     163  rtems_interval     timeout,
    163164  void              **segment
    164165);
     
    279280);
    280281
    281 #include <rtems/region.inl>
    282 #include <rtems/regionmp.h>
     282#include <rtems/rtems/region.inl>
     283#include <rtems/rtems/regionmp.h>
    283284
    284285/*
  • cpukit/rtems/include/rtems/rtems/regionmp.h

    r5072b07 r3a4ae6c  
    2222#endif
    2323
    24 #include <rtems/mppkt.h>
    25 #include <rtems/object.h>
    26 #include <rtems/options.h>
    27 #include <rtems/region.h>
    28 #include <rtems/thread.h>
     24#include <rtems/core/mppkt.h>
     25#include <rtems/core/object.h>
     26#include <rtems/core/thread.h>
     27
     28#include <rtems/rtems/options.h>
     29#include <rtems/rtems/region.h>
    2930
    3031/*
     
    8889  void                        *segment,
    8990  unsigned32                   size,
    90   rtems_option              option_set,
    91   rtems_interval            timeout
     91  rtems_option                 option_set,
     92  rtems_interval               timeout
    9293);
    9394
  • cpukit/rtems/include/rtems/rtems/sem.h

    r5072b07 r3a4ae6c  
    3232#endif
    3333
    34 #include <rtems.h>
    35 #include <rtems/attr.h>
    36 #include <rtems/object.h>
    37 #include <rtems/threadq.h>
     34#include <rtems/rtems/types.h>
     35#include <rtems/rtems/support.h>
     36#include <rtems/rtems/tasks.h>
     37#include <rtems/rtems/attr.h>
     38#include <rtems/core/coremutex.h>
     39#include <rtems/core/object.h>
     40#include <rtems/core/coresem.h>
     41#include <rtems/core/threadq.h>
    3842
    3943/*
     
    4246
    4347typedef struct {
    44   Objects_Control       Object;
    45   Thread_queue_Control  Wait_queue;
    46   rtems_attribute    attribute_set;
    47   unsigned32            count;
    48   unsigned32            nest_count;
    49   Thread_Control       *holder;
    50   Objects_Id            holder_id;
     48  Objects_Control          Object;
     49  rtems_attribute          attribute_set;
     50  union {
     51    CORE_mutex_Control     mutex;
     52    CORE_semaphore_Control semaphore;
     53  } Core_control;
    5154}   Semaphore_Control;
    5255
     
    8386
    8487rtems_status_code rtems_semaphore_create(
    85   rtems_name            name,
    86   unsigned32            count,
    87   rtems_attribute       attribute_set,
    88   rtems_task_priority   priority_ceiling,
    89   Objects_Id           *id
     88  rtems_name           name,
     89  unsigned32           count,
     90  rtems_attribute      attribute_set,
     91  rtems_task_priority  priority_ceiling,
     92  rtems_id            *id
    9093);
    9194
     
    107110  rtems_name    name,
    108111  unsigned32    node,
    109   Objects_Id   *id
     112  rtems_id     *id
    110113);
    111114
     
    120123
    121124rtems_status_code rtems_semaphore_delete(
    122   Objects_Id id
     125  rtems_id  id
    123126);
    124127
     
    138141
    139142rtems_status_code rtems_semaphore_obtain(
    140   Objects_Id        id,
    141   unsigned32        option_set,
     143  rtems_id       id,
     144  unsigned32     option_set,
    142145  rtems_interval timeout
    143146);
     
    156159
    157160rtems_status_code rtems_semaphore_release(
    158   Objects_Id id
     161  rtems_id  id
    159162);
    160163
     
    214217
    215218STATIC INLINE Semaphore_Control *_Semaphore_Get (
    216   Objects_Id         id,
     219  rtems_id           id,
    217220  Objects_Locations *location
    218221);
     
    230233);
    231234
    232 #include <rtems/sem.inl>
    233 #include <rtems/semmp.h>
     235/*
     236 *  _Semaphore_Translate_core_mutex_return_code
     237 *
     238 *  DESCRIPTION:
     239 *
     240 *  This function returns a RTEMS status code based on the mutex
     241 *  status code specified.
     242 */
     243 
     244rtems_status_code _Semaphore_Translate_core_mutex_return_code (
     245  unsigned32 the_mutex_status
     246);
     247
     248/*
     249 *  _Semaphore_Translate_core_semaphore_return_code
     250 *
     251 *  DESCRIPTION:
     252 *
     253 *  This function returns a RTEMS status code based on the semaphore
     254 *  status code specified.
     255 */
     256 
     257rtems_status_code _Semaphore_Translate_core_semaphore_return_code (
     258  unsigned32 the_mutex_status
     259);
     260 
     261/*PAGE
     262 *
     263 *  _Semaphore_Core_mutex_mp_support
     264 *
     265 *  DESCRIPTION:
     266 *
     267 *  This function processes the global actions necessary for remote
     268 *  accesses to a global semaphore based on a core mutex.  This function
     269 *  is called by the core.
     270 */
     271
     272void  _Semaphore_Core_mutex_mp_support (
     273  Thread_Control *the_thread,
     274  rtems_id        id
     275);
     276
     277/*PAGE
     278 *
     279 *  _Semaphore_Core_mp_support
     280 *
     281 *  DESCRIPTION:
     282 *
     283 *  This function processes the global actions necessary for remote
     284 *  accesses to a global semaphore based on a core semaphore.  This function
     285 *  is called by the core.
     286 */
     287 
     288void  _Semaphore_Core_semaphore_mp_support (
     289  Thread_Control *the_thread,
     290  rtems_id        id
     291);
     292
     293#include <rtems/rtems/sem.inl>
     294#include <rtems/rtems/semmp.h>
    234295
    235296#ifdef __cplusplus
  • cpukit/rtems/include/rtems/rtems/semmp.h

    r5072b07 r3a4ae6c  
    2222#endif
    2323
    24 #include <rtems/mppkt.h>
    25 #include <rtems/object.h>
    26 #include <rtems/options.h>
    27 #include <rtems/sem.h>
    28 #include <rtems/thread.h>
    29 #include <rtems/watchdog.h>
     24#include <rtems/core/mppkt.h>
     25#include <rtems/core/object.h>
     26#include <rtems/rtems/options.h>
     27#include <rtems/rtems/sem.h>
     28#include <rtems/core/thread.h>
     29#include <rtems/core/watchdog.h>
    3030
    3131/*
     
    8585  Semaphore_MP_Remote_operations operation,
    8686  Objects_Id                     semaphore_id,
    87   rtems_option                option_set,
    88   rtems_interval              timeout
     87  rtems_option                   option_set,
     88  rtems_interval                 timeout
    8989);
    9090
  • cpukit/rtems/include/rtems/rtems/signal.h

    r5072b07 r3a4ae6c  
    2828#endif
    2929
    30 #include <rtems/asr.h>
    31 #include <rtems/modes.h>
    32 #include <rtems/object.h>
    33 #include <rtems/status.h>
    34 #include <rtems/types.h>
     30#include <rtems/rtems/asr.h>
     31#include <rtems/rtems/modes.h>
     32#include <rtems/core/object.h>
     33#include <rtems/rtems/status.h>
     34#include <rtems/rtems/types.h>
     35
     36/*
     37 *  _Signal_Manager_initialization
     38 *
     39 *  DESCRIPTION:
     40 *
     41 *  This routine performs the initialization necessary for this manager.
     42 */
     43 
     44void _Signal_Manager_initialization( void );
    3545
    3646/*
     
    6474);
    6575
    66 #include <rtems/signalmp.h>
     76#include <rtems/rtems/signalmp.h>
    6777
    6878#ifdef __cplusplus
  • cpukit/rtems/include/rtems/rtems/signalmp.h

    r5072b07 r3a4ae6c  
    2222#endif
    2323
    24 #include <rtems/asr.h>
    25 #include <rtems/mppkt.h>
    26 #include <rtems/object.h>
    27 #include <rtems/thread.h>
    28 #include <rtems/watchdog.h>
     24#include <rtems/rtems/asr.h>
     25#include <rtems/core/mppkt.h>
     26#include <rtems/core/object.h>
     27#include <rtems/core/thread.h>
     28#include <rtems/core/watchdog.h>
    2929
    3030/*
  • cpukit/rtems/include/rtems/rtems/status.h

    r5072b07 r3a4ae6c  
    5353  RTEMS_NOT_IMPLEMENTED          = 24, /* directive not implemented */
    5454  RTEMS_INTERNAL_ERROR           = 25, /* RTEMS inconsistency detected */
    55   RTEMS_PROXY_BLOCKING           = 26, /* internal multiprocessing only */
    56   RTEMS_NO_MEMORY                = 27  /* could not get enough memory */
     55  RTEMS_NO_MEMORY                = 26  /* could not get enough memory */
    5756} rtems_status_code;
    5857
    5958#define RTEMS_STATUS_CODES_FIRST RTEMS_SUCCESSFUL
    6059#define RTEMS_STATUS_CODES_LAST  RTEMS_NO_MEMORY
     60
     61extern rtems_status_code _Status_Object_name_errors_to_status[];
     62
     63#ifdef INIT
     64rtems_status_code _Status_Object_name_errors_to_status[] = {
     65  RTEMS_SUCCESSFUL,      /* OBJECTS_SUCCESSFUL */
     66  RTEMS_INVALID_NAME,    /* OBJECTS_INVALID_NAME */
     67  RTEMS_INVALID_NODE     /* OBJECTS_INVALID_NODE */
     68};
     69#endif
    6170
    6271/*
     
    8796);
    8897
    89 /*
    90  *  _Status_Is_proxy_blocking
    91  *
    92  *  DESCRIPTION:
    93  *
    94  *  This function returns TRUE if the status code is equal to the
    95  *  status which indicates that a proxy is blocking, and FALSE otherwise.
    96  */
    97 
    98 STATIC INLINE boolean _Status_Is_proxy_blocking (
    99   rtems_status_code code
    100 );
    101 
    102 #include <rtems/status.inl>
     98#include <rtems/rtems/status.inl>
    10399
    104100#ifdef __cplusplus
  • cpukit/rtems/include/rtems/rtems/support.h

    r5072b07 r3a4ae6c  
    2222#endif
    2323
    24 #include <rtems/types.h>
     24#include <rtems/rtems/types.h>
    2525
    2626/*
     
    7171);
    7272
    73 #include <rtems/support.inl>
     73/*
     74 *  rtems_get_class
     75 *
     76 *  DESCRIPTION:
     77 *
     78 *  This function returns the class portion of the ID.
     79 *
     80 */
     81 
     82#define rtems_get_class( _id ) \
     83  _Objects_Get_class( _id )
     84 
     85/*
     86 *  rtems_get_node
     87 *
     88 *  DESCRIPTION:
     89 *
     90 *  This function returns the node portion of the ID.
     91 *
     92 */
     93 
     94#define rtems_get_node( _id ) \
     95  _Objects_Get_node( _id )
     96 
     97/*
     98 *  rtems_get_index
     99 *
     100 *  DESCRIPTION:
     101 *
     102 *  This function returns the index portion of the ID.
     103 *
     104 */
     105 
     106#define rtems_get_index( _id ) \
     107  _Objects_Get_index( _id )
     108
     109/*
     110 *  Time related
     111 */
     112
     113#define RTEMS_MILLISECONDS_TO_MICROSECONDS(_ms) \
     114        TOD_MILLISECONDS_TO_MICROSECONDS(_ms)
     115#define RTEMS_MILLISECONDS_TO_TICKS(_ms) \
     116        TOD_MILLISECONDS_TO_TICKS(_ms)
     117
     118#include <rtems/rtems/support.inl>
    74119
    75120#ifdef __cplusplus
  • cpukit/rtems/include/rtems/rtems/taskmp.h

    r5072b07 r3a4ae6c  
    2222#endif
    2323
    24 #include <rtems/mppkt.h>
    25 #include <rtems/object.h>
    26 #include <rtems/options.h>
    27 #include <rtems/priority.h>
    28 #include <rtems/tasks.h>
    29 #include <rtems/thread.h>
     24#include <rtems/core/mppkt.h>
     25#include <rtems/core/object.h>
     26#include <rtems/rtems/options.h>
     27#include <rtems/core/priority.h>
     28#include <rtems/rtems/tasks.h>
     29#include <rtems/core/thread.h>
    3030
    3131/*
  • cpukit/rtems/include/rtems/rtems/tasks.h

    r5072b07 r3a4ae6c  
    3939#endif
    4040
    41 #include <rtems.h>
    42 #include <rtems/message.h>
    43 #include <rtems/object.h>
    44 #include <rtems/part.h>
    45 #include <rtems/region.h>
    46 #include <rtems/sem.h>
    47 #include <rtems/states.h>
    48 #include <rtems/thread.h>
    49 #include <rtems/threadq.h>
    50 #include <rtems/types.h>
     41#include <rtems/core/object.h>
     42#include <rtems/core/states.h>
     43#include <rtems/core/thread.h>
     44#include <rtems/rtems/types.h>
     45#include <rtems/rtems/eventset.h>
     46#include <rtems/rtems/asr.h>
     47#include <rtems/rtems/attr.h>
    5148
    5249/*
     
    6158 */
    6259
    63 #define RTEMS_YIELD_PROCESSOR RTEMS_NO_TIMEOUT
     60#define RTEMS_YIELD_PROCESSOR WATCHDOG_NO_TIMEOUT
     61
     62/*
     63 *  Define the type for an RTEMS API task priority.
     64 */
     65
     66typedef Priority_Control rtems_task_priority;
     67
     68#define RTEMS_NO_PRIORITY           RTEMS_CURRENT_PRIORITY
     69
     70#define RTEMS_MINIMUM_PRIORITY      (PRIORITY_MINIMUM + 1)
     71#define RTEMS_MAXIMUM_PRIORITY      PRIORITY_MAXIMUM
     72
     73/*
     74 *  The following constant is passed to rtems_task_set_priority when the
     75 *  caller wants to obtain the current priority.
     76 */
     77
     78#define RTEMS_CURRENT_PRIORITY      PRIORITY_MINIMUM   
     79
     80/*
     81 *  Notepads constants (indices into notepad array)
     82 */
     83 
     84#define RTEMS_NOTEPAD_FIRST 0             /* lowest numbered notepad */
     85#define RTEMS_NOTEPAD_0    0              /* notepad location 0  */
     86#define RTEMS_NOTEPAD_1    1              /* notepad location 1  */
     87#define RTEMS_NOTEPAD_2    2              /* notepad location 2  */
     88#define RTEMS_NOTEPAD_3    3              /* notepad location 3  */
     89#define RTEMS_NOTEPAD_4    4              /* notepad location 4  */
     90#define RTEMS_NOTEPAD_5    5              /* notepad location 5  */
     91#define RTEMS_NOTEPAD_6    6              /* notepad location 6  */
     92#define RTEMS_NOTEPAD_7    7              /* notepad location 7  */
     93#define RTEMS_NOTEPAD_8    8              /* notepad location 8  */
     94#define RTEMS_NOTEPAD_9    9              /* notepad location 9  */
     95#define RTEMS_NOTEPAD_10   10             /* notepad location 10 */
     96#define RTEMS_NOTEPAD_11   11             /* notepad location 11 */
     97#define RTEMS_NOTEPAD_12   12             /* notepad location 12 */
     98#define RTEMS_NOTEPAD_13   13             /* notepad location 13 */
     99#define RTEMS_NOTEPAD_14   14             /* notepad location 14 */
     100#define RTEMS_NOTEPAD_15   15             /* notepad location 15 */
     101#define RTEMS_NOTEPAD_LAST RTEMS_NOTEPAD_15     /* highest numbered notepad */
     102 
     103#define RTEMS_NUMBER_NOTEPADS  (RTEMS_NOTEPAD_LAST+1)
     104
     105/*
     106 *  External API name for Thread_Control
     107 */
     108
     109typedef Thread_Control rtems_tcb;
     110
     111/*
     112 *  The following defines the "return type" of an RTEMS task.
     113 */
     114 
     115typedef void rtems_task;
     116
     117/*
     118 *  The following defines the argument to an RTEMS task.
     119 */
     120 
     121typedef unsigned32 rtems_task_argument;
     122
     123/*
     124 *  The following defines the type for the entry point of an RTEMS task.
     125 */
     126 
     127typedef rtems_task ( *rtems_task_entry )(
     128                      rtems_task_argument
     129                   );
     130 
     131/*
     132 *  The following records define the Initialization Tasks Table.
     133 *  Each entry contains the information required by RTEMS to
     134 *  create and start a user task automatically at executive
     135 *  initialization time.
     136 */
     137 
     138typedef struct {
     139  rtems_name            name;              /* task name */
     140  unsigned32            stack_size;        /* task stack size */
     141  rtems_task_priority   initial_priority;  /* task priority */
     142  rtems_attribute       attribute_set;     /* task attributes */
     143  rtems_task_entry      entry_point;       /* task entry point */
     144  rtems_mode            mode_set;          /* task initial mode */
     145  unsigned32            argument;          /* task argument */
     146} rtems_initialization_tasks_table;
     147
     148/*
     149 *  This is the API specific information required by each thread for
     150 *  the RTEMS API to function correctly.
     151 */
     152
     153 
     154typedef struct {
     155  unsigned32                Notepads[ RTEMS_NUMBER_NOTEPADS ];
     156  rtems_event_set           pending_events;
     157  rtems_event_set           event_condition;
     158  ASR_Information           Signal;
     159}  RTEMS_API_Control;
    64160
    65161/*
     
    71167
    72168/*
     169 *  These are used to manage the user initialization tasks.
     170 */
     171
     172EXTERN rtems_initialization_tasks_table *_RTEMS_tasks_User_initialization_tasks;
     173EXTERN unsigned32   _RTEMS_tasks_Number_of_initialization_tasks;
     174
     175/*
    73176 *  _RTEMS_tasks_Manager_initialization
    74177 *
     
    79182 
    80183void _RTEMS_tasks_Manager_initialization(
    81   unsigned32   maximum_tasks
     184  unsigned32                        maximum_tasks,
     185  unsigned32                        number_of_initialization_tasks,
     186  rtems_initialization_tasks_table *user_tasks
    82187);
    83188
     
    285390
    286391rtems_status_code rtems_task_wake_after(
    287   rtems_interval ticks
     392  rtems_interval  ticks
    288393);
    289394
     
    314419
    315420/*
    316  *  _RTEMS_tasks_Cancel_wait
    317  *
    318  *  DESCRIPTION:
    319  *
    320  *  This routine unblocks the_thread and cancels any timers
    321  *  which the_thread has active.
    322  */
    323 
    324 STATIC INLINE void _RTEMS_tasks_Cancel_wait(
    325   Thread_Control *the_thread
    326 );
    327 
    328 /*
    329  *  _RTEMS_Tasks_Priority_to_Core
     421 *  _RTEMS_tasks_Priority_to_Core
    330422 *
    331423 *  DESCRIPTION:
     
    334426 */
    335427 
    336 STATIC INLINE Priority_Control _RTEMS_Tasks_Priority_to_Core(
     428STATIC INLINE Priority_Control _RTEMS_tasks_Priority_to_Core(
    337429  rtems_task_priority   priority
    338430);
    339431
    340 #include <rtems/tasks.inl>
    341 #include <rtems/taskmp.h>
     432/*PAGE
     433 *
     434 *  _RTEMS_tasks_Initialize_user_tasks
     435 *
     436 *  This routine creates and starts all configured user
     437 *  initialzation threads.
     438 *
     439 *  Input parameters: NONE
     440 *
     441 *  Output parameters:  NONE
     442 */
     443 
     444void _RTEMS_tasks_Initialize_user_tasks( void );
     445
     446/*PAGE
     447 *
     448 *  _RTEMS_tasks_Priority_is_valid
     449 *
     450 */
     451 
     452STATIC INLINE boolean _RTEMS_tasks_Priority_is_valid (
     453  rtems_task_priority the_priority
     454);
     455
     456#include <rtems/rtems/tasks.inl>
     457#include <rtems/rtems/taskmp.h>
    342458
    343459#ifdef __cplusplus
  • cpukit/rtems/include/rtems/rtems/timer.h

    r5072b07 r3a4ae6c  
    3434#endif
    3535
    36 #include <rtems.h>
    37 #include <rtems/object.h>
    38 #include <rtems/tod.h>
    39 #include <rtems/watchdog.h>
     36#include <rtems/core/object.h>
     37#include <rtems/core/tod.h>
     38#include <rtems/core/watchdog.h>
    4039
    4140/*
     
    5150
    5251/*
    53  *  The following defines the type of a Timer Service Routine.
    54  */
    55 
    56 typedef rtems_timer_service_routine_entry Timer_Service;
     52 *  The following types define a pointer to a timer service routine.
     53 */
     54 
     55typedef void rtems_timer_service_routine;
     56 
     57typedef rtems_timer_service_routine ( *rtems_timer_service_routine_entry )(
     58                 rtems_id,
     59                 void *
     60             );
    5761
    5862/*
     
    154158
    155159rtems_status_code rtems_timer_fire_after(
    156   Objects_Id         id,
    157   rtems_interval  ticks,
    158   Timer_Service      routine,
    159   void              *user_data
     160  Objects_Id                         id,
     161  rtems_interval                     ticks,
     162  rtems_timer_service_routine_entry  routine,
     163  void                              *user_data
    160164);
    161165
     
    171175
    172176rtems_status_code rtems_timer_fire_when(
    173   Objects_Id         id,
    174   rtems_time_of_day       *wall_time,
    175   Timer_Service      routine,
    176   void              *user_data
     177  Objects_Id                          id,
     178  rtems_time_of_day                  *wall_time,
     179  rtems_timer_service_routine_entry   routine,
     180  void                               *user_data
    177181);
    178182
     
    284288);
    285289
    286 #include <rtems/timer.inl>
     290#include <rtems/rtems/timer.inl>
    287291
    288292#ifdef __cplusplus
  • cpukit/rtems/include/rtems/rtems/types.h

    r5072b07 r3a4ae6c  
    2121#endif
    2222
    23 #include <rtems/object.h>
    24 #include <rtems/priority.h>
    25 #include <rtems/modes.h>
     23#include <rtems/core/object.h>
     24#include <rtems/core/priority.h>
     25#include <rtems/rtems/modes.h>
     26#include <rtems/core/mpci.h>
     27#include <rtems/core/mppkt.h>
    2628
    2729/*
     
    5254
    5355/*
    54  *  Define the type for an RTEMS API task priority.
     56 *  Time related
    5557 */
    5658
    57 typedef Priority_Control rtems_task_priority;
     59typedef Watchdog_Interval rtems_interval;
     60typedef TOD_Control       rtems_time_of_day;
    5861
    59 #define RTEMS_NO_PRIORITY  RTEMS_CURRENT_PRIORITY
    6062/*
    6163 *  Define the type for an RTEMS API task mode.
     
    6365 
    6466typedef Modes_Control rtems_mode;
     67
     68/*
     69 *  MPCI related entries
     70 */
     71
     72typedef MP_packet_Classes          rtems_mp_packet_classes;
     73typedef MP_packet_Prefix           rtems_packet_prefix;
     74
     75typedef MPCI_initialization_entry  rtems_mpci_initialization_entry;
     76typedef MPCI_get_packet_entry      rtems_mpci_get_packet_entry;
     77typedef MPCI_return_packet_entry   rtems_mpci_return_packet_entry;
     78typedef MPCI_send_entry            rtems_mpci_send_packet_entry;
     79typedef MPCI_receive_entry         rtems_mpci_receive_packet_entry;
     80
     81typedef MPCI_Entry rtems_mpci_entry;
     82
     83typedef MPCI_Control rtems_mpci_table;
    6584
    6685#ifdef __cplusplus
  • cpukit/rtems/inline/rtems/rtems/asr.inl

    r5072b07 r3a4ae6c  
    1818#define __INLINE_ASR_inl
    1919
    20 #include <rtems/isr.h>
     20#include <rtems/core/isr.h>
    2121
    2222/*PAGE
     
    3030)
    3131{
     32  information->is_enabled      = TRUE;
    3233  information->handler         = NULL;
    3334  information->mode_set        = RTEMS_DEFAULT_MODES;
     
    4849{
    4950  rtems_signal_set _signals;
    50   ISR_Level              _level;
     51  ISR_Level        _level;
    5152
    5253  _ISR_Disable( _level );
  • cpukit/rtems/inline/rtems/rtems/attr.inl

    r5072b07 r3a4ae6c  
    109109}
    110110
     111/*PAGE
     112 *
     113 *  _Attributes_Is_priority_ceiling
     114 *
     115 */
     116 
     117STATIC INLINE boolean _Attributes_Is_priority_ceiling(
     118  rtems_attribute attribute_set
     119)
     120{
     121   return ( attribute_set & RTEMS_PRIORITY_CEILING );
     122}
     123
    111124#endif
    112125/* end of include file */
  • cpukit/rtems/inline/rtems/rtems/event.inl

    r5072b07 r3a4ae6c  
    2525{
    2626  _Event_Sync = FALSE;
     27
     28  /*
     29   *  Register the MP Process Packet routine.
     30   */
     31 
     32  _MPCI_Register_packet_processor( MP_PACKET_EVENT, _Event_MP_Process_packet );
    2733}
    2834
  • cpukit/rtems/inline/rtems/rtems/message.inl

    r5072b07 r3a4ae6c  
    1818#define __MESSAGE_QUEUE_inl
    1919
    20 #include <rtems/wkspace.h>
     20#include <rtems/core/wkspace.h>
    2121
    2222/*PAGE
  • cpukit/rtems/inline/rtems/rtems/modes.inl

    r5072b07 r3a4ae6c  
    5454)
    5555{
    56    return ( mode_set & RTEMS_ASR_MASK );
     56   return (mode_set & RTEMS_ASR_MASK) == RTEMS_NO_ASR;
    5757}
    5858
     
    6767)
    6868{
    69    return ( ( mode_set & RTEMS_PREEMPT_MASK ) == RTEMS_PREEMPT );
     69   return (mode_set & RTEMS_PREEMPT_MASK) == RTEMS_PREEMPT;
    7070}
    7171
     
    8080)
    8181{
    82   return ((mode_set & (RTEMS_TIMESLICE_MASK|RTEMS_PREEMPT_MASK)) ==
    83                   (RTEMS_TIMESLICE|RTEMS_PREEMPT) );
     82  return (mode_set & RTEMS_TIMESLICE_MASK) == RTEMS_TIMESLICE;
    8483}
    8584
  • cpukit/rtems/inline/rtems/rtems/status.inl

    r5072b07 r3a4ae6c  
    4545}
    4646
    47 /*
    48  *  _Status_Is_proxy_blocking
    49  *
    50  */
    51 
    52 STATIC INLINE boolean _Status_Is_proxy_blocking (
    53   rtems_status_code code
    54 )
    55 {
    56   return (code == RTEMS_PROXY_BLOCKING);
    57 }
    58 
    5947#endif
    6048/* end of include file */
  • cpukit/rtems/inline/rtems/rtems/tasks.inl

    r5072b07 r3a4ae6c  
    1717#ifndef __RTEMS_TASKS_inl
    1818#define __RTEMS_TASKS_inl
    19 
    20 #include <rtems/msgmp.h>
    21 #include <rtems/partmp.h>
    22 #include <rtems/regionmp.h>
    23 #include <rtems/semmp.h>
    2419
    2520/*PAGE
     
    5247/*PAGE
    5348 *
    54  *  _RTEMS_tasks_Cancel_wait
    55  *
    56  */
    57 
    58 STATIC INLINE void _RTEMS_tasks_Cancel_wait(
    59   Thread_Control *the_thread
    60 )
    61 {
    62   States_Control state;
    63   States_Control remote_state;
    64 
    65   state = the_thread->current_state;
    66 
    67 /* XXX do this with the object class */
    68   if ( _States_Is_waiting_on_thread_queue( state ) ) {
    69     if ( _States_Is_waiting_for_rpc_reply( state ) &&
    70           _States_Is_locally_blocked( state ) ) {
    71       remote_state = _States_Clear(
    72                        STATES_WAITING_FOR_RPC_REPLY | STATES_TRANSIENT,
    73                        state
    74                      );
    75 
    76       switch ( remote_state ) {
    77 
    78         case STATES_WAITING_FOR_BUFFER:
    79           _Partition_MP_Send_extract_proxy( the_thread );
    80           break;
    81         case STATES_WAITING_FOR_SEGMENT:
    82           _Region_MP_Send_extract_proxy( the_thread );
    83           break;
    84         case STATES_WAITING_FOR_SEMAPHORE:
    85           _Semaphore_MP_Send_extract_proxy( the_thread );
    86           break;
    87         case STATES_WAITING_FOR_MESSAGE:
    88           _Message_queue_MP_Send_extract_proxy( the_thread );
    89           break;
    90       }
    91     }
    92     _Thread_queue_Extract( the_thread->Wait.queue, the_thread );
    93   }
    94   else if ( _Watchdog_Is_active( &the_thread->Timer ) )
    95     (void) _Watchdog_Remove( &the_thread->Timer );
    96 }
    97 
    98 /*PAGE
    99  *
    100  *  _RTEMS_Tasks_Priority_to_Core
     49 *  _RTEMS_tasks_Priority_to_Core
    10150 */
    10251 
    103 STATIC INLINE Priority_Control _RTEMS_Tasks_Priority_to_Core(
     52STATIC INLINE Priority_Control _RTEMS_tasks_Priority_to_Core(
    10453  rtems_task_priority   priority
    10554)
     
    10857}
    10958
     59/*PAGE
     60 *
     61 *  _RTEMS_tasks_Priority_is_valid
     62 *
     63 */
     64 
     65STATIC INLINE boolean _RTEMS_tasks_Priority_is_valid (
     66  rtems_task_priority the_priority
     67)
     68{
     69  return (  ( the_priority >= RTEMS_MINIMUM_PRIORITY ) &&
     70            ( the_priority <= RTEMS_MAXIMUM_PRIORITY ) );
     71}
     72
    11073#endif
    11174/* end of include file */
  • cpukit/rtems/macros/rtems/rtems/asr.inl

    r5072b07 r3a4ae6c  
    1818#define __INLINE_ASR_h
    1919
    20 #include <rtems/isr.h>
     20#include <rtems/core/isr.h>
    2121
    2222/*PAGE
     
    2828#define _ASR_Initialize( _information ) \
    2929{ \
     30  (_information)->is_enabled      = TRUE; \
    3031  (_information)->handler         = NULL; \
    3132  (_information)->mode_set        = RTEMS_DEFAULT_MODES; \
  • cpukit/rtems/macros/rtems/rtems/attr.inl

    r5072b07 r3a4ae6c  
    7979  ( (_attribute_set) & RTEMS_INHERIT_PRIORITY )
    8080
     81/*PAGE
     82 *
     83 *  _Attributes_Is_priority_ceiling
     84 *
     85 */
     86 
     87#define _Attributes_Is_priority_ceiling( _attribute_set ) \
     88  ( (_attribute_set) & RTEMS_PRIORITY_CEILING )
     89
    8190#endif
    8291/* end of include file */
  • cpukit/rtems/macros/rtems/rtems/event.inl

    r5072b07 r3a4ae6c  
    2323
    2424#define _Event_Manager_initialization() \
    25   _Event_Sync = FALSE
     25  do { \
     26    \
     27    _Event_Sync = FALSE; \
     28    \
     29    /* \
     30     *  Register the MP Process Packet routine. \
     31     */ \
     32    \
     33    _MPCI_Register_packet_processor( \
     34      MP_PACKET_EVENT, \
     35      _Event_MP_Process_packet \
     36    ); \
     37  } while ( 0 )
    2638
    2739#endif
  • cpukit/rtems/macros/rtems/rtems/modes.inl

    r5072b07 r3a4ae6c  
    4242
    4343#define _Modes_Is_asr_disabled( _mode_set ) \
    44    ( (_mode_set) & RTEMS_ASR_MASK )
     44   (((_mode_set) & RTEMS_ASR_MASK) == RTEMS_NO_ASR)
    4545
    4646/*PAGE
     
    6060
    6161#define _Modes_Is_timeslice( _mode_set ) \
    62   (((_mode_set) & (RTEMS_TIMESLICE_MASK|RTEMS_PREEMPT_MASK)) == \
    63                   (RTEMS_TIMESLICE|RTEMS_PREEMPT) )
     62  (((_mode_set) & RTEMS_TIMESLICE_MASK) == RTEMS_TIMESLICE)
    6463
    6564/*PAGE
  • cpukit/rtems/macros/rtems/rtems/status.inl

    r5072b07 r3a4ae6c  
    3636   ((_code1) == (_code2))
    3737
    38 /*
    39  *  _Status_Is_proxy_blocking
    40  *
    41  */
    42 
    43 #define _Status_Is_proxy_blocking( _code ) \
    44   ( (_code) == RTEMS_PROXY_BLOCKING )
    45 
    4638#endif
    4739/* end of include file */
  • cpukit/rtems/macros/rtems/rtems/tasks.inl

    r5072b07 r3a4ae6c  
    1717#ifndef __RTEMS_TASKS_inl
    1818#define __RTEMS_TASKS_inl
    19 
    20 #include <rtems/msgmp.h>
    21 #include <rtems/partmp.h>
    22 #include <rtems/regionmp.h>
    23 #include <rtems/semmp.h>
    2419
    2520/*PAGE
     
    4338/*PAGE
    4439 *
    45  *  _RTEMS_tasks_Cancel_wait
    46  *
     40 *  _RTEMS_tasks_Priority_to_Core
    4741 */
    48 
    49 #define _RTEMS_tasks_Cancel_wait( _the_thread ) \
    50   { \
    51     States_Control _state; \
    52     States_Control _remote_state; \
    53     \
    54     _state = (_the_thread)->current_state; \
    55     \
    56     if ( _States_Is_waiting_on_thread_queue( _state ) ) { \
    57       if ( _States_Is_waiting_for_rpc_reply( _state ) && \
    58             _States_Is_locally_blocked( _state ) ) { \
    59         _remote_state = _States_Clear( \
    60                        STATES_WAITING_FOR_RPC_REPLY + STATES_TRANSIENT, \
    61                        _state \
    62                      ); \
    63         \
    64         switch ( _remote_state ) { \
    65           \
    66           case STATES_WAITING_FOR_BUFFER: \
    67             _Partition_MP_Send_extract_proxy( (_the_thread) ); \
    68             break; \
    69           case STATES_WAITING_FOR_SEGMENT: \
    70             _Region_MP_Send_extract_proxy( (_the_thread) ); \
    71             break; \
    72           case STATES_WAITING_FOR_SEMAPHORE: \
    73             _Semaphore_MP_Send_extract_proxy( (_the_thread) ); \
    74             break; \
    75           case STATES_WAITING_FOR_MESSAGE: \
    76             _Message_queue_MP_Send_extract_proxy( (_the_thread) ); \
    77             break; \
    78         } \
    79       } \
    80       _Thread_queue_Extract( (_the_thread)->Wait.queue, (_the_thread) ); \
    81     } \
    82     else if ( _Watchdog_Is_active( &(_the_thread)->Timer ) ) \
    83       (void) _Watchdog_Remove( &(_the_thread)->Timer ); \
    84   }
     42 
     43#define _RTEMS_tasks_Priority_to_Core( _priority ) \
     44  ((Priority_Control) (_priority))
    8545
    8646/*PAGE
    8747 *
    88  *  _RTEMS_Tasks_Priority_to_Core
     48 *  _RTEMS_tasks_Priority_is_valid
     49 *
    8950 */
    9051 
    91 #define _RTEMS_Tasks_Priority_to_Core( _priority ) \
    92   ((Priority_Control) (_priority))
     52#define _RTEMS_tasks_Priority_is_valid( _the_priority ) \
     53  ( ((_the_priority) >= RTEMS_MINIMUM_PRIORITY) && \
     54    ((_the_priority) <= RTEMS_MAXIMUM_PRIORITY) )
     55 
    9356
    9457#endif
  • cpukit/rtems/src/dpmem.c

    r5072b07 r3a4ae6c  
    1414
    1515#include <rtems/system.h>
    16 #include <rtems/support.h>
    17 #include <rtems/address.h>
    18 #include <rtems/dpmem.h>
    19 #include <rtems/object.h>
    20 #include <rtems/thread.h>
     16#include <rtems/rtems/status.h>
     17#include <rtems/rtems/support.h>
     18#include <rtems/core/address.h>
     19#include <rtems/rtems/dpmem.h>
     20#include <rtems/core/object.h>
     21#include <rtems/core/thread.h>
     22#include <rtems/rtems/dpmem.h>
    2123
    2224/*PAGE
     
    7981
    8082  if ( !rtems_is_name_valid( name) )
    81     return ( RTEMS_INVALID_NAME );
     83    return RTEMS_INVALID_NAME;
    8284
    8385  if ( !_Addresses_Is_aligned( internal_start ) ||
    8486       !_Addresses_Is_aligned( external_start ) )
    85     return( RTEMS_INVALID_ADDRESS );
     87    return RTEMS_INVALID_ADDRESS;
    8688
    8789  _Thread_Disable_dispatch();             /* to prevent deletion */
     
    9193  if ( !the_port ) {
    9294    _Thread_Enable_dispatch();
    93     return( RTEMS_TOO_MANY );
     95    return RTEMS_TOO_MANY;
    9496  }
    9597
     
    106108  *id = the_port->Object.id;
    107109  _Thread_Enable_dispatch();
    108   return( RTEMS_SUCCESSFUL );
     110  return RTEMS_SUCCESSFUL;
    109111}
    110112
     
    131133)
    132134{
    133   return(
    134     _Objects_Name_to_id(
    135       &_Dual_ported_memory_Information,
    136       &name,
    137       RTEMS_SEARCH_ALL_NODES,
    138       id
    139     )
     135  Objects_Name_to_id_errors  status;
     136
     137  status = _Objects_Name_to_id(
     138    &_Dual_ported_memory_Information,
     139    &name,
     140    OBJECTS_SEARCH_ALL_NODES,
     141    id
    140142  );
     143
     144  return _Status_Object_name_errors_to_status[ status ];
    141145}
    142146
     
    166170  switch ( location ) {
    167171    case OBJECTS_ERROR:
    168       return( RTEMS_INVALID_ID );
     172      return RTEMS_INVALID_ID;
    169173    case OBJECTS_REMOTE:        /* this error cannot be returned */
    170       return( RTEMS_INTERNAL_ERROR );
     174      return RTEMS_INTERNAL_ERROR;
    171175    case OBJECTS_LOCAL:
    172176      _Objects_Close( &_Dual_ported_memory_Information, &the_port->Object );
    173177      _Dual_ported_memory_Free( the_port );
    174178      _Thread_Enable_dispatch();
    175       return( RTEMS_SUCCESSFUL );
    176   }
    177 
    178   return( RTEMS_INTERNAL_ERROR );   /* unreached - only to remove warnings */
     179      return RTEMS_SUCCESSFUL;
     180  }
     181
     182  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
    179183}
    180184
     
    211215  switch ( location ) {
    212216    case OBJECTS_ERROR:
    213       return( RTEMS_INVALID_ID );
     217      return RTEMS_INVALID_ID;
    214218    case OBJECTS_REMOTE:        /* this error cannot be returned */
    215       return( RTEMS_INTERNAL_ERROR );
     219      return RTEMS_INTERNAL_ERROR;
    216220    case OBJECTS_LOCAL:
    217221      ending = _Addresses_Subtract( internal, the_port->internal_base );
     
    222226                                           ending );
    223227      _Thread_Enable_dispatch();
    224       return( RTEMS_SUCCESSFUL );
    225   }
    226 
    227   return( RTEMS_INTERNAL_ERROR );   /* unreached - only to remove warnings */
     228      return RTEMS_SUCCESSFUL;
     229  }
     230
     231  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
    228232}
    229233
     
    260264  switch ( location ) {
    261265    case OBJECTS_ERROR:
    262       return( RTEMS_INVALID_ID );
     266      return RTEMS_INVALID_ID;
    263267    case OBJECTS_REMOTE:        /* this error cannot be returned */
    264       return( RTEMS_INTERNAL_ERROR );
     268      return RTEMS_INTERNAL_ERROR;
    265269    case OBJECTS_LOCAL:
    266270      ending = _Addresses_Subtract( external, the_port->external_base );
     
    271275                                           ending );
    272276      _Thread_Enable_dispatch();
    273       return( RTEMS_SUCCESSFUL );
    274   }
    275 
    276   return( RTEMS_INTERNAL_ERROR );   /* unreached - only to remove warnings */
    277 }
     277      return RTEMS_SUCCESSFUL;
     278  }
     279
     280  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
     281}
  • cpukit/rtems/src/event.c

    r5072b07 r3a4ae6c  
    1414
    1515#include <rtems/system.h>
    16 #include <rtems/event.h>
    17 #include <rtems/isr.h>
    18 #include <rtems/object.h>
    19 #include <rtems/options.h>
    20 #include <rtems/states.h>
    21 #include <rtems/thread.h>
     16#include <rtems/rtems/status.h>
     17#include <rtems/rtems/event.h>
     18#include <rtems/core/isr.h>
     19#include <rtems/core/object.h>
     20#include <rtems/rtems/options.h>
     21#include <rtems/core/states.h>
     22#include <rtems/core/thread.h>
     23#include <rtems/rtems/tasks.h>
    2224
    2325/*PAGE
     
    4345  register Thread_Control *the_thread;
    4446  Objects_Locations        location;
     47  RTEMS_API_Control       *api;
    4548
    4649  the_thread = _Thread_Get( id, &location );
    4750  switch ( location ) {
    4851    case OBJECTS_ERROR:
    49       return( RTEMS_INVALID_ID );
     52      return RTEMS_INVALID_ID;
    5053    case OBJECTS_REMOTE:
    5154      return(
     
    5760      );
    5861    case OBJECTS_LOCAL:
    59       _Event_sets_Post( event_in, &the_thread->RTEMS_API->pending_events );
     62      api = the_thread->API_Extensions[ THREAD_API_RTEMS ];
     63      _Event_sets_Post( event_in, &api->pending_events );
    6064      _Event_Surrender( the_thread );
    6165      _Thread_Enable_dispatch();
    62       return( RTEMS_SUCCESSFUL );
     66      return RTEMS_SUCCESSFUL;
    6367  }
    6468
    65   return( RTEMS_INTERNAL_ERROR );   /* unreached - only to remove warnings */
     69  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
    6670}
    6771
     
    9195)
    9296{
     97  RTEMS_API_Control       *api;
     98
     99  api = _Thread_Executing->API_Extensions[ THREAD_API_RTEMS ];
     100
    93101  if ( _Event_sets_Is_empty( event_in ) ) {
    94     *event_out = _Thread_Executing->RTEMS_API->pending_events;
    95     return( RTEMS_SUCCESSFUL );
     102    *event_out = api->pending_events;
     103    return RTEMS_SUCCESSFUL;
    96104  }
    97105
    98106  _Thread_Disable_dispatch();
    99   _Event_Seize( event_in, option_set, ticks );
     107  _Event_Seize( event_in, option_set, ticks, event_out );
    100108  _Thread_Enable_dispatch();
    101   *event_out = _Thread_Executing->RTEMS_API->events_out;
    102109  return( _Thread_Executing->Wait.return_code );
    103110}
  • cpukit/rtems/src/eventmp.c

    r5072b07 r3a4ae6c  
    1414
    1515#include <rtems/system.h>
    16 #include <rtems/event.h>
    17 #include <rtems/mpci.h>
    18 #include <rtems/mppkt.h>
    19 #include <rtems/object.h>
    20 #include <rtems/options.h>
    21 #include <rtems/states.h>
    22 #include <rtems/thread.h>
     16#include <rtems/rtems/status.h>
     17#include <rtems/rtems/event.h>
     18#include <rtems/core/mpci.h>
     19#include <rtems/core/mppkt.h>
     20#include <rtems/core/object.h>
     21#include <rtems/rtems/options.h>
     22#include <rtems/core/states.h>
     23#include <rtems/core/thread.h>
     24#include <rtems/rtems/support.h>
    2325
    2426/*PAGE
     
    5052
    5153      the_packet                    = _Event_MP_Get_packet();
    52       the_packet->Prefix.the_class  = RTEMS_MP_PACKET_EVENT;
     54      the_packet->Prefix.the_class  = MP_PACKET_EVENT;
    5355      the_packet->Prefix.length     = sizeof ( Event_MP_Packet );
    5456      the_packet->Prefix.to_convert = sizeof ( Event_MP_Packet );
  • cpukit/rtems/src/intr.c

    r5072b07 r3a4ae6c  
    1515
    1616#include <rtems/system.h>
    17 #include <rtems/isr.h>
    18 #include <rtems/stack.h>
    19 #include <rtems/intr.h>
    20 #include <rtems/wkspace.h>
     17#include <rtems/rtems/status.h>
     18#include <rtems/core/isr.h>
     19#include <rtems/rtems/intr.h>
    2120
    2221/*  _Interrupt_Manager_initialization
     
    3130void _Interrupt_Manager_initialization( void )
    3231{
    33 #if ( CPU_ALLOCATE_INTERRUPT_STACK == TRUE )
    34 
    35   if ( _CPU_Table.interrupt_stack_size < RTEMS_MINIMUM_STACK_SIZE )
    36     rtems_fatal_error_occurred( RTEMS_INVALID_SIZE );
    37 
    38   _CPU_Interrupt_stack_low =
    39     _Workspace_Allocate_or_fatal_error( _CPU_Table.interrupt_stack_size );
    40 
    41   _CPU_Interrupt_stack_high = _Addresses_Add_offset(
    42     _CPU_Interrupt_stack_low,
    43     _CPU_Table.interrupt_stack_size
    44   );
    45 
    46 #endif
    47 
    48 #if ( CPU_HAS_HARDWARE_INTERRUPT_STACK == TRUE )
    49   _CPU_Install_interrupt_stack();
    50 #endif
    51 
    5232}
    5333
     
    7454{
    7555  if ( !_ISR_Is_vector_number_valid( vector ) )
    76     return( RTEMS_INVALID_NUMBER );
     56    return RTEMS_INVALID_NUMBER;
    7757
    7858  if ( !_ISR_Is_valid_user_handler( new_isr_handler ) )
    79     return( RTEMS_INVALID_ADDRESS );
     59    return RTEMS_INVALID_ADDRESS;
    8060
    8161  _ISR_Install_vector(
    8262    vector, (proc_ptr)new_isr_handler, (proc_ptr *)old_isr_handler );
    8363
    84   return( RTEMS_SUCCESSFUL );
     64  return RTEMS_SUCCESSFUL;
    8565}
  • cpukit/rtems/src/mp.c

    r5072b07 r3a4ae6c  
    1515
    1616#include <rtems/system.h>
    17 #include <rtems/config.h>
    18 #include <rtems/cpu.h>
    19 #include <rtems/event.h>
    20 #include <rtems/fatal.h>
    21 #include <rtems/intthrd.h>
    22 #include <rtems/message.h>
    23 #include <rtems/mp.h>
    24 #include <rtems/mpci.h>
    25 #include <rtems/mppkt.h>
    26 #include <rtems/part.h>
    27 #include <rtems/sem.h>
    28 #include <rtems/signal.h>
    29 #include <rtems/states.h>
    30 #include <rtems/tasks.h>
    31 #include <rtems/thread.h>
    32 #include <rtems/threadq.h>
    33 #include <rtems/watchdog.h>
     17#include <rtems/rtems/status.h>
     18#include <rtems/rtems/mp.h>
     19#include <rtems/core/mpci.h>
    3420
    3521/*PAGE
     
    4127void _Multiprocessing_Manager_initialization ( void )
    4228{
    43   if ( _Configuration_MP_table->node < 1 ||
    44        _Configuration_MP_table->node > _Configuration_MP_table->maximum_nodes )
    45      rtems_fatal_error_occurred( RTEMS_INVALID_NODE );
    46 
    47   _Internal_threads_Set_MP_receive_server( _Multiprocessing_Receive_server );
    4829}
    4930
     
    5637void rtems_multiprocessing_announce ( void )
    5738{
    58   _Thread_Disable_dispatch();
    59   _Event_sets_Post(
    60     RTEMS_EVENT_0,
    61     &_Internal_threads_System_initialization_thread->RTEMS_API->pending_events
    62   );
    63   _Event_Surrender( _Internal_threads_System_initialization_thread );
    64   _Thread_Enable_dispatch();
    65 }
    66 
    67 /*PAGE
    68  *
    69  *  _Multiprocessing_Receive_server
    70  *
    71  */
    72 
    73 typedef void (*packet_processor)( rtems_packet_prefix * );
    74 
    75 packet_processor _Multiprocessor_Packet_processors[] = {
    76   _Internal_threads_MP_Process_packet, /* RTEMS_MP_PACKET_INTERNAL_THREADS */
    77   _RTEMS_tasks_MP_Process_packet,      /* RTEMS_MP_PACKET_TASKS */
    78   _Message_queue_MP_Process_packet,    /* RTEMS_MP_PACKET_MESSAGE_QUEUE */
    79   _Semaphore_MP_Process_packet,        /* RTEMS_MP_PACKET_SEMAPHORE */
    80   _Partition_MP_Process_packet,        /* RTEMS_MP_PACKET_PARTITION */
    81   0,                                   /* RTEMS_MP_PACKET_REGION */
    82   _Event_MP_Process_packet,            /* RTEMS_MP_PACKET_EVENT */
    83   _Signal_MP_Process_packet            /* RTEMS_MP_PACKET_SIGNAL */
    84 };
    85 
    86 Thread _Multiprocessing_Receive_server (
    87   Thread_Argument ignored
    88 )
    89 {
    90 
    91   rtems_packet_prefix *the_packet;
    92   packet_processor     the_function;
    93 
    94   for ( ; ; ) {
    95 
    96     _Thread_Disable_dispatch();
    97     _Event_Seize( RTEMS_EVENT_0, RTEMS_DEFAULT_OPTIONS, RTEMS_NO_TIMEOUT );
    98     _Thread_Enable_dispatch();
    99 
    100     for ( ; ; ) {
    101       the_packet = _MPCI_Receive_packet();
    102 
    103       if ( !the_packet )
    104         break;
    105 
    106       _Thread_Executing->receive_packet = the_packet;
    107 
    108       if ( !_Mp_packet_Is_valid_packet_class ( the_packet->the_class ) )
    109         break;
    110 
    111       the_function = _Multiprocessor_Packet_processors[ the_packet->the_class ];
    112    
    113       if ( !the_function )
    114         break;
    115 
    116       (*the_function)( the_packet );
    117     }
    118   }
     39  _MPCI_Announce();
    11940}
    12041
  • cpukit/rtems/src/msg.c

    r5072b07 r3a4ae6c  
    1515
    1616#include <rtems/system.h>
    17 #include <rtems/attr.h>
    18 #include <rtems/chain.h>
    19 #include <rtems/config.h>
    20 #include <rtems/isr.h>
    21 #include <rtems/message.h>
    22 #include <rtems/object.h>
    23 #include <rtems/options.h>
    24 #include <rtems/states.h>
    25 #include <rtems/support.h>
    26 #include <rtems/thread.h>
    27 #include <rtems/wkspace.h>
    28 #include <rtems/mpci.h>
     17#include <rtems/rtems/status.h>
     18#include <rtems/rtems/attr.h>
     19#include <rtems/core/chain.h>
     20#include <rtems/core/isr.h>
     21#include <rtems/rtems/message.h>
     22#include <rtems/core/object.h>
     23#include <rtems/rtems/options.h>
     24#include <rtems/core/states.h>
     25#include <rtems/rtems/support.h>
     26#include <rtems/core/thread.h>
     27#include <rtems/core/wkspace.h>
     28#include <rtems/core/mpci.h>
     29#include <rtems/sysstate.h>
    2930
    3031/*PAGE
     
    5556    FALSE
    5657  );
     58
     59  /*
     60   *  Register the MP Process Packet routine.
     61   */
     62
     63  _MPCI_Register_packet_processor(
     64    MP_PACKET_MESSAGE_QUEUE,
     65    _Message_queue_MP_Process_packet
     66  );
     67
    5768}
    5869
     
    7384    unsigned32 allocated_message_size;
    7485
    75     mq = \
     86    mq =
    7687      (Message_queue_Control *)_Objects_Allocate(&_Message_queue_Information);
    7788
     
    145156
    146157  if ( !rtems_is_name_valid( name ) )
    147     return ( RTEMS_INVALID_NAME );
    148 
    149   if ( _Attributes_Is_global( attribute_set ) &&
    150        !_Configuration_Is_multiprocessing() )
    151     return( RTEMS_MP_NOT_CONFIGURED );
     158    return RTEMS_INVALID_NAME;
     159
     160  if ( _Attributes_Is_global( attribute_set ) && 
     161       !_System_state_Is_multiprocessing )
     162    return RTEMS_MP_NOT_CONFIGURED;
    152163
    153164  if (count == 0)
     
    165176 
    166177  if ( _Attributes_Is_global( attribute_set ) &&
    167        _Configuration_MPCI_table &&
    168        (_Configuration_MPCI_table->maximum_packet_size < max_message_size))
     178       (_MPCI_table->maximum_packet_size < max_message_size))
    169179  {
    170180      return RTEMS_INVALID_SIZE;
     
    178188  if ( !the_message_queue ) {
    179189    _Thread_Enable_dispatch();
    180     return( RTEMS_TOO_MANY );
     190    return RTEMS_TOO_MANY;
    181191  }
    182192
     
    202212       THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO,
    203213    STATES_WAITING_FOR_MESSAGE,
    204     _Message_queue_MP_Send_extract_proxy
     214    _Message_queue_MP_Send_extract_proxy,
     215    RTEMS_TIMEOUT
    205216  );
    206217
     
    222233
    223234  _Thread_Enable_dispatch();
    224   return( RTEMS_SUCCESSFUL );
     235  return RTEMS_SUCCESSFUL;
    225236}
    226237
     
    249260)
    250261{
    251   return _Objects_Name_to_id(
     262  Objects_Name_to_id_errors  status;
     263
     264  status = _Objects_Name_to_id(
    252265    &_Message_queue_Information,
    253266    &name,
     
    255268    id
    256269  );
     270
     271  return _Status_Object_name_errors_to_status[ status ];
    257272}
    258273
     
    282297  switch ( location ) {
    283298    case OBJECTS_ERROR:
    284       return( RTEMS_INVALID_ID );
     299      return RTEMS_INVALID_ID;
    285300    case OBJECTS_REMOTE:
    286301      _Thread_Dispatch();
    287       return( RTEMS_ILLEGAL_ON_REMOTE_OBJECT );
     302      return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
    288303    case OBJECTS_LOCAL:
    289304      _Objects_Close( &_Message_queue_Information,
     
    295310        _Thread_queue_Flush(
    296311          &the_message_queue->Wait_queue,
    297           _Message_queue_MP_Send_object_was_deleted
     312          _Message_queue_MP_Send_object_was_deleted,
     313          RTEMS_OBJECT_WAS_DELETED
    298314        );
    299315
     
    315331
    316332      _Thread_Enable_dispatch();
    317       return( RTEMS_SUCCESSFUL );
    318   }
    319 
    320   return( RTEMS_INTERNAL_ERROR );   /* unreached - only to remove warnings */
     333      return RTEMS_SUCCESSFUL;
     334  }
     335
     336  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
    321337}
    322338
     
    404420  switch ( location ) {
    405421    case OBJECTS_ERROR:
    406       return( RTEMS_INVALID_ID );
     422      return RTEMS_INVALID_ID;
    407423    case OBJECTS_REMOTE:
    408424      _Thread_Executing->Wait.return_argument = count;
     
    437453                                   constrained_size);
    438454
    439         *waitp->Extra.message_size_p = constrained_size;
     455        *(rtems_unsigned32 *)the_thread->Wait.return_argument_1 = size;
    440456       
    441457        if ( !_Objects_Is_local_id( the_thread->Object.id ) ) {
     
    451467      _Thread_Enable_dispatch();
    452468      *count = number_broadcasted;
    453       return( RTEMS_SUCCESSFUL );
     469      return RTEMS_SUCCESSFUL;
    454470    }
    455471
     
    492508
    493509    case OBJECTS_ERROR:
    494       return( RTEMS_INVALID_ID );
     510      return RTEMS_INVALID_ID;
    495511
    496512    case OBJECTS_REMOTE:
    497       _Thread_Executing->Wait.return_argument = buffer;
    498      
    499513      return _Message_queue_MP_Send_request_packet(
    500514          MESSAGE_QUEUE_MP_RECEIVE_REQUEST,
     
    518532  }
    519533
    520   return( RTEMS_INTERNAL_ERROR );   /* unreached - only to remove warnings */
     534  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
    521535}
    522536
     
    550564  switch ( location ) {
    551565    case OBJECTS_ERROR:
    552       return( RTEMS_INVALID_ID );
     566      return RTEMS_INVALID_ID;
    553567    case OBJECTS_REMOTE:
    554568      _Thread_Executing->Wait.return_argument = count;
     
    570584        *count = 0;
    571585      _Thread_Enable_dispatch();
    572       return( RTEMS_SUCCESSFUL );
    573   }
    574 
    575   return( RTEMS_INTERNAL_ERROR );   /* unreached - only to remove warnings */
     586      return RTEMS_SUCCESSFUL;
     587  }
     588
     589  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
    576590}
    577591
     
    634648  executing->Wait.queue              = &the_message_queue->Wait_queue;
    635649  executing->Wait.id                 = the_message_queue->Object.id;
    636   executing->Wait.option_set         = option_set;
    637   executing->Wait.return_argument    = (unsigned32 *)buffer;
    638   executing->Wait.Extra.message_size_p = size_p;
     650  executing->Wait.option             = option_set;
     651  executing->Wait.return_argument    = (void *)buffer;
     652  executing->Wait.return_argument_1  = (void *)size_p;
    639653  _ISR_Enable( level );
    640654  return FALSE;
     
    725739  {
    726740    case OBJECTS_ERROR:
    727       return( RTEMS_INVALID_ID );
     741      return RTEMS_INVALID_ID;
    728742
    729743    case OBJECTS_REMOTE:
     
    771785          size
    772786        );
    773         *the_thread->Wait.Extra.message_size_p = size;
     787        *(rtems_unsigned32 *)the_thread->Wait.return_argument_1 = size;
    774788       
    775789        if ( !_Objects_Is_local_id( the_thread->Object.id ) ) {
     
    784798        }
    785799        _Thread_Enable_dispatch();
    786         return( RTEMS_SUCCESSFUL );
     800        return RTEMS_SUCCESSFUL;
    787801      }
    788802
     
    795809           the_message_queue->maximum_pending_messages ) {
    796810        _Thread_Enable_dispatch();
    797         return( RTEMS_TOO_MANY );
     811        return RTEMS_TOO_MANY;
    798812      }
    799813
     
    801815      if ( the_message == 0) {
    802816        _Thread_Enable_dispatch();
    803         return( RTEMS_UNSATISFIED );
     817        return RTEMS_UNSATISFIED;
    804818      }
    805819
     
    819833
    820834      _Thread_Enable_dispatch();
    821       return( RTEMS_SUCCESSFUL );
     835      return RTEMS_SUCCESSFUL;
    822836         
    823837    default:
  • cpukit/rtems/src/msgmp.c

    r5072b07 r3a4ae6c  
    1515
    1616#include <rtems/system.h>
    17 #include <rtems/message.h>
    18 #include <rtems/mpci.h>
    19 #include <rtems/msgmp.h>
    20 #include <rtems/object.h>
    21 #include <rtems/options.h>
    22 #include <rtems/thread.h>
    23 #include <rtems/watchdog.h>
    24 #include <rtems/config.h>
     17#include <rtems/rtems/status.h>
     18#include <rtems/rtems/message.h>
     19#include <rtems/core/mpci.h>
     20#include <rtems/rtems/msgmp.h>
     21#include <rtems/core/object.h>
     22#include <rtems/rtems/options.h>
     23#include <rtems/core/thread.h>
     24#include <rtems/core/watchdog.h>
     25#include <rtems/rtems/support.h>
    2526
    2627/*PAGE
     
    4748
    4849      the_packet                    = _Message_queue_MP_Get_packet();
    49       the_packet->Prefix.the_class  = RTEMS_MP_PACKET_MESSAGE_QUEUE;
     50      the_packet->Prefix.the_class  = MP_PACKET_MESSAGE_QUEUE;
    5051      the_packet->Prefix.length     = sizeof ( Message_queue_MP_Packet );
    5152      the_packet->Prefix.to_convert = sizeof ( Message_queue_MP_Packet );
     
    103104
    104105      the_packet                    = _Message_queue_MP_Get_packet();
    105       the_packet->Prefix.the_class  = RTEMS_MP_PACKET_MESSAGE_QUEUE;
     106      the_packet->Prefix.the_class  = MP_PACKET_MESSAGE_QUEUE;
    106107      the_packet->Prefix.length     = sizeof(Message_queue_MP_Packet);
    107108      if ( size_p )
    108       the_packet->Prefix.length     += *size_p;
     109        the_packet->Prefix.length     += *size_p;
    109110      the_packet->Prefix.to_convert = sizeof(Message_queue_MP_Packet);
    110111
     
    115116       */
    116117
    117       if (the_packet->Prefix.length >
    118           _Configuration_MPCI_table->maximum_packet_size)
    119       {
     118      if (the_packet->Prefix.length > _MPCI_table->maximum_packet_size) {
    120119          _Thread_Enable_dispatch();
    121120          return RTEMS_INVALID_SIZE;
     
    133132       */
    134133     
    135       if (buffer)
    136       {
     134      if (buffer) {
    137135          the_packet->Buffer.size = *size_p;
    138136          _Message_queue_Copy_buffer(buffer,
     
    149147
    150148      the_packet                    = _Message_queue_MP_Get_packet();
    151       the_packet->Prefix.the_class  = RTEMS_MP_PACKET_MESSAGE_QUEUE;
     149      the_packet->Prefix.the_class  = MP_PACKET_MESSAGE_QUEUE;
    152150      the_packet->Prefix.length     = sizeof(Message_queue_MP_Packet);
    153151      the_packet->Prefix.to_convert = sizeof(Message_queue_MP_Packet);
     
    161159      the_packet->size       = 0;        /* just in case of an error */
    162160
    163       _Thread_Executing->Wait.return_argument      = (unsigned32 *)buffer;
    164       _Thread_Executing->Wait.Extra.message_size_p = size_p;
     161      _Thread_Executing->Wait.return_argument   = (unsigned32 *)buffer;
     162      _Thread_Executing->Wait.return_argument_1 = size_p;
    165163     
    166164      return _MPCI_Send_request_packet(rtems_get_node(message_queue_id),
     
    297295      );
    298296
    299       if ( ! _Status_Is_proxy_blocking( the_packet->Prefix.return_code ) )
     297      if ( ! _Thread_Is_proxy_blocking( the_packet->Prefix.return_code ) )
    300298        _Message_queue_MP_Send_response_packet(
    301299          MESSAGE_QUEUE_MP_RECEIVE_RESPONSE,
     
    310308
    311309      if (the_packet->Prefix.return_code == RTEMS_SUCCESSFUL) {
    312         *the_thread->Wait.Extra.message_size_p = the_packet->size;
     310        *(rtems_unsigned32 *)the_thread->Wait.return_argument_1 =
     311           the_packet->size;
    313312
    314313        _Message_queue_Copy_buffer(
  • cpukit/rtems/src/part.c

    r5072b07 r3a4ae6c  
    1515
    1616#include <rtems/system.h>
    17 #include <rtems/support.h>
    18 #include <rtems/address.h>
    19 #include <rtems/config.h>
    20 #include <rtems/object.h>
    21 #include <rtems/part.h>
    22 #include <rtems/thread.h>
     17#include <rtems/rtems/status.h>
     18#include <rtems/rtems/support.h>
     19#include <rtems/core/address.h>
     20#include <rtems/core/object.h>
     21#include <rtems/rtems/part.h>
     22#include <rtems/core/thread.h>
     23#include <rtems/sysstate.h>
    2324
    2425/*PAGE
     
    5051  );
    5152
     53  /*
     54   *  Register the MP Process Packet routine.
     55   */
     56
     57  _MPCI_Register_packet_processor(
     58    MP_PACKET_PARTITION,
     59    _Partition_MP_Process_packet
     60  );
     61
    5262}
    5363
     
    8595
    8696  if ( !rtems_is_name_valid( name ) )
    87     return ( RTEMS_INVALID_NAME );
     97    return RTEMS_INVALID_NAME;
    8898
    8999  if ( length == 0 || buffer_size == 0 || length < buffer_size ||
    90100         !_Partition_Is_buffer_size_aligned( buffer_size ) )
    91     return ( RTEMS_INVALID_SIZE );
     101    return RTEMS_INVALID_SIZE;
    92102
    93103  if ( !_Addresses_Is_aligned( starting_address ) )
    94      return( RTEMS_INVALID_ADDRESS );
    95 
    96   if ( _Attributes_Is_global( attribute_set ) &&
    97        !_Configuration_Is_multiprocessing() )
    98     return( RTEMS_MP_NOT_CONFIGURED );
     104     return RTEMS_INVALID_ADDRESS;
     105
     106  if ( _Attributes_Is_global( attribute_set ) && 
     107       !_System_state_Is_multiprocessing )
     108    return RTEMS_MP_NOT_CONFIGURED;
    99109
    100110  _Thread_Disable_dispatch();               /* prevents deletion */
     
    104114  if ( !the_partition ) {
    105115    _Thread_Enable_dispatch();
    106     return( RTEMS_TOO_MANY );
     116    return RTEMS_TOO_MANY;
    107117  }
    108118
     
    112122    _Partition_Free( the_partition );
    113123    _Thread_Enable_dispatch();
    114     return( RTEMS_TOO_MANY );
     124    return RTEMS_TOO_MANY;
    115125  }
    116126  the_partition->starting_address      = starting_address;
     
    135145
    136146  _Thread_Enable_dispatch();
    137   return( RTEMS_SUCCESSFUL );
     147  return RTEMS_SUCCESSFUL;
    138148}
    139149
     
    162172)
    163173{
    164   return _Objects_Name_to_id( &_Partition_Information, &name, node, id );
     174  Objects_Name_to_id_errors  status;
     175
     176  status = _Objects_Name_to_id( &_Partition_Information, &name, node, id );
     177
     178  return _Status_Object_name_errors_to_status[ status ];
    165179}
    166180
     
    191205  switch ( location ) {
    192206    case OBJECTS_ERROR:
    193       return( RTEMS_INVALID_ID );
     207      return RTEMS_INVALID_ID;
    194208    case OBJECTS_REMOTE:
    195209      _Thread_Dispatch();
    196       return( RTEMS_ILLEGAL_ON_REMOTE_OBJECT );
     210      return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
    197211    case OBJECTS_LOCAL:
    198212      if ( the_partition->number_of_used_blocks == 0 ) {
     
    215229
    216230        _Thread_Enable_dispatch();
    217         return( RTEMS_SUCCESSFUL );
     231        return RTEMS_SUCCESSFUL;
    218232      }
    219233      _Thread_Enable_dispatch();
    220       return( RTEMS_RESOURCE_IN_USE );
    221   }
    222 
    223   return( RTEMS_INTERNAL_ERROR );   /* unreached - only to remove warnings */
     234      return RTEMS_RESOURCE_IN_USE;
     235  }
     236
     237  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
    224238}
    225239
     
    252266  switch ( location ) {
    253267    case OBJECTS_ERROR:
    254       return( RTEMS_INVALID_ID );
     268      return RTEMS_INVALID_ID;
    255269    case OBJECTS_REMOTE:
    256270      _Thread_Executing->Wait.return_argument = buffer;
     
    268282        _Thread_Enable_dispatch();
    269283        *buffer = the_buffer;
    270         return( RTEMS_SUCCESSFUL );
     284        return RTEMS_SUCCESSFUL;
    271285      }
    272286      _Thread_Enable_dispatch();
    273       return( RTEMS_UNSATISFIED );
    274   }
    275 
    276   return( RTEMS_INTERNAL_ERROR );   /* unreached - only to remove warnings */
     287      return RTEMS_UNSATISFIED;
     288  }
     289
     290  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
    277291}
    278292
     
    304318  switch ( location ) {
    305319    case OBJECTS_ERROR:
    306       return( RTEMS_INVALID_ID );
     320      return RTEMS_INVALID_ID;
    307321    case OBJECTS_REMOTE:
    308322      return(
     
    318332        the_partition->number_of_used_blocks -= 1;
    319333        _Thread_Enable_dispatch();
    320         return( RTEMS_SUCCESSFUL );
     334        return RTEMS_SUCCESSFUL;
    321335      }
    322336      _Thread_Enable_dispatch();
    323       return( RTEMS_INVALID_ADDRESS );
    324   }
    325 
    326   return( RTEMS_INTERNAL_ERROR );   /* unreached - only to remove warnings */
    327 }
     337      return RTEMS_INVALID_ADDRESS;
     338  }
     339
     340  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
     341}
  • cpukit/rtems/src/partmp.c

    r5072b07 r3a4ae6c  
    1515
    1616#include <rtems/system.h>
    17 #include <rtems/mpci.h>
    18 #include <rtems/mppkt.h>
    19 #include <rtems/object.h>
    20 #include <rtems/options.h>
    21 #include <rtems/part.h>
    22 #include <rtems/thread.h>
     17#include <rtems/rtems/status.h>
     18#include <rtems/core/mpci.h>
     19#include <rtems/core/mppkt.h>
     20#include <rtems/core/object.h>
     21#include <rtems/rtems/options.h>
     22#include <rtems/rtems/part.h>
     23#include <rtems/core/thread.h>
     24#include <rtems/rtems/support.h>
    2325
    2426/*PAGE
     
    4547
    4648      the_packet                    = _Partition_MP_Get_packet();
    47       the_packet->Prefix.the_class  = RTEMS_MP_PACKET_PARTITION;
     49      the_packet->Prefix.the_class  = MP_PACKET_PARTITION;
    4850      the_packet->Prefix.length     = sizeof ( Partition_MP_Packet );
    4951      the_packet->Prefix.to_convert = sizeof ( Partition_MP_Packet );
     
    8991
    9092      the_packet                    = _Partition_MP_Get_packet();
    91       the_packet->Prefix.the_class  = RTEMS_MP_PACKET_PARTITION;
     93      the_packet->Prefix.the_class  = MP_PACKET_PARTITION;
    9294      the_packet->Prefix.length     = sizeof ( Partition_MP_Packet );
    9395      the_packet->Prefix.to_convert = sizeof ( Partition_MP_Packet );
  • cpukit/rtems/src/ratemon.c

    r5072b07 r3a4ae6c  
    1515
    1616#include <rtems/system.h>
    17 #include <rtems/support.h>
    18 #include <rtems/isr.h>
    19 #include <rtems/object.h>
    20 #include <rtems/ratemon.h>
    21 #include <rtems/thread.h>
     17#include <rtems/rtems/status.h>
     18#include <rtems/rtems/support.h>
     19#include <rtems/core/isr.h>
     20#include <rtems/core/object.h>
     21#include <rtems/rtems/ratemon.h>
     22#include <rtems/core/thread.h>
    2223
    2324/*PAGE
     
    7879
    7980  if ( !rtems_is_name_valid( name ) )
    80     return( RTEMS_INVALID_NAME );
     81    return RTEMS_INVALID_NAME;
    8182
    8283  _Thread_Disable_dispatch();            /* to prevent deletion */
     
    8687  if ( !the_period ) {
    8788    _Thread_Enable_dispatch();
    88     return( RTEMS_TOO_MANY );
     89    return RTEMS_TOO_MANY;
    8990  }
    9091
     
    9697  *id = the_period->Object.id;
    9798  _Thread_Enable_dispatch();
    98   return( RTEMS_SUCCESSFUL );
     99  return RTEMS_SUCCESSFUL;
    99100}
    100101
     
    121122)
    122123{
    123   return _Objects_Name_to_id(
     124  Objects_Name_to_id_errors  status;
     125
     126  status = _Objects_Name_to_id(
    124127    &_Rate_monotonic_Information,
    125128    &name,
    126     RTEMS_SEARCH_LOCAL_NODE,
     129    OBJECTS_SEARCH_LOCAL_NODE,
    127130    id
    128131  );
     132
     133  return _Status_Object_name_errors_to_status[ status ];
    129134}
    130135
     
    153158  switch ( location ) {
    154159    case OBJECTS_ERROR:
    155       return( RTEMS_INVALID_ID );
    156     case OBJECTS_REMOTE:            /* should never return this */
    157       return( RTEMS_INTERNAL_ERROR );
     160      return RTEMS_INVALID_ID;
     161    case OBJECTS_REMOTE:           
     162      return RTEMS_INTERNAL_ERROR;  /* should never return this */
    158163    case OBJECTS_LOCAL:
    159164      if ( !_Thread_Is_executing( the_period->owner ) ) {
    160165        _Thread_Enable_dispatch();
    161         return( RTEMS_NOT_OWNER_OF_RESOURCE );
     166        return RTEMS_NOT_OWNER_OF_RESOURCE;
    162167      }
    163168      (void) _Watchdog_Remove( &the_period->Timer );
    164169      the_period->state = RATE_MONOTONIC_INACTIVE;
    165170      _Thread_Enable_dispatch();
    166       return( RTEMS_SUCCESSFUL );
    167   }
    168 
    169   return( RTEMS_INTERNAL_ERROR );   /* unreached - only to remove warnings */
     171      return RTEMS_SUCCESSFUL;
     172  }
     173
     174  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
    170175}
    171176
     
    194199  switch ( location ) {
    195200    case OBJECTS_ERROR:
    196       return( RTEMS_INVALID_ID );
     201      return RTEMS_INVALID_ID;
    197202    case OBJECTS_REMOTE:            /* should never return this */
    198       return( RTEMS_INTERNAL_ERROR );
     203      return RTEMS_INTERNAL_ERROR;
    199204    case OBJECTS_LOCAL:
    200205      _Objects_Close( &_Rate_monotonic_Information, &the_period->Object );
     
    203208      _Rate_monotonic_Free( the_period );
    204209      _Thread_Enable_dispatch();
    205       return( RTEMS_SUCCESSFUL );
    206   }
    207 
    208   return( RTEMS_INTERNAL_ERROR );   /* unreached - only to remove warnings */
     210      return RTEMS_SUCCESSFUL;
     211  }
     212
     213  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
    209214}
    210215
     
    226231rtems_status_code rtems_rate_monotonic_period(
    227232  Objects_Id        id,
    228   rtems_interval length
     233  rtems_interval    length
    229234)
    230235{
    231236  Rate_monotonic_Control *the_period;
    232237  Objects_Locations       location;
    233   rtems_status_code            return_value;
     238  rtems_status_code       return_value;
    234239
    235240  the_period = _Rate_monotonic_Get( id, &location );
    236241  switch ( location ) {
    237242    case OBJECTS_ERROR:
    238       return( RTEMS_INVALID_ID );
     243      return RTEMS_INVALID_ID;
    239244    case OBJECTS_REMOTE:            /* should never return this */
    240       return( RTEMS_INTERNAL_ERROR );
     245      return RTEMS_INTERNAL_ERROR;
    241246    case OBJECTS_LOCAL:
    242247      if ( !_Thread_Is_executing( the_period->owner ) ) {
    243248        _Thread_Enable_dispatch();
    244         return( RTEMS_NOT_OWNER_OF_RESOURCE );
     249        return RTEMS_NOT_OWNER_OF_RESOURCE;
    245250      }
    246251
     
    276281                     &the_period->Timer, length, WATCHDOG_ACTIVATE_NOW );
    277282          _Thread_Enable_dispatch();
    278           return( RTEMS_SUCCESSFUL );
     283          return RTEMS_SUCCESSFUL;
    279284
    280285        case RATE_MONOTONIC_ACTIVE:
     
    283288          if ( _Rate_monotonic_Set_state( the_period ) ) {
    284289            _Thread_Enable_dispatch();
    285             return( RTEMS_SUCCESSFUL );
     290            return RTEMS_SUCCESSFUL;
    286291          }
    287292         /* has expired -- fall into next case */
     
    291296                     &the_period->Timer, length, WATCHDOG_ACTIVATE_NOW );
    292297          _Thread_Enable_dispatch();
    293           return( RTEMS_TIMEOUT );
     298          return RTEMS_TIMEOUT;
    294299      }
    295300  }
    296301
    297   return( RTEMS_INTERNAL_ERROR );   /* unreached - only to remove warnings */
     302  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
    298303}
    299304
  • cpukit/rtems/src/region.c

    r5072b07 r3a4ae6c  
    1515
    1616#include <rtems/system.h>
    17 #include <rtems/support.h>
    18 #include <rtems/config.h>
    19 #include <rtems/object.h>
    20 #include <rtems/options.h>
    21 #include <rtems/region.h>
    22 #include <rtems/states.h>
    23 #include <rtems/thread.h>
     17#include <rtems/rtems/status.h>
     18#include <rtems/rtems/support.h>
     19#include <rtems/core/object.h>
     20#include <rtems/rtems/options.h>
     21#include <rtems/rtems/region.h>
     22#include <rtems/core/states.h>
     23#include <rtems/core/thread.h>
    2424
    2525/*PAGE
     
    4949    FALSE
    5050  );
     51
     52  /*
     53   *  Register the MP Process Packet routine.
     54   */
     55
     56  _MPCI_Register_packet_processor(
     57    MP_PACKET_REGION,
     58    0  /* XXX _Region_MP_Process_packet */
     59  );
     60
    5161}
    5262
     
    8494
    8595  if ( !rtems_is_name_valid( name ) )
    86     return ( RTEMS_INVALID_NAME );
     96    return RTEMS_INVALID_NAME;
    8797
    8898  if ( !_Addresses_Is_aligned( starting_address ) )
    89     return( RTEMS_INVALID_ADDRESS );
     99    return RTEMS_INVALID_ADDRESS;
    90100
    91101  _Thread_Disable_dispatch();             /* to prevent deletion */
     
    95105  if ( !the_region ) {
    96106    _Thread_Enable_dispatch();
    97     return( RTEMS_TOO_MANY );
     107    return RTEMS_TOO_MANY;
    98108  }
    99109
     
    104114    _Region_Free( the_region );
    105115    _Thread_Enable_dispatch();
    106     return( RTEMS_INVALID_SIZE );
     116    return RTEMS_INVALID_SIZE;
    107117  }
    108118
     
    119129       THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO,
    120130    STATES_WAITING_FOR_SEGMENT,
    121     _Region_MP_Send_extract_proxy
     131    _Region_MP_Send_extract_proxy,
     132    RTEMS_TIMEOUT
    122133  );
    123134
     
    126137  *id = the_region->Object.id;
    127138  _Thread_Enable_dispatch();
    128   return( RTEMS_SUCCESSFUL );
     139  return RTEMS_SUCCESSFUL;
    129140}
    130141
     
    151162)
    152163{
    153   return _Objects_Name_to_id(
    154       &_Region_Information,
    155       &name,
    156       RTEMS_SEARCH_LOCAL_NODE,
    157       id
    158     );
     164  Objects_Name_to_id_errors  status;
     165
     166  status = _Objects_Name_to_id(
     167    &_Region_Information,
     168    &name,
     169    OBJECTS_SEARCH_LOCAL_NODE,
     170    id
     171  );
     172
     173  return _Status_Object_name_errors_to_status[ status ];
    159174}
    160175
     
    185200  switch ( location ) {
    186201    case OBJECTS_ERROR:
    187       return( RTEMS_INVALID_ID );
     202      return RTEMS_INVALID_ID;
    188203    case OBJECTS_REMOTE:        /* this error cannot be returned */
    189       return( RTEMS_INTERNAL_ERROR );
     204      return RTEMS_INTERNAL_ERROR;
    190205    case OBJECTS_LOCAL:
    191206      _Region_Debug_Walk( the_region, 5 );
     
    194209        _Region_Free( the_region );
    195210        _Thread_Enable_dispatch();
    196         return( RTEMS_SUCCESSFUL );
     211        return RTEMS_SUCCESSFUL;
    197212      }
    198213      _Thread_Enable_dispatch();
    199       return( RTEMS_RESOURCE_IN_USE );
    200   }
    201 
    202   return( RTEMS_INTERNAL_ERROR );   /* unreached - only to remove warnings */
     214      return RTEMS_RESOURCE_IN_USE;
     215  }
     216
     217  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
    203218}
    204219
     
    237252  switch ( location ) {
    238253    case OBJECTS_ERROR:
    239       return( RTEMS_INVALID_ID );
     254      return RTEMS_INVALID_ID;
    240255    case OBJECTS_REMOTE:        /* this error cannot be returned */
    241       return( RTEMS_INTERNAL_ERROR );
     256      return RTEMS_INTERNAL_ERROR;
    242257    case OBJECTS_LOCAL:
    243258
     
    265280  }
    266281
    267   return( RTEMS_INTERNAL_ERROR );
     282  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
    268283}
    269284
     
    290305  Objects_Id         id,
    291306  unsigned32         size,
    292   rtems_option    option_set,
    293   rtems_interval  timeout,
     307  rtems_option       option_set,
     308  rtems_interval     timeout,
    294309  void              **segment
    295310)
     
    301316
    302317  if ( size == 0 )
    303     return( RTEMS_INVALID_SIZE );
     318    return RTEMS_INVALID_SIZE;
    304319
    305320  executing  = _Thread_Executing;
     
    307322  switch ( location ) {
    308323    case OBJECTS_ERROR:
    309       return( RTEMS_INVALID_ID );
     324      return RTEMS_INVALID_ID;
    310325    case OBJECTS_REMOTE:        /* this error cannot be returned */
    311       return( RTEMS_INTERNAL_ERROR );
     326      return RTEMS_INTERNAL_ERROR;
    312327    case OBJECTS_LOCAL:
    313328      if ( size > the_region->maximum_segment_size ) {
    314329        _Thread_Enable_dispatch();
    315         return( RTEMS_INVALID_SIZE );
     330        return RTEMS_INVALID_SIZE;
    316331      }
    317332
     
    326341        _Thread_Enable_dispatch();
    327342        *segment = the_segment;
    328         return( RTEMS_SUCCESSFUL );
     343        return RTEMS_SUCCESSFUL;
    329344      }
    330345
    331346      if ( _Options_Is_no_wait( option_set ) ) {
    332347        _Thread_Enable_dispatch();
    333         return( RTEMS_UNSATISFIED );
    334       }
    335 
    336       executing->Wait.queue              = &the_region->Wait_queue;
    337       executing->Wait.id                 = id;
    338       executing->Wait.Extra.segment_size = size;
    339       executing->Wait.return_argument    = (unsigned32 *) segment;
     348        return RTEMS_UNSATISFIED;
     349      }
     350
     351      executing->Wait.queue           = &the_region->Wait_queue;
     352      executing->Wait.id              = id;
     353      executing->Wait.count          = size;
     354      executing->Wait.return_argument = (unsigned32 *) segment;
    340355
    341356      the_region->Wait_queue.sync = TRUE;
     
    347362  }
    348363
    349   return( RTEMS_INTERNAL_ERROR );   /* unreached - only to remove warnings */
     364  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
    350365}
    351366/*PAGE
     
    380395  switch ( location ) {
    381396    case OBJECTS_ERROR:
    382       return( RTEMS_INVALID_ID );
     397      return RTEMS_INVALID_ID;
    383398    case OBJECTS_REMOTE:        /* this error cannot be returned */
    384       return( RTEMS_INTERNAL_ERROR );
     399      return RTEMS_INTERNAL_ERROR;
    385400    case OBJECTS_LOCAL:
    386401
    387402      if ( _Heap_Size_of_user_area( &the_region->Memory, segment, size ) ) {
    388403        _Thread_Enable_dispatch();
    389         return( RTEMS_SUCCESSFUL );
     404        return RTEMS_SUCCESSFUL;
    390405      }
    391406      _Thread_Enable_dispatch();
    392       return( RTEMS_INVALID_ADDRESS );
    393   }
    394 
    395   return( RTEMS_INTERNAL_ERROR );   /* unreached - only to remove warnings */
     407      return RTEMS_INVALID_ADDRESS;
     408  }
     409
     410  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
    396411}
    397412
     
    425440  switch ( location ) {
    426441    case OBJECTS_ERROR:
    427       return( RTEMS_INVALID_ID );
     442      return RTEMS_INVALID_ID;
    428443    case OBJECTS_REMOTE:        /* this error cannot be returned */
    429       return( RTEMS_INTERNAL_ERROR );
     444      return RTEMS_INTERNAL_ERROR;
    430445    case OBJECTS_LOCAL:
    431446
     
    438453      if ( !status ) {
    439454        _Thread_Enable_dispatch();
    440         return( RTEMS_INVALID_ADDRESS );
     455        return RTEMS_INVALID_ADDRESS;
    441456      }
    442457
     
    449464
    450465        the_segment = _Region_Allocate_segment(
    451                         the_region, the_thread->Wait.Extra.segment_size );
     466           the_region,
     467           the_thread->Wait.count
     468        );
    452469
    453470        if ( the_segment == NULL )
     
    461478
    462479      _Thread_Enable_dispatch();
    463       return( RTEMS_SUCCESSFUL );
    464   }
    465 
    466   return( RTEMS_INTERNAL_ERROR );   /* unreached - only to remove warnings */
    467 }
     480      return RTEMS_SUCCESSFUL;
     481  }
     482
     483  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
     484}
  • cpukit/rtems/src/regionmp.c

    r5072b07 r3a4ae6c  
    1515
    1616#include <rtems/system.h>
    17 #include <rtems/mpci.h>
    18 #include <rtems/mppkt.h>
    19 #include <rtems/object.h>
    20 #include <rtems/options.h>
    21 #include <rtems/region.h>
    22 #include <rtems/thread.h>
     17#include <rtems/rtems/status.h>
     18#include <rtems/core/mpci.h>
     19#include <rtems/core/mppkt.h>
     20#include <rtems/core/object.h>
     21#include <rtems/rtems/options.h>
     22#include <rtems/rtems/region.h>
     23#include <rtems/core/thread.h>
     24#include <rtems/rtems/support.h>
    2325
    2426/*PAGE
     
    4547
    4648      the_packet                    = _Region_MP_Get_packet();
    47       the_packet->Prefix.the_class  = RTEMS_MP_PACKET_REGION;
     49      the_packet->Prefix.the_class  = MP_PACKET_REGION;
    4850      the_packet->Prefix.length     = sizeof ( Region_MP_Packet );
    4951      the_packet->Prefix.to_convert = sizeof ( Region_MP_Packet );
     
    8082  void                        *segment,
    8183  unsigned32                   size,
    82   rtems_option              option_set,
    83   rtems_interval            timeout
     84  rtems_option                 option_set,
     85  rtems_interval               timeout
    8486)
    8587{
     
    9294
    9395      the_packet                    = _Region_MP_Get_packet();
    94       the_packet->Prefix.the_class  = RTEMS_MP_PACKET_REGION;
     96      the_packet->Prefix.the_class  = MP_PACKET_REGION;
    9597      the_packet->Prefix.length     = sizeof ( Region_MP_Packet );
    9698      the_packet->Prefix.to_convert = sizeof ( Region_MP_Packet );
  • cpukit/rtems/src/rtclock.c

    r5072b07 r3a4ae6c  
    1414
    1515#include <rtems/system.h>
    16 #include <rtems/clock.h>
    17 #include <rtems/config.h>
    18 #include <rtems/isr.h>
    19 #include <rtems/thread.h>
    20 #include <rtems/tod.h>
    21 #include <rtems/watchdog.h>
     16#include <rtems/rtems/status.h>
     17#include <rtems/rtems/clock.h>
     18#include <rtems/core/isr.h>
     19#include <rtems/core/thread.h>
     20#include <rtems/core/tod.h>
     21#include <rtems/core/watchdog.h>
    2222
    2323/*PAGE
     
    5050    case RTEMS_CLOCK_GET_TOD:
    5151      if ( !_TOD_Is_set() )
    52         return( RTEMS_NOT_DEFINED );
     52        return RTEMS_NOT_DEFINED;
    5353
    5454      *(rtems_time_of_day *)time_buffer = _TOD_Current;
    55       return( RTEMS_SUCCESSFUL );
     55      return RTEMS_SUCCESSFUL;
    5656
    5757    case RTEMS_CLOCK_GET_SECONDS_SINCE_EPOCH:
    5858      if ( !_TOD_Is_set() )
    59         return( RTEMS_NOT_DEFINED );
     59        return RTEMS_NOT_DEFINED;
    6060
    6161      *(rtems_interval *)time_buffer = _TOD_Seconds_since_epoch;
    62       return( RTEMS_SUCCESSFUL );
     62      return RTEMS_SUCCESSFUL;
    6363
    6464    case RTEMS_CLOCK_GET_TICKS_SINCE_BOOT:
    6565      *(rtems_interval *)time_buffer = _TOD_Ticks_since_boot;
    66       return( RTEMS_SUCCESSFUL );
     66      return RTEMS_SUCCESSFUL;
    6767
    6868    case RTEMS_CLOCK_GET_TICKS_PER_SECOND:
    6969      *(rtems_interval *)time_buffer = _TOD_Ticks_per_second;
    70       return( RTEMS_SUCCESSFUL );
     70      return RTEMS_SUCCESSFUL;
    7171
    7272    case RTEMS_CLOCK_GET_TIME_VALUE:
    7373      if ( !_TOD_Is_set() )
    74         return( RTEMS_NOT_DEFINED );
     74        return RTEMS_NOT_DEFINED;
    7575
    7676      _ISR_Disable( level );
     
    8080      _ISR_Enable( level );
    8181
    82       tmp *= _Configuration_Table->microseconds_per_tick;
     82      tmp *= _TOD_Microseconds_per_tick;
    8383      ((rtems_clock_time_value *)time_buffer)->microseconds = tmp;
    8484
    85       return( RTEMS_SUCCESSFUL );
     85      return RTEMS_SUCCESSFUL;
    8686  }
    8787
    88   return( RTEMS_SUCCESSFUL );   /* should never get here */
     88  return RTEMS_INTERNAL_ERROR;   /* should never get here */
    8989
    9090}
     
    108108)
    109109{
    110   rtems_status_code      local_result;
    111   rtems_interval seconds;
     110  rtems_interval     seconds;
    112111
    113   local_result = _TOD_Validate( time_buffer );
    114   if ( rtems_is_status_successful( local_result ) ) {
     112  if ( _TOD_Validate( time_buffer ) ) {
    115113    seconds = _TOD_To_seconds( time_buffer );
    116114    _Thread_Disable_dispatch();
    117115      _TOD_Set( time_buffer, seconds );
    118116    _Thread_Enable_dispatch();
    119 
     117    return RTEMS_SUCCESSFUL;
    120118  }
    121   return( local_result );
     119  return RTEMS_INVALID_CLOCK;
    122120}
    123121
     
    150148    _Thread_Dispatch();
    151149
    152   return( RTEMS_SUCCESSFUL );
     150  return RTEMS_SUCCESSFUL;
    153151}
  • cpukit/rtems/src/rtemstimer.c

    r5072b07 r3a4ae6c  
    1515
    1616#include <rtems/system.h>
    17 #include <rtems/support.h>
    18 #include <rtems/object.h>
    19 #include <rtems/thread.h>
    20 #include <rtems/timer.h>
    21 #include <rtems/tod.h>
    22 #include <rtems/watchdog.h>
     17#include <rtems/rtems/status.h>
     18#include <rtems/rtems/support.h>
     19#include <rtems/core/object.h>
     20#include <rtems/core/thread.h>
     21#include <rtems/rtems/timer.h>
     22#include <rtems/core/tod.h>
     23#include <rtems/core/watchdog.h>
    2324
    2425/*PAGE
     
    7475
    7576  if ( !rtems_is_name_valid( name ) )
    76     return ( RTEMS_INVALID_NAME );
     77    return RTEMS_INVALID_NAME;
    7778
    7879  _Thread_Disable_dispatch();         /* to prevent deletion */
     
    8283  if ( !the_timer ) {
    8384    _Thread_Enable_dispatch();
    84     return( RTEMS_TOO_MANY );
     85    return RTEMS_TOO_MANY;
    8586  }
    8687
     
    9192  *id = the_timer->Object.id;
    9293  _Thread_Enable_dispatch();
    93   return( RTEMS_SUCCESSFUL );
     94  return RTEMS_SUCCESSFUL;
    9495}
    9596
     
    116117)
    117118{
    118   return _Objects_Name_to_id(
     119  Objects_Name_to_id_errors  status;
     120
     121  status = _Objects_Name_to_id(
    119122    &_Timer_Information,
    120123    &name,
    121     RTEMS_SEARCH_LOCAL_NODE,
     124    OBJECTS_SEARCH_LOCAL_NODE,
    122125    id
    123126  );
     127
     128  return _Status_Object_name_errors_to_status[ status ];
    124129}
    125130
     
    148153  switch ( location ) {
    149154    case OBJECTS_ERROR:
    150       return( RTEMS_INVALID_ID );
    151     case OBJECTS_REMOTE:            /* should never return this */
    152       return( RTEMS_INTERNAL_ERROR );
     155      return RTEMS_INVALID_ID;
     156    case OBJECTS_REMOTE:            /* should never return this */
     157      return RTEMS_INTERNAL_ERROR;
    153158    case OBJECTS_LOCAL:
    154159      if ( !_Timer_Is_dormant_class( the_timer->the_class ) )
    155160        (void) _Watchdog_Remove( &the_timer->Ticker );
    156161      _Thread_Enable_dispatch();
    157       return( RTEMS_SUCCESSFUL );
    158   }
    159 
    160   return( RTEMS_INTERNAL_ERROR );   /* unreached - only to remove warnings */
     162      return RTEMS_SUCCESSFUL;
     163  }
     164
     165  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
    161166}
    162167
     
    185190  switch ( location ) {
    186191    case OBJECTS_ERROR:
    187       return( RTEMS_INVALID_ID );
    188     case OBJECTS_REMOTE:            /* should never return this */
    189       return( RTEMS_INTERNAL_ERROR );
     192      return RTEMS_INVALID_ID;
     193    case OBJECTS_REMOTE:            /* should never return this */
     194      return RTEMS_INTERNAL_ERROR;
    190195    case OBJECTS_LOCAL:
    191196      _Objects_Close( &_Timer_Information, &the_timer->Object );
     
    193198      _Timer_Free( the_timer );
    194199      _Thread_Enable_dispatch();
    195       return( RTEMS_SUCCESSFUL );
    196   }
    197 
    198   return( RTEMS_INTERNAL_ERROR );   /* unreached - only to remove warnings */
     200      return RTEMS_SUCCESSFUL;
     201  }
     202
     203  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
    199204}
    200205
     
    216221
    217222rtems_status_code rtems_timer_fire_after(
    218   Objects_Id         id,
    219   rtems_interval  ticks,
    220   Timer_Service      routine,
    221   void              *user_data
     223  Objects_Id                         id,
     224  rtems_interval                     ticks,
     225  rtems_timer_service_routine_entry  routine,
     226  void                              *user_data
    222227)
    223228{
     
    226231
    227232  if ( ticks == 0 )
    228     return( RTEMS_INVALID_NUMBER );
    229 
    230   the_timer = _Timer_Get( id, &location );
    231   switch ( location ) {
    232     case OBJECTS_ERROR:
    233       return( RTEMS_INVALID_ID );
    234     case OBJECTS_REMOTE:            /* should never return this */
    235       return( RTEMS_INTERNAL_ERROR );
     233    return RTEMS_INVALID_NUMBER;
     234
     235  the_timer = _Timer_Get( id, &location );
     236  switch ( location ) {
     237    case OBJECTS_ERROR:
     238      return RTEMS_INVALID_ID;
     239    case OBJECTS_REMOTE:            /* should never return this */
     240      return RTEMS_INTERNAL_ERROR;
    236241    case OBJECTS_LOCAL:
    237242      (void) _Watchdog_Remove( &the_timer->Ticker );
     
    241246                                 ticks, WATCHDOG_ACTIVATE_NOW );
    242247      _Thread_Enable_dispatch();
    243       return( RTEMS_SUCCESSFUL );
    244   }
    245 
    246   return( RTEMS_INTERNAL_ERROR );   /* unreached - only to remove warnings */
     248      return RTEMS_SUCCESSFUL;
     249  }
     250
     251  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
    247252}
    248253
     
    264269
    265270rtems_status_code rtems_timer_fire_when(
    266   Objects_Id          id,
    267   rtems_time_of_day        *wall_time,
    268   Timer_Service       routine,
    269   void               *user_data
    270 )
    271 {
    272   Timer_Control   *the_timer;
    273   Objects_Locations       location;
    274   rtems_status_code            validate_status;
     271  Objects_Id                          id,
     272  rtems_time_of_day                  *wall_time,
     273  rtems_timer_service_routine_entry   routine,
     274  void                               *user_data
     275)
     276{
     277  Timer_Control       *the_timer;
     278  Objects_Locations    location;
    275279  rtems_interval       seconds;
    276280
    277281  if ( !_TOD_Is_set() )
    278     return( RTEMS_NOT_DEFINED );
    279 
    280   validate_status = _TOD_Validate( wall_time );
    281   if ( !rtems_is_status_successful( validate_status ) )
    282     return( validate_status );
     282    return RTEMS_NOT_DEFINED;
     283
     284  if ( !_TOD_Validate( wall_time ) )
     285    return RTEMS_INVALID_CLOCK;
    283286
    284287  seconds = _TOD_To_seconds( wall_time );
    285288  if ( seconds <= _TOD_Seconds_since_epoch )
    286     return( RTEMS_INVALID_CLOCK );
    287 
    288   the_timer = _Timer_Get( id, &location );
    289   switch ( location ) {
    290     case OBJECTS_ERROR:
    291       return( RTEMS_INVALID_ID );
    292     case OBJECTS_REMOTE:            /* should never return this */
    293       return( RTEMS_INTERNAL_ERROR );
     289    return RTEMS_INVALID_CLOCK;
     290
     291  the_timer = _Timer_Get( id, &location );
     292  switch ( location ) {
     293    case OBJECTS_ERROR:
     294      return RTEMS_INVALID_ID;
     295    case OBJECTS_REMOTE:            /* should never return this */
     296      return RTEMS_INTERNAL_ERROR;
    294297    case OBJECTS_LOCAL:
    295298      (void) _Watchdog_Remove( &the_timer->Ticker );
     
    299302                seconds - _TOD_Seconds_since_epoch, WATCHDOG_ACTIVATE_NOW );
    300303      _Thread_Enable_dispatch();
    301       return( RTEMS_SUCCESSFUL );
    302   }
    303 
    304   return( RTEMS_INTERNAL_ERROR );   /* unreached - only to remove warnings */
     304      return RTEMS_SUCCESSFUL;
     305  }
     306
     307  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
    305308}
    306309
     
    329332  switch ( location ) {
    330333    case OBJECTS_ERROR:
    331       return( RTEMS_INVALID_ID );
    332     case OBJECTS_REMOTE:            /* should never return this */
    333       return( RTEMS_INTERNAL_ERROR );
     334      return RTEMS_INVALID_ID;
     335    case OBJECTS_REMOTE:            /* should never return this */
     336      return RTEMS_INTERNAL_ERROR;
    334337    case OBJECTS_LOCAL:
    335338      if ( _Timer_Is_interval_class( the_timer->the_class ) ) {
    336339        _Watchdog_Reset( &the_timer->Ticker );
    337340        _Thread_Enable_dispatch();
    338         return( RTEMS_SUCCESSFUL );
     341        return RTEMS_SUCCESSFUL;
    339342      }
    340343      _Thread_Enable_dispatch();
    341       return( RTEMS_NOT_DEFINED );
    342   }
    343 
    344   return( RTEMS_INTERNAL_ERROR );   /* unreached - only to remove warnings */
    345 }
     344      return RTEMS_NOT_DEFINED;
     345  }
     346
     347  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
     348}
  • cpukit/rtems/src/sem.c

    r5072b07 r3a4ae6c  
    2828
    2929#include <rtems/system.h>
    30 #include <rtems/support.h>
    31 #include <rtems/attr.h>
    32 #include <rtems/config.h>
    33 #include <rtems/isr.h>
    34 #include <rtems/object.h>
    35 #include <rtems/options.h>
    36 #include <rtems/sem.h>
    37 #include <rtems/states.h>
    38 #include <rtems/thread.h>
    39 #include <rtems/threadq.h>
    40 #include <rtems/mpci.h>
     30#include <rtems/rtems/status.h>
     31#include <rtems/rtems/support.h>
     32#include <rtems/rtems/attr.h>
     33#include <rtems/core/isr.h>
     34#include <rtems/core/object.h>
     35#include <rtems/rtems/options.h>
     36#include <rtems/rtems/sem.h>
     37#include <rtems/core/coremutex.h>
     38#include <rtems/core/coresem.h>
     39#include <rtems/core/states.h>
     40#include <rtems/core/thread.h>
     41#include <rtems/core/threadq.h>
     42#include <rtems/core/mpci.h>
     43#include <rtems/sysstate.h>
     44
     45#include <rtems/core/interr.h>
    4146
    4247/*PAGE
     
    6671    FALSE
    6772  );
     73 
     74  /*
     75   *  Register the MP Process Packet routine.
     76   */
     77 
     78  _MPCI_Register_packet_processor(
     79    MP_PACKET_SEMAPHORE,
     80    _Semaphore_MP_Process_packet
     81  );
     82
    6883}
    6984
     
    7691 *
    7792 *  Input parameters:
    78  *    name          - user defined semaphore name
    79  *    count         - initial count of semaphore
    80  *    attribute_set - semaphore attributes
    81  *    id            - pointer to semaphore id
     93 *    name             - user defined semaphore name
     94 *    count            - initial count of semaphore
     95 *    attribute_set    - semaphore attributes
     96 *    priority_ceiling - semaphore's ceiling priority
     97 *    id               - pointer to semaphore id
    8298 *
    8399 *  Output parameters:
     
    88104
    89105rtems_status_code rtems_semaphore_create(
    90   rtems_name            name,
    91   unsigned32            count,
    92   rtems_attribute       attribute_set,
    93   rtems_task_priority   priority_ceiling,
    94   Objects_Id           *id
     106  rtems_name           name,
     107  unsigned32           count,
     108  rtems_attribute      attribute_set,
     109  rtems_task_priority  priority_ceiling,
     110  Objects_Id          *id
    95111)
    96112{
    97113  register Semaphore_Control *the_semaphore;
     114  CORE_mutex_Attributes       the_mutex_attributes;
     115  CORE_semaphore_Attributes   the_semaphore_attributes;
     116  unsigned32                  lock;
    98117
    99118  if ( !rtems_is_name_valid( name ) )
     
    102121  if ( _Attributes_Is_global( attribute_set ) ) {
    103122
    104     if ( !_Configuration_Is_multiprocessing() )
     123    if ( !_System_state_Is_multiprocessing )
    105124      return( RTEMS_MP_NOT_CONFIGURED );
    106125
     
    129148
    130149  if ( _Attributes_Is_global( attribute_set ) &&
    131        !( _Objects_MP_Allocate_and_open( &_Semaphore_Information, name,
     150       ! ( _Objects_MP_Allocate_and_open( &_Semaphore_Information, name,
    132151                            the_semaphore->Object.id, FALSE ) ) ) {
    133152    _Semaphore_Free( the_semaphore );
     
    137156
    138157  the_semaphore->attribute_set = attribute_set;
    139   the_semaphore->count         = count;
    140 
    141   if ( _Attributes_Is_binary_semaphore( attribute_set ) && count == 0 ) {
    142     the_semaphore->nest_count = 1;
    143     the_semaphore->holder     = _Thread_Executing;
    144     the_semaphore->holder_id  = _Thread_Executing->Object.id;
    145     _Thread_Executing->resource_count++;
    146   } else {
    147     the_semaphore->nest_count = 0;
    148     the_semaphore->holder     = NULL;
    149     the_semaphore->holder_id  = 0;
    150   }
    151 
    152   _Thread_queue_Initialize(
    153     &the_semaphore->Wait_queue,
    154     OBJECTS_RTEMS_SEMAPHORES,
    155     _Attributes_Is_priority( attribute_set ) ?
    156        THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO,
    157     STATES_WAITING_FOR_SEMAPHORE,
    158     _Semaphore_MP_Send_extract_proxy
    159   );
     158
     159  if ( _Attributes_Is_binary_semaphore( attribute_set ) ) {
     160    if ( _Attributes_Is_inherit_priority( attribute_set ) )
     161      the_mutex_attributes.discipline = CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT;
     162    else if (_Attributes_Is_priority_ceiling( attribute_set ) )
     163      the_mutex_attributes.discipline = CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING;
     164    else if (_Attributes_Is_priority( attribute_set ) )
     165      the_mutex_attributes.discipline = CORE_MUTEX_DISCIPLINES_PRIORITY;
     166    else
     167      the_mutex_attributes.discipline = CORE_MUTEX_DISCIPLINES_FIFO;
     168
     169    the_mutex_attributes.allow_nesting = TRUE;
     170
     171    /* Add priority ceiling code here ????? */
     172
     173    if ( count == 1 )
     174      lock = CORE_MUTEX_UNLOCKED;
     175    else
     176      lock = CORE_MUTEX_LOCKED;
     177
     178    _CORE_mutex_Initialize(
     179      &the_semaphore->Core_control.mutex,
     180      OBJECTS_RTEMS_SEMAPHORES,
     181      &the_mutex_attributes,
     182      lock,
     183      _Semaphore_MP_Send_extract_proxy
     184    );
     185  }
     186  else {
     187    if ( _Attributes_Is_priority( attribute_set ) )
     188      the_semaphore_attributes.discipline = CORE_SEMAPHORE_DISCIPLINES_PRIORITY;
     189    else
     190      the_semaphore_attributes.discipline = CORE_SEMAPHORE_DISCIPLINES_FIFO;
     191
     192    _CORE_semaphore_Initialize(
     193      &the_semaphore->Core_control.semaphore,
     194      OBJECTS_RTEMS_SEMAPHORES,
     195      &the_semaphore_attributes,
     196      count,
     197      _Semaphore_MP_Send_extract_proxy
     198    );
     199  }
    160200
    161201  _Objects_Open( &_Semaphore_Information, &the_semaphore->Object, &name );
     
    193233
    194234rtems_status_code rtems_semaphore_ident(
    195   rtems_name    name,
    196   unsigned32    node,
    197   Objects_Id   *id
    198 )
    199 {
    200   return( _Objects_Name_to_id( &_Semaphore_Information, &name, node, id ) );
     235  rtems_name  name,
     236  unsigned32  node,
     237  Objects_Id *id
     238)
     239{
     240  Objects_Name_to_id_errors  status;
     241 
     242  status = _Objects_Name_to_id( &_Semaphore_Information, &name, node, id );
     243 
     244  return _Status_Object_name_errors_to_status[ status ];
    201245}
    202246
     
    232276      return( RTEMS_ILLEGAL_ON_REMOTE_OBJECT );
    233277    case OBJECTS_LOCAL:
    234       if ( _Attributes_Is_binary_semaphore( the_semaphore->attribute_set) &&
    235                        ( the_semaphore->count == 0 ) ) {
    236         _Thread_Enable_dispatch();
    237         return( RTEMS_RESOURCE_IN_USE );
     278      if ( _Attributes_Is_binary_semaphore( the_semaphore->attribute_set) ) {
     279        if ( _CORE_mutex_Is_locked( &the_semaphore->Core_control.mutex ) ) {
     280          _Thread_Enable_dispatch();
     281          return( RTEMS_RESOURCE_IN_USE );
     282        }
     283        else
     284          _CORE_mutex_Flush(
     285            &the_semaphore->Core_control.mutex,
     286            _Semaphore_MP_Send_object_was_deleted,
     287            CORE_MUTEX_WAS_DELETED
     288          );
    238289      }
     290      else
     291        _CORE_semaphore_Flush(
     292          &the_semaphore->Core_control.semaphore,
     293          _Semaphore_MP_Send_object_was_deleted,
     294          CORE_SEMAPHORE_WAS_DELETED
     295        );
    239296
    240297      _Objects_Close( &_Semaphore_Information, &the_semaphore->Object );
    241 
    242       _Thread_queue_Flush(
    243         &the_semaphore->Wait_queue,
    244         _Semaphore_MP_Send_object_was_deleted
    245       );
    246298
    247299      _Semaphore_Free( the_semaphore );
     
    282334
    283335rtems_status_code rtems_semaphore_obtain(
    284   Objects_Id        id,
    285   unsigned32        option_set,
    286   rtems_interval timeout
     336  Objects_Id      id,
     337  unsigned32      option_set,
     338  rtems_interval  timeout
    287339)
    288340{
    289341  register Semaphore_Control *the_semaphore;
    290342  Objects_Locations           location;
     343  boolean                     wait;
    291344
    292345  the_semaphore = _Semaphore_Get( id, &location );
     
    302355      );
    303356    case OBJECTS_LOCAL:
    304       if ( !_Semaphore_Seize( the_semaphore, option_set ) ) {
    305         if ( _Attributes_Is_inherit_priority( the_semaphore->attribute_set ) &&
    306              the_semaphore->holder->current_priority >
    307                _Thread_Executing->current_priority ) {
    308             _Thread_Change_priority(
    309               the_semaphore->holder, _Thread_Executing->current_priority );
    310          }
    311         _Thread_queue_Enqueue( &the_semaphore->Wait_queue, timeout );
     357      if ( _Options_Is_no_wait( option_set ) )
     358        wait = FALSE;
     359      else
     360        wait = TRUE;
     361
     362      if ( _Attributes_Is_binary_semaphore( the_semaphore->attribute_set ) ) {
     363        _CORE_mutex_Seize(
     364          &the_semaphore->Core_control.mutex,
     365          id,
     366          wait,
     367          timeout
     368        );
     369        _Thread_Enable_dispatch();
     370        return( _Semaphore_Translate_core_mutex_return_code(
     371                  _Thread_Executing->Wait.return_code ) );
     372      } else {
     373        _CORE_semaphore_Seize(
     374          &the_semaphore->Core_control.semaphore,
     375          id,
     376          wait,
     377          timeout
     378        );
     379        _Thread_Enable_dispatch();
     380        return( _Semaphore_Translate_core_semaphore_return_code(
     381                  _Thread_Executing->Wait.return_code ) );
    312382      }
    313       _Thread_Enable_dispatch();
    314       return( _Thread_Executing->Wait.return_code );
    315383  }
    316384
     
    338406  register Semaphore_Control *the_semaphore;
    339407  Objects_Locations           location;
    340   Thread_Control             *the_thread;
     408  CORE_mutex_Status           mutex_status;
     409  CORE_semaphore_Status       semaphore_status;
    341410
    342411  the_semaphore = _Semaphore_Get( id, &location );
     
    354423      );
    355424    case OBJECTS_LOCAL:
    356       if ( _Attributes_Is_binary_semaphore( the_semaphore->attribute_set)) {
    357 
    358         if ( !_Objects_Are_ids_equal(
    359                _Thread_Executing->Object.id, the_semaphore->holder_id ) ) {
    360           _Thread_Enable_dispatch();
    361           return( RTEMS_NOT_OWNER_OF_RESOURCE );
    362         }
    363 
    364         the_semaphore->nest_count--;
    365 
    366         if ( the_semaphore->nest_count != 0 ) {
    367           _Thread_Enable_dispatch();
    368           return( RTEMS_SUCCESSFUL );
    369         }
    370 
    371         _Thread_Executing->resource_count--;
    372         the_semaphore->holder    = NULL;
    373         the_semaphore->holder_id = 0;
    374 
    375         /*
    376          *  Whether or not someone is waiting for the semaphore, an
    377          *  inherited priority must be lowered if this is the last
    378          *  semaphore (i.e. resource) this task has.
    379          */
    380 
    381         if ( _Attributes_Is_inherit_priority(the_semaphore->attribute_set) &&
    382              _Thread_Executing->resource_count == 0 &&
    383              _Thread_Executing->real_priority !=
    384                 _Thread_Executing->current_priority ) {
    385            _Thread_Change_priority(
    386               _Thread_Executing, _Thread_Executing->real_priority );
    387         }
    388 
     425      if ( _Attributes_Is_binary_semaphore( the_semaphore->attribute_set ) ) {
     426        mutex_status = _CORE_mutex_Surrender(
     427                         &the_semaphore->Core_control.mutex,
     428                         id,
     429                         _Semaphore_Core_mutex_mp_support
     430                       );
     431        _Thread_Enable_dispatch();
     432        return( _Semaphore_Translate_core_mutex_return_code( mutex_status ) );
    389433      }
    390 
    391       if ( (the_thread = _Thread_queue_Dequeue(&the_semaphore->Wait_queue)) ) {
    392 
    393         if ( !_Objects_Is_local_id( the_thread->Object.id ) ) {
    394           the_thread->receive_packet->return_code = RTEMS_SUCCESSFUL;
    395 
    396           if ( _Attributes_Is_binary_semaphore(the_semaphore->attribute_set) ) {
    397             the_semaphore->holder    = NULL;
    398             the_semaphore->holder_id = the_thread->Object.id;
    399             the_semaphore->nest_count = 1;
    400           }
    401 
    402           _Semaphore_MP_Send_response_packet(
    403             SEMAPHORE_MP_OBTAIN_RESPONSE,
    404             id,
    405             the_thread
    406           );
    407         } else {
    408 
    409           if ( _Attributes_Is_binary_semaphore(the_semaphore->attribute_set) ) {
    410             the_semaphore->holder    = the_thread;
    411             the_semaphore->holder_id = the_thread->Object.id;
    412             the_thread->resource_count++;
    413             the_semaphore->nest_count = 1;
    414           }
    415 
    416           /*
    417            *  No special action for priority inheritance because the_thread
    418            *  is guaranteed to be the highest priority thread waiting for
    419            *  the semaphore.
    420            */
    421         }
    422       } else
    423         the_semaphore->count += 1;
    424 
    425       _Thread_Enable_dispatch();
     434      else
     435        semaphore_status = _CORE_semaphore_Surrender(
     436                             &the_semaphore->Core_control.semaphore,
     437                             id,
     438                             _Semaphore_Core_semaphore_mp_support
     439                           );
     440        _Thread_Enable_dispatch();
     441        return(
     442          _Semaphore_Translate_core_semaphore_return_code( semaphore_status ) );
     443  }
     444
     445  return( RTEMS_INTERNAL_ERROR );   /* unreached - only to remove warnings */
     446}
     447
     448/*PAGE
     449 *
     450 *  _Semaphore_Translate_core_mutex_return_code
     451 *
     452 *  Input parameters:
     453 *    the_mutex_status - mutex status code to translate
     454 *
     455 *  Output parameters:
     456 *    rtems status code - translated RTEMS status code
     457 *
     458 */
     459 
     460rtems_status_code _Semaphore_Translate_core_mutex_return_code (
     461  unsigned32 the_mutex_status
     462)
     463{
     464  switch ( the_mutex_status ) {
     465    case  CORE_MUTEX_STATUS_SUCCESSFUL:
    426466      return( RTEMS_SUCCESSFUL );
    427   }
    428 
     467    case CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT:
     468      return( RTEMS_UNSATISFIED );
     469    case CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED:
     470      return( RTEMS_INTERNAL_ERROR );
     471    case CORE_MUTEX_STATUS_NOT_OWNER_OF_RESOURCE:
     472      return( RTEMS_NOT_OWNER_OF_RESOURCE );
     473    case CORE_MUTEX_WAS_DELETED:
     474      return( RTEMS_OBJECT_WAS_DELETED );
     475    case CORE_MUTEX_TIMEOUT:
     476      return( RTEMS_TIMEOUT );
     477    case THREAD_STATUS_PROXY_BLOCKING:
     478      return( THREAD_STATUS_PROXY_BLOCKING );
     479  }
     480  _Internal_error_Occurred(
     481    INTERNAL_ERROR_RTEMS_API,
     482    TRUE,
     483    the_mutex_status
     484  );
    429485  return( RTEMS_INTERNAL_ERROR );   /* unreached - only to remove warnings */
    430486}
     
    432488/*PAGE
    433489 *
    434  *  _Semaphore_Seize
    435  *
    436  *  This routine attempts to allocate a semaphore to the calling thread.
    437  *
    438  *  Input parameters:
    439  *    the_semaphore - pointer to semaphore control block
    440  *    option_set    - acquire semaphore options
    441  *
    442  *  Output parameters:
    443  *    TRUE  - if semaphore allocated
    444  *    FALSE - if semaphore NOT allocated
    445  *
    446  *  INTERRUPT LATENCY:
    447  *    available
    448  *    wait
    449  */
    450 
    451 boolean _Semaphore_Seize(
    452   Semaphore_Control *the_semaphore,
    453   rtems_option    option_set
    454 )
    455 {
    456   Thread_Control *executing;
    457   ISR_Level       level;
    458 
    459   executing = _Thread_Executing;
    460   executing->Wait.return_code = RTEMS_SUCCESSFUL;
    461   _ISR_Disable( level );
    462   if ( the_semaphore->count != 0 ) {
    463     the_semaphore->count -= 1;
    464     if ( _Attributes_Is_binary_semaphore( the_semaphore->attribute_set ) ) {
    465       the_semaphore->holder     = executing;
    466       the_semaphore->holder_id  = executing->Object.id;
    467       the_semaphore->nest_count = 1;
    468       executing->resource_count++;
    469     }
    470     _ISR_Enable( level );
    471     return( TRUE );
    472   }
    473 
    474   if ( _Options_Is_no_wait( option_set ) ) {
    475     _ISR_Enable( level );
    476     executing->Wait.return_code = RTEMS_UNSATISFIED;
    477     return( TRUE );
    478   }
    479 
    480   if ( _Attributes_Is_binary_semaphore( the_semaphore->attribute_set ) ) {
    481     if ( _Objects_Are_ids_equal(
    482             _Thread_Executing->Object.id, the_semaphore->holder_id ) ) {
    483       the_semaphore->nest_count++;
    484       _ISR_Enable( level );
    485       return( TRUE );
    486     }
    487   }
    488 
    489   the_semaphore->Wait_queue.sync = TRUE;
    490   executing->Wait.queue      = &the_semaphore->Wait_queue;
    491   executing->Wait.id         = the_semaphore->Object.id;
    492   executing->Wait.option_set = option_set;
    493   _ISR_Enable( level );
    494   return( FALSE );
    495 }
     490 *  _Semaphore_Translate_core_semaphore_return_code
     491 *
     492 *  Input parameters:
     493 *    the_semaphore_status - semaphore status code to translate
     494 *
     495 *  Output parameters:
     496 *    rtems status code - translated RTEMS status code
     497 *
     498 */
     499 
     500rtems_status_code _Semaphore_Translate_core_semaphore_return_code (
     501  unsigned32 the_semaphore_status
     502)
     503{
     504  switch ( the_semaphore_status ) {
     505    case  CORE_SEMAPHORE_STATUS_SUCCESSFUL:
     506      return( RTEMS_SUCCESSFUL );
     507    case CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT:
     508      return( RTEMS_UNSATISFIED );
     509    case CORE_SEMAPHORE_WAS_DELETED:
     510      return( RTEMS_OBJECT_WAS_DELETED );
     511    case CORE_SEMAPHORE_TIMEOUT:
     512      return( RTEMS_TIMEOUT );
     513    case THREAD_STATUS_PROXY_BLOCKING:
     514      return( THREAD_STATUS_PROXY_BLOCKING );
     515  }
     516  _Internal_error_Occurred(
     517    INTERNAL_ERROR_RTEMS_API,
     518    TRUE,
     519    the_semaphore_status
     520  );
     521  return( RTEMS_INTERNAL_ERROR );   /* unreached - only to remove warnings */
     522  return( RTEMS_INTERNAL_ERROR );   /* unreached - only to remove warnings */
     523}
     524
     525/*PAGE
     526 *
     527 *  _Semaphore_Core_mutex_mp_support
     528 *
     529 *  Input parameters:
     530 *    the_thread - the remote thread the semaphore was surrendered to
     531 *    id         - id of the surrendered semaphore
     532 *
     533 *  Output parameters: NONE
     534 */
     535 
     536void  _Semaphore_Core_mutex_mp_support (
     537  Thread_Control *the_thread,
     538  Objects_Id      id
     539)
     540{
     541  the_thread->receive_packet->return_code = RTEMS_SUCCESSFUL;
     542 
     543  _Semaphore_MP_Send_response_packet(
     544     SEMAPHORE_MP_OBTAIN_RESPONSE,
     545     id,
     546     the_thread
     547   );
     548}
     549
     550
     551/*PAGE
     552 *
     553 *  _Semaphore_Core_semaphore_mp_support
     554 *
     555 *  Input parameters:
     556 *    the_thread - the remote thread the semaphore was surrendered to
     557 *    id         - id of the surrendered semaphore
     558 *
     559 *  Output parameters: NONE
     560 */
     561 
     562void  _Semaphore_Core_semaphore_mp_support (
     563  Thread_Control *the_thread,
     564  Objects_Id      id
     565)
     566{
     567  the_thread->receive_packet->return_code = RTEMS_SUCCESSFUL;
     568 
     569  _Semaphore_MP_Send_response_packet(
     570     SEMAPHORE_MP_OBTAIN_RESPONSE,
     571     id,
     572     the_thread
     573   );
     574}
  • cpukit/rtems/src/semmp.c

    r5072b07 r3a4ae6c  
    1515
    1616#include <rtems/system.h>
    17 #include <rtems/mpci.h>
    18 #include <rtems/mppkt.h>
    19 #include <rtems/object.h>
    20 #include <rtems/options.h>
    21 #include <rtems/sem.h>
    22 #include <rtems/thread.h>
    23 #include <rtems/watchdog.h>
     17#include <rtems/rtems/status.h>
     18#include <rtems/core/mpci.h>
     19#include <rtems/core/mppkt.h>
     20#include <rtems/core/object.h>
     21#include <rtems/rtems/options.h>
     22#include <rtems/rtems/sem.h>
     23#include <rtems/core/thread.h>
     24#include <rtems/core/watchdog.h>
     25#include <rtems/rtems/support.h>
    2426
    2527/*PAGE
     
    4648
    4749      the_packet                    = _Semaphore_MP_Get_packet();
    48       the_packet->Prefix.the_class  = RTEMS_MP_PACKET_SEMAPHORE;
     50      the_packet->Prefix.the_class  = MP_PACKET_SEMAPHORE;
    4951      the_packet->Prefix.length     = sizeof ( Semaphore_MP_Packet );
    5052      the_packet->Prefix.to_convert = sizeof ( Semaphore_MP_Packet );
     
    7981  Semaphore_MP_Remote_operations operation,
    8082  Objects_Id                     semaphore_id,
    81   rtems_option                option_set,
    82   rtems_interval              timeout
     83  rtems_option                   option_set,
     84  rtems_interval                 timeout
    8385)
    8486{
     
    9193
    9294      the_packet                    = _Semaphore_MP_Get_packet();
    93       the_packet->Prefix.the_class  = RTEMS_MP_PACKET_SEMAPHORE;
     95      the_packet->Prefix.the_class  = MP_PACKET_SEMAPHORE;
    9496      the_packet->Prefix.length     = sizeof ( Semaphore_MP_Packet );
    9597      the_packet->Prefix.to_convert = sizeof ( Semaphore_MP_Packet );
     
    223225      );
    224226
    225       if ( ! _Status_Is_proxy_blocking( the_packet->Prefix.return_code ) )
     227      if ( ! _Thread_Is_proxy_blocking( the_packet->Prefix.return_code ) )
    226228        _Semaphore_MP_Send_response_packet(
    227229           SEMAPHORE_MP_OBTAIN_RESPONSE,
  • cpukit/rtems/src/signal.c

    r5072b07 r3a4ae6c  
    1515
    1616#include <rtems/system.h>
    17 #include <rtems/asr.h>
    18 #include <rtems/isr.h>
    19 #include <rtems/modes.h>
    20 #include <rtems/signal.h>
    21 #include <rtems/thread.h>
     17#include <rtems/rtems/status.h>
     18#include <rtems/rtems/asr.h>
     19#include <rtems/core/isr.h>
     20#include <rtems/rtems/modes.h>
     21#include <rtems/rtems/signal.h>
     22#include <rtems/core/thread.h>
     23#include <rtems/rtems/tasks.h>
    2224
     25/*PAGE
     26 *
     27 *  _Signal_Manager_initialization
     28 *
     29 *  This routine initializes all signal manager related data structures.
     30 *
     31 *  Input parameters:   NONE
     32 *
     33 *  Output parameters:  NONE
     34 */
     35 
     36void _Signal_Manager_initialization( void )
     37{
     38  /*
     39   *  Register the MP Process Packet routine.
     40   */
     41 
     42  _MPCI_Register_packet_processor(
     43    MP_PACKET_SIGNAL,
     44    _Signal_MP_Process_packet
     45  );
     46}
     47 
    2348/*PAGE
    2449 *
     
    4267)
    4368{
    44   Thread_Control *executing;
     69  Thread_Control     *executing;
     70  RTEMS_API_Control  *api;
     71  ASR_Information    *asr;
    4572
    4673/* XXX normalize mode */
    4774  executing = _Thread_Executing;
     75  api = executing->API_Extensions[ THREAD_API_RTEMS ];
     76  asr = &api->Signal;
     77
    4878  _Thread_Disable_dispatch(); /* cannot reschedule while */
    4979                              /*   the thread is inconsistent */
    5080
    5181  if ( !_ASR_Is_null_handler( asr_handler ) ) {
    52     executing->RTEMS_API->Signal.mode_set = mode_set;
    53     executing->RTEMS_API->Signal.handler = asr_handler;
     82    asr->mode_set = mode_set;
     83    asr->handler = asr_handler;
    5484  }
    5585  else
    56     _ASR_Initialize( &executing->RTEMS_API->Signal );
     86    _ASR_Initialize( asr );
    5787  _Thread_Enable_dispatch();
    58   return( RTEMS_SUCCESSFUL );
     88  return RTEMS_SUCCESSFUL;
    5989}
    6090
     
    81111  register Thread_Control *the_thread;
    82112  Objects_Locations        location;
     113  RTEMS_API_Control       *api;
     114  ASR_Information         *asr;
    83115
    84116  the_thread = _Thread_Get( id, &location );
    85117  switch ( location ) {
    86118    case OBJECTS_ERROR:
    87       return( RTEMS_INVALID_ID );
     119      return RTEMS_INVALID_ID;
    88120    case OBJECTS_REMOTE:
    89121      return _Signal_MP_Send_request_packet(
     
    93125      );
    94126    case OBJECTS_LOCAL:
    95       if ( ! _ASR_Is_null_handler( the_thread->RTEMS_API->Signal.handler ) ) {
    96         if ( _Modes_Is_asr_disabled( the_thread->current_modes ) )
    97           _ASR_Post_signals(
    98             signal_set, &the_thread->RTEMS_API->Signal.signals_pending );
    99         else {
    100           _ASR_Post_signals(
    101             signal_set, &the_thread->RTEMS_API->Signal.signals_posted );
     127      api = the_thread->API_Extensions[ THREAD_API_RTEMS ];
     128      asr = &api->Signal;
     129
     130      if ( ! _ASR_Is_null_handler( asr->handler ) ) {
     131        if ( asr->is_enabled ) {
     132          _ASR_Post_signals( signal_set, &asr->signals_posted );
    102133          if ( _ISR_Is_in_progress() && _Thread_Is_executing( the_thread ) )
    103134            _ISR_Signals_to_thread_executing = TRUE;
     135        } else {
     136          _ASR_Post_signals( signal_set, &asr->signals_pending );
    104137        }
    105138        _Thread_Enable_dispatch();
    106         return( RTEMS_SUCCESSFUL );
     139        return RTEMS_SUCCESSFUL;
    107140      }
    108141      _Thread_Enable_dispatch();
    109       return( RTEMS_NOT_DEFINED );
     142      return RTEMS_NOT_DEFINED;
    110143  }
    111144
    112   return( RTEMS_INTERNAL_ERROR );   /* unreached - only to remove warnings */
     145  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
    113146}
  • cpukit/rtems/src/signalmp.c

    r5072b07 r3a4ae6c  
    1515
    1616#include <rtems/system.h>
    17 #include <rtems/mpci.h>
    18 #include <rtems/mppkt.h>
    19 #include <rtems/object.h>
    20 #include <rtems/options.h>
    21 #include <rtems/signal.h>
    22 #include <rtems/states.h>
    23 #include <rtems/thread.h>
    24 #include <rtems/watchdog.h>
     17#include <rtems/rtems/status.h>
     18#include <rtems/core/mpci.h>
     19#include <rtems/core/mppkt.h>
     20#include <rtems/core/object.h>
     21#include <rtems/rtems/options.h>
     22#include <rtems/rtems/signal.h>
     23#include <rtems/core/states.h>
     24#include <rtems/core/thread.h>
     25#include <rtems/core/watchdog.h>
     26#include <rtems/rtems/support.h>
    2527
    2628/*PAGE
     
    5254
    5355      the_packet                    = _Signal_MP_Get_packet();
    54       the_packet->Prefix.the_class  = RTEMS_MP_PACKET_SIGNAL;
     56      the_packet->Prefix.the_class  = MP_PACKET_SIGNAL;
    5557      the_packet->Prefix.length     = sizeof ( Signal_MP_Packet );
    5658      the_packet->Prefix.to_convert = sizeof ( Signal_MP_Packet );
  • cpukit/rtems/src/taskmp.c

    r5072b07 r3a4ae6c  
    1515
    1616#include <rtems/system.h>
    17 #include <rtems/mpci.h>
    18 #include <rtems/mppkt.h>
    19 #include <rtems/object.h>
    20 #include <rtems/options.h>
    21 #include <rtems/tasks.h>
    22 #include <rtems/thread.h>
    23 #include <rtems/watchdog.h>
     17#include <rtems/rtems/status.h>
     18#include <rtems/core/mpci.h>
     19#include <rtems/core/mppkt.h>
     20#include <rtems/core/object.h>
     21#include <rtems/rtems/options.h>
     22#include <rtems/rtems/tasks.h>
     23#include <rtems/core/thread.h>
     24#include <rtems/core/watchdog.h>
     25#include <rtems/rtems/support.h>
    2426
    2527/*PAGE
     
    4345
    4446      the_packet                    = _RTEMS_tasks_MP_Get_packet();
    45       the_packet->Prefix.the_class  = RTEMS_MP_PACKET_TASKS;
     47      the_packet->Prefix.the_class  = MP_PACKET_TASKS;
    4648      the_packet->Prefix.length     = sizeof ( RTEMS_tasks_MP_Packet );
    4749      the_packet->Prefix.to_convert = sizeof ( RTEMS_tasks_MP_Packet );
     
    9294
    9395      the_packet                    = _RTEMS_tasks_MP_Get_packet();
    94       the_packet->Prefix.the_class  = RTEMS_MP_PACKET_TASKS;
     96      the_packet->Prefix.the_class  = MP_PACKET_TASKS;
    9597      the_packet->Prefix.length     = sizeof ( RTEMS_tasks_MP_Packet );
    9698      the_packet->Prefix.to_convert = sizeof ( RTEMS_tasks_MP_Packet );
     
    333335RTEMS_tasks_MP_Packet *_RTEMS_tasks_MP_Get_packet ( void )
    334336{
    335   return ( (RTEMS_tasks_MP_Packet *) _MPCI_Get_packet() );
     337  return (RTEMS_tasks_MP_Packet *) _MPCI_Get_packet();
    336338}
    337339
  • cpukit/rtems/src/tasks.c

    r5072b07 r3a4ae6c  
    1515
    1616#include <rtems/system.h>
    17 #include <rtems/support.h>
    18 #include <rtems/modes.h>
    19 #include <rtems/object.h>
    20 #include <rtems/stack.h>
    21 #include <rtems/states.h>
    22 #include <rtems/tasks.h>
    23 #include <rtems/thread.h>
    24 #include <rtems/threadq.h>
    25 #include <rtems/tod.h>
    26 #include <rtems/userext.h>
    27 #include <rtems/wkspace.h>
     17#include <rtems/rtems/status.h>
     18#include <rtems/rtems/support.h>
     19#include <rtems/rtems/modes.h>
     20#include <rtems/core/object.h>
     21#include <rtems/core/stack.h>
     22#include <rtems/core/states.h>
     23#include <rtems/rtems/tasks.h>
     24#include <rtems/core/thread.h>
     25#include <rtems/core/threadq.h>
     26#include <rtems/core/tod.h>
     27#include <rtems/core/userext.h>
     28#include <rtems/core/wkspace.h>
     29#include <rtems/core/intthrd.h>
     30#include <rtems/sysstate.h>
     31
     32/*PAGE
     33 *
     34 *  _RTEMS_tasks_Create_extension
     35 *
     36 *  XXX
     37 */
     38
     39boolean _RTEMS_tasks_Create_extension(
     40  Thread_Control *executing,
     41  Thread_Control *created
     42)
     43{
     44  RTEMS_API_Control *api;
     45
     46  api = _Workspace_Allocate( sizeof( RTEMS_API_Control ) );
     47
     48  if ( !api )
     49    return FALSE;
     50
     51  created->API_Extensions[ THREAD_API_RTEMS ] = api;
     52 
     53  api->pending_events = EVENT_SETS_NONE_PENDING;
     54  _ASR_Initialize( &api->Signal );
     55  return TRUE;
     56}
     57
     58/*PAGE
     59 *
     60 *  _RTEMS_tasks_Start_extension
     61 *
     62 *  XXX
     63 */
     64 
     65User_extensions_routine _RTEMS_tasks_Start_extension(
     66  Thread_Control *executing,
     67  Thread_Control *started
     68)
     69{
     70  RTEMS_API_Control *api;
     71
     72  api = started->API_Extensions[ THREAD_API_RTEMS ];
     73 
     74  api->pending_events = EVENT_SETS_NONE_PENDING;
     75
     76  _ASR_Initialize( &api->Signal );
     77}
     78
     79/*PAGE
     80 *
     81 *  _RTEMS_tasks_Delete_extension
     82 *
     83 *  XXX
     84 */
     85 
     86User_extensions_routine _RTEMS_tasks_Delete_extension(
     87  Thread_Control *executing,
     88  Thread_Control *deleted
     89)
     90{
     91  (void) _Workspace_Free( deleted->API_Extensions[ THREAD_API_RTEMS ] );
     92 
     93  deleted->API_Extensions[ THREAD_API_RTEMS ] = NULL;
     94}
     95
     96/*PAGE
     97 *
     98 *  _RTEMS_tasks_Switch_extension
     99 *
     100 *  XXX
     101 */
     102 
     103User_extensions_routine _RTEMS_tasks_Switch_extension(
     104  Thread_Control *executing
     105)
     106{
     107  ISR_Level          level;
     108  RTEMS_API_Control *api;
     109  ASR_Information   *asr;
     110  rtems_signal_set   signal_set;
     111  Modes_Control      prev_mode;
     112
     113  api = executing->API_Extensions[ THREAD_API_RTEMS ];
     114  asr = &api->Signal;
     115 
     116  _ISR_Disable( level );
     117
     118  signal_set = asr->signals_posted;
     119 
     120  if ( signal_set ) {
     121  /* if ( _ASR_Are_signals_pending( asr ) ) {
     122 
     123    signal_set          = asr->signals_posted; */
     124    asr->signals_posted = 0;
     125    _ISR_Enable( level );
     126 
     127    asr->nest_level += 1;
     128    rtems_task_mode( asr->mode_set, RTEMS_ALL_MODE_MASKS, &prev_mode );
     129 
     130    (*asr->handler)( signal_set );
     131 
     132    asr->nest_level -= 1;
     133    rtems_task_mode( prev_mode, RTEMS_ALL_MODE_MASKS, &prev_mode );
     134  }
     135  else
     136    _ISR_Enable( level );
     137
     138}
     139
     140Internal_threads_Extensions_control _RTEMS_tasks_Internal_thread_extensions = {
     141  { NULL, NULL },
     142  NULL,                                     /* predriver */
     143  _RTEMS_tasks_Initialize_user_tasks        /* postdriver */
     144};
     145
     146User_extensions_Control _RTEMS_tasks_API_extensions = {
     147  { NULL, NULL },
     148  { _RTEMS_tasks_Create_extension,            /* create */
     149    _RTEMS_tasks_Start_extension,             /* start */
     150    _RTEMS_tasks_Start_extension,             /* restart */
     151    _RTEMS_tasks_Delete_extension,            /* delete */
     152    NULL,                                     /* switch */
     153    _RTEMS_tasks_Switch_extension,            /* post switch */
     154    NULL,                                     /* begin */
     155    NULL,                                     /* exitted */
     156    NULL                                      /* fatal */
     157  }
     158};
    28159
    29160/*PAGE
     
    40171
    41172void _RTEMS_tasks_Manager_initialization(
    42   unsigned32   maximum_tasks
    43 )
    44 {
     173  unsigned32                        maximum_tasks,
     174  unsigned32                        number_of_initialization_tasks,
     175  rtems_initialization_tasks_table *user_tasks
     176)
     177{
     178
     179  _RTEMS_tasks_Number_of_initialization_tasks = number_of_initialization_tasks;
     180  _RTEMS_tasks_User_initialization_tasks = user_tasks;
     181
     182  if ( user_tasks == NULL || number_of_initialization_tasks == 0 )
     183    _Internal_error_Occurred( INTERNAL_ERROR_RTEMS_API, TRUE, RTEMS_TOO_MANY );
     184
    45185  _Objects_Initialize_information(
    46186    &_RTEMS_tasks_Information,
     
    53193    TRUE
    54194  );
     195
     196  /*
     197   *  Add all the extensions for this API
     198   */
     199
     200  _User_extensions_Add_API_set( &_RTEMS_tasks_API_extensions );
     201
     202  _Internal_threads_Add_extension( &_RTEMS_tasks_Internal_thread_extensions );
     203
     204  /*
     205   *  Register the MP Process Packet routine.
     206   */
     207
     208  _MPCI_Register_packet_processor(
     209    MP_PACKET_TASKS,
     210    _RTEMS_tasks_MP_Process_packet
     211  );
     212
    55213}
    56214
     
    90248  boolean                  is_fp;
    91249  boolean                  is_global;
     250  boolean                  status;
    92251  rtems_attribute          the_attribute_set;
    93252  Priority_Control         core_priority;
     253  RTEMS_API_Control       *api;
     254  ASR_Information         *asr;
    94255 
    95256
    96257  if ( !rtems_is_name_valid( name ) )
    97     return ( RTEMS_INVALID_NAME );
     258    return RTEMS_INVALID_NAME;
    98259
    99260  /*
     
    104265#if 0
    105266  if ( !_Stack_Is_enough( stack_size ) )
    106     return( RTEMS_INVALID_SIZE );
     267    return RTEMS_INVALID_SIZE;
    107268#endif
    108269
     
    111272   */
    112273
    113   if ( !_Priority_Is_valid( initial_priority ) )
    114     return( RTEMS_INVALID_PRIORITY );
    115 
    116   core_priority = _RTEMS_Tasks_Priority_to_Core( initial_priority );
     274  if ( !_RTEMS_tasks_Priority_is_valid( initial_priority ) )
     275    return RTEMS_INVALID_PRIORITY;
     276
     277  core_priority = _RTEMS_tasks_Priority_to_Core( initial_priority );
    117278
    118279  /*
     
    138299    is_global = TRUE;
    139300
    140     if ( !_Configuration_Is_multiprocessing() )
    141       return( RTEMS_MP_NOT_CONFIGURED );
     301    if ( !_System_state_Is_multiprocessing )
     302      return RTEMS_MP_NOT_CONFIGURED;
    142303
    143304  } else
     
    168329  if ( !the_thread ) {
    169330    _Thread_Enable_dispatch();
    170     return( RTEMS_TOO_MANY );
     331    return RTEMS_TOO_MANY;
    171332  }
    172333
     
    177338      _RTEMS_tasks_Free( the_thread );
    178339      _Thread_Enable_dispatch();
    179       return( RTEMS_TOO_MANY );
     340      return RTEMS_TOO_MANY;
    180341    }
    181342  }
    182343
    183 #if 0
    184   /*
    185    *  Allocate and initialize the RTEMS API specific information
    186    */
    187 
    188   the_thread->RTEMS_API = _Workspace_Allocate( sizeof( RTEMS_API_Control ) );
    189 
    190   if ( !the_thread->RTEMS_API ) {
    191     _RTEMS_tasks_Free( the_thread );
    192     if ( is_global )
    193     _Objects_MP_Free_global_object( the_global_object );
    194     _Thread_Enable_dispatch();
    195     return( RTEMS_UNSATISFIED );
    196   }
    197 
    198   the_thread->RTEMS_API->pending_events         = EVENT_SETS_NONE_PENDING;
    199   _ASR_Initialize( &the_thread->RTEMS_API->Signal );
    200 #endif
    201 
    202344  /*
    203345   *  Initialize the core thread for this task.
    204346   */
    205347
    206 /* XXX normalize mode */
    207 
    208   if ( !_Thread_Initialize( &_RTEMS_tasks_Information, the_thread,
    209          NULL, stack_size, is_fp, core_priority, initial_modes, &name ) ) {
     348  status = _Thread_Initialize(
     349    &_RTEMS_tasks_Information,
     350    the_thread,
     351    NULL,
     352    stack_size,
     353    is_fp,
     354    core_priority,
     355    _Modes_Is_preempt(initial_modes)   ? TRUE : FALSE,
     356    _Modes_Is_timeslice(initial_modes) ? TRUE : FALSE,
     357    _Modes_Get_interrupt_level(initial_modes),
     358    &name
     359  );
     360
     361  if ( !status ) {
    210362    if ( is_global )
    211363      _Objects_MP_Free_global_object( the_global_object );
    212364    _RTEMS_tasks_Free( the_thread );
    213365    _Thread_Enable_dispatch();
    214     return( RTEMS_UNSATISFIED );
    215   }
     366    return RTEMS_UNSATISFIED;
     367  }
     368
     369  api = the_thread->API_Extensions[ THREAD_API_RTEMS ];
     370  asr = &api->Signal;
     371 
     372  asr->is_enabled = _Modes_Is_asr_disabled(initial_modes) ? FALSE : TRUE;
    216373
    217374  *id = the_thread->Object.id;
     
    219376  if ( is_global ) {
    220377
    221     the_thread->RTEMS_API->is_global = TRUE;
     378    the_thread->is_global = TRUE;
    222379
    223380    _Objects_MP_Open(
     
    237394
    238395  _Thread_Enable_dispatch();
    239   return( RTEMS_SUCCESSFUL );
     396  return RTEMS_SUCCESSFUL;
    240397}
    241398
     
    264421)
    265422{
    266   if ( name != OBJECTS_ID_OF_SELF )
    267     return( _Objects_Name_to_id( &_RTEMS_tasks_Information, &name, node, id ) );
    268 
    269   *id = _Thread_Executing->Object.id;
    270   return( RTEMS_SUCCESSFUL );
     423  Objects_Name_to_id_errors  status;
     424
     425  if ( name == OBJECTS_ID_OF_SELF ) {
     426    *id = _Thread_Executing->Object.id;
     427    return RTEMS_SUCCESSFUL;
     428   }
     429
     430  status = _Objects_Name_to_id( &_RTEMS_tasks_Information, &name, node, id );
     431
     432  return _Status_Object_name_errors_to_status[ status ];
    271433}
    272434
     
    299461
    300462  if ( entry_point == NULL )
    301     return( RTEMS_INVALID_ADDRESS );
     463    return RTEMS_INVALID_ADDRESS;
    302464
    303465  the_thread = _Thread_Get( id, &location );
    304466  switch ( location ) {
    305467    case OBJECTS_ERROR:
    306       return( RTEMS_INVALID_ID );
     468      return RTEMS_INVALID_ID;
    307469    case OBJECTS_REMOTE:
    308470      _Thread_Dispatch();
    309       return( RTEMS_ILLEGAL_ON_REMOTE_OBJECT );
     471      return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
    310472    case OBJECTS_LOCAL:
    311473      if ( _Thread_Start(
    312474             the_thread, THREAD_START_NUMERIC, entry_point, NULL, argument ) ) {
    313475        _Thread_Enable_dispatch();
    314         return( RTEMS_SUCCESSFUL );
     476        return RTEMS_SUCCESSFUL;
    315477      }
    316478      _Thread_Enable_dispatch();
    317       return( RTEMS_INCORRECT_STATE );
    318   }
    319 
    320   return( RTEMS_INTERNAL_ERROR );   /* unreached - only to remove warnings */
     479      return RTEMS_INCORRECT_STATE;
     480  }
     481
     482  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
    321483}
    322484
     
    350512  switch ( location ) {
    351513    case OBJECTS_ERROR:
    352       return( RTEMS_INVALID_ID );
     514      return RTEMS_INVALID_ID;
    353515    case OBJECTS_REMOTE:
    354516      _Thread_Dispatch();
    355       return( RTEMS_ILLEGAL_ON_REMOTE_OBJECT );
     517      return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
    356518    case OBJECTS_LOCAL:
    357519      if ( _Thread_Restart( the_thread, NULL, argument ) ) {
    358 
    359         /*  XXX until these are in an API extension they are too late. */
    360         _ASR_Initialize( &the_thread->RTEMS_API->Signal );
    361         the_thread->RTEMS_API->pending_events = EVENT_SETS_NONE_PENDING;
    362 
    363520        _Thread_Enable_dispatch();
    364         return( RTEMS_SUCCESSFUL );
     521        return RTEMS_SUCCESSFUL;
    365522      }
    366523      _Thread_Enable_dispatch();
    367       return( RTEMS_INCORRECT_STATE );
    368   }
    369 
    370   return( RTEMS_INTERNAL_ERROR );   /* unreached - only to remove warnings */
     524      return RTEMS_INCORRECT_STATE;
     525  }
     526
     527  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
    371528}
    372529
     
    399556  switch ( location ) {
    400557    case OBJECTS_ERROR:
    401       return( RTEMS_INVALID_ID );
     558      return RTEMS_INVALID_ID;
    402559    case OBJECTS_REMOTE:
    403560      _Thread_Dispatch();
    404       return( RTEMS_ILLEGAL_ON_REMOTE_OBJECT );
     561      return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
    405562    case OBJECTS_LOCAL:
    406563      _Thread_Close( &_RTEMS_tasks_Information, the_thread );
    407564
    408       /* XXX */
    409       (void) _Workspace_Free( the_thread->RTEMS_API );
    410 
    411565      _RTEMS_tasks_Free( the_thread );
    412566
    413       if ( _Attributes_Is_global( the_thread->RTEMS_API->is_global ) ) {
     567      if ( the_thread->is_global ) {
    414568
    415569        _Objects_MP_Close( &_RTEMS_tasks_Information, the_thread->Object.id );
     
    423577
    424578      _Thread_Enable_dispatch();
    425       return( RTEMS_SUCCESSFUL );
    426   }
    427 
    428   return( RTEMS_INTERNAL_ERROR );   /* unreached - only to remove warnings */
     579      return RTEMS_SUCCESSFUL;
     580  }
     581
     582  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
    429583}
    430584
     
    455609  switch ( location ) {
    456610    case OBJECTS_ERROR:
    457       return( RTEMS_INVALID_ID );
     611      return RTEMS_INVALID_ID;
    458612    case OBJECTS_REMOTE:
    459       return(
    460         _RTEMS_tasks_MP_Send_request_packet(
    461           RTEMS_TASKS_MP_SUSPEND_REQUEST,
    462           id,
    463           0,          /* Not used */
    464           0,          /* Not used */
    465           0           /* Not used */
    466         )
     613      return _RTEMS_tasks_MP_Send_request_packet(
     614        RTEMS_TASKS_MP_SUSPEND_REQUEST,
     615        id,
     616        0,          /* Not used */
     617        0,          /* Not used */
     618        0           /* Not used */
    467619      );
    468620    case OBJECTS_LOCAL:
     
    470622        _Thread_Set_state( the_thread, STATES_SUSPENDED );
    471623        _Thread_Enable_dispatch();
    472         return( RTEMS_SUCCESSFUL );
     624        return RTEMS_SUCCESSFUL;
    473625      }
    474626      _Thread_Enable_dispatch();
    475       return( RTEMS_ALREADY_SUSPENDED );
    476   }
    477 
    478   return( RTEMS_INTERNAL_ERROR );   /* unreached - only to remove warnings */
     627      return RTEMS_ALREADY_SUSPENDED;
     628  }
     629
     630  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
    479631}
    480632
     
    504656  switch ( location ) {
    505657    case OBJECTS_ERROR:
    506       return( RTEMS_INVALID_ID );
     658      return RTEMS_INVALID_ID;
    507659    case OBJECTS_REMOTE:
    508660      return(
     
    519671        _Thread_Resume( the_thread );
    520672        _Thread_Enable_dispatch();
    521         return( RTEMS_SUCCESSFUL );
     673        return RTEMS_SUCCESSFUL;
    522674      }
    523675      _Thread_Enable_dispatch();
    524       return( RTEMS_INCORRECT_STATE );
    525   }
    526 
    527   return( RTEMS_INTERNAL_ERROR );   /* unreached - only to remove warnings */
     676      return RTEMS_INCORRECT_STATE;
     677  }
     678
     679  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
    528680}
    529681
     
    557709
    558710  if ( new_priority != RTEMS_CURRENT_PRIORITY &&
    559        !_Priority_Is_valid( new_priority ) )
    560     return( RTEMS_INVALID_PRIORITY );
     711       !_RTEMS_tasks_Priority_is_valid( new_priority ) )
     712    return RTEMS_INVALID_PRIORITY;
    561713
    562714  the_thread = _Thread_Get( id, &location );
    563715  switch ( location ) {
    564716    case OBJECTS_ERROR:
    565       return( RTEMS_INVALID_ID );
     717      return RTEMS_INVALID_ID;
    566718    case OBJECTS_REMOTE:
    567719      _Thread_Executing->Wait.return_argument = old_priority;
     
    584736      }
    585737      _Thread_Enable_dispatch();
    586       return( RTEMS_SUCCESSFUL );
    587   }
    588 
    589   return( RTEMS_INTERNAL_ERROR );   /* unreached - only to remove warnings */
     738      return RTEMS_SUCCESSFUL;
     739  }
     740
     741  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
    590742}
    591743
     
    604756 *  Output:
    605757 *    *previous_mode_set - previous mode set
    606  *     always returns RTEMS_SUCCESSFUL
     758 *     always return RTEMS_SUCCESSFUL;
    607759 */
    608760
     
    613765)
    614766{
    615   if ( _Thread_Change_mode( mode_set, mask, previous_mode_set ) )
     767  Thread_Control     *executing;
     768  RTEMS_API_Control  *api;
     769  ASR_Information    *asr;
     770  boolean             is_asr_enabled = FALSE;
     771  boolean             needs_asr_dispatching = FALSE;
     772  rtems_mode          old_mode;
     773
     774  executing     = _Thread_Executing;
     775  api = executing->API_Extensions[ THREAD_API_RTEMS ];
     776  asr = &api->Signal;
     777
     778  old_mode  = (executing->is_preemptible) ? RTEMS_PREEMPT : RTEMS_NO_PREEMPT;
     779  old_mode |= (executing->is_timeslice) ? RTEMS_TIMESLICE : RTEMS_NO_TIMESLICE;
     780  old_mode |= (asr->is_enabled) ? RTEMS_ASR : RTEMS_NO_ASR;
     781  old_mode |= _ISR_Get_level();
     782
     783  *previous_mode_set = old_mode;
     784
     785  /*
     786   *  These are generic thread scheduling characteristics.
     787   */
     788
     789  if ( mask & RTEMS_PREEMPT_MASK )
     790    executing->is_preemptible = _Modes_Is_preempt(mode_set) ? TRUE : FALSE;
     791
     792  if ( mask & RTEMS_TIMESLICE_MASK )
     793    executing->is_timeslice = _Modes_Is_timeslice(mode_set) ? TRUE : FALSE;
     794
     795  /*
     796   *  Set the new interrupt level
     797   */
     798
     799  if ( mask & RTEMS_INTERRUPT_MASK )
     800    _Modes_Set_interrupt_level( mode_set );
     801
     802  /*
     803   *  This is specific to the RTEMS API
     804   */
     805
     806  is_asr_enabled = FALSE;
     807  needs_asr_dispatching = FALSE;
     808
     809  if ( mask & RTEMS_ASR_MASK ) {
     810    is_asr_enabled = _Modes_Is_asr_disabled( mode_set ) ? FALSE : TRUE;
     811    if ( is_asr_enabled != asr->is_enabled ) {
     812      asr->is_enabled = is_asr_enabled;
     813      _ASR_Swap_signals( asr );
     814      if ( _ASR_Are_signals_pending( asr ) )
     815        needs_asr_dispatching = TRUE;
     816    }
     817  }
     818
     819  if ( _Thread_Evaluate_mode() || needs_asr_dispatching )
    616820    _Thread_Dispatch();
    617   return( RTEMS_SUCCESSFUL );
     821
     822  return RTEMS_SUCCESSFUL;
    618823}
    619824
     
    644849  register Thread_Control *the_thread;
    645850  Objects_Locations        location;
     851  RTEMS_API_Control       *api;
    646852
    647853  /*
     
    651857
    652858  if ( notepad > RTEMS_NOTEPAD_LAST )
    653     return( RTEMS_INVALID_NUMBER );
     859    return RTEMS_INVALID_NUMBER;
    654860
    655861  /*
     
    659865  if ( _Objects_Are_ids_equal( id, OBJECTS_ID_OF_SELF ) ||
    660866       _Objects_Are_ids_equal( id, _Thread_Executing->Object.id ) ) {
    661       *note = _Thread_Executing->RTEMS_API->Notepads[ notepad ];
    662       return( RTEMS_SUCCESSFUL );
     867      api = _Thread_Executing->API_Extensions[ THREAD_API_RTEMS ];
     868      *note = api->Notepads[ notepad ];
     869      return RTEMS_SUCCESSFUL;
    663870  }
    664871
     
    666873  switch ( location ) {
    667874    case OBJECTS_ERROR:
    668       return( RTEMS_INVALID_ID );
     875      return RTEMS_INVALID_ID;
    669876    case OBJECTS_REMOTE:
    670877      _Thread_Executing->Wait.return_argument = note;
     
    678885      );
    679886    case OBJECTS_LOCAL:
    680       *note= the_thread->RTEMS_API->Notepads[ notepad ];
     887      api = the_thread->API_Extensions[ THREAD_API_RTEMS ];
     888      *note = api->Notepads[ notepad ];
    681889      _Thread_Enable_dispatch();
    682       return( RTEMS_SUCCESSFUL );
    683   }
    684 
    685   return( RTEMS_INTERNAL_ERROR );   /* unreached - only to remove warnings */
     890      return RTEMS_SUCCESSFUL;
     891  }
     892
     893  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
    686894}
    687895
     
    711919  register Thread_Control *the_thread;
    712920  Objects_Locations        location;
     921  RTEMS_API_Control       *api;
    713922
    714923  /*
     
    718927
    719928  if ( notepad > RTEMS_NOTEPAD_LAST )
    720     return( RTEMS_INVALID_NUMBER );
     929    return RTEMS_INVALID_NUMBER;
    721930
    722931  /*
     
    726935  if ( _Objects_Are_ids_equal( id, OBJECTS_ID_OF_SELF ) ||
    727936       _Objects_Are_ids_equal( id, _Thread_Executing->Object.id ) ) {
    728       _Thread_Executing->RTEMS_API->Notepads[ notepad ] = note;
    729       return( RTEMS_SUCCESSFUL );
     937      api = _Thread_Executing->API_Extensions[ THREAD_API_RTEMS ];
     938      api->Notepads[ notepad ] = note;
     939      return RTEMS_SUCCESSFUL;
    730940  }
    731941
     
    733943  switch ( location ) {
    734944    case OBJECTS_ERROR:
    735       return( RTEMS_INVALID_ID );
     945      return RTEMS_INVALID_ID;
    736946    case OBJECTS_REMOTE:
    737947      return _RTEMS_tasks_MP_Send_request_packet(
     
    744954
    745955    case OBJECTS_LOCAL:
    746       the_thread->RTEMS_API->Notepads[ notepad ] = note;
     956      api = the_thread->API_Extensions[ THREAD_API_RTEMS ];
     957      api->Notepads[ notepad ] = note;
    747958      _Thread_Enable_dispatch();
    748       return( RTEMS_SUCCESSFUL );
    749   }
    750 
    751   return( RTEMS_INTERNAL_ERROR );   /* unreached - only to remove warnings */
     959      return RTEMS_SUCCESSFUL;
     960  }
     961
     962  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
    752963}
    753964
     
    786997    _Thread_Enable_dispatch();
    787998  }
    788   return( RTEMS_SUCCESSFUL );
     999  return RTEMS_SUCCESSFUL;
    7891000}
    7901001
     
    8081019)
    8091020{
    810   rtems_interval seconds;
    811   rtems_status_code      local_result;
     1021  Watchdog_Interval   seconds;
    8121022
    8131023  if ( !_TOD_Is_set() )
    814     return( RTEMS_NOT_DEFINED );
     1024    return RTEMS_NOT_DEFINED;
    8151025
    8161026  time_buffer->ticks = 0;
    8171027
    818   local_result = _TOD_Validate( time_buffer );
    819 
    820   if  ( !rtems_is_status_successful( local_result ) )
    821     return( local_result );
     1028  if ( !_TOD_Validate( time_buffer ) )
     1029    return RTEMS_INVALID_CLOCK;
    8221030
    8231031  seconds = _TOD_To_seconds( time_buffer );
    8241032
    8251033  if ( seconds <= _TOD_Seconds_since_epoch )
    826     return( RTEMS_INVALID_CLOCK );
     1034    return RTEMS_INVALID_CLOCK;
    8271035
    8281036  _Thread_Disable_dispatch();
     
    8371045            seconds - _TOD_Seconds_since_epoch, WATCHDOG_ACTIVATE_NOW );
    8381046  _Thread_Enable_dispatch();
    839   return( RTEMS_SUCCESSFUL );
    840 }
     1047  return RTEMS_SUCCESSFUL;
     1048}
     1049
     1050/*PAGE
     1051 *
     1052 *  _RTEMS_tasks_Initialize_user_tasks
     1053 *
     1054 *  This routine creates and starts all configured user
     1055 *  initialzation threads.
     1056 *
     1057 *  Input parameters: NONE
     1058 *
     1059 *  Output parameters:  NONE
     1060 */
     1061
     1062void _RTEMS_tasks_Initialize_user_tasks( void )
     1063{
     1064  unsigned32                        index;
     1065  unsigned32                        maximum;
     1066  rtems_id                          id;
     1067  rtems_status_code                 return_value;
     1068  rtems_initialization_tasks_table *user_tasks;
     1069
     1070  /*
     1071   *  NOTE:  This is slightly different from the Ada implementation.
     1072   */
     1073
     1074  user_tasks = _RTEMS_tasks_User_initialization_tasks;
     1075  maximum    = _RTEMS_tasks_Number_of_initialization_tasks;
     1076
     1077  for ( index=0 ; index < maximum ; index++ ) {
     1078    return_value = rtems_task_create(
     1079      user_tasks[ index ].name,
     1080      user_tasks[ index ].initial_priority,
     1081      user_tasks[ index ].stack_size,
     1082      user_tasks[ index ].mode_set,
     1083      user_tasks[ index ].attribute_set,
     1084      &id
     1085    );
     1086
     1087    if ( !rtems_is_status_successful( return_value ) )
     1088      _Internal_error_Occurred( INTERNAL_ERROR_RTEMS_API, TRUE, return_value );
     1089
     1090    return_value = rtems_task_start(
     1091      id,
     1092      user_tasks[ index ].entry_point,
     1093      user_tasks[ index ].argument
     1094    );
     1095
     1096    if ( !rtems_is_status_successful( return_value ) )
     1097      _Internal_error_Occurred( INTERNAL_ERROR_RTEMS_API, TRUE, return_value );
     1098  }
     1099}
     1100
Note: See TracChangeset for help on using the changeset viewer.