diff options
Diffstat (limited to 'c')
549 files changed, 13461 insertions, 7006 deletions
diff --git a/c/src/exec/libcsupport/include/console.h b/c/src/exec/libcsupport/include/console.h index d102c6a1b1..02196de7a9 100644 --- a/c/src/exec/libcsupport/include/console.h +++ b/c/src/exec/libcsupport/include/console.h @@ -22,14 +22,43 @@ extern "C" { #endif #define CONSOLE_DRIVER_TABLE_ENTRY \ - { console_initialize, NULL, NULL, NULL, NULL, NULL } + { console_initialize, console_open, console_close, \ + console_read, console_write, console_control } rtems_device_driver console_initialize( rtems_device_major_number, rtems_device_minor_number, - void *, - rtems_id, - rtems_unsigned32 * + void * +); + +rtems_device_driver console_open( + rtems_device_major_number, + rtems_device_minor_number, + void * +); + +rtems_device_driver console_close( + rtems_device_major_number, + rtems_device_minor_number, + void * +); + +rtems_device_driver console_read( + rtems_device_major_number, + rtems_device_minor_number, + void * +); + +rtems_device_driver console_write( + rtems_device_major_number, + rtems_device_minor_number, + void * +); + +rtems_device_driver console_control( + rtems_device_major_number, + rtems_device_minor_number, + void * ); #ifdef __cplusplus diff --git a/c/src/exec/libcsupport/src/error.c b/c/src/exec/libcsupport/src/error.c index 8cf46f0565..cfe1858e08 100644 --- a/c/src/exec/libcsupport/src/error.c +++ b/c/src/exec/libcsupport/src/error.c @@ -91,8 +91,8 @@ rtems_assoc_t rtems_status_assoc[] = { { "not owner of resource", RTEMS_NOT_OWNER_OF_RESOURCE , }, { "directive not implemented", RTEMS_NOT_IMPLEMENTED, }, { "RTEMS inconsistency detected", RTEMS_INTERNAL_ERROR, }, - { "internal multiprocessing only", RTEMS_PROXY_BLOCKING, }, { "could not get enough memory", RTEMS_NO_MEMORY, }, + { "internal multiprocessing only", THREAD_STATUS_PROXY_BLOCKING, }, { 0, 0, 0 }, }; @@ -134,7 +134,7 @@ static int rtems_verror( if (error_flag & RTEMS_ERROR_ERRNO) /* include errno? */ local_errno = errno; - if (_Configuration_Is_multiprocessing()) + if (_System_state_Is_multiprocessing) fprintf(stderr, "[%d] ", _Configuration_MP_table->node); if (rtems_progname && *rtems_progname) diff --git a/c/src/exec/libcsupport/src/libio.c b/c/src/exec/libcsupport/src/libio.c index f2046501ce..38e0f83bac 100644 --- a/c/src/exec/libcsupport/src/libio.c +++ b/c/src/exec/libcsupport/src/libio.c @@ -14,8 +14,11 @@ #include <rtems/assoc.h> /* assoc.h not included by rtems.h */ #include <fcntl.h> /* O_RDONLY, et.al. */ +#include <sys/fcntl.h> /* O_RDONLY, et.al. */ #if defined(solaris2) #define O_NDELAY O_NONBLOCK +#elif defined(RTEMS_NEWLIB) +#define O_NDELAY _FNBIO #endif #include <errno.h> #include <string.h> /* strcmp */ diff --git a/c/src/exec/libcsupport/src/newlibc.c b/c/src/exec/libcsupport/src/newlibc.c index 4493b473da..e041668375 100644 --- a/c/src/exec/libcsupport/src/newlibc.c +++ b/c/src/exec/libcsupport/src/newlibc.c @@ -80,11 +80,12 @@ libc_wrapup(void) } -rtems_extension +rtems_boolean libc_create_hook(rtems_tcb *current_task, rtems_tcb *creating_task) { MY_task_set_note(creating_task, LIBC_NOTEPAD, 0); + return TRUE; } /* @@ -231,10 +232,10 @@ libc_init(int reentrant) { memset(&libc_extension, 0, sizeof(libc_extension)); - libc_extension.rtems_task_create = libc_create_hook; - libc_extension.rtems_task_start = libc_start_hook; - libc_extension.task_switch = libc_switch_hook; - libc_extension.rtems_task_delete = libc_delete_hook; + libc_extension.thread_create = libc_create_hook; + libc_extension.thread_start = libc_start_hook; + libc_extension.thread_switch = libc_switch_hook; + libc_extension.thread_delete = libc_delete_hook; rc = rtems_extension_create(rtems_build_name('L', 'I', 'B', 'C'), &libc_extension, &extension_id); diff --git a/c/src/exec/rtems/headers/asr.h b/c/src/exec/rtems/headers/asr.h index b2147f8df4..55eed78ec2 100644 --- a/c/src/exec/rtems/headers/asr.h +++ b/c/src/exec/rtems/headers/asr.h @@ -22,7 +22,7 @@ extern "C" { #endif -#include <rtems/modes.h> +#include <rtems/rtems/modes.h> /* * @@ -54,6 +54,7 @@ typedef rtems_asr ( *rtems_asr_entry )( */ typedef struct { + boolean is_enabled; /* are ASRs enabled currently? */ rtems_asr_entry handler; /* address of RTEMS_ASR */ Modes_Control mode_set; /* RTEMS_ASR mode */ rtems_signal_set signals_posted; /* signal set */ @@ -167,7 +168,7 @@ STATIC INLINE void _ASR_Post_signals( rtems_signal_set *signal_set ); -#include <rtems/asr.inl> +#include <rtems/rtems/asr.inl> #ifdef __cplusplus } diff --git a/c/src/exec/rtems/headers/attr.h b/c/src/exec/rtems/headers/attr.h index 950d77f73d..2d34dfe380 100644 --- a/c/src/exec/rtems/headers/attr.h +++ b/c/src/exec/rtems/headers/attr.h @@ -44,6 +44,9 @@ typedef unsigned32 rtems_attribute; #define RTEMS_NO_INHERIT_PRIORITY 0x00000000 #define RTEMS_INHERIT_PRIORITY 0x00000020 +#define RTEMS_NO_PRIORITY_CEILING 0x00000000 +#define RTEMS_PRIORITY_CEILING 0x00000040 + #if ( CPU_HARDWARE_FP == TRUE ) #define ATTRIBUTES_NOT_SUPPORTED 0 #else @@ -177,7 +180,21 @@ STATIC INLINE boolean _Attributes_Is_inherit_priority( rtems_attribute attribute_set ); -#include <rtems/attr.inl> +/* + * _Attributes_Is_priority_ceiling + * + * DESCRIPTION: + * + * This function returns TRUE if the priority ceiling attribute + * is enabled in the attribute_set and FALSE otherwise. + */ + +STATIC INLINE boolean _Attributes_Is_priority_ceiling( + rtems_attribute attribute_set +); + + +#include <rtems/rtems/attr.inl> #ifdef __cplusplus } diff --git a/c/src/exec/rtems/headers/clock.h b/c/src/exec/rtems/headers/clock.h index e849ab4f40..595dfcdbaf 100644 --- a/c/src/exec/rtems/headers/clock.h +++ b/c/src/exec/rtems/headers/clock.h @@ -29,7 +29,8 @@ extern "C" { #endif -#include <rtems/tod.h> +#include <rtems/core/tod.h> +#include <rtems/rtems/types.h> /* * List of things which can be returned by the rtems_clock_get directive. diff --git a/c/src/exec/rtems/headers/dpmem.h b/c/src/exec/rtems/headers/dpmem.h index 2b6016a842..801d5f3864 100644 --- a/c/src/exec/rtems/headers/dpmem.h +++ b/c/src/exec/rtems/headers/dpmem.h @@ -32,8 +32,7 @@ extern "C" { #endif -#include <rtems.h> -#include <rtems/object.h> +#include <rtems/core/object.h> /* * The following structure defines the port control block. Each port @@ -201,7 +200,7 @@ STATIC INLINE boolean _Dual_ported_memory_Is_null( Dual_ported_memory_Control *the_port ); -#include <rtems/dpmem.inl> +#include <rtems/rtems/dpmem.inl> #ifdef __cplusplus } diff --git a/c/src/exec/rtems/headers/event.h b/c/src/exec/rtems/headers/event.h index aeb71b2abd..05020b9926 100644 --- a/c/src/exec/rtems/headers/event.h +++ b/c/src/exec/rtems/headers/event.h @@ -28,11 +28,12 @@ extern "C" { #endif -#include <rtems/object.h> -#include <rtems/options.h> -#include <rtems/thread.h> -#include <rtems/watchdog.h> -#include <rtems/eventset.h> +#include <rtems/core/object.h> +#include <rtems/rtems/types.h> +#include <rtems/rtems/options.h> +#include <rtems/core/thread.h> +#include <rtems/core/watchdog.h> +#include <rtems/rtems/eventset.h> /* * This constant is passed as the event_in to the @@ -104,9 +105,10 @@ rtems_status_code rtems_event_receive ( */ void _Event_Seize ( - rtems_event_set event_in, - rtems_option option_set, - rtems_interval ticks + rtems_event_set event_in, + rtems_option option_set, + rtems_interval ticks, + rtems_event_set *event_out ); /* @@ -147,8 +149,8 @@ void _Event_Timeout ( EXTERN boolean _Event_Sync; /* event manager sync flag */ -#include <rtems/event.inl> -#include <rtems/eventmp.h> +#include <rtems/rtems/eventmp.h> +#include <rtems/rtems/event.inl> #ifdef __cplusplus } diff --git a/c/src/exec/rtems/headers/eventmp.h b/c/src/exec/rtems/headers/eventmp.h index 4b42cf791e..86587adc4a 100644 --- a/c/src/exec/rtems/headers/eventmp.h +++ b/c/src/exec/rtems/headers/eventmp.h @@ -21,11 +21,11 @@ extern "C" { #endif -#include <rtems/event.h> -#include <rtems/mppkt.h> -#include <rtems/object.h> -#include <rtems/thread.h> -#include <rtems/watchdog.h> +#include <rtems/rtems/event.h> +#include <rtems/core/mppkt.h> +#include <rtems/core/object.h> +#include <rtems/core/thread.h> +#include <rtems/core/watchdog.h> /* * The following enumerated type defines the list of diff --git a/c/src/exec/rtems/headers/eventset.h b/c/src/exec/rtems/headers/eventset.h index a25dabe58b..770f607075 100644 --- a/c/src/exec/rtems/headers/eventset.h +++ b/c/src/exec/rtems/headers/eventset.h @@ -132,7 +132,7 @@ STATIC INLINE rtems_event_set _Event_sets_Clear( rtems_event_set the_mask ); -#include <rtems/eventset.inl> +#include <rtems/rtems/eventset.inl> #ifdef __cplusplus } diff --git a/c/src/exec/rtems/headers/intr.h b/c/src/exec/rtems/headers/intr.h index 3669af1ccc..08c249d085 100644 --- a/c/src/exec/rtems/headers/intr.h +++ b/c/src/exec/rtems/headers/intr.h @@ -21,7 +21,7 @@ extern "C" { #endif -#include <rtems/isr.h> +#include <rtems/core/isr.h> /* * Interrupt level type @@ -30,6 +30,27 @@ extern "C" { typedef ISR_Level rtems_interrupt_level; /* + * The following type defines the control block used to manage + * the vectors. + */ + +typedef ISR_Vector_number rtems_vector_number; + +/* + * Return type for ISR Handler + */ + +typedef void rtems_isr; + +/* + * Pointer to an ISR Handler + */ + +typedef rtems_isr ( *rtems_isr_entry )( + rtems_vector_number + ); + +/* * _Interrupt_Manager_initialization * * DESCRIPTION: diff --git a/c/src/exec/rtems/headers/message.h b/c/src/exec/rtems/headers/message.h index 25188044be..2ee910ac05 100644 --- a/c/src/exec/rtems/headers/message.h +++ b/c/src/exec/rtems/headers/message.h @@ -34,10 +34,11 @@ extern "C" { #endif -#include <rtems/types.h> -#include <rtems/chain.h> -#include <rtems/object.h> -#include <rtems/threadq.h> +#include <rtems/rtems/types.h> +#include <rtems/core/chain.h> +#include <rtems/core/object.h> +#include <rtems/rtems/attr.h> +#include <rtems/core/threadq.h> /* * The following defines the data types needed to manipulate @@ -468,8 +469,8 @@ STATIC INLINE Message_queue_Control *_Message_queue_Get ( Objects_Locations *location ); -#include <rtems/message.inl> -#include <rtems/msgmp.h> +#include <rtems/rtems/message.inl> +#include <rtems/rtems/msgmp.h> #ifdef __cplusplus } diff --git a/c/src/exec/rtems/headers/modes.h b/c/src/exec/rtems/headers/modes.h index b3b05b3f85..115898e503 100644 --- a/c/src/exec/rtems/headers/modes.h +++ b/c/src/exec/rtems/headers/modes.h @@ -21,7 +21,7 @@ extern "C" { #endif -#include <rtems/isr.h> +#include <rtems/core/isr.h> /* * The following type defines the control block used to manage @@ -173,7 +173,7 @@ STATIC INLINE void _Modes_Change ( Modes_Control *changed ); -#include <rtems/modes.inl> +#include <rtems/rtems/modes.inl> #ifdef __cplusplus } diff --git a/c/src/exec/rtems/headers/mp.h b/c/src/exec/rtems/headers/mp.h index 96147d3b44..079f55b093 100644 --- a/c/src/exec/rtems/headers/mp.h +++ b/c/src/exec/rtems/headers/mp.h @@ -45,20 +45,6 @@ void _Multiprocessing_Manager_initialization ( void ); void rtems_multiprocessing_announce ( void ); -/* - * - * _Multiprocessing_Receive_server - * - * DESCRIPTION: - * - * This routine is a server thread which processes remote requests - * from other nodes. - */ - -Thread _Multiprocessing_Receive_server ( - Thread_Argument ignored -); - #ifdef __cplusplus } #endif diff --git a/c/src/exec/rtems/headers/msgmp.h b/c/src/exec/rtems/headers/msgmp.h index ff84e83ed3..592328678b 100644 --- a/c/src/exec/rtems/headers/msgmp.h +++ b/c/src/exec/rtems/headers/msgmp.h @@ -21,12 +21,12 @@ extern "C" { #endif -#include <rtems/message.h> -#include <rtems/mppkt.h> -#include <rtems/object.h> -#include <rtems/options.h> -#include <rtems/thread.h> -#include <rtems/watchdog.h> +#include <rtems/rtems/message.h> +#include <rtems/core/mppkt.h> +#include <rtems/core/object.h> +#include <rtems/rtems/options.h> +#include <rtems/core/thread.h> +#include <rtems/core/watchdog.h> /* * The following enumerated type defines the list of @@ -97,7 +97,7 @@ rtems_status_code _Message_queue_MP_Send_request_packet ( void *buffer, unsigned32 *size_p, rtems_option option_set, - rtems_interval timeout + Watchdog_Interval timeout ); /* diff --git a/c/src/exec/rtems/headers/options.h b/c/src/exec/rtems/headers/options.h index b318aad8c9..d8da2f9e86 100644 --- a/c/src/exec/rtems/headers/options.h +++ b/c/src/exec/rtems/headers/options.h @@ -69,7 +69,7 @@ STATIC INLINE boolean _Options_Is_any ( rtems_option option_set ); -#include <rtems/options.inl> +#include <rtems/rtems/options.inl> #ifdef __cplusplus } diff --git a/c/src/exec/rtems/headers/part.h b/c/src/exec/rtems/headers/part.h index 230cf029f7..da163c6beb 100644 --- a/c/src/exec/rtems/headers/part.h +++ b/c/src/exec/rtems/headers/part.h @@ -31,10 +31,10 @@ extern "C" { #endif -#include <rtems.h> -#include <rtems/address.h> -#include <rtems/attr.h> -#include <rtems/object.h> +#include <rtems/core/address.h> +#include <rtems/core/object.h> +#include <rtems/rtems/attr.h> +#include <rtems/rtems/types.h> /* * The following defines the control block used to manage each partition. @@ -280,8 +280,8 @@ STATIC INLINE boolean _Partition_Is_null ( Partition_Control *the_partition ); -#include <rtems/part.inl> -#include <rtems/partmp.h> +#include <rtems/rtems/part.inl> +#include <rtems/rtems/partmp.h> #ifdef __cplusplus } diff --git a/c/src/exec/rtems/headers/partmp.h b/c/src/exec/rtems/headers/partmp.h index 4b3bf876ff..980eaea853 100644 --- a/c/src/exec/rtems/headers/partmp.h +++ b/c/src/exec/rtems/headers/partmp.h @@ -21,11 +21,12 @@ extern "C" { #endif -#include <rtems/mppkt.h> -#include <rtems/object.h> -#include <rtems/options.h> -#include <rtems/part.h> -#include <rtems/thread.h> +#include <rtems/core/mppkt.h> +#include <rtems/core/object.h> +#include <rtems/rtems/options.h> +#include <rtems/core/thread.h> + +#include <rtems/rtems/part.h> /* * The following enumerated type defines the list of diff --git a/c/src/exec/rtems/headers/ratemon.h b/c/src/exec/rtems/headers/ratemon.h index 75a9963888..6b401ba5b0 100644 --- a/c/src/exec/rtems/headers/ratemon.h +++ b/c/src/exec/rtems/headers/ratemon.h @@ -29,10 +29,9 @@ extern "C" { #endif -#include <rtems.h> -#include <rtems/object.h> -#include <rtems/thread.h> -#include <rtems/watchdog.h> +#include <rtems/core/object.h> +#include <rtems/core/thread.h> +#include <rtems/core/watchdog.h> /* * The following enumerated type defines the states in which a @@ -50,7 +49,7 @@ typedef enum { * directive to obtain status information. */ -#define RTEMS_PERIOD_STATUS RTEMS_NO_TIMEOUT +#define RTEMS_PERIOD_STATUS WATCHDOG_NO_TIMEOUT /* * The following structure defines the control block used to manage @@ -148,8 +147,8 @@ rtems_status_code rtems_rate_monotonic_delete( */ rtems_status_code rtems_rate_monotonic_period( - Objects_Id id, - rtems_interval length + Objects_Id id, + rtems_interval length ); /* @@ -276,7 +275,7 @@ STATIC INLINE boolean _Rate_monotonic_Is_null ( Rate_monotonic_Control *the_period ); -#include <rtems/ratemon.inl> +#include <rtems/rtems/ratemon.inl> #ifdef __cplusplus } diff --git a/c/src/exec/rtems/headers/region.h b/c/src/exec/rtems/headers/region.h index a5f6aa761c..077d2b76e7 100644 --- a/c/src/exec/rtems/headers/region.h +++ b/c/src/exec/rtems/headers/region.h @@ -30,11 +30,12 @@ extern "C" { #endif -#include <rtems.h> -#include <rtems/object.h> -#include <rtems/threadq.h> -#include <rtems/heap.h> +#include <rtems/core/object.h> +#include <rtems/core/threadq.h> +#include <rtems/core/heap.h> #include <rtems/debug.h> +#include <rtems/rtems/attr.h> +#include <rtems/rtems/types.h> /* * The following records define the control block used to manage @@ -158,8 +159,8 @@ rtems_status_code rtems_region_delete( rtems_status_code rtems_region_get_segment( Objects_Id id, unsigned32 size, - rtems_option option_set, - rtems_interval timeout, + rtems_option option_set, + rtems_interval timeout, void **segment ); @@ -278,8 +279,8 @@ STATIC INLINE boolean _Region_Is_null ( Region_Control *the_region ); -#include <rtems/region.inl> -#include <rtems/regionmp.h> +#include <rtems/rtems/region.inl> +#include <rtems/rtems/regionmp.h> /* * _Region_Debug_Walk diff --git a/c/src/exec/rtems/headers/regionmp.h b/c/src/exec/rtems/headers/regionmp.h index 9756103a60..91ac5227f2 100644 --- a/c/src/exec/rtems/headers/regionmp.h +++ b/c/src/exec/rtems/headers/regionmp.h @@ -21,11 +21,12 @@ extern "C" { #endif -#include <rtems/mppkt.h> -#include <rtems/object.h> -#include <rtems/options.h> -#include <rtems/region.h> -#include <rtems/thread.h> +#include <rtems/core/mppkt.h> +#include <rtems/core/object.h> +#include <rtems/core/thread.h> + +#include <rtems/rtems/options.h> +#include <rtems/rtems/region.h> /* * The following enumerated type defines the list of @@ -87,8 +88,8 @@ rtems_status_code _Region_MP_Send_request_packet ( Objects_Id region_id, void *segment, unsigned32 size, - rtems_option option_set, - rtems_interval timeout + rtems_option option_set, + rtems_interval timeout ); /* diff --git a/c/src/exec/rtems/headers/rtems.h b/c/src/exec/rtems/headers/rtems.h index d1e1e6b406..519d9416d2 100644 --- a/c/src/exec/rtems/headers/rtems.h +++ b/c/src/exec/rtems/headers/rtems.h @@ -24,31 +24,83 @@ extern "C" { #endif #include <rtems/system.h> -#include <rtems/types.h> +#include <rtems/rtems/status.h> +#include <rtems/rtems/types.h> +#include <rtems/config.h> #include <rtems/init.h> -#include <rtems/tasks.h> -#include <rtems/intr.h> -#include <rtems/clock.h> +#include <rtems/rtems/tasks.h> +#include <rtems/rtems/intr.h> +#include <rtems/rtems/clock.h> #include <rtems/extension.h> -#include <rtems/timer.h> -#include <rtems/sem.h> -#include <rtems/message.h> -#include <rtems/event.h> -#include <rtems/signal.h> -#include <rtems/event.h> -#include <rtems/part.h> -#include <rtems/region.h> -#include <rtems/dpmem.h> +#include <rtems/rtems/timer.h> +#include <rtems/rtems/sem.h> +#include <rtems/rtems/message.h> +#include <rtems/rtems/event.h> +#include <rtems/rtems/signal.h> +#include <rtems/rtems/event.h> +#include <rtems/rtems/part.h> +#include <rtems/rtems/region.h> +#include <rtems/rtems/dpmem.h> #include <rtems/io.h> #include <rtems/fatal.h> -#include <rtems/ratemon.h> -#include <rtems/mp.h> +#include <rtems/rtems/ratemon.h> +#include <rtems/rtems/mp.h> -#include <rtems/support.h> +#include <rtems/rtems/support.h> +#include <rtems/sysstate.h> #define RTEMS_HAS_HARDWARE_FP CPU_HARDWARE_FP +/* + * The following define the constants which may be used in name searches. + */ + +#define RTEMS_SEARCH_ALL_NODES OBJECTS_SEARCH_ALL_NODES +#define RTEMS_SEARCH_OTHER_NODES OBJECTS_SEARCH_OTHER_NODES +#define RTEMS_SEARCH_LOCAL_NODE OBJECTS_SEARCH_LOCAL_NODE +#define RTEMS_WHO_AM_I OBJECTS_WHO_AM_I + +/* + * Parameters and return id's for _Objects_Get_next + */ + +#define RTEMS_OBJECT_ID_INITIAL_INDEX OBJECTS_ID_INITIAL_INDEX +#define RTEMS_OBJECT_ID_FINAL_INDEX OBJECTS_ID_FINAL_INDEX + +#define RTEMS_OBJECT_ID_INITIAL(node) OBJECTS_ID_INITIAL(node) +#define RTEMS_OBJECT_ID_FINAL OBJECTS_ID_FINAL + +/* + * The following constant defines the minimum stack size which every + * thread must exceed. + */ + +#define RTEMS_MINIMUM_STACK_SIZE STACK_MINIMUM_SIZE + +/* + * Constant for indefinite wait. (actually an illegal interval) + */ + +#define RTEMS_NO_TIMEOUT WATCHDOG_NO_TIMEOUT + +/* + * An MPCI must support packets of at least this size. + */ + +#define RTEMS_MINIMUM_PACKET_SIZE MP_PACKET_MINIMUM_PACKET_SIZE + +/* + * The following constant defines the number of unsigned32's + * in a packet which must be converted to native format in a + * heterogeneous system. In packets longer than + * MP_PACKET_MINIMUN_HETERO_CONVERSION unsigned32's, some of the "extra" data + * may a user message buffer which is not automatically endian swapped. + */ + +#define RTEMS_MINIMUN_HETERO_CONVERSION MP_PACKET_MINIMUN_HETERO_CONVERSION + + #ifdef __cplusplus } #endif diff --git a/c/src/exec/rtems/headers/rtemsapi.h b/c/src/exec/rtems/headers/rtemsapi.h new file mode 100644 index 0000000000..e43de773fd --- /dev/null +++ b/c/src/exec/rtems/headers/rtemsapi.h @@ -0,0 +1,34 @@ +/* + * RTEMS API Support + * + * NOTE: + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#ifndef __RTEMS_API_h +#define __RTEMS_API_h + +#include <rtems/config.h> + +/*PAGE + * + * _RTEMS_API_Initialize + * + * XXX + */ + +void _RTEMS_API_Initialize( + rtems_configuration_table *configuration_table +); + +#endif +/* end of include file */ diff --git a/c/src/exec/rtems/headers/sem.h b/c/src/exec/rtems/headers/sem.h index ff8abbc773..1faf3b13e9 100644 --- a/c/src/exec/rtems/headers/sem.h +++ b/c/src/exec/rtems/headers/sem.h @@ -31,23 +31,26 @@ extern "C" { #endif -#include <rtems.h> -#include <rtems/attr.h> -#include <rtems/object.h> -#include <rtems/threadq.h> +#include <rtems/rtems/types.h> +#include <rtems/rtems/support.h> +#include <rtems/rtems/tasks.h> +#include <rtems/rtems/attr.h> +#include <rtems/core/coremutex.h> +#include <rtems/core/object.h> +#include <rtems/core/coresem.h> +#include <rtems/core/threadq.h> /* * The following defines the control block used to manage each semaphore. */ typedef struct { - Objects_Control Object; - Thread_queue_Control Wait_queue; - rtems_attribute attribute_set; - unsigned32 count; - unsigned32 nest_count; - Thread_Control *holder; - Objects_Id holder_id; + Objects_Control Object; + rtems_attribute attribute_set; + union { + CORE_mutex_Control mutex; + CORE_semaphore_Control semaphore; + } Core_control; } Semaphore_Control; /* @@ -82,11 +85,11 @@ void _Semaphore_Manager_initialization( */ rtems_status_code rtems_semaphore_create( - rtems_name name, - unsigned32 count, - rtems_attribute attribute_set, - rtems_task_priority priority_ceiling, - Objects_Id *id + rtems_name name, + unsigned32 count, + rtems_attribute attribute_set, + rtems_task_priority priority_ceiling, + rtems_id *id ); /* @@ -106,7 +109,7 @@ rtems_status_code rtems_semaphore_create( rtems_status_code rtems_semaphore_ident( rtems_name name, unsigned32 node, - Objects_Id *id + rtems_id *id ); /* @@ -119,7 +122,7 @@ rtems_status_code rtems_semaphore_ident( */ rtems_status_code rtems_semaphore_delete( - Objects_Id id + rtems_id id ); /* @@ -137,8 +140,8 @@ rtems_status_code rtems_semaphore_delete( */ rtems_status_code rtems_semaphore_obtain( - Objects_Id id, - unsigned32 option_set, + rtems_id id, + unsigned32 option_set, rtems_interval timeout ); @@ -155,7 +158,7 @@ rtems_status_code rtems_semaphore_obtain( */ rtems_status_code rtems_semaphore_release( - Objects_Id id + rtems_id id ); /* @@ -213,7 +216,7 @@ STATIC INLINE void _Semaphore_Free ( */ STATIC INLINE Semaphore_Control *_Semaphore_Get ( - Objects_Id id, + rtems_id id, Objects_Locations *location ); @@ -229,8 +232,66 @@ STATIC INLINE boolean _Semaphore_Is_null ( Semaphore_Control *the_semaphore ); -#include <rtems/sem.inl> -#include <rtems/semmp.h> +/* + * _Semaphore_Translate_core_mutex_return_code + * + * DESCRIPTION: + * + * This function returns a RTEMS status code based on the mutex + * status code specified. + */ + +rtems_status_code _Semaphore_Translate_core_mutex_return_code ( + unsigned32 the_mutex_status +); + +/* + * _Semaphore_Translate_core_semaphore_return_code + * + * DESCRIPTION: + * + * This function returns a RTEMS status code based on the semaphore + * status code specified. + */ + +rtems_status_code _Semaphore_Translate_core_semaphore_return_code ( + unsigned32 the_mutex_status +); + +/*PAGE + * + * _Semaphore_Core_mutex_mp_support + * + * DESCRIPTION: + * + * This function processes the global actions necessary for remote + * accesses to a global semaphore based on a core mutex. This function + * is called by the core. + */ + +void _Semaphore_Core_mutex_mp_support ( + Thread_Control *the_thread, + rtems_id id +); + +/*PAGE + * + * _Semaphore_Core_mp_support + * + * DESCRIPTION: + * + * This function processes the global actions necessary for remote + * accesses to a global semaphore based on a core semaphore. This function + * is called by the core. + */ + +void _Semaphore_Core_semaphore_mp_support ( + Thread_Control *the_thread, + rtems_id id +); + +#include <rtems/rtems/sem.inl> +#include <rtems/rtems/semmp.h> #ifdef __cplusplus } diff --git a/c/src/exec/rtems/headers/semmp.h b/c/src/exec/rtems/headers/semmp.h index 915e18164c..a796f6ad6b 100644 --- a/c/src/exec/rtems/headers/semmp.h +++ b/c/src/exec/rtems/headers/semmp.h @@ -21,12 +21,12 @@ extern "C" { #endif -#include <rtems/mppkt.h> -#include <rtems/object.h> -#include <rtems/options.h> -#include <rtems/sem.h> -#include <rtems/thread.h> -#include <rtems/watchdog.h> +#include <rtems/core/mppkt.h> +#include <rtems/core/object.h> +#include <rtems/rtems/options.h> +#include <rtems/rtems/sem.h> +#include <rtems/core/thread.h> +#include <rtems/core/watchdog.h> /* * The following enumerated type defines the list of @@ -84,8 +84,8 @@ void _Semaphore_MP_Send_process_packet ( rtems_status_code _Semaphore_MP_Send_request_packet ( Semaphore_MP_Remote_operations operation, Objects_Id semaphore_id, - rtems_option option_set, - rtems_interval timeout + rtems_option option_set, + rtems_interval timeout ); /* diff --git a/c/src/exec/rtems/headers/signal.h b/c/src/exec/rtems/headers/signal.h index 74ff4a57fb..3dcb84513b 100644 --- a/c/src/exec/rtems/headers/signal.h +++ b/c/src/exec/rtems/headers/signal.h @@ -27,11 +27,21 @@ extern "C" { #endif -#include <rtems/asr.h> -#include <rtems/modes.h> -#include <rtems/object.h> -#include <rtems/status.h> -#include <rtems/types.h> +#include <rtems/rtems/asr.h> +#include <rtems/rtems/modes.h> +#include <rtems/core/object.h> +#include <rtems/rtems/status.h> +#include <rtems/rtems/types.h> + +/* + * _Signal_Manager_initialization + * + * DESCRIPTION: + * + * This routine performs the initialization necessary for this manager. + */ + +void _Signal_Manager_initialization( void ); /* * rtems_signal_catch @@ -63,7 +73,7 @@ rtems_status_code rtems_signal_send( rtems_signal_set signal_set ); -#include <rtems/signalmp.h> +#include <rtems/rtems/signalmp.h> #ifdef __cplusplus } diff --git a/c/src/exec/rtems/headers/signalmp.h b/c/src/exec/rtems/headers/signalmp.h index b72f476bee..fb25c5a62f 100644 --- a/c/src/exec/rtems/headers/signalmp.h +++ b/c/src/exec/rtems/headers/signalmp.h @@ -21,11 +21,11 @@ extern "C" { #endif -#include <rtems/asr.h> -#include <rtems/mppkt.h> -#include <rtems/object.h> -#include <rtems/thread.h> -#include <rtems/watchdog.h> +#include <rtems/rtems/asr.h> +#include <rtems/core/mppkt.h> +#include <rtems/core/object.h> +#include <rtems/core/thread.h> +#include <rtems/core/watchdog.h> /* * The following enumerated type defines the list of diff --git a/c/src/exec/rtems/headers/status.h b/c/src/exec/rtems/headers/status.h index 42b8754780..1c00d47bbf 100644 --- a/c/src/exec/rtems/headers/status.h +++ b/c/src/exec/rtems/headers/status.h @@ -52,13 +52,22 @@ typedef enum { RTEMS_NOT_OWNER_OF_RESOURCE = 23, /* not owner of resource */ RTEMS_NOT_IMPLEMENTED = 24, /* directive not implemented */ RTEMS_INTERNAL_ERROR = 25, /* RTEMS inconsistency detected */ - RTEMS_PROXY_BLOCKING = 26, /* internal multiprocessing only */ - RTEMS_NO_MEMORY = 27 /* could not get enough memory */ + RTEMS_NO_MEMORY = 26 /* could not get enough memory */ } rtems_status_code; #define RTEMS_STATUS_CODES_FIRST RTEMS_SUCCESSFUL #define RTEMS_STATUS_CODES_LAST RTEMS_NO_MEMORY +extern rtems_status_code _Status_Object_name_errors_to_status[]; + +#ifdef INIT +rtems_status_code _Status_Object_name_errors_to_status[] = { + RTEMS_SUCCESSFUL, /* OBJECTS_SUCCESSFUL */ + RTEMS_INVALID_NAME, /* OBJECTS_INVALID_NAME */ + RTEMS_INVALID_NODE /* OBJECTS_INVALID_NODE */ +}; +#endif + /* * rtems_is_status_successful * @@ -86,20 +95,7 @@ STATIC INLINE boolean rtems_are_statuses_equal ( rtems_status_code code2 ); -/* - * _Status_Is_proxy_blocking - * - * DESCRIPTION: - * - * This function returns TRUE if the status code is equal to the - * status which indicates that a proxy is blocking, and FALSE otherwise. - */ - -STATIC INLINE boolean _Status_Is_proxy_blocking ( - rtems_status_code code -); - -#include <rtems/status.inl> +#include <rtems/rtems/status.inl> #ifdef __cplusplus } diff --git a/c/src/exec/rtems/headers/support.h b/c/src/exec/rtems/headers/support.h index c6452e0847..3cf7eb6840 100644 --- a/c/src/exec/rtems/headers/support.h +++ b/c/src/exec/rtems/headers/support.h @@ -21,7 +21,7 @@ extern "C" { #endif -#include <rtems/types.h> +#include <rtems/rtems/types.h> /* * rtems_is_name_valid @@ -70,7 +70,52 @@ STATIC INLINE void rtems_name_to_characters( char *c4 ); -#include <rtems/support.inl> +/* + * rtems_get_class + * + * DESCRIPTION: + * + * This function returns the class portion of the ID. + * + */ + +#define rtems_get_class( _id ) \ + _Objects_Get_class( _id ) + +/* + * rtems_get_node + * + * DESCRIPTION: + * + * This function returns the node portion of the ID. + * + */ + +#define rtems_get_node( _id ) \ + _Objects_Get_node( _id ) + +/* + * rtems_get_index + * + * DESCRIPTION: + * + * This function returns the index portion of the ID. + * + */ + +#define rtems_get_index( _id ) \ + _Objects_Get_index( _id ) + +/* + * Time related + */ + +#define RTEMS_MILLISECONDS_TO_MICROSECONDS(_ms) \ + TOD_MILLISECONDS_TO_MICROSECONDS(_ms) +#define RTEMS_MILLISECONDS_TO_TICKS(_ms) \ + TOD_MILLISECONDS_TO_TICKS(_ms) + +#include <rtems/rtems/support.inl> #ifdef __cplusplus } diff --git a/c/src/exec/rtems/headers/taskmp.h b/c/src/exec/rtems/headers/taskmp.h index d05277a69c..2010485aba 100644 --- a/c/src/exec/rtems/headers/taskmp.h +++ b/c/src/exec/rtems/headers/taskmp.h @@ -21,12 +21,12 @@ extern "C" { #endif -#include <rtems/mppkt.h> -#include <rtems/object.h> -#include <rtems/options.h> -#include <rtems/priority.h> -#include <rtems/tasks.h> -#include <rtems/thread.h> +#include <rtems/core/mppkt.h> +#include <rtems/core/object.h> +#include <rtems/rtems/options.h> +#include <rtems/core/priority.h> +#include <rtems/rtems/tasks.h> +#include <rtems/core/thread.h> /* * The following enumerated type defines the list of diff --git a/c/src/exec/rtems/headers/tasks.h b/c/src/exec/rtems/headers/tasks.h index df623fe175..f3abd875fc 100644 --- a/c/src/exec/rtems/headers/tasks.h +++ b/c/src/exec/rtems/headers/tasks.h @@ -38,16 +38,13 @@ extern "C" { #endif -#include <rtems.h> -#include <rtems/message.h> -#include <rtems/object.h> -#include <rtems/part.h> -#include <rtems/region.h> -#include <rtems/sem.h> -#include <rtems/states.h> -#include <rtems/thread.h> -#include <rtems/threadq.h> -#include <rtems/types.h> +#include <rtems/core/object.h> +#include <rtems/core/states.h> +#include <rtems/core/thread.h> +#include <rtems/rtems/types.h> +#include <rtems/rtems/eventset.h> +#include <rtems/rtems/asr.h> +#include <rtems/rtems/attr.h> /* * Constant to be used as the ID of current task @@ -60,7 +57,106 @@ extern "C" { * interval when a task wishes to yield the CPU. */ -#define RTEMS_YIELD_PROCESSOR RTEMS_NO_TIMEOUT +#define RTEMS_YIELD_PROCESSOR WATCHDOG_NO_TIMEOUT + +/* + * Define the type for an RTEMS API task priority. + */ + +typedef Priority_Control rtems_task_priority; + +#define RTEMS_NO_PRIORITY RTEMS_CURRENT_PRIORITY + +#define RTEMS_MINIMUM_PRIORITY (PRIORITY_MINIMUM + 1) +#define RTEMS_MAXIMUM_PRIORITY PRIORITY_MAXIMUM + +/* + * The following constant is passed to rtems_task_set_priority when the + * caller wants to obtain the current priority. + */ + +#define RTEMS_CURRENT_PRIORITY PRIORITY_MINIMUM + +/* + * Notepads constants (indices into notepad array) + */ + +#define RTEMS_NOTEPAD_FIRST 0 /* lowest numbered notepad */ +#define RTEMS_NOTEPAD_0 0 /* notepad location 0 */ +#define RTEMS_NOTEPAD_1 1 /* notepad location 1 */ +#define RTEMS_NOTEPAD_2 2 /* notepad location 2 */ +#define RTEMS_NOTEPAD_3 3 /* notepad location 3 */ +#define RTEMS_NOTEPAD_4 4 /* notepad location 4 */ +#define RTEMS_NOTEPAD_5 5 /* notepad location 5 */ +#define RTEMS_NOTEPAD_6 6 /* notepad location 6 */ +#define RTEMS_NOTEPAD_7 7 /* notepad location 7 */ +#define RTEMS_NOTEPAD_8 8 /* notepad location 8 */ +#define RTEMS_NOTEPAD_9 9 /* notepad location 9 */ +#define RTEMS_NOTEPAD_10 10 /* notepad location 10 */ +#define RTEMS_NOTEPAD_11 11 /* notepad location 11 */ +#define RTEMS_NOTEPAD_12 12 /* notepad location 12 */ +#define RTEMS_NOTEPAD_13 13 /* notepad location 13 */ +#define RTEMS_NOTEPAD_14 14 /* notepad location 14 */ +#define RTEMS_NOTEPAD_15 15 /* notepad location 15 */ +#define RTEMS_NOTEPAD_LAST RTEMS_NOTEPAD_15 /* highest numbered notepad */ + +#define RTEMS_NUMBER_NOTEPADS (RTEMS_NOTEPAD_LAST+1) + +/* + * External API name for Thread_Control + */ + +typedef Thread_Control rtems_tcb; + +/* + * The following defines the "return type" of an RTEMS task. + */ + +typedef void rtems_task; + +/* + * The following defines the argument to an RTEMS task. + */ + +typedef unsigned32 rtems_task_argument; + +/* + * The following defines the type for the entry point of an RTEMS task. + */ + +typedef rtems_task ( *rtems_task_entry )( + rtems_task_argument + ); + +/* + * The following records define the Initialization Tasks Table. + * Each entry contains the information required by RTEMS to + * create and start a user task automatically at executive + * initialization time. + */ + +typedef struct { + rtems_name name; /* task name */ + unsigned32 stack_size; /* task stack size */ + rtems_task_priority initial_priority; /* task priority */ + rtems_attribute attribute_set; /* task attributes */ + rtems_task_entry entry_point; /* task entry point */ + rtems_mode mode_set; /* task initial mode */ + unsigned32 argument; /* task argument */ +} rtems_initialization_tasks_table; + +/* + * This is the API specific information required by each thread for + * the RTEMS API to function correctly. + */ + + +typedef struct { + unsigned32 Notepads[ RTEMS_NUMBER_NOTEPADS ]; + rtems_event_set pending_events; + rtems_event_set event_condition; + ASR_Information Signal; +} RTEMS_API_Control; /* * The following defines the information control block used to @@ -70,6 +166,13 @@ extern "C" { EXTERN Objects_Information _RTEMS_tasks_Information; /* + * These are used to manage the user initialization tasks. + */ + +EXTERN rtems_initialization_tasks_table *_RTEMS_tasks_User_initialization_tasks; +EXTERN unsigned32 _RTEMS_tasks_Number_of_initialization_tasks; + +/* * _RTEMS_tasks_Manager_initialization * * DESCRIPTION: @@ -78,7 +181,9 @@ EXTERN Objects_Information _RTEMS_tasks_Information; */ void _RTEMS_tasks_Manager_initialization( - unsigned32 maximum_tasks + unsigned32 maximum_tasks, + unsigned32 number_of_initialization_tasks, + rtems_initialization_tasks_table *user_tasks ); /* @@ -284,7 +389,7 @@ rtems_status_code rtems_task_wake_when( */ rtems_status_code rtems_task_wake_after( - rtems_interval ticks + rtems_interval ticks ); /* @@ -313,32 +418,43 @@ STATIC INLINE void _RTEMS_tasks_Free ( ); /* - * _RTEMS_tasks_Cancel_wait + * _RTEMS_tasks_Priority_to_Core * * DESCRIPTION: * - * This routine unblocks the_thread and cancels any timers - * which the_thread has active. + * This function converts an RTEMS API priority into a core priority. */ - -STATIC INLINE void _RTEMS_tasks_Cancel_wait( - Thread_Control *the_thread + +STATIC INLINE Priority_Control _RTEMS_tasks_Priority_to_Core( + rtems_task_priority priority ); -/* - * _RTEMS_Tasks_Priority_to_Core +/*PAGE * - * DESCRIPTION: + * _RTEMS_tasks_Initialize_user_tasks * - * This function converts an RTEMS API priority into a core priority. + * This routine creates and starts all configured user + * initialzation threads. + * + * Input parameters: NONE + * + * Output parameters: NONE */ -STATIC INLINE Priority_Control _RTEMS_Tasks_Priority_to_Core( - rtems_task_priority priority +void _RTEMS_tasks_Initialize_user_tasks( void ); + +/*PAGE + * + * _RTEMS_tasks_Priority_is_valid + * + */ + +STATIC INLINE boolean _RTEMS_tasks_Priority_is_valid ( + rtems_task_priority the_priority ); -#include <rtems/tasks.inl> -#include <rtems/taskmp.h> +#include <rtems/rtems/tasks.inl> +#include <rtems/rtems/taskmp.h> #ifdef __cplusplus } diff --git a/c/src/exec/rtems/headers/timer.h b/c/src/exec/rtems/headers/timer.h index bab05378c7..21e88a4baf 100644 --- a/c/src/exec/rtems/headers/timer.h +++ b/c/src/exec/rtems/headers/timer.h @@ -33,10 +33,9 @@ extern "C" { #endif -#include <rtems.h> -#include <rtems/object.h> -#include <rtems/tod.h> -#include <rtems/watchdog.h> +#include <rtems/core/object.h> +#include <rtems/core/tod.h> +#include <rtems/core/watchdog.h> /* * The following enumerated type details the classes to which a timer @@ -50,10 +49,15 @@ typedef enum { } Timer_Classes; /* - * The following defines the type of a Timer Service Routine. + * The following types define a pointer to a timer service routine. */ - -typedef rtems_timer_service_routine_entry Timer_Service; + +typedef void rtems_timer_service_routine; + +typedef rtems_timer_service_routine ( *rtems_timer_service_routine_entry )( + rtems_id, + void * + ); /* * The following defines the information control block used to manage @@ -153,10 +157,10 @@ rtems_status_code rtems_timer_delete( */ rtems_status_code rtems_timer_fire_after( - Objects_Id id, - rtems_interval ticks, - Timer_Service routine, - void *user_data + Objects_Id id, + rtems_interval ticks, + rtems_timer_service_routine_entry routine, + void *user_data ); /* @@ -170,10 +174,10 @@ rtems_status_code rtems_timer_fire_after( */ rtems_status_code rtems_timer_fire_when( - Objects_Id id, - rtems_time_of_day *wall_time, - Timer_Service routine, - void *user_data + Objects_Id id, + rtems_time_of_day *wall_time, + rtems_timer_service_routine_entry routine, + void *user_data ); /* @@ -283,7 +287,7 @@ STATIC INLINE boolean _Timer_Is_null ( Timer_Control *the_timer ); -#include <rtems/timer.inl> +#include <rtems/rtems/timer.inl> #ifdef __cplusplus } diff --git a/c/src/exec/rtems/headers/types.h b/c/src/exec/rtems/headers/types.h index e4d7c11065..3b7a4a5e12 100644 --- a/c/src/exec/rtems/headers/types.h +++ b/c/src/exec/rtems/headers/types.h @@ -20,9 +20,11 @@ extern "C" { #endif -#include <rtems/object.h> -#include <rtems/priority.h> -#include <rtems/modes.h> +#include <rtems/core/object.h> +#include <rtems/core/priority.h> +#include <rtems/rtems/modes.h> +#include <rtems/core/mpci.h> +#include <rtems/core/mppkt.h> /* * RTEMS basic type definitions @@ -51,18 +53,35 @@ typedef Context_Control_fp rtems_context_fp; typedef CPU_Interrupt_frame rtems_interrupt_frame; /* - * Define the type for an RTEMS API task priority. + * Time related */ -typedef Priority_Control rtems_task_priority; +typedef Watchdog_Interval rtems_interval; +typedef TOD_Control rtems_time_of_day; -#define RTEMS_NO_PRIORITY RTEMS_CURRENT_PRIORITY /* * Define the type for an RTEMS API task mode. */ typedef Modes_Control rtems_mode; +/* + * MPCI related entries + */ + +typedef MP_packet_Classes rtems_mp_packet_classes; +typedef MP_packet_Prefix rtems_packet_prefix; + +typedef MPCI_initialization_entry rtems_mpci_initialization_entry; +typedef MPCI_get_packet_entry rtems_mpci_get_packet_entry; +typedef MPCI_return_packet_entry rtems_mpci_return_packet_entry; +typedef MPCI_send_entry rtems_mpci_send_packet_entry; +typedef MPCI_receive_entry rtems_mpci_receive_packet_entry; + +typedef MPCI_Entry rtems_mpci_entry; + +typedef MPCI_Control rtems_mpci_table; + #ifdef __cplusplus } #endif diff --git a/c/src/exec/rtems/include/rtems.h b/c/src/exec/rtems/include/rtems.h index d1e1e6b406..519d9416d2 100644 --- a/c/src/exec/rtems/include/rtems.h +++ b/c/src/exec/rtems/include/rtems.h @@ -24,31 +24,83 @@ extern "C" { #endif #include <rtems/system.h> -#include <rtems/types.h> +#include <rtems/rtems/status.h> +#include <rtems/rtems/types.h> +#include <rtems/config.h> #include <rtems/init.h> -#include <rtems/tasks.h> -#include <rtems/intr.h> -#include <rtems/clock.h> +#include <rtems/rtems/tasks.h> +#include <rtems/rtems/intr.h> +#include <rtems/rtems/clock.h> #include <rtems/extension.h> -#include <rtems/timer.h> -#include <rtems/sem.h> -#include <rtems/message.h> -#include <rtems/event.h> -#include <rtems/signal.h> -#include <rtems/event.h> -#include <rtems/part.h> -#include <rtems/region.h> -#include <rtems/dpmem.h> +#include <rtems/rtems/timer.h> +#include <rtems/rtems/sem.h> +#include <rtems/rtems/message.h> +#include <rtems/rtems/event.h> +#include <rtems/rtems/signal.h> +#include <rtems/rtems/event.h> +#include <rtems/rtems/part.h> +#include <rtems/rtems/region.h> +#include <rtems/rtems/dpmem.h> #include <rtems/io.h> #include <rtems/fatal.h> -#include <rtems/ratemon.h> -#include <rtems/mp.h> +#include <rtems/rtems/ratemon.h> +#include <rtems/rtems/mp.h> -#include <rtems/support.h> +#include <rtems/rtems/support.h> +#include <rtems/sysstate.h> #define RTEMS_HAS_HARDWARE_FP CPU_HARDWARE_FP +/* + * The following define the constants which may be used in name searches. + */ + +#define RTEMS_SEARCH_ALL_NODES OBJECTS_SEARCH_ALL_NODES +#define RTEMS_SEARCH_OTHER_NODES OBJECTS_SEARCH_OTHER_NODES +#define RTEMS_SEARCH_LOCAL_NODE OBJECTS_SEARCH_LOCAL_NODE +#define RTEMS_WHO_AM_I OBJECTS_WHO_AM_I + +/* + * Parameters and return id's for _Objects_Get_next + */ + +#define RTEMS_OBJECT_ID_INITIAL_INDEX OBJECTS_ID_INITIAL_INDEX +#define RTEMS_OBJECT_ID_FINAL_INDEX OBJECTS_ID_FINAL_INDEX + +#define RTEMS_OBJECT_ID_INITIAL(node) OBJECTS_ID_INITIAL(node) +#define RTEMS_OBJECT_ID_FINAL OBJECTS_ID_FINAL + +/* + * The following constant defines the minimum stack size which every + * thread must exceed. + */ + +#define RTEMS_MINIMUM_STACK_SIZE STACK_MINIMUM_SIZE + +/* + * Constant for indefinite wait. (actually an illegal interval) + */ + +#define RTEMS_NO_TIMEOUT WATCHDOG_NO_TIMEOUT + +/* + * An MPCI must support packets of at least this size. + */ + +#define RTEMS_MINIMUM_PACKET_SIZE MP_PACKET_MINIMUM_PACKET_SIZE + +/* + * The following constant defines the number of unsigned32's + * in a packet which must be converted to native format in a + * heterogeneous system. In packets longer than + * MP_PACKET_MINIMUN_HETERO_CONVERSION unsigned32's, some of the "extra" data + * may a user message buffer which is not automatically endian swapped. + */ + +#define RTEMS_MINIMUN_HETERO_CONVERSION MP_PACKET_MINIMUN_HETERO_CONVERSION + + #ifdef __cplusplus } #endif diff --git a/c/src/exec/rtems/include/rtems/rtems/asr.h b/c/src/exec/rtems/include/rtems/rtems/asr.h index b2147f8df4..55eed78ec2 100644 --- a/c/src/exec/rtems/include/rtems/rtems/asr.h +++ b/c/src/exec/rtems/include/rtems/rtems/asr.h @@ -22,7 +22,7 @@ extern "C" { #endif -#include <rtems/modes.h> +#include <rtems/rtems/modes.h> /* * @@ -54,6 +54,7 @@ typedef rtems_asr ( *rtems_asr_entry )( */ typedef struct { + boolean is_enabled; /* are ASRs enabled currently? */ rtems_asr_entry handler; /* address of RTEMS_ASR */ Modes_Control mode_set; /* RTEMS_ASR mode */ rtems_signal_set signals_posted; /* signal set */ @@ -167,7 +168,7 @@ STATIC INLINE void _ASR_Post_signals( rtems_signal_set *signal_set ); -#include <rtems/asr.inl> +#include <rtems/rtems/asr.inl> #ifdef __cplusplus } diff --git a/c/src/exec/rtems/include/rtems/rtems/attr.h b/c/src/exec/rtems/include/rtems/rtems/attr.h index 950d77f73d..2d34dfe380 100644 --- a/c/src/exec/rtems/include/rtems/rtems/attr.h +++ b/c/src/exec/rtems/include/rtems/rtems/attr.h @@ -44,6 +44,9 @@ typedef unsigned32 rtems_attribute; #define RTEMS_NO_INHERIT_PRIORITY 0x00000000 #define RTEMS_INHERIT_PRIORITY 0x00000020 +#define RTEMS_NO_PRIORITY_CEILING 0x00000000 +#define RTEMS_PRIORITY_CEILING 0x00000040 + #if ( CPU_HARDWARE_FP == TRUE ) #define ATTRIBUTES_NOT_SUPPORTED 0 #else @@ -177,7 +180,21 @@ STATIC INLINE boolean _Attributes_Is_inherit_priority( rtems_attribute attribute_set ); -#include <rtems/attr.inl> +/* + * _Attributes_Is_priority_ceiling + * + * DESCRIPTION: + * + * This function returns TRUE if the priority ceiling attribute + * is enabled in the attribute_set and FALSE otherwise. + */ + +STATIC INLINE boolean _Attributes_Is_priority_ceiling( + rtems_attribute attribute_set +); + + +#include <rtems/rtems/attr.inl> #ifdef __cplusplus } diff --git a/c/src/exec/rtems/include/rtems/rtems/clock.h b/c/src/exec/rtems/include/rtems/rtems/clock.h index e849ab4f40..595dfcdbaf 100644 --- a/c/src/exec/rtems/include/rtems/rtems/clock.h +++ b/c/src/exec/rtems/include/rtems/rtems/clock.h @@ -29,7 +29,8 @@ extern "C" { #endif -#include <rtems/tod.h> +#include <rtems/core/tod.h> +#include <rtems/rtems/types.h> /* * List of things which can be returned by the rtems_clock_get directive. diff --git a/c/src/exec/rtems/include/rtems/rtems/dpmem.h b/c/src/exec/rtems/include/rtems/rtems/dpmem.h index 2b6016a842..801d5f3864 100644 --- a/c/src/exec/rtems/include/rtems/rtems/dpmem.h +++ b/c/src/exec/rtems/include/rtems/rtems/dpmem.h @@ -32,8 +32,7 @@ extern "C" { #endif -#include <rtems.h> -#include <rtems/object.h> +#include <rtems/core/object.h> /* * The following structure defines the port control block. Each port @@ -201,7 +200,7 @@ STATIC INLINE boolean _Dual_ported_memory_Is_null( Dual_ported_memory_Control *the_port ); -#include <rtems/dpmem.inl> +#include <rtems/rtems/dpmem.inl> #ifdef __cplusplus } diff --git a/c/src/exec/rtems/include/rtems/rtems/event.h b/c/src/exec/rtems/include/rtems/rtems/event.h index aeb71b2abd..05020b9926 100644 --- a/c/src/exec/rtems/include/rtems/rtems/event.h +++ b/c/src/exec/rtems/include/rtems/rtems/event.h @@ -28,11 +28,12 @@ extern "C" { #endif -#include <rtems/object.h> -#include <rtems/options.h> -#include <rtems/thread.h> -#include <rtems/watchdog.h> -#include <rtems/eventset.h> +#include <rtems/core/object.h> +#include <rtems/rtems/types.h> +#include <rtems/rtems/options.h> +#include <rtems/core/thread.h> +#include <rtems/core/watchdog.h> +#include <rtems/rtems/eventset.h> /* * This constant is passed as the event_in to the @@ -104,9 +105,10 @@ rtems_status_code rtems_event_receive ( */ void _Event_Seize ( - rtems_event_set event_in, - rtems_option option_set, - rtems_interval ticks + rtems_event_set event_in, + rtems_option option_set, + rtems_interval ticks, + rtems_event_set *event_out ); /* @@ -147,8 +149,8 @@ void _Event_Timeout ( EXTERN boolean _Event_Sync; /* event manager sync flag */ -#include <rtems/event.inl> -#include <rtems/eventmp.h> +#include <rtems/rtems/eventmp.h> +#include <rtems/rtems/event.inl> #ifdef __cplusplus } diff --git a/c/src/exec/rtems/include/rtems/rtems/eventmp.h b/c/src/exec/rtems/include/rtems/rtems/eventmp.h index 4b42cf791e..86587adc4a 100644 --- a/c/src/exec/rtems/include/rtems/rtems/eventmp.h +++ b/c/src/exec/rtems/include/rtems/rtems/eventmp.h @@ -21,11 +21,11 @@ extern "C" { #endif -#include <rtems/event.h> -#include <rtems/mppkt.h> -#include <rtems/object.h> -#include <rtems/thread.h> -#include <rtems/watchdog.h> +#include <rtems/rtems/event.h> +#include <rtems/core/mppkt.h> +#include <rtems/core/object.h> +#include <rtems/core/thread.h> +#include <rtems/core/watchdog.h> /* * The following enumerated type defines the list of diff --git a/c/src/exec/rtems/include/rtems/rtems/eventset.h b/c/src/exec/rtems/include/rtems/rtems/eventset.h index a25dabe58b..770f607075 100644 --- a/c/src/exec/rtems/include/rtems/rtems/eventset.h +++ b/c/src/exec/rtems/include/rtems/rtems/eventset.h @@ -132,7 +132,7 @@ STATIC INLINE rtems_event_set _Event_sets_Clear( rtems_event_set the_mask ); -#include <rtems/eventset.inl> +#include <rtems/rtems/eventset.inl> #ifdef __cplusplus } diff --git a/c/src/exec/rtems/include/rtems/rtems/intr.h b/c/src/exec/rtems/include/rtems/rtems/intr.h index 3669af1ccc..08c249d085 100644 --- a/c/src/exec/rtems/include/rtems/rtems/intr.h +++ b/c/src/exec/rtems/include/rtems/rtems/intr.h @@ -21,7 +21,7 @@ extern "C" { #endif -#include <rtems/isr.h> +#include <rtems/core/isr.h> /* * Interrupt level type @@ -30,6 +30,27 @@ extern "C" { typedef ISR_Level rtems_interrupt_level; /* + * The following type defines the control block used to manage + * the vectors. + */ + +typedef ISR_Vector_number rtems_vector_number; + +/* + * Return type for ISR Handler + */ + +typedef void rtems_isr; + +/* + * Pointer to an ISR Handler + */ + +typedef rtems_isr ( *rtems_isr_entry )( + rtems_vector_number + ); + +/* * _Interrupt_Manager_initialization * * DESCRIPTION: diff --git a/c/src/exec/rtems/include/rtems/rtems/message.h b/c/src/exec/rtems/include/rtems/rtems/message.h index 25188044be..2ee910ac05 100644 --- a/c/src/exec/rtems/include/rtems/rtems/message.h +++ b/c/src/exec/rtems/include/rtems/rtems/message.h @@ -34,10 +34,11 @@ extern "C" { #endif -#include <rtems/types.h> -#include <rtems/chain.h> -#include <rtems/object.h> -#include <rtems/threadq.h> +#include <rtems/rtems/types.h> +#include <rtems/core/chain.h> +#include <rtems/core/object.h> +#include <rtems/rtems/attr.h> +#include <rtems/core/threadq.h> /* * The following defines the data types needed to manipulate @@ -468,8 +469,8 @@ STATIC INLINE Message_queue_Control *_Message_queue_Get ( Objects_Locations *location ); -#include <rtems/message.inl> -#include <rtems/msgmp.h> +#include <rtems/rtems/message.inl> +#include <rtems/rtems/msgmp.h> #ifdef __cplusplus } diff --git a/c/src/exec/rtems/include/rtems/rtems/modes.h b/c/src/exec/rtems/include/rtems/rtems/modes.h index b3b05b3f85..115898e503 100644 --- a/c/src/exec/rtems/include/rtems/rtems/modes.h +++ b/c/src/exec/rtems/include/rtems/rtems/modes.h @@ -21,7 +21,7 @@ extern "C" { #endif -#include <rtems/isr.h> +#include <rtems/core/isr.h> /* * The following type defines the control block used to manage @@ -173,7 +173,7 @@ STATIC INLINE void _Modes_Change ( Modes_Control *changed ); -#include <rtems/modes.inl> +#include <rtems/rtems/modes.inl> #ifdef __cplusplus } diff --git a/c/src/exec/rtems/include/rtems/rtems/mp.h b/c/src/exec/rtems/include/rtems/rtems/mp.h index 96147d3b44..079f55b093 100644 --- a/c/src/exec/rtems/include/rtems/rtems/mp.h +++ b/c/src/exec/rtems/include/rtems/rtems/mp.h @@ -45,20 +45,6 @@ void _Multiprocessing_Manager_initialization ( void ); void rtems_multiprocessing_announce ( void ); -/* - * - * _Multiprocessing_Receive_server - * - * DESCRIPTION: - * - * This routine is a server thread which processes remote requests - * from other nodes. - */ - -Thread _Multiprocessing_Receive_server ( - Thread_Argument ignored -); - #ifdef __cplusplus } #endif diff --git a/c/src/exec/rtems/include/rtems/rtems/msgmp.h b/c/src/exec/rtems/include/rtems/rtems/msgmp.h index ff84e83ed3..592328678b 100644 --- a/c/src/exec/rtems/include/rtems/rtems/msgmp.h +++ b/c/src/exec/rtems/include/rtems/rtems/msgmp.h @@ -21,12 +21,12 @@ extern "C" { #endif -#include <rtems/message.h> -#include <rtems/mppkt.h> -#include <rtems/object.h> -#include <rtems/options.h> -#include <rtems/thread.h> -#include <rtems/watchdog.h> +#include <rtems/rtems/message.h> +#include <rtems/core/mppkt.h> +#include <rtems/core/object.h> +#include <rtems/rtems/options.h> +#include <rtems/core/thread.h> +#include <rtems/core/watchdog.h> /* * The following enumerated type defines the list of @@ -97,7 +97,7 @@ rtems_status_code _Message_queue_MP_Send_request_packet ( void *buffer, unsigned32 *size_p, rtems_option option_set, - rtems_interval timeout + Watchdog_Interval timeout ); /* diff --git a/c/src/exec/rtems/include/rtems/rtems/options.h b/c/src/exec/rtems/include/rtems/rtems/options.h index b318aad8c9..d8da2f9e86 100644 --- a/c/src/exec/rtems/include/rtems/rtems/options.h +++ b/c/src/exec/rtems/include/rtems/rtems/options.h @@ -69,7 +69,7 @@ STATIC INLINE boolean _Options_Is_any ( rtems_option option_set ); -#include <rtems/options.inl> +#include <rtems/rtems/options.inl> #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 230cf029f7..da163c6beb 100644 --- a/c/src/exec/rtems/include/rtems/rtems/part.h +++ b/c/src/exec/rtems/include/rtems/rtems/part.h @@ -31,10 +31,10 @@ extern "C" { #endif -#include <rtems.h> -#include <rtems/address.h> -#include <rtems/attr.h> -#include <rtems/object.h> +#include <rtems/core/address.h> +#include <rtems/core/object.h> +#include <rtems/rtems/attr.h> +#include <rtems/rtems/types.h> /* * The following defines the control block used to manage each partition. @@ -280,8 +280,8 @@ STATIC INLINE boolean _Partition_Is_null ( Partition_Control *the_partition ); -#include <rtems/part.inl> -#include <rtems/partmp.h> +#include <rtems/rtems/part.inl> +#include <rtems/rtems/partmp.h> #ifdef __cplusplus } diff --git a/c/src/exec/rtems/include/rtems/rtems/partmp.h b/c/src/exec/rtems/include/rtems/rtems/partmp.h index 4b3bf876ff..980eaea853 100644 --- a/c/src/exec/rtems/include/rtems/rtems/partmp.h +++ b/c/src/exec/rtems/include/rtems/rtems/partmp.h @@ -21,11 +21,12 @@ extern "C" { #endif -#include <rtems/mppkt.h> -#include <rtems/object.h> -#include <rtems/options.h> -#include <rtems/part.h> -#include <rtems/thread.h> +#include <rtems/core/mppkt.h> +#include <rtems/core/object.h> +#include <rtems/rtems/options.h> +#include <rtems/core/thread.h> + +#include <rtems/rtems/part.h> /* * The following enumerated type defines the list of diff --git a/c/src/exec/rtems/include/rtems/rtems/ratemon.h b/c/src/exec/rtems/include/rtems/rtems/ratemon.h index 75a9963888..6b401ba5b0 100644 --- a/c/src/exec/rtems/include/rtems/rtems/ratemon.h +++ b/c/src/exec/rtems/include/rtems/rtems/ratemon.h @@ -29,10 +29,9 @@ extern "C" { #endif -#include <rtems.h> -#include <rtems/object.h> -#include <rtems/thread.h> -#include <rtems/watchdog.h> +#include <rtems/core/object.h> +#include <rtems/core/thread.h> +#include <rtems/core/watchdog.h> /* * The following enumerated type defines the states in which a @@ -50,7 +49,7 @@ typedef enum { * directive to obtain status information. */ -#define RTEMS_PERIOD_STATUS RTEMS_NO_TIMEOUT +#define RTEMS_PERIOD_STATUS WATCHDOG_NO_TIMEOUT /* * The following structure defines the control block used to manage @@ -148,8 +147,8 @@ rtems_status_code rtems_rate_monotonic_delete( */ rtems_status_code rtems_rate_monotonic_period( - Objects_Id id, - rtems_interval length + Objects_Id id, + rtems_interval length ); /* @@ -276,7 +275,7 @@ STATIC INLINE boolean _Rate_monotonic_Is_null ( Rate_monotonic_Control *the_period ); -#include <rtems/ratemon.inl> +#include <rtems/rtems/ratemon.inl> #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 a5f6aa761c..077d2b76e7 100644 --- a/c/src/exec/rtems/include/rtems/rtems/region.h +++ b/c/src/exec/rtems/include/rtems/rtems/region.h @@ -30,11 +30,12 @@ extern "C" { #endif -#include <rtems.h> -#include <rtems/object.h> -#include <rtems/threadq.h> -#include <rtems/heap.h> +#include <rtems/core/object.h> +#include <rtems/core/threadq.h> +#include <rtems/core/heap.h> #include <rtems/debug.h> +#include <rtems/rtems/attr.h> +#include <rtems/rtems/types.h> /* * The following records define the control block used to manage @@ -158,8 +159,8 @@ rtems_status_code rtems_region_delete( rtems_status_code rtems_region_get_segment( Objects_Id id, unsigned32 size, - rtems_option option_set, - rtems_interval timeout, + rtems_option option_set, + rtems_interval timeout, void **segment ); @@ -278,8 +279,8 @@ STATIC INLINE boolean _Region_Is_null ( Region_Control *the_region ); -#include <rtems/region.inl> -#include <rtems/regionmp.h> +#include <rtems/rtems/region.inl> +#include <rtems/rtems/regionmp.h> /* * _Region_Debug_Walk diff --git a/c/src/exec/rtems/include/rtems/rtems/regionmp.h b/c/src/exec/rtems/include/rtems/rtems/regionmp.h index 9756103a60..91ac5227f2 100644 --- a/c/src/exec/rtems/include/rtems/rtems/regionmp.h +++ b/c/src/exec/rtems/include/rtems/rtems/regionmp.h @@ -21,11 +21,12 @@ extern "C" { #endif -#include <rtems/mppkt.h> -#include <rtems/object.h> -#include <rtems/options.h> -#include <rtems/region.h> -#include <rtems/thread.h> +#include <rtems/core/mppkt.h> +#include <rtems/core/object.h> +#include <rtems/core/thread.h> + +#include <rtems/rtems/options.h> +#include <rtems/rtems/region.h> /* * The following enumerated type defines the list of @@ -87,8 +88,8 @@ rtems_status_code _Region_MP_Send_request_packet ( Objects_Id region_id, void *segment, unsigned32 size, - rtems_option option_set, - rtems_interval timeout + rtems_option option_set, + rtems_interval timeout ); /* diff --git a/c/src/exec/rtems/include/rtems/rtems/rtemsapi.h b/c/src/exec/rtems/include/rtems/rtems/rtemsapi.h new file mode 100644 index 0000000000..e43de773fd --- /dev/null +++ b/c/src/exec/rtems/include/rtems/rtems/rtemsapi.h @@ -0,0 +1,34 @@ +/* + * RTEMS API Support + * + * NOTE: + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#ifndef __RTEMS_API_h +#define __RTEMS_API_h + +#include <rtems/config.h> + +/*PAGE + * + * _RTEMS_API_Initialize + * + * XXX + */ + +void _RTEMS_API_Initialize( + rtems_configuration_table *configuration_table +); + +#endif +/* end of include file */ diff --git a/c/src/exec/rtems/include/rtems/rtems/sem.h b/c/src/exec/rtems/include/rtems/rtems/sem.h index ff8abbc773..1faf3b13e9 100644 --- a/c/src/exec/rtems/include/rtems/rtems/sem.h +++ b/c/src/exec/rtems/include/rtems/rtems/sem.h @@ -31,23 +31,26 @@ extern "C" { #endif -#include <rtems.h> -#include <rtems/attr.h> -#include <rtems/object.h> -#include <rtems/threadq.h> +#include <rtems/rtems/types.h> +#include <rtems/rtems/support.h> +#include <rtems/rtems/tasks.h> +#include <rtems/rtems/attr.h> +#include <rtems/core/coremutex.h> +#include <rtems/core/object.h> +#include <rtems/core/coresem.h> +#include <rtems/core/threadq.h> /* * The following defines the control block used to manage each semaphore. */ typedef struct { - Objects_Control Object; - Thread_queue_Control Wait_queue; - rtems_attribute attribute_set; - unsigned32 count; - unsigned32 nest_count; - Thread_Control *holder; - Objects_Id holder_id; + Objects_Control Object; + rtems_attribute attribute_set; + union { + CORE_mutex_Control mutex; + CORE_semaphore_Control semaphore; + } Core_control; } Semaphore_Control; /* @@ -82,11 +85,11 @@ void _Semaphore_Manager_initialization( */ rtems_status_code rtems_semaphore_create( - rtems_name name, - unsigned32 count, - rtems_attribute attribute_set, - rtems_task_priority priority_ceiling, - Objects_Id *id + rtems_name name, + unsigned32 count, + rtems_attribute attribute_set, + rtems_task_priority priority_ceiling, + rtems_id *id ); /* @@ -106,7 +109,7 @@ rtems_status_code rtems_semaphore_create( rtems_status_code rtems_semaphore_ident( rtems_name name, unsigned32 node, - Objects_Id *id + rtems_id *id ); /* @@ -119,7 +122,7 @@ rtems_status_code rtems_semaphore_ident( */ rtems_status_code rtems_semaphore_delete( - Objects_Id id + rtems_id id ); /* @@ -137,8 +140,8 @@ rtems_status_code rtems_semaphore_delete( */ rtems_status_code rtems_semaphore_obtain( - Objects_Id id, - unsigned32 option_set, + rtems_id id, + unsigned32 option_set, rtems_interval timeout ); @@ -155,7 +158,7 @@ rtems_status_code rtems_semaphore_obtain( */ rtems_status_code rtems_semaphore_release( - Objects_Id id + rtems_id id ); /* @@ -213,7 +216,7 @@ STATIC INLINE void _Semaphore_Free ( */ STATIC INLINE Semaphore_Control *_Semaphore_Get ( - Objects_Id id, + rtems_id id, Objects_Locations *location ); @@ -229,8 +232,66 @@ STATIC INLINE boolean _Semaphore_Is_null ( Semaphore_Control *the_semaphore ); -#include <rtems/sem.inl> -#include <rtems/semmp.h> +/* + * _Semaphore_Translate_core_mutex_return_code + * + * DESCRIPTION: + * + * This function returns a RTEMS status code based on the mutex + * status code specified. + */ + +rtems_status_code _Semaphore_Translate_core_mutex_return_code ( + unsigned32 the_mutex_status +); + +/* + * _Semaphore_Translate_core_semaphore_return_code + * + * DESCRIPTION: + * + * This function returns a RTEMS status code based on the semaphore + * status code specified. + */ + +rtems_status_code _Semaphore_Translate_core_semaphore_return_code ( + unsigned32 the_mutex_status +); + +/*PAGE + * + * _Semaphore_Core_mutex_mp_support + * + * DESCRIPTION: + * + * This function processes the global actions necessary for remote + * accesses to a global semaphore based on a core mutex. This function + * is called by the core. + */ + +void _Semaphore_Core_mutex_mp_support ( + Thread_Control *the_thread, + rtems_id id +); + +/*PAGE + * + * _Semaphore_Core_mp_support + * + * DESCRIPTION: + * + * This function processes the global actions necessary for remote + * accesses to a global semaphore based on a core semaphore. This function + * is called by the core. + */ + +void _Semaphore_Core_semaphore_mp_support ( + Thread_Control *the_thread, + rtems_id id +); + +#include <rtems/rtems/sem.inl> +#include <rtems/rtems/semmp.h> #ifdef __cplusplus } diff --git a/c/src/exec/rtems/include/rtems/rtems/semmp.h b/c/src/exec/rtems/include/rtems/rtems/semmp.h index 915e18164c..a796f6ad6b 100644 --- a/c/src/exec/rtems/include/rtems/rtems/semmp.h +++ b/c/src/exec/rtems/include/rtems/rtems/semmp.h @@ -21,12 +21,12 @@ extern "C" { #endif -#include <rtems/mppkt.h> -#include <rtems/object.h> -#include <rtems/options.h> -#include <rtems/sem.h> -#include <rtems/thread.h> -#include <rtems/watchdog.h> +#include <rtems/core/mppkt.h> +#include <rtems/core/object.h> +#include <rtems/rtems/options.h> +#include <rtems/rtems/sem.h> +#include <rtems/core/thread.h> +#include <rtems/core/watchdog.h> /* * The following enumerated type defines the list of @@ -84,8 +84,8 @@ void _Semaphore_MP_Send_process_packet ( rtems_status_code _Semaphore_MP_Send_request_packet ( Semaphore_MP_Remote_operations operation, Objects_Id semaphore_id, - rtems_option option_set, - rtems_interval timeout + rtems_option option_set, + rtems_interval timeout ); /* diff --git a/c/src/exec/rtems/include/rtems/rtems/signal.h b/c/src/exec/rtems/include/rtems/rtems/signal.h index 74ff4a57fb..3dcb84513b 100644 --- a/c/src/exec/rtems/include/rtems/rtems/signal.h +++ b/c/src/exec/rtems/include/rtems/rtems/signal.h @@ -27,11 +27,21 @@ extern "C" { #endif -#include <rtems/asr.h> -#include <rtems/modes.h> -#include <rtems/object.h> -#include <rtems/status.h> -#include <rtems/types.h> +#include <rtems/rtems/asr.h> +#include <rtems/rtems/modes.h> +#include <rtems/core/object.h> +#include <rtems/rtems/status.h> +#include <rtems/rtems/types.h> + +/* + * _Signal_Manager_initialization + * + * DESCRIPTION: + * + * This routine performs the initialization necessary for this manager. + */ + +void _Signal_Manager_initialization( void ); /* * rtems_signal_catch @@ -63,7 +73,7 @@ rtems_status_code rtems_signal_send( rtems_signal_set signal_set ); -#include <rtems/signalmp.h> +#include <rtems/rtems/signalmp.h> #ifdef __cplusplus } diff --git a/c/src/exec/rtems/include/rtems/rtems/signalmp.h b/c/src/exec/rtems/include/rtems/rtems/signalmp.h index b72f476bee..fb25c5a62f 100644 --- a/c/src/exec/rtems/include/rtems/rtems/signalmp.h +++ b/c/src/exec/rtems/include/rtems/rtems/signalmp.h @@ -21,11 +21,11 @@ extern "C" { #endif -#include <rtems/asr.h> -#include <rtems/mppkt.h> -#include <rtems/object.h> -#include <rtems/thread.h> -#include <rtems/watchdog.h> +#include <rtems/rtems/asr.h> +#include <rtems/core/mppkt.h> +#include <rtems/core/object.h> +#include <rtems/core/thread.h> +#include <rtems/core/watchdog.h> /* * The following enumerated type defines the list of diff --git a/c/src/exec/rtems/include/rtems/rtems/status.h b/c/src/exec/rtems/include/rtems/rtems/status.h index 42b8754780..1c00d47bbf 100644 --- a/c/src/exec/rtems/include/rtems/rtems/status.h +++ b/c/src/exec/rtems/include/rtems/rtems/status.h @@ -52,13 +52,22 @@ typedef enum { RTEMS_NOT_OWNER_OF_RESOURCE = 23, /* not owner of resource */ RTEMS_NOT_IMPLEMENTED = 24, /* directive not implemented */ RTEMS_INTERNAL_ERROR = 25, /* RTEMS inconsistency detected */ - RTEMS_PROXY_BLOCKING = 26, /* internal multiprocessing only */ - RTEMS_NO_MEMORY = 27 /* could not get enough memory */ + RTEMS_NO_MEMORY = 26 /* could not get enough memory */ } rtems_status_code; #define RTEMS_STATUS_CODES_FIRST RTEMS_SUCCESSFUL #define RTEMS_STATUS_CODES_LAST RTEMS_NO_MEMORY +extern rtems_status_code _Status_Object_name_errors_to_status[]; + +#ifdef INIT +rtems_status_code _Status_Object_name_errors_to_status[] = { + RTEMS_SUCCESSFUL, /* OBJECTS_SUCCESSFUL */ + RTEMS_INVALID_NAME, /* OBJECTS_INVALID_NAME */ + RTEMS_INVALID_NODE /* OBJECTS_INVALID_NODE */ +}; +#endif + /* * rtems_is_status_successful * @@ -86,20 +95,7 @@ STATIC INLINE boolean rtems_are_statuses_equal ( rtems_status_code code2 ); -/* - * _Status_Is_proxy_blocking - * - * DESCRIPTION: - * - * This function returns TRUE if the status code is equal to the - * status which indicates that a proxy is blocking, and FALSE otherwise. - */ - -STATIC INLINE boolean _Status_Is_proxy_blocking ( - rtems_status_code code -); - -#include <rtems/status.inl> +#include <rtems/rtems/status.inl> #ifdef __cplusplus } diff --git a/c/src/exec/rtems/include/rtems/rtems/support.h b/c/src/exec/rtems/include/rtems/rtems/support.h index c6452e0847..3cf7eb6840 100644 --- a/c/src/exec/rtems/include/rtems/rtems/support.h +++ b/c/src/exec/rtems/include/rtems/rtems/support.h @@ -21,7 +21,7 @@ extern "C" { #endif -#include <rtems/types.h> +#include <rtems/rtems/types.h> /* * rtems_is_name_valid @@ -70,7 +70,52 @@ STATIC INLINE void rtems_name_to_characters( char *c4 ); -#include <rtems/support.inl> +/* + * rtems_get_class + * + * DESCRIPTION: + * + * This function returns the class portion of the ID. + * + */ + +#define rtems_get_class( _id ) \ + _Objects_Get_class( _id ) + +/* + * rtems_get_node + * + * DESCRIPTION: + * + * This function returns the node portion of the ID. + * + */ + +#define rtems_get_node( _id ) \ + _Objects_Get_node( _id ) + +/* + * rtems_get_index + * + * DESCRIPTION: + * + * This function returns the index portion of the ID. + * + */ + +#define rtems_get_index( _id ) \ + _Objects_Get_index( _id ) + +/* + * Time related + */ + +#define RTEMS_MILLISECONDS_TO_MICROSECONDS(_ms) \ + TOD_MILLISECONDS_TO_MICROSECONDS(_ms) +#define RTEMS_MILLISECONDS_TO_TICKS(_ms) \ + TOD_MILLISECONDS_TO_TICKS(_ms) + +#include <rtems/rtems/support.inl> #ifdef __cplusplus } diff --git a/c/src/exec/rtems/include/rtems/rtems/taskmp.h b/c/src/exec/rtems/include/rtems/rtems/taskmp.h index d05277a69c..2010485aba 100644 --- a/c/src/exec/rtems/include/rtems/rtems/taskmp.h +++ b/c/src/exec/rtems/include/rtems/rtems/taskmp.h @@ -21,12 +21,12 @@ extern "C" { #endif -#include <rtems/mppkt.h> -#include <rtems/object.h> -#include <rtems/options.h> -#include <rtems/priority.h> -#include <rtems/tasks.h> -#include <rtems/thread.h> +#include <rtems/core/mppkt.h> +#include <rtems/core/object.h> +#include <rtems/rtems/options.h> +#include <rtems/core/priority.h> +#include <rtems/rtems/tasks.h> +#include <rtems/core/thread.h> /* * The following enumerated type defines the list of diff --git a/c/src/exec/rtems/include/rtems/rtems/tasks.h b/c/src/exec/rtems/include/rtems/rtems/tasks.h index df623fe175..f3abd875fc 100644 --- a/c/src/exec/rtems/include/rtems/rtems/tasks.h +++ b/c/src/exec/rtems/include/rtems/rtems/tasks.h @@ -38,16 +38,13 @@ extern "C" { #endif -#include <rtems.h> -#include <rtems/message.h> -#include <rtems/object.h> -#include <rtems/part.h> -#include <rtems/region.h> -#include <rtems/sem.h> -#include <rtems/states.h> -#include <rtems/thread.h> -#include <rtems/threadq.h> -#include <rtems/types.h> +#include <rtems/core/object.h> +#include <rtems/core/states.h> +#include <rtems/core/thread.h> +#include <rtems/rtems/types.h> +#include <rtems/rtems/eventset.h> +#include <rtems/rtems/asr.h> +#include <rtems/rtems/attr.h> /* * Constant to be used as the ID of current task @@ -60,7 +57,106 @@ extern "C" { * interval when a task wishes to yield the CPU. */ -#define RTEMS_YIELD_PROCESSOR RTEMS_NO_TIMEOUT +#define RTEMS_YIELD_PROCESSOR WATCHDOG_NO_TIMEOUT + +/* + * Define the type for an RTEMS API task priority. + */ + +typedef Priority_Control rtems_task_priority; + +#define RTEMS_NO_PRIORITY RTEMS_CURRENT_PRIORITY + +#define RTEMS_MINIMUM_PRIORITY (PRIORITY_MINIMUM + 1) +#define RTEMS_MAXIMUM_PRIORITY PRIORITY_MAXIMUM + +/* + * The following constant is passed to rtems_task_set_priority when the + * caller wants to obtain the current priority. + */ + +#define RTEMS_CURRENT_PRIORITY PRIORITY_MINIMUM + +/* + * Notepads constants (indices into notepad array) + */ + +#define RTEMS_NOTEPAD_FIRST 0 /* lowest numbered notepad */ +#define RTEMS_NOTEPAD_0 0 /* notepad location 0 */ +#define RTEMS_NOTEPAD_1 1 /* notepad location 1 */ +#define RTEMS_NOTEPAD_2 2 /* notepad location 2 */ +#define RTEMS_NOTEPAD_3 3 /* notepad location 3 */ +#define RTEMS_NOTEPAD_4 4 /* notepad location 4 */ +#define RTEMS_NOTEPAD_5 5 /* notepad location 5 */ +#define RTEMS_NOTEPAD_6 6 /* notepad location 6 */ +#define RTEMS_NOTEPAD_7 7 /* notepad location 7 */ +#define RTEMS_NOTEPAD_8 8 /* notepad location 8 */ +#define RTEMS_NOTEPAD_9 9 /* notepad location 9 */ +#define RTEMS_NOTEPAD_10 10 /* notepad location 10 */ +#define RTEMS_NOTEPAD_11 11 /* notepad location 11 */ +#define RTEMS_NOTEPAD_12 12 /* notepad location 12 */ +#define RTEMS_NOTEPAD_13 13 /* notepad location 13 */ +#define RTEMS_NOTEPAD_14 14 /* notepad location 14 */ +#define RTEMS_NOTEPAD_15 15 /* notepad location 15 */ +#define RTEMS_NOTEPAD_LAST RTEMS_NOTEPAD_15 /* highest numbered notepad */ + +#define RTEMS_NUMBER_NOTEPADS (RTEMS_NOTEPAD_LAST+1) + +/* + * External API name for Thread_Control + */ + +typedef Thread_Control rtems_tcb; + +/* + * The following defines the "return type" of an RTEMS task. + */ + +typedef void rtems_task; + +/* + * The following defines the argument to an RTEMS task. + */ + +typedef unsigned32 rtems_task_argument; + +/* + * The following defines the type for the entry point of an RTEMS task. + */ + +typedef rtems_task ( *rtems_task_entry )( + rtems_task_argument + ); + +/* + * The following records define the Initialization Tasks Table. + * Each entry contains the information required by RTEMS to + * create and start a user task automatically at executive + * initialization time. + */ + +typedef struct { + rtems_name name; /* task name */ + unsigned32 stack_size; /* task stack size */ + rtems_task_priority initial_priority; /* task priority */ + rtems_attribute attribute_set; /* task attributes */ + rtems_task_entry entry_point; /* task entry point */ + rtems_mode mode_set; /* task initial mode */ + unsigned32 argument; /* task argument */ +} rtems_initialization_tasks_table; + +/* + * This is the API specific information required by each thread for + * the RTEMS API to function correctly. + */ + + +typedef struct { + unsigned32 Notepads[ RTEMS_NUMBER_NOTEPADS ]; + rtems_event_set pending_events; + rtems_event_set event_condition; + ASR_Information Signal; +} RTEMS_API_Control; /* * The following defines the information control block used to @@ -70,6 +166,13 @@ extern "C" { EXTERN Objects_Information _RTEMS_tasks_Information; /* + * These are used to manage the user initialization tasks. + */ + +EXTERN rtems_initialization_tasks_table *_RTEMS_tasks_User_initialization_tasks; +EXTERN unsigned32 _RTEMS_tasks_Number_of_initialization_tasks; + +/* * _RTEMS_tasks_Manager_initialization * * DESCRIPTION: @@ -78,7 +181,9 @@ EXTERN Objects_Information _RTEMS_tasks_Information; */ void _RTEMS_tasks_Manager_initialization( - unsigned32 maximum_tasks + unsigned32 maximum_tasks, + unsigned32 number_of_initialization_tasks, + rtems_initialization_tasks_table *user_tasks ); /* @@ -284,7 +389,7 @@ rtems_status_code rtems_task_wake_when( */ rtems_status_code rtems_task_wake_after( - rtems_interval ticks + rtems_interval ticks ); /* @@ -313,32 +418,43 @@ STATIC INLINE void _RTEMS_tasks_Free ( ); /* - * _RTEMS_tasks_Cancel_wait + * _RTEMS_tasks_Priority_to_Core * * DESCRIPTION: * - * This routine unblocks the_thread and cancels any timers - * which the_thread has active. + * This function converts an RTEMS API priority into a core priority. */ - -STATIC INLINE void _RTEMS_tasks_Cancel_wait( - Thread_Control *the_thread + +STATIC INLINE Priority_Control _RTEMS_tasks_Priority_to_Core( + rtems_task_priority priority ); -/* - * _RTEMS_Tasks_Priority_to_Core +/*PAGE * - * DESCRIPTION: + * _RTEMS_tasks_Initialize_user_tasks * - * This function converts an RTEMS API priority into a core priority. + * This routine creates and starts all configured user + * initialzation threads. + * + * Input parameters: NONE + * + * Output parameters: NONE */ -STATIC INLINE Priority_Control _RTEMS_Tasks_Priority_to_Core( - rtems_task_priority priority +void _RTEMS_tasks_Initialize_user_tasks( void ); + +/*PAGE + * + * _RTEMS_tasks_Priority_is_valid + * + */ + +STATIC INLINE boolean _RTEMS_tasks_Priority_is_valid ( + rtems_task_priority the_priority ); -#include <rtems/tasks.inl> -#include <rtems/taskmp.h> +#include <rtems/rtems/tasks.inl> +#include <rtems/rtems/taskmp.h> #ifdef __cplusplus } diff --git a/c/src/exec/rtems/include/rtems/rtems/timer.h b/c/src/exec/rtems/include/rtems/rtems/timer.h index bab05378c7..21e88a4baf 100644 --- a/c/src/exec/rtems/include/rtems/rtems/timer.h +++ b/c/src/exec/rtems/include/rtems/rtems/timer.h @@ -33,10 +33,9 @@ extern "C" { #endif -#include <rtems.h> -#include <rtems/object.h> -#include <rtems/tod.h> -#include <rtems/watchdog.h> +#include <rtems/core/object.h> +#include <rtems/core/tod.h> +#include <rtems/core/watchdog.h> /* * The following enumerated type details the classes to which a timer @@ -50,10 +49,15 @@ typedef enum { } Timer_Classes; /* - * The following defines the type of a Timer Service Routine. + * The following types define a pointer to a timer service routine. */ - -typedef rtems_timer_service_routine_entry Timer_Service; + +typedef void rtems_timer_service_routine; + +typedef rtems_timer_service_routine ( *rtems_timer_service_routine_entry )( + rtems_id, + void * + ); /* * The following defines the information control block used to manage @@ -153,10 +157,10 @@ rtems_status_code rtems_timer_delete( */ rtems_status_code rtems_timer_fire_after( - Objects_Id id, - rtems_interval ticks, - Timer_Service routine, - void *user_data + Objects_Id id, + rtems_interval ticks, + rtems_timer_service_routine_entry routine, + void *user_data ); /* @@ -170,10 +174,10 @@ rtems_status_code rtems_timer_fire_after( */ rtems_status_code rtems_timer_fire_when( - Objects_Id id, - rtems_time_of_day *wall_time, - Timer_Service routine, - void *user_data + Objects_Id id, + rtems_time_of_day *wall_time, + rtems_timer_service_routine_entry routine, + void *user_data ); /* @@ -283,7 +287,7 @@ STATIC INLINE boolean _Timer_Is_null ( Timer_Control *the_timer ); -#include <rtems/timer.inl> +#include <rtems/rtems/timer.inl> #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 e4d7c11065..3b7a4a5e12 100644 --- a/c/src/exec/rtems/include/rtems/rtems/types.h +++ b/c/src/exec/rtems/include/rtems/rtems/types.h @@ -20,9 +20,11 @@ extern "C" { #endif -#include <rtems/object.h> -#include <rtems/priority.h> -#include <rtems/modes.h> +#include <rtems/core/object.h> +#include <rtems/core/priority.h> +#include <rtems/rtems/modes.h> +#include <rtems/core/mpci.h> +#include <rtems/core/mppkt.h> /* * RTEMS basic type definitions @@ -51,18 +53,35 @@ typedef Context_Control_fp rtems_context_fp; typedef CPU_Interrupt_frame rtems_interrupt_frame; /* - * Define the type for an RTEMS API task priority. + * Time related */ -typedef Priority_Control rtems_task_priority; +typedef Watchdog_Interval rtems_interval; +typedef TOD_Control rtems_time_of_day; -#define RTEMS_NO_PRIORITY RTEMS_CURRENT_PRIORITY /* * Define the type for an RTEMS API task mode. */ typedef Modes_Control rtems_mode; +/* + * MPCI related entries + */ + +typedef MP_packet_Classes rtems_mp_packet_classes; +typedef MP_packet_Prefix rtems_packet_prefix; + +typedef MPCI_initialization_entry rtems_mpci_initialization_entry; +typedef MPCI_get_packet_entry rtems_mpci_get_packet_entry; +typedef MPCI_return_packet_entry rtems_mpci_return_packet_entry; +typedef MPCI_send_entry rtems_mpci_send_packet_entry; +typedef MPCI_receive_entry rtems_mpci_receive_packet_entry; + +typedef MPCI_Entry rtems_mpci_entry; + +typedef MPCI_Control rtems_mpci_table; + #ifdef __cplusplus } #endif diff --git a/c/src/exec/rtems/inline/asr.inl b/c/src/exec/rtems/inline/asr.inl index a2da1ae311..fb1d7a8efc 100644 --- a/c/src/exec/rtems/inline/asr.inl +++ b/c/src/exec/rtems/inline/asr.inl @@ -17,7 +17,7 @@ #ifndef __INLINE_ASR_inl #define __INLINE_ASR_inl -#include <rtems/isr.h> +#include <rtems/core/isr.h> /*PAGE * @@ -29,6 +29,7 @@ STATIC INLINE void _ASR_Initialize ( ASR_Information *information ) { + information->is_enabled = TRUE; information->handler = NULL; information->mode_set = RTEMS_DEFAULT_MODES; information->signals_posted = 0; @@ -47,7 +48,7 @@ STATIC INLINE void _ASR_Swap_signals ( ) { rtems_signal_set _signals; - ISR_Level _level; + ISR_Level _level; _ISR_Disable( _level ); _signals = information->signals_pending; diff --git a/c/src/exec/rtems/inline/attr.inl b/c/src/exec/rtems/inline/attr.inl index 15a9296b7e..0f1190fe93 100644 --- a/c/src/exec/rtems/inline/attr.inl +++ b/c/src/exec/rtems/inline/attr.inl @@ -108,5 +108,18 @@ STATIC INLINE boolean _Attributes_Is_inherit_priority( return ( attribute_set & RTEMS_INHERIT_PRIORITY ); } +/*PAGE + * + * _Attributes_Is_priority_ceiling + * + */ + +STATIC INLINE boolean _Attributes_Is_priority_ceiling( + rtems_attribute attribute_set +) +{ + return ( attribute_set & RTEMS_PRIORITY_CEILING ); +} + #endif /* end of include file */ diff --git a/c/src/exec/rtems/inline/event.inl b/c/src/exec/rtems/inline/event.inl index 2f2f480001..5377144f98 100644 --- a/c/src/exec/rtems/inline/event.inl +++ b/c/src/exec/rtems/inline/event.inl @@ -24,6 +24,12 @@ STATIC INLINE void _Event_Manager_initialization( void ) { _Event_Sync = FALSE; + + /* + * Register the MP Process Packet routine. + */ + + _MPCI_Register_packet_processor( MP_PACKET_EVENT, _Event_MP_Process_packet ); } #endif diff --git a/c/src/exec/rtems/inline/message.inl b/c/src/exec/rtems/inline/message.inl index 8837159580..5b34ce5a83 100644 --- a/c/src/exec/rtems/inline/message.inl +++ b/c/src/exec/rtems/inline/message.inl @@ -17,7 +17,7 @@ #ifndef __MESSAGE_QUEUE_inl #define __MESSAGE_QUEUE_inl -#include <rtems/wkspace.h> +#include <rtems/core/wkspace.h> /*PAGE * diff --git a/c/src/exec/rtems/inline/modes.inl b/c/src/exec/rtems/inline/modes.inl index 8fe964e8d8..6d4b6d06d0 100644 --- a/c/src/exec/rtems/inline/modes.inl +++ b/c/src/exec/rtems/inline/modes.inl @@ -53,7 +53,7 @@ STATIC INLINE boolean _Modes_Is_asr_disabled ( Modes_Control mode_set ) { - return ( mode_set & RTEMS_ASR_MASK ); + return (mode_set & RTEMS_ASR_MASK) == RTEMS_NO_ASR; } /*PAGE @@ -66,7 +66,7 @@ STATIC INLINE boolean _Modes_Is_preempt ( Modes_Control mode_set ) { - return ( ( mode_set & RTEMS_PREEMPT_MASK ) == RTEMS_PREEMPT ); + return (mode_set & RTEMS_PREEMPT_MASK) == RTEMS_PREEMPT; } /*PAGE @@ -79,8 +79,7 @@ STATIC INLINE boolean _Modes_Is_timeslice ( Modes_Control mode_set ) { - return ((mode_set & (RTEMS_TIMESLICE_MASK|RTEMS_PREEMPT_MASK)) == - (RTEMS_TIMESLICE|RTEMS_PREEMPT) ); + return (mode_set & RTEMS_TIMESLICE_MASK) == RTEMS_TIMESLICE; } /*PAGE diff --git a/c/src/exec/rtems/inline/rtems/rtems/asr.inl b/c/src/exec/rtems/inline/rtems/rtems/asr.inl index a2da1ae311..fb1d7a8efc 100644 --- a/c/src/exec/rtems/inline/rtems/rtems/asr.inl +++ b/c/src/exec/rtems/inline/rtems/rtems/asr.inl @@ -17,7 +17,7 @@ #ifndef __INLINE_ASR_inl #define __INLINE_ASR_inl -#include <rtems/isr.h> +#include <rtems/core/isr.h> /*PAGE * @@ -29,6 +29,7 @@ STATIC INLINE void _ASR_Initialize ( ASR_Information *information ) { + information->is_enabled = TRUE; information->handler = NULL; information->mode_set = RTEMS_DEFAULT_MODES; information->signals_posted = 0; @@ -47,7 +48,7 @@ STATIC INLINE void _ASR_Swap_signals ( ) { rtems_signal_set _signals; - ISR_Level _level; + ISR_Level _level; _ISR_Disable( _level ); _signals = information->signals_pending; diff --git a/c/src/exec/rtems/inline/rtems/rtems/attr.inl b/c/src/exec/rtems/inline/rtems/rtems/attr.inl index 15a9296b7e..0f1190fe93 100644 --- a/c/src/exec/rtems/inline/rtems/rtems/attr.inl +++ b/c/src/exec/rtems/inline/rtems/rtems/attr.inl @@ -108,5 +108,18 @@ STATIC INLINE boolean _Attributes_Is_inherit_priority( return ( attribute_set & RTEMS_INHERIT_PRIORITY ); } +/*PAGE + * + * _Attributes_Is_priority_ceiling + * + */ + +STATIC INLINE boolean _Attributes_Is_priority_ceiling( + rtems_attribute attribute_set +) +{ + return ( attribute_set & RTEMS_PRIORITY_CEILING ); +} + #endif /* end of include file */ diff --git a/c/src/exec/rtems/inline/rtems/rtems/event.inl b/c/src/exec/rtems/inline/rtems/rtems/event.inl index 2f2f480001..5377144f98 100644 --- a/c/src/exec/rtems/inline/rtems/rtems/event.inl +++ b/c/src/exec/rtems/inline/rtems/rtems/event.inl @@ -24,6 +24,12 @@ STATIC INLINE void _Event_Manager_initialization( void ) { _Event_Sync = FALSE; + + /* + * Register the MP Process Packet routine. + */ + + _MPCI_Register_packet_processor( MP_PACKET_EVENT, _Event_MP_Process_packet ); } #endif diff --git a/c/src/exec/rtems/inline/rtems/rtems/message.inl b/c/src/exec/rtems/inline/rtems/rtems/message.inl index 8837159580..5b34ce5a83 100644 --- a/c/src/exec/rtems/inline/rtems/rtems/message.inl +++ b/c/src/exec/rtems/inline/rtems/rtems/message.inl @@ -17,7 +17,7 @@ #ifndef __MESSAGE_QUEUE_inl #define __MESSAGE_QUEUE_inl -#include <rtems/wkspace.h> +#include <rtems/core/wkspace.h> /*PAGE * diff --git a/c/src/exec/rtems/inline/rtems/rtems/modes.inl b/c/src/exec/rtems/inline/rtems/rtems/modes.inl index 8fe964e8d8..6d4b6d06d0 100644 --- a/c/src/exec/rtems/inline/rtems/rtems/modes.inl +++ b/c/src/exec/rtems/inline/rtems/rtems/modes.inl @@ -53,7 +53,7 @@ STATIC INLINE boolean _Modes_Is_asr_disabled ( Modes_Control mode_set ) { - return ( mode_set & RTEMS_ASR_MASK ); + return (mode_set & RTEMS_ASR_MASK) == RTEMS_NO_ASR; } /*PAGE @@ -66,7 +66,7 @@ STATIC INLINE boolean _Modes_Is_preempt ( Modes_Control mode_set ) { - return ( ( mode_set & RTEMS_PREEMPT_MASK ) == RTEMS_PREEMPT ); + return (mode_set & RTEMS_PREEMPT_MASK) == RTEMS_PREEMPT; } /*PAGE @@ -79,8 +79,7 @@ STATIC INLINE boolean _Modes_Is_timeslice ( Modes_Control mode_set ) { - return ((mode_set & (RTEMS_TIMESLICE_MASK|RTEMS_PREEMPT_MASK)) == - (RTEMS_TIMESLICE|RTEMS_PREEMPT) ); + return (mode_set & RTEMS_TIMESLICE_MASK) == RTEMS_TIMESLICE; } /*PAGE diff --git a/c/src/exec/rtems/inline/rtems/rtems/status.inl b/c/src/exec/rtems/inline/rtems/rtems/status.inl index bd158e535b..1db5a1e89f 100644 --- a/c/src/exec/rtems/inline/rtems/rtems/status.inl +++ b/c/src/exec/rtems/inline/rtems/rtems/status.inl @@ -44,17 +44,5 @@ STATIC INLINE boolean rtems_are_statuses_equal( return (code1 == code2); } -/* - * _Status_Is_proxy_blocking - * - */ - -STATIC INLINE boolean _Status_Is_proxy_blocking ( - rtems_status_code code -) -{ - return (code == RTEMS_PROXY_BLOCKING); -} - #endif /* end of include file */ diff --git a/c/src/exec/rtems/inline/rtems/rtems/tasks.inl b/c/src/exec/rtems/inline/rtems/rtems/tasks.inl index 2aec654571..ccd2de2613 100644 --- a/c/src/exec/rtems/inline/rtems/rtems/tasks.inl +++ b/c/src/exec/rtems/inline/rtems/rtems/tasks.inl @@ -17,11 +17,6 @@ #ifndef __RTEMS_TASKS_inl #define __RTEMS_TASKS_inl -#include <rtems/msgmp.h> -#include <rtems/partmp.h> -#include <rtems/regionmp.h> -#include <rtems/semmp.h> - /*PAGE * * _RTEMS_tasks_Allocate @@ -51,60 +46,28 @@ STATIC INLINE void _RTEMS_tasks_Free ( /*PAGE * - * _RTEMS_tasks_Cancel_wait - * + * _RTEMS_tasks_Priority_to_Core */ - -STATIC INLINE void _RTEMS_tasks_Cancel_wait( - Thread_Control *the_thread + +STATIC INLINE Priority_Control _RTEMS_tasks_Priority_to_Core( + rtems_task_priority priority ) { - States_Control state; - States_Control remote_state; - - state = the_thread->current_state; - -/* XXX do this with the object class */ - if ( _States_Is_waiting_on_thread_queue( state ) ) { - if ( _States_Is_waiting_for_rpc_reply( state ) && - _States_Is_locally_blocked( state ) ) { - remote_state = _States_Clear( - STATES_WAITING_FOR_RPC_REPLY | STATES_TRANSIENT, - state - ); - - switch ( remote_state ) { - - case STATES_WAITING_FOR_BUFFER: - _Partition_MP_Send_extract_proxy( the_thread ); - break; - case STATES_WAITING_FOR_SEGMENT: - _Region_MP_Send_extract_proxy( the_thread ); - break; - case STATES_WAITING_FOR_SEMAPHORE: - _Semaphore_MP_Send_extract_proxy( the_thread ); - break; - case STATES_WAITING_FOR_MESSAGE: - _Message_queue_MP_Send_extract_proxy( the_thread ); - break; - } - } - _Thread_queue_Extract( the_thread->Wait.queue, the_thread ); - } - else if ( _Watchdog_Is_active( &the_thread->Timer ) ) - (void) _Watchdog_Remove( &the_thread->Timer ); + return (Priority_Control) priority; } /*PAGE * - * _RTEMS_Tasks_Priority_to_Core + * _RTEMS_tasks_Priority_is_valid + * */ -STATIC INLINE Priority_Control _RTEMS_Tasks_Priority_to_Core( - rtems_task_priority priority +STATIC INLINE boolean _RTEMS_tasks_Priority_is_valid ( + rtems_task_priority the_priority ) { - return (Priority_Control) priority; + return ( ( the_priority >= RTEMS_MINIMUM_PRIORITY ) && + ( the_priority <= RTEMS_MAXIMUM_PRIORITY ) ); } #endif diff --git a/c/src/exec/rtems/inline/status.inl b/c/src/exec/rtems/inline/status.inl index bd158e535b..1db5a1e89f 100644 --- a/c/src/exec/rtems/inline/status.inl +++ b/c/src/exec/rtems/inline/status.inl @@ -44,17 +44,5 @@ STATIC INLINE boolean rtems_are_statuses_equal( return (code1 == code2); } -/* - * _Status_Is_proxy_blocking - * - */ - -STATIC INLINE boolean _Status_Is_proxy_blocking ( - rtems_status_code code -) -{ - return (code == RTEMS_PROXY_BLOCKING); -} - #endif /* end of include file */ diff --git a/c/src/exec/rtems/inline/tasks.inl b/c/src/exec/rtems/inline/tasks.inl index 2aec654571..ccd2de2613 100644 --- a/c/src/exec/rtems/inline/tasks.inl +++ b/c/src/exec/rtems/inline/tasks.inl @@ -17,11 +17,6 @@ #ifndef __RTEMS_TASKS_inl #define __RTEMS_TASKS_inl -#include <rtems/msgmp.h> -#include <rtems/partmp.h> -#include <rtems/regionmp.h> -#include <rtems/semmp.h> - /*PAGE * * _RTEMS_tasks_Allocate @@ -51,60 +46,28 @@ STATIC INLINE void _RTEMS_tasks_Free ( /*PAGE * - * _RTEMS_tasks_Cancel_wait - * + * _RTEMS_tasks_Priority_to_Core */ - -STATIC INLINE void _RTEMS_tasks_Cancel_wait( - Thread_Control *the_thread + +STATIC INLINE Priority_Control _RTEMS_tasks_Priority_to_Core( + rtems_task_priority priority ) { - States_Control state; - States_Control remote_state; - - state = the_thread->current_state; - -/* XXX do this with the object class */ - if ( _States_Is_waiting_on_thread_queue( state ) ) { - if ( _States_Is_waiting_for_rpc_reply( state ) && - _States_Is_locally_blocked( state ) ) { - remote_state = _States_Clear( - STATES_WAITING_FOR_RPC_REPLY | STATES_TRANSIENT, - state - ); - - switch ( remote_state ) { - - case STATES_WAITING_FOR_BUFFER: - _Partition_MP_Send_extract_proxy( the_thread ); - break; - case STATES_WAITING_FOR_SEGMENT: - _Region_MP_Send_extract_proxy( the_thread ); - break; - case STATES_WAITING_FOR_SEMAPHORE: - _Semaphore_MP_Send_extract_proxy( the_thread ); - break; - case STATES_WAITING_FOR_MESSAGE: - _Message_queue_MP_Send_extract_proxy( the_thread ); - break; - } - } - _Thread_queue_Extract( the_thread->Wait.queue, the_thread ); - } - else if ( _Watchdog_Is_active( &the_thread->Timer ) ) - (void) _Watchdog_Remove( &the_thread->Timer ); + return (Priority_Control) priority; } /*PAGE * - * _RTEMS_Tasks_Priority_to_Core + * _RTEMS_tasks_Priority_is_valid + * */ -STATIC INLINE Priority_Control _RTEMS_Tasks_Priority_to_Core( - rtems_task_priority priority +STATIC INLINE boolean _RTEMS_tasks_Priority_is_valid ( + rtems_task_priority the_priority ) { - return (Priority_Control) priority; + return ( ( the_priority >= RTEMS_MINIMUM_PRIORITY ) && + ( the_priority <= RTEMS_MAXIMUM_PRIORITY ) ); } #endif diff --git a/c/src/exec/rtems/macros/asr.inl b/c/src/exec/rtems/macros/asr.inl index 421755879b..6610feea2a 100644 --- a/c/src/exec/rtems/macros/asr.inl +++ b/c/src/exec/rtems/macros/asr.inl @@ -17,7 +17,7 @@ #ifndef __INLINE_ASR_h #define __INLINE_ASR_h -#include <rtems/isr.h> +#include <rtems/core/isr.h> /*PAGE * @@ -27,6 +27,7 @@ #define _ASR_Initialize( _information ) \ { \ + (_information)->is_enabled = TRUE; \ (_information)->handler = NULL; \ (_information)->mode_set = RTEMS_DEFAULT_MODES; \ (_information)->signals_posted = 0; \ diff --git a/c/src/exec/rtems/macros/attr.inl b/c/src/exec/rtems/macros/attr.inl index 97d3463d53..27231871ba 100644 --- a/c/src/exec/rtems/macros/attr.inl +++ b/c/src/exec/rtems/macros/attr.inl @@ -78,5 +78,14 @@ #define _Attributes_Is_inherit_priority( _attribute_set ) \ ( (_attribute_set) & RTEMS_INHERIT_PRIORITY ) +/*PAGE + * + * _Attributes_Is_priority_ceiling + * + */ + +#define _Attributes_Is_priority_ceiling( _attribute_set ) \ + ( (_attribute_set) & RTEMS_PRIORITY_CEILING ) + #endif /* end of include file */ diff --git a/c/src/exec/rtems/macros/event.inl b/c/src/exec/rtems/macros/event.inl index 1d4cb78237..0d2f2e47c7 100644 --- a/c/src/exec/rtems/macros/event.inl +++ b/c/src/exec/rtems/macros/event.inl @@ -22,7 +22,19 @@ */ #define _Event_Manager_initialization() \ - _Event_Sync = FALSE + do { \ + \ + _Event_Sync = FALSE; \ + \ + /* \ + * Register the MP Process Packet routine. \ + */ \ + \ + _MPCI_Register_packet_processor( \ + MP_PACKET_EVENT, \ + _Event_MP_Process_packet \ + ); \ + } while ( 0 ) #endif /* end of include file */ diff --git a/c/src/exec/rtems/macros/modes.inl b/c/src/exec/rtems/macros/modes.inl index 4c8b35a1e8..5f71796c07 100644 --- a/c/src/exec/rtems/macros/modes.inl +++ b/c/src/exec/rtems/macros/modes.inl @@ -41,7 +41,7 @@ */ #define _Modes_Is_asr_disabled( _mode_set ) \ - ( (_mode_set) & RTEMS_ASR_MASK ) + (((_mode_set) & RTEMS_ASR_MASK) == RTEMS_NO_ASR) /*PAGE * @@ -59,8 +59,7 @@ */ #define _Modes_Is_timeslice( _mode_set ) \ - (((_mode_set) & (RTEMS_TIMESLICE_MASK|RTEMS_PREEMPT_MASK)) == \ - (RTEMS_TIMESLICE|RTEMS_PREEMPT) ) + (((_mode_set) & RTEMS_TIMESLICE_MASK) == RTEMS_TIMESLICE) /*PAGE * diff --git a/c/src/exec/rtems/macros/rtems/rtems/asr.inl b/c/src/exec/rtems/macros/rtems/rtems/asr.inl index 421755879b..6610feea2a 100644 --- a/c/src/exec/rtems/macros/rtems/rtems/asr.inl +++ b/c/src/exec/rtems/macros/rtems/rtems/asr.inl @@ -17,7 +17,7 @@ #ifndef __INLINE_ASR_h #define __INLINE_ASR_h -#include <rtems/isr.h> +#include <rtems/core/isr.h> /*PAGE * @@ -27,6 +27,7 @@ #define _ASR_Initialize( _information ) \ { \ + (_information)->is_enabled = TRUE; \ (_information)->handler = NULL; \ (_information)->mode_set = RTEMS_DEFAULT_MODES; \ (_information)->signals_posted = 0; \ diff --git a/c/src/exec/rtems/macros/rtems/rtems/attr.inl b/c/src/exec/rtems/macros/rtems/rtems/attr.inl index 97d3463d53..27231871ba 100644 --- a/c/src/exec/rtems/macros/rtems/rtems/attr.inl +++ b/c/src/exec/rtems/macros/rtems/rtems/attr.inl @@ -78,5 +78,14 @@ #define _Attributes_Is_inherit_priority( _attribute_set ) \ ( (_attribute_set) & RTEMS_INHERIT_PRIORITY ) +/*PAGE + * + * _Attributes_Is_priority_ceiling + * + */ + +#define _Attributes_Is_priority_ceiling( _attribute_set ) \ + ( (_attribute_set) & RTEMS_PRIORITY_CEILING ) + #endif /* end of include file */ diff --git a/c/src/exec/rtems/macros/rtems/rtems/event.inl b/c/src/exec/rtems/macros/rtems/rtems/event.inl index 1d4cb78237..0d2f2e47c7 100644 --- a/c/src/exec/rtems/macros/rtems/rtems/event.inl +++ b/c/src/exec/rtems/macros/rtems/rtems/event.inl @@ -22,7 +22,19 @@ */ #define _Event_Manager_initialization() \ - _Event_Sync = FALSE + do { \ + \ + _Event_Sync = FALSE; \ + \ + /* \ + * Register the MP Process Packet routine. \ + */ \ + \ + _MPCI_Register_packet_processor( \ + MP_PACKET_EVENT, \ + _Event_MP_Process_packet \ + ); \ + } while ( 0 ) #endif /* end of include file */ diff --git a/c/src/exec/rtems/macros/rtems/rtems/modes.inl b/c/src/exec/rtems/macros/rtems/rtems/modes.inl index 4c8b35a1e8..5f71796c07 100644 --- a/c/src/exec/rtems/macros/rtems/rtems/modes.inl +++ b/c/src/exec/rtems/macros/rtems/rtems/modes.inl @@ -41,7 +41,7 @@ */ #define _Modes_Is_asr_disabled( _mode_set ) \ - ( (_mode_set) & RTEMS_ASR_MASK ) + (((_mode_set) & RTEMS_ASR_MASK) == RTEMS_NO_ASR) /*PAGE * @@ -59,8 +59,7 @@ */ #define _Modes_Is_timeslice( _mode_set ) \ - (((_mode_set) & (RTEMS_TIMESLICE_MASK|RTEMS_PREEMPT_MASK)) == \ - (RTEMS_TIMESLICE|RTEMS_PREEMPT) ) + (((_mode_set) & RTEMS_TIMESLICE_MASK) == RTEMS_TIMESLICE) /*PAGE * diff --git a/c/src/exec/rtems/macros/rtems/rtems/status.inl b/c/src/exec/rtems/macros/rtems/rtems/status.inl index c4f8a523df..408cb816d1 100644 --- a/c/src/exec/rtems/macros/rtems/rtems/status.inl +++ b/c/src/exec/rtems/macros/rtems/rtems/status.inl @@ -35,13 +35,5 @@ #define rtems_are_statuses_equal( _code1, _code2 ) \ ((_code1) == (_code2)) -/* - * _Status_Is_proxy_blocking - * - */ - -#define _Status_Is_proxy_blocking( _code ) \ - ( (_code) == RTEMS_PROXY_BLOCKING ) - #endif /* end of include file */ diff --git a/c/src/exec/rtems/macros/rtems/rtems/tasks.inl b/c/src/exec/rtems/macros/rtems/rtems/tasks.inl index 243d0addc7..8dd6ff351b 100644 --- a/c/src/exec/rtems/macros/rtems/rtems/tasks.inl +++ b/c/src/exec/rtems/macros/rtems/rtems/tasks.inl @@ -17,11 +17,6 @@ #ifndef __RTEMS_TASKS_inl #define __RTEMS_TASKS_inl -#include <rtems/msgmp.h> -#include <rtems/partmp.h> -#include <rtems/regionmp.h> -#include <rtems/semmp.h> - /*PAGE * * _RTEMS_tasks_Allocate @@ -42,54 +37,22 @@ /*PAGE * - * _RTEMS_tasks_Cancel_wait - * + * _RTEMS_tasks_Priority_to_Core */ - -#define _RTEMS_tasks_Cancel_wait( _the_thread ) \ - { \ - States_Control _state; \ - States_Control _remote_state; \ - \ - _state = (_the_thread)->current_state; \ - \ - if ( _States_Is_waiting_on_thread_queue( _state ) ) { \ - if ( _States_Is_waiting_for_rpc_reply( _state ) && \ - _States_Is_locally_blocked( _state ) ) { \ - _remote_state = _States_Clear( \ - STATES_WAITING_FOR_RPC_REPLY + STATES_TRANSIENT, \ - _state \ - ); \ - \ - switch ( _remote_state ) { \ - \ - case STATES_WAITING_FOR_BUFFER: \ - _Partition_MP_Send_extract_proxy( (_the_thread) ); \ - break; \ - case STATES_WAITING_FOR_SEGMENT: \ - _Region_MP_Send_extract_proxy( (_the_thread) ); \ - break; \ - case STATES_WAITING_FOR_SEMAPHORE: \ - _Semaphore_MP_Send_extract_proxy( (_the_thread) ); \ - break; \ - case STATES_WAITING_FOR_MESSAGE: \ - _Message_queue_MP_Send_extract_proxy( (_the_thread) ); \ - break; \ - } \ - } \ - _Thread_queue_Extract( (_the_thread)->Wait.queue, (_the_thread) ); \ - } \ - else if ( _Watchdog_Is_active( &(_the_thread)->Timer ) ) \ - (void) _Watchdog_Remove( &(_the_thread)->Timer ); \ - } + +#define _RTEMS_tasks_Priority_to_Core( _priority ) \ + ((Priority_Control) (_priority)) /*PAGE * - * _RTEMS_Tasks_Priority_to_Core + * _RTEMS_tasks_Priority_is_valid + * */ -#define _RTEMS_Tasks_Priority_to_Core( _priority ) \ - ((Priority_Control) (_priority)) +#define _RTEMS_tasks_Priority_is_valid( _the_priority ) \ + ( ((_the_priority) >= RTEMS_MINIMUM_PRIORITY) && \ + ((_the_priority) <= RTEMS_MAXIMUM_PRIORITY) ) + #endif /* end of include file */ diff --git a/c/src/exec/rtems/macros/status.inl b/c/src/exec/rtems/macros/status.inl index c4f8a523df..408cb816d1 100644 --- a/c/src/exec/rtems/macros/status.inl +++ b/c/src/exec/rtems/macros/status.inl @@ -35,13 +35,5 @@ #define rtems_are_statuses_equal( _code1, _code2 ) \ ((_code1) == (_code2)) -/* - * _Status_Is_proxy_blocking - * - */ - -#define _Status_Is_proxy_blocking( _code ) \ - ( (_code) == RTEMS_PROXY_BLOCKING ) - #endif /* end of include file */ diff --git a/c/src/exec/rtems/macros/tasks.inl b/c/src/exec/rtems/macros/tasks.inl index 243d0addc7..8dd6ff351b 100644 --- a/c/src/exec/rtems/macros/tasks.inl +++ b/c/src/exec/rtems/macros/tasks.inl @@ -17,11 +17,6 @@ #ifndef __RTEMS_TASKS_inl #define __RTEMS_TASKS_inl -#include <rtems/msgmp.h> -#include <rtems/partmp.h> -#include <rtems/regionmp.h> -#include <rtems/semmp.h> - /*PAGE * * _RTEMS_tasks_Allocate @@ -42,54 +37,22 @@ /*PAGE * - * _RTEMS_tasks_Cancel_wait - * + * _RTEMS_tasks_Priority_to_Core */ - -#define _RTEMS_tasks_Cancel_wait( _the_thread ) \ - { \ - States_Control _state; \ - States_Control _remote_state; \ - \ - _state = (_the_thread)->current_state; \ - \ - if ( _States_Is_waiting_on_thread_queue( _state ) ) { \ - if ( _States_Is_waiting_for_rpc_reply( _state ) && \ - _States_Is_locally_blocked( _state ) ) { \ - _remote_state = _States_Clear( \ - STATES_WAITING_FOR_RPC_REPLY + STATES_TRANSIENT, \ - _state \ - ); \ - \ - switch ( _remote_state ) { \ - \ - case STATES_WAITING_FOR_BUFFER: \ - _Partition_MP_Send_extract_proxy( (_the_thread) ); \ - break; \ - case STATES_WAITING_FOR_SEGMENT: \ - _Region_MP_Send_extract_proxy( (_the_thread) ); \ - break; \ - case STATES_WAITING_FOR_SEMAPHORE: \ - _Semaphore_MP_Send_extract_proxy( (_the_thread) ); \ - break; \ - case STATES_WAITING_FOR_MESSAGE: \ - _Message_queue_MP_Send_extract_proxy( (_the_thread) ); \ - break; \ - } \ - } \ - _Thread_queue_Extract( (_the_thread)->Wait.queue, (_the_thread) ); \ - } \ - else if ( _Watchdog_Is_active( &(_the_thread)->Timer ) ) \ - (void) _Watchdog_Remove( &(_the_thread)->Timer ); \ - } + +#define _RTEMS_tasks_Priority_to_Core( _priority ) \ + ((Priority_Control) (_priority)) /*PAGE * - * _RTEMS_Tasks_Priority_to_Core + * _RTEMS_tasks_Priority_is_valid + * */ -#define _RTEMS_Tasks_Priority_to_Core( _priority ) \ - ((Priority_Control) (_priority)) +#define _RTEMS_tasks_Priority_is_valid( _the_priority ) \ + ( ((_the_priority) >= RTEMS_MINIMUM_PRIORITY) && \ + ((_the_priority) <= RTEMS_MAXIMUM_PRIORITY) ) + #endif /* end of include file */ diff --git a/c/src/exec/rtems/optman/no-dpmem.c b/c/src/exec/rtems/optman/no-dpmem.c index 40f343eef4..a7116fefa1 100644 --- a/c/src/exec/rtems/optman/no-dpmem.c +++ b/c/src/exec/rtems/optman/no-dpmem.c @@ -13,10 +13,13 @@ */ #include <rtems/system.h> -#include <rtems/address.h> -#include <rtems/dpmem.h> -#include <rtems/object.h> -#include <rtems/thread.h> +#include <rtems/core/address.h> +#include <rtems/core/object.h> +#include <rtems/core/thread.h> + +#include <rtems/rtems/status.h> +#include <rtems/rtems/types.h> +#include <rtems/rtems/dpmem.h> void _Dual_ported_memory_Manager_initialization( unsigned32 maximum_ports @@ -32,7 +35,7 @@ rtems_status_code rtems_port_create( Objects_Id *id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_port_ident( @@ -40,14 +43,14 @@ rtems_status_code rtems_port_ident( Objects_Id *id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_port_delete( Objects_Id id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_port_internal_to_external( @@ -56,7 +59,7 @@ rtems_status_code rtems_port_internal_to_external( void **external ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_port_external_to_internal( @@ -65,5 +68,5 @@ rtems_status_code rtems_port_external_to_internal( void **internal ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } diff --git a/c/src/exec/rtems/optman/no-event.c b/c/src/exec/rtems/optman/no-event.c index c987193711..a0b2cecee7 100644 --- a/c/src/exec/rtems/optman/no-event.c +++ b/c/src/exec/rtems/optman/no-event.c @@ -13,19 +13,20 @@ */ #include <rtems/system.h> -#include <rtems/event.h> -#include <rtems/isr.h> -#include <rtems/object.h> -#include <rtems/options.h> -#include <rtems/states.h> -#include <rtems/thread.h> +#include <rtems/rtems/status.h> +#include <rtems/rtems/event.h> +#include <rtems/core/isr.h> +#include <rtems/core/object.h> +#include <rtems/rtems/options.h> +#include <rtems/core/states.h> +#include <rtems/core/thread.h> rtems_status_code rtems_event_send( Objects_Id id, rtems_event_set event_in ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_event_receive( @@ -35,6 +36,6 @@ rtems_status_code rtems_event_receive( rtems_event_set *event_out ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } diff --git a/c/src/exec/rtems/optman/no-mp.c b/c/src/exec/rtems/optman/no-mp.c index 9446cabb29..f354397c9f 100644 --- a/c/src/exec/rtems/optman/no-mp.c +++ b/c/src/exec/rtems/optman/no-mp.c @@ -14,23 +14,18 @@ */ #include <rtems/system.h> -#include <rtems/config.h> -#include <rtems/cpu.h> -#include <rtems/event.h> -#include <rtems/fatal.h> -#include <rtems/intthrd.h> -#include <rtems/message.h> -#include <rtems/mp.h> -#include <rtems/mpci.h> -#include <rtems/mppkt.h> -#include <rtems/part.h> -#include <rtems/sem.h> -#include <rtems/signal.h> -#include <rtems/states.h> -#include <rtems/tasks.h> -#include <rtems/thread.h> -#include <rtems/threadq.h> -#include <rtems/watchdog.h> +#include <rtems/rtems/status.h> +#include <rtems/rtems/mp.h> +#include <rtems/core/cpu.h> +#include <rtems/core/interr.h> +#include <rtems/core/mpci.h> +#include <rtems/core/mppkt.h> +#include <rtems/core/states.h> +#include <rtems/core/thread.h> +#include <rtems/core/threadq.h> +#include <rtems/core/tqdata.h> +#include <rtems/core/watchdog.h> +#include <rtems/sysstate.h> void _Multiprocessing_Manager_initialization ( void ) { @@ -40,62 +35,76 @@ void rtems_multiprocessing_announce ( void ) { } -Thread _Multiprocessing_Receive_server ( - Thread_Argument ignored +void _MPCI_Handler_initialization( + MPCI_Control *users_mpci_table ) { } -void _MPCI_Handler_initialization ( void ) +void _MPCI_Initialization ( void ) { } -void _MPCI_Initialization ( void ) +void _MPCI_Register_packet_processor( + Objects_Classes the_class, + MPCI_Packet_processor the_packet_processor + +) { } - -rtems_packet_prefix *_MPCI_Get_packet ( void ) + +MP_packet_Prefix *_MPCI_Get_packet ( void ) { return NULL; } void _MPCI_Return_packet ( - rtems_packet_prefix *the_packet + MP_packet_Prefix *the_packet ) { } void _MPCI_Send_process_packet ( unsigned32 destination, - rtems_packet_prefix *the_packet + MP_packet_Prefix *the_packet ) { } -rtems_status_code _MPCI_Send_request_packet ( +unsigned32 _MPCI_Send_request_packet ( unsigned32 destination, - rtems_packet_prefix *the_packet, + MP_packet_Prefix *the_packet, States_Control extra_state ) { - return( RTEMS_NOT_CONFIGURED ); + return 0; } void _MPCI_Send_response_packet ( unsigned32 destination, - rtems_packet_prefix *the_packet + MP_packet_Prefix *the_packet ) { } -rtems_packet_prefix *_MPCI_Receive_packet ( void ) +MP_packet_Prefix *_MPCI_Receive_packet ( void ) { return NULL; } Thread_Control *_MPCI_Process_response ( - rtems_packet_prefix *the_packet + MP_packet_Prefix *the_packet ) { return NULL; } + +void _MPCI_Receive_server( void ) +{ +} + +void _MPCI_Announce ( void ) +{ +} + +/* end of file */ diff --git a/c/src/exec/rtems/optman/no-msg.c b/c/src/exec/rtems/optman/no-msg.c index 6e8503ee32..8cdfcf8090 100644 --- a/c/src/exec/rtems/optman/no-msg.c +++ b/c/src/exec/rtems/optman/no-msg.c @@ -14,16 +14,17 @@ */ #include <rtems/system.h> -#include <rtems/attr.h> -#include <rtems/chain.h> +#include <rtems/rtems/status.h> +#include <rtems/rtems/attr.h> +#include <rtems/core/chain.h> #include <rtems/config.h> -#include <rtems/isr.h> -#include <rtems/message.h> -#include <rtems/object.h> -#include <rtems/options.h> -#include <rtems/states.h> -#include <rtems/thread.h> -#include <rtems/wkspace.h> +#include <rtems/core/isr.h> +#include <rtems/rtems/message.h> +#include <rtems/core/object.h> +#include <rtems/rtems/options.h> +#include <rtems/core/states.h> +#include <rtems/core/thread.h> +#include <rtems/core/wkspace.h> void _Message_queue_Manager_initialization( unsigned32 maximum_message_queues @@ -39,7 +40,7 @@ rtems_status_code rtems_message_queue_create( Objects_Id *id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_message_queue_ident( @@ -48,14 +49,14 @@ rtems_status_code rtems_message_queue_ident( Objects_Id *id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_message_queue_delete( Objects_Id id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_message_queue_send( @@ -64,7 +65,7 @@ rtems_status_code rtems_message_queue_send( unsigned32 size ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_message_queue_urgent( @@ -73,7 +74,7 @@ rtems_status_code rtems_message_queue_urgent( unsigned32 size ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_message_queue_broadcast( @@ -83,7 +84,7 @@ rtems_status_code rtems_message_queue_broadcast( unsigned32 *count ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_message_queue_receive( @@ -94,7 +95,7 @@ rtems_status_code rtems_message_queue_receive( rtems_interval timeout ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_message_queue_flush( @@ -102,7 +103,7 @@ rtems_status_code rtems_message_queue_flush( unsigned32 *count ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } unsigned32 _Message_queue_Flush_support( @@ -130,5 +131,5 @@ rtems_status_code _Message_queue_Submit( Message_queue_Submit_types submit_type ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } diff --git a/c/src/exec/rtems/optman/no-part.c b/c/src/exec/rtems/optman/no-part.c index 0b0e51329f..45cf1a7d78 100644 --- a/c/src/exec/rtems/optman/no-part.c +++ b/c/src/exec/rtems/optman/no-part.c @@ -14,11 +14,12 @@ */ #include <rtems/system.h> -#include <rtems/address.h> +#include <rtems/rtems/status.h> +#include <rtems/core/address.h> #include <rtems/config.h> -#include <rtems/object.h> -#include <rtems/part.h> -#include <rtems/thread.h> +#include <rtems/core/object.h> +#include <rtems/rtems/part.h> +#include <rtems/core/thread.h> void _Partition_Manager_initialization( unsigned32 maximum_partitions @@ -35,7 +36,7 @@ rtems_status_code rtems_partition_create( Objects_Id *id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_partition_ident( @@ -44,14 +45,14 @@ rtems_status_code rtems_partition_ident( Objects_Id *id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_partition_delete( Objects_Id id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_partition_get_buffer( @@ -59,7 +60,7 @@ rtems_status_code rtems_partition_get_buffer( void **buffer ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_partition_return_buffer( @@ -67,5 +68,5 @@ rtems_status_code rtems_partition_return_buffer( void *buffer ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } diff --git a/c/src/exec/rtems/optman/no-region.c b/c/src/exec/rtems/optman/no-region.c index 490d1371c0..4985000cab 100644 --- a/c/src/exec/rtems/optman/no-region.c +++ b/c/src/exec/rtems/optman/no-region.c @@ -14,12 +14,13 @@ */ #include <rtems/system.h> +#include <rtems/rtems/status.h> #include <rtems/config.h> -#include <rtems/object.h> -#include <rtems/options.h> -#include <rtems/region.h> -#include <rtems/states.h> -#include <rtems/thread.h> +#include <rtems/core/object.h> +#include <rtems/rtems/options.h> +#include <rtems/rtems/region.h> +#include <rtems/core/states.h> +#include <rtems/core/thread.h> void _Region_Manager_initialization( unsigned32 maximum_regions @@ -36,7 +37,7 @@ rtems_status_code rtems_region_create( Objects_Id *id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_region_ident( @@ -44,14 +45,14 @@ rtems_status_code rtems_region_ident( Objects_Id *id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_region_delete( Objects_Id id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_region_get_segment( @@ -62,7 +63,7 @@ rtems_status_code rtems_region_get_segment( void **segment ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_region_get_segment_size( @@ -71,7 +72,7 @@ rtems_status_code rtems_region_get_segment_size( unsigned32 *size ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_region_return_segment( @@ -79,5 +80,5 @@ rtems_status_code rtems_region_return_segment( void *segment ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } diff --git a/c/src/exec/rtems/optman/no-rtmon.c b/c/src/exec/rtems/optman/no-rtmon.c index 8371f19a7f..3c633721cc 100644 --- a/c/src/exec/rtems/optman/no-rtmon.c +++ b/c/src/exec/rtems/optman/no-rtmon.c @@ -14,10 +14,13 @@ */ #include <rtems/system.h> -#include <rtems/isr.h> -#include <rtems/object.h> -#include <rtems/ratemon.h> -#include <rtems/thread.h> +#include <rtems/rtems/status.h> +#include <rtems/core/isr.h> +#include <rtems/core/object.h> +#include <rtems/core/thread.h> + +#include <rtems/rtems/types.h> +#include <rtems/rtems/ratemon.h> void _Rate_monotonic_Manager_initialization( unsigned32 maximum_periods @@ -30,7 +33,7 @@ rtems_status_code rtems_rate_monotonic_create( Objects_Id *id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_rate_monotonic_ident( @@ -38,21 +41,21 @@ rtems_status_code rtems_rate_monotonic_ident( Objects_Id *id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_rate_monotonic_cancel( Objects_Id id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_rate_monotonic_delete( Objects_Id id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_rate_monotonic_period( @@ -60,7 +63,7 @@ rtems_status_code rtems_rate_monotonic_period( rtems_interval length ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } void _Rate_monotonic_Timeout( diff --git a/c/src/exec/rtems/optman/no-sem.c b/c/src/exec/rtems/optman/no-sem.c index d96b1693e2..eabd8e12a9 100644 --- a/c/src/exec/rtems/optman/no-sem.c +++ b/c/src/exec/rtems/optman/no-sem.c @@ -14,15 +14,16 @@ */ #include <rtems/system.h> -#include <rtems/attr.h> +#include <rtems/rtems/status.h> +#include <rtems/rtems/attr.h> #include <rtems/config.h> -#include <rtems/isr.h> -#include <rtems/object.h> -#include <rtems/options.h> -#include <rtems/sem.h> -#include <rtems/states.h> -#include <rtems/thread.h> -#include <rtems/threadq.h> +#include <rtems/core/isr.h> +#include <rtems/core/object.h> +#include <rtems/rtems/options.h> +#include <rtems/rtems/sem.h> +#include <rtems/core/states.h> +#include <rtems/core/thread.h> +#include <rtems/core/threadq.h> void _Semaphore_Manager_initialization( unsigned32 maximum_semaphores @@ -38,7 +39,7 @@ rtems_status_code rtems_semaphore_create( Objects_Id *id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_semaphore_ident( @@ -47,14 +48,14 @@ rtems_status_code rtems_semaphore_ident( Objects_Id *id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_semaphore_delete( Objects_Id id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_semaphore_obtain( @@ -63,14 +64,14 @@ rtems_status_code rtems_semaphore_obtain( rtems_interval timeout ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_semaphore_release( Objects_Id id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } boolean _Semaphore_Seize( diff --git a/c/src/exec/rtems/optman/no-signal.c b/c/src/exec/rtems/optman/no-signal.c index fedbf87db3..2193881d18 100644 --- a/c/src/exec/rtems/optman/no-signal.c +++ b/c/src/exec/rtems/optman/no-signal.c @@ -14,18 +14,24 @@ */ #include <rtems/system.h> -#include <rtems/asr.h> -#include <rtems/isr.h> -#include <rtems/modes.h> -#include <rtems/signal.h> -#include <rtems/thread.h> +#include <rtems/rtems/status.h> +#include <rtems/core/isr.h> +#include <rtems/core/thread.h> +#include <rtems/rtems/asr.h> +#include <rtems/rtems/modes.h> +#include <rtems/rtems/signal.h> + +void _Signal_Manager_initialization( void ) +{ +} + rtems_status_code rtems_signal_catch( rtems_asr_entry handler, rtems_mode mode_set ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_signal_send( @@ -33,5 +39,7 @@ rtems_status_code rtems_signal_send( rtems_signal_set signal_set ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } + +/* end of file */ diff --git a/c/src/exec/rtems/optman/no-timer.c b/c/src/exec/rtems/optman/no-timer.c index 1f6deb2e4f..0e32a501a6 100644 --- a/c/src/exec/rtems/optman/no-timer.c +++ b/c/src/exec/rtems/optman/no-timer.c @@ -14,11 +14,14 @@ */ #include <rtems/system.h> -#include <rtems/object.h> -#include <rtems/thread.h> -#include <rtems/timer.h> -#include <rtems/tod.h> -#include <rtems/watchdog.h> +#include <rtems/rtems/status.h> +#include <rtems/core/object.h> +#include <rtems/core/thread.h> +#include <rtems/core/tod.h> +#include <rtems/core/watchdog.h> + +#include <rtems/rtems/types.h> +#include <rtems/rtems/timer.h> void _Timer_Manager_initialization( unsigned32 maximum_timers @@ -31,7 +34,7 @@ rtems_status_code rtems_timer_create( Objects_Id *id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_timer_ident( @@ -39,46 +42,46 @@ rtems_status_code rtems_timer_ident( Objects_Id *id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_timer_cancel( Objects_Id id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_timer_delete( Objects_Id id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_timer_fire_after( - Objects_Id id, - rtems_interval ticks, - Timer_Service routine, - void *user_data + Objects_Id id, + rtems_interval ticks, + rtems_timer_service_routine_entry routine, + void *user_data ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_timer_fire_when( - Objects_Id id, - rtems_time_of_day *wall_time, - Timer_Service routine, - void *user_data + Objects_Id id, + rtems_time_of_day *wall_time, + rtems_timer_service_routine_entry routine, + void *user_data ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_timer_reset( Objects_Id id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } diff --git a/c/src/exec/rtems/src/clock.c b/c/src/exec/rtems/src/clock.c index f82baa6337..01f61374cf 100644 --- a/c/src/exec/rtems/src/clock.c +++ b/c/src/exec/rtems/src/clock.c @@ -13,12 +13,12 @@ */ #include <rtems/system.h> -#include <rtems/clock.h> -#include <rtems/config.h> -#include <rtems/isr.h> -#include <rtems/thread.h> -#include <rtems/tod.h> -#include <rtems/watchdog.h> +#include <rtems/rtems/status.h> +#include <rtems/rtems/clock.h> +#include <rtems/core/isr.h> +#include <rtems/core/thread.h> +#include <rtems/core/tod.h> +#include <rtems/core/watchdog.h> /*PAGE * @@ -49,29 +49,29 @@ rtems_status_code rtems_clock_get( switch ( option ) { case RTEMS_CLOCK_GET_TOD: if ( !_TOD_Is_set() ) - return( RTEMS_NOT_DEFINED ); + return RTEMS_NOT_DEFINED; *(rtems_time_of_day *)time_buffer = _TOD_Current; - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; case RTEMS_CLOCK_GET_SECONDS_SINCE_EPOCH: if ( !_TOD_Is_set() ) - return( RTEMS_NOT_DEFINED ); + return RTEMS_NOT_DEFINED; *(rtems_interval *)time_buffer = _TOD_Seconds_since_epoch; - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; case RTEMS_CLOCK_GET_TICKS_SINCE_BOOT: *(rtems_interval *)time_buffer = _TOD_Ticks_since_boot; - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; case RTEMS_CLOCK_GET_TICKS_PER_SECOND: *(rtems_interval *)time_buffer = _TOD_Ticks_per_second; - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; case RTEMS_CLOCK_GET_TIME_VALUE: if ( !_TOD_Is_set() ) - return( RTEMS_NOT_DEFINED ); + return RTEMS_NOT_DEFINED; _ISR_Disable( level ); ((rtems_clock_time_value *)time_buffer)->seconds = @@ -79,13 +79,13 @@ rtems_status_code rtems_clock_get( tmp = _TOD_Current.ticks; _ISR_Enable( level ); - tmp *= _Configuration_Table->microseconds_per_tick; + tmp *= _TOD_Microseconds_per_tick; ((rtems_clock_time_value *)time_buffer)->microseconds = tmp; - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } - return( RTEMS_SUCCESSFUL ); /* should never get here */ + return RTEMS_INTERNAL_ERROR; /* should never get here */ } @@ -107,18 +107,16 @@ rtems_status_code rtems_clock_set( rtems_time_of_day *time_buffer ) { - rtems_status_code local_result; - rtems_interval seconds; + rtems_interval seconds; - local_result = _TOD_Validate( time_buffer ); - if ( rtems_is_status_successful( local_result ) ) { + if ( _TOD_Validate( time_buffer ) ) { seconds = _TOD_To_seconds( time_buffer ); _Thread_Disable_dispatch(); _TOD_Set( time_buffer, seconds ); _Thread_Enable_dispatch(); - + return RTEMS_SUCCESSFUL; } - return( local_result ); + return RTEMS_INVALID_CLOCK; } /*PAGE @@ -149,5 +147,5 @@ rtems_status_code rtems_clock_tick( void ) _Thread_Is_dispatching_enabled() ) _Thread_Dispatch(); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } diff --git a/c/src/exec/rtems/src/dpmem.c b/c/src/exec/rtems/src/dpmem.c index 522c14866b..ee41eec142 100644 --- a/c/src/exec/rtems/src/dpmem.c +++ b/c/src/exec/rtems/src/dpmem.c @@ -13,11 +13,13 @@ */ #include <rtems/system.h> -#include <rtems/support.h> -#include <rtems/address.h> -#include <rtems/dpmem.h> -#include <rtems/object.h> -#include <rtems/thread.h> +#include <rtems/rtems/status.h> +#include <rtems/rtems/support.h> +#include <rtems/core/address.h> +#include <rtems/rtems/dpmem.h> +#include <rtems/core/object.h> +#include <rtems/core/thread.h> +#include <rtems/rtems/dpmem.h> /*PAGE * @@ -78,11 +80,11 @@ rtems_status_code rtems_port_create( register Dual_ported_memory_Control *the_port; if ( !rtems_is_name_valid( name) ) - return ( RTEMS_INVALID_NAME ); + return RTEMS_INVALID_NAME; if ( !_Addresses_Is_aligned( internal_start ) || !_Addresses_Is_aligned( external_start ) ) - return( RTEMS_INVALID_ADDRESS ); + return RTEMS_INVALID_ADDRESS; _Thread_Disable_dispatch(); /* to prevent deletion */ @@ -90,7 +92,7 @@ rtems_status_code rtems_port_create( if ( !the_port ) { _Thread_Enable_dispatch(); - return( RTEMS_TOO_MANY ); + return RTEMS_TOO_MANY; } the_port->internal_base = internal_start; @@ -105,7 +107,7 @@ rtems_status_code rtems_port_create( *id = the_port->Object.id; _Thread_Enable_dispatch(); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } /*PAGE @@ -130,14 +132,16 @@ rtems_status_code rtems_port_ident( Objects_Id *id ) { - return( - _Objects_Name_to_id( - &_Dual_ported_memory_Information, - &name, - RTEMS_SEARCH_ALL_NODES, - id - ) + Objects_Name_to_id_errors status; + + status = _Objects_Name_to_id( + &_Dual_ported_memory_Information, + &name, + OBJECTS_SEARCH_ALL_NODES, + id ); + + return _Status_Object_name_errors_to_status[ status ]; } /*PAGE @@ -165,17 +169,17 @@ rtems_status_code rtems_port_delete( the_port = _Dual_ported_memory_Get( id, &location ); switch ( location ) { case OBJECTS_ERROR: - return( RTEMS_INVALID_ID ); + return RTEMS_INVALID_ID; case OBJECTS_REMOTE: /* this error cannot be returned */ - return( RTEMS_INTERNAL_ERROR ); + return RTEMS_INTERNAL_ERROR; case OBJECTS_LOCAL: _Objects_Close( &_Dual_ported_memory_Information, &the_port->Object ); _Dual_ported_memory_Free( the_port ); _Thread_Enable_dispatch(); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } - return( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */ + return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ } /*PAGE @@ -210,9 +214,9 @@ 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 ); + return RTEMS_INVALID_ID; case OBJECTS_REMOTE: /* this error cannot be returned */ - return( RTEMS_INTERNAL_ERROR ); + return RTEMS_INTERNAL_ERROR; case OBJECTS_LOCAL: ending = _Addresses_Subtract( internal, the_port->internal_base ); if ( ending > the_port->length ) @@ -221,10 +225,10 @@ rtems_status_code rtems_port_internal_to_external( *external = _Addresses_Add_offset( the_port->external_base, ending ); _Thread_Enable_dispatch(); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } - return( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */ + return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ } /*PAGE @@ -259,9 +263,9 @@ 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 ); + return RTEMS_INVALID_ID; case OBJECTS_REMOTE: /* this error cannot be returned */ - return( RTEMS_INTERNAL_ERROR ); + return RTEMS_INTERNAL_ERROR; case OBJECTS_LOCAL: ending = _Addresses_Subtract( external, the_port->external_base ); if ( ending > the_port->length ) @@ -270,8 +274,8 @@ rtems_status_code rtems_port_external_to_internal( *internal = _Addresses_Add_offset( the_port->internal_base, ending ); _Thread_Enable_dispatch(); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } - return( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */ + return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ } diff --git a/c/src/exec/rtems/src/event.c b/c/src/exec/rtems/src/event.c index ec14c2aaa9..833358bca8 100644 --- a/c/src/exec/rtems/src/event.c +++ b/c/src/exec/rtems/src/event.c @@ -13,12 +13,14 @@ */ #include <rtems/system.h> -#include <rtems/event.h> -#include <rtems/isr.h> -#include <rtems/object.h> -#include <rtems/options.h> -#include <rtems/states.h> -#include <rtems/thread.h> +#include <rtems/rtems/status.h> +#include <rtems/rtems/event.h> +#include <rtems/core/isr.h> +#include <rtems/core/object.h> +#include <rtems/rtems/options.h> +#include <rtems/core/states.h> +#include <rtems/core/thread.h> +#include <rtems/rtems/tasks.h> /*PAGE * @@ -42,11 +44,12 @@ rtems_status_code rtems_event_send( { register Thread_Control *the_thread; Objects_Locations location; + RTEMS_API_Control *api; the_thread = _Thread_Get( id, &location ); switch ( location ) { case OBJECTS_ERROR: - return( RTEMS_INVALID_ID ); + return RTEMS_INVALID_ID; case OBJECTS_REMOTE: return( _Event_MP_Send_request_packet( @@ -56,13 +59,14 @@ rtems_status_code rtems_event_send( ) ); case OBJECTS_LOCAL: - _Event_sets_Post( event_in, &the_thread->RTEMS_API->pending_events ); + api = the_thread->API_Extensions[ THREAD_API_RTEMS ]; + _Event_sets_Post( event_in, &api->pending_events ); _Event_Surrender( the_thread ); _Thread_Enable_dispatch(); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } - return( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */ + return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ } /*PAGE @@ -90,14 +94,17 @@ rtems_status_code rtems_event_receive( rtems_event_set *event_out ) { + RTEMS_API_Control *api; + + api = _Thread_Executing->API_Extensions[ THREAD_API_RTEMS ]; + if ( _Event_sets_Is_empty( event_in ) ) { - *event_out = _Thread_Executing->RTEMS_API->pending_events; - return( RTEMS_SUCCESSFUL ); + *event_out = api->pending_events; + return RTEMS_SUCCESSFUL; } _Thread_Disable_dispatch(); - _Event_Seize( event_in, option_set, ticks ); + _Event_Seize( event_in, option_set, ticks, event_out ); _Thread_Enable_dispatch(); - *event_out = _Thread_Executing->RTEMS_API->events_out; return( _Thread_Executing->Wait.return_code ); } diff --git a/c/src/exec/rtems/src/eventmp.c b/c/src/exec/rtems/src/eventmp.c index 4bc5925c2a..e477c9d3b5 100644 --- a/c/src/exec/rtems/src/eventmp.c +++ b/c/src/exec/rtems/src/eventmp.c @@ -13,13 +13,15 @@ */ #include <rtems/system.h> -#include <rtems/event.h> -#include <rtems/mpci.h> -#include <rtems/mppkt.h> -#include <rtems/object.h> -#include <rtems/options.h> -#include <rtems/states.h> -#include <rtems/thread.h> +#include <rtems/rtems/status.h> +#include <rtems/rtems/event.h> +#include <rtems/core/mpci.h> +#include <rtems/core/mppkt.h> +#include <rtems/core/object.h> +#include <rtems/rtems/options.h> +#include <rtems/core/states.h> +#include <rtems/core/thread.h> +#include <rtems/rtems/support.h> /*PAGE * @@ -49,7 +51,7 @@ rtems_status_code _Event_MP_Send_request_packet ( case EVENT_MP_SEND_REQUEST: the_packet = _Event_MP_Get_packet(); - the_packet->Prefix.the_class = RTEMS_MP_PACKET_EVENT; + the_packet->Prefix.the_class = MP_PACKET_EVENT; the_packet->Prefix.length = sizeof ( Event_MP_Packet ); the_packet->Prefix.to_convert = sizeof ( Event_MP_Packet ); the_packet->operation = operation; diff --git a/c/src/exec/rtems/src/intr.c b/c/src/exec/rtems/src/intr.c index 25f5176967..dbcc23434c 100644 --- a/c/src/exec/rtems/src/intr.c +++ b/c/src/exec/rtems/src/intr.c @@ -14,10 +14,9 @@ */ #include <rtems/system.h> -#include <rtems/isr.h> -#include <rtems/stack.h> -#include <rtems/intr.h> -#include <rtems/wkspace.h> +#include <rtems/rtems/status.h> +#include <rtems/core/isr.h> +#include <rtems/rtems/intr.h> /* _Interrupt_Manager_initialization * @@ -30,25 +29,6 @@ void _Interrupt_Manager_initialization( void ) { -#if ( CPU_ALLOCATE_INTERRUPT_STACK == TRUE ) - - if ( _CPU_Table.interrupt_stack_size < RTEMS_MINIMUM_STACK_SIZE ) - rtems_fatal_error_occurred( RTEMS_INVALID_SIZE ); - - _CPU_Interrupt_stack_low = - _Workspace_Allocate_or_fatal_error( _CPU_Table.interrupt_stack_size ); - - _CPU_Interrupt_stack_high = _Addresses_Add_offset( - _CPU_Interrupt_stack_low, - _CPU_Table.interrupt_stack_size - ); - -#endif - -#if ( CPU_HAS_HARDWARE_INTERRUPT_STACK == TRUE ) - _CPU_Install_interrupt_stack(); -#endif - } /* rtems_interrupt_catch @@ -73,13 +53,13 @@ rtems_status_code rtems_interrupt_catch( ) { if ( !_ISR_Is_vector_number_valid( vector ) ) - return( RTEMS_INVALID_NUMBER ); + return RTEMS_INVALID_NUMBER; if ( !_ISR_Is_valid_user_handler( new_isr_handler ) ) - return( RTEMS_INVALID_ADDRESS ); + return RTEMS_INVALID_ADDRESS; _ISR_Install_vector( vector, (proc_ptr)new_isr_handler, (proc_ptr *)old_isr_handler ); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } diff --git a/c/src/exec/rtems/src/mp.c b/c/src/exec/rtems/src/mp.c index c555ffb3f1..f17d3b13e6 100644 --- a/c/src/exec/rtems/src/mp.c +++ b/c/src/exec/rtems/src/mp.c @@ -14,23 +14,9 @@ */ #include <rtems/system.h> -#include <rtems/config.h> -#include <rtems/cpu.h> -#include <rtems/event.h> -#include <rtems/fatal.h> -#include <rtems/intthrd.h> -#include <rtems/message.h> -#include <rtems/mp.h> -#include <rtems/mpci.h> -#include <rtems/mppkt.h> -#include <rtems/part.h> -#include <rtems/sem.h> -#include <rtems/signal.h> -#include <rtems/states.h> -#include <rtems/tasks.h> -#include <rtems/thread.h> -#include <rtems/threadq.h> -#include <rtems/watchdog.h> +#include <rtems/rtems/status.h> +#include <rtems/rtems/mp.h> +#include <rtems/core/mpci.h> /*PAGE * @@ -40,11 +26,6 @@ void _Multiprocessing_Manager_initialization ( void ) { - if ( _Configuration_MP_table->node < 1 || - _Configuration_MP_table->node > _Configuration_MP_table->maximum_nodes ) - rtems_fatal_error_occurred( RTEMS_INVALID_NODE ); - - _Internal_threads_Set_MP_receive_server( _Multiprocessing_Receive_server ); } /*PAGE @@ -55,67 +36,7 @@ void _Multiprocessing_Manager_initialization ( void ) void rtems_multiprocessing_announce ( void ) { - _Thread_Disable_dispatch(); - _Event_sets_Post( - RTEMS_EVENT_0, - &_Internal_threads_System_initialization_thread->RTEMS_API->pending_events - ); - _Event_Surrender( _Internal_threads_System_initialization_thread ); - _Thread_Enable_dispatch(); -} - -/*PAGE - * - * _Multiprocessing_Receive_server - * - */ - -typedef void (*packet_processor)( rtems_packet_prefix * ); - -packet_processor _Multiprocessor_Packet_processors[] = { - _Internal_threads_MP_Process_packet, /* RTEMS_MP_PACKET_INTERNAL_THREADS */ - _RTEMS_tasks_MP_Process_packet, /* RTEMS_MP_PACKET_TASKS */ - _Message_queue_MP_Process_packet, /* RTEMS_MP_PACKET_MESSAGE_QUEUE */ - _Semaphore_MP_Process_packet, /* RTEMS_MP_PACKET_SEMAPHORE */ - _Partition_MP_Process_packet, /* RTEMS_MP_PACKET_PARTITION */ - 0, /* RTEMS_MP_PACKET_REGION */ - _Event_MP_Process_packet, /* RTEMS_MP_PACKET_EVENT */ - _Signal_MP_Process_packet /* RTEMS_MP_PACKET_SIGNAL */ -}; - -Thread _Multiprocessing_Receive_server ( - Thread_Argument ignored -) -{ - - rtems_packet_prefix *the_packet; - packet_processor the_function; - - for ( ; ; ) { - - _Thread_Disable_dispatch(); - _Event_Seize( RTEMS_EVENT_0, RTEMS_DEFAULT_OPTIONS, RTEMS_NO_TIMEOUT ); - _Thread_Enable_dispatch(); - - for ( ; ; ) { - the_packet = _MPCI_Receive_packet(); - - if ( !the_packet ) - break; - - _Thread_Executing->receive_packet = the_packet; - - if ( !_Mp_packet_Is_valid_packet_class ( the_packet->the_class ) ) - break; - - the_function = _Multiprocessor_Packet_processors[ the_packet->the_class ]; - - if ( !the_function ) - break; - - (*the_function)( the_packet ); - } - } + _MPCI_Announce(); } /* end of file */ diff --git a/c/src/exec/rtems/src/msg.c b/c/src/exec/rtems/src/msg.c index ff4683f880..a69ae777c6 100644 --- a/c/src/exec/rtems/src/msg.c +++ b/c/src/exec/rtems/src/msg.c @@ -14,18 +14,19 @@ */ #include <rtems/system.h> -#include <rtems/attr.h> -#include <rtems/chain.h> -#include <rtems/config.h> -#include <rtems/isr.h> -#include <rtems/message.h> -#include <rtems/object.h> -#include <rtems/options.h> -#include <rtems/states.h> -#include <rtems/support.h> -#include <rtems/thread.h> -#include <rtems/wkspace.h> -#include <rtems/mpci.h> +#include <rtems/rtems/status.h> +#include <rtems/rtems/attr.h> +#include <rtems/core/chain.h> +#include <rtems/core/isr.h> +#include <rtems/rtems/message.h> +#include <rtems/core/object.h> +#include <rtems/rtems/options.h> +#include <rtems/core/states.h> +#include <rtems/rtems/support.h> +#include <rtems/core/thread.h> +#include <rtems/core/wkspace.h> +#include <rtems/core/mpci.h> +#include <rtems/sysstate.h> /*PAGE * @@ -54,6 +55,16 @@ void _Message_queue_Manager_initialization( RTEMS_MAXIMUM_NAME_LENGTH, FALSE ); + + /* + * Register the MP Process Packet routine. + */ + + _MPCI_Register_packet_processor( + MP_PACKET_MESSAGE_QUEUE, + _Message_queue_MP_Process_packet + ); + } /*PAGE @@ -72,7 +83,7 @@ Message_queue_Control *_Message_queue_Allocate ( unsigned32 message_buffering_required; unsigned32 allocated_message_size; - mq = \ + mq = (Message_queue_Control *)_Objects_Allocate(&_Message_queue_Information); if (mq == 0) @@ -144,11 +155,11 @@ rtems_status_code rtems_message_queue_create( register Message_queue_Control *the_message_queue; if ( !rtems_is_name_valid( name ) ) - return ( RTEMS_INVALID_NAME ); + return RTEMS_INVALID_NAME; - if ( _Attributes_Is_global( attribute_set ) && - !_Configuration_Is_multiprocessing() ) - return( RTEMS_MP_NOT_CONFIGURED ); + if ( _Attributes_Is_global( attribute_set ) && + !_System_state_Is_multiprocessing ) + return RTEMS_MP_NOT_CONFIGURED; if (count == 0) return RTEMS_INVALID_NUMBER; @@ -164,8 +175,7 @@ rtems_status_code rtems_message_queue_create( */ if ( _Attributes_Is_global( attribute_set ) && - _Configuration_MPCI_table && - (_Configuration_MPCI_table->maximum_packet_size < max_message_size)) + (_MPCI_table->maximum_packet_size < max_message_size)) { return RTEMS_INVALID_SIZE; } @@ -177,7 +187,7 @@ rtems_status_code rtems_message_queue_create( if ( !the_message_queue ) { _Thread_Enable_dispatch(); - return( RTEMS_TOO_MANY ); + return RTEMS_TOO_MANY; } if ( _Attributes_Is_global( attribute_set ) && @@ -201,7 +211,8 @@ rtems_status_code rtems_message_queue_create( _Attributes_Is_priority( attribute_set ) ? THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO, STATES_WAITING_FOR_MESSAGE, - _Message_queue_MP_Send_extract_proxy + _Message_queue_MP_Send_extract_proxy, + RTEMS_TIMEOUT ); _Objects_Open( @@ -221,7 +232,7 @@ rtems_status_code rtems_message_queue_create( ); _Thread_Enable_dispatch(); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } /*PAGE @@ -248,12 +259,16 @@ rtems_status_code rtems_message_queue_ident( Objects_Id *id ) { - return _Objects_Name_to_id( + Objects_Name_to_id_errors status; + + status = _Objects_Name_to_id( &_Message_queue_Information, &name, node, id ); + + return _Status_Object_name_errors_to_status[ status ]; } /*PAGE @@ -281,10 +296,10 @@ rtems_status_code rtems_message_queue_delete( the_message_queue = _Message_queue_Get( id, &location ); switch ( location ) { case OBJECTS_ERROR: - return( RTEMS_INVALID_ID ); + return RTEMS_INVALID_ID; case OBJECTS_REMOTE: _Thread_Dispatch(); - return( RTEMS_ILLEGAL_ON_REMOTE_OBJECT ); + return RTEMS_ILLEGAL_ON_REMOTE_OBJECT; case OBJECTS_LOCAL: _Objects_Close( &_Message_queue_Information, &the_message_queue->Object ); @@ -294,7 +309,8 @@ rtems_status_code rtems_message_queue_delete( else _Thread_queue_Flush( &the_message_queue->Wait_queue, - _Message_queue_MP_Send_object_was_deleted + _Message_queue_MP_Send_object_was_deleted, + RTEMS_OBJECT_WAS_DELETED ); _Message_queue_Free( the_message_queue ); @@ -314,10 +330,10 @@ rtems_status_code rtems_message_queue_delete( } _Thread_Enable_dispatch(); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } - return( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */ + return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ } /*PAGE @@ -403,7 +419,7 @@ rtems_status_code rtems_message_queue_broadcast( the_message_queue = _Message_queue_Get( id, &location ); switch ( location ) { case OBJECTS_ERROR: - return( RTEMS_INVALID_ID ); + return RTEMS_INVALID_ID; case OBJECTS_REMOTE: _Thread_Executing->Wait.return_argument = count; @@ -436,7 +452,7 @@ rtems_status_code rtems_message_queue_broadcast( waitp->return_argument, constrained_size); - *waitp->Extra.message_size_p = constrained_size; + *(rtems_unsigned32 *)the_thread->Wait.return_argument_1 = size; if ( !_Objects_Is_local_id( the_thread->Object.id ) ) { the_thread->receive_packet->return_code = RTEMS_SUCCESSFUL; @@ -450,7 +466,7 @@ rtems_status_code rtems_message_queue_broadcast( } _Thread_Enable_dispatch(); *count = number_broadcasted; - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } default: @@ -491,11 +507,9 @@ rtems_status_code rtems_message_queue_receive( switch ( location ) { case OBJECTS_ERROR: - return( RTEMS_INVALID_ID ); + return RTEMS_INVALID_ID; case OBJECTS_REMOTE: - _Thread_Executing->Wait.return_argument = buffer; - return _Message_queue_MP_Send_request_packet( MESSAGE_QUEUE_MP_RECEIVE_REQUEST, id, @@ -517,7 +531,7 @@ rtems_status_code rtems_message_queue_receive( return _Thread_Executing->Wait.return_code; } - return( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */ + return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ } /*PAGE @@ -549,7 +563,7 @@ rtems_status_code rtems_message_queue_flush( the_message_queue = _Message_queue_Get( id, &location ); switch ( location ) { case OBJECTS_ERROR: - return( RTEMS_INVALID_ID ); + return RTEMS_INVALID_ID; case OBJECTS_REMOTE: _Thread_Executing->Wait.return_argument = count; @@ -569,10 +583,10 @@ rtems_status_code rtems_message_queue_flush( else *count = 0; _Thread_Enable_dispatch(); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } - return( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */ + return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ } /*PAGE @@ -633,9 +647,9 @@ boolean _Message_queue_Seize( the_message_queue->Wait_queue.sync = TRUE; executing->Wait.queue = &the_message_queue->Wait_queue; executing->Wait.id = the_message_queue->Object.id; - executing->Wait.option_set = option_set; - executing->Wait.return_argument = (unsigned32 *)buffer; - executing->Wait.Extra.message_size_p = size_p; + executing->Wait.option = option_set; + executing->Wait.return_argument = (void *)buffer; + executing->Wait.return_argument_1 = (void *)size_p; _ISR_Enable( level ); return FALSE; } @@ -724,7 +738,7 @@ rtems_status_code _Message_queue_Submit( switch ( location ) { case OBJECTS_ERROR: - return( RTEMS_INVALID_ID ); + return RTEMS_INVALID_ID; case OBJECTS_REMOTE: switch ( submit_type ) { @@ -770,7 +784,7 @@ rtems_status_code _Message_queue_Submit( the_thread->Wait.return_argument, size ); - *the_thread->Wait.Extra.message_size_p = size; + *(rtems_unsigned32 *)the_thread->Wait.return_argument_1 = size; if ( !_Objects_Is_local_id( the_thread->Object.id ) ) { the_thread->receive_packet->return_code = RTEMS_SUCCESSFUL; @@ -783,7 +797,7 @@ rtems_status_code _Message_queue_Submit( } _Thread_Enable_dispatch(); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } /* @@ -794,13 +808,13 @@ rtems_status_code _Message_queue_Submit( if ( the_message_queue->number_of_pending_messages == the_message_queue->maximum_pending_messages ) { _Thread_Enable_dispatch(); - return( RTEMS_TOO_MANY ); + return RTEMS_TOO_MANY; } the_message = _Message_queue_Allocate_message_buffer(the_message_queue); if ( the_message == 0) { _Thread_Enable_dispatch(); - return( RTEMS_UNSATISFIED ); + return RTEMS_UNSATISFIED; } _Message_queue_Copy_buffer( buffer, the_message->Contents.buffer, size ); @@ -818,7 +832,7 @@ rtems_status_code _Message_queue_Submit( } _Thread_Enable_dispatch(); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; default: return RTEMS_INTERNAL_ERROR; /* And they were such nice boys, too! */ diff --git a/c/src/exec/rtems/src/msgmp.c b/c/src/exec/rtems/src/msgmp.c index 48e572c43b..06afd4eedc 100644 --- a/c/src/exec/rtems/src/msgmp.c +++ b/c/src/exec/rtems/src/msgmp.c @@ -14,14 +14,15 @@ */ #include <rtems/system.h> -#include <rtems/message.h> -#include <rtems/mpci.h> -#include <rtems/msgmp.h> -#include <rtems/object.h> -#include <rtems/options.h> -#include <rtems/thread.h> -#include <rtems/watchdog.h> -#include <rtems/config.h> +#include <rtems/rtems/status.h> +#include <rtems/rtems/message.h> +#include <rtems/core/mpci.h> +#include <rtems/rtems/msgmp.h> +#include <rtems/core/object.h> +#include <rtems/rtems/options.h> +#include <rtems/core/thread.h> +#include <rtems/core/watchdog.h> +#include <rtems/rtems/support.h> /*PAGE * @@ -46,7 +47,7 @@ void _Message_queue_MP_Send_process_packet ( case MESSAGE_QUEUE_MP_EXTRACT_PROXY: the_packet = _Message_queue_MP_Get_packet(); - the_packet->Prefix.the_class = RTEMS_MP_PACKET_MESSAGE_QUEUE; + the_packet->Prefix.the_class = MP_PACKET_MESSAGE_QUEUE; the_packet->Prefix.length = sizeof ( Message_queue_MP_Packet ); the_packet->Prefix.to_convert = sizeof ( Message_queue_MP_Packet ); the_packet->operation = operation; @@ -102,10 +103,10 @@ rtems_status_code _Message_queue_MP_Send_request_packet ( case MESSAGE_QUEUE_MP_FLUSH_REQUEST: the_packet = _Message_queue_MP_Get_packet(); - the_packet->Prefix.the_class = RTEMS_MP_PACKET_MESSAGE_QUEUE; + the_packet->Prefix.the_class = MP_PACKET_MESSAGE_QUEUE; the_packet->Prefix.length = sizeof(Message_queue_MP_Packet); if ( size_p ) - the_packet->Prefix.length += *size_p; + the_packet->Prefix.length += *size_p; the_packet->Prefix.to_convert = sizeof(Message_queue_MP_Packet); /* @@ -114,9 +115,7 @@ rtems_status_code _Message_queue_MP_Send_request_packet ( * we are about to slam in the payload */ - if (the_packet->Prefix.length > - _Configuration_MPCI_table->maximum_packet_size) - { + if (the_packet->Prefix.length > _MPCI_table->maximum_packet_size) { _Thread_Enable_dispatch(); return RTEMS_INVALID_SIZE; } @@ -132,8 +131,7 @@ rtems_status_code _Message_queue_MP_Send_request_packet ( * Copy the data into place if needed */ - if (buffer) - { + if (buffer) { the_packet->Buffer.size = *size_p; _Message_queue_Copy_buffer(buffer, the_packet->Buffer.buffer, @@ -148,7 +146,7 @@ rtems_status_code _Message_queue_MP_Send_request_packet ( case MESSAGE_QUEUE_MP_RECEIVE_REQUEST: the_packet = _Message_queue_MP_Get_packet(); - the_packet->Prefix.the_class = RTEMS_MP_PACKET_MESSAGE_QUEUE; + the_packet->Prefix.the_class = MP_PACKET_MESSAGE_QUEUE; the_packet->Prefix.length = sizeof(Message_queue_MP_Packet); the_packet->Prefix.to_convert = sizeof(Message_queue_MP_Packet); @@ -160,8 +158,8 @@ rtems_status_code _Message_queue_MP_Send_request_packet ( the_packet->option_set = option_set; the_packet->size = 0; /* just in case of an error */ - _Thread_Executing->Wait.return_argument = (unsigned32 *)buffer; - _Thread_Executing->Wait.Extra.message_size_p = size_p; + _Thread_Executing->Wait.return_argument = (unsigned32 *)buffer; + _Thread_Executing->Wait.return_argument_1 = size_p; return _MPCI_Send_request_packet(rtems_get_node(message_queue_id), &the_packet->Prefix, @@ -296,7 +294,7 @@ void _Message_queue_MP_Process_packet ( the_packet->Prefix.timeout ); - if ( ! _Status_Is_proxy_blocking( the_packet->Prefix.return_code ) ) + if ( ! _Thread_Is_proxy_blocking( the_packet->Prefix.return_code ) ) _Message_queue_MP_Send_response_packet( MESSAGE_QUEUE_MP_RECEIVE_RESPONSE, the_packet->Prefix.id, @@ -309,7 +307,8 @@ void _Message_queue_MP_Process_packet ( the_thread = _MPCI_Process_response( the_packet_prefix ); if (the_packet->Prefix.return_code == RTEMS_SUCCESSFUL) { - *the_thread->Wait.Extra.message_size_p = the_packet->size; + *(rtems_unsigned32 *)the_thread->Wait.return_argument_1 = + the_packet->size; _Message_queue_Copy_buffer( the_packet->Buffer.buffer, diff --git a/c/src/exec/rtems/src/part.c b/c/src/exec/rtems/src/part.c index 3d21eed416..ee714f64c1 100644 --- a/c/src/exec/rtems/src/part.c +++ b/c/src/exec/rtems/src/part.c @@ -14,12 +14,13 @@ */ #include <rtems/system.h> -#include <rtems/support.h> -#include <rtems/address.h> -#include <rtems/config.h> -#include <rtems/object.h> -#include <rtems/part.h> -#include <rtems/thread.h> +#include <rtems/rtems/status.h> +#include <rtems/rtems/support.h> +#include <rtems/core/address.h> +#include <rtems/core/object.h> +#include <rtems/rtems/part.h> +#include <rtems/core/thread.h> +#include <rtems/sysstate.h> /*PAGE * @@ -49,6 +50,15 @@ void _Partition_Manager_initialization( FALSE ); + /* + * Register the MP Process Packet routine. + */ + + _MPCI_Register_packet_processor( + MP_PACKET_PARTITION, + _Partition_MP_Process_packet + ); + } /*PAGE @@ -84,18 +94,18 @@ rtems_status_code rtems_partition_create( register Partition_Control *the_partition; if ( !rtems_is_name_valid( name ) ) - return ( RTEMS_INVALID_NAME ); + return RTEMS_INVALID_NAME; if ( length == 0 || buffer_size == 0 || length < buffer_size || !_Partition_Is_buffer_size_aligned( buffer_size ) ) - return ( RTEMS_INVALID_SIZE ); + return RTEMS_INVALID_SIZE; if ( !_Addresses_Is_aligned( starting_address ) ) - return( RTEMS_INVALID_ADDRESS ); + return RTEMS_INVALID_ADDRESS; - if ( _Attributes_Is_global( attribute_set ) && - !_Configuration_Is_multiprocessing() ) - return( RTEMS_MP_NOT_CONFIGURED ); + if ( _Attributes_Is_global( attribute_set ) && + !_System_state_Is_multiprocessing ) + return RTEMS_MP_NOT_CONFIGURED; _Thread_Disable_dispatch(); /* prevents deletion */ @@ -103,7 +113,7 @@ rtems_status_code rtems_partition_create( if ( !the_partition ) { _Thread_Enable_dispatch(); - return( RTEMS_TOO_MANY ); + return RTEMS_TOO_MANY; } if ( _Attributes_Is_global( attribute_set ) && @@ -111,7 +121,7 @@ rtems_status_code rtems_partition_create( the_partition->Object.id, FALSE ) ) ) { _Partition_Free( the_partition ); _Thread_Enable_dispatch(); - return( RTEMS_TOO_MANY ); + return RTEMS_TOO_MANY; } the_partition->starting_address = starting_address; the_partition->length = length; @@ -134,7 +144,7 @@ rtems_status_code rtems_partition_create( ); _Thread_Enable_dispatch(); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } /*PAGE @@ -161,7 +171,11 @@ rtems_status_code rtems_partition_ident( Objects_Id *id ) { - return _Objects_Name_to_id( &_Partition_Information, &name, node, id ); + Objects_Name_to_id_errors status; + + status = _Objects_Name_to_id( &_Partition_Information, &name, node, id ); + + return _Status_Object_name_errors_to_status[ status ]; } /*PAGE @@ -190,10 +204,10 @@ rtems_status_code rtems_partition_delete( the_partition = _Partition_Get( id, &location ); switch ( location ) { case OBJECTS_ERROR: - return( RTEMS_INVALID_ID ); + return RTEMS_INVALID_ID; case OBJECTS_REMOTE: _Thread_Dispatch(); - return( RTEMS_ILLEGAL_ON_REMOTE_OBJECT ); + return RTEMS_ILLEGAL_ON_REMOTE_OBJECT; case OBJECTS_LOCAL: if ( the_partition->number_of_used_blocks == 0 ) { _Objects_Close( &_Partition_Information, &the_partition->Object ); @@ -214,13 +228,13 @@ rtems_status_code rtems_partition_delete( } _Thread_Enable_dispatch(); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } _Thread_Enable_dispatch(); - return( RTEMS_RESOURCE_IN_USE ); + return RTEMS_RESOURCE_IN_USE; } - return( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */ + return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ } /*PAGE @@ -251,7 +265,7 @@ rtems_status_code rtems_partition_get_buffer( the_partition = _Partition_Get( id, &location ); switch ( location ) { case OBJECTS_ERROR: - return( RTEMS_INVALID_ID ); + return RTEMS_INVALID_ID; case OBJECTS_REMOTE: _Thread_Executing->Wait.return_argument = buffer; return( @@ -267,13 +281,13 @@ rtems_status_code rtems_partition_get_buffer( the_partition->number_of_used_blocks += 1; _Thread_Enable_dispatch(); *buffer = the_buffer; - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } _Thread_Enable_dispatch(); - return( RTEMS_UNSATISFIED ); + return RTEMS_UNSATISFIED; } - return( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */ + return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ } /*PAGE @@ -303,7 +317,7 @@ rtems_status_code rtems_partition_return_buffer( the_partition = _Partition_Get( id, &location ); switch ( location ) { case OBJECTS_ERROR: - return( RTEMS_INVALID_ID ); + return RTEMS_INVALID_ID; case OBJECTS_REMOTE: return( _Partition_MP_Send_request_packet( @@ -317,11 +331,11 @@ rtems_status_code rtems_partition_return_buffer( _Partition_Free_buffer( the_partition, buffer ); the_partition->number_of_used_blocks -= 1; _Thread_Enable_dispatch(); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } _Thread_Enable_dispatch(); - return( RTEMS_INVALID_ADDRESS ); + return RTEMS_INVALID_ADDRESS; } - return( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */ + return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ } diff --git a/c/src/exec/rtems/src/partmp.c b/c/src/exec/rtems/src/partmp.c index 0097844183..8fc36c6a04 100644 --- a/c/src/exec/rtems/src/partmp.c +++ b/c/src/exec/rtems/src/partmp.c @@ -14,12 +14,14 @@ */ #include <rtems/system.h> -#include <rtems/mpci.h> -#include <rtems/mppkt.h> -#include <rtems/object.h> -#include <rtems/options.h> -#include <rtems/part.h> -#include <rtems/thread.h> +#include <rtems/rtems/status.h> +#include <rtems/core/mpci.h> +#include <rtems/core/mppkt.h> +#include <rtems/core/object.h> +#include <rtems/rtems/options.h> +#include <rtems/rtems/part.h> +#include <rtems/core/thread.h> +#include <rtems/rtems/support.h> /*PAGE * @@ -44,7 +46,7 @@ void _Partition_MP_Send_process_packet ( case PARTITION_MP_EXTRACT_PROXY: the_packet = _Partition_MP_Get_packet(); - the_packet->Prefix.the_class = RTEMS_MP_PACKET_PARTITION; + the_packet->Prefix.the_class = MP_PACKET_PARTITION; the_packet->Prefix.length = sizeof ( Partition_MP_Packet ); the_packet->Prefix.to_convert = sizeof ( Partition_MP_Packet ); the_packet->operation = operation; @@ -88,7 +90,7 @@ rtems_status_code _Partition_MP_Send_request_packet ( case PARTITION_MP_RETURN_BUFFER_REQUEST: the_packet = _Partition_MP_Get_packet(); - the_packet->Prefix.the_class = RTEMS_MP_PACKET_PARTITION; + the_packet->Prefix.the_class = MP_PACKET_PARTITION; the_packet->Prefix.length = sizeof ( Partition_MP_Packet ); the_packet->Prefix.to_convert = sizeof ( Partition_MP_Packet ); the_packet->operation = operation; diff --git a/c/src/exec/rtems/src/ratemon.c b/c/src/exec/rtems/src/ratemon.c index c98de762af..a94ba66ea0 100644 --- a/c/src/exec/rtems/src/ratemon.c +++ b/c/src/exec/rtems/src/ratemon.c @@ -14,11 +14,12 @@ */ #include <rtems/system.h> -#include <rtems/support.h> -#include <rtems/isr.h> -#include <rtems/object.h> -#include <rtems/ratemon.h> -#include <rtems/thread.h> +#include <rtems/rtems/status.h> +#include <rtems/rtems/support.h> +#include <rtems/core/isr.h> +#include <rtems/core/object.h> +#include <rtems/rtems/ratemon.h> +#include <rtems/core/thread.h> /*PAGE * @@ -77,7 +78,7 @@ rtems_status_code rtems_rate_monotonic_create( Rate_monotonic_Control *the_period; if ( !rtems_is_name_valid( name ) ) - return( RTEMS_INVALID_NAME ); + return RTEMS_INVALID_NAME; _Thread_Disable_dispatch(); /* to prevent deletion */ @@ -85,7 +86,7 @@ rtems_status_code rtems_rate_monotonic_create( if ( !the_period ) { _Thread_Enable_dispatch(); - return( RTEMS_TOO_MANY ); + return RTEMS_TOO_MANY; } the_period->owner = _Thread_Executing; @@ -95,7 +96,7 @@ rtems_status_code rtems_rate_monotonic_create( *id = the_period->Object.id; _Thread_Enable_dispatch(); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } /*PAGE @@ -120,12 +121,16 @@ rtems_status_code rtems_rate_monotonic_ident( Objects_Id *id ) { - return _Objects_Name_to_id( + Objects_Name_to_id_errors status; + + status = _Objects_Name_to_id( &_Rate_monotonic_Information, &name, - RTEMS_SEARCH_LOCAL_NODE, + OBJECTS_SEARCH_LOCAL_NODE, id ); + + return _Status_Object_name_errors_to_status[ status ]; } /*PAGE @@ -152,21 +157,21 @@ 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: /* should never return this */ - return( RTEMS_INTERNAL_ERROR ); + return RTEMS_INVALID_ID; + case OBJECTS_REMOTE: + return RTEMS_INTERNAL_ERROR; /* should never return this */ case OBJECTS_LOCAL: if ( !_Thread_Is_executing( the_period->owner ) ) { _Thread_Enable_dispatch(); - return( RTEMS_NOT_OWNER_OF_RESOURCE ); + return RTEMS_NOT_OWNER_OF_RESOURCE; } (void) _Watchdog_Remove( &the_period->Timer ); the_period->state = RATE_MONOTONIC_INACTIVE; _Thread_Enable_dispatch(); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } - return( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */ + return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ } /*PAGE @@ -193,19 +198,19 @@ rtems_status_code rtems_rate_monotonic_delete( the_period = _Rate_monotonic_Get( id, &location ); switch ( location ) { case OBJECTS_ERROR: - return( RTEMS_INVALID_ID ); + return RTEMS_INVALID_ID; case OBJECTS_REMOTE: /* should never return this */ - return( RTEMS_INTERNAL_ERROR ); + return RTEMS_INTERNAL_ERROR; case OBJECTS_LOCAL: _Objects_Close( &_Rate_monotonic_Information, &the_period->Object ); (void) _Watchdog_Remove( &the_period->Timer ); the_period->state = RATE_MONOTONIC_INACTIVE; _Rate_monotonic_Free( the_period ); _Thread_Enable_dispatch(); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } - return( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */ + return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ } /*PAGE @@ -225,23 +230,23 @@ rtems_status_code rtems_rate_monotonic_delete( rtems_status_code rtems_rate_monotonic_period( Objects_Id id, - rtems_interval length + rtems_interval length ) { Rate_monotonic_Control *the_period; Objects_Locations location; - rtems_status_code return_value; + rtems_status_code return_value; the_period = _Rate_monotonic_Get( id, &location ); switch ( location ) { case OBJECTS_ERROR: - return( RTEMS_INVALID_ID ); + return RTEMS_INVALID_ID; case OBJECTS_REMOTE: /* should never return this */ - return( RTEMS_INTERNAL_ERROR ); + return RTEMS_INTERNAL_ERROR; case OBJECTS_LOCAL: if ( !_Thread_Is_executing( the_period->owner ) ) { _Thread_Enable_dispatch(); - return( RTEMS_NOT_OWNER_OF_RESOURCE ); + return RTEMS_NOT_OWNER_OF_RESOURCE; } if ( length == RTEMS_PERIOD_STATUS ) { @@ -275,14 +280,14 @@ rtems_status_code rtems_rate_monotonic_period( _Watchdog_Insert_ticks( &the_period->Timer, length, WATCHDOG_ACTIVATE_NOW ); _Thread_Enable_dispatch(); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; case RATE_MONOTONIC_ACTIVE: /* following is and could be a critical section problem */ _Thread_Executing->Wait.id = the_period->Object.id; if ( _Rate_monotonic_Set_state( the_period ) ) { _Thread_Enable_dispatch(); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } /* has expired -- fall into next case */ case RATE_MONOTONIC_EXPIRED: @@ -290,11 +295,11 @@ rtems_status_code rtems_rate_monotonic_period( _Watchdog_Insert_ticks( &the_period->Timer, length, WATCHDOG_ACTIVATE_NOW ); _Thread_Enable_dispatch(); - return( RTEMS_TIMEOUT ); + return RTEMS_TIMEOUT; } } - return( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */ + return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ } /*PAGE diff --git a/c/src/exec/rtems/src/region.c b/c/src/exec/rtems/src/region.c index 25aca9cda7..b5d55afdc3 100644 --- a/c/src/exec/rtems/src/region.c +++ b/c/src/exec/rtems/src/region.c @@ -14,13 +14,13 @@ */ #include <rtems/system.h> -#include <rtems/support.h> -#include <rtems/config.h> -#include <rtems/object.h> -#include <rtems/options.h> -#include <rtems/region.h> -#include <rtems/states.h> -#include <rtems/thread.h> +#include <rtems/rtems/status.h> +#include <rtems/rtems/support.h> +#include <rtems/core/object.h> +#include <rtems/rtems/options.h> +#include <rtems/rtems/region.h> +#include <rtems/core/states.h> +#include <rtems/core/thread.h> /*PAGE * @@ -48,6 +48,16 @@ void _Region_Manager_initialization( RTEMS_MAXIMUM_NAME_LENGTH, FALSE ); + + /* + * Register the MP Process Packet routine. + */ + + _MPCI_Register_packet_processor( + MP_PACKET_REGION, + 0 /* XXX _Region_MP_Process_packet */ + ); + } /*PAGE @@ -83,10 +93,10 @@ rtems_status_code rtems_region_create( Region_Control *the_region; if ( !rtems_is_name_valid( name ) ) - return ( RTEMS_INVALID_NAME ); + return RTEMS_INVALID_NAME; if ( !_Addresses_Is_aligned( starting_address ) ) - return( RTEMS_INVALID_ADDRESS ); + return RTEMS_INVALID_ADDRESS; _Thread_Disable_dispatch(); /* to prevent deletion */ @@ -94,7 +104,7 @@ rtems_status_code rtems_region_create( if ( !the_region ) { _Thread_Enable_dispatch(); - return( RTEMS_TOO_MANY ); + return RTEMS_TOO_MANY; } the_region->maximum_segment_size = @@ -103,7 +113,7 @@ rtems_status_code rtems_region_create( if ( !the_region->maximum_segment_size ) { _Region_Free( the_region ); _Thread_Enable_dispatch(); - return( RTEMS_INVALID_SIZE ); + return RTEMS_INVALID_SIZE; } the_region->starting_address = starting_address; @@ -118,14 +128,15 @@ rtems_status_code rtems_region_create( _Attributes_Is_priority( attribute_set ) ? THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO, STATES_WAITING_FOR_SEGMENT, - _Region_MP_Send_extract_proxy + _Region_MP_Send_extract_proxy, + RTEMS_TIMEOUT ); _Objects_Open( &_Region_Information, &the_region->Object, &name ); *id = the_region->Object.id; _Thread_Enable_dispatch(); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } /*PAGE @@ -150,12 +161,16 @@ rtems_status_code rtems_region_ident( Objects_Id *id ) { - return _Objects_Name_to_id( - &_Region_Information, - &name, - RTEMS_SEARCH_LOCAL_NODE, - id - ); + Objects_Name_to_id_errors status; + + status = _Objects_Name_to_id( + &_Region_Information, + &name, + OBJECTS_SEARCH_LOCAL_NODE, + id + ); + + return _Status_Object_name_errors_to_status[ status ]; } /*PAGE @@ -184,22 +199,22 @@ rtems_status_code rtems_region_delete( the_region = _Region_Get( id, &location ); switch ( location ) { case OBJECTS_ERROR: - return( RTEMS_INVALID_ID ); + return RTEMS_INVALID_ID; case OBJECTS_REMOTE: /* this error cannot be returned */ - return( RTEMS_INTERNAL_ERROR ); + return RTEMS_INTERNAL_ERROR; case OBJECTS_LOCAL: _Region_Debug_Walk( the_region, 5 ); if ( the_region->number_of_used_blocks == 0 ) { _Objects_Close( &_Region_Information, &the_region->Object ); _Region_Free( the_region ); _Thread_Enable_dispatch(); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } _Thread_Enable_dispatch(); - return( RTEMS_RESOURCE_IN_USE ); + return RTEMS_RESOURCE_IN_USE; } - return( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */ + return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ } /*PAGE @@ -236,9 +251,9 @@ rtems_status_code rtems_region_extend( the_region = _Region_Get( id, &location ); switch ( location ) { case OBJECTS_ERROR: - return( RTEMS_INVALID_ID ); + return RTEMS_INVALID_ID; case OBJECTS_REMOTE: /* this error cannot be returned */ - return( RTEMS_INTERNAL_ERROR ); + return RTEMS_INTERNAL_ERROR; case OBJECTS_LOCAL: heap_status = _Heap_Extend( @@ -264,7 +279,7 @@ rtems_status_code rtems_region_extend( return( status ); } - return( RTEMS_INTERNAL_ERROR ); + return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ } /*PAGE @@ -289,8 +304,8 @@ rtems_status_code rtems_region_extend( rtems_status_code rtems_region_get_segment( Objects_Id id, unsigned32 size, - rtems_option option_set, - rtems_interval timeout, + rtems_option option_set, + rtems_interval timeout, void **segment ) { @@ -300,19 +315,19 @@ rtems_status_code rtems_region_get_segment( void *the_segment; if ( size == 0 ) - return( RTEMS_INVALID_SIZE ); + return RTEMS_INVALID_SIZE; executing = _Thread_Executing; the_region = _Region_Get( id, &location ); switch ( location ) { case OBJECTS_ERROR: - return( RTEMS_INVALID_ID ); + return RTEMS_INVALID_ID; case OBJECTS_REMOTE: /* this error cannot be returned */ - return( RTEMS_INTERNAL_ERROR ); + return RTEMS_INTERNAL_ERROR; case OBJECTS_LOCAL: if ( size > the_region->maximum_segment_size ) { _Thread_Enable_dispatch(); - return( RTEMS_INVALID_SIZE ); + return RTEMS_INVALID_SIZE; } _Region_Debug_Walk( the_region, 1 ); @@ -325,18 +340,18 @@ rtems_status_code rtems_region_get_segment( the_region->number_of_used_blocks += 1; _Thread_Enable_dispatch(); *segment = the_segment; - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } if ( _Options_Is_no_wait( option_set ) ) { _Thread_Enable_dispatch(); - return( RTEMS_UNSATISFIED ); + return RTEMS_UNSATISFIED; } - executing->Wait.queue = &the_region->Wait_queue; - executing->Wait.id = id; - executing->Wait.Extra.segment_size = size; - executing->Wait.return_argument = (unsigned32 *) segment; + executing->Wait.queue = &the_region->Wait_queue; + executing->Wait.id = id; + executing->Wait.count = size; + executing->Wait.return_argument = (unsigned32 *) segment; the_region->Wait_queue.sync = TRUE; @@ -346,7 +361,7 @@ rtems_status_code rtems_region_get_segment( return( executing->Wait.return_code ); } - return( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */ + return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ } /*PAGE * @@ -379,20 +394,20 @@ rtems_status_code rtems_region_get_segment_size( the_region = _Region_Get( id, &location ); switch ( location ) { case OBJECTS_ERROR: - return( RTEMS_INVALID_ID ); + return RTEMS_INVALID_ID; case OBJECTS_REMOTE: /* this error cannot be returned */ - return( RTEMS_INTERNAL_ERROR ); + return RTEMS_INTERNAL_ERROR; case OBJECTS_LOCAL: if ( _Heap_Size_of_user_area( &the_region->Memory, segment, size ) ) { _Thread_Enable_dispatch(); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } _Thread_Enable_dispatch(); - return( RTEMS_INVALID_ADDRESS ); + return RTEMS_INVALID_ADDRESS; } - return( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */ + return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ } /*PAGE @@ -424,9 +439,9 @@ rtems_status_code rtems_region_return_segment( the_region = _Region_Get( id, &location ); switch ( location ) { case OBJECTS_ERROR: - return( RTEMS_INVALID_ID ); + return RTEMS_INVALID_ID; case OBJECTS_REMOTE: /* this error cannot be returned */ - return( RTEMS_INTERNAL_ERROR ); + return RTEMS_INTERNAL_ERROR; case OBJECTS_LOCAL: _Region_Debug_Walk( the_region, 3 ); @@ -437,7 +452,7 @@ rtems_status_code rtems_region_return_segment( if ( !status ) { _Thread_Enable_dispatch(); - return( RTEMS_INVALID_ADDRESS ); + return RTEMS_INVALID_ADDRESS; } the_region->number_of_used_blocks -= 1; @@ -448,7 +463,9 @@ rtems_status_code rtems_region_return_segment( break; the_segment = _Region_Allocate_segment( - the_region, the_thread->Wait.Extra.segment_size ); + the_region, + the_thread->Wait.count + ); if ( the_segment == NULL ) break; @@ -460,8 +477,8 @@ rtems_status_code rtems_region_return_segment( } _Thread_Enable_dispatch(); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } - return( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */ + return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ } diff --git a/c/src/exec/rtems/src/regionmp.c b/c/src/exec/rtems/src/regionmp.c index b460e554fe..89b9d851c5 100644 --- a/c/src/exec/rtems/src/regionmp.c +++ b/c/src/exec/rtems/src/regionmp.c @@ -14,12 +14,14 @@ */ #include <rtems/system.h> -#include <rtems/mpci.h> -#include <rtems/mppkt.h> -#include <rtems/object.h> -#include <rtems/options.h> -#include <rtems/region.h> -#include <rtems/thread.h> +#include <rtems/rtems/status.h> +#include <rtems/core/mpci.h> +#include <rtems/core/mppkt.h> +#include <rtems/core/object.h> +#include <rtems/rtems/options.h> +#include <rtems/rtems/region.h> +#include <rtems/core/thread.h> +#include <rtems/rtems/support.h> /*PAGE * @@ -44,7 +46,7 @@ void _Region_MP_Send_process_packet ( case REGION_MP_EXTRACT_PROXY: the_packet = _Region_MP_Get_packet(); - the_packet->Prefix.the_class = RTEMS_MP_PACKET_REGION; + the_packet->Prefix.the_class = MP_PACKET_REGION; the_packet->Prefix.length = sizeof ( Region_MP_Packet ); the_packet->Prefix.to_convert = sizeof ( Region_MP_Packet ); the_packet->operation = operation; @@ -79,8 +81,8 @@ rtems_status_code _Region_MP_Send_request_packet ( Objects_Id region_id, void *segment, unsigned32 size, - rtems_option option_set, - rtems_interval timeout + rtems_option option_set, + rtems_interval timeout ) { Region_MP_Packet *the_packet; @@ -91,7 +93,7 @@ rtems_status_code _Region_MP_Send_request_packet ( case REGION_MP_RETURN_SEGMENT_REQUEST: the_packet = _Region_MP_Get_packet(); - the_packet->Prefix.the_class = RTEMS_MP_PACKET_REGION; + the_packet->Prefix.the_class = MP_PACKET_REGION; the_packet->Prefix.length = sizeof ( Region_MP_Packet ); the_packet->Prefix.to_convert = sizeof ( Region_MP_Packet ); if ( ! _Options_Is_no_wait(option_set)) diff --git a/c/src/exec/rtems/src/rtclock.c b/c/src/exec/rtems/src/rtclock.c index f82baa6337..01f61374cf 100644 --- a/c/src/exec/rtems/src/rtclock.c +++ b/c/src/exec/rtems/src/rtclock.c @@ -13,12 +13,12 @@ */ #include <rtems/system.h> -#include <rtems/clock.h> -#include <rtems/config.h> -#include <rtems/isr.h> -#include <rtems/thread.h> -#include <rtems/tod.h> -#include <rtems/watchdog.h> +#include <rtems/rtems/status.h> +#include <rtems/rtems/clock.h> +#include <rtems/core/isr.h> +#include <rtems/core/thread.h> +#include <rtems/core/tod.h> +#include <rtems/core/watchdog.h> /*PAGE * @@ -49,29 +49,29 @@ rtems_status_code rtems_clock_get( switch ( option ) { case RTEMS_CLOCK_GET_TOD: if ( !_TOD_Is_set() ) - return( RTEMS_NOT_DEFINED ); + return RTEMS_NOT_DEFINED; *(rtems_time_of_day *)time_buffer = _TOD_Current; - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; case RTEMS_CLOCK_GET_SECONDS_SINCE_EPOCH: if ( !_TOD_Is_set() ) - return( RTEMS_NOT_DEFINED ); + return RTEMS_NOT_DEFINED; *(rtems_interval *)time_buffer = _TOD_Seconds_since_epoch; - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; case RTEMS_CLOCK_GET_TICKS_SINCE_BOOT: *(rtems_interval *)time_buffer = _TOD_Ticks_since_boot; - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; case RTEMS_CLOCK_GET_TICKS_PER_SECOND: *(rtems_interval *)time_buffer = _TOD_Ticks_per_second; - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; case RTEMS_CLOCK_GET_TIME_VALUE: if ( !_TOD_Is_set() ) - return( RTEMS_NOT_DEFINED ); + return RTEMS_NOT_DEFINED; _ISR_Disable( level ); ((rtems_clock_time_value *)time_buffer)->seconds = @@ -79,13 +79,13 @@ rtems_status_code rtems_clock_get( tmp = _TOD_Current.ticks; _ISR_Enable( level ); - tmp *= _Configuration_Table->microseconds_per_tick; + tmp *= _TOD_Microseconds_per_tick; ((rtems_clock_time_value *)time_buffer)->microseconds = tmp; - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } - return( RTEMS_SUCCESSFUL ); /* should never get here */ + return RTEMS_INTERNAL_ERROR; /* should never get here */ } @@ -107,18 +107,16 @@ rtems_status_code rtems_clock_set( rtems_time_of_day *time_buffer ) { - rtems_status_code local_result; - rtems_interval seconds; + rtems_interval seconds; - local_result = _TOD_Validate( time_buffer ); - if ( rtems_is_status_successful( local_result ) ) { + if ( _TOD_Validate( time_buffer ) ) { seconds = _TOD_To_seconds( time_buffer ); _Thread_Disable_dispatch(); _TOD_Set( time_buffer, seconds ); _Thread_Enable_dispatch(); - + return RTEMS_SUCCESSFUL; } - return( local_result ); + return RTEMS_INVALID_CLOCK; } /*PAGE @@ -149,5 +147,5 @@ rtems_status_code rtems_clock_tick( void ) _Thread_Is_dispatching_enabled() ) _Thread_Dispatch(); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } diff --git a/c/src/exec/rtems/src/rtemstimer.c b/c/src/exec/rtems/src/rtemstimer.c index 68d9e4591b..c59e137d0c 100644 --- a/c/src/exec/rtems/src/rtemstimer.c +++ b/c/src/exec/rtems/src/rtemstimer.c @@ -14,12 +14,13 @@ */ #include <rtems/system.h> -#include <rtems/support.h> -#include <rtems/object.h> -#include <rtems/thread.h> -#include <rtems/timer.h> -#include <rtems/tod.h> -#include <rtems/watchdog.h> +#include <rtems/rtems/status.h> +#include <rtems/rtems/support.h> +#include <rtems/core/object.h> +#include <rtems/core/thread.h> +#include <rtems/rtems/timer.h> +#include <rtems/core/tod.h> +#include <rtems/core/watchdog.h> /*PAGE * @@ -73,7 +74,7 @@ rtems_status_code rtems_timer_create( Timer_Control *the_timer; if ( !rtems_is_name_valid( name ) ) - return ( RTEMS_INVALID_NAME ); + return RTEMS_INVALID_NAME; _Thread_Disable_dispatch(); /* to prevent deletion */ @@ -81,7 +82,7 @@ rtems_status_code rtems_timer_create( if ( !the_timer ) { _Thread_Enable_dispatch(); - return( RTEMS_TOO_MANY ); + return RTEMS_TOO_MANY; } the_timer->the_class = TIMER_DORMANT; @@ -90,7 +91,7 @@ rtems_status_code rtems_timer_create( *id = the_timer->Object.id; _Thread_Enable_dispatch(); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } /*PAGE @@ -115,12 +116,16 @@ rtems_status_code rtems_timer_ident( Objects_Id *id ) { - return _Objects_Name_to_id( + Objects_Name_to_id_errors status; + + status = _Objects_Name_to_id( &_Timer_Information, &name, - RTEMS_SEARCH_LOCAL_NODE, + OBJECTS_SEARCH_LOCAL_NODE, id ); + + return _Status_Object_name_errors_to_status[ status ]; } /*PAGE @@ -147,17 +152,17 @@ rtems_status_code rtems_timer_cancel( the_timer = _Timer_Get( id, &location ); switch ( location ) { case OBJECTS_ERROR: - return( RTEMS_INVALID_ID ); + return RTEMS_INVALID_ID; case OBJECTS_REMOTE: /* should never return this */ - return( RTEMS_INTERNAL_ERROR ); + return RTEMS_INTERNAL_ERROR; case OBJECTS_LOCAL: if ( !_Timer_Is_dormant_class( the_timer->the_class ) ) (void) _Watchdog_Remove( &the_timer->Ticker ); _Thread_Enable_dispatch(); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } - return( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */ + return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ } /*PAGE @@ -184,18 +189,18 @@ rtems_status_code rtems_timer_delete( the_timer = _Timer_Get( id, &location ); switch ( location ) { case OBJECTS_ERROR: - return( RTEMS_INVALID_ID ); + return RTEMS_INVALID_ID; case OBJECTS_REMOTE: /* should never return this */ - return( RTEMS_INTERNAL_ERROR ); + return RTEMS_INTERNAL_ERROR; case OBJECTS_LOCAL: _Objects_Close( &_Timer_Information, &the_timer->Object ); (void) _Watchdog_Remove( &the_timer->Ticker ); _Timer_Free( the_timer ); _Thread_Enable_dispatch(); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } - return( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */ + return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ } /*PAGE @@ -215,24 +220,24 @@ rtems_status_code rtems_timer_delete( */ rtems_status_code rtems_timer_fire_after( - Objects_Id id, - rtems_interval ticks, - Timer_Service routine, - void *user_data + Objects_Id id, + rtems_interval ticks, + rtems_timer_service_routine_entry routine, + void *user_data ) { Timer_Control *the_timer; Objects_Locations location; if ( ticks == 0 ) - return( RTEMS_INVALID_NUMBER ); + return RTEMS_INVALID_NUMBER; the_timer = _Timer_Get( id, &location ); switch ( location ) { case OBJECTS_ERROR: - return( RTEMS_INVALID_ID ); + return RTEMS_INVALID_ID; case OBJECTS_REMOTE: /* should never return this */ - return( RTEMS_INTERNAL_ERROR ); + return RTEMS_INTERNAL_ERROR; case OBJECTS_LOCAL: (void) _Watchdog_Remove( &the_timer->Ticker ); the_timer->the_class = TIMER_INTERVAL; @@ -240,10 +245,10 @@ rtems_status_code rtems_timer_fire_after( _Watchdog_Insert_ticks( &the_timer->Ticker, ticks, WATCHDOG_ACTIVATE_NOW ); _Thread_Enable_dispatch(); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } - return( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */ + return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ } /*PAGE @@ -263,34 +268,32 @@ rtems_status_code rtems_timer_fire_after( */ rtems_status_code rtems_timer_fire_when( - Objects_Id id, - rtems_time_of_day *wall_time, - Timer_Service routine, - void *user_data + Objects_Id id, + rtems_time_of_day *wall_time, + rtems_timer_service_routine_entry routine, + void *user_data ) { - Timer_Control *the_timer; - Objects_Locations location; - rtems_status_code validate_status; + Timer_Control *the_timer; + Objects_Locations location; rtems_interval seconds; if ( !_TOD_Is_set() ) - return( RTEMS_NOT_DEFINED ); + return RTEMS_NOT_DEFINED; - validate_status = _TOD_Validate( wall_time ); - if ( !rtems_is_status_successful( validate_status ) ) - return( validate_status ); + if ( !_TOD_Validate( wall_time ) ) + return RTEMS_INVALID_CLOCK; seconds = _TOD_To_seconds( wall_time ); if ( seconds <= _TOD_Seconds_since_epoch ) - return( RTEMS_INVALID_CLOCK ); + return RTEMS_INVALID_CLOCK; the_timer = _Timer_Get( id, &location ); switch ( location ) { case OBJECTS_ERROR: - return( RTEMS_INVALID_ID ); + return RTEMS_INVALID_ID; case OBJECTS_REMOTE: /* should never return this */ - return( RTEMS_INTERNAL_ERROR ); + return RTEMS_INTERNAL_ERROR; case OBJECTS_LOCAL: (void) _Watchdog_Remove( &the_timer->Ticker ); the_timer->the_class = TIMER_TIME_OF_DAY; @@ -298,10 +301,10 @@ rtems_status_code rtems_timer_fire_when( _Watchdog_Insert_seconds( &the_timer->Ticker, seconds - _TOD_Seconds_since_epoch, WATCHDOG_ACTIVATE_NOW ); _Thread_Enable_dispatch(); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } - return( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */ + return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ } /*PAGE @@ -328,18 +331,18 @@ rtems_status_code rtems_timer_reset( the_timer = _Timer_Get( id, &location ); switch ( location ) { case OBJECTS_ERROR: - return( RTEMS_INVALID_ID ); + return RTEMS_INVALID_ID; case OBJECTS_REMOTE: /* should never return this */ - return( RTEMS_INTERNAL_ERROR ); + return RTEMS_INTERNAL_ERROR; case OBJECTS_LOCAL: if ( _Timer_Is_interval_class( the_timer->the_class ) ) { _Watchdog_Reset( &the_timer->Ticker ); _Thread_Enable_dispatch(); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } _Thread_Enable_dispatch(); - return( RTEMS_NOT_DEFINED ); + return RTEMS_NOT_DEFINED; } - return( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */ + return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ } diff --git a/c/src/exec/rtems/src/sem.c b/c/src/exec/rtems/src/sem.c index 9e87550c31..9ba1634164 100644 --- a/c/src/exec/rtems/src/sem.c +++ b/c/src/exec/rtems/src/sem.c @@ -27,17 +27,22 @@ */ #include <rtems/system.h> -#include <rtems/support.h> -#include <rtems/attr.h> -#include <rtems/config.h> -#include <rtems/isr.h> -#include <rtems/object.h> -#include <rtems/options.h> -#include <rtems/sem.h> -#include <rtems/states.h> -#include <rtems/thread.h> -#include <rtems/threadq.h> -#include <rtems/mpci.h> +#include <rtems/rtems/status.h> +#include <rtems/rtems/support.h> +#include <rtems/rtems/attr.h> +#include <rtems/core/isr.h> +#include <rtems/core/object.h> +#include <rtems/rtems/options.h> +#include <rtems/rtems/sem.h> +#include <rtems/core/coremutex.h> +#include <rtems/core/coresem.h> +#include <rtems/core/states.h> +#include <rtems/core/thread.h> +#include <rtems/core/threadq.h> +#include <rtems/core/mpci.h> +#include <rtems/sysstate.h> + +#include <rtems/core/interr.h> /*PAGE * @@ -65,6 +70,16 @@ void _Semaphore_Manager_initialization( RTEMS_MAXIMUM_NAME_LENGTH, FALSE ); + + /* + * Register the MP Process Packet routine. + */ + + _MPCI_Register_packet_processor( + MP_PACKET_SEMAPHORE, + _Semaphore_MP_Process_packet + ); + } /*PAGE @@ -75,10 +90,11 @@ void _Semaphore_Manager_initialization( * on the given count. A semaphore id is returned. * * Input parameters: - * name - user defined semaphore name - * count - initial count of semaphore - * attribute_set - semaphore attributes - * id - pointer to semaphore id + * name - user defined semaphore name + * count - initial count of semaphore + * attribute_set - semaphore attributes + * priority_ceiling - semaphore's ceiling priority + * id - pointer to semaphore id * * Output parameters: * id - semaphore id @@ -87,21 +103,24 @@ void _Semaphore_Manager_initialization( */ rtems_status_code rtems_semaphore_create( - rtems_name name, - unsigned32 count, - rtems_attribute attribute_set, - rtems_task_priority priority_ceiling, - Objects_Id *id + rtems_name name, + unsigned32 count, + rtems_attribute attribute_set, + rtems_task_priority priority_ceiling, + Objects_Id *id ) { register Semaphore_Control *the_semaphore; + CORE_mutex_Attributes the_mutex_attributes; + CORE_semaphore_Attributes the_semaphore_attributes; + unsigned32 lock; if ( !rtems_is_name_valid( name ) ) return ( RTEMS_INVALID_NAME ); if ( _Attributes_Is_global( attribute_set ) ) { - if ( !_Configuration_Is_multiprocessing() ) + if ( !_System_state_Is_multiprocessing ) return( RTEMS_MP_NOT_CONFIGURED ); if ( _Attributes_Is_inherit_priority( attribute_set ) ) @@ -128,7 +147,7 @@ rtems_status_code rtems_semaphore_create( } if ( _Attributes_Is_global( attribute_set ) && - !( _Objects_MP_Allocate_and_open( &_Semaphore_Information, name, + ! ( _Objects_MP_Allocate_and_open( &_Semaphore_Information, name, the_semaphore->Object.id, FALSE ) ) ) { _Semaphore_Free( the_semaphore ); _Thread_Enable_dispatch(); @@ -136,27 +155,48 @@ rtems_status_code rtems_semaphore_create( } the_semaphore->attribute_set = attribute_set; - the_semaphore->count = count; - - if ( _Attributes_Is_binary_semaphore( attribute_set ) && count == 0 ) { - the_semaphore->nest_count = 1; - the_semaphore->holder = _Thread_Executing; - the_semaphore->holder_id = _Thread_Executing->Object.id; - _Thread_Executing->resource_count++; - } else { - the_semaphore->nest_count = 0; - the_semaphore->holder = NULL; - the_semaphore->holder_id = 0; - } - _Thread_queue_Initialize( - &the_semaphore->Wait_queue, - OBJECTS_RTEMS_SEMAPHORES, - _Attributes_Is_priority( attribute_set ) ? - THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO, - STATES_WAITING_FOR_SEMAPHORE, - _Semaphore_MP_Send_extract_proxy - ); + if ( _Attributes_Is_binary_semaphore( attribute_set ) ) { + if ( _Attributes_Is_inherit_priority( attribute_set ) ) + the_mutex_attributes.discipline = CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT; + else if (_Attributes_Is_priority_ceiling( attribute_set ) ) + the_mutex_attributes.discipline = CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING; + else if (_Attributes_Is_priority( attribute_set ) ) + the_mutex_attributes.discipline = CORE_MUTEX_DISCIPLINES_PRIORITY; + else + the_mutex_attributes.discipline = CORE_MUTEX_DISCIPLINES_FIFO; + + the_mutex_attributes.allow_nesting = TRUE; + + /* Add priority ceiling code here ????? */ + + if ( count == 1 ) + lock = CORE_MUTEX_UNLOCKED; + else + lock = CORE_MUTEX_LOCKED; + + _CORE_mutex_Initialize( + &the_semaphore->Core_control.mutex, + OBJECTS_RTEMS_SEMAPHORES, + &the_mutex_attributes, + lock, + _Semaphore_MP_Send_extract_proxy + ); + } + else { + if ( _Attributes_Is_priority( attribute_set ) ) + the_semaphore_attributes.discipline = CORE_SEMAPHORE_DISCIPLINES_PRIORITY; + else + the_semaphore_attributes.discipline = CORE_SEMAPHORE_DISCIPLINES_FIFO; + + _CORE_semaphore_Initialize( + &the_semaphore->Core_control.semaphore, + OBJECTS_RTEMS_SEMAPHORES, + &the_semaphore_attributes, + count, + _Semaphore_MP_Send_extract_proxy + ); + } _Objects_Open( &_Semaphore_Information, &the_semaphore->Object, &name ); @@ -192,12 +232,16 @@ rtems_status_code rtems_semaphore_create( */ rtems_status_code rtems_semaphore_ident( - rtems_name name, - unsigned32 node, - Objects_Id *id + rtems_name name, + unsigned32 node, + Objects_Id *id ) { - return( _Objects_Name_to_id( &_Semaphore_Information, &name, node, id ) ); + Objects_Name_to_id_errors status; + + status = _Objects_Name_to_id( &_Semaphore_Information, &name, node, id ); + + return _Status_Object_name_errors_to_status[ status ]; } /*PAGE @@ -231,19 +275,27 @@ rtems_status_code rtems_semaphore_delete( _Thread_Dispatch(); return( RTEMS_ILLEGAL_ON_REMOTE_OBJECT ); case OBJECTS_LOCAL: - if ( _Attributes_Is_binary_semaphore( the_semaphore->attribute_set) && - ( the_semaphore->count == 0 ) ) { - _Thread_Enable_dispatch(); - return( RTEMS_RESOURCE_IN_USE ); + if ( _Attributes_Is_binary_semaphore( the_semaphore->attribute_set) ) { + if ( _CORE_mutex_Is_locked( &the_semaphore->Core_control.mutex ) ) { + _Thread_Enable_dispatch(); + return( RTEMS_RESOURCE_IN_USE ); + } + else + _CORE_mutex_Flush( + &the_semaphore->Core_control.mutex, + _Semaphore_MP_Send_object_was_deleted, + CORE_MUTEX_WAS_DELETED + ); } + else + _CORE_semaphore_Flush( + &the_semaphore->Core_control.semaphore, + _Semaphore_MP_Send_object_was_deleted, + CORE_SEMAPHORE_WAS_DELETED + ); _Objects_Close( &_Semaphore_Information, &the_semaphore->Object ); - _Thread_queue_Flush( - &the_semaphore->Wait_queue, - _Semaphore_MP_Send_object_was_deleted - ); - _Semaphore_Free( the_semaphore ); if ( _Attributes_Is_global( the_semaphore->attribute_set ) ) { @@ -281,13 +333,14 @@ rtems_status_code rtems_semaphore_delete( */ rtems_status_code rtems_semaphore_obtain( - Objects_Id id, - unsigned32 option_set, - rtems_interval timeout + Objects_Id id, + unsigned32 option_set, + rtems_interval timeout ) { register Semaphore_Control *the_semaphore; Objects_Locations location; + boolean wait; the_semaphore = _Semaphore_Get( id, &location ); switch ( location ) { @@ -301,17 +354,32 @@ rtems_status_code rtems_semaphore_obtain( timeout ); case OBJECTS_LOCAL: - if ( !_Semaphore_Seize( the_semaphore, option_set ) ) { - if ( _Attributes_Is_inherit_priority( the_semaphore->attribute_set ) && - the_semaphore->holder->current_priority > - _Thread_Executing->current_priority ) { - _Thread_Change_priority( - the_semaphore->holder, _Thread_Executing->current_priority ); - } - _Thread_queue_Enqueue( &the_semaphore->Wait_queue, timeout ); + if ( _Options_Is_no_wait( option_set ) ) + wait = FALSE; + else + wait = TRUE; + + if ( _Attributes_Is_binary_semaphore( the_semaphore->attribute_set ) ) { + _CORE_mutex_Seize( + &the_semaphore->Core_control.mutex, + id, + wait, + timeout + ); + _Thread_Enable_dispatch(); + return( _Semaphore_Translate_core_mutex_return_code( + _Thread_Executing->Wait.return_code ) ); + } else { + _CORE_semaphore_Seize( + &the_semaphore->Core_control.semaphore, + id, + wait, + timeout + ); + _Thread_Enable_dispatch(); + return( _Semaphore_Translate_core_semaphore_return_code( + _Thread_Executing->Wait.return_code ) ); } - _Thread_Enable_dispatch(); - return( _Thread_Executing->Wait.return_code ); } return( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */ @@ -337,7 +405,8 @@ rtems_status_code rtems_semaphore_release( { register Semaphore_Control *the_semaphore; Objects_Locations location; - Thread_Control *the_thread; + CORE_mutex_Status mutex_status; + CORE_semaphore_Status semaphore_status; the_semaphore = _Semaphore_Get( id, &location ); switch ( location ) { @@ -353,143 +422,153 @@ rtems_status_code rtems_semaphore_release( ) ); case OBJECTS_LOCAL: - if ( _Attributes_Is_binary_semaphore( the_semaphore->attribute_set)) { - - if ( !_Objects_Are_ids_equal( - _Thread_Executing->Object.id, the_semaphore->holder_id ) ) { - _Thread_Enable_dispatch(); - return( RTEMS_NOT_OWNER_OF_RESOURCE ); - } - - the_semaphore->nest_count--; - - if ( the_semaphore->nest_count != 0 ) { - _Thread_Enable_dispatch(); - return( RTEMS_SUCCESSFUL ); - } - - _Thread_Executing->resource_count--; - the_semaphore->holder = NULL; - the_semaphore->holder_id = 0; - - /* - * Whether or not someone is waiting for the semaphore, an - * inherited priority must be lowered if this is the last - * semaphore (i.e. resource) this task has. - */ - - if ( _Attributes_Is_inherit_priority(the_semaphore->attribute_set) && - _Thread_Executing->resource_count == 0 && - _Thread_Executing->real_priority != - _Thread_Executing->current_priority ) { - _Thread_Change_priority( - _Thread_Executing, _Thread_Executing->real_priority ); - } - + if ( _Attributes_Is_binary_semaphore( the_semaphore->attribute_set ) ) { + mutex_status = _CORE_mutex_Surrender( + &the_semaphore->Core_control.mutex, + id, + _Semaphore_Core_mutex_mp_support + ); + _Thread_Enable_dispatch(); + return( _Semaphore_Translate_core_mutex_return_code( mutex_status ) ); } + else + semaphore_status = _CORE_semaphore_Surrender( + &the_semaphore->Core_control.semaphore, + id, + _Semaphore_Core_semaphore_mp_support + ); + _Thread_Enable_dispatch(); + return( + _Semaphore_Translate_core_semaphore_return_code( semaphore_status ) ); + } - if ( (the_thread = _Thread_queue_Dequeue(&the_semaphore->Wait_queue)) ) { - - if ( !_Objects_Is_local_id( the_thread->Object.id ) ) { - the_thread->receive_packet->return_code = RTEMS_SUCCESSFUL; - - if ( _Attributes_Is_binary_semaphore(the_semaphore->attribute_set) ) { - the_semaphore->holder = NULL; - the_semaphore->holder_id = the_thread->Object.id; - the_semaphore->nest_count = 1; - } - - _Semaphore_MP_Send_response_packet( - SEMAPHORE_MP_OBTAIN_RESPONSE, - id, - the_thread - ); - } else { - - if ( _Attributes_Is_binary_semaphore(the_semaphore->attribute_set) ) { - the_semaphore->holder = the_thread; - the_semaphore->holder_id = the_thread->Object.id; - the_thread->resource_count++; - the_semaphore->nest_count = 1; - } - - /* - * No special action for priority inheritance because the_thread - * is guaranteed to be the highest priority thread waiting for - * the semaphore. - */ - } - } else - the_semaphore->count += 1; + return( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */ +} - _Thread_Enable_dispatch(); +/*PAGE + * + * _Semaphore_Translate_core_mutex_return_code + * + * Input parameters: + * the_mutex_status - mutex status code to translate + * + * Output parameters: + * rtems status code - translated RTEMS status code + * + */ + +rtems_status_code _Semaphore_Translate_core_mutex_return_code ( + unsigned32 the_mutex_status +) +{ + switch ( the_mutex_status ) { + case CORE_MUTEX_STATUS_SUCCESSFUL: return( RTEMS_SUCCESSFUL ); + case CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT: + return( RTEMS_UNSATISFIED ); + case CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED: + return( RTEMS_INTERNAL_ERROR ); + case CORE_MUTEX_STATUS_NOT_OWNER_OF_RESOURCE: + return( RTEMS_NOT_OWNER_OF_RESOURCE ); + case CORE_MUTEX_WAS_DELETED: + return( RTEMS_OBJECT_WAS_DELETED ); + case CORE_MUTEX_TIMEOUT: + return( RTEMS_TIMEOUT ); + case THREAD_STATUS_PROXY_BLOCKING: + return( THREAD_STATUS_PROXY_BLOCKING ); } - + _Internal_error_Occurred( + INTERNAL_ERROR_RTEMS_API, + TRUE, + the_mutex_status + ); return( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */ } /*PAGE * - * _Semaphore_Seize - * - * This routine attempts to allocate a semaphore to the calling thread. + * _Semaphore_Translate_core_semaphore_return_code * * Input parameters: - * the_semaphore - pointer to semaphore control block - * option_set - acquire semaphore options + * the_semaphore_status - semaphore status code to translate * * Output parameters: - * TRUE - if semaphore allocated - * FALSE - if semaphore NOT allocated + * rtems status code - translated RTEMS status code * - * INTERRUPT LATENCY: - * available - * wait */ - -boolean _Semaphore_Seize( - Semaphore_Control *the_semaphore, - rtems_option option_set + +rtems_status_code _Semaphore_Translate_core_semaphore_return_code ( + unsigned32 the_semaphore_status ) { - Thread_Control *executing; - ISR_Level level; - - executing = _Thread_Executing; - executing->Wait.return_code = RTEMS_SUCCESSFUL; - _ISR_Disable( level ); - if ( the_semaphore->count != 0 ) { - the_semaphore->count -= 1; - if ( _Attributes_Is_binary_semaphore( the_semaphore->attribute_set ) ) { - the_semaphore->holder = executing; - the_semaphore->holder_id = executing->Object.id; - the_semaphore->nest_count = 1; - executing->resource_count++; - } - _ISR_Enable( level ); - return( TRUE ); + switch ( the_semaphore_status ) { + case CORE_SEMAPHORE_STATUS_SUCCESSFUL: + return( RTEMS_SUCCESSFUL ); + case CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT: + return( RTEMS_UNSATISFIED ); + case CORE_SEMAPHORE_WAS_DELETED: + return( RTEMS_OBJECT_WAS_DELETED ); + case CORE_SEMAPHORE_TIMEOUT: + return( RTEMS_TIMEOUT ); + case THREAD_STATUS_PROXY_BLOCKING: + return( THREAD_STATUS_PROXY_BLOCKING ); } + _Internal_error_Occurred( + INTERNAL_ERROR_RTEMS_API, + TRUE, + the_semaphore_status + ); + return( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */ + return( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */ +} - if ( _Options_Is_no_wait( option_set ) ) { - _ISR_Enable( level ); - executing->Wait.return_code = RTEMS_UNSATISFIED; - return( TRUE ); - } +/*PAGE + * + * _Semaphore_Core_mutex_mp_support + * + * Input parameters: + * the_thread - the remote thread the semaphore was surrendered to + * id - id of the surrendered semaphore + * + * Output parameters: NONE + */ + +void _Semaphore_Core_mutex_mp_support ( + Thread_Control *the_thread, + Objects_Id id +) +{ + the_thread->receive_packet->return_code = RTEMS_SUCCESSFUL; + + _Semaphore_MP_Send_response_packet( + SEMAPHORE_MP_OBTAIN_RESPONSE, + id, + the_thread + ); +} - if ( _Attributes_Is_binary_semaphore( the_semaphore->attribute_set ) ) { - if ( _Objects_Are_ids_equal( - _Thread_Executing->Object.id, the_semaphore->holder_id ) ) { - the_semaphore->nest_count++; - _ISR_Enable( level ); - return( TRUE ); - } - } - the_semaphore->Wait_queue.sync = TRUE; - executing->Wait.queue = &the_semaphore->Wait_queue; - executing->Wait.id = the_semaphore->Object.id; - executing->Wait.option_set = option_set; - _ISR_Enable( level ); - return( FALSE ); +/*PAGE + * + * _Semaphore_Core_semaphore_mp_support + * + * Input parameters: + * the_thread - the remote thread the semaphore was surrendered to + * id - id of the surrendered semaphore + * + * Output parameters: NONE + */ + +void _Semaphore_Core_semaphore_mp_support ( + Thread_Control *the_thread, + Objects_Id id +) +{ + the_thread->receive_packet->return_code = RTEMS_SUCCESSFUL; + + _Semaphore_MP_Send_response_packet( + SEMAPHORE_MP_OBTAIN_RESPONSE, + id, + the_thread + ); } diff --git a/c/src/exec/rtems/src/semmp.c b/c/src/exec/rtems/src/semmp.c index 03ca51a228..c0a43f3f53 100644 --- a/c/src/exec/rtems/src/semmp.c +++ b/c/src/exec/rtems/src/semmp.c @@ -14,13 +14,15 @@ */ #include <rtems/system.h> -#include <rtems/mpci.h> -#include <rtems/mppkt.h> -#include <rtems/object.h> -#include <rtems/options.h> -#include <rtems/sem.h> -#include <rtems/thread.h> -#include <rtems/watchdog.h> +#include <rtems/rtems/status.h> +#include <rtems/core/mpci.h> +#include <rtems/core/mppkt.h> +#include <rtems/core/object.h> +#include <rtems/rtems/options.h> +#include <rtems/rtems/sem.h> +#include <rtems/core/thread.h> +#include <rtems/core/watchdog.h> +#include <rtems/rtems/support.h> /*PAGE * @@ -45,7 +47,7 @@ void _Semaphore_MP_Send_process_packet ( case SEMAPHORE_MP_EXTRACT_PROXY: the_packet = _Semaphore_MP_Get_packet(); - the_packet->Prefix.the_class = RTEMS_MP_PACKET_SEMAPHORE; + the_packet->Prefix.the_class = MP_PACKET_SEMAPHORE; the_packet->Prefix.length = sizeof ( Semaphore_MP_Packet ); the_packet->Prefix.to_convert = sizeof ( Semaphore_MP_Packet ); the_packet->operation = operation; @@ -78,8 +80,8 @@ void _Semaphore_MP_Send_process_packet ( rtems_status_code _Semaphore_MP_Send_request_packet ( Semaphore_MP_Remote_operations operation, Objects_Id semaphore_id, - rtems_option option_set, - rtems_interval timeout + rtems_option option_set, + rtems_interval timeout ) { Semaphore_MP_Packet *the_packet; @@ -90,7 +92,7 @@ rtems_status_code _Semaphore_MP_Send_request_packet ( case SEMAPHORE_MP_RELEASE_REQUEST: the_packet = _Semaphore_MP_Get_packet(); - the_packet->Prefix.the_class = RTEMS_MP_PACKET_SEMAPHORE; + the_packet->Prefix.the_class = MP_PACKET_SEMAPHORE; the_packet->Prefix.length = sizeof ( Semaphore_MP_Packet ); the_packet->Prefix.to_convert = sizeof ( Semaphore_MP_Packet ); if ( ! _Options_Is_no_wait(option_set)) @@ -222,7 +224,7 @@ void _Semaphore_MP_Process_packet ( the_packet->Prefix.timeout ); - if ( ! _Status_Is_proxy_blocking( the_packet->Prefix.return_code ) ) + if ( ! _Thread_Is_proxy_blocking( the_packet->Prefix.return_code ) ) _Semaphore_MP_Send_response_packet( SEMAPHORE_MP_OBTAIN_RESPONSE, the_packet->Prefix.id, diff --git a/c/src/exec/rtems/src/signal.c b/c/src/exec/rtems/src/signal.c index 8a300d2969..f43107fe12 100644 --- a/c/src/exec/rtems/src/signal.c +++ b/c/src/exec/rtems/src/signal.c @@ -14,14 +14,39 @@ */ #include <rtems/system.h> -#include <rtems/asr.h> -#include <rtems/isr.h> -#include <rtems/modes.h> -#include <rtems/signal.h> -#include <rtems/thread.h> +#include <rtems/rtems/status.h> +#include <rtems/rtems/asr.h> +#include <rtems/core/isr.h> +#include <rtems/rtems/modes.h> +#include <rtems/rtems/signal.h> +#include <rtems/core/thread.h> +#include <rtems/rtems/tasks.h> /*PAGE * + * _Signal_Manager_initialization + * + * This routine initializes all signal manager related data structures. + * + * Input parameters: NONE + * + * Output parameters: NONE + */ + +void _Signal_Manager_initialization( void ) +{ + /* + * Register the MP Process Packet routine. + */ + + _MPCI_Register_packet_processor( + MP_PACKET_SIGNAL, + _Signal_MP_Process_packet + ); +} + +/*PAGE + * * rtems_signal_catch * * This directive allows a thread to specify what action to take when @@ -41,21 +66,26 @@ rtems_status_code rtems_signal_catch( rtems_mode mode_set ) { - Thread_Control *executing; + Thread_Control *executing; + RTEMS_API_Control *api; + ASR_Information *asr; /* XXX normalize mode */ executing = _Thread_Executing; + api = executing->API_Extensions[ THREAD_API_RTEMS ]; + asr = &api->Signal; + _Thread_Disable_dispatch(); /* cannot reschedule while */ /* the thread is inconsistent */ if ( !_ASR_Is_null_handler( asr_handler ) ) { - executing->RTEMS_API->Signal.mode_set = mode_set; - executing->RTEMS_API->Signal.handler = asr_handler; + asr->mode_set = mode_set; + asr->handler = asr_handler; } else - _ASR_Initialize( &executing->RTEMS_API->Signal ); + _ASR_Initialize( asr ); _Thread_Enable_dispatch(); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } /*PAGE @@ -80,11 +110,13 @@ rtems_status_code rtems_signal_send( { register Thread_Control *the_thread; Objects_Locations location; + RTEMS_API_Control *api; + ASR_Information *asr; the_thread = _Thread_Get( id, &location ); switch ( location ) { case OBJECTS_ERROR: - return( RTEMS_INVALID_ID ); + return RTEMS_INVALID_ID; case OBJECTS_REMOTE: return _Signal_MP_Send_request_packet( SIGNAL_MP_SEND_REQUEST, @@ -92,22 +124,23 @@ rtems_status_code rtems_signal_send( signal_set ); case OBJECTS_LOCAL: - if ( ! _ASR_Is_null_handler( the_thread->RTEMS_API->Signal.handler ) ) { - if ( _Modes_Is_asr_disabled( the_thread->current_modes ) ) - _ASR_Post_signals( - signal_set, &the_thread->RTEMS_API->Signal.signals_pending ); - else { - _ASR_Post_signals( - signal_set, &the_thread->RTEMS_API->Signal.signals_posted ); + api = the_thread->API_Extensions[ THREAD_API_RTEMS ]; + asr = &api->Signal; + + if ( ! _ASR_Is_null_handler( asr->handler ) ) { + if ( asr->is_enabled ) { + _ASR_Post_signals( signal_set, &asr->signals_posted ); if ( _ISR_Is_in_progress() && _Thread_Is_executing( the_thread ) ) _ISR_Signals_to_thread_executing = TRUE; + } else { + _ASR_Post_signals( signal_set, &asr->signals_pending ); } _Thread_Enable_dispatch(); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } _Thread_Enable_dispatch(); - return( RTEMS_NOT_DEFINED ); + return RTEMS_NOT_DEFINED; } - return( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */ + return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ } diff --git a/c/src/exec/rtems/src/signalmp.c b/c/src/exec/rtems/src/signalmp.c index 4ac8123766..3a38818c25 100644 --- a/c/src/exec/rtems/src/signalmp.c +++ b/c/src/exec/rtems/src/signalmp.c @@ -14,14 +14,16 @@ */ #include <rtems/system.h> -#include <rtems/mpci.h> -#include <rtems/mppkt.h> -#include <rtems/object.h> -#include <rtems/options.h> -#include <rtems/signal.h> -#include <rtems/states.h> -#include <rtems/thread.h> -#include <rtems/watchdog.h> +#include <rtems/rtems/status.h> +#include <rtems/core/mpci.h> +#include <rtems/core/mppkt.h> +#include <rtems/core/object.h> +#include <rtems/rtems/options.h> +#include <rtems/rtems/signal.h> +#include <rtems/core/states.h> +#include <rtems/core/thread.h> +#include <rtems/core/watchdog.h> +#include <rtems/rtems/support.h> /*PAGE * @@ -51,7 +53,7 @@ rtems_status_code _Signal_MP_Send_request_packet ( case SIGNAL_MP_SEND_REQUEST: the_packet = _Signal_MP_Get_packet(); - the_packet->Prefix.the_class = RTEMS_MP_PACKET_SIGNAL; + the_packet->Prefix.the_class = MP_PACKET_SIGNAL; the_packet->Prefix.length = sizeof ( Signal_MP_Packet ); the_packet->Prefix.to_convert = sizeof ( Signal_MP_Packet ); the_packet->operation = operation; diff --git a/c/src/exec/rtems/src/taskmp.c b/c/src/exec/rtems/src/taskmp.c index 2b7fb214c6..98b0e9d3e5 100644 --- a/c/src/exec/rtems/src/taskmp.c +++ b/c/src/exec/rtems/src/taskmp.c @@ -14,13 +14,15 @@ */ #include <rtems/system.h> -#include <rtems/mpci.h> -#include <rtems/mppkt.h> -#include <rtems/object.h> -#include <rtems/options.h> -#include <rtems/tasks.h> -#include <rtems/thread.h> -#include <rtems/watchdog.h> +#include <rtems/rtems/status.h> +#include <rtems/core/mpci.h> +#include <rtems/core/mppkt.h> +#include <rtems/core/object.h> +#include <rtems/rtems/options.h> +#include <rtems/rtems/tasks.h> +#include <rtems/core/thread.h> +#include <rtems/core/watchdog.h> +#include <rtems/rtems/support.h> /*PAGE * @@ -42,7 +44,7 @@ void _RTEMS_tasks_MP_Send_process_packet ( case RTEMS_TASKS_MP_ANNOUNCE_DELETE: the_packet = _RTEMS_tasks_MP_Get_packet(); - the_packet->Prefix.the_class = RTEMS_MP_PACKET_TASKS; + the_packet->Prefix.the_class = MP_PACKET_TASKS; the_packet->Prefix.length = sizeof ( RTEMS_tasks_MP_Packet ); the_packet->Prefix.to_convert = sizeof ( RTEMS_tasks_MP_Packet ); the_packet->operation = operation; @@ -91,7 +93,7 @@ rtems_status_code _RTEMS_tasks_MP_Send_request_packet ( case RTEMS_TASKS_MP_SET_NOTE_REQUEST: the_packet = _RTEMS_tasks_MP_Get_packet(); - the_packet->Prefix.the_class = RTEMS_MP_PACKET_TASKS; + the_packet->Prefix.the_class = MP_PACKET_TASKS; the_packet->Prefix.length = sizeof ( RTEMS_tasks_MP_Packet ); the_packet->Prefix.to_convert = sizeof ( RTEMS_tasks_MP_Packet ); the_packet->operation = operation; @@ -332,7 +334,7 @@ void _RTEMS_tasks_MP_Process_packet ( RTEMS_tasks_MP_Packet *_RTEMS_tasks_MP_Get_packet ( void ) { - return ( (RTEMS_tasks_MP_Packet *) _MPCI_Get_packet() ); + return (RTEMS_tasks_MP_Packet *) _MPCI_Get_packet(); } /* end of file */ diff --git a/c/src/exec/rtems/src/tasks.c b/c/src/exec/rtems/src/tasks.c index 62bc8c1995..70ec7d6928 100644 --- a/c/src/exec/rtems/src/tasks.c +++ b/c/src/exec/rtems/src/tasks.c @@ -14,17 +14,148 @@ */ #include <rtems/system.h> -#include <rtems/support.h> -#include <rtems/modes.h> -#include <rtems/object.h> -#include <rtems/stack.h> -#include <rtems/states.h> -#include <rtems/tasks.h> -#include <rtems/thread.h> -#include <rtems/threadq.h> -#include <rtems/tod.h> -#include <rtems/userext.h> -#include <rtems/wkspace.h> +#include <rtems/rtems/status.h> +#include <rtems/rtems/support.h> +#include <rtems/rtems/modes.h> +#include <rtems/core/object.h> +#include <rtems/core/stack.h> +#include <rtems/core/states.h> +#include <rtems/rtems/tasks.h> +#include <rtems/core/thread.h> +#include <rtems/core/threadq.h> +#include <rtems/core/tod.h> +#include <rtems/core/userext.h> +#include <rtems/core/wkspace.h> +#include <rtems/core/intthrd.h> +#include <rtems/sysstate.h> + +/*PAGE + * + * _RTEMS_tasks_Create_extension + * + * XXX + */ + +boolean _RTEMS_tasks_Create_extension( + Thread_Control *executing, + Thread_Control *created +) +{ + RTEMS_API_Control *api; + + api = _Workspace_Allocate( sizeof( RTEMS_API_Control ) ); + + if ( !api ) + return FALSE; + + created->API_Extensions[ THREAD_API_RTEMS ] = api; + + api->pending_events = EVENT_SETS_NONE_PENDING; + _ASR_Initialize( &api->Signal ); + return TRUE; +} + +/*PAGE + * + * _RTEMS_tasks_Start_extension + * + * XXX + */ + +User_extensions_routine _RTEMS_tasks_Start_extension( + Thread_Control *executing, + Thread_Control *started +) +{ + RTEMS_API_Control *api; + + api = started->API_Extensions[ THREAD_API_RTEMS ]; + + api->pending_events = EVENT_SETS_NONE_PENDING; + + _ASR_Initialize( &api->Signal ); +} + +/*PAGE + * + * _RTEMS_tasks_Delete_extension + * + * XXX + */ + +User_extensions_routine _RTEMS_tasks_Delete_extension( + Thread_Control *executing, + Thread_Control *deleted +) +{ + (void) _Workspace_Free( deleted->API_Extensions[ THREAD_API_RTEMS ] ); + + deleted->API_Extensions[ THREAD_API_RTEMS ] = NULL; +} + +/*PAGE + * + * _RTEMS_tasks_Switch_extension + * + * XXX + */ + +User_extensions_routine _RTEMS_tasks_Switch_extension( + Thread_Control *executing +) +{ + ISR_Level level; + RTEMS_API_Control *api; + ASR_Information *asr; + rtems_signal_set signal_set; + Modes_Control prev_mode; + + api = executing->API_Extensions[ THREAD_API_RTEMS ]; + asr = &api->Signal; + + _ISR_Disable( level ); + + signal_set = asr->signals_posted; + + if ( signal_set ) { + /* if ( _ASR_Are_signals_pending( asr ) ) { + + signal_set = asr->signals_posted; */ + asr->signals_posted = 0; + _ISR_Enable( level ); + + asr->nest_level += 1; + rtems_task_mode( asr->mode_set, RTEMS_ALL_MODE_MASKS, &prev_mode ); + + (*asr->handler)( signal_set ); + + asr->nest_level -= 1; + rtems_task_mode( prev_mode, RTEMS_ALL_MODE_MASKS, &prev_mode ); + } + else + _ISR_Enable( level ); + +} + +Internal_threads_Extensions_control _RTEMS_tasks_Internal_thread_extensions = { + { NULL, NULL }, + NULL, /* predriver */ + _RTEMS_tasks_Initialize_user_tasks /* postdriver */ +}; + +User_extensions_Control _RTEMS_tasks_API_extensions = { + { NULL, NULL }, + { _RTEMS_tasks_Create_extension, /* create */ + _RTEMS_tasks_Start_extension, /* start */ + _RTEMS_tasks_Start_extension, /* restart */ + _RTEMS_tasks_Delete_extension, /* delete */ + NULL, /* switch */ + _RTEMS_tasks_Switch_extension, /* post switch */ + NULL, /* begin */ + NULL, /* exitted */ + NULL /* fatal */ + } +}; /*PAGE * @@ -39,9 +170,18 @@ */ void _RTEMS_tasks_Manager_initialization( - unsigned32 maximum_tasks + unsigned32 maximum_tasks, + unsigned32 number_of_initialization_tasks, + rtems_initialization_tasks_table *user_tasks ) { + + _RTEMS_tasks_Number_of_initialization_tasks = number_of_initialization_tasks; + _RTEMS_tasks_User_initialization_tasks = user_tasks; + + if ( user_tasks == NULL || number_of_initialization_tasks == 0 ) + _Internal_error_Occurred( INTERNAL_ERROR_RTEMS_API, TRUE, RTEMS_TOO_MANY ); + _Objects_Initialize_information( &_RTEMS_tasks_Information, OBJECTS_RTEMS_TASKS, @@ -52,6 +192,24 @@ void _RTEMS_tasks_Manager_initialization( RTEMS_MAXIMUM_NAME_LENGTH, TRUE ); + + /* + * Add all the extensions for this API + */ + + _User_extensions_Add_API_set( &_RTEMS_tasks_API_extensions ); + + _Internal_threads_Add_extension( &_RTEMS_tasks_Internal_thread_extensions ); + + /* + * Register the MP Process Packet routine. + */ + + _MPCI_Register_packet_processor( + MP_PACKET_TASKS, + _RTEMS_tasks_MP_Process_packet + ); + } /*PAGE @@ -89,12 +247,15 @@ rtems_status_code rtems_task_create( Objects_MP_Control *the_global_object = NULL; boolean is_fp; boolean is_global; + boolean status; rtems_attribute the_attribute_set; Priority_Control core_priority; + RTEMS_API_Control *api; + ASR_Information *asr; if ( !rtems_is_name_valid( name ) ) - return ( RTEMS_INVALID_NAME ); + return RTEMS_INVALID_NAME; /* * Core Thread Initialize insures we get the minimum amount of @@ -103,17 +264,17 @@ rtems_status_code rtems_task_create( #if 0 if ( !_Stack_Is_enough( stack_size ) ) - return( RTEMS_INVALID_SIZE ); + return RTEMS_INVALID_SIZE; #endif /* * Validate the RTEMS API priority and convert it to the core priority range. */ - if ( !_Priority_Is_valid( initial_priority ) ) - return( RTEMS_INVALID_PRIORITY ); + if ( !_RTEMS_tasks_Priority_is_valid( initial_priority ) ) + return RTEMS_INVALID_PRIORITY; - core_priority = _RTEMS_Tasks_Priority_to_Core( initial_priority ); + core_priority = _RTEMS_tasks_Priority_to_Core( initial_priority ); /* * Fix the attribute set to match the attributes which @@ -137,8 +298,8 @@ rtems_status_code rtems_task_create( is_global = TRUE; - if ( !_Configuration_Is_multiprocessing() ) - return( RTEMS_MP_NOT_CONFIGURED ); + if ( !_System_state_Is_multiprocessing ) + return RTEMS_MP_NOT_CONFIGURED; } else is_global = FALSE; @@ -167,7 +328,7 @@ rtems_status_code rtems_task_create( if ( !the_thread ) { _Thread_Enable_dispatch(); - return( RTEMS_TOO_MANY ); + return RTEMS_TOO_MANY; } if ( is_global ) { @@ -176,49 +337,45 @@ rtems_status_code rtems_task_create( if ( _Objects_MP_Is_null_global_object( the_global_object ) ) { _RTEMS_tasks_Free( the_thread ); _Thread_Enable_dispatch(); - return( RTEMS_TOO_MANY ); + return RTEMS_TOO_MANY; } } -#if 0 - /* - * Allocate and initialize the RTEMS API specific information - */ - - the_thread->RTEMS_API = _Workspace_Allocate( sizeof( RTEMS_API_Control ) ); - - if ( !the_thread->RTEMS_API ) { - _RTEMS_tasks_Free( the_thread ); - if ( is_global ) - _Objects_MP_Free_global_object( the_global_object ); - _Thread_Enable_dispatch(); - return( RTEMS_UNSATISFIED ); - } - - the_thread->RTEMS_API->pending_events = EVENT_SETS_NONE_PENDING; - _ASR_Initialize( &the_thread->RTEMS_API->Signal ); -#endif - /* * Initialize the core thread for this task. */ -/* XXX normalize mode */ + status = _Thread_Initialize( + &_RTEMS_tasks_Information, + the_thread, + NULL, + stack_size, + is_fp, + core_priority, + _Modes_Is_preempt(initial_modes) ? TRUE : FALSE, + _Modes_Is_timeslice(initial_modes) ? TRUE : FALSE, + _Modes_Get_interrupt_level(initial_modes), + &name + ); - if ( !_Thread_Initialize( &_RTEMS_tasks_Information, the_thread, - NULL, stack_size, is_fp, core_priority, initial_modes, &name ) ) { + if ( !status ) { if ( is_global ) _Objects_MP_Free_global_object( the_global_object ); _RTEMS_tasks_Free( the_thread ); _Thread_Enable_dispatch(); - return( RTEMS_UNSATISFIED ); + return RTEMS_UNSATISFIED; } + api = the_thread->API_Extensions[ THREAD_API_RTEMS ]; + asr = &api->Signal; + + asr->is_enabled = _Modes_Is_asr_disabled(initial_modes) ? FALSE : TRUE; + *id = the_thread->Object.id; if ( is_global ) { - the_thread->RTEMS_API->is_global = TRUE; + the_thread->is_global = TRUE; _Objects_MP_Open( &_RTEMS_tasks_Information, @@ -236,7 +393,7 @@ rtems_status_code rtems_task_create( } _Thread_Enable_dispatch(); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } /*PAGE @@ -263,11 +420,16 @@ rtems_status_code rtems_task_ident( Objects_Id *id ) { - if ( name != OBJECTS_ID_OF_SELF ) - return( _Objects_Name_to_id( &_RTEMS_tasks_Information, &name, node, id ) ); + Objects_Name_to_id_errors status; + + if ( name == OBJECTS_ID_OF_SELF ) { + *id = _Thread_Executing->Object.id; + return RTEMS_SUCCESSFUL; + } + + status = _Objects_Name_to_id( &_RTEMS_tasks_Information, &name, node, id ); - *id = _Thread_Executing->Object.id; - return( RTEMS_SUCCESSFUL ); + return _Status_Object_name_errors_to_status[ status ]; } /*PAGE @@ -298,26 +460,26 @@ rtems_status_code rtems_task_start( Objects_Locations location; if ( entry_point == NULL ) - return( RTEMS_INVALID_ADDRESS ); + return RTEMS_INVALID_ADDRESS; the_thread = _Thread_Get( id, &location ); switch ( location ) { case OBJECTS_ERROR: - return( RTEMS_INVALID_ID ); + return RTEMS_INVALID_ID; case OBJECTS_REMOTE: _Thread_Dispatch(); - return( RTEMS_ILLEGAL_ON_REMOTE_OBJECT ); + return RTEMS_ILLEGAL_ON_REMOTE_OBJECT; case OBJECTS_LOCAL: if ( _Thread_Start( the_thread, THREAD_START_NUMERIC, entry_point, NULL, argument ) ) { _Thread_Enable_dispatch(); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } _Thread_Enable_dispatch(); - return( RTEMS_INCORRECT_STATE ); + return RTEMS_INCORRECT_STATE; } - return( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */ + return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ } /*PAGE @@ -349,25 +511,20 @@ rtems_status_code rtems_task_restart( the_thread = _Thread_Get( id, &location ); switch ( location ) { case OBJECTS_ERROR: - return( RTEMS_INVALID_ID ); + return RTEMS_INVALID_ID; case OBJECTS_REMOTE: _Thread_Dispatch(); - return( RTEMS_ILLEGAL_ON_REMOTE_OBJECT ); + return RTEMS_ILLEGAL_ON_REMOTE_OBJECT; case OBJECTS_LOCAL: if ( _Thread_Restart( the_thread, NULL, argument ) ) { - - /* XXX until these are in an API extension they are too late. */ - _ASR_Initialize( &the_thread->RTEMS_API->Signal ); - the_thread->RTEMS_API->pending_events = EVENT_SETS_NONE_PENDING; - _Thread_Enable_dispatch(); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } _Thread_Enable_dispatch(); - return( RTEMS_INCORRECT_STATE ); + return RTEMS_INCORRECT_STATE; } - return( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */ + return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ } /*PAGE @@ -398,19 +555,16 @@ rtems_status_code rtems_task_delete( the_thread = _Thread_Get( id, &location ); switch ( location ) { case OBJECTS_ERROR: - return( RTEMS_INVALID_ID ); + return RTEMS_INVALID_ID; case OBJECTS_REMOTE: _Thread_Dispatch(); - return( RTEMS_ILLEGAL_ON_REMOTE_OBJECT ); + return RTEMS_ILLEGAL_ON_REMOTE_OBJECT; case OBJECTS_LOCAL: _Thread_Close( &_RTEMS_tasks_Information, the_thread ); - /* XXX */ - (void) _Workspace_Free( the_thread->RTEMS_API ); - _RTEMS_tasks_Free( the_thread ); - if ( _Attributes_Is_global( the_thread->RTEMS_API->is_global ) ) { + if ( the_thread->is_global ) { _Objects_MP_Close( &_RTEMS_tasks_Information, the_thread->Object.id ); @@ -422,10 +576,10 @@ rtems_status_code rtems_task_delete( } _Thread_Enable_dispatch(); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } - return( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */ + return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ } /*PAGE @@ -454,28 +608,26 @@ rtems_status_code rtems_task_suspend( the_thread = _Thread_Get( id, &location ); switch ( location ) { case OBJECTS_ERROR: - return( RTEMS_INVALID_ID ); + return RTEMS_INVALID_ID; case OBJECTS_REMOTE: - return( - _RTEMS_tasks_MP_Send_request_packet( - RTEMS_TASKS_MP_SUSPEND_REQUEST, - id, - 0, /* Not used */ - 0, /* Not used */ - 0 /* Not used */ - ) + return _RTEMS_tasks_MP_Send_request_packet( + RTEMS_TASKS_MP_SUSPEND_REQUEST, + id, + 0, /* Not used */ + 0, /* Not used */ + 0 /* Not used */ ); case OBJECTS_LOCAL: if ( !_States_Is_suspended( the_thread->current_state ) ) { _Thread_Set_state( the_thread, STATES_SUSPENDED ); _Thread_Enable_dispatch(); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } _Thread_Enable_dispatch(); - return( RTEMS_ALREADY_SUSPENDED ); + return RTEMS_ALREADY_SUSPENDED; } - return( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */ + return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ } /*PAGE @@ -503,7 +655,7 @@ rtems_status_code rtems_task_resume( the_thread = _Thread_Get( id, &location ); switch ( location ) { case OBJECTS_ERROR: - return( RTEMS_INVALID_ID ); + return RTEMS_INVALID_ID; case OBJECTS_REMOTE: return( _RTEMS_tasks_MP_Send_request_packet( @@ -518,13 +670,13 @@ rtems_status_code rtems_task_resume( if ( _States_Is_suspended( the_thread->current_state ) ) { _Thread_Resume( the_thread ); _Thread_Enable_dispatch(); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } _Thread_Enable_dispatch(); - return( RTEMS_INCORRECT_STATE ); + return RTEMS_INCORRECT_STATE; } - return( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */ + return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ } /*PAGE @@ -556,13 +708,13 @@ rtems_status_code rtems_task_set_priority( Objects_Locations location; if ( new_priority != RTEMS_CURRENT_PRIORITY && - !_Priority_Is_valid( new_priority ) ) - return( RTEMS_INVALID_PRIORITY ); + !_RTEMS_tasks_Priority_is_valid( new_priority ) ) + return RTEMS_INVALID_PRIORITY; the_thread = _Thread_Get( id, &location ); switch ( location ) { case OBJECTS_ERROR: - return( RTEMS_INVALID_ID ); + return RTEMS_INVALID_ID; case OBJECTS_REMOTE: _Thread_Executing->Wait.return_argument = old_priority; return( @@ -583,10 +735,10 @@ rtems_status_code rtems_task_set_priority( _Thread_Change_priority( the_thread, new_priority ); } _Thread_Enable_dispatch(); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } - return( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */ + return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ } /*PAGE @@ -603,7 +755,7 @@ rtems_status_code rtems_task_set_priority( * * Output: * *previous_mode_set - previous mode set - * always returns RTEMS_SUCCESSFUL + * always return RTEMS_SUCCESSFUL; */ rtems_status_code rtems_task_mode( @@ -612,9 +764,62 @@ rtems_status_code rtems_task_mode( rtems_mode *previous_mode_set ) { - if ( _Thread_Change_mode( mode_set, mask, previous_mode_set ) ) + Thread_Control *executing; + RTEMS_API_Control *api; + ASR_Information *asr; + boolean is_asr_enabled = FALSE; + boolean needs_asr_dispatching = FALSE; + rtems_mode old_mode; + + executing = _Thread_Executing; + api = executing->API_Extensions[ THREAD_API_RTEMS ]; + asr = &api->Signal; + + old_mode = (executing->is_preemptible) ? RTEMS_PREEMPT : RTEMS_NO_PREEMPT; + old_mode |= (executing->is_timeslice) ? RTEMS_TIMESLICE : RTEMS_NO_TIMESLICE; + old_mode |= (asr->is_enabled) ? RTEMS_ASR : RTEMS_NO_ASR; + old_mode |= _ISR_Get_level(); + + *previous_mode_set = old_mode; + + /* + * These are generic thread scheduling characteristics. + */ + + if ( mask & RTEMS_PREEMPT_MASK ) + executing->is_preemptible = _Modes_Is_preempt(mode_set) ? TRUE : FALSE; + + if ( mask & RTEMS_TIMESLICE_MASK ) + executing->is_timeslice = _Modes_Is_timeslice(mode_set) ? TRUE : FALSE; + + /* + * Set the new interrupt level + */ + + if ( mask & RTEMS_INTERRUPT_MASK ) + _Modes_Set_interrupt_level( mode_set ); + + /* + * This is specific to the RTEMS API + */ + + is_asr_enabled = FALSE; + needs_asr_dispatching = FALSE; + + if ( mask & RTEMS_ASR_MASK ) { + is_asr_enabled = _Modes_Is_asr_disabled( mode_set ) ? FALSE : TRUE; + if ( is_asr_enabled != asr->is_enabled ) { + asr->is_enabled = is_asr_enabled; + _ASR_Swap_signals( asr ); + if ( _ASR_Are_signals_pending( asr ) ) + needs_asr_dispatching = TRUE; + } + } + + if ( _Thread_Evaluate_mode() || needs_asr_dispatching ) _Thread_Dispatch(); - return( RTEMS_SUCCESSFUL ); + + return RTEMS_SUCCESSFUL; } /*PAGE @@ -643,6 +848,7 @@ rtems_status_code rtems_task_get_note( { register Thread_Control *the_thread; Objects_Locations location; + RTEMS_API_Control *api; /* * NOTE: There is no check for < RTEMS_NOTEPAD_FIRST because that would @@ -650,7 +856,7 @@ rtems_status_code rtems_task_get_note( */ if ( notepad > RTEMS_NOTEPAD_LAST ) - return( RTEMS_INVALID_NUMBER ); + return RTEMS_INVALID_NUMBER; /* * Optimize the most likely case to avoid the Thread_Dispatch. @@ -658,14 +864,15 @@ rtems_status_code rtems_task_get_note( if ( _Objects_Are_ids_equal( id, OBJECTS_ID_OF_SELF ) || _Objects_Are_ids_equal( id, _Thread_Executing->Object.id ) ) { - *note = _Thread_Executing->RTEMS_API->Notepads[ notepad ]; - return( RTEMS_SUCCESSFUL ); + api = _Thread_Executing->API_Extensions[ THREAD_API_RTEMS ]; + *note = api->Notepads[ notepad ]; + return RTEMS_SUCCESSFUL; } the_thread = _Thread_Get( id, &location ); switch ( location ) { case OBJECTS_ERROR: - return( RTEMS_INVALID_ID ); + return RTEMS_INVALID_ID; case OBJECTS_REMOTE: _Thread_Executing->Wait.return_argument = note; @@ -677,12 +884,13 @@ rtems_status_code rtems_task_get_note( 0 /* Not used */ ); case OBJECTS_LOCAL: - *note= the_thread->RTEMS_API->Notepads[ notepad ]; + api = the_thread->API_Extensions[ THREAD_API_RTEMS ]; + *note = api->Notepads[ notepad ]; _Thread_Enable_dispatch(); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } - return( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */ + return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ } /*PAGE @@ -710,6 +918,7 @@ rtems_status_code rtems_task_set_note( { register Thread_Control *the_thread; Objects_Locations location; + RTEMS_API_Control *api; /* * NOTE: There is no check for < RTEMS_NOTEPAD_FIRST because that would @@ -717,7 +926,7 @@ rtems_status_code rtems_task_set_note( */ if ( notepad > RTEMS_NOTEPAD_LAST ) - return( RTEMS_INVALID_NUMBER ); + return RTEMS_INVALID_NUMBER; /* * Optimize the most likely case to avoid the Thread_Dispatch. @@ -725,14 +934,15 @@ rtems_status_code rtems_task_set_note( if ( _Objects_Are_ids_equal( id, OBJECTS_ID_OF_SELF ) || _Objects_Are_ids_equal( id, _Thread_Executing->Object.id ) ) { - _Thread_Executing->RTEMS_API->Notepads[ notepad ] = note; - return( RTEMS_SUCCESSFUL ); + api = _Thread_Executing->API_Extensions[ THREAD_API_RTEMS ]; + api->Notepads[ notepad ] = note; + return RTEMS_SUCCESSFUL; } the_thread = _Thread_Get( id, &location ); switch ( location ) { case OBJECTS_ERROR: - return( RTEMS_INVALID_ID ); + return RTEMS_INVALID_ID; case OBJECTS_REMOTE: return _RTEMS_tasks_MP_Send_request_packet( RTEMS_TASKS_MP_SET_NOTE_REQUEST, @@ -743,12 +953,13 @@ rtems_status_code rtems_task_set_note( ); case OBJECTS_LOCAL: - the_thread->RTEMS_API->Notepads[ notepad ] = note; + api = the_thread->API_Extensions[ THREAD_API_RTEMS ]; + api->Notepads[ notepad ] = note; _Thread_Enable_dispatch(); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } - return( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */ + return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ } /*PAGE @@ -785,7 +996,7 @@ rtems_status_code rtems_task_wake_after( ticks, WATCHDOG_ACTIVATE_NOW ); _Thread_Enable_dispatch(); } - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } /*PAGE @@ -807,23 +1018,20 @@ rtems_status_code rtems_task_wake_when( rtems_time_of_day *time_buffer ) { - rtems_interval seconds; - rtems_status_code local_result; + Watchdog_Interval seconds; if ( !_TOD_Is_set() ) - return( RTEMS_NOT_DEFINED ); + return RTEMS_NOT_DEFINED; time_buffer->ticks = 0; - local_result = _TOD_Validate( time_buffer ); - - if ( !rtems_is_status_successful( local_result ) ) - return( local_result ); + if ( !_TOD_Validate( time_buffer ) ) + return RTEMS_INVALID_CLOCK; seconds = _TOD_To_seconds( time_buffer ); if ( seconds <= _TOD_Seconds_since_epoch ) - return( RTEMS_INVALID_CLOCK ); + return RTEMS_INVALID_CLOCK; _Thread_Disable_dispatch(); _Thread_Set_state( _Thread_Executing, STATES_WAITING_FOR_TIME ); @@ -836,5 +1044,57 @@ rtems_time_of_day *time_buffer _Watchdog_Insert_seconds( &_Thread_Executing->Timer, seconds - _TOD_Seconds_since_epoch, WATCHDOG_ACTIVATE_NOW ); _Thread_Enable_dispatch(); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } + +/*PAGE + * + * _RTEMS_tasks_Initialize_user_tasks + * + * This routine creates and starts all configured user + * initialzation threads. + * + * Input parameters: NONE + * + * Output parameters: NONE + */ + +void _RTEMS_tasks_Initialize_user_tasks( void ) +{ + unsigned32 index; + unsigned32 maximum; + rtems_id id; + rtems_status_code return_value; + rtems_initialization_tasks_table *user_tasks; + + /* + * NOTE: This is slightly different from the Ada implementation. + */ + + user_tasks = _RTEMS_tasks_User_initialization_tasks; + maximum = _RTEMS_tasks_Number_of_initialization_tasks; + + for ( index=0 ; index < maximum ; index++ ) { + return_value = rtems_task_create( + user_tasks[ index ].name, + user_tasks[ index ].initial_priority, + user_tasks[ index ].stack_size, + user_tasks[ index ].mode_set, + user_tasks[ index ].attribute_set, + &id + ); + + if ( !rtems_is_status_successful( return_value ) ) + _Internal_error_Occurred( INTERNAL_ERROR_RTEMS_API, TRUE, return_value ); + + return_value = rtems_task_start( + id, + user_tasks[ index ].entry_point, + user_tasks[ index ].argument + ); + + if ( !rtems_is_status_successful( return_value ) ) + _Internal_error_Occurred( INTERNAL_ERROR_RTEMS_API, TRUE, return_value ); + } +} + diff --git a/c/src/exec/rtems/src/timer.c b/c/src/exec/rtems/src/timer.c index 68d9e4591b..c59e137d0c 100644 --- a/c/src/exec/rtems/src/timer.c +++ b/c/src/exec/rtems/src/timer.c @@ -14,12 +14,13 @@ */ #include <rtems/system.h> -#include <rtems/support.h> -#include <rtems/object.h> -#include <rtems/thread.h> -#include <rtems/timer.h> -#include <rtems/tod.h> -#include <rtems/watchdog.h> +#include <rtems/rtems/status.h> +#include <rtems/rtems/support.h> +#include <rtems/core/object.h> +#include <rtems/core/thread.h> +#include <rtems/rtems/timer.h> +#include <rtems/core/tod.h> +#include <rtems/core/watchdog.h> /*PAGE * @@ -73,7 +74,7 @@ rtems_status_code rtems_timer_create( Timer_Control *the_timer; if ( !rtems_is_name_valid( name ) ) - return ( RTEMS_INVALID_NAME ); + return RTEMS_INVALID_NAME; _Thread_Disable_dispatch(); /* to prevent deletion */ @@ -81,7 +82,7 @@ rtems_status_code rtems_timer_create( if ( !the_timer ) { _Thread_Enable_dispatch(); - return( RTEMS_TOO_MANY ); + return RTEMS_TOO_MANY; } the_timer->the_class = TIMER_DORMANT; @@ -90,7 +91,7 @@ rtems_status_code rtems_timer_create( *id = the_timer->Object.id; _Thread_Enable_dispatch(); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } /*PAGE @@ -115,12 +116,16 @@ rtems_status_code rtems_timer_ident( Objects_Id *id ) { - return _Objects_Name_to_id( + Objects_Name_to_id_errors status; + + status = _Objects_Name_to_id( &_Timer_Information, &name, - RTEMS_SEARCH_LOCAL_NODE, + OBJECTS_SEARCH_LOCAL_NODE, id ); + + return _Status_Object_name_errors_to_status[ status ]; } /*PAGE @@ -147,17 +152,17 @@ rtems_status_code rtems_timer_cancel( the_timer = _Timer_Get( id, &location ); switch ( location ) { case OBJECTS_ERROR: - return( RTEMS_INVALID_ID ); + return RTEMS_INVALID_ID; case OBJECTS_REMOTE: /* should never return this */ - return( RTEMS_INTERNAL_ERROR ); + return RTEMS_INTERNAL_ERROR; case OBJECTS_LOCAL: if ( !_Timer_Is_dormant_class( the_timer->the_class ) ) (void) _Watchdog_Remove( &the_timer->Ticker ); _Thread_Enable_dispatch(); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } - return( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */ + return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ } /*PAGE @@ -184,18 +189,18 @@ rtems_status_code rtems_timer_delete( the_timer = _Timer_Get( id, &location ); switch ( location ) { case OBJECTS_ERROR: - return( RTEMS_INVALID_ID ); + return RTEMS_INVALID_ID; case OBJECTS_REMOTE: /* should never return this */ - return( RTEMS_INTERNAL_ERROR ); + return RTEMS_INTERNAL_ERROR; case OBJECTS_LOCAL: _Objects_Close( &_Timer_Information, &the_timer->Object ); (void) _Watchdog_Remove( &the_timer->Ticker ); _Timer_Free( the_timer ); _Thread_Enable_dispatch(); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } - return( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */ + return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ } /*PAGE @@ -215,24 +220,24 @@ rtems_status_code rtems_timer_delete( */ rtems_status_code rtems_timer_fire_after( - Objects_Id id, - rtems_interval ticks, - Timer_Service routine, - void *user_data + Objects_Id id, + rtems_interval ticks, + rtems_timer_service_routine_entry routine, + void *user_data ) { Timer_Control *the_timer; Objects_Locations location; if ( ticks == 0 ) - return( RTEMS_INVALID_NUMBER ); + return RTEMS_INVALID_NUMBER; the_timer = _Timer_Get( id, &location ); switch ( location ) { case OBJECTS_ERROR: - return( RTEMS_INVALID_ID ); + return RTEMS_INVALID_ID; case OBJECTS_REMOTE: /* should never return this */ - return( RTEMS_INTERNAL_ERROR ); + return RTEMS_INTERNAL_ERROR; case OBJECTS_LOCAL: (void) _Watchdog_Remove( &the_timer->Ticker ); the_timer->the_class = TIMER_INTERVAL; @@ -240,10 +245,10 @@ rtems_status_code rtems_timer_fire_after( _Watchdog_Insert_ticks( &the_timer->Ticker, ticks, WATCHDOG_ACTIVATE_NOW ); _Thread_Enable_dispatch(); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } - return( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */ + return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ } /*PAGE @@ -263,34 +268,32 @@ rtems_status_code rtems_timer_fire_after( */ rtems_status_code rtems_timer_fire_when( - Objects_Id id, - rtems_time_of_day *wall_time, - Timer_Service routine, - void *user_data + Objects_Id id, + rtems_time_of_day *wall_time, + rtems_timer_service_routine_entry routine, + void *user_data ) { - Timer_Control *the_timer; - Objects_Locations location; - rtems_status_code validate_status; + Timer_Control *the_timer; + Objects_Locations location; rtems_interval seconds; if ( !_TOD_Is_set() ) - return( RTEMS_NOT_DEFINED ); + return RTEMS_NOT_DEFINED; - validate_status = _TOD_Validate( wall_time ); - if ( !rtems_is_status_successful( validate_status ) ) - return( validate_status ); + if ( !_TOD_Validate( wall_time ) ) + return RTEMS_INVALID_CLOCK; seconds = _TOD_To_seconds( wall_time ); if ( seconds <= _TOD_Seconds_since_epoch ) - return( RTEMS_INVALID_CLOCK ); + return RTEMS_INVALID_CLOCK; the_timer = _Timer_Get( id, &location ); switch ( location ) { case OBJECTS_ERROR: - return( RTEMS_INVALID_ID ); + return RTEMS_INVALID_ID; case OBJECTS_REMOTE: /* should never return this */ - return( RTEMS_INTERNAL_ERROR ); + return RTEMS_INTERNAL_ERROR; case OBJECTS_LOCAL: (void) _Watchdog_Remove( &the_timer->Ticker ); the_timer->the_class = TIMER_TIME_OF_DAY; @@ -298,10 +301,10 @@ rtems_status_code rtems_timer_fire_when( _Watchdog_Insert_seconds( &the_timer->Ticker, seconds - _TOD_Seconds_since_epoch, WATCHDOG_ACTIVATE_NOW ); _Thread_Enable_dispatch(); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } - return( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */ + return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ } /*PAGE @@ -328,18 +331,18 @@ rtems_status_code rtems_timer_reset( the_timer = _Timer_Get( id, &location ); switch ( location ) { case OBJECTS_ERROR: - return( RTEMS_INVALID_ID ); + return RTEMS_INVALID_ID; case OBJECTS_REMOTE: /* should never return this */ - return( RTEMS_INTERNAL_ERROR ); + return RTEMS_INTERNAL_ERROR; case OBJECTS_LOCAL: if ( _Timer_Is_interval_class( the_timer->the_class ) ) { _Watchdog_Reset( &the_timer->Ticker ); _Thread_Enable_dispatch(); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } _Thread_Enable_dispatch(); - return( RTEMS_NOT_DEFINED ); + return RTEMS_NOT_DEFINED; } - return( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */ + return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ } diff --git a/c/src/exec/sapi/headers/config.h b/c/src/exec/sapi/headers/config.h index 766ea4a4a8..31e8093387 100644 --- a/c/src/exec/sapi/headers/config.h +++ b/c/src/exec/sapi/headers/config.h @@ -21,164 +21,12 @@ extern "C" { #endif -#include <rtems/types.h> -#include <rtems/object.h> -#include <rtems/thread.h> - -/* - * The following records define the Initialization Tasks Table. - * Each entry contains the information required by RTEMS to - * create and start a user task automatically at executive - * initialization time. - */ - -typedef struct { - rtems_name name; /* task name */ - unsigned32 stack_size; /* task stack size */ - rtems_task_priority initial_priority; /* task priority */ - rtems_attribute attribute_set; /* task attributes */ - rtems_task_entry entry_point; /* task entry point */ - rtems_mode mode_set; /* task initial mode */ - unsigned32 argument; /* task argument */ -} rtems_initialization_tasks_table; - -/* - * - * The following defines the types for: - * - * + major and minor numbers - * + the return type of a device driver entry - * + a pointer to a device driver entry - * + an entry in the the Device Driver Address Table. Each entry in this - * table corresponds to an application provided device driver and - * defines the entry points for that device driver. - */ - -typedef unsigned32 rtems_device_major_number; -typedef unsigned32 rtems_device_minor_number; - -typedef rtems_status_code rtems_device_driver; - -typedef rtems_device_driver ( *rtems_device_driver_entry )( - rtems_device_major_number, - rtems_device_minor_number, - void * - ); - -typedef struct { - rtems_device_driver_entry initialization; /* initialization procedure */ - rtems_device_driver_entry open; /* open request procedure */ - rtems_device_driver_entry close; /* close request procedure */ - rtems_device_driver_entry read; /* read request procedure */ - rtems_device_driver_entry write; /* write request procedure */ - rtems_device_driver_entry control; /* special functions procedure */ -} rtems_driver_address_table; - -/* - * The following records defines the User Extension Table. - * This table defines the application dependent routines which - * are invoked at critical points in the life of each task and - * the system as a whole. - */ - -typedef void rtems_extension; - -typedef rtems_extension ( *rtems_task_create_extension )( - rtems_tcb *, - rtems_tcb * - ); - -typedef rtems_extension ( *rtems_task_delete_extension )( - rtems_tcb *, - rtems_tcb * - ); - -typedef rtems_extension ( *rtems_task_start_extension )( - rtems_tcb *, - rtems_tcb * - ); - -typedef rtems_extension ( *rtems_task_restart_extension )( - rtems_tcb *, - rtems_tcb * - ); - -typedef rtems_extension ( *rtems_task_switch_extension )( - rtems_tcb *, - rtems_tcb * - ); - -typedef rtems_extension ( *rtems_task_begin_extension )( - rtems_tcb * - ); - -typedef rtems_extension ( *rtems_task_exitted_extension )( - rtems_tcb * - ); - -typedef rtems_extension ( *rtems_fatal_extension )( - unsigned32 - ); - -typedef struct { - rtems_task_create_extension rtems_task_create; - rtems_task_start_extension rtems_task_start; - rtems_task_restart_extension rtems_task_restart; - rtems_task_delete_extension rtems_task_delete; - rtems_task_switch_extension task_switch; - rtems_task_begin_extension task_begin; - rtems_task_exitted_extension task_exitted; - rtems_fatal_extension fatal; -} rtems_extensions_table; - -/* - * The following records define the Multiprocessor Communications - * Interface (MPCI) Table. This table defines the user-provided - * MPCI which is a required part of a multiprocessor RTEMS system. - * - * For non-blocking local operations that become remote operations, - * we need a timeout. This is a per-driver timeout: default_timeout - */ - -/* XXX FORWARD REFERENCES */ - -typedef struct Configuration_Table rtems_configuration_table; -typedef struct Configuration_Table_MP rtems_multiprocessing_table; - -typedef void rtems_mpci_entry; - -typedef rtems_mpci_entry ( *rtems_mpci_initialization_entry )( - rtems_configuration_table *, - rtems_cpu_table *, - rtems_multiprocessing_table * - ); - -typedef rtems_mpci_entry ( *rtems_mpci_get_packet_entry )( - rtems_packet_prefix ** - ); - -typedef rtems_mpci_entry ( *rtems_mpci_return_packet_entry )( - rtems_packet_prefix * - ); - -typedef rtems_mpci_entry ( *rtems_mpci_send_entry )( - unsigned32, - rtems_packet_prefix * - ); - -typedef rtems_mpci_entry ( *rtems_mpci_receive_entry )( - rtems_packet_prefix ** - ); - -typedef struct { - unsigned32 default_timeout; /* in ticks */ - unsigned32 maximum_packet_size; - rtems_mpci_initialization_entry initialization; - rtems_mpci_get_packet_entry get_packet; - rtems_mpci_return_packet_entry return_packet; - rtems_mpci_send_entry send_packet; - rtems_mpci_receive_entry receive_packet; -} rtems_mpci_table; +#include <rtems/rtems/status.h> +#include <rtems/extension.h> +#include <rtems/io.h> +#include <rtems/core/mpci.h> +#include <rtems/rtems/types.h> +#include <rtems/rtems/tasks.h> /* * The following records define the Multiprocessor Configuration @@ -187,13 +35,13 @@ typedef struct { * system. */ -struct Configuration_Table_MP { - unsigned32 node; /* local node number */ - unsigned32 maximum_nodes; /* maximum # nodes in system */ - unsigned32 maximum_global_objects; /* maximum # global objects */ - unsigned32 maximum_proxies; /* maximum # proxies */ - rtems_mpci_table *User_mpci_table; /* pointer to MPCI table */ -}; +typedef struct { + unsigned32 node; /* local node number */ + unsigned32 maximum_nodes; /* maximum # nodes in system */ + unsigned32 maximum_global_objects; /* maximum # global objects */ + unsigned32 maximum_proxies; /* maximum # proxies */ + MPCI_Control *User_mpci_table; /* pointer to MPCI table */ +} rtems_multiprocessing_table; /* * The following records define the Configuration Table. The @@ -207,7 +55,7 @@ struct Configuration_Table_MP { * + clock ticks per task timeslice */ -struct Configuration_Table { +typedef struct { void *work_space_start; unsigned32 work_space_size; unsigned32 maximum_tasks; @@ -224,92 +72,19 @@ struct Configuration_Table { unsigned32 number_of_initialization_tasks; rtems_initialization_tasks_table *User_initialization_tasks_table; unsigned32 number_of_device_drivers; + unsigned32 maximum_devices; rtems_driver_address_table *Device_driver_table; rtems_extensions_table *User_extension_table; rtems_multiprocessing_table *User_multiprocessing_table; -}; - -/* - * The following defines the default Multiprocessing Configuration - * Table. This table is used in a single processor system. - */ - -extern const rtems_multiprocessing_table - _Configuration_Default_multiprocessing_table; - -/* - * The following define the internal pointers to the user's - * configuration information. - */ - -EXTERN rtems_configuration_table *_Configuration_Table; -EXTERN rtems_multiprocessing_table *_Configuration_MP_table; -EXTERN rtems_mpci_table *_Configuration_MPCI_table; - -/* - * - * _Configuration_Handler_initialization - * - * DESCRIPTION: - * - * This routine performs the initialization necessary for this handler. - */ - -STATIC INLINE void _Configuration_Handler_initialization( - rtems_configuration_table *configuration_table, - rtems_multiprocessing_table *multiprocessing_table, - rtems_mpci_table *users_mpci_table -); - -/* - * _Configuration_Is_multiprocessing - * - * DESCRIPTION: - * - * This function determines if a multiprocessing application has been - * configured, if so, TRUE is returned, otherwise FALSE is returned. - */ - -STATIC INLINE boolean _Configuration_Is_multiprocessing( void ); - -/* - * _Configuration_Is_null_driver_address_table_pointer - * - * DESCRIPTION: - * - * This function returns TRUE if the_table is NULL and FALSE otherwise. - */ - -STATIC INLINE boolean _Configuration_Is_null_driver_address_table_pointer( - rtems_driver_address_table *the_table -); - -/* - * _Configuration_Is_null_extension_table_pointer - * - * DESCRIPTION: - * - * This function returns TRUE if the_table is NULL and FALSE otherwise. - */ - -STATIC INLINE boolean _Configuration_Is_null_extension_table_pointer( - rtems_extensions_table *the_table -); +} rtems_configuration_table; /* - * _Configuration_Is_null_initialization_tasks_table_pointer - * - * DESCRIPTION: - * - * This function returns TRUE if the_table is NULL and FALSE otherwise. + * The following are provided strictly for the convenience of + * the user. They are not used in RTEMS itself. */ -STATIC INLINE boolean - _Configuration_Is_null_initialization_tasks_table_pointer( - rtems_initialization_tasks_table *the_table -); - -#include <rtems/config.inl> +EXTERN rtems_configuration_table *_Configuration_Table; +EXTERN rtems_multiprocessing_table *_Configuration_MP_table; #ifdef __cplusplus } diff --git a/c/src/exec/sapi/headers/directives.h b/c/src/exec/sapi/headers/directives.h index 2b26672a0c..afcd56278f 100644 --- a/c/src/exec/sapi/headers/directives.h +++ b/c/src/exec/sapi/headers/directives.h @@ -106,6 +106,12 @@ extern "C" { #define RTEMS_NUMBER_OF_ENTRY_POINTS 82 +/* + * The jump table of entry points into RTEMS directives. + */ + +extern const void *_Entry_points[ RTEMS_NUMBER_OF_ENTRY_POINTS ]; + #ifdef __cplusplus } #endif diff --git a/c/src/exec/sapi/headers/extension.h b/c/src/exec/sapi/headers/extension.h index b447cc43fe..57c8a54271 100644 --- a/c/src/exec/sapi/headers/extension.h +++ b/c/src/exec/sapi/headers/extension.h @@ -28,9 +28,28 @@ extern "C" { #endif -#include <rtems.h> -#include <rtems/object.h> -#include <rtems/userext.h> +#include <rtems/core/object.h> +#include <rtems/core/userext.h> +#include <rtems/rtems/status.h> /* XXX */ +#include <rtems/rtems/types.h> /* XXX */ + +/* + * Extension related types + */ + +typedef User_extensions_routine rtems_extension; +typedef User_extensions_thread_create_extension rtems_task_create_extension; +typedef User_extensions_thread_delete_extension rtems_task_delete_extension; +typedef User_extensions_thread_start_extension rtems_task_start_extension; +typedef User_extensions_thread_restart_extension rtems_task_restart_extension; +typedef User_extensions_thread_switch_extension rtems_task_switch_extension; +typedef User_extensions_thread_post_switch_extension + rtems_task_post_switch_extension; +typedef User_extensions_thread_begin_extension rtems_task_begin_extension; +typedef User_extensions_thread_exitted_extension rtems_task_exitted_extension; +typedef User_extensions_fatal_extension rtems_fatal_extension; + +typedef User_extensions_Table rtems_extensions_table; /* * The following defines the information control block used to manage @@ -73,9 +92,9 @@ void _Extension_Manager_initialization( */ rtems_status_code rtems_extension_create( - rtems_name name, + rtems_name name, rtems_extensions_table *extension_table, - Objects_Id *id + Objects_Id *id ); /* diff --git a/c/src/exec/sapi/headers/init.h b/c/src/exec/sapi/headers/init.h index 8c6e34d2c3..e008c45ebc 100644 --- a/c/src/exec/sapi/headers/init.h +++ b/c/src/exec/sapi/headers/init.h @@ -30,9 +30,17 @@ extern "C" { #endif -#include <rtems/types.h> +#include <rtems/rtems/types.h> #include <rtems/config.h> -#include <rtems/intr.h> +#include <rtems/rtems/intr.h> + +/* + * The following defines the default Multiprocessing Configuration + * Table. This table is used in a single processor system. + */ + +extern const rtems_multiprocessing_table + _Initialization_Default_multiprocessing_table; /* * rtems_initialize_executive diff --git a/c/src/exec/sapi/headers/io.h b/c/src/exec/sapi/headers/io.h index ef9fc69d03..6f3afba53e 100644 --- a/c/src/exec/sapi/headers/io.h +++ b/c/src/exec/sapi/headers/io.h @@ -32,16 +32,40 @@ extern "C" { #endif -#include <rtems/config.h> +#include <rtems/rtems/status.h> /* - * The following declare the data required to manage the Device Driver - * Address Table. + * + * The following defines the types for: + * + * + major and minor numbers + * + the return type of a device driver entry + * + a pointer to a device driver entry + * + an entry in the the Device Driver Address Table. Each entry in this + * table corresponds to an application provided device driver and + * defines the entry points for that device driver. */ + +typedef unsigned32 rtems_device_major_number; +typedef unsigned32 rtems_device_minor_number; + +typedef rtems_status_code rtems_device_driver; + +typedef rtems_device_driver ( *rtems_device_driver_entry )( + rtems_device_major_number, + rtems_device_minor_number, + void * + ); -EXTERN unsigned32 _IO_Number_of_drivers; -EXTERN rtems_driver_address_table *_IO_Driver_address_table; - +typedef struct { + rtems_device_driver_entry initialization; /* initialization procedure */ + rtems_device_driver_entry open; /* open request procedure */ + rtems_device_driver_entry close; /* close request procedure */ + rtems_device_driver_entry read; /* read request procedure */ + rtems_device_driver_entry write; /* write request procedure */ + rtems_device_driver_entry control; /* special functions procedure */ +} rtems_driver_address_table; + /* * Table for the io device names */ @@ -53,12 +77,19 @@ typedef struct { rtems_device_minor_number minor; } rtems_driver_name_t; -/*XXX this really should be allocated some better way... */ -/*XXX it should probably be a chain and use a 'maximum' drivers field - * in config table */ -#define RTEMS_MAX_DRIVER_NAMES 20 -EXTERN rtems_driver_name_t rtems_driver_name_table[RTEMS_MAX_DRIVER_NAMES]; +/* + * This is the table of device names. + */ + +/* + * The following declare the data required to manage the Driver + * Address Table and Device Name Table. + */ +EXTERN unsigned32 _IO_Number_of_drivers; +EXTERN rtems_driver_address_table *_IO_Driver_address_table; +EXTERN unsigned32 _IO_Number_of_devices; +EXTERN rtems_driver_name_t *_IO_Driver_name_table; /* * _IO_Manager_initialization @@ -70,7 +101,8 @@ EXTERN rtems_driver_name_t rtems_driver_name_table[RTEMS_MAX_DRIVER_NAMES]; STATIC INLINE void _IO_Manager_initialization( rtems_driver_address_table *driver_table, - unsigned32 number_of_drivers + unsigned32 number_of_drivers, + unsigned32 number_of_devices ); /* diff --git a/c/src/exec/sapi/headers/sptables.h b/c/src/exec/sapi/headers/sptables.h index bbfd132760..2a91025100 100644 --- a/c/src/exec/sapi/headers/sptables.h +++ b/c/src/exec/sapi/headers/sptables.h @@ -23,13 +23,33 @@ extern "C" { #include <rtems/config.h> +#include <rtems/debug.h> +#include <rtems/fatal.h> +#include <rtems/init.h> +#include <rtems/io.h> +#include <rtems/sysstate.h> + +#include <rtems/rtems/intr.h> +#include <rtems/rtems/clock.h> +#include <rtems/rtems/tasks.h> +#include <rtems/rtems/dpmem.h> +#include <rtems/rtems/event.h> +#include <rtems/rtems/message.h> +#include <rtems/rtems/mp.h> +#include <rtems/rtems/part.h> +#include <rtems/rtems/ratemon.h> +#include <rtems/rtems/region.h> +#include <rtems/rtems/sem.h> +#include <rtems/rtems/signal.h> +#include <rtems/rtems/timer.h> + /* * This is the default Multiprocessing Configuration Table. * It is used in single processor configurations. */ const rtems_multiprocessing_table - _Configuration_Default_multiprocessing_table = { + _Initialization_Default_multiprocessing_table = { 1, /* local node number */ 1, /* maximum number nodes in system */ 0, /* maximum number global objects */ diff --git a/c/src/exec/sapi/include/rtems/config.h b/c/src/exec/sapi/include/rtems/config.h index 766ea4a4a8..31e8093387 100644 --- a/c/src/exec/sapi/include/rtems/config.h +++ b/c/src/exec/sapi/include/rtems/config.h @@ -21,164 +21,12 @@ extern "C" { #endif -#include <rtems/types.h> -#include <rtems/object.h> -#include <rtems/thread.h> - -/* - * The following records define the Initialization Tasks Table. - * Each entry contains the information required by RTEMS to - * create and start a user task automatically at executive - * initialization time. - */ - -typedef struct { - rtems_name name; /* task name */ - unsigned32 stack_size; /* task stack size */ - rtems_task_priority initial_priority; /* task priority */ - rtems_attribute attribute_set; /* task attributes */ - rtems_task_entry entry_point; /* task entry point */ - rtems_mode mode_set; /* task initial mode */ - unsigned32 argument; /* task argument */ -} rtems_initialization_tasks_table; - -/* - * - * The following defines the types for: - * - * + major and minor numbers - * + the return type of a device driver entry - * + a pointer to a device driver entry - * + an entry in the the Device Driver Address Table. Each entry in this - * table corresponds to an application provided device driver and - * defines the entry points for that device driver. - */ - -typedef unsigned32 rtems_device_major_number; -typedef unsigned32 rtems_device_minor_number; - -typedef rtems_status_code rtems_device_driver; - -typedef rtems_device_driver ( *rtems_device_driver_entry )( - rtems_device_major_number, - rtems_device_minor_number, - void * - ); - -typedef struct { - rtems_device_driver_entry initialization; /* initialization procedure */ - rtems_device_driver_entry open; /* open request procedure */ - rtems_device_driver_entry close; /* close request procedure */ - rtems_device_driver_entry read; /* read request procedure */ - rtems_device_driver_entry write; /* write request procedure */ - rtems_device_driver_entry control; /* special functions procedure */ -} rtems_driver_address_table; - -/* - * The following records defines the User Extension Table. - * This table defines the application dependent routines which - * are invoked at critical points in the life of each task and - * the system as a whole. - */ - -typedef void rtems_extension; - -typedef rtems_extension ( *rtems_task_create_extension )( - rtems_tcb *, - rtems_tcb * - ); - -typedef rtems_extension ( *rtems_task_delete_extension )( - rtems_tcb *, - rtems_tcb * - ); - -typedef rtems_extension ( *rtems_task_start_extension )( - rtems_tcb *, - rtems_tcb * - ); - -typedef rtems_extension ( *rtems_task_restart_extension )( - rtems_tcb *, - rtems_tcb * - ); - -typedef rtems_extension ( *rtems_task_switch_extension )( - rtems_tcb *, - rtems_tcb * - ); - -typedef rtems_extension ( *rtems_task_begin_extension )( - rtems_tcb * - ); - -typedef rtems_extension ( *rtems_task_exitted_extension )( - rtems_tcb * - ); - -typedef rtems_extension ( *rtems_fatal_extension )( - unsigned32 - ); - -typedef struct { - rtems_task_create_extension rtems_task_create; - rtems_task_start_extension rtems_task_start; - rtems_task_restart_extension rtems_task_restart; - rtems_task_delete_extension rtems_task_delete; - rtems_task_switch_extension task_switch; - rtems_task_begin_extension task_begin; - rtems_task_exitted_extension task_exitted; - rtems_fatal_extension fatal; -} rtems_extensions_table; - -/* - * The following records define the Multiprocessor Communications - * Interface (MPCI) Table. This table defines the user-provided - * MPCI which is a required part of a multiprocessor RTEMS system. - * - * For non-blocking local operations that become remote operations, - * we need a timeout. This is a per-driver timeout: default_timeout - */ - -/* XXX FORWARD REFERENCES */ - -typedef struct Configuration_Table rtems_configuration_table; -typedef struct Configuration_Table_MP rtems_multiprocessing_table; - -typedef void rtems_mpci_entry; - -typedef rtems_mpci_entry ( *rtems_mpci_initialization_entry )( - rtems_configuration_table *, - rtems_cpu_table *, - rtems_multiprocessing_table * - ); - -typedef rtems_mpci_entry ( *rtems_mpci_get_packet_entry )( - rtems_packet_prefix ** - ); - -typedef rtems_mpci_entry ( *rtems_mpci_return_packet_entry )( - rtems_packet_prefix * - ); - -typedef rtems_mpci_entry ( *rtems_mpci_send_entry )( - unsigned32, - rtems_packet_prefix * - ); - -typedef rtems_mpci_entry ( *rtems_mpci_receive_entry )( - rtems_packet_prefix ** - ); - -typedef struct { - unsigned32 default_timeout; /* in ticks */ - unsigned32 maximum_packet_size; - rtems_mpci_initialization_entry initialization; - rtems_mpci_get_packet_entry get_packet; - rtems_mpci_return_packet_entry return_packet; - rtems_mpci_send_entry send_packet; - rtems_mpci_receive_entry receive_packet; -} rtems_mpci_table; +#include <rtems/rtems/status.h> +#include <rtems/extension.h> +#include <rtems/io.h> +#include <rtems/core/mpci.h> +#include <rtems/rtems/types.h> +#include <rtems/rtems/tasks.h> /* * The following records define the Multiprocessor Configuration @@ -187,13 +35,13 @@ typedef struct { * system. */ -struct Configuration_Table_MP { - unsigned32 node; /* local node number */ - unsigned32 maximum_nodes; /* maximum # nodes in system */ - unsigned32 maximum_global_objects; /* maximum # global objects */ - unsigned32 maximum_proxies; /* maximum # proxies */ - rtems_mpci_table *User_mpci_table; /* pointer to MPCI table */ -}; +typedef struct { + unsigned32 node; /* local node number */ + unsigned32 maximum_nodes; /* maximum # nodes in system */ + unsigned32 maximum_global_objects; /* maximum # global objects */ + unsigned32 maximum_proxies; /* maximum # proxies */ + MPCI_Control *User_mpci_table; /* pointer to MPCI table */ +} rtems_multiprocessing_table; /* * The following records define the Configuration Table. The @@ -207,7 +55,7 @@ struct Configuration_Table_MP { * + clock ticks per task timeslice */ -struct Configuration_Table { +typedef struct { void *work_space_start; unsigned32 work_space_size; unsigned32 maximum_tasks; @@ -224,92 +72,19 @@ struct Configuration_Table { unsigned32 number_of_initialization_tasks; rtems_initialization_tasks_table *User_initialization_tasks_table; unsigned32 number_of_device_drivers; + unsigned32 maximum_devices; rtems_driver_address_table *Device_driver_table; rtems_extensions_table *User_extension_table; rtems_multiprocessing_table *User_multiprocessing_table; -}; - -/* - * The following defines the default Multiprocessing Configuration - * Table. This table is used in a single processor system. - */ - -extern const rtems_multiprocessing_table - _Configuration_Default_multiprocessing_table; - -/* - * The following define the internal pointers to the user's - * configuration information. - */ - -EXTERN rtems_configuration_table *_Configuration_Table; -EXTERN rtems_multiprocessing_table *_Configuration_MP_table; -EXTERN rtems_mpci_table *_Configuration_MPCI_table; - -/* - * - * _Configuration_Handler_initialization - * - * DESCRIPTION: - * - * This routine performs the initialization necessary for this handler. - */ - -STATIC INLINE void _Configuration_Handler_initialization( - rtems_configuration_table *configuration_table, - rtems_multiprocessing_table *multiprocessing_table, - rtems_mpci_table *users_mpci_table -); - -/* - * _Configuration_Is_multiprocessing - * - * DESCRIPTION: - * - * This function determines if a multiprocessing application has been - * configured, if so, TRUE is returned, otherwise FALSE is returned. - */ - -STATIC INLINE boolean _Configuration_Is_multiprocessing( void ); - -/* - * _Configuration_Is_null_driver_address_table_pointer - * - * DESCRIPTION: - * - * This function returns TRUE if the_table is NULL and FALSE otherwise. - */ - -STATIC INLINE boolean _Configuration_Is_null_driver_address_table_pointer( - rtems_driver_address_table *the_table -); - -/* - * _Configuration_Is_null_extension_table_pointer - * - * DESCRIPTION: - * - * This function returns TRUE if the_table is NULL and FALSE otherwise. - */ - -STATIC INLINE boolean _Configuration_Is_null_extension_table_pointer( - rtems_extensions_table *the_table -); +} rtems_configuration_table; /* - * _Configuration_Is_null_initialization_tasks_table_pointer - * - * DESCRIPTION: - * - * This function returns TRUE if the_table is NULL and FALSE otherwise. + * The following are provided strictly for the convenience of + * the user. They are not used in RTEMS itself. */ -STATIC INLINE boolean - _Configuration_Is_null_initialization_tasks_table_pointer( - rtems_initialization_tasks_table *the_table -); - -#include <rtems/config.inl> +EXTERN rtems_configuration_table *_Configuration_Table; +EXTERN rtems_multiprocessing_table *_Configuration_MP_table; #ifdef __cplusplus } diff --git a/c/src/exec/sapi/include/rtems/directives.h b/c/src/exec/sapi/include/rtems/directives.h index 2b26672a0c..afcd56278f 100644 --- a/c/src/exec/sapi/include/rtems/directives.h +++ b/c/src/exec/sapi/include/rtems/directives.h @@ -106,6 +106,12 @@ extern "C" { #define RTEMS_NUMBER_OF_ENTRY_POINTS 82 +/* + * The jump table of entry points into RTEMS directives. + */ + +extern const void *_Entry_points[ RTEMS_NUMBER_OF_ENTRY_POINTS ]; + #ifdef __cplusplus } #endif diff --git a/c/src/exec/sapi/include/rtems/extension.h b/c/src/exec/sapi/include/rtems/extension.h index b447cc43fe..57c8a54271 100644 --- a/c/src/exec/sapi/include/rtems/extension.h +++ b/c/src/exec/sapi/include/rtems/extension.h @@ -28,9 +28,28 @@ extern "C" { #endif -#include <rtems.h> -#include <rtems/object.h> -#include <rtems/userext.h> +#include <rtems/core/object.h> +#include <rtems/core/userext.h> +#include <rtems/rtems/status.h> /* XXX */ +#include <rtems/rtems/types.h> /* XXX */ + +/* + * Extension related types + */ + +typedef User_extensions_routine rtems_extension; +typedef User_extensions_thread_create_extension rtems_task_create_extension; +typedef User_extensions_thread_delete_extension rtems_task_delete_extension; +typedef User_extensions_thread_start_extension rtems_task_start_extension; +typedef User_extensions_thread_restart_extension rtems_task_restart_extension; +typedef User_extensions_thread_switch_extension rtems_task_switch_extension; +typedef User_extensions_thread_post_switch_extension + rtems_task_post_switch_extension; +typedef User_extensions_thread_begin_extension rtems_task_begin_extension; +typedef User_extensions_thread_exitted_extension rtems_task_exitted_extension; +typedef User_extensions_fatal_extension rtems_fatal_extension; + +typedef User_extensions_Table rtems_extensions_table; /* * The following defines the information control block used to manage @@ -73,9 +92,9 @@ void _Extension_Manager_initialization( */ rtems_status_code rtems_extension_create( - rtems_name name, + rtems_name name, rtems_extensions_table *extension_table, - Objects_Id *id + Objects_Id *id ); /* diff --git a/c/src/exec/sapi/include/rtems/init.h b/c/src/exec/sapi/include/rtems/init.h index 8c6e34d2c3..e008c45ebc 100644 --- a/c/src/exec/sapi/include/rtems/init.h +++ b/c/src/exec/sapi/include/rtems/init.h @@ -30,9 +30,17 @@ extern "C" { #endif -#include <rtems/types.h> +#include <rtems/rtems/types.h> #include <rtems/config.h> -#include <rtems/intr.h> +#include <rtems/rtems/intr.h> + +/* + * The following defines the default Multiprocessing Configuration + * Table. This table is used in a single processor system. + */ + +extern const rtems_multiprocessing_table + _Initialization_Default_multiprocessing_table; /* * rtems_initialize_executive diff --git a/c/src/exec/sapi/include/rtems/io.h b/c/src/exec/sapi/include/rtems/io.h index ef9fc69d03..6f3afba53e 100644 --- a/c/src/exec/sapi/include/rtems/io.h +++ b/c/src/exec/sapi/include/rtems/io.h @@ -32,16 +32,40 @@ extern "C" { #endif -#include <rtems/config.h> +#include <rtems/rtems/status.h> /* - * The following declare the data required to manage the Device Driver - * Address Table. + * + * The following defines the types for: + * + * + major and minor numbers + * + the return type of a device driver entry + * + a pointer to a device driver entry + * + an entry in the the Device Driver Address Table. Each entry in this + * table corresponds to an application provided device driver and + * defines the entry points for that device driver. */ + +typedef unsigned32 rtems_device_major_number; +typedef unsigned32 rtems_device_minor_number; + +typedef rtems_status_code rtems_device_driver; + +typedef rtems_device_driver ( *rtems_device_driver_entry )( + rtems_device_major_number, + rtems_device_minor_number, + void * + ); -EXTERN unsigned32 _IO_Number_of_drivers; -EXTERN rtems_driver_address_table *_IO_Driver_address_table; - +typedef struct { + rtems_device_driver_entry initialization; /* initialization procedure */ + rtems_device_driver_entry open; /* open request procedure */ + rtems_device_driver_entry close; /* close request procedure */ + rtems_device_driver_entry read; /* read request procedure */ + rtems_device_driver_entry write; /* write request procedure */ + rtems_device_driver_entry control; /* special functions procedure */ +} rtems_driver_address_table; + /* * Table for the io device names */ @@ -53,12 +77,19 @@ typedef struct { rtems_device_minor_number minor; } rtems_driver_name_t; -/*XXX this really should be allocated some better way... */ -/*XXX it should probably be a chain and use a 'maximum' drivers field - * in config table */ -#define RTEMS_MAX_DRIVER_NAMES 20 -EXTERN rtems_driver_name_t rtems_driver_name_table[RTEMS_MAX_DRIVER_NAMES]; +/* + * This is the table of device names. + */ + +/* + * The following declare the data required to manage the Driver + * Address Table and Device Name Table. + */ +EXTERN unsigned32 _IO_Number_of_drivers; +EXTERN rtems_driver_address_table *_IO_Driver_address_table; +EXTERN unsigned32 _IO_Number_of_devices; +EXTERN rtems_driver_name_t *_IO_Driver_name_table; /* * _IO_Manager_initialization @@ -70,7 +101,8 @@ EXTERN rtems_driver_name_t rtems_driver_name_table[RTEMS_MAX_DRIVER_NAMES]; STATIC INLINE void _IO_Manager_initialization( rtems_driver_address_table *driver_table, - unsigned32 number_of_drivers + unsigned32 number_of_drivers, + unsigned32 number_of_devices ); /* diff --git a/c/src/exec/sapi/include/rtems/sptables.h b/c/src/exec/sapi/include/rtems/sptables.h index bbfd132760..2a91025100 100644 --- a/c/src/exec/sapi/include/rtems/sptables.h +++ b/c/src/exec/sapi/include/rtems/sptables.h @@ -23,13 +23,33 @@ extern "C" { #include <rtems/config.h> +#include <rtems/debug.h> +#include <rtems/fatal.h> +#include <rtems/init.h> +#include <rtems/io.h> +#include <rtems/sysstate.h> + +#include <rtems/rtems/intr.h> +#include <rtems/rtems/clock.h> +#include <rtems/rtems/tasks.h> +#include <rtems/rtems/dpmem.h> +#include <rtems/rtems/event.h> +#include <rtems/rtems/message.h> +#include <rtems/rtems/mp.h> +#include <rtems/rtems/part.h> +#include <rtems/rtems/ratemon.h> +#include <rtems/rtems/region.h> +#include <rtems/rtems/sem.h> +#include <rtems/rtems/signal.h> +#include <rtems/rtems/timer.h> + /* * This is the default Multiprocessing Configuration Table. * It is used in single processor configurations. */ const rtems_multiprocessing_table - _Configuration_Default_multiprocessing_table = { + _Initialization_Default_multiprocessing_table = { 1, /* local node number */ 1, /* maximum number nodes in system */ 0, /* maximum number global objects */ diff --git a/c/src/exec/sapi/optman/no-ext.c b/c/src/exec/sapi/optman/no-ext.c index db1df3624f..ea5f04d672 100644 --- a/c/src/exec/sapi/optman/no-ext.c +++ b/c/src/exec/sapi/optman/no-ext.c @@ -14,8 +14,10 @@ */ #include <rtems/system.h> -#include <rtems/object.h> -#include <rtems/thread.h> +#include <rtems/rtems/status.h> +#include <rtems/rtems/support.h> +#include <rtems/core/object.h> +#include <rtems/core/thread.h> #include <rtems/extension.h> void _Extension_Manager_initialization( @@ -25,12 +27,12 @@ void _Extension_Manager_initialization( } rtems_status_code rtems_extension_create( - rtems_name name, + rtems_name name, rtems_extensions_table *extension_table, - Objects_Id *id + Objects_Id *id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_extension_ident( @@ -38,12 +40,12 @@ rtems_status_code rtems_extension_ident( Objects_Id *id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_extension_delete( Objects_Id id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } diff --git a/c/src/exec/sapi/optman/no-io.c b/c/src/exec/sapi/optman/no-io.c index d0fc7676f1..058ecfbfd2 100644 --- a/c/src/exec/sapi/optman/no-io.c +++ b/c/src/exec/sapi/optman/no-io.c @@ -14,10 +14,11 @@ */ #include <rtems/system.h> +#include <rtems/rtems/status.h> #include <rtems/config.h> #include <rtems/io.h> -#include <rtems/isr.h> -#include <rtems/thread.h> +#include <rtems/core/isr.h> +#include <rtems/core/thread.h> void _IO_Initialize_all_drivers( void ) { @@ -46,7 +47,7 @@ rtems_status_code rtems_io_initialize( void *argument ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_io_open( @@ -55,7 +56,7 @@ rtems_status_code rtems_io_open( void *argument ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_io_close( @@ -64,7 +65,7 @@ rtems_status_code rtems_io_close( void *argument ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_io_read( @@ -73,7 +74,7 @@ rtems_status_code rtems_io_read( void *argument ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_io_write( @@ -82,7 +83,7 @@ rtems_status_code rtems_io_write( void *argument ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_io_control( @@ -91,5 +92,5 @@ rtems_status_code rtems_io_control( void *argument ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } diff --git a/c/src/exec/sapi/src/exinit.c b/c/src/exec/sapi/src/exinit.c index f85504b18d..4c9cb2e785 100644 --- a/c/src/exec/sapi/src/exinit.c +++ b/c/src/exec/sapi/src/exinit.c @@ -21,39 +21,31 @@ #include <rtems/system.h> #include <rtems/config.h> -#include <rtems/copyrt.h> -#include <rtems/clock.h> -#include <rtems/tasks.h> #include <rtems/debug.h> -#include <rtems/dpmem.h> -#include <rtems/event.h> #include <rtems/extension.h> #include <rtems/fatal.h> -#include <rtems/heap.h> #include <rtems/init.h> -#include <rtems/intthrd.h> -#include <rtems/isr.h> -#include <rtems/intr.h> #include <rtems/io.h> -#include <rtems/message.h> -#include <rtems/mp.h> -#include <rtems/mpci.h> -#include <rtems/part.h> -#include <rtems/priority.h> -#include <rtems/ratemon.h> -#include <rtems/region.h> -#include <rtems/sem.h> -#include <rtems/signal.h> #include <rtems/sysstate.h> -#include <rtems/thread.h> -#include <rtems/timer.h> -#include <rtems/tod.h> -#include <rtems/userext.h> -#include <rtems/watchdog.h> -#include <rtems/wkspace.h> +#include <rtems/core/copyrt.h> +#include <rtems/core/heap.h> +#include <rtems/core/interr.h> +#include <rtems/core/intthrd.h> +#include <rtems/core/isr.h> +#include <rtems/core/mpci.h> +#include <rtems/core/priority.h> +#include <rtems/core/thread.h> +#include <rtems/core/tod.h> +#include <rtems/core/userext.h> +#include <rtems/core/watchdog.h> +#include <rtems/core/wkspace.h> + +#include <rtems/directives.h> #include <rtems/sptables.h> +#include <rtems/rtems/rtemsapi.h> + /*PAGE * * rtems_initialize_executive @@ -103,29 +95,54 @@ rtems_interrupt_level rtems_initialize_executive_early( _ISR_Disable( bsp_level ); - _System_state_Set( SYSTEM_STATE_BEFORE_INITIALIZATION ); + if ( cpu_table == NULL ) + _Internal_error_Occurred( + INTERNAL_ERROR_CORE, + TRUE, + INTERNAL_ERROR_NO_CONFIGURATION_TABLE + ); - _CPU_Initialize( cpu_table, _Thread_Dispatch ); + /* + * Initialize the system state based on whether this is an MP system. + */ + + multiprocessing_table = configuration_table->User_multiprocessing_table; + + _System_state_Handler_initialization( + (multiprocessing_table) ? TRUE : FALSE + ); /* - * Do this as early as possible to insure no debugging output - * is even attempted to be printed. + * Provided just for user convenience. */ - _Debug_Manager_initialization(); + _Configuration_Table = configuration_table; + _Configuration_MP_table = multiprocessing_table; + + /* + * Internally we view single processor systems as a very restricted + * multiprocessor system. + */ - multiprocessing_table = configuration_table->User_multiprocessing_table; if ( multiprocessing_table == NULL ) - multiprocessing_table = - (void *) &_Configuration_Default_multiprocessing_table; + multiprocessing_table = + (void *)&_Initialization_Default_multiprocessing_table; - _Configuration_Handler_initialization( - configuration_table, - multiprocessing_table, - multiprocessing_table->User_mpci_table - ); + if ( cpu_table == NULL ) + _Internal_error_Occurred( + INTERNAL_ERROR_CORE, + TRUE, + INTERNAL_ERROR_NO_CPU_TABLE + ); + + _CPU_Initialize( cpu_table, _Thread_Dispatch ); - _Attributes_Handler_initialization(); + /* + * Do this as early as possible to insure no debugging output + * is even attempted to be printed. + */ + + _Debug_Manager_initialization(); _Thread_Dispatch_initialization(); @@ -142,6 +159,7 @@ rtems_interrupt_level rtems_initialize_executive_early( _Objects_Handler_initialization( multiprocessing_table->node, + multiprocessing_table->maximum_nodes, multiprocessing_table->maximum_global_objects ); @@ -153,57 +171,33 @@ rtems_interrupt_level rtems_initialize_executive_early( _Thread_Handler_initialization( configuration_table->ticks_per_timeslice, + configuration_table->maximum_extensions, multiprocessing_table->maximum_proxies ); - _MPCI_Handler_initialization(); - -/* MANAGERS */ - - _Interrupt_Manager_initialization(); - - _Multiprocessing_Manager_initialization(); + _MPCI_Handler_initialization( + multiprocessing_table->User_mpci_table + ); - _RTEMS_tasks_Manager_initialization( configuration_table->maximum_tasks ); + _Internal_threads_Initialization(); - _Timer_Manager_initialization( configuration_table->maximum_timers ); +/* MANAGERS */ _Extension_Manager_initialization( configuration_table->maximum_extensions ); _IO_Manager_initialization( configuration_table->Device_driver_table, - configuration_table->number_of_device_drivers + configuration_table->number_of_device_drivers, + configuration_table->maximum_devices ); - _Event_Manager_initialization(); - - _Message_queue_Manager_initialization( - configuration_table->maximum_message_queues - ); - - _Semaphore_Manager_initialization( - configuration_table->maximum_semaphores - ); - - _Partition_Manager_initialization( - configuration_table->maximum_partitions - ); - - _Region_Manager_initialization( configuration_table->maximum_regions ); - - _Dual_ported_memory_Manager_initialization( - configuration_table->maximum_ports - ); - - _Rate_monotonic_Manager_initialization( - configuration_table->maximum_periods - ); - - _Internal_threads_Initialization(); + _RTEMS_API_Initialize( configuration_table ); if ( cpu_table->pretasking_hook ) (*cpu_table->pretasking_hook)(); + _Internal_threads_Start(); + _System_state_Set( SYSTEM_STATE_BEFORE_MULTITASKING ); return bsp_level; diff --git a/c/src/exec/sapi/src/extension.c b/c/src/exec/sapi/src/extension.c index a962ad270e..4c1ac96ebd 100644 --- a/c/src/exec/sapi/src/extension.c +++ b/c/src/exec/sapi/src/extension.c @@ -14,9 +14,9 @@ */ #include <rtems/system.h> -#include <rtems/support.h> -#include <rtems/object.h> -#include <rtems/thread.h> +#include <rtems/rtems/support.h> +#include <rtems/core/object.h> +#include <rtems/core/thread.h> #include <rtems/extension.h> /*PAGE @@ -65,15 +65,15 @@ void _Extension_Manager_initialization( */ rtems_status_code rtems_extension_create( - rtems_name name, + rtems_name name, rtems_extensions_table *extension_table, - Objects_Id *id + Objects_Id *id ) { Extension_Control *the_extension; if ( !rtems_is_name_valid( name ) ) - return ( RTEMS_INVALID_NAME ); + return RTEMS_INVALID_NAME; _Thread_Disable_dispatch(); /* to prevent deletion */ @@ -81,7 +81,7 @@ rtems_status_code rtems_extension_create( if ( !the_extension ) { _Thread_Enable_dispatch(); - return( RTEMS_TOO_MANY ); + return RTEMS_TOO_MANY; } _User_extensions_Add_set( &the_extension->Extension, extension_table ); @@ -90,7 +90,7 @@ rtems_status_code rtems_extension_create( *id = the_extension->Object.id; _Thread_Enable_dispatch(); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } /*PAGE @@ -115,12 +115,16 @@ rtems_status_code rtems_extension_ident( Objects_Id *id ) { - return _Objects_Name_to_id( + Objects_Name_to_id_errors status; + + status = _Objects_Name_to_id( &_Extension_Information, &name, - RTEMS_SEARCH_LOCAL_NODE, + OBJECTS_SEARCH_LOCAL_NODE, id ); + + return _Status_Object_name_errors_to_status[ status ]; } /*PAGE @@ -148,14 +152,14 @@ rtems_status_code rtems_extension_delete( switch ( location ) { case OBJECTS_ERROR: case OBJECTS_REMOTE: /* should never return this */ - return( RTEMS_INVALID_ID ); + return RTEMS_INVALID_ID; case OBJECTS_LOCAL: _User_extensions_Remove_set( &the_extension->Extension ); _Objects_Close( &_Extension_Information, &the_extension->Object ); _Extension_Free( the_extension ); _Thread_Enable_dispatch(); - return( RTEMS_SUCCESSFUL ); + return RTEMS_SUCCESSFUL; } - return( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */ + return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ } diff --git a/c/src/exec/sapi/src/fatal.c b/c/src/exec/sapi/src/fatal.c index 2ecc73ff3f..321eec1c00 100644 --- a/c/src/exec/sapi/src/fatal.c +++ b/c/src/exec/sapi/src/fatal.c @@ -13,42 +13,26 @@ */ #include <rtems/system.h> -#include <rtems/config.h> #include <rtems/fatal.h> -#include <rtems/sysstate.h> -#include <rtems/userext.h> +#include <rtems/core/interr.h> /*PAGE * * rtems_fatal_error_occurred * - * This directive will invoke the fatal error handler supplied by the user - * followed by the the default one provided by the executive. The default - * error handler assumes no hardware is present to help inform the user - * of the problem. Halt stores the error code in a known register, - * disables interrupts, and halts the CPU. If the CPU does not have a - * halt instruction, it will loop to itself. + * This directive will invoke the internal fatal error handler. * * Input parameters: * the_error - fatal error status code * - * Output parameters: - * the_error - on stack - * status register - on stack - * - * NOTE: The the_error is not necessarily a directive status code. + * Output parameters: NONE */ void volatile rtems_fatal_error_occurred( unsigned32 the_error ) { - - _User_extensions_Fatal( the_error ); - - _System_state_Set( SYSTEM_STATE_FAILED ); - - _CPU_Fatal_halt( the_error ); + _Internal_error_Occurred( INTERNAL_ERROR_RTEMS_API, FALSE, the_error ); /* will not return from this routine */ } diff --git a/c/src/exec/sapi/src/io.c b/c/src/exec/sapi/src/io.c index 4ab45b33f5..cca390ea71 100644 --- a/c/src/exec/sapi/src/io.c +++ b/c/src/exec/sapi/src/io.c @@ -14,11 +14,9 @@ */ #include <rtems/system.h> -#include <rtems/config.h> #include <rtems/io.h> -#include <rtems/isr.h> -#include <rtems/thread.h> -#include <rtems/intr.h> +#include <rtems/core/isr.h> +#include <rtems/core/thread.h> #include <string.h> @@ -38,7 +36,7 @@ void _IO_Initialize_all_drivers( void ) rtems_device_major_number major; for ( major=0 ; major < _IO_Number_of_drivers ; major ++ ) - (void) rtems_io_initialize( major, 0, _Configuration_Table); + (void) rtems_io_initialize( major, 0, NULL); } /*PAGE @@ -60,22 +58,26 @@ rtems_status_code rtems_io_register_name( { rtems_driver_name_t *np; unsigned32 level; + unsigned32 index; /* find an empty slot */ - for (np = rtems_driver_name_table; np < &rtems_driver_name_table[RTEMS_MAX_DRIVER_NAMES]; np++) + for( index=0, np = _IO_Driver_name_table ; + index < _IO_Number_of_devices ; + index++, np++ ) { - rtems_interrupt_disable(level); + + _ISR_Disable(level); if (np->device_name == 0) { np->device_name = device_name; np->device_name_length = strlen(device_name); np->major = major; np->minor = minor; - rtems_interrupt_enable(level); + _ISR_Enable(level); return RTEMS_SUCCESSFUL; } - rtems_interrupt_enable(level); + _ISR_Enable(level); } return RTEMS_TOO_MANY; @@ -93,13 +95,16 @@ rtems_status_code rtems_io_register_name( */ rtems_status_code rtems_io_lookup_name( - const char *pathname, + const char *pathname, rtems_driver_name_t **rnp - ) +) { rtems_driver_name_t *np; + unsigned32 index; - for (np = rtems_driver_name_table; np < &rtems_driver_name_table[RTEMS_MAX_DRIVER_NAMES]; np++) + for( index=0, np = _IO_Driver_name_table ; + index < _IO_Number_of_devices ; + index++, np++ ) if (np->device_name) if (strncmp(np->device_name, pathname, np->device_name_length) == 0) { diff --git a/c/src/exec/sapi/src/rtemsapi.c b/c/src/exec/sapi/src/rtemsapi.c new file mode 100644 index 0000000000..b6ecb6c37c --- /dev/null +++ b/c/src/exec/sapi/src/rtemsapi.c @@ -0,0 +1,89 @@ +/* + * RTEMS API Support + * + * NOTE: + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include <rtems/system.h> +#include <rtems/rtems/status.h> +#include <rtems/rtems/rtemsapi.h> + +#define INIT + +#include <rtems/rtems/intr.h> +#include <rtems/rtems/clock.h> +#include <rtems/rtems/tasks.h> +#include <rtems/rtems/dpmem.h> +#include <rtems/rtems/event.h> +#include <rtems/rtems/message.h> +#include <rtems/rtems/mp.h> +#include <rtems/rtems/part.h> +#include <rtems/rtems/ratemon.h> +#include <rtems/rtems/region.h> +#include <rtems/rtems/sem.h> +#include <rtems/rtems/signal.h> +#include <rtems/rtems/timer.h> + +/*PAGE + * + * _RTEMS_API_Initialize + * + * XXX + */ + +void _RTEMS_API_Initialize( + rtems_configuration_table *configuration_table +) +{ + _Attributes_Handler_initialization(); + + _Interrupt_Manager_initialization(); + + _Multiprocessing_Manager_initialization(); + + _RTEMS_tasks_Manager_initialization( + configuration_table->maximum_tasks, + configuration_table->number_of_initialization_tasks, + configuration_table->User_initialization_tasks_table + ); + + _Timer_Manager_initialization( configuration_table->maximum_timers ); + + _Signal_Manager_initialization(); + + _Event_Manager_initialization(); + + _Message_queue_Manager_initialization( + configuration_table->maximum_message_queues + ); + + _Semaphore_Manager_initialization( + configuration_table->maximum_semaphores + ); + + _Partition_Manager_initialization( + configuration_table->maximum_partitions + ); + + _Region_Manager_initialization( configuration_table->maximum_regions ); + + _Dual_ported_memory_Manager_initialization( + configuration_table->maximum_ports + ); + + _Rate_monotonic_Manager_initialization( + configuration_table->maximum_periods + ); +} + +/* end of file */ diff --git a/c/src/exec/score/cpu/hppa1.1/cpu.c b/c/src/exec/score/cpu/hppa1.1/cpu.c index 437996a78d..6cb6347151 100644 --- a/c/src/exec/score/cpu/hppa1.1/cpu.c +++ b/c/src/exec/score/cpu/hppa1.1/cpu.c @@ -19,11 +19,10 @@ #include <rtems/system.h> #include <rtems/fatal.h> -#include <rtems/isr.h> -#include <rtems/intr.h> -#include <rtems/wkspace.h> +#include <rtems/core/isr.h> +#include <rtems/core/wkspace.h> -rtems_status_code hppa_external_interrupt_initialize(void); +void hppa_external_interrupt_initialize(void); void hppa_external_interrupt_enable(unsigned32); void hppa_external_interrupt_disable(unsigned32); void hppa_external_interrupt(unsigned32, CPU_Interrupt_frame *); @@ -73,9 +72,6 @@ void _CPU_Initialize( extern void IVA_Table(void); - if ( cpu_table == NULL ) - rtems_fatal_error_occurred( RTEMS_NOT_CONFIGURED ); - /* * XXX; need to setup fpsr smarter perhaps */ @@ -194,7 +190,7 @@ void _CPU_ISR_install_vector( * called by bsp_start() */ -rtems_status_code +void hppa_external_interrupt_initialize(void) { rtems_isr_entry ignore; @@ -207,8 +203,6 @@ hppa_external_interrupt_initialize(void) /* install the external interrupt handler */ rtems_interrupt_catch((rtems_isr_entry) hppa_external_interrupt, HPPA_INTERRUPT_EXTERNAL_INTERRUPT, &ignore) ; - - return RTEMS_SUCCESSFUL; } /* diff --git a/c/src/exec/score/cpu/hppa1.1/cpu.h b/c/src/exec/score/cpu/hppa1.1/cpu.h index 3d330e09e5..e1f6cbfa48 100644 --- a/c/src/exec/score/cpu/hppa1.1/cpu.h +++ b/c/src/exec/score/cpu/hppa1.1/cpu.h @@ -30,9 +30,9 @@ extern "C" { #endif -#include <rtems/hppa.h> /* pick up machine definitions */ +#include <rtems/core/hppa.h> /* pick up machine definitions */ #ifndef ASM -#include <rtems/hppatypes.h> +#include <rtems/core/hppatypes.h> #endif /* conditional compilation parameters */ diff --git a/c/src/exec/score/cpu/hppa1.1/cpu_asm.s b/c/src/exec/score/cpu/hppa1.1/cpu_asm.s index acb6e589fd..229efed42c 100644 --- a/c/src/exec/score/cpu/hppa1.1/cpu_asm.s +++ b/c/src/exec/score/cpu/hppa1.1/cpu_asm.s @@ -27,11 +27,11 @@ * $Id$ # -#include <rtems/hppa.h> -#include <rtems/cpu_asm.h> -#include <rtems/cpu.h> +#include <rtems/core/hppa.h> +#include <rtems/core/cpu_asm.h> +#include <rtems/core/cpu.h> -#include <offsets.h> +#include <rtems/core/offsets.h> .SPACE $PRIVATE$ .SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31 diff --git a/c/src/exec/score/cpu/hppa1.1/rtems.s b/c/src/exec/score/cpu/hppa1.1/rtems.s index 84ffadd856..0e9305644e 100644 --- a/c/src/exec/score/cpu/hppa1.1/rtems.s +++ b/c/src/exec/score/cpu/hppa1.1/rtems.s @@ -15,7 +15,7 @@ */ #include <rtems/hppa.h> -#include <rtems/cpu_asm.h> +#include <rtems/core/cpu_asm.h> .SPACE $PRIVATE$ .SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31 diff --git a/c/src/exec/score/cpu/i386/asm.h b/c/src/exec/score/cpu/i386/asm.h index adf92f935a..aac1ba9dbe 100644 --- a/c/src/exec/score/cpu/i386/asm.h +++ b/c/src/exec/score/cpu/i386/asm.h @@ -31,7 +31,7 @@ */ #define ASM -#include <rtems/i386.h> +#include <rtems/core/i386.h> /* * Recent versions of GNU cpp define variables which indicate the diff --git a/c/src/exec/score/cpu/i386/cpu.c b/c/src/exec/score/cpu/i386/cpu.c index d1ceaba88a..446515d6f9 100644 --- a/c/src/exec/score/cpu/i386/cpu.c +++ b/c/src/exec/score/cpu/i386/cpu.c @@ -15,8 +15,8 @@ #include <rtems/system.h> #include <rtems/fatal.h> -#include <rtems/isr.h> -#include <rtems/wkspace.h> +#include <rtems/core/isr.h> +#include <rtems/core/wkspace.h> /* _CPU_Initialize * @@ -36,9 +36,6 @@ void _CPU_Initialize( register unsigned16 fp_status asm ("ax"); register unsigned8 *fp_context; - if ( cpu_table == NULL ) - rtems_fatal_error_occurred( RTEMS_NOT_CONFIGURED ); - _CPU_Table = *cpu_table; /* @@ -69,6 +66,20 @@ void _CPU_Initialize( /*PAGE * + * _CPU_ISR_Get_level + */ + +unsigned32 _CPU_ISR_Get_level( void ) +{ + unsigned32 level; + + i386_get_interrupt_level( level ); + + return level; +} + +/*PAGE + * * _CPU_ISR_install_raw_handler */ diff --git a/c/src/exec/score/cpu/i386/cpu.h b/c/src/exec/score/cpu/i386/cpu.h index 2af0096fc6..f3793cd443 100644 --- a/c/src/exec/score/cpu/i386/cpu.h +++ b/c/src/exec/score/cpu/i386/cpu.h @@ -22,9 +22,9 @@ extern "C" { #endif #ifndef ASM -#include <rtems/i386types.h> +#include <rtems/core/i386types.h> #endif -#include <rtems/i386.h> +#include <rtems/core/i386.h> /* conditional compilation parameters */ @@ -119,9 +119,9 @@ typedef struct { /* variables */ -EXTERN unsigned8 _CPU_Null_fp_context[ CPU_CONTEXT_FP_SIZE ]; -EXTERN void *_CPU_Interrupt_stack_low; -EXTERN void *_CPU_Interrupt_stack_high; +EXTERN Context_Control_fp _CPU_Null_fp_context; +EXTERN void *_CPU_Interrupt_stack_low; +EXTERN void *_CPU_Interrupt_stack_high; /* constants */ @@ -192,6 +192,8 @@ EXTERN void *_CPU_Interrupt_stack_high; else asm volatile ( "sti" ); \ } +unsigned32 _CPU_ISR_Get_level( void ); + /* end of ISR handler macros */ /* diff --git a/c/src/exec/score/cpu/i386/i386.h b/c/src/exec/score/cpu/i386/i386.h index 3ebde48ed3..d43669ba53 100644 --- a/c/src/exec/score/cpu/i386/i386.h +++ b/c/src/exec/score/cpu/i386/i386.h @@ -166,6 +166,18 @@ typedef struct { ); \ } +#define i386_get_interrupt_level( _level ) \ + do { \ + register unsigned32 _eflags = 0; \ + \ + asm volatile ( "push %0 ; \ + popf " \ + : "=r" ((_eflags)) : "0" ((_eflags)) \ + ); \ + \ + _level = (_eflags & 0x0200) ? 0 : 1; \ + } while (0) + /* * The following routine swaps the endian format of an unsigned int. * It must be static so it can be referenced indirectly. diff --git a/c/src/exec/score/cpu/i960/asm.h b/c/src/exec/score/cpu/i960/asm.h index e8fc986402..73a8b3a641 100644 --- a/c/src/exec/score/cpu/i960/asm.h +++ b/c/src/exec/score/cpu/i960/asm.h @@ -31,7 +31,7 @@ */ #define ASM -#include <rtems/i960.h> +#include <rtems/core/i960.h> /* * Recent versions of GNU cpp define variables which indicate the diff --git a/c/src/exec/score/cpu/i960/cpu.c b/c/src/exec/score/cpu/i960/cpu.c index d5acebd225..ec4613c4cf 100644 --- a/c/src/exec/score/cpu/i960/cpu.c +++ b/c/src/exec/score/cpu/i960/cpu.c @@ -21,7 +21,7 @@ #include <rtems/system.h> #include <rtems/fatal.h> -#include <rtems/isr.h> +#include <rtems/core/isr.h> /* _CPU_Initialize * @@ -40,15 +40,26 @@ void _CPU_Initialize( ) { - if ( cpu_table == NULL ) - rtems_fatal_error_occurred( RTEMS_NOT_CONFIGURED ); - _CPU_Table = *cpu_table; } /*PAGE * + * _CPU_ISR_Get_level + */ + +unsigned32 _CPU_ISR_Get_level( void ) +{ + unsigned32 level; + + i960_get_interrupt_level( level ); + + return level; +} + +/*PAGE + * * _CPU_ISR_install_raw_handler */ diff --git a/c/src/exec/score/cpu/i960/cpu.h b/c/src/exec/score/cpu/i960/cpu.h index 4e8e82e9de..3c4cb98ec8 100644 --- a/c/src/exec/score/cpu/i960/cpu.h +++ b/c/src/exec/score/cpu/i960/cpu.h @@ -23,9 +23,9 @@ extern "C" { #pragma align 4 /* for GNU C structure alignment */ -#include <rtems/i960.h> +#include <rtems/core/i960.h> #ifndef ASM -#include <rtems/i960types.h> +#include <rtems/core/i960types.h> #endif #define CPU_INLINE_ENABLE_DISPATCH FALSE @@ -237,6 +237,8 @@ EXTERN void *_CPU_Interrupt_stack_high; ); \ } +unsigned32 _CPU_ISR_Get_level( void ); + /* ISR handler section macros */ /* diff --git a/c/src/exec/score/cpu/i960/i960.h b/c/src/exec/score/cpu/i960/i960.h index 53b99f469a..5112fd58c8 100644 --- a/c/src/exec/score/cpu/i960/i960.h +++ b/c/src/exec/score/cpu/i960/i960.h @@ -169,6 +169,13 @@ typedef struct { : "0" (_mask), "1" ((oldlevel)) ); \ } +#define i960_get_interrupt_level( _level ) \ + { \ + i960_disable_interrupts( _level ); \ + i960_enable_interrupts( _level ); \ + (_level) = ((_level) & 0x1f0000) >> 16; \ + } while ( 0 ) + #define i960_atomic_modify( mask, addr, prev ) \ { register unsigned int _mask = (mask); \ register unsigned int *_addr = (unsigned int *)(addr); \ @@ -199,9 +206,8 @@ typedef struct { #define i960_clear_intr( xint ) \ { register unsigned int _xint=(xint); \ - asm volatile( "loop_til_cleared: - clrbit %0,sf0,sf0 ; \ - bbs %0,sf0,loop_til_cleared" \ +asm volatile( "loop_til_cleared: clrbit %0,sf0,sf0 ; \ + bbs %0,sf0, loop_til_cleared" \ : "=d" (_xint) : "0" (_xint) ); \ } diff --git a/c/src/exec/score/cpu/m68k/asm.h b/c/src/exec/score/cpu/m68k/asm.h index 58bb04bdf9..7a25b6c298 100644 --- a/c/src/exec/score/cpu/m68k/asm.h +++ b/c/src/exec/score/cpu/m68k/asm.h @@ -31,7 +31,7 @@ */ #define ASM -#include <rtems/m68k.h> +#include <rtems/core/m68k.h> /* * Recent versions of GNU cpp define variables which indicate the diff --git a/c/src/exec/score/cpu/m68k/cpu.c b/c/src/exec/score/cpu/m68k/cpu.c index a97698372a..fdba64bffe 100644 --- a/c/src/exec/score/cpu/m68k/cpu.c +++ b/c/src/exec/score/cpu/m68k/cpu.c @@ -14,7 +14,7 @@ #include <rtems/system.h> #include <rtems/fatal.h> -#include <rtems/isr.h> +#include <rtems/core/isr.h> /* _CPU_Initialize * @@ -33,15 +33,26 @@ void _CPU_Initialize( ) { - if ( cpu_table == NULL ) - rtems_fatal_error_occurred( RTEMS_NOT_CONFIGURED ); - _CPU_Table = *cpu_table; } /*PAGE * + * _CPU_ISR_Get_level + */ + +unsigned32 _CPU_ISR_Get_level( void ) +{ + unsigned32 level; + + m68k_get_interrupt_level( level ); + + return level; +} + +/*PAGE + * * _CPU_ISR_install_raw_handler */ diff --git a/c/src/exec/score/cpu/m68k/cpu.h b/c/src/exec/score/cpu/m68k/cpu.h index 566e479f3a..8379d47a00 100644 --- a/c/src/exec/score/cpu/m68k/cpu.h +++ b/c/src/exec/score/cpu/m68k/cpu.h @@ -30,9 +30,9 @@ extern "C" { #define NO_UNINITIALIZED_WARNINGS -#include <rtems/m68k.h> +#include <rtems/core/m68k.h> #ifndef ASM -#include <rtems/m68ktypes.h> +#include <rtems/core/m68ktypes.h> #endif /* conditional compilation parameters */ @@ -222,6 +222,8 @@ EXTERN void *_CPU_Interrupt_stack_high; #define _CPU_ISR_Set_level( _newlevel ) \ m68k_set_interrupt_level( _newlevel ) +unsigned32 _CPU_ISR_Get_level( void ); + /* end of ISR handler macros */ /* diff --git a/c/src/exec/score/cpu/m68k/m68k.h b/c/src/exec/score/cpu/m68k/m68k.h index b86db286cb..a2e0df6a25 100644 --- a/c/src/exec/score/cpu/m68k/m68k.h +++ b/c/src/exec/score/cpu/m68k/m68k.h @@ -196,6 +196,17 @@ extern "C" { ); \ } +#define m68k_get_interrupt_level( _level ) \ + do { \ + register unsigned32 _tmpsr = 0; \ + \ + asm volatile( "movw %%sr,%0" \ + : "=d" (_tmpsr) : "0" (_tmpsr) \ + ); \ + \ + _level = (_tmpsr & 0x0700) >> 8; \ + } while (0) + #define m68k_set_interrupt_level( _newlevel ) \ { \ register unsigned32 _tmpsr = 0; \ diff --git a/c/src/exec/score/cpu/no_cpu/asm.h b/c/src/exec/score/cpu/no_cpu/asm.h index 97464d5b3a..ca0ff95e35 100644 --- a/c/src/exec/score/cpu/no_cpu/asm.h +++ b/c/src/exec/score/cpu/no_cpu/asm.h @@ -31,7 +31,7 @@ */ #define ASM -#include <rtems/no_cpu.h> +#include <rtems/core/no_cpu.h> /* * Recent versions of GNU cpp define variables which indicate the diff --git a/c/src/exec/score/cpu/no_cpu/cpu.c b/c/src/exec/score/cpu/no_cpu/cpu.c index f95c435eae..c7e7cbe693 100644 --- a/c/src/exec/score/cpu/no_cpu/cpu.c +++ b/c/src/exec/score/cpu/no_cpu/cpu.c @@ -15,8 +15,8 @@ #include <rtems/system.h> #include <rtems/fatal.h> -#include <rtems/isr.h> -#include <rtems/wkspace.h> +#include <rtems/core/isr.h> +#include <rtems/core/wkspace.h> /* _CPU_Initialize * @@ -33,9 +33,6 @@ void _CPU_Initialize( void (*thread_dispatch) /* ignored on this CPU */ ) { - if ( cpu_table == NULL ) - rtems_fatal_error_occurred( RTEMS_NOT_CONFIGURED ); - /* * The thread_dispatch argument is the address of the entry point * for the routine called at the end of an ISR once it has been @@ -63,6 +60,18 @@ void _CPU_Initialize( /*PAGE * + * _CPU_ISR_Get_level + */ + +unsigned32 _CPU_ISR_Get_level( void ) +{ + /* + * This routine returns the current interrupt level. + */ +} + +/*PAGE + * * _CPU_ISR_install_raw_handler */ diff --git a/c/src/exec/score/cpu/no_cpu/cpu.h b/c/src/exec/score/cpu/no_cpu/cpu.h index 29a6960ea2..7242ebc041 100644 --- a/c/src/exec/score/cpu/no_cpu/cpu.h +++ b/c/src/exec/score/cpu/no_cpu/cpu.h @@ -21,9 +21,9 @@ extern "C" { #endif -#include <rtems/no_cpu.h> /* pick up machine definitions */ +#include <rtems/core/no_cpu.h> /* pick up machine definitions */ #ifndef ASM -#include <rtems/no_cputypes.h> +#include <rtems/core/no_cputypes.h> #endif /* conditional compilation parameters */ diff --git a/c/src/exec/score/cpu/no_cpu/cpu_asm.c b/c/src/exec/score/cpu/no_cpu/cpu_asm.c index c0cf3b5127..0d7622d15f 100644 --- a/c/src/exec/score/cpu/no_cpu/cpu_asm.c +++ b/c/src/exec/score/cpu/no_cpu/cpu_asm.c @@ -24,7 +24,7 @@ */ #include <rtems/system.h> -#include <rtems/cpu.h> +#include <rtems/core/cpu.h> /* #include "cpu_asm.h> */ /* diff --git a/c/src/exec/score/cpu/no_cpu/cpu_asm.h b/c/src/exec/score/cpu/no_cpu/cpu_asm.h index 0f4154a453..50bc256e06 100644 --- a/c/src/exec/score/cpu/no_cpu/cpu_asm.h +++ b/c/src/exec/score/cpu/no_cpu/cpu_asm.h @@ -21,7 +21,7 @@ /* pull in the generated offsets */ -#include <offsets.h> +#include <rtems/core/offsets.h> /* * Hardware General Registers diff --git a/c/src/exec/score/cpu/no_cpu/rtems.c b/c/src/exec/score/cpu/no_cpu/rtems.c index 5415ae9852..0d15381046 100644 --- a/c/src/exec/score/cpu/no_cpu/rtems.c +++ b/c/src/exec/score/cpu/no_cpu/rtems.c @@ -22,7 +22,7 @@ */ #include <rtems/system.h> -#include <rtems/cpu.h> +#include <rtems/core/cpu.h> /* #include "asm.h> */ /* diff --git a/c/src/exec/score/cpu/powerpc/cpu.c b/c/src/exec/score/cpu/powerpc/cpu.c index ab358a2490..336f1e1aef 100644 --- a/c/src/exec/score/cpu/powerpc/cpu.c +++ b/c/src/exec/score/cpu/powerpc/cpu.c @@ -30,15 +30,17 @@ #include <rtems/system.h> #include <rtems/fatal.h> -#include <rtems/isr.h> -#include <rtems/context.h> -#include <rtems/thread.h> -#include <rtems/wkspace.h> +#include <rtems/core/isr.h> +#include <rtems/core/context.h> +#include <rtems/core/thread.h> +#include <rtems/core/wkspace.h> /* * These are for testing purposes. */ +/* #define Testing +*/ #ifdef Testing static unsigned32 msr; @@ -119,9 +121,6 @@ void _CPU_Initialize( } #endif - if ( cpu_table == NULL ) - rtems_fatal_error_occurred( RTEMS_NOT_CONFIGURED ); - if ( cpu_table->spurious_handler ) handler = (proc_ptr)cpu_table->spurious_handler; @@ -164,9 +163,11 @@ void _CPU_ISR_install_vector( * be used by the _ISR_Handler so the user gets control. */ - _ISR_Vector_table[ vector ] = new_handler ? (rtems_isr_entry)new_handler : - _CPU_Table.spurious_handler ? (rtems_isr_entry)_CPU_Table.spurious_handler : - (rtems_isr_entry)ppc_spurious; + _ISR_Vector_table[ vector ] = + (new_handler) ? (ISR_Handler_entry) new_handler : + ((_CPU_Table.spurious_handler) ? + (ISR_Handler_entry) _CPU_Table.spurious_handler : + (ISR_Handler_entry) ppc_spurious); } /*PAGE diff --git a/c/src/exec/score/cpu/powerpc/cpu.h b/c/src/exec/score/cpu/powerpc/cpu.h index 82cad518e8..fd44f5ee8e 100644 --- a/c/src/exec/score/cpu/powerpc/cpu.h +++ b/c/src/exec/score/cpu/powerpc/cpu.h @@ -37,11 +37,11 @@ extern "C" { #endif -#include <rtems/ppc.h> /* pick up machine definitions */ +#include <rtems/core/ppc.h> /* pick up machine definitions */ #ifndef ASM struct CPU_Interrupt_frame; -#include <rtems/ppctypes.h> +#include <rtems/core/ppctypes.h> #endif /* conditional compilation parameters */ diff --git a/c/src/exec/score/cpu/unix/cpu.c b/c/src/exec/score/cpu/unix/cpu.c index 736b7c4c7f..339bb2a3ce 100644 --- a/c/src/exec/score/cpu/unix/cpu.c +++ b/c/src/exec/score/cpu/unix/cpu.c @@ -17,7 +17,7 @@ */ #include <rtems/system.h> -#include <rtems/isr.h> +#include <rtems/core/isr.h> #include <stdio.h> #include <stdlib.h> @@ -186,6 +186,28 @@ void _CPU_Context_From_CPU_Init() } +/*PAGE + * + * _CPU_ISR_Get_level + */ + +unsigned32 _CPU_ISR_Get_level( void ) +{ + sigset_t sigset; + + sigprocmask( 0, 0, &sigset ); + + /* + * This is an educated guess based on ONLY ONE of the signals we + * disable/enable to mask ISRs. + */ + + if ( sigismember( &sigset, SIGUSR1 ) ) + return 1; + else + return 0; +} + /* _CPU_Initialize * * This routine performs processor dependent initialization. @@ -198,12 +220,9 @@ void _CPU_Context_From_CPU_Init() void _CPU_Initialize( rtems_cpu_table *cpu_table, - void (*thread_dispatch) /* ignored on this CPU */ + void (*thread_dispatch) /* ignored on this CPU */ ) { - if ( cpu_table == NULL ) - _CPU_Fatal_halt( RTEMS_NOT_CONFIGURED ); - /* * The thread_dispatch argument is the address of the entry point * for the routine called at the end of an ISR once it has been diff --git a/c/src/exec/score/cpu/unix/cpu.h b/c/src/exec/score/cpu/unix/cpu.h index ee7239bc89..f0d583651e 100644 --- a/c/src/exec/score/cpu/unix/cpu.h +++ b/c/src/exec/score/cpu/unix/cpu.h @@ -26,9 +26,9 @@ extern "C" { #endif -#include <rtems/unix.h> +#include <rtems/core/unix.h> #ifndef ASM -#include <rtems/unixtypes.h> +#include <rtems/core/unixtypes.h> #endif #if defined(solaris2) @@ -667,6 +667,8 @@ void _CPU_ISR_Enable(unsigned32 level); else _CPU_ISR_Enable( 1 ); \ } +unsigned32 _CPU_ISR_Get_level( void ); + /* end of ISR handler macros */ /* Context handler macros */ diff --git a/c/src/exec/score/headers/address.h b/c/src/exec/score/headers/address.h index 0abd113f63..4877206801 100644 --- a/c/src/exec/score/headers/address.h +++ b/c/src/exec/score/headers/address.h @@ -52,21 +52,6 @@ STATIC INLINE void *_Addresses_Subtract_offset( ); /* - * _Addresses_Add - * - * DESCRIPTION: - * - * This function is used to add two addresses. It returns the - * resulting address. This address is typically converted to an - * access type before being used further. - */ - -STATIC INLINE void *_Addresses_Add ( - void *left, - void *right -); - -/* * _Addresses_Subtract * * DESCRIPTION: @@ -112,7 +97,7 @@ STATIC INLINE boolean _Addresses_Is_in_range ( void *limit ); -#include <rtems/address.inl> +#include <rtems/core/address.inl> #ifdef __cplusplus } diff --git a/c/src/exec/score/headers/chain.h b/c/src/exec/score/headers/chain.h index 06cc47cc65..35ac4dfa80 100644 --- a/c/src/exec/score/headers/chain.h +++ b/c/src/exec/score/headers/chain.h @@ -21,7 +21,7 @@ extern "C" { #endif -#include <rtems/address.h> +#include <rtems/core/address.h> /* * This is used to manage each element (node) which is placed @@ -422,7 +422,7 @@ STATIC INLINE boolean _Chain_Is_null_node( Chain_Node *the_node ); -#include <rtems/chain.inl> +#include <rtems/core/chain.inl> #ifdef __cplusplus } diff --git a/c/src/exec/score/headers/context.h b/c/src/exec/score/headers/context.h index 9b8ee92b04..58e497ae88 100644 --- a/c/src/exec/score/headers/context.h +++ b/c/src/exec/score/headers/context.h @@ -20,7 +20,7 @@ extern "C" { #endif -#include <rtems/cpu.h> +#include <rtems/core/cpu.h> /* * The following constant defines the number of bytes required diff --git a/c/src/exec/score/headers/coremutex.h b/c/src/exec/score/headers/coremutex.h new file mode 100644 index 0000000000..0682bbc1ea --- /dev/null +++ b/c/src/exec/score/headers/coremutex.h @@ -0,0 +1,247 @@ +/* mutex.h + * + * This include file contains all the constants and structures associated + * with the Mutex Handler. A mutex is an enhanced version of the standard + * Dijkstra binary semaphore used to provide synchronization and mutual + * exclusion capabilities. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#ifndef __RTEMS_CORE_MUTEX_h +#define __RTEMS_CORE_MUTEX_h + +#ifdef __cplusplus +extern "C" { +#endif + +#include <rtems/core/thread.h> +#include <rtems/core/threadq.h> +#include <rtems/core/priority.h> +#include <rtems/core/watchdog.h> + +/* + * The following type defines the callout which the API provides + * to support global/multiprocessor operations on mutexes. + */ + +typedef void ( *CORE_mutex_API_mp_support_callout )( + Thread_Control *, + Objects_Id + ); + +/* + * Blocking disciplines for a mutex. + */ + +typedef enum { + CORE_MUTEX_DISCIPLINES_FIFO, + CORE_MUTEX_DISCIPLINES_PRIORITY, + CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT, + CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING +} CORE_mutex_Disciplines; + +/* + * Mutex handler return statuses. + */ + +typedef enum { + CORE_MUTEX_STATUS_SUCCESSFUL, + CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT, + CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED, + CORE_MUTEX_STATUS_NOT_OWNER_OF_RESOURCE, + CORE_MUTEX_WAS_DELETED, + CORE_MUTEX_TIMEOUT +} CORE_mutex_Status; + +/* + * Locked and unlocked values + */ + +#define CORE_MUTEX_UNLOCKED 1 +#define CORE_MUTEX_LOCKED 0 + +/* + * The following defines the control block used to manage the + * attributes of each mutex. + */ + +typedef struct { + boolean allow_nesting; + CORE_mutex_Disciplines discipline; + Priority_Control priority_ceiling; +} CORE_mutex_Attributes; + +/* + * The following defines the control block used to manage each mutex. + */ + +typedef struct { + Thread_queue_Control Wait_queue; + CORE_mutex_Attributes Attributes; + unsigned32 lock; + unsigned32 nest_count; + Thread_Control *holder; + Objects_Id holder_id; +} CORE_mutex_Control; + +/* + * _CORE_mutex_Initialize + * + * DESCRIPTION: + * + * This routine initializes the mutex based on the parameters passed. + */ + +void _CORE_mutex_Initialize( + CORE_mutex_Control *the_mutex, + Objects_Classes the_class, + CORE_mutex_Attributes *the_mutex_attributes, + unsigned32 initial_lock, + Thread_queue_Extract_callout proxy_extract_callout +); + +/* + * _CORE_mutex_Seize + * + * DESCRIPTION: + * + * This routine attempts to receive a unit from the_mutex. + * If a unit is available or if the wait flag is FALSE, then the routine + * returns. Otherwise, the calling task is blocked until a unit becomes + * available. + */ + +void _CORE_mutex_Seize( + CORE_mutex_Control *the_mutex, + Objects_Id id, + boolean wait, + Watchdog_Interval timeout +); + +/* + * _CORE_mutex_Surrender + * + * DESCRIPTION: + * + * This routine frees a unit to the mutex. If a task was blocked waiting for + * a unit from this mutex, then that task will be readied and the unit + * given to that task. Otherwise, the unit will be returned to the mutex. + */ + +CORE_mutex_Status _CORE_mutex_Surrender( + CORE_mutex_Control *the_mutex, + Objects_Id id, + CORE_mutex_API_mp_support_callout api_mutex_mp_support +); + +/* + * _CORE_mutex_Flush + * + * DESCRIPTION: + * + * This routine assists in the deletion of a mutex by flushing the associated + * wait queue. + */ + +void _CORE_mutex_Flush( + CORE_mutex_Control *the_mutex, + Thread_queue_Flush_callout remote_extract_callout, + unsigned32 status +); + +/* + * _CORE_mutex_Is_locked + * + * DESCRIPTION: + * + * This routine returns TRUE if the mutex specified is locked and FALSE + * otherwise. + */ + +STATIC INLINE boolean _CORE_mutex_Is_locked( + CORE_mutex_Control *the_mutex +); + +/* + * _CORE_mutex_Is_fifo + * + * DESCRIPTION: + * + * This routine returns TRUE if the mutex's wait discipline is FIFO and FALSE + * otherwise. + */ + +STATIC INLINE boolean _CORE_mutex_Is_fifo( + CORE_mutex_Attributes *the_attribute +); + +/* + * _CORE_mutex_Is_priority + * + * DESCRIPTION: + * + * This routine returns TRUE if the mutex's wait discipline is PRIORITY and + * FALSE otherwise. + */ + +STATIC INLINE boolean _CORE_mutex_Is_priority( + CORE_mutex_Attributes *the_attribute +); + +/* + * _CORE_mutex_Is_inherit_priority + * + * DESCRIPTION: + * + * This routine returns TRUE if the mutex's wait discipline is + * INHERIT_PRIORITY and FALSE otherwise. + */ + +STATIC INLINE boolean _CORE_mutex_Is_inherit_priority( + CORE_mutex_Attributes *the_attribute +); + +/* + * _CORE_mutex_Is_priority_ceiling + * + * DESCRIPTION: + * + * This routine returns TRUE if the mutex's wait discipline is + * PRIORITY_CEILING and FALSE otherwise. + */ + +STATIC INLINE boolean _CORE_mutex_Is_priority_ceiling( + CORE_mutex_Attributes *the_attribute +); + +/* + * _CORE_mutex_Is_nesting_allowed + * + * DESCRIPTION: + * + * This routine returns TRUE if the mutex allows a task to obtain a + * semaphore more than once and nest. + */ + +STATIC INLINE boolean _CORE_mutex_Is_nesting_allowed( + CORE_mutex_Attributes *the_attribute +); + +#include <rtems/core/coremutex.inl> + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/c/src/exec/score/headers/coresem.h b/c/src/exec/score/headers/coresem.h new file mode 100644 index 0000000000..0fcd8cd0b9 --- /dev/null +++ b/c/src/exec/score/headers/coresem.h @@ -0,0 +1,179 @@ +/* core_sem.h + * + * This include file contains all the constants and structures associated + * with the Counting Semaphore Handler. A counting semaphore is the + * standard Dijkstra binary semaphore used to provide synchronization + * and mutual exclusion capabilities. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#ifndef __RTEMS_CORE_COUNTING_SEMAPHORE_h +#define __RTEMS_CORE_COUNTING_SEMAPHORE_h + +#ifdef __cplusplus +extern "C" { +#endif + +#include <rtems/core/thread.h> +#include <rtems/core/threadq.h> +#include <rtems/core/priority.h> +#include <rtems/core/watchdog.h> + +/* + * The following type defines the callout which the API provides + * to support global/multiprocessor operations on semaphores. + */ + +typedef void ( *CORE_semaphore_API_mp_support_callout )( + Thread_Control *, + Objects_Id + ); + +/* + * Blocking disciplines for a semaphore. + */ + +typedef enum { + CORE_SEMAPHORE_DISCIPLINES_FIFO, + CORE_SEMAPHORE_DISCIPLINES_PRIORITY +} CORE_semaphore_Disciplines; + +/* + * Core Semaphore handler return statuses. + */ + +typedef enum { + CORE_SEMAPHORE_STATUS_SUCCESSFUL, + CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT, + CORE_SEMAPHORE_WAS_DELETED, + CORE_SEMAPHORE_TIMEOUT +} CORE_semaphore_Status; + +/* + * The following defines the control block used to manage the + * attributes of each semaphore. + */ + +typedef struct { + CORE_semaphore_Disciplines discipline; +} CORE_semaphore_Attributes; + +/* + * The following defines the control block used to manage each + * counting semaphore. + */ + +typedef struct { + Thread_queue_Control Wait_queue; + CORE_semaphore_Attributes Attributes; + unsigned32 count; +} CORE_semaphore_Control; + +/* + * _CORE_semaphore_Initialize + * + * DESCRIPTION: + * + * This routine initializes the semaphore based on the parameters passed. + */ + +void _CORE_semaphore_Initialize( + CORE_semaphore_Control *the_semaphore, + Objects_Classes the_class, + CORE_semaphore_Attributes *the_semaphore_attributes, + unsigned32 initial_value, + Thread_queue_Extract_callout proxy_extract_callout +); + +/* + * _CORE_semaphore_Seize + * + * DESCRIPTION: + * + * This routine attempts to receive a unit from the_semaphore. + * If a unit is available or if the wait flag is FALSE, then the routine + * returns. Otherwise, the calling task is blocked until a unit becomes + * available. + */ + +void _CORE_semaphore_Seize( + CORE_semaphore_Control *the_semaphore, + Objects_Id id, + boolean wait, + Watchdog_Interval timeout +); + +/* + * _CORE_semaphore_Surrender + * + * DESCRIPTION: + * + * This routine frees a unit to the semaphore. If a task was blocked waiting + * for a unit from this semaphore, then that task will be readied and the unit + * given to that task. Otherwise, the unit will be returned to the semaphore. + */ + +CORE_semaphore_Status _CORE_semaphore_Surrender( + CORE_semaphore_Control *the_semaphore, + Objects_Id id, + CORE_semaphore_API_mp_support_callout api_semaphore_mp_support +); + +/* + * _CORE_semaphore_Flush + * + * DESCRIPTION: + * + * This routine assists in the deletion of a semaphore by flushing the + * associated wait queue. + */ + +void _CORE_semaphore_Flush( + CORE_semaphore_Control *the_semaphore, + Thread_queue_Flush_callout remote_extract_callout, + unsigned32 status +); + +/* + * _CORE_semaphore_Get_count + * + * DESCRIPTION: + * + * This routine returns the current count associated with the semaphore. + */ + +STATIC INLINE unsigned32 _CORE_semaphore_Get_count( + CORE_semaphore_Control *the_semaphore +); + +/* + * _CORE_semaphore_Is_priority + * + * DESCRIPTION: + * + * This function returns TRUE if the priority attribute is + * enabled in the attribute_set and FALSE otherwise. + */ + +STATIC INLINE boolean _CORE_semaphore_Is_priority( + CORE_semaphore_Attributes *the_attribute +); + +#include <rtems/core/coresem.inl> + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/c/src/exec/score/headers/heap.h b/c/src/exec/score/headers/heap.h index 9eb348a760..bf4a8dde6e 100644 --- a/c/src/exec/score/headers/heap.h +++ b/c/src/exec/score/headers/heap.h @@ -386,7 +386,7 @@ STATIC INLINE unsigned32 _Heap_Build_flag ( unsigned32 in_use_flag ); -#include <rtems/heap.inl> +#include <rtems/core/heap.inl> #ifdef __cplusplus } diff --git a/c/src/exec/score/headers/interr.h b/c/src/exec/score/headers/interr.h new file mode 100644 index 0000000000..c1088a9dff --- /dev/null +++ b/c/src/exec/score/headers/interr.h @@ -0,0 +1,93 @@ +/* interr.h + * + * This include file contains constants and prototypes related + * to the Internal Error Handler. + * + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id# + */ + +#ifndef __RTEMS_INTERNAL_ERROR_h +#define __RTEMS_INTERNAL_ERROR_h + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * This type lists the possible sources from which an error + * can be reported. + */ + +typedef enum { + INTERNAL_ERROR_CORE, + INTERNAL_ERROR_RTEMS_API +} Internal_errors_Source; + +/* + * A list of errors which are generated internally by the executive core. + */ + +typedef enum { + INTERNAL_ERROR_NO_CONFIGURATION_TABLE, + INTERNAL_ERROR_NO_CPU_TABLE, + INTERNAL_ERROR_INVALID_WORKSPACE_ADDRESS, + INTERNAL_ERROR_TOO_LITTLE_WORKSPACE, + INTERNAL_ERROR_WORKSPACE_ALLOCATION, + INTERNAL_ERROR_INTERRUPT_STACK_TOO_SMALL, + INTERNAL_ERROR_THREAD_EXITTED, + INTERNAL_ERROR_INCONSISTENT_MP_INFORMATION, + INTERNAL_ERROR_INVALID_NODE, + INTERNAL_ERROR_NO_MPCI, + INTERNAL_ERROR_BAD_PACKET, + INTERNAL_ERROR_OUT_OF_PACKETS, + INTERNAL_ERROR_OUT_OF_GLOBAL_OBJECTS, + INTERNAL_ERROR_OUT_OF_PROXIES, + INTERNAL_ERROR_INVALID_GLOBAL_ID +} Internal_errors_Core_list; + +/* + * This type holds the fatal error information. + */ + +typedef struct { + Internal_errors_Source the_source; + boolean is_internal; + unsigned32 the_error; +} Internal_errors_Information; + +/* + * When a fatal error occurs, the error information is stored here. + */ + +EXTERN Internal_errors_Information Internal_errors_What_happened; + +/* + * _Internal_error_Occurred + * + * DESCRIPTION: + * + * This routine is invoked when the application or the executive itself + * determines that a fatal error has occurred. + */ + +void volatile _Internal_error_Occurred( + Internal_errors_Source the_source, + boolean is_internal, + unsigned32 the_error +); + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ diff --git a/c/src/exec/score/headers/isr.h b/c/src/exec/score/headers/isr.h index 77c3f8663e..4bbc3c7aff 100644 --- a/c/src/exec/score/headers/isr.h +++ b/c/src/exec/score/headers/isr.h @@ -16,8 +16,8 @@ * $Id$ */ -#ifndef __RTEMS_ISR_h -#define __RTEMS_ISR_h +#ifndef __ISR_h +#define __ISR_h #ifdef __cplusplus extern "C" { @@ -31,24 +31,23 @@ extern "C" { typedef unsigned32 ISR_Level; /* - * The following type defines the control block used to manage - * the vectors. + * The following type defines the type used to manage the vectors. */ -typedef unsigned32 rtems_vector_number; +typedef unsigned32 ISR_Vector_number; /* * Return type for ISR Handler */ -typedef void rtems_isr; +typedef void ISR_Handler; /* * Pointer to an ISR Handler */ -typedef rtems_isr ( *rtems_isr_entry )( - rtems_vector_number +typedef ISR_Handler ( *ISR_Handler_entry )( + ISR_Vector_number ); /* * The following is TRUE if signals have been sent to the currently @@ -65,11 +64,11 @@ EXTERN boolean _ISR_Signals_to_thread_executing; EXTERN unsigned32 _ISR_Nest_level; /* - * The following declares the RTEMS Vector Table. Application - * interrupt service routines are vectored by RTEMS via this table. + * The following declares the Vector Table. Application + * interrupt service routines are vectored by the ISR Handler via this table. */ -EXTERN rtems_isr_entry _ISR_Vector_table[CPU_INTERRUPT_NUMBER_OF_VECTORS]; +EXTERN ISR_Handler_entry _ISR_Vector_table[CPU_INTERRUPT_NUMBER_OF_VECTORS]; /* * _ISR_Handler_initialization @@ -79,7 +78,7 @@ EXTERN rtems_isr_entry _ISR_Vector_table[CPU_INTERRUPT_NUMBER_OF_VECTORS]; * This routine performs the initialization necessary for this handler. */ -STATIC INLINE void _ISR_Handler_initialization ( void ); +void _ISR_Handler_initialization ( void ); /* * _ISR_Disable @@ -154,6 +153,17 @@ STATIC INLINE boolean _ISR_Is_in_progress( void ); _CPU_ISR_install_vector( _vector, _new_handler, _old_handler ) /* + * _ISR_Get_level + * + * DESCRIPTION: + * + * This routine returns the current interrupt level. + */ + +#define _ISR_Get_level() \ + _CPU_ISR_Get_level() + +/* * _ISR_Set_level * * DESCRIPTION: @@ -176,7 +186,7 @@ STATIC INLINE boolean _ISR_Is_in_progress( void ); */ STATIC INLINE boolean _ISR_Is_vector_number_valid ( - rtems_vector_number vector + ISR_Vector_number vector ); /* @@ -197,7 +207,7 @@ STATIC INLINE boolean _ISR_Is_valid_user_handler ( * * DESCRIPTION: * - * This routine is the RTEMS interrupt dispatcher. ALL interrupts + * This routine is the interrupt dispatcher. ALL interrupts * are vectored to this routine so that minimal context can be saved * and setup performed before the application's high-level language * interrupt service routine is invoked. After the application's @@ -229,7 +239,7 @@ void _ISR_Handler( void ); void _ISR_Dispatch( void ); -#include <rtems/isr.inl> +#include <rtems/core/isr.inl> #ifdef __cplusplus } diff --git a/c/src/exec/score/headers/mpci.h b/c/src/exec/score/headers/mpci.h index ca06dd243b..06dc0015d4 100644 --- a/c/src/exec/score/headers/mpci.h +++ b/c/src/exec/score/headers/mpci.h @@ -14,20 +14,20 @@ * $Id$ */ -#ifndef __RTEMS_MPCI_h -#define __RTEMS_MPCI_h +#ifndef __MPCI_h +#define __MPCI_h #ifdef __cplusplus extern "C" { #endif -#include <rtems/mppkt.h> -#include <rtems/states.h> -#include <rtems/status.h> -#include <rtems/thread.h> -#include <rtems/threadq.h> -#include <rtems/tqdata.h> -#include <rtems/watchdog.h> +#include <rtems/core/mppkt.h> +#include <rtems/core/states.h> +#include <rtems/core/thread.h> +#include <rtems/core/threadq.h> +#include <rtems/core/tqdata.h> +#include <rtems/core/watchdog.h> +#include <rtems/core/coresem.h> /* * The following defines the node number used when a broadcast is desired. @@ -45,6 +45,85 @@ extern "C" { #define MPCI_DEFAULT_TIMEOUT 0xFFFFFFFF /* + * The following records define the Multiprocessor Communications + * Interface (MPCI) Table. This table defines the user-provided + * MPCI which is a required part of a multiprocessor system. + * + * For non-blocking local operations that become remote operations, + * we need a timeout. This is a per-driver timeout: default_timeout + */ + +typedef void MPCI_Entry; + +typedef MPCI_Entry ( *MPCI_initialization_entry )( void ); + +typedef MPCI_Entry ( *MPCI_get_packet_entry )( + MP_packet_Prefix ** + ); + +typedef MPCI_Entry ( *MPCI_return_packet_entry )( + MP_packet_Prefix * + ); + +typedef MPCI_Entry ( *MPCI_send_entry )( + unsigned32, + MP_packet_Prefix * + ); + +typedef MPCI_Entry ( *MPCI_receive_entry )( + MP_packet_Prefix ** + ); + +typedef struct { + unsigned32 default_timeout; /* in ticks */ + unsigned32 maximum_packet_size; + MPCI_initialization_entry initialization; + MPCI_get_packet_entry get_packet; + MPCI_return_packet_entry return_packet; + MPCI_send_entry send_packet; + MPCI_receive_entry receive_packet; +} MPCI_Control; + +/* + * The following defines the type for packet processing routines + * invoked by the MPCI Receive server. + */ + +typedef void (*MPCI_Packet_processor)( MP_packet_Prefix * ); + +/* + * This is the core semaphore which the MPCI Receive Server blocks on. + */ + +EXTERN CORE_semaphore_Control _MPCI_Semaphore; +/* + * The following thread queue is used to maintain a list of tasks + * which currently have outstanding remote requests. + */ + +EXTERN Thread_queue_Control _MPCI_Remote_blocked_threads; + +/* + * The following define the internal pointers to the user's + * configuration information. + */ + +EXTERN MPCI_Control *_MPCI_table; + +/* + * The following points to the MPCI Receive Server. + */ + +EXTERN Thread_Control *_MPCI_Receive_server_tcb; + +/* + * The following table contains the process packet routines provided + * by each object that supports MP operations. + */ + +EXTERN MPCI_Packet_processor _MPCI_Packet_processors[MP_PACKET_CLASSES_LAST+1]; + +/* * _MPCI_Handler_initialization * * DESCRIPTION: @@ -52,7 +131,9 @@ extern "C" { * This routine performs the initialization necessary for this handler. */ -void _MPCI_Handler_initialization ( void ); +void _MPCI_Handler_initialization( + MPCI_Control *users_mpci_table +); /* * _MPCI_Initialization @@ -66,6 +147,21 @@ void _MPCI_Handler_initialization ( void ); void _MPCI_Initialization ( void ); /* + * _MPCI_Register_packet_processor + * + * DESCRIPTION: + * + * This routine registers the MPCI packet processor for the + * designated object class. + */ + +void _MPCI_Register_packet_processor( + MP_packet_Classes the_object, + MPCI_Packet_processor the_packet_processor + +); + +/* * _MPCI_Get_packet * * DESCRIPTION: @@ -74,7 +170,7 @@ void _MPCI_Initialization ( void ); * MPCI get packet callout. */ -rtems_packet_prefix *_MPCI_Get_packet ( void ); +MP_packet_Prefix *_MPCI_Get_packet ( void ); /* * _MPCI_Return_packet @@ -86,7 +182,7 @@ rtems_packet_prefix *_MPCI_Get_packet ( void ); */ void _MPCI_Return_packet ( - rtems_packet_prefix *the_packet + MP_packet_Prefix *the_packet ); /* @@ -100,7 +196,7 @@ void _MPCI_Return_packet ( void _MPCI_Send_process_packet ( unsigned32 destination, - rtems_packet_prefix *the_packet + MP_packet_Prefix *the_packet ); /* @@ -112,9 +208,9 @@ void _MPCI_Send_process_packet ( * MPCI send callout. */ -rtems_status_code _MPCI_Send_request_packet ( +unsigned32 _MPCI_Send_request_packet ( unsigned32 destination, - rtems_packet_prefix *the_packet, + MP_packet_Prefix *the_packet, States_Control extra_state ); @@ -129,7 +225,7 @@ rtems_status_code _MPCI_Send_request_packet ( void _MPCI_Send_response_packet ( unsigned32 destination, - rtems_packet_prefix *the_packet + MP_packet_Prefix *the_packet ); /* @@ -141,7 +237,7 @@ void _MPCI_Send_response_packet ( * MPCI receive callout. */ -rtems_packet_prefix *_MPCI_Receive_packet ( void ); +MP_packet_Prefix *_MPCI_Receive_packet ( void ); /* * _MPCI_Process_response @@ -153,15 +249,27 @@ rtems_packet_prefix *_MPCI_Receive_packet ( void ); */ Thread_Control *_MPCI_Process_response ( - rtems_packet_prefix *the_packet + MP_packet_Prefix *the_packet ); -/* - * The following thread queue is used to maintain a list of tasks - * which currently have outstanding remote requests. +/*PAGE + * + * _MPCI_Receive_server + * */ + +void _MPCI_Receive_server( void ); -EXTERN Thread_queue_Control _MPCI_Remote_blocked_threads; +/*PAGE + * + * _MPCI_Announce + * + * DESCRIPTION: + * + * XXX + */ + +void _MPCI_Announce ( void ); #ifdef __cplusplus } diff --git a/c/src/exec/score/headers/mppkt.h b/c/src/exec/score/headers/mppkt.h index d63d587fca..32cbc7e0e9 100644 --- a/c/src/exec/score/headers/mppkt.h +++ b/c/src/exec/score/headers/mppkt.h @@ -1,8 +1,10 @@ /* mppkt.h * * This package is the specification for the Packet Handler. - * This handler defines the basic RTEMS packet and provides + * This handler defines the basic packet and provides * mechanisms to utilize packets based on this prefix. + * Packets are the fundamental basis for messages passed between + * nodes in an MP system. * * * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. @@ -16,20 +18,19 @@ * $Id$ */ -#ifndef __RTEMS_MP_PACKET_h -#define __RTEMS_MP_PACKET_h +#ifndef __MP_PACKET_h +#define __MP_PACKET_h #ifdef __cplusplus extern "C" { #endif -#include <rtems/object.h> -#include <rtems/priority.h> -#include <rtems/watchdog.h> +#include <rtems/core/object.h> +#include <rtems/core/priority.h> +#include <rtems/core/watchdog.h> /* - * The following enumerated type defines the packet classes - * supported by RTEMS. + * The following enumerated type defines the packet classes. * * NOTE: In general, each class corresponds to a manager * which supports global operations. Each manager @@ -37,55 +38,55 @@ extern "C" { */ typedef enum { - RTEMS_MP_PACKET_INTERNAL_THREADS = 0, - RTEMS_MP_PACKET_TASKS = 1, - RTEMS_MP_PACKET_MESSAGE_QUEUE = 2, - RTEMS_MP_PACKET_SEMAPHORE = 3, - RTEMS_MP_PACKET_PARTITION = 4, - RTEMS_MP_PACKET_REGION = 5, - RTEMS_MP_PACKET_EVENT = 6, - RTEMS_MP_PACKET_SIGNAL = 7 -} rtems_mp_packet_classes; - -#define MP_PACKET_CLASSES_FIRST RTEMS_MP_PACKET_INTERNAL_THREADS -#define MP_PACKET_CLASSES_LAST RTEMS_MP_PACKET_SIGNAL + MP_PACKET_INTERNAL_THREADS = 0, + MP_PACKET_TASKS = 1, + MP_PACKET_MESSAGE_QUEUE = 2, + MP_PACKET_SEMAPHORE = 3, + MP_PACKET_PARTITION = 4, + MP_PACKET_REGION = 5, + MP_PACKET_EVENT = 6, + MP_PACKET_SIGNAL = 7 +} MP_packet_Classes; + +#define MP_PACKET_CLASSES_FIRST MP_PACKET_INTERNAL_THREADS +#define MP_PACKET_CLASSES_LAST MP_PACKET_SIGNAL /* * The following record contains the prefix for every packet - * passed between RTEMS nodes. + * passed between nodes in an MP system. * * NOTE: This structure is padded to insure that anything * following it is on a 16 byte boundary. This is * the most stringent structure alignment rule - * the RTEMS project has encountered yet (i960CA). + * encountered yet (i960CA). */ typedef struct { - rtems_mp_packet_classes the_class; + MP_packet_Classes the_class; Objects_Id id; Objects_Id source_tid; Priority_Control source_priority; - rtems_status_code return_code; + unsigned32 return_code; unsigned32 length; unsigned32 to_convert; - rtems_interval timeout; -} rtems_packet_prefix; + Watchdog_Interval timeout; +} MP_packet_Prefix; /* * An MPCI must support packets of at least this size. */ -#define RTEMS_MINIMUM_PACKET_SIZE 64 +#define MP_PACKET_MINIMUM_PACKET_SIZE 64 /* * The following constant defines the number of unsigned32's * in a packet which must be converted to native format in a * heterogeneous system. In packets longer than - * RTEMS_MINIMUN_HETERO_CONVERSION unsigned32's, some of the "extra" data + * MP_PACKET_MINIMUN_HETERO_CONVERSION unsigned32's, some of the "extra" data * may a user message buffer which is not automatically endian swapped. */ -#define RTEMS_MINIMUN_HETERO_CONVERSION ( sizeof( rtems_packet_prefix ) / 4 ) +#define MP_PACKET_MINIMUN_HETERO_CONVERSION ( sizeof( MP_packet_Prefix ) / 4 ) /* * _Mp_packet_Is_valid_packet_class @@ -97,7 +98,7 @@ typedef struct { */ STATIC INLINE boolean _Mp_packet_Is_valid_packet_class ( - rtems_mp_packet_classes the_packet_class + MP_packet_Classes the_packet_class ); /* @@ -110,10 +111,10 @@ STATIC INLINE boolean _Mp_packet_Is_valid_packet_class ( */ STATIC INLINE boolean _Mp_packet_Is_null ( - rtems_packet_prefix *the_packet + MP_packet_Prefix *the_packet ); -#include <rtems/mppkt.inl> +#include <rtems/core/mppkt.inl> #ifdef __cplusplus } diff --git a/c/src/exec/score/headers/object.h b/c/src/exec/score/headers/object.h index b1d422d3d4..3da299e95f 100644 --- a/c/src/exec/score/headers/object.h +++ b/c/src/exec/score/headers/object.h @@ -1,8 +1,9 @@ /* object.h * * This include file contains all the constants and structures associated - * with the RTEMS Object Handler. This Handler provides mechanisms which - * can be used to initialize and manipulate all RTEMS objects. + * with the Object Handler. This Handler provides mechanisms which + * can be used to initialize and manipulate all objects which have + * ids. * * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. * On-Line Applications Research Corporation (OAR). @@ -15,14 +16,14 @@ * $Id$ */ -#ifndef __RTEMS_OBJECTS_h -#define __RTEMS_OBJECTS_h +#ifndef __OBJECTS_h +#define __OBJECTS_h #ifdef __cplusplus extern "C" { #endif -#include <rtems/chain.h> +#include <rtems/core/chain.h> /* * The following type defines the control block used to manage @@ -142,6 +143,7 @@ typedef struct { */ EXTERN unsigned32 _Objects_Local_node; +EXTERN unsigned32 _Objects_Maximum_nodes; /* * The following is the list of information blocks for each object @@ -164,23 +166,23 @@ EXTERN Objects_Information * The following define the constants which may be used in name searches. */ -#define RTEMS_SEARCH_ALL_NODES 0 -#define RTEMS_SEARCH_OTHER_NODES 0x7FFFFFFE -#define RTEMS_SEARCH_LOCAL_NODE 0x7FFFFFFF -#define RTEMS_WHO_AM_I 0 +#define OBJECTS_SEARCH_ALL_NODES 0 +#define OBJECTS_SEARCH_OTHER_NODES 0x7FFFFFFE +#define OBJECTS_SEARCH_LOCAL_NODE 0x7FFFFFFF +#define OBJECTS_WHO_AM_I 0 /* * Parameters and return id's for _Objects_Get_next */ -#define RTEMS_OBJECT_ID_INITIAL_INDEX (0) -#define RTEMS_OBJECT_ID_FINAL_INDEX (0xffff) +#define OBJECTS_ID_INITIAL_INDEX (0) +#define OBJECTS_ID_FINAL_INDEX (0xffff) -#define RTEMS_OBJECT_ID_INITIAL(node) (_Objects_Build_id( \ - OBJECTS_NO_CLASS, \ - node, \ - RTEMS_OBJECT_ID_INITIAL_INDEX)) -#define RTEMS_OBJECT_ID_FINAL ((Objects_Id)~0) +#define OBJECTS_ID_INITIAL(node) (_Objects_Build_id( \ + OBJECTS_NO_CLASS, \ + node, \ + OBJECTS_ID_INITIAL_INDEX)) +#define OBJECTS_ID_FINAL ((Objects_Id)~0) /* * _Objects_Handler_initialization @@ -193,6 +195,7 @@ EXTERN Objects_Information void _Objects_Handler_initialization( unsigned32 node, + unsigned32 maximum_nodes, unsigned32 maximum_global_objects ); @@ -303,7 +306,16 @@ boolean _Objects_Compare_name_raw( * */ -rtems_status_code _Objects_Name_to_id( +typedef enum { + OBJECTS_SUCCESSFUL, + OBJECTS_INVALID_NAME, + OBJECTS_INVALID_NODE +} Objects_Name_to_id_errors; + +#define OBJECTS_NAME_ERRORS_FIRST OBJECTS_SUCCESSFUL +#define OBJECTS_NAME_ERRORS_LAST OBJECTS_INVALID_NODE + +Objects_Name_to_id_errors _Objects_Name_to_id( Objects_Information *information, Objects_Name name, unsigned32 node, @@ -378,7 +390,7 @@ STATIC INLINE Objects_Id _Objects_Build_id( ); /* - * rtems_get_class + * _Objects_Get_class * * DESCRIPTION: * @@ -386,12 +398,12 @@ STATIC INLINE Objects_Id _Objects_Build_id( * */ -STATIC INLINE Objects_Classes rtems_get_class( +STATIC INLINE Objects_Classes _Objects_Get_class( Objects_Id id ); /* - * rtems_get_node + * _Objects_Get_node * * DESCRIPTION: * @@ -399,12 +411,12 @@ STATIC INLINE Objects_Classes rtems_get_class( * */ -STATIC INLINE unsigned32 rtems_get_node( +STATIC INLINE unsigned32 _Objects_Get_node( Objects_Id id ); /* - * rtems_get_index + * _Objects_Get_index * * DESCRIPTION: * @@ -412,7 +424,7 @@ STATIC INLINE unsigned32 rtems_get_node( * */ -STATIC INLINE unsigned32 rtems_get_index( +STATIC INLINE unsigned32 _Objects_Get_index( Objects_Id id ); @@ -532,7 +544,7 @@ STATIC INLINE void _Objects_Close( Objects_Control *the_object ); -#include <rtems/object.inl> +#include <rtems/core/object.inl> #include <rtems/objectmp.h> #ifdef __cplusplus diff --git a/c/src/exec/score/headers/objectmp.h b/c/src/exec/score/headers/objectmp.h index b15d5cbb43..cef5c6879d 100644 --- a/c/src/exec/score/headers/objectmp.h +++ b/c/src/exec/score/headers/objectmp.h @@ -42,6 +42,8 @@ typedef struct { */ void _Objects_MP_Handler_initialization ( + unsigned32 node, + unsigned32 maximum_nodes, unsigned32 maximum_global_objects ); @@ -140,7 +142,7 @@ void _Objects_MP_Close ( * object with that name if one is found. */ -rtems_status_code _Objects_MP_Global_name_search ( +Objects_Name_to_id_errors _Objects_MP_Global_name_search ( Objects_Information *information, Objects_Name the_name, unsigned32 nodes_to_search, @@ -171,6 +173,7 @@ void _Objects_MP_Is_remote ( * inactive global object control blocks. */ +EXTERN unsigned32 _Objects_MP_Maximum_global_objects; EXTERN Chain_Control _Objects_MP_Inactive_global_objects; #include <rtems/objectmp.inl> diff --git a/c/src/exec/score/headers/priority.h b/c/src/exec/score/headers/priority.h index 44397e7a8a..8f681c0ce1 100644 --- a/c/src/exec/score/headers/priority.h +++ b/c/src/exec/score/headers/priority.h @@ -2,7 +2,7 @@ * * This include file contains all thread priority manipulation routines. * This Handler provides mechanisms which can be used to - * initialize and manipulate RTEMS priorities. + * initialize and manipulate thread priorities. * * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. * On-Line Applications Research Corporation (OAR). @@ -15,8 +15,8 @@ * $Id$ */ -#ifndef __RTEMS_PRIORITY_h -#define __RTEMS_PRIORITY_h +#ifndef __PRIORITY_h +#define __PRIORITY_h #ifdef __cplusplus extern "C" { @@ -31,8 +31,8 @@ extern "C" { typedef unsigned32 Priority_Control; -#define RTEMS_MINIMUM_PRIORITY 1 /* highest thread priority */ -#define RTEMS_MAXIMUM_PRIORITY 255 /* lowest thread priority */ +#define PRIORITY_MINIMUM 0 /* highest thread priority */ +#define PRIORITY_MAXIMUM 255 /* lowest thread priority */ /* * The following record defines the information associated with @@ -62,12 +62,6 @@ EXTERN volatile Priority_Bit_map_control _Priority_Major_bit_map; EXTERN Priority_Bit_map_control _Priority_Bit_map[16] CPU_STRUCTURE_ALIGNMENT; /* - * The following constants are useful when manipulating priority. - */ - -#define RTEMS_CURRENT_PRIORITY 0 /* obtain current priority */ - -/* * The definition of the Priority_Bit_map_control type is CPU dependent. * */ @@ -185,7 +179,7 @@ STATIC INLINE boolean _Priority_Is_group_empty ( Priority_Control the_priority ); -#include <rtems/priority.inl> +#include <rtems/core/priority.inl> #ifdef __cplusplus } diff --git a/c/src/exec/score/headers/stack.h b/c/src/exec/score/headers/stack.h index a0fce1ef04..2a41bcf89f 100644 --- a/c/src/exec/score/headers/stack.h +++ b/c/src/exec/score/headers/stack.h @@ -15,8 +15,8 @@ * $Id$ */ -#ifndef __RTEMS_STACK_h -#define __RTEMS_STACK_h +#ifndef __STACK_h +#define __STACK_h #ifdef __cplusplus extern "C" { @@ -27,7 +27,7 @@ extern "C" { * thread must exceed. */ -#define RTEMS_MINIMUM_STACK_SIZE CPU_STACK_MINIMUM_SIZE +#define STACK_MINIMUM_SIZE CPU_STACK_MINIMUM_SIZE /* * The following defines the control block used to manage each stack. @@ -85,7 +85,7 @@ STATIC INLINE unsigned32 _Stack_Adjust_size ( unsigned32 size ); -#include <rtems/stack.inl> +#include <rtems/core/stack.inl> #ifdef __cplusplus } diff --git a/c/src/exec/score/headers/states.h b/c/src/exec/score/headers/states.h index 56f67ecc49..3f7c4a7e99 100644 --- a/c/src/exec/score/headers/states.h +++ b/c/src/exec/score/headers/states.h @@ -1,6 +1,6 @@ /* states.h * - * This include file contains all RTEMS state information. + * This include file contains thread execution state information. * * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. * On-Line Applications Research Corporation (OAR). @@ -43,13 +43,15 @@ typedef unsigned32 States_Control; #define STATES_WAITING_FOR_MESSAGE 0x0040 /* wait for message */ #define STATES_WAITING_FOR_EVENT 0x0080 /* wait for event */ #define STATES_WAITING_FOR_SEMAPHORE 0x0100 /* wait for semaphore */ -#define STATES_WAITING_FOR_TIME 0x0200 /* wait for specific TOD */ -#define STATES_WAITING_FOR_RPC_REPLY 0x0400 /* wait for rpc reply */ -#define STATES_WAITING_FOR_PERIOD 0x0800 /* rate monotonic delay */ +#define STATES_WAITING_FOR_MUTEX 0x0200 /* wait for mutex */ +#define STATES_WAITING_FOR_TIME 0x0400 /* wait for specific TOD */ +#define STATES_WAITING_FOR_RPC_REPLY 0x0800 /* wait for rpc reply */ +#define STATES_WAITING_FOR_PERIOD 0x1000 /* rate monotonic delay */ #define STATES_LOCALLY_BLOCKED ( STATES_WAITING_FOR_BUFFER | \ STATES_WAITING_FOR_SEGMENT | \ STATES_WAITING_FOR_MESSAGE | \ + STATES_WAITING_FOR_MUTEX | \ STATES_WAITING_FOR_SEMAPHORE ) #define STATES_WAITING_ON_THREAD_QUEUE \ @@ -221,6 +223,19 @@ STATIC INLINE boolean _States_Is_waiting_for_event ( ); /* + * _States_Is_waiting_for_mutex + * + * DESCRIPTION: + * + * This function returns TRUE if the WAITING_FOR_MUTEX state + * is set in the_states, and FALSE otherwise. + */ + +STATIC INLINE boolean _States_Is_waiting_for_mutex ( + States_Control the_states +); + +/* * _States_Is_waiting_for_semaphore * * DESCRIPTION: @@ -327,7 +342,7 @@ STATIC INLINE boolean _States_Are_set ( States_Control mask ); -#include <rtems/states.inl> +#include <rtems/core/states.inl> #ifdef __cplusplus } diff --git a/c/src/exec/score/headers/sysstate.h b/c/src/exec/score/headers/sysstate.h index 511a26cefc..b0ace61f98 100644 --- a/c/src/exec/score/headers/sysstate.h +++ b/c/src/exec/score/headers/sysstate.h @@ -40,12 +40,31 @@ typedef enum { #define SYSTEM_STATE_CODES_LAST SYSTEM_STATE_FAILED /* + * The following variable indicates whether or not this is + * an multiprocessing system. + */ + +EXTERN boolean _System_state_Is_multiprocessing; + +/* * The following variable contains the current system state. */ EXTERN System_state_Codes _System_state_Current; /* + * _System_state_Handler_initialization + * + * DESCRIPTION: + * + * This routine initializes the system state handler. + */ + +STATIC INLINE void _System_state_Handler_initialization ( + boolean is_multiprocessing +); + +/* * _System_state_Set * * DESCRIPTION: diff --git a/c/src/exec/score/headers/system.h b/c/src/exec/score/headers/system.h index 5f627c1a7c..037fe93e66 100644 --- a/c/src/exec/score/headers/system.h +++ b/c/src/exec/score/headers/system.h @@ -76,9 +76,7 @@ extern "C" { typedef void * proc_ptr; -#include <rtems/cpu.h> /* processor specific information */ -#include <rtems/status.h> /* RTEMS status codes */ -#include <rtems/directives.h> +#include <rtems/core/cpu.h> /* processor specific information */ /* * Define NULL @@ -116,12 +114,6 @@ extern const char _RTEMS_version[]; /* RTEMS version string */ extern const char _Copyright_Notice[]; /* RTEMS copyright string */ /* - * The jump table of entry points into RTEMS directives. - */ - -extern const void * _Entry_points[ RTEMS_NUMBER_OF_ENTRY_POINTS ]; - -/* * The following defines the CPU dependent information table. */ diff --git a/c/src/exec/score/headers/thread.h b/c/src/exec/score/headers/thread.h index 37a5898d01..823a4e6760 100644 --- a/c/src/exec/score/headers/thread.h +++ b/c/src/exec/score/headers/thread.h @@ -14,77 +14,44 @@ * $Id$ */ -#ifndef __RTEMS_THREAD_h -#define __RTEMS_THREAD_h +#ifndef __THREAD_h +#define __THREAD_h #ifdef __cplusplus extern "C" { #endif -#include <rtems/asr.h> -#include <rtems/attr.h> -#include <rtems/context.h> -#include <rtems/cpu.h> -#include <rtems/eventset.h> -#include <rtems/modes.h> -#include <rtems/mppkt.h> -#include <rtems/object.h> -#include <rtems/options.h> -#include <rtems/priority.h> -#include <rtems/stack.h> -#include <rtems/states.h> -#include <rtems/tod.h> -#include <rtems/tqdata.h> -#include <rtems/watchdog.h> - -/* - * Notepads constants (indices into notepad array) - */ - -#define RTEMS_NOTEPAD_FIRST 0 /* lowest numbered notepad */ -#define RTEMS_NOTEPAD_0 0 /* notepad location 0 */ -#define RTEMS_NOTEPAD_1 1 /* notepad location 1 */ -#define RTEMS_NOTEPAD_2 2 /* notepad location 2 */ -#define RTEMS_NOTEPAD_3 3 /* notepad location 3 */ -#define RTEMS_NOTEPAD_4 4 /* notepad location 4 */ -#define RTEMS_NOTEPAD_5 5 /* notepad location 5 */ -#define RTEMS_NOTEPAD_6 6 /* notepad location 6 */ -#define RTEMS_NOTEPAD_7 7 /* notepad location 7 */ -#define RTEMS_NOTEPAD_8 8 /* notepad location 8 */ -#define RTEMS_NOTEPAD_9 9 /* notepad location 9 */ -#define RTEMS_NOTEPAD_10 10 /* notepad location 10 */ -#define RTEMS_NOTEPAD_11 11 /* notepad location 11 */ -#define RTEMS_NOTEPAD_12 12 /* notepad location 12 */ -#define RTEMS_NOTEPAD_13 13 /* notepad location 13 */ -#define RTEMS_NOTEPAD_14 14 /* notepad location 14 */ -#define RTEMS_NOTEPAD_15 15 /* notepad location 15 */ -#define RTEMS_NOTEPAD_LAST RTEMS_NOTEPAD_15 /* highest numbered notepad */ - -#define RTEMS_NUMBER_NOTEPADS (RTEMS_NOTEPAD_LAST+1) - -/* - * The following defines the "return type" of an RTEMS thread. - * - * NOTE: Keep both types for internal threads. - */ - -typedef void rtems_task; -typedef void Thread; +#include <rtems/core/context.h> +#include <rtems/core/cpu.h> +#include <rtems/core/mppkt.h> +#include <rtems/core/object.h> +#include <rtems/core/priority.h> +#include <rtems/core/stack.h> +#include <rtems/core/states.h> +#include <rtems/core/tod.h> +#include <rtems/core/tqdata.h> +#include <rtems/core/watchdog.h> /* - * The following defines the argument to an RTEMS thread. + * The following defines the "return type" of a thread. */ -typedef unsigned32 rtems_task_argument; -typedef unsigned32 Thread_Argument; +typedef void Thread; /* - * The following defines the type for the entry point of an RTEMS thread. + * The following defines the ways in which the entry point for a + * thread can be invoked. Basically, it can be passed any + * combination/permutation of a pointer and an unsigned32 value. + * + * NOTE: For now, we are ignoring the return type. */ -typedef rtems_task ( *rtems_task_entry )( - rtems_task_argument - ); +typedef enum { + THREAD_START_NUMERIC, + THREAD_START_POINTER, + THREAD_START_BOTH_POINTER_FIRST, + THREAD_START_BOTH_NUMERIC_FIRST +} Thread_Start_types; typedef Thread ( *Thread_Entry )( ); @@ -93,19 +60,15 @@ typedef Thread ( *Thread_Entry )( ); * the starting state of a thread. */ -typedef enum { - THREAD_START_NUMERIC, - THREAD_START_POINTER, - THREAD_START_BOTH_POINTER_FIRST, - THREAD_START_BOTH_NUMERIC_FIRST -} Thread_Start_types; - typedef struct { Thread_Entry entry_point; /* starting thread address */ Thread_Start_types prototype; /* how task is invoked */ void *pointer_argument; /* pointer argument */ unsigned32 numeric_argument; /* numeric argument */ - Modes_Control initial_modes; /* initial mode */ + /* initial execution modes */ + boolean is_preemptible; + boolean is_timeslice; + unsigned32 isr_level; Priority_Control initial_priority; /* initial priority */ Stack_Control Initial_stack; /* stack information */ void *fp_context; /* initial FP context area address */ @@ -117,16 +80,21 @@ typedef struct { * a thread which it is waiting for a resource. */ +#define THREAD_STATUS_PROXY_BLOCKING 0x1111111 + typedef struct { Objects_Id id; /* waiting on this object */ - rtems_option option_set; /* wait mode */ - union { - unsigned32 segment_size; /* size of segment requested */ - rtems_event_set event_condition; - unsigned32 *message_size_p; /* ptr for return size of message */ - } Extra; - void *return_argument; /* address of user return param */ - rtems_status_code return_code; /* status for thread awakened */ + unsigned32 count; /* "generic" fields to be used */ + void *return_argument; /* when blocking */ + void *return_argument_1; + unsigned32 option; + + /* + * NOTE: The following assumes that all API return codes can be + * treated as an unsigned32. + */ + unsigned32 return_code; /* status for thread awakened */ + Chain_Control Block2n; /* 2 - n priority blocked chain */ Thread_queue_Control *queue; /* pointer to thread queue */ } Thread_Wait_information; @@ -147,7 +115,7 @@ typedef struct { unsigned32 resource_count; Thread_Wait_information Wait; Watchdog_Control Timer; - rtems_packet_prefix *receive_packet; + MP_packet_Prefix *receive_packet; /****************** end of common block ********************/ Chain_Node Active; } Thread_Proxy_control; @@ -161,15 +129,12 @@ typedef struct { * memory images for the shared part. */ -/* XXX structure in wrong file .. API .. not core */ +typedef enum { + THREAD_API_RTEMS +} Thread_APIs; -typedef struct { - boolean is_global; - unsigned32 Notepads[ RTEMS_NUMBER_NOTEPADS ]; - rtems_event_set pending_events; - rtems_event_set events_out; - ASR_Information Signal; -} RTEMS_API_Control; +#define THREAD_API_FIRST THREAD_API_RTEMS +#define THREAD_API_LAST THREAD_API_RTEMS typedef struct { Objects_Control Object; @@ -179,24 +144,30 @@ typedef struct { unsigned32 resource_count; Thread_Wait_information Wait; Watchdog_Control Timer; - rtems_packet_prefix *receive_packet; + MP_packet_Prefix *receive_packet; /****************** end of common block ********************/ + boolean is_global; Chain_Control *ready; Priority_Information Priority_map; Thread_Start_information Start; - Modes_Control current_modes; + boolean is_preemptible; + boolean is_timeslice; Context_Control Registers; void *fp_context; - RTEMS_API_Control *RTEMS_API; - void *extension; + void *API_Extensions[ THREAD_API_LAST + 1 ]; + void **extensions; } Thread_Control; /* - * External API name for Thread_Control + * The following context area contains the context of the "thread" + * which invoked the start multitasking routine. This context is + * restored as the last action of the stop multitasking routine. Thus + * control of the processor can be returned to the environment + * which initiated the system. */ - -typedef Thread_Control rtems_tcb; - + +EXTERN Context_Control _Thread_BSP_context; + /* * The following declares the dispatch critical section nesting * counter which is used to prevent context switches at inopportune @@ -206,6 +177,14 @@ typedef Thread_Control rtems_tcb; EXTERN unsigned32 _Thread_Dispatch_disable_level; /* + * The following holds how many user extensions are in the system. This + * is used to determine how many user extension data areas to allocate + * per thread. + */ + +EXTERN unsigned32 _Thread_Maximum_extensions; + +/* * The following data items are used to manage timeslicing. */ @@ -228,7 +207,7 @@ EXTERN Thread_Control *_Thread_Executing; /* * The following points to the highest priority ready thread - * in the system. Unless the current thread is RTEMS_NO_PREEMPT, + * in the system. Unless the current thread is not preemptibl, * then this thread will be context switched to when the next * dispatch occurs. */ @@ -243,16 +222,6 @@ EXTERN Thread_Control *_Thread_Heir; EXTERN Thread_Control *_Thread_Allocated_fp; /* - * The following context area contains the context of the "thread" - * which invoked rtems_initialize_executive. This context is restored - * as the last action of the rtems_shutdown_executive directive. Thus - * control of the processor can be returned to the environment - * which initiated RTEMS. - */ - -EXTERN Context_Control _Thread_BSP_context; - -/* * _Thread_Handler_initialization * * DESCRIPTION: @@ -261,8 +230,9 @@ EXTERN Context_Control _Thread_BSP_context; */ void _Thread_Handler_initialization ( - unsigned32 ticks_per_timeslice, - unsigned32 maximum_proxies + unsigned32 ticks_per_timeslice, + unsigned32 maximum_extensions, + unsigned32 maximum_proxies ); /* @@ -272,7 +242,7 @@ void _Thread_Handler_initialization ( * * This routine initiates multitasking. It is invoked only as * part of initialization and its invocation is the last act of - * the rtems_initialize_executive directive. + * the non-multitasking part of the system initialization. */ void _Thread_Start_multitasking ( @@ -286,8 +256,8 @@ void _Thread_Start_multitasking ( * DESCRIPTION: * * This routine halts multitasking and returns control to - * the "thread" which initially invoked the rtems_initialize_executive - * directive. + * the "thread" (i.e. the BSP) which initially invoked the + * routine which initialized the system. */ STATIC INLINE void _Thread_Stop_multitasking( void ); @@ -333,7 +303,9 @@ boolean _Thread_Initialize( unsigned32 stack_size, /* insure it is >= min */ boolean is_fp, /* TRUE if thread uses FP */ Priority_Control priority, - Modes_Control mode, + boolean is_preemptible, + boolean is_timeslice, + unsigned32 isr_level, Objects_Name name ); @@ -452,7 +424,7 @@ void _Thread_Set_transient( * at the priority of the currently executing thread, then the * executing thread's timeslice is reset. Otherwise, the * currently executing thread is placed at the rear of the - * RTEMS_FIFO for this priority and a new heir is selected. + * FIFO for this priority and a new heir is selected. */ void _Thread_Reset_timeslice( void ); @@ -551,8 +523,7 @@ void _Thread_Handler( void ); * DESCRIPTION: * * This routine is invoked when a thread must be unblocked at the - * end of a delay such as the rtems_task_wake_after and rtems_task_wake_when - * directives. + * end of a time based delay (i.e. wake after or wake when). */ void _Thread_Delay_ended( @@ -590,23 +561,14 @@ void _Thread_Set_priority( ); /* - * _Thread_Change_mode + * _Thread_Evaluate_mode * * DESCRIPTION: * - * This routine changes the current values of the modes - * indicated by mask of the calling thread are changed to that - * indicated in mode_set. The former mode of the thread is - * returned in mode_set. If the changes in the current mode - * indicate that a thread dispatch operation may be necessary, - * then need_dispatch is TRUE, otherwise it is FALSE. + * This routine XXX */ -boolean _Thread_Change_mode( - Modes_Control new_mode_set, - Modes_Control mask, - Modes_Control *old_mode_set -); +boolean _Thread_Evaluate_mode( void ); /* * _Thread_Resume @@ -782,8 +744,21 @@ STATIC INLINE Thread_Control *_Thread_Get ( Objects_Locations *location ); -#include <rtems/thread.inl> -#include <rtems/threadmp.h> +/* + * _Thread_Is_proxy_blocking + * + * DESCRIPTION: + * + * This function returns TRUE if the status code is equal to the + * status which indicates that a proxy is blocking, and FALSE otherwise. + */ + +STATIC INLINE boolean _Thread_Is_proxy_blocking ( + unsigned32 code +); + +#include <rtems/core/thread.inl> +#include <rtems/core/threadmp.h> #ifdef __cplusplus } diff --git a/c/src/exec/score/headers/threadmp.h b/c/src/exec/score/headers/threadmp.h index db94a65d78..89b8e3d597 100644 --- a/c/src/exec/score/headers/threadmp.h +++ b/c/src/exec/score/headers/threadmp.h @@ -104,7 +104,7 @@ EXTERN Thread_Control *_Thread_MP_Receive; EXTERN Chain_Control _Thread_MP_Active_proxies; EXTERN Chain_Control _Thread_MP_Inactive_proxies; -#include <rtems/threadmp.inl> +#include <rtems/core/threadmp.inl> #ifdef __cplusplus } diff --git a/c/src/exec/score/headers/threadq.h b/c/src/exec/score/headers/threadq.h index 27a36ab63e..a9fb29bb57 100644 --- a/c/src/exec/score/headers/threadq.h +++ b/c/src/exec/score/headers/threadq.h @@ -14,18 +14,18 @@ * $Id$ */ -#ifndef __RTEMS_THREAD_QUEUE_h -#define __RTEMS_THREAD_QUEUE_h +#ifndef __THREAD_QUEUE_h +#define __THREAD_QUEUE_h #ifdef __cplusplus extern "C" { #endif -#include <rtems/tqdata.h> +#include <rtems/core/tqdata.h> -#include <rtems/object.h> -#include <rtems/thread.h> -#include <rtems/watchdog.h> +#include <rtems/core/object.h> +#include <rtems/core/thread.h> +#include <rtems/core/watchdog.h> /* * The following type defines the callout used when a remote task @@ -75,7 +75,7 @@ Thread_Control *_Thread_queue_Dequeue( void _Thread_queue_Enqueue( Thread_queue_Control *the_thread_queue, - rtems_interval timeout + Watchdog_Interval timeout ); /* @@ -131,7 +131,8 @@ Thread_Control *_Thread_queue_First( void _Thread_queue_Flush( Thread_queue_Control *the_thread_queue, - Thread_queue_Flush_callout remote_extract_callout + Thread_queue_Flush_callout remote_extract_callout, + unsigned32 status ); /* @@ -149,7 +150,8 @@ void _Thread_queue_Initialize( Objects_Classes the_class, Thread_queue_Disciplines the_discipline, States_Control state, - Thread_queue_Extract_callout proxy_extract_callout + Thread_queue_Extract_callout proxy_extract_callout, + unsigned32 timeout_status ); /* @@ -179,7 +181,7 @@ Thread_Control *_Thread_queue_Dequeue_priority( void _Thread_queue_Enqueue_priority( Thread_queue_Control *the_thread_queue, Thread_Control *the_thread, - rtems_interval timeout + Watchdog_Interval timeout ); /* @@ -231,13 +233,13 @@ Thread_Control *_Thread_queue_Dequeue_fifo( * * This routine enqueues the currently executing thread on * the_thread_queue with an optional timeout using the - * RTEMS_FIFO discipline. + * FIFO discipline. */ void _Thread_queue_Enqueue_fifo( Thread_queue_Control *the_thread_queue, Thread_Control *the_thread, - rtems_interval timeout + Watchdog_Interval timeout ); /* diff --git a/c/src/exec/score/headers/tod.h b/c/src/exec/score/headers/tod.h index ae7e2b9747..6c2882a3c5 100644 --- a/c/src/exec/score/headers/tod.h +++ b/c/src/exec/score/headers/tod.h @@ -14,15 +14,15 @@ * $Id$ */ -#ifndef __RTEMS_TIME_OF_DAY_h -#define __RTEMS_TIME_OF_DAY_h +#ifndef __TIME_OF_DAY_h +#define __TIME_OF_DAY_h #ifdef __cplusplus extern "C" { #endif -#include <rtems/object.h> -#include <rtems/watchdog.h> +#include <rtems/core/object.h> +#include <rtems/core/watchdog.h> /* * The following constants are related to the time of day. @@ -42,7 +42,7 @@ extern "C" { /* * The following constant define the earliest year to which an - * RTEMS time of day can be initialized. This is considered the + * time of day can be initialized. This is considered the * epoch. */ @@ -61,27 +61,27 @@ typedef struct { /* RTEID style time/date */ unsigned32 minute; /* minute, 0 -> 59 */ unsigned32 second; /* second, 0 -> 59 */ unsigned32 ticks; /* elapsed ticks between secs */ -} rtems_time_of_day; +} TOD_Control; /* * The following contains the current time of day. */ -EXTERN rtems_time_of_day _TOD_Current; +EXTERN TOD_Control _TOD_Current; /* * The following contains the number of seconds from 00:00:00 * January 1, TOD_BASE_YEAR until the current time of day. */ -EXTERN rtems_interval _TOD_Seconds_since_epoch; +EXTERN Watchdog_Interval _TOD_Seconds_since_epoch; /* * The following contains the number of ticks since the * system was booted. */ -EXTERN rtems_interval _TOD_Ticks_since_boot; +EXTERN Watchdog_Interval _TOD_Ticks_since_boot; /* * The following contains the number of microseconds per tick. @@ -173,8 +173,8 @@ void _TOD_Handler_initialization( */ void _TOD_Set( - rtems_time_of_day *the_tod, - rtems_interval seconds_since_epoch + TOD_Control *the_tod, + Watchdog_Interval seconds_since_epoch ); /* @@ -182,12 +182,12 @@ void _TOD_Set( * * DESCRIPTION: * - * This function returns STATUS.RTEMS_SUCCESSFUL if THE_TOD contains + * This function returns TRUE if THE_TOD contains * a valid time of day, and FALSE otherwise. */ -rtems_status_code _TOD_Validate( - rtems_time_of_day *the_tod +boolean _TOD_Validate( + TOD_Control *the_tod ); /* @@ -198,8 +198,8 @@ rtems_status_code _TOD_Validate( * This function returns the number seconds between the epoch and THE_TOD. */ -rtems_interval _TOD_To_seconds( - rtems_time_of_day *the_tod +Watchdog_Interval _TOD_To_seconds( + TOD_Control *the_tod ); /* @@ -243,7 +243,7 @@ STATIC INLINE void _TOD_Deactivate( void ); */ STATIC INLINE void _TOD_Activate( - rtems_interval ticks + Watchdog_Interval ticks ); /* @@ -262,7 +262,7 @@ void _TOD_Tickle( ); /* - * RTEMS_MILLISECONDS_TO_MICROSECONDS + * TOD_MILLISECONDS_TO_MICROSECONDS * * DESCRIPTION: * @@ -273,10 +273,10 @@ void _TOD_Tickle( * This must be a macro so it can be used in "static" tables. */ -#define RTEMS_MILLISECONDS_TO_MICROSECONDS(_ms) ((_ms) * 1000) +#define TOD_MILLISECONDS_TO_MICROSECONDS(_ms) ((_ms) * 1000) /* - * RTEMS_MILLISECONDS_TO_TICKS + * TOD_MILLISECONDS_TO_TICKS * * DESCRIPTION: * @@ -287,10 +287,10 @@ void _TOD_Tickle( * This must be a macro so it can be used in "static" tables. */ -#define RTEMS_MILLISECONDS_TO_TICKS(_ms) \ - (RTEMS_MILLISECONDS_TO_MICROSECONDS(_ms) / _TOD_Microseconds_per_tick) +#define TOD_MILLISECONDS_TO_TICKS(_ms) \ + (TOD_MILLISECONDS_TO_MICROSECONDS(_ms) / _TOD_Microseconds_per_tick) -#include <rtems/tod.inl> +#include <rtems/core/tod.inl> #ifdef __cplusplus } diff --git a/c/src/exec/score/headers/tqdata.h b/c/src/exec/score/headers/tqdata.h index f962f409d2..128c4183a3 100644 --- a/c/src/exec/score/headers/tqdata.h +++ b/c/src/exec/score/headers/tqdata.h @@ -14,16 +14,16 @@ * $Id$ */ -#ifndef __RTEMS_THREAD_QUEUE_DATA_h -#define __RTEMS_THREAD_QUEUE_DATA_h +#ifndef __THREAD_QUEUE_DATA_h +#define __THREAD_QUEUE_DATA_h #ifdef __cplusplus extern "C" { #endif -#include <rtems/chain.h> -#include <rtems/priority.h> -#include <rtems/states.h> +#include <rtems/core/chain.h> +#include <rtems/core/priority.h> +#include <rtems/core/states.h> /* * The following enumerated type details all of the disciplines @@ -31,8 +31,8 @@ extern "C" { */ typedef enum { - THREAD_QUEUE_DISCIPLINE_FIFO, /* RTEMS_FIFO queue discipline */ - THREAD_QUEUE_DISCIPLINE_PRIORITY /* RTEMS_PRIORITY queue discipline */ + THREAD_QUEUE_DISCIPLINE_FIFO, /* FIFO queue discipline */ + THREAD_QUEUE_DISCIPLINE_PRIORITY /* PRIORITY queue discipline */ } Thread_queue_Disciplines; /* @@ -51,6 +51,7 @@ typedef struct { boolean sync; /* alloc/dealloc critical section */ Thread_queue_Disciplines discipline; /* queue discipline */ States_Control state; /* state of threads on Thread_q */ + unsigned32 timeout_status; } Thread_queue_Control; /* @@ -80,7 +81,7 @@ STATIC INLINE boolean _Thread_queue_Is_reverse_search ( Priority_Control the_priority ); -#include <rtems/tqdata.inl> +#include <rtems/core/tqdata.inl> #ifdef __cplusplus } diff --git a/c/src/exec/score/headers/userext.h b/c/src/exec/score/headers/userext.h index 56fae9b7db..2808b3566e 100644 --- a/c/src/exec/score/headers/userext.h +++ b/c/src/exec/score/headers/userext.h @@ -2,7 +2,7 @@ * * This include file contains all information about user extensions. This * Handler provides mechanisms which can be used to initialize and manipulate - * all RTEMS user extensions. + * all user extensions. * * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. * On-Line Applications Research Corporation (OAR). @@ -15,23 +15,89 @@ * $Id$ */ -#ifndef __RTEMS_USER_EXTENSIONS_h -#define __RTEMS_USER_EXTENSIONS_h +#ifndef __USER_EXTENSIONS_h +#define __USER_EXTENSIONS_h #ifdef __cplusplus extern "C" { #endif -#include <rtems/config.h> -#include <rtems/thread.h> +#include <rtems/core/interr.h> +#include <rtems/core/chain.h> +#include <rtems/core/thread.h> + +/* + * The following records defines the User Extension Table. + * This table defines the application dependent routines which + * are invoked at critical points in the life of each thread and + * the system as a whole. + */ + +typedef void User_extensions_routine; + +typedef boolean ( *User_extensions_thread_create_extension )( + Thread_Control *, + Thread_Control * + ); + +typedef User_extensions_routine ( *User_extensions_thread_delete_extension )( + Thread_Control *, + Thread_Control * + ); + +typedef User_extensions_routine ( *User_extensions_thread_start_extension )( + Thread_Control *, + Thread_Control * + ); + +typedef User_extensions_routine ( *User_extensions_thread_restart_extension )( + Thread_Control *, + Thread_Control * + ); + +typedef User_extensions_routine ( *User_extensions_thread_switch_extension )( + Thread_Control *, + Thread_Control * + ); + +typedef User_extensions_routine (*User_extensions_thread_post_switch_extension)( + Thread_Control * + ); + +typedef User_extensions_routine ( *User_extensions_thread_begin_extension )( + Thread_Control * + ); + +typedef User_extensions_routine ( *User_extensions_thread_exitted_extension )( + Thread_Control * + ); + +typedef User_extensions_routine ( *User_extensions_fatal_extension )( + Internal_errors_Source /* the_source */, + boolean /* is_internal */, + unsigned32 /* the_error */ + ); + + +typedef struct { + User_extensions_thread_create_extension thread_create; + User_extensions_thread_start_extension thread_start; + User_extensions_thread_restart_extension thread_restart; + User_extensions_thread_delete_extension thread_delete; + User_extensions_thread_switch_extension thread_switch; + User_extensions_thread_post_switch_extension thread_post_switch; + User_extensions_thread_begin_extension thread_begin; + User_extensions_thread_exitted_extension thread_exitted; + User_extensions_fatal_extension fatal; +} User_extensions_Table; /* * The following is used to manage each user extension set. */ typedef struct { - Chain_Node Node; - rtems_extensions_table Callouts; + Chain_Node Node; + User_extensions_Table Callouts; } User_extensions_Control; /* @@ -57,7 +123,7 @@ EXTERN Chain_Control _User_extensions_List; */ STATIC INLINE void _User_extensions_Handler_initialization ( - rtems_extensions_table *initial_extensions + User_extensions_Table *initial_extensions ); /* @@ -70,7 +136,19 @@ STATIC INLINE void _User_extensions_Handler_initialization ( STATIC INLINE void _User_extensions_Add_set ( User_extensions_Control *the_extension, - rtems_extensions_table *extension_table + User_extensions_Table *extension_table +); + +/* + * _User_extensions_Add_API_set + * + * DESCRIPTION: + * + * This routine is used to add an API extension set to the active list. + */ + +STATIC INLINE void _User_extensions_Add_API_set ( + User_extensions_Control *the_extension ); /* @@ -86,59 +164,59 @@ STATIC INLINE void _User_extensions_Remove_set ( ); /* - * _User_extensions_Task_create + * _User_extensions_Thread_create * * DESCRIPTION: * * This routine is used to invoke the user extension for - * the rtems_task_create directive. + * the thread creation operate. */ -STATIC INLINE void _User_extensions_Task_create ( +boolean _User_extensions_Thread_create ( Thread_Control *the_thread ); /* - * _User_extensions_Task_delete + * _User_extensions_Thread_delete * * DESCRIPTION: * * This routine is used to invoke the user extension for - * the rtems_task_delete directive. + * the thread deletion operation. */ -STATIC INLINE void _User_extensions_Task_delete ( +void _User_extensions_Thread_delete ( Thread_Control *the_thread ); /* - * _User_extensions_Task_start + * _User_extensions_Thread_start * * DESCRIPTION: * * This routine is used to invoke the user extension for - * the rtems_task_start directive. + * the thread start operation. */ -STATIC INLINE void _User_extensions_Task_start ( +void _User_extensions_Thread_start ( Thread_Control *the_thread ); /* - * _User_extensions_Task_restart + * _User_extensions_Thread_restart * * DESCRIPTION: * * This routine is used to invoke the user extension for - * the rtems_task_restart directive. + * the thread restart operation. */ -STATIC INLINE void _User_extensions_Task_restart ( +void _User_extensions_Thread_restart ( Thread_Control *the_thread ); /* - * _User_extensions_Task_switch + * _User_extensions_Thread_switch * * DESCRIPTION: * @@ -146,47 +224,49 @@ STATIC INLINE void _User_extensions_Task_restart ( * is invoked when a context switch occurs. */ -STATIC INLINE void _User_extensions_Task_switch ( +STATIC INLINE void _User_extensions_Thread_switch ( Thread_Control *executing, Thread_Control *heir ); /* - * _User_extensions_Task_begin + * _User_extensions_Thread_post_switch * * DESCRIPTION: * - * This routine is used to invoke the user extension which - * is invoked when a task begins. + * This routine is used to invoke the user extension which is invoked + * after a context switch occurs (i.e. we are running in the context + * of the new thread). */ - -STATIC INLINE void _User_extensions_Task_begin ( + +STATIC INLINE void _User_extensions_Thread_post_switch ( Thread_Control *executing ); + /* - * _User_extensions_Task_exitted + * _User_extensions_Thread_begin * * DESCRIPTION: * * This routine is used to invoke the user extension which - * is invoked when a task exits. + * is invoked when a thread begins. */ -STATIC INLINE void _User_extensions_Task_exitted ( +void _User_extensions_Thread_begin ( Thread_Control *executing ); /* - * _User_extensions_Task_exitted + * _User_extensions_Thread_exitted * * DESCRIPTION: * * This routine is used to invoke the user extension which - * is invoked when a task exits. + * is invoked when a thread exits. */ -STATIC INLINE void _User_extensions_Task_exitted ( +void _User_extensions_Thread_exitted ( Thread_Control *executing ); @@ -195,15 +275,17 @@ STATIC INLINE void _User_extensions_Task_exitted ( * * DESCRIPTION: * - * This routine is used to invoke the user extension for - * the rtems_fatal_error_occurred directive. + * This routine is used to invoke the user extension invoked + * when a fatal error occurs. */ -STATIC INLINE void _User_extensions_Fatal ( - unsigned32 the_error +void _User_extensions_Fatal ( + Internal_errors_Source the_source, + boolean is_internal, + unsigned32 the_error ); -#include <rtems/userext.inl> +#include <rtems/core/userext.inl> #ifdef __cplusplus } diff --git a/c/src/exec/score/headers/watchdog.h b/c/src/exec/score/headers/watchdog.h index 70de7018dd..7e871c8881 100644 --- a/c/src/exec/score/headers/watchdog.h +++ b/c/src/exec/score/headers/watchdog.h @@ -15,29 +15,29 @@ * $Id$ */ -#ifndef __RTEMS_WATCHDOG_h -#define __RTEMS_WATCHDOG_h +#ifndef __WATCHDOG_h +#define __WATCHDOG_h #ifdef __cplusplus extern "C" { #endif -#include <rtems/object.h> +#include <rtems/core/object.h> /* * The following type defines the control block used to manage * intervals. */ -typedef unsigned32 rtems_interval; +typedef unsigned32 Watchdog_Interval; /* - * The following types define a pointer to a watchdog/timer service routine. + * The following types define a pointer to a watchdog service routine. */ -typedef void rtems_timer_service_routine; +typedef void Watchdog_Service_routine; -typedef rtems_timer_service_routine ( *rtems_timer_service_routine_entry )( +typedef Watchdog_Service_routine ( *Watchdog_Service_routine_entry )( Objects_Id, void * ); @@ -46,7 +46,7 @@ typedef rtems_timer_service_routine ( *rtems_timer_service_routine_entry )( * Constant for indefinite wait. (actually an illegal interval) */ -#define RTEMS_NO_TIMEOUT 0 +#define WATCHDOG_NO_TIMEOUT 0 /* * The following enumerated type details the modes in which the @@ -92,9 +92,9 @@ typedef enum { typedef struct { Chain_Node Node; Watchdog_States state; - rtems_interval initial; - rtems_interval delta_interval; - rtems_timer_service_routine_entry routine; + Watchdog_Interval initial; + Watchdog_Interval delta_interval; + Watchdog_Service_routine_entry routine; Objects_Id id; void *user_data; } Watchdog_Control; @@ -140,7 +140,7 @@ void _Watchdog_Handler_initialization( void ); STATIC INLINE void _Watchdog_Initialize( Watchdog_Control *the_watchdog, - rtems_timer_service_routine_entry routine, + Watchdog_Service_routine_entry routine, Objects_Id id, void *user_data ); @@ -238,7 +238,7 @@ STATIC INLINE void _Watchdog_Tickle_seconds( void ); STATIC INLINE void _Watchdog_Insert_ticks( Watchdog_Control *the_watchdog, - rtems_interval units, + Watchdog_Interval units, Watchdog_Insert_modes insert_mode ); @@ -256,7 +256,7 @@ STATIC INLINE void _Watchdog_Insert_ticks( STATIC INLINE void _Watchdog_Insert_seconds( Watchdog_Control *the_watchdog, - rtems_interval units, + Watchdog_Interval units, Watchdog_Insert_modes insert_mode ); @@ -273,7 +273,7 @@ STATIC INLINE void _Watchdog_Insert_seconds( STATIC INLINE void _Watchdog_Adjust_seconds( Watchdog_Adjust_directions direction, - rtems_interval units + Watchdog_Interval units ); /* @@ -288,7 +288,7 @@ STATIC INLINE void _Watchdog_Adjust_seconds( STATIC INLINE void _Watchdog_Adjust_ticks( Watchdog_Adjust_directions direction, - rtems_interval units + Watchdog_Interval units ); /* @@ -374,7 +374,7 @@ STATIC INLINE Watchdog_Control *_Watchdog_Last( void _Watchdog_Adjust ( Chain_Control *header, Watchdog_Adjust_directions direction, - rtems_interval units + Watchdog_Interval units ); /* @@ -408,7 +408,7 @@ void _Watchdog_Tickle ( Chain_Control *header ); -#include <rtems/watchdog.inl> +#include <rtems/core/watchdog.inl> #ifdef __cplusplus } diff --git a/c/src/exec/score/headers/wkspace.h b/c/src/exec/score/headers/wkspace.h index 7050be6953..a262761d68 100644 --- a/c/src/exec/score/headers/wkspace.h +++ b/c/src/exec/score/headers/wkspace.h @@ -1,8 +1,8 @@ /* wkspace.h * - * This include file contains information related to the RTEMS + * This include file contains information related to the * RAM Workspace. This Handler provides mechanisms which can be used to - * define, initialize and manipulate the RTEMS workspace. + * define, initialize and manipulate the workspace. * * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. * On-Line Applications Research Corporation (OAR). @@ -15,19 +15,18 @@ * $Id$ */ -#ifndef __RTEMS_WORKSPACE_h -#define __RTEMS_WORKSPACE_h +#ifndef __WORKSPACE_h +#define __WORKSPACE_h #ifdef __cplusplus extern "C" { #endif -#include <rtems/heap.h> -#include <rtems/fatal.h> -#include <rtems/status.h> +#include <rtems/core/heap.h> +#include <rtems/core/interr.h> /* - * The following is used to manage the RTEMS Workspace. + * The following is used to manage the Workspace. * */ @@ -67,8 +66,7 @@ STATIC INLINE void *_Workspace_Allocate( * * This routine returns the address of a block of memory of size * bytes. If a block of the appropriate size cannot be allocated - * from the workspace, then the rtems_fatal_error_occurred directive - * is invoked. + * from the workspace, then the internal error handler is invoked. */ void *_Workspace_Allocate_or_fatal_error( @@ -89,7 +87,7 @@ STATIC INLINE boolean _Workspace_Free( void *block ); -#include <rtems/wkspace.inl> +#include <rtems/core/wkspace.inl> #ifdef __cplusplus } diff --git a/c/src/exec/score/include/rtems/score/address.h b/c/src/exec/score/include/rtems/score/address.h index 0abd113f63..4877206801 100644 --- a/c/src/exec/score/include/rtems/score/address.h +++ b/c/src/exec/score/include/rtems/score/address.h @@ -52,21 +52,6 @@ STATIC INLINE void *_Addresses_Subtract_offset( ); /* - * _Addresses_Add - * - * DESCRIPTION: - * - * This function is used to add two addresses. It returns the - * resulting address. This address is typically converted to an - * access type before being used further. - */ - -STATIC INLINE void *_Addresses_Add ( - void *left, - void *right -); - -/* * _Addresses_Subtract * * DESCRIPTION: @@ -112,7 +97,7 @@ STATIC INLINE boolean _Addresses_Is_in_range ( void *limit ); -#include <rtems/address.inl> +#include <rtems/core/address.inl> #ifdef __cplusplus } diff --git a/c/src/exec/score/include/rtems/score/chain.h b/c/src/exec/score/include/rtems/score/chain.h index 06cc47cc65..35ac4dfa80 100644 --- a/c/src/exec/score/include/rtems/score/chain.h +++ b/c/src/exec/score/include/rtems/score/chain.h @@ -21,7 +21,7 @@ extern "C" { #endif -#include <rtems/address.h> +#include <rtems/core/address.h> /* * This is used to manage each element (node) which is placed @@ -422,7 +422,7 @@ STATIC INLINE boolean _Chain_Is_null_node( Chain_Node *the_node ); -#include <rtems/chain.inl> +#include <rtems/core/chain.inl> #ifdef __cplusplus } diff --git a/c/src/exec/score/include/rtems/score/context.h b/c/src/exec/score/include/rtems/score/context.h index 9b8ee92b04..58e497ae88 100644 --- a/c/src/exec/score/include/rtems/score/context.h +++ b/c/src/exec/score/include/rtems/score/context.h @@ -20,7 +20,7 @@ extern "C" { #endif -#include <rtems/cpu.h> +#include <rtems/core/cpu.h> /* * The following constant defines the number of bytes required diff --git a/c/src/exec/score/include/rtems/score/coremutex.h b/c/src/exec/score/include/rtems/score/coremutex.h new file mode 100644 index 0000000000..0682bbc1ea --- /dev/null +++ b/c/src/exec/score/include/rtems/score/coremutex.h @@ -0,0 +1,247 @@ +/* mutex.h + * + * This include file contains all the constants and structures associated + * with the Mutex Handler. A mutex is an enhanced version of the standard + * Dijkstra binary semaphore used to provide synchronization and mutual + * exclusion capabilities. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#ifndef __RTEMS_CORE_MUTEX_h +#define __RTEMS_CORE_MUTEX_h + +#ifdef __cplusplus +extern "C" { +#endif + +#include <rtems/core/thread.h> +#include <rtems/core/threadq.h> +#include <rtems/core/priority.h> +#include <rtems/core/watchdog.h> + +/* + * The following type defines the callout which the API provides + * to support global/multiprocessor operations on mutexes. + */ + +typedef void ( *CORE_mutex_API_mp_support_callout )( + Thread_Control *, + Objects_Id + ); + +/* + * Blocking disciplines for a mutex. + */ + +typedef enum { + CORE_MUTEX_DISCIPLINES_FIFO, + CORE_MUTEX_DISCIPLINES_PRIORITY, + CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT, + CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING +} CORE_mutex_Disciplines; + +/* + * Mutex handler return statuses. + */ + +typedef enum { + CORE_MUTEX_STATUS_SUCCESSFUL, + CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT, + CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED, + CORE_MUTEX_STATUS_NOT_OWNER_OF_RESOURCE, + CORE_MUTEX_WAS_DELETED, + CORE_MUTEX_TIMEOUT +} CORE_mutex_Status; + +/* + * Locked and unlocked values + */ + +#define CORE_MUTEX_UNLOCKED 1 +#define CORE_MUTEX_LOCKED 0 + +/* + * The following defines the control block used to manage the + * attributes of each mutex. + */ + +typedef struct { + boolean allow_nesting; + CORE_mutex_Disciplines discipline; + Priority_Control priority_ceiling; +} CORE_mutex_Attributes; + +/* + * The following defines the control block used to manage each mutex. + */ + +typedef struct { + Thread_queue_Control Wait_queue; + CORE_mutex_Attributes Attributes; + unsigned32 lock; + unsigned32 nest_count; + Thread_Control *holder; + Objects_Id holder_id; +} CORE_mutex_Control; + +/* + * _CORE_mutex_Initialize + * + * DESCRIPTION: + * + * This routine initializes the mutex based on the parameters passed. + */ + +void _CORE_mutex_Initialize( + CORE_mutex_Control *the_mutex, + Objects_Classes the_class, + CORE_mutex_Attributes *the_mutex_attributes, + unsigned32 initial_lock, + Thread_queue_Extract_callout proxy_extract_callout +); + +/* + * _CORE_mutex_Seize + * + * DESCRIPTION: + * + * This routine attempts to receive a unit from the_mutex. + * If a unit is available or if the wait flag is FALSE, then the routine + * returns. Otherwise, the calling task is blocked until a unit becomes + * available. + */ + +void _CORE_mutex_Seize( + CORE_mutex_Control *the_mutex, + Objects_Id id, + boolean wait, + Watchdog_Interval timeout +); + +/* + * _CORE_mutex_Surrender + * + * DESCRIPTION: + * + * This routine frees a unit to the mutex. If a task was blocked waiting for + * a unit from this mutex, then that task will be readied and the unit + * given to that task. Otherwise, the unit will be returned to the mutex. + */ + +CORE_mutex_Status _CORE_mutex_Surrender( + CORE_mutex_Control *the_mutex, + Objects_Id id, + CORE_mutex_API_mp_support_callout api_mutex_mp_support +); + +/* + * _CORE_mutex_Flush + * + * DESCRIPTION: + * + * This routine assists in the deletion of a mutex by flushing the associated + * wait queue. + */ + +void _CORE_mutex_Flush( + CORE_mutex_Control *the_mutex, + Thread_queue_Flush_callout remote_extract_callout, + unsigned32 status +); + +/* + * _CORE_mutex_Is_locked + * + * DESCRIPTION: + * + * This routine returns TRUE if the mutex specified is locked and FALSE + * otherwise. + */ + +STATIC INLINE boolean _CORE_mutex_Is_locked( + CORE_mutex_Control *the_mutex +); + +/* + * _CORE_mutex_Is_fifo + * + * DESCRIPTION: + * + * This routine returns TRUE if the mutex's wait discipline is FIFO and FALSE + * otherwise. + */ + +STATIC INLINE boolean _CORE_mutex_Is_fifo( + CORE_mutex_Attributes *the_attribute +); + +/* + * _CORE_mutex_Is_priority + * + * DESCRIPTION: + * + * This routine returns TRUE if the mutex's wait discipline is PRIORITY and + * FALSE otherwise. + */ + +STATIC INLINE boolean _CORE_mutex_Is_priority( + CORE_mutex_Attributes *the_attribute +); + +/* + * _CORE_mutex_Is_inherit_priority + * + * DESCRIPTION: + * + * This routine returns TRUE if the mutex's wait discipline is + * INHERIT_PRIORITY and FALSE otherwise. + */ + +STATIC INLINE boolean _CORE_mutex_Is_inherit_priority( + CORE_mutex_Attributes *the_attribute +); + +/* + * _CORE_mutex_Is_priority_ceiling + * + * DESCRIPTION: + * + * This routine returns TRUE if the mutex's wait discipline is + * PRIORITY_CEILING and FALSE otherwise. + */ + +STATIC INLINE boolean _CORE_mutex_Is_priority_ceiling( + CORE_mutex_Attributes *the_attribute +); + +/* + * _CORE_mutex_Is_nesting_allowed + * + * DESCRIPTION: + * + * This routine returns TRUE if the mutex allows a task to obtain a + * semaphore more than once and nest. + */ + +STATIC INLINE boolean _CORE_mutex_Is_nesting_allowed( + CORE_mutex_Attributes *the_attribute +); + +#include <rtems/core/coremutex.inl> + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/c/src/exec/score/include/rtems/score/coresem.h b/c/src/exec/score/include/rtems/score/coresem.h new file mode 100644 index 0000000000..0fcd8cd0b9 --- /dev/null +++ b/c/src/exec/score/include/rtems/score/coresem.h @@ -0,0 +1,179 @@ +/* core_sem.h + * + * This include file contains all the constants and structures associated + * with the Counting Semaphore Handler. A counting semaphore is the + * standard Dijkstra binary semaphore used to provide synchronization + * and mutual exclusion capabilities. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#ifndef __RTEMS_CORE_COUNTING_SEMAPHORE_h +#define __RTEMS_CORE_COUNTING_SEMAPHORE_h + +#ifdef __cplusplus +extern "C" { +#endif + +#include <rtems/core/thread.h> +#include <rtems/core/threadq.h> +#include <rtems/core/priority.h> +#include <rtems/core/watchdog.h> + +/* + * The following type defines the callout which the API provides + * to support global/multiprocessor operations on semaphores. + */ + +typedef void ( *CORE_semaphore_API_mp_support_callout )( + Thread_Control *, + Objects_Id + ); + +/* + * Blocking disciplines for a semaphore. + */ + +typedef enum { + CORE_SEMAPHORE_DISCIPLINES_FIFO, + CORE_SEMAPHORE_DISCIPLINES_PRIORITY +} CORE_semaphore_Disciplines; + +/* + * Core Semaphore handler return statuses. + */ + +typedef enum { + CORE_SEMAPHORE_STATUS_SUCCESSFUL, + CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT, + CORE_SEMAPHORE_WAS_DELETED, + CORE_SEMAPHORE_TIMEOUT +} CORE_semaphore_Status; + +/* + * The following defines the control block used to manage the + * attributes of each semaphore. + */ + +typedef struct { + CORE_semaphore_Disciplines discipline; +} CORE_semaphore_Attributes; + +/* + * The following defines the control block used to manage each + * counting semaphore. + */ + +typedef struct { + Thread_queue_Control Wait_queue; + CORE_semaphore_Attributes Attributes; + unsigned32 count; +} CORE_semaphore_Control; + +/* + * _CORE_semaphore_Initialize + * + * DESCRIPTION: + * + * This routine initializes the semaphore based on the parameters passed. + */ + +void _CORE_semaphore_Initialize( + CORE_semaphore_Control *the_semaphore, + Objects_Classes the_class, + CORE_semaphore_Attributes *the_semaphore_attributes, + unsigned32 initial_value, + Thread_queue_Extract_callout proxy_extract_callout +); + +/* + * _CORE_semaphore_Seize + * + * DESCRIPTION: + * + * This routine attempts to receive a unit from the_semaphore. + * If a unit is available or if the wait flag is FALSE, then the routine + * returns. Otherwise, the calling task is blocked until a unit becomes + * available. + */ + +void _CORE_semaphore_Seize( + CORE_semaphore_Control *the_semaphore, + Objects_Id id, + boolean wait, + Watchdog_Interval timeout +); + +/* + * _CORE_semaphore_Surrender + * + * DESCRIPTION: + * + * This routine frees a unit to the semaphore. If a task was blocked waiting + * for a unit from this semaphore, then that task will be readied and the unit + * given to that task. Otherwise, the unit will be returned to the semaphore. + */ + +CORE_semaphore_Status _CORE_semaphore_Surrender( + CORE_semaphore_Control *the_semaphore, + Objects_Id id, + CORE_semaphore_API_mp_support_callout api_semaphore_mp_support +); + +/* + * _CORE_semaphore_Flush + * + * DESCRIPTION: + * + * This routine assists in the deletion of a semaphore by flushing the + * associated wait queue. + */ + +void _CORE_semaphore_Flush( + CORE_semaphore_Control *the_semaphore, + Thread_queue_Flush_callout remote_extract_callout, + unsigned32 status +); + +/* + * _CORE_semaphore_Get_count + * + * DESCRIPTION: + * + * This routine returns the current count associated with the semaphore. + */ + +STATIC INLINE unsigned32 _CORE_semaphore_Get_count( + CORE_semaphore_Control *the_semaphore +); + +/* + * _CORE_semaphore_Is_priority + * + * DESCRIPTION: + * + * This function returns TRUE if the priority attribute is + * enabled in the attribute_set and FALSE otherwise. + */ + +STATIC INLINE boolean _CORE_semaphore_Is_priority( + CORE_semaphore_Attributes *the_attribute +); + +#include <rtems/core/coresem.inl> + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/c/src/exec/score/include/rtems/score/heap.h b/c/src/exec/score/include/rtems/score/heap.h index 9eb348a760..bf4a8dde6e 100644 --- a/c/src/exec/score/include/rtems/score/heap.h +++ b/c/src/exec/score/include/rtems/score/heap.h @@ -386,7 +386,7 @@ STATIC INLINE unsigned32 _Heap_Build_flag ( unsigned32 in_use_flag ); -#include <rtems/heap.inl> +#include <rtems/core/heap.inl> #ifdef __cplusplus } diff --git a/c/src/exec/score/include/rtems/score/interr.h b/c/src/exec/score/include/rtems/score/interr.h new file mode 100644 index 0000000000..c1088a9dff --- /dev/null +++ b/c/src/exec/score/include/rtems/score/interr.h @@ -0,0 +1,93 @@ +/* interr.h + * + * This include file contains constants and prototypes related + * to the Internal Error Handler. + * + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id# + */ + +#ifndef __RTEMS_INTERNAL_ERROR_h +#define __RTEMS_INTERNAL_ERROR_h + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * This type lists the possible sources from which an error + * can be reported. + */ + +typedef enum { + INTERNAL_ERROR_CORE, + INTERNAL_ERROR_RTEMS_API +} Internal_errors_Source; + +/* + * A list of errors which are generated internally by the executive core. + */ + +typedef enum { + INTERNAL_ERROR_NO_CONFIGURATION_TABLE, + INTERNAL_ERROR_NO_CPU_TABLE, + INTERNAL_ERROR_INVALID_WORKSPACE_ADDRESS, + INTERNAL_ERROR_TOO_LITTLE_WORKSPACE, + INTERNAL_ERROR_WORKSPACE_ALLOCATION, + INTERNAL_ERROR_INTERRUPT_STACK_TOO_SMALL, + INTERNAL_ERROR_THREAD_EXITTED, + INTERNAL_ERROR_INCONSISTENT_MP_INFORMATION, + INTERNAL_ERROR_INVALID_NODE, + INTERNAL_ERROR_NO_MPCI, + INTERNAL_ERROR_BAD_PACKET, + INTERNAL_ERROR_OUT_OF_PACKETS, + INTERNAL_ERROR_OUT_OF_GLOBAL_OBJECTS, + INTERNAL_ERROR_OUT_OF_PROXIES, + INTERNAL_ERROR_INVALID_GLOBAL_ID +} Internal_errors_Core_list; + +/* + * This type holds the fatal error information. + */ + +typedef struct { + Internal_errors_Source the_source; + boolean is_internal; + unsigned32 the_error; +} Internal_errors_Information; + +/* + * When a fatal error occurs, the error information is stored here. + */ + +EXTERN Internal_errors_Information Internal_errors_What_happened; + +/* + * _Internal_error_Occurred + * + * DESCRIPTION: + * + * This routine is invoked when the application or the executive itself + * determines that a fatal error has occurred. + */ + +void volatile _Internal_error_Occurred( + Internal_errors_Source the_source, + boolean is_internal, + unsigned32 the_error +); + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ diff --git a/c/src/exec/score/include/rtems/score/isr.h b/c/src/exec/score/include/rtems/score/isr.h index 77c3f8663e..4bbc3c7aff 100644 --- a/c/src/exec/score/include/rtems/score/isr.h +++ b/c/src/exec/score/include/rtems/score/isr.h @@ -16,8 +16,8 @@ * $Id$ */ -#ifndef __RTEMS_ISR_h -#define __RTEMS_ISR_h +#ifndef __ISR_h +#define __ISR_h #ifdef __cplusplus extern "C" { @@ -31,24 +31,23 @@ extern "C" { typedef unsigned32 ISR_Level; /* - * The following type defines the control block used to manage - * the vectors. + * The following type defines the type used to manage the vectors. */ -typedef unsigned32 rtems_vector_number; +typedef unsigned32 ISR_Vector_number; /* * Return type for ISR Handler */ -typedef void rtems_isr; +typedef void ISR_Handler; /* * Pointer to an ISR Handler */ -typedef rtems_isr ( *rtems_isr_entry )( - rtems_vector_number +typedef ISR_Handler ( *ISR_Handler_entry )( + ISR_Vector_number ); /* * The following is TRUE if signals have been sent to the currently @@ -65,11 +64,11 @@ EXTERN boolean _ISR_Signals_to_thread_executing; EXTERN unsigned32 _ISR_Nest_level; /* - * The following declares the RTEMS Vector Table. Application - * interrupt service routines are vectored by RTEMS via this table. + * The following declares the Vector Table. Application + * interrupt service routines are vectored by the ISR Handler via this table. */ -EXTERN rtems_isr_entry _ISR_Vector_table[CPU_INTERRUPT_NUMBER_OF_VECTORS]; +EXTERN ISR_Handler_entry _ISR_Vector_table[CPU_INTERRUPT_NUMBER_OF_VECTORS]; /* * _ISR_Handler_initialization @@ -79,7 +78,7 @@ EXTERN rtems_isr_entry _ISR_Vector_table[CPU_INTERRUPT_NUMBER_OF_VECTORS]; * This routine performs the initialization necessary for this handler. */ -STATIC INLINE void _ISR_Handler_initialization ( void ); +void _ISR_Handler_initialization ( void ); /* * _ISR_Disable @@ -154,6 +153,17 @@ STATIC INLINE boolean _ISR_Is_in_progress( void ); _CPU_ISR_install_vector( _vector, _new_handler, _old_handler ) /* + * _ISR_Get_level + * + * DESCRIPTION: + * + * This routine returns the current interrupt level. + */ + +#define _ISR_Get_level() \ + _CPU_ISR_Get_level() + +/* * _ISR_Set_level * * DESCRIPTION: @@ -176,7 +186,7 @@ STATIC INLINE boolean _ISR_Is_in_progress( void ); */ STATIC INLINE boolean _ISR_Is_vector_number_valid ( - rtems_vector_number vector + ISR_Vector_number vector ); /* @@ -197,7 +207,7 @@ STATIC INLINE boolean _ISR_Is_valid_user_handler ( * * DESCRIPTION: * - * This routine is the RTEMS interrupt dispatcher. ALL interrupts + * This routine is the interrupt dispatcher. ALL interrupts * are vectored to this routine so that minimal context can be saved * and setup performed before the application's high-level language * interrupt service routine is invoked. After the application's @@ -229,7 +239,7 @@ void _ISR_Handler( void ); void _ISR_Dispatch( void ); -#include <rtems/isr.inl> +#include <rtems/core/isr.inl> #ifdef __cplusplus } diff --git a/c/src/exec/score/include/rtems/score/mpci.h b/c/src/exec/score/include/rtems/score/mpci.h index ca06dd243b..06dc0015d4 100644 --- a/c/src/exec/score/include/rtems/score/mpci.h +++ b/c/src/exec/score/include/rtems/score/mpci.h @@ -14,20 +14,20 @@ * $Id$ */ -#ifndef __RTEMS_MPCI_h -#define __RTEMS_MPCI_h +#ifndef __MPCI_h +#define __MPCI_h #ifdef __cplusplus extern "C" { #endif -#include <rtems/mppkt.h> -#include <rtems/states.h> -#include <rtems/status.h> -#include <rtems/thread.h> -#include <rtems/threadq.h> -#include <rtems/tqdata.h> -#include <rtems/watchdog.h> +#include <rtems/core/mppkt.h> +#include <rtems/core/states.h> +#include <rtems/core/thread.h> +#include <rtems/core/threadq.h> +#include <rtems/core/tqdata.h> +#include <rtems/core/watchdog.h> +#include <rtems/core/coresem.h> /* * The following defines the node number used when a broadcast is desired. @@ -45,6 +45,85 @@ extern "C" { #define MPCI_DEFAULT_TIMEOUT 0xFFFFFFFF /* + * The following records define the Multiprocessor Communications + * Interface (MPCI) Table. This table defines the user-provided + * MPCI which is a required part of a multiprocessor system. + * + * For non-blocking local operations that become remote operations, + * we need a timeout. This is a per-driver timeout: default_timeout + */ + +typedef void MPCI_Entry; + +typedef MPCI_Entry ( *MPCI_initialization_entry )( void ); + +typedef MPCI_Entry ( *MPCI_get_packet_entry )( + MP_packet_Prefix ** + ); + +typedef MPCI_Entry ( *MPCI_return_packet_entry )( + MP_packet_Prefix * + ); + +typedef MPCI_Entry ( *MPCI_send_entry )( + unsigned32, + MP_packet_Prefix * + ); + +typedef MPCI_Entry ( *MPCI_receive_entry )( + MP_packet_Prefix ** + ); + +typedef struct { + unsigned32 default_timeout; /* in ticks */ + unsigned32 maximum_packet_size; + MPCI_initialization_entry initialization; + MPCI_get_packet_entry get_packet; + MPCI_return_packet_entry return_packet; + MPCI_send_entry send_packet; + MPCI_receive_entry receive_packet; +} MPCI_Control; + +/* + * The following defines the type for packet processing routines + * invoked by the MPCI Receive server. + */ + +typedef void (*MPCI_Packet_processor)( MP_packet_Prefix * ); + +/* + * This is the core semaphore which the MPCI Receive Server blocks on. + */ + +EXTERN CORE_semaphore_Control _MPCI_Semaphore; +/* + * The following thread queue is used to maintain a list of tasks + * which currently have outstanding remote requests. + */ + +EXTERN Thread_queue_Control _MPCI_Remote_blocked_threads; + +/* + * The following define the internal pointers to the user's + * configuration information. + */ + +EXTERN MPCI_Control *_MPCI_table; + +/* + * The following points to the MPCI Receive Server. + */ + +EXTERN Thread_Control *_MPCI_Receive_server_tcb; + +/* + * The following table contains the process packet routines provided + * by each object that supports MP operations. + */ + +EXTERN MPCI_Packet_processor _MPCI_Packet_processors[MP_PACKET_CLASSES_LAST+1]; + +/* * _MPCI_Handler_initialization * * DESCRIPTION: @@ -52,7 +131,9 @@ extern "C" { * This routine performs the initialization necessary for this handler. */ -void _MPCI_Handler_initialization ( void ); +void _MPCI_Handler_initialization( + MPCI_Control *users_mpci_table +); /* * _MPCI_Initialization @@ -66,6 +147,21 @@ void _MPCI_Handler_initialization ( void ); void _MPCI_Initialization ( void ); /* + * _MPCI_Register_packet_processor + * + * DESCRIPTION: + * + * This routine registers the MPCI packet processor for the + * designated object class. + */ + +void _MPCI_Register_packet_processor( + MP_packet_Classes the_object, + MPCI_Packet_processor the_packet_processor + +); + +/* * _MPCI_Get_packet * * DESCRIPTION: @@ -74,7 +170,7 @@ void _MPCI_Initialization ( void ); * MPCI get packet callout. */ -rtems_packet_prefix *_MPCI_Get_packet ( void ); +MP_packet_Prefix *_MPCI_Get_packet ( void ); /* * _MPCI_Return_packet @@ -86,7 +182,7 @@ rtems_packet_prefix *_MPCI_Get_packet ( void ); */ void _MPCI_Return_packet ( - rtems_packet_prefix *the_packet + MP_packet_Prefix *the_packet ); /* @@ -100,7 +196,7 @@ void _MPCI_Return_packet ( void _MPCI_Send_process_packet ( unsigned32 destination, - rtems_packet_prefix *the_packet + MP_packet_Prefix *the_packet ); /* @@ -112,9 +208,9 @@ void _MPCI_Send_process_packet ( * MPCI send callout. */ -rtems_status_code _MPCI_Send_request_packet ( +unsigned32 _MPCI_Send_request_packet ( unsigned32 destination, - rtems_packet_prefix *the_packet, + MP_packet_Prefix *the_packet, States_Control extra_state ); @@ -129,7 +225,7 @@ rtems_status_code _MPCI_Send_request_packet ( void _MPCI_Send_response_packet ( unsigned32 destination, - rtems_packet_prefix *the_packet + MP_packet_Prefix *the_packet ); /* @@ -141,7 +237,7 @@ void _MPCI_Send_response_packet ( * MPCI receive callout. */ -rtems_packet_prefix *_MPCI_Receive_packet ( void ); +MP_packet_Prefix *_MPCI_Receive_packet ( void ); /* * _MPCI_Process_response @@ -153,15 +249,27 @@ rtems_packet_prefix *_MPCI_Receive_packet ( void ); */ Thread_Control *_MPCI_Process_response ( - rtems_packet_prefix *the_packet + MP_packet_Prefix *the_packet ); -/* - * The following thread queue is used to maintain a list of tasks - * which currently have outstanding remote requests. +/*PAGE + * + * _MPCI_Receive_server + * */ + +void _MPCI_Receive_server( void ); -EXTERN Thread_queue_Control _MPCI_Remote_blocked_threads; +/*PAGE + * + * _MPCI_Announce + * + * DESCRIPTION: + * + * XXX + */ + +void _MPCI_Announce ( void ); #ifdef __cplusplus } diff --git a/c/src/exec/score/include/rtems/score/mppkt.h b/c/src/exec/score/include/rtems/score/mppkt.h index d63d587fca..32cbc7e0e9 100644 --- a/c/src/exec/score/include/rtems/score/mppkt.h +++ b/c/src/exec/score/include/rtems/score/mppkt.h @@ -1,8 +1,10 @@ /* mppkt.h * * This package is the specification for the Packet Handler. - * This handler defines the basic RTEMS packet and provides + * This handler defines the basic packet and provides * mechanisms to utilize packets based on this prefix. + * Packets are the fundamental basis for messages passed between + * nodes in an MP system. * * * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. @@ -16,20 +18,19 @@ * $Id$ */ -#ifndef __RTEMS_MP_PACKET_h -#define __RTEMS_MP_PACKET_h +#ifndef __MP_PACKET_h +#define __MP_PACKET_h #ifdef __cplusplus extern "C" { #endif -#include <rtems/object.h> -#include <rtems/priority.h> -#include <rtems/watchdog.h> +#include <rtems/core/object.h> +#include <rtems/core/priority.h> +#include <rtems/core/watchdog.h> /* - * The following enumerated type defines the packet classes - * supported by RTEMS. + * The following enumerated type defines the packet classes. * * NOTE: In general, each class corresponds to a manager * which supports global operations. Each manager @@ -37,55 +38,55 @@ extern "C" { */ typedef enum { - RTEMS_MP_PACKET_INTERNAL_THREADS = 0, - RTEMS_MP_PACKET_TASKS = 1, - RTEMS_MP_PACKET_MESSAGE_QUEUE = 2, - RTEMS_MP_PACKET_SEMAPHORE = 3, - RTEMS_MP_PACKET_PARTITION = 4, - RTEMS_MP_PACKET_REGION = 5, - RTEMS_MP_PACKET_EVENT = 6, - RTEMS_MP_PACKET_SIGNAL = 7 -} rtems_mp_packet_classes; - -#define MP_PACKET_CLASSES_FIRST RTEMS_MP_PACKET_INTERNAL_THREADS -#define MP_PACKET_CLASSES_LAST RTEMS_MP_PACKET_SIGNAL + MP_PACKET_INTERNAL_THREADS = 0, + MP_PACKET_TASKS = 1, + MP_PACKET_MESSAGE_QUEUE = 2, + MP_PACKET_SEMAPHORE = 3, + MP_PACKET_PARTITION = 4, + MP_PACKET_REGION = 5, + MP_PACKET_EVENT = 6, + MP_PACKET_SIGNAL = 7 +} MP_packet_Classes; + +#define MP_PACKET_CLASSES_FIRST MP_PACKET_INTERNAL_THREADS +#define MP_PACKET_CLASSES_LAST MP_PACKET_SIGNAL /* * The following record contains the prefix for every packet - * passed between RTEMS nodes. + * passed between nodes in an MP system. * * NOTE: This structure is padded to insure that anything * following it is on a 16 byte boundary. This is * the most stringent structure alignment rule - * the RTEMS project has encountered yet (i960CA). + * encountered yet (i960CA). */ typedef struct { - rtems_mp_packet_classes the_class; + MP_packet_Classes the_class; Objects_Id id; Objects_Id source_tid; Priority_Control source_priority; - rtems_status_code return_code; + unsigned32 return_code; unsigned32 length; unsigned32 to_convert; - rtems_interval timeout; -} rtems_packet_prefix; + Watchdog_Interval timeout; +} MP_packet_Prefix; /* * An MPCI must support packets of at least this size. */ -#define RTEMS_MINIMUM_PACKET_SIZE 64 +#define MP_PACKET_MINIMUM_PACKET_SIZE 64 /* * The following constant defines the number of unsigned32's * in a packet which must be converted to native format in a * heterogeneous system. In packets longer than - * RTEMS_MINIMUN_HETERO_CONVERSION unsigned32's, some of the "extra" data + * MP_PACKET_MINIMUN_HETERO_CONVERSION unsigned32's, some of the "extra" data * may a user message buffer which is not automatically endian swapped. */ -#define RTEMS_MINIMUN_HETERO_CONVERSION ( sizeof( rtems_packet_prefix ) / 4 ) +#define MP_PACKET_MINIMUN_HETERO_CONVERSION ( sizeof( MP_packet_Prefix ) / 4 ) /* * _Mp_packet_Is_valid_packet_class @@ -97,7 +98,7 @@ typedef struct { */ STATIC INLINE boolean _Mp_packet_Is_valid_packet_class ( - rtems_mp_packet_classes the_packet_class + MP_packet_Classes the_packet_class ); /* @@ -110,10 +111,10 @@ STATIC INLINE boolean _Mp_packet_Is_valid_packet_class ( */ STATIC INLINE boolean _Mp_packet_Is_null ( - rtems_packet_prefix *the_packet + MP_packet_Prefix *the_packet ); -#include <rtems/mppkt.inl> +#include <rtems/core/mppkt.inl> #ifdef __cplusplus } diff --git a/c/src/exec/score/include/rtems/score/object.h b/c/src/exec/score/include/rtems/score/object.h index b1d422d3d4..3da299e95f 100644 --- a/c/src/exec/score/include/rtems/score/object.h +++ b/c/src/exec/score/include/rtems/score/object.h @@ -1,8 +1,9 @@ /* object.h * * This include file contains all the constants and structures associated - * with the RTEMS Object Handler. This Handler provides mechanisms which - * can be used to initialize and manipulate all RTEMS objects. + * with the Object Handler. This Handler provides mechanisms which + * can be used to initialize and manipulate all objects which have + * ids. * * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. * On-Line Applications Research Corporation (OAR). @@ -15,14 +16,14 @@ * $Id$ */ -#ifndef __RTEMS_OBJECTS_h -#define __RTEMS_OBJECTS_h +#ifndef __OBJECTS_h +#define __OBJECTS_h #ifdef __cplusplus extern "C" { #endif -#include <rtems/chain.h> +#include <rtems/core/chain.h> /* * The following type defines the control block used to manage @@ -142,6 +143,7 @@ typedef struct { */ EXTERN unsigned32 _Objects_Local_node; +EXTERN unsigned32 _Objects_Maximum_nodes; /* * The following is the list of information blocks for each object @@ -164,23 +166,23 @@ EXTERN Objects_Information * The following define the constants which may be used in name searches. */ -#define RTEMS_SEARCH_ALL_NODES 0 -#define RTEMS_SEARCH_OTHER_NODES 0x7FFFFFFE -#define RTEMS_SEARCH_LOCAL_NODE 0x7FFFFFFF -#define RTEMS_WHO_AM_I 0 +#define OBJECTS_SEARCH_ALL_NODES 0 +#define OBJECTS_SEARCH_OTHER_NODES 0x7FFFFFFE +#define OBJECTS_SEARCH_LOCAL_NODE 0x7FFFFFFF +#define OBJECTS_WHO_AM_I 0 /* * Parameters and return id's for _Objects_Get_next */ -#define RTEMS_OBJECT_ID_INITIAL_INDEX (0) -#define RTEMS_OBJECT_ID_FINAL_INDEX (0xffff) +#define OBJECTS_ID_INITIAL_INDEX (0) +#define OBJECTS_ID_FINAL_INDEX (0xffff) -#define RTEMS_OBJECT_ID_INITIAL(node) (_Objects_Build_id( \ - OBJECTS_NO_CLASS, \ - node, \ - RTEMS_OBJECT_ID_INITIAL_INDEX)) -#define RTEMS_OBJECT_ID_FINAL ((Objects_Id)~0) +#define OBJECTS_ID_INITIAL(node) (_Objects_Build_id( \ + OBJECTS_NO_CLASS, \ + node, \ + OBJECTS_ID_INITIAL_INDEX)) +#define OBJECTS_ID_FINAL ((Objects_Id)~0) /* * _Objects_Handler_initialization @@ -193,6 +195,7 @@ EXTERN Objects_Information void _Objects_Handler_initialization( unsigned32 node, + unsigned32 maximum_nodes, unsigned32 maximum_global_objects ); @@ -303,7 +306,16 @@ boolean _Objects_Compare_name_raw( * */ -rtems_status_code _Objects_Name_to_id( +typedef enum { + OBJECTS_SUCCESSFUL, + OBJECTS_INVALID_NAME, + OBJECTS_INVALID_NODE +} Objects_Name_to_id_errors; + +#define OBJECTS_NAME_ERRORS_FIRST OBJECTS_SUCCESSFUL +#define OBJECTS_NAME_ERRORS_LAST OBJECTS_INVALID_NODE + +Objects_Name_to_id_errors _Objects_Name_to_id( Objects_Information *information, Objects_Name name, unsigned32 node, @@ -378,7 +390,7 @@ STATIC INLINE Objects_Id _Objects_Build_id( ); /* - * rtems_get_class + * _Objects_Get_class * * DESCRIPTION: * @@ -386,12 +398,12 @@ STATIC INLINE Objects_Id _Objects_Build_id( * */ -STATIC INLINE Objects_Classes rtems_get_class( +STATIC INLINE Objects_Classes _Objects_Get_class( Objects_Id id ); /* - * rtems_get_node + * _Objects_Get_node * * DESCRIPTION: * @@ -399,12 +411,12 @@ STATIC INLINE Objects_Classes rtems_get_class( * */ -STATIC INLINE unsigned32 rtems_get_node( +STATIC INLINE unsigned32 _Objects_Get_node( Objects_Id id ); /* - * rtems_get_index + * _Objects_Get_index * * DESCRIPTION: * @@ -412,7 +424,7 @@ STATIC INLINE unsigned32 rtems_get_node( * */ -STATIC INLINE unsigned32 rtems_get_index( +STATIC INLINE unsigned32 _Objects_Get_index( Objects_Id id ); @@ -532,7 +544,7 @@ STATIC INLINE void _Objects_Close( Objects_Control *the_object ); -#include <rtems/object.inl> +#include <rtems/core/object.inl> #include <rtems/objectmp.h> #ifdef __cplusplus diff --git a/c/src/exec/score/include/rtems/score/objectmp.h b/c/src/exec/score/include/rtems/score/objectmp.h index b15d5cbb43..cef5c6879d 100644 --- a/c/src/exec/score/include/rtems/score/objectmp.h +++ b/c/src/exec/score/include/rtems/score/objectmp.h @@ -42,6 +42,8 @@ typedef struct { */ void _Objects_MP_Handler_initialization ( + unsigned32 node, + unsigned32 maximum_nodes, unsigned32 maximum_global_objects ); @@ -140,7 +142,7 @@ void _Objects_MP_Close ( * object with that name if one is found. */ -rtems_status_code _Objects_MP_Global_name_search ( +Objects_Name_to_id_errors _Objects_MP_Global_name_search ( Objects_Information *information, Objects_Name the_name, unsigned32 nodes_to_search, @@ -171,6 +173,7 @@ void _Objects_MP_Is_remote ( * inactive global object control blocks. */ +EXTERN unsigned32 _Objects_MP_Maximum_global_objects; EXTERN Chain_Control _Objects_MP_Inactive_global_objects; #include <rtems/objectmp.inl> diff --git a/c/src/exec/score/include/rtems/score/priority.h b/c/src/exec/score/include/rtems/score/priority.h index 44397e7a8a..8f681c0ce1 100644 --- a/c/src/exec/score/include/rtems/score/priority.h +++ b/c/src/exec/score/include/rtems/score/priority.h @@ -2,7 +2,7 @@ * * This include file contains all thread priority manipulation routines. * This Handler provides mechanisms which can be used to - * initialize and manipulate RTEMS priorities. + * initialize and manipulate thread priorities. * * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. * On-Line Applications Research Corporation (OAR). @@ -15,8 +15,8 @@ * $Id$ */ -#ifndef __RTEMS_PRIORITY_h -#define __RTEMS_PRIORITY_h +#ifndef __PRIORITY_h +#define __PRIORITY_h #ifdef __cplusplus extern "C" { @@ -31,8 +31,8 @@ extern "C" { typedef unsigned32 Priority_Control; -#define RTEMS_MINIMUM_PRIORITY 1 /* highest thread priority */ -#define RTEMS_MAXIMUM_PRIORITY 255 /* lowest thread priority */ +#define PRIORITY_MINIMUM 0 /* highest thread priority */ +#define PRIORITY_MAXIMUM 255 /* lowest thread priority */ /* * The following record defines the information associated with @@ -62,12 +62,6 @@ EXTERN volatile Priority_Bit_map_control _Priority_Major_bit_map; EXTERN Priority_Bit_map_control _Priority_Bit_map[16] CPU_STRUCTURE_ALIGNMENT; /* - * The following constants are useful when manipulating priority. - */ - -#define RTEMS_CURRENT_PRIORITY 0 /* obtain current priority */ - -/* * The definition of the Priority_Bit_map_control type is CPU dependent. * */ @@ -185,7 +179,7 @@ STATIC INLINE boolean _Priority_Is_group_empty ( Priority_Control the_priority ); -#include <rtems/priority.inl> +#include <rtems/core/priority.inl> #ifdef __cplusplus } diff --git a/c/src/exec/score/include/rtems/score/stack.h b/c/src/exec/score/include/rtems/score/stack.h index a0fce1ef04..2a41bcf89f 100644 --- a/c/src/exec/score/include/rtems/score/stack.h +++ b/c/src/exec/score/include/rtems/score/stack.h @@ -15,8 +15,8 @@ * $Id$ */ -#ifndef __RTEMS_STACK_h -#define __RTEMS_STACK_h +#ifndef __STACK_h +#define __STACK_h #ifdef __cplusplus extern "C" { @@ -27,7 +27,7 @@ extern "C" { * thread must exceed. */ -#define RTEMS_MINIMUM_STACK_SIZE CPU_STACK_MINIMUM_SIZE +#define STACK_MINIMUM_SIZE CPU_STACK_MINIMUM_SIZE /* * The following defines the control block used to manage each stack. @@ -85,7 +85,7 @@ STATIC INLINE unsigned32 _Stack_Adjust_size ( unsigned32 size ); -#include <rtems/stack.inl> +#include <rtems/core/stack.inl> #ifdef __cplusplus } diff --git a/c/src/exec/score/include/rtems/score/states.h b/c/src/exec/score/include/rtems/score/states.h index 56f67ecc49..3f7c4a7e99 100644 --- a/c/src/exec/score/include/rtems/score/states.h +++ b/c/src/exec/score/include/rtems/score/states.h @@ -1,6 +1,6 @@ /* states.h * - * This include file contains all RTEMS state information. + * This include file contains thread execution state information. * * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. * On-Line Applications Research Corporation (OAR). @@ -43,13 +43,15 @@ typedef unsigned32 States_Control; #define STATES_WAITING_FOR_MESSAGE 0x0040 /* wait for message */ #define STATES_WAITING_FOR_EVENT 0x0080 /* wait for event */ #define STATES_WAITING_FOR_SEMAPHORE 0x0100 /* wait for semaphore */ -#define STATES_WAITING_FOR_TIME 0x0200 /* wait for specific TOD */ -#define STATES_WAITING_FOR_RPC_REPLY 0x0400 /* wait for rpc reply */ -#define STATES_WAITING_FOR_PERIOD 0x0800 /* rate monotonic delay */ +#define STATES_WAITING_FOR_MUTEX 0x0200 /* wait for mutex */ +#define STATES_WAITING_FOR_TIME 0x0400 /* wait for specific TOD */ +#define STATES_WAITING_FOR_RPC_REPLY 0x0800 /* wait for rpc reply */ +#define STATES_WAITING_FOR_PERIOD 0x1000 /* rate monotonic delay */ #define STATES_LOCALLY_BLOCKED ( STATES_WAITING_FOR_BUFFER | \ STATES_WAITING_FOR_SEGMENT | \ STATES_WAITING_FOR_MESSAGE | \ + STATES_WAITING_FOR_MUTEX | \ STATES_WAITING_FOR_SEMAPHORE ) #define STATES_WAITING_ON_THREAD_QUEUE \ @@ -221,6 +223,19 @@ STATIC INLINE boolean _States_Is_waiting_for_event ( ); /* + * _States_Is_waiting_for_mutex + * + * DESCRIPTION: + * + * This function returns TRUE if the WAITING_FOR_MUTEX state + * is set in the_states, and FALSE otherwise. + */ + +STATIC INLINE boolean _States_Is_waiting_for_mutex ( + States_Control the_states +); + +/* * _States_Is_waiting_for_semaphore * * DESCRIPTION: @@ -327,7 +342,7 @@ STATIC INLINE boolean _States_Are_set ( States_Control mask ); -#include <rtems/states.inl> +#include <rtems/core/states.inl> #ifdef __cplusplus } diff --git a/c/src/exec/score/include/rtems/score/sysstate.h b/c/src/exec/score/include/rtems/score/sysstate.h index 511a26cefc..b0ace61f98 100644 --- a/c/src/exec/score/include/rtems/score/sysstate.h +++ b/c/src/exec/score/include/rtems/score/sysstate.h @@ -40,12 +40,31 @@ typedef enum { #define SYSTEM_STATE_CODES_LAST SYSTEM_STATE_FAILED /* + * The following variable indicates whether or not this is + * an multiprocessing system. + */ + +EXTERN boolean _System_state_Is_multiprocessing; + +/* * The following variable contains the current system state. */ EXTERN System_state_Codes _System_state_Current; /* + * _System_state_Handler_initialization + * + * DESCRIPTION: + * + * This routine initializes the system state handler. + */ + +STATIC INLINE void _System_state_Handler_initialization ( + boolean is_multiprocessing +); + +/* * _System_state_Set * * DESCRIPTION: diff --git a/c/src/exec/score/include/rtems/score/thread.h b/c/src/exec/score/include/rtems/score/thread.h index 37a5898d01..823a4e6760 100644 --- a/c/src/exec/score/include/rtems/score/thread.h +++ b/c/src/exec/score/include/rtems/score/thread.h @@ -14,77 +14,44 @@ * $Id$ */ -#ifndef __RTEMS_THREAD_h -#define __RTEMS_THREAD_h +#ifndef __THREAD_h +#define __THREAD_h #ifdef __cplusplus extern "C" { #endif -#include <rtems/asr.h> -#include <rtems/attr.h> -#include <rtems/context.h> -#include <rtems/cpu.h> -#include <rtems/eventset.h> -#include <rtems/modes.h> -#include <rtems/mppkt.h> -#include <rtems/object.h> -#include <rtems/options.h> -#include <rtems/priority.h> -#include <rtems/stack.h> -#include <rtems/states.h> -#include <rtems/tod.h> -#include <rtems/tqdata.h> -#include <rtems/watchdog.h> - -/* - * Notepads constants (indices into notepad array) - */ - -#define RTEMS_NOTEPAD_FIRST 0 /* lowest numbered notepad */ -#define RTEMS_NOTEPAD_0 0 /* notepad location 0 */ -#define RTEMS_NOTEPAD_1 1 /* notepad location 1 */ -#define RTEMS_NOTEPAD_2 2 /* notepad location 2 */ -#define RTEMS_NOTEPAD_3 3 /* notepad location 3 */ -#define RTEMS_NOTEPAD_4 4 /* notepad location 4 */ -#define RTEMS_NOTEPAD_5 5 /* notepad location 5 */ -#define RTEMS_NOTEPAD_6 6 /* notepad location 6 */ -#define RTEMS_NOTEPAD_7 7 /* notepad location 7 */ -#define RTEMS_NOTEPAD_8 8 /* notepad location 8 */ -#define RTEMS_NOTEPAD_9 9 /* notepad location 9 */ -#define RTEMS_NOTEPAD_10 10 /* notepad location 10 */ -#define RTEMS_NOTEPAD_11 11 /* notepad location 11 */ -#define RTEMS_NOTEPAD_12 12 /* notepad location 12 */ -#define RTEMS_NOTEPAD_13 13 /* notepad location 13 */ -#define RTEMS_NOTEPAD_14 14 /* notepad location 14 */ -#define RTEMS_NOTEPAD_15 15 /* notepad location 15 */ -#define RTEMS_NOTEPAD_LAST RTEMS_NOTEPAD_15 /* highest numbered notepad */ - -#define RTEMS_NUMBER_NOTEPADS (RTEMS_NOTEPAD_LAST+1) - -/* - * The following defines the "return type" of an RTEMS thread. - * - * NOTE: Keep both types for internal threads. - */ - -typedef void rtems_task; -typedef void Thread; +#include <rtems/core/context.h> +#include <rtems/core/cpu.h> +#include <rtems/core/mppkt.h> +#include <rtems/core/object.h> +#include <rtems/core/priority.h> +#include <rtems/core/stack.h> +#include <rtems/core/states.h> +#include <rtems/core/tod.h> +#include <rtems/core/tqdata.h> +#include <rtems/core/watchdog.h> /* - * The following defines the argument to an RTEMS thread. + * The following defines the "return type" of a thread. */ -typedef unsigned32 rtems_task_argument; -typedef unsigned32 Thread_Argument; +typedef void Thread; /* - * The following defines the type for the entry point of an RTEMS thread. + * The following defines the ways in which the entry point for a + * thread can be invoked. Basically, it can be passed any + * combination/permutation of a pointer and an unsigned32 value. + * + * NOTE: For now, we are ignoring the return type. */ -typedef rtems_task ( *rtems_task_entry )( - rtems_task_argument - ); +typedef enum { + THREAD_START_NUMERIC, + THREAD_START_POINTER, + THREAD_START_BOTH_POINTER_FIRST, + THREAD_START_BOTH_NUMERIC_FIRST +} Thread_Start_types; typedef Thread ( *Thread_Entry )( ); @@ -93,19 +60,15 @@ typedef Thread ( *Thread_Entry )( ); * the starting state of a thread. */ -typedef enum { - THREAD_START_NUMERIC, - THREAD_START_POINTER, - THREAD_START_BOTH_POINTER_FIRST, - THREAD_START_BOTH_NUMERIC_FIRST -} Thread_Start_types; - typedef struct { Thread_Entry entry_point; /* starting thread address */ Thread_Start_types prototype; /* how task is invoked */ void *pointer_argument; /* pointer argument */ unsigned32 numeric_argument; /* numeric argument */ - Modes_Control initial_modes; /* initial mode */ + /* initial execution modes */ + boolean is_preemptible; + boolean is_timeslice; + unsigned32 isr_level; Priority_Control initial_priority; /* initial priority */ Stack_Control Initial_stack; /* stack information */ void *fp_context; /* initial FP context area address */ @@ -117,16 +80,21 @@ typedef struct { * a thread which it is waiting for a resource. */ +#define THREAD_STATUS_PROXY_BLOCKING 0x1111111 + typedef struct { Objects_Id id; /* waiting on this object */ - rtems_option option_set; /* wait mode */ - union { - unsigned32 segment_size; /* size of segment requested */ - rtems_event_set event_condition; - unsigned32 *message_size_p; /* ptr for return size of message */ - } Extra; - void *return_argument; /* address of user return param */ - rtems_status_code return_code; /* status for thread awakened */ + unsigned32 count; /* "generic" fields to be used */ + void *return_argument; /* when blocking */ + void *return_argument_1; + unsigned32 option; + + /* + * NOTE: The following assumes that all API return codes can be + * treated as an unsigned32. + */ + unsigned32 return_code; /* status for thread awakened */ + Chain_Control Block2n; /* 2 - n priority blocked chain */ Thread_queue_Control *queue; /* pointer to thread queue */ } Thread_Wait_information; @@ -147,7 +115,7 @@ typedef struct { unsigned32 resource_count; Thread_Wait_information Wait; Watchdog_Control Timer; - rtems_packet_prefix *receive_packet; + MP_packet_Prefix *receive_packet; /****************** end of common block ********************/ Chain_Node Active; } Thread_Proxy_control; @@ -161,15 +129,12 @@ typedef struct { * memory images for the shared part. */ -/* XXX structure in wrong file .. API .. not core */ +typedef enum { + THREAD_API_RTEMS +} Thread_APIs; -typedef struct { - boolean is_global; - unsigned32 Notepads[ RTEMS_NUMBER_NOTEPADS ]; - rtems_event_set pending_events; - rtems_event_set events_out; - ASR_Information Signal; -} RTEMS_API_Control; +#define THREAD_API_FIRST THREAD_API_RTEMS +#define THREAD_API_LAST THREAD_API_RTEMS typedef struct { Objects_Control Object; @@ -179,24 +144,30 @@ typedef struct { unsigned32 resource_count; Thread_Wait_information Wait; Watchdog_Control Timer; - rtems_packet_prefix *receive_packet; + MP_packet_Prefix *receive_packet; /****************** end of common block ********************/ + boolean is_global; Chain_Control *ready; Priority_Information Priority_map; Thread_Start_information Start; - Modes_Control current_modes; + boolean is_preemptible; + boolean is_timeslice; Context_Control Registers; void *fp_context; - RTEMS_API_Control *RTEMS_API; - void *extension; + void *API_Extensions[ THREAD_API_LAST + 1 ]; + void **extensions; } Thread_Control; /* - * External API name for Thread_Control + * The following context area contains the context of the "thread" + * which invoked the start multitasking routine. This context is + * restored as the last action of the stop multitasking routine. Thus + * control of the processor can be returned to the environment + * which initiated the system. */ - -typedef Thread_Control rtems_tcb; - + +EXTERN Context_Control _Thread_BSP_context; + /* * The following declares the dispatch critical section nesting * counter which is used to prevent context switches at inopportune @@ -206,6 +177,14 @@ typedef Thread_Control rtems_tcb; EXTERN unsigned32 _Thread_Dispatch_disable_level; /* + * The following holds how many user extensions are in the system. This + * is used to determine how many user extension data areas to allocate + * per thread. + */ + +EXTERN unsigned32 _Thread_Maximum_extensions; + +/* * The following data items are used to manage timeslicing. */ @@ -228,7 +207,7 @@ EXTERN Thread_Control *_Thread_Executing; /* * The following points to the highest priority ready thread - * in the system. Unless the current thread is RTEMS_NO_PREEMPT, + * in the system. Unless the current thread is not preemptibl, * then this thread will be context switched to when the next * dispatch occurs. */ @@ -243,16 +222,6 @@ EXTERN Thread_Control *_Thread_Heir; EXTERN Thread_Control *_Thread_Allocated_fp; /* - * The following context area contains the context of the "thread" - * which invoked rtems_initialize_executive. This context is restored - * as the last action of the rtems_shutdown_executive directive. Thus - * control of the processor can be returned to the environment - * which initiated RTEMS. - */ - -EXTERN Context_Control _Thread_BSP_context; - -/* * _Thread_Handler_initialization * * DESCRIPTION: @@ -261,8 +230,9 @@ EXTERN Context_Control _Thread_BSP_context; */ void _Thread_Handler_initialization ( - unsigned32 ticks_per_timeslice, - unsigned32 maximum_proxies + unsigned32 ticks_per_timeslice, + unsigned32 maximum_extensions, + unsigned32 maximum_proxies ); /* @@ -272,7 +242,7 @@ void _Thread_Handler_initialization ( * * This routine initiates multitasking. It is invoked only as * part of initialization and its invocation is the last act of - * the rtems_initialize_executive directive. + * the non-multitasking part of the system initialization. */ void _Thread_Start_multitasking ( @@ -286,8 +256,8 @@ void _Thread_Start_multitasking ( * DESCRIPTION: * * This routine halts multitasking and returns control to - * the "thread" which initially invoked the rtems_initialize_executive - * directive. + * the "thread" (i.e. the BSP) which initially invoked the + * routine which initialized the system. */ STATIC INLINE void _Thread_Stop_multitasking( void ); @@ -333,7 +303,9 @@ boolean _Thread_Initialize( unsigned32 stack_size, /* insure it is >= min */ boolean is_fp, /* TRUE if thread uses FP */ Priority_Control priority, - Modes_Control mode, + boolean is_preemptible, + boolean is_timeslice, + unsigned32 isr_level, Objects_Name name ); @@ -452,7 +424,7 @@ void _Thread_Set_transient( * at the priority of the currently executing thread, then the * executing thread's timeslice is reset. Otherwise, the * currently executing thread is placed at the rear of the - * RTEMS_FIFO for this priority and a new heir is selected. + * FIFO for this priority and a new heir is selected. */ void _Thread_Reset_timeslice( void ); @@ -551,8 +523,7 @@ void _Thread_Handler( void ); * DESCRIPTION: * * This routine is invoked when a thread must be unblocked at the - * end of a delay such as the rtems_task_wake_after and rtems_task_wake_when - * directives. + * end of a time based delay (i.e. wake after or wake when). */ void _Thread_Delay_ended( @@ -590,23 +561,14 @@ void _Thread_Set_priority( ); /* - * _Thread_Change_mode + * _Thread_Evaluate_mode * * DESCRIPTION: * - * This routine changes the current values of the modes - * indicated by mask of the calling thread are changed to that - * indicated in mode_set. The former mode of the thread is - * returned in mode_set. If the changes in the current mode - * indicate that a thread dispatch operation may be necessary, - * then need_dispatch is TRUE, otherwise it is FALSE. + * This routine XXX */ -boolean _Thread_Change_mode( - Modes_Control new_mode_set, - Modes_Control mask, - Modes_Control *old_mode_set -); +boolean _Thread_Evaluate_mode( void ); /* * _Thread_Resume @@ -782,8 +744,21 @@ STATIC INLINE Thread_Control *_Thread_Get ( Objects_Locations *location ); -#include <rtems/thread.inl> -#include <rtems/threadmp.h> +/* + * _Thread_Is_proxy_blocking + * + * DESCRIPTION: + * + * This function returns TRUE if the status code is equal to the + * status which indicates that a proxy is blocking, and FALSE otherwise. + */ + +STATIC INLINE boolean _Thread_Is_proxy_blocking ( + unsigned32 code +); + +#include <rtems/core/thread.inl> +#include <rtems/core/threadmp.h> #ifdef __cplusplus } diff --git a/c/src/exec/score/include/rtems/score/threadmp.h b/c/src/exec/score/include/rtems/score/threadmp.h index db94a65d78..89b8e3d597 100644 --- a/c/src/exec/score/include/rtems/score/threadmp.h +++ b/c/src/exec/score/include/rtems/score/threadmp.h @@ -104,7 +104,7 @@ EXTERN Thread_Control *_Thread_MP_Receive; EXTERN Chain_Control _Thread_MP_Active_proxies; EXTERN Chain_Control _Thread_MP_Inactive_proxies; -#include <rtems/threadmp.inl> +#include <rtems/core/threadmp.inl> #ifdef __cplusplus } diff --git a/c/src/exec/score/include/rtems/score/threadq.h b/c/src/exec/score/include/rtems/score/threadq.h index 27a36ab63e..a9fb29bb57 100644 --- a/c/src/exec/score/include/rtems/score/threadq.h +++ b/c/src/exec/score/include/rtems/score/threadq.h @@ -14,18 +14,18 @@ * $Id$ */ -#ifndef __RTEMS_THREAD_QUEUE_h -#define __RTEMS_THREAD_QUEUE_h +#ifndef __THREAD_QUEUE_h +#define __THREAD_QUEUE_h #ifdef __cplusplus extern "C" { #endif -#include <rtems/tqdata.h> +#include <rtems/core/tqdata.h> -#include <rtems/object.h> -#include <rtems/thread.h> -#include <rtems/watchdog.h> +#include <rtems/core/object.h> +#include <rtems/core/thread.h> +#include <rtems/core/watchdog.h> /* * The following type defines the callout used when a remote task @@ -75,7 +75,7 @@ Thread_Control *_Thread_queue_Dequeue( void _Thread_queue_Enqueue( Thread_queue_Control *the_thread_queue, - rtems_interval timeout + Watchdog_Interval timeout ); /* @@ -131,7 +131,8 @@ Thread_Control *_Thread_queue_First( void _Thread_queue_Flush( Thread_queue_Control *the_thread_queue, - Thread_queue_Flush_callout remote_extract_callout + Thread_queue_Flush_callout remote_extract_callout, + unsigned32 status ); /* @@ -149,7 +150,8 @@ void _Thread_queue_Initialize( Objects_Classes the_class, Thread_queue_Disciplines the_discipline, States_Control state, - Thread_queue_Extract_callout proxy_extract_callout + Thread_queue_Extract_callout proxy_extract_callout, + unsigned32 timeout_status ); /* @@ -179,7 +181,7 @@ Thread_Control *_Thread_queue_Dequeue_priority( void _Thread_queue_Enqueue_priority( Thread_queue_Control *the_thread_queue, Thread_Control *the_thread, - rtems_interval timeout + Watchdog_Interval timeout ); /* @@ -231,13 +233,13 @@ Thread_Control *_Thread_queue_Dequeue_fifo( * * This routine enqueues the currently executing thread on * the_thread_queue with an optional timeout using the - * RTEMS_FIFO discipline. + * FIFO discipline. */ void _Thread_queue_Enqueue_fifo( Thread_queue_Control *the_thread_queue, Thread_Control *the_thread, - rtems_interval timeout + Watchdog_Interval timeout ); /* diff --git a/c/src/exec/score/include/rtems/score/tod.h b/c/src/exec/score/include/rtems/score/tod.h index ae7e2b9747..6c2882a3c5 100644 --- a/c/src/exec/score/include/rtems/score/tod.h +++ b/c/src/exec/score/include/rtems/score/tod.h @@ -14,15 +14,15 @@ * $Id$ */ -#ifndef __RTEMS_TIME_OF_DAY_h -#define __RTEMS_TIME_OF_DAY_h +#ifndef __TIME_OF_DAY_h +#define __TIME_OF_DAY_h #ifdef __cplusplus extern "C" { #endif -#include <rtems/object.h> -#include <rtems/watchdog.h> +#include <rtems/core/object.h> +#include <rtems/core/watchdog.h> /* * The following constants are related to the time of day. @@ -42,7 +42,7 @@ extern "C" { /* * The following constant define the earliest year to which an - * RTEMS time of day can be initialized. This is considered the + * time of day can be initialized. This is considered the * epoch. */ @@ -61,27 +61,27 @@ typedef struct { /* RTEID style time/date */ unsigned32 minute; /* minute, 0 -> 59 */ unsigned32 second; /* second, 0 -> 59 */ unsigned32 ticks; /* elapsed ticks between secs */ -} rtems_time_of_day; +} TOD_Control; /* * The following contains the current time of day. */ -EXTERN rtems_time_of_day _TOD_Current; +EXTERN TOD_Control _TOD_Current; /* * The following contains the number of seconds from 00:00:00 * January 1, TOD_BASE_YEAR until the current time of day. */ -EXTERN rtems_interval _TOD_Seconds_since_epoch; +EXTERN Watchdog_Interval _TOD_Seconds_since_epoch; /* * The following contains the number of ticks since the * system was booted. */ -EXTERN rtems_interval _TOD_Ticks_since_boot; +EXTERN Watchdog_Interval _TOD_Ticks_since_boot; /* * The following contains the number of microseconds per tick. @@ -173,8 +173,8 @@ void _TOD_Handler_initialization( */ void _TOD_Set( - rtems_time_of_day *the_tod, - rtems_interval seconds_since_epoch + TOD_Control *the_tod, + Watchdog_Interval seconds_since_epoch ); /* @@ -182,12 +182,12 @@ void _TOD_Set( * * DESCRIPTION: * - * This function returns STATUS.RTEMS_SUCCESSFUL if THE_TOD contains + * This function returns TRUE if THE_TOD contains * a valid time of day, and FALSE otherwise. */ -rtems_status_code _TOD_Validate( - rtems_time_of_day *the_tod +boolean _TOD_Validate( + TOD_Control *the_tod ); /* @@ -198,8 +198,8 @@ rtems_status_code _TOD_Validate( * This function returns the number seconds between the epoch and THE_TOD. */ -rtems_interval _TOD_To_seconds( - rtems_time_of_day *the_tod +Watchdog_Interval _TOD_To_seconds( + TOD_Control *the_tod ); /* @@ -243,7 +243,7 @@ STATIC INLINE void _TOD_Deactivate( void ); */ STATIC INLINE void _TOD_Activate( - rtems_interval ticks + Watchdog_Interval ticks ); /* @@ -262,7 +262,7 @@ void _TOD_Tickle( ); /* - * RTEMS_MILLISECONDS_TO_MICROSECONDS + * TOD_MILLISECONDS_TO_MICROSECONDS * * DESCRIPTION: * @@ -273,10 +273,10 @@ void _TOD_Tickle( * This must be a macro so it can be used in "static" tables. */ -#define RTEMS_MILLISECONDS_TO_MICROSECONDS(_ms) ((_ms) * 1000) +#define TOD_MILLISECONDS_TO_MICROSECONDS(_ms) ((_ms) * 1000) /* - * RTEMS_MILLISECONDS_TO_TICKS + * TOD_MILLISECONDS_TO_TICKS * * DESCRIPTION: * @@ -287,10 +287,10 @@ void _TOD_Tickle( * This must be a macro so it can be used in "static" tables. */ -#define RTEMS_MILLISECONDS_TO_TICKS(_ms) \ - (RTEMS_MILLISECONDS_TO_MICROSECONDS(_ms) / _TOD_Microseconds_per_tick) +#define TOD_MILLISECONDS_TO_TICKS(_ms) \ + (TOD_MILLISECONDS_TO_MICROSECONDS(_ms) / _TOD_Microseconds_per_tick) -#include <rtems/tod.inl> +#include <rtems/core/tod.inl> #ifdef __cplusplus } diff --git a/c/src/exec/score/include/rtems/score/tqdata.h b/c/src/exec/score/include/rtems/score/tqdata.h index f962f409d2..128c4183a3 100644 --- a/c/src/exec/score/include/rtems/score/tqdata.h +++ b/c/src/exec/score/include/rtems/score/tqdata.h @@ -14,16 +14,16 @@ * $Id$ */ -#ifndef __RTEMS_THREAD_QUEUE_DATA_h -#define __RTEMS_THREAD_QUEUE_DATA_h +#ifndef __THREAD_QUEUE_DATA_h +#define __THREAD_QUEUE_DATA_h #ifdef __cplusplus extern "C" { #endif -#include <rtems/chain.h> -#include <rtems/priority.h> -#include <rtems/states.h> +#include <rtems/core/chain.h> +#include <rtems/core/priority.h> +#include <rtems/core/states.h> /* * The following enumerated type details all of the disciplines @@ -31,8 +31,8 @@ extern "C" { */ typedef enum { - THREAD_QUEUE_DISCIPLINE_FIFO, /* RTEMS_FIFO queue discipline */ - THREAD_QUEUE_DISCIPLINE_PRIORITY /* RTEMS_PRIORITY queue discipline */ + THREAD_QUEUE_DISCIPLINE_FIFO, /* FIFO queue discipline */ + THREAD_QUEUE_DISCIPLINE_PRIORITY /* PRIORITY queue discipline */ } Thread_queue_Disciplines; /* @@ -51,6 +51,7 @@ typedef struct { boolean sync; /* alloc/dealloc critical section */ Thread_queue_Disciplines discipline; /* queue discipline */ States_Control state; /* state of threads on Thread_q */ + unsigned32 timeout_status; } Thread_queue_Control; /* @@ -80,7 +81,7 @@ STATIC INLINE boolean _Thread_queue_Is_reverse_search ( Priority_Control the_priority ); -#include <rtems/tqdata.inl> +#include <rtems/core/tqdata.inl> #ifdef __cplusplus } diff --git a/c/src/exec/score/include/rtems/score/userext.h b/c/src/exec/score/include/rtems/score/userext.h index 56fae9b7db..2808b3566e 100644 --- a/c/src/exec/score/include/rtems/score/userext.h +++ b/c/src/exec/score/include/rtems/score/userext.h @@ -2,7 +2,7 @@ * * This include file contains all information about user extensions. This * Handler provides mechanisms which can be used to initialize and manipulate - * all RTEMS user extensions. + * all user extensions. * * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. * On-Line Applications Research Corporation (OAR). @@ -15,23 +15,89 @@ * $Id$ */ -#ifndef __RTEMS_USER_EXTENSIONS_h -#define __RTEMS_USER_EXTENSIONS_h +#ifndef __USER_EXTENSIONS_h +#define __USER_EXTENSIONS_h #ifdef __cplusplus extern "C" { #endif -#include <rtems/config.h> -#include <rtems/thread.h> +#include <rtems/core/interr.h> +#include <rtems/core/chain.h> +#include <rtems/core/thread.h> + +/* + * The following records defines the User Extension Table. + * This table defines the application dependent routines which + * are invoked at critical points in the life of each thread and + * the system as a whole. + */ + +typedef void User_extensions_routine; + +typedef boolean ( *User_extensions_thread_create_extension )( + Thread_Control *, + Thread_Control * + ); + +typedef User_extensions_routine ( *User_extensions_thread_delete_extension )( + Thread_Control *, + Thread_Control * + ); + +typedef User_extensions_routine ( *User_extensions_thread_start_extension )( + Thread_Control *, + Thread_Control * + ); + +typedef User_extensions_routine ( *User_extensions_thread_restart_extension )( + Thread_Control *, + Thread_Control * + ); + +typedef User_extensions_routine ( *User_extensions_thread_switch_extension )( + Thread_Control *, + Thread_Control * + ); + +typedef User_extensions_routine (*User_extensions_thread_post_switch_extension)( + Thread_Control * + ); + +typedef User_extensions_routine ( *User_extensions_thread_begin_extension )( + Thread_Control * + ); + +typedef User_extensions_routine ( *User_extensions_thread_exitted_extension )( + Thread_Control * + ); + +typedef User_extensions_routine ( *User_extensions_fatal_extension )( + Internal_errors_Source /* the_source */, + boolean /* is_internal */, + unsigned32 /* the_error */ + ); + + +typedef struct { + User_extensions_thread_create_extension thread_create; + User_extensions_thread_start_extension thread_start; + User_extensions_thread_restart_extension thread_restart; + User_extensions_thread_delete_extension thread_delete; + User_extensions_thread_switch_extension thread_switch; + User_extensions_thread_post_switch_extension thread_post_switch; + User_extensions_thread_begin_extension thread_begin; + User_extensions_thread_exitted_extension thread_exitted; + User_extensions_fatal_extension fatal; +} User_extensions_Table; /* * The following is used to manage each user extension set. */ typedef struct { - Chain_Node Node; - rtems_extensions_table Callouts; + Chain_Node Node; + User_extensions_Table Callouts; } User_extensions_Control; /* @@ -57,7 +123,7 @@ EXTERN Chain_Control _User_extensions_List; */ STATIC INLINE void _User_extensions_Handler_initialization ( - rtems_extensions_table *initial_extensions + User_extensions_Table *initial_extensions ); /* @@ -70,7 +136,19 @@ STATIC INLINE void _User_extensions_Handler_initialization ( STATIC INLINE void _User_extensions_Add_set ( User_extensions_Control *the_extension, - rtems_extensions_table *extension_table + User_extensions_Table *extension_table +); + +/* + * _User_extensions_Add_API_set + * + * DESCRIPTION: + * + * This routine is used to add an API extension set to the active list. + */ + +STATIC INLINE void _User_extensions_Add_API_set ( + User_extensions_Control *the_extension ); /* @@ -86,59 +164,59 @@ STATIC INLINE void _User_extensions_Remove_set ( ); /* - * _User_extensions_Task_create + * _User_extensions_Thread_create * * DESCRIPTION: * * This routine is used to invoke the user extension for - * the rtems_task_create directive. + * the thread creation operate. */ -STATIC INLINE void _User_extensions_Task_create ( +boolean _User_extensions_Thread_create ( Thread_Control *the_thread ); /* - * _User_extensions_Task_delete + * _User_extensions_Thread_delete * * DESCRIPTION: * * This routine is used to invoke the user extension for - * the rtems_task_delete directive. + * the thread deletion operation. */ -STATIC INLINE void _User_extensions_Task_delete ( +void _User_extensions_Thread_delete ( Thread_Control *the_thread ); /* - * _User_extensions_Task_start + * _User_extensions_Thread_start * * DESCRIPTION: * * This routine is used to invoke the user extension for - * the rtems_task_start directive. + * the thread start operation. */ -STATIC INLINE void _User_extensions_Task_start ( +void _User_extensions_Thread_start ( Thread_Control *the_thread ); /* - * _User_extensions_Task_restart + * _User_extensions_Thread_restart * * DESCRIPTION: * * This routine is used to invoke the user extension for - * the rtems_task_restart directive. + * the thread restart operation. */ -STATIC INLINE void _User_extensions_Task_restart ( +void _User_extensions_Thread_restart ( Thread_Control *the_thread ); /* - * _User_extensions_Task_switch + * _User_extensions_Thread_switch * * DESCRIPTION: * @@ -146,47 +224,49 @@ STATIC INLINE void _User_extensions_Task_restart ( * is invoked when a context switch occurs. */ -STATIC INLINE void _User_extensions_Task_switch ( +STATIC INLINE void _User_extensions_Thread_switch ( Thread_Control *executing, Thread_Control *heir ); /* - * _User_extensions_Task_begin + * _User_extensions_Thread_post_switch * * DESCRIPTION: * - * This routine is used to invoke the user extension which - * is invoked when a task begins. + * This routine is used to invoke the user extension which is invoked + * after a context switch occurs (i.e. we are running in the context + * of the new thread). */ - -STATIC INLINE void _User_extensions_Task_begin ( + +STATIC INLINE void _User_extensions_Thread_post_switch ( Thread_Control *executing ); + /* - * _User_extensions_Task_exitted + * _User_extensions_Thread_begin * * DESCRIPTION: * * This routine is used to invoke the user extension which - * is invoked when a task exits. + * is invoked when a thread begins. */ -STATIC INLINE void _User_extensions_Task_exitted ( +void _User_extensions_Thread_begin ( Thread_Control *executing ); /* - * _User_extensions_Task_exitted + * _User_extensions_Thread_exitted * * DESCRIPTION: * * This routine is used to invoke the user extension which - * is invoked when a task exits. + * is invoked when a thread exits. */ -STATIC INLINE void _User_extensions_Task_exitted ( +void _User_extensions_Thread_exitted ( Thread_Control *executing ); @@ -195,15 +275,17 @@ STATIC INLINE void _User_extensions_Task_exitted ( * * DESCRIPTION: * - * This routine is used to invoke the user extension for - * the rtems_fatal_error_occurred directive. + * This routine is used to invoke the user extension invoked + * when a fatal error occurs. */ -STATIC INLINE void _User_extensions_Fatal ( - unsigned32 the_error +void _User_extensions_Fatal ( + Internal_errors_Source the_source, + boolean is_internal, + unsigned32 the_error ); -#include <rtems/userext.inl> +#include <rtems/core/userext.inl> #ifdef __cplusplus } diff --git a/c/src/exec/score/include/rtems/score/watchdog.h b/c/src/exec/score/include/rtems/score/watchdog.h index 70de7018dd..7e871c8881 100644 --- a/c/src/exec/score/include/rtems/score/watchdog.h +++ b/c/src/exec/score/include/rtems/score/watchdog.h @@ -15,29 +15,29 @@ * $Id$ */ -#ifndef __RTEMS_WATCHDOG_h -#define __RTEMS_WATCHDOG_h +#ifndef __WATCHDOG_h +#define __WATCHDOG_h #ifdef __cplusplus extern "C" { #endif -#include <rtems/object.h> +#include <rtems/core/object.h> /* * The following type defines the control block used to manage * intervals. */ -typedef unsigned32 rtems_interval; +typedef unsigned32 Watchdog_Interval; /* - * The following types define a pointer to a watchdog/timer service routine. + * The following types define a pointer to a watchdog service routine. */ -typedef void rtems_timer_service_routine; +typedef void Watchdog_Service_routine; -typedef rtems_timer_service_routine ( *rtems_timer_service_routine_entry )( +typedef Watchdog_Service_routine ( *Watchdog_Service_routine_entry )( Objects_Id, void * ); @@ -46,7 +46,7 @@ typedef rtems_timer_service_routine ( *rtems_timer_service_routine_entry )( * Constant for indefinite wait. (actually an illegal interval) */ -#define RTEMS_NO_TIMEOUT 0 +#define WATCHDOG_NO_TIMEOUT 0 /* * The following enumerated type details the modes in which the @@ -92,9 +92,9 @@ typedef enum { typedef struct { Chain_Node Node; Watchdog_States state; - rtems_interval initial; - rtems_interval delta_interval; - rtems_timer_service_routine_entry routine; + Watchdog_Interval initial; + Watchdog_Interval delta_interval; + Watchdog_Service_routine_entry routine; Objects_Id id; void *user_data; } Watchdog_Control; @@ -140,7 +140,7 @@ void _Watchdog_Handler_initialization( void ); STATIC INLINE void _Watchdog_Initialize( Watchdog_Control *the_watchdog, - rtems_timer_service_routine_entry routine, + Watchdog_Service_routine_entry routine, Objects_Id id, void *user_data ); @@ -238,7 +238,7 @@ STATIC INLINE void _Watchdog_Tickle_seconds( void ); STATIC INLINE void _Watchdog_Insert_ticks( Watchdog_Control *the_watchdog, - rtems_interval units, + Watchdog_Interval units, Watchdog_Insert_modes insert_mode ); @@ -256,7 +256,7 @@ STATIC INLINE void _Watchdog_Insert_ticks( STATIC INLINE void _Watchdog_Insert_seconds( Watchdog_Control *the_watchdog, - rtems_interval units, + Watchdog_Interval units, Watchdog_Insert_modes insert_mode ); @@ -273,7 +273,7 @@ STATIC INLINE void _Watchdog_Insert_seconds( STATIC INLINE void _Watchdog_Adjust_seconds( Watchdog_Adjust_directions direction, - rtems_interval units + Watchdog_Interval units ); /* @@ -288,7 +288,7 @@ STATIC INLINE void _Watchdog_Adjust_seconds( STATIC INLINE void _Watchdog_Adjust_ticks( Watchdog_Adjust_directions direction, - rtems_interval units + Watchdog_Interval units ); /* @@ -374,7 +374,7 @@ STATIC INLINE Watchdog_Control *_Watchdog_Last( void _Watchdog_Adjust ( Chain_Control *header, Watchdog_Adjust_directions direction, - rtems_interval units + Watchdog_Interval units ); /* @@ -408,7 +408,7 @@ void _Watchdog_Tickle ( Chain_Control *header ); -#include <rtems/watchdog.inl> +#include <rtems/core/watchdog.inl> #ifdef __cplusplus } diff --git a/c/src/exec/score/include/rtems/score/wkspace.h b/c/src/exec/score/include/rtems/score/wkspace.h index 7050be6953..a262761d68 100644 --- a/c/src/exec/score/include/rtems/score/wkspace.h +++ b/c/src/exec/score/include/rtems/score/wkspace.h @@ -1,8 +1,8 @@ /* wkspace.h * - * This include file contains information related to the RTEMS + * This include file contains information related to the * RAM Workspace. This Handler provides mechanisms which can be used to - * define, initialize and manipulate the RTEMS workspace. + * define, initialize and manipulate the workspace. * * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. * On-Line Applications Research Corporation (OAR). @@ -15,19 +15,18 @@ * $Id$ */ -#ifndef __RTEMS_WORKSPACE_h -#define __RTEMS_WORKSPACE_h +#ifndef __WORKSPACE_h +#define __WORKSPACE_h #ifdef __cplusplus extern "C" { #endif -#include <rtems/heap.h> -#include <rtems/fatal.h> -#include <rtems/status.h> +#include <rtems/core/heap.h> +#include <rtems/core/interr.h> /* - * The following is used to manage the RTEMS Workspace. + * The following is used to manage the Workspace. * */ @@ -67,8 +66,7 @@ STATIC INLINE void *_Workspace_Allocate( * * This routine returns the address of a block of memory of size * bytes. If a block of the appropriate size cannot be allocated - * from the workspace, then the rtems_fatal_error_occurred directive - * is invoked. + * from the workspace, then the internal error handler is invoked. */ void *_Workspace_Allocate_or_fatal_error( @@ -89,7 +87,7 @@ STATIC INLINE boolean _Workspace_Free( void *block ); -#include <rtems/wkspace.inl> +#include <rtems/core/wkspace.inl> #ifdef __cplusplus } diff --git a/c/src/exec/score/include/rtems/system.h b/c/src/exec/score/include/rtems/system.h index 5f627c1a7c..037fe93e66 100644 --- a/c/src/exec/score/include/rtems/system.h +++ b/c/src/exec/score/include/rtems/system.h @@ -76,9 +76,7 @@ extern "C" { typedef void * proc_ptr; -#include <rtems/cpu.h> /* processor specific information */ -#include <rtems/status.h> /* RTEMS status codes */ -#include <rtems/directives.h> +#include <rtems/core/cpu.h> /* processor specific information */ /* * Define NULL @@ -116,12 +114,6 @@ extern const char _RTEMS_version[]; /* RTEMS version string */ extern const char _Copyright_Notice[]; /* RTEMS copyright string */ /* - * The jump table of entry points into RTEMS directives. - */ - -extern const void * _Entry_points[ RTEMS_NUMBER_OF_ENTRY_POINTS ]; - -/* * The following defines the CPU dependent information table. */ diff --git a/c/src/exec/score/inline/address.inl b/c/src/exec/score/inline/address.inl index f9189e625e..dd2a789b1e 100644 --- a/c/src/exec/score/inline/address.inl +++ b/c/src/exec/score/inline/address.inl @@ -28,7 +28,7 @@ STATIC INLINE void *_Addresses_Add_offset ( unsigned32 offset ) { - return (base + offset); + return (void *)((char *)base + offset); } /*PAGE @@ -42,23 +42,7 @@ STATIC INLINE void *_Addresses_Subtract_offset ( unsigned32 offset ) { - return (base - offset); -} - -/*PAGE - * - * _Addresses_Add - * - * NOTE: The cast of an address to an unsigned32 makes this code - * dependent on an addresses being thirty two bits. - */ - -STATIC INLINE void *_Addresses_Add ( - void *left, - void *right -) -{ - return (left + (unsigned32)right); + return (void *)((char *)base - offset); } /*PAGE diff --git a/c/src/exec/score/inline/coremutex.inl b/c/src/exec/score/inline/coremutex.inl new file mode 100644 index 0000000000..8681795085 --- /dev/null +++ b/c/src/exec/score/inline/coremutex.inl @@ -0,0 +1,104 @@ +/* inline/coremutex.inl + * + * This include file contains all of the inlined routines associated + * with the CORE mutexes. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#ifndef __INLINE_CORE_MUTEX_inl +#define __INLINE_CORE_MUTEX_inl + +/*PAGE + * + * _CORE_mutex_Is_locked + * + */ + +STATIC INLINE boolean _CORE_mutex_Is_locked( + CORE_mutex_Control *the_mutex +) +{ + return the_mutex->lock == CORE_MUTEX_LOCKED; +} + +/*PAGE + * + * _CORE_mutex_Is_fifo + * + */ + +STATIC INLINE boolean _CORE_mutex_Is_fifo( + CORE_mutex_Attributes *the_attribute +) +{ + return the_attribute->discipline == CORE_MUTEX_DISCIPLINES_FIFO; +} + +/*PAGE + * + * _CORE_mutex_Is_priority + * + */ + +STATIC INLINE boolean _CORE_mutex_Is_priority( + CORE_mutex_Attributes *the_attribute +) +{ + return the_attribute->discipline == CORE_MUTEX_DISCIPLINES_PRIORITY; +} + +/*PAGE + * + * _CORE_mutex_Is_inherit_priority + * + */ + +STATIC INLINE boolean _CORE_mutex_Is_inherit_priority( + CORE_mutex_Attributes *the_attribute +) +{ + return the_attribute->discipline == CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT; +} + +/*PAGE + * + * _CORE_mutex_Is_priority_ceiling + * + */ + +STATIC INLINE boolean _CORE_mutex_Is_priority_ceiling( + CORE_mutex_Attributes *the_attribute +) +{ + return the_attribute->discipline == CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING; +} + +/*PAGE + * + * _CORE_mutex_Is_nesting_allowed + * + * DESCRIPTION: + * + * This routine returns TRUE if the mutex allows a task to obtain a + * semaphore more than once and nest. + */ + +STATIC INLINE boolean _CORE_mutex_Is_nesting_allowed( + CORE_mutex_Attributes *the_attribute +) +{ + return the_attribute->allow_nesting == TRUE; + +} + +#endif +/* end of include file */ diff --git a/c/src/exec/score/inline/coresem.inl b/c/src/exec/score/inline/coresem.inl new file mode 100644 index 0000000000..53f7d68595 --- /dev/null +++ b/c/src/exec/score/inline/coresem.inl @@ -0,0 +1,47 @@ +/* inline/coresem.inl + * + * This include file contains all of the inlined routines associated + * with the CORE semaphore. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#ifndef __INLINE_CORE_SEMAPHORE_inl +#define __INLINE_CORE_SEMAPHORE_inl + +/*PAGE + * + * _CORE_semaphore_Is_priority + * + */ + +STATIC INLINE boolean _CORE_semaphore_Is_priority( + CORE_semaphore_Attributes *the_attribute +) +{ + return ( the_attribute->discipline == CORE_SEMAPHORE_DISCIPLINES_PRIORITY ); +} + +/*PAGE + * + * _CORE_semaphore_Get_count + * + */ + +STATIC INLINE unsigned32 _CORE_semaphore_Get_count( + CORE_semaphore_Control *the_semaphore +) +{ + return the_semaphore->count; +} + +#endif +/* end of include file */ diff --git a/c/src/exec/score/inline/heap.inl b/c/src/exec/score/inline/heap.inl index 58be9b02af..c28f1a6067 100644 --- a/c/src/exec/score/inline/heap.inl +++ b/c/src/exec/score/inline/heap.inl @@ -17,7 +17,7 @@ #ifndef __HEAP_inl #define __HEAP_inl -#include <rtems/address.h> +#include <rtems/core/address.h> /*PAGE * diff --git a/c/src/exec/score/inline/isr.inl b/c/src/exec/score/inline/isr.inl index f44880c3b6..222fcadb17 100644 --- a/c/src/exec/score/inline/isr.inl +++ b/c/src/exec/score/inline/isr.inl @@ -19,18 +19,6 @@ /*PAGE * - * _ISR_Handler_initialization - * - */ - -STATIC INLINE void _ISR_Handler_initialization ( void ) -{ - _ISR_Signals_to_thread_executing = FALSE; - _ISR_Nest_level = 0; -} - -/*PAGE - * * _ISR_Is_in_progress * */ diff --git a/c/src/exec/score/inline/mppkt.inl b/c/src/exec/score/inline/mppkt.inl index 22ec30a28c..c23d756ec9 100644 --- a/c/src/exec/score/inline/mppkt.inl +++ b/c/src/exec/score/inline/mppkt.inl @@ -26,7 +26,7 @@ */ STATIC INLINE boolean _Mp_packet_Is_valid_packet_class ( - rtems_mp_packet_classes the_packet_class + MP_packet_Classes the_packet_class ) { return ( the_packet_class <= MP_PACKET_CLASSES_LAST ); @@ -39,7 +39,7 @@ STATIC INLINE boolean _Mp_packet_Is_valid_packet_class ( */ STATIC INLINE boolean _Mp_packet_Is_null ( - rtems_packet_prefix *the_packet + MP_packet_Prefix *the_packet ) { return the_packet == NULL; diff --git a/c/src/exec/score/inline/object.inl b/c/src/exec/score/inline/object.inl index b6ae73a351..eb07a24890 100644 --- a/c/src/exec/score/inline/object.inl +++ b/c/src/exec/score/inline/object.inl @@ -36,10 +36,10 @@ STATIC INLINE Objects_Id _Objects_Build_id( /*PAGE * - * rtems_get_class + * _Objects_Get_class */ -STATIC INLINE Objects_Classes rtems_get_class( +STATIC INLINE Objects_Classes _Objects_Get_class( Objects_Id id ) { @@ -50,11 +50,11 @@ STATIC INLINE Objects_Classes rtems_get_class( /*PAGE * - * rtems_get_node + * _Objects_Get_node * */ -STATIC INLINE unsigned32 rtems_get_node( +STATIC INLINE unsigned32 _Objects_Get_node( Objects_Id id ) { @@ -63,11 +63,11 @@ STATIC INLINE unsigned32 rtems_get_node( /*PAGE * - * rtems_get_index + * _Objects_Get_index * */ -STATIC INLINE unsigned32 rtems_get_index( +STATIC INLINE unsigned32 _Objects_Get_index( Objects_Id id ) { @@ -110,7 +110,7 @@ STATIC INLINE boolean _Objects_Is_local_id( Objects_Id id ) { - return _Objects_Is_local_node( rtems_get_node(id) ); + return _Objects_Is_local_node( _Objects_Get_node(id) ); } /*PAGE @@ -168,7 +168,7 @@ STATIC INLINE void _Objects_Open( { unsigned32 index; - index = rtems_get_index( the_object->id ); + index = _Objects_Get_index( the_object->id ); information->local_table[ index ] = the_object; if ( information->is_string ) @@ -190,7 +190,7 @@ STATIC INLINE void _Objects_Close( { unsigned32 index; - index = rtems_get_index( the_object->id ); + index = _Objects_Get_index( the_object->id ); information->local_table[ index ] = NULL; _Objects_Clear_name( the_object->name, information->name_length ); } diff --git a/c/src/exec/score/inline/priority.inl b/c/src/exec/score/inline/priority.inl index b2bc8535ff..0ecd3c64a4 100644 --- a/c/src/exec/score/inline/priority.inl +++ b/c/src/exec/score/inline/priority.inl @@ -17,7 +17,7 @@ #ifndef __PRIORITY_inl #define __PRIORITY_inl -#include <rtems/bitfield.h> +#include <rtems/core/bitfield.h> /*PAGE * @@ -44,8 +44,12 @@ STATIC INLINE boolean _Priority_Is_valid ( Priority_Control the_priority ) { - return ( ( the_priority >= RTEMS_MINIMUM_PRIORITY ) && - ( the_priority <= RTEMS_MAXIMUM_PRIORITY ) ); + /* + * Since PRIORITY_MINIMUM is 0 and priorities are stored unsigned, + * then checking for less than 0 is unnecessary. + */ + + return ( the_priority <= PRIORITY_MAXIMUM ); } /*PAGE diff --git a/c/src/exec/score/inline/rtems/score/address.inl b/c/src/exec/score/inline/rtems/score/address.inl index f9189e625e..dd2a789b1e 100644 --- a/c/src/exec/score/inline/rtems/score/address.inl +++ b/c/src/exec/score/inline/rtems/score/address.inl @@ -28,7 +28,7 @@ STATIC INLINE void *_Addresses_Add_offset ( unsigned32 offset ) { - return (base + offset); + return (void *)((char *)base + offset); } /*PAGE @@ -42,23 +42,7 @@ STATIC INLINE void *_Addresses_Subtract_offset ( unsigned32 offset ) { - return (base - offset); -} - -/*PAGE - * - * _Addresses_Add - * - * NOTE: The cast of an address to an unsigned32 makes this code - * dependent on an addresses being thirty two bits. - */ - -STATIC INLINE void *_Addresses_Add ( - void *left, - void *right -) -{ - return (left + (unsigned32)right); + return (void *)((char *)base - offset); } /*PAGE diff --git a/c/src/exec/score/inline/rtems/score/coremutex.inl b/c/src/exec/score/inline/rtems/score/coremutex.inl new file mode 100644 index 0000000000..8681795085 --- /dev/null +++ b/c/src/exec/score/inline/rtems/score/coremutex.inl @@ -0,0 +1,104 @@ +/* inline/coremutex.inl + * + * This include file contains all of the inlined routines associated + * with the CORE mutexes. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#ifndef __INLINE_CORE_MUTEX_inl +#define __INLINE_CORE_MUTEX_inl + +/*PAGE + * + * _CORE_mutex_Is_locked + * + */ + +STATIC INLINE boolean _CORE_mutex_Is_locked( + CORE_mutex_Control *the_mutex +) +{ + return the_mutex->lock == CORE_MUTEX_LOCKED; +} + +/*PAGE + * + * _CORE_mutex_Is_fifo + * + */ + +STATIC INLINE boolean _CORE_mutex_Is_fifo( + CORE_mutex_Attributes *the_attribute +) +{ + return the_attribute->discipline == CORE_MUTEX_DISCIPLINES_FIFO; +} + +/*PAGE + * + * _CORE_mutex_Is_priority + * + */ + +STATIC INLINE boolean _CORE_mutex_Is_priority( + CORE_mutex_Attributes *the_attribute +) +{ + return the_attribute->discipline == CORE_MUTEX_DISCIPLINES_PRIORITY; +} + +/*PAGE + * + * _CORE_mutex_Is_inherit_priority + * + */ + +STATIC INLINE boolean _CORE_mutex_Is_inherit_priority( + CORE_mutex_Attributes *the_attribute +) +{ + return the_attribute->discipline == CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT; +} + +/*PAGE + * + * _CORE_mutex_Is_priority_ceiling + * + */ + +STATIC INLINE boolean _CORE_mutex_Is_priority_ceiling( + CORE_mutex_Attributes *the_attribute +) +{ + return the_attribute->discipline == CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING; +} + +/*PAGE + * + * _CORE_mutex_Is_nesting_allowed + * + * DESCRIPTION: + * + * This routine returns TRUE if the mutex allows a task to obtain a + * semaphore more than once and nest. + */ + +STATIC INLINE boolean _CORE_mutex_Is_nesting_allowed( + CORE_mutex_Attributes *the_attribute +) +{ + return the_attribute->allow_nesting == TRUE; + +} + +#endif +/* end of include file */ diff --git a/c/src/exec/score/inline/rtems/score/coresem.inl b/c/src/exec/score/inline/rtems/score/coresem.inl new file mode 100644 index 0000000000..53f7d68595 --- /dev/null +++ b/c/src/exec/score/inline/rtems/score/coresem.inl @@ -0,0 +1,47 @@ +/* inline/coresem.inl + * + * This include file contains all of the inlined routines associated + * with the CORE semaphore. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#ifndef __INLINE_CORE_SEMAPHORE_inl +#define __INLINE_CORE_SEMAPHORE_inl + +/*PAGE + * + * _CORE_semaphore_Is_priority + * + */ + +STATIC INLINE boolean _CORE_semaphore_Is_priority( + CORE_semaphore_Attributes *the_attribute +) +{ + return ( the_attribute->discipline == CORE_SEMAPHORE_DISCIPLINES_PRIORITY ); +} + +/*PAGE + * + * _CORE_semaphore_Get_count + * + */ + +STATIC INLINE unsigned32 _CORE_semaphore_Get_count( + CORE_semaphore_Control *the_semaphore +) +{ + return the_semaphore->count; +} + +#endif +/* end of include file */ diff --git a/c/src/exec/score/inline/rtems/score/heap.inl b/c/src/exec/score/inline/rtems/score/heap.inl index 58be9b02af..c28f1a6067 100644 --- a/c/src/exec/score/inline/rtems/score/heap.inl +++ b/c/src/exec/score/inline/rtems/score/heap.inl @@ -17,7 +17,7 @@ #ifndef __HEAP_inl #define __HEAP_inl -#include <rtems/address.h> +#include <rtems/core/address.h> /*PAGE * diff --git a/c/src/exec/score/inline/rtems/score/isr.inl b/c/src/exec/score/inline/rtems/score/isr.inl index f44880c3b6..222fcadb17 100644 --- a/c/src/exec/score/inline/rtems/score/isr.inl +++ b/c/src/exec/score/inline/rtems/score/isr.inl @@ -19,18 +19,6 @@ /*PAGE * - * _ISR_Handler_initialization - * - */ - -STATIC INLINE void _ISR_Handler_initialization ( void ) -{ - _ISR_Signals_to_thread_executing = FALSE; - _ISR_Nest_level = 0; -} - -/*PAGE - * * _ISR_Is_in_progress * */ diff --git a/c/src/exec/score/inline/rtems/score/mppkt.inl b/c/src/exec/score/inline/rtems/score/mppkt.inl index 22ec30a28c..c23d756ec9 100644 --- a/c/src/exec/score/inline/rtems/score/mppkt.inl +++ b/c/src/exec/score/inline/rtems/score/mppkt.inl @@ -26,7 +26,7 @@ */ STATIC INLINE boolean _Mp_packet_Is_valid_packet_class ( - rtems_mp_packet_classes the_packet_class + MP_packet_Classes the_packet_class ) { return ( the_packet_class <= MP_PACKET_CLASSES_LAST ); @@ -39,7 +39,7 @@ STATIC INLINE boolean _Mp_packet_Is_valid_packet_class ( */ STATIC INLINE boolean _Mp_packet_Is_null ( - rtems_packet_prefix *the_packet + MP_packet_Prefix *the_packet ) { return the_packet == NULL; diff --git a/c/src/exec/score/inline/rtems/score/object.inl b/c/src/exec/score/inline/rtems/score/object.inl index b6ae73a351..eb07a24890 100644 --- a/c/src/exec/score/inline/rtems/score/object.inl +++ b/c/src/exec/score/inline/rtems/score/object.inl @@ -36,10 +36,10 @@ STATIC INLINE Objects_Id _Objects_Build_id( /*PAGE * - * rtems_get_class + * _Objects_Get_class */ -STATIC INLINE Objects_Classes rtems_get_class( +STATIC INLINE Objects_Classes _Objects_Get_class( Objects_Id id ) { @@ -50,11 +50,11 @@ STATIC INLINE Objects_Classes rtems_get_class( /*PAGE * - * rtems_get_node + * _Objects_Get_node * */ -STATIC INLINE unsigned32 rtems_get_node( +STATIC INLINE unsigned32 _Objects_Get_node( Objects_Id id ) { @@ -63,11 +63,11 @@ STATIC INLINE unsigned32 rtems_get_node( /*PAGE * - * rtems_get_index + * _Objects_Get_index * */ -STATIC INLINE unsigned32 rtems_get_index( +STATIC INLINE unsigned32 _Objects_Get_index( Objects_Id id ) { @@ -110,7 +110,7 @@ STATIC INLINE boolean _Objects_Is_local_id( Objects_Id id ) { - return _Objects_Is_local_node( rtems_get_node(id) ); + return _Objects_Is_local_node( _Objects_Get_node(id) ); } /*PAGE @@ -168,7 +168,7 @@ STATIC INLINE void _Objects_Open( { unsigned32 index; - index = rtems_get_index( the_object->id ); + index = _Objects_Get_index( the_object->id ); information->local_table[ index ] = the_object; if ( information->is_string ) @@ -190,7 +190,7 @@ STATIC INLINE void _Objects_Close( { unsigned32 index; - index = rtems_get_index( the_object->id ); + index = _Objects_Get_index( the_object->id ); information->local_table[ index ] = NULL; _Objects_Clear_name( the_object->name, information->name_length ); } diff --git a/c/src/exec/score/inline/rtems/score/priority.inl b/c/src/exec/score/inline/rtems/score/priority.inl index b2bc8535ff..0ecd3c64a4 100644 --- a/c/src/exec/score/inline/rtems/score/priority.inl +++ b/c/src/exec/score/inline/rtems/score/priority.inl @@ -17,7 +17,7 @@ #ifndef __PRIORITY_inl #define __PRIORITY_inl -#include <rtems/bitfield.h> +#include <rtems/core/bitfield.h> /*PAGE * @@ -44,8 +44,12 @@ STATIC INLINE boolean _Priority_Is_valid ( Priority_Control the_priority ) { - return ( ( the_priority >= RTEMS_MINIMUM_PRIORITY ) && - ( the_priority <= RTEMS_MAXIMUM_PRIORITY ) ); + /* + * Since PRIORITY_MINIMUM is 0 and priorities are stored unsigned, + * then checking for less than 0 is unnecessary. + */ + + return ( the_priority <= PRIORITY_MAXIMUM ); } /*PAGE diff --git a/c/src/exec/score/inline/rtems/score/stack.inl b/c/src/exec/score/inline/rtems/score/stack.inl index 24a6d9d873..7c6acf7cb3 100644 --- a/c/src/exec/score/inline/rtems/score/stack.inl +++ b/c/src/exec/score/inline/rtems/score/stack.inl @@ -43,7 +43,7 @@ STATIC INLINE boolean _Stack_Is_enough ( unsigned32 size ) { - return ( size >= RTEMS_MINIMUM_STACK_SIZE ); + return ( size >= STACK_MINIMUM_SIZE ); } /*PAGE diff --git a/c/src/exec/score/inline/rtems/score/states.inl b/c/src/exec/score/inline/rtems/score/states.inl index 316f40e4eb..23ee8cacbc 100644 --- a/c/src/exec/score/inline/rtems/score/states.inl +++ b/c/src/exec/score/inline/rtems/score/states.inl @@ -1,7 +1,7 @@ /* states.inl * * This file contains the macro implementation of the inlined - * routines associated with RTEMS state information. + * routines associated with thread state information. * * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. * On-Line Applications Research Corporation (OAR). @@ -177,6 +177,19 @@ STATIC INLINE boolean _States_Is_waiting_for_event ( /*PAGE * + * _States_Is_waiting_for_mutex + * + */ + +STATIC INLINE boolean _States_Is_waiting_for_mutex ( + States_Control the_states +) +{ + return (the_states & STATES_WAITING_FOR_MUTEX); +} + +/*PAGE + * * _States_Is_waiting_for_semaphore * */ diff --git a/c/src/exec/score/inline/rtems/score/sysstate.inl b/c/src/exec/score/inline/rtems/score/sysstate.inl index 14d838cb14..180e6abe54 100644 --- a/c/src/exec/score/inline/rtems/score/sysstate.inl +++ b/c/src/exec/score/inline/rtems/score/sysstate.inl @@ -19,6 +19,19 @@ /*PAGE * + * _System_state_Handler_initialization + */ + +STATIC INLINE void _System_state_Handler_initialization ( + boolean is_multiprocessing +) +{ + _System_state_Current = SYSTEM_STATE_BEFORE_INITIALIZATION; + _System_state_Is_multiprocessing = is_multiprocessing; +} + +/*PAGE + * * _System_state_Set */ diff --git a/c/src/exec/score/inline/rtems/score/thread.inl b/c/src/exec/score/inline/rtems/score/thread.inl index 2a1049f241..e326410112 100644 --- a/c/src/exec/score/inline/rtems/score/thread.inl +++ b/c/src/exec/score/inline/rtems/score/thread.inl @@ -248,7 +248,7 @@ STATIC INLINE Thread_Control *_Thread_Get ( return( _Thread_Executing ); } - the_class = rtems_get_class( id ); + the_class = _Objects_Get_class( id ); if ( the_class > OBJECTS_CLASSES_LAST ) { *location = OBJECTS_ERROR; @@ -265,5 +265,17 @@ STATIC INLINE Thread_Control *_Thread_Get ( return (Thread_Control *) _Objects_Get( information, id, location ); } +/* + * _Thread_Is_proxy_blocking + * + */ + +STATIC INLINE boolean _Thread_Is_proxy_blocking ( + unsigned32 code +) +{ + return (code == THREAD_STATUS_PROXY_BLOCKING); +} + #endif /* end of include file */ diff --git a/c/src/exec/score/inline/rtems/score/tod.inl b/c/src/exec/score/inline/rtems/score/tod.inl index dadcdabcda..d2e26e2f2a 100644 --- a/c/src/exec/score/inline/rtems/score/tod.inl +++ b/c/src/exec/score/inline/rtems/score/tod.inl @@ -58,7 +58,7 @@ STATIC INLINE void _TOD_Deactivate( void ) */ STATIC INLINE void _TOD_Activate( - rtems_interval ticks + Watchdog_Interval ticks ) { _Watchdog_Insert_ticks( diff --git a/c/src/exec/score/inline/rtems/score/userext.inl b/c/src/exec/score/inline/rtems/score/userext.inl index fa5a31c37b..697a7eddd0 100644 --- a/c/src/exec/score/inline/rtems/score/userext.inl +++ b/c/src/exec/score/inline/rtems/score/userext.inl @@ -24,7 +24,7 @@ */ STATIC INLINE void _User_extensions_Handler_initialization ( - rtems_extensions_table *initial_extensions + User_extensions_Table *initial_extensions ) { _Chain_Initialize_empty( &_User_extensions_List ); @@ -42,7 +42,7 @@ STATIC INLINE void _User_extensions_Handler_initialization ( STATIC INLINE void _User_extensions_Add_set ( User_extensions_Control *the_extension, - rtems_extensions_table *extension_table + User_extensions_Table *extension_table ) { the_extension->Callouts = *extension_table; @@ -52,130 +52,35 @@ STATIC INLINE void _User_extensions_Add_set ( /*PAGE * - * _User_extensions_Remove_set - */ - -STATIC INLINE void _User_extensions_Remove_set ( - User_extensions_Control *the_extension -) -{ - _Chain_Extract( &the_extension->Node ); -} - -/*PAGE - * - * _User_extensions_Task_create - * + * _User_extensions_Add_API_set */ - -STATIC INLINE void _User_extensions_Task_create ( - Thread_Control *the_thread + +STATIC INLINE void _User_extensions_Add_API_set ( + User_extensions_Control *the_extension ) { - Chain_Node *the_node; - User_extensions_Control *the_extension; - - for ( the_node = _User_extensions_List.first ; - !_Chain_Is_tail( &_User_extensions_List, the_node ) ; - the_node = the_node->next ) { - - the_extension = (User_extensions_Control *) the_node; - - if ( the_extension->Callouts.rtems_task_create != NULL ) - (*the_extension->Callouts.rtems_task_create)( - _Thread_Executing, - the_thread - ); - } + _Chain_Prepend( &_User_extensions_List, &the_extension->Node ); } - + /*PAGE * - * _User_extensions_Task_delete - */ - -STATIC INLINE void _User_extensions_Task_delete ( - Thread_Control *the_thread -) -{ - Chain_Node *the_node; - User_extensions_Control *the_extension; - - for ( the_node = _User_extensions_List.last ; - !_Chain_Is_head( &_User_extensions_List, the_node ) ; - the_node = the_node->previous ) { - - the_extension = (User_extensions_Control *) the_node; - - if ( the_extension->Callouts.rtems_task_delete != NULL ) - (*the_extension->Callouts.rtems_task_delete)( - _Thread_Executing, - the_thread - ); - } -} - -/*PAGE - * - * _User_extensions_Task_start - * - */ - -STATIC INLINE void _User_extensions_Task_start ( - Thread_Control *the_thread -) -{ - Chain_Node *the_node; - User_extensions_Control *the_extension; - - for ( the_node = _User_extensions_List.first ; - !_Chain_Is_tail( &_User_extensions_List, the_node ) ; - the_node = the_node->next ) { - - the_extension = (User_extensions_Control *) the_node; - - if ( the_extension->Callouts.rtems_task_start != NULL ) - (*the_extension->Callouts.rtems_task_start)( - _Thread_Executing, - the_thread - ); - } -} - -/*PAGE - * - * _User_extensions_Task_restart - * + * _User_extensions_Remove_set */ -STATIC INLINE void _User_extensions_Task_restart ( - Thread_Control *the_thread +STATIC INLINE void _User_extensions_Remove_set ( + User_extensions_Control *the_extension ) { - Chain_Node *the_node; - User_extensions_Control *the_extension; - - for ( the_node = _User_extensions_List.first ; - !_Chain_Is_tail( &_User_extensions_List, the_node ) ; - the_node = the_node->next ) { - - the_extension = (User_extensions_Control *) the_node; - - if ( the_extension->Callouts.rtems_task_restart != NULL ) - (*the_extension->Callouts.rtems_task_restart)( - _Thread_Executing, - the_thread - ); - } + _Chain_Extract( &the_extension->Node ); } /*PAGE * - * _User_extensions_Task_switch + * _User_extensions_Thread_switch * */ -STATIC INLINE void _User_extensions_Task_switch ( +STATIC INLINE void _User_extensions_Thread_switch ( Thread_Control *executing, Thread_Control *heir ) @@ -189,78 +94,32 @@ STATIC INLINE void _User_extensions_Task_switch ( the_extension = (User_extensions_Control *) the_node; - if ( the_extension->Callouts.task_switch != NULL ) - (*the_extension->Callouts.task_switch)( executing, heir ); + if ( the_extension->Callouts.thread_switch != NULL ) + (*the_extension->Callouts.thread_switch)( executing, heir ); } } /*PAGE * - * _User_extensions_Task_begin + * _User_extensions_Thread_post_switch * */ - -STATIC INLINE void _User_extensions_Task_begin ( + +STATIC INLINE void _User_extensions_Thread_post_switch ( Thread_Control *executing ) { Chain_Node *the_node; User_extensions_Control *the_extension; - + for ( the_node = _User_extensions_List.first ; !_Chain_Is_tail( &_User_extensions_List, the_node ) ; the_node = the_node->next ) { - - the_extension = (User_extensions_Control *) the_node; - - if ( the_extension->Callouts.task_begin != NULL ) - (*the_extension->Callouts.task_begin)( executing ); - } -} - -/*PAGE - * - * _User_extensions_Task_exitted - */ - -STATIC INLINE void _User_extensions_Task_exitted ( - Thread_Control *executing -) -{ - Chain_Node *the_node; - User_extensions_Control *the_extension; - - for ( the_node = _User_extensions_List.last ; - !_Chain_Is_head( &_User_extensions_List, the_node ) ; - the_node = the_node->previous ) { - + the_extension = (User_extensions_Control *) the_node; - - if ( the_extension->Callouts.task_exitted != NULL ) - (*the_extension->Callouts.task_exitted)( executing ); - } -} - -/*PAGE - * - * _User_extensions_Fatal - */ - -STATIC INLINE void _User_extensions_Fatal ( - unsigned32 the_error -) -{ - Chain_Node *the_node; - User_extensions_Control *the_extension; - - for ( the_node = _User_extensions_List.last ; - !_Chain_Is_head( &_User_extensions_List, the_node ) ; - the_node = the_node->previous ) { - - the_extension = (User_extensions_Control *) the_node; - - if ( the_extension->Callouts.fatal != NULL ) - (*the_extension->Callouts.fatal)( the_error ); + + if ( the_extension->Callouts.thread_post_switch != NULL ) + (*the_extension->Callouts.thread_post_switch)( executing ); } } diff --git a/c/src/exec/score/inline/rtems/score/watchdog.inl b/c/src/exec/score/inline/rtems/score/watchdog.inl index 2e7dca0381..bb7edb82ed 100644 --- a/c/src/exec/score/inline/rtems/score/watchdog.inl +++ b/c/src/exec/score/inline/rtems/score/watchdog.inl @@ -24,10 +24,10 @@ */ STATIC INLINE void _Watchdog_Initialize( - Watchdog_Control *the_watchdog, - rtems_timer_service_routine_entry routine, - Objects_Id id, - void *user_data + Watchdog_Control *the_watchdog, + Watchdog_Service_routine_entry routine, + Objects_Id id, + void *user_data ) { the_watchdog->state = WATCHDOG_INACTIVE; @@ -115,7 +115,7 @@ STATIC INLINE void _Watchdog_Tickle_seconds( void ) STATIC INLINE void _Watchdog_Insert_ticks( Watchdog_Control *the_watchdog, - rtems_interval units, + Watchdog_Interval units, Watchdog_Insert_modes insert_mode ) { @@ -134,7 +134,7 @@ STATIC INLINE void _Watchdog_Insert_ticks( STATIC INLINE void _Watchdog_Insert_seconds( Watchdog_Control *the_watchdog, - rtems_interval units, + Watchdog_Interval units, Watchdog_Insert_modes insert_mode ) { @@ -153,7 +153,7 @@ STATIC INLINE void _Watchdog_Insert_seconds( STATIC INLINE void _Watchdog_Adjust_seconds( Watchdog_Adjust_directions direction, - rtems_interval units + Watchdog_Interval units ) { @@ -169,7 +169,7 @@ STATIC INLINE void _Watchdog_Adjust_seconds( STATIC INLINE void _Watchdog_Adjust_ticks( Watchdog_Adjust_directions direction, - rtems_interval units + Watchdog_Interval units ) { diff --git a/c/src/exec/score/inline/rtems/score/wkspace.inl b/c/src/exec/score/inline/rtems/score/wkspace.inl index 39d5ad8eb8..36ed61d565 100644 --- a/c/src/exec/score/inline/rtems/score/wkspace.inl +++ b/c/src/exec/score/inline/rtems/score/wkspace.inl @@ -1,7 +1,7 @@ /* wkspace.inl * * This include file contains the bodies of the routines which contains - * information related to the RTEMS RAM Workspace. + * information related to the RAM Workspace. * * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. * On-Line Applications Research Corporation (OAR). @@ -32,9 +32,12 @@ STATIC INLINE void _Workspace_Handler_initialization( unsigned32 index; unsigned32 memory_available; - if ( (starting_address == NULL) || - !_Addresses_Is_aligned( starting_address ) ) - rtems_fatal_error_occurred( RTEMS_INVALID_ADDRESS ); + if ( !starting_address || !_Addresses_Is_aligned( starting_address ) ) + _Internal_error_Occurred( + INTERNAL_ERROR_CORE, + TRUE, + INTERNAL_ERROR_INVALID_WORKSPACE_ADDRESS + ); if ( _CPU_Table.do_zero_of_workspace ) { for( zero_out_array = (unsigned32 *) starting_address, index = 0 ; @@ -51,7 +54,11 @@ STATIC INLINE void _Workspace_Handler_initialization( ); if ( memory_available == 0 ) - rtems_fatal_error_occurred( RTEMS_UNSATISFIED ); + _Internal_error_Occurred( + INTERNAL_ERROR_CORE, + TRUE, + INTERNAL_ERROR_TOO_LITTLE_WORKSPACE + ); } /*PAGE diff --git a/c/src/exec/score/inline/stack.inl b/c/src/exec/score/inline/stack.inl index 24a6d9d873..7c6acf7cb3 100644 --- a/c/src/exec/score/inline/stack.inl +++ b/c/src/exec/score/inline/stack.inl @@ -43,7 +43,7 @@ STATIC INLINE boolean _Stack_Is_enough ( unsigned32 size ) { - return ( size >= RTEMS_MINIMUM_STACK_SIZE ); + return ( size >= STACK_MINIMUM_SIZE ); } /*PAGE diff --git a/c/src/exec/score/inline/states.inl b/c/src/exec/score/inline/states.inl index 316f40e4eb..23ee8cacbc 100644 --- a/c/src/exec/score/inline/states.inl +++ b/c/src/exec/score/inline/states.inl @@ -1,7 +1,7 @@ /* states.inl * * This file contains the macro implementation of the inlined - * routines associated with RTEMS state information. + * routines associated with thread state information. * * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. * On-Line Applications Research Corporation (OAR). @@ -177,6 +177,19 @@ STATIC INLINE boolean _States_Is_waiting_for_event ( /*PAGE * + * _States_Is_waiting_for_mutex + * + */ + +STATIC INLINE boolean _States_Is_waiting_for_mutex ( + States_Control the_states +) +{ + return (the_states & STATES_WAITING_FOR_MUTEX); +} + +/*PAGE + * * _States_Is_waiting_for_semaphore * */ diff --git a/c/src/exec/score/inline/sysstate.inl b/c/src/exec/score/inline/sysstate.inl index 14d838cb14..180e6abe54 100644 --- a/c/src/exec/score/inline/sysstate.inl +++ b/c/src/exec/score/inline/sysstate.inl @@ -19,6 +19,19 @@ /*PAGE * + * _System_state_Handler_initialization + */ + +STATIC INLINE void _System_state_Handler_initialization ( + boolean is_multiprocessing +) +{ + _System_state_Current = SYSTEM_STATE_BEFORE_INITIALIZATION; + _System_state_Is_multiprocessing = is_multiprocessing; +} + +/*PAGE + * * _System_state_Set */ diff --git a/c/src/exec/score/inline/thread.inl b/c/src/exec/score/inline/thread.inl index 2a1049f241..e326410112 100644 --- a/c/src/exec/score/inline/thread.inl +++ b/c/src/exec/score/inline/thread.inl @@ -248,7 +248,7 @@ STATIC INLINE Thread_Control *_Thread_Get ( return( _Thread_Executing ); } - the_class = rtems_get_class( id ); + the_class = _Objects_Get_class( id ); if ( the_class > OBJECTS_CLASSES_LAST ) { *location = OBJECTS_ERROR; @@ -265,5 +265,17 @@ STATIC INLINE Thread_Control *_Thread_Get ( return (Thread_Control *) _Objects_Get( information, id, location ); } +/* + * _Thread_Is_proxy_blocking + * + */ + +STATIC INLINE boolean _Thread_Is_proxy_blocking ( + unsigned32 code +) +{ + return (code == THREAD_STATUS_PROXY_BLOCKING); +} + #endif /* end of include file */ diff --git a/c/src/exec/score/inline/tod.inl b/c/src/exec/score/inline/tod.inl index dadcdabcda..d2e26e2f2a 100644 --- a/c/src/exec/score/inline/tod.inl +++ b/c/src/exec/score/inline/tod.inl @@ -58,7 +58,7 @@ STATIC INLINE void _TOD_Deactivate( void ) */ STATIC INLINE void _TOD_Activate( - rtems_interval ticks + Watchdog_Interval ticks ) { _Watchdog_Insert_ticks( diff --git a/c/src/exec/score/inline/userext.inl b/c/src/exec/score/inline/userext.inl index fa5a31c37b..697a7eddd0 100644 --- a/c/src/exec/score/inline/userext.inl +++ b/c/src/exec/score/inline/userext.inl @@ -24,7 +24,7 @@ */ STATIC INLINE void _User_extensions_Handler_initialization ( - rtems_extensions_table *initial_extensions + User_extensions_Table *initial_extensions ) { _Chain_Initialize_empty( &_User_extensions_List ); @@ -42,7 +42,7 @@ STATIC INLINE void _User_extensions_Handler_initialization ( STATIC INLINE void _User_extensions_Add_set ( User_extensions_Control *the_extension, - rtems_extensions_table *extension_table + User_extensions_Table *extension_table ) { the_extension->Callouts = *extension_table; @@ -52,130 +52,35 @@ STATIC INLINE void _User_extensions_Add_set ( /*PAGE * - * _User_extensions_Remove_set - */ - -STATIC INLINE void _User_extensions_Remove_set ( - User_extensions_Control *the_extension -) -{ - _Chain_Extract( &the_extension->Node ); -} - -/*PAGE - * - * _User_extensions_Task_create - * + * _User_extensions_Add_API_set */ - -STATIC INLINE void _User_extensions_Task_create ( - Thread_Control *the_thread + +STATIC INLINE void _User_extensions_Add_API_set ( + User_extensions_Control *the_extension ) { - Chain_Node *the_node; - User_extensions_Control *the_extension; - - for ( the_node = _User_extensions_List.first ; - !_Chain_Is_tail( &_User_extensions_List, the_node ) ; - the_node = the_node->next ) { - - the_extension = (User_extensions_Control *) the_node; - - if ( the_extension->Callouts.rtems_task_create != NULL ) - (*the_extension->Callouts.rtems_task_create)( - _Thread_Executing, - the_thread - ); - } + _Chain_Prepend( &_User_extensions_List, &the_extension->Node ); } - + /*PAGE * - * _User_extensions_Task_delete - */ - -STATIC INLINE void _User_extensions_Task_delete ( - Thread_Control *the_thread -) -{ - Chain_Node *the_node; - User_extensions_Control *the_extension; - - for ( the_node = _User_extensions_List.last ; - !_Chain_Is_head( &_User_extensions_List, the_node ) ; - the_node = the_node->previous ) { - - the_extension = (User_extensions_Control *) the_node; - - if ( the_extension->Callouts.rtems_task_delete != NULL ) - (*the_extension->Callouts.rtems_task_delete)( - _Thread_Executing, - the_thread - ); - } -} - -/*PAGE - * - * _User_extensions_Task_start - * - */ - -STATIC INLINE void _User_extensions_Task_start ( - Thread_Control *the_thread -) -{ - Chain_Node *the_node; - User_extensions_Control *the_extension; - - for ( the_node = _User_extensions_List.first ; - !_Chain_Is_tail( &_User_extensions_List, the_node ) ; - the_node = the_node->next ) { - - the_extension = (User_extensions_Control *) the_node; - - if ( the_extension->Callouts.rtems_task_start != NULL ) - (*the_extension->Callouts.rtems_task_start)( - _Thread_Executing, - the_thread - ); - } -} - -/*PAGE - * - * _User_extensions_Task_restart - * + * _User_extensions_Remove_set */ -STATIC INLINE void _User_extensions_Task_restart ( - Thread_Control *the_thread +STATIC INLINE void _User_extensions_Remove_set ( + User_extensions_Control *the_extension ) { - Chain_Node *the_node; - User_extensions_Control *the_extension; - - for ( the_node = _User_extensions_List.first ; - !_Chain_Is_tail( &_User_extensions_List, the_node ) ; - the_node = the_node->next ) { - - the_extension = (User_extensions_Control *) the_node; - - if ( the_extension->Callouts.rtems_task_restart != NULL ) - (*the_extension->Callouts.rtems_task_restart)( - _Thread_Executing, - the_thread - ); - } + _Chain_Extract( &the_extension->Node ); } /*PAGE * - * _User_extensions_Task_switch + * _User_extensions_Thread_switch * */ -STATIC INLINE void _User_extensions_Task_switch ( +STATIC INLINE void _User_extensions_Thread_switch ( Thread_Control *executing, Thread_Control *heir ) @@ -189,78 +94,32 @@ STATIC INLINE void _User_extensions_Task_switch ( the_extension = (User_extensions_Control *) the_node; - if ( the_extension->Callouts.task_switch != NULL ) - (*the_extension->Callouts.task_switch)( executing, heir ); + if ( the_extension->Callouts.thread_switch != NULL ) + (*the_extension->Callouts.thread_switch)( executing, heir ); } } /*PAGE * - * _User_extensions_Task_begin + * _User_extensions_Thread_post_switch * */ - -STATIC INLINE void _User_extensions_Task_begin ( + +STATIC INLINE void _User_extensions_Thread_post_switch ( Thread_Control *executing ) { Chain_Node *the_node; User_extensions_Control *the_extension; - + for ( the_node = _User_extensions_List.first ; !_Chain_Is_tail( &_User_extensions_List, the_node ) ; the_node = the_node->next ) { - - the_extension = (User_extensions_Control *) the_node; - - if ( the_extension->Callouts.task_begin != NULL ) - (*the_extension->Callouts.task_begin)( executing ); - } -} - -/*PAGE - * - * _User_extensions_Task_exitted - */ - -STATIC INLINE void _User_extensions_Task_exitted ( - Thread_Control *executing -) -{ - Chain_Node *the_node; - User_extensions_Control *the_extension; - - for ( the_node = _User_extensions_List.last ; - !_Chain_Is_head( &_User_extensions_List, the_node ) ; - the_node = the_node->previous ) { - + the_extension = (User_extensions_Control *) the_node; - - if ( the_extension->Callouts.task_exitted != NULL ) - (*the_extension->Callouts.task_exitted)( executing ); - } -} - -/*PAGE - * - * _User_extensions_Fatal - */ - -STATIC INLINE void _User_extensions_Fatal ( - unsigned32 the_error -) -{ - Chain_Node *the_node; - User_extensions_Control *the_extension; - - for ( the_node = _User_extensions_List.last ; - !_Chain_Is_head( &_User_extensions_List, the_node ) ; - the_node = the_node->previous ) { - - the_extension = (User_extensions_Control *) the_node; - - if ( the_extension->Callouts.fatal != NULL ) - (*the_extension->Callouts.fatal)( the_error ); + + if ( the_extension->Callouts.thread_post_switch != NULL ) + (*the_extension->Callouts.thread_post_switch)( executing ); } } diff --git a/c/src/exec/score/inline/watchdog.inl b/c/src/exec/score/inline/watchdog.inl index 2e7dca0381..bb7edb82ed 100644 --- a/c/src/exec/score/inline/watchdog.inl +++ b/c/src/exec/score/inline/watchdog.inl @@ -24,10 +24,10 @@ */ STATIC INLINE void _Watchdog_Initialize( - Watchdog_Control *the_watchdog, - rtems_timer_service_routine_entry routine, - Objects_Id id, - void *user_data + Watchdog_Control *the_watchdog, + Watchdog_Service_routine_entry routine, + Objects_Id id, + void *user_data ) { the_watchdog->state = WATCHDOG_INACTIVE; @@ -115,7 +115,7 @@ STATIC INLINE void _Watchdog_Tickle_seconds( void ) STATIC INLINE void _Watchdog_Insert_ticks( Watchdog_Control *the_watchdog, - rtems_interval units, + Watchdog_Interval units, Watchdog_Insert_modes insert_mode ) { @@ -134,7 +134,7 @@ STATIC INLINE void _Watchdog_Insert_ticks( STATIC INLINE void _Watchdog_Insert_seconds( Watchdog_Control *the_watchdog, - rtems_interval units, + Watchdog_Interval units, Watchdog_Insert_modes insert_mode ) { @@ -153,7 +153,7 @@ STATIC INLINE void _Watchdog_Insert_seconds( STATIC INLINE void _Watchdog_Adjust_seconds( Watchdog_Adjust_directions direction, - rtems_interval units + Watchdog_Interval units ) { @@ -169,7 +169,7 @@ STATIC INLINE void _Watchdog_Adjust_seconds( STATIC INLINE void _Watchdog_Adjust_ticks( Watchdog_Adjust_directions direction, - rtems_interval units + Watchdog_Interval units ) { diff --git a/c/src/exec/score/inline/wkspace.inl b/c/src/exec/score/inline/wkspace.inl index 39d5ad8eb8..36ed61d565 100644 --- a/c/src/exec/score/inline/wkspace.inl +++ b/c/src/exec/score/inline/wkspace.inl @@ -1,7 +1,7 @@ /* wkspace.inl * * This include file contains the bodies of the routines which contains - * information related to the RTEMS RAM Workspace. + * information related to the RAM Workspace. * * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. * On-Line Applications Research Corporation (OAR). @@ -32,9 +32,12 @@ STATIC INLINE void _Workspace_Handler_initialization( unsigned32 index; unsigned32 memory_available; - if ( (starting_address == NULL) || - !_Addresses_Is_aligned( starting_address ) ) - rtems_fatal_error_occurred( RTEMS_INVALID_ADDRESS ); + if ( !starting_address || !_Addresses_Is_aligned( starting_address ) ) + _Internal_error_Occurred( + INTERNAL_ERROR_CORE, + TRUE, + INTERNAL_ERROR_INVALID_WORKSPACE_ADDRESS + ); if ( _CPU_Table.do_zero_of_workspace ) { for( zero_out_array = (unsigned32 *) starting_address, index = 0 ; @@ -51,7 +54,11 @@ STATIC INLINE void _Workspace_Handler_initialization( ); if ( memory_available == 0 ) - rtems_fatal_error_occurred( RTEMS_UNSATISFIED ); + _Internal_error_Occurred( + INTERNAL_ERROR_CORE, + TRUE, + INTERNAL_ERROR_TOO_LITTLE_WORKSPACE + ); } /*PAGE diff --git a/c/src/exec/score/macros/address.inl b/c/src/exec/score/macros/address.inl index f2672f2500..c0d45c3c6b 100644 --- a/c/src/exec/score/macros/address.inl +++ b/c/src/exec/score/macros/address.inl @@ -24,7 +24,7 @@ */ #define _Addresses_Add_offset( _base, _offset ) \ - ((void *)(_base) + (_offset)) + ((void *)((char *)(_base) + (_offset))) /*PAGE * @@ -33,18 +33,7 @@ */ #define _Addresses_Subtract_offset( _base, _offset ) \ - ((void *)(_base) - (_offset)) - -/*PAGE - * - * _Addresses_Add - * - * NOTE: The cast of an address to an unsigned32 makes this code - * dependent on an addresses being thirty two bits. - */ - -#define _Addresses_Add( _left, _right ) \ - ((void *)(_left) + (unsigned32)(_right)) + ((void *)((char *)(_base) - (_offset))) /*PAGE * diff --git a/c/src/exec/score/macros/coremutex.inl b/c/src/exec/score/macros/coremutex.inl new file mode 100644 index 0000000000..e8dbc9322c --- /dev/null +++ b/c/src/exec/score/macros/coremutex.inl @@ -0,0 +1,77 @@ +/* macros/coremutex.h + * + * This include file contains all of the inlined routines associated + * with core mutexes. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#ifndef __MACROS_CORE_MUTEX_h +#define __MACROS_CORE_MUTEX_h + + +/*PAGE + * + * _CORE_mutex_Is_locked + * + */ + +#define _CORE_mutex_Is_locked( _the_mutex ) \ + ( (_the_mutex)->lock == CORE_MUTEX_LOCKED ) + +/*PAGE + * + * _CORE_mutex_Is_fifo + * + */ + +#define _CORE_mutex_Is_fifo( _the_attribute ) \ + ( (_the_attribute)->discipline == CORE_MUTEX_DISCIPLINES_FIFO ) + +/*PAGE + * + * _CORE_mutex_Is_priority + * + */ + +#define _CORE_mutex_Is_priority( _the_attribute ) \ + ( (_the_attribute)->discipline == CORE_MUTEX_DISCIPLINES_PRIORITY ) + +/*PAGE + * + * _CORE_mutex_Is_inherit_priority + * + */ + +#define _CORE_mutex_Is_inherit_priority( _the_attribute ) \ + ( (_the_attribute)->discipline == \ + CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT ) + +/*PAGE + * + * _CORE_mutex_Is_priority_ceiling + * + */ + +#define _CORE_mutex_Is_priority_ceiling( _the_attribute )\ + ( (_the_attribute)->discipline == CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING ) + +/*PAGE + * + * _CORE_mutex_Is_nesting_allowed + * + */ + +#define _CORE_mutex_Is_nesting_allowed( _the_attribute ) \ + ( (_the_attribute)->allow_nesting == TRUE ) + +#endif +/* end of include file */ diff --git a/c/src/exec/score/macros/coresem.inl b/c/src/exec/score/macros/coresem.inl new file mode 100644 index 0000000000..499b4a1433 --- /dev/null +++ b/c/src/exec/score/macros/coresem.inl @@ -0,0 +1,40 @@ +/* macros/coresem.h + * + * This include file contains all of the inlined routines associated + * with core semaphores. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#ifndef __MACROS_CORE_SEMAPHORE_h +#define __MACROS_CORE_SEMAPHORE_h + +/*PAGE + * + * _CORE_semaphore_Is_priority + * + */ + +#define _CORE_semaphore_Is_priority( _the_attribute ) \ + ( (_the_attribute)->discipline == CORE_SEMAPHORE_DISCIPLINES_PRIORITY ) + +/*PAGE + * + * _Core_semaphore_Get_count + * + */ + +#define _Core_semaphore_Get_count( _the_semaphore ) \ + ( (_the_semaphore)->count ) + + +#endif +/* end of include file */ diff --git a/c/src/exec/score/macros/heap.inl b/c/src/exec/score/macros/heap.inl index 4966aab385..1023a77fc5 100644 --- a/c/src/exec/score/macros/heap.inl +++ b/c/src/exec/score/macros/heap.inl @@ -17,7 +17,7 @@ #ifndef __HEAP_inl #define __HEAP_inl -#include <rtems/address.h> +#include <rtems/core/address.h> /*PAGE * diff --git a/c/src/exec/score/macros/isr.inl b/c/src/exec/score/macros/isr.inl index 93f234c7ff..975487c98b 100644 --- a/c/src/exec/score/macros/isr.inl +++ b/c/src/exec/score/macros/isr.inl @@ -19,18 +19,6 @@ /*PAGE * - * _ISR_Handler_initialization - * - */ - -#define _ISR_Handler_initialization() \ - { \ - _ISR_Signals_to_thread_executing = FALSE; \ - _ISR_Nest_level = 0; \ - } - -/*PAGE - * * _ISR_Is_in_progress * */ diff --git a/c/src/exec/score/macros/object.inl b/c/src/exec/score/macros/object.inl index 7a346af720..8a5a0a3411 100644 --- a/c/src/exec/score/macros/object.inl +++ b/c/src/exec/score/macros/object.inl @@ -30,29 +30,29 @@ /*PAGE * - * rtems_get_class + * _Objects_Get_class */ -#define rtems_get_class( _id ) \ +#define _Objects_Get_class( _id ) \ (Objects_Classes) \ (((_id) >> OBJECTS_CLASS_START_BIT) & OBJECTS_CLASS_VALID_BITS) /*PAGE * - * rtems_get_node + * _Objects_Get_node * */ -#define rtems_get_node( _id ) \ +#define _Objects_Get_node( _id ) \ (((_id) >> OBJECTS_NODE_START_BIT) & OBJECTS_NODE_VALID_BITS) /*PAGE * - * rtems_get_index + * _Objects_Get_index * */ -#define rtems_get_index( _id ) \ +#define _Objects_Get_index( _id ) \ (((_id) >> OBJECTS_INDEX_START_BIT) & OBJECTS_INDEX_VALID_BITS) /*PAGE @@ -80,7 +80,7 @@ */ #define _Objects_Is_local_id( _id ) \ - _Objects_Is_local_node( rtems_get_node(_id) ) + _Objects_Is_local_node( _Objects_Get_node(_id) ) /*PAGE * @@ -119,7 +119,7 @@ { \ unsigned32 _index; \ \ - _index = rtems_get_index( (_the_object)->id ); \ + _index = _Objects_Get_index( (_the_object)->id ); \ (_information)->local_table[ _index ] = (_the_object); \ \ if ( (_information)->is_string ) \ @@ -139,7 +139,7 @@ { \ unsigned32 _index; \ \ - _index = rtems_get_index( (_the_object)->id ); \ + _index = _Objects_Get_index( (_the_object)->id ); \ (_information)->local_table[ _index ] = NULL; \ _Objects_Clear_name( (_the_object)->name, (_information)->name_length ); \ } diff --git a/c/src/exec/score/macros/priority.inl b/c/src/exec/score/macros/priority.inl index 0efec0050e..d78e2a0628 100644 --- a/c/src/exec/score/macros/priority.inl +++ b/c/src/exec/score/macros/priority.inl @@ -17,7 +17,7 @@ #ifndef __PRIORITY_inl #define __PRIORITY_inl -#include <rtems/bitfield.h> +#include <rtems/core/bitfield.h> /*PAGE * @@ -40,9 +40,13 @@ * */ + /* + * Since PRIORITY_MINIMUM is 0 and priorities are stored unsigned, + * then checking for less than 0 is unnecessary. + */ + #define _Priority_Is_valid( _the_priority ) \ - ( ( (_the_priority) >= RTEMS_MINIMUM_PRIORITY ) && \ - ( (_the_priority) <= RTEMS_MAXIMUM_PRIORITY ) ) + ( (_the_priority) <= PRIORITY_MAXIMUM ) /*PAGE * diff --git a/c/src/exec/score/macros/rtems/score/address.inl b/c/src/exec/score/macros/rtems/score/address.inl index f2672f2500..c0d45c3c6b 100644 --- a/c/src/exec/score/macros/rtems/score/address.inl +++ b/c/src/exec/score/macros/rtems/score/address.inl @@ -24,7 +24,7 @@ */ #define _Addresses_Add_offset( _base, _offset ) \ - ((void *)(_base) + (_offset)) + ((void *)((char *)(_base) + (_offset))) /*PAGE * @@ -33,18 +33,7 @@ */ #define _Addresses_Subtract_offset( _base, _offset ) \ - ((void *)(_base) - (_offset)) - -/*PAGE - * - * _Addresses_Add - * - * NOTE: The cast of an address to an unsigned32 makes this code - * dependent on an addresses being thirty two bits. - */ - -#define _Addresses_Add( _left, _right ) \ - ((void *)(_left) + (unsigned32)(_right)) + ((void *)((char *)(_base) - (_offset))) /*PAGE * diff --git a/c/src/exec/score/macros/rtems/score/coremutex.inl b/c/src/exec/score/macros/rtems/score/coremutex.inl new file mode 100644 index 0000000000..e8dbc9322c --- /dev/null +++ b/c/src/exec/score/macros/rtems/score/coremutex.inl @@ -0,0 +1,77 @@ +/* macros/coremutex.h + * + * This include file contains all of the inlined routines associated + * with core mutexes. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#ifndef __MACROS_CORE_MUTEX_h +#define __MACROS_CORE_MUTEX_h + + +/*PAGE + * + * _CORE_mutex_Is_locked + * + */ + +#define _CORE_mutex_Is_locked( _the_mutex ) \ + ( (_the_mutex)->lock == CORE_MUTEX_LOCKED ) + +/*PAGE + * + * _CORE_mutex_Is_fifo + * + */ + +#define _CORE_mutex_Is_fifo( _the_attribute ) \ + ( (_the_attribute)->discipline == CORE_MUTEX_DISCIPLINES_FIFO ) + +/*PAGE + * + * _CORE_mutex_Is_priority + * + */ + +#define _CORE_mutex_Is_priority( _the_attribute ) \ + ( (_the_attribute)->discipline == CORE_MUTEX_DISCIPLINES_PRIORITY ) + +/*PAGE + * + * _CORE_mutex_Is_inherit_priority + * + */ + +#define _CORE_mutex_Is_inherit_priority( _the_attribute ) \ + ( (_the_attribute)->discipline == \ + CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT ) + +/*PAGE + * + * _CORE_mutex_Is_priority_ceiling + * + */ + +#define _CORE_mutex_Is_priority_ceiling( _the_attribute )\ + ( (_the_attribute)->discipline == CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING ) + +/*PAGE + * + * _CORE_mutex_Is_nesting_allowed + * + */ + +#define _CORE_mutex_Is_nesting_allowed( _the_attribute ) \ + ( (_the_attribute)->allow_nesting == TRUE ) + +#endif +/* end of include file */ diff --git a/c/src/exec/score/macros/rtems/score/coresem.inl b/c/src/exec/score/macros/rtems/score/coresem.inl new file mode 100644 index 0000000000..499b4a1433 --- /dev/null +++ b/c/src/exec/score/macros/rtems/score/coresem.inl @@ -0,0 +1,40 @@ +/* macros/coresem.h + * + * This include file contains all of the inlined routines associated + * with core semaphores. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#ifndef __MACROS_CORE_SEMAPHORE_h +#define __MACROS_CORE_SEMAPHORE_h + +/*PAGE + * + * _CORE_semaphore_Is_priority + * + */ + +#define _CORE_semaphore_Is_priority( _the_attribute ) \ + ( (_the_attribute)->discipline == CORE_SEMAPHORE_DISCIPLINES_PRIORITY ) + +/*PAGE + * + * _Core_semaphore_Get_count + * + */ + +#define _Core_semaphore_Get_count( _the_semaphore ) \ + ( (_the_semaphore)->count ) + + +#endif +/* end of include file */ diff --git a/c/src/exec/score/macros/rtems/score/heap.inl b/c/src/exec/score/macros/rtems/score/heap.inl index 4966aab385..1023a77fc5 100644 --- a/c/src/exec/score/macros/rtems/score/heap.inl +++ b/c/src/exec/score/macros/rtems/score/heap.inl @@ -17,7 +17,7 @@ #ifndef __HEAP_inl #define __HEAP_inl -#include <rtems/address.h> +#include <rtems/core/address.h> /*PAGE * diff --git a/c/src/exec/score/macros/rtems/score/isr.inl b/c/src/exec/score/macros/rtems/score/isr.inl index 93f234c7ff..975487c98b 100644 --- a/c/src/exec/score/macros/rtems/score/isr.inl +++ b/c/src/exec/score/macros/rtems/score/isr.inl @@ -19,18 +19,6 @@ /*PAGE * - * _ISR_Handler_initialization - * - */ - -#define _ISR_Handler_initialization() \ - { \ - _ISR_Signals_to_thread_executing = FALSE; \ - _ISR_Nest_level = 0; \ - } - -/*PAGE - * * _ISR_Is_in_progress * */ diff --git a/c/src/exec/score/macros/rtems/score/object.inl b/c/src/exec/score/macros/rtems/score/object.inl index 7a346af720..8a5a0a3411 100644 --- a/c/src/exec/score/macros/rtems/score/object.inl +++ b/c/src/exec/score/macros/rtems/score/object.inl @@ -30,29 +30,29 @@ /*PAGE * - * rtems_get_class + * _Objects_Get_class */ -#define rtems_get_class( _id ) \ +#define _Objects_Get_class( _id ) \ (Objects_Classes) \ (((_id) >> OBJECTS_CLASS_START_BIT) & OBJECTS_CLASS_VALID_BITS) /*PAGE * - * rtems_get_node + * _Objects_Get_node * */ -#define rtems_get_node( _id ) \ +#define _Objects_Get_node( _id ) \ (((_id) >> OBJECTS_NODE_START_BIT) & OBJECTS_NODE_VALID_BITS) /*PAGE * - * rtems_get_index + * _Objects_Get_index * */ -#define rtems_get_index( _id ) \ +#define _Objects_Get_index( _id ) \ (((_id) >> OBJECTS_INDEX_START_BIT) & OBJECTS_INDEX_VALID_BITS) /*PAGE @@ -80,7 +80,7 @@ */ #define _Objects_Is_local_id( _id ) \ - _Objects_Is_local_node( rtems_get_node(_id) ) + _Objects_Is_local_node( _Objects_Get_node(_id) ) /*PAGE * @@ -119,7 +119,7 @@ { \ unsigned32 _index; \ \ - _index = rtems_get_index( (_the_object)->id ); \ + _index = _Objects_Get_index( (_the_object)->id ); \ (_information)->local_table[ _index ] = (_the_object); \ \ if ( (_information)->is_string ) \ @@ -139,7 +139,7 @@ { \ unsigned32 _index; \ \ - _index = rtems_get_index( (_the_object)->id ); \ + _index = _Objects_Get_index( (_the_object)->id ); \ (_information)->local_table[ _index ] = NULL; \ _Objects_Clear_name( (_the_object)->name, (_information)->name_length ); \ } diff --git a/c/src/exec/score/macros/rtems/score/priority.inl b/c/src/exec/score/macros/rtems/score/priority.inl index 0efec0050e..d78e2a0628 100644 --- a/c/src/exec/score/macros/rtems/score/priority.inl +++ b/c/src/exec/score/macros/rtems/score/priority.inl @@ -17,7 +17,7 @@ #ifndef __PRIORITY_inl #define __PRIORITY_inl -#include <rtems/bitfield.h> +#include <rtems/core/bitfield.h> /*PAGE * @@ -40,9 +40,13 @@ * */ + /* + * Since PRIORITY_MINIMUM is 0 and priorities are stored unsigned, + * then checking for less than 0 is unnecessary. + */ + #define _Priority_Is_valid( _the_priority ) \ - ( ( (_the_priority) >= RTEMS_MINIMUM_PRIORITY ) && \ - ( (_the_priority) <= RTEMS_MAXIMUM_PRIORITY ) ) + ( (_the_priority) <= PRIORITY_MAXIMUM ) /*PAGE * diff --git a/c/src/exec/score/macros/rtems/score/stack.inl b/c/src/exec/score/macros/rtems/score/stack.inl index 208503b45f..d20eebd0b9 100644 --- a/c/src/exec/score/macros/rtems/score/stack.inl +++ b/c/src/exec/score/macros/rtems/score/stack.inl @@ -36,7 +36,7 @@ */ #define _Stack_Is_enough( _size ) \ - ( (_size) >= RTEMS_MINIMUM_STACK_SIZE ) + ( (_size) >= STACK_MINIMUM_SIZE ) /*PAGE * diff --git a/c/src/exec/score/macros/rtems/score/states.inl b/c/src/exec/score/macros/rtems/score/states.inl index f69c4ba042..4fa138d107 100644 --- a/c/src/exec/score/macros/rtems/score/states.inl +++ b/c/src/exec/score/macros/rtems/score/states.inl @@ -1,7 +1,7 @@ /* states.inl * * This file contains the macro implementation of the inlined - * routines associated with RTEMS state information. + * routines associated with thread state information. * * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. * On-Line Applications Research Corporation (OAR). @@ -127,6 +127,15 @@ /*PAGE * + * _States_Is_waiting_for_mutex + * + */ + +#define _States_Is_waiting_for_mutex( _the_states ) \ + ( (_the_states) & STATES_WAITING_FOR_MUTEX ) + +/*PAGE + * * _States_Is_waiting_for_semaphore * */ diff --git a/c/src/exec/score/macros/rtems/score/sysstate.inl b/c/src/exec/score/macros/rtems/score/sysstate.inl index ed13494d30..d0cb932924 100644 --- a/c/src/exec/score/macros/rtems/score/sysstate.inl +++ b/c/src/exec/score/macros/rtems/score/sysstate.inl @@ -19,11 +19,24 @@ /*PAGE * + * _System_state_Handler_initialization + */ + +#define _System_state_Handler_initialization( _is_multiprocessing ) \ + do { \ + _System_state_Current = SYSTEM_STATE_BEFORE_INITIALIZATION; \ + _System_state_Is_multiprocessing = (_is_multiprocessing); \ + } while ( 0 ) + +/*PAGE + * * _System_state_Set */ #define _System_state_Set( _state ) \ - _System_state_Current = (_state) + do { \ + _System_state_Current = (_state); \ + } while ( 0 ) /*PAGE * diff --git a/c/src/exec/score/macros/rtems/score/thread.inl b/c/src/exec/score/macros/rtems/score/thread.inl index d7d37cb218..3f7afb054b 100644 --- a/c/src/exec/score/macros/rtems/score/thread.inl +++ b/c/src/exec/score/macros/rtems/score/thread.inl @@ -189,5 +189,13 @@ void _Thread_Enable_dispatch( void ); #define _Thread_Is_null( _the_thread ) \ ( (_the_thread) == NULL ) +/* + * _Thread_Is_proxy_blocking + * + */ + +#define _Thread_Is_proxy_blocking( _code ) \ + ( (_code) == THREAD_STATUS_PROXY_BLOCKING ) + #endif /* end of include file */ diff --git a/c/src/exec/score/macros/rtems/score/userext.inl b/c/src/exec/score/macros/rtems/score/userext.inl index 781f30ad40..2daa37494d 100644 --- a/c/src/exec/score/macros/rtems/score/userext.inl +++ b/c/src/exec/score/macros/rtems/score/userext.inl @@ -40,11 +40,20 @@ */ #define _User_extensions_Add_set( _the_extension, _extension_table ) \ - { \ + do { \ (_the_extension)->Callouts = *(_extension_table); \ \ _Chain_Append( &_User_extensions_List, &(_the_extension)->Node ); \ - } + } while ( 0 ) + +/*PAGE + * + * _User_extensions_Add_API_set + */ + +#define _User_extensions_Add_API_set( _the_extension ) \ + _Chain_Prepend( &_User_extensions_List, &(_the_extension)->Node ) + /*PAGE * @@ -106,79 +115,21 @@ /*PAGE * - * _User_extensions_Task_create - * - */ - -#define _User_extensions_Task_create( _the_thread ) \ - _User_extensions_Run_list_forward(rtems_task_create, \ - (_Thread_Executing, _the_thread) ) - -/*PAGE - * - * _User_extensions_Task_delete - * - */ - -#define _User_extensions_Task_delete( _the_thread ) \ - _User_extensions_Run_list_backward(rtems_task_delete, \ - (_Thread_Executing, _the_thread) ) - -/*PAGE - * - * _User_extensions_Task_start - * - */ - -#define _User_extensions_Task_start( _the_thread ) \ - _User_extensions_Run_list_forward(rtems_task_start, \ - (_Thread_Executing, _the_thread) ) - -/*PAGE - * - * _User_extensions_Task_restart - * - */ - -#define _User_extensions_Task_restart( _the_thread ) \ - _User_extensions_Run_list_forward(rtems_task_restart,\ - (_Thread_Executing, _the_thread) ) - -/*PAGE - * - * _User_extensions_Task_switch - * - */ - -#define _User_extensions_Task_switch( _executing, _heir ) \ - _User_extensions_Run_list_forward(task_switch, (_executing, _heir) ) - -/*PAGE - * - * _User_extensions_Task_begin - * - */ - -#define _User_extensions_Task_begin( _executing ) \ - _User_extensions_Run_list_forward(task_begin, (_executing) ) - -/*PAGE - * - * _User_extensions_Task_exitted + * _User_extensions_Thread_switch * */ -#define _User_extensions_Task_exitted( _executing ) \ - _User_extensions_Run_list_backward(task_exitted, (_executing) ) +#define _User_extensions_Thread_switch( _executing, _heir ) \ + _User_extensions_Run_list_forward(thread_switch, (_executing, _heir) ) /*PAGE * - * _User_extensions_Fatal + * _User_extensions_Thread_post_switch * */ -#define _User_extensions_Fatal( _the_error ) \ - _User_extensions_Run_list_backward(fatal, (_the_error) ) +#define _User_extensions_Thread_post_switch( _executing ) \ + _User_extensions_Run_list_forward(thread_post_switch, (_executing) ) #endif /* end of include file */ diff --git a/c/src/exec/score/macros/rtems/score/watchdog.inl b/c/src/exec/score/macros/rtems/score/watchdog.inl index 4e965420ce..15023722c6 100644 --- a/c/src/exec/score/macros/rtems/score/watchdog.inl +++ b/c/src/exec/score/macros/rtems/score/watchdog.inl @@ -17,7 +17,7 @@ #ifndef __WATCHDOG_inl #define __WATCHDOG_inl -#include <rtems/object.h> +#include <rtems/core/object.h> /*PAGE * diff --git a/c/src/exec/score/macros/rtems/score/wkspace.inl b/c/src/exec/score/macros/rtems/score/wkspace.inl index 1139e188db..aa6ccc0440 100644 --- a/c/src/exec/score/macros/rtems/score/wkspace.inl +++ b/c/src/exec/score/macros/rtems/score/wkspace.inl @@ -1,7 +1,7 @@ /* wkspace.inl * * This file contains the macro implementation of the inlined routines - * from the RTEMS RAM Workspace Handler. + * from the RAM Workspace Handler. * * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. * On-Line Applications Research Corporation (OAR). @@ -17,10 +17,6 @@ #ifndef __WORKSPACE_inl #define __WORKSPACE_inl -#include <rtems/heap.h> -#include <rtems/fatal.h> -#include <rtems/status.h> - /*PAGE * * _Workspace_Handler_initialization @@ -33,9 +29,12 @@ unsigned32 index; \ unsigned32 memory_available; \ \ - if ( ((_starting_address) == NULL) || \ - !_Addresses_Is_aligned( (_starting_address) ) ) \ - rtems_fatal_error_occurred( RTEMS_INVALID_ADDRESS ); \ + if ( !(_starting_address) || !_Addresses_Is_aligned( (_starting_address) ) ) \ + _Internal_error_Occurred( \ + INTERNAL_ERROR_CORE, \ + TRUE, \ + INTERNAL_ERROR_INVALID_WORKSPACE_ADDRESS \ + ); \ \ if ( _CPU_Table.do_zero_of_workspace ) { \ for( zero_out_array = (unsigned32 *) (_starting_address), index = 0 ; \ @@ -52,7 +51,11 @@ ); \ \ if ( memory_available == 0 ) \ - rtems_fatal_error_occurred( RTEMS_UNSATISFIED ); \ + _Internal_error_Occurred( \ + INTERNAL_ERROR_CORE, \ + TRUE, \ + INTERNAL_ERROR_TOO_LITTLE_WORKSPACE \ + ); \ } /*PAGE diff --git a/c/src/exec/score/macros/stack.inl b/c/src/exec/score/macros/stack.inl index 208503b45f..d20eebd0b9 100644 --- a/c/src/exec/score/macros/stack.inl +++ b/c/src/exec/score/macros/stack.inl @@ -36,7 +36,7 @@ */ #define _Stack_Is_enough( _size ) \ - ( (_size) >= RTEMS_MINIMUM_STACK_SIZE ) + ( (_size) >= STACK_MINIMUM_SIZE ) /*PAGE * diff --git a/c/src/exec/score/macros/states.inl b/c/src/exec/score/macros/states.inl index f69c4ba042..4fa138d107 100644 --- a/c/src/exec/score/macros/states.inl +++ b/c/src/exec/score/macros/states.inl @@ -1,7 +1,7 @@ /* states.inl * * This file contains the macro implementation of the inlined - * routines associated with RTEMS state information. + * routines associated with thread state information. * * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. * On-Line Applications Research Corporation (OAR). @@ -127,6 +127,15 @@ /*PAGE * + * _States_Is_waiting_for_mutex + * + */ + +#define _States_Is_waiting_for_mutex( _the_states ) \ + ( (_the_states) & STATES_WAITING_FOR_MUTEX ) + +/*PAGE + * * _States_Is_waiting_for_semaphore * */ diff --git a/c/src/exec/score/macros/sysstate.inl b/c/src/exec/score/macros/sysstate.inl index ed13494d30..d0cb932924 100644 --- a/c/src/exec/score/macros/sysstate.inl +++ b/c/src/exec/score/macros/sysstate.inl @@ -19,11 +19,24 @@ /*PAGE * + * _System_state_Handler_initialization + */ + +#define _System_state_Handler_initialization( _is_multiprocessing ) \ + do { \ + _System_state_Current = SYSTEM_STATE_BEFORE_INITIALIZATION; \ + _System_state_Is_multiprocessing = (_is_multiprocessing); \ + } while ( 0 ) + +/*PAGE + * * _System_state_Set */ #define _System_state_Set( _state ) \ - _System_state_Current = (_state) + do { \ + _System_state_Current = (_state); \ + } while ( 0 ) /*PAGE * diff --git a/c/src/exec/score/macros/thread.inl b/c/src/exec/score/macros/thread.inl index d7d37cb218..3f7afb054b 100644 --- a/c/src/exec/score/macros/thread.inl +++ b/c/src/exec/score/macros/thread.inl @@ -189,5 +189,13 @@ void _Thread_Enable_dispatch( void ); #define _Thread_Is_null( _the_thread ) \ ( (_the_thread) == NULL ) +/* + * _Thread_Is_proxy_blocking + * + */ + +#define _Thread_Is_proxy_blocking( _code ) \ + ( (_code) == THREAD_STATUS_PROXY_BLOCKING ) + #endif /* end of include file */ diff --git a/c/src/exec/score/macros/userext.inl b/c/src/exec/score/macros/userext.inl index 781f30ad40..2daa37494d 100644 --- a/c/src/exec/score/macros/userext.inl +++ b/c/src/exec/score/macros/userext.inl @@ -40,11 +40,20 @@ */ #define _User_extensions_Add_set( _the_extension, _extension_table ) \ - { \ + do { \ (_the_extension)->Callouts = *(_extension_table); \ \ _Chain_Append( &_User_extensions_List, &(_the_extension)->Node ); \ - } + } while ( 0 ) + +/*PAGE + * + * _User_extensions_Add_API_set + */ + +#define _User_extensions_Add_API_set( _the_extension ) \ + _Chain_Prepend( &_User_extensions_List, &(_the_extension)->Node ) + /*PAGE * @@ -106,79 +115,21 @@ /*PAGE * - * _User_extensions_Task_create - * - */ - -#define _User_extensions_Task_create( _the_thread ) \ - _User_extensions_Run_list_forward(rtems_task_create, \ - (_Thread_Executing, _the_thread) ) - -/*PAGE - * - * _User_extensions_Task_delete - * - */ - -#define _User_extensions_Task_delete( _the_thread ) \ - _User_extensions_Run_list_backward(rtems_task_delete, \ - (_Thread_Executing, _the_thread) ) - -/*PAGE - * - * _User_extensions_Task_start - * - */ - -#define _User_extensions_Task_start( _the_thread ) \ - _User_extensions_Run_list_forward(rtems_task_start, \ - (_Thread_Executing, _the_thread) ) - -/*PAGE - * - * _User_extensions_Task_restart - * - */ - -#define _User_extensions_Task_restart( _the_thread ) \ - _User_extensions_Run_list_forward(rtems_task_restart,\ - (_Thread_Executing, _the_thread) ) - -/*PAGE - * - * _User_extensions_Task_switch - * - */ - -#define _User_extensions_Task_switch( _executing, _heir ) \ - _User_extensions_Run_list_forward(task_switch, (_executing, _heir) ) - -/*PAGE - * - * _User_extensions_Task_begin - * - */ - -#define _User_extensions_Task_begin( _executing ) \ - _User_extensions_Run_list_forward(task_begin, (_executing) ) - -/*PAGE - * - * _User_extensions_Task_exitted + * _User_extensions_Thread_switch * */ -#define _User_extensions_Task_exitted( _executing ) \ - _User_extensions_Run_list_backward(task_exitted, (_executing) ) +#define _User_extensions_Thread_switch( _executing, _heir ) \ + _User_extensions_Run_list_forward(thread_switch, (_executing, _heir) ) /*PAGE * - * _User_extensions_Fatal + * _User_extensions_Thread_post_switch * */ -#define _User_extensions_Fatal( _the_error ) \ - _User_extensions_Run_list_backward(fatal, (_the_error) ) +#define _User_extensions_Thread_post_switch( _executing ) \ + _User_extensions_Run_list_forward(thread_post_switch, (_executing) ) #endif /* end of include file */ diff --git a/c/src/exec/score/macros/watchdog.inl b/c/src/exec/score/macros/watchdog.inl index 4e965420ce..15023722c6 100644 --- a/c/src/exec/score/macros/watchdog.inl +++ b/c/src/exec/score/macros/watchdog.inl @@ -17,7 +17,7 @@ #ifndef __WATCHDOG_inl #define __WATCHDOG_inl -#include <rtems/object.h> +#include <rtems/core/object.h> /*PAGE * diff --git a/c/src/exec/score/macros/wkspace.inl b/c/src/exec/score/macros/wkspace.inl index 1139e188db..aa6ccc0440 100644 --- a/c/src/exec/score/macros/wkspace.inl +++ b/c/src/exec/score/macros/wkspace.inl @@ -1,7 +1,7 @@ /* wkspace.inl * * This file contains the macro implementation of the inlined routines - * from the RTEMS RAM Workspace Handler. + * from the RAM Workspace Handler. * * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. * On-Line Applications Research Corporation (OAR). @@ -17,10 +17,6 @@ #ifndef __WORKSPACE_inl #define __WORKSPACE_inl -#include <rtems/heap.h> -#include <rtems/fatal.h> -#include <rtems/status.h> - /*PAGE * * _Workspace_Handler_initialization @@ -33,9 +29,12 @@ unsigned32 index; \ unsigned32 memory_available; \ \ - if ( ((_starting_address) == NULL) || \ - !_Addresses_Is_aligned( (_starting_address) ) ) \ - rtems_fatal_error_occurred( RTEMS_INVALID_ADDRESS ); \ + if ( !(_starting_address) || !_Addresses_Is_aligned( (_starting_address) ) ) \ + _Internal_error_Occurred( \ + INTERNAL_ERROR_CORE, \ + TRUE, \ + INTERNAL_ERROR_INVALID_WORKSPACE_ADDRESS \ + ); \ \ if ( _CPU_Table.do_zero_of_workspace ) { \ for( zero_out_array = (unsigned32 *) (_starting_address), index = 0 ; \ @@ -52,7 +51,11 @@ ); \ \ if ( memory_available == 0 ) \ - rtems_fatal_error_occurred( RTEMS_UNSATISFIED ); \ + _Internal_error_Occurred( \ + INTERNAL_ERROR_CORE, \ + TRUE, \ + INTERNAL_ERROR_TOO_LITTLE_WORKSPACE \ + ); \ } /*PAGE diff --git a/c/src/exec/score/src/chain.c b/c/src/exec/score/src/chain.c index 88f6759b0b..3cea8ea90f 100644 --- a/c/src/exec/score/src/chain.c +++ b/c/src/exec/score/src/chain.c @@ -18,9 +18,9 @@ */ #include <rtems/system.h> -#include <rtems/address.h> -#include <rtems/chain.h> -#include <rtems/isr.h> +#include <rtems/core/address.h> +#include <rtems/core/chain.h> +#include <rtems/core/isr.h> /*PAGE * diff --git a/c/src/exec/score/src/coremutex.c b/c/src/exec/score/src/coremutex.c new file mode 100644 index 0000000000..ea2b5773e1 --- /dev/null +++ b/c/src/exec/score/src/coremutex.c @@ -0,0 +1,269 @@ +/* + * Mutex Handler + * + * DESCRIPTION: + * + * This package is the implementation of the Mutex Handler. + * This handler provides synchronization and mutual exclusion capabilities. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include <rtems/system.h> +#include <rtems/core/isr.h> +#include <rtems/core/coremutex.h> +#include <rtems/core/states.h> +#include <rtems/core/thread.h> +#include <rtems/core/threadq.h> + +/*PAGE + * + * _CORE_mutex_Initialize + * + * This routine initializes a mutex at create time and set the control + * structure according to the values passed. + * + * Input parameters: + * the_mutex - the mutex control block to initialize + * the_class - the API class of the object + * the_mutex_attributes - the mutex attributes specified at create time + * initial_lock - mutex initial lock or unlocked status + * proxy_extract_callout - MP specific extract callout + * + * Output parameters: NONE + */ + +void _CORE_mutex_Initialize( + CORE_mutex_Control *the_mutex, + Objects_Classes the_class, + CORE_mutex_Attributes *the_mutex_attributes, + unsigned32 initial_lock, + Thread_queue_Extract_callout proxy_extract_callout +) +{ + +/* Add this to the RTEMS environment later ????????? + rtems_assert( initial_lock == CORE_MUTEX_LOCKED || + initial_lock == CORE_MUTEX_UNLOCKED ); + */ + + the_mutex->Attributes = *the_mutex_attributes; + the_mutex->lock = initial_lock; + + if ( initial_lock == CORE_MUTEX_LOCKED ) { + the_mutex->nest_count = 1; + the_mutex->holder = _Thread_Executing; + the_mutex->holder_id = _Thread_Executing->Object.id; + _Thread_Executing->resource_count++; + } else { + the_mutex->nest_count = 0; + the_mutex->holder = NULL; + the_mutex->holder_id = 0; + } + + _Thread_queue_Initialize( + &the_mutex->Wait_queue, + the_class, + _CORE_mutex_Is_priority( the_mutex_attributes ) ? + THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO, + STATES_WAITING_FOR_MUTEX, + proxy_extract_callout, + CORE_MUTEX_TIMEOUT + ); +} + +/*PAGE + * + * _CORE_mutex_Seize + * + * This routine attempts to allocate a mutex to the calling thread. + * + * Input parameters: + * the_mutex - pointer to mutex control block + * id - id of object to wait on + * wait - TRUE if wait is allowed, FALSE otherwise + * timeout - number of ticks to wait (0 means forever) + * + * Output parameters: NONE + * + * INTERRUPT LATENCY: + * available + * wait + */ + +void _CORE_mutex_Seize( + CORE_mutex_Control *the_mutex, + Objects_Id id, + boolean wait, + Watchdog_Interval timeout +) +{ + Thread_Control *executing; + ISR_Level level; + + executing = _Thread_Executing; + executing->Wait.return_code = CORE_MUTEX_STATUS_SUCCESSFUL; + _ISR_Disable( level ); + if ( ! _CORE_mutex_Is_locked( the_mutex ) ) { + the_mutex->lock = CORE_MUTEX_LOCKED; + the_mutex->holder = executing; + the_mutex->holder_id = executing->Object.id; + the_mutex->nest_count = 1; + executing->resource_count++; + _ISR_Enable( level ); + return; + } + + if ( !wait ) { + _ISR_Enable( level ); + executing->Wait.return_code = CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT; + return; + } + + if ( _Objects_Are_ids_equal( + _Thread_Executing->Object.id, the_mutex->holder_id ) ) { + if ( _CORE_mutex_Is_nesting_allowed( &the_mutex->Attributes ) ) + the_mutex->nest_count++; + else + executing->Wait.return_code = CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED; + + _ISR_Enable( level ); + return; + } + + the_mutex->Wait_queue.sync = TRUE; + executing->Wait.queue = &the_mutex->Wait_queue; + executing->Wait.id = id; + _ISR_Enable( level ); + + if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) && + the_mutex->holder->current_priority > + _Thread_Executing->current_priority ) { + _Thread_Change_priority( + the_mutex->holder, _Thread_Executing->current_priority ); + } + + _Thread_queue_Enqueue( &the_mutex->Wait_queue, timeout ); +} + +/* + * _CORE_mutex_Surrender + * + * DESCRIPTION: + * + * This routine frees a unit to the mutex. If a task was blocked waiting for + * a unit from this mutex, then that task will be readied and the unit + * given to that task. Otherwise, the unit will be returned to the mutex. + * + * Input parameters: + * the_mutex - the mutex to be flushed + * id - id of parent mutex + * api_mutex_mp_support - api dependent MP support actions + * + * Output parameters: + * CORE_MUTEX_STATUS_SUCCESSFUL - if successful + * core error code - if unsuccessful + */ + +CORE_mutex_Status _CORE_mutex_Surrender( + CORE_mutex_Control *the_mutex, + Objects_Id id, + CORE_mutex_API_mp_support_callout api_mutex_mp_support +) +{ + Thread_Control *the_thread; + + if ( !_Objects_Are_ids_equal( + _Thread_Executing->Object.id, the_mutex->holder_id ) ) + return( CORE_MUTEX_STATUS_NOT_OWNER_OF_RESOURCE ); + + the_mutex->nest_count--; + + if ( the_mutex->nest_count != 0 ) + return( CORE_MUTEX_STATUS_SUCCESSFUL ); + + _Thread_Executing->resource_count--; + the_mutex->holder = NULL; + the_mutex->holder_id = 0; + + /* + * Whether or not someone is waiting for the mutex, an + * inherited priority must be lowered if this is the last + * mutex (i.e. resource) this task has. + */ + + if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) && + _Thread_Executing->resource_count == 0 && + _Thread_Executing->real_priority != + _Thread_Executing->current_priority ) { + _Thread_Change_priority( + _Thread_Executing, + _Thread_Executing->real_priority + ); + } + + if ( ( the_thread = _Thread_queue_Dequeue( &the_mutex->Wait_queue ) ) ) { + + if ( !_Objects_Is_local_id( the_thread->Object.id ) ) { + + the_mutex->holder = NULL; + the_mutex->holder_id = the_thread->Object.id; + the_mutex->nest_count = 1; + + ( *api_mutex_mp_support)( the_thread, id ); + + } else { + + the_mutex->holder = the_thread; + the_mutex->holder_id = the_thread->Object.id; + the_thread->resource_count++; + the_mutex->nest_count = 1; + + /* + * No special action for priority inheritance because the_thread + * is guaranteed to be the highest priority thread waiting for + * the mutex. + */ + } + } else + the_mutex->lock = CORE_MUTEX_UNLOCKED; + + return( CORE_MUTEX_STATUS_SUCCESSFUL ); +} + +/*PAGE + * + * _CORE_mutex_Flush + * + * This function a flushes the mutex's task wait queue. + * + * Input parameters: + * the_mutex - the mutex to be flushed + * remote_extract_callout - function to invoke remotely + * status - status to pass to thread + * + * Output parameters: NONE + */ + +void _CORE_mutex_Flush( + CORE_mutex_Control *the_mutex, + Thread_queue_Flush_callout remote_extract_callout, + unsigned32 status +) +{ + + _Thread_queue_Flush( + &the_mutex->Wait_queue, + remote_extract_callout, + status + ); + +} diff --git a/c/src/exec/score/src/coresem.c b/c/src/exec/score/src/coresem.c new file mode 100644 index 0000000000..e7e1705f3c --- /dev/null +++ b/c/src/exec/score/src/coresem.c @@ -0,0 +1,185 @@ +/* + * CORE Semaphore Handler + * + * DESCRIPTION: + * + * This package is the implementation of the CORE Semaphore Handler. + * This core object utilizes standard Dijkstra counting semaphores to provide + * synchronization and mutual exclusion capabilities. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include <rtems/system.h> +#include <rtems/core/isr.h> +#include <rtems/core/coresem.h> +#include <rtems/core/states.h> +#include <rtems/core/thread.h> +#include <rtems/core/threadq.h> +#include <rtems/core/mpci.h> + +/*PAGE + * + * CORE_semaphore_Initialize + * + * This function initialize a semaphore and sets the initial value based + * on the given count. + * + * Input parameters: + * the_semaphore - the semaphore control block to initialize + * the_class - the API class of the object + * the_semaphore_attributes - the attributes specified at create time + * initial_value - semaphore's initial value + * proxy_extract_callout - MP specific extract callout + * + * Output parameters: NONE + */ + +void _CORE_semaphore_Initialize( + CORE_semaphore_Control *the_semaphore, + Objects_Classes the_class, + CORE_semaphore_Attributes *the_semaphore_attributes, + unsigned32 initial_value, + Thread_queue_Extract_callout proxy_extract_callout +) +{ + + the_semaphore->Attributes = *the_semaphore_attributes; + the_semaphore->count = initial_value; + + _Thread_queue_Initialize( + &the_semaphore->Wait_queue, + the_class, + _CORE_semaphore_Is_priority( the_semaphore_attributes ) ? + THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO, + STATES_WAITING_FOR_SEMAPHORE, + proxy_extract_callout, + CORE_SEMAPHORE_TIMEOUT + ); +} + +/*PAGE + * + * _CORE_semaphore_Surrender + * + * Input parameters: + * the_semaphore - the semaphore to be flushed + * id - id of parent semaphore + * api_semaphore_mp_support - api dependent MP support actions + * + * Output parameters: + * CORE_SEMAPHORE_STATUS_SUCCESSFUL - if successful + * core error code - if unsuccessful + * + * Output parameters: + */ + +CORE_semaphore_Status _CORE_semaphore_Surrender( + CORE_semaphore_Control *the_semaphore, + Objects_Id id, + CORE_semaphore_API_mp_support_callout api_semaphore_mp_support +) +{ + Thread_Control *the_thread; + + if ( (the_thread = _Thread_queue_Dequeue(&the_semaphore->Wait_queue)) ) { + + if ( !_Objects_Is_local_id( the_thread->Object.id ) ) + (*api_semaphore_mp_support) ( the_thread, id ); + + } else + the_semaphore->count += 1; + + return( CORE_SEMAPHORE_STATUS_SUCCESSFUL ); +} + +/*PAGE + * + * _CORE_semaphore_Seize + * + * This routine attempts to allocate a core semaphore to the calling thread. + * + * Input parameters: + * the_semaphore - pointer to semaphore control block + * id - id of object to wait on + * wait - TRUE if wait is allowed, FALSE otherwise + * timeout - number of ticks to wait (0 means forever) + * + * Output parameters: NONE + * + * INTERRUPT LATENCY: + * available + * wait + */ + +void _CORE_semaphore_Seize( + CORE_semaphore_Control *the_semaphore, + Objects_Id id, + boolean wait, + Watchdog_Interval timeout +) +{ + Thread_Control *executing; + ISR_Level level; + + executing = _Thread_Executing; + executing->Wait.return_code = CORE_SEMAPHORE_STATUS_SUCCESSFUL; + _ISR_Disable( level ); + if ( the_semaphore->count != 0 ) { + the_semaphore->count -= 1; + executing->resource_count++; + _ISR_Enable( level ); + return; + } + + if ( !wait ) { + _ISR_Enable( level ); + executing->Wait.return_code = CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT; + return; + } + + the_semaphore->Wait_queue.sync = TRUE; + executing->Wait.queue = &the_semaphore->Wait_queue; + executing->Wait.id = id; + _ISR_Enable( level ); + + _Thread_queue_Enqueue( &the_semaphore->Wait_queue, timeout ); +} + + +/*PAGE + * + * _CORE_semaphore_Flush + * + * This function a flushes the semaphore's task wait queue. + * + * Input parameters: + * the_semaphore - the semaphore to be flushed + * remote_extract_callout - function to invoke remotely + * status - status to pass to thread + * + * Output parameters: NONE + */ + +void _CORE_semaphore_Flush( + CORE_semaphore_Control *the_semaphore, + Thread_queue_Flush_callout remote_extract_callout, + unsigned32 status +) +{ + + _Thread_queue_Flush( + &the_semaphore->Wait_queue, + remote_extract_callout, + status + ); + +} diff --git a/c/src/exec/score/src/coretod.c b/c/src/exec/score/src/coretod.c index 4689c637d7..ab464664f6 100644 --- a/c/src/exec/score/src/coretod.c +++ b/c/src/exec/score/src/coretod.c @@ -14,10 +14,10 @@ */ #include <rtems/system.h> -#include <rtems/object.h> -#include <rtems/thread.h> -#include <rtems/tod.h> -#include <rtems/watchdog.h> +#include <rtems/core/object.h> +#include <rtems/core/thread.h> +#include <rtems/core/tod.h> +#include <rtems/core/watchdog.h> /*PAGE * @@ -72,11 +72,11 @@ void _TOD_Handler_initialization( */ void _TOD_Set( - rtems_time_of_day *the_tod, - rtems_interval seconds_since_epoch + TOD_Control *the_tod, + Watchdog_Interval seconds_since_epoch ) { - rtems_interval ticks_until_next_second; + Watchdog_Interval ticks_until_next_second; _Thread_Disable_dispatch(); _TOD_Deactivate(); @@ -109,14 +109,14 @@ void _TOD_Set( * the_tod - pointer to a time and date structure * * Output parameters: - * RTEMS_SUCCESSFUL - if the date, time, and tick are valid - * RTEMS_INVALID_CLOCK - if the the_tod is invalid + * TRUE - if the date, time, and tick are valid + * FALSE - if the the_tod is invalid * * NOTE: This routine only works for leap-years through 2099. */ -rtems_status_code _TOD_Validate( - rtems_time_of_day *the_tod +boolean _TOD_Validate( + TOD_Control *the_tod ) { unsigned32 days_in_month; @@ -129,7 +129,7 @@ rtems_status_code _TOD_Validate( (the_tod->month > TOD_MONTHS_PER_YEAR) || (the_tod->year < TOD_BASE_YEAR) || (the_tod->day == 0) ) - return RTEMS_INVALID_CLOCK; + return FALSE; if ( (the_tod->year % 4) == 0 ) days_in_month = _TOD_Days_per_month[ 1 ][ the_tod->month ]; @@ -137,9 +137,9 @@ rtems_status_code _TOD_Validate( days_in_month = _TOD_Days_per_month[ 0 ][ the_tod->month ]; if ( the_tod->day > days_in_month ) - return RTEMS_INVALID_CLOCK; + return FALSE; - return RTEMS_SUCCESSFUL; + return TRUE; } /*PAGE @@ -157,7 +157,7 @@ rtems_status_code _TOD_Validate( */ unsigned32 _TOD_To_seconds( - rtems_time_of_day *the_tod + TOD_Control *the_tod ) { unsigned32 time; diff --git a/c/src/exec/score/src/heap.c b/c/src/exec/score/src/heap.c index eb1c5d769e..b16cfde9de 100644 --- a/c/src/exec/score/src/heap.c +++ b/c/src/exec/score/src/heap.c @@ -14,7 +14,7 @@ #include <rtems/system.h> -#include <rtems/heap.h> +#include <rtems/core/heap.h> #include <rtems/sysstate.h> /*PAGE @@ -30,7 +30,7 @@ * page_size - allocatable unit of memory * * Output parameters: - * returns - maximum memory available if RTEMS_SUCCESSFUL + * returns - maximum memory available if successfully initialized * 0 - otherwise * * This is what a heap looks like in memory immediately diff --git a/c/src/exec/score/src/interr.c b/c/src/exec/score/src/interr.c new file mode 100644 index 0000000000..3eb2bc1746 --- /dev/null +++ b/c/src/exec/score/src/interr.c @@ -0,0 +1,61 @@ +/* + * Internal Error Handler + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include <rtems/system.h> +#include <rtems/core/interr.h> +#include <rtems/sysstate.h> +#include <rtems/core/userext.h> + +/*PAGE + * + * _Internal_error_Occurred + * + * This routine will invoke the fatal error handler supplied by the user + * followed by the the default one provided by the executive. The default + * error handler assumes no hardware is present to help inform the user + * of the problem. Halt stores the error code in a known register, + * disables interrupts, and halts the CPU. If the CPU does not have a + * halt instruction, it will loop to itself. + * + * Input parameters: + * the_source - what subsystem the error originated in + * is_internal - if the error was internally generated + * the_error - fatal error status code + * + * Output parameters: + * As much information as possible is stored in a CPU dependent fashion. + * See the CPU dependent code for more information. + * + * NOTE: The the_error is not necessarily a directive status code. + */ + +void volatile _Internal_error_Occurred( + Internal_errors_Source the_source, + boolean is_internal, + unsigned32 the_error +) +{ + + Internal_errors_What_happened.the_source = the_source; + Internal_errors_What_happened.is_internal = is_internal; + Internal_errors_What_happened.the_error = the_error; + + _User_extensions_Fatal( the_source, is_internal, the_error ); + + _System_state_Set( SYSTEM_STATE_FAILED ); + + _CPU_Fatal_halt( the_error ); + + /* will not return from this routine */ +} diff --git a/c/src/exec/score/src/isr.c b/c/src/exec/score/src/isr.c new file mode 100644 index 0000000000..b87bf9f249 --- /dev/null +++ b/c/src/exec/score/src/isr.c @@ -0,0 +1,60 @@ +/* + * ISR Handler + * + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include <rtems/system.h> +#include <rtems/core/isr.h> +#include <rtems/core/stack.h> +#include <rtems/core/interr.h> +#include <rtems/core/wkspace.h> + +/* _ISR_Handler_initialization + * + * This routine initializes the ISR handler. + * + * Input parameters: NONE + * + * Output parameters: NONE + */ + +void _ISR_Handler_initialization( void ) +{ + _ISR_Signals_to_thread_executing = FALSE; + + _ISR_Nest_level = 0; + +#if ( CPU_ALLOCATE_INTERRUPT_STACK == TRUE ) + + if ( _CPU_Table.interrupt_stack_size < STACK_MINIMUM_SIZE ) + _Internal_error_Occurred( + INTERNAL_ERROR_CORE, + TRUE, + INTERNAL_ERROR_INTERRUPT_STACK_TOO_SMALL + ); + + _CPU_Interrupt_stack_low = + _Workspace_Allocate_or_fatal_error( _CPU_Table.interrupt_stack_size ); + + _CPU_Interrupt_stack_high = _Addresses_Add_offset( + _CPU_Interrupt_stack_low, + _CPU_Table.interrupt_stack_size + ); + +#endif + +#if ( CPU_HAS_HARDWARE_INTERRUPT_STACK == TRUE ) + _CPU_Install_interrupt_stack(); +#endif + +} diff --git a/c/src/exec/score/src/mpci.c b/c/src/exec/score/src/mpci.c index 26c27ae733..ee72d6c396 100644 --- a/c/src/exec/score/src/mpci.c +++ b/c/src/exec/score/src/mpci.c @@ -14,16 +14,20 @@ */ #include <rtems/system.h> -#include <rtems/config.h> -#include <rtems/cpu.h> -#include <rtems/fatal.h> -#include <rtems/mpci.h> -#include <rtems/mppkt.h> -#include <rtems/states.h> -#include <rtems/thread.h> -#include <rtems/threadq.h> -#include <rtems/tqdata.h> -#include <rtems/watchdog.h> +#include <rtems/core/cpu.h> +#include <rtems/core/interr.h> +#include <rtems/core/mpci.h> +#include <rtems/core/mppkt.h> +#include <rtems/core/states.h> +#include <rtems/core/thread.h> +#include <rtems/core/threadq.h> +#include <rtems/core/tqdata.h> +#include <rtems/core/watchdog.h> +#include <rtems/sysstate.h> + +#include <rtems/core/coresem.h> + +#include <rtems/rtems/status.h> /* XXX for TIMEOUT */ /*PAGE * @@ -32,14 +36,38 @@ * This subprogram performs the initialization necessary for this handler. */ -void _MPCI_Handler_initialization ( void ) +void _MPCI_Handler_initialization( + MPCI_Control *users_mpci_table +) { + CORE_semaphore_Attributes attributes; + + if ( _System_state_Is_multiprocessing && !users_mpci_table ) + _Internal_error_Occurred( + INTERNAL_ERROR_CORE, + TRUE, + INTERNAL_ERROR_NO_MPCI + ); + + _MPCI_table = users_mpci_table; + + attributes.discipline = CORE_SEMAPHORE_DISCIPLINES_FIFO; + + _CORE_semaphore_Initialize( + &_MPCI_Semaphore, + OBJECTS_NO_CLASS, /* free floating semaphore */ + &attributes, /* the_semaphore_attributes */ + 0, /* initial_value */ + NULL /* proxy_extract_callout */ + ); + _Thread_queue_Initialize( &_MPCI_Remote_blocked_threads, OBJECTS_NO_CLASS, THREAD_QUEUE_DISCIPLINE_FIFO, STATES_WAITING_FOR_RPC_REPLY, - NULL + NULL, + RTEMS_TIMEOUT ); } @@ -53,11 +81,24 @@ void _MPCI_Handler_initialization ( void ) void _MPCI_Initialization ( void ) { - (*_Configuration_MPCI_table->initialization)( - _Configuration_Table, - &_CPU_Table, - _Configuration_MP_table - ); + (*_MPCI_table->initialization)(); +} + +/*PAGE + * + * _MPCI_Register_packet_processor + * + * This routine registers the MPCI packet processor for the + * designated object class. + */ + +void _MPCI_Register_packet_processor( + Objects_Classes the_class, + MPCI_Packet_processor the_packet_processor + +) +{ + _MPCI_Packet_processors[ the_class ] = the_packet_processor; } /*PAGE @@ -68,14 +109,18 @@ void _MPCI_Initialization ( void ) * MPCI get packet callout. */ -rtems_packet_prefix *_MPCI_Get_packet ( void ) +MP_packet_Prefix *_MPCI_Get_packet ( void ) { - rtems_packet_prefix *the_packet; + MP_packet_Prefix *the_packet; - (*_Configuration_MPCI_table->get_packet)( &the_packet ); + (*_MPCI_table->get_packet)( &the_packet ); if ( the_packet == NULL ) - rtems_fatal_error_occurred( RTEMS_UNSATISFIED ); + _Internal_error_Occurred( + INTERNAL_ERROR_CORE, + TRUE, + INTERNAL_ERROR_OUT_OF_PACKETS + ); /* * Put in a default timeout that will be used for @@ -96,10 +141,10 @@ rtems_packet_prefix *_MPCI_Get_packet ( void ) */ void _MPCI_Return_packet ( - rtems_packet_prefix *the_packet + MP_packet_Prefix *the_packet ) { - (*_Configuration_MPCI_table->return_packet)( the_packet ); + (*_MPCI_table->return_packet)( the_packet ); } /*PAGE @@ -112,15 +157,15 @@ void _MPCI_Return_packet ( void _MPCI_Send_process_packet ( unsigned32 destination, - rtems_packet_prefix *the_packet + MP_packet_Prefix *the_packet ) { the_packet->source_tid = _Thread_Executing->Object.id; the_packet->to_convert = - ( the_packet->to_convert - sizeof(rtems_packet_prefix) ) / + ( the_packet->to_convert - sizeof(MP_packet_Prefix) ) / sizeof(unsigned32); - (*_Configuration_MPCI_table->send_packet)( destination, the_packet ); + (*_MPCI_table->send_packet)( destination, the_packet ); } /*PAGE @@ -131,16 +176,16 @@ void _MPCI_Send_process_packet ( * MPCI send callout. */ -rtems_status_code _MPCI_Send_request_packet ( +unsigned32 _MPCI_Send_request_packet ( unsigned32 destination, - rtems_packet_prefix *the_packet, + MP_packet_Prefix *the_packet, States_Control extra_state ) { the_packet->source_tid = _Thread_Executing->Object.id; the_packet->source_priority = _Thread_Executing->current_priority; the_packet->to_convert = - ( the_packet->to_convert - sizeof(rtems_packet_prefix) ) / + ( the_packet->to_convert - sizeof(MP_packet_Prefix) ) / sizeof(unsigned32); _Thread_Executing->Wait.id = the_packet->id; @@ -149,7 +194,7 @@ rtems_status_code _MPCI_Send_request_packet ( _Thread_Disable_dispatch(); - (*_Configuration_MPCI_table->send_packet)( destination, the_packet ); + (*_MPCI_table->send_packet)( destination, the_packet ); _MPCI_Remote_blocked_threads.sync = TRUE; @@ -158,7 +203,7 @@ rtems_status_code _MPCI_Send_request_packet ( */ if (the_packet->timeout == MPCI_DEFAULT_TIMEOUT) - the_packet->timeout = _Configuration_MPCI_table->default_timeout; + the_packet->timeout = _MPCI_table->default_timeout; _Thread_queue_Enqueue( &_MPCI_Remote_blocked_threads, the_packet->timeout ); @@ -180,12 +225,12 @@ rtems_status_code _MPCI_Send_request_packet ( void _MPCI_Send_response_packet ( unsigned32 destination, - rtems_packet_prefix *the_packet + MP_packet_Prefix *the_packet ) { the_packet->source_tid = _Thread_Executing->Object.id; - (*_Configuration_MPCI_table->send_packet)( destination, the_packet ); + (*_MPCI_table->send_packet)( destination, the_packet ); } /*PAGE @@ -196,11 +241,11 @@ void _MPCI_Send_response_packet ( * MPCI receive callout. */ -rtems_packet_prefix *_MPCI_Receive_packet ( void ) +MP_packet_Prefix *_MPCI_Receive_packet ( void ) { - rtems_packet_prefix *the_packet; + MP_packet_Prefix *the_packet; - (*_Configuration_MPCI_table->receive_packet)( &the_packet ); + (*_MPCI_table->receive_packet)( &the_packet ); return the_packet; } @@ -214,7 +259,7 @@ rtems_packet_prefix *_MPCI_Receive_packet ( void ) */ Thread_Control *_MPCI_Process_response ( - rtems_packet_prefix *the_packet + MP_packet_Prefix *the_packet ) { Thread_Control *the_thread; @@ -236,4 +281,66 @@ Thread_Control *_MPCI_Process_response ( return the_thread; } +/*PAGE + * + * _MPCI_Receive_server + * + */ + +void _MPCI_Receive_server( void ) +{ + + MP_packet_Prefix *the_packet; + MPCI_Packet_processor the_function; + Thread_Control *executing; + + executing = _Thread_Executing; + _MPCI_Receive_server_tcb = executing; + + for ( ; ; ) { + + executing->receive_packet = NULL; + + _Thread_Disable_dispatch(); + _CORE_semaphore_Seize( &_MPCI_Semaphore, 0, TRUE, WATCHDOG_NO_TIMEOUT ); + _Thread_Enable_dispatch(); + + for ( ; ; ) { + the_packet = _MPCI_Receive_packet(); + + if ( !the_packet ) + break; + + executing->receive_packet = the_packet; + + if ( !_Mp_packet_Is_valid_packet_class ( the_packet->the_class ) ) + break; + + the_function = _MPCI_Packet_processors[ the_packet->the_class ]; + + if ( !the_function ) + _Internal_error_Occurred( + INTERNAL_ERROR_CORE, + TRUE, + INTERNAL_ERROR_BAD_PACKET + ); + + (*the_function)( the_packet ); + } + } +} + +/*PAGE + * + * _MPCI_Announce + * + */ + +void _MPCI_Announce ( void ) +{ + _Thread_Disable_dispatch(); + (void) _CORE_semaphore_Surrender( &_MPCI_Semaphore, 0, 0 ); + _Thread_Enable_dispatch(); +} + /* end of file */ diff --git a/c/src/exec/score/src/object.c b/c/src/exec/score/src/object.c index b274579736..7ff6aa5204 100644 --- a/c/src/exec/score/src/object.c +++ b/c/src/exec/score/src/object.c @@ -14,12 +14,12 @@ */ #include <rtems/system.h> -#include <rtems/chain.h> -#include <rtems/config.h> -#include <rtems/object.h> +#include <rtems/core/chain.h> +#include <rtems/core/object.h> #include <rtems/objectmp.h> -#include <rtems/thread.h> -#include <rtems/wkspace.h> +#include <rtems/core/thread.h> +#include <rtems/core/wkspace.h> +#include <rtems/sysstate.h> /*PAGE * @@ -29,6 +29,7 @@ * * Input parameters: * node - local node + * maximum_nodes - number of nodes in the system * maximum_global_objects - number of configured global objects * * Output parameters: NONE @@ -36,12 +37,25 @@ void _Objects_Handler_initialization( unsigned32 node, + unsigned32 maximum_nodes, unsigned32 maximum_global_objects ) { - _Objects_Local_node = node; + if ( node < 1 || node > maximum_nodes ) + _Internal_error_Occurred( + INTERNAL_ERROR_CORE, + TRUE, + INTERNAL_ERROR_INVALID_NODE + ); + + _Objects_Local_node = node; + _Objects_Maximum_nodes = maximum_nodes; - _Objects_MP_Handler_initialization( maximum_global_objects ); + _Objects_MP_Handler_initialization( + node, + maximum_nodes, + maximum_global_objects + ); } /*PAGE @@ -166,15 +180,13 @@ void _Objects_Initialize_information( * Take care of multiprocessing */ - if ( supports_global == TRUE && _Configuration_Is_multiprocessing() ) { + if ( supports_global == TRUE && _System_state_Is_multiprocessing ) { information->global_table = _Workspace_Allocate_or_fatal_error( - (_Configuration_MP_table->maximum_nodes + 1) * sizeof(Chain_Control) + (_Objects_Maximum_nodes + 1) * sizeof(Chain_Control) ); - for ( index=1; - index <= _Configuration_MP_table->maximum_nodes ; - index++ ) + for ( index=1; index <= _Objects_Maximum_nodes ; index++ ) _Chain_Initialize_empty( &information->global_table[ index ] ); } else @@ -308,12 +320,12 @@ boolean _Objects_Compare_name_raw( * id - address of return ID * * Output parameters: - * obj_id - object id - * RTEMS_SUCCESSFUL - if successful - * error code - if unsuccessful + * id - object id + * OBJECTS_SUCCESSFUL - if successful + * error code - if unsuccessful */ -rtems_status_code _Objects_Name_to_id( +Objects_Name_to_id_errors _Objects_Name_to_id( Objects_Information *information, Objects_Name name, unsigned32 node, @@ -328,12 +340,12 @@ rtems_status_code _Objects_Name_to_id( Objects_Name_comparators compare_them; if ( name == 0 ) - return( RTEMS_INVALID_NAME ); + return OBJECTS_INVALID_NAME; search_local_node = FALSE; if ( information->maximum != 0 && - (node == RTEMS_SEARCH_ALL_NODES || node == RTEMS_SEARCH_LOCAL_NODE || + (node == OBJECTS_SEARCH_ALL_NODES || node == OBJECTS_SEARCH_LOCAL_NODE || _Objects_Is_local_node( node ) ) ) search_local_node = TRUE; @@ -354,13 +366,13 @@ rtems_status_code _Objects_Name_to_id( if ( (*compare_them)( name, the_object->name, name_length ) ) { *id = the_object->id; - return( RTEMS_SUCCESSFUL ); + return OBJECTS_SUCCESSFUL; } } } - if ( _Objects_Is_local_node( node ) || node == RTEMS_SEARCH_LOCAL_NODE ) - return( RTEMS_INVALID_NAME ); + if ( _Objects_Is_local_node( node ) || node == OBJECTS_SEARCH_LOCAL_NODE ) + return OBJECTS_INVALID_NAME; return ( _Objects_MP_Global_name_search( information, name, node, id ) ); } @@ -449,14 +461,14 @@ _Objects_Get_next( Objects_Control *object; Objects_Id next_id; - if (rtems_get_index(id) == RTEMS_OBJECT_ID_INITIAL_INDEX) + if (_Objects_Get_index(id) == OBJECTS_ID_INITIAL_INDEX) next_id = information->minimum_id; else next_id = id; do { /* walked off end of list? */ - if (rtems_get_index(next_id) > information->maximum) + if (_Objects_Get_index(next_id) > information->maximum) { *location_p = OBJECTS_ERROR; goto final; @@ -473,7 +485,7 @@ _Objects_Get_next( return object; final: - *next_id_p = RTEMS_OBJECT_ID_FINAL; + *next_id_p = OBJECTS_ID_FINAL; return 0; } @@ -490,7 +502,7 @@ Objects_Information *_Objects_Get_information( { Objects_Classes the_class; - the_class = rtems_get_class( id ); + the_class = _Objects_Get_class( id ); if ( !_Objects_Is_class_valid( the_class ) ) return NULL; diff --git a/c/src/exec/score/src/objectmp.c b/c/src/exec/score/src/objectmp.c index 9752aadbc6..a7c1eff58c 100644 --- a/c/src/exec/score/src/objectmp.c +++ b/c/src/exec/score/src/objectmp.c @@ -14,9 +14,10 @@ */ #include <rtems/system.h> -#include <rtems/object.h> -#include <rtems/wkspace.h> -#include <rtems/config.h> +#include <rtems/core/interr.h> +#include <rtems/core/object.h> +#include <rtems/core/wkspace.h> +#include <rtems/rtems/support.h> /*PAGE * @@ -25,9 +26,12 @@ */ void _Objects_MP_Handler_initialization ( - unsigned32 maximum_global_objects + unsigned32 node, + unsigned32 maximum_nodes, + unsigned32 maximum_global_objects ) { + _Objects_MP_Maximum_global_objects = maximum_global_objects; if ( maximum_global_objects == 0 ) { _Chain_Initialize_empty( &_Objects_MP_Inactive_global_objects ); @@ -62,7 +66,7 @@ void _Objects_MP_Open ( the_global_object->name = the_name; _Chain_Prepend( - &information->global_table[ rtems_get_node( the_id ) ], + &information->global_table[ _Objects_Get_node( the_id ) ], &the_global_object->Object.Node ); @@ -89,7 +93,11 @@ boolean _Objects_MP_Allocate_and_open ( if ( is_fatal_error == FALSE ) return FALSE; - rtems_fatal_error_occurred( RTEMS_TOO_MANY ); + _Internal_error_Occurred( + INTERNAL_ERROR_CORE, + TRUE, + INTERNAL_ERROR_OUT_OF_GLOBAL_OBJECTS + ); } @@ -113,7 +121,7 @@ void _Objects_MP_Close ( Chain_Node *the_node; Objects_MP_Control *the_object; - the_chain = &information->global_table[ rtems_get_node( the_id ) ]; + the_chain = &information->global_table[ _Objects_Get_node( the_id ) ]; for ( the_node = the_chain->first ; !_Chain_Is_tail( the_chain, the_node ) ; @@ -132,9 +140,11 @@ void _Objects_MP_Close ( } - rtems_fatal_error_occurred( RTEMS_INVALID_ID ); - - + _Internal_error_Occurred( + INTERNAL_ERROR_CORE, + TRUE, + INTERNAL_ERROR_INVALID_GLOBAL_ID + ); } /*PAGE @@ -143,7 +153,7 @@ void _Objects_MP_Close ( * */ -rtems_status_code _Objects_MP_Global_name_search ( +Objects_Name_to_id_errors _Objects_MP_Global_name_search ( Objects_Information *information, Objects_Name the_name, unsigned32 nodes_to_search, @@ -158,17 +168,16 @@ rtems_status_code _Objects_MP_Global_name_search ( Objects_MP_Control *the_object; unsigned32 name_to_use = *(unsigned32 *)the_name; /* XXX variable */ - - if ( nodes_to_search > _Configuration_MP_table->maximum_nodes ) - return ( RTEMS_INVALID_NODE ); + if ( nodes_to_search > _Objects_Maximum_nodes ) + return OBJECTS_INVALID_NODE; if ( information->global_table == NULL ) - return ( RTEMS_INVALID_NAME ); + return OBJECTS_INVALID_NAME; - if ( nodes_to_search == RTEMS_SEARCH_ALL_NODES || - nodes_to_search == RTEMS_SEARCH_OTHER_NODES ) { + if ( nodes_to_search == OBJECTS_SEARCH_ALL_NODES || + nodes_to_search == OBJECTS_SEARCH_OTHER_NODES ) { low_node = 1; - high_node = _Configuration_MP_table->maximum_nodes; + high_node = _Objects_Maximum_nodes; } else { low_node = high_node = nodes_to_search; @@ -195,14 +204,14 @@ rtems_status_code _Objects_MP_Global_name_search ( if ( the_object->name == name_to_use ) { *the_id = the_object->Object.id; _Thread_Enable_dispatch(); - return ( RTEMS_SUCCESSFUL ); + return OBJECTS_SUCCESSFUL; } } } } _Thread_Enable_dispatch(); - return ( RTEMS_INVALID_NAME ); + return OBJECTS_INVALID_NAME; } /*PAGE @@ -223,7 +232,7 @@ void _Objects_MP_Is_remote ( Chain_Node *the_node; Objects_MP_Control *the_global_object; - node = rtems_get_node( the_id ); + node = _Objects_Get_node( the_id ); /* * NOTE: The local node was search (if necessary) by @@ -235,7 +244,7 @@ void _Objects_MP_Is_remote ( if ( node == 0 || _Objects_Is_local_node( node ) || - node > _Configuration_MP_table->maximum_nodes || + node > _Objects_Maximum_nodes || information->global_table == NULL ) { *location = OBJECTS_ERROR; diff --git a/c/src/exec/score/src/thread.c b/c/src/exec/score/src/thread.c index dfc5324cb8..d507e8e075 100644 --- a/c/src/exec/score/src/thread.c +++ b/c/src/exec/score/src/thread.c @@ -14,19 +14,17 @@ */ #include <rtems/system.h> -#include <rtems/config.h> -#include <rtems/context.h> -#include <rtems/fatal.h> -#include <rtems/init.h> -#include <rtems/intthrd.h> -#include <rtems/isr.h> -#include <rtems/modes.h> -#include <rtems/object.h> -#include <rtems/priority.h> -#include <rtems/states.h> -#include <rtems/thread.h> -#include <rtems/userext.h> -#include <rtems/wkspace.h> +#include <rtems/core/context.h> +#include <rtems/core/interr.h> +#include <rtems/core/intthrd.h> +#include <rtems/core/isr.h> +#include <rtems/core/object.h> +#include <rtems/core/priority.h> +#include <rtems/core/states.h> +#include <rtems/core/thread.h> +#include <rtems/core/threadq.h> +#include <rtems/core/userext.h> +#include <rtems/core/wkspace.h> /*PAGE * @@ -43,6 +41,7 @@ void _Thread_Handler_initialization( unsigned32 ticks_per_timeslice, + unsigned32 maximum_extensions, unsigned32 maximum_proxies ) { @@ -53,14 +52,16 @@ void _Thread_Handler_initialization( _Thread_Heir = NULL; _Thread_Allocated_fp = NULL; + _Thread_Maximum_extensions = maximum_extensions; + _Thread_Ticks_remaining_in_timeslice = ticks_per_timeslice; _Thread_Ticks_per_timeslice = ticks_per_timeslice; _Thread_Ready_chain = _Workspace_Allocate_or_fatal_error( - (RTEMS_MAXIMUM_PRIORITY + 1) * sizeof(Chain_Control) + (PRIORITY_MAXIMUM + 1) * sizeof(Chain_Control) ); - for ( index=0; index <= RTEMS_MAXIMUM_PRIORITY ; index++ ) + for ( index=0; index <= PRIORITY_MAXIMUM ; index++ ) _Chain_Initialize_empty( &_Thread_Ready_chain[ index ] ); _Thread_MP_Handler_initialization( maximum_proxies ); @@ -145,8 +146,6 @@ void _Thread_Dispatch( void ) Thread_Control *executing; Thread_Control *heir; ISR_Level level; - rtems_signal_set signal_set; - Modes_Control previous_mode; executing = _Thread_Executing; _ISR_Disable( level ); @@ -157,7 +156,7 @@ void _Thread_Dispatch( void ) _Thread_Executing = heir; _ISR_Enable( level ); - _User_extensions_Task_switch( executing, heir ); + _User_extensions_Thread_switch( executing, heir ); _Thread_Ticks_remaining_in_timeslice = _Thread_Ticks_per_timeslice; @@ -194,30 +193,16 @@ void _Thread_Dispatch( void ) _Context_Switch( &executing->Registers, &heir->Registers ); executing = _Thread_Executing; + _ISR_Disable( level ); } _Thread_Dispatch_disable_level = 0; - if ( _ASR_Are_signals_pending( &executing->RTEMS_API->Signal ) ) { - signal_set = executing->RTEMS_API->Signal.signals_posted; - executing->RTEMS_API->Signal.signals_posted = 0; - _ISR_Enable( level ); - - executing->RTEMS_API->Signal.nest_level += 1; - if (_Thread_Change_mode( executing->RTEMS_API->Signal.mode_set, - RTEMS_ALL_MODE_MASKS, &previous_mode )) - _Thread_Dispatch(); - - (*executing->RTEMS_API->Signal.handler)( signal_set ); + _ISR_Enable( level ); - executing->RTEMS_API->Signal.nest_level -= 1; - if (_Thread_Change_mode( previous_mode, - RTEMS_ALL_MODE_MASKS, &previous_mode )) - _Thread_Dispatch(); - } - else - _ISR_Enable( level ); + _User_extensions_Thread_post_switch( executing ); + } /*PAGE @@ -234,7 +219,9 @@ boolean _Thread_Initialize( unsigned32 stack_size, /* insure it is >= min */ boolean is_fp, /* TRUE if thread uses FP */ Priority_Control priority, - Modes_Control mode, + boolean is_preemptible, + boolean is_timeslice, + unsigned32 isr_level, Objects_Name name ) @@ -242,13 +229,14 @@ boolean _Thread_Initialize( unsigned32 actual_stack_size; void *stack; void *fp_area; + void *extensions_area; /* * Allocate and Initialize the stack for this thread. */ if ( !_Stack_Is_enough( stack_size ) ) - actual_stack_size = RTEMS_MINIMUM_STACK_SIZE; + actual_stack_size = STACK_MINIMUM_SIZE; else actual_stack_size = stack_size; @@ -279,7 +267,8 @@ boolean _Thread_Initialize( fp_area = _Workspace_Allocate( CONTEXT_FP_SIZE ); if ( !fp_area ) { - (void) _Workspace_Free( stack ); + if ( the_thread->Start.stack ) + (void) _Workspace_Free( the_thread->Start.stack ); return FALSE; } fp_area = _Context_Fp_start( fp_area, 0 ); @@ -290,45 +279,42 @@ boolean _Thread_Initialize( the_thread->fp_context = fp_area; the_thread->Start.fp_context = fp_area; -/* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ + /* - * Allocate and initialize the RTEMS API specific information + * Allocate the floating point area for this thread */ - - the_thread->RTEMS_API = _Workspace_Allocate( sizeof( RTEMS_API_Control ) ); - - if ( !the_thread->RTEMS_API ) { -/* XXX when in task_create - _RTEMS_tasks_Free( the_thread ); - _Objects_MP_Free_global_object( the_global_object ); - - _Thread_Enable_dispatch(); - return( RTEMS_UNSATISFIED ); -*/ - (void) _Workspace_Free( stack ); - (void) _Workspace_Free( fp_area ); - return FALSE; - - } - - the_thread->RTEMS_API->is_global = FALSE; - the_thread->RTEMS_API->pending_events = EVENT_SETS_NONE_PENDING; - _ASR_Initialize( &the_thread->RTEMS_API->Signal ); - /* XXX should not be here .... */ - -/* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ + if ( _Thread_Maximum_extensions ) { + extensions_area = _Workspace_Allocate( + (_Thread_Maximum_extensions + 1) * sizeof( void * ) + ); + + if ( !extensions_area ) { + if ( fp_area ) + (void) _Workspace_Free( fp_area ); + + if ( the_thread->Start.stack ) + (void) _Workspace_Free( the_thread->Start.stack ); + + return FALSE; + } + } else + extensions_area = NULL; + + the_thread->extensions = extensions_area; /* * General initialization */ + the_thread->Start.is_preemptible = is_preemptible; + the_thread->Start.is_timeslice = is_timeslice; + the_thread->Start.isr_level = isr_level; + the_thread->current_state = STATES_DORMANT; - the_thread->current_modes = mode; the_thread->resource_count = 0; the_thread->real_priority = priority; the_thread->Start.initial_priority = priority; - the_thread->Start.initial_modes = mode; _Thread_Set_priority( the_thread, priority ); @@ -342,10 +328,22 @@ boolean _Thread_Initialize( * Invoke create extensions */ - _User_extensions_Task_create( the_thread ); - /* XXX if this fails ... */ + if ( !_User_extensions_Thread_create( the_thread ) ) { + + if ( extensions_area ) + (void) _Workspace_Free( extensions_area ); + + if ( fp_area ) + (void) _Workspace_Free( fp_area ); + + if ( the_thread->Start.stack ) + (void) _Workspace_Free( the_thread->Start.stack ); + + return FALSE; + } return TRUE; + } /* @@ -376,7 +374,7 @@ boolean _Thread_Start( _Thread_Ready( the_thread ); - _User_extensions_Task_start( the_thread ); + _User_extensions_Thread_start( the_thread ); return TRUE; } @@ -403,7 +401,8 @@ boolean _Thread_Restart( _Thread_Set_transient( the_thread ); the_thread->resource_count = 0; - the_thread->current_modes = the_thread->Start.initial_modes; + the_thread->is_preemptible = the_thread->Start.is_preemptible; + the_thread->is_timeslice = the_thread->Start.is_timeslice; the_thread->Start.pointer_argument = pointer_argument; the_thread->Start.numeric_argument = numeric_argument; @@ -423,7 +422,7 @@ boolean _Thread_Restart( _Thread_Ready( the_thread ); - _User_extensions_Task_restart( the_thread ); + _User_extensions_Thread_restart( the_thread ); if ( _Thread_Is_executing ( the_thread ) ) _Thread_Restart_self(); @@ -457,7 +456,7 @@ void _Thread_Close( (void) _Watchdog_Remove( &the_thread->Timer ); } - _User_extensions_Task_delete( the_thread ); + _User_extensions_Thread_delete( the_thread ); #if ( CPU_USE_DEFERRED_FP_SWITCH == TRUE ) if ( _Thread_Is_allocated_fp( the_thread ) ) @@ -469,6 +468,9 @@ void _Thread_Close( if ( the_thread->Start.stack ) (void) _Workspace_Free( the_thread->Start.stack ); + + if ( the_thread->extensions ) + (void) _Workspace_Free( the_thread->extensions ); } /*PAGE @@ -512,8 +514,7 @@ void _Thread_Ready( heir = _Thread_Heir; - if ( !_Thread_Is_executing( heir ) && - _Modes_Is_preempt( _Thread_Executing->current_modes ) ) + if ( !_Thread_Is_executing( heir ) && _Thread_Executing->is_preemptible ) _Context_Switch_necessary = TRUE; _ISR_Enable( level ); @@ -559,7 +560,7 @@ void _Thread_Clear_state( if ( the_thread->current_priority < _Thread_Heir->current_priority ) { _Thread_Heir = the_thread; - if ( _Modes_Is_preempt( _Thread_Executing->current_modes ) || + if ( _Thread_Executing->is_preemptible || the_thread->current_priority == 0 ) _Context_Switch_necessary = TRUE; } @@ -729,9 +730,12 @@ void _Thread_Reset_timeslice( void ) void _Thread_Tickle_timeslice( void ) { - if ( ( _Modes_Is_timeslice(_Thread_Executing->current_modes) ) && - ( _States_Is_ready( _Thread_Executing->current_state ) ) && - ( --_Thread_Ticks_remaining_in_timeslice == 0 ) ) { + if ( !_Thread_Executing->is_timeslice || + !_Thread_Executing->is_preemptible || + !_States_Is_ready( _Thread_Executing->current_state ) ) + return; + + if ( --_Thread_Ticks_remaining_in_timeslice == 0 ) { _Thread_Reset_timeslice(); } } @@ -803,11 +807,14 @@ void _Thread_Load_environment( _Context_Initialize_fp( &the_thread->fp_context ); } + the_thread->is_preemptible = the_thread->Start.is_preemptible; + the_thread->is_timeslice = the_thread->Start.is_timeslice; + _Context_Initialize( &the_thread->Registers, the_thread->Start.Initial_stack.area, the_thread->Start.Initial_stack.size, - _Modes_Get_interrupt_level( the_thread->Start.initial_modes ), + the_thread->Start.isr_level, _Thread_Handler ); @@ -838,7 +845,7 @@ void _Thread_Handler( void ) * disabled until all 'begin' extensions complete. */ - _User_extensions_Task_begin( executing ); + _User_extensions_Thread_begin( executing ); /* * At this point, the dispatch disable level BETTER be 1. @@ -846,7 +853,7 @@ void _Thread_Handler( void ) _Thread_Enable_dispatch(); - switch ( executing->Start.prototype ) { + switch ( executing->Start.prototype ) { case THREAD_START_NUMERIC: (*executing->Start.entry_point)( executing->Start.numeric_argument ); break; @@ -867,9 +874,13 @@ void _Thread_Handler( void ) break; } - _User_extensions_Task_exitted( executing ); + _User_extensions_Thread_exitted( executing ); - rtems_fatal_error_occurred( RTEMS_TASK_EXITTED ); + _Internal_error_Occurred( + INTERNAL_ERROR_CORE, + TRUE, + INTERNAL_ERROR_THREAD_EXITTED + ); } /*PAGE @@ -953,7 +964,7 @@ void _Thread_Change_priority( _Thread_Calculate_heir(); if ( !_Thread_Is_executing_also_the_heir() && - _Modes_Is_preempt(_Thread_Executing->current_modes) ) + _Thread_Executing->is_preemptible ) _Context_Switch_necessary = TRUE; _ISR_Enable( level ); @@ -986,60 +997,24 @@ void _Thread_Set_priority( /*PAGE * - * _Thread_Change_mode - * - * This routine enables and disables several modes of - * execution for the requesting thread. - * - * Input parameters: - * mode - new mode - * mask - mask - * old_mode_set - address of previous mode + * _Thread_Evaluate_mode * - * Output: - * *old_mode_set - previous mode - * returns TRUE if scheduling necessary - * - * INTERRUPT LATENCY: - * only one case + * XXX */ -boolean _Thread_Change_mode( - Modes_Control new_mode_set, - Modes_Control mask, - Modes_Control *old_mode_set -) +boolean _Thread_Evaluate_mode( void ) { - Modes_Control changed; - Modes_Control threads_new_mode_set; - Thread_Control *executing; - boolean need_dispatch; - - executing = _Thread_Executing; - *old_mode_set = executing->current_modes; - - _Modes_Change( executing->current_modes, - new_mode_set, mask, &threads_new_mode_set, &changed ); + Thread_Control *executing; - _Modes_Set_interrupt_level( threads_new_mode_set ); - - if ( _Modes_Mask_changed( changed, RTEMS_ASR_MASK ) ) - _ASR_Swap_signals( &executing->RTEMS_API->Signal ); - - executing->current_modes = threads_new_mode_set; - need_dispatch = TRUE; + executing = _Thread_Executing; if ( !_States_Is_ready( executing->current_state ) || - ( !_Thread_Is_heir( executing ) && - _Modes_Is_preempt(threads_new_mode_set) ) ) - - _Context_Switch_necessary = TRUE; - - else if ( !_ASR_Are_signals_pending( &executing->RTEMS_API->Signal ) ) - - need_dispatch = FALSE; + ( !_Thread_Is_heir( executing ) && executing->is_preemptible ) ) { + _Context_Switch_necessary = TRUE; + return TRUE; + } - return need_dispatch; + return FALSE; } /*PAGE @@ -1068,7 +1043,7 @@ STATIC INLINE Thread_Control *_Thread_Get ( return( _Thread_Executing ); } - the_class = rtems_get_class( id ); + the_class = _Objects_Get_class( id ); if ( the_class > OBJECTS_CLASSES_LAST ) { *location = OBJECTS_ERROR; diff --git a/c/src/exec/score/src/threadmp.c b/c/src/exec/score/src/threadmp.c index f2b78cd8cd..fe346c0b9c 100644 --- a/c/src/exec/score/src/threadmp.c +++ b/c/src/exec/score/src/threadmp.c @@ -14,9 +14,10 @@ */ #include <rtems/system.h> -#include <rtems/priority.h> -#include <rtems/thread.h> -#include <rtems/wkspace.h> +#include <rtems/core/priority.h> +#include <rtems/core/thread.h> +#include <rtems/core/wkspace.h> +#include <rtems/core/isr.h> /*PAGE * @@ -67,7 +68,7 @@ Thread_Control *_Thread_MP_Allocate_proxy ( the_proxy = (Thread_Proxy_control *) the_thread; - _Thread_Executing->Wait.return_code = RTEMS_PROXY_BLOCKING; + _Thread_Executing->Wait.return_code = THREAD_STATUS_PROXY_BLOCKING; the_proxy->receive_packet = _Thread_MP_Receive->receive_packet; @@ -85,7 +86,11 @@ Thread_Control *_Thread_MP_Allocate_proxy ( return the_thread; } - rtems_fatal_error_occurred( RTEMS_TOO_MANY ); + _Internal_error_Occurred( + INTERNAL_ERROR_CORE, + TRUE, + INTERNAL_ERROR_OUT_OF_PROXIES + ); /* * NOTE: The following return insures that the compiler will diff --git a/c/src/exec/score/src/threadq.c b/c/src/exec/score/src/threadq.c index 7b4647bb7f..ec6f8cc242 100644 --- a/c/src/exec/score/src/threadq.c +++ b/c/src/exec/score/src/threadq.c @@ -14,13 +14,15 @@ */ #include <rtems/system.h> -#include <rtems/chain.h> -#include <rtems/isr.h> -#include <rtems/object.h> -#include <rtems/states.h> -#include <rtems/thread.h> -#include <rtems/threadq.h> -#include <rtems/tqdata.h> +#include <rtems/core/chain.h> +#include <rtems/core/isr.h> +#include <rtems/core/object.h> +#include <rtems/core/states.h> +#include <rtems/core/thread.h> +#include <rtems/core/threadq.h> +#include <rtems/core/tqdata.h> + +#include <rtems/rtems/status.h> /*PAGE * @@ -29,10 +31,12 @@ * This routine initializes the specified threadq. * * Input parameters: - * the_thread_queue - pointer to a threadq header - * the_class - class of the object to which this belongs - * discipline - queueing discipline - * state - state of waiting threads + * the_thread_queue - pointer to a threadq header + * the_class - class of the object to which this belongs + * discipline - queueing discipline + * state - state of waiting threads + * proxy_extract_callout - MP specific callout + * timeout_status - return on a timeout * * Output parameters: NONE */ @@ -42,15 +46,17 @@ void _Thread_queue_Initialize( Objects_Classes the_class, Thread_queue_Disciplines the_discipline, States_Control state, - Thread_queue_Extract_callout proxy_extract_callout + Thread_queue_Extract_callout proxy_extract_callout, + unsigned32 timeout_status ) { unsigned32 index; _Thread_queue_Extract_table[ the_class ] = proxy_extract_callout; - the_thread_queue->state = state; - the_thread_queue->discipline = the_discipline; + the_thread_queue->state = state; + the_thread_queue->discipline = the_discipline; + the_thread_queue->timeout_status = timeout_status; switch ( the_discipline ) { case THREAD_QUEUE_DISCIPLINE_FIFO: @@ -85,14 +91,14 @@ void _Thread_queue_Initialize( void _Thread_queue_Enqueue( Thread_queue_Control *the_thread_queue, - rtems_interval timeout + Watchdog_Interval timeout ) { Thread_Control *the_thread; the_thread = _Thread_Executing; - if ( _Thread_MP_Is_receive( the_thread ) ) + if ( _Thread_MP_Is_receive( the_thread ) && the_thread->receive_packet ) the_thread = _Thread_MP_Allocate_proxy( the_thread_queue->state ); else _Thread_Set_state( the_thread, the_thread_queue->state ); @@ -128,7 +134,7 @@ void _Thread_queue_Enqueue( * _Thread_queue_Dequeue * * This routine removes a thread from the specified threadq. If the - * threadq discipline is RTEMS_FIFO, it unblocks a thread, and cancels its + * threadq discipline is FIFO, it unblocks a thread, and cancels its * timeout timer. Priority discipline is processed elsewhere. * * Input parameters: @@ -139,7 +145,6 @@ void _Thread_queue_Enqueue( * * INTERRUPT LATENCY: * check sync - * RTEMS_FIFO */ Thread_Control *_Thread_queue_Dequeue( @@ -200,7 +205,7 @@ boolean _Thread_queue_Extract_with_proxy( if ( _States_Is_waiting_for_rpc_reply( state ) && _States_Is_locally_blocked( state ) ) { - the_class = rtems_get_class( the_thread->Wait.id ); + the_class = _Objects_Get_class( the_thread->Wait.id ); proxy_extract_callout = _Thread_queue_Extract_table[ the_class ]; @@ -252,21 +257,24 @@ void _Thread_queue_Extract( * This kernel routine flushes the given thread queue. * * Input parameters: - * the_thread_queue - pointer to threadq to be flushed + * the_thread_queue - pointer to threadq to be flushed + * remote_extract_callout - pointer to routine which extracts a remote thread + * status - status to return to the thread * * Output parameters: NONE */ void _Thread_queue_Flush( Thread_queue_Control *the_thread_queue, - Thread_queue_Flush_callout remote_extract_callout + Thread_queue_Flush_callout remote_extract_callout, + unsigned32 status ) { Thread_Control *the_thread; while ( (the_thread = _Thread_queue_Dequeue( the_thread_queue )) ) { if ( _Objects_Is_local_id( the_thread->Object.id ) ) - the_thread->Wait.return_code = RTEMS_OBJECT_WAS_DELETED; + the_thread->Wait.return_code = status; else ( *remote_extract_callout )( the_thread ); } @@ -334,7 +342,7 @@ void _Thread_queue_Timeout( case OBJECTS_REMOTE: /* impossible */ break; case OBJECTS_LOCAL: - the_thread->Wait.return_code = RTEMS_TIMEOUT; + the_thread->Wait.return_code = the_thread->Wait.queue->timeout_status; _Thread_queue_Extract( the_thread->Wait.queue, the_thread ); _Thread_Unnest_dispatch(); break; @@ -362,7 +370,7 @@ void _Thread_queue_Timeout( void _Thread_queue_Enqueue_fifo ( Thread_queue_Control *the_thread_queue, Thread_Control *the_thread, - rtems_interval timeout + Watchdog_Interval timeout ) { ISR_Level level; @@ -376,7 +384,7 @@ void _Thread_queue_Enqueue_fifo ( &the_thread->Object.Node ); - if ( timeout != RTEMS_NO_TIMEOUT ) + if ( timeout != WATCHDOG_NO_TIMEOUT ) _Watchdog_Activate( &the_thread->Timer ); _ISR_Enable( level ); @@ -412,7 +420,7 @@ void _Thread_queue_Enqueue_fifo ( * * INTERRUPT LATENCY: * check sync - * RTEMS_FIFO + * FIFO */ Thread_Control *_Thread_queue_Dequeue_fifo( @@ -541,7 +549,7 @@ Thread_Control *_Thread_queue_First_fifo( void _Thread_queue_Enqueue_priority( Thread_queue_Control *the_thread_queue, Thread_Control *the_thread, - rtems_interval timeout + Watchdog_Interval timeout ) { Priority_Control search_priority; @@ -567,7 +575,7 @@ void _Thread_queue_Enqueue_priority( goto restart_reverse_search; restart_forward_search: - search_priority = RTEMS_MINIMUM_PRIORITY - 1; + search_priority = PRIORITY_MINIMUM - 1; _ISR_Disable( level ); search_thread = (Thread_Control *) header->first; while ( !_Chain_Is_tail( header, (Chain_Node *)search_thread ) ) { @@ -595,7 +603,7 @@ restart_forward_search: goto syncronize; the_thread_queue->sync = FALSE; - if ( timeout != RTEMS_NO_TIMEOUT ) + if ( timeout != WATCHDOG_NO_TIMEOUT ) _Watchdog_Activate( &the_thread->Timer ); if ( priority == search_priority ) @@ -613,7 +621,7 @@ restart_forward_search: return; restart_reverse_search: - search_priority = RTEMS_MAXIMUM_PRIORITY + 1; + search_priority = PRIORITY_MAXIMUM + 1; _ISR_Disable( level ); search_thread = (Thread_Control *) header->last; @@ -641,7 +649,7 @@ restart_reverse_search: goto syncronize; the_thread_queue->sync = FALSE; - if ( timeout != RTEMS_NO_TIMEOUT ) + if ( timeout != WATCHDOG_NO_TIMEOUT ) _Watchdog_Activate( &the_thread->Timer ); if ( priority == search_priority ) @@ -688,7 +696,7 @@ syncronize: * * _Thread_queue_Dequeue_priority * - * This routine removes a thread from the specified RTEMS_PRIORITY based + * This routine removes a thread from the specified PRIORITY based * threadq, unblocks it, and cancels its timeout timer. * * Input parameters: diff --git a/c/src/exec/score/src/tod.c b/c/src/exec/score/src/tod.c index 4689c637d7..ab464664f6 100644 --- a/c/src/exec/score/src/tod.c +++ b/c/src/exec/score/src/tod.c @@ -14,10 +14,10 @@ */ #include <rtems/system.h> -#include <rtems/object.h> -#include <rtems/thread.h> -#include <rtems/tod.h> -#include <rtems/watchdog.h> +#include <rtems/core/object.h> +#include <rtems/core/thread.h> +#include <rtems/core/tod.h> +#include <rtems/core/watchdog.h> /*PAGE * @@ -72,11 +72,11 @@ void _TOD_Handler_initialization( */ void _TOD_Set( - rtems_time_of_day *the_tod, - rtems_interval seconds_since_epoch + TOD_Control *the_tod, + Watchdog_Interval seconds_since_epoch ) { - rtems_interval ticks_until_next_second; + Watchdog_Interval ticks_until_next_second; _Thread_Disable_dispatch(); _TOD_Deactivate(); @@ -109,14 +109,14 @@ void _TOD_Set( * the_tod - pointer to a time and date structure * * Output parameters: - * RTEMS_SUCCESSFUL - if the date, time, and tick are valid - * RTEMS_INVALID_CLOCK - if the the_tod is invalid + * TRUE - if the date, time, and tick are valid + * FALSE - if the the_tod is invalid * * NOTE: This routine only works for leap-years through 2099. */ -rtems_status_code _TOD_Validate( - rtems_time_of_day *the_tod +boolean _TOD_Validate( + TOD_Control *the_tod ) { unsigned32 days_in_month; @@ -129,7 +129,7 @@ rtems_status_code _TOD_Validate( (the_tod->month > TOD_MONTHS_PER_YEAR) || (the_tod->year < TOD_BASE_YEAR) || (the_tod->day == 0) ) - return RTEMS_INVALID_CLOCK; + return FALSE; if ( (the_tod->year % 4) == 0 ) days_in_month = _TOD_Days_per_month[ 1 ][ the_tod->month ]; @@ -137,9 +137,9 @@ rtems_status_code _TOD_Validate( days_in_month = _TOD_Days_per_month[ 0 ][ the_tod->month ]; if ( the_tod->day > days_in_month ) - return RTEMS_INVALID_CLOCK; + return FALSE; - return RTEMS_SUCCESSFUL; + return TRUE; } /*PAGE @@ -157,7 +157,7 @@ rtems_status_code _TOD_Validate( */ unsigned32 _TOD_To_seconds( - rtems_time_of_day *the_tod + TOD_Control *the_tod ) { unsigned32 time; diff --git a/c/src/exec/score/src/userext.c b/c/src/exec/score/src/userext.c index 7886dbd900..6730e81219 100644 --- a/c/src/exec/score/src/userext.c +++ b/c/src/exec/score/src/userext.c @@ -15,14 +15,14 @@ */ #include <rtems/system.h> -#include <rtems/userext.h> +#include <rtems/core/userext.h> /*PAGE * - * _User_extensions_Task_create + * _User_extensions_Thread_create */ -boolean _User_extensions_Task_create ( +boolean _User_extensions_Thread_create ( Thread_Control *the_thread ) { @@ -36,8 +36,8 @@ boolean _User_extensions_Task_create ( the_extension = (User_extensions_Control *) the_node; - if ( the_extension->Callouts.rtems_task_create != NULL ) { - status = (*the_extension->Callouts.rtems_task_create)( + if ( the_extension->Callouts.thread_create != NULL ) { + status = (*the_extension->Callouts.thread_create)( _Thread_Executing, the_thread ); @@ -51,10 +51,10 @@ boolean _User_extensions_Task_create ( /*PAGE * - * _User_extensions_Task_delete + * _User_extensions_Thread_delete */ -void _User_extensions_Task_delete ( +void _User_extensions_Thread_delete ( Thread_Control *the_thread ) { @@ -67,8 +67,8 @@ void _User_extensions_Task_delete ( the_extension = (User_extensions_Control *) the_node; - if ( the_extension->Callouts.rtems_task_delete != NULL ) - (*the_extension->Callouts.rtems_task_delete)( + if ( the_extension->Callouts.thread_delete != NULL ) + (*the_extension->Callouts.thread_delete)( _Thread_Executing, the_thread ); @@ -77,11 +77,11 @@ void _User_extensions_Task_delete ( /*PAGE * - * _User_extensions_Task_start + * _User_extensions_Thread_start * */ -void _User_extensions_Task_start ( +void _User_extensions_Thread_start ( Thread_Control *the_thread ) { @@ -94,8 +94,8 @@ void _User_extensions_Task_start ( the_extension = (User_extensions_Control *) the_node; - if ( the_extension->Callouts.rtems_task_start != NULL ) - (*the_extension->Callouts.rtems_task_start)( + if ( the_extension->Callouts.thread_start != NULL ) + (*the_extension->Callouts.thread_start)( _Thread_Executing, the_thread ); @@ -104,11 +104,11 @@ void _User_extensions_Task_start ( /*PAGE * - * _User_extensions_Task_restart + * _User_extensions_Thread_restart * */ -void _User_extensions_Task_restart ( +void _User_extensions_Thread_restart ( Thread_Control *the_thread ) { @@ -121,8 +121,8 @@ void _User_extensions_Task_restart ( the_extension = (User_extensions_Control *) the_node; - if ( the_extension->Callouts.rtems_task_restart != NULL ) - (*the_extension->Callouts.rtems_task_restart)( + if ( the_extension->Callouts.thread_restart != NULL ) + (*the_extension->Callouts.thread_restart)( _Thread_Executing, the_thread ); @@ -131,11 +131,11 @@ void _User_extensions_Task_restart ( /*PAGE * - * _User_extensions_Task_begin + * _User_extensions_Thread_begin * */ -void _User_extensions_Task_begin ( +void _User_extensions_Thread_begin ( Thread_Control *executing ) { @@ -148,17 +148,17 @@ void _User_extensions_Task_begin ( the_extension = (User_extensions_Control *) the_node; - if ( the_extension->Callouts.task_begin != NULL ) - (*the_extension->Callouts.task_begin)( executing ); + if ( the_extension->Callouts.thread_begin != NULL ) + (*the_extension->Callouts.thread_begin)( executing ); } } /*PAGE * - * _User_extensions_Task_exitted + * _User_extensions_Thread_exitted */ -void _User_extensions_Task_exitted ( +void _User_extensions_Thread_exitted ( Thread_Control *executing ) { @@ -171,8 +171,8 @@ void _User_extensions_Task_exitted ( the_extension = (User_extensions_Control *) the_node; - if ( the_extension->Callouts.task_exitted != NULL ) - (*the_extension->Callouts.task_exitted)( executing ); + if ( the_extension->Callouts.thread_exitted != NULL ) + (*the_extension->Callouts.thread_exitted)( executing ); } } @@ -182,7 +182,9 @@ void _User_extensions_Task_exitted ( */ void _User_extensions_Fatal ( - unsigned32 the_error + Internal_errors_Source the_source, + boolean is_internal, + unsigned32 the_error ) { Chain_Node *the_node; @@ -195,7 +197,7 @@ void _User_extensions_Fatal ( the_extension = (User_extensions_Control *) the_node; if ( the_extension->Callouts.fatal != NULL ) - (*the_extension->Callouts.fatal)( the_error ); + (*the_extension->Callouts.fatal)( the_source, is_internal, the_error ); } } diff --git a/c/src/exec/score/src/watchdog.c b/c/src/exec/score/src/watchdog.c index 3c46f9b535..53a405d725 100644 --- a/c/src/exec/score/src/watchdog.c +++ b/c/src/exec/score/src/watchdog.c @@ -14,8 +14,8 @@ */ #include <rtems/system.h> -#include <rtems/isr.h> -#include <rtems/watchdog.h> +#include <rtems/core/isr.h> +#include <rtems/core/watchdog.h> /*PAGE * @@ -104,7 +104,7 @@ Watchdog_States _Watchdog_Remove( void _Watchdog_Adjust( Chain_Control *header, Watchdog_Adjust_directions direction, - rtems_interval units + Watchdog_Interval units ) { if ( !_Chain_Is_empty( header ) ) { @@ -144,10 +144,10 @@ void _Watchdog_Insert( Watchdog_Insert_modes insert_mode ) { - ISR_Level level; - Watchdog_Control *after; - unsigned32 insert_isr_nest_level; - rtems_interval delta_interval; + ISR_Level level; + Watchdog_Control *after; + unsigned32 insert_isr_nest_level; + Watchdog_Interval delta_interval; insert_isr_nest_level = _ISR_Nest_level; diff --git a/c/src/exec/score/src/wkspace.c b/c/src/exec/score/src/wkspace.c index 97299540f8..f4be68651c 100644 --- a/c/src/exec/score/src/wkspace.c +++ b/c/src/exec/score/src/wkspace.c @@ -17,8 +17,8 @@ */ #include <rtems/system.h> -#include <rtems/wkspace.h> -#include <rtems/fatal.h> +#include <rtems/core/wkspace.h> +#include <rtems/core/interr.h> /*PAGE * @@ -35,7 +35,11 @@ void *_Workspace_Allocate_or_fatal_error( memory = _Workspace_Allocate( size ); if ( memory == NULL ) - rtems_fatal_error_occurred( RTEMS_UNSATISFIED ); + _Internal_error_Occurred( + INTERNAL_ERROR_CORE, + TRUE, + INTERNAL_ERROR_WORKSPACE_ALLOCATION + ); return memory; } diff --git a/c/src/lib/include/console.h b/c/src/lib/include/console.h index d102c6a1b1..02196de7a9 100644 --- a/c/src/lib/include/console.h +++ b/c/src/lib/include/console.h @@ -22,14 +22,43 @@ extern "C" { #endif #define CONSOLE_DRIVER_TABLE_ENTRY \ - { console_initialize, NULL, NULL, NULL, NULL, NULL } + { console_initialize, console_open, console_close, \ + console_read, console_write, console_control } rtems_device_driver console_initialize( rtems_device_major_number, rtems_device_minor_number, - void *, - rtems_id, - rtems_unsigned32 * + void * +); + +rtems_device_driver console_open( + rtems_device_major_number, + rtems_device_minor_number, + void * +); + +rtems_device_driver console_close( + rtems_device_major_number, + rtems_device_minor_number, + void * +); + +rtems_device_driver console_read( + rtems_device_major_number, + rtems_device_minor_number, + void * +); + +rtems_device_driver console_write( + rtems_device_major_number, + rtems_device_minor_number, + void * +); + +rtems_device_driver console_control( + rtems_device_major_number, + rtems_device_minor_number, + void * ); #ifdef __cplusplus diff --git a/c/src/lib/libbsp/hppa1.1/simhppa/include/bsp.h b/c/src/lib/libbsp/hppa1.1/simhppa/include/bsp.h index 723a66a1e9..8bf036b22e 100644 --- a/c/src/lib/libbsp/hppa1.1/simhppa/include/bsp.h +++ b/c/src/lib/libbsp/hppa1.1/simhppa/include/bsp.h @@ -67,18 +67,6 @@ extern void Clock_delay(rtems_unsigned32 microseconds); Clock_delay(microseconds); /* - * Todo: this should be put somewhere else - */ - -#undef CLOCK_DRIVER_TABLE_ENTRY -#define CLOCK_DRIVER_TABLE_ENTRY { Clock_initialize, NULL, NULL, NULL, NULL, Clock_control } -rtems_device_driver Clock_control( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *pargp -); - -/* * We printf() to a buffer if multiprocessing, *or* if this is set. * ref: src/lib/libbsp/hppa/simhppa/iosupp/consupp.c */ @@ -86,6 +74,10 @@ rtems_device_driver Clock_control( extern int use_print_buffer; /* + * Device Driver Table Entries + */ + +/* * When not doing printf to a buffer, we do printf thru RTEMS libio * and our tty driver. Set it up so that console is right. */ @@ -94,6 +86,10 @@ extern int use_print_buffer; { tty_initialize, tty_open, tty_close, tty_read, tty_write, tty_control } /* + * NOTE: Use the standard Clock driver entry + */ + +/* * How many libio files we want */ #define BSP_LIBIO_MAX_FDS 20 diff --git a/c/src/lib/libbsp/hppa1.1/simhppa/startup/bspstart.c b/c/src/lib/libbsp/hppa1.1/simhppa/startup/bspstart.c index 7e9b70f82e..2620d41df4 100644 --- a/c/src/lib/libbsp/hppa1.1/simhppa/startup/bspstart.c +++ b/c/src/lib/libbsp/hppa1.1/simhppa/startup/bspstart.c @@ -131,7 +131,7 @@ bsp_libc_init(void) RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0); /* - * Init the RTEMS libio facility to provide UNIX-like system + * Init the RTEMS libio facility to provide UNIX-like system * calls for use by newlib (ie: provide __open, __close, etc) * Uses malloc() to get area for the iops, so must be after malloc init */ diff --git a/c/src/lib/libbsp/i386/force386/clock/ckinit.c b/c/src/lib/libbsp/i386/force386/clock/ckinit.c index 45400dbd49..45a64f6f14 100644 --- a/c/src/lib/libbsp/i386/force386/clock/ckinit.c +++ b/c/src/lib/libbsp/i386/force386/clock/ckinit.c @@ -19,33 +19,44 @@ */ #include <bsp.h> -#include <clockdrv.h> + +#include <rtems/libio.h> + #include <stdlib.h> -volatile rtems_unsigned32 Clock_driver_ticks; +#define CLOCK_VECTOR 0x38 + rtems_unsigned32 Clock_isrs; /* ISRs until next tick */ + +volatile rtems_unsigned32 Clock_driver_ticks; + rtems_isr_entry Old_ticker; -rtems_device_driver Clock_initialize( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *pargp, - rtems_id tid, - rtems_unsigned32 *rval -) -{ - Install_clock( Clock_isr ); -} +void Clock_exit( void ); + +/* + * These are set by clock driver during its init + */ + +rtems_device_major_number rtems_clock_major = ~0; +rtems_device_major_number rtems_clock_minor = 0; -void ReInstall_clock( - rtems_isr_entry clock_isr +/* + * This is the ISR handler. + */ + +rtems_isr Clock_isr( + rtems_vector_number vector ) { - rtems_unsigned32 isrlevel = 0; - - rtems_interrupt_disable( isrlevel ); - (void) set_vector( clock_isr, 0x38, 1 ); - rtems_interrupt_enable( isrlevel ); + /* enable_tracing(); */ + Clock_driver_ticks += 1; + if ( Clock_isrs == 1 ) { + rtems_clock_tick(); + Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000; + } + else + Clock_isrs -= 1; } void Install_clock( @@ -56,7 +67,7 @@ void Install_clock( Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000; if ( BSP_Configuration.ticks_per_timeslice ) { - Old_ticker = ( rtems_isr_entry ) set_vector( clock_isr, 0x38, 1 ); + Old_ticker = ( rtems_isr_entry ) set_vector( clock_isr, CLOCK_VECTOR, 1 ); outport_byte( TBCR, 0x14 ); /* reset it, delay mode, 50X */ outport_byte( TBDR, 0x50 ); /* 1 millisecond */ outport_byte( IERA, 0x41 ); /* enable interrupt for B */ @@ -64,6 +75,17 @@ void Install_clock( atexit( Clock_exit ); } +void ReInstall_clock( + rtems_isr_entry clock_isr +) +{ + rtems_unsigned32 isrlevel = 0; + + rtems_interrupt_disable( isrlevel ); + (void) set_vector( clock_isr, CLOCK_VECTOR, 1 ); + rtems_interrupt_enable( isrlevel ); +} + void Clock_exit( void ) { if ( BSP_Configuration.ticks_per_timeslice ) { @@ -73,3 +95,49 @@ void Clock_exit( void ) } } +rtems_device_driver Clock_initialize( + rtems_device_major_number major, + rtems_device_minor_number minor, + void *pargp +) +{ + Install_clock( Clock_isr ); + + /* + * make major/minor avail to others such as shared memory driver + */ + + rtems_clock_major = major; + rtems_clock_minor = minor; + + return RTEMS_SUCCESSFUL; +} + +rtems_device_driver Clock_control( + rtems_device_major_number major, + rtems_device_minor_number minor, + void *pargp +) +{ + rtems_libio_ioctl_args_t *args = pargp; + + if (args == 0) + goto done; + + /* + * This is hokey, but until we get a defined interface + * to do this, it will just be this simple... + */ + + if (args->command == rtems_build_name('I', 'S', 'R', ' ')) + { + Clock_isr(CLOCK_VECTOR); + } + else if (args->command == rtems_build_name('N', 'E', 'W', ' ')) + { + ReInstall_clock(args->buffer); + } + +done: + return RTEMS_SUCCESSFUL; +} diff --git a/c/src/lib/libbsp/i386/force386/console/console.c b/c/src/lib/libbsp/i386/force386/console/console.c index f1f019c487..2b68f329c0 100644 --- a/c/src/lib/libbsp/i386/force386/console/console.c +++ b/c/src/lib/libbsp/i386/force386/console/console.c @@ -14,11 +14,10 @@ #define F386_INIT -#include <stdlib.h> +#include <bsp.h> +#include <rtems/libio.h> -#include <rtems.h> -#include "console.h" -#include "bsp.h" +#include <stdlib.h> /* console_cleanup * @@ -61,18 +60,29 @@ void console_cleanup( void ) rtems_device_driver console_initialize( rtems_device_major_number major, rtems_device_minor_number minor, - void *arg, - rtems_id self, - rtems_unsigned32 *status + void *arg ) { - /* - * flush the console now and at exit. Just in case. - */ + rtems_status_code status; + + /* + * flush the console now and at exit. Just in case. + */ + + console_cleanup(); + + status = rtems_io_register_name( + "/dev/console", + major, + (rtems_device_minor_number) 0 + ); + + if (status != RTEMS_SUCCESSFUL) + rtems_fatal_error_occurred(status); - console_cleanup(); + atexit( console_cleanup ); - atexit( console_cleanup ); + return RTEMS_SUCCESSFUL; } @@ -172,48 +182,103 @@ void outbyte( } /* - * __read -- read bytes from the serial port. Ignore fd, since - * we only have stdin. + * Open entry point */ - -int __read( - int fd, - char *buf, - int nbytes + +rtems_device_driver console_open( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg ) { - int i = 0; + return RTEMS_SUCCESSFUL; +} + +/* + * Close entry point + */ + +rtems_device_driver console_close( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg +) +{ + return RTEMS_SUCCESSFUL; +} - for (i = 0; i < nbytes; i++) { - *(buf + i) = inbyte(); - if ((*(buf + i) == '\n') || (*(buf + i) == '\r')) { - (*(buf + i++)) = '\n'; - (*(buf + i)) = 0; +/* + * read bytes from the serial port. We only have stdin. + */ + +rtems_device_driver console_read( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg +) +{ + rtems_libio_rw_args_t *rw_args; + char *buffer; + int maximum; + int count = 0; + + rw_args = (rtems_libio_rw_args_t *) arg; + + buffer = rw_args->buffer; + maximum = rw_args->count; + + for (count = 0; count < maximum; count++) { + buffer[ count ] = inbyte(); + if (buffer[ count ] == '\n' || buffer[ count ] == '\r') { + buffer[ count++ ] = '\n'; + buffer[ count ] = 0; break; } } - return (i); + + rw_args->bytes_moved = count; + return (count >= 0) ? RTEMS_SUCCESSFUL : RTEMS_UNSATISFIED; } - + /* - * __write -- write bytes to the serial port. Ignore fd, since - * stdout and stderr are the same. Since we have no filesystem, - * open will only return an error. + * write bytes to the serial port. Stdout and stderr are the same. */ - -int __write( - int fd, - char *buf, - int nbytes + +rtems_device_driver console_write( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg ) { - int i; - - for (i = 0; i < nbytes; i++) { - if (*(buf + i) == '\n') { - outbyte ('\r'); + int count; + int maximum; + rtems_libio_rw_args_t *rw_args; + char *buffer; + + rw_args = (rtems_libio_rw_args_t *) arg; + + buffer = rw_args->buffer; + maximum = rw_args->count; + + for (count = 0; count < maximum; count++) { + if ( buffer[ count ] == '\n') { + outbyte('\r'); } - outbyte (*(buf + i)); + outbyte( buffer[ count ] ); } - return (nbytes); + return maximum; } + +/* + * IO Control entry point + */ + +rtems_device_driver console_control( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg +) +{ + return RTEMS_SUCCESSFUL; +} + diff --git a/c/src/lib/libbsp/i386/force386/include/bsp.h b/c/src/lib/libbsp/i386/force386/include/bsp.h index cc8fb2d3ba..c6c553e454 100644 --- a/c/src/lib/libbsp/i386/force386/include/bsp.h +++ b/c/src/lib/libbsp/i386/force386/include/bsp.h @@ -22,6 +22,8 @@ extern "C" { #include <rtems.h> #include <iosupp.h> +#include <console.h> +#include <clockdrv.h> /* * Define the time limits for RTEMS Test Suite test durations. @@ -128,6 +130,24 @@ extern "C" { #define BSP_EXTERN extern #endif +/* + * Device Driver Table Entries + */ + +/* + * NOTE: Use the standard Console driver entry + */ + +/* + * NOTE: Use the standard Clock driver entry + */ + +/* + * How many libio files we want + */ + +#define BSP_LIBIO_MAX_FDS 20 + /* miscellaneous stuff assumed to exist */ extern rtems_configuration_table BSP_Configuration; diff --git a/c/src/lib/libbsp/i386/force386/startup/bspstart.c b/c/src/lib/libbsp/i386/force386/startup/bspstart.c index 78def6375c..19cb28e450 100644 --- a/c/src/lib/libbsp/i386/force386/startup/bspstart.c +++ b/c/src/lib/libbsp/i386/force386/startup/bspstart.c @@ -20,11 +20,16 @@ * $Id$ */ -#include <rtems.h> #include <bsp.h> +#include <rtems/libio.h> + #include <libcsupport.h> +#include <fcntl.h> + +#ifdef STACK_CHECKER_ON #include <stackchk.h> +#endif /* * The original table from the application and our copy of it with @@ -36,6 +41,8 @@ rtems_configuration_table BSP_Configuration; rtems_cpu_table Cpu_table; +char *rtems_progname; + /* Initialize whatever libc we are using * called from postdriver hook */ @@ -52,6 +59,14 @@ void bsp_libc_init() RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0); /* + * Init the RTEMS libio facility to provide UNIX-like system + * calls for use by newlib (ie: provide __open, __close, etc) + * Uses malloc() to get area for the iops, so must be after malloc init + */ + + rtems_libio_init(); + + /* * Set up for the libc handling. */ @@ -70,12 +85,44 @@ void bsp_libc_init() } -int bsp_start( +/* + * After drivers are setup, register some "filenames" + * and open stdin, stdout, stderr files + * + * Newlib will automatically associate the files with these + * (it hardcodes the numbers) + */ + +void +bsp_postdriver_hook(void) +{ + int stdin_fd, stdout_fd, stderr_fd; + + if ((stdin_fd = __open("/dev/console", O_RDONLY, 0)) == -1) + rtems_fatal_error_occurred('STD0'); + + if ((stdout_fd = __open("/dev/console", O_WRONLY, 0)) == -1) + rtems_fatal_error_occurred('STD1'); + + if ((stderr_fd = __open("/dev/console", O_WRONLY, 0)) == -1) + rtems_fatal_error_occurred('STD2'); + + if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2)) + rtems_fatal_error_occurred('STIO'); +} + +int main( int argc, char **argv, char **environp ) { + + if ((argc > 0) && argv && argv[0]) + rtems_progname = argv[0]; + else + rtems_progname = "RTEMS"; + /* * FORCE documentation incorrectly states that the bus request * level is initialized to 3. It is actually initialized by @@ -92,7 +139,7 @@ int bsp_start( Cpu_table.predriver_hook = bsp_libc_init; /* RTEMS resources available */ - Cpu_table.postdriver_hook = NULL; /* Call our main() for constructors */ + Cpu_table.postdriver_hook = bsp_postdriver_hook; Cpu_table.idle_task = NULL; /* do not override system IDLE task */ @@ -137,6 +184,12 @@ int bsp_start( BSP_Configuration.maximum_extensions++; #endif + /* + * Tell libio how many fd's we want and allow it to tweak config + */ + + rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS); + rtems_initialize_executive( &BSP_Configuration, &Cpu_table ); /* does not return */ /* no cleanup necessary for Force CPU-386 */ diff --git a/c/src/lib/libbsp/i386/go32/clock/ckinit.c b/c/src/lib/libbsp/i386/go32/clock/ckinit.c index 5ac1c10d98..fa6a8bf057 100644 --- a/c/src/lib/libbsp/i386/go32/clock/ckinit.c +++ b/c/src/lib/libbsp/i386/go32/clock/ckinit.c @@ -11,67 +11,81 @@ */ #include <bsp.h> -#include <clockdrv.h> +#include <rtems/libio.h> + #include <stdlib.h> volatile rtems_unsigned32 Clock_driver_ticks; -rtems_unsigned32 Clock_isrs_per_tick; /* ISRs per tick */ -rtems_unsigned32 Clock_isrs; /* ISRs until next tick */ +rtems_unsigned32 Clock_isrs_per_tick; /* ISRs per tick */ +rtems_unsigned32 Clock_isrs; /* ISRs until next tick */ rtems_isr_entry Old_ticker; -rtems_device_driver Clock_initialize( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *pargp, - rtems_id tid, - rtems_unsigned32 *rval -) -{ - Install_clock( Clock_isr ); -} +#define CLOCK_VECTOR 0x8 -void ReInstall_clock( - rtems_isr_entry clock_isr +void Clock_exit( void ); + +/* + * These are set by clock driver during its init + */ + +rtems_device_major_number rtems_clock_major = ~0; +rtems_device_minor_number rtems_clock_minor; + +rtems_isr Clock_isr( + rtems_vector_number vector ) { - rtems_unsigned32 isrlevel = 0; + /* touch interrupt controller for irq0 (0x20+0) */ + outport_byte( 0x20, 0x20 ); - rtems_interrupt_disable( isrlevel ); - (void) set_vector( clock_isr, 0x8, 1 ); - rtems_interrupt_enable( isrlevel ); + Clock_driver_ticks += 1; + +#if 0 && defined(pentium) + { + extern long long Last_RDTSC; + __asm __volatile( ".byte 0x0F, 0x31" : "=A" (Last_RDTSC) ); + } +#endif + + if ( Clock_isrs == 1 ) { + rtems_clock_tick(); + Clock_isrs = Clock_isrs_per_tick; + } else { + Clock_isrs -= 1; + } } void Install_clock( rtems_isr_entry clock_isr ) { - unsigned int microseconds_per_isr; + unsigned int microseconds_per_isr; #if 0 - /* Initialize clock from on-board real time clock. This breaks the */ + /* Initialize clock from on-board real time clock. This breaks the */ /* test code which assumes which assumes the application will do it. */ { - rtems_time_of_day Now; - extern void init_rtc( void ); - extern long rtc_read( rtems_time_of_day * tod ); - init_rtc(); - if ( rtc_read( &Now ) >= 0 ) - clock_set( &Now ); - } + rtems_time_of_day Now; + extern void init_rtc( void ); + extern long rtc_read( rtems_time_of_day * tod ); + init_rtc(); + if ( rtc_read( &Now ) >= 0 ) + clock_set( &Now ); + } #endif - /* Start by assuming hardware counter is large enough, then */ - /* scale it until it actually fits. */ + /* Start by assuming hardware counter is large enough, then */ + /* scale it until it actually fits. */ Clock_driver_ticks = 0; Clock_isrs_per_tick = 1; if ( BSP_Configuration.microseconds_per_tick == 0 ) - microseconds_per_isr = 10000; /* default 10 ms */ + microseconds_per_isr = 10000; /* default 10 ms */ else - microseconds_per_isr = BSP_Configuration.microseconds_per_tick; + microseconds_per_isr = BSP_Configuration.microseconds_per_tick; while ( US_TO_TICK(microseconds_per_isr) > 65535 ) { - Clock_isrs_per_tick *= 10; - microseconds_per_isr /= 10; + Clock_isrs_per_tick *= 10; + microseconds_per_isr /= 10; } /* Initialize count in ckisr.c */ @@ -83,43 +97,101 @@ void Install_clock( #endif if ( BSP_Configuration.ticks_per_timeslice ) { - /* 105/88 approximates TIMER_TICK*1e-6 */ - unsigned int count = US_TO_TICK( microseconds_per_isr ); + /* 105/88 approximates TIMER_TICK*1e-6 */ + unsigned int count = US_TO_TICK( microseconds_per_isr ); - Old_ticker = (rtems_isr_entry) set_vector( clock_isr, 0x8, 1 ); - outport_byte( TIMER_MODE, TIMER_SEL0|TIMER_16BIT|TIMER_RATEGEN ); - outport_byte( TIMER_CNTR0, count >> 0 & 0xff ); - outport_byte( TIMER_CNTR0, count >> 8 & 0xff ); + Old_ticker = (rtems_isr_entry) set_vector( clock_isr, CLOCK_VECTOR, 1 ); + outport_byte( TIMER_MODE, TIMER_SEL0|TIMER_16BIT|TIMER_RATEGEN ); + outport_byte( TIMER_CNTR0, count >> 0 & 0xff ); + outport_byte( TIMER_CNTR0, count >> 8 & 0xff ); } atexit( Clock_exit ); } +void ReInstall_clock( + rtems_isr_entry clock_isr +) +{ + rtems_unsigned32 isrlevel = 0; + + rtems_interrupt_disable( isrlevel ); + (void) set_vector( clock_isr, CLOCK_VECTOR, 1 ); + rtems_interrupt_enable( isrlevel ); +} + void Clock_exit( void ) { if ( BSP_Configuration.ticks_per_timeslice ) { - extern void rtc_set_dos_date( void ); - - /* reset to DOS value: */ - outport_byte( TIMER_MODE, TIMER_SEL0|TIMER_16BIT|TIMER_RATEGEN ); - outport_byte( TIMER_CNTR0, 0 ); - outport_byte( TIMER_CNTR0, 0 ); - - /* reset time-of-day */ - rtc_set_dos_date(); - - /* re-enable old handler: assume it was one of ours */ - set_vector( (rtems_isr_entry)Old_ticker, 0x8, 1 ); + extern void rtc_set_dos_date( void ); + + /* reset to DOS value: */ + outport_byte( TIMER_MODE, TIMER_SEL0|TIMER_16BIT|TIMER_RATEGEN ); + outport_byte( TIMER_CNTR0, 0 ); + outport_byte( TIMER_CNTR0, 0 ); + + /* reset time-of-day */ + rtc_set_dos_date(); + + /* re-enable old handler: assume it was one of ours */ + set_vector( (rtems_isr_entry)Old_ticker, CLOCK_VECTOR, 1 ); } } +rtems_device_driver Clock_initialize( + rtems_device_major_number major, + rtems_device_minor_number minor, + void *pargp +) +{ + Install_clock( Clock_isr ); + + /* + * make major/minor avail to others such as shared memory driver + */ + + rtems_clock_major = major; + rtems_clock_minor = minor; + + return RTEMS_SUCCESSFUL; +} + +rtems_device_driver Clock_control( + rtems_device_major_number major, + rtems_device_minor_number minor, + void *pargp +) +{ + rtems_libio_ioctl_args_t *args = pargp; + + if (args == 0) + goto done; + + /* + * This is hokey, but until we get a defined interface + * to do this, it will just be this simple... + */ + + if (args->command == rtems_build_name('I', 'S', 'R', ' ')) + { + Clock_isr(CLOCK_VECTOR); + } + else if (args->command == rtems_build_name('N', 'E', 'W', ' ')) + { + ReInstall_clock(args->buffer); + } + +done: + return RTEMS_SUCCESSFUL; +} #if 0 && defined(pentium) -/* This can be used to get extremely accurate timing on a pentium. */ -/* It isn't supported. [bryce] */ +/* This can be used to get extremely accurate timing on a pentium. */ +/* It isn't supported. [bryce] */ #define HZ 90.0 volatile long long Last_RDTSC; #define RDTSC()\ ({ long long _now; __asm __volatile (".byte 0x0F,0x31":"=A"(_now)); _now; }) + long long Kernel_Time_ns( void ) { extern rtems_unsigned32 _TOD_Ticks_per_second; @@ -128,7 +200,7 @@ long long Kernel_Time_ns( void ) int flags; disable_intr( flags ); now = 1e9 * Clock_driver_ticks / isrs_per_second - + (RDTSC() - Last_RDTSC) * (1000.0/HZ); + + (RDTSC() - Last_RDTSC) * (1000.0/HZ); enable_intr( flags ); return now; } diff --git a/c/src/lib/libbsp/i386/go32/console/console.c b/c/src/lib/libbsp/i386/go32/console/console.c index d7e5641e22..3265f46de0 100644 --- a/c/src/lib/libbsp/i386/go32/console/console.c +++ b/c/src/lib/libbsp/i386/go32/console/console.c @@ -8,9 +8,8 @@ #include <stdlib.h> -#include <rtems.h> -#include "console.h" -#include "bsp.h" +#include <bsp.h> +#include <rtems/libio.h> #include <dpmi.h> #include <go32.h> @@ -42,40 +41,55 @@ void console_cleanup( void ) * Return values: */ -/* Set this if console I/O should use go32 (DOS) read/write calls. */ -/* Otherwise, direct hardware accesses will be used. */ -int _IBMPC_Use_Go32_IO = 0; +/* Set this if console I/O should use go32 (DOS) read/write calls. */ +/* Otherwise, direct hardware accesses will be used. */ -static rtems_isr_entry old_keyboard_isr = NULL; -extern void _IBMPC_keyboard_isr( rtems_unsigned32 interrupt ); +int _IBMPC_Use_Go32_IO = 0; +static rtems_isr_entry old_keyboard_isr = NULL; + +extern void _IBMPC_keyboard_isr( rtems_unsigned32 interrupt ); rtems_device_driver console_initialize( rtems_device_major_number major, rtems_device_minor_number minor, - void *arg, - rtems_id self, - rtems_unsigned32 *status + void *arg ) { - if ( _IBMPC_Use_Go32_IO ) { - /* Nothing. We let DOS and go32 do all the work. */ - } else { - /* Grap the keyboard interrupt so DOS doesn't steal our */ - /* keystrokes. */ - rtems_status_code status; - status = rtems_interrupt_catch( _IBMPC_keyboard_isr, 9, - &old_keyboard_isr ); - if ( status ) { - int write( int, void *, int ); - void exit( int ); - char msg[] = "error initializing keyboard\n"; - write( 2, msg, sizeof msg - 1 ); - exit( 1 ); - } + rtems_status_code status; + + if ( _IBMPC_Use_Go32_IO ) { + /* Nothing. We let DOS and go32 do all the work. */ + } else { + /* Grap the keyboard interrupt so DOS doesn't steal our */ + /* keystrokes. */ + rtems_status_code status; + + status = + rtems_interrupt_catch( _IBMPC_keyboard_isr, 9, &old_keyboard_isr ); + + if ( status ) { + int write( int, void *, int ); + void exit( int ); + + char msg[] = "error initializing keyboard\n"; + write( 2, msg, sizeof msg - 1 ); + exit( 1 ); } + } - atexit( console_cleanup ); + status = rtems_io_register_name( + "/dev/console", + major, + (rtems_device_minor_number) 0 + ); + + if (status != RTEMS_SUCCESSFUL) + rtems_fatal_error_occurred(status); + + atexit( console_cleanup ); + + return RTEMS_SUCCESSFUL; } @@ -117,7 +131,7 @@ char inbyte( void ) void outbyte( char ch ); outbyte( ch ); if ( ch == '\r' ) - outbyte( '\n' ); + outbyte( '\n' ); #endif return ch; } @@ -138,49 +152,104 @@ void outbyte( char ch ) } /* - * __read -- read bytes from the console. Ignore fd, since - * we only have stdin. + * Open entry point */ + +rtems_device_driver console_open( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg +) +{ + return RTEMS_SUCCESSFUL; +} -int __read( - int fd, - char *buf, - int nbytes +/* + * Close entry point + */ + +rtems_device_driver console_close( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg ) { - int i = 0; - - for ( i = 0; i < nbytes; i++ ) { - buf[i] = inbyte(); - if ( buf[i] == '\r' ) { - /* What if this goes past the end of the buffer? We're hosed. [bhc] */ - buf[i++] = '\n'; - buf[i] = '\0'; - break; + return RTEMS_SUCCESSFUL; +} + +/* + * read bytes from the serial port. We only have stdin. + */ + +rtems_device_driver console_read( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg +) +{ + rtems_libio_rw_args_t *rw_args; + char *buffer; + int maximum; + int count = 0; + + rw_args = (rtems_libio_rw_args_t *) arg; + + buffer = rw_args->buffer; + maximum = rw_args->count; + + for (count = 0; count < maximum; count++) { + buffer[ count ] = inbyte(); + if (buffer[ count ] == '\n' || buffer[ count ] == '\r') { + /* What if this goes past the end of the buffer? We're hosed. [bhc] */ + buffer[ count++ ] = '\n'; + buffer[ count ] = 0; + break; } } - return i; + + rw_args->bytes_moved = count; + return (count >= 0) ? RTEMS_SUCCESSFUL : RTEMS_UNSATISFIED; } - + /* - * __write -- write bytes to the console. Ignore fd, since - * stdout and stderr are the same. Since we have no filesystem, - * open will only return an error. + * write bytes to the serial port. Stdout and stderr are the same. */ - -int __write( - int fd, - char *buf, - int nbytes + +rtems_device_driver console_write( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg ) { - int i; - - for (i = 0; i < nbytes; i++) { - if (*(buf + i) == '\n') { - outbyte ('\r'); + int count; + int maximum; + rtems_libio_rw_args_t *rw_args; + char *buffer; + + rw_args = (rtems_libio_rw_args_t *) arg; + + buffer = rw_args->buffer; + maximum = rw_args->count; + + for (count = 0; count < maximum; count++) { + if ( buffer[ count ] == '\n') { + outbyte('\r'); } - outbyte (*(buf + i)); + outbyte( buffer[ count ] ); } - return (nbytes); + return maximum; } + +/* + * IO Control entry point + */ + +rtems_device_driver console_control( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg +) +{ + return RTEMS_SUCCESSFUL; +} + diff --git a/c/src/lib/libbsp/i386/go32/include/bsp.h b/c/src/lib/libbsp/i386/go32/include/bsp.h index a41d57dc77..5bafd27bd4 100644 --- a/c/src/lib/libbsp/i386/go32/include/bsp.h +++ b/c/src/lib/libbsp/i386/go32/include/bsp.h @@ -22,6 +22,8 @@ extern "C" { #include <rtems.h> #include <iosupp.h> +#include <console.h> +#include <clockdrv.h> /* * Define the time limits for RTEMS Test Suite test durations. @@ -124,6 +126,24 @@ extern "C" { #define BSP_EXTERN extern #endif +/* + * Device Driver Table Entries + */ + +/* + * NOTE: Use the standard Console driver entry + */ + +/* + * NOTE: Use the standard Clock driver entry + */ + +/* + * How many libio files we want + */ + +#define BSP_LIBIO_MAX_FDS 20 + /* functions */ int _IBMPC_chrdy( char * ch ); @@ -134,15 +154,6 @@ void _IBMPC_outch( unsigned char ); extern rtems_configuration_table BSP_Configuration; -#if 0 -extern i386_IDT_slot Interrupt_descriptor_table[ 256 ]; -extern i386_GDT_slot Global_descriptor_table[ 8192 ]; -BSP_EXTERN unsigned short Idt[3]; /* Interrupt Descriptor Table Address */ -BSP_EXTERN unsigned short Gdt[3]; /* Global Descriptor Table Address */ -BSP_EXTERN unsigned int Idt_base; -BSP_EXTERN unsigned int Gdt_base; -#endif - /* routines */ i386_isr_entry set_vector( diff --git a/c/src/lib/libbsp/i386/go32/startup/bspstart.c b/c/src/lib/libbsp/i386/go32/startup/bspstart.c index 21594766ad..940c04270a 100644 --- a/c/src/lib/libbsp/i386/go32/startup/bspstart.c +++ b/c/src/lib/libbsp/i386/go32/startup/bspstart.c @@ -20,11 +20,18 @@ * $Id$ */ -#include <rtems.h> #include <bsp.h> +#include <rtems/libio.h> + #include <libcsupport.h> - +#include <z8036.h> + +#include <string.h> +#include <fcntl.h> + +#ifdef STACK_CHECKER_ON #include <stackchk.h> +#endif /* * The original table from the application and our copy of it with @@ -36,6 +43,8 @@ rtems_configuration_table BSP_Configuration; rtems_cpu_table Cpu_table; +char *rtems_progname; + /* Initialize whatever libc we are using * called from postdriver hook */ @@ -57,6 +66,14 @@ void bsp_libc_init() RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0); /* + * Init the RTEMS libio facility to provide UNIX-like system + * calls for use by newlib (ie: provide __open, __close, etc) + * Uses malloc() to get area for the iops, so must be after malloc init + */ + + rtems_libio_init(); + + /* * Set up for the libc handling. */ @@ -74,60 +91,116 @@ void bsp_libc_init() #endif } - -void bsp_start() + +/* + * After drivers are setup, register some "filenames" + * and open stdin, stdout, stderr files + * + * Newlib will automatically associate the files with these + * (it hardcodes the numbers) + */ + +void +bsp_postdriver_hook(void) { - extern void * sbrk( int ); - - Cpu_table.pretasking_hook = NULL; - Cpu_table.predriver_hook = bsp_libc_init; /* RTEMS resources available */ - Cpu_table.postdriver_hook = NULL; /* Call our main() for constructors */ - Cpu_table.idle_task = NULL; /* do not override system IDLE task */ - Cpu_table.do_zero_of_workspace = TRUE; - Cpu_table.interrupt_table_segment = 0;/* get_ds(); */ - Cpu_table.interrupt_table_offset = (void *)0; - Cpu_table.interrupt_stack_size = 4096; - Cpu_table.extra_system_initialization_stack = 0; - - /* - * Copy the table - */ - BSP_Configuration = Configuration; - - BSP_Configuration.work_space_start = sbrk( Configuration.work_space_size ); - if ( BSP_Configuration.work_space_start == 0 ) { - /* Big trouble */ - int write( int, void *, int ); - void _exit( int ); - char msg[] = "bsp_start() couldn't sbrk() RTEMS work space\n"; - write( 2, msg, sizeof msg - 1 ); - _exit( 1 ); - } - - /* - * Add 1 region for Malloc in libc_low - */ + int stdin_fd, stdout_fd, stderr_fd; + + if ((stdin_fd = __open("/dev/console", O_RDONLY, 0)) == -1) + rtems_fatal_error_occurred('STD0'); + + if ((stdout_fd = __open("/dev/console", O_WRONLY, 0)) == -1) + rtems_fatal_error_occurred('STD1'); + + if ((stderr_fd = __open("/dev/console", O_WRONLY, 0)) == -1) + rtems_fatal_error_occurred('STD2'); + + if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2)) + rtems_fatal_error_occurred('STIO'); +} - BSP_Configuration.maximum_regions++; +/* This is the original command line passed from DOS */ +char ** Go32_Argv; - /* - * Add 1 extension for newlib libc - */ +int main( + int argc, + char **argv, + char **environp +) +{ + extern void * sbrk( int ); + extern volatile void _exit( int ); + + /* Set up arguments that we can access later */ + Go32_Argv = argv; + + if ((argc > 0) && argv && argv[0]) + rtems_progname = argv[0]; + else + rtems_progname = "RTEMS"; + + Cpu_table.pretasking_hook = NULL; + Cpu_table.predriver_hook = bsp_libc_init; /* RTEMS resources available */ + Cpu_table.postdriver_hook = bsp_postdriver_hook; + Cpu_table.idle_task = NULL; /* do not override system IDLE task */ + Cpu_table.do_zero_of_workspace = TRUE; + Cpu_table.interrupt_table_segment = 0;/* get_ds(); */ + Cpu_table.interrupt_table_offset = (void *)0; + Cpu_table.interrupt_stack_size = 4096; + Cpu_table.extra_system_initialization_stack = 0; + + /* + * Copy the table + */ + BSP_Configuration = Configuration; + + BSP_Configuration.work_space_start = sbrk( Configuration.work_space_size ); + if ( BSP_Configuration.work_space_start == 0 ) { + /* Big trouble */ + int write( int, void *, int ); + char msg[] = "bsp_start() couldn't sbrk() RTEMS work space\n"; + write( 2, msg, sizeof msg - 1 ); + _exit( 1 ); + } + + /* + * Add 1 region for Malloc in libc_low + */ + + BSP_Configuration.maximum_regions++; + + /* + * Add 1 extension for newlib libc + */ #ifdef RTEMS_NEWLIB - BSP_Configuration.maximum_extensions++; + BSP_Configuration.maximum_extensions++; #endif - /* - * Add another extension if using the stack checker - */ + /* + * Add another extension if using the stack checker + */ #ifdef STACK_CHECKER_ON - BSP_Configuration.maximum_extensions++; + BSP_Configuration.maximum_extensions++; #endif - rtems_initialize_executive( &BSP_Configuration, &Cpu_table ); - /* does not return */ + /* + * Tell libio how many fd's we want and allow it to tweak config + */ + + rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS); + + rtems_initialize_executive( &BSP_Configuration, &Cpu_table ); + /* does not return */ + + /* We only return here if the executive has finished. This happens */ + /* when the task has called exit(). */ + /* At this point we call _exit() which resides in djgcc. */ + + for (;;) + _exit( 0 ); + + /* no cleanup necessary for GO32 */ - /* no cleanup necessary for GO32 */ + return 0; } diff --git a/c/src/lib/libbsp/i960/cvme961/clock/ckinit.c b/c/src/lib/libbsp/i960/cvme961/clock/ckinit.c index 623101075d..b479ad137c 100644 --- a/c/src/lib/libbsp/i960/cvme961/clock/ckinit.c +++ b/c/src/lib/libbsp/i960/cvme961/clock/ckinit.c @@ -20,32 +20,28 @@ #include <stdlib.h> -#include <rtems.h> #include <bsp.h> -#include <clockdrv.h> +#include <rtems/libio.h> + +#define CLOCK_VECTOR 5 rtems_unsigned32 Clock_isrs; /* ISRs until next tick */ i960_isr_entry Old_ticker; volatile rtems_unsigned32 Clock_driver_ticks; /* ticks since initialization */ -rtems_device_driver Clock_initialize( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *pargp, - rtems_id id, - rtems_unsigned32 *rval ) -{ - Install_clock( Clock_isr ); - atexit( Clock_exit ); -} +void Clock_exit( void ); + +/* + * These are set by clock driver during its init + */ + +rtems_device_major_number rtems_clock_major = ~0; +rtems_device_minor_number rtems_clock_minor; -void ReInstall_clock( - rtems_isr_entry clock_isr -) -{ - (void) set_vector( clock_isr, 5, 1 ); -} + +/* this is later in the file to avoid it being inlined */ +rtems_isr Clock_isr( rtems_vector_number vector ); void Install_clock( rtems_isr_entry clock_isr @@ -57,13 +53,20 @@ void Install_clock( Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000; if ( BSP_Configuration.ticks_per_timeslice ) { - Old_ticker = set_vector( clock_isr, 5, 1 ); + Old_ticker = set_vector( clock_isr, CLOCK_VECTOR, 1 ); victimer = (volatile unsigned char *) 0xa00000c3; *victimer = 0x12; *victimer = 0x92; /* 1000 HZ */ } } +void ReInstall_clock( + rtems_isr_entry clock_isr +) +{ + (void) set_vector( clock_isr, CLOCK_VECTOR, 1 ); +} + void Clock_exit() { unsigned char *victimer; @@ -75,3 +78,68 @@ void Clock_exit() /* do not restore old vector */ } } + +rtems_device_driver Clock_initialize( + rtems_device_major_number major, + rtems_device_minor_number minor, + void *pargp +) +{ + Install_clock( Clock_isr ); + + atexit( Clock_exit ); + + /* + * make major/minor avail to others such as shared memory driver + */ + + rtems_clock_major = major; + rtems_clock_minor = minor; + + return RTEMS_SUCCESSFUL; +} + +rtems_device_driver Clock_control( + rtems_device_major_number major, + rtems_device_minor_number minor, + void *pargp +) +{ + rtems_libio_ioctl_args_t *args = pargp; + + if (args == 0) + goto done; + + /* + * This is hokey, but until we get a defined interface + * to do this, it will just be this simple... + */ + + if (args->command == rtems_build_name('I', 'S', 'R', ' ')) + { + Clock_isr(CLOCK_VECTOR); + } + else if (args->command == rtems_build_name('N', 'E', 'W', ' ')) + { + ReInstall_clock(args->buffer); + } + +done: + return RTEMS_SUCCESSFUL; +} + +rtems_isr Clock_isr( + rtems_vector_number vector +) +{ + /* enable_tracing(); */ + Clock_driver_ticks += 1; + if ( Clock_isrs == 1 ) { + rtems_clock_tick(); + Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000; + } + else + Clock_isrs -= 1; + i960_clear_intr( 5 ); +} + diff --git a/c/src/lib/libbsp/i960/cvme961/console/console.c b/c/src/lib/libbsp/i960/cvme961/console/console.c index 8ba0352304..192c7f2d16 100644 --- a/c/src/lib/libbsp/i960/cvme961/console/console.c +++ b/c/src/lib/libbsp/i960/cvme961/console/console.c @@ -1,5 +1,5 @@ /* - * This file contains the MVME136 console IO package. + * This file contains the CVME961 console IO package. * * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. * On-Line Applications Research Corporation (OAR). @@ -14,9 +14,8 @@ #define C961_INIT -#include <rtems.h> -#include "console.h" -#include "bsp.h" +#include <bsp.h> +#include <rtems/libio.h> /* console_initialize * @@ -32,12 +31,21 @@ rtems_device_driver console_initialize( rtems_device_major_number major, rtems_device_minor_number minor, - void *arg, - rtems_id self, - rtems_unsigned32 *status + void *arg ) { - *status = RTEMS_SUCCESSFUL; + rtems_status_code status; + + status = rtems_io_register_name( + "/dev/console", + major, + (rtems_device_minor_number) 0 + ); + + if (status != RTEMS_SUCCESSFUL) + rtems_fatal_error_occurred(status); + + return RTEMS_SUCCESSFUL; } /* @@ -100,48 +108,103 @@ void outbyte( } /* - * __read -- read bytes from the serial port. Ignore fd, since - * we only have stdin. + * Open entry point */ - -int __read( - int fd, - char *buf, - int nbytes + +rtems_device_driver console_open( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg ) { - int i = 0; - - for (i = 0; i < nbytes; i++) { - *(buf + i) = inbyte(); - if ((*(buf + i) == '\n') || (*(buf + i) == '\r')) { - (*(buf + i++)) = '\n'; - (*(buf + i)) = 0; + return RTEMS_SUCCESSFUL; +} + +/* + * Close entry point + */ + +rtems_device_driver console_close( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg +) +{ + return RTEMS_SUCCESSFUL; +} + +/* + * read bytes from the serial port. We only have stdin. + */ + +rtems_device_driver console_read( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg +) +{ + rtems_libio_rw_args_t *rw_args; + char *buffer; + int maximum; + int count = 0; + + rw_args = (rtems_libio_rw_args_t *) arg; + + buffer = rw_args->buffer; + maximum = rw_args->count; + + for (count = 0; count < maximum; count++) { + buffer[ count ] = inbyte(); + if (buffer[ count ] == '\n' || buffer[ count ] == '\r') { + buffer[ count++ ] = '\n'; + buffer[ count ] = 0; break; } } - return (i); + + rw_args->bytes_moved = count; + return (count >= 0) ? RTEMS_SUCCESSFUL : RTEMS_UNSATISFIED; } - + /* - * __write -- write bytes to the serial port. Ignore fd, since - * stdout and stderr are the same. Since we have no filesystem, - * open will only return an error. + * write bytes to the serial port. Stdout and stderr are the same. */ - -int __write( - int fd, - char *buf, - int nbytes + +rtems_device_driver console_write( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg ) { - int i; - - for (i = 0; i < nbytes; i++) { - if (*(buf + i) == '\n') { - outbyte ('\r'); + int count; + int maximum; + rtems_libio_rw_args_t *rw_args; + char *buffer; + + rw_args = (rtems_libio_rw_args_t *) arg; + + buffer = rw_args->buffer; + maximum = rw_args->count; + + for (count = 0; count < maximum; count++) { + if ( buffer[ count ] == '\n') { + outbyte('\r'); } - outbyte (*(buf + i)); + outbyte( buffer[ count ] ); } - return (nbytes); + return maximum; +} + +/* + * IO Control entry point + */ + +rtems_device_driver console_control( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg +) +{ + return RTEMS_SUCCESSFUL; } + diff --git a/c/src/lib/libbsp/i960/cvme961/include/bsp.h b/c/src/lib/libbsp/i960/cvme961/include/bsp.h index ca870b3cd3..9b6caab59d 100644 --- a/c/src/lib/libbsp/i960/cvme961/include/bsp.h +++ b/c/src/lib/libbsp/i960/cvme961/include/bsp.h @@ -24,6 +24,8 @@ extern "C" { #include <rtems.h> #include <iosupp.h> +#include <console.h> +#include <clockdrv.h> /* * Define the time limits for RTEMS Test Suite test durations. @@ -115,6 +117,24 @@ extern rtems_configuration_table BSP_Configuration; BSP_EXTERN i960ca_PRCB *Prcb; BSP_EXTERN i960ca_control_table *Ctl_tbl; +/* + * Device Driver Table Entries + */ + +/* + * NOTE: Use the standard Console driver entry + */ + +/* + * NOTE: Use the standard Clock driver entry + */ + +/* + * How many libio files we want + */ + +#define BSP_LIBIO_MAX_FDS 20 + /* functions */ void bsp_cleanup( void ); diff --git a/c/src/lib/libbsp/i960/cvme961/startup/bspstart.c b/c/src/lib/libbsp/i960/cvme961/startup/bspstart.c index afb9b7e733..8298efcffe 100644 --- a/c/src/lib/libbsp/i960/cvme961/startup/bspstart.c +++ b/c/src/lib/libbsp/i960/cvme961/startup/bspstart.c @@ -20,12 +20,17 @@ * $Id$ */ -#include <rtems.h> #include <bsp.h> -#include "libcsupport.h" - - -#include "stackchk.h" +#include <rtems/libio.h> + +#include <libcsupport.h> + +#include <string.h> +#include <fcntl.h> + +#ifdef STACK_CHECKER_ON +#include <stackchk.h> +#endif /* * The original table from the application and our copy of it with @@ -38,6 +43,8 @@ rtems_configuration_table BSP_Configuration; rtems_cpu_table Cpu_table; +char *rtems_progname; + /* Initialize whatever libc we are using * called from postdriver hook */ @@ -54,6 +61,14 @@ void bsp_libc_init() RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0); /* + * Init the RTEMS libio facility to provide UNIX-like system + * calls for use by newlib (ie: provide __open, __close, etc) + * Uses malloc() to get area for the iops, so must be after malloc init + */ + + rtems_libio_init(); + + /* * Set up for the libc handling. */ @@ -70,12 +85,43 @@ void bsp_libc_init() #endif } -int bsp_start( +/* + * After drivers are setup, register some "filenames" + * and open stdin, stdout, stderr files + * + * Newlib will automatically associate the files with these + * (it hardcodes the numbers) + */ + +void +bsp_postdriver_hook(void) +{ + int stdin_fd, stdout_fd, stderr_fd; + + if ((stdin_fd = __open("/dev/console", O_RDONLY, 0)) == -1) + rtems_fatal_error_occurred('STD0'); + + if ((stdout_fd = __open("/dev/console", O_WRONLY, 0)) == -1) + rtems_fatal_error_occurred('STD1'); + + if ((stderr_fd = __open("/dev/console", O_WRONLY, 0)) == -1) + rtems_fatal_error_occurred('STD2'); + + if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2)) + rtems_fatal_error_occurred('STIO'); +} + +int main( int argc, char **argv, char **environp ) { + if ((argc > 0) && argv && argv[0]) + rtems_progname = argv[0]; + else + rtems_progname = "RTEMS"; + /* set node number in SQSIO4 CTL REG */ *((rtems_unsigned32 *)0xc00000b0) = @@ -110,7 +156,7 @@ int bsp_start( Cpu_table.predriver_hook = bsp_libc_init; /* RTEMS resources available */ - Cpu_table.postdriver_hook = NULL; /* Call our main() for constructors */ + Cpu_table.postdriver_hook = bsp_postdriver_hook; Cpu_table.idle_task = NULL; /* do not override system IDLE task */ @@ -150,6 +196,12 @@ int bsp_start( BSP_Configuration.maximum_extensions++; #endif + /* + * Tell libio how many fd's we want and allow it to tweak config + */ + + rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS); + BSP_Configuration.work_space_start = (void *) (RAM_END - BSP_Configuration.work_space_size); diff --git a/c/src/lib/libbsp/m68k/dmv152/clock/ckinit.c b/c/src/lib/libbsp/m68k/dmv152/clock/ckinit.c index d5f0f5e023..8715cdcc26 100644 --- a/c/src/lib/libbsp/m68k/dmv152/clock/ckinit.c +++ b/c/src/lib/libbsp/m68k/dmv152/clock/ckinit.c @@ -19,36 +19,46 @@ */ #include <stdlib.h> - -#include <rtems.h> + #include <bsp.h> -#include <clockdrv.h> +#include <rtems/libio.h> rtems_unsigned32 Clock_isrs; /* ISRs until next tick */ volatile rtems_unsigned32 Clock_driver_ticks; /* ticks since initialization */ rtems_isr_entry Old_ticker; -rtems_device_driver Clock_initialize( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *pargp, - rtems_id tid, - rtems_unsigned32 *rval -) -{ - Install_clock( Clock_isr ); -} +void Clock_exit( void ); -void ReInstall_clock( - rtems_isr_entry clock_isr +#define CLOCK_VECTOR TIMER_VECTOR + +/* + * These are set by clock driver during its init + */ + +rtems_device_major_number rtems_clock_major = ~0; +rtems_device_minor_number rtems_clock_minor; + +/* + * ISR Handler + */ + +rtems_isr Clock_isr( + rtems_vector_number vector ) { - rtems_unsigned32 isrlevel = 0 ; + Clock_driver_ticks += 1; - rtems_interrupt_disable( isrlevel ); - (void) set_vector( clock_isr, TIMER_VECTOR, 1 ); - rtems_interrupt_enable( isrlevel ); + Z8x36_WRITE( TIMER, CT1_CMD_STATUS, 0xE2 ); + Z8x36_WRITE( TIMER, CT1_CMD_STATUS, 0x22 ); + Z8x36_WRITE( TIMER, CT1_CMD_STATUS, 0xC6 ); + + if ( Clock_isrs == 1 ) { + rtems_clock_tick(); + Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000; + } + else + Clock_isrs -= 1; } void Install_clock( @@ -61,7 +71,7 @@ void Install_clock( Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000; if ( BSP_Configuration.ticks_per_timeslice ) { - Old_ticker = (rtems_isr_entry) set_vector( clock_isr, TIMER_VECTOR, 1 ); + Old_ticker = (rtems_isr_entry) set_vector( clock_isr, CLOCK_VECTOR, 1 ); Z8x36_WRITE( TIMER, MASTER_CFG, 0xd4 ); Z8x36_READ ( TIMER, MASTER_INTR, data ); @@ -69,7 +79,7 @@ void Install_clock( Z8x36_WRITE( TIMER, CT1_TIME_CONST_MSB, 0x04 ); Z8x36_WRITE( TIMER, CT1_TIME_CONST_LSB, 0xCE ); Z8x36_WRITE( TIMER, CT1_MODE_SPEC, 0x83 ); - Z8x36_WRITE( TIMER, CNT_TMR_VECTOR, TIMER_VECTOR ); + Z8x36_WRITE( TIMER, CNT_TMR_VECTOR, CLOCK_VECTOR ); Z8x36_WRITE( TIMER, CT1_CMD_STATUS, 0x20 ); Z8x36_READ ( TIMER, MASTER_INTR, data ); Z8x36_WRITE( TIMER, MASTER_INTR, (data & 0xDA) | 0x80 ); @@ -87,6 +97,17 @@ void Install_clock( } } +void ReInstall_clock( + rtems_isr_entry clock_isr +) +{ + rtems_unsigned32 isrlevel = 0 ; + + rtems_interrupt_disable( isrlevel ); + (void) set_vector( clock_isr, CLOCK_VECTOR, 1 ); + rtems_interrupt_enable( isrlevel ); +} + void Clock_exit( void ) { rtems_unsigned8 data; @@ -99,3 +120,51 @@ void Clock_exit( void ) } } + +rtems_device_driver Clock_initialize( + rtems_device_major_number major, + rtems_device_minor_number minor, + void *pargp +) +{ + Install_clock( Clock_isr ); + + /* + * make major/minor avail to others such as shared memory driver + */ + + rtems_clock_major = major; + rtems_clock_minor = minor; + + return RTEMS_SUCCESSFUL; +} + +rtems_device_driver Clock_control( + rtems_device_major_number major, + rtems_device_minor_number minor, + void *pargp +) +{ + rtems_libio_ioctl_args_t *args = pargp; + + if (args == 0) + goto done; + + /* + * This is hokey, but until we get a defined interface + * to do this, it will just be this simple... + */ + + if (args->command == rtems_build_name('I', 'S', 'R', ' ')) + { + Clock_isr(CLOCK_VECTOR); + } + else if (args->command == rtems_build_name('N', 'E', 'W', ' ')) + { + ReInstall_clock(args->buffer); + } + +done: + return RTEMS_SUCCESSFUL; +} + diff --git a/c/src/lib/libbsp/m68k/dmv152/console/console.c b/c/src/lib/libbsp/m68k/dmv152/console/console.c index bb0f365b9c..ed0cd801c8 100644 --- a/c/src/lib/libbsp/m68k/dmv152/console/console.c +++ b/c/src/lib/libbsp/m68k/dmv152/console/console.c @@ -14,10 +14,9 @@ #define D152_INIT -#include <rtems.h> -#include "console.h" -#include "bsp.h" - +#include <bsp.h> +#include <rtems/libio.h> + /* console_initialize * * This routine initializes the console IO driver. @@ -28,19 +27,27 @@ * * Return values: */ - + rtems_device_driver console_initialize( rtems_device_major_number major, rtems_device_minor_number minor, - void *arg, - rtems_id self, - rtems_unsigned32 *status + void *arg ) { - *status = RTEMS_SUCCESSFUL; + rtems_status_code status; + + status = rtems_io_register_name( + "/dev/console", + major, + (rtems_device_minor_number) 0 + ); + + if (status != RTEMS_SUCCESSFUL) + rtems_fatal_error_occurred(status); + + return RTEMS_SUCCESSFUL; } - /* is_character_ready * * This routine returns TRUE if a character is available. @@ -139,48 +146,102 @@ void outbyte( } /* - * __read -- read bytes from the serial port. Ignore fd, since - * we only have stdin. + * Open entry point */ -int __read( - int fd, - char *buf, - int nbytes +rtems_device_driver console_open( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg ) { - int i = 0; + return RTEMS_SUCCESSFUL; +} + +/* + * Close entry point + */ + +rtems_device_driver console_close( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg +) +{ + return RTEMS_SUCCESSFUL; +} + +/* + * read bytes from the serial port. We only have stdin. + */ - for (i = 0; i < nbytes; i++) { - *(buf + i) = inbyte(); - if ((*(buf + i) == '\n') || (*(buf + i) == '\r')) { - (*(buf + i++)) = '\n'; - (*(buf + i)) = 0; +rtems_device_driver console_read( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg +) +{ + rtems_libio_rw_args_t *rw_args; + char *buffer; + int maximum; + int count = 0; + + rw_args = (rtems_libio_rw_args_t *) arg; + + buffer = rw_args->buffer; + maximum = rw_args->count; + + for (count = 0; count < maximum; count++) { + buffer[ count ] = inbyte(); + if (buffer[ count ] == '\n' || buffer[ count ] == '\r') { + buffer[ count++ ] = '\n'; + buffer[ count ] = 0; break; } } - return (i); + + rw_args->bytes_moved = count; + return (count >= 0) ? RTEMS_SUCCESSFUL : RTEMS_UNSATISFIED; } /* - * __write -- write bytes to the serial port. Ignore fd, since - * stdout and stderr are the same. Since we have no filesystem, - * open will only return an error. + * write bytes to the serial port. Stdout and stderr are the same. */ -int __write( - int fd, - char *buf, - int nbytes +rtems_device_driver console_write( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg ) { - int i; + int count; + int maximum; + rtems_libio_rw_args_t *rw_args; + char *buffer; - for (i = 0; i < nbytes; i++) { - if (*(buf + i) == '\n') { - outbyte ('\r'); + rw_args = (rtems_libio_rw_args_t *) arg; + + buffer = rw_args->buffer; + maximum = rw_args->count; + + for (count = 0; count < maximum; count++) { + if ( buffer[ count ] == '\n') { + outbyte('\r'); } - outbyte (*(buf + i)); + outbyte( buffer[ count ] ); } - return (nbytes); + return maximum; +} + +/* + * IO Control entry point + */ + +rtems_device_driver console_control( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg +) +{ + return RTEMS_SUCCESSFUL; } diff --git a/c/src/lib/libbsp/m68k/dmv152/include/bsp.h b/c/src/lib/libbsp/m68k/dmv152/include/bsp.h index c2d3918e7f..5a31136005 100644 --- a/c/src/lib/libbsp/m68k/dmv152/include/bsp.h +++ b/c/src/lib/libbsp/m68k/dmv152/include/bsp.h @@ -21,7 +21,10 @@ extern "C" { #endif #include <rtems.h> +#include <console.h> +#include <clockdrv.h> #include <iosupp.h> +#include <vmeintr.h> #include <z8530.h> #include <z8536.h> @@ -151,6 +154,24 @@ extern rtems_configuration_table BSP_Configuration; extern m68k_isr_entry M68Kvec[]; /* vector table address */ +/* + * Device Driver Table Entries + */ + +/* + * NOTE: Use the standard Console driver entry + */ + +/* + * NOTE: Use the standard Clock driver entry + */ + +/* + * How many libio files we want + */ + +#define BSP_LIBIO_MAX_FDS 20 + /* functions */ void bsp_cleanup( void ); diff --git a/c/src/lib/libbsp/m68k/dmv152/startup/bspstart.c b/c/src/lib/libbsp/m68k/dmv152/startup/bspstart.c index e66abc9ad2..4079ee4a8e 100644 --- a/c/src/lib/libbsp/m68k/dmv152/startup/bspstart.c +++ b/c/src/lib/libbsp/m68k/dmv152/startup/bspstart.c @@ -21,11 +21,17 @@ * $Id$ */ -#include <rtems.h> #include <bsp.h> +#include <rtems/libio.h> + #include <libcsupport.h> -#include <vmeintr.h> - + +#include <string.h> +#include <fcntl.h> + +#ifdef STACK_CHECKER_ON +#include <stackchk.h> +#endif /* * The original table from the application and our copy of it with * some changes. @@ -36,6 +42,8 @@ rtems_configuration_table BSP_Configuration; rtems_cpu_table Cpu_table; +char *rtems_progname; + /* Initialize whatever libc we are using * called from postdriver hook */ @@ -52,6 +60,14 @@ void bsp_libc_init() RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0); /* + * Init the RTEMS libio facility to provide UNIX-like system + * calls for use by newlib (ie: provide __open, __close, etc) + * Uses malloc() to get area for the iops, so must be after malloc init + */ + + rtems_libio_init(); + + /* * Set up for the libc handling. */ @@ -69,7 +85,33 @@ void bsp_libc_init() #endif } -int bsp_start( +/* + * After drivers are setup, register some "filenames" + * and open stdin, stdout, stderr files + * + * Newlib will automatically associate the files with these + * (it hardcodes the numbers) + */ + +void +bsp_postdriver_hook(void) +{ + int stdin_fd, stdout_fd, stderr_fd; + + if ((stdin_fd = __open("/dev/console", O_RDONLY, 0)) == -1) + rtems_fatal_error_occurred('STD0'); + + if ((stdout_fd = __open("/dev/console", O_WRONLY, 0)) == -1) + rtems_fatal_error_occurred('STD1'); + + if ((stderr_fd = __open("/dev/console", O_WRONLY, 0)) == -1) + rtems_fatal_error_occurred('STD2'); + + if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2)) + rtems_fatal_error_occurred('STIO'); +} + +int main( int argc, char **argv, char **environp @@ -79,6 +121,11 @@ int bsp_start( int index; void *vbr; + if ((argc > 0) && argv && argv[0]) + rtems_progname = argv[0]; + else + rtems_progname = "RTEMS"; + monitors_vector_table = (m68k_isr_entry *)0; /* Monitor Vectors are at 0 */ m68k_set_vbr( monitors_vector_table ); @@ -115,7 +162,7 @@ int bsp_start( Cpu_table.predriver_hook = bsp_libc_init; /* RTEMS resources available */ - Cpu_table.postdriver_hook = NULL; /* Call our main() for constructors */ + Cpu_table.postdriver_hook = bsp_postdriver_hook; Cpu_table.idle_task = NULL; /* do not override system IDLE task */ @@ -159,6 +206,12 @@ int bsp_start( BSP_Configuration.maximum_extensions++; #endif + /* + * Tell libio how many fd's we want and allow it to tweak config + */ + + rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS); + rtems_initialize_executive( &BSP_Configuration, &Cpu_table ); /* does not return */ diff --git a/c/src/lib/libbsp/m68k/gen68302/clock/ckinit.c b/c/src/lib/libbsp/m68k/gen68302/clock/ckinit.c index be3cf6ab21..f842bbc83c 100644 --- a/c/src/lib/libbsp/m68k/gen68302/clock/ckinit.c +++ b/c/src/lib/libbsp/m68k/gen68302/clock/ckinit.c @@ -20,11 +20,12 @@ #include <stdlib.h> /* for atexit() */ -#include <rtems.h> #include <bsp.h> -#include <clockdrv.h> +#include <rtems/libio.h> + #include "m68302.h" +#define CLOCK_VECTOR 137 #define TMR1_VAL ( RBIT_TMR_RST /* software reset the timer */\ | RBIT_TMR_ICLK_MASTER16 /* master clock divided by 16 */\ @@ -49,18 +50,35 @@ volatile rtems_unsigned32 Clock_driver_ticks; */ rtems_unsigned32 Clock_isrs; +void Clock_exit( void ); + +/* + * These are set by clock driver during its init + */ + +rtems_device_major_number rtems_clock_major = ~0; +rtems_device_minor_number rtems_clock_minor; -rtems_device_driver Clock_initialize( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *pargp, - rtems_id tid, - rtems_unsigned32 *rval +/* + * ISR Handler + */ + +rtems_isr Clock_isr( + rtems_vector_number vector ) { - Install_clock( Clock_isr ); -} + Clock_driver_ticks += 1; + m302.reg.isr = RBIT_ISR_TIMER1; /* clear in-service bit */ + m302.reg.ter1 = (RBIT_TER_REF | RBIT_TER_CAP); /* clear timer intr request */ + + if ( Clock_isrs == 1 ) { + rtems_clock_tick(); + Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000; + } + else + Clock_isrs -= 1; +} void Install_clock( rtems_isr_entry clock_isr @@ -71,7 +89,7 @@ void Install_clock( Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000; if ( BSP_Configuration.ticks_per_timeslice ) { -/* set_vector( clock_isr, 137, 1 );*/ +/* set_vector( clock_isr, CLOCK_VECTOR, 1 );*/ m302.reg.trr1 = TRR1_VAL; /* set timer reference register */ m302.reg.tmr1 = TMR1_VAL; /* set timer mode register & enable */ @@ -84,6 +102,16 @@ void Install_clock( } } +void ReInstall_clock( + rtems_isr_entry clock_isr +) +{ + rtems_unsigned32 isrlevel; + + rtems_interrupt_disable( isrlevel ); + /* (void) set_vector( clock_isr, CLOCK_VECTOR, 1 ); */ + rtems_interrupt_enable( isrlevel ); +} void Clock_exit( void ) { @@ -92,3 +120,51 @@ void Clock_exit( void ) /* do not restore old vector */ } } + +rtems_device_driver Clock_initialize( + rtems_device_major_number major, + rtems_device_minor_number minor, + void *pargp +) +{ + Install_clock( Clock_isr ); + + /* + * make major/minor avail to others such as shared memory driver + */ + + rtems_clock_major = major; + rtems_clock_minor = minor; + + return RTEMS_SUCCESSFUL; +} + +rtems_device_driver Clock_control( + rtems_device_major_number major, + rtems_device_minor_number minor, + void *pargp +) +{ + rtems_libio_ioctl_args_t *args = pargp; + + if (args == 0) + goto done; + + /* + * This is hokey, but until we get a defined interface + * to do this, it will just be this simple... + */ + + if (args->command == rtems_build_name('I', 'S', 'R', ' ')) + { + Clock_isr( CLOCK_VECTOR); + } + else if (args->command == rtems_build_name('N', 'E', 'W', ' ')) + { + ReInstall_clock(args->buffer); + } + +done: + return RTEMS_SUCCESSFUL; +} + diff --git a/c/src/lib/libbsp/m68k/gen68302/console/console.c b/c/src/lib/libbsp/m68k/gen68302/console/console.c index 7f488c5cfd..dd461e4557 100644 --- a/c/src/lib/libbsp/m68k/gen68302/console/console.c +++ b/c/src/lib/libbsp/m68k/gen68302/console/console.c @@ -14,9 +14,8 @@ #define GEN68302_INIT -#include <rtems.h> -#include "console.h" #include <bsp.h> +#include <rtems/libio.h> #include "m68302.h" @@ -34,11 +33,10 @@ rtems_device_driver console_initialize( rtems_device_major_number major, rtems_device_minor_number minor, - void *arg, - rtems_id self, - rtems_unsigned32 *status + void *arg ) { + rtems_status_code status; volatile m302_dualPortRAM_t *p = &m302; p->reg.pacnt |= 0x0003; /* enable RXD2 and TXD2 signals */ @@ -81,9 +79,18 @@ rtems_device_driver console_initialize( p->reg.scc[1].sccm = 0x03; /* enable only Tx & Rx interrupts */ p->reg.scc[1].scm = 0x01BD; - *status = RTEMS_SUCCESSFUL; -} + status = rtems_io_register_name( + "/dev/console", + major, + (rtems_device_minor_number) 0 + ); + + if (status != RTEMS_SUCCESSFUL) + rtems_fatal_error_occurred(status); + + return RTEMS_SUCCESSFUL; +} /* is_character_ready * @@ -194,48 +201,102 @@ void outbyte( } /* - * __read -- read bytes from the serial port. Ignore fd, since - * we only have stdin. + * Open entry point + */ + +rtems_device_driver console_open( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg +) +{ + return RTEMS_SUCCESSFUL; +} + +/* + * Close entry point */ -int __read( - int fd, - char *buf, - int nbytes +rtems_device_driver console_close( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg ) { - int i = 0; + return RTEMS_SUCCESSFUL; +} + +/* + * read bytes from the serial port. We only have stdin. + */ - for (i = 0; i < nbytes; i++) { - *(buf + i) = inbyte(); - if ((*(buf + i) == '\n') || (*(buf + i) == '\r')) { - (*(buf + i++)) = '\n'; - (*(buf + i)) = 0; +rtems_device_driver console_read( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg +) +{ + rtems_libio_rw_args_t *rw_args; + char *buffer; + int maximum; + int count = 0; + + rw_args = (rtems_libio_rw_args_t *) arg; + + buffer = rw_args->buffer; + maximum = rw_args->count; + + for (count = 0; count < maximum; count++) { + buffer[ count ] = inbyte(); + if (buffer[ count ] == '\n' || buffer[ count ] == '\r') { + buffer[ count++ ] = '\n'; + buffer[ count ] = 0; break; } } - return (i); + + rw_args->bytes_moved = count; + return (count >= 0) ? RTEMS_SUCCESSFUL : RTEMS_UNSATISFIED; } /* - * __write -- write bytes to the serial port. Ignore fd, since - * stdout and stderr are the same. Since we have no filesystem, - * open will only return an error. + * write bytes to the serial port. Stdout and stderr are the same. */ -int __write( - int fd, - char *buf, - int nbytes +rtems_device_driver console_write( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg ) { - int i; + int count; + int maximum; + rtems_libio_rw_args_t *rw_args; + char *buffer; - for (i = 0; i < nbytes; i++) { - if (*(buf + i) == '\n') { - outbyte ('\r'); + rw_args = (rtems_libio_rw_args_t *) arg; + + buffer = rw_args->buffer; + maximum = rw_args->count; + + for (count = 0; count < maximum; count++) { + if ( buffer[ count ] == '\n') { + outbyte('\r'); } - outbyte (*(buf + i)); + outbyte( buffer[ count ] ); } - return (nbytes); + return maximum; +} + +/* + * IO Control entry point + */ + +rtems_device_driver console_control( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg +) +{ + return RTEMS_SUCCESSFUL; } diff --git a/c/src/lib/libbsp/m68k/gen68302/include/bsp.h b/c/src/lib/libbsp/m68k/gen68302/include/bsp.h index 04745e01d6..eed274fb9a 100644 --- a/c/src/lib/libbsp/m68k/gen68302/include/bsp.h +++ b/c/src/lib/libbsp/m68k/gen68302/include/bsp.h @@ -23,7 +23,9 @@ extern "C" { #endif #include <rtems.h> +#include <console.h> #include <iosupp.h> +#include <clockdrv.h> /* * Define the time limits for RTEMS Test Suite test durations. @@ -81,6 +83,24 @@ extern "C" { #define EXTERN extern #endif +/* + * Device Driver Table Entries + */ + +/* + * NOTE: Use the standard Console driver entry + */ + +/* + * NOTE: Use the standard Clock driver entry + */ + +/* + * How many libio files we want + */ + +#define BSP_LIBIO_MAX_FDS 20 + /* miscellaneous stuff assumed to exist */ extern rtems_configuration_table BSP_Configuration; diff --git a/c/src/lib/libbsp/m68k/gen68302/start/start302.s b/c/src/lib/libbsp/m68k/gen68302/start/start302.s index 2682066e84..d92ed1ce6b 100644 --- a/c/src/lib/libbsp/m68k/gen68302/start/start302.s +++ b/c/src/lib/libbsp/m68k/gen68302/start/start302.s @@ -227,7 +227,10 @@ loop: movel d0,a1@+ | to zero out uninitialized movec a0,isp | set interrupt stack #endif - jsr SYM (bsp_start) + move.l #0,a7@- | environp + move.l #0,a7@- | argv + move.l #0,a7@- | argc + jsr SYM (main) nop Bad: bra Bad diff --git a/c/src/lib/libbsp/m68k/gen68302/start302/start302.s b/c/src/lib/libbsp/m68k/gen68302/start302/start302.s index 2682066e84..d92ed1ce6b 100644 --- a/c/src/lib/libbsp/m68k/gen68302/start302/start302.s +++ b/c/src/lib/libbsp/m68k/gen68302/start302/start302.s @@ -227,7 +227,10 @@ loop: movel d0,a1@+ | to zero out uninitialized movec a0,isp | set interrupt stack #endif - jsr SYM (bsp_start) + move.l #0,a7@- | environp + move.l #0,a7@- | argv + move.l #0,a7@- | argc + jsr SYM (main) nop Bad: bra Bad diff --git a/c/src/lib/libbsp/m68k/gen68302/startup/bspstart.c b/c/src/lib/libbsp/m68k/gen68302/startup/bspstart.c index 976046cf9f..72e1656e04 100644 --- a/c/src/lib/libbsp/m68k/gen68302/startup/bspstart.c +++ b/c/src/lib/libbsp/m68k/gen68302/startup/bspstart.c @@ -20,10 +20,17 @@ * $Id$ */ -#include <rtems.h> #include <bsp.h> +#include <rtems/libio.h> + #include <libcsupport.h> - + +#include <string.h> +#include <fcntl.h> + +#ifdef STACK_CHECKER_ON +#include <stackchk.h> +#endif /* * The original table from the application and our copy of it with @@ -35,6 +42,8 @@ rtems_configuration_table BSP_Configuration; rtems_cpu_table Cpu_table; +char *rtems_progname; + /* Initialize whatever libc we are using * called from postdriver hook */ @@ -58,6 +67,14 @@ void bsp_libc_init() RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0); /* + * Init the RTEMS libio facility to provide UNIX-like system + * calls for use by newlib (ie: provide __open, __close, etc) + * Uses malloc() to get area for the iops, so must be after malloc init + */ + + rtems_libio_init(); + + /* * Set up for the libc handling. */ @@ -75,13 +92,43 @@ void bsp_libc_init() #endif } +/* + * After drivers are setup, register some "filenames" + * and open stdin, stdout, stderr files + * + * Newlib will automatically associate the files with these + * (it hardcodes the numbers) + */ + +void +bsp_postdriver_hook(void) +{ + int stdin_fd, stdout_fd, stderr_fd; + + if ((stdin_fd = __open("/dev/console", O_RDONLY, 0)) == -1) + rtems_fatal_error_occurred('STD0'); + + if ((stdout_fd = __open("/dev/console", O_WRONLY, 0)) == -1) + rtems_fatal_error_occurred('STD1'); + + if ((stderr_fd = __open("/dev/console", O_WRONLY, 0)) == -1) + rtems_fatal_error_occurred('STD2'); + + if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2)) + rtems_fatal_error_occurred('STIO'); +} -int bsp_start( +int main( int argc, char **argv, char **environp ) { + if ((argc > 0) && argv && argv[0]) + rtems_progname = argv[0]; + else + rtems_progname = "RTEMS"; + /* * Allocate the memory for the RTEMS Work Space. This can come from * a variety of places: hard coded address, malloc'ed from outside @@ -90,7 +137,7 @@ int bsp_start( * of work space from the last physical address on the CPU board. */ #if 0 -a Cpu_table.interrupt_vector_table = (mc68000_isr *) 0/*&M68Kvec*/; + Cpu_table.interrupt_vector_table = (mc68000_isr *) 0/*&M68Kvec*/; #endif @@ -123,6 +170,12 @@ a Cpu_table.interrupt_vector_table = (mc68000_isr *) 0/*&M68Kvec*/; #endif /* + * Tell libio how many fd's we want and allow it to tweak config + */ + + rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS); + + /* * Need to "allocate" the memory for the RTEMS Workspace and * tell the RTEMS configuration where it is. This memory is * not malloc'ed. It is just "pulled from the air". @@ -143,7 +196,7 @@ a Cpu_table.interrupt_vector_table = (mc68000_isr *) 0/*&M68Kvec*/; Cpu_table.predriver_hook = bsp_libc_init; /* RTEMS resources available */ - Cpu_table.postdriver_hook = NULL; + Cpu_table.postdriver_hook = bsp_postdriver_hook; Cpu_table.idle_task = NULL; /* do not override system IDLE task */ diff --git a/c/src/lib/libbsp/m68k/idp/clock/ckinit.c b/c/src/lib/libbsp/m68k/idp/clock/ckinit.c index b27e9bbe38..7966fc61d1 100644 --- a/c/src/lib/libbsp/m68k/idp/clock/ckinit.c +++ b/c/src/lib/libbsp/m68k/idp/clock/ckinit.c @@ -26,9 +26,8 @@ #include <stdlib.h> -#include <rtems.h> -#include <clockdrv.h> #include <bsp.h> +#include <rtems/libio.h> rtems_unsigned32 Clock_isrs; /* ISRs until next tick */ volatile rtems_unsigned32 Clock_driver_ticks; @@ -39,30 +38,53 @@ extern rtems_configuration_table Configuration; extern void led_putnum(); void Disable_clock(); -#define TIMER_VECTOR 0x4D +#define CLOCK_VECTOR 0x4D -rtems_device_driver Clock_initialize( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *pargp, - rtems_id tid, - rtems_unsigned32 *rval -) -{ - Install_clock( Clock_isr ); -} +void Clock_exit( void ); + +/* + * These are set by clock driver during its init + */ + +rtems_device_major_number rtems_clock_major = ~0; +rtems_device_minor_number rtems_clock_minor; + -void ReInstall_clock( clock_isr ) -rtems_isr_entry clock_isr; -{ - rtems_unsigned32 isrlevel = 0 ; +/* + * ISR Handler + * + * + * ((1ms * 6.5 MHz) / 2^5) = 203.125) where 6.5 MHz is the clock rate of the + * MC68230, 2^5 is the prescaler factor, and 1ms is the common interrupt + * interval for the Clock_isr routine. + * Therefore, 203 (decimal) is the number to program into the CPRH-L registers + * of the MC68230 for countdown. However, I have found that 193 instead of + * 203 provides greater accuracy -- why? The crystal should be more accurate + * than that + */ - rtems_interrupt_disable( isrlevel ); - (void) set_vector( clock_isr, TIMER_VECTOR, 1 ); - rtems_interrupt_enable( isrlevel ); +rtems_isr Clock_isr( + rtems_vector_number vector +) +{ + Clock_driver_ticks += 1; + /* acknowledge interrupt + TSR = 1; */ + MC68230_WRITE (TSR, 1); + + if ( Clock_isrs == 1 ) { + rtems_clock_tick(); + /* Cast to an integer so that 68EC040 IDP which doesn't have an FPU doesn't + have a heart attack -- if you use newlib1.6 or greater and get + libgcc.a for gcc with software floating point support, this is not + a problem */ + Clock_isrs = + (int)(BSP_Configuration.microseconds_per_tick / 1000); + } + else + Clock_isrs -= 1; } -/* The following was added for debugging purposes */ void Disable_clock() { /* Disable timer */ @@ -77,7 +99,7 @@ rtems_isr_entry clock_isr; if ( Configuration.ticks_per_timeslice ) { /* led_putnum('c'); * for debugging purposes */ - Old_ticker = (rtems_isr_entry) set_vector( clock_isr, TIMER_VECTOR, 1 ); + Old_ticker = (rtems_isr_entry) set_vector( clock_isr, CLOCK_VECTOR, 1 ); /* Disable timer for initialization */ MC68230_WRITE (TCR, 0x00); @@ -85,8 +107,8 @@ rtems_isr_entry clock_isr; /* some PI/T initialization stuff here -- see comment in the ckisr.c file in this directory to understand why I use the values that I do */ /* Set up the interrupt vector on the MC68230 chip: - TIVR = TIMER_VECTOR; */ - MC68230_WRITE (TIVR, TIMER_VECTOR); + TIVR = CLOCK_VECTOR; */ + MC68230_WRITE (TIVR, CLOCK_VECTOR); /* Set CPRH through CPRL to 193 (not 203) decimal for countdown--see ckisr.c CPRH = 0x00; @@ -108,6 +130,17 @@ rtems_isr_entry clock_isr; } } +void ReInstall_clock( clock_isr ) +rtems_isr_entry clock_isr; +{ + rtems_unsigned32 isrlevel = 0 ; + + rtems_interrupt_disable( isrlevel ); + (void) set_vector( clock_isr, CLOCK_VECTOR, 1 ); + rtems_interrupt_enable( isrlevel ); +} + +/* The following was added for debugging purposes */ void Clock_exit( void ) { rtems_unsigned8 data; @@ -123,3 +156,51 @@ void Clock_exit( void ) /* do not restore old vector */ } } + +rtems_device_driver Clock_initialize( + rtems_device_major_number major, + rtems_device_minor_number minor, + void *pargp +) +{ + Install_clock( Clock_isr ); + + /* + * make major/minor avail to others such as shared memory driver + */ + + rtems_clock_major = major; + rtems_clock_minor = minor; + + return RTEMS_SUCCESSFUL; +} + +rtems_device_driver Clock_control( + rtems_device_major_number major, + rtems_device_minor_number minor, + void *pargp +) +{ + rtems_libio_ioctl_args_t *args = pargp; + + if (args == 0) + goto done; + + /* + * This is hokey, but until we get a defined interface + * to do this, it will just be this simple... + */ + + if (args->command == rtems_build_name('I', 'S', 'R', ' ')) + { + Clock_isr(CLOCK_VECTOR); + } + else if (args->command == rtems_build_name('N', 'E', 'W', ' ')) + { + ReInstall_clock(args->buffer); + } + +done: + return RTEMS_SUCCESSFUL; +} + diff --git a/c/src/lib/libbsp/m68k/idp/console/console.c b/c/src/lib/libbsp/m68k/idp/console/console.c index 7bb720c120..5540d26fcd 100644 --- a/c/src/lib/libbsp/m68k/idp/console/console.c +++ b/c/src/lib/libbsp/m68k/idp/console/console.c @@ -11,17 +11,15 @@ #define MIDP_INIT -#include "rtems.h" -#include "console.h" -#include "bsp.h" +#include <bsp.h> +#include <rtems/libio.h> -#include "ringbuf.h" +#include <ringbuf.h> Ring_buffer_t Buffer[ 2 ]; rtems_isr C_Receive_ISR(rtems_vector_number vector); - /* console_initialize * * This routine initializes the console IO driver. @@ -36,18 +34,44 @@ rtems_isr C_Receive_ISR(rtems_vector_number vector); rtems_device_driver console_initialize( rtems_device_major_number major, rtems_device_minor_number minor, - void *arg, - rtems_id self, - rtems_unsigned32 *status + void *arg ) { + rtems_status_code status; Ring_buffer_Initialize( &Buffer[ 0 ] ); Ring_buffer_Initialize( &Buffer[ 1 ] ); init_pit(); - *status = RTEMS_SUCCESSFUL; + status = rtems_io_register_name( + "/dev/console", + major, + (rtems_device_minor_number) 0 + ); + + if (status != RTEMS_SUCCESSFUL) + rtems_fatal_error_occurred(status); + + status = rtems_io_register_name( + "/dev/tty00", + major, + (rtems_device_minor_number) 0 + ); + + if (status != RTEMS_SUCCESSFUL) + rtems_fatal_error_occurred(status); + + status = rtems_io_register_name( + "/dev/tty01", + major, + (rtems_device_minor_number) 1 + ); + + if (status != RTEMS_SUCCESSFUL) + rtems_fatal_error_occurred(status); + + return RTEMS_SUCCESSFUL; } @@ -151,66 +175,108 @@ void outbyte( } /* - * __read -- read bytes from the serial port. Ignore fd, since - * we only have stdin. + * Open entry point + */ + +rtems_device_driver console_open( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg +) +{ + return RTEMS_SUCCESSFUL; +} + +/* + * Close entry point + */ + +rtems_device_driver console_close( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg +) +{ + return RTEMS_SUCCESSFUL; +} + +/* + * read bytes from the serial port. We only have stdin. */ -int __read( - int fd, - char *buf, - int nbytes +rtems_device_driver console_read( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg ) { - int i = 0; - int port; - - /* - * Map port A to stdin, stdout, and stderr. - * Map everything else to port B. - */ - - if ( fd <= 2 ) port = 0; - else port = 1; - - for (i = 0; i < nbytes; i++) { - *(buf + i) = inbyte( port ); - if ((*(buf + i) == '\n') || (*(buf + i) == '\r')) { - (*(buf + i++)) = '\n'; - (*(buf + i)) = 0; + rtems_libio_rw_args_t *rw_args; + char *buffer; + int maximum; + int count = 0; + + rw_args = (rtems_libio_rw_args_t *) arg; + + buffer = rw_args->buffer; + maximum = rw_args->count; + + if ( minor > 1 ) + return RTEMS_INVALID_NUMBER; + + for (count = 0; count < maximum; count++) { + buffer[ count ] = inbyte( minor ); + if (buffer[ count ] == '\n' || buffer[ count ] == '\r') { + buffer[ count++ ] = '\n'; + buffer[ count ] = 0; break; } } - return (i); + + rw_args->bytes_moved = count; + return (count >= 0) ? RTEMS_SUCCESSFUL : RTEMS_UNSATISFIED; } /* - * __write -- write bytes to the serial port. Ignore fd, since - * stdout and stderr are the same. Since we have no filesystem, - * open will only return an error. + * write bytes to the serial port. Stdout and stderr are the same. */ -int __write( - int fd, - char *buf, - int nbytes +rtems_device_driver console_write( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg ) { - int i; - int port; - - /* - * Map port A to stdin, stdout, and stderr. - * Map everything else to port B. - */ - - if ( fd <= 2 ) port = 0; - else port = 1; - - for (i = 0; i < nbytes; i++) { - if (*(buf + i) == '\n') { - outbyte ('\r', port ); + int count; + int maximum; + rtems_libio_rw_args_t *rw_args; + char *buffer; + + rw_args = (rtems_libio_rw_args_t *) arg; + + buffer = rw_args->buffer; + maximum = rw_args->count; + + if ( minor > 1 ) + return RTEMS_INVALID_NUMBER; + + for (count = 0; count < maximum; count++) { + if ( buffer[ count ] == '\n') { + outbyte('\r', minor ); } - outbyte (*(buf + i), port ); + outbyte( buffer[ count ], minor ); } - return (nbytes); + return maximum; +} + +/* + * IO Control entry point + */ + +rtems_device_driver console_control( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg +) +{ + return RTEMS_SUCCESSFUL; } diff --git a/c/src/lib/libbsp/m68k/idp/include/bsp.h b/c/src/lib/libbsp/m68k/idp/include/bsp.h index 68faeba68c..65fcfe1e6e 100644 --- a/c/src/lib/libbsp/m68k/idp/include/bsp.h +++ b/c/src/lib/libbsp/m68k/idp/include/bsp.h @@ -10,6 +10,7 @@ #include <rtems.h> #include <console.h> +#include <clockdrv.h> #include <mc68230.h> #include <mc68681.h> @@ -52,6 +53,24 @@ #define EXTERN extern #endif +/* + * Device Driver Table Entries + */ + +/* + * NOTE: Use the standard Console driver entry + */ + +/* + * NOTE: Use the standard Clock driver entry + */ + +/* + * How many libio files we want + */ + +#define BSP_LIBIO_MAX_FDS 20 + /* miscellaneous stuff assumed to exist */ extern rtems_configuration_table BSP_Configuration; diff --git a/c/src/lib/libbsp/m68k/idp/startup/bspstart.c b/c/src/lib/libbsp/m68k/idp/startup/bspstart.c index a0b738c53e..233449282e 100644 --- a/c/src/lib/libbsp/m68k/idp/startup/bspstart.c +++ b/c/src/lib/libbsp/m68k/idp/startup/bspstart.c @@ -20,9 +20,17 @@ * $Id$ */ -#include <rtems.h> #include <bsp.h> +#include <rtems/libio.h> + #include <libcsupport.h> + +#include <string.h> +#include <fcntl.h> + +#ifdef STACK_CHECKER_ON +#include <stackchk.h> +#endif unsigned char *duart_base; extern struct duart_regs duart_info; @@ -41,6 +49,8 @@ rtems_configuration_table BSP_Configuration; rtems_cpu_table Cpu_table; +char *rtems_progname; + /* Initialize whatever libc we are using * called from postdriver hook */ @@ -56,6 +66,14 @@ void bsp_libc_init() /* Create 64 KByte memory region for RTEMS executive */ RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0); + + /* + * Init the RTEMS libio facility to provide UNIX-like system + * calls for use by newlib (ie: provide __open, __close, etc) + * Uses malloc() to get area for the iops, so must be after malloc init + */ + + rtems_libio_init(); /* * Set up for the libc handling. @@ -76,7 +94,33 @@ void bsp_libc_init() } -int bsp_start( +/* + * After drivers are setup, register some "filenames" + * and open stdin, stdout, stderr files + * + * Newlib will automatically associate the files with these + * (it hardcodes the numbers) + */ + +void +bsp_postdriver_hook(void) +{ + int stdin_fd, stdout_fd, stderr_fd; + + if ((stdin_fd = __open("/dev/console", O_RDONLY, 0)) == -1) + rtems_fatal_error_occurred('STD0'); + + if ((stdout_fd = __open("/dev/console", O_WRONLY, 0)) == -1) + rtems_fatal_error_occurred('STD1'); + + if ((stderr_fd = __open("/dev/console", O_WRONLY, 0)) == -1) + rtems_fatal_error_occurred('STD2'); + + if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2)) + rtems_fatal_error_occurred('STIO'); +} + +int main( int argc, char **argv, char **environp @@ -85,6 +129,11 @@ int bsp_start( m68k_isr_entry *monitors_vector_table; int index; + if ((argc > 0) && argv && argv[0]) + rtems_progname = argv[0]; + else + rtems_progname = "RTEMS"; + duart_base = (unsigned char *)DUART_ADDR; /* @@ -121,7 +170,7 @@ int bsp_start( Cpu_table.predriver_hook = bsp_libc_init; /* RTEMS resources available */ - Cpu_table.postdriver_hook = NULL; + Cpu_table.postdriver_hook = bsp_postdriver_hook; Cpu_table.idle_task = NULL; /* do not override system IDLE task */ @@ -164,6 +213,12 @@ int bsp_start( BSP_Configuration.maximum_extensions++; #endif + /* + * Tell libio how many fd's we want and allow it to tweak config + */ + + rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS); + /* led_putnum('e'); * for debugging purposes only */ rtems_initialize_executive( &BSP_Configuration, &Cpu_table );/* does not return */ diff --git a/c/src/lib/libbsp/m68k/mvme136/clock/ckinit.c b/c/src/lib/libbsp/m68k/mvme136/clock/ckinit.c index de88fe9252..195d4a11af 100644 --- a/c/src/lib/libbsp/m68k/mvme136/clock/ckinit.c +++ b/c/src/lib/libbsp/m68k/mvme136/clock/ckinit.c @@ -20,9 +20,8 @@ #include <stdlib.h> -#include <rtems.h> #include <bsp.h> -#include <clockdrv.h> +#include <rtems/libio.h> #include <z8036.h> #define MICRVAL 0xe2 /* disable lower chain, no vec */ @@ -35,31 +34,43 @@ #define T1CSRVAL 0xc6 /* enable interrupt, allow and */ /* and trigger countdown */ +#define TIMER 0xfffb0000 +#define RELOAD 0x24 /* clr IP & IUS,allow countdown */ + +#define CLOCK_VECTOR 66 + rtems_unsigned32 Clock_isrs; /* ISRs until next tick */ -volatile rtems_unsigned32 Clock_driver_ticks; - /* ticks since initialization */ + +volatile rtems_unsigned32 Clock_driver_ticks; /* ticks since initialization */ + rtems_isr_entry Old_ticker; -rtems_device_driver Clock_initialize( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *pargp, - rtems_id tid, - rtems_unsigned32 *rval -) -{ - Install_clock( Clock_isr ); -} +void Clock_exit( void ); -void ReInstall_clock( - rtems_isr_entry clock_isr +/* + * These are set by clock driver during its init + */ + +rtems_device_major_number rtems_clock_major = ~0; +rtems_device_minor_number rtems_clock_minor; + +/* + * ISR Handler + */ + +rtems_isr Clock_isr( + rtems_vector_number vector ) { - rtems_unsigned32 isrlevel; + Clock_driver_ticks += 1; + ((volatile struct z8036_map *) TIMER)->CT1_CMD_STATUS = RELOAD; - rtems_interrupt_disable( isrlevel ); - (void) set_vector( clock_isr, 66, 1 ); - rtems_interrupt_enable( isrlevel ); + if ( Clock_isrs == 1 ) { + rtems_clock_tick(); + Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000; + } + else + Clock_isrs -= 1; } void Install_clock( @@ -72,30 +83,42 @@ void Install_clock( Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000; if ( BSP_Configuration.ticks_per_timeslice ) { - Old_ticker = (rtems_isr_entry) set_vector( clock_isr, 66, 1 ); + Old_ticker = (rtems_isr_entry) set_vector( clock_isr, CLOCK_VECTOR, 1 ); timer = (struct z8036_map *) 0xfffb0000; timer->MASTER_INTR = MICRVAL; timer->CT1_MODE_SPEC = T1MSRVAL; - *((rtems_unsigned16 *)0xfffb0016) = MS_COUNT; /* write countdown value */ -/* - timer->CT1_TIME_CONST_MSB = (MS_COUNT >> 8); - timer->CT1_TIME_CONST_LSB = (MS_COUNT & 0xff); -*/ + *((rtems_unsigned16 *)0xfffb0016) = MS_COUNT; /* write countdown value */ + + /* + * timer->CT1_TIME_CONST_MSB = (MS_COUNT >> 8); + * timer->CT1_TIME_CONST_LSB = (MS_COUNT & 0xff); + */ + timer->MASTER_CFG = MCCRVAL; timer->CT1_CMD_STATUS = T1CSRVAL; -/* - * Enable interrupt via VME interrupt mask register - */ + /* + * Enable interrupt via VME interrupt mask register + */ (*(rtems_unsigned8 *)0xfffb0038) &= 0xfd; - atexit( Clock_exit ); } } +void ReInstall_clock( + rtems_isr_entry clock_isr +) +{ + rtems_unsigned32 isrlevel; + + rtems_interrupt_disable( isrlevel ); + (void) set_vector( clock_isr, CLOCK_VECTOR, 1 ); + rtems_interrupt_enable( isrlevel ); +} + void Clock_exit( void ) { volatile struct z8036_map *timer; @@ -109,3 +132,51 @@ void Clock_exit( void ) /* do not restore old vector */ } } + +rtems_device_driver Clock_initialize( + rtems_device_major_number major, + rtems_device_minor_number minor, + void *pargp +) +{ + Install_clock( Clock_isr ); + + /* + * make major/minor avail to others such as shared memory driver + */ + + rtems_clock_major = major; + rtems_clock_minor = minor; + + return RTEMS_SUCCESSFUL; +} + +rtems_device_driver Clock_control( + rtems_device_major_number major, + rtems_device_minor_number minor, + void *pargp +) +{ + rtems_libio_ioctl_args_t *args = pargp; + + if (args == 0) + goto done; + + /* + * This is hokey, but until we get a defined interface + * to do this, it will just be this simple... + */ + + if (args->command == rtems_build_name('I', 'S', 'R', ' ')) + { + Clock_isr(CLOCK_VECTOR); + } + else if (args->command == rtems_build_name('N', 'E', 'W', ' ')) + { + ReInstall_clock(args->buffer); + } + +done: + return RTEMS_SUCCESSFUL; +} + diff --git a/c/src/lib/libbsp/m68k/mvme136/console/console.c b/c/src/lib/libbsp/m68k/mvme136/console/console.c index 6bfcf84481..e619fc1428 100644 --- a/c/src/lib/libbsp/m68k/mvme136/console/console.c +++ b/c/src/lib/libbsp/m68k/mvme136/console/console.c @@ -14,9 +14,8 @@ #define M136_INIT -#include <rtems.h> -#include "console.h" -#include "bsp.h" +#include <bsp.h> +#include <rtems/libio.h> /* console_initialize * @@ -32,14 +31,24 @@ rtems_device_driver console_initialize( rtems_device_major_number major, rtems_device_minor_number minor, - void *arg, - rtems_id self, - rtems_unsigned32 *status + void *arg ) { + rtems_status_code status; + _Write_m681 = ( struct w_m681_info * ) M681ADDR; _Read_m681 = ( struct r_m681_info * ) M681ADDR; - *status = RTEMS_SUCCESSFUL; + + status = rtems_io_register_name( + "/dev/console", + major, + (rtems_device_minor_number) 0 + ); + + if (status != RTEMS_SUCCESSFUL) + rtems_fatal_error_occurred(status); + + return RTEMS_SUCCESSFUL; } @@ -112,48 +121,102 @@ void outbyte( } /* - * __read -- read bytes from the serial port. Ignore fd, since - * we only have stdin. + * Open entry point */ -int __read( - int fd, - char *buf, - int nbytes +rtems_device_driver console_open( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg ) { - int i = 0; + return RTEMS_SUCCESSFUL; +} + +/* + * Close entry point + */ + +rtems_device_driver console_close( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg +) +{ + return RTEMS_SUCCESSFUL; +} + +/* + * read bytes from the serial port. We only have stdin. + */ - for (i = 0; i < nbytes; i++) { - *(buf + i) = inbyte(); - if ((*(buf + i) == '\n') || (*(buf + i) == '\r')) { - (*(buf + i++)) = '\n'; - (*(buf + i)) = 0; +rtems_device_driver console_read( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg +) +{ + rtems_libio_rw_args_t *rw_args; + char *buffer; + int maximum; + int count = 0; + + rw_args = (rtems_libio_rw_args_t *) arg; + + buffer = rw_args->buffer; + maximum = rw_args->count; + + for (count = 0; count < maximum; count++) { + buffer[ count ] = inbyte(); + if (buffer[ count ] == '\n' || buffer[ count ] == '\r') { + buffer[ count++ ] = '\n'; + buffer[ count ] = 0; break; } } - return (i); + + rw_args->bytes_moved = count; + return (count >= 0) ? RTEMS_SUCCESSFUL : RTEMS_UNSATISFIED; } /* - * __write -- write bytes to the serial port. Ignore fd, since - * stdout and stderr are the same. Since we have no filesystem, - * open will only return an error. + * write bytes to the serial port. Stdout and stderr are the same. */ -int __write( - int fd, - char *buf, - int nbytes +rtems_device_driver console_write( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg ) { - int i; + int count; + int maximum; + rtems_libio_rw_args_t *rw_args; + char *buffer; - for (i = 0; i < nbytes; i++) { - if (*(buf + i) == '\n') { - outbyte ('\r'); + rw_args = (rtems_libio_rw_args_t *) arg; + + buffer = rw_args->buffer; + maximum = rw_args->count; + + for (count = 0; count < maximum; count++) { + if ( buffer[ count ] == '\n') { + outbyte('\r'); } - outbyte (*(buf + i)); + outbyte( buffer[ count ] ); } - return (nbytes); + return maximum; +} + +/* + * IO Control entry point + */ + +rtems_device_driver console_control( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg +) +{ + return RTEMS_SUCCESSFUL; } diff --git a/c/src/lib/libbsp/m68k/mvme136/include/bsp.h b/c/src/lib/libbsp/m68k/mvme136/include/bsp.h index 939a09d41e..85d899ee7c 100644 --- a/c/src/lib/libbsp/m68k/mvme136/include/bsp.h +++ b/c/src/lib/libbsp/m68k/mvme136/include/bsp.h @@ -21,6 +21,8 @@ extern "C" { #endif #include <rtems.h> +#include <clockdrv.h> +#include <console.h> #include <iosupp.h> /* @@ -124,6 +126,24 @@ EXTERN volatile struct w_m681_info *_Write_m681; /* M68681 write registers */ extern m68k_isr_entry M68Kvec[]; /* vector table address */ +/* + * Device Driver Table Entries + */ + +/* + * NOTE: Use the standard Console driver entry + */ + +/* + * NOTE: Use the standard Clock driver entry + */ + +/* + * How many libio files we want + */ + +#define BSP_LIBIO_MAX_FDS 20 + /* functions */ void bsp_cleanup( void ); diff --git a/c/src/lib/libbsp/m68k/mvme136/startup/bspstart.c b/c/src/lib/libbsp/m68k/mvme136/startup/bspstart.c index 916b495520..5f822855e8 100644 --- a/c/src/lib/libbsp/m68k/mvme136/startup/bspstart.c +++ b/c/src/lib/libbsp/m68k/mvme136/startup/bspstart.c @@ -20,12 +20,18 @@ * $Id$ */ -#include <rtems.h> #include <bsp.h> +#include <rtems/libio.h> + #include <libcsupport.h> #include <z8036.h> -#include "stackchk.h" +#include <string.h> +#include <fcntl.h> + +#ifdef STACK_CHECKER_ON +#include <stackchk.h> +#endif /* * The original table from the application and our copy of it with @@ -37,6 +43,8 @@ rtems_configuration_table BSP_Configuration; rtems_cpu_table Cpu_table; +char *rtems_progname; + /* Initialize whatever libc we are using * called from postdriver hook */ @@ -46,6 +54,10 @@ void bsp_libc_init() extern int end; rtems_unsigned32 heap_start; +#ifdef RTEMS_DEBUG + rtems_debug_enable( RTEMS_DEBUG_ALL_MASK ); +#endif + heap_start = (rtems_unsigned32) &end; if (heap_start & (CPU_ALIGNMENT-1)) heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); @@ -53,6 +65,14 @@ void bsp_libc_init() RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0); /* + * Init the RTEMS libio facility to provide UNIX-like system + * calls for use by newlib (ie: provide __open, __close, etc) + * Uses malloc() to get area for the iops, so must be after malloc init + */ + + rtems_libio_init(); + + /* * Set up for the libc handling. */ @@ -70,7 +90,34 @@ void bsp_libc_init() #endif } -int bsp_start( +/* + * After drivers are setup, register some "filenames" + * and open stdin, stdout, stderr files + * + * Newlib will automatically associate the files with these + * (it hardcodes the numbers) + */ + +void +bsp_postdriver_hook(void) +{ + int stdin_fd, stdout_fd, stderr_fd; + + if ((stdin_fd = __open("/dev/console", O_RDONLY, 0)) == -1) + rtems_fatal_error_occurred('STD0'); + + if ((stdout_fd = __open("/dev/console", O_WRONLY, 0)) == -1) + rtems_fatal_error_occurred('STD1'); + + if ((stderr_fd = __open("/dev/console", O_WRONLY, 0)) == -1) + rtems_fatal_error_occurred('STD2'); + + if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2)) + rtems_fatal_error_occurred('STIO'); +} + + +int main( int argc, char **argv, char **environp @@ -79,6 +126,11 @@ int bsp_start( m68k_isr_entry *monitors_vector_table; int index; + if ((argc > 0) && argv && argv[0]) + rtems_progname = argv[0]; + else + rtems_progname = "RTEMS"; + monitors_vector_table = (m68k_isr_entry *)0; /* 135Bug Vectors are at 0 */ m68k_set_vbr( monitors_vector_table ); @@ -104,7 +156,7 @@ int bsp_start( Cpu_table.predriver_hook = bsp_libc_init; /* RTEMS resources available */ - Cpu_table.postdriver_hook = NULL; + Cpu_table.postdriver_hook = bsp_postdriver_hook; Cpu_table.idle_task = NULL; /* do not override system IDLE task */ @@ -147,6 +199,12 @@ int bsp_start( BSP_Configuration.maximum_extensions++; #endif + /* + * Tell libio how many fd's we want and allow it to tweak config + */ + + rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS); + rtems_initialize_executive( &BSP_Configuration, &Cpu_table ); /* does not return */ diff --git a/c/src/lib/libbsp/m68k/mvme162/clock/ckinit.c b/c/src/lib/libbsp/m68k/mvme162/clock/ckinit.c index 4118b4d360..df0a13d52f 100644 --- a/c/src/lib/libbsp/m68k/mvme162/clock/ckinit.c +++ b/c/src/lib/libbsp/m68k/mvme162/clock/ckinit.c @@ -27,9 +27,8 @@ #include <stdlib.h> -#include <rtems.h> #include <bsp.h> -#include <clockdrv.h> +#include <rtems/libio.h> #define MS_COUNT 1000 /* T2's countdown constant (1 ms) */ #define CLOCK_INT_LEVEL 6 /* T2's interrupt level */ @@ -38,24 +37,33 @@ rtems_unsigned32 Clock_isrs; /* ISRs until next tick */ volatile rtems_unsigned32 Clock_driver_ticks; /* ticks since initialization */ rtems_isr_entry Old_ticker; -rtems_device_driver Clock_initialize( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *pargp, - rtems_id tid, - rtems_unsigned32 *rval -) -{ - Install_clock( Clock_isr ); -} +void Clock_exit( void ); + +#define CLOCK_VECTOR (VBR0 * 0x10 + 0x9) +/* + * These are set by clock driver during its init + */ + +rtems_device_major_number rtems_clock_major = ~0; +rtems_device_minor_number rtems_clock_minor; + -void ReInstall_clock(rtems_isr_entry clock_isr) +/* + * ISR Handler + */ + +rtems_isr Clock_isr(rtems_vector_number vector) { - rtems_unsigned32 isrlevel; + Clock_driver_ticks += 1; + lcsr->timer_cnt_2 = 0; /* clear counter */ + lcsr->intr_clear |= 0x02000000; - rtems_interrupt_disable( isrlevel ); - (void) set_vector( clock_isr, VBR0 * 0x10 + 0x9, 1 ); - rtems_interrupt_enable( isrlevel ); + if ( Clock_isrs == 1 ) { + rtems_clock_tick(); + Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000; + } + else + Clock_isrs -= 1; } void Install_clock(rtems_isr_entry clock_isr ) @@ -66,7 +74,7 @@ void Install_clock(rtems_isr_entry clock_isr ) if ( BSP_Configuration.ticks_per_timeslice ) { Old_ticker = - (rtems_isr_entry) set_vector( clock_isr, VBR0 * 0x10 + 0x9, 1 ); + (rtems_isr_entry) set_vector( clock_isr, CLOCK_VECTOR, 1 ); lcsr->vector_base |= MASK_INT; /* unmask VMEchip2 interrupts */ lcsr->to_ctl = 0xE7; /* prescaler to 1 MHz (see Appendix A1) */ lcsr->timer_cmp_2 = MS_COUNT; @@ -79,10 +87,66 @@ void Install_clock(rtems_isr_entry clock_isr ) atexit( Clock_exit ); } +} +void ReInstall_clock(rtems_isr_entry clock_isr) +{ + rtems_unsigned32 isrlevel; + + rtems_interrupt_disable( isrlevel ); + (void) set_vector( clock_isr, CLOCK_VECTOR, 1 ); + rtems_interrupt_enable( isrlevel ); } void Clock_exit( void ) { /* Dummy for now. See other m68k BSP's for code examples */ } + +rtems_device_driver Clock_initialize( + rtems_device_major_number major, + rtems_device_minor_number minor, + void *pargp +) +{ + Install_clock( Clock_isr ); + + /* + * make major/minor avail to others such as shared memory driver + */ + + rtems_clock_major = major; + rtems_clock_minor = minor; + + return RTEMS_SUCCESSFUL; +} + +rtems_device_driver Clock_control( + rtems_device_major_number major, + rtems_device_minor_number minor, + void *pargp +) +{ + rtems_libio_ioctl_args_t *args = pargp; + + if (args == 0) + goto done; + + /* + * This is hokey, but until we get a defined interface + * to do this, it will just be this simple... + */ + + if (args->command == rtems_build_name('I', 'S', 'R', ' ')) + { + Clock_isr(CLOCK_VECTOR); + } + else if (args->command == rtems_build_name('N', 'E', 'W', ' ')) + { + ReInstall_clock(args->buffer); + } + +done: + return RTEMS_SUCCESSFUL; +} + diff --git a/c/src/lib/libbsp/m68k/mvme162/console/console.c b/c/src/lib/libbsp/m68k/mvme162/console/console.c index 0892f5f200..72595f3bce 100644 --- a/c/src/lib/libbsp/m68k/mvme162/console/console.c +++ b/c/src/lib/libbsp/m68k/mvme162/console/console.c @@ -21,10 +21,9 @@ #define M162_INIT -#include <rtems.h> -#include "console.h" -#include "bsp.h" -#include "ringbuf.h" +#include <bsp.h> +#include <rtems/libio.h> +#include <ringbuf.h> Ring_buffer_t Buffer[2]; @@ -54,12 +53,11 @@ rtems_isr C_Receive_ISR(rtems_vector_number vector) rtems_device_driver console_initialize( rtems_device_major_number major, rtems_device_minor_number minor, - void *arg, - rtems_id self, - rtems_unsigned32 *status + void *arg ) { int i; + rtems_status_code status; /* * Initialise receiver interrupts on both ports @@ -79,7 +77,34 @@ rtems_device_driver console_initialize( mcchip->gen_control = 2; /* MIEN */ mcchip->SCC_int_ctl = 0x13; /* SCC IEN, IPL3 */ - *status = RTEMS_SUCCESSFUL; + status = rtems_io_register_name( + "/dev/console", + major, + (rtems_device_minor_number) 0 + ); + + if (status != RTEMS_SUCCESSFUL) + rtems_fatal_error_occurred(status); + + status = rtems_io_register_name( + "/dev/tty00", + major, + (rtems_device_minor_number) 0 + ); + + if (status != RTEMS_SUCCESSFUL) + rtems_fatal_error_occurred(status); + + status = rtems_io_register_name( + "/dev/tty01", + major, + (rtems_device_minor_number) 0 + ); + + if (status != RTEMS_SUCCESSFUL) + rtems_fatal_error_occurred(status); + + return RTEMS_SUCCESSFUL; } /* @@ -100,7 +125,7 @@ rtems_boolean char_ready(int port, char *ch) * Block on char input */ -char char_wait(int port) +char inbyte(int port) { unsigned char tmp_char; @@ -113,7 +138,7 @@ char char_wait(int port) * XON/XOFF flow control. */ -void char_put(int port, char ch) +void outbyte(int port, char ch) { while (1) { if (ZREAD0(port) & TX_BUFFER_EMPTY) break; @@ -122,45 +147,108 @@ void char_put(int port, char ch) } /* - * Map port A (1) to stdin, stdout, and stderr. - * Map everything else to port B (0). + * Open entry point + */ + +rtems_device_driver console_open( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg +) +{ + return RTEMS_SUCCESSFUL; +} + +/* + * Close entry point + */ + +rtems_device_driver console_close( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg +) +{ + return RTEMS_SUCCESSFUL; +} + +/* + * read bytes from the serial port. We only have stdin. */ -int __read(int fd, char *buf, int nbytes) +rtems_device_driver console_read( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg +) { - int i, port; + rtems_libio_rw_args_t *rw_args; + char *buffer; + int maximum; + int count = 0; + + rw_args = (rtems_libio_rw_args_t *) arg; - if ( fd <= 2 ) port = 1; - else port = 0; + buffer = rw_args->buffer; + maximum = rw_args->count; - for (i = 0; i < nbytes; i++) { - *(buf + i) = char_wait(port); - if ((*(buf + i) == '\n') || (*(buf + i) == '\r')) { - (*(buf + i++)) = '\n'; - (*(buf + i)) = 0; + if ( minor > 1 ) + return RTEMS_INVALID_NUMBER; + + for (count = 0; count < maximum; count++) { + buffer[ count ] = inbyte( minor ); + if (buffer[ count ] == '\n' || buffer[ count ] == '\r') { + buffer[ count++ ] = '\n'; + buffer[ count ] = 0; break; } } - return (i); + + rw_args->bytes_moved = count; + return (count >= 0) ? RTEMS_SUCCESSFUL : RTEMS_UNSATISFIED; } /* - * Map port A (1) to stdin, stdout, and stderr. - * Map everything else to port B (0). + * write bytes to the serial port. Stdout and stderr are the same. */ -int __write(int fd, char *buf, int nbytes) +rtems_device_driver console_write( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg +) { - int i, port; - - if ( fd <= 2 ) port = 1; - else port = 0; - - for (i = 0; i < nbytes; i++) { - if (*(buf + i) == '\n') { - char_put (port, '\r'); + int count; + int maximum; + rtems_libio_rw_args_t *rw_args; + char *buffer; + + rw_args = (rtems_libio_rw_args_t *) arg; + + buffer = rw_args->buffer; + maximum = rw_args->count; + + if ( minor > 1 ) + return RTEMS_INVALID_NUMBER; + + for (count = 0; count < maximum; count++) { + if ( buffer[ count ] == '\n') { + outbyte('\r', minor ); } - char_put (port, *(buf + i)); + outbyte( buffer[ count ], minor ); } - return (nbytes); + return maximum; +} + +/* + * IO Control entry point + */ + +rtems_device_driver console_control( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg +) +{ + return RTEMS_SUCCESSFUL; } diff --git a/c/src/lib/libbsp/m68k/mvme162/include/bsp.h b/c/src/lib/libbsp/m68k/mvme162/include/bsp.h index b11ac753b8..54e74da532 100644 --- a/c/src/lib/libbsp/m68k/mvme162/include/bsp.h +++ b/c/src/lib/libbsp/m68k/mvme162/include/bsp.h @@ -28,6 +28,8 @@ extern "C" { #endif #include <rtems.h> +#include <clockdrv.h> +#include <console.h> #include <iosupp.h> /* @@ -248,6 +250,24 @@ typedef volatile struct gcsr_regs { #define EXTERN extern #endif +/* + * Device Driver Table Entries + */ + +/* + * NOTE: Use the standard Console driver entry + */ + +/* + * NOTE: Use the standard Clock driver entry + */ + +/* + * How many libio files we want + */ + +#define BSP_LIBIO_MAX_FDS 20 + /* miscellaneous stuff assumed to exist */ extern rtems_configuration_table BSP_Configuration; diff --git a/c/src/lib/libbsp/m68k/mvme162/startup/bspstart.c b/c/src/lib/libbsp/m68k/mvme162/startup/bspstart.c index efbb89cb67..973a78a9f4 100644 --- a/c/src/lib/libbsp/m68k/mvme162/startup/bspstart.c +++ b/c/src/lib/libbsp/m68k/mvme162/startup/bspstart.c @@ -27,10 +27,17 @@ * $Id$ */ -#include <rtems.h> #include <bsp.h> +#include <rtems/libio.h> + #include <libcsupport.h> -#include <z8036.h> + +#include <string.h> +#include <fcntl.h> + +#ifdef STACK_CHECKER_ON +#include <stackchk.h> +#endif /* * The original table from the application and our copy of it with @@ -42,6 +49,8 @@ rtems_configuration_table BSP_Configuration; rtems_cpu_table Cpu_table; +char *rtems_progname; + /* Initialize whatever libc we are using * called from postdriver hook */ @@ -58,6 +67,14 @@ void bsp_libc_init() RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0); /* + * Init the RTEMS libio facility to provide UNIX-like system + * calls for use by newlib (ie: provide __open, __close, etc) + * Uses malloc() to get area for the iops, so must be after malloc init + */ + + rtems_libio_init(); + + /* * Set up for the libc handling. */ @@ -75,7 +92,33 @@ void bsp_libc_init() #endif } -int bsp_start( +/* + * After drivers are setup, register some "filenames" + * and open stdin, stdout, stderr files + * + * Newlib will automatically associate the files with these + * (it hardcodes the numbers) + */ + +void +bsp_postdriver_hook(void) +{ + int stdin_fd, stdout_fd, stderr_fd; + + if ((stdin_fd = __open("/dev/console", O_RDONLY, 0)) == -1) + rtems_fatal_error_occurred('STD0'); + + if ((stdout_fd = __open("/dev/console", O_WRONLY, 0)) == -1) + rtems_fatal_error_occurred('STD1'); + + if ((stderr_fd = __open("/dev/console", O_WRONLY, 0)) == -1) + rtems_fatal_error_occurred('STD2'); + + if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2)) + rtems_fatal_error_occurred('STIO'); +} + +int main( int argc, char **argv, char **environp @@ -84,6 +127,11 @@ int bsp_start( m68k_isr_entry *monitors_vector_table; int index; + if ((argc > 0) && argv && argv[0]) + rtems_progname = argv[0]; + else + rtems_progname = "RTEMS"; + /* * 162Bug Vectors are at 0xFFE00000 */ @@ -121,7 +169,7 @@ int bsp_start( Cpu_table.predriver_hook = bsp_libc_init; /* RTEMS resources available */ - Cpu_table.postdriver_hook = NULL; /* Call our main() for constructors */ + Cpu_table.postdriver_hook = bsp_postdriver_hook; Cpu_table.idle_task = NULL; /* do not override system IDLE task */ @@ -161,6 +209,12 @@ int bsp_start( BSP_Configuration.maximum_extensions++; #endif + /* + * Tell libio how many fd's we want and allow it to tweak config + */ + + rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS); + BSP_Configuration.work_space_start = (void *) (RAM_END - BSP_Configuration.work_space_size); diff --git a/c/src/lib/libbsp/no_cpu/no_bsp/clock/ckinit.c b/c/src/lib/libbsp/no_cpu/no_bsp/clock/ckinit.c index e4e695ad82..efe0225520 100644 --- a/c/src/lib/libbsp/no_cpu/no_bsp/clock/ckinit.c +++ b/c/src/lib/libbsp/no_cpu/no_bsp/clock/ckinit.c @@ -60,28 +60,25 @@ rtems_device_minor_number rtems_clock_minor; rtems_isr_entry Old_ticker; +void Clock_exit( void ); + + /* - * Reinstall_clock - * - * Install a clock tick handler without reprogramming the chip. This - * is used by the polling shared memory device driver. + * Isr Handler */ -void ReInstall_clock( - rtems_isr_entry clock_isr +rtems_isr Clock_isr( + rtems_vector_number vector ) { - rtems_unsigned32 isrlevel = 0; - - /* - * Disable interrupts and install the clock ISR vector using the - * BSP dependent set_vector routine. In the below example, the clock - * ISR is on vector 4 and is an RTEMS interrupt. - */ - - rtems_interrupt_disable( isrlevel ); - (void) set_vector( clock_isr, CLOCK_VECTOR, 1 ); - rtems_interrupt_enable( isrlevel ); +/* + * bump the number of clock driver ticks since initialization + * + * determine if it is time to announce the passing of tick as configured + * to RTEMS through the rtems_clock_tick directive + * + * perform any timer dependent tasks + */ } /* @@ -124,6 +121,30 @@ void Install_clock( } /* + * Reinstall_clock + * + * Install a clock tick handler without reprogramming the chip. This + * is used by the polling shared memory device driver. + */ + +void ReInstall_clock( + rtems_isr_entry clock_isr +) +{ + rtems_unsigned32 isrlevel = 0; + + /* + * Disable interrupts and install the clock ISR vector using the + * BSP dependent set_vector routine. In the below example, the clock + * ISR is on vector 4 and is an RTEMS interrupt. + */ + + rtems_interrupt_disable( isrlevel ); + (void) set_vector( clock_isr, CLOCK_VECTOR, 1 ); + rtems_interrupt_enable( isrlevel ); +} + +/* * Clean up before the application exits */ @@ -149,14 +170,15 @@ rtems_device_driver Clock_initialize( void *pargp ) { - Install_clock((rtems_isr_entry) Clock_isr); - + Install_clock( Clock_isr ); + /* * make major/minor avail to others such as shared memory driver */ + rtems_clock_major = major; - rtems_clock_minor = minor; - + rtems_clock_minor = minor; + return RTEMS_SUCCESSFUL; } diff --git a/c/src/lib/libbsp/no_cpu/no_bsp/console/console.c b/c/src/lib/libbsp/no_cpu/no_bsp/console/console.c index c115e256a3..4b1ca4a0e3 100644 --- a/c/src/lib/libbsp/no_cpu/no_bsp/console/console.c +++ b/c/src/lib/libbsp/no_cpu/no_bsp/console/console.c @@ -14,9 +14,8 @@ #define NO_BSP_INIT -#include <rtems.h> -#include "console.h" -#include "bsp.h" +#include <bsp.h> +#include <rtems/libio.h> /* console_initialize * @@ -32,12 +31,21 @@ rtems_device_driver console_initialize( rtems_device_major_number major, rtems_device_minor_number minor, - void *arg, - rtems_id self, - rtems_unsigned32 *status + void *arg ) { - *status = RTEMS_SUCCESSFUL; + rtems_status_code status; + + status = rtems_io_register_name( + "/dev/console", + major, + (rtems_device_minor_number) 0 + ); + + if (status != RTEMS_SUCCESSFUL) + rtems_fatal_error_occurred(status); + + return RTEMS_SUCCESSFUL; } @@ -110,49 +118,104 @@ void outbyte( outbyte( '\r' ); } + +/* + * Open entry point + */ + +rtems_device_driver console_open( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg +) +{ + return RTEMS_SUCCESSFUL; +} + /* - * __read -- read bytes from the serial port. Ignore fd, since - * we only have stdin. + * Close entry point */ -int __read( - int fd, - char *buf, - int nbytes +rtems_device_driver console_close( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg ) { - int i = 0; + return RTEMS_SUCCESSFUL; +} + +/* + * read bytes from the serial port. We only have stdin. + */ - for (i = 0; i < nbytes; i++) { - *(buf + i) = inbyte(); - if ((*(buf + i) == '\n') || (*(buf + i) == '\r')) { - (*(buf + i++)) = '\n'; - (*(buf + i)) = 0; +rtems_device_driver console_read( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg +) +{ + rtems_libio_rw_args_t *rw_args; + char *buffer; + int maximum; + int count = 0; + + rw_args = (rtems_libio_rw_args_t *) arg; + + buffer = rw_args->buffer; + maximum = rw_args->count; + + for (count = 0; count < maximum; count++) { + buffer[ count ] = inbyte(); + if (buffer[ count ] == '\n' || buffer[ count ] == '\r') { + buffer[ count++ ] = '\n'; + buffer[ count ] = 0; break; } } - return (i); + + rw_args->bytes_moved = count; + return (count >= 0) ? RTEMS_SUCCESSFUL : RTEMS_UNSATISFIED; } /* - * __write -- write bytes to the serial port. Ignore fd, since - * stdout and stderr are the same. Since we have no filesystem, - * open will only return an error. + * write bytes to the serial port. Stdout and stderr are the same. */ -int __write( - int fd, - char *buf, - int nbytes +rtems_device_driver console_write( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg ) { - int i; + int count; + int maximum; + rtems_libio_rw_args_t *rw_args; + char *buffer; + + rw_args = (rtems_libio_rw_args_t *) arg; - for (i = 0; i < nbytes; i++) { - if (*(buf + i) == '\n') { - outbyte ('\r'); + buffer = rw_args->buffer; + maximum = rw_args->count; + + for (count = 0; count < maximum; count++) { + if ( buffer[ count ] == '\n') { + outbyte('\r'); } - outbyte (*(buf + i)); + outbyte( buffer[ count ] ); } - return (nbytes); + return maximum; +} + +/* + * IO Control entry point + */ + +rtems_device_driver console_control( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg +) +{ + return RTEMS_SUCCESSFUL; } diff --git a/c/src/lib/libbsp/no_cpu/no_bsp/include/bsp.h b/c/src/lib/libbsp/no_cpu/no_bsp/include/bsp.h index 5bb7c62577..fa09cbb5bf 100644 --- a/c/src/lib/libbsp/no_cpu/no_bsp/include/bsp.h +++ b/c/src/lib/libbsp/no_cpu/no_bsp/include/bsp.h @@ -23,6 +23,7 @@ extern "C" { #endif #include <rtems.h> +#include <console.h> #include <clockdrv.h> /* @@ -69,19 +70,23 @@ extern "C" { extern rtems_configuration_table BSP_Configuration; /* - * Console driver init + * Device Driver Table Entries + */ + +/* + * NOTE: Use the standard Console driver entry */ - -rtems_device_driver console_initialize( - rtems_device_major_number, rtems_device_minor_number minor, void *); - -#define CONSOLE_DRIVER_TABLE_ENTRY \ - { console_initialize, NULL, NULL, NULL, NULL, NULL } /* * NOTE: Use the standard Clock driver entry */ +/* + * How many libio files we want + */ + +#define BSP_LIBIO_MAX_FDS 20 + /* functions */ void bsp_cleanup( void ); diff --git a/c/src/lib/libbsp/no_cpu/no_bsp/startup/bspstart.c b/c/src/lib/libbsp/no_cpu/no_bsp/startup/bspstart.c index 4d3d3a7175..75739aa39b 100644 --- a/c/src/lib/libbsp/no_cpu/no_bsp/startup/bspstart.c +++ b/c/src/lib/libbsp/no_cpu/no_bsp/startup/bspstart.c @@ -20,10 +20,17 @@ * $Id$ */ -#include <rtems.h> #include <bsp.h> -#include <shm.h> +#include <rtems/libio.h> + #include <libcsupport.h> + +#include <string.h> +#include <fcntl.h> + +#ifdef STACK_CHECKER_ON +#include <stackchk.h> +#endif /* * The original table from the application and our copy of it with @@ -36,6 +43,8 @@ rtems_configuration_table BSP_Configuration; rtems_cpu_table Cpu_table; +char *rtems_progname; + /* Initialize whatever libc we are using * called from postdriver hook */ @@ -59,6 +68,14 @@ void bsp_libc_init() RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0); /* + * Init the RTEMS libio facility to provide UNIX-like system + * calls for use by newlib (ie: provide __open, __close, etc) + * Uses malloc() to get area for the iops, so must be after malloc init + */ + + rtems_libio_init(); + + /* * Set up for the libc handling. */ @@ -76,12 +93,43 @@ void bsp_libc_init() #endif } -int bsp_start( +/* + * After drivers are setup, register some "filenames" + * and open stdin, stdout, stderr files + * + * Newlib will automatically associate the files with these + * (it hardcodes the numbers) + */ + +void +bsp_postdriver_hook(void) +{ + int stdin_fd, stdout_fd, stderr_fd; + + if ((stdin_fd = __open("/dev/console", O_RDONLY, 0)) == -1) + rtems_fatal_error_occurred('STD0'); + + if ((stdout_fd = __open("/dev/console", O_WRONLY, 0)) == -1) + rtems_fatal_error_occurred('STD1'); + + if ((stderr_fd = __open("/dev/console", O_WRONLY, 0)) == -1) + rtems_fatal_error_occurred('STD2'); + + if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2)) + rtems_fatal_error_occurred('STIO'); +} + +int main( int argc, char **argv, char **environp ) { + if ((argc > 0) && argv && argv[0]) + rtems_progname = argv[0]; + else + rtems_progname = "RTEMS"; + /* * Allocate the memory for the RTEMS Work Space. This can come from * a variety of places: hard coded address, malloc'ed from outside @@ -118,6 +166,20 @@ int bsp_start( BSP_Configuration.maximum_extensions++; #endif +#ifdef STACK_CHECKER_ON + /* + * Add 1 extension for stack checker + */ + + BSP_Configuration.maximum_extensions++; +#endif + + /* + * Tell libio how many fd's we want and allow it to tweak config + */ + + rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS); + /* * Need to "allocate" the memory for the RTEMS Workspace and * tell the RTEMS configuration where it is. This memory is @@ -138,7 +200,7 @@ int bsp_start( Cpu_table.predriver_hook = bsp_libc_init; /* RTEMS resources available */ - Cpu_table.postdriver_hook = NULL; + Cpu_table.postdriver_hook = bsp_postdriver_hook; Cpu_table.idle_task = NULL; /* do not override system IDLE task */ diff --git a/c/src/lib/libbsp/powerpc/papyrus/include/bsp.h b/c/src/lib/libbsp/powerpc/papyrus/include/bsp.h index a18ca343bd..58abce6d9f 100644 --- a/c/src/lib/libbsp/powerpc/papyrus/include/bsp.h +++ b/c/src/lib/libbsp/powerpc/papyrus/include/bsp.h @@ -43,6 +43,7 @@ extern "C" { #else #include <rtems.h> +#include <console.h> /* * Define the time limits for RTEMS Test Suite test durations. @@ -94,6 +95,24 @@ extern "C" { extern rtems_configuration_table BSP_Configuration; /* owned by BSP */ extern rtems_cpu_table Cpu_table; /* owned by BSP */ +/* + * Device Driver Table Entries + */ + +/* + * NOTE: Use the standard Console driver entry + */ + +/* + * NOTE: Use the standard Clock driver entry + */ + +/* + * How many libio files we want + */ + +#define BSP_LIBIO_MAX_FDS 20 + /* functions */ void bsp_start( void ); diff --git a/c/src/lib/libbsp/powerpc/papyrus/startup/bspstart.c b/c/src/lib/libbsp/powerpc/papyrus/startup/bspstart.c index a018c4cbfb..66ead73dae 100644 --- a/c/src/lib/libbsp/powerpc/papyrus/startup/bspstart.c +++ b/c/src/lib/libbsp/powerpc/papyrus/startup/bspstart.c @@ -37,10 +37,17 @@ * bspstart.c,v 1.2 1995/05/31 16:56:29 joel Exp */ -#include <rtems.h> #include <bsp.h> -#include <shm.h> +#include <rtems/libio.h> + #include <libcsupport.h> + +#include <string.h> +#include <fcntl.h> + +#ifdef STACK_CHECKER_ON +#include <stackchk.h> +#endif /* * The original table from the application and our copy of it with @@ -53,6 +60,8 @@ rtems_configuration_table BSP_Configuration; rtems_cpu_table Cpu_table; +char *rtems_progname; + /* Initialize whatever libc we are using * called from postdriver hook */ @@ -76,6 +85,14 @@ void bsp_libc_init() RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0); /* + * Init the RTEMS libio facility to provide UNIX-like system + * calls for use by newlib (ie: provide __open, __close, etc) + * Uses malloc() to get area for the iops, so must be after malloc init + */ + + rtems_libio_init(); + + /* * Set up for the libc handling. */ @@ -93,8 +110,43 @@ void bsp_libc_init() #endif } -void bsp_start(void) +/* + * After drivers are setup, register some "filenames" + * and open stdin, stdout, stderr files + * + * Newlib will automatically associate the files with these + * (it hardcodes the numbers) + */ + +void +bsp_postdriver_hook(void) +{ + int stdin_fd, stdout_fd, stderr_fd; + + if ((stdin_fd = __open("/dev/console", O_RDONLY, 0)) == -1) + rtems_fatal_error_occurred('STD0'); + + if ((stdout_fd = __open("/dev/console", O_WRONLY, 0)) == -1) + rtems_fatal_error_occurred('STD1'); + + if ((stderr_fd = __open("/dev/console", O_WRONLY, 0)) == -1) + rtems_fatal_error_occurred('STD2'); + + if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2)) + rtems_fatal_error_occurred('STIO'); +} + +int main( + int argc, + char **argv, + char **environp +) { + if ((argc > 0) && argv && argv[0]) + rtems_progname = argv[0]; + else + rtems_progname = "RTEMS"; + /* * Allocate the memory for the RTEMS Work Space. This can come from * a variety of places: hard coded address, malloc'ed from outside @@ -132,6 +184,12 @@ void bsp_start(void) #endif /* + * Tell libio how many fd's we want and allow it to tweak config + */ + + rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS); + + /* * Need to "allocate" the memory for the RTEMS Workspace and * tell the RTEMS configuration where it is. This memory is * not malloc'ed. It is just "pulled from the air". @@ -154,7 +212,7 @@ void bsp_start(void) Cpu_table.predriver_hook = bsp_libc_init; /* RTEMS resources available */ - Cpu_table.postdriver_hook = NULL; + Cpu_table.postdriver_hook = bsp_postdriver_hook; Cpu_table.idle_task = NULL; /* do not override system IDLE task */ diff --git a/c/src/lib/libbsp/shmdr/init.c b/c/src/lib/libbsp/shmdr/init.c index 435bc9dbec..14eddca0aa 100644 --- a/c/src/lib/libbsp/shmdr/init.c +++ b/c/src/lib/libbsp/shmdr/init.c @@ -3,8 +3,7 @@ * This routine is the shared memory communications initerface * driver initialization routine. * - * Input parameters: - * configuration - address of configuration table + * Input parameters: NONE * * Output parameters: NONE * @@ -33,12 +32,8 @@ rtems_extensions_table MPCI_Shm_extensions; -rtems_mpci_entry Shm_Initialization( - rtems_configuration_table *configuration, - rtems_cpu_table *cpu_configuration, - rtems_multiprocessing_table *mp_configuration +rtems_mpci_entry Shm_Initialization( void ) -) { rtems_unsigned32 i, all_initialized; rtems_unsigned32 interrupt_cause, interrupt_value; @@ -46,6 +41,9 @@ rtems_mpci_entry Shm_Initialization( Shm_Node_status_control *nscb; rtems_unsigned32 extension_id; /* for installation of MPCI_Fatal */ rtems_unsigned32 remaining_memory; +/* XXX these should use "public" methods to set their values.... */ + rtems_configuration_table *configuration = _Configuration_Table; + rtems_multiprocessing_table *mp_configuration = _Configuration_MP_table; Shm_RTEMS_Configuration = configuration; Shm_RTEMS_MP_Configuration = mp_configuration; diff --git a/c/src/lib/libbsp/shmdr/mpci.h b/c/src/lib/libbsp/shmdr/mpci.h index 11638f8cc7..c5646a61d7 100644 --- a/c/src/lib/libbsp/shmdr/mpci.h +++ b/c/src/lib/libbsp/shmdr/mpci.h @@ -15,8 +15,8 @@ * $Id$ */ -#ifndef __MPCI_h -#define __MPCI_h +#ifndef __SHM_MPCI_h +#define __SHM_MPCI_h #ifdef __cplusplus extern "C" { diff --git a/c/src/lib/libbsp/shmdr/shm.h b/c/src/lib/libbsp/shmdr/shm.h index 2122873912..5ccb0aab6b 100644 --- a/c/src/lib/libbsp/shmdr/shm.h +++ b/c/src/lib/libbsp/shmdr/shm.h @@ -493,11 +493,7 @@ rtems_mpci_entry Shm_Get_packet( rtems_packet_prefix ** ); -rtems_mpci_entry Shm_Initialization( - rtems_configuration_table *configuration, - rtems_cpu_table *cpu_configuration, - rtems_multiprocessing_table *mp_configuration -); +rtems_mpci_entry Shm_Initialization( void ); rtems_mpci_entry Shm_Receive_packet( rtems_packet_prefix ** diff --git a/c/src/lib/libbsp/shmdr/shm_driver.h b/c/src/lib/libbsp/shmdr/shm_driver.h index 2122873912..5ccb0aab6b 100644 --- a/c/src/lib/libbsp/shmdr/shm_driver.h +++ b/c/src/lib/libbsp/shmdr/shm_driver.h @@ -493,11 +493,7 @@ rtems_mpci_entry Shm_Get_packet( rtems_packet_prefix ** ); -rtems_mpci_entry Shm_Initialization( - rtems_configuration_table *configuration, - rtems_cpu_table *cpu_configuration, - rtems_multiprocessing_table *mp_configuration -); +rtems_mpci_entry Shm_Initialization( void ); rtems_mpci_entry Shm_Receive_packet( rtems_packet_prefix ** diff --git a/c/src/lib/libbsp/unix/posix/console/console.c b/c/src/lib/libbsp/unix/posix/console/console.c index 07cb033958..61bbe08c78 100644 --- a/c/src/lib/libbsp/unix/posix/console/console.c +++ b/c/src/lib/libbsp/unix/posix/console/console.c @@ -3,6 +3,8 @@ * * These provide UNIX-like read and write calls for the C library. * + * NOTE: For the most part, this is just a space holder. + * * COPYRIGHT (c) 1994 by Division Incorporated * * To anyone who acknowledges that this file is provided "AS IS" @@ -31,6 +33,71 @@ console_initialize(rtems_device_major_number major, void * arg ) { - return RTEMS_SUCCESSFUL; + return 0; +} + + +/* + * Open entry point + */ + +rtems_device_driver console_open( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg +) +{ + return RTEMS_SUCCESSFUL; } + +/* + * Close entry point + */ + +rtems_device_driver console_close( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg +) +{ + return RTEMS_SUCCESSFUL; +} + +/* + * read bytes from the serial port. We only have stdin. + */ +rtems_device_driver console_read( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg +) +{ + return RTEMS_UNSATISFIED; +} + +/* + * write bytes to the serial port. Stdout and stderr are the same. + */ + +rtems_device_driver console_write( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg +) +{ + return -1; +} + +/* + * IO Control entry point + */ + +rtems_device_driver console_control( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg +) +{ + return RTEMS_SUCCESSFUL; +} diff --git a/c/src/lib/libbsp/unix/posix/include/bsp.h b/c/src/lib/libbsp/unix/posix/include/bsp.h index 3bf43ca0c8..6ebec41276 100644 --- a/c/src/lib/libbsp/unix/posix/include/bsp.h +++ b/c/src/lib/libbsp/unix/posix/include/bsp.h @@ -22,6 +22,7 @@ extern "C" { #include <rtems.h> #include <clockdrv.h> +#include <console.h> #include <iosupp.h> #include <libcsupport.h> #include <signal.h> @@ -80,19 +81,23 @@ extern rtems_configuration_table BSP_Configuration; /* #define INTERRUPT_EXTERNAL_MPCI SIGUSR1 */ /* - * Console driver init + * Device Driver Table Entries + */ + +/* + * NOTE: Use the standard Console driver entry */ - -rtems_device_driver console_initialize( - rtems_device_major_number, rtems_device_minor_number minor, void *); - -#define CONSOLE_DRIVER_TABLE_ENTRY \ - { console_initialize, NULL, NULL, NULL, NULL, NULL } /* * NOTE: Use the standard Clock driver entry */ +/* + * How many libio files we want + */ + +#define BSP_LIBIO_MAX_FDS 20 + /* functions */ rtems_isr_entry set_vector(rtems_isr_entry, rtems_vector_number, int); diff --git a/c/src/lib/libbsp/unix/posix/startup/bspstart.c b/c/src/lib/libbsp/unix/posix/startup/bspstart.c index d4279c5818..ed687f7319 100644 --- a/c/src/lib/libbsp/unix/posix/startup/bspstart.c +++ b/c/src/lib/libbsp/unix/posix/startup/bspstart.c @@ -37,6 +37,8 @@ #include <bsp.h> #include <libcsupport.h> +#include <rtems/libio.h> + #ifdef STACK_CHECKER_ON #include <stackchk.h> #endif @@ -112,6 +114,14 @@ bsp_libc_init(void) RTEMS_Malloc_Initialize((void *)heap_start, Heap_size, 1024 * 1024); + /* + * Init the RTEMS libio facility to provide UNIX-like system + * calls for use by newlib (ie: provide __open, __close, etc) + * Uses malloc() to get area for the iops, so must be after malloc init + */ + + rtems_libio_init(); + libc_init(1); } @@ -162,6 +172,34 @@ bsp_pretasking_hook(void) } /* + * After drivers are setup, register some "filenames" + * and open stdin, stdout, stderr files + * + * Newlib will automatically associate the files with these + * (it hardcodes the numbers) + */ + +void +bsp_postdriver_hook(void) +{ +#if 0 + int stdin_fd, stdout_fd, stderr_fd; + + if ((stdin_fd = __open("/dev/console", O_RDONLY, 0)) == -1) + rtems_fatal_error_occurred('STD0'); + + if ((stdout_fd = __open("/dev/console", O_WRONLY, 0)) == -1) + rtems_fatal_error_occurred('STD1'); + + if ((stderr_fd = __open("/dev/console", O_WRONLY, 0)) == -1) + rtems_fatal_error_occurred('STD2'); + + if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2)) + rtems_fatal_error_occurred('STIO'); +#endif +} + +/* * Function: bsp_start * Created: 94/12/6 * @@ -261,7 +299,7 @@ bsp_start(void) Cpu_table.predriver_hook = NULL; - Cpu_table.postdriver_hook = NULL; + Cpu_table.postdriver_hook = bsp_postdriver_hook; Cpu_table.idle_task = NULL; /* do not override system IDLE task */ @@ -301,22 +339,28 @@ bsp_start(void) BSP_Configuration.maximum_extensions++; #endif - /* - * Add 1 extension for MPCI_fatal - */ + /* + * Tell libio how many fd's we want and allow it to tweak config + */ - if (BSP_Configuration.User_multiprocessing_table) - BSP_Configuration.maximum_extensions++; + rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS); - CPU_CLICKS_PER_TICK = 1; + /* + * Add 1 extension for MPCI_fatal + */ - /* - * Start most of RTEMS - * main() will start the rest - */ + if (BSP_Configuration.User_multiprocessing_table) + BSP_Configuration.maximum_extensions++; + + CPU_CLICKS_PER_TICK = 1; + + /* + * Start most of RTEMS + * main() will start the rest + */ - bsp_isr_level = rtems_initialize_executive_early( - &BSP_Configuration, - &Cpu_table - ); + bsp_isr_level = rtems_initialize_executive_early( + &BSP_Configuration, + &Cpu_table + ); } diff --git a/c/src/lib/libc/error.c b/c/src/lib/libc/error.c index 8cf46f0565..cfe1858e08 100644 --- a/c/src/lib/libc/error.c +++ b/c/src/lib/libc/error.c @@ -91,8 +91,8 @@ rtems_assoc_t rtems_status_assoc[] = { { "not owner of resource", RTEMS_NOT_OWNER_OF_RESOURCE , }, { "directive not implemented", RTEMS_NOT_IMPLEMENTED, }, { "RTEMS inconsistency detected", RTEMS_INTERNAL_ERROR, }, - { "internal multiprocessing only", RTEMS_PROXY_BLOCKING, }, { "could not get enough memory", RTEMS_NO_MEMORY, }, + { "internal multiprocessing only", THREAD_STATUS_PROXY_BLOCKING, }, { 0, 0, 0 }, }; @@ -134,7 +134,7 @@ static int rtems_verror( if (error_flag & RTEMS_ERROR_ERRNO) /* include errno? */ local_errno = errno; - if (_Configuration_Is_multiprocessing()) + if (_System_state_Is_multiprocessing) fprintf(stderr, "[%d] ", _Configuration_MP_table->node); if (rtems_progname && *rtems_progname) diff --git a/c/src/lib/libc/libio.c b/c/src/lib/libc/libio.c index f2046501ce..38e0f83bac 100644 --- a/c/src/lib/libc/libio.c +++ b/c/src/lib/libc/libio.c @@ -14,8 +14,11 @@ #include <rtems/assoc.h> /* assoc.h not included by rtems.h */ #include <fcntl.h> /* O_RDONLY, et.al. */ +#include <sys/fcntl.h> /* O_RDONLY, et.al. */ #if defined(solaris2) #define O_NDELAY O_NONBLOCK +#elif defined(RTEMS_NEWLIB) +#define O_NDELAY _FNBIO #endif #include <errno.h> #include <string.h> /* strcmp */ diff --git a/c/src/lib/libc/newlibc.c b/c/src/lib/libc/newlibc.c index 4493b473da..e041668375 100644 --- a/c/src/lib/libc/newlibc.c +++ b/c/src/lib/libc/newlibc.c @@ -80,11 +80,12 @@ libc_wrapup(void) } -rtems_extension +rtems_boolean libc_create_hook(rtems_tcb *current_task, rtems_tcb *creating_task) { MY_task_set_note(creating_task, LIBC_NOTEPAD, 0); + return TRUE; } /* @@ -231,10 +232,10 @@ libc_init(int reentrant) { memset(&libc_extension, 0, sizeof(libc_extension)); - libc_extension.rtems_task_create = libc_create_hook; - libc_extension.rtems_task_start = libc_start_hook; - libc_extension.task_switch = libc_switch_hook; - libc_extension.rtems_task_delete = libc_delete_hook; + libc_extension.thread_create = libc_create_hook; + libc_extension.thread_start = libc_start_hook; + libc_extension.thread_switch = libc_switch_hook; + libc_extension.thread_delete = libc_delete_hook; rc = rtems_extension_create(rtems_build_name('L', 'I', 'B', 'C'), &libc_extension, &extension_id); diff --git a/c/src/lib/libc/support.c b/c/src/lib/libc/support.c index c4e207df0a..13a2d0c2a5 100644 --- a/c/src/lib/libc/support.c +++ b/c/src/lib/libc/support.c @@ -13,8 +13,7 @@ * */ -#include <rtems/system.h> -#include <rtems/thread.h> +#include <rtems.h> void MY_task_set_note( Thread_Control *the_thread, @@ -22,7 +21,11 @@ void MY_task_set_note( unsigned32 note ) { - the_thread->RTEMS_API->Notepads[ notepad ] = note; + RTEMS_API_Control *api; + + api = the_thread->API_Extensions[ THREAD_API_RTEMS ]; + + api->Notepads[ notepad ] = note; } @@ -31,7 +34,11 @@ unsigned32 MY_task_get_note( unsigned32 notepad ) { - return the_thread->RTEMS_API->Notepads[ notepad ]; + RTEMS_API_Control *api; + + api = the_thread->API_Extensions[ THREAD_API_RTEMS ]; + + return api->Notepads[ notepad ]; } void *MY_CPU_Context_FP_start( diff --git a/c/src/lib/libcpu/powerpc/ppc403/clock/clock.c b/c/src/lib/libcpu/powerpc/ppc403/clock/clock.c index fc17de4cc8..b577f80f1a 100644 --- a/c/src/lib/libcpu/powerpc/ppc403/clock/clock.c +++ b/c/src/lib/libcpu/powerpc/ppc403/clock/clock.c @@ -33,6 +33,7 @@ #include <bsp.h> #include <clockdrv.h> +#include <rtems/libio.h> #include <stdlib.h> /* for atexit() */ @@ -42,39 +43,85 @@ volatile rtems_unsigned32 Clock_driver_ticks; static rtems_unsigned32 pit_value, tick_time; static rtems_boolean auto_restart; -rtems_device_driver Clock_initialize( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *pargp, - rtems_id tid, - rtems_unsigned32 *rval -) +void Clock_exit( void ); + +/* + * These are set by clock driver during its init + */ + +rtems_device_major_number rtems_clock_major = ~0; +rtems_device_minor_number rtems_clock_minor; + +static INLINE rtems_unsigned32 get_itimer(void) { - Install_clock(Clock_isr); -} + register rtems_unsigned32 rc; + asm volatile ("mftblo %0" : "=r" ((rc))); -void -ReInstall_clock(rtems_isr_entry new_clock_isr) + return rc; +} + +/* + * ISR Handler + */ + +rtems_isr +Clock_isr(rtems_vector_number vector) { - rtems_isr_entry previous_isr; - rtems_unsigned32 isrlevel = 0; + if (!auto_restart) + { + rtems_unsigned32 clicks_til_next_interrupt; + rtems_unsigned32 itimer_value; - rtems_interrupt_disable(isrlevel); - - rtems_interrupt_catch(new_clock_isr, PPC_IRQ_PIT, - &previous_isr); + /* + * setup for next interrupt; making sure the new value is reasonably + * in the future.... in case we lost out on an interrupt somehow + */ - rtems_interrupt_enable(isrlevel); -} + itimer_value = get_itimer(); + tick_time += pit_value; -static INLINE rtems_unsigned32 get_itimer(void) -{ - register rtems_unsigned32 rc; + /* + * how far away is next interrupt *really* + * It may be a long time; this subtraction works even if + * Clock_clicks_interrupt < Clock_clicks_low_order via + * the miracle of unsigned math. + */ + clicks_til_next_interrupt = tick_time - itimer_value; - asm volatile ("mftblo %0" : "=r" ((rc))); + /* + * If it is too soon then bump it up. + * This should only happen if CPU_HPPA_CLICKS_PER_TICK is too small. + * But setting it low is useful for debug, so... + */ - return rc; + if (clicks_til_next_interrupt < 400) + { + tick_time = itimer_value + 1000; + clicks_til_next_interrupt = 1000; + /* XXX: count these! this should be rare */ + } + + /* + * If it is too late, that means we missed the interrupt somehow. + * Rather than wait 35-50s for a wrap, we just fudge it here. + */ + + if (clicks_til_next_interrupt > pit_value) + { + tick_time = itimer_value + 1000; + clicks_til_next_interrupt = 1000; + /* XXX: count these! this should never happen :-) */ + } + + asm volatile ("mtpit %0" :: "r" (clicks_til_next_interrupt)); + } + + asm volatile ( "mttsr %0" :: "r" (0x08000000)); + + Clock_driver_ticks++; + + rtems_clock_tick(); } void Install_clock(rtems_isr_entry clock_isr) @@ -131,66 +178,21 @@ void Install_clock(rtems_isr_entry clock_isr) atexit(Clock_exit); } - -rtems_isr -Clock_isr(rtems_vector_number vector) +void +ReInstall_clock(rtems_isr_entry new_clock_isr) { - if (!auto_restart) - { - rtems_unsigned32 clicks_til_next_interrupt; - rtems_unsigned32 itimer_value; - - /* - * setup for next interrupt; making sure the new value is reasonably - * in the future.... in case we lost out on an interrupt somehow - */ - - itimer_value = get_itimer(); - tick_time += pit_value; - - /* - * how far away is next interrupt *really* - * It may be a long time; this subtraction works even if - * Clock_clicks_interrupt < Clock_clicks_low_order via - * the miracle of unsigned math. - */ - clicks_til_next_interrupt = tick_time - itimer_value; - - /* - * If it is too soon then bump it up. - * This should only happen if CPU_HPPA_CLICKS_PER_TICK is too small. - * But setting it low is useful for debug, so... - */ - - if (clicks_til_next_interrupt < 400) - { - tick_time = itimer_value + 1000; - clicks_til_next_interrupt = 1000; - /* XXX: count these! this should be rare */ - } - - /* - * If it is too late, that means we missed the interrupt somehow. - * Rather than wait 35-50s for a wrap, we just fudge it here. - */ - - if (clicks_til_next_interrupt > pit_value) - { - tick_time = itimer_value + 1000; - clicks_til_next_interrupt = 1000; - /* XXX: count these! this should never happen :-) */ - } - - asm volatile ("mtpit %0" :: "r" (clicks_til_next_interrupt)); - } - - asm volatile ( "mttsr %0" :: "r" (0x08000000)); + rtems_isr_entry previous_isr; + rtems_unsigned32 isrlevel = 0; - Clock_driver_ticks++; + rtems_interrupt_disable(isrlevel); + + rtems_interrupt_catch(new_clock_isr, PPC_IRQ_PIT, + &previous_isr); - rtems_clock_tick(); + rtems_interrupt_enable(isrlevel); } + /* * Called via atexit() * Remove the clock interrupt handler by setting handler to NULL @@ -213,3 +215,50 @@ Clock_exit(void) } } +rtems_device_driver Clock_initialize( + rtems_device_major_number major, + rtems_device_minor_number minor, + void *pargp +) +{ + Install_clock( Clock_isr ); + + /* + * make major/minor avail to others such as shared memory driver + */ + + rtems_clock_major = major; + rtems_clock_minor = minor; + + return RTEMS_SUCCESSFUL; +} + +rtems_device_driver Clock_control( + rtems_device_major_number major, + rtems_device_minor_number minor, + void *pargp +) +{ + rtems_libio_ioctl_args_t *args = pargp; + + if (args == 0) + goto done; + + /* + * This is hokey, but until we get a defined interface + * to do this, it will just be this simple... + */ + + if (args->command == rtems_build_name('I', 'S', 'R', ' ')) + { + Clock_isr(PPC_IRQ_PIT); + } + else if (args->command == rtems_build_name('N', 'E', 'W', ' ')) + { + ReInstall_clock(args->buffer); + } + +done: + return RTEMS_SUCCESSFUL; +} + diff --git a/c/src/lib/libcpu/powerpc/ppc403/console/console.c b/c/src/lib/libcpu/powerpc/ppc403/console/console.c index 6a451bb7ec..d7a7bb9bc1 100644 --- a/c/src/lib/libcpu/powerpc/ppc403/console/console.c +++ b/c/src/lib/libcpu/powerpc/ppc403/console/console.c @@ -31,9 +31,8 @@ #define NO_BSP_INIT -#include <rtems.h> -#include "console.h" -#include "bsp.h" +#include <bsp.h> +#include <rtems/libio.h> extern rtems_cpu_table Cpu_table; /* owned by BSP */ @@ -139,11 +138,10 @@ static const pasync port = (pasync)0x40000000; rtems_device_driver console_initialize( rtems_device_major_number major, rtems_device_minor_number minor, - void *arg, - rtems_id self, - rtems_unsigned32 *status + void *arg ) { + rtems_status_code status; register unsigned tmp; /* Initialise the serial port */ @@ -164,7 +162,16 @@ rtems_device_driver console_initialize( port->SPTC = (TCREnable | TCRIntDisable); port->SPHS = (HSRDsr | HSRCts); - *status = RTEMS_SUCCESSFUL; + status = rtems_io_register_name( + "/dev/console", + major, + (rtems_device_minor_number) 0 + ); + + if (status != RTEMS_SUCCESSFUL) + rtems_fatal_error_occurred(status); + + return RTEMS_SUCCESSFUL; } @@ -280,48 +287,103 @@ void outbyte( } /* - * __read -- read bytes from the serial port. Ignore fd, since - * we only have stdin. + * Open entry point */ - -int __read( - int fd, - char *buf, - int nbytes + +rtems_device_driver console_open( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg ) { - int i = 0; - - for (i = 0; i < nbytes; i++) { - *(buf + i) = inbyte(); - if ((*(buf + i) == '\n') || (*(buf + i) == '\r')) { - (*(buf + i++)) = '\n'; - (*(buf + i)) = 0; + return RTEMS_SUCCESSFUL; +} + +/* + * Close entry point + */ + +rtems_device_driver console_close( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg +) +{ + return RTEMS_SUCCESSFUL; +} + +/* + * read bytes from the serial port. We only have stdin. + */ + +rtems_device_driver console_read( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg +) +{ + rtems_libio_rw_args_t *rw_args; + char *buffer; + int maximum; + int count = 0; + + rw_args = (rtems_libio_rw_args_t *) arg; + + buffer = rw_args->buffer; + maximum = rw_args->count; + + for (count = 0; count < maximum; count++) { + buffer[ count ] = inbyte(); + if (buffer[ count ] == '\n' || buffer[ count ] == '\r') { + buffer[ count++ ] = '\n'; + buffer[ count ] = 0; break; } } - return (i); + + rw_args->bytes_moved = count; + return (count >= 0) ? RTEMS_SUCCESSFUL : RTEMS_UNSATISFIED; } - + /* - * __write -- write bytes to the serial port. Ignore fd, since - * stdout and stderr are the same. Since we have no filesystem, - * open will only return an error. + * write bytes to the serial port. Stdout and stderr are the same. */ - -int __write( - int fd, - char *buf, - int nbytes + +rtems_device_driver console_write( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg ) { - int i; - - for (i = 0; i < nbytes; i++) { - if (*(buf + i) == '\n') { - outbyte ('\r'); + int count; + int maximum; + rtems_libio_rw_args_t *rw_args; + char *buffer; + + rw_args = (rtems_libio_rw_args_t *) arg; + + buffer = rw_args->buffer; + maximum = rw_args->count; + + for (count = 0; count < maximum; count++) { + if ( buffer[ count ] == '\n') { + outbyte('\r'); } - outbyte (*(buf + i)); + outbyte( buffer[ count ] ); } - return (nbytes); + return maximum; +} + +/* + * IO Control entry point + */ + +rtems_device_driver console_control( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg +) +{ + return RTEMS_SUCCESSFUL; } + diff --git a/c/src/lib/libmisc/error/error.c b/c/src/lib/libmisc/error/error.c index 8cf46f0565..cfe1858e08 100644 --- a/c/src/lib/libmisc/error/error.c +++ b/c/src/lib/libmisc/error/error.c @@ -91,8 +91,8 @@ rtems_assoc_t rtems_status_assoc[] = { { "not owner of resource", RTEMS_NOT_OWNER_OF_RESOURCE , }, { "directive not implemented", RTEMS_NOT_IMPLEMENTED, }, { "RTEMS inconsistency detected", RTEMS_INTERNAL_ERROR, }, - { "internal multiprocessing only", RTEMS_PROXY_BLOCKING, }, { "could not get enough memory", RTEMS_NO_MEMORY, }, + { "internal multiprocessing only", THREAD_STATUS_PROXY_BLOCKING, }, { 0, 0, 0 }, }; @@ -134,7 +134,7 @@ static int rtems_verror( if (error_flag & RTEMS_ERROR_ERRNO) /* include errno? */ local_errno = errno; - if (_Configuration_Is_multiprocessing()) + if (_System_state_Is_multiprocessing) fprintf(stderr, "[%d] ", _Configuration_MP_table->node); if (rtems_progname && *rtems_progname) diff --git a/c/src/lib/libmisc/monitor/mon-dname.c b/c/src/lib/libmisc/monitor/mon-dname.c index fd10f3e333..b9907eb42b 100644 --- a/c/src/lib/libmisc/monitor/mon-dname.c +++ b/c/src/lib/libmisc/monitor/mon-dname.c @@ -57,7 +57,8 @@ rtems_monitor_dname_next( rtems_driver_name_t *table = object_information; rtems_driver_name_t *np = 0; - for (np = table + n ; n<RTEMS_MAX_DRIVER_NAMES; n++, np++) +/* XXX should we be using _IO_Number_of_devices */ + for (np = table + n ; n<_IO_Number_of_devices; n++, np++) if (np->device_name) goto done; diff --git a/c/src/lib/libmisc/monitor/mon-extension.c b/c/src/lib/libmisc/monitor/mon-extension.c index 48dfb96a2d..230fab9ddf 100644 --- a/c/src/lib/libmisc/monitor/mon-extension.c +++ b/c/src/lib/libmisc/monitor/mon-extension.c @@ -22,20 +22,20 @@ rtems_monitor_extension_canonical( rtems_extensions_table *e = &rtems_extension->Extension.Callouts; rtems_monitor_symbol_canonical_by_value(&canonical_extension->create, - e->rtems_task_create); + e->thread_create); rtems_monitor_symbol_canonical_by_value(&canonical_extension->start, - e->rtems_task_start); + e->thread_start); rtems_monitor_symbol_canonical_by_value(&canonical_extension->restart, - e->rtems_task_restart); + e->thread_restart); rtems_monitor_symbol_canonical_by_value(&canonical_extension->delete, - e->rtems_task_delete); + e->thread_delete); rtems_monitor_symbol_canonical_by_value(&canonical_extension->tswitch, - e->task_switch); + e->thread_switch); rtems_monitor_symbol_canonical_by_value(&canonical_extension->begin, - e->task_begin); + e->thread_begin); rtems_monitor_symbol_canonical_by_value(&canonical_extension->exitted, - e->task_exitted); + e->thread_exitted); rtems_monitor_symbol_canonical_by_value(&canonical_extension->fatal, e->fatal); } diff --git a/c/src/lib/libmisc/monitor/mon-object.c b/c/src/lib/libmisc/monitor/mon-object.c index 619ae5cf79..2f92845586 100644 --- a/c/src/lib/libmisc/monitor/mon-object.c +++ b/c/src/lib/libmisc/monitor/mon-object.c @@ -92,7 +92,10 @@ rtems_monitor_object_info_t rtems_monitor_object_info[] = (rtems_monitor_object_dump_fn) rtems_monitor_driver_dump, }, { RTEMS_OBJECT_DNAME, - (void *) &rtems_driver_name_table[0], + /* XXX now that the driver name table is allocated from the */ + /* XXX Workspace, this does not work */ + (void *) 0, + /* (void *) _IO_Driver_name_table, */ sizeof(rtems_monitor_dname_t), (rtems_monitor_object_next_fn) rtems_monitor_dname_next, (rtems_monitor_object_canonical_fn) rtems_monitor_dname_canonical, diff --git a/c/src/lib/libmisc/monitor/mon-server.c b/c/src/lib/libmisc/monitor/mon-server.c index e3e2da5069..5ff5688c9c 100644 --- a/c/src/lib/libmisc/monitor/mon-server.c +++ b/c/src/lib/libmisc/monitor/mon-server.c @@ -219,7 +219,7 @@ rtems_monitor_server_init( { rtems_status_code status; - if (_Configuration_Is_multiprocessing() && + if (_System_state_Is_multiprocessing && (_Configuration_MP_table->maximum_nodes > 1)) { unsigned32 maximum_nodes = _Configuration_MP_table->maximum_nodes; diff --git a/c/src/lib/libmisc/monitor/mon-task.c b/c/src/lib/libmisc/monitor/mon-task.c index 1f4dee7dee..95b650d429 100644 --- a/c/src/lib/libmisc/monitor/mon-task.c +++ b/c/src/lib/libmisc/monitor/mon-task.c @@ -19,6 +19,9 @@ rtems_monitor_task_canonical( ) { Thread_Control *rtems_thread = (Thread_Control *) thread_void; + RTEMS_API_Control *api; + + api = rtems_thread->API_Extensions[ THREAD_API_RTEMS ]; canonical_task->entry = rtems_thread->Start.entry_point; canonical_task->argument = rtems_thread->Start.numeric_argument; @@ -27,11 +30,18 @@ rtems_monitor_task_canonical( canonical_task->priority = rtems_thread->current_priority; canonical_task->state = rtems_thread->current_state; canonical_task->wait_id = rtems_thread->Wait.id; - canonical_task->events = rtems_thread->RTEMS_API->pending_events; - canonical_task->modes = rtems_thread->current_modes; - canonical_task->attributes = 0 /* XXX FIX ME rtems_thread->RTEMS_API->attribute_set */; - (void) memcpy(canonical_task->notepad, rtems_thread->RTEMS_API->Notepads, sizeof(canonical_task->notepad)); + canonical_task->events = api->pending_events; + +/* XXX modes and attributes only exist in the RTEMS API .. */ +/* XXX not directly in the core thread.. they will have to be derived */ +/* XXX if they are important enough to include anymore. */ + canonical_task->modes = 0; /* XXX FIX ME.... rtems_thread->current_modes; */ + canonical_task->attributes = 0 /* XXX FIX ME rtems_thread->API_Extensions[ THREAD_API_RTEMS ]->attribute_set */; + (void) memcpy(canonical_task->notepad, api ->Notepads, sizeof(canonical_task->notepad)); +/* XXX more to fix */ +/* (void) memcpy(&canonical_task->wait_args, &rtems_thread->Wait.Extra, sizeof(canonical_task->wait_args)); +*/ } diff --git a/c/src/lib/libmisc/stackchk/check.c b/c/src/lib/libmisc/stackchk/check.c index f9f32c5204..c2ee9a0a10 100644 --- a/c/src/lib/libmisc/stackchk/check.c +++ b/c/src/lib/libmisc/stackchk/check.c @@ -18,18 +18,9 @@ * */ -#include <rtems/system.h> -#include <rtems/extension.h> -#include <rtems/fatal.h> -#include <rtems/heap.h> -#include <rtems/stack.h> -#include <rtems/thread.h> -#ifdef XXX_RTEMS_H_FIXED -#include <bsp.h> -#else -#include <rtems/config.h> +#include <rtems.h> + extern rtems_configuration_table BSP_Configuration; -#endif #include <assert.h> #include <stdio.h> @@ -56,6 +47,7 @@ rtems_extensions_table Stack_check_Extension_table = { 0, /* rtems_task_restart */ 0, /* rtems_task_delete */ Stack_check_Switch_extension, /* task_switch */ + 0, /* task_post_switch */ Stack_check_Begin_extension, /* task_begin */ 0, /* task_exitted */ Stack_check_Fatal_extension, /* fatal */ @@ -133,9 +125,13 @@ unsigned32 stack_check_initialized = 0; void Stack_check_Initialize( void ) { - rtems_status_code status; - Objects_Id id_ignored; - unsigned32 *p; + rtems_status_code status; + Objects_Id id_ignored; + unsigned32 *p; + unsigned32 i; + unsigned32 class_index; + Thread_Control *the_thread; + Objects_Information *information; if (stack_check_initialized) return; @@ -171,10 +167,31 @@ void Stack_check_Initialize( void ) * So pretend here that we actually ran create and begin extensions. */ + /* XXX + * + * Technically this has not been done for any task created before this + * happened. So just run through them and fix the situation. + */ +#if 0 if (_Thread_Executing) { Stack_check_Create_extension(_Thread_Executing, _Thread_Executing); } +#endif + +#if 0 + for ( class_index = OBJECTS_CLASSES_FIRST ; + class_index <= OBJECTS_CLASSES_LAST ; + class_index++ ) { + information = _Objects_Information_table[ class_index ]; + if ( information && information->is_thread ) { + for ( i=1 ; i <= information->maximum ; i++ ) { + the_thread = (Thread_Control *)information->local_table[ i ]; + Stack_check_Create_extension( the_thread, the_thread ); + } + } + } +#endif /* * If appropriate, setup the interrupt stack for high water testing @@ -197,13 +214,15 @@ void Stack_check_Initialize( void ) * Stack_check_Create_extension */ -void Stack_check_Create_extension( +boolean Stack_check_Create_extension( Thread_Control *running, Thread_Control *the_thread ) { - if (the_thread && (the_thread != _Thread_Executing)) + if (the_thread /* XXX && (the_thread != _Thread_Executing) */ ) stack_check_dope_stack(&the_thread->Start.Initial_stack); + + return TRUE; } /*PAGE diff --git a/c/src/lib/libmisc/stackchk/internal.h b/c/src/lib/libmisc/stackchk/internal.h index 19c9f5e267..7cecbd6e1a 100644 --- a/c/src/lib/libmisc/stackchk/internal.h +++ b/c/src/lib/libmisc/stackchk/internal.h @@ -50,7 +50,7 @@ typedef struct { * Stack_check_Create_extension */ -void Stack_check_Create_extension( +boolean Stack_check_Create_extension( Thread_Control *running, Thread_Control *the_thread ); diff --git a/c/src/lib/start/i960/start.s b/c/src/lib/start/i960/start.s index 8db45011b1..f9287d2641 100644 --- a/c/src/lib/start/i960/start.s +++ b/c/src/lib/start/i960/start.s @@ -80,7 +80,8 @@ init_frames: */ ldconst 0,g0 ldconst 0,g1 - call _bsp_start + ldconst 0,g2 + call _main ret END_CODE diff --git a/c/src/lib/start/m68k/start.s b/c/src/lib/start/m68k/start.s index 0bbb0a851f..2784b09901 100644 --- a/c/src/lib/start/m68k/start.s +++ b/c/src/lib/start/m68k/start.s @@ -97,7 +97,14 @@ loop: movel #0,a1@+ | to zero out uninitialized movec a0,isp | set interrupt stack #endif - jsr SYM (bsp_start) + + movel #0,a7@- | push environp + movel #0,a7@- | push argv + movel #0,a7@- | push argc + + jsr SYM (main) + addl #12,a7 + #if ( M68K_HAS_SEPARATE_STACKS == 1 ) move.l SYM (initial_isp),a0 movec a0,isp diff --git a/c/src/libchip/shmdr/init.c b/c/src/libchip/shmdr/init.c index 435bc9dbec..14eddca0aa 100644 --- a/c/src/libchip/shmdr/init.c +++ b/c/src/libchip/shmdr/init.c @@ -3,8 +3,7 @@ * This routine is the shared memory communications initerface * driver initialization routine. * - * Input parameters: - * configuration - address of configuration table + * Input parameters: NONE * * Output parameters: NONE * @@ -33,12 +32,8 @@ rtems_extensions_table MPCI_Shm_extensions; -rtems_mpci_entry Shm_Initialization( - rtems_configuration_table *configuration, - rtems_cpu_table *cpu_configuration, - rtems_multiprocessing_table *mp_configuration +rtems_mpci_entry Shm_Initialization( void ) -) { rtems_unsigned32 i, all_initialized; rtems_unsigned32 interrupt_cause, interrupt_value; @@ -46,6 +41,9 @@ rtems_mpci_entry Shm_Initialization( Shm_Node_status_control *nscb; rtems_unsigned32 extension_id; /* for installation of MPCI_Fatal */ rtems_unsigned32 remaining_memory; +/* XXX these should use "public" methods to set their values.... */ + rtems_configuration_table *configuration = _Configuration_Table; + rtems_multiprocessing_table *mp_configuration = _Configuration_MP_table; Shm_RTEMS_Configuration = configuration; Shm_RTEMS_MP_Configuration = mp_configuration; diff --git a/c/src/libchip/shmdr/mpci.h b/c/src/libchip/shmdr/mpci.h index 11638f8cc7..c5646a61d7 100644 --- a/c/src/libchip/shmdr/mpci.h +++ b/c/src/libchip/shmdr/mpci.h @@ -15,8 +15,8 @@ * $Id$ */ -#ifndef __MPCI_h -#define __MPCI_h +#ifndef __SHM_MPCI_h +#define __SHM_MPCI_h #ifdef __cplusplus extern "C" { diff --git a/c/src/libchip/shmdr/shm_driver.h b/c/src/libchip/shmdr/shm_driver.h index 2122873912..5ccb0aab6b 100644 --- a/c/src/libchip/shmdr/shm_driver.h +++ b/c/src/libchip/shmdr/shm_driver.h @@ -493,11 +493,7 @@ rtems_mpci_entry Shm_Get_packet( rtems_packet_prefix ** ); -rtems_mpci_entry Shm_Initialization( - rtems_configuration_table *configuration, - rtems_cpu_table *cpu_configuration, - rtems_multiprocessing_table *mp_configuration -); +rtems_mpci_entry Shm_Initialization( void ); rtems_mpci_entry Shm_Receive_packet( rtems_packet_prefix ** diff --git a/c/src/libmisc/error/error.c b/c/src/libmisc/error/error.c index 8cf46f0565..cfe1858e08 100644 --- a/c/src/libmisc/error/error.c +++ b/c/src/libmisc/error/error.c @@ -91,8 +91,8 @@ rtems_assoc_t rtems_status_assoc[] = { { "not owner of resource", RTEMS_NOT_OWNER_OF_RESOURCE , }, { "directive not implemented", RTEMS_NOT_IMPLEMENTED, }, { "RTEMS inconsistency detected", RTEMS_INTERNAL_ERROR, }, - { "internal multiprocessing only", RTEMS_PROXY_BLOCKING, }, { "could not get enough memory", RTEMS_NO_MEMORY, }, + { "internal multiprocessing only", THREAD_STATUS_PROXY_BLOCKING, }, { 0, 0, 0 }, }; @@ -134,7 +134,7 @@ static int rtems_verror( if (error_flag & RTEMS_ERROR_ERRNO) /* include errno? */ local_errno = errno; - if (_Configuration_Is_multiprocessing()) + if (_System_state_Is_multiprocessing) fprintf(stderr, "[%d] ", _Configuration_MP_table->node); if (rtems_progname && *rtems_progname) diff --git a/c/src/libmisc/monitor/mon-dname.c b/c/src/libmisc/monitor/mon-dname.c index fd10f3e333..b9907eb42b 100644 --- a/c/src/libmisc/monitor/mon-dname.c +++ b/c/src/libmisc/monitor/mon-dname.c @@ -57,7 +57,8 @@ rtems_monitor_dname_next( rtems_driver_name_t *table = object_information; rtems_driver_name_t *np = 0; - for (np = table + n ; n<RTEMS_MAX_DRIVER_NAMES; n++, np++) +/* XXX should we be using _IO_Number_of_devices */ + for (np = table + n ; n<_IO_Number_of_devices; n++, np++) if (np->device_name) goto done; diff --git a/c/src/libmisc/monitor/mon-extension.c b/c/src/libmisc/monitor/mon-extension.c index 48dfb96a2d..230fab9ddf 100644 --- a/c/src/libmisc/monitor/mon-extension.c +++ b/c/src/libmisc/monitor/mon-extension.c @@ -22,20 +22,20 @@ rtems_monitor_extension_canonical( rtems_extensions_table *e = &rtems_extension->Extension.Callouts; rtems_monitor_symbol_canonical_by_value(&canonical_extension->create, - e->rtems_task_create); + e->thread_create); rtems_monitor_symbol_canonical_by_value(&canonical_extension->start, - e->rtems_task_start); + e->thread_start); rtems_monitor_symbol_canonical_by_value(&canonical_extension->restart, - e->rtems_task_restart); + e->thread_restart); rtems_monitor_symbol_canonical_by_value(&canonical_extension->delete, - e->rtems_task_delete); + e->thread_delete); rtems_monitor_symbol_canonical_by_value(&canonical_extension->tswitch, - e->task_switch); + e->thread_switch); rtems_monitor_symbol_canonical_by_value(&canonical_extension->begin, - e->task_begin); + e->thread_begin); rtems_monitor_symbol_canonical_by_value(&canonical_extension->exitted, - e->task_exitted); + e->thread_exitted); rtems_monitor_symbol_canonical_by_value(&canonical_extension->fatal, e->fatal); } diff --git a/c/src/libmisc/monitor/mon-object.c b/c/src/libmisc/monitor/mon-object.c index 619ae5cf79..2f92845586 100644 --- a/c/src/libmisc/monitor/mon-object.c +++ b/c/src/libmisc/monitor/mon-object.c @@ -92,7 +92,10 @@ rtems_monitor_object_info_t rtems_monitor_object_info[] = (rtems_monitor_object_dump_fn) rtems_monitor_driver_dump, }, { RTEMS_OBJECT_DNAME, - (void *) &rtems_driver_name_table[0], + /* XXX now that the driver name table is allocated from the */ + /* XXX Workspace, this does not work */ + (void *) 0, + /* (void *) _IO_Driver_name_table, */ sizeof(rtems_monitor_dname_t), (rtems_monitor_object_next_fn) rtems_monitor_dname_next, (rtems_monitor_object_canonical_fn) rtems_monitor_dname_canonical, diff --git a/c/src/libmisc/monitor/mon-server.c b/c/src/libmisc/monitor/mon-server.c index e3e2da5069..5ff5688c9c 100644 --- a/c/src/libmisc/monitor/mon-server.c +++ b/c/src/libmisc/monitor/mon-server.c @@ -219,7 +219,7 @@ rtems_monitor_server_init( { rtems_status_code status; - if (_Configuration_Is_multiprocessing() && + if (_System_state_Is_multiprocessing && (_Configuration_MP_table->maximum_nodes > 1)) { unsigned32 maximum_nodes = _Configuration_MP_table->maximum_nodes; diff --git a/c/src/libmisc/monitor/mon-task.c b/c/src/libmisc/monitor/mon-task.c index 1f4dee7dee..95b650d429 100644 --- a/c/src/libmisc/monitor/mon-task.c +++ b/c/src/libmisc/monitor/mon-task.c @@ -19,6 +19,9 @@ rtems_monitor_task_canonical( ) { Thread_Control *rtems_thread = (Thread_Control *) thread_void; + RTEMS_API_Control *api; + + api = rtems_thread->API_Extensions[ THREAD_API_RTEMS ]; canonical_task->entry = rtems_thread->Start.entry_point; canonical_task->argument = rtems_thread->Start.numeric_argument; @@ -27,11 +30,18 @@ rtems_monitor_task_canonical( canonical_task->priority = rtems_thread->current_priority; canonical_task->state = rtems_thread->current_state; canonical_task->wait_id = rtems_thread->Wait.id; - canonical_task->events = rtems_thread->RTEMS_API->pending_events; - canonical_task->modes = rtems_thread->current_modes; - canonical_task->attributes = 0 /* XXX FIX ME rtems_thread->RTEMS_API->attribute_set */; - (void) memcpy(canonical_task->notepad, rtems_thread->RTEMS_API->Notepads, sizeof(canonical_task->notepad)); + canonical_task->events = api->pending_events; + +/* XXX modes and attributes only exist in the RTEMS API .. */ +/* XXX not directly in the core thread.. they will have to be derived */ +/* XXX if they are important enough to include anymore. */ + canonical_task->modes = 0; /* XXX FIX ME.... rtems_thread->current_modes; */ + canonical_task->attributes = 0 /* XXX FIX ME rtems_thread->API_Extensions[ THREAD_API_RTEMS ]->attribute_set */; + (void) memcpy(canonical_task->notepad, api ->Notepads, sizeof(canonical_task->notepad)); +/* XXX more to fix */ +/* (void) memcpy(&canonical_task->wait_args, &rtems_thread->Wait.Extra, sizeof(canonical_task->wait_args)); +*/ } diff --git a/c/src/libmisc/stackchk/check.c b/c/src/libmisc/stackchk/check.c index f9f32c5204..c2ee9a0a10 100644 --- a/c/src/libmisc/stackchk/check.c +++ b/c/src/libmisc/stackchk/check.c @@ -18,18 +18,9 @@ * */ -#include <rtems/system.h> -#include <rtems/extension.h> -#include <rtems/fatal.h> -#include <rtems/heap.h> -#include <rtems/stack.h> -#include <rtems/thread.h> -#ifdef XXX_RTEMS_H_FIXED -#include <bsp.h> -#else -#include <rtems/config.h> +#include <rtems.h> + extern rtems_configuration_table BSP_Configuration; -#endif #include <assert.h> #include <stdio.h> @@ -56,6 +47,7 @@ rtems_extensions_table Stack_check_Extension_table = { 0, /* rtems_task_restart */ 0, /* rtems_task_delete */ Stack_check_Switch_extension, /* task_switch */ + 0, /* task_post_switch */ Stack_check_Begin_extension, /* task_begin */ 0, /* task_exitted */ Stack_check_Fatal_extension, /* fatal */ @@ -133,9 +125,13 @@ unsigned32 stack_check_initialized = 0; void Stack_check_Initialize( void ) { - rtems_status_code status; - Objects_Id id_ignored; - unsigned32 *p; + rtems_status_code status; + Objects_Id id_ignored; + unsigned32 *p; + unsigned32 i; + unsigned32 class_index; + Thread_Control *the_thread; + Objects_Information *information; if (stack_check_initialized) return; @@ -171,10 +167,31 @@ void Stack_check_Initialize( void ) * So pretend here that we actually ran create and begin extensions. */ + /* XXX + * + * Technically this has not been done for any task created before this + * happened. So just run through them and fix the situation. + */ +#if 0 if (_Thread_Executing) { Stack_check_Create_extension(_Thread_Executing, _Thread_Executing); } +#endif + +#if 0 + for ( class_index = OBJECTS_CLASSES_FIRST ; + class_index <= OBJECTS_CLASSES_LAST ; + class_index++ ) { + information = _Objects_Information_table[ class_index ]; + if ( information && information->is_thread ) { + for ( i=1 ; i <= information->maximum ; i++ ) { + the_thread = (Thread_Control *)information->local_table[ i ]; + Stack_check_Create_extension( the_thread, the_thread ); + } + } + } +#endif /* * If appropriate, setup the interrupt stack for high water testing @@ -197,13 +214,15 @@ void Stack_check_Initialize( void ) * Stack_check_Create_extension */ -void Stack_check_Create_extension( +boolean Stack_check_Create_extension( Thread_Control *running, Thread_Control *the_thread ) { - if (the_thread && (the_thread != _Thread_Executing)) + if (the_thread /* XXX && (the_thread != _Thread_Executing) */ ) stack_check_dope_stack(&the_thread->Start.Initial_stack); + + return TRUE; } /*PAGE diff --git a/c/src/libmisc/stackchk/internal.h b/c/src/libmisc/stackchk/internal.h index 19c9f5e267..7cecbd6e1a 100644 --- a/c/src/libmisc/stackchk/internal.h +++ b/c/src/libmisc/stackchk/internal.h @@ -50,7 +50,7 @@ typedef struct { * Stack_check_Create_extension */ -void Stack_check_Create_extension( +boolean Stack_check_Create_extension( Thread_Control *running, Thread_Control *the_thread ); diff --git a/c/src/optman/rtems/no-dpmem.c b/c/src/optman/rtems/no-dpmem.c index 40f343eef4..a7116fefa1 100644 --- a/c/src/optman/rtems/no-dpmem.c +++ b/c/src/optman/rtems/no-dpmem.c @@ -13,10 +13,13 @@ */ #include <rtems/system.h> -#include <rtems/address.h> -#include <rtems/dpmem.h> -#include <rtems/object.h> -#include <rtems/thread.h> +#include <rtems/core/address.h> +#include <rtems/core/object.h> +#include <rtems/core/thread.h> + +#include <rtems/rtems/status.h> +#include <rtems/rtems/types.h> +#include <rtems/rtems/dpmem.h> void _Dual_ported_memory_Manager_initialization( unsigned32 maximum_ports @@ -32,7 +35,7 @@ rtems_status_code rtems_port_create( Objects_Id *id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_port_ident( @@ -40,14 +43,14 @@ rtems_status_code rtems_port_ident( Objects_Id *id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_port_delete( Objects_Id id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_port_internal_to_external( @@ -56,7 +59,7 @@ rtems_status_code rtems_port_internal_to_external( void **external ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_port_external_to_internal( @@ -65,5 +68,5 @@ rtems_status_code rtems_port_external_to_internal( void **internal ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } diff --git a/c/src/optman/rtems/no-event.c b/c/src/optman/rtems/no-event.c index c987193711..a0b2cecee7 100644 --- a/c/src/optman/rtems/no-event.c +++ b/c/src/optman/rtems/no-event.c @@ -13,19 +13,20 @@ */ #include <rtems/system.h> -#include <rtems/event.h> -#include <rtems/isr.h> -#include <rtems/object.h> -#include <rtems/options.h> -#include <rtems/states.h> -#include <rtems/thread.h> +#include <rtems/rtems/status.h> +#include <rtems/rtems/event.h> +#include <rtems/core/isr.h> +#include <rtems/core/object.h> +#include <rtems/rtems/options.h> +#include <rtems/core/states.h> +#include <rtems/core/thread.h> rtems_status_code rtems_event_send( Objects_Id id, rtems_event_set event_in ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_event_receive( @@ -35,6 +36,6 @@ rtems_status_code rtems_event_receive( rtems_event_set *event_out ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } diff --git a/c/src/optman/rtems/no-mp.c b/c/src/optman/rtems/no-mp.c index 9446cabb29..f354397c9f 100644 --- a/c/src/optman/rtems/no-mp.c +++ b/c/src/optman/rtems/no-mp.c @@ -14,23 +14,18 @@ */ #include <rtems/system.h> -#include <rtems/config.h> -#include <rtems/cpu.h> -#include <rtems/event.h> -#include <rtems/fatal.h> -#include <rtems/intthrd.h> -#include <rtems/message.h> -#include <rtems/mp.h> -#include <rtems/mpci.h> -#include <rtems/mppkt.h> -#include <rtems/part.h> -#include <rtems/sem.h> -#include <rtems/signal.h> -#include <rtems/states.h> -#include <rtems/tasks.h> -#include <rtems/thread.h> -#include <rtems/threadq.h> -#include <rtems/watchdog.h> +#include <rtems/rtems/status.h> +#include <rtems/rtems/mp.h> +#include <rtems/core/cpu.h> +#include <rtems/core/interr.h> +#include <rtems/core/mpci.h> +#include <rtems/core/mppkt.h> +#include <rtems/core/states.h> +#include <rtems/core/thread.h> +#include <rtems/core/threadq.h> +#include <rtems/core/tqdata.h> +#include <rtems/core/watchdog.h> +#include <rtems/sysstate.h> void _Multiprocessing_Manager_initialization ( void ) { @@ -40,62 +35,76 @@ void rtems_multiprocessing_announce ( void ) { } -Thread _Multiprocessing_Receive_server ( - Thread_Argument ignored +void _MPCI_Handler_initialization( + MPCI_Control *users_mpci_table ) { } -void _MPCI_Handler_initialization ( void ) +void _MPCI_Initialization ( void ) { } -void _MPCI_Initialization ( void ) +void _MPCI_Register_packet_processor( + Objects_Classes the_class, + MPCI_Packet_processor the_packet_processor + +) { } - -rtems_packet_prefix *_MPCI_Get_packet ( void ) + +MP_packet_Prefix *_MPCI_Get_packet ( void ) { return NULL; } void _MPCI_Return_packet ( - rtems_packet_prefix *the_packet + MP_packet_Prefix *the_packet ) { } void _MPCI_Send_process_packet ( unsigned32 destination, - rtems_packet_prefix *the_packet + MP_packet_Prefix *the_packet ) { } -rtems_status_code _MPCI_Send_request_packet ( +unsigned32 _MPCI_Send_request_packet ( unsigned32 destination, - rtems_packet_prefix *the_packet, + MP_packet_Prefix *the_packet, States_Control extra_state ) { - return( RTEMS_NOT_CONFIGURED ); + return 0; } void _MPCI_Send_response_packet ( unsigned32 destination, - rtems_packet_prefix *the_packet + MP_packet_Prefix *the_packet ) { } -rtems_packet_prefix *_MPCI_Receive_packet ( void ) +MP_packet_Prefix *_MPCI_Receive_packet ( void ) { return NULL; } Thread_Control *_MPCI_Process_response ( - rtems_packet_prefix *the_packet + MP_packet_Prefix *the_packet ) { return NULL; } + +void _MPCI_Receive_server( void ) +{ +} + +void _MPCI_Announce ( void ) +{ +} + +/* end of file */ diff --git a/c/src/optman/rtems/no-msg.c b/c/src/optman/rtems/no-msg.c index 6e8503ee32..8cdfcf8090 100644 --- a/c/src/optman/rtems/no-msg.c +++ b/c/src/optman/rtems/no-msg.c @@ -14,16 +14,17 @@ */ #include <rtems/system.h> -#include <rtems/attr.h> -#include <rtems/chain.h> +#include <rtems/rtems/status.h> +#include <rtems/rtems/attr.h> +#include <rtems/core/chain.h> #include <rtems/config.h> -#include <rtems/isr.h> -#include <rtems/message.h> -#include <rtems/object.h> -#include <rtems/options.h> -#include <rtems/states.h> -#include <rtems/thread.h> -#include <rtems/wkspace.h> +#include <rtems/core/isr.h> +#include <rtems/rtems/message.h> +#include <rtems/core/object.h> +#include <rtems/rtems/options.h> +#include <rtems/core/states.h> +#include <rtems/core/thread.h> +#include <rtems/core/wkspace.h> void _Message_queue_Manager_initialization( unsigned32 maximum_message_queues @@ -39,7 +40,7 @@ rtems_status_code rtems_message_queue_create( Objects_Id *id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_message_queue_ident( @@ -48,14 +49,14 @@ rtems_status_code rtems_message_queue_ident( Objects_Id *id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_message_queue_delete( Objects_Id id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_message_queue_send( @@ -64,7 +65,7 @@ rtems_status_code rtems_message_queue_send( unsigned32 size ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_message_queue_urgent( @@ -73,7 +74,7 @@ rtems_status_code rtems_message_queue_urgent( unsigned32 size ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_message_queue_broadcast( @@ -83,7 +84,7 @@ rtems_status_code rtems_message_queue_broadcast( unsigned32 *count ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_message_queue_receive( @@ -94,7 +95,7 @@ rtems_status_code rtems_message_queue_receive( rtems_interval timeout ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_message_queue_flush( @@ -102,7 +103,7 @@ rtems_status_code rtems_message_queue_flush( unsigned32 *count ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } unsigned32 _Message_queue_Flush_support( @@ -130,5 +131,5 @@ rtems_status_code _Message_queue_Submit( Message_queue_Submit_types submit_type ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } diff --git a/c/src/optman/rtems/no-part.c b/c/src/optman/rtems/no-part.c index 0b0e51329f..45cf1a7d78 100644 --- a/c/src/optman/rtems/no-part.c +++ b/c/src/optman/rtems/no-part.c @@ -14,11 +14,12 @@ */ #include <rtems/system.h> -#include <rtems/address.h> +#include <rtems/rtems/status.h> +#include <rtems/core/address.h> #include <rtems/config.h> -#include <rtems/object.h> -#include <rtems/part.h> -#include <rtems/thread.h> +#include <rtems/core/object.h> +#include <rtems/rtems/part.h> +#include <rtems/core/thread.h> void _Partition_Manager_initialization( unsigned32 maximum_partitions @@ -35,7 +36,7 @@ rtems_status_code rtems_partition_create( Objects_Id *id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_partition_ident( @@ -44,14 +45,14 @@ rtems_status_code rtems_partition_ident( Objects_Id *id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_partition_delete( Objects_Id id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_partition_get_buffer( @@ -59,7 +60,7 @@ rtems_status_code rtems_partition_get_buffer( void **buffer ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_partition_return_buffer( @@ -67,5 +68,5 @@ rtems_status_code rtems_partition_return_buffer( void *buffer ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } diff --git a/c/src/optman/rtems/no-region.c b/c/src/optman/rtems/no-region.c index 490d1371c0..4985000cab 100644 --- a/c/src/optman/rtems/no-region.c +++ b/c/src/optman/rtems/no-region.c @@ -14,12 +14,13 @@ */ #include <rtems/system.h> +#include <rtems/rtems/status.h> #include <rtems/config.h> -#include <rtems/object.h> -#include <rtems/options.h> -#include <rtems/region.h> -#include <rtems/states.h> -#include <rtems/thread.h> +#include <rtems/core/object.h> +#include <rtems/rtems/options.h> +#include <rtems/rtems/region.h> +#include <rtems/core/states.h> +#include <rtems/core/thread.h> void _Region_Manager_initialization( unsigned32 maximum_regions @@ -36,7 +37,7 @@ rtems_status_code rtems_region_create( Objects_Id *id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_region_ident( @@ -44,14 +45,14 @@ rtems_status_code rtems_region_ident( Objects_Id *id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_region_delete( Objects_Id id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_region_get_segment( @@ -62,7 +63,7 @@ rtems_status_code rtems_region_get_segment( void **segment ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_region_get_segment_size( @@ -71,7 +72,7 @@ rtems_status_code rtems_region_get_segment_size( unsigned32 *size ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_region_return_segment( @@ -79,5 +80,5 @@ rtems_status_code rtems_region_return_segment( void *segment ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } diff --git a/c/src/optman/rtems/no-rtmon.c b/c/src/optman/rtems/no-rtmon.c index 8371f19a7f..3c633721cc 100644 --- a/c/src/optman/rtems/no-rtmon.c +++ b/c/src/optman/rtems/no-rtmon.c @@ -14,10 +14,13 @@ */ #include <rtems/system.h> -#include <rtems/isr.h> -#include <rtems/object.h> -#include <rtems/ratemon.h> -#include <rtems/thread.h> +#include <rtems/rtems/status.h> +#include <rtems/core/isr.h> +#include <rtems/core/object.h> +#include <rtems/core/thread.h> + +#include <rtems/rtems/types.h> +#include <rtems/rtems/ratemon.h> void _Rate_monotonic_Manager_initialization( unsigned32 maximum_periods @@ -30,7 +33,7 @@ rtems_status_code rtems_rate_monotonic_create( Objects_Id *id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_rate_monotonic_ident( @@ -38,21 +41,21 @@ rtems_status_code rtems_rate_monotonic_ident( Objects_Id *id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_rate_monotonic_cancel( Objects_Id id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_rate_monotonic_delete( Objects_Id id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_rate_monotonic_period( @@ -60,7 +63,7 @@ rtems_status_code rtems_rate_monotonic_period( rtems_interval length ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } void _Rate_monotonic_Timeout( diff --git a/c/src/optman/rtems/no-sem.c b/c/src/optman/rtems/no-sem.c index d96b1693e2..eabd8e12a9 100644 --- a/c/src/optman/rtems/no-sem.c +++ b/c/src/optman/rtems/no-sem.c @@ -14,15 +14,16 @@ */ #include <rtems/system.h> -#include <rtems/attr.h> +#include <rtems/rtems/status.h> +#include <rtems/rtems/attr.h> #include <rtems/config.h> -#include <rtems/isr.h> -#include <rtems/object.h> -#include <rtems/options.h> -#include <rtems/sem.h> -#include <rtems/states.h> -#include <rtems/thread.h> -#include <rtems/threadq.h> +#include <rtems/core/isr.h> +#include <rtems/core/object.h> +#include <rtems/rtems/options.h> +#include <rtems/rtems/sem.h> +#include <rtems/core/states.h> +#include <rtems/core/thread.h> +#include <rtems/core/threadq.h> void _Semaphore_Manager_initialization( unsigned32 maximum_semaphores @@ -38,7 +39,7 @@ rtems_status_code rtems_semaphore_create( Objects_Id *id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_semaphore_ident( @@ -47,14 +48,14 @@ rtems_status_code rtems_semaphore_ident( Objects_Id *id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_semaphore_delete( Objects_Id id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_semaphore_obtain( @@ -63,14 +64,14 @@ rtems_status_code rtems_semaphore_obtain( rtems_interval timeout ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_semaphore_release( Objects_Id id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } boolean _Semaphore_Seize( diff --git a/c/src/optman/rtems/no-signal.c b/c/src/optman/rtems/no-signal.c index fedbf87db3..2193881d18 100644 --- a/c/src/optman/rtems/no-signal.c +++ b/c/src/optman/rtems/no-signal.c @@ -14,18 +14,24 @@ */ #include <rtems/system.h> -#include <rtems/asr.h> -#include <rtems/isr.h> -#include <rtems/modes.h> -#include <rtems/signal.h> -#include <rtems/thread.h> +#include <rtems/rtems/status.h> +#include <rtems/core/isr.h> +#include <rtems/core/thread.h> +#include <rtems/rtems/asr.h> +#include <rtems/rtems/modes.h> +#include <rtems/rtems/signal.h> + +void _Signal_Manager_initialization( void ) +{ +} + rtems_status_code rtems_signal_catch( rtems_asr_entry handler, rtems_mode mode_set ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_signal_send( @@ -33,5 +39,7 @@ rtems_status_code rtems_signal_send( rtems_signal_set signal_set ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } + +/* end of file */ diff --git a/c/src/optman/rtems/no-timer.c b/c/src/optman/rtems/no-timer.c index 1f6deb2e4f..0e32a501a6 100644 --- a/c/src/optman/rtems/no-timer.c +++ b/c/src/optman/rtems/no-timer.c @@ -14,11 +14,14 @@ */ #include <rtems/system.h> -#include <rtems/object.h> -#include <rtems/thread.h> -#include <rtems/timer.h> -#include <rtems/tod.h> -#include <rtems/watchdog.h> +#include <rtems/rtems/status.h> +#include <rtems/core/object.h> +#include <rtems/core/thread.h> +#include <rtems/core/tod.h> +#include <rtems/core/watchdog.h> + +#include <rtems/rtems/types.h> +#include <rtems/rtems/timer.h> void _Timer_Manager_initialization( unsigned32 maximum_timers @@ -31,7 +34,7 @@ rtems_status_code rtems_timer_create( Objects_Id *id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_timer_ident( @@ -39,46 +42,46 @@ rtems_status_code rtems_timer_ident( Objects_Id *id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_timer_cancel( Objects_Id id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_timer_delete( Objects_Id id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_timer_fire_after( - Objects_Id id, - rtems_interval ticks, - Timer_Service routine, - void *user_data + Objects_Id id, + rtems_interval ticks, + rtems_timer_service_routine_entry routine, + void *user_data ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_timer_fire_when( - Objects_Id id, - rtems_time_of_day *wall_time, - Timer_Service routine, - void *user_data + Objects_Id id, + rtems_time_of_day *wall_time, + rtems_timer_service_routine_entry routine, + void *user_data ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_timer_reset( Objects_Id id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } diff --git a/c/src/optman/sapi/no-ext.c b/c/src/optman/sapi/no-ext.c index db1df3624f..ea5f04d672 100644 --- a/c/src/optman/sapi/no-ext.c +++ b/c/src/optman/sapi/no-ext.c @@ -14,8 +14,10 @@ */ #include <rtems/system.h> -#include <rtems/object.h> -#include <rtems/thread.h> +#include <rtems/rtems/status.h> +#include <rtems/rtems/support.h> +#include <rtems/core/object.h> +#include <rtems/core/thread.h> #include <rtems/extension.h> void _Extension_Manager_initialization( @@ -25,12 +27,12 @@ void _Extension_Manager_initialization( } rtems_status_code rtems_extension_create( - rtems_name name, + rtems_name name, rtems_extensions_table *extension_table, - Objects_Id *id + Objects_Id *id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_extension_ident( @@ -38,12 +40,12 @@ rtems_status_code rtems_extension_ident( Objects_Id *id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_extension_delete( Objects_Id id ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } diff --git a/c/src/optman/sapi/no-io.c b/c/src/optman/sapi/no-io.c index d0fc7676f1..058ecfbfd2 100644 --- a/c/src/optman/sapi/no-io.c +++ b/c/src/optman/sapi/no-io.c @@ -14,10 +14,11 @@ */ #include <rtems/system.h> +#include <rtems/rtems/status.h> #include <rtems/config.h> #include <rtems/io.h> -#include <rtems/isr.h> -#include <rtems/thread.h> +#include <rtems/core/isr.h> +#include <rtems/core/thread.h> void _IO_Initialize_all_drivers( void ) { @@ -46,7 +47,7 @@ rtems_status_code rtems_io_initialize( void *argument ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_io_open( @@ -55,7 +56,7 @@ rtems_status_code rtems_io_open( void *argument ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_io_close( @@ -64,7 +65,7 @@ rtems_status_code rtems_io_close( void *argument ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_io_read( @@ -73,7 +74,7 @@ rtems_status_code rtems_io_read( void *argument ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_io_write( @@ -82,7 +83,7 @@ rtems_status_code rtems_io_write( void *argument ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } rtems_status_code rtems_io_control( @@ -91,5 +92,5 @@ rtems_status_code rtems_io_control( void *argument ) { - return( RTEMS_NOT_CONFIGURED ); + return RTEMS_NOT_CONFIGURED; } diff --git a/c/src/tests/libtests/stackchk/blow.c b/c/src/tests/libtests/stackchk/blow.c index 9ad93d849c..107461b135 100644 --- a/c/src/tests/libtests/stackchk/blow.c +++ b/c/src/tests/libtests/stackchk/blow.c @@ -14,9 +14,7 @@ * $Id$ */ -#include <rtems/system.h> -#include <rtems/heap.h> -#include <rtems/thread.h> +#include <rtems.h> void b() {} diff --git a/c/src/tests/libtests/stackchk/init.c b/c/src/tests/libtests/stackchk/init.c index dc0d94931e..0415493243 100644 --- a/c/src/tests/libtests/stackchk/init.c +++ b/c/src/tests/libtests/stackchk/init.c @@ -22,11 +22,8 @@ * $Id$ */ -#include "app.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" +#define TEST_INIT +#include "system.h" rtems_task Init( rtems_task_argument argument diff --git a/c/src/tests/libtests/stackchk/system.h b/c/src/tests/libtests/stackchk/system.h new file mode 100644 index 0000000000..56a8e9526a --- /dev/null +++ b/c/src/tests/libtests/stackchk/system.h @@ -0,0 +1,49 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include <tmacros.h> + +/* macros */ + +#define TASK_STACK_SIZE (RTEMS_MINIMUM_STACK_SIZE*3) + +/* functions */ + +rtems_task Init( + rtems_task_argument argument +); + +rtems_task Task_1_through_3( + rtems_task_argument argument +); + +void blow_stack( void ); + +/* configuration information */ + +#define CONFIGURE_SPTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER + +#include <confdefs.h> + +/* global variables */ + +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ + +/* end of include file */ diff --git a/c/src/tests/libtests/stackchk/task1.c b/c/src/tests/libtests/stackchk/task1.c index d683619c7e..de31ee1068 100644 --- a/c/src/tests/libtests/stackchk/task1.c +++ b/c/src/tests/libtests/stackchk/task1.c @@ -14,7 +14,7 @@ * $Id$ */ -#include "app.h" +#include "system.h" rtems_task Task_1_through_3( rtems_task_argument argument diff --git a/c/src/tests/mptests/mp01/init.c b/c/src/tests/mptests/mp01/init.c index 2af49c8a6b..1a4c9463e4 100644 --- a/c/src/tests/mptests/mp01/init.c +++ b/c/src/tests/mptests/mp01/init.c @@ -22,11 +22,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_task Init( rtems_task_argument argument diff --git a/c/src/tests/mptests/mp01/system.h b/c/src/tests/mptests/mp01/system.h index 1110c1574f..54e0134a7d 100644 --- a/c/src/tests/mptests/mp01/system.h +++ b/c/src/tests/mptests/mp01/system.h @@ -16,14 +16,30 @@ #include <tmacros.h> -/* Miscellaneous */ +/* functions */ -#define EXTERN extern /* external definition */ +rtems_task Init( + rtems_task_argument argument +); -/* macros */ +rtems_task Test_task( + rtems_task_argument argument +); -/* structures */ +/* configuration information */ + +#define CONFIGURE_MPTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_GLOBAL -#include <gvar.h> +#include <confdefs.h> + +/* variables */ + +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ /* end of include file */ diff --git a/c/src/tests/mptests/mp02/init.c b/c/src/tests/mptests/mp02/init.c index 75d8565785..22e145d6c6 100644 --- a/c/src/tests/mptests/mp02/init.c +++ b/c/src/tests/mptests/mp02/init.c @@ -22,11 +22,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_task Init( rtems_task_argument argument diff --git a/c/src/tests/mptests/mp02/system.h b/c/src/tests/mptests/mp02/system.h index 0bf193dad9..8e2e95806d 100644 --- a/c/src/tests/mptests/mp02/system.h +++ b/c/src/tests/mptests/mp02/system.h @@ -16,14 +16,28 @@ #include <tmacros.h> -/* Miscellaneous */ +/* functions */ -#define EXTERN extern /* external definition */ +rtems_task Init( + rtems_task_argument argument +); -/* macros */ +rtems_task Test_task( + rtems_task_argument argument +); -/* structures */ +/* configuration information */ + +#define CONFIGURE_MPTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER + +#include <confdefs.h> -#include "gvar.h" +/* variables */ + +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ /* end of include file */ diff --git a/c/src/tests/mptests/mp03/init.c b/c/src/tests/mptests/mp03/init.c index a1f210dad1..861a77ef2d 100644 --- a/c/src/tests/mptests/mp03/init.c +++ b/c/src/tests/mptests/mp03/init.c @@ -22,11 +22,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_task Init( rtems_task_argument argument diff --git a/c/src/tests/mptests/mp03/system.h b/c/src/tests/mptests/mp03/system.h index 0bf193dad9..39ba36ede3 100644 --- a/c/src/tests/mptests/mp03/system.h +++ b/c/src/tests/mptests/mp03/system.h @@ -16,14 +16,41 @@ #include <tmacros.h> -/* Miscellaneous */ +/* functions */ -#define EXTERN extern /* external definition */ +rtems_task Init( + rtems_task_argument argument +); -/* macros */ +rtems_task Test_task( + rtems_task_argument argument +); -/* structures */ +rtems_timer_service_routine Delayed_send_event( + rtems_id ignored_id, + void *ignored_address +); + +/* configuration information */ + +#define CONFIGURE_MPTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_MAXIMUM_TIMERS 1 -#include "gvar.h" +#include <confdefs.h> +/* variables */ + +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ + +TEST_EXTERN rtems_id Timer_id[ 2 ]; /* array of timer ids */ +TEST_EXTERN rtems_name Timer_name[ 2 ]; /* array of timer names */ + +TEST_EXTERN rtems_unsigned32 remote_node; +TEST_EXTERN rtems_id remote_tid; + /* end of include file */ diff --git a/c/src/tests/mptests/mp04/init.c b/c/src/tests/mptests/mp04/init.c index 106176c6ca..adc21b9f0c 100644 --- a/c/src/tests/mptests/mp04/init.c +++ b/c/src/tests/mptests/mp04/init.c @@ -22,11 +22,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_task Init( rtems_task_argument argument diff --git a/c/src/tests/mptests/mp04/system.h b/c/src/tests/mptests/mp04/system.h index 0bf193dad9..f67d16fe53 100644 --- a/c/src/tests/mptests/mp04/system.h +++ b/c/src/tests/mptests/mp04/system.h @@ -16,14 +16,30 @@ #include <tmacros.h> -/* Miscellaneous */ +/* functions */ -#define EXTERN extern /* external definition */ +rtems_task Init( + rtems_task_argument argument +); -/* macros */ +rtems_task Test_task( + rtems_task_argument argument +); -/* structures */ +/* configuration information */ + +#define CONFIGURE_MPTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_MAXIMUM_TIMERS 1 -#include "gvar.h" +#include <confdefs.h> + +/* variables */ + +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ /* end of include file */ diff --git a/c/src/tests/mptests/mp05/init.c b/c/src/tests/mptests/mp05/init.c index 5db791d8f2..b6338f9a5d 100644 --- a/c/src/tests/mptests/mp05/init.c +++ b/c/src/tests/mptests/mp05/init.c @@ -22,11 +22,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_task Init( rtems_task_argument argument diff --git a/c/src/tests/mptests/mp05/system.h b/c/src/tests/mptests/mp05/system.h index 0bf193dad9..2ebc8b47b5 100644 --- a/c/src/tests/mptests/mp05/system.h +++ b/c/src/tests/mptests/mp05/system.h @@ -16,14 +16,44 @@ #include <tmacros.h> -/* Miscellaneous */ +/* functions */ -#define EXTERN extern /* external definition */ +rtems_task Init( + rtems_task_argument argument +); -/* macros */ +rtems_task Test_task( + rtems_task_argument argument +); -/* structures */ +rtems_asr Process_asr( rtems_signal_set ); -#include "gvar.h" +/* configuration information */ + +#define CONFIGURE_MPTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_MAXIMUM_TIMERS 1 +#include <confdefs.h> + +/* variables */ + +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ + +TEST_EXTERN rtems_id Timer_id[ 2 ]; /* array of timer ids */ +TEST_EXTERN rtems_name Timer_name[ 2 ]; /* array of timer names */ + +TEST_EXTERN volatile rtems_boolean Stop_Test; + +TEST_EXTERN rtems_unsigned32 remote_node; +TEST_EXTERN rtems_id remote_tid; +TEST_EXTERN rtems_signal_set remote_signal; +TEST_EXTERN rtems_signal_set expected_signal; +TEST_EXTERN volatile rtems_unsigned32 signal_count; +TEST_EXTERN volatile rtems_unsigned32 signal_caught; + /* end of include file */ diff --git a/c/src/tests/mptests/mp06/init.c b/c/src/tests/mptests/mp06/init.c index ab41308954..8639554703 100644 --- a/c/src/tests/mptests/mp06/init.c +++ b/c/src/tests/mptests/mp06/init.c @@ -22,11 +22,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_task Init( rtems_task_argument argument diff --git a/c/src/tests/mptests/mp06/system.h b/c/src/tests/mptests/mp06/system.h index 416af01a5d..a7c0048cdd 100644 --- a/c/src/tests/mptests/mp06/system.h +++ b/c/src/tests/mptests/mp06/system.h @@ -16,15 +16,35 @@ #include <tmacros.h> +/* functions */ -/* Miscellaneous */ +rtems_task Init( + rtems_task_argument argument +); -#define EXTERN extern /* external definition */ +rtems_task Test_task( + rtems_task_argument argument +); -/* macros */ +/* configuration information */ + +#define CONFIGURE_MPTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_MAXIMUM_TIMERS 1 -/* structures */ +#include <confdefs.h> -#include "gvar.h" +/* variables */ + +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ + +TEST_EXTERN rtems_id Timer_id[ 4 ]; /* array of timer ids */ +TEST_EXTERN rtems_name Timer_name[ 4 ]; /* array of timer names */ + +TEST_EXTERN volatile rtems_boolean Stop_Test; /* end of include file */ diff --git a/c/src/tests/mptests/mp07/init.c b/c/src/tests/mptests/mp07/init.c index 665c3f0b72..1d18eccd79 100644 --- a/c/src/tests/mptests/mp07/init.c +++ b/c/src/tests/mptests/mp07/init.c @@ -22,11 +22,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_task Init( rtems_task_argument argument diff --git a/c/src/tests/mptests/mp07/system.h b/c/src/tests/mptests/mp07/system.h index 96286ca802..a7c0048cdd 100644 --- a/c/src/tests/mptests/mp07/system.h +++ b/c/src/tests/mptests/mp07/system.h @@ -16,12 +16,35 @@ #include <tmacros.h> -#define EXTERN extern /* external definition */ +/* functions */ -/* macros */ +rtems_task Init( + rtems_task_argument argument +); -/* structures */ +rtems_task Test_task( + rtems_task_argument argument +); -#include "gvar.h" +/* configuration information */ + +#define CONFIGURE_MPTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_MAXIMUM_TIMERS 1 + +#include <confdefs.h> + +/* variables */ + +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ + +TEST_EXTERN rtems_id Timer_id[ 4 ]; /* array of timer ids */ +TEST_EXTERN rtems_name Timer_name[ 4 ]; /* array of timer names */ + +TEST_EXTERN volatile rtems_boolean Stop_Test; /* end of include file */ diff --git a/c/src/tests/mptests/mp08/init.c b/c/src/tests/mptests/mp08/init.c index 6f43d6635d..229a47afef 100644 --- a/c/src/tests/mptests/mp08/init.c +++ b/c/src/tests/mptests/mp08/init.c @@ -22,11 +22,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_task Init( rtems_task_argument argument diff --git a/c/src/tests/mptests/mp08/system.h b/c/src/tests/mptests/mp08/system.h index 0bf193dad9..42a2287af5 100644 --- a/c/src/tests/mptests/mp08/system.h +++ b/c/src/tests/mptests/mp08/system.h @@ -16,14 +16,34 @@ #include <tmacros.h> -/* Miscellaneous */ +/* functions */ -#define EXTERN extern /* external definition */ +rtems_task Init( + rtems_task_argument argument +); -/* macros */ +rtems_task Test_task( + rtems_task_argument argument +); -/* structures */ +/* configuration information */ + +#define CONFIGURE_MPTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_MAXIMUM_TIMERS 1 +#define CONFIGURE_MAXIMUM_SEMAPHORES 1 -#include "gvar.h" +#include <confdefs.h> + +/* variables */ + +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ + +TEST_EXTERN rtems_id Semaphore_id[ 2 ]; /* array of semaphore ids */ +TEST_EXTERN rtems_name Semaphore_name[ 2 ]; /* array of semaphore names */ /* end of include file */ diff --git a/c/src/tests/mptests/mp09/init.c b/c/src/tests/mptests/mp09/init.c index cbd612a267..95c837689a 100644 --- a/c/src/tests/mptests/mp09/init.c +++ b/c/src/tests/mptests/mp09/init.c @@ -22,11 +22,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_task Init( rtems_task_argument argument diff --git a/c/src/tests/mptests/mp09/system.h b/c/src/tests/mptests/mp09/system.h index 0bf193dad9..3060262e8e 100644 --- a/c/src/tests/mptests/mp09/system.h +++ b/c/src/tests/mptests/mp09/system.h @@ -16,14 +16,43 @@ #include <tmacros.h> -/* Miscellaneous */ +/* functions */ -#define EXTERN extern /* external definition */ +rtems_task Init( + rtems_task_argument argument +); -/* macros */ +rtems_task Test_task( + rtems_task_argument argument +); -/* structures */ +void Receive_messages( void ); -#include "gvar.h" +void Send_messages( void ); + +/* configuration information */ + +#define CONFIGURE_MPTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_MAXIMUM_TIMERS 1 +#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 + +#include <confdefs.h> + +/* variables */ + +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ + +TEST_EXTERN rtems_id Queue_id[ 2 ]; /* array of message queue ids */ +TEST_EXTERN rtems_name Queue_name[ 2 ]; /* array of message queue names */ + +extern char buffer1[16]; +extern char buffer2[16]; +extern char buffer3[16]; +extern char buffer4[16]; /* end of include file */ diff --git a/c/src/tests/mptests/mp10/init.c b/c/src/tests/mptests/mp10/init.c index 4d150be3da..b37be53a4c 100644 --- a/c/src/tests/mptests/mp10/init.c +++ b/c/src/tests/mptests/mp10/init.c @@ -28,11 +28,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_task Init( rtems_task_argument argument diff --git a/c/src/tests/mptests/mp10/system.h b/c/src/tests/mptests/mp10/system.h index 0bf193dad9..2c6d54d6a8 100644 --- a/c/src/tests/mptests/mp10/system.h +++ b/c/src/tests/mptests/mp10/system.h @@ -16,14 +16,47 @@ #include <tmacros.h> -/* Miscellaneous */ +/* functions */ -#define EXTERN extern /* external definition */ +rtems_task Init( + rtems_task_argument argument +); + +rtems_task Test_task1( + rtems_task_argument argument +); + +rtems_task Test_task2( + rtems_task_argument argument +); + +rtems_task Test_task3( + rtems_task_argument restart +); -/* macros */ +/* configuration information */ + +#define CONFIGURE_MPTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER + +#if ( NODE_NUMBER == 1 ) +#define CONFIGURE_MAXIMUM_SEMAPHORES 1 +#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 +#endif -/* structures */ +#include <confdefs.h> -#include "gvar.h" +/* variables */ + +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ + +TEST_EXTERN rtems_id Queue_id[ 2 ]; /* array of message queue ids */ +TEST_EXTERN rtems_name Queue_name[ 2 ]; /* array of message queue names */ + +TEST_EXTERN rtems_id Semaphore_id[ 2 ]; /* array of semaphore ids */ +TEST_EXTERN rtems_name Semaphore_name[ 2 ]; /* array of semaphore names */ /* end of include file */ diff --git a/c/src/tests/mptests/mp11/init.c b/c/src/tests/mptests/mp11/init.c index a560b35159..5e3da0d8d0 100644 --- a/c/src/tests/mptests/mp11/init.c +++ b/c/src/tests/mptests/mp11/init.c @@ -25,11 +25,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_unsigned8 my_partition[0x30000] CPU_STRUCTURE_ALIGNMENT; diff --git a/c/src/tests/mptests/mp11/system.h b/c/src/tests/mptests/mp11/system.h index 0bf193dad9..39ab88e08c 100644 --- a/c/src/tests/mptests/mp11/system.h +++ b/c/src/tests/mptests/mp11/system.h @@ -16,14 +16,39 @@ #include <tmacros.h> -/* Miscellaneous */ +/* functions */ -#define EXTERN extern /* external definition */ +rtems_task Init( + rtems_task_argument argument +); -/* macros */ +/* configuration information */ + +#define CONFIGURE_MPTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER -/* structures */ +#define CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS 0 +#define CONFIGURE_MP_MAXIMUM_PROXIES 0 + +#if ( NODE_NUMBER == 1 ) +#define CONFIGURE_MAXIMUM_SEMAPHORES 1 +#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 +#define CONFIGURE_MAXIMUM_PARTITIONS 1 +#endif -#include "gvar.h" +#include <confdefs.h> + +/* variables */ + +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ + +TEST_EXTERN rtems_id Queue_id[ 2 ]; /* array of message queue ids */ +TEST_EXTERN rtems_name Queue_name[ 2 ]; /* array of message queue names */ + +TEST_EXTERN rtems_id Semaphore_id[ 2 ]; /* array of semaphore ids */ +TEST_EXTERN rtems_name Semaphore_name[ 2 ]; /* array of semaphore names */ /* end of include file */ diff --git a/c/src/tests/mptests/mp12/init.c b/c/src/tests/mptests/mp12/init.c index ed56e192ae..93d472e6e6 100644 --- a/c/src/tests/mptests/mp12/init.c +++ b/c/src/tests/mptests/mp12/init.c @@ -27,11 +27,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_unsigned8 Partition_area[ 1024 ] CPU_STRUCTURE_ALIGNMENT; diff --git a/c/src/tests/mptests/mp12/system.h b/c/src/tests/mptests/mp12/system.h index 0bf193dad9..c743c4a415 100644 --- a/c/src/tests/mptests/mp12/system.h +++ b/c/src/tests/mptests/mp12/system.h @@ -16,14 +16,38 @@ #include <tmacros.h> -/* Miscellaneous */ +#define PT_NAME rtems_build_name( 'P', 'A', 'R', '\0' ) -#define EXTERN extern /* external definition */ +/* functions */ -/* macros */ +rtems_task Init( + rtems_task_argument argument +); -/* structures */ +/* configuration information */ + +#define CONFIGURE_MPTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER -#include "gvar.h" +#define CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS 1 +#define CONFIGURE_MP_MAXIMUM_PROXIES 0 + +#if ( NODE_NUMBER == 1 ) +#define CONFIGURE_MAXIMUM_PARTITIONS 1 +#elif ( NODE_NUMBER == 2 ) +#define CONFIGURE_MAXIMUM_PARTITIONS 2 +#endif + +#include <confdefs.h> + +/* variables */ + +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ + +TEST_EXTERN rtems_id Partition_id[ 2 ]; /* array of partition ids */ +TEST_EXTERN rtems_name Partition_name[ 2 ]; /* array of partition names */ /* end of include file */ diff --git a/c/src/tests/mptests/mp13/init.c b/c/src/tests/mptests/mp13/init.c index cff264e506..af618aed7c 100644 --- a/c/src/tests/mptests/mp13/init.c +++ b/c/src/tests/mptests/mp13/init.c @@ -22,11 +22,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_task Init( rtems_task_argument argument diff --git a/c/src/tests/mptests/mp13/system.h b/c/src/tests/mptests/mp13/system.h index 0bf193dad9..c3b0924a18 100644 --- a/c/src/tests/mptests/mp13/system.h +++ b/c/src/tests/mptests/mp13/system.h @@ -16,14 +16,43 @@ #include <tmacros.h> -/* Miscellaneous */ +/* functions */ -#define EXTERN extern /* external definition */ +rtems_task Init( + rtems_task_argument argument +); -/* macros */ +rtems_task Test_task1( + rtems_task_argument argument +); -/* structures */ +rtems_task Test_task2( + rtems_task_argument argument +); -#include "gvar.h" +/* configuration information */ + +#define CONFIGURE_MPTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER + +#if ( NODE_NUMBER == 1 ) +#define CONFIGURE_MAXIMUM_SEMAPHORES 1 +#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 +#endif + +#include <confdefs.h> + +/* variables */ + +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ + +TEST_EXTERN rtems_id Queue_id[ 2 ]; /* array of message queue ids */ +TEST_EXTERN rtems_name Queue_name[ 2 ]; /* array of message queue names */ + +TEST_EXTERN rtems_id Semaphore_id[ 2 ]; /* array of semaphore ids */ +TEST_EXTERN rtems_name Semaphore_name[ 2 ]; /* array of semaphore names */ /* end of include file */ diff --git a/c/src/tests/mptests/mp14/init.c b/c/src/tests/mptests/mp14/init.c index bc35d86469..2b2070083b 100644 --- a/c/src/tests/mptests/mp14/init.c +++ b/c/src/tests/mptests/mp14/init.c @@ -22,13 +22,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" - -#include "bsp.h" rtems_unsigned8 my_partition[0x30000] CPU_STRUCTURE_ALIGNMENT; diff --git a/c/src/tests/mptests/mp14/system.h b/c/src/tests/mptests/mp14/system.h index d825e0ef69..051727e854 100644 --- a/c/src/tests/mptests/mp14/system.h +++ b/c/src/tests/mptests/mp14/system.h @@ -15,16 +15,101 @@ */ #include <tmacros.h> -#include <mpci.h> -/* Miscellaneous */ +/* functions */ -#define EXTERN extern /* external definition */ +rtems_timer_service_routine Delayed_send_event( + rtems_id timer_id, + void *ignored_address +); -/* macros */ +rtems_task Init( + rtems_task_argument argument +); -/* structures */ +rtems_task Test_task( + rtems_task_argument argument +); -#include "gvar.h" +rtems_task Delayed_events_task( + rtems_task_argument argument +); + +rtems_task Message_queue_task( + rtems_task_argument index +); + +rtems_task Partition_task( + rtems_task_argument argument +); + +rtems_task Semaphore_task( + rtems_task_argument argument +); + +void Exit_test( void ); + +/* configuration information */ + +#define CONFIGURE_MPTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_TICKS_PER_TIMESLICE 1 +#define CONFIGURE_MICROSECONDS_PER_TICK RTEMS_MILLISECONDS_TO_MICROSECONDS(1) + +#if ( NODE_NUMBER == 1 ) +#define CONFIGURE_MAXIMUM_TIMERS 12 +#define CONFIGURE_MAXIMUM_SEMAPHORES 1 +#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 +#define CONFIGURE_MAXIMUM_PARTITIONS 1 +#elif ( NODE_NUMBER == 2 ) +#define CONFIGURE_MAXIMUM_TIMERS 2 +#endif + +#include <confdefs.h> + +/* variables */ + +TEST_EXTERN rtems_id Event_task_id[ 2 ]; /* event task ids */ + +TEST_EXTERN rtems_id Semaphore_task_id[ 2 ]; /* semaphore task ids */ +TEST_EXTERN rtems_name Semaphore_task_name[ 2 ]; /* semaphore task names */ + +TEST_EXTERN rtems_id Queue_task_id[ 3 ]; /* message queue task ids */ +TEST_EXTERN rtems_name Queue_task_name[ 3 ]; /* message queue task names */ + +TEST_EXTERN rtems_id Partition_task_id[ 4 ]; /* partition task ids */ +TEST_EXTERN rtems_name Partition_task_name[ 4 ]; /* partition task names */ + +TEST_EXTERN rtems_id Partition_id[ 3 ]; /* partition ids */ +TEST_EXTERN rtems_name Partition_name[ 3 ]; /* partition names */ + +TEST_EXTERN rtems_id Semaphore_id[ 3 ]; /* semaphore ids */ +TEST_EXTERN rtems_name Semaphore_name[ 3 ]; /* semaphore names */ + +TEST_EXTERN rtems_id Queue_id[ 3 ]; /* message queue ids */ +TEST_EXTERN rtems_name Queue_name[ 3 ]; /* message queue names */ + +TEST_EXTERN rtems_id Task_id[ 4 ]; /* remote event task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* remote event task names */ + +TEST_EXTERN rtems_id Timer_id[ 4 ]; /* event timer ids */ +TEST_EXTERN rtems_name Timer_name[ 4 ]; /* event timer names */ + +TEST_EXTERN rtems_unsigned32 Msg_buffer[ 4 ][ 4 ]; + +extern rtems_multiprocessing_table Multiprocessing_configuration; + +TEST_EXTERN volatile rtems_boolean Stop_Test; +TEST_EXTERN rtems_id timer_id; + +#define EVENT_TASK_DOT_COUNT 100 +#define EVENT_SEND_DOT_COUNT 100 +#define DELAYED_EVENT_DOT_COUNT 1000 +#define MESSAGE_DOT_COUNT 200 +#define PARTITION_DOT_COUNT 200 +#define SEMAPHORE_DOT_COUNT 200 /* end of include file */ diff --git a/c/src/tests/samples/base_mp/init.c b/c/src/tests/samples/base_mp/init.c index a844d9032b..26c37ec849 100644 --- a/c/src/tests/samples/base_mp/init.c +++ b/c/src/tests/samples/base_mp/init.c @@ -21,12 +21,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "shm.h" -#include "conftbl.h" -#include "gvar.h" rtems_task Init( rtems_task_argument argument @@ -41,6 +37,10 @@ rtems_task Init( task_name = rtems_build_name( 'T', 'A', '1', ' ' ); status = rtems_task_create( task_name, 1, 1024, RTEMS_INTERRUPT_LEVEL(0), RTEMS_DEFAULT_ATTRIBUTES, &tid ); - status = rtems_task_start( tid, Application_task, Mp_conf_addr.node ); + status = rtems_task_start( + tid, + Application_task, + Multiprocessing_configuration.node + ); status = rtems_task_delete( RTEMS_SELF ); } diff --git a/c/src/tests/samples/base_mp/system.h b/c/src/tests/samples/base_mp/system.h index 38b20afb5c..ec07193b72 100644 --- a/c/src/tests/samples/base_mp/system.h +++ b/c/src/tests/samples/base_mp/system.h @@ -14,19 +14,33 @@ * $Id$ */ -#include <rtems.h> -#include <bsp.h> -#include <stdio.h> -#include <libcsupport.h> +#include <tmacros.h> -/* Miscellaneous */ +/* functions */ -#define EXTERN extern /* external definition */ +rtems_task Init( + rtems_task_argument argument +); -/* macros */ +rtems_task Application_task( + rtems_task_argument argument +); -/* structures */ +/* configuration information */ + +#define CONFIGURE_MPTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER + +/* + * Put the overrides of default configuration parameters here. + */ + +#include <confdefs.h> -#include "gvar.h" +/* variables */ +TEST_EXTERN rtems_id Global_variable; /* example global variable */ + /* end of include file */ diff --git a/c/src/tests/samples/base_sp/init.c b/c/src/tests/samples/base_sp/init.c index 8c5a533074..d26787260c 100644 --- a/c/src/tests/samples/base_sp/init.c +++ b/c/src/tests/samples/base_sp/init.c @@ -21,11 +21,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" #define ARGUMENT 0 diff --git a/c/src/tests/samples/base_sp/system.h b/c/src/tests/samples/base_sp/system.h index 50d23b1476..172ced543d 100644 --- a/c/src/tests/samples/base_sp/system.h +++ b/c/src/tests/samples/base_sp/system.h @@ -11,21 +11,32 @@ * to the copyright license under the clause at DFARS 252.227-7013. This * notice must appear in all copies of this file and its derivatives. * - * system.h,v 1.2 1995/05/31 17:05:38 joel Exp + * $Id$ */ -#include <rtems.h> -#include <bsp.h> -#include <stdio.h> +#include <tmacros.h> -/* Miscellaneous */ +/* functions */ -#define EXTERN extern /* external definition */ +rtems_task Init( + rtems_task_argument argument +); -/* macros */ +rtems_task Application_task( + rtems_task_argument argument +); -/* structures */ +/* configuration information */ -#include "gvar.h" +#define CONFIGURE_SPTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER + +#include <confdefs.h> + +/* global variables */ + +TEST_EXTERN rtems_id Global_variable; /* example global variable */ /* end of include file */ diff --git a/c/src/tests/samples/cdtest/init.c b/c/src/tests/samples/cdtest/init.c index 00bdd647ba..6f3736550c 100644 --- a/c/src/tests/samples/cdtest/init.c +++ b/c/src/tests/samples/cdtest/init.c @@ -21,9 +21,6 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" #include <stdio.h> diff --git a/c/src/tests/samples/cdtest/system.h b/c/src/tests/samples/cdtest/system.h index 11e00f018a..2400478ed9 100644 --- a/c/src/tests/samples/cdtest/system.h +++ b/c/src/tests/samples/cdtest/system.h @@ -14,18 +14,28 @@ * $Id$ */ -#include <rtems.h> -#include <bsp.h> -#include <stdio.h> +#include <tmacros.h> -/* Miscellaneous */ +/* functions */ -#define EXTERN extern /* external definition */ +rtems_task main_task( + rtems_task_argument argument +); -/* macros */ +/* configuration information */ -/* structures */ +#define CONFIGURE_SPTEST -#include "gvar.h" +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER +#define CONFIGURE_INIT_TASK_ENTRY_POINT main_task +#define CONFIGURE_INIT_TASK_NAME rtems_build_name( 'C', 'T', 'O', 'R' ) + +#include <confdefs.h> + +/* global variables */ + +TEST_EXTERN rtems_id Global_variable; /* example global variable */ + /* end of include file */ diff --git a/c/src/tests/samples/hello/init.c b/c/src/tests/samples/hello/init.c index 9c56c4edda..c1c25bf045 100644 --- a/c/src/tests/samples/hello/init.c +++ b/c/src/tests/samples/hello/init.c @@ -21,11 +21,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" #include <stdio.h> rtems_task Init( diff --git a/c/src/tests/samples/hello/system.h b/c/src/tests/samples/hello/system.h index 49deb52d4a..8af4376e0f 100644 --- a/c/src/tests/samples/hello/system.h +++ b/c/src/tests/samples/hello/system.h @@ -14,19 +14,22 @@ * $Id$ */ -#include <rtems.h> -#include <bsp.h> +#include <tmacros.h> -#include <stdio.h> +/* functions */ -/* Miscellaneous */ +rtems_task Init( + rtems_task_argument argument +); -#define EXTERN extern /* external definition */ +/* configuration information */ -/* macros */ +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER -/* structures */ +#include <confdefs.h> -#include "gvar.h" +/* global variables */ + +TEST_EXTERN rtems_id Global_variable; /* example global variable */ /* end of include file */ diff --git a/c/src/tests/samples/paranoia/init.c b/c/src/tests/samples/paranoia/init.c index 947fdfd28f..9c54e0d416 100644 --- a/c/src/tests/samples/paranoia/init.c +++ b/c/src/tests/samples/paranoia/init.c @@ -21,11 +21,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" extern int paranoia(int, char **); diff --git a/c/src/tests/samples/paranoia/system.h b/c/src/tests/samples/paranoia/system.h index 11e00f018a..5e1b2d2b88 100644 --- a/c/src/tests/samples/paranoia/system.h +++ b/c/src/tests/samples/paranoia/system.h @@ -14,18 +14,23 @@ * $Id$ */ -#include <rtems.h> -#include <bsp.h> -#include <stdio.h> +#include <tmacros.h> -/* Miscellaneous */ +/* functions */ -#define EXTERN extern /* external definition */ +rtems_task Init( + rtems_task_argument argument +); -/* macros */ +/* configuration information */ -/* structures */ +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER -#include "gvar.h" +#include <confdefs.h> + +/* global variables */ + +TEST_EXTERN rtems_id Global_variable; /* example global variable */ /* end of include file */ diff --git a/c/src/tests/samples/ticker/init.c b/c/src/tests/samples/ticker/init.c index 3caa16ecd7..c023a25801 100644 --- a/c/src/tests/samples/ticker/init.c +++ b/c/src/tests/samples/ticker/init.c @@ -21,11 +21,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_task Init( rtems_task_argument argument diff --git a/c/src/tests/samples/ticker/system.h b/c/src/tests/samples/ticker/system.h index 0bf193dad9..51a9c082df 100644 --- a/c/src/tests/samples/ticker/system.h +++ b/c/src/tests/samples/ticker/system.h @@ -16,14 +16,28 @@ #include <tmacros.h> -/* Miscellaneous */ +/* functions */ -#define EXTERN extern /* external definition */ +rtems_task Init( + rtems_task_argument argument +); -/* macros */ +rtems_task Test_task( + rtems_task_argument argument +); -/* structures */ +/* configuration information */ -#include "gvar.h" +#define CONFIGURE_SPTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER + +#include <confdefs.h> + +/* global variables */ + +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ /* end of include file */ diff --git a/c/src/tests/sptests/sp01/init.c b/c/src/tests/sptests/sp01/init.c index 82ffd0015c..6823108bea 100644 --- a/c/src/tests/sptests/sp01/init.c +++ b/c/src/tests/sptests/sp01/init.c @@ -22,11 +22,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_task Init( rtems_task_argument argument diff --git a/c/src/tests/sptests/sp01/system.h b/c/src/tests/sptests/sp01/system.h index 0bf193dad9..08e71c4bb8 100644 --- a/c/src/tests/sptests/sp01/system.h +++ b/c/src/tests/sptests/sp01/system.h @@ -16,14 +16,28 @@ #include <tmacros.h> -/* Miscellaneous */ +/* functions */ -#define EXTERN extern /* external definition */ +rtems_task Init( + rtems_task_argument argument +); -/* macros */ +rtems_task Task_1_through_3( + rtems_task_argument argument +); -/* structures */ +/* configuration information */ -#include "gvar.h" +#define CONFIGURE_SPTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER + +#include <confdefs.h> + +/* global variables */ + +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ /* end of include file */ diff --git a/c/src/tests/sptests/sp02/init.c b/c/src/tests/sptests/sp02/init.c index b3ada92914..6571eb275a 100644 --- a/c/src/tests/sptests/sp02/init.c +++ b/c/src/tests/sptests/sp02/init.c @@ -19,14 +19,11 @@ * to the copyright license under the clause at DFARS 252.227-7013. This * notice must appear in all copies of this file and its derivatives. * - * $Id$ + * init.c,v 1.2 1995/05/31 17:06:49 joel Exp */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_task Init( rtems_task_argument argument diff --git a/c/src/tests/sptests/sp02/preempt.c b/c/src/tests/sptests/sp02/preempt.c index 7e93f7af57..5856bdd0c0 100644 --- a/c/src/tests/sptests/sp02/preempt.c +++ b/c/src/tests/sptests/sp02/preempt.c @@ -15,7 +15,7 @@ * to the copyright license under the clause at DFARS 252.227-7013. This * notice must appear in all copies of this file and its derivatives. * - * $Id$ + * preempt.c,v 1.2 1995/05/31 17:06:51 joel Exp */ #include "system.h" diff --git a/c/src/tests/sptests/sp02/system.h b/c/src/tests/sptests/sp02/system.h index 9bb3a13c81..95cae6c0e2 100644 --- a/c/src/tests/sptests/sp02/system.h +++ b/c/src/tests/sptests/sp02/system.h @@ -16,15 +16,43 @@ #include <tmacros.h> -/* Miscellaneous */ +/* functions */ -#define EXTERN extern /* external definition */ +rtems_task Init( + rtems_task_argument argument +); -/* macros */ +rtems_task Preempt_task( + rtems_task_argument argument +); +rtems_task Task_1( + rtems_task_argument argument +); -/* structures */ +rtems_task Task_2( + rtems_task_argument argument +); -#include "gvar.h" +rtems_task Task_3( + rtems_task_argument argument +); + +/* configuration information */ + +#define CONFIGURE_SPTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER + +#include <confdefs.h> + +/* global variables */ + +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ + +TEST_EXTERN rtems_id Preempt_task_id; /* preempt task id */ +TEST_EXTERN rtems_name Preempt_task_name; /* preempt task name */ /* end of include file */ diff --git a/c/src/tests/sptests/sp02/task1.c b/c/src/tests/sptests/sp02/task1.c index 0f6152dbb2..ef83177b84 100644 --- a/c/src/tests/sptests/sp02/task1.c +++ b/c/src/tests/sptests/sp02/task1.c @@ -15,7 +15,7 @@ * to the copyright license under the clause at DFARS 252.227-7013. This * notice must appear in all copies of this file and its derivatives. * - * $Id$ + * task1.c,v 1.2 1995/05/31 17:06:56 joel Exp */ #include "system.h" diff --git a/c/src/tests/sptests/sp02/task2.c b/c/src/tests/sptests/sp02/task2.c index f39cc5b9fc..7486d6b737 100644 --- a/c/src/tests/sptests/sp02/task2.c +++ b/c/src/tests/sptests/sp02/task2.c @@ -17,7 +17,7 @@ * to the copyright license under the clause at DFARS 252.227-7013. This * notice must appear in all copies of this file and its derivatives. * - * $Id$ + * task2.c,v 1.2 1995/05/31 17:06:58 joel Exp */ #include "system.h" diff --git a/c/src/tests/sptests/sp02/task3.c b/c/src/tests/sptests/sp02/task3.c index 89bda38b7c..ee67ab5705 100644 --- a/c/src/tests/sptests/sp02/task3.c +++ b/c/src/tests/sptests/sp02/task3.c @@ -16,7 +16,7 @@ * to the copyright license under the clause at DFARS 252.227-7013. This * notice must appear in all copies of this file and its derivatives. * - * $Id$ + * task3.c,v 1.2 1995/05/31 17:07:00 joel Exp */ #include "system.h" diff --git a/c/src/tests/sptests/sp03/init.c b/c/src/tests/sptests/sp03/init.c index 962d434284..733a9c4ad4 100644 --- a/c/src/tests/sptests/sp03/init.c +++ b/c/src/tests/sptests/sp03/init.c @@ -22,11 +22,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_task Init( rtems_task_argument argument diff --git a/c/src/tests/sptests/sp03/system.h b/c/src/tests/sptests/sp03/system.h index 0bf193dad9..d83cb3f510 100644 --- a/c/src/tests/sptests/sp03/system.h +++ b/c/src/tests/sptests/sp03/system.h @@ -16,14 +16,32 @@ #include <tmacros.h> -/* Miscellaneous */ +/* functions */ -#define EXTERN extern /* external definition */ +rtems_task Init( + rtems_task_argument argument +); -/* macros */ +rtems_task Task_1( + rtems_task_argument argument +); + +rtems_task Task_2( + rtems_task_argument argument +); -/* structures */ +/* configuration information */ -#include "gvar.h" +#define CONFIGURE_SPTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER + +#include <confdefs.h> + +/* global variables */ + +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ /* end of include file */ diff --git a/c/src/tests/sptests/sp04/init.c b/c/src/tests/sptests/sp04/init.c index b9fd541103..0bec318a88 100644 --- a/c/src/tests/sptests/sp04/init.c +++ b/c/src/tests/sptests/sp04/init.c @@ -22,11 +22,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_extensions_table Extensions = { NULL, /* task create user extension */ @@ -34,6 +31,7 @@ rtems_extensions_table Extensions = { NULL, /* task restart user extension */ NULL, /* task delete user extension */ Task_switch, /* task switch user extension */ + NULL, /* task post switch user extension */ NULL, /* task begin user extension */ NULL, /* task exitted user extension */ NULL /* fatal error user extension */ diff --git a/c/src/tests/sptests/sp04/system.h b/c/src/tests/sptests/sp04/system.h index 0bf193dad9..27e716a701 100644 --- a/c/src/tests/sptests/sp04/system.h +++ b/c/src/tests/sptests/sp04/system.h @@ -16,14 +16,50 @@ #include <tmacros.h> -/* Miscellaneous */ +/* functions */ -#define EXTERN extern /* external definition */ +rtems_task Init( + rtems_task_argument argument +); -/* macros */ +rtems_task Task_1( + rtems_task_argument argument +); + +rtems_task Task_2( + rtems_task_argument argument +); + +rtems_task Task_3( + rtems_task_argument argument +); + +void Task_switch( + rtems_tcb *unused, + rtems_tcb *heir +); -/* structures */ +/* configuration information */ -#include "gvar.h" +#define CONFIGURE_SPTEST +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1 +#define CONFIGURE_TICKS_PER_TIMESLICE 100 + +#include <confdefs.h> + +/* global variables */ + +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ + +TEST_EXTERN rtems_id Extension_id[ 4 ]; +TEST_EXTERN rtems_name Extension_name[ 4 ]; /* array of task names */ + +/* array of task run counts */ +TEST_EXTERN volatile rtems_unsigned32 Run_count[ 4 ]; + /* end of include file */ diff --git a/c/src/tests/sptests/sp05/init.c b/c/src/tests/sptests/sp05/init.c index 2f6b8a6eac..78a7ba5030 100644 --- a/c/src/tests/sptests/sp05/init.c +++ b/c/src/tests/sptests/sp05/init.c @@ -22,11 +22,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_task Init( rtems_task_argument argument diff --git a/c/src/tests/sptests/sp05/system.h b/c/src/tests/sptests/sp05/system.h index 0bf193dad9..8f8cd58a30 100644 --- a/c/src/tests/sptests/sp05/system.h +++ b/c/src/tests/sptests/sp05/system.h @@ -16,14 +16,38 @@ #include <tmacros.h> -/* Miscellaneous */ +/* functions */ -#define EXTERN extern /* external definition */ +rtems_task Init( + rtems_task_argument argument +); -/* macros */ +rtems_task Task_1( + rtems_task_argument argument +); + +rtems_task Task_2( + rtems_task_argument argument +); + +rtems_task Task_3( + rtems_task_argument argument +); + +/* configuration information */ -/* structures */ +#define CONFIGURE_SPTEST -#include "gvar.h" +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_TICKS_PER_TIMESLICE 100 + +#include <confdefs.h> + +/* global variables */ + +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ /* end of include file */ diff --git a/c/src/tests/sptests/sp06/init.c b/c/src/tests/sptests/sp06/init.c index 08bab06594..70d5284651 100644 --- a/c/src/tests/sptests/sp06/init.c +++ b/c/src/tests/sptests/sp06/init.c @@ -22,11 +22,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_task Init( rtems_task_argument argument diff --git a/c/src/tests/sptests/sp06/system.h b/c/src/tests/sptests/sp06/system.h index 0bf193dad9..aa75d36f06 100644 --- a/c/src/tests/sptests/sp06/system.h +++ b/c/src/tests/sptests/sp06/system.h @@ -16,14 +16,41 @@ #include <tmacros.h> -/* Miscellaneous */ +/* functions */ -#define EXTERN extern /* external definition */ +rtems_task Init( + rtems_task_argument argument +); -/* macros */ +rtems_task Task_1( + rtems_task_argument argument +); + +rtems_task Task_2( + rtems_task_argument argument +); + +rtems_task Task_3( + rtems_task_argument argument +); + +/* configuration information */ -/* structures */ +#define CONFIGURE_SPTEST -#include "gvar.h" +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_TICKS_PER_TIMESLICE 100 + +#include <confdefs.h> + +/* global variables */ + +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ + +TEST_EXTERN rtems_task_argument Argument; /* generic task argument */ +TEST_EXTERN rtems_task_argument Restart_argument; /* task 1 restart argument */ /* end of include file */ diff --git a/c/src/tests/sptests/sp07/init.c b/c/src/tests/sptests/sp07/init.c index f5d00eae8e..3eb37a4fe3 100644 --- a/c/src/tests/sptests/sp07/init.c +++ b/c/src/tests/sptests/sp07/init.c @@ -22,11 +22,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_extensions_table Extensions = { Task_create_extension, /* task create user extension */ @@ -34,6 +31,7 @@ rtems_extensions_table Extensions = { Task_restart_extension, /* task restart user extension */ Task_delete_extension, /* task delete user extension */ NULL, /* task switch user extension */ + NULL, /* task post switch user extension */ NULL, /* begin user extension */ Task_exit_extension, /* task exitted user extension */ NULL /* fatal error extension */ diff --git a/c/src/tests/sptests/sp07/system.h b/c/src/tests/sptests/sp07/system.h index c9246a0c07..3bd1ee69b5 100644 --- a/c/src/tests/sptests/sp07/system.h +++ b/c/src/tests/sptests/sp07/system.h @@ -16,19 +16,70 @@ #include <tmacros.h> -/* constants */ +/* functions */ -#define SI_NAME 0x53595349 /* name - "SYSI" */ -#define I_NAME 0x49444c45 /* name - "IDLE" */ +rtems_task Init( + rtems_task_argument argument +); -/* Miscellaneous */ +rtems_task Task_1( + rtems_task_argument argument +); + +rtems_task Task_2( + rtems_task_argument argument +); + +rtems_task Task_3( + rtems_task_argument argument +); + +rtems_task Task_4( + rtems_task_argument argument +); + +rtems_boolean Task_create_extension( + rtems_tcb *unused, + rtems_tcb *created_task +); + +rtems_extension Task_delete_extension( + rtems_tcb *running_task, + rtems_tcb *deleted_task +); + +rtems_extension Task_restart_extension( + rtems_tcb *unused, + rtems_tcb *restarted_task +); + +rtems_extension Task_start_extension( + rtems_tcb *unused, + rtems_tcb *started_task +); + +rtems_extension Task_exit_extension( + rtems_tcb *running_task +); -#define EXTERN extern /* external definition */ +/* configuration information */ -/* macros */ +#define CONFIGURE_SPTEST -/* structures */ +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER -#include "gvar.h" +#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1 +#define CONFIGURE_TICKS_PER_TIMESLICE 100 +#include <confdefs.h> + +/* global variables */ + +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ + +TEST_EXTERN rtems_id Extension_id[ 4 ]; +TEST_EXTERN rtems_name Extension_name[ 4 ]; /* array of task names */ + /* end of include file */ diff --git a/c/src/tests/sptests/sp07/tcreate.c b/c/src/tests/sptests/sp07/tcreate.c index 7b066630f0..aff47ed191 100644 --- a/c/src/tests/sptests/sp07/tcreate.c +++ b/c/src/tests/sptests/sp07/tcreate.c @@ -21,7 +21,7 @@ #include "system.h" -rtems_extension Task_create_extension( +rtems_boolean Task_create_extension( rtems_tcb *unused, rtems_tcb *created_task ) @@ -31,4 +31,5 @@ rtems_extension Task_create_extension( put_name( Task_name[ task_number( created_task->Object.id ) ], FALSE ); puts( " - created." ); } + return TRUE; } diff --git a/c/src/tests/sptests/sp08/init.c b/c/src/tests/sptests/sp08/init.c index e3020035ce..65b6f82bdf 100644 --- a/c/src/tests/sptests/sp08/init.c +++ b/c/src/tests/sptests/sp08/init.c @@ -22,11 +22,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_task Init( rtems_task_argument argument diff --git a/c/src/tests/sptests/sp08/system.h b/c/src/tests/sptests/sp08/system.h index bbc6669a61..85cb0c7dcd 100644 --- a/c/src/tests/sptests/sp08/system.h +++ b/c/src/tests/sptests/sp08/system.h @@ -16,17 +16,33 @@ #include <tmacros.h> -/* Miscellaneous */ +/* functions */ -#define EXTERN extern /* external definition */ - -/* macros */ +rtems_task Init( + rtems_task_argument argument +); +rtems_task Task_1( + rtems_task_argument argument +); + #define put_mode( _comment, _output_mode ) \ printf( "%s %08x\n", _comment, _output_mode ); -/* structures */ +/* configuration information */ + +#define CONFIGURE_SPTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_TICKS_PER_TIMESLICE 100 + +#include <confdefs.h> + +/* global variables */ -#include "gvar.h" +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ /* end of include file */ diff --git a/c/src/tests/sptests/sp09/init.c b/c/src/tests/sptests/sp09/init.c index 3ca4b62404..de01d2d657 100644 --- a/c/src/tests/sptests/sp09/init.c +++ b/c/src/tests/sptests/sp09/init.c @@ -22,11 +22,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_task Init( rtems_task_argument argument diff --git a/c/src/tests/sptests/sp09/system.h b/c/src/tests/sptests/sp09/system.h index 0bf193dad9..f688cf729a 100644 --- a/c/src/tests/sptests/sp09/system.h +++ b/c/src/tests/sptests/sp09/system.h @@ -16,14 +16,124 @@ #include <tmacros.h> -/* Miscellaneous */ +/* functions */ -#define EXTERN extern /* external definition */ +rtems_task Init( + rtems_task_argument argument +); -/* macros */ +rtems_timer_service_routine Delayed_routine( + rtems_id ignored_id, + void *ignored_address +); -/* structures */ +rtems_task Task_1( + rtems_task_argument argument +); -#include "gvar.h" +rtems_task Task_2( + rtems_task_argument argument +); + +rtems_task Task_3( + rtems_task_argument argument +); + +rtems_task Task_4( + rtems_task_argument argument +); + +rtems_isr Service_routine( + rtems_vector_number ignored +); + +rtems_timer_service_routine Io_during_interrupt( + rtems_id ignored +); + +void Screen1( void ); + +void Screen2( void ); + +void Screen3( void ); + +void Screen4( void ); + +void Screen5( void ); + +void Screen6( void ); + +void Screen7( void ); + +void Screen8( void ); + +void Screen9( void ); + +void Screen10( void ); + +void Screen11( void ); + +void Screen12( void ); + +void Screen13( void ); + +void Screen14( void ); + +/* configuration information */ + +#define CONFIGURE_SPTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_MAXIMUM_TIMERS 1 +#define CONFIGURE_MAXIMUM_SEMAPHORES 2 +#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 +#define CONFIGURE_MAXIMUM_PARTITIONS 1 +#define CONFIGURE_MAXIMUM_REGIONS 1 +#define CONFIGURE_MAXIMUM_PERIODS 1 +#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 0 +#define CONFIGURE_TICKS_PER_TIMESLICE 100 + +#include <confdefs.h> + +/* global variables */ + +TEST_EXTERN rtems_id Task_id[ 11 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 11 ]; /* array of task names */ + +TEST_EXTERN rtems_name Timer_name[ 2 ]; /* array of timer names */ +TEST_EXTERN rtems_id Timer_id[ 2 ]; /* array of timer ids */ + +TEST_EXTERN rtems_name Semaphore_name[ 4 ]; /* array of semaphore names */ +TEST_EXTERN rtems_id Semaphore_id[ 4 ]; /* array of semaphore ids */ + +TEST_EXTERN rtems_name Queue_name[ 3 ]; /* array of queue names */ +TEST_EXTERN rtems_id Queue_id[ 3 ]; /* array of queue ids */ + +TEST_EXTERN rtems_name Partition_name[ 2 ]; /* array of partition names */ +TEST_EXTERN rtems_id Partition_id[ 2 ]; /* array of partition ids */ + +TEST_EXTERN rtems_name Region_name[ 2 ]; /* array of region names */ +TEST_EXTERN rtems_id Region_id[ 2 ]; /* array of region ids */ + +TEST_EXTERN rtems_name Port_name[ 2 ]; /* array of port names */ +TEST_EXTERN rtems_id Port_id[ 2 ]; /* array of port ids */ + +TEST_EXTERN rtems_name Period_name[ 2 ]; /* array of period names */ +TEST_EXTERN rtems_id Period_id[ 2 ]; /* array of period ids */ + +TEST_EXTERN rtems_id Junk_id; /* id used to return errors */ + +#define Internal_port_area (void *) 0x00001000 +#define External_port_area (void *) 0x00002000 + +TEST_EXTERN rtems_unsigned8 Partition_good_area[256] CPU_STRUCTURE_ALIGNMENT; +#define Partition_bad_area (void *) 0x00000006 + +TEST_EXTERN rtems_unsigned32 Region_good_area[4096] CPU_STRUCTURE_ALIGNMENT; +#define Region_bad_area (void *) 0x00000006 +#define REGION_START_OFFSET 1024 +#define REGION_LENGTH 512 /* end of include file */ diff --git a/c/src/tests/sptests/sp11/init.c b/c/src/tests/sptests/sp11/init.c index 99ef1d55a0..c79a42fb4e 100644 --- a/c/src/tests/sptests/sp11/init.c +++ b/c/src/tests/sptests/sp11/init.c @@ -22,11 +22,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_task Init( rtems_task_argument argument diff --git a/c/src/tests/sptests/sp11/system.h b/c/src/tests/sptests/sp11/system.h index 0bf193dad9..983ed077b5 100644 --- a/c/src/tests/sptests/sp11/system.h +++ b/c/src/tests/sptests/sp11/system.h @@ -16,14 +16,73 @@ #include <tmacros.h> -/* Miscellaneous */ +/* functions */ -#define EXTERN extern /* external definition */ +rtems_task Init( + rtems_task_argument argument +); + +rtems_task Task_1( + rtems_task_argument argument +); + +rtems_task Task_2( + rtems_task_argument argument +); + +rtems_timer_service_routine TA1_send_18_to_self_5_seconds( + rtems_id ignored_id, + void *ignored_address +); + +rtems_timer_service_routine TA1_send_8_to_self_60_seconds( + rtems_id ignored_id, + void *ignored_address +); + +rtems_timer_service_routine TA1_send_9_to_self_60_seconds( + rtems_id ignored_id, + void *ignored_address +); + +rtems_timer_service_routine TA1_send_10_to_self( + rtems_id ignored_id, + void *ignored_address +); + +rtems_timer_service_routine TA1_send_1_to_self_every_second( + rtems_id ignored_id, + void *ignored_address +); + +rtems_timer_service_routine TA1_send_11_to_self( + rtems_id ignored_id, + void *ignored_address +); + +rtems_timer_service_routine TA2_send_10_to_self( + rtems_id ignored_id, + void *ignored_address +); -/* macros */ +/* configuration information */ -/* structures */ +#define CONFIGURE_SPTEST -#include "gvar.h" +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_MAXIMUM_TIMERS 6 +#define CONFIGURE_TICKS_PER_TIMESLICE 100 + +#include <confdefs.h> + +/* global variables */ + +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ + +TEST_EXTERN rtems_id Timer_id[ 7 ]; /* array of timer ids */ +TEST_EXTERN rtems_name Timer_name[ 7 ]; /* array of timer names */ /* end of include file */ diff --git a/c/src/tests/sptests/sp12/init.c b/c/src/tests/sptests/sp12/init.c index 3bbd0ef1c6..159ef815da 100644 --- a/c/src/tests/sptests/sp12/init.c +++ b/c/src/tests/sptests/sp12/init.c @@ -22,11 +22,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_task Init( rtems_task_argument argument diff --git a/c/src/tests/sptests/sp12/sp12.scn b/c/src/tests/sptests/sp12/sp12.scn index 3f1bd26b6d..ff120e7545 100644 --- a/c/src/tests/sptests/sp12/sp12.scn +++ b/c/src/tests/sptests/sp12/sp12.scn @@ -35,7 +35,7 @@ PRI5 - rtems_semaphore_release - nested PRI5 - rtems_semaphore_release - restore priority PRI5 - priority of PRI5 is 68 <pause> -TA1 - rtems_semaphore_ident - smid => 10010001 +TA1 - rtems_semaphore_ident - smid => 10010002 TA1 - rtems_semaphore_obtain - wait forever on SM2 TA1 - got SM2 TA1 - rtems_semaphore_obtain - wait forever on SM3 diff --git a/c/src/tests/sptests/sp12/system.h b/c/src/tests/sptests/sp12/system.h index 0bf193dad9..3c126963b6 100644 --- a/c/src/tests/sptests/sp12/system.h +++ b/c/src/tests/sptests/sp12/system.h @@ -16,14 +16,64 @@ #include <tmacros.h> -/* Miscellaneous */ +/* functions */ -#define EXTERN extern /* external definition */ +rtems_task Init( + rtems_task_argument argument +); + +void Priority_test_driver( + rtems_unsigned32 priority_base +); + +rtems_task Priority_task( + rtems_task_argument its_index +); + +rtems_task Task_1( + rtems_task_argument argument +); + +rtems_task Task_2( + rtems_task_argument argument +); + +rtems_task Task_3( + rtems_task_argument argument +); + +rtems_task Task_4( + rtems_task_argument argument +); + +rtems_task Task5( + rtems_task_argument argument +); -/* macros */ +/* configuration information */ -/* structures */ +#define CONFIGURE_SPTEST -#include "gvar.h" +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_MAXIMUM_SEMAPHORES 10 +#define CONFIGURE_TICKS_PER_TIMESLICE 100 + +#include <confdefs.h> + +/* global variables */ + + +TEST_EXTERN rtems_id Task_id[ 6 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 6 ]; /* array of task names */ + +TEST_EXTERN rtems_id Priority_task_id[ 6 ]; /* array of task ids */ +TEST_EXTERN rtems_name Priority_task_name[ 6 ]; /* array of task names */ + +TEST_EXTERN rtems_task_priority Task_priority[ 6 ]; + +TEST_EXTERN rtems_id Semaphore_id[ 4 ]; /* array of semaphore ids */ +TEST_EXTERN rtems_name Semaphore_name[ 4 ]; /* array of semaphore names */ /* end of include file */ diff --git a/c/src/tests/sptests/sp13/init.c b/c/src/tests/sptests/sp13/init.c index 30834550d0..178e534e11 100644 --- a/c/src/tests/sptests/sp13/init.c +++ b/c/src/tests/sptests/sp13/init.c @@ -22,11 +22,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_task Init( rtems_task_argument argument diff --git a/c/src/tests/sptests/sp13/sp13.scn b/c/src/tests/sptests/sp13/sp13.scn index 58eb37d4a9..0cd60c9f1d 100644 --- a/c/src/tests/sptests/sp13/sp13.scn +++ b/c/src/tests/sptests/sp13/sp13.scn @@ -68,1035 +68,5 @@ TA1 - create message queue of 20 bytes on queue 1 TA1 - rtems_message_queue_delete - delete queue 1 <pause> TA1 - rtems_message_queue_create - variable sizes -<pause> TA1 - rtems_message_queue_create and send - variable sizes -TA1 - message queue size: 1 -TA1 - message queue size: 2 -TA1 - message queue size: 3 -TA1 - message queue size: 4 -TA1 - message queue size: 5 -TA1 - message queue size: 6 -TA1 - message queue size: 7 -TA1 - message queue size: 8 -TA1 - message queue size: 9 -TA1 - message queue size: 10 -TA1 - message queue size: 11 -TA1 - message queue size: 12 -TA1 - message queue size: 13 -TA1 - message queue size: 14 -TA1 - message queue size: 15 -TA1 - message queue size: 16 -TA1 - message queue size: 17 -TA1 - message queue size: 18 -TA1 - message queue size: 19 -TA1 - message queue size: 20 -TA1 - message queue size: 21 -TA1 - message queue size: 22 -TA1 - message queue size: 23 -TA1 - message queue size: 24 -TA1 - message queue size: 25 -TA1 - message queue size: 26 -TA1 - message queue size: 27 -TA1 - message queue size: 28 -TA1 - message queue size: 29 -TA1 - message queue size: 30 -TA1 - message queue size: 31 -TA1 - message queue size: 32 -TA1 - message queue size: 33 -TA1 - message queue size: 34 -TA1 - message queue size: 35 -TA1 - message queue size: 36 -TA1 - message queue size: 37 -TA1 - message queue size: 38 -TA1 - message queue size: 39 -TA1 - message queue size: 40 -TA1 - message queue size: 41 -TA1 - message queue size: 42 -TA1 - message queue size: 43 -TA1 - message queue size: 44 -TA1 - message queue size: 45 -TA1 - message queue size: 46 -TA1 - message queue size: 47 -TA1 - message queue size: 48 -TA1 - message queue size: 49 -TA1 - message queue size: 50 -TA1 - message queue size: 51 -TA1 - message queue size: 52 -TA1 - message queue size: 53 -TA1 - message queue size: 54 -TA1 - message queue size: 55 -TA1 - message queue size: 56 -TA1 - message queue size: 57 -TA1 - message queue size: 58 -TA1 - message queue size: 59 -TA1 - message queue size: 60 -TA1 - message queue size: 61 -TA1 - message queue size: 62 -TA1 - message queue size: 63 -TA1 - message queue size: 64 -TA1 - message queue size: 65 -TA1 - message queue size: 66 -TA1 - message queue size: 67 -TA1 - message queue size: 68 -TA1 - message queue size: 69 -TA1 - message queue size: 70 -TA1 - message queue size: 71 -TA1 - message queue size: 72 -TA1 - message queue size: 73 -TA1 - message queue size: 74 -TA1 - message queue size: 75 -TA1 - message queue size: 76 -TA1 - message queue size: 77 -TA1 - message queue size: 78 -TA1 - message queue size: 79 -TA1 - message queue size: 80 -TA1 - message queue size: 81 -TA1 - message queue size: 82 -TA1 - message queue size: 83 -TA1 - message queue size: 84 -TA1 - message queue size: 85 -TA1 - message queue size: 86 -TA1 - message queue size: 87 -TA1 - message queue size: 88 -TA1 - message queue size: 89 -TA1 - message queue size: 90 -TA1 - message queue size: 91 -TA1 - message queue size: 92 -TA1 - message queue size: 93 -TA1 - message queue size: 94 -TA1 - message queue size: 95 -TA1 - message queue size: 96 -TA1 - message queue size: 97 -TA1 - message queue size: 98 -TA1 - message queue size: 99 -TA1 - message queue size: 100 -TA1 - message queue size: 101 -TA1 - message queue size: 102 -TA1 - message queue size: 103 -TA1 - message queue size: 104 -TA1 - message queue size: 105 -TA1 - message queue size: 106 -TA1 - message queue size: 107 -TA1 - message queue size: 108 -TA1 - message queue size: 109 -TA1 - message queue size: 110 -TA1 - message queue size: 111 -TA1 - message queue size: 112 -TA1 - message queue size: 113 -TA1 - message queue size: 114 -TA1 - message queue size: 115 -TA1 - message queue size: 116 -TA1 - message queue size: 117 -TA1 - message queue size: 118 -TA1 - message queue size: 119 -TA1 - message queue size: 120 -TA1 - message queue size: 121 -TA1 - message queue size: 122 -TA1 - message queue size: 123 -TA1 - message queue size: 124 -TA1 - message queue size: 125 -TA1 - message queue size: 126 -TA1 - message queue size: 127 -TA1 - message queue size: 128 -TA1 - message queue size: 129 -TA1 - message queue size: 130 -TA1 - message queue size: 131 -TA1 - message queue size: 132 -TA1 - message queue size: 133 -TA1 - message queue size: 134 -TA1 - message queue size: 135 -TA1 - message queue size: 136 -TA1 - message queue size: 137 -TA1 - message queue size: 138 -TA1 - message queue size: 139 -TA1 - message queue size: 140 -TA1 - message queue size: 141 -TA1 - message queue size: 142 -TA1 - message queue size: 143 -TA1 - message queue size: 144 -TA1 - message queue size: 145 -TA1 - message queue size: 146 -TA1 - message queue size: 147 -TA1 - message queue size: 148 -TA1 - message queue size: 149 -TA1 - message queue size: 150 -TA1 - message queue size: 151 -TA1 - message queue size: 152 -TA1 - message queue size: 153 -TA1 - message queue size: 154 -TA1 - message queue size: 155 -TA1 - message queue size: 156 -TA1 - message queue size: 157 -TA1 - message queue size: 158 -TA1 - message queue size: 159 -TA1 - message queue size: 160 -TA1 - message queue size: 161 -TA1 - message queue size: 162 -TA1 - message queue size: 163 -TA1 - message queue size: 164 -TA1 - message queue size: 165 -TA1 - message queue size: 166 -TA1 - message queue size: 167 -TA1 - message queue size: 168 -TA1 - message queue size: 169 -TA1 - message queue size: 170 -TA1 - message queue size: 171 -TA1 - message queue size: 172 -TA1 - message queue size: 173 -TA1 - message queue size: 174 -TA1 - message queue size: 175 -TA1 - message queue size: 176 -TA1 - message queue size: 177 -TA1 - message queue size: 178 -TA1 - message queue size: 179 -TA1 - message queue size: 180 -TA1 - message queue size: 181 -TA1 - message queue size: 182 -TA1 - message queue size: 183 -TA1 - message queue size: 184 -TA1 - message queue size: 185 -TA1 - message queue size: 186 -TA1 - message queue size: 187 -TA1 - message queue size: 188 -TA1 - message queue size: 189 -TA1 - message queue size: 190 -TA1 - message queue size: 191 -TA1 - message queue size: 192 -TA1 - message queue size: 193 -TA1 - message queue size: 194 -TA1 - message queue size: 195 -TA1 - message queue size: 196 -TA1 - message queue size: 197 -TA1 - message queue size: 198 -TA1 - message queue size: 199 -TA1 - message queue size: 200 -TA1 - message queue size: 201 -TA1 - message queue size: 202 -TA1 - message queue size: 203 -TA1 - message queue size: 204 -TA1 - message queue size: 205 -TA1 - message queue size: 206 -TA1 - message queue size: 207 -TA1 - message queue size: 208 -TA1 - message queue size: 209 -TA1 - message queue size: 210 -TA1 - message queue size: 211 -TA1 - message queue size: 212 -TA1 - message queue size: 213 -TA1 - message queue size: 214 -TA1 - message queue size: 215 -TA1 - message queue size: 216 -TA1 - message queue size: 217 -TA1 - message queue size: 218 -TA1 - message queue size: 219 -TA1 - message queue size: 220 -TA1 - message queue size: 221 -TA1 - message queue size: 222 -TA1 - message queue size: 223 -TA1 - message queue size: 224 -TA1 - message queue size: 225 -TA1 - message queue size: 226 -TA1 - message queue size: 227 -TA1 - message queue size: 228 -TA1 - message queue size: 229 -TA1 - message queue size: 230 -TA1 - message queue size: 231 -TA1 - message queue size: 232 -TA1 - message queue size: 233 -TA1 - message queue size: 234 -TA1 - message queue size: 235 -TA1 - message queue size: 236 -TA1 - message queue size: 237 -TA1 - message queue size: 238 -TA1 - message queue size: 239 -TA1 - message queue size: 240 -TA1 - message queue size: 241 -TA1 - message queue size: 242 -TA1 - message queue size: 243 -TA1 - message queue size: 244 -TA1 - message queue size: 245 -TA1 - message queue size: 246 -TA1 - message queue size: 247 -TA1 - message queue size: 248 -TA1 - message queue size: 249 -TA1 - message queue size: 250 -TA1 - message queue size: 251 -TA1 - message queue size: 252 -TA1 - message queue size: 253 -TA1 - message queue size: 254 -TA1 - message queue size: 255 -TA1 - message queue size: 256 -TA1 - message queue size: 257 -TA1 - message queue size: 258 -TA1 - message queue size: 259 -TA1 - message queue size: 260 -TA1 - message queue size: 261 -TA1 - message queue size: 262 -TA1 - message queue size: 263 -TA1 - message queue size: 264 -TA1 - message queue size: 265 -TA1 - message queue size: 266 -TA1 - message queue size: 267 -TA1 - message queue size: 268 -TA1 - message queue size: 269 -TA1 - message queue size: 270 -TA1 - message queue size: 271 -TA1 - message queue size: 272 -TA1 - message queue size: 273 -TA1 - message queue size: 274 -TA1 - message queue size: 275 -TA1 - message queue size: 276 -TA1 - message queue size: 277 -TA1 - message queue size: 278 -TA1 - message queue size: 279 -TA1 - message queue size: 280 -TA1 - message queue size: 281 -TA1 - message queue size: 282 -TA1 - message queue size: 283 -TA1 - message queue size: 284 -TA1 - message queue size: 285 -TA1 - message queue size: 286 -TA1 - message queue size: 287 -TA1 - message queue size: 288 -TA1 - message queue size: 289 -TA1 - message queue size: 290 -TA1 - message queue size: 291 -TA1 - message queue size: 292 -TA1 - message queue size: 293 -TA1 - message queue size: 294 -TA1 - message queue size: 295 -TA1 - message queue size: 296 -TA1 - message queue size: 297 -TA1 - message queue size: 298 -TA1 - message queue size: 299 -TA1 - message queue size: 300 -TA1 - message queue size: 301 -TA1 - message queue size: 302 -TA1 - message queue size: 303 -TA1 - message queue size: 304 -TA1 - message queue size: 305 -TA1 - message queue size: 306 -TA1 - message queue size: 307 -TA1 - message queue size: 308 -TA1 - message queue size: 309 -TA1 - message queue size: 310 -TA1 - message queue size: 311 -TA1 - message queue size: 312 -TA1 - message queue size: 313 -TA1 - message queue size: 314 -TA1 - message queue size: 315 -TA1 - message queue size: 316 -TA1 - message queue size: 317 -TA1 - message queue size: 318 -TA1 - message queue size: 319 -TA1 - message queue size: 320 -TA1 - message queue size: 321 -TA1 - message queue size: 322 -TA1 - message queue size: 323 -TA1 - message queue size: 324 -TA1 - message queue size: 325 -TA1 - message queue size: 326 -TA1 - message queue size: 327 -TA1 - message queue size: 328 -TA1 - message queue size: 329 -TA1 - message queue size: 330 -TA1 - message queue size: 331 -TA1 - message queue size: 332 -TA1 - message queue size: 333 -TA1 - message queue size: 334 -TA1 - message queue size: 335 -TA1 - message queue size: 336 -TA1 - message queue size: 337 -TA1 - message queue size: 338 -TA1 - message queue size: 339 -TA1 - message queue size: 340 -TA1 - message queue size: 341 -TA1 - message queue size: 342 -TA1 - message queue size: 343 -TA1 - message queue size: 344 -TA1 - message queue size: 345 -TA1 - message queue size: 346 -TA1 - message queue size: 347 -TA1 - message queue size: 348 -TA1 - message queue size: 349 -TA1 - message queue size: 350 -TA1 - message queue size: 351 -TA1 - message queue size: 352 -TA1 - message queue size: 353 -TA1 - message queue size: 354 -TA1 - message queue size: 355 -TA1 - message queue size: 356 -TA1 - message queue size: 357 -TA1 - message queue size: 358 -TA1 - message queue size: 359 -TA1 - message queue size: 360 -TA1 - message queue size: 361 -TA1 - message queue size: 362 -TA1 - message queue size: 363 -TA1 - message queue size: 364 -TA1 - message queue size: 365 -TA1 - message queue size: 366 -TA1 - message queue size: 367 -TA1 - message queue size: 368 -TA1 - message queue size: 369 -TA1 - message queue size: 370 -TA1 - message queue size: 371 -TA1 - message queue size: 372 -TA1 - message queue size: 373 -TA1 - message queue size: 374 -TA1 - message queue size: 375 -TA1 - message queue size: 376 -TA1 - message queue size: 377 -TA1 - message queue size: 378 -TA1 - message queue size: 379 -TA1 - message queue size: 380 -TA1 - message queue size: 381 -TA1 - message queue size: 382 -TA1 - message queue size: 383 -TA1 - message queue size: 384 -TA1 - message queue size: 385 -TA1 - message queue size: 386 -TA1 - message queue size: 387 -TA1 - message queue size: 388 -TA1 - message queue size: 389 -TA1 - message queue size: 390 -TA1 - message queue size: 391 -TA1 - message queue size: 392 -TA1 - message queue size: 393 -TA1 - message queue size: 394 -TA1 - message queue size: 395 -TA1 - message queue size: 396 -TA1 - message queue size: 397 -TA1 - message queue size: 398 -TA1 - message queue size: 399 -TA1 - message queue size: 400 -TA1 - message queue size: 401 -TA1 - message queue size: 402 -TA1 - message queue size: 403 -TA1 - message queue size: 404 -TA1 - message queue size: 405 -TA1 - message queue size: 406 -TA1 - message queue size: 407 -TA1 - message queue size: 408 -TA1 - message queue size: 409 -TA1 - message queue size: 410 -TA1 - message queue size: 411 -TA1 - message queue size: 412 -TA1 - message queue size: 413 -TA1 - message queue size: 414 -TA1 - message queue size: 415 -TA1 - message queue size: 416 -TA1 - message queue size: 417 -TA1 - message queue size: 418 -TA1 - message queue size: 419 -TA1 - message queue size: 420 -TA1 - message queue size: 421 -TA1 - message queue size: 422 -TA1 - message queue size: 423 -TA1 - message queue size: 424 -TA1 - message queue size: 425 -TA1 - message queue size: 426 -TA1 - message queue size: 427 -TA1 - message queue size: 428 -TA1 - message queue size: 429 -TA1 - message queue size: 430 -TA1 - message queue size: 431 -TA1 - message queue size: 432 -TA1 - message queue size: 433 -TA1 - message queue size: 434 -TA1 - message queue size: 435 -TA1 - message queue size: 436 -TA1 - message queue size: 437 -TA1 - message queue size: 438 -TA1 - message queue size: 439 -TA1 - message queue size: 440 -TA1 - message queue size: 441 -TA1 - message queue size: 442 -TA1 - message queue size: 443 -TA1 - message queue size: 444 -TA1 - message queue size: 445 -TA1 - message queue size: 446 -TA1 - message queue size: 447 -TA1 - message queue size: 448 -TA1 - message queue size: 449 -TA1 - message queue size: 450 -TA1 - message queue size: 451 -TA1 - message queue size: 452 -TA1 - message queue size: 453 -TA1 - message queue size: 454 -TA1 - message queue size: 455 -TA1 - message queue size: 456 -TA1 - message queue size: 457 -TA1 - message queue size: 458 -TA1 - message queue size: 459 -TA1 - message queue size: 460 -TA1 - message queue size: 461 -TA1 - message queue size: 462 -TA1 - message queue size: 463 -TA1 - message queue size: 464 -TA1 - message queue size: 465 -TA1 - message queue size: 466 -TA1 - message queue size: 467 -TA1 - message queue size: 468 -TA1 - message queue size: 469 -TA1 - message queue size: 470 -TA1 - message queue size: 471 -TA1 - message queue size: 472 -TA1 - message queue size: 473 -TA1 - message queue size: 474 -TA1 - message queue size: 475 -TA1 - message queue size: 476 -TA1 - message queue size: 477 -TA1 - message queue size: 478 -TA1 - message queue size: 479 -TA1 - message queue size: 480 -TA1 - message queue size: 481 -TA1 - message queue size: 482 -TA1 - message queue size: 483 -TA1 - message queue size: 484 -TA1 - message queue size: 485 -TA1 - message queue size: 486 -TA1 - message queue size: 487 -TA1 - message queue size: 488 -TA1 - message queue size: 489 -TA1 - message queue size: 490 -TA1 - message queue size: 491 -TA1 - message queue size: 492 -TA1 - message queue size: 493 -TA1 - message queue size: 494 -TA1 - message queue size: 495 -TA1 - message queue size: 496 -TA1 - message queue size: 497 -TA1 - message queue size: 498 -TA1 - message queue size: 499 -TA1 - message queue size: 500 -TA1 - message queue size: 501 -TA1 - message queue size: 502 -TA1 - message queue size: 503 -TA1 - message queue size: 504 -TA1 - message queue size: 505 -TA1 - message queue size: 506 -TA1 - message queue size: 507 -TA1 - message queue size: 508 -TA1 - message queue size: 509 -TA1 - message queue size: 510 -TA1 - message queue size: 511 -TA1 - message queue size: 512 -TA1 - message queue size: 513 -TA1 - message queue size: 514 -TA1 - message queue size: 515 -TA1 - message queue size: 516 -TA1 - message queue size: 517 -TA1 - message queue size: 518 -TA1 - message queue size: 519 -TA1 - message queue size: 520 -TA1 - message queue size: 521 -TA1 - message queue size: 522 -TA1 - message queue size: 523 -TA1 - message queue size: 524 -TA1 - message queue size: 525 -TA1 - message queue size: 526 -TA1 - message queue size: 527 -TA1 - message queue size: 528 -TA1 - message queue size: 529 -TA1 - message queue size: 530 -TA1 - message queue size: 531 -TA1 - message queue size: 532 -TA1 - message queue size: 533 -TA1 - message queue size: 534 -TA1 - message queue size: 535 -TA1 - message queue size: 536 -TA1 - message queue size: 537 -TA1 - message queue size: 538 -TA1 - message queue size: 539 -TA1 - message queue size: 540 -TA1 - message queue size: 541 -TA1 - message queue size: 542 -TA1 - message queue size: 543 -TA1 - message queue size: 544 -TA1 - message queue size: 545 -TA1 - message queue size: 546 -TA1 - message queue size: 547 -TA1 - message queue size: 548 -TA1 - message queue size: 549 -TA1 - message queue size: 550 -TA1 - message queue size: 551 -TA1 - message queue size: 552 -TA1 - message queue size: 553 -TA1 - message queue size: 554 -TA1 - message queue size: 555 -TA1 - message queue size: 556 -TA1 - message queue size: 557 -TA1 - message queue size: 558 -TA1 - message queue size: 559 -TA1 - message queue size: 560 -TA1 - message queue size: 561 -TA1 - message queue size: 562 -TA1 - message queue size: 563 -TA1 - message queue size: 564 -TA1 - message queue size: 565 -TA1 - message queue size: 566 -TA1 - message queue size: 567 -TA1 - message queue size: 568 -TA1 - message queue size: 569 -TA1 - message queue size: 570 -TA1 - message queue size: 571 -TA1 - message queue size: 572 -TA1 - message queue size: 573 -TA1 - message queue size: 574 -TA1 - message queue size: 575 -TA1 - message queue size: 576 -TA1 - message queue size: 577 -TA1 - message queue size: 578 -TA1 - message queue size: 579 -TA1 - message queue size: 580 -TA1 - message queue size: 581 -TA1 - message queue size: 582 -TA1 - message queue size: 583 -TA1 - message queue size: 584 -TA1 - message queue size: 585 -TA1 - message queue size: 586 -TA1 - message queue size: 587 -TA1 - message queue size: 588 -TA1 - message queue size: 589 -TA1 - message queue size: 590 -TA1 - message queue size: 591 -TA1 - message queue size: 592 -TA1 - message queue size: 593 -TA1 - message queue size: 594 -TA1 - message queue size: 595 -TA1 - message queue size: 596 -TA1 - message queue size: 597 -TA1 - message queue size: 598 -TA1 - message queue size: 599 -TA1 - message queue size: 600 -TA1 - message queue size: 601 -TA1 - message queue size: 602 -TA1 - message queue size: 603 -TA1 - message queue size: 604 -TA1 - message queue size: 605 -TA1 - message queue size: 606 -TA1 - message queue size: 607 -TA1 - message queue size: 608 -TA1 - message queue size: 609 -TA1 - message queue size: 610 -TA1 - message queue size: 611 -TA1 - message queue size: 612 -TA1 - message queue size: 613 -TA1 - message queue size: 614 -TA1 - message queue size: 615 -TA1 - message queue size: 616 -TA1 - message queue size: 617 -TA1 - message queue size: 618 -TA1 - message queue size: 619 -TA1 - message queue size: 620 -TA1 - message queue size: 621 -TA1 - message queue size: 622 -TA1 - message queue size: 623 -TA1 - message queue size: 624 -TA1 - message queue size: 625 -TA1 - message queue size: 626 -TA1 - message queue size: 627 -TA1 - message queue size: 628 -TA1 - message queue size: 629 -TA1 - message queue size: 630 -TA1 - message queue size: 631 -TA1 - message queue size: 632 -TA1 - message queue size: 633 -TA1 - message queue size: 634 -TA1 - message queue size: 635 -TA1 - message queue size: 636 -TA1 - message queue size: 637 -TA1 - message queue size: 638 -TA1 - message queue size: 639 -TA1 - message queue size: 640 -TA1 - message queue size: 641 -TA1 - message queue size: 642 -TA1 - message queue size: 643 -TA1 - message queue size: 644 -TA1 - message queue size: 645 -TA1 - message queue size: 646 -TA1 - message queue size: 647 -TA1 - message queue size: 648 -TA1 - message queue size: 649 -TA1 - message queue size: 650 -TA1 - message queue size: 651 -TA1 - message queue size: 652 -TA1 - message queue size: 653 -TA1 - message queue size: 654 -TA1 - message queue size: 655 -TA1 - message queue size: 656 -TA1 - message queue size: 657 -TA1 - message queue size: 658 -TA1 - message queue size: 659 -TA1 - message queue size: 660 -TA1 - message queue size: 661 -TA1 - message queue size: 662 -TA1 - message queue size: 663 -TA1 - message queue size: 664 -TA1 - message queue size: 665 -TA1 - message queue size: 666 -TA1 - message queue size: 667 -TA1 - message queue size: 668 -TA1 - message queue size: 669 -TA1 - message queue size: 670 -TA1 - message queue size: 671 -TA1 - message queue size: 672 -TA1 - message queue size: 673 -TA1 - message queue size: 674 -TA1 - message queue size: 675 -TA1 - message queue size: 676 -TA1 - message queue size: 677 -TA1 - message queue size: 678 -TA1 - message queue size: 679 -TA1 - message queue size: 680 -TA1 - message queue size: 681 -TA1 - message queue size: 682 -TA1 - message queue size: 683 -TA1 - message queue size: 684 -TA1 - message queue size: 685 -TA1 - message queue size: 686 -TA1 - message queue size: 687 -TA1 - message queue size: 688 -TA1 - message queue size: 689 -TA1 - message queue size: 690 -TA1 - message queue size: 691 -TA1 - message queue size: 692 -TA1 - message queue size: 693 -TA1 - message queue size: 694 -TA1 - message queue size: 695 -TA1 - message queue size: 696 -TA1 - message queue size: 697 -TA1 - message queue size: 698 -TA1 - message queue size: 699 -TA1 - message queue size: 700 -TA1 - message queue size: 701 -TA1 - message queue size: 702 -TA1 - message queue size: 703 -TA1 - message queue size: 704 -TA1 - message queue size: 705 -TA1 - message queue size: 706 -TA1 - message queue size: 707 -TA1 - message queue size: 708 -TA1 - message queue size: 709 -TA1 - message queue size: 710 -TA1 - message queue size: 711 -TA1 - message queue size: 712 -TA1 - message queue size: 713 -TA1 - message queue size: 714 -TA1 - message queue size: 715 -TA1 - message queue size: 716 -TA1 - message queue size: 717 -TA1 - message queue size: 718 -TA1 - message queue size: 719 -TA1 - message queue size: 720 -TA1 - message queue size: 721 -TA1 - message queue size: 722 -TA1 - message queue size: 723 -TA1 - message queue size: 724 -TA1 - message queue size: 725 -TA1 - message queue size: 726 -TA1 - message queue size: 727 -TA1 - message queue size: 728 -TA1 - message queue size: 729 -TA1 - message queue size: 730 -TA1 - message queue size: 731 -TA1 - message queue size: 732 -TA1 - message queue size: 733 -TA1 - message queue size: 734 -TA1 - message queue size: 735 -TA1 - message queue size: 736 -TA1 - message queue size: 737 -TA1 - message queue size: 738 -TA1 - message queue size: 739 -TA1 - message queue size: 740 -TA1 - message queue size: 741 -TA1 - message queue size: 742 -TA1 - message queue size: 743 -TA1 - message queue size: 744 -TA1 - message queue size: 745 -TA1 - message queue size: 746 -TA1 - message queue size: 747 -TA1 - message queue size: 748 -TA1 - message queue size: 749 -TA1 - message queue size: 750 -TA1 - message queue size: 751 -TA1 - message queue size: 752 -TA1 - message queue size: 753 -TA1 - message queue size: 754 -TA1 - message queue size: 755 -TA1 - message queue size: 756 -TA1 - message queue size: 757 -TA1 - message queue size: 758 -TA1 - message queue size: 759 -TA1 - message queue size: 760 -TA1 - message queue size: 761 -TA1 - message queue size: 762 -TA1 - message queue size: 763 -TA1 - message queue size: 764 -TA1 - message queue size: 765 -TA1 - message queue size: 766 -TA1 - message queue size: 767 -TA1 - message queue size: 768 -TA1 - message queue size: 769 -TA1 - message queue size: 770 -TA1 - message queue size: 771 -TA1 - message queue size: 772 -TA1 - message queue size: 773 -TA1 - message queue size: 774 -TA1 - message queue size: 775 -TA1 - message queue size: 776 -TA1 - message queue size: 777 -TA1 - message queue size: 778 -TA1 - message queue size: 779 -TA1 - message queue size: 780 -TA1 - message queue size: 781 -TA1 - message queue size: 782 -TA1 - message queue size: 783 -TA1 - message queue size: 784 -TA1 - message queue size: 785 -TA1 - message queue size: 786 -TA1 - message queue size: 787 -TA1 - message queue size: 788 -TA1 - message queue size: 789 -TA1 - message queue size: 790 -TA1 - message queue size: 791 -TA1 - message queue size: 792 -TA1 - message queue size: 793 -TA1 - message queue size: 794 -TA1 - message queue size: 795 -TA1 - message queue size: 796 -TA1 - message queue size: 797 -TA1 - message queue size: 798 -TA1 - message queue size: 799 -TA1 - message queue size: 800 -TA1 - message queue size: 801 -TA1 - message queue size: 802 -TA1 - message queue size: 803 -TA1 - message queue size: 804 -TA1 - message queue size: 805 -TA1 - message queue size: 806 -TA1 - message queue size: 807 -TA1 - message queue size: 808 -TA1 - message queue size: 809 -TA1 - message queue size: 810 -TA1 - message queue size: 811 -TA1 - message queue size: 812 -TA1 - message queue size: 813 -TA1 - message queue size: 814 -TA1 - message queue size: 815 -TA1 - message queue size: 816 -TA1 - message queue size: 817 -TA1 - message queue size: 818 -TA1 - message queue size: 819 -TA1 - message queue size: 820 -TA1 - message queue size: 821 -TA1 - message queue size: 822 -TA1 - message queue size: 823 -TA1 - message queue size: 824 -TA1 - message queue size: 825 -TA1 - message queue size: 826 -TA1 - message queue size: 827 -TA1 - message queue size: 828 -TA1 - message queue size: 829 -TA1 - message queue size: 830 -TA1 - message queue size: 831 -TA1 - message queue size: 832 -TA1 - message queue size: 833 -TA1 - message queue size: 834 -TA1 - message queue size: 835 -TA1 - message queue size: 836 -TA1 - message queue size: 837 -TA1 - message queue size: 838 -TA1 - message queue size: 839 -TA1 - message queue size: 840 -TA1 - message queue size: 841 -TA1 - message queue size: 842 -TA1 - message queue size: 843 -TA1 - message queue size: 844 -TA1 - message queue size: 845 -TA1 - message queue size: 846 -TA1 - message queue size: 847 -TA1 - message queue size: 848 -TA1 - message queue size: 849 -TA1 - message queue size: 850 -TA1 - message queue size: 851 -TA1 - message queue size: 852 -TA1 - message queue size: 853 -TA1 - message queue size: 854 -TA1 - message queue size: 855 -TA1 - message queue size: 856 -TA1 - message queue size: 857 -TA1 - message queue size: 858 -TA1 - message queue size: 859 -TA1 - message queue size: 860 -TA1 - message queue size: 861 -TA1 - message queue size: 862 -TA1 - message queue size: 863 -TA1 - message queue size: 864 -TA1 - message queue size: 865 -TA1 - message queue size: 866 -TA1 - message queue size: 867 -TA1 - message queue size: 868 -TA1 - message queue size: 869 -TA1 - message queue size: 870 -TA1 - message queue size: 871 -TA1 - message queue size: 872 -TA1 - message queue size: 873 -TA1 - message queue size: 874 -TA1 - message queue size: 875 -TA1 - message queue size: 876 -TA1 - message queue size: 877 -TA1 - message queue size: 878 -TA1 - message queue size: 879 -TA1 - message queue size: 880 -TA1 - message queue size: 881 -TA1 - message queue size: 882 -TA1 - message queue size: 883 -TA1 - message queue size: 884 -TA1 - message queue size: 885 -TA1 - message queue size: 886 -TA1 - message queue size: 887 -TA1 - message queue size: 888 -TA1 - message queue size: 889 -TA1 - message queue size: 890 -TA1 - message queue size: 891 -TA1 - message queue size: 892 -TA1 - message queue size: 893 -TA1 - message queue size: 894 -TA1 - message queue size: 895 -TA1 - message queue size: 896 -TA1 - message queue size: 897 -TA1 - message queue size: 898 -TA1 - message queue size: 899 -TA1 - message queue size: 900 -TA1 - message queue size: 901 -TA1 - message queue size: 902 -TA1 - message queue size: 903 -TA1 - message queue size: 904 -TA1 - message queue size: 905 -TA1 - message queue size: 906 -TA1 - message queue size: 907 -TA1 - message queue size: 908 -TA1 - message queue size: 909 -TA1 - message queue size: 910 -TA1 - message queue size: 911 -TA1 - message queue size: 912 -TA1 - message queue size: 913 -TA1 - message queue size: 914 -TA1 - message queue size: 915 -TA1 - message queue size: 916 -TA1 - message queue size: 917 -TA1 - message queue size: 918 -TA1 - message queue size: 919 -TA1 - message queue size: 920 -TA1 - message queue size: 921 -TA1 - message queue size: 922 -TA1 - message queue size: 923 -TA1 - message queue size: 924 -TA1 - message queue size: 925 -TA1 - message queue size: 926 -TA1 - message queue size: 927 -TA1 - message queue size: 928 -TA1 - message queue size: 929 -TA1 - message queue size: 930 -TA1 - message queue size: 931 -TA1 - message queue size: 932 -TA1 - message queue size: 933 -TA1 - message queue size: 934 -TA1 - message queue size: 935 -TA1 - message queue size: 936 -TA1 - message queue size: 937 -TA1 - message queue size: 938 -TA1 - message queue size: 939 -TA1 - message queue size: 940 -TA1 - message queue size: 941 -TA1 - message queue size: 942 -TA1 - message queue size: 943 -TA1 - message queue size: 944 -TA1 - message queue size: 945 -TA1 - message queue size: 946 -TA1 - message queue size: 947 -TA1 - message queue size: 948 -TA1 - message queue size: 949 -TA1 - message queue size: 950 -TA1 - message queue size: 951 -TA1 - message queue size: 952 -TA1 - message queue size: 953 -TA1 - message queue size: 954 -TA1 - message queue size: 955 -TA1 - message queue size: 956 -TA1 - message queue size: 957 -TA1 - message queue size: 958 -TA1 - message queue size: 959 -TA1 - message queue size: 960 -TA1 - message queue size: 961 -TA1 - message queue size: 962 -TA1 - message queue size: 963 -TA1 - message queue size: 964 -TA1 - message queue size: 965 -TA1 - message queue size: 966 -TA1 - message queue size: 967 -TA1 - message queue size: 968 -TA1 - message queue size: 969 -TA1 - message queue size: 970 -TA1 - message queue size: 971 -TA1 - message queue size: 972 -TA1 - message queue size: 973 -TA1 - message queue size: 974 -TA1 - message queue size: 975 -TA1 - message queue size: 976 -TA1 - message queue size: 977 -TA1 - message queue size: 978 -TA1 - message queue size: 979 -TA1 - message queue size: 980 -TA1 - message queue size: 981 -TA1 - message queue size: 982 -TA1 - message queue size: 983 -TA1 - message queue size: 984 -TA1 - message queue size: 985 -TA1 - message queue size: 986 -TA1 - message queue size: 987 -TA1 - message queue size: 988 -TA1 - message queue size: 989 -TA1 - message queue size: 990 -TA1 - message queue size: 991 -TA1 - message queue size: 992 -TA1 - message queue size: 993 -TA1 - message queue size: 994 -TA1 - message queue size: 995 -TA1 - message queue size: 996 -TA1 - message queue size: 997 -TA1 - message queue size: 998 -TA1 - message queue size: 999 -TA1 - message queue size: 1000 -TA1 - message queue size: 1001 -TA1 - message queue size: 1002 -TA1 - message queue size: 1003 -TA1 - message queue size: 1004 -TA1 - message queue size: 1005 -TA1 - message queue size: 1006 -TA1 - message queue size: 1007 -TA1 - message queue size: 1008 -TA1 - message queue size: 1009 -TA1 - message queue size: 1010 -TA1 - message queue size: 1011 -TA1 - message queue size: 1012 -TA1 - message queue size: 1013 -TA1 - message queue size: 1014 -TA1 - message queue size: 1015 -TA1 - message queue size: 1016 -TA1 - message queue size: 1017 -TA1 - message queue size: 1018 -TA1 - message queue size: 1019 -TA1 - message queue size: 1020 -TA1 - message queue size: 1021 -TA1 - message queue size: 1022 -TA1 - message queue size: 1023 -TA1 - message queue size: 1024 -TA1 - message queue size: 1025 -TA1 - message queue size: 1026 -TA1 - message queue size: 1027 -TA1 - message queue size: 1028 -TA1 - message queue size: 1029 *** END OF TEST 13 *** diff --git a/c/src/tests/sptests/sp13/system.h b/c/src/tests/sptests/sp13/system.h index 0bf193dad9..cb4b81bb63 100644 --- a/c/src/tests/sptests/sp13/system.h +++ b/c/src/tests/sptests/sp13/system.h @@ -16,14 +16,51 @@ #include <tmacros.h> -/* Miscellaneous */ +/* functions */ -#define EXTERN extern /* external definition */ +rtems_task Init( + rtems_task_argument argument +); + +void Fill_buffer( + char source[], + long *buffer +); + +void Put_buffer( + long *buffer +); + +rtems_task Task_1( + rtems_task_argument argument +); + +rtems_task Task_2( + rtems_task_argument argument +); + +rtems_task Task_3( + rtems_task_argument argument +); -/* macros */ +/* configuration information */ -/* structures */ +#define CONFIGURE_SPTEST -#include "gvar.h" +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 10 +#define CONFIGURE_TICKS_PER_TIMESLICE 100 + +#include <confdefs.h> + +/* global variables */ + +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ + +TEST_EXTERN rtems_id Queue_id[ 4 ]; /* array of queue ids */ +TEST_EXTERN rtems_name Queue_name[ 4 ]; /* array of queue names */ /* end of include file */ diff --git a/c/src/tests/sptests/sp13/task1.c b/c/src/tests/sptests/sp13/task1.c index f203c85ac6..f2b77acabe 100644 --- a/c/src/tests/sptests/sp13/task1.c +++ b/c/src/tests/sptests/sp13/task1.c @@ -273,12 +273,10 @@ pause(); directive_failed( status, "rtems_message_queue_delete" ); } -pause(); - puts( "TA1 - rtems_message_queue_create and send - variable sizes " ); for (queue_size = 1; queue_size < 1030; queue_size++) { - printf("TA1 - message queue size: %d\n", queue_size); + /* printf("TA1 - message queue size: %d\n", queue_size); */ status = rtems_message_queue_create( Queue_name[ 1 ], diff --git a/c/src/tests/sptests/sp14/init.c b/c/src/tests/sptests/sp14/init.c index 627295c03e..fe66b83eb3 100644 --- a/c/src/tests/sptests/sp14/init.c +++ b/c/src/tests/sptests/sp14/init.c @@ -22,11 +22,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_task Init( rtems_task_argument argument diff --git a/c/src/tests/sptests/sp14/system.h b/c/src/tests/sptests/sp14/system.h index 0bf193dad9..7193f893f2 100644 --- a/c/src/tests/sptests/sp14/system.h +++ b/c/src/tests/sptests/sp14/system.h @@ -16,14 +16,61 @@ #include <tmacros.h> -/* Miscellaneous */ +/* functions */ -#define EXTERN extern /* external definition */ +rtems_task Init( + rtems_task_argument argument +); + +rtems_timer_service_routine Signal_3_to_task_1( + rtems_id id, + void *pointer +); + +rtems_asr Process_asr( + rtems_signal_set the_signal_set +); + +rtems_task Task_1( + rtems_task_argument argument +); + +rtems_task Task_2( + rtems_task_argument argument +); -/* macros */ +/* configuration information */ -/* structures */ +#define CONFIGURE_SPTEST -#include "gvar.h" +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_MAXIMUM_TIMERS 1 +#define CONFIGURE_TICKS_PER_TIMESLICE 100 + +#include <confdefs.h> + +/* global variables */ + +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ + +TEST_EXTERN rtems_id Timer_id[ 3 ]; /* array of timer ids */ +TEST_EXTERN rtems_name Timer_name[ 3 ]; /* array of timer names */ + +TEST_EXTERN volatile rtems_unsigned32 Signals_sent; + /* set to TRUE to indicate that a */ + /* signal set has been sent from */ + /* an ISR to the executing task */ + +TEST_EXTERN volatile rtems_unsigned32 Asr_fired; + /* set to TRUE to indicate that the */ + /* RTEMS_ASR has executed and was */ + /* passed the correct signal set */ + +TEST_EXTERN volatile rtems_id Timer_got_this_id; + +TEST_EXTERN volatile void *Timer_got_this_pointer; /* end of include file */ diff --git a/c/src/tests/sptests/sp15/init.c b/c/src/tests/sptests/sp15/init.c index 4bee311714..a0f3dfe649 100644 --- a/c/src/tests/sptests/sp15/init.c +++ b/c/src/tests/sptests/sp15/init.c @@ -22,11 +22,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_task Init( rtems_task_argument argument diff --git a/c/src/tests/sptests/sp15/system.h b/c/src/tests/sptests/sp15/system.h index 0bf193dad9..c06714e3fc 100644 --- a/c/src/tests/sptests/sp15/system.h +++ b/c/src/tests/sptests/sp15/system.h @@ -16,14 +16,43 @@ #include <tmacros.h> -/* Miscellaneous */ +/* functions */ -#define EXTERN extern /* external definition */ +rtems_task Init( + rtems_task_argument argument +); + +rtems_task Task_1( + rtems_task_argument argument +); -/* macros */ +/* configuration information */ -/* structures */ +#define CONFIGURE_SPTEST -#include "gvar.h" +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER +#define CONFIGURE_MAXIMUM_PARTITIONS 2 +#define CONFIGURE_TICKS_PER_TIMESLICE 100 + +#include <confdefs.h> + +/* global variables */ + +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ + +TEST_EXTERN rtems_name Partition_id[ 4 ]; /* array of partition ids */ +TEST_EXTERN rtems_name Partition_name[ 4 ]; /* array of partition names */ + +TEST_EXTERN rtems_unsigned8 Area_1[4096] CPU_STRUCTURE_ALIGNMENT; +TEST_EXTERN rtems_unsigned8 Area_2[274] CPU_STRUCTURE_ALIGNMENT; + +#define Put_address_from_area_1( _to_be_printed ) \ + printf( "0x%08x", ((rtems_unsigned8 *)(_to_be_printed)) - Area_1 ) + +#define Put_address_from_area_2( _to_be_printed ) \ + printf( "0x%08x", ((rtems_unsigned8 *)(_to_be_printed)) - Area_2 ) + /* end of include file */ diff --git a/c/src/tests/sptests/sp16/init.c b/c/src/tests/sptests/sp16/init.c index a5b1163b13..6503796ef0 100644 --- a/c/src/tests/sptests/sp16/init.c +++ b/c/src/tests/sptests/sp16/init.c @@ -22,11 +22,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_task Init( rtems_task_argument argument diff --git a/c/src/tests/sptests/sp16/system.h b/c/src/tests/sptests/sp16/system.h index 3d83632f61..f28780be08 100644 --- a/c/src/tests/sptests/sp16/system.h +++ b/c/src/tests/sptests/sp16/system.h @@ -16,16 +16,68 @@ #include <tmacros.h> -/* Miscellaneous */ +/* functions */ -#define EXTERN extern /* external definition */ +rtems_task Init( + rtems_task_argument argument +); + +rtems_task Task_1( + rtems_task_argument argument +); + +rtems_task Task_2( + rtems_task_argument argument +); + +rtems_task Task_3( + rtems_task_argument argument +); + +rtems_task Task_4( + rtems_task_argument argument +); + +rtems_task Task5( + rtems_task_argument argument +); + +/* configuration information */ -#define BASE_PRIORITY 140 /* all tasks priority */ +#define CONFIGURE_SPTEST -/* macros */ +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER -/* structures */ +#define CONFIGURE_MAXIMUM_REGIONS 4 +#define CONFIGURE_TICKS_PER_TIMESLICE 100 -#include "gvar.h" +#include <confdefs.h> + +/* global variables */ + +TEST_EXTERN rtems_id Task_id[ 6 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 6 ]; /* array of task names */ +TEST_EXTERN rtems_id Region_id[ 5 ]; /* array of region ids */ +TEST_EXTERN rtems_name Region_name[ 5 ]; /* array of region names */ + +TEST_EXTERN rtems_unsigned8 Area_1[4096] CPU_STRUCTURE_ALIGNMENT; +TEST_EXTERN rtems_unsigned8 Area_2[4096] CPU_STRUCTURE_ALIGNMENT; +TEST_EXTERN rtems_unsigned8 Area_3[4096] CPU_STRUCTURE_ALIGNMENT; +TEST_EXTERN rtems_unsigned8 Area_4[8192] CPU_STRUCTURE_ALIGNMENT; + +#define BASE_PRIORITY 140 + +#define Put_address_from_area_1( _to_be_printed ) \ + printf( "0x%08x", ((rtems_unsigned8 *)(_to_be_printed)) - Area_1 ) + +#define Put_address_from_area_2( _to_be_printed ) \ + printf( "0x%08x", ((rtems_unsigned8 *)(_to_be_printed)) - Area_2 ) + +#define Put_address_from_area_3( _to_be_printed ) \ + printf( "0x%08x", ((rtems_unsigned8 *)(_to_be_printed)) - Area_3 ) + +#define Put_address_from_area_4( _to_be_printed ) \ + printf( "0x%08x", ((rtems_unsigned8 *)(_to_be_printed)) - Area_4 ) /* end of include file */ diff --git a/c/src/tests/sptests/sp17/init.c b/c/src/tests/sptests/sp17/init.c index 5527e80c9c..8a5bcfee1a 100644 --- a/c/src/tests/sptests/sp17/init.c +++ b/c/src/tests/sptests/sp17/init.c @@ -22,11 +22,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_task Init( rtems_task_argument argument diff --git a/c/src/tests/sptests/sp17/system.h b/c/src/tests/sptests/sp17/system.h index 0bf193dad9..e95b27635b 100644 --- a/c/src/tests/sptests/sp17/system.h +++ b/c/src/tests/sptests/sp17/system.h @@ -16,14 +16,41 @@ #include <tmacros.h> -/* Miscellaneous */ +/* functions */ -#define EXTERN extern /* external definition */ +rtems_task Init( + rtems_task_argument argument +); + +rtems_asr Process_asr( + rtems_signal_set signal_set +); + +rtems_task Task_1( + rtems_task_argument argument +); + +rtems_task Task_2( + rtems_task_argument argument +); -/* macros */ +/* configuration information */ -/* structures */ +#define CONFIGURE_SPTEST -#include "gvar.h" +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_MICROSECONDS_PER_TICK RTEMS_MILLISECONDS_TO_MICROSECONDS(25) +#define CONFIGURE_TICKS_PER_TIMESLICE 1000 + +#include <confdefs.h> + +/* global variables */ + +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ + +TEST_EXTERN rtems_unsigned32 Task_2_preempted; /* end of include file */ diff --git a/c/src/tests/sptests/sp19/init.c b/c/src/tests/sptests/sp19/init.c index bfadb2bce1..35b8efd4ae 100644 --- a/c/src/tests/sptests/sp19/init.c +++ b/c/src/tests/sptests/sp19/init.c @@ -22,11 +22,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_task Init( rtems_task_argument argument diff --git a/c/src/tests/sptests/sp19/system.h b/c/src/tests/sptests/sp19/system.h index 0bf193dad9..557299b9c2 100644 --- a/c/src/tests/sptests/sp19/system.h +++ b/c/src/tests/sptests/sp19/system.h @@ -16,14 +16,38 @@ #include <tmacros.h> -/* Miscellaneous */ +/* functions */ -#define EXTERN extern /* external definition */ +rtems_task Init( + rtems_task_argument argument +); + +rtems_task First_FP_task( + rtems_task_argument argument +); + +rtems_task FP_task( + rtems_task_argument argument +); + +rtems_task Task_1( + rtems_task_argument argument +); -/* macros */ +/* configuration information */ -/* structures */ +#define CONFIGURE_SPTEST -#include "gvar.h" +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER +#include <confdefs.h> + +/* global variables */ + +TEST_EXTERN rtems_id Task_id[ 7 ]; /* array of task ids */ +TEST_EXTERN rtems_id Task_name[ 7 ]; /* array of task names */ + +TEST_EXTERN rtems_double FP_factors[ 10 ]; /* FP "uniqueness" factors */ +TEST_EXTERN rtems_unsigned32 INTEGER_factors[ 10 ]; /* INT "uniqueness" factors */ /* end of include file */ diff --git a/c/src/tests/sptests/sp20/init.c b/c/src/tests/sptests/sp20/init.c index 95bdc3e728..af23fa92e1 100644 --- a/c/src/tests/sptests/sp20/init.c +++ b/c/src/tests/sptests/sp20/init.c @@ -22,11 +22,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_task Init( rtems_task_argument argument diff --git a/c/src/tests/sptests/sp20/system.h b/c/src/tests/sptests/sp20/system.h index 3d8bac50b8..ddd68c336e 100644 --- a/c/src/tests/sptests/sp20/system.h +++ b/c/src/tests/sptests/sp20/system.h @@ -16,18 +16,44 @@ #include <tmacros.h> -/* Miscellaneous */ - -#define EXTERN extern /* external definition */ - -/* macros */ - -/* structures */ +/* types */ struct counters { rtems_unsigned32 count[6]; }; -#include "gvar.h" +/* functions */ + +rtems_task Init( + rtems_task_argument argument +); + +rtems_task Task_1_through_5( + rtems_task_argument argument +); + +void Get_all_counters( void ); + +/* configuration information */ + +#define CONFIGURE_SPTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_INIT_TASK_PRIORITY 10 +#define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_DEFAULT_MODES +#define CONFIGURE_MAXIMUM_PERIODS 10 + +#include <confdefs.h> + +/* global variables */ + +TEST_EXTERN rtems_id Task_id[ 6 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 6 ]; /* array of task names */ + +TEST_EXTERN struct counters Count; /* iteration counters */ +TEST_EXTERN struct counters Temporary_count; +extern rtems_task_priority Priorities[ 6 ]; /* end of include file */ diff --git a/c/src/tests/sptests/sp21/init.c b/c/src/tests/sptests/sp21/init.c index bee9b931fc..50824bcefd 100644 --- a/c/src/tests/sptests/sp21/init.c +++ b/c/src/tests/sptests/sp21/init.c @@ -22,11 +22,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_task Init( rtems_task_argument argument diff --git a/c/src/tests/sptests/sp21/system.h b/c/src/tests/sptests/sp21/system.h index 0bf193dad9..9c68c795b4 100644 --- a/c/src/tests/sptests/sp21/system.h +++ b/c/src/tests/sptests/sp21/system.h @@ -16,14 +16,29 @@ #include <tmacros.h> -/* Miscellaneous */ +/* functions */ -#define EXTERN extern /* external definition */ +rtems_task Init( + rtems_task_argument argument +); + +rtems_task Task_1( + rtems_task_argument argument +); -/* macros */ +/* configuration information */ -/* structures */ +#define CONFIGURE_SPTEST -#include "gvar.h" +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER +#define CONFIGURE_TEST_NEEDS_STUB_DRIVER + +#include <confdefs.h> + +/* global variables */ + +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ /* end of include file */ diff --git a/c/src/tests/sptests/sp22/init.c b/c/src/tests/sptests/sp22/init.c index 820fac81e3..abfa0e0c06 100644 --- a/c/src/tests/sptests/sp22/init.c +++ b/c/src/tests/sptests/sp22/init.c @@ -22,11 +22,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_task Init( rtems_task_argument argument diff --git a/c/src/tests/sptests/sp22/system.h b/c/src/tests/sptests/sp22/system.h index 0bf193dad9..c7d0636ba3 100644 --- a/c/src/tests/sptests/sp22/system.h +++ b/c/src/tests/sptests/sp22/system.h @@ -16,14 +16,40 @@ #include <tmacros.h> -/* Miscellaneous */ +/* functions */ -#define EXTERN extern /* external definition */ +rtems_task Init( + rtems_task_argument argument +); + +rtems_timer_service_routine Delayed_resume( + rtems_id ignored_id, + void *ignored_address +); + +void Print_time( void ); + +rtems_task Task_1( + rtems_task_argument argument +); -/* macros */ +/* configuration information */ -/* structures */ +#define CONFIGURE_SPTEST -#include "gvar.h" +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_MAXIMUM_TIMERS 2 + +#include <confdefs.h> + +/* global variables */ + +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ + +TEST_EXTERN rtems_id Timer_id[ 2 ]; /* array of timer ids */ +TEST_EXTERN rtems_name Timer_name[ 2 ]; /* array of timer names */ /* end of include file */ diff --git a/c/src/tests/sptests/sp23/init.c b/c/src/tests/sptests/sp23/init.c index 5acaf67e42..c96927ece7 100644 --- a/c/src/tests/sptests/sp23/init.c +++ b/c/src/tests/sptests/sp23/init.c @@ -22,11 +22,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_task Init( rtems_task_argument argument diff --git a/c/src/tests/sptests/sp23/system.h b/c/src/tests/sptests/sp23/system.h index 0bf193dad9..5a2ad3ff4e 100644 --- a/c/src/tests/sptests/sp23/system.h +++ b/c/src/tests/sptests/sp23/system.h @@ -16,14 +16,39 @@ #include <tmacros.h> -/* Miscellaneous */ +/* functions */ -#define EXTERN extern /* external definition */ +rtems_task Init( + rtems_task_argument argument +); -/* macros */ +rtems_task Task_1( + rtems_task_argument argument +); -/* structures */ +/* configuration information */ -#include "gvar.h" +#define CONFIGURE_SPTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_MAXIMUM_PORTS 1 + +#include <confdefs.h> + +/* global variables */ + +TEST_EXTERN rtems_id Task_id[ 2 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 2 ]; /* array of task names */ + +TEST_EXTERN rtems_id Port_id[ 2 ]; /* array of port ids */ +TEST_EXTERN rtems_name Port_name[ 2 ]; /* array of port names */ + +#define Internal_port_area ((rtems_unsigned8 *) 0x00001000) +#define External_port_area ((rtems_unsigned8 *) 0x00002000) + +#define Below_port_area ((rtems_unsigned8 *) 0x00000500) +#define Above_port_area ((rtems_unsigned8 *) 0x00003000) /* end of include file */ diff --git a/c/src/tests/sptests/sp24/init.c b/c/src/tests/sptests/sp24/init.c index c73830a6df..8297581ea3 100644 --- a/c/src/tests/sptests/sp24/init.c +++ b/c/src/tests/sptests/sp24/init.c @@ -22,11 +22,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_task Init( rtems_task_argument argument diff --git a/c/src/tests/sptests/sp24/system.h b/c/src/tests/sptests/sp24/system.h index 0bf193dad9..b54beb7add 100644 --- a/c/src/tests/sptests/sp24/system.h +++ b/c/src/tests/sptests/sp24/system.h @@ -16,14 +16,38 @@ #include <tmacros.h> -/* Miscellaneous */ +/* functions */ -#define EXTERN extern /* external definition */ +rtems_task Init( + rtems_task_argument argument +); + +rtems_timer_service_routine Resume_task( + rtems_id timer_id, + void *ignored_address +); + +rtems_task Task_1_through_3( + rtems_task_argument argument +); -/* macros */ +/* configuration information */ -/* structures */ +#define CONFIGURE_SPTEST -#include "gvar.h" +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_MAXIMUM_TIMERS 3 + +#include <confdefs.h> + +/* global variables */ + +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ + +TEST_EXTERN rtems_id Timer_id[ 4 ]; /* array of timer ids */ +TEST_EXTERN rtems_name Timer_name[ 4 ]; /* array of timer names */ /* end of include file */ diff --git a/c/src/tests/sptests/sp25/init.c b/c/src/tests/sptests/sp25/init.c index fcd5b3dfd6..4fcf332355 100644 --- a/c/src/tests/sptests/sp25/init.c +++ b/c/src/tests/sptests/sp25/init.c @@ -22,11 +22,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_task Init( rtems_task_argument argument diff --git a/c/src/tests/sptests/sp25/system.h b/c/src/tests/sptests/sp25/system.h index 3d83632f61..dfcee7551b 100644 --- a/c/src/tests/sptests/sp25/system.h +++ b/c/src/tests/sptests/sp25/system.h @@ -16,16 +16,39 @@ #include <tmacros.h> -/* Miscellaneous */ +/* functions */ -#define EXTERN extern /* external definition */ +rtems_task Init( + rtems_task_argument argument +); -#define BASE_PRIORITY 140 /* all tasks priority */ +rtems_task Task_1( + rtems_task_argument argument +); -/* macros */ +/* configuration information */ -/* structures */ +#define CONFIGURE_SPTEST -#include "gvar.h" +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER +#define CONFIGURE_MAXIMUM_REGIONS 1 + +#include <confdefs.h> + +/* global variables */ + +TEST_EXTERN rtems_id Task_id[ 6 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 6 ]; /* array of task names */ +TEST_EXTERN rtems_id Region_id[ 2 ]; /* array of region ids */ +TEST_EXTERN rtems_name Region_name[ 2 ]; /* array of region names */ + +TEST_EXTERN rtems_unsigned8 Area_1[64000] CPU_STRUCTURE_ALIGNMENT; + +#define BASE_PRIORITY 140 + +#define Put_address_from_area_1( _to_be_printed ) \ + printf( "0x%08x", ((rtems_unsigned8 *)(_to_be_printed)) - Area_1 ) + /* end of include file */ diff --git a/c/src/tests/sptests/spfatal/init.c b/c/src/tests/sptests/spfatal/init.c index a50c6101f5..e06ec20c8a 100644 --- a/c/src/tests/sptests/spfatal/init.c +++ b/c/src/tests/sptests/spfatal/init.c @@ -22,11 +22,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_task Init( rtems_task_argument argument diff --git a/c/src/tests/sptests/spfatal/system.h b/c/src/tests/sptests/spfatal/system.h index 0bf193dad9..b024f3f767 100644 --- a/c/src/tests/sptests/spfatal/system.h +++ b/c/src/tests/sptests/spfatal/system.h @@ -16,14 +16,64 @@ #include <tmacros.h> -/* Miscellaneous */ +/* functions */ -#define EXTERN extern /* external definition */ +rtems_task Init( + rtems_task_argument argument +); + +void put_error( + rtems_unsigned32 error, + rtems_status_code expected +); + +rtems_extension Fatal_extension( + rtems_unsigned32 error +); + +rtems_task Task_1( + rtems_task_argument argument +); -/* macros */ +/* configuration information */ -/* structures */ +extern rtems_extensions_table initial_extensions; -#include "gvar.h" +#ifdef TEST_INIT +rtems_extensions_table initial_extensions = { + NULL, /* create */ + NULL, /* start */ + NULL, /* restart */ + NULL, /* delete */ + NULL, /* switch */ + NULL, /* post switch */ + NULL, /* begin */ + NULL, /* exitted */ + Fatal_extension /* fatal */ +}; +#endif + +#define CONFIGURE_SPTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_MICROSECONDS_PER_TICK RTEMS_MILLISECONDS_TO_MICROSECONDS(0) +#define CONFIGURE_TICKS_PER_TIMESLICE 0 + +#define CONFIGURE_INITIAL_EXTENSIONS &initial_extensions + +#include <confdefs.h> + +/* global variables */ + +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ + +TEST_EXTERN rtems_configuration_table New_Configuration; + +extern rtems_extensions_table Extensions; +extern rtems_configuration_table BSP_Configuration; +extern rtems_cpu_table Cpu_table; /* end of include file */ diff --git a/c/src/tests/sptests/spsize/init.c b/c/src/tests/sptests/spsize/init.c index e15e7b40fb..66e40cd0f1 100644 --- a/c/src/tests/sptests/spsize/init.c +++ b/c/src/tests/sptests/spsize/init.c @@ -22,11 +22,8 @@ * $Id$ */ -#include "apps.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" +#define TEST_INIT +#include "system.h" rtems_task Test_task(); void size_rtems( int mode ); diff --git a/c/src/tests/sptests/spsize/size.c b/c/src/tests/sptests/spsize/size.c index e55fbedb15..93bda6ccf9 100644 --- a/c/src/tests/sptests/spsize/size.c +++ b/c/src/tests/sptests/spsize/size.c @@ -16,34 +16,34 @@ #include <rtems/system.h> #include <rtems/config.h> -#include <rtems/copyrt.h> -#include <rtems/clock.h> -#include <rtems/tasks.h> -#include <rtems/dpmem.h> -#include <rtems/event.h> +#include <rtems/directives.h> +#include <rtems/core/copyrt.h> +#include <rtems/rtems/clock.h> +#include <rtems/rtems/tasks.h> +#include <rtems/rtems/dpmem.h> +#include <rtems/rtems/event.h> #include <rtems/extension.h> #include <rtems/fatal.h> #include <rtems/init.h> -#include <rtems/intthrd.h> -#include <rtems/isr.h> -#include <rtems/intr.h> +#include <rtems/core/intthrd.h> +#include <rtems/core/isr.h> +#include <rtems/rtems/intr.h> #include <rtems/io.h> -#include <rtems/message.h> -#include <rtems/mp.h> -#include <rtems/mpci.h> -#include <rtems/part.h> -#include <rtems/priority.h> -#include <rtems/ratemon.h> -#include <rtems/region.h> -#include <rtems/sem.h> -#include <rtems/signal.h> +#include <rtems/rtems/message.h> +#include <rtems/rtems/mp.h> +#include <rtems/core/mpci.h> +#include <rtems/rtems/part.h> +#include <rtems/core/priority.h> +#include <rtems/rtems/ratemon.h> +#include <rtems/rtems/region.h> +#include <rtems/rtems/sem.h> +#include <rtems/rtems/signal.h> #include <rtems/sysstate.h> -#include <rtems/thread.h> -#include <rtems/timer.h> -#include <rtems/tod.h> -#include <rtems/userext.h> -#include <rtems/wkspace.h> -#include <rtems/mp.h> +#include <rtems/core/thread.h> +#include <rtems/rtems/timer.h> +#include <rtems/core/tod.h> +#include <rtems/core/userext.h> +#include <rtems/core/wkspace.h> #include <stdlib.h> @@ -203,12 +203,13 @@ uninitialized = /*config.h*/ (sizeof _Configuration_Table) + (sizeof _Configuration_MP_table) + - (sizeof _Configuration_MPCI_table) + /*context.h*/ (sizeof _Context_Switch_necessary) + /*copyrt.h*/ 0 + +/*debug.h*/ (sizeof _Debug_Level) + + /*dpmem.h*/ (sizeof _Dual_ported_memory_Information) + /*event.h*/ (sizeof _Event_Sync) + @@ -225,16 +226,21 @@ uninitialized = /*init.h*/ 0 + +/*interr.h*/ (sizeof Internal_errors_What_happened) + + /*inthrdmp.h*/ 0 + /*intr.h*/ 0 + -/*intthrd.h*/ (sizeof _Internal_threads_System_initialization_thread) + +/*intthrd.h*/ (sizeof _Internal_threads_Information) + + (sizeof _Internal_threads_System_initialization_thread) + (sizeof _Internal_threads_Idle_thread) + - (sizeof _Internal_threads_MP_Receive_server_entry) + + (sizeof _Internal_threads_Extensions) + /*io.h*/ (sizeof _IO_Number_of_drivers) + (sizeof _IO_Driver_address_table) + + (sizeof _IO_Number_of_devices) + + (sizeof _IO_Driver_name_table) + /*isr.h*/ (sizeof _ISR_Nest_level) + (sizeof _ISR_Vector_table) + @@ -247,6 +253,10 @@ uninitialized = /*mp.h*/ 0 + /*mpci.h*/ (sizeof _MPCI_Remote_blocked_threads) + + (sizeof _MPCI_Semaphore) + + (sizeof _MPCI_table) + + (sizeof _MPCI_Receive_server_tcb) + + (sizeof _MPCI_Packet_processors) + /*mppkt.h*/ 0 + @@ -255,8 +265,11 @@ uninitialized = /*msgmp.h*/ 0 + /*object.h*/ (sizeof _Objects_Local_node) + + (sizeof _Objects_Maximum_nodes) + + (sizeof _Objects_Information_table) + -/*objectmp.h*/ (sizeof _Objects_MP_Inactive_global_objects) + +/*objectmp.h*/ (sizeof _Objects_MP_Maximum_global_objects) + + (sizeof _Objects_MP_Inactive_global_objects) + /*options.h*/ 0 + @@ -289,28 +302,32 @@ uninitialized = /*status.h*/ 0 + -/*system.h*/ (sizeof _CPU_Table) + +/*sysstate.h*/ (sizeof _System_state_Is_multiprocessing) + + (sizeof _System_state_Current) + -/*sysstate.h*/ (sizeof _System_state_Current) + +/*system.h*/ (sizeof _CPU_Table) + /*taskmp.h*/ 0 + /*tasks.h*/ (sizeof _RTEMS_tasks_Information) + + (sizeof _RTEMS_tasks_User_initialization_tasks) + + (sizeof _RTEMS_tasks_Number_of_initialization_tasks) + -/*thread.h*/ (sizeof _Thread_Dispatch_disable_level) + +/*thread.h*/ (sizeof _Thread_BSP_context) + + (sizeof _Thread_Dispatch_disable_level) + + (sizeof _Thread_Maximum_extensions) + (sizeof _Thread_Ticks_remaining_in_timeslice) + (sizeof _Thread_Ticks_per_timeslice) + (sizeof _Thread_Ready_chain) + (sizeof _Thread_Executing) + (sizeof _Thread_Heir) + (sizeof _Thread_Allocated_fp) + - (sizeof _Thread_BSP_context) + /*threadmp.h*/ (sizeof _Thread_MP_Receive) + (sizeof _Thread_MP_Active_proxies) + (sizeof _Thread_MP_Inactive_proxies) + -/*threadq.h*/ 0 + +/*threadq.h*/ (sizeof _Thread_queue_Extract_table) + /*timer.h*/ (sizeof _Timer_Information) + @@ -328,10 +345,10 @@ uninitialized = /*userext.h*/ (sizeof _User_extensions_Initial) + (sizeof _User_extensions_List) + -/*watchdog.h*/ (sizeof _Watchdog_Ticks_chain) + - (sizeof _Watchdog_Seconds_chain) + +/*watchdog.h*/ (sizeof _Watchdog_Sync_level) + (sizeof _Watchdog_Sync_count) + - (sizeof _Watchdog_Sync_level) + + (sizeof _Watchdog_Ticks_chain) + + (sizeof _Watchdog_Seconds_chain) + /*wkspace.h*/ (sizeof _Workspace_Area); @@ -383,10 +400,19 @@ uninitialized += (sizeof _CPU_Null_fp_context) + #endif +#ifdef ppc + +/* cpu.h */ +uninitialized += (sizeof _CPU_Interrupt_stack_low) + + (sizeof _CPU_Interrupt_stack_high) + + (sizeof _CPU_IRQ_info); + +#endif + initialized += /*copyrt.h*/ (strlen(_Copyright_Notice)+1) + -/*sptables.h*/ (sizeof _Configuration_Default_multiprocessing_table) + +/*sptables.h*/ (sizeof _Initialization_Default_multiprocessing_table) + (strlen(_RTEMS_version)+1) + (sizeof _Entry_points) + diff --git a/c/src/tests/support/include/tmacros.h b/c/src/tests/support/include/tmacros.h index c4cda870c5..6fb8402241 100644 --- a/c/src/tests/support/include/tmacros.h +++ b/c/src/tests/support/include/tmacros.h @@ -30,6 +30,13 @@ extern "C" { #define FOREVER 1 /* infinite loop */ +#ifdef TEST_INIT +#define TEST_EXTERN +#define CONFIGURE_INIT +#else +#define TEST_EXTERN extern +#endif + #define directive_failed( dirstat, failmsg ) \ fatal_directive_status( dirstat, RTEMS_SUCCESSFUL, failmsg ) diff --git a/c/src/tests/tmtests/include/timesys.h b/c/src/tests/tmtests/include/timesys.h index 3b61d7b42d..22034a2797 100644 --- a/c/src/tests/tmtests/include/timesys.h +++ b/c/src/tests/tmtests/include/timesys.h @@ -1,7 +1,7 @@ -/* timesystem.h +/* timesys.h * - * This include file contains information that is included in every - * function in the Time Suite. + * This header file contains the global variables for the Time + * suite. * * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. * On-Line Applications Research Corporation (OAR). @@ -14,17 +14,45 @@ * $Id$ */ +#include <tmacros.h> -/* constants */ - +/* + * How many times a particular operation is performed while timed. + */ + #define OPERATION_COUNT 100 -#define IT_COUNT 100 +#define IT_COUNT 100 + +/* functions */ + +#define put_time( _message, _total_time, \ + _iterations, _loop_overhead, _overhead ) \ + printf( \ + "%s %d\n", \ + (_message), \ + (((_total_time) - (_loop_overhead)) / (_iterations)) - (_overhead) \ + ) + +#if defined(STACK_CHECKER_ON) || defined(RTEMS_DEBUG) +#define Print_Warning() \ + do { \ + puts( \ + "\n" \ + "THE TIMES REPORTED BY THIS TEST INCLUDE DEBUG CODE!\n" \ + "\n" \ + ); \ + } while (0) + +#else +#define Print_Warning() +#endif -/* Miscellaneous */ +/* variables */ -#define FOREVER 1 /* infinite loop */ -#define EXTERN extern /* external definition */ +TEST_EXTERN volatile rtems_unsigned32 end_time; /* ending time variable */ +TEST_EXTERN volatile rtems_unsigned32 overhead; /* loop overhead variable */ -/* structures */ +TEST_EXTERN rtems_id Task_id[ OPERATION_COUNT+1 ]; /* array of task ids */ +TEST_EXTERN rtems_id Task_name[ OPERATION_COUNT+1 ]; /* array of task names */ /* end of include file */ diff --git a/c/src/tests/tmtests/tm01/system.h b/c/src/tests/tmtests/tm01/system.h index 4444a53c4c..190361f77c 100644 --- a/c/src/tests/tmtests/tm01/system.h +++ b/c/src/tests/tmtests/tm01/system.h @@ -17,5 +17,25 @@ #include <coverhd.h> #include <tmacros.h> +/* functions */ + +rtems_task Init( + rtems_task_argument argument +); + #include <timesys.h> -#include <timegvar.h> + +/* configuration information */ + +#define CONFIGURE_TMTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 2 +#define CONFIGURE_MAXIMUM_SEMAPHORES 1 +#define CONFIGURE_TICKS_PER_TIMESLICE 0 + +#include <confdefs.h> + +/* end of include file */ diff --git a/c/src/tests/tmtests/tm01/task1.c b/c/src/tests/tmtests/tm01/task1.c index c4e4e4bc0d..cc1cfca70f 100644 --- a/c/src/tests/tmtests/tm01/task1.c +++ b/c/src/tests/tmtests/tm01/task1.c @@ -11,11 +11,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_task Test_task( rtems_task_argument argument @@ -27,6 +24,8 @@ rtems_task Init( { rtems_status_code status; + Print_Warning(); + puts( "\n\n*** TIME TEST 1 ***" ); Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); @@ -185,5 +184,6 @@ rtems_task Test_task( CALLING_OVERHEAD_SEMAPHORE_RELEASE ); + puts( "*** END OF TEST 1 ***" ); exit( 0 ); } diff --git a/c/src/tests/tmtests/tm02/system.h b/c/src/tests/tmtests/tm02/system.h index 4444a53c4c..994d733f4a 100644 --- a/c/src/tests/tmtests/tm02/system.h +++ b/c/src/tests/tmtests/tm02/system.h @@ -17,5 +17,26 @@ #include <coverhd.h> #include <tmacros.h> +/* functions */ + +rtems_task Init( + rtems_task_argument argument +); + #include <timesys.h> -#include <timegvar.h> + +/* configuration information */ + +#define CONFIGURE_TMTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 111 +#define CONFIGURE_MAXIMUM_TIMERS 110 +#define CONFIGURE_MAXIMUM_SEMAPHORES 101 +#define CONFIGURE_TICKS_PER_TIMESLICE 0 + +#include <confdefs.h> + +/* end of include file */ diff --git a/c/src/tests/tmtests/tm02/task1.c b/c/src/tests/tmtests/tm02/task1.c index 46f947b405..a657b37c78 100644 --- a/c/src/tests/tmtests/tm02/task1.c +++ b/c/src/tests/tmtests/tm02/task1.c @@ -11,11 +11,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_id High_id; rtems_id Low_id; @@ -42,6 +39,8 @@ rtems_task Init( { rtems_status_code status; + Print_Warning(); + puts( "\n\n*** TIME TEST 2 ***" ); test_init(); @@ -153,5 +152,7 @@ rtems_task Low_task( 0, CALLING_OVERHEAD_SEMAPHORE_OBTAIN ); + + puts( "*** END OF TEST 2 ***" ); exit( 0 ); } diff --git a/c/src/tests/tmtests/tm03/system.h b/c/src/tests/tmtests/tm03/system.h index 4444a53c4c..994d733f4a 100644 --- a/c/src/tests/tmtests/tm03/system.h +++ b/c/src/tests/tmtests/tm03/system.h @@ -17,5 +17,26 @@ #include <coverhd.h> #include <tmacros.h> +/* functions */ + +rtems_task Init( + rtems_task_argument argument +); + #include <timesys.h> -#include <timegvar.h> + +/* configuration information */ + +#define CONFIGURE_TMTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 111 +#define CONFIGURE_MAXIMUM_TIMERS 110 +#define CONFIGURE_MAXIMUM_SEMAPHORES 101 +#define CONFIGURE_TICKS_PER_TIMESLICE 0 + +#include <confdefs.h> + +/* end of include file */ diff --git a/c/src/tests/tmtests/tm03/task1.c b/c/src/tests/tmtests/tm03/task1.c index 5c14f5b6e4..59f9289d10 100644 --- a/c/src/tests/tmtests/tm03/task1.c +++ b/c/src/tests/tmtests/tm03/task1.c @@ -11,11 +11,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_id Semaphore_id; rtems_task test_init( @@ -38,6 +35,8 @@ rtems_task Init( rtems_status_code status; rtems_id task_id; + Print_Warning(); + puts( "\n\n*** TIME TEST 3 ***" ); status = rtems_task_create( rtems_build_name( 'T', 'A', '1', ' ' ), @@ -146,5 +145,7 @@ rtems_task High_task( 0, CALLING_OVERHEAD_SEMAPHORE_RELEASE ); + + puts( "*** END OF TEST 3 ***" ); exit( 0 ); } diff --git a/c/src/tests/tmtests/tm04/system.h b/c/src/tests/tmtests/tm04/system.h index 4444a53c4c..74eb108e3e 100644 --- a/c/src/tests/tmtests/tm04/system.h +++ b/c/src/tests/tmtests/tm04/system.h @@ -17,5 +17,25 @@ #include <coverhd.h> #include <tmacros.h> +/* functions */ + +rtems_task Init( + rtems_task_argument argument +); + #include <timesys.h> -#include <timegvar.h> + +/* configuration information */ + +#define CONFIGURE_TMTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 111 +#define CONFIGURE_MAXIMUM_SEMAPHORES 1 +#define CONFIGURE_TICKS_PER_TIMESLICE 0 + +#include <confdefs.h> + +/* end of include file */ diff --git a/c/src/tests/tmtests/tm04/task1.c b/c/src/tests/tmtests/tm04/task1.c index 371f250282..8156a17daa 100644 --- a/c/src/tests/tmtests/tm04/task1.c +++ b/c/src/tests/tmtests/tm04/task1.c @@ -11,11 +11,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_id Semaphore_id; rtems_id Task_id[OPERATION_COUNT+1]; @@ -42,6 +39,8 @@ rtems_task Init( { rtems_status_code status; + Print_Warning(); + puts( "\n\n*** TIME TEST 4 ***" ); test_init(); @@ -328,6 +327,7 @@ rtems_task High_task( CALLING_OVERHEAD_TASK_DELETE ); + puts( "*** END OF TEST 4 ***" ); exit( 0 ); } diff --git a/c/src/tests/tmtests/tm05/system.h b/c/src/tests/tmtests/tm05/system.h index 4444a53c4c..994d733f4a 100644 --- a/c/src/tests/tmtests/tm05/system.h +++ b/c/src/tests/tmtests/tm05/system.h @@ -17,5 +17,26 @@ #include <coverhd.h> #include <tmacros.h> +/* functions */ + +rtems_task Init( + rtems_task_argument argument +); + #include <timesys.h> -#include <timegvar.h> + +/* configuration information */ + +#define CONFIGURE_TMTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 111 +#define CONFIGURE_MAXIMUM_TIMERS 110 +#define CONFIGURE_MAXIMUM_SEMAPHORES 101 +#define CONFIGURE_TICKS_PER_TIMESLICE 0 + +#include <confdefs.h> + +/* end of include file */ diff --git a/c/src/tests/tmtests/tm05/task1.c b/c/src/tests/tmtests/tm05/task1.c index 86e0c14eab..3f1f44a54a 100644 --- a/c/src/tests/tmtests/tm05/task1.c +++ b/c/src/tests/tmtests/tm05/task1.c @@ -11,11 +11,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_id Task_id[OPERATION_COUNT+1]; rtems_unsigned32 Task_index; @@ -40,6 +37,8 @@ rtems_task Init( { rtems_status_code status; + Print_Warning(); + puts( "\n\n*** TIME TEST 5 ***" ); test_init(); @@ -98,6 +97,7 @@ rtems_task High_task( CALLING_OVERHEAD_TASK_RESUME ); + puts( "*** END OF TEST 5 ***" ); exit( 0 ); } diff --git a/c/src/tests/tmtests/tm06/system.h b/c/src/tests/tmtests/tm06/system.h index 4444a53c4c..994d733f4a 100644 --- a/c/src/tests/tmtests/tm06/system.h +++ b/c/src/tests/tmtests/tm06/system.h @@ -17,5 +17,26 @@ #include <coverhd.h> #include <tmacros.h> +/* functions */ + +rtems_task Init( + rtems_task_argument argument +); + #include <timesys.h> -#include <timegvar.h> + +/* configuration information */ + +#define CONFIGURE_TMTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 111 +#define CONFIGURE_MAXIMUM_TIMERS 110 +#define CONFIGURE_MAXIMUM_SEMAPHORES 101 +#define CONFIGURE_TICKS_PER_TIMESLICE 0 + +#include <confdefs.h> + +/* end of include file */ diff --git a/c/src/tests/tmtests/tm06/task1.c b/c/src/tests/tmtests/tm06/task1.c index c6a6af6c63..2863cc8684 100644 --- a/c/src/tests/tmtests/tm06/task1.c +++ b/c/src/tests/tmtests/tm06/task1.c @@ -11,11 +11,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_id Task_id[ OPERATION_COUNT + 1 ]; @@ -37,6 +34,8 @@ rtems_task Init( { rtems_status_code status; + Print_Warning(); + puts( "\n\n*** TIME TEST 6 ***" ); test_init(); @@ -150,6 +149,7 @@ rtems_task Task_1( CALLING_OVERHEAD_TASK_RESUME ); + puts( "*** END OF TEST 6 ***" ); exit( 0 ); } diff --git a/c/src/tests/tmtests/tm07/system.h b/c/src/tests/tmtests/tm07/system.h index 4444a53c4c..994d733f4a 100644 --- a/c/src/tests/tmtests/tm07/system.h +++ b/c/src/tests/tmtests/tm07/system.h @@ -17,5 +17,26 @@ #include <coverhd.h> #include <tmacros.h> +/* functions */ + +rtems_task Init( + rtems_task_argument argument +); + #include <timesys.h> -#include <timegvar.h> + +/* configuration information */ + +#define CONFIGURE_TMTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 111 +#define CONFIGURE_MAXIMUM_TIMERS 110 +#define CONFIGURE_MAXIMUM_SEMAPHORES 101 +#define CONFIGURE_TICKS_PER_TIMESLICE 0 + +#include <confdefs.h> + +/* end of include file */ diff --git a/c/src/tests/tmtests/tm07/task1.c b/c/src/tests/tmtests/tm07/task1.c index fcd545bbc4..bd7aad8744 100644 --- a/c/src/tests/tmtests/tm07/task1.c +++ b/c/src/tests/tmtests/tm07/task1.c @@ -11,11 +11,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_id Task_id[OPERATION_COUNT+1], task_index; @@ -39,6 +36,8 @@ rtems_task Init( { rtems_status_code status; + Print_Warning(); + puts( "\n\n*** TIME TEST 7 ***" ); test_init(); @@ -94,6 +93,7 @@ rtems_task High_task( } else (void) rtems_task_suspend( RTEMS_SELF ); + puts( "*** END OF TEST 7 ***" ); exit( 0 ); } diff --git a/c/src/tests/tmtests/tm08/system.h b/c/src/tests/tmtests/tm08/system.h index 4444a53c4c..994d733f4a 100644 --- a/c/src/tests/tmtests/tm08/system.h +++ b/c/src/tests/tmtests/tm08/system.h @@ -17,5 +17,26 @@ #include <coverhd.h> #include <tmacros.h> +/* functions */ + +rtems_task Init( + rtems_task_argument argument +); + #include <timesys.h> -#include <timegvar.h> + +/* configuration information */ + +#define CONFIGURE_TMTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 111 +#define CONFIGURE_MAXIMUM_TIMERS 110 +#define CONFIGURE_MAXIMUM_SEMAPHORES 101 +#define CONFIGURE_TICKS_PER_TIMESLICE 0 + +#include <confdefs.h> + +/* end of include file */ diff --git a/c/src/tests/tmtests/tm08/task1.c b/c/src/tests/tmtests/tm08/task1.c index 36312ff4b7..99958e4197 100644 --- a/c/src/tests/tmtests/tm08/task1.c +++ b/c/src/tests/tmtests/tm08/task1.c @@ -11,11 +11,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_id Test_task_id; @@ -33,6 +30,8 @@ rtems_task Init( { rtems_status_code status; + Print_Warning(); + puts( "\n\n*** TIME TEST 8 ***" ); test_init(); @@ -234,6 +233,7 @@ rtems_task test_task( CALLING_OVERHEAD_CLOCK_GET ); + puts( "*** END OF TEST 8 ***" ); exit( 0 ); } diff --git a/c/src/tests/tmtests/tm09/system.h b/c/src/tests/tmtests/tm09/system.h index 4444a53c4c..992484e777 100644 --- a/c/src/tests/tmtests/tm09/system.h +++ b/c/src/tests/tmtests/tm09/system.h @@ -17,5 +17,24 @@ #include <coverhd.h> #include <tmacros.h> +/* functions */ + +rtems_task Init( + rtems_task_argument argument +); + #include <timesys.h> -#include <timegvar.h> + +/* configuration information */ + +#define CONFIGURE_TMTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER + +#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 +#define CONFIGURE_TICKS_PER_TIMESLICE 0 + +#include <confdefs.h> + +/* end of include file */ diff --git a/c/src/tests/tmtests/tm09/task1.c b/c/src/tests/tmtests/tm09/task1.c index f1aab28241..882fc5e61c 100644 --- a/c/src/tests/tmtests/tm09/task1.c +++ b/c/src/tests/tmtests/tm09/task1.c @@ -11,11 +11,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_id Queue_id; @@ -30,6 +27,8 @@ rtems_task Init( { rtems_status_code status; + Print_Warning(); + puts( "\n\n*** TIME TEST 9 ***" ); status = rtems_task_create( @@ -85,6 +84,7 @@ rtems_task Test_task ( CALLING_OVERHEAD_MESSAGE_QUEUE_DELETE ); + puts( "*** END OF TEST 9 ***" ); exit( 0 ); } diff --git a/c/src/tests/tmtests/tm10/system.h b/c/src/tests/tmtests/tm10/system.h index 4444a53c4c..45ec4003bf 100644 --- a/c/src/tests/tmtests/tm10/system.h +++ b/c/src/tests/tmtests/tm10/system.h @@ -17,5 +17,25 @@ #include <coverhd.h> #include <tmacros.h> +/* functions */ + +rtems_task Init( + rtems_task_argument argument +); + #include <timesys.h> -#include <timegvar.h> + +/* configuration information */ + +#define CONFIGURE_TMTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 110 +#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 +#define CONFIGURE_TICKS_PER_TIMESLICE 0 + +#include <confdefs.h> + +/* end of include file */ diff --git a/c/src/tests/tmtests/tm10/task1.c b/c/src/tests/tmtests/tm10/task1.c index 3717022063..853974ee9c 100644 --- a/c/src/tests/tmtests/tm10/task1.c +++ b/c/src/tests/tmtests/tm10/task1.c @@ -11,11 +11,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_id Queue_id; long Buffer[4]; @@ -40,6 +37,8 @@ rtems_task Init( { rtems_status_code status; + Print_Warning(); + puts( "\n\n*** TIME TEST 10 ***" ); test_init(); @@ -161,5 +160,6 @@ rtems_task Low_task( CALLING_OVERHEAD_MESSAGE_QUEUE_RECEIVE ); + puts( "*** END OF TEST 10 ***" ); exit( 0 ); } diff --git a/c/src/tests/tmtests/tm11/system.h b/c/src/tests/tmtests/tm11/system.h index 4444a53c4c..99de69201e 100644 --- a/c/src/tests/tmtests/tm11/system.h +++ b/c/src/tests/tmtests/tm11/system.h @@ -17,5 +17,25 @@ #include <coverhd.h> #include <tmacros.h> +/* functions */ + +rtems_task Init( + rtems_task_argument argument +); + #include <timesys.h> -#include <timegvar.h> + +/* configuration information */ + +#define CONFIGURE_TMTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 111 +#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 +#define CONFIGURE_TICKS_PER_TIMESLICE 0 + +#include <confdefs.h> + +/* end of include file */ diff --git a/c/src/tests/tmtests/tm11/task1.c b/c/src/tests/tmtests/tm11/task1.c index ade5d849dd..a68da12d5b 100644 --- a/c/src/tests/tmtests/tm11/task1.c +++ b/c/src/tests/tmtests/tm11/task1.c @@ -11,11 +11,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_id Queue_id; @@ -41,6 +38,8 @@ void Init( rtems_status_code status; rtems_id id; + Print_Warning(); + puts( "\n\n*** TIME TEST 11 ***" ); status = rtems_task_create( @@ -151,5 +150,6 @@ rtems_task High_task( CALLING_OVERHEAD_MESSAGE_QUEUE_SEND ); + puts( "*** END OF TEST 11 ***" ); exit( 0 ); } diff --git a/c/src/tests/tmtests/tm12/system.h b/c/src/tests/tmtests/tm12/system.h index 4444a53c4c..99de69201e 100644 --- a/c/src/tests/tmtests/tm12/system.h +++ b/c/src/tests/tmtests/tm12/system.h @@ -17,5 +17,25 @@ #include <coverhd.h> #include <tmacros.h> +/* functions */ + +rtems_task Init( + rtems_task_argument argument +); + #include <timesys.h> -#include <timegvar.h> + +/* configuration information */ + +#define CONFIGURE_TMTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 111 +#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 +#define CONFIGURE_TICKS_PER_TIMESLICE 0 + +#include <confdefs.h> + +/* end of include file */ diff --git a/c/src/tests/tmtests/tm12/task1.c b/c/src/tests/tmtests/tm12/task1.c index 6801ffb86a..16b918dd28 100644 --- a/c/src/tests/tmtests/tm12/task1.c +++ b/c/src/tests/tmtests/tm12/task1.c @@ -11,11 +11,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_id Queue_id; @@ -41,6 +38,8 @@ rtems_task Init( rtems_id task_id; rtems_status_code status; + Print_Warning(); + puts( "\n\n*** TIME TEST 12 ***" ); status = rtems_task_create( @@ -127,6 +126,7 @@ rtems_task High_task( CALLING_OVERHEAD_MESSAGE_QUEUE_SEND ); + puts( "*** END OF TEST 12 ***" ); exit( 0 ); } diff --git a/c/src/tests/tmtests/tm13/system.h b/c/src/tests/tmtests/tm13/system.h index 4444a53c4c..99de69201e 100644 --- a/c/src/tests/tmtests/tm13/system.h +++ b/c/src/tests/tmtests/tm13/system.h @@ -17,5 +17,25 @@ #include <coverhd.h> #include <tmacros.h> +/* functions */ + +rtems_task Init( + rtems_task_argument argument +); + #include <timesys.h> -#include <timegvar.h> + +/* configuration information */ + +#define CONFIGURE_TMTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 111 +#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 +#define CONFIGURE_TICKS_PER_TIMESLICE 0 + +#include <confdefs.h> + +/* end of include file */ diff --git a/c/src/tests/tmtests/tm13/task1.c b/c/src/tests/tmtests/tm13/task1.c index 45df61e2b1..2a66a38e33 100644 --- a/c/src/tests/tmtests/tm13/task1.c +++ b/c/src/tests/tmtests/tm13/task1.c @@ -11,11 +11,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_id Queue_id; @@ -40,6 +37,8 @@ void Init( rtems_status_code status; rtems_id id; + Print_Warning(); + puts( "\n\n*** TIME TEST 13 ***" ); status = rtems_task_create( @@ -150,5 +149,6 @@ rtems_task High_task( CALLING_OVERHEAD_MESSAGE_QUEUE_URGENT ); + puts( "*** END OF TEST 13 ***" ); exit( 0 ); } diff --git a/c/src/tests/tmtests/tm14/system.h b/c/src/tests/tmtests/tm14/system.h index 4444a53c4c..99de69201e 100644 --- a/c/src/tests/tmtests/tm14/system.h +++ b/c/src/tests/tmtests/tm14/system.h @@ -17,5 +17,25 @@ #include <coverhd.h> #include <tmacros.h> +/* functions */ + +rtems_task Init( + rtems_task_argument argument +); + #include <timesys.h> -#include <timegvar.h> + +/* configuration information */ + +#define CONFIGURE_TMTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 111 +#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 +#define CONFIGURE_TICKS_PER_TIMESLICE 0 + +#include <confdefs.h> + +/* end of include file */ diff --git a/c/src/tests/tmtests/tm14/task1.c b/c/src/tests/tmtests/tm14/task1.c index be27545d31..d799f0963c 100644 --- a/c/src/tests/tmtests/tm14/task1.c +++ b/c/src/tests/tmtests/tm14/task1.c @@ -11,11 +11,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_id Queue_id; @@ -41,6 +38,8 @@ rtems_task Init( rtems_id task_id; rtems_status_code status; + Print_Warning(); + puts( "\n\n*** TIME TEST 14 ***" ); status = rtems_task_create( @@ -127,6 +126,7 @@ rtems_task High_task( CALLING_OVERHEAD_MESSAGE_QUEUE_URGENT ); + puts( "*** END OF TEST 14 ***" ); exit( 0 ); } diff --git a/c/src/tests/tmtests/tm15/system.h b/c/src/tests/tmtests/tm15/system.h index 4444a53c4c..99de69201e 100644 --- a/c/src/tests/tmtests/tm15/system.h +++ b/c/src/tests/tmtests/tm15/system.h @@ -17,5 +17,25 @@ #include <coverhd.h> #include <tmacros.h> +/* functions */ + +rtems_task Init( + rtems_task_argument argument +); + #include <timesys.h> -#include <timegvar.h> + +/* configuration information */ + +#define CONFIGURE_TMTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 111 +#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 +#define CONFIGURE_TICKS_PER_TIMESLICE 0 + +#include <confdefs.h> + +/* end of include file */ diff --git a/c/src/tests/tmtests/tm15/task1.c b/c/src/tests/tmtests/tm15/task1.c index 05fb29461b..86efae5cb2 100644 --- a/c/src/tests/tmtests/tm15/task1.c +++ b/c/src/tests/tmtests/tm15/task1.c @@ -11,11 +11,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_unsigned32 time_set, eventout; @@ -35,6 +32,8 @@ rtems_task Init( { rtems_status_code status; + Print_Warning(); + puts( "\n\n*** TIME TEST 15 ***" ); test_init(); @@ -193,6 +192,7 @@ rtems_task Low_task( CALLING_OVERHEAD_EVENT_SEND ); + puts( "*** END OF TEST 15 ***" ); exit( 0 ); } diff --git a/c/src/tests/tmtests/tm16/system.h b/c/src/tests/tmtests/tm16/system.h index 4444a53c4c..99de69201e 100644 --- a/c/src/tests/tmtests/tm16/system.h +++ b/c/src/tests/tmtests/tm16/system.h @@ -17,5 +17,25 @@ #include <coverhd.h> #include <tmacros.h> +/* functions */ + +rtems_task Init( + rtems_task_argument argument +); + #include <timesys.h> -#include <timegvar.h> + +/* configuration information */ + +#define CONFIGURE_TMTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 111 +#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 +#define CONFIGURE_TICKS_PER_TIMESLICE 0 + +#include <confdefs.h> + +/* end of include file */ diff --git a/c/src/tests/tmtests/tm16/task1.c b/c/src/tests/tmtests/tm16/task1.c index a837c72014..996cbecb5f 100644 --- a/c/src/tests/tmtests/tm16/task1.c +++ b/c/src/tests/tmtests/tm16/task1.c @@ -11,11 +11,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_unsigned32 Task_count; @@ -38,6 +35,8 @@ rtems_task Init( rtems_id id; rtems_status_code status; + Print_Warning(); + puts( "\n\n*** TIME TEST 16 ***" ); status = rtems_task_create( @@ -144,5 +143,6 @@ rtems_task High_task( CALLING_OVERHEAD_EVENT_SEND ); + puts( "*** END OF TEST 16 ***" ); exit( 0 ); } diff --git a/c/src/tests/tmtests/tm17/system.h b/c/src/tests/tmtests/tm17/system.h index 4444a53c4c..99de69201e 100644 --- a/c/src/tests/tmtests/tm17/system.h +++ b/c/src/tests/tmtests/tm17/system.h @@ -17,5 +17,25 @@ #include <coverhd.h> #include <tmacros.h> +/* functions */ + +rtems_task Init( + rtems_task_argument argument +); + #include <timesys.h> -#include <timegvar.h> + +/* configuration information */ + +#define CONFIGURE_TMTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 111 +#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 +#define CONFIGURE_TICKS_PER_TIMESLICE 0 + +#include <confdefs.h> + +/* end of include file */ diff --git a/c/src/tests/tmtests/tm17/task1.c b/c/src/tests/tmtests/tm17/task1.c index fbf658799b..187f470231 100644 --- a/c/src/tests/tmtests/tm17/task1.c +++ b/c/src/tests/tmtests/tm17/task1.c @@ -11,11 +11,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_unsigned32 Task_count; rtems_task_priority Task_priority; @@ -40,6 +37,8 @@ rtems_task Init( rtems_unsigned32 index; rtems_status_code status; + Print_Warning(); + puts( "\n\n*** TIME TEST 17 ***" ); Task_priority = 254; @@ -123,5 +122,6 @@ rtems_task Last_task( CALLING_OVERHEAD_TASK_SET_PRIORITY ); + puts( "*** END OF TEST 17 ***" ); exit( 0 ); } diff --git a/c/src/tests/tmtests/tm18/system.h b/c/src/tests/tmtests/tm18/system.h index 4444a53c4c..99de69201e 100644 --- a/c/src/tests/tmtests/tm18/system.h +++ b/c/src/tests/tmtests/tm18/system.h @@ -17,5 +17,25 @@ #include <coverhd.h> #include <tmacros.h> +/* functions */ + +rtems_task Init( + rtems_task_argument argument +); + #include <timesys.h> -#include <timegvar.h> + +/* configuration information */ + +#define CONFIGURE_TMTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 111 +#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 +#define CONFIGURE_TICKS_PER_TIMESLICE 0 + +#include <confdefs.h> + +/* end of include file */ diff --git a/c/src/tests/tmtests/tm18/task1.c b/c/src/tests/tmtests/tm18/task1.c index c5b529f988..e2b44dac31 100644 --- a/c/src/tests/tmtests/tm18/task1.c +++ b/c/src/tests/tmtests/tm18/task1.c @@ -11,11 +11,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_unsigned32 taskcount; rtems_task_priority taskpri; @@ -41,6 +38,8 @@ rtems_task Init( { rtems_status_code status; + Print_Warning(); + puts( "\n\n*** TIME TEST 18 ***" ); test_init(); @@ -108,5 +107,6 @@ rtems_task Last_task( CALLING_OVERHEAD_TASK_DELETE ); + puts( "*** END OF TEST 18 ***" ); exit( 0 ); } diff --git a/c/src/tests/tmtests/tm19/system.h b/c/src/tests/tmtests/tm19/system.h index 4444a53c4c..99de69201e 100644 --- a/c/src/tests/tmtests/tm19/system.h +++ b/c/src/tests/tmtests/tm19/system.h @@ -17,5 +17,25 @@ #include <coverhd.h> #include <tmacros.h> +/* functions */ + +rtems_task Init( + rtems_task_argument argument +); + #include <timesys.h> -#include <timegvar.h> + +/* configuration information */ + +#define CONFIGURE_TMTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 111 +#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 +#define CONFIGURE_TICKS_PER_TIMESLICE 0 + +#include <confdefs.h> + +/* end of include file */ diff --git a/c/src/tests/tmtests/tm19/task1.c b/c/src/tests/tmtests/tm19/task1.c index 7c491b7572..a0c4b7159b 100644 --- a/c/src/tests/tmtests/tm19/task1.c +++ b/c/src/tests/tmtests/tm19/task1.c @@ -11,11 +11,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_asr Process_asr_for_pass_1( rtems_signal_set signals @@ -43,6 +40,8 @@ rtems_task Init( { rtems_status_code status; + Print_Warning(); + puts( "\n\n*** TIME TEST 19 ***" ); status = rtems_task_create( @@ -208,5 +207,6 @@ rtems_task Task_3( 0 ); + puts( "*** END OF TEST 19 ***" ); exit( 0 ); } diff --git a/c/src/tests/tmtests/tm20/system.h b/c/src/tests/tmtests/tm20/system.h index 4444a53c4c..f172828ad2 100644 --- a/c/src/tests/tmtests/tm20/system.h +++ b/c/src/tests/tmtests/tm20/system.h @@ -17,5 +17,26 @@ #include <coverhd.h> #include <tmacros.h> +/* functions */ + +rtems_task Init( + rtems_task_argument argument +); + #include <timesys.h> -#include <timegvar.h> + +/* configuration information */ + +#define CONFIGURE_TMTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER +#define CONFIGURE_TEST_NEEDS_STUB_DRIVER + +#define CONFIGURE_MAXIMUM_PARTITIONS 1 +#define CONFIGURE_MAXIMUM_REGIONS 1 +#define CONFIGURE_TICKS_PER_TIMESLICE 0 + +#include <confdefs.h> + +/* end of include file */ diff --git a/c/src/tests/tmtests/tm20/task1.c b/c/src/tests/tmtests/tm20/task1.c index fdd44d510c..756a957b22 100644 --- a/c/src/tests/tmtests/tm20/task1.c +++ b/c/src/tests/tmtests/tm20/task1.c @@ -11,13 +11,10 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" -rtems_device_major_number _STUB_major = 0; +rtems_device_major_number _STUB_major = 1; rtems_id Region_id; rtems_name Region_name; @@ -50,6 +47,8 @@ rtems_task Init( { rtems_status_code status; + Print_Warning(); + puts( "\n\n*** TIME TEST 20 ***" ); status = rtems_task_create( @@ -425,6 +424,7 @@ rtems_task Task_1( CALLING_OVERHEAD_IO_CONTROL ); + puts( "*** END OF TEST 20 ***" ); exit( 0 ); } diff --git a/c/src/tests/tmtests/tm21/system.h b/c/src/tests/tmtests/tm21/system.h index 4444a53c4c..f2831954e6 100644 --- a/c/src/tests/tmtests/tm21/system.h +++ b/c/src/tests/tmtests/tm21/system.h @@ -17,5 +17,32 @@ #include <coverhd.h> #include <tmacros.h> +/* functions */ + +rtems_task Init( + rtems_task_argument argument +); + #include <timesys.h> -#include <timegvar.h> + +/* configuration information */ + +#define CONFIGURE_TMTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 102 +#define CONFIGURE_MAXIMUM_TIMERS 100 +#define CONFIGURE_MAXIMUM_SEMAPHORES 100 +#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 100 +#define CONFIGURE_MAXIMUM_PARTITIONS 100 +#define CONFIGURE_MAXIMUM_REGIONS 100 +#define CONFIGURE_MAXIMUM_PORTS 100 +#define CONFIGURE_MAXIMUM_PERIODS 100 + +#define CONFIGURE_TICKS_PER_TIMESLICE 0 + +#include <confdefs.h> + +/* end of include file */ diff --git a/c/src/tests/tmtests/tm21/task1.c b/c/src/tests/tmtests/tm21/task1.c index 3bd8dc61dc..8f3bbbd837 100644 --- a/c/src/tests/tmtests/tm21/task1.c +++ b/c/src/tests/tmtests/tm21/task1.c @@ -11,11 +11,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_unsigned8 Region_area[ 2048 ] CPU_STRUCTURE_ALIGNMENT; rtems_unsigned8 Partition_area[ 2048 ] CPU_STRUCTURE_ALIGNMENT; @@ -31,6 +28,8 @@ rtems_task Init( rtems_id id; rtems_status_code status; + Print_Warning(); + puts( "\n\n*** TIME TEST 21 ***" ); status = rtems_task_create( @@ -232,5 +231,6 @@ rtems_task Task_1( CALLING_OVERHEAD_RATE_MONOTONIC_IDENT ); + puts( "*** END OF TEST 21 ***" ); exit( 0 ); } diff --git a/c/src/tests/tmtests/tm22/system.h b/c/src/tests/tmtests/tm22/system.h index 4444a53c4c..a7d66a30cc 100644 --- a/c/src/tests/tmtests/tm22/system.h +++ b/c/src/tests/tmtests/tm22/system.h @@ -17,5 +17,25 @@ #include <coverhd.h> #include <tmacros.h> +/* functions */ + +rtems_task Init( + rtems_task_argument argument +); + #include <timesys.h> -#include <timegvar.h> + +/* configuration information */ + +#define CONFIGURE_TMTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 103 +#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 +#define CONFIGURE_TICKS_PER_TIMESLICE 0 + +#include <confdefs.h> + +/* end of include file */ diff --git a/c/src/tests/tmtests/tm22/task1.c b/c/src/tests/tmtests/tm22/task1.c index 21983d8818..63ae155978 100644 --- a/c/src/tests/tmtests/tm22/task1.c +++ b/c/src/tests/tmtests/tm22/task1.c @@ -11,11 +11,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_id Queue_id; @@ -40,6 +37,8 @@ rtems_task Init( rtems_id id; rtems_status_code status; + Print_Warning(); + puts( "\n\n*** TIME TEST 22 ***" ); status = rtems_message_queue_create( @@ -179,6 +178,7 @@ rtems_task Low_task( CALLING_OVERHEAD_MESSAGE_QUEUE_BROADCAST ); + puts( "*** END OF TEST 22 ***" ); exit( 0 ); } diff --git a/c/src/tests/tmtests/tm23/system.h b/c/src/tests/tmtests/tm23/system.h index 4444a53c4c..877649e397 100644 --- a/c/src/tests/tmtests/tm23/system.h +++ b/c/src/tests/tmtests/tm23/system.h @@ -17,5 +17,25 @@ #include <coverhd.h> #include <tmacros.h> +/* functions */ + +rtems_task Init( + rtems_task_argument argument +); + #include <timesys.h> -#include <timegvar.h> + +/* configuration information */ + +#define CONFIGURE_TMTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 111 +#define CONFIGURE_MAXIMUM_TIMERS 110 +#define CONFIGURE_TICKS_PER_TIMESLICE 0 + +#include <confdefs.h> + +/* end of include file */ diff --git a/c/src/tests/tmtests/tm23/task1.c b/c/src/tests/tmtests/tm23/task1.c index 8b3e6dbccc..4fa36a8a25 100644 --- a/c/src/tests/tmtests/tm23/task1.c +++ b/c/src/tests/tmtests/tm23/task1.c @@ -11,11 +11,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_id Timer_id[ OPERATION_COUNT+1 ]; @@ -50,6 +47,8 @@ rtems_task Init( rtems_task_entry task_entry; rtems_status_code status; + Print_Warning(); + puts( "\n\n*** TIME TEST 23 ***" ); Timer_initialize(); @@ -298,5 +297,6 @@ rtems_task Low_task( CALLING_OVERHEAD_TASK_WAKE_WHEN ); + puts( "*** END OF TEST 23 ***" ); exit( 0 ); } diff --git a/c/src/tests/tmtests/tm24/system.h b/c/src/tests/tmtests/tm24/system.h index 4444a53c4c..6b2f2c420b 100644 --- a/c/src/tests/tmtests/tm24/system.h +++ b/c/src/tests/tmtests/tm24/system.h @@ -17,5 +17,24 @@ #include <coverhd.h> #include <tmacros.h> +/* functions */ + +rtems_task Init( + rtems_task_argument argument +); + #include <timesys.h> -#include <timegvar.h> + +/* configuration information */ + +#define CONFIGURE_TMTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 111 +#define CONFIGURE_TICKS_PER_TIMESLICE 0 + +#include <confdefs.h> + +/* end of include file */ diff --git a/c/src/tests/tmtests/tm24/task1.c b/c/src/tests/tmtests/tm24/task1.c index 160116ca16..2cc0046bd0 100644 --- a/c/src/tests/tmtests/tm24/task1.c +++ b/c/src/tests/tmtests/tm24/task1.c @@ -11,11 +11,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_unsigned32 Task_count; @@ -35,6 +32,8 @@ rtems_task Init( rtems_unsigned32 index; rtems_status_code status; + Print_Warning(); + puts( "\n\n*** TIME TEST 24 ***" ); status = rtems_task_create( @@ -118,6 +117,7 @@ rtems_task Tasks( CALLING_OVERHEAD_TASK_WAKE_AFTER ); + puts( "*** END OF TEST 24 ***" ); exit( 0 ); } (void) rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); diff --git a/c/src/tests/tmtests/tm25/system.h b/c/src/tests/tmtests/tm25/system.h index 4444a53c4c..74eb108e3e 100644 --- a/c/src/tests/tmtests/tm25/system.h +++ b/c/src/tests/tmtests/tm25/system.h @@ -17,5 +17,25 @@ #include <coverhd.h> #include <tmacros.h> +/* functions */ + +rtems_task Init( + rtems_task_argument argument +); + #include <timesys.h> -#include <timegvar.h> + +/* configuration information */ + +#define CONFIGURE_TMTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 111 +#define CONFIGURE_MAXIMUM_SEMAPHORES 1 +#define CONFIGURE_TICKS_PER_TIMESLICE 0 + +#include <confdefs.h> + +/* end of include file */ diff --git a/c/src/tests/tmtests/tm25/task1.c b/c/src/tests/tmtests/tm25/task1.c index 26eaa2a452..8e6fda4b68 100644 --- a/c/src/tests/tmtests/tm25/task1.c +++ b/c/src/tests/tmtests/tm25/task1.c @@ -11,11 +11,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_id Semaphore_id; @@ -35,6 +32,8 @@ rtems_task Init( rtems_unsigned32 index; rtems_status_code status; + Print_Warning(); + puts( "\n\n*** TIME TEST 25 ***" ); status = rtems_semaphore_create( @@ -105,5 +104,6 @@ rtems_task Low_task( CALLING_OVERHEAD_CLOCK_TICK ); + puts( "*** END OF TEST 25 ***" ); exit( 0 ); } diff --git a/c/src/tests/tmtests/tm26/system.h b/c/src/tests/tmtests/tm26/system.h index f76f6855b5..74eb108e3e 100644 --- a/c/src/tests/tmtests/tm26/system.h +++ b/c/src/tests/tmtests/tm26/system.h @@ -14,9 +14,28 @@ */ -#include <bsp.h> #include <coverhd.h> #include <tmacros.h> +/* functions */ + +rtems_task Init( + rtems_task_argument argument +); + #include <timesys.h> -#include <timegvar.h> + +/* configuration information */ + +#define CONFIGURE_TMTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 111 +#define CONFIGURE_MAXIMUM_SEMAPHORES 1 +#define CONFIGURE_TICKS_PER_TIMESLICE 0 + +#include <confdefs.h> + +/* end of include file */ diff --git a/c/src/tests/tmtests/tm26/task1.c b/c/src/tests/tmtests/tm26/task1.c index 745e2682f1..ed94b3c8ae 100644 --- a/c/src/tests/tmtests/tm26/task1.c +++ b/c/src/tests/tmtests/tm26/task1.c @@ -11,6 +11,7 @@ * $Id$ */ +#define TEST_INIT #include <rtems.h> #include "system.h" #include "fptest.h" @@ -18,12 +19,6 @@ #include <tmacros.h> #include <timesys.h> -#undef EXTERN -#define EXTERN -#include "gvar.h" -#include "conftbl.h" -#undef EXTERN -#define EXTERN extern /* TEST DATA */ rtems_id Semaphore_id; @@ -70,6 +65,8 @@ rtems_task Init( rtems_id task_id; rtems_status_code status; + Print_Warning(); + puts( "\n\n*** TIME TEST 26 ***" ); status = rtems_task_create( @@ -545,6 +542,8 @@ void complete_test( void ) 0, 0 ); + + puts( "*** END OF TEST 26 ***" ); exit( 0 ); } diff --git a/c/src/tests/tmtests/tm27/system.h b/c/src/tests/tmtests/tm27/system.h index 4444a53c4c..6b2f2c420b 100644 --- a/c/src/tests/tmtests/tm27/system.h +++ b/c/src/tests/tmtests/tm27/system.h @@ -17,5 +17,24 @@ #include <coverhd.h> #include <tmacros.h> +/* functions */ + +rtems_task Init( + rtems_task_argument argument +); + #include <timesys.h> -#include <timegvar.h> + +/* configuration information */ + +#define CONFIGURE_TMTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 111 +#define CONFIGURE_TICKS_PER_TIMESLICE 0 + +#include <confdefs.h> + +/* end of include file */ diff --git a/c/src/tests/tmtests/tm27/task1.c b/c/src/tests/tmtests/tm27/task1.c index edd657b40c..b90ae4d65f 100644 --- a/c/src/tests/tmtests/tm27/task1.c +++ b/c/src/tests/tmtests/tm27/task1.c @@ -11,11 +11,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" #include <bsp.h> @@ -51,6 +48,8 @@ rtems_task Init( { rtems_status_code status; + Print_Warning(); + puts( "\n\n*** TIME TEST 27 ***" ); status = rtems_task_create( @@ -186,6 +185,7 @@ rtems_task Task_2( 0 ); + puts( "*** END OF TEST 27 ***" ); exit( 0 ); } diff --git a/c/src/tests/tmtests/tm28/system.h b/c/src/tests/tmtests/tm28/system.h index 4444a53c4c..4fa010796f 100644 --- a/c/src/tests/tmtests/tm28/system.h +++ b/c/src/tests/tmtests/tm28/system.h @@ -17,5 +17,25 @@ #include <coverhd.h> #include <tmacros.h> +/* functions */ + +rtems_task Init( + rtems_task_argument argument +); + #include <timesys.h> -#include <timegvar.h> + +/* configuration information */ + +#define CONFIGURE_TMTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 2 +#define CONFIGURE_MAXIMUM_PORTS 1 +#define CONFIGURE_TICKS_PER_TIMESLICE 0 + +#include <confdefs.h> + +/* end of include file */ diff --git a/c/src/tests/tmtests/tm28/task1.c b/c/src/tests/tmtests/tm28/task1.c index c6af6fb03f..bd0682be19 100644 --- a/c/src/tests/tmtests/tm28/task1.c +++ b/c/src/tests/tmtests/tm28/task1.c @@ -11,16 +11,13 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_id Port_id; -rtems_unsigned8 Internal_area[ 256 ]; -rtems_unsigned8 External_area[ 256 ]; +rtems_unsigned8 Internal_area[ 256 ] CPU_STRUCTURE_ALIGNMENT; +rtems_unsigned8 External_area[ 256 ] CPU_STRUCTURE_ALIGNMENT; rtems_task Test_task( rtems_task_argument argument @@ -32,6 +29,8 @@ rtems_task Init( { rtems_status_code status; + Print_Warning(); + puts( "\n\n*** TIME TEST 28 ***" ); status = rtems_task_create( @@ -130,5 +129,6 @@ rtems_task Test_task ( CALLING_OVERHEAD_PORT_DELETE ); + puts( "*** END OF TEST 28 ***" ); exit( 0 ); } diff --git a/c/src/tests/tmtests/tm29/system.h b/c/src/tests/tmtests/tm29/system.h index 4444a53c4c..d2fa07c5f4 100644 --- a/c/src/tests/tmtests/tm29/system.h +++ b/c/src/tests/tmtests/tm29/system.h @@ -17,5 +17,25 @@ #include <coverhd.h> #include <tmacros.h> +/* functions */ + +rtems_task Init( + rtems_task_argument argument +); + #include <timesys.h> -#include <timegvar.h> + +/* configuration information */ + +#define CONFIGURE_TMTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 111 +#define CONFIGURE_MAXIMUM_PERIODS 111 +#define CONFIGURE_TICKS_PER_TIMESLICE 0 + +#include <confdefs.h> + +/* end of include file */ diff --git a/c/src/tests/tmtests/tm29/task1.c b/c/src/tests/tmtests/tm29/task1.c index a38e9567c8..0958765c4c 100644 --- a/c/src/tests/tmtests/tm29/task1.c +++ b/c/src/tests/tmtests/tm29/task1.c @@ -11,11 +11,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_name Period_name; @@ -37,6 +34,8 @@ rtems_task Init( rtems_unsigned32 index; rtems_status_code status; + Print_Warning(); + puts( "\n\n*** TIME TEST 29 ***" ); Period_name = rtems_build_name( 'P', 'R', 'D', ' ' ); @@ -203,5 +202,6 @@ rtems_task Low_task( CALLING_OVERHEAD_RATE_MONOTONIC_PERIOD ); + puts( "*** END OF TEST 29 ***" ); exit( 0 ); } diff --git a/c/src/tests/tmtests/tmck/system.h b/c/src/tests/tmtests/tmck/system.h index 4444a53c4c..8b1c9b0ddd 100644 --- a/c/src/tests/tmtests/tmck/system.h +++ b/c/src/tests/tmtests/tmck/system.h @@ -17,5 +17,24 @@ #include <coverhd.h> #include <tmacros.h> +/* functions */ + +rtems_task Init( + rtems_task_argument argument +); + #include <timesys.h> -#include <timegvar.h> + +/* configuration information */ + +#define CONFIGURE_TMTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 2111 +#define CONFIGURE_TICKS_PER_TIMESLICE 0 + +#include <confdefs.h> + +/* end of include file */ diff --git a/c/src/tests/tmtests/tmck/task1.c b/c/src/tests/tmtests/tmck/task1.c index 39f1490c00..34eb674f4d 100644 --- a/c/src/tests/tmtests/tmck/task1.c +++ b/c/src/tests/tmtests/tmck/task1.c @@ -12,11 +12,8 @@ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" #define MAXIMUM_DISTRIBUTION 10000 @@ -44,6 +41,8 @@ rtems_task Init( Set_find_average_overhead( 1 ); + Print_Warning(); + puts( "\n\n*** TIME CHECKER ***" ); Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ), @@ -137,6 +136,7 @@ pause(); 0 ); + puts( "*** END OF TIME CHECKER ***" ); exit( 0 ); } diff --git a/c/src/tests/tmtests/tmoverhd/system.h b/c/src/tests/tmtests/tmoverhd/system.h index 4444a53c4c..9fbbf116dd 100644 --- a/c/src/tests/tmtests/tmoverhd/system.h +++ b/c/src/tests/tmtests/tmoverhd/system.h @@ -17,5 +17,42 @@ #include <coverhd.h> #include <tmacros.h> +/* functions */ + +rtems_task Init( + rtems_task_argument argument +); + +rtems_timer_service_routine Timer_handler( + rtems_id argument +); + +rtems_asr Isr_handler( + rtems_signal_set signals +); + +rtems_asr Asr_handler( + rtems_signal_set signals +); + +rtems_task task_func(); + +void null_func(); + +rtems_status_code Empty_directive(); + #include <timesys.h> -#include <timegvar.h> + +/* configuration information */ + +#define CONFIGURE_TMTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 2 +#define CONFIGURE_TICKS_PER_TIMESLICE 0 + +#include <confdefs.h> + +/* end of include file */ diff --git a/c/src/tests/tmtests/tmoverhd/testtask.c b/c/src/tests/tmtests/tmoverhd/testtask.c index 9daa1f0949..f5cac161bb 100644 --- a/c/src/tests/tmtests/tmoverhd/testtask.c +++ b/c/src/tests/tmtests/tmoverhd/testtask.c @@ -11,11 +11,8 @@ * $Id$ */ +#define TEST_INIT #include "system.h" -#undef EXTERN -#define EXTERN -#include "conftbl.h" -#include "gvar.h" rtems_unsigned8 Memory_area[ 2048 ]; rtems_unsigned8 Internal_port_area[ 256 ]; @@ -33,7 +30,9 @@ rtems_task Init( Set_find_average_overhead( TRUE ); - puts( "\n\n*** TIME TEST overhead ***" ); + Print_Warning(); + + puts( "\n\n*** TIME TEST OVERHEAD ***" ); status = rtems_task_create( rtems_build_name( 'T', 'A', '1', ' ' ), @@ -1274,7 +1273,7 @@ pause(); 0 ); - puts( "*** END OF TIME OVERHEAD ***\n" ); + puts( "*** END OF TIME OVERHEAD ***" ); exit( 0 ); } |