From 2b3e9d9b244e279ef5693a7cf5dacc7903164af5 Mon Sep 17 00:00:00 2001 From: Ralf Corsepius Date: Mon, 22 Jul 2002 09:46:48 +0000 Subject: Remove, moved to cpukit. --- c/src/exec/score/src/.cvsignore | 2 - c/src/exec/score/src/Makefile.am | 79 ---- c/src/exec/score/src/Unlimited.txt | 387 --------------- c/src/exec/score/src/apiext.c | 104 ---- c/src/exec/score/src/chain.c | 201 -------- c/src/exec/score/src/coremsg.c | 103 ---- c/src/exec/score/src/coremsgbroadcast.c | 112 ----- c/src/exec/score/src/coremsgclose.c | 77 --- c/src/exec/score/src/coremsgflush.c | 55 --- c/src/exec/score/src/coremsgflushsupp.c | 105 ----- c/src/exec/score/src/coremsgflushwait.c | 70 --- c/src/exec/score/src/coremsginsert.c | 102 ---- c/src/exec/score/src/coremsgseize.c | 137 ------ c/src/exec/score/src/coremsgsubmit.c | 175 ------- c/src/exec/score/src/coremutex.c | 89 ---- c/src/exec/score/src/coremutexflush.c | 51 -- c/src/exec/score/src/coremutexseize.c | 154 ------ c/src/exec/score/src/coremutexsurrender.c | 142 ------ c/src/exec/score/src/coresem.c | 62 --- c/src/exec/score/src/coresemflush.c | 57 --- c/src/exec/score/src/coresemseize.c | 80 ---- c/src/exec/score/src/coresemsurrender.c | 74 --- c/src/exec/score/src/coretod.c | 59 --- c/src/exec/score/src/coretodset.c | 63 --- c/src/exec/score/src/coretodtickle.c | 67 --- c/src/exec/score/src/coretodtoseconds.c | 64 --- c/src/exec/score/src/coretodvalidate.c | 63 --- c/src/exec/score/src/heap.c | 93 ---- c/src/exec/score/src/heapallocate.c | 114 ----- c/src/exec/score/src/heapextend.c | 112 ----- c/src/exec/score/src/heapfree.c | 104 ---- c/src/exec/score/src/heapgetinfo.c | 101 ---- c/src/exec/score/src/heapsizeofuserarea.c | 63 --- c/src/exec/score/src/heapwalk.c | 149 ------ c/src/exec/score/src/interr.c | 60 --- c/src/exec/score/src/isr.c | 65 --- c/src/exec/score/src/mpci.c | 522 --------------------- c/src/exec/score/src/object.c | 64 --- c/src/exec/score/src/objectallocate.c | 68 --- c/src/exec/score/src/objectallocatebyindex.c | 73 --- c/src/exec/score/src/objectclearname.c | 46 -- c/src/exec/score/src/objectcomparenameraw.c | 57 --- c/src/exec/score/src/objectcomparenamestring.c | 53 --- c/src/exec/score/src/objectcopynameraw.c | 46 -- c/src/exec/score/src/objectcopynamestring.c | 48 -- c/src/exec/score/src/objectextendinformation.c | 291 ------------ c/src/exec/score/src/objectfree.c | 65 --- c/src/exec/score/src/objectget.c | 83 ---- c/src/exec/score/src/objectgetbyindex.c | 73 --- c/src/exec/score/src/objectgetisr.c | 89 ---- c/src/exec/score/src/objectgetnext.c | 90 ---- c/src/exec/score/src/objectgetnoprotection.c | 83 ---- c/src/exec/score/src/objectinitializeinformation.c | 177 ------- c/src/exec/score/src/objectmp.c | 274 ----------- c/src/exec/score/src/objectnametoid.c | 95 ---- c/src/exec/score/src/objectshrinkinformation.c | 115 ----- c/src/exec/score/src/thread.c | 108 ----- c/src/exec/score/src/threadchangepriority.c | 113 ----- c/src/exec/score/src/threadclearstate.c | 81 ---- c/src/exec/score/src/threadclose.c | 73 --- c/src/exec/score/src/threadcreateidle.c | 96 ---- c/src/exec/score/src/threaddelayended.c | 60 --- c/src/exec/score/src/threaddispatch.c | 141 ------ c/src/exec/score/src/threadevaluatemode.c | 49 -- c/src/exec/score/src/threadget.c | 83 ---- c/src/exec/score/src/threadhandler.c | 158 ------- c/src/exec/score/src/threadidlebody.c | 50 -- c/src/exec/score/src/threadinitialize.c | 218 --------- c/src/exec/score/src/threadloadenv.c | 70 --- c/src/exec/score/src/threadmp.c | 163 ------- c/src/exec/score/src/threadq.c | 65 --- c/src/exec/score/src/threadqdequeue.c | 62 --- c/src/exec/score/src/threadqdequeuefifo.c | 86 ---- c/src/exec/score/src/threadqdequeuepriority.c | 125 ----- c/src/exec/score/src/threadqenqueue.c | 77 --- c/src/exec/score/src/threadqenqueuefifo.c | 101 ---- c/src/exec/score/src/threadqenqueuepriority.c | 221 --------- c/src/exec/score/src/threadqextract.c | 54 --- c/src/exec/score/src/threadqextractfifo.c | 73 --- c/src/exec/score/src/threadqextractpriority.c | 104 ---- c/src/exec/score/src/threadqextractwithproxy.c | 63 --- c/src/exec/score/src/threadqfirst.c | 58 --- c/src/exec/score/src/threadqfirstfifo.c | 47 -- c/src/exec/score/src/threadqfirstpriority.c | 52 -- c/src/exec/score/src/threadqflush.c | 55 --- c/src/exec/score/src/threadqtimeout.c | 78 --- c/src/exec/score/src/threadready.c | 74 --- c/src/exec/score/src/threadreset.c | 65 --- c/src/exec/score/src/threadresettimeslice.c | 71 --- c/src/exec/score/src/threadrestart.c | 64 --- c/src/exec/score/src/threadresume.c | 94 ---- c/src/exec/score/src/threadrotatequeue.c | 92 ---- c/src/exec/score/src/threadsetpriority.c | 52 -- c/src/exec/score/src/threadsetstate.c | 83 ---- c/src/exec/score/src/threadsettransient.c | 73 --- c/src/exec/score/src/threadstackallocate.c | 81 ---- c/src/exec/score/src/threadstackfree.c | 56 --- c/src/exec/score/src/threadstart.c | 66 --- c/src/exec/score/src/threadstartmultitasking.c | 89 ---- c/src/exec/score/src/threadsuspend.c | 82 ---- c/src/exec/score/src/threadtickletimeslice.c | 86 ---- c/src/exec/score/src/threadyieldprocessor.c | 72 --- c/src/exec/score/src/userext.c | 203 -------- c/src/exec/score/src/watchdog.c | 38 -- c/src/exec/score/src/watchdogadjust.c | 62 --- c/src/exec/score/src/watchdoginsert.c | 96 ---- c/src/exec/score/src/watchdogremove.c | 70 --- c/src/exec/score/src/watchdogtickle.c | 77 --- c/src/exec/score/src/wkspace.c | 87 ---- 109 files changed, 10624 deletions(-) delete mode 100644 c/src/exec/score/src/.cvsignore delete mode 100644 c/src/exec/score/src/Makefile.am delete mode 100644 c/src/exec/score/src/Unlimited.txt delete mode 100644 c/src/exec/score/src/apiext.c delete mode 100644 c/src/exec/score/src/chain.c delete mode 100644 c/src/exec/score/src/coremsg.c delete mode 100644 c/src/exec/score/src/coremsgbroadcast.c delete mode 100644 c/src/exec/score/src/coremsgclose.c delete mode 100644 c/src/exec/score/src/coremsgflush.c delete mode 100644 c/src/exec/score/src/coremsgflushsupp.c delete mode 100644 c/src/exec/score/src/coremsgflushwait.c delete mode 100644 c/src/exec/score/src/coremsginsert.c delete mode 100644 c/src/exec/score/src/coremsgseize.c delete mode 100644 c/src/exec/score/src/coremsgsubmit.c delete mode 100644 c/src/exec/score/src/coremutex.c delete mode 100644 c/src/exec/score/src/coremutexflush.c delete mode 100644 c/src/exec/score/src/coremutexseize.c delete mode 100644 c/src/exec/score/src/coremutexsurrender.c delete mode 100644 c/src/exec/score/src/coresem.c delete mode 100644 c/src/exec/score/src/coresemflush.c delete mode 100644 c/src/exec/score/src/coresemseize.c delete mode 100644 c/src/exec/score/src/coresemsurrender.c delete mode 100644 c/src/exec/score/src/coretod.c delete mode 100644 c/src/exec/score/src/coretodset.c delete mode 100644 c/src/exec/score/src/coretodtickle.c delete mode 100644 c/src/exec/score/src/coretodtoseconds.c delete mode 100644 c/src/exec/score/src/coretodvalidate.c delete mode 100644 c/src/exec/score/src/heap.c delete mode 100644 c/src/exec/score/src/heapallocate.c delete mode 100644 c/src/exec/score/src/heapextend.c delete mode 100644 c/src/exec/score/src/heapfree.c delete mode 100644 c/src/exec/score/src/heapgetinfo.c delete mode 100644 c/src/exec/score/src/heapsizeofuserarea.c delete mode 100644 c/src/exec/score/src/heapwalk.c delete mode 100644 c/src/exec/score/src/interr.c delete mode 100644 c/src/exec/score/src/isr.c delete mode 100644 c/src/exec/score/src/mpci.c delete mode 100644 c/src/exec/score/src/object.c delete mode 100644 c/src/exec/score/src/objectallocate.c delete mode 100644 c/src/exec/score/src/objectallocatebyindex.c delete mode 100644 c/src/exec/score/src/objectclearname.c delete mode 100644 c/src/exec/score/src/objectcomparenameraw.c delete mode 100644 c/src/exec/score/src/objectcomparenamestring.c delete mode 100644 c/src/exec/score/src/objectcopynameraw.c delete mode 100644 c/src/exec/score/src/objectcopynamestring.c delete mode 100644 c/src/exec/score/src/objectextendinformation.c delete mode 100644 c/src/exec/score/src/objectfree.c delete mode 100644 c/src/exec/score/src/objectget.c delete mode 100644 c/src/exec/score/src/objectgetbyindex.c delete mode 100644 c/src/exec/score/src/objectgetisr.c delete mode 100644 c/src/exec/score/src/objectgetnext.c delete mode 100644 c/src/exec/score/src/objectgetnoprotection.c delete mode 100644 c/src/exec/score/src/objectinitializeinformation.c delete mode 100644 c/src/exec/score/src/objectmp.c delete mode 100644 c/src/exec/score/src/objectnametoid.c delete mode 100644 c/src/exec/score/src/objectshrinkinformation.c delete mode 100644 c/src/exec/score/src/thread.c delete mode 100644 c/src/exec/score/src/threadchangepriority.c delete mode 100644 c/src/exec/score/src/threadclearstate.c delete mode 100644 c/src/exec/score/src/threadclose.c delete mode 100644 c/src/exec/score/src/threadcreateidle.c delete mode 100644 c/src/exec/score/src/threaddelayended.c delete mode 100644 c/src/exec/score/src/threaddispatch.c delete mode 100644 c/src/exec/score/src/threadevaluatemode.c delete mode 100644 c/src/exec/score/src/threadget.c delete mode 100644 c/src/exec/score/src/threadhandler.c delete mode 100644 c/src/exec/score/src/threadidlebody.c delete mode 100644 c/src/exec/score/src/threadinitialize.c delete mode 100644 c/src/exec/score/src/threadloadenv.c delete mode 100644 c/src/exec/score/src/threadmp.c delete mode 100644 c/src/exec/score/src/threadq.c delete mode 100644 c/src/exec/score/src/threadqdequeue.c delete mode 100644 c/src/exec/score/src/threadqdequeuefifo.c delete mode 100644 c/src/exec/score/src/threadqdequeuepriority.c delete mode 100644 c/src/exec/score/src/threadqenqueue.c delete mode 100644 c/src/exec/score/src/threadqenqueuefifo.c delete mode 100644 c/src/exec/score/src/threadqenqueuepriority.c delete mode 100644 c/src/exec/score/src/threadqextract.c delete mode 100644 c/src/exec/score/src/threadqextractfifo.c delete mode 100644 c/src/exec/score/src/threadqextractpriority.c delete mode 100644 c/src/exec/score/src/threadqextractwithproxy.c delete mode 100644 c/src/exec/score/src/threadqfirst.c delete mode 100644 c/src/exec/score/src/threadqfirstfifo.c delete mode 100644 c/src/exec/score/src/threadqfirstpriority.c delete mode 100644 c/src/exec/score/src/threadqflush.c delete mode 100644 c/src/exec/score/src/threadqtimeout.c delete mode 100644 c/src/exec/score/src/threadready.c delete mode 100644 c/src/exec/score/src/threadreset.c delete mode 100644 c/src/exec/score/src/threadresettimeslice.c delete mode 100644 c/src/exec/score/src/threadrestart.c delete mode 100644 c/src/exec/score/src/threadresume.c delete mode 100644 c/src/exec/score/src/threadrotatequeue.c delete mode 100644 c/src/exec/score/src/threadsetpriority.c delete mode 100644 c/src/exec/score/src/threadsetstate.c delete mode 100644 c/src/exec/score/src/threadsettransient.c delete mode 100644 c/src/exec/score/src/threadstackallocate.c delete mode 100644 c/src/exec/score/src/threadstackfree.c delete mode 100644 c/src/exec/score/src/threadstart.c delete mode 100644 c/src/exec/score/src/threadstartmultitasking.c delete mode 100644 c/src/exec/score/src/threadsuspend.c delete mode 100644 c/src/exec/score/src/threadtickletimeslice.c delete mode 100644 c/src/exec/score/src/threadyieldprocessor.c delete mode 100644 c/src/exec/score/src/userext.c delete mode 100644 c/src/exec/score/src/watchdog.c delete mode 100644 c/src/exec/score/src/watchdogadjust.c delete mode 100644 c/src/exec/score/src/watchdoginsert.c delete mode 100644 c/src/exec/score/src/watchdogremove.c delete mode 100644 c/src/exec/score/src/watchdogtickle.c delete mode 100644 c/src/exec/score/src/wkspace.c (limited to 'c/src/exec/score/src') diff --git a/c/src/exec/score/src/.cvsignore b/c/src/exec/score/src/.cvsignore deleted file mode 100644 index 282522db03..0000000000 --- a/c/src/exec/score/src/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/c/src/exec/score/src/Makefile.am b/c/src/exec/score/src/Makefile.am deleted file mode 100644 index 64d0d50a15..0000000000 --- a/c/src/exec/score/src/Makefile.am +++ /dev/null @@ -1,79 +0,0 @@ -## -## $Id$ -## - - -include $(top_srcdir)/automake/multilib.am -include $(top_srcdir)/automake/compile.am -include $(top_srcdir)/automake/lib.am - -# We only build multiprocessing related files if HAS_MP was defined -MP_C_FILES = mpci.c objectmp.c threadmp.c - -CORE_MESSAGE_QUEUE_C_FILES = coremsg.c coremsgbroadcast.c coremsgclose.c \ - coremsgflush.c coremsgflushwait.c coremsginsert.c coremsgflushsupp.c \ - coremsgseize.c coremsgsubmit.c - -CORE_MUTEX_C_FILES = coremutex.c coremutexflush.c coremutexseize.c \ - coremutexsurrender.c - -CORE_SEMAPHORE_C_FILES = coresem.c coresemflush.c coresemseize.c \ - coresemsurrender.c - -HEAP_C_FILES = heap.c heapallocate.c heapextend.c heapfree.c \ - heapsizeofuserarea.c heapwalk.c heapgetinfo.c - -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 objectgetisr.c objectgetbyindex.c \ - objectgetnext.c objectinitializeinformation.c objectnametoid.c \ - objectshrinkinformation.c objectgetnoprotection.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 - -THREADQ_C_FILES = threadq.c threadqdequeue.c threadqdequeuefifo.c \ - threadqdequeuepriority.c threadqenqueue.c threadqenqueuefifo.c \ - threadqenqueuepriority.c threadqextract.c threadqextractfifo.c \ - threadqextractpriority.c threadqextractwithproxy.c threadqfirst.c \ - threadqfirstfifo.c threadqfirstpriority.c threadqflush.c threadqtimeout.c - -TOD_C_FILES = coretod.c coretodset.c coretodtickle.c coretodtoseconds.c \ - coretodvalidate.c - -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) \ - $(TOD_C_FILES) userext.c $(WATCHDOG_C_FILES) wkspace.c - -if HAS_MP -C_FILES = $(STD_C_FILES) $(MP_C_FILES) -else -C_FILES = $(STD_C_FILES) -endif -C_O_FILES = $(C_FILES:%.c=${ARCH}/%.o) - -OBJS = $(C_O_FILES) - -# -# Add local stuff here using += -# - -AM_CPPFLAGS += -D__RTEMS_INSIDE__ - -all-local: ${ARCH} ${OBJS} - -EXTRA_DIST = $(STD_C_FILES) $(MP_C_FILES) Unlimited.txt - -include $(top_srcdir)/automake/local.am diff --git a/c/src/exec/score/src/Unlimited.txt b/c/src/exec/score/src/Unlimited.txt deleted file mode 100644 index 7340fc2dfe..0000000000 --- a/c/src/exec/score/src/Unlimited.txt +++ /dev/null @@ -1,387 +0,0 @@ -# -# $Id$ -# - -This document explains how the unlimited objects support works. This was -written by Chris Johns of Objective Design Systems as a -design document. This was submitted as part of the patch which added -this capability. - -Unlimited Local Node Objects -============================ - -1. Why ? - -This patch changes the way RTEMS allocates, frees, and manages the -'Objects_Control' structure. - -The 'Objects_Control' structure is at the root of all objects in -RTEMS. The RTEMS and POSIX API allows users to create tasks, message -queues, semaphores and other resources. These are all a type of -Object. The POSIX API allow similar operations. These also map to -Objects. - -Currently the number of objects that can be created is a static value -loaded into the Configuration table before starting the kernel. The -application cannot exceed these limits. Various means are used to tune -this value. During development the value is usually set large. This -saves having to change it everytime a developer adds a new -resource. With a large team of developers the configuration table file -can cycle through a large number of revisions. The wasted memory is -only recovered when memory runs short. The issue of the configuration -table parameters become more important the less memory you have. - -The Configuration table requires a calculation to occur at compile -time to set the size of the Workspace. The calculation is an -estimate. You need to specify an overhead value for memory that can -not be calculated. An example of memory that cannot be calculated is -stack sizes. This issue is not directly related to allowing unlimited -objects how-ever the need to calculate the memory usage for a system -in this manner is prone to error. - -I would like to see download support added to RTEMS. The kernel -configuration being set at boot time means a download application can -be limited. This can defeat one of the purposes of using downloaded -code, no need to change ROMs. In a system I worked on the cost to -change ROMS in a complete system was high and could take a week. This -change is the first phase of supporting downloaded applications. - -1.1 How do Objects work ? - -All applications interact with the super core (c/src/exec/score) via -an API. The central structure used in the super core is the -`object'. Two application interfaces exist. They are RTEMS and -POSIX. Both map to the super core using objects. - -An object in RTEMS is a resource which the user (through the API) -creates. The different types of objects are referred to as classes of -objects. An object is referenced by an id. This is of type `rtems_id' -and is a 32bit unsigned integer. The id is unique for each object no -matter what class. - -Objects are anchored by the `_Object_Information' structure. There is -one per type or class of object. A global table of pointers to each -information structure for a class of objects is held in -`Objects_Information_table'. - -Objects consist of 6 main structures. The `_Object_Information' is the -root structure. It contains pointers to the `local_table', -`name_table', `global_table', the Inactive chain, and the object -memory. It also contains the various variables which describe the -object. We are only concerned with the `local_table', `name_table', -Inactive chain, and the object memory to support unlimited objects. - -The `local_table' holds the pointers to open objects. A `local_table -entry which is null is free and the object will be sitting on the -Inactive chain. The index into the table is based on part of the -id. Given an id the you can find the index into the `local_table', and -therefore the object. The `local_table' has the entries for the -indexes below the minimum_id's index. The minimum_id is always set to -1 (the change allows another value to be selected if require). The -index of 0 is reserved and never used. This allows any actions using -an id of zero to fail or map to a special case. - -The `name_table' holds the names of the objects. Each entry in this -table is the maximum size the name of the object can be. The size of -names is not constrained by the object code (but is by the MP object -code, and the API and should be fixed). - -The `global_table' and code that uses it has not changed. I did not -look at the this code, and I am not farmilar with it. - -The Inactive chain stores objects which are free or not -allocated. This design saves searching for a free object when -allocating therefore providing a deterministic allocation scheme. When -the chain is empty a null is returned. - -The change documented below basically extends the `local_table' and -`name_table' structures at run-time. The memory used be these table -is not large compared to the memory for the objects, and so are never -reduced in size once extended. The object's memory grows and shrinks -depending of the user's usage. - -Currently, the user specifies the total number of objects in the -Configuration table. The change alters the function of the values in -the Configuration table. A flag can be masked on to the value which -selects the extending mode. If the user does not set the flag the -object code operates with an object ceiling. A small performance -overhead will be incurred as the allocate and free routines are now -not inlined and a check of the auto_extend flag is made. The remaining -value field of the Configuration table entry is total number of -objects that can be allocated when not in unlimited mode. - -If the user masks the flag on to a value on the Configuration table -auto-exdending mode is selected for that class of object. The value -becomes the allocation unit size. If there are no free objects the -object's tables are extended by the allocation unit number of -objects. The object table is shrunk when the user frees objects. The -table must have one free allocation block, and at least half the -allocation size of another block before the object memory of the free -allocation block is returned to the heap. This stops threshold -thrashing when objects around the allocation unit size and created and -destroyed. - -At least one allocation block size of objects is created and never -destroyed. - -The change to support unlimited objects has extended the object -information structure. - -The flag, `auto_extend' controls if the object can be automatically -extended. The user masks the flag RTEMS_UNLIMITED_FLAGS onto the -Configuration table number to select the auto-extend mode. This is -passed to the `_Objects_Initialize_information' function in the -parameter maximum. The flag is tested for and the auto_extend flag -updated to reflect the state of the flag before being stipped from the -maximum. - -The `allocation_size' is set to the parameter maxium in the function -`_Objects_Initialize_information' if `auto_extend' is true. Making the -allocation size small causes the memory to be allocated and freed more -often. This only effects the performance times for creating a resource -such as a task. It does how-ever give you fine grain memory -control. If the performance of creating resources is not a problem -make the size small. - -The size of the object is required to be stored. It is used when -extending the object information. - -A count of the object on the Inactive list is maintained. This is used -during freeing objects. If the count is above 1.5 times the -`allocation_size' an attempt is made to shrink the object -informtation. Shrinking might not always succeed as a single -allocation block might not be free. Random freeing of objects can -result in some fragmentation. Any further allocations will use the -free objects before extending the object's information tables. - -A table of inactive objects per block is maintained. This table, like -the `local_table' and `name_table' grows as more blocks are -allocated. A check is made of a blocks inactive count when an object -which is part of that block is freed. If the total inactive count -exceeds 1.5 times the allocation size, and the block's inactive count -is the allocation_size, the objects data block is returnd to the -workspace heap. - -The `objects_blocks' is a table of pointers. The object_block's pointers -point to the object's data block. The object's data block is a single -allocation of the name space and object space. This was two separate -allocations but is now one. The objects_block's table is use to -determine if a block is allocated, and the address of the memory block -to be returned to the workspace heap when the object informtation -space is shrunk. - -2.0 Detail Of the Auto-Extend Patch to rtems-4.0.0, Snapshot 19990302 - -o Configuration table support. - - Added a flag OBJECTS_UNLIMITED_OBJECTS to score/headers/object.h - header file. This is referenced in the file sapi/headers/config.h to - create the flag RTEMS_UNLIMITED_OBJECTS. A macro is provided to take - a resource count and apply the flag. The macro is called - `rtems_resource_unlimited'. The user uses this macro when building a - configuration table. It can be used with the condefs.h header file. - -o Object Information Structure - - The object information structure, Objects_Information, has been - extended with the follow fields : - - boolean auto_extend - - - When true the object's information tables can be extended untill - all memory is used. When false the current functionallity is - maintained. - - unsigned32 allocation_size - - - When auto_extend is true, it is the value in the Configuration - table and is the number of objects the object's information - tables are extended or shrunk. - - unsigned32 size - - - The size of the object. It is used to calculate the size of - memory required to be allocated when extending the table. - - unsigned32 inactive - - - The number of elements on the Inactive chain. - - unsigned32 *inactive_per_block - - - Pointer to a table of counts of the inactive objects from a - block on the Inactive chain. It is used to know which blocks are - all free and therefore can be returned to the heap. - - void **object_blocks - - - Pointer to a table of pointers to the object data. The table - holds the pointer used to return a block to the heap when - shrinking the object's information tables. - -o Changes to Existing Object Functions - - Two functions prototypes are added. They are : - - _Objects_Extend_information, - _Objects_Shrink_information - _Object_Allocate, and - _Object_Free - - The last were inlined, how-ever now they are not as they are too - complex to implement as macros now. - -o Object Inline and Macro Changes - - The functions : - - _Object_Allocate, and - _Object_Free - - are now not inlined. The function : - - _Objects_Get_local_object, and - _Objects_Set_local_object - - have been added. There was no provided interface to allow an API to - get/set an objects local pointer given an index. The POSIX code - should be updated to use this interface. - - The function : - - _Objects_Get_information - - has been moved to be an inline function. It is used in the get - object call which the API uses for every object reference. - -o Object Initialisation - - The function _Objects_Initialize_information has been changed to - initialisation of the information structure's fields then call the - new function _Objects_Extend_information. - - The first block of objects is always allocated and never - released. This means with the auto-extend flag set to true the user - still sees the same behaviour expected without this change. That is - the number objects specified in the Configuration table is the - number of object allocated during RTEMS initialisation. If not - enough memory is found during this initial extend a fatal error - occurs. The fatal error only occurs for this case of extending the - object's information tables. - -o Object Information Extend - - The _Object_Information_Extend is a new function. It takes some of - the code form the old _Object_Initialize_information function. The - function extends an object's information base. - - Extending the first time is a special case. The function assumes the - maximum index will be less than the minimum index. This means the - minimum index must be greater than 0 at initialisation. The other - special case made is coping the tables from the old location to the - new location. The first block case is trapped and tables are - initialised instead. Workspace allocation for the first block is - tested for an if the first block the allocate or fatal error call is - made. This traps an RTEMS initialise allocation error. - - The remainder of the code deals with all cases of extending the - object's information. - - The current block count is first determined, then a scan of the - object_block table is made to locate a free slot. Blocks can be - freed in any order. The index base for the block is also determined. - - If the index base is greater than the maximum index, the tables must - grow. To grow the tables, a new larger memory block is allocated and - the tables copied. The object's information structure is then - updated to point to the new tables. The tables are allocated in one - memory block from the work-space heap. The single block is then - broken down in the required tables. - - Once the tables are copied, and the new extended parts initialised - the table pointers in the object's information structure are - updated. This is protected by masking interrupts. - - The old table's memory block is returned to the heap. - - The names table and object is allocated. This again is a single - block which is divided. - - The objects are initialised onto a local Inactive chain. They are - then copied to the object's Inactive chain to complete the - initialisation. - -o Object Informtation Shrink - - The _Object_Shrink_information function is new. It is required to - scan all the blocks to see which one has no objects allocated. The - last object freed might not belong to a block which is completely - free. - - Once a block is located, the Inactive chain is interated down - looking for objects which belong to the block of object being - released. - - Once the Inactive chain scan is complete the names table and object - memory is returned to the work-space heap and the table references cleared. - - XXX - I am not sure if this should occur if better protection or - different code to provide better protection. - - The information tables do not change size. Once extended they never - shrink. - -o Object Allocation - - The _Objects_Allocate attempts to get an object from the Inactive - chain. If auto-extend mode is not enabled no further processing - occurs. The extra overhead for this implemetation is the function is - not inlined and check of a boolean occurs. It should effect the - timing figures. - - If auto-extend is enabled, a further check is made to see if the get - from the Inactive chain suceeded in getting an object. If it failed - a call is made to extend the object's information tables. - - The get from the Inactive chain is retried. The result of this is - returned to the user. A failure here is the users problem. - -o Object Free - - The _Objects_Free puts the object back onto the Inactive - chain. Again if auto-extend mode is not enabled no further - processing occurs and performance overhead will low. - - If auto-extend mode is enabled, a check is to see if the number of - Inactive objects is one and a half times the allocation size. If - there are that many free objects an attempt is made to shrink the - object's information. - -o Object Index and the Get Function - - The existing code allocates the number of object specified in the - configuration table, how-ever it makes the local_table have one more - element. This is the slot for an id of 0. The 0 slot is always a - NULL providing a simple check for a 0 id for object classes. - - The existing _Objects_Get code removes the minimum id, which I think - could only be 1 from the index, then adds one for the 0 slot. - - This change removes this index adjustment code in _Objects_Get. - - The extend information starts the index count when scanning for free - blocks at the minumun index. This means the base index for a block - will always be adjusted by the minimum index. The extend information - function only ever allocates the allocation size of - objects. Finially the object's local_table size is the maximum plus - the minumum index size. The maximum is really the maximum index. - - This means the values in the object's information structure and - tables do not need the index adjustments which existed before. - -o The Test - - A new sample test, unlimited is provided. It attempts to test this - change. - - diff --git a/c/src/exec/score/src/apiext.c b/c/src/exec/score/src/apiext.c deleted file mode 100644 index 5bb2ad658e..0000000000 --- a/c/src/exec/score/src/apiext.c +++ /dev/null @@ -1,104 +0,0 @@ -/* apiext.c - * - * XXX - * - * 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 -#include - -/*PAGE - * - * _API_extensions_Initialization - */ - -void _API_extensions_Initialization( void ) -{ - _Chain_Initialize_empty( &_API_extensions_List ); -} - -/*PAGE - * - * _API_extensions_Add - */ - -void _API_extensions_Add( - API_extensions_Control *the_extension -) -{ - _Chain_Append( &_API_extensions_List, &the_extension->Node ); -} - -/*PAGE - * - * _API_extensions_Run_predriver - */ - -void _API_extensions_Run_predriver( void ) -{ - Chain_Node *the_node; - API_extensions_Control *the_extension; - - for ( the_node = _API_extensions_List.first ; - !_Chain_Is_tail( &_API_extensions_List, the_node ) ; - the_node = the_node->next ) { - - the_extension = (API_extensions_Control *) the_node; - - if ( the_extension->predriver_hook ) - (*the_extension->predriver_hook)(); - } -} - -/*PAGE - * - * _API_extensions_Run_postdriver - */ - -void _API_extensions_Run_postdriver( void ) -{ - Chain_Node *the_node; - API_extensions_Control *the_extension; - - for ( the_node = _API_extensions_List.first ; - !_Chain_Is_tail( &_API_extensions_List, the_node ) ; - the_node = the_node->next ) { - - the_extension = (API_extensions_Control *) the_node; - - if ( the_extension->postdriver_hook ) - (*the_extension->postdriver_hook)(); - } -} - -/*PAGE - * - * _API_extensions_Run_postswitch - */ - -void _API_extensions_Run_postswitch( void ) -{ - Chain_Node *the_node; - API_extensions_Control *the_extension; - - for ( the_node = _API_extensions_List.first ; - !_Chain_Is_tail( &_API_extensions_List, the_node ) ; - the_node = the_node->next ) { - - the_extension = (API_extensions_Control *) the_node; - - if ( the_extension->postswitch_hook ) - (*the_extension->postswitch_hook)( _Thread_Executing ); - } -} - -/* end of file */ diff --git a/c/src/exec/score/src/chain.c b/c/src/exec/score/src/chain.c deleted file mode 100644 index 1819968c76..0000000000 --- a/c/src/exec/score/src/chain.c +++ /dev/null @@ -1,201 +0,0 @@ -/* - * Chain Handler - * - * NOTE: - * - * The order of this file is to allow proper compilation due to the - * order of inlining required by the compiler. - * - * 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 -#include -#include -#include - -/*PAGE - * - * _Chain_Initialize - * - * This kernel routine initializes a doubly linked chain. - * - * Input parameters: - * the_chain - pointer to chain header - * starting_address - starting address of first node - * number_nodes - number of nodes in chain - * node_size - size of node in bytes - * - * Output parameters: NONE - */ - -void _Chain_Initialize( - Chain_Control *the_chain, - void *starting_address, - unsigned32 number_nodes, - unsigned32 node_size -) -{ - unsigned32 count; - Chain_Node *current; - Chain_Node *next; - - count = number_nodes; - current = _Chain_Head( the_chain ); - the_chain->permanent_null = NULL; - next = (Chain_Node *)starting_address; - while ( count-- ) { - current->next = next; - next->previous = current; - current = next; - next = (Chain_Node *) - _Addresses_Add_offset( (void *) next, node_size ); - } - current->next = _Chain_Tail( the_chain ); - the_chain->last = current; -} - -/*PAGE - * - * _Chain_Get_first_unprotected - */ - -#ifndef USE_INLINES -Chain_Node *_Chain_Get_first_unprotected( - Chain_Control *the_chain -) -{ - Chain_Node *return_node; - Chain_Node *new_first; - - return_node = the_chain->first; - new_first = return_node->next; - the_chain->first = new_first; - new_first->previous = _Chain_Head( the_chain ); - - return return_node; -} -#endif /* USE_INLINES */ - -/*PAGE - * - * _Chain_Get - * - * This kernel routine returns a pointer to a node taken from the - * given chain. - * - * Input parameters: - * the_chain - pointer to chain header - * - * Output parameters: - * return_node - pointer to node in chain allocated - * CHAIN_END - if no nodes available - * - * INTERRUPT LATENCY: - * only case - */ - -Chain_Node *_Chain_Get( - Chain_Control *the_chain -) -{ - ISR_Level level; - Chain_Node *return_node; - - return_node = NULL; - _ISR_Disable( level ); - if ( !_Chain_Is_empty( the_chain ) ) - return_node = _Chain_Get_first_unprotected( the_chain ); - _ISR_Enable( level ); - return return_node; -} - -/*PAGE - * - * _Chain_Append - * - * This kernel routine puts a node on the end of the specified chain. - * - * Input parameters: - * the_chain - pointer to chain header - * node - address of node to put at rear of chain - * - * Output parameters: NONE - * - * INTERRUPT LATENCY: - * only case - */ - -void _Chain_Append( - Chain_Control *the_chain, - Chain_Node *node -) -{ - ISR_Level level; - - _ISR_Disable( level ); - _Chain_Append_unprotected( the_chain, node ); - _ISR_Enable( level ); -} - -/*PAGE - * - * _Chain_Extract - * - * This kernel routine deletes the given node from a chain. - * - * Input parameters: - * node - pointer to node in chain to be deleted - * - * Output parameters: NONE - * - * INTERRUPT LATENCY: - * only case - */ - -void _Chain_Extract( - Chain_Node *node -) -{ - ISR_Level level; - - _ISR_Disable( level ); - _Chain_Extract_unprotected( node ); - _ISR_Enable( level ); -} - -/*PAGE - * - * _Chain_Insert - * - * This kernel routine inserts a given node after a specified node - * a requested chain. - * - * Input parameters: - * after_node - pointer to node in chain to be inserted after - * node - pointer to node to be inserted - * - * Output parameters: NONE - * - * INTERRUPT LATENCY: - * only case - */ - -void _Chain_Insert( - Chain_Node *after_node, - Chain_Node *node -) -{ - ISR_Level level; - - _ISR_Disable( level ); - _Chain_Insert_unprotected( after_node, node ); - _ISR_Enable( level ); -} diff --git a/c/src/exec/score/src/coremsg.c b/c/src/exec/score/src/coremsg.c deleted file mode 100644 index 5ae58a2908..0000000000 --- a/c/src/exec/score/src/coremsg.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * CORE Message Queue Handler - * - * DESCRIPTION: - * - * This package is the implementation of the CORE Message Queue Handler. - * This core object provides task synchronization and communication functions - * via messages passed to queue objects. - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#if defined(RTEMS_MULTIPROCESSING) -#include -#endif - -/*PAGE - * - * _CORE_message_queue_Initialize - * - * This routine initializes a newly created message queue based on the - * specified data. - * - * Input parameters: - * the_message_queue - the message queue to initialize - * the_class - the API specific object class - * the_message_queue_attributes - the message queue's attributes - * maximum_pending_messages - maximum message and reserved buffer count - * maximum_message_size - maximum size of each message - * - * Output parameters: - * TRUE - if the message queue is initialized - * FALSE - if the message queue is NOT initialized - */ - -boolean _CORE_message_queue_Initialize( - CORE_message_queue_Control *the_message_queue, - CORE_message_queue_Attributes *the_message_queue_attributes, - unsigned32 maximum_pending_messages, - unsigned32 maximum_message_size -) -{ - unsigned32 message_buffering_required; - unsigned32 allocated_message_size; - - the_message_queue->maximum_pending_messages = maximum_pending_messages; - the_message_queue->number_of_pending_messages = 0; - the_message_queue->maximum_message_size = maximum_message_size; - _CORE_message_queue_Set_notify( the_message_queue, NULL, NULL ); - - /* - * round size up to multiple of a ptr for chain init - */ - - allocated_message_size = maximum_message_size; - if (allocated_message_size & (sizeof(unsigned32) - 1)) { - allocated_message_size += sizeof(unsigned32); - allocated_message_size &= ~(sizeof(unsigned32) - 1); - } - - message_buffering_required = maximum_pending_messages * - (allocated_message_size + sizeof(CORE_message_queue_Buffer_control)); - - the_message_queue->message_buffers = (CORE_message_queue_Buffer *) - _Workspace_Allocate( message_buffering_required ); - - if (the_message_queue->message_buffers == 0) - return FALSE; - - _Chain_Initialize ( - &the_message_queue->Inactive_messages, - the_message_queue->message_buffers, - maximum_pending_messages, - allocated_message_size + sizeof( CORE_message_queue_Buffer_control ) - ); - - _Chain_Initialize_empty( &the_message_queue->Pending_messages ); - - _Thread_queue_Initialize( - &the_message_queue->Wait_queue, - _CORE_message_queue_Is_priority( the_message_queue_attributes ) ? - THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO, - STATES_WAITING_FOR_MESSAGE, - CORE_MESSAGE_QUEUE_STATUS_TIMEOUT - ); - - return TRUE; -} diff --git a/c/src/exec/score/src/coremsgbroadcast.c b/c/src/exec/score/src/coremsgbroadcast.c deleted file mode 100644 index 18e148ab1c..0000000000 --- a/c/src/exec/score/src/coremsgbroadcast.c +++ /dev/null @@ -1,112 +0,0 @@ -/* - * CORE Message Queue Handler - * - * DESCRIPTION: - * - * This package is the implementation of the CORE Message Queue Handler. - * This core object provides task synchronization and communication functions - * via messages passed to queue objects. - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#if defined(RTEMS_MULTIPROCESSING) -#include -#endif - -/*PAGE - * - * _CORE_message_queue_Broadcast - * - * This function sends a message for every thread waiting on the queue and - * returns the number of threads made ready by the message. - * - * Input parameters: - * the_message_queue - message is submitted to this message queue - * buffer - pointer to message buffer - * size - size in bytes of message to send - * id - id of message queue - * api_message_queue_mp_support - api specific mp support callout - * count - area to store number of threads made ready - * - * Output parameters: - * count - number of threads made ready - * CORE_MESSAGE_QUEUE_SUCCESSFUL - if successful - * error code - if unsuccessful - */ - -CORE_message_queue_Status _CORE_message_queue_Broadcast( - CORE_message_queue_Control *the_message_queue, - void *buffer, - unsigned32 size, - Objects_Id id, - CORE_message_queue_API_mp_support_callout api_message_queue_mp_support, - unsigned32 *count -) -{ - Thread_Control *the_thread; - unsigned32 number_broadcasted; - Thread_Wait_information *waitp; - unsigned32 constrained_size; - - /* - * If there are pending messages, then there can't be threads - * waiting for us to send them a message. - * - * NOTE: This check is critical because threads can block on - * send and receive and this ensures that we are broadcasting - * the message to threads waiting to receive -- not to send. - */ - - if ( the_message_queue->number_of_pending_messages != 0 ) { - *count = 0; - return CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL; - } - - /* - * There must be no pending messages if there is a thread waiting to - * receive a message. - */ - - number_broadcasted = 0; - while ((the_thread = _Thread_queue_Dequeue(&the_message_queue->Wait_queue))) { - waitp = &the_thread->Wait; - number_broadcasted += 1; - - constrained_size = size; - if ( size > the_message_queue->maximum_message_size ) - constrained_size = the_message_queue->maximum_message_size; - - _CORE_message_queue_Copy_buffer( - buffer, - waitp->return_argument, - constrained_size - ); - - *(unsigned32 *)the_thread->Wait.return_argument_1 = size; - -#if defined(RTEMS_MULTIPROCESSING) - if ( !_Objects_Is_local_id( the_thread->Object.id ) ) - (*api_message_queue_mp_support) ( the_thread, id ); -#endif - - } - *count = number_broadcasted; - return CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL; -} - diff --git a/c/src/exec/score/src/coremsgclose.c b/c/src/exec/score/src/coremsgclose.c deleted file mode 100644 index 245c18524f..0000000000 --- a/c/src/exec/score/src/coremsgclose.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * CORE Message Queue Handler - * - * DESCRIPTION: - * - * This package is the implementation of the CORE Message Queue Handler. - * This core object provides task synchronization and communication functions - * via messages passed to queue objects. - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#if defined(RTEMS_MULTIPROCESSING) -#include -#endif - -/*PAGE - * - * _CORE_message_queue_Close - * - * This function closes a message by returning all allocated space and - * flushing the message_queue's task wait queue. - * - * Input parameters: - * the_message_queue - the message_queue to be flushed - * remote_extract_callout - function to invoke remotely - * status - status to pass to thread - * - * Output parameters: NONE - */ - -void _CORE_message_queue_Close( - CORE_message_queue_Control *the_message_queue, - Thread_queue_Flush_callout remote_extract_callout, - unsigned32 status -) -{ - - /* - * This will flush blocked threads whether they were blocked on - * a send or receive. - */ - - _Thread_queue_Flush( - &the_message_queue->Wait_queue, - remote_extract_callout, - status - ); - - /* - * This removes all messages from the pending message queue. Since - * we just flushed all waiting threads, we don't have to worry about - * the flush satisfying any blocked senders as a side-effect. - */ - - if ( the_message_queue->number_of_pending_messages != 0 ) - (void) _CORE_message_queue_Flush_support( the_message_queue ); - - (void) _Workspace_Free( the_message_queue->message_buffers ); - -} - diff --git a/c/src/exec/score/src/coremsgflush.c b/c/src/exec/score/src/coremsgflush.c deleted file mode 100644 index 957d00a59e..0000000000 --- a/c/src/exec/score/src/coremsgflush.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * CORE Message Queue Handler - * - * DESCRIPTION: - * - * This package is the implementation of the CORE Message Queue Handler. - * This core object provides task synchronization and communication functions - * via messages passed to queue objects. - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#if defined(RTEMS_MULTIPROCESSING) -#include -#endif - -/*PAGE - * - * _CORE_message_queue_Flush - * - * This function flushes the message_queue's pending message queue. The - * number of messages flushed from the queue is returned. - * - * Input parameters: - * the_message_queue - the message_queue to be flushed - * - * Output parameters: - * returns - the number of messages flushed from the queue - */ - -unsigned32 _CORE_message_queue_Flush( - CORE_message_queue_Control *the_message_queue -) -{ - if ( the_message_queue->number_of_pending_messages != 0 ) - return _CORE_message_queue_Flush_support( the_message_queue ); - else - return 0; -} - diff --git a/c/src/exec/score/src/coremsgflushsupp.c b/c/src/exec/score/src/coremsgflushsupp.c deleted file mode 100644 index 4bfd8f358b..0000000000 --- a/c/src/exec/score/src/coremsgflushsupp.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * CORE Message Queue Handler - * - * DESCRIPTION: - * - * This package is the implementation of the CORE Message Queue Handler. - * This core object provides task synchronization and communication functions - * via messages passed to queue objects. - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#if defined(RTEMS_MULTIPROCESSING) -#include -#endif - -/*PAGE - * - * _CORE_message_queue_Flush_support - * - * This message handler routine removes all messages from a message queue - * and returns them to the inactive message pool. The number of messages - * flushed from the queue is returned - * - * Input parameters: - * the_message_queue - pointer to message queue - * - * Output parameters: - * returns - number of messages placed on inactive chain - * - * INTERRUPT LATENCY: - * only case - */ - -unsigned32 _CORE_message_queue_Flush_support( - CORE_message_queue_Control *the_message_queue -) -{ - ISR_Level level; - Chain_Node *inactive_first; - Chain_Node *message_queue_first; - Chain_Node *message_queue_last; - unsigned32 count; - - /* - * Currently, RTEMS supports no API that has both flush and blocking - * sends. Thus, this routine assumes that there are no senders - * blocked waiting to send messages. In the event, that an API is - * added that can flush a message queue when threads are blocked - * waiting to send, there are two basic behaviors envisioned: - * - * (1) The thread queue of pending senders is a logical extension - * of the pending message queue. In this case, it should be - * flushed using the _Thread_queue_Flush() service with a status - * such as CORE_MESSAGE_QUEUE_SENDER_FLUSHED (which currently does - * not exist). This can be implemented without changing the "big-O" - * of the message flushing part of the routine. - * - * (2) Only the actual messages queued should be purged. In this case, - * the blocked sender threads must be allowed to send their messages. - * In this case, the implementation will be forced to individually - * dequeue the senders and queue their messages. This will force - * this routine to have "big O(n)" where n is the number of blocked - * senders. If there are more messages pending than senders blocked, - * then the existing flush code can be used to dispose of the remaining - * pending messages. - * - * For now, though, we are very happy to have a small routine with - * fixed execution time that only deals with pending messages. - */ - - _ISR_Disable( level ); - inactive_first = the_message_queue->Inactive_messages.first; - message_queue_first = the_message_queue->Pending_messages.first; - message_queue_last = the_message_queue->Pending_messages.last; - - the_message_queue->Inactive_messages.first = message_queue_first; - message_queue_last->next = inactive_first; - inactive_first->previous = message_queue_last; - message_queue_first->previous = - _Chain_Head( &the_message_queue->Inactive_messages ); - - _Chain_Initialize_empty( &the_message_queue->Pending_messages ); - - count = the_message_queue->number_of_pending_messages; - the_message_queue->number_of_pending_messages = 0; - _ISR_Enable( level ); - return count; -} - diff --git a/c/src/exec/score/src/coremsgflushwait.c b/c/src/exec/score/src/coremsgflushwait.c deleted file mode 100644 index bda8143ffd..0000000000 --- a/c/src/exec/score/src/coremsgflushwait.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * CORE Message Queue Handler - * - * DESCRIPTION: - * - * This package is the implementation of the CORE Message Queue Handler. - * This core object provides task synchronization and communication functions - * via messages passed to queue objects. - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#if defined(RTEMS_MULTIPROCESSING) -#include -#endif - -/*PAGE - * - * _CORE_message_queue_Flush_waiting_threads - * - * This function flushes the message_queue's task wait queue. The number - * of messages flushed from the queue is returned. - * - * Input parameters: - * the_message_queue - the message_queue to be flushed - * - * Output parameters: - * returns - the number of messages flushed from the queue - */ - -void _CORE_message_queue_Flush_waiting_threads( - CORE_message_queue_Control *the_message_queue -) -{ - /* XXX this is not supported for global message queues */ - - /* - * IF there are no pending messages, - * THEN threads may be blocked waiting to RECEIVE a message, - * - * IF the pending message queue is full - * THEN threads may be blocked waiting to SEND a message - * - * But in either case, we will return "unsatisfied nowait" - * to indicate that the blocking condition was not satisfied - * and that the blocking state was canceled. - */ - - _Thread_queue_Flush( - &the_message_queue->Wait_queue, - NULL, - CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_NOWAIT - ); -} - diff --git a/c/src/exec/score/src/coremsginsert.c b/c/src/exec/score/src/coremsginsert.c deleted file mode 100644 index f468334c97..0000000000 --- a/c/src/exec/score/src/coremsginsert.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * CORE Message Queue Handler - * - * DESCRIPTION: - * - * This package is the implementation of the CORE Message Queue Handler. - * This core object provides task synchronization and communication functions - * via messages passed to queue objects. - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#if defined(RTEMS_MULTIPROCESSING) -#include -#endif - -/*PAGE - * - * _CORE_message_queue_Insert_message - * - * This kernel routine inserts the specified message into the - * message queue. It is assumed that the message has been filled - * in before this routine is called. - * - * Input parameters: - * the_message_queue - pointer to message queue - * the_message - message to insert - * priority - insert indication - * - * Output parameters: NONE - * - * INTERRUPT LATENCY: - * insert - */ - -void _CORE_message_queue_Insert_message( - CORE_message_queue_Control *the_message_queue, - CORE_message_queue_Buffer_control *the_message, - CORE_message_queue_Submit_types submit_type -) -{ - the_message_queue->number_of_pending_messages += 1; - - the_message->priority = submit_type; - - switch ( submit_type ) { - case CORE_MESSAGE_QUEUE_SEND_REQUEST: - _CORE_message_queue_Append( the_message_queue, the_message ); - break; - case CORE_MESSAGE_QUEUE_URGENT_REQUEST: - _CORE_message_queue_Prepend( the_message_queue, the_message ); - break; - default: - /* XXX interrupt critical section needs to be addressed */ - { - CORE_message_queue_Buffer_control *this_message; - Chain_Node *the_node; - Chain_Control *the_header; - - the_header = &the_message_queue->Pending_messages; - the_node = the_header->first; - while ( !_Chain_Is_tail( the_header, the_node ) ) { - - this_message = (CORE_message_queue_Buffer_control *) the_node; - - if ( this_message->priority <= the_message->priority ) { - the_node = the_node->next; - continue; - } - - break; - } - _Chain_Insert( the_node->previous, &the_message->Node ); - } - break; - } - - /* - * According to POSIX, does this happen before or after the message - * is actually enqueued. It is logical to think afterwards, because - * the message is actually in the queue at this point. - */ - - if ( the_message_queue->number_of_pending_messages == 1 && - the_message_queue->notify_handler ) - (*the_message_queue->notify_handler)( the_message_queue->notify_argument ); -} diff --git a/c/src/exec/score/src/coremsgseize.c b/c/src/exec/score/src/coremsgseize.c deleted file mode 100644 index 9e72f2f8a1..0000000000 --- a/c/src/exec/score/src/coremsgseize.c +++ /dev/null @@ -1,137 +0,0 @@ -/* - * CORE Message Queue Handler - * - * DESCRIPTION: - * - * This package is the implementation of the CORE Message Queue Handler. - * This core object provides task synchronization and communication functions - * via messages passed to queue objects. - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#if defined(RTEMS_MULTIPROCESSING) -#include -#endif - -/*PAGE - * - * _CORE_message_queue_Seize - * - * This kernel routine dequeues a message, copies the message buffer to - * a given destination buffer, and frees the message buffer to the - * inactive message pool. The thread will be blocked if wait is TRUE, - * otherwise an error will be given to the thread if no messages are available. - * - * Input parameters: - * the_message_queue - pointer to message queue - * id - id of object we are waitig on - * buffer - pointer to message buffer to be filled - * size - pointer to the size of buffer to be filled - * wait - TRUE if wait is allowed, FALSE otherwise - * timeout - time to wait for a message - * - * Output parameters: NONE - * - * NOTE: Dependent on BUFFER_LENGTH - * - * INTERRUPT LATENCY: - * available - * wait - */ - -void _CORE_message_queue_Seize( - CORE_message_queue_Control *the_message_queue, - Objects_Id id, - void *buffer, - unsigned32 *size, - boolean wait, - Watchdog_Interval timeout -) -{ - ISR_Level level; - CORE_message_queue_Buffer_control *the_message; - Thread_Control *executing; - Thread_Control *the_thread; - - executing = _Thread_Executing; - executing->Wait.return_code = CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL; - _ISR_Disable( level ); - if ( the_message_queue->number_of_pending_messages != 0 ) { - the_message_queue->number_of_pending_messages -= 1; - - the_message = _CORE_message_queue_Get_pending_message( the_message_queue ); - _ISR_Enable( level ); - - *size = the_message->Contents.size; - _Thread_Executing->Wait.count = the_message->priority; - _CORE_message_queue_Copy_buffer(the_message->Contents.buffer,buffer,*size); - - /* - * There could be a thread waiting to send a message. If there - * is not, then we can go ahead and free the buffer. - * - * NOTE: If we note that the queue was not full before this receive, - * then we can avoid this dequeue. - */ - - the_thread = _Thread_queue_Dequeue( &the_message_queue->Wait_queue ); - if ( !the_thread ) { - _CORE_message_queue_Free_message_buffer( the_message_queue, the_message ); - return; - } - - /* - * There was a thread waiting to send a message. This code - * puts the messages in the message queue on behalf of the - * waiting task. - */ - - the_message->priority = the_thread->Wait.count; - the_message->Contents.size = (unsigned32)the_thread->Wait.return_argument_1; - _CORE_message_queue_Copy_buffer( - the_thread->Wait.return_argument, - the_message->Contents.buffer, - the_message->Contents.size - ); - - _CORE_message_queue_Insert_message( - the_message_queue, - the_message, - the_message->priority - ); - return; - } - - if ( !wait ) { - _ISR_Enable( level ); - executing->Wait.return_code = CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_NOWAIT; - return; - } - - _Thread_queue_Enter_critical_section( &the_message_queue->Wait_queue ); - executing->Wait.queue = &the_message_queue->Wait_queue; - executing->Wait.id = id; - executing->Wait.return_argument = (void *)buffer; - executing->Wait.return_argument_1 = (void *)size; - /* Wait.count will be filled in with the message priority */ - _ISR_Enable( level ); - - _Thread_queue_Enqueue( &the_message_queue->Wait_queue, timeout ); -} - diff --git a/c/src/exec/score/src/coremsgsubmit.c b/c/src/exec/score/src/coremsgsubmit.c deleted file mode 100644 index eabcb79ddf..0000000000 --- a/c/src/exec/score/src/coremsgsubmit.c +++ /dev/null @@ -1,175 +0,0 @@ -/* - * CORE Message Queue Handler - * - * DESCRIPTION: - * - * This package is the implementation of the CORE Message Queue Handler. - * This core object provides task synchronization and communication functions - * via messages passed to queue objects. - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#if defined(RTEMS_MULTIPROCESSING) -#include -#endif - -/*PAGE - * - * _CORE_message_queue_Submit - * - * This routine implements the send and urgent message functions. It - * processes a message that is to be submitted to the designated - * message queue. The message will either be processed as a - * send message which it will be inserted at the rear of the queue - * or it will be processed as an urgent message which will be inserted - * at the front of the queue. - * - * Input parameters: - * the_message_queue - message is submitted to this message queue - * buffer - pointer to message buffer - * size - size in bytes of message to send - * id - id of message queue - * api_message_queue_mp_support - api specific mp support callout - * submit_type - send or urgent message - * - * Output parameters: - * CORE_MESSAGE_QUEUE_SUCCESSFUL - if successful - * error code - if unsuccessful - */ - -CORE_message_queue_Status _CORE_message_queue_Submit( - CORE_message_queue_Control *the_message_queue, - void *buffer, - unsigned32 size, - Objects_Id id, - CORE_message_queue_API_mp_support_callout api_message_queue_mp_support, - CORE_message_queue_Submit_types submit_type, - boolean wait, - Watchdog_Interval timeout -) -{ - ISR_Level level; - CORE_message_queue_Buffer_control *the_message; - Thread_Control *the_thread; - - if ( size > the_message_queue->maximum_message_size ) { - return CORE_MESSAGE_QUEUE_STATUS_INVALID_SIZE; - } - - /* - * Is there a thread currently waiting on this message queue? - */ - - if ( the_message_queue->number_of_pending_messages == 0 ) { - the_thread = _Thread_queue_Dequeue( &the_message_queue->Wait_queue ); - if ( the_thread ) { - _CORE_message_queue_Copy_buffer( - buffer, - the_thread->Wait.return_argument, - size - ); - *(unsigned32 *)the_thread->Wait.return_argument_1 = size; - the_thread->Wait.count = submit_type; - -#if defined(RTEMS_MULTIPROCESSING) - if ( !_Objects_Is_local_id( the_thread->Object.id ) ) - (*api_message_queue_mp_support) ( the_thread, id ); -#endif - return CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL; - } - } - - /* - * No one waiting on the message queue at this time, so attempt to - * queue the message up for a future receive. - */ - - if ( the_message_queue->number_of_pending_messages < - the_message_queue->maximum_pending_messages ) { - - the_message = - _CORE_message_queue_Allocate_message_buffer( the_message_queue ); - - /* - * NOTE: If the system is consistent, this error should never occur. - */ - - if ( !the_message ) { - return CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED; - } - - _CORE_message_queue_Copy_buffer( - buffer, - the_message->Contents.buffer, - size - ); - the_message->Contents.size = size; - the_message->priority = submit_type; - - _CORE_message_queue_Insert_message( - the_message_queue, - the_message, - submit_type - ); - return CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL; - } - - /* - * No message buffers were available so we may need to return an - * overflow error or block the sender until the message is placed - * on the queue. - */ - - if ( !wait ) { - return CORE_MESSAGE_QUEUE_STATUS_TOO_MANY; - } - - /* - * Do NOT block on a send if the caller is in an ISR. It is - * deadly to block in an ISR. - */ - - if ( _ISR_Is_in_progress() ) { - return CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED; - } - - /* - * WARNING!! executing should NOT be used prior to this point. - * Thus the unusual choice to open a new scope and declare - * it as a variable. Doing this emphasizes how dangerous it - * would be to use this variable prior to here. - */ - - { - Thread_Control *executing = _Thread_Executing; - - _ISR_Disable( level ); - _Thread_queue_Enter_critical_section( &the_message_queue->Wait_queue ); - executing->Wait.queue = &the_message_queue->Wait_queue; - executing->Wait.id = id; - executing->Wait.return_argument = (void *)buffer; - executing->Wait.return_argument_1 = (void *)size; - executing->Wait.count = submit_type; - _ISR_Enable( level ); - - _Thread_queue_Enqueue( &the_message_queue->Wait_queue, timeout ); - } - - return CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_WAIT; -} diff --git a/c/src/exec/score/src/coremutex.c b/c/src/exec/score/src/coremutex.c deleted file mode 100644 index e2ef275b75..0000000000 --- a/c/src/exec/score/src/coremutex.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Mutex Handler - * - * DESCRIPTION: - * - * This package is the implementation of the Mutex Handler. - * This handler provides synchronization and mutual exclusion capabilities. - * - * 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 -#include -#include -#include -#include -#include - -/*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_mutex_attributes - the mutex attributes specified at create time - * initial_lock - mutex initial lock or unlocked status - * - * Output parameters: NONE - */ - -void _CORE_mutex_Initialize( - CORE_mutex_Control *the_mutex, - CORE_mutex_Attributes *the_mutex_attributes, - unsigned32 initial_lock -) -{ - -/* 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; - the_mutex->blocked_count = 0; - -#if 0 - if ( !the_mutex_attributes->only_owner_release && - the_mutex_attributes->nesting_allowed ) { - _Internal_error_Occurred( - INTERNAL_ERROR_CORE, - TRUE, - INTERNAL_ERROR_BAD_ATTRIBUTES - ); - } -#endif - - if ( initial_lock == CORE_MUTEX_LOCKED ) { - the_mutex->nest_count = 1; - the_mutex->holder = _Thread_Executing; - the_mutex->holder_id = _Thread_Executing->Object.id; - if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) || - _CORE_mutex_Is_priority_ceiling( &the_mutex->Attributes ) ) - _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, - _CORE_mutex_Is_fifo( the_mutex_attributes ) ? - THREAD_QUEUE_DISCIPLINE_FIFO : THREAD_QUEUE_DISCIPLINE_PRIORITY, - STATES_WAITING_FOR_MUTEX, - CORE_MUTEX_TIMEOUT - ); -} - diff --git a/c/src/exec/score/src/coremutexflush.c b/c/src/exec/score/src/coremutexflush.c deleted file mode 100644 index ad4f3b6cc3..0000000000 --- a/c/src/exec/score/src/coremutexflush.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Mutex Handler - * - * DESCRIPTION: - * - * This package is the implementation of the Mutex Handler. - * This handler provides synchronization and mutual exclusion capabilities. - * - * 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 -#include -#include -#include -#include -#include - -/*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/coremutexseize.c b/c/src/exec/score/src/coremutexseize.c deleted file mode 100644 index 2fb2fc27e9..0000000000 --- a/c/src/exec/score/src/coremutexseize.c +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Mutex Handler - * - * DESCRIPTION: - * - * This package is the implementation of the Mutex Handler. - * This handler provides synchronization and mutual exclusion capabilities. - * - * 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 -#include -#include -#include -#include -#include - -/*PAGE - * - * _CORE_mutex_Seize (interrupt blocking support) - * - * This routine blocks the caller thread after an attempt attempts to obtain - * the specified mutex has failed. - * - * Input parameters: - * the_mutex - pointer to mutex control block - * timeout - number of ticks to wait (0 means forever) - */ - -void _CORE_mutex_Seize_interrupt_blocking( - CORE_mutex_Control *the_mutex, - Watchdog_Interval timeout -) -{ - Thread_Control *executing; - - executing = _Thread_Executing; - if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) ) { - if ( the_mutex->holder->current_priority > executing->current_priority ) { - _Thread_Change_priority( - the_mutex->holder, - executing->current_priority, - FALSE - ); - } - } - - the_mutex->blocked_count++; - _Thread_queue_Enqueue( &the_mutex->Wait_queue, timeout ); - - if ( _Thread_Executing->Wait.return_code == CORE_MUTEX_STATUS_SUCCESSFUL ) { - /* - * if CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT then nothing to do - * because this task is already the highest priority. - */ - - if ( _CORE_mutex_Is_priority_ceiling( &the_mutex->Attributes ) ) { - if (the_mutex->Attributes.priority_ceiling < executing->current_priority){ - _Thread_Change_priority( - executing, - the_mutex->Attributes.priority_ceiling, - FALSE - ); - } - } - } - _Thread_Enable_dispatch(); -} - -#if !defined(USE_INLINES) -int _CORE_mutex_Seize_interrupt_trylock( - CORE_mutex_Control *the_mutex, - ISR_Level *level_p -) -{ - Thread_Control *executing; - ISR_Level level = *level_p; - - /* disabled when you get here */ - - executing = _Thread_Executing; - executing->Wait.return_code = CORE_MUTEX_STATUS_SUCCESSFUL; - 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; - if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) || - _CORE_mutex_Is_priority_ceiling( &the_mutex->Attributes ) ) - executing->resource_count++; - - if ( !_CORE_mutex_Is_priority_ceiling( &the_mutex->Attributes ) ) { - _ISR_Enable( level ); - return 0; - } - /* else must be CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING */ - { - Priority_Control ceiling; - Priority_Control current; - - ceiling = the_mutex->Attributes.priority_ceiling; - current = executing->current_priority; - if ( current == ceiling ) { - _ISR_Enable( level ); - return 0; - } - if ( current > ceiling ) { - _Thread_Disable_dispatch(); - _ISR_Enable( level ); - _Thread_Change_priority( - the_mutex->holder, - the_mutex->Attributes.priority_ceiling, - FALSE - ); - _Thread_Enable_dispatch(); - return 0; - } - /* if ( current < ceiling ) */ { - executing->Wait.return_code = CORE_MUTEX_STATUS_CEILING_VIOLATED; - the_mutex->nest_count = 0; /* undo locking above */ - executing->resource_count--; /* undo locking above */ - _ISR_Enable( level ); - return 0; - } - } - return 0; - } - - if ( _Thread_Is_executing( the_mutex->holder ) ) { - switch ( the_mutex->Attributes.lock_nesting_behavior ) { - case CORE_MUTEX_NESTING_ACQUIRES: - the_mutex->nest_count++; - _ISR_Enable( level ); - return 0; - case CORE_MUTEX_NESTING_IS_ERROR: - executing->Wait.return_code = CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED; - _ISR_Enable( level ); - return 0; - case CORE_MUTEX_NESTING_BLOCKS: - break; - } - } - - return 1; -} -#endif diff --git a/c/src/exec/score/src/coremutexsurrender.c b/c/src/exec/score/src/coremutexsurrender.c deleted file mode 100644 index bd9cc5bf65..0000000000 --- a/c/src/exec/score/src/coremutexsurrender.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Mutex Handler - * - * DESCRIPTION: - * - * This package is the implementation of the Mutex Handler. - * This handler provides synchronization and mutual exclusion capabilities. - * - * 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 -#include -#include -#include -#include -#include - -/* - * _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; - Thread_Control *holder; - - holder = the_mutex->holder; - - /* - * The following code allows a thread (or ISR) other than the thread - * which acquired the mutex to release that mutex. This is only - * allowed when the mutex in quetion is FIFO or simple Priority - * discipline. But Priority Ceiling or Priority Inheritance mutexes - * must be released by the thread which acquired them. - */ - - if ( the_mutex->Attributes.only_owner_release ) { - if ( !_Thread_Is_executing( holder ) ) - return CORE_MUTEX_STATUS_NOT_OWNER_OF_RESOURCE; - } - - /* XXX already unlocked -- not right status */ - - if ( !the_mutex->nest_count ) - return CORE_MUTEX_STATUS_SUCCESSFUL; - - the_mutex->nest_count--; - - if ( the_mutex->nest_count != 0 ) { - switch ( the_mutex->Attributes.lock_nesting_behavior ) { - case CORE_MUTEX_NESTING_ACQUIRES: - return CORE_MUTEX_STATUS_SUCCESSFUL; - case CORE_MUTEX_NESTING_IS_ERROR: - /* should never occur */ - return CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED; - case CORE_MUTEX_NESTING_BLOCKS: - /* Currently no API exercises this behavior. */ - break; - } - } - - if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) || - _CORE_mutex_Is_priority_ceiling( &the_mutex->Attributes ) ) - holder->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 ) || - _CORE_mutex_Is_priority_ceiling( &the_mutex->Attributes ) ) { - if ( holder->resource_count == 0 && - holder->real_priority != holder->current_priority ) { - _Thread_Change_priority( holder, holder->real_priority, TRUE ); - } - } - - if ( ( the_thread = _Thread_queue_Dequeue( &the_mutex->Wait_queue ) ) ) { - -#if defined(RTEMS_MULTIPROCESSING) - 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 -#endif - { - - the_mutex->holder = the_thread; - the_mutex->holder_id = the_thread->Object.id; - if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) || - _CORE_mutex_Is_priority_ceiling( &the_mutex->Attributes ) ) - the_thread->resource_count++; - the_mutex->nest_count = 1; - - /* - * No special action for priority inheritance or priority ceiling - * 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; -} - diff --git a/c/src/exec/score/src/coresem.c b/c/src/exec/score/src/coresem.c deleted file mode 100644 index 9dc878ca6c..0000000000 --- a/c/src/exec/score/src/coresem.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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-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 -#include -#include -#include -#include -#include -#if defined(RTEMS_MULTIPROCESSING) -#include -#endif - -/*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_semaphore_attributes - the attributes specified at create time - * initial_value - semaphore's initial value - * - * Output parameters: NONE - */ - -void _CORE_semaphore_Initialize( - CORE_semaphore_Control *the_semaphore, - CORE_semaphore_Attributes *the_semaphore_attributes, - unsigned32 initial_value -) -{ - - the_semaphore->Attributes = *the_semaphore_attributes; - the_semaphore->count = initial_value; - - _Thread_queue_Initialize( - &the_semaphore->Wait_queue, - _CORE_semaphore_Is_priority( the_semaphore_attributes ) ? - THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO, - STATES_WAITING_FOR_SEMAPHORE, - CORE_SEMAPHORE_TIMEOUT - ); -} diff --git a/c/src/exec/score/src/coresemflush.c b/c/src/exec/score/src/coresemflush.c deleted file mode 100644 index e30f768aab..0000000000 --- a/c/src/exec/score/src/coresemflush.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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-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 -#include -#include -#include -#include -#include -#if defined(RTEMS_MULTIPROCESSING) -#include -#endif - -/*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/coresemseize.c b/c/src/exec/score/src/coresemseize.c deleted file mode 100644 index 0f3c25aeac..0000000000 --- a/c/src/exec/score/src/coresemseize.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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-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 -#include -#include -#include -#include -#include -#if defined(RTEMS_MULTIPROCESSING) -#include -#endif - -/*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; - _ISR_Enable( level ); - return; - } - - if ( !wait ) { - _ISR_Enable( level ); - executing->Wait.return_code = CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT; - return; - } - - _Thread_queue_Enter_critical_section( &the_semaphore->Wait_queue ); - executing->Wait.queue = &the_semaphore->Wait_queue; - executing->Wait.id = id; - _ISR_Enable( level ); - - _Thread_queue_Enqueue( &the_semaphore->Wait_queue, timeout ); -} diff --git a/c/src/exec/score/src/coresemsurrender.c b/c/src/exec/score/src/coresemsurrender.c deleted file mode 100644 index 1a54a5c712..0000000000 --- a/c/src/exec/score/src/coresemsurrender.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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-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 -#include -#include -#include -#include -#include -#if defined(RTEMS_MULTIPROCESSING) -#include -#endif - -/*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; - ISR_Level level; - CORE_semaphore_Status status; - - status = CORE_SEMAPHORE_STATUS_SUCCESSFUL; - - 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 { - _ISR_Disable( level ); - if ( the_semaphore->count <= the_semaphore->Attributes.maximum_count ) - the_semaphore->count += 1; - else - status = CORE_SEMAPHORE_MAXIMUM_COUNT_EXCEEDED; - _ISR_Enable( level ); - } - - return status; -} - diff --git a/c/src/exec/score/src/coretod.c b/c/src/exec/score/src/coretod.c deleted file mode 100644 index ef1091e1d2..0000000000 --- a/c/src/exec/score/src/coretod.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Time of Day (TOD) Handler - * - * - * 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 -#include -#include -#include -#include - -/*PAGE - * - * _TOD_Handler_initialization - * - * This routine initializes the time of day handler. - * - * Input parameters: - * microseconds_per_tick - microseconds between clock ticks - * - * Output parameters: NONE - */ - -void _TOD_Handler_initialization( - unsigned32 microseconds_per_tick -) -{ - _TOD_Microseconds_per_tick = microseconds_per_tick; - - _TOD_Seconds_since_epoch = 0; - - _TOD_Current.year = TOD_BASE_YEAR; - _TOD_Current.month = 1; - _TOD_Current.day = 1; - _TOD_Current.hour = 0; - _TOD_Current.minute = 0; - _TOD_Current.second = 0; - _TOD_Current.ticks = 0; - - if ( microseconds_per_tick == 0 ) - _TOD_Ticks_per_second = 0; - else - _TOD_Ticks_per_second = - TOD_MICROSECONDS_PER_SECOND / microseconds_per_tick; - - _Watchdog_Initialize( &_TOD_Seconds_watchdog, _TOD_Tickle, 0, NULL ); - - _TOD_Is_set = FALSE; - _TOD_Activate( _TOD_Ticks_per_second ); -} diff --git a/c/src/exec/score/src/coretodset.c b/c/src/exec/score/src/coretodset.c deleted file mode 100644 index ddb6f8ee43..0000000000 --- a/c/src/exec/score/src/coretodset.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Time of Day (TOD) Handler - * - * - * 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 -#include -#include -#include -#include - -/*PAGE - * - * _TOD_Set - * - * This rountine sets the current date and time with the specified - * new date and time structure. - * - * Input parameters: - * the_tod - pointer to the time and date structure - * seconds_since_epoch - seconds since system epoch - * - * Output parameters: NONE - */ - -void _TOD_Set( - TOD_Control *the_tod, - Watchdog_Interval seconds_since_epoch -) -{ - Watchdog_Interval ticks_until_next_second; - - _Thread_Disable_dispatch(); - _TOD_Deactivate(); - - if ( seconds_since_epoch < _TOD_Seconds_since_epoch ) - _Watchdog_Adjust_seconds( WATCHDOG_BACKWARD, - _TOD_Seconds_since_epoch - seconds_since_epoch ); - else - _Watchdog_Adjust_seconds( WATCHDOG_FORWARD, - seconds_since_epoch - _TOD_Seconds_since_epoch ); - - ticks_until_next_second = _TOD_Ticks_per_second; - if ( ticks_until_next_second > _TOD_Current.ticks ) - ticks_until_next_second -= _TOD_Current.ticks; - - _TOD_Current = *the_tod; - _TOD_Seconds_since_epoch = seconds_since_epoch; - _TOD_Is_set = TRUE; - _TOD_Activate( ticks_until_next_second ); - - _Thread_Enable_dispatch(); -} - diff --git a/c/src/exec/score/src/coretodtickle.c b/c/src/exec/score/src/coretodtickle.c deleted file mode 100644 index c28545f2b4..0000000000 --- a/c/src/exec/score/src/coretodtickle.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Time of Day (TOD) Handler - * - * - * 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 -#include -#include -#include -#include - -/*PAGE - * - * _TOD_Tickle - * - * This routine updates the calendar time and tickles the - * per second watchdog timer chain. - * - * Input parameters: - * ignored - this parameter is ignored - * - * Output parameters: NONE - * - * NOTE: This routine only works for leap-years through 2099. - */ - -void _TOD_Tickle( - Objects_Id id, - void *ignored -) -{ - unsigned32 leap; - - _TOD_Current.ticks = 0; - ++_TOD_Seconds_since_epoch; - if ( ++_TOD_Current.second >= TOD_SECONDS_PER_MINUTE ) { - _TOD_Current.second = 0; - if ( ++_TOD_Current.minute >= TOD_MINUTES_PER_HOUR ) { - _TOD_Current.minute = 0; - if ( ++_TOD_Current.hour >= TOD_HOURS_PER_DAY ) { - _TOD_Current.hour = 0; - if ( _TOD_Current.year & 0x3 ) leap = 0; - else leap = 1; - if ( ++_TOD_Current.day > - _TOD_Days_per_month[ leap ][ _TOD_Current.month ]) { - _TOD_Current.day = 1; - if ( ++_TOD_Current.month > TOD_MONTHS_PER_YEAR ) { - _TOD_Current.month = 1; - _TOD_Current.year++; - } - } - } - } - } - - _Watchdog_Tickle_seconds(); - _Watchdog_Insert_ticks( &_TOD_Seconds_watchdog, _TOD_Ticks_per_second ); -} diff --git a/c/src/exec/score/src/coretodtoseconds.c b/c/src/exec/score/src/coretodtoseconds.c deleted file mode 100644 index 16e9d24a1e..0000000000 --- a/c/src/exec/score/src/coretodtoseconds.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Time of Day (TOD) Handler - * - * - * 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 -#include -#include -#include -#include - -/*PAGE - * - * _TOD_To_seconds - * - * This routine returns the seconds from the epoch until the - * current date and time. - * - * Input parameters: - * the_tod - pointer to the time and date structure - * - * Output parameters: - * returns - seconds since epoch until the_tod - */ - -unsigned32 _TOD_To_seconds( - TOD_Control *the_tod -) -{ - unsigned32 time; - unsigned32 year_mod_4; - - time = the_tod->day - 1; - year_mod_4 = the_tod->year & 3; - - if ( year_mod_4 == 0 ) - time += _TOD_Days_to_date[ 1 ][ the_tod->month ]; - else - time += _TOD_Days_to_date[ 0 ][ the_tod->month ]; - - time += ( (the_tod->year - TOD_BASE_YEAR) / 4 ) * - ( (TOD_DAYS_PER_YEAR * 4) + 1); - - time += _TOD_Days_since_last_leap_year[ year_mod_4 ]; - - time *= TOD_SECONDS_PER_DAY; - - time += ((the_tod->hour * TOD_MINUTES_PER_HOUR) + the_tod->minute) - * TOD_SECONDS_PER_MINUTE; - - time += the_tod->second; - - return( time ); -} - diff --git a/c/src/exec/score/src/coretodvalidate.c b/c/src/exec/score/src/coretodvalidate.c deleted file mode 100644 index 18f377e500..0000000000 --- a/c/src/exec/score/src/coretodvalidate.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Time of Day (TOD) Handler - * - * - * 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 -#include -#include -#include -#include - -/*PAGE - * - * _TOD_Validate - * - * This kernel routine checks the validity of a date and time structure. - * - * Input parameters: - * the_tod - pointer to a time and date structure - * - * Output parameters: - * 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. - */ - -boolean _TOD_Validate( - TOD_Control *the_tod -) -{ - unsigned32 days_in_month; - - if ((the_tod->ticks >= _TOD_Ticks_per_second) || - (the_tod->second >= TOD_SECONDS_PER_MINUTE) || - (the_tod->minute >= TOD_MINUTES_PER_HOUR) || - (the_tod->hour >= TOD_HOURS_PER_DAY) || - (the_tod->month == 0) || - (the_tod->month > TOD_MONTHS_PER_YEAR) || - (the_tod->year < TOD_BASE_YEAR) || - (the_tod->day == 0) ) - return FALSE; - - if ( (the_tod->year % 4) == 0 ) - days_in_month = _TOD_Days_per_month[ 1 ][ the_tod->month ]; - else - days_in_month = _TOD_Days_per_month[ 0 ][ the_tod->month ]; - - if ( the_tod->day > days_in_month ) - return FALSE; - - return TRUE; -} - diff --git a/c/src/exec/score/src/heap.c b/c/src/exec/score/src/heap.c deleted file mode 100644 index 9ad4ca51ee..0000000000 --- a/c/src/exec/score/src/heap.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Heap Handler - * - * 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 -#include -#include - -/*PAGE - * - * _Heap_Initialize - * - * This kernel routine initializes a heap. - * - * Input parameters: - * the_heap - pointer to heap header - * starting_address - starting address of heap - * size - size of heap - * page_size - allocatable unit of memory - * - * Output parameters: - * returns - maximum memory available if RTEMS_SUCCESSFUL - * 0 - otherwise - * - * This is what a heap looks like in memory immediately - * after initialization: - * - * +--------------------------------+ - * 0 | size = 0 | status = used | a.k.a. dummy back flag - * +--------------------------------+ - * 4 | size = size-8 | status = free | a.k.a. front flag - * +--------------------------------+ - * 8 | next = PERM HEAP_TAIL | - * +--------------------------------+ - * 12 | previous = PERM HEAP_HEAD | - * +--------------------------------+ - * | | - * | memory available | - * | for allocation | - * | | - * +--------------------------------+ - * size - 8 | size = size-8 | status = free | a.k.a. back flag - * +--------------------------------+ - * size - 4 | size = 0 | status = used | a.k.a. dummy front flag - * +--------------------------------+ - */ - -unsigned32 _Heap_Initialize( - Heap_Control *the_heap, - void *starting_address, - unsigned32 size, - unsigned32 page_size -) -{ - Heap_Block *the_block; - unsigned32 the_size; - - if ( !_Heap_Is_page_size_valid( page_size ) || - (size < HEAP_MINIMUM_SIZE) ) - return 0; - - the_heap->page_size = page_size; - the_size = size - HEAP_OVERHEAD; - - the_block = (Heap_Block *) starting_address; - the_block->back_flag = HEAP_DUMMY_FLAG; - the_block->front_flag = the_size; - the_block->next = _Heap_Tail( the_heap ); - the_block->previous = _Heap_Head( the_heap ); - - the_heap->start = the_block; - the_heap->first = the_block; - the_heap->permanent_null = NULL; - the_heap->last = the_block; - - the_block = _Heap_Next_block( the_block ); - the_block->back_flag = the_size; - the_block->front_flag = HEAP_DUMMY_FLAG; - the_heap->final = the_block; - - return ( the_size - HEAP_BLOCK_USED_OVERHEAD ); -} - diff --git a/c/src/exec/score/src/heapallocate.c b/c/src/exec/score/src/heapallocate.c deleted file mode 100644 index 3699a6b080..0000000000 --- a/c/src/exec/score/src/heapallocate.c +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Heap Handler - * - * 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 -#include -#include - -/*PAGE - * - * _Heap_Allocate - * - * This kernel routine allocates the requested size of memory - * from the specified heap. - * - * Input parameters: - * the_heap - pointer to heap header. - * size - size in bytes of the memory block to allocate. - * - * Output parameters: - * returns - starting address of memory block allocated - */ - -void *_Heap_Allocate( - Heap_Control *the_heap, - unsigned32 size -) -{ - unsigned32 excess; - unsigned32 the_size; - Heap_Block *the_block; - Heap_Block *next_block; - Heap_Block *temporary_block; - void *ptr; - unsigned32 offset; - - /* - * Catch the case of a user allocating close to the limit of the - * unsigned32. - */ - - if ( size >= (-1 - HEAP_BLOCK_USED_OVERHEAD) ) - return( NULL ); - - excess = size % the_heap->page_size; - the_size = size + the_heap->page_size + HEAP_BLOCK_USED_OVERHEAD; - - if ( excess ) - the_size += the_heap->page_size - excess; - - if ( the_size < sizeof( Heap_Block ) ) - the_size = sizeof( Heap_Block ); - - for ( the_block = the_heap->first; - ; - the_block = the_block->next ) { - if ( the_block == _Heap_Tail( the_heap ) ) - return( NULL ); - if ( the_block->front_flag >= the_size ) - break; - } - - if ( (the_block->front_flag - the_size) > - (the_heap->page_size + HEAP_BLOCK_USED_OVERHEAD) ) { - the_block->front_flag -= the_size; - next_block = _Heap_Next_block( the_block ); - next_block->back_flag = the_block->front_flag; - - temporary_block = _Heap_Block_at( next_block, the_size ); - temporary_block->back_flag = - next_block->front_flag = _Heap_Build_flag( the_size, - HEAP_BLOCK_USED ); - ptr = _Heap_Start_of_user_area( next_block ); - } else { - next_block = _Heap_Next_block( the_block ); - next_block->back_flag = _Heap_Build_flag( the_block->front_flag, - HEAP_BLOCK_USED ); - the_block->front_flag = next_block->back_flag; - the_block->next->previous = the_block->previous; - the_block->previous->next = the_block->next; - ptr = _Heap_Start_of_user_area( the_block ); - } - - /* - * round ptr up to a multiple of page size - * Have to save the bump amount in the buffer so that free can figure it out - */ - - offset = the_heap->page_size - (((unsigned32) ptr) & (the_heap->page_size - 1)); - ptr = _Addresses_Add_offset( ptr, offset ); - *(((unsigned32 *) ptr) - 1) = offset; - -#ifdef RTEMS_DEBUG - { - unsigned32 ptr_u32; - ptr_u32 = (unsigned32) ptr; - if (ptr_u32 & (the_heap->page_size - 1)) - abort(); - } -#endif - - return ptr; -} - diff --git a/c/src/exec/score/src/heapextend.c b/c/src/exec/score/src/heapextend.c deleted file mode 100644 index 3b928301ae..0000000000 --- a/c/src/exec/score/src/heapextend.c +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Heap Handler - * - * 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 -#include -#include - -/*PAGE - * - * _Heap_Extend - * - * This routine grows the_heap memory area using the size bytes which - * begin at starting_address. - * - * Input parameters: - * the_heap - pointer to heap header. - * starting_address - pointer to the memory area. - * size - size in bytes of the memory block to allocate. - * - * Output parameters: - * *amount_extended - amount of memory added to the_heap - */ - -Heap_Extend_status _Heap_Extend( - Heap_Control *the_heap, - void *starting_address, - unsigned32 size, - unsigned32 *amount_extended -) -{ - Heap_Block *the_block; - unsigned32 *p; - - /* - * The overhead was taken from the original heap memory. - */ - - Heap_Block *old_final; - Heap_Block *new_final; - - /* - * There are five possibilities for the location of starting - * address: - * - * 1. non-contiguous lower address (NOT SUPPORTED) - * 2. contiguous lower address (NOT SUPPORTED) - * 3. in the heap (ERROR) - * 4. contiguous higher address (SUPPORTED) - * 5. non-contiguous higher address (NOT SUPPORTED) - * - * As noted, this code only supports (4). - */ - - if ( starting_address >= (void *) the_heap->start && /* case 3 */ - starting_address <= (void *) the_heap->final - ) - return HEAP_EXTEND_ERROR; - - if ( starting_address < (void *) the_heap->start ) { /* cases 1 and 2 */ - - return HEAP_EXTEND_NOT_IMPLEMENTED; /* cases 1 and 2 */ - - } else { /* cases 4 and 5 */ - - the_block = (Heap_Block *) - _Addresses_Subtract_offset( starting_address, HEAP_OVERHEAD ); - if ( the_block != the_heap->final ) - return HEAP_EXTEND_NOT_IMPLEMENTED; /* case 5 */ - } - - /* - * Currently only case 4 should make it to this point. - * The basic trick is to make the extend area look like a used - * block and free it. - */ - - *amount_extended = size; - - old_final = the_heap->final; - new_final = _Addresses_Add_offset( old_final, size ); - /* SAME AS: _Addresses_Add_offset( starting_address, size-HEAP_OVERHEAD ); */ - - the_heap->final = new_final; - - old_final->front_flag = - new_final->back_flag = _Heap_Build_flag( size, HEAP_BLOCK_USED ); - new_final->front_flag = HEAP_DUMMY_FLAG; - - /* - * Must pass in address of "user" area - * So add in the offset field. - */ - - p = (unsigned32 *) &old_final->next; - *p = sizeof(unsigned32); - p++; - _Heap_Free( the_heap, p ); - - return HEAP_EXTEND_SUCCESSFUL; -} - diff --git a/c/src/exec/score/src/heapfree.c b/c/src/exec/score/src/heapfree.c deleted file mode 100644 index 1571e1ea2b..0000000000 --- a/c/src/exec/score/src/heapfree.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Heap Handler - * - * 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 -#include -#include - -/*PAGE - * - * _Heap_Free - * - * This kernel routine returns the memory designated by the - * given heap and given starting address to the memory pool. - * - * Input parameters: - * the_heap - pointer to heap header - * starting_address - starting address of the memory block to free. - * - * Output parameters: - * TRUE - if starting_address is valid heap address - * FALSE - if starting_address is invalid heap address - */ - -boolean _Heap_Free( - Heap_Control *the_heap, - void *starting_address -) -{ - Heap_Block *the_block; - Heap_Block *next_block; - Heap_Block *new_next_block; - Heap_Block *previous_block; - Heap_Block *temporary_block; - unsigned32 the_size; - - the_block = _Heap_User_block_at( starting_address ); - - if ( !_Heap_Is_block_in( the_heap, the_block ) || - _Heap_Is_block_free( the_block ) ) { - return( FALSE ); - } - - the_size = _Heap_Block_size( the_block ); - next_block = _Heap_Block_at( the_block, the_size ); - - if ( !_Heap_Is_block_in( the_heap, next_block ) || - (the_block->front_flag != next_block->back_flag) ) { - return( FALSE ); - } - - if ( _Heap_Is_previous_block_free( the_block ) ) { - previous_block = _Heap_Previous_block( the_block ); - - if ( !_Heap_Is_block_in( the_heap, previous_block ) ) { - return( FALSE ); - } - - if ( _Heap_Is_block_free( next_block ) ) { /* coalesce both */ - previous_block->front_flag += next_block->front_flag + the_size; - temporary_block = _Heap_Next_block( previous_block ); - temporary_block->back_flag = previous_block->front_flag; - next_block->next->previous = next_block->previous; - next_block->previous->next = next_block->next; - } - else { /* coalesce prev */ - previous_block->front_flag = - next_block->back_flag = previous_block->front_flag + the_size; - } - } - else if ( _Heap_Is_block_free( next_block ) ) { /* coalesce next */ - the_block->front_flag = the_size + next_block->front_flag; - new_next_block = _Heap_Next_block( the_block ); - new_next_block->back_flag = the_block->front_flag; - the_block->next = next_block->next; - the_block->previous = next_block->previous; - next_block->previous->next = the_block; - next_block->next->previous = the_block; - - if (the_heap->first == next_block) - the_heap->first = the_block; - } - else { /* no coalesce */ - next_block->back_flag = - the_block->front_flag = the_size; - the_block->previous = _Heap_Head( the_heap ); - the_block->next = the_heap->first; - the_heap->first = the_block; - the_block->next->previous = the_block; - } - - return( TRUE ); -} - diff --git a/c/src/exec/score/src/heapgetinfo.c b/c/src/exec/score/src/heapgetinfo.c deleted file mode 100644 index a55348c3c8..0000000000 --- a/c/src/exec/score/src/heapgetinfo.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Heap Handler - * - * COPYRIGHT (c) 1989-2000. - * 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. - * - */ - - -#include -#include -#include - -/*PAGE - * - * _Heap_Get_information - * - * This kernel routine walks the heap and tots up the free and allocated - * sizes. Derived from _Heap_Walk. - * - * Input parameters: - * the_heap - pointer to heap header - * - * Output parameters: - * free_sz - Pointer for free amount return - * used_sz - Pointer for used amount return - * return 0=success, otherwise heap is corrupt. - */ - - -Heap_Get_information_status _Heap_Get_information( - Heap_Control *the_heap, - Heap_Information_block *the_info -) -{ - Heap_Block *the_block = 0; /* avoid warnings */ - Heap_Block *next_block = 0; /* avoid warnings */ - int notdone = 1; - - - the_info->free_blocks = 0; - the_info->free_size = 0; - the_info->used_blocks = 0; - the_info->used_size = 0; - - /* - * We don't want to allow walking the heap until we have - * transferred control to the user task so we watch the - * system state. - */ - - if ( !_System_state_Is_up( _System_state_Get() ) ) - return HEAP_GET_INFORMATION_SYSTEM_STATE_ERROR; - - the_block = the_heap->start; - - /* - * Handle the 1st block - */ - - if ( the_block->back_flag != HEAP_DUMMY_FLAG ) { - return HEAP_GET_INFORMATION_BLOCK_ERROR; - } - - while (notdone) { - - /* - * Accumulate size - */ - - if ( _Heap_Is_block_free(the_block) ) { - the_info->free_blocks++; - the_info->free_size += _Heap_Block_size(the_block); - } else { - the_info->used_blocks++; - the_info->used_size += _Heap_Block_size(the_block); - } - - /* - * Handle the last block - */ - - if ( the_block->front_flag != HEAP_DUMMY_FLAG ) { - next_block = _Heap_Next_block(the_block); - if ( the_block->front_flag != next_block->back_flag ) { - return HEAP_GET_INFORMATION_BLOCK_ERROR; - } - } - - if ( the_block->front_flag == HEAP_DUMMY_FLAG ) - notdone = 0; - else - the_block = next_block; - } /* while(notdone) */ - - return HEAP_GET_INFORMATION_SUCCESSFUL; -} diff --git a/c/src/exec/score/src/heapsizeofuserarea.c b/c/src/exec/score/src/heapsizeofuserarea.c deleted file mode 100644 index 243d1844e6..0000000000 --- a/c/src/exec/score/src/heapsizeofuserarea.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Heap Handler - * - * 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 -#include -#include - -/*PAGE - * - * _Heap_Size_of_user_area - * - * This kernel routine returns the size of the memory area - * given heap block. - * - * Input parameters: - * the_heap - pointer to heap header - * starting_address - starting address of the memory block to free. - * size - pointer to size of area - * - * Output parameters: - * size - size of area filled in - * TRUE - if starting_address is valid heap address - * FALSE - if starting_address is invalid heap address - */ - -boolean _Heap_Size_of_user_area( - Heap_Control *the_heap, - void *starting_address, - unsigned32 *size -) -{ - Heap_Block *the_block; - Heap_Block *next_block; - unsigned32 the_size; - - the_block = _Heap_User_block_at( starting_address ); - - if ( !_Heap_Is_block_in( the_heap, the_block ) || - _Heap_Is_block_free( the_block ) ) - return( FALSE ); - - the_size = _Heap_Block_size( the_block ); - next_block = _Heap_Block_at( the_block, the_size ); - - if ( !_Heap_Is_block_in( the_heap, next_block ) || - (the_block->front_flag != next_block->back_flag) ) - return( FALSE ); - - *size = the_size; - return( TRUE ); -} - diff --git a/c/src/exec/score/src/heapwalk.c b/c/src/exec/score/src/heapwalk.c deleted file mode 100644 index 3cd9c356ae..0000000000 --- a/c/src/exec/score/src/heapwalk.c +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Heap Handler - * - * 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 -#include -#include - -/*PAGE - * - * _Heap_Walk - * - * This kernel routine walks the heap and verifies its correctness. - * - * Input parameters: - * the_heap - pointer to heap header - * source - a numeric indicator of the invoker of this routine - * do_dump - when TRUE print the information - * - * Output parameters: NONE - */ - -#ifndef RTEMS_DEBUG - -void _Heap_Walk( - Heap_Control *the_heap, - int source, - boolean do_dump -) -{ -} - -#else - -#include -#include - -void _Heap_Walk( - Heap_Control *the_heap, - int source, - boolean do_dump -) -{ - Heap_Block *the_block = 0; /* avoid warnings */ - Heap_Block *next_block = 0; /* avoid warnings */ - int notdone = 1; - int error = 0; - int passes = 0; - - /* - * We don't want to allow walking the heap until we have - * transferred control to the user task so we watch the - * system state. - */ - - if ( !_System_state_Is_up( _System_state_Get() ) ) - return; - - the_block = the_heap->start; - - if (do_dump == TRUE) { - printf("\nPASS: %d start @ 0x%p final 0x%p, first 0x%p last 0x%p\n", - source, the_heap->start, the_heap->final, - the_heap->first, the_heap->last - ); - } - - /* - * Handle the 1st block - */ - - if (the_block->back_flag != HEAP_DUMMY_FLAG) { - printf("PASS: %d Back flag of 1st block isn't HEAP_DUMMY_FLAG\n", source); - error = 1; - } - - while (notdone) { - passes++; - if (error && (passes > 10)) - abort(); - - if (do_dump == TRUE) { - printf("PASS: %d Block @ 0x%p Back %d, Front %d", - source, the_block, - the_block->back_flag, the_block->front_flag); - if ( _Heap_Is_block_free(the_block) ) { - printf( " Prev 0x%p, Next 0x%p\n", - the_block->previous, the_block->next); - } else { - printf("\n"); - } - } - - /* - * Handle the last block - */ - - if ( the_block->front_flag != HEAP_DUMMY_FLAG ) { - next_block = _Heap_Next_block(the_block); - if ( the_block->front_flag != next_block->back_flag ) { - error = 1; - printf("PASS: %d Front and back flags don't match\n", source); - printf(" Current Block (%p): Back - %d, Front - %d", - the_block, the_block->back_flag, the_block->front_flag); - if (do_dump == TRUE) { - if (_Heap_Is_block_free(the_block)) { - printf(" Prev 0x%p, Next 0x%p\n", - the_block->previous, the_block->next); - } else { - printf("\n"); - } - } else { - printf("\n"); - } - printf(" Next Block (%p): Back - %d, Front - %d", - next_block, next_block->back_flag, next_block->front_flag); - if (do_dump == TRUE) { - if (_Heap_Is_block_free(next_block)) { - printf(" Prev 0x%p, Next 0x%p\n", - the_block->previous, the_block->next); - } else { - printf("\n"); - } - } else { - printf("\n"); - } - } - } - - if (the_block->front_flag == HEAP_DUMMY_FLAG) - notdone = 0; - else - the_block = next_block; - } - - if (error) - abort(); -} -#endif diff --git a/c/src/exec/score/src/interr.c b/c/src/exec/score/src/interr.c deleted file mode 100644 index e2a4d078bb..0000000000 --- a/c/src/exec/score/src/interr.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Internal Error Handler - * - * 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 -#include -#include -#include - -/*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 deleted file mode 100644 index ac9be65e63..0000000000 --- a/c/src/exec/score/src/isr.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * ISR Handler - * - * - * 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 -#include -#include -#include -#include - -/* _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; - - _ISR_Vector_table = _Workspace_Allocate_or_fatal_error( - sizeof(ISR_Handler_entry) * ISR_NUMBER_OF_VECTORS - ); - - _CPU_Initialize_vectors(); - -#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 deleted file mode 100644 index 547b690178..0000000000 --- a/c/src/exec/score/src/mpci.c +++ /dev/null @@ -1,522 +0,0 @@ -/* - * Multiprocessing Communications Interface (MPCI) Handler - * - * - * 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 -#include -#include -#if defined(RTEMS_MULTIPROCESSING) -#include -#include -#endif -#include -#include -#include -#include -#include -#include - -#include - -/*PAGE - * - * _MPCI_Handler_initialization - * - * This subprogram performs the initialization necessary for this handler. - */ - -void _MPCI_Handler_initialization( - MPCI_Control *users_mpci_table, - unsigned32 timeout_status -) -{ - 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; - - if ( !_System_state_Is_multiprocessing ) - return; - - /* - * Register the MP Process Packet routine. - */ - - _MPCI_Register_packet_processor( - MP_PACKET_MPCI_INTERNAL, - _MPCI_Internal_packets_Process_packet - ); - - /* - * Create the counting semaphore used by the MPCI Receive Server. - */ - - attributes.discipline = CORE_SEMAPHORE_DISCIPLINES_FIFO; - - _CORE_semaphore_Initialize( - &_MPCI_Semaphore, - &attributes, /* the_semaphore_attributes */ - 0 /* initial_value */ - ); - - _Thread_queue_Initialize( - &_MPCI_Remote_blocked_threads, - THREAD_QUEUE_DISCIPLINE_FIFO, - STATES_WAITING_FOR_RPC_REPLY, - timeout_status - ); -} - -/*PAGE - * - * _MPCI_Create_server - * - * This subprogram creates the MPCI receive server. - */ - -char *_MPCI_Internal_name = "MPCI"; - -void _MPCI_Create_server( void ) -{ - - if ( !_System_state_Is_multiprocessing ) - return; - - /* - * Initialize the MPCI Receive Server - */ - - _MPCI_Receive_server_tcb = _Thread_Internal_allocate(); - - _Thread_Initialize( - &_Thread_Internal_information, - _MPCI_Receive_server_tcb, - NULL, /* allocate the stack */ - MPCI_RECEIVE_SERVER_STACK_SIZE, - CPU_ALL_TASKS_ARE_FP, - PRIORITY_MINIMUM, - FALSE, /* no preempt */ - THREAD_CPU_BUDGET_ALGORITHM_NONE, - NULL, /* no budget algorithm callout */ - 0, /* all interrupts enabled */ - _MPCI_Internal_name - ); - - _Thread_Start( - _MPCI_Receive_server_tcb, - THREAD_START_NUMERIC, - (void *) _MPCI_Receive_server, - NULL, - 0 - ); -} - -/*PAGE - * - * _MPCI_Initialization - * - * This subprogram initializes the MPCI driver by - * invoking the user provided MPCI initialization callout. - */ - -void _MPCI_Initialization ( void ) -{ - (*_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( - MP_packet_Classes the_class, - MPCI_Packet_processor the_packet_processor - -) -{ - _MPCI_Packet_processors[ the_class ] = the_packet_processor; -} - -/*PAGE - * - * _MPCI_Get_packet - * - * This subprogram obtains a packet by invoking the user provided - * MPCI get packet callout. - */ - -MP_packet_Prefix *_MPCI_Get_packet ( void ) -{ - MP_packet_Prefix *the_packet; - - (*_MPCI_table->get_packet)( &the_packet ); - - if ( the_packet == NULL ) - _Internal_error_Occurred( - INTERNAL_ERROR_CORE, - TRUE, - INTERNAL_ERROR_OUT_OF_PACKETS - ); - - /* - * Put in a default timeout that will be used for - * all packets that do not otherwise have a timeout. - */ - - the_packet->timeout = MPCI_DEFAULT_TIMEOUT; - - return the_packet; -} - -/*PAGE - * - * _MPCI_Return_packet - * - * This subprogram returns a packet by invoking the user provided - * MPCI return packet callout. - */ - -void _MPCI_Return_packet ( - MP_packet_Prefix *the_packet -) -{ - (*_MPCI_table->return_packet)( the_packet ); -} - -/*PAGE - * - * _MPCI_Send_process_packet - * - * This subprogram sends a process packet by invoking the user provided - * MPCI send callout. - */ - -void _MPCI_Send_process_packet ( - unsigned32 destination, - MP_packet_Prefix *the_packet -) -{ - the_packet->source_tid = _Thread_Executing->Object.id; - the_packet->to_convert = - ( the_packet->to_convert - sizeof(MP_packet_Prefix) ) / - sizeof(unsigned32); - - (*_MPCI_table->send_packet)( destination, the_packet ); -} - -/*PAGE - * - * _MPCI_Send_request_packet - * - * This subprogram sends a request packet by invoking the user provided - * MPCI send callout. - */ - -unsigned32 _MPCI_Send_request_packet ( - unsigned32 destination, - 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(MP_packet_Prefix) ) / - sizeof(unsigned32); - - _Thread_Executing->Wait.id = the_packet->id; - - _Thread_Executing->Wait.queue = &_MPCI_Remote_blocked_threads; - - _Thread_Disable_dispatch(); - - (*_MPCI_table->send_packet)( destination, the_packet ); - - _Thread_queue_Enter_critical_section( &_MPCI_Remote_blocked_threads ); - - /* - * See if we need a default timeout - */ - - if (the_packet->timeout == MPCI_DEFAULT_TIMEOUT) - the_packet->timeout = _MPCI_table->default_timeout; - - _Thread_queue_Enqueue( &_MPCI_Remote_blocked_threads, the_packet->timeout ); - - _Thread_Executing->current_state = - _States_Set( extra_state, _Thread_Executing->current_state ); - - _Thread_Enable_dispatch(); - - return _Thread_Executing->Wait.return_code; -} - -/*PAGE - * - * _MPCI_Send_response_packet - * - * This subprogram sends a response packet by invoking the user provided - * MPCI send callout. - */ - -void _MPCI_Send_response_packet ( - unsigned32 destination, - MP_packet_Prefix *the_packet -) -{ - the_packet->source_tid = _Thread_Executing->Object.id; - - (*_MPCI_table->send_packet)( destination, the_packet ); -} - -/*PAGE - * - * _MPCI_Receive_packet - * - * This subprogram receives a packet by invoking the user provided - * MPCI receive callout. - */ - -MP_packet_Prefix *_MPCI_Receive_packet ( void ) -{ - MP_packet_Prefix *the_packet; - - (*_MPCI_table->receive_packet)( &the_packet ); - - return the_packet; -} - -/*PAGE - * - * _MPCI_Process_response - * - * This subprogram obtains a packet by invoking the user provided - * MPCI get packet callout. - */ - -Thread_Control *_MPCI_Process_response ( - MP_packet_Prefix *the_packet -) -{ - Thread_Control *the_thread; - Objects_Locations location; - - the_thread = _Thread_Get( the_packet->id, &location ); - switch ( location ) { - case OBJECTS_ERROR: - case OBJECTS_REMOTE: - the_thread = NULL; /* IMPOSSIBLE */ - break; - case OBJECTS_LOCAL: - _Thread_queue_Extract( &_MPCI_Remote_blocked_threads, the_thread ); - the_thread->Wait.return_code = the_packet->return_code; - _Thread_Unnest_dispatch(); - break; - } - - return the_thread; -} - -/*PAGE - * - * _MPCI_Receive_server - * - */ - -Thread _MPCI_Receive_server( - unsigned32 ignored -) -{ - - MP_packet_Prefix *the_packet; - MPCI_Packet_processor the_function; - Thread_Control *executing; - - executing = _Thread_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(); -} - -/*PAGE - * - * _MPCI_Internal_packets_Send_process_packet - * - */ - -void _MPCI_Internal_packets_Send_process_packet ( - MPCI_Internal_Remote_operations operation -) -{ - MPCI_Internal_packet *the_packet; - - switch ( operation ) { - - case MPCI_PACKETS_SYSTEM_VERIFY: - - the_packet = _MPCI_Internal_packets_Get_packet(); - the_packet->Prefix.the_class = MP_PACKET_MPCI_INTERNAL; - the_packet->Prefix.length = sizeof ( MPCI_Internal_packet ); - the_packet->Prefix.to_convert = sizeof ( MPCI_Internal_packet ); - the_packet->operation = operation; - - the_packet->maximum_nodes = _Objects_Maximum_nodes; - - the_packet->maximum_global_objects = _Objects_MP_Maximum_global_objects; - - _MPCI_Send_process_packet( MPCI_ALL_NODES, &the_packet->Prefix ); - break; - } -} - -/*PAGE - * - * _MPCI_Internal_packets_Send_request_packet - * - * This subprogram is not needed since there are no request - * packets to be sent by this manager. - * - */ - -/*PAGE - * - * _MPCI_Internal_packets_Send_response_packet - * - * This subprogram is not needed since there are no response - * packets to be sent by this manager. - * - */ - -/*PAGE - * - * - * _MPCI_Internal_packets_Process_packet - * - */ - -void _MPCI_Internal_packets_Process_packet ( - MP_packet_Prefix *the_packet_prefix -) -{ - MPCI_Internal_packet *the_packet; - unsigned32 maximum_nodes; - unsigned32 maximum_global_objects; - - the_packet = (MPCI_Internal_packet *) the_packet_prefix; - - switch ( the_packet->operation ) { - - case MPCI_PACKETS_SYSTEM_VERIFY: - - maximum_nodes = the_packet->maximum_nodes; - maximum_global_objects = the_packet->maximum_global_objects; - if ( maximum_nodes != _Objects_Maximum_nodes || - maximum_global_objects != _Objects_MP_Maximum_global_objects ) { - - _MPCI_Return_packet( the_packet_prefix ); - - _Internal_error_Occurred( - INTERNAL_ERROR_CORE, - TRUE, - INTERNAL_ERROR_INCONSISTENT_MP_INFORMATION - ); - } - - _MPCI_Return_packet( the_packet_prefix ); - - break; - } -} - -/*PAGE - * - * _MPCI_Internal_packets_Send_object_was_deleted - * - * This subprogram is not needed since there are no objects - * deleted by this manager. - * - */ - -/*PAGE - * - * _MPCI_Internal_packets_Send_extract_proxy - * - * This subprogram is not needed since there are no objects - * deleted by this manager. - * - */ - -/*PAGE - * - * _MPCI_Internal_packets_Get_packet - * - */ - -MPCI_Internal_packet *_MPCI_Internal_packets_Get_packet ( void ) -{ - return ( (MPCI_Internal_packet *) _MPCI_Get_packet() ); -} - -/* end of file */ diff --git a/c/src/exec/score/src/object.c b/c/src/exec/score/src/object.c deleted file mode 100644 index 5d3ffb5916..0000000000 --- a/c/src/exec/score/src/object.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Object Handler - * - * - * 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 -#include -#include -#include -#if defined(RTEMS_MULTIPROCESSING) -#include -#endif -#include -#include -#include -#include - -/*PAGE - * - * _Objects_Handler_initialization - * - * This routine initializes the object handler. - * - * Input parameters: - * node - local node - * maximum_nodes - number of nodes in the system - * maximum_global_objects - number of configured global objects - * - * Output parameters: NONE - */ - -void _Objects_Handler_initialization( - unsigned32 node, - unsigned32 maximum_nodes, - unsigned32 maximum_global_objects -) -{ - 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; - -#if defined(RTEMS_MULTIPROCESSING) - _Objects_MP_Handler_initialization( - node, - maximum_nodes, - maximum_global_objects - ); -#endif -} diff --git a/c/src/exec/score/src/objectallocate.c b/c/src/exec/score/src/objectallocate.c deleted file mode 100644 index 9d7193fc7a..0000000000 --- a/c/src/exec/score/src/objectallocate.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Object Handler - * - * - * 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 -#include -#include -#include -#if defined(RTEMS_MULTIPROCESSING) -#include -#endif -#include -#include -#include -#include - -/*PAGE - * - * _Objects_Allocate - * - * DESCRIPTION: - * - * This function allocates a object control block from - * the inactive chain of free object control blocks. - */ - -Objects_Control *_Objects_Allocate( - Objects_Information *information -) -{ - Objects_Control *the_object = - (Objects_Control *) _Chain_Get( &information->Inactive ); - - if ( information->auto_extend ) { - /* - * If the list is empty then we are out of objects and need to - * extend information base. - */ - - if ( !the_object ) { - _Objects_Extend_information( information ); - the_object = (Objects_Control *) _Chain_Get( &information->Inactive ); - } - - if ( the_object ) { - unsigned32 block; - - block = _Objects_Get_index( the_object->id ) - - _Objects_Get_index( information->minimum_id ); - block /= information->allocation_size; - - information->inactive_per_block[ block ]--; - information->inactive--; - } - } - - return the_object; -} diff --git a/c/src/exec/score/src/objectallocatebyindex.c b/c/src/exec/score/src/objectallocatebyindex.c deleted file mode 100644 index 6de641ae0c..0000000000 --- a/c/src/exec/score/src/objectallocatebyindex.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Object Handler - * - * - * 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 -#include -#include -#include -#if defined(RTEMS_MULTIPROCESSING) -#include -#endif -#include -#include -#include -#include - -/*PAGE - * - * _Objects_Allocate_by_index - * - * DESCRIPTION: - * - * This function allocates the object control block - * specified by the index from the inactive chain of - * free object control blocks. - */ - -Objects_Control *_Objects_Allocate_by_index( - Objects_Information *information, - unsigned32 index, - unsigned32 sizeof_control -) -{ - Objects_Control *the_object; - - if ( index && information->maximum >= index ) { - the_object = information->local_table[ index ]; - if ( the_object ) - return NULL; - - /* XXX - * This whole section of code needs to be addressed. - * + The 0 should be dealt with more properly so we can autoextend. - * + The pointer arithmetic is probably too expensive. - * + etc. - */ - - the_object = (Objects_Control *) _Addresses_Add_offset( - information->object_blocks[ 0 ], - (sizeof_control * (index - 1)) - ); - _Chain_Extract( &the_object->Node ); - - return the_object; - } - - /* - * Autoextend will have to be thought out as it applies - * to user assigned indices. - */ - - return NULL; -} diff --git a/c/src/exec/score/src/objectclearname.c b/c/src/exec/score/src/objectclearname.c deleted file mode 100644 index 639a9de458..0000000000 --- a/c/src/exec/score/src/objectclearname.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Object Handler - * - * - * 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 -#include -#include -#include -#if defined(RTEMS_MULTIPROCESSING) -#include -#endif -#include -#include -#include -#include - -/*PAGE - * - * _Objects_Clear_name - * - * This method clears the specified name so that no caller can do a name to - * ID/object lookup past this point. - */ - -void _Objects_Clear_name( - void *name, - unsigned32 length -) -{ - unsigned32 index; - unsigned32 maximum = length / OBJECTS_NAME_ALIGNMENT; - unsigned32 *name_ptr = (unsigned32 *) name; - - for ( index=0 ; index < maximum ; index++ ) - *name_ptr++ = 0; -} diff --git a/c/src/exec/score/src/objectcomparenameraw.c b/c/src/exec/score/src/objectcomparenameraw.c deleted file mode 100644 index 13962c811a..0000000000 --- a/c/src/exec/score/src/objectcomparenameraw.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Object Handler - * - * - * 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 -#include -#include -#include -#if defined(RTEMS_MULTIPROCESSING) -#include -#endif -#include -#include -#include -#include - -/*PAGE - * - * _Objects_Compare_name_raw - * - * XXX - */ - -boolean _Objects_Compare_name_raw( - void *name_1, - void *name_2, - unsigned32 length -) -{ -#if 0 - unsigned32 *name_1_p = (unsigned32 *) name_1; - unsigned32 *name_2_p = (unsigned32 *) name_2; - unsigned32 tmp_length = length / OBJECTS_NAME_ALIGNMENT; -#endif - - if ( name_1 == name_2 ) - return TRUE; - return FALSE; - -#if 0 - while ( tmp_length-- ) - if ( *name_1_p++ != *name_2_p++ ) - return FALSE; - - return TRUE; -#endif -} diff --git a/c/src/exec/score/src/objectcomparenamestring.c b/c/src/exec/score/src/objectcomparenamestring.c deleted file mode 100644 index b743eda0da..0000000000 --- a/c/src/exec/score/src/objectcomparenamestring.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Object Handler - * - * - * COPYRIGHT (c) 1989-2002. - * 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 -#include -#include -#include -#if defined(RTEMS_MULTIPROCESSING) -#include -#endif -#include -#include -#include -#include - -#include - -/*PAGE - * - * _Objects_Compare_name_string - * - * This routine compares the name of an object with the specified string. - * - * Input parameters: - * name_1 - one name - * name_2 - other name - * length - maximum length to compare - * - * Output parameters: - * returns - TRUE on a match - */ - -boolean _Objects_Compare_name_string( - void *name_1, - void *name_2, - unsigned32 length -) -{ - if ( !strncmp( name_1, name_2, length ) ) - return TRUE; - return FALSE; -} diff --git a/c/src/exec/score/src/objectcopynameraw.c b/c/src/exec/score/src/objectcopynameraw.c deleted file mode 100644 index 74eb94afc1..0000000000 --- a/c/src/exec/score/src/objectcopynameraw.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Object Handler - * - * - * 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 -#include -#include -#include -#if defined(RTEMS_MULTIPROCESSING) -#include -#endif -#include -#include -#include -#include - -/*PAGE - * - * _Objects_Copy_name_raw - * - * XXX - */ - -void _Objects_Copy_name_raw( - void *source, - void *destination, - unsigned32 length -) -{ - unsigned32 *source_p = (unsigned32 *) source; - unsigned32 *destination_p = (unsigned32 *) destination; - unsigned32 tmp_length = length / OBJECTS_NAME_ALIGNMENT; - - while ( tmp_length-- ) - *destination_p++ = *source_p++; -} diff --git a/c/src/exec/score/src/objectcopynamestring.c b/c/src/exec/score/src/objectcopynamestring.c deleted file mode 100644 index eb196f3d25..0000000000 --- a/c/src/exec/score/src/objectcopynamestring.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Object Handler - * - * - * 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 -#include -#include -#include -#if defined(RTEMS_MULTIPROCESSING) -#include -#endif -#include -#include -#include -#include - -/*PAGE - * - * _Objects_Copy_name_string - * - * XXX - */ - -void _Objects_Copy_name_string( - void *source, - void *destination -) -{ - unsigned8 *source_p = (unsigned8 *) source; - unsigned8 *destination_p = (unsigned8 *) destination; - - *destination_p = '\0'; - if ( source_p ) { - do { - *destination_p++ = *source_p; - } while ( *source_p++ ); - } -} diff --git a/c/src/exec/score/src/objectextendinformation.c b/c/src/exec/score/src/objectextendinformation.c deleted file mode 100644 index ddd38e29c5..0000000000 --- a/c/src/exec/score/src/objectextendinformation.c +++ /dev/null @@ -1,291 +0,0 @@ -/* - * Object Handler - * - * - * 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 -#include -#include -#include -#if defined(RTEMS_MULTIPROCESSING) -#include -#endif -#include -#include -#include -#include - -#include /* for memcpy() */ - -/*PAGE - * - * _Objects_Extend_information - * - * This routine extends all object information related data structures. - * - * Input parameters: - * information - object information table - * - * Output parameters: NONE - */ - -void _Objects_Extend_information( - Objects_Information *information -) -{ - Objects_Control *the_object; - void *name_area; - Chain_Control Inactive; - unsigned32 block_count; - unsigned32 block; - unsigned32 index_base; - unsigned32 minimum_index; - unsigned32 index; - - /* - * Search for a free block of indexes. The block variable ends up set - * to block_count + 1 if the table needs to be extended. - */ - - minimum_index = _Objects_Get_index( information->minimum_id ); - index_base = minimum_index; - block = 0; - - if ( information->maximum < minimum_index ) - block_count = 0; - else { - block_count = information->maximum / information->allocation_size; - - for ( ; block < block_count; block++ ) { - if ( information->object_blocks[ block ] == NULL ) - break; - else - index_base += information->allocation_size; - } - } - - /* - * If the index_base is the maximum we need to grow the tables. - */ - - if (index_base >= information->maximum ) { - ISR_Level level; - void **object_blocks; - Objects_Name *name_table; - unsigned32 *inactive_per_block; - Objects_Control **local_table; - unsigned32 maximum; - void *old_tables; - - /* - * Growing the tables means allocating a new area, doing a copy and - * updating the information table. - * - * If the maximum is minimum we do not have a table to copy. First - * time through. - * - * The allocation has : - * - * void *objects[block_count]; - * unsigned32 inactive_count[block_count]; - * Objects_Name *name_table[block_count]; - * Objects_Control *local_table[maximum]; - * - * This is the order in memory. Watch changing the order. See the memcpy - * below. - */ - - /* - * Up the block count and maximum - */ - - block_count++; - - maximum = information->maximum + information->allocation_size; - - /* - * Allocate the tables and break it up. - */ - - if ( information->auto_extend ) { - object_blocks = (void**) - _Workspace_Allocate( - block_count * - (sizeof(void *) + sizeof(unsigned32) + sizeof(Objects_Name *)) + - ((maximum + minimum_index) * sizeof(Objects_Control *)) - ); - - if ( !object_blocks ) - return; - } - else { - object_blocks = (void**) - _Workspace_Allocate_or_fatal_error( - block_count * - (sizeof(void *) + sizeof(unsigned32) + sizeof(Objects_Name *)) + - ((maximum + minimum_index) * sizeof(Objects_Control *)) - ); - } - - /* - * Break the block into the various sections. - * - */ - - inactive_per_block = (unsigned32 *) _Addresses_Add_offset( - object_blocks, block_count * sizeof(void*) ); - name_table = (Objects_Name *) _Addresses_Add_offset( - inactive_per_block, block_count * sizeof(unsigned32) ); - local_table = (Objects_Control **) _Addresses_Add_offset( - name_table, block_count * sizeof(Objects_Name *) ); - - /* - * Take the block count down. Saves all the (block_count - 1) - * in the copies. - */ - - block_count--; - - if ( information->maximum > minimum_index ) { - - /* - * Copy each section of the table over. This has to be performed as - * separate parts as size of each block has changed. - */ - - memcpy( object_blocks, - information->object_blocks, - block_count * sizeof(void*) ); - memcpy( inactive_per_block, - information->inactive_per_block, - block_count * sizeof(unsigned32) ); - memcpy( name_table, - information->name_table, - block_count * sizeof(Objects_Name *) ); - memcpy( local_table, - information->local_table, - (information->maximum + minimum_index) * sizeof(Objects_Control *) ); - } - else { - - /* - * Deal with the special case of the 0 to minimum_index - */ - for ( index = 0; index < minimum_index; index++ ) { - local_table[ index ] = NULL; - } - } - - /* - * Initialise the new entries in the table. - */ - - object_blocks[block_count] = NULL; - inactive_per_block[block_count] = 0; - name_table[block_count] = NULL; - - for ( index=index_base ; - index < ( information->allocation_size + index_base ); - index++ ) { - local_table[ index ] = NULL; - } - - _ISR_Disable( level ); - - old_tables = information->object_blocks; - - information->object_blocks = object_blocks; - information->inactive_per_block = inactive_per_block; - information->name_table = name_table; - information->local_table = local_table; - information->maximum = maximum; - information->maximum_id = _Objects_Build_id( - information->the_api, - information->the_class, - _Objects_Local_node, - information->maximum - ); - - _ISR_Enable( level ); - - if ( old_tables ) - _Workspace_Free( old_tables ); - - block_count++; - } - - /* - * Allocate the name table, and the objects - */ - - if ( information->auto_extend ) { - information->object_blocks[ block ] = - _Workspace_Allocate( - (information->allocation_size * information->name_length) + - (information->allocation_size * information->size) - ); - - if ( !information->object_blocks[ block ] ) - return; - } - else { - information->object_blocks[ block ] = - _Workspace_Allocate_or_fatal_error( - (information->allocation_size * information->name_length) + - (information->allocation_size * information->size) - ); - } - - name_area = (Objects_Name *) _Addresses_Add_offset( - information->object_blocks[ block ], - (information->allocation_size * information->size) - ); - information->name_table[ block ] = name_area; - - /* - * Initialize objects .. add to a local chain first. - */ - - _Chain_Initialize( - &Inactive, - information->object_blocks[ block ], - information->allocation_size, - information->size - ); - - /* - * Move from the local chain, initialise, then append to the inactive chain - */ - - index = index_base; - - while ( (the_object = (Objects_Control *) _Chain_Get( &Inactive ) ) != NULL ) { - - the_object->id = _Objects_Build_id( - information->the_api, - information->the_class, - _Objects_Local_node, - index - ); - - the_object->name = (void *) name_area; - - name_area = _Addresses_Add_offset( name_area, information->name_length ); - - _Chain_Append( &information->Inactive, &the_object->Node ); - - index++; - } - - information->inactive_per_block[ block ] = information->allocation_size; - information->inactive += information->allocation_size; -} diff --git a/c/src/exec/score/src/objectfree.c b/c/src/exec/score/src/objectfree.c deleted file mode 100644 index cf337efa8c..0000000000 --- a/c/src/exec/score/src/objectfree.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Object Handler - * - * - * 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 -#include -#include -#include -#if defined(RTEMS_MULTIPROCESSING) -#include -#endif -#include -#include -#include -#include - -/*PAGE - * - * _Objects_Free - * - * DESCRIPTION: - * - * This function frees a object control block to the - * inactive chain of free object control blocks. - */ - -void _Objects_Free( - Objects_Information *information, - Objects_Control *the_object -) -{ - unsigned32 allocation_size = information->allocation_size; - - _Chain_Append( &information->Inactive, &the_object->Node ); - - if ( information->auto_extend ) { - unsigned32 block; - - block = - _Objects_Get_index( the_object->id ) - _Objects_Get_index( information->minimum_id ); - block /= information->allocation_size; - - information->inactive_per_block[ block ]++; - information->inactive++; - - /* - * Check if the threshold level has been met of - * 1.5 x allocation_size are free. - */ - - if ( information->inactive > ( allocation_size + ( allocation_size >> 1 ) ) ) { - _Objects_Shrink_information( information ); - } - } -} diff --git a/c/src/exec/score/src/objectget.c b/c/src/exec/score/src/objectget.c deleted file mode 100644 index 8a551c6741..0000000000 --- a/c/src/exec/score/src/objectget.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Object Handler - * - * - * 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 -#include -#include -#include -#if defined(RTEMS_MULTIPROCESSING) -#include -#endif -#include -#include -#include -#include - -/*PAGE - * - * _Objects_Get - * - * This routine sets the object pointer for the given - * object id based on the given object information structure. - * - * Input parameters: - * information - pointer to entry in table for this class - * id - object id to search for - * location - address of where to store the location - * - * Output parameters: - * returns - address of object if local - * location - one of the following: - * OBJECTS_ERROR - invalid object ID - * OBJECTS_REMOTE - remote object - * OBJECTS_LOCAL - local object - */ - -Objects_Control *_Objects_Get( - Objects_Information *information, - Objects_Id id, - Objects_Locations *location -) -{ - Objects_Control *the_object; - unsigned32 index; - -#if defined(RTEMS_MULTIPROCESSING) - index = id - information->minimum_id + 1; -#else - /* index = _Objects_Get_index( id ); */ - index = id & 0x0000ffff; - /* This should work but doesn't always :( */ - /* index = (unsigned16) id; */ -#endif - - if ( information->maximum >= index ) { - _Thread_Disable_dispatch(); - if ( (the_object = information->local_table[ index ]) != NULL ) { - *location = OBJECTS_LOCAL; - return the_object; - } - _Thread_Enable_dispatch(); - *location = OBJECTS_ERROR; - return NULL; - } - *location = OBJECTS_ERROR; - -#if defined(RTEMS_MULTIPROCESSING) - _Objects_MP_Is_remote( information, id, location, &the_object ); - return the_object; -#else - return NULL; -#endif -} diff --git a/c/src/exec/score/src/objectgetbyindex.c b/c/src/exec/score/src/objectgetbyindex.c deleted file mode 100644 index c99e0bc7ed..0000000000 --- a/c/src/exec/score/src/objectgetbyindex.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Object Handler - * - * - * 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 -#include -#include -#include -#if defined(RTEMS_MULTIPROCESSING) -#include -#endif -#include -#include -#include -#include - -/*PAGE - * - * _Objects_Get_by_index - * - * This routine sets the object pointer for the given - * object id based on the given object information structure. - * - * Input parameters: - * information - pointer to entry in table for this class - * index - object index to check for - * location - address of where to store the location - * - * Output parameters: - * returns - address of object if local - * location - one of the following: - * OBJECTS_ERROR - invalid object ID - * OBJECTS_REMOTE - remote object - * OBJECTS_LOCAL - local object - */ - -Objects_Control *_Objects_Get_by_index( - Objects_Information *information, - unsigned32 index, - Objects_Locations *location -) -{ - Objects_Control *the_object; - - if ( information->maximum >= index ) { - _Thread_Disable_dispatch(); - the_object = information->local_table[ index ]; - if ( the_object ) { - *location = OBJECTS_LOCAL; - return( the_object ); - } - _Thread_Enable_dispatch(); - *location = OBJECTS_ERROR; - return( NULL ); - } - - /* - * With just an index, you can't access a remote object. - */ - - *location = OBJECTS_ERROR; - return NULL; -} diff --git a/c/src/exec/score/src/objectgetisr.c b/c/src/exec/score/src/objectgetisr.c deleted file mode 100644 index 18ca18cd5c..0000000000 --- a/c/src/exec/score/src/objectgetisr.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Object Handler - * - * - * 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 -#include -#include -#include -#if defined(RTEMS_MULTIPROCESSING) -#include -#endif -#include -#include -#include -#include - -/*PAGE - * - * _Objects_Get_isr_disable - * - * This routine sets the object pointer for the given - * object id based on the given object information structure. - * - * Input parameters: - * information - pointer to entry in table for this class - * id - object id to search for - * location - address of where to store the location - * level - pointer to previous interrupt level - * - * Output parameters: - * returns - address of object if local - * location - one of the following: - * OBJECTS_ERROR - invalid object ID - * OBJECTS_REMOTE - remote object - * OBJECTS_LOCAL - local object - * *level - previous interrupt level - */ - -Objects_Control *_Objects_Get_isr_disable( - Objects_Information *information, - Objects_Id id, - Objects_Locations *location, - ISR_Level *level_p -) -{ - Objects_Control *the_object; - unsigned32 index; - ISR_Level level; - -#if defined(RTEMS_MULTIPROCESSING) - index = id - information->minimum_id + 1; -#else - /* index = _Objects_Get_index( id ); */ - index = id & 0x0000ffff; - /* This should work but doesn't always :( */ - /* index = (unsigned16) id; */ -#endif - - _ISR_Disable( level ); - if ( information->maximum >= index ) { - if ( (the_object = information->local_table[ index ]) != NULL ) { - *location = OBJECTS_LOCAL; - *level_p = level; - return the_object; - } - _ISR_Enable( level ); - *location = OBJECTS_ERROR; - return NULL; - } - _ISR_Enable( level ); - *location = OBJECTS_ERROR; - -#if defined(RTEMS_MULTIPROCESSING) - _Objects_MP_Is_remote( information, id, location, &the_object ); - return the_object; -#else - return NULL; -#endif -} diff --git a/c/src/exec/score/src/objectgetnext.c b/c/src/exec/score/src/objectgetnext.c deleted file mode 100644 index ba3cea04e2..0000000000 --- a/c/src/exec/score/src/objectgetnext.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Object Handler - * - * - * 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 -#include -#include -#include -#if defined(RTEMS_MULTIPROCESSING) -#include -#endif -#include -#include -#include -#include - -/*PAGE - * - * _Objects_Get_next - * - * Like _Objects_Get, but considers the 'id' as a "hint" and - * finds next valid one after that point. - * Mostly used for monitor and debug traversal of an object. - * - * Input parameters: - * information - pointer to entry in table for this class - * id - object id to search for - * location - address of where to store the location - * next_id - address to store next id to try - * - * Output parameters: - * returns - address of object if local - * location - one of the following: - * OBJECTS_ERROR - invalid object ID - * OBJECTS_REMOTE - remote object - * OBJECTS_LOCAL - local object - * next_id - will contain a reasonable "next" id to continue traversal - * - * NOTE: - * assumes can add '1' to an id to get to next index. - */ - -Objects_Control * -_Objects_Get_next( - Objects_Information *information, - Objects_Id id, - Objects_Locations *location_p, - Objects_Id *next_id_p -) -{ - Objects_Control *object; - Objects_Id next_id; - - 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 (_Objects_Get_index(next_id) > information->maximum) - { - *location_p = OBJECTS_ERROR; - goto final; - } - - /* try to grab one */ - object = _Objects_Get(information, next_id, location_p); - - next_id++; - - } while (*location_p != OBJECTS_LOCAL); - - *next_id_p = next_id; - return object; - -final: - *next_id_p = OBJECTS_ID_FINAL; - return 0; -} diff --git a/c/src/exec/score/src/objectgetnoprotection.c b/c/src/exec/score/src/objectgetnoprotection.c deleted file mode 100644 index f1ca407218..0000000000 --- a/c/src/exec/score/src/objectgetnoprotection.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Object Handler -- Object Get - * - * - * COPYRIGHT (c) 1989-2002. - * 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 -#include -#include -#include -#if defined(RTEMS_MULTIPROCESSING) -#include -#endif -#include -#include -#include -#include - -/*PAGE - * - * _Objects_Get_no_protection - * - * This routine sets the object pointer for the given - * object id based on the given object information structure. - * - * Input parameters: - * information - pointer to entry in table for this class - * id - object id to search for - * location - address of where to store the location - * - * Output parameters: - * returns - address of object if local - * location - one of the following: - * OBJECTS_ERROR - invalid object ID - * OBJECTS_REMOTE - remote object - * OBJECTS_LOCAL - local object - */ - -Objects_Control *_Objects_Get_no_protection( - Objects_Information *information, - Objects_Id id, - Objects_Locations *location -) -{ - Objects_Control *the_object; - unsigned32 index; - -#if defined(RTEMS_MULTIPROCESSING) - index = id - information->minimum_id + 1; -#else - /* index = _Objects_Get_index( id ); */ - index = id & 0x0000ffff; - /* This should work but doesn't always :( */ - /* index = (unsigned16) id; */ -#endif - - if ( information->maximum >= index ) { - if ( (the_object = information->local_table[ index ]) != NULL ) { - *location = OBJECTS_LOCAL; - return the_object; - } - *location = OBJECTS_ERROR; - return NULL; - } - *location = OBJECTS_ERROR; - -/* - * Not supported for multiprocessing - */ -#if 0 && defined(RTEMS_MULTIPROCESSING) - _Objects_MP_Is_remote( information, id, location, &the_object ); - return the_object; -#endif - return NULL; -} diff --git a/c/src/exec/score/src/objectinitializeinformation.c b/c/src/exec/score/src/objectinitializeinformation.c deleted file mode 100644 index 02f09236f3..0000000000 --- a/c/src/exec/score/src/objectinitializeinformation.c +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Object Handler - * - * - * 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 -#include -#include -#include -#if defined(RTEMS_MULTIPROCESSING) -#include -#endif -#include -#include -#include -#include - -/*PAGE - * - * _Objects_Initialize_information - * - * This routine initializes all object information related data structures. - * - * Input parameters: - * information - object information table - * maximum - maximum objects of this class - * size - size of this object's control block - * is_string - TRUE if names for this object are strings - * maximum_name_length - maximum length of each object's name - * When multiprocessing is configured, - * supports_global - TRUE if this is a global object class - * extract_callout - pointer to threadq extract callout if MP - * - * Output parameters: NONE - */ - -void _Objects_Initialize_information( - Objects_Information *information, - Objects_APIs the_api, - unsigned32 the_class, - unsigned32 maximum, - unsigned32 size, - boolean is_string, - unsigned32 maximum_name_length -#if defined(RTEMS_MULTIPROCESSING) - , - boolean supports_global, - Objects_Thread_queue_Extract_callout *extract -#endif -) -{ - static Objects_Control *null_local_table = NULL; - unsigned32 minimum_index; - unsigned32 name_length; -#if defined(RTEMS_MULTIPROCESSING) - unsigned32 index; -#endif - - information->the_api = the_api; - information->the_class = the_class; - information->is_string = is_string; - - information->local_table = 0; - information->name_table = 0; - information->inactive_per_block = 0; - information->object_blocks = 0; - - information->inactive = 0; - - /* - * Set the entry in the object information table. - */ - - _Objects_Information_table[ the_api ][ the_class ] = information; - - /* - * Set the size of the object - */ - - information->size = size; - - /* - * Are we operating in unlimited, or auto-extend mode - */ - - information->auto_extend = (maximum & OBJECTS_UNLIMITED_OBJECTS) ? TRUE : FALSE; - maximum &= ~OBJECTS_UNLIMITED_OBJECTS; - - /* - * The allocation unit is the maximum value - */ - - information->allocation_size = maximum; - - /* - * Provide a null local table entry for the case of any empty table. - */ - - information->local_table = &null_local_table; - - /* - * Calculate minimum and maximum Id's - */ - - if ( maximum == 0 ) minimum_index = 0; - else minimum_index = 1; - - information->minimum_id = - _Objects_Build_id( the_api, the_class, _Objects_Local_node, minimum_index ); - - /* - * Calculate the maximum name length - */ - - name_length = maximum_name_length; - - if ( name_length & (OBJECTS_NAME_ALIGNMENT-1) ) - name_length = (name_length + OBJECTS_NAME_ALIGNMENT) & - ~(OBJECTS_NAME_ALIGNMENT-1); - - information->name_length = name_length; - - _Chain_Initialize_empty( &information->Inactive ); - - /* - * Initialize objects .. if there are any - */ - - if ( maximum ) { - - /* - * Reset the maximum value. It will be updated when the information is - * extended. - */ - - information->maximum = 0; - - /* - * Always have the maximum size available so the current performance - * figures are create are met. If the user moves past the maximum - * number then a performance hit is taken. - */ - - _Objects_Extend_information( information ); - - } - - /* - * Take care of multiprocessing - */ - -#if defined(RTEMS_MULTIPROCESSING) - information->extract = extract; - - if ( supports_global == TRUE && _System_state_Is_multiprocessing ) { - - information->global_table = - (Chain_Control *) _Workspace_Allocate_or_fatal_error( - (_Objects_Maximum_nodes + 1) * sizeof(Chain_Control) - ); - - for ( index=1; index <= _Objects_Maximum_nodes ; index++ ) - _Chain_Initialize_empty( &information->global_table[ index ] ); - } - else - information->global_table = NULL; -#endif -} diff --git a/c/src/exec/score/src/objectmp.c b/c/src/exec/score/src/objectmp.c deleted file mode 100644 index bbd2f18cc5..0000000000 --- a/c/src/exec/score/src/objectmp.c +++ /dev/null @@ -1,274 +0,0 @@ -/* - * Multiprocessing Support for the Object Handler - * - * - * 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 -#include -#include -#include -#include - -/*PAGE - * - * _Objects_MP_Handler_initialization - * - */ - -void _Objects_MP_Handler_initialization ( - 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 ); - return; - } - - _Chain_Initialize( - &_Objects_MP_Inactive_global_objects, - _Workspace_Allocate_or_fatal_error( - maximum_global_objects * sizeof( Objects_MP_Control ) - ), - maximum_global_objects, - sizeof( Objects_MP_Control ) - ); - -} - -/*PAGE - * - * _Objects_MP_Open - * - */ - -void _Objects_MP_Open ( - Objects_Information *information, - Objects_MP_Control *the_global_object, - unsigned32 the_name, /* XXX -- wrong for variable */ - Objects_Id the_id -) -{ - the_global_object->Object.id = the_id; - the_global_object->name = the_name; - - _Chain_Prepend( - &information->global_table[ _Objects_Get_node( the_id ) ], - &the_global_object->Object.Node - ); - -} - -/*PAGE - * - * _Objects_MP_Allocate_and_open - * - */ - -boolean _Objects_MP_Allocate_and_open ( - Objects_Information *information, - unsigned32 the_name, /* XXX -- wrong for variable */ - Objects_Id the_id, - boolean is_fatal_error -) -{ - Objects_MP_Control *the_global_object; - - the_global_object = _Objects_MP_Allocate_global_object(); - if ( _Objects_MP_Is_null_global_object( the_global_object ) ) { - - if ( is_fatal_error == FALSE ) - return FALSE; - - _Internal_error_Occurred( - INTERNAL_ERROR_CORE, - TRUE, - INTERNAL_ERROR_OUT_OF_GLOBAL_OBJECTS - ); - - } - - _Objects_MP_Open( information, the_global_object, the_name, the_id ); - - return TRUE; -} - -/*PAGE - * - * _Objects_MP_Close - * - */ - -void _Objects_MP_Close ( - Objects_Information *information, - Objects_Id the_id -) -{ - Chain_Control *the_chain; - Chain_Node *the_node; - Objects_MP_Control *the_object; - - the_chain = &information->global_table[ _Objects_Get_node( the_id ) ]; - - for ( the_node = the_chain->first ; - !_Chain_Is_tail( the_chain, the_node ) ; - the_node = the_node->next ) { - - the_object = (Objects_MP_Control *) the_node; - - if ( _Objects_Are_ids_equal( the_object->Object.id, the_id ) ) { - - _Chain_Extract( the_node ); - _Objects_MP_Free_global_object( the_object ); - return; - } - - } - - _Internal_error_Occurred( - INTERNAL_ERROR_CORE, - TRUE, - INTERNAL_ERROR_INVALID_GLOBAL_ID - ); -} - -/*PAGE - * - * _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, - Objects_Id *the_id -) -{ - unsigned32 low_node; - unsigned32 high_node; - unsigned32 node_index; - Chain_Control *the_chain; - Chain_Node *the_node; - Objects_MP_Control *the_object; - unsigned32 name_to_use = *(unsigned32 *)the_name; /* XXX variable */ - - if ( nodes_to_search > _Objects_Maximum_nodes ) - return OBJECTS_INVALID_NODE; - - if ( information->global_table == NULL ) - return OBJECTS_INVALID_NAME; - - if ( nodes_to_search == OBJECTS_SEARCH_ALL_NODES || - nodes_to_search == OBJECTS_SEARCH_OTHER_NODES ) { - low_node = 1; - high_node = _Objects_Maximum_nodes; - } else { - low_node = - high_node = nodes_to_search; - } - - _Thread_Disable_dispatch(); - - for ( node_index = low_node ; node_index <= high_node ; node_index++ ) { - - /* - * NOTE: The local node was search (if necessary) by - * _Objects_Name_to_id before this was invoked. - */ - - if ( !_Objects_Is_local_node( node_index ) ) { - the_chain = &information->global_table[ node_index ]; - - for ( the_node = the_chain->first ; - !_Chain_Is_tail( the_chain, the_node ) ; - the_node = the_node->next ) { - - the_object = (Objects_MP_Control *) the_node; - - if ( the_object->name == name_to_use ) { - *the_id = the_object->Object.id; - _Thread_Enable_dispatch(); - return OBJECTS_SUCCESSFUL; - } - } - } - } - - _Thread_Enable_dispatch(); - return OBJECTS_INVALID_NAME; -} - -/*PAGE - * - * _Objects_MP_Is_remote - * - */ - -void _Objects_MP_Is_remote ( - Objects_Information *information, - Objects_Id the_id, - Objects_Locations *location, - Objects_Control **the_object -) -{ - unsigned32 node; - Chain_Control *the_chain; - Chain_Node *the_node; - Objects_MP_Control *the_global_object; - - node = _Objects_Get_node( the_id ); - - /* - * NOTE: The local node was search (if necessary) by - * _Objects_Name_to_id before this was invoked. - * - * The NODE field of an object id cannot be 0 - * because 0 is an invalid node number. - */ - - if ( node == 0 || - _Objects_Is_local_node( node ) || - node > _Objects_Maximum_nodes || - information->global_table == NULL ) { - - *location = OBJECTS_ERROR; - *the_object = NULL; - return; - } - - _Thread_Disable_dispatch(); - - the_chain = &information->global_table[ node ]; - - for ( the_node = the_chain->first ; - !_Chain_Is_tail( the_chain, the_node ) ; - the_node = the_node->next ) { - - the_global_object = (Objects_MP_Control *) the_node; - - if ( _Objects_Are_ids_equal( the_global_object->Object.id, the_id ) ) { - _Thread_Unnest_dispatch(); - *location = OBJECTS_REMOTE; - *the_object = (Objects_Control *) the_global_object; - return; - } - } - - _Thread_Enable_dispatch(); - *location = OBJECTS_ERROR; - *the_object = NULL; - -} diff --git a/c/src/exec/score/src/objectnametoid.c b/c/src/exec/score/src/objectnametoid.c deleted file mode 100644 index 3bbf20900c..0000000000 --- a/c/src/exec/score/src/objectnametoid.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Object Handler - * - * - * 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 -#include -#include -#include -#if defined(RTEMS_MULTIPROCESSING) -#include -#endif -#include -#include -#include -#include - -/*PAGE - * - * _Objects_Name_to_id - * - * These kernel routines search the object table(s) for the given - * object name and returns the associated object id. - * - * Input parameters: - * information - object information - * name - user defined object name - * node - node indentifier (0 indicates any node) - * id - address of return ID - * - * Output parameters: - * id - object id - * OBJECTS_SUCCESSFUL - if successful - * error code - if unsuccessful - */ - -Objects_Name_to_id_errors _Objects_Name_to_id( - Objects_Information *information, - Objects_Name name, - unsigned32 node, - Objects_Id *id -) -{ - boolean search_local_node; - Objects_Control *the_object; - unsigned32 index; - unsigned32 name_length; - Objects_Name_comparators compare_them; - - if ( name == 0 ) - return OBJECTS_INVALID_NAME; - - search_local_node = FALSE; - - if ( information->maximum != 0 && - (node == OBJECTS_SEARCH_ALL_NODES || node == OBJECTS_SEARCH_LOCAL_NODE || - _Objects_Is_local_node( node ) ) ) - search_local_node = TRUE; - - if ( search_local_node ) { - name_length = information->name_length; - - if ( information->is_string ) compare_them = _Objects_Compare_name_string; - else compare_them = _Objects_Compare_name_raw; - - for ( index = 1; index <= information->maximum; index++ ) { - the_object = information->local_table[ index ]; - if ( !the_object || !the_object->name ) - continue; - - if ( (*compare_them)( name, the_object->name, name_length ) ) { - *id = the_object->id; - return OBJECTS_SUCCESSFUL; - } - } - } - - if ( _Objects_Is_local_node( node ) || node == OBJECTS_SEARCH_LOCAL_NODE ) - return OBJECTS_INVALID_NAME; - -#if defined(RTEMS_MULTIPROCESSING) - return ( _Objects_MP_Global_name_search( information, name, node, id ) ); -#else - return OBJECTS_INVALID_NAME; -#endif -} diff --git a/c/src/exec/score/src/objectshrinkinformation.c b/c/src/exec/score/src/objectshrinkinformation.c deleted file mode 100644 index 136e6b1686..0000000000 --- a/c/src/exec/score/src/objectshrinkinformation.c +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Object Handler - * - * - * 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 -#include -#include -#include -#if defined(RTEMS_MULTIPROCESSING) -#include -#endif -#include -#include -#include -#include - -/*PAGE - * - * _Objects_Shrink_information - * - * This routine shrinks object information related data structures. - * The object's name and object space are released. The local_table - * etc block does not shrink. The InActive list needs to be scanned - * to find the objects are remove them. - * Input parameters: - * information - object information table - * the_block - the block to remove - * - * Output parameters: NONE - */ - -void _Objects_Shrink_information( - Objects_Information *information -) -{ - Objects_Control *the_object; - Objects_Control *extract_me; - unsigned32 block_count; - unsigned32 block; - unsigned32 index_base; - unsigned32 index; - - /* - * Search the list to find block or chunnk with all objects inactive. - */ - - index_base = _Objects_Get_index( information->minimum_id ); - block_count = ( information->maximum - index_base ) / information->allocation_size; - - for ( block = 0; block < block_count; block++ ) { - if ( information->inactive_per_block[ block ] == information->allocation_size ) { - - /* - * XXX - Not to sure how to use a chain where you need to iterate and - * and remove elements. - */ - - the_object = (Objects_Control *) information->Inactive.first; - - /* - * Assume the Inactive chain is never empty at this point - */ - - do { - index = _Objects_Get_index( the_object->id ); - - if ((index >= index_base) && - (index < (index_base + information->allocation_size))) { - - /* - * Get the next node before the node is extracted - */ - - extract_me = the_object; - - if ( !_Chain_Is_last( &the_object->Node ) ) - the_object = (Objects_Control *) the_object->Node.next; - else - the_object = NULL; - - _Chain_Extract( &extract_me->Node ); - } - else { - the_object = (Objects_Control *) the_object->Node.next; - } - } - while ( the_object && !_Chain_Is_last( &the_object->Node ) ); - - /* - * Free the memory and reset the structures in the object' information - */ - - _Workspace_Free( information->object_blocks[ block ] ); - information->name_table[ block ] = NULL; - information->object_blocks[ block ] = NULL; - information->inactive_per_block[ block ] = 0; - - information->inactive -= information->allocation_size; - - return; - } - - index_base += information->allocation_size; - } -} diff --git a/c/src/exec/score/src/thread.c b/c/src/exec/score/src/thread.c deleted file mode 100644 index a05dd0fd75..0000000000 --- a/c/src/exec/score/src/thread.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Thread Handler - * - * - * COPYRIGHT (c) 1989-1999. - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/*PAGE - * - * _Thread_Handler_initialization - * - * This routine initializes all thread manager related data structures. - * - * Input parameters: - * ticks_per_timeslice - clock ticks per quantum - * maximum_proxies - number of proxies to initialize - * - * Output parameters: NONE - */ - -void _Thread_Handler_initialization( - unsigned32 ticks_per_timeslice, - unsigned32 maximum_extensions, - unsigned32 maximum_proxies -) -{ - unsigned32 index; - - /* - * BOTH stacks hooks must be set or both must be NULL. - * Do not allow mixture. - */ - - if ( !( ( _CPU_Table.stack_allocate_hook == 0 ) - == ( _CPU_Table.stack_free_hook == 0 ) ) ) - _Internal_error_Occurred( - INTERNAL_ERROR_CORE, - TRUE, - INTERNAL_ERROR_BAD_STACK_HOOK - ); - - _Context_Switch_necessary = FALSE; - _Thread_Executing = NULL; - _Thread_Heir = NULL; -#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE ) - _Thread_Allocated_fp = NULL; -#endif - - _Thread_Do_post_task_switch_extension = 0; - - _Thread_Maximum_extensions = maximum_extensions; - - _Thread_Ticks_per_timeslice = ticks_per_timeslice; - - _Thread_Ready_chain = (Chain_Control *) _Workspace_Allocate_or_fatal_error( - (PRIORITY_MAXIMUM + 1) * sizeof(Chain_Control) - ); - - for ( index=0; index <= PRIORITY_MAXIMUM ; index++ ) - _Chain_Initialize_empty( &_Thread_Ready_chain[ index ] ); - -#if defined(RTEMS_MULTIPROCESSING) - _Thread_MP_Handler_initialization( maximum_proxies ); -#endif - - /* - * Initialize this class of objects. - */ - - _Objects_Initialize_information( - &_Thread_Internal_information, - OBJECTS_INTERNAL_API, - OBJECTS_INTERNAL_THREADS, - ( _System_state_Is_multiprocessing ) ? 2 : 1, - sizeof( Thread_Control ), - /* size of this object's control block */ - TRUE, /* TRUE if names for this object are strings */ - 8 /* maximum length of each object's name */ -#if defined(RTEMS_MULTIPROCESSING) - , - FALSE, /* TRUE if this is a global object class */ - NULL /* Proxy extraction support callout */ -#endif - ); - -} - diff --git a/c/src/exec/score/src/threadchangepriority.c b/c/src/exec/score/src/threadchangepriority.c deleted file mode 100644 index 65c16a6305..0000000000 --- a/c/src/exec/score/src/threadchangepriority.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Thread Handler - * - * - * COPYRIGHT (c) 1989-1999. - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/*PAGE - * - * _Thread_Change_priority - * - * This kernel routine changes the priority of the thread. The - * thread chain is adjusted if necessary. - * - * Input parameters: - * the_thread - pointer to thread control block - * new_priority - ultimate priority - * prepend_it - TRUE if the thread should be prepended to the chain - * - * Output parameters: NONE - * - * INTERRUPT LATENCY: - * ready chain - * select heir - */ - -void _Thread_Change_priority( - Thread_Control *the_thread, - Priority_Control new_priority, - boolean prepend_it -) -{ - ISR_Level level; - /* boolean do_prepend = FALSE; */ - - /* - * If this is a case where prepending the task to its priority is - * potentially desired, then we need to consider whether to do it. - * This usually occurs when a task lowers its priority implcitly as - * the result of losing inherited priority. Normal explicit priority - * change calls (e.g. rtems_task_set_priority) should always do an - * append not a prepend. - */ - - /* - * Techically, the prepend should conditional on the thread lowering - * its priority but that does allow cxd2004 of the acvc 2.0.1 to - * pass with rtems 4.0.0. This should change when gnat redoes its - * priority scheme. - */ -/* - if ( prepend_it && - _Thread_Is_executing( the_thread ) && - new_priority >= the_thread->current_priority ) - prepend_it = TRUE; -*/ - - _Thread_Set_transient( the_thread ); - - if ( the_thread->current_priority != new_priority ) - _Thread_Set_priority( the_thread, new_priority ); - - _ISR_Disable( level ); - - the_thread->current_state = - _States_Clear( STATES_TRANSIENT, the_thread->current_state ); - - if ( ! _States_Is_ready( the_thread->current_state ) ) { - /* - * XXX If a task is to be reordered while blocked on a priority - * XXX priority ordered thread queue, then this is where that - * XXX should occur. - */ - _ISR_Enable( level ); - return; - } - - _Priority_Add_to_bit_map( &the_thread->Priority_map ); - if ( prepend_it ) - _Chain_Prepend_unprotected( the_thread->ready, &the_thread->Object.Node ); - else - _Chain_Append_unprotected( the_thread->ready, &the_thread->Object.Node ); - - _ISR_Flash( level ); - - _Thread_Calculate_heir(); - - if ( !_Thread_Is_executing_also_the_heir() && - _Thread_Executing->is_preemptible ) - _Context_Switch_necessary = TRUE; - _ISR_Enable( level ); -} diff --git a/c/src/exec/score/src/threadclearstate.c b/c/src/exec/score/src/threadclearstate.c deleted file mode 100644 index 8a4ae80417..0000000000 --- a/c/src/exec/score/src/threadclearstate.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Thread Handler - * - * - * COPYRIGHT (c) 1989-1999. - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/*PAGE - * - * _Thread_Clear_state - * - * This kernel routine clears the appropriate states in the - * requested thread. The thread ready chain is adjusted if - * necessary and the Heir thread is set accordingly. - * - * Input parameters: - * the_thread - pointer to thread control block - * state - state set to clear - * - * Output parameters: NONE - * - * INTERRUPT LATENCY: - * priority map - * select heir - */ - - -void _Thread_Clear_state( - Thread_Control *the_thread, - States_Control state -) -{ - ISR_Level level; - States_Control current_state; - - _ISR_Disable( level ); - current_state = the_thread->current_state; - - if ( current_state & state ) { - current_state = - the_thread->current_state = _States_Clear( state, current_state ); - - if ( _States_Is_ready( current_state ) ) { - - _Priority_Add_to_bit_map( &the_thread->Priority_map ); - - _Chain_Append_unprotected(the_thread->ready, &the_thread->Object.Node); - - _ISR_Flash( level ); - - if ( the_thread->current_priority < _Thread_Heir->current_priority ) { - _Thread_Heir = the_thread; - if ( _Thread_Executing->is_preemptible || - the_thread->current_priority == 0 ) - _Context_Switch_necessary = TRUE; - } - } - } - _ISR_Enable( level ); -} diff --git a/c/src/exec/score/src/threadclose.c b/c/src/exec/score/src/threadclose.c deleted file mode 100644 index b589461eaa..0000000000 --- a/c/src/exec/score/src/threadclose.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Thread Handler - * - * - * COPYRIGHT (c) 1989-1999. - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* - * _Thread_Close - * - * DESCRIPTION: - * - * This routine frees all memory associated with the specified - * thread and removes it from the local object table so no further - * operations on this thread are allowed. - */ - -void _Thread_Close( - Objects_Information *information, - Thread_Control *the_thread -) -{ - _Objects_Close( information, &the_thread->Object ); - - _Thread_Set_state( the_thread, STATES_TRANSIENT ); - - if ( !_Thread_queue_Extract_with_proxy( the_thread ) ) { - if ( _Watchdog_Is_active( &the_thread->Timer ) ) - (void) _Watchdog_Remove( &the_thread->Timer ); - } - - _User_extensions_Thread_delete( the_thread ); - -#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE ) -#if ( CPU_USE_DEFERRED_FP_SWITCH == TRUE ) - if ( _Thread_Is_allocated_fp( the_thread ) ) - _Thread_Deallocate_fp(); -#endif - the_thread->fp_context = NULL; - - if ( the_thread->Start.fp_context ) - (void) _Workspace_Free( the_thread->Start.fp_context ); -#endif - - _Thread_Stack_Free( the_thread ); - - if ( the_thread->extensions ) - (void) _Workspace_Free( the_thread->extensions ); - - the_thread->Start.stack = NULL; - the_thread->extensions = NULL; -} diff --git a/c/src/exec/score/src/threadcreateidle.c b/c/src/exec/score/src/threadcreateidle.c deleted file mode 100644 index 32d8254507..0000000000 --- a/c/src/exec/score/src/threadcreateidle.c +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Thread Handler - * - * - * COPYRIGHT (c) 1989-1999. - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/*PAGE - * - * _Thread_Create_idle - */ - -char *_Thread_Idle_name = "IDLE"; - -void _Thread_Create_idle( void ) -{ - void *idle; - unsigned32 idle_task_stack_size; - - /* - * The entire workspace is zeroed during its initialization. Thus, all - * fields not explicitly assigned were explicitly zeroed by - * _Workspace_Initialization. - */ - - _Thread_Idle = _Thread_Internal_allocate(); - - /* - * Initialize the IDLE task. - */ - -#if (CPU_PROVIDES_IDLE_THREAD_BODY == TRUE) - idle = (void *) _CPU_Thread_Idle_body; -#else - idle = (void *) _Thread_Idle_body; -#endif - - if ( _CPU_Table.idle_task ) - idle = _CPU_Table.idle_task; - - idle_task_stack_size = _CPU_Table.idle_task_stack_size; - if ( idle_task_stack_size < STACK_MINIMUM_SIZE ) - idle_task_stack_size = STACK_MINIMUM_SIZE; - - _Thread_Initialize( - &_Thread_Internal_information, - _Thread_Idle, - NULL, /* allocate the stack */ - idle_task_stack_size, - CPU_IDLE_TASK_IS_FP, - PRIORITY_MAXIMUM, - TRUE, /* preemptable */ - THREAD_CPU_BUDGET_ALGORITHM_NONE, - NULL, /* no budget algorithm callout */ - 0, /* all interrupts enabled */ - _Thread_Idle_name - ); - - /* - * WARNING!!! This is necessary to "kick" start the system and - * MUST be done before _Thread_Start is invoked. - */ - - _Thread_Heir = - _Thread_Executing = _Thread_Idle; - - _Thread_Start( - _Thread_Idle, - THREAD_START_NUMERIC, - idle, - NULL, - 0 - ); - -} diff --git a/c/src/exec/score/src/threaddelayended.c b/c/src/exec/score/src/threaddelayended.c deleted file mode 100644 index bb8f05296c..0000000000 --- a/c/src/exec/score/src/threaddelayended.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Thread Handler - * - * - * COPYRIGHT (c) 1989-1999. - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/*PAGE - * - * _Thread_Delay_ended - * - * This routine processes a thread whose delay period has ended. - * It is called by the watchdog handler. - * - * Input parameters: - * id - thread id - * - * Output parameters: NONE - */ - -void _Thread_Delay_ended( - Objects_Id id, - void *ignored -) -{ - Thread_Control *the_thread; - Objects_Locations location; - - the_thread = _Thread_Get( id, &location ); - switch ( location ) { - case OBJECTS_ERROR: - case OBJECTS_REMOTE: /* impossible */ - break; - case OBJECTS_LOCAL: - _Thread_Unblock( the_thread ); - _Thread_Unnest_dispatch(); - break; - } -} diff --git a/c/src/exec/score/src/threaddispatch.c b/c/src/exec/score/src/threaddispatch.c deleted file mode 100644 index eedc8cc9ee..0000000000 --- a/c/src/exec/score/src/threaddispatch.c +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Thread Handler - * - * - * COPYRIGHT (c) 1989-1999. - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/*PAGE - * - * _Thread_Dispatch - * - * This kernel routine determines if a dispatch is needed, and if so - * dispatches to the heir thread. Once the heir is running an attempt - * is made to dispatch any ASRs. - * - * ALTERNATE ENTRY POINTS: - * void _Thread_Enable_dispatch(); - * - * Input parameters: NONE - * - * Output parameters: NONE - * - * INTERRUPT LATENCY: - * dispatch thread - * no dispatch thread - */ - -#if ( CPU_INLINE_ENABLE_DISPATCH == FALSE ) -void _Thread_Enable_dispatch( void ) -{ - if ( --_Thread_Dispatch_disable_level ) - return; - _Thread_Dispatch(); -} -#endif - -void _Thread_Dispatch( void ) -{ - Thread_Control *executing; - Thread_Control *heir; - ISR_Level level; - - executing = _Thread_Executing; - _ISR_Disable( level ); - while ( _Context_Switch_necessary == TRUE ) { - heir = _Thread_Heir; - _Thread_Dispatch_disable_level = 1; - _Context_Switch_necessary = FALSE; - _Thread_Executing = heir; - executing->rtems_ada_self = rtems_ada_self; - rtems_ada_self = heir->rtems_ada_self; - _ISR_Enable( level ); - - heir->ticks_executed++; - - /* - * Switch libc's task specific data. - */ - if ( _Thread_libc_reent ) { - executing->libc_reent = *_Thread_libc_reent; - *_Thread_libc_reent = heir->libc_reent; - } - - _User_extensions_Thread_switch( executing, heir ); - - if ( heir->budget_algorithm == THREAD_CPU_BUDGET_ALGORITHM_RESET_TIMESLICE ) - heir->cpu_time_budget = _Thread_Ticks_per_timeslice; - - /* - * If the CPU has hardware floating point, then we must address saving - * and restoring it as part of the context switch. - * - * The second conditional compilation section selects the algorithm used - * to context switch between floating point tasks. The deferred algorithm - * can be significantly better in a system with few floating point tasks - * because it reduces the total number of save and restore FP context - * operations. However, this algorithm can not be used on all CPUs due - * to unpredictable use of FP registers by some compilers for integer - * operations. - */ - -#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE ) -#if ( CPU_USE_DEFERRED_FP_SWITCH != TRUE ) - if ( executing->fp_context != NULL ) - _Context_Save_fp( &executing->fp_context ); -#endif -#endif - - _Context_Switch( &executing->Registers, &heir->Registers ); - -#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE ) -#if ( CPU_USE_DEFERRED_FP_SWITCH == TRUE ) - if ( (executing->fp_context != NULL) && !_Thread_Is_allocated_fp( executing ) ) { - if ( _Thread_Allocated_fp != NULL ) - _Context_Save_fp( &_Thread_Allocated_fp->fp_context ); - _Context_Restore_fp( &executing->fp_context ); - _Thread_Allocated_fp = executing; - } -#else - if ( executing->fp_context != NULL ) - _Context_Restore_fp( &executing->fp_context ); -#endif -#endif - - executing = _Thread_Executing; - - _ISR_Disable( level ); - } - - _Thread_Dispatch_disable_level = 0; - - _ISR_Enable( level ); - - if ( _Thread_Do_post_task_switch_extension || - executing->do_post_task_switch_extension ) { - executing->do_post_task_switch_extension = FALSE; - _API_extensions_Run_postswitch(); - } - -} diff --git a/c/src/exec/score/src/threadevaluatemode.c b/c/src/exec/score/src/threadevaluatemode.c deleted file mode 100644 index edbfa5b882..0000000000 --- a/c/src/exec/score/src/threadevaluatemode.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Thread Handler - * - * - * COPYRIGHT (c) 1989-1999. - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/*PAGE - * - * _Thread_Evaluate_mode - * - * XXX - */ - -boolean _Thread_Evaluate_mode( void ) -{ - Thread_Control *executing; - - executing = _Thread_Executing; - - if ( !_States_Is_ready( executing->current_state ) || - ( !_Thread_Is_heir( executing ) && executing->is_preemptible ) ) { - _Context_Switch_necessary = TRUE; - return TRUE; - } - - return FALSE; -} diff --git a/c/src/exec/score/src/threadget.c b/c/src/exec/score/src/threadget.c deleted file mode 100644 index c8747f76fa..0000000000 --- a/c/src/exec/score/src/threadget.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Thread Handler - * - * - * COPYRIGHT (c) 1989-1999. - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/*PAGE - * - * _Thread_Get - * - * NOTE: If we are not using static inlines, this must be a real - * subroutine call. - * - * NOTE: XXX... This routine may be able to be optimized. - */ - -#ifndef USE_INLINES - -Thread_Control *_Thread_Get ( - Objects_Id id, - Objects_Locations *location -) -{ - unsigned32 the_api; - unsigned32 the_class; - Objects_Information *information; - Thread_Control *tp = (Thread_Control *) 0; - - if ( _Objects_Are_ids_equal( id, OBJECTS_ID_OF_SELF ) ) { - _Thread_Disable_dispatch(); - *location = OBJECTS_LOCAL; - tp = _Thread_Executing; - goto done; - } - - the_api = _Objects_Get_API( id ); - if ( the_api && the_api > OBJECTS_APIS_LAST ) { - *location = OBJECTS_ERROR; - goto done; - } - - the_class = _Objects_Get_class( id ); - if ( the_class != 1 ) { /* threads are always first class :) */ - *location = OBJECTS_ERROR; - goto done; - } - - information = _Objects_Information_table[ the_api ][ the_class ]; - - if ( !information ) { - *location = OBJECTS_ERROR; - goto done; - } - - tp = (Thread_Control *) _Objects_Get( information, id, location ); - -done: - return tp; -} - -#endif diff --git a/c/src/exec/score/src/threadhandler.c b/c/src/exec/score/src/threadhandler.c deleted file mode 100644 index ec09654c5a..0000000000 --- a/c/src/exec/score/src/threadhandler.c +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Thread Handler - * - * - * COPYRIGHT (c) 1989-1999. - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/*PAGE - * - * _Thread_Handler - * - * This routine is the "primal" entry point for all threads. - * _Context_Initialize() dummies up the thread's initial context - * to cause the first Context_Switch() to jump to _Thread_Handler(). - * - * This routine is the default thread exitted error handler. It is - * returned to when a thread exits. The configured fatal error handler - * is invoked to process the exit. - * - * NOTE: - * - * On entry, it is assumed all interrupts are blocked and that this - * routine needs to set the initial isr level. This may or may not - * actually be needed by the context switch routine and as a result - * interrupts may already be at there proper level. Either way, - * setting the initial isr level properly here is safe. - * - * Currently this is only really needed for the posix port, - * ref: _Context_Switch in unix/cpu.c - * - * Input parameters: NONE - * - * Output parameters: NONE - */ - -void _Thread_Handler( void ) -{ - ISR_Level level; - Thread_Control *executing; -#if defined(__USE_INIT_FINI__) || defined(__USE__MAIN__) - static char doneConstructors; - char doneCons; -#endif - - executing = _Thread_Executing; - - /* - * have to put level into a register for those cpu's that use - * inline asm here - */ - - level = executing->Start.isr_level; - _ISR_Set_level(level); - -#if defined(__USE_INIT_FINI__) || defined(__USE__MAIN__) - doneCons = doneConstructors; - doneConstructors = 1; -#endif - -#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE ) -#if ( CPU_USE_DEFERRED_FP_SWITCH == TRUE ) - if ( (executing->fp_context != NULL) && !_Thread_Is_allocated_fp( executing ) ) { - if ( _Thread_Allocated_fp != NULL ) - _Context_Save_fp( &_Thread_Allocated_fp->fp_context ); - _Thread_Allocated_fp = executing; - } -#endif -#endif - - - /* - * Take care that 'begin' extensions get to complete before - * 'switch' extensions can run. This means must keep dispatch - * disabled until all 'begin' extensions complete. - */ - - _User_extensions_Thread_begin( executing ); - - /* - * At this point, the dispatch disable level BETTER be 1. - */ - - _Thread_Enable_dispatch(); -#if defined(__USE_INIT_FINI__) - if (!doneCons) - _init (); -#endif -#if defined(__USE__MAIN__) - if (!doneCons) - __main (); -#endif - - - switch ( executing->Start.prototype ) { - case THREAD_START_NUMERIC: - executing->Wait.return_argument = - (*(Thread_Entry_numeric) executing->Start.entry_point)( - executing->Start.numeric_argument - ); - break; - case THREAD_START_POINTER: - executing->Wait.return_argument = - (*(Thread_Entry_pointer) executing->Start.entry_point)( - executing->Start.pointer_argument - ); - break; - case THREAD_START_BOTH_POINTER_FIRST: - executing->Wait.return_argument = - (*(Thread_Entry_both_pointer_first) executing->Start.entry_point)( - executing->Start.pointer_argument, - executing->Start.numeric_argument - ); - break; - case THREAD_START_BOTH_NUMERIC_FIRST: - executing->Wait.return_argument = - (*(Thread_Entry_both_numeric_first) executing->Start.entry_point)( - executing->Start.numeric_argument, - executing->Start.pointer_argument - ); - break; - } - - /* - * In the switch above, the return code from the user thread body - * was placed in return_argument. This assumed that if it returned - * anything (which is not supporting in all APIs), then it would be - * able to fit in a (void *). - */ - - _User_extensions_Thread_exitted( executing ); - - _Internal_error_Occurred( - INTERNAL_ERROR_CORE, - TRUE, - INTERNAL_ERROR_THREAD_EXITTED - ); -} diff --git a/c/src/exec/score/src/threadidlebody.c b/c/src/exec/score/src/threadidlebody.c deleted file mode 100644 index 93b90a12cd..0000000000 --- a/c/src/exec/score/src/threadidlebody.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Thread Handler - * - * - * COPYRIGHT (c) 1989-1999. - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/*PAGE - * - * _Thread_Idle_body - * - * This kernel routine is the idle thread. The idle thread runs any time - * no other thread is ready to run. This thread loops forever with - * interrupts enabled. - * - * Input parameters: - * ignored - this parameter is ignored - * - * Output parameters: NONE - */ - -#if (CPU_PROVIDES_IDLE_THREAD_BODY == FALSE) -Thread _Thread_Idle_body( - unsigned32 ignored -) -{ - for( ; ; ) ; -} -#endif diff --git a/c/src/exec/score/src/threadinitialize.c b/c/src/exec/score/src/threadinitialize.c deleted file mode 100644 index e850e3fe1f..0000000000 --- a/c/src/exec/score/src/threadinitialize.c +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Thread Handler - * - * - * COPYRIGHT (c) 1989-1999. - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/*PAGE - * - * _Thread_Initialize - * - * This routine initializes the specified the thread. It allocates - * all memory associated with this thread. It completes by adding - * the thread to the local object table so operations on this - * thread id are allowed. - */ - -boolean _Thread_Initialize( - Objects_Information *information, - Thread_Control *the_thread, - void *stack_area, - unsigned32 stack_size, - boolean is_fp, - Priority_Control priority, - boolean is_preemptible, - Thread_CPU_budget_algorithms budget_algorithm, - Thread_CPU_budget_algorithm_callout budget_callout, - unsigned32 isr_level, - Objects_Name name -) -{ - unsigned32 actual_stack_size = 0; - void *stack = NULL; -#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE ) - void *fp_area; -#endif - void *extensions_area; - - /* - * Initialize the Ada self pointer - */ - - the_thread->rtems_ada_self = NULL; - - /* - * Allocate and Initialize the stack for this thread. - */ - - - if ( !stack_area ) { - if ( !_Stack_Is_enough( stack_size ) ) - actual_stack_size = STACK_MINIMUM_SIZE; - else - actual_stack_size = stack_size; - - actual_stack_size = _Thread_Stack_Allocate( the_thread, actual_stack_size ); - - if ( !actual_stack_size ) - return FALSE; /* stack allocation failed */ - - stack = the_thread->Start.stack; - the_thread->Start.core_allocated_stack = TRUE; - } else { - stack = stack_area; - actual_stack_size = stack_size; - the_thread->Start.core_allocated_stack = FALSE; - } - - _Stack_Initialize( - &the_thread->Start.Initial_stack, - stack, - actual_stack_size - ); - - /* - * Allocate the floating point area for this thread - */ - -#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE ) - if ( is_fp ) { - - fp_area = _Workspace_Allocate( CONTEXT_FP_SIZE ); - if ( !fp_area ) { - _Thread_Stack_Free( the_thread ); - return FALSE; - } - fp_area = _Context_Fp_start( fp_area, 0 ); - - } else - fp_area = NULL; - - the_thread->fp_context = fp_area; - the_thread->Start.fp_context = fp_area; -#endif - - /* - * Clear the libc reent hook. - */ - - the_thread->libc_reent = NULL; - - /* - * Allocate the extensions area for this thread - */ - - if ( _Thread_Maximum_extensions ) { - extensions_area = _Workspace_Allocate( - (_Thread_Maximum_extensions + 1) * sizeof( void * ) - ); - - if ( !extensions_area ) { -#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE ) - if ( fp_area ) - (void) _Workspace_Free( fp_area ); -#endif - - _Thread_Stack_Free( the_thread ); - - return FALSE; - } - } else - extensions_area = NULL; - - the_thread->extensions = (void **) extensions_area; - - /* - * Clear the extensions area so extension users can determine - * if they are linked to the thread. An extension user may - * create the extension long after tasks have been created - * so they cannot rely on the thread create user extension - * call. - */ - - if ( the_thread->extensions ) { - int i; - for ( i = 0; i < (_Thread_Maximum_extensions + 1); i++ ) - the_thread->extensions[i] = NULL; - } - - /* - * General initialization - */ - - the_thread->Start.is_preemptible = is_preemptible; - the_thread->Start.budget_algorithm = budget_algorithm; - the_thread->Start.budget_callout = budget_callout; - - switch ( budget_algorithm ) { - case THREAD_CPU_BUDGET_ALGORITHM_NONE: - case THREAD_CPU_BUDGET_ALGORITHM_RESET_TIMESLICE: - break; - case THREAD_CPU_BUDGET_ALGORITHM_EXHAUST_TIMESLICE: - the_thread->cpu_time_budget = _Thread_Ticks_per_timeslice; - break; - case THREAD_CPU_BUDGET_ALGORITHM_CALLOUT: - break; - } - - the_thread->Start.isr_level = isr_level; - - the_thread->current_state = STATES_DORMANT; - the_thread->resource_count = 0; - the_thread->suspend_count = 0; - the_thread->real_priority = priority; - the_thread->Start.initial_priority = priority; - the_thread->ticks_executed = 0; - - _Thread_Set_priority( the_thread, priority ); - - /* - * Open the object - */ - - _Objects_Open( information, &the_thread->Object, name ); - - /* - * Invoke create extensions - */ - - if ( !_User_extensions_Thread_create( the_thread ) ) { - - if ( extensions_area ) - (void) _Workspace_Free( extensions_area ); - -#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE ) - if ( fp_area ) - (void) _Workspace_Free( fp_area ); -#endif - - _Thread_Stack_Free( the_thread ); - - return FALSE; - } - - return TRUE; - -} diff --git a/c/src/exec/score/src/threadloadenv.c b/c/src/exec/score/src/threadloadenv.c deleted file mode 100644 index af1233f709..0000000000 --- a/c/src/exec/score/src/threadloadenv.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Thread Handler - * - * - * COPYRIGHT (c) 1989-1999. - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/*PAGE - * - * _Thread_Load_environment - * - * Load starting environment for another thread from its start area in the - * thread. Only called from t_restart and t_start. - * - * Input parameters: - * the_thread - thread control block pointer - * - * Output parameters: NONE - */ - -void _Thread_Load_environment( - Thread_Control *the_thread -) -{ - boolean is_fp = FALSE; - -#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE ) - if ( the_thread->Start.fp_context ) { - the_thread->fp_context = the_thread->Start.fp_context; - _Context_Initialize_fp( &the_thread->fp_context ); - is_fp = TRUE; - } -#endif - - the_thread->do_post_task_switch_extension = FALSE; - the_thread->is_preemptible = the_thread->Start.is_preemptible; - the_thread->budget_algorithm = the_thread->Start.budget_algorithm; - the_thread->budget_callout = the_thread->Start.budget_callout; - - _Context_Initialize( - &the_thread->Registers, - the_thread->Start.Initial_stack.area, - the_thread->Start.Initial_stack.size, - the_thread->Start.isr_level, - _Thread_Handler, - is_fp - ); - -} diff --git a/c/src/exec/score/src/threadmp.c b/c/src/exec/score/src/threadmp.c deleted file mode 100644 index 58a183ba87..0000000000 --- a/c/src/exec/score/src/threadmp.c +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Multiprocessing Support for the Thread Handler - * - * - * 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 -#include -#include -#include -#include - -/*PAGE - * - * _Thread_MP_Handler_initialization - * - */ - -void _Thread_MP_Handler_initialization ( - unsigned32 maximum_proxies -) -{ - - _Chain_Initialize_empty( &_Thread_MP_Active_proxies ); - - if ( maximum_proxies == 0 ) { - _Chain_Initialize_empty( &_Thread_MP_Inactive_proxies ); - return; - } - - - _Chain_Initialize( - &_Thread_MP_Inactive_proxies, - _Workspace_Allocate_or_fatal_error( - maximum_proxies * sizeof( Thread_Proxy_control ) - ), - maximum_proxies, - sizeof( Thread_Proxy_control ) - ); - -} - -/*PAGE - * - * _Thread_MP_Allocate_proxy - * - */ - -Thread_Control *_Thread_MP_Allocate_proxy ( - States_Control the_state -) -{ - Thread_Control *the_thread; - Thread_Proxy_control *the_proxy; - - the_thread = (Thread_Control *)_Chain_Get( &_Thread_MP_Inactive_proxies ); - - if ( !_Thread_Is_null( the_thread ) ) { - - the_proxy = (Thread_Proxy_control *) the_thread; - - _Thread_Executing->Wait.return_code = THREAD_STATUS_PROXY_BLOCKING; - - the_proxy->receive_packet = _Thread_MP_Receive->receive_packet; - - the_proxy->Object.id = _Thread_MP_Receive->receive_packet->source_tid; - - the_proxy->current_priority = - _Thread_MP_Receive->receive_packet->source_priority; - - the_proxy->current_state = _States_Set( STATES_DORMANT, the_state ); - - the_proxy->Wait = _Thread_Executing->Wait; - - _Chain_Append( &_Thread_MP_Active_proxies, &the_proxy->Active ); - - return the_thread; - } - - _Internal_error_Occurred( - INTERNAL_ERROR_CORE, - TRUE, - INTERNAL_ERROR_OUT_OF_PROXIES - ); - - /* - * NOTE: The following return insures that the compiler will - * think that all paths return a value. - */ - - return NULL; -} - -/*PAGE - * - * _Thread_MP_Find_proxy - * - */ - -/* - * The following macro provides the offset of the Active element - * in the Thread_Proxy_control structure. This is the logical - * equivalent of the POSITION attribute in Ada. - */ - -#define _Thread_MP_Proxy_Active_offset \ - ((unsigned32)&(((Thread_Proxy_control *)0))->Active) - -Thread_Control *_Thread_MP_Find_proxy ( - Objects_Id the_id -) -{ - - Chain_Node *proxy_node; - Thread_Control *the_thread; - ISR_Level level; - -restart: - - _ISR_Disable( level ); - - for ( proxy_node = _Thread_MP_Active_proxies.first; - !_Chain_Is_tail( &_Thread_MP_Active_proxies, proxy_node ) ; - ) { - - the_thread = (Thread_Control *) _Addresses_Subtract_offset( - proxy_node, - _Thread_MP_Proxy_Active_offset - ); - - if ( _Objects_Are_ids_equal( the_thread->Object.id, the_id ) ) { - _ISR_Enable( level ); - return the_thread; - } - - _ISR_Flash( level ); - - proxy_node = proxy_node->next; - - /* - * A proxy which is only dormant is not in a blocking state. - * Therefore, we are looking at proxy which has been moved from - * active to inactive chain (by an ISR) and need to restart - * the search. - */ - - if ( _States_Is_only_dormant( the_thread->current_state ) ) { - _ISR_Enable( level ); - goto restart; - } - } - - _ISR_Enable( level ); - return NULL; -} diff --git a/c/src/exec/score/src/threadq.c b/c/src/exec/score/src/threadq.c deleted file mode 100644 index a216a4ffcd..0000000000 --- a/c/src/exec/score/src/threadq.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Thread Queue Handler - * - * - * 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 -#include -#include -#include -#include -#include -#include -#include - -/*PAGE - * - * _Thread_queue_Initialize - * - * This routine initializes the specified threadq. - * - * Input parameters: - * the_thread_queue - pointer to a threadq header - * discipline - queueing discipline - * state - state of waiting threads - * timeout_status - return on a timeout - * - * Output parameters: NONE - */ - -void _Thread_queue_Initialize( - Thread_queue_Control *the_thread_queue, - Thread_queue_Disciplines the_discipline, - States_Control state, - unsigned32 timeout_status -) -{ - unsigned32 index; - - the_thread_queue->state = state; - the_thread_queue->discipline = the_discipline; - the_thread_queue->timeout_status = timeout_status; - the_thread_queue->sync_state = THREAD_QUEUE_SYNCHRONIZED; - - switch ( the_discipline ) { - case THREAD_QUEUE_DISCIPLINE_FIFO: - _Chain_Initialize_empty( &the_thread_queue->Queues.Fifo ); - break; - case THREAD_QUEUE_DISCIPLINE_PRIORITY: - for( index=0 ; - index < TASK_QUEUE_DATA_NUMBER_OF_PRIORITY_HEADERS ; - index++) - _Chain_Initialize_empty( &the_thread_queue->Queues.Priority[index] ); - break; - } - -} diff --git a/c/src/exec/score/src/threadqdequeue.c b/c/src/exec/score/src/threadqdequeue.c deleted file mode 100644 index dcb64099d0..0000000000 --- a/c/src/exec/score/src/threadqdequeue.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Thread Queue Handler - * - * - * 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 -#include -#include -#include -#include -#include -#include -#include - -/*PAGE - * - * _Thread_queue_Dequeue - * - * This routine removes a thread from the specified threadq. If the - * threadq discipline is FIFO, it unblocks a thread, and cancels its - * timeout timer. Priority discipline is processed elsewhere. - * - * Input parameters: - * the_thread_queue - pointer to threadq - * - * Output parameters: - * returns - thread dequeued or NULL - * - * INTERRUPT LATENCY: - * check sync - */ - -Thread_Control *_Thread_queue_Dequeue( - Thread_queue_Control *the_thread_queue -) -{ - Thread_Control *the_thread; - - switch ( the_thread_queue->discipline ) { - case THREAD_QUEUE_DISCIPLINE_FIFO: - the_thread = _Thread_queue_Dequeue_fifo( the_thread_queue ); - break; - case THREAD_QUEUE_DISCIPLINE_PRIORITY: - the_thread = _Thread_queue_Dequeue_priority( the_thread_queue ); - break; - default: /* this is only to prevent warnings */ - the_thread = NULL; - break; - } - - return( the_thread ); -} - diff --git a/c/src/exec/score/src/threadqdequeuefifo.c b/c/src/exec/score/src/threadqdequeuefifo.c deleted file mode 100644 index 2e3c84fe45..0000000000 --- a/c/src/exec/score/src/threadqdequeuefifo.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Thread Queue Handler - * - * - * 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 -#include -#include -#include -#include -#include -#include -#include - -/*PAGE - * - * _Thread_queue_Dequeue_fifo - * - * This routine removes a thread from the specified threadq. - * - * Input parameters: - * the_thread_queue - pointer to threadq - * - * Output parameters: - * returns - thread dequeued or NULL - * - * INTERRUPT LATENCY: - * check sync - * FIFO - */ - -Thread_Control *_Thread_queue_Dequeue_fifo( - Thread_queue_Control *the_thread_queue -) -{ - ISR_Level level; - Thread_Control *the_thread; - - _ISR_Disable( level ); - if ( !_Chain_Is_empty( &the_thread_queue->Queues.Fifo ) ) { - - the_thread = (Thread_Control *) - _Chain_Get_first_unprotected( &the_thread_queue->Queues.Fifo ); - - if ( !_Watchdog_Is_active( &the_thread->Timer ) ) { - _ISR_Enable( level ); - _Thread_Unblock( the_thread ); - } else { - _Watchdog_Deactivate( &the_thread->Timer ); - _ISR_Enable( level ); - (void) _Watchdog_Remove( &the_thread->Timer ); - _Thread_Unblock( the_thread ); - } - -#if defined(RTEMS_MULTIPROCESSING) - if ( !_Objects_Is_local_id( the_thread->Object.id ) ) - _Thread_MP_Free_proxy( the_thread ); -#endif - - return the_thread; - } - - switch ( the_thread_queue->sync_state ) { - case THREAD_QUEUE_SYNCHRONIZED: - case THREAD_QUEUE_SATISFIED: - _ISR_Enable( level ); - return NULL; - - case THREAD_QUEUE_NOTHING_HAPPENED: - case THREAD_QUEUE_TIMEOUT: - the_thread_queue->sync_state = THREAD_QUEUE_SATISFIED; - _ISR_Enable( level ); - return _Thread_Executing; - } - return NULL; /* this is only to prevent warnings */ -} - diff --git a/c/src/exec/score/src/threadqdequeuepriority.c b/c/src/exec/score/src/threadqdequeuepriority.c deleted file mode 100644 index 0ca29eeabf..0000000000 --- a/c/src/exec/score/src/threadqdequeuepriority.c +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Thread Queue Handler - * - * - * 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 -#include -#include -#include -#include -#include -#include -#include - -/*PAGE - * - * _Thread_queue_Dequeue_priority - * - * This routine removes a thread from the specified PRIORITY based - * threadq, unblocks it, and cancels its timeout timer. - * - * Input parameters: - * the_thread_queue - pointer to thread queue - * - * Output parameters: - * returns - thread dequeued or NULL - * - * INTERRUPT LATENCY: - * only case - */ - -Thread_Control *_Thread_queue_Dequeue_priority( - Thread_queue_Control *the_thread_queue -) -{ - unsigned32 index; - ISR_Level level; - Thread_Control *the_thread = NULL; /* just to remove warnings */ - Thread_Control *new_first_thread; - Chain_Node *new_first_node; - Chain_Node *new_second_node; - Chain_Node *last_node; - Chain_Node *next_node; - Chain_Node *previous_node; - - _ISR_Disable( level ); - for( index=0 ; - index < TASK_QUEUE_DATA_NUMBER_OF_PRIORITY_HEADERS ; - index++ ) { - if ( !_Chain_Is_empty( &the_thread_queue->Queues.Priority[ index ] ) ) { - the_thread = (Thread_Control *) - the_thread_queue->Queues.Priority[ index ].first; - goto dequeue; - } - } - - switch ( the_thread_queue->sync_state ) { - case THREAD_QUEUE_SYNCHRONIZED: - case THREAD_QUEUE_SATISFIED: - _ISR_Enable( level ); - return NULL; - - case THREAD_QUEUE_NOTHING_HAPPENED: - case THREAD_QUEUE_TIMEOUT: - the_thread_queue->sync_state = THREAD_QUEUE_SATISFIED; - _ISR_Enable( level ); - return _Thread_Executing; - } - -dequeue: - new_first_node = the_thread->Wait.Block2n.first; - new_first_thread = (Thread_Control *) new_first_node; - next_node = the_thread->Object.Node.next; - previous_node = the_thread->Object.Node.previous; - - if ( !_Chain_Is_empty( &the_thread->Wait.Block2n ) ) { - last_node = the_thread->Wait.Block2n.last; - new_second_node = new_first_node->next; - - previous_node->next = new_first_node; - next_node->previous = new_first_node; - new_first_node->next = next_node; - new_first_node->previous = previous_node; - - if ( !_Chain_Has_only_one_node( &the_thread->Wait.Block2n ) ) { - /* > two threads on 2-n */ - new_second_node->previous = - _Chain_Head( &new_first_thread->Wait.Block2n ); - - new_first_thread->Wait.Block2n.first = new_second_node; - new_first_thread->Wait.Block2n.last = last_node; - - last_node->next = _Chain_Tail( &new_first_thread->Wait.Block2n ); - } - } else { - previous_node->next = next_node; - next_node->previous = previous_node; - } - - if ( !_Watchdog_Is_active( &the_thread->Timer ) ) { - _ISR_Enable( level ); - _Thread_Unblock( the_thread ); - } else { - _Watchdog_Deactivate( &the_thread->Timer ); - _ISR_Enable( level ); - (void) _Watchdog_Remove( &the_thread->Timer ); - _Thread_Unblock( the_thread ); - } - -#if defined(RTEMS_MULTIPROCESSING) - if ( !_Objects_Is_local_id( the_thread->Object.id ) ) - _Thread_MP_Free_proxy( the_thread ); -#endif - return( the_thread ); -} - diff --git a/c/src/exec/score/src/threadqenqueue.c b/c/src/exec/score/src/threadqenqueue.c deleted file mode 100644 index fb4d907c78..0000000000 --- a/c/src/exec/score/src/threadqenqueue.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Thread Queue Handler - * - * - * 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 -#include -#include -#include -#include -#include -#include -#include - -/*PAGE - * - * _Thread_queue_Enqueue - * - * This routine blocks a thread, places it on a thread, and optionally - * starts a timeout timer. - * - * Input parameters: - * the_thread_queue - pointer to threadq - * timeout - interval to wait - * - * Output parameters: NONE - * - * INTERRUPT LATENCY: - * only case - */ - -void _Thread_queue_Enqueue( - Thread_queue_Control *the_thread_queue, - Watchdog_Interval timeout -) -{ - Thread_Control *the_thread; - - the_thread = _Thread_Executing; - -#if defined(RTEMS_MULTIPROCESSING) - if ( _Thread_MP_Is_receive( the_thread ) && the_thread->receive_packet ) - the_thread = _Thread_MP_Allocate_proxy( the_thread_queue->state ); - else -#endif - _Thread_Set_state( the_thread, the_thread_queue->state ); - - if ( timeout ) { - _Watchdog_Initialize( - &the_thread->Timer, - _Thread_queue_Timeout, - the_thread->Object.id, - NULL - ); - - _Watchdog_Insert_ticks( &the_thread->Timer, timeout ); - } - - switch( the_thread_queue->discipline ) { - case THREAD_QUEUE_DISCIPLINE_FIFO: - _Thread_queue_Enqueue_fifo( the_thread_queue, the_thread, timeout ); - break; - case THREAD_QUEUE_DISCIPLINE_PRIORITY: - _Thread_queue_Enqueue_priority( the_thread_queue, the_thread, timeout ); - break; - } -} - diff --git a/c/src/exec/score/src/threadqenqueuefifo.c b/c/src/exec/score/src/threadqenqueuefifo.c deleted file mode 100644 index 5ba902198e..0000000000 --- a/c/src/exec/score/src/threadqenqueuefifo.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Thread Queue Handler - * - * - * 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 -#include -#include -#include -#include -#include -#include -#include - -/*PAGE - * - * _Thread_queue_Enqueue_fifo - * - * This routine blocks a thread, places it on a thread, and optionally - * starts a timeout timer. - * - * Input parameters: - * the_thread_queue - pointer to threadq - * the_thread - pointer to the thread to block - * timeout - interval to wait - * - * Output parameters: NONE - * - * INTERRUPT LATENCY: - * only case - */ - -void _Thread_queue_Enqueue_fifo ( - Thread_queue_Control *the_thread_queue, - Thread_Control *the_thread, - Watchdog_Interval timeout -) -{ - ISR_Level level; - Thread_queue_States sync_state; - - _ISR_Disable( level ); - - sync_state = the_thread_queue->sync_state; - the_thread_queue->sync_state = THREAD_QUEUE_SYNCHRONIZED; - - switch ( sync_state ) { - case THREAD_QUEUE_SYNCHRONIZED: - /* - * This should never happen. It indicates that someone did not - * enter a thread queue critical section. - */ - break; - - case THREAD_QUEUE_NOTHING_HAPPENED: - _Chain_Append_unprotected( - &the_thread_queue->Queues.Fifo, - &the_thread->Object.Node - ); - _ISR_Enable( level ); - return; - - case THREAD_QUEUE_TIMEOUT: - the_thread->Wait.return_code = the_thread->Wait.queue->timeout_status; - _ISR_Enable( level ); - break; - - case THREAD_QUEUE_SATISFIED: - if ( _Watchdog_Is_active( &the_thread->Timer ) ) { - _Watchdog_Deactivate( &the_thread->Timer ); - _ISR_Enable( level ); - (void) _Watchdog_Remove( &the_thread->Timer ); - } else - _ISR_Enable( level ); - break; - } - - /* - * Global objects with thread queue's should not be operated on from an - * ISR. But the sync code still must allow short timeouts to be processed - * correctly. - */ - - _Thread_Unblock( the_thread ); - -#if defined(RTEMS_MULTIPROCESSING) - if ( !_Objects_Is_local_id( the_thread->Object.id ) ) - _Thread_MP_Free_proxy( the_thread ); -#endif - -} - diff --git a/c/src/exec/score/src/threadqenqueuepriority.c b/c/src/exec/score/src/threadqenqueuepriority.c deleted file mode 100644 index a3a49cd7dc..0000000000 --- a/c/src/exec/score/src/threadqenqueuepriority.c +++ /dev/null @@ -1,221 +0,0 @@ -/* - * Thread Queue Handler - * - * - * 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 -#include -#include -#include -#include -#include -#include -#include - -/*PAGE - * - * _Thread_queue_Enqueue_priority - * - * This routine blocks a thread, places it on a thread, and optionally - * starts a timeout timer. - * - * Input parameters: - * the_thread_queue - pointer to threadq - * thread - thread to insert - * timeout - timeout interval in ticks - * - * Output parameters: NONE - * - * INTERRUPT LATENCY: - * forward less than - * forward equal - */ - -void _Thread_queue_Enqueue_priority( - Thread_queue_Control *the_thread_queue, - Thread_Control *the_thread, - Watchdog_Interval timeout -) -{ - Priority_Control search_priority; - Thread_Control *search_thread; - ISR_Level level; - Chain_Control *header; - unsigned32 header_index; - Chain_Node *the_node; - Chain_Node *next_node; - Chain_Node *previous_node; - Chain_Node *search_node; - Priority_Control priority; - States_Control block_state; - Thread_queue_States sync_state; - - _Chain_Initialize_empty( &the_thread->Wait.Block2n ); - - priority = the_thread->current_priority; - header_index = _Thread_queue_Header_number( priority ); - header = &the_thread_queue->Queues.Priority[ header_index ]; - block_state = the_thread_queue->state; - - if ( _Thread_queue_Is_reverse_search( priority ) ) - goto restart_reverse_search; - -restart_forward_search: - search_priority = PRIORITY_MINIMUM - 1; - _ISR_Disable( level ); - search_thread = (Thread_Control *) header->first; - while ( !_Chain_Is_tail( header, (Chain_Node *)search_thread ) ) { - search_priority = search_thread->current_priority; - if ( priority <= search_priority ) - break; - -#if ( CPU_UNROLL_ENQUEUE_PRIORITY == TRUE ) - search_thread = (Thread_Control *) search_thread->Object.Node.next; - if ( _Chain_Is_tail( header, (Chain_Node *)search_thread ) ) - break; - search_priority = search_thread->current_priority; - if ( priority <= search_priority ) - break; -#endif - _ISR_Flash( level ); - if ( !_States_Are_set( search_thread->current_state, block_state) ) { - _ISR_Enable( level ); - goto restart_forward_search; - } - search_thread = - (Thread_Control *)search_thread->Object.Node.next; - } - - if ( the_thread_queue->sync_state != THREAD_QUEUE_NOTHING_HAPPENED ) - goto synchronize; - - the_thread_queue->sync_state = THREAD_QUEUE_SYNCHRONIZED; - - if ( priority == search_priority ) - goto equal_priority; - - search_node = (Chain_Node *) search_thread; - previous_node = search_node->previous; - the_node = (Chain_Node *) the_thread; - - the_node->next = search_node; - the_node->previous = previous_node; - previous_node->next = the_node; - search_node->previous = the_node; - _ISR_Enable( level ); - return; - -restart_reverse_search: - search_priority = PRIORITY_MAXIMUM + 1; - - _ISR_Disable( level ); - search_thread = (Thread_Control *) header->last; - while ( !_Chain_Is_head( header, (Chain_Node *)search_thread ) ) { - search_priority = search_thread->current_priority; - if ( priority >= search_priority ) - break; -#if ( CPU_UNROLL_ENQUEUE_PRIORITY == TRUE ) - search_thread = (Thread_Control *) search_thread->Object.Node.previous; - if ( _Chain_Is_head( header, (Chain_Node *)search_thread ) ) - break; - search_priority = search_thread->current_priority; - if ( priority >= search_priority ) - break; -#endif - _ISR_Flash( level ); - if ( !_States_Are_set( search_thread->current_state, block_state) ) { - _ISR_Enable( level ); - goto restart_reverse_search; - } - search_thread = (Thread_Control *) - search_thread->Object.Node.previous; - } - - if ( the_thread_queue->sync_state != THREAD_QUEUE_NOTHING_HAPPENED ) - goto synchronize; - - the_thread_queue->sync_state = THREAD_QUEUE_SYNCHRONIZED; - - if ( priority == search_priority ) - goto equal_priority; - - search_node = (Chain_Node *) search_thread; - next_node = search_node->next; - the_node = (Chain_Node *) the_thread; - - the_node->next = next_node; - the_node->previous = search_node; - search_node->next = the_node; - next_node->previous = the_node; - _ISR_Enable( level ); - return; - -equal_priority: /* add at end of priority group */ - search_node = _Chain_Tail( &search_thread->Wait.Block2n ); - previous_node = search_node->previous; - the_node = (Chain_Node *) the_thread; - - the_node->next = search_node; - the_node->previous = previous_node; - previous_node->next = the_node; - search_node->previous = the_node; - _ISR_Enable( level ); - return; - -synchronize: - - sync_state = the_thread_queue->sync_state; - the_thread_queue->sync_state = THREAD_QUEUE_SYNCHRONIZED; - - switch ( sync_state ) { - case THREAD_QUEUE_SYNCHRONIZED: - /* - * This should never happen. It indicates that someone did not - * enter a thread queue critical section. - */ - break; - - case THREAD_QUEUE_NOTHING_HAPPENED: - /* - * This should never happen. All of this was dealt with above. - */ - break; - - case THREAD_QUEUE_TIMEOUT: - the_thread->Wait.return_code = the_thread->Wait.queue->timeout_status; - _ISR_Enable( level ); - break; - - case THREAD_QUEUE_SATISFIED: - if ( _Watchdog_Is_active( &the_thread->Timer ) ) { - _Watchdog_Deactivate( &the_thread->Timer ); - _ISR_Enable( level ); - (void) _Watchdog_Remove( &the_thread->Timer ); - } else - _ISR_Enable( level ); - break; - } - - /* - * Global objects with thread queue's should not be operated on from an - * ISR. But the sync code still must allow short timeouts to be processed - * correctly. - */ - - _Thread_Unblock( the_thread ); - -#if defined(RTEMS_MULTIPROCESSING) - if ( !_Objects_Is_local_id( the_thread->Object.id ) ) - _Thread_MP_Free_proxy( the_thread ); -#endif -} - diff --git a/c/src/exec/score/src/threadqextract.c b/c/src/exec/score/src/threadqextract.c deleted file mode 100644 index 0514b2d932..0000000000 --- a/c/src/exec/score/src/threadqextract.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Thread Queue Handler - * - * - * 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 -#include -#include -#include -#include -#include -#include -#include - -/*PAGE - * - * _Thread_queue_Extract - * - * This routine removes a specific thread from the specified threadq, - * deletes any timeout, and unblocks the thread. - * - * Input parameters: - * the_thread_queue - pointer to a threadq header - * the_thread - pointer to a thread control block - * - * Output parameters: NONE - * - * INTERRUPT LATENCY: NONE - */ - -void _Thread_queue_Extract( - Thread_queue_Control *the_thread_queue, - Thread_Control *the_thread -) -{ - switch ( the_thread_queue->discipline ) { - case THREAD_QUEUE_DISCIPLINE_FIFO: - _Thread_queue_Extract_fifo( the_thread_queue, the_thread ); - break; - case THREAD_QUEUE_DISCIPLINE_PRIORITY: - _Thread_queue_Extract_priority( the_thread_queue, the_thread ); - break; - } -} - diff --git a/c/src/exec/score/src/threadqextractfifo.c b/c/src/exec/score/src/threadqextractfifo.c deleted file mode 100644 index d2f23d38ea..0000000000 --- a/c/src/exec/score/src/threadqextractfifo.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Thread Queue Handler - * - * - * 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 -#include -#include -#include -#include -#include -#include -#include - -/*PAGE - * - * _Thread_queue_Extract_fifo - * - * This routine removes a specific thread from the specified threadq, - * deletes any timeout, and unblocks the thread. - * - * Input parameters: - * the_thread_queue - pointer to a threadq header - * the_thread - pointer to the thread to block - * - * Output parameters: NONE - * - * INTERRUPT LATENCY: - * EXTRACT_FIFO - */ - -void _Thread_queue_Extract_fifo( - Thread_queue_Control *the_thread_queue, - Thread_Control *the_thread -) -{ - ISR_Level level; - - _ISR_Disable( level ); - - if ( !_States_Is_waiting_on_thread_queue( the_thread->current_state ) ) { - _ISR_Enable( level ); - return; - } - - _Chain_Extract_unprotected( &the_thread->Object.Node ); - - if ( !_Watchdog_Is_active( &the_thread->Timer ) ) { - _ISR_Enable( level ); - } else { - _Watchdog_Deactivate( &the_thread->Timer ); - _ISR_Enable( level ); - (void) _Watchdog_Remove( &the_thread->Timer ); - } - - _Thread_Unblock( the_thread ); - -#if defined(RTEMS_MULTIPROCESSING) - if ( !_Objects_Is_local_id( the_thread->Object.id ) ) - _Thread_MP_Free_proxy( the_thread ); -#endif - -} - diff --git a/c/src/exec/score/src/threadqextractpriority.c b/c/src/exec/score/src/threadqextractpriority.c deleted file mode 100644 index 57c9c54137..0000000000 --- a/c/src/exec/score/src/threadqextractpriority.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Thread Queue Handler - * - * - * 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 -#include -#include -#include -#include -#include -#include -#include - -/*PAGE - * - * _Thread_queue_Extract_priority - * - * This routine removes a specific thread from the specified threadq, - * deletes any timeout, and unblocks the thread. - * - * Input parameters: - * the_thread_queue - pointer to a threadq header - * the_thread - pointer to a thread control block - * - * Output parameters: NONE - * - * INTERRUPT LATENCY: - * EXTRACT_PRIORITY - */ - -void _Thread_queue_Extract_priority( - Thread_queue_Control *the_thread_queue, - Thread_Control *the_thread -) -{ - ISR_Level level; - Chain_Node *the_node; - Chain_Node *next_node; - Chain_Node *previous_node; - Thread_Control *new_first_thread; - Chain_Node *new_first_node; - Chain_Node *new_second_node; - Chain_Node *last_node; - - the_node = (Chain_Node *) the_thread; - _ISR_Disable( level ); - if ( _States_Is_waiting_on_thread_queue( the_thread->current_state ) ) { - next_node = the_node->next; - previous_node = the_node->previous; - - if ( !_Chain_Is_empty( &the_thread->Wait.Block2n ) ) { - new_first_node = the_thread->Wait.Block2n.first; - new_first_thread = (Thread_Control *) new_first_node; - last_node = the_thread->Wait.Block2n.last; - new_second_node = new_first_node->next; - - previous_node->next = new_first_node; - next_node->previous = new_first_node; - new_first_node->next = next_node; - new_first_node->previous = previous_node; - - if ( !_Chain_Has_only_one_node( &the_thread->Wait.Block2n ) ) { - /* > two threads on 2-n */ - new_second_node->previous = - _Chain_Head( &new_first_thread->Wait.Block2n ); - new_first_thread->Wait.Block2n.first = new_second_node; - - new_first_thread->Wait.Block2n.last = last_node; - last_node->next = _Chain_Tail( &new_first_thread->Wait.Block2n ); - } - } else { - previous_node->next = next_node; - next_node->previous = previous_node; - } - - if ( !_Watchdog_Is_active( &the_thread->Timer ) ) { - _ISR_Enable( level ); - _Thread_Unblock( the_thread ); - } else { - _Watchdog_Deactivate( &the_thread->Timer ); - _ISR_Enable( level ); - (void) _Watchdog_Remove( &the_thread->Timer ); - _Thread_Unblock( the_thread ); - } - -#if defined(RTEMS_MULTIPROCESSING) - if ( !_Objects_Is_local_id( the_thread->Object.id ) ) - _Thread_MP_Free_proxy( the_thread ); -#endif - } - else - _ISR_Enable( level ); -} - diff --git a/c/src/exec/score/src/threadqextractwithproxy.c b/c/src/exec/score/src/threadqextractwithproxy.c deleted file mode 100644 index 5c47b215ae..0000000000 --- a/c/src/exec/score/src/threadqextractwithproxy.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Thread Queue Handler - * - * - * 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 -#include -#include -#include -#include -#include -#include -#include - -/*PAGE - * - * _Thread_queue_Extract_with_proxy - * - * This routine extracts the_thread from the_thread_queue - * and ensures that if there is a proxy for this task on - * another node, it is also dealt with. - * - * XXX - */ - -boolean _Thread_queue_Extract_with_proxy( - Thread_Control *the_thread -) -{ - States_Control state; - Objects_Information *the_information; - Objects_Thread_queue_Extract_callout proxy_extract_callout; - - 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 ) ) { - - the_information = _Objects_Get_information( the_thread->Wait.id ); - - proxy_extract_callout = - (Objects_Thread_queue_Extract_callout) the_information->extract; - - if ( proxy_extract_callout ) - (*proxy_extract_callout)( the_thread ); - } - _Thread_queue_Extract( the_thread->Wait.queue, the_thread ); - - return TRUE; - } - return FALSE; -} - diff --git a/c/src/exec/score/src/threadqfirst.c b/c/src/exec/score/src/threadqfirst.c deleted file mode 100644 index 0057429376..0000000000 --- a/c/src/exec/score/src/threadqfirst.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Thread Queue Handler - * - * - * 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 -#include -#include -#include -#include -#include -#include -#include - -/*PAGE - * - * _Thread_queue_First - * - * This routines returns a pointer to the first thread on the - * specified threadq. - * - * Input parameters: - * the_thread_queue - pointer to thread queue - * - * Output parameters: - * returns - first thread or NULL - */ - -Thread_Control *_Thread_queue_First( - Thread_queue_Control *the_thread_queue -) -{ - Thread_Control *the_thread; - - switch ( the_thread_queue->discipline ) { - case THREAD_QUEUE_DISCIPLINE_FIFO: - the_thread = _Thread_queue_First_fifo( the_thread_queue ); - break; - case THREAD_QUEUE_DISCIPLINE_PRIORITY: - the_thread = _Thread_queue_First_priority( the_thread_queue ); - break; - default: /* this is only to prevent warnings */ - the_thread = NULL; - break; - } - - return the_thread; -} - diff --git a/c/src/exec/score/src/threadqfirstfifo.c b/c/src/exec/score/src/threadqfirstfifo.c deleted file mode 100644 index f1b92f2fd2..0000000000 --- a/c/src/exec/score/src/threadqfirstfifo.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Thread Queue Handler - * - * - * 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 -#include -#include -#include -#include -#include -#include -#include - -/*PAGE - * - * _Thread_queue_First_fifo - * - * This routines returns a pointer to the first thread on the - * specified threadq. - * - * Input parameters: - * the_thread_queue - pointer to threadq - * - * Output parameters: - * returns - first thread or NULL - */ - -Thread_Control *_Thread_queue_First_fifo( - Thread_queue_Control *the_thread_queue -) -{ - if ( !_Chain_Is_empty( &the_thread_queue->Queues.Fifo ) ) - return (Thread_Control *) the_thread_queue->Queues.Fifo.first; - - return NULL; -} - diff --git a/c/src/exec/score/src/threadqfirstpriority.c b/c/src/exec/score/src/threadqfirstpriority.c deleted file mode 100644 index dbab132ef6..0000000000 --- a/c/src/exec/score/src/threadqfirstpriority.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Thread Queue Handler - * - * - * 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 -#include -#include -#include -#include -#include -#include -#include - -/*PAGE - * - * _Thread_queue_First_priority - * - * This routines returns a pointer to the first thread on the - * specified threadq. - * - * Input parameters: - * the_thread_queue - pointer to thread queue - * - * Output parameters: - * returns - first thread or NULL - */ - -Thread_Control *_Thread_queue_First_priority ( - Thread_queue_Control *the_thread_queue -) -{ - unsigned32 index; - - for( index=0 ; - index < TASK_QUEUE_DATA_NUMBER_OF_PRIORITY_HEADERS ; - index++ ) { - if ( !_Chain_Is_empty( &the_thread_queue->Queues.Priority[ index ] ) ) - return (Thread_Control *) - the_thread_queue->Queues.Priority[ index ].first; - } - return NULL; -} diff --git a/c/src/exec/score/src/threadqflush.c b/c/src/exec/score/src/threadqflush.c deleted file mode 100644 index 4d97ff60ab..0000000000 --- a/c/src/exec/score/src/threadqflush.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Thread Queue Handler - * - * - * 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 -#include -#include -#include -#include -#include -#include -#include - -/*PAGE - * - * _Thread_queue_Flush - * - * This kernel routine flushes the given thread queue. - * - * Input parameters: - * 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, - unsigned32 status -) -{ - Thread_Control *the_thread; - - while ( (the_thread = _Thread_queue_Dequeue( the_thread_queue )) ) { -#if defined(RTEMS_MULTIPROCESSING) - if ( !_Objects_Is_local_id( the_thread->Object.id ) ) - ( *remote_extract_callout )( the_thread ); - else -#endif - the_thread->Wait.return_code = status; - } -} - diff --git a/c/src/exec/score/src/threadqtimeout.c b/c/src/exec/score/src/threadqtimeout.c deleted file mode 100644 index 7ac2c04186..0000000000 --- a/c/src/exec/score/src/threadqtimeout.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Thread Queue Handler - * - * - * 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 -#include -#include -#include -#include -#include -#include -#include - -/*PAGE - * - * _Thread_queue_Timeout - * - * This routine processes a thread which timeouts while waiting on - * a thread queue. It is called by the watchdog handler. - * - * Input parameters: - * id - thread id - * - * Output parameters: NONE - */ - -void _Thread_queue_Timeout( - Objects_Id id, - void *ignored -) -{ - Thread_Control *the_thread; - Thread_queue_Control *the_thread_queue; - Objects_Locations location; - - the_thread = _Thread_Get( id, &location ); - switch ( location ) { - case OBJECTS_ERROR: - case OBJECTS_REMOTE: /* impossible */ - break; - case OBJECTS_LOCAL: - the_thread_queue = the_thread->Wait.queue; - - /* - * If the_thread_queue is not synchronized, then it is either - * "nothing happened", "timeout", or "satisfied". If the_thread - * is the executing thread, then it is in the process of blocking - * and it is the thread which is responsible for the synchronization - * process. - * - * If it is not satisfied, then it is "nothing happened" and - * this is the "timeout" transition. After a request is satisfied, - * a timeout is not allowed to occur. - */ - - if ( the_thread_queue->sync_state != THREAD_QUEUE_SYNCHRONIZED && - _Thread_Is_executing( the_thread ) ) { - if ( the_thread_queue->sync_state != THREAD_QUEUE_SATISFIED ) - the_thread_queue->sync_state = THREAD_QUEUE_TIMEOUT; - } else { - the_thread->Wait.return_code = the_thread->Wait.queue->timeout_status; - _Thread_queue_Extract( the_thread->Wait.queue, the_thread ); - } - _Thread_Unnest_dispatch(); - break; - } -} - diff --git a/c/src/exec/score/src/threadready.c b/c/src/exec/score/src/threadready.c deleted file mode 100644 index 35525e787a..0000000000 --- a/c/src/exec/score/src/threadready.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Thread Handler - * - * - * COPYRIGHT (c) 1989-1999. - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/*PAGE - * - * _Thread_Ready - * - * This kernel routine readies the requested thread, the thread chain - * is adjusted. A new heir thread may be selected. - * - * Input parameters: - * the_thread - pointer to thread control block - * - * Output parameters: NONE - * - * NOTE: This routine uses the "blocking" heir selection mechanism. - * This insures the correct heir after a thread restart. - * - * INTERRUPT LATENCY: - * ready chain - * select heir - */ - -void _Thread_Ready( - Thread_Control *the_thread -) -{ - ISR_Level level; - Thread_Control *heir; - - _ISR_Disable( level ); - - the_thread->current_state = STATES_READY; - - _Priority_Add_to_bit_map( &the_thread->Priority_map ); - - _Chain_Append_unprotected( the_thread->ready, &the_thread->Object.Node ); - - _ISR_Flash( level ); - - _Thread_Calculate_heir(); - - heir = _Thread_Heir; - - if ( !_Thread_Is_executing( heir ) && _Thread_Executing->is_preemptible ) - _Context_Switch_necessary = TRUE; - - _ISR_Enable( level ); -} diff --git a/c/src/exec/score/src/threadreset.c b/c/src/exec/score/src/threadreset.c deleted file mode 100644 index 52c975ec17..0000000000 --- a/c/src/exec/score/src/threadreset.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Thread Handler - * - * - * COPYRIGHT (c) 1989-1999. - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* - * _Thread_Reset - * - * DESCRIPTION: - * - * This routine resets a thread to its initial stat but does - * not actually restart it. Some APIs do this in separate - * operations and this division helps support this. - */ - -void _Thread_Reset( - Thread_Control *the_thread, - void *pointer_argument, - unsigned32 numeric_argument -) -{ - the_thread->resource_count = 0; - the_thread->suspend_count = 0; - the_thread->is_preemptible = the_thread->Start.is_preemptible; - the_thread->budget_algorithm = the_thread->Start.budget_algorithm; - the_thread->budget_callout = the_thread->Start.budget_callout; - - the_thread->Start.pointer_argument = pointer_argument; - the_thread->Start.numeric_argument = numeric_argument; - - if ( !_Thread_queue_Extract_with_proxy( the_thread ) ) { - - if ( _Watchdog_Is_active( &the_thread->Timer ) ) - (void) _Watchdog_Remove( &the_thread->Timer ); - } - - if ( the_thread->current_priority != the_thread->Start.initial_priority ) { - the_thread->real_priority = the_thread->Start.initial_priority; - _Thread_Set_priority( the_thread, the_thread->Start.initial_priority ); - } -} - diff --git a/c/src/exec/score/src/threadresettimeslice.c b/c/src/exec/score/src/threadresettimeslice.c deleted file mode 100644 index 480009b403..0000000000 --- a/c/src/exec/score/src/threadresettimeslice.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Thread Handler - * - * - * COPYRIGHT (c) 1989-1999. - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/*PAGE - * - * _Thread_Reset_timeslice - * - * This routine will remove the running thread from the ready chain - * and place it immediately at the rear of this chain and then the - * timeslice counter is reset. The heir THREAD will be updated if - * the running is also the currently the heir. - * - * Input parameters: NONE - * - * Output parameters: NONE - * - * INTERRUPT LATENCY: - * ready chain - * select heir - */ - -void _Thread_Reset_timeslice( void ) -{ - ISR_Level level; - Thread_Control *executing; - Chain_Control *ready; - - executing = _Thread_Executing; - ready = executing->ready; - _ISR_Disable( level ); - if ( _Chain_Has_only_one_node( ready ) ) { - _ISR_Enable( level ); - return; - } - _Chain_Extract_unprotected( &executing->Object.Node ); - _Chain_Append_unprotected( ready, &executing->Object.Node ); - - _ISR_Flash( level ); - - if ( _Thread_Is_heir( executing ) ) - _Thread_Heir = (Thread_Control *) ready->first; - - _Context_Switch_necessary = TRUE; - - _ISR_Enable( level ); -} diff --git a/c/src/exec/score/src/threadrestart.c b/c/src/exec/score/src/threadrestart.c deleted file mode 100644 index f2b6e9ddbb..0000000000 --- a/c/src/exec/score/src/threadrestart.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Thread Handler - * - * - * COPYRIGHT (c) 1989-1999. - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* - * _Thread_Restart - * - * DESCRIPTION: - * - * This support routine restarts the specified task in a way that the - * next time this thread executes, it will begin execution at its - * original starting point. - */ - -boolean _Thread_Restart( - Thread_Control *the_thread, - void *pointer_argument, - unsigned32 numeric_argument -) -{ - if ( !_States_Is_dormant( the_thread->current_state ) ) { - - _Thread_Set_transient( the_thread ); - - _Thread_Reset( the_thread, pointer_argument, numeric_argument ); - - _Thread_Load_environment( the_thread ); - - _Thread_Ready( the_thread ); - - _User_extensions_Thread_restart( the_thread ); - - if ( _Thread_Is_executing ( the_thread ) ) - _Thread_Restart_self(); - - return TRUE; - } - - return FALSE; -} diff --git a/c/src/exec/score/src/threadresume.c b/c/src/exec/score/src/threadresume.c deleted file mode 100644 index 221d6a0fc0..0000000000 --- a/c/src/exec/score/src/threadresume.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Thread Handler - * - * - * COPYRIGHT (c) 1989-1999. - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/*PAGE - * - * _Thread_Resume - * - * This kernel routine clears the SUSPEND state if the suspend_count - * drops below one. If the force parameter is set the suspend_count - * is forced back to zero. The thread ready chain is adjusted if - * necessary and the Heir thread is set accordingly. - * - * Input parameters: - * the_thread - pointer to thread control block - * force - force the suspend count back to 0 - * - * Output parameters: NONE - * - * INTERRUPT LATENCY: - * priority map - * select heir - */ - - -void _Thread_Resume( - Thread_Control *the_thread, - boolean force -) -{ - - ISR_Level level; - States_Control current_state; - - _ISR_Disable( level ); - - if ( force == TRUE ) - the_thread->suspend_count = 0; - else - the_thread->suspend_count--; - - if ( the_thread->suspend_count > 0 ) { - _ISR_Enable( level ); - return; - } - - current_state = the_thread->current_state; - if ( current_state & STATES_SUSPENDED ) { - current_state = - the_thread->current_state = _States_Clear(STATES_SUSPENDED, current_state); - - if ( _States_Is_ready( current_state ) ) { - - _Priority_Add_to_bit_map( &the_thread->Priority_map ); - - _Chain_Append_unprotected(the_thread->ready, &the_thread->Object.Node); - - _ISR_Flash( level ); - - if ( the_thread->current_priority < _Thread_Heir->current_priority ) { - _Thread_Heir = the_thread; - if ( _Thread_Executing->is_preemptible || - the_thread->current_priority == 0 ) - _Context_Switch_necessary = TRUE; - } - } - } - - _ISR_Enable( level ); -} diff --git a/c/src/exec/score/src/threadrotatequeue.c b/c/src/exec/score/src/threadrotatequeue.c deleted file mode 100644 index 0c436e22a9..0000000000 --- a/c/src/exec/score/src/threadrotatequeue.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Thread Handler - * - * - * COPYRIGHT (c) 1989-1999. - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/*PAGE - * - * _Thread_Rotate_Ready_Queue - * - * This kernel routine will rotate the ready queue. - * remove the running THREAD from the ready chain - * and place it immediatly at the rear of this chain. Reset timeslice - * and yield the processor functions both use this routine, therefore if - * reset is TRUE and this is the only thread on the chain then the - * timeslice counter is reset. The heir THREAD will be updated if the - * running is also the currently the heir. - * - * Input parameters: - * Priority of the queue we wish to modify. - * - * Output parameters: NONE - * - * INTERRUPT LATENCY: - * ready chain - * select heir - */ - -void _Thread_Rotate_Ready_Queue( - Priority_Control priority -) -{ - ISR_Level level; - Thread_Control *executing; - Chain_Control *ready; - Chain_Node *node; - - ready = &_Thread_Ready_chain[ priority ]; - executing = _Thread_Executing; - - if ( ready == executing->ready ) { - _Thread_Yield_processor(); - return; - } - - _ISR_Disable( level ); - - if ( !_Chain_Is_empty( ready ) ) { - if (!_Chain_Has_only_one_node( ready ) ) { - node = _Chain_Get_first_unprotected( ready ); - _Chain_Append_unprotected( ready, node ); - } - } - - _ISR_Flash( level ); - - if ( _Thread_Heir->ready == ready ) - _Thread_Heir = (Thread_Control *) ready->first; - - if ( executing != _Thread_Heir ) - _Context_Switch_necessary = TRUE; - - _ISR_Enable( level ); -} - - - - - - diff --git a/c/src/exec/score/src/threadsetpriority.c b/c/src/exec/score/src/threadsetpriority.c deleted file mode 100644 index a4641ae43f..0000000000 --- a/c/src/exec/score/src/threadsetpriority.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Thread Handler - * - * - * COPYRIGHT (c) 1989-1999. - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/*PAGE - * - * _Thread_Set_priority - * - * This directive enables and disables several modes of - * execution for the requesting thread. - * - * Input parameters: - * the_thread - pointer to thread priority - * new_priority - new priority - * - * Output: NONE - */ - -void _Thread_Set_priority( - Thread_Control *the_thread, - Priority_Control new_priority -) -{ - the_thread->current_priority = new_priority; - the_thread->ready = &_Thread_Ready_chain[ new_priority ]; - - _Priority_Initialize_information( &the_thread->Priority_map, new_priority ); -} diff --git a/c/src/exec/score/src/threadsetstate.c b/c/src/exec/score/src/threadsetstate.c deleted file mode 100644 index 286cacd56a..0000000000 --- a/c/src/exec/score/src/threadsetstate.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Thread Handler - * - * - * COPYRIGHT (c) 1989-1999. - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/*PAGE - * - * _Thread_Set_state - * - * This kernel routine sets the requested state in the THREAD. The - * THREAD chain is adjusted if necessary. - * - * Input parameters: - * the_thread - pointer to thread control block - * state - state to be set - * - * Output parameters: NONE - * - * INTERRUPT LATENCY: - * ready chain - * select map - */ - -void _Thread_Set_state( - Thread_Control *the_thread, - States_Control state -) -{ - ISR_Level level; - Chain_Control *ready; - - ready = the_thread->ready; - _ISR_Disable( level ); - if ( !_States_Is_ready( the_thread->current_state ) ) { - the_thread->current_state = - _States_Set( state, the_thread->current_state ); - _ISR_Enable( level ); - return; - } - - the_thread->current_state = state; - - if ( _Chain_Has_only_one_node( ready ) ) { - - _Chain_Initialize_empty( ready ); - _Priority_Remove_from_bit_map( &the_thread->Priority_map ); - - } else - _Chain_Extract_unprotected( &the_thread->Object.Node ); - - _ISR_Flash( level ); - - if ( _Thread_Is_heir( the_thread ) ) - _Thread_Calculate_heir(); - - if ( _Thread_Is_executing( the_thread ) ) - _Context_Switch_necessary = TRUE; - - _ISR_Enable( level ); -} diff --git a/c/src/exec/score/src/threadsettransient.c b/c/src/exec/score/src/threadsettransient.c deleted file mode 100644 index 9a08bddbbb..0000000000 --- a/c/src/exec/score/src/threadsettransient.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Thread Handler - * - * - * COPYRIGHT (c) 1989-1999. - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/*PAGE - * - * _Thread_Set_transient - * - * This kernel routine places the requested thread in the transient state - * which will remove it from the ready queue, if necessary. No - * rescheduling is necessary because it is assumed that the transient - * state will be cleared before dispatching is enabled. - * - * Input parameters: - * the_thread - pointer to thread control block - * - * Output parameters: NONE - * - * INTERRUPT LATENCY: - * only case - */ - -void _Thread_Set_transient( - Thread_Control *the_thread -) -{ - ISR_Level level; - unsigned32 old_state; - Chain_Control *ready; - - ready = the_thread->ready; - _ISR_Disable( level ); - - old_state = the_thread->current_state; - the_thread->current_state = _States_Set( STATES_TRANSIENT, old_state ); - - if ( _States_Is_ready( old_state ) ) { - if ( _Chain_Has_only_one_node( ready ) ) { - - _Chain_Initialize_empty( ready ); - _Priority_Remove_from_bit_map( &the_thread->Priority_map ); - - } else - _Chain_Extract_unprotected( &the_thread->Object.Node ); - } - - _ISR_Enable( level ); - -} diff --git a/c/src/exec/score/src/threadstackallocate.c b/c/src/exec/score/src/threadstackallocate.c deleted file mode 100644 index 583b672f19..0000000000 --- a/c/src/exec/score/src/threadstackallocate.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Thread Handler - * - * - * COPYRIGHT (c) 1989-1999. - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/*PAGE - * - * _Thread_Stack_Allocate - * - * Allocate the requested stack space for the thread. - * return the actual size allocated after any adjustment - * or return zero if the allocation failed. - * Set the Start.stack field to the address of the stack - */ - -unsigned32 _Thread_Stack_Allocate( - Thread_Control *the_thread, - unsigned32 stack_size -) -{ - void *stack_addr = 0; - - if ( !_Stack_Is_enough( stack_size ) ) - stack_size = STACK_MINIMUM_SIZE; - - /* - * Call ONLY the CPU table stack allocate hook, _or_ the - * the RTEMS workspace allocate. This is so the stack free - * routine can call the correct deallocation routine. - */ - - if ( _CPU_Table.stack_allocate_hook ) - { - stack_addr = (*_CPU_Table.stack_allocate_hook)( stack_size ); - } else { - - /* - * First pad the requested size so we allocate enough memory - * so the context initialization can align it properly. The address - * returned the workspace allocate must be directly stored in the - * stack control block because it is later used in the free sequence. - * - * Thus it is the responsibility of the CPU dependent code to - * get and keep the stack adjust factor, the stack alignment, and - * the context initialization sequence in sync. - */ - - stack_size = _Stack_Adjust_size( stack_size ); - stack_addr = _Workspace_Allocate( stack_size ); - } - - if ( !stack_addr ) - stack_size = 0; - - the_thread->Start.stack = stack_addr; - - return stack_size; -} diff --git a/c/src/exec/score/src/threadstackfree.c b/c/src/exec/score/src/threadstackfree.c deleted file mode 100644 index 1a8abeade8..0000000000 --- a/c/src/exec/score/src/threadstackfree.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Thread Handler - * - * - * COPYRIGHT (c) 1989-1999. - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* - * _Thread_Stack_Free - * - * Deallocate the Thread's stack. - */ - -void _Thread_Stack_Free( - Thread_Control *the_thread -) -{ - /* - * If the API provided the stack space, then don't free it. - */ - - if ( !the_thread->Start.core_allocated_stack ) - return; - - /* - * Call ONLY the CPU table stack free hook, or the - * the RTEMS workspace free. This is so the free - * routine properly matches the allocation of the stack. - */ - - if ( _CPU_Table.stack_free_hook ) - (*_CPU_Table.stack_free_hook)( the_thread->Start.Initial_stack.area ); - else - _Workspace_Free( the_thread->Start.Initial_stack.area ); -} diff --git a/c/src/exec/score/src/threadstart.c b/c/src/exec/score/src/threadstart.c deleted file mode 100644 index ac36618c63..0000000000 --- a/c/src/exec/score/src/threadstart.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Thread Handler - * - * - * COPYRIGHT (c) 1989-1999. - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* - * _Thread_Start - * - * DESCRIPTION: - * - * This routine initializes the executable information for a thread - * and makes it ready to execute. After this routine executes, the - * thread competes with all other threads for CPU time. - */ - -boolean _Thread_Start( - Thread_Control *the_thread, - Thread_Start_types the_prototype, - void *entry_point, - void *pointer_argument, - unsigned32 numeric_argument -) -{ - if ( _States_Is_dormant( the_thread->current_state ) ) { - - the_thread->Start.entry_point = (Thread_Entry) entry_point; - - the_thread->Start.prototype = the_prototype; - the_thread->Start.pointer_argument = pointer_argument; - the_thread->Start.numeric_argument = numeric_argument; - - _Thread_Load_environment( the_thread ); - - _Thread_Ready( the_thread ); - - _User_extensions_Thread_start( the_thread ); - - return TRUE; - } - - return FALSE; - -} diff --git a/c/src/exec/score/src/threadstartmultitasking.c b/c/src/exec/score/src/threadstartmultitasking.c deleted file mode 100644 index 0e58f77420..0000000000 --- a/c/src/exec/score/src/threadstartmultitasking.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Thread Handler - * - * - * COPYRIGHT (c) 1989-1999. - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/*PAGE - * - * _Thread_Start_multitasking - * - * This kernel routine readies the requested thread, the thread chain - * is adjusted. A new heir thread may be selected. - * - * Input parameters: - * system_thread - pointer to system initialization thread control block - * idle_thread - pointer to idle thread control block - * - * Output parameters: NONE - * - * NOTE: This routine uses the "blocking" heir selection mechanism. - * This insures the correct heir after a thread restart. - * - * INTERRUPT LATENCY: - * ready chain - * select heir - */ - -void _Thread_Start_multitasking( void ) -{ - /* - * The system is now multitasking and completely initialized. - * This system thread now either "goes away" in a single processor - * system or "turns into" the server thread in an MP system. - */ - - _System_state_Set( SYSTEM_STATE_UP ); - - _Context_Switch_necessary = FALSE; - - _Thread_Executing = _Thread_Heir; - - /* - * Get the init task(s) running. - * - * Note: Thread_Dispatch() is normally used to dispatch threads. As - * part of its work, Thread_Dispatch() restores floating point - * state for the heir task. - * - * This code avoids Thread_Dispatch(), and so we have to restore - * (actually initialize) the floating point state "by hand". - * - * Ignore the CPU_USE_DEFERRED_FP_SWITCH because we must always - * switch in the first thread if it is FP. - */ - - -#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE ) - /* - * don't need to worry about saving BSP's floating point state - */ - - if ( _Thread_Heir->fp_context != NULL ) - _Context_Restore_fp( &_Thread_Heir->fp_context ); -#endif - - _Context_Switch( &_Thread_BSP_context, &_Thread_Heir->Registers ); -} diff --git a/c/src/exec/score/src/threadsuspend.c b/c/src/exec/score/src/threadsuspend.c deleted file mode 100644 index fe66b715e0..0000000000 --- a/c/src/exec/score/src/threadsuspend.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Thread Handler - * - * - * COPYRIGHT (c) 1989-1999. - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/*PAGE - * - * _Thread_Suspend - * - * This kernel routine sets the SUSPEND state in the THREAD. The - * THREAD chain and suspend count are adjusted if necessary. - * - * Input parameters: - * the_thread - pointer to thread control block - * - * Output parameters: NONE - * - * INTERRUPT LATENCY: - * ready chain - * select map - */ - -void _Thread_Suspend( - Thread_Control *the_thread -) -{ - ISR_Level level; - Chain_Control *ready; - - ready = the_thread->ready; - _ISR_Disable( level ); - the_thread->suspend_count++; - if ( !_States_Is_ready( the_thread->current_state ) ) { - the_thread->current_state = - _States_Set( STATES_SUSPENDED, the_thread->current_state ); - _ISR_Enable( level ); - return; - } - - the_thread->current_state = STATES_SUSPENDED; - - if ( _Chain_Has_only_one_node( ready ) ) { - - _Chain_Initialize_empty( ready ); - _Priority_Remove_from_bit_map( &the_thread->Priority_map ); - - } else - _Chain_Extract_unprotected( &the_thread->Object.Node ); - - _ISR_Flash( level ); - - if ( _Thread_Is_heir( the_thread ) ) - _Thread_Calculate_heir(); - - if ( _Thread_Is_executing( the_thread ) ) - _Context_Switch_necessary = TRUE; - - _ISR_Enable( level ); -} diff --git a/c/src/exec/score/src/threadtickletimeslice.c b/c/src/exec/score/src/threadtickletimeslice.c deleted file mode 100644 index 24ef516506..0000000000 --- a/c/src/exec/score/src/threadtickletimeslice.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Thread Handler - * - * - * COPYRIGHT (c) 1989-1999. - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/*PAGE - * - * _Thread_Tickle_timeslice - * - * This scheduler routine determines if timeslicing is enabled - * for the currently executing thread and, if so, updates the - * timeslice count and checks for timeslice expiration. - * - * Input parameters: NONE - * - * Output parameters: NONE - */ - -void _Thread_Tickle_timeslice( void ) -{ - Thread_Control *executing; - - executing = _Thread_Executing; - - /* - * Increment the number of ticks this thread has been executing - */ - - executing->ticks_executed++; - - /* - * If the thread is not preemptible or is not ready, then - * just return. - */ - - if ( !executing->is_preemptible ) - return; - - if ( !_States_Is_ready( executing->current_state ) ) - return; - - /* - * The cpu budget algorithm determines what happens next. - */ - - switch ( executing->budget_algorithm ) { - case THREAD_CPU_BUDGET_ALGORITHM_NONE: - break; - - case THREAD_CPU_BUDGET_ALGORITHM_RESET_TIMESLICE: - case THREAD_CPU_BUDGET_ALGORITHM_EXHAUST_TIMESLICE: - if ( --executing->cpu_time_budget == 0 ) { - _Thread_Reset_timeslice(); - executing->cpu_time_budget = _Thread_Ticks_per_timeslice; - } - break; - - case THREAD_CPU_BUDGET_ALGORITHM_CALLOUT: - if ( --executing->cpu_time_budget == 0 ) - (*executing->budget_callout)( executing ); - break; - } -} diff --git a/c/src/exec/score/src/threadyieldprocessor.c b/c/src/exec/score/src/threadyieldprocessor.c deleted file mode 100644 index b46a6b1474..0000000000 --- a/c/src/exec/score/src/threadyieldprocessor.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Thread Handler - * - * - * COPYRIGHT (c) 1989-1999. - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/*PAGE - * - * _Thread_Yield_processor - * - * This kernel routine will remove the running THREAD from the ready chain - * and place it immediatly at the rear of this chain. Reset timeslice - * and yield the processor functions both use this routine, therefore if - * reset is TRUE and this is the only thread on the chain then the - * timeslice counter is reset. The heir THREAD will be updated if the - * running is also the currently the heir. - * - * Input parameters: NONE - * - * Output parameters: NONE - * - * INTERRUPT LATENCY: - * ready chain - * select heir - */ - -void _Thread_Yield_processor( void ) -{ - ISR_Level level; - Thread_Control *executing; - Chain_Control *ready; - - executing = _Thread_Executing; - ready = executing->ready; - _ISR_Disable( level ); - if ( !_Chain_Has_only_one_node( ready ) ) { - _Chain_Extract_unprotected( &executing->Object.Node ); - _Chain_Append_unprotected( ready, &executing->Object.Node ); - - _ISR_Flash( level ); - - if ( _Thread_Is_heir( executing ) ) - _Thread_Heir = (Thread_Control *) ready->first; - _Context_Switch_necessary = TRUE; - } - else if ( !_Thread_Is_heir( executing ) ) - _Context_Switch_necessary = TRUE; - - _ISR_Enable( level ); -} diff --git a/c/src/exec/score/src/userext.c b/c/src/exec/score/src/userext.c deleted file mode 100644 index d652c29568..0000000000 --- a/c/src/exec/score/src/userext.c +++ /dev/null @@ -1,203 +0,0 @@ -/* - * User Extension Handler - * - * NOTE: XXX - * - * 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 -#include - -/*PAGE - * - * _User_extensions_Thread_create - */ - -boolean _User_extensions_Thread_create ( - Thread_Control *the_thread -) -{ - Chain_Node *the_node; - User_extensions_Control *the_extension; - boolean status; - - 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.thread_create != NULL ) { - status = (*the_extension->Callouts.thread_create)( - _Thread_Executing, - the_thread - ); - if ( !status ) - return FALSE; - } - } - - return TRUE; -} - -/*PAGE - * - * _User_extensions_Thread_delete - */ - -void _User_extensions_Thread_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.thread_delete != NULL ) - (*the_extension->Callouts.thread_delete)( - _Thread_Executing, - the_thread - ); - } -} - -/*PAGE - * - * _User_extensions_Thread_start - * - */ - -void _User_extensions_Thread_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.thread_start != NULL ) - (*the_extension->Callouts.thread_start)( - _Thread_Executing, - the_thread - ); - } -} - -/*PAGE - * - * _User_extensions_Thread_restart - * - */ - -void _User_extensions_Thread_restart ( - 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.thread_restart != NULL ) - (*the_extension->Callouts.thread_restart)( - _Thread_Executing, - the_thread - ); - } -} - -/*PAGE - * - * _User_extensions_Thread_begin - * - */ - -void _User_extensions_Thread_begin ( - 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.thread_begin != NULL ) - (*the_extension->Callouts.thread_begin)( executing ); - } -} - -/*PAGE - * - * _User_extensions_Thread_exitted - */ - -void _User_extensions_Thread_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.thread_exitted != NULL ) - (*the_extension->Callouts.thread_exitted)( executing ); - } -} - -/*PAGE - * - * _User_extensions_Fatal - */ - -void _User_extensions_Fatal ( - Internal_errors_Source the_source, - boolean is_internal, - 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_source, is_internal, the_error ); - } -} - - diff --git a/c/src/exec/score/src/watchdog.c b/c/src/exec/score/src/watchdog.c deleted file mode 100644 index 1bdbc5ae3d..0000000000 --- a/c/src/exec/score/src/watchdog.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Watchdog Handler - * - * - * 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 -#include -#include - -/*PAGE - * - * _Watchdog_Handler_initialization - * - * This routine initializes the watchdog handler. - * - * Input parameters: NONE - * - * Output parameters: NONE - */ - -void _Watchdog_Handler_initialization( void ) -{ - _Watchdog_Sync_count = 0; - _Watchdog_Sync_level = 0; - _Watchdog_Ticks_since_boot = 0; - - _Chain_Initialize_empty( &_Watchdog_Ticks_chain ); - _Chain_Initialize_empty( &_Watchdog_Seconds_chain ); -} diff --git a/c/src/exec/score/src/watchdogadjust.c b/c/src/exec/score/src/watchdogadjust.c deleted file mode 100644 index 6926743f32..0000000000 --- a/c/src/exec/score/src/watchdogadjust.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Watchdog Handler - * - * - * 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 -#include -#include - -/*PAGE - * - * _Watchdog_Adjust - * - * This routine adjusts the delta chain backward or forward in response - * to a time change. - * - * Input parameters: - * header - pointer to the delta chain to be adjusted - * direction - forward or backward adjustment to delta chain - * units - units to adjust - * - * Output parameters: - */ - -void _Watchdog_Adjust( - Chain_Control *header, - Watchdog_Adjust_directions direction, - Watchdog_Interval units -) -{ - if ( !_Chain_Is_empty( header ) ) { - switch ( direction ) { - case WATCHDOG_BACKWARD: - _Watchdog_First( header )->delta_interval += units; - break; - case WATCHDOG_FORWARD: - while ( units ) { - if ( units < _Watchdog_First( header )->delta_interval ) { - _Watchdog_First( header )->delta_interval -= units; - break; - } else { - units -= _Watchdog_First( header )->delta_interval; - _Watchdog_First( header )->delta_interval = 1; - _Watchdog_Tickle( header ); - if ( _Chain_Is_empty( header ) ) - break; - } - } - break; - } - } -} - diff --git a/c/src/exec/score/src/watchdoginsert.c b/c/src/exec/score/src/watchdoginsert.c deleted file mode 100644 index 43c1eacd76..0000000000 --- a/c/src/exec/score/src/watchdoginsert.c +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Watchdog Handler - * - * - * 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 -#include -#include - -/*PAGE - * - * _Watchdog_Insert - * - * This routine inserts a watchdog timer on to the appropriate delta - * chain while updating the delta interval counters. - */ - -void _Watchdog_Insert( - Chain_Control *header, - Watchdog_Control *the_watchdog -) -{ - ISR_Level level; - Watchdog_Control *after; - unsigned32 insert_isr_nest_level; - Watchdog_Interval delta_interval; - - - insert_isr_nest_level = _ISR_Nest_level; - the_watchdog->state = WATCHDOG_BEING_INSERTED; - - _Watchdog_Sync_count++; -restart: - delta_interval = the_watchdog->initial; - - _ISR_Disable( level ); - - for ( after = _Watchdog_First( header ) ; - ; - after = _Watchdog_Next( after ) ) { - - if ( delta_interval == 0 || !_Watchdog_Next( after ) ) - break; - - if ( delta_interval < after->delta_interval ) { - after->delta_interval -= delta_interval; - break; - } - - delta_interval -= after->delta_interval; - - /* - * If you experience problems comment out the _ISR_Flash line. - * 3.2.0 was the first release with this critical section redesigned. - * Under certain circumstances, the PREVIOUS critical section algorithm - * used around this flash point allowed interrupts to execute - * which violated the design assumptions. The critical section - * mechanism used here WAS redesigned to address this. - */ - - _ISR_Flash( level ); - - if ( the_watchdog->state != WATCHDOG_BEING_INSERTED ) { - goto exit_insert; - } - - if ( _Watchdog_Sync_level > insert_isr_nest_level ) { - _Watchdog_Sync_level = insert_isr_nest_level; - _ISR_Enable( level ); - goto restart; - } - } - - _Watchdog_Activate( the_watchdog ); - - the_watchdog->delta_interval = delta_interval; - - _Chain_Insert_unprotected( after->Node.previous, &the_watchdog->Node ); - - the_watchdog->start_time = _Watchdog_Ticks_since_boot; - -exit_insert: - _Watchdog_Sync_level = insert_isr_nest_level; - _Watchdog_Sync_count--; - _ISR_Enable( level ); -} - diff --git a/c/src/exec/score/src/watchdogremove.c b/c/src/exec/score/src/watchdogremove.c deleted file mode 100644 index f3b5d8e5a1..0000000000 --- a/c/src/exec/score/src/watchdogremove.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Watchdog Handler - * - * - * 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 -#include -#include - -/*PAGE - * - * _Watchdog_Remove - * - * The routine removes a watchdog from a delta chain and updates - * the delta counters of the remaining watchdogs. - */ - -Watchdog_States _Watchdog_Remove( - Watchdog_Control *the_watchdog -) -{ - ISR_Level level; - Watchdog_States previous_state; - Watchdog_Control *next_watchdog; - - _ISR_Disable( level ); - previous_state = the_watchdog->state; - switch ( previous_state ) { - case WATCHDOG_INACTIVE: - break; - - case WATCHDOG_BEING_INSERTED: - - /* - * It is not actually on the chain so just change the state and - * the Insert operation we interrupted will be aborted. - */ - the_watchdog->state = WATCHDOG_INACTIVE; - break; - - case WATCHDOG_ACTIVE: - case WATCHDOG_REMOVE_IT: - - the_watchdog->state = WATCHDOG_INACTIVE; - next_watchdog = _Watchdog_Next( the_watchdog ); - - if ( _Watchdog_Next(next_watchdog) ) - next_watchdog->delta_interval += the_watchdog->delta_interval; - - if ( _Watchdog_Sync_count ) - _Watchdog_Sync_level = _ISR_Nest_level; - - _Chain_Extract_unprotected( &the_watchdog->Node ); - break; - } - the_watchdog->stop_time = _Watchdog_Ticks_since_boot; - - _ISR_Enable( level ); - return( previous_state ); -} - diff --git a/c/src/exec/score/src/watchdogtickle.c b/c/src/exec/score/src/watchdogtickle.c deleted file mode 100644 index fe07f566ff..0000000000 --- a/c/src/exec/score/src/watchdogtickle.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Watchdog Handler - * - * - * 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 -#include -#include - -/*PAGE - * - * _Watchdog_Tickle - * - * This routine decrements the delta counter in response to a tick. The - * delta chain is updated accordingly. - * - * Input parameters: - * header - pointer to the delta chain to be tickled - * - * Output parameters: NONE - */ - -void _Watchdog_Tickle( - Chain_Control *header -) -{ - Watchdog_Control *the_watchdog; - - if ( _Chain_Is_empty( header ) ) - return; - - the_watchdog = _Watchdog_First( header ); - the_watchdog->delta_interval--; - if ( the_watchdog->delta_interval != 0 ) - return; - - do { - switch( _Watchdog_Remove( the_watchdog ) ) { - case WATCHDOG_ACTIVE: - (*the_watchdog->routine)( - the_watchdog->id, - the_watchdog->user_data - ); - break; - - case WATCHDOG_INACTIVE: - /* - * This state indicates that the watchdog is not on any chain. - * Thus, it is NOT on a chain being tickled. This case should - * never occur. - */ - break; - - case WATCHDOG_BEING_INSERTED: - /* - * This state indicates that the watchdog is in the process of - * BEING inserted on the chain. Thus, it can NOT be on a chain - * being tickled. This case should never occur. - */ - break; - - case WATCHDOG_REMOVE_IT: - break; - } - the_watchdog = _Watchdog_First( header ); - } while ( !_Chain_Is_empty( header ) && - (the_watchdog->delta_interval == 0) ); -} diff --git a/c/src/exec/score/src/wkspace.c b/c/src/exec/score/src/wkspace.c deleted file mode 100644 index 4ae6c6c118..0000000000 --- a/c/src/exec/score/src/wkspace.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Workspace Handler - * - * XXX - * - * NOTE: - * - * 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 -#include -#include - -/*PAGE - * - * _Workspace_Handler_initialization - */ - -void _Workspace_Handler_initialization( - void *starting_address, - unsigned32 size -) -{ - unsigned32 *zero_out_array; - unsigned32 index; - unsigned32 memory_available; - - 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 ; - index < size / sizeof( unsigned32 ) ; - index++ ) - zero_out_array[ index ] = 0; - } - - memory_available = _Heap_Initialize( - &_Workspace_Area, - starting_address, - size, - CPU_HEAP_ALIGNMENT - ); - - if ( memory_available == 0 ) - _Internal_error_Occurred( - INTERNAL_ERROR_CORE, - TRUE, - INTERNAL_ERROR_TOO_LITTLE_WORKSPACE - ); -} - -/*PAGE - * - * _Workspace_Allocate_or_fatal_error - * - */ - -void *_Workspace_Allocate_or_fatal_error( - unsigned32 size -) -{ - void *memory; - - memory = _Workspace_Allocate( size ); - - if ( memory == NULL ) - _Internal_error_Occurred( - INTERNAL_ERROR_CORE, - TRUE, - INTERNAL_ERROR_WORKSPACE_ALLOCATION - ); - - return memory; -} -- cgit v1.2.3