From 97e2729d1a3432b9792b82ce88ce6d804a104f7a Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 23 Nov 1998 17:38:09 +0000 Subject: Added --disable-multiprocessing flag and modified a lot of files to make it work. --- c/src/exec/rtems/headers/Makefile.in | 12 ++- c/src/exec/rtems/headers/event.h | 2 + c/src/exec/rtems/headers/message.h | 4 + c/src/exec/rtems/headers/part.h | 2 + c/src/exec/rtems/headers/region.h | 2 + c/src/exec/rtems/headers/rtems.h | 2 + c/src/exec/rtems/headers/sem.h | 4 + c/src/exec/rtems/headers/signal.h | 2 + c/src/exec/rtems/headers/tasks.h | 2 + c/src/exec/rtems/headers/types.h | 6 ++ c/src/exec/rtems/include/rtems.h | 2 + c/src/exec/rtems/include/rtems/rtems/Makefile.in | 12 ++- c/src/exec/rtems/include/rtems/rtems/event.h | 2 + c/src/exec/rtems/include/rtems/rtems/message.h | 4 + c/src/exec/rtems/include/rtems/rtems/part.h | 2 + c/src/exec/rtems/include/rtems/rtems/region.h | 2 + c/src/exec/rtems/include/rtems/rtems/sem.h | 4 + c/src/exec/rtems/include/rtems/rtems/signal.h | 2 + c/src/exec/rtems/include/rtems/rtems/tasks.h | 2 + c/src/exec/rtems/include/rtems/rtems/types.h | 6 ++ c/src/exec/rtems/inline/attr.inl | 2 + c/src/exec/rtems/inline/rtems/rtems/attr.inl | 2 + c/src/exec/rtems/macros/attr.inl | 2 + c/src/exec/rtems/macros/rtems/rtems/attr.inl | 2 + c/src/exec/rtems/optman/Makefile.in | 2 +- c/src/exec/rtems/optman/no-mp.c | 5 +- c/src/exec/rtems/src/Makefile.in | 10 ++- c/src/exec/rtems/src/dpmem.c | 18 +++-- c/src/exec/rtems/src/event.c | 10 ++- c/src/exec/rtems/src/msg.c | 99 ++++++++++++++++++------ c/src/exec/rtems/src/part.c | 42 +++++++--- c/src/exec/rtems/src/ratemon.c | 27 ++++--- c/src/exec/rtems/src/region.c | 37 ++++++--- c/src/exec/rtems/src/rtemstimer.c | 30 ++++--- c/src/exec/rtems/src/sem.c | 69 +++++++++++++++-- c/src/exec/rtems/src/signal.c | 11 ++- c/src/exec/rtems/src/tasks.c | 97 +++++++++++++++++------ c/src/exec/rtems/src/timer.c | 30 ++++--- 38 files changed, 445 insertions(+), 126 deletions(-) (limited to 'c/src/exec/rtems') diff --git a/c/src/exec/rtems/headers/Makefile.in b/c/src/exec/rtems/headers/Makefile.in index adb4903db8..f5904f6d25 100644 --- a/c/src/exec/rtems/headers/Makefile.in +++ b/c/src/exec/rtems/headers/Makefile.in @@ -8,10 +8,14 @@ VPATH = @srcdir@ RTEMS_ROOT = @top_srcdir@ PROJECT_ROOT = @PROJECT_ROOT@ -H_PIECES=asr attr clock config dpmem event eventmp eventset \ - intr message modes mp msgmp options part partmp \ - ratemon region regionmp rtemsapi sem semmp signal signalmp status \ - support taskmp tasks timer types +# We only build multiprocessing related files if HAS_MP was defined +MP_PIECES_yes_V = eventmp mp msgmp partmp regionmp semmp signalmp taskmp +MP_PIECES = $(MP_PIECES_$(HAS_MP)_V) + +H_PIECES=asr attr clock config dpmem event eventset \ + intr message modes options part \ + ratemon region rtemsapi sem signal status \ + support tasks timer types $(MP_PIECES) H_FILES=$(H_PIECES:%=$(srcdir)/%.h) # H_FILES that get installed externally diff --git a/c/src/exec/rtems/headers/event.h b/c/src/exec/rtems/headers/event.h index 48045bdade..576b1edbff 100644 --- a/c/src/exec/rtems/headers/event.h +++ b/c/src/exec/rtems/headers/event.h @@ -161,7 +161,9 @@ void _Event_Timeout ( RTEMS_EXTERN volatile Event_Sync_states _Event_Sync_state; +#if defined(RTEMS_MULTIPROCESSING) #include +#endif #ifndef __RTEMS_APPLICATION__ #include #endif diff --git a/c/src/exec/rtems/headers/message.h b/c/src/exec/rtems/headers/message.h index 611d46fde8..283381eecc 100644 --- a/c/src/exec/rtems/headers/message.h +++ b/c/src/exec/rtems/headers/message.h @@ -316,15 +316,19 @@ rtems_status_code _Message_queue_Translate_core_message_queue_return_code ( * Output parameters: NONE */ +#if defined(RTEMS_MULTIPROCESSING) void _Message_queue_Core_message_queue_mp_support ( Thread_Control *the_thread, Objects_Id id ); +#endif #ifndef __RTEMS_APPLICATION__ #include #endif +#if defined(RTEMS_MULTIPROCESSING) #include +#endif #ifdef __cplusplus } diff --git a/c/src/exec/rtems/headers/part.h b/c/src/exec/rtems/headers/part.h index 1d720db146..884c9a5426 100644 --- a/c/src/exec/rtems/headers/part.h +++ b/c/src/exec/rtems/headers/part.h @@ -158,7 +158,9 @@ rtems_status_code rtems_partition_return_buffer( #ifndef __RTEMS_APPLICATION__ #include #endif +#if defined(RTEMS_MULTIPROCESSING) #include +#endif #ifdef __cplusplus } diff --git a/c/src/exec/rtems/headers/region.h b/c/src/exec/rtems/headers/region.h index 05418f6a95..93f279fcb5 100644 --- a/c/src/exec/rtems/headers/region.h +++ b/c/src/exec/rtems/headers/region.h @@ -201,7 +201,9 @@ rtems_status_code rtems_region_return_segment( #ifndef __RTEMS_APPLICATION__ #include #endif +#if defined(RTEMS_MULTIPROCESSING) #include +#endif /* * _Region_Debug_Walk diff --git a/c/src/exec/rtems/headers/rtems.h b/c/src/exec/rtems/headers/rtems.h index 9a165c08dd..01c0b8478b 100644 --- a/c/src/exec/rtems/headers/rtems.h +++ b/c/src/exec/rtems/headers/rtems.h @@ -57,7 +57,9 @@ extern "C" { #include #include #include +#if defined(RTEMS_MULTIPROCESSING) #include +#endif #include #include diff --git a/c/src/exec/rtems/headers/sem.h b/c/src/exec/rtems/headers/sem.h index 191e62b414..96ae149192 100644 --- a/c/src/exec/rtems/headers/sem.h +++ b/c/src/exec/rtems/headers/sem.h @@ -214,10 +214,12 @@ rtems_status_code _Semaphore_Translate_core_semaphore_return_code ( * is called by the core. */ +#if defined(RTEMS_MULTIPROCESSING) void _Semaphore_Core_mutex_mp_support ( Thread_Control *the_thread, rtems_id id ); +#endif /*PAGE * @@ -238,7 +240,9 @@ void _Semaphore_Core_semaphore_mp_support ( #ifndef __RTEMS_APPLICATION__ #include #endif +#if defined(RTEMS_MULTIPROCESSING) #include +#endif #ifdef __cplusplus } diff --git a/c/src/exec/rtems/headers/signal.h b/c/src/exec/rtems/headers/signal.h index 2b247762e9..c9424a2dfd 100644 --- a/c/src/exec/rtems/headers/signal.h +++ b/c/src/exec/rtems/headers/signal.h @@ -73,7 +73,9 @@ rtems_status_code rtems_signal_send( rtems_signal_set signal_set ); +#if defined(RTEMS_MULTIPROCESSING) #include +#endif #ifdef __cplusplus } diff --git a/c/src/exec/rtems/headers/tasks.h b/c/src/exec/rtems/headers/tasks.h index 17730cee7f..82506a5409 100644 --- a/c/src/exec/rtems/headers/tasks.h +++ b/c/src/exec/rtems/headers/tasks.h @@ -411,7 +411,9 @@ void _RTEMS_tasks_Initialize_user_tasks( void ); #ifndef __RTEMS_APPLICATION__ #include #endif +#if defined(RTEMS_MULTIPROCESSING) #include +#endif #ifdef __cplusplus } diff --git a/c/src/exec/rtems/headers/types.h b/c/src/exec/rtems/headers/types.h index 4d2915bafa..10165a6180 100644 --- a/c/src/exec/rtems/headers/types.h +++ b/c/src/exec/rtems/headers/types.h @@ -22,9 +22,13 @@ extern "C" { #include #include +#include +#include #include +#if defined(RTEMS_MULTIPROCESSING) #include #include +#endif /* * RTEMS basic type definitions @@ -75,6 +79,7 @@ typedef Modes_Control rtems_mode; * MPCI related entries */ +#if defined(RTEMS_MULTIPROCESSING) typedef MP_packet_Classes rtems_mp_packet_classes; typedef MP_packet_Prefix rtems_packet_prefix; @@ -87,6 +92,7 @@ typedef MPCI_receive_entry rtems_mpci_receive_packet_entry; typedef MPCI_Entry rtems_mpci_entry; typedef MPCI_Control rtems_mpci_table; +#endif #ifdef __cplusplus } diff --git a/c/src/exec/rtems/include/rtems.h b/c/src/exec/rtems/include/rtems.h index 9a165c08dd..01c0b8478b 100644 --- a/c/src/exec/rtems/include/rtems.h +++ b/c/src/exec/rtems/include/rtems.h @@ -57,7 +57,9 @@ extern "C" { #include #include #include +#if defined(RTEMS_MULTIPROCESSING) #include +#endif #include #include diff --git a/c/src/exec/rtems/include/rtems/rtems/Makefile.in b/c/src/exec/rtems/include/rtems/rtems/Makefile.in index adb4903db8..f5904f6d25 100644 --- a/c/src/exec/rtems/include/rtems/rtems/Makefile.in +++ b/c/src/exec/rtems/include/rtems/rtems/Makefile.in @@ -8,10 +8,14 @@ VPATH = @srcdir@ RTEMS_ROOT = @top_srcdir@ PROJECT_ROOT = @PROJECT_ROOT@ -H_PIECES=asr attr clock config dpmem event eventmp eventset \ - intr message modes mp msgmp options part partmp \ - ratemon region regionmp rtemsapi sem semmp signal signalmp status \ - support taskmp tasks timer types +# We only build multiprocessing related files if HAS_MP was defined +MP_PIECES_yes_V = eventmp mp msgmp partmp regionmp semmp signalmp taskmp +MP_PIECES = $(MP_PIECES_$(HAS_MP)_V) + +H_PIECES=asr attr clock config dpmem event eventset \ + intr message modes options part \ + ratemon region rtemsapi sem signal status \ + support tasks timer types $(MP_PIECES) H_FILES=$(H_PIECES:%=$(srcdir)/%.h) # H_FILES that get installed externally diff --git a/c/src/exec/rtems/include/rtems/rtems/event.h b/c/src/exec/rtems/include/rtems/rtems/event.h index 48045bdade..576b1edbff 100644 --- a/c/src/exec/rtems/include/rtems/rtems/event.h +++ b/c/src/exec/rtems/include/rtems/rtems/event.h @@ -161,7 +161,9 @@ void _Event_Timeout ( RTEMS_EXTERN volatile Event_Sync_states _Event_Sync_state; +#if defined(RTEMS_MULTIPROCESSING) #include +#endif #ifndef __RTEMS_APPLICATION__ #include #endif diff --git a/c/src/exec/rtems/include/rtems/rtems/message.h b/c/src/exec/rtems/include/rtems/rtems/message.h index 611d46fde8..283381eecc 100644 --- a/c/src/exec/rtems/include/rtems/rtems/message.h +++ b/c/src/exec/rtems/include/rtems/rtems/message.h @@ -316,15 +316,19 @@ rtems_status_code _Message_queue_Translate_core_message_queue_return_code ( * Output parameters: NONE */ +#if defined(RTEMS_MULTIPROCESSING) void _Message_queue_Core_message_queue_mp_support ( Thread_Control *the_thread, Objects_Id id ); +#endif #ifndef __RTEMS_APPLICATION__ #include #endif +#if defined(RTEMS_MULTIPROCESSING) #include +#endif #ifdef __cplusplus } diff --git a/c/src/exec/rtems/include/rtems/rtems/part.h b/c/src/exec/rtems/include/rtems/rtems/part.h index 1d720db146..884c9a5426 100644 --- a/c/src/exec/rtems/include/rtems/rtems/part.h +++ b/c/src/exec/rtems/include/rtems/rtems/part.h @@ -158,7 +158,9 @@ rtems_status_code rtems_partition_return_buffer( #ifndef __RTEMS_APPLICATION__ #include #endif +#if defined(RTEMS_MULTIPROCESSING) #include +#endif #ifdef __cplusplus } diff --git a/c/src/exec/rtems/include/rtems/rtems/region.h b/c/src/exec/rtems/include/rtems/rtems/region.h index 05418f6a95..93f279fcb5 100644 --- a/c/src/exec/rtems/include/rtems/rtems/region.h +++ b/c/src/exec/rtems/include/rtems/rtems/region.h @@ -201,7 +201,9 @@ rtems_status_code rtems_region_return_segment( #ifndef __RTEMS_APPLICATION__ #include #endif +#if defined(RTEMS_MULTIPROCESSING) #include +#endif /* * _Region_Debug_Walk diff --git a/c/src/exec/rtems/include/rtems/rtems/sem.h b/c/src/exec/rtems/include/rtems/rtems/sem.h index 191e62b414..96ae149192 100644 --- a/c/src/exec/rtems/include/rtems/rtems/sem.h +++ b/c/src/exec/rtems/include/rtems/rtems/sem.h @@ -214,10 +214,12 @@ rtems_status_code _Semaphore_Translate_core_semaphore_return_code ( * is called by the core. */ +#if defined(RTEMS_MULTIPROCESSING) void _Semaphore_Core_mutex_mp_support ( Thread_Control *the_thread, rtems_id id ); +#endif /*PAGE * @@ -238,7 +240,9 @@ void _Semaphore_Core_semaphore_mp_support ( #ifndef __RTEMS_APPLICATION__ #include #endif +#if defined(RTEMS_MULTIPROCESSING) #include +#endif #ifdef __cplusplus } diff --git a/c/src/exec/rtems/include/rtems/rtems/signal.h b/c/src/exec/rtems/include/rtems/rtems/signal.h index 2b247762e9..c9424a2dfd 100644 --- a/c/src/exec/rtems/include/rtems/rtems/signal.h +++ b/c/src/exec/rtems/include/rtems/rtems/signal.h @@ -73,7 +73,9 @@ rtems_status_code rtems_signal_send( rtems_signal_set signal_set ); +#if defined(RTEMS_MULTIPROCESSING) #include +#endif #ifdef __cplusplus } diff --git a/c/src/exec/rtems/include/rtems/rtems/tasks.h b/c/src/exec/rtems/include/rtems/rtems/tasks.h index 17730cee7f..82506a5409 100644 --- a/c/src/exec/rtems/include/rtems/rtems/tasks.h +++ b/c/src/exec/rtems/include/rtems/rtems/tasks.h @@ -411,7 +411,9 @@ void _RTEMS_tasks_Initialize_user_tasks( void ); #ifndef __RTEMS_APPLICATION__ #include #endif +#if defined(RTEMS_MULTIPROCESSING) #include +#endif #ifdef __cplusplus } diff --git a/c/src/exec/rtems/include/rtems/rtems/types.h b/c/src/exec/rtems/include/rtems/rtems/types.h index 4d2915bafa..10165a6180 100644 --- a/c/src/exec/rtems/include/rtems/rtems/types.h +++ b/c/src/exec/rtems/include/rtems/rtems/types.h @@ -22,9 +22,13 @@ extern "C" { #include #include +#include +#include #include +#if defined(RTEMS_MULTIPROCESSING) #include #include +#endif /* * RTEMS basic type definitions @@ -75,6 +79,7 @@ typedef Modes_Control rtems_mode; * MPCI related entries */ +#if defined(RTEMS_MULTIPROCESSING) typedef MP_packet_Classes rtems_mp_packet_classes; typedef MP_packet_Prefix rtems_packet_prefix; @@ -87,6 +92,7 @@ typedef MPCI_receive_entry rtems_mpci_receive_packet_entry; typedef MPCI_Entry rtems_mpci_entry; typedef MPCI_Control rtems_mpci_table; +#endif #ifdef __cplusplus } diff --git a/c/src/exec/rtems/inline/attr.inl b/c/src/exec/rtems/inline/attr.inl index 3cec1edd3b..df4e8650b5 100644 --- a/c/src/exec/rtems/inline/attr.inl +++ b/c/src/exec/rtems/inline/attr.inl @@ -80,12 +80,14 @@ RTEMS_INLINE_ROUTINE boolean _Attributes_Is_floating_point( * enabled in the attribute_set and FALSE otherwise. */ +#if defined(RTEMS_MULTIPROCESSING) RTEMS_INLINE_ROUTINE boolean _Attributes_Is_global( rtems_attribute attribute_set ) { return ( attribute_set & RTEMS_GLOBAL ); } +#endif /*PAGE * diff --git a/c/src/exec/rtems/inline/rtems/rtems/attr.inl b/c/src/exec/rtems/inline/rtems/rtems/attr.inl index 3cec1edd3b..df4e8650b5 100644 --- a/c/src/exec/rtems/inline/rtems/rtems/attr.inl +++ b/c/src/exec/rtems/inline/rtems/rtems/attr.inl @@ -80,12 +80,14 @@ RTEMS_INLINE_ROUTINE boolean _Attributes_Is_floating_point( * enabled in the attribute_set and FALSE otherwise. */ +#if defined(RTEMS_MULTIPROCESSING) RTEMS_INLINE_ROUTINE boolean _Attributes_Is_global( rtems_attribute attribute_set ) { return ( attribute_set & RTEMS_GLOBAL ); } +#endif /*PAGE * diff --git a/c/src/exec/rtems/macros/attr.inl b/c/src/exec/rtems/macros/attr.inl index 290e7f7870..2d8303db11 100644 --- a/c/src/exec/rtems/macros/attr.inl +++ b/c/src/exec/rtems/macros/attr.inl @@ -48,8 +48,10 @@ * */ +#if defined(RTEMS_MULTIPROCESSING) #define _Attributes_Is_global( _attribute_set ) \ ( (_attribute_set) & RTEMS_GLOBAL ) +#endif /*PAGE * diff --git a/c/src/exec/rtems/macros/rtems/rtems/attr.inl b/c/src/exec/rtems/macros/rtems/rtems/attr.inl index 290e7f7870..2d8303db11 100644 --- a/c/src/exec/rtems/macros/rtems/rtems/attr.inl +++ b/c/src/exec/rtems/macros/rtems/rtems/attr.inl @@ -48,8 +48,10 @@ * */ +#if defined(RTEMS_MULTIPROCESSING) #define _Attributes_Is_global( _attribute_set ) \ ( (_attribute_set) & RTEMS_GLOBAL ) +#endif /*PAGE * diff --git a/c/src/exec/rtems/optman/Makefile.in b/c/src/exec/rtems/optman/Makefile.in index 41d7274161..d674921aba 100644 --- a/c/src/exec/rtems/optman/Makefile.in +++ b/c/src/exec/rtems/optman/Makefile.in @@ -8,7 +8,7 @@ VPATH = @srcdir@ RTEMS_ROOT = @top_srcdir@ PROJECT_ROOT = @PROJECT_ROOT@ -C_FILES= no-dpmem.c no-event.c no-mp.c no-msg.c \ +C_FILES= no-dpmem.c no-event.c no-msg.c no-mp.c \ no-part.c no-region.c no-rtmon.c no-sem.c no-signal.c no-timer.c S_FILES= diff --git a/c/src/exec/rtems/optman/no-mp.c b/c/src/exec/rtems/optman/no-mp.c index 71c38826f3..41fa81e597 100644 --- a/c/src/exec/rtems/optman/no-mp.c +++ b/c/src/exec/rtems/optman/no-mp.c @@ -14,6 +14,9 @@ */ #include +#if !defined(RTEMS_MULTIPROCESSING) +char rtems_no_multiprocessing; +#else #include #include #include @@ -197,5 +200,5 @@ MPCI_Internal_packet *_MPCI_Internal_packets_Get_packet ( void ) ); return NULL; } - +#endif /* end of file */ diff --git a/c/src/exec/rtems/src/Makefile.in b/c/src/exec/rtems/src/Makefile.in index cfab26e662..fe68ccbe2d 100644 --- a/c/src/exec/rtems/src/Makefile.in +++ b/c/src/exec/rtems/src/Makefile.in @@ -8,9 +8,13 @@ VPATH = @srcdir@ RTEMS_ROOT = @top_srcdir@ PROJECT_ROOT = @PROJECT_ROOT@ -C_PIECES=attr clock dpmem event eventmp intr intrbody mp msg msgmp \ - part partmp ratemon region regionmp sem semmp signal signalmp \ - taskmp tasks timer +# We only build multiprocessing related files if HAS_MP was defined +MP_PIECES_yes_V = eventmp mp msgmp partmp regionmp semmp signalmp taskmp +MP_PIECES = $(MP_PIECES_$(HAS_MP)_V) + +C_PIECES=attr clock dpmem event intr intrbody msg \ + part ratemon region sem signal \ + tasks timer $(MP_PIECES) C_FILES=$(C_PIECES:%=%.c) C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) diff --git a/c/src/exec/rtems/src/dpmem.c b/c/src/exec/rtems/src/dpmem.c index 9cc778df82..cb9ed3fa4d 100644 --- a/c/src/exec/rtems/src/dpmem.c +++ b/c/src/exec/rtems/src/dpmem.c @@ -168,10 +168,12 @@ rtems_status_code rtems_port_delete( the_port = _Dual_ported_memory_Get( id, &location ); switch ( location ) { - case OBJECTS_ERROR: - return RTEMS_INVALID_ID; case OBJECTS_REMOTE: /* this error cannot be returned */ return RTEMS_INTERNAL_ERROR; + + case OBJECTS_ERROR: + return RTEMS_INVALID_ID; + case OBJECTS_LOCAL: _Objects_Close( &_Dual_ported_memory_Information, &the_port->Object ); _Dual_ported_memory_Free( the_port ); @@ -213,10 +215,12 @@ rtems_status_code rtems_port_internal_to_external( the_port = _Dual_ported_memory_Get( id, &location ); switch ( location ) { - case OBJECTS_ERROR: - return RTEMS_INVALID_ID; case OBJECTS_REMOTE: /* this error cannot be returned */ return RTEMS_INTERNAL_ERROR; + + case OBJECTS_ERROR: + return RTEMS_INVALID_ID; + case OBJECTS_LOCAL: ending = _Addresses_Subtract( internal, the_port->internal_base ); if ( ending > the_port->length ) @@ -262,10 +266,12 @@ rtems_status_code rtems_port_external_to_internal( the_port = _Dual_ported_memory_Get( id, &location ); switch ( location ) { - case OBJECTS_ERROR: - return RTEMS_INVALID_ID; case OBJECTS_REMOTE: /* this error cannot be returned */ return RTEMS_INTERNAL_ERROR; + + case OBJECTS_ERROR: + return RTEMS_INVALID_ID; + case OBJECTS_LOCAL: ending = _Addresses_Subtract( external, the_port->external_base ); if ( ending > the_port->length ) diff --git a/c/src/exec/rtems/src/event.c b/c/src/exec/rtems/src/event.c index a780ba7cf7..36c345ca8c 100644 --- a/c/src/exec/rtems/src/event.c +++ b/c/src/exec/rtems/src/event.c @@ -39,7 +39,9 @@ void _Event_Manager_initialization( void ) * Register the MP Process Packet routine. */ +#if defined(RTEMS_MULTIPROCESSING) _MPCI_Register_packet_processor( MP_PACKET_EVENT, _Event_MP_Process_packet ); +#endif } /*PAGE @@ -68,9 +70,8 @@ rtems_status_code rtems_event_send( the_thread = _Thread_Get( id, &location ); switch ( location ) { - case OBJECTS_ERROR: - return RTEMS_INVALID_ID; case OBJECTS_REMOTE: +#if defined(RTEMS_MULTIPROCESSING) return( _Event_MP_Send_request_packet( EVENT_MP_SEND_REQUEST, @@ -78,6 +79,9 @@ rtems_status_code rtems_event_send( event_in ) ); +#endif + case OBJECTS_ERROR: + return RTEMS_INVALID_ID; case OBJECTS_LOCAL: api = the_thread->API_Extensions[ THREAD_API_RTEMS ]; _Event_sets_Post( event_in, &api->pending_events ); @@ -352,8 +356,8 @@ void _Event_Timeout( the_thread = _Thread_Get( id, &location ); switch ( location ) { - case OBJECTS_ERROR: case OBJECTS_REMOTE: /* impossible */ + case OBJECTS_ERROR: break; case OBJECTS_LOCAL: diff --git a/c/src/exec/rtems/src/msg.c b/c/src/exec/rtems/src/msg.c index f49e1cac21..7681bd52d6 100644 --- a/c/src/exec/rtems/src/msg.c +++ b/c/src/exec/rtems/src/msg.c @@ -22,7 +22,9 @@ #include #include #include +#if defined(RTEMS_MULTIPROCESSING) #include +#endif #include #include #include @@ -61,10 +63,12 @@ void _Message_queue_Manager_initialization( * Register the MP Process Packet routine. */ +#if defined(RTEMS_MULTIPROCESSING) _MPCI_Register_packet_processor( MP_PACKET_MESSAGE_QUEUE, _Message_queue_MP_Process_packet ); +#endif } @@ -123,14 +127,19 @@ rtems_status_code rtems_message_queue_create( { register Message_queue_Control *the_message_queue; CORE_message_queue_Attributes the_message_queue_attributes; + void *handler; +#if defined(RTEMS_MULTIPROCESSING) boolean is_global; +#endif if ( !rtems_is_name_valid( name ) ) return RTEMS_INVALID_NAME; +#if defined(RTEMS_MULTIPROCESSING) if ( (is_global = _Attributes_Is_global( attribute_set ) ) && !_System_state_Is_multiprocessing ) return RTEMS_MP_NOT_CONFIGURED; +#endif if (count == 0) return RTEMS_INVALID_NUMBER; @@ -138,6 +147,7 @@ rtems_status_code rtems_message_queue_create( if (max_message_size == 0) return RTEMS_INVALID_SIZE; +#if defined(RTEMS_MULTIPROCESSING) #if 1 /* * I am not 100% sure this should be an error. @@ -147,7 +157,7 @@ rtems_status_code rtems_message_queue_create( if ( is_global && (_MPCI_table->maximum_packet_size < max_message_size) ) return RTEMS_INVALID_SIZE; - +#endif #endif _Thread_Disable_dispatch(); /* protects object pointer */ @@ -159,6 +169,7 @@ rtems_status_code rtems_message_queue_create( return RTEMS_TOO_MANY; } +#if defined(RTEMS_MULTIPROCESSING) if ( is_global && !( _Objects_MP_Allocate_and_open( &_Message_queue_Information, name, the_message_queue->Object.id, FALSE ) ) ) { @@ -166,6 +177,7 @@ rtems_status_code rtems_message_queue_create( _Thread_Enable_dispatch(); return RTEMS_TOO_MANY; } +#endif the_message_queue->attribute_set = attribute_set; @@ -176,16 +188,23 @@ rtems_status_code rtems_message_queue_create( the_message_queue_attributes.discipline = CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO; + handler = NULL; +#if defined(RTEMS_MULTIPROCESSING) + handler = _Message_queue_MP_Send_extract_proxy; +#endif + if ( ! _CORE_message_queue_Initialize( &the_message_queue->message_queue, OBJECTS_RTEMS_MESSAGE_QUEUES, &the_message_queue_attributes, count, max_message_size, - _Message_queue_MP_Send_extract_proxy ) ) { + handler ) ) { +#if defined(RTEMS_MULTIPROCESSING) if ( is_global ) _Objects_MP_Close( &_Message_queue_Information, the_message_queue->Object.id); +#endif _Message_queue_Free( the_message_queue ); _Thread_Enable_dispatch(); @@ -200,6 +219,7 @@ rtems_status_code rtems_message_queue_create( *id = the_message_queue->Object.id; +#if defined(RTEMS_MULTIPROCESSING) if ( is_global ) _Message_queue_MP_Send_process_packet( MESSAGE_QUEUE_MP_ANNOUNCE_CREATE, @@ -207,6 +227,7 @@ rtems_status_code rtems_message_queue_create( name, 0 ); +#endif _Thread_Enable_dispatch(); return RTEMS_SUCCESSFUL; @@ -272,23 +293,31 @@ rtems_status_code rtems_message_queue_delete( the_message_queue = _Message_queue_Get( id, &location ); switch ( location ) { - case OBJECTS_ERROR: - return RTEMS_INVALID_ID; + case OBJECTS_REMOTE: +#if defined(RTEMS_MULTIPROCESSING) _Thread_Dispatch(); return RTEMS_ILLEGAL_ON_REMOTE_OBJECT; +#endif + + case OBJECTS_ERROR: + return RTEMS_INVALID_ID; + case OBJECTS_LOCAL: _Objects_Close( &_Message_queue_Information, &the_message_queue->Object ); +#if defined(RTEMS_MULTIPROCESSING) _CORE_message_queue_Close( &the_message_queue->message_queue, _Message_queue_MP_Send_object_was_deleted, CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED ); +#endif _Message_queue_Free( the_message_queue ); +#if defined(RTEMS_MULTIPROCESSING) if ( _Attributes_Is_global( the_message_queue->attribute_set ) ) { _Objects_MP_Close( &_Message_queue_Information, @@ -302,6 +331,7 @@ rtems_status_code rtems_message_queue_delete( 0 ); } +#endif _Thread_Enable_dispatch(); return RTEMS_SUCCESSFUL; @@ -394,9 +424,8 @@ rtems_status_code rtems_message_queue_broadcast( the_message_queue = _Message_queue_Get( id, &location ); switch ( location ) { - case OBJECTS_ERROR: - return RTEMS_INVALID_ID; case OBJECTS_REMOTE: +#if defined(RTEMS_MULTIPROCESSING) _Thread_Executing->Wait.return_argument = count; return @@ -408,6 +437,10 @@ rtems_status_code rtems_message_queue_broadcast( 0, /* option_set not used */ MPCI_DEFAULT_TIMEOUT ); +#endif + + case OBJECTS_ERROR: + return RTEMS_INVALID_ID; case OBJECTS_LOCAL: core_status = _CORE_message_queue_Broadcast( @@ -415,7 +448,11 @@ rtems_status_code rtems_message_queue_broadcast( buffer, size, id, +#if defined(RTEMS_MULTIPROCESSING) _Message_queue_Core_message_queue_mp_support, +#else + NULL, +#endif count ); @@ -461,10 +498,8 @@ rtems_status_code rtems_message_queue_receive( the_message_queue = _Message_queue_Get( id, &location ); switch ( location ) { - case OBJECTS_ERROR: - return RTEMS_INVALID_ID; - case OBJECTS_REMOTE: +#if defined(RTEMS_MULTIPROCESSING) return _Message_queue_MP_Send_request_packet( MESSAGE_QUEUE_MP_RECEIVE_REQUEST, id, @@ -473,6 +508,10 @@ rtems_status_code rtems_message_queue_receive( option_set, timeout ); +#endif + + case OBJECTS_ERROR: + return RTEMS_INVALID_ID; case OBJECTS_LOCAL: if ( _Options_Is_no_wait( option_set ) ) @@ -525,9 +564,8 @@ rtems_status_code rtems_message_queue_flush( the_message_queue = _Message_queue_Get( id, &location ); switch ( location ) { - case OBJECTS_ERROR: - return RTEMS_INVALID_ID; case OBJECTS_REMOTE: +#if defined(RTEMS_MULTIPROCESSING) _Thread_Executing->Wait.return_argument = count; return @@ -539,6 +577,10 @@ rtems_status_code rtems_message_queue_flush( 0, /* option_set not used */ MPCI_DEFAULT_TIMEOUT ); +#endif + + case OBJECTS_ERROR: + return RTEMS_INVALID_ID; case OBJECTS_LOCAL: *count = _CORE_message_queue_Flush( &the_message_queue->message_queue ); @@ -575,13 +617,11 @@ rtems_status_code rtems_message_queue_get_number_pending( the_message_queue = _Message_queue_Get( id, &location ); switch ( location ) { - case OBJECTS_ERROR: - return RTEMS_INVALID_ID; case OBJECTS_REMOTE: +#if defined(RTEMS_MULTIPROCESSING) _Thread_Executing->Wait.return_argument = count; - return - _Message_queue_MP_Send_request_packet( + return _Message_queue_MP_Send_request_packet( MESSAGE_QUEUE_MP_GET_NUMBER_PENDING_REQUEST, id, 0, /* buffer not used */ @@ -589,6 +629,10 @@ rtems_status_code rtems_message_queue_get_number_pending( 0, /* option_set not used */ MPCI_DEFAULT_TIMEOUT ); +#endif + + case OBJECTS_ERROR: + return RTEMS_INVALID_ID; case OBJECTS_LOCAL: *count = the_message_queue->message_queue.number_of_pending_messages; @@ -635,14 +679,11 @@ rtems_status_code _Message_queue_Submit( the_message_queue = _Message_queue_Get( id, &location ); switch ( location ) { - case OBJECTS_ERROR: - return RTEMS_INVALID_ID; - case OBJECTS_REMOTE: +#if defined(RTEMS_MULTIPROCESSING) switch ( submit_type ) { case MESSAGE_QUEUE_SEND_REQUEST: - return - _Message_queue_MP_Send_request_packet( + return _Message_queue_MP_Send_request_packet( MESSAGE_QUEUE_MP_SEND_REQUEST, id, buffer, @@ -652,8 +693,7 @@ rtems_status_code _Message_queue_Submit( ); case MESSAGE_QUEUE_URGENT_REQUEST: - return - _Message_queue_MP_Send_request_packet( + return _Message_queue_MP_Send_request_packet( MESSAGE_QUEUE_MP_URGENT_REQUEST, id, buffer, @@ -662,6 +702,11 @@ rtems_status_code _Message_queue_Submit( MPCI_DEFAULT_TIMEOUT ); } + break; +#endif + + case OBJECTS_ERROR: + return RTEMS_INVALID_ID; case OBJECTS_LOCAL: switch ( submit_type ) { @@ -671,7 +716,11 @@ rtems_status_code _Message_queue_Submit( buffer, size, id, +#if defined(RTEMS_MULTIPROCESSING) _Message_queue_Core_message_queue_mp_support +#else + NULL +#endif ); break; case MESSAGE_QUEUE_URGENT_REQUEST: @@ -680,7 +729,11 @@ rtems_status_code _Message_queue_Submit( buffer, size, id, +#if defined(RTEMS_MULTIPROCESSING) _Message_queue_Core_message_queue_mp_support +#else + NULL +#endif ); break; default: @@ -749,6 +802,7 @@ rtems_status_code _Message_queue_Translate_core_message_queue_return_code ( * Output parameters: NONE */ +#if defined(RTEMS_MULTIPROCESSING) void _Message_queue_Core_message_queue_mp_support ( Thread_Control *the_thread, Objects_Id id @@ -762,3 +816,4 @@ void _Message_queue_Core_message_queue_mp_support ( the_thread ); } +#endif diff --git a/c/src/exec/rtems/src/part.c b/c/src/exec/rtems/src/part.c index 0698f0db71..4417db10cb 100644 --- a/c/src/exec/rtems/src/part.c +++ b/c/src/exec/rtems/src/part.c @@ -54,10 +54,12 @@ void _Partition_Manager_initialization( * Register the MP Process Packet routine. */ +#if defined(RTEMS_MULTIPROCESSING) _MPCI_Register_packet_processor( MP_PACKET_PARTITION, _Partition_MP_Process_packet ); +#endif } @@ -103,9 +105,11 @@ rtems_status_code rtems_partition_create( if ( !_Addresses_Is_aligned( starting_address ) ) return RTEMS_INVALID_ADDRESS; +#if defined(RTEMS_MULTIPROCESSING) if ( _Attributes_Is_global( attribute_set ) && !_System_state_Is_multiprocessing ) return RTEMS_MP_NOT_CONFIGURED; +#endif _Thread_Disable_dispatch(); /* prevents deletion */ @@ -116,6 +120,7 @@ rtems_status_code rtems_partition_create( return RTEMS_TOO_MANY; } +#if defined(RTEMS_MULTIPROCESSING) if ( _Attributes_Is_global( attribute_set ) && !( _Objects_MP_Allocate_and_open( &_Partition_Information, name, the_partition->Object.id, FALSE ) ) ) { @@ -123,6 +128,8 @@ rtems_status_code rtems_partition_create( _Thread_Enable_dispatch(); return RTEMS_TOO_MANY; } +#endif + the_partition->starting_address = starting_address; the_partition->length = length; the_partition->buffer_size = buffer_size; @@ -135,6 +142,7 @@ rtems_status_code rtems_partition_create( _Objects_Open( &_Partition_Information, &the_partition->Object, &name ); *id = the_partition->Object.id; +#if defined(RTEMS_MULTIPROCESSING) if ( _Attributes_Is_global( attribute_set ) ) _Partition_MP_Send_process_packet( PARTITION_MP_ANNOUNCE_CREATE, @@ -142,6 +150,7 @@ rtems_status_code rtems_partition_create( name, 0 /* Not used */ ); +#endif _Thread_Enable_dispatch(); return RTEMS_SUCCESSFUL; @@ -203,15 +212,20 @@ rtems_status_code rtems_partition_delete( the_partition = _Partition_Get( id, &location ); switch ( location ) { - case OBJECTS_ERROR: - return RTEMS_INVALID_ID; case OBJECTS_REMOTE: +#if defined(RTEMS_MULTIPROCESSING) _Thread_Dispatch(); return RTEMS_ILLEGAL_ON_REMOTE_OBJECT; +#endif + + case OBJECTS_ERROR: + return RTEMS_INVALID_ID; + case OBJECTS_LOCAL: if ( the_partition->number_of_used_blocks == 0 ) { _Objects_Close( &_Partition_Information, &the_partition->Object ); _Partition_Free( the_partition ); +#if defined(RTEMS_MULTIPROCESSING) if ( _Attributes_Is_global( the_partition->attribute_set ) ) { _Objects_MP_Close( @@ -226,6 +240,7 @@ rtems_status_code rtems_partition_delete( 0 /* Not used */ ); } +#endif _Thread_Enable_dispatch(); return RTEMS_SUCCESSFUL; @@ -264,9 +279,8 @@ rtems_status_code rtems_partition_get_buffer( the_partition = _Partition_Get( id, &location ); switch ( location ) { - case OBJECTS_ERROR: - return RTEMS_INVALID_ID; case OBJECTS_REMOTE: +#if defined(RTEMS_MULTIPROCESSING) _Thread_Executing->Wait.return_argument = buffer; return( _Partition_MP_Send_request_packet( @@ -275,6 +289,11 @@ rtems_status_code rtems_partition_get_buffer( 0 /* Not used */ ) ); +#endif + + case OBJECTS_ERROR: + return RTEMS_INVALID_ID; + case OBJECTS_LOCAL: the_buffer = _Partition_Allocate_buffer( the_partition ); if ( the_buffer ) { @@ -316,16 +335,19 @@ rtems_status_code rtems_partition_return_buffer( the_partition = _Partition_Get( id, &location ); switch ( location ) { - case OBJECTS_ERROR: - return RTEMS_INVALID_ID; + case OBJECTS_REMOTE: - return( - _Partition_MP_Send_request_packet( +#if defined(RTEMS_MULTIPROCESSING) + return _Partition_MP_Send_request_packet( PARTITION_MP_RETURN_BUFFER_REQUEST, id, buffer - ) - ); + ); +#endif + + case OBJECTS_ERROR: + return RTEMS_INVALID_ID; + case OBJECTS_LOCAL: if ( _Partition_Is_buffer_valid( buffer, the_partition ) ) { _Partition_Free_buffer( the_partition, buffer ); diff --git a/c/src/exec/rtems/src/ratemon.c b/c/src/exec/rtems/src/ratemon.c index ff9bb5bc21..6832aac593 100644 --- a/c/src/exec/rtems/src/ratemon.c +++ b/c/src/exec/rtems/src/ratemon.c @@ -156,10 +156,12 @@ rtems_status_code rtems_rate_monotonic_cancel( the_period = _Rate_monotonic_Get( id, &location ); switch ( location ) { - case OBJECTS_ERROR: - return RTEMS_INVALID_ID; case OBJECTS_REMOTE: return RTEMS_INTERNAL_ERROR; /* should never return this */ + + case OBJECTS_ERROR: + return RTEMS_INVALID_ID; + case OBJECTS_LOCAL: if ( !_Thread_Is_executing( the_period->owner ) ) { _Thread_Enable_dispatch(); @@ -197,10 +199,12 @@ rtems_status_code rtems_rate_monotonic_delete( the_period = _Rate_monotonic_Get( id, &location ); switch ( location ) { - case OBJECTS_ERROR: - return RTEMS_INVALID_ID; case OBJECTS_REMOTE: /* should never return this */ return RTEMS_INTERNAL_ERROR; + + case OBJECTS_ERROR: + return RTEMS_INVALID_ID; + case OBJECTS_LOCAL: _Objects_Close( &_Rate_monotonic_Information, &the_period->Object ); (void) _Watchdog_Remove( &the_period->Timer ); @@ -243,10 +247,12 @@ rtems_status_code rtems_rate_monotonic_get_status( the_period = _Rate_monotonic_Get( id, &location ); switch ( location ) { - case OBJECTS_ERROR: - return RTEMS_INVALID_ID; case OBJECTS_REMOTE: /* should never return this */ return RTEMS_INTERNAL_ERROR; + + case OBJECTS_ERROR: + return RTEMS_INVALID_ID; + case OBJECTS_LOCAL: status->state = the_period->state; @@ -298,10 +304,12 @@ rtems_status_code rtems_rate_monotonic_period( the_period = _Rate_monotonic_Get( id, &location ); switch ( location ) { - case OBJECTS_ERROR: - return RTEMS_INVALID_ID; case OBJECTS_REMOTE: /* should never return this */ return RTEMS_INTERNAL_ERROR; + + case OBJECTS_ERROR: + return RTEMS_INVALID_ID; + case OBJECTS_LOCAL: if ( !_Thread_Is_executing( the_period->owner ) ) { _Thread_Enable_dispatch(); @@ -431,9 +439,10 @@ void _Rate_monotonic_Timeout( the_period = _Rate_monotonic_Get( id, &location ); switch ( location ) { - case OBJECTS_ERROR: case OBJECTS_REMOTE: /* impossible */ + case OBJECTS_ERROR: break; + case OBJECTS_LOCAL: the_thread = the_period->owner; if ( _States_Is_waiting_for_period( the_thread->current_state ) && diff --git a/c/src/exec/rtems/src/region.c b/c/src/exec/rtems/src/region.c index c238bf51c5..14467c73da 100644 --- a/c/src/exec/rtems/src/region.c +++ b/c/src/exec/rtems/src/region.c @@ -53,10 +53,12 @@ void _Region_Manager_initialization( * Register the MP Process Packet routine. */ +#if defined(RTEMS_MULTIPROCESSING) _MPCI_Register_packet_processor( MP_PACKET_REGION, 0 /* XXX _Region_MP_Process_packet */ ); +#endif } @@ -128,7 +130,11 @@ rtems_status_code rtems_region_create( _Attributes_Is_priority( attribute_set ) ? THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO, STATES_WAITING_FOR_SEGMENT, +#if defined(RTEMS_MULTIPROCESSING) _Region_MP_Send_extract_proxy, +#else + NULL, +#endif RTEMS_TIMEOUT ); @@ -198,10 +204,12 @@ rtems_status_code rtems_region_delete( the_region = _Region_Get( id, &location ); switch ( location ) { - case OBJECTS_ERROR: - return RTEMS_INVALID_ID; case OBJECTS_REMOTE: /* this error cannot be returned */ return RTEMS_INTERNAL_ERROR; + + case OBJECTS_ERROR: + return RTEMS_INVALID_ID; + case OBJECTS_LOCAL: _Region_Debug_Walk( the_region, 5 ); if ( the_region->number_of_used_blocks == 0 ) { @@ -250,10 +258,12 @@ rtems_status_code rtems_region_extend( the_region = _Region_Get( id, &location ); switch ( location ) { - case OBJECTS_ERROR: - return RTEMS_INVALID_ID; case OBJECTS_REMOTE: /* this error cannot be returned */ return RTEMS_INTERNAL_ERROR; + + case OBJECTS_ERROR: + return RTEMS_INVALID_ID; + case OBJECTS_LOCAL: heap_status = _Heap_Extend( @@ -322,10 +332,12 @@ rtems_status_code rtems_region_get_segment( executing = _Thread_Executing; the_region = _Region_Get( id, &location ); switch ( location ) { - case OBJECTS_ERROR: - return RTEMS_INVALID_ID; case OBJECTS_REMOTE: /* this error cannot be returned */ return RTEMS_INTERNAL_ERROR; + + case OBJECTS_ERROR: + return RTEMS_INVALID_ID; + case OBJECTS_LOCAL: if ( size > the_region->maximum_segment_size ) { _Thread_Enable_dispatch(); @@ -395,10 +407,12 @@ rtems_status_code rtems_region_get_segment_size( executing = _Thread_Executing; the_region = _Region_Get( id, &location ); switch ( location ) { - case OBJECTS_ERROR: - return RTEMS_INVALID_ID; case OBJECTS_REMOTE: /* this error cannot be returned */ return RTEMS_INTERNAL_ERROR; + + case OBJECTS_ERROR: + return RTEMS_INVALID_ID; + case OBJECTS_LOCAL: if ( _Heap_Size_of_user_area( &the_region->Memory, segment, size ) ) { @@ -440,10 +454,13 @@ rtems_status_code rtems_region_return_segment( the_region = _Region_Get( id, &location ); switch ( location ) { - case OBJECTS_ERROR: - return RTEMS_INVALID_ID; + case OBJECTS_REMOTE: /* this error cannot be returned */ return RTEMS_INTERNAL_ERROR; + + case OBJECTS_ERROR: + return RTEMS_INVALID_ID; + case OBJECTS_LOCAL: _Region_Debug_Walk( the_region, 3 ); diff --git a/c/src/exec/rtems/src/rtemstimer.c b/c/src/exec/rtems/src/rtemstimer.c index 9d04686d40..9337df3a25 100644 --- a/c/src/exec/rtems/src/rtemstimer.c +++ b/c/src/exec/rtems/src/rtemstimer.c @@ -151,10 +151,12 @@ rtems_status_code rtems_timer_cancel( the_timer = _Timer_Get( id, &location ); switch ( location ) { - case OBJECTS_ERROR: - return RTEMS_INVALID_ID; case OBJECTS_REMOTE: /* should never return this */ return RTEMS_INTERNAL_ERROR; + + case OBJECTS_ERROR: + return RTEMS_INVALID_ID; + case OBJECTS_LOCAL: if ( !_Timer_Is_dormant_class( the_timer->the_class ) ) (void) _Watchdog_Remove( &the_timer->Ticker ); @@ -188,10 +190,12 @@ rtems_status_code rtems_timer_delete( the_timer = _Timer_Get( id, &location ); switch ( location ) { - case OBJECTS_ERROR: - return RTEMS_INVALID_ID; case OBJECTS_REMOTE: /* should never return this */ return RTEMS_INTERNAL_ERROR; + + case OBJECTS_ERROR: + return RTEMS_INVALID_ID; + case OBJECTS_LOCAL: _Objects_Close( &_Timer_Information, &the_timer->Object ); (void) _Watchdog_Remove( &the_timer->Ticker ); @@ -234,10 +238,12 @@ rtems_status_code rtems_timer_fire_after( the_timer = _Timer_Get( id, &location ); switch ( location ) { - case OBJECTS_ERROR: - return RTEMS_INVALID_ID; case OBJECTS_REMOTE: /* should never return this */ return RTEMS_INTERNAL_ERROR; + + case OBJECTS_ERROR: + return RTEMS_INVALID_ID; + case OBJECTS_LOCAL: (void) _Watchdog_Remove( &the_timer->Ticker ); the_timer->the_class = TIMER_INTERVAL; @@ -289,10 +295,12 @@ rtems_status_code rtems_timer_fire_when( the_timer = _Timer_Get( id, &location ); switch ( location ) { - case OBJECTS_ERROR: - return RTEMS_INVALID_ID; case OBJECTS_REMOTE: /* should never return this */ return RTEMS_INTERNAL_ERROR; + + case OBJECTS_ERROR: + return RTEMS_INVALID_ID; + case OBJECTS_LOCAL: (void) _Watchdog_Remove( &the_timer->Ticker ); the_timer->the_class = TIMER_TIME_OF_DAY; @@ -331,10 +339,12 @@ rtems_status_code rtems_timer_reset( the_timer = _Timer_Get( id, &location ); switch ( location ) { - case OBJECTS_ERROR: - return RTEMS_INVALID_ID; case OBJECTS_REMOTE: /* should never return this */ return RTEMS_INTERNAL_ERROR; + + case OBJECTS_ERROR: + return RTEMS_INVALID_ID; + case OBJECTS_LOCAL: if ( _Timer_Is_interval_class( the_timer->the_class ) ) { _Watchdog_Reset( &the_timer->Ticker ); diff --git a/c/src/exec/rtems/src/sem.c b/c/src/exec/rtems/src/sem.c index f1c1f1fbb9..31351dada1 100644 --- a/c/src/exec/rtems/src/sem.c +++ b/c/src/exec/rtems/src/sem.c @@ -39,7 +39,9 @@ #include #include #include +#if defined(RTEMS_MULTIPROCESSING) #include +#endif #include #include @@ -75,10 +77,12 @@ void _Semaphore_Manager_initialization( * Register the MP Process Packet routine. */ +#if defined(RTEMS_MULTIPROCESSING) _MPCI_Register_packet_processor( MP_PACKET_SEMAPHORE, _Semaphore_MP_Process_packet ); +#endif } @@ -118,6 +122,7 @@ rtems_status_code rtems_semaphore_create( if ( !rtems_is_name_valid( name ) ) return RTEMS_INVALID_NAME; +#if defined(RTEMS_MULTIPROCESSING) if ( _Attributes_Is_global( attribute_set ) ) { if ( !_System_state_Is_multiprocessing ) @@ -126,7 +131,9 @@ rtems_status_code rtems_semaphore_create( if ( _Attributes_Is_inherit_priority( attribute_set ) ) return RTEMS_NOT_DEFINED; - } else if ( _Attributes_Is_inherit_priority( attribute_set ) || + } else +#endif + if ( _Attributes_Is_inherit_priority( attribute_set ) || _Attributes_Is_priority_ceiling( attribute_set ) ) { if ( ! ( _Attributes_Is_binary_semaphore( attribute_set ) && @@ -147,6 +154,7 @@ rtems_status_code rtems_semaphore_create( return RTEMS_TOO_MANY; } +#if defined(RTEMS_MULTIPROCESSING) if ( _Attributes_Is_global( attribute_set ) && ! ( _Objects_MP_Allocate_and_open( &_Semaphore_Information, name, the_semaphore->Object.id, FALSE ) ) ) { @@ -154,6 +162,7 @@ rtems_status_code rtems_semaphore_create( _Thread_Enable_dispatch(); return RTEMS_TOO_MANY; } +#endif the_semaphore->attribute_set = attribute_set; @@ -183,7 +192,11 @@ rtems_status_code rtems_semaphore_create( OBJECTS_RTEMS_SEMAPHORES, &the_mutex_attributes, lock, +#if defined(RTEMS_MULTIPROCESSING) _Semaphore_MP_Send_extract_proxy +#else + NULL +#endif ); } else { @@ -204,7 +217,11 @@ rtems_status_code rtems_semaphore_create( OBJECTS_RTEMS_SEMAPHORES, &the_semaphore_attributes, count, +#if defined(RTEMS_MULTIPROCESSING) _Semaphore_MP_Send_extract_proxy +#else + NULL +#endif ); } @@ -212,6 +229,7 @@ rtems_status_code rtems_semaphore_create( *id = the_semaphore->Object.id; +#if defined(RTEMS_MULTIPROCESSING) if ( _Attributes_Is_global( attribute_set ) ) _Semaphore_MP_Send_process_packet( SEMAPHORE_MP_ANNOUNCE_CREATE, @@ -219,6 +237,7 @@ rtems_status_code rtems_semaphore_create( name, 0 /* Not used */ ); +#endif _Thread_Enable_dispatch(); return RTEMS_SUCCESSFUL; } @@ -279,11 +298,16 @@ rtems_status_code rtems_semaphore_delete( the_semaphore = _Semaphore_Get( id, &location ); switch ( location ) { - case OBJECTS_ERROR: - return RTEMS_INVALID_ID; + case OBJECTS_REMOTE: +#if defined(RTEMS_MULTIPROCESSING) _Thread_Dispatch(); return RTEMS_ILLEGAL_ON_REMOTE_OBJECT; +#endif + + case OBJECTS_ERROR: + return RTEMS_INVALID_ID; + case OBJECTS_LOCAL: if ( _Attributes_Is_binary_semaphore( the_semaphore->attribute_set) ) { if ( _CORE_mutex_Is_locked( &the_semaphore->Core_control.mutex ) ) { @@ -293,14 +317,22 @@ rtems_status_code rtems_semaphore_delete( else _CORE_mutex_Flush( &the_semaphore->Core_control.mutex, +#if defined(RTEMS_MULTIPROCESSING) _Semaphore_MP_Send_object_was_deleted, +#else + NULL, +#endif CORE_MUTEX_WAS_DELETED ); } else _CORE_semaphore_Flush( &the_semaphore->Core_control.semaphore, +#if defined(RTEMS_MULTIPROCESSING) _Semaphore_MP_Send_object_was_deleted, +#else + NULL, +#endif CORE_SEMAPHORE_WAS_DELETED ); @@ -308,6 +340,7 @@ rtems_status_code rtems_semaphore_delete( _Semaphore_Free( the_semaphore ); +#if defined(RTEMS_MULTIPROCESSING) if ( _Attributes_Is_global( the_semaphore->attribute_set ) ) { _Objects_MP_Close( &_Semaphore_Information, the_semaphore->Object.id ); @@ -319,6 +352,7 @@ rtems_status_code rtems_semaphore_delete( 0 /* Not used */ ); } +#endif _Thread_Enable_dispatch(); return RTEMS_SUCCESSFUL; } @@ -354,15 +388,19 @@ rtems_status_code rtems_semaphore_obtain( the_semaphore = _Semaphore_Get( id, &location ); switch ( location ) { - case OBJECTS_ERROR: - return RTEMS_INVALID_ID; case OBJECTS_REMOTE: +#if defined(RTEMS_MULTIPROCESSING) return _Semaphore_MP_Send_request_packet( SEMAPHORE_MP_OBTAIN_REQUEST, id, option_set, timeout ); +#endif + + case OBJECTS_ERROR: + return RTEMS_INVALID_ID; + case OBJECTS_LOCAL: if ( _Options_Is_no_wait( option_set ) ) wait = FALSE; @@ -420,21 +458,30 @@ rtems_status_code rtems_semaphore_release( the_semaphore = _Semaphore_Get( id, &location ); switch ( location ) { - case OBJECTS_ERROR: - return RTEMS_INVALID_ID; + case OBJECTS_REMOTE: +#if defined(RTEMS_MULTIPROCESSING) return _Semaphore_MP_Send_request_packet( SEMAPHORE_MP_RELEASE_REQUEST, id, 0, /* Not used */ MPCI_DEFAULT_TIMEOUT ); +#endif + + case OBJECTS_ERROR: + return RTEMS_INVALID_ID; + case OBJECTS_LOCAL: if ( _Attributes_Is_binary_semaphore( the_semaphore->attribute_set ) ) { mutex_status = _CORE_mutex_Surrender( &the_semaphore->Core_control.mutex, id, +#if defined(RTEMS_MULTIPROCESSING) _Semaphore_Core_mutex_mp_support +#else + NULL +#endif ); _Thread_Enable_dispatch(); return _Semaphore_Translate_core_mutex_return_code( mutex_status ); @@ -443,7 +490,11 @@ rtems_status_code rtems_semaphore_release( semaphore_status = _CORE_semaphore_Surrender( &the_semaphore->Core_control.semaphore, id, +#if defined(RTEMS_MULTIPROCESSING) _Semaphore_Core_semaphore_mp_support +#else + NULL +#endif ); _Thread_Enable_dispatch(); return @@ -530,6 +581,7 @@ rtems_status_code _Semaphore_Translate_core_semaphore_return_code ( * Output parameters: NONE */ +#if defined(RTEMS_MULTIPROCESSING) void _Semaphore_Core_mutex_mp_support ( Thread_Control *the_thread, Objects_Id id @@ -543,6 +595,7 @@ void _Semaphore_Core_mutex_mp_support ( the_thread ); } +#endif /*PAGE @@ -556,6 +609,7 @@ void _Semaphore_Core_mutex_mp_support ( * Output parameters: NONE */ +#if defined(RTEMS_MULTIPROCESSING) void _Semaphore_Core_semaphore_mp_support ( Thread_Control *the_thread, Objects_Id id @@ -569,3 +623,4 @@ void _Semaphore_Core_semaphore_mp_support ( the_thread ); } +#endif diff --git a/c/src/exec/rtems/src/signal.c b/c/src/exec/rtems/src/signal.c index efdcf70eea..120233d2d5 100644 --- a/c/src/exec/rtems/src/signal.c +++ b/c/src/exec/rtems/src/signal.c @@ -39,10 +39,12 @@ void _Signal_Manager_initialization( void ) * Register the MP Process Packet routine. */ +#if defined(RTEMS_MULTIPROCESSING) _MPCI_Register_packet_processor( MP_PACKET_SIGNAL, _Signal_MP_Process_packet ); +#endif } /*PAGE @@ -115,14 +117,19 @@ rtems_status_code rtems_signal_send( the_thread = _Thread_Get( id, &location ); switch ( location ) { - case OBJECTS_ERROR: - return RTEMS_INVALID_ID; + case OBJECTS_REMOTE: +#if defined(RTEMS_MULTIPROCESSING) return _Signal_MP_Send_request_packet( SIGNAL_MP_SEND_REQUEST, id, signal_set ); +#endif + + case OBJECTS_ERROR: + return RTEMS_INVALID_ID; + case OBJECTS_LOCAL: api = the_thread->API_Extensions[ THREAD_API_RTEMS ]; asr = &api->Signal; diff --git a/c/src/exec/rtems/src/tasks.c b/c/src/exec/rtems/src/tasks.c index 723a769836..5f6c8366c4 100644 --- a/c/src/exec/rtems/src/tasks.c +++ b/c/src/exec/rtems/src/tasks.c @@ -206,10 +206,12 @@ void _RTEMS_tasks_Manager_initialization( * Register the MP Process Packet routine. */ +#if defined(RTEMS_MULTIPROCESSING) _MPCI_Register_packet_processor( MP_PACKET_TASKS, _RTEMS_tasks_MP_Process_packet ); +#endif } @@ -245,9 +247,11 @@ rtems_status_code rtems_task_create( ) { register Thread_Control *the_thread; - Objects_MP_Control *the_global_object = NULL; boolean is_fp; +#if defined(RTEMS_MULTIPROCESSING) + Objects_MP_Control *the_global_object = NULL; boolean is_global; +#endif boolean status; rtems_attribute the_attribute_set; Priority_Control core_priority; @@ -297,6 +301,7 @@ rtems_status_code rtems_task_create( core_priority = _RTEMS_tasks_Priority_to_Core( initial_priority ); +#if defined(RTEMS_MULTIPROCESSING) if ( _Attributes_Is_global( the_attribute_set ) ) { is_global = TRUE; @@ -306,6 +311,7 @@ rtems_status_code rtems_task_create( } else is_global = FALSE; +#endif /* * Make sure system is MP if this task is global @@ -334,6 +340,7 @@ rtems_status_code rtems_task_create( return RTEMS_TOO_MANY; } +#if defined(RTEMS_MULTIPROCESSING) if ( is_global ) { the_global_object = _Objects_MP_Allocate_global_object(); @@ -343,6 +350,7 @@ rtems_status_code rtems_task_create( return RTEMS_TOO_MANY; } } +#endif /* * Initialize the core thread for this task. @@ -365,8 +373,10 @@ rtems_status_code rtems_task_create( ); if ( !status ) { +#if defined(RTEMS_MULTIPROCESSING) if ( is_global ) _Objects_MP_Free_global_object( the_global_object ); +#endif _RTEMS_tasks_Free( the_thread ); _Thread_Enable_dispatch(); return RTEMS_UNSATISFIED; @@ -379,6 +389,7 @@ rtems_status_code rtems_task_create( *id = the_thread->Object.id; +#if defined(RTEMS_MULTIPROCESSING) if ( is_global ) { the_thread->is_global = TRUE; @@ -397,6 +408,7 @@ rtems_status_code rtems_task_create( ); } +#endif _Thread_Enable_dispatch(); return RTEMS_SUCCESSFUL; @@ -470,11 +482,16 @@ rtems_status_code rtems_task_start( the_thread = _Thread_Get( id, &location ); switch ( location ) { - case OBJECTS_ERROR: - return RTEMS_INVALID_ID; + case OBJECTS_REMOTE: +#if defined(RTEMS_MULTIPROCESSING) _Thread_Dispatch(); return RTEMS_ILLEGAL_ON_REMOTE_OBJECT; +#endif + + case OBJECTS_ERROR: + return RTEMS_INVALID_ID; + case OBJECTS_LOCAL: if ( _Thread_Start( the_thread, THREAD_START_NUMERIC, entry_point, NULL, argument ) ) { @@ -516,11 +533,16 @@ rtems_status_code rtems_task_restart( the_thread = _Thread_Get( id, &location ); switch ( location ) { - case OBJECTS_ERROR: - return RTEMS_INVALID_ID; + case OBJECTS_REMOTE: +#if defined(RTEMS_MULTIPROCESSING) _Thread_Dispatch(); return RTEMS_ILLEGAL_ON_REMOTE_OBJECT; +#endif + + case OBJECTS_ERROR: + return RTEMS_INVALID_ID; + case OBJECTS_LOCAL: if ( _Thread_Restart( the_thread, NULL, argument ) ) { _Thread_Enable_dispatch(); @@ -561,11 +583,16 @@ rtems_status_code rtems_task_delete( the_thread = _Thread_Get( id, &location ); switch ( location ) { - case OBJECTS_ERROR: - return RTEMS_INVALID_ID; + case OBJECTS_REMOTE: +#if defined(RTEMS_MULTIPROCESSING) _Thread_Dispatch(); return RTEMS_ILLEGAL_ON_REMOTE_OBJECT; +#endif + + case OBJECTS_ERROR: + return RTEMS_INVALID_ID; + case OBJECTS_LOCAL: the_information = _Objects_Get_information( the_thread->Object.id ); @@ -579,6 +606,7 @@ rtems_status_code rtems_task_delete( _RTEMS_tasks_Free( the_thread ); +#if defined(RTEMS_MULTIPROCESSING) if ( the_thread->is_global ) { _Objects_MP_Close( &_RTEMS_tasks_Information, the_thread->Object.id ); @@ -589,6 +617,7 @@ rtems_status_code rtems_task_delete( 0 /* Not used */ ); } +#endif _Thread_Enable_dispatch(); return RTEMS_SUCCESSFUL; @@ -622,9 +651,9 @@ rtems_status_code rtems_task_suspend( the_thread = _Thread_Get( id, &location ); switch ( location ) { - case OBJECTS_ERROR: - return RTEMS_INVALID_ID; + case OBJECTS_REMOTE: +#if defined(RTEMS_MULTIPROCESSING) return _RTEMS_tasks_MP_Send_request_packet( RTEMS_TASKS_MP_SUSPEND_REQUEST, id, @@ -632,6 +661,11 @@ rtems_status_code rtems_task_suspend( 0, /* Not used */ 0 /* Not used */ ); +#endif + + case OBJECTS_ERROR: + return RTEMS_INVALID_ID; + case OBJECTS_LOCAL: if ( !_States_Is_suspended( the_thread->current_state ) ) { _Thread_Set_state( the_thread, STATES_SUSPENDED ); @@ -669,18 +703,21 @@ rtems_status_code rtems_task_resume( the_thread = _Thread_Get( id, &location ); switch ( location ) { - case OBJECTS_ERROR: - return RTEMS_INVALID_ID; + case OBJECTS_REMOTE: - return( - _RTEMS_tasks_MP_Send_request_packet( +#if defined(RTEMS_MULTIPROCESSING) + return _RTEMS_tasks_MP_Send_request_packet( RTEMS_TASKS_MP_RESUME_REQUEST, id, 0, /* Not used */ 0, /* Not used */ 0 /* Not used */ - ) - ); + ); +#endif + + case OBJECTS_ERROR: + return RTEMS_INVALID_ID; + case OBJECTS_LOCAL: if ( _States_Is_suspended( the_thread->current_state ) ) { _Thread_Resume( the_thread ); @@ -728,19 +765,22 @@ rtems_status_code rtems_task_set_priority( the_thread = _Thread_Get( id, &location ); switch ( location ) { - case OBJECTS_ERROR: - return RTEMS_INVALID_ID; + case OBJECTS_REMOTE: +#if defined(RTEMS_MULTIPROCESSING) _Thread_Executing->Wait.return_argument = old_priority; - return( - _RTEMS_tasks_MP_Send_request_packet( + return _RTEMS_tasks_MP_Send_request_packet( RTEMS_TASKS_MP_SET_PRIORITY_REQUEST, id, new_priority, 0, /* Not used */ 0 /* Not used */ - ) ); +#endif + + case OBJECTS_ERROR: + return RTEMS_INVALID_ID; + case OBJECTS_LOCAL: *old_priority = the_thread->current_priority; if ( new_priority != RTEMS_CURRENT_PRIORITY ) { @@ -897,9 +937,9 @@ rtems_status_code rtems_task_get_note( the_thread = _Thread_Get( id, &location ); switch ( location ) { - case OBJECTS_ERROR: - return RTEMS_INVALID_ID; + case OBJECTS_REMOTE: +#if defined(RTEMS_MULTIPROCESSING) _Thread_Executing->Wait.return_argument = note; return _RTEMS_tasks_MP_Send_request_packet( @@ -909,6 +949,11 @@ rtems_status_code rtems_task_get_note( notepad, 0 /* Not used */ ); +#endif + + case OBJECTS_ERROR: + return RTEMS_INVALID_ID; + case OBJECTS_LOCAL: api = the_thread->API_Extensions[ THREAD_API_RTEMS ]; *note = api->Notepads[ notepad ]; @@ -967,9 +1012,9 @@ rtems_status_code rtems_task_set_note( the_thread = _Thread_Get( id, &location ); switch ( location ) { - case OBJECTS_ERROR: - return RTEMS_INVALID_ID; + case OBJECTS_REMOTE: +#if defined(RTEMS_MULTIPROCESSING) return _RTEMS_tasks_MP_Send_request_packet( RTEMS_TASKS_MP_SET_NOTE_REQUEST, id, @@ -977,6 +1022,10 @@ rtems_status_code rtems_task_set_note( notepad, note ); +#endif + + case OBJECTS_ERROR: + return RTEMS_INVALID_ID; case OBJECTS_LOCAL: api = the_thread->API_Extensions[ THREAD_API_RTEMS ]; diff --git a/c/src/exec/rtems/src/timer.c b/c/src/exec/rtems/src/timer.c index 9d04686d40..9337df3a25 100644 --- a/c/src/exec/rtems/src/timer.c +++ b/c/src/exec/rtems/src/timer.c @@ -151,10 +151,12 @@ rtems_status_code rtems_timer_cancel( the_timer = _Timer_Get( id, &location ); switch ( location ) { - case OBJECTS_ERROR: - return RTEMS_INVALID_ID; case OBJECTS_REMOTE: /* should never return this */ return RTEMS_INTERNAL_ERROR; + + case OBJECTS_ERROR: + return RTEMS_INVALID_ID; + case OBJECTS_LOCAL: if ( !_Timer_Is_dormant_class( the_timer->the_class ) ) (void) _Watchdog_Remove( &the_timer->Ticker ); @@ -188,10 +190,12 @@ rtems_status_code rtems_timer_delete( the_timer = _Timer_Get( id, &location ); switch ( location ) { - case OBJECTS_ERROR: - return RTEMS_INVALID_ID; case OBJECTS_REMOTE: /* should never return this */ return RTEMS_INTERNAL_ERROR; + + case OBJECTS_ERROR: + return RTEMS_INVALID_ID; + case OBJECTS_LOCAL: _Objects_Close( &_Timer_Information, &the_timer->Object ); (void) _Watchdog_Remove( &the_timer->Ticker ); @@ -234,10 +238,12 @@ rtems_status_code rtems_timer_fire_after( the_timer = _Timer_Get( id, &location ); switch ( location ) { - case OBJECTS_ERROR: - return RTEMS_INVALID_ID; case OBJECTS_REMOTE: /* should never return this */ return RTEMS_INTERNAL_ERROR; + + case OBJECTS_ERROR: + return RTEMS_INVALID_ID; + case OBJECTS_LOCAL: (void) _Watchdog_Remove( &the_timer->Ticker ); the_timer->the_class = TIMER_INTERVAL; @@ -289,10 +295,12 @@ rtems_status_code rtems_timer_fire_when( the_timer = _Timer_Get( id, &location ); switch ( location ) { - case OBJECTS_ERROR: - return RTEMS_INVALID_ID; case OBJECTS_REMOTE: /* should never return this */ return RTEMS_INTERNAL_ERROR; + + case OBJECTS_ERROR: + return RTEMS_INVALID_ID; + case OBJECTS_LOCAL: (void) _Watchdog_Remove( &the_timer->Ticker ); the_timer->the_class = TIMER_TIME_OF_DAY; @@ -331,10 +339,12 @@ rtems_status_code rtems_timer_reset( the_timer = _Timer_Get( id, &location ); switch ( location ) { - case OBJECTS_ERROR: - return RTEMS_INVALID_ID; case OBJECTS_REMOTE: /* should never return this */ return RTEMS_INTERNAL_ERROR; + + case OBJECTS_ERROR: + return RTEMS_INVALID_ID; + case OBJECTS_LOCAL: if ( _Timer_Is_interval_class( the_timer->the_class ) ) { _Watchdog_Reset( &the_timer->Ticker ); -- cgit v1.2.3