From 8ef38186faea3d9b5e6f0f1242f668cb7e7a3d52 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 12 Jun 2000 19:57:02 +0000 Subject: Patch from John Cotton , Charles-Antoine Gauthier , and Darlene A. Stewart to add support for a number of very significant things: + BSPs for many variations on the Motorola MBX8xx board series + Cache Manager including initial support for m68040 and PowerPC + Rework of mpc8xx libcpu code so all mpc8xx CPUs now use same code base. + Rework of eth_comm BSP to utiltize above. John reports this works on the 821 and 860 --- c/src/exec/score/src/Makefile.am | 19 ++++---- c/src/exec/score/src/objectlocaliterate.c | 77 +++++++++++++++++++++++++++++++ c/src/exec/score/src/threadlocaliterate.c | 77 +++++++++++++++++++++++++++++++ 3 files changed, 164 insertions(+), 9 deletions(-) create mode 100644 c/src/exec/score/src/objectlocaliterate.c create mode 100644 c/src/exec/score/src/threadlocaliterate.c (limited to 'c/src/exec/score/src') diff --git a/c/src/exec/score/src/Makefile.am b/c/src/exec/score/src/Makefile.am index c348a606f1..97a2597cda 100644 --- a/c/src/exec/score/src/Makefile.am +++ b/c/src/exec/score/src/Makefile.am @@ -27,17 +27,18 @@ 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 objectnametoid.c objectshrinkinformation.c + objectinitializeinformation.c objectlocaliterate.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 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 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 THREADQ_C_FILES = threadq.c threadqdequeue.c threadqdequeuefifo.c \ threadqdequeuepriority.c threadqenqueue.c threadqenqueuefifo.c \ @@ -53,8 +54,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 diff --git a/c/src/exec/score/src/objectlocaliterate.c b/c/src/exec/score/src/objectlocaliterate.c new file mode 100644 index 0000000000..e4b0f28de8 --- /dev/null +++ b/c/src/exec/score/src/objectlocaliterate.c @@ -0,0 +1,77 @@ +/* + * 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 +#include + +/*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; +} + diff --git a/c/src/exec/score/src/threadlocaliterate.c b/c/src/exec/score/src/threadlocaliterate.c new file mode 100644 index 0000000000..a2d94fe81a --- /dev/null +++ b/c/src/exec/score/src/threadlocaliterate.c @@ -0,0 +1,77 @@ +/* + * 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 +#include +#include + + +/*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; +} -- cgit v1.2.3