Thread iterator and libgjc support submitted too early.

This commit is contained in:
Joel Sherrill
2000-06-14 13:38:47 +00:00
parent caacc739ff
commit fdcb2b52b7
28 changed files with 19 additions and 2086 deletions
@@ -443,21 +443,6 @@ Objects_Control *_Objects_Get (
Objects_Locations *location
);
/*
* _Objects_Get_by_index
*
* DESCRIPTION:
*
* This routine sets the object pointer for the given
* object id based on the given object information structure.
*/
Objects_Control *_Objects_Get_by_index(
Objects_Information *information,
unsigned32 index,
Objects_Locations *location
);
/*
* _Objects_Get_next
*
@@ -474,25 +459,6 @@ Objects_Control *_Objects_Get_next(
Objects_Id *next_id_p
);
/*
* _Objects_Local_iterate
*
* DESCRIPTION:
*
* This function invokes the callback function for each existing object
* of the type specified by the information block pointer. Iteration
* continues until either all objects have been processed, or, if
* break_on_error is TRUE, until an invocation of the callback returns
* something other than 0.
*/
unsigned32 _Objects_Local_iterate(
Objects_Information *information,
unsigned32 (*callback)(Objects_Control *object, void * arg),
void * arg,
boolean break_on_error
);
/*
* Pieces of object.inl are promoted out to the user
*/
@@ -733,23 +733,6 @@ Thread_Control *_Thread_Get (
);
#endif
/*
* _Thread_Local_iterate
*
* DESCRIPTION:
*
* This function invokes the callback function for each existing thread.
* Iteration continues until either all threads have been processed, or,
* if break_on_error is TRUE, until an invocation of the callback returns
* an integer value other than 0.
*/
unsigned32 _Thread_Local_iterate(
unsigned32 (*callback)(Thread_Control *the_thread, void * arg),
void * arg,
boolean break_on_error
);
/*
* _Thread_Idle_body
*
+9 -10
View File
@@ -27,18 +27,17 @@ OBJECT_C_FILES = object.c objectallocate.c objectallocatebyindex.c \
objectclearname.c objectcomparenameraw.c objectcomparenamestring.c \
objectcopynameraw.c objectcopynamestring.c objectextendinformation.c \
objectfree.c objectget.c objectgetbyindex.c objectgetnext.c \
objectinitializeinformation.c objectlocaliterate.c objectnametoid.c \
objectshrinkinformation.c
objectinitializeinformation.c objectnametoid.c objectshrinkinformation.c
THREAD_C_FILES = thread.c threadchangepriority.c threadclearstate.c \
threadclose.c threadcreateidle.c threaddelayended.c threaddispatch.c \
threadevaluatemode.c threadget.c threadhandler.c threadidlebody.c \
threadinitialize.c threadloadenv.c threadlocaliterate.c threadready.c \
threadresettimeslice.c threadreset.c threadrestart.c threadresume.c \
threadrotatequeue.c threadsetpriority.c threadsetstate.c \
threadsettransient.c threadstackallocate.c threadstackfree.c \
threadstart.c threadstartmultitasking.c threadsuspend.c \
threadtickletimeslice.c threadyieldprocessor.c
threadinitialize.c threadloadenv.c threadready.c threadresettimeslice.c \
threadreset.c threadrestart.c threadresume.c threadrotatequeue.c \
threadsetpriority.c threadsetstate.c threadsettransient.c \
threadstackallocate.c threadstackfree.c threadstart.c \
threadstartmultitasking.c threadsuspend.c threadtickletimeslice.c \
threadyieldprocessor.c
THREADQ_C_FILES = threadq.c threadqdequeue.c threadqdequeuefifo.c \
threadqdequeuepriority.c threadqenqueue.c threadqenqueuefifo.c \
@@ -54,8 +53,8 @@ WATCHDOG_C_FILES = watchdog.c watchdogadjust.c watchdoginsert.c \
watchdogremove.c watchdogtickle.c
STD_C_FILES = apiext.c chain.c $(CORE_MESSAGE_QUEUE_C_FILES) \
$(CORE_MUTEX_C_FILES) $(CORE_SEMAPHORE_C_FILES) $(HEAP_C_FILES) \
interr.c isr.c $(OBJECT_C_FILES) $(THREAD_C_FILES) $(THREADQ_C_FILES) \
$(CORE_MUTEX_C_FILES) $(CORE_SEMAPHORE_C_FILES) $(HEAP_C_FILES) interr.c \
isr.c $(OBJECT_C_FILES) $(THREAD_C_FILES) $(THREADQ_C_FILES) \
$(TOD_C_FILES) userext.c $(WATCHDOG_C_FILES) wkspace.c
if HAS_MP
-77
View File
@@ -1,77 +0,0 @@
/*
* object iterator
*
*
* COPYRIGHT (c) 2000.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in found in the file LICENSE in this distribution or at
* http://www.OARcorp.com/rtems/license.html.
*
* $Id$
*/
#include <rtems/system.h>
#include <rtems/score/object.h>
/*PAGE
*
* _Objects_Local_iterate
*
* DESCRIPTION:
*
* This function invokes the callback function for each existing object
* of the type specified by the information block pointer. Iteration
* continues until either all objects have been processed, or, if
* break_on_error is TRUE, until an invocation of the callback returns
* something other than 0.
*
* Input parameters:
* information:
* A pointer to an Objects_Information block. Determines the type of
* object over which to iterate.
* callback:
* A pointer to a function with the indicated signature.
* arg:
* A pointer to some arbitrary entity. Passed on to the callback.
* break_on_error
* If TRUE, stop iterating on error.
*
* Output parameters: NONE
* But callback may write into space pointed to by arg.
*
* Return value:
* 0 if successful
* Value returned by the callback otherwise.
*/
unsigned32 _Objects_Local_iterate(
Objects_Information *information,
unsigned32 (*callback)(Objects_Control *object, void * arg),
void *arg,
boolean break_on_error
)
{
unsigned32 result;
unsigned32 i;
Objects_Control *the_object;
if ( !information )
return 0;
if ( !callback )
return 0;
for( i = 1; i <= information->maximum; i++ ) {
the_object = (Objects_Control *)information->local_table[i];
if( the_object ) {
result = (*callback)( the_object, arg );
if ( result && break_on_error )
return result;
}
}
return 0;
}
-77
View File
@@ -1,77 +0,0 @@
/*
* Thread Iterator
*
*
* COPYRIGHT (c) 2000.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in found in the file LICENSE in this distribution or at
* http://www.OARcorp.com/rtems/license.html.
*
* $Id$
*/
#include <rtems/system.h>
#include <rtems/score/object.h>
#include <rtems/score/thread.h>
/*PAGE
*
* _Thread_Local_iterate
*
* DESCRIPTION:
*
* This function invokes the callback function for each existing thread.
* Iteration continues until either all threads have been processed, or,
* if break_on_error is TRUE, until an invocation of the callback returns
* an integer value other than 0.
*
* Input parameters:
* callback:
* A pointer to a function with the indicated signature.
* arg:
* A pointer to some arbitrary entity. Passed on to the callback.
* break_on_error
* If TRUE, stop iterating on error.
*
*
* Output parameters: NONE
* But callback may write into space pointed to by arg.
*
* Return value:
* 0 if successful
* Value returned by the callback otherwise.
*/
unsigned32 _Thread_Local_iterate(
unsigned32 (*callback)(Thread_Control *the_thread, void * arg),
void *arg,
boolean break_on_error
)
{
unsigned32 class_index;
unsigned32 result;
Objects_Information *information;
if( callback == NULL )
return 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 ) {
result = _Objects_Local_iterate(
information,
(unsigned32 (*)(Objects_Control *, void *))callback,
arg,
break_on_error );
if( result && break_on_error )
return result;
}
}
return 0;
}
+1 -1
View File
@@ -44,7 +44,7 @@ RTEMS_CHECK_ITRON_API(RTEMS_BSP)
if test "$tests_enabled" = "yes"; then
# do functionality tests first, then performance tests
cfg_subdirs="libtests sptests libffi"
cfg_subdirs="libtests sptests"
if test "$HAS_MP" = "yes"; then
cfg_subdirs="$cfg_subdirs mptests"
fi
-13
View File
@@ -1,13 +0,0 @@
Makefile
Makefile.in
aclocal.m4
config.cache
config.guess
config.log
config.status
config.sub
configure
depcomp
install-sh
missing
mkinstalldirs
-13
View File
@@ -1,13 +0,0 @@
##
## $Id$
##
AUTOMAKE_OPTIONS = foreign 1.4
ACLOCAL_AMFLAGS = -I $(RTEMS_TOPdir)/aclocal
SUBDIRS = ffitest
EXTRA_DIST = libffi.am
include $(top_srcdir)/../../../../automake/subdirs.am
include $(top_srcdir)/../../../../automake/local.am
-46
View File
@@ -1,46 +0,0 @@
dnl Process this file with autoconf to produce a configure script.
dnl
dnl $Id$
AC_PREREQ(2.13)
AC_INIT(ffitest)
RTEMS_TOP(../../../..)
AC_CONFIG_AUX_DIR(../../../..)
RTEMS_CANONICAL_TARGET_CPU
AM_INIT_AUTOMAKE(rtems-c-src-tests-libffi,$RTEMS_VERSION,no)
AM_MAINTAINER_MODE
RTEMS_ENABLE_INLINES
RTEMS_ENABLE_CXX
RTEMS_ENABLE_GCC28
RTEMS_ENABLE_BARE
RTEMS_ENV_RTEMSBSP
RTEMS_CHECK_CPU
RTEMS_CANONICAL_HOST
RTEMS_PROJECT_ROOT
RTEMS_PROG_CC_FOR_TARGET
if test "$RTEMS_HAS_CPLUSPLUS" = "yes"; then
RTEMS_PROG_CXX_FOR_TARGET
fi
RTEMS_CANONICALIZE_TOOLS
RTEMS_CHECK_CUSTOM_BSP(RTEMS_BSP)
RTEMS_CHECK_CXX(RTEMS_BSP)
AC_SUBST(BARE_CPU_CFLAGS)
AC_SUBST(BARE_CPU_MODEL)
AM_CONDITIONAL(HAS_CXX,test "$HAS_CPLUSPLUS" = "yes")
# Explicitly list all Makefiles here
AC_OUTPUT(
Makefile
ffitest/Makefile
)
-2
View File
@@ -1,2 +0,0 @@
Makefile
Makefile.in
-43
View File
@@ -1,43 +0,0 @@
##
## $Id$
##
AUTOMAKE_OPTIONS = foreign 1.4
TEST = ffitest
MANAGERS = io
C_FILES = init.c ffitest.c
C_O_FILES = $(C_FILES:%.c=${ARCH}/%.o)
H_FILES = system.h
noinst_HEADERS = $(H_FILES)
DOCTYPES = scn
DOCS = $(DOCTYPES:%=$(TEST).%)
SRCS = $(DOCS) $(C_FILES) $(H_FILES)
OBJS = $(C_O_FILES)
PRINT_SRCS = $(DOCS)
PGM = ${ARCH}/$(TEST).exe
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(RTEMS_ROOT)/make/leaf.cfg
include $(top_srcdir)/libffi.am
#
# (OPTIONAL) Add local stuff here using +=
#
LD_LIBS += -lffi
${PGM}: $(OBJS) $(LINK_FILES)
$(make-exe)
all: ${ARCH} $(TMPINSTALL_FILES)
EXTRA_DIST = $(C_FILES) $(DOCS)
include $(top_srcdir)/../../../../automake/local.am
File diff suppressed because it is too large Load Diff
-35
View File
@@ -1,35 +0,0 @@
/* Init
*
* This routine is the initialization task for this test program.
* It is called from init_exec and has the responsibility for creating
* and starting the tasks that make up the test. If the time of day
* clock is required for the test, it should also be set to a known
* value by this function.
*
* Input parameters: NONE
*
* Output parameters: NONE
*
* COPYRIGHT (c) 1989-1999.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.OARcorp.com/rtems/license.html.
*
*/
#define TEST_INIT
#include "system.h"
extern int ffi_main ( void );
rtems_task Init(
rtems_task_argument ignored
)
{
printf( "\n\n*** LIBFFI TEST ***\n" );
ffi_main();
printf( "*** END OF LIBFFI TEST ***\n" );
exit( 0 );
}
-37
View File
@@ -1,37 +0,0 @@
/* system.h
*
* This include file contains information that is included in every
* function in the test set.
*
* COPYRIGHT (c) 1989-1999.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.OARcorp.com/rtems/license.html.
*
* $Id$
*/
#include <tmacros.h>
/* functions */
rtems_task Init(
rtems_task_argument argument
);
/* configuration information */
#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_MAXIMUM_TASKS 1
#include <confdefs.h>
/* global variables */
TEST_EXTERN rtems_id Global_variable; /* example global variable */
/* end of include file */
-11
View File
@@ -1,11 +0,0 @@
project_bspdir=$(PROJECT_ROOT)/@RTEMS_BSP@
$(project_bspdir)/tests:
@$(mkinstalldirs) $@
$(project_bspdir)/tests/$(TEST)$(LIB_VARIANT).exe: $(PGM)
$(INSTALL_PROGRAM) $< $@
TMPINSTALL_FILES += \
$(project_bspdir)/tests \
$(project_bspdir)/tests/$(TEST)$(LIB_VARIANT).exe
-1
View File
@@ -67,7 +67,6 @@ sp27/Makefile
sp28/Makefile
sp29/Makefile
spsize/Makefile
threaditerate/Makefile
)
# spfatal/Makefile
@@ -1,2 +0,0 @@
Makefile
Makefile.in
@@ -1,43 +0,0 @@
##
## $Id$
##
AUTOMAKE_OPTIONS = foreign 1.4
TEST = threaditerate
MANAGERS = all
C_FILES = init.c threadinfo.c rtemstask.c pthread.c itron_task.c
C_O_FILES = $(C_FILES:%.c=${ARCH}/%.o)
H_FILES = system.h
noinst_HEADERS =$(H_FILES)
DOCTYPES = scn doc
DOCS = $(DOCTYPES:%=$(TEST).%)
SRCS = $(C_FILES) $(H_FILES)
OBJS = $(C_O_FILES)
PRINT_SRCS = $(DOCS)
PGM = ${ARCH}/$(TEST).exe
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(RTEMS_ROOT)/make/leaf.cfg
include $(top_srcdir)/sptests.am
#
# (OPTIONAL) Add local stuff here using +=
#
AM_CPPFLAGS = -I$(top_srcdir)/../psxtests/include
${PGM}: $(OBJS) $(LINK_FILES)
$(make-exe)
all: $(ARCH) $(TMPINSTALL_FILES)
EXTRA_DIST = $(C_FILES) $(DOCS)
include $(top_srcdir)/../../../../automake/local.am
-202
View File
@@ -1,202 +0,0 @@
/* Init
*
* This routine is the initialization task for this test program.
* It is a user initialization task and has the responsibility for creating
* and starting the tasks that make up the test. If the time of day
* clock is required for the test, it should also be set to a known
* value by this function.
*
* Input parameters:
* argument - task argument
*
* Output parameters: NONE
*
* COPYRIGHT (c) 1989-1999.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.OARcorp.com/rtems/license.html.
*
* $Id$
*/
#define TEST_INIT
#include "system.h"
rtems_task Init(
rtems_task_argument argument
)
{
rtems_time_of_day time;
rtems_status_code rtems_status;
#ifdef RTEMS_POSIX_API
int posix_status;
#endif
#ifdef RTEMS_ITRON_API
ER itron_status;
T_CTSK pk_ctsk;
#endif
puts( "\n\n*** Thread Iteration Test ***" );
build_time( &time, 12, 31, 2000, 9, 0, 0, 0 );
rtems_status = rtems_clock_set( &time );
directive_failed( rtems_status, "rtems_clock_set" );
Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
rtems_status = rtems_task_create(
Task_name[ 1 ],
1,
RTEMS_MINIMUM_STACK_SIZE * 2,
RTEMS_INTERRUPT_LEVEL(31),
RTEMS_DEFAULT_ATTRIBUTES,
&Task_id[ 1 ]
);
directive_failed( rtems_status, "rtems_task_create of TA1" );
rtems_status = rtems_task_create(
Task_name[ 2 ],
1,
RTEMS_MINIMUM_STACK_SIZE * 2,
RTEMS_DEFAULT_MODES,
RTEMS_DEFAULT_ATTRIBUTES,
&Task_id[ 2 ]
);
directive_failed( rtems_status, "rtems_task_create of TA2" );
rtems_status = rtems_task_create(
Task_name[ 3 ],
1,
RTEMS_MINIMUM_STACK_SIZE * 3,
RTEMS_DEFAULT_MODES,
RTEMS_DEFAULT_ATTRIBUTES,
&Task_id[ 3 ]
);
directive_failed( rtems_status, "rtems_task_create of TA3" );
rtems_status = rtems_task_start( Task_id[ 1 ], RTEMS_task_1_through_3, 0 );
if ( rtems_status == RTEMS_SUCCESSFUL )
printf("Created and started an RTEMS task with id = 0x%08x\n", Task_id[1] );
else
directive_failed( rtems_status, "rtems_task_start of TA1" );
rtems_status = rtems_task_start( Task_id[ 2 ], RTEMS_task_1_through_3, 0 );
if ( rtems_status == RTEMS_SUCCESSFUL )
printf("Created and started an RTEMS task with id = 0x%08x\n", Task_id[2] );
else
directive_failed( rtems_status, "rtems_task_start of TA2" );
rtems_status = rtems_task_start( Task_id[ 3 ], RTEMS_task_1_through_3, 0 );
if ( rtems_status == RTEMS_SUCCESSFUL )
printf("Created and started an RTEMS task with id = 0x%08x\n", Task_id[3] );
else
directive_failed( rtems_status, "rtems_task_start of TA3" );
#ifdef RTEMS_POSIX_API
posix_status = pthread_create( &pthread_id[0], NULL, pthread_1_through_3, NULL );
if ( !posix_status )
printf("Created and started a pthread with id = 0x%08x\n", pthread_id[0] );
else
assert( !posix_status );
posix_status = pthread_create( &pthread_id[1], NULL, pthread_1_through_3, NULL );
if ( !posix_status )
printf("Created and started a pthread with id = 0x%08x\n", pthread_id[1] );
else
assert( !posix_status );
posix_status = pthread_create( &pthread_id[2], NULL, pthread_1_through_3, NULL );
if ( !posix_status )
printf("Created and started a pthread with id = 0x%08x\n", pthread_id[2] );
else
assert( !posix_status );
#endif
#ifdef RTEMS_ITRON_API
#define ITRON_GET_TASK_ID(_index) \
_ITRON_Task_Information.local_table[_index]->id
pk_ctsk.exinf = NULL;
pk_ctsk.tskatr = TA_HLNG;
pk_ctsk.itskpri = 1;
pk_ctsk.task = ITRON_task_2_through_4;
pk_ctsk.stksz = RTEMS_MINIMUM_STACK_SIZE * 2;
itron_status = cre_tsk( 2, &pk_ctsk );
directive_failed( itron_status, "cre_tsk of task" );
pk_ctsk.stksz = RTEMS_MINIMUM_STACK_SIZE * 2;
itron_status = cre_tsk( 3, &pk_ctsk );
directive_failed( itron_status, "cre_tsk of TA2" );
pk_ctsk.stksz = RTEMS_MINIMUM_STACK_SIZE * 3;
itron_status = cre_tsk( 4, &pk_ctsk );
directive_failed( itron_status, "cre_tsk of TA3" );
itron_status = sta_tsk( 2, 0 );
if ( !itron_status )
printf("Created and started an ITRON task with id = 0x%08x\n", ITRON_GET_TASK_ID( 2 ) );
else
directive_failed( itron_status, "sta_tsk of ITRON task 2" );
itron_status = sta_tsk( 3, 0 );
if ( !itron_status )
printf("Created and started an ITRON task with id = 0x%08x\n", ITRON_GET_TASK_ID( 3 ) );
else
directive_failed( itron_status, "sta_tsk of ITRON task 3" );
itron_status = sta_tsk( 4, 0 );
if ( !itron_status )
printf("Created and started an ITRON task with id = 0x%08x\n", ITRON_GET_TASK_ID( 4 ) );
else
directive_failed( itron_status, "sta_tsk of ITRON task 4" );
#endif
printf( "Sleeping for 5 seconds\n" );
fflush( stdout );
rtems_status = rtems_task_wake_after( 5 * TICKS_PER_SECOND );
directive_failed( rtems_status, "rtems_task_wake_after" );
printf( "\nLooking for all threads\n\n" );
_Thread_Local_iterate( print_thread_info, NULL, FALSE );
printf( "That was it. Sleeping for 20 seconds.\n" );
rtems_status = rtems_task_wake_after( 20 * TICKS_PER_SECOND );
directive_failed( rtems_status, "rtems_task_wake_after" );
/* If we get here, all threads were created */
printf( "\nDeleting the second thread of each type\n\n" );
rtems_status = rtems_task_suspend( Task_id[2] );
directive_failed( rtems_status, "rtems_task_suspend" );
rtems_status = rtems_task_delete( Task_id[2] );
directive_failed( rtems_status, "rtems_task_delete" );
#ifdef RTEMS_POSIX_API
posix_status = pthread_cancel( pthread_id[2] );
assert( !posix_status );
#endif
#ifdef RTEMS_ITRON_API
itron_status = ter_tsk( 3 );
directive_failed( itron_status, "ter_tsk of ITRON task 3" );
#endif
printf( "\nLooking for all threads\n\n" );
_Thread_Local_iterate( print_thread_info, NULL, FALSE );
printf( "That was it. Exiting\n" );
fflush( stdout );
exit( 0 );
}
@@ -1,52 +0,0 @@
/* Task_1_through_3
*
* This routine serves as a test task. It verifies the basic task
* switching capabilities of the executive.
*
* Input parameters:
* argument - task argument
*
* Output parameters: NONE
*
* COPYRIGHT (c) 1989-1999.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.OARcorp.com/rtems/license.html.
*
* $Id$
*/
#include "system.h"
void ITRON_task_2_through_4( void )
{
ID tid;
int tid_index;
rtems_time_of_day time;
ER status;
char name[30];
status = get_tid( &tid );
directive_failed( status, "get_tid");
tid_index = tid - 1; /* account for init tasks */
status = rtems_task_wake_after( 10 * TICKS_PER_SECOND );
directive_failed( status, "rtems_task_wake_after" );
sprintf(name, "ITRON task %d", tid_index);
while( FOREVER ) {
status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
directive_failed( status, "rtems_clock_get" );
printf(name);
print_time( " - rtems_clock_get - ", &time, "\n" );
status = rtems_task_wake_after( 30 * TICKS_PER_SECOND );
directive_failed( status, "rtems_task_wake_after" );
}
}
@@ -1,46 +0,0 @@
/* pthread_1_through_3
*
* This routine serves as a test task. It verifies the basic task
* switching capabilities of the executive.
*
* Input parameters:
* argument - task argument
*
* Output parameters: NONE
*
* COPYRIGHT (c) 1989-1999.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.OARcorp.com/rtems/license.html.
*
* $Id$
*/
#include "system.h"
#include <sys/utsname.h>
void * pthread_1_through_3( void *argument )
{
int status;
struct timespec tv;
struct timespec tr;
time_t remaining;
remaining = sleep( 10 );
assert( !remaining );
while( FOREVER ) {
status = clock_gettime( CLOCK_REALTIME, &tv );
posix_service_failed( status, "clock_gettime" );
printf( "pthread: ID is 0x%08x\n", pthread_self() );
printf( " - clock_gettime - %s\n", ctime( &tv.tv_sec ) );
remaining = sleep( 30 );
assert( !remaining );
}
return NULL; /* just so the compiler thinks we returned something */
}
@@ -1,47 +0,0 @@
/* Task_1_through_3
*
* This routine serves as a test task. It verifies the basic task
* switching capabilities of the executive.
*
* Input parameters:
* argument - task argument
*
* Output parameters: NONE
*
* COPYRIGHT (c) 1989-1999.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.OARcorp.com/rtems/license.html.
*
* $Id$
*/
#include "system.h"
rtems_task RTEMS_task_1_through_3(
rtems_task_argument argument
)
{
rtems_id tid;
rtems_time_of_day time;
rtems_status_code status;
status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
directive_failed( status, "rtems_task_ident" );
status = rtems_task_wake_after( 10 * TICKS_PER_SECOND );
directive_failed( status, "rtems_task_wake_after" );
while( FOREVER ) {
status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
directive_failed( status, "rtems_clock_get" );
put_name( Task_name[ task_number( tid ) ], FALSE );
print_time( " - rtems_clock_get - ", &time, "\n" );
status = rtems_task_wake_after( 30 * TICKS_PER_SECOND );
directive_failed( status, "rtems_task_wake_after" );
}
}
@@ -1,98 +0,0 @@
/* system.h
*
* This include file contains information that is included in every
* function in the test set.
*
* COPYRIGHT (c) 1989-1999.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.OARcorp.com/rtems/license.html.
*
* $Id$
*/
/* RTEMS API */
#include <rtems/system.h>
#include <rtems/score/object.h>
#include <rtems/score/stack.h>
#include <rtems/score/states.h>
#include <rtems/score/thread.h>
unsigned32 print_thread_info( Thread_Control *thread, void * arg );
#include <tmacros.h>
/* functions */
rtems_task Init( rtems_task_argument argument );
rtems_task RTEMS_task_1_through_3( rtems_task_argument argument );
/* global variables */
TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
/* configuration information */
#define CONFIGURE_SPTEST
#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_EXTRA_TASK_STACKS (4 * RTEMS_MINIMUM_STACK_SIZE)
/* POSIX API */
#ifdef RTEMS_POSIX_API
#include <pmacros.h>
#include <unistd.h>
#include <errno.h>
#include <sched.h>
/* functions */
void *pthread_1_through_3( void *argument );
/* global variables */
TEST_EXTERN pthread_t pthread_id[3]; /* array of pthread ids */
/* configuration information */
#define CONFIGURE_MAXIMUM_POSIX_THREADS 3
#endif
/* ITRON API */
#ifdef RTEMS_ITRON_API
#include <itron.h>
#include <rtems/itron/task.h>
/* functions */
void ITRON_task_2_through_4( void );
/* global variables */
TEST_EXTERN Objects_Locations location;
/* configuration information */
#endif
#include <confdefs.h>
/* end of include file */
@@ -1,178 +0,0 @@
/* threadinfo.c
*
* Routines to print out information about threads.
*/
#include "system.h"
#include <stdlib.h>
#define PTR unsigned int
#define PTR_MASK "0x%08x"
/*
* Return a pointer to a string describing the object type.
*/
const char * _Objects_Type_to_String( Objects_Control * object )
{
switch( _Objects_Get_class( object->id ) ) {
case OBJECTS_NO_CLASS:
return "NO_CLASS";
case OBJECTS_INTERNAL_THREADS:
return "INTERNAL_THREADS";
case OBJECTS_RTEMS_TASKS:
return "RTEMS_TASKS";
case OBJECTS_POSIX_THREADS:
return "POSIX_THREADS";
case OBJECTS_ITRON_TASKS:
return "ITRON_TASKS";
case OBJECTS_RTEMS_TIMERS:
return "RTEMS_TIMERS";
case OBJECTS_RTEMS_SEMAPHORES:
return "RTEMS_SEMAPHORES";
case OBJECTS_RTEMS_MESSAGE_QUEUES:
return "RTEMS_MESSAGE_QUEUES";
case OBJECTS_RTEMS_PARTITIONS:
return "RTEMS_PARTITIONS";
case OBJECTS_RTEMS_REGIONS:
return "RTEMS_REGIONS";
case OBJECTS_RTEMS_PORTS:
return "RTEMS_PORTS";
case OBJECTS_RTEMS_PERIODS:
return "RTEMS_PERIODS";
case OBJECTS_RTEMS_EXTENSIONS:
return "RTEMS_EXTENSIONS";
case OBJECTS_POSIX_KEYS:
return "POSIX_KEYS";
case OBJECTS_POSIX_INTERRUPTS:
return "POSIX_INTERRUPTS";
case OBJECTS_POSIX_MESSAGE_QUEUES:
return "POSIX_MESSAGE_QUEUES";
case OBJECTS_POSIX_MUTEXES:
return "POSIX_MUTEXES";
case OBJECTS_POSIX_SEMAPHORES:
return "POSIX_SEMAPHORES";
case OBJECTS_POSIX_CONDITION_VARIABLES:
return "POSIX_CONDITION_VARIABLES";
case OBJECTS_ITRON_EVENTFLAGS:
return "ITRON_EVENTFLAGS";
case OBJECTS_ITRON_MAILBOXES:
return "ITRON_MAILBOXES";
case OBJECTS_ITRON_MESSAGE_BUFFERS:
return "ITRON_MESSAGE_BUFFERS";
case OBJECTS_ITRON_PORTS:
return "ITRON_PORTS";
case OBJECTS_ITRON_SEMAPHORES:
return "ITRON_SEMAPHORES";
case OBJECTS_ITRON_VARIABLE_MEMORY_POOLS:
return "ITRON_VARIABLE_MEMORY_POOLS";
case OBJECTS_ITRON_FIXED_MEMORY_POOLS:
return "ITRON_FIXED_MEMORY_POOLS";
default:
return "UNKNOWN";
}
}
/*
* Return a pointer to a string describing the thread state
*/
const char * _Thread_State_to_String( States_Control state )
{
States_Control orig_state = state;
int i;
int first_entry = TRUE;
static char buffer[256];
static const char *desc[] = {
"READY", /* 0 - 0x00000 */
"DORMANT", /* 1 - 0x00001 */
"SUSPENDED", /* 2 - 0x00002 */
"TRANSIENT", /* 3 - 0x00004 */
"DELAYING", /* 4 - 0x00008 */
"WAITING_FOR_TIME", /* 5 - 0x00010 */
"WAITING_FOR_BUFFER", /* 6 - 0x00020 */
"WAITING_FOR_SEGMENT", /* 7 - 0x00040 */
"WAITING_FOR_MESSAGE", /* 8 - 0x00080 */
"WAITING_FOR_EVENT", /* 9 - 0x00100 */
"WAITING_FOR_SEMAPHORE", /* 10 - 0x00200 */
"WAITING_FOR_MUTEX", /* 11 - 0x00400 */
"WAITING_FOR_CONDITION_VARIABLE", /* 12 - 0x00800 */
"WAITING_FOR_JOIN_AT_EXIT", /* 13 - 0x01000 */
"WAITING_FOR_RPC_REPLY", /* 14 - 0x02000 */
"WAITING_FOR_PERIOD", /* 15 - 0x04000 */
"WAITING_FOR_SIGNAL", /* 16 - 0x08000 */
"INTERRUPTIBLE_BY_SIGNAL", /* 17 - 0x10000 */
"UNKNOWN" /* 18 - all higher bits */
};
if( state == STATES_READY )
return desc[0];
memset( buffer, '\0', sizeof( buffer ) );
for ( i = 1; i < 18; i++ ) {
if ( state & 0x1 ) {
if ( !first_entry ) {
strcat ( buffer, " | " );
}
strcat ( buffer, desc[i] );
first_entry = FALSE;
}
state = state >> 1;
}
if ( state != 0 ) {
if ( !first_entry ) {
strcat ( buffer, " | " );
}
strcat ( buffer, desc[18] );
}
return buffer;
}
/*
* Callback function to print out thread Ids, thread priorities, and thread stack
* information.
*/
unsigned32 print_thread_info( Thread_Control *thread, void * arg )
{
printf( "Thread ID 0x%08x at "PTR_MASK"\n", thread->Object.id, (PTR)thread );
printf( "\ttype = %s\n", _Objects_Type_to_String( &(thread->Object) ) );
printf( "\tstate = %s\n", _Thread_State_to_String( thread->current_state ) );
printf( "\treal priority = %d\n", thread->real_priority );
printf( "\tcurrent priority = %d\n", thread->current_priority );
printf( "\tstack base = "PTR_MASK"\n", (PTR)thread->Start.Initial_stack.area );
printf( "\tstack size = 0x%08x\n", thread->Start.Initial_stack.size );
/* printf( "\tstack pointer = "PTR_MASK"\n", */
printf( "\n" );
return 0;
}
@@ -1,205 +0,0 @@
*** Thread Iteration Test ***
Created and started an RTEMS task with id = 0x08010002
Created and started an RTEMS task with id = 0x08010003
Created and started an RTEMS task with id = 0x08010004
Created and started a pthread with id = 0x0c010001
Created and started a pthread with id = 0x0c010002
Created and started a pthread with id = 0x0c010003
Created and started an ITRON task with id = 0x10010002
Created and started an ITRON task with id = 0x10010003
Created and started an ITRON task with id = 0x10010004
Sleeping for 5 seconds
Looking for all threads
Thread ID 0x04010001 at 0x00192364
type = INTERNAL_THREADS
state = READY
real priority = 255
current priority = 255
stack base = 0x0018cde8
stack size = 0x00002008
Thread ID 0x08010001 at 0x00191390
type = RTEMS_TASKS
state = READY
real priority = 1
current priority = 1
stack base = 0x0018ac54
stack size = 0x00002008
Thread ID 0x08010002 at 0x001914ec
type = RTEMS_TASKS
state = DELAYING
real priority = 1
current priority = 1
stack base = 0x00186ac0
stack size = 0x00004008
Thread ID 0x08010003 at 0x00191648
type = RTEMS_TASKS
state = DELAYING
real priority = 1
current priority = 1
stack base = 0x0018292c
stack size = 0x00004008
Thread ID 0x08010004 at 0x001917a4
type = RTEMS_TASKS
state = DELAYING
real priority = 1
current priority = 1
stack base = 0x0017c798
stack size = 0x00006008
Thread ID 0x0c010001 at 0x0018fbf4
type = POSIX_THREADS
state = DELAYING | INTERRUPTIBLE_BY_SIGNAL
real priority = 1
current priority = 1
stack base = 0x00178604
stack size = 0x00004008
Thread ID 0x0c010002 at 0x0018fd50
type = POSIX_THREADS
state = DELAYING | INTERRUPTIBLE_BY_SIGNAL
real priority = 1
current priority = 1
stack base = 0x00174470
stack size = 0x00004008
Thread ID 0x0c010003 at 0x0018feac
type = POSIX_THREADS
state = DELAYING | INTERRUPTIBLE_BY_SIGNAL
real priority = 1
current priority = 1
stack base = 0x001702dc
stack size = 0x00004008
Thread ID 0x10010002 at 0x0018ef58
type = ITRON_TASKS
state = DELAYING
real priority = 1
current priority = 1
stack base = 0x0016c148
stack size = 0x00004008
Thread ID 0x10010003 at 0x0018f0b4
type = ITRON_TASKS
state = DELAYING
real priority = 1
current priority = 1
stack base = 0x00167f24
stack size = 0x00004008
Thread ID 0x10010004 at 0x0018f210
type = ITRON_TASKS
state = DELAYING
real priority = 1
current priority = 1
stack base = 0x00161d00
stack size = 0x00006008
That was it. Sleeping for 20 seconds.
TA1 - rtems_clock_get - 09:00:10 12/31/2000
TA2 - rtems_clock_get - 09:00:10 12/31/2000
TA3 - rtems_clock_get - 09:00:10 12/31/2000
pthread: ID is 0x0c010001
- clock_gettime - Sun Dec 31 09:00:10 2000
pthread: ID is 0x0c010002
- clock_gettime - Sun Dec 31 09:00:10 2000
pthread: ID is 0x0c010003
- clock_gettime - Sun Dec 31 09:00:10 2000
ITRON task 1 - rtems_clock_get - 09:00:10 12/31/2000
ITRON task 2 - rtems_clock_get - 09:00:10 12/31/2000
ITRON task 3 - rtems_clock_get - 09:00:10 12/31/2000
Deleting the second thread of each type
Looking for all threads
Thread ID 0x04010001 at 0x00192364
type = INTERNAL_THREADS
state = READY
real priority = 255
current priority = 255
stack base = 0x0018cde8
stack size = 0x00002008
Thread ID 0x08010001 at 0x00191390
type = RTEMS_TASKS
state = READY
real priority = 1
current priority = 1
stack base = 0x0018ac54
stack size = 0x00002008
Thread ID 0x08010002 at 0x001914ec
type = RTEMS_TASKS
state = DELAYING
real priority = 1
current priority = 1
stack base = 0x00186ac0
stack size = 0x00004008
Thread ID 0x08010004 at 0x001917a4
type = RTEMS_TASKS
state = DELAYING
real priority = 1
current priority = 1
stack base = 0x0017c798
stack size = 0x00006008
Thread ID 0x0c010001 at 0x0018fbf4
type = POSIX_THREADS
state = DELAYING | INTERRUPTIBLE_BY_SIGNAL
real priority = 1
current priority = 1
stack base = 0x00178604
stack size = 0x00004008
Thread ID 0x0c010002 at 0x0018fd50
type = POSIX_THREADS
state = DELAYING | INTERRUPTIBLE_BY_SIGNAL
real priority = 1
current priority = 1
stack base = 0x00174470
stack size = 0x00004008
Thread ID 0x0c010003 at 0x0018feac
type = POSIX_THREADS
state = DELAYING | INTERRUPTIBLE_BY_SIGNAL
real priority = 1
current priority = 1
stack base = 0x001702dc
stack size = 0x00004008
Thread ID 0x10010002 at 0x0018ef58
type = ITRON_TASKS
state = DELAYING
real priority = 1
current priority = 1
stack base = 0x0016c148
stack size = 0x00004008
Thread ID 0x10010003 at 0x0018f0b4
type = ITRON_TASKS
state = DORMANT
real priority = 1
current priority = 1
stack base = 0x00167f24
stack size = 0x00004008
Thread ID 0x10010004 at 0x0018f210
type = ITRON_TASKS
state = DELAYING
real priority =1
current priority = 1
stack base = 0x00161d00
stack size = 0x00006008
That was it. Exiting
-34
View File
@@ -443,21 +443,6 @@ Objects_Control *_Objects_Get (
Objects_Locations *location
);
/*
* _Objects_Get_by_index
*
* DESCRIPTION:
*
* This routine sets the object pointer for the given
* object id based on the given object information structure.
*/
Objects_Control *_Objects_Get_by_index(
Objects_Information *information,
unsigned32 index,
Objects_Locations *location
);
/*
* _Objects_Get_next
*
@@ -474,25 +459,6 @@ Objects_Control *_Objects_Get_next(
Objects_Id *next_id_p
);
/*
* _Objects_Local_iterate
*
* DESCRIPTION:
*
* This function invokes the callback function for each existing object
* of the type specified by the information block pointer. Iteration
* continues until either all objects have been processed, or, if
* break_on_error is TRUE, until an invocation of the callback returns
* something other than 0.
*/
unsigned32 _Objects_Local_iterate(
Objects_Information *information,
unsigned32 (*callback)(Objects_Control *object, void * arg),
void * arg,
boolean break_on_error
);
/*
* Pieces of object.inl are promoted out to the user
*/
-17
View File
@@ -733,23 +733,6 @@ Thread_Control *_Thread_Get (
);
#endif
/*
* _Thread_Local_iterate
*
* DESCRIPTION:
*
* This function invokes the callback function for each existing thread.
* Iteration continues until either all threads have been processed, or,
* if break_on_error is TRUE, until an invocation of the callback returns
* an integer value other than 0.
*/
unsigned32 _Thread_Local_iterate(
unsigned32 (*callback)(Thread_Control *the_thread, void * arg),
void * arg,
boolean break_on_error
);
/*
* _Thread_Idle_body
*
+9 -10
View File
@@ -27,18 +27,17 @@ OBJECT_C_FILES = object.c objectallocate.c objectallocatebyindex.c \
objectclearname.c objectcomparenameraw.c objectcomparenamestring.c \
objectcopynameraw.c objectcopynamestring.c objectextendinformation.c \
objectfree.c objectget.c objectgetbyindex.c objectgetnext.c \
objectinitializeinformation.c objectlocaliterate.c objectnametoid.c \
objectshrinkinformation.c
objectinitializeinformation.c objectnametoid.c objectshrinkinformation.c
THREAD_C_FILES = thread.c threadchangepriority.c threadclearstate.c \
threadclose.c threadcreateidle.c threaddelayended.c threaddispatch.c \
threadevaluatemode.c threadget.c threadhandler.c threadidlebody.c \
threadinitialize.c threadloadenv.c threadlocaliterate.c threadready.c \
threadresettimeslice.c threadreset.c threadrestart.c threadresume.c \
threadrotatequeue.c threadsetpriority.c threadsetstate.c \
threadsettransient.c threadstackallocate.c threadstackfree.c \
threadstart.c threadstartmultitasking.c threadsuspend.c \
threadtickletimeslice.c threadyieldprocessor.c
threadinitialize.c threadloadenv.c threadready.c threadresettimeslice.c \
threadreset.c threadrestart.c threadresume.c threadrotatequeue.c \
threadsetpriority.c threadsetstate.c threadsettransient.c \
threadstackallocate.c threadstackfree.c threadstart.c \
threadstartmultitasking.c threadsuspend.c threadtickletimeslice.c \
threadyieldprocessor.c
THREADQ_C_FILES = threadq.c threadqdequeue.c threadqdequeuefifo.c \
threadqdequeuepriority.c threadqenqueue.c threadqenqueuefifo.c \
@@ -54,8 +53,8 @@ WATCHDOG_C_FILES = watchdog.c watchdogadjust.c watchdoginsert.c \
watchdogremove.c watchdogtickle.c
STD_C_FILES = apiext.c chain.c $(CORE_MESSAGE_QUEUE_C_FILES) \
$(CORE_MUTEX_C_FILES) $(CORE_SEMAPHORE_C_FILES) $(HEAP_C_FILES) \
interr.c isr.c $(OBJECT_C_FILES) $(THREAD_C_FILES) $(THREADQ_C_FILES) \
$(CORE_MUTEX_C_FILES) $(CORE_SEMAPHORE_C_FILES) $(HEAP_C_FILES) interr.c \
isr.c $(OBJECT_C_FILES) $(THREAD_C_FILES) $(THREADQ_C_FILES) \
$(TOD_C_FILES) userext.c $(WATCHDOG_C_FILES) wkspace.c
if HAS_MP